@digdir/designsystemet 1.1.3 → 1.1.5

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 (41) hide show
  1. package/dist/bin/designsystemet.js +130 -186
  2. package/dist/src/index.js +88 -145
  3. package/dist/src/scripts/update-preview-tokens.d.ts +3 -0
  4. package/dist/src/scripts/update-preview-tokens.d.ts.map +1 -0
  5. package/dist/src/scripts/update-preview-tokens.js +3446 -0
  6. package/dist/src/tokens/build.d.ts +1 -1
  7. package/dist/src/tokens/build.d.ts.map +1 -1
  8. package/dist/src/tokens/build.js +98 -154
  9. package/dist/src/tokens/create/generators/$designsystemet.js +6 -6
  10. package/dist/src/tokens/create/write.js +6 -6
  11. package/dist/src/tokens/format.d.ts +1 -1
  12. package/dist/src/tokens/format.d.ts.map +1 -1
  13. package/dist/src/tokens/format.js +88 -145
  14. package/dist/src/tokens/index.js +88 -145
  15. package/dist/src/tokens/process/configs/color.js +234 -293
  16. package/dist/src/tokens/process/configs/semantic.js +509 -113
  17. package/dist/src/tokens/process/configs/typography.d.ts.map +1 -1
  18. package/dist/src/tokens/process/configs/typography.js +504 -110
  19. package/dist/src/tokens/process/configs.d.ts +0 -1
  20. package/dist/src/tokens/process/configs.d.ts.map +1 -1
  21. package/dist/src/tokens/process/configs.js +231 -290
  22. package/dist/src/tokens/process/formats/css/color.d.ts.map +1 -1
  23. package/dist/src/tokens/process/formats/css/color.js +644 -12
  24. package/dist/src/tokens/process/formats/css/semantic.d.ts.map +1 -1
  25. package/dist/src/tokens/process/formats/css/semantic.js +679 -23
  26. package/dist/src/tokens/process/formats/css/typography.d.ts.map +1 -1
  27. package/dist/src/tokens/process/formats/css/typography.js +741 -8
  28. package/dist/src/tokens/process/formats/css.js +549 -38
  29. package/dist/src/tokens/process/output/declarations.js +60 -121
  30. package/dist/src/tokens/process/output/theme.js +6 -6
  31. package/dist/src/tokens/process/platform.d.ts +9 -4
  32. package/dist/src/tokens/process/platform.d.ts.map +1 -1
  33. package/dist/src/tokens/process/platform.js +76 -133
  34. package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +62 -123
  35. package/package.json +6 -6
  36. package/dist/src/tokens/process/configs/storefront.d.ts +0 -3
  37. package/dist/src/tokens/process/configs/storefront.d.ts.map +0 -1
  38. package/dist/src/tokens/process/configs/storefront.js +0 -234
  39. package/dist/src/tokens/process/formats/js-tokens.d.ts +0 -6
  40. package/dist/src/tokens/process/formats/js-tokens.d.ts.map +0 -1
  41. package/dist/src/tokens/process/formats/js-tokens.js +0 -123
@@ -1,27 +1,760 @@
1
1
  // src/tokens/process/formats/css/typography.ts
2
+ import * as R10 from "ramda";
3
+ import { createPropertyFormatter as createPropertyFormatter3 } from "style-dictionary/utils";
4
+
5
+ // src/tokens/process/platform.ts
6
+ import chalk2 from "chalk";
7
+ import * as R9 from "ramda";
8
+ import StyleDictionary2 from "style-dictionary";
9
+
10
+ // src/tokens/types.ts
11
+ var colorCategories = {
12
+ main: "main",
13
+ support: "support"
14
+ };
15
+
16
+ // src/tokens/process/configs.ts
17
+ import { register } from "@tokens-studio/sd-transforms";
18
+ import * as R8 from "ramda";
19
+ import StyleDictionary from "style-dictionary";
20
+
21
+ // src/tokens/utils.ts
2
22
  import * as R from "ramda";
