@cognitap/radiant 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/CHANGELOG.md +357 -0
  2. package/README.md +944 -29
  3. package/dist/library/Accordion.d.ts +56 -0
  4. package/dist/library/Accordion.d.ts.map +1 -0
  5. package/dist/library/Accordion.js +89 -0
  6. package/dist/library/Accordion.js.map +1 -0
  7. package/dist/library/Button.d.ts +25 -3
  8. package/dist/library/Button.d.ts.map +1 -1
  9. package/dist/library/Button.js +31 -3
  10. package/dist/library/Button.js.map +1 -1
  11. package/dist/library/Card.d.ts +31 -0
  12. package/dist/library/Card.d.ts.map +1 -0
  13. package/dist/library/Card.js +69 -0
  14. package/dist/library/Card.js.map +1 -0
  15. package/dist/library/Checkbox.d.ts +13 -0
  16. package/dist/library/Checkbox.d.ts.map +1 -0
  17. package/dist/library/Checkbox.js +77 -0
  18. package/dist/library/Checkbox.js.map +1 -0
  19. package/dist/library/Collapsible.d.ts +32 -0
  20. package/dist/library/Collapsible.d.ts.map +1 -0
  21. package/dist/library/Collapsible.js +99 -0
  22. package/dist/library/Collapsible.js.map +1 -0
  23. package/dist/library/Dialog.d.ts +50 -0
  24. package/dist/library/Dialog.d.ts.map +1 -0
  25. package/dist/library/Dialog.js +215 -0
  26. package/dist/library/Dialog.js.map +1 -0
  27. package/dist/library/Field.d.ts +68 -0
  28. package/dist/library/Field.d.ts.map +1 -0
  29. package/dist/library/Field.js +114 -0
  30. package/dist/library/Field.js.map +1 -0
  31. package/dist/library/Input.d.ts +10 -0
  32. package/dist/library/Input.d.ts.map +1 -0
  33. package/dist/library/Input.js +51 -0
  34. package/dist/library/Input.js.map +1 -0
  35. package/dist/library/Link.d.ts +27 -0
  36. package/dist/library/Link.d.ts.map +1 -0
  37. package/dist/library/Link.js +50 -0
  38. package/dist/library/Link.js.map +1 -0
  39. package/dist/library/RadioGroup.d.ts +27 -0
  40. package/dist/library/RadioGroup.d.ts.map +1 -0
  41. package/dist/library/RadioGroup.js +103 -0
  42. package/dist/library/RadioGroup.js.map +1 -0
  43. package/dist/library/ThemeScope.d.ts +10 -0
  44. package/dist/library/ThemeScope.d.ts.map +1 -0
  45. package/dist/library/ThemeScope.js +41 -0
  46. package/dist/library/ThemeScope.js.map +1 -0
  47. package/dist/library/actionStyles.d.ts +11 -0
  48. package/dist/library/actionStyles.d.ts.map +1 -0
  49. package/dist/library/actionStyles.js +75 -0
  50. package/dist/library/actionStyles.js.map +1 -0
  51. package/dist/library/cn.d.ts +1 -2
  52. package/dist/library/cn.d.ts.map +1 -1
  53. package/dist/library/cn.js +1 -8
  54. package/dist/library/cn.js.map +1 -1
  55. package/dist/library/color/colorFamilies.d.ts +3 -0
  56. package/dist/library/color/colorFamilies.d.ts.map +1 -0
  57. package/dist/library/color/colorFamilies.js +20 -0
  58. package/dist/library/color/colorFamilies.js.map +1 -0
  59. package/dist/library/color/generateColorWall.d.ts +54 -0
  60. package/dist/library/color/generateColorWall.d.ts.map +1 -0
  61. package/dist/library/color/generateColorWall.js +231 -0
  62. package/dist/library/color/generateColorWall.js.map +1 -0
  63. package/dist/library/color/index.d.ts +5 -0
  64. package/dist/library/color/index.d.ts.map +1 -0
  65. package/dist/library/color/index.js +3 -0
  66. package/dist/library/color/index.js.map +1 -0
  67. package/dist/library/color/oklch.d.ts +17 -0
  68. package/dist/library/color/oklch.d.ts.map +1 -0
  69. package/dist/library/color/oklch.js +79 -0
  70. package/dist/library/color/oklch.js.map +1 -0
  71. package/dist/library/color/recommendColorPalette.d.ts +65 -0
  72. package/dist/library/color/recommendColorPalette.d.ts.map +1 -0
  73. package/dist/library/color/recommendColorPalette.js +263 -0
  74. package/dist/library/color/recommendColorPalette.js.map +1 -0
  75. package/dist/library/controlStyles.d.ts +5 -0
  76. package/dist/library/controlStyles.d.ts.map +1 -0
  77. package/dist/library/controlStyles.js +15 -0
  78. package/dist/library/controlStyles.js.map +1 -0
  79. package/dist/library/index.d.ts +30 -1
  80. package/dist/library/index.d.ts.map +1 -1
  81. package/dist/library/index.js +14 -0
  82. package/dist/library/index.js.map +1 -1
  83. package/dist/library/internal/events.d.ts +8 -0
  84. package/dist/library/internal/events.d.ts.map +1 -0
  85. package/dist/library/internal/events.js +13 -0
  86. package/dist/library/internal/events.js.map +1 -0
  87. package/dist/library/internal/ids.d.ts +3 -0
  88. package/dist/library/internal/ids.d.ts.map +1 -0
  89. package/dist/library/internal/ids.js +6 -0
  90. package/dist/library/internal/ids.js.map +1 -0
  91. package/dist/library/internal/selection.d.ts +5 -0
  92. package/dist/library/internal/selection.d.ts.map +1 -0
  93. package/dist/library/internal/selection.js +18 -0
  94. package/dist/library/internal/selection.js.map +1 -0
  95. package/dist/library/presentation.d.ts +18 -0
  96. package/dist/library/presentation.d.ts.map +1 -0
  97. package/dist/library/presentation.js +2 -0
  98. package/dist/library/presentation.js.map +1 -0
  99. package/dist/library/react/useComposedRefs.d.ts +4 -0
  100. package/dist/library/react/useComposedRefs.d.ts.map +1 -0
  101. package/dist/library/react/useComposedRefs.js +28 -0
  102. package/dist/library/react/useComposedRefs.js.map +1 -0
  103. package/dist/library/react/useControllableState.d.ts +16 -0
  104. package/dist/library/react/useControllableState.d.ts.map +1 -0
  105. package/dist/library/react/useControllableState.js +29 -0
  106. package/dist/library/react/useControllableState.js.map +1 -0
  107. package/dist/library/react/useNativeOwner.d.ts +17 -0
  108. package/dist/library/react/useNativeOwner.d.ts.map +1 -0
  109. package/dist/library/react/useNativeOwner.js +17 -0
  110. package/dist/library/react/useNativeOwner.js.map +1 -0
  111. package/dist/library/reset.css +1 -0
  112. package/dist/library/styles.css +2 -1
  113. package/dist/library/themes/components.d.ts +217 -0
  114. package/dist/library/themes/components.d.ts.map +1 -0
  115. package/dist/library/themes/components.js +229 -0
  116. package/dist/library/themes/components.js.map +1 -0
  117. package/dist/library/themes/default.d.ts +2 -0
  118. package/dist/library/themes/default.d.ts.map +1 -0
  119. package/dist/library/themes/default.js +4 -0
  120. package/dist/library/themes/default.js.map +1 -0
  121. package/dist/library/themes/defineTheme.d.ts +33 -0
  122. package/dist/library/themes/defineTheme.d.ts.map +1 -0
  123. package/dist/library/themes/defineTheme.js +98 -0
  124. package/dist/library/themes/defineTheme.js.map +1 -0
  125. package/dist/library/themes/expressive.d.ts +2 -0
  126. package/dist/library/themes/expressive.d.ts.map +1 -0
  127. package/dist/library/themes/expressive.js +132 -0
  128. package/dist/library/themes/expressive.js.map +1 -0
  129. package/dist/library/themes/glass.d.ts +2 -0
  130. package/dist/library/themes/glass.d.ts.map +1 -0
  131. package/dist/library/themes/glass.js +132 -0
  132. package/dist/library/themes/glass.js.map +1 -0
  133. package/dist/library/themes/index.d.ts +18 -0
  134. package/dist/library/themes/index.d.ts.map +1 -0
  135. package/dist/library/themes/index.js +23 -0
  136. package/dist/library/themes/index.js.map +1 -0
  137. package/dist/library/themes/jelly.d.ts +2 -0
  138. package/dist/library/themes/jelly.d.ts.map +1 -0
  139. package/dist/library/themes/jelly.js +130 -0
  140. package/dist/library/themes/jelly.js.map +1 -0
  141. package/dist/library/themes/preset-values.d.ts +4 -0
  142. package/dist/library/themes/preset-values.d.ts.map +1 -0
  143. package/dist/library/themes/preset-values.js +5 -0
  144. package/dist/library/themes/preset-values.js.map +1 -0
  145. package/dist/library/themes/radiant.d.ts +2 -0
  146. package/dist/library/themes/radiant.d.ts.map +1 -0
  147. package/dist/library/themes/radiant.js +129 -0
  148. package/dist/library/themes/radiant.js.map +1 -0
  149. package/dist/library/themes/sharp-3d.d.ts +2 -0
  150. package/dist/library/themes/sharp-3d.d.ts.map +1 -0
  151. package/dist/library/themes/sharp-3d.js +142 -0
  152. package/dist/library/themes/sharp-3d.js.map +1 -0
  153. package/dist/library/themes/soft-squircle.d.ts +2 -0
  154. package/dist/library/themes/soft-squircle.d.ts.map +1 -0
  155. package/dist/library/themes/soft-squircle.js +131 -0
  156. package/dist/library/themes/soft-squircle.js.map +1 -0
  157. package/dist/library/themes/themeDocument.d.ts +16 -0
  158. package/dist/library/themes/themeDocument.d.ts.map +1 -0
  159. package/dist/library/themes/themeDocument.js +307 -0
  160. package/dist/library/themes/themeDocument.js.map +1 -0
  161. package/dist/library/themes/themeDocumentTypes.d.ts +69 -0
  162. package/dist/library/themes/themeDocumentTypes.d.ts.map +1 -0
  163. package/dist/library/themes/themeDocumentTypes.js +2 -0
  164. package/dist/library/themes/themeDocumentTypes.js.map +1 -0
  165. package/dist/library/themes/ticket.d.ts +2 -0
  166. package/dist/library/themes/ticket.d.ts.map +1 -0
  167. package/dist/library/themes/ticket.js +141 -0
  168. package/dist/library/themes/ticket.js.map +1 -0
  169. package/dist/library/themes/tokens.d.ts +100 -0
  170. package/dist/library/themes/tokens.d.ts.map +1 -0
  171. package/dist/library/themes/tokens.js +171 -0
  172. package/dist/library/themes/tokens.js.map +1 -0
  173. package/dist/library/themes/types.d.ts +2 -0
  174. package/dist/library/themes/types.d.ts.map +1 -0
  175. package/dist/library/themes/types.js +2 -0
  176. package/dist/library/themes/types.js.map +1 -0
  177. package/dist/library/themes/updateThemeAppearance.d.ts +29 -0
  178. package/dist/library/themes/updateThemeAppearance.d.ts.map +1 -0
  179. package/dist/library/themes/updateThemeAppearance.js +138 -0
  180. package/dist/library/themes/updateThemeAppearance.js.map +1 -0
  181. package/docs/accessibility.md +189 -0
  182. package/docs/system.md +231 -0
  183. package/docs/theming.md +804 -0
  184. package/package.json +34 -10
  185. package/src/Accordion.tsx +235 -0
  186. package/src/Button.tsx +95 -15
  187. package/src/Card.tsx +143 -0
  188. package/src/Checkbox.tsx +189 -0
  189. package/src/Collapsible.tsx +193 -0
  190. package/src/Dialog.tsx +333 -0
  191. package/src/Field.tsx +293 -0
  192. package/src/Input.tsx +82 -0
  193. package/src/Link.tsx +95 -0
  194. package/src/RadioGroup.tsx +255 -0
  195. package/src/ThemeScope.tsx +64 -0
  196. package/src/actionStyles.ts +90 -0
  197. package/src/cn.ts +1 -10
  198. package/src/color/colorFamilies.ts +19 -0
  199. package/src/color/generateColorWall.ts +358 -0
  200. package/src/color/index.ts +11 -0
  201. package/src/color/oklch.ts +95 -0
  202. package/src/color/recommendColorPalette.ts +375 -0
  203. package/src/controlStyles.ts +19 -0
  204. package/src/index.ts +130 -1
  205. package/src/internal/events.ts +17 -0
  206. package/src/internal/ids.ts +5 -0
  207. package/src/internal/selection.ts +20 -0
  208. package/src/presentation.ts +12 -0
  209. package/src/react/useComposedRefs.ts +32 -0
  210. package/src/react/useControllableState.ts +50 -0
  211. package/src/react/useNativeOwner.ts +33 -0
  212. package/src/styles.css +2 -14
  213. package/src/themes/baseline.css +116 -0
  214. package/src/themes/components.ts +249 -0
  215. package/src/themes/default.ts +4 -0
  216. package/src/themes/defineTheme.ts +145 -0
  217. package/src/themes/expressive.ts +132 -0
  218. package/src/themes/glass.ts +135 -0
  219. package/src/themes/index.ts +57 -0
  220. package/src/themes/jelly.ts +130 -0
  221. package/src/themes/preset-values.ts +5 -0
  222. package/src/themes/radiant.ts +129 -0
  223. package/src/themes/sharp-3d.ts +142 -0
  224. package/src/themes/soft-squircle.ts +131 -0
  225. package/src/themes/themeDocument.ts +340 -0
  226. package/src/themes/themeDocumentTypes.ts +76 -0
  227. package/src/themes/ticket.ts +141 -0
  228. package/src/themes/tokens.ts +262 -0
  229. package/src/themes/types.ts +10 -0
  230. package/src/themes/updateThemeAppearance.ts +172 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/themes/types.ts"],"names":[],"mappings":"","sourcesContent":["export type {\n SharedTokens,\n Theme,\n ThemeComponentOverrides,\n ThemeDefinition,\n ThemeLayer,\n ThemeMode,\n ThemeStyle,\n ThemeTokens\n} from './defineTheme.js'\n"]}
