@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,12 @@
1
+ /**
2
+ * Framer Motion on Angular: the `[motion]` directive the output brings along (see helpers.ts), a port of the Svelte
3
+ * target's motion action to a signal-input directive over the framework-free `motion` package. Exit animations use
4
+ * Angular's own `animate.leave`, which keeps a leaving element in the DOM until the callback says the animation ended.
5
+ * Generated from a checked source; edit both together.
6
+ */
7
+ /** The directive's class name, as a component's `imports` list it. */
8
+ export declare const MOTION = "Motion";
9
+ /** The AnimatePresence directive's class name (in the same file). */
10
+ export declare const MOTION_PRESENCE = "MotionPresence";
11
+ /** The directive's file. */
12
+ export declare const MOTION_FILE = "import { afterNextRender, DestroyRef, Directive, effect, ElementRef, inject, input, untracked, type AnimationCallbackEvent } from '@angular/core';\nimport { animate, hover, inView, press, styleEffect, type AnimationPlaybackControls, type MotionValue, type TargetAndTransition, type Transition, type Variants } from 'motion';\n\n/** A Framer Motion target: values to animate to, with their own transition, or the label of a variant. */\nexport type MotionTarget = TargetAndTransition | string;\n\n/** The Framer Motion props of one element, as the `[motion]` directive takes them. */\nexport interface MotionProps {\n initial?: MotionTarget | boolean;\n animate?: MotionTarget;\n exit?: MotionTarget;\n transition?: Transition;\n variants?: Variants;\n whileHover?: MotionTarget;\n whileTap?: MotionTarget;\n whileFocus?: MotionTarget;\n whileInView?: MotionTarget;\n viewport?: { once?: boolean; amount?: number | 'some' | 'all' };\n /** motion values bound to styles (`style={{ x }}` with `x = useMotionValue(0)`) */\n values?: Record<string, MotionValue<number> | MotionValue<string>>;\n onAnimationComplete?: () => void;\n onHoverStart?: () => void;\n onHoverEnd?: () => void;\n onTap?: () => void;\n onTapStart?: () => void;\n onTapCancel?: () => void;\n}\n\ntype Values = Record<string, unknown>;\n\n/** What AnimatePresence changes about its children's enter: Framer's `initial` and `mode` props. */\nexport interface PresenceProps {\n initial?: boolean;\n mode?: 'sync' | 'wait' | 'popLayout';\n}\n\n/**\n * Framer's AnimatePresence, on the `<ng-container>` around its children: what their motion elements read as they enter.\n * With `initial: false` the elements present at its first render start at `animate`; with `mode: 'wait'` an element\n * added later enters once the exits playing in it have ended (React adds it only then).\n */\n@Directive({ selector: '[motionPresence]' })\nexport class MotionPresence {\n readonly motionPresence = input<PresenceProps | ''>('');\n /** true until its first render has ended: the motion elements created until then are present at the first render */\n first = true;\n /** the exits playing in it now */\n readonly exits = new Set<Promise<void>>();\n\n constructor() {\n afterNextRender(() => (this.first = false));\n }\n\n props(): PresenceProps {\n const props = this.motionPresence();\n return typeof props === 'object' ? props : {};\n }\n}\n\n/** Framer's resting values for the transforms and opacity, used when a gesture ends and `animate` does not set them. */\nconst RESTING: Values = { opacity: 1, scale: 1, scaleX: 1, scaleY: 1, x: 0, y: 0, z: 0, rotate: 0, rotateX: 0, rotateY: 0, rotateZ: 0, skewX: 0, skewY: 0 };\n\n/**\n * Framer Motion's element behaviour, driven by the framework-free `motion` package: the initial values, an animation to\n * `animate` (again whenever it changes), the gesture states (`whileHover`, `whileTap`, `whileFocus`, `whileInView`)\n * returning to the resting values, variants by label (a child without its own labels follows its motion parent's, with\n * the parent's `staggerChildren` and `delayChildren`), motion values bound to styles, and `exit`: Angular keeps the\n * element (`animate.leave`) until its exit animation has run.\n */\n@Directive({ selector: '[motion]', host: { '(animate.leave)': 'leave($event)' } })\nexport class Motion {\n readonly motion = input.required<MotionProps>();\n private readonly element = inject<ElementRef<HTMLElement | SVGElement>>(ElementRef).nativeElement;\n private readonly parent = inject(Motion, { optional: true, skipSelf: true });\n /** the nearest AnimatePresence around it */\n private readonly presence = inject(MotionPresence, { optional: true });\n private readonly children: Motion[] = [];\n private readonly running = new Set<AnimationPlaybackControls>();\n\n constructor() {\n this.parent?.children.push(this);\n // created during the first render of its AnimatePresence: present at it\n const presentAtFirst = this.presence?.first ?? false;\n let destroyed = false;\n const stops: (() => void)[] = [];\n // what `animate` was last animated to, once the element is in the page\n let shown: string | null = null;\n const animateTo = (props: MotionProps): void => {\n const target = this.resolve(this.label('animate'));\n const key = JSON.stringify(target?.values ?? null);\n if (key === shown) return;\n shown = key;\n if (target) void this.run(target.values, { ...target.transition, delay: this.delay(target.transition) }).then(() => props.onAnimationComplete?.());\n };\n // again whenever `animate` changes\n effect(() => {\n const props = this.motion();\n if (shown !== null) untracked(() => animateTo(props));\n });\n afterNextRender(() => {\n const props = this.motion();\n const element = this.element;\n const presence = this.presence;\n // a shape inside an <svg>: Framer scales and rotates it about its own centre (transform-box: fill-box, origin\n // 50% 50%) unless it sets its own origin; the motion package keeps SVG's default, the top left corner of its box\n if (element instanceof SVGElement && !(element instanceof SVGSVGElement)) {\n element.style.transformBox ||= 'fill-box';\n element.style.transformOrigin ||= '50% 50%';\n }\n // the first values before the first paint, then the animation to `animate` (none with `initial: false`, or when\n // AnimatePresence `initial: false` holds back an element present at its first render)\n const held = props.initial === false || (presentAtFirst && presence?.props().initial === false);\n const start = this.resolve(this.label(held ? 'animate' : 'initial'));\n if (start) void this.run(start.values, { duration: 0 });\n if (held) shown = JSON.stringify(this.resolve(this.label('animate'))?.values ?? null);\n else if (presence && !presentAtFirst && presence.props().mode === 'wait') {\n // mode: 'wait': added while others leave, it takes no room until their exits have ended, then enters. Those exits\n // start in this same render (Angular runs leave animations after it), so they are read a microtask later\n const display = element.style.display;\n element.style.display = 'none';\n queueMicrotask(() => {\n void Promise.all(presence.exits).then(() => {\n if (destroyed) return;\n element.style.display = display;\n animateTo(this.motion());\n });\n });\n } else animateTo(props);\n if (props.values) stops.push(styleEffect(element, props.values));\n if (props.whileHover || props.onHoverStart || props.onHoverEnd) {\n stops.push(\n hover(element, () => {\n this.motion().onHoverStart?.();\n const end = this.gesture('whileHover');\n return () => {\n this.motion().onHoverEnd?.();\n end?.();\n };\n }),\n );\n }\n if (props.whileTap || props.onTap || props.onTapStart) {\n stops.push(\n press(element, () => {\n this.motion().onTapStart?.();\n const end = this.gesture('whileTap');\n return (_event, info) => {\n if (info.success) this.motion().onTap?.();\n else this.motion().onTapCancel?.();\n end?.();\n };\n }),\n );\n }\n if (props.whileFocus) {\n let end: (() => void) | undefined;\n const onFocus = () => (end = this.gesture('whileFocus'));\n const onBlur = () => end?.();\n element.addEventListener('focus', onFocus);\n element.addEventListener('blur', onBlur);\n stops.push(() => {\n element.removeEventListener('focus', onFocus);\n element.removeEventListener('blur', onBlur);\n });\n }\n if (props.whileInView) {\n stops.push(\n inView(element, () => {\n const end = this.gesture('whileInView');\n return this.motion().viewport?.once ? undefined : end;\n }, { amount: props.viewport?.amount ?? 'some' }),\n );\n }\n });\n inject(DestroyRef).onDestroy(() => {\n destroyed = true;\n for (const stop of stops) stop();\n for (const controls of this.running) controls.stop();\n if (this.parent) this.parent.children.splice(this.parent.children.indexOf(this), 1);\n });\n }\n\n /** `animate.leave`: the exit animation, after which Angular removes the element. */\n protected leave(event: AnimationCallbackEvent): void {\n const exit = this.resolve(this.label('exit'));\n if (!exit) return event.animationComplete();\n const done = this.run(exit.values, exit.transition);\n // an element entering with AnimatePresence mode: 'wait' waits for it\n const exits = this.presence?.exits;\n exits?.add(done);\n void done.then(() => {\n exits?.delete(done);\n event.animationComplete();\n });\n }\n\n /** A target's label (`initial`, `animate`, `exit`): this element's own, or its motion parent's when it only has variants. */\n private label(which: 'initial' | 'animate' | 'exit'): MotionTarget | boolean | undefined {\n const own = this.motion()[which];\n if (own !== undefined) return own;\n const inherited = this.motion().variants ? this.parent?.label(which) : undefined;\n return typeof inherited === 'string' ? inherited : undefined;\n }\n\n private resolve(target: MotionTarget | boolean | undefined): { values: Values; transition: Transition | undefined } | null {\n const props = this.motion();\n const variant = typeof target === 'string' ? props.variants?.[target] : typeof target === 'object' ? target : undefined;\n // a variant computed from `custom` (a function) is not played: the emitter reports `custom`\n const found = typeof variant === 'object' ? variant : undefined;\n if (!found) return null;\n const { transition, ...values } = found;\n return { values, transition: transition ?? props.transition };\n }\n\n /** The delay an animation to a variant waits: its own, plus the parent's `delayChildren` and `staggerChildren` by position. */\n private delay(transition: Transition | undefined): number | undefined {\n const own = typeof transition?.delay === 'number' ? transition.delay : 0;\n const parent = this.parent?.resolve(this.parent.label('animate'))?.transition;\n if (!this.parent || !parent || this.motion().animate !== undefined) return own || undefined;\n const stagger = typeof parent.staggerChildren === 'number' ? parent.staggerChildren : 0;\n const delayChildren = typeof parent.delayChildren === 'number' ? parent.delayChildren : 0;\n return own + delayChildren + stagger * Math.max(0, this.parent.children.indexOf(this)) || undefined;\n }\n\n private run(values: Values, transition: Transition | undefined): Promise<void> {\n const controls = animate(this.element, values, transition);\n this.running.add(controls);\n return controls.then(() => void this.running.delete(controls));\n }\n\n /** A gesture state: animated to, and back to the resting values when it ends. */\n private gesture(which: 'whileHover' | 'whileTap' | 'whileFocus' | 'whileInView'): (() => void) | undefined {\n const state = this.resolve(this.motion()[which]);\n if (!state) return undefined;\n void this.run(state.values, state.transition);\n return () => {\n const back = this.resolve(this.label('animate'))?.values ?? {};\n const initial = this.resolve(this.label('initial'))?.values ?? {};\n const computed = getComputedStyle(this.element);\n const resting: Values = {};\n for (const key of Object.keys(state.values)) resting[key] = back[key] ?? RESTING[key] ?? initial[key] ?? computed.getPropertyValue(key);\n void this.run(resting, state.transition ?? this.motion().transition);\n };\n }\n}\n";
@@ -0,0 +1,257 @@
1
+ /**
2
+ * Framer Motion on Angular: the `[motion]` directive the output brings along (see helpers.ts), a port of the Svelte
3
+ * target's motion action to a signal-input directive over the framework-free `motion` package. Exit animations use
4
+ * Angular's own `animate.leave`, which keeps a leaving element in the DOM until the callback says the animation ended.
5
+ * Generated from a checked source; edit both together.
6
+ */
7
+ /** The directive's class name, as a component's `imports` list it. */
8
+ export const MOTION = 'Motion';
9
+ /** The AnimatePresence directive's class name (in the same file). */
10
+ export const MOTION_PRESENCE = 'MotionPresence';
11
+ /** The directive's file. */
12
+ export const MOTION_FILE = `import { afterNextRender, DestroyRef, Directive, effect, ElementRef, inject, input, untracked, type AnimationCallbackEvent } from '@angular/core';
13
+ import { animate, hover, inView, press, styleEffect, type AnimationPlaybackControls, type MotionValue, type TargetAndTransition, type Transition, type Variants } from 'motion';
14
+
15
+ /** A Framer Motion target: values to animate to, with their own transition, or the label of a variant. */
16
+ export type MotionTarget = TargetAndTransition | string;
17
+
18
+ /** The Framer Motion props of one element, as the \`[motion]\` directive takes them. */
19
+ export interface MotionProps {
20
+ initial?: MotionTarget | boolean;
21
+ animate?: MotionTarget;
22
+ exit?: MotionTarget;
23
+ transition?: Transition;
24
+ variants?: Variants;
25
+ whileHover?: MotionTarget;
26
+ whileTap?: MotionTarget;
27
+ whileFocus?: MotionTarget;
28
+ whileInView?: MotionTarget;
29
+ viewport?: { once?: boolean; amount?: number | 'some' | 'all' };
30
+ /** motion values bound to styles (\`style={{ x }}\` with \`x = useMotionValue(0)\`) */
31
+ values?: Record<string, MotionValue<number> | MotionValue<string>>;
32
+ onAnimationComplete?: () => void;
33
+ onHoverStart?: () => void;
34
+ onHoverEnd?: () => void;
35
+ onTap?: () => void;
36
+ onTapStart?: () => void;
37
+ onTapCancel?: () => void;
38
+ }
39
+
40
+ type Values = Record<string, unknown>;
41
+
42
+ /** What AnimatePresence changes about its children's enter: Framer's \`initial\` and \`mode\` props. */
43
+ export interface PresenceProps {
44
+ initial?: boolean;
45
+ mode?: 'sync' | 'wait' | 'popLayout';
46
+ }
47
+
48
+ /**
49
+ * Framer's AnimatePresence, on the \`<ng-container>\` around its children: what their motion elements read as they enter.
50
+ * With \`initial: false\` the elements present at its first render start at \`animate\`; with \`mode: 'wait'\` an element
51
+ * added later enters once the exits playing in it have ended (React adds it only then).
52
+ */
53
+ @Directive({ selector: '[motionPresence]' })
54
+ export class MotionPresence {
55
+ readonly motionPresence = input<PresenceProps | ''>('');
56
+ /** true until its first render has ended: the motion elements created until then are present at the first render */
57
+ first = true;
58
+ /** the exits playing in it now */
59
+ readonly exits = new Set<Promise<void>>();
60
+
61
+ constructor() {
62
+ afterNextRender(() => (this.first = false));
63
+ }
64
+
65
+ props(): PresenceProps {
66
+ const props = this.motionPresence();
67
+ return typeof props === 'object' ? props : {};
68
+ }
69
+ }
70
+
71
+ /** Framer's resting values for the transforms and opacity, used when a gesture ends and \`animate\` does not set them. */
72
+ const RESTING: Values = { opacity: 1, scale: 1, scaleX: 1, scaleY: 1, x: 0, y: 0, z: 0, rotate: 0, rotateX: 0, rotateY: 0, rotateZ: 0, skewX: 0, skewY: 0 };
73
+
74
+ /**
75
+ * Framer Motion's element behaviour, driven by the framework-free \`motion\` package: the initial values, an animation to
76
+ * \`animate\` (again whenever it changes), the gesture states (\`whileHover\`, \`whileTap\`, \`whileFocus\`, \`whileInView\`)
77
+ * returning to the resting values, variants by label (a child without its own labels follows its motion parent's, with
78
+ * the parent's \`staggerChildren\` and \`delayChildren\`), motion values bound to styles, and \`exit\`: Angular keeps the
79
+ * element (\`animate.leave\`) until its exit animation has run.
80
+ */
81
+ @Directive({ selector: '[motion]', host: { '(animate.leave)': 'leave($event)' } })
82
+ export class Motion {
83
+ readonly motion = input.required<MotionProps>();
84
+ private readonly element = inject<ElementRef<HTMLElement | SVGElement>>(ElementRef).nativeElement;
85
+ private readonly parent = inject(Motion, { optional: true, skipSelf: true });
86
+ /** the nearest AnimatePresence around it */
87
+ private readonly presence = inject(MotionPresence, { optional: true });
88
+ private readonly children: Motion[] = [];
89
+ private readonly running = new Set<AnimationPlaybackControls>();
90
+
91
+ constructor() {
92
+ this.parent?.children.push(this);
93
+ // created during the first render of its AnimatePresence: present at it
94
+ const presentAtFirst = this.presence?.first ?? false;
95
+ let destroyed = false;
96
+ const stops: (() => void)[] = [];
97
+ // what \`animate\` was last animated to, once the element is in the page
98
+ let shown: string | null = null;
99
+ const animateTo = (props: MotionProps): void => {
100
+ const target = this.resolve(this.label('animate'));
101
+ const key = JSON.stringify(target?.values ?? null);
102
+ if (key === shown) return;
103
+ shown = key;
104
+ if (target) void this.run(target.values, { ...target.transition, delay: this.delay(target.transition) }).then(() => props.onAnimationComplete?.());
105
+ };
106
+ // again whenever \`animate\` changes
107
+ effect(() => {
108
+ const props = this.motion();
109
+ if (shown !== null) untracked(() => animateTo(props));
110
+ });
111
+ afterNextRender(() => {
112
+ const props = this.motion();
113
+ const element = this.element;
114
+ const presence = this.presence;
115
+ // a shape inside an <svg>: Framer scales and rotates it about its own centre (transform-box: fill-box, origin
116
+ // 50% 50%) unless it sets its own origin; the motion package keeps SVG's default, the top left corner of its box
117
+ if (element instanceof SVGElement && !(element instanceof SVGSVGElement)) {
118
+ element.style.transformBox ||= 'fill-box';
119
+ element.style.transformOrigin ||= '50% 50%';
120
+ }
121
+ // the first values before the first paint, then the animation to \`animate\` (none with \`initial: false\`, or when
122
+ // AnimatePresence \`initial: false\` holds back an element present at its first render)
123
+ const held = props.initial === false || (presentAtFirst && presence?.props().initial === false);
124
+ const start = this.resolve(this.label(held ? 'animate' : 'initial'));
125
+ if (start) void this.run(start.values, { duration: 0 });
126
+ if (held) shown = JSON.stringify(this.resolve(this.label('animate'))?.values ?? null);
127
+ else if (presence && !presentAtFirst && presence.props().mode === 'wait') {
128
+ // mode: 'wait': added while others leave, it takes no room until their exits have ended, then enters. Those exits
129
+ // start in this same render (Angular runs leave animations after it), so they are read a microtask later
130
+ const display = element.style.display;
131
+ element.style.display = 'none';
132
+ queueMicrotask(() => {
133
+ void Promise.all(presence.exits).then(() => {
134
+ if (destroyed) return;
135
+ element.style.display = display;
136
+ animateTo(this.motion());
137
+ });
138
+ });
139
+ } else animateTo(props);
140
+ if (props.values) stops.push(styleEffect(element, props.values));
141
+ if (props.whileHover || props.onHoverStart || props.onHoverEnd) {
142
+ stops.push(
143
+ hover(element, () => {
144
+ this.motion().onHoverStart?.();
145
+ const end = this.gesture('whileHover');
146
+ return () => {
147
+ this.motion().onHoverEnd?.();
148
+ end?.();
149
+ };
150
+ }),
151
+ );
152
+ }
153
+ if (props.whileTap || props.onTap || props.onTapStart) {
154
+ stops.push(
155
+ press(element, () => {
156
+ this.motion().onTapStart?.();
157
+ const end = this.gesture('whileTap');
158
+ return (_event, info) => {
159
+ if (info.success) this.motion().onTap?.();
160
+ else this.motion().onTapCancel?.();
161
+ end?.();
162
+ };
163
+ }),
164
+ );
165
+ }
166
+ if (props.whileFocus) {
167
+ let end: (() => void) | undefined;
168
+ const onFocus = () => (end = this.gesture('whileFocus'));
169
+ const onBlur = () => end?.();
170
+ element.addEventListener('focus', onFocus);
171
+ element.addEventListener('blur', onBlur);
172
+ stops.push(() => {
173
+ element.removeEventListener('focus', onFocus);
174
+ element.removeEventListener('blur', onBlur);
175
+ });
176
+ }
177
+ if (props.whileInView) {
178
+ stops.push(
179
+ inView(element, () => {
180
+ const end = this.gesture('whileInView');
181
+ return this.motion().viewport?.once ? undefined : end;
182
+ }, { amount: props.viewport?.amount ?? 'some' }),
183
+ );
184
+ }
185
+ });
186
+ inject(DestroyRef).onDestroy(() => {
187
+ destroyed = true;
188
+ for (const stop of stops) stop();
189
+ for (const controls of this.running) controls.stop();
190
+ if (this.parent) this.parent.children.splice(this.parent.children.indexOf(this), 1);
191
+ });
192
+ }
193
+
194
+ /** \`animate.leave\`: the exit animation, after which Angular removes the element. */
195
+ protected leave(event: AnimationCallbackEvent): void {
196
+ const exit = this.resolve(this.label('exit'));
197
+ if (!exit) return event.animationComplete();
198
+ const done = this.run(exit.values, exit.transition);
199
+ // an element entering with AnimatePresence mode: 'wait' waits for it
200
+ const exits = this.presence?.exits;
201
+ exits?.add(done);
202
+ void done.then(() => {
203
+ exits?.delete(done);
204
+ event.animationComplete();
205
+ });
206
+ }
207
+
208
+ /** A target's label (\`initial\`, \`animate\`, \`exit\`): this element's own, or its motion parent's when it only has variants. */
209
+ private label(which: 'initial' | 'animate' | 'exit'): MotionTarget | boolean | undefined {
210
+ const own = this.motion()[which];
211
+ if (own !== undefined) return own;
212
+ const inherited = this.motion().variants ? this.parent?.label(which) : undefined;
213
+ return typeof inherited === 'string' ? inherited : undefined;
214
+ }
215
+
216
+ private resolve(target: MotionTarget | boolean | undefined): { values: Values; transition: Transition | undefined } | null {
217
+ const props = this.motion();
218
+ const variant = typeof target === 'string' ? props.variants?.[target] : typeof target === 'object' ? target : undefined;
219
+ // a variant computed from \`custom\` (a function) is not played: the emitter reports \`custom\`
220
+ const found = typeof variant === 'object' ? variant : undefined;
221
+ if (!found) return null;
222
+ const { transition, ...values } = found;
223
+ return { values, transition: transition ?? props.transition };
224
+ }
225
+
226
+ /** The delay an animation to a variant waits: its own, plus the parent's \`delayChildren\` and \`staggerChildren\` by position. */
227
+ private delay(transition: Transition | undefined): number | undefined {
228
+ const own = typeof transition?.delay === 'number' ? transition.delay : 0;
229
+ const parent = this.parent?.resolve(this.parent.label('animate'))?.transition;
230
+ if (!this.parent || !parent || this.motion().animate !== undefined) return own || undefined;
231
+ const stagger = typeof parent.staggerChildren === 'number' ? parent.staggerChildren : 0;
232
+ const delayChildren = typeof parent.delayChildren === 'number' ? parent.delayChildren : 0;
233
+ return own + delayChildren + stagger * Math.max(0, this.parent.children.indexOf(this)) || undefined;
234
+ }
235
+
236
+ private run(values: Values, transition: Transition | undefined): Promise<void> {
237
+ const controls = animate(this.element, values, transition);
238
+ this.running.add(controls);
239
+ return controls.then(() => void this.running.delete(controls));
240
+ }
241
+
242
+ /** A gesture state: animated to, and back to the resting values when it ends. */
243
+ private gesture(which: 'whileHover' | 'whileTap' | 'whileFocus' | 'whileInView'): (() => void) | undefined {
244
+ const state = this.resolve(this.motion()[which]);
245
+ if (!state) return undefined;
246
+ void this.run(state.values, state.transition);
247
+ return () => {
248
+ const back = this.resolve(this.label('animate'))?.values ?? {};
249
+ const initial = this.resolve(this.label('initial'))?.values ?? {};
250
+ const computed = getComputedStyle(this.element);
251
+ const resting: Values = {};
252
+ for (const key of Object.keys(state.values)) resting[key] = back[key] ?? RESTING[key] ?? initial[key] ?? computed.getPropertyValue(key);
253
+ void this.run(resting, state.transition ?? this.motion().transition);
254
+ };
255
+ }
256
+ }
257
+ `;
@@ -0,0 +1,73 @@
1
+ import * as t from '@babel/types';
2
+ /**
3
+ * Framer Motion's DOM hooks on Angular, written as Framer writes them over the framework-free `motion` package, each
4
+ * started after render and stopped by the effect's cleanup (on destroy, and before it runs again):
5
+ * - `useInView(ref, { root, margin, amount, once, initial })`: a signal (what the template reads) set by `inView`, as
6
+ * Framer sets its state: true on enter, false on leave unless `once`;
7
+ * - `useScroll({ target, container, offset, axis })`: the scroll values it returns (`scrollYProgress`, …) are
8
+ * `motionValue`s set from `scroll`'s info, as Framer sets them; no signal wraps them.
9
+ * - `useVelocity(value)`: a `motionValue` of the value's velocity, set as Framer sets it: on each change of the value,
10
+ * at the frame's end, and again each frame while the velocity is not zero (the frame is cancelled on destroy);
11
+ * - `useAnimationFrame(callback)`: the callback on every frame's update step with the time since the first frame and
12
+ * the frame's delta, as Framer calls it, from `frame.update(…, true)` until `cancelFrame` on destroy;
13
+ * - `const [scope, animate] = useAnimate()`: `scope` is the query of the element given `ref={scope}`, `animate` is
14
+ * `createScopedAnimate` over a scope object whose `current` is that element (selectors resolve inside it), and the
15
+ * animations it started are stopped on destroy, as Framer stops them on unmount.
16
+ * Options with no counterpart in these functions keep the hook refused, with the option named.
17
+ */
18
+ export type MotionHookPlan = {
19
+ hook: 'useInView';
20
+ name: string;
21
+ ref: t.Expression;
22
+ options: Map<string, t.Expression>;
23
+ } | {
24
+ hook: 'useScroll';
25
+ values: Map<string, string>;
26
+ options: Map<string, t.Expression>;
27
+ } | {
28
+ hook: 'useVelocity';
29
+ name: string;
30
+ source: t.Expression;
31
+ } | {
32
+ hook: 'useAnimationFrame';
33
+ callback: t.Expression;
34
+ }
35
+ /** `holder`: the member that is the animations' scope, named when the members are declared */
36
+ | {
37
+ hook: 'useAnimate';
38
+ scope: string | null;
39
+ animate: string | null;
40
+ holder?: string;
41
+ };
42
+ /** The plan for a Framer hook converted here; null for another hook; a reason when this one is not converted. */
43
+ export declare function motionHookPlan(hook: string, call: t.CallExpression, id: t.LVal | null): MotionHookPlan | string | null;
44
+ /** What the statements read and write in the class: React code as class code, a member, an import. */
45
+ export interface HookScope {
46
+ /** a React expression (`ref.current`, a prop) as class code */
47
+ rewrite(e: t.Expression): t.Expression;
48
+ /** `this.name` */
49
+ member(name: string): t.Expression;
50
+ /** the local name of an @angular/core export */
51
+ api(name: string): string;
52
+ /** imports a `motion` function, by name */
53
+ motion(name: string): void;
54
+ /** imports a `motion` type, by name */
55
+ motionType(name: string): void;
56
+ /** a member name of the class not taken yet, reserved */
57
+ alloc(base: string): string;
58
+ }
59
+ /**
60
+ * A member a plan declares: the value it starts with; `signal`: read as a signal; `query`: an element query the
61
+ * template names (`#name`); `type`: written on the member.
62
+ */
63
+ export interface HookMember {
64
+ name: string;
65
+ value: t.Expression;
66
+ signal: boolean;
67
+ query?: boolean;
68
+ type?: t.TSType;
69
+ }
70
+ /** The member a plan declares: the value it starts with. */
71
+ export declare function hookMembers(plan: MotionHookPlan, scope: HookScope): HookMember[];
72
+ /** The constructor statements that start what a plan watches. */
73
+ export declare function hookEffects(plan: MotionHookPlan, scope: HookScope): t.Statement[];