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