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