@digdir/designsystemet 1.0.3 → 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.
Files changed (186) hide show
  1. package/dist/bin/designsystemet.js +4264 -45
  2. package/dist/bin/options.js +5 -4
  3. package/dist/src/colors/colorMetadata.js +5 -4
  4. package/dist/src/colors/index.js +470 -4
  5. package/dist/src/colors/theme.js +286 -20
  6. package/dist/src/colors/utils.js +16 -15
  7. package/dist/{bin → src}/config.d.ts +46 -1
  8. package/dist/src/config.d.ts.map +1 -0
  9. package/dist/src/config.js +377 -0
  10. package/dist/src/index.js +3666 -2
  11. package/dist/src/migrations/beta-to-v1.js +85 -4
  12. package/dist/src/migrations/codemods/css/plugins.js +5 -4
  13. package/dist/src/migrations/codemods/css/run.d.ts.map +1 -1
  14. package/dist/src/migrations/codemods/css/run.js +18 -4
  15. package/dist/src/migrations/color-rename-next49.js +77 -6
  16. package/dist/src/migrations/index.d.ts +0 -1
  17. package/dist/src/migrations/index.d.ts.map +1 -1
  18. package/dist/src/migrations/index.js +461 -6
  19. package/dist/src/scripts/createJsonSchema.js +1608 -4
  20. package/dist/src/scripts/update-design-tokens.d.ts +2 -0
  21. package/dist/src/scripts/update-design-tokens.d.ts.map +1 -0
  22. package/dist/src/scripts/update-design-tokens.js +36 -0
  23. package/dist/src/{tokens/template.d.ts → scripts/update-template.d.ts} +1 -1
  24. package/dist/src/scripts/update-template.d.ts.map +1 -0
  25. package/dist/src/scripts/update-template.js +1200 -0
  26. package/dist/src/tokens/build.d.ts +2 -19
  27. package/dist/src/tokens/build.d.ts.map +1 -1
  28. package/dist/src/tokens/build.js +1511 -70
  29. package/dist/src/tokens/create/defaults.d.ts +7 -0
  30. package/dist/src/tokens/create/defaults.d.ts.map +1 -0
  31. package/dist/src/tokens/create/defaults.js +994 -0
  32. package/dist/src/tokens/create/generators/$designsystemet.d.ts +5 -0
  33. package/dist/src/tokens/create/generators/$designsystemet.d.ts.map +1 -0
  34. package/dist/src/tokens/create/generators/$designsystemet.js +100 -0
  35. package/dist/src/tokens/create/generators/$metadata.d.ts +8 -0
  36. package/dist/src/tokens/create/generators/$metadata.d.ts.map +1 -0
  37. package/dist/src/tokens/{write/generate$metadata.js → create/generators/$metadata.js} +3 -2
  38. package/dist/src/tokens/create/generators/$themes.d.ts +12 -0
  39. package/dist/src/tokens/create/generators/$themes.d.ts.map +1 -0
  40. package/dist/src/tokens/create/generators/$themes.js +333 -0
  41. package/dist/src/tokens/create/generators/color.d.ts +5 -0
  42. package/dist/src/tokens/create/generators/color.d.ts.map +1 -0
  43. package/dist/src/tokens/create/generators/color.js +374 -0
  44. package/dist/src/tokens/create/generators/semantic.d.ts +296 -0
  45. package/dist/src/tokens/create/generators/semantic.d.ts.map +1 -0
  46. package/dist/src/tokens/create/generators/semantic.js +483 -0
  47. package/dist/src/tokens/create/generators/theme.d.ts +3 -0
  48. package/dist/src/tokens/create/generators/theme.d.ts.map +1 -0
  49. package/dist/src/tokens/create/generators/theme.js +168 -0
  50. package/dist/src/tokens/create/generators/typography.d.ts +3 -0
  51. package/dist/src/tokens/create/generators/typography.d.ts.map +1 -0
  52. package/dist/src/tokens/create/generators/typography.js +33 -0
  53. package/dist/src/tokens/{write.d.ts → create/write.d.ts} +2 -2
  54. package/dist/src/tokens/create/write.d.ts.map +1 -0
  55. package/dist/src/tokens/create/write.js +546 -0
  56. package/dist/src/tokens/create.d.ts +4 -2
  57. package/dist/src/tokens/create.d.ts.map +1 -1
  58. package/dist/src/tokens/create.js +2049 -59
  59. package/dist/src/tokens/format.d.ts +16 -0
  60. package/dist/src/tokens/format.d.ts.map +1 -0
  61. package/dist/src/tokens/format.js +3514 -0
  62. package/dist/src/tokens/index.d.ts +1 -0
  63. package/dist/src/tokens/index.d.ts.map +1 -1
  64. package/dist/src/tokens/index.js +3526 -2
  65. package/dist/src/tokens/process/configs/color.d.ts +12 -0
  66. package/dist/src/tokens/process/configs/color.d.ts.map +1 -0
  67. package/dist/src/tokens/process/configs/color.js +823 -0
  68. package/dist/src/tokens/process/configs/semantic.d.ts +3 -0
  69. package/dist/src/tokens/process/configs/semantic.d.ts.map +1 -0
  70. package/dist/src/tokens/process/configs/semantic.js +367 -0
  71. package/dist/src/tokens/process/configs/shared.d.ts +10 -0
  72. package/dist/src/tokens/process/configs/shared.d.ts.map +1 -0
  73. package/dist/src/tokens/process/configs/shared.js +99 -0
  74. package/dist/src/tokens/process/configs/storefront.d.ts +3 -0
  75. package/dist/src/tokens/process/configs/storefront.d.ts.map +1 -0
  76. package/dist/src/tokens/process/configs/storefront.js +220 -0
  77. package/dist/src/tokens/process/configs/typography.d.ts +3 -0
  78. package/dist/src/tokens/process/configs/typography.d.ts.map +1 -0
  79. package/dist/src/tokens/process/configs/typography.js +369 -0
  80. package/dist/src/tokens/{build → process}/configs.d.ts +3 -11
  81. package/dist/src/tokens/process/configs.d.ts.map +1 -0
  82. package/dist/src/tokens/process/configs.js +976 -0
  83. package/dist/src/tokens/process/formats/css/color.d.ts +4 -0
  84. package/dist/src/tokens/process/formats/css/color.d.ts.map +1 -0
  85. package/dist/src/tokens/process/formats/css/color.js +128 -0
  86. package/dist/src/tokens/process/formats/css/semantic.d.ts +17 -0
  87. package/dist/src/tokens/process/formats/css/semantic.d.ts.map +1 -0
  88. package/dist/src/tokens/process/formats/css/semantic.js +109 -0
  89. package/dist/src/tokens/process/formats/css/typography.d.ts +3 -0
  90. package/dist/src/tokens/process/formats/css/typography.d.ts.map +1 -0
  91. package/dist/src/tokens/process/formats/css/typography.js +32 -0
  92. package/dist/src/tokens/process/formats/css.d.ts +8 -0
  93. package/dist/src/tokens/process/formats/css.d.ts.map +1 -0
  94. package/dist/src/tokens/{build → process}/formats/css.js +94 -57
  95. package/dist/src/tokens/process/formats/js-tokens.d.ts.map +1 -0
  96. package/dist/src/tokens/process/formats/js-tokens.js +109 -0
  97. package/dist/src/tokens/process/platform.d.ts +87 -0
  98. package/dist/src/tokens/process/platform.d.ts.map +1 -0
  99. package/dist/src/tokens/process/platform.js +1090 -0
  100. package/dist/src/tokens/process/transformers.d.ts.map +1 -0
  101. package/dist/src/tokens/{build → process}/transformers.js +29 -6
  102. package/dist/src/tokens/{build → process}/utils/getMultidimensionalThemes.d.ts +3 -3
  103. package/dist/src/tokens/process/utils/getMultidimensionalThemes.d.ts.map +1 -0
  104. package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +922 -0
  105. package/dist/src/tokens/template/design-tokens/primitives/globals.js +5 -0
  106. package/dist/src/tokens/template/design-tokens/primitives/modes/size/global.js +5 -0
  107. package/dist/src/tokens/template/design-tokens/primitives/modes/size/large.js +5 -0
  108. package/dist/src/tokens/template/design-tokens/primitives/modes/size/medium.js +5 -0
  109. package/dist/src/tokens/template/design-tokens/primitives/modes/size/small.js +5 -0
  110. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/large.js +5 -0
  111. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/medium.js +5 -0
  112. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/small.js +5 -0
  113. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/typography.template.js +5 -0
  114. package/dist/src/tokens/template/design-tokens/semantic/color.base.template.js +5 -0
  115. package/dist/src/tokens/template/design-tokens/semantic/color.template.js +5 -0
  116. package/dist/src/tokens/template/design-tokens/semantic/modes/color.template.js +5 -0
  117. package/dist/src/tokens/template/design-tokens/semantic/style.js +5 -0
  118. package/dist/src/tokens/template/design-tokens/themes/theme.base.template.js +5 -0
  119. package/dist/src/tokens/template/design-tokens/themes/theme.template.js +5 -0
  120. package/dist/src/tokens/types.d.ts +54 -38
  121. package/dist/src/tokens/types.d.ts.map +1 -1
  122. package/dist/src/tokens/types.js +8 -0
  123. package/dist/src/tokens/utils.d.ts +30 -5
  124. package/dist/src/tokens/utils.d.ts.map +1 -1
  125. package/dist/src/tokens/utils.js +36 -50
  126. package/dist/src/utils.d.ts +18 -0
  127. package/dist/src/utils.d.ts.map +1 -0
  128. package/dist/src/utils.js +63 -0
  129. package/dist/typography.template-4N5YLH7F.json +22 -0
  130. package/package.json +17 -16
  131. package/dist/bin/config.d.ts.map +0 -1
  132. package/dist/bin/config.js +0 -71
  133. package/dist/src/migrations/codemods/jsx/classname-prefix.d.ts +0 -10
  134. package/dist/src/migrations/codemods/jsx/classname-prefix.d.ts.map +0 -1
  135. package/dist/src/migrations/codemods/jsx/classname-prefix.js +0 -64
  136. package/dist/src/migrations/codemods/jsx/run.d.ts +0 -7
  137. package/dist/src/migrations/codemods/jsx/run.d.ts.map +0 -1
  138. package/dist/src/migrations/codemods/jsx/run.js +0 -22
  139. package/dist/src/migrations/react-beta-to-v1.d.ts +0 -3
  140. package/dist/src/migrations/react-beta-to-v1.d.ts.map +0 -1
  141. package/dist/src/migrations/react-beta-to-v1.js +0 -5
  142. package/dist/src/scripts/copy-internal-tokens.d.ts +0 -2
  143. package/dist/src/scripts/copy-internal-tokens.d.ts.map +0 -1
  144. package/dist/src/scripts/copy-internal-tokens.js +0 -28
  145. package/dist/src/tokens/build/configs.d.ts.map +0 -1
  146. package/dist/src/tokens/build/configs.js +0 -280
  147. package/dist/src/tokens/build/formats/css.d.ts +0 -53
  148. package/dist/src/tokens/build/formats/css.d.ts.map +0 -1
  149. package/dist/src/tokens/build/formats/js-tokens.d.ts.map +0 -1
  150. package/dist/src/tokens/build/formats/js-tokens.js +0 -48
  151. package/dist/src/tokens/build/transformers.d.ts.map +0 -1
  152. package/dist/src/tokens/build/types.d.ts +0 -48
  153. package/dist/src/tokens/build/types.d.ts.map +0 -1
  154. package/dist/src/tokens/build/types.js +0 -7
  155. package/dist/src/tokens/build/utils/entryfile.d.ts +0 -12
  156. package/dist/src/tokens/build/utils/entryfile.d.ts.map +0 -1
  157. package/dist/src/tokens/build/utils/entryfile.js +0 -67
  158. package/dist/src/tokens/build/utils/getMultidimensionalThemes.d.ts.map +0 -1
  159. package/dist/src/tokens/build/utils/getMultidimensionalThemes.js +0 -112
  160. package/dist/src/tokens/design-tokens/template/$metadata.json +0 -25
  161. package/dist/src/tokens/design-tokens/template/$themes.json +0 -1498
  162. package/dist/src/tokens/template.d.ts.map +0 -1
  163. package/dist/src/tokens/template.js +0 -99
  164. package/dist/src/tokens/write/generate$metadata.d.ts +0 -9
  165. package/dist/src/tokens/write/generate$metadata.d.ts.map +0 -1
  166. package/dist/src/tokens/write/generate$themes.d.ts +0 -12
  167. package/dist/src/tokens/write/generate$themes.d.ts.map +0 -1
  168. package/dist/src/tokens/write/generate$themes.js +0 -161
  169. package/dist/src/tokens/write.d.ts.map +0 -1
  170. package/dist/src/tokens/write.js +0 -177
  171. /package/dist/{src/tokens/design-tokens/template/semantic/color-base-file.json → color.base.template-M7BHS4OV.json} +0 -0
  172. /package/dist/{src/tokens/design-tokens/template/semantic/modes/category-color/category-color-template.json → color.template-LMPUQ72A.json} +0 -0
  173. /package/dist/{src/tokens/design-tokens/template/semantic/semantic-color-template.json → color.template-XQNSHLTU.json} +0 -0
  174. /package/dist/{src/tokens/design-tokens/default/primitives/modes/size/global.json → global-XVXVBKM6.json} +0 -0
  175. /package/dist/{src/tokens/design-tokens/default/primitives/globals.json → globals-76VAFMDF.json} +0 -0
  176. /package/dist/{src/tokens/design-tokens/default/primitives/modes/typography/size/large.json → large-CIIHO7AY.json} +0 -0
  177. /package/dist/{src/tokens/design-tokens/default/primitives/modes/size/large.json → large-UUOZ6DYI.json} +0 -0
  178. /package/dist/{src/tokens/design-tokens/default/primitives/modes/size/medium.json → medium-OQ7S7P4P.json} +0 -0
  179. /package/dist/{src/tokens/design-tokens/default/primitives/modes/typography/size/medium.json → medium-VSB2S4X3.json} +0 -0
  180. /package/dist/{src/tokens/design-tokens/default/primitives/modes/typography/size/small.json → small-AEXJ6U7Z.json} +0 -0
  181. /package/dist/{src/tokens/design-tokens/default/primitives/modes/size/small.json → small-ZY4KOJWX.json} +0 -0
  182. /package/dist/src/tokens/{build → process}/formats/js-tokens.d.ts +0 -0
  183. /package/dist/src/tokens/{build → process}/transformers.d.ts +0 -0
  184. /package/dist/{src/tokens/design-tokens/default/semantic/style.json → style-FP5XVCUD.json} +0 -0
  185. /package/dist/{src/tokens/design-tokens/template/themes/theme-base-file.json → theme.base.template-Y4RMFBQY.json} +0 -0
  186. /package/dist/{src/tokens/design-tokens/template/themes/theme-color-template.json → theme.template-CTQRNOMO.json} +0 -0
