@antheo/morph 0.0.0-stage → 0.3.0

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 (464) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +266 -2
  3. package/SKILL.md +61 -0
  4. package/dist/ai/cli-provider.d.ts +80 -0
  5. package/dist/ai/cli-provider.js +250 -0
  6. package/dist/ai/gate.d.ts +39 -0
  7. package/dist/ai/gate.js +124 -0
  8. package/dist/ai/provider.d.ts +36 -0
  9. package/dist/ai/provider.js +168 -0
  10. package/dist/ai/repair.d.ts +90 -0
  11. package/dist/ai/repair.js +172 -0
  12. package/dist/analyzer/deps.d.ts +30 -0
  13. package/dist/analyzer/deps.js +265 -0
  14. package/dist/analyzer/manifest.d.ts +5 -0
  15. package/dist/analyzer/manifest.js +119 -0
  16. package/dist/analyzer/parse.d.ts +21 -0
  17. package/dist/analyzer/parse.js +29 -0
  18. package/dist/batch-worker.d.ts +16 -0
  19. package/dist/batch-worker.js +10 -0
  20. package/dist/batch.d.ts +26 -0
  21. package/dist/batch.js +227 -0
  22. package/dist/bridge/index.d.ts +26 -0
  23. package/dist/bridge/index.js +138 -0
  24. package/dist/bridge/props.d.ts +56 -0
  25. package/dist/bridge/props.js +191 -0
  26. package/dist/bridge/wrappers.d.ts +24 -0
  27. package/dist/bridge/wrappers.js +276 -0
  28. package/dist/cli/format.d.ts +7 -0
  29. package/dist/cli/format.js +30 -0
  30. package/dist/cli.d.ts +2 -0
  31. package/dist/cli.js +492 -0
  32. package/dist/fonts/carry.d.ts +34 -0
  33. package/dist/fonts/carry.js +113 -0
  34. package/dist/fonts/fallback.d.ts +11 -0
  35. package/dist/fonts/fallback.js +21 -0
  36. package/dist/fonts/google.d.ts +65 -0
  37. package/dist/fonts/google.js +343 -0
  38. package/dist/fonts/index.d.ts +27 -0
  39. package/dist/fonts/index.js +48 -0
  40. package/dist/fonts/local.d.ts +46 -0
  41. package/dist/fonts/local.js +150 -0
  42. package/dist/fonts/sfnt.d.ts +19 -0
  43. package/dist/fonts/sfnt.js +174 -0
  44. package/dist/fonts/shim.d.ts +14 -0
  45. package/dist/fonts/shim.js +96 -0
  46. package/dist/gate.d.ts +105 -0
  47. package/dist/gate.js +157 -0
  48. package/dist/index.d.ts +55 -0
  49. package/dist/index.js +74 -0
  50. package/dist/ir/annotate.d.ts +16 -0
  51. package/dist/ir/annotate.js +145 -0
  52. package/dist/ir/as-child.d.ts +18 -0
  53. package/dist/ir/as-child.js +239 -0
  54. package/dist/ir/compounds.d.ts +27 -0
  55. package/dist/ir/compounds.js +183 -0
  56. package/dist/ir/contexts.d.ts +26 -0
  57. package/dist/ir/contexts.js +185 -0
  58. package/dist/ir/dom.d.ts +11 -0
  59. package/dist/ir/dom.js +60 -0
  60. package/dist/ir/effect-returns.d.ts +10 -0
  61. package/dist/ir/effect-returns.js +25 -0
  62. package/dist/ir/extract-ui-types.d.ts +33 -0
  63. package/dist/ir/extract-ui-types.js +224 -0
  64. package/dist/ir/extract-ui.d.ts +34 -0
  65. package/dist/ir/extract-ui.js +567 -0
  66. package/dist/ir/falsy.d.ts +13 -0
  67. package/dist/ir/falsy.js +66 -0
  68. package/dist/ir/forward-refs.d.ts +11 -0
  69. package/dist/ir/forward-refs.js +155 -0
  70. package/dist/ir/fragment-source.d.ts +4 -0
  71. package/dist/ir/fragment-source.js +13 -0
  72. package/dist/ir/fragments.d.ts +32 -0
  73. package/dist/ir/fragments.js +192 -0
  74. package/dist/ir/helper-snippets.d.ts +30 -0
  75. package/dist/ir/helper-snippets.js +550 -0
  76. package/dist/ir/latest-refs.d.ts +11 -0
  77. package/dist/ir/latest-refs.js +187 -0
  78. package/dist/ir/live-args.d.ts +26 -0
  79. package/dist/ir/live-args.js +335 -0
  80. package/dist/ir/lower.d.ts +83 -0
  81. package/dist/ir/lower.js +6016 -0
  82. package/dist/ir/markup-values.d.ts +16 -0
  83. package/dist/ir/markup-values.js +188 -0
  84. package/dist/ir/model.d.ts +605 -0
  85. package/dist/ir/model.js +1 -0
  86. package/dist/ir/oracle.d.ts +91 -0
  87. package/dist/ir/oracle.js +610 -0
  88. package/dist/ir/radix.d.ts +122 -0
  89. package/dist/ir/radix.js +344 -0
  90. package/dist/ir/rename.d.ts +15 -0
  91. package/dist/ir/rename.js +151 -0
  92. package/dist/ir/render-props.d.ts +31 -0
  93. package/dist/ir/render-props.js +67 -0
  94. package/dist/ir/rewrite.d.ts +44 -0
  95. package/dist/ir/rewrite.js +381 -0
  96. package/dist/ir/running-index.d.ts +11 -0
  97. package/dist/ir/running-index.js +217 -0
  98. package/dist/ir/snapshots.d.ts +12 -0
  99. package/dist/ir/snapshots.js +140 -0
  100. package/dist/ir/style.d.ts +19 -0
  101. package/dist/ir/style.js +76 -0
  102. package/dist/ir/types.d.ts +42 -0
  103. package/dist/ir/types.js +271 -0
  104. package/dist/ir/walk.d.ts +11 -0
  105. package/dist/ir/walk.js +18 -0
  106. package/dist/mcp/server.d.ts +81 -0
  107. package/dist/mcp/server.js +518 -0
  108. package/dist/pipeline.d.ts +26 -0
  109. package/dist/pipeline.js +750 -0
  110. package/dist/registry/add.d.ts +91 -0
  111. package/dist/registry/add.js +273 -0
  112. package/dist/registry/fetch.d.ts +40 -0
  113. package/dist/registry/fetch.js +186 -0
  114. package/dist/registry/ip.d.ts +18 -0
  115. package/dist/registry/ip.js +153 -0
  116. package/dist/registry/item.d.ts +39 -0
  117. package/dist/registry/item.js +131 -0
  118. package/dist/registry/load.d.ts +35 -0
  119. package/dist/registry/load.js +106 -0
  120. package/dist/registry/paths.d.ts +8 -0
  121. package/dist/registry/paths.js +43 -0
  122. package/dist/registry/publish.d.ts +119 -0
  123. package/dist/registry/publish.js +439 -0
  124. package/dist/targets/angular/bank/bank.d.ts +39 -0
  125. package/dist/targets/angular/bank/bank.js +61 -0
  126. package/dist/targets/angular/bank/helpers.d.ts +64 -0
  127. package/dist/targets/angular/bank/helpers.js +246 -0
  128. package/dist/targets/angular/bank/kept.d.ts +98 -0
  129. package/dist/targets/angular/bank/kept.js +791 -0
  130. package/dist/targets/angular/bank/plan-helpers.d.ts +17 -0
  131. package/dist/targets/angular/bank/plan-helpers.js +286 -0
  132. package/dist/targets/angular/bank/plan.d.ts +22 -0
  133. package/dist/targets/angular/bank/plan.js +152 -0
  134. package/dist/targets/angular/bank/receivers.d.ts +66 -0
  135. package/dist/targets/angular/bank/receivers.js +293 -0
  136. package/dist/targets/angular/bank/runtime.d.ts +14 -0
  137. package/dist/targets/angular/bank/runtime.js +152 -0
  138. package/dist/targets/angular/controlled.d.ts +7 -0
  139. package/dist/targets/angular/controlled.js +37 -0
  140. package/dist/targets/angular/dynamic-tags.d.ts +34 -0
  141. package/dist/targets/angular/dynamic-tags.js +192 -0
  142. package/dist/targets/angular/emit.d.ts +41 -0
  143. package/dist/targets/angular/emit.js +5970 -0
  144. package/dist/targets/angular/exports.d.ts +48 -0
  145. package/dist/targets/angular/exports.js +243 -0
  146. package/dist/targets/angular/helpers.d.ts +15 -0
  147. package/dist/targets/angular/helpers.js +33 -0
  148. package/dist/targets/angular/host-boundary.d.ts +5 -0
  149. package/dist/targets/angular/host-boundary.js +166 -0
  150. package/dist/targets/angular/host-form.d.ts +150 -0
  151. package/dist/targets/angular/host-form.js +727 -0
  152. package/dist/targets/angular/markup-values.d.ts +58 -0
  153. package/dist/targets/angular/markup-values.js +661 -0
  154. package/dist/targets/angular/motion-directive.d.ts +12 -0
  155. package/dist/targets/angular/motion-directive.js +257 -0
  156. package/dist/targets/angular/motion-hooks.d.ts +73 -0
  157. package/dist/targets/angular/motion-hooks.js +293 -0
  158. package/dist/targets/angular/motion-layout.d.ts +14 -0
  159. package/dist/targets/angular/motion-layout.js +74 -0
  160. package/dist/targets/angular/motion-templates.d.ts +10 -0
  161. package/dist/targets/angular/motion-templates.js +65 -0
  162. package/dist/targets/angular/motion.d.ts +57 -0
  163. package/dist/targets/angular/motion.js +202 -0
  164. package/dist/targets/angular/narrowing.d.ts +24 -0
  165. package/dist/targets/angular/narrowing.js +205 -0
  166. package/dist/targets/angular/ngc.d.ts +23 -0
  167. package/dist/targets/angular/ngc.js +134 -0
  168. package/dist/targets/angular/passed-handle.d.ts +39 -0
  169. package/dist/targets/angular/passed-handle.js +154 -0
  170. package/dist/targets/angular/projected.d.ts +9 -0
  171. package/dist/targets/angular/projected.js +63 -0
  172. package/dist/targets/angular/radix/cores/alert-dialog.d.ts +13 -0
  173. package/dist/targets/angular/radix/cores/alert-dialog.js +388 -0
  174. package/dist/targets/angular/radix/cores/index.d.ts +17 -0
  175. package/dist/targets/angular/radix/cores/index.js +50 -0
  176. package/dist/targets/angular/radix/cores/slider.d.ts +8 -0
  177. package/dist/targets/angular/radix/cores/slider.js +202 -0
  178. package/dist/targets/angular/radix/index.d.ts +21 -0
  179. package/dist/targets/angular/radix/index.js +35 -0
  180. package/dist/targets/angular/radix/packages.d.ts +3 -0
  181. package/dist/targets/angular/radix/packages.js +558 -0
  182. package/dist/targets/angular/radix/part.d.ts +236 -0
  183. package/dist/targets/angular/radix/part.js +71 -0
  184. package/dist/targets/angular/radix/prepare.d.ts +66 -0
  185. package/dist/targets/angular/radix/prepare.js +548 -0
  186. package/dist/targets/angular/radix/template.d.ts +43 -0
  187. package/dist/targets/angular/radix/template.js +172 -0
  188. package/dist/targets/angular/refs.d.ts +68 -0
  189. package/dist/targets/angular/refs.js +443 -0
  190. package/dist/targets/angular/slots.d.ts +22 -0
  191. package/dist/targets/angular/slots.js +60 -0
  192. package/dist/targets/angular/source-types.d.ts +10 -0
  193. package/dist/targets/angular/source-types.js +45 -0
  194. package/dist/targets/angular/spread-forward.d.ts +24 -0
  195. package/dist/targets/angular/spread-forward.js +72 -0
  196. package/dist/targets/angular/spread.d.ts +32 -0
  197. package/dist/targets/angular/spread.js +182 -0
  198. package/dist/targets/angular/svg-hosts.d.ts +25 -0
  199. package/dist/targets/angular/svg-hosts.js +107 -0
  200. package/dist/targets/angular/template-expr.d.ts +36 -0
  201. package/dist/targets/angular/template-expr.js +287 -0
  202. package/dist/targets/angular/types.d.ts +9 -0
  203. package/dist/targets/angular/types.js +63 -0
  204. package/dist/targets/angular/walk.d.ts +11 -0
  205. package/dist/targets/angular/walk.js +26 -0
  206. package/dist/targets/react-native/emit.d.ts +14 -0
  207. package/dist/targets/react-native/emit.js +585 -0
  208. package/dist/targets/react-native/fidelity.d.ts +5 -0
  209. package/dist/targets/react-native/fidelity.js +43 -0
  210. package/dist/targets/react-native/motion.d.ts +10 -0
  211. package/dist/targets/react-native/motion.js +290 -0
  212. package/dist/targets/react-native/skia.d.ts +30 -0
  213. package/dist/targets/react-native/skia.js +358 -0
  214. package/dist/targets/shared/context.d.ts +47 -0
  215. package/dist/targets/shared/context.js +195 -0
  216. package/dist/targets/shared/foreign.d.ts +10 -0
  217. package/dist/targets/shared/foreign.js +72 -0
  218. package/dist/targets/shared/fragments.d.ts +21 -0
  219. package/dist/targets/shared/fragments.js +309 -0
  220. package/dist/targets/shared/handles.d.ts +65 -0
  221. package/dist/targets/shared/handles.js +299 -0
  222. package/dist/targets/shared/inline.d.ts +53 -0
  223. package/dist/targets/shared/inline.js +524 -0
  224. package/dist/targets/shared/layout.d.ts +70 -0
  225. package/dist/targets/shared/layout.js +224 -0
  226. package/dist/targets/shared/markup.d.ts +26 -0
  227. package/dist/targets/shared/markup.js +65 -0
  228. package/dist/targets/shared/module.d.ts +84 -0
  229. package/dist/targets/shared/module.js +468 -0
  230. package/dist/targets/shared/motion-hooks.d.ts +37 -0
  231. package/dist/targets/shared/motion-hooks.js +87 -0
  232. package/dist/targets/shared/motion-layout.d.ts +70 -0
  233. package/dist/targets/shared/motion-layout.js +392 -0
  234. package/dist/targets/shared/portal.d.ts +10 -0
  235. package/dist/targets/shared/portal.js +23 -0
  236. package/dist/targets/shared/prop-writes.d.ts +11 -0
  237. package/dist/targets/shared/prop-writes.js +32 -0
  238. package/dist/targets/shared/prune.d.ts +54 -0
  239. package/dist/targets/shared/prune.js +405 -0
  240. package/dist/targets/shared/react-libs.d.ts +25 -0
  241. package/dist/targets/shared/react-libs.js +142 -0
  242. package/dist/targets/shared/react-types.d.ts +16 -0
  243. package/dist/targets/shared/react-types.js +374 -0
  244. package/dist/targets/shared/react-values.d.ts +20 -0
  245. package/dist/targets/shared/react-values.js +145 -0
  246. package/dist/targets/shared/ref-callback.d.ts +16 -0
  247. package/dist/targets/shared/ref-callback.js +114 -0
  248. package/dist/targets/shared/script.d.ts +65 -0
  249. package/dist/targets/shared/script.js +406 -0
  250. package/dist/targets/shared/unused.d.ts +12 -0
  251. package/dist/targets/shared/unused.js +146 -0
  252. package/dist/targets/svelte/dom-spread.d.ts +27 -0
  253. package/dist/targets/svelte/dom-spread.js +146 -0
  254. package/dist/targets/svelte/emit.d.ts +15 -0
  255. package/dist/targets/svelte/emit.js +3784 -0
  256. package/dist/targets/svelte/handle-branches.d.ts +22 -0
  257. package/dist/targets/svelte/handle-branches.js +146 -0
  258. package/dist/targets/svelte/html-keys.d.ts +9 -0
  259. package/dist/targets/svelte/html-keys.js +40 -0
  260. package/dist/targets/svelte/markup-data/data.d.ts +51 -0
  261. package/dist/targets/svelte/markup-data/data.js +305 -0
  262. package/dist/targets/svelte/markup-data/helper.d.ts +12 -0
  263. package/dist/targets/svelte/markup-data/helper.js +81 -0
  264. package/dist/targets/svelte/markup-data/module-data.d.ts +21 -0
  265. package/dist/targets/svelte/markup-data/module-data.js +473 -0
  266. package/dist/targets/svelte/markup-data/sites.d.ts +52 -0
  267. package/dist/targets/svelte/markup-data/sites.js +303 -0
  268. package/dist/targets/svelte/motion-layout.d.ts +13 -0
  269. package/dist/targets/svelte/motion-layout.js +70 -0
  270. package/dist/targets/svelte/motion-table.d.ts +14 -0
  271. package/dist/targets/svelte/motion-table.js +308 -0
  272. package/dist/targets/svelte/motion.d.ts +46 -0
  273. package/dist/targets/svelte/motion.js +405 -0
  274. package/dist/targets/svelte/presence.d.ts +71 -0
  275. package/dist/targets/svelte/presence.js +318 -0
  276. package/dist/targets/svelte/radix/accordion.d.ts +9 -0
  277. package/dist/targets/svelte/radix/accordion.js +24 -0
  278. package/dist/targets/svelte/radix/aspect-ratio.d.ts +6 -0
  279. package/dist/targets/svelte/radix/aspect-ratio.js +8 -0
  280. package/dist/targets/svelte/radix/avatar.d.ts +6 -0
  281. package/dist/targets/svelte/radix/avatar.js +10 -0
  282. package/dist/targets/svelte/radix/checkbox.d.ts +10 -0
  283. package/dist/targets/svelte/radix/checkbox.js +24 -0
  284. package/dist/targets/svelte/radix/collapsible.d.ts +7 -0
  285. package/dist/targets/svelte/radix/collapsible.js +16 -0
  286. package/dist/targets/svelte/radix/context-menu.d.ts +8 -0
  287. package/dist/targets/svelte/radix/context-menu.js +49 -0
  288. package/dist/targets/svelte/radix/cores/alert-dialog.d.ts +17 -0
  289. package/dist/targets/svelte/radix/cores/alert-dialog.js +449 -0
  290. package/dist/targets/svelte/radix/cores/collapsible.d.ts +12 -0
  291. package/dist/targets/svelte/radix/cores/collapsible.js +214 -0
  292. package/dist/targets/svelte/radix/cores/core.d.ts +32 -0
  293. package/dist/targets/svelte/radix/cores/core.js +80 -0
  294. package/dist/targets/svelte/radix/cores/direction.d.ts +10 -0
  295. package/dist/targets/svelte/radix/cores/direction.js +64 -0
  296. package/dist/targets/svelte/radix/cores/index.d.ts +19 -0
  297. package/dist/targets/svelte/radix/cores/index.js +85 -0
  298. package/dist/targets/svelte/radix/cores/modal-layer.d.ts +11 -0
  299. package/dist/targets/svelte/radix/cores/modal-layer.js +244 -0
  300. package/dist/targets/svelte/radix/cores/presence.d.ts +12 -0
  301. package/dist/targets/svelte/radix/cores/presence.js +129 -0
  302. package/dist/targets/svelte/radix/cores/slider-logic.d.ts +10 -0
  303. package/dist/targets/svelte/radix/cores/slider-logic.js +287 -0
  304. package/dist/targets/svelte/radix/cores/slider.d.ts +13 -0
  305. package/dist/targets/svelte/radix/cores/slider.js +267 -0
  306. package/dist/targets/svelte/radix/dialog.d.ts +8 -0
  307. package/dist/targets/svelte/radix/dialog.js +20 -0
  308. package/dist/targets/svelte/radix/dropdown-menu.d.ts +9 -0
  309. package/dist/targets/svelte/radix/dropdown-menu.js +38 -0
  310. package/dist/targets/svelte/radix/emit.d.ts +12 -0
  311. package/dist/targets/svelte/radix/emit.js +1339 -0
  312. package/dist/targets/svelte/radix/hover-card.d.ts +7 -0
  313. package/dist/targets/svelte/radix/hover-card.js +22 -0
  314. package/dist/targets/svelte/radix/index.d.ts +12 -0
  315. package/dist/targets/svelte/radix/index.js +28 -0
  316. package/dist/targets/svelte/radix/label.d.ts +3 -0
  317. package/dist/targets/svelte/radix/label.js +5 -0
  318. package/dist/targets/svelte/radix/menubar.d.ts +7 -0
  319. package/dist/targets/svelte/radix/menubar.js +34 -0
  320. package/dist/targets/svelte/radix/navigation-menu.d.ts +8 -0
  321. package/dist/targets/svelte/radix/navigation-menu.js +25 -0
  322. package/dist/targets/svelte/radix/packages.d.ts +34 -0
  323. package/dist/targets/svelte/radix/packages.js +100 -0
  324. package/dist/targets/svelte/radix/part.d.ts +161 -0
  325. package/dist/targets/svelte/radix/part.js +85 -0
  326. package/dist/targets/svelte/radix/popover.d.ts +7 -0
  327. package/dist/targets/svelte/radix/popover.js +15 -0
  328. package/dist/targets/svelte/radix/progress.d.ts +11 -0
  329. package/dist/targets/svelte/radix/progress.js +27 -0
  330. package/dist/targets/svelte/radix/radio-group.d.ts +9 -0
  331. package/dist/targets/svelte/radix/radio-group.js +26 -0
  332. package/dist/targets/svelte/radix/scroll-area.d.ts +7 -0
  333. package/dist/targets/svelte/radix/scroll-area.js +19 -0
  334. package/dist/targets/svelte/radix/select.d.ts +13 -0
  335. package/dist/targets/svelte/radix/select.js +81 -0
  336. package/dist/targets/svelte/radix/separator.d.ts +3 -0
  337. package/dist/targets/svelte/radix/separator.js +5 -0
  338. package/dist/targets/svelte/radix/slider.d.ts +6 -0
  339. package/dist/targets/svelte/radix/slider.js +8 -0
  340. package/dist/targets/svelte/radix/switch.d.ts +6 -0
  341. package/dist/targets/svelte/radix/switch.js +10 -0
  342. package/dist/targets/svelte/radix/tabs.d.ts +8 -0
  343. package/dist/targets/svelte/radix/tabs.js +15 -0
  344. package/dist/targets/svelte/radix/toggle-group.d.ts +9 -0
  345. package/dist/targets/svelte/radix/toggle-group.js +17 -0
  346. package/dist/targets/svelte/radix/toggle.d.ts +6 -0
  347. package/dist/targets/svelte/radix/toggle.js +9 -0
  348. package/dist/targets/svelte/radix/tooltip.d.ts +6 -0
  349. package/dist/targets/svelte/radix/tooltip.js +24 -0
  350. package/dist/targets/svelte/strip.d.ts +2 -0
  351. package/dist/targets/svelte/strip.js +5 -0
  352. package/dist/targets/vue/emit.d.ts +15 -0
  353. package/dist/targets/vue/emit.js +4092 -0
  354. package/dist/targets/vue/events.d.ts +11 -0
  355. package/dist/targets/vue/events.js +13 -0
  356. package/dist/targets/vue/module-builders.d.ts +28 -0
  357. package/dist/targets/vue/module-builders.js +258 -0
  358. package/dist/targets/vue/motion-layout.d.ts +19 -0
  359. package/dist/targets/vue/motion-layout.js +79 -0
  360. package/dist/targets/vue/motion.d.ts +12 -0
  361. package/dist/targets/vue/motion.js +46 -0
  362. package/dist/targets/vue/radix/accordion.d.ts +3 -0
  363. package/dist/targets/vue/radix/accordion.js +12 -0
  364. package/dist/targets/vue/radix/alert-dialog.d.ts +6 -0
  365. package/dist/targets/vue/radix/alert-dialog.js +18 -0
  366. package/dist/targets/vue/radix/aspect-ratio.d.ts +6 -0
  367. package/dist/targets/vue/radix/aspect-ratio.js +8 -0
  368. package/dist/targets/vue/radix/avatar.d.ts +3 -0
  369. package/dist/targets/vue/radix/avatar.js +7 -0
  370. package/dist/targets/vue/radix/checkbox.d.ts +3 -0
  371. package/dist/targets/vue/radix/checkbox.js +9 -0
  372. package/dist/targets/vue/radix/collapsible.d.ts +7 -0
  373. package/dist/targets/vue/radix/collapsible.js +11 -0
  374. package/dist/targets/vue/radix/context-menu.d.ts +3 -0
  375. package/dist/targets/vue/radix/context-menu.js +30 -0
  376. package/dist/targets/vue/radix/dialog.d.ts +3 -0
  377. package/dist/targets/vue/radix/dialog.js +12 -0
  378. package/dist/targets/vue/radix/direction.d.ts +7 -0
  379. package/dist/targets/vue/radix/direction.js +9 -0
  380. package/dist/targets/vue/radix/dropdown-menu.d.ts +3 -0
  381. package/dist/targets/vue/radix/dropdown-menu.js +29 -0
  382. package/dist/targets/vue/radix/hover-card.d.ts +3 -0
  383. package/dist/targets/vue/radix/hover-card.js +11 -0
  384. package/dist/targets/vue/radix/index.d.ts +65 -0
  385. package/dist/targets/vue/radix/index.js +225 -0
  386. package/dist/targets/vue/radix/label.d.ts +3 -0
  387. package/dist/targets/vue/radix/label.js +5 -0
  388. package/dist/targets/vue/radix/menubar.d.ts +6 -0
  389. package/dist/targets/vue/radix/menubar.js +29 -0
  390. package/dist/targets/vue/radix/navigation-menu.d.ts +6 -0
  391. package/dist/targets/vue/radix/navigation-menu.js +21 -0
  392. package/dist/targets/vue/radix/part.d.ts +41 -0
  393. package/dist/targets/vue/radix/part.js +46 -0
  394. package/dist/targets/vue/radix/popover.d.ts +3 -0
  395. package/dist/targets/vue/radix/popover.js +11 -0
  396. package/dist/targets/vue/radix/progress.d.ts +3 -0
  397. package/dist/targets/vue/radix/progress.js +6 -0
  398. package/dist/targets/vue/radix/radio-group.d.ts +3 -0
  399. package/dist/targets/vue/radix/radio-group.js +10 -0
  400. package/dist/targets/vue/radix/scroll-area.d.ts +3 -0
  401. package/dist/targets/vue/radix/scroll-area.js +11 -0
  402. package/dist/targets/vue/radix/select.d.ts +3 -0
  403. package/dist/targets/vue/radix/select.js +29 -0
  404. package/dist/targets/vue/radix/separator.d.ts +3 -0
  405. package/dist/targets/vue/radix/separator.js +5 -0
  406. package/dist/targets/vue/radix/slider.d.ts +3 -0
  407. package/dist/targets/vue/radix/slider.js +13 -0
  408. package/dist/targets/vue/radix/switch.d.ts +3 -0
  409. package/dist/targets/vue/radix/switch.js +9 -0
  410. package/dist/targets/vue/radix/tabs.d.ts +3 -0
  411. package/dist/targets/vue/radix/tabs.js +12 -0
  412. package/dist/targets/vue/radix/toggle-group.d.ts +3 -0
  413. package/dist/targets/vue/radix/toggle-group.js +10 -0
  414. package/dist/targets/vue/radix/toggle.d.ts +3 -0
  415. package/dist/targets/vue/radix/toggle.js +8 -0
  416. package/dist/targets/vue/radix/tooltip.d.ts +3 -0
  417. package/dist/targets/vue/radix/tooltip.js +14 -0
  418. package/dist/targets/vue/render-fn/h.d.ts +52 -0
  419. package/dist/targets/vue/render-fn/h.js +442 -0
  420. package/dist/targets/vue/render-fn.d.ts +21 -0
  421. package/dist/targets/vue/render-fn.js +357 -0
  422. package/dist/targets/vue/slot.d.ts +9 -0
  423. package/dist/targets/vue/slot.js +57 -0
  424. package/dist/typecheck/host.d.ts +45 -0
  425. package/dist/typecheck/host.js +309 -0
  426. package/dist/typecheck/index.d.ts +16 -0
  427. package/dist/typecheck/index.js +17 -0
  428. package/dist/typecheck/lucide.d.ts +8 -0
  429. package/dist/typecheck/lucide.js +45 -0
  430. package/dist/typecheck/sourcemap.d.ts +9 -0
  431. package/dist/typecheck/sourcemap.js +54 -0
  432. package/dist/typecheck/svelte.d.ts +9 -0
  433. package/dist/typecheck/svelte.js +116 -0
  434. package/dist/typecheck/vue.d.ts +8 -0
  435. package/dist/typecheck/vue.js +78 -0
  436. package/dist/types.d.ts +446 -0
  437. package/dist/types.js +11 -0
  438. package/dist/utils/cleanup.d.ts +32 -0
  439. package/dist/utils/cleanup.js +119 -0
  440. package/dist/utils/errors.d.ts +7 -0
  441. package/dist/utils/errors.js +15 -0
  442. package/dist/utils/fs-safe.d.ts +14 -0
  443. package/dist/utils/fs-safe.js +64 -0
  444. package/dist/validate.d.ts +16 -0
  445. package/dist/validate.js +204 -0
  446. package/dist/verify/auto-steps.d.ts +107 -0
  447. package/dist/verify/auto-steps.js +471 -0
  448. package/dist/verify/bundle.d.ts +68 -0
  449. package/dist/verify/bundle.js +548 -0
  450. package/dist/verify/diff.d.ts +31 -0
  451. package/dist/verify/diff.js +133 -0
  452. package/dist/verify/leaks.d.ts +25 -0
  453. package/dist/verify/leaks.js +261 -0
  454. package/dist/verify/link-worker.d.ts +1 -0
  455. package/dist/verify/link-worker.js +27 -0
  456. package/dist/verify/runner.d.ts +57 -0
  457. package/dist/verify/runner.js +867 -0
  458. package/dist/verify/sandbox.d.ts +40 -0
  459. package/dist/verify/sandbox.js +496 -0
  460. package/dist/verify/steps.d.ts +42 -0
  461. package/dist/verify/steps.js +475 -0
  462. package/dist/verify/verdict.d.ts +15 -0
  463. package/dist/verify/verdict.js +19 -0
  464. package/package.json +118 -4
