@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,11 @@
1
+ /**
2
+ * The DOM event Vue listens to for a React DOM handler, and whether the listener is passive, as React's root listener is.
3
+ * React (17+) listens to `focusin` / `focusout` for onFocus / onBlur, so a handler on a container runs when anything
4
+ * inside it gains or loses focus; Vue's `focus` / `blur` do not bubble. React listens to `wheel`, `touchstart` and
5
+ * `touchmove` passively, so `preventDefault()` in their handlers does not stop the scroll; Vue's listener is passive only
6
+ * when asked.
7
+ */
8
+ export declare function vueDomEvent(event: string): {
9
+ event: string;
10
+ passive: boolean;
11
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The DOM event Vue listens to for a React DOM handler, and whether the listener is passive, as React's root listener is.
3
+ * React (17+) listens to `focusin` / `focusout` for onFocus / onBlur, so a handler on a container runs when anything
4
+ * inside it gains or loses focus; Vue's `focus` / `blur` do not bubble. React listens to `wheel`, `touchstart` and
5
+ * `touchmove` passively, so `preventDefault()` in their handlers does not stop the scroll; Vue's listener is passive only
6
+ * when asked.
7
+ */
8
+ export function vueDomEvent(event) {
9
+ const name = event === 'focus' ? 'focusin' : event === 'blur' ? 'focusout' : event;
10
+ return { event: name, passive: PASSIVE.has(name) };
11
+ }
12
+ /** The events React listens to passively at its root: a handler there cannot cancel the default. */
13
+ const PASSIVE = new Set(['wheel', 'touchstart', 'touchmove']);
@@ -0,0 +1,28 @@
1
+ import * as t from '@babel/types';
2
+ import type { ModuleIR } from '../../ir/model.js';
3
+ import type { TypeOracle } from '../../ir/oracle.js';
4
+ /**
5
+ * Module functions that build elements in statements (`function marked(text, ranges)` pushing strings and `<mark>`s
6
+ * into a list it returns), as Vue render-function code: the function stays as React wrote it with each element an
7
+ * `h()` call, so every call builds new VNodes (none is mounted twice), and a template renders the call where React
8
+ * rendered it as a child, through `markupNodes` (one VNode for `<component :is>`: text, elements or a list of them, as
9
+ * React renders a child). The call runs while the component renders, as React's did.
10
+ *
11
+ * Only where every read is known: the function is not exported, every mention of it outside its own declaration is a
12
+ * component template's child that is exactly a call of it (`{marked(item.label, ranges)}`); it reads no React value and
13
+ * no module `let`, writes only its own locals (and its parameters themselves), and calls no module function that is not
14
+ * effect-free by the same rule; each element has an exact `h()` form with no helper of the component's. Anything else
15
+ * keeps its module-jsx error.
16
+ */
17
+ export interface ElementBuilders {
18
+ /** the function statements as written for Vue, by the original statement */
19
+ statements: Map<t.Statement, t.Statement>;
20
+ /** the template child nodes that render a call of one (TNode `expr`) */
21
+ sites: Set<object>;
22
+ }
23
+ /** The template child renders a call of a module function that builds elements (see planElementBuilders). */
24
+ export declare function buildsModuleElements(node: object): boolean;
25
+ export declare const MARKUP_NODES_SOURCE: string;
26
+ export declare function planElementBuilders(mod: ModuleIR, reactNames: ReadonlySet<string>, mutable: ReadonlySet<string>, moduleH: boolean, oracle: TypeOracle | null | undefined, file: string): (ElementBuilders & {
27
+ types: Set<string>;
28
+ }) | null;
@@ -0,0 +1,258 @@
1
+ import * as t from '@babel/types';
2
+ import { writeMarkup } from './render-fn/h.js';
3
+ /** The template child nodes `markupNodes` renders, as the Vue template finds them. */
4
+ const SITES = new WeakSet();
5
+ /** The template child renders a call of a module function that builds elements (see planElementBuilders). */
6
+ export function buildsModuleElements(node) {
7
+ return SITES.has(node);
8
+ }
9
+ export const MARKUP_NODES_SOURCE = [
10
+ '/** What a module function returns (text, elements or a list of them) as React renders a child: one VNode for `:is`. */',
11
+ 'function markupNodes(value: VNodeChild): VNode {',
12
+ ' return h(Fragment, null, [value]);',
13
+ '}',
14
+ ].join('\n');
15
+ function functionOf(s) {
16
+ if (t.isFunctionDeclaration(s) && s.id)
17
+ return { name: s.id.name, fn: s };
18
+ if (t.isVariableDeclaration(s) && s.kind === 'const' && s.declarations.length === 1) {
19
+ const d = s.declarations[0];
20
+ let init = d?.init;
21
+ while (init && (t.isTSAsExpression(init) || t.isTSSatisfiesExpression(init) || t.isParenthesizedExpression(init)))
22
+ init = init.expression;
23
+ if (d && t.isIdentifier(d.id) && (t.isArrowFunctionExpression(init) || t.isFunctionExpression(init)))
24
+ return { name: d.id.name, fn: init };
25
+ }
26
+ return null;
27
+ }
28
+ function containsJsx(node) {
29
+ let found = false;
30
+ t.traverseFast(node, (n) => {
31
+ if (t.isJSXElement(n) || t.isJSXFragment(n))
32
+ found = true;
33
+ });
34
+ return found;
35
+ }
36
+ /** The function writes only its own locals and its parameters themselves, reads no module `let`, calls no unsafe module function. */
37
+ function effectFree(fn, mutable, unsafe) {
38
+ const params = new Set(fn.params.flatMap((p) => Object.keys(t.getBindingIdentifiers(p))));
39
+ const own = new Set();
40
+ t.traverseFast(fn.body, (n) => {
41
+ if (t.isVariableDeclarator(n) || t.isFunction(n) || t.isCatchClause(n)) {
42
+ const ids = t.isVariableDeclarator(n) ? [n.id] : t.isFunction(n) ? n.params : n.param ? [n.param] : [];
43
+ for (const id of ids)
44
+ for (const name of Object.keys(t.getBindingIdentifiers(id)))
45
+ own.add(name);
46
+ }
47
+ });
48
+ const root = (e) => {
49
+ let cur = e;
50
+ let member = false;
51
+ while (t.isMemberExpression(cur) || t.isOptionalMemberExpression(cur)) {
52
+ cur = cur.object;
53
+ member = true;
54
+ }
55
+ return t.isIdentifier(cur) ? { name: cur.name, member } : null;
56
+ };
57
+ let ok = !fn.async && !fn.generator;
58
+ t.traverseFast(fn.body, (n) => {
59
+ if (!ok)
60
+ return;
61
+ if (t.isAssignmentExpression(n) || t.isUpdateExpression(n)) {
62
+ const target = root(t.isAssignmentExpression(n) ? n.left : n.argument);
63
+ if (!target || !(own.has(target.name) || (params.has(target.name) && !target.member)))
64
+ ok = false;
65
+ }
66
+ else if (t.isAwaitExpression(n) || t.isYieldExpression(n) || t.isUnaryExpression(n, { operator: 'delete' }))
67
+ ok = false;
68
+ else if (t.isIdentifier(n) && mutable.has(n.name) && !own.has(n.name) && !params.has(n.name))
69
+ ok = false;
70
+ else if ((t.isCallExpression(n) || t.isOptionalCallExpression(n) || t.isNewExpression(n)) && t.isIdentifier(n.callee) && unsafe.has(n.callee.name))
71
+ ok = false;
72
+ });
73
+ return ok;
74
+ }
75
+ /** Every identifier named `name` under `value` (IR objects walked through), except the nodes in `allowed`. */
76
+ function mentions(value, name, allowed, seen) {
77
+ if (typeof value !== 'object' || value === null || seen.has(value))
78
+ return false;
79
+ seen.add(value);
80
+ if (t.isNode(value)) {
81
+ let found = false;
82
+ t.traverseFast(value, (n) => {
83
+ if (t.isIdentifier(n) && n.name === name && !allowed.has(n))
84
+ found = true;
85
+ });
86
+ return found;
87
+ }
88
+ if (value instanceof Map)
89
+ return [...value.values()].some((v) => mentions(v, name, allowed, seen));
90
+ if (value instanceof Set)
91
+ return [...value].some((v) => mentions(v, name, allowed, seen));
92
+ return Object.values(value).some((v) => mentions(v, name, allowed, seen));
93
+ }
94
+ /** The template `expr` nodes whose expression is exactly a call of one of `names`, with the callee nodes. */
95
+ function callSites(root, names, out) {
96
+ const visit = (value, seen) => {
97
+ if (typeof value !== 'object' || value === null || seen.has(value) || t.isNode(value))
98
+ return;
99
+ seen.add(value);
100
+ if (Array.isArray(value))
101
+ return value.forEach((v) => visit(v, seen));
102
+ if (Reflect.get(value, 'type') === 'expr') {
103
+ const e = Reflect.get(value, 'expr');
104
+ let x = t.isNode(e) ? e : null;
105
+ while (t.isParenthesizedExpression(x) || t.isTSAsExpression(x))
106
+ x = x.expression;
107
+ if (t.isCallExpression(x) && t.isIdentifier(x.callee) && names.has(x.callee.name))
108
+ out.push({ node: value, callee: x.callee, name: x.callee.name });
109
+ }
110
+ for (const v of Object.values(value))
111
+ visit(v, seen);
112
+ };
113
+ visit(root, new WeakSet());
114
+ }
115
+ /** React's markup types in the function: VNode types (`ReactNode` is `VNodeChild`, an element `VNode`). */
116
+ function vnodeTypes(node, used) {
117
+ t.traverseFast(node, (n) => {
118
+ if (!t.isTSTypeReference(n))
119
+ return;
120
+ const ref = n.typeName;
121
+ const last = t.isIdentifier(ref) ? ref.name : t.isTSQualifiedName(ref) ? ref.right.name : '';
122
+ const vue = last === 'ReactNode' ? 'VNodeChild' : last === 'ReactElement' || (last === 'Element' && t.isTSQualifiedName(ref) && t.isIdentifier(ref.left, { name: 'JSX' })) ? 'VNode' : null;
123
+ if (!vue)
124
+ return;
125
+ n.typeName = t.identifier(vue);
126
+ n.typeParameters = null;
127
+ used.add(vue);
128
+ });
129
+ }
130
+ const mayBeElement = (kind) => kind.element || kind.unknown;
131
+ export function planElementBuilders(mod, reactNames, mutable, moduleH, oracle, file) {
132
+ if (moduleH || !mod.components.length)
133
+ return null;
134
+ const fns = new Map();
135
+ for (const s of mod.moduleBody) {
136
+ const found = functionOf(s);
137
+ if (found)
138
+ fns.set(found.name, { stmt: s, fn: found.fn });
139
+ }
140
+ // module functions with effects (by the same rule), each with those that call them
141
+ const unsafe = new Set();
142
+ for (let grew = true; grew;) {
143
+ grew = false;
144
+ for (const [name, { fn }] of fns) {
145
+ if (unsafe.has(name) || effectFree(fn, mutable, unsafe))
146
+ continue;
147
+ unsafe.add(name);
148
+ grew = true;
149
+ }
150
+ }
151
+ const candidates = new Map();
152
+ for (const [name, f] of fns) {
153
+ if (!containsJsx(f.fn) || unsafe.has(name) || mod.exportedNames.has(name))
154
+ continue;
155
+ // React's own values (`Children`, `cloneElement`) have no counterpart here
156
+ // (types do not count: `ReactNode` is written as Vue's type)
157
+ let readsReact = false;
158
+ let ownH = false;
159
+ const visit = (n) => {
160
+ if (n.type.startsWith('TS'))
161
+ return;
162
+ if (t.isIdentifier(n) && reactNames.has(n.name))
163
+ readsReact = true;
164
+ if (t.isIdentifier(n, { name: 'h' }))
165
+ ownH = true;
166
+ for (const key of t.VISITOR_KEYS[n.type] ?? []) {
167
+ if (key === 'typeAnnotation' || key === 'returnType' || key === 'typeParameters' || key === 'typeArguments')
168
+ continue;
169
+ const child = Reflect.get(n, key);
170
+ for (const c of Array.isArray(child) ? child : [child])
171
+ if (t.isNode(c))
172
+ visit(c);
173
+ }
174
+ };
175
+ visit(f.fn);
176
+ if (!readsReact && !ownH)
177
+ candidates.set(name, f);
178
+ }
179
+ if (!candidates.size)
180
+ return null;
181
+ const names = new Set(candidates.keys());
182
+ const sites = [];
183
+ for (const comp of mod.components) {
184
+ const found = [];
185
+ callSites(comp.template, names, found);
186
+ for (const fr of comp.fragments)
187
+ callSites(fr.template, names, found);
188
+ sites.push(...found.map((s) => ({ ...s, comp })));
189
+ }
190
+ const statements = new Map();
191
+ const taken = new Set();
192
+ const types = new Set();
193
+ for (const [name, { stmt }] of candidates) {
194
+ const own = sites.filter((s) => s.name === name);
195
+ if (!own.length)
196
+ continue;
197
+ const allowed = new Set(own.map((s) => s.callee));
198
+ // mentioned anywhere else: module code, hooks, a component's script, a prop's data, kept code
199
+ const elsewhere = mod.moduleBody.some((s) => s !== stmt && mentions(s, name, allowed, new WeakSet())) ||
200
+ mentions(mod.hooks, name, allowed, new WeakSet()) ||
201
+ mentions(mod.markupValues ?? [], name, allowed, new WeakSet()) ||
202
+ mod.components.some((c) => mentions([c.items, c.props, c.keptMarkup ?? [], c.provides, c.markupValues ?? [], c.template, c.fragments], name, allowed, new WeakSet()));
203
+ if (elsewhere)
204
+ continue;
205
+ // each element an exact h() form, with nothing of a component's (refs, slots, helpers)
206
+ let refused = false;
207
+ const imports = [];
208
+ const written = writeMarkup(t.cloneNode(stmt, true), {
209
+ refKind: () => null,
210
+ isMotion: (n) => mod.motionNames.has(n),
211
+ isMotionValue: () => false,
212
+ tagProblem: (tag) => {
213
+ const base = tag.split('.')[0] ?? tag;
214
+ if (mod.components.some((c) => c.name === base) || mod.contexts.some((c) => c.name === base))
215
+ return 'is a component of this file (rendered by its template, not passed to h() from module code)';
216
+ return null;
217
+ },
218
+ markupProp: () => null,
219
+ use: (source, n) => void imports.push([source, n]),
220
+ helper: () => {
221
+ refused = true;
222
+ },
223
+ markupChild: (e) => {
224
+ // a child value React's types say may be an element (markup held as a value) needs a helper: not taken
225
+ const leaves = (x) => {
226
+ const v = t.isParenthesizedExpression(x) ? x.expression : x;
227
+ if (t.isLogicalExpression(v))
228
+ return [...leaves(v.left), ...leaves(v.right)];
229
+ if (t.isConditionalExpression(v))
230
+ return [...leaves(v.consequent), ...leaves(v.alternate)];
231
+ return [v];
232
+ };
233
+ if (leaves(e).some((v) => !t.isJSXElement(v) && !t.isJSXFragment(v) && !t.isStringLiteral(v) && !t.isNumericLiteral(v) && !t.isTemplateLiteral(v) && (!v.loc || !oracle || mayBeElement(oracle.elementKind(file, v.loc)))))
234
+ refused = true;
235
+ return false;
236
+ },
237
+ reactApi: () => null,
238
+ childrenNodes: () => null,
239
+ warn: () => {
240
+ refused = true;
241
+ },
242
+ refuse: () => {
243
+ refused = true;
244
+ },
245
+ });
246
+ if (!written || refused || containsJsx(written) || imports.some(([source, n]) => source !== 'vue' || n !== 'h'))
247
+ continue;
248
+ vnodeTypes(written, types);
249
+ statements.set(stmt, written);
250
+ for (const s of own)
251
+ taken.add(s.node);
252
+ }
253
+ if (!statements.size)
254
+ return null;
255
+ for (const s of taken)
256
+ SITES.add(s);
257
+ return { statements, sites: taken, types };
258
+ }
@@ -0,0 +1,19 @@
1
+ import type { EmittedFile } from '../../types.js';
2
+ import { type LayoutFeature } from '../shared/motion-layout.js';
3
+ /**
4
+ * Framer Motion's `layout` and `drag` on Vue: motion-v plays both its own way, which differs from React's while they
5
+ * move (measured), so an element whose Framer props are only layout props, or only drag props, is a plain element with
6
+ * a directive over the framework-free `motion` package's own engines (animateLayout, drag), the code the Svelte and
7
+ * Angular targets use. Written once per conversion, with only the parts it uses.
8
+ */
9
+ /** The file, at the root of the output. */
10
+ export declare const VUE_LAYOUT_FILE = "motion-layout.ts";
11
+ /** The directives it exports (`v-motion-layout`, `v-motion-drag` in a template; script setup registers `v…` imports). */
12
+ export declare const VUE_LAYOUT = "vMotionLayout";
13
+ export declare const VUE_DRAG = "vMotionDrag";
14
+ /** The file's source, with only what the conversion's elements use. */
15
+ export declare function vueLayoutSource(features: ReadonlySet<LayoutFeature>): string;
16
+ /** Records that a Vue component of the conversion uses the file (keyed by the conversion's diagnostics list). */
17
+ export declare function useVueLayout(conversion: object, features: Iterable<LayoutFeature>): void;
18
+ /** The file, when a component of the conversion uses it; nothing otherwise. */
19
+ export declare function vueLayoutFiles(conversion: object, path: string): EmittedFile[];
@@ -0,0 +1,79 @@
1
+ import { NEVER_REDUCE_SOURCE, dragCoreSource, layoutCoreSource, layoutHelperFeatures, layoutMotionImports, layoutPropsTypes, useLayoutHelper } from '../shared/motion-layout.js';
2
+ /**
3
+ * Framer Motion's `layout` and `drag` on Vue: motion-v plays both its own way, which differs from React's while they
4
+ * move (measured), so an element whose Framer props are only layout props, or only drag props, is a plain element with
5
+ * a directive over the framework-free `motion` package's own engines (animateLayout, drag), the code the Svelte and
6
+ * Angular targets use. Written once per conversion, with only the parts it uses.
7
+ */
8
+ /** The file, at the root of the output. */
9
+ export const VUE_LAYOUT_FILE = 'motion-layout.ts';
10
+ /** The directives it exports (`v-motion-layout`, `v-motion-drag` in a template; script setup registers `v…` imports). */
11
+ export const VUE_LAYOUT = 'vMotionLayout';
12
+ export const VUE_DRAG = 'vMotionDrag';
13
+ /** The file's source, with only what the conversion's elements use. */
14
+ export function vueLayoutSource(features) {
15
+ const { values, types } = layoutMotionImports(features);
16
+ const parts = [
17
+ `/**
18
+ * Framer Motion's ${[features.has('layout') && 'layout animations (\`layout\`)', features.has('drag') && 'drag gesture (\`drag\`)'].filter(Boolean).join(' and ')} on Vue, with the framework-free \`motion\` package's
19
+ * own engines, the ones React's motion components use. Written once for all the components of the conversion.
20
+ */
21
+ import type { Directive } from 'vue';
22
+ import { ${values.join(', ')} } from 'motion';
23
+ import type { ${types.join(', ')} } from 'motion';
24
+
25
+ ${layoutPropsTypes(features)}${NEVER_REDUCE_SOURCE}`,
26
+ ];
27
+ if (features.has('layout')) {
28
+ // Vue applies the updates of an event's handlers in a microtask, before the event reaches the window: nothing to flush
29
+ parts.push(layoutCoreSource('// Vue has applied them already (its scheduler runs in a microtask after each handler)'));
30
+ parts.push(`
31
+ /** \`v-motion-layout\`: an element with React's \`layout\` (and the element's \`transition\`). */
32
+ export const ${VUE_LAYOUT}: Directive<HTMLElement, LayoutProps> = {
33
+ mounted(element, binding) {
34
+ addLayout(element, binding.value);
35
+ },
36
+ updated(element, binding) {
37
+ markLayout(element, binding.value);
38
+ },
39
+ beforeUnmount(element) {
40
+ removeLayout(element);
41
+ },
42
+ };
43
+ `);
44
+ }
45
+ if (features.has('drag')) {
46
+ parts.push(dragCoreSource(features.has('whileDrag')));
47
+ parts.push(`
48
+ /** Each dragged element's latest props and the function that ends its drag. */
49
+ const dragged = new WeakMap<HTMLElement, { props: DragProps; stop: () => void }>();
50
+
51
+ /** \`v-motion-drag\`: an element with React's \`drag\` and its drag props. */
52
+ export const ${VUE_DRAG}: Directive<HTMLElement, DragProps> = {
53
+ mounted(element, binding) {
54
+ const state: { props: DragProps; stop: () => void } = { props: binding.value, stop: () => undefined };
55
+ state.stop = startDrag(element, () => state.props);
56
+ dragged.set(element, state);
57
+ },
58
+ updated(element, binding) {
59
+ const state = dragged.get(element);
60
+ if (state) state.props = binding.value;
61
+ },
62
+ beforeUnmount(element) {
63
+ dragged.get(element)?.stop();
64
+ dragged.delete(element);
65
+ },
66
+ };
67
+ `);
68
+ }
69
+ return parts.join('');
70
+ }
71
+ /** Records that a Vue component of the conversion uses the file (keyed by the conversion's diagnostics list). */
72
+ export function useVueLayout(conversion, features) {
73
+ useLayoutHelper(conversion, features);
74
+ }
75
+ /** The file, when a component of the conversion uses it; nothing otherwise. */
76
+ export function vueLayoutFiles(conversion, path) {
77
+ const features = layoutHelperFeatures(conversion);
78
+ return features ? [{ path, contents: vueLayoutSource(features), kind: 'module' }] : [];
79
+ }
@@ -0,0 +1,12 @@
1
+ import * as t from '@babel/types';
2
+ /** Framer Motion names whose motion-v counterpart is spelled differently. */
3
+ export declare const MOTION_RENAME: Record<string, string>;
4
+ /** motion-v accepts every other Framer element prop under the same name. */
5
+ export declare const MOTION_UNSUPPORTED: Set<string>;
6
+ /**
7
+ * Framer Motion element props as motion-v attributes on `<motion.tag>`: animation objects bind (`:animate`), variant
8
+ * labels stay static strings, booleans are bare attributes and handlers become `@event` listeners.
9
+ */
10
+ export declare function vueMotionAttrs(motion: Record<string, t.Expression>, expr: (e: t.Expression) => string, handler: (e: t.Expression, event: string) => string, warn: (message: string, line?: number) => void,
11
+ /** the element's first line, for a bare prop that carries no location */
12
+ line?: number): string[];
@@ -0,0 +1,46 @@
1
+ import * as t from '@babel/types';
2
+ import { escapeAttr } from '../shared/markup.js';
3
+ /** Framer Motion names whose motion-v counterpart is spelled differently. */
4
+ export const MOTION_RENAME = {
5
+ whileTap: 'whilePress',
6
+ onTap: 'onPress',
7
+ onTapStart: 'onPressStart',
8
+ onTapCancel: 'onPressCancel',
9
+ };
10
+ /** motion-v accepts every other Framer element prop under the same name. */
11
+ export const MOTION_UNSUPPORTED = new Set(['transformTemplate', 'onUpdate']);
12
+ /**
13
+ * Framer Motion element props as motion-v attributes on `<motion.tag>`: animation objects bind (`:animate`), variant
14
+ * labels stay static strings, booleans are bare attributes and handlers become `@event` listeners.
15
+ */
16
+ export function vueMotionAttrs(motion, expr, handler,
17
+ // M2: warnings take a line; `line` is the element's first line, for a bare prop that carries no location
18
+ warn,
19
+ /** the element's first line, for a bare prop that carries no location */
20
+ line) {
21
+ const out = [];
22
+ // M2: motion-v plays `layout` its own way: measured against React (tests/visual/layout-drag.test.ts), its path
23
+ // differs while it moves (it matches React at rest, and for `layoutId`); `drag` comes from v-motion-drag (emit.ts)
24
+ if (motion.layout && !t.isBooleanLiteral(motion.layout, { value: false })) {
25
+ warn('motion-v animates `layout` along another path than React while it moves (measured: a switch knob with a spring transition 67% at the click, a growing card 93% 32 ms in); it matches React at rest.', motion.layout.loc?.start.line ?? line);
26
+ }
27
+ for (const [rawName, value] of Object.entries(motion)) {
28
+ if (MOTION_UNSUPPORTED.has(rawName)) {
29
+ warn(`motion-v has no ${rawName}; it is dropped.`);
30
+ continue;
31
+ }
32
+ const name = MOTION_RENAME[rawName] ?? rawName;
33
+ if (/^on[A-Z]/.test(name)) {
34
+ const event = name.slice(2).replace(/[A-Z]/g, (c, i) => (i === 0 ? c.toLowerCase() : `-${c.toLowerCase()}`));
35
+ out.push(`@${event}="${escapeAttr(handler(value, event))}"`);
36
+ continue;
37
+ }
38
+ if (t.isBooleanLiteral(value) && value.value)
39
+ out.push(name);
40
+ else if (t.isStringLiteral(value))
41
+ out.push(`${name}="${escapeAttr(value.value)}"`);
42
+ else
43
+ out.push(`:${name}="${escapeAttr(expr(value))}"`);
44
+ }
45
+ return out;
46
+ }
@@ -0,0 +1,3 @@
1
+ import { type PackageMap } from './part.js';
2
+ /** @radix-ui/react-accordion → reka-ui's Accordion (the open item or items are reka's model value). */
3
+ export declare const accordion: PackageMap;
@@ -0,0 +1,12 @@
1
+ import { rekaPart } from './part.js';
2
+ /** @radix-ui/react-accordion → reka-ui's Accordion (the open item or items are reka's model value). */
3
+ export const accordion = {
4
+ Root: rekaPart('AccordionRoot', {
5
+ props: { type: 'type', value: 'modelValue', defaultValue: 'defaultValue', collapsible: 'collapsible', disabled: 'disabled', dir: 'dir', orientation: 'orientation' },
6
+ events: { onValueChange: 'update:modelValue' },
7
+ }),
8
+ Item: rekaPart('AccordionItem', { props: { value: 'value', disabled: 'disabled' } }),
9
+ Header: rekaPart('AccordionHeader'),
10
+ Trigger: rekaPart('AccordionTrigger'),
11
+ Content: rekaPart('AccordionContent', { props: { forceMount: 'forceMount' } }),
12
+ };
@@ -0,0 +1,6 @@
1
+ import { type PackageMap } from './part.js';
2
+ /**
3
+ * @radix-ui/react-alert-dialog → reka-ui's AlertDialog. reka-ui focuses the Cancel button when the dialog opens, as
4
+ * Radix does. reka-ui types its Root's props as `AlertDialogProps`.
5
+ */
6
+ export declare const alertDialog: PackageMap;
@@ -0,0 +1,18 @@
1
+ import { LAYER_EVENTS, portal, rekaPart } from './part.js';
2
+ /** An alert dialog's content cannot be dismissed from outside: Radix's takes no onPointerDownOutside or onInteractOutside. */
3
+ const CONTENT_EVENTS = Object.fromEntries(Object.entries(LAYER_EVENTS).filter(([key]) => key !== 'onPointerDownOutside' && key !== 'onInteractOutside'));
4
+ /**
5
+ * @radix-ui/react-alert-dialog → reka-ui's AlertDialog. reka-ui focuses the Cancel button when the dialog opens, as
6
+ * Radix does. reka-ui types its Root's props as `AlertDialogProps`.
7
+ */
8
+ export const alertDialog = {
9
+ Root: rekaPart('AlertDialogRoot', { element: false, props: { open: 'open', defaultOpen: 'defaultOpen' }, events: { onOpenChange: 'update:open' }, propsType: 'AlertDialogProps' }),
10
+ Trigger: rekaPart('AlertDialogTrigger'),
11
+ Portal: portal('AlertDialogPortal'),
12
+ Overlay: rekaPart('AlertDialogOverlay', { props: { forceMount: 'forceMount' } }),
13
+ Content: rekaPart('AlertDialogContent', { props: { forceMount: 'forceMount' }, events: CONTENT_EVENTS }),
14
+ Title: rekaPart('AlertDialogTitle'),
15
+ Description: rekaPart('AlertDialogDescription'),
16
+ Action: rekaPart('AlertDialogAction'),
17
+ Cancel: rekaPart('AlertDialogCancel'),
18
+ };
@@ -0,0 +1,6 @@
1
+ import { type PackageMap } from './part.js';
2
+ /**
3
+ * @radix-ui/react-aspect-ratio → reka-ui's AspectRatio. Both render a relative wrapper whose bottom padding is the ratio
4
+ * and an absolutely placed element inside it that takes the part's props.
5
+ */
6
+ export declare const aspectRatio: PackageMap;
@@ -0,0 +1,8 @@
1
+ import { rekaPart } from './part.js';
2
+ /**
3
+ * @radix-ui/react-aspect-ratio → reka-ui's AspectRatio. Both render a relative wrapper whose bottom padding is the ratio
4
+ * and an absolutely placed element inside it that takes the part's props.
5
+ */
6
+ export const aspectRatio = {
7
+ Root: rekaPart('AspectRatio', { props: { ratio: 'ratio' } }),
8
+ };
@@ -0,0 +1,3 @@
1
+ import { type PackageMap } from './part.js';
2
+ /** @radix-ui/react-avatar → reka-ui's Avatar. */
3
+ export declare const avatar: PackageMap;
@@ -0,0 +1,7 @@
1
+ import { rekaPart } from './part.js';
2
+ /** @radix-ui/react-avatar → reka-ui's Avatar. */
3
+ export const avatar = {
4
+ Root: rekaPart('AvatarRoot'),
5
+ Image: rekaPart('AvatarImage', { props: { src: 'src' }, events: { onLoadingStatusChange: 'loadingStatusChange' } }),
6
+ Fallback: rekaPart('AvatarFallback', { props: { delayMs: 'delayMs' } }),
7
+ };
@@ -0,0 +1,3 @@
1
+ import { type PackageMap } from './part.js';
2
+ /** @radix-ui/react-checkbox → reka-ui's Checkbox (checked, 'indeterminate' included, is reka's model value). */
3
+ export declare const checkbox: PackageMap;
@@ -0,0 +1,9 @@
1
+ import { rekaPart } from './part.js';
2
+ /** @radix-ui/react-checkbox → reka-ui's Checkbox (checked, 'indeterminate' included, is reka's model value). */
3
+ export const checkbox = {
4
+ Root: rekaPart('CheckboxRoot', {
5
+ props: { checked: 'modelValue', defaultChecked: 'defaultValue', disabled: 'disabled', required: 'required', name: 'name', value: 'value', id: 'id' },
6
+ events: { onCheckedChange: 'update:modelValue' },
7
+ }),
8
+ Indicator: rekaPart('CheckboxIndicator', { props: { forceMount: 'forceMount' } }),
9
+ };
@@ -0,0 +1,7 @@
1
+ import { type PackageMap } from './part.js';
2
+ /**
3
+ * @radix-ui/react-collapsible → reka-ui's Collapsible. Radix's Root renders a div (it takes asChild), as reka's does.
4
+ * reka removes the closed content (its `unmountOnHide` is on by default), as Radix does; it sets the content's size as
5
+ * `--reka-collapsible-content-height` / `-width` (see index: REKA_CSS_VARIABLES).
6
+ */
7
+ export declare const collapsible: PackageMap;
@@ -0,0 +1,11 @@
1
+ import { rekaPart } from './part.js';
2
+ /**
3
+ * @radix-ui/react-collapsible → reka-ui's Collapsible. Radix's Root renders a div (it takes asChild), as reka's does.
4
+ * reka removes the closed content (its `unmountOnHide` is on by default), as Radix does; it sets the content's size as
5
+ * `--reka-collapsible-content-height` / `-width` (see index: REKA_CSS_VARIABLES).
6
+ */
7
+ export const collapsible = {
8
+ Root: rekaPart('CollapsibleRoot', { props: { open: 'open', defaultOpen: 'defaultOpen', disabled: 'disabled' }, events: { onOpenChange: 'update:open' } }),
9
+ Trigger: rekaPart('CollapsibleTrigger'),
10
+ Content: rekaPart('CollapsibleContent', { props: { forceMount: 'forceMount' } }),
11
+ };
@@ -0,0 +1,3 @@
1
+ import { type PackageMap } from './part.js';
2
+ /** @radix-ui/react-context-menu → reka-ui's ContextMenu (its items as DropdownMenu's). */
3
+ export declare const contextMenu: PackageMap;
@@ -0,0 +1,30 @@
1
+ import { LAYER_EVENTS, POPPER_PROPS, portal, rekaPart } from './part.js';
2
+ /**
3
+ * A context menu opens at the pointer: Radix's Content defaults to side right, offset 2, align start and lets a prop
4
+ * change them, reka-ui's takes none of those (nor arrowPadding or updatePositionStrategy), so they are not mapped.
5
+ */
6
+ const CONTENT_POPPER = Object.fromEntries(Object.entries(POPPER_PROPS).filter(([key]) => !['side', 'sideOffset', 'align', 'arrowPadding'].includes(key)));
7
+ /** A submenu is placed beside its trigger: Radix's SubContent takes no side or align, reka's neither. */
8
+ const SUB_POPPER = Object.fromEntries(Object.entries(POPPER_PROPS).filter(([key]) => key !== 'side' && key !== 'align'));
9
+ /** A menu's content takes no onOpenAutoFocus in Radix (the menu focuses itself); a submenu's no onCloseAutoFocus either. */
10
+ const MENU_EVENTS = Object.fromEntries(Object.entries(LAYER_EVENTS).filter(([key]) => key !== 'onOpenAutoFocus'));
11
+ const SUB_EVENTS = Object.fromEntries(Object.entries(MENU_EVENTS).filter(([key]) => key !== 'onCloseAutoFocus'));
12
+ /** @radix-ui/react-context-menu → reka-ui's ContextMenu (its items as DropdownMenu's). */
13
+ export const contextMenu = {
14
+ Root: rekaPart('ContextMenuRoot', { element: false, props: { modal: 'modal', dir: 'dir' }, events: { onOpenChange: 'update:open' } }),
15
+ Trigger: rekaPart('ContextMenuTrigger', { props: { disabled: 'disabled' } }),
16
+ Portal: portal('ContextMenuPortal'),
17
+ Content: rekaPart('ContextMenuContent', { props: { forceMount: 'forceMount', loop: 'loop', ...CONTENT_POPPER }, events: MENU_EVENTS }),
18
+ Group: rekaPart('ContextMenuGroup'),
19
+ Label: rekaPart('ContextMenuLabel'),
20
+ Item: rekaPart('ContextMenuItem', { props: { disabled: 'disabled', textValue: 'textValue' }, events: { onSelect: 'select' } }),
21
+ CheckboxItem: rekaPart('ContextMenuCheckboxItem', { props: { checked: 'modelValue', disabled: 'disabled', textValue: 'textValue' }, events: { onCheckedChange: 'update:modelValue', onSelect: 'select' } }),
22
+ RadioGroup: rekaPart('ContextMenuRadioGroup', { props: { value: 'modelValue' }, events: { onValueChange: 'update:modelValue' } }),
23
+ RadioItem: rekaPart('ContextMenuRadioItem', { props: { value: 'value', disabled: 'disabled', textValue: 'textValue' }, events: { onSelect: 'select' } }),
24
+ ItemIndicator: rekaPart('ContextMenuItemIndicator', { props: { forceMount: 'forceMount' } }),
25
+ Separator: rekaPart('ContextMenuSeparator'),
26
+ Arrow: rekaPart('ContextMenuArrow', { props: { width: 'width', height: 'height' } }),
27
+ Sub: rekaPart('ContextMenuSub', { element: false, props: { open: 'open', defaultOpen: 'defaultOpen' }, events: { onOpenChange: 'update:open' } }),
28
+ SubTrigger: rekaPart('ContextMenuSubTrigger', { props: { disabled: 'disabled', textValue: 'textValue' } }),
29
+ SubContent: rekaPart('ContextMenuSubContent', { props: { forceMount: 'forceMount', loop: 'loop', ...SUB_POPPER }, events: SUB_EVENTS }),
30
+ };
@@ -0,0 +1,3 @@
1
+ import { type PackageMap } from './part.js';
2
+ /** @radix-ui/react-dialog → reka-ui's Dialog. */
3
+ export declare const dialog: PackageMap;