@@ -0,0 +1,1200 @@
1
+ // src/scripts/update-template.ts
2
+ import path from "node:path";
3
+ import chalk2 from "chalk";
4
+ import * as R from "ramda";
5
+
6
+ // ../../design-tokens/semantic/color.json
7
+ var color_default = {
8
+ color: {
9
+ accent: {
10
+ "background-default": {
11
+ $type: "color",
12
+ $value: "{color.accent.1}"
13
+ },
14
+ "background-tinted": {
15
+ $type: "color",
16
+ $value: "{color.accent.2}"
17
+ },
18
+ "surface-default": {
19
+ $type: "color",
20
+ $value: "{color.accent.3}"
21
+ },
22
+ "surface-tinted": {
23
+ $type: "color",
24
+ $value: "{color.accent.4}"
25
+ },
26
+ "surface-hover": {
27
+ $type: "color",
28
+ $value: "{color.accent.5}"
29
+ },
30
+ "surface-active": {
31
+ $type: "color",
32
+ $value: "{color.accent.6}"
33
+ },
34
+ "border-subtle": {
35
+ $type: "color",
36
+ $value: "{color.accent.7}"
37
+ },
38
+ "border-default": {
39
+ $type: "color",
40
+ $value: "{color.accent.8}"
41
+ },
42
+ "border-strong": {
43
+ $type: "color",
44
+ $value: "{color.accent.9}"
45
+ },
46
+ "text-subtle": {
47
+ $type: "color",
48
+ $value: "{color.accent.10}"
49
+ },
50
+ "text-default": {
51
+ $type: "color",
52
+ $value: "{color.accent.11}"
53
+ },
54
+ "base-default": {
55
+ $type: "color",
56
+ $value: "{color.accent.12}"
57
+ },
58
+ "base-hover": {
59
+ $type: "color",
60
+ $value: "{color.accent.13}"
61
+ },
62
+ "base-active": {
63
+ $type: "color",
64
+ $value: "{color.accent.14}"
65
+ },
66
+ "base-contrast-subtle": {
67
+ $type: "color",
68
+ $value: "{color.accent.15}"
69
+ },
70
+ "base-contrast-default": {
71
+ $type: "color",
72
+ $value: "{color.accent.16}"
73
+ }
74
+ },
75
+ neutral: {
76
+ "background-default": {
77
+ $type: "color",
78
+ $value: "{color.neutral.1}"
79
+ },
80
+ "background-tinted": {
81
+ $type: "color",
82
+ $value: "{color.neutral.2}"
83
+ },
84
+ "surface-default": {
85
+ $type: "color",
86
+ $value: "{color.neutral.3}"
87
+ },
88
+ "surface-tinted": {
89
+ $type: "color",
90
+ $value: "{color.neutral.4}"
91
+ },
92
+ "surface-hover": {
93
+ $type: "color",
94
+ $value: "{color.neutral.5}"
95
+ },
96
+ "surface-active": {
97
+ $type: "color",
98
+ $value: "{color.neutral.6}"
99
+ },
100
+ "border-subtle": {
101
+ $type: "color",
102
+ $value: "{color.neutral.7}"
103
+ },
104
+ "border-default": {
105
+ $type: "color",
106
+ $value: "{color.neutral.8}"
107
+ },
108
+ "border-strong": {
109
+ $type: "color",
110
+ $value: "{color.neutral.9}"
111
+ },
112
+ "text-subtle": {
113
+ $type: "color",
114
+ $value: "{color.neutral.10}"
115
+ },
116
+ "text-default": {
117
+ $type: "color",
118
+ $value: "{color.neutral.11}"
119
+ },
120
+ "base-default": {
121
+ $type: "color",
122
+ $value: "{color.neutral.12}"
123
+ },
124
+ "base-hover": {
125
+ $type: "color",
126
+ $value: "{color.neutral.13}"
127
+ },
128
+ "base-active": {
129
+ $type: "color",
130
+ $value: "{color.neutral.14}"
131
+ },
132
+ "base-contrast-subtle": {
133
+ $type: "color",
134
+ $value: "{color.neutral.15}"
135
+ },
136
+ "base-contrast-default": {
137
+ $type: "color",
138
+ $value: "{color.neutral.16}"
139
+ }
140
+ },
141
+ brand1: {
142
+ "background-default": {
143
+ $type: "color",
144
+ $value: "{color.brand1.1}"
145
+ },
146
+ "background-tinted": {
147
+ $type: "color",
148
+ $value: "{color.brand1.2}"
149
+ },
150
+ "surface-default": {
151
+ $type: "color",
152
+ $value: "{color.brand1.3}"
153
+ },
154
+ "surface-tinted": {
155
+ $type: "color",
156
+ $value: "{color.brand1.4}"
157
+ },
158
+ "surface-hover": {
159
+ $type: "color",
160
+ $value: "{color.brand1.5}"
161
+ },
162
+ "surface-active": {
163
+ $type: "color",
164
+ $value: "{color.brand1.6}"
165
+ },
166
+ "border-subtle": {
167
+ $type: "color",
168
+ $value: "{color.brand1.7}"
169
+ },
170
+ "border-default": {
171
+ $type: "color",
172
+ $value: "{color.brand1.8}"
173
+ },
174
+ "border-strong": {
175
+ $type: "color",
176
+ $value: "{color.brand1.9}"
177
+ },
178
+ "text-subtle": {
179
+ $type: "color",
180
+ $value: "{color.brand1.10}"
181
+ },
182
+ "text-default": {
183
+ $type: "color",
184
+ $value: "{color.brand1.11}"
185
+ },
186
+ "base-default": {
187
+ $type: "color",
188
+ $value: "{color.brand1.12}"
189
+ },
190
+ "base-hover": {
191
+ $type: "color",
192
+ $value: "{color.brand1.13}"
193
+ },
194
+ "base-active": {
195
+ $type: "color",
196
+ $value: "{color.brand1.14}"
197
+ },
198
+ "base-contrast-subtle": {
199
+ $type: "color",
200
+ $value: "{color.brand1.15}"
201
+ },
202
+ "base-contrast-default": {
203
+ $type: "color",
204
+ $value: "{color.brand1.16}"
205
+ }
206
+ },
207
+ brand2: {
208
+ "background-default": {
209
+ $type: "color",
210
+ $value: "{color.brand2.1}"
211
+ },
212
+ "background-tinted": {
213
+ $type: "color",
214
+ $value: "{color.brand2.2}"
215
+ },
216
+ "surface-default": {
217
+ $type: "color",
218
+ $value: "{color.brand2.3}"
219
+ },
220
+ "surface-tinted": {
221
+ $type: "color",
222
+ $value: "{color.brand2.4}"
223
+ },
224
+ "surface-hover": {
225
+ $type: "color",
226
+ $value: "{color.brand2.5}"
227
+ },
228
+ "surface-active": {
229
+ $type: "color",
230
+ $value: "{color.brand2.6}"
231
+ },
232
+ "border-subtle": {
233
+ $type: "color",
234
+ $value: "{color.brand2.7}"
235
+ },
236
+ "border-default": {
237
+ $type: "color",
238
+ $value: "{color.brand2.8}"
239
+ },
240
+ "border-strong": {
241
+ $type: "color",
242
+ $value: "{color.brand2.9}"
243
+ },
244
+ "text-subtle": {
245
+ $type: "color",
246
+ $value: "{color.brand2.10}"
247
+ },
248
+ "text-default": {
249
+ $type: "color",
250
+ $value: "{color.brand2.11}"
251
+ },
252
+ "base-default": {
253
+ $type: "color",
254
+ $value: "{color.brand2.12}"
255
+ },
256
+ "base-hover": {
257
+ $type: "color",
258
+ $value: "{color.brand2.13}"
259
+ },
260
+ "base-active": {
261
+ $type: "color",
262
+ $value: "{color.brand2.14}"
263
+ },
264
+ "base-contrast-subtle": {
265
+ $type: "color",
266
+ $value: "{color.brand2.15}"
267
+ },
268
+ "base-contrast-default": {
269
+ $type: "color",
270
+ $value: "{color.brand2.16}"
271
+ }
272
+ },
273
+ brand3: {
274
+ "background-default": {
275
+ $type: "color",
276
+ $value: "{color.brand3.1}"
277
+ },
278
+ "background-tinted": {
279
+ $type: "color",
280
+ $value: "{color.brand3.2}"
281
+ },
282
+ "surface-default": {
283
+ $type: "color",
284
+ $value: "{color.brand3.3}"
285
+ },
286
+ "surface-tinted": {
287
+ $type: "color",
288
+ $value: "{color.brand3.4}"
289
+ },
290
+ "surface-hover": {
291
+ $type: "color",
292
+ $value: "{color.brand3.5}"
293
+ },
294
+ "surface-active": {
295
+ $type: "color",
296
+ $value: "{color.brand3.6}"
297
+ },
298
+ "border-subtle": {
299
+ $type: "color",
300
+ $value: "{color.brand3.7}"
301
+ },
302
+ "border-default": {
303
+ $type: "color",
304
+ $value: "{color.brand3.8}"
305
+ },
306
+ "border-strong": {
307
+ $type: "color",
308
+ $value: "{color.brand3.9}"
309
+ },
310
+ "text-subtle": {
311
+ $type: "color",
312
+ $value: "{color.brand3.10}"
313
+ },
314
+ "text-default": {
315
+ $type: "color",
316
+ $value: "{color.brand3.11}"
317
+ },
318
+ "base-default": {
319
+ $type: "color",
320
+ $value: "{color.brand3.12}"
321
+ },
322
+ "base-hover": {
323
+ $type: "color",
324
+ $value: "{color.brand3.13}"
325
+ },
326
+ "base-active": {
327
+ $type: "color",
328
+ $value: "{color.brand3.14}"
329
+ },
330
+ "base-contrast-subtle": {
331
+ $type: "color",
332
+ $value: "{color.brand3.15}"
333
+ },
334
+ "base-contrast-default": {
335
+ $type: "color",
336
+ $value: "{color.brand3.16}"
337
+ }
338
+ },
339
+ success: {
340
+ "background-default": {
341
+ $type: "color",
342
+ $value: "{global.green.1}"
343
+ },
344
+ "background-tinted": {
345
+ $type: "color",
346
+ $value: "{global.green.2}"
347
+ },
348
+ "surface-default": {
349
+ $type: "color",
350
+ $value: "{global.green.3}"
351
+ },
352
+ "surface-tinted": {
353
+ $type: "color",
354
+ $value: "{global.green.4}"
355
+ },
356
+ "surface-hover": {
357
+ $type: "color",
358
+ $value: "{global.green.5}"
359
+ },
360
+ "surface-active": {
361
+ $type: "color",
362
+ $value: "{global.green.6}"
363
+ },
364
+ "border-subtle": {
365
+ $type: "color",
366
+ $value: "{global.green.7}"
367
+ },
368
+ "border-default": {
369
+ $type: "color",
370
+ $value: "{global.green.8}"
371
+ },
372
+ "border-strong": {
373
+ $type: "color",
374
+ $value: "{global.green.9}"
375
+ },
376
+ "text-subtle": {
377
+ $type: "color",
378
+ $value: "{global.green.10}"
379
+ },
380
+ "text-default": {
381
+ $type: "color",
382
+ $value: "{global.green.11}"
383
+ },
384
+ "base-default": {
385
+ $type: "color",
386
+ $value: "{global.green.12}"
387
+ },
388
+ "base-hover": {
389
+ $type: "color",
390
+ $value: "{global.green.13}"
391
+ },
392
+ "base-active": {
393
+ $type: "color",
394
+ $value: "{global.green.14}"
395
+ },
396
+ "base-contrast-subtle": {
397
+ $type: "color",
398
+ $value: "{global.green.15}"
399
+ },
400
+ "base-contrast-default": {
401
+ $type: "color",
402
+ $value: "{global.green.16}"
403
+ }
404
+ },
405
+ danger: {
406
+ "background-default": {
407
+ $type: "color",
408
+ $value: "{global.red.1}"
409
+ },
410
+ "background-tinted": {
411
+ $type: "color",
412
+ $value: "{global.red.2}"
413
+ },
414
+ "surface-default": {
415
+ $type: "color",
416
+ $value: "{global.red.3}"
417
+ },
418
+ "surface-tinted": {
419
+ $type: "color",
420
+ $value: "{global.red.4}"
421
+ },
422
+ "surface-hover": {
423
+ $type: "color",
424
+ $value: "{global.red.5}"
425
+ },
426
+ "surface-active": {
427
+ $type: "color",
428
+ $value: "{global.red.6}"
429
+ },
430
+ "border-subtle": {
431
+ $type: "color",
432
+ $value: "{global.red.7}"
433
+ },
434
+ "border-default": {
435
+ $type: "color",
436
+ $value: "{global.red.8}"
437
+ },
438
+ "border-strong": {
439
+ $type: "color",
440
+ $value: "{global.red.9}"
441
+ },
442
+ "text-subtle": {
443
+ $type: "color",
444
+ $value: "{global.red.10}"
445
+ },
446
+ "text-default": {
447
+ $type: "color",
448
+ $value: "{global.red.11}"
449
+ },
450
+ "base-default": {
451
+ $type: "color",
452
+ $value: "{global.red.12}"
453
+ },
454
+ "base-hover": {
455
+ $type: "color",
456
+ $value: "{global.red.13}"
457
+ },
458
+ "base-active": {
459
+ $type: "color",
460
+ $value: "{global.red.14}"
461
+ },
462
+ "base-contrast-subtle": {
463
+ $type: "color",
464
+ $value: "{global.red.15}"
465
+ },
466
+ "base-contrast-default": {
467
+ $type: "color",
468
+ $value: "{global.red.16}"
469
+ }
470
+ },
471
+ info: {
472
+ "background-default": {
473
+ $type: "color",
474
+ $value: "{global.blue.1}"
475
+ },
476
+ "background-tinted": {
477
+ $type: "color",
478
+ $value: "{global.blue.2}"
479
+ },
480
+ "surface-default": {
481
+ $type: "color",
482
+ $value: "{global.blue.3}"
483
+ },
484
+ "surface-tinted": {
485
+ $type: "color",
486
+ $value: "{global.blue.4}"
487
+ },
488
+ "surface-hover": {
489
+ $type: "color",
490
+ $value: "{global.blue.5}"
491
+ },
492
+ "surface-active": {
493
+ $type: "color",
494
+ $value: "{global.blue.6}"
495
+ },
496
+ "border-subtle": {
497
+ $type: "color",
498
+ $value: "{global.blue.7}"
499
+ },
500
+ "border-default": {
501
+ $type: "color",
502
+ $value: "{global.blue.8}"
503
+ },
504
+ "border-strong": {
505
+ $type: "color",
506
+ $value: "{global.blue.9}"
507
+ },
508
+ "text-subtle": {
509
+ $type: "color",
510
+ $value: "{global.blue.10}"
511
+ },
512
+ "text-default": {
513
+ $type: "color",
514
+ $value: "{global.blue.11}"
515
+ },
516
+ "base-default": {
517
+ $type: "color",
518
+ $value: "{global.blue.12}"
519
+ },
520
+ "base-hover": {
521
+ $type: "color",
522
+ $value: "{global.blue.13}"
523
+ },
524
+ "base-active": {
525
+ $type: "color",
526
+ $value: "{global.blue.14}"
527
+ },
528
+ "base-contrast-subtle": {
529
+ $type: "color",
530
+ $value: "{global.blue.15}"
531
+ },
532
+ "base-contrast-default": {
533
+ $type: "color",
534
+ $value: "{global.blue.16}"
535
+ }
536
+ },
537
+ warning: {
538
+ "background-default": {
539
+ $type: "color",
540
+ $value: "{global.orange.1}"
541
+ },
542
+ "background-tinted": {
543
+ $type: "color",
544
+ $value: "{global.orange.2}"
545
+ },
546
+ "surface-default": {
547
+ $type: "color",
548
+ $value: "{global.orange.3}"
549
+ },
550
+ "surface-tinted": {
551
+ $type: "color",
552
+ $value: "{global.orange.4}"
553
+ },
554
+ "surface-hover": {
555
+ $type: "color",
556
+ $value: "{global.orange.5}"
557
+ },
558
+ "surface-active": {
559
+ $type: "color",
560
+ $value: "{global.orange.6}"
561
+ },
562
+ "border-subtle": {
563
+ $type: "color",
564
+ $value: "{global.orange.7}"
565
+ },
566
+ "border-default": {
567
+ $type: "color",
568
+ $value: "{global.orange.8}"
569
+ },
570
+ "border-strong": {
571
+ $type: "color",
572
+ $value: "{global.orange.9}"
573
+ },
574
+ "text-subtle": {
575
+ $type: "color",
576
+ $value: "{global.orange.10}"
577
+ },
578
+ "text-default": {
579
+ $type: "color",
580
+ $value: "{global.orange.11}"
581
+ },
582
+ "base-default": {
583
+ $type: "color",
584
+ $value: "{global.orange.12}"
585
+ },
586
+ "base-hover": {
587
+ $type: "color",
588
+ $value: "{global.orange.13}"
589
+ },
590
+ "base-active": {
591
+ $type: "color",
592
+ $value: "{global.orange.14}"
593
+ },
594
+ "base-contrast-subtle": {
595
+ $type: "color",
596
+ $value: "{global.orange.15}"
597
+ },
598
+ "base-contrast-default": {
599
+ $type: "color",
600
+ $value: "{global.orange.16}"
601
+ }
602
+ },
603
+ focus: {
604
+ inner: {
605
+ $type: "color",
606
+ $value: "{color.neutral.background-default}"
607
+ },
608
+ outer: {
609
+ $type: "color",
610
+ $value: "{color.neutral.text-default}"
611
+ }
612
+ }
613
+ },
614
+ link: {
615
+ color: {
616
+ visited: {
617
+ $type: "color",
618
+ $value: "{global.purple.12}"
619
+ }
620
+ }
621
+ }
622
+ };
623
+
624
+ // ../../design-tokens/semantic/modes/main-color/accent.json
625
+ var accent_default = {
626
+ color: {
627
+ main: {
628
+ "background-default": {
629
+ $type: "color",
630
+ $value: "{color.accent.background-default}"
631
+ },
632
+ "background-tinted": {
633
+ $type: "color",
634
+ $value: "{color.accent.background-tinted}"
635
+ },
636
+ "surface-default": {
637
+ $type: "color",
638
+ $value: "{color.accent.surface-default}"
639
+ },
640
+ "surface-tinted": {
641
+ $type: "color",
642
+ $value: "{color.accent.surface-tinted}"
643
+ },
644
+ "surface-hover": {
645
+ $type: "color",
646
+ $value: "{color.accent.surface-hover}"
647
+ },
648
+ "surface-active": {
649
+ $type: "color",
650
+ $value: "{color.accent.surface-active}"
651
+ },
652
+ "border-subtle": {
653
+ $type: "color",
654
+ $value: "{color.accent.border-subtle}"
655
+ },
656
+ "border-default": {
657
+ $type: "color",
658
+ $value: "{color.accent.border-default}"
659
+ },
660
+ "border-strong": {
661
+ $type: "color",
662
+ $value: "{color.accent.border-strong}"
663
+ },
664
+ "text-subtle": {
665
+ $type: "color",
666
+ $value: "{color.accent.text-subtle}"
667
+ },
668
+ "text-default": {
669
+ $type: "color",
670
+ $value: "{color.accent.text-default}"
671
+ },
672
+ "base-default": {
673
+ $type: "color",
674
+ $value: "{color.accent.base-default}"
675
+ },
676
+ "base-hover": {
677
+ $type: "color",
678
+ $value: "{color.accent.base-hover}"
679
+ },
680
+ "base-active": {
681
+ $type: "color",
682
+ $value: "{color.accent.base-active}"
683
+ },
684
+ "base-contrast-subtle": {
685
+ $type: "color",
686
+ $value: "{color.accent.base-contrast-subtle}"
687
+ },
688
+ "base-contrast-default": {
689
+ $type: "color",
690
+ $value: "{color.accent.base-contrast-default}"
691
+ }
692
+ }
693
+ }
694
+ };
695
+
696
+ // ../../design-tokens/themes/digdir.json
697
+ var digdir_default = {
698
+ color: {
699
+ accent: {
700
+ "1": {
701
+ $type: "color",
702
+ $value: "{digdir.accent.1}"
703
+ },
704
+ "2": {
705
+ $type: "color",
706
+ $value: "{digdir.accent.2}"
707
+ },
708
+ "3": {
709
+ $type: "color",
710
+ $value: "{digdir.accent.3}"
711
+ },
712
+ "4": {
713
+ $type: "color",
714
+ $value: "{digdir.accent.4}"
715
+ },
716
+ "5": {
717
+ $type: "color",
718
+ $value: "{digdir.accent.5}"
719
+ },
720
+ "6": {
721
+ $type: "color",
722
+ $value: "{digdir.accent.6}"
723
+ },
724
+ "7": {
725
+ $type: "color",
726
+ $value: "{digdir.accent.7}"
727
+ },
728
+ "8": {
729
+ $type: "color",
730
+ $value: "{digdir.accent.8}"
731
+ },
732
+ "9": {
733
+ $type: "color",
734
+ $value: "{digdir.accent.9}"
735
+ },
736
+ "10": {
737
+ $type: "color",
738
+ $value: "{digdir.accent.10}"
739
+ },
740
+ "11": {
741
+ $type: "color",
742
+ $value: "{digdir.accent.11}"
743
+ },
744
+ "12": {
745
+ $type: "color",
746
+ $value: "{digdir.accent.12}"
747
+ },
748
+ "13": {
749
+ $type: "color",
750
+ $value: "{digdir.accent.13}"
751
+ },
752
+ "14": {
753
+ $type: "color",
754
+ $value: "{digdir.accent.14}"
755
+ },
756
+ "15": {
757
+ $type: "color",
758
+ $value: "{digdir.accent.15}"
759
+ },
760
+ "16": {
761
+ $type: "color",
762
+ $value: "{digdir.accent.16}"
763
+ }
764
+ },
765
+ neutral: {
766
+ "1": {
767
+ $type: "color",
768
+ $value: "{digdir.neutral.1}"
769
+ },
770
+ "2": {
771
+ $type: "color",
772
+ $value: "{digdir.neutral.2}"
773
+ },
774
+ "3": {
775
+ $type: "color",
776
+ $value: "{digdir.neutral.3}"
777
+ },
778
+ "4": {
779
+ $type: "color",
780
+ $value: "{digdir.neutral.4}"
781
+ },
782
+ "5": {
783
+ $type: "color",
784
+ $value: "{digdir.neutral.5}"
785
+ },
786
+ "6": {
787
+ $type: "color",
788
+ $value: "{digdir.neutral.6}"
789
+ },
790
+ "7": {
791
+ $type: "color",
792
+ $value: "{digdir.neutral.7}"
793
+ },
794
+ "8": {
795
+ $type: "color",
796
+ $value: "{digdir.neutral.8}"
797
+ },
798
+ "9": {
799
+ $type: "color",
800
+ $value: "{digdir.neutral.9}"
801
+ },
802
+ "10": {
803
+ $type: "color",
804
+ $value: "{digdir.neutral.10}"
805
+ },
806
+ "11": {
807
+ $type: "color",
808
+ $value: "{digdir.neutral.11}"
809
+ },
810
+ "12": {
811
+ $type: "color",
812
+ $value: "{digdir.neutral.12}"
813
+ },
814
+ "13": {
815
+ $type: "color",
816
+ $value: "{digdir.neutral.13}"
817
+ },
818
+ "14": {
819
+ $type: "color",
820
+ $value: "{digdir.neutral.14}"
821
+ },
822
+ "15": {
823
+ $type: "color",
824
+ $value: "{digdir.neutral.15}"
825
+ },
826
+ "16": {
827
+ $type: "color",
828
+ $value: "{digdir.neutral.16}"
829
+ }
830
+ },
831
+ brand1: {
832
+ "1": {
833
+ $type: "color",
834
+ $value: "{digdir.brand1.1}"
835
+ },
836
+ "2": {
837
+ $type: "color",
838
+ $value: "{digdir.brand1.2}"
839
+ },
840
+ "3": {
841
+ $type: "color",
842
+ $value: "{digdir.brand1.3}"
843
+ },
844
+ "4": {
845
+ $type: "color",
846
+ $value: "{digdir.brand1.4}"
847
+ },
848
+ "5": {
849
+ $type: "color",
850
+ $value: "{digdir.brand1.5}"
851
+ },
852
+ "6": {
853
+ $type: "color",
854
+ $value: "{digdir.brand1.6}"
855
+ },
856
+ "7": {
857
+ $type: "color",
858
+ $value: "{digdir.brand1.7}"
859
+ },
860
+ "8": {
861
+ $type: "color",
862
+ $value: "{digdir.brand1.8}"
863
+ },
864
+ "9": {
865
+ $type: "color",
866
+ $value: "{digdir.brand1.9}"
867
+ },
868
+ "10": {
869
+ $type: "color",
870
+ $value: "{digdir.brand1.10}"
871
+ },
872
+ "11": {
873
+ $type: "color",
874
+ $value: "{digdir.brand1.11}"
875
+ },
876
+ "12": {
877
+ $type: "color",
878
+ $value: "{digdir.brand1.12}"
879
+ },
880
+ "13": {
881
+ $type: "color",
882
+ $value: "{digdir.brand1.13}"
883
+ },
884
+ "14": {
885
+ $type: "color",
886
+ $value: "{digdir.brand1.14}"
887
+ },
888
+ "15": {
889
+ $type: "color",
890
+ $value: "{digdir.brand1.15}"
891
+ },
892
+ "16": {
893
+ $type: "color",
894
+ $value: "{digdir.brand1.16}"
895
+ }
896
+ },
897
+ brand2: {
898
+ "1": {
899
+ $type: "color",
900
+ $value: "{digdir.brand2.1}"
901
+ },
902
+ "2": {
903
+ $type: "color",
904
+ $value: "{digdir.brand2.2}"
905
+ },
906
+ "3": {
907
+ $type: "color",
908
+ $value: "{digdir.brand2.3}"
909
+ },
910
+ "4": {
911
+ $type: "color",
912
+ $value: "{digdir.brand2.4}"
913
+ },
914
+ "5": {
915
+ $type: "color",
916
+ $value: "{digdir.brand2.5}"
917
+ },
918
+ "6": {
919
+ $type: "color",
920
+ $value: "{digdir.brand2.6}"
921
+ },
922
+ "7": {
923
+ $type: "color",
924
+ $value: "{digdir.brand2.7}"
925
+ },
926
+ "8": {
927
+ $type: "color",
928
+ $value: "{digdir.brand2.8}"
929
+ },
930
+ "9": {
931
+ $type: "color",
932
+ $value: "{digdir.brand2.9}"
933
+ },
934
+ "10": {
935
+ $type: "color",
936
+ $value: "{digdir.brand2.10}"
937
+ },
938
+ "11": {
939
+ $type: "color",
940
+ $value: "{digdir.brand2.11}"
941
+ },
942
+ "12": {
943
+ $type: "color",
944
+ $value: "{digdir.brand2.12}"
945
+ },
946
+ "13": {
947
+ $type: "color",
948
+ $value: "{digdir.brand2.13}"
949
+ },
950
+ "14": {
951
+ $type: "color",
952
+ $value: "{digdir.brand2.14}"
953
+ },
954
+ "15": {
955
+ $type: "color",
956
+ $value: "{digdir.brand2.15}"
957
+ },
958
+ "16": {
959
+ $type: "color",
960
+ $value: "{digdir.brand2.16}"
961
+ }
962
+ },
963
+ brand3: {
964
+ "1": {
965
+ $type: "color",
966
+ $value: "{digdir.brand3.1}"
967
+ },
968
+ "2": {
969
+ $type: "color",
970
+ $value: "{digdir.brand3.2}"
971
+ },
972
+ "3": {
973
+ $type: "color",
974
+ $value: "{digdir.brand3.3}"
975
+ },
976
+ "4": {
977
+ $type: "color",
978
+ $value: "{digdir.brand3.4}"
979
+ },
980
+ "5": {
981
+ $type: "color",
982
+ $value: "{digdir.brand3.5}"
983
+ },
984
+ "6": {
985
+ $type: "color",
986
+ $value: "{digdir.brand3.6}"
987
+ },
988
+ "7": {
989
+ $type: "color",
990
+ $value: "{digdir.brand3.7}"
991
+ },
992
+ "8": {
993
+ $type: "color",
994
+ $value: "{digdir.brand3.8}"
995
+ },
996
+ "9": {
997
+ $type: "color",
998
+ $value: "{digdir.brand3.9}"
999
+ },
1000
+ "10": {
1001
+ $type: "color",
1002
+ $value: "{digdir.brand3.10}"
1003
+ },
1004
+ "11": {
1005
+ $type: "color",
1006
+ $value: "{digdir.brand3.11}"
1007
+ },
1008
+ "12": {
1009
+ $type: "color",
1010
+ $value: "{digdir.brand3.12}"
1011
+ },
1012
+ "13": {
1013
+ $type: "color",
1014
+ $value: "{digdir.brand3.13}"
1015
+ },
1016
+ "14": {
1017
+ $type: "color",
1018
+ $value: "{digdir.brand3.14}"
1019
+ },
1020
+ "15": {
1021
+ $type: "color",
1022
+ $value: "{digdir.brand3.15}"
1023
+ },
1024
+ "16": {
1025
+ $type: "color",
1026
+ $value: "{digdir.brand3.16}"
1027
+ }
1028
+ }
1029
+ },
1030
+ "font-family": {
1031
+ $type: "fontFamilies",
1032
+ $value: "{digdir.font-family}"
1033
+ },
1034
+ "font-weight": {
1035
+ medium: {
1036
+ $type: "fontWeights",
1037
+ $value: "{digdir.font-weight.medium}"
1038
+ },
1039
+ semibold: {
1040
+ $type: "fontWeights",
1041
+ $value: "{digdir.font-weight.semibold}"
1042
+ },
1043
+ regular: {
1044
+ $type: "fontWeights",
1045
+ $value: "{digdir.font-weight.regular}"
1046
+ }
1047
+ },
1048
+ "border-radius": {
1049
+ "1": {
1050
+ $type: "dimension",
1051
+ $value: "min({border-radius.base}*0.5,{border-radius.scale})"
1052
+ },
1053
+ "2": {
1054
+ $type: "dimension",
1055
+ $value: "min({border-radius.base},{border-radius.scale}*2)"
1056
+ },
1057
+ "3": {
1058
+ $type: "dimension",
1059
+ $value: "min({border-radius.base}*2,{border-radius.scale}*5)"
1060
+ },
1061
+ "4": {
1062
+ $type: "dimension",
1063
+ $value: "min({border-radius.base}*3,{border-radius.scale}*7)"
1064
+ },
1065
+ "5": {
1066
+ $type: "dimension",
1067
+ $value: "{border-radius.base}"
1068
+ },
1069
+ "6": {
1070
+ $type: "dimension",
1071
+ $value: "9999"
1072
+ },
1073
+ base: {
1074
+ $type: "dimension",
1075
+ $value: "4"
1076
+ },
1077
+ scale: {
1078
+ $type: "dimension",
1079
+ $value: "4"
1080
+ }
1081
+ }
1082
+ };
1083
+
1084
+ // src/utils.ts
1085
+ import fs from "node:fs/promises";
1086
+ import chalk from "chalk";
1087
+ var mkdir = async (dir, dry) => {
1088
+ if (dry) {
1089
+ console.log(`${chalk.blue("mkdir")} ${dir}`);
1090
+ return Promise.resolve();
1091
+ }
1092
+ const exists = await fs.access(dir, fs.constants.F_OK).then(() => true).catch(() => false);
1093
+ if (exists) {
1094
+ return Promise.resolve();
1095
+ }
1096
+ return fs.mkdir(dir, { recursive: true });
1097
+ };
1098
+ var writeFile = async (path2, data, dry) => {
1099
+ if (dry) {
1100
+ console.log(`${chalk.blue("writeFile")} ${path2}`);
1101
+ return Promise.resolve();
1102
+ }
1103
+ return fs.writeFile(path2, data, { encoding: "utf-8" }).catch((error) => {
1104
+ console.error(chalk.red(`Error writing file: ${path2}`));
1105
+ console.error(chalk.red(error));
1106
+ throw error;
1107
+ });
1108
+ };
1109
+ var cp = async (src, dest, dry, filter) => {
1110
+ if (dry) {
1111
+ console.log(`${chalk.blue("cp")} ${src} ${dest}`);
1112
+ return Promise.resolve();
1113
+ }
1114
+ return fs.cp(src, dest, { recursive: true, filter });
1115
+ };
1116
+ var cleanDir = async (dir, dry) => {
1117
+ if (dry) {
1118
+ console.log(`${chalk.blue("cleanDir")} ${dir}`);
1119
+ return Promise.resolve();
1120
+ }
1121
+ console.log(`
1122
+ \u{1F525} Cleaning dir ${chalk.red(`${dir.trim()}`)} `);
1123
+ return fs.rm(dir, { recursive: true, force: true });
1124
+ };
1125
+ var readFile = async (path2, dry) => {
1126
+ if (dry) {
1127
+ console.log(`${chalk.blue("readFile")} ${path2}`);
1128
+ return Promise.resolve("");
1129
+ }
1130
+ return fs.readFile(path2, "utf-8");
1131
+ };
1132
+
1133
+ // src/scripts/update-template.ts
1134
+ var DIRNAME = import.meta.dirname || __dirname;
1135
+ var SOURCE_FILES_PATH = path.join(DIRNAME, "../../../../design-tokens");
1136
+ var TEMPLATE_FILES_PATH = path.join(DIRNAME, "../tokens/template/design-tokens");
1137
+ var designTokensPath = (_path) => path.join(DIRNAME, "../../../../design-tokens", _path);
1138
+ var argsFromToPaths = (path_) => [
1139
+ path.join(SOURCE_FILES_PATH, path_),
1140
+ path.join(TEMPLATE_FILES_PATH, path_)
1141
+ ];
1142
+ var updateTemplates = async () => {
1143
+ await cleanDir(TEMPLATE_FILES_PATH);
1144
+ await cp(...argsFromToPaths("primitives/globals.json"));
1145
+ await cp(...argsFromToPaths("primitives/modes/size"));
1146
+ await cp(...argsFromToPaths("primitives/modes/typography/size"));
1147
+ await cp(...argsFromToPaths("semantic/style.json"));
1148
+ const digdirTypographyJson = await readFile(designTokensPath("primitives/modes/typography/primary/digdir.json"));
1149
+ const typographyTemplate = R.set(
1150
+ R.lensPath(["digdir", "font-family", "$value"]),
1151
+ "<font-family>",
1152
+ JSON.parse(digdirTypographyJson)
1153
+ );
1154
+ const typographyDir = path.join(TEMPLATE_FILES_PATH, "primitives/modes/typography/");
1155
+ await mkdir(typographyDir);
1156
+ await writeFile(
1157
+ path.join(typographyDir, "typography.template.json"),
1158
+ JSON.stringify(typographyTemplate, null, 2).replaceAll("digdir", "<theme>")
1159
+ );
1160
+ const categoryColorTemplate = accent_default.color.main;
1161
+ const categoryDir = path.join(TEMPLATE_FILES_PATH, "semantic/modes");
1162
+ await mkdir(categoryDir);
1163
+ await writeFile(
1164
+ path.join(categoryDir, "color.template.json"),
1165
+ JSON.stringify(categoryColorTemplate, null, 2).replaceAll("color.accent", "color.<color>")
1166
+ );
1167
+ const colorBaseFile = {
1168
+ ...color_default,
1169
+ // Remove custom colors as they are defined from by theme
1170
+ color: R.omit(["accent", "neutral", "brand1", "brand2", "brand3"], color_default.color)
1171
+ };
1172
+ await writeFile(
1173
+ path.join(TEMPLATE_FILES_PATH, `semantic/color.base.template.json`),
1174
+ JSON.stringify(colorBaseFile, null, 2)
1175
+ );
1176
+ const semanticColorTemplate = color_default.color.accent;
1177
+ await writeFile(
1178
+ path.join(TEMPLATE_FILES_PATH, `semantic/color.template.json`),
1179
+ JSON.stringify(semanticColorTemplate, null, 2).replaceAll("color.accent", "color.<color>")
1180
+ );
1181
+ const themeBaseFile = {
1182
+ color: {},
1183
+ ...R.omit(["color"], digdir_default)
1184
+ };
1185
+ await mkdir(path.join(TEMPLATE_FILES_PATH, "themes"));
1186
+ await writeFile(
1187
+ path.join(TEMPLATE_FILES_PATH, `themes/theme.base.template.json`),
1188
+ JSON.stringify(themeBaseFile, null, 2).replaceAll("digdir", "<theme>")
1189
+ );
1190
+ const themeColorTemplate = digdir_default.color.accent;
1191
+ await writeFile(
1192
+ path.join(TEMPLATE_FILES_PATH, `themes/theme.template.json`),
1193
+ JSON.stringify(themeColorTemplate, null, 2).replaceAll("digdir.accent", "<theme>.<color>")
1194
+ );
1195
+ console.log(chalk2.green("Templates updated"));
1196
+ };
1197
+ await updateTemplates();
1198
+ export {
1199
+ updateTemplates
1200
+ };