@@ -0,0 +1,29 @@
1
+ import type { ColorPalette } from '../color/recommendColorPalette.js';
2
+ import type { ThemeDocument, ThemeSection } from './themeDocumentTypes.js';
3
+ /** Bounded workshop controls; dimensions are derived from the neutral baseline, not compounded. */
4
+ export interface ThemeGeometrySettings {
5
+ /** 0.5–2; scales shared gaps and panel padding, retaining rem units. */
6
+ readonly spacing?: number;
7
+ /** 0.75–1.5; scales all three control heights, inline padding and indicators, not fonts. */
8
+ readonly density?: number;
9
+ /** Pixels, 0–32. Checkbox still caps its inherited radius; Radio stays circular. */
10
+ readonly controlRadius?: number;
11
+ /** Pixels, 0–48. */
12
+ readonly surfaceRadius?: number;
13
+ /** Pixels, 0–4. */
14
+ readonly controlBorderWidth?: number;
15
+ readonly surfaceBorderWidth?: number;
16
+ readonly borderStyle?: 'solid' | 'dashed' | 'dotted';
17
+ /** 0 = none, 1 = baseline, 2 = raised, 3 = floating. Passive and overlay shadows only. */
18
+ readonly elevation?: 0 | 1 | 2 | 3;
19
+ /** 0–0.9; black modal backdrop. Panel filtering remains a component exception. */
20
+ readonly backdropOpacity?: number;
21
+ }
22
+ export interface ThemeAppearanceSettings {
23
+ readonly version?: 1;
24
+ readonly palette?: Pick<ColorPalette, 'version' | 'color' | 'surface'>;
25
+ readonly geometry?: ThemeSection<ThemeGeometrySettings>;
26
+ }
27
+ /** Apply generated color/canvas atomically and geometry leaves without erasing authored exceptions. */
28
+ export declare function updateThemeAppearance(document: ThemeDocument, settings: ThemeAppearanceSettings): ThemeDocument;
29
+ //# sourceMappingURL=updateThemeAppearance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateThemeAppearance.d.ts","sourceRoot":"","sources":["../../../src/themes/updateThemeAppearance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAGrE,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE1E,mGAAmG;AACnG,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,4FAA4F;IAC5F,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,oFAAoF;IACpF,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;IAC/B,oBAAoB;IACpB,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;IAC/B,mBAAmB;IACnB,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAA;IACpD,0FAA0F;IAC1F,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAClC,kFAAkF;IAClF,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAClC;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IACpB,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;IACtE,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC,qBAAqB,CAAC,CAAA;CACxD;AAoGD,uGAAuG;AACvG,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,uBAAuB,GAChC,aAAa,CAsCf"}
@@ -0,0 +1,138 @@
1
+ import { tokenDefaults } from './tokens.js';
2
+ import { defineThemeDocument, updateThemeDocument } from './themeDocument.js';
3
+ const bounds = {
4
+ spacing: [0.5, 2],
5
+ density: [0.75, 1.5],
6
+ controlRadius: [0, 32],
7
+ surfaceRadius: [0, 48],
8
+ controlBorderWidth: [0, 4],
9
+ surfaceBorderWidth: [0, 4],
10
+ elevation: [0, 3],
11
+ backdropOpacity: [0, 0.9]
12
+ };
13
+ function record(value, path) {
14
+ if (!value || typeof value !== 'object' || Array.isArray(value))
15
+ throw new TypeError(`${path} must be an object.`);
16
+ }
17
+ function keys(value, allowed, path) {
18
+ for (const key of Object.keys(value))
19
+ if (!allowed.includes(key))
20
+ throw new TypeError(`Unknown ${path}.${key}.`);
21
+ }
22
+ function validate(value, path) {
23
+ record(value, path);
24
+ keys(value, [...Object.keys(bounds), 'borderStyle'], path);
25
+ for (const [key, item] of Object.entries(value)) {
26
+ if (item === undefined)
27
+ continue;
28
+ if (key === 'borderStyle') {
29
+ if (typeof item === 'string' && ['solid', 'dashed', 'dotted'].includes(item))
30
+ continue;
31
+ }
32
+ else {
33
+ const [min, max] = bounds[key];
34
+ if (typeof item === 'number' &&
35
+ Number.isFinite(item) &&
36
+ item >= min &&
37
+ item <= max &&
38
+ (key !== 'elevation' || Number.isInteger(item)))
39
+ continue;
40
+ throw new TypeError(`${path}.${key} must be a finite number from ${min} to ${max}${key === 'elevation' ? ' (integer)' : ''}.`);
41
+ }
42
+ throw new TypeError(`${path}.borderStyle must be solid, dashed or dotted.`);
43
+ }
44
+ }
45
+ const scaled = (rem, factor) => `${Number((parseFloat(rem) * factor).toFixed(6))}rem`;
46
+ function geometryTokens(settings, mode) {
47
+ const base = tokenDefaults[mode];
48
+ const spacing = {};
49
+ const control = {};
50
+ const surface = {};
51
+ if (settings.spacing !== undefined) {
52
+ for (const [key, value] of Object.entries(base.spacing))
53
+ spacing[key] = scaled(value, settings.spacing);
54
+ for (const key of ['padding', 'gap'])
55
+ surface[key] = scaled(base.surface[key], settings.spacing);
56
+ }
57
+ if (settings.density !== undefined)
58
+ for (const size of ['small', 'medium', 'large']) {
59
+ const metrics = {};
60
+ for (const key of ['height', 'paddingInline', 'indicatorSize'])
61
+ metrics[key] = scaled(base.control[size][key], settings.density);
62
+ control[size] = metrics;
63
+ }
64
+ for (const [key, target] of [
65
+ ['Radius', 'radius'],
66
+ ['BorderWidth', 'borderWidth']
67
+ ]) {
68
+ const a = settings[`control${key}`], b = settings[`surface${key}`];
69
+ if (a !== undefined)
70
+ control[target] = `${a}px`;
71
+ if (b !== undefined)
72
+ surface[target] = `${b}px`;
73
+ }
74
+ if (settings.borderStyle !== undefined)
75
+ control.borderStyle = surface.borderStyle = settings.borderStyle;
76
+ if (settings.elevation !== undefined) {
77
+ const level = settings.elevation;
78
+ surface.shadow =
79
+ level === 0
80
+ ? 'none'
81
+ : level === 1
82
+ ? base.surface.shadow
83
+ : `0 ${level * 2}px ${level * 6}px -2px rgb(0 0 0 / ${mode === 'light' ? 0.12 : 0.4})`;
84
+ surface.overlayShadow =
85
+ level === 0
86
+ ? 'none'
87
+ : level === 1
88
+ ? base.surface.overlayShadow
89
+ : `0 ${level * 12}px ${level * 32}px -16px rgb(0 0 0 / ${mode === 'light' ? 0.3 : 0.6})`;
90
+ }
91
+ if (settings.backdropOpacity !== undefined)
92
+ surface.backdrop = `rgb(0 0 0 / ${settings.backdropOpacity})`;
93
+ return {
94
+ ...(Object.keys(spacing).length ? { spacing } : {}),
95
+ ...(Object.keys(control).length ? { control } : {}),
96
+ ...(Object.keys(surface).length ? { surface } : {})
97
+ };
98
+ }
99
+ /** Apply generated color/canvas atomically and geometry leaves without erasing authored exceptions. */
100
+ export function updateThemeAppearance(document, settings) {
101
+ record(settings, 'appearance');
102
+ keys(settings, ['version', 'palette', 'geometry'], 'appearance');
103
+ if (settings.version !== undefined && settings.version !== 1)
104
+ throw new TypeError('Unsupported appearance.version; expected 1.');
105
+ let next = defineThemeDocument(document);
106
+ if (settings.palette !== undefined) {
107
+ record(settings.palette, 'appearance.palette');
108
+ if (settings.palette.version !== 1)
109
+ throw new TypeError('appearance.palette.version must be 1.');
110
+ record(settings.palette.color, 'appearance.palette.color');
111
+ record(settings.palette.surface, 'appearance.palette.surface');
112
+ next = updateThemeDocument(next, { color: settings.palette.color }, 'replace');
113
+ next = updateThemeDocument(next, { surface: settings.palette.surface });
114
+ }
115
+ const geometry = settings.geometry;
116
+ if (geometry === undefined)
117
+ return next;
118
+ record(geometry, 'appearance.geometry');
119
+ keys(geometry, ['values', 'modes'], 'appearance.geometry');
120
+ if (geometry.values !== undefined)
121
+ validate(geometry.values, 'appearance.geometry.values');
122
+ if (geometry.modes !== undefined) {
123
+ record(geometry.modes, 'appearance.geometry.modes');
124
+ keys(geometry.modes, ['light', 'dark'], 'appearance.geometry.modes');
125
+ }
126
+ for (const mode of ['light', 'dark']) {
127
+ if (geometry.modes?.[mode] !== undefined)
128
+ validate(geometry.modes[mode], `appearance.geometry.modes.${mode}`);
129
+ const values = { ...geometry.values };
130
+ for (const [key, value] of Object.entries(geometry.modes?.[mode] ?? {}))
131
+ if (value !== undefined)
132
+ Object.assign(values, { [key]: value });
133
+ const tokens = geometryTokens(values, mode);
134
+ next = updateThemeDocument(next, Object.fromEntries(Object.entries(tokens).map(([group, value]) => [group, { modes: { [mode]: value } }])));
135
+ }
136
+ return next;
137
+ }
138
+ //# sourceMappingURL=updateThemeAppearance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateThemeAppearance.js","sourceRoot":"","sources":["../../../src/themes/updateThemeAppearance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AA6B7E,MAAM,MAAM,GAAG;IACb,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IACjB,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;IACpB,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;IACtB,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;IACtB,kBAAkB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1B,kBAAkB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1B,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACjB,eAAe,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC;CACjB,CAAA;AACV,SAAS,MAAM,CAAC,KAAc,EAAE,IAAY;IAC1C,IAAI,CAAC,KAAK,IA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AAC,KAAK,EAAE,2BAA2B,CAAC,CAAA;QACnD,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,2BAA2B,CAAC,CAAA;IACtE,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,MAAM,CAAU,EAAE,CAAC;QAC9C,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,KAAK,SAAS;YACtC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,6BAA6B,IAAI,EAAE,CAAC,CAAA;QACrE,MAAM,MAAM,GAAG,EAAE,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAA;QACrC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACrE,IAAI,KAAK,KAAK,SAAS;gBAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;QAClE,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAC3C,IAAI,GAAG,mBAAmB,CACxB,IAAI,EACJ,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CACtF,CACF,CAAA;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import type { ColorPalette } from '../color/recommendColorPalette.js'\nimport { tokenDefaults, type ThemeTokens } from './tokens.js'\nimport { defineThemeDocument, updateThemeDocument } from './themeDocument.js'\nimport type { ThemeDocument, ThemeSection } from './themeDocumentTypes.js'\n\n/** Bounded workshop controls; dimensions are derived from the neutral baseline, not compounded. */\nexport interface ThemeGeometrySettings {\n /** 0.5–2; scales shared gaps and panel padding, retaining rem units. */\n readonly spacing?: number\n /** 0.75–1.5; scales all three control heights, inline padding and indicators, not fonts. */\n readonly density?: number\n /** Pixels, 0–32. Checkbox still caps its inherited radius; Radio stays circular. */\n readonly controlRadius?: number\n /** Pixels, 0–48. */\n readonly surfaceRadius?: number\n /** Pixels, 0–4. */\n readonly controlBorderWidth?: number\n readonly surfaceBorderWidth?: number\n readonly borderStyle?: 'solid' | 'dashed' | 'dotted'\n /** 0 = none, 1 = baseline, 2 = raised, 3 = floating. Passive and overlay shadows only. */\n readonly elevation?: 0 | 1 | 2 | 3\n /** 0–0.9; black modal backdrop. Panel filtering remains a component exception. */\n readonly backdropOpacity?: number\n}\n\nexport interface ThemeAppearanceSettings {\n readonly version?: 1\n readonly palette?: Pick<ColorPalette, 'version' | 'color' | 'surface'>\n readonly geometry?: ThemeSection<ThemeGeometrySettings>\n}\n\nconst bounds = {\n spacing: [0.5, 2],\n density: [0.75, 1.5],\n controlRadius: [0, 32],\n surfaceRadius: [0, 48],\n controlBorderWidth: [0, 4],\n surfaceBorderWidth: [0, 4],\n elevation: [0, 3],\n backdropOpacity: [0, 0.9]\n} as const\nfunction record(value: unknown, path: string): asserts value is Record<string, unknown> {\n if (!value || typeof value !== 'object' || Array.isArray(value))\n throw new TypeError(`${path} must be an object.`)\n}\nfunction keys(value: object, allowed: readonly string[], path: string) {\n for (const key of Object.keys(value))\n if (!allowed.includes(key)) throw new TypeError(`Unknown ${path}.${key}.`)\n}\nfunction validate(value: unknown, path: string): asserts value is ThemeGeometrySettings {\n record(value, path)\n keys(value, [...Object.keys(bounds), 'borderStyle'], path)\n for (const [key, item] of Object.entries(value)) {\n if (item === undefined) continue\n if (key === 'borderStyle') {\n if (typeof item === 'string' && ['solid', 'dashed', 'dotted'].includes(item)) continue\n } else {\n const [min, max] = bounds[key as keyof typeof bounds]\n if (\n typeof item === 'number' &&\n Number.isFinite(item) &&\n item >= min &&\n item <= max &&\n (key !== 'elevation' || Number.isInteger(item))\n )\n continue\n throw new TypeError(\n `${path}.${key} must be a finite number from ${min} to ${max}${key === 'elevation' ? ' (integer)' : ''}.`\n )\n }\n throw new TypeError(`${path}.borderStyle must be solid, dashed or dotted.`)\n }\n}\nconst scaled = (rem: string, factor: number) =>\n `${Number((parseFloat(rem) * factor).toFixed(6))}rem`\n\nfunction geometryTokens(settings: ThemeGeometrySettings, mode: 'light' | 'dark'): ThemeTokens {\n const base = tokenDefaults[mode]\n const spacing: Record<string, string> = {}\n const control: Record<string, unknown> = {}\n const surface: Record<string, string> = {}\n if (settings.spacing !== undefined) {\n for (const [key, value] of Object.entries(base.spacing))\n spacing[key] = scaled(value, settings.spacing)\n for (const key of ['padding', 'gap'] as const)\n surface[key] = scaled(base.surface[key], settings.spacing)\n }\n if (settings.density !== undefined)\n for (const size of ['small', 'medium', 'large'] as const) {\n const metrics: Record<string, string> = {}\n for (const key of ['height', 'paddingInline', 'indicatorSize'] as const)\n metrics[key] = scaled(base.control[size][key], settings.density)\n control[size] = metrics\n }\n for (const [key, target] of [\n ['Radius', 'radius'],\n ['BorderWidth', 'borderWidth']\n ] as const) {\n const a = settings[`control${key}`],\n b = settings[`surface${key}`]\n if (a !== undefined) control[target] = `${a}px`\n if (b !== undefined) surface[target] = `${b}px`\n }\n if (settings.borderStyle !== undefined)\n control.borderStyle = surface.borderStyle = settings.borderStyle\n if (settings.elevation !== undefined) {\n const level = settings.elevation\n surface.shadow =\n level === 0\n ? 'none'\n : level === 1\n ? base.surface.shadow\n : `0 ${level * 2}px ${level * 6}px -2px rgb(0 0 0 / ${mode === 'light' ? 0.12 : 0.4})`\n surface.overlayShadow =\n level === 0\n ? 'none'\n : level === 1\n ? base.surface.overlayShadow\n : `0 ${level * 12}px ${level * 32}px -16px rgb(0 0 0 / ${mode === 'light' ? 0.3 : 0.6})`\n }\n if (settings.backdropOpacity !== undefined)\n surface.backdrop = `rgb(0 0 0 / ${settings.backdropOpacity})`\n return {\n ...(Object.keys(spacing).length ? { spacing } : {}),\n ...(Object.keys(control).length ? { control } : {}),\n ...(Object.keys(surface).length ? { surface } : {})\n }\n}\n\n/** Apply generated color/canvas atomically and geometry leaves without erasing authored exceptions. */\nexport function updateThemeAppearance(\n document: ThemeDocument,\n settings: ThemeAppearanceSettings\n): ThemeDocument {\n record(settings, 'appearance')\n keys(settings, ['version', 'palette', 'geometry'], 'appearance')\n if (settings.version !== undefined && settings.version !== 1)\n throw new TypeError('Unsupported appearance.version; expected 1.')\n let next = defineThemeDocument(document)\n if (settings.palette !== undefined) {\n record(settings.palette, 'appearance.palette')\n if (settings.palette.version !== 1) throw new TypeError('appearance.palette.version must be 1.')\n record(settings.palette.color, 'appearance.palette.color')\n record(settings.palette.surface, 'appearance.palette.surface')\n next = updateThemeDocument(next, { color: settings.palette.color }, 'replace')\n next = updateThemeDocument(next, { surface: settings.palette.surface })\n }\n const geometry = settings.geometry\n if (geometry === undefined) return next\n record(geometry, 'appearance.geometry')\n keys(geometry, ['values', 'modes'], 'appearance.geometry')\n if (geometry.values !== undefined) validate(geometry.values, 'appearance.geometry.values')\n if (geometry.modes !== undefined) {\n record(geometry.modes, 'appearance.geometry.modes')\n keys(geometry.modes, ['light', 'dark'], 'appearance.geometry.modes')\n }\n for (const mode of ['light', 'dark'] as const) {\n if (geometry.modes?.[mode] !== undefined)\n validate(geometry.modes[mode], `appearance.geometry.modes.${mode}`)\n const values = { ...geometry.values }\n for (const [key, value] of Object.entries(geometry.modes?.[mode] ?? {}))\n if (value !== undefined) Object.assign(values, { [key]: value })\n const tokens = geometryTokens(values, mode)\n next = updateThemeDocument(\n next,\n Object.fromEntries(\n Object.entries(tokens).map(([group, value]) => [group, { modes: { [mode]: value } }])\n )\n )\n }\n return next\n}\n"]}
@@ -0,0 +1,189 @@
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.
71
+
72
+ | ID | Action and expected observation |
73
+ | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
74
+ | K1 — actions | Tab/Shift+Tab through Button, Link and Dialog actions, including default/custom hosts. Enter/Space activate buttons; Enter follows a link, while Space keeps native anchor behavior. Pending/disabled actions retain their documented guards/cues. Press, move away, then release to check cancellation. Visible text is included in the accessible name. |
75
+ | K2 — forms | Read Field labels/help/required/error text and RadioGroup legend/options. Exercise text entry, checkbox checked/unchecked/mixed state, radio arrows/Space and disabled options. Submit invalid then valid data; hear the error relationship and saved/reset result. Reset restores the right owner and clears stale feedback in native and TanStack recipes. |
76
+ | K3 — Dialog | Open through default Trigger and a compatible replacement. Confirm name/description, appropriate initial focus, keyboard focus containment, background inertness, a reachable visible close action, Escape and focus restoration. Repeat with long content and a narrow viewport. Check nonmodal behavior separately; a modal's standard exit makes its contained Tab cycle legitimate. |
77
+ | K4 — disclosures | Enter/Space toggle native summary; expanded state and meaningful heading/order reach AT. Closed content is excluded from reading/focus navigation while remaining mounted. Check nested Collapsible and single/multiple Accordion, disabled sections and independent instances. Keep native summary behavior rather than inventing button or roving-focus rules. |
78
+ | K5 — composition | Complete Recipes → Workspace: open the profile Dialog, correct an error, save/reset, open Privacy/Data retention and follow its Link. Check Card's reading order/heading and contained actions without adding a focus stop to its passive wrapper. Test reused forms and actual navigation/form data, not only a rendered role. |
79
+ | V1 — palette and state | For every claimed theme/mode, inspect rest/hover/press/focus, invalid/required, pending, selected/mixed and disabled states. Measure rendered text, outlines and state indicators against adjacent/composited backgrounds, especially Glass gradients. Record sizes, ratios and any criterion exception; keep non-color cues. |
80
+ | V2 — resizing | Test native browser zoom at 200% text resize and a 1280 CSS px viewport at 400% zoom (320 CSS px effective width), plus actual narrow viewports. Apply the text-spacing overrides below together. Check clipping, two-axis scrolling, modal scrolling, sticky/overlay focus obstruction and portrait/landscape. A resized viewport alone is not browser-zoom evidence. |
81
+ | 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
+ | 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
+
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.
90
+
91
+ ### Operating the required AT pairs
92
+
93
+ | Pair | Procedure and primary reference |
94
+ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
95
+ | NVDA + Firefox / Windows | Record NVDA's installed version and browse/focus settings. Use `NVDA+Space` to switch browse/focus modes; Tab/Shift+Tab also exercise native focus. Browse with heading/link/form/button/checkbox/radio commands and test actual input in focus mode. Capture the relevant Speech Viewer output alongside focus observations. [NVDA browse mode](https://download.nvaccess.org/documentation/userGuide.html#BrowseMode), [Speech Viewer](https://download.nvaccess.org/documentation/userGuide.html#SpeechViewer). |
96
+ | VoiceOver + Safari / macOS | Record Safari, OS/build, VoiceOver modifier and Safari/macOS keyboard navigation settings. Use `VO+Left/Right` to read, `VO+Space` to activate, and `VO+Shift+Down/Up` to enter/exit groups; use the rotor for headings/links/forms. Test plain Tab order as a separate observation. [Apple VoiceOver guide](https://support.apple.com/guide/voiceover/vo4be8816d70/mac), [rotor](https://support.apple.com/guide/voiceover/mchlp2719/mac). |
97
+ | 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
+ | 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
+
100
+ ## WCAG evidence map
101
+
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.
105
+
106
+ | Scenario / requirement area | Relevant A/AA criteria and evidence |
107
+ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
108
+ | K1–K5, T1: semantics and content | [1.1.1 A](https://www.w3.org/WAI/WCAG22/Understanding/non-text-content.html), [1.3.1 A](https://www.w3.org/WAI/WCAG22/Understanding/info-and-relationships.html), [1.3.2 A](https://www.w3.org/WAI/WCAG22/Understanding/meaningful-sequence.html), [2.4.4 A](https://www.w3.org/WAI/WCAG22/Understanding/link-purpose-in-context.html), [2.4.6 AA](https://www.w3.org/WAI/WCAG22/Understanding/headings-and-labels.html), [2.5.3 A](https://www.w3.org/WAI/WCAG22/Understanding/label-in-name.html), [3.3.2 A](https://www.w3.org/WAI/WCAG22/Understanding/labels-or-instructions.html), [4.1.2 A](https://www.w3.org/WAI/WCAG22/Understanding/name-role-value.html): capture reading order, accessible names, grouping, roles/states and meaningful instructions. |
109
+ | K1–K5: keyboard and focus | [2.1.1 A](https://www.w3.org/WAI/WCAG22/Understanding/keyboard.html), [2.1.2 A](https://www.w3.org/WAI/WCAG22/Understanding/no-keyboard-trap.html), [2.4.3 A](https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html), [2.4.7 AA](https://www.w3.org/WAI/WCAG22/Understanding/focus-visible.html), [2.4.11 AA](https://www.w3.org/WAI/WCAG22/Understanding/focus-not-obscured-minimum.html): record the key sequence, focus order, visible indicator, exit and overlay/scroll behavior. |
110
+ | K2/K5: input, errors and feedback | [1.3.5 AA](https://www.w3.org/WAI/WCAG22/Understanding/identify-input-purpose.html), [3.2.1 A](https://www.w3.org/WAI/WCAG22/Understanding/on-focus.html), [3.2.2 A](https://www.w3.org/WAI/WCAG22/Understanding/on-input.html), [3.3.1 A](https://www.w3.org/WAI/WCAG22/Understanding/error-identification.html), [3.3.3 AA](https://www.w3.org/WAI/WCAG22/Understanding/error-suggestion.html), [4.1.3 AA](https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html): record purpose metadata where applicable, context changes, error/correction text and actual status announcements without focus theft. Opening a dialog is not itself a status message. |
111
+ | V1: visual information | [1.4.1 A](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html), [1.4.3 AA](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html), [1.4.11 AA](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html): record non-color cues and measured contrast on actual backgrounds. Normal text needs 4.5:1; large text needs 3:1; required control/state visual information needs 3:1 against adjacent colors. |
112
+ | V2/T1: adaptable layout | [1.3.4 AA](https://www.w3.org/WAI/WCAG22/Understanding/orientation.html), [1.4.4 AA](https://www.w3.org/WAI/WCAG22/Understanding/resize-text.html), [1.4.10 AA](https://www.w3.org/WAI/WCAG22/Understanding/reflow.html), [1.4.12 AA](https://www.w3.org/WAI/WCAG22/Understanding/text-spacing.html): retain content/function at the tested zoom, effective width, spacing and orientation; record any applicable exceptions. |
113
+ | 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
+ | 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
+
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:
160
+
161
+ ```text
162
+ Record ID, date/time, tester and method (manual / automated / emulated)
163
+ Source revision + dirty changes, package integrity/fixture, CSS/reset/fonts
164
+ OS/version/build, device, browser/version, AT/version (or bundled OS build)
165
+ AT mode/verbosity/custom gestures, keyboard/zoom/scaling/viewport/orientation
166
+ Preset/mode and state; scenario IDs; applicable WCAG criteria or N/A reason
167
+ Steps + expected outcome + observed outcome / actual announcement / ratio / geometry
168
+ Result per case: pass / fail / not-run / incomplete / not-applicable (with reason)
169
+ JUnit/log/capture/transcript links; defect issue + affected combinations
170
+ Retest revision and result; remaining untested combinations/criterion gaps
171
+ ```
172
+
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.