@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.
Files changed (190) hide show
  1. package/dist/bin/designsystemet.js +4264 -45
  2. package/dist/bin/options.js +5 -4
  3. package/dist/src/colors/colorMetadata.d.ts.map +1 -1
  4. package/dist/src/colors/colorMetadata.js +84 -35
  5. package/dist/src/colors/index.js +470 -4
  6. package/dist/src/colors/theme.d.ts.map +1 -1
  7. package/dist/src/colors/theme.js +290 -18
  8. package/dist/src/colors/types.d.ts +4 -1
  9. package/dist/src/colors/types.d.ts.map +1 -1
  10. package/dist/src/colors/utils.js +16 -15
  11. package/dist/{bin → src}/config.d.ts +46 -1
  12. package/dist/src/config.d.ts.map +1 -0
  13. package/dist/src/config.js +377 -0
  14. package/dist/src/index.js +3666 -2
  15. package/dist/src/migrations/beta-to-v1.js +85 -4
  16. package/dist/src/migrations/codemods/css/plugins.js +5 -4
  17. package/dist/src/migrations/codemods/css/run.d.ts.map +1 -1
  18. package/dist/src/migrations/codemods/css/run.js +18 -4
  19. package/dist/src/migrations/color-rename-next49.js +77 -6
  20. package/dist/src/migrations/index.d.ts +0 -1
  21. package/dist/src/migrations/index.d.ts.map +1 -1
  22. package/dist/src/migrations/index.js +461 -6
  23. package/dist/src/scripts/createJsonSchema.js +1608 -4
  24. package/dist/src/scripts/update-design-tokens.d.ts +2 -0
  25. package/dist/src/scripts/update-design-tokens.d.ts.map +1 -0
  26. package/dist/src/scripts/update-design-tokens.js +36 -0
  27. package/dist/src/{tokens/template.d.ts → scripts/update-template.d.ts} +1 -1
  28. package/dist/src/scripts/update-template.d.ts.map +1 -0
  29. package/dist/src/scripts/update-template.js +1200 -0
  30. package/dist/src/tokens/build.d.ts +2 -19
  31. package/dist/src/tokens/build.d.ts.map +1 -1
  32. package/dist/src/tokens/build.js +1511 -70
  33. package/dist/src/tokens/create/defaults.d.ts +7 -0
  34. package/dist/src/tokens/create/defaults.d.ts.map +1 -0
  35. package/dist/src/tokens/create/defaults.js +994 -0
  36. package/dist/src/tokens/create/generators/$designsystemet.d.ts +5 -0
  37. package/dist/src/tokens/create/generators/$designsystemet.d.ts.map +1 -0
  38. package/dist/src/tokens/create/generators/$designsystemet.js +100 -0
  39. package/dist/src/tokens/create/generators/$metadata.d.ts +8 -0
  40. package/dist/src/tokens/create/generators/$metadata.d.ts.map +1 -0
  41. package/dist/src/tokens/{write/generate$metadata.js → create/generators/$metadata.js} +3 -2
  42. package/dist/src/tokens/create/generators/$themes.d.ts +12 -0
  43. package/dist/src/tokens/create/generators/$themes.d.ts.map +1 -0
  44. package/dist/src/tokens/create/generators/$themes.js +333 -0
  45. package/dist/src/tokens/create/generators/color.d.ts +5 -0
  46. package/dist/src/tokens/create/generators/color.d.ts.map +1 -0
  47. package/dist/src/tokens/create/generators/color.js +374 -0
  48. package/dist/src/tokens/create/generators/semantic.d.ts +296 -0
  49. package/dist/src/tokens/create/generators/semantic.d.ts.map +1 -0
  50. package/dist/src/tokens/create/generators/semantic.js +483 -0
  51. package/dist/src/tokens/create/generators/theme.d.ts +3 -0
  52. package/dist/src/tokens/create/generators/theme.d.ts.map +1 -0
  53. package/dist/src/tokens/create/generators/theme.js +168 -0
  54. package/dist/src/tokens/create/generators/typography.d.ts +3 -0
  55. package/dist/src/tokens/create/generators/typography.d.ts.map +1 -0
  56. package/dist/src/tokens/create/generators/typography.js +33 -0
  57. package/dist/src/tokens/{write.d.ts → create/write.d.ts} +2 -2
  58. package/dist/src/tokens/create/write.d.ts.map +1 -0
  59. package/dist/src/tokens/create/write.js +546 -0
  60. package/dist/src/tokens/create.d.ts +4 -2
  61. package/dist/src/tokens/create.d.ts.map +1 -1
  62. package/dist/src/tokens/create.js +2049 -59
  63. package/dist/src/tokens/format.d.ts +16 -0
  64. package/dist/src/tokens/format.d.ts.map +1 -0
  65. package/dist/src/tokens/format.js +3514 -0
  66. package/dist/src/tokens/index.d.ts +1 -0
  67. package/dist/src/tokens/index.d.ts.map +1 -1
  68. package/dist/src/tokens/index.js +3526 -2
  69. package/dist/src/tokens/process/configs/color.d.ts +12 -0
  70. package/dist/src/tokens/process/configs/color.d.ts.map +1 -0
  71. package/dist/src/tokens/process/configs/color.js +823 -0
  72. package/dist/src/tokens/process/configs/semantic.d.ts +3 -0
  73. package/dist/src/tokens/process/configs/semantic.d.ts.map +1 -0
  74. package/dist/src/tokens/process/configs/semantic.js +367 -0
  75. package/dist/src/tokens/process/configs/shared.d.ts +10 -0
  76. package/dist/src/tokens/process/configs/shared.d.ts.map +1 -0
  77. package/dist/src/tokens/process/configs/shared.js +99 -0
  78. package/dist/src/tokens/process/configs/storefront.d.ts +3 -0
  79. package/dist/src/tokens/process/configs/storefront.d.ts.map +1 -0
  80. package/dist/src/tokens/process/configs/storefront.js +220 -0
  81. package/dist/src/tokens/process/configs/typography.d.ts +3 -0
  82. package/dist/src/tokens/process/configs/typography.d.ts.map +1 -0
  83. package/dist/src/tokens/process/configs/typography.js +369 -0
  84. package/dist/src/tokens/{build → process}/configs.d.ts +3 -11
  85. package/dist/src/tokens/process/configs.d.ts.map +1 -0
  86. package/dist/src/tokens/process/configs.js +976 -0
  87. package/dist/src/tokens/process/formats/css/color.d.ts +4 -0
  88. package/dist/src/tokens/process/formats/css/color.d.ts.map +1 -0
  89. package/dist/src/tokens/process/formats/css/color.js +128 -0
  90. package/dist/src/tokens/process/formats/css/semantic.d.ts +17 -0
  91. package/dist/src/tokens/process/formats/css/semantic.d.ts.map +1 -0
  92. package/dist/src/tokens/process/formats/css/semantic.js +109 -0
  93. package/dist/src/tokens/process/formats/css/typography.d.ts +3 -0
  94. package/dist/src/tokens/process/formats/css/typography.d.ts.map +1 -0
  95. package/dist/src/tokens/process/formats/css/typography.js +32 -0
  96. package/dist/src/tokens/process/formats/css.d.ts +8 -0
  97. package/dist/src/tokens/process/formats/css.d.ts.map +1 -0
  98. package/dist/src/tokens/{build → process}/formats/css.js +94 -57
  99. package/dist/src/tokens/process/formats/js-tokens.d.ts.map +1 -0
  100. package/dist/src/tokens/process/formats/js-tokens.js +109 -0
  101. package/dist/src/tokens/process/platform.d.ts +87 -0
  102. package/dist/src/tokens/process/platform.d.ts.map +1 -0
  103. package/dist/src/tokens/process/platform.js +1090 -0
  104. package/dist/src/tokens/process/transformers.d.ts.map +1 -0
  105. package/dist/src/tokens/{build → process}/transformers.js +29 -6
  106. package/dist/src/tokens/{build → process}/utils/getMultidimensionalThemes.d.ts +3 -3
  107. package/dist/src/tokens/process/utils/getMultidimensionalThemes.d.ts.map +1 -0
  108. package/dist/src/tokens/process/utils/getMultidimensionalThemes.js +922 -0
  109. package/dist/src/tokens/template/design-tokens/primitives/globals.js +5 -0
  110. package/dist/src/tokens/template/design-tokens/primitives/modes/size/global.js +5 -0
  111. package/dist/src/tokens/template/design-tokens/primitives/modes/size/large.js +5 -0
  112. package/dist/src/tokens/template/design-tokens/primitives/modes/size/medium.js +5 -0
  113. package/dist/src/tokens/template/design-tokens/primitives/modes/size/small.js +5 -0
  114. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/large.js +5 -0
  115. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/medium.js +5 -0
  116. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/size/small.js +5 -0
  117. package/dist/src/tokens/template/design-tokens/primitives/modes/typography/typography.template.js +5 -0
  118. package/dist/src/tokens/template/design-tokens/semantic/color.base.template.js +5 -0
  119. package/dist/src/tokens/template/design-tokens/semantic/color.template.js +5 -0
  120. package/dist/src/tokens/template/design-tokens/semantic/modes/color.template.js +5 -0
  121. package/dist/src/tokens/template/design-tokens/semantic/style.js +5 -0
  122. package/dist/src/tokens/template/design-tokens/themes/theme.base.template.js +5 -0
  123. package/dist/src/tokens/template/design-tokens/themes/theme.template.js +5 -0
  124. package/dist/src/tokens/types.d.ts +54 -38
  125. package/dist/src/tokens/types.d.ts.map +1 -1
  126. package/dist/src/tokens/types.js +8 -0
  127. package/dist/src/tokens/utils.d.ts +30 -5
  128. package/dist/src/tokens/utils.d.ts.map +1 -1
  129. package/dist/src/tokens/utils.js +36 -50
  130. package/dist/src/utils.d.ts +18 -0
  131. package/dist/src/utils.d.ts.map +1 -0
  132. package/dist/src/utils.js +63 -0
  133. package/dist/typography.template-4N5YLH7F.json +22 -0
  134. package/package.json +17 -16
  135. package/dist/bin/config.d.ts.map +0 -1
  136. package/dist/bin/config.js +0 -71
  137. package/dist/src/migrations/codemods/jsx/classname-prefix.d.ts +0 -10
  138. package/dist/src/migrations/codemods/jsx/classname-prefix.d.ts.map +0 -1
  139. package/dist/src/migrations/codemods/jsx/classname-prefix.js +0 -64
  140. package/dist/src/migrations/codemods/jsx/run.d.ts +0 -7
  141. package/dist/src/migrations/codemods/jsx/run.d.ts.map +0 -1
  142. package/dist/src/migrations/codemods/jsx/run.js +0 -22
  143. package/dist/src/migrations/react-beta-to-v1.d.ts +0 -3
  144. package/dist/src/migrations/react-beta-to-v1.d.ts.map +0 -1
  145. package/dist/src/migrations/react-beta-to-v1.js +0 -5
  146. package/dist/src/scripts/copy-internal-tokens.d.ts +0 -2
  147. package/dist/src/scripts/copy-internal-tokens.d.ts.map +0 -1
  148. package/dist/src/scripts/copy-internal-tokens.js +0 -28
  149. package/dist/src/tokens/build/configs.d.ts.map +0 -1
  150. package/dist/src/tokens/build/configs.js +0 -280
  151. package/dist/src/tokens/build/formats/css.d.ts +0 -53
  152. package/dist/src/tokens/build/formats/css.d.ts.map +0 -1
  153. package/dist/src/tokens/build/formats/js-tokens.d.ts.map +0 -1
  154. package/dist/src/tokens/build/formats/js-tokens.js +0 -48
  155. package/dist/src/tokens/build/transformers.d.ts.map +0 -1
  156. package/dist/src/tokens/build/types.d.ts +0 -48
  157. package/dist/src/tokens/build/types.d.ts.map +0 -1
  158. package/dist/src/tokens/build/types.js +0 -7
  159. package/dist/src/tokens/build/utils/entryfile.d.ts +0 -12
  160. package/dist/src/tokens/build/utils/entryfile.d.ts.map +0 -1
  161. package/dist/src/tokens/build/utils/entryfile.js +0 -67
  162. package/dist/src/tokens/build/utils/getMultidimensionalThemes.d.ts.map +0 -1
  163. package/dist/src/tokens/build/utils/getMultidimensionalThemes.js +0 -112
  164. package/dist/src/tokens/design-tokens/template/$metadata.json +0 -25
  165. package/dist/src/tokens/design-tokens/template/$themes.json +0 -1498
  166. package/dist/src/tokens/template.d.ts.map +0 -1
  167. package/dist/src/tokens/template.js +0 -99
  168. package/dist/src/tokens/write/generate$metadata.d.ts +0 -9
  169. package/dist/src/tokens/write/generate$metadata.d.ts.map +0 -1
  170. package/dist/src/tokens/write/generate$themes.d.ts +0 -12
  171. package/dist/src/tokens/write/generate$themes.d.ts.map +0 -1
  172. package/dist/src/tokens/write/generate$themes.js +0 -161
  173. package/dist/src/tokens/write.d.ts.map +0 -1
  174. package/dist/src/tokens/write.js +0 -177
  175. /package/dist/{src/tokens/design-tokens/template/semantic/color-base-file.json → color.base.template-M7BHS4OV.json} +0 -0
  176. /package/dist/{src/tokens/design-tokens/template/semantic/modes/category-color/category-color-template.json → color.template-LMPUQ72A.json} +0 -0
  177. /package/dist/{src/tokens/design-tokens/template/semantic/semantic-color-template.json → color.template-XQNSHLTU.json} +0 -0
  178. /package/dist/{src/tokens/design-tokens/default/primitives/modes/size/global.json → global-XVXVBKM6.json} +0 -0
  179. /package/dist/{src/tokens/design-tokens/default/primitives/globals.json → globals-76VAFMDF.json} +0 -0
  180. /package/dist/{src/tokens/design-tokens/default/primitives/modes/typography/size/large.json → large-CIIHO7AY.json} +0 -0
  181. /package/dist/{src/tokens/design-tokens/default/primitives/modes/size/large.json → large-UUOZ6DYI.json} +0 -0
  182. /package/dist/{src/tokens/design-tokens/default/primitives/modes/size/medium.json → medium-OQ7S7P4P.json} +0 -0
  183. /package/dist/{src/tokens/design-tokens/default/primitives/modes/typography/size/medium.json → medium-VSB2S4X3.json} +0 -0
  184. /package/dist/{src/tokens/design-tokens/default/primitives/modes/typography/size/small.json → small-AEXJ6U7Z.json} +0 -0
  185. /package/dist/{src/tokens/design-tokens/default/primitives/modes/size/small.json → small-ZY4KOJWX.json} +0 -0
  186. /package/dist/src/tokens/{build → process}/formats/js-tokens.d.ts +0 -0
  187. /package/dist/src/tokens/{build → process}/transformers.d.ts +0 -0
  188. /package/dist/{src/tokens/design-tokens/default/semantic/style.json → style-FP5XVCUD.json} +0 -0
  189. /package/dist/{src/tokens/design-tokens/template/themes/theme-base-file.json → theme.base.template-Y4RMFBQY.json} +0 -0
  190. /package/dist/{src/tokens/design-tokens/template/themes/theme-color-template.json → theme.template-CTQRNOMO.json} +0 -0
