@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,707 @@
|
|
|
1
|
+
import { RegisteredModifiers, TagRef, TokenGroupRef, composite, styleProp, token } from "./refs.js";
|
|
2
|
+
import { darken, lighten } from "./colorExpressions.js";
|
|
3
|
+
import { ComponentDefinition, ComponentGroupDefinition, ComponentMetadata, CompositeStyleDefinition, LayerInput, ModeDefinition, ModifierDefinition, MotionDefinitionInput, PreviewDefinition, StylePropDefinition, StylePropMetadata, StylePropProperty, TokenDefinition } from "./types.js";
|
|
4
|
+
import { BooleanMarker, ComponentSlotMarker, LayerMarker, NumberMarker, PreviewAxisMarker, PreviewPropsRule, RequiredBrand, SlotMarker, SlotRef, SlotValueType, StringMarker, VariantMarkerArray, VariantMarkerObject } from "./markers.js";
|
|
5
|
+
import { BaseLayerStyles, LayerPropsMap, LayerTag, Props, PropsFromBindings, SlotPropValue } from "./Props.js";
|
|
6
|
+
import { ComponentPropsWithRef, ComponentType, FC, HTMLAttributes, JSX, ReactNode } from "react";
|
|
7
|
+
|
|
8
|
+
//#region ../config/dist/factories.d.ts
|
|
9
|
+
//#region src/factories.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Author-side metadata for a token group — `label` and `description`
|
|
12
|
+
* land on Studio's UI when the group is registered. Kept open
|
|
13
|
+
* (`Readonly<Record<string, unknown>>` superset) so consumers can
|
|
14
|
+
* thread arbitrary fields through to codegen without a schema change.
|
|
15
|
+
*/
|
|
16
|
+
interface TokenGroupMetadata {
|
|
17
|
+
readonly label?: string;
|
|
18
|
+
readonly description?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* `defineTokenGroup` return shape — the authored tokens record plus a
|
|
22
|
+
* non-enumerable `.metadata({...})` chain that stashes the supplied
|
|
23
|
+
* `{ label?, description? }` under a hidden `__metadata` slot.
|
|
24
|
+
* `Config.registerTokenGroups` reads the slot to back-fill the
|
|
25
|
+
* `TokenGroup` instance's `label` / `description` fields.
|
|
26
|
+
*
|
|
27
|
+
* The data is non-enumerable so `JSON.stringify(group)` still produces
|
|
28
|
+
* the bare tokens record — same wire format that lands in
|
|
29
|
+
* `.uds/config.json`.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Authored token-group value returned by `defineTokenGroup({...})`.
|
|
33
|
+
* Wraps the input tokens record under `tokens` and exposes a
|
|
34
|
+
* `.metadata({...})` chain that sets `label` / `description` on the
|
|
35
|
+
* same object. Shape-compatible with `TokenGroupDefinition` so the
|
|
36
|
+
* authored value round-trips through `Config.toJSON` /
|
|
37
|
+
* `Config.fromJSON` without reshape.
|
|
38
|
+
*/
|
|
39
|
+
type DefinedTokenGroup<T extends Record<string, TokenDefinition>> = {
|
|
40
|
+
tokens: T;
|
|
41
|
+
label?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
metadata(meta: TokenGroupMetadata): DefinedTokenGroup<T>;
|
|
44
|
+
};
|
|
45
|
+
declare function defineTokenGroup<const T extends Record<string, TokenDefinition>>(t: T): DefinedTokenGroup<T>;
|
|
46
|
+
declare function defineModifier<const T extends ModifierDefinition>(t: T): T;
|
|
47
|
+
declare function defineMode<const T extends ModeDefinition>(t: T): T;
|
|
48
|
+
declare function defineCompositeStyle<const T extends CompositeStyleDefinition>(t: T): T;
|
|
49
|
+
declare function defineMotion<const T extends MotionDefinitionInput>(t: T): T;
|
|
50
|
+
declare function defineComponentGroup<const T extends ComponentGroupDefinition>(t: T): T;
|
|
51
|
+
/**
|
|
52
|
+
* Style-prop spec with chainable `.metadata({...})` (label/description/
|
|
53
|
+
* arbitrary author-side metadata) and `.withOpacity({...})` (declares
|
|
54
|
+
* a paired opacity sibling). Both chains mutate the underlying spec
|
|
55
|
+
* in place and return it so chains can be appended or saved as a value.
|
|
56
|
+
*/
|
|
57
|
+
type DefinedStyleProp<P extends StylePropProperty> = StylePropDefinition<P> & {
|
|
58
|
+
metadata(meta: StylePropMetadata): DefinedStyleProp<P>;
|
|
59
|
+
withOpacity(spec: {
|
|
60
|
+
as: string;
|
|
61
|
+
values: TokenGroupRef;
|
|
62
|
+
separator?: string;
|
|
63
|
+
}): DefinedStyleProp<P>;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Author a style-prop spec. `P` is inferred from `cssProperty` so the
|
|
67
|
+
* `values` array narrows against the chosen CSS property's accepted
|
|
68
|
+
* keyword union (`'transparent'` is OK for `border-color`, errors for
|
|
69
|
+
* `padding`). For custom properties (`--foo`), `values` accepts open
|
|
70
|
+
* strings — `cssType` constrains the runtime value space instead.
|
|
71
|
+
*
|
|
72
|
+
* Returns the spec with a non-enumerable `.metadata({...})` chain;
|
|
73
|
+
* the chain merges the supplied bag into `spec.metadata` so multiple
|
|
74
|
+
* `.metadata({...})` calls accumulate.
|
|
75
|
+
*/
|
|
76
|
+
declare function defineStyleProp<const P extends StylePropProperty>(spec: StylePropDefinition<P>): DefinedStyleProp<P>;
|
|
77
|
+
/**
|
|
78
|
+
* Slot binding. `slot()` is an open slot — codegen treats it as
|
|
79
|
+
* `ReactNode` accepted at the component's own children. `slot('layer/prop')`
|
|
80
|
+
* routes a JSX prop into the named layer's `layerProp` (defaults to
|
|
81
|
+
* `'children'` when only a layer name is provided).
|
|
82
|
+
*
|
|
83
|
+
* Open form returns `SlotMarker` (no cross-reference). The
|
|
84
|
+
* layer-targeting forms return `SlotRef` (the `layer` field is the
|
|
85
|
+
* cross-reference — points at a layer's prop).
|
|
86
|
+
*
|
|
87
|
+
* `.required()` makes the prop mandatory in the codegen-emitted types.
|
|
88
|
+
* `.accepts(...)` constrains the accepted children to one or more
|
|
89
|
+
* registered components.
|
|
90
|
+
*/
|
|
91
|
+
declare function slot(): SlotMarker;
|
|
92
|
+
declare function slot(options: {
|
|
93
|
+
type: 'component';
|
|
94
|
+
}): ComponentSlotMarker;
|
|
95
|
+
declare function slot(options: {
|
|
96
|
+
type: SlotValueType;
|
|
97
|
+
}): SlotMarker;
|
|
98
|
+
declare function slot<TPath extends string>(path: TPath): TPath extends `${infer L}/${infer A}` ? SlotRef<L, A> : SlotRef<TPath, 'children'>;
|
|
99
|
+
declare function slot<L extends string, A extends string>(layer: L, options: {
|
|
100
|
+
prop: A;
|
|
101
|
+
type?: SlotValueType;
|
|
102
|
+
}): SlotRef<L, A>;
|
|
103
|
+
declare function slot<TPath extends string>(path: TPath, options: {
|
|
104
|
+
type: SlotValueType;
|
|
105
|
+
}): TPath extends `${infer L}/${infer A}` ? SlotRef<L, A> : SlotRef<TPath, 'children'>;
|
|
106
|
+
/**
|
|
107
|
+
* The factory return type — same marker plus a guaranteed `required()`
|
|
108
|
+
* method that returns the same chainable shape. The marker interface
|
|
109
|
+
* declares `required?()` as optional so raw `{ __kind: ... }` object
|
|
110
|
+
* literals (test fixtures, JSON-hydrated configs) still satisfy the
|
|
111
|
+
* interface; factories override that with a definite version so authoring
|
|
112
|
+
* sites can call `string().required()` without a `?.` guard.
|
|
113
|
+
*
|
|
114
|
+
* `.required()` does two things:
|
|
115
|
+
* - Consumer MUST pass the prop at the JSX site (runtime + emitted
|
|
116
|
+
* `Props<T>` shape carry the constraint).
|
|
117
|
+
* - Render-fn destructure sees the value as non-optional (`T` rather
|
|
118
|
+
* than `T | undefined`). The default render-arg type *is* optional
|
|
119
|
+
* because consumers may omit the prop and `defaultProps` is just a
|
|
120
|
+
* runtime convenience — `.required()` is the explicit "I promise
|
|
121
|
+
* this is always defined" knob.
|
|
122
|
+
*/
|
|
123
|
+
type Chainable<T extends {
|
|
124
|
+
__required?: boolean;
|
|
125
|
+
}> = T & {
|
|
126
|
+
required(): T & RequiredBrand;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Boolean-prop binding. Codegen emits the prop as `<name>?: boolean`
|
|
130
|
+
* and routes presence/absence into a per-layer `data-${name}` attribute
|
|
131
|
+
* the runtime selects on. Mirrors the old `@uds/config` `helpers.boolean()`.
|
|
132
|
+
*
|
|
133
|
+
* The optional `values` argument carries per-state per-layer styles
|
|
134
|
+
* (`{ true: { root: {...} }, false: { root: {...} } }`) — codegen emits
|
|
135
|
+
* one variant CSS class per layer per state, same as `variant({...})`.
|
|
136
|
+
*
|
|
137
|
+
* `.required()` flips the prop to mandatory at JSX call sites.
|
|
138
|
+
*/
|
|
139
|
+
declare function boolean(values?: {
|
|
140
|
+
true?: Record<string, Record<string, unknown>>;
|
|
141
|
+
false?: Record<string, Record<string, unknown>>;
|
|
142
|
+
}): Chainable<BooleanMarker>;
|
|
143
|
+
/**
|
|
144
|
+
* Cross-layer style override — `_hover: layer('close', { opacity: 1 })`
|
|
145
|
+
* declares "when this layer is hovered, apply these styles to the
|
|
146
|
+
* named layer". Codegen emits a descendant-combinator rule pointing
|
|
147
|
+
* from the source layer's selector to the target layer's selector.
|
|
148
|
+
* Mirrors the old `@uds/config` `helpers.layer()`.
|
|
149
|
+
*/
|
|
150
|
+
declare function layer(layerName: string, styles: Record<string, unknown>): LayerMarker;
|
|
151
|
+
/**
|
|
152
|
+
* Variant-prop binding — two authoring shapes, one normalized marker.
|
|
153
|
+
*
|
|
154
|
+
* 1. **Object form** — `variant({ a: { root: {...} }, b: {} })`. Keys
|
|
155
|
+
* are accepted values, values are per-layer style maps. Empty `{}`
|
|
156
|
+
* leaves a value styleless, so mixed-styling is supported in a
|
|
157
|
+
* single call.
|
|
158
|
+
* 2. **Array form** — `variant(['a','b','c'] as const)`. Typed list with
|
|
159
|
+
* no styles. Required for numeric variant (`variant([12, 16, 24] as
|
|
160
|
+
* const)`) since JS object keys can't preserve numeric literal
|
|
161
|
+
* types; also a nicer shorthand for "typed list, no styles."
|
|
162
|
+
*
|
|
163
|
+
* Both forms share the runtime tag `__kind: 'variant'`; `Array.isArray(values)`
|
|
164
|
+
* is the single discriminator. The `defaultValue` second argument seeds
|
|
165
|
+
* `defaultProps[<prop>]`.
|
|
166
|
+
*
|
|
167
|
+
* `.required()` flips the prop to mandatory at JSX call sites.
|
|
168
|
+
*/
|
|
169
|
+
declare function variant<const V extends readonly (string | number)[]>(values: V, defaultValue?: V[number]): Chainable<VariantMarkerArray<V>>;
|
|
170
|
+
declare function variant<const V extends Record<string, Record<string, unknown>>>(values: V, defaultValue?: keyof V & string): Chainable<VariantMarkerObject<V>>;
|
|
171
|
+
/**
|
|
172
|
+
* Wide-string prop binding. Codegen emits the prop as `<name>?: string`
|
|
173
|
+
* (or required when chained with `.required()`). No CSS effect — use
|
|
174
|
+
* this for free-form text props (URLs, labels). When you want a
|
|
175
|
+
* constrained list of accepted strings, reach for the array form of
|
|
176
|
+
* `variant(...)` instead.
|
|
177
|
+
*/
|
|
178
|
+
declare function string(): Chainable<StringMarker>;
|
|
179
|
+
/**
|
|
180
|
+
* Wide-number prop binding. Codegen emits the prop as `<name>?: number`
|
|
181
|
+
* (or required when chained with `.required()`). No CSS effect — use
|
|
182
|
+
* this for free-form numeric props (tabIndex, count). When you want a
|
|
183
|
+
* constrained list of accepted numbers, reach for the array form of
|
|
184
|
+
* `variant(...)` instead.
|
|
185
|
+
*/
|
|
186
|
+
declare function number(): Chainable<NumberMarker>;
|
|
187
|
+
/**
|
|
188
|
+
* Helpers passed to `defineComponent(...).config(cb)` callbacks. Same
|
|
189
|
+
* shape regardless of single-layer (`defineComponent('div')`) or
|
|
190
|
+
* multi-layer (`defineComponent.layers({...})`) entry — destructure
|
|
191
|
+
* whichever subset the prop bindings need.
|
|
192
|
+
*
|
|
193
|
+
* Wide form (no layer narrowing) — kept for the runtime helper bundle
|
|
194
|
+
* and back-compat with consumers that imported the type by name.
|
|
195
|
+
* `.config(cb)` callbacks see the narrower `TypedConfigHelpers<T>` so
|
|
196
|
+
* authoring sites get layer-aware autocomplete.
|
|
197
|
+
*/
|
|
198
|
+
interface ConfigCallbackHelpers {
|
|
199
|
+
readonly slot: typeof slot;
|
|
200
|
+
readonly variant: typeof variant;
|
|
201
|
+
readonly boolean: typeof boolean;
|
|
202
|
+
readonly string: typeof string;
|
|
203
|
+
readonly number: typeof number;
|
|
204
|
+
readonly layer: typeof layer;
|
|
205
|
+
readonly composite: typeof composite;
|
|
206
|
+
readonly styleProp: typeof styleProp;
|
|
207
|
+
readonly token: typeof token;
|
|
208
|
+
readonly darken: typeof darken;
|
|
209
|
+
readonly lighten: typeof lighten;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Per-layer styles map, keyed by layer name. Each value narrows to
|
|
213
|
+
* the layer target's own prop surface via `BaseLayerStyles<TLayers[K]>`
|
|
214
|
+
* — same mapping used by `base: { <layer>: {...} }`. Reused by
|
|
215
|
+
* `variant({...})` variant bodies, `boolean({...})` true/false bodies,
|
|
216
|
+
* and the cross-layer `layer(target, styles)` helper.
|
|
217
|
+
*/
|
|
218
|
+
type LayerStylesFor<TLayers> = { [K in keyof TLayers]?: BaseLayerStyles<TLayers[K]> };
|
|
219
|
+
/**
|
|
220
|
+
* Layer-aware overload of `variant(...)` exposed to `.config(cb)`
|
|
221
|
+
* callbacks. Array form is unchanged (no styles); object form narrows
|
|
222
|
+
* each variant's body to a layer-keyed style map. The layer name and
|
|
223
|
+
* its declared style props autocomplete; non-layer keys land in the
|
|
224
|
+
* `unknown`-typed fallback (no autocomplete) since the inner record
|
|
225
|
+
* permits arbitrary keys for back-compat with raw author bags.
|
|
226
|
+
*/
|
|
227
|
+
interface TypedVariantHelper<TLayers> {
|
|
228
|
+
<const V extends Record<string, LayerStylesFor<TLayers>>>(values: V, defaultValue?: keyof V & string): Chainable<VariantMarkerObject<V>>;
|
|
229
|
+
<const V extends readonly (string | number)[]>(values: V, defaultValue?: V[number]): Chainable<VariantMarkerArray<V>>;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Layer-aware overload of `boolean(...)` exposed to `.config(cb)`
|
|
233
|
+
* callbacks. The optional `true` / `false` per-state bodies narrow to
|
|
234
|
+
* a layer-keyed style map — same shape as `variant({...})` variant
|
|
235
|
+
* bodies.
|
|
236
|
+
*/
|
|
237
|
+
interface TypedBooleanHelper<TLayers> {
|
|
238
|
+
(): Chainable<BooleanMarker>;
|
|
239
|
+
(values: {
|
|
240
|
+
true?: LayerStylesFor<TLayers>;
|
|
241
|
+
false?: LayerStylesFor<TLayers>;
|
|
242
|
+
}): Chainable<BooleanMarker>;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Layer-aware `layer(target, styles)` cross-layer style helper. The
|
|
246
|
+
* `target` arg narrows to declared layer names; `styles` narrows to
|
|
247
|
+
* the target layer's own prop surface (modifiers included, same as
|
|
248
|
+
* the `base[<layer>]` shape).
|
|
249
|
+
*/
|
|
250
|
+
type TypedLayerHelper<TLayers> = <L extends keyof TLayers & string>(layerName: L, styles: BaseLayerStyles<TLayers[L]>) => LayerMarker;
|
|
251
|
+
/**
|
|
252
|
+
* Per-layer JSX prop keys — the names a `slot('layer/prop')` ref can
|
|
253
|
+
* point at. Composed-component layers expose their `Props<...>` keys
|
|
254
|
+
* (the same surface the rendered child accepts at JSX call sites);
|
|
255
|
+
* tag layers expose the React `HTMLAttributes` key set (children,
|
|
256
|
+
* onClick, aria-*, ...). Used to compute the `slot()` path union.
|
|
257
|
+
*/
|
|
258
|
+
type LayerPropNames<TLayer> = TLayer extends ((props: infer P) => unknown) ? keyof P & string : TLayer extends ComponentDefinition<infer InnerLayers, infer InnerProps, infer InnerTag> ? keyof Props<ComponentDefinition<InnerLayers, InnerProps, InnerTag>> & string : LayerTag<TLayer> extends infer TT extends keyof JSX.IntrinsicElements ? keyof ComponentPropsWithRef<TT> & string : keyof HTMLAttributes<HTMLElement> & string;
|
|
259
|
+
/**
|
|
260
|
+
* Per-layer prop union, lazily computed at the slot call site.
|
|
261
|
+
* Wrapped in a single-key conditional so TS only materializes the
|
|
262
|
+
* inner `Props<...>` once, when the layer literal is known —
|
|
263
|
+
* precomputing all layers eagerly via a mapped type blew the
|
|
264
|
+
* instantiation-depth budget on multi-layer components whose
|
|
265
|
+
* inner layers are themselves composed (Modal, Sheet, EmptyState).
|
|
266
|
+
*/
|
|
267
|
+
type LayerPropNamesAt<TLayers, L extends keyof TLayers & string> = LayerPropNames<TLayers[L]>;
|
|
268
|
+
/**
|
|
269
|
+
* `true` when `TLayers` declares exactly one layer (single-layer
|
|
270
|
+
* primitives like Box / Text). The empty `slot()` form returns an
|
|
271
|
+
* open `SlotMarker` that routes to the component's own children —
|
|
272
|
+
* unambiguous only when there's a single layer to route to.
|
|
273
|
+
* Multi-layer components must use the explicit `slot('layer/prop')`
|
|
274
|
+
* path form so the render fn knows where the slot lands.
|
|
275
|
+
*
|
|
276
|
+
* Implementation: standard "is-union" probe. `K extends K` distributes
|
|
277
|
+
* over the union; `[U] extends [K]` checks whether the original
|
|
278
|
+
* union still equals the now-distributed single member — only true
|
|
279
|
+
* for a single-element union.
|
|
280
|
+
*/
|
|
281
|
+
type SingleLayer<TLayers, K extends keyof TLayers = keyof TLayers> = [keyof TLayers] extends [never] ? false : K extends K ? [keyof TLayers] extends [K] ? true : false : never;
|
|
282
|
+
/**
|
|
283
|
+
* Layer-aware `slot(...)` helper. Two forms with *different* runtime
|
|
284
|
+
* semantics — pick based on intent, not layer count:
|
|
285
|
+
*
|
|
286
|
+
* - `slot()` — open slot (returns `SlotMarker`). Codegen surfaces
|
|
287
|
+
* the prop as a free render-fn arg (`({ children, ... }) => ...`)
|
|
288
|
+
* so the render fn places it explicitly between siblings. Right
|
|
289
|
+
* for sequenced positioning (`{startIcon}{children}{endIcon}`).
|
|
290
|
+
* - `slot('layer/prop')` — typed slot ref (returns `SlotRef<L, A>`).
|
|
291
|
+
* Codegen bundles the value into `props.<layer>.<prop>` so it
|
|
292
|
+
* spreads onto the named layer's JSX (`<X {...props.<layer>} />`).
|
|
293
|
+
* Right for forwarding into a wrapped component's own prop.
|
|
294
|
+
*
|
|
295
|
+
* The single-arg `slot('layer')` and the object-options form
|
|
296
|
+
* `slot('layer', { prop })` were removed — always write the explicit
|
|
297
|
+
* `'layer/prop'` path so codegen / Studio / readers see one syntax
|
|
298
|
+
* for the routed form.
|
|
299
|
+
*/
|
|
300
|
+
/** First parameter of a function-typed layer prop (the value a callback
|
|
301
|
+
* hands back — e.g. the change event for an input's `onChange`). Falls
|
|
302
|
+
* back to `any` when the prop doesn't resolve to a function type (some
|
|
303
|
+
* composed-component props don't surface their handler signature), so
|
|
304
|
+
* the transform is precisely typed where possible and unconstrained
|
|
305
|
+
* otherwise — never stricter than the old untyped form.
|
|
306
|
+
*
|
|
307
|
+
* `NonNullable<V>` strips the `| undefined` an optional layer prop
|
|
308
|
+
* carries (`onChange?: ChangeEventHandler`). Without it the bare
|
|
309
|
+
* conditional distributes over the `Handler | undefined` union: the
|
|
310
|
+
* `undefined` arm takes the `any` fallback and `any` absorbs the whole
|
|
311
|
+
* union, collapsing the transform arg to `any` for every optional prop. */
|
|
312
|
+
type UnresolvedArg = any;
|
|
313
|
+
type ArgOf<V> = NonNullable<V> extends ((arg: infer A, ...rest: never[]) => unknown) ? A : UnresolvedArg;
|
|
314
|
+
/**
|
|
315
|
+
* Layer-aware `SlotRef` whose `.transform(fn)` types `fn`'s argument as
|
|
316
|
+
* the targeted layer prop's value (e.g. `slot('field/onChange')`'s
|
|
317
|
+
* transform receives the input's change event). The consumer-facing
|
|
318
|
+
* prop then resolves to `(value: ReturnType<fn>) => void`.
|
|
319
|
+
*/
|
|
320
|
+
interface TypedSlotRef<TLayer extends string, TAs extends string, TArg> extends Omit<SlotRef<TLayer, TAs>, 'transform'> {
|
|
321
|
+
transform<Out>(fn: (arg: TArg) => Out): SlotRef<TLayer, TAs> & {
|
|
322
|
+
readonly __transformOut: Out;
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
interface TypedSlotHelper<TLayers> {
|
|
326
|
+
(): SlotMarker;
|
|
327
|
+
(options: {
|
|
328
|
+
type: 'component';
|
|
329
|
+
}): ComponentSlotMarker;
|
|
330
|
+
(options: {
|
|
331
|
+
type: SlotValueType;
|
|
332
|
+
}): SlotMarker;
|
|
333
|
+
<L extends keyof TLayers & string, A extends LayerPropNamesAt<TLayers, L>>(path: `${L}/${A}`): TypedSlotRef<L, A, ArgOf<SlotPropValue<SlotRef<L, A>, TLayers>>>;
|
|
334
|
+
<L extends keyof TLayers & string, A extends LayerPropNamesAt<TLayers, L>>(path: `${L}/${A}`, options: {
|
|
335
|
+
type: SlotValueType;
|
|
336
|
+
}): TypedSlotRef<L, A, ArgOf<SlotPropValue<SlotRef<L, A>, TLayers>>>;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* `.config(cb)` callback helpers narrowed against the chain seed `T`.
|
|
340
|
+
* `slot` / `variant` / `boolean` / `layer` know the declared layer names
|
|
341
|
+
* and per-layer prop surfaces so authoring sites get layer-aware
|
|
342
|
+
* autocomplete without changing the runtime helper bundle. The
|
|
343
|
+
* remaining helpers (`string`, `number`, `composite`, `styleProp`,
|
|
344
|
+
* `token`) don't depend on `T`, so they pass through as the wide
|
|
345
|
+
* module-level fns.
|
|
346
|
+
*/
|
|
347
|
+
type TypedConfigHelpers<T extends ComponentDefinition> = T extends ComponentDefinition<infer TLayers, infer _P, infer _Tag> ? {
|
|
348
|
+
readonly slot: TypedSlotHelper<TLayers>;
|
|
349
|
+
readonly variant: TypedVariantHelper<TLayers>;
|
|
350
|
+
readonly boolean: TypedBooleanHelper<TLayers>;
|
|
351
|
+
readonly layer: TypedLayerHelper<TLayers>;
|
|
352
|
+
readonly string: typeof string;
|
|
353
|
+
readonly number: typeof number;
|
|
354
|
+
readonly composite: typeof composite;
|
|
355
|
+
readonly styleProp: typeof styleProp;
|
|
356
|
+
readonly token: typeof token;
|
|
357
|
+
readonly darken: typeof darken;
|
|
358
|
+
readonly lighten: typeof lighten;
|
|
359
|
+
} : ConfigCallbackHelpers;
|
|
360
|
+
/**
|
|
361
|
+
* Helpers passed to `defineComponent(...).preview(cb)` callbacks.
|
|
362
|
+
* `prop(name)` produces a row/column axis spec for the `matrix` field
|
|
363
|
+
* — Studio + codegen consume the marker to expand the prop's variant
|
|
364
|
+
* values into the preview grid.
|
|
365
|
+
*
|
|
366
|
+
* Wide form (no narrowing) — kept for the runtime bundle and external
|
|
367
|
+
* consumers. `.preview(cb)` callbacks see the narrower
|
|
368
|
+
* `TypedPreviewHelpers<T>` so axis names autocomplete to declared
|
|
369
|
+
* props / registered modifiers.
|
|
370
|
+
*/
|
|
371
|
+
interface PreviewCallbackHelpers {
|
|
372
|
+
readonly prop: (name: string) => PreviewAxisMarker;
|
|
373
|
+
readonly modifier: (name: string) => PreviewAxisMarker;
|
|
374
|
+
/**
|
|
375
|
+
* Per-cell prop-override axis. Pass a flat bag (applied to every cell)
|
|
376
|
+
* or a list of `{ when?, props }` rules guarded against other axes —
|
|
377
|
+
* the way to vary render-extra data per cell without a config prop.
|
|
378
|
+
*/
|
|
379
|
+
readonly props: (arg: Record<string, unknown> | readonly PreviewPropsRule[]) => PreviewAxisMarker;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* `.preview(cb)` callback helpers narrowed against the resolved
|
|
383
|
+
* component definition `T`. `prop(name)` narrows `name` to declared
|
|
384
|
+
* prop keys; `modifier(name)` narrows to the codegen-augmented
|
|
385
|
+
* `RegisteredModifiers` registry. Falls back to the wide
|
|
386
|
+
* `PreviewCallbackHelpers` when `T` isn't a concrete definition.
|
|
387
|
+
*/
|
|
388
|
+
type TypedPreviewHelpers<T extends ComponentDefinition> = T extends ComponentDefinition<infer _L, infer TProps, infer _Tag> ? {
|
|
389
|
+
readonly prop: <K extends keyof TProps & string>(name: K) => PreviewAxisMarker;
|
|
390
|
+
readonly modifier: <K extends keyof RegisteredModifiers<unknown> & string>(name: K) => PreviewAxisMarker;
|
|
391
|
+
readonly props: (arg: Record<string, unknown> | readonly PreviewPropsRule[]) => PreviewAxisMarker;
|
|
392
|
+
} : PreviewCallbackHelpers;
|
|
393
|
+
type ConfigCallbackResult = Partial<ComponentDefinition>;
|
|
394
|
+
/**
|
|
395
|
+
* Per-layer `base` shape derived from the chain seed `T`. Each declared
|
|
396
|
+
* layer key narrows to the layer target's own prop surface (style props
|
|
397
|
+
* + HTML attrs for tag layers, `Partial<Props<...>>` for composed
|
|
398
|
+
* component layers) — same `LayerPropsValue<TLayer>` mapping the JSX
|
|
399
|
+
* `layerProps` prop already exposes. Lets the `.config(cb)` callback
|
|
400
|
+
* catch typos like `base: { root: { invalidProp: '...' } }` at the
|
|
401
|
+
* authoring site.
|
|
402
|
+
*/
|
|
403
|
+
type BaseStylesFor<T extends ComponentDefinition> = T extends ComponentDefinition<infer TLayers, infer _P, infer _Tag> ? { [K in keyof TLayers]?: BaseLayerStyles<TLayers[K]> } : never;
|
|
404
|
+
/**
|
|
405
|
+
* Per-T `defaultProps` shape. Splits on layer count:
|
|
406
|
+
*
|
|
407
|
+
* - **Multi-layer** components (`{root, text, ...}`) — narrow to
|
|
408
|
+
* the component's *own declared props* (`PropsFromBindings`).
|
|
409
|
+
* Without the narrowing, `Partial<Props<T>>` bleeds the root
|
|
410
|
+
* layer's whole prop surface through `ComposedRootProps<TLayers>`
|
|
411
|
+
* so multi-layer authoring sites see hundreds of irrelevant Box
|
|
412
|
+
* style props in autocomplete.
|
|
413
|
+
* - **Single-layer** components (`defineComponent('div')`,
|
|
414
|
+
* `defineComponent(Box)`) — keep `Partial<Props<T>>` so value-
|
|
415
|
+
* extend chains can still default inherited style props
|
|
416
|
+
* (`bg: 'tertiary'`, `as: 'button'`, `cursor: 'pointer'`).
|
|
417
|
+
*
|
|
418
|
+
* Props declared in the same `.config()` call don't appear here —
|
|
419
|
+
* the seed `T` reflects the chain state *before* the current call.
|
|
420
|
+
* Default a freshly-declared prop in a follow-up `.config()` step
|
|
421
|
+
* (or in a future `.defaultProps({...})` chain method).
|
|
422
|
+
*/
|
|
423
|
+
type DefaultPropsFor<T extends ComponentDefinition> = T extends ComponentDefinition<infer TLayers, infer TProps, infer _Tag> ? SingleLayer<TLayers> extends true ? Partial<Props<T>> : Partial<PropsFromBindings<TProps, TLayers> & RegisteredModifiers<PropsFromBindings<TProps, TLayers>> & {
|
|
424
|
+
layerProps?: LayerPropsMap<TLayers>;
|
|
425
|
+
}> : never;
|
|
426
|
+
/**
|
|
427
|
+
* `.config(cb)` callback result narrowed against the chain seed `T`.
|
|
428
|
+
* Overrides `base` with `BaseStylesFor<T>` and `defaultProps` with
|
|
429
|
+
* `DefaultPropsFor<T>` so authoring sites get autocomplete on
|
|
430
|
+
* per-layer style blocks and on the right prop surface (own declared
|
|
431
|
+
* props for multi-layer, inherited Props<T> for single-layer
|
|
432
|
+
* value-extends). Other fields stay on the wide `ComponentDefinition`
|
|
433
|
+
* shape.
|
|
434
|
+
*/
|
|
435
|
+
type ConfigCallbackResultFor<T extends ComponentDefinition> = Omit<ConfigCallbackResult, 'base' | 'defaultProps'> & {
|
|
436
|
+
base?: BaseStylesFor<T>;
|
|
437
|
+
defaultProps?: DefaultPropsFor<T>;
|
|
438
|
+
};
|
|
439
|
+
/**
|
|
440
|
+
* Per-nested-field override: when `C` carries `K`, the merged shape's
|
|
441
|
+
* `K` is `Omit<T[K], keyof C[K]> & C[K]` so newly-bound keys *replace*
|
|
442
|
+
* the parent's binding rather than intersect with it. When only one
|
|
443
|
+
* side carries `K`, that side's shape wins; when neither does, the
|
|
444
|
+
* key is omitted.
|
|
445
|
+
*/
|
|
446
|
+
type MergeNested<T, C, K extends string> = C extends Record<K, infer CV> ? T extends Record<K, infer TV> ? Record<K, Omit<TV, keyof CV> & CV> : Record<K, CV> : T extends Record<K, infer TV> ? Record<K, TV> : {};
|
|
447
|
+
/**
|
|
448
|
+
* Merge a `.config(cb)` callback result `C` over the chain seed `T`.
|
|
449
|
+
* Nested fields (`props`, `defaultProps`, `base`) merge per-key (C
|
|
450
|
+
* overrides T at the leaf level); other fields fall back to the
|
|
451
|
+
* historic `T & C` intersection.
|
|
452
|
+
*/
|
|
453
|
+
type MergeChainConfig<T, C> = Omit<T, 'props' | 'defaultProps' | 'base'> & Omit<C, 'props' | 'defaultProps' | 'base'> & MergeNested<T, C, 'props'> & MergeNested<T, C, 'defaultProps'> & MergeNested<T, C, 'base'>;
|
|
454
|
+
/**
|
|
455
|
+
* Per-config slot-prop map: walk a `props` block, pick out every
|
|
456
|
+
* `slot()`-marked entry, and surface it as `ReactNode | undefined` on
|
|
457
|
+
* the render-fn args. Each entry resolves to one JSX-callable name
|
|
458
|
+
* (`title?`, `icon?`, `actions?`) the render fn can read directly.
|
|
459
|
+
*
|
|
460
|
+
* Mirrors main's `SlotPropsFromConfig`. Slot markers carry
|
|
461
|
+
* `__kind: 'slot'`; non-slot entries (style props, variant, booleans)
|
|
462
|
+
* map to `never` and drop out of the key set.
|
|
463
|
+
*/
|
|
464
|
+
/**
|
|
465
|
+
* Resolve a marker to the value type the consumer passes via JSX
|
|
466
|
+
* and the render fn destructures. Mirrors the runtime contract:
|
|
467
|
+
* `slot` → `ReactNode`, primitive markers → their primitive,
|
|
468
|
+
* `variant` → the literal union of values/keys, `composite` → key
|
|
469
|
+
* union of the registered composite's styles, `styleProp` →
|
|
470
|
+
* `string` (token name OR bracketed arbitrary — the styler picks).
|
|
471
|
+
*/
|
|
472
|
+
type ResolveMarker<M> = M extends {
|
|
473
|
+
readonly __kind: 'slot';
|
|
474
|
+
readonly __valueType: 'component';
|
|
475
|
+
} ? ComponentType : M extends {
|
|
476
|
+
readonly __kind: 'slot';
|
|
477
|
+
} ? ReactNode : M extends {
|
|
478
|
+
readonly __kind: 'string';
|
|
479
|
+
} ? string : M extends {
|
|
480
|
+
readonly __kind: 'number';
|
|
481
|
+
} ? number : M extends {
|
|
482
|
+
readonly __kind: 'boolean';
|
|
483
|
+
} ? boolean : M extends {
|
|
484
|
+
readonly __kind: 'variant';
|
|
485
|
+
readonly values: infer V;
|
|
486
|
+
} ? V extends readonly (infer E)[] ? E : V extends Record<string, unknown> ? keyof V & string : string : M extends {
|
|
487
|
+
readonly __kind: 'composite';
|
|
488
|
+
} ? string : M extends {
|
|
489
|
+
readonly __kind: 'styleProp';
|
|
490
|
+
} ? string : unknown;
|
|
491
|
+
/**
|
|
492
|
+
* Render-fn arg map: every entry in `.config({ props })` surfaces on
|
|
493
|
+
* the render callback. Slots resolve to `ReactNode`; other markers
|
|
494
|
+
* resolve to their value type. Optionality is driven by `.required()`:
|
|
495
|
+
*
|
|
496
|
+
* - default → optional (`T | undefined`). The author has to guard.
|
|
497
|
+
* - `.required()` → non-optional (`T`). Consumer must pass at the JSX
|
|
498
|
+
* site (or `defaultProps` covers it), so render destructure is safe
|
|
499
|
+
* to use the value directly without an `as T` cast.
|
|
500
|
+
*
|
|
501
|
+
* This is what wires `.config({ props: { checked: boolean() } })` →
|
|
502
|
+
* `.render(({ checked }) => …)` without forcing authors to repeat the
|
|
503
|
+
* type declaration on `.render<T>`.
|
|
504
|
+
*/
|
|
505
|
+
type RenderPropsFromConfig<TProps, TDefaultKeys extends PropertyKey = never> = { [K in keyof TProps as TProps[K] extends RequiredBrand ? K : K extends TDefaultKeys ? K : never]-?: ResolveMarker<TProps[K]> } & { [K in keyof TProps as TProps[K] extends RequiredBrand ? never : K extends TDefaultKeys ? never : K]?: ResolveMarker<TProps[K]> };
|
|
506
|
+
/**
|
|
507
|
+
* Per-layer prop bundle the codegen-emitted FC hands to the render
|
|
508
|
+
* function. One key per layer declared on `.layers({...})`, each
|
|
509
|
+
* carrying the spread-into-JSX bag (`className`, `data-uds-*`,
|
|
510
|
+
* forwarded native attrs). Typed as `Record<string, unknown>` per
|
|
511
|
+
* entry — the runtime contents vary by layer base component and the
|
|
512
|
+
* render fn just spreads them with `{...props.<layer>}`.
|
|
513
|
+
*/
|
|
514
|
+
type LayerPropsBundle<TLayers> = { [K in keyof TLayers]: Record<string, unknown> };
|
|
515
|
+
/**
|
|
516
|
+
* Shape of the render fn passed to `.render<TExtra>(fn)`. `props` is
|
|
517
|
+
* the per-layer bundle injected by the codegen-emitted wrapper FC,
|
|
518
|
+
* keyed by the layers declared on `.layers({...})`. `TConfigProps`
|
|
519
|
+
* adds every config-declared prop (slots, variant, booleans, etc.) at
|
|
520
|
+
* the call site — required when `defaultProps` covers them, optional
|
|
521
|
+
* otherwise. `TExtra` is the consumer-declared extra JSX-prop shape
|
|
522
|
+
* (function-typed handlers, complex object pass-throughs) that the
|
|
523
|
+
* marker system doesn't express yet.
|
|
524
|
+
*/
|
|
525
|
+
type ComponentRenderFn<TExtra = unknown, TConfigProps = unknown, TLayers = Record<string, unknown>> = (args: {
|
|
526
|
+
props: LayerPropsBundle<TLayers>;
|
|
527
|
+
children?: ReactNode;
|
|
528
|
+
} & TConfigProps & TExtra) => ReactNode;
|
|
529
|
+
/**
|
|
530
|
+
* Chain methods attached to every `defineComponent` result. The
|
|
531
|
+
* builder type intersects with the underlying `ComponentDefinition`
|
|
532
|
+
* (`T`) so the value is directly assignable to
|
|
533
|
+
* `Config.registerComponents({...})`. All chain methods are
|
|
534
|
+
* non-enumerable, so `JSON.stringify` over a builder still produces
|
|
535
|
+
* the plain authored shape.
|
|
536
|
+
*/
|
|
537
|
+
interface ComponentBuilderMethods<T extends ComponentDefinition> {
|
|
538
|
+
/**
|
|
539
|
+
* Resolve prop bindings, base styles, defaults, and motion from a
|
|
540
|
+
* callback. Helpers (`slot`, `variant`, `composite`, `styleProp`,
|
|
541
|
+
* `token`) emit the marker shapes codegen consumes.
|
|
542
|
+
*
|
|
543
|
+
* The result `C` *overrides* matching `T` fields rather than
|
|
544
|
+
* intersecting — bare `T & C` would intersect literal-typed marker
|
|
545
|
+
* fields (`gap: StylePropRef<'gap'> & StylePropRef<'gapX'>`) into
|
|
546
|
+
* `never`, and `Props<T>`'s walker can't recover from that.
|
|
547
|
+
*/
|
|
548
|
+
config<const C extends ConfigCallbackResultFor<T>>(cb: (helpers: TypedConfigHelpers<T>) => C): ComponentBuilder<MergeChainConfig<T, C>>;
|
|
549
|
+
/**
|
|
550
|
+
* Attach the React render fn. Stored on non-enumerable `__renderFn`
|
|
551
|
+
* + `__hasRenderFn: true` so codegen's `transformAuthoringSource`
|
|
552
|
+
* downleveler picks it up while the JSON-safe builder shape stays
|
|
553
|
+
* clean. `TExtra` is the consumer-declared extra JSX-prop shape;
|
|
554
|
+
* slot-bound JSX props (declared via `slot()` in `.config()`)
|
|
555
|
+
* appear automatically alongside `props`/`children`.
|
|
556
|
+
*/
|
|
557
|
+
render<TExtra extends Record<string, unknown> = {}>(fn: ComponentRenderFn<TExtra, T extends {
|
|
558
|
+
props: infer P;
|
|
559
|
+
} ? RenderPropsFromConfig<P, T extends {
|
|
560
|
+
defaultProps: infer D;
|
|
561
|
+
} ? keyof D : never> : unknown, T extends {
|
|
562
|
+
layers: infer L;
|
|
563
|
+
} ? L : Record<string, unknown>>): BoundComponent<T, TExtra>;
|
|
564
|
+
/**
|
|
565
|
+
* Attach a declarative preview spec — stored under non-enumerable
|
|
566
|
+
* `__preview` so the authored builder stays JSON-clean. Callback
|
|
567
|
+
* form receives `{ prop }` for axis markers and is invoked
|
|
568
|
+
* immediately; the resolved spec is the value used downstream.
|
|
569
|
+
*
|
|
570
|
+
* `defaultProps` is narrowed against the component's resolved
|
|
571
|
+
* `Props<T>` so callback parameters (`onSubmit: (event) => ...`)
|
|
572
|
+
* infer their event type from the component's declared JSX surface.
|
|
573
|
+
*/
|
|
574
|
+
preview(spec: PreviewDefinition<DefaultPropsFor<T>> | ((helpers: TypedPreviewHelpers<T>) => PreviewDefinition<DefaultPropsFor<T>>)): ComponentBuilder<T>;
|
|
575
|
+
/**
|
|
576
|
+
* Declare child components owned by this one. Children flatten into
|
|
577
|
+
* `Config.components` at registration time and carry
|
|
578
|
+
* `derived.subcomponentOf`.
|
|
579
|
+
*/
|
|
580
|
+
subcomponents(children: Record<string, ComponentDefinition>): ComponentBuilder<T>;
|
|
581
|
+
/**
|
|
582
|
+
* Attach author-side metadata for codegen's AI prompt artifact +
|
|
583
|
+
* Studio's UI. Merged into `definition.metadata` (multiple
|
|
584
|
+
* `.metadata({...})` calls accumulate). Returns the builder so the
|
|
585
|
+
* chain continues.
|
|
586
|
+
*/
|
|
587
|
+
metadata(meta: ComponentMetadata): ComponentBuilder<T>;
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Authored builder value returned by `defineComponent(...).config(...)`.
|
|
591
|
+
*
|
|
592
|
+
* Three roles in one shape:
|
|
593
|
+
*
|
|
594
|
+
* 1. **Data** — the underlying `ComponentDefinition` fields (`layers`,
|
|
595
|
+
* `props`, `base`, `defaultProps`, `motion`, `compoundProps`) live
|
|
596
|
+
* on enumerable properties so `Config.registerComponents({Text})`
|
|
597
|
+
* and `JSON.stringify(Text)` both see the authored shape.
|
|
598
|
+
* 2. **Chain methods** — `.config`, `.render`, `.preview`, and
|
|
599
|
+
* `.subcomponents` are non-enumerable methods on the same value
|
|
600
|
+
* (see `ComponentBuilderMethods<T>`).
|
|
601
|
+
* 3. **JSX callable** — `& FC<any>` lets consumers reference the
|
|
602
|
+
* builder directly in JSX (`<Text variant="body">`). The builder
|
|
603
|
+
* isn't *actually* a React FC at runtime — the UDS loader rewrites
|
|
604
|
+
* `@/uds/components/<seg>` to the codegen-emitted
|
|
605
|
+
* `.uds/components/<seg>` artifact (a real FC) before the runtime
|
|
606
|
+
* ever sees it. The FC intersection here is the type-only
|
|
607
|
+
* concession that keeps source files typechecking against this
|
|
608
|
+
* value as if it were the rewritten artifact.
|
|
609
|
+
*/
|
|
610
|
+
type ComponentBuilder<T extends ComponentDefinition> = T & ComponentBuilderMethods<T> & FC<Props<T>>;
|
|
611
|
+
/**
|
|
612
|
+
* Bound component returned by `.render<TExtra>(fn)`. Mirrors main's
|
|
613
|
+
* `BoundComponent`: an `FC` whose JSX props are
|
|
614
|
+
* `TExtra & Record<string, unknown>` so the consumer-declared extras
|
|
615
|
+
* (`open`, `onOpenChange`, etc.) typecheck precisely at JSX call sites
|
|
616
|
+
* while the rest of the prop surface (slot/style/HTML attrs) stays
|
|
617
|
+
* permissively-typed — matching how the codegen-emitted wrapper FC
|
|
618
|
+
* actually accepts props at runtime.
|
|
619
|
+
*
|
|
620
|
+
* The builder-chain methods stay attached so `.preview()` /
|
|
621
|
+
* `.metadata()` / `.subcomponents()` can follow `.render(...)`.
|
|
622
|
+
*/
|
|
623
|
+
/**
|
|
624
|
+
* Chain methods exposed on a `BoundComponent` (post-`.render<TExtra>()`).
|
|
625
|
+
* Mirrors the pre-render `ComponentBuilderMethods` minus `render` (you
|
|
626
|
+
* only render once), with `.preview` / `.metadata` / `.subcomponents`
|
|
627
|
+
* preserving the `TExtra` narrowing so chained authors keep their
|
|
628
|
+
* TExtra-typed JSX surface at consumer call sites.
|
|
629
|
+
*/
|
|
630
|
+
interface BoundComponentMethods<T extends ComponentDefinition, TExtra extends Record<string, unknown>> {
|
|
631
|
+
config(cb: (helpers: TypedConfigHelpers<T>) => ConfigCallbackResultFor<T>): BoundComponent<T, TExtra>;
|
|
632
|
+
preview(spec: PreviewDefinition<Omit<DefaultPropsFor<T>, keyof TExtra> & TExtra> | ((helpers: TypedPreviewHelpers<T>) => PreviewDefinition<Omit<DefaultPropsFor<T>, keyof TExtra> & TExtra>)): BoundComponent<T, TExtra>;
|
|
633
|
+
subcomponents(children: Record<string, ComponentDefinition>): BoundComponent<T, TExtra>;
|
|
634
|
+
metadata(meta: ComponentMetadata): BoundComponent<T, TExtra>;
|
|
635
|
+
}
|
|
636
|
+
type BoundComponent<T extends ComponentDefinition, TExtra extends Record<string, unknown> = {}> = T & FC<Omit<Props<T>, keyof TExtra> & TExtra> & BoundComponentMethods<T, TExtra> & {
|
|
637
|
+
readonly __config: T;
|
|
638
|
+
};
|
|
639
|
+
/** Doc-alignment alias kept for callers that imported the older name. */
|
|
640
|
+
type DefinedComponent<T extends ComponentDefinition> = ComponentBuilder<T>;
|
|
641
|
+
/**
|
|
642
|
+
* Overloaded `defineComponent`:
|
|
643
|
+
*
|
|
644
|
+
* - `defineComponent(tag)` — single-layer seed `{ layers: { root: tag(tag) } }`.
|
|
645
|
+
* - `defineComponent(source)` — value-extend an existing component
|
|
646
|
+
* builder. The new seed is a fresh object spread from the source so
|
|
647
|
+
* the source's identity stays intact; non-enumerable
|
|
648
|
+
* `__extendsFrom` carries the source reference for codegen's
|
|
649
|
+
* identity-keyed reverse-lookup (consumed by `Component.extendsFrom`
|
|
650
|
+
* via the `__componentName` stamped at register time).
|
|
651
|
+
* - `defineComponent({...})` — direct static `ComponentDefinition`
|
|
652
|
+
* (literal authored shape). Mutated in place — same surface as the
|
|
653
|
+
* earlier identity factory.
|
|
654
|
+
* - `defineComponent.layers({...})` — multi-layer authoring entry.
|
|
655
|
+
* Returns a builder seeded with the named layers; chain `.config`,
|
|
656
|
+
* `.render`, and `.preview` from there.
|
|
657
|
+
*/
|
|
658
|
+
interface DefineComponentFn {
|
|
659
|
+
<const TTag extends string>(htmlTag: TTag): ComponentBuilder<{
|
|
660
|
+
layers: {
|
|
661
|
+
root: TagRef<TTag>;
|
|
662
|
+
};
|
|
663
|
+
}>;
|
|
664
|
+
<const T extends ComponentDefinition>(definitionOrParent: T): ComponentBuilder<T>;
|
|
665
|
+
layers<const L extends Record<string, LayerInput>>(layers: L): ComponentBuilder<{
|
|
666
|
+
layers: L;
|
|
667
|
+
}>;
|
|
668
|
+
}
|
|
669
|
+
declare const defineComponent: DefineComponentFn;
|
|
670
|
+
/**
|
|
671
|
+
* Mutable marker the Provider FC carries on `__udsProvider`. `name`
|
|
672
|
+
* starts unset; `.registerProviders({ ToastProvider })` writes it to
|
|
673
|
+
* the registration key so the Provider's `displayName` and the hook's
|
|
674
|
+
* error message both pick up a meaningful label.
|
|
675
|
+
*/
|
|
676
|
+
interface ProviderMarker {
|
|
677
|
+
name?: string;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Render-callback shape `defineProvider` accepts. Returns the context
|
|
681
|
+
* value and the JSX to render inside the auto-built `Context.Provider`.
|
|
682
|
+
*/
|
|
683
|
+
type ProviderRenderFn<TContext, TProps = Record<never, never>> = (props: {
|
|
684
|
+
children: ReactNode;
|
|
685
|
+
} & TProps) => {
|
|
686
|
+
context: TContext;
|
|
687
|
+
render: ReactNode;
|
|
688
|
+
};
|
|
689
|
+
/**
|
|
690
|
+
* The Provider FC returned by `defineProvider`. Carries a
|
|
691
|
+
* non-enumerable `__udsProvider` slot so `.registerProviders({...})`
|
|
692
|
+
* consumers can identify provider values and back-fill the
|
|
693
|
+
* registration name.
|
|
694
|
+
*/
|
|
695
|
+
type ProviderComponent<TProps = Record<never, never>> = FC<{
|
|
696
|
+
children: ReactNode;
|
|
697
|
+
} & TProps> & {
|
|
698
|
+
readonly __udsProvider: ProviderMarker;
|
|
699
|
+
};
|
|
700
|
+
/**
|
|
701
|
+
* Legacy alias for the tuple shape `defineProvider` returns. Kept so
|
|
702
|
+
* existing consumers reaching for `DefinedProvider<TContext, TProps>`
|
|
703
|
+
* keep compiling.
|
|
704
|
+
*/
|
|
705
|
+
type DefinedProvider<TContext = unknown, TProps = Record<never, never>> = readonly [ProviderComponent<TProps>, () => TContext]; //#endregion
|
|
706
|
+
//#endregion
|
|
707
|
+
export { BoundComponent, ComponentBuilder, ComponentBuilderMethods, ComponentRenderFn, ConfigCallbackHelpers, DefineComponentFn, DefinedComponent, DefinedProvider, DefinedStyleProp, DefinedTokenGroup, PreviewCallbackHelpers, ProviderComponent, ProviderRenderFn, TokenGroupMetadata, TypedSlotRef, boolean, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineStyleProp, defineTokenGroup, number, slot, string, variant };
|