@@ -0,0 +1,78 @@
1
+ import { join, resolve } from 'node:path';
2
+ import ts from 'typescript';
3
+ import { AMBIENT, baseOptions, createVirtualHost, key, MORPH_ROOT, messageOf, resolveWithProject } from './host.js';
4
+ let engine = null;
5
+ async function load() {
6
+ if (engine)
7
+ return engine;
8
+ const coreModule = (await import('@vue/language-core'));
9
+ const volarModule = (await import('@volar/typescript'));
10
+ const core = coreModule.default ?? coreModule;
11
+ const volar = volarModule.default ?? volarModule;
12
+ // vue-tsc's defaults for a project with no vueCompilerOptions; the Vue version is read from the package's own vue
13
+ const vueOptions = core.createParsedCommandLineByJson(ts, ts.sys, MORPH_ROOT.replace(/\\/g, '/'), {}).vueOptions;
14
+ engine = { core, volar, vueOptions };
15
+ return engine;
16
+ }
17
+ /**
18
+ * Vue 3: the program vue-tsc builds. @vue/language-core turns each SFC (script, script setup and template) into
19
+ * virtual TypeScript, @volar/typescript wraps ts.createProgram to use it and maps every error back to its place in
20
+ * the .vue file (errors in code it wrote for itself are dropped, as vue-tsc drops them).
21
+ */
22
+ export async function typecheckVue(files, root, projectRoot = null) {
23
+ const { core, volar, vueOptions } = await load();
24
+ const virtual = new Map();
25
+ for (const f of files)
26
+ virtual.set(key(resolve(root, f.path)), f.contents);
27
+ const ambient = key(join(root, '__ambient.d.ts'));
28
+ virtual.set(ambient, AMBIENT);
29
+ const options = { ...baseOptions(), jsx: ts.JsxEmit.Preserve, jsxImportSource: 'vue', allowNonTsExtensions: true };
30
+ const host = createVirtualHost(options, root, virtual, undefined, projectRoot);
31
+ // packages the output imports from the compiled project (`class-variance-authority`) resolve where its code finds them
32
+ if (projectRoot)
33
+ resolveWithProject(host, options, root, projectRoot);
34
+ // @vue/language-core keeps every SFC's virtual code in a registry that lives as long as the process (a language
35
+ // server updates them in place). Every check here has its own folder, so nothing is ever updated: each one is
36
+ // disposed after its check, or a batch keeps all of them (about 25 MB a component) until it runs out of memory.
37
+ const disposals = [];
38
+ const createProgram = volar.proxyCreateProgram(ts, ts.createProgram, (tsModule, createOptions) => {
39
+ const plugin = core.createVueLanguagePlugin(tsModule, createOptions.options, vueOptions, (id) => id);
40
+ const { createVirtualCode, disposeVirtualCode } = plugin;
41
+ if (!createVirtualCode || !disposeVirtualCode)
42
+ return [plugin];
43
+ return [
44
+ {
45
+ ...plugin,
46
+ createVirtualCode(scriptId, languageId, snapshot, ctx) {
47
+ const code = createVirtualCode.call(plugin, scriptId, languageId, snapshot, ctx);
48
+ if (code)
49
+ disposals.push(() => disposeVirtualCode.call(plugin, scriptId, code));
50
+ return code;
51
+ },
52
+ },
53
+ ];
54
+ });
55
+ const rootNames = [...virtual.keys()].filter((f) => f.endsWith('.vue') || f.endsWith('.ts'));
56
+ let diagnostics;
57
+ try {
58
+ const program = createProgram({ rootNames, options, host });
59
+ diagnostics = [...program.getOptionsDiagnostics(), ...program.getGlobalDiagnostics(), ...program.getSyntacticDiagnostics(), ...program.getSemanticDiagnostics()];
60
+ }
61
+ finally {
62
+ for (const dispose of disposals.splice(0))
63
+ dispose();
64
+ }
65
+ const rootKey = key(root);
66
+ const problems = [];
67
+ for (const d of diagnostics) {
68
+ if (d.category !== ts.DiagnosticCategory.Error)
69
+ continue;
70
+ const file = d.file ? key(d.file.fileName) : '';
71
+ if (file === ambient)
72
+ continue;
73
+ const inside = file.startsWith(rootKey + '/');
74
+ const line = d.file && d.start !== undefined ? d.file.getLineAndCharacterOfPosition(d.start).line + 1 : null;
75
+ problems.push({ path: inside ? file.slice(rootKey.length + 1) : file || '(project)', line: inside ? line : null, message: messageOf(d) });
76
+ }
77
+ return problems;
78
+ }
@@ -0,0 +1,446 @@
1
+ /** Public types shared by the analyzer, the emitters, verify and the CLI. */
2
+ export type Target = 'vue' | 'svelte' | 'angular' | 'react-native';
3
+ export declare const TARGETS: readonly Target[];
4
+ /** The targets morph holds to its full bar (compiled, type-checked, scored in a browser); the default. */
5
+ export declare const TIER_ONE: readonly Target[];
6
+ /**
7
+ * Targets asked for by name. Angular is checked by the Angular compiler in strict mode (strictTemplates) and needs the
8
+ * optional @angular packages; React Native is experimental: not yet held to the full bar.
9
+ */
10
+ export declare const EXPERIMENTAL: readonly Target[];
11
+ export type WebTarget = Exclude<Target, 'react-native'>;
12
+ /** Targets whose output is single-file components (.vue, .svelte). */
13
+ export type SfcTarget = 'vue' | 'svelte';
14
+ export type Severity = 'error' | 'warning' | 'info';
15
+ /**
16
+ * One finding. `error` blocks a clean conversion (the construct is not converted), `warning` means the output works
17
+ * but differs from the React original in a stated way, `info` is a note that changes nothing visible.
18
+ */
19
+ export interface Diagnostic {
20
+ code: string;
21
+ severity: Severity;
22
+ message: string;
23
+ file?: string;
24
+ line?: number;
25
+ target?: Target;
26
+ }
27
+ /**
28
+ * `bridged` (bridge mode only, opt-in): the compiler refused the file, and a thin wrapper in the target mounts the React
29
+ * original with react-dom instead. It is not a conversion: never counted as clean, partial or supported.
30
+ *
31
+ * `assisted` (assisted mode only, opt-in): a model wrote the output, and it passed every gate (the target's compiler,
32
+ * the strict type check, the browser harness against the React original, the unmount check). It is not the compiler's
33
+ * conversion: never counted as clean or partial.
34
+ */
35
+ export type Status = 'clean' | 'partial' | 'unsupported' | 'bridged' | 'assisted';
36
+ /** Counts by status: `bridged` is present only in a run with bridge mode on, `assisted` only in one with assisted mode on. */
37
+ export type StatusCounts = Record<Exclude<Status, 'bridged' | 'assisted'>, number> & {
38
+ bridged?: number;
39
+ assisted?: number;
40
+ };
41
+ export interface PropInfo {
42
+ name: string;
43
+ optional: boolean;
44
+ hasDefault: boolean;
45
+ kind: 'value' | 'children' | 'node' | 'event' | 'class' | 'style' | 'ref';
46
+ }
47
+ export interface ComponentInfo {
48
+ name: string;
49
+ exported: boolean;
50
+ isDefault: boolean;
51
+ props: PropInfo[];
52
+ hooks: string[];
53
+ usesMotion: boolean;
54
+ usesCanvas: boolean;
55
+ usesWebGL: boolean;
56
+ }
57
+ export interface Features {
58
+ tailwind: boolean;
59
+ framerMotion: boolean;
60
+ canvas2d: boolean;
61
+ webgl: boolean;
62
+ glsl: boolean;
63
+ svg: boolean;
64
+ cssImports: string[];
65
+ nextFont: boolean;
66
+ customHooks: string[];
67
+ effects: number;
68
+ }
69
+ export interface ModuleImport {
70
+ source: string;
71
+ kind: 'react' | 'motion' | 'local' | 'css' | 'next-font' | 'next-web' | 'next-app' | 'icons' | 'agnostic' | 'react-lib' | 'unsupported' | 'unknown';
72
+ resolved?: string;
73
+ names: string[];
74
+ }
75
+ export interface AnalyzeResult {
76
+ file: string;
77
+ components: ComponentInfo[];
78
+ hooks: string[];
79
+ imports: ModuleImport[];
80
+ features: Features;
81
+ diagnostics: Diagnostic[];
82
+ /** every local file the entry pulls in, the entry first */
83
+ graph: string[];
84
+ }
85
+ export interface EmittedFile {
86
+ /** path relative to the output root, with forward slashes */
87
+ path: string;
88
+ contents: string;
89
+ kind: 'component' | 'module' | 'style' | 'core' | 'report';
90
+ }
91
+ export interface FidelityItem {
92
+ feature: string;
93
+ weight: number;
94
+ detail: string;
95
+ }
96
+ export interface FidelityReport {
97
+ score: number;
98
+ lost: FidelityItem[];
99
+ kept: string[];
100
+ }
101
+ export interface TargetResult {
102
+ target: Target;
103
+ status: Status;
104
+ files: EmittedFile[];
105
+ diagnostics: Diagnostic[];
106
+ /** whether every emitted file passed the target's real compiler or parser */
107
+ validated: boolean;
108
+ fidelity?: FidelityReport;
109
+ }
110
+ export interface CompileResult {
111
+ file: string;
112
+ status: Status;
113
+ analysis: AnalyzeResult;
114
+ targets: TargetResult[];
115
+ }
116
+ export interface ProjectOptions {
117
+ /** project root: imports may not leave it; defaults to the nearest folder with a tsconfig.json or package.json */
118
+ root?: string;
119
+ /** import aliases, e.g. { '@/': '<root>/src/' }; defaults to tsconfig `paths` */
120
+ aliases?: Record<string, string>;
121
+ }
122
+ export interface CompileOptions extends ProjectOptions {
123
+ targets?: Target[];
124
+ /** run the real target compilers over every emitted file (default true) */
125
+ validate?: boolean;
126
+ /**
127
+ * type-check validated Vue and Svelte output, strict, as vue-tsc and svelte-check would (default true; it needs
128
+ * `validate`). Errors come back as `type-error` warnings.
129
+ */
130
+ typecheck?: boolean;
131
+ /** stops the compile between steps (it rejects with the signal's reason) */
132
+ signal?: AbortSignal;
133
+ /**
134
+ * bridge mode (default off): for a web target the compiler refuses, emit a wrapper that mounts the React original with
135
+ * react-dom (status `bridged`, diagnostic `bridged`), when every prop it needs can cross. Off: nothing changes.
136
+ */
137
+ bridge?: boolean;
138
+ /**
139
+ * next/font/google (default off): ask Google Fonts at conversion time for the CSS and files Next.js would ask for, and
140
+ * carry them in the output as next/font/local's files are (src/fonts). Only https://fonts.googleapis.com and
141
+ * https://fonts.gstatic.com are asked, and every URL is logged. Off: nothing is fetched and the call becomes a generic
142
+ * family, as before.
143
+ */
144
+ fonts?: boolean | FontsOptions;
145
+ /**
146
+ * M6, extract-UI mode (default off): the entry's component is sliced from its app before it converts. What it read
147
+ * from `next/navigation` (useRouter, usePathname, useSearchParams, useParams), from a zustand store hook, from a
148
+ * `'use server'` action or by awaiting while it rendered becomes value and callback props (warning `ui-extracted`,
149
+ * plus `<Component>.contract.ts` with the exact boundary). The result is never clean: its props are wider than the
150
+ * source's. A shape it does not slice converts as without the option (note `ui-extract-skipped`). Off: nothing changes.
151
+ */
152
+ extractUi?: boolean;
153
+ }
154
+ /** Where the fonts option keeps what it downloaded, and whether it may download at all. */
155
+ export interface FontsOptions {
156
+ /** folder for downloaded CSS and files, reused between runs (default: a folder in the system temp directory) */
157
+ cache?: string;
158
+ /** a file each requested URL is appended to before it is requested (default: requests.log in the cache folder) */
159
+ log?: string;
160
+ /** read the cache only: a font not in it keeps its warning, nothing is requested */
161
+ offline?: boolean;
162
+ }
163
+ export interface BatchEntry {
164
+ file: string;
165
+ status: Status;
166
+ targets: Record<Target, {
167
+ status: Status;
168
+ validated: boolean;
169
+ diagnostics: number;
170
+ fidelity?: number;
171
+ }>;
172
+ diagnostics: Diagnostic[];
173
+ }
174
+ export interface BatchReport {
175
+ generatedAt: string;
176
+ root: string;
177
+ dirs: string[];
178
+ totals: {
179
+ files: number;
180
+ byTarget: Record<Target, StatusCounts>;
181
+ allTargets: StatusCounts;
182
+ validationFailures: Record<Target, number>;
183
+ };
184
+ topCauses: {
185
+ code: string;
186
+ severity: Severity;
187
+ count: number;
188
+ files: number;
189
+ example: string;
190
+ }[];
191
+ entries: BatchEntry[];
192
+ }
193
+ export interface BatchOptions extends CompileOptions {
194
+ /** write emitted files here (one folder per target) */
195
+ outDir?: string;
196
+ /** only these sub-folders of the input */
197
+ include?: string[];
198
+ exclude?: string[];
199
+ /** the longest one file may take, ms (default 180000): a file that takes longer is stopped and reported as `compile-timeout` */
200
+ fileTimeoutMs?: number;
201
+ }
202
+ export type InteractionState = 'idle' | 'hover' | 'active';
203
+ /**
204
+ * Where a step acts, found the same way on the React page and on every target page, inside the component's root, first
205
+ * match in document order: an ARIA role with an exact accessible name (the name is optional), an exact text, or a CSS
206
+ * selector. A selector should name only what the component's own markup says (a tag, an attribute such as `type`,
207
+ * `value`, `aria-*`, `data-*`, or its structure), never a generated class or a framework's attribute.
208
+ */
209
+ export type StepLocator = {
210
+ role: string;
211
+ name?: string;
212
+ } | {
213
+ text: string;
214
+ } | {
215
+ selector: string;
216
+ };
217
+ /** The keys a `press` step may send: these, or any single printable character (`/`, `,`, `a`). */
218
+ export declare const STEP_KEYS: readonly ["Escape", "Enter", "Space", "Tab", "Shift+Tab", "Backspace", "Delete", "Home", "End", "PageUp", "PageDown", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"];
219
+ /**
220
+ * One user action, then a shot named by the step, compared with React's shot after the same step. `wait` is virtual
221
+ * time (ms, default `stepMs`, at most 5000) stepped after the action so transitions finish before the shot.
222
+ *
223
+ * - `click`: the pointer moves to the centre of the target, presses and releases (a real click, hit-tested);
224
+ * - `hover`: the pointer moves to the centre of the target; `leave`: the pointer moves to the page's top-left corner;
225
+ * - `focus`: the target is focused;
226
+ * - `type`: the target is focused with the caret at the end (or its text selected and deleted, with `clear`), then the
227
+ * text is typed key by key;
228
+ * - `press`: one key, sent to the target (focused first) or, without one, to whatever has focus; with `hold`, the key
229
+ * is held down for that many virtual ms before it is released (as a person's finger holds it), so timers a key-down
230
+ * starts run while the key is still down, as they do for a user; without it, down and up come in the same instant;
231
+ * - `right-click`: the pointer moves to the centre of the target and presses and releases its right button (the
232
+ * browser fires `contextmenu` as it does for a person's right click);
233
+ * - `drag` (X6): the pointer moves to the centre of the target and presses the left button, then moves in `moves`
234
+ * even steps (default 5) to `to` (an offset `{ dx, dy }` in CSS px from where it pressed, or the centre of another
235
+ * target), with `duration` virtual ms (default 160) spread evenly between the moves, as a hand drags, then releases.
236
+ * Every event is real browser input; the target is found once, before the press;
237
+ * - `wait`: nothing but time.
238
+ */
239
+ export type VerifyStep = {
240
+ name: string;
241
+ action: 'click' | 'hover' | 'focus';
242
+ target: StepLocator;
243
+ wait?: number;
244
+ } | {
245
+ name: string;
246
+ action: 'type';
247
+ target: StepLocator;
248
+ text: string;
249
+ clear?: boolean;
250
+ wait?: number;
251
+ } | {
252
+ name: string;
253
+ action: 'press';
254
+ key: string;
255
+ target?: StepLocator;
256
+ wait?: number;
257
+ hold?: number;
258
+ } | {
259
+ name: string;
260
+ action: 'right-click';
261
+ target: StepLocator;
262
+ wait?: number;
263
+ } | {
264
+ name: string;
265
+ action: 'drag';
266
+ target: StepLocator;
267
+ to: {
268
+ dx: number;
269
+ dy: number;
270
+ } | StepLocator;
271
+ moves?: number;
272
+ duration?: number;
273
+ wait?: number;
274
+ } | {
275
+ name: string;
276
+ action: 'leave' | 'wait';
277
+ wait?: number;
278
+ };
279
+ export interface VerifyOptions extends ProjectOptions {
280
+ /** the named export to render; default: the file's default export, else its first exported component */
281
+ exportName?: string;
282
+ props?: Record<string, unknown>;
283
+ states?: InteractionState[];
284
+ targets?: WebTarget[];
285
+ /** the component fills the box it is given (a background): it gets the whole viewport as its box, not a centred spot */
286
+ fill?: boolean;
287
+ /** viewport, CSS px */
288
+ width?: number;
289
+ height?: number;
290
+ /** virtual ms to let the idle state settle, and to step after each interaction */
291
+ settleMs?: number;
292
+ stepMs?: number;
293
+ /** where to write the HTML report and PNGs; nothing is written without it */
294
+ reportDir?: string;
295
+ /** Chrome or Chromium executable; default: the installed Chrome channel */
296
+ executablePath?: string;
297
+ /** per-page render timeout, ms (max 10000) */
298
+ pageTimeoutMs?: number;
299
+ /** whole run timeout, ms (max 60000) */
300
+ totalTimeoutMs?: number;
301
+ /** for tests: extra code bundled into each page before the component (e.g. a network probe) */
302
+ probe?: string;
303
+ /** render these files for a target instead of the compiler's output (the repair loop scores candidates this way) */
304
+ files?: Partial<Record<WebTarget, EmittedFile[]>>;
305
+ /** a folder of static files the component loads by absolute path (a site's public folder: `/photos/1.jpg`), served on the sandbox origin */
306
+ assetsDir?: string;
307
+ /** an existing compile of the same file (with every target asked for): verify renders it instead of compiling again */
308
+ compiled?: CompileResult;
309
+ /**
310
+ * after the renders, unmount the component the framework's own way and report what it left running (frames, timers,
311
+ * listeners on things that outlive it, observers) in `VerifyResult.leaks`. Off by default: without it verify is unchanged.
312
+ */
313
+ unmount?: boolean;
314
+ /**
315
+ * scripted user actions, run on a fresh page in React and in every target after the fixed states: each step's shot is
316
+ * compared with React's, and a few framework-neutral DOM facts with React's (in `VerifyResult.steps`). Without steps
317
+ * verify is unchanged.
318
+ */
319
+ steps?: VerifyStep[];
320
+ /**
321
+ * with no `steps`: discover a script on the React page alone (at most `maxSteps`, default 12, at most 24) and run it
322
+ * through the steps runner exactly as a given script (`VerifyResult.discoveredSteps`). Ignored when `steps` is given.
323
+ */
324
+ autoSteps?: boolean | {
325
+ maxSteps?: number;
326
+ };
327
+ /** as CompileOptions.fonts: the React page then loads the very Google font files the output carries */
328
+ fonts?: boolean | FontsOptions;
329
+ }
330
+ /** One DOM fact that differs from React's after a step (null: the fact is missing on that side). */
331
+ export interface StepStateMismatch {
332
+ /** `focus`, or what and which attribute: `switch "Email notifications" aria-checked`, `textbox "Topics" value` */
333
+ fact: string;
334
+ react: string | null;
335
+ actual: string | null;
336
+ }
337
+ export interface StepComparison {
338
+ step: string;
339
+ /** the step's place in the script, from 0 */
340
+ index: number;
341
+ target: WebTarget;
342
+ /** the lower of the whole-shot match and `changedMatch`: a step is judged on the whole page and on what it changed */
343
+ match: number;
344
+ diffPixels: number;
345
+ totalPixels: number;
346
+ /** whether the step visibly changed the React render (its shot differs from React's shot before the step) */
347
+ changedInReact: boolean;
348
+ /** how many pixels the step changed in React */
349
+ changedPixels: number;
350
+ /**
351
+ * of the pixels the step changed in React, the share where the target matches React after it (null when React
352
+ * changed nothing). A step usually changes a small part of the page, so a target that ignores it can still match
353
+ * most of the shot: this is what catches it.
354
+ */
355
+ changedMatch: number | null;
356
+ /** the DOM facts that differ from React's after the step (state the pixels may not show) */
357
+ state: StepStateMismatch[];
358
+ /** why this target could not be compared on this step (its target matched nothing, the action failed, a blank shot, an earlier step failed); match is 0 */
359
+ failure?: string;
360
+ }
361
+ /** The page after one step, in one framework. */
362
+ export interface StepShot {
363
+ /** the step's name */
364
+ step: string;
365
+ framework: 'react' | WebTarget;
366
+ png: Buffer;
367
+ box: {
368
+ width: number;
369
+ height: number;
370
+ };
371
+ variance: number;
372
+ }
373
+ export interface LeakListener {
374
+ /** `window`, `document`, `html`, `body`, an element still in the document (`div#root`), `visualViewport`, `matchMedia(<query>)`, or another target's class name */
375
+ target: string;
376
+ type: string;
377
+ count: number;
378
+ }
379
+ export interface LeakObserver {
380
+ /** `ResizeObserver`, `IntersectionObserver` or `MutationObserver` */
381
+ kind: string;
382
+ count: number;
383
+ }
384
+ /** What is still running after an unmount. */
385
+ export interface LeakCounts {
386
+ /** requestAnimationFrame loops still requesting frames after the settle time */
387
+ raf: number;
388
+ /** intervals never cleared */
389
+ intervals: number;
390
+ /** timeouts still pending at the end of the window: re-armed after unmount, or longer than the window */
391
+ timeouts: number;
392
+ listeners: LeakListener[];
393
+ /** observers still observing something */
394
+ observers: LeakObserver[];
395
+ }
396
+ export interface UnmountLeaks extends LeakCounts {
397
+ framework: 'react' | WebTarget;
398
+ /**
399
+ * what is left after mounting and unmounting an empty component in the same framework, driven the same way: the
400
+ * framework runtime's own (React's root listeners, Angular's devtools hook) and the browser harness's. Already
401
+ * subtracted from the counts.
402
+ */
403
+ runtime: LeakCounts;
404
+ /** a target: what it leaves that React does not leave for the same component (null for React, or when React could not be measured) */
405
+ beyondReact: LeakCounts | null;
406
+ /** React: it leaves nothing. A target: it leaves nothing React does not (and React was measured). */
407
+ clean: boolean;
408
+ }
409
+ export interface StateShot {
410
+ state: InteractionState;
411
+ framework: 'react' | WebTarget;
412
+ png: Buffer;
413
+ box: {
414
+ width: number;
415
+ height: number;
416
+ };
417
+ variance: number;
418
+ }
419
+ export interface StateComparison {
420
+ state: InteractionState;
421
+ target: WebTarget;
422
+ match: number;
423
+ diffPixels: number;
424
+ totalPixels: number;
425
+ /** for hover and active: whether the React render differs from idle */
426
+ changedFromIdle: boolean | null;
427
+ }
428
+ export interface VerifyResult {
429
+ file: string;
430
+ exportName: string;
431
+ comparisons: StateComparison[];
432
+ shots: StateShot[];
433
+ blocked: string[];
434
+ pageErrors: string[];
435
+ minMatch: number;
436
+ reportPath?: string;
437
+ diagnostics: Diagnostic[];
438
+ /** with `unmount`: one entry per framework that rendered and unmounted (React first) */
439
+ leaks?: UnmountLeaks[];
440
+ /** with `steps`: one entry per step and target, in script order (folded into `minMatch`) */
441
+ steps?: StepComparison[];
442
+ /** with `steps`: the shot after every step in React and in every target (the images behind `steps`; the HTML report in `reportDir` shows them) */
443
+ stepShots?: StepShot[];
444
+ /** with `autoSteps` (and no `steps`): the script discovered on the React page, which `steps` then compares */
445
+ discoveredSteps?: VerifyStep[];
446
+ }
package/dist/types.js ADDED
@@ -0,0 +1,11 @@
1
+ /** Public types shared by the analyzer, the emitters, verify and the CLI. */
2
+ export const TARGETS = ['vue', 'svelte', 'angular', 'react-native'];
3
+ /** The targets morph holds to its full bar (compiled, type-checked, scored in a browser); the default. */
4
+ export const TIER_ONE = ['vue', 'svelte'];
5
+ /**
6
+ * Targets asked for by name. Angular is checked by the Angular compiler in strict mode (strictTemplates) and needs the
7
+ * optional @angular packages; React Native is experimental: not yet held to the full bar.
8
+ */
9
+ export const EXPERIMENTAL = ['react-native'];
10
+ /** The keys a `press` step may send: these, or any single printable character (`/`, `,`, `a`). */
11
+ export const STEP_KEYS = ['Escape', 'Enter', 'Space', 'Tab', 'Shift+Tab', 'Backspace', 'Delete', 'Home', 'End', 'PageUp', 'PageDown', 'ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight'];
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Every browser, server and temporary folder morph opens registers here. Each is closed by the `finally` of the code
3
+ * that opened it; if the process is interrupted (SIGINT, SIGTERM) or exits first, the registry closes whatever is left.
4
+ */
5
+ declare class CleanupRegistry {
6
+ private readonly tasks;
7
+ private nextId;
8
+ private listening;
9
+ private readonly onSignal;
10
+ private readonly onExit;
11
+ /**
12
+ * Registers a cleanup; the returned function runs it now and unregisters it once it succeeded. Calls made while it
13
+ * runs share that run. A cleanup that fails stays registered and rethrows: the next call, or process exit (with the
14
+ * synchronous fallback), tries it again, so a folder that could not be removed is never silently forgotten.
15
+ */
16
+ add(name: string, run: () => Promise<void> | void, sync?: () => void): () => Promise<void>;
17
+ get size(): number;
18
+ /** Runs every registered cleanup, newest first; failures are collected and rethrown together. */
19
+ runAll(): Promise<void>;
20
+ /** Synchronous fallbacks only, for process exit, where nothing can be awaited. */
21
+ runAllSync(): void;
22
+ private listen;
23
+ private unlistenIfIdle;
24
+ }
25
+ /** The one registry for the whole process. */
26
+ export declare const cleanup: CleanupRegistry;
27
+ /** Creates `<tmp>/antheo-morph-*`, registered for removal; the returned function removes it. */
28
+ export declare function makeTempDir(): {
29
+ dir: string;
30
+ dispose: () => Promise<void>;
31
+ };
32
+ export {};
@@ -0,0 +1,119 @@
1
+ import { mkdtempSync, rmSync } from 'node:fs';
2
+ import { tmpdir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ /** The prefix of every temporary folder morph creates. */
5
+ const TEMP_PREFIX = 'antheo-morph-';
6
+ /**
7
+ * Every browser, server and temporary folder morph opens registers here. Each is closed by the `finally` of the code
8
+ * that opened it; if the process is interrupted (SIGINT, SIGTERM) or exits first, the registry closes whatever is left.
9
+ */
10
+ class CleanupRegistry {
11
+ tasks = new Map();
12
+ nextId = 1;
13
+ listening = false;
14
+ onSignal = (signal) => {
15
+ void this.runAll().finally(() => {
16
+ process.exit(signal === 'SIGINT' ? 130 : 143);
17
+ });
18
+ };
19
+ onExit = () => {
20
+ this.runAllSync();
21
+ };
22
+ /**
23
+ * Registers a cleanup; the returned function runs it now and unregisters it once it succeeded. Calls made while it
24
+ * runs share that run. A cleanup that fails stays registered and rethrows: the next call, or process exit (with the
25
+ * synchronous fallback), tries it again, so a folder that could not be removed is never silently forgotten.
26
+ */
27
+ add(name, run, sync) {
28
+ const id = this.nextId++;
29
+ this.tasks.set(id, sync ? { name, run, sync } : { name, run });
30
+ this.listen();
31
+ let running = null;
32
+ const attempt = async () => {
33
+ const task = this.tasks.get(id);
34
+ if (!task)
35
+ return;
36
+ try {
37
+ await task.run();
38
+ this.tasks.delete(id);
39
+ }
40
+ finally {
41
+ this.unlistenIfIdle();
42
+ }
43
+ };
44
+ return () => {
45
+ running ??= attempt().finally(() => {
46
+ running = null;
47
+ });
48
+ return running;
49
+ };
50
+ }
51
+ get size() {
52
+ return this.tasks.size;
53
+ }
54
+ /** Runs every registered cleanup, newest first; failures are collected and rethrown together. */
55
+ async runAll() {
56
+ const entries = [...this.tasks.entries()].reverse();
57
+ const failures = [];
58
+ for (const [id, task] of entries) {
59
+ // a task leaves the registry only once it has run: if the process exits meanwhile, its sync fallback still runs
60
+ try {
61
+ await task.run();
62
+ this.tasks.delete(id);
63
+ }
64
+ catch (error) {
65
+ this.tasks.delete(id);
66
+ failures.push(`${task.name}: ${error instanceof Error ? error.message : String(error)}`);
67
+ try {
68
+ task.sync?.();
69
+ }
70
+ catch (syncError) {
71
+ failures.push(`${task.name} (sync): ${syncError instanceof Error ? syncError.message : String(syncError)}`);
72
+ }
73
+ }
74
+ }
75
+ this.unlistenIfIdle();
76
+ if (failures.length)
77
+ throw new Error(`Cleanup failed: ${failures.join('; ')}`);
78
+ }
79
+ /** Synchronous fallbacks only, for process exit, where nothing can be awaited. */
80
+ runAllSync() {
81
+ const entries = [...this.tasks.values()].reverse();
82
+ this.tasks.clear();
83
+ for (const task of entries) {
84
+ try {
85
+ task.sync?.();
86
+ }
87
+ catch {
88
+ // exiting: there is nobody left to report to, and the next task must still run
89
+ continue;
90
+ }
91
+ }
92
+ this.unlistenIfIdle();
93
+ }
94
+ listen() {
95
+ if (this.listening)
96
+ return;
97
+ this.listening = true;
98
+ process.once('SIGINT', this.onSignal);
99
+ process.once('SIGTERM', this.onSignal);
100
+ process.once('exit', this.onExit);
101
+ }
102
+ unlistenIfIdle() {
103
+ if (!this.listening || this.tasks.size > 0)
104
+ return;
105
+ this.listening = false;
106
+ process.removeListener('SIGINT', this.onSignal);
107
+ process.removeListener('SIGTERM', this.onSignal);
108
+ process.removeListener('exit', this.onExit);
109
+ }
110
+ }
111
+ /** The one registry for the whole process. */
112
+ export const cleanup = new CleanupRegistry();
113
+ /** Creates `<tmp>/antheo-morph-*`, registered for removal; the returned function removes it. */
114
+ export function makeTempDir() {
115
+ const dir = mkdtempSync(join(tmpdir(), TEMP_PREFIX));
116
+ const remove = () => rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
117
+ const dispose = cleanup.add(`temp ${dir}`, remove, remove);
118
+ return { dir, dispose };
119
+ }