@digdir/designsystemet 1.11.0 → 1.12.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 (100) hide show
  1. package/dist/bin/config.js +24 -4
  2. package/dist/bin/designsystemet.js +912 -1223
  3. package/dist/src/colors/index.js +27 -1
  4. package/dist/src/colors/types.d.ts +24 -21
  5. package/dist/src/colors/types.d.ts.map +1 -1
  6. package/dist/src/colors/types.js +27 -0
  7. package/dist/src/config.js +24 -4
  8. package/dist/src/index.js +818 -1122
  9. package/dist/src/scripts/createJsonSchema.js +24 -4
  10. package/dist/src/scripts/update-preview-tokens.d.ts.map +1 -1
  11. package/dist/src/scripts/update-preview-tokens.js +1363 -1667
  12. package/dist/src/tokens/build.js +7 -8
  13. package/dist/src/tokens/create/generators/$designsystemet.js +7 -8
  14. package/dist/src/tokens/create/generators/$metadata.d.ts +2 -2
  15. package/dist/src/tokens/create/generators/$metadata.d.ts.map +1 -1
  16. package/dist/src/tokens/create/generators/$metadata.js +3 -7
  17. package/dist/src/tokens/create/generators/$themes.d.ts +17 -2
  18. package/dist/src/tokens/create/generators/$themes.d.ts.map +1 -1
  19. package/dist/src/tokens/create/generators/$themes.js +3 -3
  20. package/dist/src/tokens/create/generators/primitives/color-scheme.d.ts +5 -0
  21. package/dist/src/tokens/create/generators/primitives/color-scheme.d.ts.map +1 -0
  22. package/dist/src/tokens/create/generators/{color.js → primitives/color-scheme.js} +29 -6
  23. package/dist/src/tokens/create/generators/primitives/globals.d.ts +3 -0
  24. package/dist/src/tokens/create/generators/primitives/globals.d.ts.map +1 -0
  25. package/dist/src/tokens/create/generators/primitives/globals.js +148 -0
  26. package/dist/src/tokens/create/generators/primitives/size.d.ts +4 -0
  27. package/dist/src/tokens/create/generators/primitives/size.d.ts.map +1 -0
  28. package/dist/src/tokens/create/generators/primitives/size.js +157 -0
  29. package/dist/src/tokens/create/generators/primitives/typography.d.ts +4 -0
  30. package/dist/src/tokens/create/generators/primitives/typography.d.ts.map +1 -0
  31. package/dist/src/tokens/create/generators/primitives/typography.js +220 -0
  32. package/dist/src/tokens/create/generators/semantic/color-modes.d.ts +8 -0
  33. package/dist/src/tokens/create/generators/semantic/color-modes.d.ts.map +1 -0
  34. package/dist/src/tokens/create/generators/semantic/color-modes.js +61 -0
  35. package/dist/src/tokens/create/generators/semantic/color.d.ts +5 -0
  36. package/dist/src/tokens/create/generators/semantic/color.d.ts.map +1 -0
  37. package/dist/src/tokens/create/generators/{semantic.js → semantic/color.js} +50 -194
  38. package/dist/src/tokens/create/generators/semantic/style.d.ts +3 -0
  39. package/dist/src/tokens/create/generators/semantic/style.d.ts.map +1 -0
  40. package/dist/src/tokens/create/generators/semantic/style.js +384 -0
  41. package/dist/src/tokens/create/generators/{theme.d.ts → themes/theme.d.ts} +1 -1
  42. package/dist/src/tokens/create/generators/themes/theme.d.ts.map +1 -0
  43. package/dist/src/tokens/create/generators/{theme.js → themes/theme.js} +87 -129
  44. package/dist/src/tokens/create/write.d.ts.map +1 -1
  45. package/dist/src/tokens/create/write.js +16 -20
  46. package/dist/src/tokens/create.d.ts +1 -1
  47. package/dist/src/tokens/create.d.ts.map +1 -1
  48. package/dist/src/tokens/create.js +1340 -1647
  49. package/dist/src/tokens/format.d.ts.map +1 -1
  50. package/dist/src/tokens/format.js +1363 -1670
  51. package/dist/src/tokens/index.js +1363 -1670
  52. package/dist/src/tokens/process/output/declarations.js +7 -8
  53. package/dist/src/tokens/process/output/theme.js +7 -8
  54. package/dist/src/tokens/types.d.ts +7 -0
  55. package/dist/src/tokens/types.d.ts.map +1 -1
  56. package/package.json +8 -9
  57. package/dist/color.base.template-Z7YWN2TF.json +0 -22
  58. package/dist/color.template-LMPUQ72A.json +0 -66
  59. package/dist/color.template-XQNSHLTU.json +0 -66
  60. package/dist/global-Y35YADVH.json +0 -100
  61. package/dist/globals-76VAFMDF.json +0 -143
  62. package/dist/large-CIIHO7AY.json +0 -96
  63. package/dist/large-UUOZ6DYI.json +0 -16
  64. package/dist/medium-OQ7S7P4P.json +0 -16
  65. package/dist/medium-VSB2S4X3.json +0 -96
  66. package/dist/small-AEXJ6U7Z.json +0 -96
  67. package/dist/small-ZY4KOJWX.json +0 -16
  68. package/dist/src/scripts/update-template.d.ts +0 -2
  69. package/dist/src/scripts/update-template.d.ts.map +0 -1
  70. package/dist/src/scripts/update-template.js +0 -1366
  71. package/dist/src/tokens/create/defaults.d.ts +0 -7
  72. package/dist/src/tokens/create/defaults.d.ts.map +0 -1
  73. package/dist/src/tokens/create/defaults.js +0 -998
  74. package/dist/src/tokens/create/generators/color.d.ts +0 -5
  75. package/dist/src/tokens/create/generators/color.d.ts.map +0 -1
  76. package/dist/src/tokens/create/generators/semantic.d.ts +0 -32
  77. package/dist/src/tokens/create/generators/semantic.d.ts.map +0 -1
  78. package/dist/src/tokens/create/generators/theme.d.ts.map +0 -1
  79. package/dist/src/tokens/create/generators/typography.d.ts +0 -3
  80. package/dist/src/tokens/create/generators/typography.d.ts.map +0 -1
  81. package/dist/src/tokens/create/generators/typography.js +0 -33
  82. package/dist/src/tokens/template/design-tokens/primitives/globals.js +0 -5
  83. package/dist/src/tokens/template/design-tokens/primitives/modes/size/global.js +0 -5
  84. package/dist/src/tokens/template/design-tokens/primitives/modes/size/large.js +0 -5
  85. package/dist/src/tokens/template/design-tokens/primitives/modes/size/medium.js +0 -5
  86. package/dist/src/tokens/template/design-tokens/primitives/modes/size/small.js +0 -5
  87. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/large.js +0 -5
  88. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/medium.js +0 -5
  89. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/small.js +0 -5
  90. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/typography.template.js +0 -5
  91. package/dist/src/tokens/template/design-tokens/semantic/color.base.template.js +0 -5
  92. package/dist/src/tokens/template/design-tokens/semantic/color.template.js +0 -5
  93. package/dist/src/tokens/template/design-tokens/semantic/modes/color.template.js +0 -5
  94. package/dist/src/tokens/template/design-tokens/semantic/style.js +0 -5
  95. package/dist/src/tokens/template/design-tokens/themes/theme.base.template.js +0 -5
  96. package/dist/src/tokens/template/design-tokens/themes/theme.template.js +0 -5
  97. package/dist/style-FP5XVCUD.json +0 -378
  98. package/dist/theme.base.template-Y4RMFBQY.json +0 -55
  99. package/dist/theme.template-CTQRNOMO.json +0 -66
  100. package/dist/typography.template-4N5YLH7F.json +0 -22
