@yahoo/uds-v5-wip 1.59.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 +27 -0
- package/dist/loader/dist/loader.js +71 -309
- 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 -432
- package/dist/components/dist/accordion.config.js +0 -81
- package/dist/components/dist/accordion.d.ts +0 -454
- package/dist/components/dist/accordion.js +0 -60
- package/dist/components/dist/alert.config.d.ts +0 -220
- package/dist/components/dist/alert.config.js +0 -54
- package/dist/components/dist/alert.d.ts +0 -231
- package/dist/components/dist/alert.js +0 -16
- package/dist/components/dist/anchor.config.d.ts +0 -251
- package/dist/components/dist/anchor.config.js +0 -22
- package/dist/components/dist/anchor.d.ts +0 -262
- package/dist/components/dist/anchor.js +0 -9
- package/dist/components/dist/article.d.ts +0 -12
- package/dist/components/dist/article.js +0 -9
- package/dist/components/dist/aside.d.ts +0 -12
- package/dist/components/dist/aside.js +0 -9
- package/dist/components/dist/avatar-group.config.d.ts +0 -316
- package/dist/components/dist/avatar-group.config.js +0 -33
- package/dist/components/dist/avatar-group.d.ts +0 -330
- package/dist/components/dist/avatar-group.js +0 -39
- package/dist/components/dist/avatar.config.d.ts +0 -198
- package/dist/components/dist/avatar.config.js +0 -49
- package/dist/components/dist/avatar.d.ts +0 -212
- package/dist/components/dist/avatar.js +0 -20
- package/dist/components/dist/badge.config.d.ts +0 -478
- package/dist/components/dist/badge.config.js +0 -99
- package/dist/components/dist/badge.d.ts +0 -490
- package/dist/components/dist/badge.js +0 -16
- package/dist/components/dist/box.d.ts +0 -15
- package/dist/components/dist/box.js +0 -9
- package/dist/components/dist/breadcrumb.config.d.ts +0 -391
- package/dist/components/dist/breadcrumb.config.js +0 -43
- package/dist/components/dist/breadcrumb.d.ts +0 -421
- package/dist/components/dist/breadcrumb.js +0 -119
- package/dist/components/dist/button.config.d.ts +0 -382
- package/dist/components/dist/button.config.js +0 -91
- package/dist/components/dist/button.d.ts +0 -404
- package/dist/components/dist/button.js +0 -35
- package/dist/components/dist/card.config.d.ts +0 -337
- package/dist/components/dist/card.config.js +0 -33
- package/dist/components/dist/card.d.ts +0 -353
- package/dist/components/dist/card.js +0 -27
- package/dist/components/dist/collapsible.config.d.ts +0 -46
- package/dist/components/dist/collapsible.config.js +0 -46
- package/dist/components/dist/collapsible.d.ts +0 -62
- package/dist/components/dist/collapsible.js +0 -38
- package/dist/components/dist/command.config.d.ts +0 -1614
- package/dist/components/dist/command.config.js +0 -170
- package/dist/components/dist/command.d.ts +0 -1723
- package/dist/components/dist/command.js +0 -341
- package/dist/components/dist/control-color.config.d.ts +0 -980
- package/dist/components/dist/control-color.config.js +0 -81
- package/dist/components/dist/control-color.d.ts +0 -996
- package/dist/components/dist/control-color.js +0 -64
- package/dist/components/dist/control-curve.config.d.ts +0 -19
- package/dist/components/dist/control-curve.config.js +0 -14
- package/dist/components/dist/control-curve.d.ts +0 -36
- package/dist/components/dist/control-curve.js +0 -81
- package/dist/components/dist/control-folder.config.d.ts +0 -178
- package/dist/components/dist/control-folder.config.js +0 -47
- package/dist/components/dist/control-folder.d.ts +0 -195
- package/dist/components/dist/control-folder.js +0 -41
- package/dist/components/dist/control-group.config.d.ts +0 -860
- package/dist/components/dist/control-group.config.js +0 -80
- package/dist/components/dist/control-group.d.ts +0 -882
- package/dist/components/dist/control-group.js +0 -89
- package/dist/components/dist/control-knob.config.d.ts +0 -793
- package/dist/components/dist/control-knob.config.js +0 -67
- package/dist/components/dist/control-knob.d.ts +0 -820
- package/dist/components/dist/control-knob.js +0 -148
- package/dist/components/dist/control-panel.config.d.ts +0 -403
- package/dist/components/dist/control-panel.config.js +0 -38
- package/dist/components/dist/control-panel.d.ts +0 -416
- package/dist/components/dist/control-panel.js +0 -22
- package/dist/components/dist/control-select.config.d.ts +0 -1177
- package/dist/components/dist/control-select.config.js +0 -102
- package/dist/components/dist/control-select.d.ts +0 -1201
- package/dist/components/dist/control-select.js +0 -63
- package/dist/components/dist/control-slider.config.d.ts +0 -105
- package/dist/components/dist/control-slider.config.js +0 -98
- package/dist/components/dist/control-slider.d.ts +0 -128
- package/dist/components/dist/control-slider.js +0 -87
- package/dist/components/dist/control-spring.config.d.ts +0 -418
- package/dist/components/dist/control-spring.config.js +0 -36
- package/dist/components/dist/control-spring.d.ts +0 -440
- package/dist/components/dist/control-spring.js +0 -136
- package/dist/components/dist/control-stepper.config.d.ts +0 -1085
- package/dist/components/dist/control-stepper.config.js +0 -108
- package/dist/components/dist/control-stepper.d.ts +0 -1105
- package/dist/components/dist/control-stepper.js +0 -109
- package/dist/components/dist/control-toggle.config.d.ts +0 -408
- package/dist/components/dist/control-toggle.config.js +0 -26
- package/dist/components/dist/control-toggle.d.ts +0 -421
- package/dist/components/dist/control-toggle.js +0 -36
- package/dist/components/dist/createSlot.d.ts +0 -9
- package/dist/components/dist/createSlot.js +0 -89
- package/dist/components/dist/dropdown.config.d.ts +0 -921
- package/dist/components/dist/dropdown.config.js +0 -107
- package/dist/components/dist/dropdown.d.ts +0 -951
- package/dist/components/dist/dropdown.js +0 -92
- package/dist/components/dist/empty-state.config.d.ts +0 -397
- package/dist/components/dist/empty-state.config.js +0 -53
- package/dist/components/dist/empty-state.d.ts +0 -417
- package/dist/components/dist/empty-state.js +0 -33
- package/dist/components/dist/footer.d.ts +0 -12
- package/dist/components/dist/footer.js +0 -9
- package/dist/components/dist/grid.d.ts +0 -42
- package/dist/components/dist/grid.js +0 -34
- package/dist/components/dist/header.d.ts +0 -12
- package/dist/components/dist/header.js +0 -9
- package/dist/components/dist/hstack.d.ts +0 -16
- package/dist/components/dist/hstack.js +0 -21
- package/dist/components/dist/image.d.ts +0 -20
- package/dist/components/dist/image.js +0 -9
- package/dist/components/dist/input.config.d.ts +0 -59
- package/dist/components/dist/input.config.js +0 -42
- package/dist/components/dist/input.d.ts +0 -68
- package/dist/components/dist/input.js +0 -14
- package/dist/components/dist/item.config.d.ts +0 -352
- package/dist/components/dist/item.config.js +0 -83
- package/dist/components/dist/item.d.ts +0 -375
- package/dist/components/dist/item.js +0 -51
- package/dist/components/dist/list.d.ts +0 -20
- package/dist/components/dist/list.js +0 -21
- package/dist/components/dist/main.d.ts +0 -12
- package/dist/components/dist/main.js +0 -9
- package/dist/components/dist/modal.config.d.ts +0 -398
- package/dist/components/dist/modal.config.js +0 -92
- package/dist/components/dist/modal.d.ts +0 -434
- package/dist/components/dist/modal.js +0 -125
- package/dist/components/dist/nav-header.config.d.ts +0 -159
- package/dist/components/dist/nav-header.config.js +0 -26
- package/dist/components/dist/nav-header.d.ts +0 -174
- package/dist/components/dist/nav-header.js +0 -23
- package/dist/components/dist/nav.d.ts +0 -12
- package/dist/components/dist/nav.js +0 -9
- package/dist/components/dist/preset-bar.config.d.ts +0 -193
- package/dist/components/dist/preset-bar.config.js +0 -39
- package/dist/components/dist/preset-bar.d.ts +0 -216
- package/dist/components/dist/preset-bar.js +0 -71
- package/dist/components/dist/presets/index.d.ts +0 -17675
- package/dist/components/dist/presets/index.js +0 -97
- package/dist/components/dist/pressable.d.ts +0 -12
- package/dist/components/dist/pressable.js +0 -9
- package/dist/components/dist/progress.config.d.ts +0 -297
- package/dist/components/dist/progress.config.js +0 -35
- package/dist/components/dist/progress.d.ts +0 -312
- package/dist/components/dist/progress.js +0 -43
- package/dist/components/dist/section.d.ts +0 -12
- package/dist/components/dist/section.js +0 -9
- package/dist/components/dist/select.config.d.ts +0 -32
- package/dist/components/dist/select.config.js +0 -25
- package/dist/components/dist/select.d.ts +0 -46
- package/dist/components/dist/select.js +0 -13
- package/dist/components/dist/sheet.config.d.ts +0 -246
- package/dist/components/dist/sheet.config.js +0 -99
- package/dist/components/dist/sheet.d.ts +0 -268
- package/dist/components/dist/sheet.js +0 -53
- package/dist/components/dist/sidebar.config.d.ts +0 -1652
- package/dist/components/dist/sidebar.config.js +0 -217
- package/dist/components/dist/sidebar.d.ts +0 -1826
- package/dist/components/dist/sidebar.js +0 -492
- package/dist/components/dist/skeleton.config.d.ts +0 -17
- package/dist/components/dist/skeleton.config.js +0 -10
- package/dist/components/dist/skeleton.d.ts +0 -28
- package/dist/components/dist/skeleton.js +0 -16
- package/dist/components/dist/slider.config.d.ts +0 -45
- package/dist/components/dist/slider.config.js +0 -40
- package/dist/components/dist/slider.d.ts +0 -71
- package/dist/components/dist/slider.js +0 -247
- package/dist/components/dist/spinner.config.d.ts +0 -35
- package/dist/components/dist/spinner.config.js +0 -24
- package/dist/components/dist/spinner.d.ts +0 -43
- package/dist/components/dist/spinner.js +0 -29
- package/dist/components/dist/svg.d.ts +0 -22
- package/dist/components/dist/svg.js +0 -17
- package/dist/components/dist/switch.config.d.ts +0 -354
- package/dist/components/dist/switch.config.js +0 -47
- package/dist/components/dist/switch.d.ts +0 -371
- package/dist/components/dist/switch.js +0 -32
- package/dist/components/dist/table.d.ts +0 -37
- package/dist/components/dist/table.js +0 -29
- package/dist/components/dist/tabs.config.d.ts +0 -612
- package/dist/components/dist/tabs.config.js +0 -56
- package/dist/components/dist/tabs.d.ts +0 -633
- package/dist/components/dist/tabs.js +0 -77
- package/dist/components/dist/text.config.d.ts +0 -307
- package/dist/components/dist/text.config.js +0 -149
- package/dist/components/dist/text.d.ts +0 -206
- package/dist/components/dist/text.js +0 -12
- package/dist/components/dist/textarea.config.d.ts +0 -353
- package/dist/components/dist/textarea.config.js +0 -57
- package/dist/components/dist/textarea.d.ts +0 -363
- package/dist/components/dist/textarea.js +0 -9
- package/dist/components/dist/toast.config.d.ts +0 -336
- package/dist/components/dist/toast.config.js +0 -145
- package/dist/components/dist/toast.d.ts +0 -427
- package/dist/components/dist/toast.js +0 -159
- package/dist/components/dist/tooltip.config.d.ts +0 -194
- package/dist/components/dist/tooltip.config.js +0 -40
- package/dist/components/dist/tooltip.d.ts +0 -207
- package/dist/components/dist/tooltip.js +0 -28
- package/dist/components/dist/vstack.d.ts +0 -16
- 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 -22
- package/dist/core/dist/compositeStyles.js +0 -51
- package/dist/core/dist/configurable-prop-helpers.d.ts +0 -32
- 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 -57
- package/dist/core/dist/createComponent.js +0 -67
- package/dist/core/dist/createComponentExample.d.ts +0 -42
- package/dist/core/dist/createComponentExample.js +0 -27
- package/dist/core/dist/createProvider.d.ts +0 -13
- package/dist/core/dist/createProvider.js +0 -24
- package/dist/core/dist/generated/stylePropsTwMap.d.ts +0 -1701
- package/dist/core/dist/generated/stylePropsTwMap.js +0 -570
- package/dist/core/dist/getComponentStyles.d.ts +0 -50
- package/dist/core/dist/getComponentStyles.js +0 -85
- package/dist/core/dist/getStyles.d.ts +0 -43
- 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 -13
- package/dist/core/dist/modifier-mappings.js +0 -61
- package/dist/core/dist/resolveMotionState.d.ts +0 -5
- 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 -33
- package/dist/core/dist/style-prop-data.js +0 -1257
- package/dist/core/dist/transformPreset.d.ts +0 -18
- package/dist/core/dist/transformPreset.js +0 -28
- package/dist/core/dist/withDefaultStyleProps.d.ts +0 -44
- 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 -1558
- 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 -13
- 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,9 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { CompositeRef, RegisteredComposites, StylePropRef } from "./component-refs.js";
|
|
2
|
+
import { SlotMotionConfig } from "./defineMotionConfig.js";
|
|
3
|
+
import { Props } from "./Props.js";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
import { CSSProperties, ReactNode } from "react";
|
|
6
|
+
import { ArbitraryValue, ModifierProp } from "@uds/types";
|
|
4
7
|
|
|
5
8
|
//#region ../config/dist/component-config.d.ts
|
|
6
9
|
//#region src/component-config.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Style values for a component-config slot. Accepts every registered
|
|
12
|
+
* style-prop name (per-app `RegisteredStyleProps` augmentation provides
|
|
13
|
+
* autocomplete), standard CSS properties (camelCase), and modifier
|
|
14
|
+
* objects (e.g. `_hover: { ... }`). Values are raw CSS strings, token
|
|
15
|
+
* literals, or `token('ns/name')` markers — not typed token names.
|
|
16
|
+
*/
|
|
17
|
+
type ComponentSlotStyles = { [K in Exclude<string | keyof CSSProperties, 'motion'>]?: string | number | boolean | TokenMarker | undefined } & { [K in ModifierProp]?: ComponentSlotStyles } & {
|
|
18
|
+
/** Per-slot motion config (JS runtime): co-located with slot styles. */motion?: SlotMotionConfig;
|
|
19
|
+
};
|
|
20
|
+
/** Allowed values for component slot motion in config objects. */
|
|
21
|
+
type ComponentMotionValue<TMotionAlias extends string = string> = SlotMotionConfig | TMotionAlias | ArbitraryValue;
|
|
7
22
|
/**
|
|
8
23
|
* HTML tag literal. The TypeScript type is `string` (any tag name);
|
|
9
24
|
* runtime renders it via `React.createElement(tag, ...)`.
|
|
@@ -13,54 +28,78 @@ import { ReactNode } from "react";
|
|
|
13
28
|
* autocomplete tag names from JSX.
|
|
14
29
|
*/
|
|
15
30
|
type HtmlTag = string;
|
|
31
|
+
/**
|
|
32
|
+
* Per-slot motion descriptor — same shape the legacy `base.<slot>.motion`
|
|
33
|
+
* carried, surfaced verbatim into the build-time manifest under
|
|
34
|
+
* `components.<Name>.motion.<slot>`. Codegen does not interpret the
|
|
35
|
+
* keys; the loader's `applySlotMotionToElement` reads them at JSX
|
|
36
|
+
* rewrite time, so adding a new field here automatically flows through
|
|
37
|
+
* once the loader picks it up.
|
|
38
|
+
*
|
|
39
|
+
* `runtime: 'css'` opts out — the loader's `getCustomSlotMotion` skips
|
|
40
|
+
* css-runtime entries (CSS keyframes are handled elsewhere).
|
|
41
|
+
*/
|
|
42
|
+
interface SlotMotion {
|
|
43
|
+
readonly runtime?: 'js' | 'css';
|
|
44
|
+
readonly initial?: unknown;
|
|
45
|
+
readonly animate?: unknown;
|
|
46
|
+
readonly exit?: unknown;
|
|
47
|
+
readonly transition?: unknown;
|
|
48
|
+
readonly whileHover?: unknown;
|
|
49
|
+
readonly whileTap?: unknown;
|
|
50
|
+
readonly drag?: unknown;
|
|
51
|
+
readonly dragConstraints?: unknown;
|
|
52
|
+
readonly dragElastic?: unknown;
|
|
53
|
+
readonly dragSnapToOrigin?: unknown;
|
|
54
|
+
readonly layout?: unknown;
|
|
55
|
+
}
|
|
16
56
|
/**
|
|
17
57
|
* Object form for a primitive (HTML-tag) layer that needs locked attrs
|
|
18
|
-
*
|
|
58
|
+
* (e.g. `role`, `aria-*`, locked `href`).
|
|
19
59
|
*
|
|
20
60
|
* Distributive mapped union over `keyof React.JSX.IntrinsicElements` so
|
|
21
61
|
* `attrs` is narrowed to the HTML props valid for the chosen `tag` at
|
|
22
62
|
* the call site — `{ tag: 'a', attrs: { href: '/x' } }` type-checks;
|
|
23
|
-
* `{ tag: 'div', attrs: { href: '/x' } }` does not.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
type PrimitiveLayer = { [T in keyof
|
|
29
|
-
tag: T;
|
|
30
|
-
attrs?: Partial<
|
|
31
|
-
|
|
32
|
-
* Default per-layer CSS declarations. Keys are style-prop names (or
|
|
33
|
-
* raw CSS properties when no registered style prop applies); values
|
|
34
|
-
* are token refs (`'{spacing/4}'`), alias names, or literal CSS.
|
|
35
|
-
* Modifier keys (`_hover`, `_focus`, `_dataDisabled`, ...) nest the
|
|
36
|
-
* same shape recursively. Codegen compiles this into a single
|
|
37
|
-
* `@utility componentName-layerName { ... }` block.
|
|
38
|
-
*/
|
|
39
|
-
defaultProps?: Record<string, unknown>;
|
|
40
|
-
} }[keyof React$1.JSX.IntrinsicElements];
|
|
63
|
+
* `{ tag: 'div', attrs: { href: '/x' } }` does not.
|
|
64
|
+
*
|
|
65
|
+
* Per-layer base styles live in the config's top-level
|
|
66
|
+
* `base: { <layer>: {...} }` block — not inside this object.
|
|
67
|
+
*/
|
|
68
|
+
type PrimitiveLayer = { [T in keyof _$react.JSX.IntrinsicElements]: {
|
|
69
|
+
tag: T;
|
|
70
|
+
attrs?: Partial<_$react.ComponentPropsWithoutRef<T>>;
|
|
71
|
+
} }[keyof _$react.JSX.IntrinsicElements];
|
|
41
72
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
73
|
+
* Structural shape of a `defineComponent` value as it appears in a
|
|
74
|
+
* `layers` slot. Mirrors `BoundComponent` from `defineComponent.ts` but
|
|
75
|
+
* defined locally to avoid the circular import (`defineComponent.ts`
|
|
76
|
+
* imports types from this file). Authors don't see this shape directly
|
|
77
|
+
* — they pass the actual `BoundComponent` value, which satisfies it.
|
|
47
78
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* that shape. Without registered components, the union is `never` (so
|
|
52
|
-
* package-internal authoring sites don't have to deal with this shape).
|
|
79
|
+
* The `__config` slot is the discriminator that distinguishes a
|
|
80
|
+
* composed-component layer from a plain function (which a layer can't
|
|
81
|
+
* be — guards on the layer position rely on this brand).
|
|
53
82
|
*/
|
|
54
|
-
type
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
83
|
+
type ComposedComponentValue = _$react.FC< // biome-ignore lint/suspicious/noExplicitAny: any registered component
|
|
84
|
+
any> & {
|
|
85
|
+
readonly __config: ComponentConfigValue<Record<string, LayerInput>, any, HtmlTag | undefined>;
|
|
86
|
+
};
|
|
58
87
|
/**
|
|
59
|
-
* Allowed forms for a single layer's value
|
|
60
|
-
*
|
|
61
|
-
*
|
|
88
|
+
* Allowed forms for a single layer's value:
|
|
89
|
+
*
|
|
90
|
+
* - **`HtmlTag`** — bare string (`'div'`, `'span'`, `'a'`, …) for
|
|
91
|
+
* plain HTML elements.
|
|
92
|
+
* - **`PrimitiveLayer`** — `{ tag, attrs }` object form for HTML
|
|
93
|
+
* layers that need locked attributes (`role`, `aria-*`, etc.).
|
|
94
|
+
* - **`ComposedComponentValue`** — a `defineComponent`-produced
|
|
95
|
+
* value (`Box`, `Pressable`, `Text`, …) used directly as the
|
|
96
|
+
* layer value.
|
|
97
|
+
*
|
|
98
|
+
* Per-layer base styles always live in the config's top-level
|
|
99
|
+
* `base: { <layer>: {...} }` block; consumer-facing JSX defaults go
|
|
100
|
+
* in `defaultProps: { <prop>: value }`.
|
|
62
101
|
*/
|
|
63
|
-
type LayerInput = HtmlTag |
|
|
102
|
+
type LayerInput = HtmlTag | PrimitiveLayer | ComposedComponentValue;
|
|
64
103
|
/**
|
|
65
104
|
* Bind a registered style prop to a specific layer. The style prop's
|
|
66
105
|
* resolved class name is added to that layer's `className` bundle at
|
|
@@ -78,19 +117,24 @@ interface StylePropBinding {
|
|
|
78
117
|
* Extract the root tag literal from a `layers` map when it can be read
|
|
79
118
|
* statically. Returns the string literal `'a' | 'div' | …` when:
|
|
80
119
|
*
|
|
81
|
-
* - `layers.root` is a bare tag string (`'a'`),
|
|
82
|
-
* - `layers.root` is `{ tag: 'a', attrs?: … }
|
|
120
|
+
* - `layers.root` is a bare tag string (`'a'`),
|
|
121
|
+
* - `layers.root` is `{ tag: 'a', attrs?: … }`, or
|
|
122
|
+
* - `layers.root` is a component value whose `__config` carries its
|
|
123
|
+
* own captured root tag (recurses one level so a wrapper of
|
|
124
|
+
* `defineComponent('button', …)` inherits `'button'`).
|
|
83
125
|
*
|
|
84
|
-
* Returns `undefined` when `layers.root` is a
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
126
|
+
* Returns `undefined` when `layers.root` is a composed-component layer
|
|
127
|
+
* without a captured tag, or not present. `Props<TConfig>` reads this
|
|
128
|
+
* and substitutes `React.ComponentPropsWithRef<TTag>` for the generic
|
|
129
|
+
* `HTMLAttributes<HTMLElement>` when narrowable.
|
|
88
130
|
*/
|
|
89
131
|
type RootTag<TLayers> = TLayers extends {
|
|
90
132
|
root: infer R;
|
|
91
133
|
} ? R extends HtmlTag ? R extends `{${string}}` ? undefined : R : R extends {
|
|
92
134
|
tag: infer T extends HtmlTag;
|
|
93
|
-
} ? T :
|
|
135
|
+
} ? T : R extends {
|
|
136
|
+
readonly __config: ComponentConfigValue<Record<string, LayerInput>, any, infer TInnerTag extends HtmlTag | undefined>;
|
|
137
|
+
} ? TInnerTag : undefined : undefined;
|
|
94
138
|
/**
|
|
95
139
|
* Bind a registered composite to a single layer. Multi-layer composites
|
|
96
140
|
* use the `CompositeBinding` shape instead (see below).
|
|
@@ -110,46 +154,168 @@ interface CompositeBinding {
|
|
|
110
154
|
layers: Record<string, string>;
|
|
111
155
|
}
|
|
112
156
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
|
|
117
|
-
|
|
157
|
+
* Boolean prop — toggled on/off, no value beyond presence. Useful for
|
|
158
|
+
* `loading`, `disabled`, `selected`. Each layer's bundle gets a
|
|
159
|
+
* data-attribute (`data-loading="true"`) the consumer can target.
|
|
160
|
+
*/
|
|
161
|
+
interface BoolMarker {
|
|
162
|
+
readonly __kind: 'bool';
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* String-valued prop — parallel to `bool()` but the JSX value is a
|
|
166
|
+
* string. Each layer's bundle gets `data-<kebab-name>="<value>"` at
|
|
167
|
+
* render time so CSS can target it (`[data-kind="primary"]`).
|
|
118
168
|
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
169
|
+
* Authored via `string()` in the `props` block — surfaces as a typed
|
|
170
|
+
* `string` prop at the JSX call site and as a text-input control in
|
|
171
|
+
* the Studio design panel (driven by the `__kind` discriminator).
|
|
122
172
|
*/
|
|
173
|
+
interface StringMarker {
|
|
174
|
+
readonly __kind: 'string';
|
|
175
|
+
}
|
|
123
176
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
177
|
+
* Style-prop binding marker — JSX value contributes one resolved
|
|
178
|
+
* utility class to a layer's bundle, looked up by `ref` in the
|
|
179
|
+
* registered style-prop registry. The `__kind` discriminator lets
|
|
180
|
+
* the design panel and codegen branch on prop kind by reading the
|
|
181
|
+
* marker shape directly.
|
|
126
182
|
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* • **ComposedLayer** (`{ component: '{Box}' }`) → one of the
|
|
130
|
-
* wrapped component's exposed JSX props (looked up against
|
|
131
|
-
* `RegisteredComponents['Box']`), so `{ layer: 'label', from:
|
|
132
|
-
* 'variant' }` only type-checks if Text registers `variant`.
|
|
133
|
-
* • **PrimitiveLayer / bare HTML tag** → any string (HTML attr or
|
|
134
|
-
* event name; type-precision here would require pulling
|
|
135
|
-
* `JSX.IntrinsicElements[tag]`, deferred).
|
|
183
|
+
* Authored via the `styleProp` helper passed into the
|
|
184
|
+
* `defineComponent` callback. Two forms:
|
|
136
185
|
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
186
|
+
* styleProp('bg') // root layer, shorthand
|
|
187
|
+
* styleProp('label', 'color') // explicit layer
|
|
139
188
|
*/
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
189
|
+
interface StylePropMarker<TLayer extends string = string, TRef extends string = string> {
|
|
190
|
+
readonly __kind: 'styleProp';
|
|
191
|
+
readonly layer: TLayer;
|
|
192
|
+
readonly ref: TRef;
|
|
193
|
+
/**
|
|
194
|
+
* Re-target the marker to a different layer. Returns a fresh marker
|
|
195
|
+
* carrying the same `ref` but with `layer` set to `name`:
|
|
196
|
+
*
|
|
197
|
+
* styleProp('color').on('label')
|
|
198
|
+
* // → { __kind: 'styleProp', ref: 'color', layer: 'label' }
|
|
199
|
+
*/
|
|
200
|
+
on<TNewLayer extends string>(name: TNewLayer): StylePropMarker<TNewLayer, TRef>;
|
|
201
|
+
}
|
|
146
202
|
/**
|
|
147
|
-
*
|
|
148
|
-
* `
|
|
149
|
-
*
|
|
203
|
+
* Token-reference marker for use inside style values (`base`, `enums`,
|
|
204
|
+
* `compoundProps`). The value tells codegen "look up the token at
|
|
205
|
+
* path `<namespace>/<name>`" — it resolves to `var(--<prefix>-<ns>-<name>)`
|
|
206
|
+
* at build time. The `__kind` discriminator lets the design panel
|
|
207
|
+
* detect a token reference and offer a token picker.
|
|
208
|
+
*
|
|
209
|
+
* Authored via the `token(...)` helper:
|
|
210
|
+
*
|
|
211
|
+
* base: { root: { bg: token('bg/brand') } }
|
|
150
212
|
*/
|
|
151
|
-
interface
|
|
152
|
-
readonly __kind: '
|
|
213
|
+
interface TokenMarker<TRef extends string = string> {
|
|
214
|
+
readonly __kind: 'token';
|
|
215
|
+
readonly ref: TRef;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Token-group reference marker for `defineStyleProp({ values: [...] })`
|
|
219
|
+
* entries. Tells the resolver "every token in this namespace is a
|
|
220
|
+
* valid value for this style prop" — so `tokenGroup('spacing')` on a
|
|
221
|
+
* `padding` prop pulls in `spacing/1`, `spacing/2`, … as accepted
|
|
222
|
+
* values that map to `p-1`, `p-2`, … utility classes.
|
|
223
|
+
*
|
|
224
|
+
* Authored via the `tokenGroup(...)` helper.
|
|
225
|
+
*/
|
|
226
|
+
interface TokenGroupMarker<TGroup extends string = string> {
|
|
227
|
+
readonly __kind: 'tokenGroup';
|
|
228
|
+
readonly group: TGroup;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Slot prop — JSX-prop that accepts a `ReactNode` and routes it onto a
|
|
232
|
+
* named layer's bundle. Authored via `slot('layerName')` in the
|
|
233
|
+
* `props` block:
|
|
234
|
+
*
|
|
235
|
+
* defineComponent({
|
|
236
|
+
* layers: { root: 'div', title: 'div', content: 'div' },
|
|
237
|
+
* props: {
|
|
238
|
+
* title: slot('title'),
|
|
239
|
+
* content: slot('content'),
|
|
240
|
+
* },
|
|
241
|
+
* }).render(({ props, children }) => (
|
|
242
|
+
* <div {...props.root}>
|
|
243
|
+
* <div {...props.title} /> // renders the `title` JSX prop
|
|
244
|
+
* <div {...props.content} /> // renders the `content` JSX prop
|
|
245
|
+
* {children}
|
|
246
|
+
* </div>
|
|
247
|
+
* ));
|
|
248
|
+
*
|
|
249
|
+
* **Children routing (default).** Without `as`, the runtime puts the
|
|
250
|
+
* incoming value on `bundles[layer].children`, so spreading the layer
|
|
251
|
+
* bundle places the children automatically.
|
|
252
|
+
*
|
|
253
|
+
* **Named-prop routing (`{ as }`).** With `as: 'propName'`, the runtime
|
|
254
|
+
* puts the value on `bundles[layer][propName]` instead — useful when
|
|
255
|
+
* the layer is a composed component that already exposes its own
|
|
256
|
+
* named slots (`startContent`, `endContent`, …). Lets a wrapper like
|
|
257
|
+
* `EnhancedCard` declare its own JSX prop that forwards into the
|
|
258
|
+
* wrapped `Card`'s slot surface:
|
|
259
|
+
*
|
|
260
|
+
* const EnhancedCard = defineComponent({
|
|
261
|
+
* layers: { root: Card }, // Card as a layer
|
|
262
|
+
* props: {
|
|
263
|
+
* headline: slot('root', { as: 'startContent' }), // → Card.startContent
|
|
264
|
+
* cta: slot('root', { as: 'endContent' }), // → Card.endContent
|
|
265
|
+
* },
|
|
266
|
+
* });
|
|
267
|
+
*
|
|
268
|
+
* Codegen treats slot props as the canonical signal of named slots:
|
|
269
|
+
* each `slot()` entry in a `props` block becomes both a `ReactNode`
|
|
270
|
+
* prop in the catalog (typed as `string | { $slot: elementKey }` in
|
|
271
|
+
* json-render) AND adds the JSX-prop key to the prompt's
|
|
272
|
+
* `[slots: ...]` tag. Replaces the verbose `{ layer, from: 'children' }`
|
|
273
|
+
* forward binding for the common ReactNode-into-layer case.
|
|
274
|
+
*/
|
|
275
|
+
interface SlotMarker<TLayer extends string = '', TProp extends string = 'children'> {
|
|
276
|
+
readonly __kind: 'slot';
|
|
277
|
+
/**
|
|
278
|
+
* Target layer the incoming JSX value routes onto. Empty string
|
|
279
|
+
* (`slot()` with no path) means the value is *not* routed — the
|
|
280
|
+
* marker just declares the JSX-prop key + types it as
|
|
281
|
+
* `ReactNode`; the render function receives the value verbatim in
|
|
282
|
+
* its args.
|
|
283
|
+
*/
|
|
284
|
+
readonly layer: TLayer;
|
|
285
|
+
/**
|
|
286
|
+
* Target prop name on the layer's bundle. Defaults to `'children'`,
|
|
287
|
+
* which is what most slots want (the value lands as the layer
|
|
288
|
+
* element's children). Set to a different name to route into
|
|
289
|
+
* arbitrary props on the target layer's surface (`onClick`,
|
|
290
|
+
* `aria-label`, `startContent`, …).
|
|
291
|
+
*/
|
|
292
|
+
readonly prop?: TProp;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Composite-style prop — the JSX value picks one entry from a
|
|
296
|
+
* registered composite group's `styles` map. The runtime expands
|
|
297
|
+
* the matched style bag into the layer's bundle and emits a marker
|
|
298
|
+
* class. Implicit `'root'` layer target.
|
|
299
|
+
*
|
|
300
|
+
* Authored via `composite('textVariant')` (bare name — narrowed
|
|
301
|
+
* against the registered composite names) in the `props` block:
|
|
302
|
+
*
|
|
303
|
+
* defineComponent(Box, {
|
|
304
|
+
* defaultProps: { as: 'p' },
|
|
305
|
+
* props: {
|
|
306
|
+
* variant: composite('textVariant'),
|
|
307
|
+
* },
|
|
308
|
+
* });
|
|
309
|
+
*
|
|
310
|
+
* For multi-layer composites or non-root layer targets, use the
|
|
311
|
+
* verbose `{ composite: '{ref}', layers: {...} }` /
|
|
312
|
+
* `{ layer: 'X', composite: '{ref}' }` binding shapes directly (the
|
|
313
|
+
* verbose forms keep the brace-ref shape for consistency with
|
|
314
|
+
* style-prop refs).
|
|
315
|
+
*/
|
|
316
|
+
interface CompositeMarker<TRef extends string = string> {
|
|
317
|
+
readonly __kind: 'composite';
|
|
318
|
+
readonly ref: TRef;
|
|
153
319
|
}
|
|
154
320
|
/**
|
|
155
321
|
* Enum prop — the value picks one entry from a map. Each entry can
|
|
@@ -173,19 +339,14 @@ interface EnumMarker<TValues extends Record<string, unknown>> {
|
|
|
173
339
|
*/
|
|
174
340
|
type StylePropShorthand = StylePropRef;
|
|
175
341
|
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* `
|
|
179
|
-
* `
|
|
180
|
-
* `
|
|
181
|
-
*
|
|
182
|
-
* Generic over `TLayers` so `TypedForwardBinding` can narrow the
|
|
183
|
-
* `layer` + `from` fields against the component's own layer map.
|
|
184
|
-
* Consumers that don't know the layer map (read-side helpers,
|
|
185
|
-
* `bindRender`) parameterize with the wide default
|
|
186
|
-
* `Record<string, LayerInput>` and get the loose `ForwardBinding`.
|
|
342
|
+
* Every allowed shape for a single entry in a `props` block. Each
|
|
343
|
+
* shape comes from a marker helper (`styleProp`, `slot`, `bool`,
|
|
344
|
+
* `string`, `enums`, `composite`) and carries an introspectable
|
|
345
|
+
* `__kind` discriminator. `TLayers` parameterizes the layer-bound
|
|
346
|
+
* markers (`slot('layer/prop')`, `styleProp('bg').on('layer')`) so
|
|
347
|
+
* typos in layer names surface at the authoring site.
|
|
187
348
|
*/
|
|
188
|
-
type VerbosePropBinding<TLayers extends Record<string, LayerInput> = Record<string, LayerInput>> = StylePropBinding | SingleLayerCompositeBinding | CompositeBinding |
|
|
349
|
+
type VerbosePropBinding<TLayers extends Record<string, LayerInput> = Record<string, LayerInput>> = StylePropMarker<keyof TLayers & string, string> | StylePropBinding | SingleLayerCompositeBinding | CompositeBinding | CompositeMarker | BoolMarker | StringMarker | EnumMarker<any> | SlotMarker<(keyof TLayers & string) | '', string>;
|
|
189
350
|
/**
|
|
190
351
|
* All allowed shapes for a single entry in the primitive form's `props`
|
|
191
352
|
* block. Primitive form adds the `StylePropShorthand` brace-ref
|
|
@@ -207,93 +368,259 @@ type PropBinding<TLayers extends Record<string, LayerInput> = Record<string, Lay
|
|
|
207
368
|
* loading: bool(),
|
|
208
369
|
* disabled: bool(),
|
|
209
370
|
* }
|
|
371
|
+
*
|
|
372
|
+
* Drives both the TS type (consumer sees `loading?: boolean`) and the
|
|
373
|
+
* Studio design panel control (toggle).
|
|
210
374
|
*/
|
|
375
|
+
declare function bool(): BoolMarker;
|
|
211
376
|
/**
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
* set of values to iterate over and so aren't valid axes.
|
|
377
|
+
* Marker for a string-valued JSX prop. Parallel to `bool()` — emits
|
|
378
|
+
* `data-<kebab-name>="<value>"` on each layer's bundle so CSS can
|
|
379
|
+
* target the rendered value. Use inside the `props` block:
|
|
216
380
|
*
|
|
217
|
-
*
|
|
381
|
+
* props: {
|
|
382
|
+
* kind: string(),
|
|
383
|
+
* tone: string(),
|
|
384
|
+
* }
|
|
385
|
+
*
|
|
386
|
+
* Drives both the TS type (consumer sees `kind?: string`) and the
|
|
387
|
+
* Studio design panel control (text input).
|
|
218
388
|
*/
|
|
219
|
-
|
|
389
|
+
declare function string(): StringMarker;
|
|
220
390
|
/**
|
|
221
|
-
*
|
|
391
|
+
* Bind a registered style prop. Single string arg defaults to the
|
|
392
|
+
* root layer; chain `.on(layerName)` to target a non-root layer:
|
|
222
393
|
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
394
|
+
* props: {
|
|
395
|
+
* bg: styleProp('bg'), // root layer
|
|
396
|
+
* textColor: styleProp('color').on('label'), // label layer
|
|
397
|
+
* }
|
|
225
398
|
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
399
|
+
* The `__kind: 'styleProp'` discriminator lets the design panel render
|
|
400
|
+
* a color/token picker (driven by the registered style prop's value
|
|
401
|
+
* space) and lets codegen scan props uniformly off the marker shape.
|
|
402
|
+
*/
|
|
403
|
+
declare function styleProp<TRef extends string>(ref: TRef): StylePropMarker<'root', TRef>;
|
|
404
|
+
/**
|
|
405
|
+
* Token-reference marker for style values. Use inside `base`, enum
|
|
406
|
+
* entries, and `compoundProps` overrides:
|
|
232
407
|
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
408
|
+
* base: { root: { bg: token('bg/brand') } }
|
|
409
|
+
* props: {
|
|
410
|
+
* variant: enums({
|
|
411
|
+
* brand: { root: { color: token('color/on-brand') } },
|
|
412
|
+
* }),
|
|
413
|
+
* }
|
|
235
414
|
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
|
|
415
|
+
* Codegen and runtime detect the `__kind: 'token'` discriminator and
|
|
416
|
+
* resolve the `ref` to `var(--<prefix>-<ns>-<name>)`. The design
|
|
417
|
+
* panel uses the same discriminator to offer a token picker.
|
|
418
|
+
*/
|
|
419
|
+
declare function token<TRef extends string>(ref: TRef): TokenMarker<TRef>;
|
|
420
|
+
/**
|
|
421
|
+
* Token-group reference for `defineStyleProp({ values: [...] })`. Pulls
|
|
422
|
+
* every token in the named namespace into the style prop's accepted
|
|
423
|
+
* value set. The resolver expands the group at registration time:
|
|
424
|
+
*
|
|
425
|
+
* defineStyleProp({
|
|
426
|
+
* cssProperty: 'padding',
|
|
427
|
+
* classPrefix: 'p',
|
|
428
|
+
* values: [tokenGroup('spacing')], // → p-1, p-2, p-3, …
|
|
429
|
+
* })
|
|
240
430
|
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* stays consistent across components.
|
|
431
|
+
* The `__kind: 'tokenGroup'` discriminator lets codegen and the design
|
|
432
|
+
* panel branch on group references without parsing strings.
|
|
244
433
|
*/
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
434
|
+
declare function tokenGroup<TGroup extends string>(group: TGroup): TokenGroupMarker<TGroup>;
|
|
435
|
+
/**
|
|
436
|
+
* Marker for an enum-valued JSX prop. Each value maps to a per-layer
|
|
437
|
+
* style override. Use inside the `props` block:
|
|
438
|
+
*
|
|
439
|
+
* props: {
|
|
440
|
+
* variant: enums({
|
|
441
|
+
* brand: { root: { bg: '{bg/brand}', color: '{color/on-brand}' } },
|
|
442
|
+
* ghost: { root: { color: '{color/on-primary}' } },
|
|
443
|
+
* }),
|
|
444
|
+
* }
|
|
445
|
+
*
|
|
446
|
+
* The shape of each value mirrors a partial layer-style map keyed by
|
|
447
|
+
* the component's own layer names.
|
|
448
|
+
*/
|
|
449
|
+
declare function enums<const TValues extends Record<string, unknown>>(values: TValues): EnumMarker<TValues>;
|
|
450
|
+
/**
|
|
451
|
+
* Marker for a composite-style JSX prop. The JSX value picks one
|
|
452
|
+
* entry from the referenced composite group's `styles` map; the
|
|
453
|
+
* runtime expands the matched style bag onto the root layer's bundle
|
|
454
|
+
* and emits a marker class.
|
|
455
|
+
*
|
|
456
|
+
* // packages/.../text-variant.ts
|
|
457
|
+
* export const textVariant = defineCompositeStyle({
|
|
458
|
+
* label: 'Text Variant',
|
|
459
|
+
* styles: {
|
|
460
|
+
* body: { fontSize: '[1rem]', fontWeight: 'normal' },
|
|
461
|
+
* heading: { fontSize: '[1.5rem]', fontWeight: 'bold' },
|
|
462
|
+
* },
|
|
463
|
+
* });
|
|
464
|
+
*
|
|
465
|
+
* // apps/<consumer>/uds.config.ts
|
|
466
|
+
* udsBuilder.registerComposites({ textVariant });
|
|
467
|
+
*
|
|
468
|
+
* // The component:
|
|
469
|
+
* export const Text = defineComponent(Box, {
|
|
470
|
+
* defaultProps: { as: 'p' },
|
|
471
|
+
* props: {
|
|
472
|
+
* variant: composite('textVariant'),
|
|
473
|
+
* },
|
|
474
|
+
* });
|
|
475
|
+
*
|
|
476
|
+
* Argument is the bare composite name (no `{...}` brace wrapping) —
|
|
477
|
+
* the `composite()` function's position already establishes the
|
|
478
|
+
* composite-ref context, so the braces would be redundant. Authoring
|
|
479
|
+
* sites type-narrow `ref` against `keyof RegisteredComposites` so
|
|
480
|
+
* typos surface as compile errors.
|
|
481
|
+
*
|
|
482
|
+
* Layer target is implicit `'root'`. For multi-layer composite
|
|
483
|
+
* bindings or non-root layer targets, drop down to the verbose
|
|
484
|
+
* `{ layer: 'X', composite: '{ref}' }` /
|
|
485
|
+
* `{ composite: '{ref}', layers: {...} }` shapes (those keep the
|
|
486
|
+
* brace-ref form for consistency with style-prop refs).
|
|
487
|
+
*/
|
|
488
|
+
type CompositeName = [keyof RegisteredComposites] extends [never] ? string : keyof RegisteredComposites & string;
|
|
489
|
+
declare function composite<TRef extends CompositeName>(ref: TRef): CompositeMarker<TRef>;
|
|
258
490
|
/**
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
491
|
+
* Splits a `'layer/prop'` slot path into its two segments. Mirrors the
|
|
492
|
+
* `{namespace/name}` token-ref convention — the slash is the delimiter
|
|
493
|
+
* and the second segment is the target prop on the layer's bundle.
|
|
494
|
+
* When no slash is present, the path is a bare layer name and the
|
|
495
|
+
* target prop defaults to `'children'`.
|
|
496
|
+
*/
|
|
497
|
+
type SplitSlotPath<T extends string> = T extends `${infer L}/${infer A}` ? [L, A] : [T, 'children'];
|
|
498
|
+
/**
|
|
499
|
+
* Marker for a layer-targeted JSX-prop binding. Routes the incoming
|
|
500
|
+
* JSX value into `bundles[layer][prop]` at render time. The prop's
|
|
501
|
+
* TS value type is inferred from the target layer's surface — see
|
|
502
|
+
* `SlotPropValue` in `Props.ts`.
|
|
503
|
+
*
|
|
504
|
+
* Authoring forms:
|
|
262
505
|
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
* component can declare both without conflict.
|
|
506
|
+
* - **Canonical: `slot('layer/prop')`** — slash-separated path. The
|
|
507
|
+
* first segment names a declared layer; the second names the prop
|
|
508
|
+
* on that layer's bundle where the JSX value lands.
|
|
267
509
|
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
510
|
+
* props: {
|
|
511
|
+
* title: slot('triggerText/children'), // → Text.children
|
|
512
|
+
* onClick: slot('button/onClick'), // → button's onClick
|
|
513
|
+
* headline: slot('root/startContent'), // → Card.startContent
|
|
514
|
+
* }
|
|
515
|
+
*
|
|
516
|
+
* - **Sugar: `slot('layer')`** — equivalent to `slot('layer/children')`.
|
|
517
|
+
*
|
|
518
|
+
* - **Object form: `slot('layer', { prop: 'name' })`** — same as
|
|
519
|
+
* `slot('layer/name')` but reads better when `name` is a long
|
|
520
|
+
* identifier or contains characters the slash form can't carry.
|
|
521
|
+
*
|
|
522
|
+
* - **No-arg: `slot()`** — type-only declaration. The JSX value is
|
|
523
|
+
* typed as `ReactNode` and flows through to the render fn's args
|
|
524
|
+
* verbatim (no layer routing). Use for `children: slot()` to
|
|
525
|
+
* declare children without routing them to a specific layer.
|
|
526
|
+
*
|
|
527
|
+
* The marker is the canonical signal — to codegen and to json-render
|
|
528
|
+
* — that this JSX prop is a named slot.
|
|
270
529
|
*/
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
530
|
+
declare function slot(): SlotMarker<'', 'children'>;
|
|
531
|
+
declare function slot<const TPath extends string>(path: TPath): SlotMarker<SplitSlotPath<TPath>[0], SplitSlotPath<TPath>[1]>;
|
|
532
|
+
declare function slot<const TLayer extends string, const TProp extends string>(layer: TLayer, options: {
|
|
533
|
+
prop: TProp;
|
|
534
|
+
}): SlotMarker<TLayer, TProp>;
|
|
274
535
|
/**
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
536
|
+
* Per-layer override shape, narrowed by the layer's declared form.
|
|
537
|
+
*
|
|
538
|
+
* Same shape as a single enum-value's per-layer style map — registered
|
|
539
|
+
* style props, CSS properties, and `_hover`/`_focus`/etc. modifier
|
|
540
|
+
* keys. Uniform across all layer forms (HTML tag, PrimitiveLayer, and
|
|
541
|
+
* ComposedLayer) because `ComposedLayer.defaultProps` is also
|
|
542
|
+
* `Record<string, unknown>` and narrowing here would over-constrain
|
|
543
|
+
* authoring relative to the layer's own surface.
|
|
279
544
|
*
|
|
280
|
-
*
|
|
545
|
+
* Authors use `hidden()` (a sibling marker) to hide a layer entirely;
|
|
546
|
+
* style-map values never carry the `hidden` flag inline.
|
|
547
|
+
*/
|
|
548
|
+
type LayerOverride = ComponentSlotStyles;
|
|
549
|
+
/**
|
|
550
|
+
* Marker that hides an entire layer when the parent `compoundProps`
|
|
551
|
+
* entry matches. Separated from the style-map shape so authors don't
|
|
552
|
+
* mix structural visibility with style overrides inline.
|
|
553
|
+
*
|
|
554
|
+
* V1 `applyCompoundProps` translates a hidden layer to `display: none`
|
|
555
|
+
* on the resolved bundle — the DOM node still renders; see UDS-1631's
|
|
556
|
+
* open questions for the "strip entirely" follow-up.
|
|
557
|
+
*/
|
|
558
|
+
interface HiddenMarker {
|
|
559
|
+
readonly __kind: 'hidden';
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Marker factory — use inside `compoundProps[].layers.<layer>` to hide
|
|
563
|
+
* a layer entirely when the entry's `when` clause matches.
|
|
564
|
+
*
|
|
565
|
+
* compoundProps: [
|
|
281
566
|
* {
|
|
282
|
-
*
|
|
283
|
-
*
|
|
567
|
+
* when: { variant: 'compact' },
|
|
568
|
+
* layers: { endIcon: hidden() },
|
|
284
569
|
* },
|
|
285
570
|
* ]
|
|
571
|
+
*/
|
|
572
|
+
declare function hidden(): HiddenMarker;
|
|
573
|
+
/**
|
|
574
|
+
* Names of prop bindings that participate in `when` clauses — i.e.
|
|
575
|
+
* props authored as `enums({...})` or `bool()`. Other bindings (style
|
|
576
|
+
* props, forwards, composites) don't have a fixed enumerable value set
|
|
577
|
+
* and so aren't valid `when` keys. File-private — re-inlined here
|
|
578
|
+
* after the original `IterableAxisOf` was removed from the public
|
|
579
|
+
* surface along with the matrix-examples API.
|
|
580
|
+
*/
|
|
581
|
+
type IterableAxisOf<TProps> = { [K in keyof TProps]: TProps[K] extends EnumMarker<Record<string, unknown>> | BoolMarker ? K : never }[keyof TProps] & string;
|
|
582
|
+
/**
|
|
583
|
+
* Resolve the legal value set for an iteration axis. `enums({...})` →
|
|
584
|
+
* the union of value keys; `bool()` → `boolean`. Used to narrow per-
|
|
585
|
+
* coord values in `compoundProps.when`. File-private (see `IterableAxisOf`).
|
|
586
|
+
*/
|
|
587
|
+
type PropValuesOf<TBinding> = TBinding extends EnumMarker<infer TValues> ? keyof TValues & string : TBinding extends BoolMarker ? boolean : never;
|
|
588
|
+
/**
|
|
589
|
+
* A `compoundProps` `when` clause: partial map of iterable-axis prop
|
|
590
|
+
* names → required value. All listed keys must match the active props
|
|
591
|
+
* for the entry to apply. Keys narrow to enum/bool bindings only — so
|
|
592
|
+
* non-enum/non-bool props (style props, forwards, composites) are a
|
|
593
|
+
* type error at the authoring site. Values narrow to declared enum
|
|
594
|
+
* keys or `boolean`.
|
|
595
|
+
*/
|
|
596
|
+
type WhenClause<TProps> = { [K in IterableAxisOf<TProps>]?: K extends keyof TProps ? PropValuesOf<TProps[K]> : never };
|
|
597
|
+
/**
|
|
598
|
+
* A single `compoundProps` entry — applies per-layer overrides when
|
|
599
|
+
* *all* `when` keys match the active prop values.
|
|
286
600
|
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
601
|
+
* compoundProps: [
|
|
602
|
+
* {
|
|
603
|
+
* when: { variant: 'secondary', textVariant: 'legal1' },
|
|
604
|
+
* layers: {
|
|
605
|
+
* root: { color: '{color/tertiary}' },
|
|
606
|
+
* endIcon: hidden(),
|
|
607
|
+
* },
|
|
608
|
+
* },
|
|
609
|
+
* ]
|
|
610
|
+
*
|
|
611
|
+
* Multiple entries can match a given combination — specificity (number
|
|
612
|
+
* of keys in `when`) decides who wins per layer-property pair; ties
|
|
613
|
+
* break by source order (later wins).
|
|
293
614
|
*/
|
|
294
|
-
interface
|
|
295
|
-
|
|
296
|
-
|
|
615
|
+
interface CompoundPropsEntry<TLayers extends Record<string, LayerInput>, TProps extends Record<string, unknown> = Record<string, unknown>> {
|
|
616
|
+
when: WhenClause<TProps>;
|
|
617
|
+
/**
|
|
618
|
+
* Per-layer overrides. Style maps narrow against `ComponentSlotStyles`
|
|
619
|
+
* (registered style props + CSS properties + modifier keys); use
|
|
620
|
+
* `hidden()` to hide a layer entirely. Layer keys narrow to the
|
|
621
|
+
* component's declared layer names.
|
|
622
|
+
*/
|
|
623
|
+
layers: { [K in keyof TLayers & string]?: LayerOverride | HiddenMarker };
|
|
297
624
|
}
|
|
298
625
|
/**
|
|
299
626
|
* The architecture-doc-target component config. Distinct from today's
|
|
@@ -304,6 +631,149 @@ interface CompoundVariant {
|
|
|
304
631
|
* narrow their `layer` field against the component's actual layer
|
|
305
632
|
* names; typos surface at the authoring site.
|
|
306
633
|
*/
|
|
634
|
+
/**
|
|
635
|
+
* Static, always-on per-layer styles + props for verbose-form
|
|
636
|
+
* `defineComponent({...})`. Keyed by layer name — each value is
|
|
637
|
+
* `Partial<Props<TLayer>>` where `TLayer` is the layer's resolved
|
|
638
|
+
* component (Box / Pressable / Text / …). Mirrors the legacy
|
|
639
|
+
* `defineComponents({ <Name>: { base: { <slot>: {...} } } })`
|
|
640
|
+
* shape — `base` styles are unconditional, contrasted with the
|
|
641
|
+
* `props` block where `enums()` / `composite()` / style-prop
|
|
642
|
+
* bindings associate styles with consumer-controllable values.
|
|
643
|
+
*
|
|
644
|
+
* defineComponent({
|
|
645
|
+
* layers: { trigger: { component: Pressable } },
|
|
646
|
+
* base: {
|
|
647
|
+
* trigger: { padding: '4' }, // ✗ ERROR — Pressable exposes `spacing`, not `padding`
|
|
648
|
+
* trigger: { spacing: '4' }, // ✓
|
|
649
|
+
* },
|
|
650
|
+
* });
|
|
651
|
+
*
|
|
652
|
+
* Composed-component layers narrow to the wrapped component's prop
|
|
653
|
+
* surface via `Props<TLayer['__config']>` — catches style-prop typos
|
|
654
|
+
* at the authoring site. Bare-tag layers (`'div'`) fall back to
|
|
655
|
+
* `Record<string, unknown>` since they don't have a component-side
|
|
656
|
+
* prop registry; those layers' styles go through `prepareCss` as
|
|
657
|
+
* `@utility` CSS rules instead.
|
|
658
|
+
*
|
|
659
|
+
* `base[<layer>].as` on a composed layer overrides the layer's
|
|
660
|
+
* rendered tag (mirroring the existing primitive-form behavior).
|
|
661
|
+
*/
|
|
662
|
+
/**
|
|
663
|
+
* Resolves the accepted JSX-value shape for a single prop binding —
|
|
664
|
+
* what `defaultProps` for that binding should be typed as.
|
|
665
|
+
*
|
|
666
|
+
* - `EnumMarker` → the union of declared value keys.
|
|
667
|
+
* - `BoolMarker` → `boolean`.
|
|
668
|
+
* - `CompositeMarker` → registered composite-value keys (loosely
|
|
669
|
+
* typed `string` here; consumer apps' augmentation refines it).
|
|
670
|
+
* - `SlotMarker` → `ReactNode` (slot-position values).
|
|
671
|
+
* - `BoolMarker` etc. follow.
|
|
672
|
+
* - Style-prop bindings (`'{bg}'` shorthand or
|
|
673
|
+
* `{ layer, styleProp: '{bg}' }`) → string (the resolved token
|
|
674
|
+
* or alias name; precise narrowing happens at the consumer's
|
|
675
|
+
* augmented-types boundary).
|
|
676
|
+
* - Everything else → `unknown`.
|
|
677
|
+
*/
|
|
678
|
+
type BindingValueType<T> = T extends EnumMarker<infer V> ? keyof V & string : T extends BoolMarker ? boolean : T extends StringMarker ? string : T extends StylePropMarker ? string : T extends CompositeMarker ? string : T extends SlotMarker ? _$react.ReactNode : T extends string ? string : T extends {
|
|
679
|
+
readonly styleProp: string;
|
|
680
|
+
} ? string : unknown;
|
|
681
|
+
/**
|
|
682
|
+
* `defaultProps` for verbose-form `defineComponent({...})` —
|
|
683
|
+
* type-narrowed against the keys + binding values declared in the
|
|
684
|
+
* `props` block. Catches typos / wrong-value assignments at the
|
|
685
|
+
* authoring site:
|
|
686
|
+
*
|
|
687
|
+
* props: {
|
|
688
|
+
* variant: enums({ brand: {...}, ghost: {...} }),
|
|
689
|
+
* loading: bool(),
|
|
690
|
+
* },
|
|
691
|
+
* defaultProps: {
|
|
692
|
+
* variant: 'brand', // ✓
|
|
693
|
+
* variant: 'extra', // ✗ — not a declared enum value
|
|
694
|
+
* loading: false, // ✓
|
|
695
|
+
* typo: 'foo', // ✗ — not a declared prop key
|
|
696
|
+
* }
|
|
697
|
+
*/
|
|
698
|
+
type BindingValueDefaults<TProps> = { [K in keyof TProps]?: BindingValueType<TProps[K]> };
|
|
699
|
+
type LayerBaseStyles<TLayers extends Record<string, LayerInput>> = { [K in keyof TLayers]?: TLayers[K] extends {
|
|
700
|
+
readonly __config: infer TLayerConfig;
|
|
701
|
+
} ? TLayerConfig extends ComponentConfigValue<Record<string, LayerInput>, any, HtmlTag | undefined> ? Partial<Props<TLayerConfig>> : Record<string, unknown> : Record<string, unknown> };
|
|
702
|
+
/**
|
|
703
|
+
* Per-layer motion descriptors for verbose-form
|
|
704
|
+
* `defineComponent({...})`. Keyed by layer name; each value is a
|
|
705
|
+
* {@link SlotMotion} (framer-motion `initial`/`animate`/`exit`/
|
|
706
|
+
* `transition`/etc. shape). Codegen surfaces these into the manifest
|
|
707
|
+
* under `components.<Name>.motion.<slot>` and uses them to rewrite
|
|
708
|
+
* the slot's JSX into a motion-wrapped element at build time —
|
|
709
|
+
* `<Box {...props.icon}>` becomes `<motion.create(Box) ...>` and
|
|
710
|
+
* conditional renders are wrapped in `<AnimatePresence>` when
|
|
711
|
+
* `exit` is set.
|
|
712
|
+
*/
|
|
713
|
+
type LayerMotion<TLayers extends Record<string, LayerInput>> = { [K in keyof TLayers]?: SlotMotion };
|
|
714
|
+
interface ComponentConfigInput<TLayers extends Record<string, LayerInput>, TProps extends Record<string, VerbosePropBinding<TLayers>> = Record<string, VerbosePropBinding<TLayers>>> {
|
|
715
|
+
layers: TLayers;
|
|
716
|
+
props?: TProps;
|
|
717
|
+
/**
|
|
718
|
+
* Static per-layer styles + props applied unconditionally to every
|
|
719
|
+
* render. Each key is a layer name from `layers`; each value is
|
|
720
|
+
* `Partial<Props<that-layer's-component>>`. See {@link LayerBaseStyles}.
|
|
721
|
+
*
|
|
722
|
+
* base: {
|
|
723
|
+
* root: { borderWidth: 'thin', bg: 'primary' },
|
|
724
|
+
* trigger: { spacing: '4', _hover: { bg: 'tertiary' } },
|
|
725
|
+
* }
|
|
726
|
+
*
|
|
727
|
+
* Variant-controlled styles (per consumer JSX value) go through
|
|
728
|
+
* `enums()` / `composite()` / style-prop bindings in the `props`
|
|
729
|
+
* block. `base` is the always-on foundation; `props` adds
|
|
730
|
+
* value-driven overrides on top.
|
|
731
|
+
*
|
|
732
|
+
* Type-checked per layer — typos on composed layers surface as TS
|
|
733
|
+
* errors at the authoring site.
|
|
734
|
+
*/
|
|
735
|
+
base?: LayerBaseStyles<TLayers>;
|
|
736
|
+
/**
|
|
737
|
+
* Default values for the consumer-controllable JSX props declared
|
|
738
|
+
* in the `props` block. Keys narrow against `keyof TProps`; values
|
|
739
|
+
* narrow against each binding's accepted shape (enum keys for
|
|
740
|
+
* `enums()`, composite values for `composite()`, registered tokens
|
|
741
|
+
* for style-prop bindings, `boolean` for `bool()`).
|
|
742
|
+
*
|
|
743
|
+
* props: {
|
|
744
|
+
* variant: enums({ brand: {...}, ghost: {...} }),
|
|
745
|
+
* loading: bool(),
|
|
746
|
+
* },
|
|
747
|
+
* defaultProps: {
|
|
748
|
+
* variant: 'brand', // narrows to `keyof enum.values`
|
|
749
|
+
* loading: false,
|
|
750
|
+
* typo: '...', // ✗ ERROR — not a declared prop
|
|
751
|
+
* }
|
|
752
|
+
*/
|
|
753
|
+
defaultProps?: BindingValueDefaults<TProps>;
|
|
754
|
+
/**
|
|
755
|
+
* Per-layer motion descriptors. Keyed by layer name; each value is
|
|
756
|
+
* a {@link SlotMotion} (framer-motion shape). See {@link LayerMotion}.
|
|
757
|
+
*
|
|
758
|
+
* motion: {
|
|
759
|
+
* icon: {
|
|
760
|
+
* animate: { 'data-state': { open: { rotate: 180 }, closed: { rotate: 0 } } },
|
|
761
|
+
* transition: { duration: 0.2 },
|
|
762
|
+
* },
|
|
763
|
+
* content: {
|
|
764
|
+
* initial: { height: 0, opacity: 0 },
|
|
765
|
+
* animate: { height: 'auto', opacity: 1 },
|
|
766
|
+
* exit: { height: 0, opacity: 0 },
|
|
767
|
+
* },
|
|
768
|
+
* }
|
|
769
|
+
*/
|
|
770
|
+
motion?: LayerMotion<TLayers>;
|
|
771
|
+
/**
|
|
772
|
+
* Per-combination layer overrides keyed on enum/bool prop values.
|
|
773
|
+
* See {@link CompoundPropsEntry}.
|
|
774
|
+
*/
|
|
775
|
+
compoundProps?: CompoundPropsEntry<TLayers, TProps>[];
|
|
776
|
+
}
|
|
307
777
|
/**
|
|
308
778
|
* Branded shape returned by `defineComponent({...})`. Carries `layers`,
|
|
309
779
|
* `props`, AND a phantom `__tag` slot as const-narrowed types so
|
|
@@ -332,18 +802,61 @@ interface ComponentConfigValue<TLayers extends Record<string, LayerInput>, TProp
|
|
|
332
802
|
readonly __componentName?: string;
|
|
333
803
|
readonly layers: TLayers;
|
|
334
804
|
readonly props?: TProps;
|
|
805
|
+
/**
|
|
806
|
+
* Static per-layer styles, keyed by layer name. Codegen's
|
|
807
|
+
* downleveler spreads each entry into the layer's runtime bundle.
|
|
808
|
+
* Distinct from `defaultProps`, which carries declared-prop
|
|
809
|
+
* defaults.
|
|
810
|
+
*/
|
|
811
|
+
readonly base?: Record<string, Record<string, unknown>>;
|
|
812
|
+
/**
|
|
813
|
+
* Per-layer motion descriptors keyed by layer name. Same shape as
|
|
814
|
+
* `LayerMotion<TLayers>` (loosened here so the read-side type
|
|
815
|
+
* doesn't require parameterizing against TLayers' Props).
|
|
816
|
+
*/
|
|
817
|
+
readonly motion?: Record<string, SlotMotion>;
|
|
335
818
|
readonly defaultProps?: Record<string, unknown>;
|
|
336
|
-
readonly compoundVariants?: CompoundVariant[];
|
|
337
819
|
/**
|
|
338
|
-
*
|
|
339
|
-
* `ComponentConfigInput.
|
|
820
|
+
* Per-combination layer overrides — see {@link CompoundPropsEntry}.
|
|
821
|
+
* Carried through from `ComponentConfigInput.compoundProps`.
|
|
340
822
|
*/
|
|
341
|
-
readonly
|
|
823
|
+
readonly compoundProps?: CompoundPropsEntry<TLayers, TProps>[];
|
|
824
|
+
/**
|
|
825
|
+
* Authoring metadata (description, events) attached via the bound
|
|
826
|
+
* component's `.metadata({...})` chain. Stored non-enumerably on
|
|
827
|
+
* the config object so `JSON.stringify` output stays clean. Read by
|
|
828
|
+
* codegen's prompt + catalog generators.
|
|
829
|
+
*
|
|
830
|
+
* `acceptsChildren` isn't stored here — codegen derives it from
|
|
831
|
+
* `layers` + `props` shape so authors don't have to declare what's
|
|
832
|
+
* already obvious from the config (primitive + value-extend forms
|
|
833
|
+
* accept children unconditionally; verbose form derives from
|
|
834
|
+
* `ForwardBinding { from: 'children' }`).
|
|
835
|
+
*/
|
|
836
|
+
readonly metadata?: {
|
|
837
|
+
readonly description?: string;
|
|
838
|
+
readonly events?: readonly string[];
|
|
839
|
+
};
|
|
342
840
|
}
|
|
343
841
|
/**
|
|
344
842
|
* The bundle passed to the render function for each layer — a ready-to-
|
|
345
843
|
* spread object with `className` and any forwarded attrs. The render
|
|
346
844
|
* function destructures `props.<layerName>` into the JSX position.
|
|
347
845
|
*/
|
|
846
|
+
interface LayerBundle {
|
|
847
|
+
/** Resolved CSS class names for this layer. Omitted when empty so the
|
|
848
|
+
* rendered HTML doesn't carry a literal `class=""` attribute. */
|
|
849
|
+
className?: string;
|
|
850
|
+
[key: string]: unknown;
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Derive the render-function argument shape from a component config
|
|
854
|
+
* type. The render fn receives `props: { <each layer>: LayerBundle }`
|
|
855
|
+
* plus `children` (always present at the React level).
|
|
856
|
+
*/
|
|
857
|
+
type RenderArgs<TConfig extends ComponentConfigValue<Record<string, LayerInput>>> = {
|
|
858
|
+
props: { [K in keyof TConfig['layers']]: LayerBundle };
|
|
859
|
+
children?: ReactNode;
|
|
860
|
+
} & Record<string, unknown>; //#endregion
|
|
348
861
|
//#endregion
|
|
349
|
-
export { BoolMarker, ComponentConfigValue,
|
|
862
|
+
export { BoolMarker, ComponentConfigInput, ComponentConfigValue, ComponentMotionValue, ComponentSlotStyles, CompositeBinding, CompositeMarker, CompoundPropsEntry, EnumMarker, HiddenMarker, HtmlTag, LayerBundle, LayerInput, LayerOverride, PrimitiveLayer, PrimitivePropBinding, PropBinding, RenderArgs, RootTag, SingleLayerCompositeBinding, SlotMarker, SlotMotion, SplitSlotPath, StringMarker, StylePropBinding, StylePropMarker, StylePropShorthand, TokenGroupMarker, TokenMarker, VerbosePropBinding, WhenClause, bool, composite, enums, hidden, slot, string, styleProp, token, tokenGroup };
|