@reqvire-org/ads 0.4.0 → 0.4.3

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 (410) hide show
  1. package/README.md +115 -87
  2. package/dist/a11y.mjs +133 -48
  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 +142 -0
  7. package/dist/analysis/impact.mjs +20 -0
  8. package/dist/analysis/inputs.mjs +22 -0
  9. package/dist/analysis/module-resolvers.mjs +46 -0
  10. package/dist/analysis/native-adapter.mjs +180 -0
  11. package/dist/analysis/native-project.mjs +323 -0
  12. package/dist/analysis/queries.mjs +133 -0
  13. package/dist/analysis/service.mjs +153 -0
  14. package/dist/analysis/standalone.mjs +57 -0
  15. package/dist/analysis/syntax.mjs +179 -0
  16. package/dist/analysis/worker.mjs +182 -0
  17. package/dist/assets.mjs +6 -6
  18. package/dist/atomic-composition.mjs +191 -70
  19. package/dist/atomic-trace.mjs +120 -50
  20. package/dist/behavior-libraries.mjs +106 -37
  21. package/dist/behaviors.mjs +219 -77
  22. package/dist/boundaries.mjs +140 -41
  23. package/dist/brand-assets.mjs +219 -47
  24. package/dist/brands.mjs +86 -27
  25. package/dist/bun-compiler.mjs +28 -14
  26. package/dist/bun-worker.mjs +7 -5
  27. package/dist/capture/worker.mjs +15 -4
  28. package/dist/capture-store.mjs +4 -2
  29. package/dist/capture.mjs +17 -14
  30. package/dist/check-service.mjs +44 -58
  31. package/dist/check.mjs +754 -188
  32. package/dist/cli.mjs +200 -99
  33. package/dist/color-values.mjs +21 -21
  34. package/dist/component-contrast.mjs +127 -9
  35. package/dist/config.mjs +303 -135
  36. package/dist/construction-styles.cjs +10 -0
  37. package/dist/contrast-composition.mjs +134 -0
  38. package/dist/control-padding.mjs +45 -25
  39. package/dist/css-values.mjs +3 -2
  40. package/dist/declarative-flow.mjs +209 -109
  41. package/dist/design-values.mjs +136 -51
  42. package/dist/development-runtime.mjs +4 -6
  43. package/dist/draft-boundary.mjs +11 -6
  44. package/dist/evidence.mjs +1 -1
  45. package/dist/finding-rules.mjs +9 -5
  46. package/dist/font-rules.mjs +22 -17
  47. package/dist/fonts-generated.mjs +23 -16
  48. package/dist/foundation-views.mjs +242 -0
  49. package/dist/foundation.mjs +63 -39
  50. package/dist/generated-entries.mjs +101 -34
  51. package/dist/icons.mjs +79 -32
  52. package/dist/image-attributes.mjs +143 -66
  53. package/dist/image-size.mjs +1 -1
  54. package/dist/index.mjs +0 -2
  55. package/dist/init.mjs +122 -41
  56. package/dist/investigations.mjs +2 -2
  57. package/dist/layers.mjs +298 -129
  58. package/dist/layout-widths.mjs +180 -85
  59. package/dist/linaria/preserve-values.cjs +7 -0
  60. package/dist/linaria/spatial-inputs.cjs +56 -0
  61. package/dist/lockup-composition.mjs +44 -0
  62. package/dist/lockup-model.cjs +64 -0
  63. package/dist/mcp/THIRD_PARTY_NOTICES.md +51 -1
  64. package/dist/mcp/apps.mjs +4 -30
  65. package/dist/mcp/behavior-pages.mjs +72 -24
  66. package/dist/mcp/build-status.mjs +257 -64
  67. package/dist/mcp/catalog.mjs +90 -26
  68. package/dist/mcp/context.mjs +17 -18
  69. package/dist/mcp/draft-discovery.mjs +44 -21
  70. package/dist/mcp/drafts.mjs +903 -281
  71. package/dist/mcp/execution-coordinator.mjs +417 -167
  72. package/dist/mcp/execution-results.mjs +7 -7
  73. package/dist/mcp/mutations.mjs +673 -234
  74. package/dist/mcp/preview-watch.mjs +448 -170
  75. package/dist/mcp/preview-widget.bundle.js +44 -50
  76. package/dist/mcp/prompts.mjs +5 -5
  77. package/dist/mcp/result-pages.mjs +1 -1
  78. package/dist/mcp/sandbox-host.mjs +1 -1
  79. package/dist/mcp/server.mjs +2409 -577
  80. package/dist/mcp/showcase-host.mjs +165 -41
  81. package/dist/mcp/skills.mjs +1 -1
  82. package/dist/mcp/text-diff.mjs +29 -10
  83. package/dist/paint-contracts.mjs +174 -81
  84. package/dist/palette-generated.mjs +2 -2
  85. package/dist/pictogram-model.mjs +59 -0
  86. package/dist/pictograms.mjs +52 -0
  87. package/dist/preview-bun.mjs +494 -187
  88. package/dist/preview-failure.mjs +1 -1
  89. package/dist/preview-files.mjs +13 -13
  90. package/dist/preview-imports.mjs +104 -55
  91. package/dist/preview-inputs.mjs +2 -2
  92. package/dist/preview-requests.mjs +24 -0
  93. package/dist/preview-resources.mjs +288 -147
  94. package/dist/preview-scope.mjs +5 -4
  95. package/dist/program-cache.mjs +8 -34
  96. package/dist/project-documents.mjs +1 -1
  97. package/dist/public-api.mjs +69 -31
  98. package/dist/public-props.mjs +39 -22
  99. package/dist/{browser-audit → render-audit}/axe-run.mjs +3 -3
  100. package/dist/{browser-audit → render-audit}/image-shape.mjs +15 -5
  101. package/dist/{browser-audit → render-audit}/layout-overflow.mjs +86 -23
  102. package/dist/{browser-audit → render-audit}/non-text-contrast.mjs +86 -27
  103. package/dist/render-audit/pictograms.mjs +88 -0
  104. package/dist/{browser-audit → render-audit}/render-states.mjs +208 -52
  105. package/dist/{browser-audit → render-audit}/worker.mjs +98 -30
  106. package/dist/render-audit.mjs +838 -0
  107. package/dist/render-color-probe.mjs +96 -42
  108. package/dist/render-composition.mjs +164 -0
  109. package/dist/resource-limits.mjs +229 -97
  110. package/dist/runtime-contracts.mjs +467 -185
  111. package/dist/scenario-groups.mjs +22 -10
  112. package/dist/scenario-inspector.mjs +6 -43
  113. package/dist/scenario-program.mjs +8 -25
  114. package/dist/scenario-registry.mjs +72 -30
  115. package/dist/scenario-selectors.mjs +161 -64
  116. package/dist/scenario-slots.mjs +149 -56
  117. package/dist/scenario-trace.mjs +215 -109
  118. package/dist/scenarios-compiler.mjs +719 -378
  119. package/dist/scenarios-vite.d.mts +1 -3
  120. package/dist/scenarios-vite.mjs +2 -81
  121. package/dist/scenarios.mjs +421 -157
  122. package/dist/selector-match.mjs +2 -2
  123. package/dist/showcase/client.bundle.js +57 -56
  124. package/dist/showcase/draft-navigation.js +21 -3
  125. package/dist/showcase/favicon.ico +0 -0
  126. package/dist/showcase/favicon.svg +1 -0
  127. package/dist/showcase/foundation-view.css +58 -0
  128. package/dist/showcase/foundation-view.mjs +255 -0
  129. package/dist/showcase/guide-controls.ads.review.mjs +32 -0
  130. package/dist/showcase/icons.js +1 -145
  131. package/dist/showcase/index.html +3 -31
  132. package/dist/showcase/pictogram-view.mjs +53 -0
  133. package/dist/showcase/preview-frame.ads.review.css +46 -0
  134. package/dist/showcase/preview-frame.ads.review.d.mts +11 -0
  135. package/dist/showcase/preview-frame.ads.review.mjs +22 -0
  136. package/dist/showcase/preview-state.js +0 -9
  137. package/dist/showcase/refresh-scheduler.js +23 -0
  138. package/dist/showcase/style.css +5 -47
  139. package/dist/showcase/ui/ui.css +1353 -0
  140. package/dist/showcase/ui/ui.js +1064 -0
  141. package/dist/showcase-coverage.mjs +58 -37
  142. package/dist/skills/README.md +24 -23
  143. package/dist/skills/ads-designer/README.md +8 -2
  144. package/dist/skills/ads-designer/SKILL.md +143 -120
  145. package/dist/skills/ads-designer/references/accessibility.md +78 -15
  146. package/dist/skills/ads-designer/references/atomic-styles.md +4 -4
  147. package/dist/skills/ads-designer/references/behaviors.md +30 -27
  148. package/dist/skills/ads-designer/references/branding.md +101 -24
  149. package/dist/skills/ads-designer/references/captures.md +25 -0
  150. package/dist/skills/ads-designer/references/cli.md +21 -24
  151. package/dist/skills/ads-designer/references/contracts.md +7 -6
  152. package/dist/skills/ads-designer/references/design-data.md +49 -52
  153. package/dist/skills/ads-designer/references/drafts.md +20 -17
  154. package/dist/skills/ads-designer/references/evidence.md +1 -5
  155. package/dist/skills/ads-designer/references/guarded-editing.md +14 -18
  156. package/dist/skills/ads-designer/references/layers.md +1 -1
  157. package/dist/skills/ads-designer/references/layout.md +347 -0
  158. package/dist/skills/ads-designer/references/mobile.md +2 -1
  159. package/dist/skills/{ads-motion/references/performance.md → ads-designer/references/motion-performance.md} +5 -1
  160. package/dist/skills/{ads-motion/references/build.md → ads-designer/references/motion.md} +73 -5
  161. package/dist/skills/ads-designer/references/performance.md +3 -2
  162. package/dist/skills/ads-designer/references/pictograms.md +131 -0
  163. package/dist/skills/ads-designer/references/review.md +37 -34
  164. package/dist/skills/ads-designer/references/runtimes.md +33 -30
  165. package/dist/skills/ads-designer/references/scenarios.md +16 -18
  166. package/dist/skills/{ads-break-ui/references/catalog.md → ads-designer/references/stress-catalog.md} +3 -1
  167. package/dist/skills/ads-designer/references/stress-test.md +68 -0
  168. package/dist/skills/ads-designer/references/validation.md +83 -75
  169. package/dist/skills/ads-designer/references/workflows.md +8 -33
  170. package/dist/skills/ads-import/SKILL.md +43 -325
  171. package/dist/skills/ads-import/references/atomic-styles.md +4 -4
  172. package/dist/skills/ads-import/references/behaviors.md +30 -27
  173. package/dist/skills/ads-import/references/branding.md +5 -5
  174. package/dist/skills/ads-import/references/captures.md +25 -0
  175. package/dist/skills/ads-import/references/cli.md +21 -24
  176. package/dist/skills/ads-import/references/compatibility.md +1 -1
  177. package/dist/skills/ads-import/references/contracts.md +7 -6
  178. package/dist/skills/ads-import/references/design-data.md +49 -52
  179. package/dist/skills/ads-import/references/drafts.md +20 -17
  180. package/dist/skills/ads-import/references/evidence.md +1 -5
  181. package/dist/skills/ads-import/references/guarded-editing.md +14 -18
  182. package/dist/skills/ads-import/references/implementation.md +2 -1
  183. package/dist/skills/ads-import/references/layers.md +1 -1
  184. package/dist/skills/ads-import/references/layout.md +347 -0
  185. package/dist/skills/ads-import/references/review.md +37 -34
  186. package/dist/skills/ads-import/references/runtimes.md +33 -30
  187. package/dist/skills/ads-import/references/scenarios.md +16 -18
  188. package/dist/skills/ads-import/references/tokens.md +3 -3
  189. package/dist/skills/ads-import/references/validation.md +83 -75
  190. package/dist/skills/ads-import/references/workflows.md +8 -33
  191. package/dist/skills/ads-migrate/SKILL.md +56 -0
  192. package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +602 -0
  193. package/dist/skills/ads-port/SKILL.md +58 -344
  194. package/dist/skills/ads-port/references/atomic-styles.md +4 -4
  195. package/dist/skills/ads-port/references/behaviors.md +30 -27
  196. package/dist/skills/ads-port/references/captures.md +25 -0
  197. package/dist/skills/ads-port/references/cli.md +21 -24
  198. package/dist/skills/ads-port/references/contracts.md +7 -6
  199. package/dist/skills/ads-port/references/design-data.md +49 -52
  200. package/dist/skills/ads-port/references/drafts.md +20 -17
  201. package/dist/skills/ads-port/references/evidence.md +1 -5
  202. package/dist/skills/ads-port/references/guarded-editing.md +14 -18
  203. package/dist/skills/ads-port/references/layers.md +1 -1
  204. package/dist/skills/ads-port/references/layout.md +347 -0
  205. package/dist/skills/ads-port/references/lint-and-docs.md +8 -11
  206. package/dist/skills/ads-port/references/native-implementation.md +2 -1
  207. package/dist/skills/ads-port/references/review.md +37 -34
  208. package/dist/skills/ads-port/references/runtimes.md +33 -30
  209. package/dist/skills/ads-port/references/scenarios.md +16 -18
  210. package/dist/skills/ads-port/references/validation.md +83 -75
  211. package/dist/skills/ads-port/references/workflows.md +8 -33
  212. package/dist/source-symbols.mjs +1 -8
  213. package/dist/source-values.mjs +270 -129
  214. package/dist/spatial-composition.mjs +322 -0
  215. package/dist/spatial-contexts.cjs +56 -0
  216. package/dist/spatial-css.cjs +351 -0
  217. package/dist/spatial-inputs.cjs +80 -0
  218. package/dist/spatial-metadata.mjs +18 -0
  219. package/dist/spatial-model.cjs +322 -0
  220. package/dist/spatial.mjs +21 -0
  221. package/dist/stage-timing.cjs +20 -0
  222. package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +105 -0
  223. package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +275 -0
  224. package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
  225. package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
  226. package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +8 -0
  227. package/dist/starters/preact/ds.config.json +25 -6
  228. package/dist/starters/preact/package.json +4 -8
  229. package/dist/starters/preact/tsconfig.json +4 -5
  230. package/dist/starters/preact/vite.config.ts +3 -3
  231. package/dist/starters/react/ADS.md +42 -47
  232. package/dist/starters/react/README.md +47 -49
  233. package/dist/starters/react/design-system/assets/pictograms/catalog.ads.json +13 -0
  234. package/dist/starters/react/design-system/assets/pictograms/journey.dark.svg +7 -0
  235. package/dist/starters/react/design-system/assets/pictograms/journey.svg +7 -0
  236. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +18 -2
  237. package/dist/starters/react/design-system/components/Actions/IconButton/README.md +3 -0
  238. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.exports.ts +1 -0
  239. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.fixture.ts +1 -0
  240. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.scenario.tsx +7 -0
  241. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.tsx +26 -0
  242. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/README.md +5 -0
  243. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.fixture.ts +13 -0
  244. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.scenario.tsx +22 -0
  245. package/dist/starters/react/design-system/index.ts +2 -1
  246. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.exports.ts +1 -0
  247. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.fixture.ts +7 -0
  248. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.scenario.tsx +15 -0
  249. package/dist/starters/react/design-system/patterns/Conversation/Conversation.tsx +105 -0
  250. package/dist/starters/react/design-system/patterns/Conversation/README.md +9 -0
  251. package/dist/starters/react/design-system/patterns/Shell/Floating.ads.fixture.ts +5 -0
  252. package/dist/starters/react/design-system/patterns/Shell/Floating.ads.scenario.tsx +21 -0
  253. package/dist/starters/react/design-system/patterns/Shell/README.md +43 -0
  254. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.exports.ts +1 -0
  255. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.fixture.ts +5 -0
  256. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +21 -0
  257. package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +274 -0
  258. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +1 -1
  259. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
  260. package/dist/starters/react/design-system/review/index.ads.review.ts +4 -0
  261. package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.exports.ts +1 -0
  262. package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.review.tsx +6 -0
  263. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +1 -1
  264. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
  265. package/dist/starters/react/design-system/showcase/mcp/{main.tsx → main.ads.mount.tsx} +4 -2
  266. package/dist/starters/react/design-system/tokens/catalog.ads.json +1221 -0
  267. package/dist/starters/react/design-system/tokens/colors.css +1 -1
  268. package/dist/starters/react/design-system/tokens/spacing.css +22 -32
  269. package/dist/starters/react/design-system/tokens/spatial.ads.json +70 -0
  270. package/dist/starters/react/design-system/tokens/themes.generated.ts +1 -1
  271. package/dist/starters/react/ds.config.json +25 -6
  272. package/dist/starters/react/package.json +2 -6
  273. package/dist/starters/react/tsconfig.json +2 -3
  274. package/dist/starters/react/vite.config.ts +3 -3
  275. package/dist/style-boundaries.mjs +70 -25
  276. package/dist/task-cache.mjs +173 -72
  277. package/dist/task-worker.mjs +22 -11
  278. package/dist/test-boundaries.mjs +132 -59
  279. package/dist/themes-generated.mjs +1 -1
  280. package/dist/themes-watch.mjs +57 -22
  281. package/dist/themes.mjs +176 -73
  282. package/dist/token-export.mjs +39 -14
  283. package/dist/token-policy.mjs +6 -3
  284. package/dist/token-quality.mjs +6 -6
  285. package/dist/token-samples.mjs +16 -5
  286. package/dist/tokens.mjs +71 -26
  287. package/dist/ui-framework.mjs +16 -14
  288. package/dist/unit-contracts.mjs +251 -104
  289. package/dist/units.mjs +209 -99
  290. package/dist/usage.mjs +138 -38
  291. package/dist/validation-checks.mjs +115 -38
  292. package/dist/validation-inputs.mjs +191 -78
  293. package/dist/validation.mjs +268 -102
  294. package/dist/verification/browser.mjs +27 -5
  295. package/dist/verification.mjs +711 -187
  296. package/docs/ADS.md +96 -80
  297. package/docs/ARCHITECTURE.md +368 -137
  298. package/docs/BEHAVIORS.md +29 -25
  299. package/docs/CACHING.md +77 -17
  300. package/docs/CHANGELOG.md +332 -17
  301. package/docs/CONTRACTS.md +12 -4
  302. package/docs/DESIGN-REFERENCES.md +40 -0
  303. package/docs/GUIDE.md +300 -263
  304. package/docs/MCP.md +187 -324
  305. package/docs/SPATIAL-CHECKS.md +69 -0
  306. package/docs/benchmarks/README.md +39 -0
  307. package/package.json +43 -34
  308. package/dist/browser-audit.mjs +0 -429
  309. package/dist/create.mjs +0 -48
  310. package/dist/lint-config.mjs +0 -50
  311. package/dist/mcp/project-widget.bundle.js +0 -114
  312. package/dist/mcp/reports.mjs +0 -101
  313. package/dist/mcp/widget.bundle.js +0 -147
  314. package/dist/oxlint.mjs +0 -89
  315. package/dist/preview-builder.mjs +0 -133
  316. package/dist/preview-workers.mjs +0 -184
  317. package/dist/showcase.mjs +0 -77
  318. package/dist/skills/ads-break-ui/LICENSE.upstream +0 -21
  319. package/dist/skills/ads-break-ui/README.md +0 -16
  320. package/dist/skills/ads-break-ui/SKILL.md +0 -412
  321. package/dist/skills/ads-break-ui/agents/openai.yaml +0 -4
  322. package/dist/skills/ads-break-ui/references/atomic-styles.md +0 -293
  323. package/dist/skills/ads-break-ui/references/behaviors.md +0 -412
  324. package/dist/skills/ads-break-ui/references/captures.md +0 -135
  325. package/dist/skills/ads-break-ui/references/contracts.md +0 -317
  326. package/dist/skills/ads-break-ui/references/design-data.md +0 -354
  327. package/dist/skills/ads-break-ui/references/drafts.md +0 -194
  328. package/dist/skills/ads-break-ui/references/evidence.md +0 -128
  329. package/dist/skills/ads-break-ui/references/guarded-editing.md +0 -165
  330. package/dist/skills/ads-break-ui/references/layers.md +0 -145
  331. package/dist/skills/ads-break-ui/references/reporting.md +0 -101
  332. package/dist/skills/ads-break-ui/references/review.md +0 -97
  333. package/dist/skills/ads-break-ui/references/runtimes.md +0 -203
  334. package/dist/skills/ads-break-ui/references/scenarios.md +0 -246
  335. package/dist/skills/ads-break-ui/references/validation.md +0 -166
  336. package/dist/skills/ads-break-ui/references/verification.md +0 -58
  337. package/dist/skills/ads-break-ui/references/workflows.md +0 -90
  338. package/dist/skills/ads-designer/references/reporting.md +0 -101
  339. package/dist/skills/ads-import/references/reporting.md +0 -101
  340. package/dist/skills/ads-motion/LICENSE.upstream +0 -21
  341. package/dist/skills/ads-motion/README.md +0 -22
  342. package/dist/skills/ads-motion/SKILL.md +0 -385
  343. package/dist/skills/ads-motion/agents/openai.yaml +0 -4
  344. package/dist/skills/ads-motion/references/atomic-styles.md +0 -293
  345. package/dist/skills/ads-motion/references/audit.md +0 -44
  346. package/dist/skills/ads-motion/references/behaviors.md +0 -412
  347. package/dist/skills/ads-motion/references/captures.md +0 -135
  348. package/dist/skills/ads-motion/references/contracts.md +0 -317
  349. package/dist/skills/ads-motion/references/design-data.md +0 -354
  350. package/dist/skills/ads-motion/references/drafts.md +0 -194
  351. package/dist/skills/ads-motion/references/evidence.md +0 -128
  352. package/dist/skills/ads-motion/references/guarded-editing.md +0 -165
  353. package/dist/skills/ads-motion/references/layers.md +0 -145
  354. package/dist/skills/ads-motion/references/motion-review.md +0 -35
  355. package/dist/skills/ads-motion/references/reporting.md +0 -101
  356. package/dist/skills/ads-motion/references/review.md +0 -97
  357. package/dist/skills/ads-motion/references/runtimes.md +0 -203
  358. package/dist/skills/ads-motion/references/scenarios.md +0 -246
  359. package/dist/skills/ads-motion/references/validation.md +0 -166
  360. package/dist/skills/ads-motion/references/verification.md +0 -39
  361. package/dist/skills/ads-motion/references/workflows.md +0 -90
  362. package/dist/skills/ads-port/references/reporting.md +0 -101
  363. package/dist/starters/preact/design-system/components/Layout/Grid/Grid.ads.contract.ts +0 -6
  364. package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +0 -76
  365. package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.tsx +0 -29
  366. package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
  367. package/dist/starters/preact/design-system/review/token-preview/TokenPreview.ads.contract.ts +0 -6
  368. package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +0 -137
  369. package/dist/starters/preact/design-system/showcase/mcp/main.tsx +0 -6
  370. package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +0 -7
  371. package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.scenario.tsx +0 -4
  372. package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +0 -7
  373. package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.scenario.tsx +0 -4
  374. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.contract.ts +0 -6
  375. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.exports.ts +0 -1
  376. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +0 -12
  377. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +0 -17
  378. package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +0 -75
  379. package/dist/starters/react/design-system/components/Layout/Grid/README.md +0 -21
  380. package/dist/starters/react/design-system/review/brand-preview/BrandPreview.ads.exports.ts +0 -1
  381. package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +0 -112
  382. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.tsx +0 -29
  383. package/dist/starters/react/design-system/review/grid-cell/GridCell.ads.exports.ts +0 -1
  384. package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +0 -18
  385. package/dist/starters/react/design-system/review/index.ts +0 -6
  386. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
  387. package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.contract.ts +0 -6
  388. package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.exports.ts +0 -1
  389. package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +0 -137
  390. package/dist/starters/react/design-system/showcase/mcp/index.html +0 -1
  391. package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +0 -124
  392. package/dist/starters/react/design-system/tokens/Color.ads.scenario.tsx +0 -4
  393. package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +0 -39
  394. package/dist/starters/react/design-system/tokens/Layout.ads.scenario.tsx +0 -4
  395. package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +0 -18
  396. package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +0 -4
  397. package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +0 -30
  398. package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +0 -4
  399. package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +0 -37
  400. package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +0 -4
  401. package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +0 -29
  402. package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +0 -4
  403. package/dist/starters/react/package-lock.json +0 -4707
  404. package/dist/token-fixtures.mjs +0 -30
  405. package/docs/benchmarks/bun-previews.md +0 -91
  406. package/docs/benchmarks/preview-memory.md +0 -147
  407. package/docs/benchmarks/turbo-poc.md +0 -284
  408. package/docs/plans/execution-coordination.md +0 -57
  409. /package/dist/{browser-audit → render-audit}/first-render.mjs +0 -0
  410. /package/dist/{browser-audit → render-audit}/layout-shift.mjs +0 -0
