import { get } from '@theme-ui/css' /** * * COPIED FROM @theme-ui/css UNTIL EXPORTS ARE MERGED + PUBLISHED */ export const aliases = { bg: 'backgroundColor', m: 'margin', mt: 'marginTop', mr: 'marginRight', mb: 'marginBottom', ml: 'marginLeft', mx: 'marginX', my: 'marginY', p: 'padding', pt: 'paddingTop', pr: 'paddingRight', pb: 'paddingBottom', pl: 'paddingLeft', px: 'paddingX', py: 'paddingY', } export const positiveOrNegative = (scale: object, value: string | number) => { if (typeof value !== 'number' || value >= 0) { return get(scale, value, value) } const absolute = Math.abs(value) const n = get(scale, absolute, absolute) if (typeof n === 'string') return '-' + n return Number(n) * -1 } export const scales = { color: 'colors', backgroundColor: 'colors', borderColor: 'colors', margin: 'space', marginTop: 'space', marginRight: 'space', marginBottom: 'space', marginLeft: 'space', marginX: 'space', marginY: 'space', padding: 'space', paddingTop: 'space', paddingRight: 'space', paddingBottom: 'space', paddingLeft: 'space', paddingX: 'space', paddingY: 'space', top: 'space', right: 'space', bottom: 'space', left: 'space', gridGap: 'space', gridColumnGap: 'space', gridRowGap: 'space', gap: 'space', columnGap: 'space', rowGap: 'space', fontFamily: 'fonts', fontSize: 'fontSizes', fontWeight: 'fontWeights', lineHeight: 'lineHeights', letterSpacing: 'letterSpacings', border: 'borders', borderTop: 'borders', borderRight: 'borders', borderBottom: 'borders', borderLeft: 'borders', borderWidth: 'borderWidths', borderStyle: 'borderStyles', borderRadius: 'radii', borderTopRightRadius: 'radii', borderTopLeftRadius: 'radii', borderBottomRightRadius: 'radii', borderBottomLeftRadius: 'radii', borderTopWidth: 'borderWidths', borderTopColor: 'colors', borderTopStyle: 'borderStyles', borderBottomWidth: 'borderWidths', borderBottomColor: 'colors', borderBottomStyle: 'borderStyles', borderLeftWidth: 'borderWidths', borderLeftColor: 'colors', borderLeftStyle: 'borderStyles', borderRightWidth: 'borderWidths', borderRightColor: 'colors', borderRightStyle: 'borderStyles', outlineColor: 'colors', boxShadow: 'shadows', textShadow: 'shadows', zIndex: 'zIndices', width: 'sizes', minWidth: 'sizes', maxWidth: 'sizes', height: 'sizes', minHeight: 'sizes', maxHeight: 'sizes', flexBasis: 'sizes', size: 'sizes', // svg fill: 'colors', stroke: 'colors', }