@digdir/designsystemet 1.11.1 → 1.12.1

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 (100) hide show
  1. package/dist/bin/config.js +24 -4
  2. package/dist/bin/designsystemet.js +909 -1220
  3. package/dist/src/colors/index.js +27 -1
  4. package/dist/src/colors/types.d.ts +24 -21
  5. package/dist/src/colors/types.d.ts.map +1 -1
  6. package/dist/src/colors/types.js +27 -0
  7. package/dist/src/config.js +24 -4
  8. package/dist/src/index.js +815 -1119
  9. package/dist/src/scripts/createJsonSchema.js +24 -4
  10. package/dist/src/scripts/update-preview-tokens.d.ts.map +1 -1
  11. package/dist/src/scripts/update-preview-tokens.js +1356 -1662
  12. package/dist/src/tokens/build.js +4 -5
  13. package/dist/src/tokens/create/generators/$designsystemet.js +4 -5
  14. package/dist/src/tokens/create/generators/$metadata.d.ts +2 -2
  15. package/dist/src/tokens/create/generators/$metadata.d.ts.map +1 -1
  16. package/dist/src/tokens/create/generators/$metadata.js +3 -7
  17. package/dist/src/tokens/create/generators/$themes.d.ts +17 -2
  18. package/dist/src/tokens/create/generators/$themes.d.ts.map +1 -1
  19. package/dist/src/tokens/create/generators/$themes.js +3 -3
  20. package/dist/src/tokens/create/generators/primitives/color-scheme.d.ts +5 -0
  21. package/dist/src/tokens/create/generators/primitives/color-scheme.d.ts.map +1 -0
  22. package/dist/src/tokens/create/generators/{color.js → primitives/color-scheme.js} +29 -6
  23. package/dist/src/tokens/create/generators/primitives/globals.d.ts +3 -0
  24. package/dist/src/tokens/create/generators/primitives/globals.d.ts.map +1 -0
  25. package/dist/src/tokens/create/generators/primitives/globals.js +148 -0
  26. package/dist/src/tokens/create/generators/primitives/size.d.ts +4 -0
  27. package/dist/src/tokens/create/generators/primitives/size.d.ts.map +1 -0
  28. package/dist/src/tokens/create/generators/primitives/size.js +157 -0
  29. package/dist/src/tokens/create/generators/primitives/typography.d.ts +4 -0
  30. package/dist/src/tokens/create/generators/primitives/typography.d.ts.map +1 -0
  31. package/dist/src/tokens/create/generators/primitives/typography.js +220 -0
  32. package/dist/src/tokens/create/generators/semantic/color-modes.d.ts +8 -0
  33. package/dist/src/tokens/create/generators/semantic/color-modes.d.ts.map +1 -0
  34. package/dist/src/tokens/create/generators/semantic/color-modes.js +61 -0
  35. package/dist/src/tokens/create/generators/semantic/color.d.ts +5 -0
  36. package/dist/src/tokens/create/generators/semantic/color.d.ts.map +1 -0
  37. package/dist/src/tokens/create/generators/{semantic.js → semantic/color.js} +50 -194
  38. package/dist/src/tokens/create/generators/semantic/style.d.ts +3 -0
  39. package/dist/src/tokens/create/generators/semantic/style.d.ts.map +1 -0
  40. package/dist/src/tokens/create/generators/semantic/style.js +384 -0
  41. package/dist/src/tokens/create/generators/{theme.d.ts → themes/theme.d.ts} +1 -1
  42. package/dist/src/tokens/create/generators/themes/theme.d.ts.map +1 -0
  43. package/dist/src/tokens/create/generators/{theme.js → themes/theme.js} +87 -129
  44. package/dist/src/tokens/create/write.d.ts.map +1 -1
  45. package/dist/src/tokens/create/write.js +13 -17
  46. package/dist/src/tokens/create.d.ts +1 -1
  47. package/dist/src/tokens/create.d.ts.map +1 -1
  48. package/dist/src/tokens/create.js +1340 -1647
  49. package/dist/src/tokens/format.d.ts.map +1 -1
  50. package/dist/src/tokens/format.js +1360 -1667
  51. package/dist/src/tokens/index.js +1360 -1667
  52. package/dist/src/tokens/process/output/declarations.js +4 -5
  53. package/dist/src/tokens/process/output/theme.js +4 -5
  54. package/dist/src/tokens/types.d.ts +7 -0
  55. package/dist/src/tokens/types.d.ts.map +1 -1
  56. package/package.json +5 -6
  57. package/dist/color.base.template-Z7YWN2TF.json +0 -22
  58. package/dist/color.template-LMPUQ72A.json +0 -66
  59. package/dist/color.template-XQNSHLTU.json +0 -66
  60. package/dist/global-Y35YADVH.json +0 -100
  61. package/dist/globals-76VAFMDF.json +0 -143
  62. package/dist/large-CIIHO7AY.json +0 -96
  63. package/dist/large-UUOZ6DYI.json +0 -16
  64. package/dist/medium-OQ7S7P4P.json +0 -16
  65. package/dist/medium-VSB2S4X3.json +0 -96
  66. package/dist/small-AEXJ6U7Z.json +0 -96
  67. package/dist/small-ZY4KOJWX.json +0 -16
  68. package/dist/src/scripts/update-template.d.ts +0 -2
  69. package/dist/src/scripts/update-template.d.ts.map +0 -1
  70. package/dist/src/scripts/update-template.js +0 -1366
  71. package/dist/src/tokens/create/defaults.d.ts +0 -7
  72. package/dist/src/tokens/create/defaults.d.ts.map +0 -1
  73. package/dist/src/tokens/create/defaults.js +0 -998
  74. package/dist/src/tokens/create/generators/color.d.ts +0 -5
  75. package/dist/src/tokens/create/generators/color.d.ts.map +0 -1
  76. package/dist/src/tokens/create/generators/semantic.d.ts +0 -32
  77. package/dist/src/tokens/create/generators/semantic.d.ts.map +0 -1
  78. package/dist/src/tokens/create/generators/theme.d.ts.map +0 -1
  79. package/dist/src/tokens/create/generators/typography.d.ts +0 -3
  80. package/dist/src/tokens/create/generators/typography.d.ts.map +0 -1
  81. package/dist/src/tokens/create/generators/typography.js +0 -33
  82. package/dist/src/tokens/template/design-tokens/primitives/globals.js +0 -5
  83. package/dist/src/tokens/template/design-tokens/primitives/modes/size/global.js +0 -5
  84. package/dist/src/tokens/template/design-tokens/primitives/modes/size/large.js +0 -5
  85. package/dist/src/tokens/template/design-tokens/primitives/modes/size/medium.js +0 -5
  86. package/dist/src/tokens/template/design-tokens/primitives/modes/size/small.js +0 -5
  87. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/large.js +0 -5
  88. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/medium.js +0 -5
  89. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/small.js +0 -5
  90. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/typography.template.js +0 -5
  91. package/dist/src/tokens/template/design-tokens/semantic/color.base.template.js +0 -5
  92. package/dist/src/tokens/template/design-tokens/semantic/color.template.js +0 -5
  93. package/dist/src/tokens/template/design-tokens/semantic/modes/color.template.js +0 -5
  94. package/dist/src/tokens/template/design-tokens/semantic/style.js +0 -5
  95. package/dist/src/tokens/template/design-tokens/themes/theme.base.template.js +0 -5
  96. package/dist/src/tokens/template/design-tokens/themes/theme.template.js +0 -5
  97. package/dist/style-FP5XVCUD.json +0 -378
  98. package/dist/theme.base.template-Y4RMFBQY.json +0 -55
  99. package/dist/theme.template-CTQRNOMO.json +0 -66
  100. package/dist/typography.template-4N5YLH7F.json +0 -22
@@ -348,10 +348,33 @@ var generateColorContrast = (color, type) => {
348
348
  return color;
349
349
  };
350
350
 
351
+ // src/colors/types.ts
352
+ import * as R3 from "ramda";
353
+ var semanticColorMap = {
354
+ "background-default": 1,
355
+ "background-tinted": 2,
356
+ "surface-default": 3,
357
+ "surface-tinted": 4,
358
+ "surface-hover": 5,
359
+ "surface-active": 6,
360
+ "border-subtle": 7,
361
+ "border-default": 8,
362
+ "border-strong": 9,
363
+ "text-subtle": 10,
364
+ "text-default": 11,
365
+ "base-default": 12,
366
+ "base-hover": 13,
367
+ "base-active": 14,
368
+ "base-contrast-subtle": 15,
369
+ "base-contrast-default": 16
370
+ };
371
+ var semanticColorNames = R3.keys(semanticColorMap);
372
+ var semanticColorNumbers = R3.values(semanticColorMap);
373
+
351
374
  // src/migrations/codemods/css/plugins.ts
352
375
  import hash from "object-hash";
353
376
  import pc from "picocolors";
