@flikk/ui 1.0.0-beta.31 → 1.0.0-beta.32
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 +295 -22
- package/dist/components/ai/AgentRequest/AgentRequest.animations.d.ts +25 -0
- package/dist/components/ai/AgentRequest/AgentRequest.animations.js +81 -0
- package/dist/components/ai/AgentRequest/AgentRequest.d.ts +3 -0
- package/dist/components/ai/AgentRequest/AgentRequest.js +435 -0
- package/dist/components/ai/AgentRequest/AgentRequest.theme.d.ts +2 -0
- package/dist/components/ai/AgentRequest/AgentRequest.theme.js +106 -0
- package/dist/components/ai/AgentRequest/AgentRequest.types.d.ts +241 -0
- package/dist/components/ai/AgentRequest/index.d.ts +3 -0
- package/dist/components/ai/CodeBlock/CodeBlock.theme.js +1 -1
- package/dist/components/ai/PromptInput/PromptInput.js +2 -2
- package/dist/components/ai/PromptInput/PromptInput.theme.js +2 -2
- package/dist/components/ai/PromptSuggestion/PromptSuggestion.theme.js +2 -2
- package/dist/components/ai/Reasoning/Reasoning.js +27 -3
- package/dist/components/ai/Reasoning/Reasoning.theme.d.ts +6 -0
- package/dist/components/ai/Reasoning/Reasoning.theme.js +36 -0
- package/dist/components/ai/Reasoning/Reasoning.types.d.ts +58 -5
- package/dist/components/ai/Reasoning/ReasoningTrace.d.ts +11 -0
- package/dist/components/ai/Reasoning/ReasoningTrace.js +84 -0
- package/dist/components/ai/Reasoning/index.d.ts +2 -1
- package/dist/components/ai/StreamingResponse/AnimatedText.d.ts +7 -0
- package/dist/components/ai/StreamingResponse/AnimatedText.js +8 -7
- package/dist/components/ai/StreamingResponse/MarkdownRenderer.d.ts +5 -0
- package/dist/components/ai/StreamingResponse/MarkdownRenderer.js +4 -4
- package/dist/components/ai/StreamingResponse/StreamingCursor.d.ts +2 -2
- package/dist/components/ai/StreamingResponse/StreamingCursor.js +10 -7
- package/dist/components/ai/StreamingResponse/StreamingResponse.animations.d.ts +10 -0
- package/dist/components/ai/StreamingResponse/StreamingResponse.animations.js +59 -33
- package/dist/components/ai/StreamingResponse/StreamingResponse.js +13 -7
- package/dist/components/ai/StreamingResponse/StreamingResponse.types.d.ts +33 -2
- package/dist/components/ai/StreamingResponse/StreamingSurface.d.ts +13 -0
- package/dist/components/ai/StreamingResponse/StreamingSurface.js +38 -0
- package/dist/components/ai/StreamingResponse/WordAnimationContext.d.ts +5 -0
- package/dist/components/ai/StreamingResponse/WordAnimationContext.js +5 -4
- package/dist/components/ai/StreamingResponse/index.d.ts +4 -2
- package/dist/components/ai/TokenCounter/TokenCounter.theme.js +1 -1
- package/dist/components/ai/index.d.ts +3 -2
- package/dist/components/ai/index.js +4 -0
- package/dist/components/canvas/BaseNode.js +1 -1
- package/dist/components/canvas/CanvasToolbar.js +0 -1
- package/dist/components/canvas/Edge.js +2 -2
- package/dist/components/canvas/NodeControls.js +0 -1
- package/dist/components/canvas/NodeRenderer.js +2 -2
- package/dist/components/charts/ActivityRings/ActivityRings.js +2 -2
- package/dist/components/charts/ActivityRings/ActivityRings.theme.js +1 -1
- package/dist/components/charts/AreaChart/AreaChart.js +3 -3
- package/dist/components/charts/AreaChart/AreaChart.theme.js +3 -3
- package/dist/components/charts/BarChart/BarChart.js +4 -4
- package/dist/components/charts/ComboChart/BarRenderer.js +2 -2
- package/dist/components/charts/ComboChart/BarRenderer.types.d.ts +1 -1
- package/dist/components/charts/ComboChart/ComboChartCanvas.js +1 -1
- package/dist/components/charts/ComboChart/LineRenderer.js +1 -1
- package/dist/components/charts/ComboChart/LineRenderer.types.d.ts +1 -1
- package/dist/components/charts/DonutChart/DonutChart.theme.js +4 -4
- package/dist/components/charts/DonutChart/MultiSegmentDonutChart.theme.js +1 -1
- package/dist/components/charts/Heatmap/Heatmap.js +49 -42
- package/dist/components/charts/Heatmap/Heatmap.theme.d.ts +6 -2
- package/dist/components/charts/Heatmap/Heatmap.theme.js +20 -8
- package/dist/components/charts/Heatmap/Heatmap.types.d.ts +49 -82
- package/dist/components/charts/Heatmap/HeatmapCell.js +30 -81
- package/dist/components/charts/Heatmap/HeatmapLegend.d.ts +7 -6
- package/dist/components/charts/Heatmap/HeatmapLegend.js +6 -6
- package/dist/components/charts/Heatmap/index.d.ts +1 -1
- package/dist/components/charts/Heatmap/utils/heatmapUtils.d.ts +7 -12
- package/dist/components/charts/Heatmap/utils/heatmapUtils.js +16 -61
- package/dist/components/charts/Heatmap/utils/heatmapUtils.test.d.ts +1 -0
- package/dist/components/charts/HorizontalBarChart/HorizontalBarChart.js +1 -1
- package/dist/components/charts/LineChart/LineChart.js +2 -2
- package/dist/components/charts/LollipopChart/LollipopChart.js +1 -1
- package/dist/components/charts/RadarChart/RadarChart.js +1 -1
- package/dist/components/charts/StackedBarChart/StackedBarChart.js +3 -3
- package/dist/components/charts/hooks/useChartAccessibility.js +9 -6
- package/dist/components/charts/index.d.ts +4 -8
- package/dist/components/charts/index.js +2 -4
- package/dist/components/charts/shared/ChartText/ChartText.theme.js +1 -1
- package/dist/components/charts/shared/index.d.ts +1 -1
- package/dist/components/charts/theme/chart.theme.js +3 -3
- package/dist/components/charts/utils/animation-utils.d.ts +12 -7
- package/dist/components/charts/utils/animation-utils.js +19 -19
- package/dist/components/core/Accordion/Accordion.theme.js +1 -1
- package/dist/components/core/Alert/Alert.animations.d.ts +11 -4
- package/dist/components/core/Alert/Alert.animations.js +11 -4
- package/dist/components/core/Alert/Alert.js +16 -2
- package/dist/components/core/Alert/Alert.theme.js +1 -1
- package/dist/components/core/Alert/Alert.types.d.ts +4 -2
- package/dist/components/core/AlertDialog/AlertDialog.js +2 -2
- package/dist/components/core/Avatar/Avatar.theme.js +1 -1
- package/dist/components/core/Badge/Badge.animations.d.ts +0 -5
- package/dist/components/core/Badge/Badge.animations.js +5 -84
- package/dist/components/core/Badge/Badge.d.ts +7 -4
- package/dist/components/core/Badge/Badge.js +27 -64
- package/dist/components/core/Badge/Badge.theme.js +8 -12
- package/dist/components/core/Badge/Badge.types.d.ts +18 -34
- package/dist/components/core/Breadcrumbs/Breadcrumbs.theme.js +4 -4
- package/dist/components/core/Button/Button.js +7 -43
- package/dist/components/core/Button/Button.theme.js +2 -2
- package/dist/components/core/Button/Button.types.d.ts +8 -12
- package/dist/components/core/Button/index.d.ts +0 -2
- package/dist/components/core/Calendar/Calendar.theme.js +1 -1
- package/dist/components/core/Calendar/CalendarMini/CalendarMini.theme.js +2 -2
- package/dist/components/core/Card/Card.js +7 -2
- package/dist/components/core/Card/Card.theme.js +29 -1
- package/dist/components/core/Card/Card.types.d.ts +20 -0
- package/dist/components/core/Card/CardBody.js +9 -1
- package/dist/components/core/Card/CardContext.d.ts +13 -0
- package/dist/components/core/Card/CardContext.js +14 -0
- package/dist/components/core/Card/CardHeader.js +4 -1
- package/dist/components/core/ContextMenu/ContextMenu.theme.js +4 -3
- package/dist/components/core/ContextMenu/ContextMenu.types.d.ts +8 -1
- package/dist/components/core/ContextMenu/ContextMenuSub.d.ts +11 -1
- package/dist/components/core/ContextMenu/ContextMenuSub.js +35 -22
- package/dist/components/core/ContextMenu/ContextMenuSubBody.js +14 -3
- package/dist/components/core/ContextMenu/ContextMenuSubTrigger.js +21 -8
- package/dist/components/core/DragDrop/DragDrop.theme.js +2 -2
- package/dist/components/core/Drawer/Drawer.theme.js +1 -1
- package/dist/components/core/Drawer/DrawerHeader.js +0 -1
- package/dist/components/core/Dropdown/DropdownMenu.js +22 -7
- package/dist/components/core/Link/Link.js +1 -1
- package/dist/components/core/Masonry/Masonry.theme.js +1 -1
- package/dist/components/core/MenuItem/MenuItem.js +2 -1
- package/dist/components/core/MenuItem/MenuItem.theme.js +13 -1
- package/dist/components/core/Message/Message.js +2 -0
- package/dist/components/core/Message/Message.theme.js +3 -3
- package/dist/components/core/Modal/Modal.animations.d.ts +1 -1
- package/dist/components/core/Modal/Modal.animations.js +50 -11
- package/dist/components/core/Modal/Modal.js +5 -1
- package/dist/components/core/Modal/Modal.theme.js +1 -1
- package/dist/components/core/Modal/ModalHeader.js +0 -1
- package/dist/components/core/ModalStack/ModalStackModal.js +3 -1
- package/dist/components/core/NavItem/NavItem.js +3 -2
- package/dist/components/core/NavItem/NavItem.theme.js +1 -1
- package/dist/components/core/OfflineIndicator/OfflineIndicator.theme.js +4 -2
- package/dist/components/core/PageHeading/PageHeading.theme.js +1 -1
- package/dist/components/core/Pagination/Pagination.theme.js +2 -2
- package/dist/components/core/Pill/Pill.js +2 -1
- package/dist/components/core/Pill/Pill.theme.js +4 -2
- package/dist/components/core/Popover/PopoverBody.js +16 -5
- package/dist/components/core/Progress/Progress.d.ts +0 -25
- package/dist/components/core/Progress/Progress.js +79 -11
- package/dist/components/core/Progress/Progress.theme.js +17 -0
- package/dist/components/core/Progress/Progress.types.d.ts +47 -1
- package/dist/components/core/Rating/Rating.theme.js +1 -1
- package/dist/components/core/Rating/Rating.types.d.ts +3 -2
- package/dist/components/core/ScrollArea/ScrollArea.js +1 -1
- package/dist/components/core/ScrollArea/ScrollArea.theme.js +1 -1
- package/dist/components/core/Segmented/Segmented.theme.js +3 -3
- package/dist/components/core/Segmented/SegmentedContext.js +1 -0
- package/dist/components/core/Sidebar/Sidebar.js +5 -2
- package/dist/components/core/Sidebar/Sidebar.theme.js +2 -2
- package/dist/components/core/Sidebar/SidebarContent.js +1 -1
- package/dist/components/core/Sidebar/SidebarHeader.js +1 -1
- package/dist/components/core/Sidebar/SidebarSearch.js +2 -2
- package/dist/components/core/Sidebar/SidebarToggle.js +1 -1
- package/dist/components/core/Sidebar/SidebarUserProfile.js +1 -1
- package/dist/components/core/Sortable/Sortable.theme.js +1 -1
- package/dist/components/core/Tabs/Tabs.theme.js +1 -1
- package/dist/components/core/Tag/Tag.theme.js +1 -1
- package/dist/components/core/Toast/ToastProvider.js +1 -1
- package/dist/components/core/Tree/Tree.theme.js +1 -1
- package/dist/components/core/index.d.ts +0 -2
- package/dist/components/core/index.js +0 -4
- package/dist/components/core/shared/ChartTooltip/ChartTooltip.animations.d.ts +4 -0
- package/dist/components/core/shared/ChartTooltip/ChartTooltip.animations.js +20 -0
- package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.js +1 -1
- package/dist/components/core/shared/Ripple.d.ts +16 -0
- package/dist/components/core/shared/Ripple.js +141 -0
- package/dist/components/data-display/GanttChart/GanttChart.theme.js +6 -6
- package/dist/components/data-display/GanttChart/GanttTaskBar.js +1 -1
- package/dist/components/data-display/GanttChart/GanttTimelineHeader.js +1 -1
- package/dist/components/data-display/GanttChart/GanttToolbar.js +0 -1
- package/dist/components/data-display/KPI/KPI.js +11 -20
- package/dist/components/data-display/KPI/KPI.theme.js +8 -4
- package/dist/components/data-display/Metric/Metric.theme.js +4 -4
- package/dist/components/data-display/Table/Table.theme.js +2 -2
- package/dist/components/data-display/Table/TableColumnManager.js +1 -2
- package/dist/components/data-display/Table/TableContext.js +1 -0
- package/dist/components/data-display/Table/TableFilter.js +9 -2
- package/dist/components/data-display/Table/TableSelectionHeader.js +1 -1
- package/dist/components/data-display/Timeline/Timeline.theme.js +1 -1
- package/dist/components/effects/CustomCursor/CustomCursor.d.ts +1 -1
- package/dist/components/effects/CustomCursor/CustomCursor.js +1 -1
- package/dist/components/effects/CustomCursor/CustomCursor.theme.js +4 -4
- package/dist/components/effects/Neumorphic/InsetCircleButton.js +1 -1
- package/dist/components/effects/Overlay/Overlay.js +7 -3
- package/dist/components/effects/index.d.ts +0 -32
- package/dist/components/effects/index.js +0 -16
- package/dist/components/effects/shared/ShaderCanvas/ShaderCanvas.d.ts +0 -2
- package/dist/components/effects/shared/ShaderCanvas/ShaderCanvas.js +1 -93
- package/dist/components/effects/shared/ShaderCanvas/ShaderCanvas.types.d.ts +0 -10
- package/dist/components/effects/shared/ShaderCanvas/index.d.ts +1 -1
- package/dist/components/effects/shared/index.d.ts +1 -3
- package/dist/components/effects/shared/shaderNoise.glsl.d.ts +1 -1
- package/dist/components/effects/shared/shaderNoise.glsl.js +2 -11
- package/dist/components/forms/Checkbox/Checkbox.theme.js +1 -1
- package/dist/components/forms/ColorPicker/ColorPickerHeader.js +1 -1
- package/dist/components/forms/ColorPicker/ColorPickerImage.js +1 -1
- package/dist/components/forms/Combobox/Combobox.js +2 -0
- package/dist/components/forms/DateRangePicker/DateRangePicker.theme.js +1 -1
- package/dist/components/forms/DateRangePicker/DateRangePickerContext.js +1 -0
- package/dist/components/forms/FileUpload/FileUpload.theme.js +2 -2
- package/dist/components/forms/FileUpload/FileUploadProgress.theme.js +1 -1
- package/dist/components/forms/InputAddress/InputAddress.types.d.ts +2 -2
- package/dist/components/forms/Radio/Radio.theme.js +1 -1
- package/dist/components/forms/RichTextEditor/RichTextEditor.d.ts +12 -16
- package/dist/components/forms/RichTextEditor/RichTextEditor.js +165 -1680
- package/dist/components/forms/RichTextEditor/RichTextEditor.theme.d.ts +12 -56
- package/dist/components/forms/RichTextEditor/RichTextEditor.theme.js +60 -118
- package/dist/components/forms/RichTextEditor/RichTextEditor.types.d.ts +62 -126
- package/dist/components/forms/RichTextEditor/RichTextLinkField.d.ts +18 -0
- package/dist/components/forms/RichTextEditor/RichTextLinkField.js +46 -0
- package/dist/components/forms/RichTextEditor/RichTextToolbar.d.ts +15 -0
- package/dist/components/forms/RichTextEditor/RichTextToolbar.js +93 -0
- package/dist/components/forms/RichTextEditor/editorCommands.d.ts +50 -0
- package/dist/components/forms/RichTextEditor/editorCommands.js +58 -0
- package/dist/components/forms/RichTextEditor/editorState.d.ts +19 -0
- package/dist/components/forms/RichTextEditor/editorState.js +103 -0
- package/dist/components/forms/RichTextEditor/index.d.ts +5 -3
- package/dist/components/forms/RichTextEditor/sanitizeHtml.d.ts +38 -0
- package/dist/components/forms/RichTextEditor/sanitizeHtml.js +179 -0
- package/dist/components/forms/RichTextEditor/sanitizeHtml.test.d.ts +1 -0
- package/dist/components/forms/Select/Select.js +4 -4
- package/dist/components/forms/Select/Select.types.d.ts +70 -7
- package/dist/components/forms/Select/useSelectState.d.ts +9 -3
- package/dist/components/forms/Select/useSelectState.js +4 -1
- package/dist/components/forms/SelectableCard/SelectableCard.js +2 -1
- package/dist/components/forms/SelectableCard/SelectableCard.theme.js +1 -1
- package/dist/components/forms/Switch/Switch.theme.js +2 -2
- package/dist/components/forms/TimePicker/TimePicker.theme.js +1 -1
- package/dist/components/forms/TimePicker/TimePickerTrigger.js +1 -1
- package/dist/components/forms/forms.theme.js +19 -5
- package/dist/components/forms/index.js +1 -0
- package/dist/components/generative/FormShell.d.ts +22 -0
- package/dist/components/generative/FormShell.js +102 -0
- package/dist/components/generative/GenerativeView.d.ts +52 -1
- package/dist/components/generative/GenerativeView.js +203 -11
- package/dist/components/generative/actions.d.ts +5 -0
- package/dist/components/generative/ai-sdk/index.d.ts +1 -0
- package/dist/components/generative/ai-sdk/index.js +1 -0
- package/dist/components/generative/ai-sdk/useGenerativeChat.d.ts +52 -0
- package/dist/components/generative/ai-sdk/useGenerativeChat.js +73 -0
- package/dist/components/generative/ai-sdk/useGenerativeChat.test.d.ts +1 -0
- package/dist/components/generative/fieldBinding.d.ts +31 -0
- package/dist/components/generative/fieldBinding.js +33 -0
- package/dist/components/generative/fieldBinding.test.d.ts +1 -0
- package/dist/components/generative/formScope.d.ts +71 -0
- package/dist/components/generative/formScope.js +135 -0
- package/dist/components/generative/index.d.ts +4 -0
- package/dist/components/generative/index.js +4 -0
- package/dist/components/generative/registry.d.ts +2 -0
- package/dist/components/generative/registry.js +10 -10
- package/dist/components/generative/schema.generated.js +178 -292
- package/dist/components/generative/toToolResult.d.ts +21 -0
- package/dist/components/generative/toToolResult.js +15 -0
- package/dist/components/generative/toToolResult.test.d.ts +1 -0
- package/dist/components/generative/validate.d.ts +10 -1
- package/dist/components/generative/validate.js +126 -11
- package/dist/components/layout/Grid/Grid.js +1 -0
- package/dist/components/layout/Section/Section.theme.js +1 -1
- package/dist/components/layout/Stack/Stack.js +1 -0
- package/dist/generative.schema.json +178 -292
- package/dist/index.js +1 -4
- package/dist/registry.json +2599 -2375
- package/dist/shadcn-compat.css +5 -5
- package/dist/styles/theme.test.d.ts +1 -0
- package/dist/styles.css +1 -1
- package/dist/test/render.d.ts +17 -0
- package/dist/themes/precision.css +232 -0
- package/dist/tools.json +179 -294
- package/dist/utils/index.d.ts +0 -1
- package/package.json +31 -1
- package/src/global.scss +21 -28
- package/src/styles/theme.css +124 -41
- package/src/styles/theme.test.ts +119 -0
- package/tailwind.preset.cjs +30 -20
- package/dist/components/charts/FunnelChart/FunnelChart.animations.d.ts +0 -35
- package/dist/components/charts/FunnelChart/FunnelChart.animations.js +0 -59
- package/dist/components/charts/FunnelChart/FunnelChart.d.ts +0 -8
- package/dist/components/charts/FunnelChart/FunnelChart.js +0 -410
- package/dist/components/charts/FunnelChart/FunnelChart.theme.d.ts +0 -2
- package/dist/components/charts/FunnelChart/FunnelChart.theme.js +0 -12
- package/dist/components/charts/FunnelChart/FunnelChart.types.d.ts +0 -105
- package/dist/components/charts/FunnelChart/index.d.ts +0 -4
- package/dist/components/charts/ScatterPlot/ScatterPlot.d.ts +0 -9
- package/dist/components/charts/ScatterPlot/ScatterPlot.js +0 -208
- package/dist/components/charts/ScatterPlot/ScatterPlot.theme.d.ts +0 -18
- package/dist/components/charts/ScatterPlot/ScatterPlot.theme.js +0 -42
- package/dist/components/charts/ScatterPlot/ScatterPlot.types.d.ts +0 -60
- package/dist/components/charts/ScatterPlot/ScatterPlot.types.js +0 -19
- package/dist/components/charts/ScatterPlot/index.d.ts +0 -3
- package/dist/components/core/Button/Button.ripple.d.ts +0 -71
- package/dist/components/core/Button/Button.ripple.js +0 -236
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.d.ts +0 -4
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.theme.d.ts +0 -12
- package/dist/components/core/Calendar/CalendarEvent/CalendarEvent.types.d.ts +0 -23
- package/dist/components/core/Calendar/CalendarEvent/index.d.ts +0 -2
- package/dist/components/core/CardStack/CardStack.animations.d.ts +0 -47
- package/dist/components/core/CardStack/CardStack.d.ts +0 -3
- package/dist/components/core/CardStack/CardStack.js +0 -187
- package/dist/components/core/CardStack/CardStack.theme.d.ts +0 -6
- package/dist/components/core/CardStack/CardStack.theme.js +0 -33
- package/dist/components/core/CardStack/CardStack.types.d.ts +0 -139
- package/dist/components/core/CardStack/index.d.ts +0 -7
- package/dist/components/core/Carousel/Carousel.d.ts +0 -3
- package/dist/components/core/Carousel/Carousel.js +0 -83
- package/dist/components/core/Carousel/Carousel.theme.d.ts +0 -10
- package/dist/components/core/Carousel/Carousel.theme.js +0 -20
- package/dist/components/core/Carousel/Carousel.types.d.ts +0 -113
- package/dist/components/core/Carousel/CarouselBody.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselBody.js +0 -59
- package/dist/components/core/Carousel/CarouselContext.d.ts +0 -3
- package/dist/components/core/Carousel/CarouselContext.js +0 -13
- package/dist/components/core/Carousel/CarouselItem.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselItem.js +0 -11
- package/dist/components/core/Carousel/CarouselNext.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselNext.js +0 -16
- package/dist/components/core/Carousel/CarouselPrevious.d.ts +0 -4
- package/dist/components/core/Carousel/CarouselPrevious.js +0 -16
- package/dist/components/core/Carousel/index.d.ts +0 -3
- package/dist/components/effects/ColorPanels/ColorPanels.d.ts +0 -8
- package/dist/components/effects/ColorPanels/ColorPanels.js +0 -66
- package/dist/components/effects/ColorPanels/ColorPanels.shaders.d.ts +0 -12
- package/dist/components/effects/ColorPanels/ColorPanels.shaders.js +0 -218
- package/dist/components/effects/ColorPanels/ColorPanels.types.d.ts +0 -29
- package/dist/components/effects/ColorPanels/ColorPanels.types.js +0 -3
- package/dist/components/effects/ColorPanels/index.d.ts +0 -2
- package/dist/components/effects/FlutedGlass/FlutedGlass.d.ts +0 -9
- package/dist/components/effects/FlutedGlass/FlutedGlass.js +0 -80
- package/dist/components/effects/FlutedGlass/FlutedGlass.shaders.d.ts +0 -12
- package/dist/components/effects/FlutedGlass/FlutedGlass.shaders.js +0 -335
- package/dist/components/effects/FlutedGlass/FlutedGlass.types.d.ts +0 -61
- package/dist/components/effects/FlutedGlass/FlutedGlass.types.js +0 -16
- package/dist/components/effects/FlutedGlass/index.d.ts +0 -3
- package/dist/components/effects/GlassEffect/GlassEffect.d.ts +0 -15
- package/dist/components/effects/GlassEffect/GlassEffect.js +0 -38
- package/dist/components/effects/GlassEffect/GlassEffect.types.d.ts +0 -19
- package/dist/components/effects/GlassEffect/index.d.ts +0 -2
- package/dist/components/effects/GlassSurface/GlassSurface.d.ts +0 -8
- package/dist/components/effects/GlassSurface/GlassSurface.js +0 -250
- package/dist/components/effects/GlassSurface/GlassSurface.types.d.ts +0 -66
- package/dist/components/effects/GlassSurface/index.d.ts +0 -2
- package/dist/components/effects/GodRays/GodRays.d.ts +0 -8
- package/dist/components/effects/GodRays/GodRays.js +0 -68
- package/dist/components/effects/GodRays/GodRays.shaders.d.ts +0 -10
- package/dist/components/effects/GodRays/GodRays.shaders.js +0 -128
- package/dist/components/effects/GodRays/GodRays.types.d.ts +0 -25
- package/dist/components/effects/GodRays/GodRays.types.js +0 -3
- package/dist/components/effects/GodRays/index.d.ts +0 -2
- package/dist/components/effects/GridPattern/GridPattern.d.ts +0 -18
- package/dist/components/effects/GridPattern/GridPattern.js +0 -65
- package/dist/components/effects/GridPattern/GridPattern.types.d.ts +0 -47
- package/dist/components/effects/GridPattern/index.d.ts +0 -2
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.d.ts +0 -10
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.js +0 -78
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.shaders.d.ts +0 -22
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.shaders.js +0 -239
- package/dist/components/effects/HalftoneCmyk/HalftoneCmyk.types.d.ts +0 -52
- package/dist/components/effects/HalftoneCmyk/index.d.ts +0 -2
- package/dist/components/effects/HalftoneDots/HalftoneDots.d.ts +0 -9
- package/dist/components/effects/HalftoneDots/HalftoneDots.js +0 -68
- package/dist/components/effects/HalftoneDots/HalftoneDots.shaders.d.ts +0 -13
- package/dist/components/effects/HalftoneDots/HalftoneDots.shaders.js +0 -296
- package/dist/components/effects/HalftoneDots/HalftoneDots.types.d.ts +0 -43
- package/dist/components/effects/HalftoneDots/HalftoneDots.types.js +0 -12
- package/dist/components/effects/HalftoneDots/index.d.ts +0 -3
- package/dist/components/effects/ImageDithering/ImageDithering.d.ts +0 -9
- package/dist/components/effects/ImageDithering/ImageDithering.js +0 -68
- package/dist/components/effects/ImageDithering/ImageDithering.shaders.d.ts +0 -12
- package/dist/components/effects/ImageDithering/ImageDithering.shaders.js +0 -117
- package/dist/components/effects/ImageDithering/ImageDithering.types.d.ts +0 -30
- package/dist/components/effects/ImageDithering/ImageDithering.types.js +0 -8
- package/dist/components/effects/ImageDithering/index.d.ts +0 -3
- package/dist/components/effects/MagneticElement/MagneticElement.d.ts +0 -30
- package/dist/components/effects/MagneticElement/MagneticElement.js +0 -111
- package/dist/components/effects/MagneticElement/MagneticElement.types.d.ts +0 -44
- package/dist/components/effects/MagneticElement/index.d.ts +0 -2
- package/dist/components/effects/Metaballs/Metaballs.d.ts +0 -8
- package/dist/components/effects/Metaballs/Metaballs.js +0 -59
- package/dist/components/effects/Metaballs/Metaballs.shaders.d.ts +0 -10
- package/dist/components/effects/Metaballs/Metaballs.shaders.js +0 -102
- package/dist/components/effects/Metaballs/Metaballs.types.d.ts +0 -16
- package/dist/components/effects/Metaballs/Metaballs.types.js +0 -3
- package/dist/components/effects/Metaballs/index.d.ts +0 -2
- package/dist/components/effects/PaperTexture/PaperTexture.d.ts +0 -9
- package/dist/components/effects/PaperTexture/PaperTexture.js +0 -61
- package/dist/components/effects/PaperTexture/PaperTexture.shaders.d.ts +0 -22
- package/dist/components/effects/PaperTexture/PaperTexture.shaders.js +0 -145
- package/dist/components/effects/PaperTexture/PaperTexture.types.d.ts +0 -19
- package/dist/components/effects/PaperTexture/index.d.ts +0 -2
- package/dist/components/effects/PulsingBorder/PulsingBorder.d.ts +0 -27
- package/dist/components/effects/PulsingBorder/PulsingBorder.js +0 -174
- package/dist/components/effects/PulsingBorder/PulsingBorder.shaders.d.ts +0 -14
- package/dist/components/effects/PulsingBorder/PulsingBorder.shaders.js +0 -258
- package/dist/components/effects/PulsingBorder/PulsingBorder.types.d.ts +0 -75
- package/dist/components/effects/PulsingBorder/PulsingBorder.types.js +0 -3
- package/dist/components/effects/PulsingBorder/index.d.ts +0 -2
- package/dist/components/effects/SmokeRing/SmokeRing.d.ts +0 -8
- package/dist/components/effects/SmokeRing/SmokeRing.js +0 -62
- package/dist/components/effects/SmokeRing/SmokeRing.shaders.d.ts +0 -14
- package/dist/components/effects/SmokeRing/SmokeRing.shaders.js +0 -130
- package/dist/components/effects/SmokeRing/SmokeRing.types.d.ts +0 -22
- package/dist/components/effects/SmokeRing/SmokeRing.types.js +0 -3
- package/dist/components/effects/SmokeRing/index.d.ts +0 -2
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.d.ts +0 -9
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.js +0 -59
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.shaders.d.ts +0 -14
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.shaders.js +0 -129
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.types.d.ts +0 -23
- package/dist/components/effects/StaticGradientMesh/StaticGradientMesh.types.js +0 -3
- package/dist/components/effects/StaticGradientMesh/index.d.ts +0 -2
- package/dist/components/effects/Water/Water.d.ts +0 -9
- package/dist/components/effects/Water/Water.js +0 -65
- package/dist/components/effects/Water/Water.shaders.d.ts +0 -11
- package/dist/components/effects/Water/Water.shaders.js +0 -123
- package/dist/components/effects/Water/Water.types.d.ts +0 -25
- package/dist/components/effects/Water/index.d.ts +0 -2
- package/dist/components/effects/shared/bayerMatrices.glsl.d.ts +0 -10
- package/dist/components/effects/shared/bayerMatrices.glsl.js +0 -44
- package/dist/components/effects/shared/imageUV.glsl.d.ts +0 -12
- package/dist/components/effects/shared/imageUV.glsl.js +0 -26
- package/dist/components/forms/RichTextEditor/RichTextEditor.animations.d.ts +0 -7
- package/dist/components/forms/RichTextEditor/RichTextEditor.animations.js +0 -32
- package/dist/utils/calendarUtils.d.ts +0 -60
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.theme.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.theme.js +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltip.types.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/ChartTooltipContent.d.ts +0 -0
- /package/dist/components/{charts → core}/shared/ChartTooltip/index.d.ts +0 -0
|
@@ -6,7 +6,63 @@ import { defaultRegistry, CardShell } from './registry.js';
|
|
|
6
6
|
import { applyResolvers } from './resolvers.js';
|
|
7
7
|
import { SKELETON_NODE } from './streaming.js';
|
|
8
8
|
import { bindActionProps } from './actions.js';
|
|
9
|
+
import { getFieldBinding } from './fieldBinding.js';
|
|
10
|
+
import { useFormScope } from './formScope.js';
|
|
9
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Which props each curated field component actually DECLARES, and may
|
|
14
|
+
* therefore be handed. NOT every FIELD_BINDINGS entry supports all three —
|
|
15
|
+
* hand-verified against each component's OWN Props interface, not a sibling's
|
|
16
|
+
* (mirrors the same "don't infer from the name" caution as `fieldBinding.ts`'s
|
|
17
|
+
* own table):
|
|
18
|
+
* - Select/Combobox/Switch/Slider/TimePicker/InputTag accept `state` (for
|
|
19
|
+
* border styling) but declare NO `errorMessage` prop at all.
|
|
20
|
+
* - Checkbox accepts `state` but NOT `errorMessage` — `errorMessage` exists
|
|
21
|
+
* only on the separate `CheckboxGroupProps` (`Checkbox.Group`), not on
|
|
22
|
+
* `CheckboxProps` (what's actually registered/rendered here). Checkbox.tsx
|
|
23
|
+
* destructures known props and spreads the rest onto the native `<input>`
|
|
24
|
+
* (Checkbox.tsx:35,115), so this one is a real, reproducible DOM leak if
|
|
25
|
+
* gotten wrong, not a hypothetical — verified by reverting this row and
|
|
26
|
+
* confirming GenerativeView.test.tsx's Checkbox pinning test fails.
|
|
27
|
+
* - Rating has none of the three: it's a Core rating widget, not a
|
|
28
|
+
* FORMS_STANDARDS component.
|
|
29
|
+
* Forwarding a prop a component doesn't declare reaches the DOM as an
|
|
30
|
+
* unrecognized attribute (most of these spread unknown rest props onto
|
|
31
|
+
* their root element) and React logs it — see GenerativeView.test.tsx's
|
|
32
|
+
* "does not forward errorMessage/state to a control that doesn't declare
|
|
33
|
+
* them" tests (Switch and Checkbox each get their own).
|
|
34
|
+
*
|
|
35
|
+
* 🔴 `required` is on this table for FORWARDING ONLY. It is separately an
|
|
36
|
+
* ENGINE-SEMANTIC prop: `node.props.required` is read below to register the
|
|
37
|
+
* field's required-ness with the FormScope, which is what blocks submit —
|
|
38
|
+
* that happens for all 13 regardless of this table, and is why all 13 must
|
|
39
|
+
* declare `required` in the generated schema (see `REQUIRED_PROP` in
|
|
40
|
+
* packages/mcp/scripts/generativeManifest.ts). The four that decline it here
|
|
41
|
+
* (InputOTP/InputCounter/InputTag/Rating) extend
|
|
42
|
+
* `HTMLAttributes<HTMLDivElement>` and declare no `required` of their own, so
|
|
43
|
+
* forwarding would paint an invalid `required` attribute onto a `<div>` and
|
|
44
|
+
* buy nothing. Their required-ness is still enforced, and surfaced to the
|
|
45
|
+
* user by `FormShell`'s error summary rather than a per-field indicator.
|
|
46
|
+
* 🔴 The forwarding strip below is UNCONDITIONAL — it runs for every node,
|
|
47
|
+
* not only ones with a `name`/binding. A `required` prop with no `name` at
|
|
48
|
+
* all never registers with the scope, but it still rides along in `hydrated`
|
|
49
|
+
* and would otherwise reach a component's root element untouched.
|
|
50
|
+
*/
|
|
51
|
+
const FIELD_PROP_SUPPORT = {
|
|
52
|
+
Input: { state: true, errorMessage: true, required: true },
|
|
53
|
+
Textarea: { state: true, errorMessage: true, required: true },
|
|
54
|
+
Select: { state: true, errorMessage: false, required: true },
|
|
55
|
+
Combobox: { state: true, errorMessage: false, required: true },
|
|
56
|
+
Checkbox: { state: true, errorMessage: false, required: true },
|
|
57
|
+
Switch: { state: true, errorMessage: false, required: true },
|
|
58
|
+
Slider: { state: true, errorMessage: false, required: true },
|
|
59
|
+
InputOTP: { state: true, errorMessage: true, required: false },
|
|
60
|
+
TimePicker: { state: true, errorMessage: false, required: true },
|
|
61
|
+
InputDate: { state: true, errorMessage: true, required: true },
|
|
62
|
+
InputCounter: { state: true, errorMessage: true, required: false },
|
|
63
|
+
InputTag: { state: true, errorMessage: false, required: false },
|
|
64
|
+
Rating: { state: false, errorMessage: false, required: false },
|
|
65
|
+
};
|
|
10
66
|
const placeholderStyle = "rounded-lg border border-dashed border-[var(--color-border-secondary)] " +
|
|
11
67
|
"bg-[var(--color-surface-sunken)] p-3 text-xs text-[var(--color-text-muted)]";
|
|
12
68
|
/** The model asked for a component we didn't register — render, don't throw. */
|
|
@@ -43,23 +99,56 @@ class NodeBoundary extends React__default.Component {
|
|
|
43
99
|
return this.props.children;
|
|
44
100
|
}
|
|
45
101
|
}
|
|
46
|
-
function NodeRenderer({ node, registry, inShell, dispatch, }) {
|
|
47
|
-
var _a, _b, _c;
|
|
102
|
+
function NodeRenderer({ node, registry, inShell, dispatch, path, values, defaultValues, onFormValuesChange, }) {
|
|
103
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
104
|
+
const scope = useFormScope();
|
|
105
|
+
const fieldName = typeof ((_a = node.props) === null || _a === void 0 ? void 0 : _a.name) === "string" ? node.props.name : undefined;
|
|
106
|
+
const binding = fieldName ? getFieldBinding(node.component) : undefined;
|
|
107
|
+
const specSeed = binding
|
|
108
|
+
? ((_c = (_b = node.props) === null || _b === void 0 ? void 0 : _b[binding.valueProp]) !== null && _c !== void 0 ? _c : (binding.defaultValueProp
|
|
109
|
+
? (_d = node.props) === null || _d === void 0 ? void 0 : _d[binding.defaultValueProp]
|
|
110
|
+
: undefined))
|
|
111
|
+
: undefined;
|
|
112
|
+
// Registration is an effect, not a render side effect: a field that
|
|
113
|
+
// disappears when the model re-emits a different spec must stop
|
|
114
|
+
// contributing its stale value to the next submit. The seed (spec value,
|
|
115
|
+
// or the binding's "empty") is handed to the scope rather than committed
|
|
116
|
+
// here via `setValue` — `formScope`'s `register` commits it internally
|
|
117
|
+
// without notifying `onValuesChange`, since mounting a field isn't a
|
|
118
|
+
// user-driven change (see formScope.tsx).
|
|
119
|
+
const required = ((_e = node.props) === null || _e === void 0 ? void 0 : _e.required) === true;
|
|
120
|
+
// The field's own label, handed to the scope purely so `FormShell`'s error
|
|
121
|
+
// summary can name a blocked field the way the user sees it rather than by
|
|
122
|
+
// its submission key ("Email address", not "email_address").
|
|
123
|
+
const fieldLabel = typeof ((_f = node.props) === null || _f === void 0 ? void 0 : _f.label) === "string" ? node.props.label : undefined;
|
|
124
|
+
React__default.useEffect(() => {
|
|
125
|
+
if (!scope || !fieldName || !binding)
|
|
126
|
+
return;
|
|
127
|
+
scope.register(fieldName, { required, binding, label: fieldLabel, seed: specSeed !== null && specSeed !== void 0 ? specSeed : binding.empty });
|
|
128
|
+
return () => scope.unregister(fieldName);
|
|
129
|
+
// `specSeed` is intentionally omitted from the deps: it's read straight
|
|
130
|
+
// from `node.props` for this same field/binding pair, so it's already
|
|
131
|
+
// implied by `fieldName`/`binding` being unchanged — and `register`
|
|
132
|
+
// itself only ever applies a seed once (it no-ops once the scope holds
|
|
133
|
+
// a value for the name), so re-deriving it on an unrelated re-render
|
|
134
|
+
// would be a no-op anyway.
|
|
135
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
136
|
+
}, [scope, fieldName, binding, required, fieldLabel]);
|
|
48
137
|
if (node.component === SKELETON_NODE)
|
|
49
138
|
return jsx(SkeletonPlaceholder, { props: node.props });
|
|
50
139
|
const entry = registry.components[node.component];
|
|
51
140
|
if (!entry)
|
|
52
141
|
return jsx(UnknownNode, { name: node.component });
|
|
53
|
-
const hydrated = applyResolvers(((
|
|
142
|
+
const hydrated = applyResolvers(((_g = node.props) !== null && _g !== void 0 ? _g : {}), registry.resolvers, { icons: registry.icons, node });
|
|
54
143
|
const isContainer = entry.kind === "container";
|
|
55
|
-
if (process.env.NODE_ENV !== "production" && !isContainer && ((
|
|
144
|
+
if (process.env.NODE_ENV !== "production" && !isContainer && ((_h = node.children) === null || _h === void 0 ? void 0 : _h.length)) {
|
|
56
145
|
console.warn(`[GenerativeView]: "${node.component}" is not a container — its children are ignored`);
|
|
57
146
|
}
|
|
58
147
|
const childInShell = entry.providesShell ? true : inShell;
|
|
59
|
-
const children = isContainer && ((
|
|
148
|
+
const children = isContainer && ((_j = node.children) === null || _j === void 0 ? void 0 : _j.length)
|
|
60
149
|
? node.children.map((child, index) => {
|
|
61
|
-
var _a;
|
|
62
|
-
return (jsx(NodeBoundary, { name: child.component, children: jsx(NodeRenderer, { node: child, registry: registry, inShell: childInShell, dispatch: dispatch }) }, (
|
|
150
|
+
var _a, _b;
|
|
151
|
+
return (jsx(NodeBoundary, { name: child.component, children: jsx(NodeRenderer, { node: child, registry: registry, inShell: childInShell, dispatch: dispatch, path: `${path}.${(_a = child.id) !== null && _a !== void 0 ? _a : index}`, values: values, defaultValues: defaultValues, onFormValuesChange: onFormValuesChange }) }, (_b = child.id) !== null && _b !== void 0 ? _b : index));
|
|
63
152
|
})
|
|
64
153
|
: undefined;
|
|
65
154
|
// Shell-wrapped leaves: title/subtitle belong to the shell, not the component.
|
|
@@ -78,6 +167,89 @@ function NodeRenderer({ node, registry, inShell, dispatch, }) {
|
|
|
78
167
|
componentProps = bound.props;
|
|
79
168
|
unboundClick = bound.unboundClick;
|
|
80
169
|
}
|
|
170
|
+
// `required` is forwarded ONLY to a component whose FIELD_PROP_SUPPORT
|
|
171
|
+
// entry declares it — those need it for their own native `required`
|
|
172
|
+
// attribute and their FormLabel asterisk/"(required)" indicator (WCAG
|
|
173
|
+
// 3.3.2 — a required field must be identifiable before submit, not just
|
|
174
|
+
// after a rejected one). `FormShell` renders `<form noValidate>`, so the
|
|
175
|
+
// native attribute never interferes with `scope.submit()`'s own required
|
|
176
|
+
// check. This strip is UNCONDITIONAL — it must run whether or not this
|
|
177
|
+
// node has a `name`/`binding` at all: a node can carry `required` with no
|
|
178
|
+
// `name` (the field never registers, but `required` still rode along in
|
|
179
|
+
// `hydrated`) or a `name` for a component with no binding, and either way
|
|
180
|
+
// the component's own root element (e.g. Rating's `<div role="slider">`)
|
|
181
|
+
// must never receive an attribute it doesn't declare. Enforcement is
|
|
182
|
+
// unaffected either way: `node.props.required` was already read above and
|
|
183
|
+
// registered with the scope regardless of whether it survives forwarding.
|
|
184
|
+
if (!((_k = FIELD_PROP_SUPPORT[node.component]) === null || _k === void 0 ? void 0 : _k.required))
|
|
185
|
+
delete componentProps.required;
|
|
186
|
+
if (scope && fieldName && binding) {
|
|
187
|
+
const held = scope.getValue(fieldName);
|
|
188
|
+
const value = held !== undefined ? held : specSeed;
|
|
189
|
+
const existingChange = componentProps[binding.changeProp];
|
|
190
|
+
const support = FIELD_PROP_SUPPORT[node.component];
|
|
191
|
+
const next = { ...componentProps };
|
|
192
|
+
delete next.name; // consumed for registration; never forwarded
|
|
193
|
+
if (binding.defaultValueProp)
|
|
194
|
+
delete next[binding.defaultValueProp];
|
|
195
|
+
next[binding.valueProp] = value !== null && value !== void 0 ? value : binding.empty;
|
|
196
|
+
next[binding.changeProp] = (...args) => {
|
|
197
|
+
scope.setValue(fieldName, args[0]);
|
|
198
|
+
existingChange === null || existingChange === void 0 ? void 0 : existingChange(...args);
|
|
199
|
+
};
|
|
200
|
+
if (scope.errors[fieldName]) {
|
|
201
|
+
if (support === null || support === void 0 ? void 0 : support.state)
|
|
202
|
+
next.state = "invalid";
|
|
203
|
+
if (support === null || support === void 0 ? void 0 : support.errorMessage)
|
|
204
|
+
next.errorMessage = (_l = next.errorMessage) !== null && _l !== void 0 ? _l : scope.errors[fieldName];
|
|
205
|
+
}
|
|
206
|
+
componentProps = next;
|
|
207
|
+
}
|
|
208
|
+
else if (fieldName && binding) {
|
|
209
|
+
// A named FIELD-BINDING component outside a Form still renders; `name`
|
|
210
|
+
// is simply inert there. Strip it so it never reaches the DOM. A
|
|
211
|
+
// component with NO binding (e.g. `Avatar.name`, a person's display
|
|
212
|
+
// name) never entered this branch's condition for the wrong reason —
|
|
213
|
+
// `binding` here confirms it actually IS a field component, so its
|
|
214
|
+
// `name` prop is left alone and forwarded untouched.
|
|
215
|
+
const { name: _unused, ...rest } = componentProps;
|
|
216
|
+
componentProps = rest;
|
|
217
|
+
}
|
|
218
|
+
// Design spec §3.5: a `Button` inside a Form that declares no `actions` of
|
|
219
|
+
// its own IS that form's submit button. Core `Button` renders `type="button"`
|
|
220
|
+
// ahead of its rest-prop spread (Button.tsx:170), so injecting `type` here
|
|
221
|
+
// overrides it — and `FormShell`'s
|
|
222
|
+
// `button[type="submit"]:not([data-generative-auto-submit])` probe then finds
|
|
223
|
+
// it and suppresses the auto-rendered one, leaving exactly one button.
|
|
224
|
+
// `type` is deliberately NOT in the generative schema: the rule is the
|
|
225
|
+
// engine's to apply, not a knob the model can set (or forget to set).
|
|
226
|
+
// A Button WITH actions keeps its own click behaviour and never submits.
|
|
227
|
+
const declaresOwnActions = !!node.actions && Object.keys(node.actions).length > 0;
|
|
228
|
+
if (node.component === "Button" && scope && !declaresOwnActions) {
|
|
229
|
+
componentProps = { ...componentProps, type: "submit" };
|
|
230
|
+
}
|
|
231
|
+
if (entry.isForm) {
|
|
232
|
+
const formId = (_m = node.id) !== null && _m !== void 0 ? _m : `form-${path}`;
|
|
233
|
+
componentProps = {
|
|
234
|
+
...componentProps,
|
|
235
|
+
formId,
|
|
236
|
+
// `Object.hasOwn`, not `values?.[formId]`: `formId` comes from the spec's
|
|
237
|
+
// own `node.id`. `validate()` now rejects unsafe ids (see validate.ts),
|
|
238
|
+
// but `GenerativeView` also accepts RAW specs, where a plain-object bag
|
|
239
|
+
// would resolve `id: "toString"` to an inherited function instead of
|
|
240
|
+
// `undefined` — and hand `FormShell` a function as its `values` prop.
|
|
241
|
+
values: values && Object.hasOwn(values, formId) ? values[formId] : undefined,
|
|
242
|
+
defaultValues: defaultValues && Object.hasOwn(defaultValues, formId) ? defaultValues[formId] : undefined,
|
|
243
|
+
onValuesChange: (formValues) => onFormValuesChange === null || onFormValuesChange === void 0 ? void 0 : onFormValuesChange(formId, formValues),
|
|
244
|
+
onSubmit: (formValues) => {
|
|
245
|
+
var _a;
|
|
246
|
+
const descriptor = (_a = node.actions) === null || _a === void 0 ? void 0 : _a.submit;
|
|
247
|
+
if (!descriptor || !dispatch)
|
|
248
|
+
return;
|
|
249
|
+
dispatch(descriptor, { component: "Form", nodeId: node.id, values: formValues });
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
}
|
|
81
253
|
const Component = entry.component;
|
|
82
254
|
let inner;
|
|
83
255
|
if (entry.render)
|
|
@@ -106,12 +278,32 @@ function NodeRenderer({ node, registry, inShell, dispatch, }) {
|
|
|
106
278
|
* Render a serializable UINode spec with the given registry.
|
|
107
279
|
* Render-only in P1 — streaming (P3) and action dispatch (P4) layer on top.
|
|
108
280
|
*/
|
|
109
|
-
function GenerativeView({ spec, registry = defaultRegistry, onAction, className, }) {
|
|
281
|
+
function GenerativeView({ spec, registry = defaultRegistry, onAction, className, values, defaultValues, onValuesChange, }) {
|
|
110
282
|
const nodes = Array.isArray(spec) ? spec : [spec];
|
|
283
|
+
const isControlled = values !== undefined;
|
|
284
|
+
// `onValuesChange` is documented to fire with the COMPLETE next values bag,
|
|
285
|
+
// across every form in the spec. Controlled mode gets that for free: the
|
|
286
|
+
// consumer's `values` is the live bag, so merging onto it is correct.
|
|
287
|
+
// Uncontrolled mode does not — `defaultValues` is a static seed that never
|
|
288
|
+
// reflects what the user has since typed, so merging each form's callback
|
|
289
|
+
// onto it erased every OTHER form's live state (type in form A, then form B,
|
|
290
|
+
// and A's value vanished from the payload). This ref carries the last bag we
|
|
291
|
+
// emitted so the merge base stays current between forms.
|
|
292
|
+
const lastEmittedRef = React__default.useRef(defaultValues !== null && defaultValues !== void 0 ? defaultValues : {});
|
|
293
|
+
const handleFormValuesChange = React__default.useCallback((formId, formValues) => {
|
|
294
|
+
const base = isControlled ? (values !== null && values !== void 0 ? values : {}) : lastEmittedRef.current;
|
|
295
|
+
// A computed key in an object literal is a data-property definition, not
|
|
296
|
+
// an assignment, so a hostile `formId` cannot reach a prototype setter
|
|
297
|
+
// here even on a raw (unvalidated) spec.
|
|
298
|
+
const next = { ...base, [formId]: formValues };
|
|
299
|
+
if (!isControlled)
|
|
300
|
+
lastEmittedRef.current = next;
|
|
301
|
+
onValuesChange === null || onValuesChange === void 0 ? void 0 : onValuesChange(next);
|
|
302
|
+
}, [isControlled, values, onValuesChange]);
|
|
111
303
|
return (jsx("div", { className: className, children: nodes.map((node, index) => {
|
|
112
|
-
var _a;
|
|
113
|
-
return (jsx(NodeBoundary, { name: node.component, children: jsx(NodeRenderer, { node: node, registry: registry, inShell: false, dispatch: onAction }) }, (
|
|
304
|
+
var _a, _b;
|
|
305
|
+
return (jsx(NodeBoundary, { name: node.component, children: jsx(NodeRenderer, { node: node, registry: registry, inShell: false, dispatch: onAction, path: `${(_a = node.id) !== null && _a !== void 0 ? _a : index}`, values: values, defaultValues: defaultValues, onFormValuesChange: handleFormValuesChange }) }, (_b = node.id) !== null && _b !== void 0 ? _b : index));
|
|
114
306
|
}) }));
|
|
115
307
|
}
|
|
116
308
|
|
|
117
|
-
export { GenerativeView };
|
|
309
|
+
export { FIELD_PROP_SUPPORT, GenerativeView };
|
|
@@ -7,6 +7,11 @@ export interface ActionContext {
|
|
|
7
7
|
nodeId?: string;
|
|
8
8
|
/** Serializable callback payload (e.g. the clicked Table row). Never a DOM event. */
|
|
9
9
|
data?: JSONValue;
|
|
10
|
+
/**
|
|
11
|
+
* Present only on a Form's submit action: every registered field value,
|
|
12
|
+
* collected in one bag. Built with a null prototype.
|
|
13
|
+
*/
|
|
14
|
+
values?: Record<string, JSONValue>;
|
|
10
15
|
}
|
|
11
16
|
/** Consumer handler: first arg is the EXACT descriptor from the spec. */
|
|
12
17
|
export type ActionHandler = (action: ActionDescriptor, context: ActionContext) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useGenerativeChat, type UseGenerativeChatOptions, type UseGenerativeChatReturn, } from "./useGenerativeChat";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useGenerativeChat } from './useGenerativeChat.js';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useChat } from "@ai-sdk/react";
|
|
2
|
+
import { ActionContext } from "../actions";
|
|
3
|
+
import { ActionDescriptor, UISpec } from "../types";
|
|
4
|
+
export interface UseGenerativeChatOptions {
|
|
5
|
+
/** Chat endpoint. Passed straight to the AI SDK's transport. @default "/api/chat" */
|
|
6
|
+
api?: string;
|
|
7
|
+
/** Tool name the model calls to render UI. @default GENERATIVE_TOOL.name */
|
|
8
|
+
toolName?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface UseGenerativeChatReturn {
|
|
11
|
+
/** The validated spec from the most recent render tool call. Empty array while nothing has streamed in yet. */
|
|
12
|
+
spec: UISpec;
|
|
13
|
+
/** Route this into <GenerativeView onAction={…} /> to close the loop. */
|
|
14
|
+
onAction: (action: ActionDescriptor, ctx: ActionContext) => void;
|
|
15
|
+
/**
|
|
16
|
+
* True while the render tool's arguments are still arriving — either the
|
|
17
|
+
* matched tool-call part's own `state` is `"input-streaming"`, or the chat
|
|
18
|
+
* as a whole is still streaming (`chat.status === "streaming"`, e.g. the
|
|
19
|
+
* tool call hasn't started yet but a response is in flight). False at rest
|
|
20
|
+
* (no messages, nothing in flight) and once the matched part has settled.
|
|
21
|
+
*
|
|
22
|
+
* NOT derived from `useGenerativeStream`'s own `complete` flag — see the
|
|
23
|
+
* note on `useGenerativeChat` below for why that signal is unusable here.
|
|
24
|
+
*/
|
|
25
|
+
streaming: boolean;
|
|
26
|
+
messages: ReturnType<typeof useChat>["messages"];
|
|
27
|
+
sendMessage: ReturnType<typeof useChat>["sendMessage"];
|
|
28
|
+
status: ReturnType<typeof useChat>["status"];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Wires the AI SDK's chat loop to the generative engine: feeds the render
|
|
32
|
+
* tool's arguments through `useGenerativeStream`, validates the result, and
|
|
33
|
+
* routes user interactions back to the model as a tool result.
|
|
34
|
+
*
|
|
35
|
+
* 🔴 Skeleton placeholders do NOT apply on this path. `useGenerativeStream` /
|
|
36
|
+
* `parseStreamingSpec` detect "still arriving" content by finding an unclosed
|
|
37
|
+
* bracket in raw, truncated JSON text — that's how `GenerativeView` gets to
|
|
38
|
+
* render `__skeleton__` placeholders mid-stream. But `@ai-sdk/react` never
|
|
39
|
+
* exposes that raw text: a streaming tool-call part's `input` is already a
|
|
40
|
+
* parsed `DeepPartial` snapshot, and `JSON.stringify`-ing it (the only way to
|
|
41
|
+
* satisfy `useGenerativeStream`'s string contract) always yields syntactically
|
|
42
|
+
* COMPLETE JSON, at every step. So `pending` is always `0` here, and content
|
|
43
|
+
* pops in whole as fields complete rather than reserving skeleton space for
|
|
44
|
+
* fields that haven't started. This is a real, accepted trade-off of the
|
|
45
|
+
* installed SDK's surface — not a bug — which is also why `streaming` below
|
|
46
|
+
* is derived from the tool-call part's own `state` / `chat.status`, and NOT
|
|
47
|
+
* from `useGenerativeStream`'s `complete` flag (which is always `true` here
|
|
48
|
+
* for the same reason `pending` is always `0`).
|
|
49
|
+
*
|
|
50
|
+
* Requires the optional peers `ai` and `@ai-sdk/react`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function useGenerativeChat({ api, toolName, }?: UseGenerativeChatOptions): UseGenerativeChatReturn;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { useChat } from '@ai-sdk/react';
|
|
4
|
+
import { DefaultChatTransport } from 'ai';
|
|
5
|
+
import { GENERATIVE_TOOL } from '../tools.js';
|
|
6
|
+
import { toToolResult } from '../toToolResult.js';
|
|
7
|
+
import { useGenerativeStream } from '../useGenerativeStream.js';
|
|
8
|
+
import { validate } from '../validate.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wires the AI SDK's chat loop to the generative engine: feeds the render
|
|
12
|
+
* tool's arguments through `useGenerativeStream`, validates the result, and
|
|
13
|
+
* routes user interactions back to the model as a tool result.
|
|
14
|
+
*
|
|
15
|
+
* 🔴 Skeleton placeholders do NOT apply on this path. `useGenerativeStream` /
|
|
16
|
+
* `parseStreamingSpec` detect "still arriving" content by finding an unclosed
|
|
17
|
+
* bracket in raw, truncated JSON text — that's how `GenerativeView` gets to
|
|
18
|
+
* render `__skeleton__` placeholders mid-stream. But `@ai-sdk/react` never
|
|
19
|
+
* exposes that raw text: a streaming tool-call part's `input` is already a
|
|
20
|
+
* parsed `DeepPartial` snapshot, and `JSON.stringify`-ing it (the only way to
|
|
21
|
+
* satisfy `useGenerativeStream`'s string contract) always yields syntactically
|
|
22
|
+
* COMPLETE JSON, at every step. So `pending` is always `0` here, and content
|
|
23
|
+
* pops in whole as fields complete rather than reserving skeleton space for
|
|
24
|
+
* fields that haven't started. This is a real, accepted trade-off of the
|
|
25
|
+
* installed SDK's surface — not a bug — which is also why `streaming` below
|
|
26
|
+
* is derived from the tool-call part's own `state` / `chat.status`, and NOT
|
|
27
|
+
* from `useGenerativeStream`'s `complete` flag (which is always `true` here
|
|
28
|
+
* for the same reason `pending` is always `0`).
|
|
29
|
+
*
|
|
30
|
+
* Requires the optional peers `ai` and `@ai-sdk/react`.
|
|
31
|
+
*/
|
|
32
|
+
function useGenerativeChat({ api = "/api/chat", toolName = GENERATIVE_TOOL.name, } = {}) {
|
|
33
|
+
const transport = React__default.useMemo(() => new DefaultChatTransport({ api }), [api]);
|
|
34
|
+
const chat = useChat({ transport });
|
|
35
|
+
// Most recent render tool call across the transcript, streaming or settled.
|
|
36
|
+
const match = React__default.useMemo(() => {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
const staticType = `tool-${toolName}`;
|
|
39
|
+
for (let i = chat.messages.length - 1; i >= 0; i--) {
|
|
40
|
+
const parts = (_a = chat.messages[i].parts) !== null && _a !== void 0 ? _a : [];
|
|
41
|
+
for (let j = parts.length - 1; j >= 0; j--) {
|
|
42
|
+
const part = parts[j];
|
|
43
|
+
const isMatch = part.type === staticType || (part.type === "dynamic-tool" && part.toolName === toolName);
|
|
44
|
+
if (isMatch) {
|
|
45
|
+
return {
|
|
46
|
+
text: typeof part.input === "string" ? part.input : JSON.stringify((_b = part.input) !== null && _b !== void 0 ? _b : {}),
|
|
47
|
+
isStreaming: part.state === "input-streaming",
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return { text: "", isStreaming: false };
|
|
53
|
+
}, [chat.messages, toolName]);
|
|
54
|
+
const stream = useGenerativeStream({ text: match.text });
|
|
55
|
+
const spec = React__default.useMemo(() => {
|
|
56
|
+
if (!stream.spec)
|
|
57
|
+
return [];
|
|
58
|
+
return validate(stream.spec).spec;
|
|
59
|
+
}, [stream.spec]);
|
|
60
|
+
const onAction = React__default.useCallback((action, ctx) => {
|
|
61
|
+
chat.sendMessage({ text: JSON.stringify(toToolResult(action, ctx)) });
|
|
62
|
+
}, [chat.sendMessage]);
|
|
63
|
+
return {
|
|
64
|
+
spec,
|
|
65
|
+
onAction,
|
|
66
|
+
streaming: match.isStreaming || chat.status === "streaming",
|
|
67
|
+
messages: chat.messages,
|
|
68
|
+
sendMessage: chat.sendMessage,
|
|
69
|
+
status: chat.status,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { useGenerativeChat };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { JSONValue } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* How one curated control exposes its value to the form scope.
|
|
4
|
+
*
|
|
5
|
+
* Hand-verified against each component's `.types.ts` — these contracts are NOT
|
|
6
|
+
* uniform and must never be inferred from the component name:
|
|
7
|
+
* - `Checkbox.value` / `Switch.value` are the HTML *value attribute*
|
|
8
|
+
* (Checkbox.types.ts:23 declares it REQUIRED); the state is `checked`.
|
|
9
|
+
* - `Input`/`Textarea` fire `onValueChange`; everything else fires `onChange`.
|
|
10
|
+
* - `Input`/`Textarea` inherit `value`/`defaultValue` from the native
|
|
11
|
+
* HTML attribute interfaces rather than declaring them.
|
|
12
|
+
*/
|
|
13
|
+
export interface FieldBinding {
|
|
14
|
+
/** Prop carrying the field's current value in controlled use. */
|
|
15
|
+
valueProp: string;
|
|
16
|
+
/** Prop carrying the seed value in uncontrolled use, when the control has one. */
|
|
17
|
+
defaultValueProp?: string;
|
|
18
|
+
/** Callback prop fired on change. Its first argument is the new value. */
|
|
19
|
+
changeProp: string;
|
|
20
|
+
/** The value this control considers "blank" for the `required` check. */
|
|
21
|
+
empty: JSONValue;
|
|
22
|
+
}
|
|
23
|
+
export declare const FIELD_BINDINGS: Record<string, FieldBinding>;
|
|
24
|
+
/**
|
|
25
|
+
* Look up a binding. Uses `Object.hasOwn` so inherited Object.prototype members
|
|
26
|
+
* ("constructor", "toString") resolve to undefined rather than a function —
|
|
27
|
+
* the same guard `validate.ts`'s `safeLookup` applies.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getFieldBinding(component: string): FieldBinding | undefined;
|
|
30
|
+
/** Is this value "blank" for the purposes of a `required` check? */
|
|
31
|
+
export declare function isEmptyValue(binding: FieldBinding, value: JSONValue | undefined): boolean;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const FIELD_BINDINGS = {
|
|
2
|
+
Input: { valueProp: "value", defaultValueProp: "defaultValue", changeProp: "onValueChange", empty: "" },
|
|
3
|
+
Textarea: { valueProp: "value", defaultValueProp: "defaultValue", changeProp: "onValueChange", empty: "" },
|
|
4
|
+
Select: { valueProp: "value", changeProp: "onChange", empty: "" },
|
|
5
|
+
Combobox: { valueProp: "value", changeProp: "onChange", empty: "" },
|
|
6
|
+
Checkbox: { valueProp: "checked", defaultValueProp: "defaultChecked", changeProp: "onChange", empty: false },
|
|
7
|
+
Switch: { valueProp: "checked", defaultValueProp: "defaultChecked", changeProp: "onChange", empty: false },
|
|
8
|
+
Slider: { valueProp: "value", defaultValueProp: "defaultValue", changeProp: "onChange", empty: null },
|
|
9
|
+
InputOTP: { valueProp: "value", defaultValueProp: "defaultValue", changeProp: "onChange", empty: "" },
|
|
10
|
+
TimePicker: { valueProp: "value", defaultValueProp: "defaultValue", changeProp: "onChange", empty: "" },
|
|
11
|
+
InputDate: { valueProp: "value", changeProp: "onChange", empty: "" },
|
|
12
|
+
InputCounter: { valueProp: "value", changeProp: "onChange", empty: null },
|
|
13
|
+
InputTag: { valueProp: "value", defaultValueProp: "defaultValue", changeProp: "onChange", empty: [] },
|
|
14
|
+
Rating: { valueProp: "value", defaultValueProp: "defaultValue", changeProp: "onChange", empty: 0 },
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Look up a binding. Uses `Object.hasOwn` so inherited Object.prototype members
|
|
18
|
+
* ("constructor", "toString") resolve to undefined rather than a function —
|
|
19
|
+
* the same guard `validate.ts`'s `safeLookup` applies.
|
|
20
|
+
*/
|
|
21
|
+
function getFieldBinding(component) {
|
|
22
|
+
return Object.hasOwn(FIELD_BINDINGS, component) ? FIELD_BINDINGS[component] : undefined;
|
|
23
|
+
}
|
|
24
|
+
/** Is this value "blank" for the purposes of a `required` check? */
|
|
25
|
+
function isEmptyValue(binding, value) {
|
|
26
|
+
if (value === undefined || value === null)
|
|
27
|
+
return true;
|
|
28
|
+
if (Array.isArray(binding.empty))
|
|
29
|
+
return Array.isArray(value) && value.length === 0;
|
|
30
|
+
return value === binding.empty;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { FIELD_BINDINGS, getFieldBinding, isEmptyValue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FieldBinding } from "./fieldBinding";
|
|
3
|
+
import { JSONValue } from "./types";
|
|
4
|
+
/** One form's field values, keyed by field name. */
|
|
5
|
+
export type FormValues = Record<string, JSONValue>;
|
|
6
|
+
/** Every form in a spec, keyed by form id. */
|
|
7
|
+
export type GenerativeValues = Record<string, FormValues>;
|
|
8
|
+
export declare const REQUIRED_MESSAGE = "This field is required.";
|
|
9
|
+
interface FieldRegistration {
|
|
10
|
+
required?: boolean;
|
|
11
|
+
binding: FieldBinding;
|
|
12
|
+
/**
|
|
13
|
+
* The field's visible label, if it has one. Used only by `FormShell`'s error
|
|
14
|
+
* summary, so a blocked field is named the way the user sees it rather than
|
|
15
|
+
* by its submission key.
|
|
16
|
+
*/
|
|
17
|
+
label?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The field's initial value (spec seed or the binding's "empty"), committed
|
|
20
|
+
* to the scope on registration if nothing is held for this name yet. Kept
|
|
21
|
+
* separate from `setValue` so mounting a field doesn't fire `onValuesChange`
|
|
22
|
+
* before any user interaction — seeding is not a user-driven change.
|
|
23
|
+
*/
|
|
24
|
+
seed?: JSONValue;
|
|
25
|
+
}
|
|
26
|
+
export interface FormScopeValue {
|
|
27
|
+
formId: string;
|
|
28
|
+
getValue(name: string): JSONValue | undefined;
|
|
29
|
+
setValue(name: string, value: JSONValue): void;
|
|
30
|
+
/**
|
|
31
|
+
* The registered label for a field, if any. Read at render time by the
|
|
32
|
+
* error summary; safe because the scope's identity changes whenever
|
|
33
|
+
* `errors` does, so the summary always re-reads after a blocked submit.
|
|
34
|
+
*/
|
|
35
|
+
getLabel(name: string): string | undefined;
|
|
36
|
+
register(name: string, opts: FieldRegistration): void;
|
|
37
|
+
/** Drop a field that has unmounted, so its stale value never submits. */
|
|
38
|
+
unregister(name: string): void;
|
|
39
|
+
errors: Record<string, string>;
|
|
40
|
+
submit(): void;
|
|
41
|
+
}
|
|
42
|
+
export declare const FormScopeContext: React.Context<FormScopeValue | undefined>;
|
|
43
|
+
/** Nearest enclosing form scope, or undefined outside a Form. */
|
|
44
|
+
export declare function useFormScope(): FormScopeValue | undefined;
|
|
45
|
+
export interface UseFormScopeStateOptions {
|
|
46
|
+
formId: string;
|
|
47
|
+
/** Controlled values for THIS form. Presence switches to controlled mode. */
|
|
48
|
+
values?: FormValues;
|
|
49
|
+
/** Uncontrolled seed for THIS form. */
|
|
50
|
+
defaultValues?: FormValues;
|
|
51
|
+
onValuesChange?: (values: FormValues) => void;
|
|
52
|
+
onSubmit: (values: FormValues) => void;
|
|
53
|
+
/**
|
|
54
|
+
* Called with EVERY invalid field name, in registration order, when submit
|
|
55
|
+
* is blocked. Deliberately the whole list rather than just the first: the
|
|
56
|
+
* per-field invalid treatment reaches only some controls (six of the
|
|
57
|
+
* thirteen render no focusable primary element at all — per-field focus
|
|
58
|
+
* isn't viable without a core-component change, a deferred follow-up, see
|
|
59
|
+
* FormShell.tsx — and Switch/Rating render no error text at all), so
|
|
60
|
+
* `FormShell` needs the full set to build the form-level error summary
|
|
61
|
+
* that covers all of them.
|
|
62
|
+
*/
|
|
63
|
+
onInvalid?: (invalidNames: string[]) => void;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The form state machine. Controlled when `values` is passed; otherwise it owns
|
|
67
|
+
* state seeded from `defaultValues`. Mode is derived per render and never
|
|
68
|
+
* stored (CLAUDE.md §9).
|
|
69
|
+
*/
|
|
70
|
+
export declare function useFormScopeState({ formId, values, defaultValues, onValuesChange, onSubmit, onInvalid, }: UseFormScopeStateOptions): FormScopeValue;
|
|
71
|
+
export {};
|