@reqvire-org/ads 0.4.0 → 0.4.2

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 (394) hide show
  1. package/README.md +105 -86
  2. package/dist/a11y.mjs +108 -29
  3. package/dist/analysis/compiler-options.mjs +13 -0
  4. package/dist/analysis/context.mjs +46 -0
  5. package/dist/analysis/file-tree.mjs +52 -0
  6. package/dist/analysis/helpers.mjs +140 -0
  7. package/dist/analysis/impact.mjs +20 -0
  8. package/dist/analysis/inputs.mjs +15 -0
  9. package/dist/analysis/native-adapter.mjs +180 -0
  10. package/dist/analysis/native-project.mjs +323 -0
  11. package/dist/analysis/queries.mjs +133 -0
  12. package/dist/analysis/service.mjs +146 -0
  13. package/dist/analysis/standalone.mjs +57 -0
  14. package/dist/analysis/syntax.mjs +164 -0
  15. package/dist/analysis/worker.mjs +182 -0
  16. package/dist/assets.mjs +5 -5
  17. package/dist/atomic-composition.mjs +191 -70
  18. package/dist/atomic-trace.mjs +120 -50
  19. package/dist/behavior-libraries.mjs +106 -37
  20. package/dist/behaviors.mjs +219 -77
  21. package/dist/boundaries.mjs +135 -38
  22. package/dist/brand-assets.mjs +219 -47
  23. package/dist/brands.mjs +86 -27
  24. package/dist/bun-compiler.mjs +28 -14
  25. package/dist/bun-worker.mjs +7 -5
  26. package/dist/capture/worker.mjs +15 -4
  27. package/dist/capture-store.mjs +4 -2
  28. package/dist/capture.mjs +17 -14
  29. package/dist/check-service.mjs +40 -57
  30. package/dist/check.mjs +749 -188
  31. package/dist/cli.mjs +200 -99
  32. package/dist/color-values.mjs +21 -21
  33. package/dist/component-contrast.mjs +2 -2
  34. package/dist/config.mjs +303 -135
  35. package/dist/construction-styles.cjs +10 -0
  36. package/dist/control-padding.mjs +45 -25
  37. package/dist/css-values.mjs +3 -2
  38. package/dist/declarative-flow.mjs +209 -109
  39. package/dist/design-values.mjs +136 -51
  40. package/dist/development-runtime.mjs +4 -6
  41. package/dist/draft-boundary.mjs +11 -6
  42. package/dist/evidence.mjs +1 -1
  43. package/dist/finding-rules.mjs +7 -5
  44. package/dist/font-rules.mjs +2 -2
  45. package/dist/fonts-generated.mjs +2 -2
  46. package/dist/foundation-views.mjs +238 -0
  47. package/dist/foundation.mjs +63 -39
  48. package/dist/generated-entries.mjs +101 -34
  49. package/dist/icons.mjs +79 -32
  50. package/dist/image-attributes.mjs +109 -36
  51. package/dist/image-size.mjs +1 -1
  52. package/dist/index.mjs +0 -2
  53. package/dist/init.mjs +122 -41
  54. package/dist/investigations.mjs +2 -2
  55. package/dist/layers.mjs +298 -129
  56. package/dist/layout-widths.mjs +180 -85
  57. package/dist/linaria/preserve-values.cjs +7 -0
  58. package/dist/linaria/spatial-inputs.cjs +56 -0
  59. package/dist/lockup-composition.mjs +44 -0
  60. package/dist/lockup-model.cjs +64 -0
  61. package/dist/mcp/THIRD_PARTY_NOTICES.md +51 -1
  62. package/dist/mcp/apps.mjs +4 -30
  63. package/dist/mcp/behavior-pages.mjs +72 -24
  64. package/dist/mcp/build-status.mjs +257 -64
  65. package/dist/mcp/catalog.mjs +90 -26
  66. package/dist/mcp/context.mjs +17 -18
  67. package/dist/mcp/draft-discovery.mjs +44 -21
  68. package/dist/mcp/drafts.mjs +901 -281
  69. package/dist/mcp/execution-coordinator.mjs +417 -167
  70. package/dist/mcp/execution-results.mjs +7 -7
  71. package/dist/mcp/mutations.mjs +670 -234
  72. package/dist/mcp/preview-watch.mjs +448 -170
  73. package/dist/mcp/preview-widget.bundle.js +44 -50
  74. package/dist/mcp/prompts.mjs +5 -5
  75. package/dist/mcp/result-pages.mjs +1 -1
  76. package/dist/mcp/sandbox-host.mjs +1 -1
  77. package/dist/mcp/server.mjs +2402 -577
  78. package/dist/mcp/showcase-host.mjs +165 -41
  79. package/dist/mcp/skills.mjs +1 -1
  80. package/dist/mcp/text-diff.mjs +29 -10
  81. package/dist/paint-contracts.mjs +174 -81
  82. package/dist/palette-generated.mjs +2 -2
  83. package/dist/preview-bun.mjs +493 -187
  84. package/dist/preview-failure.mjs +1 -1
  85. package/dist/preview-files.mjs +13 -13
  86. package/dist/preview-imports.mjs +104 -55
  87. package/dist/preview-inputs.mjs +2 -2
  88. package/dist/preview-requests.mjs +24 -0
  89. package/dist/preview-resources.mjs +288 -147
  90. package/dist/preview-scope.mjs +5 -4
  91. package/dist/program-cache.mjs +8 -34
  92. package/dist/project-documents.mjs +1 -1
  93. package/dist/public-api.mjs +69 -31
  94. package/dist/public-props.mjs +39 -22
  95. package/dist/{browser-audit → render-audit}/axe-run.mjs +3 -3
  96. package/dist/{browser-audit → render-audit}/image-shape.mjs +2 -2
  97. package/dist/{browser-audit → render-audit}/layout-overflow.mjs +86 -23
  98. package/dist/{browser-audit → render-audit}/non-text-contrast.mjs +86 -27
  99. package/dist/{browser-audit → render-audit}/render-states.mjs +208 -52
  100. package/dist/{browser-audit → render-audit}/worker.mjs +86 -30
  101. package/dist/render-audit.mjs +828 -0
  102. package/dist/render-color-probe.mjs +96 -42
  103. package/dist/resource-limits.mjs +229 -97
  104. package/dist/runtime-contracts.mjs +467 -185
  105. package/dist/scenario-groups.mjs +22 -10
  106. package/dist/scenario-inspector.mjs +6 -43
  107. package/dist/scenario-program.mjs +8 -25
  108. package/dist/scenario-registry.mjs +72 -30
  109. package/dist/scenario-selectors.mjs +161 -64
  110. package/dist/scenario-slots.mjs +149 -56
  111. package/dist/scenario-trace.mjs +215 -109
  112. package/dist/scenarios-compiler.mjs +719 -378
  113. package/dist/scenarios-vite.d.mts +1 -3
  114. package/dist/scenarios-vite.mjs +2 -81
  115. package/dist/scenarios.mjs +421 -157
  116. package/dist/selector-match.mjs +2 -2
  117. package/dist/showcase/client.bundle.js +57 -56
  118. package/dist/showcase/draft-navigation.js +18 -0
  119. package/dist/showcase/favicon.ico +0 -0
  120. package/dist/showcase/favicon.svg +1 -0
  121. package/dist/showcase/foundation-view.css +55 -0
  122. package/dist/showcase/foundation-view.mjs +252 -0
  123. package/dist/showcase/guide-controls.ads.review.mjs +32 -0
  124. package/dist/showcase/icons.js +1 -145
  125. package/dist/showcase/index.html +3 -31
  126. package/dist/showcase/preview-frame.ads.review.css +46 -0
  127. package/dist/showcase/preview-frame.ads.review.d.mts +11 -0
  128. package/dist/showcase/preview-frame.ads.review.mjs +22 -0
  129. package/dist/showcase/preview-state.js +0 -9
  130. package/dist/showcase/refresh-scheduler.js +23 -0
  131. package/dist/showcase/style.css +5 -47
  132. package/dist/showcase/ui/ui.css +1353 -0
  133. package/dist/showcase/ui/ui.js +1062 -0
  134. package/dist/showcase-coverage.mjs +58 -37
  135. package/dist/skills/README.md +24 -23
  136. package/dist/skills/ads-designer/README.md +8 -2
  137. package/dist/skills/ads-designer/SKILL.md +130 -119
  138. package/dist/skills/ads-designer/references/accessibility.md +12 -13
  139. package/dist/skills/ads-designer/references/atomic-styles.md +4 -4
  140. package/dist/skills/ads-designer/references/behaviors.md +30 -27
  141. package/dist/skills/ads-designer/references/branding.md +98 -10
  142. package/dist/skills/ads-designer/references/captures.md +25 -0
  143. package/dist/skills/ads-designer/references/cli.md +21 -24
  144. package/dist/skills/ads-designer/references/contracts.md +7 -6
  145. package/dist/skills/ads-designer/references/design-data.md +49 -52
  146. package/dist/skills/ads-designer/references/drafts.md +20 -17
  147. package/dist/skills/ads-designer/references/evidence.md +1 -5
  148. package/dist/skills/ads-designer/references/guarded-editing.md +14 -18
  149. package/dist/skills/ads-designer/references/layers.md +1 -1
  150. package/dist/skills/ads-designer/references/layout.md +347 -0
  151. package/dist/skills/ads-designer/references/mobile.md +2 -1
  152. package/dist/skills/{ads-motion/references/performance.md → ads-designer/references/motion-performance.md} +5 -1
  153. package/dist/skills/{ads-motion/references/build.md → ads-designer/references/motion.md} +73 -5
  154. package/dist/skills/ads-designer/references/review.md +37 -34
  155. package/dist/skills/ads-designer/references/runtimes.md +33 -30
  156. package/dist/skills/ads-designer/references/scenarios.md +16 -18
  157. package/dist/skills/{ads-break-ui/references/catalog.md → ads-designer/references/stress-catalog.md} +3 -1
  158. package/dist/skills/ads-designer/references/stress-test.md +68 -0
  159. package/dist/skills/ads-designer/references/validation.md +83 -75
  160. package/dist/skills/ads-designer/references/workflows.md +8 -33
  161. package/dist/skills/ads-import/SKILL.md +43 -325
  162. package/dist/skills/ads-import/references/atomic-styles.md +4 -4
  163. package/dist/skills/ads-import/references/behaviors.md +30 -27
  164. package/dist/skills/ads-import/references/branding.md +5 -5
  165. package/dist/skills/ads-import/references/captures.md +25 -0
  166. package/dist/skills/ads-import/references/cli.md +21 -24
  167. package/dist/skills/ads-import/references/compatibility.md +1 -1
  168. package/dist/skills/ads-import/references/contracts.md +7 -6
  169. package/dist/skills/ads-import/references/design-data.md +49 -52
  170. package/dist/skills/ads-import/references/drafts.md +20 -17
  171. package/dist/skills/ads-import/references/evidence.md +1 -5
  172. package/dist/skills/ads-import/references/guarded-editing.md +14 -18
  173. package/dist/skills/ads-import/references/implementation.md +2 -1
  174. package/dist/skills/ads-import/references/layers.md +1 -1
  175. package/dist/skills/ads-import/references/layout.md +347 -0
  176. package/dist/skills/ads-import/references/review.md +37 -34
  177. package/dist/skills/ads-import/references/runtimes.md +33 -30
  178. package/dist/skills/ads-import/references/scenarios.md +16 -18
  179. package/dist/skills/ads-import/references/tokens.md +3 -3
  180. package/dist/skills/ads-import/references/validation.md +83 -75
  181. package/dist/skills/ads-import/references/workflows.md +8 -33
  182. package/dist/skills/ads-migrate/SKILL.md +56 -0
  183. package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +602 -0
  184. package/dist/skills/ads-port/SKILL.md +54 -343
  185. package/dist/skills/ads-port/references/atomic-styles.md +4 -4
  186. package/dist/skills/ads-port/references/behaviors.md +30 -27
  187. package/dist/skills/ads-port/references/captures.md +25 -0
  188. package/dist/skills/ads-port/references/cli.md +21 -24
  189. package/dist/skills/ads-port/references/contracts.md +7 -6
  190. package/dist/skills/ads-port/references/design-data.md +49 -52
  191. package/dist/skills/ads-port/references/drafts.md +20 -17
  192. package/dist/skills/ads-port/references/evidence.md +1 -5
  193. package/dist/skills/ads-port/references/guarded-editing.md +14 -18
  194. package/dist/skills/ads-port/references/layers.md +1 -1
  195. package/dist/skills/ads-port/references/layout.md +347 -0
  196. package/dist/skills/ads-port/references/lint-and-docs.md +8 -11
  197. package/dist/skills/ads-port/references/native-implementation.md +2 -1
  198. package/dist/skills/ads-port/references/review.md +37 -34
  199. package/dist/skills/ads-port/references/runtimes.md +33 -30
  200. package/dist/skills/ads-port/references/scenarios.md +16 -18
  201. package/dist/skills/ads-port/references/validation.md +83 -75
  202. package/dist/skills/ads-port/references/workflows.md +8 -33
  203. package/dist/source-symbols.mjs +1 -8
  204. package/dist/source-values.mjs +266 -128
  205. package/dist/spatial-composition.mjs +322 -0
  206. package/dist/spatial-contexts.cjs +56 -0
  207. package/dist/spatial-css.cjs +351 -0
  208. package/dist/spatial-inputs.cjs +80 -0
  209. package/dist/spatial-metadata.mjs +18 -0
  210. package/dist/spatial-model.cjs +322 -0
  211. package/dist/spatial.mjs +21 -0
  212. package/dist/stage-timing.cjs +20 -0
  213. package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +105 -0
  214. package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +275 -0
  215. package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
  216. package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
  217. package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +8 -0
  218. package/dist/starters/preact/ds.config.json +25 -6
  219. package/dist/starters/preact/package.json +4 -8
  220. package/dist/starters/preact/tsconfig.json +4 -5
  221. package/dist/starters/preact/vite.config.ts +3 -3
  222. package/dist/starters/react/ADS.md +42 -47
  223. package/dist/starters/react/README.md +47 -49
  224. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +18 -2
  225. package/dist/starters/react/design-system/components/Actions/IconButton/README.md +3 -0
  226. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/README.md +5 -0
  227. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.fixture.ts +13 -0
  228. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.scenario.tsx +22 -0
  229. package/dist/starters/react/design-system/index.ts +2 -1
  230. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.exports.ts +1 -0
  231. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.fixture.ts +7 -0
  232. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.scenario.tsx +15 -0
  233. package/dist/starters/react/design-system/patterns/Conversation/Conversation.tsx +105 -0
  234. package/dist/starters/react/design-system/patterns/Conversation/README.md +9 -0
  235. package/dist/starters/react/design-system/patterns/Shell/Floating.ads.fixture.ts +5 -0
  236. package/dist/starters/react/design-system/patterns/Shell/Floating.ads.scenario.tsx +21 -0
  237. package/dist/starters/react/design-system/patterns/Shell/README.md +43 -0
  238. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.exports.ts +1 -0
  239. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.fixture.ts +5 -0
  240. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +21 -0
  241. package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +274 -0
  242. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +1 -1
  243. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
  244. package/dist/starters/react/design-system/review/index.ads.review.ts +4 -0
  245. package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.exports.ts +1 -0
  246. package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.review.tsx +6 -0
  247. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +1 -1
  248. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
  249. package/dist/starters/react/design-system/showcase/mcp/{main.tsx → main.ads.mount.tsx} +4 -2
  250. package/dist/starters/react/design-system/tokens/catalog.ads.json +1221 -0
  251. package/dist/starters/react/design-system/tokens/colors.css +1 -1
  252. package/dist/starters/react/design-system/tokens/spacing.css +22 -32
  253. package/dist/starters/react/design-system/tokens/spatial.ads.json +70 -0
  254. package/dist/starters/react/design-system/tokens/themes.generated.ts +1 -1
  255. package/dist/starters/react/ds.config.json +25 -6
  256. package/dist/starters/react/package.json +2 -6
  257. package/dist/starters/react/tsconfig.json +2 -3
  258. package/dist/starters/react/vite.config.ts +3 -3
  259. package/dist/style-boundaries.mjs +70 -25
  260. package/dist/task-cache.mjs +173 -72
  261. package/dist/task-worker.mjs +22 -11
  262. package/dist/test-boundaries.mjs +132 -59
  263. package/dist/themes-generated.mjs +1 -1
  264. package/dist/themes-watch.mjs +57 -22
  265. package/dist/themes.mjs +176 -73
  266. package/dist/token-export.mjs +39 -14
  267. package/dist/token-policy.mjs +6 -3
  268. package/dist/token-quality.mjs +6 -6
  269. package/dist/token-samples.mjs +16 -5
  270. package/dist/tokens.mjs +71 -26
  271. package/dist/ui-framework.mjs +16 -14
  272. package/dist/unit-contracts.mjs +251 -104
  273. package/dist/units.mjs +208 -98
  274. package/dist/usage.mjs +138 -38
  275. package/dist/validation-checks.mjs +115 -38
  276. package/dist/validation-inputs.mjs +187 -78
  277. package/dist/validation.mjs +268 -102
  278. package/dist/verification/browser.mjs +27 -5
  279. package/dist/verification.mjs +711 -187
  280. package/docs/ADS.md +90 -79
  281. package/docs/ARCHITECTURE.md +294 -136
  282. package/docs/BEHAVIORS.md +29 -25
  283. package/docs/CACHING.md +52 -17
  284. package/docs/CHANGELOG.md +309 -17
  285. package/docs/CONTRACTS.md +12 -4
  286. package/docs/DESIGN-REFERENCES.md +40 -0
  287. package/docs/GUIDE.md +270 -258
  288. package/docs/MCP.md +181 -324
  289. package/docs/SPATIAL-CHECKS.md +69 -0
  290. package/docs/benchmarks/README.md +39 -0
  291. package/package.json +42 -34
  292. package/dist/browser-audit.mjs +0 -429
  293. package/dist/create.mjs +0 -48
  294. package/dist/lint-config.mjs +0 -50
  295. package/dist/mcp/project-widget.bundle.js +0 -114
  296. package/dist/mcp/reports.mjs +0 -101
  297. package/dist/mcp/widget.bundle.js +0 -147
  298. package/dist/oxlint.mjs +0 -89
  299. package/dist/preview-builder.mjs +0 -133
  300. package/dist/preview-workers.mjs +0 -184
  301. package/dist/showcase.mjs +0 -77
  302. package/dist/skills/ads-break-ui/LICENSE.upstream +0 -21
  303. package/dist/skills/ads-break-ui/README.md +0 -16
  304. package/dist/skills/ads-break-ui/SKILL.md +0 -412
  305. package/dist/skills/ads-break-ui/agents/openai.yaml +0 -4
  306. package/dist/skills/ads-break-ui/references/atomic-styles.md +0 -293
  307. package/dist/skills/ads-break-ui/references/behaviors.md +0 -412
  308. package/dist/skills/ads-break-ui/references/captures.md +0 -135
  309. package/dist/skills/ads-break-ui/references/contracts.md +0 -317
  310. package/dist/skills/ads-break-ui/references/design-data.md +0 -354
  311. package/dist/skills/ads-break-ui/references/drafts.md +0 -194
  312. package/dist/skills/ads-break-ui/references/evidence.md +0 -128
  313. package/dist/skills/ads-break-ui/references/guarded-editing.md +0 -165
  314. package/dist/skills/ads-break-ui/references/layers.md +0 -145
  315. package/dist/skills/ads-break-ui/references/reporting.md +0 -101
  316. package/dist/skills/ads-break-ui/references/review.md +0 -97
  317. package/dist/skills/ads-break-ui/references/runtimes.md +0 -203
  318. package/dist/skills/ads-break-ui/references/scenarios.md +0 -246
  319. package/dist/skills/ads-break-ui/references/validation.md +0 -166
  320. package/dist/skills/ads-break-ui/references/verification.md +0 -58
  321. package/dist/skills/ads-break-ui/references/workflows.md +0 -90
  322. package/dist/skills/ads-designer/references/reporting.md +0 -101
  323. package/dist/skills/ads-import/references/reporting.md +0 -101
  324. package/dist/skills/ads-motion/LICENSE.upstream +0 -21
  325. package/dist/skills/ads-motion/README.md +0 -22
  326. package/dist/skills/ads-motion/SKILL.md +0 -385
  327. package/dist/skills/ads-motion/agents/openai.yaml +0 -4
  328. package/dist/skills/ads-motion/references/atomic-styles.md +0 -293
  329. package/dist/skills/ads-motion/references/audit.md +0 -44
  330. package/dist/skills/ads-motion/references/behaviors.md +0 -412
  331. package/dist/skills/ads-motion/references/captures.md +0 -135
  332. package/dist/skills/ads-motion/references/contracts.md +0 -317
  333. package/dist/skills/ads-motion/references/design-data.md +0 -354
  334. package/dist/skills/ads-motion/references/drafts.md +0 -194
  335. package/dist/skills/ads-motion/references/evidence.md +0 -128
  336. package/dist/skills/ads-motion/references/guarded-editing.md +0 -165
  337. package/dist/skills/ads-motion/references/layers.md +0 -145
  338. package/dist/skills/ads-motion/references/motion-review.md +0 -35
  339. package/dist/skills/ads-motion/references/reporting.md +0 -101
  340. package/dist/skills/ads-motion/references/review.md +0 -97
  341. package/dist/skills/ads-motion/references/runtimes.md +0 -203
  342. package/dist/skills/ads-motion/references/scenarios.md +0 -246
  343. package/dist/skills/ads-motion/references/validation.md +0 -166
  344. package/dist/skills/ads-motion/references/verification.md +0 -39
  345. package/dist/skills/ads-motion/references/workflows.md +0 -90
  346. package/dist/skills/ads-port/references/reporting.md +0 -101
  347. package/dist/starters/preact/design-system/components/Layout/Grid/Grid.ads.contract.ts +0 -6
  348. package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +0 -76
  349. package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.tsx +0 -29
  350. package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
  351. package/dist/starters/preact/design-system/review/token-preview/TokenPreview.ads.contract.ts +0 -6
  352. package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +0 -137
  353. package/dist/starters/preact/design-system/showcase/mcp/main.tsx +0 -6
  354. package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +0 -7
  355. package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.scenario.tsx +0 -4
  356. package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +0 -7
  357. package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.scenario.tsx +0 -4
  358. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.contract.ts +0 -6
  359. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.exports.ts +0 -1
  360. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +0 -12
  361. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +0 -17
  362. package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +0 -75
  363. package/dist/starters/react/design-system/components/Layout/Grid/README.md +0 -21
  364. package/dist/starters/react/design-system/review/brand-preview/BrandPreview.ads.exports.ts +0 -1
  365. package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +0 -112
  366. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.tsx +0 -29
  367. package/dist/starters/react/design-system/review/grid-cell/GridCell.ads.exports.ts +0 -1
  368. package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +0 -18
  369. package/dist/starters/react/design-system/review/index.ts +0 -6
  370. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
  371. package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.contract.ts +0 -6
  372. package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.exports.ts +0 -1
  373. package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +0 -137
  374. package/dist/starters/react/design-system/showcase/mcp/index.html +0 -1
  375. package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +0 -124
  376. package/dist/starters/react/design-system/tokens/Color.ads.scenario.tsx +0 -4
  377. package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +0 -39
  378. package/dist/starters/react/design-system/tokens/Layout.ads.scenario.tsx +0 -4
  379. package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +0 -18
  380. package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +0 -4
  381. package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +0 -30
  382. package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +0 -4
  383. package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +0 -37
  384. package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +0 -4
  385. package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +0 -29
  386. package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +0 -4
  387. package/dist/starters/react/package-lock.json +0 -4707
  388. package/dist/token-fixtures.mjs +0 -30
  389. package/docs/benchmarks/bun-previews.md +0 -91
  390. package/docs/benchmarks/preview-memory.md +0 -147
  391. package/docs/benchmarks/turbo-poc.md +0 -284
  392. package/docs/plans/execution-coordination.md +0 -57
  393. /package/dist/{browser-audit → render-audit}/first-render.mjs +0 -0
  394. /package/dist/{browser-audit → render-audit}/layout-shift.mjs +0 -0
