@codecademy/variance 0.19.1-alpha.a809e8.0 → 0.20.1-alpha.447c4d.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 (78) hide show
  1. package/.turbo/turbo-build.log +6 -0
  2. package/CHANGELOG.md +14 -1
  3. package/dist/core.d.ts +10 -0
  4. package/dist/core.js +189 -0
  5. package/dist/core.js.map +1 -0
  6. package/dist/createTheme/createTheme.d.ts +55 -0
  7. package/dist/createTheme/createTheme.js +94 -0
  8. package/dist/createTheme/createTheme.js.map +1 -0
  9. package/dist/createTheme/createTheme.test.d.ts +1 -0
  10. package/dist/createTheme/createTheme.test.js +167 -0
  11. package/dist/createTheme/createTheme.test.js.map +1 -0
  12. package/dist/createTheme/index.d.ts +3 -0
  13. package/dist/createTheme/index.js +4 -0
  14. package/dist/createTheme/index.js.map +1 -0
  15. package/dist/createTheme/types.d.ts +42 -0
  16. package/dist/createTheme/types.js +2 -0
  17. package/dist/createTheme/types.js.map +1 -0
  18. package/dist/index.d.ts +5 -0
  19. package/dist/index.js +6 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/scales/createScale.d.ts +3 -0
  22. package/dist/scales/createScale.js +2 -0
  23. package/dist/scales/createScale.js.map +1 -0
  24. package/dist/scales/createScaleLookup.d.ts +5 -0
  25. package/dist/scales/createScaleLookup.js +14 -0
  26. package/dist/scales/createScaleLookup.js.map +1 -0
  27. package/dist/src/core.d.ts +10 -0
  28. package/dist/src/core.js +189 -0
  29. package/dist/src/core.js.map +1 -0
  30. package/dist/src/createTheme/createTheme.test.d.ts +1 -0
  31. package/dist/src/createTheme/createTheme.test.js +167 -0
  32. package/dist/src/createTheme/createTheme.test.js.map +1 -0
  33. package/dist/src/index.d.ts +5 -0
  34. package/dist/src/index.js +6 -0
  35. package/dist/src/index.js.map +1 -0
  36. package/dist/src/utils/__fixtures__/testConfig.d.ts +153 -0
  37. package/dist/src/utils/__fixtures__/testConfig.js +94 -0
  38. package/dist/src/utils/__fixtures__/testConfig.js.map +1 -0
  39. package/dist/transforms/index.d.ts +1 -0
  40. package/dist/transforms/index.js +2 -0
  41. package/dist/transforms/index.js.map +1 -0
  42. package/dist/transforms/transformSize.d.ts +2 -0
  43. package/dist/transforms/transformSize.js +26 -0
  44. package/dist/transforms/transformSize.js.map +1 -0
  45. package/dist/types/config.d.ts +71 -0
  46. package/dist/types/config.js +2 -0
  47. package/dist/types/config.js.map +1 -0
  48. package/dist/types/properties.d.ts +22 -0
  49. package/dist/types/properties.js +2 -0
  50. package/dist/types/properties.js.map +1 -0
  51. package/dist/types/props.d.ts +47 -0
  52. package/dist/types/props.js +2 -0
  53. package/dist/types/props.js.map +1 -0
  54. package/dist/types/theme.d.ts +17 -0
  55. package/dist/types/theme.js +2 -0
  56. package/dist/types/theme.js.map +1 -0
  57. package/dist/types/utils.d.ts +3 -0
  58. package/dist/types/utils.js +2 -0
  59. package/dist/types/utils.js.map +1 -0
  60. package/dist/utils/__fixtures__/testConfig.d.ts +153 -0
  61. package/dist/utils/__fixtures__/testConfig.js +94 -0
  62. package/dist/utils/__fixtures__/testConfig.js.map +1 -0
  63. package/dist/utils/flattenScale.d.ts +20 -0
  64. package/dist/utils/flattenScale.js +18 -0
  65. package/dist/utils/flattenScale.js.map +1 -0
  66. package/dist/utils/getStaticProperties.d.ts +1 -0
  67. package/dist/utils/getStaticProperties.js +3 -0
  68. package/dist/utils/getStaticProperties.js.map +1 -0
  69. package/dist/utils/propNames.d.ts +6 -0
  70. package/dist/utils/propNames.js +66 -0
  71. package/dist/utils/propNames.js.map +1 -0
  72. package/dist/utils/responsive.d.ts +16 -0
  73. package/dist/utils/responsive.js +65 -0
  74. package/dist/utils/responsive.js.map +1 -0
  75. package/dist/utils/serializeTokens.d.ts +18 -0
  76. package/dist/utils/serializeTokens.js +33 -0
  77. package/dist/utils/serializeTokens.js.map +1 -0
  78. package/package.json +4 -4
