@digdir/designsystemet 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/configs/digdir.config.json +4 -0
  2. package/dist/bin/designsystemet.js +488 -166
  3. package/dist/global-Y35YADVH.json +100 -0
  4. package/dist/src/index.js +527 -203
  5. package/dist/src/scripts/update-preview-tokens.js +478 -128
  6. package/dist/src/tokens/build.js +429 -111
  7. package/dist/src/tokens/create/defaults.js +27 -23
  8. package/dist/src/tokens/create/generators/$designsystemet.js +6 -6
  9. package/dist/src/tokens/create/write.js +6 -6
  10. package/dist/src/tokens/create.js +27 -23
  11. package/dist/src/tokens/format.js +527 -203
  12. package/dist/src/tokens/index.js +527 -203
  13. package/dist/src/tokens/process/configs/color.js +366 -66
  14. package/dist/src/tokens/process/configs/semantic.d.ts.map +1 -1
  15. package/dist/src/tokens/process/configs/semantic.js +368 -68
  16. package/dist/src/tokens/process/configs/shared.js +9 -2
  17. package/dist/src/tokens/process/configs/size-mode.d.ts +3 -0
  18. package/dist/src/tokens/process/configs/size-mode.d.ts.map +1 -0
  19. package/dist/src/tokens/process/configs/size-mode.js +1067 -0
  20. package/dist/src/tokens/process/configs/size.d.ts +3 -0
  21. package/dist/src/tokens/process/configs/size.d.ts.map +1 -0
  22. package/dist/src/tokens/process/configs/size.js +1069 -0
  23. package/dist/src/tokens/process/configs/type-scale.d.ts +3 -0
  24. package/dist/src/tokens/process/configs/type-scale.d.ts.map +1 -0
  25. package/dist/src/tokens/process/configs/type-scale.js +1067 -0
  26. package/dist/src/tokens/process/configs/typography.d.ts.map +1 -1
  27. package/dist/src/tokens/process/configs/typography.js +364 -64
  28. package/dist/src/tokens/process/configs.d.ts +3 -0
  29. package/dist/src/tokens/process/configs.d.ts.map +1 -1
  30. package/dist/src/tokens/process/configs.js +373 -71
  31. package/dist/src/tokens/process/formats/css/color.js +381 -79
  32. package/dist/src/tokens/process/formats/css/semantic.d.ts +0 -14
  33. package/dist/src/tokens/process/formats/css/semantic.d.ts.map +1 -1
  34. package/dist/src/tokens/process/formats/css/semantic.js +407 -109
  35. package/dist/src/tokens/process/formats/css/size-mode.d.ts +4 -0
  36. package/dist/src/tokens/process/formats/css/size-mode.d.ts.map +1 -0
  37. package/dist/src/tokens/process/formats/css/size-mode.js +1068 -0
  38. package/dist/src/tokens/process/formats/css/size.d.ts +17 -0
  39. package/dist/src/tokens/process/formats/css/size.d.ts.map +1 -0
  40. package/dist/src/tokens/process/formats/css/size.js +1069 -0
  41. package/dist/src/tokens/process/formats/css/type-scale.d.ts +3 -0
  42. package/dist/src/tokens/process/formats/css/type-scale.d.ts.map +1 -0
  43. package/dist/src/tokens/process/formats/css/type-scale.js +1069 -0
  44. package/dist/src/tokens/process/formats/css/typography.js +365 -63
  45. package/dist/src/tokens/process/formats/css.d.ts +3 -0
  46. package/dist/src/tokens/process/formats/css.d.ts.map +1 -1
  47. package/dist/src/tokens/process/formats/css.js +364 -64
  48. package/dist/src/tokens/process/output/declarations.js +376 -74
  49. package/dist/src/tokens/process/output/theme.d.ts.map +1 -1
  50. package/dist/src/tokens/process/output/theme.js +63 -14
  51. package/dist/src/tokens/process/platform.d.ts +16 -0
  52. package/dist/src/tokens/process/platform.d.ts.map +1 -1
  53. package/dist/src/tokens/process/platform.js +402 -95
  54. package/dist/src/tokens/process/transformers.js +9 -2
  55. package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +373 -71
  56. package/dist/src/tokens/template/design-tokens/primitives/modes/size/global.js +1 -1
  57. package/dist/src/tokens/utils.d.ts +4 -1
  58. package/dist/src/tokens/utils.d.ts.map +1 -1
  59. package/dist/src/tokens/utils.js +24 -1
  60. package/package.json +6 -6
  61. package/dist/global-XVXVBKM6.json +0 -96
