@codecademy/variance 0.20.0 → 0.20.1-alpha.32ef98.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/core.js +183 -245
  3. package/dist/createTheme/createTheme.js +58 -132
  4. package/dist/createTheme/createTheme.test.js +159 -184
  5. package/dist/createTheme/index.js +2 -1
  6. package/dist/createTheme/types.js +2 -0
  7. package/dist/index.js +2 -1
  8. package/dist/scales/createScale.js +2 -3
  9. package/dist/scales/createScaleLookup.js +13 -23
  10. package/dist/src/core.d.ts +10 -0
  11. package/dist/src/core.js +189 -0
  12. package/dist/src/core.js.map +1 -0
  13. package/dist/src/createTheme/createTheme.test.d.ts +1 -0
  14. package/dist/src/createTheme/createTheme.test.js +167 -0
  15. package/dist/src/createTheme/createTheme.test.js.map +1 -0
  16. package/dist/src/index.d.ts +5 -0
  17. package/dist/src/index.js +6 -0
  18. package/dist/src/index.js.map +1 -0
  19. package/dist/src/utils/__fixtures__/testConfig.d.ts +153 -0
  20. package/dist/src/utils/__fixtures__/testConfig.js +94 -0
  21. package/dist/src/utils/__fixtures__/testConfig.js.map +1 -0
  22. package/dist/transforms/index.js +2 -1
  23. package/dist/transforms/transformSize.js +24 -45
  24. package/dist/types/config.js +2 -0
  25. package/dist/types/properties.js +2 -0
  26. package/dist/types/props.js +2 -0
  27. package/dist/types/theme.js +2 -0
  28. package/dist/types/utils.js +2 -0
  29. package/dist/utils/__fixtures__/testConfig.js +94 -153
  30. package/dist/utils/flattenScale.js +16 -22
  31. package/dist/utils/getStaticProperties.js +2 -5
  32. package/dist/utils/propNames.js +57 -43
  33. package/dist/utils/responsive.js +57 -86
  34. package/dist/utils/serializeTokens.js +30 -39
  35. package/package.json +3 -3
