@digdir/designsystemet 1.13.2 → 1.14.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 (89) hide show
  1. package/dist/bin/config.js +50 -658
  2. package/dist/bin/designsystemet.d.ts.map +1 -1
  3. package/dist/bin/designsystemet.js +136 -4623
  4. package/dist/bin/options.js +22 -14
  5. package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BorderValues.js +9 -0
  6. package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js +8 -0
  7. package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js +13 -0
  8. package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js +10 -0
  9. package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js +10 -0
  10. package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/Properties.js +53 -0
  11. package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js +14 -0
  12. package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js +9 -0
  13. package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenTypes.js +32 -0
  14. package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TypographyValues.js +15 -0
  15. package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/types/index.js +11 -0
  16. package/dist/package.js +5 -0
  17. package/dist/src/colors/colorMetadata.js +255 -261
  18. package/dist/src/colors/index.js +5 -522
  19. package/dist/src/colors/theme.js +104 -343
  20. package/dist/src/colors/types.js +22 -25
  21. package/dist/src/colors/utils.js +241 -154
  22. package/dist/src/config.js +103 -444
  23. package/dist/src/index.js +10 -3588
  24. package/dist/src/migrations/beta-to-v1.js +339 -537
  25. package/dist/src/migrations/codemods/css/plugins.js +31 -42
  26. package/dist/src/migrations/codemods/css/run.js +20 -151
  27. package/dist/src/migrations/color-rename-next49.js +44 -220
  28. package/dist/src/migrations/index.js +7 -577
  29. package/dist/src/scripts/update-preview-tokens.d.ts.map +1 -1
  30. package/dist/src/tokens/build.js +39 -1816
  31. package/dist/src/tokens/create/files.d.ts +10 -5
  32. package/dist/src/tokens/create/files.d.ts.map +1 -1
  33. package/dist/src/tokens/create/files.js +44 -601
  34. package/dist/src/tokens/create/generators/$designsystemet.js +8 -97
  35. package/dist/src/tokens/create/generators/$metadata.d.ts +7 -3
  36. package/dist/src/tokens/create/generators/$metadata.d.ts.map +1 -1
  37. package/dist/src/tokens/create/generators/$metadata.js +24 -21
  38. package/dist/src/tokens/create/generators/$themes.d.ts +2 -4
  39. package/dist/src/tokens/create/generators/$themes.d.ts.map +1 -1
  40. package/dist/src/tokens/create/generators/$themes.js +139 -312
  41. package/dist/src/tokens/create/generators/primitives/color-scheme.js +68 -443
  42. package/dist/src/tokens/create/generators/primitives/globals.js +141 -147
  43. package/dist/src/tokens/create/generators/primitives/size.js +146 -156
  44. package/dist/src/tokens/create/generators/primitives/typography.js +213 -217
  45. package/dist/src/tokens/create/generators/semantic/color-modes.js +24 -59
  46. package/dist/src/tokens/create/generators/semantic/color.js +42 -326
  47. package/dist/src/tokens/create/generators/semantic/style.js +379 -382
  48. package/dist/src/tokens/create/generators/themes/theme.js +108 -392
  49. package/dist/src/tokens/create.d.ts +2 -1
  50. package/dist/src/tokens/create.d.ts.map +1 -1
  51. package/dist/src/tokens/create.js +50 -1591
  52. package/dist/src/tokens/format.d.ts.map +1 -1
  53. package/dist/src/tokens/format.js +35 -3324
  54. package/dist/src/tokens/generate-config.js +155 -298
  55. package/dist/src/tokens/index.js +3 -3344
  56. package/dist/src/tokens/process/configs/color.js +50 -1085
  57. package/dist/src/tokens/process/configs/semantic.js +45 -1083
  58. package/dist/src/tokens/process/configs/shared.js +18 -109
  59. package/dist/src/tokens/process/configs/size-mode.js +27 -1082
  60. package/dist/src/tokens/process/configs/size.js +32 -1083
  61. package/dist/src/tokens/process/configs/type-scale.js +49 -1083
  62. package/dist/src/tokens/process/configs/typography.js +63 -1084
  63. package/dist/src/tokens/process/configs.js +91 -1224
  64. package/dist/src/tokens/process/formats/css/color.js +58 -1079
  65. package/dist/src/tokens/process/formats/css/semantic.js +27 -1081
  66. package/dist/src/tokens/process/formats/css/size-mode.js +43 -1077
  67. package/dist/src/tokens/process/formats/css/size.js +86 -1079
  68. package/dist/src/tokens/process/formats/css/type-scale.js +53 -1083
  69. package/dist/src/tokens/process/formats/css/typography.js +27 -1081
  70. package/dist/src/tokens/process/formats/css.js +18 -1081
  71. package/dist/src/tokens/process/output/declarations.js +18 -1201
  72. package/dist/src/tokens/process/output/tailwind.js +26 -40
  73. package/dist/src/tokens/process/output/theme.js +73 -206
  74. package/dist/src/tokens/process/platform.js +165 -1355
  75. package/dist/src/tokens/process/transformers.js +49 -89
  76. package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +100 -1183
  77. package/dist/src/tokens/process/utils/kebab-case.js +7 -5
  78. package/dist/src/tokens/types.d.ts +6 -0
  79. package/dist/src/tokens/types.d.ts.map +1 -1
  80. package/dist/src/tokens/types.js +6 -7
  81. package/dist/src/tokens/utils.d.ts +2 -1
  82. package/dist/src/tokens/utils.d.ts.map +1 -1
  83. package/dist/src/tokens/utils.js +107 -93
  84. package/dist/src/types.js +1 -5
  85. package/dist/src/utils/filesystem.js +112 -124
  86. package/package.json +12 -15
  87. package/configs/test-tokens.config.json +0 -82
  88. package/dist/src/scripts/createJsonSchema.js +0 -409
  89. package/dist/src/scripts/update-preview-tokens.js +0 -3353