@@ -1,21 +1,25 @@
1
- import ts from "typescript";
1
+ import { eachChild, flatMapAsync, forEachAsync, mapAsync } from "./analysis/queries.mjs";
2
+ import ts from "./analysis/syntax.mjs";
2
3
  import { isInside } from "./config.mjs";
3
4
  import { uiOperation } from "./ui-framework.mjs";
4
5
  import { sourceSymbol } from "./source-symbols.mjs";
6
+ import { memoProgram } from "./analysis/helpers.mjs";
5
7
 
6
- export const unknown = reason => ({ kind: "unknown", reason });
7
- export const literal = value => ({ kind: "literal", value });
8
- export const reference = (node, env = new Map(), via = []) => node ? { kind: "node", node, env, via } : literal(undefined);
9
- export const union = values => values.length === 1 ? values[0] : { kind: "union", values };
10
- export const isFunction = node => node && (ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) || ts.isArrowFunction(node) || ts.isMethodDeclaration(node));
11
- const nameOf = node => node && (ts.isIdentifier(node) || ts.isStringLiteralLike(node) || ts.isNumericLiteral(node)) ? node.text : undefined;
8
+ export const unknown = (reason) => ({ kind: "unknown", reason });
9
+ export const literal = (value) => ({ kind: "literal", value });
10
+ export const reference = (node, env = new Map(), via = []) => (node ? { kind: "node", node, env, via } : literal(undefined));
11
+ export const union = (values) => (values.length === 1 ? values[0] : { kind: "union", values });
12
+ export const isFunction = (node) =>
13
+ node && (ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) || ts.isArrowFunction(node) || ts.isMethodDeclaration(node));
14
+ const nameOf = (node) => (node && (ts.isIdentifier(node) || ts.isStringLiteralLike(node) || ts.isNumericLiteral(node)) ? node.text : undefined);
12
15
  export function unwrap(node) {
13
- while (node && (ts.isParenthesizedExpression(node) || ts.isAsExpression(node) || ts.isSatisfiesExpression(node) || ts.isNonNullExpression(node))) node = node.expression;
16
+ while (node && (ts.isParenthesizedExpression(node) || ts.isAsExpression(node) || ts.isSatisfiesExpression(node) || ts.isNonNullExpression(node)))
17
+ node = node.expression;
14
18
  return node;
15
19
  }
