@digdir/designsystemet 1.4.0 → 1.5.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 (60) hide show
  1. package/dist/bin/designsystemet.js +485 -163
  2. package/dist/global-Y35YADVH.json +100 -0
  3. package/dist/src/index.js +524 -200
  4. package/dist/src/scripts/update-preview-tokens.js +429 -118
  5. package/dist/src/tokens/build.js +426 -108
  6. package/dist/src/tokens/create/defaults.js +27 -23
  7. package/dist/src/tokens/create/generators/$designsystemet.js +3 -3
  8. package/dist/src/tokens/create/write.js +3 -3
  9. package/dist/src/tokens/create.js +27 -23
  10. package/dist/src/tokens/format.js +524 -200
  11. package/dist/src/tokens/index.js +524 -200
  12. package/dist/src/tokens/process/configs/color.js +366 -66
  13. package/dist/src/tokens/process/configs/semantic.d.ts.map +1 -1
  14. package/dist/src/tokens/process/configs/semantic.js +368 -68
  15. package/dist/src/tokens/process/configs/shared.js +9 -2
  16. package/dist/src/tokens/process/configs/size-mode.d.ts +3 -0
  17. package/dist/src/tokens/process/configs/size-mode.d.ts.map +1 -0
  18. package/dist/src/tokens/process/configs/size-mode.js +1067 -0
  19. package/dist/src/tokens/process/configs/size.d.ts +3 -0
  20. package/dist/src/tokens/process/configs/size.d.ts.map +1 -0
  21. package/dist/src/tokens/process/configs/size.js +1069 -0
  22. package/dist/src/tokens/process/configs/type-scale.d.ts +3 -0
  23. package/dist/src/tokens/process/configs/type-scale.d.ts.map +1 -0
  24. package/dist/src/tokens/process/configs/type-scale.js +1067 -0
  25. package/dist/src/tokens/process/configs/typography.d.ts.map +1 -1
  26. package/dist/src/tokens/process/configs/typography.js +364 -64
  27. package/dist/src/tokens/process/configs.d.ts +3 -0
  28. package/dist/src/tokens/process/configs.d.ts.map +1 -1
  29. package/dist/src/tokens/process/configs.js +373 -71
  30. package/dist/src/tokens/process/formats/css/color.js +381 -79
  31. package/dist/src/tokens/process/formats/css/semantic.d.ts +0 -14
  32. package/dist/src/tokens/process/formats/css/semantic.d.ts.map +1 -1
  33. package/dist/src/tokens/process/formats/css/semantic.js +407 -109
  34. package/dist/src/tokens/process/formats/css/size-mode.d.ts +4 -0
  35. package/dist/src/tokens/process/formats/css/size-mode.d.ts.map +1 -0
  36. package/dist/src/tokens/process/formats/css/size-mode.js +1068 -0
  37. package/dist/src/tokens/process/formats/css/size.d.ts +17 -0
  38. package/dist/src/tokens/process/formats/css/size.d.ts.map +1 -0
  39. package/dist/src/tokens/process/formats/css/size.js +1069 -0
  40. package/dist/src/tokens/process/formats/css/type-scale.d.ts +3 -0
  41. package/dist/src/tokens/process/formats/css/type-scale.d.ts.map +1 -0
  42. package/dist/src/tokens/process/formats/css/type-scale.js +1069 -0
  43. package/dist/src/tokens/process/formats/css/typography.js +365 -63
  44. package/dist/src/tokens/process/formats/css.d.ts +3 -0
  45. package/dist/src/tokens/process/formats/css.d.ts.map +1 -1
  46. package/dist/src/tokens/process/formats/css.js +364 -64
  47. package/dist/src/tokens/process/output/declarations.js +373 -71
  48. package/dist/src/tokens/process/output/theme.d.ts.map +1 -1
  49. package/dist/src/tokens/process/output/theme.js +60 -11
  50. package/dist/src/tokens/process/platform.d.ts +16 -0
  51. package/dist/src/tokens/process/platform.d.ts.map +1 -1
  52. package/dist/src/tokens/process/platform.js +402 -95
  53. package/dist/src/tokens/process/transformers.js +9 -2
  54. package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +373 -71
  55. package/dist/src/tokens/template/design-tokens/primitives/modes/size/global.js +1 -1
  56. package/dist/src/tokens/utils.d.ts +4 -1
  57. package/dist/src/tokens/utils.d.ts.map +1 -1
  58. package/dist/src/tokens/utils.js +24 -1
  59. package/package.json +3 -3
  60. package/dist/global-XVXVBKM6.json +0 -96
@@ -151,95 +151,99 @@ var global_default = {
151
151
  _size: {
152
152
  "0": {
153
153
  $type: "dimension",
154
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *0)"
154
+ $value: "floor({_size.unit} * 0)"
155
155
  },
156
156
  "1": {
157
157
  $type: "dimension",
158
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *1)"
158
+ $value: "floor({_size.unit} * 1)"
159
159
  },
160
160
  "2": {
161
161
  $type: "dimension",
162
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *2)"
162
+ $value: "floor({_size.unit} * 2)"
163
163
  },
164
164
  "3": {
165
165
  $type: "dimension",
166
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *3)"
166
+ $value: "floor({_size.unit} * 3)"
167
167
  },
168
168
  "4": {
169
169
  $type: "dimension",
170
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *4)"
170
+ $value: "floor({_size.unit} * 4)"
171
171
  },
172
172
  "5": {
173
173
  $type: "dimension",
174
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *5)"
174
+ $value: "floor({_size.unit} * 5)"
175
175
  },
176
176
  "6": {
177
177
  $type: "dimension",
178
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *6)"
178
+ $value: "floor({_size.unit} * 6)"
179
179
  },
180
180
  "7": {
181
181
  $type: "dimension",
182
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *7)"
182
+ $value: "floor({_size.unit} * 7)"
183
183
  },
184
184
  "8": {
185
185
  $type: "dimension",
186
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *8)"
186
+ $value: "floor({_size.unit} * 8)"
187
187
  },
188
188
  "9": {
189
189
  $type: "dimension",
190
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *9)"
190
+ $value: "floor({_size.unit} * 9)"
191
191
  },
192
192
  "10": {
193
193
  $type: "dimension",
194
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *10)"
194
+ $value: "floor({_size.unit} * 10)"
195
195
  },
196
196
  "11": {
197
197
  $type: "dimension",
198
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *11)"
198
+ $value: "floor({_size.unit} * 11)"
199
199
  },
200
200
  "12": {
201
201
  $type: "dimension",
202
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *12)"
202
+ $value: "floor({_size.unit} * 12)"
203
203
  },
204
204
  "13": {
205
205
  $type: "dimension",
206
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *13)"
206
+ $value: "floor({_size.unit} * 13)"
207
207
  },
208
208
  "14": {
209
209
  $type: "dimension",
210
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *14)"
210
+ $value: "floor({_size.unit} * 14)"
211
211
  },
212
212
  "15": {
213
213
  $type: "dimension",
214
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *15)"
214
+ $value: "floor({_size.unit} * 15)"
215
215
  },
216
216
  "18": {
217
217
  $type: "dimension",
218
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *18)"
218
+ $value: "floor({_size.unit} * 18)"
219
219
  },