23
+ var mapToLowerCase = R.map(R.toLower);
24
+ var hasAnyTruth = R.any(R.equals(true));
25
+ var getType = (token) => (token.$type ?? token.type) || "";
26
+ var getValue = (token) => token.$value ?? token.value;
27
+ var typeEquals = R.curry(
28
+ (types, token) => {
29
+ if (R.isNil(token)) {
30
+ return false;
31
+ }
32
+ return R.includes(R.toLower(getType(token)), R.map(R.toLower, Array.isArray(types) ? types : [types]));
33
+ }
34
+ );
35
+ var pathStartsWithOneOf = R.curry(
36
+ (paths, token) => {
37
+ if (R.isNil(token)) {
38
+ return false;
39
+ }
40
+ const tokenPath = mapToLowerCase(token.path);
41
+ const matchPathsStartingWith = R.map((path) => R.startsWith([path], tokenPath), mapToLowerCase(paths));
42
+ return hasAnyTruth(matchPathsStartingWith);
43
+ }
44
+ );
45
+ function isSemanticToken(token) {
46
+ return token.filePath.includes("semantic/");
47
+ }
48
+ function isSemanticColorToken(token, color) {
49
+ return token.filePath.includes("semantic/") && R.startsWith(["color", color], token.path);
50
+ }
51
+ function isGlobalColorToken(token) {
52
+ return typeEquals("color", token) && pathStartsWithOneOf(["global"], token);
53
+ }
54
+ function isColorCategoryToken(token, category) {
55
+ if (!category) {
56
+ return Object.keys(colorCategories).some(
57
+ (colorCategory2) => isColorCategoryToken(token, colorCategory2)
58
+ );
59
+ }
60
+ return R.startsWith(["color", category], token.path);
61
+ }
62
+ var isDigit = (s) => /^\d+$/.test(s);
63
+ function inlineTokens(shouldInline, tokens) {
64
+ const [inlineableTokens, otherTokens] = R.partition(shouldInline, tokens);
65
+ return otherTokens.map((token) => {
66
+ let transformed = getValue(token.original);
67
+ for (const ref of inlineableTokens) {
68
+ const refName = ref.path.join(".");
69
+ if (typeof transformed === "string") {
70
+ transformed = transformed.replaceAll(`{${refName}}`, getValue(ref.original));
71
+ }
72
+ }
73
+ const tokenWithInlinedRefs = R.set(R.lensPath(["original", "$value"]), transformed, token);
74
+ return tokenWithInlinedRefs;
75
+ });
76
+ }
77
+
78
+ // src/tokens/process/configs/color.ts
79
+ import * as R5 from "ramda";
80
+
81
+ // src/tokens/process/formats/css/color.ts
82
+ import * as R2 from "ramda";
3
83
  import { createPropertyFormatter } from "style-dictionary/utils";
