@und-ui/tokens 0.1.0 → 0.3.0

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 (247) hide show
  1. package/README.md +100 -11
  2. package/dist/android/values/und_colors.xml +204 -73
  3. package/dist/android/values/und_dimens.xml +15 -4
  4. package/dist/android/values-night/und_colors.xml +207 -76
  5. package/dist/css/base.css +610 -35
  6. package/dist/css/motion.css +129 -1
  7. package/dist/css/themes/butter.css +278 -0
  8. package/dist/css/themes/chocolate.css +255 -0
  9. package/dist/css/themes/gothic.css +710 -0
  10. package/dist/css/themes/kesar.css +1 -1
  11. package/dist/css/themes/matcha.css +291 -0
  12. package/dist/css/themes/mitti.css +1 -1
  13. package/dist/css/themes/nabh.css +179 -0
  14. package/dist/css/themes/neem.css +1 -1
  15. package/dist/css/themes/neutral.css +255 -0
  16. package/dist/css/themes/raat.css +35 -1
  17. package/dist/css/themes/stone.css +275 -0
  18. package/dist/css/themes/sutra.css +1 -1
  19. package/dist/css/themes/ujala.css +1 -1
  20. package/dist/css/themes/y2k.css +289 -0
  21. package/dist/css/tokens.css +2998 -1
  22. package/dist/dart/und_tokens.dart +11414 -320
  23. package/dist/js/contexts.js +1 -1
  24. package/dist/js/index.d.ts +583 -1
  25. package/dist/js/index.js +850 -157
  26. package/dist/json/flat/butter.dark.json +945 -0
  27. package/dist/json/flat/butter.darkMore.json +945 -0
  28. package/dist/json/flat/butter.light.json +945 -0
  29. package/dist/json/flat/butter.lightMore.json +945 -0
  30. package/dist/json/flat/chocolate.dark.json +945 -0
  31. package/dist/json/flat/chocolate.darkMore.json +945 -0
  32. package/dist/json/flat/chocolate.light.json +945 -0
  33. package/dist/json/flat/chocolate.lightMore.json +945 -0
  34. package/dist/json/flat/gothic.dark.json +945 -0
  35. package/dist/json/flat/gothic.darkMore.json +945 -0
  36. package/dist/json/flat/kesar.dark.json +207 -0
  37. package/dist/json/flat/kesar.darkMore.json +207 -0
  38. package/dist/json/flat/kesar.light.json +207 -0
  39. package/dist/json/flat/kesar.lightMore.json +207 -0
  40. package/dist/json/flat/matcha.dark.json +945 -0
  41. package/dist/json/flat/matcha.darkMore.json +945 -0
  42. package/dist/json/flat/matcha.light.json +945 -0
  43. package/dist/json/flat/matcha.lightMore.json +945 -0
  44. package/dist/json/flat/mitti.dark.json +207 -0
  45. package/dist/json/flat/mitti.darkMore.json +207 -0
  46. package/dist/json/flat/mitti.light.json +207 -0
  47. package/dist/json/flat/mitti.lightMore.json +207 -0
  48. package/dist/json/flat/nabh.dark.json +945 -0
  49. package/dist/json/flat/nabh.darkMore.json +945 -0
  50. package/dist/json/flat/nabh.light.json +945 -0
  51. package/dist/json/flat/nabh.lightMore.json +945 -0
  52. package/dist/json/flat/neem.dark.json +207 -0
  53. package/dist/json/flat/neem.darkMore.json +207 -0
  54. package/dist/json/flat/neem.light.json +207 -0
  55. package/dist/json/flat/neem.lightMore.json +207 -0
  56. package/dist/json/flat/neutral.dark.json +945 -0
  57. package/dist/json/flat/neutral.darkMore.json +945 -0
  58. package/dist/json/flat/neutral.light.json +945 -0
  59. package/dist/json/flat/neutral.lightMore.json +945 -0
  60. package/dist/json/flat/raat.dark.json +207 -0
  61. package/dist/json/flat/raat.darkMore.json +207 -0
  62. package/dist/json/flat/stone.dark.json +945 -0
  63. package/dist/json/flat/stone.darkMore.json +945 -0
  64. package/dist/json/flat/stone.light.json +945 -0
  65. package/dist/json/flat/stone.lightMore.json +945 -0
  66. package/dist/json/flat/sutra.dark.json +207 -0
  67. package/dist/json/flat/sutra.darkMore.json +207 -0
  68. package/dist/json/flat/sutra.light.json +207 -0
  69. package/dist/json/flat/sutra.lightMore.json +207 -0
  70. package/dist/json/flat/ujala.dark.json +207 -0
  71. package/dist/json/flat/ujala.darkMore.json +207 -0
  72. package/dist/json/flat/ujala.light.json +207 -0
  73. package/dist/json/flat/ujala.lightMore.json +207 -0
  74. package/dist/json/flat/y2k.dark.json +945 -0
  75. package/dist/json/flat/y2k.darkMore.json +945 -0
  76. package/dist/json/flat/y2k.light.json +945 -0
  77. package/dist/json/flat/y2k.lightMore.json +945 -0
  78. package/dist/json/nested/butter.dark.json +1177 -0
  79. package/dist/json/nested/butter.darkMore.json +1177 -0
  80. package/dist/json/nested/butter.light.json +1177 -0
  81. package/dist/json/nested/butter.lightMore.json +1177 -0
  82. package/dist/json/nested/chocolate.dark.json +1177 -0
  83. package/dist/json/nested/chocolate.darkMore.json +1177 -0
  84. package/dist/json/nested/chocolate.light.json +1177 -0
  85. package/dist/json/nested/chocolate.lightMore.json +1177 -0
  86. package/dist/json/nested/gothic.dark.json +1177 -0
  87. package/dist/json/nested/gothic.darkMore.json +1177 -0
  88. package/dist/json/nested/kesar.dark.json +295 -4
  89. package/dist/json/nested/kesar.darkMore.json +295 -4
  90. package/dist/json/nested/kesar.light.json +295 -4
  91. package/dist/json/nested/kesar.lightMore.json +295 -4
  92. package/dist/json/nested/matcha.dark.json +1177 -0
  93. package/dist/json/nested/matcha.darkMore.json +1177 -0
  94. package/dist/json/nested/matcha.light.json +1177 -0
  95. package/dist/json/nested/matcha.lightMore.json +1177 -0
  96. package/dist/json/nested/mitti.dark.json +295 -4
  97. package/dist/json/nested/mitti.darkMore.json +295 -4
  98. package/dist/json/nested/mitti.light.json +295 -4
  99. package/dist/json/nested/mitti.lightMore.json +295 -4
  100. package/dist/json/nested/nabh.dark.json +1177 -0
  101. package/dist/json/nested/nabh.darkMore.json +1177 -0
  102. package/dist/json/nested/nabh.light.json +1177 -0
  103. package/dist/json/nested/nabh.lightMore.json +1177 -0
  104. package/dist/json/nested/neem.dark.json +295 -4
  105. package/dist/json/nested/neem.darkMore.json +295 -4
  106. package/dist/json/nested/neem.light.json +295 -4
  107. package/dist/json/nested/neem.lightMore.json +295 -4
  108. package/dist/json/nested/neutral.dark.json +1177 -0
  109. package/dist/json/nested/neutral.darkMore.json +1177 -0
  110. package/dist/json/nested/neutral.light.json +1177 -0
  111. package/dist/json/nested/neutral.lightMore.json +1177 -0
  112. package/dist/json/nested/raat.dark.json +295 -4
  113. package/dist/json/nested/raat.darkMore.json +295 -4
  114. package/dist/json/nested/stone.dark.json +1177 -0
  115. package/dist/json/nested/stone.darkMore.json +1177 -0
  116. package/dist/json/nested/stone.light.json +1177 -0
  117. package/dist/json/nested/stone.lightMore.json +1177 -0
  118. package/dist/json/nested/sutra.dark.json +295 -4
  119. package/dist/json/nested/sutra.darkMore.json +295 -4
  120. package/dist/json/nested/sutra.light.json +295 -4
  121. package/dist/json/nested/sutra.lightMore.json +295 -4
  122. package/dist/json/nested/ujala.dark.json +295 -4
  123. package/dist/json/nested/ujala.darkMore.json +295 -4
  124. package/dist/json/nested/ujala.light.json +295 -4
  125. package/dist/json/nested/ujala.lightMore.json +295 -4
  126. package/dist/json/nested/y2k.dark.json +1177 -0
  127. package/dist/json/nested/y2k.darkMore.json +1177 -0
  128. package/dist/json/nested/y2k.light.json +1177 -0
  129. package/dist/json/nested/y2k.lightMore.json +1177 -0
  130. package/dist/kotlin/UndTokens.kt +15338 -2190
  131. package/dist/lib/build/formats/css.d.ts +7 -0
  132. package/dist/lib/build/formats/css.js +113 -3
  133. package/dist/lib/build/formats/dart.d.ts +0 -7
  134. package/dist/lib/build/formats/dart.js +22 -4
  135. package/dist/lib/build/formats/js.d.ts +0 -6
  136. package/dist/lib/build/formats/js.js +8 -1
  137. package/dist/lib/build/formats/kotlin.d.ts +1 -1
  138. package/dist/lib/build/formats/kotlin.js +43 -14
  139. package/dist/lib/build/formats/react-native.js +2 -1
  140. package/dist/lib/build/formats/swift.d.ts +0 -6
  141. package/dist/lib/build/formats/swift.js +78 -15
  142. package/dist/lib/build/formats/tailwind.js +22 -2
  143. package/dist/lib/build/index.js +6 -5
  144. package/dist/lib/build/native-model.d.ts +16 -0
  145. package/dist/lib/build/native-model.js +33 -0
  146. package/dist/lib/color/pairs.js +2 -1
  147. package/dist/lib/dtcg/engine.d.ts +6 -0
  148. package/dist/lib/dtcg/engine.js +21 -1
  149. package/dist/lib/source/generate.d.ts +3 -1
  150. package/dist/lib/source/generate.js +56 -7
  151. package/dist/lib/themes/aa.d.ts +44 -0
  152. package/dist/lib/themes/aa.js +168 -0
  153. package/dist/lib/themes/definitions.d.ts +21 -10
  154. package/dist/lib/themes/definitions.js +181 -5
  155. package/dist/lib/themes/generate.d.ts +47 -0
  156. package/dist/lib/themes/generate.js +329 -0
  157. package/dist/lib/themes/ported-map.d.ts +59 -0
  158. package/dist/lib/themes/ported-map.js +618 -0
  159. package/dist/lib/themes/ported.d.ts +10 -0
  160. package/dist/lib/themes/ported.js +1764 -0
  161. package/dist/react-native/index.d.ts +132 -1
  162. package/dist/react-native/tokens.js +16487 -1656
  163. package/dist/scss/_variables.scss +346 -138
  164. package/dist/scss/_vars.scss +208 -1
  165. package/dist/scss/butter.dark.scss +946 -0
  166. package/dist/scss/butter.darkMore.scss +946 -0
  167. package/dist/scss/butter.light.scss +946 -0
  168. package/dist/scss/butter.lightMore.scss +946 -0
  169. package/dist/scss/chocolate.dark.scss +946 -0
  170. package/dist/scss/chocolate.darkMore.scss +946 -0
  171. package/dist/scss/chocolate.light.scss +946 -0
  172. package/dist/scss/chocolate.lightMore.scss +946 -0
  173. package/dist/scss/gothic.dark.scss +946 -0
  174. package/dist/scss/gothic.darkMore.scss +946 -0
  175. package/dist/scss/kesar.dark.scss +207 -0
  176. package/dist/scss/kesar.darkMore.scss +207 -0
  177. package/dist/scss/kesar.light.scss +207 -0
  178. package/dist/scss/kesar.lightMore.scss +207 -0
  179. package/dist/scss/matcha.dark.scss +946 -0
  180. package/dist/scss/matcha.darkMore.scss +946 -0
  181. package/dist/scss/matcha.light.scss +946 -0
  182. package/dist/scss/matcha.lightMore.scss +946 -0
  183. package/dist/scss/mitti.dark.scss +207 -0
  184. package/dist/scss/mitti.darkMore.scss +207 -0
  185. package/dist/scss/mitti.light.scss +207 -0
  186. package/dist/scss/mitti.lightMore.scss +207 -0
  187. package/dist/scss/nabh.dark.scss +946 -0
  188. package/dist/scss/nabh.darkMore.scss +946 -0
  189. package/dist/scss/nabh.light.scss +946 -0
  190. package/dist/scss/nabh.lightMore.scss +946 -0
  191. package/dist/scss/neem.dark.scss +207 -0
  192. package/dist/scss/neem.darkMore.scss +207 -0
  193. package/dist/scss/neem.light.scss +207 -0
  194. package/dist/scss/neem.lightMore.scss +207 -0
  195. package/dist/scss/neutral.dark.scss +946 -0
  196. package/dist/scss/neutral.darkMore.scss +946 -0
  197. package/dist/scss/neutral.light.scss +946 -0
  198. package/dist/scss/neutral.lightMore.scss +946 -0
  199. package/dist/scss/raat.dark.scss +207 -0
  200. package/dist/scss/raat.darkMore.scss +207 -0
  201. package/dist/scss/stone.dark.scss +946 -0
  202. package/dist/scss/stone.darkMore.scss +946 -0
  203. package/dist/scss/stone.light.scss +946 -0
  204. package/dist/scss/stone.lightMore.scss +946 -0
  205. package/dist/scss/sutra.dark.scss +207 -0
  206. package/dist/scss/sutra.darkMore.scss +207 -0
  207. package/dist/scss/sutra.light.scss +207 -0
  208. package/dist/scss/sutra.lightMore.scss +207 -0
  209. package/dist/scss/ujala.dark.scss +207 -0
  210. package/dist/scss/ujala.darkMore.scss +207 -0
  211. package/dist/scss/ujala.light.scss +207 -0
  212. package/dist/scss/ujala.lightMore.scss +207 -0
  213. package/dist/scss/y2k.dark.scss +946 -0
  214. package/dist/scss/y2k.darkMore.scss +946 -0
  215. package/dist/scss/y2k.light.scss +946 -0
  216. package/dist/scss/y2k.lightMore.scss +946 -0
  217. package/dist/swift/UndTokens.swift +6061 -3432
  218. package/dist/tailwind/und.css +198 -2
  219. package/package.json +5 -1
  220. package/tokens/modes/dark.tokens.json +241 -0
  221. package/tokens/modes/light.tokens.json +246 -0
  222. package/tokens/palettes/butter.dark.tokens.json +887 -0
  223. package/tokens/palettes/butter.light.tokens.json +872 -0
  224. package/tokens/palettes/chocolate.dark.tokens.json +917 -0
  225. package/tokens/palettes/chocolate.light.tokens.json +902 -0
  226. package/tokens/palettes/gothic.dark.tokens.json +831 -0
  227. package/tokens/palettes/matcha.dark.tokens.json +932 -0
  228. package/tokens/palettes/matcha.light.tokens.json +907 -0
  229. package/tokens/palettes/nabh.dark.tokens.json +498 -0
  230. package/tokens/palettes/nabh.light.tokens.json +498 -0
  231. package/tokens/palettes/neutral.dark.tokens.json +837 -0
  232. package/tokens/palettes/neutral.light.tokens.json +817 -0
  233. package/tokens/palettes/stone.dark.tokens.json +877 -0
  234. package/tokens/palettes/stone.light.tokens.json +877 -0
  235. package/tokens/palettes/y2k.dark.tokens.json +877 -0
  236. package/tokens/palettes/y2k.light.tokens.json +877 -0
  237. package/tokens/semantic/roles.tokens.json +521 -0
  238. package/tokens/themes/butter.tokens.json +254 -0
  239. package/tokens/themes/chocolate.tokens.json +214 -0
  240. package/tokens/themes/gothic.tokens.json +249 -0
  241. package/tokens/themes/matcha.tokens.json +258 -0
  242. package/tokens/themes/nabh.tokens.json +174 -0
  243. package/tokens/themes/neutral.tokens.json +234 -0
  244. package/tokens/themes/stone.tokens.json +254 -0
  245. package/tokens/themes/ujala.tokens.json +1 -1
  246. package/tokens/themes/y2k.tokens.json +264 -0
  247. package/tokens/und.resolver.json +40 -4
