@reqvire-org/ads 0.4.7 → 0.5.1

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 (751) hide show
  1. package/README.md +268 -420
  2. package/dist/accessibility-declarations.mjs +43 -0
  3. package/dist/active-clock.d.mts +30 -0
  4. package/dist/active-clock.mjs +26 -17
  5. package/dist/ads-errors.mjs +3684 -0
  6. package/dist/ads-view-choices.mjs +17 -0
  7. package/dist/ads-views.mjs +12 -0
  8. package/dist/analysis/captured-content.mjs +16 -0
  9. package/dist/analysis/compiler-options.mjs +3 -7
  10. package/dist/analysis/context.mjs +14 -20
  11. package/dist/analysis/controller-gates.mjs +119 -0
  12. package/dist/analysis/design-usage.mjs +142 -0
  13. package/dist/analysis/file-tree.mjs +44 -29
  14. package/dist/analysis/framework-imports.mjs +62 -0
  15. package/dist/analysis/glyph-macros.mjs +103 -0
  16. package/dist/analysis/helpers.mjs +119 -91
  17. package/dist/analysis/impact.mjs +25 -12
  18. package/dist/analysis/inputs.mjs +19 -13
  19. package/dist/analysis/mock-check.mjs +99 -0
  20. package/dist/analysis/module-graph.mjs +156 -0
  21. package/dist/analysis/module-resolvers.mjs +30 -28
  22. package/dist/analysis/native-adapter.mjs +139 -146
  23. package/dist/analysis/native-boundary.mjs +52 -0
  24. package/dist/analysis/native-project.mjs +331 -231
  25. package/dist/analysis/native-session.mjs +20 -0
  26. package/dist/analysis/owner-accessibility.mjs +74 -0
  27. package/dist/analysis/owner-analysis-cache.mjs +125 -0
  28. package/dist/analysis/owner-analysis-key.mjs +114 -0
  29. package/dist/analysis/owner-choices.mjs +896 -0
  30. package/dist/analysis/owner-composition.mjs +636 -0
  31. package/dist/analysis/owner-controls.mjs +27 -0
  32. package/dist/analysis/owner-discovery.mjs +164 -0
  33. package/dist/analysis/owner-failures.mjs +19 -0
  34. package/dist/analysis/owner-outcomes.mjs +42 -0
  35. package/dist/analysis/owner-reuse.mjs +100 -0
  36. package/dist/analysis/owner-source.mjs +1555 -0
  37. package/dist/analysis/prose-owners.mjs +57 -0
  38. package/dist/analysis/public-imports.mjs +31 -0
  39. package/dist/analysis/queries.mjs +72 -54
  40. package/dist/analysis/runtime-setters.mjs +114 -0
  41. package/dist/analysis/scenario-keys.mjs +151 -0
  42. package/dist/analysis/service.mjs +111 -70
  43. package/dist/analysis/standalone.mjs +40 -37
  44. package/dist/analysis/styling-ownership.mjs +298 -0
  45. package/dist/analysis/svg-attributes.mjs +199 -0
  46. package/dist/analysis/syntax.mjs +82 -78
  47. package/dist/analysis/visual-bindings.mjs +68 -0
  48. package/dist/analysis/worker-protocol.mjs +302 -0
  49. package/dist/analysis/worker.mjs +234 -166
  50. package/dist/api-signature.mjs +53 -0
  51. package/dist/app-icon-checks.mjs +298 -0
  52. package/dist/app-icon-declaration.d.mts +53 -0
  53. package/dist/app-icon-declaration.mjs +66 -0
  54. package/dist/asset-binding.mjs +35 -0
  55. package/dist/asset-catalog.mjs +83 -0
  56. package/dist/asset-declaration.d.mts +42 -0
  57. package/dist/asset-declaration.mjs +108 -0
  58. package/dist/asset-macro.d.mts +63 -0
  59. package/dist/asset-macro.mjs +22 -0
  60. package/dist/asset-model.mjs +74 -0
  61. package/dist/asset-usage.mjs +14 -0
  62. package/dist/asset-view-facts.mjs +41 -0
  63. package/dist/authoring-macro.d.mts +11 -0
  64. package/dist/authoring-macro.mjs +21 -0
  65. package/dist/autocomplete-hints.mjs +31 -0
  66. package/dist/availability.mjs +9 -0
  67. package/dist/behavior-macro.d.mts +31 -0
  68. package/dist/behavior-macro.mjs +3 -0
  69. package/dist/behavior-registry.mjs +358 -0
  70. package/dist/boundaries.mjs +50 -212
  71. package/dist/browser-runtime.mjs +73 -0
  72. package/dist/browser-test.d.mts +3 -0
  73. package/dist/browser-test.mjs +2 -0
  74. package/dist/bun-bundler.mjs +10 -0
  75. package/dist/bun-compiler.mjs +30 -18
  76. package/dist/bun-runtime.mjs +4 -0
  77. package/dist/bun-worker.mjs +10 -4
  78. package/dist/capture/request.mjs +81 -0
  79. package/dist/capture/worker.mjs +69 -40
  80. package/dist/capture/worker.page.mjs +6 -0
  81. package/dist/capture-store.mjs +159 -75
  82. package/dist/capture.mjs +232 -95
  83. package/dist/check-service.mjs +27 -33
  84. package/dist/check.mjs +206 -904
  85. package/dist/cli-arguments.mjs +278 -0
  86. package/dist/cli.mjs +374 -304
  87. package/dist/color-values.mjs +294 -242
  88. package/dist/composed-contrast.mjs +648 -0
  89. package/dist/composed-keyline.mjs +107 -0
  90. package/dist/config.mjs +162 -468
  91. package/dist/construction-output.mjs +345 -0
  92. package/dist/construction-spec.d.mts +915 -0
  93. package/dist/construction-spec.mjs +1178 -0
  94. package/dist/corner-overpaint.mjs +53 -0
  95. package/dist/css-length.mjs +80 -0
  96. package/dist/css-quantity.mjs +173 -0
  97. package/dist/deletion-model.mjs +56 -0
  98. package/dist/deletion-plan.mjs +364 -0
  99. package/dist/dependency-manifest.mjs +56 -0
  100. package/dist/design-context-model.d.mts +61 -0
  101. package/dist/design-context-model.mjs +79 -0
  102. package/dist/design-contexts.mjs +105 -0
  103. package/dist/design-foundation.mjs +532 -0
  104. package/dist/design-inputs.mjs +156 -0
  105. package/dist/design-modules.mjs +27 -0
  106. package/dist/design-rejection.d.mts +23 -0
  107. package/dist/design-rejection.mjs +29 -0
  108. package/dist/design-system-closure.mjs +108 -0
  109. package/dist/design-usage.mjs +54 -0
  110. package/dist/development-modules.mjs +2 -0
  111. package/dist/development-runtime.mjs +0 -7
  112. package/dist/digest.mjs +2 -0
  113. package/dist/draft-boundary.mjs +1 -27
  114. package/dist/draft-workspace.mjs +11 -5
  115. package/dist/emit/accept.mjs +33 -0
  116. package/dist/emit/app-icon-emission.mjs +124 -0
  117. package/dist/emit/app-icon-render.mjs +126 -0
  118. package/dist/emit/asset-imports.mjs +18 -0
  119. package/dist/emit/cli-report.mjs +97 -0
  120. package/dist/emit/contract.mjs +136 -0
  121. package/dist/emit/emission.mjs +182 -0
  122. package/dist/emit/font-emission.mjs +111 -0
  123. package/dist/emit/foundation-sheet.mjs +56 -0
  124. package/dist/emit/icon-containers.mjs +46 -0
  125. package/dist/emit/integrity.mjs +61 -0
  126. package/dist/emit/lock.mjs +66 -0
  127. package/dist/emit/namespace.mjs +79 -0
  128. package/dist/emit/operation-reply.mjs +3 -0
  129. package/dist/emit/operation.mjs +36 -0
  130. package/dist/emit/output-location.mjs +20 -0
  131. package/dist/emit/output-package.mjs +7 -0
  132. package/dist/emit/owner-emission-cache.mjs +52 -0
  133. package/dist/emit/palette-module.mjs +19 -0
  134. package/dist/emit/palette-refresh.mjs +77 -0
  135. package/dist/emit/preview-emitter.mjs +110 -0
  136. package/dist/emit/preview-tree.mjs +174 -0
  137. package/dist/emit/scheduler.mjs +75 -0
  138. package/dist/emit/service.mjs +249 -0
  139. package/dist/emit/sync.mjs +38 -0
  140. package/dist/emit/watch.mjs +74 -0
  141. package/dist/emit/writer.mjs +102 -0
  142. package/dist/evidence.mjs +6 -8
  143. package/dist/example-babel.mjs +7 -0
  144. package/dist/example-literals.mjs +88 -0
  145. package/dist/finding-rules.mjs +78 -77
  146. package/dist/focus-checks.mjs +93 -0
  147. package/dist/font-checks.mjs +185 -0
  148. package/dist/font-declaration.d.mts +64 -0
  149. package/dist/font-declaration.mjs +99 -0
  150. package/dist/font-fallback.d.mts +37 -0
  151. package/dist/font-fallback.mjs +25 -0
  152. package/dist/font-macro.d.mts +42 -0
  153. package/dist/font-macro.mjs +6 -0
  154. package/dist/font-metrics.d.mts +34 -0
  155. package/dist/font-metrics.mjs +314 -0
  156. package/dist/font-model.mjs +63 -0
  157. package/dist/form-states.mjs +82 -0
  158. package/dist/foundation-macro.d.mts +108 -0
  159. package/dist/foundation-macro.mjs +6 -0
  160. package/dist/frame-regions.mjs +253 -0
  161. package/dist/glyph-set-declaration.d.mts +27 -0
  162. package/dist/glyph-set-declaration.mjs +36 -0
  163. package/dist/grid-checks.mjs +94 -0
  164. package/dist/grid-facts.mjs +148 -0
  165. package/dist/grid-lowering.mjs +263 -0
  166. package/dist/guard/cli.mjs +51 -0
  167. package/dist/guard/config.mjs +67 -0
  168. package/dist/guard/files.mjs +31 -0
  169. package/dist/guard/index.mjs +3 -0
  170. package/dist/guard/run.mjs +56 -0
  171. package/dist/guard/tsconfig.declarations.json +13 -0
  172. package/dist/index.mjs +2 -7
  173. package/dist/init-project.mjs +134 -0
  174. package/dist/init.mjs +217 -264
  175. package/dist/input-digests.mjs +109 -163
  176. package/dist/input-scope.mjs +18 -41
  177. package/dist/inspected-svg.d.mts +28 -0
  178. package/dist/inspected-svg.mjs +40 -0
  179. package/dist/inventories.mjs +149 -0
  180. package/dist/inventory-query.mjs +15 -0
  181. package/dist/investigations.mjs +177 -99
  182. package/dist/json.d.mts +10 -0
  183. package/dist/json.mjs +36 -0
  184. package/dist/linaria/atomic-processor.json +96 -0
  185. package/dist/linaria/atomic-processor.mjs +2452 -0
  186. package/dist/linaria/backend-identity.mjs +26 -0
  187. package/dist/linaria/compatibility.json +61 -0
  188. package/dist/linaria/css-shape.mjs +94 -0
  189. package/dist/linaria/custom-property-css.mjs +56 -0
  190. package/dist/linaria/delivery.mjs +111 -0
  191. package/dist/linaria/direct-extract.mjs +43 -0
  192. package/dist/linaria/extraction-cache.mjs +31 -0
  193. package/dist/linaria/extraction-model.mjs +5 -0
  194. package/dist/linaria/fingerprint.mjs +183 -0
  195. package/dist/linaria/pair-manifest.json +2315 -0
  196. package/dist/linaria/persisted-extraction-cache.mjs +352 -0
  197. package/dist/linaria/preservation.mjs +13 -0
  198. package/dist/linaria/priority-emitted-rank.mjs +40 -0
  199. package/dist/linaria/priority-manifest.mjs +87 -0
  200. package/dist/linaria/priority-table.mjs +47 -0
  201. package/dist/linaria/priority-tiers.mjs +27 -0
  202. package/dist/linaria/processor-host.mjs +42 -0
  203. package/dist/linaria/processor-runtime.mjs +36 -0
  204. package/dist/linaria-processor-NOTICES.md +147 -0
  205. package/dist/lowering-components.mjs +14 -0
  206. package/dist/lowering-effects.mjs +38 -0
  207. package/dist/lowering-emitter.mjs +29 -0
  208. package/dist/lowering-enter.mjs +31 -0
  209. package/dist/lowering-hidden.mjs +30 -0
  210. package/dist/lowering-layer.mjs +141 -0
  211. package/dist/lowering-motion.mjs +37 -0
  212. package/dist/lowering-normalize.mjs +194 -0
  213. package/dist/lowering-overlaps.mjs +328 -0
  214. package/dist/lowering-paint.mjs +32 -0
  215. package/dist/lowering-properties.mjs +165 -0
  216. package/dist/lowering-region-layout.mjs +225 -0
  217. package/dist/lowering-sequence.mjs +89 -0
  218. package/dist/lowering-serialize.mjs +40 -0
  219. package/dist/lowering-session.mjs +137 -0
  220. package/dist/lowering-tiers.mjs +23 -0
  221. package/dist/lowering-transitions.mjs +53 -0
  222. package/dist/mcp/ads-mcp.mjs +423 -0
  223. package/dist/mcp/apps.mjs +3 -25
  224. package/dist/mcp/behavior-pages.mjs +58 -51
  225. package/dist/mcp/build-status.mjs +233 -267
  226. package/dist/mcp/catalog.mjs +21 -128
  227. package/dist/mcp/compiler-channel.mjs +218 -83
  228. package/dist/mcp/context.mjs +50 -40
  229. package/dist/mcp/deletions.mjs +147 -0
  230. package/dist/mcp/draft-discovery.mjs +43 -38
  231. package/dist/mcp/drafts.mjs +635 -691
  232. package/dist/mcp/execution-context.mjs +33 -22
  233. package/dist/mcp/execution-coordinator.mjs +367 -354
  234. package/dist/mcp/execution-results.mjs +440 -173
  235. package/dist/mcp/mutation-limits.mjs +1 -2
  236. package/dist/mcp/mutations.mjs +515 -553
  237. package/dist/mcp/patch.mjs +117 -75
  238. package/dist/mcp/preview-http.bundle.js +3 -7
  239. package/dist/mcp/preview-http.mjs +220 -107
  240. package/dist/mcp/preview-owner-guard.mjs +81 -43
  241. package/dist/mcp/preview-watch.mjs +428 -365
  242. package/dist/mcp/preview-widget.bundle.js +42 -46
  243. package/dist/mcp/preview-work.mjs +25 -13
  244. package/dist/mcp/prompts.mjs +22 -16
  245. package/dist/mcp/resource-loader.js +1 -1
  246. package/dist/mcp/result-pages.mjs +94 -54
  247. package/dist/mcp/sandbox-host.mjs +41 -19
  248. package/dist/mcp/server-discovery.mjs +96 -0
  249. package/dist/mcp/server-guides.mjs +43 -0
  250. package/dist/mcp/server-host.mjs +203 -0
  251. package/dist/mcp/server-observation.mjs +225 -0
  252. package/dist/mcp/server-project.mjs +371 -0
  253. package/dist/mcp/server-resources.mjs +466 -0
  254. package/dist/mcp/server-shared.mjs +79 -0
  255. package/dist/mcp/server-tools.mjs +791 -0
  256. package/dist/mcp/server.mjs +2 -2813
  257. package/dist/mcp/showcase-host.mjs +209 -135
  258. package/dist/mcp/showcase-http.mjs +50 -28
  259. package/dist/mcp/skills.mjs +32 -36
  260. package/dist/mcp/text-diff.mjs +18 -36
  261. package/dist/measured-geometry.mjs +157 -0
  262. package/dist/motion-model.mjs +52 -0
  263. package/dist/non-text-contrast.mjs +118 -0
  264. package/dist/owner-analysis-check.mjs +711 -0
  265. package/dist/owner-design.mjs +15 -0
  266. package/dist/owner-errors.mjs +216 -0
  267. package/dist/owner-lowering.mjs +206 -0
  268. package/dist/owner-scenarios.mjs +854 -0
  269. package/dist/ownership-model.d.mts +6 -0
  270. package/dist/ownership-model.mjs +143 -0
  271. package/dist/package-declarations.mjs +34 -0
  272. package/dist/paint-contrast.mjs +186 -0
  273. package/dist/palette-generated.mjs +101 -116
  274. package/dist/pictogram-model.mjs +13 -51
  275. package/dist/placeholder-contrast.mjs +35 -0
  276. package/dist/platform-features.mjs +401 -0
  277. package/dist/press-scale.mjs +26 -0
  278. package/dist/preview-bun.mjs +334 -404
  279. package/dist/preview-compile-inputs.mjs +78 -0
  280. package/dist/preview-contexts.mjs +7 -0
  281. package/dist/preview-controls.mjs +35 -0
  282. package/dist/preview-failure.mjs +20 -10
  283. package/dist/preview-files.mjs +18 -36
  284. package/dist/preview-imports.mjs +76 -70
  285. package/dist/preview-incremental.mjs +322 -222
  286. package/dist/preview-inputs.mjs +26 -26
  287. package/dist/preview-manifest-update.mjs +67 -49
  288. package/dist/preview-requests.mjs +10 -17
  289. package/dist/preview-resources.mjs +275 -323
  290. package/dist/preview-scope.mjs +15 -17
  291. package/dist/preview-source.mjs +182 -0
  292. package/dist/preview-spatial.mjs +27 -0
  293. package/dist/profile-macro.d.mts +56 -0
  294. package/dist/profile-macro.mjs +6 -0
  295. package/dist/profile-model.d.mts +65 -0
  296. package/dist/profile-model.mjs +213 -0
  297. package/dist/profile-view-facts.mjs +93 -0
  298. package/dist/program-cache.mjs +9 -7
  299. package/dist/project-boundary.mjs +8 -13
  300. package/dist/project-documents.mjs +25 -29
  301. package/dist/property-registrations.mjs +44 -35
  302. package/dist/prose-model.d.mts +81 -0
  303. package/dist/prose-model.mjs +101 -0
  304. package/dist/public-catalog.mjs +76 -0
  305. package/dist/recipe-defaults.mjs +117 -0
  306. package/dist/recipe-macro.d.mts +502 -0
  307. package/dist/recipe-macro.mjs +23 -0
  308. package/dist/recipe-model.d.mts +26 -0
  309. package/dist/recipe-model.mjs +214 -0
  310. package/dist/region-lowering.mjs +723 -0
  311. package/dist/registration-css.mjs +41 -0
  312. package/dist/registration-roles.mjs +35 -0
  313. package/dist/render-audit/axe-run.page.mjs +28 -0
  314. package/dist/render-audit/corner-overpaint.page.mjs +54 -0
  315. package/dist/render-audit/first-render.page.mjs +35 -0
  316. package/dist/render-audit/image-shape.page.mjs +42 -0
  317. package/dist/render-audit/layout-overflow.page.mjs +240 -0
  318. package/dist/render-audit/layout-shift.page.mjs +36 -0
  319. package/dist/render-audit/non-text-contrast.page.mjs +138 -0
  320. package/dist/render-audit/render-states.mjs +66 -293
  321. package/dist/render-audit/render-states.page.mjs +177 -0
  322. package/dist/render-audit/text-scale.mjs +42 -0
  323. package/dist/render-audit/text-scale.page.mjs +25 -0
  324. package/dist/render-audit/worker.mjs +130 -112
  325. package/dist/render-audit/worker.page.mjs +21 -0
  326. package/dist/render-audit.mjs +490 -500
  327. package/dist/resource-limits.mjs +174 -223
  328. package/dist/result.d.mts +34 -0
  329. package/dist/result.mjs +60 -0
  330. package/dist/role-vocabulary.d.mts +260 -0
  331. package/dist/role-vocabulary.mjs +258 -0
  332. package/dist/runtime-paint-contrast.mjs +97 -0
  333. package/dist/runtime-paint.mjs +42 -0
  334. package/dist/runtime-requirements.mjs +10 -11
  335. package/dist/runtime-style.mjs +21 -0
  336. package/dist/scenario-groups.mjs +42 -33
  337. package/dist/scenario-inspector.mjs +4 -4
  338. package/dist/scenario-kit.d.mts +85 -0
  339. package/dist/scenario-kit.mjs +18 -0
  340. package/dist/scenario-registry-model.mjs +2 -0
  341. package/dist/scenario-registry.mjs +89 -108
  342. package/dist/scenarios-compiler.mjs +875 -662
  343. package/dist/scheme-switch.d.mts +8 -0
  344. package/dist/scheme-switch.mjs +1 -0
  345. package/dist/showcase/ads-views.mjs +166 -0
  346. package/dist/showcase/assets-view.mjs +252 -0
  347. package/dist/showcase/client.bundle.js +211 -48
  348. package/dist/showcase/guide-controls.d.mts +28 -0
  349. package/dist/showcase/guide-controls.mjs +31 -0
  350. package/dist/showcase/http-client.bundle.js +172 -9
  351. package/dist/showcase/index.html +1 -1
  352. package/dist/showcase/preview-frame.css +18 -0
  353. package/dist/showcase/preview-frame.d.mts +5 -0
  354. package/dist/showcase/preview-frame.mjs +4 -0
  355. package/dist/showcase/preview-root.d.mts +2 -0
  356. package/dist/showcase/preview-root.mjs +9 -0
  357. package/dist/showcase/profiles-view.mjs +321 -0
  358. package/dist/showcase/project-rules.mjs +9 -0
  359. package/dist/showcase/sandbox.bundle.js +1 -1
  360. package/dist/showcase/scenario-page.d.mts +49 -0
  361. package/dist/showcase/scenario-page.mjs +105 -0
  362. package/dist/showcase/style.css +2 -0
  363. package/dist/showcase/token-sample.mjs +89 -0
  364. package/dist/showcase/tokens-view.mjs +233 -0
  365. package/dist/showcase/ui/apple-touch-icon-9zwv3w79.png +0 -0
  366. package/dist/showcase/{favicon.ico → ui/favicon-c2c9kvtf.ico} +0 -0
  367. package/dist/showcase/ui/icon-192-t5zh7mxx.png +0 -0
  368. package/dist/showcase/ui/icon-512-ed6yz0n0.png +0 -0
  369. package/dist/showcase/ui/ui.css +1 -1353
  370. package/dist/showcase/ui/ui.js +165 -1064
  371. package/dist/showcase-http-routes.mjs +28 -21
  372. package/dist/skills/README.md +28 -28
  373. package/dist/skills/ads-designer/README.md +1 -1
  374. package/dist/skills/ads-designer/SKILL.md +313 -551
  375. package/dist/skills/ads-designer/references/accessibility.md +162 -114
  376. package/dist/skills/ads-designer/references/atomic-styles.md +72 -277
  377. package/dist/skills/ads-designer/references/behaviors.md +144 -280
  378. package/dist/skills/ads-designer/references/branding.md +137 -222
  379. package/dist/skills/ads-designer/references/captures.md +13 -7
  380. package/dist/skills/ads-designer/references/cli.md +80 -63
  381. package/dist/skills/ads-designer/references/contracts.md +225 -286
  382. package/dist/skills/ads-designer/references/design-craft.md +2 -2
  383. package/dist/skills/ads-designer/references/design-data.md +299 -323
  384. package/dist/skills/ads-designer/references/drafts.md +83 -22
  385. package/dist/skills/ads-designer/references/evidence.md +2 -1
  386. package/dist/skills/ads-designer/references/forms.md +199 -0
  387. package/dist/skills/ads-designer/references/guarded-editing.md +37 -48
  388. package/dist/skills/ads-designer/references/layers.md +64 -76
  389. package/dist/skills/ads-designer/references/layout.md +224 -330
  390. package/dist/skills/ads-designer/references/mobile.md +2 -2
  391. package/dist/skills/ads-designer/references/motion.md +66 -25
  392. package/dist/skills/ads-designer/references/performance.md +55 -50
  393. package/dist/skills/ads-designer/references/pictograms.md +62 -127
  394. package/dist/skills/ads-designer/references/recipes.md +368 -0
  395. package/dist/skills/ads-designer/references/review.md +51 -95
  396. package/dist/skills/ads-designer/references/runtimes.md +34 -33
  397. package/dist/skills/ads-designer/references/scenarios.md +256 -216
  398. package/dist/skills/ads-designer/references/stress-test.md +13 -5
  399. package/dist/skills/ads-designer/references/validation.md +28 -21
  400. package/dist/skills/ads-designer/references/workflows.md +7 -5
  401. package/dist/skills/ads-import/SKILL.md +29 -29
  402. package/dist/skills/ads-import/references/atomic-styles.md +72 -277
  403. package/dist/skills/ads-import/references/behaviors.md +144 -280
  404. package/dist/skills/ads-import/references/branding.md +24 -41
  405. package/dist/skills/ads-import/references/captures.md +13 -7
  406. package/dist/skills/ads-import/references/cli.md +80 -63
  407. package/dist/skills/ads-import/references/compatibility.md +3 -3
  408. package/dist/skills/ads-import/references/contracts.md +225 -286
  409. package/dist/skills/ads-import/references/design-data.md +299 -323
  410. package/dist/skills/ads-import/references/drafts.md +83 -22
  411. package/dist/skills/ads-import/references/evidence.md +2 -1
  412. package/dist/skills/ads-import/references/forms.md +199 -0
  413. package/dist/skills/ads-import/references/guarded-editing.md +37 -48
  414. package/dist/skills/ads-import/references/implementation.md +20 -20
  415. package/dist/skills/ads-import/references/layers.md +64 -76
  416. package/dist/skills/ads-import/references/layout.md +224 -330
  417. package/dist/skills/ads-import/references/recipes.md +368 -0
  418. package/dist/skills/ads-import/references/review.md +51 -95
  419. package/dist/skills/ads-import/references/runtimes.md +34 -33
  420. package/dist/skills/ads-import/references/scenarios.md +256 -216
  421. package/dist/skills/ads-import/references/tokens.md +26 -17
  422. package/dist/skills/ads-import/references/validation.md +28 -21
  423. package/dist/skills/ads-import/references/workflows.md +7 -5
  424. package/dist/skills/ads-migrate/SKILL.md +20 -5
  425. package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +6 -0
  426. package/dist/skills/ads-migrate/references/0.4.7-to-0.5.0-boundary.md +71 -0
  427. package/dist/skills/ads-migrate/references/0.4.7-to-0.5.0-grid.md +204 -0
  428. package/dist/skills/ads-migrate/references/0.4.7-to-0.5.0.md +727 -0
  429. package/dist/skills/ads-migrate/references/0.5.0-to-0.5.1.md +239 -0
  430. package/dist/skills/ads-port/SKILL.md +27 -28
  431. package/dist/skills/ads-port/references/atomic-styles.md +72 -277
  432. package/dist/skills/ads-port/references/behaviors.md +144 -280
  433. package/dist/skills/ads-port/references/captures.md +13 -7
  434. package/dist/skills/ads-port/references/cli.md +80 -63
  435. package/dist/skills/ads-port/references/contracts.md +225 -286
  436. package/dist/skills/ads-port/references/design-data.md +299 -323
  437. package/dist/skills/ads-port/references/drafts.md +83 -22
  438. package/dist/skills/ads-port/references/evidence.md +2 -1
  439. package/dist/skills/ads-port/references/forms.md +199 -0
  440. package/dist/skills/ads-port/references/guarded-editing.md +37 -48
  441. package/dist/skills/ads-port/references/layers.md +64 -76
  442. package/dist/skills/ads-port/references/layout.md +224 -330
  443. package/dist/skills/ads-port/references/lint-and-docs.md +2 -3
  444. package/dist/skills/ads-port/references/native-implementation.md +23 -33
  445. package/dist/skills/ads-port/references/recipes.md +368 -0
  446. package/dist/skills/ads-port/references/review.md +51 -95
  447. package/dist/skills/ads-port/references/runtimes.md +34 -33
  448. package/dist/skills/ads-port/references/scenarios.md +256 -216
  449. package/dist/skills/ads-port/references/validation.md +28 -21
  450. package/dist/skills/ads-port/references/workflows.md +7 -5
  451. package/dist/source-inventory.mjs +33 -0
  452. package/dist/source-values.mjs +272 -262
  453. package/dist/spatial-css.mjs +403 -0
  454. package/dist/spatial-metadata.mjs +11 -11
  455. package/dist/spatial-model.mjs +438 -0
  456. package/dist/spatial-reading.mjs +127 -0
  457. package/dist/stage-timing.mjs +27 -0
  458. package/dist/state-conditions.d.mts +80 -0
  459. package/dist/state-conditions.mjs +107 -0
  460. package/dist/static-values.mjs +94 -0
  461. package/dist/surface-contrast.mjs +252 -0
  462. package/dist/surface-effects.mjs +98 -0
  463. package/dist/target-size.mjs +177 -0
  464. package/dist/task-cache.mjs +142 -136
  465. package/dist/task-worker.mjs +18 -18
  466. package/dist/test-boundaries.mjs +50 -189
  467. package/dist/token-checks.mjs +21 -0
  468. package/dist/token-dtcg.mjs +136 -0
  469. package/dist/token-expression.mjs +19 -0
  470. package/dist/token-inventory.mjs +146 -0
  471. package/dist/token-operations.mjs +37 -0
  472. package/dist/token-overlap.mjs +29 -0
  473. package/dist/token-provenance.mjs +260 -0
  474. package/dist/token-references.mjs +71 -0
  475. package/dist/token-registrations.mjs +116 -0
  476. package/dist/token-resolution.mjs +38 -0
  477. package/dist/token-sections.mjs +123 -0
  478. package/dist/token-shapes.mjs +121 -0
  479. package/dist/token-sheet-check.mjs +54 -0
  480. package/dist/token-type-check.mjs +89 -0
  481. package/dist/token-view-facts.mjs +111 -0
  482. package/dist/tsconfig.declarations.json +24 -0
  483. package/dist/types/css-tree.d.ts +45 -0
  484. package/dist/ui-framework.mjs +34 -34
  485. package/dist/units.mjs +186 -226
  486. package/dist/unknown.d.mts +9 -0
  487. package/dist/unknown.mjs +13 -0
  488. package/dist/unreached-sources.mjs +5 -0
  489. package/dist/validation-checks.mjs +62 -71
  490. package/dist/validation-inputs.mjs +209 -279
  491. package/dist/validation.mjs +132 -159
  492. package/dist/verification/browser.d.mts +21 -25
  493. package/dist/verification/browser.mjs +281 -124
  494. package/dist/verification/browser.page.d.mts +22 -0
  495. package/dist/verification/browser.page.mjs +19 -0
  496. package/dist/verification/paint-audit.page.d.mts +55 -0
  497. package/dist/verification/paint-audit.page.mjs +144 -0
  498. package/dist/verification/playwright-reporter.mjs +160 -0
  499. package/dist/verification/preview-startup.d.mts +51 -0
  500. package/dist/verification/preview-startup.mjs +76 -0
  501. package/dist/verification/request.d.mts +28 -0
  502. package/dist/verification/request.mjs +30 -0
  503. package/dist/verification/unit-preload.mjs +37 -0
  504. package/dist/verification.mjs +574 -607
  505. package/docs/ADS.md +585 -565
  506. package/docs/ARCHITECTURE.md +2002 -1384
  507. package/docs/ASSETS.md +487 -0
  508. package/docs/BEHAVIORS.md +339 -370
  509. package/docs/CACHING.md +365 -154
  510. package/docs/CHANGELOG.md +462 -21
  511. package/docs/COMPARISON.md +21 -26
  512. package/docs/DESIGN-REFERENCES.md +40 -27
  513. package/docs/GUIDE.md +2473 -1292
  514. package/docs/LANGUAGE.md +1159 -0
  515. package/docs/LOWERING.md +180 -0
  516. package/docs/MCP.md +1461 -1179
  517. package/docs/MOTION.md +491 -0
  518. package/docs/PROFILE-KINDS.md +544 -0
  519. package/docs/PROFILES.md +176 -0
  520. package/docs/RULES.md +590 -0
  521. package/docs/TOKEN-ROLES.md +377 -0
  522. package/docs/benchmarks/README.md +26 -27
  523. package/package.json +59 -45
  524. package/dist/a11y.mjs +0 -187
  525. package/dist/assets.mjs +0 -159
  526. package/dist/atomic-composition.mjs +0 -337
  527. package/dist/atomic-trace.mjs +0 -162
  528. package/dist/behavior-libraries.mjs +0 -174
  529. package/dist/behaviors.mjs +0 -306
  530. package/dist/brand-assets.mjs +0 -458
  531. package/dist/brands.mjs +0 -141
  532. package/dist/component-contrast.mjs +0 -256
  533. package/dist/construction-styles.cjs +0 -10
  534. package/dist/contracts/foundation.json +0 -211
  535. package/dist/contracts/tokens.json +0 -52
  536. package/dist/contracts.d.mts +0 -30
  537. package/dist/contrast-composition.mjs +0 -80
  538. package/dist/contrast-styles.mjs +0 -88
  539. package/dist/control-padding.mjs +0 -113
  540. package/dist/css-values.mjs +0 -27
  541. package/dist/declarative-flow.mjs +0 -244
  542. package/dist/design-values.mjs +0 -173
  543. package/dist/font-rules.mjs +0 -108
  544. package/dist/fonts-generated.mjs +0 -112
  545. package/dist/foundation-views.mjs +0 -242
  546. package/dist/foundation.mjs +0 -154
  547. package/dist/generated-entries.mjs +0 -198
  548. package/dist/html.mjs +0 -30
  549. package/dist/icons.mjs +0 -154
  550. package/dist/image-attributes.mjs +0 -187
  551. package/dist/image-size.mjs +0 -28
  552. package/dist/layers.mjs +0 -461
  553. package/dist/layout-widths.mjs +0 -332
  554. package/dist/linaria/atomic-css.cjs +0 -2
  555. package/dist/linaria/atomic-styled.cjs +0 -2
  556. package/dist/linaria/preserve-values.cjs +0 -58
  557. package/dist/linaria/spatial-inputs.cjs +0 -56
  558. package/dist/linaria.d.mts +0 -1
  559. package/dist/linaria.mjs +0 -9
  560. package/dist/lockup-composition.mjs +0 -44
  561. package/dist/lockup-model.cjs +0 -64
  562. package/dist/paint-contracts.mjs +0 -216
  563. package/dist/pictograms.mjs +0 -52
  564. package/dist/public-api.mjs +0 -121
  565. package/dist/public-props.mjs +0 -91
  566. package/dist/render-audit/axe-run.mjs +0 -17
  567. package/dist/render-audit/first-render.mjs +0 -40
  568. package/dist/render-audit/image-shape.mjs +0 -46
  569. package/dist/render-audit/layout-overflow.mjs +0 -167
  570. package/dist/render-audit/layout-shift.mjs +0 -32
  571. package/dist/render-audit/non-text-contrast.mjs +0 -151
  572. package/dist/render-audit/pictograms.mjs +0 -88
  573. package/dist/render-color-probe.mjs +0 -202
  574. package/dist/render-composition.mjs +0 -186
  575. package/dist/runtime-contracts.mjs +0 -506
  576. package/dist/scenario-program.mjs +0 -19
  577. package/dist/scenario-selectors.mjs +0 -237
  578. package/dist/scenario-slots.mjs +0 -217
  579. package/dist/scenario-trace.mjs +0 -314
  580. package/dist/scenarios-vite.d.mts +0 -2
  581. package/dist/scenarios-vite.mjs +0 -2
  582. package/dist/scenarios.mjs +0 -616
  583. package/dist/selector-match.mjs +0 -94
  584. package/dist/showcase/comparison.js +0 -48
  585. package/dist/showcase/connection.js +0 -10
  586. package/dist/showcase/draft-navigation.js +0 -59
  587. package/dist/showcase/foundation-view.css +0 -58
  588. package/dist/showcase/foundation-view.mjs +0 -255
  589. package/dist/showcase/guide-controls.ads.review.mjs +0 -32
  590. package/dist/showcase/http-connection.js +0 -86
  591. package/dist/showcase/http-preview.js +0 -81
  592. package/dist/showcase/icons.js +0 -2
  593. package/dist/showcase/navigation.js +0 -13
  594. package/dist/showcase/pictogram-view.mjs +0 -53
  595. package/dist/showcase/preview-frame.ads.review.css +0 -46
  596. package/dist/showcase/preview-frame.ads.review.d.mts +0 -11
  597. package/dist/showcase/preview-frame.ads.review.mjs +0 -22
  598. package/dist/showcase/preview-state.js +0 -11
  599. package/dist/showcase/refresh-scheduler.js +0 -23
  600. package/dist/showcase/resource-reader.js +0 -37
  601. package/dist/showcase-coverage.mjs +0 -139
  602. package/dist/source-symbols.mjs +0 -4
  603. package/dist/spatial-composition.mjs +0 -322
  604. package/dist/spatial-contexts.cjs +0 -56
  605. package/dist/spatial-css.cjs +0 -351
  606. package/dist/spatial-inputs.cjs +0 -80
  607. package/dist/spatial-model.cjs +0 -322
  608. package/dist/spatial.mjs +0 -21
  609. package/dist/stage-timing.cjs +0 -21
  610. package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +0 -105
  611. package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +0 -275
  612. package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +0 -7
  613. package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +0 -10
  614. package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +0 -8
  615. package/dist/starters/preact/ds.config.json +0 -37
  616. package/dist/starters/preact/package.json +0 -35
  617. package/dist/starters/preact/src/vite-env.d.ts +0 -7
  618. package/dist/starters/preact/tsconfig.json +0 -35
  619. package/dist/starters/preact/vite.config.ts +0 -23
  620. package/dist/starters/react/ADS.md +0 -286
  621. package/dist/starters/react/README.md +0 -184
  622. package/dist/starters/react/biome.css.json +0 -21
  623. package/dist/starters/react/design-system/assets/brand/README.md +0 -41
  624. package/dist/starters/react/design-system/assets/brand/app-icon.svg +0 -4
  625. package/dist/starters/react/design-system/assets/brand/logo.dark.svg +0 -6
  626. package/dist/starters/react/design-system/assets/brand/logo.svg +0 -6
  627. package/dist/starters/react/design-system/assets/glyphs/README.md +0 -15
  628. package/dist/starters/react/design-system/assets/glyphs/aliases.json +0 -1
  629. package/dist/starters/react/design-system/assets/glyphs/check.svg +0 -1
  630. package/dist/starters/react/design-system/assets/glyphs/chevron-down.svg +0 -1
  631. package/dist/starters/react/design-system/assets/glyphs/chevron-right.svg +0 -1
  632. package/dist/starters/react/design-system/assets/glyphs/close.svg +0 -1
  633. package/dist/starters/react/design-system/assets/glyphs/external-link.svg +0 -1
  634. package/dist/starters/react/design-system/assets/glyphs/info.svg +0 -1
  635. package/dist/starters/react/design-system/assets/glyphs/menu.svg +0 -1
  636. package/dist/starters/react/design-system/assets/glyphs/plus.svg +0 -1
  637. package/dist/starters/react/design-system/assets/glyphs/search.svg +0 -1
  638. package/dist/starters/react/design-system/assets/glyphs/warning.svg +0 -1
  639. package/dist/starters/react/design-system/assets/pictograms/catalog.ads.json +0 -13
  640. package/dist/starters/react/design-system/assets/pictograms/journey.dark.svg +0 -7
  641. package/dist/starters/react/design-system/assets/pictograms/journey.svg +0 -7
  642. package/dist/starters/react/design-system/components/Actions/Button/Button.ads.exports.ts +0 -1
  643. package/dist/starters/react/design-system/components/Actions/Button/Button.ads.fixture.ts +0 -1
  644. package/dist/starters/react/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -13
  645. package/dist/starters/react/design-system/components/Actions/Button/Button.tsx +0 -56
  646. package/dist/starters/react/design-system/components/Actions/Button/README.md +0 -12
  647. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.exports.ts +0 -1
  648. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.fixture.ts +0 -9
  649. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.scenario.tsx +0 -16
  650. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +0 -60
  651. package/dist/starters/react/design-system/components/Actions/IconButton/README.md +0 -17
  652. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.exports.ts +0 -1
  653. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.fixture.ts +0 -6
  654. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.scenario.tsx +0 -16
  655. package/dist/starters/react/design-system/components/Content/Icon/Icon.tsx +0 -42
  656. package/dist/starters/react/design-system/components/Content/Icon/README.md +0 -17
  657. package/dist/starters/react/design-system/components/Content/Icon/glyphs.ts +0 -17
  658. package/dist/starters/react/design-system/components/Content/Image/Image.ads.exports.ts +0 -1
  659. package/dist/starters/react/design-system/components/Content/Image/Image.ads.fixture.ts +0 -2
  660. package/dist/starters/react/design-system/components/Content/Image/Image.ads.scenario.tsx +0 -13
  661. package/dist/starters/react/design-system/components/Content/Image/Image.tsx +0 -51
  662. package/dist/starters/react/design-system/components/Content/Image/README.md +0 -20
  663. package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.exports.ts +0 -1
  664. package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.fixture.ts +0 -1
  665. package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.scenario.tsx +0 -12
  666. package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +0 -35
  667. package/dist/starters/react/design-system/components/Content/Logo/README.md +0 -12
  668. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.exports.ts +0 -1
  669. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.fixture.ts +0 -1
  670. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.scenario.tsx +0 -7
  671. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.tsx +0 -26
  672. package/dist/starters/react/design-system/components/Forms/TextField/README.md +0 -14
  673. package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.exports.ts +0 -1
  674. package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.fixture.ts +0 -6
  675. package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -13
  676. package/dist/starters/react/design-system/components/Forms/TextField/TextField.tsx +0 -61
  677. package/dist/starters/react/design-system/composition/Search/SearchPage/README.md +0 -4
  678. package/dist/starters/react/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +0 -7
  679. package/dist/starters/react/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +0 -16
  680. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/README.md +0 -5
  681. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.fixture.ts +0 -13
  682. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.scenario.tsx +0 -22
  683. package/dist/starters/react/design-system/controllers/Palette/Palette.ads.exports.ts +0 -1
  684. package/dist/starters/react/design-system/controllers/Palette/Palette.ts +0 -164
  685. package/dist/starters/react/design-system/index.ts +0 -12
  686. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.exports.ts +0 -1
  687. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.fixture.ts +0 -7
  688. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.scenario.tsx +0 -15
  689. package/dist/starters/react/design-system/patterns/Conversation/Conversation.tsx +0 -105
  690. package/dist/starters/react/design-system/patterns/Conversation/README.md +0 -9
  691. package/dist/starters/react/design-system/patterns/Search/SearchBar/README.md +0 -12
  692. package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.exports.ts +0 -1
  693. package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +0 -1
  694. package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +0 -11
  695. package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.tsx +0 -41
  696. package/dist/starters/react/design-system/patterns/Shell/Floating.ads.fixture.ts +0 -5
  697. package/dist/starters/react/design-system/patterns/Shell/Floating.ads.scenario.tsx +0 -21
  698. package/dist/starters/react/design-system/patterns/Shell/README.md +0 -43
  699. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.exports.ts +0 -1
  700. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.fixture.ts +0 -5
  701. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +0 -21
  702. package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +0 -274
  703. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +0 -1
  704. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.review.tsx +0 -7
  705. package/dist/starters/react/design-system/review/index.ads.review.ts +0 -4
  706. package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.exports.ts +0 -1
  707. package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.review.tsx +0 -6
  708. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +0 -1
  709. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +0 -10
  710. package/dist/starters/react/design-system/showcase/mcp/main.ads.mount.tsx +0 -10
  711. package/dist/starters/react/design-system/styles.css +0 -7
  712. package/dist/starters/react/design-system/tokens/base.css +0 -36
  713. package/dist/starters/react/design-system/tokens/catalog.ads.json +0 -1221
  714. package/dist/starters/react/design-system/tokens/colors.css +0 -215
  715. package/dist/starters/react/design-system/tokens/elevation.css +0 -53
  716. package/dist/starters/react/design-system/tokens/spacing.css +0 -87
  717. package/dist/starters/react/design-system/tokens/spatial.ads.json +0 -70
  718. package/dist/starters/react/design-system/tokens/themes.generated.css +0 -142
  719. package/dist/starters/react/design-system/tokens/themes.generated.ts +0 -402
  720. package/dist/starters/react/design-system/tokens/typography.css +0 -31
  721. package/dist/starters/react/ds.config.json +0 -37
  722. package/dist/starters/react/gitignore.template +0 -8
  723. package/dist/starters/react/package.json +0 -39
  724. package/dist/starters/react/scripts/build-mcp-previews.mjs +0 -3
  725. package/dist/starters/react/src/vite-env.d.ts +0 -7
  726. package/dist/starters/react/tsconfig.build.json +0 -20
  727. package/dist/starters/react/tsconfig.json +0 -34
  728. package/dist/starters/react/vite.config.ts +0 -23
  729. package/dist/style-boundaries.mjs +0 -106
  730. package/dist/style-token-rules.mjs +0 -51
  731. package/dist/themes-generated.mjs +0 -161
  732. package/dist/themes-watch.mjs +0 -83
  733. package/dist/themes.mjs +0 -360
  734. package/dist/token-export.mjs +0 -94
  735. package/dist/token-origins.mjs +0 -24
  736. package/dist/token-policy.mjs +0 -26
  737. package/dist/token-quality.mjs +0 -149
  738. package/dist/token-samples.mjs +0 -19
  739. package/dist/tokens.mjs +0 -194
  740. package/dist/unit-contracts.mjs +0 -396
  741. package/dist/usage.mjs +0 -184
  742. package/dist/verification/playwright-reporter.cjs +0 -87
  743. package/docs/CONTRACTS.md +0 -285
  744. package/docs/HTTP-SHOWCASE-POC.md +0 -397
  745. package/docs/SPATIAL-CHECKS.md +0 -69
  746. package/docs/benchmarks/http-showcase-optimized.json +0 -1879
  747. package/docs/benchmarks/http-showcase-profile.json +0 -308
  748. package/docs/benchmarks/http-showcase.json +0 -3069
  749. /package/dist/{starters/react/design-system/assets/fonts/.gitkeep → analysis/semantic.mjs} +0 -0
  750. /package/dist/{starters/react/design-system/controllers/.gitkeep → lowering-model.mjs} +0 -0
  751. /package/dist/showcase/{favicon.svg → ui/favicon-scavmehf.svg} +0 -0
