@yahoo/uds-v5-wip 1.60.0 → 1.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/dist/AssetGroup.d.ts +75 -0
- package/dist/config/dist/AssetGroup.js +114 -0
- package/dist/config/dist/Component.d.ts +309 -0
- package/dist/config/dist/Component.js +897 -0
- package/dist/config/dist/ComponentGroup.d.ts +21 -0
- package/dist/config/dist/ComponentGroup.js +46 -0
- package/dist/config/dist/CompositeStyle.d.ts +28 -0
- package/dist/config/dist/CompositeStyle.js +52 -0
- package/dist/config/dist/Config.d.ts +422 -0
- package/dist/config/dist/Config.js +1426 -0
- package/dist/config/dist/Mode.d.ts +42 -0
- package/dist/config/dist/Mode.js +81 -0
- package/dist/config/dist/Modifier.d.ts +52 -0
- package/dist/config/dist/Modifier.js +97 -0
- package/dist/config/dist/MotionDef.d.ts +50 -0
- package/dist/config/dist/MotionDef.js +97 -0
- package/dist/config/dist/Props.d.ts +284 -39
- package/dist/config/dist/Provider.d.ts +21 -0
- package/dist/config/dist/Provider.js +14 -0
- package/dist/config/dist/StyleProp.d.ts +113 -0
- package/dist/config/dist/StyleProp.js +197 -0
- package/dist/config/dist/Token.d.ts +56 -0
- package/dist/config/dist/Token.js +112 -0
- package/dist/config/dist/TokenGroup.d.ts +33 -0
- package/dist/config/dist/TokenGroup.js +68 -0
- package/dist/config/dist/asset-kind.d.ts +56 -0
- package/dist/config/dist/asset-kind.js +29 -0
- package/dist/config/dist/brands.d.ts +31 -0
- package/dist/config/dist/brands.js +20 -0
- package/dist/config/dist/captureCallerPath.d.ts +49 -0
- package/dist/config/dist/captureCallerPath.js +95 -0
- package/dist/config/dist/colorExpressions.d.ts +132 -0
- package/dist/config/dist/colorExpressions.js +148 -0
- package/dist/config/dist/defineAssetGroup.d.ts +158 -0
- package/dist/config/dist/defineAssetGroup.js +263 -0
- package/dist/config/dist/defineProvider.d.ts +30 -0
- package/dist/config/dist/defineProvider.js +60 -0
- package/dist/config/dist/element-marker.d.ts +55 -0
- package/dist/config/dist/element-marker.js +113 -0
- package/dist/config/dist/entity-utils.d.ts +27 -0
- package/dist/config/dist/entity-utils.js +105 -0
- package/dist/config/dist/factories.d.ts +707 -0
- package/dist/config/dist/factories.js +393 -0
- package/dist/config/dist/foreign-component-name.js +42 -0
- package/dist/config/dist/index.d.ts +31 -13
- package/dist/config/dist/index.js +26 -10
- package/dist/config/dist/interpolate.d.ts +21 -0
- package/dist/{foundational-presets/dist/motion.js → config/dist/interpolate.js} +1 -1
- package/dist/config/dist/markers.d.ts +218 -0
- package/dist/config/dist/markers.js +67 -0
- package/dist/config/dist/refs.d.ts +159 -0
- package/dist/config/dist/refs.js +98 -71
- package/dist/config/dist/token-override-rows.d.ts +67 -0
- package/dist/config/dist/token-override-rows.js +223 -0
- package/dist/config/dist/tokenValueType.js +138 -0
- package/dist/config/dist/types/css-properties.d.ts +233 -0
- package/dist/config/dist/types/css-property-keywords.d.ts +157 -0
- package/dist/config/dist/types/css-property-keywords.js +616 -0
- package/dist/config/dist/types/css-values.d.ts +20 -17
- package/dist/config/dist/types.d.ts +697 -64
- package/dist/config/dist/units.d.ts +15 -0
- package/dist/config/dist/units.js +16 -0
- package/dist/config.d.ts +32 -1562
- package/dist/config.js +28 -21
- package/dist/loader/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/loader/dist/index.d.ts +2 -0
- package/dist/loader/dist/index.js +3 -0
- package/dist/loader/dist/loader/artifacts.js +26 -9
- package/dist/loader/dist/loader/babel-utils.js +1 -29
- package/dist/loader/dist/loader.d.ts +17 -1
- package/dist/loader/dist/loader.js +56 -339
- package/dist/loader/dist/next.d.ts +2 -1
- package/dist/loader/dist/next.js +3 -3
- package/dist/loader/dist/transform-runner.js +7 -0
- package/dist/loader/dist/unplugin.d.ts +27 -0
- package/dist/loader/dist/unplugin.js +52 -0
- package/dist/plugin.d.ts +2 -2
- package/dist/plugin.js +3 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/dist/index.js +1 -0
- package/dist/utils/dist/motion-utils/resolveMotionState.d.ts +35 -0
- package/dist/utils/dist/motion-utils/resolveMotionState.js +33 -0
- package/dist/utils/dist/string-utils/componentClassName.d.ts +41 -8
- package/dist/utils/dist/string-utils/componentClassName.js +48 -11
- package/dist/utils.d.ts +3 -2
- package/dist/utils.js +3 -2
- package/package.json +3 -51
- package/dist/components/accordion.config.d.ts +0 -2
- package/dist/components/accordion.config.js +0 -2
- package/dist/components/accordion.d.ts +0 -2
- package/dist/components/accordion.js +0 -2
- package/dist/components/alert.config.d.ts +0 -2
- package/dist/components/alert.config.js +0 -2
- package/dist/components/alert.d.ts +0 -2
- package/dist/components/alert.js +0 -2
- package/dist/components/anchor.config.d.ts +0 -2
- package/dist/components/anchor.config.js +0 -2
- package/dist/components/anchor.d.ts +0 -2
- package/dist/components/anchor.js +0 -2
- package/dist/components/article.d.ts +0 -2
- package/dist/components/article.js +0 -2
- package/dist/components/aside.d.ts +0 -2
- package/dist/components/aside.js +0 -2
- package/dist/components/avatar-group.config.d.ts +0 -2
- package/dist/components/avatar-group.config.js +0 -2
- package/dist/components/avatar-group.d.ts +0 -2
- package/dist/components/avatar-group.js +0 -2
- package/dist/components/avatar.config.d.ts +0 -2
- package/dist/components/avatar.config.js +0 -2
- package/dist/components/avatar.d.ts +0 -2
- package/dist/components/avatar.js +0 -2
- package/dist/components/badge.config.d.ts +0 -2
- package/dist/components/badge.config.js +0 -2
- package/dist/components/badge.d.ts +0 -2
- package/dist/components/badge.js +0 -2
- package/dist/components/box.d.ts +0 -2
- package/dist/components/box.js +0 -2
- package/dist/components/breadcrumb.config.d.ts +0 -2
- package/dist/components/breadcrumb.config.js +0 -2
- package/dist/components/breadcrumb.d.ts +0 -2
- package/dist/components/breadcrumb.js +0 -2
- package/dist/components/button.config.d.ts +0 -2
- package/dist/components/button.config.js +0 -2
- package/dist/components/button.d.ts +0 -2
- package/dist/components/button.js +0 -2
- package/dist/components/card.config.d.ts +0 -2
- package/dist/components/card.config.js +0 -2
- package/dist/components/card.d.ts +0 -2
- package/dist/components/card.js +0 -2
- package/dist/components/collapsible.config.d.ts +0 -2
- package/dist/components/collapsible.config.js +0 -2
- package/dist/components/collapsible.d.ts +0 -2
- package/dist/components/collapsible.js +0 -2
- package/dist/components/command.config.d.ts +0 -2
- package/dist/components/command.config.js +0 -2
- package/dist/components/command.d.ts +0 -2
- package/dist/components/command.js +0 -2
- package/dist/components/control-color.config.d.ts +0 -2
- package/dist/components/control-color.config.js +0 -2
- package/dist/components/control-color.d.ts +0 -2
- package/dist/components/control-color.js +0 -2
- package/dist/components/control-curve.config.d.ts +0 -2
- package/dist/components/control-curve.config.js +0 -2
- package/dist/components/control-curve.d.ts +0 -2
- package/dist/components/control-curve.js +0 -2
- package/dist/components/control-folder.config.d.ts +0 -2
- package/dist/components/control-folder.config.js +0 -2
- package/dist/components/control-folder.d.ts +0 -2
- package/dist/components/control-folder.js +0 -2
- package/dist/components/control-group.config.d.ts +0 -2
- package/dist/components/control-group.config.js +0 -2
- package/dist/components/control-group.d.ts +0 -2
- package/dist/components/control-group.js +0 -2
- package/dist/components/control-knob.config.d.ts +0 -2
- package/dist/components/control-knob.config.js +0 -2
- package/dist/components/control-knob.d.ts +0 -2
- package/dist/components/control-knob.js +0 -2
- package/dist/components/control-panel.config.d.ts +0 -2
- package/dist/components/control-panel.config.js +0 -2
- package/dist/components/control-panel.d.ts +0 -2
- package/dist/components/control-panel.js +0 -2
- package/dist/components/control-select.config.d.ts +0 -2
- package/dist/components/control-select.config.js +0 -2
- package/dist/components/control-select.d.ts +0 -2
- package/dist/components/control-select.js +0 -2
- package/dist/components/control-slider.config.d.ts +0 -2
- package/dist/components/control-slider.config.js +0 -2
- package/dist/components/control-slider.d.ts +0 -2
- package/dist/components/control-slider.js +0 -2
- package/dist/components/control-spring.config.d.ts +0 -2
- package/dist/components/control-spring.config.js +0 -2
- package/dist/components/control-spring.d.ts +0 -2
- package/dist/components/control-spring.js +0 -2
- package/dist/components/control-stepper.config.d.ts +0 -2
- package/dist/components/control-stepper.config.js +0 -2
- package/dist/components/control-stepper.d.ts +0 -2
- package/dist/components/control-stepper.js +0 -2
- package/dist/components/control-toggle.config.d.ts +0 -2
- package/dist/components/control-toggle.config.js +0 -2
- package/dist/components/control-toggle.d.ts +0 -2
- package/dist/components/control-toggle.js +0 -2
- package/dist/components/dist/_slots.js +0 -8
- package/dist/components/dist/accordion.config.d.ts +0 -431
- package/dist/components/dist/accordion.config.js +0 -81
- package/dist/components/dist/accordion.d.ts +0 -453
- package/dist/components/dist/accordion.js +0 -60
- package/dist/components/dist/alert.config.d.ts +0 -219
- package/dist/components/dist/alert.config.js +0 -54
- package/dist/components/dist/alert.d.ts +0 -230
- package/dist/components/dist/alert.js +0 -16
- package/dist/components/dist/anchor.config.d.ts +0 -250
- package/dist/components/dist/anchor.config.js +0 -22
- package/dist/components/dist/anchor.d.ts +0 -261
- package/dist/components/dist/anchor.js +0 -9
- package/dist/components/dist/article.d.ts +0 -11
- package/dist/components/dist/article.js +0 -9
- package/dist/components/dist/aside.d.ts +0 -11
- package/dist/components/dist/aside.js +0 -9
- package/dist/components/dist/avatar-group.config.d.ts +0 -315
- package/dist/components/dist/avatar-group.config.js +0 -33
- package/dist/components/dist/avatar-group.d.ts +0 -329
- package/dist/components/dist/avatar-group.js +0 -39
- package/dist/components/dist/avatar.config.d.ts +0 -197
- package/dist/components/dist/avatar.config.js +0 -49
- package/dist/components/dist/avatar.d.ts +0 -211
- package/dist/components/dist/avatar.js +0 -20
- package/dist/components/dist/badge.config.d.ts +0 -477
- package/dist/components/dist/badge.config.js +0 -99
- package/dist/components/dist/badge.d.ts +0 -489
- package/dist/components/dist/badge.js +0 -16
- package/dist/components/dist/box.d.ts +0 -14
- package/dist/components/dist/box.js +0 -9
- package/dist/components/dist/breadcrumb.config.d.ts +0 -390
- package/dist/components/dist/breadcrumb.config.js +0 -43
- package/dist/components/dist/breadcrumb.d.ts +0 -420
- package/dist/components/dist/breadcrumb.js +0 -119
- package/dist/components/dist/button.config.d.ts +0 -381
- package/dist/components/dist/button.config.js +0 -91
- package/dist/components/dist/button.d.ts +0 -403
- package/dist/components/dist/button.js +0 -35
- package/dist/components/dist/card.config.d.ts +0 -336
- package/dist/components/dist/card.config.js +0 -33
- package/dist/components/dist/card.d.ts +0 -352
- package/dist/components/dist/card.js +0 -27
- package/dist/components/dist/collapsible.config.d.ts +0 -45
- package/dist/components/dist/collapsible.config.js +0 -46
- package/dist/components/dist/collapsible.d.ts +0 -61
- package/dist/components/dist/collapsible.js +0 -38
- package/dist/components/dist/command.config.d.ts +0 -1613
- package/dist/components/dist/command.config.js +0 -170
- package/dist/components/dist/command.d.ts +0 -1722
- package/dist/components/dist/command.js +0 -341
- package/dist/components/dist/control-color.config.d.ts +0 -979
- package/dist/components/dist/control-color.config.js +0 -81
- package/dist/components/dist/control-color.d.ts +0 -995
- package/dist/components/dist/control-color.js +0 -64
- package/dist/components/dist/control-curve.config.d.ts +0 -18
- package/dist/components/dist/control-curve.config.js +0 -14
- package/dist/components/dist/control-curve.d.ts +0 -35
- package/dist/components/dist/control-curve.js +0 -81
- package/dist/components/dist/control-folder.config.d.ts +0 -177
- package/dist/components/dist/control-folder.config.js +0 -47
- package/dist/components/dist/control-folder.d.ts +0 -194
- package/dist/components/dist/control-folder.js +0 -41
- package/dist/components/dist/control-group.config.d.ts +0 -859
- package/dist/components/dist/control-group.config.js +0 -80
- package/dist/components/dist/control-group.d.ts +0 -881
- package/dist/components/dist/control-group.js +0 -89
- package/dist/components/dist/control-knob.config.d.ts +0 -792
- package/dist/components/dist/control-knob.config.js +0 -67
- package/dist/components/dist/control-knob.d.ts +0 -819
- package/dist/components/dist/control-knob.js +0 -148
- package/dist/components/dist/control-panel.config.d.ts +0 -402
- package/dist/components/dist/control-panel.config.js +0 -38
- package/dist/components/dist/control-panel.d.ts +0 -415
- package/dist/components/dist/control-panel.js +0 -22
- package/dist/components/dist/control-select.config.d.ts +0 -1176
- package/dist/components/dist/control-select.config.js +0 -102
- package/dist/components/dist/control-select.d.ts +0 -1200
- package/dist/components/dist/control-select.js +0 -63
- package/dist/components/dist/control-slider.config.d.ts +0 -104
- package/dist/components/dist/control-slider.config.js +0 -98
- package/dist/components/dist/control-slider.d.ts +0 -127
- package/dist/components/dist/control-slider.js +0 -87
- package/dist/components/dist/control-spring.config.d.ts +0 -417
- package/dist/components/dist/control-spring.config.js +0 -36
- package/dist/components/dist/control-spring.d.ts +0 -439
- package/dist/components/dist/control-spring.js +0 -136
- package/dist/components/dist/control-stepper.config.d.ts +0 -1084
- package/dist/components/dist/control-stepper.config.js +0 -108
- package/dist/components/dist/control-stepper.d.ts +0 -1104
- package/dist/components/dist/control-stepper.js +0 -109
- package/dist/components/dist/control-toggle.config.d.ts +0 -407
- package/dist/components/dist/control-toggle.config.js +0 -26
- package/dist/components/dist/control-toggle.d.ts +0 -420
- package/dist/components/dist/control-toggle.js +0 -36
- package/dist/components/dist/createSlot.d.ts +0 -8
- package/dist/components/dist/createSlot.js +0 -89
- package/dist/components/dist/dropdown.config.d.ts +0 -920
- package/dist/components/dist/dropdown.config.js +0 -107
- package/dist/components/dist/dropdown.d.ts +0 -950
- package/dist/components/dist/dropdown.js +0 -92
- package/dist/components/dist/empty-state.config.d.ts +0 -396
- package/dist/components/dist/empty-state.config.js +0 -53
- package/dist/components/dist/empty-state.d.ts +0 -416
- package/dist/components/dist/empty-state.js +0 -33
- package/dist/components/dist/footer.d.ts +0 -11
- package/dist/components/dist/footer.js +0 -9
- package/dist/components/dist/grid.d.ts +0 -41
- package/dist/components/dist/grid.js +0 -34
- package/dist/components/dist/header.d.ts +0 -11
- package/dist/components/dist/header.js +0 -9
- package/dist/components/dist/hstack.d.ts +0 -15
- package/dist/components/dist/hstack.js +0 -21
- package/dist/components/dist/image.d.ts +0 -19
- package/dist/components/dist/image.js +0 -9
- package/dist/components/dist/input.config.d.ts +0 -58
- package/dist/components/dist/input.config.js +0 -42
- package/dist/components/dist/input.d.ts +0 -67
- package/dist/components/dist/input.js +0 -14
- package/dist/components/dist/item.config.d.ts +0 -351
- package/dist/components/dist/item.config.js +0 -83
- package/dist/components/dist/item.d.ts +0 -374
- package/dist/components/dist/item.js +0 -51
- package/dist/components/dist/list.d.ts +0 -19
- package/dist/components/dist/list.js +0 -21
- package/dist/components/dist/main.d.ts +0 -11
- package/dist/components/dist/main.js +0 -9
- package/dist/components/dist/modal.config.d.ts +0 -397
- package/dist/components/dist/modal.config.js +0 -92
- package/dist/components/dist/modal.d.ts +0 -433
- package/dist/components/dist/modal.js +0 -125
- package/dist/components/dist/nav-header.config.d.ts +0 -158
- package/dist/components/dist/nav-header.config.js +0 -26
- package/dist/components/dist/nav-header.d.ts +0 -173
- package/dist/components/dist/nav-header.js +0 -23
- package/dist/components/dist/nav.d.ts +0 -11
- package/dist/components/dist/nav.js +0 -9
- package/dist/components/dist/preset-bar.config.d.ts +0 -192
- package/dist/components/dist/preset-bar.config.js +0 -39
- package/dist/components/dist/preset-bar.d.ts +0 -215
- package/dist/components/dist/preset-bar.js +0 -71
- package/dist/components/dist/presets/index.d.ts +0 -17674
- package/dist/components/dist/presets/index.js +0 -97
- package/dist/components/dist/pressable.d.ts +0 -11
- package/dist/components/dist/pressable.js +0 -9
- package/dist/components/dist/progress.config.d.ts +0 -296
- package/dist/components/dist/progress.config.js +0 -35
- package/dist/components/dist/progress.d.ts +0 -311
- package/dist/components/dist/progress.js +0 -43
- package/dist/components/dist/section.d.ts +0 -11
- package/dist/components/dist/section.js +0 -9
- package/dist/components/dist/select.config.d.ts +0 -31
- package/dist/components/dist/select.config.js +0 -25
- package/dist/components/dist/select.d.ts +0 -45
- package/dist/components/dist/select.js +0 -13
- package/dist/components/dist/sheet.config.d.ts +0 -245
- package/dist/components/dist/sheet.config.js +0 -99
- package/dist/components/dist/sheet.d.ts +0 -267
- package/dist/components/dist/sheet.js +0 -53
- package/dist/components/dist/sidebar.config.d.ts +0 -1651
- package/dist/components/dist/sidebar.config.js +0 -217
- package/dist/components/dist/sidebar.d.ts +0 -1825
- package/dist/components/dist/sidebar.js +0 -492
- package/dist/components/dist/skeleton.config.d.ts +0 -16
- package/dist/components/dist/skeleton.config.js +0 -10
- package/dist/components/dist/skeleton.d.ts +0 -27
- package/dist/components/dist/skeleton.js +0 -16
- package/dist/components/dist/slider.config.d.ts +0 -44
- package/dist/components/dist/slider.config.js +0 -40
- package/dist/components/dist/slider.d.ts +0 -70
- package/dist/components/dist/slider.js +0 -247
- package/dist/components/dist/spinner.config.d.ts +0 -34
- package/dist/components/dist/spinner.config.js +0 -24
- package/dist/components/dist/spinner.d.ts +0 -42
- package/dist/components/dist/spinner.js +0 -29
- package/dist/components/dist/svg.d.ts +0 -21
- package/dist/components/dist/svg.js +0 -17
- package/dist/components/dist/switch.config.d.ts +0 -353
- package/dist/components/dist/switch.config.js +0 -47
- package/dist/components/dist/switch.d.ts +0 -370
- package/dist/components/dist/switch.js +0 -32
- package/dist/components/dist/table.d.ts +0 -36
- package/dist/components/dist/table.js +0 -29
- package/dist/components/dist/tabs.config.d.ts +0 -611
- package/dist/components/dist/tabs.config.js +0 -56
- package/dist/components/dist/tabs.d.ts +0 -632
- package/dist/components/dist/tabs.js +0 -77
- package/dist/components/dist/text.config.d.ts +0 -306
- package/dist/components/dist/text.config.js +0 -149
- package/dist/components/dist/text.d.ts +0 -205
- package/dist/components/dist/text.js +0 -12
- package/dist/components/dist/textarea.config.d.ts +0 -352
- package/dist/components/dist/textarea.config.js +0 -57
- package/dist/components/dist/textarea.d.ts +0 -362
- package/dist/components/dist/textarea.js +0 -9
- package/dist/components/dist/toast.config.d.ts +0 -335
- package/dist/components/dist/toast.config.js +0 -145
- package/dist/components/dist/toast.d.ts +0 -426
- package/dist/components/dist/toast.js +0 -159
- package/dist/components/dist/tooltip.config.d.ts +0 -193
- package/dist/components/dist/tooltip.config.js +0 -40
- package/dist/components/dist/tooltip.d.ts +0 -206
- package/dist/components/dist/tooltip.js +0 -28
- package/dist/components/dist/vstack.d.ts +0 -15
- package/dist/components/dist/vstack.js +0 -20
- package/dist/components/dropdown.config.d.ts +0 -2
- package/dist/components/dropdown.config.js +0 -2
- package/dist/components/dropdown.d.ts +0 -2
- package/dist/components/dropdown.js +0 -2
- package/dist/components/empty-state.config.d.ts +0 -2
- package/dist/components/empty-state.config.js +0 -2
- package/dist/components/empty-state.d.ts +0 -2
- package/dist/components/empty-state.js +0 -2
- package/dist/components/footer.d.ts +0 -2
- package/dist/components/footer.js +0 -2
- package/dist/components/grid.d.ts +0 -2
- package/dist/components/grid.js +0 -2
- package/dist/components/header.d.ts +0 -2
- package/dist/components/header.js +0 -2
- package/dist/components/hstack.d.ts +0 -2
- package/dist/components/hstack.js +0 -2
- package/dist/components/image.d.ts +0 -2
- package/dist/components/image.js +0 -2
- package/dist/components/input.config.d.ts +0 -2
- package/dist/components/input.config.js +0 -2
- package/dist/components/input.d.ts +0 -2
- package/dist/components/input.js +0 -2
- package/dist/components/item.config.d.ts +0 -2
- package/dist/components/item.config.js +0 -2
- package/dist/components/item.d.ts +0 -2
- package/dist/components/item.js +0 -2
- package/dist/components/list.d.ts +0 -2
- package/dist/components/list.js +0 -2
- package/dist/components/main.d.ts +0 -2
- package/dist/components/main.js +0 -2
- package/dist/components/modal.config.d.ts +0 -2
- package/dist/components/modal.config.js +0 -2
- package/dist/components/modal.d.ts +0 -2
- package/dist/components/modal.js +0 -2
- package/dist/components/nav-header.config.d.ts +0 -2
- package/dist/components/nav-header.config.js +0 -2
- package/dist/components/nav-header.d.ts +0 -2
- package/dist/components/nav-header.js +0 -2
- package/dist/components/nav.d.ts +0 -2
- package/dist/components/nav.js +0 -2
- package/dist/components/preset-bar.config.d.ts +0 -2
- package/dist/components/preset-bar.config.js +0 -2
- package/dist/components/preset-bar.d.ts +0 -2
- package/dist/components/preset-bar.js +0 -2
- package/dist/components/presets/index.d.ts +0 -44
- package/dist/components/presets/index.js +0 -44
- package/dist/components/pressable.d.ts +0 -2
- package/dist/components/pressable.js +0 -2
- package/dist/components/progress.config.d.ts +0 -2
- package/dist/components/progress.config.js +0 -2
- package/dist/components/progress.d.ts +0 -2
- package/dist/components/progress.js +0 -2
- package/dist/components/section.d.ts +0 -2
- package/dist/components/section.js +0 -2
- package/dist/components/select.config.d.ts +0 -2
- package/dist/components/select.config.js +0 -2
- package/dist/components/select.d.ts +0 -2
- package/dist/components/select.js +0 -2
- package/dist/components/sheet.config.d.ts +0 -2
- package/dist/components/sheet.config.js +0 -2
- package/dist/components/sheet.d.ts +0 -2
- package/dist/components/sheet.js +0 -2
- package/dist/components/sidebar.config.d.ts +0 -2
- package/dist/components/sidebar.config.js +0 -2
- package/dist/components/sidebar.d.ts +0 -2
- package/dist/components/sidebar.js +0 -2
- package/dist/components/skeleton.config.d.ts +0 -2
- package/dist/components/skeleton.config.js +0 -2
- package/dist/components/skeleton.d.ts +0 -2
- package/dist/components/skeleton.js +0 -2
- package/dist/components/slider.config.d.ts +0 -2
- package/dist/components/slider.config.js +0 -2
- package/dist/components/slider.d.ts +0 -2
- package/dist/components/slider.js +0 -2
- package/dist/components/spinner.config.d.ts +0 -2
- package/dist/components/spinner.config.js +0 -2
- package/dist/components/spinner.d.ts +0 -2
- package/dist/components/spinner.js +0 -2
- package/dist/components/svg.d.ts +0 -2
- package/dist/components/svg.js +0 -2
- package/dist/components/switch.config.d.ts +0 -2
- package/dist/components/switch.config.js +0 -2
- package/dist/components/switch.d.ts +0 -2
- package/dist/components/switch.js +0 -2
- package/dist/components/table.d.ts +0 -2
- package/dist/components/table.js +0 -2
- package/dist/components/tabs.config.d.ts +0 -2
- package/dist/components/tabs.config.js +0 -2
- package/dist/components/tabs.d.ts +0 -2
- package/dist/components/tabs.js +0 -2
- package/dist/components/text.config.d.ts +0 -2
- package/dist/components/text.config.js +0 -2
- package/dist/components/text.d.ts +0 -2
- package/dist/components/text.js +0 -2
- package/dist/components/textarea.config.d.ts +0 -2
- package/dist/components/textarea.config.js +0 -2
- package/dist/components/textarea.d.ts +0 -2
- package/dist/components/textarea.js +0 -2
- package/dist/components/toast.config.d.ts +0 -2
- package/dist/components/toast.config.js +0 -2
- package/dist/components/toast.d.ts +0 -2
- package/dist/components/toast.js +0 -2
- package/dist/components/tooltip.config.d.ts +0 -2
- package/dist/components/tooltip.config.js +0 -2
- package/dist/components/tooltip.d.ts +0 -2
- package/dist/components/tooltip.js +0 -2
- package/dist/components/vstack.d.ts +0 -2
- package/dist/components/vstack.js +0 -2
- package/dist/config/dist/component-config.d.ts +0 -349
- package/dist/config/dist/component-refs.d.ts +0 -98
- package/dist/config/dist/component-resolution.js +0 -78
- package/dist/config/dist/consts/defaultColors.d.ts +0 -253
- package/dist/config/dist/consts/defaultColors.js +0 -252
- package/dist/config/dist/createComponent.d.ts +0 -1
- package/dist/config/dist/createComponent.js +0 -1
- package/dist/config/dist/createConfig.d.ts +0 -375
- package/dist/config/dist/createConfig.js +0 -625
- package/dist/config/dist/defineComponent.d.ts +0 -24
- package/dist/config/dist/defineComponent.js +0 -2
- package/dist/config/dist/defineStyleProp.d.ts +0 -93
- package/dist/config/dist/defineStyleProp.js +0 -60
- package/dist/config/dist/preset-merge.js +0 -192
- package/dist/config/dist/propertyAcceptedTypes.js +0 -220
- package/dist/config/dist/propertyGroups.d.ts +0 -1
- package/dist/config/dist/propertyGroups.js +0 -414
- package/dist/config/dist/resolveStyleProp.d.ts +0 -88
- package/dist/config/dist/resolveStyleProp.js +0 -235
- package/dist/config/dist/resolveTokenTypes.d.ts +0 -1
- package/dist/config/dist/resolveTokenTypes.js +0 -149
- package/dist/config/dist/runtime-registry.js +0 -9
- package/dist/config/dist/serialize.d.ts +0 -73
- package/dist/config/dist/serialize.js +0 -172
- package/dist/config/dist/style-prop-runtime.d.ts +0 -1
- package/dist/config-utils/dist/componentConfig.d.ts +0 -10
- package/dist/config-utils/dist/componentConfig.js +0 -11
- package/dist/config-utils.d.ts +0 -2
- package/dist/config-utils.js +0 -2
- package/dist/core/dist/color-opacity-map.js +0 -33
- package/dist/core/dist/compositeStyles.d.ts +0 -21
- package/dist/core/dist/compositeStyles.js +0 -51
- package/dist/core/dist/configurable-prop-helpers.d.ts +0 -31
- package/dist/core/dist/configurable-prop-helpers.js +0 -61
- package/dist/core/dist/createComponent.boundaries.js +0 -192
- package/dist/core/dist/createComponent.d.ts +0 -56
- package/dist/core/dist/createComponent.js +0 -67
- package/dist/core/dist/createComponentExample.d.ts +0 -41
- package/dist/core/dist/createComponentExample.js +0 -27
- package/dist/core/dist/createProvider.d.ts +0 -12
- package/dist/core/dist/createProvider.js +0 -24
- package/dist/core/dist/generated/stylePropsTwMap.d.ts +0 -1700
- package/dist/core/dist/generated/stylePropsTwMap.js +0 -570
- package/dist/core/dist/getComponentStyles.d.ts +0 -49
- package/dist/core/dist/getComponentStyles.js +0 -85
- package/dist/core/dist/getStyles.d.ts +0 -42
- package/dist/core/dist/getStyles.js +0 -300
- package/dist/core/dist/index.d.ts +0 -13
- package/dist/core/dist/index.js +0 -13
- package/dist/core/dist/modifier-mappings.d.ts +0 -12
- package/dist/core/dist/modifier-mappings.js +0 -61
- package/dist/core/dist/resolveMotionState.d.ts +0 -4
- package/dist/core/dist/resolveMotionState.js +0 -17
- package/dist/core/dist/resolveProps.boundaries.js +0 -131
- package/dist/core/dist/style-prop-data.d.ts +0 -32
- package/dist/core/dist/style-prop-data.js +0 -1257
- package/dist/core/dist/transformPreset.d.ts +0 -17
- package/dist/core/dist/transformPreset.js +0 -28
- package/dist/core/dist/withDefaultStyleProps.d.ts +0 -43
- package/dist/core/dist/withDefaultStyleProps.js +0 -18
- package/dist/core.d.ts +0 -14
- package/dist/core.js +0 -15
- package/dist/createSlot.d.ts +0 -2
- package/dist/createSlot.js +0 -2
- package/dist/fixtures.d.ts +0 -4
- package/dist/fixtures.js +0 -5
- package/dist/foundational-presets/dist/_virtual/_rolldown/runtime.js +0 -13
- package/dist/foundational-presets/dist/defaultPreset.d.ts +0 -1557
- package/dist/foundational-presets/dist/defaultPreset.js +0 -615
- package/dist/foundational-presets/dist/index.d.ts +0 -1
- package/dist/foundational-presets/dist/index.js +0 -1
- package/dist/foundational-presets/dist/motion.d.ts +0 -12
- package/dist/foundational-presets/dist/style-props.js +0 -1445
- package/dist/loader/dist/loader/create-component-data.js +0 -33
- package/dist/loader/dist/loader/create-component-lowering.js +0 -454
- package/dist/loader/dist/loader/data-attr-transform.js +0 -191
- package/dist/loader/dist/loader/dynamic-style-codegen.js +0 -97
- package/dist/loader/dist/loader/internal-meta.js +0 -22
- package/dist/loader/dist/loader/lower-new-api-primitive.js +0 -90
- package/dist/loader/dist/loader/motion-transform.js +0 -717
- package/dist/loader/dist/loader/style-transform.js +0 -670
- package/dist/loader/dist/node_modules/react/cjs/react-jsx-runtime.development.js +0 -203
- package/dist/loader/dist/node_modules/react/cjs/react-jsx-runtime.production.js +0 -25
- package/dist/loader/dist/node_modules/react/cjs/react.development.js +0 -762
- package/dist/loader/dist/node_modules/react/cjs/react.production.js +0 -351
- package/dist/loader/dist/node_modules/react/index.js +0 -10
- package/dist/loader/dist/node_modules/react/jsx-runtime.js +0 -10
- package/dist/loader/dist/packages/core/dist/color-opacity-map.js +0 -33
- package/dist/loader/dist/packages/core/dist/compositeStyles.js +0 -43
- package/dist/loader/dist/packages/core/dist/createComponent.js +0 -6
- package/dist/loader/dist/packages/core/dist/createProvider.js +0 -7
- package/dist/loader/dist/packages/core/dist/generated/stylePropsTwMap.js +0 -570
- package/dist/loader/dist/packages/core/dist/getComponentStyles.js +0 -2
- package/dist/loader/dist/packages/core/dist/getStyles.js +0 -60
- package/dist/loader/dist/packages/core/dist/index.js +0 -6
- package/dist/loader/dist/packages/core/dist/modifier-mappings.js +0 -61
- package/dist/loader/dist/packages/core/dist/style-prop-data.js +0 -1257
- package/dist/loader/dist/packages/core/dist/withDefaultStyleProps.js +0 -1
- package/dist/presets/dist/defaultPreset.d.ts +0 -6
- package/dist/presets/dist/defaultPreset.js +0 -51
- package/dist/presets/dist/index.d.ts +0 -1
- package/dist/presets/dist/index.js +0 -1
- package/dist/presets/motion.d.ts +0 -2
- package/dist/presets/motion.js +0 -2
- package/dist/presets.d.ts +0 -2
- package/dist/presets.js +0 -3
- package/dist/styles.d.ts +0 -4
- package/dist/styles.js +0 -5
- package/dist/transformPreset.d.ts +0 -2
- package/dist/transformPreset.js +0 -3
- /package/dist/{config/dist/component-resolution.d.ts → loader/dist/transform-runner.d.ts} +0 -0
|
@@ -1,670 +0,0 @@
|
|
|
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 { expandCompositeStyles } from "../packages/core/dist/compositeStyles.js";
|
|
6
|
-
import { propMappings } from "../packages/core/dist/style-prop-data.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, "_").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 compositeStylesConf = transformData?.compositeStylesConfig ?? {};
|
|
159
|
-
let effectiveProps = styleProps;
|
|
160
|
-
if (Object.keys(compositeStylesConf).length > 0 && !modifierPrefix) {
|
|
161
|
-
const { expanded, markerClasses } = expandCompositeStyles(styleProps, compositeStylesConf);
|
|
162
|
-
effectiveProps = expanded;
|
|
163
|
-
if (markerClasses.length > 0) effectiveProps.__compositeStyleMarkers = markerClasses;
|
|
164
|
-
}
|
|
165
|
-
for (const { colorProp, opacityProp, separator } of transformData?.colorOpacityPairs ?? []) if (effectiveProps[opacityProp] !== void 0 && effectiveProps[colorProp] !== void 0) {
|
|
166
|
-
effectiveProps[colorProp] = `${effectiveProps[colorProp]}${separator}${effectiveProps[opacityProp]}`;
|
|
167
|
-
delete effectiveProps[opacityProp];
|
|
168
|
-
}
|
|
169
|
-
const classParts = [];
|
|
170
|
-
if (Array.isArray(effectiveProps.__compositeStyleMarkers)) {
|
|
171
|
-
classParts.push(...effectiveProps.__compositeStyleMarkers);
|
|
172
|
-
delete effectiveProps.__compositeStyleMarkers;
|
|
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 };
|