16
20
 
17
21
  /** Bounded symbolic source traversal. No project code is imported or executed. */
18
- export function createSourceValues(program, options, { preserveCall = () => false, strict = false } = {}) {
22
+ export function createSourceValues(program, options, { preserveCall = () => false, strict = false, completeReturns = strict } = {}) {
19
23
  const checker = program.getTypeChecker();
20
24
  const ownedFiles = new Map();
21
25
  function owned(node) {
@@ -23,99 +27,158 @@ export function createSourceValues(program, options, { preserveCall = () => fals
23
27
  if (!ownedFiles.has(file)) ownedFiles.set(file, isInside(options.dsRoot, file));
24
28
  return ownedFiles.get(file);
25
29
  }
26
- const symbol = node => {
27
- const value = sourceSymbol(checker, ts.isPropertyAccessExpression(node) ? node.name : node);
28
- return value?.valueDeclaration && ts.isShorthandPropertyAssignment(value.valueDeclaration) ? checker.getShorthandAssignmentValueSymbol(value.valueDeclaration) ?? value : value;
30
+ const symbol = async (node) => {
31
+ const value = await sourceSymbol(checker, ts.isPropertyAccessExpression(node) ? node.name : node);
32
+ return value?.valueDeclaration && ts.isShorthandPropertyAssignment(value.valueDeclaration)
33
+ ? ((await checker.getShorthandAssignmentValueSymbol(value.valueDeclaration)) ?? value)
34
+ : value;
29
35
  };
30
- function declaration(node) {
31
- let value = symbol(node);
32
- if (value?.flags & ts.SymbolFlags.Alias) value = checker.getAliasedSymbol(value);
36
+ async function declaration(node) {
37
+ let value = await symbol(node);
38
+ if (value?.flags & ts.SymbolFlags.Alias) value = await checker.getAliasedSymbol(value);
33
39
  return value?.valueDeclaration;
34
40
  }
35
- const writes = new Set(), escapes = new Set(), aliases = [];
36
- if (strict) {
37
- function root(node) {
38
- node = unwrap(node);
39
- while (node && (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node))) node = unwrap(node.expression);
40
- return node && ts.isIdentifier(node) ? symbol(node) : null;
41
- }
42
- function scan(node) {
43
- if (ts.isBinaryExpression(node) && node.operatorToken.kind >= ts.SyntaxKind.FirstAssignment && node.operatorToken.kind <= ts.SyntaxKind.LastAssignment) writes.add(root(node.left));
44
- if ((ts.isPrefixUnaryExpression(node) || ts.isPostfixUnaryExpression(node)) && [ts.SyntaxKind.PlusPlusToken, ts.SyntaxKind.MinusMinusToken].includes(node.operator)) writes.add(root(node.operand));
45
- if (ts.isDeleteExpression(node)) writes.add(root(node.expression));
46
- if (ts.isCallExpression(node) || ts.isNewExpression(node)) for (const argument of node.arguments ?? []) {
47
- const value = unwrap(argument);
48
- if (ts.isIdentifier(value)) escapes.add(symbol(value));
41
+ let effects;
42
+ const strictEffects = async () =>
43
+ (effects ??= await memoProgram(program, `strict-source-effects:${options.dsRoot}`, async () => {
44
+ const writes = new Set(),
45
+ escapes = new Set(),
46
+ aliases = [];
47
+ async function root(node) {
48
+ node = unwrap(node);
49
+ while (node && (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node))) node = unwrap(node.expression);
50
+ return node && ts.isIdentifier(node) ? await symbol(node) : null;
49
51
  }
50
- if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer && root(node.initializer)) aliases.push([symbol(node.name), root(node.initializer)]);
51
- ts.forEachChild(node, scan);
52
- }
53
- for (const file of program.getSourceFiles()) if (isInside(options.dsRoot, file.fileName)) scan(file);
54
- const targets = new Map();
55
- for (const [alias, target] of aliases) { if (!targets.has(alias)) targets.set(alias, []); targets.get(alias).push(target); }
56
- for (const affected of [writes, escapes]) {
57
- const queue = [...affected];
58
- for (let index = 0; index < queue.length; ++index) for (const target of targets.get(queue[index]) ?? []) if (!affected.has(target)) { affected.add(target); queue.push(target); }
59
- }
60
- }
52
+ async function scan(node) {
53
+ if (ts.isBinaryExpression(node) && node.operatorToken.kind >= ts.SyntaxKind.FirstAssignment && node.operatorToken.kind <= ts.SyntaxKind.LastAssignment)
54
+ writes.add(await root(node.left));
55
+ if (
56
+ (ts.isPrefixUnaryExpression(node) || ts.isPostfixUnaryExpression(node)) &&
57
+ [ts.SyntaxKind.PlusPlusToken, ts.SyntaxKind.MinusMinusToken].includes(node.operator)
58
+ )
59
+ writes.add(await root(node.operand));
60
+ if (ts.isDeleteExpression(node)) writes.add(await root(node.expression));
61
+ if (ts.isCallExpression(node) || ts.isNewExpression(node))
62
+ for (const argument of node.arguments ?? []) {
63
+ const value = unwrap(argument);
64
+ if (ts.isIdentifier(value)) escapes.add(await symbol(value));
65
+ }
66
+ if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer && (await root(node.initializer)))
67
+ aliases.push([await symbol(node.name), await root(node.initializer)]);
68
+ await eachChild(node, scan);
69
+ }
70
+ for (const file of await program.getSourceFiles()) if (isInside(options.dsRoot, file.fileName)) await scan(file);
71
+ const targets = new Map();
72
+ for (const [alias, target] of aliases) {
73
+ if (!targets.has(alias)) targets.set(alias, []);
74
+ targets.get(alias).push(target);
75
+ }
76
+ for (const affected of [writes, escapes]) {
77
+ const queue = [...affected];
78
+ for (let index = 0; index < queue.length; ++index)
79
+ for (const target of targets.get(queue[index]) ?? [])
80
+ if (!affected.has(target)) {
81
+ affected.add(target);
82
+ queue.push(target);
83
+ }
84
+ }
85
+ return { writes, escapes };
86
+ }));
61
87
  const state = () => ({ budget: { steps: 0 }, depth: 0, calls: new Set() });
62
- function next(context) { return { ...context, depth: context.depth + 1 }; }
63
- function exhausted(context) { return ++context.budget.steps > (context.maxSteps??4000) || context.depth > (context.maxDepth??48); }
88
+ function next(context) {
89
+ return { ...context, depth: context.depth + 1 };
90
+ }
91
+ function exhausted(context) {
92
+ return ++context.budget.steps > (context.maxSteps ?? 4000) || context.depth > (context.maxDepth ?? 48);
93
+ }
64
94
  function at(node, kind, name) {
65
- const source = node.getSourceFile(), position = source.getLineAndCharacterOfPosition(node.getStart(source));
95
+ const source = node.getSourceFile(),
96
+ position = source.getLineAndCharacterOfPosition(node.getStart(source));
66
97
  return { file: source.fileName, line: position.line + 1, column: position.character + 1, kind, name: name.slice(0, 100) };
67
98
  }
68
99
  function withVia(value, via) {
69
- if (value.kind === "union") return { ...value, values: value.values.map(item => withVia(item, via)) };
70
- return value.kind === "node" ? { ...value, via: [...new Map([...via, ...value.via].map(item => [JSON.stringify(item), item])).values()].slice(0, 16) } : value;
100
+ if (value.kind === "union") return { ...value, values: value.values.map((item) => withVia(item, via)) };
101
+ return value.kind === "node"
102
+ ? { ...value, via: [...new Map([...via, ...value.via].map((item) => [JSON.stringify(item), item])).values()].slice(0, 16) }
103
+ : value;
71
104
  }
72
- function withDefault(value, fallback, context) {
105
+ async function withDefault(value, fallback, context) {
73
106
  if (!fallback) return value;
74
- value = resolve(value, next(context));
107
+ value = await resolve(value, next(context));
75
108
  if (value.kind === "literal") return value.value === undefined ? fallback : value;
76
109
  if (value.kind === "unknown") return union([value, fallback]);
77
- if (value.kind === "union") return union(value.values.map(item => withDefault(item, fallback, next(context))));
110
+ if (value.kind === "union") return union(await mapAsync(value.values, async (item) => withDefault(item, fallback, next(context))));
78
111
  return value;
79
112
  }
80
- function bind(pattern, value, env, via, context) {
81
- if (ts.isIdentifier(pattern)) { env.set(symbol(pattern), value); return; }
113
+ async function bind(pattern, value, env, via, context) {
114
+ if (ts.isIdentifier(pattern)) {
115
+ env.set(await symbol(pattern), value);
116
+ return;
117
+ }
82
118
  if (ts.isObjectBindingPattern(pattern)) {
83
119
  const excluded = new Set();
84
120
  for (const part of pattern.elements) {
85
121
  const key = nameOf(part.propertyName ?? part.name);
86
- if (part.dotDotDotToken) bind(part.name, { kind: "rest", value, excluded: new Set(excluded) }, env, via, next(context));
122
+ if (part.dotDotDotToken) await bind(part.name, { kind: "rest", value, excluded: new Set(excluded) }, env, via, next(context));
87
123
  else {
88
124
  if (key === undefined) continue;
89
125
  excluded.add(key);
90
- bind(part.name, withDefault(get(value, key, next(context)), part.initializer && reference(part.initializer, env, via), context), env, via, next(context));
126
+ await bind(
127
+ part.name,
128
+ await withDefault(await get(value, key, next(context)), part.initializer && reference(part.initializer, env, via), context),
129
+ env,
130
+ via,
131
+ next(context),
132
+ );
91
133
  }
92
134
  }
93
135
  } else if (ts.isArrayBindingPattern(pattern)) {
94
- pattern.elements.forEach((part, index) => {
95
- if (ts.isBindingElement(part) && !part.dotDotDotToken) bind(part.name, withDefault(get(value, String(index), next(context)), part.initializer && reference(part.initializer, env, via), context), env, via, next(context));
136
+ await forEachAsync(pattern.elements, async (part, index) => {
137
+ if (ts.isBindingElement(part) && !part.dotDotDotToken)
138
+ await bind(
139
+ part.name,
140
+ await withDefault(await get(value, String(index), next(context)), part.initializer && reference(part.initializer, env, via), context),
141
+ env,
142
+ via,
143
+ next(context),
144
+ );
96
145
  });
97
146
  }
98
147
  }
99
- function boundElement(node, env, via, context) {
148
+ async function boundElement(node, env, via, context) {
100
149
  let owner = node;
101
150
  while (ts.isBindingElement(owner) || ts.isObjectBindingPattern(owner) || ts.isArrayBindingPattern(owner)) owner = owner.parent;
102
151
  if (!ts.isVariableDeclaration(owner) || !owner.initializer || !(owner.parent.flags & ts.NodeFlags.Const)) return unknown();
103
152
  const local = new Map(env);
104
- bind(owner.name, reference(owner.initializer, env, via), local, via, next(context));
105
- return local.get(symbol(node.name)) ?? unknown();
153
+ await bind(owner.name, reference(owner.initializer, env, via), local, via, next(context));
154
+ return local.get(await symbol(node.name)) ?? unknown();
106
155
  }
107
- function get(value, key, context) {
108
- value = resolve(value, next(context));
156
+ async function get(value, key, context) {
157
+ value = await resolve(value, next(context));
109
158
  if (strict && value.kind === "context" && key === "Provider") return { kind: "provider" };
110
- if (value.kind === "union") return union(value.values.map(item => get(item, key, next(context))));
111
- if (value.kind === "rest") return value.excluded.has(key) ? literal(undefined) : get(value.value, key, next(context));
159
+ if (value.kind === "union") return union(await mapAsync(value.values, async (item) => get(item, key, next(context))));
160
+ if (value.kind === "rest") return value.excluded.has(key) ? literal(undefined) : await get(value.value, key, next(context));
112
161
  const layers = value.kind === "object" ? value.layers : [];
113
162
  if (value.kind === "node" && ts.isObjectLiteralExpression(value.node)) {
114
163
  for (const property of value.node.properties) {
115
164
  if (ts.isSpreadAssignment(property)) layers.push(reference(property.expression, value.env, value.via));
116
165
  else {
117
166
  const name = nameOf(property.name);
118
- if (name !== undefined) layers.push(new Map([[name, strict && (ts.isGetAccessorDeclaration(property) || ts.isSetAccessorDeclaration(property)) ? unknown("An accessor is not a statically known property.") : reference(ts.isShorthandPropertyAssignment(property) ? property.name : ts.isMethodDeclaration(property) ? property : property.initializer, value.env, value.via)]]));
167
+ if (name !== undefined)
168
+ layers.push(
169
+ new Map([
170
+ [
171
+ name,
172
+ strict && (ts.isGetAccessorDeclaration(property) || ts.isSetAccessorDeclaration(property))
173
+ ? unknown("An accessor is not a statically known property.")
174
+ : reference(
175
+ ts.isShorthandPropertyAssignment(property) ? property.name : ts.isMethodDeclaration(property) ? property : property.initializer,
176
+ value.env,
177
+ value.via,
178
+ ),
179
+ ],
180
+ ]),
181
+ );
119
182
  else if (strict) layers.push(unknown("A computed object key may replace the selected property."));
120
183
  }
121
184
  }
@@ -124,132 +187,210 @@ export function createSourceValues(program, options, { preserveCall = () => fals
124
187
  } else if (value.kind !== "object") return unknown(value.reason);
125
188
  for (let index = layers.length - 1; index >= 0; index--) {
126
189
  const layer = layers[index];
127
- if (layer instanceof Map) { if (layer.has(key)) return layer.get(key); }
128
- else {
129
- const selected = get(layer, key, next(context));
190
+ if (layer instanceof Map) {
191
+ if (layer.has(key)) return layer.get(key);
192
+ } else {
193
+ const selected = await get(layer, key, next(context));
130
194
  if (selected.kind === "literal" && selected.value === undefined) continue;
131
195
  // An opaque later spread may replace an earlier explicit property.
132
- if (selected.kind === "unknown" || selected.kind === "union") return union([selected, get({ kind: "object", layers: layers.slice(0, index) }, key, next(context))]);
196
+ if (selected.kind === "unknown" || selected.kind === "union")
197
+ return union([selected, await get({ kind: "object", layers: layers.slice(0, index) }, key, next(context))]);
133
198
  return selected;
134
199
  }
135
200
  }
136
201
  return literal(undefined);
137
202
  }
138
- function keys(value, context) {
139
- value = resolve(value, next(context));
140
- if (value.kind === "union") return [...new Set(value.values.flatMap(item => keys(item, next(context))))];
141
- if (value.kind === "rest") return keys(value.value, next(context)).filter(key => !value.excluded.has(key));
142
- if (value.kind === "node" && ts.isObjectLiteralExpression(value.node)) return value.node.properties.flatMap(property => ts.isSpreadAssignment(property) ? keys(reference(property.expression, value.env, value.via), next(context)) : nameOf(property.name) ?? []);
143
- if (value.kind === "object") return [...new Set(value.layers.flatMap(layer => layer instanceof Map ? [...layer.keys()] : keys(layer, next(context))))];
203
+ async function keys(value, context) {
204
+ value = await resolve(value, next(context));
205
+ if (value.kind === "union") return [...new Set(await flatMapAsync(value.values, async (item) => keys(item, next(context))))];
206
+ if (value.kind === "rest") return (await keys(value.value, next(context))).filter((key) => !value.excluded.has(key));
207
+ if (value.kind === "node" && ts.isObjectLiteralExpression(value.node))
208
+ return flatMapAsync(value.node.properties, async (property) =>
209
+ ts.isSpreadAssignment(property) ? await keys(reference(property.expression, value.env, value.via), next(context)) : (nameOf(property.name) ?? []),
210
+ );
211
+ if (value.kind === "object")
212
+ return [...new Set(await flatMapAsync(value.layers, async (layer) => (layer instanceof Map ? [...layer.keys()] : await keys(layer, next(context)))))];
144
213
  return [];
145
214
  }
146
- function returns(fn, args, context, kind = "helper") {
147
- if (kind!=="component"&&context.calls.has(fn.node)) return [unknown("Recursive local call could not be fully traced.")];
148
- if (!fn.node.body || fn.node.asteriskToken || fn.node.modifiers?.some(item => item.kind === ts.SyntaxKind.AsyncKeyword)) return [unknown("Async, generator or declaration-only calls are outside atomic source tracing.")];
149
- const env = new Map(fn.env), via = [...fn.via, at(fn.node, kind, fn.node.name?.getText() ?? "local function")];
150
- const inner = { ...next(context), calls: new Set(kind==="component"?[fn.node]:[...context.calls, fn.node]) };
215
+ async function returns(fn, args, context, kind = "helper") {
216
+ if (kind !== "component" && context.calls.has(fn.node)) return [unknown("Recursive local call could not be fully traced.")];
217
+ if (!fn.node.body || fn.node.asteriskToken || fn.node.modifiers?.some((item) => item.kind === ts.SyntaxKind.AsyncKeyword))
218
+ return [unknown("Async, generator or declaration-only calls are outside atomic source tracing.")];
219
+ const env = new Map(fn.env),
220
+ via = [...fn.via, at(fn.node, kind, fn.node.name?.getText() ?? "local function")];
221
+ const inner = { ...next(context), calls: new Set(kind === "component" ? [fn.node] : [...context.calls, fn.node]) };
151
222
  for (const [index, parameter] of fn.node.parameters.entries()) {
152
- if (parameter.dotDotDotToken) { bind(parameter.name, { kind: "array", values: args.slice(index) }, env, via, inner); break; }
153
- bind(parameter.name, withDefault(resolve(args[index] ?? literal(undefined), inner), parameter.initializer && reference(parameter.initializer, env, via), inner), env, via, inner);
223
+ if (parameter.dotDotDotToken) {
224
+ await bind(parameter.name, { kind: "array", values: args.slice(index) }, env, via, inner);
225
+ break;
226
+ }
227
+ await bind(
228
+ parameter.name,
229
+ await withDefault(await resolve(args[index] ?? literal(undefined), inner), parameter.initializer && reference(parameter.initializer, env, via), inner),
230
+ env,
231
+ via,
232
+ inner,
233
+ );
154
234
  }
155
235
  const outputs = [];
156
- function statement(node) {
157
- if (ts.isReturnStatement(node)) { outputs.push(reference(node.expression, env, via)); return true; }
158
- if (ts.isBlock(node)) { for (const child of node.statements) if (statement(child)) return true; }
159
- else if (ts.isIfStatement(node)) {
160
- const condition = resolve(reference(node.expression, env, via), inner);
161
- if (condition.kind === "literal") return condition.value ? statement(node.thenStatement) : node.elseStatement ? statement(node.elseStatement) : false;
162
- const left = statement(node.thenStatement), right = node.elseStatement ? statement(node.elseStatement) : false;
236
+ async function statement(node) {
237
+ if (ts.isReturnStatement(node)) {
238
+ outputs.push(reference(node.expression, env, via));
239
+ return true;
240
+ }
241
+ if (ts.isBlock(node)) {
242
+ for (const child of node.statements) if (await statement(child)) return true;
243
+ } else if (ts.isIfStatement(node)) {
244
+ const condition = await resolve(reference(node.expression, env, via), inner);
245
+ if (condition.kind === "literal")
246
+ return condition.value ? await statement(node.thenStatement) : node.elseStatement ? await statement(node.elseStatement) : false;
247
+ const left = await statement(node.thenStatement),
248
+ right = node.elseStatement ? await statement(node.elseStatement) : false;
163
249
  return left && right;
164
- } else if (ts.isThrowStatement(node)) { if (strict) outputs.push(unknown("A throwing branch does not establish a returned value.")); return true; }
165
- else if (ts.isIterationStatement(node, false) || ts.isSwitchStatement(node) || ts.isTryStatement(node)) outputs.push(unknown("Loop, switch or try control flow could not be fully traced."));
250
+ } else if (ts.isThrowStatement(node)) {
251
+ if (completeReturns) outputs.push(unknown("A throwing branch does not establish a returned value."));
252
+ return true;
253
+ } else if (ts.isIterationStatement(node, false) || ts.isSwitchStatement(node) || ts.isTryStatement(node))
254
+ outputs.push(unknown("Loop, switch or try control flow could not be fully traced."));
166
255
  return false;
167
256
  }
168
- if (ts.isBlock(fn.node.body)) { if (!statement(fn.node.body) && strict) outputs.push(literal(undefined)); }
169
- else outputs.push(reference(fn.node.body, env, via));
257
+ if (ts.isBlock(fn.node.body)) {
258
+ if (!(await statement(fn.node.body)) && completeReturns) outputs.push(literal(undefined));
259
+ } else outputs.push(reference(fn.node.body, env, via));
170
260
  // Keep call stacks with lazy return references, including nested helpers.
171
- return outputs.length ? outputs.map(value => ({ ...value, context: inner })) : [literal(undefined)];
261
+ return outputs.length ? outputs.map((value) => ({ ...value, context: inner })) : [literal(undefined)];
172
262
  }
173
- function resolve(value, context) {
263
+ async function resolve(value, context) {
174
264
  if (!value) return literal(undefined);
175
265
  context = value.context ?? context;
176
266
  if (exhausted(context)) return unknown("Atomic source tracing reached its depth or work limit.");
177
267
  if (value.kind !== "node") return value;
178
- const node = unwrap(value.node), { env, via } = value;
179
- if (ts.isStringLiteralLike(node) || ts.isNumericLiteral(node)) return { ...literal(ts.isNumericLiteral(node) ? Number(node.text) : node.text), ...(strict ? { origin: node, via } : {}) };
268
+ const node = unwrap(value.node),
269
+ { env, via } = value;
270
+ if (ts.isStringLiteralLike(node) || ts.isNumericLiteral(node))
271
+ return { ...literal(ts.isNumericLiteral(node) ? Number(node.text) : node.text), ...(strict ? { origin: node, via } : {}) };
180
272
  if (node.kind === ts.SyntaxKind.TrueKeyword || node.kind === ts.SyntaxKind.FalseKeyword) return literal(node.kind === ts.SyntaxKind.TrueKeyword);
181
273
  if (node.kind === ts.SyntaxKind.NullKeyword) return literal(null);
182
274
  if (ts.isIdentifier(node)) {
183
- if (strict && writes.has(symbol(node))) return unknown("A written binding or object is not a statically known value.");
184
- if (strict && ["Fragment", "StrictMode"].includes(uiOperation(node, checker))) return { kind: "provider" };
185
- if (env.has(symbol(node))) {
186
- const result = resolve(env.get(symbol(node)), next(context));
187
- return strict && escapes.has(symbol(node)) && (result.kind === "object" || result.kind === "array" || result.kind === "node" && (ts.isObjectLiteralExpression(result.node) || ts.isArrayLiteralExpression(result.node))) ? unknown("An object passed to another call may have been mutated.") : result;
275
+ if (strict && (await strictEffects()).writes.has(await symbol(node))) return unknown("A written binding or object is not a statically known value.");
276
+ if (strict && ["Fragment", "StrictMode"].includes(await uiOperation(node, checker))) return { kind: "provider" };
277
+ if (env.has(await symbol(node))) {
278
+ const result = await resolve(env.get(await symbol(node)), next(context));
279
+ return strict &&
280
+ (await strictEffects()).escapes.has(await symbol(node)) &&
281
+ (result.kind === "object" ||
282
+ result.kind === "array" ||
283
+ (result.kind === "node" && (ts.isObjectLiteralExpression(result.node) || ts.isArrayLiteralExpression(result.node))))
284
+ ? unknown("An object passed to another call may have been mutated.")
285
+ : result;
188
286
  }
189
- const owner = declaration(node);
287
+ const owner = await declaration(node);
190
288
  if (owner && owned(owner)) {
191
289
  if (isFunction(owner)) return reference(owner, env, via);
192
290
  if (ts.isVariableDeclaration(owner) && owner.initializer && owner.parent.flags & ts.NodeFlags.Const) {
193
- const result = resolve(reference(owner.initializer, env, via), next(context));
194
- return strict && escapes.has(symbol(node)) && (result.kind === "object" || result.kind === "array" || result.kind === "node" && (ts.isObjectLiteralExpression(result.node) || ts.isArrayLiteralExpression(result.node))) ? unknown("An object passed to another call may have been mutated.") : result;
291
+ const result = await resolve(reference(owner.initializer, env, via), next(context));
292
+ return strict &&
293
+ (await strictEffects()).escapes.has(await symbol(node)) &&
294
+ (result.kind === "object" ||
295
+ result.kind === "array" ||
296
+ (result.kind === "node" && (ts.isObjectLiteralExpression(result.node) || ts.isArrayLiteralExpression(result.node))))
297
+ ? unknown("An object passed to another call may have been mutated.")
298
+ : result;
195
299
  }
196
- if (ts.isBindingElement(owner)) return resolve(boundElement(owner, env, via, context), next(context));
300
+ if (ts.isBindingElement(owner)) return resolve(await boundElement(owner, env, via, context), next(context));
197
301
  }
198
302
  return node.text === "undefined" && !owner ? literal(undefined) : unknown();
199
303
  }
200
304
  if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) {
201
- const key = ts.isPropertyAccessExpression(node) ? literal(node.name.text) : resolve(reference(node.argumentExpression, env, via), next(context));
305
+ const key = ts.isPropertyAccessExpression(node) ? literal(node.name.text) : await resolve(reference(node.argumentExpression, env, via), next(context));
202
306
  const object = reference(node.expression, env, via);
203
307
  if (key.kind === "literal") {
204
- const selected = get(object, String(key.value), next(context));
205
- const owner = declaration(node);
206
- if (selected.kind === "unknown" && owner && owned(owner)) {
308
+ const selected = await get(object, String(key.value), next(context));
309
+ const owner = await declaration(node);
310
+ // A property symbol identifies its original declaration, not the value
311
+ // after mutation, an accessor or an opaque override. Preserve that lack
312
+ // of proof instead of recovering the declaration's stale initializer.
313
+ if (selected.kind === "unknown" && !(strict && selected.reason) && owner && owned(owner)) {
207
314
  if (isFunction(owner)) return reference(owner, env, via);
208
- if (ts.isVariableDeclaration(owner) && owner.initializer && owner.parent.flags & ts.NodeFlags.Const) return resolve(reference(owner.initializer, env, via), next(context));
315
+ if (ts.isVariableDeclaration(owner) && owner.initializer && owner.parent.flags & ts.NodeFlags.Const)
316
+ return resolve(reference(owner.initializer, env, via), next(context));
209
317
  }
210
318
  return resolve(selected, next(context));
211
319
  }
212
- const names = keys(object, next(context));
320
+ const names = await keys(object, next(context));
213
321
  if (strict) return unknown("A dynamic property selection is not a statically known value.");
214
- return names.length ? union(names.map(name => get(object, name, next(context)))) : unknown();
322
+ return names.length ? resolve(union(await mapAsync(names, async (name) => get(object, name, next(context)))), next(context)) : unknown();
215
323
  }
216
324
  if (ts.isConditionalExpression(node)) {
217
- const condition = resolve(reference(node.condition, env, via), next(context));
218
- return condition.kind === "literal" ? resolve(reference(condition.value ? node.whenTrue : node.whenFalse, env, via), next(context)) : union([reference(node.whenTrue, env, via), reference(node.whenFalse, env, via)]);
325
+ const condition = await resolve(reference(node.condition, env, via), next(context));
326
+ return condition.kind === "literal"
327
+ ? await resolve(reference(condition.value ? node.whenTrue : node.whenFalse, env, via), next(context))
328
+ : union([reference(node.whenTrue, env, via), reference(node.whenFalse, env, via)]);
219
329
  }
220
330
  if (ts.isBinaryExpression(node)) {
221
- const left = resolve(reference(node.left, env, via), next(context)), right = reference(node.right, env, via), operator = node.operatorToken.kind;
222
- if (operator === ts.SyntaxKind.AmpersandAmpersandToken) return left.kind === "literal" ? left.value ? right : literal(undefined) : union([literal(undefined), right]);
223
- if (operator === ts.SyntaxKind.BarBarToken) return left.kind === "literal" ? left.value ? left : right : union([left, right]);
224
- if (operator === ts.SyntaxKind.QuestionQuestionToken) return left.kind === "literal" ? left.value == null ? right : left : union([left, right]);
225
- const other = resolve(right, next(context));
226
- if (left.kind === "literal" && other.kind === "literal" && [ts.SyntaxKind.EqualsEqualsEqualsToken, ts.SyntaxKind.ExclamationEqualsEqualsToken].includes(operator)) return literal(operator === ts.SyntaxKind.EqualsEqualsEqualsToken ? left.value === other.value : left.value !== other.value);
331
+ const left = await resolve(reference(node.left, env, via), next(context)),
332
+ right = reference(node.right, env, via),
333
+ operator = node.operatorToken.kind;
334
+ if (operator === ts.SyntaxKind.AmpersandAmpersandToken)
335
+ return left.kind === "literal" ? (left.value ? right : literal(undefined)) : union([literal(undefined), right]);
336
+ if (operator === ts.SyntaxKind.BarBarToken) return left.kind === "literal" ? (left.value ? left : right) : union([left, right]);
337
+ if (operator === ts.SyntaxKind.QuestionQuestionToken) return left.kind === "literal" ? (left.value == null ? right : left) : union([left, right]);
338
+ const other = await resolve(right, next(context));
339
+ if (
340
+ left.kind === "literal" &&
341
+ other.kind === "literal" &&
342
+ [ts.SyntaxKind.EqualsEqualsEqualsToken, ts.SyntaxKind.ExclamationEqualsEqualsToken].includes(operator)
343
+ )
344
+ return literal(operator === ts.SyntaxKind.EqualsEqualsEqualsToken ? left.value === other.value : left.value !== other.value);
227
345
  }
228
346
  if (ts.isPrefixUnaryExpression(node) && node.operator === ts.SyntaxKind.ExclamationToken) {
229
- const operand = resolve(reference(node.operand, env, via), next(context));
347
+ const operand = await resolve(reference(node.operand, env, via), next(context));
230
348
  return operand.kind === "literal" ? literal(!operand.value) : unknown();
231
349
  }
232
- if (ts.isCallExpression(node) && !preserveCall(node.expression)) {
233
- if (strict && uiOperation(node.expression, checker) === "createContext") return { kind: "context" };
234
- if (["memo", "forwardRef"].includes(uiOperation(node.expression, checker))) return resolve(reference(node.arguments[0], env, via), next(context));
235
- const fn = resolve(reference(node.expression, env, via), next(context));
350
+ if (ts.isCallExpression(node) && !(await preserveCall(node.expression))) {
351
+ if (strict && (await uiOperation(node.expression, checker)) === "createContext") return { kind: "context" };
352
+ if (["memo", "forwardRef"].includes(await uiOperation(node.expression, checker))) return resolve(reference(node.arguments[0], env, via), next(context));
353
+ const fn = await resolve(reference(node.expression, env, via), next(context));
236
354
  if (fn.kind === "node" && isFunction(fn.node)) {
237
- const outputs = returns(fn, node.arguments.map(argument => reference(argument, env, via)), next(context));
238
- return withVia(resolve(union(outputs), next(context)), outputs.flatMap(item => item.via ?? []));
355
+ const outputs = await returns(
356
+ fn,
357
+ node.arguments.map((argument) => reference(argument, env, via)),
358
+ next(context),
359
+ );
360
+ return withVia(
361
+ await resolve(union(outputs), next(context)),
362
+ outputs.flatMap((item) => item.via ?? []),
363
+ );
239
364
  }
240
365
  return unknown(`Call ${node.expression.getText().slice(0, 80)} could not be traced to a local function.`);
241
366
  }
242
367
  return { ...value, node };
243
368
  }
244
- function arrays(value, context) {
245
- value = resolve(value, next(context));
369
+ async function arrays(value, context) {
370
+ value = await resolve(value, next(context));
246
371
  if (value.kind === "array") return value.values;
247
- if (value.kind === "node" && ts.isArrayLiteralExpression(value.node)) return value.node.elements.map(node => reference(node, value.env, value.via));
372
+ if (value.kind === "node" && ts.isArrayLiteralExpression(value.node)) return value.node.elements.map((node) => reference(node, value.env, value.via));
248
373
  return null;
249
374
  }
250
375
 
251
376
  function props(node, env = new Map(), via = []) {
252
- return { kind: "object", layers: node.attributes.properties.map(attribute => ts.isJsxSpreadAttribute(attribute) ? reference(attribute.expression, env, via) : new Map([[attribute.name.text, attribute.initializer ? ts.isJsxExpression(attribute.initializer) ? reference(attribute.initializer.expression, env, via) : reference(attribute.initializer, env, via) : literal(true)]])) };
377
+ return {
378
+ kind: "object",
379
+ layers: node.attributes.properties.map((attribute) =>
380
+ ts.isJsxSpreadAttribute(attribute)
381
+ ? reference(attribute.expression, env, via)
382
+ : new Map([
383
+ [
384
+ attribute.name.text,
385
+ attribute.initializer
386
+ ? ts.isJsxExpression(attribute.initializer)
387
+ ? reference(attribute.initializer.expression, env, via)
388
+ : reference(attribute.initializer, env, via)
389
+ : literal(true),
390
+ ],
391
+ ]),
392
+ ),
393
+ };
253
394
  }
254
395
  return { state, next, at, resolve, get, keys, arrays, returns, props, declaration };
255
396
  }