@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,133 @@
1
+ import { PNG } from 'pngjs';
2
+ import pixelmatch from 'pixelmatch';
3
+ /** pixelmatch's per-pixel colour tolerance (0..1). Verify never uses anything looser than 0.1. */
4
+ export const PIXEL_THRESHOLD = 0.1;
5
+ export function decodePng(buffer) {
6
+ return PNG.sync.read(buffer);
7
+ }
8
+ /** The colour variance of an image: 0 means a single flat colour (a blank render). */
9
+ export function variance(png) {
10
+ const { data } = png;
11
+ const n = data.length / 4;
12
+ if (!n)
13
+ return 0;
14
+ let sum = 0;
15
+ let sumSq = 0;
16
+ for (let i = 0; i < data.length; i += 4) {
17
+ const luma = 0.299 * (data[i] ?? 0) + 0.587 * (data[i + 1] ?? 0) + 0.114 * (data[i + 2] ?? 0);
18
+ sum += luma;
19
+ sumSq += luma * luma;
20
+ }
21
+ const mean = sum / n;
22
+ return sumSq / n - mean * mean;
23
+ }
24
+ /** Compares two same-size screenshots with pixelmatch at a threshold of 0.1 (anti-aliased pixels count as equal). */
25
+ export function compare(a, b, threshold = PIXEL_THRESHOLD) {
26
+ if (threshold > PIXEL_THRESHOLD)
27
+ throw new Error(`pixelmatch threshold ${threshold} is looser than the allowed ${PIXEL_THRESHOLD}`);
28
+ const pa = decodePng(a);
29
+ const pb = decodePng(b);
30
+ if (pa.width !== pb.width || pa.height !== pb.height) {
31
+ const total = Math.max(pa.width * pa.height, pb.width * pb.height);
32
+ return { diffPixels: total, totalPixels: total, match: 0, png: a };
33
+ }
34
+ const out = new PNG({ width: pa.width, height: pa.height });
35
+ const diffPixels = pixelmatch(pa.data, pb.data, out.data, pa.width, pa.height, { threshold, includeAA: false, alpha: 0.2 });
36
+ const totalPixels = pa.width * pa.height;
37
+ return { diffPixels, totalPixels, match: 1 - diffPixels / totalPixels, png: PNG.sync.write(out) };
38
+ }
39
+ /** Which pixels differ between two same-size images, by pixelmatch at the threshold (anti-aliased pixels count as equal). */
40
+ function differing(a, b, threshold) {
41
+ const out = new PNG({ width: a.width, height: a.height });
42
+ pixelmatch(a.data, b.data, out.data, a.width, a.height, { threshold, includeAA: false, diffMask: true });
43
+ const mask = new Uint8Array(a.width * a.height);
44
+ for (let i = 0; i < mask.length; i++)
45
+ mask[i] = (out.data[i * 4 + 3] ?? 0) > 0 ? 1 : 0;
46
+ return mask;
47
+ }
48
+ /**
49
+ * How far a target made the change a step made in React. A step usually changes a small part of the page (a switch's
50
+ * knob, a tab's underline), so a whole-page score barely moves when a target ignores it: a dead click handler on a
51
+ * switch still matches 99.5% of the viewport. This looks only at the pixels React changed and asks how many of them
52
+ * the target got right, with the same pixelmatch threshold.
53
+ */
54
+ export function changedRegion(before, after, other, threshold = PIXEL_THRESHOLD) {
55
+ if (threshold > PIXEL_THRESHOLD)
56
+ throw new Error(`pixelmatch threshold ${threshold} is looser than the allowed ${PIXEL_THRESHOLD}`);
57
+ const [b, a, o] = [decodePng(before), decodePng(after), decodePng(other)];
58
+ if (b.width !== a.width || b.height !== a.height)
59
+ return { changedPixels: 0, match: null };
60
+ const changed = differing(b, a, threshold);
61
+ let changedPixels = 0;
62
+ for (const c of changed)
63
+ changedPixels += c;
64
+ if (!changedPixels)
65
+ return { changedPixels, match: null };
66
+ if (o.width !== a.width || o.height !== a.height)
67
+ return { changedPixels, match: 0 };
68
+ const wrong = differing(a, o, threshold);
69
+ let missed = 0;
70
+ for (let i = 0; i < changed.length; i++)
71
+ if (changed[i] && wrong[i])
72
+ missed++;
73
+ return { changedPixels, match: 1 - missed / changedPixels };
74
+ }
75
+ function img(png) {
76
+ return `<img src="data:image/png;base64,${png.toString('base64')}" alt="">`;
77
+ }
78
+ function esc(s) {
79
+ return s.replace(/[&<>"]/g, (c) => `&#${c.charCodeAt(0)};`);
80
+ }
81
+ /** A self-contained HTML report: every state side by side (React, Vue, Svelte, and the diffs), with the scores. */
82
+ export function htmlReport(result, diffs) {
83
+ const shot = (state, framework) => result.shots.find((s) => s.state === state && s.framework === framework);
84
+ const states = [...new Set(result.shots.map((s) => s.state))];
85
+ const rows = states
86
+ .map((state) => {
87
+ const comps = result.comparisons.filter((c) => c.state === state);
88
+ const cells = ['react', 'vue', 'svelte']
89
+ .map((f) => {
90
+ const s = shot(state, f);
91
+ return s ? `<figure>${img(s.png)}<figcaption>${f}</figcaption></figure>` : '';
92
+ })
93
+ .join('');
94
+ const diffCells = comps
95
+ .map((c) => {
96
+ const d = diffs.get(`${state}:${c.target}`);
97
+ return d ? `<figure>${img(d)}<figcaption>diff ${c.target}: ${(c.match * 100).toFixed(2)}% (${c.diffPixels} px)</figcaption></figure>` : '';
98
+ })
99
+ .join('');
100
+ const changed = comps[0]?.changedFromIdle;
101
+ return `<section><h2>${esc(state)}${changed === null || changed === undefined ? '' : changed ? ' <small>changed from idle</small>' : ' <small class="bad">no visible change from idle</small>'}</h2><div class="row">${cells}${diffCells}</div></section>`;
102
+ })
103
+ .join('');
104
+ // with steps: one section per step, React and every target after it, the diffs, the scores and any state mismatch
105
+ const stepNames = [...new Set((result.steps ?? []).map((c) => c.step))];
106
+ const stepRows = stepNames
107
+ .map((step) => {
108
+ const comps = (result.steps ?? []).filter((c) => c.step === step);
109
+ const cells = ['react', 'vue', 'svelte', 'angular']
110
+ .map((f) => {
111
+ const s = result.stepShots?.find((x) => x.step === step && x.framework === f);
112
+ return s ? `<figure>${img(s.png)}<figcaption>${f}</figcaption></figure>` : '';
113
+ })
114
+ .join('');
115
+ const diffCells = comps
116
+ .map((c) => {
117
+ const d = diffs.get(`step:${c.index}:${c.target}`);
118
+ const said = c.failure ? ` <span class="bad">${esc(c.failure)}</span>` : '';
119
+ const state = c.state.length ? ` <span class="bad">state: ${esc(c.state.map((m) => `${m.fact} ${m.actual ?? 'missing'} (React ${m.react ?? 'missing'})`).join('; '))}</span>` : '';
120
+ const region = c.changedMatch === null ? '' : ` (of what the step changed in React: ${(c.changedMatch * 100).toFixed(2)}%)`;
121
+ return `<figure>${d ? img(d) : ''}<figcaption>diff ${c.target}: ${(c.match * 100).toFixed(2)}%${region}${said}${state}</figcaption></figure>`;
122
+ })
123
+ .join('');
124
+ const changed = comps[0]?.changedInReact;
125
+ return `<section><h2>step: ${esc(step)}${changed === undefined ? '' : changed ? ' <small>changed the React render</small>' : ' <small class="bad">no visible change in React</small>'}</h2><div class="row">${cells}${diffCells}</div></section>`;
126
+ })
127
+ .join('');
128
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8"><title>antheo-morph verify: ${esc(result.exportName)}</title><style>
129
+ body{font:14px/1.4 system-ui,sans-serif;margin:24px;color:#18181b;background:#fafafa}h1{font-size:18px;margin:0 0 4px}h2{font-size:15px;margin:24px 0 8px}
130
+ .row{display:flex;flex-wrap:wrap;gap:12px}figure{margin:0;background:#fff;border-radius:8px;padding:8px;box-shadow:0 1px 2px #0001}figure img{display:block;max-width:360px;height:auto}
131
+ figcaption{font-size:12px;color:#52525b;margin-top:6px}small{font-weight:400;color:#16a34a}.bad{color:#dc2626}.meta{color:#52525b}
132
+ </style></head><body><h1>${esc(result.file)} · ${esc(result.exportName)}</h1><p class="meta">Lowest match ${(result.minMatch * 100).toFixed(2)}% · pixelmatch threshold ${PIXEL_THRESHOLD} · ${result.blocked.length} blocked request(s) · ${result.pageErrors.length} page error(s)</p>${rows}${stepRows}</body></html>`;
133
+ }
@@ -0,0 +1,25 @@
1
+ import type { LeakCounts } from '../types.js';
2
+ /**
3
+ * The unmount leak probe, installed in the page right after the virtual clock and before any bundle code: it wraps
4
+ * requestAnimationFrame, the timers, `EventTarget.prototype.addEventListener` / `removeEventListener` (and the legacy
5
+ * `MediaQueryList.addListener`), and the three observers, and keeps what is still live. After the component is
6
+ * unmounted, `report()` says what survived:
7
+ *
8
+ * - `raf`: frames still pending that were requested after `mark()` (a loop that keeps requesting frames after the
9
+ * settle time leaves exactly one; a single frame already queued at unmount has run by then and leaves none);
10
+ * - `intervals`: intervals never cleared;
11
+ * - `timeouts`: timeouts still pending at the end of the window (one that fired once and re-armed nothing is gone; one
12
+ * that re-arms is always pending; so is one longer than the window, which the runner makes up to 10 s);
13
+ * - `listeners`: listeners on targets that outlive the component (window, document, html, body, any element still in
14
+ * the document, `visualViewport`, `MediaQueryList`s and any other non-node target); listeners on the component's own
15
+ * elements, removed with them, are collected with them and do not count;
16
+ * - `observers`: observers that still observe something.
17
+ */
18
+ export declare const LEAK_PROBE_SCRIPT = "(() => {\n let seq = 0;\n let markSeq = Infinity;\n const frames = new Map();\n const timeouts = new Map();\n const intervals = new Map();\n const rawRaf = window.requestAnimationFrame;\n const rawCaf = window.cancelAnimationFrame;\n const rawSetTimeout = window.setTimeout;\n const rawClearTimeout = window.clearTimeout;\n const rawSetInterval = window.setInterval;\n const rawClearInterval = window.clearInterval;\n window.requestAnimationFrame = function (cb) {\n const s = ++seq;\n let id = 0;\n id = rawRaf.call(window, function (time) { frames.delete(id); return typeof cb === 'function' ? cb(time) : undefined; });\n frames.set(id, s);\n return id;\n };\n window.cancelAnimationFrame = function (id) { frames.delete(id); return rawCaf.call(window, id); };\n window.setTimeout = function (fn, ms, ...args) {\n const s = ++seq;\n let id = 0;\n const wrapped = typeof fn === 'function' ? function (...a) { timeouts.delete(id); return fn.apply(this, a); } : fn;\n id = rawSetTimeout.call(window, wrapped, ms, ...args);\n timeouts.set(id, { seq: s, due: performance.now() + Math.max(0, Number(ms) || 0) });\n return id;\n };\n window.setInterval = function (fn, ms, ...args) {\n const id = rawSetInterval.call(window, fn, ms, ...args);\n intervals.set(id, ++seq);\n return id;\n };\n // the two clear functions are interchangeable in browsers: either one clears a timeout or an interval\n window.clearTimeout = function (id) { timeouts.delete(id); intervals.delete(id); return rawClearTimeout.call(window, id); };\n window.clearInterval = function (id) { timeouts.delete(id); intervals.delete(id); return rawClearInterval.call(window, id); };\n\n // listeners, by target, then by type and capture (the DOM's identity for a listener), then by callback\n const live = new Map();\n const proto = EventTarget.prototype;\n const rawAdd = proto.addEventListener;\n const rawRemove = proto.removeEventListener;\n const captureOf = (o) => (typeof o === 'boolean' ? o : !!(o && o.capture));\n proto.addEventListener = function (type, cb, options) {\n if (cb == null) return rawAdd.call(this, type, cb, options);\n const target = this;\n const key = String(type) + '|' + captureOf(options);\n const known = live.get(target)?.get(key)?.get(cb);\n // the same listener twice is one listener (the browser ignores the second add)\n if (known) return rawAdd.call(target, type, known.actual, options);\n const signal = options && typeof options === 'object' ? options.signal : undefined;\n if (signal && signal.aborted) return rawAdd.call(target, type, cb, options);\n const entry = { actual: cb };\n const forget = () => {\n const byKey = live.get(target);\n const byCb = byKey && byKey.get(key);\n if (!byCb || byCb.get(cb) !== entry) return;\n byCb.delete(cb);\n if (!byCb.size) byKey.delete(key);\n if (!byKey.size) live.delete(target);\n };\n // a once listener removes itself when it runs: the probe forgets it then too\n if (options && typeof options === 'object' && options.once) {\n entry.actual = function (event) { forget(); return typeof cb === 'function' ? cb.call(this, event) : cb.handleEvent(event); };\n }\n let byKey = live.get(target);\n if (!byKey) live.set(target, (byKey = new Map()));\n let byCb = byKey.get(key);\n if (!byCb) byKey.set(key, (byCb = new Map()));\n byCb.set(cb, entry);\n if (signal) rawAdd.call(signal, 'abort', forget, { once: true });\n return rawAdd.call(target, type, entry.actual, options);\n };\n proto.removeEventListener = function (type, cb, options) {\n const key = String(type) + '|' + captureOf(options);\n const byKey = live.get(this);\n const byCb = byKey && byKey.get(key);\n const entry = byCb && byCb.get(cb);\n if (!entry) return rawRemove.call(this, type, cb, options);\n byCb.delete(cb);\n if (!byCb.size) byKey.delete(key);\n if (!byKey.size) live.delete(this);\n return rawRemove.call(this, type, entry.actual, options);\n };\n // the legacy MediaQueryList API is, by the spec, an event listener of type change without capture\n if (window.MediaQueryList && MediaQueryList.prototype.addListener) {\n MediaQueryList.prototype.addListener = function (cb) { return this.addEventListener('change', cb); };\n MediaQueryList.prototype.removeListener = function (cb) { return this.removeEventListener('change', cb); };\n }\n\n // observers that observe something, by kind\n const observed = new Map();\n for (const kind of ['ResizeObserver', 'IntersectionObserver', 'MutationObserver']) {\n const Base = window[kind];\n if (typeof Base !== 'function') continue;\n const Probe = class extends Base {\n observe(target, options) {\n const result = super.observe(target, options);\n let seen = observed.get(this);\n if (!seen) observed.set(this, (seen = { kind, targets: new Set() }));\n seen.targets.add(target);\n return result;\n }\n unobserve(target) {\n const seen = observed.get(this);\n if (seen) { seen.targets.delete(target); if (!seen.targets.size) observed.delete(this); }\n return super.unobserve(target);\n }\n disconnect() { observed.delete(this); return super.disconnect(); }\n };\n // MutationObserver has no unobserve: the probe adds none\n if (typeof Base.prototype.unobserve !== 'function') delete Probe.prototype.unobserve;\n Object.defineProperty(Probe, 'name', { value: Base.name });\n window[kind] = Probe;\n }\n\n const label = (t) => {\n if (t === window) return 'window';\n if (t === document) return 'document';\n if (t === document.documentElement) return 'html';\n if (t === document.body) return 'body';\n if (window.visualViewport && t === window.visualViewport) return 'visualViewport';\n if (window.MediaQueryList && t instanceof MediaQueryList) return 'matchMedia(' + t.media + ')';\n if (t instanceof Node) {\n // the component's own elements, removed from the document with it: their listeners go with them\n if (!t.isConnected) return null;\n return t instanceof Element ? t.tagName.toLowerCase() + (t.id ? '#' + t.id : '') : t.nodeName;\n }\n return (t && t.constructor && t.constructor.name) || 'EventTarget';\n };\n window.__morphLeaks = {\n mark() { markSeq = seq; },\n horizon() {\n let last = performance.now();\n for (const t of timeouts.values()) last = Math.max(last, t.due);\n return last - performance.now();\n },\n report() {\n let raf = 0;\n for (const s of frames.values()) if (s > markSeq) raf++;\n const listeners = new Map();\n for (const [target, byKey] of live) {\n const where = label(target);\n if (where === null) continue;\n for (const [key, byCb] of byKey) {\n const type = key.slice(0, key.lastIndexOf('|'));\n const id = where + '\\u0000' + type;\n const row = listeners.get(id) || { target: where, type, count: 0 };\n row.count += byCb.size;\n listeners.set(id, row);\n }\n }\n const observers = new Map();\n for (const seen of observed.values()) observers.set(seen.kind, (observers.get(seen.kind) || 0) + 1);\n return {\n raf,\n intervals: intervals.size,\n timeouts: timeouts.size,\n listeners: [...listeners.values()],\n observers: [...observers].map(([kind, count]) => ({ kind, count })),\n };\n },\n };\n})();";
19
+ /** What `a` leaves that `b` does not: every count less `b`'s, never below zero (listeners by target and type). */
20
+ export declare function subtractLeaks(a: LeakCounts, b: LeakCounts): LeakCounts;
21
+ export declare function noLeaks(c: LeakCounts): boolean;
22
+ /** One line for a diagnostic: `2 rAF loops, 1 interval, window resize ×1`. */
23
+ export declare function describeLeaks(c: LeakCounts): string;
24
+ /** Checks the shape of what the page's probe returned (it crosses from the page as plain JSON). */
25
+ export declare function readLeakReport(value: unknown): LeakCounts;
@@ -0,0 +1,261 @@
1
+ /**
2
+ * The unmount leak probe, installed in the page right after the virtual clock and before any bundle code: it wraps
3
+ * requestAnimationFrame, the timers, `EventTarget.prototype.addEventListener` / `removeEventListener` (and the legacy
4
+ * `MediaQueryList.addListener`), and the three observers, and keeps what is still live. After the component is
5
+ * unmounted, `report()` says what survived:
6
+ *
7
+ * - `raf`: frames still pending that were requested after `mark()` (a loop that keeps requesting frames after the
8
+ * settle time leaves exactly one; a single frame already queued at unmount has run by then and leaves none);
9
+ * - `intervals`: intervals never cleared;
10
+ * - `timeouts`: timeouts still pending at the end of the window (one that fired once and re-armed nothing is gone; one
11
+ * that re-arms is always pending; so is one longer than the window, which the runner makes up to 10 s);
12
+ * - `listeners`: listeners on targets that outlive the component (window, document, html, body, any element still in
13
+ * the document, `visualViewport`, `MediaQueryList`s and any other non-node target); listeners on the component's own
14
+ * elements, removed with them, are collected with them and do not count;
15
+ * - `observers`: observers that still observe something.
16
+ */
17
+ export const LEAK_PROBE_SCRIPT = `(() => {
18
+ let seq = 0;
19
+ let markSeq = Infinity;
20
+ const frames = new Map();
21
+ const timeouts = new Map();
22
+ const intervals = new Map();
23
+ const rawRaf = window.requestAnimationFrame;
24
+ const rawCaf = window.cancelAnimationFrame;
25
+ const rawSetTimeout = window.setTimeout;
26
+ const rawClearTimeout = window.clearTimeout;
27
+ const rawSetInterval = window.setInterval;
28
+ const rawClearInterval = window.clearInterval;
29
+ window.requestAnimationFrame = function (cb) {
30
+ const s = ++seq;
31
+ let id = 0;
32
+ id = rawRaf.call(window, function (time) { frames.delete(id); return typeof cb === 'function' ? cb(time) : undefined; });
33
+ frames.set(id, s);
34
+ return id;
35
+ };
36
+ window.cancelAnimationFrame = function (id) { frames.delete(id); return rawCaf.call(window, id); };
37
+ window.setTimeout = function (fn, ms, ...args) {
38
+ const s = ++seq;
39
+ let id = 0;
40
+ const wrapped = typeof fn === 'function' ? function (...a) { timeouts.delete(id); return fn.apply(this, a); } : fn;
41
+ id = rawSetTimeout.call(window, wrapped, ms, ...args);
42
+ timeouts.set(id, { seq: s, due: performance.now() + Math.max(0, Number(ms) || 0) });
43
+ return id;
44
+ };
45
+ window.setInterval = function (fn, ms, ...args) {
46
+ const id = rawSetInterval.call(window, fn, ms, ...args);
47
+ intervals.set(id, ++seq);
48
+ return id;
49
+ };
50
+ // the two clear functions are interchangeable in browsers: either one clears a timeout or an interval
51
+ window.clearTimeout = function (id) { timeouts.delete(id); intervals.delete(id); return rawClearTimeout.call(window, id); };
52
+ window.clearInterval = function (id) { timeouts.delete(id); intervals.delete(id); return rawClearInterval.call(window, id); };
53
+
54
+ // listeners, by target, then by type and capture (the DOM's identity for a listener), then by callback
55
+ const live = new Map();
56
+ const proto = EventTarget.prototype;
57
+ const rawAdd = proto.addEventListener;
58
+ const rawRemove = proto.removeEventListener;
59
+ const captureOf = (o) => (typeof o === 'boolean' ? o : !!(o && o.capture));
60
+ proto.addEventListener = function (type, cb, options) {
61
+ if (cb == null) return rawAdd.call(this, type, cb, options);
62
+ const target = this;
63
+ const key = String(type) + '|' + captureOf(options);
64
+ const known = live.get(target)?.get(key)?.get(cb);
65
+ // the same listener twice is one listener (the browser ignores the second add)
66
+ if (known) return rawAdd.call(target, type, known.actual, options);
67
+ const signal = options && typeof options === 'object' ? options.signal : undefined;
68
+ if (signal && signal.aborted) return rawAdd.call(target, type, cb, options);
69
+ const entry = { actual: cb };
70
+ const forget = () => {
71
+ const byKey = live.get(target);
72
+ const byCb = byKey && byKey.get(key);
73
+ if (!byCb || byCb.get(cb) !== entry) return;
74
+ byCb.delete(cb);
75
+ if (!byCb.size) byKey.delete(key);
76
+ if (!byKey.size) live.delete(target);
77
+ };
78
+ // a once listener removes itself when it runs: the probe forgets it then too
79
+ if (options && typeof options === 'object' && options.once) {
80
+ entry.actual = function (event) { forget(); return typeof cb === 'function' ? cb.call(this, event) : cb.handleEvent(event); };
81
+ }
82
+ let byKey = live.get(target);
83
+ if (!byKey) live.set(target, (byKey = new Map()));
84
+ let byCb = byKey.get(key);
85
+ if (!byCb) byKey.set(key, (byCb = new Map()));
86
+ byCb.set(cb, entry);
87
+ if (signal) rawAdd.call(signal, 'abort', forget, { once: true });
88
+ return rawAdd.call(target, type, entry.actual, options);
89
+ };
90
+ proto.removeEventListener = function (type, cb, options) {
91
+ const key = String(type) + '|' + captureOf(options);
92
+ const byKey = live.get(this);
93
+ const byCb = byKey && byKey.get(key);
94
+ const entry = byCb && byCb.get(cb);
95
+ if (!entry) return rawRemove.call(this, type, cb, options);
96
+ byCb.delete(cb);
97
+ if (!byCb.size) byKey.delete(key);
98
+ if (!byKey.size) live.delete(this);
99
+ return rawRemove.call(this, type, entry.actual, options);
100
+ };
101
+ // the legacy MediaQueryList API is, by the spec, an event listener of type change without capture
102
+ if (window.MediaQueryList && MediaQueryList.prototype.addListener) {
103
+ MediaQueryList.prototype.addListener = function (cb) { return this.addEventListener('change', cb); };
104
+ MediaQueryList.prototype.removeListener = function (cb) { return this.removeEventListener('change', cb); };
105
+ }
106
+
107
+ // observers that observe something, by kind
108
+ const observed = new Map();
109
+ for (const kind of ['ResizeObserver', 'IntersectionObserver', 'MutationObserver']) {
110
+ const Base = window[kind];
111
+ if (typeof Base !== 'function') continue;
112
+ const Probe = class extends Base {
113
+ observe(target, options) {
114
+ const result = super.observe(target, options);
115
+ let seen = observed.get(this);
116
+ if (!seen) observed.set(this, (seen = { kind, targets: new Set() }));
117
+ seen.targets.add(target);
118
+ return result;
119
+ }
120
+ unobserve(target) {
121
+ const seen = observed.get(this);
122
+ if (seen) { seen.targets.delete(target); if (!seen.targets.size) observed.delete(this); }
123
+ return super.unobserve(target);
124
+ }
125
+ disconnect() { observed.delete(this); return super.disconnect(); }
126
+ };
127
+ // MutationObserver has no unobserve: the probe adds none
128
+ if (typeof Base.prototype.unobserve !== 'function') delete Probe.prototype.unobserve;
129
+ Object.defineProperty(Probe, 'name', { value: Base.name });
130
+ window[kind] = Probe;
131
+ }
132
+
133
+ const label = (t) => {
134
+ if (t === window) return 'window';
135
+ if (t === document) return 'document';
136
+ if (t === document.documentElement) return 'html';
137
+ if (t === document.body) return 'body';
138
+ if (window.visualViewport && t === window.visualViewport) return 'visualViewport';
139
+ if (window.MediaQueryList && t instanceof MediaQueryList) return 'matchMedia(' + t.media + ')';
140
+ if (t instanceof Node) {
141
+ // the component's own elements, removed from the document with it: their listeners go with them
142
+ if (!t.isConnected) return null;
143
+ return t instanceof Element ? t.tagName.toLowerCase() + (t.id ? '#' + t.id : '') : t.nodeName;
144
+ }
145
+ return (t && t.constructor && t.constructor.name) || 'EventTarget';
146
+ };
147
+ window.__morphLeaks = {
148
+ mark() { markSeq = seq; },
149
+ horizon() {
150
+ let last = performance.now();
151
+ for (const t of timeouts.values()) last = Math.max(last, t.due);
152
+ return last - performance.now();
153
+ },
154
+ report() {
155
+ let raf = 0;
156
+ for (const s of frames.values()) if (s > markSeq) raf++;
157
+ const listeners = new Map();
158
+ for (const [target, byKey] of live) {
159
+ const where = label(target);
160
+ if (where === null) continue;
161
+ for (const [key, byCb] of byKey) {
162
+ const type = key.slice(0, key.lastIndexOf('|'));
163
+ const id = where + '\\u0000' + type;
164
+ const row = listeners.get(id) || { target: where, type, count: 0 };
165
+ row.count += byCb.size;
166
+ listeners.set(id, row);
167
+ }
168
+ }
169
+ const observers = new Map();
170
+ for (const seen of observed.values()) observers.set(seen.kind, (observers.get(seen.kind) || 0) + 1);
171
+ return {
172
+ raf,
173
+ intervals: intervals.size,
174
+ timeouts: timeouts.size,
175
+ listeners: [...listeners.values()],
176
+ observers: [...observers].map(([kind, count]) => ({ kind, count })),
177
+ };
178
+ },
179
+ };
180
+ })();`;
181
+ const listenerKey = (l) => `${l.target}\u0000${l.type}`;
182
+ function sortCounts(counts) {
183
+ return {
184
+ ...counts,
185
+ listeners: [...counts.listeners].sort((a, b) => a.target.localeCompare(b.target) || a.type.localeCompare(b.type)),
186
+ observers: [...counts.observers].sort((a, b) => a.kind.localeCompare(b.kind)),
187
+ };
188
+ }
189
+ /** What `a` leaves that `b` does not: every count less `b`'s, never below zero (listeners by target and type). */
190
+ export function subtractLeaks(a, b) {
191
+ const theirs = new Map(b.listeners.map((l) => [listenerKey(l), l.count]));
192
+ const listeners = [];
193
+ for (const l of a.listeners) {
194
+ const count = l.count - (theirs.get(listenerKey(l)) ?? 0);
195
+ if (count > 0)
196
+ listeners.push({ target: l.target, type: l.type, count });
197
+ }
198
+ const theirObservers = new Map(b.observers.map((o) => [o.kind, o.count]));
199
+ const observers = [];
200
+ for (const o of a.observers) {
201
+ const count = o.count - (theirObservers.get(o.kind) ?? 0);
202
+ if (count > 0)
203
+ observers.push({ kind: o.kind, count });
204
+ }
205
+ return sortCounts({ raf: Math.max(0, a.raf - b.raf), intervals: Math.max(0, a.intervals - b.intervals), timeouts: Math.max(0, a.timeouts - b.timeouts), listeners, observers });
206
+ }
207
+ export function noLeaks(c) {
208
+ return c.raf === 0 && c.intervals === 0 && c.timeouts === 0 && c.listeners.length === 0 && c.observers.length === 0;
209
+ }
210
+ /** One line for a diagnostic: `2 rAF loops, 1 interval, window resize ×1`. */
211
+ export function describeLeaks(c) {
212
+ const parts = [];
213
+ if (c.raf)
214
+ parts.push(`${c.raf} requestAnimationFrame loop${c.raf === 1 ? '' : 's'}`);
215
+ if (c.intervals)
216
+ parts.push(`${c.intervals} interval${c.intervals === 1 ? '' : 's'}`);
217
+ if (c.timeouts)
218
+ parts.push(`${c.timeouts} re-armed or pending timeout${c.timeouts === 1 ? '' : 's'}`);
219
+ for (const l of c.listeners)
220
+ parts.push(`${l.target} ${l.type} listener${l.count === 1 ? '' : ` ×${l.count}`}`);
221
+ for (const o of c.observers)
222
+ parts.push(`${o.count} ${o.kind}${o.count === 1 ? '' : 's'}`);
223
+ return parts.join(', ');
224
+ }
225
+ /** Checks the shape of what the page's probe returned (it crosses from the page as plain JSON). */
226
+ export function readLeakReport(value) {
227
+ const record = (v) => {
228
+ if (typeof v !== 'object' || v === null || Array.isArray(v))
229
+ throw new Error('the leak probe returned no report');
230
+ return Object.fromEntries(Object.entries(v));
231
+ };
232
+ const num = (v) => {
233
+ if (typeof v !== 'number' || !Number.isFinite(v) || v < 0)
234
+ throw new Error('the leak probe returned a bad count');
235
+ return v;
236
+ };
237
+ const str = (v) => {
238
+ if (typeof v !== 'string')
239
+ throw new Error('the leak probe returned a bad name');
240
+ return v;
241
+ };
242
+ const list = (v) => {
243
+ if (!Array.isArray(v))
244
+ throw new Error('the leak probe returned a bad list');
245
+ return v;
246
+ };
247
+ const r = record(value);
248
+ return sortCounts({
249
+ raf: num(r['raf']),
250
+ intervals: num(r['intervals']),
251
+ timeouts: num(r['timeouts']),
252
+ listeners: list(r['listeners']).map((x) => {
253
+ const l = record(x);
254
+ return { target: str(l['target']), type: str(l['type']), count: num(l['count']) };
255
+ }),
256
+ observers: list(r['observers']).map((x) => {
257
+ const o = record(x);
258
+ return { kind: str(o['kind']), count: num(o['count']) };
259
+ }),
260
+ });
261
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The Angular linker, on its own thread. Linking a large Angular library (`@lucide/angular` is one 10 MB file) keeps a
3
+ * thread busy for tens of seconds; on the main thread that would also stop the sandbox's file server and every page
4
+ * clock of a verify run that shares the process (see angularLinkerPlugin in bundle.ts). Here it blocks nothing else.
5
+ *
6
+ * Message in: `{ id, path, source }`. Message out: `{ id, code }`, or `{ id, error, missing }` (`missing` when Babel or
7
+ * the Angular linker is not installed).
8
+ */
9
+ import { parentPort } from 'node:worker_threads';
10
+ let tools = null;
11
+ /** Thrown when Babel or the linker cannot be loaded: the main thread then says which optional dependencies to add. */
12
+ class MissingTooling extends Error {
13
+ }
14
+ async function link(request) {
15
+ tools ??= Promise.all([import('@babel/core'), import('@angular/compiler-cli/linker/babel')]).then(([babel, linker]) => ({ babel, linker: linker.default }), (error) => {
16
+ throw new MissingTooling(error instanceof Error ? error.message : String(error));
17
+ });
18
+ const { babel, linker } = await tools;
19
+ const out = await babel.transformAsync(request.source, { filename: request.path, plugins: [linker], compact: false, babelrc: false, configFile: false, sourceMaps: false });
20
+ return out?.code ?? request.source;
21
+ }
22
+ const port = parentPort;
23
+ if (port) {
24
+ port.on('message', (request) => {
25
+ link(request).then((code) => port.postMessage({ id: request.id, code }), (error) => port.postMessage({ id: request.id, error: error instanceof Error ? error.message : String(error), missing: error instanceof MissingTooling }));
26
+ });
27
+ }
@@ -0,0 +1,57 @@
1
+ import type { VerifyOptions, VerifyResult } from '../types.js';
2
+ declare global {
3
+ interface Window {
4
+ __morphReady?: boolean;
5
+ __morphClock?: {
6
+ advance: (ms: number) => Promise<number>;
7
+ elapse: (ms: number) => Promise<number>;
8
+ now: () => number;
9
+ };
10
+ /** with `unmount`: unmounts the component the framework's own way */
11
+ __morphUnmount?: () => unknown;
12
+ /** with `unmount`: the leak probe (verify/leaks.ts) */
13
+ __morphLeaks?: {
14
+ mark: () => void;
15
+ horizon: () => number;
16
+ report: () => unknown;
17
+ };
18
+ }
19
+ }
20
+ /** The Angular file that declares a component class (Angular files hold every component of a source file). */
21
+ export declare function angularComponentFile(files: {
22
+ path: string;
23
+ contents: string;
24
+ kind: string;
25
+ }[], exportName: string): string | null;
26
+ /**
27
+ * The text of each stylesheet the emitted Angular components name (`styleUrl: './theme.css'`, `styleUrls: [...]`),
28
+ * resolved beside the component file, in the order they are named, each once; a name that is not an emitted file is
29
+ * skipped (the Angular compiler reports it).
30
+ */
31
+ export declare function angularStylesheets(files: {
32
+ path: string;
33
+ contents: string;
34
+ }[]): string[];
35
+ /** The component file a target emitted for an export: the .vue/.svelte named after it, nearest the source. */
36
+ export declare function componentFile(files: {
37
+ path: string;
38
+ kind: string;
39
+ }[], exportName: string, ext: string, sourceRel: string): string | null;
40
+ /**
41
+ * Renders the React original and its Vue 3 and Svelte 5 output in sandboxed headless Chrome, at rest and after a hover
42
+ * and a press stepped on a virtual clock, and compares each against React pixel by pixel.
43
+ */
44
+ export declare function runVerify(file: string, options?: VerifyOptions): Promise<VerifyResult>;
45
+ /**
46
+ * The most a run's total clock leaves out for waits on once-per-process work (VerifyRun.excuse). Measured worst cases:
47
+ * linking `@lucide/angular` held the main thread 32.6 s on a cold start, and took 66 s on the linker's own thread on a
48
+ * loaded machine; 180 s is a generous multiple of both. Past it the clock fires as before, so a linker thread that is
49
+ * alive but never answers cannot hang verify.
50
+ */
51
+ export declare const MAX_EXCUSED_MS = 180000;
52
+ /**
53
+ * Starts a run's total clock: after `totalMs`, `fire` is called with the timeout's message, unless `takeExcused` reports
54
+ * time the run waited on once-per-process work, which postpones it by that much, up to `allowanceMs` in all. Returns a
55
+ * function that stops the clock.
56
+ */
57
+ export declare function armTotalClock(totalMs: number, allowanceMs: number, takeExcused: () => number, fire: (message: string) => void): () => void;