@gunkin/uiify 0.0.25-alpha → 0.0.27-alpha
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/README.md +59 -0
- package/agents/components.md +2 -0
- package/agents/index.md +1 -0
- package/agents/reference/components/accordion.md +4 -4
- package/agents/reference/components/alert-modal.md +10 -10
- package/agents/reference/components/alert.md +1 -1
- package/agents/reference/components/aspect-ratio.md +1 -1
- package/agents/reference/components/avatar.md +2 -2
- package/agents/reference/components/breadcrumb.md +9 -10
- package/agents/reference/components/candle-chart.md +35 -35
- package/agents/reference/components/carousel.md +10 -14
- package/agents/reference/components/collapsible.md +3 -3
- package/agents/reference/components/color-picker.md +6 -6
- package/agents/reference/components/combobox.md +7 -17
- package/agents/reference/components/context-menu.md +5 -26
- package/agents/reference/components/date-picker.md +2 -1
- package/agents/reference/components/drawer.md +17 -31
- package/agents/reference/components/dropdown-menu.md +2 -3
- package/agents/reference/components/field.md +11 -11
- package/agents/reference/components/form-error-summary.md +4 -4
- package/agents/reference/components/input-group.md +1 -0
- package/agents/reference/components/input.md +1 -0
- package/agents/reference/components/line-chart.md +29 -29
- package/agents/reference/components/modal.md +13 -15
- package/agents/reference/components/number-field.md +1 -1
- package/agents/reference/components/otp-input.md +2 -1
- package/agents/reference/components/pagination.md +7 -8
- package/agents/reference/components/rating.md +1 -1
- package/agents/reference/components/segmented-control.md +1 -0
- package/agents/reference/components/select.md +1 -0
- package/agents/reference/components/slider.md +4 -4
- package/agents/reference/components/spinner.md +1 -1
- package/agents/reference/components/table.md +1 -1
- package/agents/reference/components/tabs.md +6 -6
- package/agents/reference/components/tags-input.md +5 -12
- package/agents/reference/components/toast.md +8 -15
- package/agents/reference/components/toggle.md +4 -3
- package/agents/reference/components/virtual-scroll.md +4 -5
- package/agents/reference/elements/choice.md +3 -3
- package/agents/reference/elements/details.md +2 -2
- package/agents/reference/elements/popover.md +3 -3
- package/dist/ai/UiDocument.d.ts +16 -0
- package/dist/ai/UiDocument.d.ts.map +1 -0
- package/dist/ai/UiDocument.js +33 -0
- package/dist/ai/UiDocument.js.map +1 -0
- package/dist/ai/catalog.generated.d.ts +2766 -0
- package/dist/ai/catalog.generated.d.ts.map +1 -0
- package/dist/ai/catalog.generated.js +214 -0
- package/dist/ai/catalog.generated.js.map +1 -0
- package/dist/ai/index.d.ts +9 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +13 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/issues.d.ts +10 -0
- package/dist/ai/issues.d.ts.map +1 -0
- package/dist/ai/issues.js +178 -0
- package/dist/ai/issues.js.map +1 -0
- package/dist/ai/layout.d.ts +26 -0
- package/dist/ai/layout.d.ts.map +1 -0
- package/dist/ai/layout.js +46 -0
- package/dist/ai/layout.js.map +1 -0
- package/dist/ai/limits.d.ts +16 -0
- package/dist/ai/limits.d.ts.map +1 -0
- package/dist/ai/limits.js +99 -0
- package/dist/ai/limits.js.map +1 -0
- package/dist/ai/load.d.ts +16 -0
- package/dist/ai/load.d.ts.map +1 -0
- package/dist/ai/load.js +69 -0
- package/dist/ai/load.js.map +1 -0
- package/dist/ai/loaders.generated.d.ts +5 -0
- package/dist/ai/loaders.generated.d.ts.map +1 -0
- package/dist/ai/loaders.generated.js +122 -0
- package/dist/ai/loaders.generated.js.map +1 -0
- package/dist/ai/rules.d.ts +11 -0
- package/dist/ai/rules.d.ts.map +1 -0
- package/dist/ai/rules.js +126 -0
- package/dist/ai/rules.js.map +1 -0
- package/dist/ai/schema.generated.d.ts +8 -0
- package/dist/ai/schema.generated.d.ts.map +1 -0
- package/dist/ai/schema.generated.js +3316 -0
- package/dist/ai/schema.generated.js.map +1 -0
- package/dist/ai/types.d.ts +33 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +14 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/ai/validate.d.ts +15 -0
- package/dist/ai/validate.d.ts.map +1 -0
- package/dist/ai/validate.js +32 -0
- package/dist/ai/validate.js.map +1 -0
- package/dist/ai/validator.generated.d.ts +13 -0
- package/dist/ai/validator.generated.d.ts.map +1 -0
- package/dist/ai/validator.generated.js +49133 -0
- package/dist/ai/validator.generated.js.map +1 -0
- package/dist/components/accordion/Accordion.d.ts.map +1 -1
- package/dist/components/accordion/Accordion.js +20 -46
- package/dist/components/accordion/Accordion.js.map +1 -1
- package/dist/components/accordion/types.d.ts +6 -15
- package/dist/components/accordion/types.d.ts.map +1 -1
- package/dist/components/alert/Alert.d.ts.map +1 -1
- package/dist/components/alert/Alert.js +5 -14
- package/dist/components/alert/Alert.js.map +1 -1
- package/dist/components/alert/types.d.ts +3 -7
- package/dist/components/alert/types.d.ts.map +1 -1
- package/dist/components/alert-modal/AlertModal.d.ts.map +1 -1
- package/dist/components/alert-modal/AlertModal.js +28 -137
- package/dist/components/alert-modal/AlertModal.js.map +1 -1
- package/dist/components/alert-modal/AlertModalParts.d.ts.map +1 -1
- package/dist/components/alert-modal/AlertModalParts.js +4 -37
- package/dist/components/alert-modal/AlertModalParts.js.map +1 -1
- package/dist/components/alert-modal/types.d.ts +15 -33
- package/dist/components/alert-modal/types.d.ts.map +1 -1
- package/dist/components/aspect-ratio/AspectRatio.d.ts.map +1 -1
- package/dist/components/aspect-ratio/AspectRatio.js +4 -12
- package/dist/components/aspect-ratio/AspectRatio.js.map +1 -1
- package/dist/components/aspect-ratio/types.d.ts +3 -6
- package/dist/components/aspect-ratio/types.d.ts.map +1 -1
- package/dist/components/avatar/Avatar.d.ts.map +1 -1
- package/dist/components/avatar/Avatar.js +4 -21
- package/dist/components/avatar/Avatar.js.map +1 -1
- package/dist/components/avatar/types.d.ts +4 -14
- package/dist/components/avatar/types.d.ts.map +1 -1
- package/dist/components/breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb/Breadcrumb.js +43 -123
- package/dist/components/breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/breadcrumb/types.d.ts +12 -35
- package/dist/components/breadcrumb/types.d.ts.map +1 -1
- package/dist/components/candle-chart/CandleChart.d.ts.map +1 -1
- package/dist/components/candle-chart/CandleChart.js +122 -186
- package/dist/components/candle-chart/CandleChart.js.map +1 -1
- package/dist/components/candle-chart/client/CandleChartClient.d.ts.map +1 -1
- package/dist/components/candle-chart/client/CandleChartClient.js +8 -15
- package/dist/components/candle-chart/client/CandleChartClient.js.map +1 -1
- package/dist/components/candle-chart/types.d.ts +42 -116
- package/dist/components/candle-chart/types.d.ts.map +1 -1
- package/dist/components/carousel/CarouselMarkup.d.ts.map +1 -1
- package/dist/components/carousel/CarouselMarkup.js +55 -142
- package/dist/components/carousel/CarouselMarkup.js.map +1 -1
- package/dist/components/carousel/types.d.ts +13 -80
- package/dist/components/carousel/types.d.ts.map +1 -1
- package/dist/components/collapsible/Collapsible.d.ts +1 -5
- package/dist/components/collapsible/Collapsible.d.ts.map +1 -1
- package/dist/components/collapsible/Collapsible.js +3 -33
- package/dist/components/collapsible/Collapsible.js.map +1 -1
- package/dist/components/collapsible/types.d.ts +4 -18
- package/dist/components/collapsible/types.d.ts.map +1 -1
- package/dist/components/color-picker/ColorPicker.d.ts.map +1 -1
- package/dist/components/color-picker/ColorPicker.js +28 -123
- package/dist/components/color-picker/ColorPicker.js.map +1 -1
- package/dist/components/color-picker/types.d.ts +11 -30
- package/dist/components/color-picker/types.d.ts.map +1 -1
- package/dist/components/combobox/Combobox.d.ts.map +1 -1
- package/dist/components/combobox/Combobox.js +30 -23
- package/dist/components/combobox/Combobox.js.map +1 -1
- package/dist/components/combobox/types.d.ts +9 -29
- package/dist/components/combobox/types.d.ts.map +1 -1
- package/dist/components/context-menu/ContextMenu.d.ts.map +1 -1
- package/dist/components/context-menu/ContextMenu.js +30 -53
- package/dist/components/context-menu/ContextMenu.js.map +1 -1
- package/dist/components/context-menu/types.d.ts +6 -31
- package/dist/components/context-menu/types.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.d.ts +1 -1
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.js +2 -1
- package/dist/components/date-picker/DatePicker.js.map +1 -1
- package/dist/components/date-picker/types.d.ts +4 -1
- package/dist/components/date-picker/types.d.ts.map +1 -1
- package/dist/components/drawer/Drawer.d.ts.map +1 -1
- package/dist/components/drawer/Drawer.js +12 -12
- package/dist/components/drawer/Drawer.js.map +1 -1
- package/dist/components/drawer/DrawerNative.d.ts.map +1 -1
- package/dist/components/drawer/DrawerNative.js +47 -252
- package/dist/components/drawer/DrawerNative.js.map +1 -1
- package/dist/components/drawer/types.d.ts +25 -30
- package/dist/components/drawer/types.d.ts.map +1 -1
- package/dist/components/dropdown-menu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/dropdown-menu/DropdownMenu.js +30 -27
- package/dist/components/dropdown-menu/DropdownMenu.js.map +1 -1
- package/dist/components/dropdown-menu/DropdownMenuBar.d.ts.map +1 -1
- package/dist/components/dropdown-menu/DropdownMenuBar.js +3 -7
- package/dist/components/dropdown-menu/DropdownMenuBar.js.map +1 -1
- package/dist/components/dropdown-menu/types.d.ts +2 -5
- package/dist/components/dropdown-menu/types.d.ts.map +1 -1
- package/dist/components/field/Field.js +7 -7
- package/dist/components/field/Field.js.map +1 -1
- package/dist/components/field/types.d.ts +11 -11
- package/dist/components/field/types.d.ts.map +1 -1
- package/dist/components/form-error-summary/FormErrorSummary.d.ts.map +1 -1
- package/dist/components/form-error-summary/FormErrorSummary.js +20 -34
- package/dist/components/form-error-summary/FormErrorSummary.js.map +1 -1
- package/dist/components/form-error-summary/types.d.ts +6 -16
- package/dist/components/form-error-summary/types.d.ts.map +1 -1
- package/dist/components/hover-card/HoverCard.d.ts.map +1 -1
- package/dist/components/hover-card/HoverCard.js +9 -9
- package/dist/components/hover-card/HoverCard.js.map +1 -1
- package/dist/components/input/Input.d.ts.map +1 -1
- package/dist/components/input/Input.js +2 -0
- package/dist/components/input/Input.js.map +1 -1
- package/dist/components/input/types.d.ts +3 -0
- package/dist/components/input/types.d.ts.map +1 -1
- package/dist/components/input-group/InputGroup.d.ts.map +1 -1
- package/dist/components/input-group/InputGroup.js +2 -1
- package/dist/components/input-group/InputGroup.js.map +1 -1
- package/dist/components/input-group/types.d.ts +3 -0
- package/dist/components/input-group/types.d.ts.map +1 -1
- package/dist/components/internal/chart-scrollbar/use-scrollbar-reserve.d.ts +2 -2
- package/dist/components/internal/chart-scrollbar/use-scrollbar-reserve.d.ts.map +1 -1
- package/dist/components/internal/chart-scrollbar/use-scrollbar-reserve.js +11 -3
- package/dist/components/internal/chart-scrollbar/use-scrollbar-reserve.js.map +1 -1
- package/dist/components/internal/choice-family/ChoiceGroup.d.ts.map +1 -1
- package/dist/components/internal/choice-family/ChoiceGroup.js +14 -51
- package/dist/components/internal/choice-family/ChoiceGroup.js.map +1 -1
- package/dist/components/internal/choice-family/types.d.ts +8 -40
- package/dist/components/internal/choice-family/types.d.ts.map +1 -1
- package/dist/components/internal/control-size/types.d.ts +3 -0
- package/dist/components/internal/control-size/types.d.ts.map +1 -0
- package/dist/components/internal/control-size/types.js +1 -0
- package/dist/components/internal/control-size/types.js.map +1 -0
- package/dist/components/internal/live-chart/types.d.ts +3 -1
- package/dist/components/internal/live-chart/types.d.ts.map +1 -1
- package/dist/components/internal/live-chart/use-live-chart-window.d.ts.map +1 -1
- package/dist/components/internal/live-chart/use-live-chart-window.js +21 -5
- package/dist/components/internal/live-chart/use-live-chart-window.js.map +1 -1
- package/dist/components/internal/menu/menu-parts.d.ts.map +1 -1
- package/dist/components/internal/menu/menu-parts.js +3 -3
- package/dist/components/internal/menu/menu-parts.js.map +1 -1
- package/dist/components/internal/native-check-control/NativeCheckControl.d.ts.map +1 -1
- package/dist/components/internal/native-check-control/NativeCheckControl.js +8 -32
- package/dist/components/internal/native-check-control/NativeCheckControl.js.map +1 -1
- package/dist/components/internal/native-check-control/types.d.ts +4 -18
- package/dist/components/internal/native-check-control/types.d.ts.map +1 -1
- package/dist/components/line-chart/LineChart.d.ts.map +1 -1
- package/dist/components/line-chart/LineChart.js +134 -208
- package/dist/components/line-chart/LineChart.js.map +1 -1
- package/dist/components/line-chart/client/LineChartClient.d.ts.map +1 -1
- package/dist/components/line-chart/client/LineChartClient.js +8 -15
- package/dist/components/line-chart/client/LineChartClient.js.map +1 -1
- package/dist/components/line-chart/types.d.ts +36 -103
- package/dist/components/line-chart/types.d.ts.map +1 -1
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +34 -115
- package/dist/components/modal/Modal.js.map +1 -1
- package/dist/components/modal/ModalAnatomy.js +6 -6
- package/dist/components/modal/ModalAnatomy.js.map +1 -1
- package/dist/components/modal/ModalParts.js +1 -1
- package/dist/components/modal/ModalParts.js.map +1 -1
- package/dist/components/modal/client/ModalClientContent.d.ts.map +1 -1
- package/dist/components/modal/client/ModalClientContent.js +2 -2
- package/dist/components/modal/client/ModalClientContent.js.map +1 -1
- package/dist/components/modal/types.d.ts +19 -19
- package/dist/components/modal/types.d.ts.map +1 -1
- package/dist/components/number-field/NumberField.d.ts.map +1 -1
- package/dist/components/number-field/NumberField.js +13 -11
- package/dist/components/number-field/NumberField.js.map +1 -1
- package/dist/components/number-field/types.d.ts +1 -1
- package/dist/components/number-field/types.d.ts.map +1 -1
- package/dist/components/otp-input/OtpInput.d.ts.map +1 -1
- package/dist/components/otp-input/OtpInput.js +9 -9
- package/dist/components/otp-input/OtpInput.js.map +1 -1
- package/dist/components/otp-input/types.d.ts +4 -1
- package/dist/components/otp-input/types.d.ts.map +1 -1
- package/dist/components/pagination/Pagination.d.ts.map +1 -1
- package/dist/components/pagination/Pagination.js +26 -69
- package/dist/components/pagination/Pagination.js.map +1 -1
- package/dist/components/pagination/PaginationShell.d.ts.map +1 -1
- package/dist/components/pagination/PaginationShell.js +5 -6
- package/dist/components/pagination/PaginationShell.js.map +1 -1
- package/dist/components/pagination/types.d.ts +9 -32
- package/dist/components/pagination/types.d.ts.map +1 -1
- package/dist/components/rating/types.d.ts +1 -5
- package/dist/components/rating/types.d.ts.map +1 -1
- package/dist/components/segmented-control/SegmentedControl.d.ts +1 -1
- package/dist/components/segmented-control/SegmentedControl.d.ts.map +1 -1
- package/dist/components/segmented-control/SegmentedControl.js +4 -2
- package/dist/components/segmented-control/SegmentedControl.js.map +1 -1
- package/dist/components/segmented-control/client/SegmentedControlClient.d.ts +1 -1
- package/dist/components/segmented-control/client/SegmentedControlClient.d.ts.map +1 -1
- package/dist/components/segmented-control/client/SegmentedControlClient.js +4 -2
- package/dist/components/segmented-control/client/SegmentedControlClient.js.map +1 -1
- package/dist/components/segmented-control/types.d.ts +3 -0
- package/dist/components/segmented-control/types.d.ts.map +1 -1
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/Select.js +2 -0
- package/dist/components/select/Select.js.map +1 -1
- package/dist/components/select/types.d.ts +3 -0
- package/dist/components/select/types.d.ts.map +1 -1
- package/dist/components/slider/Slider.d.ts.map +1 -1
- package/dist/components/slider/Slider.js +12 -7
- package/dist/components/slider/Slider.js.map +1 -1
- package/dist/components/slider/client/SliderClient.d.ts.map +1 -1
- package/dist/components/slider/client/SliderClient.js +53 -100
- package/dist/components/slider/client/SliderClient.js.map +1 -1
- package/dist/components/slider/types.d.ts +8 -38
- package/dist/components/slider/types.d.ts.map +1 -1
- package/dist/components/spinner/Spinner.d.ts.map +1 -1
- package/dist/components/spinner/Spinner.js +2 -10
- package/dist/components/spinner/Spinner.js.map +1 -1
- package/dist/components/spinner/types.d.ts +3 -6
- package/dist/components/spinner/types.d.ts.map +1 -1
- package/dist/components/table/client/TableColumnHeader.d.ts.map +1 -1
- package/dist/components/table/client/TableColumnHeader.js +1 -15
- package/dist/components/table/client/TableColumnHeader.js.map +1 -1
- package/dist/components/table/types.d.ts +2 -6
- package/dist/components/table/types.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.js +9 -43
- package/dist/components/tabs/Tabs.js.map +1 -1
- package/dist/components/tabs/types.d.ts +8 -21
- package/dist/components/tabs/types.d.ts.map +1 -1
- package/dist/components/tags-input/TagsInput.d.ts.map +1 -1
- package/dist/components/tags-input/TagsInput.js +16 -27
- package/dist/components/tags-input/TagsInput.js.map +1 -1
- package/dist/components/tags-input/types.d.ts +8 -23
- package/dist/components/tags-input/types.d.ts.map +1 -1
- package/dist/components/toast/Toast.d.ts.map +1 -1
- package/dist/components/toast/Toast.js +13 -62
- package/dist/components/toast/Toast.js.map +1 -1
- package/dist/components/toast/ToastElements.d.ts.map +1 -1
- package/dist/components/toast/ToastElements.js +20 -57
- package/dist/components/toast/ToastElements.js.map +1 -1
- package/dist/components/toast/types.d.ts +9 -36
- package/dist/components/toast/types.d.ts.map +1 -1
- package/dist/components/toggle/Toggle.d.ts +1 -1
- package/dist/components/toggle/Toggle.d.ts.map +1 -1
- package/dist/components/toggle/Toggle.js +36 -61
- package/dist/components/toggle/Toggle.js.map +1 -1
- package/dist/components/toggle/types.d.ts +5 -24
- package/dist/components/toggle/types.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.js +4 -4
- package/dist/components/tooltip/Tooltip.js.map +1 -1
- package/dist/components/virtual-scroll/VirtualScroll.d.ts.map +1 -1
- package/dist/components/virtual-scroll/VirtualScroll.js +66 -44
- package/dist/components/virtual-scroll/VirtualScroll.js.map +1 -1
- package/dist/components/virtual-scroll/VirtualScrollRowShell.js +2 -2
- package/dist/components/virtual-scroll/VirtualScrollRowShell.js.map +1 -1
- package/dist/components/virtual-scroll/types.d.ts +7 -20
- package/dist/components/virtual-scroll/types.d.ts.map +1 -1
- package/dist/components/virtual-scroll/types.js.map +1 -1
- package/dist/components/virtual-scroll/virtual-scroll-scroll-sync.d.ts +3 -0
- package/dist/components/virtual-scroll/virtual-scroll-scroll-sync.d.ts.map +1 -1
- package/dist/components/virtual-scroll/virtual-scroll-scroll-sync.js +11 -2
- package/dist/components/virtual-scroll/virtual-scroll-scroll-sync.js.map +1 -1
- package/dist/core/class-names.d.ts +3 -0
- package/dist/core/class-names.d.ts.map +1 -0
- package/dist/core/class-names.js +7 -0
- package/dist/core/class-names.js.map +1 -0
- package/dist/core/part-names.d.ts +8 -0
- package/dist/core/part-names.d.ts.map +1 -0
- package/dist/core/part-names.js +111 -0
- package/dist/core/part-names.js.map +1 -0
- package/dist/core/polymorphic.d.ts +10 -3
- package/dist/core/polymorphic.d.ts.map +1 -1
- package/dist/core/render-native-invoker.d.ts +1 -0
- package/dist/core/render-native-invoker.d.ts.map +1 -1
- package/dist/core/render-native-invoker.js +6 -6
- package/dist/core/render-native-invoker.js.map +1 -1
- package/dist/core/roving-focus.d.ts +2 -2
- package/dist/core/roving-focus.d.ts.map +1 -1
- package/dist/core/roving-focus.js +6 -7
- package/dist/core/roving-focus.js.map +1 -1
- package/dist/core/slot-props.d.ts +9 -7
- package/dist/core/slot-props.d.ts.map +1 -1
- package/dist/core/slot-props.js +4 -14
- package/dist/core/slot-props.js.map +1 -1
- package/dist/elements/choice/Choice.d.ts.map +1 -1
- package/dist/elements/choice/Choice.js +5 -42
- package/dist/elements/choice/Choice.js.map +1 -1
- package/dist/elements/choice/types.d.ts +4 -11
- package/dist/elements/choice/types.d.ts.map +1 -1
- package/dist/elements/details/Details.d.ts.map +1 -1
- package/dist/elements/details/Details.js +4 -5
- package/dist/elements/details/Details.js.map +1 -1
- package/dist/elements/details/types.d.ts +3 -3
- package/dist/elements/details/types.d.ts.map +1 -1
- package/dist/elements/dialog/Dialog.d.ts.map +1 -1
- package/dist/elements/dialog/Dialog.js +1 -1
- package/dist/elements/dialog/Dialog.js.map +1 -1
- package/dist/elements/invoker/Invoker.js +3 -3
- package/dist/elements/invoker/Invoker.js.map +1 -1
- package/dist/elements/popover/Popover.d.ts.map +1 -1
- package/dist/elements/popover/Popover.js +3 -3
- package/dist/elements/popover/Popover.js.map +1 -1
- package/dist/elements/popover/types.d.ts +6 -4
- package/dist/elements/popover/types.d.ts.map +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/styles/tailwind.css +2 -2
- package/dist/styles/tokens.css +1 -1
- package/package.json +10 -1
- package/skills/uiify/SKILL.md +14 -10
- package/skills/uiify/references/elements/aspect-ratio.md +1 -1
- package/skills/uiify/references/elements/field.md +1 -1
- package/skills/uiify/references/elements/toggle.md +1 -0
- package/skills/uiify/references/guides/verification.md +13 -2
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
function Stack({
|
|
3
|
+
direction,
|
|
4
|
+
gap,
|
|
5
|
+
align,
|
|
6
|
+
wrap,
|
|
7
|
+
children
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
"data-ui-layout": "stack",
|
|
13
|
+
"data-direction": direction,
|
|
14
|
+
"data-gap": gap,
|
|
15
|
+
"data-align": align,
|
|
16
|
+
"data-wrap": wrap ? "true" : void 0,
|
|
17
|
+
children
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
Stack.displayName = "Stack";
|
|
22
|
+
function Grid({
|
|
23
|
+
columns,
|
|
24
|
+
gap,
|
|
25
|
+
children
|
|
26
|
+
}) {
|
|
27
|
+
return /* @__PURE__ */ jsx("div", { "data-ui-layout": "grid", "data-columns": columns, "data-gap": gap, children });
|
|
28
|
+
}
|
|
29
|
+
Grid.displayName = "Grid";
|
|
30
|
+
function Section({
|
|
31
|
+
as: Tag = "section",
|
|
32
|
+
padding,
|
|
33
|
+
width,
|
|
34
|
+
children
|
|
35
|
+
}) {
|
|
36
|
+
return /* @__PURE__ */ jsx(Tag, { "data-ui-layout": "section", "data-padding": padding, "data-width": width, children });
|
|
37
|
+
}
|
|
38
|
+
Section.displayName = "Section";
|
|
39
|
+
const layoutComponents = { Stack, Grid, Section };
|
|
40
|
+
export {
|
|
41
|
+
Grid,
|
|
42
|
+
Section,
|
|
43
|
+
Stack,
|
|
44
|
+
layoutComponents
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ai/layout.tsx"],"sourcesContent":["import type { ComponentType, ReactElement, ReactNode } from \"react\";\nimport type { GridProps, SectionProps, StackProps } from \"./catalog.generated.js\";\n\n/**\n * Layout nodes of a UI document. They are plain elements marked with `data-ui-layout`\n * and styled by `styles/components/ai-layout.css`, so they need no hooks and no client JS.\n */\n\nexport function Stack({\n direction,\n gap,\n align,\n wrap,\n children,\n}: StackProps & { children?: ReactNode }): ReactElement {\n return (\n <div\n data-ui-layout=\"stack\"\n data-direction={direction}\n data-gap={gap}\n data-align={align}\n data-wrap={wrap ? \"true\" : undefined}\n >\n {children}\n </div>\n );\n}\nStack.displayName = \"Stack\";\n\nexport function Grid({\n columns,\n gap,\n children,\n}: GridProps & { children?: ReactNode }): ReactElement {\n return (\n <div data-ui-layout=\"grid\" data-columns={columns} data-gap={gap}>\n {children}\n </div>\n );\n}\nGrid.displayName = \"Grid\";\n\nexport function Section({\n as: Tag = \"section\",\n padding,\n width,\n children,\n}: SectionProps & { children?: ReactNode }): ReactElement {\n return (\n <Tag data-ui-layout=\"section\" data-padding={padding} data-width={width}>\n {children}\n </Tag>\n );\n}\nSection.displayName = \"Section\";\n\n// oxlint-disable-next-line typescript/no-explicit-any -- each node takes its own props\nexport const layoutComponents: Readonly<Record<\"Stack\" | \"Grid\" | \"Section\", ComponentType<any>>> =\n { Stack, Grid, Section };\n"],"mappings":"AAgBI;AARG,SAAS,MAAM;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAwD;AACtD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,kBAAe;AAAA,MACf,kBAAgB;AAAA,MAChB,YAAU;AAAA,MACV,cAAY;AAAA,MACZ,aAAW,OAAO,SAAS;AAAA,MAE1B;AAAA;AAAA,EACH;AAEJ;AACA,MAAM,cAAc;AAEb,SAAS,KAAK;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AACF,GAAuD;AACrD,SACE,oBAAC,SAAI,kBAAe,QAAO,gBAAc,SAAS,YAAU,KACzD,UACH;AAEJ;AACA,KAAK,cAAc;AAEZ,SAAS,QAAQ;AAAA,EACtB,IAAI,MAAM;AAAA,EACV;AAAA,EACA;AAAA,EACA;AACF,GAA0D;AACxD,SACE,oBAAC,OAAI,kBAAe,WAAU,gBAAc,SAAS,cAAY,OAC9D,UACH;AAEJ;AACA,QAAQ,cAAc;AAGf,MAAM,mBACX,EAAE,OAAO,MAAM,QAAQ;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { UiValidationIssue } from "./types.js";
|
|
2
|
+
/** Deepest node nesting a document may have (the root is depth 1). */
|
|
3
|
+
export declare const MAX_DEPTH = 32;
|
|
4
|
+
/** Most nodes a document may have; text children count as nodes. */
|
|
5
|
+
export declare const MAX_NODES = 2000;
|
|
6
|
+
/** Longest string (text, prop value or property name) a document may contain. */
|
|
7
|
+
export declare const MAX_STRING_LENGTH = 10000;
|
|
8
|
+
/**
|
|
9
|
+
* Checks size limits and shared or circular references with an iterative walk, so a hostile
|
|
10
|
+
* document cannot exhaust the call stack. It runs before the schema because the schema is
|
|
11
|
+
* recursive. It walks own enumerable properties and never calls a function value; reading a
|
|
12
|
+
* property does run its getter, as the schema check after it does too, so validate plain data
|
|
13
|
+
* (`JSON.parse` output). `loadDocument` validates a `structuredClone`, whose getters ran once.
|
|
14
|
+
*/
|
|
15
|
+
export declare function checkLimits(value: unknown): UiValidationIssue[];
|
|
16
|
+
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../src/ai/limits.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,sEAAsE;AACtE,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,oEAAoE;AACpE,eAAO,MAAM,SAAS,OAAO,CAAC;AAC9B,iFAAiF;AACjF,eAAO,MAAM,iBAAiB,QAAS,CAAC;AAoBxC;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,EAAE,CAmG/D"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { breadcrumbAt } from "./issues.js";
|
|
2
|
+
const MAX_DEPTH = 32;
|
|
3
|
+
const MAX_NODES = 2e3;
|
|
4
|
+
const MAX_STRING_LENGTH = 1e4;
|
|
5
|
+
const MAX_ISSUES = 50;
|
|
6
|
+
function escapePointer(key) {
|
|
7
|
+
return key.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
8
|
+
}
|
|
9
|
+
function isObject(value) {
|
|
10
|
+
return typeof value === "object" && value !== null;
|
|
11
|
+
}
|
|
12
|
+
function checkLimits(value) {
|
|
13
|
+
const issues = [];
|
|
14
|
+
const add = (path, message) => {
|
|
15
|
+
issues.push({ path, breadcrumb: breadcrumbAt(value, path), message });
|
|
16
|
+
return issues.length >= MAX_ISSUES;
|
|
17
|
+
};
|
|
18
|
+
const visited = /* @__PURE__ */ new Set();
|
|
19
|
+
const stack = [];
|
|
20
|
+
let nodes = 0;
|
|
21
|
+
if (isObject(value) && !Array.isArray(value) && Object.hasOwn(value, "type")) {
|
|
22
|
+
stack.push({ value, path: "", depth: 1, node: true });
|
|
23
|
+
} else {
|
|
24
|
+
stack.push({ value, path: "", depth: 0, node: false });
|
|
25
|
+
}
|
|
26
|
+
while (stack.length > 0) {
|
|
27
|
+
const frame = stack.pop();
|
|
28
|
+
const { value: current, path, depth, node } = frame;
|
|
29
|
+
if (typeof current === "string") {
|
|
30
|
+
if (node) {
|
|
31
|
+
nodes += 1;
|
|
32
|
+
if (nodes > MAX_NODES) {
|
|
33
|
+
add(path, `document has more than ${MAX_NODES} nodes (text children count as nodes)`);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (current.length > MAX_STRING_LENGTH && add(path, `string is ${current.length} characters long; the limit is ${MAX_STRING_LENGTH}`))
|
|
38
|
+
break;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (!isObject(current)) continue;
|
|
42
|
+
if (visited.has(current)) {
|
|
43
|
+
if (node && add(
|
|
44
|
+
path,
|
|
45
|
+
"this node or list already appears elsewhere in the document; shared and circular references are not allowed"
|
|
46
|
+
))
|
|
47
|
+
break;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
visited.add(current);
|
|
51
|
+
if (Array.isArray(current)) {
|
|
52
|
+
for (let index = current.length - 1; index >= 0; index -= 1) {
|
|
53
|
+
stack.push({ value: current[index], path: `${path}/${index}`, depth, node });
|
|
54
|
+
}
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (node) {
|
|
58
|
+
nodes += 1;
|
|
59
|
+
if (nodes > MAX_NODES) {
|
|
60
|
+
add(path, `document has more than ${MAX_NODES} nodes (text children count as nodes)`);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (depth > MAX_DEPTH) {
|
|
65
|
+
if (add(path, `nesting is deeper than ${MAX_DEPTH} levels`)) break;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const keys = Object.keys(current);
|
|
69
|
+
const isWrapper = !node && depth === 0;
|
|
70
|
+
for (let index = keys.length - 1; index >= 0; index -= 1) {
|
|
71
|
+
const key = keys[index];
|
|
72
|
+
const childPath = `${path}/${escapePointer(key)}`;
|
|
73
|
+
if (key.length > MAX_STRING_LENGTH) {
|
|
74
|
+
if (add(
|
|
75
|
+
path,
|
|
76
|
+
`property name is ${key.length} characters long; the limit is ${MAX_STRING_LENGTH}`
|
|
77
|
+
))
|
|
78
|
+
return issues;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const child = current[key];
|
|
82
|
+
if (node && key === "children")
|
|
83
|
+
stack.push({ value: child, path: childPath, depth: depth + 1, node: true });
|
|
84
|
+
else if (node && key === "props")
|
|
85
|
+
stack.push({ value: child, path: childPath, depth, node: false });
|
|
86
|
+
else if (isWrapper && key === "root")
|
|
87
|
+
stack.push({ value: child, path: childPath, depth: 1, node: true });
|
|
88
|
+
else stack.push({ value: child, path: childPath, depth: depth + 1, node: false });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return issues;
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
MAX_DEPTH,
|
|
95
|
+
MAX_NODES,
|
|
96
|
+
MAX_STRING_LENGTH,
|
|
97
|
+
checkLimits
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ai/limits.ts"],"sourcesContent":["import { breadcrumbAt } from \"./issues.js\";\nimport type { UiValidationIssue } from \"./types.js\";\n\n/** Deepest node nesting a document may have (the root is depth 1). */\nexport const MAX_DEPTH = 32;\n/** Most nodes a document may have; text children count as nodes. */\nexport const MAX_NODES = 2000;\n/** Longest string (text, prop value or property name) a document may contain. */\nexport const MAX_STRING_LENGTH = 10_000;\n\nconst MAX_ISSUES = 50;\n\ninterface Frame {\n readonly value: unknown;\n readonly path: string;\n readonly depth: number;\n /** True for a node, and for the `children` array whose items are nodes. */\n readonly node: boolean;\n}\n\nfunction escapePointer(key: string): string {\n return key.replaceAll(\"~\", \"~0\").replaceAll(\"/\", \"~1\");\n}\n\nfunction isObject(value: unknown): value is object {\n return typeof value === \"object\" && value !== null;\n}\n\n/**\n * Checks size limits and shared or circular references with an iterative walk, so a hostile\n * document cannot exhaust the call stack. It runs before the schema because the schema is\n * recursive. It walks own enumerable properties and never calls a function value; reading a\n * property does run its getter, as the schema check after it does too, so validate plain data\n * (`JSON.parse` output). `loadDocument` validates a `structuredClone`, whose getters ran once.\n */\nexport function checkLimits(value: unknown): UiValidationIssue[] {\n const issues: UiValidationIssue[] = [];\n const add = (path: string, message: string): boolean => {\n issues.push({ path, breadcrumb: breadcrumbAt(value, path), message });\n return issues.length >= MAX_ISSUES;\n };\n\n const visited = new Set<object>();\n const stack: Frame[] = [];\n let nodes = 0;\n\n if (isObject(value) && !Array.isArray(value) && Object.hasOwn(value, \"type\")) {\n stack.push({ value, path: \"\", depth: 1, node: true });\n } else {\n stack.push({ value, path: \"\", depth: 0, node: false });\n }\n\n while (stack.length > 0) {\n const frame = stack.pop() as Frame;\n const { value: current, path, depth, node } = frame;\n\n if (typeof current === \"string\") {\n // A string inside `children` is a text child, which counts as a node.\n if (node) {\n nodes += 1;\n if (nodes > MAX_NODES) {\n add(path, `document has more than ${MAX_NODES} nodes (text children count as nodes)`);\n break;\n }\n }\n if (\n current.length > MAX_STRING_LENGTH &&\n add(path, `string is ${current.length} characters long; the limit is ${MAX_STRING_LENGTH}`)\n )\n break;\n continue;\n }\n if (!isObject(current)) continue;\n\n if (visited.has(current)) {\n // A reused props object was checked the first time; a reused node or children\n // array would make the document a graph, and a cycle never ends.\n if (\n node &&\n add(\n path,\n \"this node or list already appears elsewhere in the document; shared and circular references are not allowed\",\n )\n )\n break;\n continue;\n }\n visited.add(current);\n\n if (Array.isArray(current)) {\n for (let index = current.length - 1; index >= 0; index -= 1) {\n stack.push({ value: current[index], path: `${path}/${index}`, depth, node });\n }\n continue;\n }\n\n if (node) {\n nodes += 1;\n if (nodes > MAX_NODES) {\n add(path, `document has more than ${MAX_NODES} nodes (text children count as nodes)`);\n break;\n }\n }\n if (depth > MAX_DEPTH) {\n if (add(path, `nesting is deeper than ${MAX_DEPTH} levels`)) break;\n continue;\n }\n\n const keys = Object.keys(current);\n const isWrapper = !node && depth === 0;\n for (let index = keys.length - 1; index >= 0; index -= 1) {\n const key = keys[index] as string;\n const childPath = `${path}/${escapePointer(key)}`;\n if (key.length > MAX_STRING_LENGTH) {\n if (\n add(\n path,\n `property name is ${key.length} characters long; the limit is ${MAX_STRING_LENGTH}`,\n )\n )\n return issues;\n continue;\n }\n const child = (current as Record<string, unknown>)[key];\n if (node && key === \"children\")\n stack.push({ value: child, path: childPath, depth: depth + 1, node: true });\n else if (node && key === \"props\")\n stack.push({ value: child, path: childPath, depth, node: false });\n else if (isWrapper && key === \"root\")\n stack.push({ value: child, path: childPath, depth: 1, node: true });\n else stack.push({ value: child, path: childPath, depth: depth + 1, node: false });\n }\n }\n return issues;\n}\n"],"mappings":"AAAA,SAAS,oBAAoB;AAItB,MAAM,YAAY;AAElB,MAAM,YAAY;AAElB,MAAM,oBAAoB;AAEjC,MAAM,aAAa;AAUnB,SAAS,cAAc,KAAqB;AAC1C,SAAO,IAAI,WAAW,KAAK,IAAI,EAAE,WAAW,KAAK,IAAI;AACvD;AAEA,SAAS,SAAS,OAAiC;AACjD,SAAO,OAAO,UAAU,YAAY,UAAU;AAChD;AASO,SAAS,YAAY,OAAqC;AAC/D,QAAM,SAA8B,CAAC;AACrC,QAAM,MAAM,CAAC,MAAc,YAA6B;AACtD,WAAO,KAAK,EAAE,MAAM,YAAY,aAAa,OAAO,IAAI,GAAG,QAAQ,CAAC;AACpE,WAAO,OAAO,UAAU;AAAA,EAC1B;AAEA,QAAM,UAAU,oBAAI,IAAY;AAChC,QAAM,QAAiB,CAAC;AACxB,MAAI,QAAQ;AAEZ,MAAI,SAAS,KAAK,KAAK,CAAC,MAAM,QAAQ,KAAK,KAAK,OAAO,OAAO,OAAO,MAAM,GAAG;AAC5E,UAAM,KAAK,EAAE,OAAO,MAAM,IAAI,OAAO,GAAG,MAAM,KAAK,CAAC;AAAA,EACtD,OAAO;AACL,UAAM,KAAK,EAAE,OAAO,MAAM,IAAI,OAAO,GAAG,MAAM,MAAM,CAAC;AAAA,EACvD;AAEA,SAAO,MAAM,SAAS,GAAG;AACvB,UAAM,QAAQ,MAAM,IAAI;AACxB,UAAM,EAAE,OAAO,SAAS,MAAM,OAAO,KAAK,IAAI;AAE9C,QAAI,OAAO,YAAY,UAAU;AAE/B,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G;AACtD,UAAI,QAAQ,QAAQ;AAClB,cAAM,KAAK,EAAE,OAAO,OAAO,MAAM,WAAW,OAAO,QAAQ,GAAG,MAAM,KAAK,CAAC;AAAA,eACnE,QAAQ,QAAQ;AACvB,cAAM,KAAK,EAAE,OAAO,OAAO,MAAM,WAAW,OAAO,MAAM,MAAM,CAAC;AAAA,eACzD,aAAa,QAAQ;AAC5B,cAAM,KAAK,EAAE,OAAO,OAAO,MAAM,WAAW,OAAO,GAAG,MAAM,KAAK,CAAC;AAAA,UAC/D,OAAM,KAAK,EAAE,OAAO,OAAO,MAAM,WAAW,OAAO,QAAQ,GAAG,MAAM,MAAM,CAAC;AAAA,IAClF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { UiChild, UiNode } from "./catalog.generated.js";
|
|
2
|
+
import type { LoadedDocument, UiDocumentData } from "./types.js";
|
|
3
|
+
/** Validates untrusted data as a document, or throws `UiDocumentError` with its issues. */
|
|
4
|
+
export declare function assertDocument(value: unknown): UiDocumentData;
|
|
5
|
+
/** A node's children; leaf parts have none. */
|
|
6
|
+
export declare function childrenOf(node: UiNode): readonly UiChild[];
|
|
7
|
+
/**
|
|
8
|
+
* Validates `value`, then loads the component of every part type it uses, and only those.
|
|
9
|
+
* Rejects with `UiDocumentError` when the document is invalid.
|
|
10
|
+
*
|
|
11
|
+
* Documents are immutable: this validates and renders a deep-frozen `structuredClone` of
|
|
12
|
+
* `value`, so changing `value` afterwards never reaches what was validated. To show a changed
|
|
13
|
+
* document, pass a new object.
|
|
14
|
+
*/
|
|
15
|
+
export declare function loadDocument(value: unknown): Promise<LoadedDocument>;
|
|
16
|
+
//# sourceMappingURL=load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/ai/load.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAU,MAAM,wBAAwB,CAAC;AAItE,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjE,2FAA2F;AAC3F,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CAI7D;AAED,+CAA+C;AAC/C,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,OAAO,EAAE,CAE3D;AAuCD;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,cAAc,CAAC,CAoB1E"}
|
package/dist/ai/load.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { uiParts } from "./catalog.generated.js";
|
|
2
|
+
import { layoutComponents } from "./layout.js";
|
|
3
|
+
import { uiLoaders } from "./loaders.generated.js";
|
|
4
|
+
import { UiDocumentError } from "./types.js";
|
|
5
|
+
import { validateDocument } from "./validate.js";
|
|
6
|
+
function assertDocument(value) {
|
|
7
|
+
const result = validateDocument(value);
|
|
8
|
+
if (!result.ok) throw new UiDocumentError(result.issues);
|
|
9
|
+
return result.document;
|
|
10
|
+
}
|
|
11
|
+
function childrenOf(node) {
|
|
12
|
+
return node.children ?? [];
|
|
13
|
+
}
|
|
14
|
+
function collectTypes(node, types) {
|
|
15
|
+
types.add(node.type);
|
|
16
|
+
for (const child of childrenOf(node)) {
|
|
17
|
+
if (typeof child !== "string") collectTypes(child, types);
|
|
18
|
+
}
|
|
19
|
+
return types;
|
|
20
|
+
}
|
|
21
|
+
async function loadComponent(type) {
|
|
22
|
+
const kind = uiParts[type].kind;
|
|
23
|
+
if (kind === "layout") return layoutComponents[type];
|
|
24
|
+
const load = uiLoaders[type];
|
|
25
|
+
if (!load) throw new Error(`No loader for UI part type ${type}`);
|
|
26
|
+
return load();
|
|
27
|
+
}
|
|
28
|
+
function frozenCopy(value) {
|
|
29
|
+
let copy;
|
|
30
|
+
try {
|
|
31
|
+
copy = structuredClone(value);
|
|
32
|
+
} catch {
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
const stack = [copy];
|
|
36
|
+
while (stack.length > 0) {
|
|
37
|
+
const current = stack.pop();
|
|
38
|
+
if (typeof current !== "object" || current === null || Object.isFrozen(current)) continue;
|
|
39
|
+
Object.freeze(current);
|
|
40
|
+
for (const key of Object.keys(current)) stack.push(current[key]);
|
|
41
|
+
}
|
|
42
|
+
return copy;
|
|
43
|
+
}
|
|
44
|
+
async function loadDocument(value) {
|
|
45
|
+
const copy = frozenCopy(value);
|
|
46
|
+
if (copy === void 0 && value !== void 0) {
|
|
47
|
+
throw new UiDocumentError([
|
|
48
|
+
{
|
|
49
|
+
path: "",
|
|
50
|
+
breadcrumb: "document",
|
|
51
|
+
message: "a document must be plain data that structuredClone can copy"
|
|
52
|
+
}
|
|
53
|
+
]);
|
|
54
|
+
}
|
|
55
|
+
const { root } = assertDocument(copy);
|
|
56
|
+
const types = [...collectTypes(root, /* @__PURE__ */ new Set())].filter(
|
|
57
|
+
(type) => uiParts[type].kind !== "native"
|
|
58
|
+
);
|
|
59
|
+
const loaded = await Promise.all(
|
|
60
|
+
types.map(async (type) => [type, await loadComponent(type)])
|
|
61
|
+
);
|
|
62
|
+
return { root, components: new Map(loaded) };
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
assertDocument,
|
|
66
|
+
childrenOf,
|
|
67
|
+
loadDocument
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=load.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ai/load.ts"],"sourcesContent":["import type { ComponentType } from \"react\";\nimport type { UiChild, UiNode, UiType } from \"./catalog.generated.js\";\nimport { uiParts } from \"./catalog.generated.js\";\nimport { layoutComponents } from \"./layout.js\";\nimport { uiLoaders } from \"./loaders.generated.js\";\nimport type { LoadedDocument, UiDocumentData } from \"./types.js\";\nimport { UiDocumentError } from \"./types.js\";\nimport { validateDocument } from \"./validate.js\";\n\n/** Validates untrusted data as a document, or throws `UiDocumentError` with its issues. */\nexport function assertDocument(value: unknown): UiDocumentData {\n const result = validateDocument(value);\n if (!result.ok) throw new UiDocumentError(result.issues);\n return result.document;\n}\n\n/** A node's children; leaf parts have none. */\nexport function childrenOf(node: UiNode): readonly UiChild[] {\n return (node as { readonly children?: readonly UiChild[] }).children ?? [];\n}\n\nfunction collectTypes(node: UiNode, types: Set<UiType>): Set<UiType> {\n types.add(node.type);\n for (const child of childrenOf(node)) {\n if (typeof child !== \"string\") collectTypes(child, types);\n }\n return types;\n}\n\n// oxlint-disable-next-line typescript/no-explicit-any -- each part takes its own props\nasync function loadComponent(type: UiType): Promise<ComponentType<any>> {\n const kind = uiParts[type].kind;\n if (kind === \"layout\") return layoutComponents[type as keyof typeof layoutComponents];\n const load = uiLoaders[type];\n if (!load) throw new Error(`No loader for UI part type ${type}`);\n return load();\n}\n\n/** A copy of `value` nothing outside can change, or `undefined` when it cannot be copied. */\nfunction frozenCopy(value: unknown): unknown {\n let copy: unknown;\n try {\n // Copies data only (getters run once, here); functions and symbols make it throw.\n copy = structuredClone(value);\n } catch {\n return undefined;\n }\n // Iterative, so a deep or cyclic value cannot exhaust the stack; validation rejects both.\n const stack: unknown[] = [copy];\n while (stack.length > 0) {\n const current = stack.pop();\n if (typeof current !== \"object\" || current === null || Object.isFrozen(current)) continue;\n Object.freeze(current);\n for (const key of Object.keys(current)) stack.push((current as Record<string, unknown>)[key]);\n }\n return copy;\n}\n\n/**\n * Validates `value`, then loads the component of every part type it uses, and only those.\n * Rejects with `UiDocumentError` when the document is invalid.\n *\n * Documents are immutable: this validates and renders a deep-frozen `structuredClone` of\n * `value`, so changing `value` afterwards never reaches what was validated. To show a changed\n * document, pass a new object.\n */\nexport async function loadDocument(value: unknown): Promise<LoadedDocument> {\n const copy = frozenCopy(value);\n // Never validate or render the original: a Proxy can pass validation and change afterwards.\n if (copy === undefined && value !== undefined) {\n throw new UiDocumentError([\n {\n path: \"\",\n breadcrumb: \"document\",\n message: \"a document must be plain data that structuredClone can copy\",\n },\n ]);\n }\n const { root } = assertDocument(copy);\n const types = [...collectTypes(root, new Set())].filter(\n (type) => uiParts[type].kind !== \"native\",\n );\n const loaded = await Promise.all(\n types.map(async (type) => [type, await loadComponent(type)] as const),\n );\n return { root, components: new Map(loaded) };\n}\n"],"mappings":"AAEA,SAAS,eAAe;AACxB,SAAS,wBAAwB;AACjC,SAAS,iBAAiB;AAE1B,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AAG1B,SAAS,eAAe,OAAgC;AAC7D,QAAM,SAAS,iBAAiB,KAAK;AACrC,MAAI,CAAC,OAAO,GAAI,OAAM,IAAI,gBAAgB,OAAO,MAAM;AACvD,SAAO,OAAO;AAChB;AAGO,SAAS,WAAW,MAAkC;AAC3D,SAAQ,KAAoD,YAAY,CAAC;AAC3E;AAEA,SAAS,aAAa,MAAc,OAAiC;AACnE,QAAM,IAAI,KAAK,IAAI;AACnB,aAAW,SAAS,WAAW,IAAI,GAAG;AACpC,QAAI,OAAO,UAAU,SAAU,cAAa,OAAO,KAAK;AAAA,EAC1D;AACA,SAAO;AACT;AAGA,eAAe,cAAc,MAA2C;AACtE,QAAM,OAAO,QAAQ,IAAI,EAAE;AAC3B,MAAI,SAAS,SAAU,QAAO,iBAAiB,IAAqC;AACpF,QAAM,OAAO,UAAU,IAAI;AAC3B,MAAI,CAAC,KAAM,OAAM,IAAI,MAAM,8BAA8B,IAAI,EAAE;AAC/D,SAAO,KAAK;AACd;AAGA,SAAS,WAAW,OAAyB;AAC3C,MAAI;AACJ,MAAI;AAEF,WAAO,gBAAgB,KAAK;AAAA,EAC9B,QAAQ;AACN,WAAO;AAAA,EACT;AAEA,QAAM,QAAmB,CAAC,IAAI;AAC9B,SAAO,MAAM,SAAS,GAAG;AACvB,UAAM,UAAU,MAAM,IAAI;AAC1B,QAAI,OAAO,YAAY,YAAY,YAAY,QAAQ,OAAO,SAAS,OAAO,EAAG;AACjF,WAAO,OAAO,OAAO;AACrB,eAAW,OAAO,OAAO,KAAK,OAAO,EAAG,OAAM,KAAM,QAAoC,GAAG,CAAC;AAAA,EAC9F;AACA,SAAO;AACT;AAUA,eAAsB,aAAa,OAAyC;AAC1E,QAAM,OAAO,WAAW,KAAK;AAE7B,MAAI,SAAS,UAAa,UAAU,QAAW;AAC7C,UAAM,IAAI,gBAAgB;AAAA,MACxB;AAAA,QACE,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,SAAS;AAAA,MACX;AAAA,IACF,CAAC;AAAA,EACH;AACA,QAAM,EAAE,KAAK,IAAI,eAAe,IAAI;AACpC,QAAM,QAAQ,CAAC,GAAG,aAAa,MAAM,oBAAI,IAAI,CAAC,CAAC,EAAE;AAAA,IAC/C,CAAC,SAAS,QAAQ,IAAI,EAAE,SAAS;AAAA,EACnC;AACA,QAAM,SAAS,MAAM,QAAQ;AAAA,IAC3B,MAAM,IAAI,OAAO,SAAS,CAAC,MAAM,MAAM,cAAc,IAAI,CAAC,CAAU;AAAA,EACtE;AACA,SAAO,EAAE,MAAM,YAAY,IAAI,IAAI,MAAM,EAAE;AAC7C;","names":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
import type { UiType } from "./catalog.generated.js";
|
|
3
|
+
/** Loads each component part from its component entry, so a document loads only what it uses. */
|
|
4
|
+
export declare const uiLoaders: Readonly<Partial<Record<UiType, () => Promise<ComponentType<any>>>>>;
|
|
5
|
+
//# sourceMappingURL=loaders.generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loaders.generated.d.ts","sourceRoot":"","sources":["../../src/ai/loaders.generated.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,iGAAiG;AACjG,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAwJ1F,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
const uiLoaders = {
|
|
2
|
+
Alert: () => import("../components/alert/index.js").then((m) => m.Alert),
|
|
3
|
+
AlertDescription: () => import("../components/alert/index.js").then((m) => m.AlertDescription),
|
|
4
|
+
AlertTitle: () => import("../components/alert/index.js").then((m) => m.AlertTitle),
|
|
5
|
+
AlertModal: () => import("../components/alert-modal/index.js").then((m) => m.AlertModal),
|
|
6
|
+
AlertModalAction: () => import("../components/alert-modal/index.js").then((m) => m.AlertModalAction),
|
|
7
|
+
AlertModalCancel: () => import("../components/alert-modal/index.js").then((m) => m.AlertModalCancel),
|
|
8
|
+
AlertModalContent: () => import("../components/alert-modal/index.js").then((m) => m.AlertModalContent),
|
|
9
|
+
AlertModalTrigger: () => import("../components/alert-modal/index.js").then((m) => m.AlertModalTrigger),
|
|
10
|
+
AspectRatio: () => import("../components/aspect-ratio/index.js").then((m) => m.AspectRatio),
|
|
11
|
+
Avatar: () => import("../components/avatar/index.js").then((m) => m.Avatar),
|
|
12
|
+
Badge: () => import("../components/badge/index.js").then((m) => m.Badge),
|
|
13
|
+
"Breadcrumb.Item": () => import("../components/breadcrumb/index.js").then((m) => m.Breadcrumb.Item),
|
|
14
|
+
"Breadcrumb.Link": () => import("../components/breadcrumb/index.js").then((m) => m.Breadcrumb.Link),
|
|
15
|
+
"Breadcrumb.List": () => import("../components/breadcrumb/index.js").then((m) => m.Breadcrumb.List),
|
|
16
|
+
"Breadcrumb.Root": () => import("../components/breadcrumb/index.js").then((m) => m.Breadcrumb.Root),
|
|
17
|
+
"Breadcrumb.Separator": () => import("../components/breadcrumb/index.js").then((m) => m.Breadcrumb.Separator),
|
|
18
|
+
Button: () => import("../components/button/index.js").then((m) => m.Button),
|
|
19
|
+
Card: () => import("../components/card/index.js").then((m) => m.Card),
|
|
20
|
+
Checkbox: () => import("../components/checkbox/index.js").then((m) => m.Checkbox),
|
|
21
|
+
ColorPicker: () => import("../components/color-picker/index.js").then((m) => m.ColorPicker),
|
|
22
|
+
DatePicker: () => import("../components/date-picker/index.js").then((m) => m.DatePicker),
|
|
23
|
+
DescriptionDetails: () => import("../components/description-list/index.js").then((m) => m.DescriptionDetails),
|
|
24
|
+
DescriptionList: () => import("../components/description-list/index.js").then((m) => m.DescriptionList),
|
|
25
|
+
DescriptionTerm: () => import("../components/description-list/index.js").then((m) => m.DescriptionTerm),
|
|
26
|
+
"Drawer.Close": () => import("../components/drawer/index.js").then((m) => m.DrawerClose),
|
|
27
|
+
"Drawer.Content": () => import("../components/drawer/index.js").then((m) => m.DrawerContent),
|
|
28
|
+
"Drawer.Description": () => import("../components/drawer/index.js").then((m) => m.DrawerDescription),
|
|
29
|
+
"Drawer.Handle": () => import("../components/drawer/index.js").then((m) => m.DrawerHandle),
|
|
30
|
+
"Drawer.Root": () => import("../components/drawer/index.js").then((m) => m.DrawerRoot),
|
|
31
|
+
"Drawer.Title": () => import("../components/drawer/index.js").then((m) => m.DrawerTitle),
|
|
32
|
+
"Drawer.Trigger": () => import("../components/drawer/index.js").then((m) => m.DrawerTrigger),
|
|
33
|
+
DrawerPanel: () => import("../components/drawer/index.js").then((m) => m.DrawerPanel),
|
|
34
|
+
DrawerNativeTrigger: () => import("../components/drawer/index.js").then((m) => m.DrawerNativeTrigger),
|
|
35
|
+
DrawerNativeClose: () => import("../components/drawer/index.js").then((m) => m.DrawerNativeClose),
|
|
36
|
+
DrawerNativeContent: () => import("../components/drawer/index.js").then((m) => m.DrawerNativeContent),
|
|
37
|
+
Empty: () => import("../components/empty/index.js").then((m) => m.Empty),
|
|
38
|
+
EmptyContent: () => import("../components/empty/index.js").then((m) => m.EmptyContent),
|
|
39
|
+
EmptyDescription: () => import("../components/empty/index.js").then((m) => m.EmptyDescription),
|
|
40
|
+
EmptyTitle: () => import("../components/empty/index.js").then((m) => m.EmptyTitle),
|
|
41
|
+
"Field.Root": () => import("../components/field/index.js").then((m) => m.Field.Root),
|
|
42
|
+
"Field.Label": () => import("../components/field/index.js").then((m) => m.Field.Label),
|
|
43
|
+
"Field.Control": () => import("../components/field/index.js").then((m) => m.Field.Control),
|
|
44
|
+
"Field.Description": () => import("../components/field/index.js").then((m) => m.Field.Description),
|
|
45
|
+
"Field.Error": () => import("../components/field/index.js").then((m) => m.Field.Error),
|
|
46
|
+
Fieldset: () => import("../components/fieldset/index.js").then((m) => m.Fieldset),
|
|
47
|
+
FieldsetLegend: () => import("../components/fieldset/index.js").then((m) => m.FieldsetLegend),
|
|
48
|
+
"FileUpload.Dropzone": () => import("../components/file-upload/index.js").then((m) => m.FileUploadDropzone),
|
|
49
|
+
"FileUpload.HiddenInput": () => import("../components/file-upload/index.js").then((m) => m.FileUploadHiddenInput),
|
|
50
|
+
"FileUpload.Item": () => import("../components/file-upload/index.js").then((m) => m.FileUploadItem),
|
|
51
|
+
"FileUpload.ItemRemove": () => import("../components/file-upload/index.js").then((m) => m.FileUploadItemRemove),
|
|
52
|
+
"FileUpload.List": () => import("../components/file-upload/index.js").then((m) => m.FileUploadList),
|
|
53
|
+
"FileUpload.Root": () => import("../components/file-upload/index.js").then((m) => m.FileUploadRoot),
|
|
54
|
+
"FileUpload.Trigger": () => import("../components/file-upload/index.js").then((m) => m.FileUploadTrigger),
|
|
55
|
+
Form: () => import("../components/form/index.js").then((m) => m.Form),
|
|
56
|
+
"Header.Root": () => import("../components/header/index.js").then((m) => m.Header.Root),
|
|
57
|
+
Input: () => import("../components/input/index.js").then((m) => m.Input),
|
|
58
|
+
InputGroup: () => import("../components/input-group/index.js").then((m) => m.InputGroup),
|
|
59
|
+
InputGroupAddon: () => import("../components/input-group/index.js").then((m) => m.InputGroupAddon),
|
|
60
|
+
Item: () => import("../components/item/index.js").then((m) => m.Item),
|
|
61
|
+
ItemActions: () => import("../components/item/index.js").then((m) => m.ItemActions),
|
|
62
|
+
ItemContent: () => import("../components/item/index.js").then((m) => m.ItemContent),
|
|
63
|
+
ItemMedia: () => import("../components/item/index.js").then((m) => m.ItemMedia),
|
|
64
|
+
ItemMetadata: () => import("../components/item/index.js").then((m) => m.ItemMetadata),
|
|
65
|
+
Modal: () => import("../components/modal/index.js").then((m) => m.Modal),
|
|
66
|
+
ModalBody: () => import("../components/modal/index.js").then((m) => m.ModalBody),
|
|
67
|
+
ModalClose: () => import("../components/modal/index.js").then((m) => m.ModalClose),
|
|
68
|
+
ModalContent: () => import("../components/modal/index.js").then((m) => m.ModalContent),
|
|
69
|
+
ModalDescription: () => import("../components/modal/index.js").then((m) => m.ModalDescription),
|
|
70
|
+
ModalFooter: () => import("../components/modal/index.js").then((m) => m.ModalFooter),
|
|
71
|
+
ModalGrabber: () => import("../components/modal/index.js").then((m) => m.ModalGrabber),
|
|
72
|
+
ModalHeader: () => import("../components/modal/index.js").then((m) => m.ModalHeader),
|
|
73
|
+
ModalTitle: () => import("../components/modal/index.js").then((m) => m.ModalTitle),
|
|
74
|
+
ModalTrigger: () => import("../components/modal/index.js").then((m) => m.ModalTrigger),
|
|
75
|
+
"NumberField.Root": () => import("../components/number-field/index.js").then((m) => m.NumberFieldRoot),
|
|
76
|
+
"NumberField.Group": () => import("../components/number-field/index.js").then((m) => m.NumberFieldGroup),
|
|
77
|
+
"NumberField.Input": () => import("../components/number-field/index.js").then((m) => m.NumberFieldInput),
|
|
78
|
+
"NumberField.Increment": () => import("../components/number-field/index.js").then((m) => m.NumberFieldIncrement),
|
|
79
|
+
"NumberField.Decrement": () => import("../components/number-field/index.js").then((m) => m.NumberFieldDecrement),
|
|
80
|
+
"Pagination.Ellipsis": () => import("../components/pagination/index.js").then((m) => m.PaginationEllipsis),
|
|
81
|
+
"Pagination.Item": () => import("../components/pagination/index.js").then((m) => m.PaginationItem),
|
|
82
|
+
"Pagination.Link": () => import("../components/pagination/index.js").then((m) => m.PaginationLink),
|
|
83
|
+
"Pagination.List": () => import("../components/pagination/index.js").then((m) => m.PaginationList),
|
|
84
|
+
"Pagination.Root": () => import("../components/pagination/index.js").then((m) => m.PaginationRoot),
|
|
85
|
+
"Popup.Close": () => import("../components/popup/index.js").then((m) => m.Popup.Close),
|
|
86
|
+
"Popup.Content": () => import("../components/popup/index.js").then((m) => m.Popup.Content),
|
|
87
|
+
"Popup.Root": () => import("../components/popup/index.js").then((m) => m.Popup.Root),
|
|
88
|
+
"Popup.Trigger": () => import("../components/popup/index.js").then((m) => m.Popup.Trigger),
|
|
89
|
+
PopupClose: () => import("../components/popup/index.js").then((m) => m.PopupClose),
|
|
90
|
+
PopupContent: () => import("../components/popup/index.js").then((m) => m.PopupContent),
|
|
91
|
+
PopupTrigger: () => import("../components/popup/index.js").then((m) => m.PopupTrigger),
|
|
92
|
+
Progress: () => import("../components/progress/index.js").then((m) => m.Progress),
|
|
93
|
+
Rating: () => import("../components/rating/index.js").then((m) => m.Rating),
|
|
94
|
+
"Select.Content": () => import("../components/select/index.js").then((m) => m.Select.Content),
|
|
95
|
+
"Select.Group": () => import("../components/select/index.js").then((m) => m.Select.Group),
|
|
96
|
+
"Select.Item": () => import("../components/select/index.js").then((m) => m.Select.Item),
|
|
97
|
+
"Select.Root": () => import("../components/select/index.js").then((m) => m.Select.Root),
|
|
98
|
+
"Select.Separator": () => import("../components/select/index.js").then((m) => m.Select.Separator),
|
|
99
|
+
Skeleton: () => import("../components/skeleton/index.js").then((m) => m.Skeleton),
|
|
100
|
+
Slider: () => import("../components/slider/index.js").then((m) => m.Slider),
|
|
101
|
+
Spinner: () => import("../components/spinner/index.js").then((m) => m.Spinner),
|
|
102
|
+
Switch: () => import("../components/switch/index.js").then((m) => m.Switch),
|
|
103
|
+
"Table.Footer": () => import("../components/table/index.js").then((m) => m.Table.Footer),
|
|
104
|
+
"Table.RowHeader": () => import("../components/table/index.js").then((m) => m.Table.RowHeader),
|
|
105
|
+
"Table.Body": () => import("../components/table/index.js").then((m) => m.Table.Body),
|
|
106
|
+
"Table.Caption": () => import("../components/table/index.js").then((m) => m.Table.Caption),
|
|
107
|
+
"Table.Cell": () => import("../components/table/index.js").then((m) => m.Table.Cell),
|
|
108
|
+
"Table.ColumnHeader": () => import("../components/table/index.js").then((m) => m.Table.ColumnHeader),
|
|
109
|
+
"Table.Header": () => import("../components/table/index.js").then((m) => m.Table.Header),
|
|
110
|
+
"Table.Root": () => import("../components/table/index.js").then((m) => m.Table.Root),
|
|
111
|
+
"Table.Row": () => import("../components/table/index.js").then((m) => m.Table.Row),
|
|
112
|
+
Textarea: () => import("../components/textarea/index.js").then((m) => m.Textarea),
|
|
113
|
+
Toggle: () => import("../components/toggle/index.js").then((m) => m.Toggle),
|
|
114
|
+
"Tooltip.Content": () => import("../components/tooltip/index.js").then((m) => m.TooltipContent),
|
|
115
|
+
"Tooltip.Provider": () => import("../components/tooltip/index.js").then((m) => m.TooltipProvider),
|
|
116
|
+
"Tooltip.Root": () => import("../components/tooltip/index.js").then((m) => m.TooltipRoot),
|
|
117
|
+
"Tooltip.Trigger": () => import("../components/tooltip/index.js").then((m) => m.TooltipTrigger)
|
|
118
|
+
};
|
|
119
|
+
export {
|
|
120
|
+
uiLoaders
|
|
121
|
+
};
|
|
122
|
+
//# sourceMappingURL=loaders.generated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/ai/loaders.generated.ts"],"sourcesContent":["// Generated by packages/catalog/src/build/ai-catalog.ts: run `npm run ai:catalog`. Do not edit.\nimport type { ComponentType } from \"react\";\nimport type { UiType } from \"./catalog.generated.js\";\n\n/** Loads each component part from its component entry, so a document loads only what it uses. */\nexport const uiLoaders: Readonly<Partial<Record<UiType, () => Promise<ComponentType<any>>>>> = {\n Alert: () => import(\"../components/alert/index.js\").then((m) => m.Alert),\n AlertDescription: () => import(\"../components/alert/index.js\").then((m) => m.AlertDescription),\n AlertTitle: () => import(\"../components/alert/index.js\").then((m) => m.AlertTitle),\n AlertModal: () => import(\"../components/alert-modal/index.js\").then((m) => m.AlertModal),\n AlertModalAction: () =>\n import(\"../components/alert-modal/index.js\").then((m) => m.AlertModalAction),\n AlertModalCancel: () =>\n import(\"../components/alert-modal/index.js\").then((m) => m.AlertModalCancel),\n AlertModalContent: () =>\n import(\"../components/alert-modal/index.js\").then((m) => m.AlertModalContent),\n AlertModalTrigger: () =>\n import(\"../components/alert-modal/index.js\").then((m) => m.AlertModalTrigger),\n AspectRatio: () => import(\"../components/aspect-ratio/index.js\").then((m) => m.AspectRatio),\n Avatar: () => import(\"../components/avatar/index.js\").then((m) => m.Avatar),\n Badge: () => import(\"../components/badge/index.js\").then((m) => m.Badge),\n \"Breadcrumb.Item\": () =>\n import(\"../components/breadcrumb/index.js\").then((m) => m.Breadcrumb.Item),\n \"Breadcrumb.Link\": () =>\n import(\"../components/breadcrumb/index.js\").then((m) => m.Breadcrumb.Link),\n \"Breadcrumb.List\": () =>\n import(\"../components/breadcrumb/index.js\").then((m) => m.Breadcrumb.List),\n \"Breadcrumb.Root\": () =>\n import(\"../components/breadcrumb/index.js\").then((m) => m.Breadcrumb.Root),\n \"Breadcrumb.Separator\": () =>\n import(\"../components/breadcrumb/index.js\").then((m) => m.Breadcrumb.Separator),\n Button: () => import(\"../components/button/index.js\").then((m) => m.Button),\n Card: () => import(\"../components/card/index.js\").then((m) => m.Card),\n Checkbox: () => import(\"../components/checkbox/index.js\").then((m) => m.Checkbox),\n ColorPicker: () => import(\"../components/color-picker/index.js\").then((m) => m.ColorPicker),\n DatePicker: () => import(\"../components/date-picker/index.js\").then((m) => m.DatePicker),\n DescriptionDetails: () =>\n import(\"../components/description-list/index.js\").then((m) => m.DescriptionDetails),\n DescriptionList: () =>\n import(\"../components/description-list/index.js\").then((m) => m.DescriptionList),\n DescriptionTerm: () =>\n import(\"../components/description-list/index.js\").then((m) => m.DescriptionTerm),\n \"Drawer.Close\": () => import(\"../components/drawer/index.js\").then((m) => m.DrawerClose),\n \"Drawer.Content\": () => import(\"../components/drawer/index.js\").then((m) => m.DrawerContent),\n \"Drawer.Description\": () =>\n import(\"../components/drawer/index.js\").then((m) => m.DrawerDescription),\n \"Drawer.Handle\": () => import(\"../components/drawer/index.js\").then((m) => m.DrawerHandle),\n \"Drawer.Root\": () => import(\"../components/drawer/index.js\").then((m) => m.DrawerRoot),\n \"Drawer.Title\": () => import(\"../components/drawer/index.js\").then((m) => m.DrawerTitle),\n \"Drawer.Trigger\": () => import(\"../components/drawer/index.js\").then((m) => m.DrawerTrigger),\n DrawerPanel: () => import(\"../components/drawer/index.js\").then((m) => m.DrawerPanel),\n DrawerNativeTrigger: () =>\n import(\"../components/drawer/index.js\").then((m) => m.DrawerNativeTrigger),\n DrawerNativeClose: () => import(\"../components/drawer/index.js\").then((m) => m.DrawerNativeClose),\n DrawerNativeContent: () =>\n import(\"../components/drawer/index.js\").then((m) => m.DrawerNativeContent),\n Empty: () => import(\"../components/empty/index.js\").then((m) => m.Empty),\n EmptyContent: () => import(\"../components/empty/index.js\").then((m) => m.EmptyContent),\n EmptyDescription: () => import(\"../components/empty/index.js\").then((m) => m.EmptyDescription),\n EmptyTitle: () => import(\"../components/empty/index.js\").then((m) => m.EmptyTitle),\n \"Field.Root\": () => import(\"../components/field/index.js\").then((m) => m.Field.Root),\n \"Field.Label\": () => import(\"../components/field/index.js\").then((m) => m.Field.Label),\n \"Field.Control\": () => import(\"../components/field/index.js\").then((m) => m.Field.Control),\n \"Field.Description\": () =>\n import(\"../components/field/index.js\").then((m) => m.Field.Description),\n \"Field.Error\": () => import(\"../components/field/index.js\").then((m) => m.Field.Error),\n Fieldset: () => import(\"../components/fieldset/index.js\").then((m) => m.Fieldset),\n FieldsetLegend: () => import(\"../components/fieldset/index.js\").then((m) => m.FieldsetLegend),\n \"FileUpload.Dropzone\": () =>\n import(\"../components/file-upload/index.js\").then((m) => m.FileUploadDropzone),\n \"FileUpload.HiddenInput\": () =>\n import(\"../components/file-upload/index.js\").then((m) => m.FileUploadHiddenInput),\n \"FileUpload.Item\": () =>\n import(\"../components/file-upload/index.js\").then((m) => m.FileUploadItem),\n \"FileUpload.ItemRemove\": () =>\n import(\"../components/file-upload/index.js\").then((m) => m.FileUploadItemRemove),\n \"FileUpload.List\": () =>\n import(\"../components/file-upload/index.js\").then((m) => m.FileUploadList),\n \"FileUpload.Root\": () =>\n import(\"../components/file-upload/index.js\").then((m) => m.FileUploadRoot),\n \"FileUpload.Trigger\": () =>\n import(\"../components/file-upload/index.js\").then((m) => m.FileUploadTrigger),\n Form: () => import(\"../components/form/index.js\").then((m) => m.Form),\n \"Header.Root\": () => import(\"../components/header/index.js\").then((m) => m.Header.Root),\n Input: () => import(\"../components/input/index.js\").then((m) => m.Input),\n InputGroup: () => import(\"../components/input-group/index.js\").then((m) => m.InputGroup),\n InputGroupAddon: () =>\n import(\"../components/input-group/index.js\").then((m) => m.InputGroupAddon),\n Item: () => import(\"../components/item/index.js\").then((m) => m.Item),\n ItemActions: () => import(\"../components/item/index.js\").then((m) => m.ItemActions),\n ItemContent: () => import(\"../components/item/index.js\").then((m) => m.ItemContent),\n ItemMedia: () => import(\"../components/item/index.js\").then((m) => m.ItemMedia),\n ItemMetadata: () => import(\"../components/item/index.js\").then((m) => m.ItemMetadata),\n Modal: () => import(\"../components/modal/index.js\").then((m) => m.Modal),\n ModalBody: () => import(\"../components/modal/index.js\").then((m) => m.ModalBody),\n ModalClose: () => import(\"../components/modal/index.js\").then((m) => m.ModalClose),\n ModalContent: () => import(\"../components/modal/index.js\").then((m) => m.ModalContent),\n ModalDescription: () => import(\"../components/modal/index.js\").then((m) => m.ModalDescription),\n ModalFooter: () => import(\"../components/modal/index.js\").then((m) => m.ModalFooter),\n ModalGrabber: () => import(\"../components/modal/index.js\").then((m) => m.ModalGrabber),\n ModalHeader: () => import(\"../components/modal/index.js\").then((m) => m.ModalHeader),\n ModalTitle: () => import(\"../components/modal/index.js\").then((m) => m.ModalTitle),\n ModalTrigger: () => import(\"../components/modal/index.js\").then((m) => m.ModalTrigger),\n \"NumberField.Root\": () =>\n import(\"../components/number-field/index.js\").then((m) => m.NumberFieldRoot),\n \"NumberField.Group\": () =>\n import(\"../components/number-field/index.js\").then((m) => m.NumberFieldGroup),\n \"NumberField.Input\": () =>\n import(\"../components/number-field/index.js\").then((m) => m.NumberFieldInput),\n \"NumberField.Increment\": () =>\n import(\"../components/number-field/index.js\").then((m) => m.NumberFieldIncrement),\n \"NumberField.Decrement\": () =>\n import(\"../components/number-field/index.js\").then((m) => m.NumberFieldDecrement),\n \"Pagination.Ellipsis\": () =>\n import(\"../components/pagination/index.js\").then((m) => m.PaginationEllipsis),\n \"Pagination.Item\": () =>\n import(\"../components/pagination/index.js\").then((m) => m.PaginationItem),\n \"Pagination.Link\": () =>\n import(\"../components/pagination/index.js\").then((m) => m.PaginationLink),\n \"Pagination.List\": () =>\n import(\"../components/pagination/index.js\").then((m) => m.PaginationList),\n \"Pagination.Root\": () =>\n import(\"../components/pagination/index.js\").then((m) => m.PaginationRoot),\n \"Popup.Close\": () => import(\"../components/popup/index.js\").then((m) => m.Popup.Close),\n \"Popup.Content\": () => import(\"../components/popup/index.js\").then((m) => m.Popup.Content),\n \"Popup.Root\": () => import(\"../components/popup/index.js\").then((m) => m.Popup.Root),\n \"Popup.Trigger\": () => import(\"../components/popup/index.js\").then((m) => m.Popup.Trigger),\n PopupClose: () => import(\"../components/popup/index.js\").then((m) => m.PopupClose),\n PopupContent: () => import(\"../components/popup/index.js\").then((m) => m.PopupContent),\n PopupTrigger: () => import(\"../components/popup/index.js\").then((m) => m.PopupTrigger),\n Progress: () => import(\"../components/progress/index.js\").then((m) => m.Progress),\n Rating: () => import(\"../components/rating/index.js\").then((m) => m.Rating),\n \"Select.Content\": () => import(\"../components/select/index.js\").then((m) => m.Select.Content),\n \"Select.Group\": () => import(\"../components/select/index.js\").then((m) => m.Select.Group),\n \"Select.Item\": () => import(\"../components/select/index.js\").then((m) => m.Select.Item),\n \"Select.Root\": () => import(\"../components/select/index.js\").then((m) => m.Select.Root),\n \"Select.Separator\": () => import(\"../components/select/index.js\").then((m) => m.Select.Separator),\n Skeleton: () => import(\"../components/skeleton/index.js\").then((m) => m.Skeleton),\n Slider: () => import(\"../components/slider/index.js\").then((m) => m.Slider),\n Spinner: () => import(\"../components/spinner/index.js\").then((m) => m.Spinner),\n Switch: () => import(\"../components/switch/index.js\").then((m) => m.Switch),\n \"Table.Footer\": () => import(\"../components/table/index.js\").then((m) => m.Table.Footer),\n \"Table.RowHeader\": () => import(\"../components/table/index.js\").then((m) => m.Table.RowHeader),\n \"Table.Body\": () => import(\"../components/table/index.js\").then((m) => m.Table.Body),\n \"Table.Caption\": () => import(\"../components/table/index.js\").then((m) => m.Table.Caption),\n \"Table.Cell\": () => import(\"../components/table/index.js\").then((m) => m.Table.Cell),\n \"Table.ColumnHeader\": () =>\n import(\"../components/table/index.js\").then((m) => m.Table.ColumnHeader),\n \"Table.Header\": () => import(\"../components/table/index.js\").then((m) => m.Table.Header),\n \"Table.Root\": () => import(\"../components/table/index.js\").then((m) => m.Table.Root),\n \"Table.Row\": () => import(\"../components/table/index.js\").then((m) => m.Table.Row),\n Textarea: () => import(\"../components/textarea/index.js\").then((m) => m.Textarea),\n Toggle: () => import(\"../components/toggle/index.js\").then((m) => m.Toggle),\n \"Tooltip.Content\": () => import(\"../components/tooltip/index.js\").then((m) => m.TooltipContent),\n \"Tooltip.Provider\": () => import(\"../components/tooltip/index.js\").then((m) => m.TooltipProvider),\n \"Tooltip.Root\": () => import(\"../components/tooltip/index.js\").then((m) => m.TooltipRoot),\n \"Tooltip.Trigger\": () => import(\"../components/tooltip/index.js\").then((m) => m.TooltipTrigger),\n};\n"],"mappings":"AAKO,MAAM,YAAkF;AAAA,EAC7F,OAAO,MAAM,OAAO,8BAA8B,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK;AAAA,EACvE,kBAAkB,MAAM,OAAO,8BAA8B,EAAE,KAAK,CAAC,MAAM,EAAE,gBAAgB;AAAA,EAC7F,YAAY,MAAM,OAAO,8BAA8B,EAAE,KAAK,CAAC,MAAM,E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,cAAc;AAAA,EAC9F,oBAAoB,MAAM,OAAO,gCAAgC,EAAE,KAAK,CAAC,MAAM,EAAE,eAAe;AAAA,EAChG,gBAAgB,MAAM,OAAO,gCAAgC,EAAE,KAAK,CAAC,MAAM,EAAE,WAAW;AAAA,EACxF,mBAAmB,MAAM,OAAO,gCAAgC,EAAE,KAAK,CAAC,MAAM,EAAE,cAAc;AAChG;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type UiNode } from "./catalog.generated.js";
|
|
2
|
+
import type { UiValidationIssue } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Rules JSON Schema cannot express, over a document that already passed the schema:
|
|
5
|
+
* a part sits inside its root, a `fieldId` names the enclosing root, ids are unique, and
|
|
6
|
+
* nesting the HTML parser would rewrite (block content in phrasing elements, a form in a form,
|
|
7
|
+
* a link or label in a link, anything but items in a list) is rejected.
|
|
8
|
+
* `basePath` is the pointer of `root` inside the value the caller validated.
|
|
9
|
+
*/
|
|
10
|
+
export declare function checkRules(root: UiNode, basePath?: string): UiValidationIssue[];
|
|
11
|
+
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/ai/rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,MAAM,EAAe,MAAM,wBAAwB,CAAC;AACzF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAqFpD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAK,GAAG,iBAAiB,EAAE,CAoE3E"}
|
package/dist/ai/rules.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { uiParts } from "./catalog.generated.js";
|
|
2
|
+
const PHRASING_PARENTS = /* @__PURE__ */ new Set([
|
|
3
|
+
"p",
|
|
4
|
+
"h1",
|
|
5
|
+
"h2",
|
|
6
|
+
"h3",
|
|
7
|
+
"h4",
|
|
8
|
+
"h5",
|
|
9
|
+
"h6",
|
|
10
|
+
"a",
|
|
11
|
+
"strong",
|
|
12
|
+
"em",
|
|
13
|
+
"label",
|
|
14
|
+
"legend",
|
|
15
|
+
"dt"
|
|
16
|
+
]);
|
|
17
|
+
const PHRASING = /* @__PURE__ */ new Set(["a", "strong", "em", "label"]);
|
|
18
|
+
const FORMS = ["form", "Form"];
|
|
19
|
+
const LINK_INTERACTIVE = /* @__PURE__ */ new Set(["a", "label"]);
|
|
20
|
+
const LIST_ITEMS = {
|
|
21
|
+
ul: ["li"],
|
|
22
|
+
ol: ["li"],
|
|
23
|
+
dl: ["dt", "dd"]
|
|
24
|
+
};
|
|
25
|
+
function nestingProblem(node, parent) {
|
|
26
|
+
if (parent === void 0) return void 0;
|
|
27
|
+
const parentType = parent.node.type;
|
|
28
|
+
const items = LIST_ITEMS[parentType];
|
|
29
|
+
if (items !== void 0 && !items.includes(node.type)) {
|
|
30
|
+
return `${node.type} cannot be directly inside ${parentType}; ${parentType} takes only ${items.join(" and ")} children`;
|
|
31
|
+
}
|
|
32
|
+
if (PHRASING_PARENTS.has(parentType) && !PHRASING.has(node.type)) {
|
|
33
|
+
return `${node.type} cannot be inside ${parentType}; ${parentType} holds only text and ${[...PHRASING].join(", ")}`;
|
|
34
|
+
}
|
|
35
|
+
if (FORMS.includes(node.type) && FORMS.some((type) => nearest(parent, type) !== void 0)) {
|
|
36
|
+
return `${node.type} cannot be inside another form`;
|
|
37
|
+
}
|
|
38
|
+
if (LINK_INTERACTIVE.has(node.type) && nearest(parent, "a") !== void 0) {
|
|
39
|
+
return `${node.type} cannot be inside a link (a)`;
|
|
40
|
+
}
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
function propsOf(node) {
|
|
44
|
+
return node.props;
|
|
45
|
+
}
|
|
46
|
+
function nearest(from, type) {
|
|
47
|
+
for (let link = from; link !== void 0; link = link.parent) {
|
|
48
|
+
if (link.node.type === type) return link.node;
|
|
49
|
+
}
|
|
50
|
+
return void 0;
|
|
51
|
+
}
|
|
52
|
+
function crumbsOf(parent, node, suffix = "") {
|
|
53
|
+
const types = [];
|
|
54
|
+
for (let link = parent; link !== void 0; link = link.parent) types.push(link.node.type);
|
|
55
|
+
types.reverse();
|
|
56
|
+
types.push(`${node.type}${suffix}`);
|
|
57
|
+
return types.join(" \u203A ");
|
|
58
|
+
}
|
|
59
|
+
function checkRules(root, basePath = "") {
|
|
60
|
+
const issues = [];
|
|
61
|
+
const firstPathOfId = /* @__PURE__ */ new Map();
|
|
62
|
+
const stack = [{ node: root, path: basePath, parent: void 0 }];
|
|
63
|
+
while (stack.length > 0) {
|
|
64
|
+
const { node, path, parent } = stack.pop();
|
|
65
|
+
const props = propsOf(node);
|
|
66
|
+
const rootType = uiParts[node.type].rootType;
|
|
67
|
+
const nesting = nestingProblem(node, parent);
|
|
68
|
+
if (nesting !== void 0) {
|
|
69
|
+
issues.push({ path, breadcrumb: crumbsOf(parent, node), message: nesting });
|
|
70
|
+
}
|
|
71
|
+
if (rootType !== void 0) {
|
|
72
|
+
const enclosing = nearest(parent, rootType);
|
|
73
|
+
if (enclosing === void 0) {
|
|
74
|
+
issues.push({
|
|
75
|
+
path,
|
|
76
|
+
breadcrumb: crumbsOf(parent, node),
|
|
77
|
+
message: `${node.type} must be inside a ${rootType}`,
|
|
78
|
+
allowed: [rootType]
|
|
79
|
+
});
|
|
80
|
+
} else if (typeof props.fieldId === "string") {
|
|
81
|
+
const id = propsOf(enclosing).id;
|
|
82
|
+
if (props.fieldId !== id) {
|
|
83
|
+
issues.push({
|
|
84
|
+
path: `${path}/props/fieldId`,
|
|
85
|
+
breadcrumb: crumbsOf(parent, node, ".props.fieldId"),
|
|
86
|
+
message: `fieldId ${JSON.stringify(props.fieldId)} does not match the id ${JSON.stringify(id)} of the enclosing ${rootType}`,
|
|
87
|
+
allowed: [id]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (typeof props.id === "string") {
|
|
93
|
+
const first = firstPathOfId.get(props.id);
|
|
94
|
+
if (first === void 0) {
|
|
95
|
+
firstPathOfId.set(props.id, path);
|
|
96
|
+
} else {
|
|
97
|
+
issues.push({
|
|
98
|
+
path: `${path}/props/id`,
|
|
99
|
+
breadcrumb: crumbsOf(parent, node, ".props.id"),
|
|
100
|
+
message: `duplicate id ${JSON.stringify(props.id)}; first used at ${first}`
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const children = node.children;
|
|
105
|
+
if (children !== void 0) {
|
|
106
|
+
const link = { node, parent };
|
|
107
|
+
for (let index = children.length - 1; index >= 0; index -= 1) {
|
|
108
|
+
const child = children[index];
|
|
109
|
+
if (typeof child === "object" && child !== null) {
|
|
110
|
+
stack.push({ node: child, path: `${path}/children/${index}`, parent: link });
|
|
111
|
+
} else if (LIST_ITEMS[node.type] !== void 0) {
|
|
112
|
+
issues.push({
|
|
113
|
+
path: `${path}/children/${index}`,
|
|
114
|
+
breadcrumb: `${crumbsOf(parent, node)} \u203A children[${index}]`,
|
|
115
|
+
message: `text cannot be directly inside ${node.type}; wrap it in ${LIST_ITEMS[node.type]?.[0] ?? "an item"}`
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return issues;
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
checkRules
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=rules.js.map
|