@@ -0,0 +1 @@
1
+ export declare const getStaticCss: (props: Record<string, any>, filteredKeys: string[]) => Pick<Record<string, any>, string>;
@@ -0,0 +1,3 @@
1
+ import { keys, pick } from 'lodash';
2
+ export const getStaticCss = (props, filteredKeys) => pick(props, keys(props).filter((key) => !filteredKeys.includes(key)));
3
+ //# sourceMappingURL=getStaticProperties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getStaticProperties.js","sourceRoot":"","sources":["../../src/utils/getStaticProperties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEpC,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,KAA0B,EAC1B,YAAsB,EACtB,EAAE,CACF,IAAI,CACF,KAAK,EACL,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CACzD,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { BaseProperty } from '../types/config';
2
+ /**
3
+ * Orders all properties by the most dependent props
4
+ * @param config
5
+ */
6
+ export declare const orderPropNames: (config: Record<string, BaseProperty>) => string[];
@@ -0,0 +1,66 @@
1
+ const SHORTHAND_PROPERTIES = [
2
+ 'border',
3
+ 'borderTop',
4
+ 'borderBottom',
5
+ 'borderLeft',
6
+ 'borderRight',
7
+ 'borderWidth',
8
+ 'borderStyle',
9
+ 'borderColor',
10
+ 'background',
11
+ 'flex',
12
+ 'margin',
13
+ 'padding',
14
+ 'transition',
15
+ 'gap',
16
+ 'grid',
17
+ 'gridArea',
18
+ 'gridColumn',
19
+ 'gridRow',
20
+ 'gridTemplate',
21
+ 'overflow',
22
+ 'transition',
23
+ ];
24
+ const SORT = {
25
+ A_BEFORE_B: -1,
26
+ B_BEFORE_A: 1,
27
+ EQUAL: 1,
28
+ };
29
+ const compare = (a, b) => {
30
+ if (a < b)
31
+ return SORT.A_BEFORE_B;
32
+ if (b < a)
33
+ return SORT.B_BEFORE_A;
34
+ return SORT.EQUAL;
35
+ };
36
+ /**
37
+ * Orders all properties by the most dependent props
38
+ * @param config
39
+ */
40
+ export const orderPropNames = (config) => Object.keys(config).sort((a, b) => {
41
+ const { [a]: aConf, [b]: bConf } = config;
42
+ const { property: aProp, properties: aProperties = [] } = aConf;
43
+ const { property: bProp, properties: bProperties = [] } = bConf;
44
+ const aIsShorthand = SHORTHAND_PROPERTIES.includes(aProp);
45
+ const bIsShorthand = SHORTHAND_PROPERTIES.includes(bProp);
46
+ if (aIsShorthand && bIsShorthand) {
47
+ const aNum = aProperties.length;
48
+ const bNum = bProperties.length;
49
+ if (aProp !== bProp) {
50
+ return compare(SHORTHAND_PROPERTIES.indexOf(aProp), SHORTHAND_PROPERTIES.indexOf(bProp));
51
+ }
52
+ if (aProp === bProp) {
53
+ if (aNum === 0)
54
+ return SORT.A_BEFORE_B;
55
+ if (bNum === 0)
56
+ return SORT.B_BEFORE_A;
57
+ }
58
+ return compare(bNum, aNum);
59
+ }
60
+ if (aIsShorthand)
61
+ return SORT.A_BEFORE_B;
62
+ if (bIsShorthand)
63
+ return SORT.B_BEFORE_A;
64
+ return SORT.EQUAL;
65
+ });
66
+ //# sourceMappingURL=propNames.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propNames.js","sourceRoot":"","sources":["../../src/utils/propNames.ts"],"names":[],"mappings":"AAEA,MAAM,oBAAoB,GAAG;IAC3B,QAAQ;IACR,WAAW;IACX,cAAc;IACd,YAAY;IACZ,aAAa;IACb,aAAa;IACb,aAAa;IACb,aAAa;IACb,YAAY;IACZ,MAAM;IACN,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,KAAK;IACL,MAAM;IACN,UAAU;IACV,YAAY;IACZ,SAAS;IACT,cAAc;IACd,UAAU;IACV,YAAY;CACb,CAAC;AAEF,MAAM,IAAI,GAAG;IACX,UAAU,EAAE,CAAC,CAAC;IACd,UAAU,EAAE,CAAC;IACb,KAAK,EAAE,CAAC;CACT,CAAC;AAEF,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AAI,CAAC,UAAU,CAAC;YACvC,IAAI,IAAI,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC,UAAU,CAAC;SACxC;QAED,OAAO,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;KAC5B;IAED,IAAI,YAAY;QAAE,OAAO,IAAI,CAAC,UAAU,CAAC;IACzC,IAAI,YAAY;QAAE,OAAO,IAAI,CAAC,UAAU,CAAC;IAEzC,OAAO,IAAI,CAAC,KAAK,CAAC;AACpB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { AbstractPropTransformer } from '../types/config';
2
+ import { BreakpointCache, CSSObject, MediaQueryMap, ThemeProps } from '../types/props';
3
+ import { Breakpoints } from '../types/theme';
4
+ /**
5
+ * Destructures the themes breakpoints into an ordered structure to traverse
6
+ */
7
+ export declare const parseBreakpoints: (breakpoints?: Breakpoints | undefined) => BreakpointCache | null;
8
+ export declare const isMediaArray: (val: unknown) => val is (string | number)[];
9
+ export declare const isMediaMap: (val: object) => val is MediaQueryMap<string | number>;
10
+ interface ResponsiveParser<Bp extends MediaQueryMap<string | number> | (string | number)[]> {
11
+ <C extends AbstractPropTransformer>(value: Bp, props: ThemeProps, config: C, breakpoints: Bp): CSSObject;
12
+ }
13
+ export declare const objectParser: ResponsiveParser<MediaQueryMap<string | number>>;
14
+ export declare const arrayParser: ResponsiveParser<(string | number)[]>;
15
+ export declare const orderBreakpoints: (styles: CSSObject, breakpoints: string[]) => CSSObject;
16
+ export {};
@@ -0,0 +1,65 @@
1
+ import { intersection, omit } from 'lodash';
2
+ const BREAKPOINT_KEYS = ['_', 'xs', 'sm', 'md', 'lg', 'xl'];
3
+ /**
4
+ * Destructures the themes breakpoints into an ordered structure to traverse
5
+ */
6
+ export const parseBreakpoints = (breakpoints) => {
7
+ if (breakpoints === undefined)
8
+ return null;
9
+ const { xs, sm, md, lg, xl } = breakpoints ?? {};
10
+ // Ensure order for mapping
11
+ return {
12
+ map: breakpoints,
13
+ array: [xs, sm, md, lg, xl],
14
+ };
15
+ };
16
+ export const isMediaArray = (val) => Array.isArray(val);
17
+ export const isMediaMap = (val) => intersection(Object.keys(val), BREAKPOINT_KEYS).length > 0;
18
+ export const objectParser = (value, props, config, breakpoints) => {
19
+ const styles = {};
20
+ const { styleFn, prop } = config;
21
+ const { _, ...rest } = value;
22
+ // the keyof 'base' is base styles
23
+ if (_)
24
+ Object.assign(styles, styleFn(_, prop, props));
25
+ // Map over remaining keys and merge the corresponding breakpoint styles
26
+ // for that property.
27
+ Object.keys(breakpoints).forEach((breakpointKey) => {
28
+ const bpStyles = rest[breakpointKey];
29
+ if (typeof bpStyles === 'undefined')
30
+ return;
31
+ Object.assign(styles, {
32
+ [breakpoints[breakpointKey]]: styleFn(bpStyles, prop, props),
33
+ });
34
+ });
35
+ return styles;
36
+ };
37
+ export const arrayParser = (value, props, config, breakpoints) => {
38
+ const styles = {};
39
+ const { styleFn, prop } = config;
40
+ const [_, ...rest] = value;
41
+ // the first index is base styles
42
+ if (_)
43
+ Object.assign(styles, styleFn(_, prop, props));
44
+ // Map over each value in the array and merge the corresponding breakpoint styles
45
+ // for that property.
46
+ rest.forEach((val, i) => {
47
+ const breakpointKey = breakpoints[i];
48
+ if (!breakpointKey || typeof val === 'undefined')
49
+ return;
50
+ Object.assign(styles, {
51
+ [breakpointKey]: styleFn(val, prop, props),
52
+ });
53
+ });
54
+ return styles;
55
+ };
56
+ export const orderBreakpoints = (styles, breakpoints) => {
57
+ const orderedStyles = omit(styles, breakpoints);
58
+ breakpoints.forEach((bp) => {
59
+ if (styles[bp]) {
60
+ orderedStyles[bp] = styles[bp];
61
+ }
62
+ });
63
+ return orderedStyles;
64
+ };
65
+ //# sourceMappingURL=responsive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responsive.js","sourceRoot":"","sources":["../../src/utils/responsive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAW5C,MAA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B,GAAG,CAAC,MAAiB,EAAE,WAAqB,EAAE,EAAE;IAC3E,MAAM,aAAa,GAAc,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC3D,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QACzB,IAAI,MAAM,CAAC,EAAE,CAAC,EAAE;YACd,aAAa,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,EAAE,CAAc,CAAC;SAC7C;IACH,CAAC,CAAC,CAAC;IACH,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { Theme } from '@emotion/react';
2
+ import { CSSObject } from '../types/props';
3
+ /**
4
+ * Returns an type of any object with { key: 'var(--key) }
5
+ */
6
+ export declare type KeyAsVariable<T extends Record<string, any>, Prefix extends string> = {
7
+ [V in keyof T]: `var(--${Prefix}-${Extract<V, string>})`;
8
+ };
9
+ declare type SerializedTokensInput = Record<string, string | number | CSSObject | SerializedTokensInputRecursive>;
10
+ interface SerializedTokensInputRecursive {
11
+ [i: number]: SerializedTokensInput;
12
+ [i: string]: SerializedTokensInput;
13
+ }
14
+ export declare const serializeTokens: <T extends SerializedTokensInput, Prefix extends string>(tokens: T, prefix: Prefix, theme: Theme | undefined) => {
15
+ tokens: KeyAsVariable<T, Prefix>;
16
+ variables: CSSObject;
17
+ };
18
+ export {};
@@ -0,0 +1,33 @@
1
+ import { isObject, merge } from 'lodash';
2
+ const templateBreakpoints = (value, alias, theme) => {
3
+ if (isObject(value)) {
4
+ const { _, base, ...rest } = value;
5
+ const css = {
6
+ [alias]: _ ?? base,
7
+ };
8
+ if (theme) {
9
+ const { breakpoints } = theme;
10
+ Object.keys(breakpoints).forEach((key) => {
11
+ css[breakpoints[key]] = {
12
+ [alias]: rest[key],
13
+ };
14
+ });
15
+ }
16
+ return css;
17
+ }
18
+ return { [alias]: value };
19
+ };
20
+ export const serializeTokens = (tokens, prefix, theme) => {
21
+ const tokenReferences = {};
22
+ const tokenVariables = {};
23
+ Object.keys(tokens).forEach((key) => {
24
+ const varName = `--${prefix}-${key}`;
25
+ tokenReferences[key] = `var(${varName})`;
26
+ merge(tokenVariables, templateBreakpoints(tokens[key], varName, theme));
27
+ });
28
+ return {
29
+ tokens: tokenReferences,
30
+ variables: tokenVariables,
31
+ };
32
+ };
33
+ //# sourceMappingURL=serializeTokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializeTokens.js","sourceRoot":"","sources":["../../src/utils/serializeTokens.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAczC,MAAM,mBAAmB,GAAG,CAC1B,KAAkC,EAClC,KAAa,EACb,KAAwB,EACxB,EAAE;IACF,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;QACnB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QACnC,MAAM,GAAG,GAAG;YACV,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI;SACnB,CAAC;QAEF,IAAI,KAAK,EAAE;YACT,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;YAC9B,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACvC,GAAG,CAAC,WAAW,CAAC,GAA+B,CAAC,CAAC,GAAG;oBAClD,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC;iBACnB,CAAC;YACJ,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,GAAG,CAAC;KACZ;IACD,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;AAC5B,CAAC,CAAC;AAYF,MAAM,CAAC,MAAM,eAAe,GAAG,CAI7B,MAAS,EACT,MAAc,EACd,KAAwB,EAIxB,EAAE;IACF,MAAM,eAAe,GAAG,EAA4B,CAAC;IACrD,MAAM,cAAc,GAAc,EAAE,CAAC;IAErC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAClC,MAAM,OAAO,GAAG,KAAK,MAAM,IAAI,GAAG,EAAE,CAAC;QACrC,eAAe,CAAC,GAAG,CAAC,GAAG,OAAO,OAAO,GAAG,CAAC;QAEzC,KAAK,CAAC,cAAc,EAAE,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,MAAM,EAAE,eAA2C;QACnD,SAAS,EAAE,cAAc;KAC1B,CAAC;AACJ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@codecademy/variance",
3
3
  "description": "Constraint based CSS in JS for building scalable design systems",
4
- "version": "0.19.1-alpha.a809e8.0",
4
+ "version": "0.20.1-alpha.447c4d.0",
5
5
  "keywords": [
6
6
  "emotion",
7
7
  "css",
@@ -40,8 +40,8 @@
40
40
  "@emotion/jest": "^11.3.0",
41
41
  "@emotion/styled": "^11.3.0",
42
42
  "@types/react-test-renderer": "^17.0.1",
43
- "react": "16.13.1",
44
- "react-test-renderer": "16.13.1"
43
+ "react": "17.0.2",
44
+ "react-test-renderer": "17.0.2"
45
45
  },
46
- "gitHead": "7be5114e0f5a72b7d5835c0312490f467646a903"
46
+ "gitHead": "00814476df1784f2bd65d8fdf6ca191938e82526"
47
47
  }