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