@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,357 @@
1
+ import * as t from '@babel/types';
2
+ import { domAttributeName, domEventName, isDomEventProp } from '../../ir/dom.js';
3
+ import { containsJSX } from '../../ir/lower.js';
4
+ import { isStringy, numericLiteral, reactStyleValue, styleKey } from '../../ir/style.js';
5
+ import { vueDomEvent } from './events.js';
6
+ /**
7
+ * Markup held as a value (ModuleIR.markupValues, ComponentIR.markupValues) as a Vue functional component:
8
+ * `() => h(Layers, { size: 14 })`. The markup is written with `h()` as Vue's own render functions are: elements and
9
+ * components with their props, text, values, choices (`a ? h(…) : null`) and lists (`items.map((item) => h(…))`).
10
+ * Anything else (a style object that needs units, refs, slots, Framer Motion) has no form here: null, and the caller
11
+ * reports it. `clone` copies each expression of the markup (a component's keeps what its names are bound to).
12
+ */
13
+ export function renderFunction(template, clone = (node) => t.cloneNode(node, true)) {
14
+ const body = new RenderWriter(clone).vnode(template);
15
+ return body ? t.arrowFunctionExpression([], body) : null;
16
+ }
17
+ const h = (args) => t.callExpression(t.identifier('h'), args);
18
+ function key(name) {
19
+ return /^[A-Za-z_$][\w$]*$/.test(name) ? t.identifier(name) : t.stringLiteral(name);
20
+ }
21
+ class RenderWriter {
22
+ clone;
23
+ constructor(clone) {
24
+ this.clone = clone;
25
+ }
26
+ /** One child, or several as an array (null renders nothing). */
27
+ vnode(n) {
28
+ const list = this.vnodes(n);
29
+ if (!list)
30
+ return null;
31
+ if (list.length === 1 && list[0])
32
+ return list[0];
33
+ return list.length ? t.arrayExpression(list) : t.nullLiteral();
34
+ }
35
+ vnodes(n) {
36
+ switch (n.type) {
37
+ case 'text':
38
+ return [t.stringLiteral(n.value)];
39
+ case 'expr':
40
+ // a value rendered where React renders it: Vue renders null, undefined and booleans as nothing too
41
+ return n.markup ? null : [this.clone(n.expr)];
42
+ case 'fragment':
43
+ return this.children(n.children);
44
+ case 'if': {
45
+ let out = t.nullLiteral();
46
+ for (const b of [...n.branches].reverse()) {
47
+ const value = this.vnode({ type: 'fragment', children: b.children });
48
+ if (!value)
49
+ return null;
50
+ out = b.test ? t.conditionalExpression(this.clone(b.test), value, out) : value;
51
+ }
52
+ return [out];
53
+ }
54
+ case 'for': {
55
+ const item = n.item;
56
+ if (n.locals.length || !(t.isIdentifier(item) || t.isObjectPattern(item) || t.isArrayPattern(item)))
57
+ return null;
58
+ const child = this.vnode({ type: 'fragment', children: n.children });
59
+ if (!child)
60
+ return null;
61
+ const params = [this.clone(item)];
62
+ if (n.index)
63
+ params.push(t.identifier(n.index));
64
+ return [t.callExpression(t.memberExpression(this.clone(n.iterable), t.identifier('map')), [t.arrowFunctionExpression(params, child)])];
65
+ }
66
+ case 'element': {
67
+ const e = this.element(n);
68
+ return e ? [e] : null;
69
+ }
70
+ default:
71
+ return null;
72
+ }
73
+ }
74
+ children(list) {
75
+ const out = [];
76
+ for (const c of list) {
77
+ const v = this.vnodes(c);
78
+ if (!v)
79
+ return null;
80
+ out.push(...v);
81
+ }
82
+ return out;
83
+ }
84
+ element(n) {
85
+ if (n.motion || n.portal || n.tag.includes('.'))
86
+ return null;
87
+ const props = this.propsOf(n.attrs, !!n.component);
88
+ if (!props)
89
+ return null;
90
+ const kids = this.children(n.children);
91
+ if (!kids)
92
+ return null;
93
+ const type = n.component ? t.identifier(n.tag) : t.stringLiteral(n.tag);
94
+ const args = [type];
95
+ if (props.properties.length || kids.length)
96
+ args.push(props.properties.length ? props : t.nullLiteral());
97
+ // a component takes its children as the default slot; an element as its own children
98
+ if (kids.length)
99
+ args.push(n.component ? t.objectExpression([t.objectProperty(t.identifier('default'), t.arrowFunctionExpression([], t.arrayExpression(kids)))]) : t.arrayExpression(kids));
100
+ return h(args);
101
+ }
102
+ propsOf(attrs, component) {
103
+ const out = [];
104
+ for (const a of attrs) {
105
+ switch (a.kind) {
106
+ case 'static':
107
+ out.push(t.objectProperty(key(a.name), t.stringLiteral(a.value)));
108
+ break;
109
+ case 'bool':
110
+ out.push(t.objectProperty(key(a.name), t.booleanLiteral(true)));
111
+ break;
112
+ case 'expr':
113
+ out.push(t.objectProperty(key(a.name), this.clone(a.expr)));
114
+ break;
115
+ case 'spread':
116
+ out.push(t.spreadElement(this.clone(a.expr)));
117
+ break;
118
+ case 'event': {
119
+ if (component) {
120
+ out.push(t.objectProperty(key(`${a.react}${a.capture && !a.react.endsWith('Capture') ? 'Capture' : ''}`), this.clone(a.handler)));
121
+ break;
122
+ }
123
+ // an element listens to the DOM event React's handler stands for (`onChange` on a text field is `input`,
124
+ // `onDoubleClick` is `dblclick`), focus bubbling and wheel and touch passive as React's (targets/vue/events)
125
+ const { event, passive } = vueDomEvent(a.name);
126
+ out.push(t.objectProperty(key(`on${event.charAt(0).toUpperCase()}${event.slice(1)}${passive ? 'Passive' : ''}${a.capture ? 'Capture' : ''}`), this.clone(a.handler)));
127
+ break;
128
+ }
129
+ case 'style': {
130
+ // a style string, or an object of values that are strings: the same in Vue. A number written as a literal
131
+ // takes React's unit here (`fontSize: 11` is '11px', `fontWeight: 600` stays 600); any other number would
132
+ // need a unit chosen at run time, which has no form here
133
+ const e = a.expr;
134
+ if (t.isStringLiteral(e)) {
135
+ out.push(t.objectProperty(t.identifier('style'), this.clone(e)));
136
+ break;
137
+ }
138
+ if (!t.isObjectExpression(e))
139
+ return null;
140
+ const style = [];
141
+ for (const p of e.properties) {
142
+ const name = t.isObjectProperty(p) ? styleKey(p) : null;
143
+ if (!t.isObjectProperty(p) || name === null || !t.isExpression(p.value))
144
+ return null;
145
+ const n = numericLiteral(p.value);
146
+ const value = n !== null ? reactStyleValue(name, n) : isStringy(p.value) ? this.clone(p.value) : null;
147
+ if (value === null)
148
+ return null;
149
+ const literal = (v) => (v < 0 ? t.unaryExpression('-', t.numericLiteral(-v)) : t.numericLiteral(v));
150
+ style.push(t.objectProperty(key(name), typeof value === 'number' ? literal(value) : typeof value === 'string' ? t.stringLiteral(value) : value));
151
+ }
152
+ out.push(t.objectProperty(t.identifier('style'), t.objectExpression(style)));
153
+ break;
154
+ }
155
+ default:
156
+ return null;
157
+ }
158
+ }
159
+ return t.objectExpression(out);
160
+ }
161
+ }
162
+ /**
163
+ * A module function kept as code that returns markup (`export function renderIcon(icon, size): ReactNode`, exported for
164
+ * other files, or read by other module code) as Vue writes markup held as a value: each element it returns is a
165
+ * functional component (`() => h(Icon, { size })`), and React's element test (`isValidElement(x)`) is the test for one
166
+ * (`typeof x === 'function'`). The function keeps its parameters, so the files that import it call it as before, and a
167
+ * template renders what it returns as markup (`<component :is>`), as a value React's types say may be an element.
168
+ * Null (the statement stays, and is reported) when the function builds elements anywhere but in what it returns (a
169
+ * nested function, a local, an argument), or an element has no exact `h()` form here (see RenderCallWriter).
170
+ * `elementTest` says whether a callee is React's `isValidElement`.
171
+ */
172
+ export function renderHelperValue(stmt, elementTest) {
173
+ const copy = t.cloneNode(stmt, true);
174
+ const decl = t.isExportNamedDeclaration(copy) ? copy.declaration : copy;
175
+ let fn = null;
176
+ if (t.isFunctionDeclaration(decl))
177
+ fn = decl;
178
+ else if (t.isVariableDeclaration(decl) && decl.kind === 'const' && decl.declarations.length === 1) {
179
+ let init = decl.declarations[0]?.init;
180
+ while (init && (t.isTSAsExpression(init) || t.isTSSatisfiesExpression(init) || t.isParenthesizedExpression(init)))
181
+ init = init.expression;
182
+ if (t.isArrowFunctionExpression(init) || t.isFunctionExpression(init))
183
+ fn = init;
184
+ }
185
+ if (!fn || fn.async || fn.generator || !containsJSX(fn.body))
186
+ return null;
187
+ // `h` is Vue's: a name of the function's own that is `h` (a height parameter) would hide it
188
+ let ownH = false;
189
+ t.traverseFast(fn, (n) => {
190
+ if (t.isIdentifier(n, { name: 'h' }))
191
+ ownH = true;
192
+ });
193
+ if (ownH)
194
+ return null;
195
+ const writer = new RenderCallWriter();
196
+ if (t.isExpression(fn.body)) {
197
+ const body = writer.value(fn.body);
198
+ if (!body)
199
+ return null;
200
+ fn.body = body;
201
+ }
202
+ else {
203
+ // the function's own returns (a nested function's are its own)
204
+ const returns = [];
205
+ const find = (n) => {
206
+ if (t.isFunction(n) || t.isClass(n))
207
+ return;
208
+ if (t.isReturnStatement(n))
209
+ returns.push(n);
210
+ for (const key of t.VISITOR_KEYS[n.type] ?? []) {
211
+ const child = Reflect.get(n, key);
212
+ for (const c of Array.isArray(child) ? child : [child])
213
+ if (t.isNode(c))
214
+ find(c);
215
+ }
216
+ };
217
+ for (const s of fn.body.body)
218
+ find(s);
219
+ for (const r of returns) {
220
+ if (!r.argument)
221
+ continue;
222
+ const value = writer.value(r.argument);
223
+ if (!value)
224
+ return null;
225
+ r.argument = value;
226
+ }
227
+ }
228
+ if (containsJSX(fn))
229
+ return null;
230
+ // React's element test, on a value this function hands back as markup: a functional component is a function
231
+ const tests = (n) => {
232
+ for (const key of t.VISITOR_KEYS[n.type] ?? []) {
233
+ const child = Reflect.get(n, key);
234
+ const list = Array.isArray(child) ? child : [child];
235
+ list.forEach((c, i) => {
236
+ if (!t.isNode(c))
237
+ return;
238
+ const arg = t.isCallExpression(c) && c.arguments.length === 1 && elementTest(c.callee) ? c.arguments[0] : undefined;
239
+ const swapped = arg && t.isExpression(arg) ? t.binaryExpression('===', t.unaryExpression('typeof', arg), t.stringLiteral('function')) : c;
240
+ if (Array.isArray(child))
241
+ child[i] = swapped;
242
+ else
243
+ Reflect.set(n, key, swapped);
244
+ tests(swapped);
245
+ });
246
+ }
247
+ };
248
+ tests(fn);
249
+ return copy;
250
+ }
251
+ /**
252
+ * Markup a module function returns, written with `h()`: elements with attributes whose browser name is known (React's
253
+ * names mapped as templates map them), standard DOM events, a style string, components with plain props, text and
254
+ * literal children. Anything else (a ref, a style object, an expression child whose value may itself be markup, an
255
+ * element inside an argument) has no exact form here: null.
256
+ */
257
+ class RenderCallWriter {
258
+ /** A returned value: each element in it (through choices) becomes a functional component; null when one cannot. */
259
+ value(e) {
260
+ if (t.isJSXElement(e) || t.isJSXFragment(e)) {
261
+ const body = this.node(e);
262
+ return body ? t.arrowFunctionExpression([], body) : null;
263
+ }
264
+ if (t.isParenthesizedExpression(e))
265
+ return this.value(e.expression);
266
+ if (t.isConditionalExpression(e)) {
267
+ if (containsJSX(e.test))
268
+ return null;
269
+ const yes = this.value(e.consequent);
270
+ const no = this.value(e.alternate);
271
+ return yes && no ? t.conditionalExpression(e.test, yes, no) : null;
272
+ }
273
+ if (t.isLogicalExpression(e)) {
274
+ const left = this.value(e.left);
275
+ const right = this.value(e.right);
276
+ return left && right ? t.logicalExpression(e.operator, left, right) : null;
277
+ }
278
+ return containsJSX(e) ? null : e;
279
+ }
280
+ node(e) {
281
+ const kids = this.children(t.react.buildChildren(e));
282
+ if (!kids)
283
+ return null;
284
+ if (t.isJSXFragment(e))
285
+ return t.arrayExpression(kids);
286
+ const name = e.openingElement.name;
287
+ if (!t.isJSXIdentifier(name))
288
+ return null;
289
+ const component = /^[A-Z_$]/.test(name.name);
290
+ const props = this.props(e.openingElement.attributes, component, name.name);
291
+ if (!props)
292
+ return null;
293
+ const args = [component ? t.identifier(name.name) : t.stringLiteral(name.name)];
294
+ if (props.properties.length || kids.length)
295
+ args.push(props.properties.length ? props : t.nullLiteral());
296
+ // a component takes its children as the default slot; an element as its own children
297
+ if (kids.length)
298
+ args.push(component ? t.objectExpression([t.objectProperty(t.identifier('default'), t.arrowFunctionExpression([], t.arrayExpression(kids)))]) : t.arrayExpression(kids));
299
+ return h(args);
300
+ }
301
+ children(list) {
302
+ const out = [];
303
+ for (const c of list) {
304
+ if (t.isJSXElement(c) || t.isJSXFragment(c)) {
305
+ const v = this.node(c);
306
+ if (!v)
307
+ return null;
308
+ out.push(v);
309
+ }
310
+ else if (t.isStringLiteral(c) || t.isNumericLiteral(c) || (t.isTemplateLiteral(c) && !containsJSX(c)))
311
+ out.push(c);
312
+ // any other value may be markup held as a value, which `h()` children would print as text
313
+ else
314
+ return null;
315
+ }
316
+ return out;
317
+ }
318
+ props(attrs, component, tag) {
319
+ const out = [];
320
+ for (const a of attrs) {
321
+ if (!t.isJSXAttribute(a) || !t.isJSXIdentifier(a.name))
322
+ return null;
323
+ const react = a.name.name;
324
+ if (react === 'ref' || react === 'dangerouslySetInnerHTML' || react === 'suppressHydrationWarning' || react === 'children')
325
+ return null;
326
+ const v = a.value;
327
+ const value = v === null || v === undefined ? t.booleanLiteral(true) : t.isStringLiteral(v) ? v : t.isJSXExpressionContainer(v) && t.isExpression(v.expression) && !containsJSX(v.expression) ? v.expression : null;
328
+ if (!value)
329
+ return null;
330
+ // a component's props pass as written; its class and style are the element's, which this form does not merge
331
+ if (component) {
332
+ if (react === 'className' || react === 'style' || react === 'key')
333
+ return null;
334
+ out.push(t.objectProperty(key(react), value, false, t.isIdentifier(value, { name: react })));
335
+ continue;
336
+ }
337
+ if (react === 'style' && !t.isStringLiteral(value))
338
+ return null;
339
+ if (/^on[A-Z]/.test(react)) {
340
+ if (!isDomEventProp(react) || !t.isExpression(value))
341
+ return null;
342
+ // React's onFocus / onBlur bubble and its wheel and touch listeners are passive (targets/vue/events)
343
+ const { event, passive } = vueDomEvent(domEventName(react, tag, attrs));
344
+ out.push(t.objectProperty(key(`on${event.charAt(0).toUpperCase()}${event.slice(1)}${passive ? 'Passive' : ''}`), value));
345
+ continue;
346
+ }
347
+ const name = domAttributeName(react);
348
+ // a name React passes on as written is lower case (`role`, `aria-hidden`), or SVG's own (`viewBox`)
349
+ if (name === react && /[A-Z]/.test(react) && !SVG_CASED.has(react))
350
+ return null;
351
+ out.push(t.objectProperty(key(name), value));
352
+ }
353
+ return t.objectExpression(out);
354
+ }
355
+ }
356
+ /** SVG attributes the browser takes in camel case, as React writes them. */
357
+ const SVG_CASED = new Set(['viewBox', 'preserveAspectRatio', 'gradientUnits', 'gradientTransform', 'patternUnits', 'patternContentUnits', 'patternTransform', 'clipPathUnits', 'maskUnits', 'maskContentUnits', 'markerWidth', 'markerHeight', 'markerUnits', 'refX', 'refY', 'stdDeviation', 'pathLength', 'textLength', 'lengthAdjust', 'spreadMethod', 'startOffset', 'filterUnits', 'primitiveUnits', 'baseFrequency', 'numOctaves', 'kernelMatrix', 'tableValues', 'viewTarget']);
@@ -0,0 +1,9 @@
1
+ import type { EmittedFile } from '../../types.js';
2
+ /** The helper file a Vue conversion writes once when a component renders Radix's Slot (ir/as-child). */
3
+ export declare const VUE_SLOT_FILE = "slot.ts";
4
+ /** The component it exports. */
5
+ export declare const VUE_SLOT = "Slot";
6
+ /** Marks the conversion (keyed by its diagnostics list, as the Svelte motion helper is) as needing the file. */
7
+ export declare function useVueSlot(conversion: object): void;
8
+ /** The file, when a component of the conversion uses it. */
9
+ export declare function vueSlotFiles(conversion: object, path: string): EmittedFile[];
@@ -0,0 +1,57 @@
1
+ /** The helper file a Vue conversion writes once when a component renders Radix's Slot (ir/as-child). */
2
+ export const VUE_SLOT_FILE = 'slot.ts';
3
+ /** The component it exports. */
4
+ export const VUE_SLOT = 'Slot';
5
+ const used = new WeakSet();
6
+ /** Marks the conversion (keyed by its diagnostics list, as the Svelte motion helper is) as needing the file. */
7
+ export function useVueSlot(conversion) {
8
+ used.add(conversion);
9
+ }
10
+ /** The file, when a component of the conversion uses it. */
11
+ export function vueSlotFiles(conversion, path) {
12
+ return used.has(conversion) ? [{ path, contents: VUE_SLOT_SOURCE, kind: 'module' }] : [];
13
+ }
14
+ /**
15
+ * Radix's Slot for Vue. Vue's own `cloneVNode(child, extra)` merges with `mergeProps(child.props, extra)`: class names
16
+ * joined, styles merged with `extra` winning, handlers both called (the child's first), any other key taken from
17
+ * `extra`. Radix lets the child win: so `extra` carries the slot's class and handlers as they are, its style under the
18
+ * child's (`[slot, child]`, the child's declarations last), and of the other attributes only those the child does not
19
+ * set itself.
20
+ */
21
+ const VUE_SLOT_SOURCE = `import { cloneVNode, Comment, defineComponent, Fragment, isVNode, Text, type VNode } from 'vue';
22
+
23
+ /** The nodes a slot renders, through fragments (\`v-for\`, \`<template>\`), without comments or blank text. */
24
+ function rendered(nodes: unknown[]): VNode[] {
25
+ return nodes.filter(isVNode).flatMap((node) => {
26
+ if (node.type === Fragment) return Array.isArray(node.children) ? rendered(node.children) : [];
27
+ if (node.type === Comment) return [];
28
+ if (node.type === Text && typeof node.children === 'string' && !node.children.trim()) return [];
29
+ return [node];
30
+ });
31
+ }
32
+
33
+ /**
34
+ * Radix's Slot (\`asChild\`): renders the one element it is given, with its own attributes merged on as Radix merges
35
+ * them. The element's own attributes win; class names are joined; styles are merged, the element's winning; a handler
36
+ * both set runs the element's first, then the slot's. Anything but one element renders nothing.
37
+ */
38
+ export const Slot = defineComponent({
39
+ name: 'Slot',
40
+ inheritAttrs: false,
41
+ setup(_, { attrs, slots }) {
42
+ return () => {
43
+ const nodes = rendered(slots.default?.() ?? []);
44
+ const child = nodes[0];
45
+ if (!child || nodes.length > 1 || child.type === Text) return null;
46
+ const own: Record<string, unknown> = child.props ?? {};
47
+ const extra: Record<string, unknown> = {};
48
+ for (const [key, value] of Object.entries(attrs)) {
49
+ if (key === 'class' || /^on[A-Z]/.test(key)) extra[key] = value;
50
+ else if (key === 'style') extra.style = [value, own.style];
51
+ else if (!(key in own)) extra[key] = value;
52
+ }
53
+ return cloneVNode(child, extra, true);
54
+ };
55
+ },
56
+ });
57
+ `;
@@ -0,0 +1,45 @@
1
+ import ts from 'typescript';
2
+ /**
3
+ * The package's own folder (the first one up from here with a node_modules): the virtual files sit in a folder inside
4
+ * it, so `vue`, `svelte`, `motion-v` and the rest resolve from its node_modules, offline.
5
+ */
6
+ export declare const MORPH_ROOT: string;
7
+ export declare const key: (p: string) => string;
8
+ /**
9
+ * The libraries of the project being compiled (its tsconfig's `lib`, read as the TypeOracle reads it): the output may
10
+ * call what its source could (`findLastIndex`), so the check knows the same library. Without a tsconfig or a `lib`,
11
+ * esnext with the DOM.
12
+ */
13
+ export declare function useProjectLib(root: string): void;
14
+ /** What a Vite + Vue or SvelteKit scaffold's tsconfig sets, strict, with no emit; the libraries are the project's. */
15
+ export declare function baseOptions(): ts.CompilerOptions;
16
+ /** Ambient declarations every bundler project has (Vite's client types): stylesheet imports. */
17
+ export declare const AMBIENT: string;
18
+ export declare function shareFile(path: string, text: string): void;
19
+ /**
20
+ * A compiler host over a virtual folder inside the package: files in `virtual` (absolute paths, forward slashes) are
21
+ * read from memory, the rest from disk. `scriptKind` picks how a virtual file is parsed (a .svelte file holds TS).
22
+ */
23
+ export declare function createVirtualHost(options: ts.CompilerOptions, root: string, virtual: Map<string, string>, scriptKind?: (file: string) => ts.ScriptKind | undefined, projectRoot?: string | null): ts.CompilerHost;
24
+ /**
25
+ * Resolves the bare imports of the checked files (`class-variance-authority`, `clsx`) where the compiled project's
26
+ * own code finds them: each virtual file stands where its source stands in the project (its path under `virtualRoot`
27
+ * is its path under `projectRoot`), so the lookup walks up from there through the project's node_modules, with the
28
+ * project's tsconfig `paths`. Only a package (a node_modules file) or a declaration file is taken: the project's own
29
+ * React sources are never part of the check. Undefined when the project does not have it (the caller falls back to
30
+ * the compiler's own copy).
31
+ */
32
+ export declare function projectModuleResolver(projectRoot: string, virtualRoot: string): (name: string, containingFile: string) => ts.ResolvedModuleFull | undefined;
33
+ /**
34
+ * Installs module resolution on a host: `special` first (a generated file, a shim), then the compiled project's own
35
+ * packages, then TypeScript's resolution from the virtual folder (the compiler's node_modules).
36
+ */
37
+ export declare function resolveWithProject(host: ts.CompilerHost, options: ts.CompilerOptions, root: string, projectRoot: string | null, special?: (name: string, containingFile: string) => ts.ResolvedModuleFull | undefined): void;
38
+ /** Offsets of the line starts of a text, for offset → line lookups. */
39
+ export declare function lineStarts(text: string): number[];
40
+ /** 0-based line and column of an offset. */
41
+ export declare function lineCol(starts: number[], offset: number): {
42
+ line: number;
43
+ col: number;
44
+ };
45
+ export declare function messageOf(d: ts.Diagnostic): string;