@digdir/designsystemet 0.1.0-next.31 → 0.100.51-next.52

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.
Files changed (199) hide show
  1. package/README.md +16 -0
  2. package/dist/bin/config.d.ts +162 -0
  3. package/dist/bin/config.d.ts.map +1 -0
  4. package/dist/bin/config.js +56 -0
  5. package/dist/{types/bin → bin}/designsystemet.d.ts.map +1 -1
  6. package/dist/bin/designsystemet.js +159 -31
  7. package/dist/bin/options.d.ts +16 -0
  8. package/dist/bin/options.d.ts.map +1 -0
  9. package/dist/bin/options.js +12 -0
  10. package/dist/config.schema.json +81 -0
  11. package/dist/src/colors/colorMetadata.d.ts +53 -0
  12. package/dist/src/colors/colorMetadata.d.ts.map +1 -0
  13. package/dist/src/colors/colorMetadata.js +211 -0
  14. package/dist/{types/src → src}/colors/index.d.ts +1 -0
  15. package/dist/src/colors/index.d.ts.map +1 -0
  16. package/dist/src/colors/index.js +1 -0
  17. package/dist/src/colors/theme.d.ts +30 -0
  18. package/dist/src/colors/theme.d.ts.map +1 -0
  19. package/dist/src/colors/theme.js +52 -233
  20. package/dist/src/colors/types.d.ts +63 -0
  21. package/dist/src/colors/types.d.ts.map +1 -0
  22. package/dist/{types/src → src}/colors/utils.d.ts +39 -56
  23. package/dist/src/colors/utils.d.ts.map +1 -0
  24. package/dist/src/colors/utils.js +59 -187
  25. package/dist/src/index.d.ts +3 -0
  26. package/dist/src/index.d.ts.map +1 -0
  27. package/dist/src/index.js +2 -0
  28. package/dist/src/migrations/beta-to-v1.d.ts.map +1 -0
  29. package/dist/src/migrations/beta-to-v1.js +45 -45
  30. package/dist/src/migrations/codemods/css/plugins.d.ts.map +1 -0
  31. package/dist/src/migrations/codemods/css/plugins.js +7 -8
  32. package/dist/src/migrations/codemods/css/run.d.ts.map +1 -0
  33. package/dist/src/migrations/codemods/css/run.js +9 -1
  34. package/dist/src/migrations/codemods/jsx/classname-prefix.d.ts.map +1 -0
  35. package/dist/src/migrations/codemods/jsx/run.d.ts.map +1 -0
  36. package/dist/src/migrations/color-rename-next49.d.ts +3 -0
  37. package/dist/src/migrations/color-rename-next49.d.ts.map +1 -0
  38. package/dist/src/migrations/color-rename-next49.js +38 -0
  39. package/dist/{types/src → src}/migrations/index.d.ts +1 -0
  40. package/dist/src/migrations/index.d.ts.map +1 -0
  41. package/dist/src/migrations/index.js +3 -1
  42. package/dist/src/migrations/react-beta-to-v1.d.ts.map +1 -0
  43. package/dist/src/scripts/copy-internal-tokens.d.ts +2 -0
  44. package/dist/src/scripts/copy-internal-tokens.d.ts.map +1 -0
  45. package/dist/src/scripts/copy-internal-tokens.js +28 -0
  46. package/dist/src/scripts/createJsonSchema.d.ts +2 -0
  47. package/dist/src/scripts/createJsonSchema.d.ts.map +1 -0
  48. package/dist/src/scripts/createJsonSchema.js +15 -0
  49. package/dist/src/tokens/build/builtin-colors.css +87 -0
  50. package/dist/src/tokens/build/configs.d.ts +21 -0
  51. package/dist/src/tokens/build/configs.d.ts.map +1 -0
  52. package/dist/src/tokens/build/configs.js +136 -95
  53. package/dist/src/tokens/build/formats/css.d.ts +53 -0
  54. package/dist/src/tokens/build/formats/css.d.ts.map +1 -0
  55. package/dist/src/tokens/build/formats/css.js +140 -111
  56. package/dist/src/tokens/build/formats/js-tokens.d.ts.map +1 -0
  57. package/dist/src/tokens/build/formats/js-tokens.js +22 -9
  58. package/dist/src/tokens/build/transformers.d.ts +6 -0
  59. package/dist/src/tokens/build/transformers.d.ts.map +1 -0
  60. package/dist/src/tokens/build/transformers.js +27 -18
  61. package/dist/src/tokens/build/types.d.ts +45 -0
  62. package/dist/src/tokens/build/types.d.ts.map +1 -0
  63. package/dist/src/tokens/build/types.js +7 -0
  64. package/dist/{types/src → src}/tokens/build/utils/entryfile.d.ts +1 -0
  65. package/dist/src/tokens/build/utils/entryfile.d.ts.map +1 -0
  66. package/dist/src/tokens/build/utils/entryfile.js +42 -6
  67. package/dist/src/tokens/build/utils/getMultidimensionalThemes.d.ts +35 -0
  68. package/dist/src/tokens/build/utils/getMultidimensionalThemes.d.ts.map +1 -0
  69. package/dist/src/tokens/build/utils/getMultidimensionalThemes.js +112 -0
  70. package/dist/src/tokens/build.d.ts +20 -0
  71. package/dist/src/tokens/build.d.ts.map +1 -0
  72. package/dist/src/tokens/build.js +131 -0
  73. package/dist/src/tokens/create.d.ts +18 -0
  74. package/dist/src/tokens/create.d.ts.map +1 -0
  75. package/dist/src/tokens/create.js +99 -0
  76. package/dist/src/{init/template/default-files/design-tokens → tokens/design-tokens/default}/primitives/globals.json +2 -20
  77. package/dist/src/tokens/design-tokens/default/primitives/modes/size/global.json +96 -0
  78. package/dist/src/tokens/design-tokens/default/primitives/modes/size/large.json +16 -0
  79. package/dist/src/tokens/design-tokens/default/primitives/modes/size/medium.json +16 -0
  80. package/dist/src/tokens/design-tokens/default/primitives/modes/size/small.json +16 -0
  81. package/dist/src/tokens/design-tokens/default/primitives/modes/typography/size/large.json +96 -0
  82. package/dist/src/{init/template/default-files/design-tokens/primitives/size/default.json → tokens/design-tokens/default/primitives/modes/typography/size/medium.json} +9 -88
  83. package/dist/src/tokens/design-tokens/default/primitives/modes/typography/size/small.json +96 -0
  84. package/dist/src/{init/template/default-files/design-tokens → tokens/design-tokens/default}/semantic/style.json +126 -312
  85. package/dist/src/tokens/design-tokens/template/$metadata.json +25 -0
  86. package/dist/src/tokens/design-tokens/template/$themes.json +1498 -0
  87. package/dist/src/tokens/design-tokens/template/semantic/color-base-file.json +278 -0
  88. package/dist/src/tokens/design-tokens/template/semantic/modes/category-color/category-color-template.json +66 -0
  89. package/dist/src/tokens/design-tokens/template/semantic/semantic-color-template.json +66 -0
  90. package/dist/src/tokens/design-tokens/template/themes/theme-base-file.json +57 -0
  91. package/dist/src/tokens/design-tokens/template/themes/theme-color-template.json +66 -0
  92. package/dist/src/tokens/index.d.ts +3 -0
  93. package/dist/src/tokens/index.d.ts.map +1 -0
  94. package/dist/src/tokens/index.js +2 -1
  95. package/dist/src/tokens/template.d.ts +2 -0
  96. package/dist/src/tokens/template.d.ts.map +1 -0
  97. package/dist/src/tokens/template.js +98 -0
  98. package/dist/src/tokens/types.d.ts +46 -0
  99. package/dist/src/tokens/types.d.ts.map +1 -0
  100. package/dist/src/tokens/types.js +0 -0
  101. package/dist/src/tokens/utils.d.ts +34 -0
  102. package/dist/src/tokens/utils.d.ts.map +1 -0
  103. package/dist/src/tokens/utils.js +85 -0
  104. package/dist/src/tokens/write/generate$metadata.d.ts +9 -0
  105. package/dist/src/tokens/write/generate$metadata.d.ts.map +1 -0
  106. package/dist/src/tokens/write/generate$metadata.js +28 -0
  107. package/dist/src/tokens/write/generate$themes.d.ts +12 -0
  108. package/dist/src/tokens/write/generate$themes.d.ts.map +1 -0
  109. package/dist/src/tokens/write/generate$themes.js +161 -0
  110. package/dist/src/tokens/write.d.ts +12 -0
  111. package/dist/src/tokens/write.d.ts.map +1 -0
  112. package/dist/src/tokens/write.js +176 -0
  113. package/package.json +43 -31
  114. package/dist/src/init/createTokensPackage.js +0 -273
  115. package/dist/src/init/generateMetadataJson.js +0 -24
  116. package/dist/src/init/generateThemesJson.js +0 -103
  117. package/dist/src/init/index.js +0 -10
  118. package/dist/src/init/nextStepsMarkdown.js +0 -92
  119. package/dist/src/init/template/default-files/README.md +0 -10
  120. package/dist/src/init/template/default-files/design-tokens/Figma/components.json +0 -22
  121. package/dist/src/init/template/default-files/design-tokens/README.md +0 -3
  122. package/dist/src/init/template/default-files/design-tokens/semantic/color.json +0 -572
  123. package/dist/src/init/template/default-files/design-tokens/themes/theme.json +0 -334
  124. package/dist/src/init/template/prettier.config.js +0 -5
  125. package/dist/src/init/template/template-files/design-tokens/primitives/modes/colors/contrast/global.json +0 -376
  126. package/dist/src/init/template/template-files/design-tokens/primitives/modes/colors/contrast/theme-template.json +0 -314
  127. package/dist/src/init/template/template-files/design-tokens/primitives/modes/colors/dark/global.json +0 -376
  128. package/dist/src/init/template/template-files/design-tokens/primitives/modes/colors/dark/theme-template.json +0 -314
  129. package/dist/src/init/template/template-files/design-tokens/primitives/modes/colors/light/global.json +0 -376
  130. package/dist/src/init/template/template-files/design-tokens/primitives/modes/colors/light/theme-template.json +0 -314
  131. package/dist/src/init/template/template-files/design-tokens/primitives/modes/typography/primary/theme-template.json +0 -30
  132. package/dist/src/init/template/template-files/design-tokens/primitives/modes/typography/secondary/theme-template.json +0 -30
  133. package/dist/src/init/template/template-files/design-tokens/themes/theme-template.json +0 -334
  134. package/dist/src/init/template/template-files/package.json +0 -24
  135. package/dist/src/init/utils.js +0 -15
  136. package/dist/src/tokens/build/actions.js +0 -33
  137. package/dist/src/tokens/build/index.js +0 -85
  138. package/dist/src/tokens/build/utils/noCase.js +0 -24
  139. package/dist/src/tokens/build/utils/permutateThemes.js +0 -64
  140. package/dist/src/tokens/build/utils/utils.js +0 -25
  141. package/dist/src/tokens/create/README.md +0 -3
  142. package/dist/src/tokens/create/index.js +0 -150
  143. package/dist/types/src/colors/index.d.ts.map +0 -1
  144. package/dist/types/src/colors/theme.d.ts +0 -85
  145. package/dist/types/src/colors/theme.d.ts.map +0 -1
  146. package/dist/types/src/colors/types.d.ts +0 -17
  147. package/dist/types/src/colors/types.d.ts.map +0 -1
  148. package/dist/types/src/colors/utils.d.ts.map +0 -1
  149. package/dist/types/src/init/createTokensPackage.d.ts +0 -5
  150. package/dist/types/src/init/createTokensPackage.d.ts.map +0 -1
  151. package/dist/types/src/init/generateMetadataJson.d.ts +0 -6
  152. package/dist/types/src/init/generateMetadataJson.d.ts.map +0 -1
  153. package/dist/types/src/init/generateThemesJson.d.ts +0 -3
  154. package/dist/types/src/init/generateThemesJson.d.ts.map +0 -1
  155. package/dist/types/src/init/index.d.ts +0 -3
  156. package/dist/types/src/init/index.d.ts.map +0 -1
  157. package/dist/types/src/init/nextStepsMarkdown.d.ts +0 -3
  158. package/dist/types/src/init/nextStepsMarkdown.d.ts.map +0 -1
  159. package/dist/types/src/init/template/prettier.config.d.mts +0 -9
  160. package/dist/types/src/init/template/prettier.config.d.mts.map +0 -1
  161. package/dist/types/src/init/utils.d.ts +0 -4
  162. package/dist/types/src/init/utils.d.ts.map +0 -1
  163. package/dist/types/src/migrations/beta-to-v1.d.ts.map +0 -1
  164. package/dist/types/src/migrations/codemods/css/plugins.d.ts.map +0 -1
  165. package/dist/types/src/migrations/codemods/css/run.d.ts.map +0 -1
  166. package/dist/types/src/migrations/codemods/jsx/classname-prefix.d.ts.map +0 -1
  167. package/dist/types/src/migrations/codemods/jsx/run.d.ts.map +0 -1
  168. package/dist/types/src/migrations/index.d.ts.map +0 -1
  169. package/dist/types/src/migrations/react-beta-to-v1.d.ts.map +0 -1
  170. package/dist/types/src/tokens/build/actions.d.ts +0 -6
  171. package/dist/types/src/tokens/build/actions.d.ts.map +0 -1
  172. package/dist/types/src/tokens/build/configs.d.ts +0 -31
  173. package/dist/types/src/tokens/build/configs.d.ts.map +0 -1
  174. package/dist/types/src/tokens/build/formats/css.d.ts +0 -5
  175. package/dist/types/src/tokens/build/formats/css.d.ts.map +0 -1
  176. package/dist/types/src/tokens/build/formats/js-tokens.d.ts.map +0 -1
  177. package/dist/types/src/tokens/build/index.d.ts +0 -11
  178. package/dist/types/src/tokens/build/index.d.ts.map +0 -1
  179. package/dist/types/src/tokens/build/transformers.d.ts +0 -5
  180. package/dist/types/src/tokens/build/transformers.d.ts.map +0 -1
  181. package/dist/types/src/tokens/build/utils/entryfile.d.ts.map +0 -1
  182. package/dist/types/src/tokens/build/utils/noCase.d.ts +0 -11
  183. package/dist/types/src/tokens/build/utils/noCase.d.ts.map +0 -1
  184. package/dist/types/src/tokens/build/utils/permutateThemes.d.ts +0 -17
  185. package/dist/types/src/tokens/build/utils/permutateThemes.d.ts.map +0 -1
  186. package/dist/types/src/tokens/build/utils/utils.d.ts +0 -25
  187. package/dist/types/src/tokens/build/utils/utils.d.ts.map +0 -1
  188. package/dist/types/src/tokens/create/index.d.ts +0 -64
  189. package/dist/types/src/tokens/create/index.d.ts.map +0 -1
  190. package/dist/types/src/tokens/index.d.ts +0 -2
  191. package/dist/types/src/tokens/index.d.ts.map +0 -1
  192. /package/dist/{types/bin → bin}/designsystemet.d.ts +0 -0
  193. /package/dist/{types/src → src}/migrations/beta-to-v1.d.ts +0 -0
  194. /package/dist/{types/src → src}/migrations/codemods/css/plugins.d.ts +0 -0
  195. /package/dist/{types/src → src}/migrations/codemods/css/run.d.ts +0 -0
  196. /package/dist/{types/src → src}/migrations/codemods/jsx/classname-prefix.d.ts +0 -0
  197. /package/dist/{types/src → src}/migrations/codemods/jsx/run.d.ts +0 -0
  198. /package/dist/{types/src → src}/migrations/react-beta-to-v1.d.ts +0 -0
  199. /package/dist/{types/src → src}/tokens/build/formats/js-tokens.d.ts +0 -0