354
- import * as R3 from "ramda";
377
+ import * as R4 from "ramda";
355
378
  var printDelete = (text) => console.log(`${pc.red("Deleted:")} ${text}`.replace(/"|'/g, ""));
356
379
  var deleteMsg = (decl, from) => `${pc.yellow(from)} @ ${pc.gray(`${JSON.stringify(decl.source?.input.file)}:${decl.source?.start?.line}:${decl.source?.start?.column}`)}`;
357
380
  var cssClassRename = (dictionary) => ({
@@ -372,15 +395,15 @@ var cssVarRename = (dictionary) => ({
372
395
  const { value, prop: prop4 } = decl;
373
396
  const deleted = /* @__PURE__ */ new Set();
374
397
  for (const [from, to] of Object.entries(dictionary)) {
375
- if (R3.isNotEmpty(to)) {
398
+ if (R4.isNotEmpty(to)) {
376
399
  if (to === "[delete]") {
377
400
  deleted.add(deleteMsg(decl, from));
378
401
  }
379
- if (R3.includes(from, value)) {
402
+ if (R4.includes(from, value)) {
380
403
  decl.value = value.replace(from, to);
381
404
  continue;
382
405
  }
383
- if (R3.includes(from, prop4) && decl.variable) {
406
+ if (R4.includes(from, prop4) && decl.variable) {
384
407
  decl.prop = prop4.replace(from, to);
385
408
  }
386
409
  }
@@ -810,8 +833,8 @@ var beta_to_v1_default = (glob2) => runCssCodemod({
810
833
  });
811
834
 
812
835
  // src/migrations/color-rename-next49.ts
813
- import * as R4 from "ramda";
814
- var replace = (oldTemplate, newTemplate, colors2, placeholder = "[color]") => R4.reduce(
836
+ import * as R5 from "ramda";
837
+ var replace = (oldTemplate, newTemplate, colors2, placeholder = "[color]") => R5.reduce(
815
838
  (acc, color) => {
816
839
  acc[oldTemplate.replace(placeholder, color)] = newTemplate.replace(placeholder, color);
817
840
  return acc;
@@ -853,7 +876,7 @@ var migrations_default = {
853
876
  // src/tokens/build.ts
854
877
  import path from "path";
855
878
  import pc7 from "picocolors";
856
- import * as R21 from "ramda";
879
+ import * as R22 from "ramda";
857
880
 
858
881
  // src/tokens/process/output/declarations.ts
859
882
  import pc5 from "picocolors";
@@ -861,7 +884,7 @@ import pc5 from "picocolors";
861
884
  // package.json
862
885
  var package_default = {
863
886
  name: "@digdir/designsystemet",
864
- version: "1.11.1",
887
+ version: "1.12.1",
865
888
  description: "CLI for Designsystemet",
866
889
  author: "Designsystemet team",
867
890
  engines: {
@@ -913,9 +936,8 @@ var package_default = {
913
936
  "test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
914
937
  "test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
915
938
  "test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
916
- "test:generate-config-from-tokens": "pnpm run designsystemet generate-config-from-tokens -d ../../internal/digdir/design-tokens --dry",
939
+ "test:generate-config-from-tokens": "pnpm run designsystemet generate-config-from-tokens -d ../../design-tokens --dry",
917
940
  test: "node -v && pnpm test:tokens-create-and-build-options && pnpm test:generate-config-from-tokens && pnpm test:tokens-create-and-build-config",
918
- "update:template": "tsx ./src/scripts/update-template.ts",
919
941
  "update:preview-tokens": "tsx ./src/scripts/update-preview-tokens.ts",
920
942
  verify: "pnpm test && pnpm update:template && pnpm --filter @internal/digdir update:theme-digdir"
921
943
  },
@@ -932,14 +954,14 @@ var package_default = {
932
954
  picocolors: "^1.1.1",
933
955
  postcss: "^8.5.6",
934
956
  ramda: "^0.32.0",
935
- "style-dictionary": "^5.2.0",
957
+ "style-dictionary": "^5.3.0",
936
958
  zod: "^4.3.6",
937
959
  "zod-validation-error": "^5.0.0"
938
960
  },
939
961
  devDependencies: {
940
962
  "@tokens-studio/types": "0.5.2",
941
963
  "@types/chroma-js": "^3.1.2",
942
- "@types/node": "^24.10.9",
964
+ "@types/node": "^24.10.13",
943
965
  "@types/object-hash": "^3.0.6",
944
966
  "@types/ramda": "^0.31.1",
945
967
  tsup: "^8.5.1",
@@ -950,7 +972,7 @@ var package_default = {
950
972
 
951
973
  // src/tokens/process/platform.ts
952
974
  import pc4 from "picocolors";
953
- import * as R19 from "ramda";
975
+ import * as R20 from "ramda";
954
976
  import StyleDictionary2 from "style-dictionary";
955
977
 
956
978
  // src/tokens/types.ts
@@ -961,32 +983,32 @@ var colorCategories = {
961
983
 
962
984
  // src/tokens/process/configs.ts
963
985
  import { register } from "@tokens-studio/sd-transforms";
964
- import * as R18 from "ramda";
986
+ import * as R19 from "ramda";
965
987
  import StyleDictionary from "style-dictionary";
966
988
 
967
989
  // src/tokens/utils.ts
968
- import * as R5 from "ramda";
969
- var mapToLowerCase = R5.map(R5.toLower);
970
- var hasAnyTruth = R5.any(R5.equals(true));
990
+ import * as R6 from "ramda";
991
+ var mapToLowerCase = R6.map(R6.toLower);
992
+ var hasAnyTruth = R6.any(R6.equals(true));
971
993
  var getType = (token) => (token.$type ?? token.type) || "";
972
994
  var getValue = (token) => token.$value ?? token.value;
973
- var typeEquals = R5.curry(
995
+ var typeEquals = R6.curry(
974
996
  (types, token) => {
975
- if (R5.isNil(token)) {
997
+ if (R6.isNil(token)) {
976
998
  return false;
977
999
  }
978
- return R5.includes(R5.toLower(getType(token)), R5.map(R5.toLower, Array.isArray(types) ? types : [types]));
1000
+ return R6.includes(R6.toLower(getType(token)), R6.map(R6.toLower, Array.isArray(types) ? types : [types]));
979
1001
  }
980
1002
  );
981
- var pathStartsWithOneOf = R5.curry(
1003
+ var pathStartsWithOneOf = R6.curry(
982
1004
  (paths, token) => {
983
- if (R5.isNil(token)) {
1005
+ if (R6.isNil(token)) {
984
1006
  return false;
985
1007
  }
986
1008
  const tokenPath = mapToLowerCase(token.path);
987
- const matchPathsStartingWith = R5.map((pathOrString) => {
1009
+ const matchPathsStartingWith = R6.map((pathOrString) => {
988
1010
  const path6 = typeof pathOrString === "string" ? [pathOrString] : pathOrString;
989
- return R5.startsWith(mapToLowerCase(path6), tokenPath);
1011
+ return R6.startsWith(mapToLowerCase(path6), tokenPath);
990
1012
  }, paths);
991
1013
  return hasAnyTruth(matchPathsStartingWith);
992
1014
  }
@@ -995,7 +1017,7 @@ function isSemanticToken(token) {
995
1017
  return token.filePath.includes("semantic/");
996
1018
  }
997
1019
  function isSemanticColorToken(token, color) {
998
- return token.filePath.includes("semantic/") && R5.startsWith(["color", color], token.path);
1020
+ return token.filePath.includes("semantic/") && R6.startsWith(["color", color], token.path);
999
1021
  }
1000
1022
  function isGlobalColorToken(token) {
1001
1023
  return typeEquals("color", token) && pathStartsWithOneOf(["global"], token);
@@ -1006,7 +1028,7 @@ function isColorCategoryToken(token, category) {
1006
1028
  (colorCategory2) => isColorCategoryToken(token, colorCategory2)
1007
1029
  );
1008
1030
  }
1009
- return R5.startsWith(["color", category], token.path);
1031
+ return R6.startsWith(["color", category], token.path);
1010
1032
  }
1011
1033
  var isDigit = (s) => /^\d+$/.test(s);
1012
1034
  function traverseObj(obj, fn) {
@@ -1022,7 +1044,7 @@ function traverseObj(obj, fn) {
1022
1044
  return obj;
1023
1045
  }
1024
1046
  function inlineTokens(shouldInline, tokens) {
1025
- const [inlineableTokens, otherTokens] = R5.partition(shouldInline, tokens);
1047
+ const [inlineableTokens, otherTokens] = R6.partition(shouldInline, tokens);
1026
1048
  return otherTokens.map((token) => {
1027
1049
  let transformed = getValue(token.original);
1028
1050
  for (const ref of inlineableTokens) {
@@ -1031,7 +1053,7 @@ function inlineTokens(shouldInline, tokens) {
1031
1053
  transformed = transformed.replaceAll(`{${refName}}`, getValue(ref.original));
1032
1054
  }
1033
1055
  }
1034
- const tokenWithInlinedRefs = R5.set(R5.lensPath(["original", "$value"]), transformed, token);
1056
+ const tokenWithInlinedRefs = R6.set(R6.lensPath(["original", "$value"]), transformed, token);
1035
1057
  return tokenWithInlinedRefs;
1036
1058
  });
1037
1059
  }
@@ -1050,14 +1072,14 @@ var sizeComparator = (size2) => {
1050
1072
  return sortIndex ?? 0;
1051
1073
  };
1052
1074
  function orderBySize(sizes) {
1053
- return R5.sortBy(sizeComparator, sizes);
1075
+ return R6.sortBy(sizeComparator, sizes);
1054
1076
  }
1055
1077
 
1056
1078
  // src/tokens/process/configs/color.ts
1057
- import * as R13 from "ramda";
1079
+ import * as R14 from "ramda";
1058
1080
 
1059
1081
  // src/tokens/process/formats/css/color.ts
1060
- import * as R6 from "ramda";
1082
+ import * as R7 from "ramda";
1061
1083
  import { createPropertyFormatter } from "style-dictionary/utils";
1062
1084
  var prefersColorScheme = (colorScheme2, content) => `
1063
1085
  @media (prefers-color-scheme: ${colorScheme2}) {
@@ -1081,8 +1103,8 @@ var colorScheme = {
1081
1103
  color-scheme: ${colorScheme_};
1082
1104
  ` : "";
1083
1105
  const filteredAllTokens = allTokens.filter(
1084
- R6.allPass([
1085
- R6.anyPass([
1106
+ R7.allPass([
1107
+ R7.anyPass([
1086
1108
  // Include semantic tokens in the output
1087
1109
  isSemanticToken,
1088
1110
  // Include global color tokens
@@ -1096,13 +1118,13 @@ var colorScheme = {
1096
1118
  token,
1097
1119
  formatted: format(token)
1098
1120
  }));
1099
- const formattedTokens = formattedMap.map(R6.view(R6.lensProp("formatted"))).join("\n");
1121
+ const formattedTokens = formattedMap.map(R7.view(R7.lensProp("formatted"))).join("\n");
1100
1122
  const content = `{
1101
1123
  ${formattedTokens}
1102
1124
  ${colorSchemeProperty}}
1103
1125
  `;
1104
1126
  const autoSelectorContent = ["light", "dark"].includes(colorScheme_) ? prefersColorScheme(colorScheme_, content) : "";
1105
- const body = R6.isNotNil(layer) ? `@layer ${layer} {
1127
+ const body = R7.isNotNil(layer) ? `@layer ${layer} {
1106
1128
  ${selector} ${content} ${autoSelectorContent}
1107
1129
  }
1108
1130
  ` : `${selector} ${content} ${autoSelectorContent}
@@ -1116,7 +1138,7 @@ var colorCategory = {
1116
1138
  const { outputReferences, usesDtcg } = options;
1117
1139
  const { selector, layer } = platform;
1118
1140
  const destination = file.destination;
1119
- const format = R6.compose(
1141
+ const format = R7.compose(
1120
1142
  createPropertyFormatter({
1121
1143
  outputReferences,
1122
1144
  dictionary,
@@ -1137,12 +1159,12 @@ var colorCategory = {
1137
1159
  formatted: format(token)
1138
1160
  }));
1139
1161
  buildOptions.buildTokenFormats[destination] = formattedMap;
1140
- const formattedTokens = formattedMap.map(R6.view(R6.lensProp("formatted"))).join("\n");
1162
+ const formattedTokens = formattedMap.map(R7.view(R7.lensProp("formatted"))).join("\n");
1141
1163
  const content = `{
1142
1164
  ${formattedTokens}
1143
1165
  }
1144
1166
  `;
1145
- const body = R6.isNotNil(layer) ? `@layer ${layer} {
1167
+ const body = R7.isNotNil(layer) ? `@layer ${layer} {
1146
1168
  ${selector} ${content}
1147
1169
  }
1148
1170
  ` : `${selector} ${content}
@@ -1152,16 +1174,16 @@ ${selector} ${content}
1152
1174
  };
1153
1175
 
1154
1176
  // src/tokens/process/formats/css/semantic.ts
1155
- import * as R8 from "ramda";
1177
+ import * as R9 from "ramda";
1156
1178
  import { createPropertyFormatter as createPropertyFormatter3 } from "style-dictionary/utils";
1157
1179
 
1158
1180
  // src/tokens/process/formats/css/size.ts
1159
- import * as R7 from "ramda";
1181
+ import * as R8 from "ramda";
1160
1182
  import { createPropertyFormatter as createPropertyFormatter2 } from "style-dictionary/utils";
1161
1183
  var isNumericBorderRadiusToken = (t) => t.path[0] === "border-radius" && isDigit(t.path[1]);
1162
1184
  var isNumericSizeToken = (t) => pathStartsWithOneOf(["size"], t) && isDigit(t.path[1]);
1163
1185
  var isSizeToken = (t) => pathStartsWithOneOf(["size"], t);
1164
- var isInlineTokens = R7.anyPass([isNumericBorderRadiusToken, isNumericSizeToken, isSizeToken]);
1186
+ var isInlineTokens = R8.anyPass([isNumericBorderRadiusToken, isNumericSizeToken, isSizeToken]);
1165
1187
  var overrideSizingFormula = (format, token) => {
1166
1188
  const [name, value] = format(token).replace(/;$/, "").split(": ");
1167
1189
  let calc;
@@ -1180,7 +1202,7 @@ var overrideSizingFormula = (format, token) => {
1180
1202
  calc
1181
1203
  };
1182
1204
  };
1183
- var formatSizingTokens = (format, tokens) => R7.reduce(
1205
+ var formatSizingTokens = (format, tokens) => R8.reduce(
1184
1206
  (acc, token) => {
1185
1207
  const { round, calc, name } = overrideSizingFormula(format, token);
1186
1208
  return {
@@ -1214,8 +1236,8 @@ var size = {
1214
1236
  usesDtcg
1215
1237
  });
1216
1238
  const tokens = inlineTokens(isInlineTokens, dictionary.allTokens);
1217
- const filteredTokens = R7.reject((token) => R7.equals(["_size", "mode-font-size"], token.path), tokens);
1218
- const [sizingTokens, restTokens] = R7.partition(
1239
+ const filteredTokens = R8.reject((token) => R8.equals(["_size", "mode-font-size"], token.path), tokens);
1240
+ const [sizingTokens, restTokens] = R8.partition(
1219
1241
  (t) => pathStartsWithOneOf(["_size"], t) && (isDigit(t.path[1]) || t.path[1] === "unit"),
1220
1242
  filteredTokens
1221
1243
  );
@@ -1229,12 +1251,12 @@ var size = {
1229
1251
  formatted: t
1230
1252
  }));
1231
1253
  buildOptions.buildTokenFormats[destination] = [...formattedMap, ...formattedSizingMap];
1232
- const formattedTokens = [formattedMap.map(R7.prop("formatted")).join("\n"), sizingTemplate(formattedSizingTokens)];
1254
+ const formattedTokens = [formattedMap.map(R8.prop("formatted")).join("\n"), sizingTemplate(formattedSizingTokens)];
1233
1255
  const content = `${selector} {
1234
1256
  ${formattedTokens.join("\n")}
1235
1257
  }
1236
1258
  `;
1237
- const body = R7.isNotNil(layer) ? `@layer ${layer} {
1259
+ const body = R8.isNotNil(layer) ? `@layer ${layer} {
1238
1260
  ${content}
1239
1261
  }
1240
1262
  ` : `${content}
@@ -1262,12 +1284,12 @@ var semantic = {
1262
1284
  formatted: format(token)
1263
1285
  }));
1264
1286
  buildOptions.buildTokenFormats[destination] = formattedMap;
1265
- const formattedTokens = formattedMap.map(R8.prop("formatted")).join("\n");
1287
+ const formattedTokens = formattedMap.map(R9.prop("formatted")).join("\n");
1266
1288
  const content = `${selector} {
1267
1289
  ${formattedTokens}
1268
1290
  }
1269
1291
  `;
1270
- const body = R8.isNotNil(layer) ? `@layer ${layer} {
1292
+ const body = R9.isNotNil(layer) ? `@layer ${layer} {
1271
1293
  ${content}
1272
1294
  }
1273
1295
  ` : `${content}
@@ -1277,13 +1299,13 @@ ${content}
1277
1299
  };
1278
1300
 
1279
1301
  // src/tokens/process/formats/css/size-mode.ts
1280
- import * as R10 from "ramda";
1302
+ import * as R11 from "ramda";
1281
1303
  import { createPropertyFormatter as createPropertyFormatter4 } from "style-dictionary/utils";
1282
1304
 
1283
1305
  // src/tokens/process/transformers.ts
1284
1306
  import { checkAndEvaluateMath } from "@tokens-studio/sd-transforms";
1285
- import * as R9 from "ramda";
1286
- var isPx = R9.test(/\b\d+px\b/g);
1307
+ import * as R10 from "ramda";
1308
+ var isPx = R10.test(/\b\d+px\b/g);
1287
1309
  var sizeRem = {
1288
1310
  name: "ds/size/toRem",
1289
1311
  type: "value",
@@ -1402,13 +1424,13 @@ ${sizes.map((size3) => ` var(--ds-size--${size3}, var(--ds-size-mode-font-siz
1402
1424
  const sharedContent = `${sizingToggles}
1403
1425
 
1404
1426
  ${sizingHelpers}`;
1405
- const sharedBody = shortSizeName(size2) === R10.last(sizes) ? `
1427
+ const sharedBody = shortSizeName(size2) === R11.last(sizes) ? `
1406
1428
  ${wrapInLayer(sharedContent, layer)}` : "";
1407
1429
  return body + sharedBody;
1408
1430
  }
1409
1431
  };
1410
1432
  function wrapInLayer(content, layer) {
1411
- return R10.isNotNil(layer) ? `@layer ${layer} {
1433
+ return R11.isNotNil(layer) ? `@layer ${layer} {
1412
1434
  ${content}
1413
1435
  }
1414
1436
  ` : `${content}
@@ -1416,11 +1438,11 @@ ${content}
1416
1438
  }
1417
1439
 
1418
1440
  // src/tokens/process/formats/css/typography.ts
1419
- import * as R11 from "ramda";
1441
+ import * as R12 from "ramda";
1420
1442
  import { createPropertyFormatter as createPropertyFormatter5 } from "style-dictionary/utils";
1421
- var typographyFontFamilyPredicate = R11.allPass([
1422
- R11.pathSatisfies(R11.includes("typography"), ["path"]),
1423
- R11.pathSatisfies(R11.includes("fontFamily"), ["path"])
1443
+ var typographyFontFamilyPredicate = R12.allPass([
1444
+ R12.pathSatisfies(R12.includes("typography"), ["path"]),
1445
+ R12.pathSatisfies(R12.includes("fontFamily"), ["path"])
1424
1446
  ]);
1425
1447
  var typography = {
1426
1448
  name: "ds/css-typography",
@@ -1434,17 +1456,17 @@ var typography = {
1434
1456
  format: "css",
1435
1457
  usesDtcg
1436
1458
  });
1437
- const filteredTokens = R11.reject(typographyFontFamilyPredicate, dictionary.allTokens);
1459
+ const filteredTokens = R12.reject(typographyFontFamilyPredicate, dictionary.allTokens);
1438
1460
  const formattedMap = filteredTokens.map((token) => ({
1439
1461
  token,
1440
1462
  formatted: format(token)
1441
1463
  }));
1442
1464
  buildOptions.buildTokenFormats[destination] = formattedMap;
1443
- const formattedTokens = formattedMap.map(R11.view(R11.lensProp("formatted"))).join("\n");
1465
+ const formattedTokens = formattedMap.map(R12.view(R12.lensProp("formatted"))).join("\n");
1444
1466
  const content = selector ? `${selector} {
1445
1467
  ${formattedTokens}
1446
1468
  }` : formattedTokens;
1447
- const body = R11.isNotNil(layer) ? `@layer ${layer} {
1469
+ const body = R12.isNotNil(layer) ? `@layer ${layer} {
1448
1470
  ${content}
1449
1471
  }` : content;
1450
1472
  return body;
@@ -1452,17 +1474,17 @@ ${content}
1452
1474
  };
1453
1475
 
1454
1476
  // src/tokens/process/formats/css/type-scale.ts
1455
- import * as R12 from "ramda";
1477
+ import * as R13 from "ramda";
1456
1478
  import { createPropertyFormatter as createPropertyFormatter6 } from "style-dictionary/utils";
1457
- var isTypographyFontFamilyToken = R12.allPass([
1458
- R12.pathSatisfies(R12.includes("typography"), ["path"]),
1459
- R12.pathSatisfies(R12.includes("fontFamily"), ["path"])
1479
+ var isTypographyFontFamilyToken = R13.allPass([
1480
+ R13.pathSatisfies(R13.includes("typography"), ["path"]),
1481
+ R13.pathSatisfies(R13.includes("fontFamily"), ["path"])
1460
1482
  ]);
1461
1483
  var formatTypographySizeToken = (format, token) => {
1462
1484
  const [name, value] = format(token).replace(/;$/, "").split(": ");
1463
1485
  let calc;
1464
1486
  let round;
1465
- if (R12.startsWith(["font-size"], token.path)) {
1487
+ if (R13.startsWith(["font-size"], token.path)) {
1466
1488
  calc = `calc(${value} * var(--_ds-font-size-factor))`;
1467
1489
  round = `round(${calc}, 1px)`;
1468
1490
  } else {
@@ -1470,7 +1492,7 @@ var formatTypographySizeToken = (format, token) => {
1470
1492
  }
1471
1493
  return { name, calc, round: round ?? calc };
1472
1494
  };
1473
- var formatTypographySizeTokens = (format, tokens) => R12.reduce(
1495
+ var formatTypographySizeTokens = (format, tokens) => R13.reduce(
1474
1496
  (acc, token) => {
1475
1497
  const { name, calc, round } = formatTypographySizeToken(format, token);
1476
1498
  acc.tokens.push(token);
@@ -1493,7 +1515,7 @@ var typeScale = {
1493
1515
  format: "css",
1494
1516
  usesDtcg
1495
1517
  });
1496
- const filteredTokens = R12.reject(R12.anyPass([isTypographyFontFamilyToken]), dictionary.allTokens);
1518
+ const filteredTokens = R13.reject(R13.anyPass([isTypographyFontFamilyToken]), dictionary.allTokens);
1497
1519
  const formattedTokens = formatTypographySizeTokens(format, filteredTokens);
1498
1520
  const formattedMap = formattedTokens.round.map((t, i) => ({
1499
1521
  token: formattedTokens.tokens[i],
@@ -1504,7 +1526,7 @@ var typeScale = {
1504
1526
  const content = `${selector} {
1505
1527
  ${sizeFactor}${sizingTemplate(formattedTokens)}
1506
1528
  }`;
1507
- const body = R12.isNotNil(layer) ? `@layer ${layer} {
1529
+ const body = R13.isNotNil(layer) ? `@layer ${layer} {
1508
1530
  ${content}
1509
1531
  }` : content;
1510
1532
  return body;
@@ -1543,7 +1565,7 @@ var colorSchemeVariables = ({ "color-scheme": colorScheme2 = "light", theme }) =
1543
1565
  {
1544
1566
  destination: `color-scheme/${colorScheme2}.css`,
1545
1567
  format: formats.colorScheme.name,
1546
- filter: (token) => typeEquals("color", token) && !R13.startsWith(["global"], token.path)
1568
+ filter: (token) => typeEquals("color", token) && !R14.startsWith(["global"], token.path)
1547
1569
  }
1548
1570
  ],
1549
1571
  options: {
@@ -1594,7 +1616,7 @@ var colorCategoryVariables = (opts) => ({ "color-scheme": colorScheme2, theme, .
1594
1616
  };
1595
1617
 
1596
1618
  // src/tokens/process/configs/semantic.ts
1597
- import * as R14 from "ramda";
1619
+ import * as R15 from "ramda";
1598
1620
  import { outputReferencesFilter } from "style-dictionary/utils";
1599
1621
  var semanticVariables = ({ theme }) => {
1600
1622
  const selector = `:root`;
@@ -1617,8 +1639,8 @@ var semanticVariables = ({ theme }) => {
1617
1639
  destination: `semantic.css`,
1618
1640
  format: formats.semantic.name,
1619
1641
  filter: (token) => {
1620
- const isUwantedToken = R14.anyPass([R14.includes("primitives/global")])(token.filePath);
1621
- const isPrivateToken = R14.includes("_", token.path);
1642
+ const isUwantedToken = R15.anyPass([R15.includes("primitives/global")])(token.filePath);
1643
+ const isPrivateToken = R15.includes("_", token.path);
1622
1644
  const unwantedPaths = pathStartsWithOneOf(
1623
1645
  ["size", "_size", "font-size", "line-height", "letter-spacing"],
1624
1646
  token
@@ -1641,7 +1663,7 @@ var semanticVariables = ({ theme }) => {
1641
1663
  };
1642
1664
 
1643
1665
  // src/tokens/process/configs/size.ts
1644
- import * as R15 from "ramda";
1666
+ import * as R16 from "ramda";
1645
1667
  import { outputReferencesFilter as outputReferencesFilter2 } from "style-dictionary/utils";
1646
1668
  var sizeVariables = ({ theme }) => {
1647
1669
  const selector = `:root, [data-size]`;
@@ -1664,8 +1686,8 @@ var sizeVariables = ({ theme }) => {
1664
1686
  destination: `size.css`,
1665
1687
  format: formats.size.name,
1666
1688
  filter: (token) => {
1667
- const isUwantedToken = R15.anyPass([R15.includes("primitives/global")])(token.filePath);
1668
- const isPrivateToken = R15.includes("_", token.path);
1689
+ const isUwantedToken = R16.anyPass([R16.includes("primitives/global")])(token.filePath);
1690
+ const isPrivateToken = R16.includes("_", token.path);
1669
1691
  return pathStartsWithOneOf(["size", "_size"], token) && !(isUwantedToken || isPrivateToken);
1670
1692
  }
1671
1693
  }
@@ -1682,7 +1704,7 @@ var sizeVariables = ({ theme }) => {
1682
1704
  };
1683
1705
 
1684
1706
  // src/tokens/process/configs/size-mode.ts
1685
- import * as R16 from "ramda";
1707
+ import * as R17 from "ramda";
1686
1708
  var sizeModeVariables = ({ theme, size: size2 }) => {
1687
1709
  const selector = `:root`;
1688
1710
  const layer = `ds.theme.size-mode`;
@@ -1705,7 +1727,7 @@ var sizeModeVariables = ({ theme, size: size2 }) => {
1705
1727
  destination: `size-mode/${size2}.css`,
1706
1728
  format: formats.sizeMode.name,
1707
1729
  filter: (token) => {
1708
- return R16.equals(["_size", "mode-font-size"], token.path);
1730
+ return R17.equals(["_size", "mode-font-size"], token.path);
1709
1731
  }
1710
1732
  }
1711
1733
  ]
@@ -1968,7 +1990,7 @@ var TypographyValues;
1968
1990
 
1969
1991
  // src/tokens/process/utils/getMultidimensionalThemes.ts
1970
1992
  import pc3 from "picocolors";
1971
- import * as R17 from "ramda";
1993
+ import * as R18 from "ramda";
1972
1994
 
1973
1995
  // src/tokens/process/utils/kebab-case.ts
1974
1996
  function kebabCase(str) {
@@ -1981,8 +2003,8 @@ var getMultidimensionalThemes = (processed$themes, dimensions) => {
1981
2003
  const grouped$themes = groupThemes(processed$themes);
1982
2004
  const permutations = permutateThemes(grouped$themes);
1983
2005
  const ALL_DEPENDENT_ON = ["theme"];
1984
- const keys3 = R17.keys(grouped$themes);
1985
- const nonDependentKeys = keys3.filter((x) => ![...ALL_DEPENDENT_ON, ...dimensions].includes(x));
2006
+ const keys4 = R18.keys(grouped$themes);
2007
+ const nonDependentKeys = keys4.filter((x) => ![...ALL_DEPENDENT_ON, ...dimensions].includes(x));
1986
2008
  if (verboseLogging) {
1987
2009
  console.log(pc3.cyan(`\u{1F50E} Finding theme permutations for ${dimensions}`));
1988
2010
  console.log(pc3.cyan(` (ignoring permutations for ${nonDependentKeys})`));
@@ -2021,7 +2043,7 @@ function groupThemes(themes) {
2021
2043
  }
2022
2044
  return groups;
2023
2045
  }
2024
- var hasUnknownProps = R17.pipe(R17.values, R17.none(R17.equals("unknown")), R17.not);
2046
+ var hasUnknownProps = R18.pipe(R18.values, R18.none(R18.equals("unknown")), R18.not);
2025
2047
  function permutateThemes(groups) {
2026
2048
  const separator = "_";
2027
2049
  const permutations = cartesian(Object.values(groups));
@@ -2031,8 +2053,8 @@ function permutateThemes(groups) {
2031
2053
  const { group, name, selectedTokenSets } = theme;
2032
2054
  let updatedPermutation = acc.permutation;
2033
2055
  if (group) {
2034
- const groupProp = R17.lensProp(group);
2035
- updatedPermutation = R17.set(groupProp, name, updatedPermutation);
2056
+ const groupProp = R18.lensProp(group);
2057
+ updatedPermutation = R18.set(groupProp, name, updatedPermutation);
2036
2058
  }
2037
2059
  const updatedName = `${String(acc.name)}${acc ? separator : ""}${name}`;
2038
2060
  const sets = [...acc.selectedTokenSets, ...filterTokenSets(selectedTokenSets)];
@@ -2123,7 +2145,7 @@ var getConfigsForThemeDimensions = (getConfig, processed$themes, dimensions, opt
2123
2145
  obj.filePath = tokenSet;
2124
2146
  }
2125
2147
  });
2126
- tokenSource.tokens = R18.mergeDeepRight(tokenSource.tokens, tokensWithFilePath);
2148
+ tokenSource.tokens = R19.mergeDeepRight(tokenSource.tokens, tokensWithFilePath);
2127
2149
  }
2128
2150
  }
2129
2151
  } else {
@@ -2236,24 +2258,24 @@ async function processPlatform(options) {
2236
2258
  buildOptions.colorGroups = colorGroups;
2237
2259
  if (!buildOptions.defaultColor) {
2238
2260
  const customColors = getCustomColors(processed$themes, colorGroups);
2239
- const firstMainColor = R19.head(customColors);
2261
+ const firstMainColor = R20.head(customColors);
2240
2262
  buildOptions.defaultColor = firstMainColor;
2241
2263
  }
2242
2264
  if (buildOptions.defaultColor) {
2243
2265
  console.log(`
2244
2266
  \u{1F3A8} Using ${pc4.blue(buildOptions.defaultColor)} as default color`);
2245
2267
  }
2246
- const sizeModes = processed$themes.filter((x) => x.group === "size").map((x) => x.name);
2247
- buildOptions.sizeModes = sizeModes;
2268
+ const sizeModes2 = processed$themes.filter((x) => x.group === "size").map((x) => x.name);
2269
+ buildOptions.sizeModes = sizeModes2;
2248
2270
  if (!buildOptions.defaultSize) {
2249
- const defaultSize = R19.head(sizeModes);
2271
+ const defaultSize = R20.head(sizeModes2);
2250
2272
  buildOptions.defaultSize = defaultSize;
2251
2273
  }
2252
2274
  if (buildOptions.defaultSize) {
2253
2275
  console.log(`
2254
2276
  \u{1F4CF} Using ${pc4.blue(buildOptions.defaultSize)} as default size`);
2255
2277
  }
2256
- const buildAndSdConfigs = R19.map((buildConfig) => {
2278
+ const buildAndSdConfigs = R20.map((buildConfig) => {
2257
2279
  const sdConfigs = getConfigsForThemeDimensions(buildConfig.getConfig, processed$themes, buildConfig.dimensions, {
2258
2280
  tokensDir,
2259
2281
  tokenSets
@@ -2287,7 +2309,7 @@ async function processPlatform(options) {
2287
2309
  typeScale: [initResult]
2288
2310
  };
2289
2311
  try {
2290
- for (const [buildName, { buildConfig, sdConfigs }] of R19.toPairs(buildAndSdConfigs)) {
2312
+ for (const [buildName, { buildConfig, sdConfigs }] of R20.toPairs(buildAndSdConfigs)) {
2291
2313
  if (!(buildConfig.enabled?.() ?? true)) {
2292
2314
  continue;
2293
2315
  }
@@ -2299,7 +2321,7 @@ async function processPlatform(options) {
2299
2321
  const { config, permutation } = sdConfig;
2300
2322
  const modes = ["theme", ...buildConfig.dimensions];
2301
2323
  const modeMessage = modes.map((x) => permutation[x]).join(" - ");
2302
- const logMessage = R19.isNil(buildConfig.log) ? modeMessage : buildConfig?.log(sdConfig);
2324
+ const logMessage = R20.isNil(buildConfig.log) ? modeMessage : buildConfig?.log(sdConfig);
2303
2325
  console.log(logMessage);
2304
2326
  const sdOptions = { cache: true };
2305
2327
  const sdExtended = await sd.extend(config);
@@ -2425,7 +2447,7 @@ ${dynamicColors}`;
2425
2447
 
2426
2448
  // src/tokens/process/output/theme.ts
2427
2449
  import pc6 from "picocolors";
2428
- import * as R20 from "ramda";
2450
+ import * as R21 from "ramda";
2429
2451
  var defaultFileHeader2 = `build: v${package_default.version}`;
2430
2452
  var getFileNameWithoutExtension = (path6) => {
2431
2453
  const pathSegments = path6.split("/");
@@ -2440,9 +2462,9 @@ var createThemeCSSFiles = ({
2440
2462
  for (const buildResult of buildResults) {
2441
2463
  const themeName = buildResult.permutation.theme;
2442
2464
  const newOutputs = buildResult.formatted;
2443
- if (R20.isNotEmpty(newOutputs)) {
2465
+ if (R21.isNotEmpty(newOutputs)) {
2444
2466
  const currentOutputs = groupedByTheme[themeName] ?? [];
2445
- groupedByTheme[themeName] = R20.concat(currentOutputs, newOutputs);
2467
+ groupedByTheme[themeName] = R21.concat(currentOutputs, newOutputs);
2446
2468
  }
2447
2469
  }
2448
2470
  }
@@ -2458,7 +2480,7 @@ var createThemeCSSFiles = ({
2458
2480
  "typography/primary",
2459
2481
  "color/"
2460
2482
  ];
2461
- const sortByDefinedOrder = R20.sortBy((file) => {
2483
+ const sortByDefinedOrder = R21.sortBy((file) => {
2462
2484
  const filePath = file.destination || "";
2463
2485
  const sortIndex = sortOrder.findIndex((sortElement) => {
2464
2486
  if (sortElement.endsWith("/")) {
@@ -2487,17 +2509,17 @@ ${fileHeader}
2487
2509
  */
2488
2510
 
2489
2511
  `;
2490
- const sortAlphabetically = R20.sort(R20.ascend((x) => x.destination || ""));
2491
- const sortBySize = R20.sortBy(
2492
- R20.pipe((s) => getFileNameWithoutExtension(s.destination ?? ""), sizeComparator)
2512
+ const sortAlphabetically = R21.sort(R21.ascend((x) => x.destination || ""));
2513
+ const sortBySize = R21.sortBy(
2514
+ R21.pipe((s) => getFileNameWithoutExtension(s.destination ?? ""), sizeComparator)
2493
2515
  );
2494
- const pickOutputs = R20.map(R20.view(R20.lensProp("output")));
2495
- const themeCSSFile = R20.pipe(
2516
+ const pickOutputs = R21.map(R21.view(R21.lensProp("output")));
2517
+ const themeCSSFile = R21.pipe(
2496
2518
  sortAlphabetically,
2497
2519
  sortBySize,
2498
2520
  sortByDefinedOrder,
2499
2521
  pickOutputs,
2500
- R20.join("\n"),
2522
+ R21.join("\n"),
2501
2523
  (content) => header + content
2502
2524
  );
2503
2525
  const themeCSSFiles = Object.entries(groupedByTheme).map(([theme, files]) => ({
@@ -2540,7 +2562,7 @@ var buildTokens = async (options) => {
2540
2562
  processed$themes,
2541
2563
  buildTokenFormats: {}
2542
2564
  });
2543
- const fileHeader = R21.join("")([
2565
+ const fileHeader = R22.join("")([
2544
2566
  defaultFileHeader2,
2545
2567
  $designsystemet ? `
2546
2568
  design-tokens: v${$designsystemet.version}` : ""
@@ -2564,7 +2586,7 @@ design-tokens: v${$designsystemet.version}` : ""
2564
2586
  // src/tokens/create/write.ts
2565
2587
  import path2 from "path";
2566
2588
  import pc8 from "picocolors";
2567
- import * as R22 from "ramda";
2589
+ import * as R23 from "ramda";
2568
2590
 
2569
2591
  // src/tokens/create/generators/$designsystemet.ts
2570
2592
  function generate$Designsystemet() {
@@ -2575,17 +2597,13 @@ function generate$Designsystemet() {
2575
2597
  }
2576
2598
 
2577
2599
  // src/tokens/create/generators/$metadata.ts
2578
- function generate$Metadata(schemes, themes, colors2) {
2600
+ function generate$Metadata(schemes, themes, colors2, sizeModes2) {
2579
2601
  return {
2580
2602
  tokenSetOrder: [
2581
2603
  "primitives/globals",
2582
- "primitives/modes/size/small",
2583
- "primitives/modes/size/medium",
2584
- "primitives/modes/size/large",
2604
+ ...sizeModes2.map((size2) => `primitives/modes/size/${size2}`),
2585
2605
  "primitives/modes/size/global",
2586
- "primitives/modes/typography/size/small",
2587
- "primitives/modes/typography/size/medium",
2588
- "primitives/modes/typography/size/large",
2606
+ ...sizeModes2.map((size2) => `primitives/modes/typography/size/${size2}`),
2589
2607
  ...themes.map((theme) => `primitives/modes/typography/primary/${theme}`),
2590
2608
  ...themes.map((theme) => `primitives/modes/typography/secondary/${theme}`),
2591
2609
  ...schemes.flatMap((scheme) => [...themes.map((theme) => `primitives/modes/color-scheme/${scheme}/${theme}`)]),
@@ -2607,9 +2625,9 @@ async function createHash(text, algo = "SHA-1") {
2607
2625
  (byte) => byte.toString(16).padStart(2, "0")
2608
2626
  ).join("");
2609
2627
  }
2610
- async function generate$Themes(colorSchemes, themes, colors2) {
2628
+ async function generate$Themes(colorSchemes, themes, colors2, sizeModes2) {
2611
2629
  return [
2612
- ...generateSizeGroup(),
2630
+ ...generateSizeGroup(sizeModes2),
2613
2631
  ...await generateThemesGroup(themes),
2614
2632
  ...generateTypographyGroup(themes),
2615
2633
  ...generateColorSchemesGroup(colorSchemes, themes),
@@ -2618,7 +2636,7 @@ async function generate$Themes(colorSchemes, themes, colors2) {
2618
2636
  ...await generateColorGroup("support", colors2)
2619
2637
  ];
2620
2638
  }
2621
- function generateSizeGroup() {
2639
+ function generateSizeGroup(_sizes) {
2622
2640
  return [
2623
2641
  {
2624
2642
  id: "8b2c8cc86611a34b135cb22948666779361fd729",
@@ -2779,6 +2797,7 @@ var writeTokens = async (options) => {
2779
2797
  const $metadataPath = path2.join(targetDir, "$metadata.json");
2780
2798
  const $designsystemetPath = path2.join(targetDir, "$designsystemet.jsonc");
2781
2799
  let themeObjects = [];
2800
+ const sizeModes2 = ["small", "medium", "large"];
2782
2801
  await mkdir(targetDir, dry);
2783
2802
  try {
2784
2803
  const $themes2 = await readFile($themesPath);
@@ -2787,18 +2806,18 @@ var writeTokens = async (options) => {
2787
2806
  }
2788
2807
  } catch (_error) {
2789
2808
  }
2790
- const concatThemeNames = R22.pipe(
2791
- R22.filter((obj) => R22.toLower(obj.group || "") === "theme"),
2792
- R22.map(R22.prop("name")),
2809
+ const concatThemeNames = R23.pipe(
2810
+ R23.filter((obj) => R23.toLower(obj.group || "") === "theme"),
2811
+ R23.map(R23.prop("name")),
2793
2812
  // New theme is added to the end of the list so we keep the same order from config and Token Studio
2794
- R22.append(themeName),
2795
- R22.uniq
2813
+ R23.append(themeName),
2814
+ R23.uniq
2796
2815
  );
2797
2816
  const themes = concatThemeNames(themeObjects);
2798
2817
  console.log(`
2799
2818
  Themes: ${pc8.blue(themes.join(", "))}`);
2800
- const $themes = await generate$Themes(["dark", "light"], themes, colors2);
2801
- const $metadata = generate$Metadata(["dark", "light"], themes, colors2);
2819
+ const $themes = await generate$Themes(["dark", "light"], themes, colors2, sizeModes2);
2820
+ const $metadata = generate$Metadata(["dark", "light"], themes, colors2, sizeModes2);
2802
2821
  const $designsystemet = generate$Designsystemet();
2803
2822
  await writeFile($themesPath, stringify($themes), dry);
2804
2823
  await writeFile($metadataPath, stringify($metadata), dry);
@@ -2812,11 +2831,94 @@ Themes: ${pc8.blue(themes.join(", "))}`);
2812
2831
  console.log(`Finished creating Designsystem design tokens in ${pc8.green(outDir)} for theme ${pc8.blue(themeName)}`);
2813
2832
  };
2814
2833
 
2815
- // src/tokens/create/defaults.ts
2816
- import * as R23 from "ramda";
2834
+ // src/tokens/create/generators/primitives/color-scheme.ts
2835
+ import * as R24 from "ramda";
2836
+ var generateColor = (colorArray, overrides) => {
2837
+ const obj = {};
2838
+ const $type = "color";
2839
+ for (const index in colorArray) {
2840
+ const position = Number(index) + 1;
2841
+ const overrideValue = overrides?.[position];
2842
+ obj[position] = {
2843
+ $type,
2844
+ $value: overrideValue || colorArray[index].hex
2845
+ };
2846
+ }
2847
+ return obj;
2848
+ };
2849
+ var generateColorScheme = (themeName, colorScheme2, colors2, overrides) => {
2850
+ const createColorOverrides = (colorName) => {
2851
+ if (!overrides?.colors || !(colorName in overrides.colors)) {
2852
+ return void 0;
2853
+ }
2854
+ const colorOverrides = overrides.colors[colorName];
2855
+ const positionOverrides = {};
2856
+ Object.entries(colorOverrides).forEach(([semanticTokenName, modeOverrides]) => {
2857
+ const position = colorMetadata[semanticTokenName].number;
2858
+ if (position) {
2859
+ let overrideValue;
2860
+ if (colorScheme2 === "light" && modeOverrides.light) {
2861
+ overrideValue = modeOverrides.light;
2862
+ } else if (colorScheme2 === "dark" && modeOverrides.dark) {
2863
+ overrideValue = modeOverrides.dark;
2864
+ }
2865
+ if (overrideValue) {
2866
+ positionOverrides[position] = overrideValue;
2867
+ }
2868
+ }
2869
+ });
2870
+ return Object.keys(positionOverrides).length > 0 ? positionOverrides : void 0;
2871
+ };
2872
+ const main = R24.mapObjIndexed(
2873
+ (color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
2874
+ colors2.main
2875
+ );
2876
+ const support = R24.mapObjIndexed(
2877
+ (color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
2878
+ colors2.support
2879
+ );
2880
+ const neutralColorScale = generateColorScale(colors2.neutral, colorScheme2);
2881
+ const neutral = generateColor(neutralColorScale, createColorOverrides("neutral"));
2882
+ const baseColorsWithOverrides = {
2883
+ ...baseColors,
2884
+ ...overrides?.severity
2885
+ };
2886
+ const globalColors = R24.mapObjIndexed(
2887
+ (color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
2888
+ baseColorsWithOverrides
2889
+ );
2890
+ const linkColor = generateColor(generateColorScale(dsLinkColor, colorScheme2));
2891
+ const defaultLinkVisited = linkColor[12];
2892
+ const linkOverride = overrides?.linkVisited?.[colorScheme2] ? { $type: "color", $value: overrides.linkVisited[colorScheme2] } : void 0;
2893
+ const defaultFocusInner = neutralColorScale[0].hex;
2894
+ const defaultFocusOuter = neutralColorScale[10].hex;
2895
+ const focusInnerOverride = overrides?.focus?.inner?.[colorScheme2];
2896
+ const focusOuterOverride = overrides?.focus?.outer?.[colorScheme2];
2897
+ return {
2898
+ [themeName]: {
2899
+ ...main,
2900
+ ...support,
2901
+ neutral,
2902
+ ...globalColors,
2903
+ link: {
2904
+ visited: linkOverride || defaultLinkVisited
2905
+ },
2906
+ focus: {
2907
+ inner: {
2908
+ $type: "color",
2909
+ $value: focusInnerOverride || defaultFocusInner
2910
+ },
2911
+ outer: {
2912
+ $type: "color",
2913
+ $value: focusOuterOverride || defaultFocusOuter
2914
+ }
2915
+ }
2916
+ }
2917
+ };
2918
+ };
2817
2919
 
2818
- // src/tokens/template/design-tokens/primitives/globals.json with { type: 'json' }
2819
- var globals_default = {
2920
+ // src/tokens/create/generators/primitives/globals.ts
2921
+ var globals = {
2820
2922
  "border-width": {
2821
2923
  "1": {
2822
2924
  $type: "borderWidth",
@@ -2959,9 +3061,10 @@ var globals_default = {
2959
3061
  }
2960
3062
  }
2961
3063
  };
3064
+ var generateGlobals = () => globals;
2962
3065
 
2963
- // src/tokens/template/design-tokens/primitives/modes/size/global.json with { type: 'json' }
2964
- var global_default = {
3066
+ // src/tokens/create/generators/primitives/size.ts
3067
+ var global = {
2965
3068
  _size: {
2966
3069
  "0": {
2967
3070
  $type: "dimension",
@@ -3061,540 +3164,444 @@ var global_default = {
3061
3164
  }
3062
3165
  }
3063
3166
  };
3064
-
3065
- // src/tokens/template/design-tokens/primitives/modes/size/large.json with { type: 'json' }
3066
- var large_default = {
3067
- size: {
3068
- "_mode-font-size": {
3069
- $type: "dimension",
3070
- $value: "21"
3071
- },
3072
- _base: {
3073
- $type: "dimension",
3074
- $value: "18"
3075
- },
3076
- _step: {
3077
- $type: "dimension",
3078
- $value: "4"
3167
+ var sizeModes = {
3168
+ large: {
3169
+ size: {
3170
+ "_mode-font-size": {
3171
+ $type: "dimension",
3172
+ $value: "21"
3173
+ },
3174
+ _base: {
3175
+ $type: "dimension",
3176
+ $value: "18"
3177
+ },
3178
+ _step: {
3179
+ $type: "dimension",
3180
+ $value: "4"
3181
+ }
3182
+ }
3183
+ },
3184
+ medium: {
3185
+ size: {
3186
+ "_mode-font-size": {
3187
+ $type: "dimension",
3188
+ $value: "18"
3189
+ },
3190
+ _base: {
3191
+ $type: "dimension",
3192
+ $value: "18"
3193
+ },
3194
+ _step: {
3195
+ $type: "dimension",
3196
+ $value: "4"
3197
+ }
3198
+ }
3199
+ },
3200
+ small: {
3201
+ size: {
3202
+ "_mode-font-size": {
3203
+ $type: "dimension",
3204
+ $value: "16"
3205
+ },
3206
+ _base: {
3207
+ $type: "dimension",
3208
+ $value: "18"
3209
+ },
3210
+ _step: {
3211
+ $type: "dimension",
3212
+ $value: "4"
3213
+ }
3079
3214
  }
3080
3215
  }
3081
3216
  };
3217
+ var generateSize = (size2) => sizeModes[size2];
3218
+ var generateSizeGlobal = () => global;
3082
3219
 
3083
- // src/tokens/template/design-tokens/primitives/modes/size/medium.json with { type: 'json' }
3084
- var medium_default = {
3085
- size: {
3086
- "_mode-font-size": {
3087
- $type: "dimension",
3088
- $value: "18"
3089
- },
3090
- _base: {
3091
- $type: "dimension",
3092
- $value: "18"
3220
+ // src/tokens/create/generators/primitives/typography.ts
3221
+ var generateTypography = (themeName, { fontFamily }) => ({
3222
+ [themeName]: {
3223
+ "font-family": {
3224
+ $type: "fontFamilies",
3225
+ $value: fontFamily
3093
3226
  },
3094
- _step: {
3095
- $type: "dimension",
3096
- $value: "4"
3227
+ "font-weight": {
3228
+ medium: {
3229
+ $type: "fontWeights",
3230
+ $value: "Medium"
3231
+ },
3232
+ semibold: {
3233
+ $type: "fontWeights",
3234
+ $value: "Semi bold"
3235
+ },
3236
+ regular: {
3237
+ $type: "fontWeights",
3238
+ $value: "Regular"
3239
+ }
3097
3240
  }
3098
3241
  }
3242
+ });
3243
+ var generateFontSizes = (size2) => fontSizes[size2];
3244
+ var lineHeights = {
3245
+ sm: {
3246
+ $type: "lineHeights",
3247
+ $value: "130%"
3248
+ },
3249
+ md: {
3250
+ $type: "lineHeights",
3251
+ $value: "150%"
3252
+ },
3253
+ lg: {
3254
+ $type: "lineHeights",
3255
+ $value: "170%"
3256
+ }
3099
3257
  };
3100
-
3101
- // src/tokens/template/design-tokens/primitives/modes/size/small.json with { type: 'json' }
3102
- var small_default = {
3103
- size: {
3104
- "_mode-font-size": {
3105
- $type: "dimension",
3106
- $value: "16"
3107
- },
3108
- _base: {
3109
- $type: "dimension",
3110
- $value: "18"
3111
- },
3112
- _step: {
3113
- $type: "dimension",
3114
- $value: "4"
3115
- }
3258
+ var letterSpacings = {
3259
+ "1": {
3260
+ $type: "letterSpacing",
3261
+ $value: "-1%"
3262
+ },
3263
+ "2": {
3264
+ $type: "letterSpacing",
3265
+ $value: "-0.5%"
3266
+ },
3267
+ "3": {
3268
+ $type: "letterSpacing",
3269
+ $value: "-0.25%"
3270
+ },
3271
+ "4": {
3272
+ $type: "letterSpacing",
3273
+ $value: "-0.15%"
3274
+ },
3275
+ "5": {
3276
+ $type: "letterSpacing",
3277
+ $value: "0%"
3278
+ },
3279
+ "6": {
3280
+ $type: "letterSpacing",
3281
+ $value: "0.15%"
3282
+ },
3283
+ "7": {
3284
+ $type: "letterSpacing",
3285
+ $value: "0.25%"
3286
+ },
3287
+ "8": {
3288
+ $type: "letterSpacing",
3289
+ $value: "0.5%"
3290
+ },
3291
+ "9": {
3292
+ $type: "letterSpacing",
3293
+ $value: "1.5%"
3116
3294
  }
3117
3295
  };
3118
-
3119
- // src/tokens/template/design-tokens/primitives/modes/typography/size/large.json with { type: 'json' }
3120
- var large_default2 = {
3121
- "line-height": {
3122
- sm: {
3123
- $type: "lineHeights",
3124
- $value: "130%"
3125
- },
3126
- md: {
3127
- $type: "lineHeights",
3128
- $value: "150%"
3296
+ var fontSizes = {
3297
+ large: {
3298
+ "line-height": lineHeights,
3299
+ "font-size": {
3300
+ "1": {
3301
+ $type: "fontSizes",
3302
+ $value: "13"
3303
+ },
3304
+ "2": {
3305
+ $type: "fontSizes",
3306
+ $value: "16"
3307
+ },
3308
+ "3": {
3309
+ $type: "fontSizes",
3310
+ $value: "18"
3311
+ },
3312
+ "4": {
3313
+ $type: "fontSizes",
3314
+ $value: "21"
3315
+ },
3316
+ "5": {
3317
+ $type: "fontSizes",
3318
+ $value: "24"
3319
+ },
3320
+ "6": {
3321
+ $type: "fontSizes",
3322
+ $value: "30"
3323
+ },
3324
+ "7": {
3325
+ $type: "fontSizes",
3326
+ $value: "36"
3327
+ },
3328
+ "8": {
3329
+ $type: "fontSizes",
3330
+ $value: "48"
3331
+ },
3332
+ "9": {
3333
+ $type: "fontSizes",
3334
+ $value: "60"
3335
+ },
3336
+ "10": {
3337
+ $type: "fontSizes",
3338
+ $value: "72"
3339
+ }
3129
3340
  },
3130
- lg: {
3131
- $type: "lineHeights",
3132
- $value: "170%"
3133
- }
3341
+ "letter-spacing": letterSpacings
3134
3342
  },
3135
- "font-size": {
3136
- "1": {
3137
- $type: "fontSizes",
3138
- $value: "13"
3139
- },
3140
- "2": {
3141
- $type: "fontSizes",
3142
- $value: "16"
3143
- },
3144
- "3": {
3145
- $type: "fontSizes",
3146
- $value: "18"
3147
- },
3148
- "4": {
3149
- $type: "fontSizes",
3150
- $value: "21"
3151
- },
3152
- "5": {
3153
- $type: "fontSizes",
3154
- $value: "24"
3155
- },
3156
- "6": {
3157
- $type: "fontSizes",
3158
- $value: "30"
3159
- },
3160
- "7": {
3161
- $type: "fontSizes",
3162
- $value: "36"
3163
- },
3164
- "8": {
3165
- $type: "fontSizes",
3166
- $value: "48"
3167
- },
3168
- "9": {
3169
- $type: "fontSizes",
3170
- $value: "60"
3343
+ medium: {
3344
+ "line-height": lineHeights,
3345
+ "font-size": {
3346
+ "1": {
3347
+ $type: "fontSizes",
3348
+ $value: "12"
3349
+ },
3350
+ "2": {
3351
+ $type: "fontSizes",
3352
+ $value: "14"
3353
+ },
3354
+ "3": {
3355
+ $type: "fontSizes",
3356
+ $value: "16"
3357
+ },
3358
+ "4": {
3359
+ $type: "fontSizes",
3360
+ $value: "18"
3361
+ },
3362
+ "5": {
3363
+ $type: "fontSizes",
3364
+ $value: "21"
3365
+ },
3366
+ "6": {
3367
+ $type: "fontSizes",
3368
+ $value: "24"
3369
+ },
3370
+ "7": {
3371
+ $type: "fontSizes",
3372
+ $value: "30"
3373
+ },
3374
+ "8": {
3375
+ $type: "fontSizes",
3376
+ $value: "36"
3377
+ },
3378
+ "9": {
3379
+ $type: "fontSizes",
3380
+ $value: "48"
3381
+ },
3382
+ "10": {
3383
+ $type: "fontSizes",
3384
+ $value: "60"
3385
+ }
3171
3386
  },
3172
- "10": {
3173
- $type: "fontSizes",
3174
- $value: "72"
3175
- }
3387
+ "letter-spacing": letterSpacings
3176
3388
  },
3177
- "letter-spacing": {
3178
- "1": {
3179
- $type: "letterSpacing",
3180
- $value: "-1%"
3181
- },
3182
- "2": {
3183
- $type: "letterSpacing",
3184
- $value: "-0.5%"
3185
- },
3186
- "3": {
3187
- $type: "letterSpacing",
3188
- $value: "-0.25%"
3189
- },
3190
- "4": {
3191
- $type: "letterSpacing",
3192
- $value: "-0.15%"
3193
- },
3194
- "5": {
3195
- $type: "letterSpacing",
3196
- $value: "0%"
3197
- },
3198
- "6": {
3199
- $type: "letterSpacing",
3200
- $value: "0.15%"
3201
- },
3202
- "7": {
3203
- $type: "letterSpacing",
3204
- $value: "0.25%"
3205
- },
3206
- "8": {
3207
- $type: "letterSpacing",
3208
- $value: "0.5%"
3389
+ small: {
3390
+ "line-height": lineHeights,
3391
+ "font-size": {
3392
+ "1": {
3393
+ $type: "fontSizes",
3394
+ $value: "11"
3395
+ },
3396
+ "2": {
3397
+ $type: "fontSizes",
3398
+ $value: "13"
3399
+ },
3400
+ "3": {
3401
+ $type: "fontSizes",
3402
+ $value: "14"
3403
+ },
3404
+ "4": {
3405
+ $type: "fontSizes",
3406
+ $value: "16"
3407
+ },
3408
+ "5": {
3409
+ $type: "fontSizes",
3410
+ $value: "18"
3411
+ },
3412
+ "6": {
3413
+ $type: "fontSizes",
3414
+ $value: "21"
3415
+ },
3416
+ "7": {
3417
+ $type: "fontSizes",
3418
+ $value: "24"
3419
+ },
3420
+ "8": {
3421
+ $type: "fontSizes",
3422
+ $value: "30"
3423
+ },
3424
+ "9": {
3425
+ $type: "fontSizes",
3426
+ $value: "36"
3427
+ },
3428
+ "10": {
3429
+ $type: "fontSizes",
3430
+ $value: "48"
3431
+ }
3209
3432
  },
3210
- "9": {
3211
- $type: "letterSpacing",
3212
- $value: "1.5%"
3213
- }
3433
+ "letter-spacing": letterSpacings
3214
3434
  }
3215
3435
  };
3216
3436
 
3217
- // src/tokens/template/design-tokens/primitives/modes/typography/size/medium.json with { type: 'json' }
3218
- var medium_default2 = {
3219
- "line-height": {
3220
- sm: {
3221
- $type: "lineHeights",
3222
- $value: "130%"
3223
- },
3224
- md: {
3225
- $type: "lineHeights",
3226
- $value: "150%"
3227
- },
3228
- lg: {
3229
- $type: "lineHeights",
3230
- $value: "170%"
3437
+ // src/tokens/create/generators/semantic/color.ts
3438
+ import * as R25 from "ramda";
3439
+ var generateSemanticColors = (colors2, _themeName) => {
3440
+ const mainColorNames = Object.keys(colors2.main);
3441
+ const supportColorNames = Object.keys(colors2.support);
3442
+ const customColors = [...mainColorNames, "neutral", ...supportColorNames];
3443
+ const allColors = [...customColors, ...baseColorNames];
3444
+ const semanticColorTokens = allColors.map((colorName) => [colorName, generateColorScaleTokens(colorName)]);
3445
+ return {
3446
+ ...baseColorTemplate,
3447
+ color: {
3448
+ ...Object.fromEntries(semanticColorTokens),
3449
+ ...baseColorTemplate.color
3231
3450
  }
3232
- },
3233
- "font-size": {
3234
- "1": {
3235
- $type: "fontSizes",
3236
- $value: "12"
3237
- },
3238
- "2": {
3239
- $type: "fontSizes",
3240
- $value: "14"
3241
- },
3242
- "3": {
3243
- $type: "fontSizes",
3244
- $value: "16"
3245
- },
3246
- "4": {
3247
- $type: "fontSizes",
3248
- $value: "18"
3249
- },
3250
- "5": {
3251
- $type: "fontSizes",
3252
- $value: "21"
3253
- },
3254
- "6": {
3255
- $type: "fontSizes",
3256
- $value: "24"
3257
- },
3258
- "7": {
3259
- $type: "fontSizes",
3260
- $value: "30"
3261
- },
3262
- "8": {
3263
- $type: "fontSizes",
3264
- $value: "36"
3265
- },
3266
- "9": {
3267
- $type: "fontSizes",
3268
- $value: "48"
3269
- },
3270
- "10": {
3271
- $type: "fontSizes",
3272
- $value: "60"
3451
+ };
3452
+ };
3453
+ var baseColorTemplate = {
3454
+ color: {
3455
+ focus: {
3456
+ inner: {
3457
+ $type: "color",
3458
+ $value: "{color.focus.inner-color}"
3459
+ },
3460
+ outer: {
3461
+ $type: "color",
3462
+ $value: "{color.focus.outer-color}"
3463
+ }
3273
3464
  }
3274
3465
  },
3275
- "letter-spacing": {
3276
- "1": {
3277
- $type: "letterSpacing",
3278
- $value: "-1%"
3279
- },
3280
- "2": {
3281
- $type: "letterSpacing",
3282
- $value: "-0.5%"
3283
- },
3284
- "3": {
3285
- $type: "letterSpacing",
3286
- $value: "-0.25%"
3287
- },
3288
- "4": {
3289
- $type: "letterSpacing",
3290
- $value: "-0.15%"
3291
- },
3292
- "5": {
3293
- $type: "letterSpacing",
3294
- $value: "0%"
3295
- },
3296
- "6": {
3297
- $type: "letterSpacing",
3298
- $value: "0.15%"
3299
- },
3300
- "7": {
3301
- $type: "letterSpacing",
3302
- $value: "0.25%"
3303
- },
3304
- "8": {
3305
- $type: "letterSpacing",
3306
- $value: "0.5%"
3307
- },
3308
- "9": {
3309
- $type: "letterSpacing",
3310
- $value: "1.5%"
3466
+ link: {
3467
+ color: {
3468
+ visited: {
3469
+ $type: "color",
3470
+ $value: "{color.link.visited}"
3471
+ }
3311
3472
  }
3312
3473
  }
3313
3474
  };
3475
+ var generateColorScaleTokens = (colorName) => {
3476
+ const colorScale = {};
3477
+ for (const [colorSemantic, colorNumber] of R25.toPairs(semanticColorMap)) {
3478
+ colorScale[colorSemantic] = {
3479
+ $type: "color",
3480
+ $value: `{color.${colorName}.${colorNumber}}`
3481
+ };
3482
+ }
3483
+ return colorScale;
3484
+ };
3314
3485
 
3315
- // src/tokens/template/design-tokens/primitives/modes/typography/size/small.json with { type: 'json' }
3316
- var small_default2 = {
3317
- "line-height": {
3318
- sm: {
3319
- $type: "lineHeights",
3320
- $value: "130%"
3321
- },
3322
- md: {
3323
- $type: "lineHeights",
3324
- $value: "150%"
3325
- },
3326
- lg: {
3327
- $type: "lineHeights",
3328
- $value: "170%"
3329
- }
3330
- },
3331
- "font-size": {
3332
- "1": {
3333
- $type: "fontSizes",
3334
- $value: "11"
3335
- },
3336
- "2": {
3337
- $type: "fontSizes",
3338
- $value: "13"
3339
- },
3340
- "3": {
3341
- $type: "fontSizes",
3342
- $value: "14"
3343
- },
3344
- "4": {
3345
- $type: "fontSizes",
3346
- $value: "16"
3347
- },
3348
- "5": {
3349
- $type: "fontSizes",
3350
- $value: "18"
3351
- },
3352
- "6": {
3353
- $type: "fontSizes",
3354
- $value: "21"
3355
- },
3356
- "7": {
3357
- $type: "fontSizes",
3358
- $value: "24"
3359
- },
3360
- "8": {
3361
- $type: "fontSizes",
3362
- $value: "30"
3363
- },
3364
- "9": {
3365
- $type: "fontSizes",
3366
- $value: "36"
3367
- },
3368
- "10": {
3369
- $type: "fontSizes",
3370
- $value: "48"
3371
- }
3372
- },
3373
- "letter-spacing": {
3374
- "1": {
3375
- $type: "letterSpacing",
3376
- $value: "-1%"
3377
- },
3378
- "2": {
3379
- $type: "letterSpacing",
3380
- $value: "-0.5%"
3381
- },
3382
- "3": {
3383
- $type: "letterSpacing",
3384
- $value: "-0.25%"
3385
- },
3386
- "4": {
3387
- $type: "letterSpacing",
3388
- $value: "-0.15%"
3389
- },
3390
- "5": {
3391
- $type: "letterSpacing",
3392
- $value: "0%"
3393
- },
3394
- "6": {
3395
- $type: "letterSpacing",
3396
- $value: "0.15%"
3397
- },
3398
- "7": {
3399
- $type: "letterSpacing",
3400
- $value: "0.25%"
3401
- },
3402
- "8": {
3403
- $type: "letterSpacing",
3404
- $value: "0.5%"
3405
- },
3406
- "9": {
3407
- $type: "letterSpacing",
3408
- $value: "1.5%"
3486
+ // src/tokens/create/generators/semantic/color-modes.ts
3487
+ var generateColorModes = (colors2, _themeName) => {
3488
+ const mainColorNames = Object.keys(colors2.main);
3489
+ const supportColorNames = Object.keys(colors2.support);
3490
+ const modes = {
3491
+ "main-color": {},
3492
+ "support-color": {}
3493
+ };
3494
+ const categories = [
3495
+ ["main-color", mainColorNames],
3496
+ ["support-color", supportColorNames]
3497
+ ];
3498
+ for (const [colorCategory2, colorNames2] of categories) {
3499
+ for (const colorName of colorNames2) {
3500
+ const category = colorCategory2.replace("-color", "");
3501
+ const customColorTokens = {
3502
+ color: {
3503
+ [category]: generateColorScaleTokens2(colorName)
3504
+ }
3505
+ };
3506
+ modes[colorCategory2][colorName] = customColorTokens;
3409
3507
  }
3410
3508
  }
3509
+ return modes;
3510
+ };
3511
+ var generateColorScaleTokens2 = (colorName) => {
3512
+ const colorScale = {};
3513
+ for (const colorSemantic of semanticColorNames) {
3514
+ colorScale[colorSemantic] = {
3515
+ $type: "color",
3516
+ $value: `{color.${colorName}.${colorSemantic}}`
3517
+ };
3518
+ }
3519
+ return colorScale;
3411
3520
  };
3412
3521
 
3413
- // src/tokens/template/design-tokens/semantic/style.json with { type: 'json' }
3414
- var style_default = {
3415
- typography: {
3416
- heading: {
3417
- "2xl": {
3418
- $type: "typography",
3419
- $value: {
3420
- fontFamily: "{font-family}",
3421
- fontWeight: "{font-weight.medium}",
3422
- lineHeight: "{line-height.sm}",
3423
- fontSize: "{font-size.10}",
3424
- letterSpacing: "{letter-spacing.1}"
3425
- }
3426
- },
3427
- xl: {
3428
- $type: "typography",
3429
- $value: {
3430
- fontFamily: "{font-family}",
3431
- fontWeight: "{font-weight.medium}",
3432
- lineHeight: "{line-height.sm}",
3433
- fontSize: "{font-size.9}",
3434
- letterSpacing: "{letter-spacing.1}"
3435
- }
3436
- },
3437
- lg: {
3438
- $type: "typography",
3439
- $value: {
3440
- fontFamily: "{font-family}",
3441
- fontWeight: "{font-weight.medium}",
3442
- lineHeight: "{line-height.sm}",
3443
- fontSize: "{font-size.8}",
3444
- letterSpacing: "{letter-spacing.2}"
3445
- }
3446
- },
3447
- md: {
3448
- $type: "typography",
3449
- $value: {
3450
- fontFamily: "{font-family}",
3451
- fontWeight: "{font-weight.medium}",
3452
- lineHeight: "{line-height.sm}",
3453
- fontSize: "{font-size.7}",
3454
- letterSpacing: "{letter-spacing.3}"
3455
- }
3456
- },
3457
- sm: {
3458
- $type: "typography",
3459
- $value: {
3460
- fontFamily: "{font-family}",
3461
- fontWeight: "{font-weight.medium}",
3462
- lineHeight: "{line-height.sm}",
3463
- fontSize: "{font-size.6}",
3464
- letterSpacing: "{letter-spacing.5}"
3465
- }
3466
- },
3467
- xs: {
3468
- $type: "typography",
3469
- $value: {
3470
- fontFamily: "{font-family}",
3471
- fontWeight: "{font-weight.medium}",
3472
- lineHeight: "{line-height.sm}",
3473
- fontSize: "{font-size.5}",
3474
- letterSpacing: "{letter-spacing.6}"
3475
- }
3476
- },
3477
- "2xs": {
3478
- $type: "typography",
3479
- $value: {
3480
- fontFamily: "{font-family}",
3481
- fontWeight: "{font-weight.medium}",
3482
- lineHeight: "{line-height.sm}",
3483
- fontSize: "{font-size.4}",
3484
- letterSpacing: "{letter-spacing.6}"
3485
- }
3486
- }
3487
- },
3488
- body: {
3489
- xl: {
3490
- $type: "typography",
3491
- $value: {
3492
- fontFamily: "{font-family}",
3493
- fontWeight: "{font-weight.regular}",
3494
- lineHeight: "{line-height.md}",
3495
- fontSize: "{font-size.6}",
3496
- letterSpacing: "{letter-spacing.8}"
3497
- }
3498
- },
3499
- lg: {
3500
- $type: "typography",
3501
- $value: {
3502
- fontFamily: "{font-family}",
3503
- fontWeight: "{font-weight.regular}",
3504
- lineHeight: "{line-height.md}",
3505
- fontSize: "{font-size.5}",
3506
- letterSpacing: "{letter-spacing.8}"
3507
- }
3508
- },
3509
- md: {
3510
- $type: "typography",
3511
- $value: {
3512
- fontFamily: "{font-family}",
3513
- fontWeight: "{font-weight.regular}",
3514
- lineHeight: "{line-height.md}",
3515
- fontSize: "{font-size.4}",
3516
- letterSpacing: "{letter-spacing.8}"
3517
- }
3518
- },
3519
- sm: {
3520
- $type: "typography",
3521
- $value: {
3522
- fontFamily: "{font-family}",
3523
- fontWeight: "{font-weight.regular}",
3524
- lineHeight: "{line-height.md}",
3525
- fontSize: "{font-size.3}",
3526
- letterSpacing: "{letter-spacing.7}"
3527
- }
3528
- },
3529
- xs: {
3530
- $type: "typography",
3531
- $value: {
3532
- fontFamily: "{font-family}",
3533
- fontWeight: "{font-weight.regular}",
3534
- lineHeight: "{line-height.md}",
3535
- fontSize: "{font-size.2}",
3536
- letterSpacing: "{letter-spacing.6}"
3537
- }
3538
- },
3539
- short: {
3522
+ // src/tokens/create/generators/semantic/style.ts
3523
+ function generateSemanticStyle() {
3524
+ return {
3525
+ typography: {
3526
+ heading: {
3527
+ "2xl": {
3528
+ $type: "typography",
3529
+ $value: {
3530
+ fontFamily: "{font-family}",
3531
+ fontWeight: "{font-weight.medium}",
3532
+ lineHeight: "{line-height.sm}",
3533
+ fontSize: "{font-size.10}",
3534
+ letterSpacing: "{letter-spacing.1}"
3535
+ }
3536
+ },
3540
3537
  xl: {
3541
3538
  $type: "typography",
3542
3539
  $value: {
3543
3540
  fontFamily: "{font-family}",
3544
- fontWeight: "{font-weight.regular}",
3541
+ fontWeight: "{font-weight.medium}",
3545
3542
  lineHeight: "{line-height.sm}",
3546
- fontSize: "{font-size.6}",
3547
- letterSpacing: "{letter-spacing.8}"
3543
+ fontSize: "{font-size.9}",
3544
+ letterSpacing: "{letter-spacing.1}"
3548
3545
  }
3549
3546
  },
3550
3547
  lg: {
3551
3548
  $type: "typography",
3552
3549
  $value: {
3553
3550
  fontFamily: "{font-family}",
3554
- fontWeight: "{font-weight.regular}",
3551
+ fontWeight: "{font-weight.medium}",
3555
3552
  lineHeight: "{line-height.sm}",
3556
- fontSize: "{font-size.5}",
3557
- letterSpacing: "{letter-spacing.8}"
3553
+ fontSize: "{font-size.8}",
3554
+ letterSpacing: "{letter-spacing.2}"
3558
3555
  }
3559
3556
  },
3560
3557
  md: {
3561
3558
  $type: "typography",
3562
3559
  $value: {
3563
3560
  fontFamily: "{font-family}",
3564
- fontWeight: "{font-weight.regular}",
3561
+ fontWeight: "{font-weight.medium}",
3565
3562
  lineHeight: "{line-height.sm}",
3566
- fontSize: "{font-size.4}",
3567
- letterSpacing: "{letter-spacing.8}"
3563
+ fontSize: "{font-size.7}",
3564
+ letterSpacing: "{letter-spacing.3}"
3568
3565
  }
3569
3566
  },
3570
3567
  sm: {
3571
3568
  $type: "typography",
3572
3569
  $value: {
3573
3570
  fontFamily: "{font-family}",
3574
- fontWeight: "{font-weight.regular}",
3571
+ fontWeight: "{font-weight.medium}",
3575
3572
  lineHeight: "{line-height.sm}",
3576
- fontSize: "{font-size.3}",
3577
- letterSpacing: "{letter-spacing.7}"
3573
+ fontSize: "{font-size.6}",
3574
+ letterSpacing: "{letter-spacing.5}"
3578
3575
  }
3579
3576
  },
3580
3577
  xs: {
3581
3578
  $type: "typography",
3582
3579
  $value: {
3583
3580
  fontFamily: "{font-family}",
3584
- fontWeight: "{font-weight.regular}",
3581
+ fontWeight: "{font-weight.medium}",
3585
3582
  lineHeight: "{line-height.sm}",
3586
- fontSize: "{font-size.2}",
3583
+ fontSize: "{font-size.5}",
3584
+ letterSpacing: "{letter-spacing.6}"
3585
+ }
3586
+ },
3587
+ "2xs": {
3588
+ $type: "typography",
3589
+ $value: {
3590
+ fontFamily: "{font-family}",
3591
+ fontWeight: "{font-weight.medium}",
3592
+ lineHeight: "{line-height.sm}",
3593
+ fontSize: "{font-size.4}",
3587
3594
  letterSpacing: "{letter-spacing.6}"
3588
3595
  }
3589
3596
  }
3590
3597
  },
3591
- long: {
3598
+ body: {
3592
3599
  xl: {
3593
3600
  $type: "typography",
3594
3601
  $value: {
3595
3602
  fontFamily: "{font-family}",
3596
3603
  fontWeight: "{font-weight.regular}",
3597
- lineHeight: "{line-height.lg}",
3604
+ lineHeight: "{line-height.md}",
3598
3605
  fontSize: "{font-size.6}",
3599
3606
  letterSpacing: "{letter-spacing.8}"
3600
3607
  }
@@ -3604,7 +3611,7 @@ var style_default = {
3604
3611
  $value: {
3605
3612
  fontFamily: "{font-family}",
3606
3613
  fontWeight: "{font-weight.regular}",
3607
- lineHeight: "{line-height.lg}",
3614
+ lineHeight: "{line-height.md}",
3608
3615
  fontSize: "{font-size.5}",
3609
3616
  letterSpacing: "{letter-spacing.8}"
3610
3617
  }
@@ -3614,7 +3621,7 @@ var style_default = {
3614
3621
  $value: {
3615
3622
  fontFamily: "{font-family}",
3616
3623
  fontWeight: "{font-weight.regular}",
3617
- lineHeight: "{line-height.lg}",
3624
+ lineHeight: "{line-height.md}",
3618
3625
  fontSize: "{font-size.4}",
3619
3626
  letterSpacing: "{letter-spacing.8}"
3620
3627
  }
@@ -3624,7 +3631,7 @@ var style_default = {
3624
3631
  $value: {
3625
3632
  fontFamily: "{font-family}",
3626
3633
  fontWeight: "{font-weight.regular}",
3627
- lineHeight: "{line-height.lg}",
3634
+ lineHeight: "{line-height.md}",
3628
3635
  fontSize: "{font-size.3}",
3629
3636
  letterSpacing: "{letter-spacing.7}"
3630
3637
  }
@@ -3634,505 +3641,333 @@ var style_default = {
3634
3641
  $value: {
3635
3642
  fontFamily: "{font-family}",
3636
3643
  fontWeight: "{font-weight.regular}",
3637
- lineHeight: "{line-height.lg}",
3644
+ lineHeight: "{line-height.md}",
3638
3645
  fontSize: "{font-size.2}",
3639
3646
  letterSpacing: "{letter-spacing.6}"
3640
3647
  }
3648
+ },
3649
+ short: {
3650
+ xl: {
3651
+ $type: "typography",
3652
+ $value: {
3653
+ fontFamily: "{font-family}",
3654
+ fontWeight: "{font-weight.regular}",
3655
+ lineHeight: "{line-height.sm}",
3656
+ fontSize: "{font-size.6}",
3657
+ letterSpacing: "{letter-spacing.8}"
3658
+ }
3659
+ },
3660
+ lg: {
3661
+ $type: "typography",
3662
+ $value: {
3663
+ fontFamily: "{font-family}",
3664
+ fontWeight: "{font-weight.regular}",
3665
+ lineHeight: "{line-height.sm}",
3666
+ fontSize: "{font-size.5}",
3667
+ letterSpacing: "{letter-spacing.8}"
3668
+ }
3669
+ },
3670
+ md: {
3671
+ $type: "typography",
3672
+ $value: {
3673
+ fontFamily: "{font-family}",
3674
+ fontWeight: "{font-weight.regular}",
3675
+ lineHeight: "{line-height.sm}",
3676
+ fontSize: "{font-size.4}",
3677
+ letterSpacing: "{letter-spacing.8}"
3678
+ }
3679
+ },
3680
+ sm: {
3681
+ $type: "typography",
3682
+ $value: {
3683
+ fontFamily: "{font-family}",
3684
+ fontWeight: "{font-weight.regular}",
3685
+ lineHeight: "{line-height.sm}",
3686
+ fontSize: "{font-size.3}",
3687
+ letterSpacing: "{letter-spacing.7}"
3688
+ }
3689
+ },
3690
+ xs: {
3691
+ $type: "typography",
3692
+ $value: {
3693
+ fontFamily: "{font-family}",
3694
+ fontWeight: "{font-weight.regular}",
3695
+ lineHeight: "{line-height.sm}",
3696
+ fontSize: "{font-size.2}",
3697
+ letterSpacing: "{letter-spacing.6}"
3698
+ }
3699
+ }
3700
+ },
3701
+ long: {
3702
+ xl: {
3703
+ $type: "typography",
3704
+ $value: {
3705
+ fontFamily: "{font-family}",
3706
+ fontWeight: "{font-weight.regular}",
3707
+ lineHeight: "{line-height.lg}",
3708
+ fontSize: "{font-size.6}",
3709
+ letterSpacing: "{letter-spacing.8}"
3710
+ }
3711
+ },
3712
+ lg: {
3713
+ $type: "typography",
3714
+ $value: {
3715
+ fontFamily: "{font-family}",
3716
+ fontWeight: "{font-weight.regular}",
3717
+ lineHeight: "{line-height.lg}",
3718
+ fontSize: "{font-size.5}",
3719
+ letterSpacing: "{letter-spacing.8}"
3720
+ }
3721
+ },
3722
+ md: {
3723
+ $type: "typography",
3724
+ $value: {
3725
+ fontFamily: "{font-family}",
3726
+ fontWeight: "{font-weight.regular}",
3727
+ lineHeight: "{line-height.lg}",
3728
+ fontSize: "{font-size.4}",
3729
+ letterSpacing: "{letter-spacing.8}"
3730
+ }
3731
+ },
3732
+ sm: {
3733
+ $type: "typography",
3734
+ $value: {
3735
+ fontFamily: "{font-family}",
3736
+ fontWeight: "{font-weight.regular}",
3737
+ lineHeight: "{line-height.lg}",
3738
+ fontSize: "{font-size.3}",
3739
+ letterSpacing: "{letter-spacing.7}"
3740
+ }
3741
+ },
3742
+ xs: {
3743
+ $type: "typography",
3744
+ $value: {
3745
+ fontFamily: "{font-family}",
3746
+ fontWeight: "{font-weight.regular}",
3747
+ lineHeight: "{line-height.lg}",
3748
+ fontSize: "{font-size.2}",
3749
+ letterSpacing: "{letter-spacing.6}"
3750
+ }
3751
+ }
3641
3752
  }
3642
3753
  }
3643
- }
3644
- },
3645
- opacity: {
3646
- disabled: {
3647
- $type: "opacity",
3648
- $value: "{opacity.30}"
3649
- }
3650
- },
3651
- "border-width": {
3652
- default: {
3653
- $type: "borderWidth",
3654
- $value: "{border-width.1}"
3655
3754
  },
3656
- focus: {
3657
- $type: "borderWidth",
3658
- $value: "{border-width.3}"
3659
- }
3660
- },
3661
- shadow: {
3662
- xs: {
3663
- $type: "boxShadow",
3664
- $value: "{shadow.100}"
3665
- },
3666
- sm: {
3667
- $type: "boxShadow",
3668
- $value: "{shadow.200}"
3669
- },
3670
- md: {
3671
- $type: "boxShadow",
3672
- $value: "{shadow.300}"
3673
- },
3674
- lg: {
3675
- $type: "boxShadow",
3676
- $value: "{shadow.400}"
3677
- },
3678
- xl: {
3679
- $type: "boxShadow",
3680
- $value: "{shadow.500}"
3681
- }
3682
- },
3683
- "border-radius": {
3684
- sm: {
3685
- $type: "dimension",
3686
- $value: "{border-radius.1}"
3687
- },
3688
- md: {
3689
- $type: "dimension",
3690
- $value: "{border-radius.2}"
3691
- },
3692
- lg: {
3693
- $type: "dimension",
3694
- $value: "{border-radius.3}"
3695
- },
3696
- xl: {
3697
- $type: "dimension",
3698
- $value: "{border-radius.4}"
3699
- },
3700
- default: {
3701
- $type: "dimension",
3702
- $value: "{border-radius.5}"
3703
- },
3704
- full: {
3705
- $type: "dimension",
3706
- $value: "{border-radius.6}"
3707
- }
3708
- },
3709
- size: {
3710
- "0": {
3711
- $type: "dimension",
3712
- $value: "{_size.0}"
3713
- },
3714
- "1": {
3715
- $type: "dimension",
3716
- $value: "{_size.1}"
3717
- },
3718
- "2": {
3719
- $type: "dimension",
3720
- $value: "{_size.2}"
3721
- },
3722
- "3": {
3723
- $type: "dimension",
3724
- $value: "{_size.3}"
3725
- },
3726
- "4": {
3727
- $type: "dimension",
3728
- $value: "{_size.4}"
3729
- },
3730
- "5": {
3731
- $type: "dimension",
3732
- $value: "{_size.5}"
3733
- },
3734
- "6": {
3735
- $type: "dimension",
3736
- $value: "{_size.6}"
3737
- },
3738
- "7": {
3739
- $type: "dimension",
3740
- $value: "{_size.7}"
3741
- },
3742
- "8": {
3743
- $type: "dimension",
3744
- $value: "{_size.8}"
3745
- },
3746
- "9": {
3747
- $type: "dimension",
3748
- $value: "{_size.9}"
3749
- },
3750
- "10": {
3751
- $type: "dimension",
3752
- $value: "{_size.10}"
3753
- },
3754
- "11": {
3755
- $type: "dimension",
3756
- $value: "{_size.11}"
3757
- },
3758
- "12": {
3759
- $type: "dimension",
3760
- $value: "{_size.12}"
3761
- },
3762
- "13": {
3763
- $type: "dimension",
3764
- $value: "{_size.13}"
3765
- },
3766
- "14": {
3767
- $type: "dimension",
3768
- $value: "{_size.14}"
3769
- },
3770
- "15": {
3771
- $type: "dimension",
3772
- $value: "{_size.15}"
3755
+ opacity: {
3756
+ disabled: {
3757
+ $type: "opacity",
3758
+ $value: "{opacity.30}"
3759
+ }
3773
3760
  },
3774
- "18": {
3775
- $type: "dimension",
3776
- $value: "{_size.18}"
3761
+ "border-width": {
3762
+ default: {
3763
+ $type: "borderWidth",
3764
+ $value: "{border-width.1}"
3765
+ },
3766
+ focus: {
3767
+ $type: "borderWidth",
3768
+ $value: "{border-width.3}"
3769
+ }
3777
3770
  },
3778
- "22": {
3779
- $type: "dimension",
3780
- $value: "{_size.22}"
3771
+ shadow: {
3772
+ xs: {
3773
+ $type: "boxShadow",
3774
+ $value: "{shadow.100}"
3775
+ },
3776
+ sm: {
3777
+ $type: "boxShadow",
3778
+ $value: "{shadow.200}"
3779
+ },
3780
+ md: {
3781
+ $type: "boxShadow",
3782
+ $value: "{shadow.300}"
3783
+ },
3784
+ lg: {
3785
+ $type: "boxShadow",
3786
+ $value: "{shadow.400}"
3787
+ },
3788
+ xl: {
3789
+ $type: "boxShadow",
3790
+ $value: "{shadow.500}"
3791
+ }
3781
3792
  },
3782
- "26": {
3783
- $type: "dimension",
3784
- $value: "{_size.26}"
3793
+ "border-radius": {
3794
+ sm: {
3795
+ $type: "dimension",
3796
+ $value: "{border-radius.1}"
3797
+ },
3798
+ md: {
3799
+ $type: "dimension",
3800
+ $value: "{border-radius.2}"
3801
+ },
3802
+ lg: {
3803
+ $type: "dimension",
3804
+ $value: "{border-radius.3}"
3805
+ },
3806
+ xl: {
3807
+ $type: "dimension",
3808
+ $value: "{border-radius.4}"
3809
+ },
3810
+ default: {
3811
+ $type: "dimension",
3812
+ $value: "{border-radius.5}"
3813
+ },
3814
+ full: {
3815
+ $type: "dimension",
3816
+ $value: "{border-radius.6}"
3817
+ }
3785
3818
  },
3786
- "30": {
3787
- $type: "dimension",
3788
- $value: "{_size.30}"
3789
- }
3790
- }
3791
- };
3792
-
3793
- // src/tokens/create/defaults.ts
3794
- var defaultTokens = {
3795
- "primitives/globals": globals_default,
3796
- "primitives/modes/size/small": small_default,
3797
- "primitives/modes/size/medium": medium_default,
3798
- "primitives/modes/size/large": large_default,
3799
- "primitives/modes/size/global": global_default,
3800
- "primitives/modes/typography/size/small": small_default2,
3801
- "primitives/modes/typography/size/medium": medium_default2,
3802
- "primitives/modes/typography/size/large": large_default2,
3803
- "semantic/style": style_default
3804
- };
3805
- var getDefaultTokens = (tokenSets) => Object.entries(R23.pick(tokenSets, defaultTokens));
3806
- var getDefaultToken = (tokenPath) => {
3807
- return [tokenPath, defaultTokens[tokenPath]];
3808
- };
3809
-
3810
- // src/tokens/create/generators/color.ts
3811
- import * as R24 from "ramda";
3812
- var generateColor = (colorArray, overrides) => {
3813
- const obj = {};
3814
- const $type = "color";
3815
- for (const index in colorArray) {
3816
- const position = Number(index) + 1;
3817
- const overrideValue = overrides?.[position];
3818
- obj[position] = {
3819
- $type,
3820
- $value: overrideValue || colorArray[index].hex
3821
- };
3822
- }
3823
- return obj;
3824
- };
3825
- var generateColorScheme = (themeName, colorScheme2, colors2, overrides) => {
3826
- const createColorOverrides = (colorName) => {
3827
- if (!overrides?.colors || !(colorName in overrides.colors)) {
3828
- return void 0;
3829
- }
3830
- const colorOverrides = overrides.colors[colorName];
3831
- const positionOverrides = {};
3832
- Object.entries(colorOverrides).forEach(([semanticTokenName, modeOverrides]) => {
3833
- const position = colorMetadata[semanticTokenName].number;
3834
- if (position) {
3835
- let overrideValue;
3836
- if (colorScheme2 === "light" && modeOverrides.light) {
3837
- overrideValue = modeOverrides.light;
3838
- } else if (colorScheme2 === "dark" && modeOverrides.dark) {
3839
- overrideValue = modeOverrides.dark;
3840
- }
3841
- if (overrideValue) {
3842
- positionOverrides[position] = overrideValue;
3843
- }
3819
+ size: {
3820
+ "0": {
3821
+ $type: "dimension",
3822
+ $value: "{_size.0}"
3823
+ },
3824
+ "1": {
3825
+ $type: "dimension",
3826
+ $value: "{_size.1}"
3827
+ },
3828
+ "2": {
3829
+ $type: "dimension",
3830
+ $value: "{_size.2}"
3831
+ },
3832
+ "3": {
3833
+ $type: "dimension",
3834
+ $value: "{_size.3}"
3835
+ },
3836
+ "4": {
3837
+ $type: "dimension",
3838
+ $value: "{_size.4}"
3839
+ },
3840
+ "5": {
3841
+ $type: "dimension",
3842
+ $value: "{_size.5}"
3843
+ },
3844
+ "6": {
3845
+ $type: "dimension",
3846
+ $value: "{_size.6}"
3847
+ },
3848
+ "7": {
3849
+ $type: "dimension",
3850
+ $value: "{_size.7}"
3851
+ },
3852
+ "8": {
3853
+ $type: "dimension",
3854
+ $value: "{_size.8}"
3855
+ },
3856
+ "9": {
3857
+ $type: "dimension",
3858
+ $value: "{_size.9}"
3859
+ },
3860
+ "10": {
3861
+ $type: "dimension",
3862
+ $value: "{_size.10}"
3863
+ },
3864
+ "11": {
3865
+ $type: "dimension",
3866
+ $value: "{_size.11}"
3867
+ },
3868
+ "12": {
3869
+ $type: "dimension",
3870
+ $value: "{_size.12}"
3871
+ },
3872
+ "13": {
3873
+ $type: "dimension",
3874
+ $value: "{_size.13}"
3875
+ },
3876
+ "14": {
3877
+ $type: "dimension",
3878
+ $value: "{_size.14}"
3879
+ },
3880
+ "15": {
3881
+ $type: "dimension",
3882
+ $value: "{_size.15}"
3883
+ },
3884
+ "18": {
3885
+ $type: "dimension",
3886
+ $value: "{_size.18}"
3887
+ },
3888
+ "22": {
3889
+ $type: "dimension",
3890
+ $value: "{_size.22}"
3891
+ },
3892
+ "26": {
3893
+ $type: "dimension",
3894
+ $value: "{_size.26}"
3895
+ },
3896
+ "30": {
3897
+ $type: "dimension",
3898
+ $value: "{_size.30}"
3844
3899
  }
3845
- });
3846
- return Object.keys(positionOverrides).length > 0 ? positionOverrides : void 0;
3847
- };
3848
- const main = R24.mapObjIndexed(
3849
- (color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
3850
- colors2.main
3851
- );
3852
- const support = R24.mapObjIndexed(
3853
- (color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
3854
- colors2.support
3855
- );
3856
- const neutralColorScale = generateColorScale(colors2.neutral, colorScheme2);
3857
- const neutral = generateColor(neutralColorScale, createColorOverrides("neutral"));
3858
- const baseColorsWithOverrides = {
3859
- ...baseColors,
3860
- ...overrides?.severity
3900
+ }
3861
3901
  };
3862
- const globalColors = R24.mapObjIndexed(
3863
- (color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
3864
- baseColorsWithOverrides
3902
+ }
3903
+
3904
+ // src/tokens/create/generators/themes/theme.ts
3905
+ import * as R26 from "ramda";
3906
+ var generateTheme = (colors2, themeName, borderRadius) => {
3907
+ const mainColorNames = Object.keys(colors2.main);
3908
+ const supportColorNames = Object.keys(colors2.support);
3909
+ const customColors = [...mainColorNames, "neutral", ...supportColorNames, ...baseColorNames];
3910
+ const themeColorTokens = Object.fromEntries(
3911
+ customColors.map((colorName) => [colorName, generateColorScaleTokens3(colorName, themeName)])
3865
3912
  );
3866
- const linkColor = generateColor(generateColorScale(dsLinkColor, colorScheme2));
3867
- const defaultLinkVisited = linkColor[12];
3868
- const linkOverride = overrides?.linkVisited?.[colorScheme2] ? { $type: "color", $value: overrides.linkVisited[colorScheme2] } : void 0;
3869
- const defaultFocusInner = neutralColorScale[0].hex;
3870
- const defaultFocusOuter = neutralColorScale[10].hex;
3871
- const focusInnerOverride = overrides?.focus?.inner?.[colorScheme2];
3872
- const focusOuterOverride = overrides?.focus?.outer?.[colorScheme2];
3873
- return {
3874
- [themeName]: {
3875
- ...main,
3876
- ...support,
3877
- neutral,
3878
- ...globalColors,
3913
+ const { color: themeBaseFileColor, ...remainingThemeFile } = generateBase(themeName);
3914
+ const themeFile = {
3915
+ color: {
3916
+ ...themeColorTokens,
3917
+ ...themeBaseFileColor,
3879
3918
  link: {
3880
- visited: linkOverride || defaultLinkVisited
3919
+ visited: {
3920
+ $type: "color",
3921
+ $value: `{${themeName}.link.visited}`
3922
+ }
3881
3923
  },
3882
3924
  focus: {
3883
- inner: {
3925
+ "inner-color": {
3884
3926
  $type: "color",
3885
- $value: focusInnerOverride || defaultFocusInner
3927
+ $value: `{${themeName}.focus.inner}`
3886
3928
  },
3887
- outer: {
3929
+ "outer-color": {
3888
3930
  $type: "color",
3889
- $value: focusOuterOverride || defaultFocusOuter
3931
+ $value: `{${themeName}.focus.outer}`
3890
3932
  }
3891
3933
  }
3892
- }
3893
- };
3894
- };
3895
-
3896
- // src/tokens/create/generators/semantic.ts
3897
- import * as R25 from "ramda";
3898
-
3899
- // src/tokens/template/design-tokens/semantic/color.base.template.json with { type: 'json' }
3900
- var color_base_template_default = {
3901
- color: {
3902
- focus: {
3903
- inner: {
3904
- $type: "color",
3905
- $value: "{color.focus.inner-color}"
3906
- },
3907
- outer: {
3908
- $type: "color",
3909
- $value: "{color.focus.outer-color}"
3910
- }
3911
- }
3912
- },
3913
- link: {
3914
- color: {
3915
- visited: {
3916
- $type: "color",
3917
- $value: "{color.link.visited}"
3918
- }
3919
- }
3920
- }
3921
- };
3922
-
3923
- // src/tokens/template/design-tokens/semantic/color.template.json with { type: 'json' }
3924
- var color_template_default = {
3925
- "background-default": {
3926
- $type: "color",
3927
- $value: "{color.<color>.1}"
3928
- },
3929
- "background-tinted": {
3930
- $type: "color",
3931
- $value: "{color.<color>.2}"
3932
- },
3933
- "surface-default": {
3934
- $type: "color",
3935
- $value: "{color.<color>.3}"
3936
- },
3937
- "surface-tinted": {
3938
- $type: "color",
3939
- $value: "{color.<color>.4}"
3940
- },
3941
- "surface-hover": {
3942
- $type: "color",
3943
- $value: "{color.<color>.5}"
3944
- },
3945
- "surface-active": {
3946
- $type: "color",
3947
- $value: "{color.<color>.6}"
3948
- },
3949
- "border-subtle": {
3950
- $type: "color",
3951
- $value: "{color.<color>.7}"
3952
- },
3953
- "border-default": {
3954
- $type: "color",
3955
- $value: "{color.<color>.8}"
3956
- },
3957
- "border-strong": {
3958
- $type: "color",
3959
- $value: "{color.<color>.9}"
3960
- },
3961
- "text-subtle": {
3962
- $type: "color",
3963
- $value: "{color.<color>.10}"
3964
- },
3965
- "text-default": {
3966
- $type: "color",
3967
- $value: "{color.<color>.11}"
3968
- },
3969
- "base-default": {
3970
- $type: "color",
3971
- $value: "{color.<color>.12}"
3972
- },
3973
- "base-hover": {
3974
- $type: "color",
3975
- $value: "{color.<color>.13}"
3976
- },
3977
- "base-active": {
3978
- $type: "color",
3979
- $value: "{color.<color>.14}"
3980
- },
3981
- "base-contrast-subtle": {
3982
- $type: "color",
3983
- $value: "{color.<color>.15}"
3984
- },
3985
- "base-contrast-default": {
3986
- $type: "color",
3987
- $value: "{color.<color>.16}"
3988
- }
3989
- };
3990
-
3991
- // src/tokens/template/design-tokens/semantic/modes/color.template.json with { type: 'json' }
3992
- var color_template_default2 = {
3993
- "background-default": {
3994
- $type: "color",
3995
- $value: "{color.<color>.background-default}"
3996
- },
3997
- "background-tinted": {
3998
- $type: "color",
3999
- $value: "{color.<color>.background-tinted}"
4000
- },
4001
- "surface-default": {
4002
- $type: "color",
4003
- $value: "{color.<color>.surface-default}"
4004
- },
4005
- "surface-tinted": {
4006
- $type: "color",
4007
- $value: "{color.<color>.surface-tinted}"
4008
- },
4009
- "surface-hover": {
4010
- $type: "color",
4011
- $value: "{color.<color>.surface-hover}"
4012
- },
4013
- "surface-active": {
4014
- $type: "color",
4015
- $value: "{color.<color>.surface-active}"
4016
- },
4017
- "border-subtle": {
4018
- $type: "color",
4019
- $value: "{color.<color>.border-subtle}"
4020
- },
4021
- "border-default": {
4022
- $type: "color",
4023
- $value: "{color.<color>.border-default}"
4024
- },
4025
- "border-strong": {
4026
- $type: "color",
4027
- $value: "{color.<color>.border-strong}"
4028
- },
4029
- "text-subtle": {
4030
- $type: "color",
4031
- $value: "{color.<color>.text-subtle}"
4032
- },
4033
- "text-default": {
4034
- $type: "color",
4035
- $value: "{color.<color>.text-default}"
4036
- },
4037
- "base-default": {
4038
- $type: "color",
4039
- $value: "{color.<color>.base-default}"
4040
- },
4041
- "base-hover": {
4042
- $type: "color",
4043
- $value: "{color.<color>.base-hover}"
4044
- },
4045
- "base-active": {
4046
- $type: "color",
4047
- $value: "{color.<color>.base-active}"
4048
- },
4049
- "base-contrast-subtle": {
4050
- $type: "color",
4051
- $value: "{color.<color>.base-contrast-subtle}"
4052
- },
4053
- "base-contrast-default": {
4054
- $type: "color",
4055
- $value: "{color.<color>.base-contrast-default}"
4056
- }
4057
- };
4058
-
4059
- // src/tokens/create/generators/semantic.ts
4060
- var generateSemantic = (colors2, _themeName) => {
4061
- const mainColorNames = Object.keys(colors2.main);
4062
- const supportColorNames = Object.keys(colors2.support);
4063
- const modes = {
4064
- "main-color": {},
4065
- "support-color": {}
3934
+ },
3935
+ ...remainingThemeFile
4066
3936
  };
4067
- const categories = [
4068
- ["main-color", mainColorNames],
4069
- ["support-color", supportColorNames]
4070
- ];
4071
- for (const [colorCategory2, colorNames2] of categories) {
4072
- for (const colorName of colorNames2) {
4073
- const category = colorCategory2.replace("-color", "");
4074
- const customColorTokens = {
4075
- color: {
4076
- [category]: JSON.parse(
4077
- JSON.stringify(
4078
- color_template_default2,
4079
- (key, value) => {
4080
- if (key === "$value") {
4081
- return value.replace("<color>", colorName);
4082
- }
4083
- return value;
4084
- },
4085
- 2
4086
- )
4087
- )
3937
+ const baseBorderRadius = R26.lensPath(["border-radius", "base", "$value"]);
3938
+ const updatedThemeFile = R26.set(baseBorderRadius, String(borderRadius), themeFile);
3939
+ const token = JSON.parse(
3940
+ JSON.stringify(
3941
+ updatedThemeFile,
3942
+ (key, value) => {
3943
+ if (key === "$value") {
3944
+ return value.replace("<theme>", themeName);
4088
3945
  }
4089
- };
4090
- modes[colorCategory2][colorName] = customColorTokens;
4091
- }
4092
- }
4093
- const customColors = [...mainColorNames, "neutral", ...supportColorNames];
4094
- const allColors = [...customColors, ...baseColorNames];
4095
- const semanticColorTokens = allColors.map(
4096
- (colorName) => [
4097
- colorName,
4098
- R25.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), color_template_default)
4099
- ]
3946
+ return value;
3947
+ },
3948
+ 2
3949
+ )
4100
3950
  );
4101
- const color = {
4102
- ...color_base_template_default,
4103
- color: {
4104
- ...Object.fromEntries(semanticColorTokens),
4105
- ...color_base_template_default.color
4106
- }
4107
- };
4108
- return {
4109
- modes,
4110
- color
4111
- };
3951
+ return token;
4112
3952
  };
4113
-
4114
- // src/tokens/create/generators/theme.ts
4115
- import * as R26 from "ramda";
4116
-
4117
- // src/tokens/template/design-tokens/themes/theme.base.template.json with { type: 'json' }
4118
- var theme_base_template_default = {
3953
+ var generateBase = (themeName) => ({
4119
3954
  color: {},
4120
3955
  "font-family": {
4121
3956
  $type: "fontFamilies",
4122
- $value: "{<theme>.font-family}"
3957
+ $value: `{${themeName}.font-family}`
4123
3958
  },
4124
3959
  "font-weight": {
4125
3960
  medium: {
4126
3961
  $type: "fontWeights",
4127
- $value: "{<theme>.font-weight.medium}"
3962
+ $value: `{${themeName}.font-weight.medium}`
4128
3963
  },
4129
3964
  semibold: {
4130
3965
  $type: "fontWeights",
4131
- $value: "{<theme>.font-weight.semibold}"
3966
+ $value: `{${themeName}.font-weight.semibold}`
4132
3967
  },
4133
3968
  regular: {
4134
3969
  $type: "fontWeights",
4135
- $value: "{<theme>.font-weight.regular}"
3970
+ $value: `{${themeName}.font-weight.regular}`
4136
3971
  }
4137
3972
  },
4138
3973
  "border-radius": {
@@ -4169,159 +4004,16 @@ var theme_base_template_default = {
4169
4004
  $value: "4"
4170
4005
  }
4171
4006
  }
4172
- };
4173
-
4174
- // src/tokens/template/design-tokens/themes/theme.template.json with { type: 'json' }
4175
- var theme_template_default = {
4176
- "1": {
4177
- $type: "color",
4178
- $value: "{<theme>.<color>.1}"
4179
- },
4180
- "2": {
4181
- $type: "color",
4182
- $value: "{<theme>.<color>.2}"
4183
- },
4184
- "3": {
4185
- $type: "color",
4186
- $value: "{<theme>.<color>.3}"
4187
- },
4188
- "4": {
4189
- $type: "color",
4190
- $value: "{<theme>.<color>.4}"
4191
- },
4192
- "5": {
4193
- $type: "color",
4194
- $value: "{<theme>.<color>.5}"
4195
- },
4196
- "6": {
4197
- $type: "color",
4198
- $value: "{<theme>.<color>.6}"
4199
- },
4200
- "7": {
4201
- $type: "color",
4202
- $value: "{<theme>.<color>.7}"
4203
- },
4204
- "8": {
4205
- $type: "color",
4206
- $value: "{<theme>.<color>.8}"
4207
- },
4208
- "9": {
4209
- $type: "color",
4210
- $value: "{<theme>.<color>.9}"
4211
- },
4212
- "10": {
4213
- $type: "color",
4214
- $value: "{<theme>.<color>.10}"
4215
- },
4216
- "11": {
4217
- $type: "color",
4218
- $value: "{<theme>.<color>.11}"
4219
- },
4220
- "12": {
4221
- $type: "color",
4222
- $value: "{<theme>.<color>.12}"
4223
- },
4224
- "13": {
4225
- $type: "color",
4226
- $value: "{<theme>.<color>.13}"
4227
- },
4228
- "14": {
4229
- $type: "color",
4230
- $value: "{<theme>.<color>.14}"
4231
- },
4232
- "15": {
4233
- $type: "color",
4234
- $value: "{<theme>.<color>.15}"
4235
- },
4236
- "16": {
4237
- $type: "color",
4238
- $value: "{<theme>.<color>.16}"
4239
- }
4240
- };
4241
-
4242
- // src/tokens/create/generators/theme.ts
4243
- var generateTheme = (colors2, themeName, borderRadius) => {
4244
- const mainColorNames = Object.keys(colors2.main);
4245
- const supportColorNames = Object.keys(colors2.support);
4246
- const customColors = [...mainColorNames, "neutral", ...supportColorNames, ...baseColorNames];
4247
- const themeColorTokens = Object.fromEntries(
4248
- customColors.map(
4249
- (colorName) => [
4250
- colorName,
4251
- R26.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), theme_template_default)
4252
- ]
4253
- )
4254
- );
4255
- const { color: themeBaseFileColor, ...remainingThemeFile } = theme_base_template_default;
4256
- const themeFile = {
4257
- color: {
4258
- ...themeColorTokens,
4259
- ...themeBaseFileColor,
4260
- link: {
4261
- visited: {
4262
- $type: "color",
4263
- $value: `{${themeName}.link.visited}`
4264
- }
4265
- },
4266
- focus: {
4267
- "inner-color": {
4268
- $type: "color",
4269
- $value: `{${themeName}.focus.inner}`
4270
- },
4271
- "outer-color": {
4272
- $type: "color",
4273
- $value: `{${themeName}.focus.outer}`
4274
- }
4275
- }
4276
- },
4277
- ...remainingThemeFile
4278
- };
4279
- const baseBorderRadius = R26.lensPath(["border-radius", "base", "$value"]);
4280
- const updatedThemeFile = R26.set(baseBorderRadius, String(borderRadius), themeFile);
4281
- const token = JSON.parse(
4282
- JSON.stringify(
4283
- updatedThemeFile,
4284
- (key, value) => {
4285
- if (key === "$value") {
4286
- return value.replace("<theme>", themeName);
4287
- }
4288
- return value;
4289
- },
4290
- 2
4291
- )
4292
- );
4293
- return token;
4294
- };
4295
-
4296
- // src/tokens/template/design-tokens/primitives/modes/typography/typography.template.json with { type: 'json' }
4297
- var typography_template_default = {
4298
- "<theme>": {
4299
- "font-family": {
4300
- $type: "fontFamilies",
4301
- $value: "<font-family>"
4302
- },
4303
- "font-weight": {
4304
- medium: {
4305
- $type: "fontWeights",
4306
- $value: "Medium"
4307
- },
4308
- semibold: {
4309
- $type: "fontWeights",
4310
- $value: "Semi bold"
4311
- },
4312
- regular: {
4313
- $type: "fontWeights",
4314
- $value: "Regular"
4315
- }
4316
- }
4007
+ });
4008
+ var generateColorScaleTokens3 = (colorName, themeName) => {
4009
+ const colorScale = {};
4010
+ for (const [_, colorNumber] of R26.toPairs(semanticColorMap)) {
4011
+ colorScale[colorNumber] = {
4012
+ $type: "color",
4013
+ $value: `{${themeName}.${colorName}.${colorNumber}}`
4014
+ };
4317
4015
  }
4318
- };
4319
-
4320
- // src/tokens/create/generators/typography.ts
4321
- var generateTypography = (themeName, { fontFamily }) => {
4322
- return JSON.parse(
4323
- JSON.stringify(typography_template_default).replaceAll(/<font-family>/g, fontFamily).replaceAll(/<theme>/g, themeName)
4324
- );
4016
+ return colorScale;
4325
4017
  };
4326
4018
 
4327
4019
  // src/tokens/create.ts
@@ -4341,20 +4033,17 @@ var cliOptions = {
4341
4033
  borderRadius: "border-radius"
4342
4034
  }
4343
4035
  };
4344
- var createTokens = async (opts) => {
4345
- const { colors: colors2, typography: typography2, name, borderRadius, overrides } = opts;
4036
+ var createTokens = async (theme) => {
4037
+ const { colors: colors2, typography: typography2, name, borderRadius, overrides } = theme;
4346
4038
  const colorSchemes = ["light", "dark"];
4347
- const semantic2 = generateSemantic(colors2, name);
4039
+ const sizeModes2 = ["small", "medium", "large"];
4348
4040
  const tokenSets = new Map([
4349
- ...getDefaultTokens([
4350
- "primitives/globals",
4351
- "primitives/modes/size/small",
4352
- "primitives/modes/size/medium",
4353
- "primitives/modes/size/large",
4354
- "primitives/modes/size/global",
4355
- "primitives/modes/typography/size/small",
4356
- "primitives/modes/typography/size/medium",
4357
- "primitives/modes/typography/size/large"
4041
+ ["primitives/globals", generateGlobals()],
4042
+ ...sizeModes2.map((size2) => [`primitives/modes/size/${size2}`, generateSize(size2)]),
4043
+ ["primitives/modes/size/global", generateSizeGlobal()],
4044
+ ...sizeModes2.map((size2) => [
4045
+ `primitives/modes/typography/size/${size2}`,
4046
+ generateFontSizes(size2)
4358
4047
  ]),
4359
4048
  [`primitives/modes/typography/primary/${name}`, generateTypography(name, typography2)],
4360
4049
  [`primitives/modes/typography/secondary/${name}`, generateTypography(name, typography2)],
@@ -4362,12 +4051,12 @@ var createTokens = async (opts) => {
4362
4051
  [`primitives/modes/color-scheme/${scheme}/${name}`, generateColorScheme(name, scheme, colors2, overrides)]
4363
4052
  ]),
4364
4053
  [`themes/${name}`, generateTheme(colors2, name, borderRadius)],
4365
- ["semantic/color", semantic2.color],
4054
+ ["semantic/color", generateSemanticColors(colors2, name)],
4366
4055
  // maps out semantic modes, ieg 'semantic/modes/main-color/accent', and 'semantic/modes/support-color/brand1'
4367
- ...Object.entries(semantic2.modes).flatMap(
4056
+ ...Object.entries(generateColorModes(colors2, name)).flatMap(
4368
4057
  ([mode, colors3]) => Object.entries(colors3).map(([key, colorSet]) => [`semantic/modes/${mode}/${key}`, colorSet])
4369
4058
  ),
4370
- getDefaultToken("semantic/style")
4059
+ [`semantic/style`, generateSemanticStyle()]
4371
4060
  ]);
4372
4061
  return { tokenSets };
4373
4062
  };