@@ -0,0 +1,220 @@
1
+ // src/tokens/create/generators/primitives/typography.ts
2
+ var generateTypography = (themeName, { fontFamily }) => ({
3
+ [themeName]: {
4
+ "font-family": {
5
+ $type: "fontFamilies",
6
+ $value: fontFamily
7
+ },
8
+ "font-weight": {
9
+ medium: {
10
+ $type: "fontWeights",
11
+ $value: "Medium"
12
+ },
13
+ semibold: {
14
+ $type: "fontWeights",
15
+ $value: "Semi bold"
16
+ },
17
+ regular: {
18
+ $type: "fontWeights",
19
+ $value: "Regular"
20
+ }
21
+ }
22
+ }
23
+ });
24
+ var generateFontSizes = (size) => fontSizes[size];
25
+ var lineHeights = {
26
+ sm: {
27
+ $type: "lineHeights",
28
+ $value: "130%"
29
+ },
30
+ md: {
31
+ $type: "lineHeights",
32
+ $value: "150%"
33
+ },
34
+ lg: {
35
+ $type: "lineHeights",
36
+ $value: "170%"
37
+ }
38
+ };
39
+ var letterSpacings = {
40
+ "1": {
41
+ $type: "letterSpacing",
42
+ $value: "-1%"
43
+ },
44
+ "2": {
45
+ $type: "letterSpacing",
46
+ $value: "-0.5%"
47
+ },
48
+ "3": {
49
+ $type: "letterSpacing",
50
+ $value: "-0.25%"
51
+ },
52
+ "4": {
53
+ $type: "letterSpacing",
54
+ $value: "-0.15%"
55
+ },
56
+ "5": {
57
+ $type: "letterSpacing",
58
+ $value: "0%"
59
+ },
60
+ "6": {
61
+ $type: "letterSpacing",
62
+ $value: "0.15%"
63
+ },
64
+ "7": {
65
+ $type: "letterSpacing",
66
+ $value: "0.25%"
67
+ },
68
+ "8": {
69
+ $type: "letterSpacing",
70
+ $value: "0.5%"
71
+ },
72
+ "9": {
73
+ $type: "letterSpacing",
74
+ $value: "1.5%"
75
+ }
76
+ };
77
+ var fontSizes = {
78
+ large: {
79
+ "line-height": lineHeights,
80
+ "font-size": {
81
+ "1": {
82
+ $type: "fontSizes",
83
+ $value: "13"
84
+ },
85
+ "2": {
86
+ $type: "fontSizes",
87
+ $value: "16"
88
+ },
89
+ "3": {
90
+ $type: "fontSizes",
91
+ $value: "18"
92
+ },
93
+ "4": {
94
+ $type: "fontSizes",
95
+ $value: "21"
96
+ },
97
+ "5": {
98
+ $type: "fontSizes",
99
+ $value: "24"
100
+ },
101
+ "6": {
102
+ $type: "fontSizes",
103
+ $value: "30"
104
+ },
105
+ "7": {
106
+ $type: "fontSizes",
107
+ $value: "36"
108
+ },
109
+ "8": {
110
+ $type: "fontSizes",
111
+ $value: "48"
112
+ },
113
+ "9": {
114
+ $type: "fontSizes",
115
+ $value: "60"
116
+ },
117
+ "10": {
118
+ $type: "fontSizes",
119
+ $value: "72"
120
+ }
121
+ },
122
+ "letter-spacing": letterSpacings
123
+ },
124
+ medium: {
125
+ "line-height": lineHeights,
126
+ "font-size": {
127
+ "1": {
128
+ $type: "fontSizes",
129
+ $value: "12"
130
+ },
131
+ "2": {
132
+ $type: "fontSizes",
133
+ $value: "14"
134
+ },
135
+ "3": {
136
+ $type: "fontSizes",
137
+ $value: "16"
138
+ },
139
+ "4": {
140
+ $type: "fontSizes",
141
+ $value: "18"
142
+ },
143
+ "5": {
144
+ $type: "fontSizes",
145
+ $value: "21"
146
+ },
147
+ "6": {
148
+ $type: "fontSizes",
149
+ $value: "24"
150
+ },
151
+ "7": {
152
+ $type: "fontSizes",
153
+ $value: "30"
154
+ },
155
+ "8": {
156
+ $type: "fontSizes",
157
+ $value: "36"
158
+ },
159
+ "9": {
160
+ $type: "fontSizes",
161
+ $value: "48"
162
+ },
163
+ "10": {
164
+ $type: "fontSizes",
165
+ $value: "60"
166
+ }
167
+ },
168
+ "letter-spacing": letterSpacings
169
+ },
170
+ small: {
171
+ "line-height": lineHeights,
172
+ "font-size": {
173
+ "1": {
174
+ $type: "fontSizes",
175
+ $value: "11"
176
+ },
177
+ "2": {
178
+ $type: "fontSizes",
179
+ $value: "13"
180
+ },
181
+ "3": {
182
+ $type: "fontSizes",
183
+ $value: "14"
184
+ },
185
+ "4": {
186
+ $type: "fontSizes",
187
+ $value: "16"
188
+ },
189
+ "5": {
190
+ $type: "fontSizes",
191
+ $value: "18"
192
+ },
193
+ "6": {
194
+ $type: "fontSizes",
195
+ $value: "21"
196
+ },
197
+ "7": {
198
+ $type: "fontSizes",
199
+ $value: "24"
200
+ },
201
+ "8": {
202
+ $type: "fontSizes",
203
+ $value: "30"
204
+ },
205
+ "9": {
206
+ $type: "fontSizes",
207
+ $value: "36"
208
+ },
209
+ "10": {
210
+ $type: "fontSizes",
211
+ $value: "48"
212
+ }
213
+ },
214
+ "letter-spacing": letterSpacings
215
+ }
216
+ };
217
+ export {
218
+ generateFontSizes,
219
+ generateTypography
220
+ };
@@ -0,0 +1,8 @@
1
+ import type { Colors, TokenSet } from '../../../types.js';
2
+ type SemanticModes = {
3
+ 'main-color': Record<string, TokenSet>;
4
+ 'support-color': Record<string, TokenSet>;
5
+ };
6
+ export declare const generateColorModes: (colors: Colors, _themeName: string) => SemanticModes;
7
+ export {};
8
+ //# sourceMappingURL=color-modes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-modes.d.ts","sourceRoot":"","sources":["../../../../../../src/tokens/create/generators/semantic/color-modes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAS,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEjE,KAAK,aAAa,GAAG;IACnB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACvC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,QAAQ,MAAM,EAAE,YAAY,MAAM,kBA4BpE,CAAC"}
@@ -0,0 +1,61 @@
1
+ // src/colors/types.ts
2
+ import * as R from "ramda";
3
+ var semanticColorMap = {
4
+ "background-default": 1,
5
+ "background-tinted": 2,
6
+ "surface-default": 3,
7
+ "surface-tinted": 4,
8
+ "surface-hover": 5,
9
+ "surface-active": 6,
10
+ "border-subtle": 7,
11
+ "border-default": 8,
12
+ "border-strong": 9,
13
+ "text-subtle": 10,
14
+ "text-default": 11,
15
+ "base-default": 12,
16
+ "base-hover": 13,
17
+ "base-active": 14,
18
+ "base-contrast-subtle": 15,
19
+ "base-contrast-default": 16
20
+ };
21
+ var semanticColorNames = R.keys(semanticColorMap);
22
+ var semanticColorNumbers = R.values(semanticColorMap);
23
+
24
+ // src/tokens/create/generators/semantic/color-modes.ts
25
+ var generateColorModes = (colors, _themeName) => {
26
+ const mainColorNames = Object.keys(colors.main);
27
+ const supportColorNames = Object.keys(colors.support);
28
+ const modes = {
29
+ "main-color": {},
30
+ "support-color": {}
31
+ };
32
+ const categories = [
33
+ ["main-color", mainColorNames],
34
+ ["support-color", supportColorNames]
35
+ ];
36
+ for (const [colorCategory, colorNames] of categories) {
37
+ for (const colorName of colorNames) {
38
+ const category = colorCategory.replace("-color", "");
39
+ const customColorTokens = {
40
+ color: {
41
+ [category]: generateColorScaleTokens(colorName)
42
+ }
43
+ };
44
+ modes[colorCategory][colorName] = customColorTokens;
45
+ }
46
+ }
47
+ return modes;
48
+ };
49
+ var generateColorScaleTokens = (colorName) => {
50
+ const colorScale = {};
51
+ for (const colorSemantic of semanticColorNames) {
52
+ colorScale[colorSemantic] = {
53
+ $type: "color",
54
+ $value: `{color.${colorName}.${colorSemantic}}`
55
+ };
56
+ }
57
+ return colorScale;
58
+ };
59
+ export {
60
+ generateColorModes
61
+ };
@@ -0,0 +1,5 @@
1
+ import type { Colors } from '../../../types.js';
2
+ export declare const generateSemanticColors: (colors: Colors, _themeName: string) => {
3
+ color: any;
4
+ };
5
+ //# sourceMappingURL=color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../../../../src/tokens/create/generators/semantic/color.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAmB,MAAM,mBAAmB,CAAC;AAEjE,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,EAAE,YAAY,MAAM;;CAiBxE,CAAC"}
@@ -1,5 +1,5 @@
1
- // src/tokens/create/generators/semantic.ts
2
- import * as R2 from "ramda";
1
+ // src/tokens/create/generators/semantic/color.ts
2
+ import * as R3 from "ramda";
3
3
 
