@digdir/designsystemet 1.11.1 → 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.
- package/dist/bin/config.js +24 -4
- package/dist/bin/designsystemet.js +909 -1220
- package/dist/src/colors/index.js +27 -1
- package/dist/src/colors/types.d.ts +24 -21
- package/dist/src/colors/types.d.ts.map +1 -1
- package/dist/src/colors/types.js +27 -0
- package/dist/src/config.js +24 -4
- package/dist/src/index.js +815 -1119
- package/dist/src/scripts/createJsonSchema.js +24 -4
- package/dist/src/scripts/update-preview-tokens.d.ts.map +1 -1
- package/dist/src/scripts/update-preview-tokens.js +1356 -1662
- package/dist/src/tokens/build.js +4 -5
- package/dist/src/tokens/create/generators/$designsystemet.js +4 -5
- package/dist/src/tokens/create/generators/$metadata.d.ts +2 -2
- package/dist/src/tokens/create/generators/$metadata.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/$metadata.js +3 -7
- package/dist/src/tokens/create/generators/$themes.d.ts +17 -2
- package/dist/src/tokens/create/generators/$themes.d.ts.map +1 -1
- package/dist/src/tokens/create/generators/$themes.js +3 -3
- package/dist/src/tokens/create/generators/primitives/color-scheme.d.ts +5 -0
- package/dist/src/tokens/create/generators/primitives/color-scheme.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/{color.js → primitives/color-scheme.js} +29 -6
- package/dist/src/tokens/create/generators/primitives/globals.d.ts +3 -0
- package/dist/src/tokens/create/generators/primitives/globals.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/primitives/globals.js +148 -0
- package/dist/src/tokens/create/generators/primitives/size.d.ts +4 -0
- package/dist/src/tokens/create/generators/primitives/size.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/primitives/size.js +157 -0
- package/dist/src/tokens/create/generators/primitives/typography.d.ts +4 -0
- package/dist/src/tokens/create/generators/primitives/typography.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/primitives/typography.js +220 -0
- package/dist/src/tokens/create/generators/semantic/color-modes.d.ts +8 -0
- package/dist/src/tokens/create/generators/semantic/color-modes.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/semantic/color-modes.js +61 -0
- package/dist/src/tokens/create/generators/semantic/color.d.ts +5 -0
- package/dist/src/tokens/create/generators/semantic/color.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/{semantic.js → semantic/color.js} +50 -194
- package/dist/src/tokens/create/generators/semantic/style.d.ts +3 -0
- package/dist/src/tokens/create/generators/semantic/style.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/semantic/style.js +384 -0
- package/dist/src/tokens/create/generators/{theme.d.ts → themes/theme.d.ts} +1 -1
- package/dist/src/tokens/create/generators/themes/theme.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/{theme.js → themes/theme.js} +87 -129
- package/dist/src/tokens/create/write.d.ts.map +1 -1
- package/dist/src/tokens/create/write.js +13 -17
- package/dist/src/tokens/create.d.ts +1 -1
- package/dist/src/tokens/create.d.ts.map +1 -1
- package/dist/src/tokens/create.js +1340 -1647
- package/dist/src/tokens/format.d.ts.map +1 -1
- package/dist/src/tokens/format.js +1360 -1667
- package/dist/src/tokens/index.js +1360 -1667
- package/dist/src/tokens/process/output/declarations.js +4 -5
- package/dist/src/tokens/process/output/theme.js +4 -5
- package/dist/src/tokens/types.d.ts +7 -0
- package/dist/src/tokens/types.d.ts.map +1 -1
- package/package.json +5 -6
- package/dist/color.base.template-Z7YWN2TF.json +0 -22
- package/dist/color.template-LMPUQ72A.json +0 -66
- package/dist/color.template-XQNSHLTU.json +0 -66
- package/dist/global-Y35YADVH.json +0 -100
- package/dist/globals-76VAFMDF.json +0 -143
- package/dist/large-CIIHO7AY.json +0 -96
- package/dist/large-UUOZ6DYI.json +0 -16
- package/dist/medium-OQ7S7P4P.json +0 -16
- package/dist/medium-VSB2S4X3.json +0 -96
- package/dist/small-AEXJ6U7Z.json +0 -96
- package/dist/small-ZY4KOJWX.json +0 -16
- package/dist/src/scripts/update-template.d.ts +0 -2
- package/dist/src/scripts/update-template.d.ts.map +0 -1
- package/dist/src/scripts/update-template.js +0 -1366
- package/dist/src/tokens/create/defaults.d.ts +0 -7
- package/dist/src/tokens/create/defaults.d.ts.map +0 -1
- package/dist/src/tokens/create/defaults.js +0 -998
- package/dist/src/tokens/create/generators/color.d.ts +0 -5
- package/dist/src/tokens/create/generators/color.d.ts.map +0 -1
- package/dist/src/tokens/create/generators/semantic.d.ts +0 -32
- package/dist/src/tokens/create/generators/semantic.d.ts.map +0 -1
- package/dist/src/tokens/create/generators/theme.d.ts.map +0 -1
- package/dist/src/tokens/create/generators/typography.d.ts +0 -3
- package/dist/src/tokens/create/generators/typography.d.ts.map +0 -1
- package/dist/src/tokens/create/generators/typography.js +0 -33
- package/dist/src/tokens/template/design-tokens/primitives/globals.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/size/global.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/size/large.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/size/medium.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/size/small.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/large.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/medium.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/small.js +0 -5
- package/dist/src/tokens/template/design-tokens/primitives/modes/typography/typography.template.js +0 -5
- package/dist/src/tokens/template/design-tokens/semantic/color.base.template.js +0 -5
- package/dist/src/tokens/template/design-tokens/semantic/color.template.js +0 -5
- package/dist/src/tokens/template/design-tokens/semantic/modes/color.template.js +0 -5
- package/dist/src/tokens/template/design-tokens/semantic/style.js +0 -5
- package/dist/src/tokens/template/design-tokens/themes/theme.base.template.js +0 -5
- package/dist/src/tokens/template/design-tokens/themes/theme.template.js +0 -5
- package/dist/style-FP5XVCUD.json +0 -378
- package/dist/theme.base.template-Y4RMFBQY.json +0 -55
- package/dist/theme.template-CTQRNOMO.json +0 -66
- package/dist/typography.template-4N5YLH7F.json +0 -22
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
// src/tokens/create/generators/semantic/style.ts
|
|
2
|
+
function generateSemanticStyle() {
|
|
3
|
+
return {
|
|
4
|
+
typography: {
|
|
5
|
+
heading: {
|
|
6
|
+
"2xl": {
|
|
7
|
+
$type: "typography",
|
|
8
|
+
$value: {
|
|
9
|
+
fontFamily: "{font-family}",
|
|
10
|
+
fontWeight: "{font-weight.medium}",
|
|
11
|
+
lineHeight: "{line-height.sm}",
|
|
12
|
+
fontSize: "{font-size.10}",
|
|
13
|
+
letterSpacing: "{letter-spacing.1}"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
xl: {
|
|
17
|
+
$type: "typography",
|
|
18
|
+
$value: {
|
|
19
|
+
fontFamily: "{font-family}",
|
|
20
|
+
fontWeight: "{font-weight.medium}",
|
|
21
|
+
lineHeight: "{line-height.sm}",
|
|
22
|
+
fontSize: "{font-size.9}",
|
|
23
|
+
letterSpacing: "{letter-spacing.1}"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
lg: {
|
|
27
|
+
$type: "typography",
|
|
28
|
+
$value: {
|
|
29
|
+
fontFamily: "{font-family}",
|
|
30
|
+
fontWeight: "{font-weight.medium}",
|
|
31
|
+
lineHeight: "{line-height.sm}",
|
|
32
|
+
fontSize: "{font-size.8}",
|
|
33
|
+
letterSpacing: "{letter-spacing.2}"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
md: {
|
|
37
|
+
$type: "typography",
|
|
38
|
+
$value: {
|
|
39
|
+
fontFamily: "{font-family}",
|
|
40
|
+
fontWeight: "{font-weight.medium}",
|
|
41
|
+
lineHeight: "{line-height.sm}",
|
|
42
|
+
fontSize: "{font-size.7}",
|
|
43
|
+
letterSpacing: "{letter-spacing.3}"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
sm: {
|
|
47
|
+
$type: "typography",
|
|
48
|
+
$value: {
|
|
49
|
+
fontFamily: "{font-family}",
|
|
50
|
+
fontWeight: "{font-weight.medium}",
|
|
51
|
+
lineHeight: "{line-height.sm}",
|
|
52
|
+
fontSize: "{font-size.6}",
|
|
53
|
+
letterSpacing: "{letter-spacing.5}"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
xs: {
|
|
57
|
+
$type: "typography",
|
|
58
|
+
$value: {
|
|
59
|
+
fontFamily: "{font-family}",
|
|
60
|
+
fontWeight: "{font-weight.medium}",
|
|
61
|
+
lineHeight: "{line-height.sm}",
|
|
62
|
+
fontSize: "{font-size.5}",
|
|
63
|
+
letterSpacing: "{letter-spacing.6}"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"2xs": {
|
|
67
|
+
$type: "typography",
|
|
68
|
+
$value: {
|
|
69
|
+
fontFamily: "{font-family}",
|
|
70
|
+
fontWeight: "{font-weight.medium}",
|
|
71
|
+
lineHeight: "{line-height.sm}",
|
|
72
|
+
fontSize: "{font-size.4}",
|
|
73
|
+
letterSpacing: "{letter-spacing.6}"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
body: {
|
|
78
|
+
xl: {
|
|
79
|
+
$type: "typography",
|
|
80
|
+
$value: {
|
|
81
|
+
fontFamily: "{font-family}",
|
|
82
|
+
fontWeight: "{font-weight.regular}",
|
|
83
|
+
lineHeight: "{line-height.md}",
|
|
84
|
+
fontSize: "{font-size.6}",
|
|
85
|
+
letterSpacing: "{letter-spacing.8}"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
lg: {
|
|
89
|
+
$type: "typography",
|
|
90
|
+
$value: {
|
|
91
|
+
fontFamily: "{font-family}",
|
|
92
|
+
fontWeight: "{font-weight.regular}",
|
|
93
|
+
lineHeight: "{line-height.md}",
|
|
94
|
+
fontSize: "{font-size.5}",
|
|
95
|
+
letterSpacing: "{letter-spacing.8}"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
md: {
|
|
99
|
+
$type: "typography",
|
|
100
|
+
$value: {
|
|
101
|
+
fontFamily: "{font-family}",
|
|
102
|
+
fontWeight: "{font-weight.regular}",
|
|
103
|
+
lineHeight: "{line-height.md}",
|
|
104
|
+
fontSize: "{font-size.4}",
|
|
105
|
+
letterSpacing: "{letter-spacing.8}"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
sm: {
|
|
109
|
+
$type: "typography",
|
|
110
|
+
$value: {
|
|
111
|
+
fontFamily: "{font-family}",
|
|
112
|
+
fontWeight: "{font-weight.regular}",
|
|
113
|
+
lineHeight: "{line-height.md}",
|
|
114
|
+
fontSize: "{font-size.3}",
|
|
115
|
+
letterSpacing: "{letter-spacing.7}"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
xs: {
|
|
119
|
+
$type: "typography",
|
|
120
|
+
$value: {
|
|
121
|
+
fontFamily: "{font-family}",
|
|
122
|
+
fontWeight: "{font-weight.regular}",
|
|
123
|
+
lineHeight: "{line-height.md}",
|
|
124
|
+
fontSize: "{font-size.2}",
|
|
125
|
+
letterSpacing: "{letter-spacing.6}"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
short: {
|
|
129
|
+
xl: {
|
|
130
|
+
$type: "typography",
|
|
131
|
+
$value: {
|
|
132
|
+
fontFamily: "{font-family}",
|
|
133
|
+
fontWeight: "{font-weight.regular}",
|
|
134
|
+
lineHeight: "{line-height.sm}",
|
|
135
|
+
fontSize: "{font-size.6}",
|
|
136
|
+
letterSpacing: "{letter-spacing.8}"
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
lg: {
|
|
140
|
+
$type: "typography",
|
|
141
|
+
$value: {
|
|
142
|
+
fontFamily: "{font-family}",
|
|
143
|
+
fontWeight: "{font-weight.regular}",
|
|
144
|
+
lineHeight: "{line-height.sm}",
|
|
145
|
+
fontSize: "{font-size.5}",
|
|
146
|
+
letterSpacing: "{letter-spacing.8}"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
md: {
|
|
150
|
+
$type: "typography",
|
|
151
|
+
$value: {
|
|
152
|
+
fontFamily: "{font-family}",
|
|
153
|
+
fontWeight: "{font-weight.regular}",
|
|
154
|
+
lineHeight: "{line-height.sm}",
|
|
155
|
+
fontSize: "{font-size.4}",
|
|
156
|
+
letterSpacing: "{letter-spacing.8}"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
sm: {
|
|
160
|
+
$type: "typography",
|
|
161
|
+
$value: {
|
|
162
|
+
fontFamily: "{font-family}",
|
|
163
|
+
fontWeight: "{font-weight.regular}",
|
|
164
|
+
lineHeight: "{line-height.sm}",
|
|
165
|
+
fontSize: "{font-size.3}",
|
|
166
|
+
letterSpacing: "{letter-spacing.7}"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
xs: {
|
|
170
|
+
$type: "typography",
|
|
171
|
+
$value: {
|
|
172
|
+
fontFamily: "{font-family}",
|
|
173
|
+
fontWeight: "{font-weight.regular}",
|
|
174
|
+
lineHeight: "{line-height.sm}",
|
|
175
|
+
fontSize: "{font-size.2}",
|
|
176
|
+
letterSpacing: "{letter-spacing.6}"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
long: {
|
|
181
|
+
xl: {
|
|
182
|
+
$type: "typography",
|
|
183
|
+
$value: {
|
|
184
|
+
fontFamily: "{font-family}",
|
|
185
|
+
fontWeight: "{font-weight.regular}",
|
|
186
|
+
lineHeight: "{line-height.lg}",
|
|
187
|
+
fontSize: "{font-size.6}",
|
|
188
|
+
letterSpacing: "{letter-spacing.8}"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
lg: {
|
|
192
|
+
$type: "typography",
|
|
193
|
+
$value: {
|
|
194
|
+
fontFamily: "{font-family}",
|
|
195
|
+
fontWeight: "{font-weight.regular}",
|
|
196
|
+
lineHeight: "{line-height.lg}",
|
|
197
|
+
fontSize: "{font-size.5}",
|
|
198
|
+
letterSpacing: "{letter-spacing.8}"
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
md: {
|
|
202
|
+
$type: "typography",
|
|
203
|
+
$value: {
|
|
204
|
+
fontFamily: "{font-family}",
|
|
205
|
+
fontWeight: "{font-weight.regular}",
|
|
206
|
+
lineHeight: "{line-height.lg}",
|
|
207
|
+
fontSize: "{font-size.4}",
|
|
208
|
+
letterSpacing: "{letter-spacing.8}"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
sm: {
|
|
212
|
+
$type: "typography",
|
|
213
|
+
$value: {
|
|
214
|
+
fontFamily: "{font-family}",
|
|
215
|
+
fontWeight: "{font-weight.regular}",
|
|
216
|
+
lineHeight: "{line-height.lg}",
|
|
217
|
+
fontSize: "{font-size.3}",
|
|
218
|
+
letterSpacing: "{letter-spacing.7}"
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
xs: {
|
|
222
|
+
$type: "typography",
|
|
223
|
+
$value: {
|
|
224
|
+
fontFamily: "{font-family}",
|
|
225
|
+
fontWeight: "{font-weight.regular}",
|
|
226
|
+
lineHeight: "{line-height.lg}",
|
|
227
|
+
fontSize: "{font-size.2}",
|
|
228
|
+
letterSpacing: "{letter-spacing.6}"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
opacity: {
|
|
235
|
+
disabled: {
|
|
236
|
+
$type: "opacity",
|
|
237
|
+
$value: "{opacity.30}"
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
"border-width": {
|
|
241
|
+
default: {
|
|
242
|
+
$type: "borderWidth",
|
|
243
|
+
$value: "{border-width.1}"
|
|
244
|
+
},
|
|
245
|
+
focus: {
|
|
246
|
+
$type: "borderWidth",
|
|
247
|
+
$value: "{border-width.3}"
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
shadow: {
|
|
251
|
+
xs: {
|
|
252
|
+
$type: "boxShadow",
|
|
253
|
+
$value: "{shadow.100}"
|
|
254
|
+
},
|
|
255
|
+
sm: {
|
|
256
|
+
$type: "boxShadow",
|
|
257
|
+
$value: "{shadow.200}"
|
|
258
|
+
},
|
|
259
|
+
md: {
|
|
260
|
+
$type: "boxShadow",
|
|
261
|
+
$value: "{shadow.300}"
|
|
262
|
+
},
|
|
263
|
+
lg: {
|
|
264
|
+
$type: "boxShadow",
|
|
265
|
+
$value: "{shadow.400}"
|
|
266
|
+
},
|
|
267
|
+
xl: {
|
|
268
|
+
$type: "boxShadow",
|
|
269
|
+
$value: "{shadow.500}"
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
"border-radius": {
|
|
273
|
+
sm: {
|
|
274
|
+
$type: "dimension",
|
|
275
|
+
$value: "{border-radius.1}"
|
|
276
|
+
},
|
|
277
|
+
md: {
|
|
278
|
+
$type: "dimension",
|
|
279
|
+
$value: "{border-radius.2}"
|
|
280
|
+
},
|
|
281
|
+
lg: {
|
|
282
|
+
$type: "dimension",
|
|
283
|
+
$value: "{border-radius.3}"
|
|
284
|
+
},
|
|
285
|
+
xl: {
|
|
286
|
+
$type: "dimension",
|
|
287
|
+
$value: "{border-radius.4}"
|
|
288
|
+
},
|
|
289
|
+
default: {
|
|
290
|
+
$type: "dimension",
|
|
291
|
+
$value: "{border-radius.5}"
|
|
292
|
+
},
|
|
293
|
+
full: {
|
|
294
|
+
$type: "dimension",
|
|
295
|
+
$value: "{border-radius.6}"
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
size: {
|
|
299
|
+
"0": {
|
|
300
|
+
$type: "dimension",
|
|
301
|
+
$value: "{_size.0}"
|
|
302
|
+
},
|
|
303
|
+
"1": {
|
|
304
|
+
$type: "dimension",
|
|
305
|
+
$value: "{_size.1}"
|
|
306
|
+
},
|
|
307
|
+
"2": {
|
|
308
|
+
$type: "dimension",
|
|
309
|
+
$value: "{_size.2}"
|
|
310
|
+
},
|
|
311
|
+
"3": {
|
|
312
|
+
$type: "dimension",
|
|
313
|
+
$value: "{_size.3}"
|
|
314
|
+
},
|
|
315
|
+
"4": {
|
|
316
|
+
$type: "dimension",
|
|
317
|
+
$value: "{_size.4}"
|
|
318
|
+
},
|
|
319
|
+
"5": {
|
|
320
|
+
$type: "dimension",
|
|
321
|
+
$value: "{_size.5}"
|
|
322
|
+
},
|
|
323
|
+
"6": {
|
|
324
|
+
$type: "dimension",
|
|
325
|
+
$value: "{_size.6}"
|
|
326
|
+
},
|
|
327
|
+
"7": {
|
|
328
|
+
$type: "dimension",
|
|
329
|
+
$value: "{_size.7}"
|
|
330
|
+
},
|
|
331
|
+
"8": {
|
|
332
|
+
$type: "dimension",
|
|
333
|
+
$value: "{_size.8}"
|
|
334
|
+
},
|
|
335
|
+
"9": {
|
|
336
|
+
$type: "dimension",
|
|
337
|
+
$value: "{_size.9}"
|
|
338
|
+
},
|
|
339
|
+
"10": {
|
|
340
|
+
$type: "dimension",
|
|
341
|
+
$value: "{_size.10}"
|
|
342
|
+
},
|
|
343
|
+
"11": {
|
|
344
|
+
$type: "dimension",
|
|
345
|
+
$value: "{_size.11}"
|
|
346
|
+
},
|
|
347
|
+
"12": {
|
|
348
|
+
$type: "dimension",
|
|
349
|
+
$value: "{_size.12}"
|
|
350
|
+
},
|
|
351
|
+
"13": {
|
|
352
|
+
$type: "dimension",
|
|
353
|
+
$value: "{_size.13}"
|
|
354
|
+
},
|
|
355
|
+
"14": {
|
|
356
|
+
$type: "dimension",
|
|
357
|
+
$value: "{_size.14}"
|
|
358
|
+
},
|
|
359
|
+
"15": {
|
|
360
|
+
$type: "dimension",
|
|
361
|
+
$value: "{_size.15}"
|
|
362
|
+
},
|
|
363
|
+
"18": {
|
|
364
|
+
$type: "dimension",
|
|
365
|
+
$value: "{_size.18}"
|
|
366
|
+
},
|
|
367
|
+
"22": {
|
|
368
|
+
$type: "dimension",
|
|
369
|
+
$value: "{_size.22}"
|
|
370
|
+
},
|
|
371
|
+
"26": {
|
|
372
|
+
$type: "dimension",
|
|
373
|
+
$value: "{_size.26}"
|
|
374
|
+
},
|
|
375
|
+
"30": {
|
|
376
|
+
$type: "dimension",
|
|
377
|
+
$value: "{_size.30}"
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
export {
|
|
383
|
+
generateSemanticStyle
|
|
384
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../../src/tokens/create/generators/themes/theme.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAS,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEjE,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,EAAE,WAAW,MAAM,EAAE,cAAc,MAAM,aAmDpF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// src/tokens/create/generators/theme.ts
|
|
2
|
-
import * as
|
|
1
|
+
// src/tokens/create/generators/themes/theme.ts
|
|
2
|
+
import * as R3 from "ramda";
|
|
3
3
|
|
|
4
4
|
// src/colors/colorMetadata.ts
|
|
5
5
|
import * as R from "ramda";
|
|
@@ -255,25 +255,95 @@ 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/
|
|
259
|
-
|
|
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/themes/theme.ts
|
|
282
|
+
var generateTheme = (colors, themeName, borderRadius) => {
|
|
283
|
+
const mainColorNames = Object.keys(colors.main);
|
|
284
|
+
const supportColorNames = Object.keys(colors.support);
|
|
285
|
+
const customColors = [...mainColorNames, "neutral", ...supportColorNames, ...baseColorNames];
|
|
286
|
+
const themeColorTokens = Object.fromEntries(
|
|
287
|
+
customColors.map((colorName) => [colorName, generateColorScaleTokens(colorName, themeName)])
|
|
288
|
+
);
|
|
289
|
+
const { color: themeBaseFileColor, ...remainingThemeFile } = generateBase(themeName);
|
|
290
|
+
const themeFile = {
|
|
291
|
+
color: {
|
|
292
|
+
...themeColorTokens,
|
|
293
|
+
...themeBaseFileColor,
|
|
294
|
+
link: {
|
|
295
|
+
visited: {
|
|
296
|
+
$type: "color",
|
|
297
|
+
$value: `{${themeName}.link.visited}`
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
focus: {
|
|
301
|
+
"inner-color": {
|
|
302
|
+
$type: "color",
|
|
303
|
+
$value: `{${themeName}.focus.inner}`
|
|
304
|
+
},
|
|
305
|
+
"outer-color": {
|
|
306
|
+
$type: "color",
|
|
307
|
+
$value: `{${themeName}.focus.outer}`
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
...remainingThemeFile
|
|
312
|
+
};
|
|
313
|
+
const baseBorderRadius = R3.lensPath(["border-radius", "base", "$value"]);
|
|
314
|
+
const updatedThemeFile = R3.set(baseBorderRadius, String(borderRadius), themeFile);
|
|
315
|
+
const token = JSON.parse(
|
|
316
|
+
JSON.stringify(
|
|
317
|
+
updatedThemeFile,
|
|
318
|
+
(key, value) => {
|
|
319
|
+
if (key === "$value") {
|
|
320
|
+
return value.replace("<theme>", themeName);
|
|
321
|
+
}
|
|
322
|
+
return value;
|
|
323
|
+
},
|
|
324
|
+
2
|
|
325
|
+
)
|
|
326
|
+
);
|
|
327
|
+
return token;
|
|
328
|
+
};
|
|
329
|
+
var generateBase = (themeName) => ({
|
|
260
330
|
color: {},
|
|
261
331
|
"font-family": {
|
|
262
332
|
$type: "fontFamilies",
|
|
263
|
-
$value:
|
|
333
|
+
$value: `{${themeName}.font-family}`
|
|
264
334
|
},
|
|
265
335
|
"font-weight": {
|
|
266
336
|
medium: {
|
|
267
337
|
$type: "fontWeights",
|
|
268
|
-
$value:
|
|
338
|
+
$value: `{${themeName}.font-weight.medium}`
|
|
269
339
|
},
|
|
270
340
|
semibold: {
|
|
271
341
|
$type: "fontWeights",
|
|
272
|
-
$value:
|
|
342
|
+
$value: `{${themeName}.font-weight.semibold}`
|
|
273
343
|
},
|
|
274
344
|
regular: {
|
|
275
345
|
$type: "fontWeights",
|
|
276
|
-
$value:
|
|
346
|
+
$value: `{${themeName}.font-weight.regular}`
|
|
277
347
|
}
|
|
278
348
|
},
|
|
279
349
|
"border-radius": {
|
|
@@ -310,128 +380,16 @@ var theme_base_template_default = {
|
|
|
310
380
|
$value: "4"
|
|
311
381
|
}
|
|
312
382
|
}
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
"2": {
|
|
322
|
-
$type: "color",
|
|
323
|
-
$value: "{<theme>.<color>.2}"
|
|
324
|
-
},
|
|
325
|
-
"3": {
|
|
326
|
-
$type: "color",
|
|
327
|
-
$value: "{<theme>.<color>.3}"
|
|
328
|
-
},
|
|
329
|
-
"4": {
|
|
330
|
-
$type: "color",
|
|
331
|
-
$value: "{<theme>.<color>.4}"
|
|
332
|
-
},
|
|
333
|
-
"5": {
|
|
334
|
-
$type: "color",
|
|
335
|
-
$value: "{<theme>.<color>.5}"
|
|
336
|
-
},
|
|
337
|
-
"6": {
|
|
338
|
-
$type: "color",
|
|
339
|
-
$value: "{<theme>.<color>.6}"
|
|
340
|
-
},
|
|
341
|
-
"7": {
|
|
342
|
-
$type: "color",
|
|
343
|
-
$value: "{<theme>.<color>.7}"
|
|
344
|
-
},
|
|
345
|
-
"8": {
|
|
346
|
-
$type: "color",
|
|
347
|
-
$value: "{<theme>.<color>.8}"
|
|
348
|
-
},
|
|
349
|
-
"9": {
|
|
350
|
-
$type: "color",
|
|
351
|
-
$value: "{<theme>.<color>.9}"
|
|
352
|
-
},
|
|
353
|
-
"10": {
|
|
354
|
-
$type: "color",
|
|
355
|
-
$value: "{<theme>.<color>.10}"
|
|
356
|
-
},
|
|
357
|
-
"11": {
|
|
358
|
-
$type: "color",
|
|
359
|
-
$value: "{<theme>.<color>.11}"
|
|
360
|
-
},
|
|
361
|
-
"12": {
|
|
362
|
-
$type: "color",
|
|
363
|
-
$value: "{<theme>.<color>.12}"
|
|
364
|
-
},
|
|
365
|
-
"13": {
|
|
366
|
-
$type: "color",
|
|
367
|
-
$value: "{<theme>.<color>.13}"
|
|
368
|
-
},
|
|
369
|
-
"14": {
|
|
370
|
-
$type: "color",
|
|
371
|
-
$value: "{<theme>.<color>.14}"
|
|
372
|
-
},
|
|
373
|
-
"15": {
|
|
374
|
-
$type: "color",
|
|
375
|
-
$value: "{<theme>.<color>.15}"
|
|
376
|
-
},
|
|
377
|
-
"16": {
|
|
378
|
-
$type: "color",
|
|
379
|
-
$value: "{<theme>.<color>.16}"
|
|
383
|
+
});
|
|
384
|
+
var generateColorScaleTokens = (colorName, themeName) => {
|
|
385
|
+
const colorScale = {};
|
|
386
|
+
for (const [_, colorNumber] of R3.toPairs(semanticColorMap)) {
|
|
387
|
+
colorScale[colorNumber] = {
|
|
388
|
+
$type: "color",
|
|
389
|
+
$value: `{${themeName}.${colorName}.${colorNumber}}`
|
|
390
|
+
};
|
|
380
391
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
// src/tokens/create/generators/theme.ts
|
|
384
|
-
var generateTheme = (colors, themeName, borderRadius) => {
|
|
385
|
-
const mainColorNames = Object.keys(colors.main);
|
|
386
|
-
const supportColorNames = Object.keys(colors.support);
|
|
387
|
-
const customColors = [...mainColorNames, "neutral", ...supportColorNames, ...baseColorNames];
|
|
388
|
-
const themeColorTokens = Object.fromEntries(
|
|
389
|
-
customColors.map(
|
|
390
|
-
(colorName) => [
|
|
391
|
-
colorName,
|
|
392
|
-
R2.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), theme_template_default)
|
|
393
|
-
]
|
|
394
|
-
)
|
|
395
|
-
);
|
|
396
|
-
const { color: themeBaseFileColor, ...remainingThemeFile } = theme_base_template_default;
|
|
397
|
-
const themeFile = {
|
|
398
|
-
color: {
|
|
399
|
-
...themeColorTokens,
|
|
400
|
-
...themeBaseFileColor,
|
|
401
|
-
link: {
|
|
402
|
-
visited: {
|
|
403
|
-
$type: "color",
|
|
404
|
-
$value: `{${themeName}.link.visited}`
|
|
405
|
-
}
|
|
406
|
-
},
|
|
407
|
-
focus: {
|
|
408
|
-
"inner-color": {
|
|
409
|
-
$type: "color",
|
|
410
|
-
$value: `{${themeName}.focus.inner}`
|
|
411
|
-
},
|
|
412
|
-
"outer-color": {
|
|
413
|
-
$type: "color",
|
|
414
|
-
$value: `{${themeName}.focus.outer}`
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
},
|
|
418
|
-
...remainingThemeFile
|
|
419
|
-
};
|
|
420
|
-
const baseBorderRadius = R2.lensPath(["border-radius", "base", "$value"]);
|
|
421
|
-
const updatedThemeFile = R2.set(baseBorderRadius, String(borderRadius), themeFile);
|
|
422
|
-
const token = JSON.parse(
|
|
423
|
-
JSON.stringify(
|
|
424
|
-
updatedThemeFile,
|
|
425
|
-
(key, value) => {
|
|
426
|
-
if (key === "$value") {
|
|
427
|
-
return value.replace("<theme>", themeName);
|
|
428
|
-
}
|
|
429
|
-
return value;
|
|
430
|
-
},
|
|
431
|
-
2
|
|
432
|
-
)
|
|
433
|
-
);
|
|
434
|
-
return token;
|
|
392
|
+
return colorScale;
|
|
435
393
|
};
|
|
436
394
|
export {
|
|
437
395
|
generateTheme
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../../../src/tokens/create/write.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../../../src/tokens/create/write.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAa,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAK/D,eAAO,MAAM,SAAS,GAAI,MAAM,OAAO,WAAkC,CAAC;AAE1E,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,wCAAwC;IACxC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAU,SAAS,kBAAkB,kBAuD5D,CAAC"}
|