@digdir/designsystemet 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/config.js +24 -4
- package/dist/bin/designsystemet.js +912 -1223
- 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 +818 -1122
- 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 +1363 -1667
- package/dist/src/tokens/build.js +7 -8
- package/dist/src/tokens/create/generators/$designsystemet.js +7 -8
- 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 +16 -20
- 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 +1363 -1670
- package/dist/src/tokens/index.js +1363 -1670
- package/dist/src/tokens/process/output/declarations.js +7 -8
- package/dist/src/tokens/process/output/theme.js +7 -8
- package/dist/src/tokens/types.d.ts +7 -0
- package/dist/src/tokens/types.d.ts.map +1 -1
- package/package.json +8 -9
- 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
package/dist/src/tokens/index.js
CHANGED
|
@@ -1,1659 +1,1498 @@
|
|
|
1
|
-
// src/tokens/create/
|
|
2
|
-
import * as
|
|
1
|
+
// src/tokens/create/generators/primitives/color-scheme.ts
|
|
2
|
+
import * as R4 from "ramda";
|
|
3
3
|
|
|
4
|
-
// src/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
// src/colors/colorMetadata.ts
|
|
5
|
+
import * as R from "ramda";
|
|
6
|
+
var baseColors = {
|
|
7
|
+
info: "#0A71C0",
|
|
8
|
+
success: "#068718",
|
|
9
|
+
warning: "#EA9B1B",
|
|
10
|
+
danger: "#C01B1B"
|
|
11
|
+
};
|
|
12
|
+
var dsLinkColor = "#663299";
|
|
13
|
+
var colorMetadata = {
|
|
14
|
+
"background-default": {
|
|
15
|
+
number: 1,
|
|
16
|
+
name: "background-default",
|
|
17
|
+
group: "background",
|
|
18
|
+
displayName: "Background Default",
|
|
19
|
+
description: {
|
|
20
|
+
long: "Background Default er den mest n\xF8ytrale bakgrunnsfargen.",
|
|
21
|
+
short: "Standard bakgrunnsfarge."
|
|
10
22
|
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
23
|
+
luminance: {
|
|
24
|
+
light: 1,
|
|
25
|
+
dark: 9e-3,
|
|
26
|
+
contrast: 1e-3
|
|
14
27
|
}
|
|
15
28
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
blur: "1",
|
|
25
|
-
spread: "0"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
x: "0",
|
|
29
|
-
y: "1",
|
|
30
|
-
blur: "2",
|
|
31
|
-
spread: "0",
|
|
32
|
-
color: "rgba(0,0,0,0.12)"
|
|
33
|
-
}
|
|
34
|
-
]
|
|
29
|
+
"background-tinted": {
|
|
30
|
+
number: 2,
|
|
31
|
+
name: "background-tinted",
|
|
32
|
+
group: "background",
|
|
33
|
+
displayName: "Background Tinted",
|
|
34
|
+
description: {
|
|
35
|
+
long: "Background Tinted er en bakgrunnsfarge som har et hint av farge i seg.",
|
|
36
|
+
short: "Bakgrunn med et hint av farge i seg."
|
|
35
37
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
blur: "2",
|
|
51
|
-
spread: "0"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
x: "0",
|
|
55
|
-
y: "2",
|
|
56
|
-
blur: "4",
|
|
57
|
-
spread: "0",
|
|
58
|
-
color: "rgba(0,0,0,0.1)"
|
|
59
|
-
}
|
|
60
|
-
]
|
|
38
|
+
luminance: {
|
|
39
|
+
light: 0.9,
|
|
40
|
+
dark: 0.014,
|
|
41
|
+
contrast: 65e-4
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"surface-default": {
|
|
45
|
+
number: 3,
|
|
46
|
+
name: "surface-default",
|
|
47
|
+
group: "surface",
|
|
48
|
+
displayName: "Surface Default",
|
|
49
|
+
description: {
|
|
50
|
+
long: "Surface Default brukes p\xE5 flater som ligger opp\xE5 bakgrunnsfargene. Dette er den mest n\xF8ytrale surface fargen.",
|
|
51
|
+
short: "Standardfarge for overflater / komponenter."
|
|
61
52
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
blur: "4",
|
|
77
|
-
spread: "0"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
x: "0",
|
|
81
|
-
y: "4",
|
|
82
|
-
blur: "8",
|
|
83
|
-
spread: "0",
|
|
84
|
-
color: "rgba(0,0,0,0.12)"
|
|
85
|
-
}
|
|
86
|
-
]
|
|
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."
|
|
87
67
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
blur: "5",
|
|
103
|
-
spread: "0"
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
x: "0",
|
|
107
|
-
y: "6",
|
|
108
|
-
blur: "12",
|
|
109
|
-
spread: "0",
|
|
110
|
-
color: "rgba(0,0,0,0.14)"
|
|
111
|
-
}
|
|
112
|
-
]
|
|
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."
|
|
113
82
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
color: "rgba(0,0,0,0.12)",
|
|
119
|
-
x: "0",
|
|
120
|
-
y: "0",
|
|
121
|
-
blur: "1",
|
|
122
|
-
spread: "0"
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
color: "rgba(0,0,0,0.16)",
|
|
126
|
-
x: "0",
|
|
127
|
-
y: "4",
|
|
128
|
-
blur: "8",
|
|
129
|
-
spread: "0"
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
x: "0",
|
|
133
|
-
y: "12",
|
|
134
|
-
blur: "24",
|
|
135
|
-
spread: "0",
|
|
136
|
-
color: "rgba(0,0,0,0.16)"
|
|
137
|
-
}
|
|
138
|
-
]
|
|
83
|
+
luminance: {
|
|
84
|
+
light: 0.7,
|
|
85
|
+
dark: 0.036,
|
|
86
|
+
contrast: 0.028
|
|
139
87
|
}
|
|
140
88
|
},
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
|
145
102
|
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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)."
|
|
155
112
|
},
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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."
|
|
159
127
|
},
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
"3": {
|
|
165
|
-
$type: "dimension",
|
|
166
|
-
$value: "floor({_size.unit} * 3)"
|
|
167
|
-
},
|
|
168
|
-
"4": {
|
|
169
|
-
$type: "dimension",
|
|
170
|
-
$value: "floor({_size.unit} * 4)"
|
|
171
|
-
},
|
|
172
|
-
"5": {
|
|
173
|
-
$type: "dimension",
|
|
174
|
-
$value: "floor({_size.unit} * 5)"
|
|
175
|
-
},
|
|
176
|
-
"6": {
|
|
177
|
-
$type: "dimension",
|
|
178
|
-
$value: "floor({_size.unit} * 6)"
|
|
179
|
-
},
|
|
180
|
-
"7": {
|
|
181
|
-
$type: "dimension",
|
|
182
|
-
$value: "floor({_size.unit} * 7)"
|
|
183
|
-
},
|
|
184
|
-
"8": {
|
|
185
|
-
$type: "dimension",
|
|
186
|
-
$value: "floor({_size.unit} * 8)"
|
|
187
|
-
},
|
|
188
|
-
"9": {
|
|
189
|
-
$type: "dimension",
|
|
190
|
-
$value: "floor({_size.unit} * 9)"
|
|
191
|
-
},
|
|
192
|
-
"10": {
|
|
193
|
-
$type: "dimension",
|
|
194
|
-
$value: "floor({_size.unit} * 10)"
|
|
195
|
-
},
|
|
196
|
-
"11": {
|
|
197
|
-
$type: "dimension",
|
|
198
|
-
$value: "floor({_size.unit} * 11)"
|
|
199
|
-
},
|
|
200
|
-
"12": {
|
|
201
|
-
$type: "dimension",
|
|
202
|
-
$value: "floor({_size.unit} * 12)"
|
|
203
|
-
},
|
|
204
|
-
"13": {
|
|
205
|
-
$type: "dimension",
|
|
206
|
-
$value: "floor({_size.unit} * 13)"
|
|
207
|
-
},
|
|
208
|
-
"14": {
|
|
209
|
-
$type: "dimension",
|
|
210
|
-
$value: "floor({_size.unit} * 14)"
|
|
211
|
-
},
|
|
212
|
-
"15": {
|
|
213
|
-
$type: "dimension",
|
|
214
|
-
$value: "floor({_size.unit} * 15)"
|
|
215
|
-
},
|
|
216
|
-
"18": {
|
|
217
|
-
$type: "dimension",
|
|
218
|
-
$value: "floor({_size.unit} * 18)"
|
|
219
|
-
},
|
|
220
|
-
"22": {
|
|
221
|
-
$type: "dimension",
|
|
222
|
-
$value: "floor({_size.unit} * 22)"
|
|
223
|
-
},
|
|
224
|
-
"26": {
|
|
225
|
-
$type: "dimension",
|
|
226
|
-
$value: "floor({_size.unit} * 26)"
|
|
227
|
-
},
|
|
228
|
-
"30": {
|
|
229
|
-
$type: "dimension",
|
|
230
|
-
$value: "floor({_size.unit} * 30)"
|
|
231
|
-
},
|
|
232
|
-
"mode-font-size": {
|
|
233
|
-
$type: "number",
|
|
234
|
-
$value: "{size._mode-font-size}"
|
|
235
|
-
},
|
|
236
|
-
base: {
|
|
237
|
-
$type: "number",
|
|
238
|
-
$value: "{size._base}"
|
|
239
|
-
},
|
|
240
|
-
step: {
|
|
241
|
-
$type: "number",
|
|
242
|
-
$value: "{size._step}"
|
|
243
|
-
},
|
|
244
|
-
unit: {
|
|
245
|
-
$type: "number",
|
|
246
|
-
$value: "{_size.step} / {_size.base} * {_size.mode-font-size}"
|
|
128
|
+
luminance: {
|
|
129
|
+
light: 0.19,
|
|
130
|
+
dark: 0.22,
|
|
131
|
+
contrast: 0.4
|
|
247
132
|
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
},
|
|
258
|
-
_base: {
|
|
259
|
-
$type: "dimension",
|
|
260
|
-
$value: "18"
|
|
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."
|
|
261
142
|
},
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
143
|
+
luminance: {
|
|
144
|
+
light: 0.11,
|
|
145
|
+
dark: 0.39,
|
|
146
|
+
contrast: 0.6
|
|
265
147
|
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
},
|
|
276
|
-
_base: {
|
|
277
|
-
$type: "dimension",
|
|
278
|
-
$value: "18"
|
|
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."
|
|
279
157
|
},
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
158
|
+
luminance: {
|
|
159
|
+
light: 0.11,
|
|
160
|
+
dark: 0.39,
|
|
161
|
+
contrast: 0.57
|
|
283
162
|
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
},
|
|
294
|
-
_base: {
|
|
295
|
-
$type: "dimension",
|
|
296
|
-
$value: "18"
|
|
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."
|
|
297
172
|
},
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
// src/tokens/template/design-tokens/primitives/modes/typography/size/large.json with { type: 'json' }
|
|
306
|
-
var large_default2 = {
|
|
307
|
-
"line-height": {
|
|
308
|
-
sm: {
|
|
309
|
-
$type: "lineHeights",
|
|
310
|
-
$value: "130%"
|
|
311
|
-
},
|
|
312
|
-
md: {
|
|
313
|
-
$type: "lineHeights",
|
|
314
|
-
$value: "150%"
|
|
315
|
-
},
|
|
316
|
-
lg: {
|
|
317
|
-
$type: "lineHeights",
|
|
318
|
-
$value: "170%"
|
|
173
|
+
luminance: {
|
|
174
|
+
light: 0.0245,
|
|
175
|
+
dark: 0.84,
|
|
176
|
+
contrast: 0.86
|
|
319
177
|
}
|
|
320
178
|
},
|
|
321
|
-
"
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
},
|
|
330
|
-
"3": {
|
|
331
|
-
$type: "fontSizes",
|
|
332
|
-
$value: "18"
|
|
333
|
-
},
|
|
334
|
-
"4": {
|
|
335
|
-
$type: "fontSizes",
|
|
336
|
-
$value: "21"
|
|
337
|
-
},
|
|
338
|
-
"5": {
|
|
339
|
-
$type: "fontSizes",
|
|
340
|
-
$value: "24"
|
|
341
|
-
},
|
|
342
|
-
"6": {
|
|
343
|
-
$type: "fontSizes",
|
|
344
|
-
$value: "30"
|
|
345
|
-
},
|
|
346
|
-
"7": {
|
|
347
|
-
$type: "fontSizes",
|
|
348
|
-
$value: "36"
|
|
349
|
-
},
|
|
350
|
-
"8": {
|
|
351
|
-
$type: "fontSizes",
|
|
352
|
-
$value: "48"
|
|
353
|
-
},
|
|
354
|
-
"9": {
|
|
355
|
-
$type: "fontSizes",
|
|
356
|
-
$value: "60"
|
|
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."
|
|
357
187
|
},
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
188
|
+
luminance: {
|
|
189
|
+
light: 1,
|
|
190
|
+
dark: 1,
|
|
191
|
+
contrast: 1
|
|
361
192
|
}
|
|
362
193
|
},
|
|
363
|
-
"
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
},
|
|
372
|
-
"3": {
|
|
373
|
-
$type: "letterSpacing",
|
|
374
|
-
$value: "-0.25%"
|
|
375
|
-
},
|
|
376
|
-
"4": {
|
|
377
|
-
$type: "letterSpacing",
|
|
378
|
-
$value: "-0.15%"
|
|
379
|
-
},
|
|
380
|
-
"5": {
|
|
381
|
-
$type: "letterSpacing",
|
|
382
|
-
$value: "0%"
|
|
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."
|
|
383
202
|
},
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
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."
|
|
387
217
|
},
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
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."
|
|
391
232
|
},
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
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."
|
|
395
247
|
},
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
248
|
+
luminance: {
|
|
249
|
+
light: 1,
|
|
250
|
+
dark: 1,
|
|
251
|
+
contrast: 1
|
|
399
252
|
}
|
|
400
253
|
}
|
|
401
254
|
};
|
|
255
|
+
var colorMetadataByNumber = R.indexBy((metadata) => metadata.number, Object.values(colorMetadata));
|
|
256
|
+
var colorNames = Object.keys(colorMetadata);
|
|
257
|
+
var baseColorNames = Object.keys(baseColors);
|
|
402
258
|
|
|
403
|
-
// src/
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
$value: "12"
|
|
423
|
-
},
|
|
424
|
-
"2": {
|
|
425
|
-
$type: "fontSizes",
|
|
426
|
-
$value: "14"
|
|
427
|
-
},
|
|
428
|
-
"3": {
|
|
429
|
-
$type: "fontSizes",
|
|
430
|
-
$value: "16"
|
|
431
|
-
},
|
|
432
|
-
"4": {
|
|
433
|
-
$type: "fontSizes",
|
|
434
|
-
$value: "18"
|
|
435
|
-
},
|
|
436
|
-
"5": {
|
|
437
|
-
$type: "fontSizes",
|
|
438
|
-
$value: "21"
|
|
439
|
-
},
|
|
440
|
-
"6": {
|
|
441
|
-
$type: "fontSizes",
|
|
442
|
-
$value: "24"
|
|
443
|
-
},
|
|
444
|
-
"7": {
|
|
445
|
-
$type: "fontSizes",
|
|
446
|
-
$value: "30"
|
|
447
|
-
},
|
|
448
|
-
"8": {
|
|
449
|
-
$type: "fontSizes",
|
|
450
|
-
$value: "36"
|
|
451
|
-
},
|
|
452
|
-
"9": {
|
|
453
|
-
$type: "fontSizes",
|
|
454
|
-
$value: "48"
|
|
455
|
-
},
|
|
456
|
-
"10": {
|
|
457
|
-
$type: "fontSizes",
|
|
458
|
-
$value: "60"
|
|
459
|
-
}
|
|
460
|
-
},
|
|
461
|
-
"letter-spacing": {
|
|
462
|
-
"1": {
|
|
463
|
-
$type: "letterSpacing",
|
|
464
|
-
$value: "-1%"
|
|
465
|
-
},
|
|
466
|
-
"2": {
|
|
467
|
-
$type: "letterSpacing",
|
|
468
|
-
$value: "-0.5%"
|
|
469
|
-
},
|
|
470
|
-
"3": {
|
|
471
|
-
$type: "letterSpacing",
|
|
472
|
-
$value: "-0.25%"
|
|
473
|
-
},
|
|
474
|
-
"4": {
|
|
475
|
-
$type: "letterSpacing",
|
|
476
|
-
$value: "-0.15%"
|
|
477
|
-
},
|
|
478
|
-
"5": {
|
|
479
|
-
$type: "letterSpacing",
|
|
480
|
-
$value: "0%"
|
|
481
|
-
},
|
|
482
|
-
"6": {
|
|
483
|
-
$type: "letterSpacing",
|
|
484
|
-
$value: "0.15%"
|
|
485
|
-
},
|
|
486
|
-
"7": {
|
|
487
|
-
$type: "letterSpacing",
|
|
488
|
-
$value: "0.25%"
|
|
489
|
-
},
|
|
490
|
-
"8": {
|
|
491
|
-
$type: "letterSpacing",
|
|
492
|
-
$value: "0.5%"
|
|
493
|
-
},
|
|
494
|
-
"9": {
|
|
495
|
-
$type: "letterSpacing",
|
|
496
|
-
$value: "1.5%"
|
|
497
|
-
}
|
|
498
|
-
}
|
|
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;
|
|
499
278
|
};
|
|
500
279
|
|
|
501
|
-
// src/
|
|
502
|
-
var
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
"
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
"
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
"
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
"
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
"10": {
|
|
555
|
-
$type: "fontSizes",
|
|
556
|
-
$value: "48"
|
|
557
|
-
}
|
|
558
|
-
},
|
|
559
|
-
"letter-spacing": {
|
|
560
|
-
"1": {
|
|
561
|
-
$type: "letterSpacing",
|
|
562
|
-
$value: "-1%"
|
|
563
|
-
},
|
|
564
|
-
"2": {
|
|
565
|
-
$type: "letterSpacing",
|
|
566
|
-
$value: "-0.5%"
|
|
567
|
-
},
|
|
568
|
-
"3": {
|
|
569
|
-
$type: "letterSpacing",
|
|
570
|
-
$value: "-0.25%"
|
|
571
|
-
},
|
|
572
|
-
"4": {
|
|
573
|
-
$type: "letterSpacing",
|
|
574
|
-
$value: "-0.15%"
|
|
575
|
-
},
|
|
576
|
-
"5": {
|
|
577
|
-
$type: "letterSpacing",
|
|
578
|
-
$value: "0%"
|
|
579
|
-
},
|
|
580
|
-
"6": {
|
|
581
|
-
$type: "letterSpacing",
|
|
582
|
-
$value: "0.15%"
|
|
583
|
-
},
|
|
584
|
-
"7": {
|
|
585
|
-
$type: "letterSpacing",
|
|
586
|
-
$value: "0.25%"
|
|
587
|
-
},
|
|
588
|
-
"8": {
|
|
589
|
-
$type: "letterSpacing",
|
|
590
|
-
$value: "0.5%"
|
|
591
|
-
},
|
|
592
|
-
"9": {
|
|
593
|
-
$type: "letterSpacing",
|
|
594
|
-
$value: "1.5%"
|
|
595
|
-
}
|
|
280
|
+
// src/colors/theme.ts
|
|
281
|
+
var generateColorScale = (color, colorScheme2) => {
|
|
282
|
+
let interpolationColor = color;
|
|
283
|
+
if (colorScheme2 === "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[colorScheme2];
|
|
290
|
+
return {
|
|
291
|
+
...colorData,
|
|
292
|
+
hex: chroma2(interpolationColor).luminance(luminance).hex()
|
|
293
|
+
};
|
|
294
|
+
}, colorMetadata);
|
|
295
|
+
const baseColors2 = generateBaseColors(color, colorScheme2);
|
|
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, colorScheme2) => {
|
|
310
|
+
let colorLightness = getLightnessFromHex(color);
|
|
311
|
+
if (colorScheme2 !== "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: colorScheme2 === "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();
|
|
596
333
|
}
|
|
334
|
+
return color;
|
|
597
335
|
};
|
|
598
336
|
|
|
599
|
-
// src/
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
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, colorScheme2, 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 (colorScheme2 === "light" && modeOverrides.light) {
|
|
386
|
+
overrideValue = modeOverrides.light;
|
|
387
|
+
} else if (colorScheme2 === "dark" && modeOverrides.dark) {
|
|
388
|
+
overrideValue = modeOverrides.dark;
|
|
651
389
|
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
$type: "typography",
|
|
655
|
-
$value: {
|
|
656
|
-
fontFamily: "{font-family}",
|
|
657
|
-
fontWeight: "{font-weight.medium}",
|
|
658
|
-
lineHeight: "{line-height.sm}",
|
|
659
|
-
fontSize: "{font-size.5}",
|
|
660
|
-
letterSpacing: "{letter-spacing.6}"
|
|
390
|
+
if (overrideValue) {
|
|
391
|
+
positionOverrides[position] = overrideValue;
|
|
661
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, colorScheme2), createColorOverrides(colorName)),
|
|
399
|
+
colors.main
|
|
400
|
+
);
|
|
401
|
+
const support = R4.mapObjIndexed(
|
|
402
|
+
(color, colorName) => generateColor(generateColorScale(color, colorScheme2), createColorOverrides(colorName)),
|
|
403
|
+
colors.support
|
|
404
|
+
);
|
|
405
|
+
const neutralColorScale = generateColorScale(colors.neutral, colorScheme2);
|
|
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, colorScheme2), createColorOverrides(colorName)),
|
|
413
|
+
baseColorsWithOverrides
|
|
414
|
+
);
|
|
415
|
+
const linkColor = generateColor(generateColorScale(dsLinkColor, colorScheme2));
|
|
416
|
+
const defaultLinkVisited = linkColor[12];
|
|
417
|
+
const linkOverride = overrides?.linkVisited?.[colorScheme2] ? { $type: "color", $value: overrides.linkVisited[colorScheme2] } : void 0;
|
|
418
|
+
const defaultFocusInner = neutralColorScale[0].hex;
|
|
419
|
+
const defaultFocusOuter = neutralColorScale[10].hex;
|
|
420
|
+
const focusInnerOverride = overrides?.focus?.inner?.[colorScheme2];
|
|
421
|
+
const focusOuterOverride = overrides?.focus?.outer?.[colorScheme2];
|
|
422
|
+
return {
|
|
423
|
+
[themeName]: {
|
|
424
|
+
...main,
|
|
425
|
+
...support,
|
|
426
|
+
neutral,
|
|
427
|
+
...globalColors,
|
|
428
|
+
link: {
|
|
429
|
+
visited: linkOverride || defaultLinkVisited
|
|
662
430
|
},
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
431
|
+
focus: {
|
|
432
|
+
inner: {
|
|
433
|
+
$type: "color",
|
|
434
|
+
$value: focusInnerOverride || defaultFocusInner
|
|
435
|
+
},
|
|
436
|
+
outer: {
|
|
437
|
+
$type: "color",
|
|
438
|
+
$value: focusOuterOverride || defaultFocusOuter
|
|
671
439
|
}
|
|
672
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"
|
|
673
451
|
},
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
$type: "typography",
|
|
697
|
-
$value: {
|
|
698
|
-
fontFamily: "{font-family}",
|
|
699
|
-
fontWeight: "{font-weight.regular}",
|
|
700
|
-
lineHeight: "{line-height.md}",
|
|
701
|
-
fontSize: "{font-size.4}",
|
|
702
|
-
letterSpacing: "{letter-spacing.8}"
|
|
703
|
-
}
|
|
704
|
-
},
|
|
705
|
-
sm: {
|
|
706
|
-
$type: "typography",
|
|
707
|
-
$value: {
|
|
708
|
-
fontFamily: "{font-family}",
|
|
709
|
-
fontWeight: "{font-weight.regular}",
|
|
710
|
-
lineHeight: "{line-height.md}",
|
|
711
|
-
fontSize: "{font-size.3}",
|
|
712
|
-
letterSpacing: "{letter-spacing.7}"
|
|
713
|
-
}
|
|
714
|
-
},
|
|
715
|
-
xs: {
|
|
716
|
-
$type: "typography",
|
|
717
|
-
$value: {
|
|
718
|
-
fontFamily: "{font-family}",
|
|
719
|
-
fontWeight: "{font-weight.regular}",
|
|
720
|
-
lineHeight: "{line-height.md}",
|
|
721
|
-
fontSize: "{font-size.2}",
|
|
722
|
-
letterSpacing: "{letter-spacing.6}"
|
|
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)"
|
|
723
474
|
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
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"
|
|
735
486
|
},
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
fontSize: "{font-size.5}",
|
|
743
|
-
letterSpacing: "{letter-spacing.8}"
|
|
744
|
-
}
|
|
487
|
+
{
|
|
488
|
+
color: "rgba(0,0,0,0.12)",
|
|
489
|
+
x: "0",
|
|
490
|
+
y: "1",
|
|
491
|
+
blur: "2",
|
|
492
|
+
spread: "0"
|
|
745
493
|
},
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
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"
|
|
755
512
|
},
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
fontSize: "{font-size.3}",
|
|
763
|
-
letterSpacing: "{letter-spacing.7}"
|
|
764
|
-
}
|
|
513
|
+
{
|
|
514
|
+
color: "rgba(0,0,0,0.12)",
|
|
515
|
+
x: "0",
|
|
516
|
+
y: "2",
|
|
517
|
+
blur: "4",
|
|
518
|
+
spread: "0"
|
|
765
519
|
},
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
fontSize: "{font-size.2}",
|
|
773
|
-
letterSpacing: "{letter-spacing.6}"
|
|
774
|
-
}
|
|
520
|
+
{
|
|
521
|
+
x: "0",
|
|
522
|
+
y: "4",
|
|
523
|
+
blur: "8",
|
|
524
|
+
spread: "0",
|
|
525
|
+
color: "rgba(0,0,0,0.12)"
|
|
775
526
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
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"
|
|
787
538
|
},
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
fontSize: "{font-size.5}",
|
|
795
|
-
letterSpacing: "{letter-spacing.8}"
|
|
796
|
-
}
|
|
539
|
+
{
|
|
540
|
+
color: "rgba(0,0,0,0.13)",
|
|
541
|
+
x: "0",
|
|
542
|
+
y: "3",
|
|
543
|
+
blur: "5",
|
|
544
|
+
spread: "0"
|
|
797
545
|
},
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
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"
|
|
807
564
|
},
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
fontSize: "{font-size.3}",
|
|
815
|
-
letterSpacing: "{letter-spacing.7}"
|
|
816
|
-
}
|
|
565
|
+
{
|
|
566
|
+
color: "rgba(0,0,0,0.16)",
|
|
567
|
+
x: "0",
|
|
568
|
+
y: "4",
|
|
569
|
+
blur: "8",
|
|
570
|
+
spread: "0"
|
|
817
571
|
},
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
fontSize: "{font-size.2}",
|
|
825
|
-
letterSpacing: "{letter-spacing.6}"
|
|
826
|
-
}
|
|
572
|
+
{
|
|
573
|
+
x: "0",
|
|
574
|
+
y: "12",
|
|
575
|
+
blur: "24",
|
|
576
|
+
spread: "0",
|
|
577
|
+
color: "rgba(0,0,0,0.16)"
|
|
827
578
|
}
|
|
828
|
-
|
|
579
|
+
]
|
|
829
580
|
}
|
|
830
581
|
},
|
|
831
582
|
opacity: {
|
|
832
|
-
|
|
583
|
+
"30": {
|
|
833
584
|
$type: "opacity",
|
|
834
|
-
$value: "
|
|
835
|
-
}
|
|
836
|
-
},
|
|
837
|
-
"border-width": {
|
|
838
|
-
default: {
|
|
839
|
-
$type: "borderWidth",
|
|
840
|
-
$value: "{border-width.1}"
|
|
841
|
-
},
|
|
842
|
-
focus: {
|
|
843
|
-
$type: "borderWidth",
|
|
844
|
-
$value: "{border-width.3}"
|
|
585
|
+
$value: "30%"
|
|
845
586
|
}
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
$
|
|
855
|
-
|
|
856
|
-
md: {
|
|
857
|
-
$type: "boxShadow",
|
|
858
|
-
$value: "{shadow.300}"
|
|
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)"
|
|
859
597
|
},
|
|
860
|
-
|
|
861
|
-
$type: "
|
|
862
|
-
$value: "{
|
|
598
|
+
"1": {
|
|
599
|
+
$type: "dimension",
|
|
600
|
+
$value: "floor({_size.unit} * 1)"
|
|
863
601
|
},
|
|
864
|
-
|
|
865
|
-
$type: "boxShadow",
|
|
866
|
-
$value: "{shadow.500}"
|
|
867
|
-
}
|
|
868
|
-
},
|
|
869
|
-
"border-radius": {
|
|
870
|
-
sm: {
|
|
602
|
+
"2": {
|
|
871
603
|
$type: "dimension",
|
|
872
|
-
$value: "{
|
|
604
|
+
$value: "floor({_size.unit} * 2)"
|
|
873
605
|
},
|
|
874
|
-
|
|
606
|
+
"3": {
|
|
875
607
|
$type: "dimension",
|
|
876
|
-
$value: "{
|
|
608
|
+
$value: "floor({_size.unit} * 3)"
|
|
877
609
|
},
|
|
878
|
-
|
|
610
|
+
"4": {
|
|
879
611
|
$type: "dimension",
|
|
880
|
-
$value: "{
|
|
612
|
+
$value: "floor({_size.unit} * 4)"
|
|
881
613
|
},
|
|
882
|
-
|
|
614
|
+
"5": {
|
|
883
615
|
$type: "dimension",
|
|
884
|
-
$value: "{
|
|
616
|
+
$value: "floor({_size.unit} * 5)"
|
|
885
617
|
},
|
|
886
|
-
|
|
618
|
+
"6": {
|
|
887
619
|
$type: "dimension",
|
|
888
|
-
$value: "{
|
|
620
|
+
$value: "floor({_size.unit} * 6)"
|
|
889
621
|
},
|
|
890
|
-
|
|
622
|
+
"7": {
|
|
891
623
|
$type: "dimension",
|
|
892
|
-
$value: "{
|
|
893
|
-
}
|
|
894
|
-
},
|
|
895
|
-
size: {
|
|
896
|
-
"0": {
|
|
897
|
-
$type: "dimension",
|
|
898
|
-
$value: "{_size.0}"
|
|
899
|
-
},
|
|
900
|
-
"1": {
|
|
901
|
-
$type: "dimension",
|
|
902
|
-
$value: "{_size.1}"
|
|
903
|
-
},
|
|
904
|
-
"2": {
|
|
905
|
-
$type: "dimension",
|
|
906
|
-
$value: "{_size.2}"
|
|
907
|
-
},
|
|
908
|
-
"3": {
|
|
909
|
-
$type: "dimension",
|
|
910
|
-
$value: "{_size.3}"
|
|
911
|
-
},
|
|
912
|
-
"4": {
|
|
913
|
-
$type: "dimension",
|
|
914
|
-
$value: "{_size.4}"
|
|
915
|
-
},
|
|
916
|
-
"5": {
|
|
917
|
-
$type: "dimension",
|
|
918
|
-
$value: "{_size.5}"
|
|
919
|
-
},
|
|
920
|
-
"6": {
|
|
921
|
-
$type: "dimension",
|
|
922
|
-
$value: "{_size.6}"
|
|
923
|
-
},
|
|
924
|
-
"7": {
|
|
925
|
-
$type: "dimension",
|
|
926
|
-
$value: "{_size.7}"
|
|
624
|
+
$value: "floor({_size.unit} * 7)"
|
|
927
625
|
},
|
|
928
626
|
"8": {
|
|
929
627
|
$type: "dimension",
|
|
930
|
-
$value: "{_size.8
|
|
628
|
+
$value: "floor({_size.unit} * 8)"
|
|
931
629
|
},
|
|
932
630
|
"9": {
|
|
933
631
|
$type: "dimension",
|
|
934
|
-
$value: "{_size.9
|
|
632
|
+
$value: "floor({_size.unit} * 9)"
|
|
935
633
|
},
|
|
936
634
|
"10": {
|
|
937
635
|
$type: "dimension",
|
|
938
|
-
$value: "{_size.10
|
|
636
|
+
$value: "floor({_size.unit} * 10)"
|
|
939
637
|
},
|
|
940
638
|
"11": {
|
|
941
639
|
$type: "dimension",
|
|
942
|
-
$value: "{_size.11
|
|
640
|
+
$value: "floor({_size.unit} * 11)"
|
|
943
641
|
},
|
|
944
642
|
"12": {
|
|
945
643
|
$type: "dimension",
|
|
946
|
-
$value: "{_size.12
|
|
644
|
+
$value: "floor({_size.unit} * 12)"
|
|
947
645
|
},
|
|
948
646
|
"13": {
|
|
949
647
|
$type: "dimension",
|
|
950
|
-
$value: "{_size.13
|
|
648
|
+
$value: "floor({_size.unit} * 13)"
|
|
951
649
|
},
|
|
952
650
|
"14": {
|
|
953
651
|
$type: "dimension",
|
|
954
|
-
$value: "{_size.14
|
|
652
|
+
$value: "floor({_size.unit} * 14)"
|
|
955
653
|
},
|
|
956
654
|
"15": {
|
|
957
655
|
$type: "dimension",
|
|
958
|
-
$value: "{_size.15
|
|
656
|
+
$value: "floor({_size.unit} * 15)"
|
|
959
657
|
},
|
|
960
658
|
"18": {
|
|
961
659
|
$type: "dimension",
|
|
962
|
-
$value: "{_size.18
|
|
660
|
+
$value: "floor({_size.unit} * 18)"
|
|
963
661
|
},
|
|
964
662
|
"22": {
|
|
965
663
|
$type: "dimension",
|
|
966
|
-
$value: "{_size.22
|
|
664
|
+
$value: "floor({_size.unit} * 22)"
|
|
967
665
|
},
|
|
968
666
|
"26": {
|
|
969
667
|
$type: "dimension",
|
|
970
|
-
$value: "{_size.26
|
|
668
|
+
$value: "floor({_size.unit} * 26)"
|
|
971
669
|
},
|
|
972
670
|
"30": {
|
|
973
671
|
$type: "dimension",
|
|
974
|
-
$value: "{_size.30
|
|
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}"
|
|
975
689
|
}
|
|
976
690
|
}
|
|
977
691
|
};
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
return [tokenPath, defaultTokens[tokenPath]];
|
|
994
|
-
};
|
|
995
|
-
|
|
996
|
-
// src/tokens/create/generators/color.ts
|
|
997
|
-
import * as R4 from "ramda";
|
|
998
|
-
|
|
999
|
-
// src/colors/colorMetadata.ts
|
|
1000
|
-
import * as R2 from "ramda";
|
|
1001
|
-
var baseColors = {
|
|
1002
|
-
info: "#0A71C0",
|
|
1003
|
-
success: "#068718",
|
|
1004
|
-
warning: "#EA9B1B",
|
|
1005
|
-
danger: "#C01B1B"
|
|
1006
|
-
};
|
|
1007
|
-
var dsLinkColor = "#663299";
|
|
1008
|
-
var colorMetadata = {
|
|
1009
|
-
"background-default": {
|
|
1010
|
-
number: 1,
|
|
1011
|
-
name: "background-default",
|
|
1012
|
-
group: "background",
|
|
1013
|
-
displayName: "Background Default",
|
|
1014
|
-
description: {
|
|
1015
|
-
long: "Background Default er den mest n\xF8ytrale bakgrunnsfargen.",
|
|
1016
|
-
short: "Standard bakgrunnsfarge."
|
|
1017
|
-
},
|
|
1018
|
-
luminance: {
|
|
1019
|
-
light: 1,
|
|
1020
|
-
dark: 9e-3,
|
|
1021
|
-
contrast: 1e-3
|
|
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
|
+
}
|
|
1022
707
|
}
|
|
1023
708
|
},
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
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
|
+
}
|
|
1037
723
|
}
|
|
1038
724
|
},
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
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
|
+
}
|
|
1052
739
|
}
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
var generateSize = (size2) => sizeModes[size2];
|
|
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
|
|
1062
751
|
},
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
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
|
+
}
|
|
1067
765
|
}
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
var generateFontSizes = (size2) => fontSizes[size2];
|
|
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%"
|
|
1068
787
|
},
|
|
1069
|
-
"
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
group: "surface",
|
|
1073
|
-
displayName: "Surface Hover",
|
|
1074
|
-
description: {
|
|
1075
|
-
long: "Surface Hover brukes p\xE5 interaktive flater som ligger opp\xE5 bakgrunnsfargene i en hover state.",
|
|
1076
|
-
short: "Hover-farge til overflater / komponenter."
|
|
1077
|
-
},
|
|
1078
|
-
luminance: {
|
|
1079
|
-
light: 0.7,
|
|
1080
|
-
dark: 0.036,
|
|
1081
|
-
contrast: 0.028
|
|
1082
|
-
}
|
|
788
|
+
"2": {
|
|
789
|
+
$type: "letterSpacing",
|
|
790
|
+
$value: "-0.5%"
|
|
1083
791
|
},
|
|
1084
|
-
"
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
group: "surface",
|
|
1088
|
-
displayName: "Surface Active",
|
|
1089
|
-
description: {
|
|
1090
|
-
long: "Surface Active brukes p\xE5 interaktive flater som ligger opp\xE5 bakgrunnsfargene i en active state.",
|
|
1091
|
-
short: "Active-farge til overflater / komponenter."
|
|
1092
|
-
},
|
|
1093
|
-
luminance: {
|
|
1094
|
-
light: 0.59,
|
|
1095
|
-
dark: 0.056,
|
|
1096
|
-
contrast: 0.045
|
|
1097
|
-
}
|
|
792
|
+
"3": {
|
|
793
|
+
$type: "letterSpacing",
|
|
794
|
+
$value: "-0.25%"
|
|
1098
795
|
},
|
|
1099
|
-
"
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
group: "border",
|
|
1103
|
-
displayName: "Border Subtle",
|
|
1104
|
-
description: {
|
|
1105
|
-
long: "Border Subtle er den lyseste border-fargen og brukes for \xE5 skille elementer fra hverandre.",
|
|
1106
|
-
short: "Border-farge med lav kontrast til dekorativ bruk (skillelinjer)."
|
|
1107
|
-
},
|
|
1108
|
-
luminance: {
|
|
1109
|
-
light: 0.5,
|
|
1110
|
-
dark: 0.08,
|
|
1111
|
-
contrast: 0.26
|
|
1112
|
-
}
|
|
796
|
+
"4": {
|
|
797
|
+
$type: "letterSpacing",
|
|
798
|
+
$value: "-0.15%"
|
|
1113
799
|
},
|
|
1114
|
-
"
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
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
|
+
}
|
|
1122
865
|
},
|
|
1123
|
-
|
|
1124
|
-
light: 0.19,
|
|
1125
|
-
dark: 0.22,
|
|
1126
|
-
contrast: 0.4
|
|
1127
|
-
}
|
|
866
|
+
"letter-spacing": letterSpacings
|
|
1128
867
|
},
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
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
|
+
}
|
|
1137
911
|
},
|
|
1138
|
-
|
|
1139
|
-
light: 0.11,
|
|
1140
|
-
dark: 0.39,
|
|
1141
|
-
contrast: 0.6
|
|
1142
|
-
}
|
|
912
|
+
"letter-spacing": letterSpacings
|
|
1143
913
|
},
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
}
|
|
1188
|
-
},
|
|
1189
|
-
"base-hover": {
|
|
1190
|
-
number: 13,
|
|
1191
|
-
name: "base-hover",
|
|
1192
|
-
group: "base",
|
|
1193
|
-
displayName: "Base Hover",
|
|
1194
|
-
description: {
|
|
1195
|
-
long: "Base Hover brukes som hover farge p\xE5 elementer som bruker Base Default fargen.",
|
|
1196
|
-
short: "Hover-farge for solide bakgrunner."
|
|
1197
|
-
},
|
|
1198
|
-
luminance: {
|
|
1199
|
-
light: 1,
|
|
1200
|
-
dark: 1,
|
|
1201
|
-
contrast: 1
|
|
1202
|
-
}
|
|
1203
|
-
},
|
|
1204
|
-
"base-active": {
|
|
1205
|
-
number: 14,
|
|
1206
|
-
name: "base-active",
|
|
1207
|
-
group: "base",
|
|
1208
|
-
displayName: "Base Active",
|
|
1209
|
-
description: {
|
|
1210
|
-
long: "Base Active brukes som active farge p\xE5 elementer som bruker Base Default fargen.",
|
|
1211
|
-
short: "Active-farge for solide bakgrunner."
|
|
1212
|
-
},
|
|
1213
|
-
luminance: {
|
|
1214
|
-
light: 1,
|
|
1215
|
-
dark: 1,
|
|
1216
|
-
contrast: 1
|
|
1217
|
-
}
|
|
1218
|
-
},
|
|
1219
|
-
"base-contrast-subtle": {
|
|
1220
|
-
number: 15,
|
|
1221
|
-
name: "base-contrast-subtle",
|
|
1222
|
-
group: "base",
|
|
1223
|
-
displayName: "Contrast Subtle",
|
|
1224
|
-
description: {
|
|
1225
|
-
long: "Contrast Subtle brukes som en viktig meningsb\xE6rende farge opp\xE5 Base Default fargen.",
|
|
1226
|
-
short: "Farge med god kontrast mot Base-default."
|
|
1227
|
-
},
|
|
1228
|
-
luminance: {
|
|
1229
|
-
light: 1,
|
|
1230
|
-
dark: 1,
|
|
1231
|
-
contrast: 1
|
|
1232
|
-
}
|
|
1233
|
-
},
|
|
1234
|
-
"base-contrast-default": {
|
|
1235
|
-
number: 16,
|
|
1236
|
-
name: "base-contrast-default",
|
|
1237
|
-
group: "base",
|
|
1238
|
-
displayName: "Contrast Default",
|
|
1239
|
-
description: {
|
|
1240
|
-
long: "Contrast Default brukes som en viktig meningsb\xE6rende farge opp\xE5 alle Base fargane.",
|
|
1241
|
-
short: "Farge med god kontrast mot Base-default og Base-hover."
|
|
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
|
+
}
|
|
1242
957
|
},
|
|
1243
|
-
|
|
1244
|
-
light: 1,
|
|
1245
|
-
dark: 1,
|
|
1246
|
-
contrast: 1
|
|
1247
|
-
}
|
|
958
|
+
"letter-spacing": letterSpacings
|
|
1248
959
|
}
|
|
1249
960
|
};
|
|
1250
|
-
var colorMetadataByNumber = R2.indexBy((metadata) => metadata.number, Object.values(colorMetadata));
|
|
1251
|
-
var colorNames = Object.keys(colorMetadata);
|
|
1252
|
-
var baseColorNames = Object.keys(baseColors);
|
|
1253
|
-
|
|
1254
|
-
// src/colors/theme.ts
|
|
1255
|
-
import chroma2 from "chroma-js";
|
|
1256
|
-
import * as R3 from "ramda";
|
|
1257
|
-
|
|
1258
|
-
// src/colors/utils.ts
|
|
1259
|
-
import chroma from "chroma-js";
|
|
1260
|
-
import Colorjs from "colorjs.io";
|
|
1261
|
-
import { Hsluv } from "hsluv";
|
|
1262
|
-
var getLuminanceFromLightness = (lightness) => {
|
|
1263
|
-
const conv = new Hsluv();
|
|
1264
|
-
conv.hsluv_l = lightness;
|
|
1265
|
-
conv.hsluvToHex();
|
|
1266
|
-
return chroma(conv.hex).luminance();
|
|
1267
|
-
};
|
|
1268
|
-
var getLightnessFromHex = (hex) => {
|
|
1269
|
-
const conv = new Hsluv();
|
|
1270
|
-
conv.hex = hex;
|
|
1271
|
-
conv.hexToHsluv();
|
|
1272
|
-
return conv.hsluv_l;
|
|
1273
|
-
};
|
|
1274
961
|
|
|
1275
|
-
// src/
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
const colors = R3.mapObjIndexed((colorData) => {
|
|
1284
|
-
const luminance = colorData.luminance[colorScheme2];
|
|
1285
|
-
return {
|
|
1286
|
-
...colorData,
|
|
1287
|
-
hex: chroma2(interpolationColor).luminance(luminance).hex()
|
|
1288
|
-
};
|
|
1289
|
-
}, colorMetadata);
|
|
1290
|
-
const baseColors2 = generateBaseColors(color, colorScheme2);
|
|
1291
|
-
colors["base-default"] = { ...colors["base-default"], hex: baseColors2.default };
|
|
1292
|
-
colors["base-hover"] = { ...colors["base-hover"], hex: baseColors2.hover };
|
|
1293
|
-
colors["base-active"] = { ...colors["base-active"], hex: baseColors2.active };
|
|
1294
|
-
colors["base-contrast-subtle"] = {
|
|
1295
|
-
...colors["base-contrast-subtle"],
|
|
1296
|
-
hex: generateColorContrast(baseColors2.default, "subtle")
|
|
1297
|
-
};
|
|
1298
|
-
colors["base-contrast-default"] = {
|
|
1299
|
-
...colors["base-contrast-default"],
|
|
1300
|
-
hex: generateColorContrast(baseColors2.default, "default")
|
|
1301
|
-
};
|
|
1302
|
-
return Object.values(colors);
|
|
1303
|
-
};
|
|
1304
|
-
var generateBaseColors = (color, colorScheme2) => {
|
|
1305
|
-
let colorLightness = getLightnessFromHex(color);
|
|
1306
|
-
if (colorScheme2 !== "light") {
|
|
1307
|
-
colorLightness = colorLightness <= 30 ? 70 : 100 - colorLightness;
|
|
1308
|
-
}
|
|
1309
|
-
const modifier = colorLightness <= 30 || colorLightness >= 49 && colorLightness <= 65 ? -8 : 8;
|
|
1310
|
-
const calculateLightness = (base, mod) => base - mod;
|
|
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)]);
|
|
1311
970
|
return {
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
971
|
+
...baseColorTemplate,
|
|
972
|
+
color: {
|
|
973
|
+
...Object.fromEntries(semanticColorTokens),
|
|
974
|
+
...baseColorTemplate.color
|
|
975
|
+
}
|
|
1315
976
|
};
|
|
1316
977
|
};
|
|
1317
|
-
var
|
|
1318
|
-
|
|
1319
|
-
|
|
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
|
+
}
|
|
1320
998
|
}
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
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
|
+
};
|
|
1328
1007
|
}
|
|
1329
|
-
return
|
|
1008
|
+
return colorScale;
|
|
1330
1009
|
};
|
|
1331
1010
|
|
|
1332
|
-
// src/tokens/create/generators/color.ts
|
|
1333
|
-
var
|
|
1334
|
-
const
|
|
1335
|
-
const
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
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 [colorCategory2, colorNames2] of categories) {
|
|
1024
|
+
for (const colorName of colorNames2) {
|
|
1025
|
+
const category = colorCategory2.replace("-color", "");
|
|
1026
|
+
const customColorTokens = {
|
|
1027
|
+
color: {
|
|
1028
|
+
[category]: generateColorScaleTokens2(colorName)
|
|
1029
|
+
}
|
|
1030
|
+
};
|
|
1031
|
+
modes[colorCategory2][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}}`
|
|
1342
1042
|
};
|
|
1343
1043
|
}
|
|
1344
|
-
return
|
|
1044
|
+
return colorScale;
|
|
1345
1045
|
};
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
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
|
+
}
|
|
1361
1121
|
}
|
|
1362
|
-
|
|
1363
|
-
|
|
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
|
+
}
|
|
1364
1277
|
}
|
|
1365
1278
|
}
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
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
|
+
}
|
|
1382
1426
|
};
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
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)])
|
|
1386
1437
|
);
|
|
1387
|
-
const
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
const focusInnerOverride = overrides?.focus?.inner?.[colorScheme2];
|
|
1393
|
-
const focusOuterOverride = overrides?.focus?.outer?.[colorScheme2];
|
|
1394
|
-
return {
|
|
1395
|
-
[themeName]: {
|
|
1396
|
-
...main,
|
|
1397
|
-
...support,
|
|
1398
|
-
neutral,
|
|
1399
|
-
...globalColors,
|
|
1438
|
+
const { color: themeBaseFileColor, ...remainingThemeFile } = generateBase(themeName);
|
|
1439
|
+
const themeFile = {
|
|
1440
|
+
color: {
|
|
1441
|
+
...themeColorTokens,
|
|
1442
|
+
...themeBaseFileColor,
|
|
1400
1443
|
link: {
|
|
1401
|
-
visited:
|
|
1444
|
+
visited: {
|
|
1445
|
+
$type: "color",
|
|
1446
|
+
$value: `{${themeName}.link.visited}`
|
|
1447
|
+
}
|
|
1402
1448
|
},
|
|
1403
1449
|
focus: {
|
|
1404
|
-
inner: {
|
|
1450
|
+
"inner-color": {
|
|
1405
1451
|
$type: "color",
|
|
1406
|
-
$value:
|
|
1452
|
+
$value: `{${themeName}.focus.inner}`
|
|
1407
1453
|
},
|
|
1408
|
-
outer: {
|
|
1454
|
+
"outer-color": {
|
|
1409
1455
|
$type: "color",
|
|
1410
|
-
$value:
|
|
1456
|
+
$value: `{${themeName}.focus.outer}`
|
|
1411
1457
|
}
|
|
1412
1458
|
}
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
};
|
|
1416
|
-
|
|
1417
|
-
// src/tokens/create/generators/semantic.ts
|
|
1418
|
-
import * as R5 from "ramda";
|
|
1419
|
-
|
|
1420
|
-
// src/tokens/template/design-tokens/semantic/color.base.template.json with { type: 'json' }
|
|
1421
|
-
var color_base_template_default = {
|
|
1422
|
-
color: {
|
|
1423
|
-
focus: {
|
|
1424
|
-
inner: {
|
|
1425
|
-
$type: "color",
|
|
1426
|
-
$value: "{color.focus.inner-color}"
|
|
1427
|
-
},
|
|
1428
|
-
outer: {
|
|
1429
|
-
$type: "color",
|
|
1430
|
-
$value: "{color.focus.outer-color}"
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
},
|
|
1434
|
-
link: {
|
|
1435
|
-
color: {
|
|
1436
|
-
visited: {
|
|
1437
|
-
$type: "color",
|
|
1438
|
-
$value: "{color.link.visited}"
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
};
|
|
1443
|
-
|
|
1444
|
-
// src/tokens/template/design-tokens/semantic/color.template.json with { type: 'json' }
|
|
1445
|
-
var color_template_default = {
|
|
1446
|
-
"background-default": {
|
|
1447
|
-
$type: "color",
|
|
1448
|
-
$value: "{color.<color>.1}"
|
|
1449
|
-
},
|
|
1450
|
-
"background-tinted": {
|
|
1451
|
-
$type: "color",
|
|
1452
|
-
$value: "{color.<color>.2}"
|
|
1453
|
-
},
|
|
1454
|
-
"surface-default": {
|
|
1455
|
-
$type: "color",
|
|
1456
|
-
$value: "{color.<color>.3}"
|
|
1457
|
-
},
|
|
1458
|
-
"surface-tinted": {
|
|
1459
|
-
$type: "color",
|
|
1460
|
-
$value: "{color.<color>.4}"
|
|
1461
|
-
},
|
|
1462
|
-
"surface-hover": {
|
|
1463
|
-
$type: "color",
|
|
1464
|
-
$value: "{color.<color>.5}"
|
|
1465
|
-
},
|
|
1466
|
-
"surface-active": {
|
|
1467
|
-
$type: "color",
|
|
1468
|
-
$value: "{color.<color>.6}"
|
|
1469
|
-
},
|
|
1470
|
-
"border-subtle": {
|
|
1471
|
-
$type: "color",
|
|
1472
|
-
$value: "{color.<color>.7}"
|
|
1473
|
-
},
|
|
1474
|
-
"border-default": {
|
|
1475
|
-
$type: "color",
|
|
1476
|
-
$value: "{color.<color>.8}"
|
|
1477
|
-
},
|
|
1478
|
-
"border-strong": {
|
|
1479
|
-
$type: "color",
|
|
1480
|
-
$value: "{color.<color>.9}"
|
|
1481
|
-
},
|
|
1482
|
-
"text-subtle": {
|
|
1483
|
-
$type: "color",
|
|
1484
|
-
$value: "{color.<color>.10}"
|
|
1485
|
-
},
|
|
1486
|
-
"text-default": {
|
|
1487
|
-
$type: "color",
|
|
1488
|
-
$value: "{color.<color>.11}"
|
|
1489
|
-
},
|
|
1490
|
-
"base-default": {
|
|
1491
|
-
$type: "color",
|
|
1492
|
-
$value: "{color.<color>.12}"
|
|
1493
|
-
},
|
|
1494
|
-
"base-hover": {
|
|
1495
|
-
$type: "color",
|
|
1496
|
-
$value: "{color.<color>.13}"
|
|
1497
|
-
},
|
|
1498
|
-
"base-active": {
|
|
1499
|
-
$type: "color",
|
|
1500
|
-
$value: "{color.<color>.14}"
|
|
1501
|
-
},
|
|
1502
|
-
"base-contrast-subtle": {
|
|
1503
|
-
$type: "color",
|
|
1504
|
-
$value: "{color.<color>.15}"
|
|
1505
|
-
},
|
|
1506
|
-
"base-contrast-default": {
|
|
1507
|
-
$type: "color",
|
|
1508
|
-
$value: "{color.<color>.16}"
|
|
1509
|
-
}
|
|
1510
|
-
};
|
|
1511
|
-
|
|
1512
|
-
// src/tokens/template/design-tokens/semantic/modes/color.template.json with { type: 'json' }
|
|
1513
|
-
var color_template_default2 = {
|
|
1514
|
-
"background-default": {
|
|
1515
|
-
$type: "color",
|
|
1516
|
-
$value: "{color.<color>.background-default}"
|
|
1517
|
-
},
|
|
1518
|
-
"background-tinted": {
|
|
1519
|
-
$type: "color",
|
|
1520
|
-
$value: "{color.<color>.background-tinted}"
|
|
1521
|
-
},
|
|
1522
|
-
"surface-default": {
|
|
1523
|
-
$type: "color",
|
|
1524
|
-
$value: "{color.<color>.surface-default}"
|
|
1525
|
-
},
|
|
1526
|
-
"surface-tinted": {
|
|
1527
|
-
$type: "color",
|
|
1528
|
-
$value: "{color.<color>.surface-tinted}"
|
|
1529
|
-
},
|
|
1530
|
-
"surface-hover": {
|
|
1531
|
-
$type: "color",
|
|
1532
|
-
$value: "{color.<color>.surface-hover}"
|
|
1533
|
-
},
|
|
1534
|
-
"surface-active": {
|
|
1535
|
-
$type: "color",
|
|
1536
|
-
$value: "{color.<color>.surface-active}"
|
|
1537
|
-
},
|
|
1538
|
-
"border-subtle": {
|
|
1539
|
-
$type: "color",
|
|
1540
|
-
$value: "{color.<color>.border-subtle}"
|
|
1541
|
-
},
|
|
1542
|
-
"border-default": {
|
|
1543
|
-
$type: "color",
|
|
1544
|
-
$value: "{color.<color>.border-default}"
|
|
1545
|
-
},
|
|
1546
|
-
"border-strong": {
|
|
1547
|
-
$type: "color",
|
|
1548
|
-
$value: "{color.<color>.border-strong}"
|
|
1549
|
-
},
|
|
1550
|
-
"text-subtle": {
|
|
1551
|
-
$type: "color",
|
|
1552
|
-
$value: "{color.<color>.text-subtle}"
|
|
1553
|
-
},
|
|
1554
|
-
"text-default": {
|
|
1555
|
-
$type: "color",
|
|
1556
|
-
$value: "{color.<color>.text-default}"
|
|
1557
|
-
},
|
|
1558
|
-
"base-default": {
|
|
1559
|
-
$type: "color",
|
|
1560
|
-
$value: "{color.<color>.base-default}"
|
|
1561
|
-
},
|
|
1562
|
-
"base-hover": {
|
|
1563
|
-
$type: "color",
|
|
1564
|
-
$value: "{color.<color>.base-hover}"
|
|
1565
|
-
},
|
|
1566
|
-
"base-active": {
|
|
1567
|
-
$type: "color",
|
|
1568
|
-
$value: "{color.<color>.base-active}"
|
|
1569
|
-
},
|
|
1570
|
-
"base-contrast-subtle": {
|
|
1571
|
-
$type: "color",
|
|
1572
|
-
$value: "{color.<color>.base-contrast-subtle}"
|
|
1573
|
-
},
|
|
1574
|
-
"base-contrast-default": {
|
|
1575
|
-
$type: "color",
|
|
1576
|
-
$value: "{color.<color>.base-contrast-default}"
|
|
1577
|
-
}
|
|
1578
|
-
};
|
|
1579
|
-
|
|
1580
|
-
// src/tokens/create/generators/semantic.ts
|
|
1581
|
-
var generateSemantic = (colors, _themeName) => {
|
|
1582
|
-
const mainColorNames = Object.keys(colors.main);
|
|
1583
|
-
const supportColorNames = Object.keys(colors.support);
|
|
1584
|
-
const modes = {
|
|
1585
|
-
"main-color": {},
|
|
1586
|
-
"support-color": {}
|
|
1459
|
+
},
|
|
1460
|
+
...remainingThemeFile
|
|
1587
1461
|
};
|
|
1588
|
-
const
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
color: {
|
|
1597
|
-
[category]: JSON.parse(
|
|
1598
|
-
JSON.stringify(
|
|
1599
|
-
color_template_default2,
|
|
1600
|
-
(key, value) => {
|
|
1601
|
-
if (key === "$value") {
|
|
1602
|
-
return value.replace("<color>", colorName);
|
|
1603
|
-
}
|
|
1604
|
-
return value;
|
|
1605
|
-
},
|
|
1606
|
-
2
|
|
1607
|
-
)
|
|
1608
|
-
)
|
|
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);
|
|
1609
1470
|
}
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
const customColors = [...mainColorNames, "neutral", ...supportColorNames];
|
|
1615
|
-
const allColors = [...customColors, ...baseColorNames];
|
|
1616
|
-
const semanticColorTokens = allColors.map(
|
|
1617
|
-
(colorName) => [
|
|
1618
|
-
colorName,
|
|
1619
|
-
R5.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), color_template_default)
|
|
1620
|
-
]
|
|
1471
|
+
return value;
|
|
1472
|
+
},
|
|
1473
|
+
2
|
|
1474
|
+
)
|
|
1621
1475
|
);
|
|
1622
|
-
|
|
1623
|
-
...color_base_template_default,
|
|
1624
|
-
color: {
|
|
1625
|
-
...Object.fromEntries(semanticColorTokens),
|
|
1626
|
-
...color_base_template_default.color
|
|
1627
|
-
}
|
|
1628
|
-
};
|
|
1629
|
-
return {
|
|
1630
|
-
modes,
|
|
1631
|
-
color
|
|
1632
|
-
};
|
|
1476
|
+
return token;
|
|
1633
1477
|
};
|
|
1634
|
-
|
|
1635
|
-
// src/tokens/create/generators/theme.ts
|
|
1636
|
-
import * as R6 from "ramda";
|
|
1637
|
-
|
|
1638
|
-
// src/tokens/template/design-tokens/themes/theme.base.template.json with { type: 'json' }
|
|
1639
|
-
var theme_base_template_default = {
|
|
1478
|
+
var generateBase = (themeName) => ({
|
|
1640
1479
|
color: {},
|
|
1641
1480
|
"font-family": {
|
|
1642
1481
|
$type: "fontFamilies",
|
|
1643
|
-
$value:
|
|
1482
|
+
$value: `{${themeName}.font-family}`
|
|
1644
1483
|
},
|
|
1645
1484
|
"font-weight": {
|
|
1646
1485
|
medium: {
|
|
1647
1486
|
$type: "fontWeights",
|
|
1648
|
-
$value:
|
|
1487
|
+
$value: `{${themeName}.font-weight.medium}`
|
|
1649
1488
|
},
|
|
1650
1489
|
semibold: {
|
|
1651
1490
|
$type: "fontWeights",
|
|
1652
|
-
$value:
|
|
1491
|
+
$value: `{${themeName}.font-weight.semibold}`
|
|
1653
1492
|
},
|
|
1654
1493
|
regular: {
|
|
1655
1494
|
$type: "fontWeights",
|
|
1656
|
-
$value:
|
|
1495
|
+
$value: `{${themeName}.font-weight.regular}`
|
|
1657
1496
|
}
|
|
1658
1497
|
},
|
|
1659
1498
|
"border-radius": {
|
|
@@ -1690,159 +1529,16 @@ var theme_base_template_default = {
|
|
|
1690
1529
|
$value: "4"
|
|
1691
1530
|
}
|
|
1692
1531
|
}
|
|
1693
|
-
};
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
"2": {
|
|
1702
|
-
$type: "color",
|
|
1703
|
-
$value: "{<theme>.<color>.2}"
|
|
1704
|
-
},
|
|
1705
|
-
"3": {
|
|
1706
|
-
$type: "color",
|
|
1707
|
-
$value: "{<theme>.<color>.3}"
|
|
1708
|
-
},
|
|
1709
|
-
"4": {
|
|
1710
|
-
$type: "color",
|
|
1711
|
-
$value: "{<theme>.<color>.4}"
|
|
1712
|
-
},
|
|
1713
|
-
"5": {
|
|
1714
|
-
$type: "color",
|
|
1715
|
-
$value: "{<theme>.<color>.5}"
|
|
1716
|
-
},
|
|
1717
|
-
"6": {
|
|
1718
|
-
$type: "color",
|
|
1719
|
-
$value: "{<theme>.<color>.6}"
|
|
1720
|
-
},
|
|
1721
|
-
"7": {
|
|
1722
|
-
$type: "color",
|
|
1723
|
-
$value: "{<theme>.<color>.7}"
|
|
1724
|
-
},
|
|
1725
|
-
"8": {
|
|
1726
|
-
$type: "color",
|
|
1727
|
-
$value: "{<theme>.<color>.8}"
|
|
1728
|
-
},
|
|
1729
|
-
"9": {
|
|
1730
|
-
$type: "color",
|
|
1731
|
-
$value: "{<theme>.<color>.9}"
|
|
1732
|
-
},
|
|
1733
|
-
"10": {
|
|
1734
|
-
$type: "color",
|
|
1735
|
-
$value: "{<theme>.<color>.10}"
|
|
1736
|
-
},
|
|
1737
|
-
"11": {
|
|
1738
|
-
$type: "color",
|
|
1739
|
-
$value: "{<theme>.<color>.11}"
|
|
1740
|
-
},
|
|
1741
|
-
"12": {
|
|
1742
|
-
$type: "color",
|
|
1743
|
-
$value: "{<theme>.<color>.12}"
|
|
1744
|
-
},
|
|
1745
|
-
"13": {
|
|
1746
|
-
$type: "color",
|
|
1747
|
-
$value: "{<theme>.<color>.13}"
|
|
1748
|
-
},
|
|
1749
|
-
"14": {
|
|
1750
|
-
$type: "color",
|
|
1751
|
-
$value: "{<theme>.<color>.14}"
|
|
1752
|
-
},
|
|
1753
|
-
"15": {
|
|
1754
|
-
$type: "color",
|
|
1755
|
-
$value: "{<theme>.<color>.15}"
|
|
1756
|
-
},
|
|
1757
|
-
"16": {
|
|
1758
|
-
$type: "color",
|
|
1759
|
-
$value: "{<theme>.<color>.16}"
|
|
1760
|
-
}
|
|
1761
|
-
};
|
|
1762
|
-
|
|
1763
|
-
// src/tokens/create/generators/theme.ts
|
|
1764
|
-
var generateTheme = (colors, themeName, borderRadius) => {
|
|
1765
|
-
const mainColorNames = Object.keys(colors.main);
|
|
1766
|
-
const supportColorNames = Object.keys(colors.support);
|
|
1767
|
-
const customColors = [...mainColorNames, "neutral", ...supportColorNames, ...baseColorNames];
|
|
1768
|
-
const themeColorTokens = Object.fromEntries(
|
|
1769
|
-
customColors.map(
|
|
1770
|
-
(colorName) => [
|
|
1771
|
-
colorName,
|
|
1772
|
-
R6.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), theme_template_default)
|
|
1773
|
-
]
|
|
1774
|
-
)
|
|
1775
|
-
);
|
|
1776
|
-
const { color: themeBaseFileColor, ...remainingThemeFile } = theme_base_template_default;
|
|
1777
|
-
const themeFile = {
|
|
1778
|
-
color: {
|
|
1779
|
-
...themeColorTokens,
|
|
1780
|
-
...themeBaseFileColor,
|
|
1781
|
-
link: {
|
|
1782
|
-
visited: {
|
|
1783
|
-
$type: "color",
|
|
1784
|
-
$value: `{${themeName}.link.visited}`
|
|
1785
|
-
}
|
|
1786
|
-
},
|
|
1787
|
-
focus: {
|
|
1788
|
-
"inner-color": {
|
|
1789
|
-
$type: "color",
|
|
1790
|
-
$value: `{${themeName}.focus.inner}`
|
|
1791
|
-
},
|
|
1792
|
-
"outer-color": {
|
|
1793
|
-
$type: "color",
|
|
1794
|
-
$value: `{${themeName}.focus.outer}`
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
},
|
|
1798
|
-
...remainingThemeFile
|
|
1799
|
-
};
|
|
1800
|
-
const baseBorderRadius = R6.lensPath(["border-radius", "base", "$value"]);
|
|
1801
|
-
const updatedThemeFile = R6.set(baseBorderRadius, String(borderRadius), themeFile);
|
|
1802
|
-
const token = JSON.parse(
|
|
1803
|
-
JSON.stringify(
|
|
1804
|
-
updatedThemeFile,
|
|
1805
|
-
(key, value) => {
|
|
1806
|
-
if (key === "$value") {
|
|
1807
|
-
return value.replace("<theme>", themeName);
|
|
1808
|
-
}
|
|
1809
|
-
return value;
|
|
1810
|
-
},
|
|
1811
|
-
2
|
|
1812
|
-
)
|
|
1813
|
-
);
|
|
1814
|
-
return token;
|
|
1815
|
-
};
|
|
1816
|
-
|
|
1817
|
-
// src/tokens/template/design-tokens/primitives/modes/typography/typography.template.json with { type: 'json' }
|
|
1818
|
-
var typography_template_default = {
|
|
1819
|
-
"<theme>": {
|
|
1820
|
-
"font-family": {
|
|
1821
|
-
$type: "fontFamilies",
|
|
1822
|
-
$value: "<font-family>"
|
|
1823
|
-
},
|
|
1824
|
-
"font-weight": {
|
|
1825
|
-
medium: {
|
|
1826
|
-
$type: "fontWeights",
|
|
1827
|
-
$value: "Medium"
|
|
1828
|
-
},
|
|
1829
|
-
semibold: {
|
|
1830
|
-
$type: "fontWeights",
|
|
1831
|
-
$value: "Semi bold"
|
|
1832
|
-
},
|
|
1833
|
-
regular: {
|
|
1834
|
-
$type: "fontWeights",
|
|
1835
|
-
$value: "Regular"
|
|
1836
|
-
}
|
|
1837
|
-
}
|
|
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
|
+
};
|
|
1838
1540
|
}
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
// src/tokens/create/generators/typography.ts
|
|
1842
|
-
var generateTypography = (themeName, { fontFamily }) => {
|
|
1843
|
-
return JSON.parse(
|
|
1844
|
-
JSON.stringify(typography_template_default).replaceAll(/<font-family>/g, fontFamily).replaceAll(/<theme>/g, themeName)
|
|
1845
|
-
);
|
|
1541
|
+
return colorScale;
|
|
1846
1542
|
};
|
|
1847
1543
|
|
|
1848
1544
|
// src/tokens/create.ts
|
|
@@ -1862,20 +1558,17 @@ var cliOptions = {
|
|
|
1862
1558
|
borderRadius: "border-radius"
|
|
1863
1559
|
}
|
|
1864
1560
|
};
|
|
1865
|
-
var createTokens = async (
|
|
1866
|
-
const { colors, typography: typography2, name, borderRadius, overrides } =
|
|
1561
|
+
var createTokens = async (theme) => {
|
|
1562
|
+
const { colors, typography: typography2, name, borderRadius, overrides } = theme;
|
|
1867
1563
|
const colorSchemes = ["light", "dark"];
|
|
1868
|
-
const
|
|
1564
|
+
const sizeModes2 = ["small", "medium", "large"];
|
|
1869
1565
|
const tokenSets = new Map([
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
"primitives/modes/typography/size/small",
|
|
1877
|
-
"primitives/modes/typography/size/medium",
|
|
1878
|
-
"primitives/modes/typography/size/large"
|
|
1566
|
+
["primitives/globals", generateGlobals()],
|
|
1567
|
+
...sizeModes2.map((size2) => [`primitives/modes/size/${size2}`, generateSize(size2)]),
|
|
1568
|
+
["primitives/modes/size/global", generateSizeGlobal()],
|
|
1569
|
+
...sizeModes2.map((size2) => [
|
|
1570
|
+
`primitives/modes/typography/size/${size2}`,
|
|
1571
|
+
generateFontSizes(size2)
|
|
1879
1572
|
]),
|
|
1880
1573
|
[`primitives/modes/typography/primary/${name}`, generateTypography(name, typography2)],
|
|
1881
1574
|
[`primitives/modes/typography/secondary/${name}`, generateTypography(name, typography2)],
|
|
@@ -1883,12 +1576,12 @@ var createTokens = async (opts) => {
|
|
|
1883
1576
|
[`primitives/modes/color-scheme/${scheme}/${name}`, generateColorScheme(name, scheme, colors, overrides)]
|
|
1884
1577
|
]),
|
|
1885
1578
|
[`themes/${name}`, generateTheme(colors, name, borderRadius)],
|
|
1886
|
-
["semantic/color",
|
|
1579
|
+
["semantic/color", generateSemanticColors(colors, name)],
|
|
1887
1580
|
// maps out semantic modes, ieg 'semantic/modes/main-color/accent', and 'semantic/modes/support-color/brand1'
|
|
1888
|
-
...Object.entries(
|
|
1581
|
+
...Object.entries(generateColorModes(colors, name)).flatMap(
|
|
1889
1582
|
([mode, colors2]) => Object.entries(colors2).map(([key, colorSet]) => [`semantic/modes/${mode}/${key}`, colorSet])
|
|
1890
1583
|
),
|
|
1891
|
-
|
|
1584
|
+
[`semantic/style`, generateSemanticStyle()]
|
|
1892
1585
|
]);
|
|
1893
1586
|
return { tokenSets };
|
|
1894
1587
|
};
|
|
@@ -2068,9 +1761,9 @@ async function createHash(text, algo = "SHA-1") {
|
|
|
2068
1761
|
(byte) => byte.toString(16).padStart(2, "0")
|
|
2069
1762
|
).join("");
|
|
2070
1763
|
}
|
|
2071
|
-
async function generate$Themes(colorSchemes, themes, colors) {
|
|
1764
|
+
async function generate$Themes(colorSchemes, themes, colors, sizeModes2) {
|
|
2072
1765
|
return [
|
|
2073
|
-
...generateSizeGroup(),
|
|
1766
|
+
...generateSizeGroup(sizeModes2),
|
|
2074
1767
|
...await generateThemesGroup(themes),
|
|
2075
1768
|
...generateTypographyGroup(themes),
|
|
2076
1769
|
...generateColorSchemesGroup(colorSchemes, themes),
|
|
@@ -2079,7 +1772,7 @@ async function generate$Themes(colorSchemes, themes, colors) {
|
|
|
2079
1772
|
...await generateColorGroup("support", colors)
|
|
2080
1773
|
];
|
|
2081
1774
|
}
|
|
2082
|
-
function generateSizeGroup() {
|
|
1775
|
+
function generateSizeGroup(_sizes) {
|
|
2083
1776
|
return [
|
|
2084
1777
|
{
|
|
2085
1778
|
id: "8b2c8cc86611a34b135cb22948666779361fd729",
|
|
@@ -2233,7 +1926,7 @@ import * as R8 from "ramda";
|
|
|
2233
1926
|
// package.json
|
|
2234
1927
|
var package_default = {
|
|
2235
1928
|
name: "@digdir/designsystemet",
|
|
2236
|
-
version: "1.
|
|
1929
|
+
version: "1.12.0",
|
|
2237
1930
|
description: "CLI for Designsystemet",
|
|
2238
1931
|
author: "Designsystemet team",
|
|
2239
1932
|
engines: {
|
|
@@ -2285,9 +1978,8 @@ var package_default = {
|
|
|
2285
1978
|
"test:tokens-build-config-tailwind": "pnpm run designsystemet tokens build -t ./temp/config/design-tokens -o ./temp/config/build --clean --experimental-tailwind",
|
|
2286
1979
|
"test:tokens-create-and-build-options": "pnpm test:tokens-create-options && pnpm test:tokens-build",
|
|
2287
1980
|
"test:tokens-create-and-build-config": "pnpm test:tokens-create-config && pnpm test:tokens-build-config",
|
|
2288
|
-
"test:generate-config-from-tokens": "pnpm run designsystemet generate-config-from-tokens -d ../../
|
|
1981
|
+
"test:generate-config-from-tokens": "pnpm run designsystemet generate-config-from-tokens -d ../../design-tokens --dry",
|
|
2289
1982
|
test: "node -v && pnpm test:tokens-create-and-build-options && pnpm test:generate-config-from-tokens && pnpm test:tokens-create-and-build-config",
|
|
2290
|
-
"update:template": "tsx ./src/scripts/update-template.ts",
|
|
2291
1983
|
"update:preview-tokens": "tsx ./src/scripts/update-preview-tokens.ts",
|
|
2292
1984
|
verify: "pnpm test && pnpm update:template && pnpm --filter @internal/digdir update:theme-digdir"
|
|
2293
1985
|
},
|
|
@@ -2296,22 +1988,22 @@ var package_default = {
|
|
|
2296
1988
|
"@digdir/designsystemet-types": "workspace:^",
|
|
2297
1989
|
"@tokens-studio/sd-transforms": "2.0.3",
|
|
2298
1990
|
"chroma-js": "^3.2.0",
|
|
2299
|
-
"colorjs.io": "^0.6.
|
|
2300
|
-
commander: "^14.0.
|
|
1991
|
+
"colorjs.io": "^0.6.1",
|
|
1992
|
+
commander: "^14.0.3",
|
|
2301
1993
|
"fast-glob": "^3.3.3",
|
|
2302
1994
|
hsluv: "^1.0.1",
|
|
2303
1995
|
"object-hash": "^3.0.0",
|
|
2304
1996
|
picocolors: "^1.1.1",
|
|
2305
1997
|
postcss: "^8.5.6",
|
|
2306
1998
|
ramda: "^0.32.0",
|
|
2307
|
-
"style-dictionary": "^5.
|
|
2308
|
-
zod: "^4.3.
|
|
1999
|
+
"style-dictionary": "^5.3.0",
|
|
2000
|
+
zod: "^4.3.6",
|
|
2309
2001
|
"zod-validation-error": "^5.0.0"
|
|
2310
2002
|
},
|
|
2311
2003
|
devDependencies: {
|
|
2312
2004
|
"@tokens-studio/types": "0.5.2",
|
|
2313
2005
|
"@types/chroma-js": "^3.1.2",
|
|
2314
|
-
"@types/node": "^24.10.
|
|
2006
|
+
"@types/node": "^24.10.13",
|
|
2315
2007
|
"@types/object-hash": "^3.0.6",
|
|
2316
2008
|
"@types/ramda": "^0.31.1",
|
|
2317
2009
|
tsup: "^8.5.1",
|
|
@@ -3274,8 +2966,8 @@ var getMultidimensionalThemes = (processed$themes, dimensions) => {
|
|
|
3274
2966
|
const grouped$themes = groupThemes(processed$themes);
|
|
3275
2967
|
const permutations = permutateThemes(grouped$themes);
|
|
3276
2968
|
const ALL_DEPENDENT_ON = ["theme"];
|
|
3277
|
-
const
|
|
3278
|
-
const nonDependentKeys =
|
|
2969
|
+
const keys3 = R20.keys(grouped$themes);
|
|
2970
|
+
const nonDependentKeys = keys3.filter((x) => ![...ALL_DEPENDENT_ON, ...dimensions].includes(x));
|
|
3279
2971
|
if (verboseLogging) {
|
|
3280
2972
|
console.log(pc2.cyan(`\u{1F50E} Finding theme permutations for ${dimensions}`));
|
|
3281
2973
|
console.log(pc2.cyan(` (ignoring permutations for ${nonDependentKeys})`));
|
|
@@ -3536,10 +3228,10 @@ async function processPlatform(options) {
|
|
|
3536
3228
|
console.log(`
|
|
3537
3229
|
\u{1F3A8} Using ${pc3.blue(buildOptions.defaultColor)} as default color`);
|
|
3538
3230
|
}
|
|
3539
|
-
const
|
|
3540
|
-
buildOptions.sizeModes =
|
|
3231
|
+
const sizeModes2 = processed$themes.filter((x) => x.group === "size").map((x) => x.name);
|
|
3232
|
+
buildOptions.sizeModes = sizeModes2;
|
|
3541
3233
|
if (!buildOptions.defaultSize) {
|
|
3542
|
-
const defaultSize = R22.head(
|
|
3234
|
+
const defaultSize = R22.head(sizeModes2);
|
|
3543
3235
|
buildOptions.defaultSize = defaultSize;
|
|
3544
3236
|
}
|
|
3545
3237
|
if (buildOptions.defaultSize) {
|
|
@@ -3629,7 +3321,8 @@ var formatTokens = async (options) => {
|
|
|
3629
3321
|
};
|
|
3630
3322
|
var formatTheme = async (themeConfig) => {
|
|
3631
3323
|
const { tokenSets } = await createTokens(themeConfig);
|
|
3632
|
-
const
|
|
3324
|
+
const sizeModes2 = ["small", "medium", "large"];
|
|
3325
|
+
const $themes = await generate$Themes(["dark", "light"], [themeConfig.name], themeConfig.colors, sizeModes2);
|
|
3633
3326
|
const processed$themes = $themes.map(processThemeObject);
|
|
3634
3327
|
const processedBuilds = await formatTokens({
|
|
3635
3328
|
tokenSets,
|