@@ -1,12 +1,18 @@
1
1
  /**
2
- * The six UND UI themes (report section 7).
2
+ * The UND UI themes: the default (Nabh), the six original themes (report
3
+ * section 7) and the seven ported themes (Neutral, Stone, Butter, Chocolate,
4
+ * Gothic, Matcha, Y2K).
3
5
  *
4
6
  * A theme is a small seed object; the generator turns it into a DTCG override
5
7
  * file (tokens/themes/<name>.tokens.json). Theme overrides are deliberately
6
8
  * mode- and contrast-independent (they point at scale aliases, which the mode
7
9
  * sources resolve), so one resolver order works for every combination:
8
- * base -> mode -> theme -> contrast -> density -> transparency -> motion.
9
- * Raat is dark-only: its theme context pulls in the dark mode sources itself.
10
+ * base -> mode -> theme -> palette -> contrast -> density -> transparency -> motion.
11
+ * Raat and Gothic are dark-only: their theme context pulls in the dark mode sources itself.
12
+ *
13
+ * Palette themes (Nabh and the ported themes) also carry literal light and dark
14
+ * colours, shadows and the like. Those live in tokens/palettes/<name>.<mode>.tokens.json
15
+ * and are selected by the `palette` modifier, whose input is derived from theme and mode.
10
16
  */
