@yahoo/uds-v5-wip 1.60.0 → 1.61.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/codegen/dist/loader/getLoaderArtifacts.js +2 -0
- package/dist/config/dist/Props.d.ts +161 -25
- package/dist/config/dist/bindRender.d.ts +16 -0
- package/dist/config/dist/bindRender.js +310 -0
- package/dist/config/dist/className.d.ts +54 -0
- package/dist/config/dist/className.js +77 -0
- package/dist/config/dist/component-config.d.ts +674 -161
- package/dist/config/dist/component-config.js +163 -0
- package/dist/config/dist/component-refs.d.ts +41 -18
- package/dist/config/dist/createConfig.d.ts +140 -59
- package/dist/config/dist/createConfig.js +95 -217
- package/dist/config/dist/createStyler.d.ts +35 -0
- package/dist/config/dist/createStyler.js +93 -0
- package/dist/config/dist/defineComponent.d.ts +297 -4
- package/dist/config/dist/defineComponent.js +264 -2
- package/dist/config/dist/defineCompositeStyle.d.ts +93 -0
- package/dist/config/dist/defineCompositeStyle.js +18 -0
- package/dist/config/dist/defineMotionConfig.d.ts +152 -0
- package/dist/config/dist/definePreview.d.ts +45 -0
- package/dist/config/dist/definePreview.js +35 -0
- package/dist/config/dist/defineStyleProp.d.ts +199 -3
- package/dist/config/dist/defineStyleProp.js +3 -2
- package/dist/config/dist/index.d.ts +20 -11
- package/dist/config/dist/index.js +8 -4
- package/dist/config/dist/merge-utils.js +51 -0
- package/dist/config/dist/propertyAcceptedTypes.d.ts +19 -0
- package/dist/config/dist/refs.d.ts +85 -0
- package/dist/config/dist/refs.js +92 -47
- package/dist/config/dist/resolveCompoundProps.d.ts +65 -0
- package/dist/config/dist/resolveCompoundProps.js +120 -0
- package/dist/config/dist/resolveStyleProp.d.ts +72 -3
- package/dist/config/dist/resolveStyleProp.js +68 -43
- package/dist/config/dist/runtime-registry.js +30 -2
- package/dist/config/dist/serialize.d.ts +8 -34
- package/dist/config/dist/serialize.js +10 -71
- package/dist/config/dist/sniffTokenType.d.ts +7 -0
- package/dist/config/dist/sniffTokenType.js +67 -0
- package/dist/config/dist/style-prop-runtime.d.ts +75 -1
- package/dist/config/dist/style-prop-runtime.js +390 -0
- package/dist/config/dist/types/css-properties.d.ts +223 -0
- package/dist/config/dist/types/css-values.d.ts +2 -1
- package/dist/config/dist/types.d.ts +14 -3
- package/dist/config.d.ts +21 -1560
- package/dist/config.js +15 -20
- 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 +2 -2
- package/dist/loader/dist/loader/babel-utils.js +1 -29
- package/dist/loader/dist/loader/internal-meta.js +38 -1
- package/dist/loader/dist/loader/lower-new-api-primitive.js +176 -14
- package/dist/loader/dist/loader.d.ts +29 -1
- package/dist/loader/dist/loader.js +71 -309
- package/dist/loader/dist/next.d.ts +2 -1
- package/dist/loader/dist/transform-runner.js +14 -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/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-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/preset-merge.js +0 -192
- package/dist/config/dist/propertyGroups.d.ts +0 -1
- package/dist/config/dist/propertyGroups.js +0 -414
- package/dist/config/dist/resolveTokenTypes.d.ts +0 -1
- package/dist/config/dist/resolveTokenTypes.js +0 -149
- 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/motion.js +0 -10
- 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/motion-transform.js +0 -717
- package/dist/loader/dist/loader/style-transform.js +0 -670
- package/dist/loader/dist/node_modules/react/cjs/react-jsx-runtime.development.js +0 -203
- package/dist/loader/dist/node_modules/react/cjs/react-jsx-runtime.production.js +0 -25
- package/dist/loader/dist/node_modules/react/cjs/react.development.js +0 -762
- package/dist/loader/dist/node_modules/react/cjs/react.production.js +0 -351
- package/dist/loader/dist/node_modules/react/index.js +0 -10
- package/dist/loader/dist/node_modules/react/jsx-runtime.js +0 -10
- package/dist/loader/dist/packages/core/dist/color-opacity-map.js +0 -33
- package/dist/loader/dist/packages/core/dist/compositeStyles.js +0 -43
- package/dist/loader/dist/packages/core/dist/createComponent.js +0 -6
- package/dist/loader/dist/packages/core/dist/createProvider.js +0 -7
- package/dist/loader/dist/packages/core/dist/generated/stylePropsTwMap.js +0 -570
- package/dist/loader/dist/packages/core/dist/getComponentStyles.js +0 -2
- package/dist/loader/dist/packages/core/dist/getStyles.js +0 -60
- package/dist/loader/dist/packages/core/dist/index.js +0 -6
- package/dist/loader/dist/packages/core/dist/modifier-mappings.js +0 -61
- package/dist/loader/dist/packages/core/dist/style-prop-data.js +0 -1257
- package/dist/loader/dist/packages/core/dist/withDefaultStyleProps.js +0 -1
- package/dist/presets/dist/defaultPreset.d.ts +0 -6
- package/dist/presets/dist/defaultPreset.js +0 -51
- package/dist/presets/dist/index.d.ts +0 -1
- package/dist/presets/dist/index.js +0 -1
- package/dist/presets/motion.d.ts +0 -2
- package/dist/presets/motion.js +0 -2
- package/dist/presets.d.ts +0 -2
- package/dist/presets.js +0 -3
- package/dist/styles.d.ts +0 -4
- package/dist/styles.js +0 -5
- package/dist/transformPreset.d.ts +0 -2
- package/dist/transformPreset.js +0 -3
- /package/dist/{config/dist/component-resolution.d.ts → loader/dist/transform-runner.d.ts} +0 -0
|
@@ -1,18 +1,135 @@
|
|
|
1
|
-
import { ComponentConfigValue, HtmlTag, LayerInput } from "./component-config.js";
|
|
1
|
+
import { BoolMarker, ComponentConfigInput, ComponentConfigValue, EnumMarker, HiddenMarker, HtmlTag, LayerInput, PrimitivePropBinding, RootTag, SlotMarker, SplitSlotPath, StringMarker, StylePropMarker, TokenMarker, VerbosePropBinding, composite } from "./component-config.js";
|
|
2
2
|
import { Props } from "./Props.js";
|
|
3
|
-
import {
|
|
3
|
+
import { CreateComponentRenderArgs } from "./bindRender.js";
|
|
4
|
+
import { JSX, ReactNode } from "react";
|
|
4
5
|
|
|
5
6
|
//#region ../config/dist/defineComponent.d.ts
|
|
6
7
|
//#region src/defineComponent.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Helpers injected into a `defineComponent` callback. Carries
|
|
10
|
+
* factories for every prop-binding marker shape so:
|
|
11
|
+
*
|
|
12
|
+
* - Prop bindings are introspectable at runtime (each helper stamps
|
|
13
|
+
* a `__kind` discriminator) — drives both auto-generated TS types
|
|
14
|
+
* and the Studio design-panel control selection.
|
|
15
|
+
* - Layer-bound helpers (`styleProp`, `slot`) narrow against the
|
|
16
|
+
* component's own declared layers — typo'd layer names surface
|
|
17
|
+
* at the authoring site instead of as silent no-ops at runtime.
|
|
18
|
+
* - Authors can't reach for bare-string brace-refs; the helper
|
|
19
|
+
* shape is the only path through.
|
|
20
|
+
*
|
|
21
|
+
* The `TLayers` parameter is inferred from the callback's return
|
|
22
|
+
* value (`layers: {...}`) via contextual typing — the helpers are
|
|
23
|
+
* typed against the same layer map the consumer is currently
|
|
24
|
+
* authoring.
|
|
25
|
+
*/
|
|
26
|
+
interface DefineHelpers<TLayers extends Record<string, LayerInput> = Record<string, LayerInput>> {
|
|
27
|
+
bool: () => BoolMarker;
|
|
28
|
+
string: () => StringMarker;
|
|
29
|
+
styleProp: <TRef extends string>(ref: TRef) => StylePropMarker<'root', TRef>;
|
|
30
|
+
slot: {
|
|
31
|
+
(): SlotMarker<'', 'children'>;
|
|
32
|
+
<const TPath extends string>(path: TPath): SlotMarker<SplitSlotPath<TPath>[0], SplitSlotPath<TPath>[1]>;
|
|
33
|
+
<const TLayer extends keyof TLayers & string, const TProp extends string>(layer: TLayer, options: {
|
|
34
|
+
prop: TProp;
|
|
35
|
+
}): SlotMarker<TLayer, TProp>;
|
|
36
|
+
};
|
|
37
|
+
enums: <const TValues extends Record<string, unknown>>(values: TValues) => EnumMarker<TValues>;
|
|
38
|
+
composite: typeof composite;
|
|
39
|
+
token: <TRef extends string>(ref: TRef) => TokenMarker<TRef>;
|
|
40
|
+
hidden: () => HiddenMarker;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Authoring-side metadata that drives the codegen-emitted AI prompt
|
|
44
|
+
* (`apps/<app>/.uds/react-prompt.ts`) and any future doc tooling.
|
|
45
|
+
*
|
|
46
|
+
* Authored via the chainable `.metadata({...})` on a bound component:
|
|
47
|
+
*
|
|
48
|
+
* const Grid = defineComponent('div', { ... }).metadata({
|
|
49
|
+
* description: 'CSS grid container — pair with `<GridItem>` ...',
|
|
50
|
+
* acceptsChildren: true,
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* Stored as a non-enumerable slot on the component's `__config` so
|
|
54
|
+
* `JSON.stringify(config)` still round-trips clean. Codegen's
|
|
55
|
+
* `synthesizeComponentExportInfo` reads from this map to populate
|
|
56
|
+
* `description`, `acceptsChildren`, and `events` on the catalog entry
|
|
57
|
+
* the prompt generator iterates.
|
|
58
|
+
*
|
|
59
|
+
* All fields are optional — unset fields read `undefined` and the
|
|
60
|
+
* prompt-generator falls back to its existing defaults (event list,
|
|
61
|
+
* children-detection from layer shape, etc.).
|
|
62
|
+
*/
|
|
63
|
+
interface ComponentMetadata {
|
|
64
|
+
/**
|
|
65
|
+
* Short human-readable summary the AI prompt shows next to the
|
|
66
|
+
* component name. Plain prose — no markdown.
|
|
67
|
+
*/
|
|
68
|
+
readonly description?: string;
|
|
69
|
+
/**
|
|
70
|
+
* React/HTML event handler names the component supports
|
|
71
|
+
* (`'focus'`, `'press'`, etc.). The prompt's `[events: ...]` tag
|
|
72
|
+
* lists these. When unset, the synthesizer falls back to the
|
|
73
|
+
* standard React event roster for primitives.
|
|
74
|
+
*
|
|
75
|
+
* `acceptsChildren` is intentionally NOT a field here — the
|
|
76
|
+
* synthesizer derives it from the config shape (primitive +
|
|
77
|
+
* value-extend forms always accept children; verbose form derives
|
|
78
|
+
* from `ForwardBinding { from: 'children' }` presence).
|
|
79
|
+
*/
|
|
80
|
+
readonly events?: readonly string[];
|
|
81
|
+
}
|
|
7
82
|
/**
|
|
8
83
|
* A React component bound to a `defineComponent` config, with the
|
|
9
84
|
* source config attached as a phantom type slot. Tools (codegen,
|
|
10
85
|
* devtools) recover the config at runtime via the non-enumerable
|
|
11
86
|
* `__config` property; the type slot lets consumers read it at the
|
|
12
87
|
* type level too — `Props<typeof Box['__config']>`.
|
|
88
|
+
*
|
|
89
|
+
* The runtime value also carries a chainable `.metadata({...})`
|
|
90
|
+
* method (typed via `BoundComponentWithBuilder` at definition sites).
|
|
91
|
+
* Calling it returns a NEW bound component value with the metadata
|
|
92
|
+
* attached non-enumerably to its `__config`.
|
|
13
93
|
*/
|
|
14
|
-
type BoundComponent<TConfig extends ComponentConfigValue<Record<string, LayerInput>, any, HtmlTag | undefined>, TExtra extends Record<string, unknown> = {}> = React.FC<Props<TConfig> & TExtra> & {
|
|
94
|
+
type BoundComponent<TConfig extends ComponentConfigValue<Record<string, LayerInput>, any, HtmlTag | undefined>, TExtra extends Record<string, unknown> = {}> = React.FC<Omit<Props<TConfig>, keyof TExtra> & TExtra> & {
|
|
15
95
|
readonly __config: TConfig;
|
|
96
|
+
/**
|
|
97
|
+
* The user-authored render function attached to verbose-form
|
|
98
|
+
* (`.render(fn)`) bound components. Codegen's downleveled
|
|
99
|
+
* `#uds/components` emitter reads this so it can call the render
|
|
100
|
+
* fn directly with pre-resolved per-layer bundles, instead of
|
|
101
|
+
* routing through the runtime `bindRender` closure.
|
|
102
|
+
*
|
|
103
|
+
* Non-enumerable at runtime. Absent on primitive-form components
|
|
104
|
+
* (`defineComponent('div', {...})`) and on value-extend-form
|
|
105
|
+
* components (`defineComponent(Box, {...})`) — those have an
|
|
106
|
+
* auto-generated render fn that the downleveler doesn't need to
|
|
107
|
+
* import; their config alone is enough to emit a working FC.
|
|
108
|
+
*/
|
|
109
|
+
readonly __renderFn?: (args: any) => React.ReactNode;
|
|
110
|
+
/**
|
|
111
|
+
* Chainable: attach authoring metadata (`description`,
|
|
112
|
+
* `acceptsChildren`, `events`) read by codegen's prompt + catalog
|
|
113
|
+
* generators. Mutates the underlying config's `metadata` slot
|
|
114
|
+
* non-enumerably and returns the same bound-component value:
|
|
115
|
+
*
|
|
116
|
+
* export const Grid = defineComponent('div', { ... }).metadata({
|
|
117
|
+
* description: 'CSS grid container ...',
|
|
118
|
+
* acceptsChildren: true,
|
|
119
|
+
* });
|
|
120
|
+
*
|
|
121
|
+
* The return type is intentionally widened to a permissive
|
|
122
|
+
* bound-component shape so the recursive `BoundComponent<TConfig>`
|
|
123
|
+
* referenced inside `metadata`'s signature doesn't cause variance
|
|
124
|
+
* issues at consumer call sites (`registerComponents` accepts
|
|
125
|
+
* `BoundComponent<any, any>` and is fine with the looser shape).
|
|
126
|
+
* For tooling that needs the precise `__config`, read it off the
|
|
127
|
+
* pre-`.metadata()` value or off `(Grid as any).__config`.
|
|
128
|
+
*/
|
|
129
|
+
metadata(meta: ComponentMetadata): // biome-ignore lint/suspicious/noExplicitAny: see docblock — loose return to avoid recursive-variance issues
|
|
130
|
+
React.FC<any> & {
|
|
131
|
+
readonly __config: ComponentConfigValue<any, any, any>;
|
|
132
|
+
};
|
|
16
133
|
};
|
|
17
134
|
/**
|
|
18
135
|
* A `defineComponent({...})` config value with a `.render(fn)` builder
|
|
@@ -20,5 +137,181 @@ type BoundComponent<TConfig extends ComponentConfigValue<Record<string, LayerInp
|
|
|
20
137
|
* still produces pure data — codegen can read `__kind`, `layers`,
|
|
21
138
|
* `props`, and `defaultProps` without seeing the render hook.
|
|
22
139
|
*/
|
|
140
|
+
interface DefinedComponent<TLayers extends Record<string, LayerInput>, TProps extends Record<string, VerbosePropBinding>> extends ComponentConfigValue<TLayers, TProps, RootTag<TLayers>> {
|
|
141
|
+
/**
|
|
142
|
+
* Bind this config to a React render function and produce a component.
|
|
143
|
+
* The render fn receives `{ props, children, ...rest }` where
|
|
144
|
+
* `props.<layer>` is the computed bundle for that layer.
|
|
145
|
+
*
|
|
146
|
+
* Pass `TExtra` to declare custom JSX props the render fn consumes
|
|
147
|
+
* (event handlers, controlled state, etc.) that aren't part of the
|
|
148
|
+
* style/layer config. The args type widens to include `TExtra`, and
|
|
149
|
+
* the resulting component's Props become `Props<TConfig> & TExtra`.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* defineComponent({
|
|
153
|
+
* layers: { root: 'div' },
|
|
154
|
+
* }).render<{ onDismiss?: () => void; loading?: boolean }>(
|
|
155
|
+
* ({ props, onDismiss, loading }) => (...)
|
|
156
|
+
* );
|
|
157
|
+
*/
|
|
158
|
+
render<TExtra extends Record<string, unknown> = {}>(fn: (args: CreateComponentRenderArgs<TLayers> & SlotPropsFromConfig<TProps> & TExtra) => ReactNode): BoundComponent<ComponentConfigValue<TLayers, TProps, RootTag<TLayers>>, TExtra>;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Per-config slot-prop map: walk the `props` block, pick out every
|
|
162
|
+
* `slot()`-marked entry, and surface it as `ReactNode | undefined` on
|
|
163
|
+
* the render-fn args. The render fn can conditionally use the value
|
|
164
|
+
* (`title ? <Text>...</Text> : null`); the runtime *also* routes the
|
|
165
|
+
* value into the matching layer's bundle (`props.<layer>.children`)
|
|
166
|
+
* so the typical render-fn shape (`<Text {...props.title} />`) keeps
|
|
167
|
+
* working without manual wiring.
|
|
168
|
+
*/
|
|
169
|
+
type SlotPropsFromConfig<TProps> = { [K in keyof TProps as TProps[K] extends {
|
|
170
|
+
readonly __kind: 'slot';
|
|
171
|
+
} ? K : never]?: ReactNode };
|
|
172
|
+
/**
|
|
173
|
+
* Single-layer config used by the primitive form. No `layers` key
|
|
174
|
+
* (the root tag comes from the first arg). `props` entries use
|
|
175
|
+
* `styleProp(ref)` markers that target the implicit root layer.
|
|
176
|
+
*/
|
|
177
|
+
interface PrimitiveComponentInput<TProps extends Record<string, PrimitivePropBinding>> {
|
|
178
|
+
props?: TProps;
|
|
179
|
+
defaultProps?: Record<string, unknown>;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Single-layer config used by the **value-extend form**
|
|
183
|
+
* (`defineComponent(Box, { defaultProps: {...} })`). The wrapped
|
|
184
|
+
* component is passed in directly as a `BoundComponent` value (its
|
|
185
|
+
* `__config` carries the parent's props + tag); `defaultProps` is
|
|
186
|
+
* narrowed against the parent's exposed prop surface and merged
|
|
187
|
+
* underneath the wrapper's JSX-site props at render time.
|
|
188
|
+
*
|
|
189
|
+
* Replaces the deprecated `'{Name}'` brace-ref syntax. The brace-ref
|
|
190
|
+
* relied on a module-level runtime registry to resolve the parent
|
|
191
|
+
* component by name; the value-import form eliminates that
|
|
192
|
+
* indirection — the parent is a regular import, the bundler tree-
|
|
193
|
+
* shakes it normally, and there is no registry lookup at render time.
|
|
194
|
+
*
|
|
195
|
+
* `TAs` is captured from the literal `defaultProps.as` value when set
|
|
196
|
+
* (`{ as: 'button' }` → `TAs = 'button'`). The value-extend
|
|
197
|
+
* overload threads this through as the synthesized config's TTag slot
|
|
198
|
+
* so `Props<typeof Pressable['__config']>` resolves to
|
|
199
|
+
* `ComponentPropsWithRef<'button'>` (button-specific HTML attrs land
|
|
200
|
+
* on the JSX type) without any manual `Pick<ButtonHTMLAttributes,
|
|
201
|
+
* 'type' | 'disabled' | ...>` shim at the call site.
|
|
202
|
+
*/
|
|
203
|
+
interface ExtendComponentInput<TParentConfig extends ComponentConfigValue<any, any, any>, TAs extends keyof JSX.IntrinsicElements & string> {
|
|
204
|
+
/**
|
|
205
|
+
* Additional prop bindings layered on top of the parent's bindings.
|
|
206
|
+
* Same shape as primitive form's `props`.
|
|
207
|
+
*/
|
|
208
|
+
props?: Record<string, PrimitivePropBinding>;
|
|
209
|
+
/**
|
|
210
|
+
* Default values for the parent's JSX-prop surface PLUS any extra
|
|
211
|
+
* wrapper-declared props (the keys in `this.props`). Defaults to
|
|
212
|
+
* `Partial<Props<TParentConfig>>` here; the function overload
|
|
213
|
+
* tightens the type to also include the wrapper's `TExtraProps`
|
|
214
|
+
* key set so e.g. `Anchor`'s `defaultProps: { variant: 'body' }`
|
|
215
|
+
* typechecks against the `composite('textVariant')` binding the
|
|
216
|
+
* same `config.props` block declares.
|
|
217
|
+
*
|
|
218
|
+
* The `as` slot is the polymorphic-element override the runtime /
|
|
219
|
+
* auto-render reads to switch the rendered tag.
|
|
220
|
+
*/
|
|
221
|
+
defaultProps?: Partial<Omit<Props<TParentConfig>, 'as'>> & {
|
|
222
|
+
as?: TAs;
|
|
223
|
+
[key: string]: any;
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Value-extend form — `defineComponent(Box, { defaultProps: {...} })`.
|
|
228
|
+
*
|
|
229
|
+
* Takes another `defineComponent` value as the first argument and
|
|
230
|
+
* produces a new bound component whose config is the parent's config
|
|
231
|
+
* flattened with the wrapper's options merged in:
|
|
232
|
+
*
|
|
233
|
+
* - `layers` and `props` carry over from the parent (so VStack
|
|
234
|
+
* accepts all of Box's style props).
|
|
235
|
+
* - `defaultProps` becomes `{ ...parent.defaultProps, ...input.defaultProps }`.
|
|
236
|
+
* - `defaultProps.as` (when set as a literal) becomes the synthesized
|
|
237
|
+
* config's TTag slot so JSX-site element attrs narrow accordingly
|
|
238
|
+
* (`<Pressable type="button" disabled>` picks up button HTML attrs).
|
|
239
|
+
*
|
|
240
|
+
* No runtime registry lookup: the parent is a normal imported value
|
|
241
|
+
* the bundler tree-shakes alongside the wrapper. Replaces the
|
|
242
|
+
* deprecated `'{Name}'` brace-ref form.
|
|
243
|
+
*/
|
|
244
|
+
declare function defineComponent<TParentConfig extends ComponentConfigValue<any, any, any>, const TAs extends keyof JSX.IntrinsicElements & string = 'div', const TExtraProps extends Record<string, PrimitivePropBinding> = {}>(parent: BoundComponent<TParentConfig>, config?: ExtendComponentInput<TParentConfig, TAs> & {
|
|
245
|
+
props?: TExtraProps;
|
|
246
|
+
}): BoundComponent<ComponentConfigValue<TParentConfig['layers'], Omit<Exclude<TParentConfig['props'], undefined>, keyof TExtraProps> & TExtraProps, TAs>> & {
|
|
247
|
+
/**
|
|
248
|
+
* Attach wrapper-side defaults / extra props via a helper-driven
|
|
249
|
+
* callback. Returns a fresh bound component carrying the merged
|
|
250
|
+
* config.
|
|
251
|
+
*/
|
|
252
|
+
config<const TAs2 extends keyof JSX.IntrinsicElements & string = 'div', const TExtraProps2 extends Record<string, VerbosePropBinding> = {}>(cb: (h: DefineHelpers) => ExtendComponentInput<TParentConfig, TAs2> & {
|
|
253
|
+
props?: TExtraProps2;
|
|
254
|
+
}): BoundComponent<ComponentConfigValue<TParentConfig['layers'], Omit<Exclude<TParentConfig['props'], undefined>, keyof TExtraProps2> & TExtraProps2, TAs2>>;
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
* Primitive shorthand — `defineComponent('div', { props: {...} })`.
|
|
258
|
+
*
|
|
259
|
+
* The returned bound component also carries a `.config((h) => ({...}))`
|
|
260
|
+
* method so authors can declare style-prop bindings / default props
|
|
261
|
+
* fluently:
|
|
262
|
+
*
|
|
263
|
+
* export const Spacer = defineComponent('div');
|
|
264
|
+
* export const Box = defineComponent('div').config(({ styleProp }) => ({
|
|
265
|
+
* props: { bg: styleProp('bg') },
|
|
266
|
+
* }));
|
|
267
|
+
*/
|
|
268
|
+
declare function defineComponent<const TTag extends HtmlTag, const TProps extends Record<string, PrimitivePropBinding> = {}>(tag: TTag, config?: PrimitiveComponentInput<TProps>): BoundComponent<ComponentConfigValue<{
|
|
269
|
+
root: TTag;
|
|
270
|
+
}, TProps, TTag>> & {
|
|
271
|
+
config<const TProps2 extends Record<string, VerbosePropBinding<{
|
|
272
|
+
root: TTag;
|
|
273
|
+
}>> = {}>(cb: (h: DefineHelpers<{
|
|
274
|
+
root: TTag;
|
|
275
|
+
}>) => PrimitiveComponentInput<TProps2>): BoundComponent<ComponentConfigValue<{
|
|
276
|
+
root: TTag;
|
|
277
|
+
}, TProps2, TTag>>;
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Verbose form — `defineComponent({ layers, props, defaultProps })`.
|
|
281
|
+
* Returns the pure-data config value with a `.render(fn)` builder.
|
|
282
|
+
*/
|
|
283
|
+
declare function defineComponent<const TLayers extends Record<string, LayerInput>, const TProps extends Record<string, VerbosePropBinding<TLayers>> = {}>(config: ComponentConfigInput<TLayers, TProps>): DefinedComponent<TLayers, TProps>;
|
|
284
|
+
/**
|
|
285
|
+
* Two-step authoring API for multi-layer components: declare layers
|
|
286
|
+
* up-front so the `.config((h) => ({...}))` callback's helpers can
|
|
287
|
+
* narrow against the declared layer keys.
|
|
288
|
+
*
|
|
289
|
+
* defineComponent
|
|
290
|
+
* .layers({ root: 'div', label: 'strong' })
|
|
291
|
+
* .config(({ slot, styleProp, token, bool, enums }) => ({
|
|
292
|
+
* props: {
|
|
293
|
+
* title: slot('label/children'), // 'label' narrows
|
|
294
|
+
* bg: styleProp('bg').on('root'),
|
|
295
|
+
* loading: bool(),
|
|
296
|
+
* },
|
|
297
|
+
* base: { root: { bg: token('bg/brand') } },
|
|
298
|
+
* defaultProps: { loading: false },
|
|
299
|
+
* }))
|
|
300
|
+
* .render(({ props }) => ...); // optional
|
|
301
|
+
*
|
|
302
|
+
* Single-layer primitive and value-extend components use the direct
|
|
303
|
+
* call form: `defineComponent('div').config(...)` and
|
|
304
|
+
* `defineComponent(Parent).config(...)`. Only multi-layer authoring
|
|
305
|
+
* goes through `defineComponent.layers({...})`.
|
|
306
|
+
*/
|
|
307
|
+
declare namespace defineComponent {
|
|
308
|
+
/**
|
|
309
|
+
* `defineComponent.layers({...})` — first step of the multi-layer
|
|
310
|
+
* builder. Returns an object with a `.config((h) => ({...}))` method.
|
|
311
|
+
*/
|
|
312
|
+
function layers<const TLayers extends Record<string, LayerInput>>(layersMap: TLayers): {
|
|
313
|
+
config<const TProps extends Record<string, VerbosePropBinding<TLayers>> = {}>(cb: (h: DefineHelpers<TLayers>) => Omit<ComponentConfigInput<TLayers, TProps>, 'layers'>): DefinedComponent<TLayers, TProps>;
|
|
314
|
+
};
|
|
315
|
+
} //#endregion
|
|
23
316
|
//#endregion
|
|
24
|
-
export { BoundComponent };
|
|
317
|
+
export { BoundComponent, DefineHelpers, DefinedComponent, PrimitiveComponentInput, defineComponent };
|
|
@@ -1,2 +1,264 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "
|
|
1
|
+
import { bool, composite, enums, hidden, slot, string, styleProp, token } from "./component-config.js";
|
|
2
|
+
import { bindRender } from "./bindRender.js";
|
|
3
|
+
import { createElement } from "react";
|
|
4
|
+
//#region ../config/dist/defineComponent.js
|
|
5
|
+
/**
|
|
6
|
+
* `defineComponent(...)` — author a component config.
|
|
7
|
+
*
|
|
8
|
+
* Three call shapes:
|
|
9
|
+
*
|
|
10
|
+
* **1. Primitive** — first arg is an HTML tag string. The returned
|
|
11
|
+
* value is a working bound component (auto-rendered) with a
|
|
12
|
+
* chainable `.config((h) => ({...}))` for declaring style-prop
|
|
13
|
+
* bindings + default props:
|
|
14
|
+
*
|
|
15
|
+
* export const Spacer = defineComponent('div');
|
|
16
|
+
* export const Box = defineComponent('div').config(({ styleProp }) => ({
|
|
17
|
+
* props: { bg: styleProp('bg'), padding: styleProp('spacing') },
|
|
18
|
+
* }));
|
|
19
|
+
*
|
|
20
|
+
* **2. Value-extend** — first arg is another `defineComponent`-produced
|
|
21
|
+
* bound component. Inherits the parent's layers + prop surface; chain
|
|
22
|
+
* `.config((h) => ({...}))` to merge wrapper-side defaults / extra
|
|
23
|
+
* props:
|
|
24
|
+
*
|
|
25
|
+
* export const Pressable = defineComponent(Box).config(() => ({
|
|
26
|
+
* defaultProps: { as: 'button' },
|
|
27
|
+
* }));
|
|
28
|
+
*
|
|
29
|
+
* **3. Multi-layer** — `defineComponent.layers({...}).config(({ ... }) => ({...}))`.
|
|
30
|
+
* Returns a pure-data config value with a chainable `.render(fn)`
|
|
31
|
+
* method that binds the config to a React render function. Helpers
|
|
32
|
+
* narrow against the declared layer keys:
|
|
33
|
+
*
|
|
34
|
+
* export const Alert = defineComponent
|
|
35
|
+
* .layers({ root: 'div', label: 'strong' })
|
|
36
|
+
* .config(({ slot, enums }) => ({
|
|
37
|
+
* props: {
|
|
38
|
+
* children: slot('label/children'),
|
|
39
|
+
* severity: enums({ info: {…}, warning: {…} }),
|
|
40
|
+
* },
|
|
41
|
+
* }))
|
|
42
|
+
* .render(({ props }) => (
|
|
43
|
+
* <div {...props.root}>
|
|
44
|
+
* <strong {...props.label} />
|
|
45
|
+
* </div>
|
|
46
|
+
* ));
|
|
47
|
+
*
|
|
48
|
+
* A slot binding routes its incoming JSX value onto the named layer's
|
|
49
|
+
* bundle — the render fn just spreads the bundle; no manual
|
|
50
|
+
* `{children}` re-placement.
|
|
51
|
+
*
|
|
52
|
+
* Need custom non-config props (event handlers, controlled state)?
|
|
53
|
+
* Declare them via the `.render<TExtra>(fn)` generic. The render fn
|
|
54
|
+
* args widen to include `TExtra`; the component's Props become
|
|
55
|
+
* `Props<TConfig> & TExtra`:
|
|
56
|
+
*
|
|
57
|
+
* export const Alert = defineComponent
|
|
58
|
+
* .layers({ root: 'div', label: 'strong' })
|
|
59
|
+
* .config(({ slot }) => ({
|
|
60
|
+
* props: { children: slot('label/children') },
|
|
61
|
+
* }))
|
|
62
|
+
* .render<{ onDismiss?: () => void; loading?: boolean }>(
|
|
63
|
+
* ({ props, onDismiss, loading }) => (
|
|
64
|
+
* <div {...props.root}>
|
|
65
|
+
* <strong {...props.label} />
|
|
66
|
+
* {onDismiss && <button onClick={onDismiss}>×</button>}
|
|
67
|
+
* </div>
|
|
68
|
+
* ),
|
|
69
|
+
* );
|
|
70
|
+
*
|
|
71
|
+
* The component's name is *not* part of any shape — it's supplied by
|
|
72
|
+
* the key the consumer uses in `.registerComponents({ Alert })`,
|
|
73
|
+
* mirroring how `defineStyleProp({...})` is keyed by
|
|
74
|
+
* `.registerStyleProps({ bg })`.
|
|
75
|
+
*
|
|
76
|
+
* The returned value carries `layers`, `props`, and the root-tag literal
|
|
77
|
+
* as const-narrowed types so downstream `import type { AlertConfig }`
|
|
78
|
+
* threads the full shape through to `Props<typeof config>`.
|
|
79
|
+
*/
|
|
80
|
+
const HELPERS = {
|
|
81
|
+
bool,
|
|
82
|
+
string,
|
|
83
|
+
styleProp,
|
|
84
|
+
slot,
|
|
85
|
+
enums,
|
|
86
|
+
composite,
|
|
87
|
+
token,
|
|
88
|
+
hidden
|
|
89
|
+
};
|
|
90
|
+
function defineComponent(tagOrConfigOrParent, optionsOrConfig) {
|
|
91
|
+
if (typeof tagOrConfigOrParent === "function" && "__config" in tagOrConfigOrParent) {
|
|
92
|
+
const parentConfig = tagOrConfigOrParent.__config;
|
|
93
|
+
const input = optionsOrConfig;
|
|
94
|
+
const parentDefaults = parentConfig.defaultProps;
|
|
95
|
+
const inputDefaults = input?.defaultProps;
|
|
96
|
+
const mergedDefaults = parentDefaults || inputDefaults ? {
|
|
97
|
+
...parentDefaults ?? {},
|
|
98
|
+
...inputDefaults ?? {}
|
|
99
|
+
} : void 0;
|
|
100
|
+
const mergedProps = parentConfig.props || input?.props ? {
|
|
101
|
+
...parentConfig.props ?? {},
|
|
102
|
+
...input?.props ?? {}
|
|
103
|
+
} : void 0;
|
|
104
|
+
const synthesized = {
|
|
105
|
+
__kind: "componentConfig",
|
|
106
|
+
layers: parentConfig.layers,
|
|
107
|
+
props: mergedProps,
|
|
108
|
+
defaultProps: mergedDefaults
|
|
109
|
+
};
|
|
110
|
+
Object.defineProperty(synthesized, "__parentConfig", {
|
|
111
|
+
enumerable: false,
|
|
112
|
+
configurable: true,
|
|
113
|
+
writable: true,
|
|
114
|
+
value: parentConfig
|
|
115
|
+
});
|
|
116
|
+
const parentRoot = parentConfig.layers.root;
|
|
117
|
+
const inferredTag = typeof parentRoot === "string" ? parentRoot : typeof parentRoot === "object" && parentRoot !== null && "tag" in parentRoot ? parentRoot.tag : "div";
|
|
118
|
+
const autoRender = (args) => {
|
|
119
|
+
const { props, children, as, ...rest } = args;
|
|
120
|
+
const rootBundle = props.root;
|
|
121
|
+
const merged = {
|
|
122
|
+
...rootBundle,
|
|
123
|
+
...rest,
|
|
124
|
+
children: rootBundle.children ?? children
|
|
125
|
+
};
|
|
126
|
+
return createElement(as ?? inferredTag, merged);
|
|
127
|
+
};
|
|
128
|
+
const Component = bindRender(synthesized, autoRender);
|
|
129
|
+
attachConfig(Component, synthesized);
|
|
130
|
+
attachExtendConfig(Component, parentConfig);
|
|
131
|
+
return Component;
|
|
132
|
+
}
|
|
133
|
+
if (typeof tagOrConfigOrParent === "string") {
|
|
134
|
+
const tag = tagOrConfigOrParent;
|
|
135
|
+
const primitiveInput = optionsOrConfig;
|
|
136
|
+
const synthesized = {
|
|
137
|
+
__kind: "componentConfig",
|
|
138
|
+
layers: { root: tag },
|
|
139
|
+
props: primitiveInput?.props,
|
|
140
|
+
defaultProps: primitiveInput?.defaultProps
|
|
141
|
+
};
|
|
142
|
+
const autoRender = (args) => {
|
|
143
|
+
const { props, children, as, ...rest } = args;
|
|
144
|
+
const rootBundle = props.root;
|
|
145
|
+
const merged = {
|
|
146
|
+
...rootBundle,
|
|
147
|
+
...rest,
|
|
148
|
+
children: rootBundle.children ?? children
|
|
149
|
+
};
|
|
150
|
+
return createElement(as ?? tag, merged);
|
|
151
|
+
};
|
|
152
|
+
const Component = bindRender(synthesized, autoRender);
|
|
153
|
+
attachConfig(Component, synthesized);
|
|
154
|
+
attachPrimitiveConfig(Component, tag);
|
|
155
|
+
return Component;
|
|
156
|
+
}
|
|
157
|
+
const config = {
|
|
158
|
+
__kind: "componentConfig",
|
|
159
|
+
layers: tagOrConfigOrParent.layers,
|
|
160
|
+
props: tagOrConfigOrParent.props,
|
|
161
|
+
base: tagOrConfigOrParent.base,
|
|
162
|
+
motion: tagOrConfigOrParent.motion,
|
|
163
|
+
defaultProps: tagOrConfigOrParent.defaultProps,
|
|
164
|
+
compoundProps: tagOrConfigOrParent.compoundProps
|
|
165
|
+
};
|
|
166
|
+
Object.defineProperty(config, "render", {
|
|
167
|
+
enumerable: false,
|
|
168
|
+
value: function render(fn) {
|
|
169
|
+
const Component = bindRender(config, fn);
|
|
170
|
+
attachConfig(Component, config);
|
|
171
|
+
Object.defineProperty(Component, "__renderFn", {
|
|
172
|
+
enumerable: false,
|
|
173
|
+
value: fn
|
|
174
|
+
});
|
|
175
|
+
Object.defineProperty(config, "__hasRenderFn", {
|
|
176
|
+
enumerable: false,
|
|
177
|
+
value: true
|
|
178
|
+
});
|
|
179
|
+
return Component;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
return config;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Attach the underlying config + the chainable `.metadata({...})`
|
|
186
|
+
* method to a bound component. Both slots are non-enumerable so
|
|
187
|
+
* tooling (codegen, devtools) can recover the source shape without
|
|
188
|
+
* polluting JSX prop spreads or `JSON.stringify` output.
|
|
189
|
+
*
|
|
190
|
+
* `.metadata(meta)` produces a fresh bound component whose `__config`
|
|
191
|
+
* carries the metadata under a non-enumerable `metadata` slot. The
|
|
192
|
+
* synthesized config object is shared by reference (mutation isolates
|
|
193
|
+
* to the metadata slot via `Object.defineProperty`), so reads from the
|
|
194
|
+
* original Component still see the new metadata once attached — useful
|
|
195
|
+
* for downstream tooling that walks the registered map after
|
|
196
|
+
* authoring.
|
|
197
|
+
*/
|
|
198
|
+
function attachConfig(Component, config) {
|
|
199
|
+
Object.defineProperty(Component, "__config", {
|
|
200
|
+
enumerable: false,
|
|
201
|
+
value: config
|
|
202
|
+
});
|
|
203
|
+
Object.defineProperty(Component, "metadata", {
|
|
204
|
+
enumerable: false,
|
|
205
|
+
value: (meta) => {
|
|
206
|
+
Object.defineProperty(config, "metadata", {
|
|
207
|
+
enumerable: false,
|
|
208
|
+
configurable: true,
|
|
209
|
+
writable: true,
|
|
210
|
+
value: meta
|
|
211
|
+
});
|
|
212
|
+
return Component;
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Graft a `.config((h) => ({...}))` method onto a primitive-form bound
|
|
218
|
+
* component. The method invokes the callback with the shared HELPERS
|
|
219
|
+
* bag and re-runs `defineComponent(tag, config)` with the resolved
|
|
220
|
+
* options, producing a fresh bound component with the new bindings.
|
|
221
|
+
*/
|
|
222
|
+
function attachPrimitiveConfig(Component, tag) {
|
|
223
|
+
Object.defineProperty(Component, "config", {
|
|
224
|
+
enumerable: false,
|
|
225
|
+
value: (cb) => {
|
|
226
|
+
const config = cb(HELPERS);
|
|
227
|
+
return defineComponent(tag, config);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Graft a `.config((h) => ({...}))` method onto a value-extend bound
|
|
233
|
+
* component. Same shape as `attachPrimitiveConfig` but routes through
|
|
234
|
+
* the value-extend overload so wrapper-side `defaultProps` / extra
|
|
235
|
+
* `props` flow into the synthesized config.
|
|
236
|
+
*/
|
|
237
|
+
function attachExtendConfig(Component, parentConfig) {
|
|
238
|
+
Object.defineProperty(Component, "config", {
|
|
239
|
+
enumerable: false,
|
|
240
|
+
value: (cb) => {
|
|
241
|
+
const config = cb(HELPERS);
|
|
242
|
+
const parentShell = (() => null);
|
|
243
|
+
Object.defineProperty(parentShell, "__config", {
|
|
244
|
+
enumerable: false,
|
|
245
|
+
value: parentConfig
|
|
246
|
+
});
|
|
247
|
+
return defineComponent(parentShell, config);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
(function(_defineComponent) {
|
|
252
|
+
function layers(layersMap) {
|
|
253
|
+
return { config(cb) {
|
|
254
|
+
const rest = cb(HELPERS);
|
|
255
|
+
return defineComponent({
|
|
256
|
+
layers: layersMap,
|
|
257
|
+
...rest
|
|
258
|
+
});
|
|
259
|
+
} };
|
|
260
|
+
}
|
|
261
|
+
_defineComponent.layers = layers;
|
|
262
|
+
})(defineComponent || (defineComponent = {}));
|
|
263
|
+
//#endregion
|
|
264
|
+
export { defineComponent };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//#region ../config/dist/defineCompositeStyle.d.ts
|
|
2
|
+
//#region src/defineCompositeStyle.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* `defineCompositeStyle(...)` — author a single composite style.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors the factory + registry pattern used by `defineStyleProp` +
|
|
7
|
+
* `.registerStyleProps({...})` and `defineComponent` + `.registerComponents({...})`.
|
|
8
|
+
* One composite per file is the canonical authoring shape; consumers
|
|
9
|
+
* import the value and pass it to `.registerComposites({...})` on the
|
|
10
|
+
* UDS builder.
|
|
11
|
+
*
|
|
12
|
+
* // packages/.../text-variant.ts
|
|
13
|
+
* export const textVariant = defineCompositeStyle({
|
|
14
|
+
* label: 'Text Variant',
|
|
15
|
+
* description: 'Typography presets',
|
|
16
|
+
* styles: {
|
|
17
|
+
* heading1: { fontSize: '[2.5rem]', fontWeight: 'bold' },
|
|
18
|
+
* body: { fontSize: 'base', fontWeight: 'normal' },
|
|
19
|
+
* },
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // apps/<consumer>/uds.config.ts
|
|
23
|
+
* udsBuilder.registerComposites({ textVariant });
|
|
24
|
+
*
|
|
25
|
+
* The returned value is pure data with a `__kind: 'compositeStyle'`
|
|
26
|
+
* brand so the builder's `.registerComposites` can distinguish it from
|
|
27
|
+
* a plain object. `.metadata({...})` is a no-op stub for now — symmetry
|
|
28
|
+
* with `defineStyleProp`'s chain — and can grow new fields without
|
|
29
|
+
* breaking the surface.
|
|
30
|
+
*
|
|
31
|
+
* Authors reference tokens via the `token('namespace/name')` helper,
|
|
32
|
+
* write inline CSS literals (`'1rem'`, `'450'`), or opt into arbitrary
|
|
33
|
+
* values with the `'[2.5rem]'` bracket syntax. The resolver walks
|
|
34
|
+
* each entry at registration time and emits the matching style-prop
|
|
35
|
+
* declarations into the composite's `@utility` block.
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* One entry inside a composite's `styles[variantId]` map — a bag of
|
|
39
|
+
* style-prop keys to values. Values are `TokenMarker` instances from
|
|
40
|
+
* `token('ns/name')`, inline CSS literals, or arbitrary-value brackets
|
|
41
|
+
* (`'[2.5rem]'`); the resolver expands them like any style-prop value
|
|
42
|
+
* at registration time.
|
|
43
|
+
*/
|
|
44
|
+
interface CompositeStyleObject {
|
|
45
|
+
[styleProp: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The shape `defineCompositeStyle({...})` accepts and the resolver
|
|
49
|
+
* stores under `config.compositeStyles[<name>]`. Each entry exposes a
|
|
50
|
+
* `<name>` JSX prop on components whose values are the keys of `styles`.
|
|
51
|
+
*/
|
|
52
|
+
interface CompositeStyleDef {
|
|
53
|
+
/** Human-readable display name surfaced in Studio. */
|
|
54
|
+
label: string;
|
|
55
|
+
/** Optional long-form description surfaced in Studio. */
|
|
56
|
+
description?: string;
|
|
57
|
+
/** Variant id -> style bag. Variant ids become JSX prop values. */
|
|
58
|
+
styles: Record<string, CompositeStyleObject>;
|
|
59
|
+
}
|
|
60
|
+
type CompositeStylesConfig = Record<string, CompositeStyleDef>;
|
|
61
|
+
/**
|
|
62
|
+
* Branded composite-style value returned by `defineCompositeStyle`.
|
|
63
|
+
* Adds a `__kind` brand so the builder can distinguish factory-authored
|
|
64
|
+
* composites from plain object literals.
|
|
65
|
+
*/
|
|
66
|
+
interface DefinedCompositeStyle extends CompositeStyleDef {
|
|
67
|
+
readonly __kind: 'compositeStyle';
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Compile-time shape input to `defineCompositeStyle`. Carries a
|
|
71
|
+
* `label`, an optional `description`, and a `styles` map keyed by
|
|
72
|
+
* variant id.
|
|
73
|
+
*
|
|
74
|
+
* `styles[variantId]` is a `CompositeStyleObject` (one style-prop key
|
|
75
|
+
* → one value); values are `TokenMarker` instances from
|
|
76
|
+
* `token('ns/name')`, inline CSS literals (`'1rem'`), or arbitrary
|
|
77
|
+
* brackets (`'[2.5rem]'`).
|
|
78
|
+
*/
|
|
79
|
+
interface CompositeStyleInput {
|
|
80
|
+
label: string;
|
|
81
|
+
description?: string;
|
|
82
|
+
styles: Record<string, CompositeStyleObject>;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Author a composite style. Returns a branded value the consumer
|
|
86
|
+
* passes to `.registerComposites({...})` on the UDS builder.
|
|
87
|
+
*
|
|
88
|
+
* Pure — no global registration happens here; the builder's
|
|
89
|
+
* `.registerComposites({...})` is the registration step.
|
|
90
|
+
*/
|
|
91
|
+
declare function defineCompositeStyle(input: CompositeStyleInput): DefinedCompositeStyle; //#endregion
|
|
92
|
+
//#endregion
|
|
93
|
+
export { CompositeStyleDef, CompositeStyleInput, CompositeStyleObject, CompositeStylesConfig, DefinedCompositeStyle, defineCompositeStyle };
|