4
- var typographyFontFamilyPredicate = R.allPass([
5
- R.pathSatisfies(R.includes("typography"), ["path"]),
6
- R.pathSatisfies(R.includes("fontFamily"), ["path"])
84
+ var prefersColorScheme = (colorScheme2, content) => `
85
+ @media (prefers-color-scheme: ${colorScheme2}) {
86
+ [data-color-scheme="auto"] ${content}
87
+ }
88
+ `;
89
+ var colorScheme = {
90
+ name: "ds/css-colorscheme",
91
+ format: async ({ dictionary, options, platform }) => {
92
+ const { allTokens } = dictionary;
93
+ const { outputReferences, usesDtcg } = options;
94
+ const { selector, colorScheme: colorScheme2, layer } = platform;
95
+ const colorScheme_ = colorScheme2;
96
+ const format = createPropertyFormatter({
97
+ outputReferences,
98
+ dictionary,
99
+ format: "css",
100
+ usesDtcg
101
+ });
102
+ const colorSchemeProperty = colorScheme_ === "dark" || colorScheme_ === "light" ? `
103
+ color-scheme: ${colorScheme_};
104
+ ` : "";
105
+ const filteredAllTokens = allTokens.filter(
106
+ R2.allPass([
107
+ R2.anyPass([
108
+ // Include semantic tokens in the output
109
+ isSemanticToken,
110
+ // Include global color tokens
111
+ isGlobalColorToken
112
+ ]),
113
+ // Don't include color category tokens -- they are exported separately
114
+ (t) => !isColorCategoryToken(t)
115
+ ])
116
+ );
117
+ const formattedMap = filteredAllTokens.map((token) => ({
118
+ token,
119
+ formatted: format(token)
120
+ }));
121
+ const formattedTokens = formattedMap.map(R2.view(R2.lensProp("formatted"))).join("\n");
122
+ const content = `{
123
+ ${formattedTokens}
124
+ ${colorSchemeProperty}}
125
+ `;
126
+ const autoSelectorContent = ["light", "dark"].includes(colorScheme_) ? prefersColorScheme(colorScheme_, content) : "";
127
+ const body = R2.isNotNil(layer) ? `@layer ${layer} {
128
+ ${selector} ${content} ${autoSelectorContent}
129
+ }
130
+ ` : `${selector} ${content} ${autoSelectorContent}
131
+ `;
132
+ return body;
133
+ }
134
+ };
135
+ var colorCategory = {
136
+ name: "ds/css-colorcategory",
137
+ format: async ({ dictionary, options, platform }) => {
138
+ const { outputReferences, usesDtcg } = options;
139
+ const { selector, layer, files } = platform;
140
+ const destination = files?.[0]?.destination;
141
+ const format = R2.compose(
142
+ createPropertyFormatter({
143
+ outputReferences,
144
+ dictionary,
145
+ format: "css",
146
+ usesDtcg
147
+ }),
148
+ (token) => ({
149
+ ...token,
150
+ name: token.name.replace(/color-\w+-/, "color-"),
151
+ original: {
152
+ ...token.original,
153
+ $value: new RegExp(`color-(${colorCategories.main}|${colorCategories.support})-`).test(token.name) ? token.original.$value : `{${token.path.join(".")}}`
154
+ }
155
+ })
156
+ );
157
+ const formattedMap = dictionary.allTokens.map((token) => ({
158
+ token,
159
+ formatted: format(token)
160
+ }));
161
+ buildOptions.buildTokenFormats[destination] = formattedMap;
162
+ const formattedTokens = formattedMap.map(R2.view(R2.lensProp("formatted"))).join("\n");
163
+ const content = `{
164
+ ${formattedTokens}
165
+ }
166
+ `;
167
+ const body = R2.isNotNil(layer) ? `@layer ${layer} {
168
+ ${selector} ${content}
169
+ }
170
+ ` : `${selector} ${content}
171
+ `;
172
+ return body;
173
+ }
174
+ };
175
+
176
+ // src/tokens/process/formats/css/semantic.ts
177
+ import * as R3 from "ramda";
178
+ import { createPropertyFormatter as createPropertyFormatter2 } from "style-dictionary/utils";
179
+ var isNumericBorderRadiusToken = (t) => t.path[0] === "border-radius" && isDigit(t.path[1]);
180
+ var isNumericSizeToken = (t) => pathStartsWithOneOf(["size"], t) && isDigit(t.path[1]);
181
+ var isSizeToken = (t) => pathStartsWithOneOf(["size"], t);
182
+ var isInlineTokens = R3.anyPass([isNumericBorderRadiusToken, isNumericSizeToken, isSizeToken]);
183
+ var overrideSizingFormula = (format, token) => {
184
+ const [name, value] = format(token).split(":");
185
+ const calc = value.replace(`var(--ds-size-mode-font-size)`, "1em").replace(/floor\((.*)\);/, "calc($1)");
186
+ const round = `round(down, ${calc}, 1px)`;
187
+ return {
188
+ name,
189
+ round,
190
+ calc
191
+ };
192
+ };
193
+ var formatSizingTokens = (format, tokens) => R3.reduce(
194
+ (acc, token) => {
195
+ const { round, calc, name } = overrideSizingFormula(format, token);
196
+ return {
197
+ tokens: [...acc.tokens, token],
198
+ round: [...acc.round, `${name}: ${round};`],
199
+ calc: [...acc.calc, `${name}: ${calc};`]
200
+ };
201
+ },
202
+ { tokens: [], round: [], calc: [] },
203
+ tokens
204
+ );
205
+ var sizingTemplate = ({ round, calc }) => `
206
+ ${calc.join("\n")}
207
+
208
+ @supports (width: round(down, .1em, 1px)) {
209
+ ${round.join("\n")}
210
+ }`;
211
+ var semantic = {
212
+ name: "ds/css-semantic",
213
+ format: async ({ dictionary, options, platform }) => {
214
+ const { outputReferences, usesDtcg } = options;
215
+ const { selector, layer, files } = platform;
216
+ const destination = files?.[0]?.destination;
217
+ const format = createPropertyFormatter2({
218
+ outputReferences,
219
+ dictionary,
220
+ format: "css",
221
+ usesDtcg
222
+ });
223
+ const tokens = inlineTokens(isInlineTokens, dictionary.allTokens);
224
+ const filteredTokens = R3.reject((token) => token.name.includes("ds-size-mode-font-size"), tokens);
225
+ const [sizingTokens, restTokens] = R3.partition(
226
+ (t) => pathStartsWithOneOf(["_size"], t) && isDigit(t.path[1]),
227
+ filteredTokens
228
+ );
229
+ const formattedSizingTokens = formatSizingTokens(format, sizingTokens);
230
+ const formattedMap = restTokens.map((token) => ({
231
+ token,
232
+ formatted: format(token)
233
+ }));
234
+ const formattedSizingMap = formattedSizingTokens.round.map((t, i) => ({
235
+ token: formattedSizingTokens.tokens[i],
236
+ formatted: t
237
+ }));
238
+ buildOptions.buildTokenFormats[destination] = [...formattedMap, ...formattedSizingMap];
239
+ const sizingSnippet = sizingTemplate(formattedSizingTokens);
240
+ const formattedTokens = formattedMap.map(R3.view(R3.lensProp("formatted"))).concat(sizingSnippet);
241
+ const content = `{
242
+ ${formattedTokens.join("\n")}
243
+ }
244
+ `;
245
+ const body = R3.isNotNil(layer) ? `@layer ${layer} {
246
+ ${selector} ${content}
247
+ }
248
+ ` : `${selector} ${content}
249
+ `;
250
+ return body;
251
+ }
252
+ };
253
+
254
+ // src/tokens/process/formats/css.ts
255
+ var formats = {
256
+ colorScheme,
257
+ colorCategory,
258
+ semantic,
259
+ typography
260
+ };
261
+
262
+ // src/tokens/process/transformers.ts
263
+ import { checkAndEvaluateMath } from "@tokens-studio/sd-transforms";
264
+ import * as R4 from "ramda";
265
+ var isPx = R4.test(/\b\d+px\b/g);
266
+ var sizeRem = {
267
+ name: "ds/size/toRem",
268
+ type: "value",
269
+ transitive: true,
270
+ filter: (token) => {
271
+ const hasWantedType = typeEquals(["dimension", "fontsize"], token);
272
+ const hasWantedPath = pathStartsWithOneOf(["spacing", "sizing", "border-radius", "font-size"], token);
273
+ return hasWantedType && hasWantedPath;
274
+ },
275
+ transform: (token, config) => {
276
+ const value = getValue(token);
277
+ if (isPx(value)) {
278
+ const baseFont = config.basePxFontSize || 16;
279
+ const size = parseInt(value);
280
+ if (size === 0) {
281
+ return "0";
282
+ }
283
+ return `${size / baseFont}rem`;
284
+ }
285
+ return value;
286
+ }
287
+ };
288
+ var typographyName = {
289
+ name: "name/typography",
290
+ type: "name",
291
+ transitive: true,
292
+ // expanded tokens have different type so we match on path instead
293
+ filter: (token) => pathStartsWithOneOf(["typography"], token),
294
+ transform: (token) => {
295
+ return token.name.replace("-typography", "");
296
+ }
297
+ };
298
+ var resolveMath = {
299
+ name: "ds/resolveMath",
300
+ type: "value",
301
+ transitive: true,
302
+ filter: (token) => {
303
+ const isValidValue = ["string", "object"].includes(typeof getValue(token));
304
+ const isTokenOfInterest = !pathStartsWithOneOf(["border-radius"], token);
305
+ return isValidValue && isTokenOfInterest;
306
+ },
307
+ transform: (token, platformCfg) => checkAndEvaluateMath(token, platformCfg.mathFractionDigits)
308
+ };
309
+ var unitless = {
310
+ name: "ds/unitless",
311
+ type: "value",
312
+ transitive: true,
313
+ filter: (token) => pathStartsWithOneOf(["size", "_size"], token),
314
+ transform: (token) => parseInt(getValue(token))
315
+ };
316
+
317
+ // src/tokens/process/configs/shared.ts
318
+ var prefix = "ds";
319
+ var basePxFontSize = 16;
320
+ var dsTransformers = [
321
+ "name/kebab",
322
+ resolveMath.name,
323
+ "ts/size/px",
324
+ sizeRem.name,
325
+ unitless.name,
326
+ "ts/typography/fontWeight",
327
+ typographyName.name,
328
+ "ts/color/modifiers",
329
+ "ts/color/css/hexrgba",
330
+ "ts/size/lineheight",
331
+ "shadow/css/shorthand"
332
+ ];
333
+
334
+ // src/tokens/process/configs/color.ts
335
+ var colorSchemeVariables = ({ "color-scheme": colorScheme2 = "light", theme }) => {
336
+ const selector = `${colorScheme2 === "light" ? ":root, " : ""}[data-color-scheme="${colorScheme2}"]`;
337
+ const layer = `ds.theme.color-scheme.${colorScheme2}`;
338
+ return {
339
+ preprocessors: ["tokens-studio"],
340
+ platforms: {
341
+ css: {
342
+ // custom
343
+ colorScheme: colorScheme2,
344
+ theme,
345
+ selector,
346
+ layer,
347
+ //
348
+ prefix,
349
+ buildPath: `${theme}/`,
350
+ transforms: dsTransformers,
351
+ files: [
352
+ {
353
+ destination: `color-scheme/${colorScheme2}.css`,
354
+ format: formats.colorScheme.name,
355
+ filter: (token) => typeEquals("color", token) && !R5.startsWith(["global"], token.path)
356
+ }
357
+ ],
358
+ options: {
359
+ outputReferences: false
360
+ }
361
+ }
362
+ }
363
+ };
364
+ };
365
+ var colorCategoryVariables = (opts) => ({ "color-scheme": colorScheme2, theme, ...permutation }) => {
366
+ const category = opts.category;
367
+ const color = category === "builtin" ? opts.color : permutation[`${category}-color`];
368
+ if (!color) {
369
+ throw new Error(
370
+ category === "builtin" ? `Missing color for built-in color ${opts.color}` : `Missing color for category ${category}`
371
+ );
372
+ }
373
+ const layer = `ds.theme.color`;
374
+ const isRootColor = color === buildOptions?.defaultColor;
375
+ const selector = isRootColor ? `:root, [data-color-scheme], [data-color="${color}"]` : `[data-color="${color}"], [data-color-scheme][data-color="${color}"]`;
376
+ const config = {
377
+ preprocessors: ["tokens-studio"],
378
+ platforms: {
379
+ css: {
380
+ // custom
381
+ colorScheme: colorScheme2,
382
+ theme,
383
+ selector,
384
+ layer,
385
+ //
386
+ prefix,
387
+ buildPath: `${theme}/`,
388
+ transforms: dsTransformers,
389
+ files: [
390
+ {
391
+ destination: `color/${color}.css`,
392
+ format: formats.colorCategory.name,
393
+ filter: (token) => category === "builtin" ? isSemanticColorToken(token, color) : isColorCategoryToken(token, category)
394
+ }
395
+ ],
396
+ options: {
397
+ outputReferences: true
398
+ }
399
+ }
400
+ }
401
+ };
402
+ return config;
403
+ };
404
+
405
+ // src/tokens/process/configs/semantic.ts
406
+ import * as R6 from "ramda";
407
+ import { outputReferencesFilter } from "style-dictionary/utils";
408
+ var semanticVariables = ({ theme }) => {
409
+ const selector = `:root`;
410
+ const layer = `ds.theme.semantic`;
411
+ return {
412
+ preprocessors: ["tokens-studio"],
413
+ platforms: {
414
+ css: {
415
+ // custom
416
+ theme,
417
+ basePxFontSize,
418
+ selector,
419
+ layer,
420
+ //
421
+ prefix,
422
+ buildPath: `${theme}/`,
423
+ transforms: dsTransformers,
424
+ files: [
425
+ {
426
+ destination: `semantic.css`,
427
+ format: formats.semantic.name,
428
+ filter: (token) => {
429
+ const isUwantedToken = R6.anyPass([R6.includes("primitives/global")])(token.filePath);
430
+ const isPrivateToken = R6.includes("_", token.path);
431
+ const unwantedPaths = pathStartsWithOneOf(["font-size", "line-height", "letter-spacing"], token);
432
+ const unwantedTypes = typeEquals(["color", "fontWeight", "fontFamily", "typography"], token);
433
+ const unwantedTokens = !(unwantedPaths || unwantedTypes || isPrivateToken || isUwantedToken);
434
+ return unwantedTokens;
435
+ }
436
+ }
437
+ ],
438
+ options: {
439
+ outputReferences: (token, options) => {
440
+ const include = pathStartsWithOneOf(["border-radius"], token);
441
+ const isWantedSize = pathStartsWithOneOf(["size", "_size"], token) && isDigit(token.path[1]);
442
+ return (include || isWantedSize) && outputReferencesFilter(token, options);
443
+ }
444
+ }
445
+ }
446
+ }
447
+ };
448
+ };
449
+
450
+ // src/tokens/process/configs/typography.ts
451
+ import { expandTypesMap } from "@tokens-studio/sd-transforms";
452
+ var typographyVariables = ({ theme, typography: typography2 }) => {
453
+ const selector = `${typography2 === "primary" ? ":root, " : ""}[data-typography="${typography2}"]`;
454
+ const layer = `ds.theme.typography.${typography2}`;
455
+ return {
456
+ usesDtcg: true,
457
+ preprocessors: ["tokens-studio"],
458
+ expand: {
459
+ include: ["typography"],
460
+ typesMap: { ...expandTypesMap, typography: { ...expandTypesMap.typography, letterSpacing: "dimension" } }
461
+ },
462
+ platforms: {
463
+ css: {
464
+ prefix,
465
+ typography: typography2,
466
+ selector,
467
+ layer,
468
+ buildPath: `${theme}/`,
469
+ basePxFontSize,
470
+ transforms: [
471
+ "name/kebab",
472
+ "ts/size/px",
473
+ sizeRem.name,
474
+ "ts/size/lineheight",
475
+ "ts/typography/fontWeight",
476
+ "ts/size/css/letterspacing",
477
+ typographyName.name
478
+ ],
479
+ files: [
480
+ {
481
+ destination: `typography/${typography2}.css`,
482
+ format: formats.typography.name,
483
+ filter: (token) => {
484
+ const included = typeEquals(
485
+ ["typography", "fontweight", "fontFamily", "lineHeight", "dimension", "font", "fontsize"],
486
+ token
487
+ );
488
+ if (/primitives\/modes\/typography\/(primary|secondary)/.test(token.filePath)) return false;
489
+ return included && !pathStartsWithOneOf(["spacing", "sizing", "size", "_size", "border-width", "border-radius"], token);
490
+ }
491
+ }
492
+ ]
493
+ }
494
+ }
495
+ };
496
+ };
497
+
498
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js
499
+ var BoxShadowTypes;
500
+ (function(BoxShadowTypes2) {
501
+ BoxShadowTypes2["DROP_SHADOW"] = "dropShadow";
502
+ BoxShadowTypes2["INNER_SHADOW"] = "innerShadow";
503
+ })(BoxShadowTypes || (BoxShadowTypes = {}));
504
+
505
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js
506
+ var ColorModifierTypes;
507
+ (function(ColorModifierTypes2) {
508
+ ColorModifierTypes2["LIGHTEN"] = "lighten";
509
+ ColorModifierTypes2["DARKEN"] = "darken";
510
+ ColorModifierTypes2["MIX"] = "mix";
511
+ ColorModifierTypes2["ALPHA"] = "alpha";
512
+ })(ColorModifierTypes || (ColorModifierTypes = {}));
513
+
514
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js
515
+ var ColorSpaceTypes;
516
+ (function(ColorSpaceTypes2) {
517
+ ColorSpaceTypes2["LCH"] = "lch";
518
+ ColorSpaceTypes2["SRGB"] = "srgb";
519
+ ColorSpaceTypes2["P3"] = "p3";
520
+ ColorSpaceTypes2["HSL"] = "hsl";
521
+ })(ColorSpaceTypes || (ColorSpaceTypes = {}));
522
+
523
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/Properties.js
524
+ var Properties;
525
+ (function(Properties2) {
526
+ Properties2["sizing"] = "sizing";
527
+ Properties2["height"] = "height";
528
+ Properties2["width"] = "width";
529
+ Properties2["spacing"] = "spacing";
530
+ Properties2["verticalPadding"] = "verticalPadding";
531
+ Properties2["horizontalPadding"] = "horizontalPadding";
532
+ Properties2["paddingTop"] = "paddingTop";
533
+ Properties2["paddingRight"] = "paddingRight";
534
+ Properties2["paddingBottom"] = "paddingBottom";
535
+ Properties2["paddingLeft"] = "paddingLeft";
536
+ Properties2["itemSpacing"] = "itemSpacing";
537
+ Properties2["fill"] = "fill";
538
+ Properties2["backgroundBlur"] = "backgroundBlur";
539
+ Properties2["border"] = "border";
540
+ Properties2["borderTop"] = "borderTop";
541
+ Properties2["borderRight"] = "borderRight";
542
+ Properties2["borderBottom"] = "borderBottom";
543
+ Properties2["borderLeft"] = "borderLeft";
544
+ Properties2["borderColor"] = "borderColor";
545
+ Properties2["borderRadius"] = "borderRadius";
546
+ Properties2["borderRadiusTopLeft"] = "borderRadiusTopLeft";
547
+ Properties2["borderRadiusTopRight"] = "borderRadiusTopRight";
548
+ Properties2["borderRadiusBottomRight"] = "borderRadiusBottomRight";
549
+ Properties2["borderRadiusBottomLeft"] = "borderRadiusBottomLeft";
550
+ Properties2["borderWidth"] = "borderWidth";
551
+ Properties2["borderWidthTop"] = "borderWidthTop";
552
+ Properties2["borderWidthRight"] = "borderWidthRight";
553
+ Properties2["borderWidthBottom"] = "borderWidthBottom";
554
+ Properties2["borderWidthLeft"] = "borderWidthLeft";
555
+ Properties2["boxShadow"] = "boxShadow";
556
+ Properties2["opacity"] = "opacity";
557
+ Properties2["fontFamilies"] = "fontFamilies";
558
+ Properties2["fontWeights"] = "fontWeights";
559
+ Properties2["fontSizes"] = "fontSizes";
560
+ Properties2["lineHeights"] = "lineHeights";
561
+ Properties2["typography"] = "typography";
562
+ Properties2["composition"] = "composition";
563
+ Properties2["letterSpacing"] = "letterSpacing";
564
+ Properties2["paragraphSpacing"] = "paragraphSpacing";
565
+ Properties2["textCase"] = "textCase";
566
+ Properties2["dimension"] = "dimension";
567
+ Properties2["textDecoration"] = "textDecoration";
568
+ Properties2["asset"] = "asset";
569
+ Properties2["tokenValue"] = "tokenValue";
570
+ Properties2["value"] = "value";
571
+ Properties2["tokenName"] = "tokenName";
572
+ Properties2["description"] = "description";
573
+ })(Properties || (Properties = {}));
574
+
575
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js
576
+ var TokenSetStatus;
577
+ (function(TokenSetStatus2) {
578
+ TokenSetStatus2["DISABLED"] = "disabled";
579
+ TokenSetStatus2["SOURCE"] = "source";
580
+ TokenSetStatus2["ENABLED"] = "enabled";
581
+ })(TokenSetStatus || (TokenSetStatus = {}));
582
+
583
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenTypes.js
584
+ var TokenTypes;
585
+ (function(TokenTypes2) {
586
+ TokenTypes2["OTHER"] = "other";
587
+ TokenTypes2["COLOR"] = "color";
588
+ TokenTypes2["BORDER_RADIUS"] = "borderRadius";
589
+ TokenTypes2["SIZING"] = "sizing";
590
+ TokenTypes2["SPACING"] = "spacing";
591
+ TokenTypes2["TEXT"] = "text";
592
+ TokenTypes2["TYPOGRAPHY"] = "typography";
593
+ TokenTypes2["OPACITY"] = "opacity";
594
+ TokenTypes2["BORDER_WIDTH"] = "borderWidth";
595
+ TokenTypes2["STROKE_STYLE"] = "strokeStyle";
596
+ TokenTypes2["BOX_SHADOW"] = "boxShadow";
597
+ TokenTypes2["FONT_FAMILIES"] = "fontFamilies";
598
+ TokenTypes2["FONT_WEIGHTS"] = "fontWeights";
599
+ TokenTypes2["LINE_HEIGHTS"] = "lineHeights";
600
+ TokenTypes2["FONT_SIZES"] = "fontSizes";
601
+ TokenTypes2["LETTER_SPACING"] = "letterSpacing";
602
+ TokenTypes2["PARAGRAPH_SPACING"] = "paragraphSpacing";
603
+ TokenTypes2["PARAGRAPH_INDENT"] = "paragraphIndent";
604
+ TokenTypes2["TEXT_DECORATION"] = "textDecoration";
605
+ TokenTypes2["TEXT_CASE"] = "textCase";
606
+ TokenTypes2["COMPOSITION"] = "composition";
607
+ TokenTypes2["DIMENSION"] = "dimension";
608
+ TokenTypes2["BORDER"] = "border";
609
+ TokenTypes2["ASSET"] = "asset";
610
+ TokenTypes2["BOOLEAN"] = "boolean";
611
+ TokenTypes2["NUMBER"] = "number";
612
+ })(TokenTypes || (TokenTypes = {}));
613
+
614
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BorderValues.js
615
+ var BorderValues;
616
+ (function(BorderValues2) {
617
+ BorderValues2["BORDER_COLOR"] = "color";
618
+ BorderValues2["BORDER_WIDTH"] = "width";
619
+ BorderValues2["BORDER_STYLE"] = "style";
620
+ })(BorderValues || (BorderValues = {}));
621
+
622
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js
623
+ var StrokeStyleValues;
624
+ (function(StrokeStyleValues2) {
625
+ StrokeStyleValues2["SOLID"] = "solid";
626
+ StrokeStyleValues2["DASHED"] = "dashed";
627
+ StrokeStyleValues2["DOTTED"] = "dotted";
628
+ StrokeStyleValues2["DOUBLE"] = "double";
629
+ StrokeStyleValues2["GROOVE"] = "groove";
630
+ StrokeStyleValues2["RIDGE"] = "ridge";
631
+ StrokeStyleValues2["OUTSET"] = "outset";
632
+ StrokeStyleValues2["INSET"] = "inset";
633
+ })(StrokeStyleValues || (StrokeStyleValues = {}));
634
+
635
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js
636
+ var BoxShadowValues;
637
+ (function(BoxShadowValues2) {
638
+ BoxShadowValues2["TYPE"] = "type";
639
+ BoxShadowValues2["COLOR"] = "color";
640
+ BoxShadowValues2["X"] = "x";
641
+ BoxShadowValues2["Y"] = "y";
642
+ BoxShadowValues2["BLUR"] = "blur";
643
+ BoxShadowValues2["SPREAD"] = "spread";
644
+ BoxShadowValues2["BLEND_MODE"] = "blendMode";
645
+ })(BoxShadowValues || (BoxShadowValues = {}));
646
+
647
+ // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TypographyValues.js
648
+ var TypographyValues;
649
+ (function(TypographyValues2) {
650
+ TypographyValues2["FONT_FAMILY"] = "fontFamily";
651
+ TypographyValues2["FONT_WEIGHT"] = "fontWeight";
652
+ TypographyValues2["LINE_HEIGHT"] = "lineHeight";
653
+ TypographyValues2["FONT_SIZE"] = "fontSize";
654
+ TypographyValues2["LETTER_SPACING"] = "letterSpacing";
655
+ TypographyValues2["PARAGRAPH_SPACING"] = "paragraphSpacing";
656
+ TypographyValues2["PARAGRAPH_INDENT"] = "paragraphIndent";
657
+ TypographyValues2["TEXT_DECORATION"] = "textDecoration";
658
+ TypographyValues2["TEXT_CASE"] = "textCase";
659
+ })(TypographyValues || (TypographyValues = {}));
660
+
661
+ // src/tokens/process/utils/getMultidimensionalThemes.ts
662
+ import chalk from "chalk";
663
+ import { kebabCase } from "change-case";
664
+ import * as R7 from "ramda";
665
+ var processed = Symbol("Type brand for ProcessedThemeObject");
666
+ var hasUnknownProps = R7.pipe(R7.values, R7.none(R7.equals("unknown")), R7.not);
667
+
668
+ // src/tokens/process/configs.ts
669
+ void register(StyleDictionary, { withSDBuiltins: false });
670
+ StyleDictionary.registerTransform(sizeRem);
671
+ StyleDictionary.registerTransform(typographyName);
672
+ StyleDictionary.registerTransform(resolveMath);
673
+ StyleDictionary.registerTransform(unitless);
674
+ for (const format of Object.values(formats)) {
675
+ StyleDictionary.registerFormat(format);
676
+ }
677
+ var configs = {
678
+ colorSchemeVariables,
679
+ mainColorVariables: colorCategoryVariables({ category: "main" }),
680
+ supportColorVariables: colorCategoryVariables({ category: "support" }),
681
+ neutralColorVariables: colorCategoryVariables({ category: "builtin", color: "neutral" }),
682
+ successColorVariables: colorCategoryVariables({ category: "builtin", color: "success" }),
683
+ dangerColorVariables: colorCategoryVariables({ category: "builtin", color: "danger" }),
684
+ warningColorVariables: colorCategoryVariables({ category: "builtin", color: "warning" }),
685
+ infoColorVariables: colorCategoryVariables({ category: "builtin", color: "info" }),
686
+ typographyVariables,
687
+ semanticVariables
688
+ };
689
+
690
+ // src/tokens/process/platform.ts
691
+ var buildOptions = {
692
+ verbose: false,
693
+ processed$themes: [],
694
+ buildTokenFormats: {}
695
+ };
696
+ var sd = new StyleDictionary2();
697
+ var buildConfigs = {
698
+ typography: { getConfig: configs.typographyVariables, dimensions: ["typography"] },
699
+ "color-scheme": { getConfig: configs.colorSchemeVariables, dimensions: ["color-scheme"] },
700
+ "main-color": { getConfig: configs.mainColorVariables, dimensions: ["main-color"] },
701
+ "support-color": { getConfig: configs.supportColorVariables, dimensions: ["support-color"] },
702
+ "neutral-color": {
703
+ getConfig: configs.neutralColorVariables,
704
+ dimensions: ["semantic"],
705
+ log: ({ permutation: { theme } }) => `${theme} - neutral`
706
+ },
707
+ "success-color": {
708
+ getConfig: configs.successColorVariables,
709
+ dimensions: ["semantic"],
710
+ log: ({ permutation: { theme } }) => `${theme} - success`
711
+ },
712
+ "danger-color": {
713
+ getConfig: configs.dangerColorVariables,
714
+ dimensions: ["semantic"],
715
+ log: ({ permutation: { theme } }) => `${theme} - danger`
716
+ },
717
+ "warning-color": {
718
+ getConfig: configs.warningColorVariables,
719
+ dimensions: ["semantic"],
720
+ log: ({ permutation: { theme } }) => `${theme} - warning`
721
+ },
722
+ "info-color": {
723
+ getConfig: configs.infoColorVariables,
724
+ dimensions: ["semantic"],
725
+ log: ({ permutation: { theme } }) => `${theme} - info`
726
+ },
727
+ semantic: { getConfig: configs.semanticVariables, dimensions: ["semantic"] }
728
+ };
729
+
730
+ // src/tokens/process/formats/css/typography.ts
731
+ var typographyFontFamilyPredicate = R10.allPass([
732
+ R10.pathSatisfies(R10.includes("typography"), ["path"]),
733
+ R10.pathSatisfies(R10.includes("fontFamily"), ["path"])
7
734
  ]);
8
735
  var typography = {
9
736
  name: "ds/css-typography",
10
737
  format: async ({ dictionary, options, platform }) => {
11
738
  const { outputReferences, usesDtcg } = options;
12
- const { selector, layer } = platform;
13
- const format = createPropertyFormatter({
739
+ const { selector, layer, files } = platform;
740
+ const destination = files?.[0]?.destination;
741
+ const format = createPropertyFormatter3({
14
742
  outputReferences,
15
743
  dictionary,
16
744
  format: "css",
17
745
  usesDtcg
18
746
  });
19
- const filteredTokens = R.reject(typographyFontFamilyPredicate, dictionary.allTokens);
20
- const formattedTokens = R.pipe(R.map(format), R.join("\n"))(filteredTokens);
747
+ const filteredTokens = R10.reject(typographyFontFamilyPredicate, dictionary.allTokens);
748
+ const formattedMap = filteredTokens.map((token) => ({
749
+ token,
750
+ formatted: format(token)
751
+ }));
752
+ buildOptions.buildTokenFormats[destination] = formattedMap;
753
+ const formattedTokens = formattedMap.map(R10.view(R10.lensProp("formatted"))).join("\n");
21
754
  const content = selector ? `${selector} {
22
755
  ${formattedTokens}
23
756
  }` : formattedTokens;
24
- const body = R.isNotNil(layer) ? `@layer ${layer} {
757
+ const body = R10.isNotNil(layer) ? `@layer ${layer} {
25
758
  ${content}
26
759
  }` : content;
27
760
  return body;