@reqvire-org/ads 0.3.53 → 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 (401) hide show
  1. package/README.md +114 -94
  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 +6 -6
  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 +222 -79
  21. package/dist/boundaries.mjs +137 -40
  22. package/dist/brand-assets.mjs +219 -47
  23. package/dist/brands.mjs +86 -27
  24. package/dist/bun-compiler.mjs +34 -13
  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 +66 -0
  30. package/dist/check.mjs +756 -196
  31. package/dist/cli.mjs +203 -100
  32. package/dist/color-values.mjs +21 -21
  33. package/dist/component-contrast.mjs +2 -2
  34. package/dist/config.mjs +308 -163
  35. package/dist/construction-styles.cjs +10 -0
  36. package/dist/contracts.d.mts +9 -0
  37. package/dist/control-padding.mjs +45 -25
  38. package/dist/css-values.mjs +3 -2
  39. package/dist/declarative-flow.mjs +209 -109
  40. package/dist/design-values.mjs +136 -51
  41. package/dist/development-runtime.mjs +4 -6
  42. package/dist/draft-boundary.mjs +11 -6
  43. package/dist/evidence.mjs +1 -1
  44. package/dist/finding-rules.mjs +7 -5
  45. package/dist/font-rules.mjs +2 -2
  46. package/dist/fonts-generated.mjs +4 -2
  47. package/dist/foundation-views.mjs +238 -0
  48. package/dist/foundation.mjs +63 -39
  49. package/dist/generated-entries.mjs +198 -0
  50. package/dist/icons.mjs +80 -33
  51. package/dist/image-attributes.mjs +109 -36
  52. package/dist/image-size.mjs +1 -1
  53. package/dist/index.mjs +0 -2
  54. package/dist/init.mjs +128 -68
  55. package/dist/investigations.mjs +2 -2
  56. package/dist/layers.mjs +300 -127
  57. package/dist/layout-widths.mjs +180 -85
  58. package/dist/linaria/preserve-values.cjs +7 -0
  59. package/dist/linaria/spatial-inputs.cjs +56 -0
  60. package/dist/lockup-composition.mjs +44 -0
  61. package/dist/lockup-model.cjs +64 -0
  62. package/dist/mcp/THIRD_PARTY_NOTICES.md +51 -1
  63. package/dist/mcp/apps.mjs +4 -30
  64. package/dist/mcp/behavior-pages.mjs +72 -24
  65. package/dist/mcp/build-status.mjs +257 -64
  66. package/dist/mcp/catalog.mjs +91 -26
  67. package/dist/mcp/context.mjs +17 -18
  68. package/dist/mcp/draft-discovery.mjs +44 -21
  69. package/dist/mcp/drafts.mjs +978 -343
  70. package/dist/mcp/execution-coordinator.mjs +417 -167
  71. package/dist/mcp/execution-results.mjs +7 -7
  72. package/dist/mcp/mutations.mjs +701 -219
  73. package/dist/mcp/preview-watch.mjs +465 -161
  74. package/dist/mcp/preview-widget.bundle.js +44 -50
  75. package/dist/mcp/prompts.mjs +6 -6
  76. package/dist/mcp/result-pages.mjs +1 -1
  77. package/dist/mcp/sandbox-host.mjs +1 -1
  78. package/dist/mcp/server.mjs +2436 -570
  79. package/dist/mcp/showcase-host.mjs +176 -39
  80. package/dist/mcp/skills.mjs +1 -1
  81. package/dist/mcp/text-diff.mjs +29 -10
  82. package/dist/paint-contracts.mjs +174 -81
  83. package/dist/palette-generated.mjs +2 -2
  84. package/dist/preview-bun.mjs +493 -187
  85. package/dist/preview-failure.mjs +1 -1
  86. package/dist/preview-files.mjs +13 -13
  87. package/dist/preview-imports.mjs +104 -55
  88. package/dist/preview-inputs.mjs +2 -2
  89. package/dist/preview-requests.mjs +24 -0
  90. package/dist/preview-resources.mjs +288 -147
  91. package/dist/preview-scope.mjs +5 -4
  92. package/dist/program-cache.mjs +10 -0
  93. package/dist/project-documents.mjs +1 -1
  94. package/dist/public-api.mjs +70 -31
  95. package/dist/public-props.mjs +39 -22
  96. package/dist/{browser-audit → render-audit}/axe-run.mjs +3 -3
  97. package/dist/{browser-audit → render-audit}/image-shape.mjs +2 -2
  98. package/dist/{browser-audit → render-audit}/layout-overflow.mjs +86 -23
  99. package/dist/{browser-audit → render-audit}/non-text-contrast.mjs +86 -27
  100. package/dist/{browser-audit → render-audit}/render-states.mjs +208 -52
  101. package/dist/{browser-audit → render-audit}/worker.mjs +86 -30
  102. package/dist/render-audit.mjs +828 -0
  103. package/dist/render-color-probe.mjs +96 -42
  104. package/dist/resource-limits.mjs +229 -97
  105. package/dist/runtime-contracts.mjs +467 -185
  106. package/dist/scenario-groups.mjs +22 -10
  107. package/dist/scenario-inspector.mjs +6 -43
  108. package/dist/scenario-program.mjs +8 -25
  109. package/dist/scenario-registry.mjs +72 -30
  110. package/dist/scenario-selectors.mjs +161 -64
  111. package/dist/scenario-slots.mjs +149 -56
  112. package/dist/scenario-trace.mjs +215 -109
  113. package/dist/scenarios-compiler.mjs +768 -359
  114. package/dist/scenarios-vite.d.mts +1 -3
  115. package/dist/scenarios-vite.mjs +2 -81
  116. package/dist/scenarios.mjs +424 -159
  117. package/dist/selector-match.mjs +2 -2
  118. package/dist/showcase/client.bundle.js +57 -56
  119. package/dist/showcase/draft-navigation.js +18 -0
  120. package/dist/showcase/favicon.ico +0 -0
  121. package/dist/showcase/favicon.svg +1 -0
  122. package/dist/showcase/foundation-view.css +55 -0
  123. package/dist/showcase/foundation-view.mjs +252 -0
  124. package/dist/showcase/guide-controls.ads.review.mjs +32 -0
  125. package/dist/showcase/icons.js +1 -145
  126. package/dist/showcase/index.html +3 -31
  127. package/dist/showcase/preview-frame.ads.review.css +46 -0
  128. package/dist/showcase/preview-frame.ads.review.d.mts +11 -0
  129. package/dist/showcase/preview-frame.ads.review.mjs +22 -0
  130. package/dist/showcase/preview-state.js +0 -9
  131. package/dist/showcase/refresh-scheduler.js +23 -0
  132. package/dist/showcase/style.css +5 -47
  133. package/dist/showcase/ui/ui.css +1353 -0
  134. package/dist/showcase/ui/ui.js +1062 -0
  135. package/dist/showcase-coverage.mjs +58 -37
  136. package/dist/skills/README.md +24 -23
  137. package/dist/skills/ads-designer/README.md +8 -2
  138. package/dist/skills/ads-designer/SKILL.md +152 -144
  139. package/dist/skills/ads-designer/references/accessibility.md +14 -11
  140. package/dist/skills/ads-designer/references/atomic-styles.md +4 -4
  141. package/dist/skills/ads-designer/references/behaviors.md +34 -30
  142. package/dist/skills/ads-designer/references/branding.md +98 -10
  143. package/dist/skills/ads-designer/references/captures.md +31 -31
  144. package/dist/skills/ads-designer/references/cli.md +21 -20
  145. package/dist/skills/ads-designer/references/contracts.md +63 -29
  146. package/dist/skills/ads-designer/references/design-data.md +49 -52
  147. package/dist/skills/ads-designer/references/drafts.md +71 -52
  148. package/dist/skills/ads-designer/references/evidence.md +1 -5
  149. package/dist/skills/ads-designer/references/guarded-editing.md +58 -51
  150. package/dist/skills/ads-designer/references/layers.md +1 -1
  151. package/dist/skills/ads-designer/references/layout.md +347 -0
  152. package/dist/skills/ads-designer/references/mobile.md +2 -1
  153. package/dist/skills/{ads-motion/references/performance.md → ads-designer/references/motion-performance.md} +5 -1
  154. package/dist/skills/{ads-motion/references/build.md → ads-designer/references/motion.md} +73 -5
  155. package/dist/skills/ads-designer/references/performance.md +3 -2
  156. package/dist/skills/ads-designer/references/review.md +42 -38
  157. package/dist/skills/ads-designer/references/runtimes.md +33 -30
  158. package/dist/skills/ads-designer/references/scenarios.md +17 -19
  159. package/dist/skills/{ads-break-ui/references/catalog.md → ads-designer/references/stress-catalog.md} +3 -1
  160. package/dist/skills/ads-designer/references/stress-test.md +68 -0
  161. package/dist/skills/ads-designer/references/validation.md +83 -71
  162. package/dist/skills/ads-designer/references/workflows.md +19 -37
  163. package/dist/skills/ads-import/SKILL.md +43 -328
  164. package/dist/skills/ads-import/references/atomic-styles.md +4 -4
  165. package/dist/skills/ads-import/references/behaviors.md +34 -30
  166. package/dist/skills/ads-import/references/branding.md +5 -5
  167. package/dist/skills/ads-import/references/captures.md +31 -31
  168. package/dist/skills/ads-import/references/cli.md +21 -20
  169. package/dist/skills/ads-import/references/compatibility.md +1 -1
  170. package/dist/skills/ads-import/references/contracts.md +63 -29
  171. package/dist/skills/ads-import/references/design-data.md +49 -52
  172. package/dist/skills/ads-import/references/drafts.md +71 -52
  173. package/dist/skills/ads-import/references/evidence.md +1 -5
  174. package/dist/skills/ads-import/references/guarded-editing.md +58 -51
  175. package/dist/skills/ads-import/references/implementation.md +2 -1
  176. package/dist/skills/ads-import/references/layers.md +1 -1
  177. package/dist/skills/ads-import/references/layout.md +347 -0
  178. package/dist/skills/ads-import/references/review.md +42 -38
  179. package/dist/skills/ads-import/references/runtimes.md +33 -30
  180. package/dist/skills/ads-import/references/scenarios.md +17 -19
  181. package/dist/skills/ads-import/references/tokens.md +3 -3
  182. package/dist/skills/ads-import/references/validation.md +83 -71
  183. package/dist/skills/ads-import/references/workflows.md +19 -37
  184. package/dist/skills/ads-migrate/SKILL.md +56 -0
  185. package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +602 -0
  186. package/dist/skills/ads-port/SKILL.md +54 -346
  187. package/dist/skills/ads-port/references/atomic-styles.md +4 -4
  188. package/dist/skills/ads-port/references/behaviors.md +34 -30
  189. package/dist/skills/ads-port/references/captures.md +31 -31
  190. package/dist/skills/ads-port/references/cli.md +21 -20
  191. package/dist/skills/ads-port/references/contracts.md +63 -29
  192. package/dist/skills/ads-port/references/design-data.md +49 -52
  193. package/dist/skills/ads-port/references/drafts.md +71 -52
  194. package/dist/skills/ads-port/references/evidence.md +1 -5
  195. package/dist/skills/ads-port/references/guarded-editing.md +58 -51
  196. package/dist/skills/ads-port/references/layers.md +1 -1
  197. package/dist/skills/ads-port/references/layout.md +347 -0
  198. package/dist/skills/ads-port/references/lint-and-docs.md +8 -11
  199. package/dist/skills/ads-port/references/native-implementation.md +8 -7
  200. package/dist/skills/ads-port/references/review.md +42 -38
  201. package/dist/skills/ads-port/references/runtimes.md +33 -30
  202. package/dist/skills/ads-port/references/scenarios.md +17 -19
  203. package/dist/skills/ads-port/references/validation.md +83 -71
  204. package/dist/skills/ads-port/references/workflows.md +19 -37
  205. package/dist/source-symbols.mjs +1 -8
  206. package/dist/source-values.mjs +266 -128
  207. package/dist/spatial-composition.mjs +322 -0
  208. package/dist/spatial-contexts.cjs +56 -0
  209. package/dist/spatial-css.cjs +351 -0
  210. package/dist/spatial-inputs.cjs +80 -0
  211. package/dist/spatial-metadata.mjs +18 -0
  212. package/dist/spatial-model.cjs +322 -0
  213. package/dist/spatial.mjs +21 -0
  214. package/dist/stage-timing.cjs +20 -0
  215. package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +105 -0
  216. package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +275 -0
  217. package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
  218. package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
  219. package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +8 -0
  220. package/dist/starters/preact/ds.config.json +24 -19
  221. package/dist/starters/preact/package.json +4 -8
  222. package/dist/starters/preact/tsconfig.json +4 -5
  223. package/dist/starters/preact/vite.config.ts +3 -3
  224. package/dist/starters/react/ADS.md +42 -47
  225. package/dist/starters/react/README.md +54 -52
  226. package/dist/starters/react/design-system/components/Actions/Button/Button.ads.exports.ts +1 -0
  227. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.exports.ts +1 -0
  228. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +18 -2
  229. package/dist/starters/react/design-system/components/Actions/IconButton/README.md +3 -0
  230. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.exports.ts +1 -0
  231. package/dist/starters/react/design-system/components/Content/Image/Image.ads.exports.ts +1 -0
  232. package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.exports.ts +1 -0
  233. package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.exports.ts +1 -0
  234. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/README.md +5 -0
  235. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.fixture.ts +13 -0
  236. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.scenario.tsx +22 -0
  237. package/dist/starters/react/design-system/controllers/Palette/Palette.ads.exports.ts +1 -0
  238. package/dist/starters/react/design-system/index.ts +5 -8
  239. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.exports.ts +1 -0
  240. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.fixture.ts +7 -0
  241. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.scenario.tsx +15 -0
  242. package/dist/starters/react/design-system/patterns/Conversation/Conversation.tsx +105 -0
  243. package/dist/starters/react/design-system/patterns/Conversation/README.md +9 -0
  244. package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.exports.ts +1 -0
  245. package/dist/starters/react/design-system/patterns/Shell/Floating.ads.fixture.ts +5 -0
  246. package/dist/starters/react/design-system/patterns/Shell/Floating.ads.scenario.tsx +21 -0
  247. package/dist/starters/react/design-system/patterns/Shell/README.md +43 -0
  248. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.exports.ts +1 -0
  249. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.fixture.ts +5 -0
  250. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +21 -0
  251. package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +274 -0
  252. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +1 -0
  253. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
  254. package/dist/starters/react/design-system/review/index.ads.review.ts +4 -0
  255. package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.exports.ts +1 -0
  256. package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.review.tsx +6 -0
  257. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +1 -0
  258. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
  259. package/dist/starters/react/design-system/showcase/mcp/{main.tsx → main.ads.mount.tsx} +4 -2
  260. package/dist/starters/react/design-system/styles.css +1 -0
  261. package/dist/starters/react/design-system/tokens/catalog.ads.json +1221 -0
  262. package/dist/starters/react/design-system/tokens/colors.css +1 -1
  263. package/dist/starters/react/design-system/tokens/spacing.css +22 -32
  264. package/dist/starters/react/design-system/tokens/spatial.ads.json +70 -0
  265. package/dist/starters/react/design-system/tokens/themes.generated.ts +1 -1
  266. package/dist/starters/react/ds.config.json +24 -19
  267. package/dist/starters/react/package.json +2 -6
  268. package/dist/starters/react/tsconfig.json +2 -3
  269. package/dist/starters/react/vite.config.ts +3 -3
  270. package/dist/style-boundaries.mjs +73 -27
  271. package/dist/task-cache.mjs +173 -72
  272. package/dist/task-worker.mjs +22 -11
  273. package/dist/test-boundaries.mjs +133 -60
  274. package/dist/themes-generated.mjs +1 -1
  275. package/dist/themes-watch.mjs +60 -19
  276. package/dist/themes.mjs +176 -73
  277. package/dist/token-export.mjs +39 -14
  278. package/dist/token-policy.mjs +6 -3
  279. package/dist/token-quality.mjs +6 -6
  280. package/dist/token-samples.mjs +16 -5
  281. package/dist/tokens.mjs +71 -26
  282. package/dist/ui-framework.mjs +16 -14
  283. package/dist/unit-contracts.mjs +270 -89
  284. package/dist/units.mjs +215 -180
  285. package/dist/usage.mjs +138 -38
  286. package/dist/validation-checks.mjs +121 -38
  287. package/dist/validation-inputs.mjs +187 -78
  288. package/dist/validation.mjs +268 -102
  289. package/dist/verification/browser.mjs +27 -5
  290. package/dist/verification.mjs +711 -187
  291. package/docs/ADS.md +100 -89
  292. package/docs/ARCHITECTURE.md +353 -159
  293. package/docs/BEHAVIORS.md +33 -28
  294. package/docs/CACHING.md +55 -11
  295. package/docs/CHANGELOG.md +358 -17
  296. package/docs/COMPARISON.md +1 -1
  297. package/docs/CONTRACTS.md +22 -29
  298. package/docs/DESIGN-REFERENCES.md +40 -0
  299. package/docs/GUIDE.md +313 -292
  300. package/docs/MCP.md +261 -439
  301. package/docs/SPATIAL-CHECKS.md +69 -0
  302. package/docs/benchmarks/README.md +39 -0
  303. package/package.json +42 -34
  304. package/dist/browser-audit.mjs +0 -424
  305. package/dist/contract-migration.mjs +0 -110
  306. package/dist/create.mjs +0 -48
  307. package/dist/lint-config.mjs +0 -48
  308. package/dist/mcp/draft-exports.mjs +0 -40
  309. package/dist/mcp/edit-preparation.mjs +0 -115
  310. package/dist/mcp/project-widget.bundle.js +0 -114
  311. package/dist/mcp/reports.mjs +0 -101
  312. package/dist/mcp/widget.bundle.js +0 -147
  313. package/dist/oxlint.mjs +0 -88
  314. package/dist/preview-builder.mjs +0 -133
  315. package/dist/preview-workers.mjs +0 -184
  316. package/dist/showcase.mjs +0 -77
  317. package/dist/skills/ads-break-ui/LICENSE.upstream +0 -21
  318. package/dist/skills/ads-break-ui/README.md +0 -16
  319. package/dist/skills/ads-break-ui/SKILL.md +0 -415
  320. package/dist/skills/ads-break-ui/agents/openai.yaml +0 -4
  321. package/dist/skills/ads-break-ui/references/atomic-styles.md +0 -293
  322. package/dist/skills/ads-break-ui/references/behaviors.md +0 -411
  323. package/dist/skills/ads-break-ui/references/captures.md +0 -160
  324. package/dist/skills/ads-break-ui/references/contracts.md +0 -284
  325. package/dist/skills/ads-break-ui/references/design-data.md +0 -354
  326. package/dist/skills/ads-break-ui/references/drafts.md +0 -178
  327. package/dist/skills/ads-break-ui/references/evidence.md +0 -128
  328. package/dist/skills/ads-break-ui/references/guarded-editing.md +0 -154
  329. package/dist/skills/ads-break-ui/references/layers.md +0 -145
  330. package/dist/skills/ads-break-ui/references/reporting.md +0 -101
  331. package/dist/skills/ads-break-ui/references/review.md +0 -96
  332. package/dist/skills/ads-break-ui/references/runtimes.md +0 -203
  333. package/dist/skills/ads-break-ui/references/scenarios.md +0 -246
  334. package/dist/skills/ads-break-ui/references/validation.md +0 -162
  335. package/dist/skills/ads-break-ui/references/verification.md +0 -58
  336. package/dist/skills/ads-break-ui/references/workflows.md +0 -83
  337. package/dist/skills/ads-designer/references/reporting.md +0 -101
  338. package/dist/skills/ads-import/references/reporting.md +0 -101
  339. package/dist/skills/ads-motion/LICENSE.upstream +0 -21
  340. package/dist/skills/ads-motion/README.md +0 -22
  341. package/dist/skills/ads-motion/SKILL.md +0 -388
  342. package/dist/skills/ads-motion/agents/openai.yaml +0 -4
  343. package/dist/skills/ads-motion/references/atomic-styles.md +0 -293
  344. package/dist/skills/ads-motion/references/audit.md +0 -44
  345. package/dist/skills/ads-motion/references/behaviors.md +0 -411
  346. package/dist/skills/ads-motion/references/captures.md +0 -160
  347. package/dist/skills/ads-motion/references/contracts.md +0 -284
  348. package/dist/skills/ads-motion/references/design-data.md +0 -354
  349. package/dist/skills/ads-motion/references/drafts.md +0 -178
  350. package/dist/skills/ads-motion/references/evidence.md +0 -128
  351. package/dist/skills/ads-motion/references/guarded-editing.md +0 -154
  352. package/dist/skills/ads-motion/references/layers.md +0 -145
  353. package/dist/skills/ads-motion/references/motion-review.md +0 -35
  354. package/dist/skills/ads-motion/references/reporting.md +0 -101
  355. package/dist/skills/ads-motion/references/review.md +0 -96
  356. package/dist/skills/ads-motion/references/runtimes.md +0 -203
  357. package/dist/skills/ads-motion/references/scenarios.md +0 -246
  358. package/dist/skills/ads-motion/references/validation.md +0 -162
  359. package/dist/skills/ads-motion/references/verification.md +0 -39
  360. package/dist/skills/ads-motion/references/workflows.md +0 -83
  361. package/dist/skills/ads-port/references/reporting.md +0 -101
  362. package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +0 -76
  363. package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.tsx +0 -29
  364. package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
  365. package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +0 -137
  366. package/dist/starters/preact/design-system/showcase/mcp/main.tsx +0 -6
  367. package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +0 -7
  368. package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.scenario.tsx +0 -4
  369. package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +0 -7
  370. package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.scenario.tsx +0 -4
  371. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +0 -12
  372. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +0 -17
  373. package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +0 -75
  374. package/dist/starters/react/design-system/components/Layout/Grid/README.md +0 -21
  375. package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +0 -112
  376. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.tsx +0 -29
  377. package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +0 -18
  378. package/dist/starters/react/design-system/review/index.ts +0 -5
  379. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
  380. package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +0 -137
  381. package/dist/starters/react/design-system/showcase/mcp/index.html +0 -1
  382. package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +0 -124
  383. package/dist/starters/react/design-system/tokens/Color.ads.scenario.tsx +0 -4
  384. package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +0 -39
  385. package/dist/starters/react/design-system/tokens/Layout.ads.scenario.tsx +0 -4
  386. package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +0 -18
  387. package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +0 -4
  388. package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +0 -30
  389. package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +0 -4
  390. package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +0 -37
  391. package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +0 -4
  392. package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +0 -29
  393. package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +0 -4
  394. package/dist/starters/react/package-lock.json +0 -4707
  395. package/dist/token-fixtures.mjs +0 -30
  396. package/docs/benchmarks/bun-previews.md +0 -91
  397. package/docs/benchmarks/preview-memory.md +0 -147
  398. package/docs/benchmarks/turbo-poc.md +0 -284
  399. package/docs/plans/execution-coordination.md +0 -57
  400. /package/dist/{browser-audit → render-audit}/first-render.mjs +0 -0
  401. /package/dist/{browser-audit → render-audit}/layout-shift.mjs +0 -0
