@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/dist/themes.mjs DELETED
@@ -1,360 +0,0 @@
1
- import selectorParser from "postcss-selector-parser";
2
- import valueParser from "postcss-value-parser";
3
- import { findingSeverity } from "./finding-rules.mjs";
4
-
5
- // A theme is a named set of token values: roles keep their names, values change. A token that
6
- // differs per theme is written as one half per declared theme, plain values on :root (and on
7
- // [data-brand="<name>"] for a brand): --color-accent-9-light, --color-accent-9-dark. ADS
8
- // generates themes.generated.css from the halves: one switch per theme on [data-theme="<name>"]
9
- // and a resolver that picks the active theme's half on every themed or branded element, so
10
- // themes and brands nest at any depth, each following its nearest ancestor.
11
-
12
- export const defaultThemes = [
13
- { name: "light", scheme: "light" },
14
- { name: "dark", scheme: "dark" },
15
- ];
16
-
17
- export function validateThemes(themes) {
18
- if (!Array.isArray(themes) || !themes.length || themes.length > 8) throw new Error("themes must list 1–8 themes; the first is the default.");
19
- const names = new Set();
20
- for (const [index, theme] of themes.entries()) {
21
- const field = `themes[${index}]`;
22
- if (!theme || typeof theme !== "object" || Array.isArray(theme)) throw new Error(`${field} must be an object with name and scheme.`);
23
- const unknown = Object.keys(theme).filter((key) => !["name", "scheme"].includes(key));
24
- if (unknown.length) throw new Error(`${field} has unknown keys: ${unknown.join(", ")}.`);
25
- if (typeof theme.name !== "string" || !/^[a-z][a-z0-9-]{0,31}$/.test(theme.name))
26
- throw new Error(`${field}.name must be a lowercase name such as "dark" or "high-contrast".`);
27
- if (!["light", "dark"].includes(theme.scheme))
28
- throw new Error(`${field}.scheme must be "light" or "dark": the color scheme browsers use for native controls.`);
29
- if (names.has(theme.name)) throw new Error(`Theme "${theme.name}" is declared twice.`);
30
- names.add(theme.name);
31
- }
32
- }
33
-
34
- const cache = new Map();
35
- const rootNode = (node) => (node.type === "pseudo" && node.value.toLowerCase() === ":root") || (node.type === "tag" && node.value.toLowerCase() === "html");
36
- const unquote = (value) => value.replace(/^["']|["']$/g, "");
37
-
38
- /** Where a token declaration applies: the default brand ({ kind: "root" }: :root or html, or the
39
- * default brand's [data-brand]), one brand ({ kind: "brand", brand }), the old theme form
40
- * ({ kind: "old" }: a [data-theme] value block, a prefers-color-scheme block, a valueless or
41
- * combined [data-brand]), or anything else ({ kind: "conditional" }: @media and other selectors). */
42
- export function classifyScope(scope, defaultBrand) {
43
- const key = `${defaultBrand ?? ""}\0${scope}`;
44
- if (cache.has(key)) return cache.get(key);
45
- let result;
46
- if (/data-theme|prefers-color-scheme/i.test(scope)) result = { kind: "old" };
47
- else if (scope.includes("@") || scope.includes(" > ")) result = { kind: "conditional" };
48
- else {
49
- try {
50
- let old = false,
51
- other = false;
52
- const brands = [];
53
- selectorParser((root) => {
54
- for (const selector of root.nodes) {
55
- let brand = null;
56
- for (const node of selector.nodes) {
57
- if (node.type === "comment" || rootNode(node)) continue;
58
- if (node.type === "attribute" && node.attribute === "data-brand") {
59
- if (node.value === undefined || node.operator !== "=" || brand !== null) old = true;
60
- else brand = unquote(node.value);
61
- continue;
62
- }
63
- if (node.type === "combinator" && /data-brand/.test(scope)) old = true;
64
- other = true;
65
- }
66
- brands.push(brand === defaultBrand ? null : brand);
67
- }
68
- }).processSync(scope);
69
- result = old
70
- ? { kind: "old" }
71
- : other
72
- ? { kind: "conditional" }
73
- : new Set(brands).size > 1
74
- ? { kind: "old" }
75
- : brands[0] === null
76
- ? { kind: "root" }
77
- : { kind: "brand", brand: brands[0] };
78
- } catch {
79
- result = { kind: "conditional" };
80
- }
81
- }
82
- cache.set(key, result);
83
- return result;
84
- }
85
-
86
- const plainScope = (where) => where.kind === "root" || where.kind === "brand";
87
-
88
- /** Token definitions from the token sheets' custom property declarations ({ prop, value, file,
89
- * line, column, scope }, in source order). A name ending in a declared theme's name is a half
90
- * when another theme's half of the same token exists: --x-light and --x-dark form the themed
91
- * token --x, whose definitions carry their theme. Definitions carry their brand (null for the
92
- * default brand); a half's value names other halves of its own theme by their token name, and
93
- * keeps the authored text and property. */
94
- export function buildTokens(declarations, { themes = defaultThemes, brands = [] } = {}) {
95
- const names = themes.map((theme) => theme.name).sort((a, b) => b.length - a.length);
96
- const split = (prop) => {
97
- if (themes.length < 2) return null;
98
- for (const name of names) if (prop.endsWith(`-${name}`) && prop.length > name.length + 3) return { base: prop.slice(0, -name.length - 1), theme: name };
99
- return null;
100
- };
101
- const entries = declarations.map((declaration) => ({ ...declaration, where: classifyScope(declaration.scope, brands[0]?.name) }));
102
- const halves = new Map();
103
- for (const entry of entries) {
104
- const half = plainScope(entry.where) && split(entry.prop);
105
- if (!half) continue;
106
- if (!halves.has(half.base)) halves.set(half.base, new Set());
107
- halves.get(half.base).add(half.theme);
108
- }
109
- const themed = new Set([...halves].filter(([, set]) => set.size > 1).map(([base]) => base));
110
- const halfOf = (prop) => {
111
- const half = split(prop);
112
- return half && themed.has(half.base) ? half : null;
113
- };
114
- const normalize = (value, theme) => {
115
- const parsed = valueParser(value);
116
- parsed.walk((node) => {
117
- if (node.type !== "function" || node.value !== "var") return;
118
- const word = node.nodes.find((child) => child.type === "word");
119
- const half = word && halfOf(word.value);
120
- if (half?.theme === theme) word.value = half.base;
121
- });
122
- return parsed.toString();
123
- };
124
- const tokens = new Map();
125
- for (const entry of entries) {
126
- const half = halfOf(entry.prop),
127
- name = half ? half.base : entry.prop;
128
- const definition = {
129
- file: entry.file,
130
- line: entry.line,
131
- column: entry.column,
132
- scope: entry.scope,
133
- value: half ? normalize(entry.value, half.theme) : entry.value,
134
- theme: half?.theme ?? null,
135
- brand: entry.where.kind === "brand" ? entry.where.brand : null,
136
- ...(half ? { property: entry.prop, authored: entry.value } : {}),
137
- ...(entry.where.kind === "conditional" ? { conditional: true } : entry.where.kind === "old" ? { conditional: true, old: true } : {}),
138
- };
139
- if (!tokens.has(name)) tokens.set(name, []);
140
- tokens.get(name).push(definition);
141
- }
142
- return [...tokens]
143
- .sort(([a], [b]) => a.localeCompare(b))
144
- .map(([name, definitions]) => ({ name, ...(themed.has(name) ? { themed: true } : {}), definitions }));
145
- }
146
-
147
- const applies = (definition) => !definition.conditional;
148
-
149
- /** A token's definition where a theme and a brand apply: the brand's own one, else the default
150
- * brand's; within a brand the theme's half, else the single value. Undefined brand = default. */
151
- export function contextDefinition(token, { theme, brand } = {}) {
152
- const matches = (definition) => applies(definition) && (definition.theme === null || definition.theme === theme);
153
- return (
154
- (brand !== undefined && brand !== null ? token.definitions.findLast((definition) => definition.brand === brand && matches(definition)) : undefined) ??
155
- token.definitions.findLast((definition) => definition.brand === null && matches(definition))
156
- );
157
- }
158
-
159
- /** A token's default-brand definition: its single value, else its half for the named theme
160
- * (the first half when no theme is named). */
161
- export function baseDefinition(token, theme) {
162
- const own = token.definitions.filter((definition) => applies(definition) && definition.brand === null);
163
- return own.findLast((definition) => definition.theme === null) ?? own.find((definition) => theme === undefined || definition.theme === theme);
164
- }
165
-
166
- /** A token's default-brand definition in one theme. */
167
- export const themeDefinition = (token, theme) => contextDefinition(token, { theme });
168
-
169
- /** Every token and half by name in one theme and brand, each with its authored value, so
170
- * var() references resolve the way the browser does there. */
171
- export function contextValues(tokens, { theme, brand, themes }) {
172
- const values = new Map();
173
- for (const token of tokens) {
174
- const own = contextDefinition(token, { theme, brand });
175
- if (own) values.set(token.name, { ...own, value: own.authored ?? own.value });
176
- if (!token.themed) continue;
177
- for (const { name } of themes) {
178
- const half = contextDefinition(token, { theme: name, brand });
179
- if (half) values.set(`${token.name}-${name}`, { ...half, value: half.authored ?? half.value });
180
- }
181
- }
182
- return values;
183
- }
184
-
185
- /** A value with its single var() aliases followed in one context; null when unresolved. */
186
- export function resolveValue(values, name, seen = new Set()) {
187
- if (seen.has(name)) return null;
188
- const value = values.get(name)?.value?.trim();
189
- const reference = value?.match(/^var\(\s*(--[\w-]+)\s*(?:,([^)]*))?\)$/);
190
- if (!reference) return value ?? null;
191
- return values.has(reference[1]) ? resolveValue(values, reference[1], new Set([...seen, name])) : reference[2]?.trim() || null;
192
- }
193
-
194
- export const referencedTokens = (value) => {
195
- const names = [];
196
- valueParser(value).walk((node) => {
197
- if (node.type === "function" && node.value === "var") {
198
- const word = node.nodes.find((child) => child.type === "word");
199
- if (word?.value.startsWith("--")) names.push(word.value);
200
- }
201
- });
202
- return names;
203
- };
204
-
205
- /** Tokens that follow the theme: themed tokens and every default single value that refers to
206
- * one, directly or through other tokens. The generated resolver re-resolves them per element. */
207
- export function themeDependents(tokens) {
208
- const dependent = new Set(tokens.filter((token) => token.themed).map((token) => token.name));
209
- for (let changed = true; changed; ) {
210
- changed = false;
211
- for (const token of tokens) {
212
- if (dependent.has(token.name)) continue;
213
- const base = baseDefinition(token);
214
- if (base && base.theme === null && referencedTokens(base.value).some((name) => dependent.has(name))) {
215
- dependent.add(token.name);
216
- changed = true;
217
- }
218
- }
219
- }
220
- return dependent;
221
- }
222
-
223
- export const nameList = (names) => (names.length === 1 ? names[0] : `${names.length} tokens (${names.slice(0, 3).join(", ")}${names.length > 3 ? ", …" : ""})`);
224
-
225
- /** The theme form: old [data-theme] value blocks are errors; a themed token has a default half
226
- * for every declared theme, only halves, and halves that refer to other halves. */
227
- export function themeFindings(tokens, themes, { dsDir } = {}) {
228
- const diagnostics = [],
229
- advisories = [];
230
- const error = (rule, at, message, names) =>
231
- diagnostics.push({ rule, file: at.file, line: at.line, column: at.column, ...(names ? { tokens: names } : {}), message });
232
- const finding = (rule, at, message, names) =>
233
- (findingSeverity(rule) === "error" ? diagnostics : advisories).push({
234
- rule,
235
- severity: findingSeverity(rule),
236
- file: at.file,
237
- line: at.line,
238
- column: at.column,
239
- ...(names ? { tokens: names } : {}),
240
- guidanceUri: "ads://guides/tokens",
241
- message,
242
- });
243
- // One finding per old rule, naming what it sets.
244
- const old = new Map();
245
- for (const token of tokens)
246
- for (const definition of token.definitions.filter((definition) => definition.old)) {
247
- const key = `${definition.file}\0${definition.scope}`;
248
- if (!old.has(key)) old.set(key, { at: definition, names: [] });
249
- old.get(key).names.push(token.name);
250
- }
251
- for (const { at, names } of [...old.values()].sort((a, b) => a.at.file.localeCompare(b.at.file) || a.at.line - b.at.line)) {
252
- const theme =
253
- at.scope.match(/data-theme\s*=\s*["']?([\w-]+)/)?.[1] ??
254
- (/prefers-color-scheme\s*:\s*dark/.test(at.scope) ? "dark" : (themes[1]?.name ?? themes[0].name));
255
- error(
256
- "theme-old-form",
257
- at,
258
- `Old theme form: ${at.scope} sets ${nameList(names)}. Write per-theme halves on :root (or [data-brand="<name>"]) instead, such as ${names[0]}-${theme}; ADS generates the theme switches.`,
259
- names,
260
- );
261
- }
262
- if (themes.length < 2) return { diagnostics, advisories };
263
- const dependent = themeDependents(tokens);
264
- for (const token of tokens.filter((token) => token.themed)) {
265
- const own = token.definitions.filter((definition) => applies(definition) && definition.brand === null);
266
- const single = own.find((definition) => definition.theme === null);
267
- if (single)
268
- error(
269
- "theme-half-conflict",
270
- single,
271
- `${token.name} is set both as one value and as per-theme halves (${token.definitions.find((definition) => definition.property)?.property}, …); keep only the halves.`,
272
- [token.name],
273
- );
274
- const missing = own.length ? themes.filter((theme) => !own.some((definition) => definition.theme === theme.name)).map((theme) => theme.name) : [];
275
- if (missing.length)
276
- error(
277
- "theme-coverage",
278
- own.find((definition) => definition.theme !== null) ?? own[0],
279
- `${token.name} has no ${missing.map((name) => `${token.name}-${name}`).join(", ")} on :root; a themed token needs a half for every declared theme, or it is unset in ${missing.join(", ")}.`,
280
- [token.name],
281
- );
282
- }
283
- // A half is resolved where it is declared, on :root or a brand: it names halves, not tokens that follow the theme.
284
- const byName = new Map(tokens.map((token) => [token.name, token]));
285
- // The half a theme-following alias stands for: --accent → --color-accent-9 → --color-accent-9-dark.
286
- const halfFor = (name, theme, seen = new Set()) => {
287
- const token = byName.get(name);
288
- if (token?.themed) return `${name}-${theme}`;
289
- const alias =
290
- !seen.has(name) &&
291
- baseDefinition(token ?? { definitions: [] })
292
- ?.value.trim()
293
- .match(/^var\(\s*(--[\w-]+)\s*\)$/)?.[1];
294
- return alias ? halfFor(alias, theme, new Set([...seen, name])) : null;
295
- };
296
- for (const token of tokens.filter((token) => token.themed))
297
- for (const definition of token.definitions.filter((definition) => applies(definition) && definition.authored)) {
298
- const wrong = referencedTokens(definition.authored).filter((name) => dependent.has(name));
299
- if (wrong.length)
300
- error(
301
- "theme-half-reference",
302
- definition,
303
- `${definition.property} refers to ${wrong.join(", ")}, which follows the theme; a half is resolved where it is declared, so refer to ${wrong.map((name) => halfFor(name, definition.theme) ?? `halves of ${name}`).join(", ")}.`,
304
- [token.name],
305
- );
306
- }
307
- // A lone half-like name: the other themes' halves are missing, so it is a plain token.
308
- const declared = new Set(tokens.map((token) => token.name));
309
- for (const token of tokens.filter((token) => !token.themed)) {
310
- const theme = themes.slice(1).find((theme) => token.name.endsWith(`-${theme.name}`));
311
- const base = theme && token.name.slice(0, -theme.name.length - 1);
312
- const at = token.definitions.find(applies);
313
- if (base && at && !declared.has(base))
314
- finding(
315
- "theme-new-token",
316
- at,
317
- `${token.name} reads as the ${theme.name} half of ${base}, but no other theme gives ${base}; add ${themes
318
- .filter((item) => item !== theme)
319
- .map((item) => `${base}-${item.name}`)
320
- .join(", ")} on :root, or rename it.`,
321
- [token.name],
322
- );
323
- }
324
- // While the old form remains, theme-old-form already names what to write.
325
- if (!tokens.some((token) => token.themed) && !old.size && dsDir)
326
- for (const theme of themes.slice(1))
327
- finding(
328
- "theme-empty",
329
- { file: dsDir, line: 1, column: 1 },
330
- `Theme "${theme.name}" is declared but no token has a ${theme.name} half; give the tokens that change per theme halves such as --color-accent-9-${themes[0].name} and --color-accent-9-${theme.name}, or remove it from ds.config.json.`,
331
- );
332
- return { diagnostics, advisories };
333
- }
334
-
335
- /** Whether a component/pattern selector reads the theme or brand from an ancestor or the root
336
- * ([data-theme="dark"] &, :root[data-theme="dark"] &, :is([data-brand="acme"]) &): such a
337
- * selector matches the outermost themed ancestor, not the nearest section, so it is an error. */
338
- export function themeAncestorSelector(selector) {
339
- let found = false;
340
- try {
341
- selectorParser((root) =>
342
- root.walkAttributes((node) => {
343
- if (!["data-theme", "data-brand"].includes(node.attribute)) return;
344
- // The selector's own subject compound (&[data-theme="dark"]) is the section itself.
345
- let top = node;
346
- while (top.parent && top.parent.type !== "root") top = top.parent;
347
- const compound = top.nodes,
348
- index = compound.indexOf(node);
349
- const own =
350
- index >= 0 &&
351
- !compound.slice(index).some((part) => part.type === "combinator") &&
352
- !compound.some((part) => part.type === "pseudo" && part.value.toLowerCase() === ":root");
353
- if (!own) found = true;
354
- }),
355
- ).processSync(selector);
356
- } catch {
357
- /* CSS syntax diagnostics are owned by the parser/build. */
358
- }
359
- return found;
360
- }
@@ -1,94 +0,0 @@
1
- import { inspectTokens } from "./tokens.mjs";
2
- import { parseColor } from "./token-quality.mjs";
3
- import { contextDefinition, contextValues, resolveValue } from "./themes.mjs";
4
-
5
- // The W3C Design Tokens Community Group format (draft): JSON groups of tokens with $value,
6
- // $type and {group.token} references. The format has no themes yet: a document holds one
7
- // theme's (and one brand's) values, and the other themes' and brands' values travel in this
8
- // tool's $extensions entry (values, keyed "dark", "acme" or "acme/dark"), as do CSS values the
9
- // format cannot express.
10
- const extension = "org.reqvire.ads";
11
-
12
- /** A token's path in the export: its family, then the rest of its name. */
13
- function tokenPath(name) {
14
- const bare = name.slice(2),
15
- dash = bare.indexOf("-");
16
- return dash < 0 ? [bare, "$root"] : [bare.slice(0, dash), bare.slice(dash + 1)];
17
- }
18
- const reference = (name) => `{${tokenPath(name).join(".")}}`;
19
-
20
- /** A CSS value as a DTCG value and type, or null when the format cannot express it. */
21
- function typed(name, value) {
22
- const text = value.trim();
23
- const alias = text.match(/^var\(\s*(--[\w-]+)\s*\)$/);
24
- if (alias) return { $value: reference(alias[1]) };
25
- const color = parseColor(text);
26
- if (color && !/^(?:--font-|--weight-|--leading-|--z-)/.test(name)) {
27
- const hex = `#${color
28
- .slice(0, 3)
29
- .map((channel) => Math.round(channel).toString(16).padStart(2, "0"))
30
- .join("")}`;
31
- return {
32
- $type: "color",
33
- $value: {
34
- colorSpace: "srgb",
35
- components: color.slice(0, 3).map((channel) => Number((channel / 255).toFixed(4))),
36
- ...(color[3] < 1 ? { alpha: color[3] } : {}),
37
- hex,
38
- },
39
- };
40
- }
41
- let match = text.match(/^(-?\d*\.?\d+)(px|rem)$/);
42
- if (match) return { $type: "dimension", $value: { value: Number(match[1]), unit: match[2] } };
43
- match = text.match(/^(\d*\.?\d+)(ms|s)$/);
44
- if (match) return { $type: "duration", $value: { value: Number(match[1]), unit: match[2] } };
45
- match = text.match(/^cubic-bezier\(([^)]*)\)$/);
46
- if (match) return { $type: "cubicBezier", $value: match[1].split(",").map(Number) };
47
- if (name.startsWith("--font-")) return { $type: "fontFamily", $value: text.split(",").map((family) => family.trim().replace(/^["']|["']$/g, "")) };
48
- if (name.startsWith("--weight-") && /^\d+$/.test(text)) return { $type: "fontWeight", $value: Number(text) };
49
- if (/^-?\d*\.?\d+$/.test(text)) return { $type: "number", $value: Number(text) };
50
- return null;
51
- }
52
-
53
- /** The project's tokens as one DTCG document, with the values of one theme and one brand
54
- * (default: the first of each). */
55
- export async function exportTokensDtcg(directory, { theme, brand } = {}, inventory) {
56
- if (inventory === undefined) inventory = await inspectTokens(directory);
57
- const { tokens, themes, brands = [] } = inventory;
58
- if (theme !== undefined && !themes.some((item) => item.name === theme))
59
- throw new Error(`Unknown theme "${theme}"; the project declares ${themes.map((item) => item.name).join(", ")}.`);
60
- if (brand !== undefined && !brands.some((item) => item.name === brand))
61
- throw new Error(
62
- `Unknown brand "${brand}"; ${brands.length ? `the project declares ${brands.map((item) => item.name).join(", ")}` : "the project declares no brands"}.`,
63
- );
64
- const selected = theme ?? themes[0].name,
65
- own = brand === brands[0]?.name ? undefined : brand;
66
- const names = new Set(tokens.map((token) => token.name));
67
- let values;
68
- const document = {};
69
- for (const token of tokens) {
70
- const base = contextDefinition(token, { theme: selected, brand: own });
71
- if (!base) continue;
72
- // A half that names another theme's half has no DTCG alias; export its resolved value.
73
- const alias = base.value.trim().match(/^var\(\s*(--[\w-]+)\s*\)$/)?.[1];
74
- const value =
75
- alias && !names.has(alias)
76
- ? (resolveValue((values ??= contextValues(tokens, { theme: selected, brand: own, themes })), token.name) ?? base.value)
77
- : base.value;
78
- const entry = typed(token.name, value) ?? { $value: value.trim() };
79
- if (!("$type" in entry) && !entry.$value.toString().startsWith("{")) entry.$extensions = { [extension]: { css: value.trim() } };
80
- if (token.meaning) entry.$description = token.meaning;
81
- // The other contexts: a theme ("dark"), a brand ("acme") or both ("acme/dark"), or a condition.
82
- const label = (definition) => (definition.conditional ? definition.scope : [definition.brand, definition.theme].filter(Boolean).join("/") || "default");
83
- const others = Object.fromEntries(
84
- token.definitions
85
- .filter((definition) => definition !== base)
86
- .map((definition) => [label(definition), (typed(token.name, definition.value) ?? { $value: definition.value.trim() }).$value]),
87
- );
88
- if (Object.keys(others).length) entry.$extensions = { ...entry.$extensions, [extension]: { ...entry.$extensions?.[extension], values: others } };
89
- const [group, key] = tokenPath(token.name);
90
- document[group] ??= {};
91
- document[group][key] = entry;
92
- }
93
- return document;
94
- }
@@ -1,24 +0,0 @@
1
- import valueParser from "postcss-value-parser";
2
-
3
- /** Read-only provenance for project policies. No token-name or design semantics
4
- * are inferred. stopAt is an explicit project-selected vocabulary. */
5
- export function inspectTokenOrigins(inventory, name, { stopAt = [] } = {}) {
6
- const allowed=new Set(stopAt),tokens=new Map(inventory.tokens.map(token=>[token.name,token]));
7
- const origins=new Set(),literals=[],diagnostics=[];let steps=0;
8
- function visit(name,seen=new Set()) {
9
- if(++steps>256){diagnostics.push("Token provenance exceeded 256 branches.");return;}
10
- const token=tokens.get(name);
11
- if(!token){diagnostics.push(`Undefined token ${name}.`);return;}
12
- if(allowed.has(name)){origins.add(name);return;}
13
- if(seen.has(name)){diagnostics.push(`Cyclic alias through ${name}.`);return;}
14
- seen=new Set([...seen,name]);
15
- for(const definition of token.definitions) {
16
- const nodes=valueParser(definition.value).nodes.filter(node=>!["space","comment"].includes(node.type));
17
- const ref=nodes.length===1&&nodes[0].type==="function"&&nodes[0].value==="var"&&nodes[0].nodes.filter(node=>!["space","comment"].includes(node.type));
18
- if(ref&&ref.length===1&&ref[0].type==="word"&&/^--[\w-]+$/.test(ref[0].value))visit(ref[0].value,seen);
19
- else literals.push({token:name,...definition});
20
- }
21
- }
22
- visit(name);
23
- return {token:name,origins:[...origins].sort(),literals,diagnostics,aliasOnly:origins.size>0&&!literals.length&&!diagnostics.length};
24
- }
@@ -1,26 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import path from "node:path";
3
- import valueParser from "postcss-value-parser";
4
-
5
- export const tokenContract = JSON.parse(readFileSync(new URL("./contracts/tokens.json", import.meta.url), "utf8"));
6
-
7
- export function isSharedToken(name) {
8
- return (
9
- name in tokenContract.tokens ||
10
- tokenContract.naming.names.includes(name) ||
11
- tokenContract.naming.prefixes.some((prefix) => name.startsWith(prefix) && name.length > prefix.length)
12
- );
13
- }
14
-
15
- // The foundation sheets in import order; themes.generated.css comes last, after every sheet it re-applies.
16
- export const foundationFiles = ["fonts.css", "colors.css", "typography.css", "spacing.css", "elevation.css", "base.css", "themes.generated.css"];
17
-
18
- /** The foundation entry accepts only a single, unconditional local import. */
19
- export function foundationImportTarget(node, file) {
20
- if (node.type !== "atrule" || node.name !== "import" || node.nodes) return null;
21
- const parts = valueParser(node.params).nodes.filter((part) => part.type !== "space" && part.type !== "comment");
22
- if (parts.length !== 1) return null;
23
- const part = parts[0];
24
- const value = part.type === "string" ? part.value : part.type === "function" && part.value === "url" && part.nodes.length === 1 ? part.nodes[0].value : null;
25
- return value ? path.resolve(path.dirname(file), value) : null;
26
- }
@@ -1,149 +0,0 @@
1
- import { contextValues, defaultThemes } from "./themes.mjs";
2
- import { paletteContexts, resolveColorToken } from "./palette-generated.mjs";
3
- import { findingSeverity } from "./finding-rules.mjs";
4
-
5
- /** Accessibility and rhythm reviews of token values: WCAG contrast between the roles that
6
- * meet on screen, in every theme and brand, and spacing steps on the 2 px grid. Both are
7
- * errors; a contrast pair ADS cannot resolve statically is an info item. */
8
-
9
- const named = { white: [255, 255, 255, 1], black: [0, 0, 0, 1] };
10
-
11
- /** sRGB channels and alpha of a hex, rgb()/rgba() or hsl()/hsla() color; null otherwise. */
12
- export function parseColor(value) {
13
- const text = value.trim().toLowerCase();
14
- if (named[text]) return named[text];
15
- let match = text.match(/^#([0-9a-f]{3,8})$/);
16
- if (match) {
17
- let hex = match[1];
18
- if (hex.length === 3 || hex.length === 4) hex = [...hex].map(digit => digit + digit).join("");
19
- if (hex.length !== 6 && hex.length !== 8) return null;
20
- const channels = [0, 2, 4].map(index => parseInt(hex.slice(index, index + 2), 16));
21
- return [...channels, hex.length === 8 ? parseInt(hex.slice(6), 16) / 255 : 1];
22
- }
23
- match = text.match(/^(rgba?|hsla?)\((.*)\)$/);
24
- if (!match) return null;
25
- const parts = match[2].split(/[\s,/]+/).filter(Boolean);
26
- if (parts.length < 3) return null;
27
- const alpha = parts[3] === undefined ? 1 : parts[3].endsWith("%") ? parseFloat(parts[3]) / 100 : parseFloat(parts[3]);
28
- if (match[1].startsWith("rgb")) {
29
- const channels = parts.slice(0, 3).map(part => part.endsWith("%") ? parseFloat(part) * 2.55 : parseFloat(part));
30
- return channels.some(Number.isNaN) ? null : [...channels, alpha];
31
- }
32
- const [h, s, l] = [parseFloat(parts[0]), parseFloat(parts[1]) / 100, parseFloat(parts[2]) / 100];
33
- if ([h, s, l].some(Number.isNaN)) return null;
34
- const k = n => (n + h / 30) % 12, a = s * Math.min(l, 1 - l);
35
- const f = n => 255 *( l - a * Math.max(-1, Math.min(k(n) - 3, 9 - k(n), 1)));
36
- return [f(0), f(8), f(4), alpha];
37
- }
38
-
39
- const luminance = ([r, g, b]) => {
40
- const channel = value => { value /= 255; return value <= 0.04045 ? value / 12.92 : ((value+0.055)/1.055) ** 2.4; };
41
- return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);
42
- };
43
- export const over = (top, bottom) => [0, 1, 2].map(index => top[index] * top[3] + bottom[index] *( 1 - top[3])).concat(1);
44
- /** WCAG 2 contrast ratio of a foreground over an opaque background. */
45
- export function contrastRatio(foreground, background) {
46
- const [a, b] = [luminance(over(foreground, background)), luminance(background)];
47
- return (Math.max(a, b) + 0.05) /( Math.min(a, b) + 0.05);
48
- }
49
-
50
- const textBackgrounds = ["--bg-canvas", "--bg-surface", "--bg-raised", "--bg-field", "--bg-hover"];
51
- /** The roles that meet on screen. Text needs 4.5:1 (WCAG 1.4.3); focus indicators and the
52
- * borders that identify controls need 3:1 (1.4.11). */
53
- export function contrastPairs(names) {
54
- const pairs = [];
55
- for (const text of ["--text-strong", "--text-body", "--text-muted", "--text-link", "--accent-text"]) for (const background of textBackgrounds) pairs.push([text, background, 4.5]);
56
- pairs.push(["--accent-fg", "--accent", 4.5], ["--accent-fg", "--accent-hover", 4.5]);
57
- for (const status of ["success", "warning", "danger", "info"]) pairs.push([`--${status}-fg`, `--${status}`, 4.5], [`--${status}-text`, `--${status}-bg`, 4.5]);
58
- for (const ui of ["--border-focus", "--border-strong"]) for (const background of ["--bg-canvas", "--bg-surface"]) pairs.push([ui, background, 3]);
59
- return pairs.filter(([foreground, background]) => names.has(foreground) && names.has(background));
60
- }
61
-
62
- export const contrastLabel = ({ theme, brand }) => brand === undefined ? `the ${theme.name} theme` : `the ${theme.name} theme of brand "${brand}"`;
63
- const sameEntry = (first, second) => first?.color && second?.color ? first.color.every((value, index) => value === second.color[index]) : !first?.color && !second?.color && first?.value === second?.value;
64
-
65
- /** Every theme × brand context with a cached color resolver. `color(name)` resolves in the
66
- * context; `changed(name)` tells whether a brand other than the default changes the token from
67
- * the theme's default value (always true for the default brand); `canvas` is the opaque
68
- * --bg-canvas a translucent background composites over; `opaque(entry, name)` composites it. */
69
- export function contrastContexts(tokens, themes = defaultThemes, brands = []) {
70
- const defaults = new Map(themes.map(theme => [theme.name, contextValues(tokens, { theme: theme.name, themes })]));
71
- return paletteContexts({ themes, brands }).map(context => {
72
- const { theme, brand } = context, scheme = theme.scheme, own = brand === undefined;
73
- const values = own ? defaults.get(theme.name) : contextValues(tokens, { theme: theme.name, brand, themes });
74
- const resolved = new Map(), base = new Map();
75
- const color = (name, from = values, cache = resolved) => { if (!cache.has(name)) cache.set(name, resolveColorToken(from, name, scheme)); return cache.get(name); };
76
- const canvasEntry = color("--bg-canvas");
77
- const canvas = canvasEntry?.color ? over(canvasEntry.color, [255, 255, 255, 1]) : [255, 255, 255, 1];
78
- return { context, label: contrastLabel(context), own, values, color: name => color(name),
79
- changed: name => own || !sameEntry(color(name), color(name, defaults.get(theme.name), base)),
80
- canvas, opaque: (entry, name) => entry.color[3] < 1 ? over(entry.color, name === "--bg-canvas" ? [255, 255, 255, 1] : canvas) : entry.color };
81
- });
82
- }
83
-
84
- /** WCAG contrast of every role pair in every theme of every brand. Colors resolve the way the
85
- * generated palette resolves them (resolveColorToken: the per-theme halves, aliases and var()
86
- * fallbacks, light-dark() by the theme's scheme, every CSS color syntax and color-mix(), clipped
87
- * to sRGB). WCAG compares opaque colors, so alpha is composited as the page paints it: a
88
- * translucent background over --bg-canvas (the canvas itself over white), then a translucent
89
- * foreground over that background. A brand other than the default reports only the pairs whose
90
- * colors it changes. A pair color that cannot be resolved statically (currentColor, relative
91
- * color syntax, a system color, a non-color value) is reported once per token and value as a
92
- * token-contrast-unresolved info item instead of being checked. */
93
- export function tokenContrastAdvisories(tokens, themes = defaultThemes, brands = []) {
94
- const names = new Set(tokens.map(token => token.name));
95
- const advisories = [], unresolved = new Map();
96
- const pairs = contrastPairs(names);
97
- for (const { label, values, color, changed, opaque } of contrastContexts(tokens, themes, brands)) {
98
- for (const [foreground, background, minimum] of pairs) {
99
- const front = color(foreground), back = color(background);
100
- if (!front || !back) continue;
101
- if (!changed(foreground) && !changed(background)) continue;
102
- const missing = [[foreground, front, background], [background, back, foreground]].filter(([, entry]) => !entry.color);
103
- for (const [name, entry, partner] of missing) {
104
- const key = `${name}\u0000${entry.value}`;
105
- const item = unresolved.get(key) ?? { name, value: entry.value, reason: entry.unresolved ?? "not a color", at: values.get(name), contexts: new Set(), partners: new Set() };
106
- item.contexts.add(label); item.partners.add(partner);
107
- unresolved.set(key, item);
108
- }
109
- if (missing.length) continue;
110
- const ratio = contrastRatio(front.color, opaque(back, background));
111
- if (ratio + 1e-9 >= minimum) continue;
112
- const at = values.get(foreground);
113
- if (!at) continue;
114
- const { file, line, column } = at;
115
- advisories.push({ rule: "token-contrast", severity: findingSeverity("token-contrast"), file, line, column, tokens: [foreground, background], guidanceUri: "ads://guides/tokens",
116
- message: `${foreground} on ${background} is ${ratio.toFixed(2)}:1 in ${label}; ${minimum === 4.5 ? "text needs 4.5:1 (WCAG 1.4.3)" : "focus indicators and control borders need 3:1 (WCAG 1.4.11)"}.` });
117
- }
118
- }
119
- for (const { name, value, reason, at, contexts, partners } of unresolved.values()) {
120
- advisories.push({ rule: "token-contrast-unresolved", severity: findingSeverity("token-contrast-unresolved"), ...(at ? { file: at.file, line: at.line, column: at.column } : {}), tokens: [name, ...partners], guidanceUri: "ads://guides/tokens",
121
- message: `${name} is ${value} in ${[...contexts].join(", ")}, which ADS cannot resolve to a color statically (${reason}), so its contrast with ${[...partners].join(", ")} is not checked. Set it to a color or a ramp step, or check the pages that use it with ads audit.` });
122
- }
123
- return advisories;
124
- }
125
-
126
- /** Pixels of a px/rem/0 length, or null. */
127
- const pixels = value => {
128
- const match = value.trim().match(/^(-?\d*\.?\d+)(px|rem)?$/);
129
- if (!match ||( !match[2] && Number(match[1]) !== 0)) return null;
130
- return Number(match[1]) *( match[2] === "rem" ? 16 : 1);
131
- };
132
-
133
- /** Numbered spacing steps sit on the 2 px grid, --space-N at N × 2 px. */
134
- export function tokenRhythmAdvisories(tokens) {
135
- const advisories = [];
136
- for (const token of tokens) {
137
- const step = token.name.match(/^--space-(\d+)$/)?.[1];
138
- if (step === undefined) continue;
139
- for (const { file, line, column, value, scope, property } of token.definitions) {
140
- const size = pixels(value);
141
- if (size === null) continue;
142
- const expected = Number(step) * 2;
143
- if (size % 2 === 0 && size === expected) continue;
144
- advisories.push({ rule: "token-rhythm", severity: findingSeverity("token-rhythm"), file, line, column, tokens: [token.name], guidanceUri: "ads://guides/tokens",
145
- message: `${token.name} is ${size}px${property ? ` as ${property}` : ""}${scope === ":root" ? "" : ` in ${scope}`}; the spacing scale is --space-N = N × 2 px (${expected}px), on a 2 px grid.` });
146
- }
147
- }
148
- return advisories;
149
- }