220
220
  "22": {
221
221
  $type: "dimension",
222
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *22)"
222
+ $value: "floor({_size.unit} * 22)"
223
223
  },
224
224
  "26": {
225
225
  $type: "dimension",
226
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *26)"
226
+ $value: "floor({_size.unit} * 26)"
227
227
  },
228
228
  "30": {
229
229
  $type: "dimension",
230
- $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *30)"
230
+ $value: "floor({_size.unit} * 30)"
231
231
  },
232
232
  "mode-font-size": {
233
- $type: "dimension",
233
+ $type: "number",
234
234
  $value: "{size._mode-font-size}"
235
235
  },
236
236
  base: {
237
- $type: "dimension",
237
+ $type: "number",
238
238
  $value: "{size._base}"
239
239
  },
240
240
  step: {
241
- $type: "dimension",
241
+ $type: "number",
242
242
  $value: "{size._step}"
243
+ },
244
+ unit: {
245
+ $type: "number",
246
+ $value: "{_size.step} / {_size.base} * {_size.mode-font-size}"
243
247
  }
244
248
  }
245
249
  };
@@ -2089,7 +2093,7 @@ var createTokens = async (opts) => {
2089
2093
  };
2090
2094
 
2091
2095
  // src/tokens/format.ts
2092
- import * as R18 from "ramda";
2096
+ import * as R23 from "ramda";
2093
2097
 
2094
2098
  // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js
2095
2099
  var BoxShadowTypes;
