@digdir/designsystemet 1.0.5 → 1.0.7

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 (49) hide show
  1. package/LICENSE +7 -0
  2. package/configs/digdir.config.json +59 -0
  3. package/configs/test-tokens.config.json +45 -0
  4. package/dist/bin/designsystemet.js +82 -88
  5. package/dist/config.schema.json +38 -27
  6. package/dist/src/colors/index.js +32 -0
  7. package/dist/src/colors/theme.js +1 -0
  8. package/dist/src/colors/utils.d.ts +13 -0
  9. package/dist/src/colors/utils.d.ts.map +1 -1
  10. package/dist/src/colors/utils.js +32 -0
  11. package/dist/src/config.d.ts +24 -176
  12. package/dist/src/config.d.ts.map +1 -1
  13. package/dist/src/config.js +23 -32
  14. package/dist/src/index.js +85 -50
  15. package/dist/src/migrations/beta-to-v1.js +2 -2
  16. package/dist/src/migrations/codemods/css/run.js +2 -2
  17. package/dist/src/migrations/color-rename-next49.js +2 -2
  18. package/dist/src/migrations/index.js +2 -2
  19. package/dist/src/scripts/createJsonSchema.js +33 -1292
  20. package/dist/src/scripts/update-design-tokens.js +4 -4
  21. package/dist/src/scripts/update-template.js +7 -7
  22. package/dist/src/tokens/build.js +56 -53
  23. package/dist/src/tokens/create/generators/$designsystemet.js +27 -25
  24. package/dist/src/tokens/create/generators/$themes.js +10 -10
  25. package/dist/src/tokens/create/generators/color.js +1 -0
  26. package/dist/src/tokens/create/write.js +39 -37
  27. package/dist/src/tokens/create.js +1 -0
  28. package/dist/src/tokens/format.js +54 -50
  29. package/dist/src/tokens/index.js +54 -50
  30. package/dist/src/tokens/process/configs/color.js +26 -22
  31. package/dist/src/tokens/process/configs/semantic.js +16 -12
  32. package/dist/src/tokens/process/configs/shared.js +16 -12
  33. package/dist/src/tokens/process/configs/storefront.js +16 -12
  34. package/dist/src/tokens/process/configs/typography.js +16 -12
  35. package/dist/src/tokens/process/configs.js +26 -22
  36. package/dist/src/tokens/process/formats/css/color.js +16 -12
  37. package/dist/src/tokens/process/formats/css/semantic.js +16 -12
  38. package/dist/src/tokens/process/formats/css.js +16 -12
  39. package/dist/src/tokens/process/formats/js-tokens.js +16 -12
  40. package/dist/src/tokens/process/platform.js +26 -22
  41. package/dist/src/tokens/process/theme.d.ts.map +1 -1
  42. package/dist/src/tokens/process/theme.js +27 -28
  43. package/dist/src/tokens/process/transformers.js +16 -12
  44. package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +26 -22
  45. package/dist/src/tokens/utils.d.ts +2 -2
  46. package/dist/src/tokens/utils.d.ts.map +1 -1
  47. package/dist/src/tokens/utils.js +16 -12
  48. package/dist/src/utils.js +1 -1
  49. package/package.json +35 -33
@@ -13,20 +13,24 @@ import * as R from "ramda";
13
13
  var mapToLowerCase = R.map(R.toLower);
14
14
  var hasAnyTruth = R.any(R.equals(true));
15
15
  var getType = (token) => (token.$type ?? token.type) || "";