@@ -0,0 +1,189 @@
1
+ import { get, identity, isArray, isObject, isUndefined, merge } from 'lodash';
2
+ import { createScaleLookup } from './scales/createScaleLookup';
3
+ import { getStaticCss } from './utils/getStaticProperties';
4
+ import { orderPropNames } from './utils/propNames';
5
+ import { arrayParser, isMediaArray, isMediaMap, objectParser, orderBreakpoints, parseBreakpoints, } from './utils/responsive';
6
+ export const variance = {
7
+ // Parser to handle any set of configured props
8
+ createParser(config) {
9
+ const propNames = orderPropNames(config);
10
+ let breakpoints;
11
+ const parser = (props) => {
12
+ const styles = {};
13
+ const { theme } = props;
14
+ // Attempt to cache the breakpoints if we have not yet or if theme has become available.
15
+ if (breakpoints === undefined ||
16
+ (breakpoints === null && theme?.breakpoints)) {
17
+ // Save the breakpoints if we can
18
+ breakpoints = parseBreakpoints(theme?.breakpoints);
19
+ }
20
+ // Loops over all prop names on the configured config to check for configured styles
21
+ propNames.forEach((prop) => {
22
+ const property = config[prop];
23
+ const value = get(props, prop);
24
+ switch (typeof value) {
25
+ case 'string':
26
+ case 'number':
27
+ case 'function':
28
+ return Object.assign(styles, property.styleFn(value, prop, props));
29
+ // handle any props configured with the responsive notation
30
+ case 'object':
31
+ if (!breakpoints) {
32
+ return;
33
+ }
34
+ // If it is an array the order of values is smallest to largest: [_, xs, ...]
35
+ if (isMediaArray(value)) {
36
+ return merge(styles, arrayParser(value, props, property, breakpoints.array));
37
+ }
38
+ // Check to see if value is an object matching the responsive syntax and generate the styles.
39
+ if (isMediaMap(value)) {
40
+ return merge(styles, objectParser(value, props, property, breakpoints.map));
41
+ }
42
+ }
43
+ });
44
+ return breakpoints ? orderBreakpoints(styles, breakpoints.array) : styles;
45
+ };
46
+ // return the parser function with the resulting meta information for further composition
47
+ return Object.assign(parser, { propNames, config });
48
+ },
49
+ // Given a single property configuration enrich the config with a transform function
50
+ // that traverses the properties the function is responsible for.
51
+ createTransform(prop, config) {
52
+ const { transform = identity, property, properties = [property], scale, } = config;
53
+ const getScaleValue = createScaleLookup(scale);
54
+ const alwaysTransform = scale === undefined || isArray(scale);
55
+ return {
56
+ ...config,
57
+ prop,
58
+ styleFn: (value, prop, props) => {
59
+ const styles = {};
60
+ if (isUndefined(value)) {
61
+ return styles;
62
+ }
63
+ let useTransform = false;
64
+ let intermediateValue;
65
+ let scaleValue;
66
+ switch (typeof value) {
67
+ case 'number':
68
+ case 'string':
69
+ scaleValue = getScaleValue(value, props);
70
+ useTransform = scaleValue !== undefined || alwaysTransform;
71
+ intermediateValue = scaleValue ?? value;
72
+ break;
73
+ case 'function':
74
+ if (props.theme) {
75
+ intermediateValue = value(props.theme);
76
+ }
77
+ break;
78
+ default:
79
+ return styles;
80
+ }
81
+ // for each property look up the scale value from theme if passed and apply any
82
+ // final transforms to the value
83
+ properties.forEach((property) => {
84
+ let styleValue = intermediateValue;
85
+ if (useTransform && !isUndefined(styleValue)) {
86
+ styleValue = transform(styleValue, property, props);
87
+ }
88
+ switch (typeof styleValue) {
89
+ case 'number':
90
+ case 'string':
91
+ return (styles[property] = styleValue);
92
+ case 'object':
93
+ return Object.assign(styles, styleValue);
94
+ default:
95
+ }
96
+ });
97
+ // return the resulting styles object
98
+ return styles;
99
+ },
100
+ };
101
+ },
102
+ compose(...parsers) {
103
+ return this.createParser(parsers.reduce((carry, parser) => ({ ...carry, ...parser.config }), {}));
104
+ },
105
+ createCss(config) {
106
+ const parser = this.create(config);
107
+ const filteredProps = parser.propNames;
108
+ return (cssProps) => {
109
+ let cache;
110
+ const allKeys = Object.keys(cssProps);
111
+ /** Any key of the CSSProps that is not a System Prop or a Static CSS Property is treated as a nested selector */
112
+ const selectors = allKeys.filter((key) => !filteredProps.includes(key) && isObject(cssProps[key]));
113
+ /** Static CSS Properties get extracted if they match neither syntax */
114
+ const staticCss = getStaticCss(cssProps, [
115
+ 'theme',
116
+ ...selectors,
117
+ ...filteredProps,
118
+ ]);
119
+ return ({ theme }) => {
120
+ if (cache)
121
+ return cache;
122
+ const css = parser({ ...cssProps, theme });
123
+ selectors.forEach((selector) => {
124
+ const selectorConfig = cssProps[selector] ?? {};
125
+ css[selector] = {
126
+ ...getStaticCss(selectorConfig, filteredProps),
127
+ ...parser({ ...selectorConfig, theme }),
128
+ };
129
+ });
130
+ /** Merge the static and generated css and save it to the cache */
131
+ cache = {
132
+ ...staticCss,
133
+ ...css,
134
+ };
135
+ return cache;
136
+ };
137
+ };
138
+ },
139
+ createVariant(config) {
140
+ const css = this.createCss(config);
141
+ return ({ prop = 'variant', defaultVariant, base = {}, variants }) => {
142
+ const baseFn = css(base);
143
+ const variantFns = {};
144
+ Object.keys(variants).forEach((key) => {
145
+ const variantKey = key;
146
+ const cssProps = variants[variantKey];
147
+ variantFns[variantKey] = css(cssProps);
148
+ });
149
+ return (props) => {
150
+ const { [prop]: selected = defaultVariant } = props;
151
+ const styles = {};
152
+ if (!selected)
153
+ return styles;
154
+ return merge(styles, baseFn(props), variantFns?.[selected]?.(props));
155
+ };
156
+ };
157
+ },
158
+ createStates(config) {
159
+ const css = this.createCss(config);
160
+ return (states) => {
161
+ const orderedStates = Object.keys(states);
162
+ const stateFns = {};
163
+ orderedStates.forEach((key) => {
164
+ const stateKey = key;
165
+ const cssProps = states[stateKey];
166
+ stateFns[stateKey] = css(cssProps);
167
+ });
168
+ return (props) => {
169
+ const styles = {};
170
+ orderedStates.forEach((state) => {
171
+ merge(styles, props[state] && stateFns[state](props));
172
+ });
173
+ return styles;
174
+ };
175
+ };
176
+ },
177
+ create(config) {
178
+ const transforms = {};
179
+ // Create a transform function for each of the props
180
+ for (const prop in config) {
181
+ if (typeof prop === 'string') {
182
+ transforms[prop] = this.createTransform(prop, config[prop]);
183
+ }
184
+ }
185
+ // Create a parser that handles all the props within the config
186
+ return this.createParser(transforms);
187
+ },
188
+ };
189
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,4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M,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAE1C,MAAM,QAAQ,GAAG,EAAoD,CAAC;YAEtE,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC5B,MAAM,QAAQ,GAAG,GAAW,CAAC;gBAC7B,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;gBAClC,QAAQ,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,QAAe,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,KAAK,EAAE,EAAE;gBACf,MAAM,MAAM,GAAG,EAAE,CAAC;gBAClB,aAAa,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;oBAC9B,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;gBACxD,CAAC,CAAC,CAAC;gBAEH,OAAO,MAAM,CAAC;YAChB,CAAC,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;IACD,MAAM,CAAsC,MAAc;QACxD,MAAM,UAAU,GAAG,EAA4B,CAAC;QAEhD,oDAAoD;QACpD,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE;YACzB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;gBAC5B,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;aAC7D;SACF;QAED,+DAA+D;QAC/D,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;CACF,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,167 @@
1
+ import { mapValues } from 'lodash';
2
+ import { createTheme } from './createTheme';
3
+ describe('createTheme', () => {
4
+ const base = {
5
+ breakpoints: { xs: '1', sm: '2', md: '3', lg: '4', xl: '5' },
6
+ };
7
+ it('works', () => {
8
+ expect(createTheme(base).build()).toEqual({
9
+ ...base,
10
+ _variables: {},
11
+ _tokens: {},
12
+ });
13
+ });
14
+ it('adds a scale', () => {
15
+ const theme = createTheme(base)
16
+ .addScale('test', () => ({
17
+ test: 1,
18
+ test2: 2,
19
+ }))
20
+ .build();
21
+ expect(theme.test).toEqual({ test: 1, test2: 2 });
22
+ });
23
+ it('updates a scale', () => {
24
+ const builder = createTheme(base).addScale('test', () => ({
25
+ test: 1,
26
+ test2: 2,
27
+ }));
28
+ expect(builder.build().test).toEqual({ test: 1, test2: 2 });
29
+ builder.updateScale('test', () => ({ test3: 3 }));
30
+ expect(builder.build().test).toEqual({ test: 1, test2: 2, test3: 3 });
31
+ });
32
+ it('serializes variables', () => {
33
+ const theme = createTheme(base)
34
+ .addScale('test', () => ({
35
+ test: 1,
36
+ test2: 2,
37
+ }))
38
+ .createScaleVariables('test')
39
+ .build();
40
+ expect(theme.test).toEqual({
41
+ test: 'var(--test-test)',
42
+ test2: 'var(--test-test2)',
43
+ });
44
+ expect(theme._variables.root).toEqual({
45
+ '--test-test': 1,
46
+ '--test-test2': 2,
47
+ });
48
+ });
49
+ describe('colors', () => {
50
+ const staticColors = {
51
+ white: 'white',
52
+ black: 'black',
53
+ blue: 'blue',
54
+ green: 'green',
55
+ red: 'red',
56
+ };
57
+ const cssVariableReferences = mapValues(staticColors, (val) => `var(--color-${val})`);
58
+ const builder = createTheme(base);
59
+ it('creates color variables', () => {
60
+ const theme = builder.addColors(staticColors).build();
61
+ expect(theme.colors).toEqual(cssVariableReferences);
62
+ });
63
+ it('adds colorModes', () => {
64
+ const theme = builder
65
+ .addColors(staticColors)
66
+ .addColorModes('light', {
67
+ light: {
68
+ primary: 'red',
69
+ },
70
+ dark: {
71
+ primary: 'blue',
72
+ },
73
+ })
74
+ .build();
75
+ expect(theme.colors).toEqual({
76
+ ...mapValues(staticColors, (val) => `var(--color-${val})`),
77
+ primary: 'var(--color-primary)',
78
+ });
79
+ expect(theme._variables.mode).toEqual({
80
+ '--color-primary': 'var(--color-red)',
81
+ });
82
+ });
83
+ it('returns value checker for colors', () => {
84
+ const theme = builder
85
+ .addColors({
86
+ black: '#000000',
87
+ white: '#FFFFFF',
88
+ })
89
+ .addColorModes('light', {
90
+ light: {
91
+ primary: 'black',
92
+ },
93
+ dark: {
94
+ primary: 'white',
95
+ },
96
+ })
97
+ .build();
98
+ expect(theme._getColorValue('white')).toEqual('#FFFFFF');
99
+ expect(theme._getColorValue(theme.modes.light.primary)).toEqual('#000000');
100
+ });
101
+ it('returns value checker for colors with deep values', () => {
102
+ const theme = builder
103
+ .addColors({
104
+ black: '#000000',
105
+ white: '#FFFFFF',
106
+ gray: { 200: '#eeeeee', 300: '#666666' },
107
+ })
108
+ .addColorModes('light', {
109
+ light: {
110
+ primary: {
111
+ default: 'gray-200',
112
+ cool: { _: 'gray-300', town: 'black' },
113
+ },
114
+ },
115
+ })
116
+ .build();
117
+ expect(theme._getColorValue('gray-300')).toEqual('#666666');
118
+ expect(theme._getColorValue(theme.modes.light['primary-default'])).toEqual('#eeeeee');
119
+ });
120
+ it('merges color mode configurations when overriden', () => {
121
+ const theme = builder
122
+ .addColors({
123
+ black: '#000000',
124
+ white: '#FFFFFF',
125
+ })
126
+ .addColorModes('light', {
127
+ light: {
128
+ primary: {
129
+ _: 'black',
130
+ hover: 'white',
131
+ },
132
+ },
133
+ })
134
+ .build();
135
+ const override = createTheme(theme)
136
+ .addColorModes('light', {
137
+ light: {
138
+ primary: {
139
+ _: 'white',
140
+ hover: 'black',
141
+ },
142
+ },
143
+ })
144
+ .build();
145
+ expect(override.modes.light.primary).toEqual('white');
146
+ });
147
+ it('returns the raw values of color mode colors on the tokens object', () => {
148
+ const theme = createTheme(base)
149
+ .addColors({
150
+ black: '#000000',
151
+ gray: { 300: '#666666' },
152
+ })
153
+ .addColorModes('light', {
154
+ light: {
155
+ primary: {
156
+ cool: { _: 'gray-300', town: 'black' },
157
+ },
158
+ },
159
+ })
160
+ .build();
161
+ expect(theme._tokens.modes).toEqual({
162
+ light: { 'primary-cool': '#666666', 'primary-cool-town': '#000000' },
163
+ });
164
+ });
165
+ });
166
+ });
167
+ //# sourceMappingURL=createTheme.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTheme.test.js","sourceRoot":"","sources":["../../../src/createTheme/createTheme.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,MAAM,IAAI,GAAG;QACX,WAAW,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE;KAC7D,CAAC;IACF,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACf,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC;YACxC,GAAG,IAAI;YACP,UAAU,EAAE,EAAE;YACd,OAAO,EAAE,EAAE;SACZ,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;QACtB,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC;aAC5B,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YACvB,IAAI,EAAE,CAAC;YACP,KAAK,EAAE,CAAC;SACT,CAAC,CAAC;aACF,KAAK,EAAE,CAAC;QAEX,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iBAAiB,EAAE,GAAG,EAAE;QACzB,MAAM,OA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AC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { variance } from './core';
2
+ export * from './createTheme';
3
+ export * from './types/props';
4
+ export * from './transforms';
5
+ export * from './scales/createScale';
@@ -0,0 +1,6 @@
1
+ export { variance } from './core';
2
+ export * from './createTheme';
3
+ export * from './types/props';
4
+ export * from './transforms';
5
+ export * from './scales/createScale';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,153 @@
1
+ export declare const testConfig: {
2
+ readonly textColor: {
3
+ readonly property: "color";
4
+ };
5
+ readonly bg: {
6
+ readonly property: "backgroundColor";
7
+ };
8
+ readonly borderColor: {
9
+ readonly property: "borderColor";
10
+ };
11
+ readonly borderColorX: {
12
+ readonly property: "borderColor";
13
+ readonly properties: readonly ["borderLeftColor", "borderRightColor"];
14
+ readonly scale: "colors";
15
+ };
16
+ readonly borderColorY: {
17
+ readonly property: "borderColor";
18
+ readonly properties: readonly ["borderTopColor", "borderBottomColor"];
19
+ readonly scale: "colors";
20
+ };
21
+ readonly borderColorLeft: {
22
+ readonly property: "borderLeftColor";
23
+ };
24
+ readonly borderColorRight: {
25
+ readonly property: "borderRightColor";
26
+ };
27
+ readonly borderColorTop: {
28
+ readonly property: "borderTopColor";
29
+ };
30
+ readonly borderColorBottom: {
31
+ readonly property: "borderBottomColor";
32
+ };
33
+ readonly border: {
34
+ readonly property: "border";
35
+ };
36
+ readonly borderX: {
37
+ readonly property: "border";
38
+ readonly properties: readonly ["borderLeft", "borderRight"];
39
+ };
40
+ readonly borderY: {
41
+ readonly property: "border";
42
+ readonly properties: readonly ["borderTop", "borderBottom"];
43
+ };
44
+ readonly borderTop: {
45
+ readonly property: "borderTop";
46
+ };
47
+ readonly borderRight: {
48
+ readonly property: "borderRight";
49
+ };
50
+ readonly borderBottom: {
51
+ readonly property: "borderBottom";
52
+ };
53
+ readonly borderLeft: {
54
+ readonly property: "borderLeft";
55
+ };
56
+ readonly borderWidth: {
57
+ readonly property: "borderWidth";
58
+ };
59
+ readonly borderWidthX: {
60
+ readonly property: "borderWidth";
61
+ readonly properties: readonly ["borderLeftWidth", "borderRightWidth"];
62
+ };
63
+ readonly borderWidthY: {
64
+ readonly property: "borderWidth";
65
+ readonly properties: readonly ["borderTopWidth", "borderBottomWidth"];
66
+ };
67
+ readonly borderRadius: {
68
+ readonly property: "borderRadius";
69
+ };
70
+ readonly borderRadiusLeft: {
71
+ readonly property: "borderRadius";
72
+ readonly properties: readonly ["borderTopLeftRadius", "borderBottomLeftRadius"];
73
+ };
74
+ readonly borderRadiusTop: {
75
+ readonly property: "borderRadius";
76
+ readonly properties: readonly ["borderTopLeftRadius", "borderTopRightRadius"];
77
+ };
78
+ readonly borderRadiusBottom: {
79
+ readonly property: "borderRadius";
80
+ readonly properties: readonly ["borderBottomLeftRadius", "borderBottomRightRadius"];
81
+ };
82
+ readonly borderRadiusRight: {
83
+ readonly property: "borderRadius";
84
+ readonly properties: readonly ["borderTopRightRadius", "borderBottomRightRadius"];
85
+ };
86
+ readonly borderStyle: {
87
+ readonly property: "borderStyle";
88
+ };
89
+ readonly borderStyleX: {
90
+ readonly property: "borderStyle";
91
+ readonly properties: readonly ["borderLeftStyle", "borderRightStyle"];
92
+ };
93
+ readonly borderStyleY: {
94
+ readonly property: "borderStyle";
95
+ readonly properties: readonly ["borderTopStyle", "borderBottomStyle"];
96
+ };
97
+ readonly flex: {
98
+ readonly property: "flex";
99
+ };
100
+ readonly flexBasis: {
101
+ readonly property: "flexBasis";
102
+ };
103
+ readonly p: {
104
+ readonly property: "padding";
105
+ };
106
+ readonly px: {
107
+ readonly property: "padding";
108
+ readonly properties: readonly ["paddingLeft", "paddingRight"];
109
+ readonly scale: "spacing";
110
+ };
111
+ readonly py: {
112
+ readonly property: "padding";
113
+ readonly properties: readonly ["paddingTop", "paddingBottom"];
114
+ readonly scale: "spacing";
115
+ };
116
+ readonly pt: {
117
+ readonly property: "paddingTop";
118
+ };
119
+ readonly pb: {
120
+ readonly property: "paddingBottom";
121
+ };
122
+ readonly pr: {
123
+ readonly property: "paddingRight";
124
+ };
125
+ readonly pl: {
126
+ readonly property: "paddingLeft";
127
+ };
128
+ readonly m: {
129
+ readonly property: "margin";
130
+ };
131
+ readonly mx: {
132
+ readonly property: "margin";
133
+ readonly properties: readonly ["marginLeft", "marginRight"];
134
+ readonly scale: "spacing";
135
+ };
136
+ readonly my: {
137
+ readonly property: "margin";
138
+ readonly properties: readonly ["marginTop", "marginBottom"];
139
+ readonly scale: "spacing";
140
+ };
141
+ readonly mt: {
142
+ readonly property: "marginTop";
143
+ };
144
+ readonly mb: {
145
+ readonly property: "marginBottom";
146
+ };
147
+ readonly mr: {
148
+ readonly property: "marginRight";
149
+ };
150
+ readonly ml: {
151
+ readonly property: "marginLeft";
152
+ };
153
+ };
@@ -0,0 +1,94 @@
1
+ export const testConfig = {
2
+ textColor: { property: 'color' },
3
+ bg: { property: 'backgroundColor' },
4
+ borderColor: { property: 'borderColor' },
5
+ borderColorX: {
6
+ property: 'borderColor',
7
+ properties: ['borderLeftColor', 'borderRightColor'],
8
+ scale: 'colors',
9
+ },
10
+ borderColorY: {
11
+ property: 'borderColor',
12
+ properties: ['borderTopColor', 'borderBottomColor'],
13
+ scale: 'colors',
14
+ },
15
+ borderColorLeft: { property: 'borderLeftColor' },
16
+ borderColorRight: { property: 'borderRightColor' },
17
+ borderColorTop: { property: 'borderTopColor' },
18
+ borderColorBottom: { property: 'borderBottomColor' },
19
+ border: { property: 'border' },
20
+ borderX: { property: 'border', properties: ['borderLeft', 'borderRight'] },
21
+ borderY: { property: 'border', properties: ['borderTop', 'borderBottom'] },
22
+ borderTop: { property: 'borderTop' },
23
+ borderRight: { property: 'borderRight' },
24
+ borderBottom: { property: 'borderBottom' },
25
+ borderLeft: { property: 'borderLeft' },
26
+ borderWidth: { property: 'borderWidth' },
27
+ borderWidthX: {
28
+ property: 'borderWidth',
29
+ properties: ['borderLeftWidth', 'borderRightWidth'],
30
+ },
31
+ borderWidthY: {
32
+ property: 'borderWidth',
33
+ properties: ['borderTopWidth', 'borderBottomWidth'],
34
+ },
35
+ borderRadius: { property: 'borderRadius' },
36
+ borderRadiusLeft: {
37
+ property: 'borderRadius',
38
+ properties: ['borderTopLeftRadius', 'borderBottomLeftRadius'],
39
+ },
40
+ borderRadiusTop: {
41
+ property: 'borderRadius',
42
+ properties: ['borderTopLeftRadius', 'borderTopRightRadius'],
43
+ },
44
+ borderRadiusBottom: {
45
+ property: 'borderRadius',
46
+ properties: ['borderBottomLeftRadius', 'borderBottomRightRadius'],
47
+ },
48
+ borderRadiusRight: {
49
+ property: 'borderRadius',
50
+ properties: ['borderTopRightRadius', 'borderBottomRightRadius'],
51
+ },
52
+ borderStyle: { property: 'borderStyle' },
53
+ borderStyleX: {
54
+ property: 'borderStyle',
55
+ properties: ['borderLeftStyle', 'borderRightStyle'],
56
+ },
57
+ borderStyleY: {
58
+ property: 'borderStyle',
59
+ properties: ['borderTopStyle', 'borderBottomStyle'],
60
+ },
61
+ flex: { property: 'flex' },
62
+ flexBasis: { property: 'flexBasis' },
63
+ p: { property: 'padding' },
64
+ px: {
65
+ property: 'padding',
66
+ properties: ['paddingLeft', 'paddingRight'],
67
+ scale: 'spacing',
68
+ },
69
+ py: {
70
+ property: 'padding',
71
+ properties: ['paddingTop', 'paddingBottom'],
72
+ scale: 'spacing',
73
+ },
74
+ pt: { property: 'paddingTop' },
75
+ pb: { property: 'paddingBottom' },
76
+ pr: { property: 'paddingRight' },
77
+ pl: { property: 'paddingLeft' },
78
+ m: { property: 'margin' },
79
+ mx: {
80
+ property: 'margin',
81
+ properties: ['marginLeft', 'marginRight'],
82
+ scale: 'spacing',
83
+ },
84
+ my: {
85
+ property: 'margin',
86
+ properties: ['marginTop', 'marginBottom'],
87
+ scale: 'spacing',
88
+ },
89
+ mt: { property: 'marginTop' },
90
+ mb: { property: 'marginBottom' },
91
+ mr: { property: 'marginRight' },
92
+ ml: { property: 'marginLeft' },
93
+ };
94
+ //# sourceMappingURL=testConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testConfig.js","sourceRoot":"","sources":["../../../../src/utils/__fixtures__/testConfig.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,SAAS,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE;IAChC,EAAE,EAAE,EAAE,QAAQ,EAAE,iBAAiB,EAAE;IACnC,WAAW,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE;IACxC,YAAY,EAAE;QACZ,QAAQ,EAAE,aAAa;QACvB,UAAU,EAAE,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;QACnD,KAAK,EAAE,QAAQ;KAChB;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,aAAa;QACvB,UAAU,EAAE,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;QACnD,KAAK,EAAE,QAAQ;KAChB;IACD,eAAe,EAAE,EAAE,QAAQ,EAAE,iBAAiB,EAAE;IAChD,gBAAgB,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE;IAClD,cAAc,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE;IAC9C,iBAAiB,EAAE,EAAE,QAAQ,EAAE,mBAAmB,EAAE;IAEpD,MAAM,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE;IAC9B,OAAO,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC,EAAE;IAC1E,OAAO,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,WAAW,EAAE,cAAc,CAAC,EAAE;IAC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