@yahoo/uds-v5-wip 0.0.1
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/dist/components/accordion.config.d.ts +2 -0
- package/dist/components/accordion.config.js +2 -0
- package/dist/components/accordion.d.ts +2 -0
- package/dist/components/accordion.js +2 -0
- package/dist/components/alert.config.d.ts +2 -0
- package/dist/components/alert.config.js +2 -0
- package/dist/components/alert.d.ts +2 -0
- package/dist/components/alert.js +2 -0
- package/dist/components/anchor.config.d.ts +2 -0
- package/dist/components/anchor.config.js +2 -0
- package/dist/components/anchor.d.ts +2 -0
- package/dist/components/anchor.js +2 -0
- package/dist/components/article.d.ts +2 -0
- package/dist/components/article.js +2 -0
- package/dist/components/aside.d.ts +2 -0
- package/dist/components/aside.js +2 -0
- package/dist/components/avatar-group.config.d.ts +2 -0
- package/dist/components/avatar-group.config.js +2 -0
- package/dist/components/avatar-group.d.ts +2 -0
- package/dist/components/avatar-group.js +2 -0
- package/dist/components/avatar.config.d.ts +2 -0
- package/dist/components/avatar.config.js +2 -0
- package/dist/components/avatar.d.ts +2 -0
- package/dist/components/avatar.js +2 -0
- package/dist/components/badge.config.d.ts +2 -0
- package/dist/components/badge.config.js +2 -0
- package/dist/components/badge.d.ts +2 -0
- package/dist/components/badge.js +2 -0
- package/dist/components/box.d.ts +2 -0
- package/dist/components/box.js +2 -0
- package/dist/components/breadcrumb.config.d.ts +2 -0
- package/dist/components/breadcrumb.config.js +2 -0
- package/dist/components/breadcrumb.d.ts +2 -0
- package/dist/components/breadcrumb.js +2 -0
- package/dist/components/button.config.d.ts +2 -0
- package/dist/components/button.config.js +2 -0
- package/dist/components/button.d.ts +2 -0
- package/dist/components/button.js +2 -0
- package/dist/components/card.config.d.ts +2 -0
- package/dist/components/card.config.js +2 -0
- package/dist/components/card.d.ts +2 -0
- package/dist/components/card.js +2 -0
- package/dist/components/collapsible.config.d.ts +2 -0
- package/dist/components/collapsible.config.js +2 -0
- package/dist/components/collapsible.d.ts +2 -0
- package/dist/components/collapsible.js +2 -0
- package/dist/components/command.config.d.ts +2 -0
- package/dist/components/command.config.js +2 -0
- package/dist/components/command.d.ts +2 -0
- package/dist/components/command.js +2 -0
- package/dist/components/control-color.config.d.ts +2 -0
- package/dist/components/control-color.config.js +2 -0
- package/dist/components/control-color.d.ts +2 -0
- package/dist/components/control-color.js +2 -0
- package/dist/components/control-curve.config.d.ts +2 -0
- package/dist/components/control-curve.config.js +2 -0
- package/dist/components/control-curve.d.ts +2 -0
- package/dist/components/control-curve.js +2 -0
- package/dist/components/control-folder.config.d.ts +2 -0
- package/dist/components/control-folder.config.js +2 -0
- package/dist/components/control-folder.d.ts +2 -0
- package/dist/components/control-folder.js +2 -0
- package/dist/components/control-group.config.d.ts +2 -0
- package/dist/components/control-group.config.js +2 -0
- package/dist/components/control-group.d.ts +2 -0
- package/dist/components/control-group.js +2 -0
- package/dist/components/control-knob.config.d.ts +2 -0
- package/dist/components/control-knob.config.js +2 -0
- package/dist/components/control-knob.d.ts +2 -0
- package/dist/components/control-knob.js +2 -0
- package/dist/components/control-panel.config.d.ts +2 -0
- package/dist/components/control-panel.config.js +2 -0
- package/dist/components/control-panel.d.ts +2 -0
- package/dist/components/control-panel.js +2 -0
- package/dist/components/control-select.config.d.ts +2 -0
- package/dist/components/control-select.config.js +2 -0
- package/dist/components/control-select.d.ts +2 -0
- package/dist/components/control-select.js +2 -0
- package/dist/components/control-slider.config.d.ts +2 -0
- package/dist/components/control-slider.config.js +2 -0
- package/dist/components/control-slider.d.ts +2 -0
- package/dist/components/control-slider.js +2 -0
- package/dist/components/control-spring.config.d.ts +2 -0
- package/dist/components/control-spring.config.js +2 -0
- package/dist/components/control-spring.d.ts +2 -0
- package/dist/components/control-spring.js +2 -0
- package/dist/components/control-stepper.config.d.ts +2 -0
- package/dist/components/control-stepper.config.js +2 -0
- package/dist/components/control-stepper.d.ts +2 -0
- package/dist/components/control-stepper.js +2 -0
- package/dist/components/control-toggle.config.d.ts +2 -0
- package/dist/components/control-toggle.config.js +2 -0
- package/dist/components/control-toggle.d.ts +2 -0
- package/dist/components/control-toggle.js +2 -0
- package/dist/components/dist/_slots.js +8 -0
- package/dist/components/dist/accordion.config.d.ts +432 -0
- package/dist/components/dist/accordion.config.js +81 -0
- package/dist/components/dist/accordion.d.ts +454 -0
- package/dist/components/dist/accordion.js +60 -0
- package/dist/components/dist/alert.config.d.ts +220 -0
- package/dist/components/dist/alert.config.js +54 -0
- package/dist/components/dist/alert.d.ts +231 -0
- package/dist/components/dist/alert.js +16 -0
- package/dist/components/dist/anchor.config.d.ts +251 -0
- package/dist/components/dist/anchor.config.js +22 -0
- package/dist/components/dist/anchor.d.ts +262 -0
- package/dist/components/dist/anchor.js +9 -0
- package/dist/components/dist/article.d.ts +12 -0
- package/dist/components/dist/article.js +9 -0
- package/dist/components/dist/aside.d.ts +12 -0
- package/dist/components/dist/aside.js +9 -0
- package/dist/components/dist/avatar-group.config.d.ts +316 -0
- package/dist/components/dist/avatar-group.config.js +33 -0
- package/dist/components/dist/avatar-group.d.ts +330 -0
- package/dist/components/dist/avatar-group.js +39 -0
- package/dist/components/dist/avatar.config.d.ts +198 -0
- package/dist/components/dist/avatar.config.js +49 -0
- package/dist/components/dist/avatar.d.ts +212 -0
- package/dist/components/dist/avatar.js +20 -0
- package/dist/components/dist/badge.config.d.ts +478 -0
- package/dist/components/dist/badge.config.js +99 -0
- package/dist/components/dist/badge.d.ts +490 -0
- package/dist/components/dist/badge.js +16 -0
- package/dist/components/dist/box.d.ts +15 -0
- package/dist/components/dist/box.js +9 -0
- package/dist/components/dist/breadcrumb.config.d.ts +391 -0
- package/dist/components/dist/breadcrumb.config.js +43 -0
- package/dist/components/dist/breadcrumb.d.ts +421 -0
- package/dist/components/dist/breadcrumb.js +119 -0
- package/dist/components/dist/button.config.d.ts +382 -0
- package/dist/components/dist/button.config.js +91 -0
- package/dist/components/dist/button.d.ts +404 -0
- package/dist/components/dist/button.js +35 -0
- package/dist/components/dist/card.config.d.ts +337 -0
- package/dist/components/dist/card.config.js +33 -0
- package/dist/components/dist/card.d.ts +353 -0
- package/dist/components/dist/card.js +27 -0
- package/dist/components/dist/collapsible.config.d.ts +46 -0
- package/dist/components/dist/collapsible.config.js +46 -0
- package/dist/components/dist/collapsible.d.ts +62 -0
- package/dist/components/dist/collapsible.js +38 -0
- package/dist/components/dist/command.config.d.ts +1614 -0
- package/dist/components/dist/command.config.js +170 -0
- package/dist/components/dist/command.d.ts +1723 -0
- package/dist/components/dist/command.js +341 -0
- package/dist/components/dist/control-color.config.d.ts +980 -0
- package/dist/components/dist/control-color.config.js +81 -0
- package/dist/components/dist/control-color.d.ts +996 -0
- package/dist/components/dist/control-color.js +64 -0
- package/dist/components/dist/control-curve.config.d.ts +19 -0
- package/dist/components/dist/control-curve.config.js +14 -0
- package/dist/components/dist/control-curve.d.ts +36 -0
- package/dist/components/dist/control-curve.js +81 -0
- package/dist/components/dist/control-folder.config.d.ts +178 -0
- package/dist/components/dist/control-folder.config.js +47 -0
- package/dist/components/dist/control-folder.d.ts +195 -0
- package/dist/components/dist/control-folder.js +41 -0
- package/dist/components/dist/control-group.config.d.ts +860 -0
- package/dist/components/dist/control-group.config.js +80 -0
- package/dist/components/dist/control-group.d.ts +882 -0
- package/dist/components/dist/control-group.js +89 -0
- package/dist/components/dist/control-knob.config.d.ts +793 -0
- package/dist/components/dist/control-knob.config.js +67 -0
- package/dist/components/dist/control-knob.d.ts +820 -0
- package/dist/components/dist/control-knob.js +148 -0
- package/dist/components/dist/control-panel.config.d.ts +403 -0
- package/dist/components/dist/control-panel.config.js +38 -0
- package/dist/components/dist/control-panel.d.ts +416 -0
- package/dist/components/dist/control-panel.js +22 -0
- package/dist/components/dist/control-select.config.d.ts +1177 -0
- package/dist/components/dist/control-select.config.js +102 -0
- package/dist/components/dist/control-select.d.ts +1201 -0
- package/dist/components/dist/control-select.js +63 -0
- package/dist/components/dist/control-slider.config.d.ts +105 -0
- package/dist/components/dist/control-slider.config.js +98 -0
- package/dist/components/dist/control-slider.d.ts +128 -0
- package/dist/components/dist/control-slider.js +87 -0
- package/dist/components/dist/control-spring.config.d.ts +418 -0
- package/dist/components/dist/control-spring.config.js +36 -0
- package/dist/components/dist/control-spring.d.ts +440 -0
- package/dist/components/dist/control-spring.js +136 -0
- package/dist/components/dist/control-stepper.config.d.ts +1085 -0
- package/dist/components/dist/control-stepper.config.js +108 -0
- package/dist/components/dist/control-stepper.d.ts +1105 -0
- package/dist/components/dist/control-stepper.js +109 -0
- package/dist/components/dist/control-toggle.config.d.ts +408 -0
- package/dist/components/dist/control-toggle.config.js +26 -0
- package/dist/components/dist/control-toggle.d.ts +421 -0
- package/dist/components/dist/control-toggle.js +36 -0
- package/dist/components/dist/createSlot.d.ts +9 -0
- package/dist/components/dist/createSlot.js +89 -0
- package/dist/components/dist/dropdown.config.d.ts +921 -0
- package/dist/components/dist/dropdown.config.js +107 -0
- package/dist/components/dist/dropdown.d.ts +951 -0
- package/dist/components/dist/dropdown.js +92 -0
- package/dist/components/dist/empty-state.config.d.ts +397 -0
- package/dist/components/dist/empty-state.config.js +53 -0
- package/dist/components/dist/empty-state.d.ts +417 -0
- package/dist/components/dist/empty-state.js +33 -0
- package/dist/components/dist/footer.d.ts +12 -0
- package/dist/components/dist/footer.js +9 -0
- package/dist/components/dist/grid.d.ts +42 -0
- package/dist/components/dist/grid.js +34 -0
- package/dist/components/dist/header.d.ts +12 -0
- package/dist/components/dist/header.js +9 -0
- package/dist/components/dist/hstack.d.ts +16 -0
- package/dist/components/dist/hstack.js +21 -0
- package/dist/components/dist/image.d.ts +20 -0
- package/dist/components/dist/image.js +9 -0
- package/dist/components/dist/input.config.d.ts +59 -0
- package/dist/components/dist/input.config.js +42 -0
- package/dist/components/dist/input.d.ts +68 -0
- package/dist/components/dist/input.js +14 -0
- package/dist/components/dist/item.config.d.ts +352 -0
- package/dist/components/dist/item.config.js +83 -0
- package/dist/components/dist/item.d.ts +375 -0
- package/dist/components/dist/item.js +51 -0
- package/dist/components/dist/list.d.ts +20 -0
- package/dist/components/dist/list.js +21 -0
- package/dist/components/dist/main.d.ts +12 -0
- package/dist/components/dist/main.js +9 -0
- package/dist/components/dist/modal.config.d.ts +398 -0
- package/dist/components/dist/modal.config.js +92 -0
- package/dist/components/dist/modal.d.ts +434 -0
- package/dist/components/dist/modal.js +125 -0
- package/dist/components/dist/nav-header.config.d.ts +159 -0
- package/dist/components/dist/nav-header.config.js +26 -0
- package/dist/components/dist/nav-header.d.ts +174 -0
- package/dist/components/dist/nav-header.js +23 -0
- package/dist/components/dist/nav.d.ts +12 -0
- package/dist/components/dist/nav.js +9 -0
- package/dist/components/dist/preset-bar.config.d.ts +193 -0
- package/dist/components/dist/preset-bar.config.js +39 -0
- package/dist/components/dist/preset-bar.d.ts +216 -0
- package/dist/components/dist/preset-bar.js +71 -0
- package/dist/components/dist/presets/index.d.ts +17675 -0
- package/dist/components/dist/presets/index.js +97 -0
- package/dist/components/dist/pressable.d.ts +12 -0
- package/dist/components/dist/pressable.js +9 -0
- package/dist/components/dist/progress.config.d.ts +297 -0
- package/dist/components/dist/progress.config.js +35 -0
- package/dist/components/dist/progress.d.ts +312 -0
- package/dist/components/dist/progress.js +43 -0
- package/dist/components/dist/section.d.ts +12 -0
- package/dist/components/dist/section.js +9 -0
- package/dist/components/dist/select.config.d.ts +32 -0
- package/dist/components/dist/select.config.js +25 -0
- package/dist/components/dist/select.d.ts +46 -0
- package/dist/components/dist/select.js +13 -0
- package/dist/components/dist/sheet.config.d.ts +246 -0
- package/dist/components/dist/sheet.config.js +99 -0
- package/dist/components/dist/sheet.d.ts +268 -0
- package/dist/components/dist/sheet.js +53 -0
- package/dist/components/dist/sidebar.config.d.ts +1652 -0
- package/dist/components/dist/sidebar.config.js +217 -0
- package/dist/components/dist/sidebar.d.ts +1826 -0
- package/dist/components/dist/sidebar.js +496 -0
- package/dist/components/dist/skeleton.config.d.ts +17 -0
- package/dist/components/dist/skeleton.config.js +10 -0
- package/dist/components/dist/skeleton.d.ts +28 -0
- package/dist/components/dist/skeleton.js +16 -0
- package/dist/components/dist/slider.config.d.ts +45 -0
- package/dist/components/dist/slider.config.js +40 -0
- package/dist/components/dist/slider.d.ts +71 -0
- package/dist/components/dist/slider.js +247 -0
- package/dist/components/dist/spinner.config.d.ts +35 -0
- package/dist/components/dist/spinner.config.js +24 -0
- package/dist/components/dist/spinner.d.ts +43 -0
- package/dist/components/dist/spinner.js +29 -0
- package/dist/components/dist/svg.d.ts +22 -0
- package/dist/components/dist/svg.js +17 -0
- package/dist/components/dist/switch.config.d.ts +354 -0
- package/dist/components/dist/switch.config.js +47 -0
- package/dist/components/dist/switch.d.ts +371 -0
- package/dist/components/dist/switch.js +32 -0
- package/dist/components/dist/table.d.ts +37 -0
- package/dist/components/dist/table.js +29 -0
- package/dist/components/dist/tabs.config.d.ts +612 -0
- package/dist/components/dist/tabs.config.js +56 -0
- package/dist/components/dist/tabs.d.ts +633 -0
- package/dist/components/dist/tabs.js +77 -0
- package/dist/components/dist/text.config.d.ts +307 -0
- package/dist/components/dist/text.config.js +149 -0
- package/dist/components/dist/text.d.ts +206 -0
- package/dist/components/dist/text.js +12 -0
- package/dist/components/dist/textarea.config.d.ts +353 -0
- package/dist/components/dist/textarea.config.js +57 -0
- package/dist/components/dist/textarea.d.ts +363 -0
- package/dist/components/dist/textarea.js +9 -0
- package/dist/components/dist/toast.config.d.ts +336 -0
- package/dist/components/dist/toast.config.js +145 -0
- package/dist/components/dist/toast.d.ts +427 -0
- package/dist/components/dist/toast.js +159 -0
- package/dist/components/dist/tooltip.config.d.ts +194 -0
- package/dist/components/dist/tooltip.config.js +40 -0
- package/dist/components/dist/tooltip.d.ts +207 -0
- package/dist/components/dist/tooltip.js +28 -0
- package/dist/components/dist/vstack.d.ts +16 -0
- package/dist/components/dist/vstack.js +20 -0
- package/dist/components/dropdown.config.d.ts +2 -0
- package/dist/components/dropdown.config.js +2 -0
- package/dist/components/dropdown.d.ts +2 -0
- package/dist/components/dropdown.js +2 -0
- package/dist/components/empty-state.config.d.ts +2 -0
- package/dist/components/empty-state.config.js +2 -0
- package/dist/components/empty-state.d.ts +2 -0
- package/dist/components/empty-state.js +2 -0
- package/dist/components/footer.d.ts +2 -0
- package/dist/components/footer.js +2 -0
- package/dist/components/grid.d.ts +2 -0
- package/dist/components/grid.js +2 -0
- package/dist/components/header.d.ts +2 -0
- package/dist/components/header.js +2 -0
- package/dist/components/hstack.d.ts +2 -0
- package/dist/components/hstack.js +2 -0
- package/dist/components/image.d.ts +2 -0
- package/dist/components/image.js +2 -0
- package/dist/components/input.config.d.ts +2 -0
- package/dist/components/input.config.js +2 -0
- package/dist/components/input.d.ts +2 -0
- package/dist/components/input.js +2 -0
- package/dist/components/item.config.d.ts +2 -0
- package/dist/components/item.config.js +2 -0
- package/dist/components/item.d.ts +2 -0
- package/dist/components/item.js +2 -0
- package/dist/components/list.d.ts +2 -0
- package/dist/components/list.js +2 -0
- package/dist/components/main.d.ts +2 -0
- package/dist/components/main.js +2 -0
- package/dist/components/modal.config.d.ts +2 -0
- package/dist/components/modal.config.js +2 -0
- package/dist/components/modal.d.ts +2 -0
- package/dist/components/modal.js +2 -0
- package/dist/components/nav-header.config.d.ts +2 -0
- package/dist/components/nav-header.config.js +2 -0
- package/dist/components/nav-header.d.ts +2 -0
- package/dist/components/nav-header.js +2 -0
- package/dist/components/nav.d.ts +2 -0
- package/dist/components/nav.js +2 -0
- package/dist/components/preset-bar.config.d.ts +2 -0
- package/dist/components/preset-bar.config.js +2 -0
- package/dist/components/preset-bar.d.ts +2 -0
- package/dist/components/preset-bar.js +2 -0
- package/dist/components/presets/index.d.ts +44 -0
- package/dist/components/presets/index.js +44 -0
- package/dist/components/pressable.d.ts +2 -0
- package/dist/components/pressable.js +2 -0
- package/dist/components/progress.config.d.ts +2 -0
- package/dist/components/progress.config.js +2 -0
- package/dist/components/progress.d.ts +2 -0
- package/dist/components/progress.js +2 -0
- package/dist/components/section.d.ts +2 -0
- package/dist/components/section.js +2 -0
- package/dist/components/select.config.d.ts +2 -0
- package/dist/components/select.config.js +2 -0
- package/dist/components/select.d.ts +2 -0
- package/dist/components/select.js +2 -0
- package/dist/components/sheet.config.d.ts +2 -0
- package/dist/components/sheet.config.js +2 -0
- package/dist/components/sheet.d.ts +2 -0
- package/dist/components/sheet.js +2 -0
- package/dist/components/sidebar.config.d.ts +2 -0
- package/dist/components/sidebar.config.js +2 -0
- package/dist/components/sidebar.d.ts +2 -0
- package/dist/components/sidebar.js +2 -0
- package/dist/components/skeleton.config.d.ts +2 -0
- package/dist/components/skeleton.config.js +2 -0
- package/dist/components/skeleton.d.ts +2 -0
- package/dist/components/skeleton.js +2 -0
- package/dist/components/slider.config.d.ts +2 -0
- package/dist/components/slider.config.js +2 -0
- package/dist/components/slider.d.ts +2 -0
- package/dist/components/slider.js +2 -0
- package/dist/components/spinner.config.d.ts +2 -0
- package/dist/components/spinner.config.js +2 -0
- package/dist/components/spinner.d.ts +2 -0
- package/dist/components/spinner.js +2 -0
- package/dist/components/svg.d.ts +2 -0
- package/dist/components/svg.js +2 -0
- package/dist/components/switch.config.d.ts +2 -0
- package/dist/components/switch.config.js +2 -0
- package/dist/components/switch.d.ts +2 -0
- package/dist/components/switch.js +2 -0
- package/dist/components/table.d.ts +2 -0
- package/dist/components/table.js +2 -0
- package/dist/components/tabs.config.d.ts +2 -0
- package/dist/components/tabs.config.js +2 -0
- package/dist/components/tabs.d.ts +2 -0
- package/dist/components/tabs.js +2 -0
- package/dist/components/text.config.d.ts +2 -0
- package/dist/components/text.config.js +2 -0
- package/dist/components/text.d.ts +2 -0
- package/dist/components/text.js +2 -0
- package/dist/components/textarea.config.d.ts +2 -0
- package/dist/components/textarea.config.js +2 -0
- package/dist/components/textarea.d.ts +2 -0
- package/dist/components/textarea.js +2 -0
- package/dist/components/toast.config.d.ts +2 -0
- package/dist/components/toast.config.js +2 -0
- package/dist/components/toast.d.ts +2 -0
- package/dist/components/toast.js +2 -0
- package/dist/components/tooltip.config.d.ts +2 -0
- package/dist/components/tooltip.config.js +2 -0
- package/dist/components/tooltip.d.ts +2 -0
- package/dist/components/tooltip.js +2 -0
- package/dist/components/vstack.d.ts +2 -0
- package/dist/components/vstack.js +2 -0
- package/dist/config/dist/component-resolution.d.ts +1 -0
- package/dist/config/dist/component-resolution.js +78 -0
- package/dist/config/dist/consts/defaultColors.d.ts +253 -0
- package/dist/config/dist/consts/defaultColors.js +252 -0
- package/dist/config/dist/createConfig.d.ts +214 -0
- package/dist/config/dist/createConfig.js +454 -0
- package/dist/config/dist/index.d.ts +5 -0
- package/dist/config/dist/index.js +4 -0
- package/dist/config/dist/preset-merge.js +165 -0
- package/dist/config/dist/serialize.d.ts +57 -0
- package/dist/config/dist/serialize.js +153 -0
- package/dist/config-utils/dist/componentConfig.d.ts +10 -0
- package/dist/config-utils/dist/componentConfig.js +11 -0
- package/dist/config-utils.d.ts +2 -0
- package/dist/config-utils.js +2 -0
- package/dist/config.d.ts +3512 -0
- package/dist/config.js +22 -0
- package/dist/core/dist/createComponent.boundaries.js +192 -0
- package/dist/core/dist/createComponent.d.ts +57 -0
- package/dist/core/dist/createComponent.js +67 -0
- package/dist/core/dist/createComponentExample.d.ts +42 -0
- package/dist/core/dist/createComponentExample.js +27 -0
- package/dist/core/dist/createProvider.d.ts +13 -0
- package/dist/core/dist/createProvider.js +24 -0
- package/dist/core/dist/generated/stylePropsTwMap.d.ts +1701 -0
- package/dist/core/dist/generated/stylePropsTwMap.js +570 -0
- package/dist/core/dist/getComponentStyles.d.ts +50 -0
- package/dist/core/dist/getComponentStyles.js +85 -0
- package/dist/core/dist/getStyles.d.ts +43 -0
- package/dist/core/dist/getStyles.js +305 -0
- package/dist/core/dist/index.d.ts +11 -0
- package/dist/core/dist/index.js +11 -0
- package/dist/core/dist/macros.d.ts +22 -0
- package/dist/core/dist/macros.js +49 -0
- package/dist/core/dist/propMappings.d.ts +77 -0
- package/dist/core/dist/propMappings.js +1404 -0
- package/dist/core/dist/resolveMotionState.d.ts +5 -0
- package/dist/core/dist/resolveMotionState.js +17 -0
- package/dist/core/dist/resolveProps.boundaries.js +130 -0
- package/dist/core/dist/transformPreset.d.ts +18 -0
- package/dist/core/dist/transformPreset.js +28 -0
- package/dist/core/dist/withDefaultStyleProps.d.ts +44 -0
- package/dist/core/dist/withDefaultStyleProps.js +18 -0
- package/dist/core.d.ts +12 -0
- package/dist/core.js +13 -0
- package/dist/createSlot.d.ts +2 -0
- package/dist/createSlot.js +2 -0
- package/dist/devtools.d.ts +2 -0
- package/dist/devtools.js +3 -0
- package/dist/fixtures.d.ts +2 -0
- package/dist/fixtures.js +3 -0
- package/dist/foundational-presets/dist/boldVibrant.d.ts +3575 -0
- package/dist/foundational-presets/dist/boldVibrant.js +326 -0
- package/dist/foundational-presets/dist/brutalist.d.ts +3575 -0
- package/dist/foundational-presets/dist/brutalist.js +326 -0
- package/dist/foundational-presets/dist/candy.d.ts +3575 -0
- package/dist/foundational-presets/dist/candy.js +326 -0
- package/dist/foundational-presets/dist/cleanMinimalist.d.ts +3575 -0
- package/dist/foundational-presets/dist/cleanMinimalist.js +326 -0
- package/dist/foundational-presets/dist/corporate.d.ts +3575 -0
- package/dist/foundational-presets/dist/corporate.js +326 -0
- package/dist/foundational-presets/dist/darkMoody.d.ts +3575 -0
- package/dist/foundational-presets/dist/darkMoody.js +326 -0
- package/dist/foundational-presets/dist/defaultPreset.d.ts +3509 -0
- package/dist/foundational-presets/dist/defaultPreset.js +1784 -0
- package/dist/foundational-presets/dist/forest.d.ts +3575 -0
- package/dist/foundational-presets/dist/forest.js +326 -0
- package/dist/foundational-presets/dist/highContrast.d.ts +3575 -0
- package/dist/foundational-presets/dist/highContrast.js +326 -0
- package/dist/foundational-presets/dist/index.d.ts +19 -0
- package/dist/foundational-presets/dist/index.js +19 -0
- package/dist/foundational-presets/dist/lavender.d.ts +3575 -0
- package/dist/foundational-presets/dist/lavender.js +326 -0
- package/dist/foundational-presets/dist/luxury.d.ts +3575 -0
- package/dist/foundational-presets/dist/luxury.js +326 -0
- package/dist/foundational-presets/dist/monochrome.d.ts +3575 -0
- package/dist/foundational-presets/dist/monochrome.js +326 -0
- package/dist/foundational-presets/dist/motion.d.ts +13 -0
- package/dist/foundational-presets/dist/motion.js +10 -0
- package/dist/foundational-presets/dist/neonCyber.d.ts +3575 -0
- package/dist/foundational-presets/dist/neonCyber.js +326 -0
- package/dist/foundational-presets/dist/newspaper.d.ts +3575 -0
- package/dist/foundational-presets/dist/newspaper.js +326 -0
- package/dist/foundational-presets/dist/ocean.d.ts +3575 -0
- package/dist/foundational-presets/dist/ocean.js +326 -0
- package/dist/foundational-presets/dist/slate.d.ts +3575 -0
- package/dist/foundational-presets/dist/slate.js +326 -0
- package/dist/foundational-presets/dist/sunset.d.ts +3575 -0
- package/dist/foundational-presets/dist/sunset.js +326 -0
- package/dist/foundational-presets/dist/terminal.d.ts +3575 -0
- package/dist/foundational-presets/dist/terminal.js +326 -0
- package/dist/foundational-presets/dist/warmOrganic.d.ts +3575 -0
- package/dist/foundational-presets/dist/warmOrganic.js +326 -0
- package/dist/loader/dist/_virtual/_rolldown/runtime.js +6 -0
- package/dist/loader/dist/loader/artifacts.js +43 -0
- package/dist/loader/dist/loader/babel-utils.js +29 -0
- package/dist/loader/dist/loader/create-component-data.js +33 -0
- package/dist/loader/dist/loader/create-component-lowering.js +454 -0
- package/dist/loader/dist/loader/data-attr-transform.js +191 -0
- package/dist/loader/dist/loader/dynamic-style-codegen.js +96 -0
- package/dist/loader/dist/loader/internal-meta.js +22 -0
- package/dist/loader/dist/loader/motion-transform.js +717 -0
- package/dist/loader/dist/loader/style-transform.js +670 -0
- package/dist/loader/dist/loader.d.ts +8 -0
- package/dist/loader/dist/loader.js +357 -0
- package/dist/loader/dist/next.d.ts +17 -0
- package/dist/loader/dist/next.js +77 -0
- package/dist/loader/dist/node_modules/react/cjs/react-jsx-runtime.development.js +203 -0
- package/dist/loader/dist/node_modules/react/cjs/react-jsx-runtime.production.js +25 -0
- package/dist/loader/dist/node_modules/react/cjs/react.development.js +762 -0
- package/dist/loader/dist/node_modules/react/cjs/react.production.js +351 -0
- package/dist/loader/dist/node_modules/react/index.js +10 -0
- package/dist/loader/dist/node_modules/react/jsx-runtime.js +10 -0
- package/dist/loader/dist/packages/core/dist/createComponent.js +6 -0
- package/dist/loader/dist/packages/core/dist/createProvider.js +7 -0
- package/dist/loader/dist/packages/core/dist/generated/stylePropsTwMap.js +570 -0
- package/dist/loader/dist/packages/core/dist/getComponentStyles.js +2 -0
- package/dist/loader/dist/packages/core/dist/getStyles.js +58 -0
- package/dist/loader/dist/packages/core/dist/index.js +6 -0
- package/dist/loader/dist/packages/core/dist/macros.js +41 -0
- package/dist/loader/dist/packages/core/dist/propMappings.js +1347 -0
- package/dist/loader/dist/packages/core/dist/withDefaultStyleProps.js +1 -0
- package/dist/loader.d.ts +2 -0
- package/dist/loader.js +2 -0
- package/dist/next.d.ts +2 -0
- package/dist/next.js +2 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.js +2 -0
- package/dist/presets/dist/boldVibrant.d.ts +6 -0
- package/dist/presets/dist/boldVibrant.js +7 -0
- package/dist/presets/dist/brutalist.d.ts +6 -0
- package/dist/presets/dist/brutalist.js +7 -0
- package/dist/presets/dist/candy.d.ts +6 -0
- package/dist/presets/dist/candy.js +7 -0
- package/dist/presets/dist/cleanMinimalist.d.ts +6 -0
- package/dist/presets/dist/cleanMinimalist.js +7 -0
- package/dist/presets/dist/corporate.d.ts +6 -0
- package/dist/presets/dist/corporate.js +7 -0
- package/dist/presets/dist/darkMoody.d.ts +6 -0
- package/dist/presets/dist/darkMoody.js +7 -0
- package/dist/presets/dist/defaultPreset.d.ts +6 -0
- package/dist/presets/dist/defaultPreset.js +68 -0
- package/dist/presets/dist/forest.d.ts +6 -0
- package/dist/presets/dist/forest.js +7 -0
- package/dist/presets/dist/highContrast.d.ts +6 -0
- package/dist/presets/dist/highContrast.js +7 -0
- package/dist/presets/dist/index.d.ts +19 -0
- package/dist/presets/dist/index.js +19 -0
- package/dist/presets/dist/lavender.d.ts +6 -0
- package/dist/presets/dist/lavender.js +7 -0
- package/dist/presets/dist/luxury.d.ts +6 -0
- package/dist/presets/dist/luxury.js +7 -0
- package/dist/presets/dist/monochrome.d.ts +6 -0
- package/dist/presets/dist/monochrome.js +7 -0
- package/dist/presets/dist/neonCyber.d.ts +6 -0
- package/dist/presets/dist/neonCyber.js +7 -0
- package/dist/presets/dist/newspaper.d.ts +6 -0
- package/dist/presets/dist/newspaper.js +7 -0
- package/dist/presets/dist/ocean.d.ts +6 -0
- package/dist/presets/dist/ocean.js +7 -0
- package/dist/presets/dist/slate.d.ts +6 -0
- package/dist/presets/dist/slate.js +7 -0
- package/dist/presets/dist/sunset.d.ts +6 -0
- package/dist/presets/dist/sunset.js +7 -0
- package/dist/presets/dist/terminal.d.ts +6 -0
- package/dist/presets/dist/terminal.js +7 -0
- package/dist/presets/dist/warmOrganic.d.ts +6 -0
- package/dist/presets/dist/warmOrganic.js +7 -0
- package/dist/presets/motion.d.ts +2 -0
- package/dist/presets/motion.js +2 -0
- package/dist/presets.d.ts +20 -0
- package/dist/presets.js +21 -0
- package/dist/remotion/dist/components/image-slide.config.js +43 -0
- package/dist/remotion/dist/components/image-slide.d.ts +20 -0
- package/dist/remotion/dist/components/image-slide.js +24 -0
- package/dist/remotion/dist/components/index.js +16 -0
- package/dist/remotion/dist/components/lower-third.config.js +54 -0
- package/dist/remotion/dist/components/lower-third.d.ts +21 -0
- package/dist/remotion/dist/components/lower-third.js +26 -0
- package/dist/remotion/dist/components/quote-card.config.js +85 -0
- package/dist/remotion/dist/components/quote-card.d.ts +21 -0
- package/dist/remotion/dist/components/quote-card.js +27 -0
- package/dist/remotion/dist/components/split-screen.config.js +90 -0
- package/dist/remotion/dist/components/split-screen.d.ts +25 -0
- package/dist/remotion/dist/components/split-screen.js +35 -0
- package/dist/remotion/dist/components/stat-card.config.js +55 -0
- package/dist/remotion/dist/components/stat-card.d.ts +19 -0
- package/dist/remotion/dist/components/stat-card.js +23 -0
- package/dist/remotion/dist/components/text-overlay.config.js +46 -0
- package/dist/remotion/dist/components/text-overlay.d.ts +17 -0
- package/dist/remotion/dist/components/text-overlay.js +16 -0
- package/dist/remotion/dist/components/title-card.config.js +56 -0
- package/dist/remotion/dist/components/title-card.d.ts +19 -0
- package/dist/remotion/dist/components/title-card.js +23 -0
- package/dist/remotion/dist/components/typing-text.config.js +57 -0
- package/dist/remotion/dist/components/typing-text.d.ts +21 -0
- package/dist/remotion/dist/components/typing-text.js +23 -0
- package/dist/remotion/dist/index.d.ts +8 -0
- package/dist/remotion/dist/index.js +8 -0
- package/dist/remotion/dist/transitions/fade.js +19 -0
- package/dist/remotion/dist/transitions/index.js +7 -0
- package/dist/remotion/dist/transitions/slide-down.js +21 -0
- package/dist/remotion/dist/transitions/slide-left.js +21 -0
- package/dist/remotion/dist/transitions/slide-right.js +21 -0
- package/dist/remotion/dist/transitions/slide-up.js +21 -0
- package/dist/remotion/dist/transitions/wipe.js +21 -0
- package/dist/remotion/dist/transitions/zoom.js +19 -0
- package/dist/remotion.d.ts +9 -0
- package/dist/remotion.js +10 -0
- package/dist/styles.d.ts +4 -0
- package/dist/styles.js +5 -0
- package/dist/transformPreset.d.ts +2 -0
- package/dist/transformPreset.js +3 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +1 -0
- package/dist/utils/dist/array-utils/closestItem.d.ts +5 -0
- package/dist/utils/dist/array-utils/closestItem.js +9 -0
- package/dist/utils/dist/array-utils/removeItem.d.ts +5 -0
- package/dist/utils/dist/array-utils/removeItem.js +8 -0
- package/dist/utils/dist/component-style-defaults.d.ts +6 -0
- package/dist/utils/dist/component-style-defaults.js +68 -0
- package/dist/utils/dist/index.js +23 -0
- package/dist/utils/dist/math-utils/clamp.d.ts +13 -0
- package/dist/utils/dist/math-utils/clamp.js +14 -0
- package/dist/utils/dist/motion-utils/interpolate.d.ts +11 -0
- package/dist/utils/dist/motion-utils/interpolate.js +25 -0
- package/dist/utils/dist/object-utils/entries.d.ts +5 -0
- package/dist/utils/dist/object-utils/entries.js +6 -0
- package/dist/utils/dist/object-utils/flattenObj.d.ts +13 -0
- package/dist/utils/dist/object-utils/flattenObj.js +21 -0
- package/dist/utils/dist/object-utils/fromEntries.d.ts +5 -0
- package/dist/utils/dist/object-utils/fromEntries.js +6 -0
- package/dist/utils/dist/object-utils/keys.d.ts +5 -0
- package/dist/utils/dist/object-utils/keys.js +6 -0
- package/dist/utils/dist/object-utils/mapKeys.d.ts +6 -0
- package/dist/utils/dist/object-utils/mapKeys.js +10 -0
- package/dist/utils/dist/object-utils/mapValues.d.ts +6 -0
- package/dist/utils/dist/object-utils/mapValues.js +9 -0
- package/dist/utils/dist/string-utils/arrayToUnion.d.ts +5 -0
- package/dist/utils/dist/string-utils/arrayToUnion.js +6 -0
- package/dist/utils/dist/string-utils/capitalize.d.ts +5 -0
- package/dist/utils/dist/string-utils/capitalize.js +6 -0
- package/dist/utils/dist/string-utils/componentClassName.d.ts +26 -0
- package/dist/utils/dist/string-utils/componentClassName.js +33 -0
- package/dist/utils/dist/string-utils/createTemplate.d.ts +17 -0
- package/dist/utils/dist/string-utils/createTemplate.js +142 -0
- package/dist/utils/dist/string-utils/cssVar.d.ts +54 -0
- package/dist/utils/dist/string-utils/cssVar.js +61 -0
- package/dist/utils/dist/string-utils/cssVars.d.ts +82 -0
- package/dist/utils/dist/string-utils/cssVars.js +108 -0
- package/dist/utils/dist/string-utils/dedent.d.ts +48 -0
- package/dist/utils/dist/string-utils/dedent.js +68 -0
- package/dist/utils/dist/string-utils/indent.d.ts +5 -0
- package/dist/utils/dist/string-utils/indent.js +6 -0
- package/dist/utils/dist/string-utils/join.d.ts +6 -0
- package/dist/utils/dist/string-utils/join.js +6 -0
- package/dist/utils/dist/string-utils/kebabCase.d.ts +14 -0
- package/dist/utils/dist/string-utils/kebabCase.js +14 -0
- package/dist/utils/dist/string-utils/objectToInterface.js +6 -0
- package/dist/utils/dist/string-utils/split.d.ts +11 -0
- package/dist/utils/dist/string-utils/split.js +12 -0
- package/dist/utils/dist/string-utils/tsProperties.d.ts +30 -0
- package/dist/utils/dist/string-utils/tsProperties.js +60 -0
- package/dist/utils.d.ts +24 -0
- package/dist/utils.js +25 -0
- package/package.json +185 -0
|
@@ -0,0 +1,717 @@
|
|
|
1
|
+
import * as t from "@babel/types";
|
|
2
|
+
//#region ../loader/dist/loader/motion-transform.js
|
|
3
|
+
function isRecord(value) {
|
|
4
|
+
return typeof value === "object" && value !== null;
|
|
5
|
+
}
|
|
6
|
+
function isIntrinsicJsxTagName(name) {
|
|
7
|
+
return /^[a-z]/.test(name);
|
|
8
|
+
}
|
|
9
|
+
function getCustomSlotMotion(manifest, slotInfo) {
|
|
10
|
+
const component = manifest?.components[slotInfo.componentName];
|
|
11
|
+
if (!component || component.type !== "custom") return null;
|
|
12
|
+
const slotMotion = component.motion?.[slotInfo.slotName];
|
|
13
|
+
if (!isRecord(slotMotion)) return null;
|
|
14
|
+
if (slotMotion.runtime === "css") return null;
|
|
15
|
+
return slotMotion;
|
|
16
|
+
}
|
|
17
|
+
function hasAnimatePresenceAncestor(nodePath) {
|
|
18
|
+
let current = nodePath.parentPath;
|
|
19
|
+
while (current) {
|
|
20
|
+
if (current.node?.type === "JSXElement" && current.node.openingElement?.name?.type === "JSXIdentifier" && current.node.openingElement.name.name === "AnimatePresence") return true;
|
|
21
|
+
current = current.parentPath;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Ensure the motion element has a `key` attribute.
|
|
27
|
+
* AnimatePresence requires a `key` on its direct children to track exit animations.
|
|
28
|
+
* If no `key` exists, inject `key="exit-motion"` as a stable identifier.
|
|
29
|
+
*/
|
|
30
|
+
function ensureKeyOnMotionElement(openingElementPath) {
|
|
31
|
+
const attributes = openingElementPath.node.attributes;
|
|
32
|
+
if (!attributes.some((attr) => attr.type === "JSXAttribute" && attr.name?.type === "JSXIdentifier" && attr.name.name === "key")) attributes.unshift(t.jsxAttribute(t.jsxIdentifier("key"), t.stringLiteral("exit-motion")));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Build an `<AnimatePresence initial={false}>{expression}</AnimatePresence>` JSX wrapper.
|
|
36
|
+
*/
|
|
37
|
+
function buildAnimatePresenceJsxWrapper(expression) {
|
|
38
|
+
return t.jsxElement(t.jsxOpeningElement(t.jsxIdentifier("AnimatePresence"), [t.jsxAttribute(t.jsxIdentifier("initial"), t.jsxExpressionContainer(t.booleanLiteral(false)))], false), t.jsxClosingElement(t.jsxIdentifier("AnimatePresence")), [t.jsxExpressionContainer(expression)], false);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Check if a node path is a direct argument of a CallExpression
|
|
42
|
+
* (e.g. the first arg of `createPortal(expr, container)`).
|
|
43
|
+
*/
|
|
44
|
+
function isCallExpressionArg(nodePath) {
|
|
45
|
+
const parent = nodePath.parentPath;
|
|
46
|
+
if (!parent || parent.node?.type !== "CallExpression") return false;
|
|
47
|
+
return parent.node.arguments.includes(nodePath.node);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Auto-wrap a conditionally rendered motion element with `<AnimatePresence initial={false}>`.
|
|
51
|
+
*
|
|
52
|
+
* Detects three patterns from the JSXElement parent of the opening element:
|
|
53
|
+
* - `{condition && <motion.div ...>}` (LogicalExpression with &&)
|
|
54
|
+
* - `{condition ? <motion.div ...> : null}` (ConditionalExpression with null/false alternate)
|
|
55
|
+
* - `{items.map(cb => <motion.div ...>)}` (CallExpression with .map())
|
|
56
|
+
*
|
|
57
|
+
* Also ensures the motion element has a `key` attribute, which AnimatePresence
|
|
58
|
+
* requires to track children for exit animations.
|
|
59
|
+
*
|
|
60
|
+
* Returns true if wrapping was applied.
|
|
61
|
+
*/
|
|
62
|
+
function wrapParentConditionalWithAnimatePresence(nodePath) {
|
|
63
|
+
const jsxElementPath = nodePath.parentPath;
|
|
64
|
+
if (!jsxElementPath || jsxElementPath.node?.type !== "JSXElement") return false;
|
|
65
|
+
if (hasAnimatePresenceAncestor(jsxElementPath)) return false;
|
|
66
|
+
const parentPath = jsxElementPath.parentPath;
|
|
67
|
+
if (!parentPath) return false;
|
|
68
|
+
const parentNode = parentPath.node;
|
|
69
|
+
let expressionContainerPath = null;
|
|
70
|
+
if (parentNode?.type === "LogicalExpression" && parentNode.operator === "&&" && parentNode.right === jsxElementPath.node) expressionContainerPath = parentPath.parentPath;
|
|
71
|
+
if (parentNode?.type === "ConditionalExpression" && parentNode.consequent === jsxElementPath.node) {
|
|
72
|
+
const alternate = parentNode.alternate;
|
|
73
|
+
if (alternate?.type === "NullLiteral" || alternate?.type === "BooleanLiteral" && alternate.value === false || alternate?.type === "Identifier" && alternate.name === "null") expressionContainerPath = parentPath.parentPath;
|
|
74
|
+
}
|
|
75
|
+
if (!expressionContainerPath) expressionContainerPath = findMapExpressionContainer(jsxElementPath);
|
|
76
|
+
ensureKeyOnMotionElement(nodePath);
|
|
77
|
+
if (expressionContainerPath?.node?.type === "JSXExpressionContainer") {
|
|
78
|
+
const originalExpression = expressionContainerPath.node.expression;
|
|
79
|
+
expressionContainerPath.replaceWith(buildAnimatePresenceJsxWrapper(originalExpression));
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
if (parentPath && isCallExpressionArg(parentPath)) {
|
|
83
|
+
const originalExpression = t.cloneNode(parentPath.node, true);
|
|
84
|
+
parentPath.replaceWith(buildAnimatePresenceJsxWrapper(originalExpression));
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Find the JSXExpressionContainer ancestor of a `.map()` call that returns
|
|
91
|
+
* the given JSX element.
|
|
92
|
+
*
|
|
93
|
+
* Walks up from the JSXElement through:
|
|
94
|
+
* JSXElement → (optional ParenthesizedExpression) → ArrowFunctionExpression body
|
|
95
|
+
* OR JSXElement → ReturnStatement → BlockStatement → ArrowFunctionExpression/FunctionExpression
|
|
96
|
+
* → CallExpression(.map) argument → CallExpression → JSXExpressionContainer
|
|
97
|
+
*/
|
|
98
|
+
function findMapExpressionContainer(jsxElementPath) {
|
|
99
|
+
let current = jsxElementPath;
|
|
100
|
+
while (current.parentPath?.node?.type === "ParenthesizedExpression") current = current.parentPath;
|
|
101
|
+
let callbackPath = current.parentPath;
|
|
102
|
+
if (callbackPath?.node?.type === "ArrowFunctionExpression" && callbackPath.node.body === current.node) {} else {
|
|
103
|
+
if (current.parentPath?.node?.type !== "ReturnStatement") return null;
|
|
104
|
+
const blockPath = current.parentPath.parentPath;
|
|
105
|
+
if (blockPath?.node?.type !== "BlockStatement") return null;
|
|
106
|
+
callbackPath = blockPath.parentPath;
|
|
107
|
+
if (callbackPath?.node?.type !== "ArrowFunctionExpression" && callbackPath?.node?.type !== "FunctionExpression") return null;
|
|
108
|
+
}
|
|
109
|
+
const callExprPath = callbackPath.parentPath;
|
|
110
|
+
if (callExprPath?.node?.type !== "CallExpression") return null;
|
|
111
|
+
const callee = callExprPath.node.callee;
|
|
112
|
+
if (callee?.type !== "MemberExpression" || callee.property?.type !== "Identifier" || callee.property.name !== "map") return null;
|
|
113
|
+
const containerPath = callExprPath.parentPath;
|
|
114
|
+
if (containerPath?.node?.type === "JSXExpressionContainer") return containerPath;
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Convert a jsxs callee to its jsx (single-child) equivalent.
|
|
119
|
+
* e.g. identifier `jsxs` → `jsx`, member `_runtime.jsxs` → `_runtime.jsx`
|
|
120
|
+
*/
|
|
121
|
+
function toSingleChildJsxCallee(callee) {
|
|
122
|
+
const cloned = t.cloneNode(callee, true);
|
|
123
|
+
if (t.isIdentifier(cloned) && cloned.name.endsWith("s")) {
|
|
124
|
+
cloned.name = cloned.name.slice(0, -1);
|
|
125
|
+
return cloned;
|
|
126
|
+
}
|
|
127
|
+
if ((t.isMemberExpression(cloned) || t.isOptionalMemberExpression(cloned)) && t.isIdentifier(cloned.property) && cloned.property.name.endsWith("s")) {
|
|
128
|
+
cloned.property = t.identifier(cloned.property.name.slice(0, -1));
|
|
129
|
+
return cloned;
|
|
130
|
+
}
|
|
131
|
+
return cloned;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Auto-wrap a compiled JSX call expression that has exit motion with AnimatePresence.
|
|
135
|
+
*
|
|
136
|
+
* Detects three patterns:
|
|
137
|
+
* - `condition && _jsx(motion.div, ...)` (LogicalExpression with &&)
|
|
138
|
+
* - `condition ? _jsx(motion.div, ...) : null` (ConditionalExpression with null/false)
|
|
139
|
+
* - `items.map(cb => _jsx(motion.div, ...))` (CallExpression with .map())
|
|
140
|
+
*
|
|
141
|
+
* Wraps the expression with: `_jsx(AnimatePresence, { initial: false, children: ... })`
|
|
142
|
+
*/
|
|
143
|
+
function wrapCompiledConditionalWithAnimatePresence(nodePath, jsxCallee) {
|
|
144
|
+
const parentPath = nodePath.parentPath;
|
|
145
|
+
if (!parentPath) return false;
|
|
146
|
+
const parentNode = parentPath.node;
|
|
147
|
+
let targetPath = null;
|
|
148
|
+
if (parentNode?.type === "LogicalExpression" && parentNode.operator === "&&" && parentNode.right === nodePath.node) targetPath = parentPath;
|
|
149
|
+
if (parentNode?.type === "ConditionalExpression" && parentNode.consequent === nodePath.node) {
|
|
150
|
+
const alternate = parentNode.alternate;
|
|
151
|
+
if (alternate?.type === "NullLiteral" || alternate?.type === "BooleanLiteral" && alternate.value === false || alternate?.type === "Identifier" && alternate.name === "null") targetPath = parentPath;
|
|
152
|
+
}
|
|
153
|
+
if (!targetPath) targetPath = findCompiledMapCallExpression(nodePath);
|
|
154
|
+
if (!targetPath) return false;
|
|
155
|
+
const singleChildCallee = toSingleChildJsxCallee(jsxCallee);
|
|
156
|
+
const originalExpression = t.cloneNode(targetPath.node, true);
|
|
157
|
+
const animatePresenceCall = t.callExpression(singleChildCallee, [t.identifier("AnimatePresence"), t.objectExpression([t.objectProperty(t.identifier("initial"), t.booleanLiteral(false)), t.objectProperty(t.identifier("children"), originalExpression)])]);
|
|
158
|
+
targetPath.replaceWith(animatePresenceCall);
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Find the .map() CallExpression ancestor of a compiled JSX call.
|
|
163
|
+
*
|
|
164
|
+
* Walks up from _jsx(motion.div, ...) through:
|
|
165
|
+
* CallExpression → ArrowFunctionExpression body (or ReturnStatement → BlockStatement → fn)
|
|
166
|
+
* → CallExpression(.map) argument → CallExpression(.map)
|
|
167
|
+
*/
|
|
168
|
+
function findCompiledMapCallExpression(nodePath) {
|
|
169
|
+
let callbackPath = nodePath.parentPath;
|
|
170
|
+
if (callbackPath?.node?.type === "ArrowFunctionExpression" && callbackPath.node.body === nodePath.node) {} else {
|
|
171
|
+
if (nodePath.parentPath?.node?.type !== "ReturnStatement") return null;
|
|
172
|
+
const blockPath = nodePath.parentPath.parentPath;
|
|
173
|
+
if (blockPath?.node?.type !== "BlockStatement") return null;
|
|
174
|
+
callbackPath = blockPath.parentPath;
|
|
175
|
+
if (callbackPath?.node?.type !== "ArrowFunctionExpression" && callbackPath?.node?.type !== "FunctionExpression") return null;
|
|
176
|
+
}
|
|
177
|
+
const mapCallPath = callbackPath.parentPath;
|
|
178
|
+
if (mapCallPath?.node?.type !== "CallExpression") return null;
|
|
179
|
+
const callee = mapCallPath.node.callee;
|
|
180
|
+
if (callee?.type !== "MemberExpression" || callee.property?.type !== "Identifier" || callee.property.name !== "map") return null;
|
|
181
|
+
return mapCallPath;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Check if a custom component in the manifest has any slot with exit motion.
|
|
185
|
+
*/
|
|
186
|
+
function componentHasExitMotion(manifest, componentName) {
|
|
187
|
+
const component = manifest?.components[componentName];
|
|
188
|
+
if (!component || !component.motion) return false;
|
|
189
|
+
for (const slotMotion of Object.values(component.motion)) if (isRecord(slotMotion) && slotMotion.exit !== void 0) return true;
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Auto-wrap a custom component with exit motion in AnimatePresence when used
|
|
194
|
+
* inside a conditional or .map() pattern.
|
|
195
|
+
*
|
|
196
|
+
* Unlike `wrapParentConditionalWithAnimatePresence` (which works on slot elements
|
|
197
|
+
* inside createComponent), this works on custom component JSX usage sites
|
|
198
|
+
* (e.g. `<Toast>` inside a createProvider or any other context).
|
|
199
|
+
*
|
|
200
|
+
* Returns true if wrapping was applied.
|
|
201
|
+
*/
|
|
202
|
+
function wrapCustomComponentWithAnimatePresence(nodePath) {
|
|
203
|
+
const jsxElementPath = nodePath.parentPath;
|
|
204
|
+
if (!jsxElementPath || jsxElementPath.node?.type !== "JSXElement") return false;
|
|
205
|
+
if (hasAnimatePresenceAncestor(jsxElementPath)) return false;
|
|
206
|
+
const parentPath = jsxElementPath.parentPath;
|
|
207
|
+
if (!parentPath) return false;
|
|
208
|
+
const parentNode = parentPath.node;
|
|
209
|
+
let expressionContainerPath = null;
|
|
210
|
+
if (parentNode?.type === "LogicalExpression" && parentNode.operator === "&&" && parentNode.right === jsxElementPath.node) expressionContainerPath = parentPath.parentPath;
|
|
211
|
+
if (parentNode?.type === "ConditionalExpression" && parentNode.consequent === jsxElementPath.node) {
|
|
212
|
+
const alternate = parentNode.alternate;
|
|
213
|
+
if (alternate?.type === "NullLiteral" || alternate?.type === "BooleanLiteral" && alternate.value === false || alternate?.type === "Identifier" && alternate.name === "null") expressionContainerPath = parentPath.parentPath;
|
|
214
|
+
}
|
|
215
|
+
if (!expressionContainerPath) expressionContainerPath = findMapExpressionContainer(jsxElementPath);
|
|
216
|
+
if (expressionContainerPath?.node?.type === "JSXExpressionContainer") {
|
|
217
|
+
const originalExpression = expressionContainerPath.node.expression;
|
|
218
|
+
expressionContainerPath.replaceWith(buildAnimatePresenceJsxWrapper(originalExpression));
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
if (parentPath && isCallExpressionArg(parentPath)) {
|
|
222
|
+
const originalExpression = t.cloneNode(parentPath.node, true);
|
|
223
|
+
parentPath.replaceWith(buildAnimatePresenceJsxWrapper(originalExpression));
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
function ensureMotionWrappedJsxElement(nodePath) {
|
|
229
|
+
const nameNode = nodePath.node.name;
|
|
230
|
+
if (nameNode.type !== "JSXIdentifier") return false;
|
|
231
|
+
if (!isIntrinsicJsxTagName(nameNode.name)) return false;
|
|
232
|
+
const intrinsicTagName = nameNode.name;
|
|
233
|
+
nodePath.node.name = t.jsxMemberExpression(t.jsxIdentifier("motion"), t.jsxIdentifier(intrinsicTagName));
|
|
234
|
+
const parent = nodePath.parent;
|
|
235
|
+
if (parent.type === "JSXElement" && parent.closingElement) {
|
|
236
|
+
if (parent.closingElement.name.type === "JSXIdentifier") parent.closingElement.name = t.jsxMemberExpression(t.jsxIdentifier("motion"), t.jsxIdentifier(intrinsicTagName));
|
|
237
|
+
}
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
function setJsxAttributeIfMissing(nodePath, key, value) {
|
|
241
|
+
if (value === void 0) return false;
|
|
242
|
+
if (nodePath.node.attributes.some((attr) => attr.type === "JSXAttribute" && attr.name?.type === "JSXIdentifier" && attr.name.name === key)) return false;
|
|
243
|
+
nodePath.node.attributes.push(t.jsxAttribute(t.jsxIdentifier(key), t.jsxExpressionContainer(t.valueToNode(value))));
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Check if a value is an InterpolateMarker object.
|
|
248
|
+
*/
|
|
249
|
+
function isInterpolateMarker(value) {
|
|
250
|
+
return typeof value === "object" && value !== null && value.__type === "interpolate";
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Check if a state map contains any InterpolateMarker values.
|
|
254
|
+
*/
|
|
255
|
+
function hasInterpolateMarkers(stateMap) {
|
|
256
|
+
for (const stateKeyframe of Object.values(stateMap)) {
|
|
257
|
+
if (!stateKeyframe || typeof stateKeyframe !== "object") continue;
|
|
258
|
+
for (const value of Object.values(stateKeyframe)) if (isInterpolateMarker(value)) return true;
|
|
259
|
+
}
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Extract data-attribute conditional keyframes from inside `slotMotion.animate`.
|
|
264
|
+
* Looks for any key matching `data-*` (e.g. `'data-state'`, `'data-side'`).
|
|
265
|
+
* Returns `{ attr, stateMap }` for the first match, or null if none found.
|
|
266
|
+
*/
|
|
267
|
+
function extractDataAttrModifiers(slotMotion) {
|
|
268
|
+
const animate = slotMotion.animate;
|
|
269
|
+
if (!animate || typeof animate !== "object") return null;
|
|
270
|
+
for (const [key, value] of Object.entries(animate)) if (key.startsWith("data-") && value && typeof value === "object") return {
|
|
271
|
+
attr: key,
|
|
272
|
+
stateMap: value
|
|
273
|
+
};
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Get the base animate object with all `data-*` keys removed.
|
|
278
|
+
*/
|
|
279
|
+
function getBaseAnimate(animate) {
|
|
280
|
+
if (!animate || typeof animate !== "object") return {};
|
|
281
|
+
const base = {};
|
|
282
|
+
for (const [key, value] of Object.entries(animate)) if (!key.startsWith("data-")) base[key] = value;
|
|
283
|
+
return base;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Track hoisted motion states constants to be injected at module scope.
|
|
287
|
+
* Each entry maps a unique variable name to its states config object.
|
|
288
|
+
*/
|
|
289
|
+
const hoistedMotionStates = /* @__PURE__ */ new Map();
|
|
290
|
+
/**
|
|
291
|
+
* Get the hoisted motion states map for injection into the AST.
|
|
292
|
+
* Called by the loader after traversal to inject const declarations.
|
|
293
|
+
*/
|
|
294
|
+
function getHoistedMotionStates() {
|
|
295
|
+
return hoistedMotionStates;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Clear hoisted motion states (call at start of each file transform).
|
|
299
|
+
*/
|
|
300
|
+
function clearHoistedMotionStates() {
|
|
301
|
+
hoistedMotionStates.clear();
|
|
302
|
+
}
|
|
303
|
+
let motionStatesCounter = 0;
|
|
304
|
+
/**
|
|
305
|
+
* Build an animate expression that wraps state keyframes with resolveMotionState.
|
|
306
|
+
*
|
|
307
|
+
* For a ternary data-state={expanded ? 'expanded' : 'collapsed'} with interpolate markers:
|
|
308
|
+
* animate={__rms(expanded ? __states.expanded : __states.collapsed, index)}
|
|
309
|
+
*
|
|
310
|
+
* Without interpolate markers (plain keyframes), produces direct keyframe objects:
|
|
311
|
+
* animate={expanded ? { rotate: 180 } : { rotate: 0 }}
|
|
312
|
+
*/
|
|
313
|
+
function buildInterpolateAnimateExpr(stateExpr, _stateMap, stateValues, statesVarName, indexExpr, _baseAnimate) {
|
|
314
|
+
let stateKeyframeExpr;
|
|
315
|
+
if (stateExpr.type === "ConditionalExpression" && stateExpr.consequent.type === "StringLiteral" && stateExpr.alternate.type === "StringLiteral" && stateValues.length === 2) stateKeyframeExpr = t.conditionalExpression(stateExpr.test, t.memberExpression(t.identifier(statesVarName), t.identifier(stateExpr.consequent.value)), t.memberExpression(t.identifier(statesVarName), t.identifier(stateExpr.alternate.value)));
|
|
316
|
+
else if (stateExpr.type === "StringLiteral") stateKeyframeExpr = t.memberExpression(t.identifier(statesVarName), t.identifier(stateExpr.value));
|
|
317
|
+
else {
|
|
318
|
+
let result = t.memberExpression(t.identifier(statesVarName), t.identifier(stateValues[0]));
|
|
319
|
+
for (const sv of [...stateValues].reverse()) result = t.conditionalExpression(t.binaryExpression("===", stateExpr, t.stringLiteral(sv)), t.memberExpression(t.identifier(statesVarName), t.identifier(sv)), result);
|
|
320
|
+
stateKeyframeExpr = result;
|
|
321
|
+
}
|
|
322
|
+
return t.callExpression(t.identifier("__rms"), [stateKeyframeExpr, indexExpr]);
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Transform data-attribute modifiers on a slot element.
|
|
326
|
+
*
|
|
327
|
+
* When the motion config has:
|
|
328
|
+
* `animate: { 'data-state': { open: { rotate: 180 }, closed: { rotate: 0 } } }`
|
|
329
|
+
* and the element has `data-state={isOpen ? 'open' : 'closed'}`, the loader:
|
|
330
|
+
* 1. Keeps the data attribute (still needed for CSS modifiers)
|
|
331
|
+
* 2. Extracts the condition from the ternary expression
|
|
332
|
+
* 3. Generates: `animate={isOpen ? { rotate: 180 } : { rotate: 0 }}`
|
|
333
|
+
* 4. Sets `initial={false}` to prevent animation on first render
|
|
334
|
+
*
|
|
335
|
+
* When state keyframes contain InterpolateMarker objects, the loader:
|
|
336
|
+
* 1. Finds `data-motion-index` on the element for the index expression
|
|
337
|
+
* 2. Hoists state keyframes as a module-scope constant
|
|
338
|
+
* 3. Generates: `animate={__rms(stateKeyframe, index)}`
|
|
339
|
+
* 4. Removes `data-motion-index` from DOM attributes
|
|
340
|
+
* 5. Adds `@uds/core` import for `resolveMotionState`
|
|
341
|
+
*
|
|
342
|
+
* Returns `{ applied, needsResolveMotionStateImport }`.
|
|
343
|
+
*/
|
|
344
|
+
function transformDataModifiers(nodePath, slotMotion) {
|
|
345
|
+
const dataAttrInfo = extractDataAttrModifiers(slotMotion);
|
|
346
|
+
if (!dataAttrInfo) return {
|
|
347
|
+
applied: false,
|
|
348
|
+
needsResolveMotionStateImport: false
|
|
349
|
+
};
|
|
350
|
+
const { attr: dataAttrName, stateMap } = dataAttrInfo;
|
|
351
|
+
const stateValues = Object.keys(stateMap);
|
|
352
|
+
if (stateValues.length === 0) return {
|
|
353
|
+
applied: false,
|
|
354
|
+
needsResolveMotionStateImport: false
|
|
355
|
+
};
|
|
356
|
+
const attributes = nodePath.node.attributes;
|
|
357
|
+
const attrIndex = attributes.findIndex((a) => a.type === "JSXAttribute" && a.name?.type === "JSXIdentifier" && a.name.name === dataAttrName);
|
|
358
|
+
if (attrIndex === -1) return {
|
|
359
|
+
applied: false,
|
|
360
|
+
needsResolveMotionStateImport: false
|
|
361
|
+
};
|
|
362
|
+
const attr = attributes[attrIndex];
|
|
363
|
+
if (attr.type !== "JSXAttribute") return {
|
|
364
|
+
applied: false,
|
|
365
|
+
needsResolveMotionStateImport: false
|
|
366
|
+
};
|
|
367
|
+
const needsInterpolation = hasInterpolateMarkers(stateMap);
|
|
368
|
+
let animateExpr = null;
|
|
369
|
+
let needsResolveMotionStateImport = false;
|
|
370
|
+
const baseAnimate = getBaseAnimate(slotMotion.animate);
|
|
371
|
+
let stateExpr = null;
|
|
372
|
+
if (attr.value?.type === "JSXExpressionContainer" && attr.value.expression.type !== "JSXEmptyExpression") stateExpr = attr.value.expression;
|
|
373
|
+
else if (attr.value?.type === "StringLiteral") stateExpr = t.stringLiteral(attr.value.value);
|
|
374
|
+
if (!stateExpr) return {
|
|
375
|
+
applied: false,
|
|
376
|
+
needsResolveMotionStateImport: false
|
|
377
|
+
};
|
|
378
|
+
if (needsInterpolation) {
|
|
379
|
+
const indexAttrIndex = attributes.findIndex((a) => a.type === "JSXAttribute" && a.name?.type === "JSXIdentifier" && a.name.name === "data-motion-index");
|
|
380
|
+
if (indexAttrIndex === -1) return {
|
|
381
|
+
applied: false,
|
|
382
|
+
needsResolveMotionStateImport: false
|
|
383
|
+
};
|
|
384
|
+
const indexAttr = attributes[indexAttrIndex];
|
|
385
|
+
let indexExpr = null;
|
|
386
|
+
if (indexAttr.value?.type === "JSXExpressionContainer" && indexAttr.value.expression.type !== "JSXEmptyExpression") indexExpr = indexAttr.value.expression;
|
|
387
|
+
else if (indexAttr.value?.type === "StringLiteral") indexExpr = t.numericLiteral(Number.parseInt(indexAttr.value.value, 10));
|
|
388
|
+
if (!indexExpr) return {
|
|
389
|
+
applied: false,
|
|
390
|
+
needsResolveMotionStateImport: false
|
|
391
|
+
};
|
|
392
|
+
const statesVarName = `__motion_states_${motionStatesCounter++}`;
|
|
393
|
+
hoistedMotionStates.set(statesVarName, stateMap);
|
|
394
|
+
animateExpr = buildInterpolateAnimateExpr(stateExpr, stateMap, stateValues, statesVarName, indexExpr, baseAnimate);
|
|
395
|
+
needsResolveMotionStateImport = true;
|
|
396
|
+
attributes.splice(indexAttrIndex, 1);
|
|
397
|
+
} else {
|
|
398
|
+
if (stateExpr.type === "StringLiteral") {
|
|
399
|
+
const staticValue = stateExpr.value;
|
|
400
|
+
animateExpr = stateMap[staticValue] ? t.valueToNode(stateMap[staticValue]) : t.valueToNode(baseAnimate);
|
|
401
|
+
} else if (stateExpr.type === "ConditionalExpression" && stateValues.length === 2) {
|
|
402
|
+
const { test, consequent, alternate } = stateExpr;
|
|
403
|
+
const consequentValue = consequent.type === "StringLiteral" ? consequent.value : null;
|
|
404
|
+
const alternateValue = alternate.type === "StringLiteral" ? alternate.value : null;
|
|
405
|
+
if (consequentValue && alternateValue && stateMap[consequentValue] !== void 0 && stateMap[alternateValue] !== void 0) animateExpr = t.conditionalExpression(test, t.valueToNode(stateMap[consequentValue]), t.valueToNode(stateMap[alternateValue]));
|
|
406
|
+
}
|
|
407
|
+
if (!animateExpr) {
|
|
408
|
+
let result = t.valueToNode(baseAnimate);
|
|
409
|
+
for (const stateValue of [...stateValues].reverse()) result = t.conditionalExpression(t.binaryExpression("===", stateExpr, t.stringLiteral(stateValue)), t.valueToNode(stateMap[stateValue]), result);
|
|
410
|
+
animateExpr = result;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if (!animateExpr) return {
|
|
414
|
+
applied: false,
|
|
415
|
+
needsResolveMotionStateImport: false
|
|
416
|
+
};
|
|
417
|
+
const existingAnimateIndex = attributes.findIndex((a) => a.type === "JSXAttribute" && a.name?.type === "JSXIdentifier" && a.name.name === "animate");
|
|
418
|
+
const animateAttr = t.jsxAttribute(t.jsxIdentifier("animate"), t.jsxExpressionContainer(animateExpr));
|
|
419
|
+
if (existingAnimateIndex !== -1) attributes[existingAnimateIndex] = animateAttr;
|
|
420
|
+
else attributes.push(animateAttr);
|
|
421
|
+
const existingInitialIndex = attributes.findIndex((a) => a.type === "JSXAttribute" && a.name?.type === "JSXIdentifier" && a.name.name === "initial");
|
|
422
|
+
const initialValue = slotMotion.initial ? t.valueToNode(slotMotion.initial) : t.booleanLiteral(false);
|
|
423
|
+
const initialAttr = t.jsxAttribute(t.jsxIdentifier("initial"), t.jsxExpressionContainer(initialValue));
|
|
424
|
+
if (existingInitialIndex !== -1) attributes[existingInitialIndex] = initialAttr;
|
|
425
|
+
else attributes.push(initialAttr);
|
|
426
|
+
return {
|
|
427
|
+
applied: true,
|
|
428
|
+
needsResolveMotionStateImport
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Detect and transform a boolean-toggle `animate` attribute on a slot element.
|
|
433
|
+
*
|
|
434
|
+
* When a component author writes `animate={expression}` where the expression
|
|
435
|
+
* is NOT an ObjectExpression (e.g. `animate={isOpen}`), and the slot motion
|
|
436
|
+
* config has both `initial` and `animate`, the expression is treated as a
|
|
437
|
+
* boolean toggle condition. The loader transforms it to:
|
|
438
|
+
*
|
|
439
|
+
* initial={false}
|
|
440
|
+
* animate={expression ? configAnimate : configInitial}
|
|
441
|
+
*
|
|
442
|
+
* This lets the component author signal *when* to toggle between states,
|
|
443
|
+
* while the config defines *what* those states are.
|
|
444
|
+
*
|
|
445
|
+
* Returns true if the toggle transform was applied.
|
|
446
|
+
*/
|
|
447
|
+
function transformToggleAnimate(nodePath, slotMotion) {
|
|
448
|
+
if (!slotMotion.initial || !slotMotion.animate) return false;
|
|
449
|
+
const animateAttrIndex = nodePath.node.attributes.findIndex((attr) => attr.type === "JSXAttribute" && attr.name?.type === "JSXIdentifier" && attr.name.name === "animate");
|
|
450
|
+
if (animateAttrIndex === -1) return false;
|
|
451
|
+
const animateAttr = nodePath.node.attributes[animateAttrIndex];
|
|
452
|
+
if (animateAttr.type !== "JSXAttribute") return false;
|
|
453
|
+
let conditionExpr = null;
|
|
454
|
+
if (animateAttr.value?.type === "JSXExpressionContainer" && animateAttr.value.expression.type !== "JSXEmptyExpression") {
|
|
455
|
+
const expr = animateAttr.value.expression;
|
|
456
|
+
if (expr.type === "ObjectExpression") return false;
|
|
457
|
+
conditionExpr = expr;
|
|
458
|
+
}
|
|
459
|
+
if (!conditionExpr) return false;
|
|
460
|
+
animateAttr.value = t.jsxExpressionContainer(t.conditionalExpression(conditionExpr, t.valueToNode(slotMotion.animate), t.valueToNode(slotMotion.initial)));
|
|
461
|
+
const initialAttrIndex = nodePath.node.attributes.findIndex((attr) => attr.type === "JSXAttribute" && attr.name?.type === "JSXIdentifier" && attr.name.name === "initial");
|
|
462
|
+
const initialFalseAttr = t.jsxAttribute(t.jsxIdentifier("initial"), t.jsxExpressionContainer(t.booleanLiteral(false)));
|
|
463
|
+
if (initialAttrIndex !== -1) nodePath.node.attributes[initialAttrIndex] = initialFalseAttr;
|
|
464
|
+
else nodePath.node.attributes.push(initialFalseAttr);
|
|
465
|
+
return true;
|
|
466
|
+
}
|
|
467
|
+
function applySlotMotionToElement(nodePath, slotMotion, options) {
|
|
468
|
+
if (!ensureMotionWrappedJsxElement(nodePath)) return {
|
|
469
|
+
transformed: false,
|
|
470
|
+
needsResolveMotionStateImport: false
|
|
471
|
+
};
|
|
472
|
+
if (options?.injectAttributes === false) return {
|
|
473
|
+
transformed: true,
|
|
474
|
+
needsResolveMotionStateImport: false
|
|
475
|
+
};
|
|
476
|
+
const dataModResult = transformDataModifiers(nodePath, slotMotion);
|
|
477
|
+
const hasDataModifier = dataModResult.applied;
|
|
478
|
+
const needsResolveMotionStateImport = dataModResult.needsResolveMotionStateImport;
|
|
479
|
+
const isToggle = !hasDataModifier && transformToggleAnimate(nodePath, slotMotion);
|
|
480
|
+
let transformed = hasDataModifier || isToggle;
|
|
481
|
+
if (!hasDataModifier && !isToggle) {
|
|
482
|
+
transformed = setJsxAttributeIfMissing(nodePath, "initial", slotMotion.initial) || transformed;
|
|
483
|
+
const baseAnimate = getBaseAnimate(slotMotion.animate);
|
|
484
|
+
transformed = setJsxAttributeIfMissing(nodePath, "animate", Object.keys(baseAnimate).length > 0 ? baseAnimate : slotMotion.animate) || transformed;
|
|
485
|
+
}
|
|
486
|
+
transformed = setJsxAttributeIfMissing(nodePath, "exit", slotMotion.exit) || transformed;
|
|
487
|
+
transformed = setJsxAttributeIfMissing(nodePath, "transition", slotMotion.transition) || transformed;
|
|
488
|
+
transformed = setJsxAttributeIfMissing(nodePath, "whileHover", slotMotion.whileHover) || transformed;
|
|
489
|
+
transformed = setJsxAttributeIfMissing(nodePath, "whileTap", slotMotion.whileTap) || transformed;
|
|
490
|
+
transformed = setJsxAttributeIfMissing(nodePath, "drag", slotMotion.drag) || transformed;
|
|
491
|
+
transformed = setJsxAttributeIfMissing(nodePath, "dragConstraints", slotMotion.dragConstraints) || transformed;
|
|
492
|
+
transformed = setJsxAttributeIfMissing(nodePath, "dragElastic", slotMotion.dragElastic) || transformed;
|
|
493
|
+
transformed = setJsxAttributeIfMissing(nodePath, "dragSnapToOrigin", slotMotion.dragSnapToOrigin) || transformed;
|
|
494
|
+
transformed = setJsxAttributeIfMissing(nodePath, "layout", slotMotion.layout) || transformed;
|
|
495
|
+
return {
|
|
496
|
+
transformed,
|
|
497
|
+
needsResolveMotionStateImport
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Handle motion transforms on a JSX opening element.
|
|
502
|
+
* Returns true if the element was transformed.
|
|
503
|
+
*/
|
|
504
|
+
function handleMotionOnElement(nodePath, manifest, customComponents, primitiveComponents, importsToAdd) {
|
|
505
|
+
const nameNode = nodePath.node.name;
|
|
506
|
+
if (nameNode.type !== "JSXIdentifier") return false;
|
|
507
|
+
const componentName = nameNode.name;
|
|
508
|
+
const motionAttrIndex = nodePath.node.attributes.findIndex((attr) => attr.type === "JSXAttribute" && attr.name.name === "motion");
|
|
509
|
+
if (motionAttrIndex === -1) return false;
|
|
510
|
+
if (!manifest) return false;
|
|
511
|
+
if (primitiveComponents.has(componentName)) {
|
|
512
|
+
const motionAttr = nodePath.node.attributes[motionAttrIndex];
|
|
513
|
+
if (motionAttr.type !== "JSXAttribute") return false;
|
|
514
|
+
const valueNode = motionAttr.value;
|
|
515
|
+
if (!valueNode) return false;
|
|
516
|
+
let presetName = null;
|
|
517
|
+
if (valueNode.type === "StringLiteral") presetName = valueNode.value;
|
|
518
|
+
else if (valueNode.type === "JSXExpressionContainer" && valueNode.expression.type !== "JSXEmptyExpression") if (valueNode.expression.type === "StringLiteral") presetName = valueNode.expression.value;
|
|
519
|
+
else {
|
|
520
|
+
swapMotionComponent(nodePath, {
|
|
521
|
+
componentName: `${componentName}WithInlineMotion`,
|
|
522
|
+
importPath: `.uds/motion-components/${componentName}WithInlineMotion`
|
|
523
|
+
}, importsToAdd);
|
|
524
|
+
return true;
|
|
525
|
+
}
|
|
526
|
+
if (!presetName) return false;
|
|
527
|
+
const presetInfo = manifest.presets[presetName];
|
|
528
|
+
if (!presetInfo) return false;
|
|
529
|
+
nodePath.node.attributes.splice(motionAttrIndex, 1);
|
|
530
|
+
if (presetInfo.runtime === "css") injectMotionCssClass(nodePath, presetName);
|
|
531
|
+
else {
|
|
532
|
+
const compInfo = manifest.components[componentName]?.presets[presetName];
|
|
533
|
+
if (!compInfo) return false;
|
|
534
|
+
swapMotionComponent(nodePath, compInfo, importsToAdd);
|
|
535
|
+
}
|
|
536
|
+
return true;
|
|
537
|
+
}
|
|
538
|
+
if (customComponents?.has(componentName)) {
|
|
539
|
+
const motionAttr = nodePath.node.attributes[motionAttrIndex];
|
|
540
|
+
if (motionAttr.type !== "JSXAttribute") return false;
|
|
541
|
+
const valueNode = motionAttr.value;
|
|
542
|
+
if (!valueNode || valueNode.type !== "StringLiteral") return false;
|
|
543
|
+
const presetName = valueNode.value;
|
|
544
|
+
const presetInfo = manifest.presets[presetName];
|
|
545
|
+
if (!presetInfo) return false;
|
|
546
|
+
nodePath.node.attributes.splice(motionAttrIndex, 1);
|
|
547
|
+
if (presetInfo.runtime === "css") injectCustomComponentCssClass(nodePath, presetName);
|
|
548
|
+
return true;
|
|
549
|
+
}
|
|
550
|
+
return false;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Inject a `motion-{presetName}` CSS class into the className of a JSX element.
|
|
554
|
+
*/
|
|
555
|
+
function injectMotionCssClass(nodePath, presetName) {
|
|
556
|
+
const classNameAttr = nodePath.node.attributes.find((attr) => attr.type === "JSXAttribute" && attr.name.name === "className");
|
|
557
|
+
if (classNameAttr && classNameAttr.type === "JSXAttribute") {
|
|
558
|
+
if (classNameAttr.value?.type === "StringLiteral") classNameAttr.value.value += ` motion-${presetName}`;
|
|
559
|
+
else if (classNameAttr.value?.type === "JSXExpressionContainer" && classNameAttr.value.expression.type !== "JSXEmptyExpression") {
|
|
560
|
+
const existingExpr = classNameAttr.value.expression;
|
|
561
|
+
classNameAttr.value = t.jsxExpressionContainer(t.templateLiteral([t.templateElement({
|
|
562
|
+
raw: "",
|
|
563
|
+
cooked: ""
|
|
564
|
+
}), t.templateElement({
|
|
565
|
+
raw: ` motion-${presetName}`,
|
|
566
|
+
cooked: ` motion-${presetName}`
|
|
567
|
+
}, true)], [existingExpr]));
|
|
568
|
+
}
|
|
569
|
+
} else nodePath.node.attributes.push(t.jsxAttribute(t.jsxIdentifier("className"), t.stringLiteral(`motion-${presetName}`)));
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Inject a `motion-{presetName}` class into a custom component's internal class prop.
|
|
573
|
+
*/
|
|
574
|
+
function injectCustomComponentCssClass(nodePath, presetName) {
|
|
575
|
+
const classNameAttr = nodePath.node.attributes.find((attr) => attr.type === "JSXAttribute" && attr.name.type === "JSXIdentifier" && attr.name.name === "data-uds-class");
|
|
576
|
+
if (classNameAttr) {
|
|
577
|
+
if (classNameAttr.value?.type === "StringLiteral") classNameAttr.value.value += ` motion-${presetName}`;
|
|
578
|
+
else if (classNameAttr.value?.type === "JSXExpressionContainer" && classNameAttr.value.expression.type !== "JSXEmptyExpression") {
|
|
579
|
+
const existingExpr = classNameAttr.value.expression;
|
|
580
|
+
classNameAttr.value = t.jsxExpressionContainer(t.templateLiteral([t.templateElement({
|
|
581
|
+
raw: "",
|
|
582
|
+
cooked: ""
|
|
583
|
+
}), t.templateElement({
|
|
584
|
+
raw: ` motion-${presetName}`,
|
|
585
|
+
cooked: ` motion-${presetName}`
|
|
586
|
+
}, true)], [existingExpr]));
|
|
587
|
+
}
|
|
588
|
+
} else nodePath.node.attributes.push(t.jsxAttribute(t.jsxIdentifier("data-uds-class"), t.stringLiteral(`motion-${presetName}`)));
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Swap a JSX component to a generated motion wrapper component (JS runtime).
|
|
592
|
+
*/
|
|
593
|
+
function swapMotionComponent(nodePath, compInfo, importsToAdd) {
|
|
594
|
+
const nameNode = nodePath.node.name;
|
|
595
|
+
nameNode.name = compInfo.componentName;
|
|
596
|
+
const parent = nodePath.parent;
|
|
597
|
+
if (parent.type === "JSXElement" && parent.closingElement) {
|
|
598
|
+
const closingName = parent.closingElement.name;
|
|
599
|
+
if (closingName.type === "JSXIdentifier") closingName.name = compInfo.componentName;
|
|
600
|
+
}
|
|
601
|
+
importsToAdd.set(compInfo.componentName, compInfo.importPath);
|
|
602
|
+
}
|
|
603
|
+
function hasCompiledProp(propsArg, key) {
|
|
604
|
+
return propsArg.properties.some((prop) => prop.type === "ObjectProperty" && (prop.key.type === "Identifier" && prop.key.name === key || prop.key.type === "StringLiteral" && prop.key.value === key));
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Find a compiled prop by key and return its value node.
|
|
608
|
+
*/
|
|
609
|
+
function getCompiledPropValue(propsArg, key) {
|
|
610
|
+
for (const prop of propsArg.properties) {
|
|
611
|
+
if (prop.type !== "ObjectProperty") continue;
|
|
612
|
+
if (prop.key.type === "Identifier" && prop.key.name === key || prop.key.type === "StringLiteral" && prop.key.value === key) return prop.value;
|
|
613
|
+
}
|
|
614
|
+
return null;
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Handle data-attribute modifiers in compiled JSX.
|
|
618
|
+
* Finds the matching data-* prop, extracts the condition, and builds
|
|
619
|
+
* a ternary animate expression.
|
|
620
|
+
*/
|
|
621
|
+
function handleCompiledDataAttrModifiers(propsArg, slotMotion) {
|
|
622
|
+
const dataAttrInfo = extractDataAttrModifiers(slotMotion);
|
|
623
|
+
if (!dataAttrInfo) return {
|
|
624
|
+
applied: false,
|
|
625
|
+
needsResolveMotionStateImport: false
|
|
626
|
+
};
|
|
627
|
+
const { attr: dataAttrName, stateMap } = dataAttrInfo;
|
|
628
|
+
const stateValues = Object.keys(stateMap);
|
|
629
|
+
if (stateValues.length === 0) return {
|
|
630
|
+
applied: false,
|
|
631
|
+
needsResolveMotionStateImport: false
|
|
632
|
+
};
|
|
633
|
+
const dataStateValue = getCompiledPropValue(propsArg, dataAttrName);
|
|
634
|
+
if (!dataStateValue) return {
|
|
635
|
+
applied: false,
|
|
636
|
+
needsResolveMotionStateImport: false
|
|
637
|
+
};
|
|
638
|
+
const needsInterpolation = hasInterpolateMarkers(stateMap);
|
|
639
|
+
let animateExpr = null;
|
|
640
|
+
let needsResolveMotionStateImport = false;
|
|
641
|
+
if (needsInterpolation) {
|
|
642
|
+
const indexValue = getCompiledPropValue(propsArg, "data-motion-index");
|
|
643
|
+
if (!indexValue) return {
|
|
644
|
+
applied: false,
|
|
645
|
+
needsResolveMotionStateImport: false
|
|
646
|
+
};
|
|
647
|
+
const statesVarName = `__motion_states_${motionStatesCounter++}`;
|
|
648
|
+
hoistedMotionStates.set(statesVarName, stateMap);
|
|
649
|
+
animateExpr = buildInterpolateAnimateExpr(dataStateValue, stateMap, stateValues, statesVarName, indexValue, {});
|
|
650
|
+
needsResolveMotionStateImport = true;
|
|
651
|
+
propsArg.properties = propsArg.properties.filter((prop) => {
|
|
652
|
+
if (prop.type !== "ObjectProperty") return true;
|
|
653
|
+
return (prop.key.type === "Identifier" ? prop.key.name : prop.key.type === "StringLiteral" ? prop.key.value : null) !== "data-motion-index";
|
|
654
|
+
});
|
|
655
|
+
} else {
|
|
656
|
+
const baseAnimate = getBaseAnimate(slotMotion.animate);
|
|
657
|
+
if (dataStateValue.type === "ConditionalExpression" && stateValues.length === 2) {
|
|
658
|
+
const { test, consequent, alternate } = dataStateValue;
|
|
659
|
+
const consequentValue = consequent.type === "StringLiteral" ? consequent.value : null;
|
|
660
|
+
const alternateValue = alternate.type === "StringLiteral" ? alternate.value : null;
|
|
661
|
+
if (consequentValue && alternateValue && stateMap[consequentValue] !== void 0 && stateMap[alternateValue] !== void 0) animateExpr = t.conditionalExpression(test, t.valueToNode(stateMap[consequentValue]), t.valueToNode(stateMap[alternateValue]));
|
|
662
|
+
}
|
|
663
|
+
if (!animateExpr) {
|
|
664
|
+
let result = t.valueToNode(baseAnimate);
|
|
665
|
+
for (const stateValue of [...stateValues].reverse()) result = t.conditionalExpression(t.binaryExpression("===", dataStateValue, t.stringLiteral(stateValue)), t.valueToNode(stateMap[stateValue]), result);
|
|
666
|
+
animateExpr = result;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
if (!animateExpr) return {
|
|
670
|
+
applied: false,
|
|
671
|
+
needsResolveMotionStateImport: false
|
|
672
|
+
};
|
|
673
|
+
const initialValue = slotMotion.initial ? t.valueToNode(slotMotion.initial) : t.booleanLiteral(false);
|
|
674
|
+
propsArg.properties.push(t.objectProperty(t.identifier("animate"), animateExpr), t.objectProperty(t.identifier("initial"), initialValue));
|
|
675
|
+
return {
|
|
676
|
+
applied: true,
|
|
677
|
+
needsResolveMotionStateImport
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
function applySlotMotionToCompiledJsx(args, propsArg, slotMotion) {
|
|
681
|
+
const tagArg = args[0];
|
|
682
|
+
let transformed = false;
|
|
683
|
+
let canApplyMotionProps = false;
|
|
684
|
+
let needsResolveMotionStateImport = false;
|
|
685
|
+
if (tagArg?.type === "StringLiteral" && isIntrinsicJsxTagName(tagArg.value)) {
|
|
686
|
+
args[0] = t.memberExpression(t.identifier("motion"), t.identifier(tagArg.value));
|
|
687
|
+
transformed = true;
|
|
688
|
+
canApplyMotionProps = true;
|
|
689
|
+
} else if (tagArg?.type === "MemberExpression" && tagArg.object?.type === "Identifier" && tagArg.object.name === "motion") canApplyMotionProps = true;
|
|
690
|
+
if (!canApplyMotionProps) return {
|
|
691
|
+
transformed: false,
|
|
692
|
+
needsMotionImport: false,
|
|
693
|
+
hasExit: false,
|
|
694
|
+
needsResolveMotionStateImport: false
|
|
695
|
+
};
|
|
696
|
+
const dataModResult = handleCompiledDataAttrModifiers(propsArg, slotMotion);
|
|
697
|
+
const hasDataStateModifier = dataModResult.applied;
|
|
698
|
+
if (dataModResult.needsResolveMotionStateImport) needsResolveMotionStateImport = true;
|
|
699
|
+
for (const [key, value] of Object.entries(slotMotion)) {
|
|
700
|
+
if (key === "runtime" || value === void 0 || hasCompiledProp(propsArg, key)) continue;
|
|
701
|
+
propsArg.properties.push(t.objectProperty(t.identifier(key), t.valueToNode(value)));
|
|
702
|
+
transformed = true;
|
|
703
|
+
}
|
|
704
|
+
if (hasDataStateModifier) transformed = true;
|
|
705
|
+
const hasExit = slotMotion.exit !== void 0;
|
|
706
|
+
if (hasExit) {
|
|
707
|
+
if (args.length < 3) args.push(t.stringLiteral("exit-motion"));
|
|
708
|
+
}
|
|
709
|
+
return {
|
|
710
|
+
transformed,
|
|
711
|
+
needsMotionImport: transformed,
|
|
712
|
+
hasExit,
|
|
713
|
+
needsResolveMotionStateImport
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
//#endregion
|
|
717
|
+
export { applySlotMotionToCompiledJsx, applySlotMotionToElement, clearHoistedMotionStates, componentHasExitMotion, getCustomSlotMotion, getHoistedMotionStates, handleMotionOnElement, wrapCompiledConditionalWithAnimatePresence, wrapCustomComponentWithAnimatePresence, wrapParentConditionalWithAnimatePresence };
|