@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,670 @@
|
|
|
1
|
+
import { applyComponentStyleDefaults } from "../../../utils/dist/component-style-defaults.js";
|
|
2
|
+
import { kebabCase } from "../../../utils/dist/string-utils/kebabCase.js";
|
|
3
|
+
import { componentVariantClass } from "../../../utils/dist/string-utils/componentClassName.js";
|
|
4
|
+
import "../../../utils/dist/index.js";
|
|
5
|
+
import { expandMacros } from "../packages/core/dist/macros.js";
|
|
6
|
+
import { colorPropToOpacityProp, propMappings } from "../packages/core/dist/propMappings.js";
|
|
7
|
+
import { toCamelCase } from "../packages/core/dist/getStyles.js";
|
|
8
|
+
import "../packages/core/dist/index.js";
|
|
9
|
+
import { buildDynamicClassExpression, parseHandlerString } from "./dynamic-style-codegen.js";
|
|
10
|
+
import * as t from "@babel/types";
|
|
11
|
+
//#region ../loader/dist/loader/style-transform.js
|
|
12
|
+
const parseClassToken = (prefix, value) => {
|
|
13
|
+
if (value === "") return prefix;
|
|
14
|
+
return (prefix === value ? String(value) : `${prefix}-${value}`).replace(/[./]/g, "_");
|
|
15
|
+
};
|
|
16
|
+
function parseStaticExpression(expression) {
|
|
17
|
+
if (t.isStringLiteral(expression)) return expression.value;
|
|
18
|
+
if (t.isNumericLiteral(expression)) return expression.value;
|
|
19
|
+
if (t.isBooleanLiteral(expression)) return expression.value;
|
|
20
|
+
if (t.isNullLiteral(expression)) return null;
|
|
21
|
+
if (t.isTemplateLiteral(expression) && expression.expressions.length === 0 && expression.quasis.length === 1) return expression.quasis[0]?.value.cooked ?? "";
|
|
22
|
+
if (t.isUnaryExpression(expression) && expression.operator === "-" && t.isNumericLiteral(expression.argument)) return -expression.argument.value;
|
|
23
|
+
if (t.isObjectExpression(expression)) {
|
|
24
|
+
const result = {};
|
|
25
|
+
for (const property of expression.properties) {
|
|
26
|
+
if (!t.isObjectProperty(property) || property.computed) return;
|
|
27
|
+
const key = t.isIdentifier(property.key) ? property.key.name : t.isStringLiteral(property.key) ? property.key.value : void 0;
|
|
28
|
+
if (!key || !t.isExpression(property.value)) return;
|
|
29
|
+
const parsedValue = parseStaticExpression(property.value);
|
|
30
|
+
if (parsedValue === void 0) return void 0;
|
|
31
|
+
result[key] = parsedValue;
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function parseStaticJsxAttributeValue(attribute) {
|
|
37
|
+
if (!attribute.value) return true;
|
|
38
|
+
if (t.isStringLiteral(attribute.value)) return attribute.value.value;
|
|
39
|
+
if (t.isJSXExpressionContainer(attribute.value) && !t.isJSXEmptyExpression(attribute.value.expression)) return parseStaticExpression(attribute.value.expression);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Extract the dynamic expression from a JSX attribute value.
|
|
43
|
+
* Returns null if the attribute is static (handled by parseStaticJsxAttributeValue).
|
|
44
|
+
*/
|
|
45
|
+
function getDynamicJsxAttributeExpression(attribute) {
|
|
46
|
+
if (!attribute.value) return null;
|
|
47
|
+
if (t.isStringLiteral(attribute.value)) return null;
|
|
48
|
+
if (t.isJSXExpressionContainer(attribute.value) && !t.isJSXEmptyExpression(attribute.value.expression)) {
|
|
49
|
+
const expr = attribute.value.expression;
|
|
50
|
+
if (parseStaticExpression(expr) !== void 0) return null;
|
|
51
|
+
return expr;
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Try to compile a conditional/logical expression where all branches are
|
|
57
|
+
* statically resolvable. Returns a clean ternary/logical with pre-compiled
|
|
58
|
+
* class names, or null if not all branches are static.
|
|
59
|
+
*
|
|
60
|
+
* e.g. `color={isActive ? 'on-primary' : 'on-secondary'}`
|
|
61
|
+
* → `isActive ? 'color-on-primary' : 'color-on-secondary'`
|
|
62
|
+
*/
|
|
63
|
+
function tryCompileStaticBranchExpression(expr, handler, modifierPrefix) {
|
|
64
|
+
if (t.isConditionalExpression(expr)) {
|
|
65
|
+
const consequentValue = parseStaticExpression(expr.consequent);
|
|
66
|
+
const alternateValue = parseStaticExpression(expr.alternate);
|
|
67
|
+
if (consequentValue !== void 0 && alternateValue !== void 0) {
|
|
68
|
+
const consequentClass = String(handler(consequentValue));
|
|
69
|
+
const alternateClass = String(handler(alternateValue));
|
|
70
|
+
const fullConsequent = modifierPrefix ? `${modifierPrefix}${consequentClass}` : consequentClass;
|
|
71
|
+
const fullAlternate = modifierPrefix ? `${modifierPrefix}${alternateClass}` : alternateClass;
|
|
72
|
+
return t.conditionalExpression(t.cloneNode(expr.test), t.stringLiteral(fullConsequent), t.stringLiteral(fullAlternate));
|
|
73
|
+
}
|
|
74
|
+
const compiledConsequent = consequentValue !== void 0 ? t.stringLiteral(modifierPrefix ? `${modifierPrefix}${String(handler(consequentValue))}` : String(handler(consequentValue))) : tryCompileStaticBranchExpression(expr.consequent, handler, modifierPrefix);
|
|
75
|
+
const compiledAlternate = alternateValue !== void 0 ? t.stringLiteral(modifierPrefix ? `${modifierPrefix}${String(handler(alternateValue))}` : String(handler(alternateValue))) : tryCompileStaticBranchExpression(expr.alternate, handler, modifierPrefix);
|
|
76
|
+
if (compiledConsequent && compiledAlternate) return t.conditionalExpression(t.cloneNode(expr.test), compiledConsequent, compiledAlternate);
|
|
77
|
+
}
|
|
78
|
+
if (t.isLogicalExpression(expr) && expr.operator === "&&") {
|
|
79
|
+
const rightValue = parseStaticExpression(expr.right);
|
|
80
|
+
if (rightValue !== void 0) {
|
|
81
|
+
const rightClass = String(handler(rightValue));
|
|
82
|
+
const fullRight = modifierPrefix ? `${modifierPrefix}${rightClass}` : rightClass;
|
|
83
|
+
return t.logicalExpression("&&", t.cloneNode(expr.left), t.stringLiteral(fullRight));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
function buildClassJoinExpression(parts) {
|
|
89
|
+
return t.callExpression(t.memberExpression(t.callExpression(t.memberExpression(t.arrayExpression(parts), t.identifier("filter")), [t.identifier("Boolean")]), t.identifier("join")), [t.stringLiteral(" ")]);
|
|
90
|
+
}
|
|
91
|
+
function getStaticMemberKey(node) {
|
|
92
|
+
if (!node.computed) {
|
|
93
|
+
if (t.isIdentifier(node.property)) return node.property.name;
|
|
94
|
+
if (t.isStringLiteral(node.property)) return node.property.value;
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
if (t.isStringLiteral(node.property)) return node.property.value;
|
|
98
|
+
if (t.isNumericLiteral(node.property)) return String(node.property.value);
|
|
99
|
+
if (t.isTemplateLiteral(node.property) && node.property.expressions.length === 0 && node.property.quasis.length === 1) return node.property.quasis[0]?.value.cooked ?? "";
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
function getStaticObjectPropertyKey(property) {
|
|
103
|
+
if (property.computed) return null;
|
|
104
|
+
if (t.isIdentifier(property.key)) return property.key.name;
|
|
105
|
+
if (t.isStringLiteral(property.key)) return property.key.value;
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
function upsertClassNameAttribute(attributes, classExpression) {
|
|
109
|
+
const classAttr = attributes.find((attr) => t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name) && attr.name.name === "className");
|
|
110
|
+
if (!classAttr) {
|
|
111
|
+
attributes.push(t.jsxAttribute(t.jsxIdentifier("className"), t.jsxExpressionContainer(classExpression)));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
let existingExpression = null;
|
|
115
|
+
if (!classAttr.value) existingExpression = t.booleanLiteral(true);
|
|
116
|
+
else if (t.isStringLiteral(classAttr.value)) existingExpression = t.stringLiteral(classAttr.value.value);
|
|
117
|
+
else if (t.isJSXExpressionContainer(classAttr.value) && !t.isJSXEmptyExpression(classAttr.value.expression)) existingExpression = classAttr.value.expression;
|
|
118
|
+
const nextExpression = existingExpression ? buildClassJoinExpression([existingExpression, classExpression]) : classExpression;
|
|
119
|
+
classAttr.value = t.jsxExpressionContainer(nextExpression);
|
|
120
|
+
}
|
|
121
|
+
function createStyleTransformRuntime(transformData, manifest) {
|
|
122
|
+
const manifestAllComponents = manifest ? Object.keys(manifest.components) : [];
|
|
123
|
+
const manifestPrimitiveComponents = manifest ? Object.entries(manifest.components).filter(([, entry]) => entry.type === "primitive").map(([name]) => name) : [];
|
|
124
|
+
const allComponents = new Set([...transformData?.allComponents ?? [], ...manifestAllComponents]);
|
|
125
|
+
const primitiveComponents = new Set([...transformData?.primitiveComponents ?? [], ...manifestPrimitiveComponents]);
|
|
126
|
+
const componentTagPatterns = [...allComponents].flatMap((name) => [`<${name}`, `(${name},`]);
|
|
127
|
+
const safeStyleProps = transformData?.safeStyleProps ?? transformData?.styleAndModifierProps ?? [];
|
|
128
|
+
const styleAndModifierPropSet = new Set(safeStyleProps);
|
|
129
|
+
const classnamesMap = transformData?.classnamesMap ?? {};
|
|
130
|
+
const modifiersTwMap = transformData?.modifiersTwMap ?? {};
|
|
131
|
+
const stylePropHandlerMap = {};
|
|
132
|
+
const parsedHandlerCache = /* @__PURE__ */ new Map();
|
|
133
|
+
for (const [key, fnBody] of Object.entries(classnamesMap)) stylePropHandlerMap[key] = new Function("parse", `return ${fnBody}`)(parseClassToken);
|
|
134
|
+
function getParsedHandler(propName) {
|
|
135
|
+
if (parsedHandlerCache.has(propName)) return parsedHandlerCache.get(propName) ?? null;
|
|
136
|
+
const handlerStr = classnamesMap[propName];
|
|
137
|
+
if (!handlerStr) {
|
|
138
|
+
parsedHandlerCache.set(propName, null);
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
const parsed = parseHandlerString(handlerStr);
|
|
142
|
+
parsedHandlerCache.set(propName, parsed);
|
|
143
|
+
return parsed;
|
|
144
|
+
}
|
|
145
|
+
const componentClassDataMap = transformData?.componentClassData;
|
|
146
|
+
function getComponentVariantData(componentName) {
|
|
147
|
+
const data = componentClassDataMap?.[componentName];
|
|
148
|
+
if (!data) return null;
|
|
149
|
+
const hasVariants = data.variantClassNames && Object.keys(data.variantClassNames).length > 0;
|
|
150
|
+
const hasDefaults = data.defaultVariants && Object.keys(data.defaultVariants).length > 0;
|
|
151
|
+
if (!hasVariants && !hasDefaults) return null;
|
|
152
|
+
return data;
|
|
153
|
+
}
|
|
154
|
+
function isStyleLikeProp(propName) {
|
|
155
|
+
return styleAndModifierPropSet.has(propName) || propName.startsWith("_");
|
|
156
|
+
}
|
|
157
|
+
function compileStyleClassName(styleProps, modifierPrefix = "") {
|
|
158
|
+
const macroConf = transformData?.macroConfig ?? {};
|
|
159
|
+
let effectiveProps = styleProps;
|
|
160
|
+
if (Object.keys(macroConf).length > 0 && !modifierPrefix) {
|
|
161
|
+
const { expanded, markerClasses } = expandMacros(styleProps, macroConf);
|
|
162
|
+
effectiveProps = expanded;
|
|
163
|
+
if (markerClasses.length > 0) effectiveProps.__macroMarkers = markerClasses;
|
|
164
|
+
}
|
|
165
|
+
for (const [colorProp, opacityPropName] of Object.entries(colorPropToOpacityProp)) if (effectiveProps[opacityPropName] !== void 0 && effectiveProps[colorProp] !== void 0) {
|
|
166
|
+
effectiveProps[colorProp] = `${effectiveProps[colorProp]}/${effectiveProps[opacityPropName]}`;
|
|
167
|
+
delete effectiveProps[opacityPropName];
|
|
168
|
+
}
|
|
169
|
+
const classParts = [];
|
|
170
|
+
if (Array.isArray(effectiveProps.__macroMarkers)) {
|
|
171
|
+
classParts.push(...effectiveProps.__macroMarkers);
|
|
172
|
+
delete effectiveProps.__macroMarkers;
|
|
173
|
+
}
|
|
174
|
+
for (const key in effectiveProps) {
|
|
175
|
+
if (!Object.hasOwn(effectiveProps, key)) continue;
|
|
176
|
+
const value = effectiveProps[key];
|
|
177
|
+
if (value === void 0) continue;
|
|
178
|
+
const builtInModifier = modifiersTwMap[key];
|
|
179
|
+
if (builtInModifier) {
|
|
180
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
181
|
+
const nested = compileStyleClassName(value, `${modifierPrefix}${builtInModifier}`);
|
|
182
|
+
if (nested) classParts.push(nested);
|
|
183
|
+
}
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
if (key.startsWith("_")) {
|
|
187
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
188
|
+
const nested = compileStyleClassName(value, `${modifierPrefix}${key.slice(1)}:`);
|
|
189
|
+
if (nested) classParts.push(nested);
|
|
190
|
+
}
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
const handler = stylePropHandlerMap[key];
|
|
194
|
+
if (!handler) continue;
|
|
195
|
+
const token = String(handler(value));
|
|
196
|
+
if (!token) continue;
|
|
197
|
+
classParts.push(modifierPrefix ? `${modifierPrefix}${token}` : token);
|
|
198
|
+
}
|
|
199
|
+
return classParts.join(" ");
|
|
200
|
+
}
|
|
201
|
+
function extractVariantClassMapFromCreateVariantsCall(callExpression) {
|
|
202
|
+
const firstArg = callExpression.arguments[0];
|
|
203
|
+
if (!firstArg || !t.isObjectExpression(firstArg)) return null;
|
|
204
|
+
const result = {};
|
|
205
|
+
for (const property of firstArg.properties) {
|
|
206
|
+
if (!t.isObjectProperty(property) || property.computed) return null;
|
|
207
|
+
const key = t.isIdentifier(property.key) ? property.key.name : t.isStringLiteral(property.key) ? property.key.value : null;
|
|
208
|
+
if (!key || !t.isExpression(property.value)) return null;
|
|
209
|
+
const parsedStyleProps = parseStaticExpression(property.value);
|
|
210
|
+
if (!parsedStyleProps || typeof parsedStyleProps !== "object" || Array.isArray(parsedStyleProps)) return null;
|
|
211
|
+
result[key] = compileStyleClassName(parsedStyleProps);
|
|
212
|
+
}
|
|
213
|
+
return result;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Build a dynamic class expression for a modifier object with mixed
|
|
217
|
+
* static/dynamic values. For example: `_hover={{ bg: someVar, color: 'red' }}`
|
|
218
|
+
*
|
|
219
|
+
* Static properties are compiled normally. Dynamic properties get inline
|
|
220
|
+
* expressions via the codegen module.
|
|
221
|
+
*/
|
|
222
|
+
function buildMixedModifierObjectExpression(objectExpr, modifierPrefix) {
|
|
223
|
+
const staticProps = {};
|
|
224
|
+
const dynamicExpressions = [];
|
|
225
|
+
let hasDynamic = false;
|
|
226
|
+
for (const property of objectExpr.properties) {
|
|
227
|
+
if (!t.isObjectProperty(property) || property.computed) return null;
|
|
228
|
+
const key = t.isIdentifier(property.key) ? property.key.name : t.isStringLiteral(property.key) ? property.key.value : null;
|
|
229
|
+
if (!key || !t.isExpression(property.value)) return null;
|
|
230
|
+
const nestedModifier = modifiersTwMap[key];
|
|
231
|
+
if (nestedModifier) {
|
|
232
|
+
const nestedPrefix = `${modifierPrefix}${nestedModifier}`;
|
|
233
|
+
if (t.isObjectExpression(property.value)) {
|
|
234
|
+
const nested = buildMixedModifierObjectExpression(property.value, nestedPrefix);
|
|
235
|
+
if (nested) {
|
|
236
|
+
Object.assign(staticProps, nested.staticProps);
|
|
237
|
+
dynamicExpressions.push(...nested.dynamicExpressions);
|
|
238
|
+
if (nested.dynamicExpressions.length > 0) hasDynamic = true;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
if (key.startsWith("_")) {
|
|
244
|
+
const customModifierPrefix = `${modifierPrefix}${key.slice(1)}:`;
|
|
245
|
+
if (t.isObjectExpression(property.value)) {
|
|
246
|
+
const nested = buildMixedModifierObjectExpression(property.value, customModifierPrefix);
|
|
247
|
+
if (nested) {
|
|
248
|
+
Object.assign(staticProps, nested.staticProps);
|
|
249
|
+
dynamicExpressions.push(...nested.dynamicExpressions);
|
|
250
|
+
if (nested.dynamicExpressions.length > 0) hasDynamic = true;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
if (!isStyleLikeProp(key)) continue;
|
|
256
|
+
const parsedValue = parseStaticExpression(property.value);
|
|
257
|
+
if (parsedValue !== void 0) {
|
|
258
|
+
const handler = stylePropHandlerMap[key];
|
|
259
|
+
if (handler) {
|
|
260
|
+
const token = String(handler(parsedValue));
|
|
261
|
+
if (token) {
|
|
262
|
+
const fullToken = modifierPrefix ? `${modifierPrefix}${token}` : token;
|
|
263
|
+
staticProps[`__compiled_${modifierPrefix}${key}`] = fullToken;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
} else {
|
|
267
|
+
const handler = stylePropHandlerMap[key];
|
|
268
|
+
if (handler) {
|
|
269
|
+
const staticBranchExpr = tryCompileStaticBranchExpression(property.value, handler, modifierPrefix);
|
|
270
|
+
if (staticBranchExpr) {
|
|
271
|
+
dynamicExpressions.push(staticBranchExpr);
|
|
272
|
+
hasDynamic = true;
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
const parsedHandler = getParsedHandler(key);
|
|
277
|
+
if (parsedHandler) {
|
|
278
|
+
dynamicExpressions.push(buildDynamicClassExpression(parsedHandler, property.value, modifierPrefix));
|
|
279
|
+
hasDynamic = true;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return hasDynamic || Object.keys(staticProps).length > 0 ? {
|
|
284
|
+
staticProps,
|
|
285
|
+
dynamicExpressions
|
|
286
|
+
} : null;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Build a className expression for a non-root slot with dynamic variant lookups.
|
|
290
|
+
* Produces a template literal like `${lookupA[expr] || ""} ${lookupB[expr] || ""}`.
|
|
291
|
+
* If a static prefix is provided, it is prepended.
|
|
292
|
+
*/
|
|
293
|
+
function buildSlotDynamicClassName(dynamicExprs, staticPrefix) {
|
|
294
|
+
if (dynamicExprs.length === 1 && !staticPrefix) return dynamicExprs[0];
|
|
295
|
+
const quasis = [];
|
|
296
|
+
const expressions = [];
|
|
297
|
+
const prefix = staticPrefix ? `${staticPrefix} ` : "";
|
|
298
|
+
quasis.push(t.templateElement({
|
|
299
|
+
raw: prefix,
|
|
300
|
+
cooked: prefix
|
|
301
|
+
}, false));
|
|
302
|
+
for (let i = 0; i < dynamicExprs.length; i++) {
|
|
303
|
+
expressions.push(dynamicExprs[i]);
|
|
304
|
+
const isLast = i === dynamicExprs.length - 1;
|
|
305
|
+
const suffix = isLast ? "" : " ";
|
|
306
|
+
quasis.push(t.templateElement({
|
|
307
|
+
raw: suffix,
|
|
308
|
+
cooked: suffix
|
|
309
|
+
}, isLast));
|
|
310
|
+
}
|
|
311
|
+
return t.templateLiteral(quasis, expressions);
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Collect variant classes for all slots from a slot map.
|
|
315
|
+
* Root classes go to classExpressionParts; non-root go to slotVariantClasses.
|
|
316
|
+
*/
|
|
317
|
+
function collectAllSlotVariantClasses(ctx, slotMap) {
|
|
318
|
+
for (const [slot, className] of Object.entries(slotMap)) if (slot === "root") ctx.classExpressionParts.push(t.stringLiteral(className));
|
|
319
|
+
else {
|
|
320
|
+
ctx.slotVariantClasses[slot] ??= [];
|
|
321
|
+
ctx.slotVariantClasses[slot].push(className);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Derive the set of slots that participate in a variant axis by inspecting
|
|
326
|
+
* the existing variant class name map. Falls back to just 'root' when the
|
|
327
|
+
* axis has no known values yet (e.g. entirely new axis).
|
|
328
|
+
*/
|
|
329
|
+
function deriveSlotsFromAxis(variantClassMap) {
|
|
330
|
+
const slots = /* @__PURE__ */ new Set();
|
|
331
|
+
for (const slotMap of Object.values(variantClassMap)) for (const slot of Object.keys(slotMap)) slots.add(slot);
|
|
332
|
+
return slots.size > 0 ? [...slots] : ["root"];
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Process a single prop (variant or style) and accumulate results into ctx.
|
|
336
|
+
* Returns true if the prop was consumed and should be removed.
|
|
337
|
+
*/
|
|
338
|
+
function processComponentProp(ctx, key, staticValue, dynamicExpr, modifierObjectExpr) {
|
|
339
|
+
if (ctx.variantAxes?.has(key)) {
|
|
340
|
+
const variantClassMap = ctx.variantData?.variantClassNames[key];
|
|
341
|
+
if (staticValue !== void 0 && typeof staticValue === "string" && variantClassMap) {
|
|
342
|
+
const slotMap = variantClassMap[staticValue];
|
|
343
|
+
if (slotMap) collectAllSlotVariantClasses(ctx, slotMap);
|
|
344
|
+
else {
|
|
345
|
+
const slotsForAxis = deriveSlotsFromAxis(variantClassMap);
|
|
346
|
+
for (const slot of slotsForAxis) {
|
|
347
|
+
const className = componentVariantClass(ctx.componentName, slot, key, staticValue);
|
|
348
|
+
if (slot === "root") ctx.classExpressionParts.push(t.stringLiteral(className));
|
|
349
|
+
else {
|
|
350
|
+
ctx.slotVariantClasses[slot] ??= [];
|
|
351
|
+
ctx.slotVariantClasses[slot].push(className);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
ctx.resolvedVariantAxes.add(key);
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
if (variantClassMap && dynamicExpr && ctx.hoistedVariantClassMapNames && ctx.hoistedVariantClassMaps) {
|
|
359
|
+
const slotLookups = {};
|
|
360
|
+
for (const [value, slotMap] of Object.entries(variantClassMap)) for (const [slot, className] of Object.entries(slotMap)) {
|
|
361
|
+
slotLookups[slot] ??= {};
|
|
362
|
+
slotLookups[slot][value] = className;
|
|
363
|
+
}
|
|
364
|
+
if (Object.keys(slotLookups).length > 0) {
|
|
365
|
+
for (const [slot, lookup] of Object.entries(slotLookups)) {
|
|
366
|
+
const lookupKey = `__uds_${ctx.componentName}_${key}_${slot}`;
|
|
367
|
+
let hoistedName = ctx.hoistedVariantClassMapNames.get(lookupKey);
|
|
368
|
+
if (!hoistedName) {
|
|
369
|
+
hoistedName = lookupKey;
|
|
370
|
+
ctx.hoistedVariantClassMapNames.set(lookupKey, hoistedName);
|
|
371
|
+
ctx.hoistedVariantClassMaps.set(hoistedName, lookup);
|
|
372
|
+
}
|
|
373
|
+
const classPrefix = `${kebabCase(ctx.componentName)}-${slot}--${key}-`;
|
|
374
|
+
const fallbackExpr = t.templateLiteral([t.templateElement({
|
|
375
|
+
raw: classPrefix,
|
|
376
|
+
cooked: classPrefix
|
|
377
|
+
}, false), t.templateElement({
|
|
378
|
+
raw: "",
|
|
379
|
+
cooked: ""
|
|
380
|
+
}, true)], [t.cloneNode(dynamicExpr)]);
|
|
381
|
+
const lookupExpr = t.logicalExpression("||", t.memberExpression(t.identifier(hoistedName), t.cloneNode(dynamicExpr), true), fallbackExpr);
|
|
382
|
+
if (slot === "root") ctx.classExpressionParts.push(lookupExpr);
|
|
383
|
+
else {
|
|
384
|
+
ctx.dynamicSlotExprs[slot] ??= [];
|
|
385
|
+
ctx.dynamicSlotExprs[slot].push(lookupExpr);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
ctx.resolvedVariantAxes.add(key);
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
if (!isStyleLikeProp(key)) return false;
|
|
394
|
+
if (staticValue !== void 0) {
|
|
395
|
+
if (typeof staticValue === "string" && /^\[.+\](?:\/\d+)?$/.test(staticValue)) {
|
|
396
|
+
const mapping = propMappings[key];
|
|
397
|
+
if (mapping) {
|
|
398
|
+
const rawValue = staticValue.slice(1, staticValue.lastIndexOf("]"));
|
|
399
|
+
if (mapping.arbitraryValueTemplate) {
|
|
400
|
+
const { cssProperty, valueTemplate } = mapping.arbitraryValueTemplate;
|
|
401
|
+
ctx.arbitraryInlineStyleProps[toCamelCase(cssProperty)] = valueTemplate.replace("%s", rawValue);
|
|
402
|
+
return true;
|
|
403
|
+
}
|
|
404
|
+
if (mapping.cssProperty) {
|
|
405
|
+
ctx.arbitraryInlineStyleProps[toCamelCase(mapping.cssProperty)] = rawValue;
|
|
406
|
+
return true;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
ctx.staticStyleProps[key] = staticValue;
|
|
411
|
+
return true;
|
|
412
|
+
}
|
|
413
|
+
if (!key.startsWith("_") && dynamicExpr) {
|
|
414
|
+
const handler = stylePropHandlerMap[key];
|
|
415
|
+
if (handler) {
|
|
416
|
+
const staticBranchExpr = tryCompileStaticBranchExpression(dynamicExpr, handler);
|
|
417
|
+
if (staticBranchExpr) {
|
|
418
|
+
ctx.classExpressionParts.push(staticBranchExpr);
|
|
419
|
+
return true;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
const parsedHandler = getParsedHandler(key);
|
|
423
|
+
if (parsedHandler) {
|
|
424
|
+
ctx.classExpressionParts.push(buildDynamicClassExpression(parsedHandler, dynamicExpr));
|
|
425
|
+
return true;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
if (key.startsWith("_") && modifierObjectExpr) {
|
|
429
|
+
const result = buildMixedModifierObjectExpression(modifierObjectExpr, modifiersTwMap[key] || `${key.slice(1)}:`);
|
|
430
|
+
if (result) {
|
|
431
|
+
for (const value of Object.values(result.staticProps)) if (typeof value === "string") ctx.classExpressionParts.push(t.stringLiteral(value));
|
|
432
|
+
ctx.classExpressionParts.push(...result.dynamicExpressions);
|
|
433
|
+
return true;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return false;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Apply default variant classes and compile static style props into the
|
|
440
|
+
* final class expression. Returns null if no classes were generated.
|
|
441
|
+
*/
|
|
442
|
+
function finalizeStyleClassParts(ctx) {
|
|
443
|
+
if (ctx.variantData?.defaultVariants && ctx.variantData.variantClassNames) for (const [axis, defaultValue] of Object.entries(ctx.variantData.defaultVariants)) {
|
|
444
|
+
if (ctx.resolvedVariantAxes.has(axis)) continue;
|
|
445
|
+
const variantClassMap = ctx.variantData.variantClassNames[axis];
|
|
446
|
+
if (!variantClassMap) continue;
|
|
447
|
+
const slotMap = variantClassMap[defaultValue];
|
|
448
|
+
if (slotMap) collectAllSlotVariantClasses(ctx, slotMap);
|
|
449
|
+
}
|
|
450
|
+
const staticClassName = compileStyleClassName(applyComponentStyleDefaults(ctx.componentName, ctx.staticStyleProps));
|
|
451
|
+
if (staticClassName) ctx.classExpressionParts.unshift(t.stringLiteral(staticClassName));
|
|
452
|
+
if (ctx.classExpressionParts.length === 0) return null;
|
|
453
|
+
return ctx.classExpressionParts.length === 1 ? ctx.classExpressionParts[0] : buildClassJoinExpression(ctx.classExpressionParts);
|
|
454
|
+
}
|
|
455
|
+
function transformUdsComponentStyleProps(nodePath, createVariantsClassMaps, hoistedVariantClassMapNames, hoistedVariantClassMaps) {
|
|
456
|
+
const openingElement = nodePath.node;
|
|
457
|
+
if (!t.isJSXIdentifier(openingElement.name)) return false;
|
|
458
|
+
const componentName = openingElement.name.name;
|
|
459
|
+
if (!allComponents.has(componentName)) return false;
|
|
460
|
+
const attributes = openingElement.attributes;
|
|
461
|
+
const removeIndices = [];
|
|
462
|
+
const variantData = getComponentVariantData(componentName);
|
|
463
|
+
const ctx = {
|
|
464
|
+
componentName,
|
|
465
|
+
variantData,
|
|
466
|
+
variantAxes: variantData?.variantClassNames ? new Set(Object.keys(variantData.variantClassNames)) : null,
|
|
467
|
+
resolvedVariantAxes: /* @__PURE__ */ new Set(),
|
|
468
|
+
staticStyleProps: {},
|
|
469
|
+
classExpressionParts: [],
|
|
470
|
+
slotVariantClasses: {},
|
|
471
|
+
dynamicSlotExprs: {},
|
|
472
|
+
arbitraryInlineStyleProps: {},
|
|
473
|
+
hoistedVariantClassMapNames,
|
|
474
|
+
hoistedVariantClassMaps
|
|
475
|
+
};
|
|
476
|
+
for (const [index, attribute] of attributes.entries()) {
|
|
477
|
+
if (t.isJSXAttribute(attribute) && t.isJSXIdentifier(attribute.name)) {
|
|
478
|
+
const attrName = attribute.name.name;
|
|
479
|
+
if (attrName === "className") continue;
|
|
480
|
+
const staticValue = parseStaticJsxAttributeValue(attribute);
|
|
481
|
+
const dynamicExpr = getDynamicJsxAttributeExpression(attribute);
|
|
482
|
+
let modifierObjectExpr = null;
|
|
483
|
+
if (attribute.value && t.isJSXExpressionContainer(attribute.value) && !t.isJSXEmptyExpression(attribute.value.expression) && t.isObjectExpression(attribute.value.expression)) modifierObjectExpr = attribute.value.expression;
|
|
484
|
+
if (processComponentProp(ctx, attrName, staticValue, dynamicExpr, modifierObjectExpr)) removeIndices.push(index);
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
if (t.isJSXSpreadAttribute(attribute) && t.isMemberExpression(attribute.argument) && t.isIdentifier(attribute.argument.object)) {
|
|
488
|
+
const variantVarName = attribute.argument.object.name;
|
|
489
|
+
const classMap = createVariantsClassMaps.get(variantVarName);
|
|
490
|
+
if (!classMap) continue;
|
|
491
|
+
removeIndices.push(index);
|
|
492
|
+
const staticKey = getStaticMemberKey(attribute.argument);
|
|
493
|
+
if (staticKey !== null) {
|
|
494
|
+
const staticClassName = classMap[staticKey];
|
|
495
|
+
if (staticClassName) ctx.classExpressionParts.push(t.stringLiteral(staticClassName));
|
|
496
|
+
continue;
|
|
497
|
+
}
|
|
498
|
+
const keyExpression = attribute.argument.computed ? attribute.argument.property : t.stringLiteral(t.isIdentifier(attribute.argument.property) ? attribute.argument.property.name : "");
|
|
499
|
+
let hoistedName = hoistedVariantClassMapNames.get(variantVarName);
|
|
500
|
+
if (!hoistedName) {
|
|
501
|
+
hoistedName = `__uds_${variantVarName}_classMap`;
|
|
502
|
+
hoistedVariantClassMapNames.set(variantVarName, hoistedName);
|
|
503
|
+
hoistedVariantClassMaps.set(hoistedName, classMap);
|
|
504
|
+
}
|
|
505
|
+
ctx.classExpressionParts.push(t.logicalExpression("||", t.memberExpression(t.identifier(hoistedName), keyExpression, true), t.stringLiteral("")));
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
if (t.isJSXSpreadAttribute(attribute) && t.isObjectExpression(attribute.argument)) {
|
|
509
|
+
const remainingProperties = [];
|
|
510
|
+
let consumedStyleProps = false;
|
|
511
|
+
for (const property of attribute.argument.properties) {
|
|
512
|
+
if (!t.isObjectProperty(property)) {
|
|
513
|
+
remainingProperties.push(property);
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
const key = getStaticObjectPropertyKey(property);
|
|
517
|
+
if (!key || !isStyleLikeProp(key) || !t.isExpression(property.value)) {
|
|
518
|
+
remainingProperties.push(property);
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
521
|
+
const parsedValue = parseStaticExpression(property.value);
|
|
522
|
+
if (parsedValue === void 0) {
|
|
523
|
+
remainingProperties.push(property);
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
526
|
+
ctx.staticStyleProps[key] = parsedValue;
|
|
527
|
+
consumedStyleProps = true;
|
|
528
|
+
}
|
|
529
|
+
if (!consumedStyleProps) continue;
|
|
530
|
+
if (remainingProperties.length === 0) removeIndices.push(index);
|
|
531
|
+
else if (remainingProperties.every((p) => t.isObjectProperty(p) && !p.computed && (t.isIdentifier(p.key) || t.isStringLiteral(p.key)))) {
|
|
532
|
+
const flatAttrs = remainingProperties.map((p) => {
|
|
533
|
+
const key = t.isIdentifier(p.key) ? p.key.name : p.key.value;
|
|
534
|
+
const value = t.isExpression(p.value) ? t.isStringLiteral(p.value) ? t.stringLiteral(p.value.value) : t.jsxExpressionContainer(t.cloneNode(p.value, true, true)) : null;
|
|
535
|
+
return t.jsxAttribute(t.jsxIdentifier(key), value);
|
|
536
|
+
});
|
|
537
|
+
attributes.splice(index, 1, ...flatAttrs);
|
|
538
|
+
} else attributes[index] = t.jsxSpreadAttribute(t.objectExpression(remainingProperties));
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
const mergedExpression = finalizeStyleClassParts(ctx);
|
|
542
|
+
const hasSlotClasses = Object.keys(ctx.slotVariantClasses).length > 0;
|
|
543
|
+
const hasDynamicSlotExprs = Object.keys(ctx.dynamicSlotExprs).length > 0;
|
|
544
|
+
const hasArbitraryInlineStyles = Object.keys(ctx.arbitraryInlineStyleProps).length > 0;
|
|
545
|
+
if (!mergedExpression && !hasSlotClasses && !hasDynamicSlotExprs && !hasArbitraryInlineStyles) return false;
|
|
546
|
+
removeIndices.sort((a, b) => b - a).forEach((index) => {
|
|
547
|
+
attributes.splice(index, 1);
|
|
548
|
+
});
|
|
549
|
+
if (mergedExpression) upsertClassNameAttribute(attributes, mergedExpression);
|
|
550
|
+
const allSlots = new Set([...Object.keys(ctx.slotVariantClasses), ...Object.keys(ctx.dynamicSlotExprs)]);
|
|
551
|
+
if (allSlots.size > 0) for (const slot of allSlots) {
|
|
552
|
+
const staticClasses = ctx.slotVariantClasses[slot];
|
|
553
|
+
const dynamicExprs = ctx.dynamicSlotExprs[slot];
|
|
554
|
+
let classNameExpr;
|
|
555
|
+
if (staticClasses && !dynamicExprs) classNameExpr = t.stringLiteral(staticClasses.join(" "));
|
|
556
|
+
else if (!staticClasses && dynamicExprs) classNameExpr = buildSlotDynamicClassName(dynamicExprs);
|
|
557
|
+
else if (staticClasses && dynamicExprs) classNameExpr = buildSlotDynamicClassName(dynamicExprs, staticClasses.join(" "));
|
|
558
|
+
else continue;
|
|
559
|
+
attributes.push(t.jsxAttribute(t.jsxIdentifier(`_${slot}`), t.jsxExpressionContainer(t.objectExpression([t.objectProperty(t.identifier("className"), classNameExpr)]))));
|
|
560
|
+
}
|
|
561
|
+
if (hasArbitraryInlineStyles) {
|
|
562
|
+
const inlineStyleProperties = Object.entries(ctx.arbitraryInlineStyleProps).map(([cssProp, cssVal]) => t.objectProperty(t.identifier(cssProp), t.stringLiteral(cssVal)));
|
|
563
|
+
const existingStyleAttr = attributes.find((attr) => t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name) && attr.name.name === "style");
|
|
564
|
+
if (existingStyleAttr) {
|
|
565
|
+
let existingStyleExpr = null;
|
|
566
|
+
if (t.isJSXExpressionContainer(existingStyleAttr.value) && !t.isJSXEmptyExpression(existingStyleAttr.value.expression)) existingStyleExpr = existingStyleAttr.value.expression;
|
|
567
|
+
const mergedStyleExpr = existingStyleExpr ? t.objectExpression([t.spreadElement(existingStyleExpr), ...inlineStyleProperties]) : t.objectExpression(inlineStyleProperties);
|
|
568
|
+
existingStyleAttr.value = t.jsxExpressionContainer(mergedStyleExpr);
|
|
569
|
+
} else attributes.push(t.jsxAttribute(t.jsxIdentifier("style"), t.jsxExpressionContainer(t.objectExpression(inlineStyleProperties))));
|
|
570
|
+
}
|
|
571
|
+
return true;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Transform style props in compiled JSX calls like:
|
|
575
|
+
* _jsx(Box, { display: "flex", flexDirection: "col", ...rest, children })
|
|
576
|
+
*
|
|
577
|
+
* Extracts style props from the ObjectExpression, compiles them to className,
|
|
578
|
+
* and removes them from the props object.
|
|
579
|
+
*/
|
|
580
|
+
function transformCompiledJsxStyleProps(callExpression, hoistedVariantClassMapNames, hoistedVariantClassMaps) {
|
|
581
|
+
const callee = callExpression.callee;
|
|
582
|
+
if (!t.isIdentifier(callee)) return false;
|
|
583
|
+
if (callee.name !== "jsx" && callee.name !== "jsxs" && callee.name !== "jsxDEV" && callee.name !== "_jsx" && callee.name !== "_jsxs" && callee.name !== "_jsxDEV") return false;
|
|
584
|
+
const args = callExpression.arguments;
|
|
585
|
+
if (!args || args.length < 2) return false;
|
|
586
|
+
const firstArg = args[0];
|
|
587
|
+
if (!t.isIdentifier(firstArg)) return false;
|
|
588
|
+
if (!allComponents.has(firstArg.name)) return false;
|
|
589
|
+
const propsArg = args[1];
|
|
590
|
+
if (!t.isObjectExpression(propsArg)) return false;
|
|
591
|
+
const componentName = firstArg.name;
|
|
592
|
+
const removeIndices = [];
|
|
593
|
+
const variantData = getComponentVariantData(componentName);
|
|
594
|
+
const ctx = {
|
|
595
|
+
componentName,
|
|
596
|
+
variantData,
|
|
597
|
+
variantAxes: variantData?.variantClassNames ? new Set(Object.keys(variantData.variantClassNames)) : null,
|
|
598
|
+
resolvedVariantAxes: /* @__PURE__ */ new Set(),
|
|
599
|
+
staticStyleProps: {},
|
|
600
|
+
classExpressionParts: [],
|
|
601
|
+
slotVariantClasses: {},
|
|
602
|
+
dynamicSlotExprs: {},
|
|
603
|
+
arbitraryInlineStyleProps: {},
|
|
604
|
+
hoistedVariantClassMapNames,
|
|
605
|
+
hoistedVariantClassMaps
|
|
606
|
+
};
|
|
607
|
+
for (const [index, property] of propsArg.properties.entries()) {
|
|
608
|
+
if (!t.isObjectProperty(property)) continue;
|
|
609
|
+
if (property.computed) continue;
|
|
610
|
+
const key = t.isIdentifier(property.key) ? property.key.name : t.isStringLiteral(property.key) ? property.key.value : null;
|
|
611
|
+
if (!key) continue;
|
|
612
|
+
if (key === "className" || key === "children") continue;
|
|
613
|
+
if (!t.isExpression(property.value)) continue;
|
|
614
|
+
const staticValue = parseStaticExpression(property.value);
|
|
615
|
+
if (processComponentProp(ctx, key, staticValue, staticValue !== void 0 ? null : property.value, t.isObjectExpression(property.value) ? property.value : null)) removeIndices.push(index);
|
|
616
|
+
}
|
|
617
|
+
const mergedExpression = finalizeStyleClassParts(ctx);
|
|
618
|
+
const hasSlotClasses = Object.keys(ctx.slotVariantClasses).length > 0;
|
|
619
|
+
const hasDynSlotExprs = Object.keys(ctx.dynamicSlotExprs).length > 0;
|
|
620
|
+
const hasArbitraryInlineStyles = Object.keys(ctx.arbitraryInlineStyleProps).length > 0;
|
|
621
|
+
if (!mergedExpression && !hasSlotClasses && !hasDynSlotExprs && !hasArbitraryInlineStyles) return false;
|
|
622
|
+
removeIndices.sort((a, b) => b - a).forEach((index) => {
|
|
623
|
+
propsArg.properties.splice(index, 1);
|
|
624
|
+
});
|
|
625
|
+
if (mergedExpression) {
|
|
626
|
+
const existingClassNameIndex = propsArg.properties.findIndex((prop) => t.isObjectProperty(prop) && !prop.computed && (t.isIdentifier(prop.key) && prop.key.name === "className" || t.isStringLiteral(prop.key) && prop.key.value === "className"));
|
|
627
|
+
if (existingClassNameIndex === -1) {
|
|
628
|
+
const spreadClassNameExprs = [];
|
|
629
|
+
for (const prop of propsArg.properties) if (t.isSpreadElement(prop) && t.isIdentifier(prop.argument)) spreadClassNameExprs.push(t.optionalMemberExpression(t.identifier(prop.argument.name), t.identifier("className"), false, true));
|
|
630
|
+
const finalExpression = spreadClassNameExprs.length > 0 ? buildClassJoinExpression([...spreadClassNameExprs, mergedExpression]) : mergedExpression;
|
|
631
|
+
propsArg.properties.push(t.objectProperty(t.identifier("className"), finalExpression));
|
|
632
|
+
} else {
|
|
633
|
+
const existingProp = propsArg.properties[existingClassNameIndex];
|
|
634
|
+
const existingValue = existingProp.value;
|
|
635
|
+
existingProp.value = buildClassJoinExpression([existingValue, mergedExpression]);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
const allCompiledSlots = new Set([...Object.keys(ctx.slotVariantClasses), ...Object.keys(ctx.dynamicSlotExprs)]);
|
|
639
|
+
if (allCompiledSlots.size > 0) for (const slot of allCompiledSlots) {
|
|
640
|
+
const staticClasses = ctx.slotVariantClasses[slot];
|
|
641
|
+
const dynamicExprs = ctx.dynamicSlotExprs[slot];
|
|
642
|
+
let classNameExpr;
|
|
643
|
+
if (staticClasses && !dynamicExprs) classNameExpr = t.stringLiteral(staticClasses.join(" "));
|
|
644
|
+
else if (!staticClasses && dynamicExprs) classNameExpr = buildSlotDynamicClassName(dynamicExprs);
|
|
645
|
+
else if (staticClasses && dynamicExprs) classNameExpr = buildSlotDynamicClassName(dynamicExprs, staticClasses.join(" "));
|
|
646
|
+
else continue;
|
|
647
|
+
propsArg.properties.push(t.objectProperty(t.stringLiteral(`_${slot}`), t.objectExpression([t.objectProperty(t.identifier("className"), classNameExpr)])));
|
|
648
|
+
}
|
|
649
|
+
if (hasArbitraryInlineStyles) {
|
|
650
|
+
const inlineStyleProperties = Object.entries(ctx.arbitraryInlineStyleProps).map(([cssProp, cssVal]) => t.objectProperty(t.identifier(cssProp), t.stringLiteral(cssVal)));
|
|
651
|
+
const existingStyleIndex = propsArg.properties.findIndex((prop) => t.isObjectProperty(prop) && !prop.computed && (t.isIdentifier(prop.key) && prop.key.name === "style" || t.isStringLiteral(prop.key) && prop.key.value === "style"));
|
|
652
|
+
if (existingStyleIndex !== -1) {
|
|
653
|
+
const existingStyleProp = propsArg.properties[existingStyleIndex];
|
|
654
|
+
const existingStyleValue = existingStyleProp.value;
|
|
655
|
+
existingStyleProp.value = t.objectExpression([t.spreadElement(existingStyleValue), ...inlineStyleProperties]);
|
|
656
|
+
} else propsArg.properties.push(t.objectProperty(t.identifier("style"), t.objectExpression(inlineStyleProperties)));
|
|
657
|
+
}
|
|
658
|
+
return true;
|
|
659
|
+
}
|
|
660
|
+
return {
|
|
661
|
+
allComponents,
|
|
662
|
+
primitiveComponents,
|
|
663
|
+
componentTagPatterns,
|
|
664
|
+
extractVariantClassMapFromCreateVariantsCall,
|
|
665
|
+
transformUdsComponentStyleProps,
|
|
666
|
+
transformCompiledJsxStyleProps
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
//#endregion
|
|
670
|
+
export { createStyleTransformRuntime };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LoaderDefinitionFunction } from "webpack";
|
|
2
|
+
|
|
3
|
+
//#region ../loader/dist/loader.d.ts
|
|
4
|
+
//#region src/loader.d.ts
|
|
5
|
+
declare const transformLoader: LoaderDefinitionFunction;
|
|
6
|
+
declare const normal: LoaderDefinitionFunction<{}, {}>; //#endregion
|
|
7
|
+
//#endregion
|
|
8
|
+
export { normal, transformLoader };
|