16
- var typeEquals = R.curry((types, token) => {
17
- if (R.isNil(token)) {
18
- return false;
16
+ var typeEquals = R.curry(
17
+ (types, token) => {
18
+ if (R.isNil(token)) {
19
+ return false;
20
+ }
21
+ return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
19
22
  }
20
- return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
21
- });
22
- var pathStartsWithOneOf = R.curry((paths, token) => {
23
- if (R.isNil(token)) {
24
- return false;
23
+ );
24
+ var pathStartsWithOneOf = R.curry(
25
+ (paths, token) => {
26
+ if (R.isNil(token)) {
27
+ return false;
28
+ }
29
+ const tokenPath = mapToLowerCase(token.path);
30
+ const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
31
+ return hasAnyTruth(matchPathsStartingWith);
25
32
  }
26
- const tokenPath = mapToLowerCase(token.path);
27
- const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
28
- return hasAnyTruth(matchPathsStartingWith);
29
- });
33
+ );
30
34
  function isSemanticToken(token) {
31
35
  return token.filePath.includes("semantic/");
32
36
  }
@@ -8,20 +8,24 @@ var mapToLowerCase = R.map(R.toLower);
8
8
  var hasAnyTruth = R.any(R.equals(true));
9
9
  var getType = (token) => (token.$type ?? token.type) || "";
10
10
  var getValue = (token) => token.$value ?? token.value;
11
- var typeEquals = R.curry((types, token) => {
12
- if (R.isNil(token)) {
13
- return false;
11
+ var typeEquals = R.curry(
12
+ (types, token) => {
13
+ if (R.isNil(token)) {
14
+ return false;
15
+ }
16
+ return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
14
17
  }
15
- return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
16
- });
17
- var pathStartsWithOneOf = R.curry((paths, token) => {
18
- if (R.isNil(token)) {
19
- return false;
18
+ );
19
+ var pathStartsWithOneOf = R.curry(
20
+ (paths, token) => {
21
+ if (R.isNil(token)) {
22
+ return false;
23
+ }
24
+ const tokenPath = mapToLowerCase(token.path);
25
+ const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
26
+ return hasAnyTruth(matchPathsStartingWith);
20
27
  }
21
- const tokenPath = mapToLowerCase(token.path);
22
- const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
23
- return hasAnyTruth(matchPathsStartingWith);
24
- });
28
+ );
25
29
  var isDigit = (s) => /^\d+$/.test(s);
26
30
  function inlineTokens(shouldInline, tokens) {
27
31
  const [inlineableTokens, otherTokens] = R.partition(shouldInline, tokens);
@@ -14,20 +14,24 @@ var mapToLowerCase = R.map(R.toLower);
14
14
  var hasAnyTruth = R.any(R.equals(true));
15
15
  var getType = (token) => (token.$type ?? token.type) || "";
16
16
  var getValue = (token) => token.$value ?? token.value;
17
- var typeEquals = R.curry((types, token) => {
18
- if (R.isNil(token)) {
19
- return false;
17
+ var typeEquals = R.curry(
18
+ (types, token) => {
19
+ if (R.isNil(token)) {
20
+ return false;
21
+ }
22
+ return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
20
23
  }
21
- return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
22
- });
23
- var pathStartsWithOneOf = R.curry((paths, token) => {
24
- if (R.isNil(token)) {
25
- return false;
24
+ );
25
+ var pathStartsWithOneOf = R.curry(
26
+ (paths, token) => {
27
+ if (R.isNil(token)) {
28
+ return false;
29
+ }
30
+ const tokenPath = mapToLowerCase(token.path);
31
+ const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
32
+ return hasAnyTruth(matchPathsStartingWith);
26
33
  }
27
- const tokenPath = mapToLowerCase(token.path);
28
- const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
29
- return hasAnyTruth(matchPathsStartingWith);
30
- });
34
+ );
31
35
  function isSemanticToken(token) {
32
36
  return token.filePath.includes("semantic/");
33
37
  }
@@ -8,20 +8,24 @@ var mapToLowerCase = R.map(R.toLower);
8
8
  var hasAnyTruth = R.any(R.equals(true));
9
9
  var getType = (token) => (token.$type ?? token.type) || "";
10
10
  var getValue = (token) => token.$value ?? token.value;
11
- var typeEquals = R.curry((types, token) => {
12
- if (R.isNil(token)) {
13
- return false;
11
+ var typeEquals = R.curry(
12
+ (types, token) => {
13
+ if (R.isNil(token)) {
14
+ return false;
15
+ }
16
+ return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
14
17
  }
15
- return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
16
- });
17
- var pathStartsWithOneOf = R.curry((paths, token) => {
18
- if (R.isNil(token)) {
19
- return false;
18
+ );
19
+ var pathStartsWithOneOf = R.curry(
20
+ (paths, token) => {
21
+ if (R.isNil(token)) {
22
+ return false;
23
+ }
24
+ const tokenPath = mapToLowerCase(token.path);
25
+ const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
26
+ return hasAnyTruth(matchPathsStartingWith);
20
27
  }
21
- const tokenPath = mapToLowerCase(token.path);
22
- const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
23
- return hasAnyTruth(matchPathsStartingWith);
24
- });
28
+ );
25
29
  function isColorCategoryToken(token, category) {
26
30
  if (!category) {
27
31
  return ["main", "support"].some((c) => isColorCategoryToken(token, c));
@@ -20,20 +20,24 @@ var mapToLowerCase = R.map(R.toLower);
20
20
  var hasAnyTruth = R.any(R.equals(true));
21
21
  var getType = (token) => (token.$type ?? token.type) || "";
22
22
  var getValue = (token) => token.$value ?? token.value;
23
- var typeEquals = R.curry((types, token) => {
24
- if (R.isNil(token)) {
25
- return false;
23
+ var typeEquals = R.curry(
24
+ (types, token) => {
25
+ if (R.isNil(token)) {
26
+ return false;
27
+ }
28
+ return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
26
29
  }
27
- return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
28
- });
29
- var pathStartsWithOneOf = R.curry((paths, token) => {
30
- if (R.isNil(token)) {
31
- return false;
30
+ );
31
+ var pathStartsWithOneOf = R.curry(
32
+ (paths, token) => {
33
+ if (R.isNil(token)) {
34
+ return false;
35
+ }
36
+ const tokenPath = mapToLowerCase(token.path);
37
+ const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
38
+ return hasAnyTruth(matchPathsStartingWith);
32
39
  }
33
- const tokenPath = mapToLowerCase(token.path);
34
- const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
35
- return hasAnyTruth(matchPathsStartingWith);
36
- });
40
+ );
37
41
  function isSemanticToken(token) {
38
42
  return token.filePath.includes("semantic/");
39
43
  }
@@ -589,14 +593,14 @@ var typographyVariables = ({ theme, typography: typography2 }) => {
589
593
  };
590
594
  };
591
595
 
592
- // ../../node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js
596
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js
593
597
  var BoxShadowTypes;
594
598
  (function(BoxShadowTypes2) {
595
599
  BoxShadowTypes2["DROP_SHADOW"] = "dropShadow";
596
600
  BoxShadowTypes2["INNER_SHADOW"] = "innerShadow";
597
601
  })(BoxShadowTypes || (BoxShadowTypes = {}));
598
602
 
599
- // ../../node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js
603
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js
600
604
  var ColorModifierTypes;
601
605
  (function(ColorModifierTypes2) {
602
606
  ColorModifierTypes2["LIGHTEN"] = "lighten";
@@ -605,7 +609,7 @@ var ColorModifierTypes;
605
609
  ColorModifierTypes2["ALPHA"] = "alpha";
606
610
  })(ColorModifierTypes || (ColorModifierTypes = {}));
607
611
 
608
- // ../../node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js
612
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js
609
613
  var ColorSpaceTypes;
610
614
  (function(ColorSpaceTypes2) {
611
615
  ColorSpaceTypes2["LCH"] = "lch";
@@ -614,7 +618,7 @@ var ColorSpaceTypes;
614
618
  ColorSpaceTypes2["HSL"] = "hsl";
615
619
  })(ColorSpaceTypes || (ColorSpaceTypes = {}));
616
620
 
617
- // ../../node_modules/@tokens-studio/types/dist/constants/Properties.js
621
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/Properties.js
618
622
  var Properties;
619
623
  (function(Properties2) {
620
624
  Properties2["sizing"] = "sizing";
@@ -666,7 +670,7 @@ var Properties;
666
670
  Properties2["description"] = "description";
667
671
  })(Properties || (Properties = {}));
668
672
 
669
- // ../../node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js
673
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js
670
674
  var TokenSetStatus;
671
675
  (function(TokenSetStatus2) {
672
676
  TokenSetStatus2["DISABLED"] = "disabled";
@@ -674,7 +678,7 @@ var TokenSetStatus;
674
678
  TokenSetStatus2["ENABLED"] = "enabled";
675
679
  })(TokenSetStatus || (TokenSetStatus = {}));
676
680
 
677
- // ../../node_modules/@tokens-studio/types/dist/constants/TokenTypes.js
681
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenTypes.js
678
682
  var TokenTypes;
679
683
  (function(TokenTypes2) {
680
684
  TokenTypes2["OTHER"] = "other";
@@ -705,7 +709,7 @@ var TokenTypes;
705
709
  TokenTypes2["NUMBER"] = "number";
706
710
  })(TokenTypes || (TokenTypes = {}));
707
711
 
708
- // ../../node_modules/@tokens-studio/types/dist/constants/BorderValues.js
712
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BorderValues.js
709
713
  var BorderValues;
710
714
  (function(BorderValues2) {
711
715
  BorderValues2["BORDER_COLOR"] = "color";
@@ -713,7 +717,7 @@ var BorderValues;
713
717
  BorderValues2["BORDER_STYLE"] = "style";
714
718
  })(BorderValues || (BorderValues = {}));
715
719
 
716
- // ../../node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js
720
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js
717
721
  var StrokeStyleValues;
718
722
  (function(StrokeStyleValues2) {
719
723
  StrokeStyleValues2["SOLID"] = "solid";
@@ -726,7 +730,7 @@ var StrokeStyleValues;
726
730
  StrokeStyleValues2["INSET"] = "inset";
727
731
  })(StrokeStyleValues || (StrokeStyleValues = {}));
728
732
 
729
- // ../../node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js
733
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js
730
734
  var BoxShadowValues;
731
735
  (function(BoxShadowValues2) {
732
736
  BoxShadowValues2["TYPE"] = "type";
@@ -738,7 +742,7 @@ var BoxShadowValues;
738
742
  BoxShadowValues2["BLEND_MODE"] = "blendMode";
739
743
  })(BoxShadowValues || (BoxShadowValues = {}));
740
744
 
741
- // ../../node_modules/@tokens-studio/types/dist/constants/TypographyValues.js
745
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TypographyValues.js
742
746
  var TypographyValues;
743
747
  (function(TypographyValues2) {
744
748
  TypographyValues2["FONT_FAMILY"] = "fontFamily";
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/tokens/process/theme.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,eAAO,MAAM,iBAAiB,QAA2B,CAAC;AAE1D,KAAK,mBAAmB,GAAG;IACzB,6GAA6G;IAC7G,eAAe,EAAE,aAAa,CAAC;IAC/B,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAAI,kCAGjC,mBAAmB,KAAG,UAAU,EAiFlC,CAAC"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/tokens/process/theme.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,eAAO,MAAM,iBAAiB,QAA2B,CAAC;AAE1D,KAAK,mBAAmB,GAAG;IACzB,6GAA6G;IAC7G,eAAe,EAAE,aAAa,CAAC;IAC/B,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAAI,kCAGjC,mBAAmB,KAAG,UAAU,EA8ElC,CAAC"}
@@ -5,11 +5,11 @@ import chalk from "chalk";
5
5
  // package.json
6
6
  var package_default = {
7
7
  name: "@digdir/designsystemet",
8
- version: "1.0.5",
8
+ version: "1.0.7",
9
9
  description: "CLI for Designsystemet",
10
10
  author: "Designsystemet team",
11
11
  engines: {
12
- node: ">=22.14.0"
12
+ node: ">=22.16.0"
13
13
  },
14
14
  repository: {
15
15
  type: "git",
@@ -20,7 +20,8 @@ var package_default = {
20
20
  type: "module",
21
21
  main: "./dist/src/index.js",
22
22
  files: [
23
- "./dist/**"
23
+ "./dist/**",
24
+ "./configs/**"
24
25
  ],
25
26
  bin: "dist/bin/designsystemet.js",
26
27
  exports: {
@@ -39,57 +40,58 @@ var package_default = {
39
40
  },
40
41
  scripts: {
41
42
  designsystemet: "tsx ./bin/designsystemet.ts",
42
- "build:tokens": "yarn designsystemet tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
43
- "build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
44
- build: "tsup && yarn build:types && yarn build:json-schema",
43
+ "build:tokens": "pnpm run designsystemet tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
44
+ "build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../internal/design-tokens -o ../../packages/theme/brand --clean",
45
+ build: "tsup && pnpm build:types && pnpm build:json-schema",
45
46
  "build:types": "tsc --emitDeclarationOnly --declaration",
46
47
  "build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
47
48
  types: "tsc --noEmit",
48
- "test:tokens-create-options": "yarn designsystemet tokens create -m dominant:#007682 -n #003333 -b 99 -o ./test-tokens/options --theme options --clean",
49
- "test:tokens-create-config": "yarn designsystemet tokens create --config ./test/test-tokens.config.json",
50
- "test:tokens-build": "yarn designsystemet tokens build -t ./test-tokens/options -o ./test-tokens/options-build --clean",
51
- "test:tokens-build-config": "yarn designsystemet tokens build -t ./test-tokens/config -o ./test-tokens/config-build --clean",
52
- "test:tokens-create-and-build-options": "yarn test:tokens-create-options && yarn test:tokens-build",
53
- "test:tokens-create-and-build-config": "yarn test:tokens-create-config && yarn test:tokens-build-config",
54
- test: "yarn test:tokens-create-and-build-options && yarn test:tokens-create-and-build-config",
55
- "internal:tokens-create": "yarn designsystemet tokens create --config ./internal.config.json",
49
+ "test:tokens-create-options": 'pnpm run designsystemet tokens create -m dominant:"#007682" -n "#003333" -b 99 -o ./temp/options/design-tokens --theme options --clean',
50
+ "test:tokens-create-config": "pnpm run designsystemet tokens create --config ./configs/test-tokens.config.json",
51
+ "test:tokens-build": "pnpm run designsystemet tokens build -t ./temp/options/design-tokens -o ./temp/options/build --clean",
52
+ "test:tokens-build-config": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean",
53
+ "test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
54
+ "test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
55
+ test: "pnpm test:tokens-create-and-build-options && pnpm test:tokens-create-and-build-config",
56
+ "digdir:tokens-create": "pnpm run designsystemet tokens create --config ./configs/digdir.config.json",
56
57
  "update:template": "tsx ./src/scripts/update-template.ts",
57
- "update:design-tokens": "yarn internal:tokens-create && tsx ./src/scripts/update-design-tokens.ts",
58
- verify: "yarn test && yarn update:template && yarn update:design-tokens"
58
+ "update:design-tokens": "pnpm digdir:tokens-create && tsx ./src/scripts/update-design-tokens.ts",
59
+ verify: "pnpm test && pnpm update:template && pnpm update:design-tokens"
59
60
  },
60
61
  dependencies: {
61
62
  "@commander-js/extra-typings": "^13.1.0",
62
- "@tokens-studio/sd-transforms": "1.2.12",
63
+ "@tokens-studio/sd-transforms": "1.3.0",
63
64
  "apca-w3": "^0.1.9",
64
65
  chalk: "^5.4.1",
65
66
  "change-case": "^5.4.4",
66
67
  "chroma-js": "^3.1.2",
68
+ "colorjs.io": "^0.6.0-alpha.1",
67
69
  commander: "^13.1.0",
68
70
  "fast-glob": "^3.3.3",
69
71
  hsluv: "^1.0.1",
70
72
  "object-hash": "^3.0.0",
71
73
  postcss: "^8.5.3",
72
74
  ramda: "^0.30.1",
73
- "style-dictionary": "^4.3.3",
74
- zod: "^3.24.2",
75
- "zod-validation-error": "^3.4.0"
75
+ "style-dictionary": "^4.4.0",
76
+ zod: "^3.25.30",
77
+ "zod-validation-error": "^3.4.1"
76
78
  },
77
79
  devDependencies: {
80
+ "@tokens-studio/types": "0.5.2",
78
81
  "@types/apca-w3": "^0.1.3",
79
82
  "@types/chroma-js": "^3.1.1",
80
83
  "@types/fs-extra": "^11.0.4",
81
84
  "@types/glob": "^8.1.0",
82
85
  "@types/jscodeshift": "^0.12.0",
83
- "@types/node": "^22.14.0",
86
+ "@types/node": "^22.15.21",
84
87
  "@types/object-hash": "^3.0.6",
85
88
  "@types/ramda": "^0.30.2",
86
89
  "fs-extra": "^11.3.0",
87
90
  "ts-toolbelt": "^9.6.0",
88
91
  tslib: "^2.8.1",
89
- tsup: "^8.4.0",
90
- tsx: "^4.19.3",
91
- typescript: "^5.8.2",
92
- "zod-to-json-schema": "^3.24.5"
92
+ tsup: "^8.5.0",
93
+ tsx: "^4.19.4",
94
+ typescript: "^5.8.3"
93
95
  }
94
96
  };
95
97
 
@@ -143,9 +145,6 @@ order may change due to nondeterminism.`.trim()
143
145
  return sortIndex;
144
146
  });
145
147
  const header = `@charset "UTF-8";
146
-
147
- @layer ds.theme, ds.base, ds.utilities, ds.components;
148
-
149
148
  /*
150
149
  ${fileHeader}
151
150
  */
@@ -8,20 +8,24 @@ var mapToLowerCase = R.map(R.toLower);
8
8
  var hasAnyTruth = R.any(R.equals(true));
9
9
  var getType = (token) => (token.$type ?? token.type) || "";
10
10
  var getValue = (token) => token.$value ?? token.value;
11
- var typeEquals = R.curry((types, token) => {
12
- if (R.isNil(token)) {
13
- return false;
11
+ var typeEquals = R.curry(
12
+ (types, token) => {
13
+ if (R.isNil(token)) {
14
+ return false;
15
+ }
16
+ return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
14
17
  }
15
- return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
16
- });
17
- var pathStartsWithOneOf = R.curry((paths, token) => {
18
- if (R.isNil(token)) {
19
- return false;
18
+ );
19
+ var pathStartsWithOneOf = R.curry(
20
+ (paths, token) => {
21
+ if (R.isNil(token)) {
22
+ return false;
23
+ }
24
+ const tokenPath = mapToLowerCase(token.path);
25
+ const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
26
+ return hasAnyTruth(matchPathsStartingWith);
20
27
  }
21
- const tokenPath = mapToLowerCase(token.path);
22
- const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
23
- return hasAnyTruth(matchPathsStartingWith);
24
- });
28
+ );
25
29
 
26
30
  // src/tokens/process/transformers.ts
27
31
  var isPx = R2.test(/\b\d+px\b/g);
@@ -1,11 +1,11 @@
1
- // ../../node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js
1
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js
2
2
  var BoxShadowTypes;
3
3
  (function(BoxShadowTypes2) {
4
4
  BoxShadowTypes2["DROP_SHADOW"] = "dropShadow";
5
5
  BoxShadowTypes2["INNER_SHADOW"] = "innerShadow";
6
6
  })(BoxShadowTypes || (BoxShadowTypes = {}));
7
7
 
8
- // ../../node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js
8
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js
9
9
  var ColorModifierTypes;
10
10
  (function(ColorModifierTypes2) {
11
11
  ColorModifierTypes2["LIGHTEN"] = "lighten";
@@ -14,7 +14,7 @@ var ColorModifierTypes;
14
14
  ColorModifierTypes2["ALPHA"] = "alpha";
15
15
  })(ColorModifierTypes || (ColorModifierTypes = {}));
16
16
 
17
- // ../../node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js
17
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js
18
18
  var ColorSpaceTypes;
19
19
  (function(ColorSpaceTypes2) {
20
20
  ColorSpaceTypes2["LCH"] = "lch";
@@ -23,7 +23,7 @@ var ColorSpaceTypes;
23
23
  ColorSpaceTypes2["HSL"] = "hsl";
24
24
  })(ColorSpaceTypes || (ColorSpaceTypes = {}));
25
25
 
26
- // ../../node_modules/@tokens-studio/types/dist/constants/Properties.js
26
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/Properties.js
27
27
  var Properties;
28
28
  (function(Properties2) {
29
29
  Properties2["sizing"] = "sizing";
@@ -75,7 +75,7 @@ var Properties;
75
75
  Properties2["description"] = "description";
76
76
  })(Properties || (Properties = {}));
77
77
 
78
- // ../../node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js
78
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js
79
79
  var TokenSetStatus;
80
80
  (function(TokenSetStatus2) {
81
81
  TokenSetStatus2["DISABLED"] = "disabled";
@@ -83,7 +83,7 @@ var TokenSetStatus;
83
83
  TokenSetStatus2["ENABLED"] = "enabled";
84
84
  })(TokenSetStatus || (TokenSetStatus = {}));
85
85
 
86
- // ../../node_modules/@tokens-studio/types/dist/constants/TokenTypes.js
86
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenTypes.js
87
87
  var TokenTypes;
88
88
  (function(TokenTypes2) {
89
89
  TokenTypes2["OTHER"] = "other";
@@ -114,7 +114,7 @@ var TokenTypes;
114
114
  TokenTypes2["NUMBER"] = "number";
115
115
  })(TokenTypes || (TokenTypes = {}));
116
116
 
117
- // ../../node_modules/@tokens-studio/types/dist/constants/BorderValues.js
117
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BorderValues.js
118
118
  var BorderValues;
119
119
  (function(BorderValues2) {
120
120
  BorderValues2["BORDER_COLOR"] = "color";
@@ -122,7 +122,7 @@ var BorderValues;
122
122
  BorderValues2["BORDER_STYLE"] = "style";
123
123
  })(BorderValues || (BorderValues = {}));
124
124
 
125
- // ../../node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js
125
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js
126
126
  var StrokeStyleValues;
127
127
  (function(StrokeStyleValues2) {
128
128
  StrokeStyleValues2["SOLID"] = "solid";
@@ -135,7 +135,7 @@ var StrokeStyleValues;
135
135
  StrokeStyleValues2["INSET"] = "inset";
136
136
  })(StrokeStyleValues || (StrokeStyleValues = {}));
137
137
 
138
- // ../../node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js
138
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js
139
139
  var BoxShadowValues;
140
140
  (function(BoxShadowValues2) {
141
141
  BoxShadowValues2["TYPE"] = "type";
@@ -147,7 +147,7 @@ var BoxShadowValues;
147
147
  BoxShadowValues2["BLEND_MODE"] = "blendMode";
148
148
  })(BoxShadowValues || (BoxShadowValues = {}));
149
149
 
150
- // ../../node_modules/@tokens-studio/types/dist/constants/TypographyValues.js
150
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TypographyValues.js
151
151
  var TypographyValues;
152
152
  (function(TypographyValues2) {
153
153
  TypographyValues2["FONT_FAMILY"] = "fontFamily";
@@ -188,20 +188,24 @@ var mapToLowerCase = R.map(R.toLower);
188
188
  var hasAnyTruth = R.any(R.equals(true));
189
189
  var getType = (token) => (token.$type ?? token.type) || "";
190
190
  var getValue = (token) => token.$value ?? token.value;
191
- var typeEquals = R.curry((types, token) => {
192
- if (R.isNil(token)) {
193
- return false;
191
+ var typeEquals = R.curry(
192
+ (types, token) => {
193
+ if (R.isNil(token)) {
194
+ return false;
195
+ }
196
+ return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
194
197
  }
195
- return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
196
- });
197
- var pathStartsWithOneOf = R.curry((paths, token) => {
198
- if (R.isNil(token)) {
199
- return false;
198
+ );
199
+ var pathStartsWithOneOf = R.curry(
200
+ (paths, token) => {
201
+ if (R.isNil(token)) {
202
+ return false;
203
+ }
204
+ const tokenPath = mapToLowerCase(token.path);
205
+ const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
206
+ return hasAnyTruth(matchPathsStartingWith);
200
207
  }
201
- const tokenPath = mapToLowerCase(token.path);
202
- const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
203
- return hasAnyTruth(matchPathsStartingWith);
204
- });
208
+ );
205
209
  function isSemanticToken(token) {
206
210
  return token.filePath.includes("semantic/");
207
211
  }
@@ -22,8 +22,8 @@ export declare const getValue: <T>(token: TransformedToken | DesignToken) => T;
22
22
  * @param token Transformed token
23
23
  * @returns boolean
24
24
  */
25
- export declare const typeEquals: import("ts-toolbelt/out/Function/Curry.js").Curry<(types: string[] | string, token: TransformedToken) => boolean>;
26
- export declare const pathStartsWithOneOf: import("ts-toolbelt/out/Function/Curry.js").Curry<(paths: string[], token: TransformedToken) => boolean>;
25
+ export declare const typeEquals: (types: string[] | string, token: TransformedToken) => boolean;
26
+ export declare const pathStartsWithOneOf: (paths: string[], token: TransformedToken) => boolean;
27
27
  export declare function isSemanticToken(token: TransformedToken): boolean;
28
28
  export declare function isSemanticColorToken(token: TransformedToken, color: string): boolean;
29
29
  export declare function isGlobalColorToken(token: TransformedToken): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tokens/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAM3C;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,gBAAgB,WAAkD,CAAC;AAElG;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,OAAO,gBAAgB,GAAG,WAAW,KAAG,CAAuC,CAAC;AAE5G;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,4DAAmB,MAAM,EAAE,GAAG,MAAM,SAAS,gBAAgB,aAMlF,CAAC;AAEH,eAAO,MAAM,mBAAmB,4DAAmB,MAAM,EAAE,SAAS,gBAAgB,aASlF,CAAC;AAEH,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAEhE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpF;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAEnE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAKpG;AAED,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,YAAoB,CAAC;AAEtD;2HAC2H;AAC3H,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,GAAG,QAAQ,EACtB,EAAE,EAAE,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,EAAE,GAAG,EAAE,MAAM,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,KAAK,IAAI,4DAYrH;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,gBAAgB,KAAK,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,sBAetG"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tokens/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAM3C;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,gBAAgB,WAAkD,CAAC;AAElG;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,OAAO,gBAAgB,GAAG,WAAW,KAAG,CAAuC,CAAC;AAE5G;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,gBAAgB,KAAK,OAQ/E,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,gBAAgB,KAAK,OAW/E,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAEhE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpF;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAEnE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAKpG;AAED,eAAO,MAAM,OAAO,GAAI,GAAG,MAAM,YAAoB,CAAC;AAEtD;2HAC2H;AAC3H,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,GAAG,QAAQ,EACtB,EAAE,EAAE,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,EAAE,GAAG,EAAE,MAAM,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,KAAK,IAAI,4DAYrH;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,gBAAgB,KAAK,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,sBAetG"}
@@ -4,20 +4,24 @@ var mapToLowerCase = R.map(R.toLower);
4
4
  var hasAnyTruth = R.any(R.equals(true));
5
5
  var getType = (token) => (token.$type ?? token.type) || "";
6
6
  var getValue = (token) => token.$value ?? token.value;
7
- var typeEquals = R.curry((types, token) => {
8
- if (R.isNil(token)) {
9
- return false;
7
+ var typeEquals = R.curry(
8
+ (types, token) => {
9
+ if (R.isNil(token)) {
10
+ return false;
11
+ }
12
+ return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
10
13
  }
11
- return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
12
- });
13
- var pathStartsWithOneOf = R.curry((paths, token) => {
14
- if (R.isNil(token)) {
15
- return false;
14
+ );
15
+ var pathStartsWithOneOf = R.curry(
16
+ (paths, token) => {
17
+ if (R.isNil(token)) {
18
+ return false;
19
+ }
20
+ const tokenPath = mapToLowerCase(token.path);
21
+ const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
22
+ return hasAnyTruth(matchPathsStartingWith);
16
23
  }
17
- const tokenPath = mapToLowerCase(token.path);
18
- const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
19
- return hasAnyTruth(matchPathsStartingWith);
20
- });
24
+ );
21
25
  function isSemanticToken(token) {
22
26
  return token.filePath.includes("semantic/");
23
27
  }
package/dist/src/utils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/utils.ts
2
- import fs from "node:fs/promises";
2
+ import fs from "fs/promises";
3
3
  import chalk from "chalk";
4
4
  var mkdir = async (dir, dry) => {
5
5
  if (dry) {