@@ -0,0 +1,1067 @@
1
+ // src/tokens/process/configs/size-mode.ts
2
+ import * as R15 from "ramda";
3
+
4
+ // src/tokens/process/formats/css/color.ts
5
+ import * as R9 from "ramda";
6
+ import { createPropertyFormatter } from "style-dictionary/utils";
7
+
8
+ // src/tokens/types.ts
9
+ var colorCategories = {
10
+ main: "main",
11
+ support: "support"
12
+ };
13
+
14
+ // src/tokens/utils.ts
15
+ import * as R from "ramda";
16
+ var mapToLowerCase = R.map(R.toLower);
17
+ var hasAnyTruth = R.any(R.equals(true));
18
+ var getType = (token) => (token.$type ?? token.type) || "";
19
+ var getValue = (token) => token.$value ?? token.value;
20
+ var typeEquals = R.curry(
21
+ (types, token) => {
22
+ if (R.isNil(token)) {
23
+ return false;
24
+ }
25
+ return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
26
+ }
27
+ );
28
+ var pathStartsWithOneOf = R.curry(
29
+ (paths, token) => {
30
+ if (R.isNil(token)) {
31
+ return false;
32
+ }
33
+ const tokenPath = mapToLowerCase(token.path);
34
+ const matchPathsStartingWith = R.map((pathOrString) => {
35
+ const path = typeof pathOrString === "string" ? [pathOrString] : pathOrString;
36
+ return R.startsWith(mapToLowerCase(path), tokenPath);
37
+ }, paths);
38
+ return hasAnyTruth(matchPathsStartingWith);
39
+ }
40
+ );
41
+ function isSemanticToken(token) {
42
+ return token.filePath.includes("semantic/");
43
+ }
44
+ function isSemanticColorToken(token, color) {
45
+ return token.filePath.includes("semantic/") && R.startsWith(["color", color], token.path);
46
+ }
47
+ function isGlobalColorToken(token) {
48
+ return typeEquals("color", token) && pathStartsWithOneOf(["global"], token);
49
+ }
50
+ function isColorCategoryToken(token, category) {
51
+ if (!category) {
52
+ return Object.keys(colorCategories).some(
53
+ (colorCategory2) => isColorCategoryToken(token, colorCategory2)
54
+ );
55
+ }
56
+ return R.startsWith(["color", category], token.path);
57
+ }
58
+ var isDigit = (s) => /^\d+$/.test(s);
59
+ function inlineTokens(shouldInline, tokens) {
60
+ const [inlineableTokens, otherTokens] = R.partition(shouldInline, tokens);
61
+ return otherTokens.map((token) => {
62
+ let transformed = getValue(token.original);
63
+ for (const ref of inlineableTokens) {
64
+ const refName = ref.path.join(".");
65
+ if (typeof transformed === "string") {
66
+ transformed = transformed.replaceAll(`{${refName}}`, getValue(ref.original));
67
+ }
68
+ }
69
+ const tokenWithInlinedRefs = R.set(R.lensPath(["original", "$value"]), transformed, token);
70
+ return tokenWithInlinedRefs;
71
+ });
72
+ }
73
+ var sizeMap = {
74
+ xsmall: "xs",
75
+ small: "sm",
76
+ medium: "md",
77
+ large: "lg",
78
+ xlarge: "xl"
79
+ };
80
+ function shortSizeName(size2) {
81
+ return sizeMap[size2] ?? size2;
82
+ }
83
+ var sizeComparator = (size2) => {
84
+ const sortIndex = Object.entries(sizeMap).findIndex(([key, val]) => key === size2 || val === size2);
85
+ return sortIndex ?? 0;
86
+ };
87
+ function orderBySize(sizes) {
88
+ return R.sortBy(sizeComparator, sizes);
89
+ }
90
+
91
+ // src/tokens/process/platform.ts
92
+ import pc2 from "picocolors";
93
+ import * as R8 from "ramda";
94
+ import StyleDictionary2 from "style-dictionary";
95
+
96
+ // src/tokens/process/configs.ts
97
+ import { register } from "@tokens-studio/sd-transforms";
98
+ import * as R7 from "ramda";
99
+ import StyleDictionary from "style-dictionary";
100
+
101
+ // src/tokens/process/configs/color.ts
102
+ import * as R3 from "ramda";
103
+
104
+ // src/tokens/process/transformers.ts
105
+ import { checkAndEvaluateMath } from "@tokens-studio/sd-transforms";
106
+ import * as R2 from "ramda";
107
+ var isPx = R2.test(/\b\d+px\b/g);
108
+ var sizeRem = {
109
+ name: "ds/size/toRem",
110
+ type: "value",
111
+ transitive: true,
112
+ filter: (token) => {
113
+ const hasWantedType = typeEquals(["dimension", "fontsize"], token);
114
+ const hasWantedPath = pathStartsWithOneOf([
115
+ "border-radius",
116
+ "font-size"
117
+ /*, ['_size', 'mode-font-size']*/
118
+ ], token);
119
+ return hasWantedType && hasWantedPath;
120
+ },
121
+ transform: (token, config) => {
122
+ const value = getValue(token);
123
+ if (isPx(value)) {
124
+ const baseFont = config.basePxFontSize || 16;
125
+ const size2 = parseInt(value, 10);
126
+ if (size2 === 0) {
127
+ return "0";
128
+ }
129
+ return `${size2 / baseFont}rem`;
130
+ }
131
+ return value;
132
+ }
133
+ };
134
+ var typographyName = {
135
+ name: "name/typography",
136
+ type: "name",
137
+ transitive: true,
138
+ // expanded tokens have different type so we match on path instead
139
+ filter: (token) => pathStartsWithOneOf(["typography"], token),
140
+ transform: (token) => {
141
+ return token.name.replace("-typography", "");
142
+ }
143
+ };
144
+ var resolveMath = {
145
+ name: "ds/resolveMath",
146
+ type: "value",
147
+ transitive: true,
148
+ filter: (token) => {
149
+ const isValidValue = ["string", "object"].includes(typeof getValue(token));
150
+ const isTokenOfInterest = !pathStartsWithOneOf(["border-radius"], token);
151
+ return isValidValue && isTokenOfInterest;
152
+ },
153
+ transform: (token, platformCfg) => checkAndEvaluateMath(token, platformCfg.mathFractionDigits)
154
+ };
155
+ var unitless = {
156
+ name: "ds/unitless",
157
+ type: "value",
158
+ transitive: true,
159
+ filter: (token) => pathStartsWithOneOf(["size", "_size"], token),
160
+ transform: (token) => parseInt(getValue(token), 10)
161
+ };
162
+
163
+ // src/tokens/process/configs/shared.ts
164
+ var prefix = "ds";
165
+ var basePxFontSize = 16;
166
+ var dsTransformers = [
167
+ "name/kebab",
168
+ resolveMath.name,
169
+ "ts/size/px",
170
+ sizeRem.name,
171
+ unitless.name,
172
+ "ts/typography/fontWeight",
173
+ typographyName.name,
174
+ "ts/color/modifiers",
175
+ "ts/color/css/hexrgba",
176
+ "ts/size/lineheight",
177
+ "shadow/css/shorthand"
178
+ ];
179
+
180
+ // src/tokens/process/configs/color.ts
181
+ var colorSchemeVariables = ({ "color-scheme": colorScheme2 = "light", theme }) => {
182
+ const selector = `${colorScheme2 === "light" ? ":root, " : ""}[data-color-scheme="${colorScheme2}"]`;
183
+ const layer = `ds.theme.color-scheme.${colorScheme2}`;
184
+ return {
185
+ preprocessors: ["tokens-studio"],
186
+ platforms: {
187
+ css: {
188
+ // custom
189
+ colorScheme: colorScheme2,
190
+ theme,
191
+ selector,
192
+ layer,
193
+ //
194
+ prefix,
195
+ buildPath: `${theme}/`,
196
+ transforms: dsTransformers,
197
+ files: [
198
+ {
199
+ destination: `color-scheme/${colorScheme2}.css`,
200
+ format: formats.colorScheme.name,
201
+ filter: (token) => typeEquals("color", token) && !R3.startsWith(["global"], token.path)
202
+ }
203
+ ],
204
+ options: {
205
+ outputReferences: false
206
+ }
207
+ }
208
+ }
209
+ };
210
+ };
211
+ var colorCategoryVariables = (opts) => ({ "color-scheme": colorScheme2, theme, ...permutation }) => {
212
+ const category = opts.category;
213
+ const color = category === "builtin" ? opts.color : permutation[`${category}-color`];
214
+ if (!color) {
215
+ throw new Error(
216
+ category === "builtin" ? `Missing color for built-in color ${opts.color}` : `Missing color for category ${category}`
217
+ );
218
+ }
219
+ const layer = `ds.theme.color`;
220
+ const isRootColor = color === buildOptions?.defaultColor;
221
+ const selector = isRootColor ? `:root, [data-color-scheme], [data-color="${color}"]` : `[data-color="${color}"], [data-color-scheme][data-color="${color}"]`;
222
+ const config = {
223
+ preprocessors: ["tokens-studio"],
224
+ platforms: {
225
+ css: {
226
+ // custom
227
+ colorScheme: colorScheme2,
228
+ theme,
229
+ selector,
230
+ layer,
231
+ //
232
+ prefix,
233
+ buildPath: `${theme}/`,
234
+ transforms: dsTransformers,
235
+ files: [
236
+ {
237
+ destination: `color/${color}.css`,
238
+ format: formats.colorCategory.name,
239
+ filter: (token) => category === "builtin" ? isSemanticColorToken(token, color) : isColorCategoryToken(token, category)
240
+ }
241
+ ],
242
+ options: {
243
+ outputReferences: true
244
+ }
245
+ }
246
+ }
247
+ };
248
+ return config;
249
+ };
250
+
251
+ // src/tokens/process/configs/semantic.ts
252
+ import * as R4 from "ramda";
253
+ import { outputReferencesFilter } from "style-dictionary/utils";
254
+ var semanticVariables = ({ theme }) => {
255
+ const selector = `:root`;
256
+ const layer = `ds.theme.semantic`;
257
+ return {
258
+ preprocessors: ["tokens-studio"],
259
+ platforms: {
260
+ css: {
261
+ // custom
262
+ theme,
263
+ basePxFontSize,
264
+ selector,
265
+ layer,
266
+ //
267
+ prefix,
268
+ buildPath: `${theme}/`,
269
+ transforms: dsTransformers,
270
+ files: [
271
+ {
272
+ destination: `semantic.css`,
273
+ format: formats.semantic.name,
274
+ filter: (token) => {
275
+ const isUwantedToken = R4.anyPass([R4.includes("primitives/global")])(token.filePath);
276
+ const isPrivateToken = R4.includes("_", token.path);
277
+ const unwantedPaths = pathStartsWithOneOf(
278
+ ["size", "_size", "font-size", "line-height", "letter-spacing"],
279
+ token
280
+ );
281
+ const unwantedTypes = typeEquals(["color", "fontWeight", "fontFamily", "typography"], token);
282
+ const unwantedTokens = !(unwantedPaths || unwantedTypes || isPrivateToken || isUwantedToken);
283
+ return unwantedTokens;
284
+ }
285
+ }
286
+ ],
287
+ options: {
288
+ outputReferences: (token, options) => {
289
+ const include = pathStartsWithOneOf(["border-radius"], token);
290
+ return include && outputReferencesFilter(token, options);
291
+ }
292
+ }
293
+ }
294
+ }
295
+ };
296
+ };
297
+
298
+ // src/tokens/process/configs/size.ts
299
+ import * as R5 from "ramda";
300
+ import { outputReferencesFilter as outputReferencesFilter2 } from "style-dictionary/utils";
301
+ var sizeVariables = ({ theme }) => {
302
+ const selector = `:root, [data-size]`;
303
+ const layer = `ds.theme.size`;
304
+ return {
305
+ preprocessors: ["tokens-studio"],
306
+ platforms: {
307
+ css: {
308
+ // custom
309
+ theme,
310
+ basePxFontSize,
311
+ selector,
312
+ layer,
313
+ //
314
+ prefix,
315
+ buildPath: `${theme}/`,
316
+ transforms: dsTransformers,
317
+ files: [
318
+ {
319
+ destination: `size.css`,
320
+ format: formats.size.name,
321
+ filter: (token) => {
322
+ const isUwantedToken = R5.anyPass([R5.includes("primitives/global")])(token.filePath);
323
+ const isPrivateToken = R5.includes("_", token.path);
324
+ return pathStartsWithOneOf(["size", "_size"], token) && !(isUwantedToken || isPrivateToken);
325
+ }
326
+ }
327
+ ],
328
+ options: {
329
+ outputReferences: (token, options) => {
330
+ const isWantedSize = pathStartsWithOneOf(["size", "_size"], token) && (isDigit(token.path[1]) || token.path[1] === "unit");
331
+ return isWantedSize && outputReferencesFilter2(token, options);
332
+ }
333
+ }
334
+ }
335
+ }
336
+ };
337
+ };
338
+
339
+ // src/tokens/process/configs/type-scale.ts
340
+ var typeScaleVariables = ({ theme, size: size2 }) => {
341
+ const selector = ":root, [data-size]";
342
+ const layer = `ds.theme.type-scale`;
343
+ return {
344
+ usesDtcg: true,
345
+ preprocessors: ["tokens-studio"],
346
+ expand: {
347
+ include: ["typography"]
348
+ },
349
+ platforms: {
350
+ css: {
351
+ prefix,
352
+ selector,
353
+ layer,
354
+ buildPath: `${theme}/`,
355
+ basePxFontSize,
356
+ transforms: [
357
+ "name/kebab",
358
+ "ts/size/px",
359
+ sizeRem.name,
360
+ "ts/size/lineheight",
361
+ "ts/typography/fontWeight",
362
+ typographyName.name
363
+ ],
364
+ files: [
365
+ {
366
+ destination: `type-scale.css`,
367
+ format: formats.typeScale.name,
368
+ filter: (token) => {
369
+ const included = typeEquals(["typography", "dimension", "fontsize"], token);
370
+ if (/primitives\/modes\/typography\/(primary|secondary)/.test(token.filePath)) return false;
371
+ return included && !pathStartsWithOneOf(["spacing", "sizing", "size", "border-width", "border-radius"], token) && (pathStartsWithOneOf(["font-size"], token) || token.path.includes("fontSize"));
372
+ }
373
+ }
374
+ ],
375
+ options: {
376
+ outputReferences: (token) => pathStartsWithOneOf(["typography"], token) && token.path.includes("fontSize")
377
+ }
378
+ }
379
+ }
380
+ };
381
+ };
382
+
383
+ // src/tokens/process/configs/typography.ts
384
+ import { expandTypesMap } from "@tokens-studio/sd-transforms";
385
+ var typographyVariables = ({ theme, typography: typography2 }) => {
386
+ const selector = `${typography2 === "primary" ? ":root, " : ""}[data-typography="${typography2}"]`;
387
+ const layer = `ds.theme.typography.${typography2}`;
388
+ return {
389
+ usesDtcg: true,
390
+ preprocessors: ["tokens-studio"],
391
+ expand: {
392
+ include: ["typography"],
393
+ typesMap: { ...expandTypesMap, typography: { ...expandTypesMap.typography, letterSpacing: "dimension" } }
394
+ },
395
+ platforms: {
396
+ css: {
397
+ prefix,
398
+ typography: typography2,
399
+ selector,
400
+ layer,
401
+ buildPath: `${theme}/`,
402
+ basePxFontSize,
403
+ transforms: [
404
+ "name/kebab",
405
+ "ts/size/px",
406
+ sizeRem.name,
407
+ "ts/size/lineheight",
408
+ "ts/typography/fontWeight",
409
+ "ts/size/css/letterspacing",
410
+ typographyName.name
411
+ ],
412
+ files: [
413
+ {
414
+ destination: `typography/${typography2}.css`,
415
+ format: formats.typography.name,
416
+ filter: (token) => {
417
+ const included = typeEquals(["fontweight", "fontFamily", "lineHeight", "dimension"], token);
418
+ if (/primitives\/modes\/typography\/(primary|secondary)/.test(token.filePath)) return false;
419
+ return included && !pathStartsWithOneOf(["spacing", "sizing", "size", "_size", "border-width", "border-radius"], token) && !(pathStartsWithOneOf(["typography"], token) && token.path.includes("fontSize"));
420
+ }
421
+ }
422
+ ]
423
+ }
424
+ }
425
+ };
426
+ };
427
+
428
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js
429
+ var BoxShadowTypes;
430
+ (function(BoxShadowTypes2) {
431
+ BoxShadowTypes2["DROP_SHADOW"] = "dropShadow";
432
+ BoxShadowTypes2["INNER_SHADOW"] = "innerShadow";
433
+ })(BoxShadowTypes || (BoxShadowTypes = {}));
434
+
435
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js
436
+ var ColorModifierTypes;
437
+ (function(ColorModifierTypes2) {
438
+ ColorModifierTypes2["LIGHTEN"] = "lighten";
439
+ ColorModifierTypes2["DARKEN"] = "darken";
440
+ ColorModifierTypes2["MIX"] = "mix";
441
+ ColorModifierTypes2["ALPHA"] = "alpha";
442
+ })(ColorModifierTypes || (ColorModifierTypes = {}));
443
+
444
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js
445
+ var ColorSpaceTypes;
446
+ (function(ColorSpaceTypes2) {
447
+ ColorSpaceTypes2["LCH"] = "lch";
448
+ ColorSpaceTypes2["SRGB"] = "srgb";
449
+ ColorSpaceTypes2["P3"] = "p3";
450
+ ColorSpaceTypes2["HSL"] = "hsl";
451
+ })(ColorSpaceTypes || (ColorSpaceTypes = {}));
452
+
453
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/Properties.js
454
+ var Properties;
455
+ (function(Properties2) {
456
+ Properties2["sizing"] = "sizing";
457
+ Properties2["height"] = "height";
458
+ Properties2["width"] = "width";
459
+ Properties2["spacing"] = "spacing";
460
+ Properties2["verticalPadding"] = "verticalPadding";
461
+ Properties2["horizontalPadding"] = "horizontalPadding";
462
+ Properties2["paddingTop"] = "paddingTop";
463
+ Properties2["paddingRight"] = "paddingRight";
464
+ Properties2["paddingBottom"] = "paddingBottom";
465
+ Properties2["paddingLeft"] = "paddingLeft";
466
+ Properties2["itemSpacing"] = "itemSpacing";
467
+ Properties2["fill"] = "fill";
468
+ Properties2["backgroundBlur"] = "backgroundBlur";
469
+ Properties2["border"] = "border";
470
+ Properties2["borderTop"] = "borderTop";
471
+ Properties2["borderRight"] = "borderRight";
472
+ Properties2["borderBottom"] = "borderBottom";
473
+ Properties2["borderLeft"] = "borderLeft";
474
+ Properties2["borderColor"] = "borderColor";
475
+ Properties2["borderRadius"] = "borderRadius";
476
+ Properties2["borderRadiusTopLeft"] = "borderRadiusTopLeft";
477
+ Properties2["borderRadiusTopRight"] = "borderRadiusTopRight";
478
+ Properties2["borderRadiusBottomRight"] = "borderRadiusBottomRight";
479
+ Properties2["borderRadiusBottomLeft"] = "borderRadiusBottomLeft";
480
+ Properties2["borderWidth"] = "borderWidth";
481
+ Properties2["borderWidthTop"] = "borderWidthTop";
482
+ Properties2["borderWidthRight"] = "borderWidthRight";
483
+ Properties2["borderWidthBottom"] = "borderWidthBottom";
484
+ Properties2["borderWidthLeft"] = "borderWidthLeft";
485
+ Properties2["boxShadow"] = "boxShadow";
486
+ Properties2["opacity"] = "opacity";
487
+ Properties2["fontFamilies"] = "fontFamilies";
488
+ Properties2["fontWeights"] = "fontWeights";
489
+ Properties2["fontSizes"] = "fontSizes";
490
+ Properties2["lineHeights"] = "lineHeights";
491
+ Properties2["typography"] = "typography";
492
+ Properties2["composition"] = "composition";
493
+ Properties2["letterSpacing"] = "letterSpacing";
494
+ Properties2["paragraphSpacing"] = "paragraphSpacing";
495
+ Properties2["textCase"] = "textCase";
496
+ Properties2["dimension"] = "dimension";
497
+ Properties2["textDecoration"] = "textDecoration";
498
+ Properties2["asset"] = "asset";
499
+ Properties2["tokenValue"] = "tokenValue";
500
+ Properties2["value"] = "value";
501
+ Properties2["tokenName"] = "tokenName";
502
+ Properties2["description"] = "description";
503
+ })(Properties || (Properties = {}));
504
+
505
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js
506
+ var TokenSetStatus;
507
+ (function(TokenSetStatus2) {
508
+ TokenSetStatus2["DISABLED"] = "disabled";
509
+ TokenSetStatus2["SOURCE"] = "source";
510
+ TokenSetStatus2["ENABLED"] = "enabled";
511
+ })(TokenSetStatus || (TokenSetStatus = {}));
512
+
513
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenTypes.js
514
+ var TokenTypes;
515
+ (function(TokenTypes2) {
516
+ TokenTypes2["OTHER"] = "other";
517
+ TokenTypes2["COLOR"] = "color";
518
+ TokenTypes2["BORDER_RADIUS"] = "borderRadius";
519
+ TokenTypes2["SIZING"] = "sizing";
520
+ TokenTypes2["SPACING"] = "spacing";
521
+ TokenTypes2["TEXT"] = "text";
522
+ TokenTypes2["TYPOGRAPHY"] = "typography";
523
+ TokenTypes2["OPACITY"] = "opacity";
524
+ TokenTypes2["BORDER_WIDTH"] = "borderWidth";
525
+ TokenTypes2["STROKE_STYLE"] = "strokeStyle";
526
+ TokenTypes2["BOX_SHADOW"] = "boxShadow";
527
+ TokenTypes2["FONT_FAMILIES"] = "fontFamilies";
528
+ TokenTypes2["FONT_WEIGHTS"] = "fontWeights";
529
+ TokenTypes2["LINE_HEIGHTS"] = "lineHeights";
530
+ TokenTypes2["FONT_SIZES"] = "fontSizes";
531
+ TokenTypes2["LETTER_SPACING"] = "letterSpacing";
532
+ TokenTypes2["PARAGRAPH_SPACING"] = "paragraphSpacing";
533
+ TokenTypes2["PARAGRAPH_INDENT"] = "paragraphIndent";
534
+ TokenTypes2["TEXT_DECORATION"] = "textDecoration";
535
+ TokenTypes2["TEXT_CASE"] = "textCase";
536
+ TokenTypes2["COMPOSITION"] = "composition";
537
+ TokenTypes2["DIMENSION"] = "dimension";
538
+ TokenTypes2["BORDER"] = "border";
539
+ TokenTypes2["ASSET"] = "asset";
540
+ TokenTypes2["BOOLEAN"] = "boolean";
541
+ TokenTypes2["NUMBER"] = "number";
542
+ })(TokenTypes || (TokenTypes = {}));
543
+
544
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BorderValues.js
545
+ var BorderValues;
546
+ (function(BorderValues2) {
547
+ BorderValues2["BORDER_COLOR"] = "color";
548
+ BorderValues2["BORDER_WIDTH"] = "width";
549
+ BorderValues2["BORDER_STYLE"] = "style";
550
+ })(BorderValues || (BorderValues = {}));
551
+
552
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js
553
+ var StrokeStyleValues;
554
+ (function(StrokeStyleValues2) {
555
+ StrokeStyleValues2["SOLID"] = "solid";
556
+ StrokeStyleValues2["DASHED"] = "dashed";
557
+ StrokeStyleValues2["DOTTED"] = "dotted";
558
+ StrokeStyleValues2["DOUBLE"] = "double";
559
+ StrokeStyleValues2["GROOVE"] = "groove";
560
+ StrokeStyleValues2["RIDGE"] = "ridge";
561
+ StrokeStyleValues2["OUTSET"] = "outset";
562
+ StrokeStyleValues2["INSET"] = "inset";
563
+ })(StrokeStyleValues || (StrokeStyleValues = {}));
564
+
565
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js
566
+ var BoxShadowValues;
567
+ (function(BoxShadowValues2) {
568
+ BoxShadowValues2["TYPE"] = "type";
569
+ BoxShadowValues2["COLOR"] = "color";
570
+ BoxShadowValues2["X"] = "x";
571
+ BoxShadowValues2["Y"] = "y";
572
+ BoxShadowValues2["BLUR"] = "blur";
573
+ BoxShadowValues2["SPREAD"] = "spread";
574
+ BoxShadowValues2["BLEND_MODE"] = "blendMode";
575
+ })(BoxShadowValues || (BoxShadowValues = {}));
576
+
577
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TypographyValues.js
578
+ var TypographyValues;
579
+ (function(TypographyValues2) {
580
+ TypographyValues2["FONT_FAMILY"] = "fontFamily";
581
+ TypographyValues2["FONT_WEIGHT"] = "fontWeight";
582
+ TypographyValues2["LINE_HEIGHT"] = "lineHeight";
583
+ TypographyValues2["FONT_SIZE"] = "fontSize";
584
+ TypographyValues2["LETTER_SPACING"] = "letterSpacing";
585
+ TypographyValues2["PARAGRAPH_SPACING"] = "paragraphSpacing";
586
+ TypographyValues2["PARAGRAPH_INDENT"] = "paragraphIndent";
587
+ TypographyValues2["TEXT_DECORATION"] = "textDecoration";
588
+ TypographyValues2["TEXT_CASE"] = "textCase";
589
+ })(TypographyValues || (TypographyValues = {}));
590
+
591
+ // src/tokens/process/utils/getMultidimensionalThemes.ts
592
+ import { kebabCase } from "change-case";
593
+ import pc from "picocolors";
594
+ import * as R6 from "ramda";
595
+ var processed = Symbol("Type brand for ProcessedThemeObject");
596
+ var hasUnknownProps = R6.pipe(R6.values, R6.none(R6.equals("unknown")), R6.not);
597
+
598
+ // src/tokens/process/configs.ts
599
+ void register(StyleDictionary, { withSDBuiltins: false });
600
+ StyleDictionary.registerTransform(sizeRem);
601
+ StyleDictionary.registerTransform(typographyName);
602
+ StyleDictionary.registerTransform(resolveMath);
603
+ StyleDictionary.registerTransform(unitless);
604
+ for (const format of Object.values(formats)) {
605
+ StyleDictionary.registerFormat(format);
606
+ }
607
+ var configs = {
608
+ colorSchemeVariables,
609
+ mainColorVariables: colorCategoryVariables({ category: "main" }),
610
+ supportColorVariables: colorCategoryVariables({ category: "support" }),
611
+ neutralColorVariables: colorCategoryVariables({ category: "builtin", color: "neutral" }),
612
+ successColorVariables: colorCategoryVariables({ category: "builtin", color: "success" }),
613
+ dangerColorVariables: colorCategoryVariables({ category: "builtin", color: "danger" }),
614
+ warningColorVariables: colorCategoryVariables({ category: "builtin", color: "warning" }),
615
+ infoColorVariables: colorCategoryVariables({ category: "builtin", color: "info" }),
616
+ sizeModeVariables,
617
+ sizeVariables,
618
+ typographyVariables,
619
+ typeScaleVariables,
620
+ semanticVariables
621
+ };
622
+
623
+ // src/tokens/process/platform.ts
624
+ var buildOptions = {
625
+ verbose: false,
626
+ processed$themes: [],
627
+ buildTokenFormats: {}
628
+ };
629
+ var sd = new StyleDictionary2();
630
+ var buildConfigs = {
631
+ typography: { getConfig: configs.typographyVariables, dimensions: ["typography"] },
632
+ sizeMode: { getConfig: configs.sizeModeVariables, dimensions: ["size"] },
633
+ size: { getConfig: configs.sizeVariables, dimensions: ["semantic"] },
634
+ typeScale: { getConfig: configs.typeScaleVariables, dimensions: ["semantic"] },
635
+ "color-scheme": { getConfig: configs.colorSchemeVariables, dimensions: ["color-scheme"] },
636
+ "main-color": { getConfig: configs.mainColorVariables, dimensions: ["main-color"] },
637
+ "support-color": { getConfig: configs.supportColorVariables, dimensions: ["support-color"] },
638
+ "neutral-color": {
639
+ getConfig: configs.neutralColorVariables,
640
+ dimensions: ["semantic"],
641
+ log: ({ permutation: { theme } }) => `${theme} - neutral`
642
+ },
643
+ "success-color": {
644
+ getConfig: configs.successColorVariables,
645
+ dimensions: ["semantic"],
646
+ log: ({ permutation: { theme } }) => `${theme} - success`
647
+ },
648
+ "danger-color": {
649
+ getConfig: configs.dangerColorVariables,
650
+ dimensions: ["semantic"],
651
+ log: ({ permutation: { theme } }) => `${theme} - danger`
652
+ },
653
+ "warning-color": {
654
+ getConfig: configs.warningColorVariables,
655
+ dimensions: ["semantic"],
656
+ log: ({ permutation: { theme } }) => `${theme} - warning`
657
+ },
658
+ "info-color": {
659
+ getConfig: configs.infoColorVariables,
660
+ dimensions: ["semantic"],
661
+ log: ({ permutation: { theme } }) => `${theme} - info`
662
+ },
663
+ semantic: { getConfig: configs.semanticVariables, dimensions: ["semantic"] }
664
+ };
665
+
666
+ // src/tokens/process/formats/css/color.ts
667
+ var prefersColorScheme = (colorScheme2, content) => `
668
+ @media (prefers-color-scheme: ${colorScheme2}) {
669
+ [data-color-scheme="auto"] ${content}
670
+ }
671
+ `;
672
+ var colorScheme = {
673
+ name: "ds/css-colorscheme",
674
+ format: async ({ dictionary, options, platform }) => {
675
+ const { allTokens } = dictionary;
676
+ const { outputReferences, usesDtcg } = options;
677
+ const { selector, colorScheme: colorScheme2, layer } = platform;
678
+ const colorScheme_ = colorScheme2;
679
+ const format = createPropertyFormatter({
680
+ outputReferences,
681
+ dictionary,
682
+ format: "css",
683
+ usesDtcg
684
+ });
685
+ const colorSchemeProperty = colorScheme_ === "dark" || colorScheme_ === "light" ? `
686
+ color-scheme: ${colorScheme_};
687
+ ` : "";
688
+ const filteredAllTokens = allTokens.filter(
689
+ R9.allPass([
690
+ R9.anyPass([
691
+ // Include semantic tokens in the output
692
+ isSemanticToken,
693
+ // Include global color tokens
694
+ isGlobalColorToken
695
+ ]),
696
+ // Don't include color category tokens -- they are exported separately
697
+ (t) => !isColorCategoryToken(t)
698
+ ])
699
+ );
700
+ const formattedMap = filteredAllTokens.map((token) => ({
701
+ token,
702
+ formatted: format(token)
703
+ }));
704
+ const formattedTokens = formattedMap.map(R9.view(R9.lensProp("formatted"))).join("\n");
705
+ const content = `{
706
+ ${formattedTokens}
707
+ ${colorSchemeProperty}}
708
+ `;
709
+ const autoSelectorContent = ["light", "dark"].includes(colorScheme_) ? prefersColorScheme(colorScheme_, content) : "";
710
+ const body = R9.isNotNil(layer) ? `@layer ${layer} {
711
+ ${selector} ${content} ${autoSelectorContent}
712
+ }
713
+ ` : `${selector} ${content} ${autoSelectorContent}
714
+ `;
715
+ return body;
716
+ }
717
+ };
718
+ var colorCategory = {
719
+ name: "ds/css-colorcategory",
720
+ format: async ({ dictionary, file, options, platform }) => {
721
+ const { outputReferences, usesDtcg } = options;
722
+ const { selector, layer } = platform;
723
+ const destination = file.destination;
724
+ const format = R9.compose(
725
+ createPropertyFormatter({
726
+ outputReferences,
727
+ dictionary,
728
+ format: "css",
729
+ usesDtcg
730
+ }),
731
+ (token) => ({
732
+ ...token,
733
+ name: token.name.replace(/color-\w+-/, "color-"),
734
+ original: {
735
+ ...token.original,
736
+ $value: new RegExp(`color-(${colorCategories.main}|${colorCategories.support})-`).test(token.name) ? token.original.$value : `{${token.path.join(".")}}`
737
+ }
738
+ })
739
+ );
740
+ const formattedMap = dictionary.allTokens.map((token) => ({
741
+ token,
742
+ formatted: format(token)
743
+ }));
744
+ buildOptions.buildTokenFormats[destination] = formattedMap;
745
+ const formattedTokens = formattedMap.map(R9.view(R9.lensProp("formatted"))).join("\n");
746
+ const content = `{
747
+ ${formattedTokens}
748
+ }
749
+ `;
750
+ const body = R9.isNotNil(layer) ? `@layer ${layer} {
751
+ ${selector} ${content}
752
+ }
753
+ ` : `${selector} ${content}
754
+ `;
755
+ return body;
756
+ }
757
+ };
758
+
759
+ // src/tokens/process/formats/css/semantic.ts
760
+ import * as R11 from "ramda";
761
+ import { createPropertyFormatter as createPropertyFormatter3 } from "style-dictionary/utils";
762
+
763
+ // src/tokens/process/formats/css/size.ts
764
+ import * as R10 from "ramda";
765
+ import { createPropertyFormatter as createPropertyFormatter2 } from "style-dictionary/utils";
766
+ var isNumericBorderRadiusToken = (t) => t.path[0] === "border-radius" && isDigit(t.path[1]);
767
+ var isNumericSizeToken = (t) => pathStartsWithOneOf(["size"], t) && isDigit(t.path[1]);
768
+ var isSizeToken = (t) => pathStartsWithOneOf(["size"], t);
769
+ var isInlineTokens = R10.anyPass([isNumericBorderRadiusToken, isNumericSizeToken, isSizeToken]);
770
+ var overrideSizingFormula = (format, token) => {
771
+ const [name, value] = format(token).replace(/;$/, "").split(": ");
772
+ let calc;
773
+ let round;
774
+ if (token.path[1] === "unit") {
775
+ calc = `calc(1rem * ${value})`;
776
+ } else if (value.startsWith("floor")) {
777
+ calc = value.replace(/^floor\((.*)\)$/, "calc($1)");
778
+ round = `round(down, ${calc}, 1px)`;
779
+ } else {
780
+ calc = value.includes("*") ? `calc(${value})` : value;
781
+ }
782
+ return {
783
+ name,
784
+ round: round ?? calc,
785
+ calc
786
+ };
787
+ };
788
+ var formatSizingTokens = (format, tokens) => R10.reduce(
789
+ (acc, token) => {
790
+ const { round, calc, name } = overrideSizingFormula(format, token);
791
+ return {
792
+ tokens: [...acc.tokens, token],
793
+ round: [...acc.round, `${name}: ${round};`],
794
+ calc: [...acc.calc, `${name}: ${calc};`]
795
+ };
796
+ },
797
+ { tokens: [], round: [], calc: [] },
798
+ tokens
799
+ );
800
+ var sizingTemplate = ({ round, calc }) => {
801
+ const usesRounding = round.filter((val, i) => val !== calc[i]);
802
+ return `
803
+ ${calc.join("\n")}
804
+
805
+ @supports (width: round(down, .1em, 1px)) {
806
+ ${usesRounding.join("\n ")}
807
+ }`;
808
+ };
809
+ var size = {
810
+ name: "ds/css-size",
811
+ format: async ({ dictionary, file, options, platform }) => {
812
+ const { outputReferences, usesDtcg } = options;
813
+ const { selector, layer } = platform;
814
+ const destination = file.destination;
815
+ const format = createPropertyFormatter2({
816
+ outputReferences,
817
+ dictionary,
818
+ format: "css",
819
+ usesDtcg
820
+ });
821
+ const tokens = inlineTokens(isInlineTokens, dictionary.allTokens);
822
+ const filteredTokens = R10.reject((token) => R10.equals(["_size", "mode-font-size"], token.path), tokens);
823
+ const [sizingTokens, restTokens] = R10.partition(
824
+ (t) => pathStartsWithOneOf(["_size"], t) && (isDigit(t.path[1]) || t.path[1] === "unit"),
825
+ filteredTokens
826
+ );
827
+ const formattedSizingTokens = formatSizingTokens(format, sizingTokens);
828
+ const formattedMap = restTokens.map((token) => ({
829
+ token,
830
+ formatted: format(token)
831
+ }));
832
+ const formattedSizingMap = formattedSizingTokens.round.map((t, i) => ({
833
+ token: formattedSizingTokens.tokens[i],
834
+ formatted: t
835
+ }));
836
+ buildOptions.buildTokenFormats[destination] = [...formattedMap, ...formattedSizingMap];
837
+ const formattedTokens = [formattedMap.map(R10.prop("formatted")).join("\n"), sizingTemplate(formattedSizingTokens)];
838
+ const content = `${selector} {
839
+ ${formattedTokens.join("\n")}
840
+ }
841
+ `;
842
+ const body = R10.isNotNil(layer) ? `@layer ${layer} {
843
+ ${content}
844
+ }
845
+ ` : `${content}
846
+ `;
847
+ return body;
848
+ }
849
+ };
850
+
851
+ // src/tokens/process/formats/css/semantic.ts
852
+ var semantic = {
853
+ name: "ds/css-semantic",
854
+ format: async ({ dictionary, file, options, platform }) => {
855
+ const { outputReferences, usesDtcg } = options;
856
+ const { selector, layer } = platform;
857
+ const destination = file.destination;
858
+ const format = createPropertyFormatter3({
859
+ outputReferences,
860
+ dictionary,
861
+ format: "css",
862
+ usesDtcg
863
+ });
864
+ const tokens = inlineTokens(isInlineTokens, dictionary.allTokens);
865
+ const formattedMap = tokens.map((token) => ({
866
+ token,
867
+ formatted: format(token)
868
+ }));
869
+ buildOptions.buildTokenFormats[destination] = formattedMap;
870
+ const formattedTokens = formattedMap.map(R11.prop("formatted")).join("\n");
871
+ const content = `${selector} {
872
+ ${formattedTokens}
873
+ }
874
+ `;
875
+ const body = R11.isNotNil(layer) ? `@layer ${layer} {
876
+ ${content}
877
+ }
878
+ ` : `${content}
879
+ `;
880
+ return body;
881
+ }
882
+ };
883
+
884
+ // src/tokens/process/formats/css/size-mode.ts
885
+ import * as R12 from "ramda";
886
+ import { createPropertyFormatter as createPropertyFormatter4 } from "style-dictionary/utils";
887
+ var formatBaseSizeToken = (size2) => (token) => ({
888
+ ...token,
889
+ originalName: token.name,
890
+ name: `${token.name}--${shortSizeName(size2)}`,
891
+ $value: token.$value / basePxFontSize
892
+ });
893
+ var sizeMode = {
894
+ name: "ds/css-size-mode",
895
+ format: async ({ dictionary, file, options, platform }) => {
896
+ const { outputReferences, usesDtcg } = options;
897
+ const { selector, layer, size: size2 } = platform;
898
+ const destination = file.destination;
899
+ const format = createPropertyFormatter4({
900
+ outputReferences,
901
+ dictionary,
902
+ format: "css",
903
+ usesDtcg
904
+ });
905
+ const sizeSpecificTokens = dictionary.allTokens.map(formatBaseSizeToken(size2));
906
+ const sizeSpecificVariables = sizeSpecificTokens.map(format).join("\n");
907
+ const formattedMap = sizeSpecificTokens.map((token) => ({
908
+ token,
909
+ formatted: format({
910
+ ...token,
911
+ // Remove the `--<size>` suffix for the token listing, since that is the only token we actually use
912
+ name: token.originalName
913
+ })
914
+ }));
915
+ buildOptions.buildTokenFormats[destination] = formattedMap;
916
+ const content = `${selector} /* ${size2} */ {
917
+ ${sizeSpecificVariables}
918
+ }`;
919
+ const body = wrapInLayer(content, layer);
920
+ const sizes = orderBySize(buildOptions?.sizeModes ?? []).map(shortSizeName);
921
+ const defaultSize = shortSizeName(buildOptions?.defaultSize ?? "");
922
+ const sizingToggles = `:root, [data-size] {
923
+ --ds-size: var(--ds-size--${defaultSize});
924
+ ${sizes.map((size3) => ` --ds-size--${size3}: var(--ds-size,);`).join("\n")}
925
+ --ds-size-mode-font-size:
926
+ ${sizes.map((size3) => ` var(--ds-size--${size3}, var(--ds-size-mode-font-size--${size3}))`).join("\n")};
927
+ }`;
928
+ const sizingHelpers = sizes.map((size3) => `[data-size='${size3}'] { --ds-size: var(--ds-size--${size3}); }`).join("\n");
929
+ const sharedContent = `${sizingToggles}
930
+
931
+ ${sizingHelpers}`;
932
+ const sharedBody = shortSizeName(size2) === R12.last(sizes) ? `
933
+ ${wrapInLayer(sharedContent, layer)}` : "";
934
+ return body + sharedBody;
935
+ }
936
+ };
937
+ function wrapInLayer(content, layer) {
938
+ return R12.isNotNil(layer) ? `@layer ${layer} {
939
+ ${content}
940
+ }
941
+ ` : `${content}
942
+ `;
943
+ }
944
+
945
+ // src/tokens/process/formats/css/typography.ts
946
+ import * as R13 from "ramda";
947
+ import { createPropertyFormatter as createPropertyFormatter5 } from "style-dictionary/utils";
948
+ var typographyFontFamilyPredicate = R13.allPass([
949
+ R13.pathSatisfies(R13.includes("typography"), ["path"]),
950
+ R13.pathSatisfies(R13.includes("fontFamily"), ["path"])
951
+ ]);
952
+ var typography = {
953
+ name: "ds/css-typography",
954
+ format: async ({ dictionary, file, options, platform }) => {
955
+ const { outputReferences, usesDtcg } = options;
956
+ const { selector, layer } = platform;
957
+ const destination = file.destination;
958
+ const format = createPropertyFormatter5({
959
+ outputReferences,
960
+ dictionary,
961
+ format: "css",
962
+ usesDtcg
963
+ });
964
+ const filteredTokens = R13.reject(typographyFontFamilyPredicate, dictionary.allTokens);
965
+ const formattedMap = filteredTokens.map((token) => ({
966
+ token,
967
+ formatted: format(token)
968
+ }));
969
+ buildOptions.buildTokenFormats[destination] = formattedMap;
970
+ const formattedTokens = formattedMap.map(R13.view(R13.lensProp("formatted"))).join("\n");
971
+ const content = selector ? `${selector} {
972
+ ${formattedTokens}
973
+ }` : formattedTokens;
974
+ const body = R13.isNotNil(layer) ? `@layer ${layer} {
975
+ ${content}
976
+ }` : content;
977
+ return body;
978
+ }
979
+ };
980
+
981
+ // src/tokens/process/formats/css/type-scale.ts
982
+ import * as R14 from "ramda";
983
+ import { createPropertyFormatter as createPropertyFormatter6 } from "style-dictionary/utils";
984
+ var typographyFontFamilyPredicate2 = R14.allPass([
985
+ R14.pathSatisfies(R14.includes("typography"), ["path"]),
986
+ R14.pathSatisfies(R14.includes("fontFamily"), ["path"])
987
+ ]);
988
+ function formatTypographySizeToken(token) {
989
+ return { ...token, $value: `calc(${token.$value} * var(--_ds-font-size-factor))` };
990
+ }
991
+ var typeScale = {
992
+ name: "ds/css-type-scale",
993
+ format: async ({ dictionary, file, options, platform }) => {
994
+ const { outputReferences, usesDtcg } = options;
995
+ const { selector, layer } = platform;
996
+ const destination = file.destination;
997
+ const format = createPropertyFormatter6({
998
+ outputReferences,
999
+ dictionary,
1000
+ format: "css",
1001
+ usesDtcg
1002
+ });
1003
+ const filteredTokens = R14.reject(typographyFontFamilyPredicate2, dictionary.allTokens);
1004
+ const tokens = R14.map(formatTypographySizeToken, filteredTokens);
1005
+ const formattedMap = tokens.map((token) => ({
1006
+ token,
1007
+ formatted: format(token)
1008
+ }));
1009
+ buildOptions.buildTokenFormats[destination] = formattedMap;
1010
+ const formattedTokens = formattedMap.map(R14.prop("formatted")).join("\n");
1011
+ const sizeFactor = ` --_ds-font-size-factor: calc(var(--ds-size-mode-font-size) / (var(--ds-size-base) / ${basePxFontSize}));`;
1012
+ const content = `${selector} {
1013
+ ${sizeFactor}
1014
+ ${formattedTokens}
1015
+ }`;
1016
+ const body = R14.isNotNil(layer) ? `@layer ${layer} {
1017
+ ${content}
1018
+ }` : content;
1019
+ return body;
1020
+ }
1021
+ };
1022
+
1023
+ // src/tokens/process/formats/css.ts
1024
+ var formats = {
1025
+ colorScheme,
1026
+ colorCategory,
1027
+ semantic,
1028
+ sizeMode,
1029
+ size,
1030
+ typography,
1031
+ typeScale
1032
+ };
1033
+
1034
+ // src/tokens/process/configs/size-mode.ts
1035
+ var sizeModeVariables = ({ theme, size: size2 }) => {
1036
+ const selector = `:root`;
1037
+ const layer = `ds.theme.size-mode`;
1038
+ return {
1039
+ preprocessors: ["tokens-studio"],
1040
+ platforms: {
1041
+ css: {
1042
+ // custom
1043
+ size: size2,
1044
+ theme,
1045
+ basePxFontSize,
1046
+ selector,
1047
+ layer,
1048
+ //
1049
+ prefix,
1050
+ buildPath: `${theme}/`,
1051
+ transforms: dsTransformers,
1052
+ files: [
1053
+ {
1054
+ destination: `size-mode/${size2}.css`,
1055
+ format: formats.sizeMode.name,
1056
+ filter: (token) => {
1057
+ return R15.equals(["_size", "mode-font-size"], token.path);
1058
+ }
1059
+ }
1060
+ ]
1061
+ }
1062
+ }
1063
+ };
1064
+ };
1065
+ export {
1066
+ sizeModeVariables
1067
+ };