11
17
  const INTER = {
12
18
  body: '{font.sans}',
@@ -14,11 +20,73 @@ const INTER = {
14
20
  display: '{font.display}',
15
21
  code: '{font.mono}',
16
22
  };
23
+ /** Indic and system fallbacks appended to every ported stack, so Hindi and the other Indic scripts keep a good face. */
24
+ const INDIC_SANS = ['Noto Sans Devanagari', 'Noto Sans', 'Nirmala UI', 'Kohinoor Devanagari'];
25
+ const SYSTEM_SANS = [
26
+ '-apple-system',
27
+ 'BlinkMacSystemFont',
28
+ 'Segoe UI',
29
+ 'Roboto',
30
+ 'Helvetica',
31
+ 'Arial',
32
+ ...INDIC_SANS,
33
+ 'sans-serif',
34
+ ];
35
+ const SERIF = [
36
+ 'Georgia',
37
+ 'Times New Roman',
38
+ 'Times',
39
+ 'Noto Serif Devanagari',
40
+ 'Nirmala UI',
41
+ 'serif',
42
+ ];
43
+ /** Families that @und-ui/fonts ships with a metric-matched local() fallback face. */
44
+ const WITH_FALLBACK = new Set(['Figtree', 'Outfit', 'Albert Sans', 'Fustat', 'DM Sans', 'Poppins']);
45
+ const sans = (...families) => [
46
+ ...families.flatMap((f) => (WITH_FALLBACK.has(f) ? [f, `${f} Fallback`] : [f])),
47
+ ...SYSTEM_SANS,
48
+ ];
49
+ const JETBRAINS = [
50
+ 'JetBrains Mono',
51
+ 'JetBrains Mono Fallback',
52
+ 'SF Mono',
53
+ 'Monaco',
54
+ 'Consolas',
55
+ 'monospace',
56
+ ];
57
+ /** A palette theme: literal per-mode colours, ported radii, type scale and motion, no glass. */
58
+ function ported(def) {
59
+ return {
60
+ modes: ['light', 'dark'],
61
+ radiusFactor: 1,
62
+ tempo: 1,
63
+ character: 'standard',
64
+ density: 'comfortable',
65
+ glass: 'off',
66
+ typeface: { body: SYSTEM_SANS, heading: SYSTEM_SANS, display: SYSTEM_SANS, code: JETBRAINS },
67
+ palette: def.name,
68
+ ...def,
69
+ };
70
+ }
17
71
  export const THEMES = [
72
+ ported({
73
+ name: 'nabh',
74
+ label: 'Nabh',
75
+ personality: 'Default. Clear sky blue on cool greys, system fonts and crisp radii: calm and familiar on every platform.',
76
+ accent: 'blue',
77
+ neutral: 'neutral',
78
+ palette: 'default',
79
+ typeface: {
80
+ body: SYSTEM_SANS,
81
+ heading: SYSTEM_SANS,
82
+ display: SYSTEM_SANS,
83
+ code: ['SF Mono', 'Monaco', 'Consolas', 'monospace'],
84
+ },
85
+ }),
18
86
  {
19
87
  name: 'ujala',
20
88
  label: 'Ujala',
21
- personality: 'Default. Confident, friendly, modern civic. The UND brand.',
89
+ personality: 'Confident, friendly, modern civic: the UND brand indigo (the default theme before 0.3).',
22
90
  accent: 'indigo',
23
91
  neutral: 'neutral',
24
92
  modes: ['light', 'dark'],
@@ -130,8 +198,116 @@ export const THEMES = [
130
198
  'color.accent': '{scale.neutral.12}',
131
199
  },
132
200
  },
201
+ ported({
202
+ name: 'neutral',
203
+ label: 'Neutral',
204
+ personality: 'Restrained warm greys. Minimal and quiet, so the content stays the focus.',
205
+ accent: 'gray',
206
+ neutral: 'gray',
207
+ typeface: {
208
+ body: sans('Figtree'),
209
+ heading: sans('Figtree'),
210
+ display: sans('Figtree'),
211
+ code: [
212
+ 'ui-monospace',
213
+ 'SF Mono',
214
+ 'Monaco',
215
+ 'Consolas',
216
+ 'Liberation Mono',
217
+ 'Courier New',
218
+ 'monospace',
219
+ ],
220
+ },
221
+ fonts: ['figtree'],
222
+ }),
223
+ ported({
224
+ name: 'stone',
225
+ label: 'Stone',
226
+ personality: 'Warm stone and slate, earthy and understated, with just enough character to feel handcrafted.',
227
+ accent: 'neutral',
228
+ neutral: 'neutral',
229
+ typeface: {
230
+ body: sans('Figtree'),
231
+ heading: sans('Montserrat', 'Figtree'),
232
+ display: sans('Montserrat', 'Figtree'),
233
+ code: JETBRAINS,
234
+ },
235
+ fonts: ['figtree', 'montserrat', 'jetbrains-mono'],
236
+ }),
237
+ ported({
238
+ name: 'butter',
239
+ label: 'Butter',
240
+ personality: 'Warm, creamy yellows with a friendly blue accent. Playful enough for consumer surfaces, soft enough to stay readable.',
241
+ accent: 'blue',
242
+ neutral: 'warm',
243
+ typeface: {
244
+ body: sans('Outfit'),
245
+ heading: sans('Outfit'),
246
+ display: ['Sarina', 'Brush Script MT', 'Snell Roundhand', ...INDIC_SANS, 'cursive'],
247
+ code: JETBRAINS,
248
+ },
249
+ fonts: ['outfit', 'sarina', 'jetbrains-mono'],
250
+ }),
251
+ ported({
252
+ name: 'chocolate',
253
+ label: 'Chocolate',
254
+ personality: 'Rich browns with Fraunces headings and Albert Sans body: warm, editorial and tactile.',
255
+ accent: 'terracotta',
256
+ neutral: 'sand',
257
+ typeface: {
258
+ body: sans('Albert Sans'),
259
+ heading: ['Fraunces', ...SERIF],
260
+ display: ['Fraunces', ...SERIF],
261
+ code: JETBRAINS,
262
+ },
263
+ fonts: ['albert-sans', 'fraunces', 'jetbrains-mono'],
264
+ }),
265
+ ported({
266
+ name: 'gothic',
267
+ label: 'Gothic',
268
+ personality: 'Deep blue-greys and a blackletter display face. Dramatic and editorial, for surfaces that want to be remembered. Dark-only.',
269
+ accent: 'gray',
270
+ neutral: 'midnight',
271
+ modes: ['dark'],
272
+ typeface: {
273
+ body: sans('Fustat'),
274
+ heading: sans('Fustat'),
275
+ display: ['Manufacturing Consent', 'UnifrakturMaguntia', 'Old English Text MT', ...SERIF],
276
+ code: JETBRAINS,
277
+ },
278
+ fonts: ['fustat', 'manufacturing-consent', 'jetbrains-mono'],
279
+ }),
280
+ ported({
281
+ name: 'matcha',
282
+ label: 'Matcha',
283
+ personality: 'Earthy greens with a calm, organic feel and roomy spacing. Grounded, for wellness or content-first apps.',
284
+ accent: 'green',
285
+ neutral: 'sage',
286
+ typeface: {
287
+ body: sans('DM Sans'),
288
+ heading: ['Playwrite US Trad', ...SERIF],
289
+ display: ['Playwrite US Trad', ...SERIF],
290
+ code: JETBRAINS,
291
+ },
292
+ fonts: ['dm-sans', 'playwrite-us-trad', 'jetbrains-mono'],
293
+ }),
294
+ ported({
295
+ name: 'y2k',
296
+ label: 'Y2K',
297
+ personality: 'Periwinkle, hot pink and lime with square corners and Poppins. Bubbly, playful and unmistakably retro.',
298
+ accent: 'pink',
299
+ neutral: 'neutral',
300
+ typeface: {
301
+ body: sans('Poppins'),
302
+ heading: sans('Poppins'),
303
+ display: ['Crimson Text', ...SERIF],
304
+ code: JETBRAINS,
305
+ },
306
+ fonts: ['poppins', 'crimson-text', 'jetbrains-mono'],
307
+ }),
133
308
  ];
134
- export const DEFAULT_THEME = 'ujala';
309
+ /** Un-themed pages get this theme. */
310
+ export const DEFAULT_THEME = 'nabh';
135
311
  export function themeByName(name) {
136
312
  const t = THEMES.find((x) => x.name === name);
137
313
  if (!t)
@@ -0,0 +1,47 @@
1
+ import { over } from './aa.js';
2
+ import type { RoleColors } from './aa.js';
3
+ export interface ThemeSeed {
4
+ /** Attribute value: `data-und-theme="<name>"`. Lowercase letters, digits and hyphens. */
5
+ name: string;
6
+ /** Brand colour (hex). Used for solids, links, focus rings and selected states. */
7
+ accent: string;
8
+ /** Colour that tints the greys (hex). Default: the accent, at a whisper of chroma. */
9
+ neutral?: string;
10
+ /** Grey chroma, 0 (pure grey) to 0.04 (clearly tinted). Default 0.008. */
11
+ neutralChroma?: number;
12
+ /** Page background per mode (hex). Default: derived from the neutral. */
13
+ canvas?: {
14
+ light?: string;
15
+ dark?: string;
16
+ };
17
+ /** Modes the theme supports. Default both; one mode makes a single-scheme theme. */
18
+ modes?: readonly ('light' | 'dark')[];
19
+ /** Base corner radius in px for controls (inner, container and page radii follow). Default 10. */
20
+ radius?: number;
21
+ /** Font stacks (CSS font-family lists). Default: the system stack. */
22
+ fonts?: Partial<Record<'body' | 'heading' | 'display' | 'code', string>>;
23
+ }
24
+ export interface GeneratedTheme {
25
+ name: string;
26
+ /** Final colours per role and mode (hex, `#rrggbbaa` when translucent). */
27
+ colors: Record<string, {
28
+ light: string;
29
+ dark: string;
30
+ }>;
31
+ /** Every non-colour custom property the theme sets (radii, fonts). */
32
+ properties: Record<string, string>;
33
+ /** The theme stylesheet. */
34
+ css: string;
35
+ /** AA pairs that still fail after repair (empty for any sensible seed). */
36
+ failures: string[];
37
+ }
38
+ /**
39
+ * Audits the derived roles (tones, data, syntax) the way auditPalette audits the core
40
+ * ones; returns the failures.
41
+ */
42
+ export declare function auditExtendedRoles(c: RoleColors): string[];
43
+ /** Builds a theme from seeds. Throws a TypeError on malformed seeds. */
44
+ export declare function generateTheme(seed: ThemeSeed): GeneratedTheme;
45
+ export { auditPalette, repairPalette } from './aa.js';
46
+ export type { RoleColors, Rgba } from './aa.js';
47
+ export { over };
@@ -0,0 +1,329 @@
1
+ /**
2
+ * `@und-ui/tokens/generate`: a theme from a few seeds.
3
+ *
4
+ * import { generateTheme } from '@und-ui/tokens/generate';
5
+ * const { css } = generateTheme({ name: 'brand', accent: '#0f766e' });
6
+ * // <style>{css}</style>, then <html data-und-theme="brand">
7
+ *
8
+ * The seeds (accent, optional neutral tint, canvas colours, radius, fonts) become
9
+ * the full colour role set of a palette theme in both modes (including tones, data and syntax
10
+ * colours), repaired to WCAG 2.2 AA
11
+ * (src/themes/aa.ts), and one CSS block whose colours use light-dark(), so the page's
12
+ * data-und-mode (or the OS scheme) picks the side. Load it after @und-ui/tokens/css.
13
+ * Pure functions: no DOM, no file system, safe in browsers, workers and build tools.
14
+ */
15
+ import { hexToOklch, oklchToHex } from '../color/convert.js';
16
+ import { auditPalette, contrast, flat, hexOf, minContrast, mix, nudge, over, repairPalette, rgba, soften, } from './aa.js';
17
+ const SYSTEM_STACK = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Noto Sans Devanagari", "Noto Sans", "Nirmala UI", sans-serif';
18
+ const MONO_STACK = 'ui-monospace, "SF Mono", Monaco, Consolas, "Liberation Mono", monospace';
19
+ /** Status hues (OKLCH degrees): success green, warning amber, danger red, info blue. */
20
+ const STATUS_HUES = { success: 150, warning: 75, danger: 27, info: 250 };
21
+ /** Categorical tones (badges, tags, avatars): OKLCH hue per name; gray (-1) follows the neutral tint. */
22
+ const TONE_HUES = {
23
+ blue: 255,
24
+ cyan: 225,
25
+ gray: -1,
26
+ green: 150,
27
+ orange: 50,
28
+ pink: 350,
29
+ purple: 295,
30
+ red: 25,
31
+ teal: 190,
32
+ yellow: 85,
33
+ };
34
+ /** Categorical data colours (chart series), in series order; brown is a low-chroma orange. */
35
+ const DATA_HUES = {
36
+ blue: 255,
37
+ orange: 50,
38
+ purple: 295,
39
+ green: 145,
40
+ pink: 350,
41
+ cyan: 225,
42
+ red: 25,
43
+ teal: 190,
44
+ brown: 65,
45
+ indigo: 275,
46
+ };
47
+ /** Sequential data ramps (heatmaps, choropleths): step 1 lightest, 5 darkest; gray follows the neutral. */
48
+ const RAMP_HUES = {
49
+ blue: 255,
50
+ shamrock: 155,
51
+ orange: 50,
52
+ pink: 350,
53
+ purple: 295,
54
+ red: 25,
55
+ teal: 190,
56
+ yellow: 90,
57
+ gray: -1,
58
+ };
59
+ const RAMP_L = [0.95, 0.86, 0.74, 0.56, 0.38];
60
+ const RAMP_C = [0.04, 0.1, 0.15, 0.15, 0.11];
61
+ /** Syntax highlighting roles and the role each one reads (text on syntax.background). */
62
+ const SYNTAX = {
63
+ keyword: 'accent.fg',
64
+ string: 'tone.green.fg',
65
+ comment: 'fg.muted',
66
+ number: 'tone.orange.fg',
67
+ function: 'tone.blue.fg',
68
+ type: 'tone.purple.fg',
69
+ variable: 'fg.default',
70
+ operator: 'tone.cyan.fg',
71
+ constant: 'tone.orange.fg',
72
+ tag: 'tone.red.fg',
73
+ attribute: 'tone.teal.fg',
74
+ property: 'tone.cyan.fg',
75
+ punctuation: 'fg.muted',
76
+ 'added-marker': 'tone.green.fg',
77
+ 'removed-marker': 'tone.red.fg',
78
+ };
79
+ const HEX = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
80
+ const NAME = /^[a-z][a-z0-9-]{0,39}$/;
81
+ function hex(value, what) {
82
+ if (!HEX.test(value))
83
+ throw new TypeError(`${what} must be a #rgb or #rrggbb colour, got "${value}"`);
84
+ return value.length === 4
85
+ ? `#${value
86
+ .slice(1)
87
+ .split('')
88
+ .map((c) => c + c)
89
+ .join('')}`.toLowerCase()
90
+ : value.toLowerCase();
91
+ }
92
+ /** A font-family list may not close the declaration or open a block. */
93
+ function fontStack(value, what) {
94
+ if (/[;{}<>\\]|\/\*/.test(value))
95
+ throw new TypeError(`${what} has characters not allowed in font-family`);
96
+ return value.trim();
97
+ }
98
+ const ok = (l, c, h) => rgba(oklchToHex({ l, c, h }));
99
+ const alpha = (c, a) => ({ ...c, a });
100
+ const BLACK = rgba('#000000');
101
+ const WHITE = rgba('#ffffff');
102
+ /** Black or white, whichever reads better on `bg`. */
103
+ const labelOn = (bg) => (contrast(WHITE, bg) >= contrast(BLACK, bg) ? WHITE : BLACK);
104
+ function modeColors(seed, mode) {
105
+ const accent = hexToOklch(hex(seed.accent, 'accent'));
106
+ const tint = hexToOklch(hex(seed.neutral ?? seed.accent, 'neutral'));
107
+ const nc = Math.min(Math.max(seed.neutralChroma ?? 0.008, 0), 0.04);
108
+ const g = (l) => ok(l, nc, tint.h);
109
+ const light = mode === 'light';
110
+ const canvasSeed = seed.canvas?.[mode];
111
+ const canvas = canvasSeed ? rgba(hex(canvasSeed, `canvas.${mode}`)) : g(light ? 0.975 : 0.17);
112
+ const cl = hexToOklch(hexOf(canvas)).l;
113
+ // Surfaces step away from the canvas: lighter cards in light mode, lifted greys in dark mode.
114
+ const lift = (d) => g(Math.min(Math.max(light ? cl + d : cl + d, 0), 1));
115
+ const c = new Map();
116
+ c.set('bg.canvas', canvas);
117
+ c.set('bg.surface', light ? WHITE : lift(0.045));
118
+ c.set('bg.card', c.get('bg.surface'));
119
+ c.set('bg.raised', light ? WHITE : lift(0.08));
120
+ c.set('bg.subtle', light ? lift(-0.02) : lift(0.02));
121
+ c.set('bg.muted', alpha(light ? g(0.25) : g(0.9), light ? 0.07 : 0.1));
122
+ c.set('bg.overlay', alpha(BLACK, light ? 0.5 : 0.7));
123
+ const hover = alpha(light ? BLACK : WHITE, light ? 0.05 : 0.06);
124
+ const pressed = alpha(light ? BLACK : WHITE, light ? 0.1 : 0.12);
125
+ c.set('bg.hover', hover);
126
+ c.set('bg.pressed', pressed);
127
+ c.set('bg.inverse', light ? g(0.2) : g(0.96));
128
+ c.set('bg.skeleton', light ? g(0.9) : g(0.32));
129
+ c.set('bg.track', light ? g(0.9) : g(0.3));
130
+ c.set('fg.default', light ? g(0.2) : g(0.96));
131
+ c.set('fg.muted', light ? g(0.45) : g(0.75));
132
+ c.set('fg.disabled', light ? g(0.7) : g(0.45));
133
+ c.set('border.subtle', alpha(light ? g(0.3) : g(0.95), 0.1));
134
+ c.set('border.default', light ? g(0.86) : g(0.36));
135
+ // Accent: the seed is the solid; the label is whichever of white and black reads better.
136
+ const solid = rgba(hex(seed.accent, 'accent'));
137
+ c.set('accent.solid', solid);
138
+ c.set('fg.on-accent', labelOn(solid));
139
+ c.set('accent.bg', alpha(solid, light ? 0.14 : 0.24));
140
+ c.set('accent.fg', ok(light ? 0.5 : 0.78, accent.c, accent.h));
141
+ c.set('accent.fg-strong', ok(light ? 0.38 : 0.88, accent.c, accent.h));
142
+ for (const [s, h] of Object.entries(STATUS_HUES)) {
143
+ const sol = ok(light ? 0.56 : 0.68, s === 'warning' ? 0.15 : 0.17, h);
144
+ c.set(`status.${s}.solid`, sol);
145
+ c.set(`status.${s}.on-solid`, labelOn(sol));
146
+ c.set(`status.${s}.bg`, alpha(sol, light ? 0.14 : 0.22));
147
+ c.set(`status.${s}.fg`, ok(light ? 0.47 : 0.8, 0.15, h));
148
+ c.set(`status.${s}.fg-strong`, ok(light ? 0.36 : 0.9, 0.12, h));
149
+ }
150
+ c.set('fg.inverse', c.get('bg.surface'));
151
+ repairPalette(c, mode, hover, pressed);
152
+ // Roles that follow the repaired ones.
153
+ c.set('icon.default', c.get('fg.default'));
154
+ c.set('icon.muted', c.get('fg.muted'));
155
+ c.set('icon.disabled', c.get('fg.disabled'));
156
+ c.set('icon.accent', c.get('accent.fg'));
157
+ for (const s of Object.keys(STATUS_HUES)) {
158
+ c.set(`status.${s}.icon`, c.get(`status.${s}.fg`));
159
+ c.set(`status.${s}.border`, mix(flat(c.get(`status.${s}.solid`), canvas), canvas, 0.35));
160
+ }
161
+ c.set('tint.hover', light ? BLACK : WHITE);
162
+ deriveExtendedRoles(c, mode, accent.c, tint.h, nc);
163
+ return c;
164
+ }
165
+ /** Text surfaces (canvas, surface, subtle, raised) composited over the canvas. */
166
+ const textSurfaces = (c) => {
167
+ const canvas = c.get('bg.canvas');
168
+ return ['bg.canvas', 'bg.surface', 'bg.subtle', 'bg.raised'].map((p) => flat(c.get(p), canvas));
169
+ };
170
+ /**
171
+ * Tones, data colours and syntax roles from the seeds: fixed hues (a blue tag stays blue),
172
+ * chroma scaled by the accent's (a muted brand gets muted tones), lightness placed for the
173
+ * repaired canvas and surfaces, then nudged until every pair passes (text 4.5:1 on every
174
+ * surface and on its own tint; borders, icons and chart marks 3:1).
175
+ */
176
+ function deriveExtendedRoles(c, mode, accentChroma, tintHue, nc) {
177
+ const light = mode === 'light';
178
+ const canvas = c.get('bg.canvas');
179
+ const surface = flat(c.get('bg.surface'), canvas);
180
+ const S = textSurfaces(c);
181
+ const k = Math.min(0.6 + accentChroma * 2.5, 1.15);
182
+ /** [hue, chroma]; a negative hue means the neutral tint at grey chroma. */
183
+ const hc = (h, chroma) => h < 0 ? [tintHue, Math.min(Math.max(nc, 0.01), 0.03)] : [h, chroma * k];
184
+ for (const [name, hue] of Object.entries(TONE_HUES)) {
185
+ const [h, ch] = hc(hue, 0.15);
186
+ const tint = alpha(ok(light ? 0.72 : 0.62, ch, h), light ? 0.2 : 0.28);
187
+ const tints = () => [
188
+ over(c.get(`tone.${name}.bg`), canvas),
189
+ over(c.get(`tone.${name}.bg`), surface),
190
+ ];
191
+ c.set(`tone.${name}.bg`, tint);
192
+ let fg = nudge(ok(light ? 0.38 : 0.88, ch * 0.85, h), [...S, ...tints()], 4.5);
193
+ if (minContrast(fg, [...S, ...tints()]) < 4.5) {
194
+ // The text cannot pass on both the page and the tint: fade the tint toward the page.
195
+ fg = nudge(fg, S, 4.5);
196
+ c.set(`tone.${name}.bg`, soften(tint, canvas, fg, 4.5));
197
+ }
198
+ c.set(`tone.${name}.fg`, fg);
199
+ c.set(`tone.${name}.icon`, fg);
200
+ c.set(`tone.${name}.border`, nudge(ok(light ? 0.6 : 0.58, ch, h), S, 3));
201
+ }
202
+ for (const [name, hue] of Object.entries(DATA_HUES)) {
203
+ const brown = name === 'brown';
204
+ const [h, ch] = hc(hue, brown ? 0.1 : 0.17);
205
+ const l = light ? (brown ? 0.5 : 0.58) : brown ? 0.64 : 0.7;
206
+ c.set(`data.categorical.${name}`, nudge(ok(l, ch, h), [canvas, surface], 3));
207
+ }
208
+ c.set('data.neutral', nudge(ok(light ? 0.6 : 0.62, Math.min(Math.max(nc, 0.01), 0.03), tintHue), [canvas, surface], 3));
209
+ for (const [name, hue] of Object.entries(RAMP_HUES))
210
+ RAMP_L.forEach((l, i) => {
211
+ const [h, ch] = hc(hue, RAMP_C[i]);
212
+ c.set(`data.${name}.${i + 1}`, ok(l, ch, h));
213
+ });
214
+ for (const [role, source] of Object.entries(SYNTAX))
215
+ c.set(`syntax.${role}`, c.get(source));
216
+ c.set('syntax.background', c.get('bg.subtle'));
217
+ c.set('syntax.diff-header', c.get('bg.subtle'));
218
+ }
219
+ /**
220
+ * Audits the derived roles (tones, data, syntax) the way auditPalette audits the core
221
+ * ones; returns the failures.
222
+ */
223
+ export function auditExtendedRoles(c) {
224
+ const canvas = c.get('bg.canvas');
225
+ const surface = flat(c.get('bg.surface'), canvas);
226
+ const S = textSurfaces(c);
227
+ const out = [];
228
+ const check = (fg, bgs, min, what) => {
229
+ const r = minContrast(c.get(fg), bgs);
230
+ if (r < min)
231
+ out.push(`${fg} on ${what} = ${r.toFixed(2)} < ${min}`);
232
+ };
233
+ for (const name of Object.keys(TONE_HUES)) {
234
+ const bg = c.get(`tone.${name}.bg`);
235
+ check(`tone.${name}.fg`, S, 4.5, 'surfaces');
236
+ check(`tone.${name}.fg`, [over(bg, canvas), over(bg, surface)], 4.5, `tone.${name}.bg`);
237
+ check(`tone.${name}.icon`, S, 3, 'surfaces');
238
+ check(`tone.${name}.border`, S, 3, 'surfaces');
239
+ }
240
+ for (const name of Object.keys(DATA_HUES))
241
+ check(`data.categorical.${name}`, [canvas, surface], 3, 'canvas/surface');
242
+ check('data.neutral', [canvas, surface], 3, 'canvas/surface');
243
+ for (const name of Object.keys(RAMP_HUES))
244
+ for (let i = 1; i < RAMP_L.length; i++) {
245
+ const a = hexToOklch(hexOf(c.get(`data.${name}.${i}`))).l;
246
+ const b = hexToOklch(hexOf(c.get(`data.${name}.${i + 1}`))).l;
247
+ if (!(a > b))
248
+ out.push(`data.${name}.${i + 1} is not darker than step ${i}`);
249
+ }
250
+ const code = flat(c.get('syntax.background'), canvas);
251
+ for (const role of Object.keys(SYNTAX))
252
+ if (!role.endsWith('-marker'))
253
+ check(`syntax.${role}`, [code], 4.5, 'syntax.background');
254
+ for (const role of ['added-marker', 'removed-marker'])
255
+ check(`syntax.${role}`, [code], 3, 'syntax.background');
256
+ return out;
257
+ }
258
+ const hexA = (c) => {
259
+ const h = hexOf(c);
260
+ if (c.a >= 1)
261
+ return h;
262
+ return (h +
263
+ Math.round(c.a * 255)
264
+ .toString(16)
265
+ .padStart(2, '0'));
266
+ };
267
+ const varName = (path) => `--und-${path.replace(/\./g, '-')}`;
268
+ /** Builds a theme from seeds. Throws a TypeError on malformed seeds. */
269
+ export function generateTheme(seed) {
270
+ if (!NAME.test(seed.name))
271
+ throw new TypeError(`name must match ${NAME}, got "${seed.name}"`);
272
+ const modes = seed.modes?.length ? [...new Set(seed.modes)] : ['light', 'dark'];
273
+ const per = {
274
+ light: modeColors(seed, modes.includes('light') ? 'light' : 'dark'),
275
+ dark: modeColors(seed, modes.includes('dark') ? 'dark' : 'light'),
276
+ };
277
+ const colors = {};
278
+ for (const [path, l] of per.light)
279
+ colors[path] = { light: hexA(l), dark: hexA(per.dark.get(path)) };
280
+ const r = seed.radius ?? 10;
281
+ if (!(r >= 0 && r <= 64))
282
+ throw new TypeError(`radius must be 0-64 px, got ${seed.radius}`);
283
+ const px = (n) => `${Math.round(n * 100) / 100}px`;
284
+ const properties = {
285
+ '--und-radius-inner': px(r * 0.6),
286
+ '--und-radius-element': px(r),
287
+ '--und-radius-container': px(r * 1.2),
288
+ '--und-radius-page': px(r * 2.8),
289
+ '--und-shape-control': 'var(--und-radius-element)',
290
+ '--und-shape-card': 'var(--und-radius-container)',
291
+ '--und-shape-dialog': 'var(--und-radius-container)',
292
+ '--und-shape-popover': 'var(--und-radius-container)',
293
+ '--und-typeface-body': fontStack(seed.fonts?.body ?? SYSTEM_STACK, 'fonts.body'),
294
+ '--und-typeface-heading': fontStack(seed.fonts?.heading ?? seed.fonts?.body ?? SYSTEM_STACK, 'fonts.heading'),
295
+ '--und-typeface-display': fontStack(seed.fonts?.display ?? seed.fonts?.heading ?? seed.fonts?.body ?? SYSTEM_STACK, 'fonts.display'),
296
+ '--und-typeface-code': fontStack(seed.fonts?.code ?? MONO_STACK, 'fonts.code'),
297
+ // References that follow the repaired roles (the on-solid scale band, visited links, v0 bridge).
298
+ '--und-scale-accent-9': 'var(--und-accent-solid)',
299
+ '--und-scale-accent-10': 'var(--und-accent-solid-hover)',
300
+ '--und-scale-accent-contrast': 'var(--und-fg-on-accent)',
301
+ '--und-link-visited': 'var(--und-link-default)',
302
+ '--und-color-accent': 'var(--und-accent-fg)',
303
+ // The chart palette follows the derived categorical colours.
304
+ ...Object.fromEntries(Object.keys(DATA_HUES)
305
+ .slice(0, 8)
306
+ .map((h, i) => [`--und-dataviz-${i + 1}`, `var(--und-data-categorical-${h})`])),
307
+ };
308
+ const scheme = modes.length === 1 ? modes[0] : 'light dark';
309
+ const lines = [
310
+ ` color-scheme: ${scheme};`,
311
+ ...Object.entries(colors).map(([p, v]) => v.light === v.dark || modes.length === 1
312
+ ? ` ${varName(p)}: ${modes[0] === 'dark' && modes.length === 1 ? v.dark : v.light};`
313
+ : ` ${varName(p)}: light-dark(${v.light}, ${v.dark});`),
314
+ ...Object.entries(properties).map(([k, v]) => ` ${k}: ${v};`),
315
+ ];
316
+ const sel = `[data-und-theme="${seed.name}"]`;
317
+ const css = `/* UND UI theme "${seed.name}", generated by @und-ui/tokens/generate. Load after @und-ui/tokens/css. */\n` +
318
+ `:where(${sel}, ${sel} :is([data-und-mode], [data-und-contrast]):not([data-und-theme])) {\n${lines.join('\n')}\n}\n`;
319
+ const failures = [
320
+ ...auditPalette(per.light).map((f) => `light: ${f}`),
321
+ ...auditPalette(per.dark).map((f) => `dark: ${f}`),
322
+ ...auditExtendedRoles(per.light).map((f) => `light: ${f}`),
323
+ ...auditExtendedRoles(per.dark).map((f) => `dark: ${f}`),
324
+ ];
325
+ return { name: seed.name, colors, properties, css, failures };
326
+ }
327
+ export { auditPalette, repairPalette } from './aa.js';
328
+ // Re-exported for custom pipelines that composite translucent roles.
329
+ export { over };
@@ -0,0 +1,59 @@
1
+ import { mix, over } from './aa.js';
2
+ import type { Rgba } from './aa.js';
3
+ import type { PortedValue } from './ported.js';
4
+ type Obj = Record<string, unknown>;
5
+ export type Mode = 'light' | 'dark';
6
+ export type { Rgba };
7
+ /** Parses the colour syntaxes used by the source CSS: hex, rgb()/rgba(), oklch(), keywords. */
8
+ export declare function parseCssColor(input: string): Rgba;
9
+ export declare const hexOfRgba: (c: Rgba) => string;
10
+ /** DTCG sRGB colour value. */
11
+ export declare function colorValue(c: Rgba): Obj;
12
+ export { mix, over };
13
+ /** Parses a CSS box-shadow list into DTCG shadow layers. */
14
+ export declare function parseShadow(css: string): Obj[];
15
+ export declare const STATUS_MAP: {
16
+ info: string;
17
+ success: string;
18
+ warning: string;
19
+ error: string;
20
+ };
21
+ export declare const TONES: readonly ["blue", "cyan", "gray", "green", "orange", "pink", "purple", "red", "teal", "yellow"];
22
+ export declare const DATA_CATEGORICAL: readonly ["blue", "orange", "purple", "green", "pink", "cyan", "red", "teal", "brown", "indigo"];
23
+ export declare const DATA_RAMPS: readonly ["blue", "shamrock", "orange", "pink", "purple", "red", "teal", "yellow", "gray"];
24
+ export declare const SYNTAX_ROLES: readonly ["keyword", "string", "comment", "number", "function", "type", "variable", "operator", "constant", "tag", "attribute", "property", "punctuation", "background"];
25
+ export declare const FONT_SIZES: readonly ["4xs", "3xs", "2xs", "xs", "sm", "base", "lg", "xl", "2xl", "3xl", "4xl", "5xl"];
26
+ export declare const TYPE_ROLES: readonly ["heading-1", "heading-2", "heading-3", "heading-4", "heading-5", "heading-6", "display-1", "display-2", "display-3", "body", "large", "label", "code", "supporting"];
27
+ export declare const SPACING: readonly ["0", "0-5", "1", "1-5", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
28
+ declare const DURATIONS: readonly ["fast-min", "fast", "fast-max", "medium-min", "medium", "medium-max", "slow-min", "slow", "slow-max"];
29
+ /** Source colour key -> UND paths. Roles UND already had are aliases; the rest are new. */
30
+ export declare const COLOR_MAP: readonly (readonly [source: string, paths: readonly string[]])[];
31
+ /** Shadow source key -> UND path. Elevations 4 and 5 reuse `high`. */
32
+ export declare const SHADOW_MAP: readonly (readonly [string, readonly string[]])[];
33
+ /** Paths that are new in this release (their base value is the default theme's value). */
34
+ export declare function isNewRole(path: string): boolean;
35
+ export declare function sideOf(v: PortedValue, mode: Mode): string;
36
+ /** A theme's own value, falling back to the default look (as the source themes do). */
37
+ export declare function portedValue(theme: string, key: string, mode: Mode): string | undefined;
38
+ export declare function ownsKey(theme: string, key: string): boolean;
39
+ /** Mode-independent base definitions of the new roles: tokens/semantic/roles.tokens.json. */
40
+ export declare function rolesFile(literalConstants: [string, Obj][]): Obj;
41
+ /**
42
+ * New colour and shadow roles with literal default values, split into
43
+ * mode-independent constants (for the roles file) and per-mode values (for the
44
+ * mode files).
45
+ */
46
+ export declare function newLiteralRoles(): {
47
+ constants: [string, Obj][];
48
+ perMode: Record<Mode, [string, Obj, string][]>;
49
+ };
50
+ /**
51
+ * The literal colour roles of a palette (per theme, per mode) after WCAG 2.2 AA
52
+ * repair: source values where they pass, the nearest passing lightness where not.
53
+ */
54
+ export declare function paletteColors(theme: string, mode: Mode): Map<string, Rgba>;
55
+ /** One palette file (per theme, per mode): literal colours and shadows. */
56
+ export declare function paletteEntries(theme: string, mode: Mode): [string, string, unknown][];
57
+ /** Non-colour overrides of a palette theme: radii, shapes, spacing, sizes, motion, type scale. */
58
+ export declare function portedThemeOverrides(theme: string): [string, Obj][];
59
+ export { DURATIONS };