@digdir/designsystemet 1.0.2 → 1.0.4
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/designsystemet.js +4264 -45
- package/dist/bin/options.js +5 -4
- package/dist/src/colors/colorMetadata.d.ts.map +1 -1
- package/dist/src/colors/colorMetadata.js +84 -35
- package/dist/src/colors/index.js +470 -4
- package/dist/src/colors/theme.d.ts.map +1 -1
- package/dist/src/colors/theme.js +290 -18
- package/dist/src/colors/types.d.ts +4 -1
- package/dist/src/colors/types.d.ts.map +1 -1
- package/dist/src/colors/utils.js +16 -15
- package/dist/{bin → src}/config.d.ts +46 -1
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +377 -0
- package/dist/src/index.js +3666 -2
- package/dist/src/migrations/beta-to-v1.js +85 -4
- package/dist/src/migrations/codemods/css/plugins.js +5 -4
- package/dist/src/migrations/codemods/css/run.d.ts.map +1 -1
- package/dist/src/migrations/codemods/css/run.js +18 -4
- package/dist/src/migrations/color-rename-next49.js +77 -6
- package/dist/src/migrations/index.d.ts +0 -1
- package/dist/src/migrations/index.d.ts.map +1 -1
- package/dist/src/migrations/index.js +461 -6
- package/dist/src/scripts/createJsonSchema.js +1608 -4
- package/dist/src/scripts/update-design-tokens.d.ts +2 -0
- package/dist/src/scripts/update-design-tokens.d.ts.map +1 -0
- package/dist/src/scripts/update-design-tokens.js +36 -0
- package/dist/src/{tokens/template.d.ts → scripts/update-template.d.ts} +1 -1
- package/dist/src/scripts/update-template.d.ts.map +1 -0
- package/dist/src/scripts/update-template.js +1200 -0
- package/dist/src/tokens/build.d.ts +2 -19
- package/dist/src/tokens/build.d.ts.map +1 -1
- package/dist/src/tokens/build.js +1511 -70
- package/dist/src/tokens/create/defaults.d.ts +7 -0
- package/dist/src/tokens/create/defaults.d.ts.map +1 -0
- package/dist/src/tokens/create/defaults.js +994 -0
- package/dist/src/tokens/create/generators/$designsystemet.d.ts +5 -0
- package/dist/src/tokens/create/generators/$designsystemet.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/$designsystemet.js +100 -0
- package/dist/src/tokens/create/generators/$metadata.d.ts +8 -0
- package/dist/src/tokens/create/generators/$metadata.d.ts.map +1 -0
- package/dist/src/tokens/{write/generate$metadata.js → create/generators/$metadata.js} +3 -2
- package/dist/src/tokens/create/generators/$themes.d.ts +12 -0
- package/dist/src/tokens/create/generators/$themes.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/$themes.js +333 -0
- package/dist/src/tokens/create/generators/color.d.ts +5 -0
- package/dist/src/tokens/create/generators/color.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/color.js +374 -0
- package/dist/src/tokens/create/generators/semantic.d.ts +296 -0
- package/dist/src/tokens/create/generators/semantic.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/semantic.js +483 -0
- package/dist/src/tokens/create/generators/theme.d.ts +3 -0
- package/dist/src/tokens/create/generators/theme.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/theme.js +168 -0
- package/dist/src/tokens/create/generators/typography.d.ts +3 -0
- package/dist/src/tokens/create/generators/typography.d.ts.map +1 -0
- package/dist/src/tokens/create/generators/typography.js +33 -0
- package/dist/src/tokens/{write.d.ts → create/write.d.ts} +2 -2
- package/dist/src/tokens/create/write.d.ts.map +1 -0
- package/dist/src/tokens/create/write.js +546 -0
- package/dist/src/tokens/create.d.ts +4 -2
- package/dist/src/tokens/create.d.ts.map +1 -1
- package/dist/src/tokens/create.js +2049 -59
- package/dist/src/tokens/format.d.ts +16 -0
- package/dist/src/tokens/format.d.ts.map +1 -0
- package/dist/src/tokens/format.js +3514 -0
- package/dist/src/tokens/index.d.ts +1 -0
- package/dist/src/tokens/index.d.ts.map +1 -1
- package/dist/src/tokens/index.js +3526 -2
- package/dist/src/tokens/process/configs/color.d.ts +12 -0
- package/dist/src/tokens/process/configs/color.d.ts.map +1 -0
- package/dist/src/tokens/process/configs/color.js +823 -0
- package/dist/src/tokens/process/configs/semantic.d.ts +3 -0
- package/dist/src/tokens/process/configs/semantic.d.ts.map +1 -0
- package/dist/src/tokens/process/configs/semantic.js +367 -0
- package/dist/src/tokens/process/configs/shared.d.ts +10 -0
- package/dist/src/tokens/process/configs/shared.d.ts.map +1 -0
- package/dist/src/tokens/process/configs/shared.js +99 -0
- package/dist/src/tokens/process/configs/storefront.d.ts +3 -0
- package/dist/src/tokens/process/configs/storefront.d.ts.map +1 -0
- package/dist/src/tokens/process/configs/storefront.js +220 -0
- package/dist/src/tokens/process/configs/typography.d.ts +3 -0
- package/dist/src/tokens/process/configs/typography.d.ts.map +1 -0
- package/dist/src/tokens/process/configs/typography.js +369 -0
- package/dist/src/tokens/{build → process}/configs.d.ts +3 -11
- package/dist/src/tokens/process/configs.d.ts.map +1 -0
- package/dist/src/tokens/process/configs.js +976 -0
- package/dist/src/tokens/process/formats/css/color.d.ts +4 -0
- package/dist/src/tokens/process/formats/css/color.d.ts.map +1 -0
- package/dist/src/tokens/process/formats/css/color.js +128 -0
- package/dist/src/tokens/process/formats/css/semantic.d.ts +17 -0
- package/dist/src/tokens/process/formats/css/semantic.d.ts.map +1 -0
- package/dist/src/tokens/process/formats/css/semantic.js +109 -0
- package/dist/src/tokens/process/formats/css/typography.d.ts +3 -0
- package/dist/src/tokens/process/formats/css/typography.d.ts.map +1 -0
- package/dist/src/tokens/process/formats/css/typography.js +32 -0
- package/dist/src/tokens/process/formats/css.d.ts +8 -0
- package/dist/src/tokens/process/formats/css.d.ts.map +1 -0
- package/dist/src/tokens/{build → process}/formats/css.js +94 -57
- package/dist/src/tokens/process/formats/js-tokens.d.ts.map +1 -0
- package/dist/src/tokens/process/formats/js-tokens.js +109 -0
- package/dist/src/tokens/process/platform.d.ts +87 -0
- package/dist/src/tokens/process/platform.d.ts.map +1 -0
- package/dist/src/tokens/process/platform.js +1090 -0
- package/dist/src/tokens/process/transformers.d.ts.map +1 -0
- package/dist/src/tokens/{build → process}/transformers.js +29 -6
- package/dist/src/tokens/{build → process}/utils/getMultidimensionalThemes.d.ts +3 -3
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.d.ts.map +1 -0
- package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +922 -0
- package/dist/src/tokens/template/design-tokens/primitives/globals.js +5 -0
- package/dist/src/tokens/template/design-tokens/primitives/modes/size/global.js +5 -0
- package/dist/src/tokens/template/design-tokens/primitives/modes/size/large.js +5 -0
- package/dist/src/tokens/template/design-tokens/primitives/modes/size/medium.js +5 -0
- package/dist/src/tokens/template/design-tokens/primitives/modes/size/small.js +5 -0
- package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/large.js +5 -0
- package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/medium.js +5 -0
- package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/small.js +5 -0
- package/dist/src/tokens/template/design-tokens/primitives/modes/typography/typography.template.js +5 -0
- package/dist/src/tokens/template/design-tokens/semantic/color.base.template.js +5 -0
- package/dist/src/tokens/template/design-tokens/semantic/color.template.js +5 -0
- package/dist/src/tokens/template/design-tokens/semantic/modes/color.template.js +5 -0
- package/dist/src/tokens/template/design-tokens/semantic/style.js +5 -0
- package/dist/src/tokens/template/design-tokens/themes/theme.base.template.js +5 -0
- package/dist/src/tokens/template/design-tokens/themes/theme.template.js +5 -0
- package/dist/src/tokens/types.d.ts +54 -38
- package/dist/src/tokens/types.d.ts.map +1 -1
- package/dist/src/tokens/types.js +8 -0
- package/dist/src/tokens/utils.d.ts +30 -5
- package/dist/src/tokens/utils.d.ts.map +1 -1
- package/dist/src/tokens/utils.js +36 -50
- package/dist/src/utils.d.ts +18 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +63 -0
- package/dist/typography.template-4N5YLH7F.json +22 -0
- package/package.json +17 -16
- package/dist/bin/config.d.ts.map +0 -1
- package/dist/bin/config.js +0 -71
- package/dist/src/migrations/codemods/jsx/classname-prefix.d.ts +0 -10
- package/dist/src/migrations/codemods/jsx/classname-prefix.d.ts.map +0 -1
- package/dist/src/migrations/codemods/jsx/classname-prefix.js +0 -64
- package/dist/src/migrations/codemods/jsx/run.d.ts +0 -7
- package/dist/src/migrations/codemods/jsx/run.d.ts.map +0 -1
- package/dist/src/migrations/codemods/jsx/run.js +0 -22
- package/dist/src/migrations/react-beta-to-v1.d.ts +0 -3
- package/dist/src/migrations/react-beta-to-v1.d.ts.map +0 -1
- package/dist/src/migrations/react-beta-to-v1.js +0 -5
- package/dist/src/scripts/copy-internal-tokens.d.ts +0 -2
- package/dist/src/scripts/copy-internal-tokens.d.ts.map +0 -1
- package/dist/src/scripts/copy-internal-tokens.js +0 -28
- package/dist/src/tokens/build/configs.d.ts.map +0 -1
- package/dist/src/tokens/build/configs.js +0 -280
- package/dist/src/tokens/build/formats/css.d.ts +0 -53
- package/dist/src/tokens/build/formats/css.d.ts.map +0 -1
- package/dist/src/tokens/build/formats/js-tokens.d.ts.map +0 -1
- package/dist/src/tokens/build/formats/js-tokens.js +0 -48
- package/dist/src/tokens/build/transformers.d.ts.map +0 -1
- package/dist/src/tokens/build/types.d.ts +0 -48
- package/dist/src/tokens/build/types.d.ts.map +0 -1
- package/dist/src/tokens/build/types.js +0 -7
- package/dist/src/tokens/build/utils/entryfile.d.ts +0 -12
- package/dist/src/tokens/build/utils/entryfile.d.ts.map +0 -1
- package/dist/src/tokens/build/utils/entryfile.js +0 -67
- package/dist/src/tokens/build/utils/getMultidimensionalThemes.d.ts.map +0 -1
- package/dist/src/tokens/build/utils/getMultidimensionalThemes.js +0 -112
- package/dist/src/tokens/design-tokens/template/$metadata.json +0 -25
- package/dist/src/tokens/design-tokens/template/$themes.json +0 -1498
- package/dist/src/tokens/template.d.ts.map +0 -1
- package/dist/src/tokens/template.js +0 -99
- package/dist/src/tokens/write/generate$metadata.d.ts +0 -9
- package/dist/src/tokens/write/generate$metadata.d.ts.map +0 -1
- package/dist/src/tokens/write/generate$themes.d.ts +0 -12
- package/dist/src/tokens/write/generate$themes.d.ts.map +0 -1
- package/dist/src/tokens/write/generate$themes.js +0 -161
- package/dist/src/tokens/write.d.ts.map +0 -1
- package/dist/src/tokens/write.js +0 -177
- /package/dist/{src/tokens/design-tokens/template/semantic/color-base-file.json → color.base.template-M7BHS4OV.json} +0 -0
- /package/dist/{src/tokens/design-tokens/template/semantic/modes/category-color/category-color-template.json → color.template-LMPUQ72A.json} +0 -0
- /package/dist/{src/tokens/design-tokens/template/semantic/semantic-color-template.json → color.template-XQNSHLTU.json} +0 -0
- /package/dist/{src/tokens/design-tokens/default/primitives/modes/size/global.json → global-XVXVBKM6.json} +0 -0
- /package/dist/{src/tokens/design-tokens/default/primitives/globals.json → globals-76VAFMDF.json} +0 -0
- /package/dist/{src/tokens/design-tokens/default/primitives/modes/typography/size/large.json → large-CIIHO7AY.json} +0 -0
- /package/dist/{src/tokens/design-tokens/default/primitives/modes/size/large.json → large-UUOZ6DYI.json} +0 -0
- /package/dist/{src/tokens/design-tokens/default/primitives/modes/size/medium.json → medium-OQ7S7P4P.json} +0 -0
- /package/dist/{src/tokens/design-tokens/default/primitives/modes/typography/size/medium.json → medium-VSB2S4X3.json} +0 -0
- /package/dist/{src/tokens/design-tokens/default/primitives/modes/typography/size/small.json → small-AEXJ6U7Z.json} +0 -0
- /package/dist/{src/tokens/design-tokens/default/primitives/modes/size/small.json → small-ZY4KOJWX.json} +0 -0
- /package/dist/src/tokens/{build → process}/formats/js-tokens.d.ts +0 -0
- /package/dist/src/tokens/{build → process}/transformers.d.ts +0 -0
- /package/dist/{src/tokens/design-tokens/default/semantic/style.json → style-FP5XVCUD.json} +0 -0
- /package/dist/{src/tokens/design-tokens/template/themes/theme-base-file.json → theme.base.template-Y4RMFBQY.json} +0 -0
- /package/dist/{src/tokens/design-tokens/template/themes/theme-color-template.json → theme.template-CTQRNOMO.json} +0 -0
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
// src/tokens/create/generators/semantic.ts
|
|
2
|
+
import * as R from "ramda";
|
|
3
|
+
|
|
4
|
+
// src/tokens/template/design-tokens/semantic/color.base.template.json with { type: 'json' }
|
|
5
|
+
var color_base_template_default = {
|
|
6
|
+
color: {
|
|
7
|
+
success: {
|
|
8
|
+
"background-default": {
|
|
9
|
+
$type: "color",
|
|
10
|
+
$value: "{global.green.1}"
|
|
11
|
+
},
|
|
12
|
+
"background-tinted": {
|
|
13
|
+
$type: "color",
|
|
14
|
+
$value: "{global.green.2}"
|
|
15
|
+
},
|
|
16
|
+
"surface-default": {
|
|
17
|
+
$type: "color",
|
|
18
|
+
$value: "{global.green.3}"
|
|
19
|
+
},
|
|
20
|
+
"surface-tinted": {
|
|
21
|
+
$type: "color",
|
|
22
|
+
$value: "{global.green.4}"
|
|
23
|
+
},
|
|
24
|
+
"surface-hover": {
|
|
25
|
+
$type: "color",
|
|
26
|
+
$value: "{global.green.5}"
|
|
27
|
+
},
|
|
28
|
+
"surface-active": {
|
|
29
|
+
$type: "color",
|
|
30
|
+
$value: "{global.green.6}"
|
|
31
|
+
},
|
|
32
|
+
"border-subtle": {
|
|
33
|
+
$type: "color",
|
|
34
|
+
$value: "{global.green.7}"
|
|
35
|
+
},
|
|
36
|
+
"border-default": {
|
|
37
|
+
$type: "color",
|
|
38
|
+
$value: "{global.green.8}"
|
|
39
|
+
},
|
|
40
|
+
"border-strong": {
|
|
41
|
+
$type: "color",
|
|
42
|
+
$value: "{global.green.9}"
|
|
43
|
+
},
|
|
44
|
+
"text-subtle": {
|
|
45
|
+
$type: "color",
|
|
46
|
+
$value: "{global.green.10}"
|
|
47
|
+
},
|
|
48
|
+
"text-default": {
|
|
49
|
+
$type: "color",
|
|
50
|
+
$value: "{global.green.11}"
|
|
51
|
+
},
|
|
52
|
+
"base-default": {
|
|
53
|
+
$type: "color",
|
|
54
|
+
$value: "{global.green.12}"
|
|
55
|
+
},
|
|
56
|
+
"base-hover": {
|
|
57
|
+
$type: "color",
|
|
58
|
+
$value: "{global.green.13}"
|
|
59
|
+
},
|
|
60
|
+
"base-active": {
|
|
61
|
+
$type: "color",
|
|
62
|
+
$value: "{global.green.14}"
|
|
63
|
+
},
|
|
64
|
+
"base-contrast-subtle": {
|
|
65
|
+
$type: "color",
|
|
66
|
+
$value: "{global.green.15}"
|
|
67
|
+
},
|
|
68
|
+
"base-contrast-default": {
|
|
69
|
+
$type: "color",
|
|
70
|
+
$value: "{global.green.16}"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
danger: {
|
|
74
|
+
"background-default": {
|
|
75
|
+
$type: "color",
|
|
76
|
+
$value: "{global.red.1}"
|
|
77
|
+
},
|
|
78
|
+
"background-tinted": {
|
|
79
|
+
$type: "color",
|
|
80
|
+
$value: "{global.red.2}"
|
|
81
|
+
},
|
|
82
|
+
"surface-default": {
|
|
83
|
+
$type: "color",
|
|
84
|
+
$value: "{global.red.3}"
|
|
85
|
+
},
|
|
86
|
+
"surface-tinted": {
|
|
87
|
+
$type: "color",
|
|
88
|
+
$value: "{global.red.4}"
|
|
89
|
+
},
|
|
90
|
+
"surface-hover": {
|
|
91
|
+
$type: "color",
|
|
92
|
+
$value: "{global.red.5}"
|
|
93
|
+
},
|
|
94
|
+
"surface-active": {
|
|
95
|
+
$type: "color",
|
|
96
|
+
$value: "{global.red.6}"
|
|
97
|
+
},
|
|
98
|
+
"border-subtle": {
|
|
99
|
+
$type: "color",
|
|
100
|
+
$value: "{global.red.7}"
|
|
101
|
+
},
|
|
102
|
+
"border-default": {
|
|
103
|
+
$type: "color",
|
|
104
|
+
$value: "{global.red.8}"
|
|
105
|
+
},
|
|
106
|
+
"border-strong": {
|
|
107
|
+
$type: "color",
|
|
108
|
+
$value: "{global.red.9}"
|
|
109
|
+
},
|
|
110
|
+
"text-subtle": {
|
|
111
|
+
$type: "color",
|
|
112
|
+
$value: "{global.red.10}"
|
|
113
|
+
},
|
|
114
|
+
"text-default": {
|
|
115
|
+
$type: "color",
|
|
116
|
+
$value: "{global.red.11}"
|
|
117
|
+
},
|
|
118
|
+
"base-default": {
|
|
119
|
+
$type: "color",
|
|
120
|
+
$value: "{global.red.12}"
|
|
121
|
+
},
|
|
122
|
+
"base-hover": {
|
|
123
|
+
$type: "color",
|
|
124
|
+
$value: "{global.red.13}"
|
|
125
|
+
},
|
|
126
|
+
"base-active": {
|
|
127
|
+
$type: "color",
|
|
128
|
+
$value: "{global.red.14}"
|
|
129
|
+
},
|
|
130
|
+
"base-contrast-subtle": {
|
|
131
|
+
$type: "color",
|
|
132
|
+
$value: "{global.red.15}"
|
|
133
|
+
},
|
|
134
|
+
"base-contrast-default": {
|
|
135
|
+
$type: "color",
|
|
136
|
+
$value: "{global.red.16}"
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
info: {
|
|
140
|
+
"background-default": {
|
|
141
|
+
$type: "color",
|
|
142
|
+
$value: "{global.blue.1}"
|
|
143
|
+
},
|
|
144
|
+
"background-tinted": {
|
|
145
|
+
$type: "color",
|
|
146
|
+
$value: "{global.blue.2}"
|
|
147
|
+
},
|
|
148
|
+
"surface-default": {
|
|
149
|
+
$type: "color",
|
|
150
|
+
$value: "{global.blue.3}"
|
|
151
|
+
},
|
|
152
|
+
"surface-tinted": {
|
|
153
|
+
$type: "color",
|
|
154
|
+
$value: "{global.blue.4}"
|
|
155
|
+
},
|
|
156
|
+
"surface-hover": {
|
|
157
|
+
$type: "color",
|
|
158
|
+
$value: "{global.blue.5}"
|
|
159
|
+
},
|
|
160
|
+
"surface-active": {
|
|
161
|
+
$type: "color",
|
|
162
|
+
$value: "{global.blue.6}"
|
|
163
|
+
},
|
|
164
|
+
"border-subtle": {
|
|
165
|
+
$type: "color",
|
|
166
|
+
$value: "{global.blue.7}"
|
|
167
|
+
},
|
|
168
|
+
"border-default": {
|
|
169
|
+
$type: "color",
|
|
170
|
+
$value: "{global.blue.8}"
|
|
171
|
+
},
|
|
172
|
+
"border-strong": {
|
|
173
|
+
$type: "color",
|
|
174
|
+
$value: "{global.blue.9}"
|
|
175
|
+
},
|
|
176
|
+
"text-subtle": {
|
|
177
|
+
$type: "color",
|
|
178
|
+
$value: "{global.blue.10}"
|
|
179
|
+
},
|
|
180
|
+
"text-default": {
|
|
181
|
+
$type: "color",
|
|
182
|
+
$value: "{global.blue.11}"
|
|
183
|
+
},
|
|
184
|
+
"base-default": {
|
|
185
|
+
$type: "color",
|
|
186
|
+
$value: "{global.blue.12}"
|
|
187
|
+
},
|
|
188
|
+
"base-hover": {
|
|
189
|
+
$type: "color",
|
|
190
|
+
$value: "{global.blue.13}"
|
|
191
|
+
},
|
|
192
|
+
"base-active": {
|
|
193
|
+
$type: "color",
|
|
194
|
+
$value: "{global.blue.14}"
|
|
195
|
+
},
|
|
196
|
+
"base-contrast-subtle": {
|
|
197
|
+
$type: "color",
|
|
198
|
+
$value: "{global.blue.15}"
|
|
199
|
+
},
|
|
200
|
+
"base-contrast-default": {
|
|
201
|
+
$type: "color",
|
|
202
|
+
$value: "{global.blue.16}"
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
warning: {
|
|
206
|
+
"background-default": {
|
|
207
|
+
$type: "color",
|
|
208
|
+
$value: "{global.orange.1}"
|
|
209
|
+
},
|
|
210
|
+
"background-tinted": {
|
|
211
|
+
$type: "color",
|
|
212
|
+
$value: "{global.orange.2}"
|
|
213
|
+
},
|
|
214
|
+
"surface-default": {
|
|
215
|
+
$type: "color",
|
|
216
|
+
$value: "{global.orange.3}"
|
|
217
|
+
},
|
|
218
|
+
"surface-tinted": {
|
|
219
|
+
$type: "color",
|
|
220
|
+
$value: "{global.orange.4}"
|
|
221
|
+
},
|
|
222
|
+
"surface-hover": {
|
|
223
|
+
$type: "color",
|
|
224
|
+
$value: "{global.orange.5}"
|
|
225
|
+
},
|
|
226
|
+
"surface-active": {
|
|
227
|
+
$type: "color",
|
|
228
|
+
$value: "{global.orange.6}"
|
|
229
|
+
},
|
|
230
|
+
"border-subtle": {
|
|
231
|
+
$type: "color",
|
|
232
|
+
$value: "{global.orange.7}"
|
|
233
|
+
},
|
|
234
|
+
"border-default": {
|
|
235
|
+
$type: "color",
|
|
236
|
+
$value: "{global.orange.8}"
|
|
237
|
+
},
|
|
238
|
+
"border-strong": {
|
|
239
|
+
$type: "color",
|
|
240
|
+
$value: "{global.orange.9}"
|
|
241
|
+
},
|
|
242
|
+
"text-subtle": {
|
|
243
|
+
$type: "color",
|
|
244
|
+
$value: "{global.orange.10}"
|
|
245
|
+
},
|
|
246
|
+
"text-default": {
|
|
247
|
+
$type: "color",
|
|
248
|
+
$value: "{global.orange.11}"
|
|
249
|
+
},
|
|
250
|
+
"base-default": {
|
|
251
|
+
$type: "color",
|
|
252
|
+
$value: "{global.orange.12}"
|
|
253
|
+
},
|
|
254
|
+
"base-hover": {
|
|
255
|
+
$type: "color",
|
|
256
|
+
$value: "{global.orange.13}"
|
|
257
|
+
},
|
|
258
|
+
"base-active": {
|
|
259
|
+
$type: "color",
|
|
260
|
+
$value: "{global.orange.14}"
|
|
261
|
+
},
|
|
262
|
+
"base-contrast-subtle": {
|
|
263
|
+
$type: "color",
|
|
264
|
+
$value: "{global.orange.15}"
|
|
265
|
+
},
|
|
266
|
+
"base-contrast-default": {
|
|
267
|
+
$type: "color",
|
|
268
|
+
$value: "{global.orange.16}"
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
focus: {
|
|
272
|
+
inner: {
|
|
273
|
+
$type: "color",
|
|
274
|
+
$value: "{color.neutral.background-default}"
|
|
275
|
+
},
|
|
276
|
+
outer: {
|
|
277
|
+
$type: "color",
|
|
278
|
+
$value: "{color.neutral.text-default}"
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
link: {
|
|
283
|
+
color: {
|
|
284
|
+
visited: {
|
|
285
|
+
$type: "color",
|
|
286
|
+
$value: "{global.purple.12}"
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
// src/tokens/template/design-tokens/semantic/color.template.json with { type: 'json' }
|
|
293
|
+
var color_template_default = {
|
|
294
|
+
"background-default": {
|
|
295
|
+
$type: "color",
|
|
296
|
+
$value: "{color.<color>.1}"
|
|
297
|
+
},
|
|
298
|
+
"background-tinted": {
|
|
299
|
+
$type: "color",
|
|
300
|
+
$value: "{color.<color>.2}"
|
|
301
|
+
},
|
|
302
|
+
"surface-default": {
|
|
303
|
+
$type: "color",
|
|
304
|
+
$value: "{color.<color>.3}"
|
|
305
|
+
},
|
|
306
|
+
"surface-tinted": {
|
|
307
|
+
$type: "color",
|
|
308
|
+
$value: "{color.<color>.4}"
|
|
309
|
+
},
|
|
310
|
+
"surface-hover": {
|
|
311
|
+
$type: "color",
|
|
312
|
+
$value: "{color.<color>.5}"
|
|
313
|
+
},
|
|
314
|
+
"surface-active": {
|
|
315
|
+
$type: "color",
|
|
316
|
+
$value: "{color.<color>.6}"
|
|
317
|
+
},
|
|
318
|
+
"border-subtle": {
|
|
319
|
+
$type: "color",
|
|
320
|
+
$value: "{color.<color>.7}"
|
|
321
|
+
},
|
|
322
|
+
"border-default": {
|
|
323
|
+
$type: "color",
|
|
324
|
+
$value: "{color.<color>.8}"
|
|
325
|
+
},
|
|
326
|
+
"border-strong": {
|
|
327
|
+
$type: "color",
|
|
328
|
+
$value: "{color.<color>.9}"
|
|
329
|
+
},
|
|
330
|
+
"text-subtle": {
|
|
331
|
+
$type: "color",
|
|
332
|
+
$value: "{color.<color>.10}"
|
|
333
|
+
},
|
|
334
|
+
"text-default": {
|
|
335
|
+
$type: "color",
|
|
336
|
+
$value: "{color.<color>.11}"
|
|
337
|
+
},
|
|
338
|
+
"base-default": {
|
|
339
|
+
$type: "color",
|
|
340
|
+
$value: "{color.<color>.12}"
|
|
341
|
+
},
|
|
342
|
+
"base-hover": {
|
|
343
|
+
$type: "color",
|
|
344
|
+
$value: "{color.<color>.13}"
|
|
345
|
+
},
|
|
346
|
+
"base-active": {
|
|
347
|
+
$type: "color",
|
|
348
|
+
$value: "{color.<color>.14}"
|
|
349
|
+
},
|
|
350
|
+
"base-contrast-subtle": {
|
|
351
|
+
$type: "color",
|
|
352
|
+
$value: "{color.<color>.15}"
|
|
353
|
+
},
|
|
354
|
+
"base-contrast-default": {
|
|
355
|
+
$type: "color",
|
|
356
|
+
$value: "{color.<color>.16}"
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
// src/tokens/template/design-tokens/semantic/modes/color.template.json with { type: 'json' }
|
|
361
|
+
var color_template_default2 = {
|
|
362
|
+
"background-default": {
|
|
363
|
+
$type: "color",
|
|
364
|
+
$value: "{color.<color>.background-default}"
|
|
365
|
+
},
|
|
366
|
+
"background-tinted": {
|
|
367
|
+
$type: "color",
|
|
368
|
+
$value: "{color.<color>.background-tinted}"
|
|
369
|
+
},
|
|
370
|
+
"surface-default": {
|
|
371
|
+
$type: "color",
|
|
372
|
+
$value: "{color.<color>.surface-default}"
|
|
373
|
+
},
|
|
374
|
+
"surface-tinted": {
|
|
375
|
+
$type: "color",
|
|
376
|
+
$value: "{color.<color>.surface-tinted}"
|
|
377
|
+
},
|
|
378
|
+
"surface-hover": {
|
|
379
|
+
$type: "color",
|
|
380
|
+
$value: "{color.<color>.surface-hover}"
|
|
381
|
+
},
|
|
382
|
+
"surface-active": {
|
|
383
|
+
$type: "color",
|
|
384
|
+
$value: "{color.<color>.surface-active}"
|
|
385
|
+
},
|
|
386
|
+
"border-subtle": {
|
|
387
|
+
$type: "color",
|
|
388
|
+
$value: "{color.<color>.border-subtle}"
|
|
389
|
+
},
|
|
390
|
+
"border-default": {
|
|
391
|
+
$type: "color",
|
|
392
|
+
$value: "{color.<color>.border-default}"
|
|
393
|
+
},
|
|
394
|
+
"border-strong": {
|
|
395
|
+
$type: "color",
|
|
396
|
+
$value: "{color.<color>.border-strong}"
|
|
397
|
+
},
|
|
398
|
+
"text-subtle": {
|
|
399
|
+
$type: "color",
|
|
400
|
+
$value: "{color.<color>.text-subtle}"
|
|
401
|
+
},
|
|
402
|
+
"text-default": {
|
|
403
|
+
$type: "color",
|
|
404
|
+
$value: "{color.<color>.text-default}"
|
|
405
|
+
},
|
|
406
|
+
"base-default": {
|
|
407
|
+
$type: "color",
|
|
408
|
+
$value: "{color.<color>.base-default}"
|
|
409
|
+
},
|
|
410
|
+
"base-hover": {
|
|
411
|
+
$type: "color",
|
|
412
|
+
$value: "{color.<color>.base-hover}"
|
|
413
|
+
},
|
|
414
|
+
"base-active": {
|
|
415
|
+
$type: "color",
|
|
416
|
+
$value: "{color.<color>.base-active}"
|
|
417
|
+
},
|
|
418
|
+
"base-contrast-subtle": {
|
|
419
|
+
$type: "color",
|
|
420
|
+
$value: "{color.<color>.base-contrast-subtle}"
|
|
421
|
+
},
|
|
422
|
+
"base-contrast-default": {
|
|
423
|
+
$type: "color",
|
|
424
|
+
$value: "{color.<color>.base-contrast-default}"
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
// src/tokens/create/generators/semantic.ts
|
|
429
|
+
var generateSemantic = (colors) => {
|
|
430
|
+
const mainColorNames = Object.keys(colors.main);
|
|
431
|
+
const supportColorNames = Object.keys(colors.support);
|
|
432
|
+
const modes = {
|
|
433
|
+
"main-color": {},
|
|
434
|
+
"support-color": {}
|
|
435
|
+
};
|
|
436
|
+
const categories = [
|
|
437
|
+
["main-color", mainColorNames],
|
|
438
|
+
["support-color", supportColorNames]
|
|
439
|
+
];
|
|
440
|
+
for (const [colorCategory, colorNames] of categories) {
|
|
441
|
+
for (const colorName of colorNames) {
|
|
442
|
+
const category = colorCategory.replace("-color", "");
|
|
443
|
+
const customColorTokens = {
|
|
444
|
+
color: {
|
|
445
|
+
[category]: JSON.parse(
|
|
446
|
+
JSON.stringify(
|
|
447
|
+
color_template_default2,
|
|
448
|
+
(key, value) => {
|
|
449
|
+
if (key === "$value") {
|
|
450
|
+
return value.replace("<color>", colorName);
|
|
451
|
+
}
|
|
452
|
+
return value;
|
|
453
|
+
},
|
|
454
|
+
2
|
|
455
|
+
)
|
|
456
|
+
)
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
modes[colorCategory][colorName] = customColorTokens;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
const customColors = [...mainColorNames, "neutral", ...supportColorNames];
|
|
463
|
+
const semanticColorTokens = customColors.map(
|
|
464
|
+
(colorName) => [
|
|
465
|
+
colorName,
|
|
466
|
+
R.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), color_template_default)
|
|
467
|
+
]
|
|
468
|
+
);
|
|
469
|
+
const color = {
|
|
470
|
+
...color_base_template_default,
|
|
471
|
+
color: {
|
|
472
|
+
...Object.fromEntries(semanticColorTokens),
|
|
473
|
+
...color_base_template_default.color
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
return {
|
|
477
|
+
modes,
|
|
478
|
+
color
|
|
479
|
+
};
|
|
480
|
+
};
|
|
481
|
+
export {
|
|
482
|
+
generateSemantic
|
|
483
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/create/generators/theme.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEvD,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,EAAE,WAAW,MAAM,EAAE,cAAc,MAAM,aAyCpF,CAAC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// src/tokens/create/generators/theme.ts
|
|
2
|
+
import * as R from "ramda";
|
|
3
|
+
|
|
4
|
+
// src/tokens/template/design-tokens/themes/theme.base.template.json with { type: 'json' }
|
|
5
|
+
var theme_base_template_default = {
|
|
6
|
+
color: {},
|
|
7
|
+
"font-family": {
|
|
8
|
+
$type: "fontFamilies",
|
|
9
|
+
$value: "{<theme>.font-family}"
|
|
10
|
+
},
|
|
11
|
+
"font-weight": {
|
|
12
|
+
medium: {
|
|
13
|
+
$type: "fontWeights",
|
|
14
|
+
$value: "{<theme>.font-weight.medium}"
|
|
15
|
+
},
|
|
16
|
+
semibold: {
|
|
17
|
+
$type: "fontWeights",
|
|
18
|
+
$value: "{<theme>.font-weight.semibold}"
|
|
19
|
+
},
|
|
20
|
+
regular: {
|
|
21
|
+
$type: "fontWeights",
|
|
22
|
+
$value: "{<theme>.font-weight.regular}"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"border-radius": {
|
|
26
|
+
"1": {
|
|
27
|
+
$type: "dimension",
|
|
28
|
+
$value: "min({border-radius.base}*0.5,{border-radius.scale})"
|
|
29
|
+
},
|
|
30
|
+
"2": {
|
|
31
|
+
$type: "dimension",
|
|
32
|
+
$value: "min({border-radius.base},{border-radius.scale}*2)"
|
|
33
|
+
},
|
|
34
|
+
"3": {
|
|
35
|
+
$type: "dimension",
|
|
36
|
+
$value: "min({border-radius.base}*2,{border-radius.scale}*5)"
|
|
37
|
+
},
|
|
38
|
+
"4": {
|
|
39
|
+
$type: "dimension",
|
|
40
|
+
$value: "min({border-radius.base}*3,{border-radius.scale}*7)"
|
|
41
|
+
},
|
|
42
|
+
"5": {
|
|
43
|
+
$type: "dimension",
|
|
44
|
+
$value: "{border-radius.base}"
|
|
45
|
+
},
|
|
46
|
+
"6": {
|
|
47
|
+
$type: "dimension",
|
|
48
|
+
$value: "9999"
|
|
49
|
+
},
|
|
50
|
+
base: {
|
|
51
|
+
$type: "dimension",
|
|
52
|
+
$value: "4"
|
|
53
|
+
},
|
|
54
|
+
scale: {
|
|
55
|
+
$type: "dimension",
|
|
56
|
+
$value: "4"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// src/tokens/template/design-tokens/themes/theme.template.json with { type: 'json' }
|
|
62
|
+
var theme_template_default = {
|
|
63
|
+
"1": {
|
|
64
|
+
$type: "color",
|
|
65
|
+
$value: "{<theme>.<color>.1}"
|
|
66
|
+
},
|
|
67
|
+
"2": {
|
|
68
|
+
$type: "color",
|
|
69
|
+
$value: "{<theme>.<color>.2}"
|
|
70
|
+
},
|
|
71
|
+
"3": {
|
|
72
|
+
$type: "color",
|
|
73
|
+
$value: "{<theme>.<color>.3}"
|
|
74
|
+
},
|
|
75
|
+
"4": {
|
|
76
|
+
$type: "color",
|
|
77
|
+
$value: "{<theme>.<color>.4}"
|
|
78
|
+
},
|
|
79
|
+
"5": {
|
|
80
|
+
$type: "color",
|
|
81
|
+
$value: "{<theme>.<color>.5}"
|
|
82
|
+
},
|
|
83
|
+
"6": {
|
|
84
|
+
$type: "color",
|
|
85
|
+
$value: "{<theme>.<color>.6}"
|
|
86
|
+
},
|
|
87
|
+
"7": {
|
|
88
|
+
$type: "color",
|
|
89
|
+
$value: "{<theme>.<color>.7}"
|
|
90
|
+
},
|
|
91
|
+
"8": {
|
|
92
|
+
$type: "color",
|
|
93
|
+
$value: "{<theme>.<color>.8}"
|
|
94
|
+
},
|
|
95
|
+
"9": {
|
|
96
|
+
$type: "color",
|
|
97
|
+
$value: "{<theme>.<color>.9}"
|
|
98
|
+
},
|
|
99
|
+
"10": {
|
|
100
|
+
$type: "color",
|
|
101
|
+
$value: "{<theme>.<color>.10}"
|
|
102
|
+
},
|
|
103
|
+
"11": {
|
|
104
|
+
$type: "color",
|
|
105
|
+
$value: "{<theme>.<color>.11}"
|
|
106
|
+
},
|
|
107
|
+
"12": {
|
|
108
|
+
$type: "color",
|
|
109
|
+
$value: "{<theme>.<color>.12}"
|
|
110
|
+
},
|
|
111
|
+
"13": {
|
|
112
|
+
$type: "color",
|
|
113
|
+
$value: "{<theme>.<color>.13}"
|
|
114
|
+
},
|
|
115
|
+
"14": {
|
|
116
|
+
$type: "color",
|
|
117
|
+
$value: "{<theme>.<color>.14}"
|
|
118
|
+
},
|
|
119
|
+
"15": {
|
|
120
|
+
$type: "color",
|
|
121
|
+
$value: "{<theme>.<color>.15}"
|
|
122
|
+
},
|
|
123
|
+
"16": {
|
|
124
|
+
$type: "color",
|
|
125
|
+
$value: "{<theme>.<color>.16}"
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// src/tokens/create/generators/theme.ts
|
|
130
|
+
var generateTheme = (colors, themeName, borderRadius) => {
|
|
131
|
+
const mainColorNames = Object.keys(colors.main);
|
|
132
|
+
const supportColorNames = Object.keys(colors.support);
|
|
133
|
+
const customColors = [...mainColorNames, "neutral", ...supportColorNames];
|
|
134
|
+
const themeColorTokens = Object.fromEntries(
|
|
135
|
+
customColors.map(
|
|
136
|
+
(colorName) => [
|
|
137
|
+
colorName,
|
|
138
|
+
R.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), theme_template_default)
|
|
139
|
+
]
|
|
140
|
+
)
|
|
141
|
+
);
|
|
142
|
+
const { color: themeBaseFileColor, ...remainingThemeFile } = theme_base_template_default;
|
|
143
|
+
const themeFile = {
|
|
144
|
+
color: {
|
|
145
|
+
...themeColorTokens,
|
|
146
|
+
...themeBaseFileColor
|
|
147
|
+
},
|
|
148
|
+
...remainingThemeFile
|
|
149
|
+
};
|
|
150
|
+
const baseBorderRadius = R.lensPath(["border-radius", "base", "$value"]);
|
|
151
|
+
const updatedThemeFile = R.set(baseBorderRadius, String(borderRadius), themeFile);
|
|
152
|
+
const token = JSON.parse(
|
|
153
|
+
JSON.stringify(
|
|
154
|
+
updatedThemeFile,
|
|
155
|
+
(key, value) => {
|
|
156
|
+
if (key === "$value") {
|
|
157
|
+
return value.replace("<theme>", themeName);
|
|
158
|
+
}
|
|
159
|
+
return value;
|
|
160
|
+
},
|
|
161
|
+
2
|
|
162
|
+
)
|
|
163
|
+
);
|
|
164
|
+
return token;
|
|
165
|
+
};
|
|
166
|
+
export {
|
|
167
|
+
generateTheme
|
|
168
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../../../../src/tokens/create/generators/typography.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE3D,eAAO,MAAM,kBAAkB,GAAI,WAAW,MAAM,EAAE,gBAAgB,UAAU,KAAG,QAMlF,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/tokens/template/design-tokens/primitives/modes/typography/typography.template.json with { type: 'json' }
|
|
2
|
+
var typography_template_default = {
|
|
3
|
+
"<theme>": {
|
|
4
|
+
"font-family": {
|
|
5
|
+
$type: "fontFamilies",
|
|
6
|
+
$value: "<font-family>"
|
|
7
|
+
},
|
|
8
|
+
"font-weight": {
|
|
9
|
+
medium: {
|
|
10
|
+
$type: "fontWeights",
|
|
11
|
+
$value: "Medium"
|
|
12
|
+
},
|
|
13
|
+
semibold: {
|
|
14
|
+
$type: "fontWeights",
|
|
15
|
+
$value: "Semi bold"
|
|
16
|
+
},
|
|
17
|
+
regular: {
|
|
18
|
+
$type: "fontWeights",
|
|
19
|
+
$value: "Regular"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// src/tokens/create/generators/typography.ts
|
|
26
|
+
var generateTypography = (themeName, { fontFamily }) => {
|
|
27
|
+
return JSON.parse(
|
|
28
|
+
JSON.stringify(typography_template_default).replaceAll(/<font-family>/g, fontFamily).replaceAll(/<theme>/g, themeName)
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
generateTypography
|
|
33
|
+
};
|