@cognitap/radiant 0.0.5 → 0.0.7

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 (234) hide show
  1. package/CHANGELOG.md +68 -368
  2. package/README.md +41 -1006
  3. package/RELEASE_POLICY.md +3 -3
  4. package/dist/library/Accordion.d.ts +3 -0
  5. package/dist/library/Accordion.d.ts.map +1 -1
  6. package/dist/library/Accordion.js +1 -1
  7. package/dist/library/Accordion.js.map +1 -1
  8. package/dist/library/Button.d.ts +8 -1
  9. package/dist/library/Button.d.ts.map +1 -1
  10. package/dist/library/Button.js +44 -2
  11. package/dist/library/Button.js.map +1 -1
  12. package/dist/library/Card.d.ts +2 -0
  13. package/dist/library/Card.d.ts.map +1 -1
  14. package/dist/library/Card.js +1 -1
  15. package/dist/library/Card.js.map +1 -1
  16. package/dist/library/Checkbox.d.ts +5 -0
  17. package/dist/library/Checkbox.d.ts.map +1 -1
  18. package/dist/library/Checkbox.js +3 -2
  19. package/dist/library/Checkbox.js.map +1 -1
  20. package/dist/library/Collapsible.d.ts +6 -1
  21. package/dist/library/Collapsible.d.ts.map +1 -1
  22. package/dist/library/Collapsible.js +24 -3
  23. package/dist/library/Collapsible.js.map +1 -1
  24. package/dist/library/Dialog.d.ts +5 -1
  25. package/dist/library/Dialog.d.ts.map +1 -1
  26. package/dist/library/Dialog.js +5 -2
  27. package/dist/library/Dialog.js.map +1 -1
  28. package/dist/library/Field.d.ts +8 -0
  29. package/dist/library/Field.d.ts.map +1 -1
  30. package/dist/library/Field.js +2 -0
  31. package/dist/library/Field.js.map +1 -1
  32. package/dist/library/Input.d.ts +3 -0
  33. package/dist/library/Input.d.ts.map +1 -1
  34. package/dist/library/Input.js +1 -0
  35. package/dist/library/Input.js.map +1 -1
  36. package/dist/library/Link.d.ts +5 -0
  37. package/dist/library/Link.d.ts.map +1 -1
  38. package/dist/library/Link.js.map +1 -1
  39. package/dist/library/RadioGroup.d.ts +8 -0
  40. package/dist/library/RadioGroup.d.ts.map +1 -1
  41. package/dist/library/RadioGroup.js +4 -2
  42. package/dist/library/RadioGroup.js.map +1 -1
  43. package/dist/library/ThemeScope.d.ts.map +1 -1
  44. package/dist/library/ThemeScope.js +10 -9
  45. package/dist/library/ThemeScope.js.map +1 -1
  46. package/dist/library/examples/expressive.d.ts +4 -0
  47. package/dist/library/examples/expressive.d.ts.map +1 -0
  48. package/dist/library/{themes → examples}/expressive.js +4 -3
  49. package/dist/library/examples/expressive.js.map +1 -0
  50. package/dist/library/examples/glass.d.ts +4 -0
  51. package/dist/library/examples/glass.d.ts.map +1 -0
  52. package/dist/library/{themes → examples}/glass.js +4 -3
  53. package/dist/library/examples/glass.js.map +1 -0
  54. package/dist/library/examples/index.d.ts +13 -0
  55. package/dist/library/examples/index.d.ts.map +1 -0
  56. package/dist/library/examples/index.js +32 -0
  57. package/dist/library/examples/index.js.map +1 -0
  58. package/dist/library/examples/jelly.d.ts +4 -0
  59. package/dist/library/examples/jelly.d.ts.map +1 -0
  60. package/dist/library/{themes → examples}/jelly.js +4 -3
  61. package/dist/library/examples/jelly.js.map +1 -0
  62. package/dist/library/examples/preset-values.d.ts.map +1 -0
  63. package/dist/library/examples/preset-values.js.map +1 -0
  64. package/dist/library/examples/radiant.d.ts +4 -0
  65. package/dist/library/examples/radiant.d.ts.map +1 -0
  66. package/dist/library/{themes → examples}/radiant.js +4 -3
  67. package/dist/library/examples/radiant.js.map +1 -0
  68. package/dist/library/examples/sharp-3d.d.ts +4 -0
  69. package/dist/library/examples/sharp-3d.d.ts.map +1 -0
  70. package/dist/library/{themes → examples}/sharp-3d.js +4 -3
  71. package/dist/library/examples/sharp-3d.js.map +1 -0
  72. package/dist/library/examples/soft-squircle.d.ts +4 -0
  73. package/dist/library/examples/soft-squircle.d.ts.map +1 -0
  74. package/dist/library/{themes → examples}/soft-squircle.js +4 -3
  75. package/dist/library/examples/soft-squircle.js.map +1 -0
  76. package/dist/library/examples/ticket.d.ts +4 -0
  77. package/dist/library/examples/ticket.d.ts.map +1 -0
  78. package/dist/library/{themes → examples}/ticket.js +4 -3
  79. package/dist/library/examples/ticket.js.map +1 -0
  80. package/dist/library/index.d.ts +4 -2
  81. package/dist/library/index.d.ts.map +1 -1
  82. package/dist/library/index.js +2 -1
  83. package/dist/library/index.js.map +1 -1
  84. package/dist/library/motion/MotionLink.d.ts +8 -0
  85. package/dist/library/motion/MotionLink.d.ts.map +1 -0
  86. package/dist/library/motion/MotionLink.js +44 -0
  87. package/dist/library/motion/MotionLink.js.map +1 -0
  88. package/dist/library/motion/browser.d.ts +5 -0
  89. package/dist/library/motion/browser.d.ts.map +1 -0
  90. package/dist/library/motion/browser.js +35 -0
  91. package/dist/library/motion/browser.js.map +1 -0
  92. package/dist/library/motion/config.d.ts +26 -0
  93. package/dist/library/motion/config.d.ts.map +1 -0
  94. package/dist/library/motion/config.js +58 -0
  95. package/dist/library/motion/config.js.map +1 -0
  96. package/dist/library/motion/context.d.ts +2 -0
  97. package/dist/library/motion/context.d.ts.map +1 -0
  98. package/dist/library/motion/context.js +5 -0
  99. package/dist/library/motion/context.js.map +1 -0
  100. package/dist/library/motion/drag.d.ts +20 -0
  101. package/dist/library/motion/drag.d.ts.map +1 -0
  102. package/dist/library/motion/drag.js +138 -0
  103. package/dist/library/motion/drag.js.map +1 -0
  104. package/dist/library/motion/dragBrowser.d.ts +4 -0
  105. package/dist/library/motion/dragBrowser.d.ts.map +1 -0
  106. package/dist/library/motion/dragBrowser.js +156 -0
  107. package/dist/library/motion/dragBrowser.js.map +1 -0
  108. package/dist/library/motion/follow.d.ts +9 -0
  109. package/dist/library/motion/follow.d.ts.map +1 -0
  110. package/dist/library/motion/follow.js +26 -0
  111. package/dist/library/motion/follow.js.map +1 -0
  112. package/dist/library/motion/host.d.ts +30 -0
  113. package/dist/library/motion/host.d.ts.map +1 -0
  114. package/dist/library/motion/host.js +70 -0
  115. package/dist/library/motion/host.js.map +1 -0
  116. package/dist/library/motion/index.d.ts +16 -0
  117. package/dist/library/motion/index.d.ts.map +1 -0
  118. package/dist/library/motion/index.js +9 -0
  119. package/dist/library/motion/index.js.map +1 -0
  120. package/dist/library/motion/layout.d.ts +20 -0
  121. package/dist/library/motion/layout.d.ts.map +1 -0
  122. package/dist/library/motion/layout.js +67 -0
  123. package/dist/library/motion/layout.js.map +1 -0
  124. package/dist/library/motion/layoutDom.d.ts +17 -0
  125. package/dist/library/motion/layoutDom.d.ts.map +1 -0
  126. package/dist/library/motion/layoutDom.js +272 -0
  127. package/dist/library/motion/layoutDom.js.map +1 -0
  128. package/dist/library/motion/press.d.ts +5 -0
  129. package/dist/library/motion/press.d.ts.map +1 -0
  130. package/dist/library/motion/press.js +99 -0
  131. package/dist/library/motion/press.js.map +1 -0
  132. package/dist/library/motion/pressPolicy.d.ts +5 -0
  133. package/dist/library/motion/pressPolicy.d.ts.map +1 -0
  134. package/dist/library/motion/pressPolicy.js +8 -0
  135. package/dist/library/motion/pressPolicy.js.map +1 -0
  136. package/dist/library/motion/react.d.ts +35 -0
  137. package/dist/library/motion/react.d.ts.map +1 -0
  138. package/dist/library/motion/react.js +224 -0
  139. package/dist/library/motion/react.js.map +1 -0
  140. package/dist/library/motion/runtime.d.ts +22 -0
  141. package/dist/library/motion/runtime.d.ts.map +1 -0
  142. package/dist/library/motion/runtime.js +117 -0
  143. package/dist/library/motion/runtime.js.map +1 -0
  144. package/dist/library/motion/transitions.d.ts +5 -0
  145. package/dist/library/motion/transitions.d.ts.map +1 -0
  146. package/dist/library/motion/transitions.js +244 -0
  147. package/dist/library/motion/transitions.js.map +1 -0
  148. package/dist/library/styles.css +1 -1
  149. package/dist/library/themes/defineTheme.d.ts +3 -0
  150. package/dist/library/themes/defineTheme.d.ts.map +1 -1
  151. package/dist/library/themes/defineTheme.js +4 -2
  152. package/dist/library/themes/defineTheme.js.map +1 -1
  153. package/dist/library/themes/index.d.ts +2 -12
  154. package/dist/library/themes/index.d.ts.map +1 -1
  155. package/dist/library/themes/index.js +1 -19
  156. package/dist/library/themes/index.js.map +1 -1
  157. package/dist/library/themes/themeDocument.d.ts.map +1 -1
  158. package/dist/library/themes/themeDocument.js +11 -5
  159. package/dist/library/themes/themeDocument.js.map +1 -1
  160. package/dist/library/themes/themeDocumentTypes.d.ts +5 -1
  161. package/dist/library/themes/themeDocumentTypes.d.ts.map +1 -1
  162. package/dist/library/themes/themeDocumentTypes.js.map +1 -1
  163. package/docs/accessibility.md +76 -142
  164. package/docs/architecture.md +197 -0
  165. package/docs/motion.md +153 -0
  166. package/docs/theming.md +275 -882
  167. package/package.json +22 -7
  168. package/src/Accordion.tsx +4 -1
  169. package/src/Button.tsx +55 -1
  170. package/src/Card.tsx +3 -1
  171. package/src/Checkbox.tsx +7 -2
  172. package/src/Collapsible.tsx +38 -2
  173. package/src/Dialog.tsx +13 -1
  174. package/src/Field.tsx +8 -0
  175. package/src/Input.tsx +3 -0
  176. package/src/Link.tsx +5 -0
  177. package/src/RadioGroup.tsx +10 -2
  178. package/src/ThemeScope.tsx +21 -17
  179. package/src/{themes → examples}/expressive.ts +5 -3
  180. package/src/{themes → examples}/glass.ts +5 -3
  181. package/src/examples/index.ts +35 -0
  182. package/src/{themes → examples}/jelly.ts +5 -3
  183. package/src/{themes → examples}/radiant.ts +5 -3
  184. package/src/{themes → examples}/sharp-3d.ts +5 -3
  185. package/src/{themes → examples}/soft-squircle.ts +5 -3
  186. package/src/{themes → examples}/ticket.ts +5 -3
  187. package/src/index.ts +10 -13
  188. package/src/motion/MotionLink.tsx +69 -0
  189. package/src/motion/browser.ts +45 -0
  190. package/src/motion/config.ts +79 -0
  191. package/src/motion/context.ts +4 -0
  192. package/src/motion/drag.ts +151 -0
  193. package/src/motion/dragBrowser.ts +159 -0
  194. package/src/motion/follow.ts +28 -0
  195. package/src/motion/host.ts +96 -0
  196. package/src/motion/index.ts +28 -0
  197. package/src/motion/layout.ts +78 -0
  198. package/src/motion/layoutDom.ts +293 -0
  199. package/src/motion/press.ts +97 -0
  200. package/src/motion/pressPolicy.ts +14 -0
  201. package/src/motion/react.ts +272 -0
  202. package/src/motion/runtime.ts +122 -0
  203. package/src/motion/transitions.ts +237 -0
  204. package/src/themes/defineTheme.ts +10 -2
  205. package/src/themes/index.ts +2 -22
  206. package/src/themes/themeDocument.ts +14 -6
  207. package/src/themes/themeDocumentTypes.ts +12 -5
  208. package/dist/library/themes/expressive.d.ts +0 -2
  209. package/dist/library/themes/expressive.d.ts.map +0 -1
  210. package/dist/library/themes/expressive.js.map +0 -1
  211. package/dist/library/themes/glass.d.ts +0 -2
  212. package/dist/library/themes/glass.d.ts.map +0 -1
  213. package/dist/library/themes/glass.js.map +0 -1
  214. package/dist/library/themes/jelly.d.ts +0 -2
  215. package/dist/library/themes/jelly.d.ts.map +0 -1
  216. package/dist/library/themes/jelly.js.map +0 -1
  217. package/dist/library/themes/preset-values.d.ts.map +0 -1
  218. package/dist/library/themes/preset-values.js.map +0 -1
  219. package/dist/library/themes/radiant.d.ts +0 -2
  220. package/dist/library/themes/radiant.d.ts.map +0 -1
  221. package/dist/library/themes/radiant.js.map +0 -1
  222. package/dist/library/themes/sharp-3d.d.ts +0 -2
  223. package/dist/library/themes/sharp-3d.d.ts.map +0 -1
  224. package/dist/library/themes/sharp-3d.js.map +0 -1
  225. package/dist/library/themes/soft-squircle.d.ts +0 -2
  226. package/dist/library/themes/soft-squircle.d.ts.map +0 -1
  227. package/dist/library/themes/soft-squircle.js.map +0 -1
  228. package/dist/library/themes/ticket.d.ts +0 -2
  229. package/dist/library/themes/ticket.d.ts.map +0 -1
  230. package/dist/library/themes/ticket.js.map +0 -1
  231. package/docs/system.md +0 -238
  232. /package/dist/library/{themes → examples}/preset-values.d.ts +0 -0
  233. /package/dist/library/{themes → examples}/preset-values.js +0 -0
  234. /package/src/{themes → examples}/preset-values.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"themeDocument.d.ts","sourceRoot":"","sources":["../../../src/themes/themeDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,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Aa,GAAG,aAAa,CAK1E;AAED,4FAA4F;AAC5F,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,aAAa,GAAG,KAAK,CAGnE;AAiBD,gGAAgG;AAChG,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,aAAa,EACvB,IAAI,GAAE,OAAO,GAAG,SAAmB,GAClC,aAAa,CAWf;AAED,iGAAiG;AACjG,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,SAAS,gBAAgB,EAAE,GACjC,kBAAkB,CAapB;AAED,oGAAoG;AACpG,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,eAAe,GAAG,aAAa,CAyBtF"}