@@ -1,332 +1,159 @@
1
- // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js
2
- var BoxShadowTypes;
3
- (function(BoxShadowTypes2) {
4
- BoxShadowTypes2["DROP_SHADOW"] = "dropShadow";
5
- BoxShadowTypes2["INNER_SHADOW"] = "innerShadow";
6
- })(BoxShadowTypes || (BoxShadowTypes = {}));
7
-
8
- // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js
9
- var ColorModifierTypes;
10
- (function(ColorModifierTypes2) {
11
- ColorModifierTypes2["LIGHTEN"] = "lighten";
12
- ColorModifierTypes2["DARKEN"] = "darken";
13
- ColorModifierTypes2["MIX"] = "mix";
14
- ColorModifierTypes2["ALPHA"] = "alpha";
15
- })(ColorModifierTypes || (ColorModifierTypes = {}));
16
-
17
- // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js
18
- var ColorSpaceTypes;
19
- (function(ColorSpaceTypes2) {
20
- ColorSpaceTypes2["LCH"] = "lch";
21
- ColorSpaceTypes2["SRGB"] = "srgb";
22
- ColorSpaceTypes2["P3"] = "p3";
23
- ColorSpaceTypes2["HSL"] = "hsl";
24
- })(ColorSpaceTypes || (ColorSpaceTypes = {}));
25
-
26
- // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/Properties.js
27
- var Properties;
28
- (function(Properties2) {
29
- Properties2["sizing"] = "sizing";
30
- Properties2["height"] = "height";
31
- Properties2["width"] = "width";
32
- Properties2["spacing"] = "spacing";
33
- Properties2["verticalPadding"] = "verticalPadding";
34
- Properties2["horizontalPadding"] = "horizontalPadding";
35
- Properties2["paddingTop"] = "paddingTop";
36
- Properties2["paddingRight"] = "paddingRight";
37
- Properties2["paddingBottom"] = "paddingBottom";
38
- Properties2["paddingLeft"] = "paddingLeft";
39
- Properties2["itemSpacing"] = "itemSpacing";
40
- Properties2["fill"] = "fill";
41
- Properties2["backgroundBlur"] = "backgroundBlur";
42
- Properties2["border"] = "border";
43
- Properties2["borderTop"] = "borderTop";
44
- Properties2["borderRight"] = "borderRight";
45
- Properties2["borderBottom"] = "borderBottom";
46
- Properties2["borderLeft"] = "borderLeft";
47
- Properties2["borderColor"] = "borderColor";
48
- Properties2["borderRadius"] = "borderRadius";
49
- Properties2["borderRadiusTopLeft"] = "borderRadiusTopLeft";
50
- Properties2["borderRadiusTopRight"] = "borderRadiusTopRight";
51
- Properties2["borderRadiusBottomRight"] = "borderRadiusBottomRight";
52
- Properties2["borderRadiusBottomLeft"] = "borderRadiusBottomLeft";
53
- Properties2["borderWidth"] = "borderWidth";
54
- Properties2["borderWidthTop"] = "borderWidthTop";
55
- Properties2["borderWidthRight"] = "borderWidthRight";
56
- Properties2["borderWidthBottom"] = "borderWidthBottom";
57
- Properties2["borderWidthLeft"] = "borderWidthLeft";
58
- Properties2["boxShadow"] = "boxShadow";
59
- Properties2["opacity"] = "opacity";
60
- Properties2["fontFamilies"] = "fontFamilies";
61
- Properties2["fontWeights"] = "fontWeights";
62
- Properties2["fontSizes"] = "fontSizes";
63
- Properties2["lineHeights"] = "lineHeights";
64
- Properties2["typography"] = "typography";
65
- Properties2["composition"] = "composition";
66
- Properties2["letterSpacing"] = "letterSpacing";
67
- Properties2["paragraphSpacing"] = "paragraphSpacing";
68
- Properties2["textCase"] = "textCase";
69
- Properties2["dimension"] = "dimension";
70
- Properties2["textDecoration"] = "textDecoration";
71
- Properties2["asset"] = "asset";
72
- Properties2["tokenValue"] = "tokenValue";
73
- Properties2["value"] = "value";
74
- Properties2["tokenName"] = "tokenName";
75
- Properties2["description"] = "description";
76
- })(Properties || (Properties = {}));
77
-
78
- // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js
79
- var TokenSetStatus;
80
- (function(TokenSetStatus2) {
81
- TokenSetStatus2["DISABLED"] = "disabled";
82
- TokenSetStatus2["SOURCE"] = "source";
83
- TokenSetStatus2["ENABLED"] = "enabled";
84
- })(TokenSetStatus || (TokenSetStatus = {}));
1
+ import { TokenSetStatus } from "../../../../node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js";
2
+ import "../../../../node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/types/index.js";
3
+ //#region src/tokens/create/generators/$themes.ts
4
+ const capitalize = (word) => word.charAt(0).toUpperCase() + word.slice(1);
5
+ async function createHash(text, algo = "SHA-1") {
6
+ const crypto = globalThis.crypto;
7
+ return Array.from(new Uint8Array(await crypto.subtle.digest(algo, new TextEncoder().encode(text))), (byte) => byte.toString(16).padStart(2, "0")).join("");
8
+ }
9
+ /**
85
10
 
86
- // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenTypes.js
87
- var TokenTypes;
88
- (function(TokenTypes2) {
89
- TokenTypes2["OTHER"] = "other";
90
- TokenTypes2["COLOR"] = "color";
91
- TokenTypes2["BORDER_RADIUS"] = "borderRadius";
92
- TokenTypes2["SIZING"] = "sizing";
93
- TokenTypes2["SPACING"] = "spacing";
94
- TokenTypes2["TEXT"] = "text";
95
- TokenTypes2["TYPOGRAPHY"] = "typography";
96
- TokenTypes2["OPACITY"] = "opacity";
97
- TokenTypes2["BORDER_WIDTH"] = "borderWidth";
98
- TokenTypes2["STROKE_STYLE"] = "strokeStyle";
99
- TokenTypes2["BOX_SHADOW"] = "boxShadow";
100
- TokenTypes2["FONT_FAMILIES"] = "fontFamilies";
101
- TokenTypes2["FONT_WEIGHTS"] = "fontWeights";
102
- TokenTypes2["LINE_HEIGHTS"] = "lineHeights";
103
- TokenTypes2["FONT_SIZES"] = "fontSizes";
104
- TokenTypes2["LETTER_SPACING"] = "letterSpacing";
105
- TokenTypes2["PARAGRAPH_SPACING"] = "paragraphSpacing";
106
- TokenTypes2["PARAGRAPH_INDENT"] = "paragraphIndent";
107
- TokenTypes2["TEXT_DECORATION"] = "textDecoration";
108
- TokenTypes2["TEXT_CASE"] = "textCase";
109
- TokenTypes2["COMPOSITION"] = "composition";
110
- TokenTypes2["DIMENSION"] = "dimension";
111
- TokenTypes2["BORDER"] = "border";
112
- TokenTypes2["ASSET"] = "asset";
113
- TokenTypes2["BOOLEAN"] = "boolean";
114
- TokenTypes2["NUMBER"] = "number";
115
- })(TokenTypes || (TokenTypes = {}));
11
+ * Generates the `$themes.json` file which is used by Token Studio to update Figma variable collections and modes.
116
12
 
117
- // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BorderValues.js
118
- var BorderValues;
119
- (function(BorderValues2) {
120
- BorderValues2["BORDER_COLOR"] = "color";
121
- BorderValues2["BORDER_WIDTH"] = "width";
122
- BorderValues2["BORDER_STYLE"] = "style";
123
- })(BorderValues || (BorderValues = {}));
13
+ * **IMPORTANT:**
124
14
 
125
- // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js
126
- var StrokeStyleValues;
127
- (function(StrokeStyleValues2) {
128
- StrokeStyleValues2["SOLID"] = "solid";
129
- StrokeStyleValues2["DASHED"] = "dashed";
130
- StrokeStyleValues2["DOTTED"] = "dotted";
131
- StrokeStyleValues2["DOUBLE"] = "double";
132
- StrokeStyleValues2["GROOVE"] = "groove";
133
- StrokeStyleValues2["RIDGE"] = "ridge";
134
- StrokeStyleValues2["OUTSET"] = "outset";
135
- StrokeStyleValues2["INSET"] = "inset";
136
- })(StrokeStyleValues || (StrokeStyleValues = {}));
15
+ * We use existing Figma variable ids to update existing collections/modes fetched from our published Figma community file.
137
16
 
138
- // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js
139
- var BoxShadowValues;
140
- (function(BoxShadowValues2) {
141
- BoxShadowValues2["TYPE"] = "type";
142
- BoxShadowValues2["COLOR"] = "color";
143
- BoxShadowValues2["X"] = "x";
144
- BoxShadowValues2["Y"] = "y";
145
- BoxShadowValues2["BLUR"] = "blur";
146
- BoxShadowValues2["SPREAD"] = "spread";
147
- BoxShadowValues2["BLEND_MODE"] = "blendMode";
148
- })(BoxShadowValues || (BoxShadowValues = {}));
17
+ * These are important for maintaining existing variables in user files when updating tokens.
149
18
 
150
- // ../../node_modules/.pnpm/@tokens-studio+types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TypographyValues.js
151
- var TypographyValues;
152
- (function(TypographyValues2) {
153
- TypographyValues2["FONT_FAMILY"] = "fontFamily";
154
- TypographyValues2["FONT_WEIGHT"] = "fontWeight";
155
- TypographyValues2["LINE_HEIGHT"] = "lineHeight";
156
- TypographyValues2["FONT_SIZE"] = "fontSize";
157
- TypographyValues2["LETTER_SPACING"] = "letterSpacing";
158
- TypographyValues2["PARAGRAPH_SPACING"] = "paragraphSpacing";
159
- TypographyValues2["PARAGRAPH_INDENT"] = "paragraphIndent";
160
- TypographyValues2["TEXT_DECORATION"] = "textDecoration";
161
- TypographyValues2["TEXT_CASE"] = "textCase";
162
- })(TypographyValues || (TypographyValues = {}));
19
+ * Omitting these ids results will result in the following bugs:
20
+ - New collections/modes being created which may cause ghost variables in Figma.
21
+ - New collections/modes may cause users hitting the cap on Figma variable modes which is at time of writing 4 (or unlimited for enterprise).
163
22
 
164
- // src/tokens/create/generators/$themes.ts
165
- var capitalize = (word) => word.charAt(0).toUpperCase() + word.slice(1);
166
- async function createHash(text, algo = "SHA-1") {
167
- const crypto = globalThis.crypto;
168
- return Array.from(
169
- new Uint8Array(await crypto.subtle.digest(algo, new TextEncoder().encode(text))),
170
- (byte) => byte.toString(16).padStart(2, "0")
171
- ).join("");
172
- }
173
- async function generate$Themes(colorSchemes, themes, colors, sizeModes) {
174
- return [
175
- ...generateSizeGroup(sizeModes),
176
- ...await generateThemesGroup(themes),
177
- ...generateTypographyGroup(themes),
178
- ...generateColorSchemesGroup(colorSchemes, themes),
179
- generateSemanticGroup(),
180
- ...await generateColorGroup("main", colors),
181
- ...await generateColorGroup("support", colors)
182
- ];
23
+ */
24
+ async function generate$Themes(tokenSetDimensions, themeNames, colors) {
25
+ const { colorSchemes, sizeModes } = tokenSetDimensions;
26
+ return [
27
+ ...generateSizeGroup(sizeModes),
28
+ ...await generateThemesGroup(themeNames),
29
+ ...generateTypographyGroup(themeNames),
30
+ ...generateColorSchemesGroup(colorSchemes, themeNames),
31
+ generateSemanticGroup(),
32
+ ...await generateColorGroup("main", colors.main),
33
+ ...await generateColorGroup("support", colors.support)
34
+ ];
183
35
  }