package/dist/layers.mjs CHANGED
@@ -1,100 +1,155 @@
1
+ import { eachChild, findAsync, flatMapAsync, mapAsync, walkAsync, walkValuesAsync } from "./analysis/queries.mjs";
1
2
  import path from "node:path";
2
- import { existsSync, readFileSync } from "node:fs";
3
- import ts from "typescript";
3
+ import { existsSync } from "node:fs";
4
+ import ts from "./analysis/syntax.mjs";
5
+ import { sourceAst } from "./analysis/helpers.mjs";
4
6
  import selectorParser from "postcss-selector-parser";
5
7
  import valueParser from "postcss-value-parser";
6
8
  import { isDevelopmentFile, isInside, isStateVariable, isTestFile, isReviewFile } from "./config.mjs";
7
9
  import { importResolver, styleAccessProperty } from "./boundaries.mjs";
10
+ import { ownerStylePolicy } from "./unit-contracts.mjs";
8
11
 
9
- const guidance = "See ads://guides/layers. A component provides one cohesive UI capability; a pattern arranges capabilities into a reusable structure or workflow. Component count does not decide the layer.";
12
+ const guidance =
13
+ "See ads://guides/layers. A component provides one cohesive UI capability; a pattern arranges capabilities into a reusable structure or workflow. Component count does not decide the layer.";
10
14
 
