@cloudflare/kumo 1.0.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/CHANGELOG.md +510 -0
- package/LICENSE +21 -0
- package/README.md +521 -0
- package/ai/component-registry.json +3754 -0
- package/ai/component-registry.md +4022 -0
- package/ai/schemas.ts +594 -0
- package/dist/badge-Dc99vsfo.js +51 -0
- package/dist/badge-Dc99vsfo.js.map +1 -0
- package/dist/banner-4fkH6Sbt.js +51 -0
- package/dist/banner-4fkH6Sbt.js.map +1 -0
- package/dist/breadcrumbs-B5SY2CWj.js +132 -0
- package/dist/breadcrumbs-B5SY2CWj.js.map +1 -0
- package/dist/button-E2-hZMZE.js +191 -0
- package/dist/button-E2-hZMZE.js.map +1 -0
- package/dist/catalog.js +229 -0
- package/dist/catalog.js.map +1 -0
- package/dist/checkbox-BexIU_lZ.js +224 -0
- package/dist/checkbox-BexIU_lZ.js.map +1 -0
- package/dist/clipboard-text-BFHWMjmr.js +108 -0
- package/dist/clipboard-text-BFHWMjmr.js.map +1 -0
- package/dist/cn-Bhsu1vx2.js +26 -0
- package/dist/cn-Bhsu1vx2.js.map +1 -0
- package/dist/code-T2wPDiM0.js +60 -0
- package/dist/code-T2wPDiM0.js.map +1 -0
- package/dist/collapsible-OBNkTO48.js +56 -0
- package/dist/collapsible-OBNkTO48.js.map +1 -0
- package/dist/combobox-Dld0kS0U.js +228 -0
- package/dist/combobox-Dld0kS0U.js.map +1 -0
- package/dist/command-line/cli.js +764 -0
- package/dist/command-line/commands/add.js +220 -0
- package/dist/command-line/commands/blocks.js +61 -0
- package/dist/command-line/commands/doc.js +167 -0
- package/dist/command-line/commands/init.js +95 -0
- package/dist/command-line/commands/ls.js +53 -0
- package/dist/command-palette-BgQ680BG.js +393 -0
- package/dist/command-palette-BgQ680BG.js.map +1 -0
- package/dist/components/badge.js +7 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/banner.js +7 -0
- package/dist/components/banner.js.map +1 -0
- package/dist/components/breadcrumbs.js +9 -0
- package/dist/components/breadcrumbs.js.map +1 -0
- package/dist/components/button.js +9 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/checkbox.js +8 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/clipboard-text.js +6 -0
- package/dist/components/clipboard-text.js.map +1 -0
- package/dist/components/code.js +7 -0
- package/dist/components/code.js.map +1 -0
- package/dist/components/collapsible.js +6 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/combobox.js +6 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/command-palette.js +8 -0
- package/dist/components/command-palette.js.map +1 -0
- package/dist/components/date-range-picker.js +6 -0
- package/dist/components/date-range-picker.js.map +1 -0
- package/dist/components/dialog.js +11 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/dropdown.js +6 -0
- package/dist/components/dropdown.js.map +1 -0
- package/dist/components/empty.js +9 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/field.js +9 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/grid.js +11 -0
- package/dist/components/grid.js.map +1 -0
- package/dist/components/input.js +11 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/label.js +10 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/layer-card.js +6 -0
- package/dist/components/layer-card.js.map +1 -0
- package/dist/components/link.js +9 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/loader.js +8 -0
- package/dist/components/loader.js.map +1 -0
- package/dist/components/menubar.js +7 -0
- package/dist/components/menubar.js.map +1 -0
- package/dist/components/meter.js +6 -0
- package/dist/components/meter.js.map +1 -0
- package/dist/components/pagination.js +6 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/popover.js +14 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/radio.js +10 -0
- package/dist/components/radio.js.map +1 -0
- package/dist/components/select.js +6 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/sensitive-input.js +8 -0
- package/dist/components/sensitive-input.js.map +1 -0
- package/dist/components/surface.js +6 -0
- package/dist/components/surface.js.map +1 -0
- package/dist/components/switch.js +8 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.js +8 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.js +6 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/text.js +6 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/toast.js +8 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/tooltip.js +7 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/date-range-picker-CbKEQ9pi.js +408 -0
- package/dist/date-range-picker-CbKEQ9pi.js.map +1 -0
- package/dist/dialog-B1TaN0oR.js +77 -0
- package/dist/dialog-B1TaN0oR.js.map +1 -0
- package/dist/dropdown-D0rhYKeG.js +263 -0
- package/dist/dropdown-D0rhYKeG.js.map +1 -0
- package/dist/empty-DzCqjea-.js +93 -0
- package/dist/empty-DzCqjea-.js.map +1 -0
- package/dist/field-V3J0Ql_V.js +71 -0
- package/dist/field-V3J0Ql_V.js.map +1 -0
- package/dist/grid-DKajRHh8.js +127 -0
- package/dist/grid-DKajRHh8.js.map +1 -0
- package/dist/index.js +125 -0
- package/dist/index.js.map +1 -0
- package/dist/input-Dqvc2AB_.js +109 -0
- package/dist/input-Dqvc2AB_.js.map +1 -0
- package/dist/input-area-B9qajxvZ.js +57 -0
- package/dist/input-area-B9qajxvZ.js.map +1 -0
- package/dist/input-group-Bl6tgD5-.js +111 -0
- package/dist/input-group-Bl6tgD5-.js.map +1 -0
- package/dist/label-87HQArUG.js +50 -0
- package/dist/label-87HQArUG.js.map +1 -0
- package/dist/layer-card-C8j5Hkkj.js +44 -0
- package/dist/layer-card-C8j5Hkkj.js.map +1 -0
- package/dist/link-6TIZ4JIw.js +73 -0
- package/dist/link-6TIZ4JIw.js.map +1 -0
- package/dist/link-provider-DPBGo-0n.js +22 -0
- package/dist/link-provider-DPBGo-0n.js.map +1 -0
- package/dist/loader-DHGMYlC6.js +105 -0
- package/dist/loader-DHGMYlC6.js.map +1 -0
- package/dist/menubar-DLwLRFB1.js +92 -0
- package/dist/menubar-DLwLRFB1.js.map +1 -0
- package/dist/meter-DKUuvXxS.js +51 -0
- package/dist/meter-DKUuvXxS.js.map +1 -0
- package/dist/pagination-C4HQqodz.js +99 -0
- package/dist/pagination-C4HQqodz.js.map +1 -0
- package/dist/popover-DhdIqrP7.js +178 -0
- package/dist/popover-DhdIqrP7.js.map +1 -0
- package/dist/primitives/accordion.js +6 -0
- package/dist/primitives/accordion.js.map +1 -0
- package/dist/primitives/alert-dialog.js +6 -0
- package/dist/primitives/alert-dialog.js.map +1 -0
- package/dist/primitives/autocomplete.js +6 -0
- package/dist/primitives/autocomplete.js.map +1 -0
- package/dist/primitives/avatar.js +6 -0
- package/dist/primitives/avatar.js.map +1 -0
- package/dist/primitives/button.js +6 -0
- package/dist/primitives/button.js.map +1 -0
- package/dist/primitives/checkbox-group.js +6 -0
- package/dist/primitives/checkbox-group.js.map +1 -0
- package/dist/primitives/checkbox.js +6 -0
- package/dist/primitives/checkbox.js.map +1 -0
- package/dist/primitives/collapsible.js +6 -0
- package/dist/primitives/collapsible.js.map +1 -0
- package/dist/primitives/combobox.js +6 -0
- package/dist/primitives/combobox.js.map +1 -0
- package/dist/primitives/context-menu.js +6 -0
- package/dist/primitives/context-menu.js.map +1 -0
- package/dist/primitives/dialog.js +6 -0
- package/dist/primitives/dialog.js.map +1 -0
- package/dist/primitives/direction-provider.js +7 -0
- package/dist/primitives/direction-provider.js.map +1 -0
- package/dist/primitives/field.js +6 -0
- package/dist/primitives/field.js.map +1 -0
- package/dist/primitives/fieldset.js +6 -0
- package/dist/primitives/fieldset.js.map +1 -0
- package/dist/primitives/form.js +6 -0
- package/dist/primitives/form.js.map +1 -0
- package/dist/primitives/input.js +6 -0
- package/dist/primitives/input.js.map +1 -0
- package/dist/primitives/menu.js +6 -0
- package/dist/primitives/menu.js.map +1 -0
- package/dist/primitives/menubar.js +6 -0
- package/dist/primitives/menubar.js.map +1 -0
- package/dist/primitives/meter.js +6 -0
- package/dist/primitives/meter.js.map +1 -0
- package/dist/primitives/navigation-menu.js +6 -0
- package/dist/primitives/navigation-menu.js.map +1 -0
- package/dist/primitives/number-field.js +6 -0
- package/dist/primitives/number-field.js.map +1 -0
- package/dist/primitives/popover.js +6 -0
- package/dist/primitives/popover.js.map +1 -0
- package/dist/primitives/preview-card.js +6 -0
- package/dist/primitives/preview-card.js.map +1 -0
- package/dist/primitives/progress.js +6 -0
- package/dist/primitives/progress.js.map +1 -0
- package/dist/primitives/radio-group.js +6 -0
- package/dist/primitives/radio-group.js.map +1 -0
- package/dist/primitives/radio.js +6 -0
- package/dist/primitives/radio.js.map +1 -0
- package/dist/primitives/scroll-area.js +6 -0
- package/dist/primitives/scroll-area.js.map +1 -0
- package/dist/primitives/select.js +6 -0
- package/dist/primitives/select.js.map +1 -0
- package/dist/primitives/separator.js +6 -0
- package/dist/primitives/separator.js.map +1 -0
- package/dist/primitives/slider.js +6 -0
- package/dist/primitives/slider.js.map +1 -0
- package/dist/primitives/switch.js +6 -0
- package/dist/primitives/switch.js.map +1 -0
- package/dist/primitives/tabs.js +6 -0
- package/dist/primitives/tabs.js.map +1 -0
- package/dist/primitives/toast.js +6 -0
- package/dist/primitives/toast.js.map +1 -0
- package/dist/primitives/toggle-group.js +6 -0
- package/dist/primitives/toggle-group.js.map +1 -0
- package/dist/primitives/toggle.js +6 -0
- package/dist/primitives/toggle.js.map +1 -0
- package/dist/primitives/toolbar.js +6 -0
- package/dist/primitives/toolbar.js.map +1 -0
- package/dist/primitives/tooltip.js +6 -0
- package/dist/primitives/tooltip.js.map +1 -0
- package/dist/primitives.js +43 -0
- package/dist/primitives.js.map +1 -0
- package/dist/radio-BVAG7hNp.js +125 -0
- package/dist/radio-BVAG7hNp.js.map +1 -0
- package/dist/registry.js +2 -0
- package/dist/registry.js.map +1 -0
- package/dist/schemas-BSdA0fz-.js +3210 -0
- package/dist/schemas-BSdA0fz-.js.map +1 -0
- package/dist/select-B5Vb3zou.js +122 -0
- package/dist/select-B5Vb3zou.js.map +1 -0
- package/dist/sensitive-input-D5HCV04N.js +258 -0
- package/dist/sensitive-input-D5HCV04N.js.map +1 -0
- package/dist/skeleton-line-CtpS1u1J.js +28 -0
- package/dist/skeleton-line-CtpS1u1J.js.map +1 -0
- package/dist/src/blocks/page-header/index.d.ts +2 -0
- package/dist/src/blocks/page-header/index.d.ts.map +1 -0
- package/dist/src/blocks/page-header/page-header.d.ts +38 -0
- package/dist/src/blocks/page-header/page-header.d.ts.map +1 -0
- package/dist/src/blocks/resource-list/index.d.ts +2 -0
- package/dist/src/blocks/resource-list/index.d.ts.map +1 -0
- package/dist/src/blocks/resource-list/resource-list.d.ts +18 -0
- package/dist/src/blocks/resource-list/resource-list.d.ts.map +1 -0
- package/dist/src/catalog/catalog.d.ts +75 -0
- package/dist/src/catalog/catalog.d.ts.map +1 -0
- package/dist/src/catalog/data.d.ts +44 -0
- package/dist/src/catalog/data.d.ts.map +1 -0
- package/dist/src/catalog/index.d.ts +39 -0
- package/dist/src/catalog/index.d.ts.map +1 -0
- package/dist/src/catalog/types.d.ts +226 -0
- package/dist/src/catalog/types.d.ts.map +1 -0
- package/dist/src/catalog/visibility.d.ts +37 -0
- package/dist/src/catalog/visibility.d.ts.map +1 -0
- package/dist/src/command-line/build-cli.d.ts +7 -0
- package/dist/src/command-line/build-cli.d.ts.map +1 -0
- package/dist/src/command-line/cli.d.ts +13 -0
- package/dist/src/command-line/cli.d.ts.map +1 -0
- package/dist/src/command-line/commands/add.d.ts +10 -0
- package/dist/src/command-line/commands/add.d.ts.map +1 -0
- package/dist/src/command-line/commands/blocks.d.ts +10 -0
- package/dist/src/command-line/commands/blocks.d.ts.map +1 -0
- package/dist/src/command-line/commands/doc.d.ts +14 -0
- package/dist/src/command-line/commands/doc.d.ts.map +1 -0
- package/dist/src/command-line/commands/init.d.ts +18 -0
- package/dist/src/command-line/commands/init.d.ts.map +1 -0
- package/dist/src/command-line/commands/ls.d.ts +10 -0
- package/dist/src/command-line/commands/ls.d.ts.map +1 -0
- package/dist/src/command-line/commands/migrate.d.ts +10 -0
- package/dist/src/command-line/commands/migrate.d.ts.map +1 -0
- package/dist/src/command-line/utils/config.d.ts +42 -0
- package/dist/src/command-line/utils/config.d.ts.map +1 -0
- package/dist/src/command-line/utils/transformer.d.ts +17 -0
- package/dist/src/command-line/utils/transformer.d.ts.map +1 -0
- package/dist/src/components/badge/badge.d.ts +46 -0
- package/dist/src/components/badge/badge.d.ts.map +1 -0
- package/dist/src/components/badge/index.d.ts +2 -0
- package/dist/src/components/badge/index.d.ts.map +1 -0
- package/dist/src/components/banner/banner.d.ts +45 -0
- package/dist/src/components/banner/banner.d.ts.map +1 -0
- package/dist/src/components/banner/index.d.ts +2 -0
- package/dist/src/components/banner/index.d.ts.map +1 -0
- package/dist/src/components/breadcrumbs/breadcrumbs.d.ts +43 -0
- package/dist/src/components/breadcrumbs/breadcrumbs.d.ts.map +1 -0
- package/dist/src/components/breadcrumbs/index.d.ts +2 -0
- package/dist/src/components/breadcrumbs/index.d.ts.map +1 -0
- package/dist/src/components/button/button.d.ts +118 -0
- package/dist/src/components/button/button.d.ts.map +1 -0
- package/dist/src/components/button/index.d.ts +2 -0
- package/dist/src/components/button/index.d.ts.map +1 -0
- package/dist/src/components/checkbox/checkbox.d.ts +167 -0
- package/dist/src/components/checkbox/checkbox.d.ts.map +1 -0
- package/dist/src/components/checkbox/index.d.ts +2 -0
- package/dist/src/components/checkbox/index.d.ts.map +1 -0
- package/dist/src/components/clipboard-text/clipboard-text.d.ts +38 -0
- package/dist/src/components/clipboard-text/clipboard-text.d.ts.map +1 -0
- package/dist/src/components/clipboard-text/index.d.ts +2 -0
- package/dist/src/components/clipboard-text/index.d.ts.map +1 -0
- package/dist/src/components/code/code.d.ts +138 -0
- package/dist/src/components/code/code.d.ts.map +1 -0
- package/dist/src/components/code/index.d.ts +4 -0
- package/dist/src/components/code/index.d.ts.map +1 -0
- package/dist/src/components/collapsible/collapsible.d.ts +62 -0
- package/dist/src/components/collapsible/collapsible.d.ts.map +1 -0
- package/dist/src/components/collapsible/index.d.ts +2 -0
- package/dist/src/components/collapsible/index.d.ts.map +1 -0
- package/dist/src/components/combobox/combobox.d.ts +124 -0
- package/dist/src/components/combobox/combobox.d.ts.map +1 -0
- package/dist/src/components/combobox/index.d.ts +2 -0
- package/dist/src/components/combobox/index.d.ts.map +1 -0
- package/dist/src/components/command-palette/command-palette.d.ts +225 -0
- package/dist/src/components/command-palette/command-palette.d.ts.map +1 -0
- package/dist/src/components/command-palette/index.d.ts +3 -0
- package/dist/src/components/command-palette/index.d.ts.map +1 -0
- package/dist/src/components/command-palette/types.d.ts +149 -0
- package/dist/src/components/command-palette/types.d.ts.map +1 -0
- package/dist/src/components/date-range-picker/date-range-picker.d.ts +65 -0
- package/dist/src/components/date-range-picker/date-range-picker.d.ts.map +1 -0
- package/dist/src/components/date-range-picker/index.d.ts +2 -0
- package/dist/src/components/date-range-picker/index.d.ts.map +1 -0
- package/dist/src/components/dialog/dialog.d.ts +121 -0
- package/dist/src/components/dialog/dialog.d.ts.map +1 -0
- package/dist/src/components/dialog/index.d.ts +2 -0
- package/dist/src/components/dialog/index.d.ts.map +1 -0
- package/dist/src/components/dropdown/dropdown.d.ts +58 -0
- package/dist/src/components/dropdown/dropdown.d.ts.map +1 -0
- package/dist/src/components/dropdown/index.d.ts +2 -0
- package/dist/src/components/dropdown/index.d.ts.map +1 -0
- package/dist/src/components/empty/empty.d.ts +34 -0
- package/dist/src/components/empty/empty.d.ts.map +1 -0
- package/dist/src/components/empty/index.d.ts +2 -0
- package/dist/src/components/empty/index.d.ts.map +1 -0
- package/dist/src/components/field/field.d.ts +38 -0
- package/dist/src/components/field/field.d.ts.map +1 -0
- package/dist/src/components/field/index.d.ts +2 -0
- package/dist/src/components/field/index.d.ts.map +1 -0
- package/dist/src/components/grid/grid.d.ts +107 -0
- package/dist/src/components/grid/grid.d.ts.map +1 -0
- package/dist/src/components/grid/index.d.ts +2 -0
- package/dist/src/components/grid/index.d.ts.map +1 -0
- package/dist/src/components/input/index.d.ts +4 -0
- package/dist/src/components/input/index.d.ts.map +1 -0
- package/dist/src/components/input/input-area.d.ts +46 -0
- package/dist/src/components/input/input-area.d.ts.map +1 -0
- package/dist/src/components/input/input-group.d.ts +39 -0
- package/dist/src/components/input/input-group.d.ts.map +1 -0
- package/dist/src/components/input/input.d.ts +157 -0
- package/dist/src/components/input/input.d.ts.map +1 -0
- package/dist/src/components/label/index.d.ts +2 -0
- package/dist/src/components/label/index.d.ts.map +1 -0
- package/dist/src/components/label/label.d.ts +54 -0
- package/dist/src/components/label/label.d.ts.map +1 -0
- package/dist/src/components/layer-card/index.d.ts +2 -0
- package/dist/src/components/layer-card/index.d.ts.map +1 -0
- package/dist/src/components/layer-card/layer-card.d.ts +16 -0
- package/dist/src/components/layer-card/layer-card.d.ts.map +1 -0
- package/dist/src/components/link/index.d.ts +2 -0
- package/dist/src/components/link/index.d.ts.map +1 -0
- package/dist/src/components/link/link.d.ts +35 -0
- package/dist/src/components/link/link.d.ts.map +1 -0
- package/dist/src/components/loader/index.d.ts +3 -0
- package/dist/src/components/loader/index.d.ts.map +1 -0
- package/dist/src/components/loader/loader.d.ts +30 -0
- package/dist/src/components/loader/loader.d.ts.map +1 -0
- package/dist/src/components/loader/skeleton-line.d.ts +10 -0
- package/dist/src/components/loader/skeleton-line.d.ts.map +1 -0
- package/dist/src/components/menubar/index.d.ts +3 -0
- package/dist/src/components/menubar/index.d.ts.map +1 -0
- package/dist/src/components/menubar/menubar.d.ts +22 -0
- package/dist/src/components/menubar/menubar.d.ts.map +1 -0
- package/dist/src/components/menubar/use-menu-navigation.d.ts +8 -0
- package/dist/src/components/menubar/use-menu-navigation.d.ts.map +1 -0
- package/dist/src/components/meter/index.d.ts +2 -0
- package/dist/src/components/meter/index.d.ts.map +1 -0
- package/dist/src/components/meter/meter.d.ts +18 -0
- package/dist/src/components/meter/meter.d.ts.map +1 -0
- package/dist/src/components/pagination/index.d.ts +2 -0
- package/dist/src/components/pagination/index.d.ts.map +1 -0
- package/dist/src/components/pagination/pagination.d.ts +28 -0
- package/dist/src/components/pagination/pagination.d.ts.map +1 -0
- package/dist/src/components/popover/index.d.ts +3 -0
- package/dist/src/components/popover/index.d.ts.map +1 -0
- package/dist/src/components/popover/popover.d.ts +110 -0
- package/dist/src/components/popover/popover.d.ts.map +1 -0
- package/dist/src/components/radio/index.d.ts +2 -0
- package/dist/src/components/radio/index.d.ts.map +1 -0
- package/dist/src/components/radio/radio.d.ts +141 -0
- package/dist/src/components/radio/radio.d.ts.map +1 -0
- package/dist/src/components/select/index.d.ts +2 -0
- package/dist/src/components/select/index.d.ts.map +1 -0
- package/dist/src/components/select/select.d.ts +128 -0
- package/dist/src/components/select/select.d.ts.map +1 -0
- package/dist/src/components/sensitive-input/index.d.ts +2 -0
- package/dist/src/components/sensitive-input/index.d.ts.map +1 -0
- package/dist/src/components/sensitive-input/sensitive-input.d.ts +70 -0
- package/dist/src/components/sensitive-input/sensitive-input.d.ts.map +1 -0
- package/dist/src/components/surface/index.d.ts +2 -0
- package/dist/src/components/surface/index.d.ts.map +1 -0
- package/dist/src/components/surface/surface.d.ts +48 -0
- package/dist/src/components/surface/surface.d.ts.map +1 -0
- package/dist/src/components/switch/index.d.ts +2 -0
- package/dist/src/components/switch/index.d.ts.map +1 -0
- package/dist/src/components/switch/switch.d.ts +155 -0
- package/dist/src/components/switch/switch.d.ts.map +1 -0
- package/dist/src/components/table/index.d.ts +2 -0
- package/dist/src/components/table/index.d.ts.map +1 -0
- package/dist/src/components/table/table.d.ts +54 -0
- package/dist/src/components/table/table.d.ts.map +1 -0
- package/dist/src/components/tabs/index.d.ts +3 -0
- package/dist/src/components/tabs/index.d.ts.map +1 -0
- package/dist/src/components/tabs/tabs.d.ts +64 -0
- package/dist/src/components/tabs/tabs.d.ts.map +1 -0
- package/dist/src/components/text/index.d.ts +2 -0
- package/dist/src/components/text/index.d.ts.map +1 -0
- package/dist/src/components/text/text.d.ts +153 -0
- package/dist/src/components/text/text.d.ts.map +1 -0
- package/dist/src/components/toast/index.d.ts +3 -0
- package/dist/src/components/toast/index.d.ts.map +1 -0
- package/dist/src/components/toast/toast.d.ts +66 -0
- package/dist/src/components/toast/toast.d.ts.map +1 -0
- package/dist/src/components/tooltip/index.d.ts +2 -0
- package/dist/src/components/tooltip/index.d.ts.map +1 -0
- package/dist/src/components/tooltip/tooltip.d.ts +43 -0
- package/dist/src/components/tooltip/tooltip.d.ts.map +1 -0
- package/dist/src/index.d.ts +39 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/primitives/accordion.d.ts +13 -0
- package/dist/src/primitives/accordion.d.ts.map +1 -0
- package/dist/src/primitives/alert-dialog.d.ts +13 -0
- package/dist/src/primitives/alert-dialog.d.ts.map +1 -0
- package/dist/src/primitives/autocomplete.d.ts +13 -0
- package/dist/src/primitives/autocomplete.d.ts.map +1 -0
- package/dist/src/primitives/avatar.d.ts +13 -0
- package/dist/src/primitives/avatar.d.ts.map +1 -0
- package/dist/src/primitives/button.d.ts +13 -0
- package/dist/src/primitives/button.d.ts.map +1 -0
- package/dist/src/primitives/checkbox-group.d.ts +13 -0
- package/dist/src/primitives/checkbox-group.d.ts.map +1 -0
- package/dist/src/primitives/checkbox.d.ts +13 -0
- package/dist/src/primitives/checkbox.d.ts.map +1 -0
- package/dist/src/primitives/collapsible.d.ts +13 -0
- package/dist/src/primitives/collapsible.d.ts.map +1 -0
- package/dist/src/primitives/combobox.d.ts +13 -0
- package/dist/src/primitives/combobox.d.ts.map +1 -0
- package/dist/src/primitives/context-menu.d.ts +13 -0
- package/dist/src/primitives/context-menu.d.ts.map +1 -0
- package/dist/src/primitives/dialog.d.ts +13 -0
- package/dist/src/primitives/dialog.d.ts.map +1 -0
- package/dist/src/primitives/direction-provider.d.ts +13 -0
- package/dist/src/primitives/direction-provider.d.ts.map +1 -0
- package/dist/src/primitives/field.d.ts +13 -0
- package/dist/src/primitives/field.d.ts.map +1 -0
- package/dist/src/primitives/fieldset.d.ts +13 -0
- package/dist/src/primitives/fieldset.d.ts.map +1 -0
- package/dist/src/primitives/form.d.ts +13 -0
- package/dist/src/primitives/form.d.ts.map +1 -0
- package/dist/src/primitives/index.d.ts +52 -0
- package/dist/src/primitives/index.d.ts.map +1 -0
- package/dist/src/primitives/input.d.ts +13 -0
- package/dist/src/primitives/input.d.ts.map +1 -0
- package/dist/src/primitives/menu.d.ts +13 -0
- package/dist/src/primitives/menu.d.ts.map +1 -0
- package/dist/src/primitives/menubar.d.ts +13 -0
- package/dist/src/primitives/menubar.d.ts.map +1 -0
- package/dist/src/primitives/meter.d.ts +13 -0
- package/dist/src/primitives/meter.d.ts.map +1 -0
- package/dist/src/primitives/navigation-menu.d.ts +13 -0
- package/dist/src/primitives/navigation-menu.d.ts.map +1 -0
- package/dist/src/primitives/number-field.d.ts +13 -0
- package/dist/src/primitives/number-field.d.ts.map +1 -0
- package/dist/src/primitives/popover.d.ts +13 -0
- package/dist/src/primitives/popover.d.ts.map +1 -0
- package/dist/src/primitives/preview-card.d.ts +13 -0
- package/dist/src/primitives/preview-card.d.ts.map +1 -0
- package/dist/src/primitives/progress.d.ts +13 -0
- package/dist/src/primitives/progress.d.ts.map +1 -0
- package/dist/src/primitives/radio-group.d.ts +13 -0
- package/dist/src/primitives/radio-group.d.ts.map +1 -0
- package/dist/src/primitives/radio.d.ts +13 -0
- package/dist/src/primitives/radio.d.ts.map +1 -0
- package/dist/src/primitives/scroll-area.d.ts +13 -0
- package/dist/src/primitives/scroll-area.d.ts.map +1 -0
- package/dist/src/primitives/select.d.ts +13 -0
- package/dist/src/primitives/select.d.ts.map +1 -0
- package/dist/src/primitives/separator.d.ts +13 -0
- package/dist/src/primitives/separator.d.ts.map +1 -0
- package/dist/src/primitives/slider.d.ts +13 -0
- package/dist/src/primitives/slider.d.ts.map +1 -0
- package/dist/src/primitives/switch.d.ts +13 -0
- package/dist/src/primitives/switch.d.ts.map +1 -0
- package/dist/src/primitives/tabs.d.ts +13 -0
- package/dist/src/primitives/tabs.d.ts.map +1 -0
- package/dist/src/primitives/toast.d.ts +13 -0
- package/dist/src/primitives/toast.d.ts.map +1 -0
- package/dist/src/primitives/toggle-group.d.ts +13 -0
- package/dist/src/primitives/toggle-group.d.ts.map +1 -0
- package/dist/src/primitives/toggle.d.ts +13 -0
- package/dist/src/primitives/toggle.d.ts.map +1 -0
- package/dist/src/primitives/toolbar.d.ts +13 -0
- package/dist/src/primitives/toolbar.d.ts.map +1 -0
- package/dist/src/primitives/tooltip.d.ts +13 -0
- package/dist/src/primitives/tooltip.d.ts.map +1 -0
- package/dist/src/registry/index.d.ts +8 -0
- package/dist/src/registry/index.d.ts.map +1 -0
- package/dist/src/registry/types.d.ts +191 -0
- package/dist/src/registry/types.d.ts.map +1 -0
- package/dist/src/utils/cn.d.ts +4 -0
- package/dist/src/utils/cn.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +3 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/link-provider.d.ts +12 -0
- package/dist/src/utils/link-provider.d.ts.map +1 -0
- package/dist/src/utils/prop-examples.d.ts +36 -0
- package/dist/src/utils/prop-examples.d.ts.map +1 -0
- package/dist/styles/kumo-binding.css +190 -0
- package/dist/styles/kumo-standalone.css +2 -0
- package/dist/styles/kumo.css +55 -0
- package/dist/styles/theme-fedramp.css +20 -0
- package/dist/styles/theme-kumo.css +186 -0
- package/dist/surface-BIC6CXiz.js +21 -0
- package/dist/surface-BIC6CXiz.js.map +1 -0
- package/dist/switch-D4duMhJ0.js +257 -0
- package/dist/switch-D4duMhJ0.js.map +1 -0
- package/dist/table-KuvHGpL8.js +153 -0
- package/dist/table-KuvHGpL8.js.map +1 -0
- package/dist/tabs-lQup-IbT.js +85 -0
- package/dist/tabs-lQup-IbT.js.map +1 -0
- package/dist/text-BEhqwMfe.js +97 -0
- package/dist/text-BEhqwMfe.js.map +1 -0
- package/dist/toast-8YyyQuqZ.js +69 -0
- package/dist/toast-8YyyQuqZ.js.map +1 -0
- package/dist/tooltip-DJWsDTWJ.js +85 -0
- package/dist/tooltip-DJWsDTWJ.js.map +1 -0
- package/dist/utils.js +10 -0
- package/dist/utils.js.map +1 -0
- package/dist/vendor-base-ui-DWIDNgE1.js +20446 -0
- package/dist/vendor-base-ui-DWIDNgE1.js.map +1 -0
- package/dist/vendor-floating-ui-BgbEw62H.js +1286 -0
- package/dist/vendor-floating-ui-BgbEw62H.js.map +1 -0
- package/dist/vendor-styling-BQbxAbdS.js +2775 -0
- package/dist/vendor-styling-BQbxAbdS.js.map +1 -0
- package/dist/vendor-utils-DD8jNJwD.js +741 -0
- package/dist/vendor-utils-DD8jNJwD.js.map +1 -0
- package/package.json +444 -0
- package/scripts/component-registry/cache.ts +123 -0
- package/scripts/component-registry/discovery.ts +469 -0
- package/scripts/component-registry/example-cleanup.ts +168 -0
- package/scripts/component-registry/index.test.ts +680 -0
- package/scripts/component-registry/index.ts +874 -0
- package/scripts/component-registry/markdown-generator.ts +222 -0
- package/scripts/component-registry/metadata.ts +643 -0
- package/scripts/component-registry/props-filter.ts +310 -0
- package/scripts/component-registry/schema-generator.ts +326 -0
- package/scripts/component-registry/sub-components.ts +349 -0
- package/scripts/component-registry/types.ts +156 -0
- package/scripts/component-registry/utils.ts +280 -0
- package/scripts/component-registry/variant-parser.ts +261 -0
- package/scripts/css-build.ts +55 -0
- package/scripts/generate-primitives.ts +178 -0
- package/scripts/theme-generator/config.ts +392 -0
- package/scripts/theme-generator/generate-css.ts +250 -0
- package/scripts/theme-generator/index.ts +159 -0
- package/scripts/theme-generator/migrate.ts +560 -0
- package/scripts/theme-generator/types.ts +86 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props filtering for component registry generation.
|
|
3
|
+
*
|
|
4
|
+
* Filters out inherited DOM/React props to keep documentation focused
|
|
5
|
+
* on component-specific props.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as ts from "typescript";
|
|
9
|
+
import { join, dirname } from "node:path";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
11
|
+
import type { CLIFlags } from "./types.js";
|
|
12
|
+
|
|
13
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
const rootDir = join(__dirname, "../..");
|
|
15
|
+
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// Props Filter Constants
|
|
18
|
+
// =============================================================================
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Props to always skip - these are internal React props or rarely useful for LLMs
|
|
22
|
+
*/
|
|
23
|
+
export const ALWAYS_SKIP_PROPS = new Set([
|
|
24
|
+
"key",
|
|
25
|
+
"ref",
|
|
26
|
+
"style",
|
|
27
|
+
"dangerouslySetInnerHTML",
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Prefixes for props that should be skipped (DOM event handlers, ARIA, data attributes)
|
|
32
|
+
*/
|
|
33
|
+
export const SKIP_PROP_PREFIXES = [
|
|
34
|
+
"aria-",
|
|
35
|
+
"data-",
|
|
36
|
+
"on", // Event handlers: onClick, onMouseDown, onKeyUp, etc.
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Props that should be kept even if they appear in inherited HTML types.
|
|
41
|
+
* These are commonly used and meaningful for component APIs.
|
|
42
|
+
*/
|
|
43
|
+
export const KEEP_PROPS = new Set([
|
|
44
|
+
"children",
|
|
45
|
+
"className",
|
|
46
|
+
"disabled",
|
|
47
|
+
"name",
|
|
48
|
+
"value",
|
|
49
|
+
"checked",
|
|
50
|
+
"required",
|
|
51
|
+
"placeholder",
|
|
52
|
+
"readOnly",
|
|
53
|
+
"type",
|
|
54
|
+
"label", // Common form field prop
|
|
55
|
+
"href", // Common link prop for navigation components
|
|
56
|
+
"lang", // Code component uses lang for syntax highlighting
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* React interface names that define inherited HTML props.
|
|
61
|
+
* Props from these interfaces are filtered out to keep docs focused on component-specific props.
|
|
62
|
+
*/
|
|
63
|
+
export const REACT_HTML_INTERFACES = [
|
|
64
|
+
"HTMLAttributes",
|
|
65
|
+
"InputHTMLAttributes",
|
|
66
|
+
"ButtonHTMLAttributes",
|
|
67
|
+
"AnchorHTMLAttributes",
|
|
68
|
+
"FormHTMLAttributes",
|
|
69
|
+
"TextareaHTMLAttributes",
|
|
70
|
+
"SelectHTMLAttributes",
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Minimal static list of common HTML props to skip (when --inherited-props is not set).
|
|
75
|
+
* This replaces the expensive deriveInheritedHtmlProps() by default.
|
|
76
|
+
*/
|
|
77
|
+
export const MINIMAL_SKIP_PROPS = new Set([
|
|
78
|
+
// Common HTML attributes we don't want to document
|
|
79
|
+
"accessKey",
|
|
80
|
+
"autoCapitalize",
|
|
81
|
+
"autoFocus",
|
|
82
|
+
"contentEditable",
|
|
83
|
+
"dir",
|
|
84
|
+
"draggable",
|
|
85
|
+
"hidden",
|
|
86
|
+
"spellCheck",
|
|
87
|
+
"tabIndex",
|
|
88
|
+
"translate",
|
|
89
|
+
// Form-specific attributes
|
|
90
|
+
"autocomplete",
|
|
91
|
+
"autofocus",
|
|
92
|
+
"form",
|
|
93
|
+
"formAction",
|
|
94
|
+
"formEncType",
|
|
95
|
+
"formMethod",
|
|
96
|
+
"formNoValidate",
|
|
97
|
+
"formTarget",
|
|
98
|
+
"max",
|
|
99
|
+
"maxLength",
|
|
100
|
+
"min",
|
|
101
|
+
"minLength",
|
|
102
|
+
"multiple",
|
|
103
|
+
"pattern",
|
|
104
|
+
"step",
|
|
105
|
+
// Media attributes
|
|
106
|
+
"accept",
|
|
107
|
+
"capture",
|
|
108
|
+
"crossOrigin",
|
|
109
|
+
"loop",
|
|
110
|
+
"muted",
|
|
111
|
+
"preload",
|
|
112
|
+
"poster",
|
|
113
|
+
"src",
|
|
114
|
+
"srcSet",
|
|
115
|
+
// React internal props
|
|
116
|
+
"suppressContentEditableWarning",
|
|
117
|
+
"suppressHydrationWarning",
|
|
118
|
+
"defaultChecked",
|
|
119
|
+
"defaultValue",
|
|
120
|
+
// RDFa attributes (semantic web metadata - not useful for component docs)
|
|
121
|
+
"about",
|
|
122
|
+
"content",
|
|
123
|
+
"datatype",
|
|
124
|
+
"inlist",
|
|
125
|
+
"prefix",
|
|
126
|
+
"property",
|
|
127
|
+
"rel",
|
|
128
|
+
"resource",
|
|
129
|
+
"rev",
|
|
130
|
+
"typeof",
|
|
131
|
+
"vocab",
|
|
132
|
+
// Microdata attributes (HTML5 semantic markup - not useful for component docs)
|
|
133
|
+
"itemID",
|
|
134
|
+
"itemProp",
|
|
135
|
+
"itemRef",
|
|
136
|
+
"itemScope",
|
|
137
|
+
"itemType",
|
|
138
|
+
// Deprecated/obscure HTML attributes
|
|
139
|
+
"autoCorrect",
|
|
140
|
+
"autoSave",
|
|
141
|
+
"color",
|
|
142
|
+
"results",
|
|
143
|
+
"security",
|
|
144
|
+
"unselectable",
|
|
145
|
+
// Popover API attributes (rarely used directly)
|
|
146
|
+
"popover",
|
|
147
|
+
"popoverTarget",
|
|
148
|
+
"popoverTargetAction",
|
|
149
|
+
// Web Components attributes
|
|
150
|
+
"is",
|
|
151
|
+
"slot",
|
|
152
|
+
"part",
|
|
153
|
+
"exportparts",
|
|
154
|
+
// Other rarely-used HTML attributes
|
|
155
|
+
"contextMenu",
|
|
156
|
+
"enterKeyHint",
|
|
157
|
+
"inputMode",
|
|
158
|
+
"inert",
|
|
159
|
+
"nonce",
|
|
160
|
+
"radioGroup",
|
|
161
|
+
"role",
|
|
162
|
+
]);
|
|
163
|
+
|
|
164
|
+
// =============================================================================
|
|
165
|
+
// Inherited Props Derivation (expensive, only used with --inherited-props)
|
|
166
|
+
// =============================================================================
|
|
167
|
+
|
|
168
|
+
// Lazily computed inherited HTML props (derived from React types at runtime)
|
|
169
|
+
let _inheritedHtmlProps: Set<string> | null = null;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* OPTIMIZATION: Derive inherited HTML props from React's type definitions.
|
|
173
|
+
* This is EXPENSIVE (~15s / 47% of total time) and NOT NEEDED for most use cases.
|
|
174
|
+
* Only enabled with --inherited-props CLI flag.
|
|
175
|
+
*
|
|
176
|
+
* Extracts property names from HTMLAttributes, InputHTMLAttributes, ButtonHTMLAttributes, etc.
|
|
177
|
+
* These are filtered out to keep component docs focused on component-specific props.
|
|
178
|
+
*/
|
|
179
|
+
export function deriveInheritedHtmlProps(): Set<string> {
|
|
180
|
+
const inheritedProps = new Set<string>();
|
|
181
|
+
|
|
182
|
+
try {
|
|
183
|
+
// Read tsconfig to get compiler options
|
|
184
|
+
const configPath = join(rootDir, "tsconfig.json");
|
|
185
|
+
const configFile = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
186
|
+
const parsedConfig = ts.parseJsonConfigFileContent(
|
|
187
|
+
configFile.config,
|
|
188
|
+
ts.sys,
|
|
189
|
+
rootDir,
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
// Create a program to access React's type definitions
|
|
193
|
+
const program = ts.createProgram({
|
|
194
|
+
rootNames: parsedConfig.fileNames,
|
|
195
|
+
options: parsedConfig.options,
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// Find React's type definition file
|
|
199
|
+
const reactDts = program
|
|
200
|
+
.getSourceFiles()
|
|
201
|
+
.find((sf) =>
|
|
202
|
+
sf.fileName.includes("node_modules/@types/react/index.d.ts"),
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
if (!reactDts) {
|
|
206
|
+
throw new Error("Could not find React type definitions");
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Walk the AST to find the HTML attribute interfaces
|
|
210
|
+
ts.forEachChild(reactDts, function visit(node) {
|
|
211
|
+
if (ts.isInterfaceDeclaration(node)) {
|
|
212
|
+
const name = node.name.text;
|
|
213
|
+
if (REACT_HTML_INTERFACES.includes(name)) {
|
|
214
|
+
// Extract property names from this interface
|
|
215
|
+
for (const member of node.members) {
|
|
216
|
+
if (ts.isPropertySignature(member) && member.name) {
|
|
217
|
+
const propName = member.name.getText(reactDts);
|
|
218
|
+
inheritedProps.add(propName);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
ts.forEachChild(node, visit);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
console.log(
|
|
227
|
+
`Derived ${inheritedProps.size} inherited HTML props from React types`,
|
|
228
|
+
);
|
|
229
|
+
} catch (error) {
|
|
230
|
+
console.warn(
|
|
231
|
+
"Warning: Could not derive HTML props from React types, using fallback list",
|
|
232
|
+
);
|
|
233
|
+
console.warn(error instanceof Error ? error.message : error);
|
|
234
|
+
|
|
235
|
+
// Fallback to a minimal set if derivation fails
|
|
236
|
+
const fallbackProps = [
|
|
237
|
+
"accessKey",
|
|
238
|
+
"autoCapitalize",
|
|
239
|
+
"autoFocus",
|
|
240
|
+
"contentEditable",
|
|
241
|
+
"dir",
|
|
242
|
+
"draggable",
|
|
243
|
+
"hidden",
|
|
244
|
+
"lang",
|
|
245
|
+
"spellCheck",
|
|
246
|
+
"tabIndex",
|
|
247
|
+
"title",
|
|
248
|
+
"translate",
|
|
249
|
+
"className",
|
|
250
|
+
"id",
|
|
251
|
+
"style",
|
|
252
|
+
"children",
|
|
253
|
+
];
|
|
254
|
+
for (const prop of fallbackProps) {
|
|
255
|
+
inheritedProps.add(prop);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return inheritedProps;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Get the set of inherited HTML props to skip.
|
|
264
|
+
* Uses minimal static list by default, or derives from React types with --inherited-props flag.
|
|
265
|
+
*/
|
|
266
|
+
export function getInheritedHtmlProps(cliFlags: CLIFlags): Set<string> {
|
|
267
|
+
if (!cliFlags.includeInheritedProps) {
|
|
268
|
+
// Use minimal static list instead of expensive derivation
|
|
269
|
+
return MINIMAL_SKIP_PROPS;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (!_inheritedHtmlProps) {
|
|
273
|
+
_inheritedHtmlProps = deriveInheritedHtmlProps();
|
|
274
|
+
}
|
|
275
|
+
return _inheritedHtmlProps;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// =============================================================================
|
|
279
|
+
// Main Filter Function
|
|
280
|
+
// =============================================================================
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Determine if a prop should be skipped from the generated documentation.
|
|
284
|
+
* Filters out inherited DOM props, event handlers, and internal React props.
|
|
285
|
+
*/
|
|
286
|
+
export function shouldSkipProp(propName: string, cliFlags: CLIFlags): boolean {
|
|
287
|
+
// Never skip props in the keep list
|
|
288
|
+
if (KEEP_PROPS.has(propName)) {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Always skip certain props
|
|
293
|
+
if (ALWAYS_SKIP_PROPS.has(propName)) {
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Skip props with certain prefixes
|
|
298
|
+
for (const prefix of SKIP_PROP_PREFIXES) {
|
|
299
|
+
if (propName.startsWith(prefix)) {
|
|
300
|
+
return true;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Skip inherited HTML attributes (derived from React types)
|
|
305
|
+
if (getInheritedHtmlProps(cliFlags).has(propName)) {
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod Schema Generator for Kumo Component Registry
|
|
3
|
+
*
|
|
4
|
+
* Generates TypeScript file with Zod schemas from component-registry.json.
|
|
5
|
+
* This enables runtime validation of AI-generated UI trees.
|
|
6
|
+
*
|
|
7
|
+
* Output: catalog/schemas.ts
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type {
|
|
11
|
+
ComponentRegistry,
|
|
12
|
+
ComponentSchema,
|
|
13
|
+
PropSchema,
|
|
14
|
+
} from "./types.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Convert a PropSchema type to its Zod equivalent
|
|
18
|
+
*/
|
|
19
|
+
function propTypeToZod(prop: PropSchema): string {
|
|
20
|
+
const { type, values, required, optional } = prop;
|
|
21
|
+
|
|
22
|
+
let zodType: string;
|
|
23
|
+
|
|
24
|
+
// Handle enum types with explicit values
|
|
25
|
+
if (type === "enum" && values && values.length > 0) {
|
|
26
|
+
const enumValues = values.map((v) => `"${v}"`).join(", ");
|
|
27
|
+
zodType = `z.enum([${enumValues}])`;
|
|
28
|
+
}
|
|
29
|
+
// Handle common types
|
|
30
|
+
else if (type === "string") {
|
|
31
|
+
zodType = "z.string()";
|
|
32
|
+
} else if (type === "number") {
|
|
33
|
+
zodType = "z.number()";
|
|
34
|
+
} else if (type === "boolean") {
|
|
35
|
+
zodType = "z.boolean()";
|
|
36
|
+
} else if (type === "ReactNode") {
|
|
37
|
+
// ReactNode can be string, number, boolean, null, or a dynamic path reference
|
|
38
|
+
zodType =
|
|
39
|
+
"z.union([z.string(), z.number(), z.boolean(), z.null(), DynamicValueSchema])";
|
|
40
|
+
} else if (type.endsWith("[]")) {
|
|
41
|
+
// Array types
|
|
42
|
+
const itemType = type.slice(0, -2);
|
|
43
|
+
const itemZod = itemType === "string" ? "z.string()" : "z.unknown()";
|
|
44
|
+
zodType = `z.array(${itemZod})`;
|
|
45
|
+
} else if (type.includes("|")) {
|
|
46
|
+
// Union types - simplified handling
|
|
47
|
+
zodType = "z.unknown()";
|
|
48
|
+
} else {
|
|
49
|
+
// Fallback for complex types
|
|
50
|
+
zodType = "z.unknown()";
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Make optional if not required
|
|
54
|
+
if (optional || !required) {
|
|
55
|
+
zodType = `${zodType}.optional()`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return zodType;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Generate Zod schema for a single component's props
|
|
63
|
+
*/
|
|
64
|
+
function generateComponentPropsSchema(
|
|
65
|
+
componentName: string,
|
|
66
|
+
schema: ComponentSchema,
|
|
67
|
+
): string {
|
|
68
|
+
const propsEntries = Object.entries(schema.props);
|
|
69
|
+
|
|
70
|
+
if (propsEntries.length === 0) {
|
|
71
|
+
return `export const ${componentName}PropsSchema = z.object({});`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const propsLines = propsEntries.map(([propName, propSchema]) => {
|
|
75
|
+
const zodType = propTypeToZod(propSchema);
|
|
76
|
+
// Replace newlines with spaces to keep comments on a single line
|
|
77
|
+
const sanitizedDescription = propSchema.description
|
|
78
|
+
?.replace(/\n+/g, " ")
|
|
79
|
+
.trim();
|
|
80
|
+
const comment = sanitizedDescription ? ` // ${sanitizedDescription}` : "";
|
|
81
|
+
return ` ${propName}: ${zodType},${comment}`;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return `export const ${componentName}PropsSchema = z.object({
|
|
85
|
+
${propsLines.join("\n")}
|
|
86
|
+
});`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Generate the complete schemas.ts file content
|
|
91
|
+
*/
|
|
92
|
+
export function generateSchemasFile(registry: ComponentRegistry): string {
|
|
93
|
+
const componentNames = Object.keys(registry.components).sort();
|
|
94
|
+
|
|
95
|
+
const lines: string[] = [
|
|
96
|
+
"/**",
|
|
97
|
+
" * Auto-generated Zod schemas for Kumo components",
|
|
98
|
+
" * DO NOT EDIT - Generated by scripts/component-registry/index.ts",
|
|
99
|
+
" *",
|
|
100
|
+
" * These schemas enable runtime validation of AI-generated UI trees.",
|
|
101
|
+
" */",
|
|
102
|
+
"",
|
|
103
|
+
'import { z } from "zod";',
|
|
104
|
+
"",
|
|
105
|
+
"// =============================================================================",
|
|
106
|
+
"// Dynamic Value Schema (for data binding)",
|
|
107
|
+
"// =============================================================================",
|
|
108
|
+
"",
|
|
109
|
+
"/**",
|
|
110
|
+
" * A value that can either be a literal or a reference to the data model.",
|
|
111
|
+
' * Example: "Hello" or { path: "/user/name" }',
|
|
112
|
+
" */",
|
|
113
|
+
"export const DynamicValueSchema = z.union([",
|
|
114
|
+
" z.string(),",
|
|
115
|
+
" z.number(),",
|
|
116
|
+
" z.boolean(),",
|
|
117
|
+
" z.null(),",
|
|
118
|
+
" z.object({ path: z.string() }),",
|
|
119
|
+
"]);",
|
|
120
|
+
"",
|
|
121
|
+
"export type DynamicValue<T = unknown> = T | { path: string };",
|
|
122
|
+
"",
|
|
123
|
+
"// =============================================================================",
|
|
124
|
+
"// Visibility Condition Schemas",
|
|
125
|
+
"// =============================================================================",
|
|
126
|
+
"",
|
|
127
|
+
"/**",
|
|
128
|
+
" * Visibility conditions for conditional rendering.",
|
|
129
|
+
" * Components can be shown/hidden based on data, auth, or logic expressions.",
|
|
130
|
+
" */",
|
|
131
|
+
"",
|
|
132
|
+
"// Forward declaration for recursive types",
|
|
133
|
+
"// Note: Numeric comparisons use DynamicValue (not DynamicValue<number>) for Zod compatibility",
|
|
134
|
+
"export type LogicExpression =",
|
|
135
|
+
" | { and: LogicExpression[] }",
|
|
136
|
+
" | { or: LogicExpression[] }",
|
|
137
|
+
" | { not: LogicExpression }",
|
|
138
|
+
" | { path: string }",
|
|
139
|
+
" | { eq: [DynamicValue, DynamicValue] }",
|
|
140
|
+
" | { neq: [DynamicValue, DynamicValue] }",
|
|
141
|
+
" | { gt: [DynamicValue, DynamicValue] }",
|
|
142
|
+
" | { gte: [DynamicValue, DynamicValue] }",
|
|
143
|
+
" | { lt: [DynamicValue, DynamicValue] }",
|
|
144
|
+
" | { lte: [DynamicValue, DynamicValue] };",
|
|
145
|
+
"",
|
|
146
|
+
"// Lazy schema for recursive logic expressions",
|
|
147
|
+
"const LogicExpressionSchema: z.ZodType<LogicExpression> = z.lazy(() =>",
|
|
148
|
+
" z.union([",
|
|
149
|
+
" z.object({ and: z.array(LogicExpressionSchema) }),",
|
|
150
|
+
" z.object({ or: z.array(LogicExpressionSchema) }),",
|
|
151
|
+
" z.object({ not: LogicExpressionSchema }),",
|
|
152
|
+
" z.object({ path: z.string() }),",
|
|
153
|
+
" z.object({ eq: z.tuple([DynamicValueSchema, DynamicValueSchema]) }),",
|
|
154
|
+
" z.object({ neq: z.tuple([DynamicValueSchema, DynamicValueSchema]) }),",
|
|
155
|
+
" z.object({ gt: z.tuple([DynamicValueSchema, DynamicValueSchema]) }),",
|
|
156
|
+
" z.object({ gte: z.tuple([DynamicValueSchema, DynamicValueSchema]) }),",
|
|
157
|
+
" z.object({ lt: z.tuple([DynamicValueSchema, DynamicValueSchema]) }),",
|
|
158
|
+
" z.object({ lte: z.tuple([DynamicValueSchema, DynamicValueSchema]) }),",
|
|
159
|
+
" ])",
|
|
160
|
+
");",
|
|
161
|
+
"",
|
|
162
|
+
"export const VisibilityConditionSchema = z.union([",
|
|
163
|
+
" z.boolean(),",
|
|
164
|
+
" z.object({ path: z.string() }),",
|
|
165
|
+
' z.object({ auth: z.enum(["signedIn", "signedOut"]) }),',
|
|
166
|
+
" LogicExpressionSchema,",
|
|
167
|
+
"]);",
|
|
168
|
+
"",
|
|
169
|
+
"export type VisibilityCondition = z.infer<typeof VisibilityConditionSchema>;",
|
|
170
|
+
"",
|
|
171
|
+
"// =============================================================================",
|
|
172
|
+
"// Action Schemas",
|
|
173
|
+
"// =============================================================================",
|
|
174
|
+
"",
|
|
175
|
+
"/**",
|
|
176
|
+
" * Action confirmation dialog configuration",
|
|
177
|
+
" */",
|
|
178
|
+
"export const ActionConfirmSchema = z.object({",
|
|
179
|
+
" title: z.string(),",
|
|
180
|
+
" message: z.string(),",
|
|
181
|
+
' variant: z.enum(["default", "danger"]).optional(),',
|
|
182
|
+
" confirmLabel: z.string().optional(),",
|
|
183
|
+
" cancelLabel: z.string().optional(),",
|
|
184
|
+
"});",
|
|
185
|
+
"",
|
|
186
|
+
"/**",
|
|
187
|
+
" * Action definition that AI can declare",
|
|
188
|
+
" */",
|
|
189
|
+
"export const ActionSchema = z.object({",
|
|
190
|
+
" name: z.string(),",
|
|
191
|
+
" params: z.record(z.string(), DynamicValueSchema).optional(),",
|
|
192
|
+
" confirm: ActionConfirmSchema.optional(),",
|
|
193
|
+
" onSuccess: z.object({ set: z.record(z.string(), DynamicValueSchema) }).optional(),",
|
|
194
|
+
" onError: z.object({ set: z.record(z.string(), DynamicValueSchema) }).optional(),",
|
|
195
|
+
"});",
|
|
196
|
+
"",
|
|
197
|
+
"export type Action = z.infer<typeof ActionSchema>;",
|
|
198
|
+
"",
|
|
199
|
+
"// =============================================================================",
|
|
200
|
+
"// Component Props Schemas",
|
|
201
|
+
"// =============================================================================",
|
|
202
|
+
"",
|
|
203
|
+
];
|
|
204
|
+
|
|
205
|
+
// Generate schema for each component
|
|
206
|
+
for (const name of componentNames) {
|
|
207
|
+
const schema = registry.components[name];
|
|
208
|
+
lines.push(generateComponentPropsSchema(name, schema));
|
|
209
|
+
lines.push("");
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Generate the component type union
|
|
213
|
+
lines.push(
|
|
214
|
+
"// =============================================================================",
|
|
215
|
+
);
|
|
216
|
+
lines.push("// Component Type Union");
|
|
217
|
+
lines.push(
|
|
218
|
+
"// =============================================================================",
|
|
219
|
+
);
|
|
220
|
+
lines.push("");
|
|
221
|
+
lines.push("/**");
|
|
222
|
+
lines.push(" * All valid component type names");
|
|
223
|
+
lines.push(" */");
|
|
224
|
+
const typeUnion = componentNames.map((n) => `"${n}"`).join(" | ");
|
|
225
|
+
lines.push(`export type KumoComponentType = ${typeUnion};`);
|
|
226
|
+
lines.push("");
|
|
227
|
+
lines.push("export const KumoComponentTypeSchema = z.enum([");
|
|
228
|
+
for (const name of componentNames) {
|
|
229
|
+
lines.push(` "${name}",`);
|
|
230
|
+
}
|
|
231
|
+
lines.push("]);");
|
|
232
|
+
lines.push("");
|
|
233
|
+
|
|
234
|
+
// Generate props schema map
|
|
235
|
+
lines.push("/**");
|
|
236
|
+
lines.push(" * Map of component type to its props schema");
|
|
237
|
+
lines.push(" */");
|
|
238
|
+
lines.push("export const ComponentPropsSchemas = {");
|
|
239
|
+
for (const name of componentNames) {
|
|
240
|
+
lines.push(` ${name}: ${name}PropsSchema,`);
|
|
241
|
+
}
|
|
242
|
+
lines.push("} as const;");
|
|
243
|
+
lines.push("");
|
|
244
|
+
|
|
245
|
+
// Generate UIElement schema
|
|
246
|
+
lines.push(
|
|
247
|
+
"// =============================================================================",
|
|
248
|
+
);
|
|
249
|
+
lines.push("// UI Element & Tree Schemas");
|
|
250
|
+
lines.push(
|
|
251
|
+
"// =============================================================================",
|
|
252
|
+
);
|
|
253
|
+
lines.push("");
|
|
254
|
+
lines.push("/**");
|
|
255
|
+
lines.push(" * Base UI element structure");
|
|
256
|
+
lines.push(" */");
|
|
257
|
+
lines.push("export const UIElementBaseSchema = z.object({");
|
|
258
|
+
lines.push(" key: z.string(),");
|
|
259
|
+
lines.push(" type: KumoComponentTypeSchema,");
|
|
260
|
+
lines.push(" props: z.record(z.string(), z.unknown()),");
|
|
261
|
+
lines.push(" children: z.array(z.string()).optional(),");
|
|
262
|
+
lines.push(" parentKey: z.string().nullable().optional(),");
|
|
263
|
+
lines.push(" visible: VisibilityConditionSchema.optional(),");
|
|
264
|
+
lines.push(" action: ActionSchema.optional(),");
|
|
265
|
+
lines.push("});");
|
|
266
|
+
lines.push("");
|
|
267
|
+
lines.push("export type UIElement = z.infer<typeof UIElementBaseSchema>;");
|
|
268
|
+
lines.push("");
|
|
269
|
+
lines.push("/**");
|
|
270
|
+
lines.push(" * Flat UI tree structure (optimized for LLM generation)");
|
|
271
|
+
lines.push(" */");
|
|
272
|
+
lines.push("export const UITreeSchema = z.object({");
|
|
273
|
+
lines.push(" root: z.string(),");
|
|
274
|
+
lines.push(" elements: z.record(z.string(), UIElementBaseSchema),");
|
|
275
|
+
lines.push("});");
|
|
276
|
+
lines.push("");
|
|
277
|
+
lines.push("export type UITree = z.infer<typeof UITreeSchema>;");
|
|
278
|
+
lines.push("");
|
|
279
|
+
|
|
280
|
+
// Generate validation helpers
|
|
281
|
+
lines.push(
|
|
282
|
+
"// =============================================================================",
|
|
283
|
+
);
|
|
284
|
+
lines.push("// Validation Helpers");
|
|
285
|
+
lines.push(
|
|
286
|
+
"// =============================================================================",
|
|
287
|
+
);
|
|
288
|
+
lines.push("");
|
|
289
|
+
lines.push("/**");
|
|
290
|
+
lines.push(" * Validate an element's props against its component schema");
|
|
291
|
+
lines.push(" */");
|
|
292
|
+
lines.push(
|
|
293
|
+
"export function validateElementProps(element: UIElement): z.SafeParseReturnType<unknown, unknown> {",
|
|
294
|
+
);
|
|
295
|
+
lines.push(
|
|
296
|
+
" const schema = ComponentPropsSchemas[element.type as keyof typeof ComponentPropsSchemas];",
|
|
297
|
+
);
|
|
298
|
+
lines.push(" if (!schema) {");
|
|
299
|
+
lines.push(
|
|
300
|
+
" return { success: false, error: new z.ZodError([{ code: 'custom', message: `Unknown component type: ${element.type}`, path: ['type'] }]) };",
|
|
301
|
+
);
|
|
302
|
+
lines.push(" }");
|
|
303
|
+
lines.push(" return schema.safeParse(element.props);");
|
|
304
|
+
lines.push("}");
|
|
305
|
+
lines.push("");
|
|
306
|
+
lines.push("/**");
|
|
307
|
+
lines.push(" * Validate a complete UI tree");
|
|
308
|
+
lines.push(" */");
|
|
309
|
+
lines.push(
|
|
310
|
+
"export function validateUITree(tree: unknown): z.SafeParseReturnType<unknown, UITree> {",
|
|
311
|
+
);
|
|
312
|
+
lines.push(" return UITreeSchema.safeParse(tree);");
|
|
313
|
+
lines.push("}");
|
|
314
|
+
lines.push("");
|
|
315
|
+
|
|
316
|
+
// Export component names for catalog generation
|
|
317
|
+
lines.push("/**");
|
|
318
|
+
lines.push(" * List of all component names (for catalog generation)");
|
|
319
|
+
lines.push(" */");
|
|
320
|
+
lines.push(
|
|
321
|
+
`export const KUMO_COMPONENT_NAMES = [${componentNames.map((n) => `"${n}"`).join(", ")}] as const;`,
|
|
322
|
+
);
|
|
323
|
+
lines.push("");
|
|
324
|
+
|
|
325
|
+
return lines.join("\n");
|
|
326
|
+
}
|