@@ -2424,12 +2428,12 @@ function generateTypographyGroup(themes) {
2424
2428
 
2425
2429
  // src/tokens/process/output/theme.ts
2426
2430
  import pc from "picocolors";
2427
- import * as R7 from "ramda";
2431
+ import * as R8 from "ramda";
2428
2432
 
2429
2433
  // package.json
2430
2434
  var package_default = {
2431
2435
  name: "@digdir/designsystemet",
2432
- version: "1.4.0",
2436
+ version: "1.5.1",
2433
2437
  description: "CLI for Designsystemet",
2434
2438
  author: "Designsystemet team",
2435
2439
  engines: {
@@ -2512,9 +2516,9 @@ var package_default = {
2512
2516
  "@types/apca-w3": "^0.1.3",
2513
2517
  "@types/chroma-js": "^3.1.1",
2514
2518
  "@types/fs-extra": "^11.0.4",
2515
- "@types/node": "^22.18.0",
2519
+ "@types/node": "^22.18.1",
2516
2520
  "@types/object-hash": "^3.0.6",
2517
- "@types/ramda": "^0.31.0",
2521
+ "@types/ramda": "^0.31.1",
2518
2522
  "fs-extra": "^11.3.1",
2519
2523
  tslib: "^2.8.1",
2520
2524
  tsup: "^8.5.0",
@@ -2523,8 +2527,109 @@ var package_default = {
2523
2527
  }
2524
2528
  };
2525
2529
 
2530
+ // src/tokens/utils.ts
2531
+ import * as R7 from "ramda";
2532
+
2533
+ // src/tokens/types.ts
2534
+ var colorCategories = {
2535
+ main: "main",
2536
+ support: "support"
2537
+ };
2538
+
2539
+ // src/tokens/utils.ts
2540
+ var mapToLowerCase = R7.map(R7.toLower);
2541
+ var hasAnyTruth = R7.any(R7.equals(true));
2542
+ var getType = (token) => (token.$type ?? token.type) || "";
2543
+ var getValue = (token) => token.$value ?? token.value;
2544
+ var typeEquals = R7.curry(
2545
+ (types, token) => {
2546
+ if (R7.isNil(token)) {
2547
+ return false;
2548
+ }
2549
+ return R7.includes(R7.toLower(getType(token)), R7.map(R7.toLower, Array.isArray(types) ? types : [types]));
2550
+ }
2551
+ );
2552
+ var pathStartsWithOneOf = R7.curry(
2553
+ (paths, token) => {
2554
+ if (R7.isNil(token)) {
2555
+ return false;
2556
+ }
2557
+ const tokenPath = mapToLowerCase(token.path);
2558
+ const matchPathsStartingWith = R7.map((pathOrString) => {
2559
+ const path = typeof pathOrString === "string" ? [pathOrString] : pathOrString;
2560
+ return R7.startsWith(mapToLowerCase(path), tokenPath);
2561
+ }, paths);
2562
+ return hasAnyTruth(matchPathsStartingWith);
2563
+ }
2564
+ );
2565
+ function isSemanticToken(token) {
2566
+ return token.filePath.includes("semantic/");
2567
+ }
2568
+ function isSemanticColorToken(token, color) {
2569
+ return token.filePath.includes("semantic/") && R7.startsWith(["color", color], token.path);
2570
+ }
2571
+ function isGlobalColorToken(token) {
2572
+ return typeEquals("color", token) && pathStartsWithOneOf(["global"], token);
2573
+ }
2574
+ function isColorCategoryToken(token, category) {
2575
+ if (!category) {
2576
+ return Object.keys(colorCategories).some(
2577
+ (colorCategory2) => isColorCategoryToken(token, colorCategory2)
2578
+ );
2579
+ }
2580
+ return R7.startsWith(["color", category], token.path);
2581
+ }
2582
+ var isDigit = (s) => /^\d+$/.test(s);
2583
+ function traverseObj(obj, fn) {
2584
+ for (const key in obj) {
2585
+ const prop4 = obj[key];
2586
+ if (prop4 != null) {
2587
+ fn.apply(null, [obj, key, prop4]);
2588
+ if (typeof prop4 === "object") {
2589
+ traverseObj(prop4, fn);
2590
+ }
2591
+ }
2592
+ }
2593
+ return obj;
2594
+ }
2595
+ function inlineTokens(shouldInline, tokens) {
2596
+ const [inlineableTokens, otherTokens] = R7.partition(shouldInline, tokens);
2597
+ return otherTokens.map((token) => {
2598
+ let transformed = getValue(token.original);
2599
+ for (const ref of inlineableTokens) {
2600
+ const refName = ref.path.join(".");
2601
+ if (typeof transformed === "string") {
2602
+ transformed = transformed.replaceAll(`{${refName}}`, getValue(ref.original));
2603
+ }
2604
+ }
2605
+ const tokenWithInlinedRefs = R7.set(R7.lensPath(["original", "$value"]), transformed, token);
2606
+ return tokenWithInlinedRefs;
2607
+ });
2608
+ }
2609
+ var sizeMap = {
2610
+ xsmall: "xs",
2611
+ small: "sm",
2612
+ medium: "md",
2613
+ large: "lg",
2614
+ xlarge: "xl"
2615
+ };
2616
+ function shortSizeName(size2) {
2617
+ return sizeMap[size2] ?? size2;
2618
+ }
2619
+ var sizeComparator = (size2) => {
2620
+ const sortIndex = Object.entries(sizeMap).findIndex(([key, val]) => key === size2 || val === size2);
2621
+ return sortIndex ?? 0;
2622
+ };
2623
+ function orderBySize(sizes) {
2624
+ return R7.sortBy(sizeComparator, sizes);
2625
+ }
2626
+
2526
2627
  // src/tokens/process/output/theme.ts
2527
2628
  var defaultFileHeader = `build: v${package_default.version}`;
2629
+ var getFileNameWithoutExtension = (path) => {
2630
+ const pathSegments = path.split("/");
2631
+ return pathSegments[pathSegments.length - 1].split(".").slice(0, -1).join(".");
2632
+ };
2528
2633
  var createThemeCSSFiles = ({
2529
2634
  processedBuilds,
2530
2635
  fileHeader = defaultFileHeader
@@ -2534,22 +2639,25 @@ var createThemeCSSFiles = ({
2534
2639
  for (const buildResult of buildResults) {
2535
2640
  const themeName = buildResult.permutation.theme;
2536
2641
  const newOutputs = buildResult.formatted;
2537
- if (R7.isNotEmpty(newOutputs)) {
2642
+ if (R8.isNotEmpty(newOutputs)) {
2538
2643
  const currentOutputs = groupedByTheme[themeName] ?? [];
2539
- groupedByTheme[themeName] = R7.concat(currentOutputs, newOutputs);
2644
+ groupedByTheme[themeName] = R8.concat(currentOutputs, newOutputs);
2540
2645
  }
2541
2646
  }
2542
2647
  }
2543
2648
  const sortOrder = [
2649
+ "size-mode/",
2650
+ "type-scale",
2544
2651
  "color-scheme/light",
2545
2652
  "typography/secondary",
2653
+ "size",
2546
2654
  "semantic",
2547
2655
  "color-scheme/dark",
2548
2656
  "color-scheme/contrast",
2549
2657
  "typography/primary",
2550
2658
  "color/"
2551
2659
  ];
2552
- const sortByDefinedOrder = R7.sortBy((file) => {
2660
+ const sortByDefinedOrder = R8.sortBy((file) => {
2553
2661
  const filePath = file.destination || "";
2554
2662
  const sortIndex = sortOrder.findIndex((sortElement) => {
2555
2663
  if (sortElement.endsWith("/")) {
@@ -2578,13 +2686,17 @@ ${fileHeader}
2578
2686
  */
2579
2687
 
2580
2688
  `;
2581
- const sortAlphabetically = R7.sort(R7.ascend((x) => x.destination || ""));
2582
- const pickOutputs = R7.map(R7.view(R7.lensProp("output")));
2583
- const themeCSSFile = R7.pipe(
2689
+ const sortAlphabetically = R8.sort(R8.ascend((x) => x.destination || ""));
2690
+ const sortBySize = R8.sortBy(
2691
+ R8.pipe((s) => getFileNameWithoutExtension(s.destination ?? ""), sizeComparator)
2692
+ );
2693
+ const pickOutputs = R8.map(R8.view(R8.lensProp("output")));
2694
+ const themeCSSFile = R8.pipe(
2584
2695
  sortAlphabetically,
2696
+ sortBySize,
2585
2697
  sortByDefinedOrder,
2586
2698
  pickOutputs,
2587
- R7.join("\n"),
2699
+ R8.join("\n"),
2588
2700
  (content) => header + content
2589
2701
  );
2590
2702
  const themeCSSFiles = Object.entries(groupedByTheme).map(([theme, files]) => ({
@@ -2596,91 +2708,16 @@ ${fileHeader}
2596
2708
 
2597
2709
  // src/tokens/process/platform.ts
2598
2710
  import pc3 from "picocolors";
2599
- import * as R17 from "ramda";
2711
+ import * as R22 from "ramda";
2600
2712
  import StyleDictionary2 from "style-dictionary";
2601
2713
 
2602
- // src/tokens/types.ts
2603
- var colorCategories = {
2604
- main: "main",
2605
- support: "support"
2606
- };
2607
-
2608
2714
  // src/tokens/process/configs.ts
2609
2715
  import { register } from "@tokens-studio/sd-transforms";
2610
- import * as R16 from "ramda";
2716
+ import * as R21 from "ramda";
2611
2717
  import StyleDictionary from "style-dictionary";
2612
2718
 
2613
- // src/tokens/utils.ts
2614
- import * as R8 from "ramda";
2615
- var mapToLowerCase = R8.map(R8.toLower);
2616
- var hasAnyTruth = R8.any(R8.equals(true));
2617
- var getType = (token) => (token.$type ?? token.type) || "";
2618
- var getValue = (token) => token.$value ?? token.value;
2619
- var typeEquals = R8.curry(
2620
- (types, token) => {
2621
- if (R8.isNil(token)) {
2622
- return false;
2623
- }
2624
- return R8.includes(R8.toLower(getType(token)), R8.map(R8.toLower, Array.isArray(types) ? types : [types]));
2625
- }
2626
- );
2627
- var pathStartsWithOneOf = R8.curry(
2628
- (paths, token) => {
2629
- if (R8.isNil(token)) {
2630
- return false;
2631
- }
2632
- const tokenPath = mapToLowerCase(token.path);
2633
- const matchPathsStartingWith = R8.map((path) => R8.startsWith([path], tokenPath), mapToLowerCase(paths));
2634
- return hasAnyTruth(matchPathsStartingWith);
2635
- }
2636
- );
2637
- function isSemanticToken(token) {
2638
- return token.filePath.includes("semantic/");
2639
- }
2640
- function isSemanticColorToken(token, color) {
2641
- return token.filePath.includes("semantic/") && R8.startsWith(["color", color], token.path);
2642
- }
2643
- function isGlobalColorToken(token) {
2644
- return typeEquals("color", token) && pathStartsWithOneOf(["global"], token);
2645
- }
2646
- function isColorCategoryToken(token, category) {
2647
- if (!category) {
2648
- return Object.keys(colorCategories).some(
2649
- (colorCategory2) => isColorCategoryToken(token, colorCategory2)
2650
- );
2651
- }
2652
- return R8.startsWith(["color", category], token.path);
2653
- }
2654
- var isDigit = (s) => /^\d+$/.test(s);
2655
- function traverseObj(obj, fn) {
2656
- for (const key in obj) {
2657
- const prop = obj[key];
2658
- if (prop != null) {
2659
- fn.apply(null, [obj, key, prop]);
2660
- if (typeof prop === "object") {
2661
- traverseObj(prop, fn);
2662
- }
2663
- }
2664
- }
2665
- return obj;
2666
- }
2667
- function inlineTokens(shouldInline, tokens) {
2668
- const [inlineableTokens, otherTokens] = R8.partition(shouldInline, tokens);
2669
- return otherTokens.map((token) => {
2670
- let transformed = getValue(token.original);
2671
- for (const ref of inlineableTokens) {
2672
- const refName = ref.path.join(".");
2673
- if (typeof transformed === "string") {
2674
- transformed = transformed.replaceAll(`{${refName}}`, getValue(ref.original));
2675
- }
2676
- }
2677
- const tokenWithInlinedRefs = R8.set(R8.lensPath(["original", "$value"]), transformed, token);
2678
- return tokenWithInlinedRefs;
2679
- });
2680
- }
2681
-
2682
2719
  // src/tokens/process/configs/color.ts
2683
- import * as R13 from "ramda";
2720
+ import * as R16 from "ramda";
2684
2721
 
2685
2722
  // src/tokens/process/formats/css/color.ts
2686
2723
  import * as R9 from "ramda";
@@ -2738,10 +2775,10 @@ ${selector} ${content} ${autoSelectorContent}
2738
2775
  };
2739
2776
  var colorCategory = {
2740
2777
  name: "ds/css-colorcategory",
2741
- format: async ({ dictionary, options, platform }) => {
2778
+ format: async ({ dictionary, file, options, platform }) => {
2742
2779
  const { outputReferences, usesDtcg } = options;
2743
- const { selector, layer, files } = platform;
2744
- const destination = files?.[0]?.destination;
2780
+ const { selector, layer } = platform;
2781
+ const destination = file.destination;
2745
2782
  const format = R9.compose(
2746
2783
  createPropertyFormatter({
2747
2784
  outputReferences,
@@ -2778,6 +2815,10 @@ ${selector} ${content}
2778
2815
  };
2779
2816
 
2780
2817
  // src/tokens/process/formats/css/semantic.ts
2818
+ import * as R11 from "ramda";
2819
+ import { createPropertyFormatter as createPropertyFormatter3 } from "style-dictionary/utils";
2820
+
2821
+ // src/tokens/process/formats/css/size.ts
2781
2822
  import * as R10 from "ramda";
2782
2823
  import { createPropertyFormatter as createPropertyFormatter2 } from "style-dictionary/utils";
2783
2824
  var isNumericBorderRadiusToken = (t) => t.path[0] === "border-radius" && isDigit(t.path[1]);
@@ -2785,12 +2826,20 @@ var isNumericSizeToken = (t) => pathStartsWithOneOf(["size"], t) && isDigit(t.pa
2785
2826
  var isSizeToken = (t) => pathStartsWithOneOf(["size"], t);
2786
2827
  var isInlineTokens = R10.anyPass([isNumericBorderRadiusToken, isNumericSizeToken, isSizeToken]);
2787
2828
  var overrideSizingFormula = (format, token) => {
2788
- const [name, value] = format(token).split(":");
2789
- const calc = value.replace(`var(--ds-size-mode-font-size)`, "1em").replace(/floor\((.*)\);/, "calc($1)");
2790
- const round = `round(down, ${calc}, 1px)`;
2829
+ const [name, value] = format(token).replace(/;$/, "").split(": ");
2830
+ let calc;
2831
+ let round;
2832
+ if (token.path[1] === "unit") {
2833
+ calc = `calc(1rem * ${value})`;
2834
+ } else if (value.startsWith("floor")) {
2835
+ calc = value.replace(/^floor\((.*)\)$/, "calc($1)");
2836
+ round = `round(down, ${calc}, 1px)`;
2837
+ } else {
2838
+ calc = value.includes("*") ? `calc(${value})` : value;
2839
+ }
2791
2840
  return {
2792
2841
  name,
2793
- round,
2842
+ round: round ?? calc,
2794
2843
  calc
2795
2844
  };
2796
2845
  };
@@ -2806,18 +2855,21 @@ var formatSizingTokens = (format, tokens) => R10.reduce(
2806
2855
  { tokens: [], round: [], calc: [] },
2807
2856
  tokens
2808
2857
  );
2809
- var sizingTemplate = ({ round, calc }) => `
2858
+ var sizingTemplate = ({ round, calc }) => {
2859
+ const usesRounding = round.filter((val, i) => val !== calc[i]);
2860
+ return `
2810
2861
  ${calc.join("\n")}
2811
2862
 
2812
2863
  @supports (width: round(down, .1em, 1px)) {
2813
- ${round.join("\n")}
2864
+ ${usesRounding.join("\n ")}
2814
2865
  }`;
2815
- var semantic = {
2816
- name: "ds/css-semantic",
2817
- format: async ({ dictionary, options, platform }) => {
2866
+ };
2867
+ var size = {
2868
+ name: "ds/css-size",
2869
+ format: async ({ dictionary, file, options, platform }) => {
2818
2870
  const { outputReferences, usesDtcg } = options;
2819
- const { selector, layer, files } = platform;
2820
- const destination = files?.[0]?.destination;
2871
+ const { selector, layer } = platform;
2872
+ const destination = file.destination;
2821
2873
  const format = createPropertyFormatter2({
2822
2874
  outputReferences,
2823
2875
  dictionary,
@@ -2825,9 +2877,9 @@ var semantic = {
2825
2877
  usesDtcg
2826
2878
  });
2827
2879
  const tokens = inlineTokens(isInlineTokens, dictionary.allTokens);
2828
- const filteredTokens = R10.reject((token) => token.name.includes("ds-size-mode-font-size"), tokens);
2880
+ const filteredTokens = R10.reject((token) => R10.equals(["_size", "mode-font-size"], token.path), tokens);
2829
2881
  const [sizingTokens, restTokens] = R10.partition(
2830
- (t) => pathStartsWithOneOf(["_size"], t) && isDigit(t.path[1]),
2882
+ (t) => pathStartsWithOneOf(["_size"], t) && (isDigit(t.path[1]) || t.path[1] === "unit"),
2831
2883
  filteredTokens
2832
2884
  );
2833
2885
  const formattedSizingTokens = formatSizingTokens(format, sizingTokens);
@@ -2840,64 +2892,56 @@ var semantic = {
2840
2892
  formatted: t
2841
2893
  }));
2842
2894
  buildOptions.buildTokenFormats[destination] = [...formattedMap, ...formattedSizingMap];
2843
- const sizingSnippet = sizingTemplate(formattedSizingTokens);
2844
- const formattedTokens = formattedMap.map(R10.view(R10.lensProp("formatted"))).concat(sizingSnippet);
2845
- const content = `{
2895
+ const formattedTokens = [formattedMap.map(R10.prop("formatted")).join("\n"), sizingTemplate(formattedSizingTokens)];
2896
+ const content = `${selector} {
2846
2897
  ${formattedTokens.join("\n")}
2847
2898
  }
2848
2899
  `;
2849
2900
  const body = R10.isNotNil(layer) ? `@layer ${layer} {
2850
- ${selector} ${content}
2901
+ ${content}
2851
2902
  }
2852
- ` : `${selector} ${content}
2903
+ ` : `${content}
2853
2904
  `;
2854
2905
  return body;
2855
2906
  }
2856
2907
  };
2857
2908
 
2858
- // src/tokens/process/formats/css/typography.ts
2859
- import * as R11 from "ramda";
2860
- import { createPropertyFormatter as createPropertyFormatter3 } from "style-dictionary/utils";
2861
- var typographyFontFamilyPredicate = R11.allPass([
2862
- R11.pathSatisfies(R11.includes("typography"), ["path"]),
2863
- R11.pathSatisfies(R11.includes("fontFamily"), ["path"])
2864
- ]);
2865
- var typography = {
2866
- name: "ds/css-typography",
2867
- format: async ({ dictionary, options, platform }) => {
2909
+ // src/tokens/process/formats/css/semantic.ts
2910
+ var semantic = {
2911
+ name: "ds/css-semantic",
2912
+ format: async ({ dictionary, file, options, platform }) => {
2868
2913
  const { outputReferences, usesDtcg } = options;
2869
- const { selector, layer, files } = platform;
2870
- const destination = files?.[0]?.destination;
2914
+ const { selector, layer } = platform;
2915
+ const destination = file.destination;
2871
2916
  const format = createPropertyFormatter3({
2872
2917
  outputReferences,
2873
2918
  dictionary,
2874
2919
  format: "css",
2875
2920
  usesDtcg
2876
2921
  });
2877
- const filteredTokens = R11.reject(typographyFontFamilyPredicate, dictionary.allTokens);
2878
- const formattedMap = filteredTokens.map((token) => ({
2922
+ const tokens = inlineTokens(isInlineTokens, dictionary.allTokens);
2923
+ const formattedMap = tokens.map((token) => ({
2879
2924
  token,
2880
2925
  formatted: format(token)
2881
2926
  }));
2882
2927
  buildOptions.buildTokenFormats[destination] = formattedMap;
2883
- const formattedTokens = formattedMap.map(R11.view(R11.lensProp("formatted"))).join("\n");
2884
- const content = selector ? `${selector} {
2928
+ const formattedTokens = formattedMap.map(R11.prop("formatted")).join("\n");
2929
+ const content = `${selector} {
2885
2930
  ${formattedTokens}
2886
- }` : formattedTokens;
2931
+ }
2932
+ `;
2887
2933
  const body = R11.isNotNil(layer) ? `@layer ${layer} {
2888
2934
  ${content}
2889
- }` : content;
2935
+ }
2936
+ ` : `${content}
2937
+ `;
2890
2938
  return body;
2891
2939
  }
2892
2940
  };
2893
2941
 
2894
- // src/tokens/process/formats/css.ts
2895
- var formats = {
2896
- colorScheme,
2897
- colorCategory,
2898
- semantic,
2899
- typography
2900
- };
2942
+ // src/tokens/process/formats/css/size-mode.ts
2943
+ import * as R13 from "ramda";
2944
+ import { createPropertyFormatter as createPropertyFormatter4 } from "style-dictionary/utils";
2901
2945
 
2902
2946
  // src/tokens/process/transformers.ts
2903
2947
  import { checkAndEvaluateMath } from "@tokens-studio/sd-transforms";
@@ -2909,18 +2953,22 @@ var sizeRem = {
2909
2953
  transitive: true,
2910
2954
  filter: (token) => {
2911
2955
  const hasWantedType = typeEquals(["dimension", "fontsize"], token);
2912
- const hasWantedPath = pathStartsWithOneOf(["spacing", "sizing", "border-radius", "font-size"], token);
2956
+ const hasWantedPath = pathStartsWithOneOf([
2957
+ "border-radius",
2958
+ "font-size"
2959
+ /*, ['_size', 'mode-font-size']*/
2960
+ ], token);
2913
2961
  return hasWantedType && hasWantedPath;
2914
2962
  },
2915
2963
  transform: (token, config) => {
2916
2964
  const value = getValue(token);
2917
2965
  if (isPx(value)) {
2918
2966
  const baseFont = config.basePxFontSize || 16;
2919
- const size = parseInt(value, 10);
2920
- if (size === 0) {
2967
+ const size2 = parseInt(value, 10);
2968
+ if (size2 === 0) {
2921
2969
  return "0";
2922
2970
  }
2923
- return `${size / baseFont}rem`;
2971
+ return `${size2 / baseFont}rem`;
2924
2972
  }
2925
2973
  return value;
2926
2974
  }
@@ -2971,6 +3019,154 @@ var dsTransformers = [
2971
3019
  "shadow/css/shorthand"
2972
3020
  ];
2973
3021
 
3022
+ // src/tokens/process/formats/css/size-mode.ts
3023
+ var formatBaseSizeToken = (size2) => (token) => ({
3024
+ ...token,
3025
+ originalName: token.name,
3026
+ name: `${token.name}--${shortSizeName(size2)}`,
3027
+ $value: token.$value / basePxFontSize
3028
+ });
3029
+ var sizeMode = {
3030
+ name: "ds/css-size-mode",
3031
+ format: async ({ dictionary, file, options, platform }) => {
3032
+ const { outputReferences, usesDtcg } = options;
3033
+ const { selector, layer, size: size2 } = platform;
3034
+ const destination = file.destination;
3035
+ const format = createPropertyFormatter4({
3036
+ outputReferences,
3037
+ dictionary,
3038
+ format: "css",
3039
+ usesDtcg
3040
+ });
3041
+ const sizeSpecificTokens = dictionary.allTokens.map(formatBaseSizeToken(size2));
3042
+ const sizeSpecificVariables = sizeSpecificTokens.map(format).join("\n");
3043
+ const formattedMap = sizeSpecificTokens.map((token) => ({
3044
+ token,
3045
+ formatted: format({
3046
+ ...token,
3047
+ // Remove the `--<size>` suffix for the token listing, since that is the only token we actually use
3048
+ name: token.originalName
3049
+ })
3050
+ }));
3051
+ buildOptions.buildTokenFormats[destination] = formattedMap;
3052
+ const content = `${selector} /* ${size2} */ {
3053
+ ${sizeSpecificVariables}
3054
+ }`;
3055
+ const body = wrapInLayer(content, layer);
3056
+ const sizes = orderBySize(buildOptions?.sizeModes ?? []).map(shortSizeName);
3057
+ const defaultSize = shortSizeName(buildOptions?.defaultSize ?? "");
3058
+ const sizingToggles = `:root, [data-size] {
3059
+ --ds-size: var(--ds-size--${defaultSize});
3060
+ ${sizes.map((size3) => ` --ds-size--${size3}: var(--ds-size,);`).join("\n")}
3061
+ --ds-size-mode-font-size:
3062
+ ${sizes.map((size3) => ` var(--ds-size--${size3}, var(--ds-size-mode-font-size--${size3}))`).join("\n")};
3063
+ }`;
3064
+ const sizingHelpers = sizes.map((size3) => `[data-size='${size3}'] { --ds-size: var(--ds-size--${size3}); }`).join("\n");
3065
+ const sharedContent = `${sizingToggles}
3066
+
3067
+ ${sizingHelpers}`;
3068
+ const sharedBody = shortSizeName(size2) === R13.last(sizes) ? `
3069
+ ${wrapInLayer(sharedContent, layer)}` : "";
3070
+ return body + sharedBody;
3071
+ }
3072
+ };
3073
+ function wrapInLayer(content, layer) {
3074
+ return R13.isNotNil(layer) ? `@layer ${layer} {
3075
+ ${content}
3076
+ }
3077
+ ` : `${content}
3078
+ `;
3079
+ }
3080
+
3081
+ // src/tokens/process/formats/css/typography.ts
3082
+ import * as R14 from "ramda";
3083
+ import { createPropertyFormatter as createPropertyFormatter5 } from "style-dictionary/utils";
3084
+ var typographyFontFamilyPredicate = R14.allPass([
3085
+ R14.pathSatisfies(R14.includes("typography"), ["path"]),
3086
+ R14.pathSatisfies(R14.includes("fontFamily"), ["path"])
3087
+ ]);
3088
+ var typography = {
3089
+ name: "ds/css-typography",
3090
+ format: async ({ dictionary, file, options, platform }) => {
3091
+ const { outputReferences, usesDtcg } = options;
3092
+ const { selector, layer } = platform;
3093
+ const destination = file.destination;
3094
+ const format = createPropertyFormatter5({
3095
+ outputReferences,
3096
+ dictionary,
3097
+ format: "css",
3098
+ usesDtcg
3099
+ });
3100
+ const filteredTokens = R14.reject(typographyFontFamilyPredicate, dictionary.allTokens);
3101
+ const formattedMap = filteredTokens.map((token) => ({
3102
+ token,
3103
+ formatted: format(token)
3104
+ }));
3105
+ buildOptions.buildTokenFormats[destination] = formattedMap;
3106
+ const formattedTokens = formattedMap.map(R14.view(R14.lensProp("formatted"))).join("\n");
3107
+ const content = selector ? `${selector} {
3108
+ ${formattedTokens}
3109
+ }` : formattedTokens;
3110
+ const body = R14.isNotNil(layer) ? `@layer ${layer} {
3111
+ ${content}
3112
+ }` : content;
3113
+ return body;
3114
+ }
3115
+ };
3116
+
3117
+ // src/tokens/process/formats/css/type-scale.ts
3118
+ import * as R15 from "ramda";
3119
+ import { createPropertyFormatter as createPropertyFormatter6 } from "style-dictionary/utils";
3120
+ var typographyFontFamilyPredicate2 = R15.allPass([
3121
+ R15.pathSatisfies(R15.includes("typography"), ["path"]),
3122
+ R15.pathSatisfies(R15.includes("fontFamily"), ["path"])
3123
+ ]);
3124
+ function formatTypographySizeToken(token) {
3125
+ return { ...token, $value: `calc(${token.$value} * var(--_ds-font-size-factor))` };
3126
+ }
3127
+ var typeScale = {
3128
+ name: "ds/css-type-scale",
3129
+ format: async ({ dictionary, file, options, platform }) => {
3130
+ const { outputReferences, usesDtcg } = options;
3131
+ const { selector, layer } = platform;
3132
+ const destination = file.destination;
3133
+ const format = createPropertyFormatter6({
3134
+ outputReferences,
3135
+ dictionary,
3136
+ format: "css",
3137
+ usesDtcg
3138
+ });
3139
+ const filteredTokens = R15.reject(typographyFontFamilyPredicate2, dictionary.allTokens);
3140
+ const tokens = R15.map(formatTypographySizeToken, filteredTokens);
3141
+ const formattedMap = tokens.map((token) => ({
3142
+ token,
3143
+ formatted: format(token)
3144
+ }));
3145
+ buildOptions.buildTokenFormats[destination] = formattedMap;
3146
+ const formattedTokens = formattedMap.map(R15.prop("formatted")).join("\n");
3147
+ const sizeFactor = ` --_ds-font-size-factor: calc(var(--ds-size-mode-font-size) / (var(--ds-size-base) / ${basePxFontSize}));`;
3148
+ const content = `${selector} {
3149
+ ${sizeFactor}
3150
+ ${formattedTokens}
3151
+ }`;
3152
+ const body = R15.isNotNil(layer) ? `@layer ${layer} {
3153
+ ${content}
3154
+ }` : content;
3155
+ return body;
3156
+ }
3157
+ };
3158
+
3159
+ // src/tokens/process/formats/css.ts
3160
+ var formats = {
3161
+ colorScheme,
3162
+ colorCategory,
3163
+ semantic,
3164
+ sizeMode,
3165
+ size,
3166
+ typography,
3167
+ typeScale
3168
+ };
3169
+
2974
3170
  // src/tokens/process/configs/color.ts
2975
3171
  var colorSchemeVariables = ({ "color-scheme": colorScheme2 = "light", theme }) => {
2976
3172
  const selector = `${colorScheme2 === "light" ? ":root, " : ""}[data-color-scheme="${colorScheme2}"]`;
@@ -2992,7 +3188,7 @@ var colorSchemeVariables = ({ "color-scheme": colorScheme2 = "light", theme }) =
2992
3188
  {
2993
3189
  destination: `color-scheme/${colorScheme2}.css`,
2994
3190
  format: formats.colorScheme.name,
2995
- filter: (token) => typeEquals("color", token) && !R13.startsWith(["global"], token.path)
3191
+ filter: (token) => typeEquals("color", token) && !R16.startsWith(["global"], token.path)
2996
3192
  }
2997
3193
  ],
2998
3194
  options: {
@@ -3043,7 +3239,7 @@ var colorCategoryVariables = (opts) => ({ "color-scheme": colorScheme2, theme, .
3043
3239
  };
3044
3240
 
3045
3241
  // src/tokens/process/configs/semantic.ts
3046
- import * as R14 from "ramda";
3242
+ import * as R17 from "ramda";
3047
3243
  import { outputReferencesFilter } from "style-dictionary/utils";
3048
3244
  var semanticVariables = ({ theme }) => {
3049
3245
  const selector = `:root`;
@@ -3066,9 +3262,12 @@ var semanticVariables = ({ theme }) => {
3066
3262
  destination: `semantic.css`,
3067
3263
  format: formats.semantic.name,
3068
3264
  filter: (token) => {
3069
- const isUwantedToken = R14.anyPass([R14.includes("primitives/global")])(token.filePath);
3070
- const isPrivateToken = R14.includes("_", token.path);
3071
- const unwantedPaths = pathStartsWithOneOf(["font-size", "line-height", "letter-spacing"], token);
3265
+ const isUwantedToken = R17.anyPass([R17.includes("primitives/global")])(token.filePath);
3266
+ const isPrivateToken = R17.includes("_", token.path);
3267
+ const unwantedPaths = pathStartsWithOneOf(
3268
+ ["size", "_size", "font-size", "line-height", "letter-spacing"],
3269
+ token
3270
+ );
3072
3271
  const unwantedTypes = typeEquals(["color", "fontWeight", "fontFamily", "typography"], token);
3073
3272
  const unwantedTokens = !(unwantedPaths || unwantedTypes || isPrivateToken || isUwantedToken);
3074
3273
  return unwantedTokens;
@@ -3078,8 +3277,48 @@ var semanticVariables = ({ theme }) => {
3078
3277
  options: {
3079
3278
  outputReferences: (token, options) => {
3080
3279
  const include = pathStartsWithOneOf(["border-radius"], token);
3081
- const isWantedSize = pathStartsWithOneOf(["size", "_size"], token) && isDigit(token.path[1]);
3082
- return (include || isWantedSize) && outputReferencesFilter(token, options);
3280
+ return include && outputReferencesFilter(token, options);
3281
+ }
3282
+ }
3283
+ }
3284
+ }
3285
+ };
3286
+ };
3287
+
3288
+ // src/tokens/process/configs/size.ts
3289
+ import * as R18 from "ramda";
3290
+ import { outputReferencesFilter as outputReferencesFilter2 } from "style-dictionary/utils";
3291
+ var sizeVariables = ({ theme }) => {
3292
+ const selector = `:root, [data-size]`;
3293
+ const layer = `ds.theme.size`;
3294
+ return {
3295
+ preprocessors: ["tokens-studio"],
3296
+ platforms: {
3297
+ css: {
3298
+ // custom
3299
+ theme,
3300
+ basePxFontSize,
3301
+ selector,
3302
+ layer,
3303
+ //
3304
+ prefix,
3305
+ buildPath: `${theme}/`,
3306
+ transforms: dsTransformers,
3307
+ files: [
3308
+ {
3309
+ destination: `size.css`,
3310
+ format: formats.size.name,
3311
+ filter: (token) => {
3312
+ const isUwantedToken = R18.anyPass([R18.includes("primitives/global")])(token.filePath);
3313
+ const isPrivateToken = R18.includes("_", token.path);
3314
+ return pathStartsWithOneOf(["size", "_size"], token) && !(isUwantedToken || isPrivateToken);
3315
+ }
3316
+ }
3317
+ ],
3318
+ options: {
3319
+ outputReferences: (token, options) => {
3320
+ const isWantedSize = pathStartsWithOneOf(["size", "_size"], token) && (isDigit(token.path[1]) || token.path[1] === "unit");
3321
+ return isWantedSize && outputReferencesFilter2(token, options);
3083
3322
  }
3084
3323
  }
3085
3324
  }
@@ -3087,6 +3326,83 @@ var semanticVariables = ({ theme }) => {
3087
3326
  };
3088
3327
  };
3089
3328
 
3329
+ // src/tokens/process/configs/size-mode.ts
3330
+ import * as R19 from "ramda";
3331
+ var sizeModeVariables = ({ theme, size: size2 }) => {
3332
+ const selector = `:root`;
3333
+ const layer = `ds.theme.size-mode`;
3334
+ return {
3335
+ preprocessors: ["tokens-studio"],
3336
+ platforms: {
3337
+ css: {
3338
+ // custom
3339
+ size: size2,
3340
+ theme,
3341
+ basePxFontSize,
3342
+ selector,
3343
+ layer,
3344
+ //
3345
+ prefix,
3346
+ buildPath: `${theme}/`,
3347
+ transforms: dsTransformers,
3348
+ files: [
3349
+ {
3350
+ destination: `size-mode/${size2}.css`,
3351
+ format: formats.sizeMode.name,
3352
+ filter: (token) => {
3353
+ return R19.equals(["_size", "mode-font-size"], token.path);
3354
+ }
3355
+ }
3356
+ ]
3357
+ }
3358
+ }
3359
+ };
3360
+ };
3361
+
3362
+ // src/tokens/process/configs/type-scale.ts
3363
+ var typeScaleVariables = ({ theme }) => {
3364
+ const selector = ":root, [data-size]";
3365
+ const layer = `ds.theme.type-scale`;
3366
+ return {
3367
+ usesDtcg: true,
3368
+ preprocessors: ["tokens-studio"],
3369
+ expand: {
3370
+ include: ["typography"]
3371
+ },
3372
+ platforms: {
3373
+ css: {
3374
+ prefix,
3375
+ selector,
3376
+ layer,
3377
+ buildPath: `${theme}/`,
3378
+ basePxFontSize,
3379
+ transforms: [
3380
+ "name/kebab",
3381
+ "ts/size/px",
3382
+ sizeRem.name,
3383
+ "ts/size/lineheight",
3384
+ "ts/typography/fontWeight",
3385
+ typographyName.name
3386
+ ],
3387
+ files: [
3388
+ {
3389
+ destination: `type-scale.css`,
3390
+ format: formats.typeScale.name,
3391
+ filter: (token) => {
3392
+ const included = typeEquals(["typography", "dimension", "fontsize"], token);
3393
+ if (/primitives\/modes\/typography\/(primary|secondary)/.test(token.filePath)) return false;
3394
+ return included && !pathStartsWithOneOf(["spacing", "sizing", "size", "border-width", "border-radius"], token) && (pathStartsWithOneOf(["font-size"], token) || token.path.includes("fontSize"));
3395
+ }
3396
+ }
3397
+ ],
3398
+ options: {
3399
+ outputReferences: (token) => pathStartsWithOneOf(["typography"], token) && token.path.includes("fontSize")
3400
+ }
3401
+ }
3402
+ }
3403
+ };
3404
+ };
3405
+
3090
3406
  // src/tokens/process/configs/typography.ts
3091
3407
  import { expandTypesMap } from "@tokens-studio/sd-transforms";
3092
3408
  var typographyVariables = ({ theme, typography: typography2 }) => {
@@ -3121,12 +3437,9 @@ var typographyVariables = ({ theme, typography: typography2 }) => {
3121
3437
  destination: `typography/${typography2}.css`,
3122
3438
  format: formats.typography.name,
3123
3439
  filter: (token) => {
3124
- const included = typeEquals(
3125
- ["typography", "fontweight", "fontFamily", "lineHeight", "dimension", "font", "fontsize"],
3126
- token
3127
- );
3440
+ const included = typeEquals(["fontweight", "fontFamily", "lineHeight", "dimension"], token);
3128
3441
  if (/primitives\/modes\/typography\/(primary|secondary)/.test(token.filePath)) return false;
3129
- return included && !pathStartsWithOneOf(["spacing", "sizing", "size", "_size", "border-width", "border-radius"], token);
3442
+ return included && !pathStartsWithOneOf(["spacing", "sizing", "size", "_size", "border-width", "border-radius"], token) && !(pathStartsWithOneOf(["typography"], token) && token.path.includes("fontSize"));
3130
3443
  }
3131
3444
  }
3132
3445
  ]
@@ -3138,13 +3451,13 @@ var typographyVariables = ({ theme, typography: typography2 }) => {
3138
3451
  // src/tokens/process/utils/getMultidimensionalThemes.ts
3139
3452
  import { kebabCase } from "change-case";
3140
3453
  import pc2 from "picocolors";
3141
- import * as R15 from "ramda";
3454
+ import * as R20 from "ramda";
3142
3455
  var getMultidimensionalThemes = (processed$themes, dimensions) => {
3143
3456
  const verboseLogging = buildOptions?.verbose;
3144
3457
  const grouped$themes = groupThemes(processed$themes);
3145
3458
  const permutations = permutateThemes(grouped$themes);
3146
3459
  const ALL_DEPENDENT_ON = ["theme"];
3147
- const keys2 = R15.keys(grouped$themes);
3460
+ const keys2 = R20.keys(grouped$themes);
3148
3461
  const nonDependentKeys = keys2.filter((x) => ![...ALL_DEPENDENT_ON, ...dimensions].includes(x));
3149
3462
  if (verboseLogging) {
3150
3463
  console.log(pc2.cyan(`\u{1F50E} Finding theme permutations for ${dimensions}`));
@@ -3184,7 +3497,7 @@ function groupThemes(themes) {
3184
3497
  }
3185
3498
  return groups;
3186
3499
  }
3187
- var hasUnknownProps = R15.pipe(R15.values, R15.none(R15.equals("unknown")), R15.not);
3500
+ var hasUnknownProps = R20.pipe(R20.values, R20.none(R20.equals("unknown")), R20.not);
3188
3501
  function permutateThemes(groups) {
3189
3502
  const separator = "_";
3190
3503
  const permutations = cartesian(Object.values(groups));
@@ -3194,8 +3507,8 @@ function permutateThemes(groups) {
3194
3507
  const { group, name, selectedTokenSets } = theme;
3195
3508
  let updatedPermutation = acc.permutation;
3196
3509
  if (group) {
3197
- const groupProp = R15.lensProp(group);
3198
- updatedPermutation = R15.set(groupProp, name, updatedPermutation);
3510
+ const groupProp = R20.lensProp(group);
3511
+ updatedPermutation = R20.set(groupProp, name, updatedPermutation);
3199
3512
  }
3200
3513
  const updatedName = `${String(acc.name)}${acc ? separator : ""}${name}`;
3201
3514
  const sets = [...acc.selectedTokenSets, ...filterTokenSets(selectedTokenSets)];
@@ -3266,7 +3579,10 @@ var configs = {
3266
3579
  dangerColorVariables: colorCategoryVariables({ category: "builtin", color: "danger" }),
3267
3580
  warningColorVariables: colorCategoryVariables({ category: "builtin", color: "warning" }),
3268
3581
  infoColorVariables: colorCategoryVariables({ category: "builtin", color: "info" }),
3582
+ sizeModeVariables,
3583
+ sizeVariables,
3269
3584
  typographyVariables,
3585
+ typeScaleVariables,
3270
3586
  semanticVariables
3271
3587
  };
3272
3588
  var getConfigsForThemeDimensions = (getConfig, processed$themes, dimensions, options) => {
@@ -3283,7 +3599,7 @@ var getConfigsForThemeDimensions = (getConfig, processed$themes, dimensions, opt
3283
3599
  obj.filePath = tokenSet;
3284
3600
  }
3285
3601
  });
3286
- tokenSource.tokens = R16.mergeDeepRight(tokenSource.tokens, tokensWithFilePath);
3602
+ tokenSource.tokens = R21.mergeDeepRight(tokenSource.tokens, tokensWithFilePath);
3287
3603
  }
3288
3604
  }
3289
3605
  } else {
@@ -3334,6 +3650,9 @@ var buildOptions = {
3334
3650
  var sd = new StyleDictionary2();
3335
3651
  var buildConfigs = {
3336
3652
  typography: { getConfig: configs.typographyVariables, dimensions: ["typography"] },
3653
+ sizeMode: { getConfig: configs.sizeModeVariables, dimensions: ["size"] },
3654
+ size: { getConfig: configs.sizeVariables, dimensions: ["semantic"] },
3655
+ typeScale: { getConfig: configs.typeScaleVariables, dimensions: ["semantic"] },
3337
3656
  "color-scheme": { getConfig: configs.colorSchemeVariables, dimensions: ["color-scheme"] },
3338
3657
  "main-color": { getConfig: configs.mainColorVariables, dimensions: ["main-color"] },
3339
3658
  "support-color": { getConfig: configs.supportColorVariables, dimensions: ["support-color"] },
@@ -3369,9 +3688,6 @@ async function processPlatform(options) {
3369
3688
  const platform = "css";
3370
3689
  const tokenSets = type === "format" ? options.tokenSets : void 0;
3371
3690
  const tokensDir = type === "build" ? options.tokensDir : void 0;
3372
- const filteredProcessed$themes = processed$themes.filter(
3373
- (theme) => R17.not(theme.group === "size" && theme.name !== "medium")
3374
- );
3375
3691
  const UNSAFE_DEFAULT_COLOR = process.env.UNSAFE_DEFAULT_COLOR ?? "";
3376
3692
  if (UNSAFE_DEFAULT_COLOR) {
3377
3693
  console.warn(
@@ -3395,24 +3711,29 @@ async function processPlatform(options) {
3395
3711
  buildOptions.defaultColor = UNSAFE_DEFAULT_COLOR;
3396
3712
  buildOptions.colorGroups = colorGroups;
3397
3713
  if (!buildOptions.defaultColor) {
3398
- const customColors = getCustomColors(filteredProcessed$themes, colorGroups);
3399
- const firstMainColor = R17.head(customColors);
3714
+ const customColors = getCustomColors(processed$themes, colorGroups);
3715
+ const firstMainColor = R22.head(customColors);
3400
3716
  buildOptions.defaultColor = firstMainColor;
3401
3717
  }
3402
3718
  if (buildOptions.defaultColor) {
3403
3719
  console.log(`
3404
3720
  \u{1F3A8} Using ${pc3.blue(buildOptions.defaultColor)} as default color`);
3405
3721
  }
3406
- const buildAndSdConfigs = R17.map((buildConfig) => {
3407
- const sdConfigs = getConfigsForThemeDimensions(
3408
- buildConfig.getConfig,
3409
- filteredProcessed$themes,
3410
- buildConfig.dimensions,
3411
- {
3412
- tokensDir,
3413
- tokenSets
3414
- }
3415
- );
3722
+ const sizeModes = processed$themes.filter((x) => x.group === "size").map((x) => x.name);
3723
+ buildOptions.sizeModes = sizeModes;
3724
+ if (!buildOptions.defaultSize) {
3725
+ const defaultSize = R22.head(sizeModes);
3726
+ buildOptions.defaultSize = defaultSize;
3727
+ }
3728
+ if (buildOptions.defaultSize) {
3729
+ console.log(`
3730
+ \u{1F4CF} Using ${pc3.blue(buildOptions.defaultSize)} as default size`);
3731
+ }
3732
+ const buildAndSdConfigs = R22.map((buildConfig) => {
3733
+ const sdConfigs = getConfigsForThemeDimensions(buildConfig.getConfig, processed$themes, buildConfig.dimensions, {
3734
+ tokensDir,
3735
+ tokenSets
3736
+ });
3416
3737
  const unknownConfigs = buildConfig.dimensions.map(
3417
3738
  (dimension) => sdConfigs.filter((x) => x.permutation[dimension] === "unknown")
3418
3739
  );
@@ -3436,10 +3757,13 @@ async function processPlatform(options) {
3436
3757
  "warning-color": [initResult],
3437
3758
  "info-color": [initResult],
3438
3759
  semantic: [initResult],
3439
- typography: [initResult]
3760
+ typography: [initResult],
3761
+ sizeMode: [initResult],
3762
+ size: [initResult],
3763
+ typeScale: [initResult]
3440
3764
  };
3441
3765
  try {
3442
- for (const [buildName, { buildConfig, sdConfigs }] of R17.toPairs(buildAndSdConfigs)) {
3766
+ for (const [buildName, { buildConfig, sdConfigs }] of R22.toPairs(buildAndSdConfigs)) {
3443
3767
  if (!(buildConfig.enabled?.() ?? true)) {
3444
3768
  continue;
3445
3769
  }
@@ -3451,7 +3775,7 @@ async function processPlatform(options) {
3451
3775
  const { config, permutation } = sdConfig;
3452
3776
  const modes = ["theme", ...buildConfig.dimensions];
3453
3777
  const modeMessage = modes.map((x) => permutation[x]).join(" - ");
3454
- const logMessage = R17.isNil(buildConfig.log) ? modeMessage : buildConfig?.log(sdConfig);
3778
+ const logMessage = R22.isNil(buildConfig.log) ? modeMessage : buildConfig?.log(sdConfig);
3455
3779
  console.log(logMessage);
3456
3780
  const sdOptions = { cache: true };
3457
3781
  const sdExtended = await sd.extend(config);
@@ -3500,7 +3824,7 @@ var formatTheme = async (themeConfig) => {
3500
3824
  var formatThemeCSS = async (themeConfig) => {
3501
3825
  const processedBuilds = await formatTheme(themeConfig);
3502
3826
  const themeCSSFiles = createThemeCSSFiles({ processedBuilds });
3503
- return R18.head(themeCSSFiles)?.output ?? "";
3827
+ return R23.head(themeCSSFiles)?.output ?? "";
3504
3828
  };
3505
3829
  export {
3506
3830
  cliOptions,