@@ -0,0 +1,278 @@
1
+ {
2
+ "color": {
3
+ "success": {
4
+ "background-default": {
5
+ "$type": "color",
6
+ "$value": "{global.green.1}"
7
+ },
8
+ "background-tinted": {
9
+ "$type": "color",
10
+ "$value": "{global.green.2}"
11
+ },
12
+ "surface-default": {
13
+ "$type": "color",
14
+ "$value": "{global.green.3}"
15
+ },
16
+ "surface-tinted": {
17
+ "$type": "color",
18
+ "$value": "{global.green.4}"
19
+ },
20
+ "surface-hover": {
21
+ "$type": "color",
22
+ "$value": "{global.green.5}"
23
+ },
24
+ "surface-active": {
25
+ "$type": "color",
26
+ "$value": "{global.green.6}"
27
+ },
28
+ "border-subtle": {
29
+ "$type": "color",
30
+ "$value": "{global.green.7}"
31
+ },
32
+ "border-default": {
33
+ "$type": "color",
34
+ "$value": "{global.green.8}"
35
+ },
36
+ "border-strong": {
37
+ "$type": "color",
38
+ "$value": "{global.green.9}"
39
+ },
40
+ "text-subtle": {
41
+ "$type": "color",
42
+ "$value": "{global.green.10}"
43
+ },
44
+ "text-default": {
45
+ "$type": "color",
46
+ "$value": "{global.green.11}"
47
+ },
48
+ "base-default": {
49
+ "$type": "color",
50
+ "$value": "{global.green.12}"
51
+ },
52
+ "base-hover": {
53
+ "$type": "color",
54
+ "$value": "{global.green.13}"
55
+ },
56
+ "base-active": {
57
+ "$type": "color",
58
+ "$value": "{global.green.14}"
59
+ },
60
+ "base-contrast-subtle": {
61
+ "$type": "color",
62
+ "$value": "{global.green.15}"
63
+ },
64
+ "base-contrast-default": {
65
+ "$type": "color",
66
+ "$value": "{global.green.16}"
67
+ }
68
+ },
69
+ "danger": {
70
+ "background-default": {
71
+ "$type": "color",
72
+ "$value": "{global.red.1}"
73
+ },
74
+ "background-tinted": {
75
+ "$type": "color",
76
+ "$value": "{global.red.2}"
77
+ },
78
+ "surface-default": {
79
+ "$type": "color",
80
+ "$value": "{global.red.3}"
81
+ },
82
+ "surface-tinted": {
83
+ "$type": "color",
84
+ "$value": "{global.red.4}"
85
+ },
86
+ "surface-hover": {
87
+ "$type": "color",
88
+ "$value": "{global.red.5}"
89
+ },
90
+ "surface-active": {
91
+ "$type": "color",
92
+ "$value": "{global.red.6}"
93
+ },
94
+ "border-subtle": {
95
+ "$type": "color",
96
+ "$value": "{global.red.7}"
97
+ },
98
+ "border-default": {
99
+ "$type": "color",
100
+ "$value": "{global.red.8}"
101
+ },
102
+ "border-strong": {
103
+ "$type": "color",
104
+ "$value": "{global.red.9}"
105
+ },
106
+ "text-subtle": {
107
+ "$type": "color",
108
+ "$value": "{global.red.10}"
109
+ },
110
+ "text-default": {
111
+ "$type": "color",
112
+ "$value": "{global.red.11}"
113
+ },
114
+ "base-default": {
115
+ "$type": "color",
116
+ "$value": "{global.red.12}"
117
+ },
118
+ "base-hover": {
119
+ "$type": "color",
120
+ "$value": "{global.red.13}"
121
+ },
122
+ "base-active": {
123
+ "$type": "color",
124
+ "$value": "{global.red.14}"
125
+ },
126
+ "base-contrast-subtle": {
127
+ "$type": "color",
128
+ "$value": "{global.red.15}"
129
+ },
130
+ "base-contrast-default": {
131
+ "$type": "color",
132
+ "$value": "{global.red.16}"
133
+ }
134
+ },
135
+ "info": {
136
+ "background-default": {
137
+ "$type": "color",
138
+ "$value": "{global.blue.1}"
139
+ },
140
+ "background-tinted": {
141
+ "$type": "color",
142
+ "$value": "{global.blue.2}"
143
+ },
144
+ "surface-default": {
145
+ "$type": "color",
146
+ "$value": "{global.blue.3}"
147
+ },
148
+ "surface-tinted": {
149
+ "$type": "color",
150
+ "$value": "{global.blue.4}"
151
+ },
152
+ "surface-hover": {
153
+ "$type": "color",
154
+ "$value": "{global.blue.5}"
155
+ },
156
+ "surface-active": {
157
+ "$type": "color",
158
+ "$value": "{global.blue.6}"
159
+ },
160
+ "border-subtle": {
161
+ "$type": "color",
162
+ "$value": "{global.blue.7}"
163
+ },
164
+ "border-default": {
165
+ "$type": "color",
166
+ "$value": "{global.blue.8}"
167
+ },
168
+ "border-strong": {
169
+ "$type": "color",
170
+ "$value": "{global.blue.9}"
171
+ },
172
+ "text-subtle": {
173
+ "$type": "color",
174
+ "$value": "{global.blue.10}"
175
+ },
176
+ "text-default": {
177
+ "$type": "color",
178
+ "$value": "{global.blue.11}"
179
+ },
180
+ "base-default": {
181
+ "$type": "color",
182
+ "$value": "{global.blue.12}"
183
+ },
184
+ "base-hover": {
185
+ "$type": "color",
186
+ "$value": "{global.blue.13}"
187
+ },
188
+ "base-active": {
189
+ "$type": "color",
190
+ "$value": "{global.blue.14}"
191
+ },
192
+ "base-contrast-subtle": {
193
+ "$type": "color",
194
+ "$value": "{global.blue.15}"
195
+ },
196
+ "base-contrast-default": {
197
+ "$type": "color",
198
+ "$value": "{global.blue.16}"
199
+ }
200
+ },
201
+ "warning": {
202
+ "background-default": {
203
+ "$type": "color",
204
+ "$value": "{global.orange.1}"
205
+ },
206
+ "background-tinted": {
207
+ "$type": "color",
208
+ "$value": "{global.orange.2}"
209
+ },
210
+ "surface-default": {
211
+ "$type": "color",
212
+ "$value": "{global.orange.3}"
213
+ },
214
+ "surface-tinted": {
215
+ "$type": "color",
216
+ "$value": "{global.orange.4}"
217
+ },
218
+ "surface-hover": {
219
+ "$type": "color",
220
+ "$value": "{global.orange.5}"
221
+ },
222
+ "surface-active": {
223
+ "$type": "color",
224
+ "$value": "{global.orange.6}"
225
+ },
226
+ "border-subtle": {
227
+ "$type": "color",
228
+ "$value": "{global.orange.7}"
229
+ },
230
+ "border-default": {
231
+ "$type": "color",
232
+ "$value": "{global.orange.8}"
233
+ },
234
+ "border-strong": {
235
+ "$type": "color",
236
+ "$value": "{global.orange.9}"
237
+ },
238
+ "text-subtle": {
239
+ "$type": "color",
240
+ "$value": "{global.orange.10}"
241
+ },
242
+ "text-default": {
243
+ "$type": "color",
244
+ "$value": "{global.orange.11}"
245
+ },
246
+ "base-default": {
247
+ "$type": "color",
248
+ "$value": "{global.orange.12}"
249
+ },
250
+ "base-hover": {
251
+ "$type": "color",
252
+ "$value": "{global.orange.13}"
253
+ },
254
+ "base-active": {
255
+ "$type": "color",
256
+ "$value": "{global.orange.14}"
257
+ },
258
+ "base-contrast-subtle": {
259
+ "$type": "color",
260
+ "$value": "{global.orange.15}"
261
+ },
262
+ "base-contrast-default": {
263
+ "$type": "color",
264
+ "$value": "{global.orange.16}"
265
+ }
266
+ },
267
+ "focus": {
268
+ "inner": {
269
+ "$type": "color",
270
+ "$value": "{color.neutral.background-default}"
271
+ },
272
+ "outer": {
273
+ "$type": "color",
274
+ "$value": "{color.neutral.text-default}"
275
+ }
276
+ }
277
+ }
278
+ }
@@ -0,0 +1,66 @@
1
+ {
2
+ "background-default": {
3
+ "$type": "color",
4
+ "$value": "{color.<color>.background-default}"
5
+ },
6
+ "background-tinted": {
7
+ "$type": "color",
8
+ "$value": "{color.<color>.background-tinted}"
9
+ },
10
+ "surface-default": {
11
+ "$type": "color",
12
+ "$value": "{color.<color>.surface-default}"
13
+ },
14
+ "surface-tinted": {
15
+ "$type": "color",
16
+ "$value": "{color.<color>.surface-tinted}"
17
+ },
18
+ "surface-hover": {
19
+ "$type": "color",
20
+ "$value": "{color.<color>.surface-hover}"
21
+ },
22
+ "surface-active": {
23
+ "$type": "color",
24
+ "$value": "{color.<color>.surface-active}"
25
+ },
26
+ "border-subtle": {
27
+ "$type": "color",
28
+ "$value": "{color.<color>.border-subtle}"
29
+ },
30
+ "border-default": {
31
+ "$type": "color",
32
+ "$value": "{color.<color>.border-default}"
33
+ },
34
+ "border-strong": {
35
+ "$type": "color",
36
+ "$value": "{color.<color>.border-strong}"
37
+ },
38
+ "text-subtle": {
39
+ "$type": "color",
40
+ "$value": "{color.<color>.text-subtle}"
41
+ },
42
+ "text-default": {
43
+ "$type": "color",
44
+ "$value": "{color.<color>.text-default}"
45
+ },
46
+ "base-default": {
47
+ "$type": "color",
48
+ "$value": "{color.<color>.base-default}"
49
+ },
50
+ "base-hover": {
51
+ "$type": "color",
52
+ "$value": "{color.<color>.base-hover}"
53
+ },
54
+ "base-active": {
55
+ "$type": "color",
56
+ "$value": "{color.<color>.base-active}"
57
+ },
58
+ "base-contrast-subtle": {
59
+ "$type": "color",
60
+ "$value": "{color.<color>.base-contrast-subtle}"
61
+ },
62
+ "base-contrast-default": {
63
+ "$type": "color",
64
+ "$value": "{color.<color>.base-contrast-default}"
65
+ }
66
+ }
@@ -0,0 +1,66 @@
1
+ {
2
+ "background-default": {
3
+ "$type": "color",
4
+ "$value": "{color.<color>.1}"
5
+ },
6
+ "background-tinted": {
7
+ "$type": "color",
8
+ "$value": "{color.<color>.2}"
9
+ },
10
+ "surface-default": {
11
+ "$type": "color",
12
+ "$value": "{color.<color>.3}"
13
+ },
14
+ "surface-tinted": {
15
+ "$type": "color",
16
+ "$value": "{color.<color>.4}"
17
+ },
18
+ "surface-hover": {
19
+ "$type": "color",
20
+ "$value": "{color.<color>.5}"
21
+ },
22
+ "surface-active": {
23
+ "$type": "color",
24
+ "$value": "{color.<color>.6}"
25
+ },
26
+ "border-subtle": {
27
+ "$type": "color",
28
+ "$value": "{color.<color>.7}"
29
+ },
30
+ "border-default": {
31
+ "$type": "color",
32
+ "$value": "{color.<color>.8}"
33
+ },
34
+ "border-strong": {
35
+ "$type": "color",
36
+ "$value": "{color.<color>.9}"
37
+ },
38
+ "text-subtle": {
39
+ "$type": "color",
40
+ "$value": "{color.<color>.10}"
41
+ },
42
+ "text-default": {
43
+ "$type": "color",
44
+ "$value": "{color.<color>.11}"
45
+ },
46
+ "base-default": {
47
+ "$type": "color",
48
+ "$value": "{color.<color>.12}"
49
+ },
50
+ "base-hover": {
51
+ "$type": "color",
52
+ "$value": "{color.<color>.13}"
53
+ },
54
+ "base-active": {
55
+ "$type": "color",
56
+ "$value": "{color.<color>.14}"
57
+ },
58
+ "base-contrast-subtle": {
59
+ "$type": "color",
60
+ "$value": "{color.<color>.15}"
61
+ },
62
+ "base-contrast-default": {
63
+ "$type": "color",
64
+ "$value": "{color.<color>.16}"
65
+ }
66
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "color": {},
3
+ "font": {
4
+ "family": {
5
+ "$type": "fontFamilies",
6
+ "$value": "{<theme>.main}"
7
+ }
8
+ },
9
+ "font-weight": {
10
+ "medium": {
11
+ "$type": "fontWeights",
12
+ "$value": "{<theme>.bold}"
13
+ },
14
+ "semibold": {
15
+ "$type": "fontWeights",
16
+ "$value": "{<theme>.extra-bold}"
17
+ },
18
+ "regular": {
19
+ "$type": "fontWeights",
20
+ "$value": "{<theme>.regular}"
21
+ }
22
+ },
23
+ "border-radius": {
24
+ "1": {
25
+ "$type": "dimension",
26
+ "$value": "min({border-radius.base}*0.5,{border-radius.scale})"
27
+ },
28
+ "2": {
29
+ "$type": "dimension",
30
+ "$value": "min({border-radius.base},{border-radius.scale}*2)"
31
+ },
32
+ "3": {
33
+ "$type": "dimension",
34
+ "$value": "min({border-radius.base}*2,{border-radius.scale}*5)"
35
+ },
36
+ "4": {
37
+ "$type": "dimension",
38
+ "$value": "min({border-radius.base}*3,{border-radius.scale}*7)"
39
+ },
40
+ "5": {
41
+ "$type": "dimension",
42
+ "$value": "{border-radius.base}"
43
+ },
44
+ "6": {
45
+ "$type": "dimension",
46
+ "$value": "9999"
47
+ },
48
+ "base": {
49
+ "$type": "dimension",
50
+ "$value": "4"
51
+ },
52
+ "scale": {
53
+ "$type": "dimension",
54
+ "$value": "4"
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,66 @@
1
+ {
2
+ "1": {
3
+ "$type": "color",
4
+ "$value": "{<theme>.<color>.1}"
5
+ },
6
+ "2": {
7
+ "$type": "color",
8
+ "$value": "{<theme>.<color>.2}"
9
+ },
10
+ "3": {
11
+ "$type": "color",
12
+ "$value": "{<theme>.<color>.3}"
13
+ },
14
+ "4": {
15
+ "$type": "color",
16
+ "$value": "{<theme>.<color>.4}"
17
+ },
18
+ "5": {
19
+ "$type": "color",
20
+ "$value": "{<theme>.<color>.5}"
21
+ },
22
+ "6": {
23
+ "$type": "color",
24
+ "$value": "{<theme>.<color>.6}"
25
+ },
26
+ "7": {
27
+ "$type": "color",
28
+ "$value": "{<theme>.<color>.7}"
29
+ },
30
+ "8": {
31
+ "$type": "color",
32
+ "$value": "{<theme>.<color>.8}"
33
+ },
34
+ "9": {
35
+ "$type": "color",
36
+ "$value": "{<theme>.<color>.9}"
37
+ },
38
+ "10": {
39
+ "$type": "color",
40
+ "$value": "{<theme>.<color>.10}"
41
+ },
42
+ "11": {
43
+ "$type": "color",
44
+ "$value": "{<theme>.<color>.11}"
45
+ },
46
+ "12": {
47
+ "$type": "color",
48
+ "$value": "{<theme>.<color>.12}"
49
+ },
50
+ "13": {
51
+ "$type": "color",
52
+ "$value": "{<theme>.<color>.13}"
53
+ },
54
+ "14": {
55
+ "$type": "color",
56
+ "$value": "{<theme>.<color>.14}"
57
+ },
58
+ "15": {
59
+ "$type": "color",
60
+ "$value": "{<theme>.<color>.15}"
61
+ },
62
+ "16": {
63
+ "$type": "color",
64
+ "$value": "{<theme>.<color>.16}"
65
+ }
66
+ }
@@ -0,0 +1,3 @@
1
+ export { createTokens, cliOptions } from './create.js';
2
+ export type { Theme as CreateTokensOptions } from './types.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tokens/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,YAAY,EAAE,KAAK,IAAI,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
@@ -1,4 +1,5 @@
1
- import { createTokens } from "./create/index.js";
1
+ import { createTokens, cliOptions } from "./create.js";
2
2
  export {
3
+ cliOptions,
3
4
  createTokens
4
5
  };
@@ -0,0 +1,2 @@
1
+ export declare const updateTemplates: () => Promise<void>;
2
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../src/tokens/template.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,eAAe,qBAwG3B,CAAC"}
@@ -0,0 +1,98 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import * as R from "ramda";
4
+ import originalColorJson from "../../../../design-tokens/semantic/color.json" with { type: "json" };
5
+ import originalColorCategoryJson from "../../../../design-tokens/semantic/modes/main-color/accent.json" with { type: "json" };
6
+ import originalThemeJson from "../../../../design-tokens/themes/digdir.json" with { type: "json" };
7
+ import { stringify } from "./write.js";
8
+ const DIRNAME = import.meta.dirname || __dirname;
9
+ const SOURCE_FILES_PATH = path.join(DIRNAME, "../../../../design-tokens");
10
+ const DEFAULT_FILES_PATH = path.join(DIRNAME, "./design-tokens/default");
11
+ const TEMPLATE_FILES_PATH = path.join(DIRNAME, "./design-tokens/template");
12
+ const argsFromToPaths = (path_) => [
13
+ path.join(SOURCE_FILES_PATH, path_),
14
+ path.join(DEFAULT_FILES_PATH, path_)
15
+ ];
16
+ const options = { recursive: true };
17
+ const endsWithOneOf = (suffixes, str) => R.any((suffix) => R.endsWith(suffix, str), suffixes);
18
+ const updateTemplates = async () => {
19
+ await fs.cp(...argsFromToPaths("primitives/globals.json"), options);
20
+ await fs.cp(...argsFromToPaths("primitives/modes/size"), options);
21
+ await fs.cp(...argsFromToPaths("primitives/modes/typography/size"), options);
22
+ await fs.cp(...argsFromToPaths("semantic/style.json"), options);
23
+ const categoryColorTemplate = originalColorCategoryJson.color.main;
24
+ const categoryDir = path.join(TEMPLATE_FILES_PATH, "semantic/modes/category-color");
25
+ await fs.mkdir(categoryDir, options);
26
+ await fs.writeFile(
27
+ path.join(categoryDir, "category-color-template.json"),
28
+ JSON.stringify(categoryColorTemplate, null, 2).replaceAll("color.accent", "color.<color>")
29
+ );
30
+ const colorBaseFile = {
31
+ color: R.omit(["accent", "neutral", "brand1", "brand2", "brand3"], originalColorJson.color)
32
+ };
33
+ await fs.writeFile(
34
+ path.join(TEMPLATE_FILES_PATH, `semantic/color-base-file.json`),
35
+ JSON.stringify(colorBaseFile, null, 2).replaceAll("color.accent", "color.<accent-color>")
36
+ );
37
+ const semanticColorTemplate = originalColorJson.color.accent;
38
+ await fs.writeFile(
39
+ path.join(TEMPLATE_FILES_PATH, `semantic/semantic-color-template.json`),
40
+ JSON.stringify(semanticColorTemplate, null, 2).replaceAll("color.accent", "color.<color>")
41
+ );
42
+ const themeBaseFile = {
43
+ color: {},
44
+ ...R.omit(["color"], originalThemeJson)
45
+ };
46
+ await fs.mkdir(path.join(TEMPLATE_FILES_PATH, "themes"), options);
47
+ await fs.writeFile(
48
+ path.join(TEMPLATE_FILES_PATH, `themes/theme-base-file.json`),
49
+ JSON.stringify(themeBaseFile, null, 2).replaceAll("digdir", "<theme>")
50
+ );
51
+ const themeColorTemplate = originalThemeJson.color.accent;
52
+ await fs.writeFile(
53
+ path.join(TEMPLATE_FILES_PATH, `themes/theme-color-template.json`),
54
+ JSON.stringify(themeColorTemplate, null, 2).replaceAll("digdir.accent", "<theme>.<color>")
55
+ );
56
+ const themesFile = await fs.readFile(path.join(SOURCE_FILES_PATH, "$themes.json"), "utf-8");
57
+ const themesTemplate = JSON.parse(themesFile).filter((themeobj) => {
58
+ if (R.toLower(themeobj.name) === "compact" && R.toLower(themeobj.group || "") === "size") {
59
+ return false;
60
+ }
61
+ if (R.toLower(themeobj.name) !== "digdir" && R.toLower(themeobj.group || "") === "theme") {
62
+ return false;
63
+ }
64
+ return true;
65
+ }).map((themeobj) => {
66
+ if (R.toLower(themeobj.name) === "digdir") {
67
+ return {
68
+ ...themeobj,
69
+ name: "<theme>",
70
+ selectedTokenSets: {
71
+ "themes/<theme>": "enabled"
72
+ }
73
+ };
74
+ }
75
+ return themeobj;
76
+ });
77
+ await fs.writeFile(path.join(TEMPLATE_FILES_PATH, `$themes.json`), stringify(themesTemplate));
78
+ const metadataFile = await fs.readFile(path.join(SOURCE_FILES_PATH, "$metadata.json"), "utf-8");
79
+ const tokenSetOrderTemplate = JSON.parse(metadataFile).tokenSetOrder.filter((tokenSet) => {
80
+ if (endsWithOneOf(["altinn", "portal", "uutilsynet"], tokenSet)) {
81
+ return false;
82
+ }
83
+ return true;
84
+ }).map((tokenSet) => {
85
+ if (endsWithOneOf(["digdir"], tokenSet)) {
86
+ return tokenSet.replace("/digdir", "/<theme>");
87
+ }
88
+ return tokenSet;
89
+ });
90
+ await fs.writeFile(
91
+ path.join(TEMPLATE_FILES_PATH, `$metadata.json`),
92
+ stringify({ tokenSetOrder: tokenSetOrderTemplate })
93
+ );
94
+ };
95
+ updateTemplates();
96
+ export {
97
+ updateTemplates
98
+ };