@digdir/designsystemet 1.13.1 → 1.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/config.js +50 -658
- package/dist/bin/designsystemet.js +131 -4623
- package/dist/bin/options.js +22 -14
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BorderValues.js +9 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js +8 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js +13 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js +10 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js +10 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/Properties.js +53 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js +14 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js +9 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TokenTypes.js +32 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/constants/TypographyValues.js +15 -0
- package/dist/node_modules/.pnpm/@tokens-studio_types@0.5.2/node_modules/@tokens-studio/types/dist/types/index.js +11 -0
- package/dist/package.js +5 -0
- package/dist/src/colors/colorMetadata.js +255 -261
- package/dist/src/colors/index.js +5 -522
- package/dist/src/colors/theme.js +104 -343
- package/dist/src/colors/types.js +22 -25
- package/dist/src/colors/utils.js +241 -154
- package/dist/src/config.js +103 -444
- package/dist/src/index.js +10 -3588
- package/dist/src/migrations/beta-to-v1.js +339 -537
- package/dist/src/migrations/codemods/css/plugins.js +31 -42
- package/dist/src/migrations/codemods/css/run.js +20 -151
- package/dist/src/migrations/color-rename-next49.js +44 -220
- package/dist/src/migrations/index.js +7 -577
- package/dist/src/tokens/build.js +39 -1816
- package/dist/src/tokens/create/files.js +43 -602
- package/dist/src/tokens/create/generators/$designsystemet.js +8 -97
- package/dist/src/tokens/create/generators/$metadata.js +17 -20
- package/dist/src/tokens/create/generators/$themes.js +137 -311
- package/dist/src/tokens/create/generators/primitives/color-scheme.js +68 -443
- package/dist/src/tokens/create/generators/primitives/globals.js +141 -147
- package/dist/src/tokens/create/generators/primitives/size.js +146 -156
- package/dist/src/tokens/create/generators/primitives/typography.js +213 -217
- package/dist/src/tokens/create/generators/semantic/color-modes.js +24 -59
- package/dist/src/tokens/create/generators/semantic/color.js +42 -326
- package/dist/src/tokens/create/generators/semantic/style.js +379 -382
- package/dist/src/tokens/create/generators/themes/theme.js +108 -392
- package/dist/src/tokens/create.js +47 -1591
- package/dist/src/tokens/format.js +38 -3324
- package/dist/src/tokens/generate-config.js +155 -298
- package/dist/src/tokens/index.js +3 -3344
- package/dist/src/tokens/process/configs/color.js +50 -1086
- package/dist/src/tokens/process/configs/semantic.js +45 -1084
- package/dist/src/tokens/process/configs/shared.js +18 -109
- package/dist/src/tokens/process/configs/size-mode.js +27 -1083
- package/dist/src/tokens/process/configs/size.js +32 -1084
- package/dist/src/tokens/process/configs/type-scale.js +49 -1084
- package/dist/src/tokens/process/configs/typography.js +63 -1085
- package/dist/src/tokens/process/configs.js +88 -1225
- package/dist/src/tokens/process/formats/css/color.js +58 -1080
- package/dist/src/tokens/process/formats/css/semantic.js +27 -1082
- package/dist/src/tokens/process/formats/css/size-mode.js +43 -1078
- package/dist/src/tokens/process/formats/css/size.js +86 -1080
- package/dist/src/tokens/process/formats/css/type-scale.js +53 -1084
- package/dist/src/tokens/process/formats/css/typography.js +27 -1082
- package/dist/src/tokens/process/formats/css.js +18 -1082
- package/dist/src/tokens/process/output/declarations.js +18 -1202
- package/dist/src/tokens/process/output/tailwind.js +26 -40
- package/dist/src/tokens/process/output/theme.js +73 -206
- package/dist/src/tokens/process/platform.js +165 -1356
- package/dist/src/tokens/process/transformers.js +49 -89
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +100 -1183
- package/dist/src/tokens/process/utils/kebab-case.js +7 -5
- package/dist/src/tokens/types.js +6 -7
- package/dist/src/tokens/utils.js +102 -93
- package/dist/src/types.js +1 -5
- package/dist/src/utils/filesystem.js +112 -124
- package/package.json +18 -21
- package/configs/test-tokens.config.json +0 -82
- package/dist/src/scripts/createJsonSchema.js +0 -409
- package/dist/src/scripts/update-preview-tokens.js +0 -3353
|
@@ -1,220 +1,216 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
$value: "170%"
|
|
37
|
-
}
|
|
1
|
+
//#region src/tokens/create/generators/primitives/typography.ts
|
|
2
|
+
const generateTypography = (themeName, { fontFamily }) => ({ [themeName]: {
|
|
3
|
+
"font-family": {
|
|
4
|
+
$type: "fontFamilies",
|
|
5
|
+
$value: fontFamily
|
|
6
|
+
},
|
|
7
|
+
"font-weight": {
|
|
8
|
+
medium: {
|
|
9
|
+
$type: "fontWeights",
|
|
10
|
+
$value: "Medium"
|
|
11
|
+
},
|
|
12
|
+
semibold: {
|
|
13
|
+
$type: "fontWeights",
|
|
14
|
+
$value: "Semi bold"
|
|
15
|
+
},
|
|
16
|
+
regular: {
|
|
17
|
+
$type: "fontWeights",
|
|
18
|
+
$value: "Regular"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
} });
|
|
22
|
+
const generateFontSizes = (size) => fontSizes[size];
|
|
23
|
+
const lineHeights = {
|
|
24
|
+
sm: {
|
|
25
|
+
$type: "lineHeights",
|
|
26
|
+
$value: "130%"
|
|
27
|
+
},
|
|
28
|
+
md: {
|
|
29
|
+
$type: "lineHeights",
|
|
30
|
+
$value: "150%"
|
|
31
|
+
},
|
|
32
|
+
lg: {
|
|
33
|
+
$type: "lineHeights",
|
|
34
|
+
$value: "170%"
|
|
35
|
+
}
|
|
38
36
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
37
|
+
const letterSpacings = {
|
|
38
|
+
"1": {
|
|
39
|
+
$type: "letterSpacing",
|
|
40
|
+
$value: "-1%"
|
|
41
|
+
},
|
|
42
|
+
"2": {
|
|
43
|
+
$type: "letterSpacing",
|
|
44
|
+
$value: "-0.5%"
|
|
45
|
+
},
|
|
46
|
+
"3": {
|
|
47
|
+
$type: "letterSpacing",
|
|
48
|
+
$value: "-0.25%"
|
|
49
|
+
},
|
|
50
|
+
"4": {
|
|
51
|
+
$type: "letterSpacing",
|
|
52
|
+
$value: "-0.15%"
|
|
53
|
+
},
|
|
54
|
+
"5": {
|
|
55
|
+
$type: "letterSpacing",
|
|
56
|
+
$value: "0%"
|
|
57
|
+
},
|
|
58
|
+
"6": {
|
|
59
|
+
$type: "letterSpacing",
|
|
60
|
+
$value: "0.15%"
|
|
61
|
+
},
|
|
62
|
+
"7": {
|
|
63
|
+
$type: "letterSpacing",
|
|
64
|
+
$value: "0.25%"
|
|
65
|
+
},
|
|
66
|
+
"8": {
|
|
67
|
+
$type: "letterSpacing",
|
|
68
|
+
$value: "0.5%"
|
|
69
|
+
},
|
|
70
|
+
"9": {
|
|
71
|
+
$type: "letterSpacing",
|
|
72
|
+
$value: "1.5%"
|
|
73
|
+
}
|
|
76
74
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
};
|
|
217
|
-
export {
|
|
218
|
-
generateFontSizes,
|
|
219
|
-
generateTypography
|
|
75
|
+
const fontSizes = {
|
|
76
|
+
large: {
|
|
77
|
+
"line-height": lineHeights,
|
|
78
|
+
"font-size": {
|
|
79
|
+
"1": {
|
|
80
|
+
$type: "fontSizes",
|
|
81
|
+
$value: "13"
|
|
82
|
+
},
|
|
83
|
+
"2": {
|
|
84
|
+
$type: "fontSizes",
|
|
85
|
+
$value: "16"
|
|
86
|
+
},
|
|
87
|
+
"3": {
|
|
88
|
+
$type: "fontSizes",
|
|
89
|
+
$value: "18"
|
|
90
|
+
},
|
|
91
|
+
"4": {
|
|
92
|
+
$type: "fontSizes",
|
|
93
|
+
$value: "21"
|
|
94
|
+
},
|
|
95
|
+
"5": {
|
|
96
|
+
$type: "fontSizes",
|
|
97
|
+
$value: "24"
|
|
98
|
+
},
|
|
99
|
+
"6": {
|
|
100
|
+
$type: "fontSizes",
|
|
101
|
+
$value: "30"
|
|
102
|
+
},
|
|
103
|
+
"7": {
|
|
104
|
+
$type: "fontSizes",
|
|
105
|
+
$value: "36"
|
|
106
|
+
},
|
|
107
|
+
"8": {
|
|
108
|
+
$type: "fontSizes",
|
|
109
|
+
$value: "48"
|
|
110
|
+
},
|
|
111
|
+
"9": {
|
|
112
|
+
$type: "fontSizes",
|
|
113
|
+
$value: "60"
|
|
114
|
+
},
|
|
115
|
+
"10": {
|
|
116
|
+
$type: "fontSizes",
|
|
117
|
+
$value: "72"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"letter-spacing": letterSpacings
|
|
121
|
+
},
|
|
122
|
+
medium: {
|
|
123
|
+
"line-height": lineHeights,
|
|
124
|
+
"font-size": {
|
|
125
|
+
"1": {
|
|
126
|
+
$type: "fontSizes",
|
|
127
|
+
$value: "12"
|
|
128
|
+
},
|
|
129
|
+
"2": {
|
|
130
|
+
$type: "fontSizes",
|
|
131
|
+
$value: "14"
|
|
132
|
+
},
|
|
133
|
+
"3": {
|
|
134
|
+
$type: "fontSizes",
|
|
135
|
+
$value: "16"
|
|
136
|
+
},
|
|
137
|
+
"4": {
|
|
138
|
+
$type: "fontSizes",
|
|
139
|
+
$value: "18"
|
|
140
|
+
},
|
|
141
|
+
"5": {
|
|
142
|
+
$type: "fontSizes",
|
|
143
|
+
$value: "21"
|
|
144
|
+
},
|
|
145
|
+
"6": {
|
|
146
|
+
$type: "fontSizes",
|
|
147
|
+
$value: "24"
|
|
148
|
+
},
|
|
149
|
+
"7": {
|
|
150
|
+
$type: "fontSizes",
|
|
151
|
+
$value: "30"
|
|
152
|
+
},
|
|
153
|
+
"8": {
|
|
154
|
+
$type: "fontSizes",
|
|
155
|
+
$value: "36"
|
|
156
|
+
},
|
|
157
|
+
"9": {
|
|
158
|
+
$type: "fontSizes",
|
|
159
|
+
$value: "48"
|
|
160
|
+
},
|
|
161
|
+
"10": {
|
|
162
|
+
$type: "fontSizes",
|
|
163
|
+
$value: "60"
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"letter-spacing": letterSpacings
|
|
167
|
+
},
|
|
168
|
+
small: {
|
|
169
|
+
"line-height": lineHeights,
|
|
170
|
+
"font-size": {
|
|
171
|
+
"1": {
|
|
172
|
+
$type: "fontSizes",
|
|
173
|
+
$value: "11"
|
|
174
|
+
},
|
|
175
|
+
"2": {
|
|
176
|
+
$type: "fontSizes",
|
|
177
|
+
$value: "13"
|
|
178
|
+
},
|
|
179
|
+
"3": {
|
|
180
|
+
$type: "fontSizes",
|
|
181
|
+
$value: "14"
|
|
182
|
+
},
|
|
183
|
+
"4": {
|
|
184
|
+
$type: "fontSizes",
|
|
185
|
+
$value: "16"
|
|
186
|
+
},
|
|
187
|
+
"5": {
|
|
188
|
+
$type: "fontSizes",
|
|
189
|
+
$value: "18"
|
|
190
|
+
},
|
|
191
|
+
"6": {
|
|
192
|
+
$type: "fontSizes",
|
|
193
|
+
$value: "21"
|
|
194
|
+
},
|
|
195
|
+
"7": {
|
|
196
|
+
$type: "fontSizes",
|
|
197
|
+
$value: "24"
|
|
198
|
+
},
|
|
199
|
+
"8": {
|
|
200
|
+
$type: "fontSizes",
|
|
201
|
+
$value: "30"
|
|
202
|
+
},
|
|
203
|
+
"9": {
|
|
204
|
+
$type: "fontSizes",
|
|
205
|
+
$value: "36"
|
|
206
|
+
},
|
|
207
|
+
"10": {
|
|
208
|
+
$type: "fontSizes",
|
|
209
|
+
$value: "48"
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
"letter-spacing": letterSpacings
|
|
213
|
+
}
|
|
220
214
|
};
|
|
215
|
+
//#endregion
|
|
216
|
+
export { generateFontSizes, generateTypography };
|
|
@@ -1,61 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"base-hover": 13,
|
|
17
|
-
"base-active": 14,
|
|
18
|
-
"base-contrast-subtle": 15,
|
|
19
|
-
"base-contrast-default": 16
|
|
1
|
+
import { semanticColorNames } from "../../../../colors/types.js";
|
|
2
|
+
//#region src/tokens/create/generators/semantic/color-modes.ts
|
|
3
|
+
const generateColorModes = (colors, _themeName) => {
|
|
4
|
+
const mainColorNames = Object.keys(colors.main);
|
|
5
|
+
const supportColorNames = Object.keys(colors.support);
|
|
6
|
+
const modes = {
|
|
7
|
+
"main-color": {},
|
|
8
|
+
"support-color": {}
|
|
9
|
+
};
|
|
10
|
+
const categories = [["main-color", mainColorNames], ["support-color", supportColorNames]];
|
|
11
|
+
for (const [colorCategory, colorNames] of categories) for (const colorName of colorNames) {
|
|
12
|
+
const customColorTokens = { color: { [colorCategory.replace("-color", "")]: generateColorScaleTokens(colorName) } };
|
|
13
|
+
modes[colorCategory][colorName] = customColorTokens;
|
|
14
|
+
}
|
|
15
|
+
return modes;
|
|
20
16
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const modes = {
|
|
29
|
-
"main-color": {},
|
|
30
|
-
"support-color": {}
|
|
31
|
-
};
|
|
32
|
-
const categories = [
|
|
33
|
-
["main-color", mainColorNames],
|
|
34
|
-
["support-color", supportColorNames]
|
|
35
|
-
];
|
|
36
|
-
for (const [colorCategory, colorNames] of categories) {
|
|
37
|
-
for (const colorName of colorNames) {
|
|
38
|
-
const category = colorCategory.replace("-color", "");
|
|
39
|
-
const customColorTokens = {
|
|
40
|
-
color: {
|
|
41
|
-
[category]: generateColorScaleTokens(colorName)
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
modes[colorCategory][colorName] = customColorTokens;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return modes;
|
|
48
|
-
};
|
|
49
|
-
var generateColorScaleTokens = (colorName) => {
|
|
50
|
-
const colorScale = {};
|
|
51
|
-
for (const colorSemantic of semanticColorNames) {
|
|
52
|
-
colorScale[colorSemantic] = {
|
|
53
|
-
$type: "color",
|
|
54
|
-
$value: `{color.${colorName}.${colorSemantic}}`
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return colorScale;
|
|
58
|
-
};
|
|
59
|
-
export {
|
|
60
|
-
generateColorModes
|
|
17
|
+
const generateColorScaleTokens = (colorName) => {
|
|
18
|
+
const colorScale = {};
|
|
19
|
+
for (const colorSemantic of semanticColorNames) colorScale[colorSemantic] = {
|
|
20
|
+
$type: "color",
|
|
21
|
+
$value: `{color.${colorName}.${colorSemantic}}`
|
|
22
|
+
};
|
|
23
|
+
return colorScale;
|
|
61
24
|
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { generateColorModes };
|