@@ -0,0 +1,3514 @@
1
+ // src/tokens/format.ts
2
+ import * as R19 from "ramda";
3
+ import chalk3 from "chalk";
4
+
5
+ // package.json
6
+ var package_default = {
7
+ name: "@digdir/designsystemet",
8
+ version: "1.0.4",
9
+ description: "CLI for Designsystemet",
10
+ author: "Designsystemet team",
11
+ engines: {
12
+ node: ">=22.14.0"
13
+ },
14
+ repository: {
15
+ type: "git",
16
+ url: "git+https://github.com/digdir/designsystemet.git"
17
+ },
18
+ homepage: "https://github.com/digdir/designsystemet/tree/main/scripts/cli",
19
+ license: "MIT",
20
+ type: "module",
21
+ main: "./dist/src/index.js",
22
+ files: [
23
+ "./dist/**"
24
+ ],
25
+ bin: "dist/bin/designsystemet.js",
26
+ exports: {
27
+ ".": {
28
+ import: "./dist/src/index.js"
29
+ },
30
+ "./color": {
31
+ import: "./dist/src/colors/index.js"
32
+ },
33
+ "./tokens": {
34
+ import: "./dist/src/tokens/index.js"
35
+ }
36
+ },
37
+ publishConfig: {
38
+ access: "public"
39
+ },
40
+ scripts: {
41
+ designsystemet: "tsx ./bin/designsystemet.ts",
42
+ "build:tokens": "yarn designsystemet tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
43
+ "build:tokens:debug": "tsx --inspect-brk ./bin/designsystemet.ts tokens build -p -t ../../design-tokens -o ../../packages/theme/brand --clean",
44
+ build: "tsup && yarn build:types && yarn build:json-schema",
45
+ "build:types": "tsc --emitDeclarationOnly --declaration",
46
+ "build:json-schema": "tsx ./src/scripts/createJsonSchema.ts",
47
+ types: "tsc --noEmit",
48
+ "test:tokens-create-options": "yarn designsystemet tokens create -m dominant:#007682 -n #003333 -b 99 -o ./test-tokens-create --theme options-test --clean",
49
+ "test:tokens-create-config": "yarn designsystemet tokens create --config ./test-tokens-create-complex.config.json",
50
+ "test:tokens-build": "yarn designsystemet tokens build -t ./test-tokens-create -o ./test-tokens-build --clean",
51
+ "test:tokens-create-and-build-options": "yarn test:tokens-create-options && yarn test:tokens-build",
52
+ "test:tokens-create-and-build-config": "yarn test:tokens-create-config && yarn test:tokens-build",
53
+ test: "yarn test:tokens-create-and-build-options && yarn test:tokens-create-and-build-config",
54
+ "internal:tokens-create": "yarn designsystemet tokens create --config ./internal.config.json",
55
+ "update:template": "tsx ./src/scripts/update-template.ts",
56
+ "update:design-tokens": "yarn internal:tokens-create && tsx ./src/scripts/update-design-tokens.ts",
57
+ verify: "yarn test && yarn update:template && yarn update:design-tokens"
58
+ },
59
+ dependencies: {
60
+ "@commander-js/extra-typings": "^13.1.0",
61
+ "@tokens-studio/sd-transforms": "1.2.12",
62
+ "apca-w3": "^0.1.9",
63
+ chalk: "^5.4.1",
64
+ "change-case": "^5.4.4",
65
+ "chroma-js": "^3.1.2",
66
+ commander: "^13.1.0",
67
+ "fast-glob": "^3.3.3",
68
+ hsluv: "^1.0.1",
69
+ "object-hash": "^3.0.0",
70
+ postcss: "^8.5.3",
71
+ ramda: "^0.30.1",
72
+ "style-dictionary": "^4.3.3",
73
+ zod: "^3.24.2",
74
+ "zod-validation-error": "^3.4.0"
75
+ },
76
+ devDependencies: {
77
+ "@types/apca-w3": "^0.1.3",
78
+ "@types/chroma-js": "^3.1.1",
79
+ "@types/fs-extra": "^11.0.4",
80
+ "@types/glob": "^8.1.0",
81
+ "@types/jscodeshift": "^0.12.0",
82
+ "@types/node": "^22.14.0",
83
+ "@types/object-hash": "^3.0.6",
84
+ "@types/ramda": "^0.30.2",
85
+ "fs-extra": "^11.3.0",
86
+ "ts-toolbelt": "^9.6.0",
87
+ tslib: "^2.8.1",
88
+ tsup: "^8.4.0",
89
+ tsx: "^4.19.3",
90
+ typescript: "^5.8.2",
91
+ "zod-to-json-schema": "^3.24.5"
92
+ }
93
+ };
94
+
95
+ // src/tokens/create/defaults.ts
96
+ import * as R from "ramda";
97
+
98
+ // src/tokens/template/design-tokens/primitives/globals.json with { type: 'json' }
99
+ var globals_default = {
100
+ "border-width": {
101
+ "1": {
102
+ $type: "borderWidth",
103
+ $value: "1px"
104
+ },
105
+ "3": {
106
+ $type: "borderWidth",
107
+ $value: "3px"
108
+ }
109
+ },
110
+ shadow: {
111
+ "100": {
112
+ $type: "boxShadow",
113
+ $value: [
114
+ {
115
+ color: "rgba(0,0,0,0.16)",
116
+ x: "0",
117
+ y: "0",
118
+ blur: "1",
119
+ spread: "0"
120
+ },
121
+ {
122
+ x: "0",
123
+ y: "1",
124
+ blur: "2",
125
+ spread: "0",
126
+ color: "rgba(0,0,0,0.12)"
127
+ }
128
+ ]
129
+ },
130
+ "200": {
131
+ $type: "boxShadow",
132
+ $value: [
133
+ {
134
+ color: "rgba(0,0,0,0.15)",
135
+ x: "0",
136
+ y: "0",
137
+ blur: "1",
138
+ spread: "0"
139
+ },
140
+ {
141
+ color: "rgba(0,0,0,0.12)",
142
+ x: "0",
143
+ y: "1",
144
+ blur: "2",
145
+ spread: "0"
146
+ },
147
+ {
148
+ x: "0",
149
+ y: "2",
150
+ blur: "4",
151
+ spread: "0",
152
+ color: "rgba(0,0,0,0.1)"
153
+ }
154
+ ]
155
+ },
156
+ "300": {
157
+ $type: "boxShadow",
158
+ $value: [
159
+ {
160
+ color: "rgba(0,0,0,0.14)",
161
+ x: "0",
162
+ y: "0",
163
+ blur: "1",
164
+ spread: "0"
165
+ },
166
+ {
167
+ color: "rgba(0,0,0,0.12)",
168
+ x: "0",
169
+ y: "2",
170
+ blur: "4",
171
+ spread: "0"
172
+ },
173
+ {
174
+ x: "0",
175
+ y: "4",
176
+ blur: "8",
177
+ spread: "0",
178
+ color: "rgba(0,0,0,0.12)"
179
+ }
180
+ ]
181
+ },
182
+ "400": {
183
+ $type: "boxShadow",
184
+ $value: [
185
+ {
186
+ color: "rgba(0,0,0,0.13)",
187
+ x: "0",
188
+ y: "0",
189
+ blur: "1",
190
+ spread: "0"
191
+ },
192
+ {
193
+ color: "rgba(0,0,0,0.13)",
194
+ x: "0",
195
+ y: "3",
196
+ blur: "5",
197
+ spread: "0"
198
+ },
199
+ {
200
+ x: "0",
201
+ y: "6",
202
+ blur: "12",
203
+ spread: "0",
204
+ color: "rgba(0,0,0,0.14)"
205
+ }
206
+ ]
207
+ },
208
+ "500": {
209
+ $type: "boxShadow",
210
+ $value: [
211
+ {
212
+ color: "rgba(0,0,0,0.12)",
213
+ x: "0",
214
+ y: "0",
215
+ blur: "1",
216
+ spread: "0"
217
+ },
218
+ {
219
+ color: "rgba(0,0,0,0.16)",
220
+ x: "0",
221
+ y: "4",
222
+ blur: "8",
223
+ spread: "0"
224
+ },
225
+ {
226
+ x: "0",
227
+ y: "12",
228
+ blur: "24",
229
+ spread: "0",
230
+ color: "rgba(0,0,0,0.16)"
231
+ }
232
+ ]
233
+ }
234
+ },
235
+ opacity: {
236
+ "30": {
237
+ $type: "opacity",
238
+ $value: "30%"
239
+ }
240
+ }
241
+ };
242
+
243
+ // src/tokens/template/design-tokens/primitives/modes/size/global.json with { type: 'json' }
244
+ var global_default = {
245
+ _size: {
246
+ "0": {
247
+ $type: "dimension",
248
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *0)"
249
+ },
250
+ "1": {
251
+ $type: "dimension",
252
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *1)"
253
+ },
254
+ "2": {
255
+ $type: "dimension",
256
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *2)"
257
+ },
258
+ "3": {
259
+ $type: "dimension",
260
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *3)"
261
+ },
262
+ "4": {
263
+ $type: "dimension",
264
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *4)"
265
+ },
266
+ "5": {
267
+ $type: "dimension",
268
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *5)"
269
+ },
270
+ "6": {
271
+ $type: "dimension",
272
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *6)"
273
+ },
274
+ "7": {
275
+ $type: "dimension",
276
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *7)"
277
+ },
278
+ "8": {
279
+ $type: "dimension",
280
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *8)"
281
+ },
282
+ "9": {
283
+ $type: "dimension",
284
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *9)"
285
+ },
286
+ "10": {
287
+ $type: "dimension",
288
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *10)"
289
+ },
290
+ "11": {
291
+ $type: "dimension",
292
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *11)"
293
+ },
294
+ "12": {
295
+ $type: "dimension",
296
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *12)"
297
+ },
298
+ "13": {
299
+ $type: "dimension",
300
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *13)"
301
+ },
302
+ "14": {
303
+ $type: "dimension",
304
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *14)"
305
+ },
306
+ "15": {
307
+ $type: "dimension",
308
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *15)"
309
+ },
310
+ "18": {
311
+ $type: "dimension",
312
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *18)"
313
+ },
314
+ "22": {
315
+ $type: "dimension",
316
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *22)"
317
+ },
318
+ "26": {
319
+ $type: "dimension",
320
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *26)"
321
+ },
322
+ "30": {
323
+ $type: "dimension",
324
+ $value: "floor({_size.step} / {_size.base} * {_size.mode-font-size} *30)"
325
+ },
326
+ "mode-font-size": {
327
+ $type: "dimension",
328
+ $value: "{size._mode-font-size}"
329
+ },
330
+ base: {
331
+ $type: "dimension",
332
+ $value: "{size._base}"
333
+ },
334
+ step: {
335
+ $type: "dimension",
336
+ $value: "{size._step}"
337
+ }
338
+ }
339
+ };
340
+
341
+ // src/tokens/template/design-tokens/primitives/modes/size/large.json with { type: 'json' }
342
+ var large_default = {
343
+ size: {
344
+ "_mode-font-size": {
345
+ $type: "dimension",
346
+ $value: "21"
347
+ },
348
+ _base: {
349
+ $type: "dimension",
350
+ $value: "18"
351
+ },
352
+ _step: {
353
+ $type: "dimension",
354
+ $value: "4"
355
+ }
356
+ }
357
+ };
358
+
359
+ // src/tokens/template/design-tokens/primitives/modes/size/medium.json with { type: 'json' }
360
+ var medium_default = {
361
+ size: {
362
+ "_mode-font-size": {
363
+ $type: "dimension",
364
+ $value: "18"
365
+ },
366
+ _base: {
367
+ $type: "dimension",
368
+ $value: "18"
369
+ },
370
+ _step: {
371
+ $type: "dimension",
372
+ $value: "4"
373
+ }
374
+ }
375
+ };
376
+
377
+ // src/tokens/template/design-tokens/primitives/modes/size/small.json with { type: 'json' }
378
+ var small_default = {
379
+ size: {
380
+ "_mode-font-size": {
381
+ $type: "dimension",
382
+ $value: "16"
383
+ },
384
+ _base: {
385
+ $type: "dimension",
386
+ $value: "18"
387
+ },
388
+ _step: {
389
+ $type: "dimension",
390
+ $value: "4"
391
+ }
392
+ }
393
+ };
394
+
395
+ // src/tokens/template/design-tokens/primitives/modes/typography/size/large.json with { type: 'json' }
396
+ var large_default2 = {
397
+ "line-height": {
398
+ sm: {
399
+ $type: "lineHeights",
400
+ $value: "130%"
401
+ },
402
+ md: {
403
+ $type: "lineHeights",
404
+ $value: "150%"
405
+ },
406
+ lg: {
407
+ $type: "lineHeights",
408
+ $value: "170%"
409
+ }
410
+ },
411
+ "font-size": {
412
+ "1": {
413
+ $type: "fontSizes",
414
+ $value: "13"
415
+ },
416
+ "2": {
417
+ $type: "fontSizes",
418
+ $value: "16"
419
+ },
420
+ "3": {
421
+ $type: "fontSizes",
422
+ $value: "18"
423
+ },
424
+ "4": {
425
+ $type: "fontSizes",
426
+ $value: "21"
427
+ },
428
+ "5": {
429
+ $type: "fontSizes",
430
+ $value: "24"
431
+ },
432
+ "6": {
433
+ $type: "fontSizes",
434
+ $value: "30"
435
+ },
436
+ "7": {
437
+ $type: "fontSizes",
438
+ $value: "36"
439
+ },
440
+ "8": {
441
+ $type: "fontSizes",
442
+ $value: "48"
443
+ },
444
+ "9": {
445
+ $type: "fontSizes",
446
+ $value: "60"
447
+ },
448
+ "10": {
449
+ $type: "fontSizes",
450
+ $value: "72"
451
+ }
452
+ },
453
+ "letter-spacing": {
454
+ "1": {
455
+ $type: "letterSpacing",
456
+ $value: "-1%"
457
+ },
458
+ "2": {
459
+ $type: "letterSpacing",
460
+ $value: "-0.5%"
461
+ },
462
+ "3": {
463
+ $type: "letterSpacing",
464
+ $value: "-0.25%"
465
+ },
466
+ "4": {
467
+ $type: "letterSpacing",
468
+ $value: "-0.15%"
469
+ },
470
+ "5": {
471
+ $type: "letterSpacing",
472
+ $value: "0%"
473
+ },
474
+ "6": {
475
+ $type: "letterSpacing",
476
+ $value: "0.15%"
477
+ },
478
+ "7": {
479
+ $type: "letterSpacing",
480
+ $value: "0.25%"
481
+ },
482
+ "8": {
483
+ $type: "letterSpacing",
484
+ $value: "0.5%"
485
+ },
486
+ "9": {
487
+ $type: "letterSpacing",
488
+ $value: "1.5%"
489
+ }
490
+ }
491
+ };
492
+
493
+ // src/tokens/template/design-tokens/primitives/modes/typography/size/medium.json with { type: 'json' }
494
+ var medium_default2 = {
495
+ "line-height": {
496
+ sm: {
497
+ $type: "lineHeights",
498
+ $value: "130%"
499
+ },
500
+ md: {
501
+ $type: "lineHeights",
502
+ $value: "150%"
503
+ },
504
+ lg: {
505
+ $type: "lineHeights",
506
+ $value: "170%"
507
+ }
508
+ },
509
+ "font-size": {
510
+ "1": {
511
+ $type: "fontSizes",
512
+ $value: "12"
513
+ },
514
+ "2": {
515
+ $type: "fontSizes",
516
+ $value: "14"
517
+ },
518
+ "3": {
519
+ $type: "fontSizes",
520
+ $value: "16"
521
+ },
522
+ "4": {
523
+ $type: "fontSizes",
524
+ $value: "18"
525
+ },
526
+ "5": {
527
+ $type: "fontSizes",
528
+ $value: "21"
529
+ },
530
+ "6": {
531
+ $type: "fontSizes",
532
+ $value: "24"
533
+ },
534
+ "7": {
535
+ $type: "fontSizes",
536
+ $value: "30"
537
+ },
538
+ "8": {
539
+ $type: "fontSizes",
540
+ $value: "36"
541
+ },
542
+ "9": {
543
+ $type: "fontSizes",
544
+ $value: "48"
545
+ },
546
+ "10": {
547
+ $type: "fontSizes",
548
+ $value: "60"
549
+ }
550
+ },
551
+ "letter-spacing": {
552
+ "1": {
553
+ $type: "letterSpacing",
554
+ $value: "-1%"
555
+ },
556
+ "2": {
557
+ $type: "letterSpacing",
558
+ $value: "-0.5%"
559
+ },
560
+ "3": {
561
+ $type: "letterSpacing",
562
+ $value: "-0.25%"
563
+ },
564
+ "4": {
565
+ $type: "letterSpacing",
566
+ $value: "-0.15%"
567
+ },
568
+ "5": {
569
+ $type: "letterSpacing",
570
+ $value: "0%"
571
+ },
572
+ "6": {
573
+ $type: "letterSpacing",
574
+ $value: "0.15%"
575
+ },
576
+ "7": {
577
+ $type: "letterSpacing",
578
+ $value: "0.25%"
579
+ },
580
+ "8": {
581
+ $type: "letterSpacing",
582
+ $value: "0.5%"
583
+ },
584
+ "9": {
585
+ $type: "letterSpacing",
586
+ $value: "1.5%"
587
+ }
588
+ }
589
+ };
590
+
591
+ // src/tokens/template/design-tokens/primitives/modes/typography/size/small.json with { type: 'json' }
592
+ var small_default2 = {
593
+ "line-height": {
594
+ sm: {
595
+ $type: "lineHeights",
596
+ $value: "130%"
597
+ },
598
+ md: {
599
+ $type: "lineHeights",
600
+ $value: "150%"
601
+ },
602
+ lg: {
603
+ $type: "lineHeights",
604
+ $value: "170%"
605
+ }
606
+ },
607
+ "font-size": {
608
+ "1": {
609
+ $type: "fontSizes",
610
+ $value: "11"
611
+ },
612
+ "2": {
613
+ $type: "fontSizes",
614
+ $value: "13"
615
+ },
616
+ "3": {
617
+ $type: "fontSizes",
618
+ $value: "14"
619
+ },
620
+ "4": {
621
+ $type: "fontSizes",
622
+ $value: "16"
623
+ },
624
+ "5": {
625
+ $type: "fontSizes",
626
+ $value: "18"
627
+ },
628
+ "6": {
629
+ $type: "fontSizes",
630
+ $value: "21"
631
+ },
632
+ "7": {
633
+ $type: "fontSizes",
634
+ $value: "24"
635
+ },
636
+ "8": {
637
+ $type: "fontSizes",
638
+ $value: "30"
639
+ },
640
+ "9": {
641
+ $type: "fontSizes",
642
+ $value: "36"
643
+ },
644
+ "10": {
645
+ $type: "fontSizes",
646
+ $value: "48"
647
+ }
648
+ },
649
+ "letter-spacing": {
650
+ "1": {
651
+ $type: "letterSpacing",
652
+ $value: "-1%"
653
+ },
654
+ "2": {
655
+ $type: "letterSpacing",
656
+ $value: "-0.5%"
657
+ },
658
+ "3": {
659
+ $type: "letterSpacing",
660
+ $value: "-0.25%"
661
+ },
662
+ "4": {
663
+ $type: "letterSpacing",
664
+ $value: "-0.15%"
665
+ },
666
+ "5": {
667
+ $type: "letterSpacing",
668
+ $value: "0%"
669
+ },
670
+ "6": {
671
+ $type: "letterSpacing",
672
+ $value: "0.15%"
673
+ },
674
+ "7": {
675
+ $type: "letterSpacing",
676
+ $value: "0.25%"
677
+ },
678
+ "8": {
679
+ $type: "letterSpacing",
680
+ $value: "0.5%"
681
+ },
682
+ "9": {
683
+ $type: "letterSpacing",
684
+ $value: "1.5%"
685
+ }
686
+ }
687
+ };
688
+
689
+ // src/tokens/template/design-tokens/semantic/style.json with { type: 'json' }
690
+ var style_default = {
691
+ typography: {
692
+ heading: {
693
+ "2xl": {
694
+ $type: "typography",
695
+ $value: {
696
+ fontFamily: "{font-family}",
697
+ fontWeight: "{font-weight.medium}",
698
+ lineHeight: "{line-height.sm}",
699
+ fontSize: "{font-size.10}",
700
+ letterSpacing: "{letter-spacing.1}"
701
+ }
702
+ },
703
+ xl: {
704
+ $type: "typography",
705
+ $value: {
706
+ fontFamily: "{font-family}",
707
+ fontWeight: "{font-weight.medium}",
708
+ lineHeight: "{line-height.sm}",
709
+ fontSize: "{font-size.9}",
710
+ letterSpacing: "{letter-spacing.1}"
711
+ }
712
+ },
713
+ lg: {
714
+ $type: "typography",
715
+ $value: {
716
+ fontFamily: "{font-family}",
717
+ fontWeight: "{font-weight.medium}",
718
+ lineHeight: "{line-height.sm}",
719
+ fontSize: "{font-size.8}",
720
+ letterSpacing: "{letter-spacing.2}"
721
+ }
722
+ },
723
+ md: {
724
+ $type: "typography",
725
+ $value: {
726
+ fontFamily: "{font-family}",
727
+ fontWeight: "{font-weight.medium}",
728
+ lineHeight: "{line-height.sm}",
729
+ fontSize: "{font-size.7}",
730
+ letterSpacing: "{letter-spacing.3}"
731
+ }
732
+ },
733
+ sm: {
734
+ $type: "typography",
735
+ $value: {
736
+ fontFamily: "{font-family}",
737
+ fontWeight: "{font-weight.medium}",
738
+ lineHeight: "{line-height.sm}",
739
+ fontSize: "{font-size.6}",
740
+ letterSpacing: "{letter-spacing.5}"
741
+ }
742
+ },
743
+ xs: {
744
+ $type: "typography",
745
+ $value: {
746
+ fontFamily: "{font-family}",
747
+ fontWeight: "{font-weight.medium}",
748
+ lineHeight: "{line-height.sm}",
749
+ fontSize: "{font-size.5}",
750
+ letterSpacing: "{letter-spacing.6}"
751
+ }
752
+ },
753
+ "2xs": {
754
+ $type: "typography",
755
+ $value: {
756
+ fontFamily: "{font-family}",
757
+ fontWeight: "{font-weight.medium}",
758
+ lineHeight: "{line-height.sm}",
759
+ fontSize: "{font-size.4}",
760
+ letterSpacing: "{letter-spacing.6}"
761
+ }
762
+ }
763
+ },
764
+ body: {
765
+ xl: {
766
+ $type: "typography",
767
+ $value: {
768
+ fontFamily: "{font-family}",
769
+ fontWeight: "{font-weight.regular}",
770
+ lineHeight: "{line-height.md}",
771
+ fontSize: "{font-size.6}",
772
+ letterSpacing: "{letter-spacing.8}"
773
+ }
774
+ },
775
+ lg: {
776
+ $type: "typography",
777
+ $value: {
778
+ fontFamily: "{font-family}",
779
+ fontWeight: "{font-weight.regular}",
780
+ lineHeight: "{line-height.md}",
781
+ fontSize: "{font-size.5}",
782
+ letterSpacing: "{letter-spacing.8}"
783
+ }
784
+ },
785
+ md: {
786
+ $type: "typography",
787
+ $value: {
788
+ fontFamily: "{font-family}",
789
+ fontWeight: "{font-weight.regular}",
790
+ lineHeight: "{line-height.md}",
791
+ fontSize: "{font-size.4}",
792
+ letterSpacing: "{letter-spacing.8}"
793
+ }
794
+ },
795
+ sm: {
796
+ $type: "typography",
797
+ $value: {
798
+ fontFamily: "{font-family}",
799
+ fontWeight: "{font-weight.regular}",
800
+ lineHeight: "{line-height.md}",
801
+ fontSize: "{font-size.3}",
802
+ letterSpacing: "{letter-spacing.7}"
803
+ }
804
+ },
805
+ xs: {
806
+ $type: "typography",
807
+ $value: {
808
+ fontFamily: "{font-family}",
809
+ fontWeight: "{font-weight.regular}",
810
+ lineHeight: "{line-height.md}",
811
+ fontSize: "{font-size.2}",
812
+ letterSpacing: "{letter-spacing.6}"
813
+ }
814
+ },
815
+ short: {
816
+ xl: {
817
+ $type: "typography",
818
+ $value: {
819
+ fontFamily: "{font-family}",
820
+ fontWeight: "{font-weight.regular}",
821
+ lineHeight: "{line-height.sm}",
822
+ fontSize: "{font-size.6}",
823
+ letterSpacing: "{letter-spacing.8}"
824
+ }
825
+ },
826
+ lg: {
827
+ $type: "typography",
828
+ $value: {
829
+ fontFamily: "{font-family}",
830
+ fontWeight: "{font-weight.regular}",
831
+ lineHeight: "{line-height.sm}",
832
+ fontSize: "{font-size.5}",
833
+ letterSpacing: "{letter-spacing.8}"
834
+ }
835
+ },
836
+ md: {
837
+ $type: "typography",
838
+ $value: {
839
+ fontFamily: "{font-family}",
840
+ fontWeight: "{font-weight.regular}",
841
+ lineHeight: "{line-height.sm}",
842
+ fontSize: "{font-size.4}",
843
+ letterSpacing: "{letter-spacing.8}"
844
+ }
845
+ },
846
+ sm: {
847
+ $type: "typography",
848
+ $value: {
849
+ fontFamily: "{font-family}",
850
+ fontWeight: "{font-weight.regular}",
851
+ lineHeight: "{line-height.sm}",
852
+ fontSize: "{font-size.3}",
853
+ letterSpacing: "{letter-spacing.7}"
854
+ }
855
+ },
856
+ xs: {
857
+ $type: "typography",
858
+ $value: {
859
+ fontFamily: "{font-family}",
860
+ fontWeight: "{font-weight.regular}",
861
+ lineHeight: "{line-height.sm}",
862
+ fontSize: "{font-size.2}",
863
+ letterSpacing: "{letter-spacing.6}"
864
+ }
865
+ }
866
+ },
867
+ long: {
868
+ xl: {
869
+ $type: "typography",
870
+ $value: {
871
+ fontFamily: "{font-family}",
872
+ fontWeight: "{font-weight.regular}",
873
+ lineHeight: "{line-height.lg}",
874
+ fontSize: "{font-size.6}",
875
+ letterSpacing: "{letter-spacing.8}"
876
+ }
877
+ },
878
+ lg: {
879
+ $type: "typography",
880
+ $value: {
881
+ fontFamily: "{font-family}",
882
+ fontWeight: "{font-weight.regular}",
883
+ lineHeight: "{line-height.lg}",
884
+ fontSize: "{font-size.5}",
885
+ letterSpacing: "{letter-spacing.8}"
886
+ }
887
+ },
888
+ md: {
889
+ $type: "typography",
890
+ $value: {
891
+ fontFamily: "{font-family}",
892
+ fontWeight: "{font-weight.regular}",
893
+ lineHeight: "{line-height.lg}",
894
+ fontSize: "{font-size.4}",
895
+ letterSpacing: "{letter-spacing.8}"
896
+ }
897
+ },
898
+ sm: {
899
+ $type: "typography",
900
+ $value: {
901
+ fontFamily: "{font-family}",
902
+ fontWeight: "{font-weight.regular}",
903
+ lineHeight: "{line-height.lg}",
904
+ fontSize: "{font-size.3}",
905
+ letterSpacing: "{letter-spacing.7}"
906
+ }
907
+ },
908
+ xs: {
909
+ $type: "typography",
910
+ $value: {
911
+ fontFamily: "{font-family}",
912
+ fontWeight: "{font-weight.regular}",
913
+ lineHeight: "{line-height.lg}",
914
+ fontSize: "{font-size.2}",
915
+ letterSpacing: "{letter-spacing.6}"
916
+ }
917
+ }
918
+ }
919
+ }
920
+ },
921
+ opacity: {
922
+ disabled: {
923
+ $type: "opacity",
924
+ $value: "{opacity.30}"
925
+ }
926
+ },
927
+ "border-width": {
928
+ default: {
929
+ $type: "borderWidth",
930
+ $value: "{border-width.1}"
931
+ },
932
+ focus: {
933
+ $type: "borderWidth",
934
+ $value: "{border-width.3}"
935
+ }
936
+ },
937
+ shadow: {
938
+ xs: {
939
+ $type: "boxShadow",
940
+ $value: "{shadow.100}"
941
+ },
942
+ sm: {
943
+ $type: "boxShadow",
944
+ $value: "{shadow.200}"
945
+ },
946
+ md: {
947
+ $type: "boxShadow",
948
+ $value: "{shadow.300}"
949
+ },
950
+ lg: {
951
+ $type: "boxShadow",
952
+ $value: "{shadow.400}"
953
+ },
954
+ xl: {
955
+ $type: "boxShadow",
956
+ $value: "{shadow.500}"
957
+ }
958
+ },
959
+ "border-radius": {
960
+ sm: {
961
+ $type: "dimension",
962
+ $value: "{border-radius.1}"
963
+ },
964
+ md: {
965
+ $type: "dimension",
966
+ $value: "{border-radius.2}"
967
+ },
968
+ lg: {
969
+ $type: "dimension",
970
+ $value: "{border-radius.3}"
971
+ },
972
+ xl: {
973
+ $type: "dimension",
974
+ $value: "{border-radius.4}"
975
+ },
976
+ default: {
977
+ $type: "dimension",
978
+ $value: "{border-radius.5}"
979
+ },
980
+ full: {
981
+ $type: "dimension",
982
+ $value: "{border-radius.6}"
983
+ }
984
+ },
985
+ size: {
986
+ "0": {
987
+ $type: "dimension",
988
+ $value: "{_size.0}"
989
+ },
990
+ "1": {
991
+ $type: "dimension",
992
+ $value: "{_size.1}"
993
+ },
994
+ "2": {
995
+ $type: "dimension",
996
+ $value: "{_size.2}"
997
+ },
998
+ "3": {
999
+ $type: "dimension",
1000
+ $value: "{_size.3}"
1001
+ },
1002
+ "4": {
1003
+ $type: "dimension",
1004
+ $value: "{_size.4}"
1005
+ },
1006
+ "5": {
1007
+ $type: "dimension",
1008
+ $value: "{_size.5}"
1009
+ },
1010
+ "6": {
1011
+ $type: "dimension",
1012
+ $value: "{_size.6}"
1013
+ },
1014
+ "7": {
1015
+ $type: "dimension",
1016
+ $value: "{_size.7}"
1017
+ },
1018
+ "8": {
1019
+ $type: "dimension",
1020
+ $value: "{_size.8}"
1021
+ },
1022
+ "9": {
1023
+ $type: "dimension",
1024
+ $value: "{_size.9}"
1025
+ },
1026
+ "10": {
1027
+ $type: "dimension",
1028
+ $value: "{_size.10}"
1029
+ },
1030
+ "11": {
1031
+ $type: "dimension",
1032
+ $value: "{_size.11}"
1033
+ },
1034
+ "12": {
1035
+ $type: "dimension",
1036
+ $value: "{_size.12}"
1037
+ },
1038
+ "13": {
1039
+ $type: "dimension",
1040
+ $value: "{_size.13}"
1041
+ },
1042
+ "14": {
1043
+ $type: "dimension",
1044
+ $value: "{_size.14}"
1045
+ },
1046
+ "15": {
1047
+ $type: "dimension",
1048
+ $value: "{_size.15}"
1049
+ },
1050
+ "18": {
1051
+ $type: "dimension",
1052
+ $value: "{_size.18}"
1053
+ },
1054
+ "22": {
1055
+ $type: "dimension",
1056
+ $value: "{_size.22}"
1057
+ },
1058
+ "26": {
1059
+ $type: "dimension",
1060
+ $value: "{_size.26}"
1061
+ },
1062
+ "30": {
1063
+ $type: "dimension",
1064
+ $value: "{_size.30}"
1065
+ }
1066
+ }
1067
+ };
1068
+
1069
+ // src/tokens/create/defaults.ts
1070
+ var defaultTokens = {
1071
+ "primitives/globals": globals_default,
1072
+ "primitives/modes/size/small": small_default,
1073
+ "primitives/modes/size/medium": medium_default,
1074
+ "primitives/modes/size/large": large_default,
1075
+ "primitives/modes/size/global": global_default,
1076
+ "primitives/modes/typography/size/small": small_default2,
1077
+ "primitives/modes/typography/size/medium": medium_default2,
1078
+ "primitives/modes/typography/size/large": large_default2,
1079
+ "semantic/style": style_default
1080
+ };
1081
+ var getDefaultTokens = (tokenSets) => Object.entries(R.pick(tokenSets, defaultTokens));
1082
+ var getDefaultToken = (tokenPath) => {
1083
+ return [tokenPath, defaultTokens[tokenPath]];
1084
+ };
1085
+
1086
+ // src/tokens/create/generators/color.ts
1087
+ import * as R4 from "ramda";
1088
+
1089
+ // src/colors/utils.ts
1090
+ import chroma from "chroma-js";
1091
+ import { Hsluv } from "hsluv";
1092
+ var getLuminanceFromLightness = (lightness) => {
1093
+ const conv = new Hsluv();
1094
+ conv.hsluv_l = lightness;
1095
+ conv.hsluvToHex();
1096
+ return chroma(conv.hex).luminance();
1097
+ };
1098
+ var getLightnessFromHex = (hex) => {
1099
+ const conv = new Hsluv();
1100
+ conv.hex = hex;
1101
+ conv.hexToHsluv();
1102
+ return conv.hsluv_l;
1103
+ };
1104
+
1105
+ // src/colors/theme.ts
1106
+ import chroma2 from "chroma-js";
1107
+ import * as R3 from "ramda";
1108
+
1109
+ // src/colors/colorMetadata.ts
1110
+ import * as R2 from "ramda";
1111
+ var baseColors = {
1112
+ blue: "#0A71C0",
1113
+ green: "#068718",
1114
+ orange: "#EA9B1B",
1115
+ purple: "#663299",
1116
+ red: "#C01B1B"
1117
+ };
1118
+ var colorMetadata = {
1119
+ "background-default": {
1120
+ number: 1,
1121
+ name: "background-default",
1122
+ group: "background",
1123
+ displayName: "Background Default",
1124
+ description: {
1125
+ long: "Background Default er den mest n\xF8ytrale bakgrunnsfargen.",
1126
+ short: "Standard bakgrunnsfarge."
1127
+ },
1128
+ luminance: {
1129
+ light: 1,
1130
+ dark: 9e-3,
1131
+ contrast: 1e-3
1132
+ }
1133
+ },
1134
+ "background-tinted": {
1135
+ number: 2,
1136
+ name: "background-tinted",
1137
+ group: "background",
1138
+ displayName: "Background Tinted",
1139
+ description: {
1140
+ long: "Background Tinted er en bakgrunnsfarge som har et hint av farge i seg.",
1141
+ short: "Bakgrunn med et hint av farge i seg."
1142
+ },
1143
+ luminance: {
1144
+ light: 0.9,
1145
+ dark: 0.014,
1146
+ contrast: 65e-4
1147
+ }
1148
+ },
1149
+ "surface-default": {
1150
+ number: 3,
1151
+ name: "surface-default",
1152
+ group: "surface",
1153
+ displayName: "Surface Default",
1154
+ description: {
1155
+ long: "Surface Default brukes p\xE5 flater som ligger opp\xE5 bakgrunnsfargene. Dette er den mest n\xF8ytrale surface fargen.",
1156
+ short: "Standardfarge for overflater / komponenter."
1157
+ },
1158
+ luminance: {
1159
+ light: 1,
1160
+ dark: 0.021,
1161
+ contrast: 0.015
1162
+ }
1163
+ },
1164
+ "surface-tinted": {
1165
+ number: 4,
1166
+ name: "surface-tinted",
1167
+ group: "surface",
1168
+ displayName: "Surface Tinted",
1169
+ description: {
1170
+ long: "Surface Tinted brukes p\xE5 flater som ligger opp\xE5 bakgrunnsfargene. Denne har et hint av farge i seg.",
1171
+ short: "Overflater / komponenter med et hint av farge i seg."
1172
+ },
1173
+ luminance: {
1174
+ light: 0.81,
1175
+ dark: 0.027,
1176
+ contrast: 0.015
1177
+ }
1178
+ },
1179
+ "surface-hover": {
1180
+ number: 5,
1181
+ name: "surface-hover",
1182
+ group: "surface",
1183
+ displayName: "Surface Hover",
1184
+ description: {
1185
+ long: "Surface Hover brukes p\xE5 interaktive flater som ligger opp\xE5 bakgrunnsfargene i en hover state.",
1186
+ short: "Hover-farge til overflater / komponenter."
1187
+ },
1188
+ luminance: {
1189
+ light: 0.7,
1190
+ dark: 0.036,
1191
+ contrast: 0.028
1192
+ }
1193
+ },
1194
+ "surface-active": {
1195
+ number: 6,
1196
+ name: "surface-active",
1197
+ group: "surface",
1198
+ displayName: "Surface Active",
1199
+ description: {
1200
+ long: "Surface Active brukes p\xE5 interaktive flater som ligger opp\xE5 bakgrunnsfargene i en active state.",
1201
+ short: "Active-farge til overflater / komponenter."
1202
+ },
1203
+ luminance: {
1204
+ light: 0.59,
1205
+ dark: 0.056,
1206
+ contrast: 0.045
1207
+ }
1208
+ },
1209
+ "border-subtle": {
1210
+ number: 7,
1211
+ name: "border-subtle",
1212
+ group: "border",
1213
+ displayName: "Border Subtle",
1214
+ description: {
1215
+ long: "Border Subtle er den lyseste border-fargen og brukes for \xE5 skille elementer fra hverandre.",
1216
+ short: "Border-farge med lav kontrast til dekorativ bruk (skillelinjer)."
1217
+ },
1218
+ luminance: {
1219
+ light: 0.5,
1220
+ dark: 0.08,
1221
+ contrast: 0.26
1222
+ }
1223
+ },
1224
+ "border-default": {
1225
+ number: 8,
1226
+ name: "border-default",
1227
+ group: "border",
1228
+ displayName: "Border Default",
1229
+ description: {
1230
+ long: "Border Default er en border-farge som brukes n\xE5r man \xF8nsker god kontrast mot bakgrunnsfargene.",
1231
+ short: "Standard border-farge til skjemakomponenter og meningsb\xE6rende elementer."
1232
+ },
1233
+ luminance: {
1234
+ light: 0.19,
1235
+ dark: 0.22,
1236
+ contrast: 0.4
1237
+ }
1238
+ },
1239
+ "border-strong": {
1240
+ number: 9,
1241
+ name: "border-strong",
1242
+ group: "border",
1243
+ displayName: "Border Strong",
1244
+ description: {
1245
+ long: "Border Strong er den m\xF8rkeste border-fargen og brukes n\xE5r man \xF8nsker en veldig tydelig og sterk border.",
1246
+ short: "Border-farge med h\xF8y kontrast for ekstra synlighet."
1247
+ },
1248
+ luminance: {
1249
+ light: 0.11,
1250
+ dark: 0.39,
1251
+ contrast: 0.6
1252
+ }
1253
+ },
1254
+ "text-subtle": {
1255
+ number: 10,
1256
+ name: "text-subtle",
1257
+ group: "text",
1258
+ displayName: "Text Subtle",
1259
+ description: {
1260
+ long: "Text Subtle er den lyseste tekstfargen og brukes p\xE5 tekst som skal v\xE6re litt mindre synlig eller for \xE5 skape variasjon i typografien.",
1261
+ short: "Tekst- og ikonfarge med lavere kontrast."
1262
+ },
1263
+ luminance: {
1264
+ light: 0.11,
1265
+ dark: 0.39,
1266
+ contrast: 0.57
1267
+ }
1268
+ },
1269
+ "text-default": {
1270
+ number: 11,
1271
+ name: "text-default",
1272
+ group: "text",
1273
+ displayName: "Text Default",
1274
+ description: {
1275
+ long: "Text Default er den m\xF8rkeste tekstfargen og brukes p\xE5 tekst som skal v\xE6re mest synlig. Denne fargen b\xF8r brukes p\xE5 mesteparten av teksten p\xE5 en side.",
1276
+ short: "Tekst- og ikonfarge med h\xF8y kontrast og god synlighet."
1277
+ },
1278
+ luminance: {
1279
+ light: 0.0245,
1280
+ dark: 0.84,
1281
+ contrast: 0.86
1282
+ }
1283
+ },
1284
+ "base-default": {
1285
+ number: 12,
1286
+ name: "base-default",
1287
+ group: "base",
1288
+ displayName: "Base Default",
1289
+ description: {
1290
+ long: "Base Default fargen f\xE5r den samme hex koden som fargen som er valgt i verkt\xF8yet. Brukes ofte som farge p\xE5 viktige elementer og p\xE5 flater som skal fange brukerens oppmerksomhet.",
1291
+ short: "Standardfarge for solide bakgrunner."
1292
+ },
1293
+ luminance: {
1294
+ light: 1,
1295
+ dark: 1,
1296
+ contrast: 1
1297
+ }
1298
+ },
1299
+ "base-hover": {
1300
+ number: 13,
1301
+ name: "base-hover",
1302
+ group: "base",
1303
+ displayName: "Base Hover",
1304
+ description: {
1305
+ long: "Base Hover brukes som hover farge p\xE5 elementer som bruker Base Default fargen.",
1306
+ short: "Hover-farge for solide bakgrunner."
1307
+ },
1308
+ luminance: {
1309
+ light: 1,
1310
+ dark: 1,
1311
+ contrast: 1
1312
+ }
1313
+ },
1314
+ "base-active": {
1315
+ number: 14,
1316
+ name: "base-active",
1317
+ group: "base",
1318
+ displayName: "Base Active",
1319
+ description: {
1320
+ long: "Base Active brukes som active farge p\xE5 elementer som bruker Base Default fargen.",
1321
+ short: "Active-farge for solide bakgrunner."
1322
+ },
1323
+ luminance: {
1324
+ light: 1,
1325
+ dark: 1,
1326
+ contrast: 1
1327
+ }
1328
+ },
1329
+ "base-contrast-subtle": {
1330
+ number: 15,
1331
+ name: "base-contrast-subtle",
1332
+ group: "base",
1333
+ displayName: "Contrast Subtle",
1334
+ description: {
1335
+ long: "Contrast Subtle brukes som en viktig meningsb\xE6rende farge opp\xE5 Base Default fargen.",
1336
+ short: "Farge med god kontrast mot Base-default."
1337
+ },
1338
+ luminance: {
1339
+ light: 1,
1340
+ dark: 1,
1341
+ contrast: 1
1342
+ }
1343
+ },
1344
+ "base-contrast-default": {
1345
+ number: 16,
1346
+ name: "base-contrast-default",
1347
+ group: "base",
1348
+ displayName: "Contrast Default",
1349
+ description: {
1350
+ long: "Contrast Default brukes som en viktig meningsb\xE6rende farge opp\xE5 alle Base fargane.",
1351
+ short: "Farge med god kontrast mot Base-default og Base-hover."
1352
+ },
1353
+ luminance: {
1354
+ light: 1,
1355
+ dark: 1,
1356
+ contrast: 1
1357
+ }
1358
+ }
1359
+ };
1360
+ var colorMetadataByNumber = R2.indexBy((metadata) => metadata.number, Object.values(colorMetadata));
1361
+
1362
+ // src/colors/theme.ts
1363
+ var generateColorScale = (color, colorScheme2) => {
1364
+ let interpolationColor = color;
1365
+ if (colorScheme2 === "dark") {
1366
+ const [L, C, H] = chroma2(color).oklch();
1367
+ const chromaModifier = 0.7;
1368
+ interpolationColor = chroma2(L, C * chromaModifier, H, "oklch").hex();
1369
+ }
1370
+ const colors = R3.mapObjIndexed((colorData) => {
1371
+ const luminance = colorData.luminance[colorScheme2];
1372
+ return {
1373
+ ...colorData,
1374
+ hex: chroma2(interpolationColor).luminance(luminance).hex()
1375
+ };
1376
+ }, colorMetadata);
1377
+ const baseColors2 = generateBaseColors(color, colorScheme2);
1378
+ colors["base-default"] = { ...colors["base-default"], hex: baseColors2.default };
1379
+ colors["base-hover"] = { ...colors["base-hover"], hex: baseColors2.hover };
1380
+ colors["base-active"] = { ...colors["base-active"], hex: baseColors2.active };
1381
+ colors["base-contrast-subtle"] = {
1382
+ ...colors["base-contrast-subtle"],
1383
+ hex: generateColorContrast(baseColors2.default, "subtle")
1384
+ };
1385
+ colors["base-contrast-default"] = {
1386
+ ...colors["base-contrast-default"],
1387
+ hex: generateColorContrast(baseColors2.default, "default")
1388
+ };
1389
+ return Object.values(colors);
1390
+ };
1391
+ var generateBaseColors = (color, colorScheme2) => {
1392
+ let colorLightness = getLightnessFromHex(color);
1393
+ if (colorScheme2 !== "light") {
1394
+ colorLightness = colorLightness <= 30 ? 70 : 100 - colorLightness;
1395
+ }
1396
+ const modifier = colorLightness <= 30 || colorLightness >= 49 && colorLightness <= 65 ? -8 : 8;
1397
+ const calculateLightness = (base, mod) => base - mod;
1398
+ return {
1399
+ default: colorScheme2 === "light" ? color : chroma2(color).luminance(getLuminanceFromLightness(colorLightness)).hex(),
1400
+ hover: chroma2(color).luminance(getLuminanceFromLightness(calculateLightness(colorLightness, modifier))).hex(),
1401
+ active: chroma2(color).luminance(getLuminanceFromLightness(calculateLightness(colorLightness, modifier * 2))).hex()
1402
+ };
1403
+ };
1404
+ var generateColorContrast = (color, type) => {
1405
+ if (type === "default") {
1406
+ return chroma2.contrast(color, "#ffffff") >= chroma2.contrast(color, "#000000") ? "#ffffff" : "#000000";
1407
+ }
1408
+ if (type === "subtle") {
1409
+ const contrastWhite = chroma2.contrast(color, "#ffffff");
1410
+ const contrastBlack = chroma2.contrast(color, "#000000");
1411
+ const lightness = getLightnessFromHex(color);
1412
+ const modifier = lightness <= 40 || lightness >= 60 ? 60 : 50;
1413
+ const targetLightness = contrastWhite >= contrastBlack ? lightness + modifier : lightness - modifier;
1414
+ return chroma2(color).luminance(getLuminanceFromLightness(targetLightness)).hex();
1415
+ }
1416
+ return color;
1417
+ };
1418
+
1419
+ // src/tokens/create/generators/color.ts
1420
+ var generateColor = (colorArray) => {
1421
+ const obj = {};
1422
+ const $type = "color";
1423
+ for (const index in colorArray) {
1424
+ obj[Number(index) + 1] = { $type, $value: colorArray[index].hex };
1425
+ }
1426
+ return obj;
1427
+ };
1428
+ var generateColorScheme = (themeName, colorScheme2, colors) => {
1429
+ const main = R4.map((color) => generateColor(generateColorScale(color, colorScheme2)), colors.main);
1430
+ const support = R4.map((color) => generateColor(generateColorScale(color, colorScheme2)), colors.support);
1431
+ const neutral = generateColor(generateColorScale(colors.neutral, colorScheme2));
1432
+ return {
1433
+ [themeName]: {
1434
+ ...main,
1435
+ ...support,
1436
+ neutral
1437
+ }
1438
+ };
1439
+ };
1440
+ var generateColorGlobal = (colorScheme2) => {
1441
+ const blueScale = generateColorScale(baseColors.blue, colorScheme2);
1442
+ const greenScale = generateColorScale(baseColors.green, colorScheme2);
1443
+ const orangeScale = generateColorScale(baseColors.orange, colorScheme2);
1444
+ const purpleScale = generateColorScale(baseColors.purple, colorScheme2);
1445
+ const redScale = generateColorScale(baseColors.red, colorScheme2);
1446
+ return {
1447
+ global: {
1448
+ blue: generateColor(blueScale),
1449
+ green: generateColor(greenScale),
1450
+ orange: generateColor(orangeScale),
1451
+ purple: generateColor(purpleScale),
1452
+ red: generateColor(redScale)
1453
+ }
1454
+ };
1455
+ };
1456
+
1457
+ // src/tokens/create/generators/semantic.ts
1458
+ import * as R5 from "ramda";
1459
+
1460
+ // src/tokens/template/design-tokens/semantic/color.base.template.json with { type: 'json' }
1461
+ var color_base_template_default = {
1462
+ color: {
1463
+ success: {
1464
+ "background-default": {
1465
+ $type: "color",
1466
+ $value: "{global.green.1}"
1467
+ },
1468
+ "background-tinted": {
1469
+ $type: "color",
1470
+ $value: "{global.green.2}"
1471
+ },
1472
+ "surface-default": {
1473
+ $type: "color",
1474
+ $value: "{global.green.3}"
1475
+ },
1476
+ "surface-tinted": {
1477
+ $type: "color",
1478
+ $value: "{global.green.4}"
1479
+ },
1480
+ "surface-hover": {
1481
+ $type: "color",
1482
+ $value: "{global.green.5}"
1483
+ },
1484
+ "surface-active": {
1485
+ $type: "color",
1486
+ $value: "{global.green.6}"
1487
+ },
1488
+ "border-subtle": {
1489
+ $type: "color",
1490
+ $value: "{global.green.7}"
1491
+ },
1492
+ "border-default": {
1493
+ $type: "color",
1494
+ $value: "{global.green.8}"
1495
+ },
1496
+ "border-strong": {
1497
+ $type: "color",
1498
+ $value: "{global.green.9}"
1499
+ },
1500
+ "text-subtle": {
1501
+ $type: "color",
1502
+ $value: "{global.green.10}"
1503
+ },
1504
+ "text-default": {
1505
+ $type: "color",
1506
+ $value: "{global.green.11}"
1507
+ },
1508
+ "base-default": {
1509
+ $type: "color",
1510
+ $value: "{global.green.12}"
1511
+ },
1512
+ "base-hover": {
1513
+ $type: "color",
1514
+ $value: "{global.green.13}"
1515
+ },
1516
+ "base-active": {
1517
+ $type: "color",
1518
+ $value: "{global.green.14}"
1519
+ },
1520
+ "base-contrast-subtle": {
1521
+ $type: "color",
1522
+ $value: "{global.green.15}"
1523
+ },
1524
+ "base-contrast-default": {
1525
+ $type: "color",
1526
+ $value: "{global.green.16}"
1527
+ }
1528
+ },
1529
+ danger: {
1530
+ "background-default": {
1531
+ $type: "color",
1532
+ $value: "{global.red.1}"
1533
+ },
1534
+ "background-tinted": {
1535
+ $type: "color",
1536
+ $value: "{global.red.2}"
1537
+ },
1538
+ "surface-default": {
1539
+ $type: "color",
1540
+ $value: "{global.red.3}"
1541
+ },
1542
+ "surface-tinted": {
1543
+ $type: "color",
1544
+ $value: "{global.red.4}"
1545
+ },
1546
+ "surface-hover": {
1547
+ $type: "color",
1548
+ $value: "{global.red.5}"
1549
+ },
1550
+ "surface-active": {
1551
+ $type: "color",
1552
+ $value: "{global.red.6}"
1553
+ },
1554
+ "border-subtle": {
1555
+ $type: "color",
1556
+ $value: "{global.red.7}"
1557
+ },
1558
+ "border-default": {
1559
+ $type: "color",
1560
+ $value: "{global.red.8}"
1561
+ },
1562
+ "border-strong": {
1563
+ $type: "color",
1564
+ $value: "{global.red.9}"
1565
+ },
1566
+ "text-subtle": {
1567
+ $type: "color",
1568
+ $value: "{global.red.10}"
1569
+ },
1570
+ "text-default": {
1571
+ $type: "color",
1572
+ $value: "{global.red.11}"
1573
+ },
1574
+ "base-default": {
1575
+ $type: "color",
1576
+ $value: "{global.red.12}"
1577
+ },
1578
+ "base-hover": {
1579
+ $type: "color",
1580
+ $value: "{global.red.13}"
1581
+ },
1582
+ "base-active": {
1583
+ $type: "color",
1584
+ $value: "{global.red.14}"
1585
+ },
1586
+ "base-contrast-subtle": {
1587
+ $type: "color",
1588
+ $value: "{global.red.15}"
1589
+ },
1590
+ "base-contrast-default": {
1591
+ $type: "color",
1592
+ $value: "{global.red.16}"
1593
+ }
1594
+ },
1595
+ info: {
1596
+ "background-default": {
1597
+ $type: "color",
1598
+ $value: "{global.blue.1}"
1599
+ },
1600
+ "background-tinted": {
1601
+ $type: "color",
1602
+ $value: "{global.blue.2}"
1603
+ },
1604
+ "surface-default": {
1605
+ $type: "color",
1606
+ $value: "{global.blue.3}"
1607
+ },
1608
+ "surface-tinted": {
1609
+ $type: "color",
1610
+ $value: "{global.blue.4}"
1611
+ },
1612
+ "surface-hover": {
1613
+ $type: "color",
1614
+ $value: "{global.blue.5}"
1615
+ },
1616
+ "surface-active": {
1617
+ $type: "color",
1618
+ $value: "{global.blue.6}"
1619
+ },
1620
+ "border-subtle": {
1621
+ $type: "color",
1622
+ $value: "{global.blue.7}"
1623
+ },
1624
+ "border-default": {
1625
+ $type: "color",
1626
+ $value: "{global.blue.8}"
1627
+ },
1628
+ "border-strong": {
1629
+ $type: "color",
1630
+ $value: "{global.blue.9}"
1631
+ },
1632
+ "text-subtle": {
1633
+ $type: "color",
1634
+ $value: "{global.blue.10}"
1635
+ },
1636
+ "text-default": {
1637
+ $type: "color",
1638
+ $value: "{global.blue.11}"
1639
+ },
1640
+ "base-default": {
1641
+ $type: "color",
1642
+ $value: "{global.blue.12}"
1643
+ },
1644
+ "base-hover": {
1645
+ $type: "color",
1646
+ $value: "{global.blue.13}"
1647
+ },
1648
+ "base-active": {
1649
+ $type: "color",
1650
+ $value: "{global.blue.14}"
1651
+ },
1652
+ "base-contrast-subtle": {
1653
+ $type: "color",
1654
+ $value: "{global.blue.15}"
1655
+ },
1656
+ "base-contrast-default": {
1657
+ $type: "color",
1658
+ $value: "{global.blue.16}"
1659
+ }
1660
+ },
1661
+ warning: {
1662
+ "background-default": {
1663
+ $type: "color",
1664
+ $value: "{global.orange.1}"
1665
+ },
1666
+ "background-tinted": {
1667
+ $type: "color",
1668
+ $value: "{global.orange.2}"
1669
+ },
1670
+ "surface-default": {
1671
+ $type: "color",
1672
+ $value: "{global.orange.3}"
1673
+ },
1674
+ "surface-tinted": {
1675
+ $type: "color",
1676
+ $value: "{global.orange.4}"
1677
+ },
1678
+ "surface-hover": {
1679
+ $type: "color",
1680
+ $value: "{global.orange.5}"
1681
+ },
1682
+ "surface-active": {
1683
+ $type: "color",
1684
+ $value: "{global.orange.6}"
1685
+ },
1686
+ "border-subtle": {
1687
+ $type: "color",
1688
+ $value: "{global.orange.7}"
1689
+ },
1690
+ "border-default": {
1691
+ $type: "color",
1692
+ $value: "{global.orange.8}"
1693
+ },
1694
+ "border-strong": {
1695
+ $type: "color",
1696
+ $value: "{global.orange.9}"
1697
+ },
1698
+ "text-subtle": {
1699
+ $type: "color",
1700
+ $value: "{global.orange.10}"
1701
+ },
1702
+ "text-default": {
1703
+ $type: "color",
1704
+ $value: "{global.orange.11}"
1705
+ },
1706
+ "base-default": {
1707
+ $type: "color",
1708
+ $value: "{global.orange.12}"
1709
+ },
1710
+ "base-hover": {
1711
+ $type: "color",
1712
+ $value: "{global.orange.13}"
1713
+ },
1714
+ "base-active": {
1715
+ $type: "color",
1716
+ $value: "{global.orange.14}"
1717
+ },
1718
+ "base-contrast-subtle": {
1719
+ $type: "color",
1720
+ $value: "{global.orange.15}"
1721
+ },
1722
+ "base-contrast-default": {
1723
+ $type: "color",
1724
+ $value: "{global.orange.16}"
1725
+ }
1726
+ },
1727
+ focus: {
1728
+ inner: {
1729
+ $type: "color",
1730
+ $value: "{color.neutral.background-default}"
1731
+ },
1732
+ outer: {
1733
+ $type: "color",
1734
+ $value: "{color.neutral.text-default}"
1735
+ }
1736
+ }
1737
+ },
1738
+ link: {
1739
+ color: {
1740
+ visited: {
1741
+ $type: "color",
1742
+ $value: "{global.purple.12}"
1743
+ }
1744
+ }
1745
+ }
1746
+ };
1747
+
1748
+ // src/tokens/template/design-tokens/semantic/color.template.json with { type: 'json' }
1749
+ var color_template_default = {
1750
+ "background-default": {
1751
+ $type: "color",
1752
+ $value: "{color.<color>.1}"
1753
+ },
1754
+ "background-tinted": {
1755
+ $type: "color",
1756
+ $value: "{color.<color>.2}"
1757
+ },
1758
+ "surface-default": {
1759
+ $type: "color",
1760
+ $value: "{color.<color>.3}"
1761
+ },
1762
+ "surface-tinted": {
1763
+ $type: "color",
1764
+ $value: "{color.<color>.4}"
1765
+ },
1766
+ "surface-hover": {
1767
+ $type: "color",
1768
+ $value: "{color.<color>.5}"
1769
+ },
1770
+ "surface-active": {
1771
+ $type: "color",
1772
+ $value: "{color.<color>.6}"
1773
+ },
1774
+ "border-subtle": {
1775
+ $type: "color",
1776
+ $value: "{color.<color>.7}"
1777
+ },
1778
+ "border-default": {
1779
+ $type: "color",
1780
+ $value: "{color.<color>.8}"
1781
+ },
1782
+ "border-strong": {
1783
+ $type: "color",
1784
+ $value: "{color.<color>.9}"
1785
+ },
1786
+ "text-subtle": {
1787
+ $type: "color",
1788
+ $value: "{color.<color>.10}"
1789
+ },
1790
+ "text-default": {
1791
+ $type: "color",
1792
+ $value: "{color.<color>.11}"
1793
+ },
1794
+ "base-default": {
1795
+ $type: "color",
1796
+ $value: "{color.<color>.12}"
1797
+ },
1798
+ "base-hover": {
1799
+ $type: "color",
1800
+ $value: "{color.<color>.13}"
1801
+ },
1802
+ "base-active": {
1803
+ $type: "color",
1804
+ $value: "{color.<color>.14}"
1805
+ },
1806
+ "base-contrast-subtle": {
1807
+ $type: "color",
1808
+ $value: "{color.<color>.15}"
1809
+ },
1810
+ "base-contrast-default": {
1811
+ $type: "color",
1812
+ $value: "{color.<color>.16}"
1813
+ }
1814
+ };
1815
+
1816
+ // src/tokens/template/design-tokens/semantic/modes/color.template.json with { type: 'json' }
1817
+ var color_template_default2 = {
1818
+ "background-default": {
1819
+ $type: "color",
1820
+ $value: "{color.<color>.background-default}"
1821
+ },
1822
+ "background-tinted": {
1823
+ $type: "color",
1824
+ $value: "{color.<color>.background-tinted}"
1825
+ },
1826
+ "surface-default": {
1827
+ $type: "color",
1828
+ $value: "{color.<color>.surface-default}"
1829
+ },
1830
+ "surface-tinted": {
1831
+ $type: "color",
1832
+ $value: "{color.<color>.surface-tinted}"
1833
+ },
1834
+ "surface-hover": {
1835
+ $type: "color",
1836
+ $value: "{color.<color>.surface-hover}"
1837
+ },
1838
+ "surface-active": {
1839
+ $type: "color",
1840
+ $value: "{color.<color>.surface-active}"
1841
+ },
1842
+ "border-subtle": {
1843
+ $type: "color",
1844
+ $value: "{color.<color>.border-subtle}"
1845
+ },
1846
+ "border-default": {
1847
+ $type: "color",
1848
+ $value: "{color.<color>.border-default}"
1849
+ },
1850
+ "border-strong": {
1851
+ $type: "color",
1852
+ $value: "{color.<color>.border-strong}"
1853
+ },
1854
+ "text-subtle": {
1855
+ $type: "color",
1856
+ $value: "{color.<color>.text-subtle}"
1857
+ },
1858
+ "text-default": {
1859
+ $type: "color",
1860
+ $value: "{color.<color>.text-default}"
1861
+ },
1862
+ "base-default": {
1863
+ $type: "color",
1864
+ $value: "{color.<color>.base-default}"
1865
+ },
1866
+ "base-hover": {
1867
+ $type: "color",
1868
+ $value: "{color.<color>.base-hover}"
1869
+ },
1870
+ "base-active": {
1871
+ $type: "color",
1872
+ $value: "{color.<color>.base-active}"
1873
+ },
1874
+ "base-contrast-subtle": {
1875
+ $type: "color",
1876
+ $value: "{color.<color>.base-contrast-subtle}"
1877
+ },
1878
+ "base-contrast-default": {
1879
+ $type: "color",
1880
+ $value: "{color.<color>.base-contrast-default}"
1881
+ }
1882
+ };
1883
+
1884
+ // src/tokens/create/generators/semantic.ts
1885
+ var generateSemantic = (colors) => {
1886
+ const mainColorNames = Object.keys(colors.main);
1887
+ const supportColorNames = Object.keys(colors.support);
1888
+ const modes = {
1889
+ "main-color": {},
1890
+ "support-color": {}
1891
+ };
1892
+ const categories = [
1893
+ ["main-color", mainColorNames],
1894
+ ["support-color", supportColorNames]
1895
+ ];
1896
+ for (const [colorCategory2, colorNames] of categories) {
1897
+ for (const colorName of colorNames) {
1898
+ const category = colorCategory2.replace("-color", "");
1899
+ const customColorTokens = {
1900
+ color: {
1901
+ [category]: JSON.parse(
1902
+ JSON.stringify(
1903
+ color_template_default2,
1904
+ (key, value) => {
1905
+ if (key === "$value") {
1906
+ return value.replace("<color>", colorName);
1907
+ }
1908
+ return value;
1909
+ },
1910
+ 2
1911
+ )
1912
+ )
1913
+ }
1914
+ };
1915
+ modes[colorCategory2][colorName] = customColorTokens;
1916
+ }
1917
+ }
1918
+ const customColors = [...mainColorNames, "neutral", ...supportColorNames];
1919
+ const semanticColorTokens = customColors.map(
1920
+ (colorName) => [
1921
+ colorName,
1922
+ R5.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), color_template_default)
1923
+ ]
1924
+ );
1925
+ const color = {
1926
+ ...color_base_template_default,
1927
+ color: {
1928
+ ...Object.fromEntries(semanticColorTokens),
1929
+ ...color_base_template_default.color
1930
+ }
1931
+ };
1932
+ return {
1933
+ modes,
1934
+ color
1935
+ };
1936
+ };
1937
+
1938
+ // src/tokens/create/generators/theme.ts
1939
+ import * as R6 from "ramda";
1940
+
1941
+ // src/tokens/template/design-tokens/themes/theme.base.template.json with { type: 'json' }
1942
+ var theme_base_template_default = {
1943
+ color: {},
1944
+ "font-family": {
1945
+ $type: "fontFamilies",
1946
+ $value: "{<theme>.font-family}"
1947
+ },
1948
+ "font-weight": {
1949
+ medium: {
1950
+ $type: "fontWeights",
1951
+ $value: "{<theme>.font-weight.medium}"
1952
+ },
1953
+ semibold: {
1954
+ $type: "fontWeights",
1955
+ $value: "{<theme>.font-weight.semibold}"
1956
+ },
1957
+ regular: {
1958
+ $type: "fontWeights",
1959
+ $value: "{<theme>.font-weight.regular}"
1960
+ }
1961
+ },
1962
+ "border-radius": {
1963
+ "1": {
1964
+ $type: "dimension",
1965
+ $value: "min({border-radius.base}*0.5,{border-radius.scale})"
1966
+ },
1967
+ "2": {
1968
+ $type: "dimension",
1969
+ $value: "min({border-radius.base},{border-radius.scale}*2)"
1970
+ },
1971
+ "3": {
1972
+ $type: "dimension",
1973
+ $value: "min({border-radius.base}*2,{border-radius.scale}*5)"
1974
+ },
1975
+ "4": {
1976
+ $type: "dimension",
1977
+ $value: "min({border-radius.base}*3,{border-radius.scale}*7)"
1978
+ },
1979
+ "5": {
1980
+ $type: "dimension",
1981
+ $value: "{border-radius.base}"
1982
+ },
1983
+ "6": {
1984
+ $type: "dimension",
1985
+ $value: "9999"
1986
+ },
1987
+ base: {
1988
+ $type: "dimension",
1989
+ $value: "4"
1990
+ },
1991
+ scale: {
1992
+ $type: "dimension",
1993
+ $value: "4"
1994
+ }
1995
+ }
1996
+ };
1997
+
1998
+ // src/tokens/template/design-tokens/themes/theme.template.json with { type: 'json' }
1999
+ var theme_template_default = {
2000
+ "1": {
2001
+ $type: "color",
2002
+ $value: "{<theme>.<color>.1}"
2003
+ },
2004
+ "2": {
2005
+ $type: "color",
2006
+ $value: "{<theme>.<color>.2}"
2007
+ },
2008
+ "3": {
2009
+ $type: "color",
2010
+ $value: "{<theme>.<color>.3}"
2011
+ },
2012
+ "4": {
2013
+ $type: "color",
2014
+ $value: "{<theme>.<color>.4}"
2015
+ },
2016
+ "5": {
2017
+ $type: "color",
2018
+ $value: "{<theme>.<color>.5}"
2019
+ },
2020
+ "6": {
2021
+ $type: "color",
2022
+ $value: "{<theme>.<color>.6}"
2023
+ },
2024
+ "7": {
2025
+ $type: "color",
2026
+ $value: "{<theme>.<color>.7}"
2027
+ },
2028
+ "8": {
2029
+ $type: "color",
2030
+ $value: "{<theme>.<color>.8}"
2031
+ },
2032
+ "9": {
2033
+ $type: "color",
2034
+ $value: "{<theme>.<color>.9}"
2035
+ },
2036
+ "10": {
2037
+ $type: "color",
2038
+ $value: "{<theme>.<color>.10}"
2039
+ },
2040
+ "11": {
2041
+ $type: "color",
2042
+ $value: "{<theme>.<color>.11}"
2043
+ },
2044
+ "12": {
2045
+ $type: "color",
2046
+ $value: "{<theme>.<color>.12}"
2047
+ },
2048
+ "13": {
2049
+ $type: "color",
2050
+ $value: "{<theme>.<color>.13}"
2051
+ },
2052
+ "14": {
2053
+ $type: "color",
2054
+ $value: "{<theme>.<color>.14}"
2055
+ },
2056
+ "15": {
2057
+ $type: "color",
2058
+ $value: "{<theme>.<color>.15}"
2059
+ },
2060
+ "16": {
2061
+ $type: "color",
2062
+ $value: "{<theme>.<color>.16}"
2063
+ }
2064
+ };
2065
+
2066
+ // src/tokens/create/generators/theme.ts
2067
+ var generateTheme = (colors, themeName, borderRadius) => {
2068
+ const mainColorNames = Object.keys(colors.main);
2069
+ const supportColorNames = Object.keys(colors.support);
2070
+ const customColors = [...mainColorNames, "neutral", ...supportColorNames];
2071
+ const themeColorTokens = Object.fromEntries(
2072
+ customColors.map(
2073
+ (colorName) => [
2074
+ colorName,
2075
+ R6.map((x) => ({ ...x, $value: x.$value.replace("<color>", colorName) }), theme_template_default)
2076
+ ]
2077
+ )
2078
+ );
2079
+ const { color: themeBaseFileColor, ...remainingThemeFile } = theme_base_template_default;
2080
+ const themeFile = {
2081
+ color: {
2082
+ ...themeColorTokens,
2083
+ ...themeBaseFileColor
2084
+ },
2085
+ ...remainingThemeFile
2086
+ };
2087
+ const baseBorderRadius = R6.lensPath(["border-radius", "base", "$value"]);
2088
+ const updatedThemeFile = R6.set(baseBorderRadius, String(borderRadius), themeFile);
2089
+ const token = JSON.parse(
2090
+ JSON.stringify(
2091
+ updatedThemeFile,
2092
+ (key, value) => {
2093
+ if (key === "$value") {
2094
+ return value.replace("<theme>", themeName);
2095
+ }
2096
+ return value;
2097
+ },
2098
+ 2
2099
+ )
2100
+ );
2101
+ return token;
2102
+ };
2103
+
2104
+ // src/tokens/template/design-tokens/primitives/modes/typography/typography.template.json with { type: 'json' }
2105
+ var typography_template_default = {
2106
+ "<theme>": {
2107
+ "font-family": {
2108
+ $type: "fontFamilies",
2109
+ $value: "<font-family>"
2110
+ },
2111
+ "font-weight": {
2112
+ medium: {
2113
+ $type: "fontWeights",
2114
+ $value: "Medium"
2115
+ },
2116
+ semibold: {
2117
+ $type: "fontWeights",
2118
+ $value: "Semi bold"
2119
+ },
2120
+ regular: {
2121
+ $type: "fontWeights",
2122
+ $value: "Regular"
2123
+ }
2124
+ }
2125
+ }
2126
+ };
2127
+
2128
+ // src/tokens/create/generators/typography.ts
2129
+ var generateTypography = (themeName, { fontFamily }) => {
2130
+ return JSON.parse(
2131
+ JSON.stringify(typography_template_default).replaceAll(/<font-family>/g, fontFamily).replaceAll(/<theme>/g, themeName)
2132
+ );
2133
+ };
2134
+
2135
+ // src/tokens/create.ts
2136
+ var createTokens = async (opts) => {
2137
+ const { colors, typography: typography2, name, borderRadius } = opts;
2138
+ const colorSchemes = ["light", "dark"];
2139
+ const semantic2 = generateSemantic(colors);
2140
+ const tokenSets = new Map([
2141
+ ...getDefaultTokens([
2142
+ "primitives/globals",
2143
+ "primitives/modes/size/small",
2144
+ "primitives/modes/size/medium",
2145
+ "primitives/modes/size/large",
2146
+ "primitives/modes/size/global",
2147
+ "primitives/modes/typography/size/small",
2148
+ "primitives/modes/typography/size/medium",
2149
+ "primitives/modes/typography/size/large"
2150
+ ]),
2151
+ [`primitives/modes/typography/primary/${name}`, generateTypography(name, typography2)],
2152
+ [`primitives/modes/typography/secondary/${name}`, generateTypography(name, typography2)],
2153
+ ...colorSchemes.flatMap((scheme) => [
2154
+ [`primitives/modes/color-scheme/${scheme}/global`, generateColorGlobal(scheme)],
2155
+ [`primitives/modes/color-scheme/${scheme}/${name}`, generateColorScheme(name, scheme, colors)]
2156
+ ]),
2157
+ [`themes/${name}`, generateTheme(colors, name, borderRadius)],
2158
+ ["semantic/color", semantic2.color],
2159
+ // maps out semantic modes, ieg 'semantic/modes/main-color/accent', and 'semantic/modes/support-color/brand1'
2160
+ ...Object.entries(semantic2.modes).flatMap(
2161
+ ([mode, colors2]) => Object.entries(colors2).map(([key, colorSet]) => [`semantic/modes/${mode}/${key}`, colorSet])
2162
+ ),
2163
+ getDefaultToken("semantic/style")
2164
+ ]);
2165
+ return { tokenSets };
2166
+ };
2167
+
2168
+ // ../../node_modules/@tokens-studio/types/dist/constants/BoxShadowTypes.js
2169
+ var BoxShadowTypes;
2170
+ (function(BoxShadowTypes2) {
2171
+ BoxShadowTypes2["DROP_SHADOW"] = "dropShadow";
2172
+ BoxShadowTypes2["INNER_SHADOW"] = "innerShadow";
2173
+ })(BoxShadowTypes || (BoxShadowTypes = {}));
2174
+
2175
+ // ../../node_modules/@tokens-studio/types/dist/constants/ColorModifierTypes.js
2176
+ var ColorModifierTypes;
2177
+ (function(ColorModifierTypes2) {
2178
+ ColorModifierTypes2["LIGHTEN"] = "lighten";
2179
+ ColorModifierTypes2["DARKEN"] = "darken";
2180
+ ColorModifierTypes2["MIX"] = "mix";
2181
+ ColorModifierTypes2["ALPHA"] = "alpha";
2182
+ })(ColorModifierTypes || (ColorModifierTypes = {}));
2183
+
2184
+ // ../../node_modules/@tokens-studio/types/dist/constants/ColorSpaceTypes.js
2185
+ var ColorSpaceTypes;
2186
+ (function(ColorSpaceTypes2) {
2187
+ ColorSpaceTypes2["LCH"] = "lch";
2188
+ ColorSpaceTypes2["SRGB"] = "srgb";
2189
+ ColorSpaceTypes2["P3"] = "p3";
2190
+ ColorSpaceTypes2["HSL"] = "hsl";
2191
+ })(ColorSpaceTypes || (ColorSpaceTypes = {}));
2192
+
2193
+ // ../../node_modules/@tokens-studio/types/dist/constants/Properties.js
2194
+ var Properties;
2195
+ (function(Properties2) {
2196
+ Properties2["sizing"] = "sizing";
2197
+ Properties2["height"] = "height";
2198
+ Properties2["width"] = "width";
2199
+ Properties2["spacing"] = "spacing";
2200
+ Properties2["verticalPadding"] = "verticalPadding";
2201
+ Properties2["horizontalPadding"] = "horizontalPadding";
2202
+ Properties2["paddingTop"] = "paddingTop";
2203
+ Properties2["paddingRight"] = "paddingRight";
2204
+ Properties2["paddingBottom"] = "paddingBottom";
2205
+ Properties2["paddingLeft"] = "paddingLeft";
2206
+ Properties2["itemSpacing"] = "itemSpacing";
2207
+ Properties2["fill"] = "fill";
2208
+ Properties2["backgroundBlur"] = "backgroundBlur";
2209
+ Properties2["border"] = "border";
2210
+ Properties2["borderTop"] = "borderTop";
2211
+ Properties2["borderRight"] = "borderRight";
2212
+ Properties2["borderBottom"] = "borderBottom";
2213
+ Properties2["borderLeft"] = "borderLeft";
2214
+ Properties2["borderColor"] = "borderColor";
2215
+ Properties2["borderRadius"] = "borderRadius";
2216
+ Properties2["borderRadiusTopLeft"] = "borderRadiusTopLeft";
2217
+ Properties2["borderRadiusTopRight"] = "borderRadiusTopRight";
2218
+ Properties2["borderRadiusBottomRight"] = "borderRadiusBottomRight";
2219
+ Properties2["borderRadiusBottomLeft"] = "borderRadiusBottomLeft";
2220
+ Properties2["borderWidth"] = "borderWidth";
2221
+ Properties2["borderWidthTop"] = "borderWidthTop";
2222
+ Properties2["borderWidthRight"] = "borderWidthRight";
2223
+ Properties2["borderWidthBottom"] = "borderWidthBottom";
2224
+ Properties2["borderWidthLeft"] = "borderWidthLeft";
2225
+ Properties2["boxShadow"] = "boxShadow";
2226
+ Properties2["opacity"] = "opacity";
2227
+ Properties2["fontFamilies"] = "fontFamilies";
2228
+ Properties2["fontWeights"] = "fontWeights";
2229
+ Properties2["fontSizes"] = "fontSizes";
2230
+ Properties2["lineHeights"] = "lineHeights";
2231
+ Properties2["typography"] = "typography";
2232
+ Properties2["composition"] = "composition";
2233
+ Properties2["letterSpacing"] = "letterSpacing";
2234
+ Properties2["paragraphSpacing"] = "paragraphSpacing";
2235
+ Properties2["textCase"] = "textCase";
2236
+ Properties2["dimension"] = "dimension";
2237
+ Properties2["textDecoration"] = "textDecoration";
2238
+ Properties2["asset"] = "asset";
2239
+ Properties2["tokenValue"] = "tokenValue";
2240
+ Properties2["value"] = "value";
2241
+ Properties2["tokenName"] = "tokenName";
2242
+ Properties2["description"] = "description";
2243
+ })(Properties || (Properties = {}));
2244
+
2245
+ // ../../node_modules/@tokens-studio/types/dist/constants/TokenSetStatus.js
2246
+ var TokenSetStatus;
2247
+ (function(TokenSetStatus2) {
2248
+ TokenSetStatus2["DISABLED"] = "disabled";
2249
+ TokenSetStatus2["SOURCE"] = "source";
2250
+ TokenSetStatus2["ENABLED"] = "enabled";
2251
+ })(TokenSetStatus || (TokenSetStatus = {}));
2252
+
2253
+ // ../../node_modules/@tokens-studio/types/dist/constants/TokenTypes.js
2254
+ var TokenTypes;
2255
+ (function(TokenTypes2) {
2256
+ TokenTypes2["OTHER"] = "other";
2257
+ TokenTypes2["COLOR"] = "color";
2258
+ TokenTypes2["BORDER_RADIUS"] = "borderRadius";
2259
+ TokenTypes2["SIZING"] = "sizing";
2260
+ TokenTypes2["SPACING"] = "spacing";
2261
+ TokenTypes2["TEXT"] = "text";
2262
+ TokenTypes2["TYPOGRAPHY"] = "typography";
2263
+ TokenTypes2["OPACITY"] = "opacity";
2264
+ TokenTypes2["BORDER_WIDTH"] = "borderWidth";
2265
+ TokenTypes2["STROKE_STYLE"] = "strokeStyle";
2266
+ TokenTypes2["BOX_SHADOW"] = "boxShadow";
2267
+ TokenTypes2["FONT_FAMILIES"] = "fontFamilies";
2268
+ TokenTypes2["FONT_WEIGHTS"] = "fontWeights";
2269
+ TokenTypes2["LINE_HEIGHTS"] = "lineHeights";
2270
+ TokenTypes2["FONT_SIZES"] = "fontSizes";
2271
+ TokenTypes2["LETTER_SPACING"] = "letterSpacing";
2272
+ TokenTypes2["PARAGRAPH_SPACING"] = "paragraphSpacing";
2273
+ TokenTypes2["PARAGRAPH_INDENT"] = "paragraphIndent";
2274
+ TokenTypes2["TEXT_DECORATION"] = "textDecoration";
2275
+ TokenTypes2["TEXT_CASE"] = "textCase";
2276
+ TokenTypes2["COMPOSITION"] = "composition";
2277
+ TokenTypes2["DIMENSION"] = "dimension";
2278
+ TokenTypes2["BORDER"] = "border";
2279
+ TokenTypes2["ASSET"] = "asset";
2280
+ TokenTypes2["BOOLEAN"] = "boolean";
2281
+ TokenTypes2["NUMBER"] = "number";
2282
+ })(TokenTypes || (TokenTypes = {}));
2283
+
2284
+ // ../../node_modules/@tokens-studio/types/dist/constants/BorderValues.js
2285
+ var BorderValues;
2286
+ (function(BorderValues2) {
2287
+ BorderValues2["BORDER_COLOR"] = "color";
2288
+ BorderValues2["BORDER_WIDTH"] = "width";
2289
+ BorderValues2["BORDER_STYLE"] = "style";
2290
+ })(BorderValues || (BorderValues = {}));
2291
+
2292
+ // ../../node_modules/@tokens-studio/types/dist/constants/StrokeStyleValues.js
2293
+ var StrokeStyleValues;
2294
+ (function(StrokeStyleValues2) {
2295
+ StrokeStyleValues2["SOLID"] = "solid";
2296
+ StrokeStyleValues2["DASHED"] = "dashed";
2297
+ StrokeStyleValues2["DOTTED"] = "dotted";
2298
+ StrokeStyleValues2["DOUBLE"] = "double";
2299
+ StrokeStyleValues2["GROOVE"] = "groove";
2300
+ StrokeStyleValues2["RIDGE"] = "ridge";
2301
+ StrokeStyleValues2["OUTSET"] = "outset";
2302
+ StrokeStyleValues2["INSET"] = "inset";
2303
+ })(StrokeStyleValues || (StrokeStyleValues = {}));
2304
+
2305
+ // ../../node_modules/@tokens-studio/types/dist/constants/BoxShadowValues.js
2306
+ var BoxShadowValues;
2307
+ (function(BoxShadowValues2) {
2308
+ BoxShadowValues2["TYPE"] = "type";
2309
+ BoxShadowValues2["COLOR"] = "color";
2310
+ BoxShadowValues2["X"] = "x";
2311
+ BoxShadowValues2["Y"] = "y";
2312
+ BoxShadowValues2["BLUR"] = "blur";
2313
+ BoxShadowValues2["SPREAD"] = "spread";
2314
+ BoxShadowValues2["BLEND_MODE"] = "blendMode";
2315
+ })(BoxShadowValues || (BoxShadowValues = {}));
2316
+
2317
+ // ../../node_modules/@tokens-studio/types/dist/constants/TypographyValues.js
2318
+ var TypographyValues;
2319
+ (function(TypographyValues2) {
2320
+ TypographyValues2["FONT_FAMILY"] = "fontFamily";
2321
+ TypographyValues2["FONT_WEIGHT"] = "fontWeight";
2322
+ TypographyValues2["LINE_HEIGHT"] = "lineHeight";
2323
+ TypographyValues2["FONT_SIZE"] = "fontSize";
2324
+ TypographyValues2["LETTER_SPACING"] = "letterSpacing";
2325
+ TypographyValues2["PARAGRAPH_SPACING"] = "paragraphSpacing";
2326
+ TypographyValues2["PARAGRAPH_INDENT"] = "paragraphIndent";
2327
+ TypographyValues2["TEXT_DECORATION"] = "textDecoration";
2328
+ TypographyValues2["TEXT_CASE"] = "textCase";
2329
+ })(TypographyValues || (TypographyValues = {}));
2330
+
2331
+ // src/tokens/create/generators/$themes.ts
2332
+ var capitalize = (word) => word.charAt(0).toUpperCase() + word.slice(1);
2333
+ async function createHash(text, algo = "SHA-1") {
2334
+ const crypto = globalThis.crypto;
2335
+ return Array.from(
2336
+ new Uint8Array(await crypto.subtle.digest(algo, new TextEncoder().encode(text))),
2337
+ (byte) => byte.toString(16).padStart(2, "0")
2338
+ ).join("");
2339
+ }
2340
+ async function generate$Themes(colorSchemes, themes, colors) {
2341
+ return [
2342
+ ...generateSizeGroup(),
2343
+ ...await generateThemesGroup(themes),
2344
+ ...generateTypographyGroup(themes),
2345
+ ...generateColorSchemesGroup(colorSchemes, themes),
2346
+ generateSemanticGroup(),
2347
+ ...await generateColorGroup("main", colors),
2348
+ ...await generateColorGroup("support", colors)
2349
+ ];
2350
+ }
2351
+ function generateSizeGroup() {
2352
+ return [
2353
+ {
2354
+ id: "8b2c8cc86611a34b135cb22948666779361fd729",
2355
+ name: "medium",
2356
+ $figmaStyleReferences: {},
2357
+ selectedTokenSets: {
2358
+ "primitives/modes/size/medium": TokenSetStatus.SOURCE,
2359
+ "primitives/modes/size/global": TokenSetStatus.ENABLED,
2360
+ "primitives/modes/typography/size/medium": TokenSetStatus.ENABLED
2361
+ },
2362
+ $figmaCollectionId: "VariableCollectionId:36248:20757",
2363
+ $figmaModeId: "41630:1",
2364
+ group: "Size"
2365
+ },
2366
+ {
2367
+ id: "d49b9eebeb48a4f165a74b7261733d0a73370f0e",
2368
+ name: "large",
2369
+ $figmaStyleReferences: {},
2370
+ selectedTokenSets: {
2371
+ "primitives/modes/size/large": TokenSetStatus.SOURCE,
2372
+ "primitives/modes/size/global": TokenSetStatus.ENABLED,
2373
+ "primitives/modes/typography/size/large": TokenSetStatus.ENABLED
2374
+ },
2375
+ $figmaCollectionId: "VariableCollectionId:36248:20757",
2376
+ $figmaModeId: "41630:2",
2377
+ group: "Size"
2378
+ },
2379
+ {
2380
+ id: "fb11567729c298ca37c9da4e3a27716a23480824",
2381
+ name: "small",
2382
+ $figmaStyleReferences: {},
2383
+ selectedTokenSets: {
2384
+ "primitives/modes/size/small": TokenSetStatus.SOURCE,
2385
+ "primitives/modes/size/global": TokenSetStatus.ENABLED,
2386
+ "primitives/modes/typography/size/small": TokenSetStatus.ENABLED
2387
+ },
2388
+ $figmaCollectionId: "VariableCollectionId:36248:20757",
2389
+ $figmaModeId: "41630:3",
2390
+ group: "Size"
2391
+ }
2392
+ ];
2393
+ }
2394
+ var colorSchemeDefaults = {
2395
+ light: {
2396
+ name: "Light",
2397
+ selectedTokenSets: {},
2398
+ id: "0daa3ca0b427b9349da7e7dc00101b5668972926",
2399
+ $figmaCollectionId: "VariableCollectionId:34811:5472",
2400
+ $figmaModeId: "34811:0"
2401
+ },
2402
+ dark: {
2403
+ name: "Dark",
2404
+ selectedTokenSets: {},
2405
+ id: "9ebd8aed52afbffc17e2666e8b4653a53498b257",
2406
+ $figmaCollectionId: "VariableCollectionId:34811:5472",
2407
+ $figmaModeId: "34811:1"
2408
+ },
2409
+ contrast: {
2410
+ name: "Contrast",
2411
+ selectedTokenSets: {},
2412
+ id: "9ebd8aed52afbffc17e2666e8b4653a53498b123",
2413
+ $figmaCollectionId: "VariableCollectionId:34811:5472",
2414
+ $figmaModeId: "34811:2"
2415
+ }
2416
+ };
2417
+ function generateColorSchemesGroup(colorSchemes, themes) {
2418
+ return colorSchemes.map(
2419
+ (scheme) => ({
2420
+ ...colorSchemeDefaults[scheme],
2421
+ selectedTokenSets: Object.fromEntries([
2422
+ [`primitives/modes/color-scheme/${scheme}/global`, TokenSetStatus.ENABLED],
2423
+ ...themes.map((theme) => [`primitives/modes/color-scheme/${scheme}/${theme}`, TokenSetStatus.ENABLED])
2424
+ ]),
2425
+ group: "Color scheme"
2426
+ })
2427
+ );
2428
+ }
2429
+ async function generateThemesGroup(themes) {
2430
+ return Promise.all(
2431
+ themes.map(
2432
+ async (theme, index) => ({
2433
+ id: await createHash(theme),
2434
+ $figmaCollectionId: "VariableCollectionId:36528:61712",
2435
+ $figmaModeId: `40960:${index + 6}`,
2436
+ // Start on 6 in Token Studio and Community file for some reason
2437
+ name: theme,
2438
+ selectedTokenSets: {
2439
+ [`themes/${theme}`]: TokenSetStatus.ENABLED
2440
+ },
2441
+ group: "Theme"
2442
+ })
2443
+ )
2444
+ );
2445
+ }
2446
+ function generateSemanticGroup() {
2447
+ return {
2448
+ id: "541629445ef90ad5363f9e88f52a1ccb617e6f84",
2449
+ name: "Semantic",
2450
+ selectedTokenSets: {
2451
+ "semantic/style": TokenSetStatus.ENABLED,
2452
+ "semantic/color": TokenSetStatus.ENABLED,
2453
+ "primitives/globals": TokenSetStatus.SOURCE
2454
+ },
2455
+ $figmaCollectionId: "VariableCollectionId:34811:5976",
2456
+ $figmaModeId: "34811:5",
2457
+ group: "Semantic"
2458
+ };
2459
+ }
2460
+ async function generateColorGroup(group, colors) {
2461
+ return Promise.all(
2462
+ Object.entries(colors[group]).map(
2463
+ async ([color]) => ({
2464
+ id: await createHash(`${group}-${color}`),
2465
+ name: color,
2466
+ selectedTokenSets: {
2467
+ [`semantic/modes/${group}-color/${color}`]: TokenSetStatus.ENABLED
2468
+ },
2469
+ group: `${capitalize(group)} color`
2470
+ })
2471
+ )
2472
+ );
2473
+ }
2474
+ function generateTypographyGroup(themes) {
2475
+ return [
2476
+ {
2477
+ id: "368d753fcac4455f289500eaa42e70dc0a03522f",
2478
+ $figmaCollectionId: "VariableCollectionId:36248:20769",
2479
+ $figmaModeId: "36248:2",
2480
+ name: "Primary",
2481
+ selectedTokenSets: Object.fromEntries(
2482
+ themes.map((theme) => [`primitives/modes/typography/primary/${theme}`, TokenSetStatus.ENABLED])
2483
+ ),
2484
+ group: "Typography"
2485
+ },
2486
+ {
2487
+ id: "264b8bd1d40b364e1ea3acf09e49795ddd4c513c",
2488
+ $figmaCollectionId: "VariableCollectionId:36248:20769",
2489
+ $figmaModeId: "36248:3",
2490
+ name: "Secondary",
2491
+ selectedTokenSets: Object.fromEntries(
2492
+ themes.map((theme) => [`primitives/modes/typography/secondary/${theme}`, TokenSetStatus.ENABLED])
2493
+ ),
2494
+ group: "Typography"
2495
+ }
2496
+ ];
2497
+ }
2498
+
2499
+ // src/tokens/process/platform.ts
2500
+ import chalk2 from "chalk";
2501
+ import * as R18 from "ramda";
2502
+ import StyleDictionary2 from "style-dictionary";
2503
+
2504
+ // src/tokens/types.ts
2505
+ var colorCategories = {
2506
+ main: "main",
2507
+ support: "support"
2508
+ };
2509
+
2510
+ // src/tokens/process/configs.ts
2511
+ import { register } from "@tokens-studio/sd-transforms";
2512
+ import * as R17 from "ramda";
2513
+ import StyleDictionary from "style-dictionary";
2514
+
2515
+ // src/tokens/utils.ts
2516
+ import * as R7 from "ramda";
2517
+ var mapToLowerCase = R7.map(R7.toLower);
2518
+ var hasAnyTruth = R7.any(R7.equals(true));
2519
+ var getType = (token) => (token.$type ?? token.type) || "";
2520
+ var getValue = (token) => token.$value ?? token.value;
2521
+ var typeEquals = R7.curry((types, token) => {
2522
+ if (R7.isNil(token)) {
2523
+ return false;
2524
+ }
2525
+ return R7.includes(R7.toLower(getType(token)), R7.map(R7.toLower, Array.isArray(types) ? types : [types]));
2526
+ });
2527
+ var pathStartsWithOneOf = R7.curry((paths, token) => {
2528
+ if (R7.isNil(token)) {
2529
+ return false;
2530
+ }
2531
+ const tokenPath = mapToLowerCase(token.path);
2532
+ const matchPathsStartingWith = R7.map((path) => R7.startsWith([path], tokenPath), mapToLowerCase(paths));
2533
+ return hasAnyTruth(matchPathsStartingWith);
2534
+ });
2535
+ function isSemanticToken(token) {
2536
+ return token.filePath.includes("semantic/");
2537
+ }
2538
+ function isSemanticColorToken(token, color) {
2539
+ return token.filePath.includes("semantic/") && R7.startsWith(["color", color], token.path);
2540
+ }
2541
+ function isGlobalColorToken(token) {
2542
+ return typeEquals("color", token) && pathStartsWithOneOf(["global"], token);
2543
+ }
2544
+ function isColorCategoryToken(token, category) {
2545
+ if (!category) {
2546
+ return ["main", "support"].some((c) => isColorCategoryToken(token, c));
2547
+ }
2548
+ return R7.startsWith(["color", category], token.path);
2549
+ }
2550
+ var isDigit = (s) => /^\d+$/.test(s);
2551
+ function traverseObj(obj, fn) {
2552
+ for (const key in obj) {
2553
+ const prop = obj[key];
2554
+ if (prop != null) {
2555
+ fn.apply(null, [obj, key, prop]);
2556
+ if (typeof prop === "object") {
2557
+ traverseObj(prop, fn);
2558
+ }
2559
+ }
2560
+ }
2561
+ return obj;
2562
+ }
2563
+ function inlineTokens(shouldInline, tokens) {
2564
+ const [inlineableTokens, otherTokens] = R7.partition(shouldInline, tokens);
2565
+ return otherTokens.map((token) => {
2566
+ let transformed = getValue(token.original);
2567
+ for (const ref of inlineableTokens) {
2568
+ const refName = ref.path.join(".");
2569
+ if (typeof transformed === "string") {
2570
+ transformed = transformed.replaceAll(`{${refName}}`, getValue(ref.original));
2571
+ }
2572
+ }
2573
+ const tokenWithInlinedRefs = R7.set(R7.lensPath(["original", "$value"]), transformed, token);
2574
+ return tokenWithInlinedRefs;
2575
+ });
2576
+ }
2577
+
2578
+ // src/tokens/process/configs/color.ts
2579
+ import * as R12 from "ramda";
2580
+
2581
+ // src/tokens/process/formats/css/color.ts
2582
+ import * as R8 from "ramda";
2583
+ import { createPropertyFormatter } from "style-dictionary/utils";
2584
+ var prefersColorScheme = (colorScheme2, content) => `
2585
+ @media (prefers-color-scheme: ${colorScheme2}) {
2586
+ [data-color-scheme="auto"] ${content}
2587
+ }
2588
+ `;
2589
+ var colorScheme = {
2590
+ name: "ds/css-colorscheme",
2591
+ format: async ({ dictionary, file, options, platform }) => {
2592
+ const { allTokens } = dictionary;
2593
+ const { outputReferences, usesDtcg } = options;
2594
+ const { selector, colorScheme: colorScheme2, layer } = platform;
2595
+ const colorScheme_ = colorScheme2;
2596
+ const format = createPropertyFormatter({
2597
+ outputReferences,
2598
+ dictionary,
2599
+ format: "css",
2600
+ usesDtcg
2601
+ });
2602
+ const colorSchemeProperty = colorScheme_ === "dark" || colorScheme_ === "light" ? `
2603
+ color-scheme: ${colorScheme_};
2604
+ ` : "";
2605
+ const filteredAllTokens = allTokens.filter(
2606
+ R8.allPass([
2607
+ R8.anyPass([
2608
+ // Include semantic tokens in the output
2609
+ isSemanticToken,
2610
+ // Include global color tokens
2611
+ isGlobalColorToken
2612
+ ]),
2613
+ // Don't include color category tokens -- they are exported separately
2614
+ (t) => !isColorCategoryToken(t)
2615
+ ])
2616
+ );
2617
+ const formattedTokens = filteredAllTokens.map(format).join("\n");
2618
+ const content = `{
2619
+ ${formattedTokens}
2620
+ ${colorSchemeProperty}}
2621
+ `;
2622
+ const autoSelectorContent = ["light", "dark"].includes(colorScheme_) ? prefersColorScheme(colorScheme_, content) : "";
2623
+ const body = R8.isNotNil(layer) ? `@layer ${layer} {
2624
+ ${selector} ${content} ${autoSelectorContent}
2625
+ }
2626
+ ` : `${selector} ${content} ${autoSelectorContent}
2627
+ `;
2628
+ return body;
2629
+ }
2630
+ };
2631
+ var colorCategory = {
2632
+ name: "ds/css-colorcategory",
2633
+ format: async ({ dictionary, file, options, platform }) => {
2634
+ const { outputReferences, usesDtcg } = options;
2635
+ const { selector, layer } = platform;
2636
+ const format = R8.compose(
2637
+ createPropertyFormatter({
2638
+ outputReferences,
2639
+ dictionary,
2640
+ format: "css",
2641
+ usesDtcg
2642
+ }),
2643
+ (token) => ({
2644
+ ...token,
2645
+ name: token.name.replace(/color-\w+-/, "color-"),
2646
+ original: {
2647
+ ...token.original,
2648
+ $value: new RegExp(`color-(${colorCategories.main}|${colorCategories.support})-`).test(token.name) ? token.original.$value : `{${token.path.join(".")}}`
2649
+ }
2650
+ })
2651
+ );
2652
+ const formattedTokens = dictionary.allTokens.map(format).join("\n");
2653
+ const content = `{
2654
+ ${formattedTokens}
2655
+ }
2656
+ `;
2657
+ const body = R8.isNotNil(layer) ? `@layer ${layer} {
2658
+ ${selector} ${content}
2659
+ }
2660
+ ` : `${selector} ${content}
2661
+ `;
2662
+ return body;
2663
+ }
2664
+ };
2665
+
2666
+ // src/tokens/process/formats/css/semantic.ts
2667
+ import * as R9 from "ramda";
2668
+ import { createPropertyFormatter as createPropertyFormatter2 } from "style-dictionary/utils";
2669
+ var isNumericBorderRadiusToken = (t) => t.path[0] === "border-radius" && isDigit(t.path[1]);
2670
+ var isNumericSizeToken = (t) => pathStartsWithOneOf(["size"], t) && isDigit(t.path[1]);
2671
+ var isSizeToken = (t) => pathStartsWithOneOf(["size"], t);
2672
+ var isInlineTokens = R9.anyPass([isNumericBorderRadiusToken, isNumericSizeToken, isSizeToken]);
2673
+ var overrideSizingFormula = (format, token) => {
2674
+ const [name, value] = format(token).split(":");
2675
+ const calc = value.replace(`var(--ds-size-mode-font-size)`, "1em").replace(/floor\((.*)\);/, "calc($1)");
2676
+ const round = `round(down, ${calc}, 0.0625rem)`;
2677
+ return {
2678
+ name,
2679
+ round,
2680
+ calc
2681
+ };
2682
+ };
2683
+ var formatSizingTokens = (format, tokens) => {
2684
+ const { round, calc } = R9.reduce(
2685
+ (acc, token) => {
2686
+ const { round: round2, calc: calc2, name } = overrideSizingFormula(format, token);
2687
+ return {
2688
+ round: [...acc.round, `${name}: ${round2};`],
2689
+ calc: [...acc.calc, `${name}: ${calc2};`]
2690
+ };
2691
+ },
2692
+ { round: [], calc: [] },
2693
+ tokens
2694
+ );
2695
+ return `
2696
+ ${calc.join("\n")}
2697
+
2698
+ @supports (width: round(down, .1em, 1px)) {
2699
+ ${round.join("\n")}
2700
+ }`;
2701
+ };
2702
+ var semantic = {
2703
+ name: "ds/css-semantic",
2704
+ format: async ({ dictionary, file, options, platform }) => {
2705
+ const { outputReferences, usesDtcg } = options;
2706
+ const { selector, layer } = platform;
2707
+ const format = createPropertyFormatter2({
2708
+ outputReferences,
2709
+ dictionary,
2710
+ format: "css",
2711
+ usesDtcg
2712
+ });
2713
+ const tokens = inlineTokens(isInlineTokens, dictionary.allTokens);
2714
+ const filteredTokens = R9.reject((token) => token.name.includes("ds-size-mode-font-size"), tokens);
2715
+ const [sizingTokens, restTokens] = R9.partition(
2716
+ (t) => pathStartsWithOneOf(["_size"], t) && isDigit(t.path[1]),
2717
+ filteredTokens
2718
+ );
2719
+ const formattedTokens = [R9.map(format, restTokens).join("\n"), formatSizingTokens(format, sizingTokens)];
2720
+ const content = `{
2721
+ ${formattedTokens.join("\n")}
2722
+ }
2723
+ `;
2724
+ const body = R9.isNotNil(layer) ? `@layer ${layer} {
2725
+ ${selector} ${content}
2726
+ }
2727
+ ` : `${selector} ${content}
2728
+ `;
2729
+ return body;
2730
+ }
2731
+ };
2732
+
2733
+ // src/tokens/process/formats/css/typography.ts
2734
+ import * as R10 from "ramda";
2735
+ import { createPropertyFormatter as createPropertyFormatter3 } from "style-dictionary/utils";
2736
+ var typographyFontFamilyPredicate = R10.allPass([
2737
+ R10.pathSatisfies(R10.includes("typography"), ["path"]),
2738
+ R10.pathSatisfies(R10.includes("fontFamily"), ["path"])
2739
+ ]);
2740
+ var typography = {
2741
+ name: "ds/css-typography",
2742
+ format: async ({ dictionary, file, options, platform }) => {
2743
+ const { outputReferences, usesDtcg } = options;
2744
+ const { selector, layer } = platform;
2745
+ const format = createPropertyFormatter3({
2746
+ outputReferences,
2747
+ dictionary,
2748
+ format: "css",
2749
+ usesDtcg
2750
+ });
2751
+ const filteredTokens = R10.reject(typographyFontFamilyPredicate, dictionary.allTokens);
2752
+ const formattedTokens = R10.pipe(R10.map(format), R10.join("\n"))(filteredTokens);
2753
+ const content = selector ? `${selector} {
2754
+ ${formattedTokens}
2755
+ }` : formattedTokens;
2756
+ const body = R10.isNotNil(layer) ? `@layer ${layer} {
2757
+ ${content}
2758
+ }` : content;
2759
+ return body;
2760
+ }
2761
+ };
2762
+
2763
+ // src/tokens/process/formats/css.ts
2764
+ var formats = {
2765
+ colorScheme,
2766
+ colorCategory,
2767
+ semantic,
2768
+ typography
2769
+ };
2770
+
2771
+ // src/tokens/process/transformers.ts
2772
+ import { checkAndEvaluateMath } from "@tokens-studio/sd-transforms";
2773
+ import * as R11 from "ramda";
2774
+ var isPx = R11.test(/\b\d+px\b/g);
2775
+ var sizeRem = {
2776
+ name: "ds/size/toRem",
2777
+ type: "value",
2778
+ transitive: true,
2779
+ filter: (token) => {
2780
+ const hasWantedType = typeEquals(["dimension", "fontsize"], token);
2781
+ const hasWantedPath = pathStartsWithOneOf(["spacing", "sizing", "border-radius", "font-size"], token);
2782
+ return hasWantedType && hasWantedPath;
2783
+ },
2784
+ transform: (token, config) => {
2785
+ const value = getValue(token);
2786
+ if (isPx(value)) {
2787
+ const baseFont = config.basePxFontSize || 16;
2788
+ const size = parseInt(value);
2789
+ if (size === 0) {
2790
+ return "0";
2791
+ }
2792
+ return `${size / baseFont}rem`;
2793
+ }
2794
+ return value;
2795
+ }
2796
+ };
2797
+ var typographyName = {
2798
+ name: "name/typography",
2799
+ type: "name",
2800
+ transitive: true,
2801
+ // expanded tokens have different type so we match on path instead
2802
+ filter: (token) => pathStartsWithOneOf(["typography"], token),
2803
+ transform: (token) => {
2804
+ return token.name.replace("-typography", "");
2805
+ }
2806
+ };
2807
+ var resolveMath = {
2808
+ name: "ds/resolveMath",
2809
+ type: "value",
2810
+ transitive: true,
2811
+ filter: (token) => {
2812
+ const isValidValue = ["string", "object"].includes(typeof getValue(token));
2813
+ const isTokenOfInterest = !pathStartsWithOneOf(["border-radius"], token);
2814
+ return isValidValue && isTokenOfInterest;
2815
+ },
2816
+ transform: (token, platformCfg) => checkAndEvaluateMath(token, platformCfg.mathFractionDigits)
2817
+ };
2818
+ var unitless = {
2819
+ name: "ds/unitless",
2820
+ type: "value",
2821
+ transitive: true,
2822
+ filter: (token) => pathStartsWithOneOf(["size", "_size"], token),
2823
+ transform: (token) => parseInt(getValue(token))
2824
+ };
2825
+
2826
+ // src/tokens/process/configs/shared.ts
2827
+ var prefix = "ds";
2828
+ var basePxFontSize = 16;
2829
+ var dsTransformers = [
2830
+ "name/kebab",
2831
+ resolveMath.name,
2832
+ "ts/size/px",
2833
+ sizeRem.name,
2834
+ unitless.name,
2835
+ "ts/typography/fontWeight",
2836
+ typographyName.name,
2837
+ "ts/color/modifiers",
2838
+ "ts/color/css/hexrgba",
2839
+ "ts/size/lineheight",
2840
+ "shadow/css/shorthand"
2841
+ ];
2842
+
2843
+ // src/tokens/process/configs/color.ts
2844
+ var colorSchemeVariables = ({ "color-scheme": colorScheme2 = "light", theme }) => {
2845
+ const selector = `${colorScheme2 === "light" ? ":root, " : ""}[data-color-scheme="${colorScheme2}"]`;
2846
+ const layer = `ds.theme.color-scheme.${colorScheme2}`;
2847
+ return {
2848
+ preprocessors: ["tokens-studio"],
2849
+ platforms: {
2850
+ css: {
2851
+ // custom
2852
+ colorScheme: colorScheme2,
2853
+ theme,
2854
+ selector,
2855
+ layer,
2856
+ //
2857
+ prefix,
2858
+ buildPath: `${theme}/`,
2859
+ transforms: dsTransformers,
2860
+ files: [
2861
+ {
2862
+ destination: `color-scheme/${colorScheme2}.css`,
2863
+ format: formats.colorScheme.name,
2864
+ filter: (token) => typeEquals("color", token) && !R12.startsWith(["global"], token.path)
2865
+ }
2866
+ ],
2867
+ options: {
2868
+ outputReferences: false
2869
+ }
2870
+ }
2871
+ }
2872
+ };
2873
+ };
2874
+ var colorCategoryVariables = (opts) => ({ "color-scheme": colorScheme2, theme, ...permutation }) => {
2875
+ const category = opts.category;
2876
+ const color = category === "builtin" ? opts.color : permutation[`${category}-color`];
2877
+ if (!color) {
2878
+ throw new Error(
2879
+ category === "builtin" ? `Missing color for built-in color ${opts.color}` : `Missing color for category ${category}`
2880
+ );
2881
+ }
2882
+ const layer = `ds.theme.color`;
2883
+ const isRootColor = color === buildOptions?.rootColor;
2884
+ const selector = isRootColor ? `:root, [data-color-scheme], [data-color="${color}"]` : `[data-color="${color}"], [data-color-scheme][data-color="${color}"]`;
2885
+ const config = {
2886
+ preprocessors: ["tokens-studio"],
2887
+ platforms: {
2888
+ css: {
2889
+ // custom
2890
+ colorScheme: colorScheme2,
2891
+ theme,
2892
+ selector,
2893
+ layer,
2894
+ //
2895
+ prefix,
2896
+ buildPath: `${theme}/`,
2897
+ transforms: dsTransformers,
2898
+ files: [
2899
+ {
2900
+ destination: `color/${color}.css`,
2901
+ format: formats.colorCategory.name,
2902
+ filter: (token) => category === "builtin" ? isSemanticColorToken(token, color) : isColorCategoryToken(token, category)
2903
+ }
2904
+ ],
2905
+ options: {
2906
+ outputReferences: true
2907
+ }
2908
+ }
2909
+ }
2910
+ };
2911
+ return config;
2912
+ };
2913
+
2914
+ // src/tokens/process/configs/semantic.ts
2915
+ import * as R13 from "ramda";
2916
+ import { outputReferencesFilter } from "style-dictionary/utils";
2917
+ var semanticVariables = ({ theme }) => {
2918
+ const selector = `:root`;
2919
+ const layer = `ds.theme.semantic`;
2920
+ return {
2921
+ preprocessors: ["tokens-studio"],
2922
+ platforms: {
2923
+ css: {
2924
+ // custom
2925
+ theme,
2926
+ basePxFontSize,
2927
+ selector,
2928
+ layer,
2929
+ //
2930
+ prefix,
2931
+ buildPath: `${theme}/`,
2932
+ transforms: dsTransformers,
2933
+ files: [
2934
+ {
2935
+ destination: `semantic.css`,
2936
+ format: formats.semantic.name,
2937
+ filter: (token) => {
2938
+ const isUwantedToken = R13.anyPass([R13.includes("primitives/global")])(token.filePath);
2939
+ const isPrivateToken = R13.includes("_", token.path);
2940
+ const unwantedPaths = pathStartsWithOneOf(["font-size", "line-height", "letter-spacing"], token);
2941
+ const unwantedTypes = typeEquals(["color", "fontWeight", "fontFamily", "typography"], token);
2942
+ const unwantedTokens = !(unwantedPaths || unwantedTypes || isPrivateToken || isUwantedToken);
2943
+ return unwantedTokens;
2944
+ }
2945
+ }
2946
+ ],
2947
+ options: {
2948
+ outputReferences: (token, options) => {
2949
+ const include = pathStartsWithOneOf(["border-radius"], token);
2950
+ const isWantedSize = pathStartsWithOneOf(["size", "_size"], token) && isDigit(token.path[1]);
2951
+ return (include || isWantedSize) && outputReferencesFilter(token, options);
2952
+ }
2953
+ }
2954
+ }
2955
+ }
2956
+ };
2957
+ };
2958
+
2959
+ // src/tokens/process/configs/storefront.ts
2960
+ import * as R15 from "ramda";
2961
+ import { outputReferencesFilter as outputReferencesFilter2 } from "style-dictionary/utils";
2962
+
2963
+ // src/tokens/process/formats/js-tokens.ts
2964
+ import * as R14 from "ramda";
2965
+ import { createPropertyFormatter as createPropertyFormatter4, fileHeader } from "style-dictionary/utils";
2966
+ var groupByType = R14.groupBy((token) => getType(token));
2967
+ var removeUnwatedTokens = R14.pipe(
2968
+ R14.reject((token) => isColorCategoryToken(token)),
2969
+ R14.reject((token) => R14.any((path) => path.startsWith("_"))(token.path))
2970
+ );
2971
+ var dissocExtensions = R14.pipe(R14.dissoc("$extensions"), R14.dissocPath(["original", "$extensions"]));
2972
+ var removeUnwatedProps = R14.map((token) => dissocExtensions(token));
2973
+ var toCssVarName = R14.pipe(R14.split(":"), R14.head, R14.trim);
2974
+ var jsTokens = {
2975
+ name: "ds/js-tokens",
2976
+ format: async ({ dictionary, file, options }) => {
2977
+ const { usesDtcg, outputReferences } = options;
2978
+ const format = createPropertyFormatter4({
2979
+ outputReferences,
2980
+ dictionary,
2981
+ format: "css",
2982
+ usesDtcg
2983
+ });
2984
+ const formatTokens2 = R14.map((token) => {
2985
+ if (pathStartsWithOneOf(["size", "_size"], token)) {
2986
+ const { calc, name } = overrideSizingFormula(format, token);
2987
+ return {
2988
+ ...token,
2989
+ name: name.trim(),
2990
+ $value: calc.trim()
2991
+ };
2992
+ }
2993
+ return {
2994
+ ...token,
2995
+ name: toCssVarName(format(token))
2996
+ };
2997
+ });
2998
+ const processTokens = R14.pipe(removeUnwatedTokens, removeUnwatedProps, formatTokens2, groupByType);
2999
+ const tokens = processTokens(inlineTokens(isInlineTokens, dictionary.allTokens));
3000
+ const content = Object.entries(tokens).map(
3001
+ ([name, token]) => `export const ${name} = ${JSON.stringify(token, null, 2).replace(/"([^"]+)":/g, "$1:")}
3002
+ `
3003
+ ).join("\n");
3004
+ return fileHeader({ file }).then((fileHeaderText) => fileHeaderText + content);
3005
+ }
3006
+ };
3007
+
3008
+ // src/tokens/process/configs/storefront.ts
3009
+ var typescriptTokens = ({ "color-scheme": colorScheme2, theme }) => {
3010
+ return {
3011
+ preprocessors: ["tokens-studio"],
3012
+ platforms: {
3013
+ ts: {
3014
+ prefix,
3015
+ basePxFontSize,
3016
+ transforms: dsTransformers,
3017
+ buildPath: `${theme}/`,
3018
+ files: [
3019
+ {
3020
+ destination: `${colorScheme2}.ts`,
3021
+ format: jsTokens.name,
3022
+ filter: (token) => {
3023
+ if (pathStartsWithOneOf(["border-width", "letter-spacing", "border-radius"], token) && !R15.includes("semantic", token.filePath))
3024
+ return false;
3025
+ const isSemanticColor = R15.includes("semantic", token.filePath) && typeEquals(["color"], token);
3026
+ const wantedTypes = typeEquals(["shadow", "dimension", "typography", "opacity"], token);
3027
+ return isSemanticColor || wantedTypes;
3028
+ }
3029
+ }
3030
+ ],
3031
+ options: {
3032
+ outputReferences: (token, options) => {
3033
+ const include = pathStartsWithOneOf(["border-radius"], token);
3034
+ const isWantedSize = pathStartsWithOneOf(["size", "_size"], token) && isDigit(token.path[1]);
3035
+ return (include || isWantedSize) && outputReferencesFilter2(token, options);
3036
+ }
3037
+ }
3038
+ }
3039
+ }
3040
+ };
3041
+ };
3042
+
3043
+ // src/tokens/process/configs/typography.ts
3044
+ import { expandTypesMap } from "@tokens-studio/sd-transforms";
3045
+ var typographyVariables = ({ theme, typography: typography2 }) => {
3046
+ const selector = `${typography2 === "primary" ? ":root, " : ""}[data-typography="${typography2}"]`;
3047
+ const layer = `ds.theme.typography.${typography2}`;
3048
+ return {
3049
+ usesDtcg: true,
3050
+ preprocessors: ["tokens-studio"],
3051
+ expand: {
3052
+ include: ["typography"],
3053
+ typesMap: { ...expandTypesMap, typography: { ...expandTypesMap.typography, letterSpacing: "dimension" } }
3054
+ },
3055
+ platforms: {
3056
+ css: {
3057
+ prefix,
3058
+ typography: typography2,
3059
+ selector,
3060
+ layer,
3061
+ buildPath: `${theme}/`,
3062
+ basePxFontSize,
3063
+ transforms: [
3064
+ "name/kebab",
3065
+ "ts/size/px",
3066
+ sizeRem.name,
3067
+ "ts/size/lineheight",
3068
+ "ts/typography/fontWeight",
3069
+ typographyName.name
3070
+ ],
3071
+ files: [
3072
+ {
3073
+ destination: `typography/${typography2}.css`,
3074
+ format: formats.typography.name,
3075
+ filter: (token) => {
3076
+ const included = typeEquals(
3077
+ ["typography", "fontweight", "fontFamily", "lineHeight", "dimension", "font", "fontsize"],
3078
+ token
3079
+ );
3080
+ if (/primitives\/modes\/typography\/(primary|secondary)/.test(token.filePath)) return false;
3081
+ return included && !pathStartsWithOneOf(["spacing", "sizing", "size", "_size", "border-width", "border-radius"], token);
3082
+ }
3083
+ }
3084
+ ]
3085
+ }
3086
+ }
3087
+ };
3088
+ };
3089
+
3090
+ // src/tokens/process/utils/getMultidimensionalThemes.ts
3091
+ import chalk from "chalk";
3092
+ import { kebabCase } from "change-case";
3093
+ import * as R16 from "ramda";
3094
+ var getMultidimensionalThemes = (processed$themes, dimensions) => {
3095
+ const verboseLogging = buildOptions?.verbose;
3096
+ const grouped$themes = groupThemes(processed$themes);
3097
+ const permutations = permutateThemes(grouped$themes);
3098
+ const ALL_DEPENDENT_ON = ["theme"];
3099
+ const keys2 = R16.keys(grouped$themes);
3100
+ const nonDependentKeys = keys2.filter((x) => ![...ALL_DEPENDENT_ON, ...dimensions].includes(x));
3101
+ if (verboseLogging) {
3102
+ console.log(chalk.cyan(`\u{1F50E} Finding theme permutations for ${dimensions}`));
3103
+ console.log(chalk.cyan(` (ignoring permutations for ${nonDependentKeys})`));
3104
+ }
3105
+ return permutations.filter((val) => {
3106
+ const filters = nonDependentKeys.map((x) => val.permutation[x] === grouped$themes[x][0].name);
3107
+ return filters.every((x) => x);
3108
+ });
3109
+ };
3110
+ var processed = Symbol("Type brand for ProcessedThemeObject");
3111
+ function isProcessed(theme) {
3112
+ return Boolean(theme[processed]);
3113
+ }
3114
+ function processThemeObject(theme) {
3115
+ if (isProcessed(theme)) {
3116
+ return theme;
3117
+ }
3118
+ const result = { ...theme, [processed]: true };
3119
+ if (result.group) {
3120
+ result.group = kebabCase(result.group);
3121
+ }
3122
+ result.name = kebabCase(result.name);
3123
+ return result;
3124
+ }
3125
+ function groupThemes(themes) {
3126
+ const groups = {};
3127
+ for (const rawTheme of themes) {
3128
+ const theme = processThemeObject(rawTheme);
3129
+ if (theme.group) {
3130
+ const groupKey = theme.group;
3131
+ groups[groupKey] = [...groups[groupKey] ?? [], theme];
3132
+ } else {
3133
+ throw new Error(
3134
+ `Theme ${theme.name} does not have a group property, which is required for multi-dimensional theming.`
3135
+ );
3136
+ }
3137
+ }
3138
+ return groups;
3139
+ }
3140
+ var hasUnknownProps = R16.pipe(R16.values, R16.none(R16.equals("unknown")), R16.not);
3141
+ function permutateThemes(groups) {
3142
+ const separator = "_";
3143
+ const permutations = cartesian(Object.values(groups));
3144
+ const permutatedThemes = permutations.map((perm) => {
3145
+ const permutatedTheme = perm.reduce(
3146
+ (acc, theme) => {
3147
+ const { group, name, selectedTokenSets } = theme;
3148
+ let updatedPermutation = acc.permutation;
3149
+ if (group) {
3150
+ const groupProp = R16.lensProp(group);
3151
+ updatedPermutation = R16.set(groupProp, name, updatedPermutation);
3152
+ }
3153
+ const updatedName = `${String(acc.name)}${acc ? separator : ""}${name}`;
3154
+ const sets = [...acc.selectedTokenSets, ...filterTokenSets(selectedTokenSets)];
3155
+ return {
3156
+ permutation: updatedPermutation,
3157
+ name: updatedName,
3158
+ selectedTokenSets: sets
3159
+ };
3160
+ },
3161
+ {
3162
+ name: "",
3163
+ selectedTokenSets: [],
3164
+ permutation: {
3165
+ "color-scheme": "unknown",
3166
+ "main-color": "unknown",
3167
+ "support-color": "unknown",
3168
+ theme: "unknown",
3169
+ semantic: "unknown",
3170
+ size: "unknown",
3171
+ typography: "unknown"
3172
+ }
3173
+ }
3174
+ );
3175
+ if (hasUnknownProps(permutatedTheme)) {
3176
+ throw Error(`Theme ${permutatedTheme.name} has unknown props: ${JSON.stringify(permutatedTheme)}`);
3177
+ }
3178
+ const uniqueTokenSets = new Set(permutatedTheme.selectedTokenSets);
3179
+ return { ...permutatedTheme, selectedTokenSets: Array.from(uniqueTokenSets) };
3180
+ });
3181
+ return permutatedThemes;
3182
+ }
3183
+ function filterTokenSets(tokensets) {
3184
+ return Object.entries(tokensets).filter(([, val]) => val !== TokenSetStatus.DISABLED).sort((a, b) => {
3185
+ if (a[1] === TokenSetStatus.SOURCE && b[1] === TokenSetStatus.ENABLED) {
3186
+ return -1;
3187
+ }
3188
+ if (a[1] === TokenSetStatus.ENABLED && b[1] === TokenSetStatus.SOURCE) {
3189
+ return 1;
3190
+ }
3191
+ return 0;
3192
+ }).map((entry) => entry[0]);
3193
+ }
3194
+ function cartesian(a) {
3195
+ return a.reduce((a2, b) => a2.flatMap((d) => b.map((e) => [d, e].flat())));
3196
+ }
3197
+
3198
+ // src/tokens/process/configs.ts
3199
+ void register(StyleDictionary, { withSDBuiltins: false });
3200
+ StyleDictionary.registerTransform(sizeRem);
3201
+ StyleDictionary.registerTransform(typographyName);
3202
+ StyleDictionary.registerTransform(resolveMath);
3203
+ StyleDictionary.registerTransform(unitless);
3204
+ StyleDictionary.registerFormat(jsTokens);
3205
+ for (const format of Object.values(formats)) {
3206
+ StyleDictionary.registerFormat(format);
3207
+ }
3208
+ var configs = {
3209
+ colorSchemeVariables,
3210
+ mainColorVariables: colorCategoryVariables({ category: "main" }),
3211
+ supportColorVariables: colorCategoryVariables({ category: "support" }),
3212
+ neutralColorVariables: colorCategoryVariables({ category: "builtin", color: "neutral" }),
3213
+ successColorVariables: colorCategoryVariables({ category: "builtin", color: "success" }),
3214
+ dangerColorVariables: colorCategoryVariables({ category: "builtin", color: "danger" }),
3215
+ warningColorVariables: colorCategoryVariables({ category: "builtin", color: "warning" }),
3216
+ infoColorVariables: colorCategoryVariables({ category: "builtin", color: "info" }),
3217
+ typographyVariables,
3218
+ semanticVariables,
3219
+ typescriptTokens
3220
+ };
3221
+ var getConfigsForThemeDimensions = (getConfig, processed$themes, dimensions, options) => {
3222
+ const { tokensDir, tokenSets } = options;
3223
+ const permutations = getMultidimensionalThemes(processed$themes, dimensions);
3224
+ return permutations.flatMap(({ selectedTokenSets, permutation }) => {
3225
+ const tokenSource = { source: void 0, tokens: {} };
3226
+ if (tokenSets) {
3227
+ for (const tokenSet of selectedTokenSets) {
3228
+ const tokens = tokenSets.get(tokenSet);
3229
+ if (tokens) {
3230
+ const tokensWithFilePath = traverseObj(tokens, (obj) => {
3231
+ if (Object.hasOwn(obj, `$value`) && !obj.filePath) {
3232
+ obj.filePath = tokenSet;
3233
+ }
3234
+ });
3235
+ tokenSource.tokens = R17.mergeDeepRight(tokenSource.tokens, tokensWithFilePath);
3236
+ }
3237
+ }
3238
+ } else {
3239
+ tokenSource.source = selectedTokenSets.map((x) => `${tokensDir}/${x}.json`);
3240
+ }
3241
+ const configOrConfigs = getConfig(permutation);
3242
+ const configs_ = Array.isArray(configOrConfigs) ? configOrConfigs : [{ config: configOrConfigs }];
3243
+ const configs2 = configs_.map(({ config, permutationOverrides }) => {
3244
+ return {
3245
+ permutation: { ...permutation, ...permutationOverrides },
3246
+ config: {
3247
+ ...config,
3248
+ /** Use official W3C design token format
3249
+ @see https://v4.styledictionary.com/info/dtcg/
3250
+ @see https://design-tokens.github.io/community-group/format/ */
3251
+ usesDtcg: true,
3252
+ log: {
3253
+ ...config?.log,
3254
+ verbosity: buildOptions?.verbose ? "verbose" : "silent"
3255
+ },
3256
+ ...tokenSource
3257
+ }
3258
+ };
3259
+ });
3260
+ return configs2;
3261
+ }).sort();
3262
+ };
3263
+
3264
+ // src/tokens/process/platform.ts
3265
+ var initResult = {
3266
+ formatted: [],
3267
+ permutation: {
3268
+ "color-scheme": "",
3269
+ "main-color": "",
3270
+ "support-color": "",
3271
+ semantic: "",
3272
+ size: "",
3273
+ theme: "",
3274
+ typography: ""
3275
+ }
3276
+ };
3277
+ var buildOptions;
3278
+ var sd = new StyleDictionary2();
3279
+ var getCustomColors = (processed$themes) => processed$themes.filter(
3280
+ (x) => x.group && [colorCategories.main, colorCategories.support].map((c) => `${c}-color`).includes(x.group)
3281
+ ).map((x) => x.name);
3282
+ var buildConfigs = {
3283
+ typography: { getConfig: configs.typographyVariables, dimensions: ["typography"] },
3284
+ "color-scheme": { getConfig: configs.colorSchemeVariables, dimensions: ["color-scheme"] },
3285
+ "main-color": { getConfig: configs.mainColorVariables, dimensions: ["main-color"] },
3286
+ "support-color": { getConfig: configs.supportColorVariables, dimensions: ["support-color"] },
3287
+ "neutral-color": {
3288
+ getConfig: configs.neutralColorVariables,
3289
+ dimensions: ["semantic"],
3290
+ log: ({ permutation: { theme } }) => `${theme} - neutral`
3291
+ },
3292
+ "success-color": {
3293
+ getConfig: configs.successColorVariables,
3294
+ dimensions: ["semantic"],
3295
+ log: ({ permutation: { theme } }) => `${theme} - success`
3296
+ },
3297
+ "danger-color": {
3298
+ getConfig: configs.dangerColorVariables,
3299
+ dimensions: ["semantic"],
3300
+ log: ({ permutation: { theme } }) => `${theme} - danger`
3301
+ },
3302
+ "warning-color": {
3303
+ getConfig: configs.warningColorVariables,
3304
+ dimensions: ["semantic"],
3305
+ log: ({ permutation: { theme } }) => `${theme} - warning`
3306
+ },
3307
+ "info-color": {
3308
+ getConfig: configs.infoColorVariables,
3309
+ dimensions: ["semantic"],
3310
+ log: ({ permutation: { theme } }) => `${theme} - info`
3311
+ },
3312
+ semantic: { getConfig: configs.semanticVariables, dimensions: ["semantic"] }
3313
+ // storefront: {
3314
+ // name: 'Storefront preview tokens',
3315
+ // getConfig: configs.typescriptTokens,
3316
+ // dimensions: ['color-scheme'],
3317
+ // options: { outPath: path.resolve('../../apps/storefront/tokens') },
3318
+ // enabled: () => buildOptions?.preview ?? false,
3319
+ // },
3320
+ };
3321
+ async function processPlatform(options) {
3322
+ const { dry, process, $themes } = options;
3323
+ const platform = "css";
3324
+ const tokenSets = process === "format" ? options.tokenSets : void 0;
3325
+ const tokensDir = process === "build" ? options.tokensDir : void 0;
3326
+ buildOptions = options;
3327
+ const processed$themes = $themes.map(processThemeObject).filter((theme) => R18.not(theme.group === "size" && theme.name !== "medium"));
3328
+ const customColors = getCustomColors(processed$themes);
3329
+ if (!buildOptions.rootColor) {
3330
+ const firstMainColor = R18.head(customColors);
3331
+ buildOptions.rootColor = firstMainColor;
3332
+ console.log(`Using first main color; ${chalk2.blue(firstMainColor)}, as ${chalk2.green(`":root"`)} color`);
3333
+ }
3334
+ const buildAndSdConfigs = R18.map((buildConfig) => {
3335
+ const sdConfigs = getConfigsForThemeDimensions(buildConfig.getConfig, processed$themes, buildConfig.dimensions, {
3336
+ tokensDir,
3337
+ tokenSets
3338
+ });
3339
+ const unknownConfigs = buildConfig.dimensions.map(
3340
+ (dimension) => sdConfigs.filter((x) => x.permutation[dimension] === "unknown")
3341
+ );
3342
+ for (const unknowns of unknownConfigs) {
3343
+ if (unknowns.length === sdConfigs.length) {
3344
+ buildConfig.enabled = () => false;
3345
+ }
3346
+ }
3347
+ return {
3348
+ buildConfig,
3349
+ sdConfigs
3350
+ };
3351
+ }, buildConfigs);
3352
+ const processedBuilds = {
3353
+ "color-scheme": [initResult],
3354
+ "main-color": [initResult],
3355
+ "support-color": [initResult],
3356
+ "neutral-color": [initResult],
3357
+ "success-color": [initResult],
3358
+ "danger-color": [initResult],
3359
+ "warning-color": [initResult],
3360
+ "info-color": [initResult],
3361
+ semantic: [initResult],
3362
+ typography: [initResult],
3363
+ types: [initResult]
3364
+ };
3365
+ try {
3366
+ for (const [buildName, { buildConfig, sdConfigs }] of R18.toPairs(buildAndSdConfigs)) {
3367
+ if (!(buildConfig.enabled?.() ?? true)) {
3368
+ continue;
3369
+ }
3370
+ if (sdConfigs.length > 0) {
3371
+ console.log(`
3372
+ \u{1F371} Building ${chalk2.green(buildConfig.name ?? buildName)}`);
3373
+ const results = await Promise.all(
3374
+ sdConfigs.map(async (sdConfig) => {
3375
+ const { config, permutation } = sdConfig;
3376
+ const modes = ["theme", ...buildConfig.dimensions];
3377
+ const modeMessage = modes.map((x) => permutation[x]).join(" - ");
3378
+ const logMessage = R18.isNil(buildConfig.log) ? modeMessage : buildConfig?.log(sdConfig);
3379
+ console.log(logMessage);
3380
+ const sdOptions = { cache: true };
3381
+ const sdExtended = await sd.extend(config);
3382
+ const result = {
3383
+ permutation,
3384
+ formatted: await sdExtended.formatPlatform(platform, sdOptions)
3385
+ };
3386
+ return Promise.resolve(result);
3387
+ })
3388
+ );
3389
+ processedBuilds[buildName] = results;
3390
+ }
3391
+ }
3392
+ } catch (err) {
3393
+ if (err instanceof Error) {
3394
+ err.message = err.message.replace('log.verbosity "verbose" or use ', "");
3395
+ }
3396
+ throw err;
3397
+ }
3398
+ const colorsFileName = "colors.d.ts";
3399
+ const reactColorTypes = await createColorTypeDeclaration(customColors);
3400
+ processedBuilds.types = [
3401
+ {
3402
+ ...initResult,
3403
+ formatted: [{ output: reactColorTypes, destination: colorsFileName }]
3404
+ }
3405
+ ];
3406
+ return processedBuilds;
3407
+ }
3408
+ async function createColorTypeDeclaration(colors) {
3409
+ console.log(`
3410
+ \u{1F371} Building ${chalk2.green("type declarations")}`);
3411
+ const typeDeclaration = `
3412
+ import type {} from '@digdir/designsystemet-react/colors';
3413
+
3414
+ declare module '@digdir/designsystemet-react/colors' {
3415
+ export interface MainAndSupportColors {
3416
+ ${colors.map((color) => ` ${color}: never;`).join("\n")}
3417
+ }
3418
+ }
3419
+ `.trimStart();
3420
+ return typeDeclaration;
3421
+ }
3422
+
3423
+ // src/tokens/format.ts
3424
+ var formatTokens = async (options) => {
3425
+ const processedBuilds = await processPlatform({
3426
+ process: "format",
3427
+ ...options
3428
+ });
3429
+ return processedBuilds;
3430
+ };
3431
+ var formatTheme = async (themeConfig) => {
3432
+ const { tokenSets } = await createTokens(themeConfig);
3433
+ const $themes = await generate$Themes(["dark", "light"], [themeConfig.name], themeConfig.colors);
3434
+ const processedBuilds = await formatTokens({
3435
+ tokenSets,
3436
+ $themes,
3437
+ verbose: false,
3438
+ preview: false
3439
+ });
3440
+ return processedBuilds;
3441
+ };
3442
+ var formatThemeCSS = async (themeConfig) => {
3443
+ const processedBuilds = await formatTheme(themeConfig);
3444
+ const themeCSSFiles = createThemeCSSFiles(processedBuilds);
3445
+ return R19.head(themeCSSFiles)?.output ?? "";
3446
+ };
3447
+ var createThemeCSSFiles = (processedBuilds) => {
3448
+ const groupedByTheme = {};
3449
+ for (const [_, buildResults] of Object.entries(R19.dissoc("types", processedBuilds))) {
3450
+ for (const buildResult of buildResults) {
3451
+ const previous = groupedByTheme[buildResult.permutation.theme] ?? [];
3452
+ groupedByTheme[buildResult.permutation.theme] = R19.concat(previous, buildResult.formatted);
3453
+ }
3454
+ }
3455
+ const sortOrder = [
3456
+ "color-scheme/light",
3457
+ "typography/secondary",
3458
+ "semantic",
3459
+ "color-scheme/dark",
3460
+ "color-scheme/contrast",
3461
+ "typography/primary",
3462
+ "color/"
3463
+ ];
3464
+ const sortByDefinedOrder = R19.sortBy((file) => {
3465
+ const filePath = file.destination || "";
3466
+ const sortIndex = sortOrder.findIndex((sortElement) => {
3467
+ if (sortElement.endsWith("/")) {
3468
+ return filePath.includes(sortElement);
3469
+ }
3470
+ return filePath.includes(`${sortElement}.css`);
3471
+ });
3472
+ if (sortIndex === -1) {
3473
+ console.error(
3474
+ chalk3.yellow("WARNING: CSS section does not have a defined sort order:", filePath.replace(".css", ""))
3475
+ );
3476
+ console.log(
3477
+ chalk3.dim(
3478
+ `
3479
+ The section will currently be added to the end of the entry file, but the exact
3480
+ order may change due to nondeterminism.`.trim()
3481
+ )
3482
+ );
3483
+ return Infinity;
3484
+ }
3485
+ return sortIndex;
3486
+ });
3487
+ const header = `@charset "UTF-8";
3488
+
3489
+ @layer ds.theme, ds.base, ds.utilities, ds.components;
3490
+
3491
+ /* This file is generated by ${package_default.name}@${package_default.version} */
3492
+
3493
+ `;
3494
+ const sortAlphabetically = R19.sort(R19.ascend((x) => x.destination || ""));
3495
+ const pickOutputs = R19.map(R19.view(R19.lensProp("output")));
3496
+ const themeCSSFile = R19.pipe(
3497
+ sortAlphabetically,
3498
+ sortByDefinedOrder,
3499
+ pickOutputs,
3500
+ R19.join("\n"),
3501
+ (content) => header + content
3502
+ );
3503
+ const themeCSSFiles = Object.entries(groupedByTheme).map(([theme, files]) => ({
3504
+ destination: `${theme}.css`,
3505
+ output: themeCSSFile(files)
3506
+ }));
3507
+ return themeCSSFiles;
3508
+ };
3509
+ export {
3510
+ createThemeCSSFiles,
3511
+ formatTheme,
3512
+ formatThemeCSS,
3513
+ formatTokens
3514
+ };