@@ -194,6 +194,8 @@ function toDefinition(sections, id, name) {
194
194
  const section = sections[sectionName];
195
195
  if (!section)
196
196
  continue;
197
+ if (sectionName === 'motion')
198
+ common.motion = sections.motion?.profile;
197
199
  if (sectionName === 'typography' && sections.typography?.typesetting !== undefined) {
198
200
  common.tokens.typography = generateTypography(sections.typography.typesetting).tokens;
199
201
  }
@@ -227,11 +229,13 @@ export function parseThemeDocument(input) {
227
229
  keys(section, [
228
230
  'values',
229
231
  'modes',
230
- ...(name === 'color'
231
- ? ['brand', 'fidelity', 'palettes', 'anchor']
232
- : name === 'typography'
233
- ? ['fonts', 'typesetting']
234
- : [])
232
+ ...(name === 'motion'
233
+ ? ['profile']
234
+ : name === 'color'
235
+ ? ['brand', 'fidelity', 'palettes', 'anchor']
236
+ : name === 'typography'
237
+ ? ['fonts', 'typesetting']
238
+ : [])
235
239
  ], path);
236
240
  if (section.modes !== undefined) {
237
241
  record(section.modes, `${path}.modes`);
@@ -310,6 +314,8 @@ export function themeDocumentFromDefinition(definition) {
310
314
  const values = name === 'components' ? copy.components : copy.tokens?.[name];
311
315
  if (values !== undefined)
312
316
  section.values = values;
317
+ if (name === 'motion' && copy.motion !== undefined)
318
+ section.profile = copy.motion;
313
319
  const modes = {};
314
320
  for (const mode of ['light', 'dark']) {
315
321
  const values = name === 'components' ? copy.modes?.[mode]?.components : copy.modes?.[mode]?.tokens?.[name];
@@ -1 +1 @@
1
- {"version":3,"file":"themeDocument.js","sourceRoot":"","sources":["../../../src/themes/themeDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqD,MAAM,kBAAkB,CAAA;AACjG,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAW3D,MAAM,YAAY,GAAgC;IAChD,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;IACnC,YAAY;CACS,CAAA;AACvB,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AAG7E,SAAS,MAAM,CAAC,KAAc,EAAE,IAAY;IAC1C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChE,MAAM,IAAI,SAAS,CAAC,GAAG,IAAI,qBAAqB,CAAC,CAAA;IACnD,CAAC;AACH,CAAC;AAED,SAAS,IAAI,CAAC,KAAkB,EAAE,OAA0B,EAAE,IAAY;IACxE,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,SAAS,CAAC,gBAAgB,IAAI,IAAI,GAAG,GAAG,CAAC,CAAA;IACjF,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,KAAc,EAAE,IAAY;IAC7C,IAAI,OAAO,KAAK,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A;QACpD,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM;YAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,OAAO,CAAA;IAC3D,CAAC;IACD,OAAO,mBAAmB,CAAC;QACzB,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,CAAC;QACV,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,QAAQ;KACT,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { defineTheme, type Theme, type ThemeDefinition, type ThemeLayer } from './defineTheme.js'\nimport { freezeTree, tokenDefaults } from './tokens.js'\nimport { generateTypography } from '../typography/index.js'\nimport type {\n ThemeColorSection,\n ThemeDocument,\n ThemeSectionExport,\n ThemeSectionName,\n ThemeSections\n} from './themeDocumentTypes.js'\n\nexport type * from './themeDocumentTypes.js'\n\nconst sectionNames: readonly ThemeSectionName[] = [\n ...Object.keys(tokenDefaults.light),\n 'components'\n] as ThemeSectionName[]\nconst stops = new Set([50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950])\ntype RecordValue = Record<string, unknown>\n\nfunction record(value: unknown, path: string): asserts value is RecordValue {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n throw new TypeError(`${path} must be an object.`)\n }\n}\n\nfunction keys(value: RecordValue, allowed: readonly string[], path: string) {\n for (const key of Object.keys(value)) {\n if (!allowed.includes(key)) throw new TypeError(`Unknown key: ${path}.${key}.`)\n }\n}\n\nfunction textValue(value: unknown, path: string) {\n if (typeof value !== 'string' || !value.trim()) {\n throw new TypeError(`${path} must be a nonempty string.`)\n }\n}\n\nfunction choice(value: unknown, allowed: readonly unknown[], path: string) {\n if (!allowed.includes(value)) {\n throw new TypeError(`${path} must be one of: ${allowed.join(', ')}.`)\n }\n}\n\nfunction list(value: unknown, path: string): asserts value is unknown[] {\n if (!Array.isArray(value)) throw new TypeError(`${path} must be an array.`)\n}\n\nfunction unique(value: unknown, seen: Set<unknown>, path: string) {\n if (seen.has(value)) throw new TypeError(`Duplicate value at ${path}: ${String(value)}.`)\n seen.add(value)\n}\n\n/** Copy data without running getters/toJSON or silently losing functions and binaries. */\nfunction jsonCopy(value: unknown, path: string, ancestors = new Set<object>()): unknown {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return value\n if (typeof value === 'number' && Number.isFinite(value)) return value === 0 ? 0 : value\n if (!value || typeof value !== 'object')\n throw new TypeError(`${path} must contain JSON data only.`)\n if (ancestors.has(value)) throw new TypeError(`Circular reference at ${path}.`)\n const array = Array.isArray(value)\n const prototype = Object.getPrototypeOf(value)\n if (\n array ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null\n ) {\n throw new TypeError(`${path} must contain plain JSON objects, not class instances or binaries.`)\n }\n ancestors.add(value)\n const result: RecordValue | unknown[] = array ? [] : {}\n if (Object.getOwnPropertySymbols(value).length)\n throw new TypeError(`${path} cannot contain symbol keys.`)\n const descriptors = Object.getOwnPropertyDescriptors(value)\n for (const key of Object.keys(descriptors).sort()) {\n if (array && key === 'length') continue\n if (['__proto__', 'constructor', 'prototype'].includes(key))\n throw new TypeError(`Forbidden key: ${path}.${key}.`)\n const descriptor = descriptors[key]\n if (!('value' in descriptor) || !descriptor.enumerable) {\n throw new TypeError(`${path}.${key} must be an enumerable data property.`)\n }\n if (array && (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= value.length)) {\n throw new TypeError(`${path}.${key} is not an array index.`)\n }\n // Optional object properties follow JSON omission rules; array holes/undefined are invalid.\n if (descriptor.value === undefined && !array) continue\n const copy = jsonCopy(descriptor.value, `${path}.${key}`, ancestors)\n Object.defineProperty(result, key, {\n value: copy,\n enumerable: true,\n writable: true,\n configurable: true\n })\n }\n if (array && Object.keys(result).length !== value.length)\n throw new TypeError(`${path} cannot contain array holes.`)\n ancestors.delete(value)\n return result\n}\n\nfunction validateColor(value: RecordValue, path: string) {\n if (value.brand !== undefined) {\n record(value.brand, `${path}.brand`)\n keys(value.brand, ['value', 'gamut', 'srgbFallback'], `${path}.brand`)\n textValue(value.brand.value, `${path}.brand.value`)\n choice(value.brand.gamut, ['srgb', 'display-p3'], `${path}.brand.gamut`)\n if (value.brand.srgbFallback !== undefined)\n textValue(value.brand.srgbFallback, `${path}.brand.srgbFallback`)\n if (value.fidelity === undefined) value.fidelity = 'anchored'\n }\n if (value.fidelity !== undefined)\n choice(value.fidelity, ['anchored', 'unanchored'], `${path}.fidelity`)\n if (value.palettes !== undefined) {\n list(value.palettes, `${path}.palettes`)\n const ids = new Set<unknown>()\n for (const [i, palette] of value.palettes.entries()) {\n const p = `${path}.palettes.${i}`\n record(palette, p)\n keys(palette, ['id', 'name', 'swatches'], p)\n textValue(palette.id, `${p}.id`)\n textValue(palette.name, `${p}.name`)\n unique(palette.id, ids, `${p}.id`)\n list(palette.swatches, `${p}.swatches`)\n if (!palette.swatches.length) throw new TypeError(`${p}.swatches must not be empty.`)\n const seen = new Set<unknown>()\n for (const [j, swatch] of palette.swatches.entries()) {\n const s = `${p}.swatches.${j}`\n record(swatch, s)\n keys(swatch, ['stop', 'value', 'srgbFallback'], s)\n if (!stops.has(swatch.stop as number))\n throw new TypeError(`${s}.stop must be a numbered color stop (50–950).`)\n unique(swatch.stop, seen, `${s}.stop`)\n textValue(swatch.value, `${s}.value`)\n if (swatch.srgbFallback !== undefined) textValue(swatch.srgbFallback, `${s}.srgbFallback`)\n }\n }\n }\n if (value.anchor !== undefined) {\n record(value.anchor, `${path}.anchor`)\n keys(value.anchor, ['paletteId', 'stop'], `${path}.anchor`)\n textValue(value.anchor.paletteId, `${path}.anchor.paletteId`)\n if (!stops.has(value.anchor.stop as number))\n throw new TypeError(`${path}.anchor.stop must be a numbered color stop (50–950).`)\n const color = value as ThemeColorSection\n const swatch = color.palettes\n ?.find(p => p.id === color.anchor!.paletteId)\n ?.swatches.find(s => s.stop === color.anchor!.stop)\n if (!color.brand || color.fidelity !== 'anchored' || swatch?.value !== color.brand.value) {\n throw new TypeError(\n `${path}.anchor must reference a swatch containing the exact brand.value with anchored fidelity. Regenerate or replace the color section.`\n )\n }\n }\n}\n\nfunction validateFonts(value: unknown, path: string) {\n list(value, path)\n const ids = new Set<unknown>()\n for (const [i, font] of value.entries()) {\n const p = `${path}.${i}`\n record(font, p)\n keys(font, ['id', 'family', 'source', 'weights', 'styles', 'axes'], p)\n textValue(font.id, `${p}.id`)\n textValue(font.family, `${p}.family`)\n unique(font.id, ids, `${p}.id`)\n choice(font.source, ['system', 'catalog', 'local'], `${p}.source`)\n if (font.axes !== undefined) {\n list(font.axes, `${p}.axes`)\n if (font.axes.length > 32) throw new TypeError(`${p}.axes supports at most 32 axes.`)\n const tags = new Set<unknown>()\n for (const [j, axis] of font.axes.entries()) {\n const at = `${p}.axes.${j}`\n record(axis, at)\n keys(axis, ['tag', 'min', 'default', 'max'], at)\n if (typeof axis.tag !== 'string' || !/^[A-Za-z][A-Za-z0-9]{3}$/.test(axis.tag))\n throw new TypeError(\n `${at}.tag must contain four ASCII letters/digits, starting with a letter.`\n )\n unique(axis.tag, tags, `${at}.tag`)\n for (const key of ['min', 'default', 'max'])\n if (\n typeof axis[key] !== 'number' ||\n !Number.isFinite(axis[key]) ||\n Math.abs(axis[key]) > 1000000\n )\n throw new TypeError(\n `${at}.${key} must be a finite number between -1000000 and 1000000.`\n )\n if (Number(axis.min) > Number(axis.default) || Number(axis.default) > Number(axis.max))\n throw new TypeError(`${at} must satisfy min <= default <= max.`)\n }\n }\n for (const key of ['weights', 'styles']) {\n if (font[key] === undefined) continue\n list(font[key], `${p}.${key}`)\n const seen = new Set<unknown>()\n for (const [j, item] of font[key].entries()) {\n const at = `${p}.${key}.${j}`\n if (key === 'styles') choice(item, ['normal', 'italic'], at)\n else if (typeof item !== 'number' || !Number.isFinite(item) || item < 1 || item > 1000)\n throw new TypeError(`${at} must be a weight from 1 to 1000.`)\n unique(item, seen, at)\n }\n }\n }\n}\n\nfunction toDefinition(sections: ThemeSections, id: string, name: string): ThemeDefinition {\n const common: { tokens: RecordValue; components?: ThemeLayer['components'] } = { tokens: {} }\n const modes = { light: { tokens: {} } as typeof common, dark: { tokens: {} } as typeof common }\n for (const sectionName of sectionNames) {\n const section = sections[sectionName]\n if (!section) continue\n if (sectionName === 'typography' && sections.typography?.typesetting !== undefined) {\n common.tokens.typography = generateTypography(sections.typography.typesetting).tokens\n }\n for (const mode of ['common', 'light', 'dark'] as const) {\n const values = mode === 'common' ? section.values : section.modes?.[mode]\n if (values === undefined) continue\n const layer = mode === 'common' ? common : modes[mode]\n if (sectionName === 'components') layer.components = values as ThemeLayer['components']\n else layer.tokens[sectionName] = merge(layer.tokens[sectionName], values)\n }\n }\n return { id, name, ...common, modes }\n}\n\n/** Read JSON.parse output (or data objects); unknown versions/keys fail with a path. */\nexport function parseThemeDocument(input: unknown): ThemeDocument | ThemeSectionExport {\n const value = jsonCopy(input, 'document')\n record(value, 'document')\n choice(value.kind, ['radiant-theme', 'radiant-theme-sections'], 'document.kind')\n if (value.version !== 1)\n throw new TypeError(\n `Unsupported document.version: ${String(value.version)}. Expected 1; migrate the configuration before importing.`\n )\n const full = value.kind === 'radiant-theme'\n keys(\n value,\n full ? ['kind', 'version', 'id', 'name', 'sections'] : ['kind', 'version', 'sections'],\n 'document'\n )\n record(value.sections, 'document.sections')\n keys(value.sections, sectionNames, 'document.sections')\n for (const [name, section] of Object.entries(value.sections)) {\n const path = `document.sections.${name}`\n record(section, path)\n keys(\n section,\n [\n 'values',\n 'modes',\n ...(name === 'color'\n ? ['brand', 'fidelity', 'palettes', 'anchor']\n : name === 'typography'\n ? ['fonts', 'typesetting']\n : [])\n ],\n path\n )\n if (section.modes !== undefined) {\n record(section.modes, `${path}.modes`)\n keys(section.modes, ['light', 'dark'], `${path}.modes`)\n }\n if (name === 'color') validateColor(section, path)\n if (name === 'typography' && section.fonts !== undefined)\n validateFonts(section.fonts, `${path}.fonts`)\n }\n // Reuse the canonical token/component validation and resolution; no second token schema.\n defineTheme(\n toDefinition(\n value.sections as ThemeSections,\n full ? (value.id as string) : 'section-export',\n full ? (value.name as string) : 'Section export'\n )\n )\n return freezeTree(jsonCopy(value, 'document') as object) as ThemeDocument | ThemeSectionExport\n}\n\n/** Validate and detach an immutable, portable authoring snapshot. */\nexport function defineThemeDocument(document: ThemeDocument): ThemeDocument {\n const result = parseThemeDocument(document)\n if (result.kind !== 'radiant-theme')\n throw new TypeError('Expected a radiant-theme document with id and name.')\n return result\n}\n\n/** Compile only authored semantic values through the existing application theme runtime. */\nexport function compileThemeDocument(document: ThemeDocument): Theme {\n const validated = defineThemeDocument(document)\n return defineTheme(toDefinition(validated.sections, validated.id, validated.name))\n}\n\nfunction merge(base: unknown, patch: unknown): unknown {\n if (\n !base ||\n !patch ||\n typeof base !== 'object' ||\n typeof patch !== 'object' ||\n Array.isArray(base) ||\n Array.isArray(patch)\n )\n return patch\n const result: RecordValue = { ...base }\n for (const [key, value] of Object.entries(patch)) result[key] = merge(result[key], value)\n return result\n}\n\n/** Merge leaves/replace arrays, or replace only supplied sections. Empty replacement resets. */\nexport function updateThemeDocument(\n document: ThemeDocument,\n sections: ThemeSections,\n mode: 'merge' | 'replace' = 'merge'\n): ThemeDocument {\n const base = defineThemeDocument(document)\n choice(mode, ['merge', 'replace'], 'update mode')\n // Check the patch's JSON boundary before merging, including keys a spread would discard.\n const patch = jsonCopy(sections, 'sections')\n record(patch, 'sections')\n keys(patch, sectionNames, 'sections')\n const next = { ...base.sections } as RecordValue\n for (const [name, section] of Object.entries(patch))\n next[name] = mode === 'replace' ? section : merge(next[name], section)\n return defineThemeDocument({ ...base, sections: next })\n}\n\n/** Export exactly these sections, with no document identity or implicit component exceptions. */\nexport function exportThemeSections(\n document: ThemeDocument,\n names: readonly ThemeSectionName[]\n): ThemeSectionExport {\n const base = defineThemeDocument(document)\n list(names, 'section names')\n const sections: RecordValue = {}\n for (const name of names) {\n choice(name, sectionNames, 'section name')\n if (base.sections[name] !== undefined) sections[name] = base.sections[name]\n }\n return parseThemeDocument({\n kind: 'radiant-theme-sections',\n version: 1,\n sections\n }) as ThemeSectionExport\n}\n\n/** Bring existing authored themes into the workshop without materialising defaults as overrides. */\nexport function themeDocumentFromDefinition(definition: ThemeDefinition): ThemeDocument {\n const copy = jsonCopy(definition, 'theme') as ThemeDefinition\n defineTheme(copy)\n const sections: RecordValue = {}\n for (const name of sectionNames) {\n const section: RecordValue = {}\n const values = name === 'components' ? copy.components : copy.tokens?.[name]\n if (values !== undefined) section.values = values\n const modes: RecordValue = {}\n for (const mode of ['light', 'dark'] as const) {\n const values =\n name === 'components' ? copy.modes?.[mode]?.components : copy.modes?.[mode]?.tokens?.[name]\n if (values !== undefined) modes[mode] = values\n }\n if (Object.keys(modes).length) section.modes = modes\n if (Object.keys(section).length) sections[name] = section\n }\n return defineThemeDocument({\n kind: 'radiant-theme',\n version: 1,\n id: copy.id,\n name: copy.name,\n sections\n })\n}\n"]}
1
+ {"version":3,"file":"themeDocument.js","sourceRoot":"","sources":["../../../src/themes/themeDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqD,MAAM,kBAAkB,CAAA;AACjG,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAW3D,MAAM,YAAY,GAAgC;IAChD,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;IACnC,YAAY;CACS,CAAA;AACvB,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AAG7E,SAAS,MAAM,CAAC,KAAc,EAAE,IAAY;IAC1C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CA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AM,EAAE,CAAC,IAAI,CAAC,CAAA;QAC5E,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,CAAC,MAAM,GAAG,MAAM,CAAA;QACjD,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;YAAE,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAA;QACjF,MAAM,KAAK,GAAgB,EAAE,CAAA;QAC7B,KAAK,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,MAAM,CAAU,EAAE,CAAC;YAC9C,MAAM,MAAM,GACV,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,CAAA;YAC7F,IAAI,MAAM,KAAK,SAAS;gBAAE,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAA;QAChD,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM;YAAE,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;QACpD,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM;YAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,OAAO,CAAA;IAC3D,CAAC;IACD,OAAO,mBAAmB,CAAC;QACzB,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,CAAC;QACV,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,QAAQ;KACT,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import { defineTheme, type Theme, type ThemeDefinition, type ThemeLayer } from './defineTheme.js'\nimport { freezeTree, tokenDefaults } from './tokens.js'\nimport { generateTypography } from '../typography/index.js'\nimport type {\n ThemeColorSection,\n ThemeDocument,\n ThemeSectionExport,\n ThemeSectionName,\n ThemeSections\n} from './themeDocumentTypes.js'\n\nexport type * from './themeDocumentTypes.js'\n\nconst sectionNames: readonly ThemeSectionName[] = [\n ...Object.keys(tokenDefaults.light),\n 'components'\n] as ThemeSectionName[]\nconst stops = new Set([50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950])\ntype RecordValue = Record<string, unknown>\n\nfunction record(value: unknown, path: string): asserts value is RecordValue {\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n throw new TypeError(`${path} must be an object.`)\n }\n}\n\nfunction keys(value: RecordValue, allowed: readonly string[], path: string) {\n for (const key of Object.keys(value)) {\n if (!allowed.includes(key)) throw new TypeError(`Unknown key: ${path}.${key}.`)\n }\n}\n\nfunction textValue(value: unknown, path: string) {\n if (typeof value !== 'string' || !value.trim()) {\n throw new TypeError(`${path} must be a nonempty string.`)\n }\n}\n\nfunction choice(value: unknown, allowed: readonly unknown[], path: string) {\n if (!allowed.includes(value)) {\n throw new TypeError(`${path} must be one of: ${allowed.join(', ')}.`)\n }\n}\n\nfunction list(value: unknown, path: string): asserts value is unknown[] {\n if (!Array.isArray(value)) throw new TypeError(`${path} must be an array.`)\n}\n\nfunction unique(value: unknown, seen: Set<unknown>, path: string) {\n if (seen.has(value)) throw new TypeError(`Duplicate value at ${path}: ${String(value)}.`)\n seen.add(value)\n}\n\n/** Copy data without running getters/toJSON or silently losing functions and binaries. */\nfunction jsonCopy(value: unknown, path: string, ancestors = new Set<object>()): unknown {\n if (value === null || typeof value === 'string' || typeof value === 'boolean') return value\n if (typeof value === 'number' && Number.isFinite(value)) return value === 0 ? 0 : value\n if (!value || typeof value !== 'object')\n throw new TypeError(`${path} must contain JSON data only.`)\n if (ancestors.has(value)) throw new TypeError(`Circular reference at ${path}.`)\n const array = Array.isArray(value)\n const prototype = Object.getPrototypeOf(value)\n if (\n array ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null\n ) {\n throw new TypeError(`${path} must contain plain JSON objects, not class instances or binaries.`)\n }\n ancestors.add(value)\n const result: RecordValue | unknown[] = array ? [] : {}\n if (Object.getOwnPropertySymbols(value).length)\n throw new TypeError(`${path} cannot contain symbol keys.`)\n const descriptors = Object.getOwnPropertyDescriptors(value)\n for (const key of Object.keys(descriptors).sort()) {\n if (array && key === 'length') continue\n if (['__proto__', 'constructor', 'prototype'].includes(key))\n throw new TypeError(`Forbidden key: ${path}.${key}.`)\n const descriptor = descriptors[key]\n if (!('value' in descriptor) || !descriptor.enumerable) {\n throw new TypeError(`${path}.${key} must be an enumerable data property.`)\n }\n if (array && (!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= value.length)) {\n throw new TypeError(`${path}.${key} is not an array index.`)\n }\n // Optional object properties follow JSON omission rules; array holes/undefined are invalid.\n if (descriptor.value === undefined && !array) continue\n const copy = jsonCopy(descriptor.value, `${path}.${key}`, ancestors)\n Object.defineProperty(result, key, {\n value: copy,\n enumerable: true,\n writable: true,\n configurable: true\n })\n }\n if (array && Object.keys(result).length !== value.length)\n throw new TypeError(`${path} cannot contain array holes.`)\n ancestors.delete(value)\n return result\n}\n\nfunction validateColor(value: RecordValue, path: string) {\n if (value.brand !== undefined) {\n record(value.brand, `${path}.brand`)\n keys(value.brand, ['value', 'gamut', 'srgbFallback'], `${path}.brand`)\n textValue(value.brand.value, `${path}.brand.value`)\n choice(value.brand.gamut, ['srgb', 'display-p3'], `${path}.brand.gamut`)\n if (value.brand.srgbFallback !== undefined)\n textValue(value.brand.srgbFallback, `${path}.brand.srgbFallback`)\n if (value.fidelity === undefined) value.fidelity = 'anchored'\n }\n if (value.fidelity !== undefined)\n choice(value.fidelity, ['anchored', 'unanchored'], `${path}.fidelity`)\n if (value.palettes !== undefined) {\n list(value.palettes, `${path}.palettes`)\n const ids = new Set<unknown>()\n for (const [i, palette] of value.palettes.entries()) {\n const p = `${path}.palettes.${i}`\n record(palette, p)\n keys(palette, ['id', 'name', 'swatches'], p)\n textValue(palette.id, `${p}.id`)\n textValue(palette.name, `${p}.name`)\n unique(palette.id, ids, `${p}.id`)\n list(palette.swatches, `${p}.swatches`)\n if (!palette.swatches.length) throw new TypeError(`${p}.swatches must not be empty.`)\n const seen = new Set<unknown>()\n for (const [j, swatch] of palette.swatches.entries()) {\n const s = `${p}.swatches.${j}`\n record(swatch, s)\n keys(swatch, ['stop', 'value', 'srgbFallback'], s)\n if (!stops.has(swatch.stop as number))\n throw new TypeError(`${s}.stop must be a numbered color stop (50–950).`)\n unique(swatch.stop, seen, `${s}.stop`)\n textValue(swatch.value, `${s}.value`)\n if (swatch.srgbFallback !== undefined) textValue(swatch.srgbFallback, `${s}.srgbFallback`)\n }\n }\n }\n if (value.anchor !== undefined) {\n record(value.anchor, `${path}.anchor`)\n keys(value.anchor, ['paletteId', 'stop'], `${path}.anchor`)\n textValue(value.anchor.paletteId, `${path}.anchor.paletteId`)\n if (!stops.has(value.anchor.stop as number))\n throw new TypeError(`${path}.anchor.stop must be a numbered color stop (50–950).`)\n const color = value as ThemeColorSection\n const swatch = color.palettes\n ?.find(p => p.id === color.anchor!.paletteId)\n ?.swatches.find(s => s.stop === color.anchor!.stop)\n if (!color.brand || color.fidelity !== 'anchored' || swatch?.value !== color.brand.value) {\n throw new TypeError(\n `${path}.anchor must reference a swatch containing the exact brand.value with anchored fidelity. Regenerate or replace the color section.`\n )\n }\n }\n}\n\nfunction validateFonts(value: unknown, path: string) {\n list(value, path)\n const ids = new Set<unknown>()\n for (const [i, font] of value.entries()) {\n const p = `${path}.${i}`\n record(font, p)\n keys(font, ['id', 'family', 'source', 'weights', 'styles', 'axes'], p)\n textValue(font.id, `${p}.id`)\n textValue(font.family, `${p}.family`)\n unique(font.id, ids, `${p}.id`)\n choice(font.source, ['system', 'catalog', 'local'], `${p}.source`)\n if (font.axes !== undefined) {\n list(font.axes, `${p}.axes`)\n if (font.axes.length > 32) throw new TypeError(`${p}.axes supports at most 32 axes.`)\n const tags = new Set<unknown>()\n for (const [j, axis] of font.axes.entries()) {\n const at = `${p}.axes.${j}`\n record(axis, at)\n keys(axis, ['tag', 'min', 'default', 'max'], at)\n if (typeof axis.tag !== 'string' || !/^[A-Za-z][A-Za-z0-9]{3}$/.test(axis.tag))\n throw new TypeError(\n `${at}.tag must contain four ASCII letters/digits, starting with a letter.`\n )\n unique(axis.tag, tags, `${at}.tag`)\n for (const key of ['min', 'default', 'max'])\n if (\n typeof axis[key] !== 'number' ||\n !Number.isFinite(axis[key]) ||\n Math.abs(axis[key]) > 1000000\n )\n throw new TypeError(\n `${at}.${key} must be a finite number between -1000000 and 1000000.`\n )\n if (Number(axis.min) > Number(axis.default) || Number(axis.default) > Number(axis.max))\n throw new TypeError(`${at} must satisfy min <= default <= max.`)\n }\n }\n for (const key of ['weights', 'styles']) {\n if (font[key] === undefined) continue\n list(font[key], `${p}.${key}`)\n const seen = new Set<unknown>()\n for (const [j, item] of font[key].entries()) {\n const at = `${p}.${key}.${j}`\n if (key === 'styles') choice(item, ['normal', 'italic'], at)\n else if (typeof item !== 'number' || !Number.isFinite(item) || item < 1 || item > 1000)\n throw new TypeError(`${at} must be a weight from 1 to 1000.`)\n unique(item, seen, at)\n }\n }\n }\n}\n\nfunction toDefinition(sections: ThemeSections, id: string, name: string): ThemeDefinition {\n const common: {\n tokens: RecordValue\n components?: ThemeLayer['components']\n motion?: ThemeDefinition['motion']\n } = { tokens: {} }\n const modes = { light: { tokens: {} } as typeof common, dark: { tokens: {} } as typeof common }\n for (const sectionName of sectionNames) {\n const section = sections[sectionName]\n if (!section) continue\n if (sectionName === 'motion') common.motion = sections.motion?.profile\n if (sectionName === 'typography' && sections.typography?.typesetting !== undefined) {\n common.tokens.typography = generateTypography(sections.typography.typesetting).tokens\n }\n for (const mode of ['common', 'light', 'dark'] as const) {\n const values = mode === 'common' ? section.values : section.modes?.[mode]\n if (values === undefined) continue\n const layer = mode === 'common' ? common : modes[mode]\n if (sectionName === 'components') layer.components = values as ThemeLayer['components']\n else layer.tokens[sectionName] = merge(layer.tokens[sectionName], values)\n }\n }\n return { id, name, ...common, modes }\n}\n\n/** Read JSON.parse output (or data objects); unknown versions/keys fail with a path. */\nexport function parseThemeDocument(input: unknown): ThemeDocument | ThemeSectionExport {\n const value = jsonCopy(input, 'document')\n record(value, 'document')\n choice(value.kind, ['radiant-theme', 'radiant-theme-sections'], 'document.kind')\n if (value.version !== 1)\n throw new TypeError(\n `Unsupported document.version: ${String(value.version)}. Expected 1; migrate the configuration before importing.`\n )\n const full = value.kind === 'radiant-theme'\n keys(\n value,\n full ? ['kind', 'version', 'id', 'name', 'sections'] : ['kind', 'version', 'sections'],\n 'document'\n )\n record(value.sections, 'document.sections')\n keys(value.sections, sectionNames, 'document.sections')\n for (const [name, section] of Object.entries(value.sections)) {\n const path = `document.sections.${name}`\n record(section, path)\n keys(\n section,\n [\n 'values',\n 'modes',\n ...(name === 'motion'\n ? ['profile']\n : name === 'color'\n ? ['brand', 'fidelity', 'palettes', 'anchor']\n : name === 'typography'\n ? ['fonts', 'typesetting']\n : [])\n ],\n path\n )\n if (section.modes !== undefined) {\n record(section.modes, `${path}.modes`)\n keys(section.modes, ['light', 'dark'], `${path}.modes`)\n }\n if (name === 'color') validateColor(section, path)\n if (name === 'typography' && section.fonts !== undefined)\n validateFonts(section.fonts, `${path}.fonts`)\n }\n // Reuse the canonical token/component validation and resolution; no second token schema.\n defineTheme(\n toDefinition(\n value.sections as ThemeSections,\n full ? (value.id as string) : 'section-export',\n full ? (value.name as string) : 'Section export'\n )\n )\n return freezeTree(jsonCopy(value, 'document') as object) as ThemeDocument | ThemeSectionExport\n}\n\n/** Validate and detach an immutable, portable authoring snapshot. */\nexport function defineThemeDocument(document: ThemeDocument): ThemeDocument {\n const result = parseThemeDocument(document)\n if (result.kind !== 'radiant-theme')\n throw new TypeError('Expected a radiant-theme document with id and name.')\n return result\n}\n\n/** Compile only authored semantic values through the existing application theme runtime. */\nexport function compileThemeDocument(document: ThemeDocument): Theme {\n const validated = defineThemeDocument(document)\n return defineTheme(toDefinition(validated.sections, validated.id, validated.name))\n}\n\nfunction merge(base: unknown, patch: unknown): unknown {\n if (\n !base ||\n !patch ||\n typeof base !== 'object' ||\n typeof patch !== 'object' ||\n Array.isArray(base) ||\n Array.isArray(patch)\n )\n return patch\n const result: RecordValue = { ...base }\n for (const [key, value] of Object.entries(patch)) result[key] = merge(result[key], value)\n return result\n}\n\n/** Merge leaves/replace arrays, or replace only supplied sections. Empty replacement resets. */\nexport function updateThemeDocument(\n document: ThemeDocument,\n sections: ThemeSections,\n mode: 'merge' | 'replace' = 'merge'\n): ThemeDocument {\n const base = defineThemeDocument(document)\n choice(mode, ['merge', 'replace'], 'update mode')\n // Check the patch's JSON boundary before merging, including keys a spread would discard.\n const patch = jsonCopy(sections, 'sections')\n record(patch, 'sections')\n keys(patch, sectionNames, 'sections')\n const next = { ...base.sections } as RecordValue\n for (const [name, section] of Object.entries(patch))\n next[name] = mode === 'replace' ? section : merge(next[name], section)\n return defineThemeDocument({ ...base, sections: next })\n}\n\n/** Export exactly these sections, with no document identity or implicit component exceptions. */\nexport function exportThemeSections(\n document: ThemeDocument,\n names: readonly ThemeSectionName[]\n): ThemeSectionExport {\n const base = defineThemeDocument(document)\n list(names, 'section names')\n const sections: RecordValue = {}\n for (const name of names) {\n choice(name, sectionNames, 'section name')\n if (base.sections[name] !== undefined) sections[name] = base.sections[name]\n }\n return parseThemeDocument({\n kind: 'radiant-theme-sections',\n version: 1,\n sections\n }) as ThemeSectionExport\n}\n\n/** Bring existing authored themes into the workshop without materialising defaults as overrides. */\nexport function themeDocumentFromDefinition(definition: ThemeDefinition): ThemeDocument {\n const copy = jsonCopy(definition, 'theme') as ThemeDefinition\n defineTheme(copy)\n const sections: RecordValue = {}\n for (const name of sectionNames) {\n const section: RecordValue = {}\n const values = name === 'components' ? copy.components : copy.tokens?.[name]\n if (values !== undefined) section.values = values\n if (name === 'motion' && copy.motion !== undefined) section.profile = copy.motion\n const modes: RecordValue = {}\n for (const mode of ['light', 'dark'] as const) {\n const values =\n name === 'components' ? copy.modes?.[mode]?.components : copy.modes?.[mode]?.tokens?.[name]\n if (values !== undefined) modes[mode] = values\n }\n if (Object.keys(modes).length) section.modes = modes\n if (Object.keys(section).length) sections[name] = section\n }\n return defineThemeDocument({\n kind: 'radiant-theme',\n version: 1,\n id: copy.id,\n name: copy.name,\n sections\n })\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import type { MotionProfileInput } from '../motion/config.js';
1
2
  import type { ThemeComponentOverrides } from './components.js';
2
3
  import type { ThemeTokens } from './tokens.js';
3
4
  import type { TypographyInput } from '../typography/types.js';
@@ -57,9 +58,12 @@ export interface ThemeTypographySection extends ThemeSection<ThemeTokens['typogr
57
58
  /** Generated defaults; explicit values and mode values override these leaves. */
58
59
  readonly typesetting?: TypographyInput;
59
60
  }
61
+ export interface ThemeMotionSection extends ThemeSection<ThemeTokens['motion']> {
62
+ readonly profile?: MotionProfileInput;
63
+ }
60
64
  /** Token groups are the extension seams for richer typesetting and spring authoring. */
61
65
  export type ThemeSections = {
62
- readonly [K in keyof ThemeTokens]?: K extends 'color' ? ThemeColorSection : K extends 'typography' ? ThemeTypographySection : ThemeSection<ThemeTokens[K]>;
66
+ readonly [K in keyof ThemeTokens]?: K extends 'motion' ? ThemeMotionSection : K extends 'color' ? ThemeColorSection : K extends 'typography' ? ThemeTypographySection : ThemeSection<ThemeTokens[K]>;
63
67
  } & {
64
68
  readonly components?: ThemeSection<ThemeComponentOverrides>;
65
69
  };
@@ -1 +1 @@
1
- {"version":3,"file":"themeDocumentTypes.d.ts","sourceRoot":"","sources":["../../../src/themes/themeDocumentTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAE7D,yEAAyE;AACzE,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,QAAQ,CAAC,MAAM,C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AI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAA;CACjC;AAED,6FAA6F;AAC7F,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAA;IACvC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;IACnB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAA;CACjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"themeDocumentTypes.js","sourceRoot":"","sources":["../../../src/themes/themeDocumentTypes.ts"],"names":[],"mappings":"","sourcesContent":["import type { ThemeComponentOverrides } from './components.js'\nimport type { ThemeTokens } from './tokens.js'\nimport type { TypographyInput } from '../typography/types.js'\n\n/** One existing token group, with independently authored mode layers. */\nexport interface ThemeSection<T> {\n readonly values?: T\n readonly modes?: { readonly light?: T; readonly dark?: T }\n}\n\nexport type ThemeColorStop = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950\n\nexport interface ThemeBrandSource {\n /** Unmodified source text. A mapped fallback never replaces this value. */\n readonly value: string\n readonly gamut: 'srgb' | 'display-p3'\n readonly srgbFallback?: string\n}\n\nexport interface ThemePalette {\n readonly id: string\n readonly name: string\n readonly swatches: readonly {\n readonly stop: ThemeColorStop\n readonly value: string\n readonly srgbFallback?: string\n }[]\n}\n\nexport interface ThemeColorSection extends ThemeSection<ThemeTokens['color']> {\n readonly brand?: ThemeBrandSource\n /** Defaults to anchored when a brand is present. Generation belongs to the color engine. */\n readonly fidelity?: 'anchored' | 'unanchored'\n readonly palettes?: readonly ThemePalette[]\n /** Optional until generation; references the exact original, never its fallback. */\n readonly anchor?: { readonly paletteId: string; readonly stop: ThemeColorStop }\n}\n\n/** Available OpenType axis range, never a font file or a trial-only setting. */\nexport interface ThemeFontAxis {\n readonly tag: string\n readonly min: number\n readonly default: number\n readonly max: number\n}\n\n/** Portable descriptors only. The consuming application owns loading and local availability. */\nexport interface ThemeFontMetadata {\n readonly id: string\n readonly family: string\n readonly source: 'system' | 'catalog' | 'local'\n readonly weights?: readonly number[]\n readonly styles?: readonly ('normal' | 'italic')[]\n readonly axes?: readonly ThemeFontAxis[]\n}\n\nexport interface ThemeTypographySection extends ThemeSection<ThemeTokens['typography']> {\n readonly fonts?: readonly ThemeFontMetadata[]\n /** Generated defaults; explicit values and mode values override these leaves. */\n readonly typesetting?: TypographyInput\n}\n\n/** Token groups are the extension seams for richer typesetting and spring authoring. */\nexport type ThemeSections = {\n readonly [K in keyof ThemeTokens]?: K extends 'color'\n ? ThemeColorSection\n : K extends 'typography'\n ? ThemeTypographySection\n : ThemeSection<ThemeTokens[K]>\n} & {\n readonly components?: ThemeSection<ThemeComponentOverrides>\n}\nexport type ThemeSectionName = keyof ThemeSections\n\nexport interface ThemeDocument {\n readonly kind: 'radiant-theme'\n readonly version: 1\n readonly id: string\n readonly name: string\n readonly sections: ThemeSections\n}\n\n/** A selective export has no identity and cannot accidentally replace an entire document. */\nexport interface ThemeSectionExport {\n readonly kind: 'radiant-theme-sections'\n readonly version: 1\n readonly sections: ThemeSections\n}\n"]}
1
+ {"version":3,"file":"themeDocumentTypes.js","sourceRoot":"","sources":["../../../src/themes/themeDocumentTypes.ts"],"names":[],"mappings":"","sourcesContent":["import type { MotionProfileInput } from '../motion/config.js'\nimport type { ThemeComponentOverrides } from './components.js'\nimport type { ThemeTokens } from './tokens.js'\nimport type { TypographyInput } from '../typography/types.js'\n\n/** One existing token group, with independently authored mode layers. */\nexport interface ThemeSection<T> {\n readonly values?: T\n readonly modes?: { readonly light?: T; readonly dark?: T }\n}\n\nexport type ThemeColorStop = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950\n\nexport interface ThemeBrandSource {\n /** Unmodified source text. A mapped fallback never replaces this value. */\n readonly value: string\n readonly gamut: 'srgb' | 'display-p3'\n readonly srgbFallback?: string\n}\n\nexport interface ThemePalette {\n readonly id: string\n readonly name: string\n readonly swatches: readonly {\n readonly stop: ThemeColorStop\n readonly value: string\n readonly srgbFallback?: string\n }[]\n}\n\nexport interface ThemeColorSection extends ThemeSection<ThemeTokens['color']> {\n readonly brand?: ThemeBrandSource\n /** Defaults to anchored when a brand is present. Generation belongs to the color engine. */\n readonly fidelity?: 'anchored' | 'unanchored'\n readonly palettes?: readonly ThemePalette[]\n /** Optional until generation; references the exact original, never its fallback. */\n readonly anchor?: { readonly paletteId: string; readonly stop: ThemeColorStop }\n}\n\n/** Available OpenType axis range, never a font file or a trial-only setting. */\nexport interface ThemeFontAxis {\n readonly tag: string\n readonly min: number\n readonly default: number\n readonly max: number\n}\n\n/** Portable descriptors only. The consuming application owns loading and local availability. */\nexport interface ThemeFontMetadata {\n readonly id: string\n readonly family: string\n readonly source: 'system' | 'catalog' | 'local'\n readonly weights?: readonly number[]\n readonly styles?: readonly ('normal' | 'italic')[]\n readonly axes?: readonly ThemeFontAxis[]\n}\n\nexport interface ThemeTypographySection extends ThemeSection<ThemeTokens['typography']> {\n readonly fonts?: readonly ThemeFontMetadata[]\n /** Generated defaults; explicit values and mode values override these leaves. */\n readonly typesetting?: TypographyInput\n}\n\nexport interface ThemeMotionSection extends ThemeSection<ThemeTokens['motion']> {\n readonly profile?: MotionProfileInput\n}\n\n/** Token groups are the extension seams for richer typesetting and spring authoring. */\nexport type ThemeSections = {\n readonly [K in keyof ThemeTokens]?: K extends 'motion'\n ? ThemeMotionSection\n : K extends 'color'\n ? ThemeColorSection\n : K extends 'typography'\n ? ThemeTypographySection\n : ThemeSection<ThemeTokens[K]>\n} & {\n readonly components?: ThemeSection<ThemeComponentOverrides>\n}\nexport type ThemeSectionName = keyof ThemeSections\n\nexport interface ThemeDocument {\n readonly kind: 'radiant-theme'\n readonly version: 1\n readonly id: string\n readonly name: string\n readonly sections: ThemeSections\n}\n\n/** A selective export has no identity and cannot accidentally replace an entire document. */\nexport interface ThemeSectionExport {\n readonly kind: 'radiant-theme-sections'\n readonly version: 1\n readonly sections: ThemeSections\n}\n"]}
@@ -1,73 +1,45 @@
1
- # Browser and accessibility verification
2
-
3
- This is Radiant's support-target matrix and evidence process for the current
4
- ten-family batch. It defines what to check and how to report it. A target is a
5
- configuration we intend to verify; only a dated result identifies what passed.
6
- DEV-134 audits harmonisation coverage, DEV-57 checks installed compositions, and
7
- DEV-83 owns the complete-catalog release audit.
8
-
9
- The reference is [WCAG 2.2 A/AA](https://www.w3.org/TR/WCAG22/).
10
- Component tests contribute evidence; conformance applies to
11
- [whole pages and complete processes](https://www.w3.org/TR/WCAG22/#conformance-reqs).
12
- [Automated tools require human judgment](https://www.w3.org/WAI/test-evaluate/tools/selecting/#what-evaluation-tools-can-do-and-can-not-do).
13
- This matrix supplies neither a library-wide conformance claim nor certification.
14
-
15
- ## Targets and recorded coverage
16
-
17
- For manual targets, use a stable browser/AT release on a vendor-supported OS.
18
- Record the installed versions/builds, device and settings at the time of testing;
19
- "latest" is a target-selection rule, never a version in an evidence record.
20
- Record built-in VoiceOver against the exact OS version/build if a separate AT
21
- version is unavailable. A desktop engine test does not verify a mobile browser,
22
- and Playwright WebKit does not establish Safari/VoiceOver behavior.
23
-
24
- | Target | Input / AT | Evidence as of 2026-10-25 |
25
- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
26
- | Pinned Playwright Chromium on the local macOS host | Automated browser input and axe; no AT | Version-complete environment captured; execution result in [E47-local](https://github.com/cognitap/radiant/blob/main/docs/verification/2026-10-25-chromium.md) |
27
- | Pinned Playwright Chromium on Linux CI | Same automated suite; no AT | Each new run records its own environment and JUnit report; inspect that run's artifacts |
28
- | Windows + Firefox | Keyboard and NVDA | **Not run**; browser, OS and NVDA versions unrecorded |
29
- | macOS + Safari | Keyboard and VoiceOver | **Not run**; installed OS availability is not a test result |
30
- | iOS + Safari on a physical iPhone/iPad | Touch exploration and VoiceOver; external keyboard when claimed | **Not run**; device, OS/build, Safari and AT configuration unrecorded |
31
- | Android + Chrome on a physical device | Touch exploration and TalkBack; external keyboard when claimed | **Not run**; device, OS/build, Chrome and TalkBack versions unrecorded |
32
- | Desktop Chrome / Edge on supported Windows/macOS; Firefox and Safari on their supported desktop OS | Keyboard, zoom, visual rendering; real Windows contrast themes where applicable | **Not run as a version-complete manual matrix**; the historical Chrome review below is narrower evidence |
33
-
34
- The [2026-10 Storybook audit](https://github.com/cognitap/radiant/blob/main/docs/storybook-audit-2026-10.md)
35
- records earlier Chrome visual/interaction work and corrections. Its browser/OS
36
- builds were not captured, and AT was explicitly outside its scope. Preserve that
37
- history without promoting it to a version-complete browser or screen-reader pass.
38
- The open manual rows are known evidence gaps, not failures observed on those systems.
39
-
40
- ## Prepare a reproducible run
41
-
42
- 1. Use a fixed revision and matching JavaScript/CSS. Record the package or source
43
- revision, working-tree changes, CSS route (compiled or Tailwind), optional
44
- reset, custom overrides and font loading. Installed-consumer evidence must
45
- also identify its package version/archive integrity and fixture revision.
46
- 2. Open the [canonical stories and assembled recipes](system.md#reuse-the-canonical-examples).
47
- Inspect native and TanStack form owners, standalone/Card/Dialog placement,
48
- and both default and replacement action paths. Use default Radiant parts in
49
- the ordinary path so an adapter cannot hide a broken composition.
50
- 3. Use the global Theme/Mode selectors. Disable autoplay for manual interactions
51
- with `embed=true`; wait for the story scope, fonts and mode to settle. Check
52
- Canvas and Docs when changing preview integration. See
53
- [Storybook inspection](https://github.com/cognitap/radiant/blob/main/docs/storybook.md#verification).
54
- 4. Record each tested preset/mode rather than writing "all themes" from a sample.
55
- The visual target is every preset in explicit light/dark, relevant states,
56
- and System preference switching. For each claimed browser/AT combination,
57
- execute the applicable scenarios below; record sampled combinations and leave
58
- the rest unverified. Recheck a defect's affected combinations after its fix.
59
- 5. Capture OS/browser/AT versions and settings before acting. Include locale,
60
- browser zoom, viewport, orientation, OS text/display scaling, keyboard access
61
- and screen-reader mode/verbosity/gesture customisations. Record OS reduced
62
- motion/contrast settings separately from browser emulation.
63
-
64
- ## Manual scenarios
65
-
66
- Run desktop keyboard cases with the screen reader off, then with it on.
67
- Observe browser focus and the screen reader's reading cursor separately.
68
- Record conveyed names/roles/states and actual announcements; exact speech wording
69
- can vary by settings. The platform instructions below are operating guidance,
70
- not results for Radiant.
1
+ # Accessibility
2
+
3
+ What to check by hand, on which browsers and screen readers, and how to record
4
+ it. Automated tests are described in [testing](testing.md). The reference is
5
+ [WCAG 2.2 A/AA](https://www.w3.org/TR/WCAG22/). Component checks are evidence
6
+ toward it, but conformance applies to whole pages, so this is not a
7
+ certification.
8
+
9
+ ## Targets
10
+
11
+ | Target | Input / AT | Status |
12
+ | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
13
+ | Pinned Playwright Chromium on the local macOS host | Automated browser input and axe; no AT | Version-complete environment captured |
14
+ | Pinned Playwright Chromium on Linux CI | Same automated suite; no AT | Each new run records its own environment and JUnit report; inspect that run's artifacts |
15
+ | Windows + Firefox | Keyboard and NVDA | **Not run**; browser, OS and NVDA versions unrecorded |
16
+ | macOS + Safari | Keyboard and VoiceOver | **Not run**; installed OS availability is not a test result |
17
+ | iOS + Safari on a physical iPhone/iPad | Touch exploration and VoiceOver; external keyboard when claimed | **Not run**; device, OS/build, Safari and AT configuration unrecorded |
18
+ | Android + Chrome on a physical device | Touch exploration and TalkBack; external keyboard when claimed | **Not run**; device, OS/build, Chrome and TalkBack versions unrecorded |
19
+ | Desktop Chrome / Edge on supported Windows/macOS; Firefox and Safari on their supported desktop OS | Keyboard, zoom, visual rendering; real Windows contrast themes where applicable | **Not run as a version-complete manual matrix** |
20
+
21
+ A row marked **Not run** is a gap, not a failure. Record exact versions when you
22
+ test; "latest" is not a version. Playwright WebKit does not stand in for Safari
23
+ with VoiceOver, and a desktop engine does not stand in for a mobile browser.
24
+
25
+ ## Prepare a run
26
+
27
+ 1. Use a fixed commit with matching JavaScript and CSS. Note the CSS route,
28
+ reset, overrides and fonts.
29
+ 2. Open the [canonical examples](architecture.md#examples-and-type-fixtures).
30
+ Cover native and TanStack forms, standalone, Card and Dialog placement, and
31
+ both default and `render` actions.
32
+ 3. Pick the theme and mode in the Storybook toolbar. Add `embed=true` to the
33
+ iframe URL so plays do not interfere. See
34
+ [Storybook](storybook.md#verification).
35
+ 4. Record each preset and mode you test. Never write "all themes" from a sample.
36
+ 5. Record OS, browser and screen reader versions and settings first: zoom,
37
+ viewport, text scaling, reduced motion and contrast settings.
38
+
39
+ ## Scenarios
40
+
41
+ Run keyboard cases with the screen reader off, then on. Record what is conveyed
42
+ (names, roles, states), not exact wording.
71
43
 
72
44
  | ID | Action and expected observation |
73
45
  | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -81,14 +53,12 @@ not results for Radiant.
81
53
  | V3 — preferences | Enable real OS reduced motion and, on Windows, contrast themes/forced colors. Verify visible focus, selected/disabled/mixed marks, pending feedback and readable controls after decorative paint disappears. Label browser-emulated media checks as emulation; they do not establish real OS or AT behavior. |
82
54
  | T1 — mobile AT | On iOS/Android, explore by touch and swipe reading order, use heading/link/form navigation, activate with double-tap, edit and dismiss the on-screen keyboard, select options and submit/correct/reset the form. Open/close Dialog and verify touch/reading containment and restoration. Ensure collapsed/disabled/background items are treated appropriately. Measure the real label/control hit area and spacing, not only its glyph. |
83
55
 
84
- Native radio reverse-entry behavior can differ between browsers when no option
85
- is checked; record the behavior instead of forcing the ARIA example's focus
86
- model. [APG radio guidance](https://www.w3.org/WAI/ARIA/apg/patterns/radio/).
87
- Use the [modal Dialog guidance](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/)
88
- for content-dependent initial focus and restoration. APG is informative guidance;
89
- its examples do not certify a library's browser/AT compatibility.
56
+ Native radio entry with no option checked differs between browsers; record it
57
+ rather than forcing the [APG radio](https://www.w3.org/WAI/ARIA/apg/patterns/radio/)
58
+ model. Use the [APG modal dialog](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/)
59
+ guidance for initial focus and restoration.
90
60
 
91
- ### Operating the required AT pairs
61
+ ### Screen reader pairs
92
62
 
93
63
  | Pair | Procedure and primary reference |
94
64
  | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
@@ -97,11 +67,9 @@ its examples do not certify a library's browser/AT compatibility.
97
67
  | VoiceOver + Safari / iOS | Record device, iOS build, Safari context and VoiceOver settings. Touch explores; swipe Right/Left moves next/previous; double-tap activates. Use the rotor's headings/links/form-control categories and check the on-screen keyboard and modal boundaries. [Apple gestures](https://support.apple.com/guide/iphone/iph3e2e2281/ios), [Safari](https://support.apple.com/guide/iphone/iphe4ee74be8/ios). |
98
68
  | TalkBack + Chrome / Android | Record Android/build, device, Chrome and installed TalkBack version/settings. Touch explores; swipe Right/Left moves next/previous; double-tap activates; two-finger swipe scrolls. Use reading controls for headings/links/controls, accounting for customised gestures. [Google Chrome guidance](https://support.google.com/accessibility/android/answer/2633135?hl=en), [TalkBack gestures](https://support.google.com/accessibility/android/answer/6151827?hl=en). |
99
69
 
100
- ## WCAG evidence map
70
+ ## WCAG criteria
101
71
 
102
- These are relevant requirements to assess, not passed criterion cells. Each run
103
- records applicability and an observed outcome for the criteria it covers. Follow
104
- the linked definitions/exception rules; the list is not a complete product audit.
72
+ These are the criteria to assess for each scenario, not passed results.
105
73
 
106
74
  | Scenario / requirement area | Relevant A/AA criteria and evidence |
107
75
  | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
@@ -113,50 +81,23 @@ the linked definitions/exception rules; the list is not a complete product audit
113
81
  | K1/T1: pointer and targets | [2.5.2 A](https://www.w3.org/WAI/WCAG22/Understanding/pointer-cancellation.html), [2.5.8 AA](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html): record cancellation behavior and measured target/spacing, or the precise exception used. |
114
82
  | Additional hover/focus content | [1.4.13 AA](https://www.w3.org/WAI/WCAG22/Understanding/content-on-hover-or-focus.html): if extra content appears, check dismissal, hoverability and persistence; an ordinary paint-only hover effect is not extra content. |
115
83
 
116
- Keep these distinctions explicit:
117
-
118
- - **Focus:** 2.4.7 and 2.4.11 are AA. Minimum non-obscuring forbids total coverage
119
- by author content. The stronger two-pixel-perimeter rule in
120
- [2.4.13 Focus Appearance](https://www.w3.org/WAI/WCAG22/Understanding/focus-appearance.html)
121
- is AAA, not an AA minimum.
122
- - **Targets:** 2.5.8's AA minimum is 24×24 CSS px unless a specified exception
123
- applies. For its spacing exception, centre a 24px-diameter circle on each
124
- undersized target's bounding box: it must intersect neither another target
125
- nor another undersized target's circle. Other exceptions are an equivalent
126
- conforming control on the same page, inline text constraints, unmodified
127
- user-agent sizing, and essential/legally required presentation. Styled native
128
- controls are not automatically exempt. Record the chosen exception and geometry.
129
- - **Contrast:** large text is at least 18pt, or 14pt bold. Apply the criterion's
130
- inactive/decorative/logotype and unmodified-UA exceptions where applicable;
131
- record disabled legibility as usability evidence even when exempt.
132
- - **Spacing:** test line height 1.5×font size, paragraph spacing 2×font size,
133
- letter spacing 0.12×font size and word spacing 0.16×font size together, with
134
- applicable language/script exceptions. These are resilience tests, not required
135
- default typography settings.
136
- - **Preferences:** forced-colors and reduced-motion checks are part of Radiant's
137
- functional CSS target. An emulated preference or a `motion-reduce` class proves
138
- neither an OS/AT result nor complete WCAG conformance.
139
-
140
- ## Record and retain evidence
141
-
142
- `pnpm test:browser` first writes `output/browser/environment.json` from the
143
- installed Chromium and host OS, then runs the existing tests. Preflight clears
144
- prior environment/JUnit files first so an interrupted run cannot reuse an old
145
- pass. Preserve an old run before starting the next. The receipt contains
146
- exact browser/Node/Playwright/Vitest versions, OS/build details, revision, dirty
147
- flag and CI run link. AT is explicitly `not-run`. It is environment metadata,
148
- not a passing test result: pair it with the completed `junit.xml`, actual project/
149
- case selection, logs and manual evidence. A failed or interrupted suite does not
150
- inherit a prior pass from the receipt. The current command runs Chromium only.
151
-
152
- CI uploads these files as **browser-results** with a 14-day retention period.
153
- Before they expire, retain the version/result summary and relevant captures in a
154
- reviewed `docs/verification/YYYY-MM-DD-<scope>.md` record or durable issue/PR
155
- attachments. Link the exact CI run and commit; keep older records immutable and
156
- append a new verification when code, browser/AT, OS, theme or adapter changes.
157
- A preview/run of the environment recorder alone has no test-result status.
158
-
159
- Use this structure for each actual manual or automated run:
84
+ Easy to get wrong:
85
+
86
+ - **Focus:** 2.4.7 and 2.4.11 are AA. The two-pixel perimeter rule (2.4.13) is
87
+ AAA.
88
+ - **Targets:** 2.5.8 needs 24×24 CSS px unless an exception applies. For the
89
+ spacing exception, a 24px circle centered on each small target must not touch
90
+ another target or circle. Styled native controls are not exempt by default.
91
+ - **Contrast:** large text is 18pt, or 14pt bold. Disabled controls are exempt,
92
+ but record their legibility anyway.
93
+ - **Text spacing:** apply line height 1.5×, paragraph spacing 2×, letter spacing
94
+ 0.12× and word spacing 0.16× the font size together.
95
+ - **Preferences:** emulated reduced motion or forced colors is not an OS result.
96
+
97
+ ## Record results
98
+
99
+ Put the results in the pull request with a link to the CI run and commit. Use
100
+ this structure for each run:
160
101
 
161
102
  ```text
162
103
  Record ID, date/time, tester and method (manual / automated / emulated)
@@ -170,20 +111,13 @@ JUnit/log/capture/transcript links; defect issue + affected combinations
170
111
  Retest revision and result; remaining untested combinations/criterion gaps
171
112
  ```
172
113
 
173
- A failure gets a reproducible issue and an affected-combination list; link its
174
- fix and retest instead of erasing it. An inconclusive axe result stays incomplete
175
- until reviewed. Never turn a missing manual result into pass, N/A or "supported".
176
- Publishing this process can complete DEV-47 while the manual matrix remains open;
177
- those gaps continue into DEV-134/DEV-83's readiness decisions.
178
-
179
- ## Consumer responsibilities
180
-
181
- Radiant supplies native semantics, relationships and functional styling. Product
182
- owners provide meaningful names/headings/content, valid form instructions and
183
- errors, appropriate initial focus, sensible navigation, validation/persistence,
184
- font assets and theme/adapter choices. They must verify their rendered colors,
185
- content, responsive layouts, complete tasks and any overrides/host replacements.
186
- Page language/titles, consistent navigation, authentication, data-entry/error
187
- prevention and other page/process criteria also need product-level applicability
188
- and evidence. Neither a passing library matrix nor a paid certificate replaces
189
- that evaluation. Follow the [system guide](system.md) when composing the controls.
114
+ A failure gets an issue listing the affected combinations; link the fix and
115
+ the retest. An inconclusive axe result stays incomplete until reviewed. Never
116
+ turn a missing result into a pass.
117
+
118
+ ## What the application owns
119
+
120
+ Radiant supplies native semantics, relationships and functional styles. The
121
+ application supplies meaningful names, headings and content, form instructions
122
+ and errors, initial focus, navigation, and its own colors and overrides. It must
123
+ test its own pages and tasks; a passing library matrix does not cover them.