11
15
  /** Include statically addressed local helpers outside the configured source roots.
12
16
  * Dependency packages remain external; no project module is imported/executed. */
13
- export function layerSourceFiles(initial, options) {
14
- const files = new Set(initial), resolve = importResolver(options);
17
+ export async function layerSourceFiles(initial, options) {
18
+ const files = new Set(initial),
19
+ resolve = await importResolver(options);
15
20
  for (const file of files) {
16
- const source = ts.createSourceFile(file, readFileSync(file, "utf8"), ts.ScriptTarget.Latest, true);
17
- function include(literal) {
21
+ const source = await sourceAst(file);
22
+ async function include(literal) {
18
23
  if (!literal || !ts.isStringLiteralLike(literal)) return;
19
- for (const dependency of resolve(literal.text, file)) {
20
- if (isInside(options.root, dependency) && !dependency.split(path.sep).includes("node_modules") && /\.[cm]?[jt]sx?$/.test(dependency) && existsSync(dependency)) files.add(dependency);
24
+ for (const dependency of await resolve(literal.text, file)) {
25
+ if (
26
+ isInside(options.root, dependency) &&
27
+ !dependency.split(path.sep).includes("node_modules") &&
28
+ /\.[cm]?[jt]sx?$/.test(dependency) &&
29
+ existsSync(dependency)
30
+ )
31
+ files.add(dependency);
21
32
  }
22
33
  }
23
- function visit(node) {
24
- if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) include(node.moduleSpecifier);
25
- if (ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)) include(node.moduleReference.expression);
26
- if (ts.isImportTypeNode(node) && ts.isLiteralTypeNode(node.argument)) include(node.argument.literal);
27
- if (ts.isCallExpression(node) && (node.expression.kind === ts.SyntaxKind.ImportKeyword || ts.isIdentifier(node.expression) && node.expression.text === "require")) include(node.arguments[0]);
28
- ts.forEachChild(node, visit);
34
+ async function visit(node) {
35
+ if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) await include(node.moduleSpecifier);
36
+ if (ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)) await include(node.moduleReference.expression);
37
+ if (ts.isImportTypeNode(node) && ts.isLiteralTypeNode(node.argument)) await include(node.argument.literal);
38
+ if (
39
+ ts.isCallExpression(node) &&
40
+ (node.expression.kind === ts.SyntaxKind.ImportKeyword || (ts.isIdentifier(node.expression) && node.expression.text === "require"))
41
+ )
42
+ await include(node.arguments[0]);
43
+ await eachChild(node, visit);
29
44
  }
30
- visit(source);
45
+ await visit(source);
31
46
  }
32
47
  return [...files];
33
48
  }