4
4
  // src/colors/colorMetadata.ts
5
5
  import * as R from "ramda";
@@ -255,8 +255,45 @@ var colorMetadataByNumber = R.indexBy((metadata) => metadata.number, Object.valu
255
255
  var colorNames = Object.keys(colorMetadata);
256
256
  var baseColorNames = Object.keys(baseColors);
257
257
 
258
- // src/tokens/template/design-tokens/semantic/color.base.template.json with { type: 'json' }
259
- var color_base_template_default = {
258
+ // src/colors/types.ts
259
+ import * as R2 from "ramda";
260
+ var semanticColorMap = {
261
+ "background-default": 1,
262
+ "background-tinted": 2,
263
+ "surface-default": 3,
264
+ "surface-tinted": 4,
265
+ "surface-hover": 5,
266
+ "surface-active": 6,
267
+ "border-subtle": 7,
268
+ "border-default": 8,
269
+ "border-strong": 9,
270
+ "text-subtle": 10,
271
+ "text-default": 11,
272
+ "base-default": 12,
273
+ "base-hover": 13,
274
+ "base-active": 14,
275
+ "base-contrast-subtle": 15,
276
+ "base-contrast-default": 16
277
+ };
278
+ var semanticColorNames = R2.keys(semanticColorMap);
279
+ var semanticColorNumbers = R2.values(semanticColorMap);
280
+
281
+ // src/tokens/create/generators/semantic/color.ts
282
+ var generateSemanticColors = (colors, _themeName) => {
283
+ const mainColorNames = Object.keys(colors.main);
284
+ const supportColorNames = Object.keys(colors.support);
285
+ const customColors = [...mainColorNames, "neutral", ...supportColorNames];
286
+ const allColors = [...customColors, ...baseColorNames];
287
+ const semanticColorTokens = allColors.map((colorName) => [colorName, generateColorScaleTokens(colorName)]);
288
+ return {
289
+ ...baseColorTemplate,
290
+ color: {
291
+ ...Object.fromEntries(semanticColorTokens),
292
+ ...baseColorTemplate.color
293
+ }
294
+ };
295
+ };
296
+ var baseColorTemplate = {
260
297
  color: {
261
298
  focus: {
262
299
  inner: {
@@ -278,197 +315,16 @@ var color_base_template_default = {
278
315
  }
279
316
  }
280
317
  };
281
-
282
- // src/tokens/template/design-tokens/semantic/color.template.json with { type: 'json' }
283
- var color_template_default = {
284
- "background-default": {
285
- $type: "color",
286
- $value: "{color.<color>.1}"
287
- },
288
- "background-tinted": {
289
- $type: "color",
290
- $value: "{color.<color>.2}"
291
- },
292
- "surface-default": {
293
- $type: "color",
294
- $value: "{color.<color>.3}"
295
- },
296
- "surface-tinted": {
297
- $type: "color",
298
- $value: "{color.<color>.4}"
299
- },
300
- "surface-hover": {
301
- $type: "color",
302
- $value: "{color.<color>.5}"
303
- },
304
- "surface-active": {
305
- $type: "color",
306
- $value: "{color.<color>.6}"
307
- },
308
- "border-subtle": {
309
- $type: "color",
310
- $value: "{color.<color>.7}"
311
- },
312
- "border-default": {
313
- $type: "color",
314
- $value: "{color.<color>.8}"
315
- },
316
- "border-strong": {
317
- $type: "color",
318
- $value: "{color.<color>.9}"
319
- },
320
- "text-subtle": {
321
- $type: "color",
322
- $value: "{color.<color>.10}"
323
- },
324
- "text-default": {
325
- $type: "color",
326
- $value: "{color.<color>.11}"
327
- },
328
- "base-default": {
329
- $type: "color",
330
- $value: "{color.<color>.12}"
331
- },
332
- "base-hover": {
333
- $type: "color",
334
- $value: "{color.<color>.13}"
335
- },
336
- "base-active": {
337
- $type: "color",
338
- $value: "{color.<color>.14}"
339
- },
340
- "base-contrast-subtle": {
341
- $type: "color",
342
- $value: "{color.<color>.15}"
343
- },
344
- "base-contrast-default": {
345
- $type: "color",
346
- $value: "{color.<color>.16}"
318
+ var generateColorScaleTokens = (colorName) => {
319
+ const colorScale = {};
320
+ for (const [colorSemantic, colorNumber] of R3.toPairs(semanticColorMap)) {
321
+ colorScale[colorSemantic] = {
322
+ $type: "color",
323
+ $value: `{color.${colorName}.${colorNumber}}`
324
+ };
347
325
  }
348
- };
349
-
350
- // src/tokens/template/design-tokens/semantic/modes/color.template.json with { type: 'json' }
351
- var color_template_default2 = {
352
- "background-default": {
353
- $type: "color",
354
- $value: "{color.<color>.background-default}"
355
- },
356
- "background-tinted": {
357
- $type: "color",
358
- $value: "{color.<color>.background-tinted}"
359
- },
360
- "surface-default": {
361
- $type: "color",
362
- $value: "{color.<color>.surface-default}"
363
- },
364
- "surface-tinted": {
365
- $type: "color",
366
- $value: "{color.<color>.surface-tinted}"
367
- },
368
- "surface-hover": {
369
- $type: "color",
370
- $value: "{color.<color>.surface-hover}"
371
- },
372
- "surface-active": {
373
- $type: "color",
374
- $value: "{color.<color>.surface-active}"
375
- },
376
- "border-subtle": {
377
- $type: "color",
378
- $value: "{color.<color>.border-subtle}"
379
- },
380
- "border-default": {
381
- $type: "color",
382
- $value: "{color.<color>.border-default}"
383
- },
384
- "border-strong": {
385
- $type: "color",
386
- $value: "{color.<color>.border-strong}"
387
- },
388
- "text-subtle": {
389
- $type: "color",
390
- $value: "{color.<color>.text-subtle}"
391
- },
392
- "text-default": {
393
- $type: "color",
394
- $value: "{color.<color>.text-default}"
395
- },
396
- "base-default": {
397
- $type: "color",
398
- $value: "{color.<color>.base-default}"
399
- },
400
- "base-hover": {
401
- $type: "color",
402
- $value: "{color.<color>.base-hover}"
403
- },
404
- "base-active": {
405
- $type: "color",
406
- $value: "{color.<color>.base-active}"
407
- },
408
- "base-contrast-subtle": {
409
- $type: "color",
410
- $value: "{color.<color>.base-contrast-subtle}"
411
- },
412
- "base-contrast-default": {
413
- $type: "color",
414
- $value: "{color.<color>.base-contrast-default}"
415
- }
416
- };
417
-
418
- // src/tokens/create/generators/semantic.ts
419
- var generateSemantic = (colors, _themeName) => {
420
- const mainColorNames = Object.keys(colors.main);
421
- const supportColorNames = Object.keys(colors.support);
422
- const modes = {
423
- "main-color": {},
424
- "support-color": {}
425
- };
426
- const categories = [
427
- ["main-color", mainColorNames],
428
- ["support-color", supportColorNames]
429
- ];
430
- for (const [colorCategory, colorNames2] of categories) {
431
- for (const colorName of colorNames2) {
432
- const category = colorCategory.replace("-color", "");
433
- const customColorTokens = {
434
- color: {
435
- [category]: JSON.parse(
436
- JSON.stringify(
437
- color_template_default2,
438
- (key, value) => {
439
- if (key === "$value") {
440
- return value.replace("<color>", colorName);
441
- }
442
- return value;
443
- },
444
- 2
445
- )
446
- )
447
- }
448
- };
449
- modes[colorCategory][colorName] = customColorTokens;
450
- }
451
- }
452
- const customColors = [...mainColorNames, "neutral", ...supportColorNames];
453
- const allColors = [...customColors, ...baseColorNames];
454
- const semanticColorTokens = allColors.map(
455
- (colorName) => [
456
- colorName,
457
- R2.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), color_template_default)
458
- ]
459
- );
460
- const color = {
461
- ...color_base_template_default,
462
- color: {
463
- ...Object.fromEntries(semanticColorTokens),
464
- ...color_base_template_default.color
465
- }
466
- };
467
- return {
468
- modes,
469
- color
470
- };
326
+ return colorScale;
471
327
  };
472
328
  export {
473
- generateSemantic
329
+ generateSemanticColors
474
330
  };
@@ -0,0 +1,3 @@
1
+ import type { TokenSet } from '../../../types.js';
2
+ export declare function generateSemanticStyle(): TokenSet;
3
+ //# sourceMappingURL=style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../../../src/tokens/create/generators/semantic/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEzD,wBAAgB,qBAAqB,IAAI,QAAQ,CA2XhD"}