184
36
  function generateSizeGroup(_sizes) {
185
- return [
186
- {
187
- id: "8b2c8cc86611a34b135cb22948666779361fd729",
188
- name: "medium",
189
- $figmaStyleReferences: {},
190
- selectedTokenSets: {
191
- "primitives/modes/size/medium": TokenSetStatus.SOURCE,
192
- "primitives/modes/size/global": TokenSetStatus.ENABLED,
193
- "primitives/modes/typography/size/medium": TokenSetStatus.ENABLED
194
- },
195
- $figmaCollectionId: "VariableCollectionId:36248:20757",
196
- $figmaModeId: "41630:1",
197
- group: "Size"
198
- },
199
- {
200
- id: "d49b9eebeb48a4f165a74b7261733d0a73370f0e",
201
- name: "large",
202
- $figmaStyleReferences: {},
203
- selectedTokenSets: {
204
- "primitives/modes/size/large": TokenSetStatus.SOURCE,
205
- "primitives/modes/size/global": TokenSetStatus.ENABLED,
206
- "primitives/modes/typography/size/large": TokenSetStatus.ENABLED
207
- },
208
- $figmaCollectionId: "VariableCollectionId:36248:20757",
209
- $figmaModeId: "41630:2",
210
- group: "Size"
211
- },
212
- {
213
- id: "fb11567729c298ca37c9da4e3a27716a23480824",
214
- name: "small",
215
- $figmaStyleReferences: {},
216
- selectedTokenSets: {
217
- "primitives/modes/size/small": TokenSetStatus.SOURCE,
218
- "primitives/modes/size/global": TokenSetStatus.ENABLED,
219
- "primitives/modes/typography/size/small": TokenSetStatus.ENABLED
220
- },
221
- $figmaCollectionId: "VariableCollectionId:36248:20757",
222
- $figmaModeId: "41630:3",
223
- group: "Size"
224
- }
225
- ];
37
+ return [
38
+ {
39
+ id: "8b2c8cc86611a34b135cb22948666779361fd729",
40
+ name: "medium",
41
+ $figmaStyleReferences: {},
42
+ selectedTokenSets: {
43
+ "primitives/modes/size/medium": TokenSetStatus.SOURCE,
44
+ "primitives/modes/size/global": TokenSetStatus.ENABLED,
45
+ "primitives/modes/typography/size/medium": TokenSetStatus.ENABLED
46
+ },
47
+ $figmaCollectionId: "VariableCollectionId:36248:20757",
48
+ $figmaModeId: "41630:1",
49
+ group: "Size"
50
+ },
51
+ {
52
+ id: "d49b9eebeb48a4f165a74b7261733d0a73370f0e",
53
+ name: "large",
54
+ $figmaStyleReferences: {},
55
+ selectedTokenSets: {
56
+ "primitives/modes/size/large": TokenSetStatus.SOURCE,
57
+ "primitives/modes/size/global": TokenSetStatus.ENABLED,
58
+ "primitives/modes/typography/size/large": TokenSetStatus.ENABLED
59
+ },
60
+ $figmaCollectionId: "VariableCollectionId:36248:20757",
61
+ $figmaModeId: "41630:2",
62
+ group: "Size"
63
+ },
64
+ {
65
+ id: "fb11567729c298ca37c9da4e3a27716a23480824",
66
+ name: "small",
67
+ $figmaStyleReferences: {},
68
+ selectedTokenSets: {
69
+ "primitives/modes/size/small": TokenSetStatus.SOURCE,
70
+ "primitives/modes/size/global": TokenSetStatus.ENABLED,
71
+ "primitives/modes/typography/size/small": TokenSetStatus.ENABLED
72
+ },
73
+ $figmaCollectionId: "VariableCollectionId:36248:20757",
74
+ $figmaModeId: "41630:3",
75
+ group: "Size"
76
+ }
77
+ ];
226
78
  }