@@ -9,80 +9,165 @@ import { findingSeverity } from "./finding-rules.mjs";
9
9
  const colorCache = new Map();
10
10
  export function isColorKeyword(value) {
11
11
  if (!/^[a-z]+$/i.test(value) || /^(?:currentcolor|transparent|none|inherit|initial|unset|revert)$/i.test(value)) return false;
12
- const key=value.toLowerCase();
13
- if(!colorCache.has(key))colorCache.set(key,!!lexer.matchType("color",key).matched);
12
+ const key = value.toLowerCase();
13
+ if (!colorCache.has(key)) colorCache.set(key, !!lexer.matchType("color", key).matched);
14
14
  return colorCache.get(key);
15
15
  }
16
- const refs = value => {
17
- const names=[];
18
- valueParser(value).walk(node=>{if(node.type==="function"&&node.value==="var"){const name=node.nodes.find(child=>child.type==="word")?.value;if(name?.startsWith("--"))names.push(name);}});
16
+ const refs = (value) => {
17
+ const names = [];
18
+ valueParser(value).walk((node) => {
19
+ if (node.type === "function" && node.value === "var") {
20
+ const name = node.nodes.find((child) => child.type === "word")?.value;
21
+ if (name?.startsWith("--")) names.push(name);
22
+ }
23
+ });
19
24
  return names;
20
25
  };
21
26
 
22
- /** Resolve static interpolations through imports/local helpers; never execute project code. */
27
+ const maxDesignVariants = 256;
28
+ const variantLimit = `More than ${maxDesignVariants} distinct style alternatives; split this template into smaller source-resolvable styles.`;
29
+
30
+ /** Resolve every alternative or return an explicit incomplete result. Never execute project code. */
23
31
  export function createDesignValues(program, options) {
24
- const values=createSourceValues(program,options);
25
- function strings(input, context=values.state()) {
26
- const value=values.resolve(input,context);
27
- if(value.kind==="literal")return ["string","number"].includes(typeof value.value)?[String(value.value)]:[];
28
- if(value.kind==="union")return value.values.slice(0,16).flatMap(item=>strings(item,values.next(context)));
29
- return [];
32
+ const values = createSourceValues(program, options, { completeReturns: true });
33
+ return async (expression) => {
34
+ const strings = new Set();
35
+ let reason;
36
+ async function collect(input, context) {
37
+ if (reason) return;
38
+ const value = await values.resolve(input, context);
39
+ if (value.kind === "union") {
40
+ for (const item of value.values) {
41
+ await collect(item, values.next(context));
42
+ if (reason) break;
43
+ }
44
+ } else if (value.kind === "literal" && ["string", "number"].includes(typeof value.value)) {
45
+ strings.add(String(value.value));
46
+ if (strings.size > maxDesignVariants) reason = variantLimit;
47
+ } else reason = value.reason ?? "A style alternative is not a source-resolvable string or number.";
48
+ }
49
+ await collect(reference(expression), values.state());
50
+ return { values: [...strings], reason: reason ?? (strings.size ? undefined : "No style alternative could be established from source.") };
51
+ };
52
+ }
53
+
54
+ /** Bound the Cartesian product without silently dropping branches or unknown fragments. */
55
+ export async function designTemplateVariants(template, resolve) {
56
+ if (!template.templateSpans) return { texts: [template.text] };
57
+ let prefixes = new Set([template.head.text]);
58
+ for (const span of template.templateSpans) {
59
+ const parts = await resolve(span.expression);
60
+ if (parts.reason) return { texts: [], reason: parts.reason, node: span.expression };
61
+ const next = new Set();
62
+ for (const prefix of prefixes) for (const value of parts.values) {
63
+ next.add(prefix + value + span.literal.text);
64
+ if (next.size > maxDesignVariants) return { texts: [], reason: variantLimit, node: span.expression };
65
+ }
66
+ prefixes = next;
30
67
  }
31
- return expression => [...new Set(strings(reference(expression)))];
68
+ return { texts: [...prefixes] };
32
69
  }
33
70
 
34
71
  /** Variable names cannot conceal the typography/layering role of their consumer. */
35
72
  export function inspectDesignAliases(styles, options, report) {
36
- const declarations=[], roles=new Map(), protectedProperties=new Set(["font-family","font-weight","z-index"]);
37
- const add=(name,role)=>{if(!roles.has(name))roles.set(name,new Set());const before=roles.get(name).size;roles.get(name).add(role);return roles.get(name).size!==before;};
38
- for(const entry of styles) {
39
- if(isInside(path.join(options.dsRoot,options.config.tokenDir),entry.file))continue;
40
- entry.css.walkDecls(decl=>{
41
- if(decl.parent.type==="atrule"&&decl.parent.name.toLowerCase()==="property")return;
42
- declarations.push({...entry,decl});
43
- if(protectedProperties.has(decl.prop))for(const name of refs(decl.value))add(name,decl.prop);
73
+ const declarations = [],
74
+ roles = new Map(),
75
+ protectedProperties = new Set(["font-family", "font-weight", "z-index"]);
76
+ const add = (name, role) => {
77
+ if (!roles.has(name)) roles.set(name, new Set());
78
+ const before = roles.get(name).size;
79
+ roles.get(name).add(role);
80
+ return roles.get(name).size !== before;
81
+ };
82
+ for (const entry of styles) {
83
+ if (isInside(path.join(options.dsRoot, options.config.tokenDir), entry.file)) continue;
84
+ entry.css.walkDecls((decl) => {
85
+ if (decl.parent.type === "atrule" && decl.parent.name.toLowerCase() === "property") return;
86
+ declarations.push({ ...entry, decl });
87
+ if (protectedProperties.has(decl.prop)) for (const name of refs(decl.value)) add(name, decl.prop);
44
88
  });
45
89
  }
46
90
  // A finite fixed point includes all alias/fallback branches and imported helper styles.
47
- let changed=true;
48
- while(changed){changed=false;for(const {decl} of declarations)for(const role of roles.get(decl.prop)??[])for(const name of refs(decl.value))changed=add(name,role)||changed;}
49
- for(const {file,offset,decl} of declarations) {
50
- const selected=protectedProperties.has(decl.prop)?new Set([decl.prop]):roles.get(decl.prop);
51
- if(!selected)continue;
52
- const nodes=valueParser(decl.value).nodes.filter(node=>!["space","comment"].includes(node.type));
53
- function allowed(nodes){
54
- nodes=nodes.filter(node=>!["space","comment"].includes(node.type));
55
- if(nodes.length!==1)return false;
56
- const [node]=nodes;
57
- if(node.type==="word")return /^(?:inherit|initial|unset|revert(?:-layer)?|auto)$/.test(node.value);
58
- if(node.type!=="function"||node.value!=="var"||node.unclosed)return false;
59
- const parts=node.nodes.filter(node=>!["space","comment"].includes(node.type));
60
- return parts[0]?.type==="word"&&/^--[\w-]+$/.test(parts[0].value)&&(parts.length===1||parts[1]?.type==="div"&&parts[1].value===","&&allowed(parts.slice(2)));
91
+ let changed = true;
92
+ while (changed) {
93
+ changed = false;
94
+ for (const { decl } of declarations)
95
+ for (const role of roles.get(decl.prop) ?? []) for (const name of refs(decl.value)) changed = add(name, role) || changed;
96
+ }
97
+ for (const { file, offset, decl } of declarations) {
98
+ const selected = protectedProperties.has(decl.prop) ? new Set([decl.prop]) : roles.get(decl.prop);
99
+ if (!selected) continue;
100
+ const nodes = valueParser(decl.value).nodes.filter((node) => !["space", "comment"].includes(node.type));
101
+ function allowed(nodes) {
102
+ nodes = nodes.filter((node) => !["space", "comment"].includes(node.type));
103
+ if (nodes.length !== 1) return false;
104
+ const [node] = nodes;
105
+ if (node.type === "word") return /^(?:inherit|initial|unset|revert(?:-layer)?|auto)$/.test(node.value);
106
+ if (node.type !== "function" || node.value !== "var" || node.unclosed) return false;
107
+ const parts = node.nodes.filter((node) => !["space", "comment"].includes(node.type));
108
+ return (
109
+ parts[0]?.type === "word" &&
110
+ /^--[\w-]+$/.test(parts[0].value) &&
111
+ (parts.length === 1 || (parts[1]?.type === "div" && parts[1].value === "," && allowed(parts.slice(2))))
112
+ );
61
113
  }
62
- const valid=allowed(nodes);
63
- if(!valid)report(file,"design-value-source",`${decl.prop} reaches ${[...selected].sort().join("/")}. Map it to shared Data with a token reference; a private variable or raw fallback cannot introduce independent typography/layering values.`,offset.line+decl.source.start.line-1,decl.source.start.column,{guidanceUri:"ads://guides/tokens"});
114
+ const valid = allowed(nodes);
115
+ if (!valid)
116
+ report(
117
+ file,
118
+ "design-value-source",
119
+ `${decl.prop} reaches ${[...selected].sort().join("/")}. Map it to shared Data with a token reference; a private variable or raw fallback cannot introduce independent typography/layering values.`,
120
+ offset.line + decl.source.start.line - 1,
121
+ decl.source.start.column,
122
+ { guidanceUri: "ads://guides/tokens" },
123
+ );
64
124
  }
65
125
  }
66
126
 
67
- const canonical=value=>{try{return generate(parse(value,{context:"value"}));}catch{return value.trim();}};
127
+ const canonical = (value) => {
128
+ try {
129
+ return generate(parse(value, { context: "value" }));
130
+ } catch {
131
+ return value.trim();
132
+ }
133
+ };
68
134
  // A token's family: its shared prefix (--space-, --radius-) or, for a fixed name, the name itself.
69
- const prefixes=[...tokenContract.naming.prefixes].sort((a,b)=>b.length-a.length);
70
- const family=name=>prefixes.find(prefix=>name.startsWith(prefix)&&name.length>prefix.length)??name;
135
+ const prefixes = [...tokenContract.naming.prefixes].sort((a, b) => b.length - a.length);
136
+ const family = (name) => prefixes.find((prefix) => name.startsWith(prefix) && name.length > prefix.length) ?? name;
71
137
  /** Equal definitions within one family invite review, not an automatic merge of different
72
138
  * semantic roles. Equal values in different families (a radius and a spacing step) are scales
73
139
  * meeting by design. */
74
140
  export function tokenOverlapAdvisories(tokens) {
75
- const groups=new Map();
76
- for(const token of tokens) {
77
- if(token.owner!=="tokens"||!token.definitions.length)continue;
78
- const definitions=token.definitions.map(({scope,theme,value})=>[theme?`${scope} ${theme}`:scope,canonical(value)]).sort(([a],[b])=>a.localeCompare(b));
79
- if(definitions.every(([,value])=>/^var\(--[\w-]+\)$/.test(value))||definitions.every(([,value])=>/^(?:0|1|none|auto|inherit|initial|unset|transparent)$/.test(value)))continue;
80
- const signature=JSON.stringify([family(token.name),definitions]);
81
- if(!groups.has(signature))groups.set(signature,[]);
141
+ const groups = new Map();
142
+ for (const token of tokens) {
143
+ if (token.owner !== "tokens" || !token.definitions.length) continue;
144
+ const definitions = token.definitions
145
+ .map(({ scope, theme, value }) => [theme ? `${scope} ${theme}` : scope, canonical(value)])
146
+ .sort(([a], [b]) => a.localeCompare(b));
147
+ if (
148
+ definitions.every(([, value]) => /^var\(--[\w-]+\)$/.test(value)) ||
149
+ definitions.every(([, value]) => /^(?:0|1|none|auto|inherit|initial|unset|transparent)$/.test(value))
150
+ )
151
+ continue;
152
+ const signature = JSON.stringify([family(token.name), definitions]);
153
+ if (!groups.has(signature)) groups.set(signature, []);
82
154
  groups.get(signature).push(token);
83
155
  }
84
- return [...groups.values()].filter(group=>group.length>1).map(group=>{
85
- const [first]=group, {file,line,column}=first.definitions[0],names=group.map(token=>token.name);
86
- return {rule:"token-overlap-review",severity:findingSeverity("token-overlap-review"),file,line,column,tokens:names,guidanceUri:"ads://guides/tokens",message:`Shared Data tokens have identical definitions across their declared theme/condition scopes: ${names.slice(0,6).join(", ")}${names.length>6?` and ${names.length-6} more`:""}. Review semantic roles and consumers before consolidating. Equal values do not prove equivalent purpose; preserve distinct roles or use an explicit shared alias when appropriate.`};
87
- });
156
+ return [...groups.values()]
157
+ .filter((group) => group.length > 1)
158
+ .map((group) => {
159
+ const [first] = group,
160
+ { file, line, column } = first.definitions[0],
161
+ names = group.map((token) => token.name);
162
+ return {
163
+ rule: "token-overlap-review",
164
+ severity: findingSeverity("token-overlap-review"),
165
+ file,
166
+ line,
167
+ column,
168
+ tokens: names,
169
+ guidanceUri: "ads://guides/tokens",
170
+ message: `Shared Data tokens have identical definitions across their declared theme/condition scopes: ${names.slice(0, 6).join(", ")}${names.length > 6 ? ` and ${names.length - 6} more` : ""}. Review semantic roles and consumers before consolidating. Equal values do not prove equivalent purpose; preserve distinct roles or use an explicit shared alias when appropriate.`,
171
+ };
172
+ });
88
173
  }
@@ -1,15 +1,13 @@
1
1
  import path from "node:path";
2
2
 
3
- /** The launcher selects the runtime; Node-compatible imports work on both. */
3
+ /** ADS's tools run on Bun; this is the Bun executable running them. */
4
4
  export function developmentRuntime() {
5
- return { name: process.versions.bun ? "bun" : "node", version: process.versions.bun ?? process.versions.node,
6
- executable: process.execPath, binDir: path.dirname(process.execPath) };
5
+ return { name: "bun", version: process.versions.bun, executable: process.execPath, binDir: path.dirname(process.execPath) };
7
6
  }
8
7
 
9
- /** `runtime` is portable. Explicit interpreter names keep their meaning. */
8
+ /** `runtime` and `bun` name ADS's own Bun. A project's other interpreters (such as node) keep their meaning. */
10
9
  export function developmentExecutable(command) {
11
- const runtime = developmentRuntime();
12
- return command === "runtime" || command === runtime.name ? runtime.executable : command;
10
+ return command === "runtime" || command === "bun" ? process.execPath : command;
13
11
  }
14
12
 
15
13
  export function packageScriptCommand(manager, script) {
@@ -7,21 +7,26 @@ export function isDraftFile(file) {
7
7
  const name = file.replaceAll("\\", "/").split(/[?#]/)[0];
8
8
  return name.split("/").includes(DRAFT_DIRECTORY) || name.endsWith(".ads") || /\.ads\.draft(?:\.|$)/.test(path.basename(name));
9
9
  }
10
- export function draftImportViolation(specifier, importer, resolve) {
10
+ export async function draftImportViolation(specifier,importer,resolve){
11
11
  if (isDraftFile(importer)) return false;
12
- return isDraftFile(specifier) || resolve(specifier, importer).some(file => isDraftFile(file) || existsSync(file) && isDraftFile(realpathSync(file)));
12
+ return isDraftFile(specifier) || (await resolve(specifier,importer)).some(file=>isDraftFile(file)||existsSync(file)&&isDraftFile(realpathSync(file)));
13
13
  }
14
14
 
15
+ const isDevelopmentSource = file => /\.ads\.[^/]+$/.test(file.replaceAll("\\", "/").split(/[?#]/)[0]);
16
+ const isPreviewApi = source => /^@reqvire-org\/ads\/preview(?:[/?#]|$)/.test(source);
17
+
15
18
  /** Install in application bundlers as well as using the mandatory ADS checks. */
16
- export function draftImportGuard() {
17
- return { name: "ads-no-draft-imports", enforce: "pre",
19
+ export function developmentImportGuard() {
20
+ return { name: "ads-no-development-imports", enforce: "pre",
18
21
  async resolveId(source, importer, options) {
19
22
  if (!importer) return;
20
23
  if (isDraftFile(source)) this.error("Unaccepted ADS drafts cannot be imported. Preview with ads_show_draft, then accept the exact revision.");
24
+ if (isDevelopmentSource(source) || isPreviewApi(source)) this.error("ADS .ads.* scenarios, review helpers, styles and preview tooling cannot enter a production build.");
21
25
  const resolved = await this.resolve(source, importer, { ...options, skipSelf: true });
22
- if (resolved && (isDraftFile(resolved.id) || existsSync(resolved.id.split("?")[0]) && isDraftFile(realpathSync(resolved.id.split("?")[0])))) this.error("Unaccepted ADS drafts cannot be imported through aliases or symlinks.");
26
+ if (resolved &&( isDraftFile(resolved.id) || existsSync(resolved.id.split("?")[0]) && isDraftFile(realpathSync(resolved.id.split("?")[0])))) this.error("Unaccepted ADS drafts cannot be imported through aliases or symlinks.");
27
+ if (resolved &&( isDevelopmentSource(resolved.id) || existsSync(resolved.id.split("?")[0]) && isDevelopmentSource(realpathSync(resolved.id.split("?")[0])))) this.error("ADS development-only files cannot enter production through aliases or symlinks.");
23
28
  return resolved;
24
29
  },
25
- load(id) { if (isDraftFile(id)) this.error("Unaccepted ADS drafts are not production modules."); },
30
+ load(id) { if (isDraftFile(id)) this.error("Unaccepted ADS drafts are not production modules."); if (isDevelopmentSource(id)) this.error("ADS .ads.* files are development-only, not production modules."); },
26
31
  };
27
32
  }
package/dist/evidence.mjs CHANGED
@@ -12,7 +12,7 @@ export function acceptance(scope, passed, established, unverified) {
12
12
 
13
13
  export function architectureEvidence(result) {
14
14
  return { ...result,
15
- diagnostics: result.diagnostics.map(diagnostic => ({ ...diagnostic, ...(["style-token","design-value-source","token-name","token-ownership"].includes(diagnostic.rule)&&!diagnostic.guidanceUri?{guidanceUri:"ads://guides/tokens"}:{}), ...(/^(?:unit-contract|paint-.+|binding-.+|declarative-.+|development-role)$/.test(diagnostic.rule)&&!diagnostic.guidanceUri?{guidanceUri:"ads://guides/contracts"}:{}), ...(["declarative-consumer","binding-producer","scenario-render","scenario-exercise","showcase-control"].includes(diagnostic.rule)?{reportingGuidanceUri:"ads://guides/reporting"}:{}), failure: diagnostic.failure ?? failure("architecture", "source-analysis", diagnostic.rule) })),
15
+ diagnostics: result.diagnostics.map( (diagnostic )=>({...diagnostic,...(["style-token","design-value-source","token-name","token-ownership"].includes(diagnostic.rule)&&!diagnostic.guidanceUri?{guidanceUri:"ads://guides/tokens"}:{}),...(/^(?:unit-contract|paint-.+|binding-.+|declarative-.+|development-role)$/.test(diagnostic.rule)&&!diagnostic.guidanceUri?{guidanceUri:"ads://guides/contracts"}:{}),failure:diagnostic.failure??failure("architecture","source-analysis",diagnostic.rule)})),
16
16
  acceptance: acceptance("core-architecture", result.ok, result.ok ? ["core-source-guards"] : [], ["project-checks", "compiled-preview", "browser-behavior", "visual-parity", "accessibility-audit"]),
17
17
  };
18
18
  }
@@ -7,7 +7,7 @@ export const findingRules = Object.freeze({
7
7
  // Accessibility: deterministic source and token rules, and axe-core where the audit runs.
8
8
  "a11y-axe": "error", "a11y-focus": "error", "a11y-icon-label": "error", "a11y-image-alt": "error", "a11y-reduced-motion": "error",
9
9
  // A rendered scenario the audit could not complete after its retries.
10
- "browser-audit": "error",
10
+ "render-audit": "error",
11
11
  "a11y-non-text-contrast": "error", "a11y-target-size": "error", "a11y-text-resize": "error", "a11y-text-spacing": "error",
12
12
  // A click handler on a non-control may be reachable through a delegated or wrapping control.
13
13
  "a11y-keyboard": "review",
@@ -18,19 +18,21 @@ export const findingRules = Object.freeze({
18
18
  // Text and background a component style block pairs itself; a side that names no color token is informational.
19
19
  "component-contrast": "error", "component-contrast-unresolved": "info",
20
20
  // Brand artwork and brand token values.
21
- "brand-coverage": "error", "brand-empty": "error", "brand-license": "error", "brand-new-token": "error", "brand-preview": "error", "brand-readme": "error",
21
+ "brand-coverage": "error", "brand-empty": "error", "brand-license": "error", "brand-new-token": "error", "brand-readme": "error",
22
22
  // Artwork may be used by code ADS cannot trace (a CMS, a server template).
23
23
  "brand-unused": "review",
24
24
  "control-padding": "error",
25
+ // Explicit artwork/text relationships, not universal artwork geometry.
26
+ "lockup-construction": "error",
25
27
  // Widths are fluid on the grid: fixed widths from source, and overflow where the audit renders.
26
28
  "layout-fixed-width": "error", "layout-overflow": "error",
27
29
  // Whether a declared width must stay fixed, a fluid wrapper does anything, or a part ever sits in
28
30
  // a narrow pane takes judgement.
29
- "layout-declared-width": "review", "layout-width-noop": "review", "layout-overflow-narrow": "review",
31
+ "layout-declared-width": "review", "layout-overflow-narrow": "review",
30
32
  // Rendered at a shape other than the one declared: cropped or stretched.
31
33
  "img-shape": "error",
32
34
  // What the audit could not measure, by reason; a render whose targets could none be measured is for review.
33
- "browser-audit-skipped": "info", "browser-audit-nothing-measured": "review",
35
+ "render-audit-skipped": "info", "render-audit-nothing-measured": "review",
34
36
  // Images reserve their space and choose how they load; a spread or foreign class cannot be read.
35
37
  "img-attributes": "error", "img-attributes-unresolved": "info",
36
38
  "asset-image-budget": "error", "asset-font-budget": "error",
@@ -71,7 +73,7 @@ export function findingSeverity(rule) {
71
73
  }
72
74
 
73
75
  /** A finding carrying its rule's registered severity. */
74
- export const classified = finding => ({ ...finding, severity: findingSeverity(finding.rule) });
76
+ export const classified = (finding )=>({...finding,severity:findingSeverity(finding.rule)});
75
77
 
76
78
  /** Route findings by class: errors join the blocking diagnostics; review and info items stay
77
79
  * nonblocking, review before info. Findings without a severity take their rule's. */
@@ -59,7 +59,7 @@ export function createFontRules({ root, dsRoot, config }, tokens) {
59
59
  return {
60
60
  /** Reads one style sheet or Linaria template. */
61
61
  collect(css, target, offset = { line: 1 }) {
62
- const source = decl => ({ file: relative(target), line: offset.line + (decl.source?.start.line ?? 1) - 1 });
62
+ const source = (decl )=>({file:relative(target),line:offset.line+(decl.source?.start.line??1)-1});
63
63
  // A Linaria template's own declarations sit at the root of what it parses to.
64
64
  const owners = new Set();
65
65
  css.walkDecls(/^font(?:-family|-weight)?$/i, decl => { if (decl.parent.type !== "atrule" || !/^font-face$/i.test(decl.parent.name)) owners.add(decl.parent); });
@@ -78,7 +78,7 @@ export function createFontRules({ root, dsRoot, config }, tokens) {
78
78
  }
79
79
  },
80
80
  findings() {
81
- const findings = preloadFindings(), covering = (family, weight) => faces.some(face => face.family === family && !face.italic && (face.auto || face.low <= weight && weight <= face.high));
81
+ const findings = preloadFindings(), covering = (family, weight) => faces.some(face => face.family === family && !face.italic &&( face.auto || face.low <= weight && weight <= face.high));
82
82
  if (bodyFamily) { named.add(bodyFamily); inherited.delete(bodyFamily); for (const { weight, where } of pending) note(bodyFamily, weight, where); }
83
83
  pending = [];
84
84
  for (const [family, uses] of used) for (const [weight, where] of uses) if (!covering(family, weight)) {
@@ -29,10 +29,10 @@ export function fontFaces(text) {
29
29
  }
30
30
 
31
31
  /** Whether a unicode-range covers Latin capital A, the subset first text needs. */
32
- const coversLatin = range => !range || range.split(",").some(part => { const [first, last = first] = part.trim().replace(/^U\+/i, "").split("-").map(item => parseInt(item.replaceAll("?", "0"), 16)); return first <= 0x41 && 0x41 <= (part.includes("?") ? first + 0xff : last); });
32
+ const coversLatin = range => !range || range.split(",").some(part => { const [first, last = first] = part.trim().replace(/^U\+/i, "").split("-").map(item => parseInt(item.replaceAll("?", "0"), 16)); return first <= 0x41 && 0x41 <=( part.includes("?") ? first + 0xff : last); });
33
33
 
34
34
  /** The face a named family and weight loads for first text: upright, covering Latin and that weight. */
35
- export const preloadFace = (faces, { family, weight }) => faces.find(face => face.family === family && face.slant === "normal" && coversLatin(face.range) && (face.auto || face.low <= weight && weight <= face.high));
35
+ export const preloadFace = (faces, { family, weight }) => faces.find(face => face.family === family && face.slant === "normal" && coversLatin(face.range) &&( face.auto || face.low <= weight && weight <= face.high));
36
36
 
37
37
  /** The font and weight of the body and of headings, as base.css sets them. */
38
38
  function firstTextFonts(text, values) {
@@ -0,0 +1,238 @@
1
+ import { existsSync, lstatSync, readFileSync, readdirSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { validTokenSamples } from "./token-samples.mjs";
4
+ import postcss from "postcss";
5
+ import spatial from "./spatial-model.cjs";
6
+ import { inspectSpatial } from "./spatial.mjs";
7
+
8
+ // Definition metadata is project data. Markup, layout and interaction belong to
9
+ // the tool template, shared by the native showcase and MCP preview resource graph.
10
+ export const foundationCatalogFile = "catalog.ads.json";
11
+ const relative = (root, file) => path.relative(root, file).replaceAll("\\", "/");
12
+ const imageTypes = { ".svg": "image/svg+xml", ".png": "image/png", ".webp": "image/webp", ".jpg": "image/jpeg", ".jpeg": "image/jpeg" };
13
+ const defaultSamples = {
14
+ color: ["background-color", "rgb(17, 31, 47)"],
15
+ dimension: ["width", "13.375px"],
16
+ fontFamily: ["font-family", "monospace, serif"],
17
+ shadow: ["box-shadow", "none"],
18
+ duration: ["transition-duration", "137ms"],
19
+ easing: ["transition-timing-function", "linear"],
20
+ };
21
+
22
+ /** What a token's sample shows, from the CSS property it is sampled with. One rule for
23
+ * the server (which splits views into sections) and the view (which draws the sample). */
24
+ export function tokenSampleKind(property = "") {
25
+ if (/^(font-|line-height|letter-spacing)/.test(property)) return "type";
26
+ if (property === "color") return "text";
27
+ if (property.includes("color")) return "color";
28
+ if (/^(animation|transition)-(duration|timing-function)/.test(property)) return "motion";
29
+ if (/^(width|min-width|max-width|inline-size|padding|margin|gap|column-gap|row-gap)/.test(property)) return "length";
30
+ if (/^(height|min-height|max-height|block-size)$/.test(property)) return "height";
31
+ if (property === "column-count" || property === "grid-template-columns") return "columns";
32
+ if (property === "box-shadow") return "shadow";
33
+ if (/radius|border.*width|outline.*width|opacity/.test(property)) return "shape";
34
+ if (property === "z-index") return "layer";
35
+ if (property === "filter") return "effect";
36
+ return "value";
37
+ }
38
+ // Sections in display order. A catalog group is a sidebar group (like a folder above owners);
39
+ // each section of it is one page (like an owner).
40
+ const sections = [
41
+ ["color", "Color fills"], ["text", "Text colors"],
42
+ ["font-family", "Font families"], ["font-size", "Text sizes"], ["font-weight", "Font weights"], ["line-height", "Line heights"], ["letter-spacing", "Letter spacing"],
43
+ ["length", "Dimensions"], ["height", "Heights"], ["columns", "Columns"],
44
+ ["shape", "Shape"], ["shadow", "Shadows"], ["layer", "Layers"], ["effect", "Effects"],
45
+ ["duration", "Durations"], ["easing", "Easing"], ["value", "Values"],
46
+ ];
47
+ export function tokenSection(property = "") {
48
+ const kind = tokenSampleKind(property);
49
+ const key = kind === "type" ? property : kind === "motion" ? (property.endsWith("duration") ? "duration" : "easing") : kind;
50
+ const index = sections.findIndex(([name]) => name === key);
51
+ return { key, title: sections[index]?.[1] ?? "Samples", order: index < 0 ? sections.length : index };
52
+ }
53
+
54
+ export function foundationViews(options, inventory) {
55
+ const { root, dsRoot, config } = options;
56
+ const catalog = path.join(dsRoot, config.tokenDir, foundationCatalogFile);
57
+ const diagnostics = [],
58
+ metadata = new Map(),
59
+ groups = new Map();
60
+ const report = (message) => diagnostics.push({ file: relative(root, catalog), rule: "foundation-catalog", line: 1, column: 1, message });
61
+ if (existsSync(catalog)) {
62
+ try {
63
+ const data = JSON.parse(readFileSync(catalog, "utf8"));
64
+ if (data.schemaVersion !== 1 || !Array.isArray(data.groups) || Object.keys(data).some((key) => !["schemaVersion", "groups"].includes(key)))
65
+ throw new Error("Expected schemaVersion: 1 and groups.");
66
+ for (const group of data.groups) {
67
+ if (
68
+ !/^[\w-]+$/.test(group.id) ||
69
+ typeof group.title !== "string" ||
70
+ !group.title.trim() ||
71
+ groups.has(group.id) ||
72
+ !Array.isArray(group.samples) ||
73
+ (group.samples.length && !validTokenSamples(group.samples)) ||
74
+ Object.keys(group).some((key) => !["id", "title", "samples"].includes(key))
75
+ )
76
+ throw new Error("Each group needs a unique id, title and valid CSS samples; presentation code is not supported.");
77
+ groups.set(group.id, { id: group.id, title: group.title, tokens: [] });
78
+ for (const sample of group.samples) {
79
+ if (metadata.has(sample.token)) throw new Error(`${sample.token} belongs to more than one group.`);
80
+ metadata.set(sample.token, { group: group.id, ...sample });
81
+ }
82
+ }
83
+ const names = new Set(inventory.tokens.map((token) => token.name));
84
+ for (const name of metadata.keys()) if (!names.has(name)) report(`Remove metadata for undefined token ${name}.`);
85
+ } catch (error) {
86
+ report(`Invalid foundation metadata: ${error.message}`);
87
+ }
88
+ }
89
+ for (const token of inventory.tokens) {
90
+ const declared = metadata.get(token.name);
91
+ // Unknown semantics stay a value/dependency readout. Never invent a visual
92
+ // binding from a name; explicit metadata or the shared type supplies it.
93
+ const id = declared?.group ?? "Values";
94
+ if (!groups.has(id)) groups.set(id, { id, title: "Values", tokens: [] });
95
+ const sample = declared ?? (defaultSamples[token.type] && { property: defaultSamples[token.type][0], probe: defaultSamples[token.type][1] });
96
+ groups.get(id).tokens.push({ ...token, ...(sample ? { property: sample.property, probe: sample.probe } : {}) });
97
+ }
98
+ const view = (id, title, tokens, group, order) => ({
99
+ id: `tokens/${id}`,
100
+ // Sections list in display order (fills before text, sizes before weights), not by key.
101
+ ...(order === undefined ? {} : { sortKey: `tokens/${id.split("/")[0]}/${String(order).padStart(2, "0")}` }),
102
+ kind: "tokens",
103
+ title,
104
+ ...(group ? { group } : {}),
105
+ covers: [],
106
+ tokens: tokens.map((token) => token.name),
107
+ file: tokens[0].definitions[0].file,
108
+ foundation: { schemaVersion: 1, kind: "tokens", title, tokens },
109
+ });
110
+ const views = [...groups.values()]
111
+ .filter((group) => group.tokens.length)
112
+ .flatMap((group) => {
113
+ const tokens = group.tokens.map((token) => ({ ...token, sampleKind: tokenSampleKind(token.property), section: tokenSection(token.property) }));
114
+ const split = new Map();
115
+ for (const token of tokens) {
116
+ if (!split.has(token.section.key)) split.set(token.section.key, []);
117
+ split.get(token.section.key).push(token);
118
+ }
119
+ // One section stays one page; the grid reference belongs with all of its tokens.
120
+ if (split.size < 2 || group.id === "Layout") return [view(group.id, group.title, tokens)];
121
+ return [...split.values()]
122
+ .sort((a, b) => a[0].section.order - b[0].section.order)
123
+ .map((items) => view(`${group.id}/${items[0].section.key}`, items[0].section.title, items, group.title, items[0].section.order));
124
+ });
125
+ try {
126
+ const model = inspectSpatial(options)?.model;
127
+ const grid = views.find((view) => view.id === "tokens/Layout");
128
+ if (model && grid) {
129
+ const examples = [
130
+ ...Object.keys(model.gutters).map((mode) => ({
131
+ id: `fluid-${mode}`,
132
+ title: `Fluid · ${mode} gutters`,
133
+ definition: `@ads-layout fluid { gutter: ${mode}; row-gap: ${model.miniUnit}; @ads-cell .a { span: full; } @ads-cell .b { span: 1; } @ads-cell .c { start: 2; span: full; } }`,
134
+ })),
135
+ { id: "fixed", title: "Fixed tiles · wrapping", definition: `@ads-layout fixed { tile: ${model.scale.at(-1)}; row-gap: ${model.miniUnit}; }` },
136
+ { id: "flow", title: "Vertical rhythm · natural content height", definition: `@ads-layout flow { row-gap: ${model.scale[2] ?? model.miniUnit}; }` },
137
+ {
138
+ id: "hybrid",
139
+ title: "Hybrid · one fixed track beside fluid tracks",
140
+ definition: `@ads-layout hybrid { columns: 13; fixed-start: ${model.scale.at(-1)}; gutter: wide; row-gap: ${model.miniUnit}; @ads-cell .a { span: 1; } @ads-cell .b { start: 2; span: 12; } }`,
141
+ },
142
+ {
143
+ id: "push",
144
+ title: "Panels · a docked panel pushes the main region",
145
+ definition: `@ads-layout hybrid { columns: 3; fixed-start: ${model.scale.at(-1)}; fixed-end: ${model.scale.at(-1)}; gutter: none; margin: --space-0; @ads-cell .a { span: 1; row: 1; } @ads-cell .b { start: 2; span: 1; row: 1; } @ads-cell .c { start: 3; span: 1; row: 1; } }`,
146
+ },
147
+ {
148
+ id: "cover",
149
+ title: "Panels · a floating panel covers the main region",
150
+ definition: `@ads-layout hybrid { columns: 3; fixed-start: ${model.scale.at(-1)}; fixed-end: ${model.scale.at(-1)}; gutter: none; margin: --space-0; @ads-cell .a { span: 1; row: 1; } @ads-cell .b { start: 2; span: 2; row: 1; } @ads-cell .c { start: 3; span: 1; row: 1; overlay: end; } }`,
151
+ },
152
+ {
153
+ id: "nested",
154
+ title: "Inherited tracks · shared keylines",
155
+ definition: `@ads-layout fluid { gutter: wide; @ads-cell .a { span: full; @ads-layout inherited { gutter: narrow; @ads-cell .b { span: 1; } @ads-cell .c { start: 2; span: full; } } } }`,
156
+ },
157
+ ];
158
+ // Each grid role the spatial definition names, followed through var() to the primitive it
159
+ // uses. Names come from the project's definition; nothing assumes --grid-* or --space-*.
160
+ const definitions = new Map(inventory.tokens.map((token) => [token.name, token.definitions.find((item) => !item.theme && !item.brand) ?? token.definitions[0]]));
161
+ const chain = (name) => {
162
+ const steps = [name];
163
+ for (let current = name; steps.length < 8; ) {
164
+ const next = definitions.get(current)?.value?.trim().match(/^var\(\s*(--[\w-]+)\s*\)$/)?.[1];
165
+ if (!next || steps.includes(next)) break;
166
+ steps.push(next);
167
+ current = next;
168
+ }
169
+ return { chain: steps, value: definitions.get(steps.at(-1))?.value ?? null };
170
+ };
171
+ const roles = [
172
+ { role: "Mini unit", token: model.miniUnit },
173
+ { role: "Fine unit", token: model.fineUnit },
174
+ ...Object.entries(model.gutters).flatMap(([mode, gutter]) => [
175
+ { role: `Gutter · ${mode} · start`, token: gutter.start },
176
+ { role: `Gutter · ${mode} · end`, token: gutter.end },
177
+ ]),
178
+ ...model.breakpoints.map((point) => ({ role: `Outer margin · ${point.name}`, token: point.margin })),
179
+ ...(model.maxWidth ? [{ role: "Maximum width", token: model.maxWidth }] : []),
180
+ ].map((item) => ({ ...item, ...chain(item.token) }));
181
+ // Each token in a chain links to the view that shows it.
182
+ const viewOf = new Map(views.flatMap((view) => view.tokens.map((name) => [name, view.id])));
183
+ for (const role of roles) role.links = Object.fromEntries(role.chain.filter((name) => viewOf.has(name)).map((name) => [name, viewOf.get(name)]));
184
+ grid.foundation.spatial = {
185
+ roles,
186
+ miniUnit: model.miniUnit,
187
+ fineUnit: model.fineUnit,
188
+ scale: model.scale,
189
+ ratios: model.ratios,
190
+ breakpoints: model.breakpoints,
191
+ examples: examples.map((example) => ({
192
+ ...example,
193
+ css: spatial.expandSpatialStyles(postcss.parse(`.ads-grid-example-${example.id} { ${example.definition} }`), model).toString(),
194
+ })),
195
+ };
196
+ }
197
+ } catch (error) {
198
+ report(error.message);
199
+ }
200
+ const directory = path.join(dsRoot, "assets/brand");
201
+ // Subfolders such as pictograms/ are brand artwork too: the brand checks
202
+ // walk them, so the view shows them under their relative names.
203
+ const brandFiles = (folder, prefix = "") => {
204
+ const stat = lstatSync(folder, { throwIfNoEntry: false });
205
+ if (!stat || stat.isSymbolicLink() || !stat.isDirectory()) return [];
206
+ return readdirSync(folder, { withFileTypes: true })
207
+ .sort((a, b) => a.name.localeCompare(b.name))
208
+ .flatMap((entry) => {
209
+ const name = prefix ? `${prefix}/${entry.name}` : entry.name;
210
+ if (entry.isSymbolicLink()) return [];
211
+ return entry.isDirectory() ? brandFiles(path.join(folder, entry.name), name) : entry.isFile() ? [name] : [];
212
+ });
213
+ };
214
+ const artwork = brandFiles(directory).flatMap((name) => {
215
+ const file = path.join(directory, name),
216
+ type = imageTypes[path.extname(name).toLowerCase()];
217
+ if (!type || lstatSync(file).size > 1024 * 1024) return [];
218
+ return [
219
+ {
220
+ name,
221
+ file: relative(root, file),
222
+ src: `data:${type};base64,${readFileSync(file).toString("base64")}`,
223
+ appIcon: path.resolve(dsRoot, config.assets.iconSource ?? ".") === file,
224
+ },
225
+ ];
226
+ });
227
+ if (artwork.length)
228
+ views.unshift({
229
+ id: "brand/Assets",
230
+ kind: "brand",
231
+ title: "Brand assets",
232
+ covers: [],
233
+ tokens: [],
234
+ file: artwork[0].file,
235
+ foundation: { schemaVersion: 1, kind: "brand", title: "Brand assets", artwork },
236
+ });
237
+ return { views: views.map((view) => ({ ...view, artifact: `.ds/scenarios/${view.id}/index.html` })), diagnostics };
238
+ }