package/docs/GUIDE.md CHANGED
@@ -1,368 +1,402 @@
1
1
  # ADS tool guide
2
2
 
3
- Choose [direct code editing or MCP-only editing](../skills/ads-designer/references/workflows.md).
4
- Direct editors change owned files normally and use MCP for preview and validation;
5
- ordinary edits do not require drafts or acceptance. MCP-only iterative editing
6
- uses [tracked drafts](../skills/ads-designer/references/drafts.md), rendered review
7
- and exact-revision acceptance. Direct editors may choose drafts for isolation and
8
- Accepted/Draft comparison too. Complete any required tracked proposals before
9
- reporting the design change finished. Both editing routes use ADS's own compiler.
10
-
11
- ADS is development tooling for a project's local design system. This package
12
- contains a Bun CLI, shared token contract, asynchronous native static checks and
13
- foundation scaffolding. Default initialization creates an empty design system;
14
- `--include-starter` adds the shared example design and application source. ADS
15
- adds no runtime dependency to the application's shipped UI.
16
-
17
- For an existing installation, use the [ads-migrate skill](../skills/ads-migrate/SKILL.md).
18
- The [0.4.3 → 0.4.4 guide](../skills/ads-migrate/references/0.4.3-to-0.4.4.md)
19
- covers dependency updates, restarting the managed runtime and checking incremental
20
- previews without rewriting project components or deleting active drafts.
3
+ ADS is development tooling for a project's local design system. The package
4
+ contains a Bun CLI, asynchronous native static checks and the design-system
5
+ compiler. `ads init` sets a project up; the design system is the project's own
6
+ to author. `ads emit` compiles it into plain modules and stylesheets. ADS adds no
7
+ runtime dependency to the application's shipped UI.
8
+
9
+ There are two [editing routes](../skills/ads-designer/references/workflows.md).
10
+ Both use ADS's own compiler.
11
+
12
+ - **Direct editing.** Change the owned files normally, and use MCP for preview
13
+ and validation. Drafts and acceptance are not required, but you can use drafts
14
+ for isolation and for the Accepted/Draft comparison.
15
+ - **MCP-only editing.** Change source through
16
+ [tracked drafts](../skills/ads-designer/references/drafts.md), review the
17
+ rendered result, then accept the exact revision.
18
+
19
+ Complete each required tracked proposal before you report a design change as
20
+ finished.
21
21
 
22
22
  ## Use ADS through MCP
23
23
 
