@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.
- package/LICENSE +21 -0
- package/README.md +266 -2
- package/SKILL.md +61 -0
- package/dist/ai/cli-provider.d.ts +80 -0
- package/dist/ai/cli-provider.js +250 -0
- package/dist/ai/gate.d.ts +39 -0
- package/dist/ai/gate.js +124 -0
- package/dist/ai/provider.d.ts +36 -0
- package/dist/ai/provider.js +168 -0
- package/dist/ai/repair.d.ts +90 -0
- package/dist/ai/repair.js +172 -0
- package/dist/analyzer/deps.d.ts +30 -0
- package/dist/analyzer/deps.js +265 -0
- package/dist/analyzer/manifest.d.ts +5 -0
- package/dist/analyzer/manifest.js +119 -0
- package/dist/analyzer/parse.d.ts +21 -0
- package/dist/analyzer/parse.js +29 -0
- package/dist/batch-worker.d.ts +16 -0
- package/dist/batch-worker.js +10 -0
- package/dist/batch.d.ts +26 -0
- package/dist/batch.js +227 -0
- package/dist/bridge/index.d.ts +26 -0
- package/dist/bridge/index.js +138 -0
- package/dist/bridge/props.d.ts +56 -0
- package/dist/bridge/props.js +191 -0
- package/dist/bridge/wrappers.d.ts +24 -0
- package/dist/bridge/wrappers.js +276 -0
- package/dist/cli/format.d.ts +7 -0
- package/dist/cli/format.js +30 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +492 -0
- package/dist/fonts/carry.d.ts +34 -0
- package/dist/fonts/carry.js +113 -0
- package/dist/fonts/fallback.d.ts +11 -0
- package/dist/fonts/fallback.js +21 -0
- package/dist/fonts/google.d.ts +65 -0
- package/dist/fonts/google.js +343 -0
- package/dist/fonts/index.d.ts +27 -0
- package/dist/fonts/index.js +48 -0
- package/dist/fonts/local.d.ts +46 -0
- package/dist/fonts/local.js +150 -0
- package/dist/fonts/sfnt.d.ts +19 -0
- package/dist/fonts/sfnt.js +174 -0
- package/dist/fonts/shim.d.ts +14 -0
- package/dist/fonts/shim.js +96 -0
- package/dist/gate.d.ts +105 -0
- package/dist/gate.js +157 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.js +74 -0
- package/dist/ir/annotate.d.ts +16 -0
- package/dist/ir/annotate.js +145 -0
- package/dist/ir/as-child.d.ts +18 -0
- package/dist/ir/as-child.js +239 -0
- package/dist/ir/compounds.d.ts +27 -0
- package/dist/ir/compounds.js +183 -0
- package/dist/ir/contexts.d.ts +26 -0
- package/dist/ir/contexts.js +185 -0
- package/dist/ir/dom.d.ts +11 -0
- package/dist/ir/dom.js +60 -0
- package/dist/ir/effect-returns.d.ts +10 -0
- package/dist/ir/effect-returns.js +25 -0
- package/dist/ir/extract-ui-types.d.ts +33 -0
- package/dist/ir/extract-ui-types.js +224 -0
- package/dist/ir/extract-ui.d.ts +34 -0
- package/dist/ir/extract-ui.js +567 -0
- package/dist/ir/falsy.d.ts +13 -0
- package/dist/ir/falsy.js +66 -0
- package/dist/ir/forward-refs.d.ts +11 -0
- package/dist/ir/forward-refs.js +155 -0
- package/dist/ir/fragment-source.d.ts +4 -0
- package/dist/ir/fragment-source.js +13 -0
- package/dist/ir/fragments.d.ts +32 -0
- package/dist/ir/fragments.js +192 -0
- package/dist/ir/helper-snippets.d.ts +30 -0
- package/dist/ir/helper-snippets.js +550 -0
- package/dist/ir/latest-refs.d.ts +11 -0
- package/dist/ir/latest-refs.js +187 -0
- package/dist/ir/live-args.d.ts +26 -0
- package/dist/ir/live-args.js +335 -0
- package/dist/ir/lower.d.ts +83 -0
- package/dist/ir/lower.js +6016 -0
- package/dist/ir/markup-values.d.ts +16 -0
- package/dist/ir/markup-values.js +188 -0
- package/dist/ir/model.d.ts +605 -0
- package/dist/ir/model.js +1 -0
- package/dist/ir/oracle.d.ts +91 -0
- package/dist/ir/oracle.js +610 -0
- package/dist/ir/radix.d.ts +122 -0
- package/dist/ir/radix.js +344 -0
- package/dist/ir/rename.d.ts +15 -0
- package/dist/ir/rename.js +151 -0
- package/dist/ir/render-props.d.ts +31 -0
- package/dist/ir/render-props.js +67 -0
- package/dist/ir/rewrite.d.ts +44 -0
- package/dist/ir/rewrite.js +381 -0
- package/dist/ir/running-index.d.ts +11 -0
- package/dist/ir/running-index.js +217 -0
- package/dist/ir/snapshots.d.ts +12 -0
- package/dist/ir/snapshots.js +140 -0
- package/dist/ir/style.d.ts +19 -0
- package/dist/ir/style.js +76 -0
- package/dist/ir/types.d.ts +42 -0
- package/dist/ir/types.js +271 -0
- package/dist/ir/walk.d.ts +11 -0
- package/dist/ir/walk.js +18 -0
- package/dist/mcp/server.d.ts +81 -0
- package/dist/mcp/server.js +518 -0
- package/dist/pipeline.d.ts +26 -0
- package/dist/pipeline.js +750 -0
- package/dist/registry/add.d.ts +91 -0
- package/dist/registry/add.js +273 -0
- package/dist/registry/fetch.d.ts +40 -0
- package/dist/registry/fetch.js +186 -0
- package/dist/registry/ip.d.ts +18 -0
- package/dist/registry/ip.js +153 -0
- package/dist/registry/item.d.ts +39 -0
- package/dist/registry/item.js +131 -0
- package/dist/registry/load.d.ts +35 -0
- package/dist/registry/load.js +106 -0
- package/dist/registry/paths.d.ts +8 -0
- package/dist/registry/paths.js +43 -0
- package/dist/registry/publish.d.ts +119 -0
- package/dist/registry/publish.js +439 -0
- package/dist/targets/angular/bank/bank.d.ts +39 -0
- package/dist/targets/angular/bank/bank.js +61 -0
- package/dist/targets/angular/bank/helpers.d.ts +64 -0
- package/dist/targets/angular/bank/helpers.js +246 -0
- package/dist/targets/angular/bank/kept.d.ts +98 -0
- package/dist/targets/angular/bank/kept.js +791 -0
- package/dist/targets/angular/bank/plan-helpers.d.ts +17 -0
- package/dist/targets/angular/bank/plan-helpers.js +286 -0
- package/dist/targets/angular/bank/plan.d.ts +22 -0
- package/dist/targets/angular/bank/plan.js +152 -0
- package/dist/targets/angular/bank/receivers.d.ts +66 -0
- package/dist/targets/angular/bank/receivers.js +293 -0
- package/dist/targets/angular/bank/runtime.d.ts +14 -0
- package/dist/targets/angular/bank/runtime.js +152 -0
- package/dist/targets/angular/controlled.d.ts +7 -0
- package/dist/targets/angular/controlled.js +37 -0
- package/dist/targets/angular/dynamic-tags.d.ts +34 -0
- package/dist/targets/angular/dynamic-tags.js +192 -0
- package/dist/targets/angular/emit.d.ts +41 -0
- package/dist/targets/angular/emit.js +5970 -0
- package/dist/targets/angular/exports.d.ts +48 -0
- package/dist/targets/angular/exports.js +243 -0
- package/dist/targets/angular/helpers.d.ts +15 -0
- package/dist/targets/angular/helpers.js +33 -0
- package/dist/targets/angular/host-boundary.d.ts +5 -0
- package/dist/targets/angular/host-boundary.js +166 -0
- package/dist/targets/angular/host-form.d.ts +150 -0
- package/dist/targets/angular/host-form.js +727 -0
- package/dist/targets/angular/markup-values.d.ts +58 -0
- package/dist/targets/angular/markup-values.js +661 -0
- package/dist/targets/angular/motion-directive.d.ts +12 -0
- package/dist/targets/angular/motion-directive.js +257 -0
- package/dist/targets/angular/motion-hooks.d.ts +73 -0
- package/dist/targets/angular/motion-hooks.js +293 -0
- package/dist/targets/angular/motion-layout.d.ts +14 -0
- package/dist/targets/angular/motion-layout.js +74 -0
- package/dist/targets/angular/motion-templates.d.ts +10 -0
- package/dist/targets/angular/motion-templates.js +65 -0
- package/dist/targets/angular/motion.d.ts +57 -0
- package/dist/targets/angular/motion.js +202 -0
- package/dist/targets/angular/narrowing.d.ts +24 -0
- package/dist/targets/angular/narrowing.js +205 -0
- package/dist/targets/angular/ngc.d.ts +23 -0
- package/dist/targets/angular/ngc.js +134 -0
- package/dist/targets/angular/passed-handle.d.ts +39 -0
- package/dist/targets/angular/passed-handle.js +154 -0
- package/dist/targets/angular/projected.d.ts +9 -0
- package/dist/targets/angular/projected.js +63 -0
- package/dist/targets/angular/radix/cores/alert-dialog.d.ts +13 -0
- package/dist/targets/angular/radix/cores/alert-dialog.js +388 -0
- package/dist/targets/angular/radix/cores/index.d.ts +17 -0
- package/dist/targets/angular/radix/cores/index.js +50 -0
- package/dist/targets/angular/radix/cores/slider.d.ts +8 -0
- package/dist/targets/angular/radix/cores/slider.js +202 -0
- package/dist/targets/angular/radix/index.d.ts +21 -0
- package/dist/targets/angular/radix/index.js +35 -0
- package/dist/targets/angular/radix/packages.d.ts +3 -0
- package/dist/targets/angular/radix/packages.js +558 -0
- package/dist/targets/angular/radix/part.d.ts +236 -0
- package/dist/targets/angular/radix/part.js +71 -0
- package/dist/targets/angular/radix/prepare.d.ts +66 -0
- package/dist/targets/angular/radix/prepare.js +548 -0
- package/dist/targets/angular/radix/template.d.ts +43 -0
- package/dist/targets/angular/radix/template.js +172 -0
- package/dist/targets/angular/refs.d.ts +68 -0
- package/dist/targets/angular/refs.js +443 -0
- package/dist/targets/angular/slots.d.ts +22 -0
- package/dist/targets/angular/slots.js +60 -0
- package/dist/targets/angular/source-types.d.ts +10 -0
- package/dist/targets/angular/source-types.js +45 -0
- package/dist/targets/angular/spread-forward.d.ts +24 -0
- package/dist/targets/angular/spread-forward.js +72 -0
- package/dist/targets/angular/spread.d.ts +32 -0
- package/dist/targets/angular/spread.js +182 -0
- package/dist/targets/angular/svg-hosts.d.ts +25 -0
- package/dist/targets/angular/svg-hosts.js +107 -0
- package/dist/targets/angular/template-expr.d.ts +36 -0
- package/dist/targets/angular/template-expr.js +287 -0
- package/dist/targets/angular/types.d.ts +9 -0
- package/dist/targets/angular/types.js +63 -0
- package/dist/targets/angular/walk.d.ts +11 -0
- package/dist/targets/angular/walk.js +26 -0
- package/dist/targets/react-native/emit.d.ts +14 -0
- package/dist/targets/react-native/emit.js +585 -0
- package/dist/targets/react-native/fidelity.d.ts +5 -0
- package/dist/targets/react-native/fidelity.js +43 -0
- package/dist/targets/react-native/motion.d.ts +10 -0
- package/dist/targets/react-native/motion.js +290 -0
- package/dist/targets/react-native/skia.d.ts +30 -0
- package/dist/targets/react-native/skia.js +358 -0
- package/dist/targets/shared/context.d.ts +47 -0
- package/dist/targets/shared/context.js +195 -0
- package/dist/targets/shared/foreign.d.ts +10 -0
- package/dist/targets/shared/foreign.js +72 -0
- package/dist/targets/shared/fragments.d.ts +21 -0
- package/dist/targets/shared/fragments.js +309 -0
- package/dist/targets/shared/handles.d.ts +65 -0
- package/dist/targets/shared/handles.js +299 -0
- package/dist/targets/shared/inline.d.ts +53 -0
- package/dist/targets/shared/inline.js +524 -0
- package/dist/targets/shared/layout.d.ts +70 -0
- package/dist/targets/shared/layout.js +224 -0
- package/dist/targets/shared/markup.d.ts +26 -0
- package/dist/targets/shared/markup.js +65 -0
- package/dist/targets/shared/module.d.ts +84 -0
- package/dist/targets/shared/module.js +468 -0
- package/dist/targets/shared/motion-hooks.d.ts +37 -0
- package/dist/targets/shared/motion-hooks.js +87 -0
- package/dist/targets/shared/motion-layout.d.ts +70 -0
- package/dist/targets/shared/motion-layout.js +392 -0
- package/dist/targets/shared/portal.d.ts +10 -0
- package/dist/targets/shared/portal.js +23 -0
- package/dist/targets/shared/prop-writes.d.ts +11 -0
- package/dist/targets/shared/prop-writes.js +32 -0
- package/dist/targets/shared/prune.d.ts +54 -0
- package/dist/targets/shared/prune.js +405 -0
- package/dist/targets/shared/react-libs.d.ts +25 -0
- package/dist/targets/shared/react-libs.js +142 -0
- package/dist/targets/shared/react-types.d.ts +16 -0
- package/dist/targets/shared/react-types.js +374 -0
- package/dist/targets/shared/react-values.d.ts +20 -0
- package/dist/targets/shared/react-values.js +145 -0
- package/dist/targets/shared/ref-callback.d.ts +16 -0
- package/dist/targets/shared/ref-callback.js +114 -0
- package/dist/targets/shared/script.d.ts +65 -0
- package/dist/targets/shared/script.js +406 -0
- package/dist/targets/shared/unused.d.ts +12 -0
- package/dist/targets/shared/unused.js +146 -0
- package/dist/targets/svelte/dom-spread.d.ts +27 -0
- package/dist/targets/svelte/dom-spread.js +146 -0
- package/dist/targets/svelte/emit.d.ts +15 -0
- package/dist/targets/svelte/emit.js +3784 -0
- package/dist/targets/svelte/handle-branches.d.ts +22 -0
- package/dist/targets/svelte/handle-branches.js +146 -0
- package/dist/targets/svelte/html-keys.d.ts +9 -0
- package/dist/targets/svelte/html-keys.js +40 -0
- package/dist/targets/svelte/markup-data/data.d.ts +51 -0
- package/dist/targets/svelte/markup-data/data.js +305 -0
- package/dist/targets/svelte/markup-data/helper.d.ts +12 -0
- package/dist/targets/svelte/markup-data/helper.js +81 -0
- package/dist/targets/svelte/markup-data/module-data.d.ts +21 -0
- package/dist/targets/svelte/markup-data/module-data.js +473 -0
- package/dist/targets/svelte/markup-data/sites.d.ts +52 -0
- package/dist/targets/svelte/markup-data/sites.js +303 -0
- package/dist/targets/svelte/motion-layout.d.ts +13 -0
- package/dist/targets/svelte/motion-layout.js +70 -0
- package/dist/targets/svelte/motion-table.d.ts +14 -0
- package/dist/targets/svelte/motion-table.js +308 -0
- package/dist/targets/svelte/motion.d.ts +46 -0
- package/dist/targets/svelte/motion.js +405 -0
- package/dist/targets/svelte/presence.d.ts +71 -0
- package/dist/targets/svelte/presence.js +318 -0
- package/dist/targets/svelte/radix/accordion.d.ts +9 -0
- package/dist/targets/svelte/radix/accordion.js +24 -0
- package/dist/targets/svelte/radix/aspect-ratio.d.ts +6 -0
- package/dist/targets/svelte/radix/aspect-ratio.js +8 -0
- package/dist/targets/svelte/radix/avatar.d.ts +6 -0
- package/dist/targets/svelte/radix/avatar.js +10 -0
- package/dist/targets/svelte/radix/checkbox.d.ts +10 -0
- package/dist/targets/svelte/radix/checkbox.js +24 -0
- package/dist/targets/svelte/radix/collapsible.d.ts +7 -0
- package/dist/targets/svelte/radix/collapsible.js +16 -0
- package/dist/targets/svelte/radix/context-menu.d.ts +8 -0
- package/dist/targets/svelte/radix/context-menu.js +49 -0
- package/dist/targets/svelte/radix/cores/alert-dialog.d.ts +17 -0
- package/dist/targets/svelte/radix/cores/alert-dialog.js +449 -0
- package/dist/targets/svelte/radix/cores/collapsible.d.ts +12 -0
- package/dist/targets/svelte/radix/cores/collapsible.js +214 -0
- package/dist/targets/svelte/radix/cores/core.d.ts +32 -0
- package/dist/targets/svelte/radix/cores/core.js +80 -0
- package/dist/targets/svelte/radix/cores/direction.d.ts +10 -0
- package/dist/targets/svelte/radix/cores/direction.js +64 -0
- package/dist/targets/svelte/radix/cores/index.d.ts +19 -0
- package/dist/targets/svelte/radix/cores/index.js +85 -0
- package/dist/targets/svelte/radix/cores/modal-layer.d.ts +11 -0
- package/dist/targets/svelte/radix/cores/modal-layer.js +244 -0
- package/dist/targets/svelte/radix/cores/presence.d.ts +12 -0
- package/dist/targets/svelte/radix/cores/presence.js +129 -0
- package/dist/targets/svelte/radix/cores/slider-logic.d.ts +10 -0
- package/dist/targets/svelte/radix/cores/slider-logic.js +287 -0
- package/dist/targets/svelte/radix/cores/slider.d.ts +13 -0
- package/dist/targets/svelte/radix/cores/slider.js +267 -0
- package/dist/targets/svelte/radix/dialog.d.ts +8 -0
- package/dist/targets/svelte/radix/dialog.js +20 -0
- package/dist/targets/svelte/radix/dropdown-menu.d.ts +9 -0
- package/dist/targets/svelte/radix/dropdown-menu.js +38 -0
- package/dist/targets/svelte/radix/emit.d.ts +12 -0
- package/dist/targets/svelte/radix/emit.js +1339 -0
- package/dist/targets/svelte/radix/hover-card.d.ts +7 -0
- package/dist/targets/svelte/radix/hover-card.js +22 -0
- package/dist/targets/svelte/radix/index.d.ts +12 -0
- package/dist/targets/svelte/radix/index.js +28 -0
- package/dist/targets/svelte/radix/label.d.ts +3 -0
- package/dist/targets/svelte/radix/label.js +5 -0
- package/dist/targets/svelte/radix/menubar.d.ts +7 -0
- package/dist/targets/svelte/radix/menubar.js +34 -0
- package/dist/targets/svelte/radix/navigation-menu.d.ts +8 -0
- package/dist/targets/svelte/radix/navigation-menu.js +25 -0
- package/dist/targets/svelte/radix/packages.d.ts +34 -0
- package/dist/targets/svelte/radix/packages.js +100 -0
- package/dist/targets/svelte/radix/part.d.ts +161 -0
- package/dist/targets/svelte/radix/part.js +85 -0
- package/dist/targets/svelte/radix/popover.d.ts +7 -0
- package/dist/targets/svelte/radix/popover.js +15 -0
- package/dist/targets/svelte/radix/progress.d.ts +11 -0
- package/dist/targets/svelte/radix/progress.js +27 -0
- package/dist/targets/svelte/radix/radio-group.d.ts +9 -0
- package/dist/targets/svelte/radix/radio-group.js +26 -0
- package/dist/targets/svelte/radix/scroll-area.d.ts +7 -0
- package/dist/targets/svelte/radix/scroll-area.js +19 -0
- package/dist/targets/svelte/radix/select.d.ts +13 -0
- package/dist/targets/svelte/radix/select.js +81 -0
- package/dist/targets/svelte/radix/separator.d.ts +3 -0
- package/dist/targets/svelte/radix/separator.js +5 -0
- package/dist/targets/svelte/radix/slider.d.ts +6 -0
- package/dist/targets/svelte/radix/slider.js +8 -0
- package/dist/targets/svelte/radix/switch.d.ts +6 -0
- package/dist/targets/svelte/radix/switch.js +10 -0
- package/dist/targets/svelte/radix/tabs.d.ts +8 -0
- package/dist/targets/svelte/radix/tabs.js +15 -0
- package/dist/targets/svelte/radix/toggle-group.d.ts +9 -0
- package/dist/targets/svelte/radix/toggle-group.js +17 -0
- package/dist/targets/svelte/radix/toggle.d.ts +6 -0
- package/dist/targets/svelte/radix/toggle.js +9 -0
- package/dist/targets/svelte/radix/tooltip.d.ts +6 -0
- package/dist/targets/svelte/radix/tooltip.js +24 -0
- package/dist/targets/svelte/strip.d.ts +2 -0
- package/dist/targets/svelte/strip.js +5 -0
- package/dist/targets/vue/emit.d.ts +15 -0
- package/dist/targets/vue/emit.js +4092 -0
- package/dist/targets/vue/events.d.ts +11 -0
- package/dist/targets/vue/events.js +13 -0
- package/dist/targets/vue/module-builders.d.ts +28 -0
- package/dist/targets/vue/module-builders.js +258 -0
- package/dist/targets/vue/motion-layout.d.ts +19 -0
- package/dist/targets/vue/motion-layout.js +79 -0
- package/dist/targets/vue/motion.d.ts +12 -0
- package/dist/targets/vue/motion.js +46 -0
- package/dist/targets/vue/radix/accordion.d.ts +3 -0
- package/dist/targets/vue/radix/accordion.js +12 -0
- package/dist/targets/vue/radix/alert-dialog.d.ts +6 -0
- package/dist/targets/vue/radix/alert-dialog.js +18 -0
- package/dist/targets/vue/radix/aspect-ratio.d.ts +6 -0
- package/dist/targets/vue/radix/aspect-ratio.js +8 -0
- package/dist/targets/vue/radix/avatar.d.ts +3 -0
- package/dist/targets/vue/radix/avatar.js +7 -0
- package/dist/targets/vue/radix/checkbox.d.ts +3 -0
- package/dist/targets/vue/radix/checkbox.js +9 -0
- package/dist/targets/vue/radix/collapsible.d.ts +7 -0
- package/dist/targets/vue/radix/collapsible.js +11 -0
- package/dist/targets/vue/radix/context-menu.d.ts +3 -0
- package/dist/targets/vue/radix/context-menu.js +30 -0
- package/dist/targets/vue/radix/dialog.d.ts +3 -0
- package/dist/targets/vue/radix/dialog.js +12 -0
- package/dist/targets/vue/radix/direction.d.ts +7 -0
- package/dist/targets/vue/radix/direction.js +9 -0
- package/dist/targets/vue/radix/dropdown-menu.d.ts +3 -0
- package/dist/targets/vue/radix/dropdown-menu.js +29 -0
- package/dist/targets/vue/radix/hover-card.d.ts +3 -0
- package/dist/targets/vue/radix/hover-card.js +11 -0
- package/dist/targets/vue/radix/index.d.ts +65 -0
- package/dist/targets/vue/radix/index.js +225 -0
- package/dist/targets/vue/radix/label.d.ts +3 -0
- package/dist/targets/vue/radix/label.js +5 -0
- package/dist/targets/vue/radix/menubar.d.ts +6 -0
- package/dist/targets/vue/radix/menubar.js +29 -0
- package/dist/targets/vue/radix/navigation-menu.d.ts +6 -0
- package/dist/targets/vue/radix/navigation-menu.js +21 -0
- package/dist/targets/vue/radix/part.d.ts +41 -0
- package/dist/targets/vue/radix/part.js +46 -0
- package/dist/targets/vue/radix/popover.d.ts +3 -0
- package/dist/targets/vue/radix/popover.js +11 -0
- package/dist/targets/vue/radix/progress.d.ts +3 -0
- package/dist/targets/vue/radix/progress.js +6 -0
- package/dist/targets/vue/radix/radio-group.d.ts +3 -0
- package/dist/targets/vue/radix/radio-group.js +10 -0
- package/dist/targets/vue/radix/scroll-area.d.ts +3 -0
- package/dist/targets/vue/radix/scroll-area.js +11 -0
- package/dist/targets/vue/radix/select.d.ts +3 -0
- package/dist/targets/vue/radix/select.js +29 -0
- package/dist/targets/vue/radix/separator.d.ts +3 -0
- package/dist/targets/vue/radix/separator.js +5 -0
- package/dist/targets/vue/radix/slider.d.ts +3 -0
- package/dist/targets/vue/radix/slider.js +13 -0
- package/dist/targets/vue/radix/switch.d.ts +3 -0
- package/dist/targets/vue/radix/switch.js +9 -0
- package/dist/targets/vue/radix/tabs.d.ts +3 -0
- package/dist/targets/vue/radix/tabs.js +12 -0
- package/dist/targets/vue/radix/toggle-group.d.ts +3 -0
- package/dist/targets/vue/radix/toggle-group.js +10 -0
- package/dist/targets/vue/radix/toggle.d.ts +3 -0
- package/dist/targets/vue/radix/toggle.js +8 -0
- package/dist/targets/vue/radix/tooltip.d.ts +3 -0
- package/dist/targets/vue/radix/tooltip.js +14 -0
- package/dist/targets/vue/render-fn/h.d.ts +52 -0
- package/dist/targets/vue/render-fn/h.js +442 -0
- package/dist/targets/vue/render-fn.d.ts +21 -0
- package/dist/targets/vue/render-fn.js +357 -0
- package/dist/targets/vue/slot.d.ts +9 -0
- package/dist/targets/vue/slot.js +57 -0
- package/dist/typecheck/host.d.ts +45 -0
- package/dist/typecheck/host.js +309 -0
- package/dist/typecheck/index.d.ts +16 -0
- package/dist/typecheck/index.js +17 -0
- package/dist/typecheck/lucide.d.ts +8 -0
- package/dist/typecheck/lucide.js +45 -0
- package/dist/typecheck/sourcemap.d.ts +9 -0
- package/dist/typecheck/sourcemap.js +54 -0
- package/dist/typecheck/svelte.d.ts +9 -0
- package/dist/typecheck/svelte.js +116 -0
- package/dist/typecheck/vue.d.ts +8 -0
- package/dist/typecheck/vue.js +78 -0
- package/dist/types.d.ts +446 -0
- package/dist/types.js +11 -0
- package/dist/utils/cleanup.d.ts +32 -0
- package/dist/utils/cleanup.js +119 -0
- package/dist/utils/errors.d.ts +7 -0
- package/dist/utils/errors.js +15 -0
- package/dist/utils/fs-safe.d.ts +14 -0
- package/dist/utils/fs-safe.js +64 -0
- package/dist/validate.d.ts +16 -0
- package/dist/validate.js +204 -0
- package/dist/verify/auto-steps.d.ts +107 -0
- package/dist/verify/auto-steps.js +471 -0
- package/dist/verify/bundle.d.ts +68 -0
- package/dist/verify/bundle.js +548 -0
- package/dist/verify/diff.d.ts +31 -0
- package/dist/verify/diff.js +133 -0
- package/dist/verify/leaks.d.ts +25 -0
- package/dist/verify/leaks.js +261 -0
- package/dist/verify/link-worker.d.ts +1 -0
- package/dist/verify/link-worker.js +27 -0
- package/dist/verify/runner.d.ts +57 -0
- package/dist/verify/runner.js +867 -0
- package/dist/verify/sandbox.d.ts +40 -0
- package/dist/verify/sandbox.js +496 -0
- package/dist/verify/steps.d.ts +42 -0
- package/dist/verify/steps.js +475 -0
- package/dist/verify/verdict.d.ts +15 -0
- package/dist/verify/verdict.js +19 -0
- package/package.json +118 -4
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
import type * as t from '@babel/types';
|
|
2
|
+
import type { Diagnostic, PropInfo } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* dom: attached to an element with `ref={x}`; value: a mutable box read and written through `.current`;
|
|
5
|
+
* either may `escape` (passed whole to a function, a child or returned), in which case targets keep an object.
|
|
6
|
+
*/
|
|
7
|
+
export type RefKind = 'dom' | 'value';
|
|
8
|
+
export type BindingKind = 'prop' | 'propsObject' | 'rest' | 'state' | 'setter' | 'reducer' | 'dispatch' | 'derived' | 'ref' | 'function' | 'id' | 'hook' | 'param';
|
|
9
|
+
export interface Binding {
|
|
10
|
+
name: string;
|
|
11
|
+
kind: BindingKind;
|
|
12
|
+
/** reads of this name follow reactive state (computed in Vue, $derived in Svelte) */
|
|
13
|
+
reactive: boolean;
|
|
14
|
+
refKind?: RefKind;
|
|
15
|
+
/** the ref object is passed whole somewhere, so it must stay an object */
|
|
16
|
+
escapes?: boolean;
|
|
17
|
+
/** for setters: the state they write */
|
|
18
|
+
state?: string;
|
|
19
|
+
/** for hook results: reactive in the hook's own signature (a ref in Vue, a getter in Svelte) */
|
|
20
|
+
fromHook?: string;
|
|
21
|
+
/** for useCallback functions: the dependencies React re-created it on, which an effect listing the function follows */
|
|
22
|
+
deps?: t.Expression[];
|
|
23
|
+
}
|
|
24
|
+
export interface PropDecl {
|
|
25
|
+
/** the prop's public name, as React callers pass it */
|
|
26
|
+
key: string;
|
|
27
|
+
/** the local name inside the component */
|
|
28
|
+
local: string;
|
|
29
|
+
defaultValue: t.Expression | null;
|
|
30
|
+
kind: PropInfo['kind'];
|
|
31
|
+
type: t.TSType | null;
|
|
32
|
+
optional: boolean;
|
|
33
|
+
/** destructured but not declared in the component's own interface (inherited HTML attributes) */
|
|
34
|
+
inherited: boolean;
|
|
35
|
+
/** the JSDoc comment above it in the interface */
|
|
36
|
+
doc: string | null;
|
|
37
|
+
/** a default made of markup (`icon = <Clock/>`): shown as the slot's fallback instead of a prop default */
|
|
38
|
+
templateDefault: t.Expression | null;
|
|
39
|
+
}
|
|
40
|
+
export interface CoreExtraction {
|
|
41
|
+
/** the function exported by the core module */
|
|
42
|
+
name: string;
|
|
43
|
+
/** the element ref passed as the first argument */
|
|
44
|
+
elementRef: string;
|
|
45
|
+
/** component bindings read inside the effect, passed in an options object */
|
|
46
|
+
inputs: string[];
|
|
47
|
+
/** setters called inside, passed as callbacks */
|
|
48
|
+
setters: string[];
|
|
49
|
+
/** value refs read or written inside, passed as `{ current }` boxes */
|
|
50
|
+
boxes: string[];
|
|
51
|
+
}
|
|
52
|
+
export type ScriptItem =
|
|
53
|
+
/** `typeFrom`: a source expression whose checked type is the state's (a store read typed by its snapshot), see pipeline */
|
|
54
|
+
{
|
|
55
|
+
kind: 'state';
|
|
56
|
+
name: string;
|
|
57
|
+
setter: string | null;
|
|
58
|
+
init: t.Expression | null;
|
|
59
|
+
type: t.TSType | null;
|
|
60
|
+
typeFrom?: t.Node;
|
|
61
|
+
} | {
|
|
62
|
+
kind: 'reducer';
|
|
63
|
+
name: string;
|
|
64
|
+
dispatch: string;
|
|
65
|
+
reducer: t.Expression;
|
|
66
|
+
init: t.Expression;
|
|
67
|
+
} | {
|
|
68
|
+
kind: 'ref';
|
|
69
|
+
name: string;
|
|
70
|
+
init: t.Expression | null;
|
|
71
|
+
type: t.TSType | null;
|
|
72
|
+
} | {
|
|
73
|
+
kind: 'derived';
|
|
74
|
+
id: t.LVal;
|
|
75
|
+
names: string[];
|
|
76
|
+
init: t.Expression;
|
|
77
|
+
memo: boolean;
|
|
78
|
+
type: t.TSType | null;
|
|
79
|
+
declKind: 'const' | 'let' | 'var'; /** a useMemo's dependency list */
|
|
80
|
+
deps?: t.Expression[];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* a value built by statements: either they end by returning it (`returns`), or they declare and mutate `name`.
|
|
84
|
+
* `members`: the statements compute several values of the component at once (`let a, b; if (…) { a = …; b = …; }`)
|
|
85
|
+
* and return them as one object (`return { a, b }`) named `name`; each member is declared right after the block as a
|
|
86
|
+
* derived value reading `name.member`.
|
|
87
|
+
*/
|
|
88
|
+
| {
|
|
89
|
+
kind: 'block';
|
|
90
|
+
name: string;
|
|
91
|
+
statements: t.Statement[];
|
|
92
|
+
type: t.TSType | null;
|
|
93
|
+
returns?: boolean;
|
|
94
|
+
members?: string[];
|
|
95
|
+
} | {
|
|
96
|
+
kind: 'function';
|
|
97
|
+
name: string;
|
|
98
|
+
node: t.FunctionDeclaration | t.ArrowFunctionExpression | t.FunctionExpression;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* `returnsExpression`: the callback was an expression (`() => stop`, `() => subscribe(fn)`), lowered as `return <it>`
|
|
102
|
+
* because its value may be the cleanup React runs; a pass with React's types (ir/effect-returns) keeps the return only
|
|
103
|
+
* when the value can be a function.
|
|
104
|
+
*/
|
|
105
|
+
| {
|
|
106
|
+
kind: 'effect';
|
|
107
|
+
phase: 'effect' | 'layout' | 'render';
|
|
108
|
+
deps: t.Expression[] | null;
|
|
109
|
+
body: t.BlockStatement;
|
|
110
|
+
core: CoreExtraction | null;
|
|
111
|
+
returnsExpression?: boolean;
|
|
112
|
+
} | {
|
|
113
|
+
kind: 'id';
|
|
114
|
+
name: string;
|
|
115
|
+
}
|
|
116
|
+
/** `live`: its arguments are passed live (see ir/live-args), so a target reads them where the hook uses them */
|
|
117
|
+
| {
|
|
118
|
+
kind: 'hook';
|
|
119
|
+
hook: string;
|
|
120
|
+
call: t.CallExpression;
|
|
121
|
+
id: t.LVal | null;
|
|
122
|
+
source: 'local' | 'motion';
|
|
123
|
+
live?: boolean; /** kept whole (`const ctl = useThing()`) while it returns reactive members */
|
|
124
|
+
wholeReactive?: boolean;
|
|
125
|
+
}
|
|
126
|
+
/** `guard`: a check that a provider is above (`if (!ctx) throw …`), which needs running only once, at setup */
|
|
127
|
+
| {
|
|
128
|
+
kind: 'statement';
|
|
129
|
+
node: t.Statement;
|
|
130
|
+
guard?: boolean;
|
|
131
|
+
}
|
|
132
|
+
/** useImperativeHandle: the methods a parent reaches through a ref (defineExpose in Vue, exports in Svelte) */
|
|
133
|
+
| {
|
|
134
|
+
kind: 'expose';
|
|
135
|
+
object: t.ObjectExpression;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* useImperativeHandle whose handle is not an object literal: a value (`() => api`), a spread (`({ ...base, x })`), a
|
|
139
|
+
* choice (`open ? a : b`) or a block that returns one. `members` are the names a parent can reach, null when the
|
|
140
|
+
* handle does not show them (its type may: `type`, the handle type written on the call, the factory or the ref).
|
|
141
|
+
*/
|
|
142
|
+
| {
|
|
143
|
+
kind: 'handle';
|
|
144
|
+
value: t.Expression | t.BlockStatement;
|
|
145
|
+
members: HandleMember[] | null;
|
|
146
|
+
type: t.TSType | null;
|
|
147
|
+
}
|
|
148
|
+
/** useImperativeHandle whose handle is one of the component's own element refs (`() => inputRef.current!`) */
|
|
149
|
+
| {
|
|
150
|
+
kind: 'forward';
|
|
151
|
+
ref: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* `useContext(Ctx)` / `use(Ctx)`: the value of the nearest provider above, or the context's default. `name` is the
|
|
155
|
+
* binding it declares (a made-up one when the call was destructured or read in an expression); `context` is the local
|
|
156
|
+
* name the call reads. Reads of `name` follow the provider's value as it changes (see targets/shared/context).
|
|
157
|
+
*/
|
|
158
|
+
| {
|
|
159
|
+
kind: 'context';
|
|
160
|
+
name: string;
|
|
161
|
+
context: string;
|
|
162
|
+
hook: 'useContext' | 'use';
|
|
163
|
+
call: t.CallExpression; /** a guard after it throws unless it holds a value (`if (!ctx) throw …`): later reads see it narrowed */
|
|
164
|
+
guarded?: boolean;
|
|
165
|
+
};
|
|
166
|
+
/** A member of an imperative handle a parent can reach. */
|
|
167
|
+
export interface HandleMember {
|
|
168
|
+
name: string;
|
|
169
|
+
/** every form of the handle has it (a choice between two literals may have it on one side only) */
|
|
170
|
+
always: boolean;
|
|
171
|
+
/** known to be a function (a method, an arrow, a function the component declares) */
|
|
172
|
+
fn: boolean;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* `const Ctx = createContext<T>(fallback)` at module level. The module statement stays in `moduleBody`; each target
|
|
176
|
+
* writes its own declaration in its place (a Vue InjectionKey, a Svelte typed context, an Angular InjectionToken).
|
|
177
|
+
*/
|
|
178
|
+
export interface ContextDecl {
|
|
179
|
+
name: string;
|
|
180
|
+
exported: boolean;
|
|
181
|
+
/** the value type as written (`createContext<T>`), or null when React infers it from the default */
|
|
182
|
+
type: t.TSType | null;
|
|
183
|
+
/** what a consumer with no provider above reads */
|
|
184
|
+
defaultValue: t.Expression;
|
|
185
|
+
/** the module statement that declares it */
|
|
186
|
+
statement: t.Statement;
|
|
187
|
+
}
|
|
188
|
+
/** A context a function reads or provides, resolved to its declaration (this module's or an imported one's). */
|
|
189
|
+
export interface ContextRef {
|
|
190
|
+
decl: ContextDecl;
|
|
191
|
+
/** the absolute source file that declares it */
|
|
192
|
+
file: string;
|
|
193
|
+
/** the name this module reads it by */
|
|
194
|
+
local: string;
|
|
195
|
+
}
|
|
196
|
+
/** `<Ctx.Provider value={v}>` (or React 19's `<Ctx value={v}>`) written as no element: the component provides `value`. */
|
|
197
|
+
export interface ProvideDecl {
|
|
198
|
+
context: ContextRef;
|
|
199
|
+
value: t.Expression;
|
|
200
|
+
/**
|
|
201
|
+
* the provider sits under conditions (`{spin ? art : <Ctx.Provider value={still}>{art}</Ctx.Provider>}`): the
|
|
202
|
+
* component provides `value` while `when` holds and the value from above otherwise. Set only for targets that print it.
|
|
203
|
+
*/
|
|
204
|
+
when?: t.Expression;
|
|
205
|
+
}
|
|
206
|
+
export type AttrNode = {
|
|
207
|
+
kind: 'static';
|
|
208
|
+
name: string;
|
|
209
|
+
value: string;
|
|
210
|
+
} | {
|
|
211
|
+
kind: 'expr';
|
|
212
|
+
name: string;
|
|
213
|
+
expr: t.Expression;
|
|
214
|
+
} | {
|
|
215
|
+
kind: 'bool';
|
|
216
|
+
name: string;
|
|
217
|
+
} | {
|
|
218
|
+
kind: 'spread';
|
|
219
|
+
expr: t.Expression;
|
|
220
|
+
} | {
|
|
221
|
+
kind: 'event';
|
|
222
|
+
name: string;
|
|
223
|
+
react: string;
|
|
224
|
+
capture: boolean;
|
|
225
|
+
handler: t.Expression;
|
|
226
|
+
} | {
|
|
227
|
+
kind: 'ref';
|
|
228
|
+
expr: t.Expression;
|
|
229
|
+
} | {
|
|
230
|
+
kind: 'style';
|
|
231
|
+
expr: t.Expression;
|
|
232
|
+
} | {
|
|
233
|
+
kind: 'html';
|
|
234
|
+
expr: t.Expression;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Markup passed to a component prop. `when`: the markup is passed only while it holds (`art={ink ? <Drawing/> :
|
|
238
|
+
* undefined}`): React passes undefined otherwise, and the component tests the prop. `render`: a render prop
|
|
239
|
+
* (`actions={(picked) => <Bar/>}`): `children` is its markup, reading the function's parameters (scoped slot props
|
|
240
|
+
* in Vue, snippet parameters in Svelte); the function node is kept for its parameters and their types.
|
|
241
|
+
*/
|
|
242
|
+
| {
|
|
243
|
+
kind: 'slotProp';
|
|
244
|
+
name: string;
|
|
245
|
+
children: TNode[];
|
|
246
|
+
when?: t.Expression;
|
|
247
|
+
render?: t.ArrowFunctionExpression | t.FunctionExpression;
|
|
248
|
+
};
|
|
249
|
+
export interface ElementNode {
|
|
250
|
+
type: 'element';
|
|
251
|
+
tag: string;
|
|
252
|
+
component: boolean;
|
|
253
|
+
/** `motion.div` and friends: the plain tag in `tag`, Framer props in `motion` */
|
|
254
|
+
motion: Record<string, t.Expression> | null;
|
|
255
|
+
attrs: AttrNode[];
|
|
256
|
+
children: TNode[];
|
|
257
|
+
/**
|
|
258
|
+
* `createPortal(children, container)`: no element of its own (`tag` is 'portal', `attrs` empty). Its children render
|
|
259
|
+
* under `container` (an element, `document.body`) instead of in place, and leave it when the component unmounts or
|
|
260
|
+
* the condition around them turns false. Vue: `<Teleport>`; Svelte: an attachment that moves them and removes them.
|
|
261
|
+
*/
|
|
262
|
+
portal?: t.Expression;
|
|
263
|
+
/**
|
|
264
|
+
* Radix's Slot (`const Comp = asChild ? Slot.Root : 'button'; <Comp …/>`, see ir/as-child): while this holds, the
|
|
265
|
+
* element (`tag`) is not rendered; the one element the component is given as children is, with this element's
|
|
266
|
+
* attributes merged onto it as Radix merges them (its own attributes win, class names joined, styles merged with its
|
|
267
|
+
* own winning, a handler both have runs its own first). Vue: a Slot helper; Svelte: a `child` snippet the caller
|
|
268
|
+
* passes, given the attributes as `props`.
|
|
269
|
+
*/
|
|
270
|
+
asChild?: t.Expression;
|
|
271
|
+
}
|
|
272
|
+
export type TNode = ElementNode | {
|
|
273
|
+
type: 'text';
|
|
274
|
+
value: string;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* `markup`: the value may be markup held as a value (a React element in data: a snippet in Svelte, a functional
|
|
278
|
+
* component in Vue), set by ir/markup-values from React's types; it renders as markup, the rest of it as text.
|
|
279
|
+
* `'element'`: a branch that React's `isValidElement` test chose holds it, so it is only ever markup there
|
|
280
|
+
*/
|
|
281
|
+
| {
|
|
282
|
+
type: 'expr';
|
|
283
|
+
expr: t.Expression;
|
|
284
|
+
markup?: boolean | 'element';
|
|
285
|
+
/**
|
|
286
|
+
* the id of the `expression` entry of the component's `keptMarkup` when this value reads markup held by a render
|
|
287
|
+
* helper or a value as a value (`{cell(r, c)}`, reported as jsx-in-script): every target prints the node as before,
|
|
288
|
+
* a target that can render such a value renders the entry instead
|
|
289
|
+
*/
|
|
290
|
+
kept?: string;
|
|
291
|
+
} | {
|
|
292
|
+
type: 'if';
|
|
293
|
+
branches: {
|
|
294
|
+
test: t.Expression | null;
|
|
295
|
+
children: TNode[];
|
|
296
|
+
}[];
|
|
297
|
+
/**
|
|
298
|
+
* `{count && <Badge/>}`: React renders the first test's own value when it is falsy and a number (`0`, `NaN`). Set by
|
|
299
|
+
* lowering when the test may be a number; ir/falsy turns it into a branch that renders the number (or drops it when
|
|
300
|
+
* the type checker shows the test is never one) before any target sees the template.
|
|
301
|
+
*/
|
|
302
|
+
rendersFalsy?: boolean;
|
|
303
|
+
} | {
|
|
304
|
+
type: 'for';
|
|
305
|
+
iterable: t.Expression;
|
|
306
|
+
item: t.LVal | null;
|
|
307
|
+
index: string | null;
|
|
308
|
+
key: t.Expression | null;
|
|
309
|
+
locals: t.VariableDeclaration[];
|
|
310
|
+
children: TNode[];
|
|
311
|
+
}
|
|
312
|
+
/** a prop's markup rendered; `args`: a render prop called with them (`{actions(picked)}`, see ir/render-props) */
|
|
313
|
+
| {
|
|
314
|
+
type: 'slot';
|
|
315
|
+
name: string;
|
|
316
|
+
prop: string;
|
|
317
|
+
fallback: TNode[];
|
|
318
|
+
args?: t.Expression[];
|
|
319
|
+
} | {
|
|
320
|
+
type: 'fragment';
|
|
321
|
+
children: TNode[];
|
|
322
|
+
} | {
|
|
323
|
+
type: 'keyed';
|
|
324
|
+
key: t.Expression;
|
|
325
|
+
children: TNode[];
|
|
326
|
+
} | {
|
|
327
|
+
type: 'presence';
|
|
328
|
+
attrs: AttrNode[];
|
|
329
|
+
children: TNode[];
|
|
330
|
+
}
|
|
331
|
+
/** a call of a render helper written once as a fragment (see FragmentDef), with the values it passes */
|
|
332
|
+
| {
|
|
333
|
+
type: 'render';
|
|
334
|
+
name: string;
|
|
335
|
+
args: t.Expression[];
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* something the compiler could not convert: printed as a comment, reported as an error. `kept`: the id of the
|
|
339
|
+
* `expression` entry of the component's `keptMarkup` that holds the markup React renders here (`{(() => { … return
|
|
340
|
+
* <b/>; })()}`); `value`: the name rendered where the template renders a value script code builds out of elements
|
|
341
|
+
* (a `value` entry of `keptMarkup`). Both are plain strings, so code that walks the template sees no source node
|
|
342
|
+
* here; the entry is looked up in the component that owns the template (an inlined private component's node finds
|
|
343
|
+
* nothing in its host and stays unconverted).
|
|
344
|
+
*/
|
|
345
|
+
| {
|
|
346
|
+
type: 'unconverted';
|
|
347
|
+
reason: string;
|
|
348
|
+
kept?: string;
|
|
349
|
+
value?: string;
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* Code of a component that builds elements where a template has no form for it, kept as React wrote it so a target that
|
|
353
|
+
* can hold elements as values (Vue render functions, Svelte data, Angular templates) can write it. Lowering leaves it
|
|
354
|
+
* out of `items` and reports it with `diagnostic` (an error) exactly as before; every target that does not write it
|
|
355
|
+
* keeps that error. A target that writes it removes that very object from its diagnostics list
|
|
356
|
+
* (`ctx.diagnostics.indexOf(kept.diagnostic)`: the pipeline passes the IR's own diagnostic objects).
|
|
357
|
+
*
|
|
358
|
+
* The code is the source's own nodes, not copies: its identifiers keep their `refs` entries (a target rewrites state
|
|
359
|
+
* reads and setter calls through them) and the JSX keeps its `loc` (for TypeOracle questions).
|
|
360
|
+
*
|
|
361
|
+
* - `value`: a value built out of elements (`const rows = []; for (…) rows.push(<li/>)`, a memo or function that returns
|
|
362
|
+
* markup and is read as a value): the item lowering would have written (`block`, `derived` or `function`), declaring
|
|
363
|
+
* `names`. The names keep their `bindings` as before; `reactive` says whether the code reads reactive state, worked
|
|
364
|
+
* out as for a block (`computeReactivity`), stored here so the bindings stay exactly as other targets see them.
|
|
365
|
+
* - `statement`: a statement of the render body that builds elements and declares no value (`if (…) { …; return
|
|
366
|
+
* <button/>; }`, a loop pushing elements into a value declared above it).
|
|
367
|
+
* - `expression`: markup the template renders in a place it has no form for (jsx-in-expression): `expr` as React wrote
|
|
368
|
+
* it (parentheses and TS casts unwrapped); the template's `unconverted` node names it by `id`.
|
|
369
|
+
*
|
|
370
|
+
* `after`: the item of `items` it followed in the source once lowering is done (null: it comes first), so a target can
|
|
371
|
+
* put it back in place.
|
|
372
|
+
*/
|
|
373
|
+
export type KeptMarkup = {
|
|
374
|
+
kind: 'value';
|
|
375
|
+
item: Extract<ScriptItem, {
|
|
376
|
+
kind: 'block' | 'derived' | 'function';
|
|
377
|
+
}>;
|
|
378
|
+
names: string[];
|
|
379
|
+
reactive: boolean;
|
|
380
|
+
after: ScriptItem | null;
|
|
381
|
+
diagnostic: Diagnostic;
|
|
382
|
+
/**
|
|
383
|
+
* A kept render helper's calls of the component's other render helpers that no template node calls (`cell`
|
|
384
|
+
* returning `<span>{quiet(r.value)}</span>`): lowering keeps them nowhere else, so a target that writes the helper
|
|
385
|
+
* writes these too, or does not write it. Transitive; absent when there are none.
|
|
386
|
+
*/
|
|
387
|
+
calls?: {
|
|
388
|
+
name: string;
|
|
389
|
+
node: t.ArrowFunctionExpression | t.FunctionExpression | t.FunctionDeclaration;
|
|
390
|
+
}[];
|
|
391
|
+
} | {
|
|
392
|
+
kind: 'statement';
|
|
393
|
+
node: t.Statement;
|
|
394
|
+
reactive: boolean;
|
|
395
|
+
after: ScriptItem | null;
|
|
396
|
+
diagnostic: Diagnostic;
|
|
397
|
+
} | {
|
|
398
|
+
kind: 'expression';
|
|
399
|
+
id: string;
|
|
400
|
+
expr: t.Expression;
|
|
401
|
+
reactive: boolean;
|
|
402
|
+
diagnostic: Diagnostic;
|
|
403
|
+
};
|
|
404
|
+
/**
|
|
405
|
+
* A render helper of a component, as markup with parameters: `const row = (step: Step, sub: boolean) => { const time =
|
|
406
|
+
* timeOf(step); return <div>…</div>; }`. Its markup reads its parameters, its own values and the component's bindings.
|
|
407
|
+
* The template renders it through `render` nodes: Svelte as a snippet (`{#snippet row(step, sub)}` and `{@render}`),
|
|
408
|
+
* Vue and Angular write its markup at each call with the arguments in place of the parameters.
|
|
409
|
+
*/
|
|
410
|
+
export interface FragmentDef {
|
|
411
|
+
name: string;
|
|
412
|
+
/** as written, with their types (`child?: Child`) */
|
|
413
|
+
params: t.Identifier[];
|
|
414
|
+
/** the values it declares before its markup, in order: one `const name = value` each */
|
|
415
|
+
locals: t.VariableDeclaration[];
|
|
416
|
+
template: TNode;
|
|
417
|
+
/** it renders itself, directly or through another fragment (a tree) */
|
|
418
|
+
recursive: boolean;
|
|
419
|
+
}
|
|
420
|
+
export interface FunctionIR {
|
|
421
|
+
/** a component: the line its function starts on in its source file (an error about the component points there) */
|
|
422
|
+
line?: number;
|
|
423
|
+
name: string;
|
|
424
|
+
file: string;
|
|
425
|
+
items: ScriptItem[];
|
|
426
|
+
bindings: Map<string, Binding>;
|
|
427
|
+
/** reference identifiers that resolve to this function's own bindings */
|
|
428
|
+
refs: WeakMap<t.Node, string>;
|
|
429
|
+
/** names of local functions in scope that write state (a call may change reactive values) */
|
|
430
|
+
diagnostics: Diagnostic[];
|
|
431
|
+
/** module-level names this function reads */
|
|
432
|
+
moduleNames: Set<string>;
|
|
433
|
+
/** a component's code that builds elements where a template has no form for it, in source order (see KeptMarkup) */
|
|
434
|
+
keptMarkup?: KeptMarkup[];
|
|
435
|
+
}
|
|
436
|
+
export interface ComponentIR extends FunctionIR {
|
|
437
|
+
type: 'component';
|
|
438
|
+
/**
|
|
439
|
+
* Markup a prop's data holds, written in the component's markup (`art={ink ? { list: draw(gem) } : undefined}`): the
|
|
440
|
+
* data holds each one's name instead (`{ list: artList }`). Svelte declares each as a snippet of the component's
|
|
441
|
+
* markup, Vue as a functional component of its setup; other targets report it. `moduleNames`: module names it reads.
|
|
442
|
+
*/
|
|
443
|
+
markupValues?: MarkupValue[];
|
|
444
|
+
exported: boolean;
|
|
445
|
+
isDefault: boolean;
|
|
446
|
+
propsStyle: 'destructured' | 'object' | 'none';
|
|
447
|
+
propsObject: string | null;
|
|
448
|
+
props: PropDecl[];
|
|
449
|
+
rest: string | null;
|
|
450
|
+
/** the props interface members the component declares itself, kept for the targets' own interfaces */
|
|
451
|
+
propsType: t.TSType | null;
|
|
452
|
+
propsTypeName: string | null;
|
|
453
|
+
/** every member the props type declares (destructured or not), from the component's own module */
|
|
454
|
+
declared: Map<string, {
|
|
455
|
+
type: t.TSType | null;
|
|
456
|
+
optional: boolean;
|
|
457
|
+
doc: string | null;
|
|
458
|
+
}>;
|
|
459
|
+
/** props types the module imports or cannot see into (kept as intersections by the targets) */
|
|
460
|
+
propsHeritage: t.TSType[];
|
|
461
|
+
/** 'button' when the props extend React.ButtonHTMLAttributes<HTMLButtonElement>, etc. */
|
|
462
|
+
/** `anyElement`: the attributes are written for any element (`HTMLAttributes<HTMLElement>`), not `element`'s own */
|
|
463
|
+
extendsHtml: {
|
|
464
|
+
react: string;
|
|
465
|
+
element: string;
|
|
466
|
+
anyElement?: boolean;
|
|
467
|
+
} | null;
|
|
468
|
+
forwardRef: string | null;
|
|
469
|
+
/** `function Select<T>(...)`: the component is generic */
|
|
470
|
+
typeParams: t.TSTypeParameterDeclaration | null;
|
|
471
|
+
template: TNode;
|
|
472
|
+
/** the render helpers its template calls with arguments, written once (see FragmentDef) */
|
|
473
|
+
fragments: FragmentDef[];
|
|
474
|
+
/** the contexts its markup provides (filled by ir/contexts once the graph is known), in markup order, outermost first */
|
|
475
|
+
provides: ProvideDecl[];
|
|
476
|
+
/** the type a parent's ref holds, when written (`forwardRef<Handle, Props>`, `ref: ForwardedRef<Handle>`, `ref?: Ref<Handle>`) */
|
|
477
|
+
handleType: t.TSType | null;
|
|
478
|
+
/**
|
|
479
|
+
* The prop that switches the component's Radix Slot on (`asChild`), when it renders one (ElementNode.asChild reads
|
|
480
|
+
* it): a caller in the same conversion that sets it passes its one child element to be merged (Svelte: as the
|
|
481
|
+
* `child` snippet).
|
|
482
|
+
*/
|
|
483
|
+
asChildProp?: string;
|
|
484
|
+
}
|
|
485
|
+
export interface HookIR extends FunctionIR {
|
|
486
|
+
type: 'hook';
|
|
487
|
+
exported: boolean;
|
|
488
|
+
params: t.Function['params'];
|
|
489
|
+
/** what the hook returns, keyed by name when it returns an object literal or an array */
|
|
490
|
+
returns: t.Expression | null;
|
|
491
|
+
returnShape: {
|
|
492
|
+
kind: 'object' | 'array' | 'value';
|
|
493
|
+
members: {
|
|
494
|
+
name: string;
|
|
495
|
+
reactive: boolean;
|
|
496
|
+
isRef: boolean;
|
|
497
|
+
}[];
|
|
498
|
+
};
|
|
499
|
+
typeParams: t.TSTypeParameterDeclaration | null;
|
|
500
|
+
returnType: t.TSType | null;
|
|
501
|
+
/** markup it returned among its values, moved to the components that render it (see HookMarkup) */
|
|
502
|
+
markupMembers?: HookMarkup[];
|
|
503
|
+
}
|
|
504
|
+
/** A source file, lowered: its components and hooks, and the module-level code left around them. */
|
|
505
|
+
export interface ModuleIR {
|
|
506
|
+
file: string;
|
|
507
|
+
/**
|
|
508
|
+
* React's type declarations the project compiles with are 19 or later: `RefObject<T>` is `{ current: T }` there
|
|
509
|
+
* (null only when T holds it); before 19 it is `{ readonly current: T | null }`. Unset when unknown.
|
|
510
|
+
*/
|
|
511
|
+
reactTypes19?: boolean;
|
|
512
|
+
components: ComponentIR[];
|
|
513
|
+
hooks: HookIR[];
|
|
514
|
+
/** top-level statements that are neither components nor hooks (imports excluded) */
|
|
515
|
+
moduleBody: t.Statement[];
|
|
516
|
+
imports: t.ImportDeclaration[];
|
|
517
|
+
/** `export { X } from` and `export * from` statements */
|
|
518
|
+
reexports: (t.ExportNamedDeclaration | t.ExportAllDeclaration)[];
|
|
519
|
+
/** names exported from this file */
|
|
520
|
+
exportedNames: Set<string>;
|
|
521
|
+
defaultExport: string | null;
|
|
522
|
+
diagnostics: Diagnostic[];
|
|
523
|
+
/** local names bound to framer-motion's `motion` */
|
|
524
|
+
motionNames: Set<string>;
|
|
525
|
+
/** module-level element constants, render helpers and maps of elements, inlined where components render them */
|
|
526
|
+
moduleJsx: ModuleJsx;
|
|
527
|
+
/**
|
|
528
|
+
* another name for a component of the file (`export const PrismSpillCard = PrismSpill`), by alias: the component's
|
|
529
|
+
* file is that name too, as a component file exports nothing but its component
|
|
530
|
+
*/
|
|
531
|
+
aliases: Map<string, string>;
|
|
532
|
+
/**
|
|
533
|
+
* Markup the module's data holds as values (`const TABS = [{ icon: <Layers size={14} /> }]`): the data holds each
|
|
534
|
+
* one's name instead. Svelte declares each as a top-level snippet of the main component (the module script reads
|
|
535
|
+
* it), Vue as a functional component (`() => h(Layers, { size: 14 })`). `moduleNames`: the module names it reads.
|
|
536
|
+
*/
|
|
537
|
+
markupValues?: MarkupValue[];
|
|
538
|
+
/**
|
|
539
|
+
* Module functions kept as code whose call has no effect but its value (no writes, no calls but to others like it):
|
|
540
|
+
* a template may read such a call more than once. Set by the pipeline (ir/markup-values pureModuleFunctions).
|
|
541
|
+
*/
|
|
542
|
+
pureFunctions?: Set<string>;
|
|
543
|
+
/**
|
|
544
|
+
* Svelte: the module's render helpers kept as code (exported, or called by another helper) as top-level snippets of
|
|
545
|
+
* the main component, exported from its module script, each with a predicate of the same arguments (`shows`, its
|
|
546
|
+
* name) that says whether the helper renders anything, as the helper's own empty returns decide (ir/helper-snippets).
|
|
547
|
+
*/
|
|
548
|
+
snippetHelpers?: {
|
|
549
|
+
defs: FragmentDef[];
|
|
550
|
+
exported: Set<string>;
|
|
551
|
+
shows: Map<string, {
|
|
552
|
+
name: string;
|
|
553
|
+
arity: number;
|
|
554
|
+
}>;
|
|
555
|
+
};
|
|
556
|
+
/** Svelte: why a helper kept as code that builds markup is not such a snippet, by name (its module-jsx error says so) */
|
|
557
|
+
snippetRefusals?: Map<string, string>;
|
|
558
|
+
/** `createContext` declarations at module level */
|
|
559
|
+
contexts: ContextDecl[];
|
|
560
|
+
/**
|
|
561
|
+
* compound components (`Object.assign(CardRoot, { Header })`, `Card.Header = Header`): root component → member →
|
|
562
|
+
* part component; the declarations leave the module body and `<Card.Header>` is the part (see ir/compounds)
|
|
563
|
+
*/
|
|
564
|
+
compounds?: Map<string, Map<string, string>>;
|
|
565
|
+
}
|
|
566
|
+
export interface ModuleJsx {
|
|
567
|
+
constants: Map<string, t.Expression>;
|
|
568
|
+
renderFns: Map<string, t.ArrowFunctionExpression | t.FunctionExpression | t.FunctionDeclaration>;
|
|
569
|
+
maps: Map<string, Map<string, t.Expression>>;
|
|
570
|
+
/**
|
|
571
|
+
* the maps that are arrays of elements (`const HAIR = [null, <path/>, <circle/>]`), keyed by position in `maps`, with
|
|
572
|
+
* their length: `HAIR[i % HAIR.length]` picks one by its index
|
|
573
|
+
*/
|
|
574
|
+
lists?: Map<string, number>;
|
|
575
|
+
/** every module-level name, so inlined markup can import what it uses */
|
|
576
|
+
moduleNames: Set<string>;
|
|
577
|
+
/** module-level `const` names bound to an object literal (`const ICONS = { … }`): reading a key of one cannot throw */
|
|
578
|
+
constObjects?: Set<string>;
|
|
579
|
+
}
|
|
580
|
+
/** One markup value of a module (see ModuleIR.markupValues). */
|
|
581
|
+
export interface MarkupValue {
|
|
582
|
+
name: string;
|
|
583
|
+
template: TNode;
|
|
584
|
+
moduleNames: string[];
|
|
585
|
+
}
|
|
586
|
+
/** A hook's public shape, as seen by its callers in other files. */
|
|
587
|
+
/**
|
|
588
|
+
* Markup a hook returned as one of its values (`input: <input type="hidden" … />`), moved out of the hook: `expr` is
|
|
589
|
+
* the markup as written, reading the hook's values by their names; `reads` gives the key each of them is returned
|
|
590
|
+
* under now (`committed` → `value`). A component writes it where it renders `{result.input}` (see lowering).
|
|
591
|
+
*/
|
|
592
|
+
export interface HookMarkup {
|
|
593
|
+
member: string;
|
|
594
|
+
expr: t.Expression;
|
|
595
|
+
reads: Map<string, string>;
|
|
596
|
+
}
|
|
597
|
+
export interface HookSignature {
|
|
598
|
+
name: string;
|
|
599
|
+
returnShape: HookIR['returnShape'];
|
|
600
|
+
file: string;
|
|
601
|
+
/** markup it returned, moved to where components render it */
|
|
602
|
+
markup?: HookMarkup[];
|
|
603
|
+
/** how it takes each parameter after ir/live-args */
|
|
604
|
+
params?: import('./live-args.js').ParamMode[];
|
|
605
|
+
}
|
package/dist/ir/model.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|