@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
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { attachSourcePath, captureCallerPath } from "./captureCallerPath.js";
|
|
2
|
+
import { isComponentRef } from "./refs.js";
|
|
3
|
+
//#region ../config/dist/defineAssetGroup.js
|
|
4
|
+
/**
|
|
5
|
+
* `defineAssetGroup(members).config({...})` — the asset registration
|
|
6
|
+
* factory. Members are positional (matching
|
|
7
|
+
* `defineTokenGroup(tokens)`, wildcard-import friendly); everything
|
|
8
|
+
* else lives in one chained `.config({...})` discriminated-union.
|
|
9
|
+
*
|
|
10
|
+
* The return value does double duty, the same way `BoundComponent` is
|
|
11
|
+
* both a `ComponentDefinition` and an `FC`:
|
|
12
|
+
*
|
|
13
|
+
* - it is the registerable group (`uds.registerAssetGroups({ icons })`
|
|
14
|
+
* reads `members` + config fields off it), and
|
|
15
|
+
* - it carries the embedded `__kind: 'assetGroup'` / `ref` tag that
|
|
16
|
+
* `isAssetGroupRef()` / `slot().accepts(...)` read.
|
|
17
|
+
*
|
|
18
|
+
* The `ref` slug is bound late: `registerAssetGroups` stamps the
|
|
19
|
+
* registration key onto the object (the key IS the slug — same
|
|
20
|
+
* late-binding precedent as `Component.registryKey`'s namespace
|
|
21
|
+
* getter). Reading `ref` before registration throws — an unregistered
|
|
22
|
+
* group has no identity to point at.
|
|
23
|
+
*/
|
|
24
|
+
/** Icon-class asset names are PascalCase identifiers — each asset class has its own naming rule (fonts use kebab-case below). */
|
|
25
|
+
const PASCAL_CASE = /^[A-Z][A-Za-z0-9]*$/;
|
|
26
|
+
/** Font-class asset names are kebab-case `FontID`s (`yas`, `centra-no2`). */
|
|
27
|
+
const KEBAB_CASE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
|
|
28
|
+
/**
|
|
29
|
+
* Component-shaped: a plain function component, or a forwardRef/memo
|
|
30
|
+
* exotic (an object stamped with React's `$$typeof` symbol).
|
|
31
|
+
*/
|
|
32
|
+
function isComponentShaped(value) {
|
|
33
|
+
if (typeof value === "function") return true;
|
|
34
|
+
return typeof value === "object" && value !== null && typeof value.$$typeof === "symbol";
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Read and *sanitize* a member's static `.metadata`. The harvest is the
|
|
38
|
+
* trust boundary for arbitrary wildcard imports, so loosely-shaped
|
|
39
|
+
* fields are dropped rather than cast — `variants: 'outline'` must not
|
|
40
|
+
* iterate char-by-char into `['o','u','t',…]` downstream.
|
|
41
|
+
*/
|
|
42
|
+
function readIconMetadata(value) {
|
|
43
|
+
if (typeof value !== "function" && typeof value !== "object") return;
|
|
44
|
+
if (value === null) return void 0;
|
|
45
|
+
const metadata = value.metadata;
|
|
46
|
+
if (metadata === null || typeof metadata !== "object") return void 0;
|
|
47
|
+
const raw = metadata;
|
|
48
|
+
const out = {};
|
|
49
|
+
if (typeof raw.name === "string" && raw.name.length > 0) out.name = raw.name;
|
|
50
|
+
if (typeof raw.isSvgIcon === "boolean") out.isSvgIcon = raw.isSvgIcon;
|
|
51
|
+
if (isStringArray(raw.variants)) out.variants = raw.variants;
|
|
52
|
+
if (typeof raw.category === "string") out.category = raw.category;
|
|
53
|
+
if (isStringArray(raw.tags)) out.tags = raw.tags;
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
function isStringArray(value) {
|
|
57
|
+
return Array.isArray(value) && value.every((entry) => typeof entry === "string");
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Icon-class harvest. Wildcard `import * as` carries everything a
|
|
61
|
+
* package exports — helpers, constants, possibly `default` — so
|
|
62
|
+
* non-matching exports are *skipped*, not errors:
|
|
63
|
+
*
|
|
64
|
+
* - `.metadata.isSvgIcon === true` is definitive — the member is an
|
|
65
|
+
* icon (named via `.metadata.name`, falling back to the export key).
|
|
66
|
+
* - `.metadata.isSvgIcon === false` is the explicit opt-out — skipped.
|
|
67
|
+
* Unrelated metadata (no `isSvgIcon` field) does NOT opt out; the
|
|
68
|
+
* convention below still applies, so one foreign metadata shape
|
|
69
|
+
* can't silently shrink the harvest.
|
|
70
|
+
* - Otherwise the documented convention applies: PascalCase export
|
|
71
|
+
* key + component-shaped value (covers metadata-less Phosphor-style
|
|
72
|
+
* libraries).
|
|
73
|
+
* - `default` is never registered literally — it registers only when
|
|
74
|
+
* explicit icon metadata supplies a usable PascalCase name (i.e. it
|
|
75
|
+
* gets renamed), and is otherwise skipped as wildcard noise. This
|
|
76
|
+
* deliberately includes an explicit-icon `default` whose
|
|
77
|
+
* `.metadata.name` fails the PascalCase rule: it is *skipped*, not
|
|
78
|
+
* thrown — unlike the same mistake on a named export (below). A
|
|
79
|
+
* `default` carries no authored intent to register under a literal
|
|
80
|
+
* name, so an unusable name on it is noise, not an author error.
|
|
81
|
+
*
|
|
82
|
+
* The loud failures inside the skip-friendly walk: an explicit icon
|
|
83
|
+
* (`isSvgIcon: true`) on a *named* export whose resolved name fails the
|
|
84
|
+
* PascalCase rule, or two members resolving to the same name — both
|
|
85
|
+
* are author errors, not wildcard noise.
|
|
86
|
+
*/
|
|
87
|
+
function harvestIconMembers(raw, include) {
|
|
88
|
+
const members = {};
|
|
89
|
+
const memberMetadata = {};
|
|
90
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
91
|
+
if (include && !include(key)) continue;
|
|
92
|
+
if (!isComponentShaped(value)) continue;
|
|
93
|
+
const metadata = readIconMetadata(value);
|
|
94
|
+
const isExplicitIcon = metadata?.isSvgIcon === true;
|
|
95
|
+
if (metadata?.isSvgIcon === false) continue;
|
|
96
|
+
const name = isExplicitIcon ? metadata?.name ?? key : key;
|
|
97
|
+
if (key === "default") {
|
|
98
|
+
if (!isExplicitIcon || !PASCAL_CASE.test(name)) continue;
|
|
99
|
+
} else if (!isExplicitIcon) {
|
|
100
|
+
if (!PASCAL_CASE.test(key)) continue;
|
|
101
|
+
} else if (!PASCAL_CASE.test(name)) throw new Error(`defineAssetGroup: icon member "${key}" resolves to asset name "${name}", which is not a PascalCase identifier — icon asset names become the asset-id name segment. Rename the export or set \`.metadata.name\`.`);
|
|
102
|
+
if (members[name] !== void 0) throw new Error(`defineAssetGroup: two icon members resolve to the asset name "${name}" — asset names must be unique within a group.`);
|
|
103
|
+
members[name] = value;
|
|
104
|
+
memberMetadata[name] = metadata ?? {};
|
|
105
|
+
}
|
|
106
|
+
if (Object.keys(members).length === 0) throw new Error("defineAssetGroup: no icon members harvested — expected PascalCase component exports (or components carrying `.metadata.isSvgIcon`). For a font group, declare `.config({ type: 'font' })`.");
|
|
107
|
+
return {
|
|
108
|
+
members,
|
|
109
|
+
memberMetadata
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Font-class guard. Unlike the icon wildcard filter, font members come
|
|
114
|
+
* from an explicit data map where every entry is intended — a member
|
|
115
|
+
* failing the class contract (`fontFamily` + `declarations[]`) is a
|
|
116
|
+
* named config-load error, never a silent skip.
|
|
117
|
+
*/
|
|
118
|
+
function guardFontMembers(raw) {
|
|
119
|
+
const members = {};
|
|
120
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
121
|
+
if (!KEBAB_CASE.test(key)) throw new Error(`defineAssetGroup: font member "${key}" is not a kebab-case FontID — font asset names become the asset-id name segment (e.g. "yas", "centra-no2").`);
|
|
122
|
+
const record = value;
|
|
123
|
+
const fontFamily = record?.fontFamily;
|
|
124
|
+
const declarations = record?.declarations;
|
|
125
|
+
if (typeof fontFamily !== "string" || fontFamily.length === 0) throw new Error(`defineAssetGroup: font member "${key}" fails the 'font' class contract — missing a non-empty \`fontFamily\` string.`);
|
|
126
|
+
if (!Array.isArray(declarations)) throw new Error(`defineAssetGroup: font member "${key}" fails the 'font' class contract — missing a \`declarations\` array.`);
|
|
127
|
+
members[key] = value;
|
|
128
|
+
}
|
|
129
|
+
if (Object.keys(members).length === 0) throw new Error("defineAssetGroup: font group has no members — pass the font declarations map (e.g. FONT_DECLARATIONS_MAP).");
|
|
130
|
+
return members;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Variant superset when `config.variants` is omitted: the harvested
|
|
134
|
+
* union of members' `.metadata.variants`, first-seen order.
|
|
135
|
+
*/
|
|
136
|
+
function deriveVariantUnion(memberMetadata) {
|
|
137
|
+
const union = [];
|
|
138
|
+
for (const metadata of Object.values(memberMetadata)) for (const variant of metadata.variants ?? []) if (!union.includes(variant)) union.push(variant);
|
|
139
|
+
return union;
|
|
140
|
+
}
|
|
141
|
+
/** Internal slug slot the late-bound `ref` getter reads. @internal */
|
|
142
|
+
const ASSET_GROUP_SLUG_KEY = "__slug";
|
|
143
|
+
/**
|
|
144
|
+
* Safe slug read for error messages — never throws, unlike the `ref`
|
|
145
|
+
* getter. Returns `undefined` for an unregistered group. @internal
|
|
146
|
+
*/
|
|
147
|
+
function readAssetGroupSlug(value) {
|
|
148
|
+
if (typeof value !== "object" || value === null) return void 0;
|
|
149
|
+
const slug = value[ASSET_GROUP_SLUG_KEY];
|
|
150
|
+
return typeof slug === "string" ? slug : void 0;
|
|
151
|
+
}
|
|
152
|
+
function defineHidden(target, key, value) {
|
|
153
|
+
Object.defineProperty(target, key, {
|
|
154
|
+
enumerable: false,
|
|
155
|
+
configurable: true,
|
|
156
|
+
writable: true,
|
|
157
|
+
value
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Stamp the invariant `__kind: 'assetGroup'` ref tag. Deliberately
|
|
162
|
+
* deferred to the end of `.config()` so an unconfigured builder never
|
|
163
|
+
* passes `isAssetGroupRef()` — the guard's truth implies a complete,
|
|
164
|
+
* registerable group.
|
|
165
|
+
*/
|
|
166
|
+
function stampRefTag(target) {
|
|
167
|
+
Object.defineProperty(target, "__kind", {
|
|
168
|
+
enumerable: false,
|
|
169
|
+
configurable: true,
|
|
170
|
+
writable: false,
|
|
171
|
+
value: "assetGroup"
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Attach icon metadata to a single one-off icon and hand it back
|
|
176
|
+
* unchanged. `isSvgIcon: true` is implied —
|
|
177
|
+
* the point of the call is to mark the component as an icon so the
|
|
178
|
+
* group harvest picks it up. Slots still point at the *group*, never
|
|
179
|
+
* at this.
|
|
180
|
+
*/
|
|
181
|
+
function defineAssetIcon(component, metadata) {
|
|
182
|
+
Object.defineProperty(component, "metadata", {
|
|
183
|
+
enumerable: true,
|
|
184
|
+
configurable: true,
|
|
185
|
+
writable: true,
|
|
186
|
+
value: {
|
|
187
|
+
isSvgIcon: true,
|
|
188
|
+
...metadata
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
return component;
|
|
192
|
+
}
|
|
193
|
+
function defineAssetGroup(members) {
|
|
194
|
+
const out = {};
|
|
195
|
+
attachSourcePath(out, captureCallerPath());
|
|
196
|
+
Object.defineProperty(out, ASSET_GROUP_SLUG_KEY, {
|
|
197
|
+
enumerable: false,
|
|
198
|
+
configurable: true,
|
|
199
|
+
writable: true,
|
|
200
|
+
value: void 0
|
|
201
|
+
});
|
|
202
|
+
Object.defineProperty(out, "ref", {
|
|
203
|
+
enumerable: false,
|
|
204
|
+
configurable: true,
|
|
205
|
+
get() {
|
|
206
|
+
const slug = readAssetGroupSlug(out);
|
|
207
|
+
if (slug === void 0) throw new Error("AssetGroup.ref read before registration — the slug is late-bound from the `registerAssetGroups({ <slug>: group })` record key. Register the group first.");
|
|
208
|
+
return slug;
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
Object.defineProperty(out, "config", {
|
|
212
|
+
enumerable: false,
|
|
213
|
+
configurable: true,
|
|
214
|
+
writable: true,
|
|
215
|
+
value(config) {
|
|
216
|
+
if (out.assetKind !== void 0) throw new Error("defineAssetGroup: .config({...}) may only be called once per group.");
|
|
217
|
+
if (config.label !== void 0) out.label = config.label;
|
|
218
|
+
if (config.description !== void 0) out.description = config.description;
|
|
219
|
+
if (config.type === "font") {
|
|
220
|
+
const fontMembers = guardFontMembers(members);
|
|
221
|
+
out.assetKind = "font";
|
|
222
|
+
defineHidden(out, "members", fontMembers);
|
|
223
|
+
stampRefTag(out);
|
|
224
|
+
return out;
|
|
225
|
+
}
|
|
226
|
+
let resolvedSizes = config.sizes;
|
|
227
|
+
let resolvedVariants = config.variants;
|
|
228
|
+
if (config.props !== void 0) {
|
|
229
|
+
if (config.sizes !== void 0 || config.variants !== void 0) throw new Error("defineAssetGroup: `props` cannot be combined with the flat `sizes`/`variants` fields — use one or the other.");
|
|
230
|
+
const mapEntries = [];
|
|
231
|
+
const arrayEntries = [];
|
|
232
|
+
for (const [key, value] of Object.entries(config.props)) {
|
|
233
|
+
if (value === void 0) continue;
|
|
234
|
+
if (Array.isArray(value)) arrayEntries.push([key, value]);
|
|
235
|
+
else if (typeof value === "object" && value !== null) mapEntries.push([key, value]);
|
|
236
|
+
else throw new Error(`defineAssetGroup: \`props.${key}\` must be a named→px map (size axis) or an array (variant axis).`);
|
|
237
|
+
}
|
|
238
|
+
if (mapEntries.length !== 1) throw new Error("defineAssetGroup: `props` requires exactly one named→px map entry (the size axis).");
|
|
239
|
+
if (arrayEntries.length > 1) throw new Error("defineAssetGroup: `props` supports at most one array entry (the variant axis) — the serialized format holds a single variant axis.");
|
|
240
|
+
const [, sizeMap] = mapEntries[0];
|
|
241
|
+
resolvedSizes = sizeMap;
|
|
242
|
+
if (arrayEntries.length === 1) {
|
|
243
|
+
const [, variantValues] = arrayEntries[0];
|
|
244
|
+
resolvedVariants = variantValues;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (resolvedSizes === void 0 || Object.keys(resolvedSizes).length === 0) throw new Error("defineAssetGroup: icon groups require a non-empty `sizes` map (named size → px) — declare it via `props: { size: {…} }` or the flat `sizes` field. The picker derives its size options from the keys.");
|
|
248
|
+
const { members: harvested, memberMetadata } = harvestIconMembers(members, config.include);
|
|
249
|
+
out.assetKind = "icon";
|
|
250
|
+
defineHidden(out, "members", harvested);
|
|
251
|
+
defineHidden(out, "memberMetadata", memberMetadata);
|
|
252
|
+
out.sizes = { ...resolvedSizes };
|
|
253
|
+
out.variants = resolvedVariants ? [...resolvedVariants] : deriveVariantUnion(memberMetadata);
|
|
254
|
+
const componentName = isComponentRef(config.component) ? config.component.ref : config.component;
|
|
255
|
+
if (componentName !== void 0) out.component = componentName;
|
|
256
|
+
stampRefTag(out);
|
|
257
|
+
return out;
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
return out;
|
|
261
|
+
}
|
|
262
|
+
//#endregion
|
|
263
|
+
export { ASSET_GROUP_SLUG_KEY, defineAssetGroup, defineAssetIcon, readAssetGroupSlug };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ProviderComponent, ProviderRenderFn } from "./factories.js";
|
|
2
|
+
|
|
3
|
+
//#region ../config/dist/defineProvider.d.ts
|
|
4
|
+
//#region src/defineProvider.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Pair a React context with a Provider component + matching hook in
|
|
7
|
+
* one declaration. The render-fn receives the props, returns
|
|
8
|
+
* `{ context, render }` — `context` is what the hook returns; `render`
|
|
9
|
+
* is the JSX (typically `<>{children}<Portal /></>` and similar).
|
|
10
|
+
*
|
|
11
|
+
* export const [ToastProvider, useToast] = defineProvider<ToastCtx>(
|
|
12
|
+
* ({ children }) => {
|
|
13
|
+
* const [toasts, setToasts] = useState<ToastItem[]>([]);
|
|
14
|
+
* return {
|
|
15
|
+
* context: { addToast, dismissToast, updateToast },
|
|
16
|
+
* render: <>{children}<Portal /></>,
|
|
17
|
+
* };
|
|
18
|
+
* },
|
|
19
|
+
* );
|
|
20
|
+
*
|
|
21
|
+
* uds.registerProviders({ ToastProvider });
|
|
22
|
+
*
|
|
23
|
+
* Lives in its own module so the React (`createContext`) imports don't
|
|
24
|
+
* land in the static graph of every consumer importing `@uds/config`
|
|
25
|
+
* — Turbopack flags `createContext` reaching a server-component module
|
|
26
|
+
* as an error.
|
|
27
|
+
*/
|
|
28
|
+
declare function defineProvider<TContext, TProps = Record<never, never>>(renderFn: ProviderRenderFn<TContext, TProps>): [ProviderComponent<TProps>, () => TContext]; //#endregion
|
|
29
|
+
//#endregion
|
|
30
|
+
export { defineProvider };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { attachSourcePath, captureCallerPath } from "./captureCallerPath.js";
|
|
3
|
+
import { createContext, createElement, useContext } from "react";
|
|
4
|
+
//#region ../config/dist/defineProvider.js
|
|
5
|
+
/**
|
|
6
|
+
* Pair a React context with a Provider component + matching hook in
|
|
7
|
+
* one declaration. The render-fn receives the props, returns
|
|
8
|
+
* `{ context, render }` — `context` is what the hook returns; `render`
|
|
9
|
+
* is the JSX (typically `<>{children}<Portal /></>` and similar).
|
|
10
|
+
*
|
|
11
|
+
* export const [ToastProvider, useToast] = defineProvider<ToastCtx>(
|
|
12
|
+
* ({ children }) => {
|
|
13
|
+
* const [toasts, setToasts] = useState<ToastItem[]>([]);
|
|
14
|
+
* return {
|
|
15
|
+
* context: { addToast, dismissToast, updateToast },
|
|
16
|
+
* render: <>{children}<Portal /></>,
|
|
17
|
+
* };
|
|
18
|
+
* },
|
|
19
|
+
* );
|
|
20
|
+
*
|
|
21
|
+
* uds.registerProviders({ ToastProvider });
|
|
22
|
+
*
|
|
23
|
+
* Lives in its own module so the React (`createContext`) imports don't
|
|
24
|
+
* land in the static graph of every consumer importing `@uds/config`
|
|
25
|
+
* — Turbopack flags `createContext` reaching a server-component module
|
|
26
|
+
* as an error.
|
|
27
|
+
*/
|
|
28
|
+
function defineProvider(renderFn) {
|
|
29
|
+
const Context = createContext(null);
|
|
30
|
+
const marker = {};
|
|
31
|
+
function Provider(props) {
|
|
32
|
+
const result = renderFn(props);
|
|
33
|
+
return createElement(Context.Provider, { value: result.context }, result.render);
|
|
34
|
+
}
|
|
35
|
+
Provider.displayName = "Provider";
|
|
36
|
+
Object.defineProperty(Provider, "__udsProvider", {
|
|
37
|
+
enumerable: false,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: false,
|
|
40
|
+
value: marker
|
|
41
|
+
});
|
|
42
|
+
function useProviderContext() {
|
|
43
|
+
let ctx;
|
|
44
|
+
try {
|
|
45
|
+
ctx = useContext(Context);
|
|
46
|
+
} catch {
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
49
|
+
if (ctx === null) {
|
|
50
|
+
const name = marker.name ?? "Provider";
|
|
51
|
+
const hookName = name.replace(/Provider$/, "");
|
|
52
|
+
throw new Error(`use${hookName} must be used within ${name}`);
|
|
53
|
+
}
|
|
54
|
+
return ctx;
|
|
55
|
+
}
|
|
56
|
+
attachSourcePath(Provider, captureCallerPath());
|
|
57
|
+
return [Provider, useProviderContext];
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { defineProvider };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region ../config/dist/element-marker.d.ts
|
|
2
|
+
//#region src/element-marker.d.ts
|
|
3
|
+
declare const ELEMENT_MARKER_KIND = "element";
|
|
4
|
+
/** Serializable stand-in for a React element authored as a preview prop value. */
|
|
5
|
+
interface ElementMarker {
|
|
6
|
+
readonly __kind: typeof ELEMENT_MARKER_KIND;
|
|
7
|
+
/**
|
|
8
|
+
* Registry-resolvable type — `foreign:<Name>` for a third-party leaf,
|
|
9
|
+
* a registered UDS component's name, or an intrinsic tag (`'svg'`).
|
|
10
|
+
*/
|
|
11
|
+
readonly type: string;
|
|
12
|
+
/** Author-set element key (preserved so revived list children stay keyed). */
|
|
13
|
+
readonly key?: string;
|
|
14
|
+
/** Serialized props; a nested element value is itself an `ElementMarker`. */
|
|
15
|
+
readonly props?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
declare function isElementMarker(value: unknown): value is ElementMarker;
|
|
18
|
+
/**
|
|
19
|
+
* A live React element or its `$$typeof`-less husk. `Config.toJSON` runs on the
|
|
20
|
+
* in-memory config, where preview elements are still live (carry `$$typeof`);
|
|
21
|
+
* the husk shape (`_owner`/`_store`, no live `type`) only appears after a
|
|
22
|
+
* structuredClone/JSON round-trip and is matched here defensively.
|
|
23
|
+
*/
|
|
24
|
+
declare function isElementLikeValue(value: unknown): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Treat a matched object as an opaque leaf the deep walk stops at, rather than
|
|
27
|
+
* recursing into it. The walks run at render time, where a prop may already
|
|
28
|
+
* hold a live React element whose `_owner` fiber chain is circular — descending
|
|
29
|
+
* into one never terminates, and it can't contain an un-revived marker anyway.
|
|
30
|
+
* Defaults to {@link isElementLikeValue}.
|
|
31
|
+
*/
|
|
32
|
+
type OpaqueLeafPredicate = (value: object) => boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Does `value` hold an {@link ElementMarker} anywhere in its plain-data subtree?
|
|
35
|
+
* Lets a caller skip the revive walk entirely (and keep prop references stable)
|
|
36
|
+
* when there's nothing to revive.
|
|
37
|
+
*/
|
|
38
|
+
declare function hasElementMarkerDeep(value: unknown, isOpaqueLeaf?: OpaqueLeafPredicate): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Inverse of {@link serializeElementsDeep}: deep-walk `value` and turn each
|
|
41
|
+
* {@link ElementMarker} into a renderable node via `renderMarker`, preserving
|
|
42
|
+
* the surrounding plain data (arrays, objects). A marker's OWN props are left
|
|
43
|
+
* for `renderMarker` to handle — they are not pre-revived here, so a marker
|
|
44
|
+
* nested inside another marker's props stays inert until its enclosing marker
|
|
45
|
+
* renders. This mirrors how `$slot` resolution defers and avoids handing a live
|
|
46
|
+
* element (circular `_owner`) back into a renderer that deep-walks props.
|
|
47
|
+
*
|
|
48
|
+
* `renderMarker` is the framework seam — studio renders each marker through its
|
|
49
|
+
* preview `UdsRenderer`; the playground does the same with its bundled renderer.
|
|
50
|
+
* Guard with {@link hasElementMarkerDeep} to preserve referential stability for
|
|
51
|
+
* marker-free values (this walk always rebuilds the containers it descends).
|
|
52
|
+
*/
|
|
53
|
+
declare function reviveElementMarkersDeep(value: unknown, renderMarker: (marker: ElementMarker) => unknown, isOpaqueLeaf?: OpaqueLeafPredicate): unknown; //#endregion
|
|
54
|
+
//#endregion
|
|
55
|
+
export { ELEMENT_MARKER_KIND, ElementMarker, OpaqueLeafPredicate, hasElementMarkerDeep, isElementLikeValue, isElementMarker, reviveElementMarkersDeep };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { foreignRegistryKey } from "./foreign-component-name.js";
|
|
2
|
+
//#region ../config/dist/element-marker.js
|
|
3
|
+
const ELEMENT_MARKER_KIND = "element";
|
|
4
|
+
function isElementMarker(value) {
|
|
5
|
+
return value !== null && typeof value === "object" && value.__kind === "element" && typeof value.type === "string";
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A live React element or its `$$typeof`-less husk. `Config.toJSON` runs on the
|
|
9
|
+
* in-memory config, where preview elements are still live (carry `$$typeof`);
|
|
10
|
+
* the husk shape (`_owner`/`_store`, no live `type`) only appears after a
|
|
11
|
+
* structuredClone/JSON round-trip and is matched here defensively.
|
|
12
|
+
*/
|
|
13
|
+
function isElementLikeValue(value) {
|
|
14
|
+
return value !== null && typeof value === "object" && ("$$typeof" in value || "_owner" in value || "_store" in value);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The registry key for a React element's `type`: a UDS component's stamped
|
|
18
|
+
* `__componentName`, a `foreign:<Name>` for a `forwardRef`/`memo` leaf, an
|
|
19
|
+
* intrinsic tag string, or a plain function component's display/name. Returns
|
|
20
|
+
* `null` when the type can't be named (an anonymous wrapper) — the caller then
|
|
21
|
+
* drops the value rather than emit an unresolvable marker.
|
|
22
|
+
*/
|
|
23
|
+
function elementTypeName(type) {
|
|
24
|
+
if (typeof type === "string") return type;
|
|
25
|
+
if (!(type !== null && (typeof type === "object" || typeof type === "function"))) return null;
|
|
26
|
+
const udsName = type.__componentName;
|
|
27
|
+
if (typeof udsName === "string") return udsName;
|
|
28
|
+
const foreign = foreignRegistryKey(type);
|
|
29
|
+
if (foreign !== null) return foreign;
|
|
30
|
+
if (typeof type === "function") {
|
|
31
|
+
const fn = type;
|
|
32
|
+
if (typeof fn.displayName === "string" && fn.displayName.length > 0) return fn.displayName;
|
|
33
|
+
if (typeof fn.name === "string" && fn.name.length > 0) return fn.name;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
function elementToMarker(element) {
|
|
38
|
+
const el = element;
|
|
39
|
+
const type = elementTypeName(el.type);
|
|
40
|
+
if (type === null) return void 0;
|
|
41
|
+
const marker = {
|
|
42
|
+
__kind: ELEMENT_MARKER_KIND,
|
|
43
|
+
type
|
|
44
|
+
};
|
|
45
|
+
if (typeof el.key === "string") marker.key = el.key;
|
|
46
|
+
if (el.props !== null && typeof el.props === "object") {
|
|
47
|
+
const props = serializeElementsDeep(el.props);
|
|
48
|
+
if (Object.keys(props).length > 0) marker.props = props;
|
|
49
|
+
}
|
|
50
|
+
return marker;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Deeply convert every React element value to an {@link ElementMarker},
|
|
54
|
+
* preserving the surrounding plain data (axis markers, primitive props, nested
|
|
55
|
+
* arrays/objects). A value that can't be named drops out (`undefined`), so an
|
|
56
|
+
* anonymous wrapper or a clone-stripped husk is removed rather than serialized
|
|
57
|
+
* into something unrenderable. Already-serialized markers carry none of the
|
|
58
|
+
* element internals {@link isElementLikeValue} matches, so they pass through.
|
|
59
|
+
*/
|
|
60
|
+
function serializeElementsDeep(value) {
|
|
61
|
+
if (isElementLikeValue(value)) return elementToMarker(value);
|
|
62
|
+
if (Array.isArray(value)) return value.map(serializeElementsDeep).filter((entry) => entry !== void 0);
|
|
63
|
+
if (value !== null && typeof value === "object") {
|
|
64
|
+
const out = {};
|
|
65
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
66
|
+
const cleaned = serializeElementsDeep(entry);
|
|
67
|
+
if (cleaned !== void 0) out[key] = cleaned;
|
|
68
|
+
}
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Does `value` hold an {@link ElementMarker} anywhere in its plain-data subtree?
|
|
75
|
+
* Lets a caller skip the revive walk entirely (and keep prop references stable)
|
|
76
|
+
* when there's nothing to revive.
|
|
77
|
+
*/
|
|
78
|
+
function hasElementMarkerDeep(value, isOpaqueLeaf = isElementLikeValue) {
|
|
79
|
+
if (isElementMarker(value)) return true;
|
|
80
|
+
if (Array.isArray(value)) return value.some((entry) => hasElementMarkerDeep(entry, isOpaqueLeaf));
|
|
81
|
+
if (value !== null && typeof value === "object") {
|
|
82
|
+
if (isOpaqueLeaf(value)) return false;
|
|
83
|
+
return Object.values(value).some((entry) => hasElementMarkerDeep(entry, isOpaqueLeaf));
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Inverse of {@link serializeElementsDeep}: deep-walk `value` and turn each
|
|
89
|
+
* {@link ElementMarker} into a renderable node via `renderMarker`, preserving
|
|
90
|
+
* the surrounding plain data (arrays, objects). A marker's OWN props are left
|
|
91
|
+
* for `renderMarker` to handle — they are not pre-revived here, so a marker
|
|
92
|
+
* nested inside another marker's props stays inert until its enclosing marker
|
|
93
|
+
* renders. This mirrors how `$slot` resolution defers and avoids handing a live
|
|
94
|
+
* element (circular `_owner`) back into a renderer that deep-walks props.
|
|
95
|
+
*
|
|
96
|
+
* `renderMarker` is the framework seam — studio renders each marker through its
|
|
97
|
+
* preview `UdsRenderer`; the playground does the same with its bundled renderer.
|
|
98
|
+
* Guard with {@link hasElementMarkerDeep} to preserve referential stability for
|
|
99
|
+
* marker-free values (this walk always rebuilds the containers it descends).
|
|
100
|
+
*/
|
|
101
|
+
function reviveElementMarkersDeep(value, renderMarker, isOpaqueLeaf = isElementLikeValue) {
|
|
102
|
+
if (isElementMarker(value)) return renderMarker(value);
|
|
103
|
+
if (Array.isArray(value)) return value.map((entry) => reviveElementMarkersDeep(entry, renderMarker, isOpaqueLeaf));
|
|
104
|
+
if (value !== null && typeof value === "object") {
|
|
105
|
+
if (isOpaqueLeaf(value)) return value;
|
|
106
|
+
const out = {};
|
|
107
|
+
for (const [key, entry] of Object.entries(value)) out[key] = reviveElementMarkersDeep(entry, renderMarker, isOpaqueLeaf);
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
return value;
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export { ELEMENT_MARKER_KIND, hasElementMarkerDeep, isElementLikeValue, isElementMarker, reviveElementMarkersDeep, serializeElementsDeep };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region ../config/dist/entity-utils.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Build a `tokenRef → 'var(--<prefix>-<ns>-<name>)'` resolver — the callback
|
|
4
|
+
* `resolveColorExpression` consumes to turn `token('ns/name')` refs into CSS var
|
|
5
|
+
* references. Splits a ref on its FIRST slash into namespace + name; a ref with
|
|
6
|
+
* no usable slash passes through unchanged (already a literal).
|
|
7
|
+
*
|
|
8
|
+
* The single source of truth shared by the config render-spec bake and codegen
|
|
9
|
+
* (`tokenValue.ts`, `prepareCss.ts`), so config-baked and codegen-emitted CSS
|
|
10
|
+
* stay byte-identical. The name segment uses the `@uds/utils` `safeTokenName`
|
|
11
|
+
* transform (dots→`_`, slashes→`-`) — NOT `cssSafeSegment` (which also
|
|
12
|
+
* kebab-cases) — so multi-segment paths like `spectrum/carbon/0` resolve to a
|
|
13
|
+
* valid `--<prefix>-spectrum-carbon-0`.
|
|
14
|
+
*/
|
|
15
|
+
declare function makeTokenRefToCss(prefix: string | undefined): (ref: string) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Build a composite style's CSS class name: `<prefix>-<name>-<variant>`.
|
|
18
|
+
* Both name/variant segments are sanitized so subpath variants like
|
|
19
|
+
* `ui5/emphasized` emit `.yos-text-variant-ui5-emphasized` instead of an
|
|
20
|
+
* invalid `.text-variant-ui5/emphasized` (which the browser splits at `/`).
|
|
21
|
+
*
|
|
22
|
+
* The `prefix` namespaces the class the same way it namespaces CSS
|
|
23
|
+
* variables and component classes (`componentClassNames`) — an empty
|
|
24
|
+
* prefix yields the bare, unprefixed form.
|
|
25
|
+
*/
|
|
26
|
+
//#endregion
|
|
27
|
+
export { makeTokenRefToCss };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { cssClassName, cssVar } from "./brands.js";
|
|
2
|
+
//#region ../config/dist/entity-utils.js
|
|
3
|
+
/**
|
|
4
|
+
* Shared helpers used by entity `.derived` getters.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Kebab-case a single identifier. Inserts a hyphen at each upper-case
|
|
8
|
+
* boundary and lower-cases the result. Single-segment only — for slashed
|
|
9
|
+
* `'namespace/name'` paths, kebab each segment separately.
|
|
10
|
+
*/
|
|
11
|
+
function kebabCase(value) {
|
|
12
|
+
return value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z])([A-Z][a-z])/g, "$1-$2").toLowerCase();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Kebab-case + sanitize a single identifier for use inside a CSS custom
|
|
16
|
+
* property name or class name. Dots become `_` and slashes become `-`
|
|
17
|
+
* (so `1.5` → `1_5`, `1/2` → `1-2`, `ui5/emphasized` → `ui5-emphasized`).
|
|
18
|
+
* Mirrors the `safeTokenName` transform used by the runtime styler in
|
|
19
|
+
* `@uds/utils`, so codegen-declared identifiers and runtime-referenced
|
|
20
|
+
* identifiers stay in lockstep.
|
|
21
|
+
*/
|
|
22
|
+
function cssSafeSegment(value) {
|
|
23
|
+
return kebabCase(value).replace(/\./g, "_").replace(/\//g, "-");
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Build a CSS variable name from a prefix + namespace + token name.
|
|
27
|
+
* Each segment is kebab-cased; dots in the token name are mapped to
|
|
28
|
+
* `_` and slashes to `-` since CSS custom-property identifiers reject
|
|
29
|
+
* both `.` and `/` (so a `1.5` spacing token emits
|
|
30
|
+
* `--<prefix>-spacing-1_5`, and a subpath token `1/2` or
|
|
31
|
+
* `always/white` emits `--<prefix>-position-1-2` /
|
|
32
|
+
* `--<prefix>-global-always-white` — both valid).
|
|
33
|
+
*/
|
|
34
|
+
function buildCssVar(prefix, namespace, name) {
|
|
35
|
+
return cssVar(`--${prefix}-${kebabCase(namespace)}-${cssSafeSegment(name)}`);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Build a `tokenRef → 'var(--<prefix>-<ns>-<name>)'` resolver — the callback
|
|
39
|
+
* `resolveColorExpression` consumes to turn `token('ns/name')` refs into CSS var
|
|
40
|
+
* references. Splits a ref on its FIRST slash into namespace + name; a ref with
|
|
41
|
+
* no usable slash passes through unchanged (already a literal).
|
|
42
|
+
*
|
|
43
|
+
* The single source of truth shared by the config render-spec bake and codegen
|
|
44
|
+
* (`tokenValue.ts`, `prepareCss.ts`), so config-baked and codegen-emitted CSS
|
|
45
|
+
* stay byte-identical. The name segment uses the `@uds/utils` `safeTokenName`
|
|
46
|
+
* transform (dots→`_`, slashes→`-`) — NOT `cssSafeSegment` (which also
|
|
47
|
+
* kebab-cases) — so multi-segment paths like `spectrum/carbon/0` resolve to a
|
|
48
|
+
* valid `--<prefix>-spectrum-carbon-0`.
|
|
49
|
+
*/
|
|
50
|
+
function makeTokenRefToCss(prefix) {
|
|
51
|
+
return (ref) => {
|
|
52
|
+
const slashIdx = ref.indexOf("/");
|
|
53
|
+
if (slashIdx <= 0 || slashIdx >= ref.length - 1) return ref;
|
|
54
|
+
const namespace = kebabCase(ref.slice(0, slashIdx));
|
|
55
|
+
const name = ref.slice(slashIdx + 1).replace(/\./g, "_").replace(/\//g, "-");
|
|
56
|
+
return prefix ? `var(--${prefix}-${namespace}-${name})` : `var(--${namespace}-${name})`;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Build a composite style's CSS class name: `<prefix>-<name>-<variant>`.
|
|
61
|
+
* Both name/variant segments are sanitized so subpath variants like
|
|
62
|
+
* `ui5/emphasized` emit `.yos-text-variant-ui5-emphasized` instead of an
|
|
63
|
+
* invalid `.text-variant-ui5/emphasized` (which the browser splits at `/`).
|
|
64
|
+
*
|
|
65
|
+
* The `prefix` namespaces the class the same way it namespaces CSS
|
|
66
|
+
* variables and component classes (`componentClassNames`) — an empty
|
|
67
|
+
* prefix yields the bare, unprefixed form.
|
|
68
|
+
*/
|
|
69
|
+
function buildCompositeClassName(prefix, name, variant) {
|
|
70
|
+
const body = `${cssSafeSegment(name)}-${cssSafeSegment(variant)}`;
|
|
71
|
+
return cssClassName(prefix ? `${prefix}-${body}` : body);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Build the marker custom-property name a composite group writes (and
|
|
75
|
+
* its container style queries read): `--<prefix>-composite-<kebab-name>`.
|
|
76
|
+
* Single source of truth — the setter emission and `@container style(...)`
|
|
77
|
+
* query both consume this so they stay in lockstep.
|
|
78
|
+
*/
|
|
79
|
+
function buildCompositeMarkerVarName(prefix, name) {
|
|
80
|
+
return cssVar(`--${prefix}-composite-${kebabCase(name)}`);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Token names that aren't valid CSS identifiers (`2xl`, `3xs`) get an
|
|
84
|
+
* underscore prefix so they survive in CSS contexts. Dots are mapped
|
|
85
|
+
* to `_` and slashes to `-` — `1.5` would otherwise produce a class
|
|
86
|
+
* string the browser splits at the dot (`class="text-1.5"` parses as
|
|
87
|
+
* `.text-1` and `.5`), and a subpath token like `1/2` would emit
|
|
88
|
+
* `text-1/2` which the browser treats as `.text-1` followed by
|
|
89
|
+
* `/2`. Mirrors `safeTokenName` from `@uds/utils`.
|
|
90
|
+
*/
|
|
91
|
+
function toCssSafeName(name) {
|
|
92
|
+
return cssClassName(cssSafeSegment(/^[0-9]/.test(name) ? `_${name}` : name));
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Filter undefined fields out of a partial object literal so optional
|
|
96
|
+
* authored properties don't show up as `key: undefined` in `toJSON()`
|
|
97
|
+
* output. Mirrors the pattern used by `@uds/config` `defineX` builders.
|
|
98
|
+
*/
|
|
99
|
+
function compact(input) {
|
|
100
|
+
const out = {};
|
|
101
|
+
for (const [key, value] of Object.entries(input)) if (value !== void 0) out[key] = value;
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { buildCompositeClassName, buildCompositeMarkerVarName, buildCssVar, compact, cssSafeSegment, kebabCase, makeTokenRefToCss, toCssSafeName };
|