@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.
- package/dist/bin/config.js +50 -658
- package/dist/bin/designsystemet.d.ts.map +1 -1
- package/dist/bin/designsystemet.js +136 -4623
- package/dist/bin/options.js +22 -14
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BorderValues.js +9 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js +8 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js +13 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js +10 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js +10 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/Properties.js +53 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js +14 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js +9 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenTypes.js +32 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TypographyValues.js +15 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/types/index.js +11 -0
- package/dist/package.js +5 -0
- package/dist/src/colors/colorMetadata.js +255 -261
- package/dist/src/colors/index.js +5 -522
- package/dist/src/colors/theme.js +104 -343
- package/dist/src/colors/types.js +22 -25
- package/dist/src/colors/utils.js +241 -154
- package/dist/src/config.js +103 -444
- package/dist/src/index.js +10 -3588
- package/dist/src/migrations/beta-to-v1.js +339 -537
- package/dist/src/migrations/codemods/css/plugins.js +31 -42
- package/dist/src/migrations/codemods/css/run.js +20 -151
- package/dist/src/migrations/color-rename-next49.js +44 -220
- package/dist/src/migrations/index.js +7 -577
- package/dist/src/scripts/update-preview-tokens.d.ts.map +1 -1
- package/dist/src/tokens/build.js +39 -1816
- package/dist/src/tokens/create/files.d.ts +10 -5
- package/dist/src/tokens/create/files.d.ts.map +1 -1
- package/dist/src/tokens/create/files.js +44 -601
- package/dist/src/tokens/create/generators/$designsystemet.js +8 -97
- package/dist/src/tokens/create/generators/$metadata.d.ts +7 -3
- package/dist/src/tokens/create/generators/$metadata.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/$metadata.js +24 -21
- package/dist/src/tokens/create/generators/$themes.d.ts +2 -4
- package/dist/src/tokens/create/generators/$themes.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/$themes.js +139 -312
- package/dist/src/tokens/create/generators/primitives/color-scheme.js +68 -443
- package/dist/src/tokens/create/generators/primitives/globals.js +141 -147
- package/dist/src/tokens/create/generators/primitives/size.js +146 -156
- package/dist/src/tokens/create/generators/primitives/typography.js +213 -217
- package/dist/src/tokens/create/generators/semantic/color-modes.js +24 -59
- package/dist/src/tokens/create/generators/semantic/color.js +42 -326
- package/dist/src/tokens/create/generators/semantic/style.js +379 -382
- package/dist/src/tokens/create/generators/themes/theme.js +108 -392
- package/dist/src/tokens/create.d.ts +2 -1
- package/dist/src/tokens/create.d.ts.map +1 -1
- package/dist/src/tokens/create.js +50 -1591
- package/dist/src/tokens/format.d.ts.map +1 -1
- package/dist/src/tokens/format.js +35 -3324
- package/dist/src/tokens/generate-config.js +155 -298
- package/dist/src/tokens/index.js +3 -3344
- package/dist/src/tokens/process/configs/color.js +50 -1085
- package/dist/src/tokens/process/configs/semantic.js +45 -1083
- package/dist/src/tokens/process/configs/shared.js +18 -109
- package/dist/src/tokens/process/configs/size-mode.js +27 -1082
- package/dist/src/tokens/process/configs/size.js +32 -1083
- package/dist/src/tokens/process/configs/type-scale.js +49 -1083
- package/dist/src/tokens/process/configs/typography.js +63 -1084
- package/dist/src/tokens/process/configs.js +91 -1224
- package/dist/src/tokens/process/formats/css/color.js +58 -1079
- package/dist/src/tokens/process/formats/css/semantic.js +27 -1081
- package/dist/src/tokens/process/formats/css/size-mode.js +43 -1077
- package/dist/src/tokens/process/formats/css/size.js +86 -1079
- package/dist/src/tokens/process/formats/css/type-scale.js +53 -1083
- package/dist/src/tokens/process/formats/css/typography.js +27 -1081
- package/dist/src/tokens/process/formats/css.js +18 -1081
- package/dist/src/tokens/process/output/declarations.js +18 -1201
- package/dist/src/tokens/process/output/tailwind.js +26 -40
- package/dist/src/tokens/process/output/theme.js +73 -206
- package/dist/src/tokens/process/platform.js +165 -1355
- package/dist/src/tokens/process/transformers.js +49 -89
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +100 -1183
- package/dist/src/tokens/process/utils/kebab-case.js +7 -5
- package/dist/src/tokens/types.d.ts +6 -0
- package/dist/src/tokens/types.d.ts.map +1 -1
- package/dist/src/tokens/types.js +6 -7
- package/dist/src/tokens/utils.d.ts +2 -1
- package/dist/src/tokens/utils.d.ts.map +1 -1
- package/dist/src/tokens/utils.js +107 -93
- package/dist/src/types.js +1 -5
- package/dist/src/utils/filesystem.js +112 -124
- package/package.json +12 -15
- package/configs/test-tokens.config.json +0 -82
- package/dist/src/scripts/createJsonSchema.js +0 -409
- package/dist/src/scripts/update-preview-tokens.js +0 -3353
|
@@ -1,1591 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
short: "Standardfarge for overflater / komponenter."
|
|
52
|
-
},
|
|
53
|
-
luminance: {
|
|
54
|
-
light: 1,
|
|
55
|
-
dark: 0.021,
|
|
56
|
-
contrast: 0.015
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"surface-tinted": {
|
|
60
|
-
number: 4,
|
|
61
|
-
name: "surface-tinted",
|
|
62
|
-
group: "surface",
|
|
63
|
-
displayName: "Surface Tinted",
|
|
64
|
-
description: {
|
|
65
|
-
long: "Surface Tinted brukes p\xE5 flater som ligger opp\xE5 bakgrunnsfargene. Denne har et hint av farge i seg.",
|
|
66
|
-
short: "Overflater / komponenter med et hint av farge i seg."
|
|
67
|
-
},
|
|
68
|
-
luminance: {
|
|
69
|
-
light: 0.81,
|
|
70
|
-
dark: 0.027,
|
|
71
|
-
contrast: 0.015
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
"surface-hover": {
|
|
75
|
-
number: 5,
|
|
76
|
-
name: "surface-hover",
|
|
77
|
-
group: "surface",
|
|
78
|
-
displayName: "Surface Hover",
|
|
79
|
-
description: {
|
|
80
|
-
long: "Surface Hover brukes p\xE5 interaktive flater som ligger opp\xE5 bakgrunnsfargene i en hover state.",
|
|
81
|
-
short: "Hover-farge til overflater / komponenter."
|
|
82
|
-
},
|
|
83
|
-
luminance: {
|
|
84
|
-
light: 0.7,
|
|
85
|
-
dark: 0.036,
|
|
86
|
-
contrast: 0.028
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
"surface-active": {
|
|
90
|
-
number: 6,
|
|
91
|
-
name: "surface-active",
|
|
92
|
-
group: "surface",
|
|
93
|
-
displayName: "Surface Active",
|
|
94
|
-
description: {
|
|
95
|
-
long: "Surface Active brukes p\xE5 interaktive flater som ligger opp\xE5 bakgrunnsfargene i en active state.",
|
|
96
|
-
short: "Active-farge til overflater / komponenter."
|
|
97
|
-
},
|
|
98
|
-
luminance: {
|
|
99
|
-
light: 0.59,
|
|
100
|
-
dark: 0.056,
|
|
101
|
-
contrast: 0.045
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
"border-subtle": {
|
|
105
|
-
number: 7,
|
|
106
|
-
name: "border-subtle",
|
|
107
|
-
group: "border",
|
|
108
|
-
displayName: "Border Subtle",
|
|
109
|
-
description: {
|
|
110
|
-
long: "Border Subtle er den lyseste border-fargen og brukes for \xE5 skille elementer fra hverandre.",
|
|
111
|
-
short: "Border-farge med lav kontrast til dekorativ bruk (skillelinjer)."
|
|
112
|
-
},
|
|
113
|
-
luminance: {
|
|
114
|
-
light: 0.5,
|
|
115
|
-
dark: 0.08,
|
|
116
|
-
contrast: 0.26
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
"border-default": {
|
|
120
|
-
number: 8,
|
|
121
|
-
name: "border-default",
|
|
122
|
-
group: "border",
|
|
123
|
-
displayName: "Border Default",
|
|
124
|
-
description: {
|
|
125
|
-
long: "Border Default er en border-farge som brukes n\xE5r man \xF8nsker god kontrast mot bakgrunnsfargene.",
|
|
126
|
-
short: "Standard border-farge til skjemakomponenter og meningsb\xE6rende elementer."
|
|
127
|
-
},
|
|
128
|
-
luminance: {
|
|
129
|
-
light: 0.19,
|
|
130
|
-
dark: 0.22,
|
|
131
|
-
contrast: 0.4
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
"border-strong": {
|
|
135
|
-
number: 9,
|
|
136
|
-
name: "border-strong",
|
|
137
|
-
group: "border",
|
|
138
|
-
displayName: "Border Strong",
|
|
139
|
-
description: {
|
|
140
|
-
long: "Border Strong er den m\xF8rkeste border-fargen og brukes n\xE5r man \xF8nsker en veldig tydelig og sterk border.",
|
|
141
|
-
short: "Border-farge med h\xF8y kontrast for ekstra synlighet."
|
|
142
|
-
},
|
|
143
|
-
luminance: {
|
|
144
|
-
light: 0.11,
|
|
145
|
-
dark: 0.39,
|
|
146
|
-
contrast: 0.6
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
"text-subtle": {
|
|
150
|
-
number: 10,
|
|
151
|
-
name: "text-subtle",
|
|
152
|
-
group: "text",
|
|
153
|
-
displayName: "Text Subtle",
|
|
154
|
-
description: {
|
|
155
|
-
long: "Text Subtle er den lyseste tekstfargen og brukes p\xE5 tekst som skal v\xE6re litt mindre synlig eller for \xE5 skape variasjon i typografien.",
|
|
156
|
-
short: "Tekst- og ikonfarge med lavere kontrast."
|
|
157
|
-
},
|
|
158
|
-
luminance: {
|
|
159
|
-
light: 0.11,
|
|
160
|
-
dark: 0.39,
|
|
161
|
-
contrast: 0.57
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
"text-default": {
|
|
165
|
-
number: 11,
|
|
166
|
-
name: "text-default",
|
|
167
|
-
group: "text",
|
|
168
|
-
displayName: "Text Default",
|
|
169
|
-
description: {
|
|
170
|
-
long: "Text Default er den m\xF8rkeste tekstfargen og brukes p\xE5 tekst som skal v\xE6re mest synlig. Denne fargen b\xF8r brukes p\xE5 mesteparten av teksten p\xE5 en side.",
|
|
171
|
-
short: "Tekst- og ikonfarge med h\xF8y kontrast og god synlighet."
|
|
172
|
-
},
|
|
173
|
-
luminance: {
|
|
174
|
-
light: 0.0245,
|
|
175
|
-
dark: 0.84,
|
|
176
|
-
contrast: 0.86
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
"base-default": {
|
|
180
|
-
number: 12,
|
|
181
|
-
name: "base-default",
|
|
182
|
-
group: "base",
|
|
183
|
-
displayName: "Base Default",
|
|
184
|
-
description: {
|
|
185
|
-
long: "Base Default fargen f\xE5r den samme hex koden som fargen som er valgt i verkt\xF8yet. Brukes ofte som farge p\xE5 viktige elementer og p\xE5 flater som skal fange brukerens oppmerksomhet.",
|
|
186
|
-
short: "Standardfarge for solide bakgrunner."
|
|
187
|
-
},
|
|
188
|
-
luminance: {
|
|
189
|
-
light: 1,
|
|
190
|
-
dark: 1,
|
|
191
|
-
contrast: 1
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
"base-hover": {
|
|
195
|
-
number: 13,
|
|
196
|
-
name: "base-hover",
|
|
197
|
-
group: "base",
|
|
198
|
-
displayName: "Base Hover",
|
|
199
|
-
description: {
|
|
200
|
-
long: "Base Hover brukes som hover farge p\xE5 elementer som bruker Base Default fargen.",
|
|
201
|
-
short: "Hover-farge for solide bakgrunner."
|
|
202
|
-
},
|
|
203
|
-
luminance: {
|
|
204
|
-
light: 1,
|
|
205
|
-
dark: 1,
|
|
206
|
-
contrast: 1
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
"base-active": {
|
|
210
|
-
number: 14,
|
|
211
|
-
name: "base-active",
|
|
212
|
-
group: "base",
|
|
213
|
-
displayName: "Base Active",
|
|
214
|
-
description: {
|
|
215
|
-
long: "Base Active brukes som active farge p\xE5 elementer som bruker Base Default fargen.",
|
|
216
|
-
short: "Active-farge for solide bakgrunner."
|
|
217
|
-
},
|
|
218
|
-
luminance: {
|
|
219
|
-
light: 1,
|
|
220
|
-
dark: 1,
|
|
221
|
-
contrast: 1
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
"base-contrast-subtle": {
|
|
225
|
-
number: 15,
|
|
226
|
-
name: "base-contrast-subtle",
|
|
227
|
-
group: "base",
|
|
228
|
-
displayName: "Contrast Subtle",
|
|
229
|
-
description: {
|
|
230
|
-
long: "Contrast Subtle brukes som en viktig meningsb\xE6rende farge opp\xE5 Base Default fargen.",
|
|
231
|
-
short: "Farge med god kontrast mot Base-default."
|
|
232
|
-
},
|
|
233
|
-
luminance: {
|
|
234
|
-
light: 1,
|
|
235
|
-
dark: 1,
|
|
236
|
-
contrast: 1
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
"base-contrast-default": {
|
|
240
|
-
number: 16,
|
|
241
|
-
name: "base-contrast-default",
|
|
242
|
-
group: "base",
|
|
243
|
-
displayName: "Contrast Default",
|
|
244
|
-
description: {
|
|
245
|
-
long: "Contrast Default brukes som en viktig meningsb\xE6rende farge opp\xE5 alle Base fargane.",
|
|
246
|
-
short: "Farge med god kontrast mot Base-default og Base-hover."
|
|
247
|
-
},
|
|
248
|
-
luminance: {
|
|
249
|
-
light: 1,
|
|
250
|
-
dark: 1,
|
|
251
|
-
contrast: 1
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
var colorMetadataByNumber = R.indexBy((metadata) => metadata.number, Object.values(colorMetadata));
|
|
256
|
-
var colorNames = Object.keys(colorMetadata);
|
|
257
|
-
var baseColorNames = Object.keys(baseColors);
|
|
258
|
-
|
|
259
|
-
// src/colors/theme.ts
|
|
260
|
-
import chroma2 from "chroma-js";
|
|
261
|
-
import * as R2 from "ramda";
|
|
262
|
-
|
|
263
|
-
// src/colors/utils.ts
|
|
264
|
-
import chroma from "chroma-js";
|
|
265
|
-
import Colorjs from "colorjs.io";
|
|
266
|
-
import { Hsluv } from "hsluv";
|
|
267
|
-
var getLuminanceFromLightness = (lightness) => {
|
|
268
|
-
const conv = new Hsluv();
|
|
269
|
-
conv.hsluv_l = lightness;
|
|
270
|
-
conv.hsluvToHex();
|
|
271
|
-
return chroma(conv.hex).luminance();
|
|
272
|
-
};
|
|
273
|
-
var getLightnessFromHex = (hex) => {
|
|
274
|
-
const conv = new Hsluv();
|
|
275
|
-
conv.hex = hex;
|
|
276
|
-
conv.hexToHsluv();
|
|
277
|
-
return conv.hsluv_l;
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
// src/colors/theme.ts
|
|
281
|
-
var generateColorScale = (color, colorScheme) => {
|
|
282
|
-
let interpolationColor = color;
|
|
283
|
-
if (colorScheme === "dark") {
|
|
284
|
-
const [L, C, H] = chroma2(color).oklch();
|
|
285
|
-
const chromaModifier = 0.7;
|
|
286
|
-
interpolationColor = chroma2(L, C * chromaModifier, H, "oklch").hex();
|
|
287
|
-
}
|
|
288
|
-
const colors = R2.mapObjIndexed((colorData) => {
|
|
289
|
-
const luminance = colorData.luminance[colorScheme];
|
|
290
|
-
return {
|
|
291
|
-
...colorData,
|
|
292
|
-
hex: chroma2(interpolationColor).luminance(luminance).hex()
|
|
293
|
-
};
|
|
294
|
-
}, colorMetadata);
|
|
295
|
-
const baseColors2 = generateBaseColors(color, colorScheme);
|
|
296
|
-
colors["base-default"] = { ...colors["base-default"], hex: baseColors2.default };
|
|
297
|
-
colors["base-hover"] = { ...colors["base-hover"], hex: baseColors2.hover };
|
|
298
|
-
colors["base-active"] = { ...colors["base-active"], hex: baseColors2.active };
|
|
299
|
-
colors["base-contrast-subtle"] = {
|
|
300
|
-
...colors["base-contrast-subtle"],
|
|
301
|
-
hex: generateColorContrast(baseColors2.default, "subtle")
|
|
302
|
-
};
|
|
303
|
-
colors["base-contrast-default"] = {
|
|
304
|
-
...colors["base-contrast-default"],
|
|
305
|
-
hex: generateColorContrast(baseColors2.default, "default")
|
|
306
|
-
};
|
|
307
|
-
return Object.values(colors);
|
|
308
|
-
};
|
|
309
|
-
var generateBaseColors = (color, colorScheme) => {
|
|
310
|
-
let colorLightness = getLightnessFromHex(color);
|
|
311
|
-
if (colorScheme !== "light") {
|
|
312
|
-
colorLightness = colorLightness <= 30 ? 70 : 100 - colorLightness;
|
|
313
|
-
}
|
|
314
|
-
const modifier = colorLightness <= 30 || colorLightness >= 49 && colorLightness <= 65 ? -8 : 8;
|
|
315
|
-
const calculateLightness = (base, mod) => base - mod;
|
|
316
|
-
return {
|
|
317
|
-
default: colorScheme === "light" ? color : chroma2(color).luminance(getLuminanceFromLightness(colorLightness)).hex(),
|
|
318
|
-
hover: chroma2(color).luminance(getLuminanceFromLightness(calculateLightness(colorLightness, modifier))).hex(),
|
|
319
|
-
active: chroma2(color).luminance(getLuminanceFromLightness(calculateLightness(colorLightness, modifier * 2))).hex()
|
|
320
|
-
};
|
|
321
|
-
};
|
|
322
|
-
var generateColorContrast = (color, type) => {
|
|
323
|
-
if (type === "default") {
|
|
324
|
-
return chroma2.contrast(color, "#ffffff") >= chroma2.contrast(color, "#000000") ? "#ffffff" : "#000000";
|
|
325
|
-
}
|
|
326
|
-
if (type === "subtle") {
|
|
327
|
-
const contrastWhite = chroma2.contrast(color, "#ffffff");
|
|
328
|
-
const contrastBlack = chroma2.contrast(color, "#000000");
|
|
329
|
-
const lightness = getLightnessFromHex(color);
|
|
330
|
-
const modifier = lightness <= 40 || lightness >= 60 ? 60 : 50;
|
|
331
|
-
const targetLightness = contrastWhite >= contrastBlack ? lightness + modifier : lightness - modifier;
|
|
332
|
-
return chroma2(color).luminance(getLuminanceFromLightness(targetLightness)).hex();
|
|
333
|
-
}
|
|
334
|
-
return color;
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
// src/colors/types.ts
|
|
338
|
-
import * as R3 from "ramda";
|
|
339
|
-
var semanticColorMap = {
|
|
340
|
-
"background-default": 1,
|
|
341
|
-
"background-tinted": 2,
|
|
342
|
-
"surface-default": 3,
|
|
343
|
-
"surface-tinted": 4,
|
|
344
|
-
"surface-hover": 5,
|
|
345
|
-
"surface-active": 6,
|
|
346
|
-
"border-subtle": 7,
|
|
347
|
-
"border-default": 8,
|
|
348
|
-
"border-strong": 9,
|
|
349
|
-
"text-subtle": 10,
|
|
350
|
-
"text-default": 11,
|
|
351
|
-
"base-default": 12,
|
|
352
|
-
"base-hover": 13,
|
|
353
|
-
"base-active": 14,
|
|
354
|
-
"base-contrast-subtle": 15,
|
|
355
|
-
"base-contrast-default": 16
|
|
356
|
-
};
|
|
357
|
-
var semanticColorNames = R3.keys(semanticColorMap);
|
|
358
|
-
var semanticColorNumbers = R3.values(semanticColorMap);
|
|
359
|
-
|
|
360
|
-
// src/tokens/create/generators/primitives/color-scheme.ts
|
|
361
|
-
var generateColor = (colorArray, overrides) => {
|
|
362
|
-
const obj = {};
|
|
363
|
-
const $type = "color";
|
|
364
|
-
for (const index in colorArray) {
|
|
365
|
-
const position = Number(index) + 1;
|
|
366
|
-
const overrideValue = overrides?.[position];
|
|
367
|
-
obj[position] = {
|
|
368
|
-
$type,
|
|
369
|
-
$value: overrideValue || colorArray[index].hex
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
return obj;
|
|
373
|
-
};
|
|
374
|
-
var generateColorScheme = (themeName, colorScheme, colors, overrides) => {
|
|
375
|
-
const createColorOverrides = (colorName) => {
|
|
376
|
-
if (!overrides?.colors || !(colorName in overrides.colors)) {
|
|
377
|
-
return void 0;
|
|
378
|
-
}
|
|
379
|
-
const colorOverrides = overrides.colors[colorName];
|
|
380
|
-
const positionOverrides = {};
|
|
381
|
-
Object.entries(colorOverrides).forEach(([semanticTokenName, modeOverrides]) => {
|
|
382
|
-
const position = colorMetadata[semanticTokenName].number;
|
|
383
|
-
if (position) {
|
|
384
|
-
let overrideValue;
|
|
385
|
-
if (colorScheme === "light" && modeOverrides.light) {
|
|
386
|
-
overrideValue = modeOverrides.light;
|
|
387
|
-
} else if (colorScheme === "dark" && modeOverrides.dark) {
|
|
388
|
-
overrideValue = modeOverrides.dark;
|
|
389
|
-
}
|
|
390
|
-
if (overrideValue) {
|
|
391
|
-
positionOverrides[position] = overrideValue;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
});
|
|
395
|
-
return Object.keys(positionOverrides).length > 0 ? positionOverrides : void 0;
|
|
396
|
-
};
|
|
397
|
-
const main = R4.mapObjIndexed(
|
|
398
|
-
(color, colorName) => generateColor(generateColorScale(color, colorScheme), createColorOverrides(colorName)),
|
|
399
|
-
colors.main
|
|
400
|
-
);
|
|
401
|
-
const support = R4.mapObjIndexed(
|
|
402
|
-
(color, colorName) => generateColor(generateColorScale(color, colorScheme), createColorOverrides(colorName)),
|
|
403
|
-
colors.support
|
|
404
|
-
);
|
|
405
|
-
const neutralColorScale = generateColorScale(colors.neutral, colorScheme);
|
|
406
|
-
const neutral = generateColor(neutralColorScale, createColorOverrides("neutral"));
|
|
407
|
-
const baseColorsWithOverrides = {
|
|
408
|
-
...baseColors,
|
|
409
|
-
...overrides?.severity
|
|
410
|
-
};
|
|
411
|
-
const globalColors = R4.mapObjIndexed(
|
|
412
|
-
(color, colorName) => generateColor(generateColorScale(color, colorScheme), createColorOverrides(colorName)),
|
|
413
|
-
baseColorsWithOverrides
|
|
414
|
-
);
|
|
415
|
-
const linkColor = generateColor(generateColorScale(dsLinkColor, colorScheme));
|
|
416
|
-
const defaultLinkVisited = linkColor[12];
|
|
417
|
-
const linkOverride = overrides?.linkVisited?.[colorScheme] ? { $type: "color", $value: overrides.linkVisited[colorScheme] } : void 0;
|
|
418
|
-
const defaultFocusInner = neutralColorScale[0].hex;
|
|
419
|
-
const defaultFocusOuter = neutralColorScale[10].hex;
|
|
420
|
-
const focusInnerOverride = overrides?.focus?.inner?.[colorScheme];
|
|
421
|
-
const focusOuterOverride = overrides?.focus?.outer?.[colorScheme];
|
|
422
|
-
return {
|
|
423
|
-
[themeName]: {
|
|
424
|
-
...main,
|
|
425
|
-
...support,
|
|
426
|
-
neutral,
|
|
427
|
-
...globalColors,
|
|
428
|
-
link: {
|
|
429
|
-
visited: linkOverride || defaultLinkVisited
|
|
430
|
-
},
|
|
431
|
-
focus: {
|
|
432
|
-
inner: {
|
|
433
|
-
$type: "color",
|
|
434
|
-
$value: focusInnerOverride || defaultFocusInner
|
|
435
|
-
},
|
|
436
|
-
outer: {
|
|
437
|
-
$type: "color",
|
|
438
|
-
$value: focusOuterOverride || defaultFocusOuter
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
};
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
// src/tokens/create/generators/primitives/globals.ts
|
|
446
|
-
var globals = {
|
|
447
|
-
"border-width": {
|
|
448
|
-
"1": {
|
|
449
|
-
$type: "borderWidth",
|
|
450
|
-
$value: "1px"
|
|
451
|
-
},
|
|
452
|
-
"3": {
|
|
453
|
-
$type: "borderWidth",
|
|
454
|
-
$value: "3px"
|
|
455
|
-
}
|
|
456
|
-
},
|
|
457
|
-
shadow: {
|
|
458
|
-
"100": {
|
|
459
|
-
$type: "boxShadow",
|
|
460
|
-
$value: [
|
|
461
|
-
{
|
|
462
|
-
color: "rgba(0,0,0,0.16)",
|
|
463
|
-
x: "0",
|
|
464
|
-
y: "0",
|
|
465
|
-
blur: "1",
|
|
466
|
-
spread: "0"
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
x: "0",
|
|
470
|
-
y: "1",
|
|
471
|
-
blur: "2",
|
|
472
|
-
spread: "0",
|
|
473
|
-
color: "rgba(0,0,0,0.12)"
|
|
474
|
-
}
|
|
475
|
-
]
|
|
476
|
-
},
|
|
477
|
-
"200": {
|
|
478
|
-
$type: "boxShadow",
|
|
479
|
-
$value: [
|
|
480
|
-
{
|
|
481
|
-
color: "rgba(0,0,0,0.15)",
|
|
482
|
-
x: "0",
|
|
483
|
-
y: "0",
|
|
484
|
-
blur: "1",
|
|
485
|
-
spread: "0"
|
|
486
|
-
},
|
|
487
|
-
{
|
|
488
|
-
color: "rgba(0,0,0,0.12)",
|
|
489
|
-
x: "0",
|
|
490
|
-
y: "1",
|
|
491
|
-
blur: "2",
|
|
492
|
-
spread: "0"
|
|
493
|
-
},
|
|
494
|
-
{
|
|
495
|
-
x: "0",
|
|
496
|
-
y: "2",
|
|
497
|
-
blur: "4",
|
|
498
|
-
spread: "0",
|
|
499
|
-
color: "rgba(0,0,0,0.1)"
|
|
500
|
-
}
|
|
501
|
-
]
|
|
502
|
-
},
|
|
503
|
-
"300": {
|
|
504
|
-
$type: "boxShadow",
|
|
505
|
-
$value: [
|
|
506
|
-
{
|
|
507
|
-
color: "rgba(0,0,0,0.14)",
|
|
508
|
-
x: "0",
|
|
509
|
-
y: "0",
|
|
510
|
-
blur: "1",
|
|
511
|
-
spread: "0"
|
|
512
|
-
},
|
|
513
|
-
{
|
|
514
|
-
color: "rgba(0,0,0,0.12)",
|
|
515
|
-
x: "0",
|
|
516
|
-
y: "2",
|
|
517
|
-
blur: "4",
|
|
518
|
-
spread: "0"
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
x: "0",
|
|
522
|
-
y: "4",
|
|
523
|
-
blur: "8",
|
|
524
|
-
spread: "0",
|
|
525
|
-
color: "rgba(0,0,0,0.12)"
|
|
526
|
-
}
|
|
527
|
-
]
|
|
528
|
-
},
|
|
529
|
-
"400": {
|
|
530
|
-
$type: "boxShadow",
|
|
531
|
-
$value: [
|
|
532
|
-
{
|
|
533
|
-
color: "rgba(0,0,0,0.13)",
|
|
534
|
-
x: "0",
|
|
535
|
-
y: "0",
|
|
536
|
-
blur: "1",
|
|
537
|
-
spread: "0"
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
color: "rgba(0,0,0,0.13)",
|
|
541
|
-
x: "0",
|
|
542
|
-
y: "3",
|
|
543
|
-
blur: "5",
|
|
544
|
-
spread: "0"
|
|
545
|
-
},
|
|
546
|
-
{
|
|
547
|
-
x: "0",
|
|
548
|
-
y: "6",
|
|
549
|
-
blur: "12",
|
|
550
|
-
spread: "0",
|
|
551
|
-
color: "rgba(0,0,0,0.14)"
|
|
552
|
-
}
|
|
553
|
-
]
|
|
554
|
-
},
|
|
555
|
-
"500": {
|
|
556
|
-
$type: "boxShadow",
|
|
557
|
-
$value: [
|
|
558
|
-
{
|
|
559
|
-
color: "rgba(0,0,0,0.12)",
|
|
560
|
-
x: "0",
|
|
561
|
-
y: "0",
|
|
562
|
-
blur: "1",
|
|
563
|
-
spread: "0"
|
|
564
|
-
},
|
|
565
|
-
{
|
|
566
|
-
color: "rgba(0,0,0,0.16)",
|
|
567
|
-
x: "0",
|
|
568
|
-
y: "4",
|
|
569
|
-
blur: "8",
|
|
570
|
-
spread: "0"
|
|
571
|
-
},
|
|
572
|
-
{
|
|
573
|
-
x: "0",
|
|
574
|
-
y: "12",
|
|
575
|
-
blur: "24",
|
|
576
|
-
spread: "0",
|
|
577
|
-
color: "rgba(0,0,0,0.16)"
|
|
578
|
-
}
|
|
579
|
-
]
|
|
580
|
-
}
|
|
581
|
-
},
|
|
582
|
-
opacity: {
|
|
583
|
-
"30": {
|
|
584
|
-
$type: "opacity",
|
|
585
|
-
$value: "30%"
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
};
|
|
589
|
-
var generateGlobals = () => globals;
|
|
590
|
-
|
|
591
|
-
// src/tokens/create/generators/primitives/size.ts
|
|
592
|
-
var global = {
|
|
593
|
-
_size: {
|
|
594
|
-
"0": {
|
|
595
|
-
$type: "dimension",
|
|
596
|
-
$value: "floor({_size.unit} * 0)"
|
|
597
|
-
},
|
|
598
|
-
"1": {
|
|
599
|
-
$type: "dimension",
|
|
600
|
-
$value: "floor({_size.unit} * 1)"
|
|
601
|
-
},
|
|
602
|
-
"2": {
|
|
603
|
-
$type: "dimension",
|
|
604
|
-
$value: "floor({_size.unit} * 2)"
|
|
605
|
-
},
|
|
606
|
-
"3": {
|
|
607
|
-
$type: "dimension",
|
|
608
|
-
$value: "floor({_size.unit} * 3)"
|
|
609
|
-
},
|
|
610
|
-
"4": {
|
|
611
|
-
$type: "dimension",
|
|
612
|
-
$value: "floor({_size.unit} * 4)"
|
|
613
|
-
},
|
|
614
|
-
"5": {
|
|
615
|
-
$type: "dimension",
|
|
616
|
-
$value: "floor({_size.unit} * 5)"
|
|
617
|
-
},
|
|
618
|
-
"6": {
|
|
619
|
-
$type: "dimension",
|
|
620
|
-
$value: "floor({_size.unit} * 6)"
|
|
621
|
-
},
|
|
622
|
-
"7": {
|
|
623
|
-
$type: "dimension",
|
|
624
|
-
$value: "floor({_size.unit} * 7)"
|
|
625
|
-
},
|
|
626
|
-
"8": {
|
|
627
|
-
$type: "dimension",
|
|
628
|
-
$value: "floor({_size.unit} * 8)"
|
|
629
|
-
},
|
|
630
|
-
"9": {
|
|
631
|
-
$type: "dimension",
|
|
632
|
-
$value: "floor({_size.unit} * 9)"
|
|
633
|
-
},
|
|
634
|
-
"10": {
|
|
635
|
-
$type: "dimension",
|
|
636
|
-
$value: "floor({_size.unit} * 10)"
|
|
637
|
-
},
|
|
638
|
-
"11": {
|
|
639
|
-
$type: "dimension",
|
|
640
|
-
$value: "floor({_size.unit} * 11)"
|
|
641
|
-
},
|
|
642
|
-
"12": {
|
|
643
|
-
$type: "dimension",
|
|
644
|
-
$value: "floor({_size.unit} * 12)"
|
|
645
|
-
},
|
|
646
|
-
"13": {
|
|
647
|
-
$type: "dimension",
|
|
648
|
-
$value: "floor({_size.unit} * 13)"
|
|
649
|
-
},
|
|
650
|
-
"14": {
|
|
651
|
-
$type: "dimension",
|
|
652
|
-
$value: "floor({_size.unit} * 14)"
|
|
653
|
-
},
|
|
654
|
-
"15": {
|
|
655
|
-
$type: "dimension",
|
|
656
|
-
$value: "floor({_size.unit} * 15)"
|
|
657
|
-
},
|
|
658
|
-
"18": {
|
|
659
|
-
$type: "dimension",
|
|
660
|
-
$value: "floor({_size.unit} * 18)"
|
|
661
|
-
},
|
|
662
|
-
"22": {
|
|
663
|
-
$type: "dimension",
|
|
664
|
-
$value: "floor({_size.unit} * 22)"
|
|
665
|
-
},
|
|
666
|
-
"26": {
|
|
667
|
-
$type: "dimension",
|
|
668
|
-
$value: "floor({_size.unit} * 26)"
|
|
669
|
-
},
|
|
670
|
-
"30": {
|
|
671
|
-
$type: "dimension",
|
|
672
|
-
$value: "floor({_size.unit} * 30)"
|
|
673
|
-
},
|
|
674
|
-
"mode-font-size": {
|
|
675
|
-
$type: "number",
|
|
676
|
-
$value: "{size._mode-font-size}"
|
|
677
|
-
},
|
|
678
|
-
base: {
|
|
679
|
-
$type: "number",
|
|
680
|
-
$value: "{size._base}"
|
|
681
|
-
},
|
|
682
|
-
step: {
|
|
683
|
-
$type: "number",
|
|
684
|
-
$value: "{size._step}"
|
|
685
|
-
},
|
|
686
|
-
unit: {
|
|
687
|
-
$type: "number",
|
|
688
|
-
$value: "{_size.step} / {_size.base} * {_size.mode-font-size}"
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
};
|
|
692
|
-
var sizeModes = {
|
|
693
|
-
large: {
|
|
694
|
-
size: {
|
|
695
|
-
"_mode-font-size": {
|
|
696
|
-
$type: "dimension",
|
|
697
|
-
$value: "21"
|
|
698
|
-
},
|
|
699
|
-
_base: {
|
|
700
|
-
$type: "dimension",
|
|
701
|
-
$value: "18"
|
|
702
|
-
},
|
|
703
|
-
_step: {
|
|
704
|
-
$type: "dimension",
|
|
705
|
-
$value: "4"
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
},
|
|
709
|
-
medium: {
|
|
710
|
-
size: {
|
|
711
|
-
"_mode-font-size": {
|
|
712
|
-
$type: "dimension",
|
|
713
|
-
$value: "18"
|
|
714
|
-
},
|
|
715
|
-
_base: {
|
|
716
|
-
$type: "dimension",
|
|
717
|
-
$value: "18"
|
|
718
|
-
},
|
|
719
|
-
_step: {
|
|
720
|
-
$type: "dimension",
|
|
721
|
-
$value: "4"
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
},
|
|
725
|
-
small: {
|
|
726
|
-
size: {
|
|
727
|
-
"_mode-font-size": {
|
|
728
|
-
$type: "dimension",
|
|
729
|
-
$value: "16"
|
|
730
|
-
},
|
|
731
|
-
_base: {
|
|
732
|
-
$type: "dimension",
|
|
733
|
-
$value: "18"
|
|
734
|
-
},
|
|
735
|
-
_step: {
|
|
736
|
-
$type: "dimension",
|
|
737
|
-
$value: "4"
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
};
|
|
742
|
-
var generateSize = (size) => sizeModes[size];
|
|
743
|
-
var generateSizeGlobal = () => global;
|
|
744
|
-
|
|
745
|
-
// src/tokens/create/generators/primitives/typography.ts
|
|
746
|
-
var generateTypography = (themeName, { fontFamily }) => ({
|
|
747
|
-
[themeName]: {
|
|
748
|
-
"font-family": {
|
|
749
|
-
$type: "fontFamilies",
|
|
750
|
-
$value: fontFamily
|
|
751
|
-
},
|
|
752
|
-
"font-weight": {
|
|
753
|
-
medium: {
|
|
754
|
-
$type: "fontWeights",
|
|
755
|
-
$value: "Medium"
|
|
756
|
-
},
|
|
757
|
-
semibold: {
|
|
758
|
-
$type: "fontWeights",
|
|
759
|
-
$value: "Semi bold"
|
|
760
|
-
},
|
|
761
|
-
regular: {
|
|
762
|
-
$type: "fontWeights",
|
|
763
|
-
$value: "Regular"
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
var generateFontSizes = (size) => fontSizes[size];
|
|
769
|
-
var lineHeights = {
|
|
770
|
-
sm: {
|
|
771
|
-
$type: "lineHeights",
|
|
772
|
-
$value: "130%"
|
|
773
|
-
},
|
|
774
|
-
md: {
|
|
775
|
-
$type: "lineHeights",
|
|
776
|
-
$value: "150%"
|
|
777
|
-
},
|
|
778
|
-
lg: {
|
|
779
|
-
$type: "lineHeights",
|
|
780
|
-
$value: "170%"
|
|
781
|
-
}
|
|
782
|
-
};
|
|
783
|
-
var letterSpacings = {
|
|
784
|
-
"1": {
|
|
785
|
-
$type: "letterSpacing",
|
|
786
|
-
$value: "-1%"
|
|
787
|
-
},
|
|
788
|
-
"2": {
|
|
789
|
-
$type: "letterSpacing",
|
|
790
|
-
$value: "-0.5%"
|
|
791
|
-
},
|
|
792
|
-
"3": {
|
|
793
|
-
$type: "letterSpacing",
|
|
794
|
-
$value: "-0.25%"
|
|
795
|
-
},
|
|
796
|
-
"4": {
|
|
797
|
-
$type: "letterSpacing",
|
|
798
|
-
$value: "-0.15%"
|
|
799
|
-
},
|
|
800
|
-
"5": {
|
|
801
|
-
$type: "letterSpacing",
|
|
802
|
-
$value: "0%"
|
|
803
|
-
},
|
|
804
|
-
"6": {
|
|
805
|
-
$type: "letterSpacing",
|
|
806
|
-
$value: "0.15%"
|
|
807
|
-
},
|
|
808
|
-
"7": {
|
|
809
|
-
$type: "letterSpacing",
|
|
810
|
-
$value: "0.25%"
|
|
811
|
-
},
|
|
812
|
-
"8": {
|
|
813
|
-
$type: "letterSpacing",
|
|
814
|
-
$value: "0.5%"
|
|
815
|
-
},
|
|
816
|
-
"9": {
|
|
817
|
-
$type: "letterSpacing",
|
|
818
|
-
$value: "1.5%"
|
|
819
|
-
}
|
|
820
|
-
};
|
|
821
|
-
var fontSizes = {
|
|
822
|
-
large: {
|
|
823
|
-
"line-height": lineHeights,
|
|
824
|
-
"font-size": {
|
|
825
|
-
"1": {
|
|
826
|
-
$type: "fontSizes",
|
|
827
|
-
$value: "13"
|
|
828
|
-
},
|
|
829
|
-
"2": {
|
|
830
|
-
$type: "fontSizes",
|
|
831
|
-
$value: "16"
|
|
832
|
-
},
|
|
833
|
-
"3": {
|
|
834
|
-
$type: "fontSizes",
|
|
835
|
-
$value: "18"
|
|
836
|
-
},
|
|
837
|
-
"4": {
|
|
838
|
-
$type: "fontSizes",
|
|
839
|
-
$value: "21"
|
|
840
|
-
},
|
|
841
|
-
"5": {
|
|
842
|
-
$type: "fontSizes",
|
|
843
|
-
$value: "24"
|
|
844
|
-
},
|
|
845
|
-
"6": {
|
|
846
|
-
$type: "fontSizes",
|
|
847
|
-
$value: "30"
|
|
848
|
-
},
|
|
849
|
-
"7": {
|
|
850
|
-
$type: "fontSizes",
|
|
851
|
-
$value: "36"
|
|
852
|
-
},
|
|
853
|
-
"8": {
|
|
854
|
-
$type: "fontSizes",
|
|
855
|
-
$value: "48"
|
|
856
|
-
},
|
|
857
|
-
"9": {
|
|
858
|
-
$type: "fontSizes",
|
|
859
|
-
$value: "60"
|
|
860
|
-
},
|
|
861
|
-
"10": {
|
|
862
|
-
$type: "fontSizes",
|
|
863
|
-
$value: "72"
|
|
864
|
-
}
|
|
865
|
-
},
|
|
866
|
-
"letter-spacing": letterSpacings
|
|
867
|
-
},
|
|
868
|
-
medium: {
|
|
869
|
-
"line-height": lineHeights,
|
|
870
|
-
"font-size": {
|
|
871
|
-
"1": {
|
|
872
|
-
$type: "fontSizes",
|
|
873
|
-
$value: "12"
|
|
874
|
-
},
|
|
875
|
-
"2": {
|
|
876
|
-
$type: "fontSizes",
|
|
877
|
-
$value: "14"
|
|
878
|
-
},
|
|
879
|
-
"3": {
|
|
880
|
-
$type: "fontSizes",
|
|
881
|
-
$value: "16"
|
|
882
|
-
},
|
|
883
|
-
"4": {
|
|
884
|
-
$type: "fontSizes",
|
|
885
|
-
$value: "18"
|
|
886
|
-
},
|
|
887
|
-
"5": {
|
|
888
|
-
$type: "fontSizes",
|
|
889
|
-
$value: "21"
|
|
890
|
-
},
|
|
891
|
-
"6": {
|
|
892
|
-
$type: "fontSizes",
|
|
893
|
-
$value: "24"
|
|
894
|
-
},
|
|
895
|
-
"7": {
|
|
896
|
-
$type: "fontSizes",
|
|
897
|
-
$value: "30"
|
|
898
|
-
},
|
|
899
|
-
"8": {
|
|
900
|
-
$type: "fontSizes",
|
|
901
|
-
$value: "36"
|
|
902
|
-
},
|
|
903
|
-
"9": {
|
|
904
|
-
$type: "fontSizes",
|
|
905
|
-
$value: "48"
|
|
906
|
-
},
|
|
907
|
-
"10": {
|
|
908
|
-
$type: "fontSizes",
|
|
909
|
-
$value: "60"
|
|
910
|
-
}
|
|
911
|
-
},
|
|
912
|
-
"letter-spacing": letterSpacings
|
|
913
|
-
},
|
|
914
|
-
small: {
|
|
915
|
-
"line-height": lineHeights,
|
|
916
|
-
"font-size": {
|
|
917
|
-
"1": {
|
|
918
|
-
$type: "fontSizes",
|
|
919
|
-
$value: "11"
|
|
920
|
-
},
|
|
921
|
-
"2": {
|
|
922
|
-
$type: "fontSizes",
|
|
923
|
-
$value: "13"
|
|
924
|
-
},
|
|
925
|
-
"3": {
|
|
926
|
-
$type: "fontSizes",
|
|
927
|
-
$value: "14"
|
|
928
|
-
},
|
|
929
|
-
"4": {
|
|
930
|
-
$type: "fontSizes",
|
|
931
|
-
$value: "16"
|
|
932
|
-
},
|
|
933
|
-
"5": {
|
|
934
|
-
$type: "fontSizes",
|
|
935
|
-
$value: "18"
|
|
936
|
-
},
|
|
937
|
-
"6": {
|
|
938
|
-
$type: "fontSizes",
|
|
939
|
-
$value: "21"
|
|
940
|
-
},
|
|
941
|
-
"7": {
|
|
942
|
-
$type: "fontSizes",
|
|
943
|
-
$value: "24"
|
|
944
|
-
},
|
|
945
|
-
"8": {
|
|
946
|
-
$type: "fontSizes",
|
|
947
|
-
$value: "30"
|
|
948
|
-
},
|
|
949
|
-
"9": {
|
|
950
|
-
$type: "fontSizes",
|
|
951
|
-
$value: "36"
|
|
952
|
-
},
|
|
953
|
-
"10": {
|
|
954
|
-
$type: "fontSizes",
|
|
955
|
-
$value: "48"
|
|
956
|
-
}
|
|
957
|
-
},
|
|
958
|
-
"letter-spacing": letterSpacings
|
|
959
|
-
}
|
|
960
|
-
};
|
|
961
|
-
|
|
962
|
-
// src/tokens/create/generators/semantic/color.ts
|
|
963
|
-
import * as R5 from "ramda";
|
|
964
|
-
var generateSemanticColors = (colors, _themeName) => {
|
|
965
|
-
const mainColorNames = Object.keys(colors.main);
|
|
966
|
-
const supportColorNames = Object.keys(colors.support);
|
|
967
|
-
const customColors = [...mainColorNames, "neutral", ...supportColorNames];
|
|
968
|
-
const allColors = [...customColors, ...baseColorNames];
|
|
969
|
-
const semanticColorTokens = allColors.map((colorName) => [colorName, generateColorScaleTokens(colorName)]);
|
|
970
|
-
return {
|
|
971
|
-
...baseColorTemplate,
|
|
972
|
-
color: {
|
|
973
|
-
...Object.fromEntries(semanticColorTokens),
|
|
974
|
-
...baseColorTemplate.color
|
|
975
|
-
}
|
|
976
|
-
};
|
|
977
|
-
};
|
|
978
|
-
var baseColorTemplate = {
|
|
979
|
-
color: {
|
|
980
|
-
focus: {
|
|
981
|
-
inner: {
|
|
982
|
-
$type: "color",
|
|
983
|
-
$value: "{color.focus.inner-color}"
|
|
984
|
-
},
|
|
985
|
-
outer: {
|
|
986
|
-
$type: "color",
|
|
987
|
-
$value: "{color.focus.outer-color}"
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
},
|
|
991
|
-
link: {
|
|
992
|
-
color: {
|
|
993
|
-
visited: {
|
|
994
|
-
$type: "color",
|
|
995
|
-
$value: "{color.link.visited}"
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
};
|
|
1000
|
-
var generateColorScaleTokens = (colorName) => {
|
|
1001
|
-
const colorScale = {};
|
|
1002
|
-
for (const [colorSemantic, colorNumber] of R5.toPairs(semanticColorMap)) {
|
|
1003
|
-
colorScale[colorSemantic] = {
|
|
1004
|
-
$type: "color",
|
|
1005
|
-
$value: `{color.${colorName}.${colorNumber}}`
|
|
1006
|
-
};
|
|
1007
|
-
}
|
|
1008
|
-
return colorScale;
|
|
1009
|
-
};
|
|
1010
|
-
|
|
1011
|
-
// src/tokens/create/generators/semantic/color-modes.ts
|
|
1012
|
-
var generateColorModes = (colors, _themeName) => {
|
|
1013
|
-
const mainColorNames = Object.keys(colors.main);
|
|
1014
|
-
const supportColorNames = Object.keys(colors.support);
|
|
1015
|
-
const modes = {
|
|
1016
|
-
"main-color": {},
|
|
1017
|
-
"support-color": {}
|
|
1018
|
-
};
|
|
1019
|
-
const categories = [
|
|
1020
|
-
["main-color", mainColorNames],
|
|
1021
|
-
["support-color", supportColorNames]
|
|
1022
|
-
];
|
|
1023
|
-
for (const [colorCategory, colorNames2] of categories) {
|
|
1024
|
-
for (const colorName of colorNames2) {
|
|
1025
|
-
const category = colorCategory.replace("-color", "");
|
|
1026
|
-
const customColorTokens = {
|
|
1027
|
-
color: {
|
|
1028
|
-
[category]: generateColorScaleTokens2(colorName)
|
|
1029
|
-
}
|
|
1030
|
-
};
|
|
1031
|
-
modes[colorCategory][colorName] = customColorTokens;
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
return modes;
|
|
1035
|
-
};
|
|
1036
|
-
var generateColorScaleTokens2 = (colorName) => {
|
|
1037
|
-
const colorScale = {};
|
|
1038
|
-
for (const colorSemantic of semanticColorNames) {
|
|
1039
|
-
colorScale[colorSemantic] = {
|
|
1040
|
-
$type: "color",
|
|
1041
|
-
$value: `{color.${colorName}.${colorSemantic}}`
|
|
1042
|
-
};
|
|
1043
|
-
}
|
|
1044
|
-
return colorScale;
|
|
1045
|
-
};
|
|
1046
|
-
|
|
1047
|
-
// src/tokens/create/generators/semantic/style.ts
|
|
1048
|
-
function generateSemanticStyle() {
|
|
1049
|
-
return {
|
|
1050
|
-
typography: {
|
|
1051
|
-
heading: {
|
|
1052
|
-
"2xl": {
|
|
1053
|
-
$type: "typography",
|
|
1054
|
-
$value: {
|
|
1055
|
-
fontFamily: "{font-family}",
|
|
1056
|
-
fontWeight: "{font-weight.medium}",
|
|
1057
|
-
lineHeight: "{line-height.sm}",
|
|
1058
|
-
fontSize: "{font-size.10}",
|
|
1059
|
-
letterSpacing: "{letter-spacing.1}"
|
|
1060
|
-
}
|
|
1061
|
-
},
|
|
1062
|
-
xl: {
|
|
1063
|
-
$type: "typography",
|
|
1064
|
-
$value: {
|
|
1065
|
-
fontFamily: "{font-family}",
|
|
1066
|
-
fontWeight: "{font-weight.medium}",
|
|
1067
|
-
lineHeight: "{line-height.sm}",
|
|
1068
|
-
fontSize: "{font-size.9}",
|
|
1069
|
-
letterSpacing: "{letter-spacing.1}"
|
|
1070
|
-
}
|
|
1071
|
-
},
|
|
1072
|
-
lg: {
|
|
1073
|
-
$type: "typography",
|
|
1074
|
-
$value: {
|
|
1075
|
-
fontFamily: "{font-family}",
|
|
1076
|
-
fontWeight: "{font-weight.medium}",
|
|
1077
|
-
lineHeight: "{line-height.sm}",
|
|
1078
|
-
fontSize: "{font-size.8}",
|
|
1079
|
-
letterSpacing: "{letter-spacing.2}"
|
|
1080
|
-
}
|
|
1081
|
-
},
|
|
1082
|
-
md: {
|
|
1083
|
-
$type: "typography",
|
|
1084
|
-
$value: {
|
|
1085
|
-
fontFamily: "{font-family}",
|
|
1086
|
-
fontWeight: "{font-weight.medium}",
|
|
1087
|
-
lineHeight: "{line-height.sm}",
|
|
1088
|
-
fontSize: "{font-size.7}",
|
|
1089
|
-
letterSpacing: "{letter-spacing.3}"
|
|
1090
|
-
}
|
|
1091
|
-
},
|
|
1092
|
-
sm: {
|
|
1093
|
-
$type: "typography",
|
|
1094
|
-
$value: {
|
|
1095
|
-
fontFamily: "{font-family}",
|
|
1096
|
-
fontWeight: "{font-weight.medium}",
|
|
1097
|
-
lineHeight: "{line-height.sm}",
|
|
1098
|
-
fontSize: "{font-size.6}",
|
|
1099
|
-
letterSpacing: "{letter-spacing.5}"
|
|
1100
|
-
}
|
|
1101
|
-
},
|
|
1102
|
-
xs: {
|
|
1103
|
-
$type: "typography",
|
|
1104
|
-
$value: {
|
|
1105
|
-
fontFamily: "{font-family}",
|
|
1106
|
-
fontWeight: "{font-weight.medium}",
|
|
1107
|
-
lineHeight: "{line-height.sm}",
|
|
1108
|
-
fontSize: "{font-size.5}",
|
|
1109
|
-
letterSpacing: "{letter-spacing.6}"
|
|
1110
|
-
}
|
|
1111
|
-
},
|
|
1112
|
-
"2xs": {
|
|
1113
|
-
$type: "typography",
|
|
1114
|
-
$value: {
|
|
1115
|
-
fontFamily: "{font-family}",
|
|
1116
|
-
fontWeight: "{font-weight.medium}",
|
|
1117
|
-
lineHeight: "{line-height.sm}",
|
|
1118
|
-
fontSize: "{font-size.4}",
|
|
1119
|
-
letterSpacing: "{letter-spacing.6}"
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
},
|
|
1123
|
-
body: {
|
|
1124
|
-
xl: {
|
|
1125
|
-
$type: "typography",
|
|
1126
|
-
$value: {
|
|
1127
|
-
fontFamily: "{font-family}",
|
|
1128
|
-
fontWeight: "{font-weight.regular}",
|
|
1129
|
-
lineHeight: "{line-height.md}",
|
|
1130
|
-
fontSize: "{font-size.6}",
|
|
1131
|
-
letterSpacing: "{letter-spacing.8}"
|
|
1132
|
-
}
|
|
1133
|
-
},
|
|
1134
|
-
lg: {
|
|
1135
|
-
$type: "typography",
|
|
1136
|
-
$value: {
|
|
1137
|
-
fontFamily: "{font-family}",
|
|
1138
|
-
fontWeight: "{font-weight.regular}",
|
|
1139
|
-
lineHeight: "{line-height.md}",
|
|
1140
|
-
fontSize: "{font-size.5}",
|
|
1141
|
-
letterSpacing: "{letter-spacing.8}"
|
|
1142
|
-
}
|
|
1143
|
-
},
|
|
1144
|
-
md: {
|
|
1145
|
-
$type: "typography",
|
|
1146
|
-
$value: {
|
|
1147
|
-
fontFamily: "{font-family}",
|
|
1148
|
-
fontWeight: "{font-weight.regular}",
|
|
1149
|
-
lineHeight: "{line-height.md}",
|
|
1150
|
-
fontSize: "{font-size.4}",
|
|
1151
|
-
letterSpacing: "{letter-spacing.8}"
|
|
1152
|
-
}
|
|
1153
|
-
},
|
|
1154
|
-
sm: {
|
|
1155
|
-
$type: "typography",
|
|
1156
|
-
$value: {
|
|
1157
|
-
fontFamily: "{font-family}",
|
|
1158
|
-
fontWeight: "{font-weight.regular}",
|
|
1159
|
-
lineHeight: "{line-height.md}",
|
|
1160
|
-
fontSize: "{font-size.3}",
|
|
1161
|
-
letterSpacing: "{letter-spacing.7}"
|
|
1162
|
-
}
|
|
1163
|
-
},
|
|
1164
|
-
xs: {
|
|
1165
|
-
$type: "typography",
|
|
1166
|
-
$value: {
|
|
1167
|
-
fontFamily: "{font-family}",
|
|
1168
|
-
fontWeight: "{font-weight.regular}",
|
|
1169
|
-
lineHeight: "{line-height.md}",
|
|
1170
|
-
fontSize: "{font-size.2}",
|
|
1171
|
-
letterSpacing: "{letter-spacing.6}"
|
|
1172
|
-
}
|
|
1173
|
-
},
|
|
1174
|
-
short: {
|
|
1175
|
-
xl: {
|
|
1176
|
-
$type: "typography",
|
|
1177
|
-
$value: {
|
|
1178
|
-
fontFamily: "{font-family}",
|
|
1179
|
-
fontWeight: "{font-weight.regular}",
|
|
1180
|
-
lineHeight: "{line-height.sm}",
|
|
1181
|
-
fontSize: "{font-size.6}",
|
|
1182
|
-
letterSpacing: "{letter-spacing.8}"
|
|
1183
|
-
}
|
|
1184
|
-
},
|
|
1185
|
-
lg: {
|
|
1186
|
-
$type: "typography",
|
|
1187
|
-
$value: {
|
|
1188
|
-
fontFamily: "{font-family}",
|
|
1189
|
-
fontWeight: "{font-weight.regular}",
|
|
1190
|
-
lineHeight: "{line-height.sm}",
|
|
1191
|
-
fontSize: "{font-size.5}",
|
|
1192
|
-
letterSpacing: "{letter-spacing.8}"
|
|
1193
|
-
}
|
|
1194
|
-
},
|
|
1195
|
-
md: {
|
|
1196
|
-
$type: "typography",
|
|
1197
|
-
$value: {
|
|
1198
|
-
fontFamily: "{font-family}",
|
|
1199
|
-
fontWeight: "{font-weight.regular}",
|
|
1200
|
-
lineHeight: "{line-height.sm}",
|
|
1201
|
-
fontSize: "{font-size.4}",
|
|
1202
|
-
letterSpacing: "{letter-spacing.8}"
|
|
1203
|
-
}
|
|
1204
|
-
},
|
|
1205
|
-
sm: {
|
|
1206
|
-
$type: "typography",
|
|
1207
|
-
$value: {
|
|
1208
|
-
fontFamily: "{font-family}",
|
|
1209
|
-
fontWeight: "{font-weight.regular}",
|
|
1210
|
-
lineHeight: "{line-height.sm}",
|
|
1211
|
-
fontSize: "{font-size.3}",
|
|
1212
|
-
letterSpacing: "{letter-spacing.7}"
|
|
1213
|
-
}
|
|
1214
|
-
},
|
|
1215
|
-
xs: {
|
|
1216
|
-
$type: "typography",
|
|
1217
|
-
$value: {
|
|
1218
|
-
fontFamily: "{font-family}",
|
|
1219
|
-
fontWeight: "{font-weight.regular}",
|
|
1220
|
-
lineHeight: "{line-height.sm}",
|
|
1221
|
-
fontSize: "{font-size.2}",
|
|
1222
|
-
letterSpacing: "{letter-spacing.6}"
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
},
|
|
1226
|
-
long: {
|
|
1227
|
-
xl: {
|
|
1228
|
-
$type: "typography",
|
|
1229
|
-
$value: {
|
|
1230
|
-
fontFamily: "{font-family}",
|
|
1231
|
-
fontWeight: "{font-weight.regular}",
|
|
1232
|
-
lineHeight: "{line-height.lg}",
|
|
1233
|
-
fontSize: "{font-size.6}",
|
|
1234
|
-
letterSpacing: "{letter-spacing.8}"
|
|
1235
|
-
}
|
|
1236
|
-
},
|
|
1237
|
-
lg: {
|
|
1238
|
-
$type: "typography",
|
|
1239
|
-
$value: {
|
|
1240
|
-
fontFamily: "{font-family}",
|
|
1241
|
-
fontWeight: "{font-weight.regular}",
|
|
1242
|
-
lineHeight: "{line-height.lg}",
|
|
1243
|
-
fontSize: "{font-size.5}",
|
|
1244
|
-
letterSpacing: "{letter-spacing.8}"
|
|
1245
|
-
}
|
|
1246
|
-
},
|
|
1247
|
-
md: {
|
|
1248
|
-
$type: "typography",
|
|
1249
|
-
$value: {
|
|
1250
|
-
fontFamily: "{font-family}",
|
|
1251
|
-
fontWeight: "{font-weight.regular}",
|
|
1252
|
-
lineHeight: "{line-height.lg}",
|
|
1253
|
-
fontSize: "{font-size.4}",
|
|
1254
|
-
letterSpacing: "{letter-spacing.8}"
|
|
1255
|
-
}
|
|
1256
|
-
},
|
|
1257
|
-
sm: {
|
|
1258
|
-
$type: "typography",
|
|
1259
|
-
$value: {
|
|
1260
|
-
fontFamily: "{font-family}",
|
|
1261
|
-
fontWeight: "{font-weight.regular}",
|
|
1262
|
-
lineHeight: "{line-height.lg}",
|
|
1263
|
-
fontSize: "{font-size.3}",
|
|
1264
|
-
letterSpacing: "{letter-spacing.7}"
|
|
1265
|
-
}
|
|
1266
|
-
},
|
|
1267
|
-
xs: {
|
|
1268
|
-
$type: "typography",
|
|
1269
|
-
$value: {
|
|
1270
|
-
fontFamily: "{font-family}",
|
|
1271
|
-
fontWeight: "{font-weight.regular}",
|
|
1272
|
-
lineHeight: "{line-height.lg}",
|
|
1273
|
-
fontSize: "{font-size.2}",
|
|
1274
|
-
letterSpacing: "{letter-spacing.6}"
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
},
|
|
1280
|
-
opacity: {
|
|
1281
|
-
disabled: {
|
|
1282
|
-
$type: "opacity",
|
|
1283
|
-
$value: "{opacity.30}"
|
|
1284
|
-
}
|
|
1285
|
-
},
|
|
1286
|
-
"border-width": {
|
|
1287
|
-
default: {
|
|
1288
|
-
$type: "borderWidth",
|
|
1289
|
-
$value: "{border-width.1}"
|
|
1290
|
-
},
|
|
1291
|
-
focus: {
|
|
1292
|
-
$type: "borderWidth",
|
|
1293
|
-
$value: "{border-width.3}"
|
|
1294
|
-
}
|
|
1295
|
-
},
|
|
1296
|
-
shadow: {
|
|
1297
|
-
xs: {
|
|
1298
|
-
$type: "boxShadow",
|
|
1299
|
-
$value: "{shadow.100}"
|
|
1300
|
-
},
|
|
1301
|
-
sm: {
|
|
1302
|
-
$type: "boxShadow",
|
|
1303
|
-
$value: "{shadow.200}"
|
|
1304
|
-
},
|
|
1305
|
-
md: {
|
|
1306
|
-
$type: "boxShadow",
|
|
1307
|
-
$value: "{shadow.300}"
|
|
1308
|
-
},
|
|
1309
|
-
lg: {
|
|
1310
|
-
$type: "boxShadow",
|
|
1311
|
-
$value: "{shadow.400}"
|
|
1312
|
-
},
|
|
1313
|
-
xl: {
|
|
1314
|
-
$type: "boxShadow",
|
|
1315
|
-
$value: "{shadow.500}"
|
|
1316
|
-
}
|
|
1317
|
-
},
|
|
1318
|
-
"border-radius": {
|
|
1319
|
-
sm: {
|
|
1320
|
-
$type: "dimension",
|
|
1321
|
-
$value: "{border-radius.1}"
|
|
1322
|
-
},
|
|
1323
|
-
md: {
|
|
1324
|
-
$type: "dimension",
|
|
1325
|
-
$value: "{border-radius.2}"
|
|
1326
|
-
},
|
|
1327
|
-
lg: {
|
|
1328
|
-
$type: "dimension",
|
|
1329
|
-
$value: "{border-radius.3}"
|
|
1330
|
-
},
|
|
1331
|
-
xl: {
|
|
1332
|
-
$type: "dimension",
|
|
1333
|
-
$value: "{border-radius.4}"
|
|
1334
|
-
},
|
|
1335
|
-
default: {
|
|
1336
|
-
$type: "dimension",
|
|
1337
|
-
$value: "{border-radius.5}"
|
|
1338
|
-
},
|
|
1339
|
-
full: {
|
|
1340
|
-
$type: "dimension",
|
|
1341
|
-
$value: "{border-radius.6}"
|
|
1342
|
-
}
|
|
1343
|
-
},
|
|
1344
|
-
size: {
|
|
1345
|
-
"0": {
|
|
1346
|
-
$type: "dimension",
|
|
1347
|
-
$value: "{_size.0}"
|
|
1348
|
-
},
|
|
1349
|
-
"1": {
|
|
1350
|
-
$type: "dimension",
|
|
1351
|
-
$value: "{_size.1}"
|
|
1352
|
-
},
|
|
1353
|
-
"2": {
|
|
1354
|
-
$type: "dimension",
|
|
1355
|
-
$value: "{_size.2}"
|
|
1356
|
-
},
|
|
1357
|
-
"3": {
|
|
1358
|
-
$type: "dimension",
|
|
1359
|
-
$value: "{_size.3}"
|
|
1360
|
-
},
|
|
1361
|
-
"4": {
|
|
1362
|
-
$type: "dimension",
|
|
1363
|
-
$value: "{_size.4}"
|
|
1364
|
-
},
|
|
1365
|
-
"5": {
|
|
1366
|
-
$type: "dimension",
|
|
1367
|
-
$value: "{_size.5}"
|
|
1368
|
-
},
|
|
1369
|
-
"6": {
|
|
1370
|
-
$type: "dimension",
|
|
1371
|
-
$value: "{_size.6}"
|
|
1372
|
-
},
|
|
1373
|
-
"7": {
|
|
1374
|
-
$type: "dimension",
|
|
1375
|
-
$value: "{_size.7}"
|
|
1376
|
-
},
|
|
1377
|
-
"8": {
|
|
1378
|
-
$type: "dimension",
|
|
1379
|
-
$value: "{_size.8}"
|
|
1380
|
-
},
|
|
1381
|
-
"9": {
|
|
1382
|
-
$type: "dimension",
|
|
1383
|
-
$value: "{_size.9}"
|
|
1384
|
-
},
|
|
1385
|
-
"10": {
|
|
1386
|
-
$type: "dimension",
|
|
1387
|
-
$value: "{_size.10}"
|
|
1388
|
-
},
|
|
1389
|
-
"11": {
|
|
1390
|
-
$type: "dimension",
|
|
1391
|
-
$value: "{_size.11}"
|
|
1392
|
-
},
|
|
1393
|
-
"12": {
|
|
1394
|
-
$type: "dimension",
|
|
1395
|
-
$value: "{_size.12}"
|
|
1396
|
-
},
|
|
1397
|
-
"13": {
|
|
1398
|
-
$type: "dimension",
|
|
1399
|
-
$value: "{_size.13}"
|
|
1400
|
-
},
|
|
1401
|
-
"14": {
|
|
1402
|
-
$type: "dimension",
|
|
1403
|
-
$value: "{_size.14}"
|
|
1404
|
-
},
|
|
1405
|
-
"15": {
|
|
1406
|
-
$type: "dimension",
|
|
1407
|
-
$value: "{_size.15}"
|
|
1408
|
-
},
|
|
1409
|
-
"18": {
|
|
1410
|
-
$type: "dimension",
|
|
1411
|
-
$value: "{_size.18}"
|
|
1412
|
-
},
|
|
1413
|
-
"22": {
|
|
1414
|
-
$type: "dimension",
|
|
1415
|
-
$value: "{_size.22}"
|
|
1416
|
-
},
|
|
1417
|
-
"26": {
|
|
1418
|
-
$type: "dimension",
|
|
1419
|
-
$value: "{_size.26}"
|
|
1420
|
-
},
|
|
1421
|
-
"30": {
|
|
1422
|
-
$type: "dimension",
|
|
1423
|
-
$value: "{_size.30}"
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
};
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
// src/tokens/create/generators/themes/theme.ts
|
|
1430
|
-
import * as R6 from "ramda";
|
|
1431
|
-
var generateTheme = (colors, themeName, borderRadius) => {
|
|
1432
|
-
const mainColorNames = Object.keys(colors.main);
|
|
1433
|
-
const supportColorNames = Object.keys(colors.support);
|
|
1434
|
-
const customColors = [...mainColorNames, "neutral", ...supportColorNames, ...baseColorNames];
|
|
1435
|
-
const themeColorTokens = Object.fromEntries(
|
|
1436
|
-
customColors.map((colorName) => [colorName, generateColorScaleTokens3(colorName, themeName)])
|
|
1437
|
-
);
|
|
1438
|
-
const { color: themeBaseFileColor, ...remainingThemeFile } = generateBase(themeName);
|
|
1439
|
-
const themeFile = {
|
|
1440
|
-
color: {
|
|
1441
|
-
...themeColorTokens,
|
|
1442
|
-
...themeBaseFileColor,
|
|
1443
|
-
link: {
|
|
1444
|
-
visited: {
|
|
1445
|
-
$type: "color",
|
|
1446
|
-
$value: `{${themeName}.link.visited}`
|
|
1447
|
-
}
|
|
1448
|
-
},
|
|
1449
|
-
focus: {
|
|
1450
|
-
"inner-color": {
|
|
1451
|
-
$type: "color",
|
|
1452
|
-
$value: `{${themeName}.focus.inner}`
|
|
1453
|
-
},
|
|
1454
|
-
"outer-color": {
|
|
1455
|
-
$type: "color",
|
|
1456
|
-
$value: `{${themeName}.focus.outer}`
|
|
1457
|
-
}
|
|
1458
|
-
}
|
|
1459
|
-
},
|
|
1460
|
-
...remainingThemeFile
|
|
1461
|
-
};
|
|
1462
|
-
const baseBorderRadius = R6.lensPath(["border-radius", "base", "$value"]);
|
|
1463
|
-
const updatedThemeFile = R6.set(baseBorderRadius, String(borderRadius), themeFile);
|
|
1464
|
-
const token = JSON.parse(
|
|
1465
|
-
JSON.stringify(
|
|
1466
|
-
updatedThemeFile,
|
|
1467
|
-
(key, value) => {
|
|
1468
|
-
if (key === "$value") {
|
|
1469
|
-
return value.replace("<theme>", themeName);
|
|
1470
|
-
}
|
|
1471
|
-
return value;
|
|
1472
|
-
},
|
|
1473
|
-
2
|
|
1474
|
-
)
|
|
1475
|
-
);
|
|
1476
|
-
return token;
|
|
1477
|
-
};
|
|
1478
|
-
var generateBase = (themeName) => ({
|
|
1479
|
-
color: {},
|
|
1480
|
-
"font-family": {
|
|
1481
|
-
$type: "fontFamilies",
|
|
1482
|
-
$value: `{${themeName}.font-family}`
|
|
1483
|
-
},
|
|
1484
|
-
"font-weight": {
|
|
1485
|
-
medium: {
|
|
1486
|
-
$type: "fontWeights",
|
|
1487
|
-
$value: `{${themeName}.font-weight.medium}`
|
|
1488
|
-
},
|
|
1489
|
-
semibold: {
|
|
1490
|
-
$type: "fontWeights",
|
|
1491
|
-
$value: `{${themeName}.font-weight.semibold}`
|
|
1492
|
-
},
|
|
1493
|
-
regular: {
|
|
1494
|
-
$type: "fontWeights",
|
|
1495
|
-
$value: `{${themeName}.font-weight.regular}`
|
|
1496
|
-
}
|
|
1497
|
-
},
|
|
1498
|
-
"border-radius": {
|
|
1499
|
-
"1": {
|
|
1500
|
-
$type: "dimension",
|
|
1501
|
-
$value: "min({border-radius.base}*0.5,{border-radius.scale})"
|
|
1502
|
-
},
|
|
1503
|
-
"2": {
|
|
1504
|
-
$type: "dimension",
|
|
1505
|
-
$value: "min({border-radius.base},{border-radius.scale}*2)"
|
|
1506
|
-
},
|
|
1507
|
-
"3": {
|
|
1508
|
-
$type: "dimension",
|
|
1509
|
-
$value: "min({border-radius.base}*2,{border-radius.scale}*5)"
|
|
1510
|
-
},
|
|
1511
|
-
"4": {
|
|
1512
|
-
$type: "dimension",
|
|
1513
|
-
$value: "min({border-radius.base}*3,{border-radius.scale}*7)"
|
|
1514
|
-
},
|
|
1515
|
-
"5": {
|
|
1516
|
-
$type: "dimension",
|
|
1517
|
-
$value: "{border-radius.base}"
|
|
1518
|
-
},
|
|
1519
|
-
"6": {
|
|
1520
|
-
$type: "dimension",
|
|
1521
|
-
$value: "9999"
|
|
1522
|
-
},
|
|
1523
|
-
base: {
|
|
1524
|
-
$type: "dimension",
|
|
1525
|
-
$value: "4"
|
|
1526
|
-
},
|
|
1527
|
-
scale: {
|
|
1528
|
-
$type: "dimension",
|
|
1529
|
-
$value: "4"
|
|
1530
|
-
}
|
|
1531
|
-
}
|
|
1532
|
-
});
|
|
1533
|
-
var generateColorScaleTokens3 = (colorName, themeName) => {
|
|
1534
|
-
const colorScale = {};
|
|
1535
|
-
for (const [_, colorNumber] of R6.toPairs(semanticColorMap)) {
|
|
1536
|
-
colorScale[colorNumber] = {
|
|
1537
|
-
$type: "color",
|
|
1538
|
-
$value: `{${themeName}.${colorName}.${colorNumber}}`
|
|
1539
|
-
};
|
|
1540
|
-
}
|
|
1541
|
-
return colorScale;
|
|
1542
|
-
};
|
|
1543
|
-
|
|
1544
|
-
// src/tokens/create.ts
|
|
1545
|
-
var cliOptions = {
|
|
1546
|
-
outDir: "out-dir",
|
|
1547
|
-
clean: "clean",
|
|
1548
|
-
tailwind: "tailwind",
|
|
1549
|
-
theme: {
|
|
1550
|
-
colors: {
|
|
1551
|
-
main: "main-colors",
|
|
1552
|
-
support: "support-colors",
|
|
1553
|
-
neutral: "neutral-color"
|
|
1554
|
-
},
|
|
1555
|
-
typography: {
|
|
1556
|
-
fontFamily: "font-family"
|
|
1557
|
-
},
|
|
1558
|
-
borderRadius: "border-radius"
|
|
1559
|
-
}
|
|
1560
|
-
};
|
|
1561
|
-
var createTokens = async (theme) => {
|
|
1562
|
-
const { colors, typography, name, borderRadius, overrides } = theme;
|
|
1563
|
-
const colorSchemes = ["light", "dark"];
|
|
1564
|
-
const sizeModes2 = ["small", "medium", "large"];
|
|
1565
|
-
const tokenSets = new Map([
|
|
1566
|
-
["primitives/globals", generateGlobals()],
|
|
1567
|
-
...sizeModes2.map((size) => [`primitives/modes/size/${size}`, generateSize(size)]),
|
|
1568
|
-
["primitives/modes/size/global", generateSizeGlobal()],
|
|
1569
|
-
...sizeModes2.map((size) => [
|
|
1570
|
-
`primitives/modes/typography/size/${size}`,
|
|
1571
|
-
generateFontSizes(size)
|
|
1572
|
-
]),
|
|
1573
|
-
[`primitives/modes/typography/primary/${name}`, generateTypography(name, typography)],
|
|
1574
|
-
[`primitives/modes/typography/secondary/${name}`, generateTypography(name, typography)],
|
|
1575
|
-
...colorSchemes.flatMap((scheme) => [
|
|
1576
|
-
[`primitives/modes/color-scheme/${scheme}/${name}`, generateColorScheme(name, scheme, colors, overrides)]
|
|
1577
|
-
]),
|
|
1578
|
-
[`themes/${name}`, generateTheme(colors, name, borderRadius)],
|
|
1579
|
-
["semantic/color", generateSemanticColors(colors, name)],
|
|
1580
|
-
// maps out semantic modes, ieg 'semantic/modes/main-color/accent', and 'semantic/modes/support-color/brand1'
|
|
1581
|
-
...Object.entries(generateColorModes(colors, name)).flatMap(
|
|
1582
|
-
([mode, colors2]) => Object.entries(colors2).map(([key, colorSet]) => [`semantic/modes/${mode}/${key}`, colorSet])
|
|
1583
|
-
),
|
|
1584
|
-
[`semantic/style`, generateSemanticStyle()]
|
|
1585
|
-
]);
|
|
1586
|
-
return { tokenSets };
|
|
1587
|
-
};
|
|
1588
|
-
export {
|
|
1589
|
-
cliOptions,
|
|
1590
|
-
createTokens
|
|
1591
|
-
};
|
|
1
|
+
import { generateColorScheme } from "./create/generators/primitives/color-scheme.js";
|
|
2
|
+
import { generateGlobals } from "./create/generators/primitives/globals.js";
|
|
3
|
+
import { generateSize, generateSizeGlobal } from "./create/generators/primitives/size.js";
|
|
4
|
+
import { generateFontSizes, generateTypography } from "./create/generators/primitives/typography.js";
|
|
5
|
+
import { generateSemanticColors } from "./create/generators/semantic/color.js";
|
|
6
|
+
import { generateColorModes } from "./create/generators/semantic/color-modes.js";
|
|
7
|
+
import { generateSemanticStyle } from "./create/generators/semantic/style.js";
|
|
8
|
+
import { generateTheme } from "./create/generators/themes/theme.js";
|
|
9
|
+
//#region src/tokens/create.ts
|
|
10
|
+
const tokenSetDimensions = {
|
|
11
|
+
colorSchemes: ["dark", "light"],
|
|
12
|
+
sizeModes: [
|
|
13
|
+
"small",
|
|
14
|
+
"medium",
|
|
15
|
+
"large"
|
|
16
|
+
]
|
|
17
|
+
};
|
|
18
|
+
const cliOptions = {
|
|
19
|
+
outDir: "out-dir",
|
|
20
|
+
clean: "clean",
|
|
21
|
+
tailwind: "tailwind",
|
|
22
|
+
theme: {
|
|
23
|
+
colors: {
|
|
24
|
+
main: "main-colors",
|
|
25
|
+
support: "support-colors",
|
|
26
|
+
neutral: "neutral-color"
|
|
27
|
+
},
|
|
28
|
+
typography: { fontFamily: "font-family" },
|
|
29
|
+
borderRadius: "border-radius"
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const createTokens = async (theme) => {
|
|
33
|
+
const { colors, typography, name, borderRadius, overrides } = theme;
|
|
34
|
+
const { colorSchemes, sizeModes } = tokenSetDimensions;
|
|
35
|
+
return { tokenSets: new Map([
|
|
36
|
+
["primitives/globals", generateGlobals()],
|
|
37
|
+
...sizeModes.map((size) => [`primitives/modes/size/${size}`, generateSize(size)]),
|
|
38
|
+
["primitives/modes/size/global", generateSizeGlobal()],
|
|
39
|
+
...sizeModes.map((size) => [`primitives/modes/typography/size/${size}`, generateFontSizes(size)]),
|
|
40
|
+
[`primitives/modes/typography/primary/${name}`, generateTypography(name, typography)],
|
|
41
|
+
[`primitives/modes/typography/secondary/${name}`, generateTypography(name, typography)],
|
|
42
|
+
...colorSchemes.flatMap((scheme) => [[`primitives/modes/color-scheme/${scheme}/${name}`, generateColorScheme(name, scheme, colors, overrides)]]),
|
|
43
|
+
[`themes/${name}`, generateTheme(colors, name, borderRadius)],
|
|
44
|
+
["semantic/color", generateSemanticColors(colors, name)],
|
|
45
|
+
...Object.entries(generateColorModes(colors, name)).flatMap(([mode, colors]) => Object.entries(colors).map(([key, colorSet]) => [`semantic/modes/${mode}/${key}`, colorSet])),
|
|
46
|
+
[`semantic/style`, generateSemanticStyle()]
|
|
47
|
+
]) };
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { cliOptions, createTokens, tokenSetDimensions };
|