227
- var colorSchemeDefaults = {
228
- light: {
229
- name: "Light",
230
- selectedTokenSets: {},
231
- id: "0daa3ca0b427b9349da7e7dc00101b5668972926",
232
- $figmaCollectionId: "VariableCollectionId:34811:5472",
233
- $figmaModeId: "34811:0"
234
- },
235
- dark: {
236
- name: "Dark",
237
- selectedTokenSets: {},
238
- id: "9ebd8aed52afbffc17e2666e8b4653a53498b257",
239
- $figmaCollectionId: "VariableCollectionId:34811:5472",
240
- $figmaModeId: "34811:1"
241
- },
242
- contrast: {
243
- name: "Contrast",
244
- selectedTokenSets: {},
245
- id: "9ebd8aed52afbffc17e2666e8b4653a53498b123",
246
- $figmaCollectionId: "VariableCollectionId:34811:5472",
247
- $figmaModeId: "34811:2"
248
- }
79
+ const colorSchemeDefaults = {
80
+ light: {
81
+ name: "Light",
82
+ selectedTokenSets: {},
83
+ id: "0daa3ca0b427b9349da7e7dc00101b5668972926",
84
+ $figmaCollectionId: "VariableCollectionId:34811:5472",
85
+ $figmaModeId: "34811:0"
86
+ },
87
+ dark: {
88
+ name: "Dark",
89
+ selectedTokenSets: {},
90
+ id: "9ebd8aed52afbffc17e2666e8b4653a53498b257",
91
+ $figmaCollectionId: "VariableCollectionId:34811:5472",
92
+ $figmaModeId: "34811:1"
93
+ },
94
+ contrast: {
95
+ name: "Contrast",
96
+ selectedTokenSets: {},
97
+ id: "9ebd8aed52afbffc17e2666e8b4653a53498b123",
98
+ $figmaCollectionId: "VariableCollectionId:34811:5472",
99
+ $figmaModeId: "34811:2"
100
+ }
249
101
  };
250
102
  function generateColorSchemesGroup(colorSchemes, themes) {
251
- return colorSchemes.map(
252
- (scheme) => ({
253
- ...colorSchemeDefaults[scheme],
254
- selectedTokenSets: Object.fromEntries([
255
- ...themes.map((theme) => [`primitives/modes/color-scheme/${scheme}/${theme}`, TokenSetStatus.ENABLED])
256
- ]),
257
- group: "Color scheme"
258
- })
259
- );
103
+ return colorSchemes.map((scheme) => ({
104
+ ...colorSchemeDefaults[scheme],
105
+ selectedTokenSets: Object.fromEntries([...themes.map((theme) => [`primitives/modes/color-scheme/${scheme}/${theme}`, TokenSetStatus.ENABLED])]),
106
+ group: "Color scheme"
107
+ }));
260
108
  }
261
109
  async function generateThemesGroup(themes) {
262
- return Promise.all(
263
- themes.map(
264
- async (theme, index) => ({
265
- id: await createHash(theme),
266
- $figmaCollectionId: "VariableCollectionId:36528:61712",
267
- $figmaModeId: `40960:${index + 6}`,
268
- // Start on 6 in Token Studio and Community file for some reason
269
- name: theme,
270
- selectedTokenSets: {
271
- [`themes/${theme}`]: TokenSetStatus.ENABLED
272
- },
273
- group: "Theme"
274
- })
275
- )
276
- );
110
+ return Promise.all(themes.map(async (theme, index) => ({
111
+ id: await createHash(theme),
112
+ $figmaCollectionId: "VariableCollectionId:36528:61712",
113
+ $figmaModeId: `40960:${index + 6}`,
114
+ name: theme,
115
+ selectedTokenSets: { [`themes/${theme}`]: TokenSetStatus.ENABLED },
116
+ group: "Theme"
117
+ })));
277
118
  }
278
119
  function generateSemanticGroup() {
279
- return {
280
- id: "541629445ef90ad5363f9e88f52a1ccb617e6f84",
281
- name: "Semantic",
282
- selectedTokenSets: {
283
- "semantic/style": TokenSetStatus.ENABLED,
284
- "semantic/color": TokenSetStatus.ENABLED,
285
- "primitives/globals": TokenSetStatus.SOURCE
286
- },
287
- $figmaCollectionId: "VariableCollectionId:34811:5976",
288
- $figmaModeId: "34811:5",
289
- group: "Semantic"
290
- };
120
+ return {
121
+ id: "541629445ef90ad5363f9e88f52a1ccb617e6f84",
122
+ name: "Semantic",
123
+ selectedTokenSets: {
124
+ "semantic/style": TokenSetStatus.ENABLED,
125
+ "semantic/color": TokenSetStatus.ENABLED,
126
+ "primitives/globals": TokenSetStatus.SOURCE
127
+ },
128
+ $figmaCollectionId: "VariableCollectionId:34811:5976",
129
+ $figmaModeId: "34811:5",
130
+ group: "Semantic"
131
+ };
291
132
  }
292
133
  async function generateColorGroup(group, colors) {
293
- return Promise.all(
294
- Object.entries(colors[group]).map(
295
- async ([color]) => ({
296
- id: await createHash(`${group}-${color}`),
297
- name: color,
298
- selectedTokenSets: {
299
- [`semantic/modes/${group}-color/${color}`]: TokenSetStatus.ENABLED
300
- },
301
- group: `${capitalize(group)} color`
302
- })
303
- )
304
- );
134
+ return Promise.all(colors.map(async (color) => ({
135
+ id: await createHash(`${group}-${color}`),
136
+ name: color,
137
+ selectedTokenSets: { [`semantic/modes/${group}-color/${color}`]: TokenSetStatus.ENABLED },
138
+ group: `${capitalize(group)} color`
139
+ })));
305
140
  }
306
141
  function generateTypographyGroup(themes) {
307
- return [
308
- {
309
- id: "368d753fcac4455f289500eaa42e70dc0a03522f",
310
- $figmaCollectionId: "VariableCollectionId:36248:20769",
311
- $figmaModeId: "36248:2",
312
- name: "Primary",
313
- selectedTokenSets: Object.fromEntries(
314
- themes.map((theme) => [`primitives/modes/typography/primary/${theme}`, TokenSetStatus.ENABLED])
315
- ),
316
- group: "Typography"
317
- },
318
- {
319
- id: "264b8bd1d40b364e1ea3acf09e49795ddd4c513c",
320
- $figmaCollectionId: "VariableCollectionId:36248:20769",
321
- $figmaModeId: "36248:3",
322
- name: "Secondary",
323
- selectedTokenSets: Object.fromEntries(
324
- themes.map((theme) => [`primitives/modes/typography/secondary/${theme}`, TokenSetStatus.ENABLED])
325
- ),
326
- group: "Typography"
327
- }
328
- ];
142
+ return [{
143
+ id: "368d753fcac4455f289500eaa42e70dc0a03522f",
144
+ $figmaCollectionId: "VariableCollectionId:36248:20769",
145
+ $figmaModeId: "36248:2",
146
+ name: "Primary",
147
+ selectedTokenSets: Object.fromEntries(themes.map((theme) => [`primitives/modes/typography/primary/${theme}`, TokenSetStatus.ENABLED])),
148
+ group: "Typography"
149
+ }, {
150
+ id: "264b8bd1d40b364e1ea3acf09e49795ddd4c513c",
151
+ $figmaCollectionId: "VariableCollectionId:36248:20769",
152
+ $figmaModeId: "36248:3",
153
+ name: "Secondary",
154
+ selectedTokenSets: Object.fromEntries(themes.map((theme) => [`primitives/modes/typography/secondary/${theme}`, TokenSetStatus.ENABLED])),
155
+ group: "Typography"
156
+ }];
329
157
  }
330
- export {
331
- generate$Themes
332
- };
158
+ //#endregion
159
+ export { generate$Themes };