34
49
 
35
50
  /** Source-only dependency and private-style evidence; never evaluates project code. */
36
- export function createLayerBoundaries(program, options, report) {
51
+ export async function createLayerBoundaries(program, options, report) {
37
52
  const { root, dsRoot, sourceRoot, config } = options;
38
- const checker = program.getTypeChecker(), resolve = importResolver(options);
39
- const sources = program.getSourceFiles().filter(source => isInside(root, source.fileName) && !source.isDeclarationFile && !source.fileName.split(path.sep).includes("node_modules"));
40
- const runtime = file => !isTestFile(file) && !isDevelopmentFile(file, options);
41
- const layer = file => ["components", "patterns", "controllers", "composition", "review"].find(name => isInside(path.join(dsRoot, name), file)) ?? (isInside(sourceRoot, file) && !isInside(dsRoot, file) ? "application" : "shared");
42
- const unalias = symbol => symbol?.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(symbol) : symbol;
43
- const entry = program.getSourceFile(path.join(dsRoot, config.publicEntry));
44
- const module = entry && checker.getSymbolAtLocation(entry);
45
- const publicSymbols = new Set((module ? checker.getExportsOfModule(module) : []).map(unalias));
46
- const publicFiles = new Set([...publicSymbols].filter(symbol => symbol?.flags & ts.SymbolFlags.Value).flatMap(symbol => symbol.declarations?.map(node => node.getSourceFile().fileName) ?? []));
47
- const edges = new Map(), emitted = new Set(), classOwners = new Map(), attributeOwners = new Map(), componentVariables = new Set(), patternVariables = new Set(), publicHooks = new Set();
53
+ const checker = program.getTypeChecker(),
54
+ resolve = await importResolver(options);
55
+ const sources = (await program.getSourceFiles()).filter(
56
+ (source) => isInside(root, source.fileName) && !source.isDeclarationFile && !source.fileName.split(path.sep).includes("node_modules"),
57
+ );
58
+ // Called for every syntax node and import edge: answer once per file.
59
+ const perFile = (compute) => {
60
+ const known = new Map();
61
+ return (file) => {
62
+ if (!known.has(file)) known.set(file, compute(file));
63
+ return known.get(file);
64
+ };
65
+ };
66
+ const runtime = perFile((file) => !isTestFile(file) && !isDevelopmentFile(file, options));
67
+ const sections = ["components", "patterns", "controllers", "composition", "review"].map((name) => [name, path.join(dsRoot, name)]);
68
+ const layer = perFile((file) =>
69
+ isReviewFile(file, options)
70
+ ? "review"
71
+ : (sections.find(([, directory]) => isInside(directory, file))?.[0] ??
72
+ (isInside(sourceRoot, file) && !isInside(dsRoot, file) ? "application" : "shared")),
73
+ );
74
+ const unalias = async (symbol) => (symbol?.flags & ts.SymbolFlags.Alias ? await checker.getAliasedSymbol(symbol) : symbol);
75
+ const entry = await program.getSourceFile(path.join(dsRoot, config.publicEntry));
76
+ const module = entry && (await checker.getSymbolAtLocation(entry));
77
+ const publicSymbols = new Set(await mapAsync(module ? await checker.getExportsOfModule(module) : [], unalias));
78
+ const publicFiles = new Set(
79
+ [...publicSymbols]
80
+ .filter((symbol) => symbol?.flags & ts.SymbolFlags.Value)
81
+ .flatMap((symbol) => symbol.declarations?.map((node) => node.getSourceFile().fileName) ?? []),
82
+ );
83
+ const edges = new Map(),
84
+ emitted = new Set(),
85
+ classOwners = new Map(),
86
+ attributeOwners = new Map(),
87
+ componentVariables = new Set(),
88
+ patternVariables = new Set(),
89
+ publicHooks = new Set();
48
90
 
49
91
  function emit(node, rule, message) {
50
- const source = node.getSourceFile(), position = source.getLineAndCharacterOfPosition(node.getStart(source));
92
+ const source = node.getSourceFile(),
93
+ position = source.getLineAndCharacterOfPosition(node.getStart(source));
51
94
  const key = `${source.fileName}:${node.pos}:${rule}:${message}`;
52
95
  if (emitted.has(key)) return;
53
96
  emitted.add(key);
54
97
  report(source.fileName, rule, `${message} ${guidance}`, position.line + 1, position.character + 1, { guidanceUri: "ads://guides/layers" });
55
98
  }
56
- function target(specifier, source) {
57
- return resolve(specifier, source.fileName).find(file => program.getSourceFile(file));
99
+ async function target(specifier, source) {
100
+ return findAsync(await resolve(specifier, source.fileName), async (file) => program.getSourceFile(file));
58
101
  }
59
- function exportsOf(file) {
60
- const source = file && program.getSourceFile(file), symbol = source && checker.getSymbolAtLocation(source);
61
- return symbol ? checker.getExportsOfModule(symbol) : [];
102
+ async function exportsOf(file) {
103
+ const source = file && (await program.getSourceFile(file)),
104
+ symbol = source && (await checker.getSymbolAtLocation(source));
105
+ return symbol ? await checker.getExportsOfModule(symbol) : [];
62
106
  }
63
- function origins(symbol) {
64
- symbol = unalias(symbol);
65
- return [...new Set(symbol?.declarations?.map(node => node.getSourceFile().fileName) ?? [])].filter(file => isInside(root, file) && !file.split(path.sep).includes("node_modules")).map(file => ({ file, symbol }));
107
+ async function origins(symbol) {
108
+ symbol = await unalias(symbol);
109
+ return [...new Set(symbol?.declarations?.map((node) => node.getSourceFile().fileName) ?? [])]
110
+ .filter((file) => isInside(root, file) && !file.split(path.sep).includes("node_modules"))
111
+ .map((file) => ({ file, symbol }));
66
112
  }
67
113
  function bindings(pattern) {
68
- return ts.isObjectBindingPattern(pattern) ? pattern.elements.filter(node => !node.dotDotDotToken).map(node => (node.propertyName ?? node.name).text).filter(Boolean) : null;
114
+ return ts.isObjectBindingPattern(pattern)
115
+ ? pattern.elements
116
+ .filter((node) => !node.dotDotDotToken)
117
+ .map((node) => (node.propertyName ?? node.name).text)
118
+ .filter(Boolean)
119
+ : null;
69
120
  }
70
- function members(identifier, source) {
71
- const symbol = checker.getSymbolAtLocation(identifier), names = new Set();
121
+ async function members(identifier, source) {
122
+ const symbol = await checker.getSymbolAtLocation(identifier),
123
+ names = new Set();
72
124
  let opaque = false;
73
- function visit(node) {
74
- if (ts.isIdentifier(node) && node !== identifier && checker.getSymbolAtLocation(node) === symbol) {
125
+ async function visit(node) {
126
+ if (ts.isIdentifier(node) && node !== identifier && (await checker.getSymbolAtLocation(node)) === symbol) {
75
127
  const parent = node.parent;
76
128
  if (ts.isPropertyAccessExpression(parent) && parent.expression === node) names.add(parent.name.text);
77
- else if (ts.isElementAccessExpression(parent) && parent.expression === node && ts.isStringLiteralLike(parent.argumentExpression)) names.add(parent.argumentExpression.text);
78
- else if (ts.isVariableDeclaration(parent) && parent.initializer === node && bindings(parent.name)) for (const name of bindings(parent.name)) names.add(name);
129
+ else if (ts.isElementAccessExpression(parent) && parent.expression === node && ts.isStringLiteralLike(parent.argumentExpression))
130
+ names.add(parent.argumentExpression.text);
131
+ else if (ts.isVariableDeclaration(parent) && parent.initializer === node && bindings(parent.name))
132
+ for (const name of bindings(parent.name)) names.add(name);
79
133
  else opaque = true;
80
134
  }
81
- ts.forEachChild(node, visit);
135
+ await eachChild(node, visit);
82
136
  }
83
- visit(source);
137
+ await visit(source);
84
138
  return opaque ? null : [...names];
85
139
  }
86
- function selectedImport(call, source) {
140
+ async function selectedImport(call, source) {
87
141
  let expression = call;
88
142
  while (ts.isAwaitExpression(expression.parent) || ts.isParenthesizedExpression(expression.parent)) expression = expression.parent;
89
143
  const parent = expression.parent;
90
144
  if (ts.isPropertyAccessExpression(parent) && parent.expression === expression && parent.name.text !== "then") return [parent.name.text];
91
- if (ts.isElementAccessExpression(parent) && parent.expression === expression && ts.isStringLiteralLike(parent.argumentExpression)) return [parent.argumentExpression.text];
92
- if (ts.isVariableDeclaration(parent)) return bindings(parent.name) ?? (ts.isIdentifier(parent.name) ? members(parent.name, source) : null);
145
+ if (ts.isElementAccessExpression(parent) && parent.expression === expression && ts.isStringLiteralLike(parent.argumentExpression))
146
+ return [parent.argumentExpression.text];
147
+ if (ts.isVariableDeclaration(parent)) return bindings(parent.name) ?? (ts.isIdentifier(parent.name) ? await members(parent.name, source) : null);
93
148
  if (ts.isPropertyAccessExpression(parent) && parent.name.text === "then" && ts.isCallExpression(parent.parent)) {
94
149
  const callback = parent.parent.arguments[0];
95
150
  if (callback && (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback)) && callback.parameters[0]) {
96
151
  const parameter = callback.parameters[0].name;
97
- return bindings(parameter) ?? (ts.isIdentifier(parameter) ? members(parameter, source) : null);
152
+ return bindings(parameter) ?? (ts.isIdentifier(parameter) ? await members(parameter, source) : null);
98
153
  }
99
154
  }
100
155
  return null;
@@ -105,88 +160,151 @@ export function createLayerBoundaries(program, options, report) {
105
160
  list.push({ ...dependency, node, typeOnly });
106
161
  edges.set(source.fileName, list);
107
162
  }
108
- function addSymbol(source, node, symbol, typeOnly = false) {
109
- for (const origin of origins(symbol)) add(source, node, origin, typeOnly);
163
+ async function addSymbol(source, node, symbol, typeOnly = false) {
164
+ for (const origin of await origins(symbol)) add(source, node, origin, typeOnly);
110
165
  }
111
- function addModule(source, node, file, names, typeOnly = false) {
166
+ async function addModule(source, node, file, names, typeOnly = false) {
112
167
  if (!file) return;
113
- const values = exportsOf(file).filter(symbol => names === null || names.includes(symbol.name));
114
- for (const symbol of values) if (typeOnly || unalias(symbol)?.flags & ts.SymbolFlags.Value) addSymbol(source, node, symbol, typeOnly);
168
+ const values = (await exportsOf(file)).filter((symbol) => names === null || names.includes(symbol.name));
169
+ for (const symbol of values) if (typeOnly || (await unalias(symbol))?.flags & ts.SymbolFlags.Value) await addSymbol(source, node, symbol, typeOnly);
115
170
  if (!values.length || layer(file) === "composition" || isDevelopmentFile(file, options)) add(source, node, { file }, typeOnly);
116
171
  // Explicit side effects in a forwarding barrel still run for a selected export.
117
- if (!typeOnly) for (const statement of program.getSourceFile(file)?.statements ?? []) {
118
- if (ts.isImportDeclaration(statement) && !statement.importClause && ts.isStringLiteralLike(statement.moduleSpecifier)) {
119
- const sideEffect = target(statement.moduleSpecifier.text, statement.getSourceFile());
120
- if (sideEffect) add(source, node, { file: sideEffect });
172
+ if (!typeOnly)
173
+ for (const statement of (await program.getSourceFile(file))?.statements ?? []) {
174
+ if (ts.isImportDeclaration(statement) && !statement.importClause && ts.isStringLiteralLike(statement.moduleSpecifier)) {
175
+ const sideEffect = await target(statement.moduleSpecifier.text, statement.getSourceFile());
176
+ if (sideEffect) add(source, node, { file: sideEffect });
177
+ }
121
178
  }
122
- }
123
179
  }
124
180
  for (const source of sources) {
125
- function visit(node) {
181
+ async function visit(node) {
126
182
  if (ts.isImportDeclaration(node) && ts.isStringLiteralLike(node.moduleSpecifier)) {
127
- const file = target(node.moduleSpecifier.text, source), clause = node.importClause;
128
- if (!clause) add(source, node, { file: file ?? resolve(node.moduleSpecifier.text, source.fileName)[0] });
183
+ const file = await target(node.moduleSpecifier.text, source),
184
+ clause = node.importClause;
185
+ if (!clause) add(source, node, { file: file ?? (await resolve(node.moduleSpecifier.text, source.fileName))[0] });
129
186
  else {
130
- if (clause.name) addSymbol(source, node, checker.getSymbolAtLocation(clause.name), !!clause.isTypeOnly);
187
+ if (clause.name) await addSymbol(source, node, await checker.getSymbolAtLocation(clause.name), !!clause.isTypeOnly);
131
188
  const named = clause.namedBindings;
132
- if (named && ts.isNamedImports(named)) for (const item of named.elements) addSymbol(source, item, checker.getSymbolAtLocation(item.name), !!(clause.isTypeOnly || item.isTypeOnly));
133
- if (named && ts.isNamespaceImport(named)) addModule(source, node, file, members(named.name, source), !!clause.isTypeOnly);
189
+ if (named && ts.isNamedImports(named))
190
+ for (const item of named.elements)
191
+ await addSymbol(source, item, await checker.getSymbolAtLocation(item.name), !!(clause.isTypeOnly || item.isTypeOnly));
192
+ if (named && ts.isNamespaceImport(named)) await addModule(source, node, file, await members(named.name, source), !!clause.isTypeOnly);
134
193
  }
135
194
  }
136
195
  if (ts.isExportDeclaration(node)) {
137
- if (node.exportClause && ts.isNamedExports(node.exportClause)) for (const item of node.exportClause.elements) addSymbol(source, item, checker.getSymbolAtLocation(item.name), !!(node.isTypeOnly || item.isTypeOnly));
138
- else if (node.moduleSpecifier && ts.isStringLiteralLike(node.moduleSpecifier)) addModule(source, node, target(node.moduleSpecifier.text, source), null, !!node.isTypeOnly);
196
+ if (node.exportClause && ts.isNamedExports(node.exportClause))
197
+ for (const item of node.exportClause.elements)
198
+ await addSymbol(source, item, await checker.getSymbolAtLocation(item.name), !!(node.isTypeOnly || item.isTypeOnly));
199
+ else if (node.moduleSpecifier && ts.isStringLiteralLike(node.moduleSpecifier))
200
+ await addModule(source, node, await target(node.moduleSpecifier.text, source), null, !!node.isTypeOnly);
139
201
  }
140
- if (ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference) && node.moduleReference.expression && ts.isStringLiteralLike(node.moduleReference.expression)) {
141
- addModule(source, node, target(node.moduleReference.expression.text, source), members(node.name, source), !!node.isTypeOnly);
202
+ if (
203
+ ts.isImportEqualsDeclaration(node) &&
204
+ ts.isExternalModuleReference(node.moduleReference) &&
205
+ node.moduleReference.expression &&
206
+ ts.isStringLiteralLike(node.moduleReference.expression)
207
+ ) {
208
+ await addModule(source, node, await target(node.moduleReference.expression.text, source), await members(node.name, source), !!node.isTypeOnly);
142
209
  }
143
- if (ts.isImportTypeNode(node) && ts.isLiteralTypeNode(node.argument) && ts.isStringLiteralLike(node.argument.literal)) addModule(source, node, target(node.argument.literal.text, source), null, true);
144
- const requireSymbol = ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "require" ? checker.getSymbolAtLocation(node.expression) : null;
145
- if (ts.isCallExpression(node) && (node.expression.kind === ts.SyntaxKind.ImportKeyword || ts.isIdentifier(node.expression) && node.expression.text === "require" && (!requireSymbol || requireSymbol.declarations?.every(declaration => declaration.getSourceFile().isDeclarationFile))) && ts.isStringLiteralLike(node.arguments[0])) {
146
- addModule(source, node, target(node.arguments[0].text, source), selectedImport(node, source));
210
+ if (ts.isImportTypeNode(node) && ts.isLiteralTypeNode(node.argument) && ts.isStringLiteralLike(node.argument.literal))
211
+ await addModule(source, node, await target(node.argument.literal.text, source), null, true);
212
+ const requireSymbol =
213
+ ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "require"
214
+ ? await checker.getSymbolAtLocation(node.expression)
215
+ : null;
216
+ if (
217
+ ts.isCallExpression(node) &&
218
+ (node.expression.kind === ts.SyntaxKind.ImportKeyword ||
219
+ (ts.isIdentifier(node.expression) &&
220
+ node.expression.text === "require" &&
221
+ (!requireSymbol || requireSymbol.declarations?.every((declaration) => declaration.getSourceFile().isDeclarationFile)))) &&
222
+ ts.isStringLiteralLike(node.arguments[0])
223
+ ) {
224
+ await addModule(source, node, await target(node.arguments[0].text, source), await selectedImport(node, source));
147
225
  }
148
- ts.forEachChild(node, visit);
226
+ await eachChild(node, visit);
149
227
  }
150
- visit(source);
228
+ await visit(source);
151
229
  }
152
230
 
153
- function runtimeHelpers() {
154
- const found = new Set(sources.filter(source => isReviewFile(source.fileName, options) || runtime(source.fileName) && ["components", "patterns", "controllers"].includes(layer(source.fileName))).map(source => source.fileName));
155
- for (const file of found) for (const edge of edges.get(file) ?? []) if (!edge.typeOnly && runtime(edge.file) && program.getSourceFile(edge.file)) found.add(edge.file);
231
+ async function runtimeHelpers() {
232
+ const found = new Set(
233
+ sources
234
+ .filter(
235
+ (source) =>
236
+ isReviewFile(source.fileName, options) || (runtime(source.fileName) && ["components", "patterns", "controllers"].includes(layer(source.fileName))),
237
+ )
238
+ .map((source) => source.fileName),
239
+ );
240
+ for (const file of found)
241
+ for (const edge of edges.get(file) ?? []) if (!edge.typeOnly && runtime(edge.file) && (await program.getSourceFile(edge.file))) found.add(edge.file);
156
242
  return [...found];
157
243
  }
158
244
 
159
245
  function inspectDependencies() {
160
- for (const source of sources.filter(source => runtime(source.fileName) || isReviewFile(source.fileName, options))) {
246
+ for (const source of sources.filter((source) => runtime(source.fileName) || isReviewFile(source.fileName, options))) {
161
247
  const ownLayer = layer(source.fileName);
162
248
  // Check resolved declaration ownership too: a barrel cannot launder fixtures/app code.
163
- if (isInside(dsRoot, source.fileName) || ownLayer === "application") for (const edge of edges.get(source.fileName) ?? []) {
164
- if (runtime(source.fileName) && layer(edge.file) === "review") emit(edge.node, "review-import", "Production code and its public entry cannot depend on review implementations or their types, including through aliases and re-exports. Use the development review entry only from scenarios, fixtures and tests.");
165
- if (edge.typeOnly) continue;
166
- if (runtime(source.fileName) && !runtime(edge.file)) emit(edge.node, "showcase-import", "Runtime code cannot depend on review helpers, scenarios, fixtures or checks, including through re-exports. Keep demonstrations beside their owner and integration harnesses in tests.");
167
- if (isInside(dsRoot, source.fileName) && layer(edge.file) === "application") emit(edge.node, "no-app-import", "ADS runtime cannot import application stores, routing or services, including through forwarding modules. Receive data and navigation callbacks through public APIs.");
168
- }
249
+ if (isInside(dsRoot, source.fileName) || ownLayer === "application")
250
+ for (const edge of edges.get(source.fileName) ?? []) {
251
+ if (runtime(source.fileName) && layer(edge.file) === "review")
252
+ emit(
253
+ edge.node,
254
+ "review-import",
255
+ "Production code and its public entry cannot depend on review implementations or their types, including through aliases and re-exports. Use the development review entry only from scenarios, fixtures and tests.",
256
+ );
257
+ if (edge.typeOnly) continue;
258
+ if (runtime(source.fileName) && !runtime(edge.file))
259
+ emit(
260
+ edge.node,
261
+ "showcase-import",
262
+ "Runtime code cannot depend on review helpers, scenarios, fixtures or checks, including through re-exports. Keep demonstrations beside their owner and integration harnesses in tests.",
263
+ );
264
+ if (isInside(dsRoot, source.fileName) && layer(edge.file) === "application")
265
+ emit(
266
+ edge.node,
267
+ "no-app-import",
268
+ "ADS runtime cannot import application stores, routing or services, including through forwarding modules. Receive data and navigation callbacks through public APIs.",
269
+ );
270
+ }
169
271
  if (!["components", "patterns", "review"].includes(ownLayer)) continue;
170
272
  for (const initial of edges.get(source.fileName) ?? []) {
171
273
  if (initial.typeOnly && ownLayer === "components") continue;
172
- const queue = [{ edge: initial, trail: [source.fileName] }], seen = new Set();
274
+ const queue = [{ edge: initial, trail: [source.fileName] }],
275
+ seen = new Set();
173
276
  while (queue.length) {
174
277
  const { edge, trail } = queue.shift();
175
278
  const key = `${edge.file}:${edge.symbol?.name ?? ""}`;
176
279
  if (seen.has(key)) continue;
177
280
  seen.add(key);
178
- const dependencyLayer = layer(edge.file), chain = [...trail, edge.file];
179
- const via = chain.map(file => path.relative(root, file).replaceAll("\\", "/")).join(" → ");
281
+ const dependencyLayer = layer(edge.file),
282
+ chain = [...trail, edge.file];
283
+ const via = chain.map((file) => path.relative(root, file).replaceAll("\\", "/")).join(" → ");
180
284
  if (ownLayer === "components" && ["patterns", "composition"].includes(dependencyLayer)) {
181
- emit(initial.node, "component-dependency", `Component runtime depends on ${dependencyLayer}: ${via}. Move the arrangement to a pattern or extract a lower-level component/controller; do not change a valid API just to satisfy classification.`);
285
+ emit(
286
+ initial.node,
287
+ "component-dependency",
288
+ `Component runtime depends on ${dependencyLayer}: ${via}. Move the arrangement to a pattern or extract a lower-level component/controller; do not change a valid API just to satisfy classification.`,
289
+ );
182
290
  break;
183
291
  }
184
292
  if (["patterns", "review"].includes(ownLayer) && dependencyLayer === "components") {
185
- if (edge.symbol ? !publicSymbols.has(edge.symbol) : !publicFiles.has(edge.file)) emit(initial.node, "component-contract", `Pattern accesses private component ${edge.symbol?.name ?? "module"}: ${via}. Export an intentional public contract or keep the helper/state/style inside its component; importing a module directly is allowed when the selected symbol is public.`);
293
+ if (edge.symbol ? !publicSymbols.has(edge.symbol) : !publicFiles.has(edge.file))
294
+ emit(
295
+ initial.node,
296
+ "component-contract",
297
+ `Pattern accesses private component ${edge.symbol?.name ?? "module"}: ${via}. Export an intentional public contract or keep the helper/state/style inside its component; importing a module directly is allowed when the selected symbol is public.`,
298
+ );
186
299
  continue; // Public component implementations may use their own private files.
187
300
  }
188
301
  if (ownLayer === "review" && ["patterns", "controllers"].includes(dependencyLayer)) {
189
- if (edge.symbol ? !publicSymbols.has(edge.symbol) : !publicFiles.has(edge.file)) emit(initial.node, "review-contract", `Review accesses private ${dependencyLayer} ${edge.symbol?.name ?? "module"}: ${via}. Demonstrate the production API instead of depending on private implementation details.`);
302
+ if (edge.symbol ? !publicSymbols.has(edge.symbol) : !publicFiles.has(edge.file))
303
+ emit(
304
+ initial.node,
305
+ "review-contract",
306
+ `Review accesses private ${dependencyLayer} ${edge.symbol?.name ?? "module"}: ${via}. Demonstrate the production API instead of depending on private implementation details.`,
307
+ );
190
308
  continue;
191
309
  }
192
310
  if (dependencyLayer === "application" || !runtime(edge.file)) continue;
@@ -197,61 +315,87 @@ export function createLayerBoundaries(program, options, report) {
197
315
  }
198
316
  }
199
317
 
200
- function strings(node, seen = new Set()) {
318
+ async function strings(node, seen = new Set()) {
201
319
  if (!node || seen.has(node)) return [];
202
320
  seen.add(node);
203
321
  if (ts.isStringLiteralLike(node)) return [node.text];
204
322
  if (ts.isIdentifier(node) || ts.isPropertyAccessExpression(node)) {
205
- const symbol = unalias(checker.getSymbolAtLocation(ts.isPropertyAccessExpression(node) ? node.name : node));
206
- return (symbol?.declarations ?? []).flatMap(declaration => ts.isVariableDeclaration(declaration) || ts.isPropertyAssignment(declaration) ? strings(declaration.initializer, seen) : []);
323
+ const symbol = await unalias(await checker.getSymbolAtLocation(ts.isPropertyAccessExpression(node) ? node.name : node));
324
+ return flatMapAsync(symbol?.declarations ?? [], async (declaration) =>
325
+ ts.isVariableDeclaration(declaration) || ts.isPropertyAssignment(declaration) ? await strings(declaration.initializer, seen) : [],
326
+ );
207
327
  }
208
328
  if (ts.isTaggedTemplateExpression(node)) return [];
209
329
  const found = [];
210
- ts.forEachChild(node, child => { found.push(...strings(child, seen)); });
330
+ await eachChild(node, async (child) => {
331
+ found.push(...(await strings(child, seen)));
332
+ });
211
333
  return found;
212
334
  }
213
335
  function own(map, key, file) {
214
336
  if (!map.has(key)) map.set(key, new Set());
215
337
  map.get(key).add(file);
216
338
  }
217
- for (const symbol of publicSymbols) for (const node of symbol?.declarations ?? []) if (ts.isVariableDeclaration(node)) for (const value of strings(node.initializer)) publicHooks.add(value);
218
- for (const source of sources.filter(source => runtime(source.fileName))) {
219
- function visit(node) {
339
+ for (const symbol of publicSymbols)
340
+ for (const node of symbol?.declarations ?? [])
341
+ if (ts.isVariableDeclaration(node)) for (const value of await strings(node.initializer)) publicHooks.add(value);
342
+ for (const source of sources.filter((source) => runtime(source.fileName))) {
343
+ async function visit(node) {
220
344
  let name, value;
221
345
  if (["components", "patterns"].includes(layer(source.fileName))) {
222
346
  const write = styleAccessProperty(node);
223
347
  if (typeof write === "string" && write.startsWith("--")) (layer(source.fileName) === "components" ? componentVariables : patternVariables).add(write);
224
348
  }
225
- if (ts.isJsxAttribute(node)) { name = node.name.getText(); value = node.initializer; }
226
- if (ts.isPropertyAssignment(node) && (ts.isIdentifier(node.name) || ts.isStringLiteralLike(node.name))) { name = node.name.text; value = node.initializer; }
227
- if (name === "className" || name === "class") for (const text of strings(value)) for (const token of text.split(/\s+/).filter(Boolean)) own(classOwners, token, source.fileName);
228
- if (name?.startsWith("data-")) for (const text of strings(value)) own(attributeOwners, `${name}=${text}`, source.fileName);
229
- ts.forEachChild(node, visit);
349
+ if (ts.isJsxAttribute(node)) {
350
+ name = node.name.getText();
351
+ value = node.initializer;
352
+ }
353
+ if (ts.isPropertyAssignment(node) && (ts.isIdentifier(node.name) || ts.isStringLiteralLike(node.name))) {
354
+ name = node.name.text;
355
+ value = node.initializer;
356
+ }
357
+ if (name === "className" || name === "class")
358
+ for (const text of await strings(value)) for (const token of text.split(/\s+/).filter(Boolean)) own(classOwners, token, source.fileName);
359
+ if (name?.startsWith("data-")) for (const text of await strings(value)) own(attributeOwners, `${name}=${text}`, source.fileName);
360
+ await eachChild(node, visit);
230
361
  }
231
- visit(source);
362
+ await visit(source);
232
363
  }
233
364
  function privateHook(map, key, kinds = ["components"]) {
234
365
  const owners = map.get(key);
235
- return !publicHooks.has(key) && owners?.size && (map !== attributeOwners || owners.size === 1) && [...owners].every(file => kinds.includes(layer(file)));
366
+ return !publicHooks.has(key) && owners?.size && (map !== attributeOwners || owners.size === 1) && [...owners].every((file) => kinds.includes(layer(file)));
236
367
  }
237
368
  // Called first for all component styles, then for patterns by checkProject.
238
369
  function collectComponentStyles(file, css) {
239
- if (runtime(file) && ["components", "patterns"].includes(layer(file))) css.walkDecls(declaration => {
240
- if (declaration.prop.startsWith("--")) (layer(file) === "components" ? componentVariables : patternVariables).add(declaration.prop);
241
- });
370
+ if (runtime(file) && ["components", "patterns"].includes(layer(file)))
371
+ css.walkDecls((declaration) => {
372
+ if (declaration.prop.startsWith("--")) (layer(file) === "components" ? componentVariables : patternVariables).add(declaration.prop);
373
+ });
242
374
  }
243
- function inspectStyles(file, css, offset = { line: 1 }) {
375
+ async function inspectStyles(file, css, offset = { line: 1 }) {
244
376
  if (!runtime(file) && !isReviewFile(file, options)) return;
245
377
  const ownLayer = layer(file);
246
- css.walkAtRules("import", rule => {
247
- const first = valueParser(rule.params).nodes.find(node => node.type !== "space" && node.type !== "comment");
378
+ await walkAsync(css, "walkAtRules", "import", async (rule) => {
379
+ const first = valueParser(rule.params).nodes.find((node) => node.type !== "space" && node.type !== "comment");
248
380
  const specifier = first?.type === "string" ? first.value : first?.type === "function" && first.value === "url" ? first.nodes[0]?.value : null;
249
381
  if (!specifier || /^(?:[a-z]+:|\/\/)/i.test(specifier)) return;
250
- for (const dependency of resolve(specifier, file)) {
382
+ for (const dependency of await resolve(specifier, file)) {
251
383
  const dependencyLayer = layer(dependency);
252
- const boundary = ownLayer === "components" && ["patterns", "composition"].includes(dependencyLayer) ? "component-dependency"
253
- : ["patterns", "review"].includes(ownLayer) && dependencyLayer === "components" ? "component-contract" : null;
254
- if (boundary) report(file, boundary, `Stylesheet import crosses the ${ownLayer} → ${dependencyLayer} boundary: ${specifier}. Consume public component contracts instead of importing private styles. ${guidance}`, offset.line + (rule.source?.start.line ?? 1) - 1, rule.source?.start.column ?? 1, { guidanceUri: "ads://guides/layers" });
384
+ const boundary =
385
+ ownLayer === "components" && ["patterns", "composition"].includes(dependencyLayer)
386
+ ? "component-dependency"
387
+ : ["patterns", "review"].includes(ownLayer) && dependencyLayer === "components"
388
+ ? "component-contract"
389
+ : null;
390
+ if (boundary)
391
+ report(
392
+ file,
393
+ boundary,
394
+ `Stylesheet import crosses the ${ownLayer} → ${dependencyLayer} boundary: ${specifier}. Consume public component contracts instead of importing private styles. ${guidance}`,
395
+ offset.line + (rule.source?.start.line ?? 1) - 1,
396
+ rule.source?.start.column ?? 1,
397
+ { guidanceUri: "ads://guides/layers" },
398
+ );
255
399
  }
256
400
  });
257
401
  if (!["patterns", "review"].includes(ownLayer)) return;
@@ -261,28 +405,57 @@ export function createLayerBoundaries(program, options, report) {
261
405
  const key = `${line}:${message}`;
262
406
  if (failures.has(key)) return;
263
407
  failures.add(key);
264
- report(file, "component-style", `${message} Use component props, public class helpers or registered non-state customization variables; patterns own arrangement and spacing. ${guidance}`, line, node.source?.start.column ?? 1, { guidanceUri: "ads://guides/layers" });
408
+ report(
409
+ file,
410
+ "component-style",
411
+ `${message} Use component props, public class helpers or registered non-state customization variables; patterns own arrangement and spacing. ${guidance}`,
412
+ line,
413
+ node.source?.start.column ?? 1,
414
+ { guidanceUri: "ads://guides/layers" },
415
+ );
265
416
  };
266
- css.walkRules(rule => {
417
+ css.walkRules((rule) => {
267
418
  try {
268
- selectorParser(selectors => {
419
+ selectorParser((selectors) => {
269
420
  function subject(selector) {
270
- const nodes = selector.nodes ?? [], lastCombinator = nodes.findLastIndex(node => node.type === "combinator");
421
+ const nodes = selector.nodes ?? [],
422
+ lastCombinator = nodes.findLastIndex((node) => node.type === "combinator");
271
423
  for (const node of nodes.slice(lastCombinator + 1)) {
272
- if (node.type === "class" && privateHook(classOwners, node.value, ownLayer === "review" ? ["components", "patterns"] : undefined)) styleReport(rule, `${ownLayer === "review" ? "Review selector targets private product" : "Pattern selector targets private component"} class .${node.value}.`);
273
- if (node.type === "attribute" && node.operator === "=" && privateHook(attributeOwners, `${node.attribute}=${node.value}`, ownLayer === "review" ? ["components", "patterns"] : undefined) && !publicHooks.has(node.value)) styleReport(rule, `${ownLayer === "review" ? "Review selector targets private product" : "Pattern selector targets private component"} marker [${node.attribute}="${node.value}"].`);
424
+ if (node.type === "class" && privateHook(classOwners, node.value, ownLayer === "review" ? ["components", "patterns"] : undefined))
425
+ styleReport(
426
+ rule,
427
+ `${ownLayer === "review" ? "Review selector targets private product" : "Pattern selector targets private component"} class .${node.value}.`,
428
+ );
429
+ if (
430
+ node.type === "attribute" &&
431
+ node.operator === "=" &&
432
+ privateHook(attributeOwners, `${node.attribute}=${node.value}`, ownLayer === "review" ? ["components", "patterns"] : undefined) &&
433
+ !publicHooks.has(node.value)
434
+ )
435
+ styleReport(
436
+ rule,
437
+ `${ownLayer === "review" ? "Review selector targets private product" : "Pattern selector targets private component"} marker [${node.attribute}="${node.value}"].`,
438
+ );
274
439
  if (node.type === "pseudo" && [":is", ":where"].includes(node.value)) for (const branch of node.nodes ?? []) subject(branch);
275
440
  }
276
441
  }
277
442
  for (const selector of selectors.nodes) subject(selector);
278
443
  }).processSync(rule.selector);
279
- } catch { /* CSS syntax diagnostics are owned by the existing parser/build. */ }
444
+ } catch {
445
+ /* CSS syntax diagnostics are owned by the existing parser/build. */
446
+ }
280
447
  });
281
- css.walkDecls(declaration => valueParser(declaration.value).walk(node => {
282
- if (node.type !== "function" || node.value !== "var") return;
283
- const name = node.nodes.find(child => child.type === "word")?.value;
284
- if ((componentVariables.has(name) || ownLayer === "review" && patternVariables.has(name) && !publicHooks.has(name)) && (isStateVariable(name) || !config.boundaries.componentVariables.includes(name))) styleReport(declaration, `${ownLayer === "review" ? "Review reads private product" : "Pattern reads private component"} variable ${name}.`);
285
- }));
448
+ await walkAsync(css, "walkDecls", async (declaration) =>
449
+ walkValuesAsync(valueParser(declaration.value), async (node) => {
450
+ if (node.type !== "function" || node.value !== "var") return;
451
+ const name = node.nodes.find((child) => child.type === "word")?.value;
452
+ if (
453
+ (componentVariables.has(name) || (ownLayer === "review" && patternVariables.has(name) && !publicHooks.has(name))) &&
454
+ (isStateVariable(name) || !(await ownerStylePolicy(options)).componentVariables.includes(name))
455
+ )
456
+ styleReport(declaration, `${ownLayer === "review" ? "Review reads private product" : "Pattern reads private component"} variable ${name}.`);
457
+ }),
458
+ );
286
459
  }
287
460
  return { inspectDependencies, runtimeHelpers, collectComponentStyles, inspectStyles };
288
461
  }