24
- Connect your coding agent using the [MCP client setup](MCP.md#connect-codex-or-claude).
25
- The client launches `ads mcp` in your project; add `--mutations` to enable guarded
26
- source editing. Initialization also supplies `ads-mcp` and `ads-read-mcp` launch
27
- scripts. The server starts its showcase and ADS-managed preview compiler, so use
28
- the returned showcase URL rather than starting a separate preview application.
29
-
30
- An agent uses the MCP tools to inspect, edit and review the project:
31
-
32
- 1. Call `ads_status` to identify the connected project, available commands,
33
- mutation mode, showcase URL and build freshness.
34
- 2. Find public UI/behavior APIs with `ads_catalog`, inspect relevant definitions
35
- with `ads_tokens`, and discover preview IDs with `ads_scenarios`. Read one
36
- relevant workflow skill before editing: natively, or through `ads_skills` and
37
- `ads_read_skill` on a 2025-era connection.
38
- 3. Open a discovered preview, including the token and brand views ADS renders, with `ads_show_scenario`. It
39
- renders the project's actual scenario, fixtures and adapter through MCP Apps.
40
- Use the returned showcase link when the client cannot render Apps.
41
- 4. Select the editing route, independently of `mutations.enabled`. With direct
42
- source access, edit owned files and use the existing compiler/preview; run
43
- current gates and relevant project/behavior checks before finishing. With
44
- MCP-only access and mutation tools enabled, every change goes through a draft:
45
- discover owners with `ads_units`, use `ads_create_draft`,
46
- `ads_read_file`/`ads_update_draft` (file contents or a Git diff), rendered
47
- `ads_show_draft` review, an optional `ads_accept` dry run and exact-revision
48
- `ads_accept`. An owner is in at most one open draft. Accept dependencies first and
49
- review dependents again. After a series of accepted drafts, run
50
- `ads_validate({scope:"changed"})`. A read-only MCP connection
51
- supports direct editors; it cannot edit for an MCP-only client.
52
- 5. Review diagnostics, registered behavior evidence and the rendered result.
53
- `ads_behaviors` discovers guarantees; the gates run them, and `ads verify` runs
54
- one unit's checks from the CLI. Recheck `ads_status.build` after changes; notifications alone do not
55
- establish current output.
56
-
57
- For an on-demand screenshot, call `ads_capture` with a discovered scenario ID and
58
- optionally a named `captureTargets` element, theme and viewport. To compare a
59
- draft with accepted source, pass its `draft` id and exact `revision`; acceptance and
60
- its dry run create no screenshots. Capture uses project-installed
61
- Playwright and its browser; ADS installs neither (`ads init` declares
62
- `@playwright/test`; run `npx playwright install chromium` once).
63
-
64
- For layout inspection, add `guides:["tracks","gaps","padding","mini"]`.
65
- The selectable layers are `bounds`, `tracks`, `gaps`, `padding`, `margins`, and
66
- `mini`; they use the showcase overlay on all visible elements. Omit `guides` or
67
- pass `[]` for a clean visual review. Guides work on components, patterns,
68
- compositions and `tokens/Layout`, and are recorded in image settings. Read the
69
- annotated image before requesting a clean capture: each scenario/target has one
70
- current slot, so the next capture replaces it. A draft comparison uses the same
71
- layers for current and candidate.
72
-
73
- Read `ads://project/captures` and the returned PNG image URIs through MCP
74
- `resources/read`. Each target keeps only current and candidate: a successful
75
- standalone screenshot replaces current and clears candidate; a screenshot-enabled
76
- dry run replaces the pair; applying matching source promotes candidate. Source
77
- changes mark images stale. There is no previous slot, history or TTL.
78
- `ads_capture_clear` discards candidate or clears both images. Subscribe to resource
79
- updates when supported, and explicitly reread otherwise. Screenshots provide visual
80
- evidence for one state; they do not replace behavior checks.
81
-
82
- ADS serves its skills over MCP, by what the client speaks:
83
-
84
- | Client | How it gets skills |
24
+ Connect your coding agent with the [MCP client setup](MCP.md#connect-codex-or-claude).
25
+ The client launches `ads mcp` in your project; `--mutations` enables guarded
26
+ source editing. The server starts its showcase and the ADS-managed preview
27
+ compiler. Use the returned showcase URL; do not start a separate preview
28
+ application. The [MCP guide](MCP.md) gives the tool and resource schemas,
29
+ prompts, skills and notifications.
30
+
31
+ An agent works in these steps:
32
+
33
+ 1. Call `ads_status`. It identifies the connected project, the available
34
+ commands, the mutation mode, the showcase URL, the declared themes and brands,
35
+ and the build freshness.
36
+ 2. Find the public UI and behavior with `ads_catalog`, the tokens with
37
+ `ads_tokens`, the files of an owner with `ads_units` and the preview IDs with
38
+ `ads_scenarios`.
39
+ 3. Read one relevant workflow [skill](MCP.md#skills) before you edit: natively,
40
+ or through `ads_skills` and `ads_read_skill` on an earlier protocol. The host
41
+ decides whether a skill is loaded into an agent's context. `npx skills`
42
+ installs the skills locally for a host that does not read them over MCP.
43
+ 4. Open a discovered preview with `ads_show_scenario`. It renders the project's
44
+ actual scenario through MCP Apps. If the client cannot render Apps, use the
45
+ returned showcase link.
46
+ 5. Select the editing route. The route does not depend on `mutations.enabled`.
47
+ - With direct source access, edit the owned files. Run `ads check` and the
48
+ relevant project checks before you finish.
49
+ - With MCP-only access and mutation tools enabled, every change goes through
50
+ a draft: `ads_create_draft`, `ads_read_file` and `ads_update_draft` (file
51
+ contents or a Git diff), a rendered `ads_show_draft` review, an optional
52
+ `ads_accept` dry run, then `ads_accept` of the exact revision. An owner is
53
+ in at most one open draft. Accept dependencies first and review dependents
54
+ again.
55
+ - After a series of accepted drafts, run `ads_validate({scope:"changed"})`.
56
+ - To remove declared targets, use `ads_delete`
57
+ ([Deleting declared targets](#deleting-declared-targets)).
58
+ - A read-only MCP connection supports direct editors. It cannot edit for an
59
+ MCP-only client.
60
+ 6. Review the diagnostics, the execution evidence and the rendered result. Check
61
+ `ads_status.build` again after changes. Notifications alone do not prove that
62
+ the output is current.
63
+
64
+ **Nothing to inspect or run.** A feature with nothing to inspect or run does not
65
+ report an empty match or a pass. Its result carries
66
+ `{ "status": "not-available", "reason", "message" }`:
67
+
68
+ | Reason | Meaning |
85
69
  |---|---|
86
- | Protocol `2026-07-28` | The `io.modelcontextprotocol/skills` extension: `skills/list` and `skills/get` give each skill's frontmatter and its complete file list with digests and sizes, `resources/directory/read` lists a folder, and `resources/read` gets a file |
87
- | Earlier protocols | `skill://` resources through `resources/list` and `resources/read`, and the `ads_skills` and `ads_read_skill` tools |
70
+ | `no-scenarios` | No scenarios are registered, so nothing can be rendered, captured or audited |
71
+ | `no-behavior-checks` | No behavior checks are registered |
72
+ | `no-token-inventory` | The design system declares no token sheet (`ads tokens`, `ads_tokens`, `ads://project/tokens`, `ads://project/tokens/dtcg`) |
73
+ | `no-catalog` | The design system has no public barrel, or it exports nothing (`ads_catalog`, `ads://project/catalog`) |
74
+ | `none-selected` | Entries are registered, but the change set or selection reaches none of them |
75
+ | `turned-off` | The project's configuration turns the stage off |
76
+
77
+ A gate stage that ran nothing is listed as skipped, never as passed or
78
+ established.
79
+
80
+ **Screenshots.** For an on-demand screenshot, call `ads_capture` with a
81
+ discovered scenario ID and, optionally, a named `captureTargets` element, one
82
+ of the scenario's named states, a theme, a viewport and layout `guides`. To compare a draft with accepted source,
83
+ pass the `draft` id and the exact `revision`. Acceptance and its dry run create
84
+ no screenshots. A screenshot is visual evidence for one state; it does not
85
+ replace behavior checks. See
86
+ [screenshots and candidate comparison](MCP.md#screenshots-and-candidate-comparison)
87
+ and the portable [capture guide](../skills/ads-designer/references/captures.md)
88
+ (`ads://guides/captures`) for guides, named targets, limits and the
89
+ current/candidate image lifecycle.
90
+
91
+ Capture and the render audit use ADS's own Playwright; the project installs
92
+ nothing. The first capture or audit on a machine installs Playwright's browser
93
+ into its shared cache, with progress. To provision CI or an offline machine
94
+ ahead of time, run the command that a failed installation names:
95
+ `bunx playwright@<ADS's Playwright version> install chromium`.
88
96
 
89
- Whether a skill is loaded into an agent's context is up to the host. `npx skills` installs them locally
90
- for a host that does not read them over MCP.
97
+ ## Implementation support
91
98
 
92
- The [MCP guide](MCP.md) details tool/resource schemas, prompts, skills and
93
- notifications. The portable [capture guide](../skills/ads-designer/references/captures.md)
94
- explains screenshot setup, named targets, limits and comparison usage; MCP serves
95
- the same guide at `ads://guides/captures`.
99
+ [Design system source](#design-system-source) describes what you author and what
100
+ `ads check` enforces. [Emitting the design system](#emitting-the-design-system)
101
+ describes the output that an application imports.
96
102
 
97
- Watched previews keep the isolated frame alive during compatible edits. Component
98
- state, entered text and focus can survive code and style updates; changed hook
99
- signatures follow React or Preact's reset rules. Incompatible module changes and
100
- restoring rejected revisions may reset the preview. “Checking changes…” is live
101
- feedback, not acceptance: source gates and selected browser checks still decide
102
- whether the revision passes. Application production builds are unchanged.
103
+ The emitted output targets the project's framework: React, or
104
+ native Preact (owners typed by Preact's own JSX runtime, `preact/hooks`, no
105
+ `preact/compat`).
103
106
 
104
- ## Implementation support
107
+ The guards do not parse Vue or Svelte single-file components, or HTML templates.
108
+ Keep the framework-specific checks for them. A clean ADS check does not validate
109
+ a surface that ADS does not check.
105
110
 
106
- Linaria is required for component and pattern styling. Projects choose their
107
- UI framework and visual design; `init` preserves framework configuration and
108
- adds no React runtime dependency. See the
109
- [architecture](https://github.com/reqvire-org/ads/blob/main/docs/ARCHITECTURE.md#linaria-is-the-implementation-mechanism)
110
- for the rationale.
111
-
112
- Current source checking supports `.js`, `.jsx`, `.ts`, `.tsx`, their module
113
- variants, `.css`, and imported Linaria `css` and `styled` templates. JSX style/type checks
114
- support React and native Preact, including imported factory aliases and
115
- DOM/CSS types. Scenario discovery, coverage, ownership checks and MCP delivery
116
- apply to both. The empty application starter comes for React and for Preact; this
117
- checkout’s working example uses native Preact 11 with TypeScript and Linaria. ADS adds neither runtime
118
- to a receiving application and never silently aliases React to Preact.
119
-
120
- Vue/Svelte single-file components and HTML templates are not parsed by these
121
- guards. Web Component JS/TS logic and separate CSS can be checked, but HTML
122
- template strings and Shadow DOM style constructs lack equivalent coverage.
123
- Retain framework-specific checks; a clean ADS check does not validate those
124
- unchecked surfaces.
111
+ For product MCP Apps, make the widget's entry the root of the production bundle,
112
+ and import the necessary public design-system UI by name from the emitted
113
+ output. The app's own MCP server serves the built widget; it does not need ADS's
114
+ server or showcase. Check the runtime code and the emitted CSS and assets for
115
+ unrelated owners. See the
116
+ [product widget integration proof](MCP.md#product-widgets-and-payload-scope).
125
117
 
126
118
  ### Controllers and behavior checks
127
119
 
128
- Keep private controllers with their consumer; share reusable behavior through
129
- `design-system/controllers/<Name>/`. Use the configured framework and declared
130
- project dependencies. Controllers own lifecycle/measurements while components and
131
- patterns own presentation. A shared context provider is a behavioral API too.
132
-
133
- Optional `<Owner>.ads.contract.ts` registers guarantees and maintained checks using actual implementation references.
134
- Scenario `exercises` records demonstrations separately from rendered `covers`.
135
- Use `ads behaviors --json` for discovery and `ads verify --unit <discovered-id>`
136
- to run registered cases; MCP exposes `ads_behaviors`, and its gates run the cases. Tests and
137
- contracts stay outside production exports. See the [complete schema and runner
138
- integration](BEHAVIORS.md), including browser and React development StrictMode profiles.
139
-
140
- ### Linaria integration
141
-
142
- Before authoring components or patterns, integrate Linaria extraction with the
143
- project's existing build:
144
-
145
- - Install compatible Linaria packages and the extraction integration for the
146
- project's bundler. ADS implementations use `css` and `cx` from
147
- `@linaria/atomic`.
148
- - For Vite, run `@wyw-in-js/vite` before the framework transform. Apply equivalent
149
- extraction to application and project preview builds.
150
- - Resolve `@ds` to the local public entry in the bundler and TypeScript, and load
151
- the foundation CSS once. Preserve intentional CSS side effects.
152
- - Compile an actual styled component and inspect its emitted CSS and browser
153
- result. Static source checks do not establish complete extraction or
154
- unused-style removal.
155
-
156
- For product MCP Apps, make the widget's entry the production bundle root and
157
- import the needed public design-system UI by name. The app's own MCP server
158
- serves that built widget; it does not need ADS's server or showcase. Check both
159
- runtime code and emitted CSS/assets for unrelated owners. See the
160
- [product widget integration proof](MCP.md#product-widgets-and-payload-scope).
120
+ A controller is a plain module that the barrel exports, with no recipe and no
121
+ markup. Keep a private controller with its consumer; share reusable behavior
122
+ through `design-system/controllers/<Name>/`. A controller owns lifecycle and
123
+ measurements, and components and patterns own presentation. It can read computed
124
+ styles and use an offscreen canvas. It renders no markup, sets no class or
125
+ style, and writes no styling through the DOM (`source/plain-*`). Use the
126
+ configured framework and the declared project dependencies.
127
+
128
+ Owners register behavior in `<Owner>.ads.behavior.ts`. ADS runs every check
129
+ itself: `unit` specs under its own Bun, `browser` and `strict` (React) specs
130
+ with its own Playwright. The project installs and configures no test runner;
131
+ `mcp.behaviorProfiles` can only set the `timeoutMs` of a built-in profile. A
132
+ design system that registers no checks reports `not-available`
133
+ (`no-behavior-checks`). See
134
+ [registered checks and their status](BEHAVIORS.md#registered-checks-and-their-status).
135
+
136
+ The example design system's form-field bridge (`controllers/FormField`) registers eight
137
+ guarantees with unit checks. In the example design system, `ads behaviors` lists them
138
+ and `ads verify` runs them under the built-in `unit` profile.
139
+
140
+ ### Forms
141
+
142
+ A field shows a constraint error only after the user interacts with it (a
143
+ commit, a blur after an edit, a failed submit). It shows an application error (a
144
+ server's verdict) immediately. The example design system's form-field bridge
145
+ (`controllers/FormField`: `bindFormField`, `bindForm`, and the hooks
146
+ `useFormField` and `useFormBridge`) mirrors that timing onto the field's root as
147
+ `data-user-invalid`, `data-user-valid` and `data-autofill`, which recipes select
148
+ as ordinary attribute states. It also sets `aria-invalid` explicitly, links the
149
+ error message with `aria-describedby` only while it is shown, announces an error
150
+ that appears on blur once through the form's one polite live region, and after a
151
+ failed submit focuses the form's error summary, or the first invalid field.
152
+ Where the browser lacks `:user-invalid`, its own tracked events give the same
153
+ timing.
154
+
155
+ The example design system's `TextField` takes `type`, `autoComplete`, `inputMode`,
156
+ `enterKeyHint`, `spellCheck`, `autoCorrect` and `autoCapitalize` (off by default
157
+ for email, tel, url and password), `pattern`, `minLength`, `maxLength`,
158
+ `required`, `error` (the application's), `validationMessage` and
159
+ `nativeValidation`. Its invalid and autofill states draw inset rings, which take
160
+ no space and are not colour alone.
161
+
162
+ `ads check` blocks an error or autofill state shown by colour alone
163
+ (`source/form-state-colour-only`) and an autofill treatment that moves layout
164
+ (`source/autofill-layout-shift`). It reviews a text field that names what it
165
+ collects without `autoComplete` (`review/autocomplete-missing`). Read the forms
166
+ guide ([forms.md](../skills/ads-designer/references/forms.md),
167
+ `ads://guides/forms`) for the timing, the bridge's API, the recipe states and
168
+ the browser limits. ADS's browser tests run in Chromium only.
169
+
170
+ ## Set up a design package
171
+
172
+ A design system lives in its own package, the *design package*: a folder with
173
+ its own `package.json`, `ds.config.json`, `tsconfig.json` and `design-system/`.
174
+ ADS runs only there. Applications consume what `ads emit` writes and never
175
+ install ADS. Install Bun 1.4.1 or later for ADS tooling and previews. ADS ships
176
+ everything else it needs (its own Playwright and browser, its test runners) and
177
+ needs nothing from the application.
178
+
179
+ There are two layouts.
180
+
181
+ **Several applications, one design system.** The design package has its own
182
+ repository. Its output is `dist/`, which its `exports` publish and which is
183
+ committed, so a Git reference installs it:
161
184
 
162
- The [starter's dependencies](https://github.com/reqvire-org/ads/blob/main/starters/shared/package.json),
163
- [entry build](https://github.com/reqvire-org/ads/blob/main/starters/shared/vite.config.ts),
164
- and [native mounts](https://github.com/reqvire-org/ads/tree/main/starters)
165
- provide the React/Vite setup. Merge the needed integration into an existing
166
- project instead of replacing its configuration.
185
+ ```sh
186
+ bunx @reqvire-org/ads init acme-design --framework react # or npx … init
187
+ cd acme-design && bun install
188
+ bun run lint:ds # ads check
189
+ bun run emit:ds # ads emit → dist/
190
+ git add . && git commit -m "Design system 1.0.0" && git tag v1.0.0
191
+ ```
167
192
 
168
- `ads init` does not install Linaria, configure extraction, or verify the complete
169
- styling pipeline. It sets up token/source checks and build hooks. The copied
170
- standalone starter already includes Linaria dependencies and Vite integration.
193
+ ```json
194
+ {
195
+ "name": "@acme/ui",
196
+ "version": "1.0.0",
197
+ "type": "module",
198
+ "exports": { ".": "./dist/index.ts", "./foundation.css": "./dist/foundation.css" },
199
+ "files": ["dist"],
200
+ "sideEffects": ["*.css"],
201
+ "peerDependencies": { "react": "^19.0.0" },
202
+ "devDependencies": { "@reqvire-org/ads": "^0.5.0", "react": "19.2.7", "react-dom": "19.2.7", "@types/react": "19.2.17" },
203
+ "scripts": { "lint:ds": "ads check .", "emit:ds": "ads emit" }
204
+ }
205
+ ```
171
206
 
172
- ### Native Preact integration
207
+ An application in another repository depends on it by Git reference (or a packed
208
+ tarball, or a registry release), and installs its own React:
173
209
 
174
- An existing Preact project keeps its own runtime. Use `preact` for rendering and
175
- DOM types, `preact/hooks` for hooks, and optionally `@preact/signals` for reactive
176
- state. Configure TypeScript with `"jsx": "react-jsx"` and
177
- `"jsxImportSource": "preact"`. A Vite build can use its native transform:
210
+ ```json
211
+ {
212
+ "name": "shop-app",
213
+ "private": true,
214
+ "type": "module",
215
+ "dependencies": {
216
+ "@acme/ui": "git+ssh://git@github.com/acme/acme-design.git#v1.0.0",
217
+ "react": "^19.0.0",
218
+ "react-dom": "^19.0.0"
219
+ },
220
+ "devDependencies": { "vite": "^7.0.0", "@vitejs/plugin-react": "^5.0.0", "typescript": "^5.9.0" },
221
+ "scripts": { "dev": "vite", "build": "vite build" }
222
+ }
223
+ ```
178
224
 
179
- ```ts
180
- esbuild: { jsx: "automatic", jsxImportSource: "preact" },
181
- plugins: [wyw({ tagResolver: linariaTagResolver }), /* project plugins */],
225
+ ```tsx
226
+ import "@acme/ui/foundation.css";
227
+ import { Button } from "@acme/ui";
182
228
  ```
183
229
 
184
- Apply that configuration to the application build. ADS's preview compiler uses
185
- the declared `framework` and shared Linaria resolver automatically. Mount preview
186
- entries with `render(<Scenario />, root)` from `preact`; React entries use their
187
- existing React mount. Keep Linaria's `css`/`cx` extraction; native Preact does not
188
- need `@linaria/react`'s React `styled` wrapper. Use `onInput` for live text updates
189
- and `event.currentTarget` for the typed element. Native SVG uses DOM names such as
190
- `stroke-width` and `stroke-linecap`; React’s camel-case presentation aliases are
191
- not normalized by the native renderer. The `svg-attribute` guard checks those
192
- attributes when the project/file JSX runtime or factory is native Preact. Preact 11 accepts refs as props
193
- and exports DOM types such as `HTMLAttributes` directly; Preact 10's `JSX` type
194
- namespace is also recognized by guards. See the [Preact upgrade guide](https://preactjs.com/guide/v11/upgrade-guide/).
195
-
196
- The [shared starter](https://github.com/reqvire-org/ads/tree/main/starters/shared)
197
- and its [native generator](https://github.com/reqvire-org/ads/blob/main/scripts/build-starters.mjs)
198
- show the setup. `ads init --framework preact --include-starter` adds the generated
199
- Preact variant of that source. The generator changes runtime dependencies, JSX
200
- settings, framework imports and the native mount together. For a Preact app without a saved framework, run
201
- `ads init --framework preact`; newly generated foundation scenarios use native
202
- hooks. Init preserves the application's compiler, dependencies and mount adapter.
203
-
204
- ### CSS correctness in the tool and starter
205
-
206
- The tool and starter use Biome only for CSS, configured in
207
- `biome.css.json`. Parsing rejects malformed CSS and invalid hex colors, including
208
- token values. Explicit lint rules reject duplicate font names and selectors;
209
- the starter also rejects duplicate properties. Formatting is disabled. ADS directly checks architecture, token usage and
210
- ownership in JavaScript/TypeScript. The tool repository uses Oxlint for its own
211
- ordinary JavaScript linting; consumers do not need that extra pass. `ads init` preserves an existing project's lint tools.
212
-
213
- CSS regression tests cover rejected input, valid theme/nesting
214
- contexts, and exclusion of JavaScript and generated outputs.
215
-
216
- ## Set up an existing project
217
-
218
- Install Bun 1.4.1+ for ADS tooling and previews. The application keeps its own
219
- Node/npm or Bun pipeline. Run inside the project containing `package.json`:
230
+ To upgrade, move the ref (`#v1.1.0`). To try an unreleased change, use a branch
231
+ ref or a packed tarball. Git references, tarballs and registries install a copy
232
+ without the design package's `devDependencies`. Its React for authoring is thus
233
+ never installed into the application: one React, no bundler setting. Symlinked
234
+ local dependencies (`file:` to a folder, `link:`, `npm link`) are not supported:
235
+ the application would resolve the design package's own `node_modules` first and
236
+ could load a second React.
237
+
238
+ **One application, one design system.** The design package is a folder in the
239
+ application's repository and emits directly into the application's source:
220
240
 
221
241
  ```sh
222
- npx @reqvire-org/ads init --framework react
223
- npm install
224
- npx playwright install chromium # browser for the accessibility audit
225
- npm run build
242
+ cd shop-app
243
+ bunx @reqvire-org/ads init design --framework react --out ../src/ui
244
+ cd design && bun install && bun run emit:ds # → ../src/ui
245
+ ```
246
+
247
+ ```
248
+ shop-app/
249
+ ├── package.json the application (no ADS)
250
+ ├── src/ui/ emitted by ADS, committed
251
+ └── design/
252
+ ├── package.json the design package (private)
253
+ ├── ds.config.json { "compile": { "outDir": "../src/ui" } }
254
+ └── design-system/
226
255
  ```
227
256
 
228
- For a Bun-managed project, use
229
- `bunx @reqvire-org/ads init --framework react`, followed by `bun install`,
230
- `bunx playwright install chromium` and `bun --bun run build`. Node is unnecessary. No archive or directory argument is needed for a published
231
- release. `init` requires an existing project; it does not create an application.
232
- To start from ADS's TypeScript/Linaria starter, add `--include-starter`: init also adds
233
- the starter's example design system, Vite and TypeScript setup, scripts and development
234
- dependencies that the project lacks. It never replaces an existing file and never writes
235
- a lockfile.
236
-
237
- Choose `--framework react` or `--framework preact` when the project has no saved
238
- framework. Init persists it as `framework` in `ds.config.json`. Subsequent runs
239
- reuse the saved value.
240
- There is no implicit framework detection or default for initialization.
241
-
242
- A conflicting flag stops init before writes. Init also checks available
243
- TypeScript/JavaScript JSX settings, including inherited configurations and project
244
- references, for clear React/Preact conflicts. It preserves compiler files and
245
- does not install a framework or establish that the complete bundler setup works.
246
- Projects without JSX settings can still record their choice and configure the
247
- compiler separately. Svelte and other frameworks are not accepted yet.
248
-
249
- Existing ADS configs without `framework` remain readable by checks and inspection.
250
- On the next init, supply the flag once; init adds that field while preserving
251
- other settings and existing source. To migrate frameworks, update the project
252
- and its saved choice explicitly; init is not a framework conversion command.
253
-
254
- Initialization:
255
-
256
- - Adds the tool to `devDependencies`, with the executing version pinned by
257
- default. Keeps an existing tool version unless `--tool-package` overrides it.
258
- - Creates missing `ds.config.json`, foundation CSS, a public entry, and empty
259
- component/pattern directories, brand guidance, and an empty font directory.
260
- Seeds token defaults only when the configured
261
- token folder contains no CSS. New foundation scenarios use the selected
262
- framework's hooks. Existing ADS source and token values remain unchanged;
263
- incomplete existing token contracts need an explicit migration.
264
- - Adds `lint:ds`, which runs native `ads check` directly. Project linter and test
265
- commands remain explicitly owned by the project.
266
- - Adds `assets:ds` (`ads assets`) after those checks and before the existing
267
- `prebuild` hook, preserving the actual
268
- `build` command. If the project has no build script, adds a validation/generation
269
- build. Repeating init does not duplicate the hook.
270
- - Adds the same checks and generation to `prebuild:showcase` when a standalone
271
- `build:showcase` script exists, preserving its existing hook and build command.
272
- - Adds `dev:showcase` as `ads showcase` when absent. An existing run command is
273
- preserved; deliberately switch it when migrating to the built-in showcase.
274
- - Adds `ads-mcp` with guarded editing enabled and `ads-read-mcp` with editing
275
- disabled, preserving existing scripts with those names. Both start the showcase.
276
- - Appends `.ds/` to the project's ignore file and supplies a framework mount
277
- adapter for ADS's native preview compiler when one is missing.
278
-
279
- Application files, framework configuration, unrelated scripts/dependencies,
280
- and lockfiles are preserved. `init` does not install dependencies or configure
281
- framework aliases, CSS extraction, or application entry points. Resolve `@ds`
282
- to the local public entry in TypeScript and the bundler, and load foundation CSS
283
- once when integrating ADS source into the app. Complete the
284
- [Linaria integration](#linaria-integration) using the existing framework.
285
-
286
- An unrelated custom `lint:ds` or `assets:ds` script causes init to stop before writing files;
287
- rename it or integrate the checks deliberately. Writes are preflighted and do
288
- not follow symlinks. Keep normal version control review of the resulting changes.
289
-
290
- After installation, normal builds use the project's installed tool; they do not rely
291
- on the initializing npx cache. Commit the
292
- updated lockfile. npm CI can use `npm ci`, then `npm run build`.
257
+ The application imports the output as its own code
258
+ (`import { Button } from "./ui"` and `import "./ui/foundation.css"`). Emitted
259
+ files import `react` and resolve it upward from their folder, so `src/ui`
260
+ reaches the application's `node_modules` and its one React. This is why the
261
+ output does not stay inside the design folder in this layout. The design package
262
+ stays private, with no peers and no `exports`.
263
+
264
+ **Dependencies.** Each package that the emitted output imports must reach the
265
+ application:
266
+
267
+ | Kind | Example | Several applications (design package) | One application |
268
+ | --- | --- | --- | --- |
269
+ | Framework | `react`, `preact` | `peerDependencies` (range), pinned in `devDependencies` | application `dependencies` |
270
+ | Headless library holding shared state (context, focus) | `react-aria` | `peerDependencies` (range), pinned in `devDependencies` | application `dependencies` |
271
+ | Stateless library | `date-fns` | `dependencies` (installed with the design package) | application `dependencies` |
272
+ | Types only | `@types/react` | `devDependencies` | application `devDependencies` if it typechecks the output |
273
+
274
+ A library that holds shared state must be the application's one copy, so it is a
275
+ peer. npm 7+, pnpm and Bun install a missing peer and report a range conflict.
276
+
277
+ - With the output inside the design package, `ads check` reports
278
+ `package-dependency-undeclared` when the output imports a package at runtime
279
+ that the design package declares only in `devDependencies` or nowhere.
280
+ - In the one-application layout, the application's build enforces the rule: a
281
+ missing package is an unresolved import that names it.
282
+ - In both layouts, `ads emit` writes `ads-dependencies.json`: the packages that
283
+ the application must satisfy, with ranges and runtime or types use.
284
+
285
+ `<outDir>/package.json` declares `"sideEffects": ["*.css"]` in both layouts
286
+ ([Consuming the output](#consuming-the-output)).
287
+
288
+ **Framework.** `--framework react` or `--framework preact` is required on the
289
+ first init. Init saves it as `framework` in `ds.config.json`, and later runs use
290
+ the saved value. ADS does not detect a framework and has no default. A Preact
291
+ design system's owners import `preact/hooks` and Preact's types
292
+ (`ComponentChildren`). If
293
+ the flag differs from the saved framework, init stops; change `ds.config.json`
294
+ explicitly.
295
+
296
+ **What init does.** `ads init [folder]` (the current folder by default):
297
+
298
+ - Creates the folder and its `package.json` when absent (name from the folder,
299
+ `version` `0.1.0`, `type: "module"`, and `private` with `--out`).
300
+ - Creates the design-system folder when it is absent, and leaves it empty. Init
301
+ installs no design system and generates no source: you author the
302
+ foundation (`foundation.ads.ts`), the public barrel (`index.ts`), the role
303
+ token sheets, the profiles and the owners
304
+ ([Design system source](#design-system-source)). Until the foundation and
305
+ the barrel exist, `ads check` fails and names what is missing.
306
+ - Writes `ds.config.json` with `schemaVersion`, `framework`, `dsDir` and the
307
+ `compile` defaults (`outDir` from `--out`). If the file exists, init keeps
308
+ every saved field and adds only the missing ones. Themes and brands are
309
+ declared in `foundation.ads.ts`, never in `ds.config.json`.
310
+ - Adds the tool and the framework's packages (`react`, `react-dom` and
311
+ `@types/react`, or `preact`) to `devDependencies` when neither dependency map
312
+ declares them. It keeps an existing tool version unless `--tool-package`
313
+ overrides it.
314
+ - Without `--out`, also adds the framework to `peerDependencies` and, when
315
+ absent, `exports`, `files` and `sideEffects` that publish `dist/`.
316
+ - Adds `lint:ds` (`ads check .`) and `emit:ds` (`ads emit`), in the spelling of
317
+ the package's package manager.
318
+ - Writes `tsconfig.json` and `ads-env.d.ts` when the package has no tsconfig:
319
+ bundler resolution, the framework's JSX, `@ds` mapped to the barrel, and SVG
320
+ module declarations. Editors and the package's own typecheck thus never use
321
+ the tsconfig of an enclosing application.
322
+ - Never edits `.gitignore`, never writes a lockfile, never follows symlinks and
323
+ never overwrites a project file. Ignore `.ds/` (ADS's caches and working
324
+ files) yourself.
325
+
326
+ A second run changes nothing. If the design-system folder already has content
327
+ and the package has a `ds.config.json`, init keeps the folder unchanged,
328
+ completes only the configuration and dependencies, and prints a notice. Without
329
+ a `ds.config.json`, init stops (`design-system-exists`): move the folder, or add
330
+ a `ds.config.json` (with another `dsDir` if that folder is not the design
331
+ system).
332
+
333
+ Init also stops before any write for an unrelated custom `lint:ds` or `emit:ds`
334
+ script, and for an `--out` folder that ADS cannot own
335
+ ([The output folder](#the-output-folder)).
336
+
337
+ The JSON result of `ads init` reports `framework`, `packageManager`,
338
+ `toolDependency`, `designSystem` (`installed` with a file count, or `kept`),
339
+ `notices` and `updatedFiles`.
293
340
 
294
341
  ## Package manager detection
295
342
 
296
- `init` reads npm or Bun from the project:
343
+ This version supports npm and Bun. `init` reads the package manager from the
344
+ design package:
297
345
 
298
- 1. Its `packageManager` field in `package.json`.
346
+ 1. The `packageManager` field in its `package.json`.
299
347
  2. Its Bun (`bun.lock` or `bun.lockb`) or npm (`package-lock.json`) lockfile.
300
348
 
301
- A project that declares neither stops init with an error naming what to add; with both
302
- lockfile types and no `packageManager`, keep one or set the field. This version supports
303
- npm and Bun. It never replaces or removes a lockfile. How ADS was launched (`npx` or
304
- `bunx`) does not change the project's choice.
305
-
306
- Init
307
- does not translate the app's existing scripts. Bun hooks explicitly use `bun --bun run` so package executables,
308
- including ADS, run on Bun despite Node shebangs.
309
- Launch the MCP server with `bunx @reqvire-org/ads mcp`, or its generated
310
- `ads-mcp` script. Managed workers and screenshot capture inherit the interpreter.
311
- Use `command: "runtime"` for portable preview compiler/behavior profiles;
312
- explicit `node`, `bun` or other commands are respected. Project-specific tools
313
- must themselves support the selected runtime. `ads_status.project.runtime`
314
- reports the actual name, version and executable; package manager and UI framework
315
- are separate choices.
316
-
317
- ## Migrating from DS
318
-
319
- ADS uses the package `@reqvire-org/ads`, CLI `ads`, MCP tools named `ads_*`,
320
- resource namespaces `ads://`, `ui://ads` and `skill://ads`, and skills named
321
- `ads-*`. Replace the old `@reqvire-org/ds` dependency and package imports, install
322
- dependencies, then run `ads init` to refresh managed build hooks. Existing
323
- `ds.config.json`, `.ds/`, `design-system/`, `@ds`, shared token names and
324
- `--ds-*`/`--ux-*` ownership prefixes remain valid. Project UI requires no rewrite.
325
-
326
- Use `ads-mcp` and `ads-read-mcp` for the editing and read-only launch scripts.
327
- Update MCP client configuration to the new package/server name and reconnect;
328
- tool names and resource URIs have changed. Install the renamed `ads-*` skills
329
- when using local skill installation. Rebuild previews with the new tool to
330
- refresh generated resource manifests. Existing `DS.md` project guides are still
331
- discovered; the tool's contract and new scaffold use `ADS.md`.
332
-
333
- npm has no in-place package rename: publish `@reqvire-org/ads` as a new package.
334
- Set up its own trusted publisher for `reqvire-org/ads`, workflow
335
- `release.yml`, allowing `npm publish` and `npm dist-tag`. Once ADS is available,
336
- deprecate the old package with a migration message:
349
+ A new design package follows the repository it is created in: the nearest
350
+ enclosing folder with a `packageManager` field or a lockfile (an application, in
351
+ the one-application layout). Otherwise it uses Bun, which runs ADS. An existing
352
+ package that declares neither stops init with an error that names what to add.
353
+ With both lockfile types and no `packageManager`, keep one lockfile or set the
354
+ field. ADS never replaces or removes a lockfile. The launcher (`npx` or `bunx`)
355
+ does not change the package's choice.
337
356
 
338
- ```sh
339
- npm deprecate @reqvire-org/ds "Renamed to @reqvire-org/ads. Install that package instead."
340
- ```
341
-
342
- Keep old releases available for existing consumers. See npm's
343
- [package rename guidance](https://docs.npmjs.com/unpublishing-packages-from-the-registry/),
344
- [deprecation guidance](https://docs.npmjs.com/deprecating-and-undeprecating-packages-or-package-versions/)
345
- and [trusted publishing setup](https://docs.npmjs.com/trusted-publishers/).
357
+ Launch the MCP server with `bunx @reqvire-org/ads mcp` or
358
+ `npx @reqvire-org/ads mcp` in the design package. `ads_status.project.runtime`
359
+ reports the actual name, version and executable. The package manager and the UI
360
+ framework are separate choices.
346
361
 
347
362
  ## Develop ADS locally
348
363
 
349
- To run this checkout's MCP server and showcase together:
364
+ These commands are for work on the ADS repository. Projects that use the
365
+ published package do not need them.
366
+
367
+ **Playground.** `bun run dev` (or `bun run dev:react`, the same command) builds
368
+ the tool and serves the showcase for a playground: a working copy of
369
+ `tests/fixtures/reference-project` in the ignored folder `.ds/playground/`.
370
+ Serving, drafts and accepted changes thus never change the fixture that the
371
+ tests read. `scripts/playground.mjs` creates the copy once.
372
+ `bun scripts/playground.mjs showcase --fresh` replaces it with the fixture's
373
+ current files, and the same script runs `mcp`, `check`, `validate`, `emit` or
374
+ `sync` on it. Playground edits are experiments: promote deliberate changes to
375
+ the fixture by hand.
376
+
377
+ To run the playground's MCP server and showcase together:
350
378
 
351
379
  ```sh
352
- npm run ads-mcp -- --port 4191 # guarded editing enabled
380
+ bun run ads-mcp -- --port 4191 # guarded editing enabled
353
381
  # or:
354
- npm run ads-read-mcp -- --port 4191 # read-only
382
+ bun run ads-read-mcp -- --port 4191 # read-only
355
383
  ```
356
384
 
357
- Run one at a time and open **http://127.0.0.1:4191/**. Both build the local tool
358
- before starting stdio MCP, the showcase and its managed preview compiler. For an
359
- MCP client's launch configuration, use `npm --silent run ads-mcp` or
360
- `npm --silent run ads-read-mcp` so npm's banner does not enter the JSON-RPC stream.
361
- The local tool build logs go to stderr. Use `--no-showcase` after `--` when only
362
- the stdio connection is needed. `npm run dev:showcase` remains browser-only.
385
+ Run one at a time and open **http://127.0.0.1:4191/**. Each command builds the
386
+ local tool (build logs go to stderr), then starts stdio MCP, the showcase and
387
+ its managed preview compiler. For an MCP client's launch configuration, run the
388
+ script silently (`npm --silent run ads-mcp`), so that a package manager banner
389
+ does not enter the JSON-RPC stream. If you need only the stdio connection, add
390
+ `--no-showcase` after `--`.
391
+
392
+ **Showcase UI.** `bun run dev:ui` serves ADS's own showcase design system
393
+ (`showcase-ui/`) in place, so its scenarios refresh as you edit them.
394
+ `bun run check:ui` validates it. Both build ADS first and link this checkout
395
+ into `showcase-ui/node_modules` (ignored). `bun run build` builds the showcase's
396
+ bundle from it.
363
397
 
364
- Use `npm link` to try changes from this checkout in a project already set up
365
- with ADS. From the ADS repository root:
398
+ **Link the checkout.** Use `npm link` to try changes from this checkout in a
399
+ project that is already set up with ADS. From the ADS repository root:
366
400
 
367
401
  ```sh
368
402
  npm install
@@ -370,49 +404,58 @@ npm run build
370
404
  npm link
371
405
  ```
372
406
 
373
- Then run inside the test project, after installing its normal dependencies:
407
+ Then, in the test project, after you install its normal dependencies:
374
408
 
375
409
  ```sh
376
410
  npm link @reqvire-org/ads
377
411
  npm exec -- ads --version
378
- npm run build
412
+ npm run lint:ds
379
413
  ```
380
414
 
381
- The project now uses your checkout through a symlink. Keep the normal published
382
- dependency in its `package.json`; linking is local development setup. The
383
- versionless `npx -y @reqvire-org/ads mcp` configuration uses that linked copy when
384
- the client starts in this project. The version check confirms which build is
385
- running. See [npm's linking documentation](https://docs.npmjs.com/cli/v11/commands/npm-link/)
415
+ The project now uses your checkout through a symlink, and the version check
416
+ confirms which build runs. See
417
+ [npm's linking documentation](https://docs.npmjs.com/cli/v11/commands/npm-link/)
386
418
  and [local-package resolution](https://docs.npmjs.com/cli/v11/commands/npm-exec/).
387
419
 
388
- After changing ADS tool code, packaged skills, starter files or the showcase
389
- client, run `npm run build` in this checkout and reconnect MCP. The link points
390
- to the rebuilt `dist/`; it does not compile source automatically. Changes to
391
- the test project's components and styles still use its managed preview watcher.
392
- After another `npm install` or `npm ci` in the test project, run
393
- `npm link @reqvire-org/ads` again if the install replaced the link.
394
-
395
- To return to the published version, run `npm unlink --no-save @reqvire-org/ads`
396
- then `npm install` in the test project. To remove the global development link,
397
- run `npm unlink --global @reqvire-org/ads`.
398
-
399
- For this checkout's diagnostic MCP client, run:
420
+ - Keep the normal published dependency in the project's `package.json`.
421
+ - The versionless `npx -y @reqvire-org/ads mcp` configuration uses the linked
422
+ copy when the client starts in this project.
423
+ - The link points to the built `dist/`; it does not compile source. After you
424
+ change ADS tool code, packaged skills or the showcase client, run
425
+ `npm run build` in this checkout and reconnect MCP.
426
+ - Changes to the test project's design system still use its managed preview
427
+ watcher.
428
+ - If `npm install` or `npm ci` in the test project replaces the link, run
429
+ `npm link @reqvire-org/ads` again.
430
+ - To return to the published version, run
431
+ `npm unlink --no-save @reqvire-org/ads` and then `npm install` in the test
432
+ project. To remove the global development link, run
433
+ `npm unlink --global @reqvire-org/ads`.
434
+
435
+ **MCP Explorer.** For this checkout's diagnostic MCP client, run:
400
436
 
401
437
  ```sh
402
438
  npm run dev:mcp-explorer
403
439
  ```
404
440
 
405
- Open **http://127.0.0.1:4190/**. It builds ADS and starts the real stdio server,
406
- its showcase and ADS-managed preview compiler. The
407
- [explorer guide](../mcp-explorer/README.md) covers tools, resources, prompts, skills,
408
- notifications and widget checks. Run `npm run dev:showcase` instead for normal
409
- visual review. These development commands are not required in projects using
410
- the published package.
441
+ Open **http://127.0.0.1:4190/**. The command builds ADS and starts the real
442
+ stdio server, its showcase and the ADS-managed preview compiler. The
443
+ [explorer guide](../mcp-explorer/README.md) covers tools, resources, prompts,
444
+ skills, notifications and widget checks.
445
+
446
+ ### CSS correctness in the tool
447
+
448
+ The tool repository uses Biome only for CSS, configured in `biome.css.json`.
449
+ Parsing rejects malformed CSS and invalid hex colors. Explicit lint rules reject
450
+ duplicate font names and duplicate selectors. Formatting is disabled. The tool
451
+ repository uses Oxlint for its own JavaScript linting; consumers do not need
452
+ that pass. `ads init` preserves an existing project's lint tools.
411
453
 
412
454
  ## Test a local package
413
455
 
414
- Use a tarball to verify the packed release and a clean install before publishing.
415
- For iterative development, use the linking workflow above. From the repository root:
456
+ Use a tarball to verify the packed release and a clean install before you
457
+ publish. For iterative development, link the checkout
458
+ ([Develop ADS locally](#develop-ads-locally)). From the repository root:
416
459
 
417
460
  ```sh
418
461
  npm install
@@ -421,130 +464,134 @@ npm run pack:tool
421
464
  ads_tool_package="$PWD/output/npm/reqvire-org-ads-$(bun -p 'require("./package.json").version').tgz"
422
465
  ```
423
466
 
424
- Then change into an existing test project containing `package.json`:
467
+ Then create a design package beside (or inside) a test application:
425
468
 
426
469
  ```sh
427
- cd /absolute/path/to/test-project
428
- npx --yes --package "$ads_tool_package" ads init --framework react --tool-package "$ads_tool_package"
470
+ cd /absolute/path/to/test-application
471
+ npx --yes --package "$ads_tool_package" ads init design --framework react --out ../src/ui --tool-package "$ads_tool_package"
472
+ cd design
429
473
  npm install
430
- npm run build
474
+ npm run lint:ds
475
+ npm run emit:ds
431
476
  ```
432
477
 
433
- Use `bun install` and `bun run build` for Bun. Keep npx options before `ads`.
434
- `--tool-package` accepts an absolute local tarball path, a version, or a matching
435
- package/version. A tarball becomes a `file:` development dependency, so keep it
436
- available for subsequent installs. A published pinned version is portable
437
- between machines without an archive. Routine builds need no global install.
478
+ For Bun, use `bun install` and `bun run lint:ds`. Keep the npx options before
479
+ `ads`. `--tool-package` accepts an absolute local tarball path, a version, or a
480
+ matching package/version. A tarball becomes a `file:` development dependency, so
481
+ keep it available for subsequent installs. A published pinned version is
482
+ portable between machines without an archive. Routine builds need no global
483
+ install.
438
484
 
439
485
  ## Commands and checks
440
486
 
441
487
  | Command | Behavior |
442
488
  |---------|----------|
443
- | `ads init --framework react` | Add ADS tooling to the current project; accepts `react` or `preact`; saved choices can omit the flag |
444
- | `ads check [directory]` | Read-only core token, source import, and style checks |
445
- | `ads tokens [directory]` | List declared values and theme/media scopes |
446
- | `ads assets [directory]` | Generate standard icons from `assets.iconSource` |
489
+ | `ads init [folder] --framework react [--out ../src/ui]` | Set up the design package: tooling, configuration and an empty design-system folder to author in ([Set up a design package](#set-up-a-design-package)). A saved framework can omit the flag |
490
+ | `ads check [directory]` | Read-only check of the design system: structure, imports, owner analysis, mocks and the emitted output ([Design system source](#design-system-source)) |
491
+ | `ads compile [directory]` | Build ADS previews with Bun (`--watch` for incremental previews) |
492
+ | `ads emit [directory]` | Check, then write the compiled design system to its output folder ([Emitting the design system](#emitting-the-design-system)) |
493
+ | `ads sync [directory]` | Regenerate stale generated source files ([Regenerating generated source](#regenerating-generated-source)) |
494
+ | `ads validate [directory]` | The project gate (`--changed` limits it to what changed since the last successful full run) |
495
+ | `ads behaviors [directory]` | Registered behavior checks and current verification evidence |
496
+ | `ads verify [directory]` | Run registered behavior checks (`--unit` and `--check` select) |
497
+ | `ads audit [directory]` | Render audit of registered scenarios (`--scenario`, `--theme` and `--brand` select) |
498
+ | `ads tokens [directory]` | The design system's tokens: values per theme, brand and condition, declarations, profiles, owners and value-shape status (`--query`, `--role`, `--group`, `--limit`; `--format dtcg` exports DTCG JSON) ([Inspecting tokens and the public API](#inspecting-tokens-and-the-public-api)) |
447
499
  | `ads mcp [directory]` | Serve tools, resources, prompts, skills and preview Apps; start the local showcase |
448
500
  | `ads mcp --mutations` | Enable guarded edits to the local ADS, validated before application |
449
501
  | `ads showcase [directory]` | Start the same MCP runtime and showcase for browser-only use |
450
502
  | `ads --version`, `ads --help` | Version and usage |
451
503
 
452
- `init` accepts no directory argument. Other commands default to the current
453
- directory and can inspect another directory. `--json` gives structured results
454
- for inspection/setup commands; `mcp` uses stdout exclusively for JSON-RPC.
455
- Exit codes are 0 for success, 1 for check findings, and 2 for invalid
456
- input/configuration or execution errors.
457
-
458
- Guarded MCP editing is opt-in. Its mandatory checks and optional project
459
- `acceptance.scripts` run in a temporary project copy with installed
460
- dependencies. Project scripts default to 60 seconds each; use the explicit
461
- `mcp.mutationCheckTimeoutMs` budget (100–300000 ms) for measured slower builds.
462
- A preview waits up to 5 minutes for its build, including the first build after the
463
- MCP server starts; set `mcp.previewBuildTimeoutMs` (1000–3600000 ms) to change it.
464
- Behavior profiles have a separate whole-run budget.
465
- Draft acceptance runs the draft owners' own registered tests unless
466
- `acceptance.behavior` is false, and their render audit unless `acceptance.audit` is
467
- false. `ads validate` runs `acceptance.scripts` and then `validation.scripts`, so list
468
- each script once. Both script lists default to empty; no names are inferred. Direct
469
- source edits run `ads validate --changed`. See [the two gates](../skills/ads-designer/references/validation.md).
470
- When acceptance runs the owners' registered behavior checks (or a capture was
471
- requested), ADS builds and shares production previews with browser verification.
472
- Acceptance's render audit renders the owners' UI scenarios in the candidate on that
473
- host, or compiles only those scenarios when nothing else needs previews. Core-only
474
- acceptance does not build the whole graph. Remove `build:mcp-previews` from
475
- `acceptance.scripts`; keep that script in the ordinary project build.
476
- See the [editing contract](MCP.md#guarded-editing) for unit ownership,
477
- Git patches, bounded reads and preview review. Keep normal build gates enabled
478
- for edits made by other tools.
479
-
480
- `check` validates required shared names in `:root`, readily checkable value
481
- categories, undefined aliases, alias cycles, and individual theme/media
482
- overrides. Project-specific values and additional definitions within ADS's fixed
483
- naming contract are allowed. The contract's `naming` section lists the fixed
484
- shared families and names; projects cannot rename those shared semantics.
485
- All design values belong in the shared foundation. Components and patterns map
486
- shared roles into their runtime variables instead of defining independent values.
487
- See [shared Data and component mappings](ADS.md#shared-data-and-component-mappings).
488
- Foreign token namespaces remain rejected.
489
- `--ds-*`, `--ux-*`, and `--showcase-*` variables remain owned by their layers,
490
- including when a file is inside `tokens/`. Shared token assignments outside
491
- `tokens/` fail. Source styles also check shared references for undeclared names.
492
- It does not change values, import a theme, or synchronize definitions.
493
-
494
- Source checks enforce the fixed `@ds` public alias for app/showcase consumers,
495
- reject JSX inline styling except files declared in their owner's `styles.inline`
496
- contract, and check CSS and imported
497
- Linaria `css` and `styled` templates for raw visual values and namespace ownership. Private
498
- ADS implementation imports and showcase-local files are allowed. The checker
499
- recognizes imported aliases and shadowed bindings.
500
-
501
- These are static checks, not framework type checking or browser CSS evaluation.
502
- Arbitrary computed expressions, combined conditional cascade behavior, computed
503
- module specifiers, JSX spreads, other styling engines, and renderer-specific APIs
504
- need the project's existing checks and review. Continue to run its type checking,
505
- component tests, and browser comparisons. Register component-specific guards as
506
- explicit project scripts; include them in builds and `acceptance.scripts` when
507
- required. `ads check` does not invoke project linter plugins.
504
+ `init` takes the folder of the design package to create or complete. Other
505
+ commands inspect the given directory. All default to the current folder.
506
+ `--json` gives structured results for inspection and setup commands; `mcp` uses
507
+ stdout only for JSON-RPC. `--fresh` (check and validate) executes the batch
508
+ checks without task-cache reads ([caching](CACHING.md)).
509
+
510
+ Exit codes:
511
+
512
+ - 0: success.
513
+ - 1: error findings, or a gate that did not pass. `ads audit` also exits 1 when
514
+ it ran nothing (no registered or selected scenario): its result is
515
+ `not-available`, never `ok`.
516
+ - 2: invalid input or configuration, or an execution error. With `--json`, an
517
+ execution error prints `{ "ok": false, "error" }`.
518
+
519
+ Review and info items never change the exit code. A one-shot command exits as
520
+ soon as it has reported: it closes its native compiler clients and does not wait
521
+ for their idle timeout. `ads mcp`, `ads showcase` and the `--watch` modes run
522
+ until stopped.
523
+
524
+ These are static checks. They are not framework type checking of the
525
+ application, and they do not evaluate CSS in a browser. Continue to run the
526
+ project's type checking, tests and browser comparisons. Register
527
+ project-specific guards as explicit project scripts, and include them in builds
528
+ and in `acceptance.scripts` when required. `ads check` does not invoke project
529
+ linter plugins. Keep the normal build gates enabled for edits made by other
530
+ tools.
531
+
532
+ **Guarded editing.** Guarded MCP editing is opt-in. Its mandatory checks and the
533
+ optional project `acceptance.scripts` run in a temporary project copy with
534
+ installed dependencies. See the [editing contract](MCP.md#guarded-editing) for
535
+ unit ownership, Git patches, bounded reads and preview review.
536
+
537
+ - `acceptance.scripts` and `validation.scripts` default to empty; ADS infers no
538
+ names. `ads validate` runs `acceptance.scripts` and then `validation.scripts`,
539
+ so list each script once. After direct source edits, run
540
+ `ads validate --changed`
541
+ ([the two gates](../skills/ads-designer/references/validation.md)).
542
+ - Each project script has 60 seconds by default. For measured slower builds, set
543
+ `mcp.mutationCheckTimeoutMs` (100–300000 ms). Behavior profiles have a
544
+ separate whole-run budget.
545
+ - A preview waits up to 5 minutes for its build, including the first build after
546
+ the MCP server starts. `mcp.previewBuildTimeoutMs` (1000–3600000 ms) changes
547
+ this.
548
+ - When acceptance runs the owners' registered behavior checks, or a capture was
549
+ requested, ADS builds production previews and shares them with browser
550
+ verification. The render audit of acceptance renders the owners' UI scenarios
551
+ in the candidate on that host, or compiles only those scenarios when nothing
552
+ else needs previews. Core-only acceptance does not build the whole graph.
508
553
 
509
554
  ### Checks and guards
510
555
 
511
- Every finding has one of three kinds, and no setting changes a finding's kind:
556
+ Every finding has one of three kinds. No setting changes the kind of a finding,
557
+ and there is no warning level.
512
558
 
513
559
  - **Error**: fails `ads check`, `ads audit`, `ads validate` and MCP acceptance.
514
- - **Review**: shown, never blocks; it names something only a person can judge.
515
- - **Info**: notes an analysis limit, such as a color `token-contrast` cannot resolve
516
- statically.
517
-
518
- There is no warning level.
560
+ - **Review**: shown, never blocks. It names something only a person can judge.
561
+ - **Info**: notes an analysis limit, such as an owner that is not analysed until
562
+ another owner is fixed.
563
+
564
+ **Repair plan.** When a command fails, its text output ends with a repair plan:
565
+ the failed rules grouped by mistake, in the order to fix them, each with its
566
+ repair hint and the guides to read. An earlier group is often the cause of later
567
+ errors, so fix the first group and check again. After the steps, the plan names
568
+ the owners that are not analysed until those errors are fixed, one line each
569
+ (`Not analysed until fixed: <owner> (blocked by <owner>)`, capped, with the rest
570
+ in `--json`). `--json` output is the command's result unchanged. MCP replies
571
+ carry the plan as `repair`, with the owners in `repair.notAnalysed`.
572
+ [The rule reference](RULES.md) lists every rule under its group; agents read the
573
+ same catalogue as `ads://guides/errors`.
574
+
575
+ **Text output.** Text output prints errors and review items, but not individual
576
+ info notes. The summary line counts them and says where to read them, for
577
+ example
578
+ `ADS check failed: . (1 error, 4 review items, 38 info notes; --json lists them)`.
579
+ The info part is omitted when there are none. `ads validate` adds the same count
580
+ to its summary line. `ads audit` prints its info rows and counts them in its
581
+ summary.
519
582
 
520
583
  **Gates.**
521
584
 
522
585
  | Gate | What runs |
523
586
  |---|---|
524
- | `ads check` | Static token, theme, brand, accessibility, ownership, import and coverage rules; no browser |
525
- | `ads audit` | axe-core (WCAG A/AA rules), ADS's non-text contrast check, `layout-shift` and `layout-overflow` at 390, 768 and 1280 px in every component, pattern and composition scenario, once per brand and theme, and in a 240 px container for components and patterns |
587
+ | `ads check` | Design-system structure, the import closure, owner analysis, mock ownership, declared themes and brands, generated source and the emitted output folder; no browser |
588
+ | `ads audit` | `ads check`, then axe-core (WCAG A/AA rules), ADS's non-text contrast check, `layout-shift`, `layout-overflow`, `img-shape` and `corner-overpainted` in every registered scenario, once per declared brand and theme, and the text passes (`a11y-text-scale`, `a11y-text-spacing-override`, `a11y-reflow`) once per scenario |
526
589
  | MCP acceptance | `ads_accept` checks the draft's candidate and writes no source unless it passes (`dryRun:true` writes nothing): `ads check` rules, `acceptance.scripts`, the draft owners' own registered behavior tests (`acceptance.behavior`, default `true`) and the render audit of their own UI scenarios (`acceptance.audit`, default `true`) |
527
590
  | `ads validate` | The project gate, applying nothing: `ads check` rules, `acceptance.scripts` then `validation.scripts`, current previews, and every registered behavior test and render audit its change set reaches |
528
- | `ads validate --changed` | The same for what changed since the last successful full run (configuration, foundation or token changes widen it to everything); run it after direct edits or a series of accepted drafts |
529
-
530
- **Render audit.** `ads validate` always runs it over the scenarios its change set
531
- reaches; draft acceptance runs it over the draft owners' own scenarios.
532
- `mcp.auditPages` (1–16, default 4) sets how many pages render at once. Each `a11y-axe`,
533
- `a11y-non-text-contrast`, `layout-overflow` and `layout-shift` finding is an error that fails the gate, and an audit that cannot run fails it with a `render-audit` error
534
- naming what to install. Each `a11y-incomplete` finding is an info item that fails nothing: axe could
535
- not decide that rule on those elements, so check it by hand. It names the axe rule, scenario, themes,
536
- elements, and axe's reason, such as `bgGradient` for text over a gradient. The audit needs the
537
- project's Playwright and a browser:
538
-
539
- ```sh
540
- npm install -D @playwright/test # ads init declares it
541
- npx playwright install chromium # Bun: bunx playwright install chromium
542
- ```
591
+ | `ads validate --changed` | The same for what changed since the last successful full run. Configuration, foundation or token changes, and changes outside `dsDir` such as manifests, lockfiles or tooling, widen it to everything. Run it after direct edits or a series of accepted drafts |
543
592
 
544
- `mcp.capture` selects `browser` (`chromium`, `firefox`, `webkit`), an installed Chrome
545
- `channel` such as `"chrome"`, and `timeoutMs`. To turn the owners' behavior tests or
546
- render audit off for draft acceptance, set them in `ds.config.json`; `ads validate`
547
- always runs both:
593
+ To turn the owners' behavior tests or render audit off for draft acceptance, set
594
+ them in `ds.config.json`. `ads validate` always runs both:
548
595
 
549
596
  ```json
550
597
  {
@@ -553,930 +600,2064 @@ always runs both:
553
600
  }
554
601
  ```
555
602
 
556
- Declare `"sideEffects": ["**/*.css"]` in `package.json`, as the starters do, so a
557
- component change audits only the scenarios that import it.
558
-
559
- A render that fails because the preview dropped or was slow is retried on its own, up to 3
560
- attempts, with a new browser and preview; the others keep their results, and findings never
561
- cause a retry. The JSON result and the check list retried passes under `retries`, and `ads
562
- audit` prints them. A scenario that still fails is a `render-audit` error naming it and the
563
- last cause, beside any findings. A project that fails validation stops the audit.
564
-
565
- **Non-text contrast.** axe-core does not check WCAG 1.4.11, so the audit adds
566
- `a11y-non-text-contrast` for every visible, enabled `button`, `input`, `select`, `textarea`,
567
- `a[href]` and `switch`, `checkbox`, `radio`, `slider` and `tab` role in the rendered state:
568
-
569
- - A control whose background has less than 3:1 against the background around it and that
570
- has a visible border needs that border at 3:1 against the surrounding background. Use
571
- `--border-strong` (or a stronger step) for a field or control outline; `--border-default`
572
- is for dividers and card edges. A button, link or tab with text or an icon is exempt: that
573
- content identifies it.
574
- - An icon-only control (an `svg`, no text) needs the icon's stroke or fill at 3:1 against
575
- the control's background. Paint icons with a text or `-fg` token.
576
-
577
- Disabled and `aria-disabled="true"` controls, controls whose background has 3:1 against
578
- their surroundings, browser-drawn native checkboxes, radios and ranges, and controls over a
579
- background image are exempt. Each finding names the scenario, themes and brands, element
580
- selectors and the lowest ratio. Hover and focus states are not rendered by the audit.
581
-
582
- **Contrast.** `token-contrast` checks the role pairs that meet on screen in every theme and
583
- brand: text, link, accent and status text on their backgrounds need 4.5:1; focus indicators
584
- and control borders on canvas and surface need 3:1. It resolves every CSS color syntax,
585
- including `oklch()` and `color-mix()`, and composites translucent colors over their
586
- background and the canvas. A pair color it cannot resolve statically (`currentColor`,
587
- relative color syntax) is a `token-contrast-unresolved` info item. Fix a failing pair by
588
- choosing another ramp step.
589
-
590
- `component-contrast` checks the pairs components and patterns make themselves. Where one
591
- Linaria style block (the template's top level, a nested block such as `&:hover` or
592
- `&[aria-selected="true"]`, or an at-rule) declares both `color: var(--a)` and
593
- `background` or `background-color: var(--b)`, the pair needs 4.5:1 in every theme and brand,
594
- resolved and composited as `token-contrast` resolves it. Large text needs 3:1 (WCAG 1.4.3):
595
- where the block or an enclosing block declares `font-size` of at least 24px, or at least
596
- 18.66px with `font-weight` 700 or more, in `px`, `pt` or `rem` (a 16px root), literally or
597
- through a token resolved per theme and brand. Other sizes (`em`, `%`, `calc()`, keywords,
598
- the `font` shorthand) are not known to be large and keep 4.5:1; a size set by another
599
- composed class is not seen, so declare it in the block that pairs the colors. Each failing
600
- context reports its `minimum`. Local custom properties set in the
601
- block or an enclosing block resolve one level; an undeclared one reads its `var()` fallback.
602
- Fix it with the role contract: `--x-text` on
603
- `--x-bg`, `--x-fg` on `--x` (not `--success` as text on `--success-bg`). Disabled states
604
- (`:disabled`, `[disabled]`, `[aria-disabled="true"]`, `[data-disabled]`) are exempt;
605
- `currentColor`, `inherit`, `transparent`, fully transparent backgrounds, one token on both
606
- sides and native `<progress>`, `<meter>` and range parts are skipped. A side that names no
607
- declared color token is a `component-contrast-unresolved` info item; so is text matching the
608
- canvas (under 1.25:1) over a translucent background, which sits on another backdrop.
609
- Pairs `token-contrast` checks are not repeated.
610
-
611
- The same rule also follows source-resolvable owned JSX composition: imported component
612
- calls, wrappers forwarding `children`, fragments, returned style objects and separate
613
- Linaria classes. For actual text, it checks the resolved foreground against the element's
614
- background or an owned ancestor's background, across themes and brands. For example, a
615
- link using `--text-product` inside a panel using `--bg-menu` is checked automatically;
616
- there is no custom pair declaration to remember. Transparent wrappers preserve the
617
- backdrop; translucent token layers need a known opaque ancestor. Composed text can use a
618
- known inherited font size/weight. Hidden and disabled text is excluded; matching text and
619
- background tokens are still an error when the source proves that text is rendered.
620
- Text supplied through a `string` or `number` prop is checked too. Literal class hooks
621
- do not hide the backdrop when no captured paint selector targets them. Optional classes
622
- that only change layout preserve contrast evidence; every alternative must establish
623
- the same paint and visibility facts.
624
-
625
- This composition pass does not guess the browser cascade. Competing classes, differing
626
- paint/interpolation alternatives, unknown prop spreads or components, conditional or
627
- descendant paint selectors, gradients, opacity, filters, out-of-flow positioning and
628
- missing backdrops produce `component-contrast-unresolved` info where contrast evidence
629
- is incomplete. SVG text, native control value/placeholder text and dynamically generated
630
- DOM remain browser-audit concerns. An informational limit is not a contrast pass: run
631
- `ads audit` on the affected composed scenario and interaction states. Axe remains the
632
- rendered check, including actual cascade, visibility and backgrounds.
633
-
634
- **Static accessibility.** Errors: `a11y-target-size` (`--control-height-*` at least 24 px),
635
- `a11y-focus` (`--focus-w` at least 2 px and a `:focus-visible` indicator in `base.css`),
636
- `a11y-text-resize` (font sizes in `rem`), `a11y-reduced-motion` (every non-zero `--dur-*`
637
- set to 0 under `prefers-reduced-motion`), `a11y-text-spacing` (`--leading-normal` at least
638
- 1.5, `--content-max` under 80 characters), `a11y-image-alt` and `a11y-icon-label`.
639
- `a11y-keyboard` is a review item.
640
-
641
- **Layout.** Widths are fluid on the grid.
642
-
643
- `layout-fixed-width` (`ads check`) reads fixed minima in component, pattern and composition
644
- styles: widths, inline sizes, flex bases and grid tracks. Fixed sizing comes from the project's
645
- spatial scale, mini/fine units, standard control/icon sizes or explicit fixed-size roles.
646
- Aliases and calculations retain their underlying roles, and a fixed minimum must fit the
647
- spatial maximum. Projects without a spatial definition may use their shared spacing primitives.
648
-
649
- | Construction | Result |
650
- |---|---|
651
- | A fixed size from `spatial.ads.json`'s scale, including sizes above 96 px | Supported within the spatial bound |
652
- | Standard control/icon size, or an alias/calculation based on a supported size | Supported within the spatial bound |
653
- | A fixed minimum without a supported sizing role | `layout-fixed-width` error |
654
- | `min(100%, var(--side-pane-width))`, shrinking flex bases or `minmax(0, var(--side-pane-width))` tracks | Supported responsive sizing |
655
- | Percentages, fractional tracks, viewport/container units and intrinsic sizing | Supported |
656
- | A maximum size, or a fixed width capped by `max-width: 100%` in the same rule | Supported cap |
657
- | A token explicitly named by `layout.widthTokens` | Supported and listed for review |
658
- | Fixed/hybrid tracks emitted by `@ads-layout` | Checked by local track, cap, margin and gutter algebra |
603
+ A behavior, preview or audit stage with nothing to run (no registered checks or
604
+ scenarios, none that the change reaches, or turned off) is listed as
605
+ `skipped: true` with `status: "not-available"`, a `reason` code and a `message`.
606
+ In acceptance it does not block the draft; `ads audit` exits 1.
607
+
608
+ **Behavior.** A registered guarantee needs current passing execution evidence.
609
+ `ads verify` runs the registered checks against current source.
610
+
611
+ #### Render audit
612
+
613
+ The audit renders registered scenarios from the emitted preview tree, which
614
+ holds only a revision that passes `ads check`. With no registered scenario it
615
+ reports `not-available` (`no-scenarios`); with none selected, `none-selected`.
616
+
617
+ The audit mounts a scenario's specimens alone, without the page that ADS draws
618
+ around them in the showcase, so every finding is about the project's UI. A
619
+ capture shows the page as the showcase does.
620
+
621
+ - **Kinds.** Without `--scenario`, the audit renders component and pattern
622
+ scenarios. A mock gates nothing and is left out; `ads audit --scenario
623
+ mocks/<Name>` still audits one, as a look at how its owners combine.
624
+ - **States.** Every named state of a scenario is its own render, in every theme
625
+ and brand, with all passes. A finding lists the states it was found in
626
+ (`states`, and "States: Invalid, Long." at the end of its message); the same
627
+ finding in several states is one finding. A scenario has at most 12 states.
628
+
629
+ - Each `a11y-axe`, `a11y-non-text-contrast`, `a11y-text-scale`,
630
+ `a11y-text-spacing-override`, `a11y-reflow`, `layout-overflow`, `layout-shift`
631
+ and `img-shape` finding is an error that fails the gate.
632
+ - Each `a11y-incomplete` finding is an info item that fails nothing: axe could
633
+ not decide that rule on those elements, so check it by hand.
634
+ - An audit that cannot run fails the gate with a `render-audit-unavailable`
635
+ error. When the browser installation cannot run (offline, a blocked download),
636
+ the error names the command that installs the browser by hand (see
637
+ **Screenshots** above).
638
+ - The browser is Chromium by default. `mcp.capture` selects `browser`
639
+ (`chromium`, `firefox`, `webkit`), an installed Chrome `channel` such as
640
+ `"chrome"`, and `timeoutMs`.
641
+ - `mcp.auditPages` (1–16, default 4) sets how many pages render at once.
642
+ - A render that fails because the preview dropped or was slow is retried alone,
643
+ up to 3 attempts, with a new browser and preview. The other renders keep their
644
+ results, and findings never cause a retry. The JSON result and the check list
645
+ the retried passes under `retries`, and `ads audit` prints them. A scenario
646
+ that still fails is a `render-audit` error that names it and the last cause,
647
+ beside any findings.
648
+
649
+ What the audit measures in each render:
650
+
651
+ - **Non-text contrast** (WCAG 1.4.11, which axe-core does not check). A visible,
652
+ enabled control whose background does not stand out from its surroundings
653
+ needs a 3:1 border on its best-contrasting side (a soft field's one rule under
654
+ the text passes). An icon-only control needs a 3:1 icon. Disabled controls,
655
+ browser-drawn native controls and controls over a background image are exempt.
656
+ A text-entry control whose recipe declares an `accessibility` boundary
657
+ (identified by its visible label, or by a boundary that appears on
658
+ interaction) is not failed. It is listed on every run as the review item
659
+ `a11y-boundary-declared`, with a screenshot under `.ds/audit-evidence/`, for a
660
+ person to keep approving.
661
+ - **Overflow** at 390, 768 and 1280 px: horizontal document scrolling, elements
662
+ past the edge of the viewport, and text or a control cut off by
663
+ `overflow-x: hidden` or `clip` (`clipped`; the finding names what is cut).
664
+ - The audit measures what is cut, not the scroll width of the box. Images,
665
+ video, canvas, SVG artwork, iframes, `aria-hidden` and inert layers, and
666
+ pseudo-elements under a clip are not cut content, so a cropped hero image or
667
+ a decorative glow passes.
668
+ - Scrollers, ellipsis text, carousels, pannable widgets, native text fields,
669
+ fixed layers and visually hidden content are exempt.
670
+ - Components and patterns are also rendered in a 240 px container. What does
671
+ not fit a side pane is a `layout-overflow-narrow` review item.
672
+ - **Text scaling** (WCAG 1.4.4, 1.4.10, 1.4.12), once per scenario in the first
673
+ theme and brand, because text does not follow colour. The passes add about a
674
+ tenth to the audit's time.
675
+ - `a11y-text-scale`: at each overflow width the audit doubles the root font
676
+ size (200% text). It also renders the page zoomed to 200% (the 640 px
677
+ viewport that a 1280 px window leaves).
678
+ - `a11y-text-spacing-override`: at each overflow width the audit applies the
679
+ WCAG text-spacing values as the reader's stylesheet does (line height 1.5,
680
+ letter spacing 0.12em, word spacing 0.16em, 2em after paragraphs).
681
+ - `a11y-reflow`: the audit renders the page at 320 px (1280 px at 400%).
682
+ - Each pass reports what the scenario does not already show at rest:
683
+ horizontal overflow as above; text or controls cut off below by
684
+ `overflow: hidden` or `clip` (`block-clipped`); content that spills past a
685
+ box whose height or max-height does not grow (`spilled`); grid or flex items
686
+ that overlap past a reserved track (`overlap`); and a control or its focus
687
+ outline cut off by a clipping ancestor (`focus-clipped`).
688
+ - Each finding names the pass, the widths and the elements. Content that a
689
+ scroll axis hides is scrolled, not cut off. Ellipsis text, line clamps and
690
+ the exemptions of the overflow check stay exempt. Overflow that already
691
+ fails at 390 px is reported once, by `layout-overflow`.
692
+ - **Interaction states**: overlays opened from `aria-haspopup` controls, hovered
693
+ and focused controls, and busy controls, named in the finding's selector
694
+ (`open overlay "Edit": button`, `hover: button`). The result's `coverage`,
695
+ printed as a `Covered:` line, gives what was measured. What was skipped is a
696
+ `render-audit-skipped` info item. A render that measured none of its targets
697
+ is a `render-audit-nothing-measured` review item.
698
+ - **Settling**: the audit waits up to 5 s for the page to settle, and each
699
+ measurement waits for layout to stop moving. A page that never settles is
700
+ measured anyway and reported as `content-still-changing`.
701
+ - **Images and layout shift**: `img-shape` reports a visible image whose box
702
+ differs from its declared ratio. `layout-shift` reports a Cumulative Layout
703
+ Shift above 0.1 on first render, where the browser reports it (Chromium).
704
+ - **Rounded corners**: `corner-overpainted` reports an element with a radius
705
+ and visible overflow whose corner a descendant paints over (a child
706
+ component's background, an image). `ads check` proves the same for a
707
+ recipe's own parts (`construction/corner-overpaint`); the audit covers what
708
+ a recipe cannot see. ADS never clips for you, because clipping also cuts
709
+ focus outlines, shadows and menus: clip the element, inset it, or round what
710
+ it holds.
659
711
 
660
- A panel can use a responsive cap or a validated hybrid region. Repeated tiles can use
661
- `@ads-layout fixed`. There is no universal fixed-width pixel cutoff and no warning for a
662
- legitimate responsive cap around a small part.
712
+ ## Showcase
663
713
 
664
- `layout` in `ds.config.json` has two fields:
714
+ ADS ships a minimal HTTP browser shell with isolated previews. `ads mcp` serves
715
+ the website alongside its stdio connection, and `ads showcase` starts the same
716
+ runtime for browser-only use. `ads mcp --no-showcase` keeps a headless stdio
717
+ server. Run the commands from the project root. Open the printed URL, or use
718
+ `ads_status.showcaseUrl` from a connected runtime: the URL and port of the
719
+ showcase that the server runs. ADS selects an available loopback port by
720
+ default; `--port 4185` selects a fixed port.
721
+
722
+ The browser reads discovery and opens previews through scoped HTTP services,
723
+ backed by the same engine as MCP. The client uses no project catalogue pages and
724
+ no direct component imports.
725
+
726
+ - SSE events refresh the menus and the build state.
727
+ - The selected scenario updates inside its persistent iframe. Compatible edits
728
+ keep component state, typed values and focus. Changed hook signatures follow
729
+ the framework's refresh rules (React Refresh, or Prefresh for Preact). An edit
730
+ that changes hook signatures or module boundaries, or the restoration of a
731
+ rejected revision, can reset the preview.
732
+ - A failed check restores the verified output. Errors identify stale retained
733
+ output.
734
+ - “Checking changes…” is live feedback, not acceptance. The source gates and the
735
+ selected browser checks decide whether the revision passes. Application
736
+ production builds are unchanged.
737
+ - The theme and brand selectors list the themes and brands that
738
+ `foundation.ads.ts` declares, through the preview host context.
739
+
740
+ Previews compile from the design system's emitted preview tree with ADS's Bun
741
+ compiler: incremental modules for watched previews and complete bundles for
742
+ verification. The project supplies no mount file and no preview application.
743
+ There is one managed compiler per runtime, shared by stdio and HTTP clients. The
744
+ App loads only the selected scenario's dependencies. An accepted mutation of a
745
+ configuration unit replaces the managed compiler and keeps MCP connected. See
746
+ [the compiler contract](MCP.md#one-client-command-managed-preview-builds) for
747
+ revisions, diagnostics, invalidation and the shared resource graph.
665
748
 
666
749
  ```json
667
- { "layout": {
668
- "widthTokens": ["--side-pane-width", "--ux-panel-*"],
669
- "fixedWidthUnits": ["components/Overlays/*", "design-system/patterns/Menu/**"]
670
- } }
750
+ {
751
+ "framework": "react@19.2.7",
752
+ "mcp": { "showcaseTitle": "My Project Design System" }
753
+ }
671
754
  ```
672
755
 
673
- - `widthTokens`: token names or globs of widths that stay fixed.
674
- - `fixedWidthUnits`: unit ids or project-relative file globs (`*` within a path segment, `**`
675
- across them) whose widths are not checked. List overlays here: dialogs, menus, popovers and
676
- tooltips. There is no per-declaration exception.
756
+ `framework` can pin the exact installed version (`name@1.2.3`). ADS keys preview
757
+ freshness and compiled previews by the files it owns (`ds.config.json` and the
758
+ design-system folder) and by the emitted preview tree. The pin is how a
759
+ framework upgrade reaches previews, so update it with the upgrade. The optional
760
+ title defaults to the project package name followed by ` · Design System`.
761
+
762
+ **Scenarios.** The showcase lists the registered [scenarios](#scenarios) and
763
+ previews them from the emitted preview tree. A project without scenarios lists
764
+ none, and `ads_scenarios`, `ads://project/scenarios` and `ads_status` report
765
+ `not-available` (`no-scenarios`).
766
+
767
+ **Showcase boxes.** A scenario's subject (the owners it covers) is shown in a
768
+ box of the project's own canvas, 16px larger than the subject on each side, on
769
+ the showcase's neutral page; the scenario's own headings and notes stay on the
770
+ page. The ADS views do the same for their samples and drawings. Leave at least
771
+ 24px between a heading and the subject under it.
772
+
773
+ **Groups follow folders.** The left menu groups its entries by the design
774
+ system's folders: token folders and their role sheets, profile folders, asset
775
+ folders, the area folders that hold owners, and an owner that has more than
776
+ one scenario. Tokens, Profiles and Artwork each start with a **Summary** entry
777
+ generated from the same data: the folders with their counts. A view opened without the
778
+ showcase (an MCP App in another client) offers the same choices as buttons on
779
+ its page.
780
+
781
+ **ADS views.** Beside the scenarios, the showcase lists entries that ADS draws
782
+ itself from the revision it previews, in a frame of the project with its emitted
783
+ sheets and themes. They are not scenarios: the registry, `ads_scenarios` and
784
+ scenario coverage never list or count them, and no source file declares them.
785
+ They read the preview tree of the emitted revision, never live source, so an
786
+ edit appears after it is emitted.
787
+
788
+ - **Spatial grids** (id `foundation`, in the Profiles section after its
789
+ summary) shows the grid of each
790
+ spatial profile as cards: one per breakpoint with its columns and outer
791
+ margin drawn to scale, one per gutter mode with the content placed in its
792
+ columns, the spacing scale step by step and the units. After the cards come
793
+ example regions that
794
+ step through the breakpoints as you resize the preview: one per gutter mode,
795
+ a hybrid grid when the profile states fixed tracks, and a fixed tiling when
796
+ it states a tile size. Each example is the grid algebra's own expansion,
797
+ carried in the preview tree's facts file with its token references; the
798
+ view derives no margins, bounds or tracks
799
+ itself. A changed margin or gutter token thus changes the example in the
800
+ frame's theme and brand. The guide overlay draws on the examples. It draws
801
+ each element's lattice in the mini unit of the spatial profile that the grids
802
+ of its owner follow, from the same facts.
803
+ `ads_show_scenario({ id: "foundation" })` opens the view like a scenario.
804
+ - **Profiles** (id `profiles`, the Profiles section) lists every profile,
805
+ whether or not an owner selects it. The left menu lists the folders under
806
+ `profiles/`; a folder's page shows its profiles under their kinds. Each
807
+ profile is a card: its sample, its name, and a line of its first fields
808
+ (for a composite, the fields that shape it), what it states itself before
809
+ what it takes from another profile. The sample shows the profile as a whole: text set in a text
810
+ profile, a surface painted with a surface profile, a box framed by a frame
811
+ profile, items spaced by a spacing profile, a control with a focus profile's
812
+ indicator, and a composite's profiles together. A motion profile also
813
+ plays: a square moves by the profile's timing on its own effect (a turn, a
814
+ scale or a distance), with a **Replay** button; it stays still when the
815
+ reader asks for reduced motion. Use it to find profiles
816
+ that repeat each other, and to see what a change to a base profile reaches.
817
+ `ads_show_scenario({ id: "profiles" })` opens the view like a scenario.
818
+ - **Artwork** (id `assets`, the Artwork section) lists every declared asset,
819
+ whether or not an owner draws it. The left menu lists the asset groups (the
820
+ folders under `assets/`). The Summary lists every glyph set with its
821
+ members: a set is a named list of glyphs that a component may choose from by
822
+ name at run time, declared beside the glyphs. A group's assets are sections by paint kind: foreground
823
+ (takes the text colour), slots (takes its paint slots' tokens) and intrinsic
824
+ (keeps its own colours). Each row draws the asset from its authored SVG, made
825
+ inert by ADS's sanitizer, and shows its title, aliases, glyph sets, what
826
+ differs between its drawings (themes, sizes, states), its optical centre
827
+ when that is not the middle of its box, and where it is declared. A themed asset shows the drawing of the preview's theme.
828
+ `ads_show_scenario({ id: "assets" })` opens the view like a scenario.
829
+ - **Tokens** (id `tokens`, the Tokens section) lists every token of the
830
+ token inventory (`ads tokens`), whether or not an owner uses it. No scenario
831
+ thus has to exercise a token. The left menu lists the token folders as groups
832
+ and each role sheet (`tokens/<Group>/<role>.ads.css`) as an entry; an entry's
833
+ page shows that role's tokens. Under
834
+ its name a section says what the role is for, the unit to write it in, the
835
+ profile fields that read it, and whether it may derive from a spacing token. A
836
+ **Problems** choice lists every token whose status is not valid. A group shows
837
+ its first 100 tokens, and **Show more** adds the next 100. A token edit keeps
838
+ the selected group; an edit to an owner alone does not rebuild the view. The
839
+ explorer entry of the view is the token category, whose count is the number of
840
+ tokens. Each token is a card:
841
+ - a sample drawn from the token itself: a swatch as wide as the card for a
842
+ paint, gradient or shadow, or, when the token differs between themes, one
843
+ small swatch per theme with the theme's name and the value there; two
844
+ lines of text for a line height; a bar for a length; a corner for a radius; a
845
+ line eight times as thick for a border width; a type sample for a font
846
+ family, size, weight or letter spacing; for a duration or an easing, a
847
+ square that travels a track for that long, or along that curve (at rest
848
+ when the reader asks for reduced motion);
849
+ - the name, then its value here (what the frame computes in the theme and
850
+ brand selected in the showcase), what its author says it is for (the
851
+ comment above its declaration), what a brand or a condition changes
852
+ (`iris: …; @media (…): …`) and its value-shape status when it is not
853
+ valid. `ads tokens` lists where each token is declared and what reads it.
854
+
855
+ **Phone viewport.** The toggle in the showcase header constrains the real
856
+ preview iframe to 390 CSS pixels, or to the available width on a narrower
857
+ screen. It keeps the mounted example and its state, and does not change the
858
+ selected application host. `?viewport=phone` keeps the choice in a link; turn
859
+ the toggle off to follow the available browser width. On phone browsers the
860
+ catalogue starts collapsed, and the navigation button opens it again. Automated
861
+ captures keep their exact requested viewport.
862
+
863
+ **Approval view.** `?draft=<id>&view=approval&revision=<revision>`, the
864
+ `approvalUrl` that `ads_accept` returns, lists the accessibility declarations
865
+ that a draft revision adds or changes, and what ADS verifies of each. Its
866
+ "Approve and accept" is a person's step. It accepts that exact revision through
867
+ the gates of `ads_accept` and records no name; a changed draft asks for a new
868
+ link. First review the draft's split view in every theme and brand.
869
+
870
+ Run `ads check` and the registered project checks before preview compilation,
871
+ with the framework checks and meaningful tests. Review real entries at narrow
872
+ and wide sizes, in each declared theme and in the relevant states. Browser
873
+ verification establishes layout, keyboard and focus behavior, interactions and
874
+ motion; compiler success does not.
677
875
 
678
- `layout-declared-width` lists explicit fixed roles and owners for review. A configuration
679
- entry matching no token, unit or file is a `layout-config` error; an entry cannot name every
680
- token or unit.
876
+ ## Configuration and component rules
681
877
 
682
- ### Spatial layouts
878
+ `ds.config.json` uses schema version 1. Every field is optional except the
879
+ framework that init saves. Defaults apply to the other fields:
683
880
 
684
- `tokens/spatial.ads.json` defines the mini unit, sizing scale, ratios, breakpoints and gutter
685
- modes. Owned Linaria styles describe layout with `@ads-layout`; ADS validates it against that
686
- definition and compiles it to ordinary CSS, so placement is correct in the first render and no
687
- layout wrapper component is needed. An invalid construction is a `grid-construction` error at
688
- its source; an invalid definition is `grid-definition`.
881
+ ```json
882
+ {
883
+ "schemaVersion": 1,
884
+ "framework": "react",
885
+ "dsDir": "design-system",
886
+ "assets": { "generatedPaths": ["dist", "dist-showcase", ".vite", ".ds"], "fontBudgetKb": 150 },
887
+ "acceptance": { "scripts": [], "behavior": true, "audit": true },
888
+ "validation": { "scripts": [], "inputs": [] },
889
+ "resources": { "memoryLimitMb": null },
890
+ "cache": { "extractionMaxMiB": 64, "extractionMaxEntries": 8192 },
891
+ "compile": { "outDir": null, "emitOnAccept": true },
892
+ "mcp": { "showcaseTitle": null, "auditPages": 4, "behaviorProfiles": {}, "capture": {} }
893
+ }
894
+ ```
689
895
 
690
- | Layout | Use |
896
+ | Field | Purpose |
691
897
  |---|---|
692
- | `fluid` | Tracks that share the width: the breakpoint's column count, or `columns: N` |
693
- | `hybrid` | Fluid tracks plus a `fixed-start` and/or `fixed-end` track (a token or `0`); `@ads-at <breakpoint> { fixed-start: …; fixed-end: … }` changes them from that breakpoint on |
694
- | `fixed` | Tiles of `tile: <token>` that wrap |
695
- | `flow` | A column with `row-gap`, natural content height |
696
- | `inherited` | Inside a cell: continues the parent's tracks (CSS subgrid), optionally with its own `gutter` mode |
697
-
698
- Fluid and hybrid roots also take `gutter`, `row-gap`, `margin`, `bound`, `align`, `rows` and
699
- `context`. `align: start | center | end` places a capped region (`bound` other than `full`)
700
- inside the available width, keeping its outer margin; the default is `center`. `rows` lists
701
- 1–12 row sizes, each `auto` (content height) or `fill` (shares the remaining block size), for
702
- example `rows: auto fill` for a header above a body. Without `rows`, rows are implicit and
703
- content-sized; ADS never invents equal rows.
704
- `context: viewport` (the default) emits media queries; `context: container` applies the same
705
- breakpoints to the nearest region container instead, so a layout responds to the space its
706
- region has. Inherited layouts follow their parent's context.
707
-
708
- Cells are direct children named by class or data attribute: `@ads-cell .name { … }`.
709
-
710
- | Property | Values |
711
- |---|---|
712
- | `start` | A column line from 1, or `auto` to take the next free position (needs a numeric `span`). Default `1` |
713
- | `span` / `end` | Columns to cover (a number or `full`), or the line to end before. Use one; a breakpoint that sets one replaces the other |
714
- | `row`, `row-span` | Row line (default `auto`) and rows to cover (default 1). With `rows` declared, placement must stay within them |
715
- | `visible` | `true` (default) or `false`. A hidden range compiles to a bounded query, so the element's own `display` is never overridden where it is visible |
716
- | `padding`, `ratio` | A spacing token inside the cell; a supported ratio |
717
-
718
- Two region properties:
719
-
720
- - `container: region` makes the cell a region container for `context: container` layouts
721
- inside it. A cell either continues its parent's tracks or starts a region, not both.
722
- - `overlay: start | end` takes the cell out of the tracks at that breakpoint: it covers the
723
- region from that inline edge and the other cells keep their tracks. `overlay: none` returns
724
- it to its track. Overlays belong to root fluid or hybrid layouts.
725
-
726
- `@ads-at <breakpoint> { start; span; end; row; row-span; overlay; visible }` changes a cell from
727
- that breakpoint on. An overlay keeps its row band, so a panel placed in the body row covers the
728
- body, not the header.
729
- Placement is checked against the track count at every breakpoint. Outside any region
730
- container, a `context: container` layout uses its narrowest placement. The starter's `Shell`
731
- pattern combines hybrid tracks, overlays and a region container for its panels.
732
-
733
- `layout-overflow` (render audit) resizes each rendered scenario, in every theme and brand, to
734
- 390, 768 and 1280 px. Each finding names the scenario, widths, themes, brands and elements:
735
-
736
- - The document scrolls horizontally.
737
- - An element reaches past the viewport's edge; the outermost such element is named.
738
- - An element with `overflow-x: hidden` or `clip` cuts off content more than 4 px wider.
739
-
740
- Exempt: `overflow-x: auto` or `scroll` scrollers and their content, except the outermost one as tall as the window, which is the page or a preview frame; `text-overflow: ellipsis`,
741
- carousels (`aria-roledescription="carousel"`), pannable widgets (`role="application"`), native text fields, fixed-position layers and visually hidden content.
742
-
743
- Each measurement waits for layout to stop moving, so a component that refits after a resize is
744
- measured after it refits. Before measuring anything, the audit waits up to 5 s for the page to settle:
745
- no change in the scenario for 500 ms, no finite animation running, and nothing still loading. Content
746
- that arrives late, such as syntax colours, is then measured every run. A page that never settles is
747
- measured anyway and reported as `content-still-changing`.
748
-
749
- The audit also renders what a scenario shows after someone acts on it, in every theme and brand.
750
- Findings name the state in the selector, such as `open overlay "Edit": button` or `hover: button`.
751
- The result's `coverage`, also printed as a `Covered:` line, gives what was measured. What was skipped is
752
- a `render-audit-skipped` info item per reason, with up to 5 examples. A render that could measure none
753
- of its targets is a `render-audit-nothing-measured` review item.
754
-
755
- - **Overlays.** It clicks each distinct control with `aria-haspopup`, up to 3 per render, once per
756
- theme and brand across the audit. What opens
757
- (`dialog`, `alertdialog`, `menu`, `listbox` roles, an open `<dialog>` or popover) gets axe, non-text
758
- contrast, and must fit the 390 px viewport. Give a trigger `aria-haspopup`, or render the overlay
759
- open in its scenario. Tooltips are not opened.
760
- - **Hover and focus.** Up to 6 controls per render, in document order, each distinct control once per
761
- theme and brand on the same surface, measured by the first scenario in request order. Focus skips a
762
- control a keyboard cannot reach: `aria-hidden` on it or an ancestor, `inert`, or `tabindex="-1"`
763
- outside a `group`, `tablist`, `menu`, `menubar`, `radiogroup`, `toolbar`, `listbox`, `tree` or `grid` that
764
- holds a `tabindex="0"`. Under hover it runs axe
765
- `color-contrast` and the non-text check. A `:focus-visible` outline needs 3:1 against what is around
766
- it. A focus ring drawn with `box-shadow` is not read, and an outline beside one is left alone.
767
- - **Busy.** A control with `aria-busy="true"` is checked even when disabled, and its icon even when it
768
- has text. Render the busy state in the scenario: the audit does not press buttons to reach it.
769
-
770
- It also renders each component and pattern scenario with its container narrowed to 240 px, inside
771
- the 1280 px viewport, once per brand, to show what would not fit a side pane. These are
772
- `layout-overflow-narrow` review items: fix the part if it can sit in a pane, or change a scenario's
773
- demo frame to a maximum.
774
-
775
- - An element past the container's edge, or cut off inside it, is reported when it or something in it
776
- has a set width, `min-width` or unshrinking `flex-basis` above 96 px. A row or table held open only
777
- by its content, or by parts of 96 px or less, is not reported.
778
- - Not rendered this way: compositions, scenarios with a `main` landmark, which are pages, and owners
779
- in `layout.fixedWidthUnits`, which float above the layout.
780
- - A finding that clears at the 390 px viewport, still in the 240 px container, is left out: it folds
781
- on a viewport media query, such as a full-width site header.
782
-
783
- **Web performance.** MCP serves this as `ads://guides/performance`.
784
-
785
- | Rule | Gate | Fails |
786
- |---|---|---|
787
- | `img-attributes` | `ads check` | A raw `<img>` in components, patterns or compositions without `loading`, or without `width` and `height`, a visible `aspect-ratio`, a width and height in its style, or out-of-flow positioning. A `srcset` with width descriptors and no `sizes`, on `<img>` or the project's `Image`. A spread or a class from elsewhere is an `img-attributes-unresolved` info item |
788
- | `asset-image-budget` | `ads check` | An image in `assets/` over its limit: SVG 100 KB, WebP and AVIF 300 KB, JPEG 400 KB, PNG and GIF 500 KB. `assets.imageBudgetKb` is one limit for every format |
789
- | `img-shape` | `ads audit` | A visible image whose CSS sizing box differs from its explicit `aspect-ratio`, or, with none and `object-fit: fill`, whose content box differs from its `width` and `height`. Explicit CSS ratios respect `box-sizing`; attribute ratios exclude border and padding. A height attribute beats `aspect-ratio`: add `height: auto`. `object-fit: cover` in a box of its own with no `aspect-ratio` is a deliberate crop |
790
- | `layout-shift` | `ads audit` | A scenario with Cumulative Layout Shift above 0.1 on first render, where the browser reports it (Chromium) |
791
- | `themes-generated` | `ads check` | A stale `tokens/fonts.preload.generated.ts` |
792
- | `font-weight-missing` | `ads check` | CSS uses a weight of a family `tokens/fonts.css` declares and no face covers it. A range such as `100 900`, or a face with no `font-weight`, covers what it spans. A weight in a rule with no `font-family` counts against the body's family |
793
- | `asset-font-budget` | `ads check` | A font file in `assets/` above 150 KB. `assets.fontBudgetKb` changes the limit |
794
-
795
- Review items, which fail nothing: `font-file-unused` (a declared face no CSS uses; weights 400 and 700
796
- count as used, since browsers apply them by default), `font-display` (none, or `optional`, which decides
797
- per file and can leave some weights in the fallback on one page) and `font-format` (not WOFF2). A
798
- project with no `@font-face` gets none of these.
799
-
800
- The starters' `Image` lazily loads and reserves space; `priority` marks the view's main visible
801
- image. When body or heading text uses a font from `tokens/fonts.css`, `ads assets` writes
802
- `tokens/fonts.preload.generated.ts`, and the generated public barrel re-exports it: call
803
- `preloadFonts()` from the public entry in the app entry before the first render. It imports the files through the bundler, Vite or Bun, so the preload and the stylesheet share
804
- one URL. For a preload earlier than JavaScript, a build step or prerender can call `fontPreloadTags()`
805
- for `<link>` tags or `fontPreloadHeader()` for a `Link` header value; `fontPreloads` is the same list.
806
- A project that sets heading fonts per component names what to preload in `assets.preloadFonts`:
807
- `[{ "family": "Body", "weight": 400 }, { "family": "Heading", "weight": 700 }]`. That list replaces the
808
- reading of `base.css`, and an entry `tokens/fonts.css` cannot satisfy is a `font-preload-config` error.
809
- ADS does not cover page metadata, `noindex`, sitemaps or hosting; run Lighthouse on a production
810
- build with real URLs.
811
-
812
- **Themes and brands.** Themed tokens are per-theme halves (`--x-light`, `--x-dark`) on
813
- `:root`; brands set their own halves on `[data-brand]`. `ads assets` generates
814
- `themes.generated.css` and `.ts`. Missing or conflicting halves, empty themes or brands,
815
- stale generated files, `light-dark()` and `[data-theme]`/`[data-brand]` ancestor selectors
816
- in components are errors; see [Tokens, grid, icons and accessibility](#tokens-grid-icons-and-accessibility).
817
-
818
- **Tokens.** Ownership, naming, the 2 px spacing rhythm (`token-rhythm`), missing names and
819
- scenario references are errors; equal values in different roles are a
820
- `token-overlap-review` item.
821
-
822
- **Architecture.** Data, UX and Skin ownership, project structure, unit and paint contracts,
823
- and binding and variable ownership are errors; Linaria atomic composition risks are
824
- `atomic-composition-review` items. See [Generic architecture guards](#generic-architecture-guards).
825
-
826
- **Behavior.** A registered guarantee needs current passing execution evidence. `ads verify`
827
- runs the registered checks against current source (`--unit` and `--check` select);
828
- `ads validate` runs every one its change set reaches, draft acceptance the draft
829
- owners' own ones unless `acceptance.behavior` is `false`.
898
+ | `framework` | The UI framework that the design system is written for and that previews mount with (`react` or `preact`), optionally pinned as `react@<version>` |
899
+ | `dsDir` | The design-system folder |
900
+ | `assets.generatedPaths` | Project-relative folders that hold generated output, never source. They are not analysis inputs, and an import from one is a `source-unavailable` error |
901
+ | `assets.fontBudgetKb` | The largest font file that a `font()` declaration may list, in KiB rounded up (default 150). Above it: `font-budget` |
902
+ | `acceptance` | Draft acceptance: extra project scripts, and whether the owners' behavior tests and render audit run |
903
+ | `validation` | `ads validate`: scripts run after `acceptance.scripts`, and extra project files that count as validation inputs |
904
+ | `resources.memoryLimitMb` | An optional memory budget for ADS's managed processes |
905
+ | `cache` | Bounds of the persisted extraction cache ([Cache bounds](#cache-bounds)) |
906
+ | `compile` | The emitted output folder, and emit after acceptance ([Emitting the design system](#emitting-the-design-system)) |
907
+ | `mcp` | Showcase title, check and preview timeouts, audit concurrency, behavior profiles, capture browser and result retention |
908
+
909
+ An unknown field, at the top level or in a section, fails to load; ADS does not
910
+ silently weaken checks. Paths stay within the receiving project. A subfolder
911
+ with its own `ds.config.json` is a separate project: check, validation, audits,
912
+ previews and watches stop there and run in it on their own.
913
+
914
+ ADS reads only the design-system project: the `dsDir` tree, `ds.config.json`,
915
+ package manifests and lockfiles with their dependency-resolution configuration,
916
+ the TypeScript configuration chain, the entry files of configured package
917
+ scripts and their imports, notices and `validation.inputs`. ADS does not read or
918
+ check application source, public directories, the root `index.html` or tests
919
+ outside `dsDir`. An edit to them never makes validation, preview or acceptance
920
+ evidence stale. A policy about how the application uses the design system
921
+ belongs to the application's own tooling.
922
+
923
+ ### Cache bounds
924
+
925
+ `cache` bounds ADS's persisted extraction cache in `.ds/cache/extraction/`
926
+ (see [the caching guide](CACHING.md#persisted-extraction-cache)).
927
+ Both fields are optional:
830
928
 
831
- ## Showcase
929
+ ```json
930
+ { "cache": { "extractionMaxMiB": 64, "extractionMaxEntries": 8192 } }
931
+ ```
932
+
933
+ | Field | Default | Range | Bounds |
934
+ | --- | --- | --- | --- |
935
+ | `extractionMaxMiB` | 64 | integer 1–65536 | Disk space of all entries, in MiB |
936
+ | `extractionMaxEntries` | 8192 | integer 128–1000000 | Number of entries |
937
+
938
+ The bound limits disk space only. A lookup costs the same at any size, and
939
+ pruning runs when ADS is idle or about to exit, not during a check. A smaller
940
+ cap extracts more again after restarts. Values outside the ranges fail to load.
941
+ `ADS_CACHE=off` disables the disk layer whatever the bound.
942
+
943
+ ### Design system source
944
+
945
+ A design system authors recipe owners (`@reqvire-org/ads/recipe`), role token
946
+ sheets (`tokens/**/*.ads.css`), profiles (`profiles/**/*.ads.ts`), asset
947
+ declarations beside their drawings (`assets/<group>/*.ads.ts` and `*.svg`) and
948
+ `foundation.ads.ts`. The public barrel `index.ts` is written by hand and names
949
+ each public owner (`export *` is rejected). The installed `@reqvire-org/ads`
950
+ package types the macro imports. An `env.d.ts` at the design-system root is
951
+ included when present, but is not required. Source in any other form fails.
952
+
953
+ This section describes what `ads check` enforces, by area. `ads check`, MCP
954
+ checks, previews, emission and draft acceptance use the same findings.
955
+ [The contract](ADS.md#checks) lists the rules of each area,
956
+ [the rule reference](RULES.md) gives the statement and repair of every rule, and
957
+ [the authoring language](LANGUAGE.md) describes the constructs.
958
+
959
+ #### Structure, themes and brands
960
+
961
+ - `project-structure`: `dsDir`, `index.ts` and `foundation.ads.ts` are required.
962
+ - `import-leaves-design-system`: an import leaves the design-system folder.
963
+ - `source-unavailable`: an import names a file that is not an analysis input,
964
+ such as a folder in `assets.generatedPaths` or the emitted output.
965
+ - `source/framework-mismatch` (`owner-analysis`, at the import): a React package
966
+ (`react`, `react-dom`, their subpaths, type imports included) in a Preact
967
+ project, or a Preact package (`preact`, `@preact/*`) in a React project.
968
+
969
+ ADS reads the themes and brands from `foundation({ ..., themes, brands })`, in
970
+ declared order. The first theme and brand are the defaults: the `:root` values
971
+ of the token sheets. The render audit, capture, the showcase and `ads_status`
972
+ read the same declaration. Two optional fields are `true` or omitted:
973
+
974
+ - `followSystemTheme: true`: a root without `data-theme` follows the OS colour
975
+ scheme. It takes the first light-scheme theme for a light preference and the
976
+ first dark-scheme theme for a dark one, so the design system needs one of
977
+ each. An explicit `data-theme` always wins, and brands keep their own values.
978
+ Emission copies the token rules of each such theme for
979
+ `:root:not([data-theme])` under `@media (prefers-color-scheme: …)`, directly
980
+ after the original, so they cascade as the attribute does.
981
+ - `sections: true`: `data-theme` or `data-brand` on any element switches its
982
+ subtree ([Colours that depend on their surroundings](#colours-that-depend-on-their-surroundings)).
983
+ Without it, only the attributes of `<html>` select a context.
984
+
985
+ An invalid list or field is an `owner-analysis` finding at the field
986
+ (`contexts/list-invalid`). A theme or brand that a token sheet or asset variant
987
+ names without a declaration is one finding per reference
988
+ (`contexts/theme-undeclared`, `contexts/brand-undeclared`). A declared
989
+ non-default theme or brand that nothing defines is an error at its entry
990
+ (`theme-undefined`, `brand-undefined`).
991
+
992
+ #### Owner analysis
993
+
994
+ Owner analysis reads the design inputs and discovers every owner that the barrel
995
+ reaches. It type-checks the owners with the scenarios and the fixtures they
996
+ import. It then analyzes, lowers and compiles every reachable construction, and
997
+ resolves each owner's token CSS. Each failure is a blocking `owner-analysis`
998
+ finding with a `code` that names the exact error (`<domain>/<kind>`, for example
999
+ `spec/value-invalid` or `token-css/token-missing`), its `group`, a `repair` hint
1000
+ and a position.
1001
+
1002
+ - ADS analyzes every owner. One check thus reports the first source failure of
1003
+ each failing owner (in discovery order), every TypeScript diagnostic, each
1004
+ failing helper module, the first compile failure of the analyzed owners and
1005
+ every token CSS failure.
1006
+ - Invalid design inputs, owner discovery failures (a cycle, `export *`) and
1007
+ import-graph failures stop analysis of the revision.
1008
+ - An owner whose grid aligns the rows of a failed owner (`alignRows`) cannot be
1009
+ analyzed until that owner is fixed. ADS reports it as a nonblocking
1010
+ `owner-analysis-blocked` info advisory at the aligned component, with the
1011
+ failed owner in `blockedBy`, never as an error that repeats the cause. After
1012
+ the fix, the blocked owner reports its own problems.
1013
+ - What analysis cannot prove is a nonblocking `owner-analysis-review` item with
1014
+ a `review/<kind>` code: a scroll container that nothing focuses, a summary
1015
+ without its marker or artwork, truncated or clamped text without a `title`.
1016
+
1017
+ Three codes concern profile and recipe declarations:
1018
+
1019
+ - `foundation/profile-field-unknown`, at the field: a profile field that its
1020
+ kind does not have (a misspelt composite slot such as `frameProfle`, a text
1021
+ field on a spacing profile, an unknown field in a choice option or spatial
1022
+ clause). The vocabulary is the kind's token and policy fields and the
1023
+ composite slots.
1024
+ - `foundation/profile-argument-default`, at the selection: a slot reference
1025
+ selects the default option of the referenced profile.
1026
+ - `source/recipe-redundant`, at the declaration: a recipe restates what its
1027
+ selected profile supplies. This is a default choice selection, a binding equal
1028
+ to its composite slot (by name, an equivalent alias, `{ slot: "text" }` on a
1029
+ text part, a binding recipe's `visual`, a paint transition's `motion`), the
1030
+ default content gap, or a `when` state that selects the base surface. It is
1031
+ redundant only when it is redundant in every reachable choice. A state surface
1032
+ may overlay part of its base (a colour-only error state).
1033
+
1034
+ #### Tokens
1035
+
1036
+ Shared values obey three contracts: the value shape of each role, the roles that
1037
+ each profile field reads, and the permitted token derivations
1038
+ ([token roles](TOKEN-ROLES.md)). ADS checks the tokens in every context that the
1039
+ sheets declare: the base, each theme, each brand, each brand under each theme,
1040
+ and the overrides of each `@media`/`@supports` condition. It first resolves
1041
+ `var()` references through the values of that context. Each finding is at the
1042
+ declaration, unless stated.
1043
+
1044
+ - `token-role-duplicate` (error): a token has one role, the file name of its
1045
+ sheet. Its `:root` default and every theme or brand override are in that
1046
+ sheet.
1047
+ - `token-selector-invalid` (error): token rules are `:root`,
1048
+ `:root[data-theme="…"]`, `:root[data-brand="…"]` or both, directly or inside
1049
+ `@media`, `@supports` or `@layer`. Another selector (`.card`, a selector list,
1050
+ `[data-theme]` without `:root`) or at-rule (`@container`) forms no context. An
1051
+ override of a token with no `:root` default is allowed; each reference to such
1052
+ a token needs a `var()` fallback (`token-css/token-missing`).
1053
+ - `review/context-section-inactive` (review): without `sections: true`, a
1054
+ `data-theme` or `data-brand` attribute on design-system markup switches
1055
+ nothing.
1056
+ - `token-sheet-property` (error): a token sheet declares custom properties only.
1057
+ An ordinary property (`:root { color: red }`) is not read as a token.
1058
+ - `token-type` (error): every token is a value of the shape of its role
1059
+ (`paint` a colour, `spacing` a nonnegative length, `duration` a nonnegative
1060
+ time, `easing` a timing function). A `calc()` that mixes units is accepted
1061
+ where the role has no sign or range bound.
1062
+ - `token-type-unresolved` (review, never a silent pass): a mixed-unit `calc()`
1063
+ where the role has a bound, or a value ADS cannot read statically (an unknown
1064
+ function, `currentColor`, an undefined reference).
1065
+ - `token-provenance` (error): a forbidden authored edge or composite position,
1066
+ including in unused tokens and fallbacks. Repair the named reference with a
1067
+ permitted role or shared literal
1068
+ ([provenance](TOKEN-ROLES.md#provenance-and-permitted-derivation)).
1069
+ - `token-overlap-review` (review, at the second token): tokens of one role that
1070
+ are identical in every context are possibly one decision named twice. Pure
1071
+ aliases (`var(--space-lg)` in every context) are not compared.
1072
+ - `a11y-text-resize` (error): a `font-size` token, and a `line-height` token
1073
+ that is a length, resolves to `rem` or `em` (or a `calc()`, `min()`, `max()`
1074
+ or `clamp()` that contains them) in every context (WCAG 2.2 1.4.4). A px line
1075
+ height stays fixed while resized text grows, so lines overlap; a unitless
1076
+ multiplier already scales. See also
1077
+ [Text scaling in the application](#text-scaling-in-the-application).
1078
+
1079
+ **Spatial profiles.**
1080
+
1081
+ - `spatial-profile-invalid` (error, at the profile's declaration): every
1082
+ declared spatial profile, selected or not, reads through the grid algebra
1083
+ (units, scale, ratios, maximum width, breakpoints, margins and gutters), as
1084
+ grid lowering and the preview facts read it, in the base context and in every
1085
+ context that defines a reached token differently. Profiles that compose one
1086
+ definition (`with: ["page-grid"]`) and have the same failure give one finding,
1087
+ at the profile that declares the units. An owner that selects a broken profile
1088
+ also reports its own failure at the construction.
1089
+ - `spatial-context-unsupported` (error, at the profile's declaration): a
1090
+ breakpoint width, column count or named condition bound is compiled into media
1091
+ queries and track lists, so no context can give its token another value.
1092
+ Margins, gutters, the maximum width and fixed tracks are read live and can
1093
+ differ by context, if every grid still holds there
1094
+ (`construction/grid-context-invalid`, at the grid construction).
1095
+
1096
+ #### Contrast
1097
+
1098
+ Each text pair belongs to one of three checks. The minimum is 4.5:1 (WCAG 2.2
1099
+ 1.4.3), or 3:1 where the text is provably large: its text profile, own or
1100
+ inherited, resolves to at least 24px, or 18.66px at weight 700, in that context.
1101
+ Inactive elements and states (`:disabled`, `[aria-disabled="true"]`, not a state
1102
+ only excluded with `:not()`) have no minimum. The same is true for placeholder
1103
+ contrast.
1104
+
1105
+ The minimum follows what the colour paints:
1106
+
1107
+ | The colour paints | Minimum | How ADS knows |
1108
+ | --- | --- | --- |
1109
+ | Text | 4.5:1 | the default |
1110
+ | Large text | 3:1 | the element's text profile resolves to 24px, or 18.66px at weight 700 |
1111
+ | Artwork that carries meaning | 3:1 (WCAG 1.4.11) | a visual part, or a control that renders no text |
1112
+ | Decorative artwork | none | a visual part whose element is `aria-hidden` |
1113
+
1114
+ **`surface-contrast`** (error, at the profile's declaration): a surface profile
1115
+ that sets both `color` and `background` reaches 4.5:1 in every context. Its
1116
+ `background-image` gradient stops count as backgrounds. A profile does not state
1117
+ what its colour paints, so 4.5:1 is its default; a pair below it is accepted
1118
+ when it is enough for every place the design system uses the profile (the
1119
+ table above). A quiet icon colour at 3:1 is its own surface profile, selected
1120
+ only by visual parts or text-less controls. These keep 4.5:1: a profile
1121
+ nothing uses, one a composite slot supplies, the document surface, and one the
1122
+ recipe also names for a pseudo-element, a prose element, a backdrop or an
1123
+ entrance. Nothing is released while an owner fails, because its uses are not
1124
+ known.
1125
+
1126
+ - A partly transparent background, an `opacity` below 1 or an image that is not
1127
+ a gradient of known colours is a `surface-contrast-unresolved` review item.
1128
+ - A fully transparent background (a ghost button's `transparent`) is the note
1129
+ `surface-contrast-placed` (info): the profile paints nothing, so its text
1130
+ contrast is decided where it is placed, by the cross-owner check and, for
1131
+ what scenarios show, the render audit.
1132
+ - A surface that paints a disabled control declares `state: "inactive"` among
1133
+ its fields and is not checked. A construction can select it only under an
1134
+ inactive owner state; anywhere else is `construction/inactive-surface-active`.
1135
+
1136
+ **State contrast** (owner analysis): an owner's `when` states pair the colour of
1137
+ one profile with the background of another, such as a colour-only error state
1138
+ over the base fill, or a hover fill under the base colour. Two states that
1139
+ cannot hold on one root together are not paired: two values of one attribute
1140
+ (`[aria-pressed="false"]:hover` and `[aria-pressed="true"]`), a state and its
1141
+ `:not()`, `:disabled` and `:enabled`.
1142
+ `construction/state-contrast-insufficient` blocks the owner;
1143
+ `review/state-contrast-unresolved` is a review item.
1144
+
1145
+ **`component-contrast`** (error, at the surface that chose the colour of the
1146
+ text): text meets the minimum against the backdrop it is rendered on, across
1147
+ elements and owners, without declared pairs.
1148
+ [The contract](ADS.md#composed-text-contrast) defines the rule and its
1149
+ unresolved cases, and [the architecture](ARCHITECTURE.md#composed-contrast)
1150
+ explains the join.
1151
+
1152
+ - ADS follows each text position outward through the elements of its owner, into
1153
+ the slot of every component it is passed to and back out, and up through every
1154
+ placement of its owner. The colour is the nearest one that a surface sets. The
1155
+ backdrop is the nearest opaque background, with translucent backgrounds and
1156
+ gradients of known colours composited over it.
1157
+ - Text sizes inherit across owners: an owner without a text profile takes its
1158
+ renderer's, else the document's. A placement's literal props select the
1159
+ choices of the child that it renders. Hidden elements and absent text
1160
+ (`{null}`, an empty or missing prop) add nothing.
1161
+ - Applications also place a component that the public barrel exports, on the
1162
+ document surface that `foundation({ surface })` declares. ADS thus checks its
1163
+ text there also. An application's own coloured container is outside this
1164
+ check.
1165
+ - An element that renders `data-theme` or `data-brand` is painted with the
1166
+ document surface. With `sections: true`, its subtree is checked in the named
1167
+ context only; without sections, in the page's contexts.
1168
+ - The finding lists the pair's `tokens`, every failing context that differs from
1169
+ the one it extends (`contexts`: theme, brand, condition, ratio, minimum) and,
1170
+ in `related`, the backdrop, the placements and the slots between them.
1171
+ - What ADS cannot prove is a `component-contrast-unresolved` review item at the
1172
+ placement or element, never a pass. Examples are a wrapper component that ADS
1173
+ does not analyze, a same-file component that does not render its `children`, a
1174
+ component placed by a plain module, a user-agent colour, an out-of-flow
1175
+ element without its own backdrop, `opacity` below 1, an unknown image, with
1176
+ sections a `data-theme`/`data-brand` that ADS cannot name, an expression that
1177
+ may be text, and markup rendered outside the markup of its component.
1178
+
1179
+ #### Accessibility in owners
1180
+
1181
+ ADS checks owners and their constructions against WCAG 2.2 AA. Each finding is
1182
+ an owner-analysis finding with its fine-grained code, reported under its
1183
+ `a11y-*` rule.
1184
+
1185
+ - `a11y-focus` (error, at the focus profile; WCAG 2.4.7, 1.4.11): the `width` of
1186
+ every focus profile is at least 2 CSS px in every context, and the document's
1187
+ default indicator has 3:1 against the background of the document surface. What
1188
+ cannot be evaluated is `a11y-focus-unresolved` (review).
1189
+ - `a11y-target-size` (error): every control construction and every
1190
+ `frame: "control"` part is at least 24 × 24 CSS px in every context, its hit
1191
+ area included (`construction/target-size-below-minimum`, naming the element,
1192
+ its size, the context and the deficit).
1193
+ - ADS computes the size from the lowered box, with relative lengths at the
1194
+ 16px reference root: min block = max(`min-block-size`, content + 2 × (inset +
1195
+ border)); inline = max(the frame's `min-inline-size`, 2 × (`padding-inline` +
1196
+ border) + content).
1197
+ - Neighbouring hit areas in a stack or inline arrangement must not overlap
1198
+ across their gap (`construction/target-area-overlap`).
1199
+ - A value that ADS cannot evaluate, or an inline extent that reaches 24px only
1200
+ with the width of its label (text is data), is `a11y-target-size-unresolved`
1201
+ (review).
1202
+ - A frame's `min-target-inline-size` / `min-target-block-size` (role
1203
+ `target-min-size`) lower to a hit area that the element owns: a centred,
1204
+ absolutely positioned `::after` that takes no layout space. A top-layer root
1205
+ cannot have one.
1206
+ - `a11y-icon-label` (error, at the control's element): in every reachable choice
1207
+ where a control renders no text part, its root has a non-empty `aria-label`,
1208
+ `aria-labelledby` or `title` (`source/control-name-missing`). Conditions are
1209
+ evaluated in the choice. Application text (a label prop) counts as a name, as
1210
+ it counts as content in a text part.
1211
+ - `source/pressed-state-mismatch` (`owner-analysis` error, at the choice's
1212
+ binding recipe; WCAG 4.1.2): a toggle's `aria-pressed` agrees with its
1213
+ drawing. In every reachable choice where the root of a construction sets
1214
+ `aria-pressed` and its artwork declares a `selected` state, a pressed choice
1215
+ draws `selected` and an unpressed one another state. An `aria-pressed` whose
1216
+ type is not finite (`any`, for example) is a `review/pressed-state-unresolved`
1217
+ item.
1218
+ - `a11y-image-alt` (error, at the image): every `<img>` that an owner renders
1219
+ has `alt`: artwork (`source/intrinsic-alt-missing`), content media and any
1220
+ other image (`source/image-alt-missing`). `alt=""` marks a decorative one.
1221
+ - `a11y-keyboard` (review, at the element): `onClick` on a non-interactive
1222
+ element (div, span, li, img, …) without a role and `tabIndex`
1223
+ (`review/click-without-keyboard`). Composite-widget items (option, tab,
1224
+ menuitem, row, gridcell, …) and backdrops whose handler reads `currentTarget`
1225
+ are exempt.
1226
+ - `a11y-non-text-contrast` (error): the check applies where a construction knows
1227
+ the surface that a control part sits on (an enclosing element that paints an
1228
+ opaque background). A control part is a `frame: "control"` part, or
1229
+ `frame: { kind: "control", rules }` with one-sided rules such as a soft
1230
+ field's underline.
1231
+ - The border colour of the part (base and each owner state) reaches 3:1, when
1232
+ the part's own background does not bound it at 3:1.
1233
+ - The focus outline colour reaches 3:1, on the enclosing background outside
1234
+ the box and on the part's own background inside it.
1235
+ - The error is `construction/non-text-contrast-insufficient`. Unprovable pairs
1236
+ are `review/non-text-contrast-unresolved`.
1237
+ - A part can carry a human-approved `accessibility` declaration. It turns the
1238
+ border error into the review item `review/boundary-identified-otherwise` and
1239
+ needs a person's approval at acceptance (see the accessibility reference of
1240
+ the skill).
1241
+ - A control's artwork paints with its text colour, which `surface-contrast`
1242
+ holds to 4.5:1, or to 3:1 where the control renders no text. The surroundings of a control root are its parent's
1243
+ composition, which the render audit measures.
1244
+
1245
+ #### Assets, fonts and the application icon
1246
+
1247
+ **Assets** ([assets](ASSETS.md#icons-and-glyph-sets)).
1248
+
1249
+ - Asset names, asset aliases and glyph-set names are one namespace
1250
+ (`assets/name-duplicate`, at the repeated field). An alias resolves to its
1251
+ asset wherever an asset name is accepted.
1252
+ - The members of a glyph set are declared, distinct foreground assets on one
1253
+ grid, and its aliases name members (`assets/set-*`, at the member or alias).
1254
+ - An owner that takes an icon takes a glyph reference
1255
+ (`Glyph<"close" | "search">`, made with `glyph()`). An icon chosen from data
1256
+ is looked up in a declared glyph set by a name typed as the names of the set.
1257
+ The constructions do not depend on the glyph (`source/glyph-*` codes).
1258
+ - `asset-unused` (error, at the name in the declaration): an asset that no owner
1259
+ binds, no bound set lists and no `glyph()` references, or a glyph set that no
1260
+ owner binds. ADS reports it only after every owner is analyzed.
1261
+
1262
+ **Fonts.** Declare a font family once, with `font()`, in an `assets/**/*.ads.ts`
1263
+ file beside its files. Keep its licence there also:
1264
+
1265
+ ```ts
1266
+ import { font } from "@reqvire-org/ads/font" with { type: "macro" };
1267
+
1268
+ export default font({
1269
+ family: "Inter", // the CSS family name, unique in the design system
1270
+ title: "Inter",
1271
+ description: "UI text face",
1272
+ license: "SIL OFL 1.1 (assets/fonts/inter/OFL.txt)",
1273
+ display: "swap", // swap | fallback | optional | block
1274
+ faces: [
1275
+ { source: "./Inter-Variable.woff2", weight: [100, 900] },
1276
+ { source: "./Inter-Italic.woff2", weight: [100, 900], style: "italic" },
1277
+ ],
1278
+ preload: [{ weight: 600 }], // optional: faces to preload beyond the document text's
1279
+ fallback: "Arial", // optional: the system font drawn while Inter loads, matched to it
1280
+ });
1281
+ ```
1282
+
1283
+ A font is used where a font-family role token names it first
1284
+ (`--font-ui: "Inter", system-ui, sans-serif`), in any theme, brand or condition.
1285
+ The example design system keeps system fonts. A face's file is a design input. A missing file,
1286
+ a source outside the declaration's folder, a file whose bytes are not its
1287
+ format, a repeated family (`fonts/family-duplicate`) or overlapping faces reject
1288
+ the declaration.
1289
+
1290
+ - `font-weight-missing` (error, at the profile): a text profile draws a declared
1291
+ font at a weight that no upright face covers. The weight is its font-weight
1292
+ token in some context; the document text profile without one draws at 400.
1293
+ - `font-budget` (error): a file is above `assets.fontBudgetKb`.
1294
+ - `font-unused` (review): a family that no font-family token names first, or a
1295
+ face of a used family that no profile selects. The 400, 700 and italic faces
1296
+ count as used, because browsers draw plain, bold and emphasized text with
1297
+ them.
1298
+ - `font-format` (review): a file is not WOFF2.
1299
+ - `font-display` (review): display `block` (invisible text while loading) or
1300
+ `optional` (one page can mix the face and the fallback).
1301
+ - `font-fallback` (error, at the token): the family declares a `fallback`, and a
1302
+ font-family token names the family first without `"<family> Fallback"` right
1303
+ after it.
1304
+
1305
+ **A fallback that does not move the page.** With `display: "swap"`, text is
1306
+ drawn in a system font until the family loads. The two fonts have different
1307
+ widths and line heights, so lines rewrap and the page moves when the family
1308
+ arrives. `fallback` makes ADS read each face file's own measurements and emit a
1309
+ second face, `"<family> Fallback"`, which is the system font sized and spaced
1310
+ like the family. For Karla Regular with `fallback: "Arial"` it emits:
1311
+
1312
+ ```css
1313
+ @font-face {
1314
+ font-family: "Karla Fallback";
1315
+ src: local("Arial");
1316
+ font-weight: 400;
1317
+ font-style: normal;
1318
+ size-adjust: 102.29%; /* Karla's average width over Arial's */
1319
+ ascent-override: 89.64%; /* Karla's own line metrics */
1320
+ descent-override: 24.63%;
1321
+ line-gap-override: 0%;
1322
+ }
1323
+ ```
1324
+
1325
+ Name it right after the family in the font-family token:
1326
+ `--font-ui: "Inter", "Inter Fallback", system-ui, sans-serif`. There is one
1327
+ fallback face per declared face, for the same weights and style; a face from
1328
+ weight 600 falls back to the system font's bold, an italic face to its italic.
1329
+
1330
+ - `fallback` is `"Arial"`, `"Times New Roman"` or `"Courier New"`: fonts every
1331
+ desktop platform has or substitutes, whose widths ADS knows. Choose the one
1332
+ nearest the family: sans-serif, serif or monospaced.
1333
+ - For another system font, state the size yourself:
1334
+ `fallback: { font: "Georgia", sizeAdjust: 104 }` (a percentage; ADS still
1335
+ takes the line metrics from the family's files).
1336
+ - The width is the average over English prose (letters, spaces, capitals and
1337
+ punctuation by their frequency), so text in the two fonts differs by a
1338
+ fraction of a percent in ordinary copy and more in unusual text such as
1339
+ all-capital headings. A face without those characters needs the stated form. A file ADS cannot measure (a font collection, a damaged file)
1340
+ rejects the declaration.
1341
+ - Where the system font is absent, the browser skips the fallback face and uses
1342
+ the next family in the token, as without a fallback.
1343
+
1344
+ **Application icon.** `foundation({ appIcon })` names a declared asset as the
1345
+ icon that browsers, launchers and app stores show
1346
+ ([the icon role](ASSETS.md#the-application-icon-a-role-not-a-kind)). `ads emit`
1347
+ renders it ([The output folder](#the-output-folder)). Its drawings count as used
1348
+ (no `asset-unused`).
1349
+
1350
+ ```ts
1351
+ export default foundation({
1352
+ // …tokens, profiles, themes…
1353
+ appIcon: {
1354
+ asset: "app-icon", // a declared asset() name or alias
1355
+ background: "--brand-surface", // optional: a paint-role token behind padded renders
1356
+ maskable: { padding: 0.1 }, // optional: or { asset: "app-icon-maskable" }
1357
+ exports: [ // optional: further images, inside the output folder
1358
+ { file: "icons/128x128.png", size: 128 },
1359
+ { file: "social/banner.png", asset: "banner", width: 1200, height: 630, background: "--brand-surface" },
1360
+ { file: "icons/icon.ico", sizes: [16, 32, 48, 256] },
1361
+ { file: "icons/icon.icns", sizes: [16, 32, 64, 128, 256, 512, 1024] },
1362
+ { file: "icons/app.svg" },
1363
+ ],
1364
+ },
1365
+ });
1366
+ ```
1367
+
1368
+ - `app-icon-asset` (error, at `appIcon.asset` or `appIcon.background`): the
1369
+ asset is undeclared, is not `paint: "intrinsic"` (a browser tab or launcher
1370
+ cannot read CSS variables), has optical-size variants, or has a viewBox that
1371
+ is not square. Or a background token is not a paint-role token, or does not
1372
+ resolve to an opaque colour in the default theme and brand. With variants, ADS
1373
+ renders the drawing of the default theme.
1374
+ - `app-icon-export` (error, at the entry): a file outside the output folder
1375
+ (`..`, absolute or hidden segments), or at a path that ADS or another export
1376
+ writes (the platform icons, `fonts/`); a format other than `.svg`, `.png`,
1377
+ `.ico` and `.icns`; a size outside 16–2048 px; an export asset that cannot be
1378
+ rendered; or a sizing that the format does not take. `.png` takes `size`, or
1379
+ `width` and `height`; `.ico` takes `sizes` up to 256; `.icns` takes `sizes`
1380
+ 16, 32, 64, 128, 256, 512 and 1024; an `.svg` copy takes none.
1381
+ - `app-icon-maskable` (error, at `appIcon.maskable`): a padded master (`padding`
1382
+ 0–0.4 of the width on each side) needs `background`, and its drawing stays
1383
+ inside the safe zone, the central circle of 80% of the width (W3C Web App
1384
+ Manifest). A separate maskable drawing is square and opaque to its edges. ADS
1385
+ reads both from the drawing rendered at 256 px.
1386
+
1387
+ #### Styling ownership
1388
+
1389
+ Styling exists only in owners, and owners style only through their recipes. Each
1390
+ finding is an `owner-analysis` error at its position.
1391
+
1392
+ - `source/css-in-js-import`: an import of a CSS-in-JS package in any
1393
+ design-system file, including owners, scenarios and fixtures. ADS keeps the
1394
+ known packages as one closed list, a backstop for libraries that hide a class
1395
+ name behind a component or a call.
1396
+ - A production module that authors no recipe renders only design-system owners.
1397
+ The errors are intrinsic markup (`source/plain-markup`); `className`, `class`,
1398
+ `style` or `css` on a rendered element (`source/plain-style-attribute`);
1399
+ styling written through the DOM (`source/plain-style-write`); and stylesheet
1400
+ imports (`source/plain-stylesheet-import`). To repair them, move the styling
1401
+ into a recipe in an owner. Then render that owner from the plain module, or
1402
+ make the module an owner by authoring the recipe of its markup.
1403
+ - A scenario styles nothing. It can render fixture markup around owners. Styling
1404
+ props (on owners too), DOM styling writes and stylesheet imports are the same
1405
+ errors, and a `<style>` element is `source/style-element`.
1406
+ - An owner imports no stylesheet (`source/owner-stylesheet-import`, at the
1407
+ import, whether or not the file exists).
1408
+ - An owner writes no styling through the DOM (`source/owner-style-write`).
1409
+ Geometry that it measures at runtime goes through the declared `measured`
1410
+ values of its recipe ([Runtime values](#runtime-values-and-interaction)).
1411
+ - A production module's import that points into a development location
1412
+ (mock media such as `../mocks/…/media/photo.svg`, a fixture) is
1413
+ `source/development-import`. `source/module-unresolved` stays for paths that
1414
+ are really unresolved.
1415
+ - A development file's import of an asset that the preview serves
1416
+ (`./media/mark.svg`, `?raw`, `?url`, `?worker`) needs no module declaration.
1417
+
1418
+ `source/framework-mismatch` is in
1419
+ [Structure, themes and brands](#structure-themes-and-brands).
1420
+
1421
+ **Mocks.** `mock-ownership` (codes `mock/<kind>`) applies
1422
+ to every script under `mocks/` and each helper it imports. A mock is held to
1423
+ what a source application is held to. The script renders only what it imports
1424
+ from `@ds` with explicit props: a pattern, and components only inside a
1425
+ pattern, as its child or in a slot prop (`component-outside-pattern`). It may import
1426
+ any framework hook and declared library. It reaches the design system only
1427
+ through `@ds`: a relative import leads to captured helpers inside `mocks/` or
1428
+ its own `media/` images. Native or local markup,
1429
+ `style`/`className`/`css`/`dangerouslySetInnerHTML`, spreads, re-exports,
1430
+ imperative styles, dynamic code and design hidden in strings are errors at their
1431
+ position.
1432
+
1433
+ ##### The same check for a source package
1434
+
1435
+ The part of the mock rule that concerns design use is released as its own npm
1436
+ package, `@reqvire-org/ads-guard`. An application installs it and confirms that
1437
+ its own source does no design and uses the design system only. It is optional.
1438
+ Its purpose is to close the loop for work in the application, where ADS does
1439
+ not look: without it, a person or an agent can add an element or a class in
1440
+ application code and nothing reports it.
1441
+
1442
+ It runs on Node or Bun and needs no ADS in the application.
1443
+
1444
+ ```sh
1445
+ npm install --save-dev @reqvire-org/ads-guard # or: bun add --dev @reqvire-org/ads-guard
1446
+ npx ads-guard # or: bunx ads-guard
1447
+ ```
832
1448
 
833
- ADS ships a minimal HTTP browser shell with isolated previews. `ads mcp` serves the
834
- website alongside its stdio connection; `ads showcase` starts the same runtime
835
- for browser-only use. Run commands from the project root. Open the printed URL,
836
- or use `ads_status.showcaseUrl` from an already connected runtime: it is the URL
837
- and port of the showcase that server is running. An available loopback port is
838
- selected by default; `--port 4185` selects a fixed port.
839
- `ads mcp --no-showcase` keeps a headless stdio server.
840
-
841
- The browser reads catalogues and opens previews through scoped HTTP services
842
- backed by the same engine as MCP. SSE events refresh menus and build state;
843
- the selected scenario updates inside its persistent iframe.
844
- Compatible React/Preact edits retain component state, typed values and focus.
845
- Edits that change hook signatures or module boundaries can reset state; failed
846
- checks restore verified output. Errors identify
847
- stale retained output. Its neutral header and left pane align and collapse
848
- together. Themes flow through the preview host context. No project catalogue pages
849
- or direct component imports are used by this client.
850
-
851
- The project owns implementations, colocated scenarios/fixtures, foundation
852
- CSS and a framework mount adapter. ADS runs its preview compiler on Bun, using
853
- incremental modules for watched previews and complete bundles for verification.
854
- The starter and init provide the mount under `design-system/showcase/mcp/`.
855
- Configure the framework; ADS compiles every scenario into one shared preview graph:
1449
+ Where to run it:
1450
+
1451
+ | Stage | How |
1452
+ | --- | --- |
1453
+ | Lint | `"lint": "eslint . && ads-guard"` in the application's `package.json` |
1454
+ | Test | `"pretest": "ads-guard"`, so tests do not start on source that does design |
1455
+ | Build | `"prebuild": "ads-guard"`, when a build must never ship such source |
1456
+ | CI | A step `npx ads-guard` (or `bunx ads-guard`); it exits 1 on findings |
1457
+ | An agent's own loop | Tell the agent to run `npx ads-guard` after it edits application code, and to fix findings by using or adding a pattern, never by excluding the file |
1458
+
1459
+ `npx ads-guard --json` prints the report for tools.
1460
+
1461
+ `ads-guard.config.json`, in the application's root:
856
1462
 
857
1463
  ```json
858
1464
  {
859
- "framework": "react@19.1.0",
860
- "behaviorLibraries": ["tabbable@6.2.0"],
861
- "mcp": {
862
- "showcaseTitle": "My Project Design System"
863
- }
1465
+ "designSystem": "@acme/design",
1466
+ "include": ["src"],
1467
+ "exclude": ["src/generated"],
1468
+ "allow": { "react": ["Suspense", "StrictMode"], "react-router": ["Outlet", "RouterProvider"] }
864
1469
  }
865
1470
  ```
866
1471
 
867
- Keep the saved `framework` (`react` or `preact`), JSX transform and mount adapter
868
- consistent. Pin the framework and every `behaviorLibraries` package to the exact
869
- installed version (`name@1.2.3`). ADS keys preview freshness and compiled previews
870
- by the files it owns: `ds.config.json`, the design-system folder and the declared
871
- public folders. It does not read the project's lockfiles, `tsconfig.json` or `src/`
872
- for this. The pins are how a dependency upgrade reaches previews: update the pin
873
- with the upgrade, and `ads check` reports a pin that no longer matches what is installed. The optional title defaults to the project package name followed by
874
- ` · Design System`. The browser shell stays the same for both frameworks. There is
875
- one managed compiler per runtime, shared by stdio and HTTP clients. It builds
876
- a shared multi-entry graph on first demand and after source changes; the App
877
- loads only the selected scenario's dependencies. TSX/Linaria compilation still
878
- happens automatically. Accepted configuration-unit mutations replace the managed
879
- compiler while keeping MCP connected. Configuration or dependency
880
- changes may require restarting the runtime; ordinary owner/fixture/style/asset edits do not.
881
- See [the compiler contract](MCP.md#one-client-command-managed-preview-builds) for revisions,
882
- diagnostics, invalidation and the shared resource graph.
883
-
884
- Colocate `<Owner>.ads.scenario.tsx` and `<Owner>.ads.fixture.ts` beside tokens and
885
- each component/pattern. Larger entries
886
- live under `composition/<Name>/`. A default zero-input mountable view imports the
887
- real public UI and a local fixture, and exports literal metadata:
1472
+ - `designSystem` is the specifier the application imports the design system
1473
+ by. The guard reads its public entry to learn which exports are patterns.
1474
+ When the specifier is an alias that Node cannot resolve, `entry` names the
1475
+ entry file.
1476
+ - `include` lists the source folders. `exclude` lists folders and files under
1477
+ them that are not checked. Every run reports what was excluded, and an entry
1478
+ that does not exist is an error, so the list cannot hide anything.
1479
+ - `allow` lists components of other packages that carry no design, one by one:
1480
+ a router's outlet, providers, the framework's own markers.
1481
+ - Tests and the design system's own files are never checked; the report counts
1482
+ them. Document metadata (`<title>`, `<meta>`, `<script>`, a `<link>` that is
1483
+ not a stylesheet) is accepted anywhere.
1484
+ - Exit code 0: the source uses the design system only. 1: findings, each with
1485
+ a file, position, code (`design-usage/<kind>`), message and repair. 2: the
1486
+ configuration is wrong.
1487
+
1488
+ The configuration belongs to the application, not to the design system: ADS
1489
+ reads only the design-system project, and one design system can serve
1490
+ applications on different frameworks.
1491
+
1492
+ **Libraries in an application.** What a library gives decides how it is used.
1493
+
1494
+ | The library gives | Examples | Use |
1495
+ | --- | --- | --- |
1496
+ | Functions and hooks | Image URL builders, a router's hooks, date utilities | Freely. They are behavior. |
1497
+ | Components that render nothing | `Suspense`, `Outlet`, providers | Listed in the guard's `allow`. |
1498
+ | Hooks that return props for an element | `react-aria` | In the design system: the owner spreads them on its own element (`behaviorLibraries`). |
1499
+ | Components with their own design | A styled library, a framework's image component | Not rendered. Take the library's function; the design system owns the element. |
1500
+
1501
+ - **Images.** The application asks the library for the URLs and passes them to
1502
+ the design system's image owner: with Next.js, `getImageProps` from
1503
+ `next/image` gives `src`, `srcSet` and `sizes` as data; Cloudinary and imgix
1504
+ build the same from a source and a width. The example design system's `Image` takes
1505
+ `source` and `responsive: { srcSet, sizes }`.
1506
+ - **Links.** The pattern renders `<a href>` and reports the click; the
1507
+ application navigates in the handler with its router.
1508
+
1509
+ #### Layout
1510
+
1511
+ **Grid containers.** A grid in container context (`context: "container"`)
1512
+ follows the nearest `ads-region` size container. An owned ancestor in the same
1513
+ owner must thus start one in every reachable choice: a region framed
1514
+ `frame: { container: "region" }`. Otherwise the tier rules of the grid never
1515
+ match, wherever the component is placed, and the grid is
1516
+ `source/grid-container-missing` at its construction. A container that a consumer
1517
+ renders around the component, or one inside a public component that the grid is
1518
+ passed to, is not evidence for this owner.
1519
+
1520
+ **Frames in grid cells.** A grid cell whose own construction declares a frame
1521
+ with a fixed inline size needs that width at the lower edge of every tier it is
1522
+ visible in. A fixed inline size is an `inline-size` that its `max-inline-size`
1523
+ does not cap to the region, or a `min-inline-size`.
1524
+
1525
+ - Where the grid algebra bounds the cell and the frame is wider, the cell is
1526
+ `source/frame-exceeds-region` at its construction. The finding names the tier,
1527
+ the condition and the context. The bound is the span of the cell less its
1528
+ gutter insets, in every context whose geometry differs.
1529
+ - Where the algebra cannot bound the cell (inherited tracks, or the placement
1530
+ outside a named condition at a tier that the condition can hold), or the size
1531
+ is not a length that ADS evaluates (an `em` of an unknown font size), it is
1532
+ the review item `review/frame-region-unresolved`, never a pass.
1533
+ - Frames deeper inside a cell are checked against the cell less the inline
1534
+ insets and fixed sizes of the owned elements between. A public component, or a
1535
+ list, figure, blockquote or fieldset in the way, is reviewed.
1536
+
1537
+ ##### The text keyline
1538
+
1539
+ In a grid, text should start on one vertical line. That line is the **keyline**:
1540
+ the start inset of the spatial profile's `wide` gutter, which a grid takes when
1541
+ it names no gutter (16px in the example design system).
1542
+
1543
+ A grid on another gutter mode starts its cells nearer the column line: `narrow`
1544
+ at the line itself, `condensed` half a border from it. Such grids are for
1545
+ frames that should sit flush, such as cards. The frame then insets its own
1546
+ content with its padding, and that padding decides where its text lands:
1547
+
1548
+ | Card in a narrow-gutter cell | Its text starts at | On the 16px keyline? |
1549
+ | --- | --- | --- |
1550
+ | 16px inline padding | 16px | Yes |
1551
+ | 24px inline padding | 24px | No: 8px past it |
1552
+
1553
+ `ads check` enforces it. A frame in the same owner as the grid is
1554
+ `source/keyline-missed`; a public component placed in the cell, whose frame
1555
+ belongs to another owner, is `component-keyline`. Both use the same comparison:
1556
+
1557
+ - **What is compared.** The gutter's start inset plus the frame's inline
1558
+ padding, against the wide gutter's start.
1559
+ - **Tolerance.** The spatial profile's fine unit (`fineUnit`, 2px in the
1560
+ example design system). A condensed gutter's half border is inside it.
1561
+ - **Borders are not counted.** A border is the frame's edge. Its width may
1562
+ change with the theme (the example design system draws 2px in its dark and high-contrast
1563
+ themes), and no inset token may be derived from a border width, so an inset
1564
+ cannot follow it. Text therefore sits a border's width past the keyline.
1565
+ - **Where it applies.** The cell's own container frame, or the first padded
1566
+ container frame inside the cell, in a `fluid` or `hybrid` grid whose gutter is
1567
+ a declared mode other than `wide`. It is checked in every theme and brand.
1568
+ - **Across owners.** For a public component in the cell, the frame is the
1569
+ component's root: the outermost element of its markup. A component whose root
1570
+ is another component takes that one's root. The finding is at the placement,
1571
+ and names the root frame as a related position. A root that ADS cannot read
1572
+ is the review item `component-keyline-unresolved`, never a pass.
1573
+ - **Where it does not.** A control (a button or a tile has its own inset, sized
1574
+ for its label and target); a frame without inline padding (flush content is a
1575
+ choice); what is inside a frame that already pads; `gutter: "none"` grids,
1576
+ which are structural layouts such as an application shell and have no text
1577
+ column; fixed tiling.
1578
+ - **Cost.** A design system with no component in a narrower-gutter grid has
1579
+ nothing to join: the cross-owner check returns before reading a token value.
1580
+
1581
+ The repair is a frame whose inline padding is the wide gutter's own token. The
1582
+ example design system's `card-cell` profile does this for the cards in its condensed grid:
1583
+
1584
+ ```ts
1585
+ // tokens/Containers/frame-inset.ads.css: --card-cell-inset: var(--grid-gutter-wide-start);
1586
+ export const cardCellFrame = profile({
1587
+ name: "card-cell-frame",
1588
+ kind: "frame",
1589
+ fields: { paddingBlock: "--card-padding", paddingInline: "--card-cell-inset", borderWidth: "--container-border", radius: "--radius-panel" },
1590
+ });
1591
+ ```
1592
+ - For the children of a fixed tiling grid, a size wider than the tile fails. Any
1593
+ other fixed size is reviewed, because a tile shrinks to a narrower region.
1594
+ - A public component placed as a cell or tile is reviewed, naming the narrowest
1595
+ region that the grid gives it. Its frame belongs to its own owner.
1596
+ - A nested grid inside a cell is checked against its own regions.
1597
+
1598
+ The overflow check of the render audit stays the rendered backstop.
1599
+
1600
+ **Row width.** An `inline` row is as wide as its content and never wider than
1601
+ its container. `extent: "container"` on its root makes it take the width
1602
+ available in any parent (a block, a column that aligns its children, the space
1603
+ left beside siblings). A part with `extent: "fill"` needs such a row, or one
1604
+ whose frame fixes its width: in a row that hugs, it has nothing to fill
1605
+ (`construction/extent-row-hugs`). `"container"` on a row whose frame fixes its
1606
+ width is `construction/extent-conflict`.
1607
+
1608
+ **Text layout.** Text layout is closed and resolved at compile time. A text
1609
+ part's `wrap` is one of anywhere (`true`/`"anywhere"`), `"never"`, `"balance"`
1610
+ (headings and short titles), `"pretty"` (body text) or `"truncate"`. Truncation
1611
+ is one line with an ellipsis, or a clamp to `lines: 2 | 3`. `reserveLines:
1612
+ 1 | 2 | 3` makes the part always take that many lines of the line height of its
1613
+ text profile. Control labels keep their own closed `wrap` (word breaks by
1614
+ default, `"anywhere"` or `"never"`). [The language](LANGUAGE.md#closed-layout-constructs)
1615
+ gives the lowering; the contract's platform inventory lists each lowered feature
1616
+ ([Browser targets](#browser-targets)).
1617
+
1618
+ - `spec/value-invalid`: `lines` other than `2 | 3`; `lines` without
1619
+ `wrap: "truncate"`; or a clamp that reserves more lines than it shows
1620
+ (`lines: 2` with `reserveLines: 3`, at `reserveLines`, naming both values).
1621
+ - `spec/value-invalid`, `construction/extent-conflict`: a clamp on a declared
1622
+ native `element`, or beside an arrangement's own display or a scroll
1623
+ container.
1624
+ - `source/clamp-on-control`: a clamp on a control or a form label (a button,
1625
+ label, legend, summary, select, option or text field), or on text inside one.
1626
+ It hides what the control does.
1627
+ - `review/truncated-text-unnamed`: truncated or clamped text without a `title`.
1628
+ Assistive technology reads all of the text. Sighted readers need the title, an
1629
+ expand control or the full content elsewhere, and analysis sees only the
1630
+ title.
1631
+ - `review/balance-on-paragraph`, at the part's `wrap`: `wrap: "balance"` on a
1632
+ text part rendered as a `<p>`. A paragraph is body text, which `"pretty"`
1633
+ suits. Render a heading as a heading element.
1634
+
1635
+ #### Runtime values and interaction
1636
+
1637
+ The authoring language owns these constructs. Each lowers to plain CSS and
1638
+ plain `style.setProperty`/`removeProperty` calls, with no ADS runtime.
1639
+
1640
+ **Measured geometry** ([language](LANGUAGE.md#measured-runtime-geometry),
1641
+ [cropped media](LANGUAGE.md#cropped-media)). A recipe declares what its owner
1642
+ measures at runtime with `measured: { name: { type, property, fallback? } }`.
1643
+ The owner writes the values with `recipe.measured.set` and `.clear`, or spreads
1644
+ `recipe.measured.props(…)` on the element for a value known at render. Codes:
1645
+ `construction/measured-property-unsupported`,
1646
+ `construction/measured-profile-conflict`,
1647
+ `construction/measured-placement-missing`, `source/measured-undeclared`,
1648
+ `review/measured-unused`, `construction/cover-box-missing` and
1649
+ `construction/cover-asset-unsupported`. A measured size on a `frame: "control"`
1650
+ part is checked for target size with its fallback and reviewed
1651
+ (`a11y-target-size-unresolved`). Measured values never take part in contrast.
1652
+ The example design system's `Menu` is a worked example: it places its panel below its trigger,
1653
+ or above it when only that side has room, and clears the values when it closes.
1654
+
1655
+ **Interaction properties** ([language](LANGUAGE.md#interaction-properties)).
1656
+ Drag handles, splitters and carousels declare `cursor`, `touchAction` and
1657
+ `userSelect` in `normalize`, and scroll snap as `snap: { type, align }` on the
1658
+ arrangement that scrolls. Codes: `spec/value-invalid`,
1659
+ `construction/extent-conflict`, `construction/snap-without-scroll`,
1660
+ `review/user-select-text` and `review/touch-action-unhandled`. A splitter
1661
+ combines both constructs: the grip declares the interaction, the pane declares
1662
+ the measured width, and the pointer handlers of the owner write the width
1663
+ through the measured setter.
1664
+
1665
+ **Runtime paint from data** ([language](LANGUAGE.md#runtime-paint-from-data)). A
1666
+ recipe declares the paints that its owner selects by data (a chart series, a
1667
+ status) with `paints: { name: { property, values, fallback } }`. The owner
1668
+ writes `recipe.paints.set` and `.clear`. Codes:
1669
+ `construction/paint-property-unsupported`, `construction/paint-value-role`,
1670
+ `construction/paint-profile-conflict`,
1671
+ `construction/paint-contrast-insufficient`, `source/paint-undeclared`,
1672
+ `source/paint-value-untyped`, `review/paint-unused` and
1673
+ `review/paint-contrast-unresolved`. The example design system's `BarChart` paints its bars
1674
+ from the `--chart-1`…`--chart-3` series tokens (`tokens/Charts/paint.ads.css`,
1675
+ with light, dark and high-contrast values).
1676
+
1677
+ **Press scale** ([language](LANGUAGE.md#state-focus-and-motion),
1678
+ [motion](MOTION.md)). A press effect is a `when` state that reads `scale` from
1679
+ the motion slot of the recipe: on the artwork part of a control, or on a region
1680
+ or control root that declares `transition: ["scale"]`. A scale factor is
1681
+ relative: 0.96 moves a 40px button in by less than 1px per side, and a 400px
1682
+ card by 8px. Select the factor per size class, through the motion profile that
1683
+ the motion slot of the composite selects. The example design system names the classes
1684
+ (`tokens/Motion/motion-scale.ads.css`, `profiles/Motion/feedback.ads.ts`):
1685
+
1686
+ | Element size | Profile | Factor | Shrink |
1687
+ | --- | --- | --- | --- |
1688
+ | Artwork inside a control (~20px) | `press-glyph` | 0.98 in the example design system; 0.9 gives a visible ~1px | ~0.2px per side at 0.98 |
1689
+ | A control (~120 × 40px) | `press-control` | 0.97 | ~1–2px |
1690
+ | A card or tile surface (~300px) | `press-surface` | 0.99 | ~1.5px |
1691
+ | A page-sized region | none | — | no press scale |
1692
+
1693
+ The example design system's Button, IconButton and ToggleTile press their artwork
1694
+ (`action-feedback` composes `press-glyph`). A `frame: "container"` root whose
1695
+ press factor is below 0.98 in some token context, or cannot be read as a number,
1696
+ is the review item `review/press-scale-large-surface` at the `scale` endpoint
1697
+ (`owner-analysis-review`, never blocking, also in a draft's acceptance result).
1698
+ `frame: {}` roots and control roots do not count. Select a surface-class press
1699
+ profile (factor at least 0.98) or no press scale, or keep a deliberate stronger
1700
+ press. Only such roots read token values for this item, so every other owner
1701
+ keeps its analysis across token edits.
1702
+
1703
+ #### Generated source and the emitted output
1704
+
1705
+ - `palette-generated` (error): a declared `palette.generated.ts` is missing or
1706
+ out of date, or one is present without `palette: true`
1707
+ ([Regenerating generated source](#regenerating-generated-source)).
1708
+ - `generated-modified` (error) and `generated-stale` (info): see
1709
+ [Hand edits and out-of-date output](#hand-edits-and-out-of-date-output).
1710
+
1711
+ #### Scenarios
1712
+
1713
+ Every public owner needs a scenario. A public owner is a file that the barrel
1714
+ re-exports and that authors recipes; a public plain module needs none. A public
1715
+ owner that no scenario covers is a `scenario-coverage` error at the owner file,
1716
+ naming it and where its scenario goes.
1717
+
1718
+ A scenario is a `*.ads.scenario.tsx` under `components/`, `patterns/` or
1719
+ `mocks/`. It supplies data and subjects; ADS draws the page with its own
1720
+ showcase components, the same for every design system.
888
1721
 
889
1722
  ```tsx
890
1723
  import { Button } from "@ds";
891
- import { fixture } from "./Button.ads.fixture";
892
- export const scenario = { title: "Button states", covers: ["Button"] };
893
- export default function Scenario() { return <Button>{fixture.label}</Button>; }
1724
+ import type { Scenario } from "@reqvire-org/ads/showcase";
1725
+
1726
+ export const scenario = {
1727
+ title: "Button",
1728
+ description: "The primary action control.",
1729
+ covers: ["Button"],
1730
+ specimens: [
1731
+ { title: "Sizes", arrangement: "row",
1732
+ render: () => <><Button label="Continue" size="sm" /><Button label="Continue" size="lg" /></> },
1733
+ ],
1734
+ } satisfies Scenario;
894
1735
  ```
895
1736
 
896
- IDs derive from filenames; do not maintain another registry or hand-assigned IDs.
897
- Showcase groups come only from folders. A folder above an owner becomes a group
898
- when its non-hidden children are all real directories:
1737
+ - It exports a literal `scenario` and has no default export (`scenario-entry`).
1738
+ ADS draws the title, the description, each specimen's title and note, the box
1739
+ around a specimen, the gaps and the state switch.
1740
+ - `title` is a nonempty static string. `covers` lists the public UI that the
1741
+ specimens render. Optional fields are `description`, `id`, `exercises`,
1742
+ `frame`, `states` and `captureTargets` (up to 20 named, nonempty CSS selectors
1743
+ of at most 500 characters). Another field, a `frame` outside `inline`,
1744
+ `screen` and `phone`, or `states` that is not an object literal of named prop
1745
+ sets is a `scenario-field` error.
1746
+ - `specimens` is a nonempty array literal of object literals
1747
+ (`scenario-specimens`). A specimen has a `render` function and can have a
1748
+ static `title` and `note`, an `arrangement` (`stack`, `row`, `tiles`) and a
1749
+ `width` (`content`, `full`, `small`, `medium`).
1750
+ - `render` is a component of the project's framework. It can hold local state.
1751
+ Its argument is the chosen state's props.
1752
+ - A scenario file writes no markup of its own (`scenario-markup`): no HTML or
1753
+ SVG element, no `style` attribute, and no component that a fixture or helper
1754
+ file declares. It renders owners, text and the scenario kit.
1755
+
1756
+ **States.** `states` names sets of props. ADS draws one switch for the scenario
1757
+ and passes the chosen set to every `render`. A new choice starts each specimen
1758
+ again. Use local state for what a person changes by using the owner. The
1759
+ showcase address names the chosen state (`&state=<name>`), so a state can be
1760
+ linked, and `ads_capture` takes the same name to capture it.
1761
+
1762
+ **Live controls.** `controls: true` asks ADS to draw a control for each closed
1763
+ prop of the first owner in `covers`: a union of literals (`size`, `variant`)
1764
+ or a boolean (`disabled`). ADS takes the list from the owner's own analysis,
1765
+ so it is exactly the props that change the owner's markup or styling; text,
1766
+ numbers, callbacks and data are never controls. Every `render` receives the
1767
+ chosen values as props, over the chosen state's, and takes part by spreading
1768
+ them:
899
1769
 
900
- ```text
901
- components/
902
- Forms/ # group: Forms
903
- Input/
904
- Input.ads.scenario.tsx
905
- Select/
906
- Select.ads.scenario.tsx
907
- Switch/ # ungrouped owner
908
- Switch.ads.scenario.tsx
1770
+ ```tsx
1771
+ export const scenario = {
1772
+ title: "Button",
1773
+ covers: ["Button"],
1774
+ controls: true,
1775
+ specimens: [{ title: "Try it", render: (props) => <Button label="Continue" {...props} /> }],
1776
+ } satisfies Scenario;
909
1777
  ```
910
1778
 
911
- The folder name is the group name, with spelling and case unchanged:
912
- `form-controls/` displays as `form-controls`. The owner's own directory and the
913
- layer root are never groups. The same convention applies to `patterns/` and
914
- `composition/`. Nested containers appear as one label, such as
915
- `Forms / Selection`. A regular file (`index.ts`, `README.md`, etc.) or a symbolic
916
- link prevents that container from becoming a group. Hidden entries are ignored.
917
-
918
- There is no grouping metadata, tag list or grouping registry. Do not add `group`
919
- to the scenario export or owner contract. The optional `group` in MCP discovery
920
- results is computed from folders; it is not authoring input. Change a group by
921
- moving complete owner directories and updating imports, exports and any scenario,
922
- behavior or capture references whose path-derived IDs change.
923
-
924
- Ungrouped entries remain directly visible without a Default heading. Named groups
925
- are collapsible and sorted alphabetically within each layer. Existing flat
926
- projects continue to work without moving files. Token views follow the catalogue's groups.
927
-
928
- ADS renders the **Tokens** section itself from the token sheets and
929
- `<dsDir>/tokens/catalog.ads.json`. Token navigation follows the same model as folders: a
930
- catalogue group is a sidebar group, and each kind of token in it (color fills, text colors,
931
- font families, text sizes, line heights, shadows…) is one view, `tokens/<Group>/<section>`, so a page shows one kind at a
932
- time. A group with a single kind stays one view, `tokens/<Group>`; the `Layout` group stays one
933
- view with the spatial reference. The section follows from each token's sample property, so there
934
- is no section metadata. As on component pages, each sample sits on the project canvas in a box
935
- while names and values sit on the showcase surface. The catalogue lists groups and gives each token its sample binding:
1779
+ Named states are for situations that need data (loaded, empty, failed); the
1780
+ controls are for switches. The render audit renders named states only: a
1781
+ combination made with the controls is not a named case.
1782
+
1783
+ **Frames.** `frame: "inline"` (the default) is a page of boxed specimens.
1784
+ `frame: "screen"` shows the first specimen as a whole screen, with the state
1785
+ switch in a bar above it; a mock uses it. `frame: "phone"` shows it in a
1786
+ 390 by 844px box.
1787
+
1788
+ **The scenario kit.** `@reqvire-org/ads/showcase` supplies what a subject
1789
+ sometimes needs around it. The kit renders only in an ADS preview.
1790
+
1791
+ | Kit | Purpose |
1792
+ | --- | --- |
1793
+ | `Container` | A parent of a named size and direction, for a subject that only makes sense inside one. `inline`: `fill`, `pane`, `column`, `page`. `block`: `content`, `short`, `medium`, `tall`. |
1794
+ | `Placeholder` | A labelled, tinted stand-in for a slot that the application fills. |
1795
+ | `Anchor` | The control an overlay opens from. Its child is a function that receives the control's element. |
1796
+ | `EventLog`, `useEvents` | Shows what the owner's callbacks received. |
1797
+
1798
+ **Roles.** The type of an export decides what it is, however it was made
1799
+ (aliases, re-exports, `memo`, any chain of factories).
1800
+
1801
+ - It is rendered UI when calling it returns the framework's element type, or
1802
+ constructing it gives a class component. The element types are React's
1803
+ `ReactNode`, `ReactElement` or `JSX.Element`, and Preact's `VNode`,
1804
+ `ComponentChildren` or `JSX.Element`, identified by the framework's own
1805
+ declarations.
1806
+ - It is a behavioral API when it is callable or constructible and returns
1807
+ anything else (a value, `void`, a controller instance, a hook's result), or is
1808
+ declared under `controllers/` (a context provider).
1809
+ - An export of a recipe owner, or one that aliases it, is UI unless its
1810
+ signatures show otherwise (a hook beside the component).
1811
+ - When its type, or what calling it returns, is `any`, `unknown` or generic, ADS
1812
+ does not guess. An `exercises` entry that names it is a
1813
+ `scenario-exercise-review` item that says why. A `covers` entry that names it
1814
+ is judged by whether the scenario renders it.
1815
+
1816
+ **`covers`.** ADS checks each entry on its own, at that entry
1817
+ (`entry: "covers[1]"`). A bad entry is left out of what the scenario registers,
1818
+ and the valid ones stand.
1819
+
1820
+ - `scenario-covers`: the entry is not a static name, or the barrel does not
1821
+ export it.
1822
+ - `scenario-covers-role`: the entry names a public behavioral API.
1823
+ - `scenario-render`, at the entry: nothing that a specimen's `render` reaches
1824
+ renders the covered export. ADS resolves every JSX tag that a `render` reaches,
1825
+ and every call of the framework's element factory (`createElement`, or
1826
+ Preact's `h`), to its declaration, through `const` aliases. It follows the
1827
+ design system's own components (scenario adapters, owners) into theirs, so a
1828
+ mock renders the owners that its patterns render. An import, or a
1829
+ reference outside the rendered tree, does not count.
1830
+
1831
+ **`exercises`** names the public behavioral APIs that the scenario uses, so that
1832
+ previews and `ads_scenarios` can find them. It is a demonstration, never passing
1833
+ behavior evidence. The scenario stays registered with its valid entries and its
1834
+ covers.
1835
+
1836
+ - `scenario-exercise-api`, at the entry: the entry is not a static name, is not
1837
+ exported by the barrel, names rendered UI, or names a value that is neither
1838
+ callable nor constructible.
1839
+ - `scenario-field`: `exercises` is not an array.
1840
+ - `scenario-exercise`: the mounted code never uses the API (it is only imported,
1841
+ or used in a function that nothing reaches). A use is a call, a construction
1842
+ or a render (a context provider), in a specimen's `render` or in a development
1843
+ adapter that it reaches: a component it renders, a function it calls, an event
1844
+ handler. A call of a method attached to the API (`api.success()`) counts,
1845
+ through aliases, namespace imports and re-exports.
1846
+ - `scenario-exercise-review` (review, never blocks): the mounted code only
1847
+ passes the API on or reads it, or ADS cannot tell the role of the entry.
1848
+
1849
+ **Other rules.** The location, entry, metadata and identity of a scenario are
1850
+ checked as `scenario-location`, `scenario-entry`, `scenario-metadata`,
1851
+ `scenario-field` and `scenario-identity`. After a field error (an unknown field,
1852
+ an empty `title`, an invalid `id` or `captureTargets`), the scenario stays
1853
+ registered and its coverage counts while `covers` reads. Unreadable metadata
1854
+ (`scenario-metadata`, marked `coverage: "not-established"`) leaves its coverage
1855
+ unknown, not missing.
1856
+
1857
+ #### Previews
1858
+
1859
+ A scenario previews the emitted owner: the bytes that `ads emit` writes, with
1860
+ the emitted `foundation.css` as the document CSS.
1861
+
1862
+ - While a preview compiler runs, ADS emits each settled edit of the design
1863
+ system into a preview-owned tree (`.ds/emitted/live`, never the output
1864
+ folder), and the open previews rebuild from it. Scenario and fixture edits
1865
+ rebuild without an emit.
1866
+ - A revision whose check fails is not emitted, and the previews keep the last
1867
+ good revision. `ads://project/build` reports `freshness`
1868
+ `{ kind: "stale", shown, reason: { kind: "emit-failed", failure } }` with the
1869
+ findings of the check until the edit is fixed, then
1870
+ `{ kind: "current", revision }`.
1871
+ - The showcase marks such a preview stale. The preview status in the toolbar
1872
+ becomes an error. Its details list the findings of the check (or of emission)
1873
+ and offer Retry preview, until the revision is current again.
1874
+ - Several MCP servers on one project share that tree. They write it one at a
1875
+ time under a lock in `.ds/locks/`, and an earlier revision never replaces the
1876
+ revision of the latest edit.
1877
+
1878
+ #### Touch density
1879
+
1880
+ Input modality is a token context, like a theme or a brand, so controls can grow
1881
+ on touch screens without a new construct. Override the size tokens in their own
1882
+ role sheets under `@media (pointer: coarse)`. Every owner that reads them
1883
+ follows:
936
1884
 
937
- ```json
938
- {
939
- "schemaVersion": 1,
940
- "groups": [
941
- { "id": "Color", "title": "Color", "samples": [
942
- { "token": "--accent", "property": "background-color", "probe": "rgb(31, 97, 163)" }
943
- ] }
944
- ]
1885
+ ```css
1886
+ /* tokens/Controls/control-min-size.ads.css */
1887
+ :root { --control-height-sm: 1.75rem; --control-height-md: 2.25rem; --control-height-lg: 2.75rem; }
1888
+ @media (pointer: coarse) {
1889
+ :root { --control-height-sm: 2.25rem; --control-height-md: 2.75rem; --control-height-lg: 3rem; }
1890
+ }
1891
+
1892
+ /* tokens/Controls/frame-inset.ads.css: the insets that go with the taller frames */
1893
+ :root { --control-inset-inline: 0.75rem; }
1894
+ @media (pointer: coarse) {
1895
+ :root { --control-inset-inline: 1rem; }
945
1896
  }
946
1897
  ```
947
1898
 
948
- `property` is the CSS property the view demonstrates the token with, and `probe` a valid test
949
- value different from the token's own; the view checks in the browser that the property responds.
950
- Tokens without a catalogue entry appear in a **Values** group with a default binding for their
951
- type. The `Layout` group's view also shows the spatial definition's examples. An invalid
952
- catalogue is a `foundation-catalog` error. Projects author no token scenarios or token review
953
- renderers: a project scenario with a foundation view's ID fails. (An additional project scenario
954
- that claims tokens is still checked by `token-scenario-reference` and `token-scenario-render`.)
955
-
956
- Fixtures/adapters own development inputs, state, callbacks and simulated services.
957
- The entry requires no browser page, application router/store or prior setup.
958
- Several contextual parts may share a scenario with their real parent. Larger
959
- entries reuse public production screen patterns instead of reassembling screens.
960
-
961
- `scenario-contract`, `scenario-render` and `scenario-coverage` require addressable
962
- coverage for every public renderable component/pattern, including unused exports.
963
- Only reachable real render references count. Types/constants/utilities are
964
- excluded. Scenarios and fixture helpers are development-only; runtime code and
965
- the public barrel cannot import or re-export them. They define no CSS, custom
966
- classes or native widget replicas. Project-specific review helpers use marked `.ads.review.*` files; the outer browser shell is tooling UI. Full-app integration harnesses
967
- belong in application tests. See the [contract](ADS.md#showcase-contract).
968
-
969
- The showcase header's **Phone viewport** toggle constrains the real preview iframe to 390 CSS pixels (or the available width on a narrower screen). It is available for patterns and compositions as well as components, keeps the mounted example and its state, and does not change the selected application host. Use it to review a responsive web shell at phone width independently of a native mobile app shell. `?viewport=phone` preserves this preview choice in a link; toggle it off to follow the available browser width. On phone browsers the catalogue starts collapsed, leaving the available width to the preview; the navigation button can reopen it. Automated captures retain their exact requested viewport.
970
-
971
- For this checkout, `bun run dev:showcase` builds the tool and serves an initialized
972
- Preact starter under ignored `.ds/playground/`. `bun run dev:react` selects React.
973
- The design source is `starters/shared/`; restart after editing it to generate a new
974
- playground snapshot. `bun run build:showcase` compiles that starter’s scenarios.
975
- The playground and receiving projects use the same initializer and packaged source.
976
- The built-in browser reads discovery and checked assets over HTTP and receives
977
- build reports through SSE. MCP agents and embedded Apps retain their existing
978
- interfaces. No delivery flag or project migration is required. Existing custom showcases
979
- are preserved by init; replace their run command deliberately when migrating.
980
-
981
- Run core and registered project checks before preview compilation, alongside
982
- framework checks and meaningful tests. Review real entries at narrow/wide sizes,
983
- in both themes and relevant states. Browser verification still establishes
984
- layout, keyboard/focus, interactions and motion; compiler success does not.
985
-
986
- Public `*Props` declarations omit inherited DOM `style`; arbitrary visual strings
987
- also fail. Measured geometry uses explicit boundaries. HTML mount styles may
988
- only establish full root height and body overflow. Project presentation belongs
989
- in owned component/pattern styles, with tokens supplying visual values.
990
-
991
- ## Branding
992
-
993
- ADS has fixed token names and ownership namespaces. Change values in the existing
994
- token files; `--accent`, `--font-sans`, `--radius-md`, and the other shared roles
995
- keep their meanings across projects. Foreign shared prefixes such as `--nuv-*` or
996
- `--brand-*` fail. There are no independent owner-local token namespaces. Components own `--ds-*`, patterns own `--ux-*`, and the showcase
997
- reserves `--showcase-*` for showcase boundaries. Fixture files still define no
998
- custom styling; the frame pattern uses `--ux-*`. Branding never assigns
999
- component state variables.
1000
-
1001
- Keep original artwork (SVG masters, finished PNG/JPEG/WebP images, delivered
1002
- `.ico`/`.icns` files, in any mix) and a usage/credits/license README in
1003
- `design-system/assets/brand/`, and font files in `assets/fonts/`. `ads check` fails
1004
- when artwork is undescribed in that README (`brand-readme`), the README states no
1005
- license (`brand-license`), and lists artwork nothing uses for review (`brand-unused`). Name a dark-theme variant
1006
- `<name>.dark.svg`; the component showing it renders both and shows each with a display switch
1007
- (`display: var(--display-dark, block)`). ADS renders the showcase's first
1008
- section, **Brand** (`brand/Assets`), from the artwork in `assets/brand/` and its subfolders: artwork in the
1009
- current theme and the app icon at its actual sizes. Projects author no brand preview scenarios. A finished image renders only at or below its own
1010
- pixel size; ADS never enlarges it. The [branding guide](../skills/ads-designer/references/branding.md)
1011
- (`ads://guides/branding`) covers the whole flow. Font declarations
1012
- belong in optional `tokens/fonts.css`. ADS generates the import-only foundation entry
1013
- (`styles.css`) from the sheets present, in this order: fonts, colors, typography, spacing,
1014
- elevation, base, themes.generated.css. Never edit it by hand.
1015
- Fixed artwork colors and geometry are permitted inside SVG assets; they do not
1016
- permit raw visual values in component or pattern styles.
1017
-
1018
- Foundation sheets are checked source. Keep root token definitions in value sheets,
1019
- font faces in `fonts.css`, and closed-role defaults in `base.css` (document
1020
- typography/canvas/theme, limited native resets, global focus/reduced motion).
1021
- Owner hooks, contextual UI selectors, keyframes, extra CSS imports, raw visual
1022
- values and missing token references fail checks there too. Move component-specific
1023
- repairs into their Linaria owner; see the [foundation contract](ADS.md#shared-token-contract).
1024
-
1025
-
1026
- Select one square master, an SVG or a PNG/JPEG/WebP of at least 512 px, with an
1027
- ADS-relative path:
1899
+ - The token checks evaluate the overrides of each `@media` condition as a
1900
+ context of its own, crossed with every theme and brand. Thus
1901
+ `a11y-target-size`, contrast and `token-type` all check the touch values. A
1902
+ coarse value that makes a control smaller than 24 px fails in that context,
1903
+ and the finding names it (for example `:root under @media (pointer: coarse)`).
1904
+ - `ads emit` writes the overrides into the emitted sheets unchanged. Nothing
1905
+ runs at runtime.
1906
+ - ADS checks WCAG 2.2 AA (2.5.8): 24 px, whatever the pointer. Larger touch
1907
+ targets (44 px is a common platform guideline) are a design choice that the
1908
+ tokens express, not a rule that ADS enforces. An owned hit area
1909
+ (`minTargetBlockSize`, `minTargetInlineSize` on a frame profile) can enlarge
1910
+ the target without a change to the layout.
1911
+ - To see a coarse-pointer density, open a scenario in a touch context: Chromium DevTools device
1912
+ emulation, or Playwright's `hasTouch: true`, which makes Chromium report a
1913
+ coarse primary pointer.
1914
+ - Prefer `(pointer: coarse)` for the primary input. `(any-pointer: coarse)` also
1915
+ matches a laptop with a touch screen, which then gets touch density with a
1916
+ mouse also.
1917
+
1918
+ ### Surface effects
1919
+
1920
+ A surface profile can blur its element (`blur`), blur and saturate what is
1921
+ behind it (`backdropBlur`, `backdropSaturate`: a glass bar over scrolling
1922
+ content), and cast a shadow that follows a shape instead of a box
1923
+ (`shapeShadow` on an image or artwork part, `groupShadow` on a container whose
1924
+ contents should cast one shadow). ADS composes them into the element's one
1925
+ `filter` and one `backdrop-filter` in a fixed order and writes the `-webkit-`
1926
+ companion. Their values are tokens: blur radii in `tokens/<Group>/blur.ads.css`,
1927
+ the saturation percentage in `saturation.ads.css`, and shadows in
1928
+ `shadow.ads.css`, where a shape or group shadow is one layer without spread.
1929
+ [Profile kinds](PROFILE-KINDS.md#surface-effects) has the fields, the rules and
1930
+ an example; the example design system's `profiles/Surfaces/materials.ads.ts` declares a
1931
+ translucent surface and a lifted drawing.
1932
+
1933
+ ### Colours that depend on their surroundings
1934
+
1935
+ Some UI must change its colours with what it sits on. Examples are a dark footer
1936
+ or dark card on a light page, a button over a photo or a strongly coloured
1937
+ banner, the cells and icons of a selected table row, and the links inside a
1938
+ warning banner. ADS has two checked patterns for this.
1939
+
1940
+ #### Nested theme and brand sections
1941
+
1942
+ A design system opts in with `sections: true` in its foundation declaration:
1028
1943
 
1029
- ```json
1030
- { "assets": { "iconSource": "assets/brand/app-icon.svg" } }
1944
+ ```ts
1945
+ // foundation.ads.ts
1946
+ export default foundation({
1947
+ // …
1948
+ themes: [
1949
+ { name: "light", scheme: "light" },
1950
+ { name: "dark", scheme: "dark" },
1951
+ ],
1952
+ sections: true,
1953
+ });
1031
1954
  ```
1032
1955
 
1033
- Merge this into `ds.config.json`; the source must be inside `assets/brand/`.
1034
- `favicon.svg` is written only for an SVG master. `ads assets` generates these files in ignored `.ds/assets/`:
1956
+ Then `data-theme="<name>"` or `data-brand="<name>"` on any element switches
1957
+ every token in the subtree of that element, exactly as the same attribute on
1958
+ `<html>` switches the page.
1035
1959
 
1036
- | Output | Size |
1037
- |--------|------|
1038
- | `favicon.svg` | Copy of the original SVG |
1039
- | `favicon.ico` | 16, 32, 48 px entries |
1040
- | `apple-touch-icon.png` | 180 × 180 |
1041
- | `icon-192.png` | 192 × 192 |
1042
- | `icon-512.png` | 512 × 512 |
1960
+ **Cost.** Sections are opt-in because they cost CSS. Every owner sheet carries
1961
+ toggle rules and a section rule for its context-dependent tokens. Without `sections: true`, ADS emits
1962
+ no section rule, and `data-theme` or `data-brand` below `<html>` changes
1963
+ nothing: the subtree keeps the page's values.
1043
1964
 
1044
- Rendering preserves colors, aspect ratio, and transparent padding. Include a
1045
- background in the original if needed for a platform. Every invocation rebuilds
1046
- the small output set; there is no rendering cache, asset registry, or theme
1047
- resolver. With no `iconSource`, it succeeds without writing. All images render
1048
- before generated files are replaced, so invalid artwork leaves prior outputs
1049
- intact. Sources, duplicate output mounts, and symlinked write paths are checked.
1965
+ **Authoring.** Token sheets continue to declare their contexts on the root only
1966
+ (`:root`, `:root[data-theme="dark"]`, `:root[data-brand="iris"]`,
1967
+ `:root[data-brand="iris"][data-theme="dark"]`). Emission applies each context to
1968
+ sections also ([The output folder](#the-output-folder)).
1050
1969
 
1051
- ### Committed targets and glyph sets
1970
+ **Selection.** The nearest `data-theme` and the nearest `data-brand` select the
1971
+ context independently, at any depth. The nearest attribute is the element's own
1972
+ or an ancestor's, `<html>` included.
1052
1973
 
1053
- Native launchers, tray icons and upload exports must exist without running ADS, so
1054
- they are committed. `assets.targets` lists them; each renders one master from
1055
- `assets/brand/` to a project path, the extension choosing the format:
1974
+ - A `data-brand="iris"` section inside a dark page gets iris's dark values.
1975
+ - A `data-theme="light"` section inside a dark page resets to the values of the
1976
+ default theme.
1977
+ - The `color-scheme` of the section follows its theme, so native controls and
1978
+ `light-dark()` match.
1979
+ - `foundation.css` repaints its document surface.
1056
1980
 
1057
- ```json
1058
- { "assets": { "targets": [
1059
- { "from": "assets/brand/app-icon.svg", "to": "app/icons/icon.svg" },
1060
- { "from": "assets/brand/app-icon.svg", "to": "app/icons/128x128.png", "size": 128 },
1061
- { "from": "assets/brand/banner.svg", "to": "exports/banner.png", "width": 1200, "height": 630 },
1062
- { "from": "assets/brand/app-icon.svg", "to": "exports/upload.png", "size": 1024, "background": "#FFFFFF" },
1063
- { "from": "assets/brand/app-icon.svg", "to": "app/icons/icon.ico", "sizes": [16, 32, 48, 256] },
1064
- { "from": "assets/brand/app-icon.svg", "to": "app/icons/icon.icns", "sizes": [16, 32, 64, 128, 256, 512, 1024] }
1065
- ] } }
1981
+ The checks already evaluate every theme, brand and brand × theme context. The
1982
+ same findings thus prove contrast inside a section and on the page.
1983
+
1984
+ A dark footer on a light page:
1985
+
1986
+ ```tsx
1987
+ // Application code: the footer and everything in it take the dark theme's values.
1988
+ <footer data-theme="dark">
1989
+ <p>Northstar · Terms · Privacy</p>
1990
+ <Button onClick={subscribe}>Subscribe</Button>
1991
+ </footer>
1066
1992
  ```
1067
1993
 
1068
- `.svg` copies the master; `.png` renders one `size` or a `width` × `height`
1069
- (other shapes are centred); `.ico` and `.icns` bundle `sizes`; `background` fills
1070
- transparency. `ads assets` re-renders only targets whose master or settings changed
1071
- and records every output's master hash, settings and output hash in the committed
1072
- `assets/generated.json`. `ads check` fails (`brand-output-stale`) when an output is
1073
- missing, edited by hand, or out of date, by comparing those hashes; it renders
1074
- nothing. Commit outputs and the manifest together.
1075
-
1076
- `assets.glyphs` turns a folder of UI icon SVGs into one typed module:
1077
- `{ "source": "assets/glyphs", "output": "components/Content/Icon/glyphs.ts",
1078
- "attributes": { "fill": "none", "stroke": "currentColor" } }`. Each SVG becomes
1079
- `glyphs[name]` with missing root attributes added; `aliases.json` beside them
1080
- becomes `glyphAliases`. `ads assets` writes it and `ads check` fails when it is stale.
1081
- Other products' logos are not brand artwork or glyphs: keep them, in their own
1082
- colors and under their owners' trademark and usage terms, in `assets/logos/` and
1083
- show them as images; ADS generates and checks nothing there. Never mute, tint or recolor
1084
- another product's logo. Use a one-color version only where its owner's published rules allow
1085
- it and in the colors they name; a CSS mask over a color token then keeps the shape and
1086
- follows the theme. A quieter version needs the owner's rule or written permission. Record each
1087
- file's source and rule in `assets/logos/README.md`.
1088
-
1089
- ### Tokens, grid, icons and accessibility
1090
-
1091
- `ads init` starts a design system from a token foundation in six groups (Color, Type, Space &
1092
- sizing, Shape & elevation, Motion, Layout) whose roles meet WCAG 2.2 AA in both themes,
1093
- a spatial definition with `@ads-layout` constructions (see [Spatial layouts](#spatial-layouts)), and an icon set with `Icon` and
1094
- `IconButton`. Keep the token names and change values to brand a project.
1095
-
1096
- `ads check` reports two kinds of finding. **Errors** fail `ads check`, validation and
1097
- acceptance: contrast per theme and brand (`token-contrast`), the 2 px spacing rhythm
1098
- (`token-rhythm`), accessibility from tokens and source (`a11y-target-size`, `a11y-focus`,
1099
- `a11y-text-resize`, `a11y-reduced-motion`, `a11y-text-spacing`, `a11y-image-alt`,
1100
- `a11y-icon-label`), glyph sets (`glyph-viewbox`, `glyph-color`), control padding
1101
- (`control-padding`: a control sized with `--control-height-<size>` pads its sides with
1102
- `--control-padding-<size>`, or `--control-inset` inside a track), declared artwork/text
1103
- relationships (`lockup-construction`), and the theme, brand and
1104
- brand-artwork rules below. **Review items** never block; each names something only a person
1105
- can judge: `atomic-composition-review`, `token-overlap-review`, `pointer-capture-review`,
1106
- `scenario-exercise-review`, `a11y-keyboard`, `brand-unused` and `render-color-probe`.
1107
- **Info** items (`atomic-composition-limit`) note an analysis limit. There is no setting that
1108
- changes a finding's kind. The showcase's layout-grid button inspects actual rendered grid
1109
- containers. Its **Icons** tab shows the glyph set: every glyph at the size used beside
1110
- text, each one on its grid at every `--icon-*` size with its aliases and glyph errors, and
1111
- each file in `assets/logos/` as it is, on a white and a black tile.
1112
-
1113
- Use `@ads-lockup` in an owned Linaria style to declare the artwork hook, text-group
1114
- hook and size token for a logo/icon beside text. It centers the artwork and aligns
1115
- the text runs, preserving intrinsic artwork proportions. The blocking check rejects
1116
- conflicting styles and unresolved hooks; it does not restrict standalone artwork
1117
- or prove optical balance. See the [worked branding example](../skills/ads-designer/references/branding.md#aligning-artwork-with-text)
1118
- for markup, font trimming, browser support and review boundaries.
1119
-
1120
- `ads audit` runs `ads check` first. A policy error such as `layout-fixed-width` or `img-attributes`
1121
- does not stop it: it renders every scenario and reports those errors with its own, and exits 1. Only
1122
- an error that stops rendering blocks it (`source-syntax`, `css-syntax`, `project-structure`,
1123
- `styles-entry`, `scenario-contract`); a broken import fails the scenarios that reach it. `ads check`,
1124
- `ads compile` and `ads validate` stop on every error, as before.
1125
-
1126
- It adds a rendered check: axe-core (WCAG A/AA rules) in every component, pattern
1127
- and composition scenario, once per declared brand and theme (`--scenario`, `--theme` and
1128
- `--brand` narrow it). Each violation is an `a11y-axe` error naming the axe rule, WCAG
1129
- criterion, themes and brands, failing elements and help link, and `ads audit` exits 1. It
1130
- needs the project's Playwright and browser, as captures do. `ads validate` runs it too,
1131
- over every scenario its change set reaches; MCP draft acceptance audits the draft
1132
- owners' own scenarios before writing source unless `acceptance.audit` is `false`, and an
1133
- `a11y-axe`, `a11y-non-text-contrast` or `layout-overflow` error rejects the change.
1134
- `ads tokens --format dtcg` exports the tokens as W3C Design Tokens JSON for design tools
1135
- (`--theme <name>` and `--brand <name>` select one context). MCP clients read the same export
1136
- from `ads://project/tokens/dtcg` (`?theme=` and `?brand=`).
1137
-
1138
- `themes` in `ds.config.json` declares the themes (a name and the color scheme for native
1139
- controls; the first is the default), and the optional `brands` the brands (the first is the
1140
- default). `data-theme="<name>"` and `data-brand="<name>"` on `<html>` theme the page, on any
1141
- element one section; each element follows its nearest theme and its nearest brand, at any
1142
- nesting depth, in every browser with CSS variables.
1143
-
1144
- Write a token that differs per theme as one plain value per theme, named with the theme as
1145
- suffix, on `:root`:
1994
+ **Guarantees.**
1995
+
1996
+ - Any element below a section resolves the context of the nearest `data-theme`
1997
+ and the nearest `data-brand` above it, at any depth and in any order of the
1998
+ two attributes.
1999
+ - A token whose value reads another token (`var(--action-fill)`) resolves with
2000
+ the values of the section.
2001
+ - A token that a context leaves undefined is undefined in such a section also.
2002
+ Its readers take their `var()` fallback.
2003
+ - Only declared names switch. An undeclared `data-theme` value leaves the
2004
+ section on the context of its parent.
2005
+
2006
+ **Limits.**
2007
+
2008
+ - A section switches whole themes and brands, never a subset of tokens.
2009
+ - A recipe's own declaration of a token on the section element wins over the
2010
+ value of the section. Sections apply at zero specificity, as the root values
2011
+ of the page are overridable.
2012
+ - Conditional overrides (`@media`, `@supports`) follow each condition as the
2013
+ checks evaluate it, one condition at a time. When two conditions hold at once
2014
+ and override the same token in different contexts, a section takes the value
2015
+ of the later condition, where the page root cascades them by specificity.
2016
+ - `@layer` is read as the checks read it. The contexts of a token in one layer
2017
+ behave exactly. A layered and an unlayered override of the same token are not
2018
+ ranked by layer.
2019
+
2020
+ #### Explicit choices
2021
+
2022
+ Sometimes a child must look different on one particular background that is not a
2023
+ whole theme, such as a photo or a brand-coloured banner. The child then exposes
2024
+ a closed choice that the caller sets, as Spectrum's `staticColor` prop does. The
2025
+ choice is typed and checked like any other choice. The caller must pass it.
2026
+
2027
+ ```tsx
2028
+ // IconButton.tsx (sketch): tone selects a precompiled surface; the default adds nothing.
2029
+ export interface IconButtonProps {
2030
+ // …
2031
+ /** "on-dark" over a photo or dark fill the theme does not know about. */
2032
+ tone?: "default" | "on-dark";
2033
+ }
2034
+ const toneChoices = {
2035
+ default: undefined,
2036
+ "on-dark": recipe({ surface: "control-on-dark-surface" }).root,
2037
+ };
2038
+ // … className={`ds-icon-button ${anatomy} ${toneChoices[tone] ?? ""} …`}
2039
+ ```
1146
2040
 
1147
2041
  ```css
2042
+ /* tokens/Surfaces/paint.ads.css: static paints, the same in every context. */
1148
2043
  :root {
1149
- --color-accent-9-light: oklch(55% .2 280);
1150
- --color-accent-9-dark: oklch(70% .16 280);
1151
- --bg-canvas-light: var(--slate-1-light); /* a half refers to halves */
1152
- --bg-canvas-dark: var(--slate-2-dark);
1153
- --accent: var(--color-accent-9); /* single values stay single */
1154
- }
1155
- [data-brand="acme"] { /* a brand sets its own halves */
1156
- --color-accent-9-light: oklch(55% .2 25);
1157
- --color-accent-9-dark: oklch(70% .16 25);
2044
+ --static-dark-fill: #101c19;
2045
+ --static-light-text: #ffffff;
1158
2046
  }
1159
2047
  ```
1160
2048
 
1161
- ADS generates `tokens/themes.generated.css` from these halves and the declared themes and
1162
- brands: theme switches and one resolver per themed token. It is the last foundation import;
1163
- commit it and never edit it. `ads assets`, the showcase and the MCP server write it, the
1164
- showcase and MCP server again whenever tokens or `ds.config.json` change; `ads check` fails
1165
- when it is missing or out of date (`themes-generated`).
1166
-
1167
- The generated file also defines display switches: `--display-<theme>` and, with brands,
1168
- `--display-brand-<brand>`, each `none` outside its nearest theme or brand. Show
1169
- theme- or brand-specific content with `display: var(--display-dark, block)`.
1170
- `"followSystemTheme": true` makes a page without `data-theme` take the first declared theme
1171
- whose scheme matches the OS `prefers-color-scheme`; an explicit `data-theme` wins.
1172
-
1173
- Beside it ADS generates `tokens/themes.generated.ts`, written, checked and kept current
1174
- together with the CSS: every color token resolved for every theme and brand as `{ css, rgba }`
1175
- for Canvas, WebGL and SVG renderers. The starter's `controllers/Palette` reads it:
1176
- `paletteFor(element)` (the nearest theme and brand's palette), `observePalette(element,
1177
- callback)` (once per theme or brand change) and `resolveColor(element, value)` (a non-token
1178
- color, cached, without inserting elements). `render-color-probe` (review) flags color reads
1179
- from the page inside per-item render callbacks. The same module exports `themed({ light,
1180
- dark, … })` and `themedByScheme({ light, dark })` for per-theme values that come from data at
1181
- runtime; `light-dark()` is an error in token sheets, component CSS and component string
1182
- literals (`theme-light-dark`).
1183
-
1184
- Errors: a token value set under `[data-theme]`, `prefers-color-scheme` or a combined brand
1185
- selector (`theme-old-form`); a component or pattern styled by a `[data-theme]` or
1186
- `[data-brand]` ancestor selector (`theme-selector`); a themed token without a half for every theme
1187
- (`theme-coverage`); a token set both as one value and as halves (`theme-half-conflict`); a
1188
- half that refers to a theme-following token instead of its half (`theme-half-reference`); a
1189
- lone half (`theme-new-token`); themes without any halves (`theme-empty`); an undeclared
1190
- brand name (`brand-undeclared`); a brand that gives a theme-following token one value
1191
- (`brand-theme-value`) or only some of its halves or ramp steps (`brand-coverage`); a token
1192
- only a brand defines (`brand-new-token`); a declared brand without values (`brand-empty`).
1193
- See the [token guide](../skills/ads-designer/references/design-data.md) and the
1194
- [accessibility guide](../skills/ads-designer/references/accessibility.md).
1195
-
1196
- Initialized builds run:
2049
+ ```ts
2050
+ // profiles/Surfaces/controls.ads.ts: the treatment.
2051
+ export const controlOnDarkSurface = profile({
2052
+ name: "control-on-dark-surface",
2053
+ kind: "surface",
2054
+ with: ["control-surface"],
2055
+ fields: { background: "--static-dark-fill", color: "--static-light-text" },
2056
+ });
2057
+ ```
1197
2058
 
1198
- ```text
1199
- ads check → ads assets → existing prebuild → existing build
2059
+ ```tsx
2060
+ // Application code: the caller knows what is behind the button.
2061
+ <figure>
2062
+ <img src={photo} alt="" />
2063
+ <IconButton icon={closeGlyph} label="Close" tone="on-dark" />
2064
+ </figure>
1200
2065
  ```
1201
2066
 
1202
- `lint:ds` runs the native, read-only ADS gates. `assets:ds`
1203
- runs `ads assets`; checks do not require outputs on a clean checkout. A failed
1204
- check or generation stops the build. Re-running init preserves token values,
1205
- artwork, existing configuration, and unrelated scripts.
1206
-
1207
- Mount `.ds/assets/` using the application's existing bundler. Init does not change
1208
- framework configuration. For a Vite app with no other public directory, a project
1209
- can set `publicDir: path.resolve(import.meta.dirname, ".ds/assets")`; when it
1210
- already has public assets, use its existing asset merge/copy step and reject
1211
- duplicate output paths. Use the same assets in development and production.
1212
- Application manifest metadata and other platform exports remain project-owned.
1213
-
1214
- ### Generic architecture guards
1215
-
1216
- `ads check` enforces reusable architecture policies alongside token checks:
1217
-
1218
- | Guard | Shared enforcement |
1219
- |----------------|------------------------------|
1220
- | Public APIs | Inherited/explicit style props and open-ended visual color/fill/stroke strings |
1221
- | Renderer boundaries | JSX inline styles, React/Preact CSS types, imperative `.style` writes, bulk style writes, and style-object escapes |
1222
- | Asset ownership | ADS/public mount collisions, configured generated assets in source, and tracked generated output |
1223
- | Product patterns | CSS/JSX namespace ownership; ADS implementations and showcase cannot import app source |
1224
- | Primitive state | State-variable overrides outside components; undocumented non-state component variables |
1225
- | Literal visual values | Absolute/font-relative lengths (including `ch` and root font units), durations and color/effect formulas require tokens; geometry angles and responsive viewport/container relationships remain available |
1226
- | Fixed token ownership | Foreign token names, shared token overrides, misplaced component/pattern/showcase variables, and noncanonical foundation imports |
1227
- | Showcase ownership | Fixture CSS/Linaria definitions, custom JSX classes, native controls/widget roles, state styling, private CSS/aliased imports, catalogue dependencies of a project's own showcase pages and source ownership, and runtime imports of fixtures/test helpers |
1228
- | Scenario coverage | All public renderable UI has path-discovered entries, colocated fixtures, literal metadata and reachable public render references; runtime imports of scenarios/fixtures are rejected |
1229
- | Data access | Direct global fetch/XHR/WebSocket/EventSource in ADS source is rejected; injected services, workers and lazy imports remain allowed |
1230
- | Showcase coverage | Public ADS UI referenced by production JSX/React `createElement` has showcase render references; imports and tests alone do not count |
1231
-
1232
- ES module imports, re-exports, and dynamic imports with literal specifiers use
1233
- TypeScript's project configuration, including aliases and bundler resource
1234
- queries. ADS implementations and showcase fixtures cannot import app code.
1235
- Private imports within ADS implementations remain allowed, including when the ADS
1236
- is nested inside `src/`. Application integration harnesses belong in test support.
1237
-
1238
- Unknown configuration fields fail rather than silently weakening checks.
1239
-
1240
- Notification usage can be enforced directly by ADS, without a project lint
1241
- plugin or another parse/lint pass:
2067
+ Surface contrast proves the pair of the profile in every context, and these
2068
+ static paints do not change between contexts. The on-dark treatment is thus
2069
+ readable whatever theme the page uses. Whether the photo needs the treatment is
2070
+ the caller's decision, which the type makes explicit.
1242
2071
 
1243
- ```json
1244
- {
1245
- "usage": {
1246
- "notifications": [{
1247
- "api": "toast",
1248
- "host": "Toaster",
1249
- "rootFiles": ["src/App.tsx", "design-system/components/Toast.ads.scenario.tsx"]
1250
- }],
1251
- "restrictedImports": ["sonner"]
1252
- }
1253
- }
1254
- ```
2072
+ #### What neither pattern covers
1255
2073
 
1256
- `api` and `host` name exports imported from `@ds`. ADS
1257
- recognizes named aliases and namespace imports, respecting shadowed bindings.
1258
- It rejects direct module/render calls and calls in `use server` modules, requires
1259
- a stable `id` for directly effect-created notifications with inspectable options,
1260
- and restricts the host to the exact declared roots. Direct conditional hosts and
1261
- duplicate static host IDs in one file fail. `restrictedImports` rejects runtime
1262
- package and subpath imports, re-exports, literal dynamic imports and unshadowed
1263
- `require` calls; type-only imports are exempt. Both policies are empty by default.
1264
-
1265
- These native guards run in `ads check`, acceptance and validation. They inspect
1266
- source and ADS runtime/scenario files, excluding tests and declaration contracts.
1267
- They do not prove cross-module host uniqueness or trace helper calls, dynamic
1268
- IDs/options, aliases assigned to local variables or framework render callbacks.
1269
- Keep route persistence and lifecycle browser tests. ADS does not assume a toast
1270
- implementation exists or install one.
1271
-
1272
- Component interaction variables such as `--ds-button-hover-bg` cannot be
1273
- assigned by app code, patterns, or showcase code. This includes static JSX style
1274
- objects in files with inline-style exceptions. Reading a variable is allowed;
1275
- the component owns its state definitions. Documented non-state customizations
1276
- are registered explicitly. State variables cannot be allowlisted.
1277
-
1278
- Keep renderer-, framework-, and component-specific project guards too. The
1279
- shared tool does not validate a third-party graph renderer's own APIs, arbitrary
1280
- runtime spreads, or the semantic meaning of a
1281
- measured value. Register project-specific guard scripts in the existing build
1282
- and configured acceptance/validation scripts. The project's own linter remains
1283
- an independent build tool.
1284
-
1285
- ### Project boundaries and assets
1286
-
1287
- Style permissions belong to their owner, in its `<Owner>.ads.contract.ts`, with paths
1288
- relative to the contract:
2074
+ Two cases are not covered:
1289
2075
 
1290
- ```ts
1291
- export default {
1292
- schemaVersion: 1,
1293
- styles: { writes: { "./geometry.ts": ["--ds-panel-height"] }, inline: [] },
1294
- customization: ["--ds-panel-gap"],
1295
- } satisfies UnitContract;
1296
- ```
2076
+ - state that cascades to children: a selected table row whose cells, icons and
2077
+ checkbox switch to "on selected" colours;
2078
+ - tinted containers: a success or warning banner whose links and icons must stay
2079
+ readable on its tint.
1297
2080
 
1298
- `styles.writes` permits only the listed CSS properties in that exact file. Use
1299
- kebab-case (`user-select`) or an exact custom property. Static assignments,
1300
- `setProperty`, and `removeProperty` can use that permission; `cssText`, computed
1301
- property names, escaped style objects, and bulk writes remain forbidden. Plain
1302
- property reads are allowed. `styles.inline` is a separate file-level JSX/type
1303
- exception and never permits imperative writes by itself. `customization` lists a
1304
- component's non-state `--ds-*` variables that patterns, the showcase and the
1305
- application may set.
2081
+ These cases need a prop passed through each child (an explicit choice at every
2082
+ level), or a construct that lets a surface set the context that its descendants
2083
+ read. ADS has no such surface-context construct. Do not emulate one with a theme
2084
+ per state: a theme is a whole colour mode, and the checks would prove every
2085
+ token of it.
1306
2086
 
1307
- Optional asset configuration adds only the paths that the project actually uses:
2087
+ ### Emitting the design system
1308
2088
 
1309
- ```json
1310
- {
1311
- "assets": {
1312
- "iconSource": "assets/brand/app-icon.svg",
1313
- "publicDirs": ["public/assets"],
1314
- "generatedPaths": ["dist", "dist-showcase", ".vite", ".ds"],
1315
- "generatedFiles": ["icon-generated.png"]
1316
- }
1317
- }
1318
- ```
2089
+ `ads emit [directory] [--json] [--force] [--watch]` compiles the design system
2090
+ into plain modules that an application can install without ADS. It captures the
2091
+ current revision of the design system once, runs `ads check` on it, and writes
2092
+ output only when that check passes. A failing check returns its findings and
2093
+ writes nothing.
1319
2094
 
1320
- Merge this section into `ds.config.json`.
2095
+ Exit codes:
1321
2096
 
1322
- Asset checks compare `design-system/assets/` with each configured public mount
1323
- and `design-system/showcase/public/assets/`, adjusting for `dsDir`. A relative
1324
- asset path may have one source owner per mount, even if duplicate contents
1325
- match. `generatedFiles` names asset-relative paths forbidden in those source
1326
- directories; nothing is inferred from filenames such as `favicon.ico`.
2097
+ - `0`: emitted, including "nothing changed".
2098
+ - `1`: a failing check or emission, or an output folder with hand edits.
2099
+ - `2`: an invalid invocation, an unusable output folder, a concurrent emit,
2100
+ cancellation, a source change during the emit, or a write failure.
1327
2101
 
1328
- `generatedPaths` names project-relative files or directories that must not be
1329
- tracked. A project's own `dist-showcase/` build output is also treated as generated;
1330
- the built-in client uses project preview artifacts under `.ds/`.
1331
- Git inspects tracked files, including nested workspaces. Outside a Git repo,
1332
- there are no tracked outputs to check; other asset checks still run. Real Git
1333
- inspection errors fail the check. These guards read files and never delete them.
2102
+ `--json` prints `{ "ok": true, "revision", "outDir", "written", "unchanged",
2103
+ "removed", "contract", "owners", "forced" }` or
2104
+ `{ "ok": false, "failure": { "kind", … } }`.
1334
2105
 
1335
- ## Configuration and component rules
2106
+ #### The output folder
1336
2107
 
1337
- `ds.config.json` uses schema version 1. A subfolder with its own `ds.config.json` is a separate
1338
- project: check, validation, audits, previews and watches stop there and run in it on their own.
1339
- Paths stay within the receiving project:
2108
+ By default ADS writes the design package's `dist/`, which the package's
2109
+ `exports` publish. The one-application layout emits into the application's
2110
+ source ([Set up a design package](#set-up-a-design-package)):
1340
2111
 
1341
2112
  ```json
1342
- {
1343
- "schemaVersion": 1,
1344
- "sourceDir": "src",
1345
- "dsDir": "design-system",
1346
- "themes": [{ "name": "light", "scheme": "light" }, { "name": "dark", "scheme": "dark" }],
1347
- "layout": { "widthTokens": [], "fixedWidthUnits": [] }
2113
+ { "compile": { "outDir": "../src/ui", "emitOnAccept": true } }
2114
+ ```
2115
+
2116
+ - `compile.outDir` is relative to the design package, or `null` for the default.
2117
+ It can be outside the package (an application's source). It is never the
2118
+ package's root, the design-system folder or an ancestor of either, and never
2119
+ inside `node_modules`, `.git` or `.ds`, judged from the package root. Any
2120
+ other value fails to load.
2121
+ - `compile.emitOnAccept` (`true` or `false`, default `true`) emits after
2122
+ `ads_accept` publishes a draft ([Emit after acceptance](#emit-after-acceptance)).
2123
+ - ADS owns the output folder entirely: after every emit it holds exactly the
2124
+ emitted files. Emission refuses to replace a folder that holds files it did
2125
+ not write, so an `outDir` that points at existing application code cannot
2126
+ erase that code.
2127
+ - The folder is never an input. ADS does not capture, watch or analyze it, so an
2128
+ emit never changes the revision that a check or a preview sees.
2129
+ - The repository owner decides whether the folder is committed. ADS never edits
2130
+ `.gitignore`, and emission, checks and the contract behave the same in both
2131
+ cases.
2132
+
2133
+ The folder holds:
2134
+
2135
+ - **Owner modules and sheets**, at the owner's path inside the design system.
2136
+ The module is the authored source with class expressions replaced by compiled
2137
+ classes. `<Owner>.css` holds the token CSS that the owner uses and its
2138
+ compiled atomic rules. With `sections: true` it also holds the section rules
2139
+ that apply the contexts of those tokens to nested `data-theme`/`data-brand`
2140
+ sections.
2141
+ - **`foundation.css`**, the document CSS that `foundation.ads.ts` declares, once
2142
+ for the design system
2143
+ ([contents](ARCHITECTURE.md#the-foundation-has-a-narrow-styling-role)): one
2144
+ `@font-face` per declared font face (`font-family`,
2145
+ `src: url("./fonts/…") format(…)`, `font-weight` value or range, `font-style`
2146
+ and `font-display`); the document reset (box sizing, body margin, inherited
2147
+ control fonts, and `display: none` for every `[hidden]` element except
2148
+ `hidden="until-found"`); the `text` and `surface` profile fields on `body`;
2149
+ the default focus indicator from the `focus` profile
2150
+ (`foundation({ focus: "keyboard-focus" })`) on every `:focus-visible` element,
2151
+ at zero specificity so that the indicator of a construction wins;
2152
+ `color-scheme` for each declared theme, with the two scheme switches beside
2153
+ it (`--ads-not-light`, `--ads-not-dark`) that display a
2154
+ [light or dark content image](ASSETS.md#a-content-image-with-a-light-and-a-dark-file);
2155
+ the page scroll lock behind a modal
2156
+ dialog, when an owner needs it; and the tokens that these use.
2157
+ - **`index.ts`**, the public barrel: the authored `<dsDir>/index.ts` with the
2158
+ same exports, which resolve to the emitted modules (public `@ds` imports, if
2159
+ any, made relative). It imports `foundation.css` first. It is the import entry
2160
+ of the output: an application imports the emitted design system, with its
2161
+ document CSS, through it, as it imports `@ds` while authoring. With declared
2162
+ fonts it also re-exports `fonts.ts`, and with an application icon
2163
+ `app-icons.ts`.
2164
+ - **Fonts**, with declared fonts: each face's file at
2165
+ `fonts/<family-slug>/<source>`, and `fonts.ts`, the preload list. Previews use
2166
+ the emitted tree, so they draw the faces also. `fonts.ts` exports:
2167
+ - `fontPreloads` (`{ href, type }[]`): the face that the document `text`
2168
+ profile draws first, in the default context, then the `preload` faces of
2169
+ each declaration, once each;
2170
+ - `preloadFonts(doc = document)`, which adds one
2171
+ `<link rel="preload" as="font" crossorigin>` per face, once;
2172
+ - `fontPreloadTags()` and `fontPreloadHeader()`, for a build step, a server
2173
+ render or a `Link` header.
2174
+
2175
+ Each href is a standard asset import of the file
2176
+ (`import font0 from "./fonts/…"`), which the application's bundler resolves to
2177
+ its public URL: the same in the client and server builds, and the same as the
2178
+ `url()` of the stylesheet, so a preloaded font downloads once. Call
2179
+ `preloadFonts()` in the app entry before the first render, or render
2180
+ `fontPreloadTags()` into the server's `<head>` (`preloadFonts()` then adds
2181
+ nothing).
2182
+ - **Application icon**, with `foundation({ appIcon })`: each export at its
2183
+ `file`, and the platform set under `icons/`: `favicon.svg` (the drawing),
2184
+ `favicon.ico` (16, 32 and 48 px), `apple-touch-icon.png` (180 px),
2185
+ `icon-192.png` and `icon-512.png`, and with a maskable icon
2186
+ `icon-maskable-192.png` and `icon-maskable-512.png`. `app-icons.ts` exports:
2187
+ - `appIconLinks` (`{ rel, href, sizes?, type }[]`): the ICO, the SVG and the
2188
+ touch icon;
2189
+ - `appIconTags()`: the same as `<link>` tags for the head of the page, from a
2190
+ build step, prerender or server render;
2191
+ - `webManifestIcons` (`{ src, sizes, type, purpose }[]`) for the `icons` of a
2192
+ web app manifest, the maskable ones with `purpose: "maskable"`.
2193
+
2194
+ Each URL is an asset import of the file (`import icon0 from "./icons/…"`). ADS
2195
+ does not write into the application's `public/` folder: copy the files, or
2196
+ import them from the output. ADS caches renders by the bytes of the drawing
2197
+ and the settings, so an emit with an unchanged icon renders nothing. Committed
2198
+ launcher or installer icons are committed with the folder.
2199
+ - **Helper modules** that the owners or the barrel import, with public `@ds`
2200
+ imports made relative. A public helper that no owner imports is emitted also.
2201
+ A module's `glyph("close")` becomes the reference literal `{ asset, source }`
2202
+ (the SVG text of its drawing), and the declaration of a glyph set under
2203
+ `assets/` becomes its name list. The application's bundler thus drops a glyph
2204
+ that is not imported.
2205
+ - **`ads-glyph.ts`**, the types-only `Glyph`/`GlyphSet` module, when an emitted
2206
+ module uses glyph references. Their `@reqvire-org/ads/asset` type imports are
2207
+ rewritten to it.
2208
+ - **`ads-dependencies.json`**, the packages that the emitted modules require.
2209
+ - **`package.json`**, `{ "sideEffects": ["*.css"] }`: an emitted module does
2210
+ nothing when it loads except import its stylesheet. The file has no `type`
2211
+ field, because the output is source for bundlers, not a package that Node
2212
+ runs.
2213
+ - **`ads-contract.json`**, the record of the emission: `format`
2214
+ (`"ads-contract"`), `version` (2), the source `revision`, `files` with the
2215
+ `sha256` of each emitted file, and `platform`
2216
+ ([Browser targets](#browser-targets)). The contract does not list itself. ADS
2217
+ also reads a version 1 contract, which has no `platform`, and verifies its
2218
+ folder in the same way; the next emit replaces it.
2219
+
2220
+ #### Consuming the output
2221
+
2222
+ The output ships source only: `.ts`/`.tsx` modules, `.css` sheets and the JSON
2223
+ records, plus the files of the declared fonts and the images of the application
2224
+ icon. An application consumes it through a bundler (Vite, Bun, Next.js, or a
2225
+ library build such as tsup or Vite library mode). Applications import the
2226
+ emitted barrel, never authoring source, which holds build-time macros. With the
2227
+ default output folder, for example:
2228
+
2229
+ ```jsonc
2230
+ // tsconfig.json
2231
+ { "compilerOptions": { "paths": { "@ds": ["./design-system/dist/index.ts"] } } }
2232
+ ```
2233
+
2234
+ ```ts
2235
+ // vite.config.ts
2236
+ export default defineConfig({ resolve: { alias: { "@ds": "/design-system/dist/index.ts" } } });
2237
+ ```
2238
+
2239
+ **JSX.** The output carries no JSX pragma: compile it with the JSX runtime of
2240
+ the project's framework. For Preact, set `"jsx": "react-jsx"` and
2241
+ `"jsxImportSource": "preact"` in the application's `tsconfig.json` (Vite and Bun
2242
+ read them from there).
2243
+
2244
+ **Stylesheets.** Each owner module begins with a side-effect import of its own
2245
+ sheet (`import "./Button.css";`). There is no separate stylesheet to include: a
2246
+ bundle that imports an owner gets its CSS. The JavaScript of unused owners is
2247
+ tree-shaken with every bundler.
2248
+
2249
+ - Vite, webpack and Next.js read the nearest `package.json` of each file. A
2250
+ bundler that honours the output's `sideEffects` bundles, through `index.ts`,
2251
+ only the sheets of the owners that the application uses: an owner imported
2252
+ through the barrel bundles the same CSS as a direct import of its module.
2253
+ - Bun.build ignores `sideEffects` for CSS and bundles every public owner's sheet
2254
+ that the barrel reaches. With Bun.build, import the owners you use directly from the
2255
+ output (`<outDir>/components/Actions/Button/Button`, with
2256
+ `<outDir>/foundation.css`).
2257
+ - Other bundlers that honour `sideEffects` for CSS imports should behave as Vite
2258
+ does. ADS tests Vite and Bun.build
2259
+ (`tests/integration/packed-emitted-app.test.ts`).
2260
+
2261
+ **Asset imports.** `fonts.ts` and `app-icons.ts` import their files (`.woff2`,
2262
+ `.woff`, `.ttf`, `.otf`, `.ico`, `.svg`, `.png`) as standard asset imports, each
2263
+ marked `// @ts-ignore`. A bundler's own types (`vite/client`) declare those
2264
+ modules, and a second wildcard declaration would conflict with them.
2265
+
2266
+ - Vite resolves the `url()` of the stylesheet and those imports to one hashed
2267
+ file, in client and SSR builds. It inlines files under
2268
+ `build.assetsInlineLimit` (4 KiB by default) as data URLs in both; set `0` to
2269
+ keep every icon a file.
2270
+ - Bun.build reads the `paths` alias itself and copies each imported file under a
2271
+ hashed name. Set `publicPath` (for example `"/"`) so that the imported URLs
2272
+ are absolute, not relative to the page.
2273
+ - Bun.build inlines a `url()` file of a stylesheet smaller than 128 KiB as a
2274
+ data URL. A small font thus arrives with the CSS, and a preload of its file is
2275
+ a second download. With Bun.build, preload only faces of 128 KiB or more.
2276
+
2277
+ **Server rendering.** The generated modules (`fonts.ts`, `app-icons.ts`, the
2278
+ palette) touch no `window` or `document` when they load. The example design system's owners
2279
+ use the DOM only in effects, ref callbacks and handlers, so the emitted example design system
2280
+ renders with `react-dom/server` or `preact-render-to-string` and hydrates
2281
+ without mismatch. For other owners, their own module-level code decides this.
2282
+
2283
+ - Values spread with `recipe.measured.props(…)` are in the server's markup.
2284
+ Values set with `recipe.measured.set` or `recipe.paints.set` are written by
2285
+ the client after hydration.
2286
+ - The server render can put `fontPreloadTags()` and `appIconTags()` in the head
2287
+ of the page. A Vite SSR build gives each file the URL that the client build
2288
+ gives it, so the server's tags are the client's and the client's
2289
+ `preloadFonts()` adds nothing
2290
+ (`tests/browser/emitted-ssr-hydration-browser.test.ts`).
2291
+
2292
+ #### Browser targets
2293
+
2294
+ ADS does not certify browser versions. The `platform` section of the contract
2295
+ states, as facts read from the emitted sheets, what the emitted CSS uses beyond
2296
+ the CSS core. The core is CSS 2.1 and the long-established CSS3 modules:
2297
+ selectors level 3, media queries, flexbox, grid layout, custom properties,
2298
+ `calc()` and the comparison functions, transforms, transitions, animations and
2299
+ web fonts.
2300
+
2301
+ ```jsonc
2302
+ "platform": {
2303
+ "features": {
2304
+ "popover": { "css": [":popover-open"], "owners": ["components/Overlays/Menu/Menu.tsx"],
2305
+ "degrades": "Required by popovers and menus: …" },
2306
+ "lh-unit": { "css": ["lh"], "owners": ["components/Actions/Button/Button.tsx", "…"],
2307
+ "degrades": "Declarations measured in lines are dropped: control boxes sized by 1lh fall back to their content height, …" },
2308
+ "user-select": { "css": ["user-select"], "prefixed": ["-webkit-user-select"], "owners": ["…"], "degrades": "Text stays selectable; …" },
2309
+ "text-wrap-balance": { "css": ["text-wrap: balance"], "owners": ["…"], "degrades": "Normal wrapping: line lengths are not balanced." }
2310
+ },
2311
+ "unrecognized": {},
2312
+ "assumptions": ["foundation.css loads before every owner sheet: …", "…"]
1348
2313
  }
1349
2314
  ```
1350
2315
 
1351
- `layout` declares allowed width tokens and owners with fixed widths; see
1352
- [Checks and guards](#checks-and-guards). Inside `dsDir` the layout is fixed:
1353
- ADS generates the public barrel `index.ts`, the review entry `review/index.ads.review.ts`
1354
- and the styles entry `styles.css`, and token sheets live in `tokens/`. ADS writes
1355
- the barrels from the owners' `<Owner>.ads.exports.ts` files and the styles entry
1356
- from the token sheets (`ads assets`, the showcase and the MCP server); `ads check`
1357
- reports one that is stale or edited by hand. The app imports the design system as
1358
- `@ds` and its development layer as `@ds/review`.
1359
-
1360
- These source-layout defaults apply when the file is absent; the example omits
1361
- the required init-time framework choice. Run `ads init --framework react` (or
1362
- `preact`) to save it. To use other folders, write this configuration before init. Configure TypeScript and the app bundler to resolve
1363
- `@ds` to `<dsDir>/index.ts`; this file does not rewrite their configuration.
1364
-
1365
- Colocate component-specific guards with their owner and register their command
1366
- in the project build or in `acceptance.scripts`. Core tooling imports no particular component.
1367
- Registered project configuration and build helpers may import one another;
1368
- native ADS import guards enforce this boundary. It does not
1369
- allow application code to import private ADS modules or build helpers to import
1370
- private UI implementation.
1371
-
1372
- Unused `styles.inline` entries and `styles.writes` properties fail the core
1373
- `stale-style-boundary` check, reported on the contract. Inline permissions recognize
1374
- JSX, imported UI factories and UI `CSSProperties` use; property permissions require
1375
- an exact write or removal, not a read. Change an owner's source and its contract
1376
- permissions together in its draft.
1377
-
1378
- `styles.inline` should name only documented geometry/renderer boundaries,
1379
- not broad styling exceptions. Ignore `.ds/`; generated paths refer to the project
1380
- and its locally installed tool.
1381
-
1382
- For native ADS gates outside package-manager hooks, run the installed tool directly:
2316
+ - `features`, by feature id:
2317
+ - `css`: the constructs found (properties, value keywords such as
2318
+ `display: -webkit-box`, at-rules, media features, pseudo-classes, units,
2319
+ functions);
2320
+ - `prefixed`: the vendor-prefixed forms that ADS writes beside or for the
2321
+ standard one (the clamp's `-webkit-box` form, `-webkit-user-select`);
2322
+ - `owners`: the owners whose sheets use it (`foundation.css` for the document
2323
+ sheet);
2324
+ - `degrades`: what happens in a browser without it. Required features
2325
+ (popover, modal dialogs, logical properties, `:focus-visible`) say so.
2326
+ Progressive enhancements (balanced and pretty wrapping, `@starting-style`,
2327
+ text-box trim) describe the plainer result.
2328
+ - `unrecognized`: constructs that the inventory has no entry for, with their
2329
+ owners. Typically this is a function in the project's own token values. Check
2330
+ them yourself.
2331
+ - `assumptions`: what the output needs of the document. `foundation.css` loads
2332
+ first (or, for a namespaced emission, the host page's own document styles).
2333
+ Themes and brands are selected with `data-theme`/`data-brand` on the root or a
2334
+ section. The root font size is the 16px that ADS's pixel-equivalent checks
2335
+ assume. Operating-system text scaling is not audited.
2336
+
2337
+ Check the listed features against your own browser targets, for example with
2338
+ Baseline data, before you rely on a degradation that you cannot accept. ADS has
2339
+ no declared targets with generated fallbacks.
2340
+
2341
+ #### Text scaling in the application
2342
+
2343
+ ADS owns the design system, not the application's `index.html`, and never writes
2344
+ document metadata (no `<meta name="text-scale">`). A design system is safe for
2345
+ the reader's text size, including the text scaling of the operating system where
2346
+ the browser passes it on, under three conditions.
2347
+
2348
+ ADS checks the two that belong to the design system. Every font size and length
2349
+ line height is in `rem` or `em` (`a11y-text-resize`). Every scenario keeps its
2350
+ content with 200% text, 200% zoom, WCAG text spacing and at 320 px (the text
2351
+ passes of the [render audit](#render-audit)). `foundation.css` sets no root font
2352
+ size, so `rem` starts from the browser's default (`medium`), which is where the
2353
+ reader's setting arrives.
2354
+
2355
+ The third is the application's document, which ADS does not check:
2356
+
2357
+ - Leave the root font size to the reader: no `px` `font-size` on `html` or
2358
+ `:root`. A percentage or `rem` scales with the setting; a `px` value replaces
2359
+ it.
2360
+ - Let the reader zoom: no `user-scalable=no`, and no `maximum-scale` below 2, in
2361
+ the viewport `<meta>` (WCAG 1.4.4).
2362
+ - To receive the operating system's text scale on browsers that support it, opt
2363
+ in with `<meta name="text-scale" content="scale">` in the head of the
2364
+ document. The tag tells the browser that the page scales its own text. The
2365
+ browser then sets the default font size from the system setting, and does not
2366
+ zoom or enlarge text on its own. Without the tag, those browsers keep their
2367
+ own adjustment, which the zoom pass covers. Add the tag when the application's
2368
+ own CSS also sizes text in `rem` or `em`: ADS checks the owners of the design
2369
+ system for this, not the pages of the application.
2370
+
2371
+ #### How an emit writes
2372
+
2373
+ - **Incremental.** An emit writes only the files whose bytes changed, and
2374
+ removes the files that are no longer emitted. An emit with no source change
2375
+ writes nothing. Owners whose analysis is unchanged keep their emitted module
2376
+ and are not analyzed or serialized again. This applies within one running ADS
2377
+ process, such as the MCP server or `ads emit --watch`; a one-off CLI run
2378
+ reuses only the persisted extraction cache.
2379
+ - **Whole-folder swap.** ADS stages the new tree beside the output folder and
2380
+ swaps it in with two renames, so a reader never sees a mix of old and new
2381
+ files. Between the renames the folder is briefly absent, because Bun offers no
2382
+ atomic directory exchange. A tool that reads it at that instant can see it
2383
+ missing and must retry. A failure or cancellation leaves the old tree
2384
+ untouched.
2385
+ - **One writer.** One emit writes a given output folder at a time, under a lock
2386
+ in `.ds/locks/`. An emit from another process is refused as `output-busy`. ADS
2387
+ removes a lock that a stopped process left. Within one process
2388
+ (`ads emit --watch`, or the MCP server's `ads_emit` and emit after
2389
+ acceptance), an emit requested while another runs is queued: at most one
2390
+ follow-up per output folder, which emits the source as it is when it starts.
2391
+
2392
+ **Watch mode.** `ads emit --watch` emits once, then again whenever the inputs of
2393
+ the design system change (the files that `ads check` captures, never the output
2394
+ folder).
2395
+
2396
+ - Changes that arrive within 150 ms of the first one share one emit. An event
2397
+ that leaves the bytes of every input as they were emitted (a touched file, a
2398
+ restored edit) emits nothing.
2399
+ - Each emit prints one line with the revision, the written, unchanged and
2400
+ removed counts and its duration, or its failure (findings on stderr). The
2401
+ watch continues after a failure. With `--json`, each emit is one JSON object
2402
+ per line: the `--json` result plus `event: "emit"` and `elapsedMs`.
2403
+ - The analysis stays warm, so after a one-owner edit only that owner is analyzed
2404
+ and serialized again.
2405
+ - SIGINT, SIGTERM or the end of stdin stops the watch. Run it with an open
2406
+ stdin; `< /dev/null` stops it immediately. A running emit is cancelled without
2407
+ a partial folder, and the lock, the watchers and the analysis process are
2408
+ released (exit 0).
2409
+
2410
+ #### Emit after acceptance
2411
+
2412
+ When `ads_accept` publishes a draft, the MCP server writes the published
2413
+ revision into the output folder, unless `compile.emitOnAccept` is `false`. It
2414
+ does not emit on a dry run, a rejection, a cancellation before publication or a
2415
+ stale revision. [Emitting from MCP](MCP.md#emitting-from-mcp) gives the `emit`
2416
+ result, including its `from` (`candidate-tree` or `published-source`).
2417
+
2418
+ - The source is published first, then the output folder. Acceptance never
2419
+ depends on the emit, and no owner is analyzed again for it.
2420
+ - A failed write (a hand edit, a busy folder, a cancellation, a write error) is
2421
+ reported as a failed emit with its `repair`, never as a success. The folder
2422
+ keeps its previous emission whole, `ads check` reports it `generated-stale`
2423
+ until `ads emit` runs, and nothing retries the emit.
2424
+ - The emit is never forced. Hand edits are reported as `output-modified`.
2425
+ - The MCP tool `ads_emit` (mutation-enabled servers) runs the same emit on
2426
+ demand. `ads_delete` publishes and emits in the same way.
2427
+
2428
+ #### Hand edits and out-of-date output
2429
+
2430
+ **Hand edits.** Before it writes, ADS verifies the folder against its
2431
+ `ads-contract.json`. A file edited after emission, a missing file, a file that
2432
+ ADS did not emit, or a non-empty folder without a contract refuses the emit
2433
+ (`output-modified`, exit 1), and nothing is written. Make the change in the
2434
+ design-system source, or run `ads emit --force` to overwrite the folder.
2435
+ `ads check` reports the same differences as blocking `generated-modified`
2436
+ findings, each hand-edited, missing or foreign file on its own. It reports
2437
+ nothing while the folder does not exist. The contract reports a hand-edited icon
2438
+ like any emitted file.
2439
+
2440
+ **Out-of-date output.** The contract records the source revision that the output
2441
+ was emitted from: the digest of the inputs that `ads check` captures for the
2442
+ same bytes. When the design system has changed since then, `ads check` (in the
2443
+ CLI, MCP and validation) lists a `generated-stale` info item at the contract,
2444
+ naming both revisions and `ads emit`. The item never blocks a check or an
2445
+ acceptance. After an accept with `compile.emitOnAccept: false`, it is expected
2446
+ until the next emit. `ads check --json` lists it, and the text report counts it
2447
+ among the info notes. A folder without a readable contract is
2448
+ `generated-modified`.
2449
+
2450
+ #### Renderer palette
2451
+
2452
+ Code that draws on a canvas or with WebGL needs theme colours as JavaScript
2453
+ values. A design system that declares `palette: true` in `foundation()` (the
2454
+ example design system does) keeps `<dsDir>/palette.generated.ts`: every paint-role token,
2455
+ resolved in every declared context (each theme of the default brand, then
2456
+ `<brand>/<theme>`). A design system that does not declare it gets none.
2457
+
2458
+ - The module exports `palette`, `themes`, `brands`, `contexts`,
2459
+ `defaultContext`, `systemThemes`, `themeSchemes` and `unresolved`, and the
2460
+ types `ColorToken`, `Palette`, `PaletteColor`, `PaletteContext` and `Theme`.
2461
+ - Themes, brands and the default come from `foundation.ads.ts`, in declared
2462
+ order. A value is what the `:root` rules of the token sheets cascade to on a
2463
+ root with that `data-theme`/`data-brand`. `@media`/`@supports` variants are
2464
+ not contexts.
2465
+ - `systemThemes` names the theme that each OS colour scheme selects when the
2466
+ foundation declares `followSystemTheme: true`. Otherwise it is `null`.
2467
+ - The module is generated source. Owners and controllers import it relatively
2468
+ and typecheck against its exact token union, and emission copies it as a plain
2469
+ module. The example design system's `controllers/Palette/Palette.ts` reads it (`paletteFor`,
2470
+ `observePalette`, `resolveColor`, `paletteContext`, exported from the barrel).
2471
+ - `ads emit` never writes source, so it refuses while `ads check` reports
2472
+ `palette-generated`
2473
+ ([Regenerating generated source](#regenerating-generated-source)).
2474
+
2475
+ ### Deleting declared targets
2476
+
2477
+ Through MCP (`--mutations`), `ads_delete` removes declared targets (tokens,
2478
+ profiles, components, patterns, assets, glyph sets, fonts) without a draft.
2479
+ [Guarded deletion](MCP.md#guarded-deletion) gives the inputs, what each target
2480
+ kind removes, the refusals and the result.
2481
+
2482
+ - Name each target by identity: a token's custom property (`--radius-spare`); a
2483
+ profile, asset, glyph-set or font family name; or a component or pattern owner
2484
+ path (`Actions/Button`). Pass the `ads_status.sourceRevision` at which you
2485
+ inspected them, and try `dryRun: true` first.
2486
+ - ADS refuses the deletion while anything that survives still refers to a
2487
+ target, while an open draft holds a changed file, and at another source
2488
+ revision. Change a dependent first, or name it in the same request. ADS never
2489
+ deletes dependents on its own.
2490
+ - The candidate runs the same checks as `ads_accept`. On success ADS writes the
2491
+ source, then the output folder.
2492
+ - The protection covers the design system that ADS checks. ADS cannot see
2493
+ applications maintained elsewhere, or consumers of a published package, that
2494
+ still import a removed export.
2495
+
2496
+ ### Inspecting tokens and the public API
2497
+
2498
+ `ads tokens [directory]` lists every token that the role sheets
2499
+ (`tokens/**/<role>.ads.css`) declare, by group (the folder of the sheet below
2500
+ `tokens/`), role (the name of the sheet) and name. Each token has one line with
2501
+ its role, its `:root` value (the default theme and brand), its value-shape
2502
+ status when it is not valid, and its first declaration. Below it is each theme,
2503
+ brand or condition whose value differs:
2504
+
2505
+ ```text
2506
+ ADS tokens: 1 of 1
2507
+ --action-fill Surfaces/paint #145e50 design-system/tokens/Surfaces/paint.ads.css:8
2508
+ :root[data-theme="dark"]: #a6e8cf
2509
+ :root[data-brand="iris"]: #51429a
2510
+ ```
2511
+
2512
+ - `--query text` keeps tokens whose name, role or group contains the text. Token
2513
+ names are accepted as written (`--query --action-fill`). `--role` and
2514
+ `--group` select exactly, and `--limit n` bounds the listing.
2515
+ - `--json` prints the page `{ total, tokens, nextOffset?, groups, contexts,
2516
+ reach }`. [The token inventory](MCP.md#the-token-inventory) describes the
2517
+ fields of each token: `role`, `group`, `shape`, `value`, `values`,
2518
+ `declarations`, `profiles`, `owners` and `type`. `reach.complete` is false
2519
+ while an owner was not analyzed.
2520
+ - `--format dtcg` prints every token as one
2521
+ [W3C Design Tokens (DTCG)](https://www.designtokens.org/tr/2025.10/format/)
2522
+ document. The selection options do not apply to the export.
2523
+ - The structure is `group → role → name` (without `--`), with `$type` from
2524
+ the value shape of the role.
2525
+ - `$value` is the `:root` value: an exact `var(--token)` as a
2526
+ `{group.role.name}` reference; a colour, dimension, duration, font family
2527
+ or cubic Bézier as its DTCG object; other values as CSS text marked
2528
+ `css: true`.
2529
+ - `$extensions["org.reqvire.ads"]` has the token's `name`, `role`, `group` and
2530
+ `modes`: the value of every theme, brand and condition that differs, keyed
2531
+ `dark`, `iris`, `iris/dark` or `dark @media (…)`. The document's own
2532
+ extension lists the context of each mode.
2533
+ - The output is deterministic (keys sorted), so you can commit and diff it.
2534
+
2535
+ Both forms read the sources as `ads check` does, never a generated file. The
2536
+ inventory reports value-shape problems but never fails (exit 0); `ads check`
2537
+ fails for them. Tokens that do not read (for example, a sheet names an
2538
+ undeclared theme) are an execution error (exit 2) that names the first finding
2539
+ of `ads check`.
2540
+
2541
+ MCP serves the same inventory (`ads_tokens`, `ads://project/tokens`,
2542
+ `ads://project/tokens/dtcg`) and the public catalogue: `ads_catalog` lists every
2543
+ public export with its API role, source, scenarios and props and, for an owner,
2544
+ the profiles it selects ([MCP inspection](MCP.md#inspect-the-design-system)).
2545
+
2546
+ ### Regenerating generated source
2547
+
2548
+ `ads sync [directory] [--json]` creates and refreshes the generated source files
2549
+ that `foundation.ads.ts` declares. The only such file is
2550
+ `<dsDir>/palette.generated.ts` (`palette: true`), generated from the token
2551
+ sheets and `foundation.ads.ts`.
2552
+
2553
+ - If you edit source directly, run `ads sync` after you declare the palette, or
2554
+ change colour tokens or the declared themes and brands. Until then,
2555
+ `ads check` reports a blocking `palette-generated` finding. It reports the
2556
+ same finding for a module that is present without the declaration.
2557
+ - Drafts need no sync: acceptance creates or regenerates the file in the
2558
+ candidate before its check, so the published change includes it.
2559
+ - The command prints each file that it created or wrote, or that every generated
2560
+ file is current. It never creates an undeclared file, and leaves a file that
2561
+ is present without its declaration unchanged (declare it or delete it).
2562
+ - Exit codes: 0 created, written or current; 1 the inputs of a generated file do
2563
+ not read, or the file is present without its declaration (run `ads check` for
2564
+ the located finding); 2 a usage error.
2565
+ - With `--json` it prints `{ ok, root, files: [{ source, file, outcome }] }`.
2566
+ `outcome` is `absent` (neither declared nor present), `undeclared`, `current`,
2567
+ `created`, `written` or `inputs-unreadable`.
2568
+
2569
+ **Project guards.** Put a component-specific guard beside its owner, and
2570
+ register its command in the project build or in `acceptance.scripts`. Core
2571
+ tooling imports no particular component. For native ADS gates outside
2572
+ package-manager scripts, run the installed tool directly:
1383
2573
 
1384
2574
  ```sh
1385
2575
  ads check .
1386
- ads compile .
2576
+ ads emit .
1387
2577
  ```
1388
2578
 
1389
- Retain unrelated lint, type checking, and framework build commands.
2579
+ Keep unrelated lint, type checking and framework build commands. Ignore `.ds/`.
2580
+ Generated paths refer to the project and its locally installed tool.
1390
2581
 
1391
2582
  ## External content
1392
2583
 
1393
- Use the repository's `ads-import` skill for selected external ADS source or theme
1394
- values, and `ads-port` for a native implementation inspired by an upstream
1395
- library. These agent workflows handle dependency closure, token mapping, motion
1396
- comparisons, source credits, applicable notices, and local documentation.
1397
- Ports reuse the project's visual language and consolidate equivalent design roles
1398
- introduced by upstream dependencies. Verify required behavior and project
1399
- consistency; exact visual replication is an explicit requirement, not the default.
1400
- They are agent workflows, rather than CLI import/design subcommands. Install
1401
- them through `npx skills`, or read the packaged skills through the
1402
- [stdio MCP server](MCP.md#skills). MCP serving does not install or automatically
1403
- activate a skill, and the tool still bundles no UI component/example library.
1404
-
2584
+ Use the repository's `ads-import` skill for selected external ADS source or
2585
+ theme values, and `ads-port` for a native implementation inspired by an upstream
2586
+ library. These are agent workflows, not CLI import or design subcommands.
2587
+
2588
+ - The workflows handle dependency closure, token mapping, motion comparisons,
2589
+ source credits, applicable notices and local documentation.
2590
+ - A port reuses the project's visual language and consolidates equivalent design
2591
+ roles that upstream dependencies introduce. Verify the required behavior and
2592
+ the consistency with the project. Exact visual replication is an explicit
2593
+ requirement, not the default.
2594
+ - Install the skills through `npx skills`, or read the packaged skills through
2595
+ the [stdio MCP server](MCP.md#skills). MCP serving does not install or
2596
+ automatically activate a skill.
2597
+ - The tool bundles no UI component or example library, and no design system.
1405
2598
 
1406
2599
  ## Release maintenance
1407
2600
 
1408
- Choose a version that is not already in `npm view @reqvire-org/ads versions`.
1409
- Published npm versions cannot be replaced, even by moving or recreating a Git
2601
+ Select a version that is not already in `npm view @reqvire-org/ads versions`.
2602
+ Published npm versions cannot be replaced, even if you move or recreate a Git
1410
2603
  tag; see [npm publishing rules](https://docs.npmjs.com/cli/v11/commands/npm-publish/).
1411
2604
 
1412
- Update `package.json` and its lockfile with
1413
- `npm version <new-version> --no-git-tag-version --ignore-scripts`. Follow the
1414
- [local verification and changelog stamp workflow](#releasing-the-ads-tool), then
1415
- push the matching `v<new-version>` tag. `release.yml` checks version availability
1416
- and the committed local proof, packs, publishes and creates the GitHub release. Stable tags publish as `latest`; prerelease tags
1417
- publish as `next`. Check the workflow result and npm version before updating
1418
- consumer dependencies. The manual workflow moves a label to an existing
1419
- published version; it does not publish new source.
1420
-
1421
- ## Owner contracts and migration
1422
-
1423
- New colocated development source uses `<Name>.ads.<role>.ts[x]`: contract,
1424
- scenario, fixture, helpers, test, spec or behavior.spec. Optional
1425
- `<Owner>.ads.contract.ts` consolidates token/behavior declarations with typed
1426
- paint and declarative-consumer contracts. Production APIs/types stay in runtime
1427
- files. ADS reads contract data statically; no project import runs during discovery.
1428
- See [CONTRACTS.md](CONTRACTS.md) for exact fields, supported producer forms and
1429
- source/browser limits. Only `.ads.`-marked filenames are development roles.
1430
-
1431
- Project scale policies remain explicit. A registered check can call
1432
- `inspectTokenOrigins(await inspectTokens(root), target, {stopAt: allowedSharedTokens})`
1433
- from the tooling package. Check `aliasOnly` for strict alias-only policies across
1434
- all themes; inspect `literals`/`diagnostics` for raw values, cycles and limits.
1435
- Choose exact targets/origins and documented geometry exceptions in project code;
1436
- register the command in `acceptance.scripts` and the normal build. ADS owns no
1437
- universal spacing scale and infers no design meaning from token names.
2605
+ 1. Update `package.json` and its lockfile with
2606
+ `npm version <new-version> --no-git-tag-version --ignore-scripts`.
2607
+ 2. Follow the [local verification and changelog stamp workflow](#releasing-the-ads-tool).
2608
+ 3. Push the matching `v<new-version>` tag. `release.yml` checks version
2609
+ availability and the committed local proof, builds, packs and publishes the
2610
+ tagged version, and creates the GitHub release with the changelog entry as
2611
+ the release notes. It does not repeat the local browser and package suite.
2612
+ Stable tags publish as `latest`; prerelease tags publish as `next`.
2613
+ 4. Check the workflow result and the npm version before you update consumer
2614
+ dependencies.
2615
+
2616
+ The manual workflow moves a label to an existing published version. It does not
2617
+ publish new source.
1438
2618
 
1439
2619
  ## Releasing the ADS tool
1440
2620
 
1441
- Run the complete tool, browser and packed npm/Bun suite locally before tagging.
1442
- Commit the implementation, documentation and package version first, then run
1443
- `bun run release:verify` with Bun, Chrome, and npm and Node available (the packed
1444
- tests install ADS into an npm project and check the Node-facing exports). The suite
1445
- runs the same grouped command as `bun run test`: one shared build, then unit,
1446
- integration and browser groups. Defaults are 4 unit file workers with up to 4
1447
- concurrent cases per file, 2 integration workers and 4 browser workers. All three
1448
- groups overlap after the build. All per-group overrides also
1449
- apply to release verification; see [test configuration](../tests/README.md).
1450
- Bun's optional `[test] smol = true` in
1451
- `bunfig.toml` reduces heap growth through more frequent garbage collection; it
1452
- can slow tests and is not a hard limit for the runner or its compiler/browser
1453
- children. Use an OS/container limit when a hard memory cap is needed.
1454
- The runner rejects failed or skipped tests, and
1455
- refuses uncommitted inputs or source changes during the run.
1456
-
1457
- `make test` runs the same full suite; `make test-grid` uses serial compact dots
1458
- and `make test-analysis` runs the focused analysis tests. `make release-verify`
1459
- records release evidence and `make release-proof` verifies it. These targets
1460
- enable terminal colors. Direct `bun run release:verify` also preserves colors
1461
- while saving its output. To disable them, use `make test FORCE_COLOR=0` or
1462
- `FORCE_COLOR=0 bun run release:verify`.
1463
-
1464
- A successful run writes a generated verification stamp under the matching
1465
- version in `docs/CHANGELOG.md`. It records the tested implementation commit,
1466
- command, counts, runtimes, completion time, duration, source SHA-256 and log
1467
- SHA-256, per-group counts/report hashes and explicit test-setting overrides.
1468
- All three fresh JUnit reports must pass without skips. The full log remains in
1469
- `output/local-tests.log`; group reports are in `output/local-tests.junit/`. Commit that stamp
1470
- and tag the resulting commit. Do not hand-author a passing stamp.
1471
-
1472
- `bun run release:proof` verifies that the tested commit is an ancestor and its
1473
- source digest matches both the release tree and working inputs. Only generated
1474
- proof blocks and the machine-specific, unpackaged `.mcp.json` launcher are
1475
- excluded from the digest; other tracked changes require another local run.
1476
- Untracked release source must be committed before testing. This is a record of
1477
- trusted local verification, not a signed attestation or a substitute for review.
1478
-
1479
- Release CI checks the committed proof, builds and packs the tool, and publishes
1480
- the tagged version with its changelog entry as the release notes. It does not repeat the local browser/package suite.
1481
-
1482
- To add illustrative SVG artwork, use `design-system/assets/pictograms/catalog.ads.json` and the separate **Pictograms** showcase section. The starter includes a Journey example and a project-owned Pictogram component. Read the [pictogram guide](../skills/ads-designer/references/pictograms.md) for full-color artwork, theme selection, accessibility and checks. Brand identity and UI icons keep their own sections.
2621
+ Run the complete tool, browser and packed npm/Bun suite locally before you tag.
2622
+
2623
+ 1. Commit the implementation, the documentation and the package version. The
2624
+ runner refuses uncommitted inputs, untracked release source and source
2625
+ changes during the run.
2626
+ 2. Run `bun run release:verify` with Bun, Chrome, npm and Node available. The
2627
+ packed tests install ADS into an npm project and check the Node-facing
2628
+ exports. The runner rejects failed or skipped tests.
2629
+ 3. Commit the generated stamp and tag the resulting commit. Do not write a
2630
+ passing stamp by hand.
2631
+ 4. Run `bun run release:proof` to verify the stamp.
2632
+
2633
+ **The suite.** It runs the same grouped command as `bun run test`: one shared
2634
+ build, then the unit, integration and browser groups. The worker defaults and
2635
+ per-group overrides of [test configuration](../tests/README.md) also apply to
2636
+ release verification.
2637
+
2638
+ Bun's optional `[test] smol = true` in `bunfig.toml` reduces heap growth through
2639
+ more frequent garbage collection. It can slow tests, and it is not a hard limit
2640
+ for the runner or its compiler and browser children. For a hard memory cap, use
2641
+ an OS or container limit.
2642
+
2643
+ **Make targets.** `make test` runs the same full suite, `make test-grid` uses
2644
+ serial compact dots, and `make test-analysis` runs the focused analysis tests.
2645
+ `make release-verify` records release evidence and `make release-proof` verifies
2646
+ it. These targets enable terminal colors. Direct `bun run release:verify` also
2647
+ preserves colors while it saves its output. To disable colors, use
2648
+ `make test FORCE_COLOR=0` or `FORCE_COLOR=0 bun run release:verify`.
2649
+
2650
+ **The stamp.** A successful run writes a generated verification stamp under the
2651
+ matching version in `docs/CHANGELOG.md`. It records the tested implementation
2652
+ commit, command, counts, runtimes, completion time, duration, source SHA-256 and
2653
+ log SHA-256, per-group counts and report hashes, and explicit test-setting
2654
+ overrides. All three fresh JUnit reports must pass without skips. The full log
2655
+ is in `output/local-tests.log`, and the group reports are in
2656
+ `output/local-tests.junit/`.
2657
+
2658
+ **The proof.** `bun run release:proof` verifies that the tested commit is an
2659
+ ancestor, and that its source digest matches both the release tree and the
2660
+ working inputs. Only generated proof blocks and the machine-specific, unpackaged
2661
+ `.mcp.json` launcher are excluded from the digest. Other tracked changes require
2662
+ another local run. The proof is a record of trusted local verification. It is
2663
+ not a signed attestation or a substitute for review.