@flikk/ui 1.0.0-beta.26 → 1.0.0-beta.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bg/1.webp +0 -0
- package/dist/bg/10.webp +0 -0
- package/dist/bg/11.webp +0 -0
- package/dist/bg/12.webp +0 -0
- package/dist/bg/13.webp +0 -0
- package/dist/bg/14.webp +0 -0
- package/dist/bg/15.webp +0 -0
- package/dist/bg/16.webp +0 -0
- package/dist/bg/17.webp +0 -0
- package/dist/bg/18.webp +0 -0
- package/dist/bg/19.webp +0 -0
- package/dist/bg/2.webp +0 -0
- package/dist/bg/20.webp +0 -0
- package/dist/bg/21.webp +0 -0
- package/dist/bg/22.webp +0 -0
- package/dist/bg/3.webp +0 -0
- package/dist/bg/4.webp +0 -0
- package/dist/bg/5.webp +0 -0
- package/dist/bg/6.webp +0 -0
- package/dist/bg/7.webp +0 -0
- package/dist/bg/8.webp +0 -0
- package/dist/bg/9.webp +0 -0
- package/dist/components/ai/CodeBlock/CodeBlock.theme.js +1 -1
- package/dist/components/ai/PromptInput/PromptInput.js +7 -140
- package/dist/components/ai/PromptInput/VoiceRecorder.js +0 -85
- package/dist/components/ai/TokenCounter/TokenCounter.theme.js +1 -1
- package/dist/components/canvas/Background.d.ts +19 -0
- package/dist/components/canvas/Background.js +23 -0
- package/dist/components/canvas/BaseNode.d.ts +15 -0
- package/dist/components/canvas/BaseNode.js +20 -0
- package/dist/components/canvas/CanvasToolbar.d.ts +34 -0
- package/dist/components/canvas/CanvasToolbar.js +34 -0
- package/dist/components/canvas/Edge.d.ts +35 -0
- package/dist/components/canvas/Edge.js +97 -0
- package/dist/components/canvas/EdgeLayer.d.ts +18 -0
- package/dist/components/canvas/EdgeLayer.js +111 -0
- package/dist/components/canvas/Handle.d.ts +11 -0
- package/dist/components/canvas/Handle.js +63 -0
- package/dist/components/canvas/MiniMap.d.ts +22 -0
- package/dist/components/canvas/MiniMap.js +105 -0
- package/dist/components/canvas/NodeCanvas.d.ts +10 -0
- package/dist/components/canvas/NodeCanvas.js +477 -0
- package/dist/components/canvas/NodeCanvas.theme.d.ts +7 -0
- package/dist/components/canvas/NodeCanvas.theme.js +9 -0
- package/dist/components/canvas/NodeCanvas.types.d.ts +187 -0
- package/dist/components/canvas/NodeControls.d.ts +25 -0
- package/dist/components/canvas/NodeControls.js +40 -0
- package/dist/components/canvas/NodeRenderer.d.ts +19 -0
- package/dist/components/canvas/NodeRenderer.js +117 -0
- package/dist/components/canvas/changes.d.ts +11 -0
- package/dist/components/canvas/changes.js +76 -0
- package/dist/components/canvas/context/CanvasContext.d.ts +32 -0
- package/dist/components/canvas/context/CanvasContext.js +14 -0
- package/dist/components/canvas/context/ConnectionContext.d.ts +33 -0
- package/dist/components/canvas/context/ConnectionContext.js +13 -0
- package/dist/components/canvas/context/HandleRegistry.d.ts +24 -0
- package/dist/components/canvas/context/HandleRegistry.js +15 -0
- package/dist/components/canvas/context/InteractionContext.d.ts +18 -0
- package/dist/components/canvas/context/InteractionContext.js +14 -0
- package/dist/components/canvas/context/NodeIdContext.d.ts +3 -0
- package/dist/components/canvas/context/NodeIdContext.js +15 -0
- package/dist/components/canvas/hooks/useConnection.d.ts +17 -0
- package/dist/components/canvas/hooks/useConnection.js +29 -0
- package/dist/components/canvas/hooks/useMarquee.d.ts +25 -0
- package/dist/components/canvas/hooks/useMarquee.js +91 -0
- package/dist/components/canvas/hooks/useNodeDrag.d.ts +23 -0
- package/dist/components/canvas/hooks/useNodeDrag.js +110 -0
- package/dist/components/canvas/hooks/usePanZoom.d.ts +30 -0
- package/dist/components/canvas/hooks/usePanZoom.js +189 -0
- package/dist/components/canvas/hooks/useViewport.d.ts +21 -0
- package/dist/components/canvas/hooks/useViewport.js +35 -0
- package/dist/components/canvas/index.d.ts +14 -0
- package/dist/components/canvas/index.js +12 -0
- package/dist/components/canvas/layout.d.ts +22 -0
- package/dist/components/canvas/layout.js +67 -0
- package/dist/components/canvas/utils.d.ts +4 -0
- package/dist/components/canvas/utils.js +16 -0
- package/dist/components/charts/AreaChart/AreaChart.js +136 -101
- package/dist/components/charts/AreaChart/AreaChart.types.d.ts +5 -5
- package/dist/components/charts/AreaChart/AreaChart.types.js +1 -0
- package/dist/components/charts/BarChart/BarChart.js +207 -143
- package/dist/components/charts/BarChart/BarChart.types.d.ts +4 -4
- package/dist/components/charts/BarChart/BarChart.types.js +1 -0
- package/dist/components/charts/ComboChart/ComboChart.types.d.ts +2 -2
- package/dist/components/charts/LineChart/LineChart.js +88 -72
- package/dist/components/charts/LineChart/LineChart.types.d.ts +3 -3
- package/dist/components/charts/RadarChart/RadarChart.js +1 -1
- package/dist/components/charts/RadarChart/RadarChart.theme.js +5 -2
- package/dist/components/charts/ScatterPlot/ScatterPlot.js +62 -72
- package/dist/components/charts/ScatterPlot/ScatterPlot.theme.js +10 -1
- package/dist/components/charts/ScatterPlot/ScatterPlot.types.d.ts +3 -9
- package/dist/components/charts/StackedBarChart/StackedBarChart.js +33 -33
- package/dist/components/charts/StackedBarChart/StackedBarChart.types.d.ts +2 -2
- package/dist/components/charts/hooks/index.d.ts +2 -0
- package/dist/components/charts/hooks/useChartDimensions.d.ts +29 -0
- package/dist/components/charts/hooks/useChartDimensions.js +42 -0
- package/dist/components/charts/shared/ChartTooltip/ChartTooltip.theme.js +1 -1
- package/dist/components/charts/types/chart.types.d.ts +11 -2
- package/dist/components/charts/types/chart.types.js +10 -3
- package/dist/components/core/Avatar/Avatar.js +5 -1
- package/dist/components/core/AvatarGroup/AvatarGroup.js +5 -1
- package/dist/components/core/AvatarGroup/AvatarGroup.theme.js +4 -2
- package/dist/components/core/Badge/Badge.js +1 -1
- package/dist/components/core/Badge/Badge.theme.js +16 -15
- package/dist/components/core/Button/Button.js +1 -1
- package/dist/components/core/Button/Button.theme.js +3 -3
- package/dist/components/core/Calendar/Calendar.theme.js +1 -1
- package/dist/components/core/Card/Card.js +7 -3
- package/dist/components/core/Card/Card.theme.js +3 -3
- package/dist/components/core/Card/Card.types.d.ts +27 -2
- package/dist/components/core/CommandPalette/CommandItem.js +4 -5
- package/dist/components/core/CommandPalette/CommandPalette.js +1 -1
- package/dist/components/core/CommandPalette/CommandPalette.theme.js +11 -13
- package/dist/components/core/CommandPalette/CommandPalette.types.d.ts +0 -2
- package/dist/components/core/ContextMenu/ContextMenu.theme.js +14 -15
- package/dist/components/core/ContextMenu/ContextMenuItem.js +1 -1
- package/dist/components/core/ContextMenu/ContextMenuSubTrigger.js +1 -1
- package/dist/components/core/DotSeparator/DotSeparator.d.ts +3 -0
- package/dist/components/core/DotSeparator/DotSeparator.js +19 -0
- package/dist/components/core/DotSeparator/DotSeparator.theme.d.ts +2 -0
- package/dist/components/core/DotSeparator/DotSeparator.theme.js +10 -0
- package/dist/components/core/DotSeparator/DotSeparator.types.d.ts +25 -0
- package/dist/components/core/DotSeparator/index.d.ts +3 -0
- package/dist/components/core/Dropdown/Dropdown.theme.js +5 -6
- package/dist/components/core/Dropdown/DropdownItem.js +1 -1
- package/dist/components/core/Dropdown/DropdownMenu.js +58 -30
- package/dist/components/core/HeroCard/HeroCard.d.ts +5 -0
- package/dist/components/core/HeroCard/HeroCard.js +99 -0
- package/dist/components/core/HeroCard/HeroCard.theme.d.ts +3 -0
- package/dist/components/core/HeroCard/HeroCard.theme.js +8 -0
- package/dist/components/core/HeroCard/HeroCard.types.d.ts +70 -0
- package/dist/components/core/HeroCard/index.d.ts +4 -0
- package/dist/components/core/Kbd/Kbd.theme.js +1 -1
- package/dist/components/core/MenuItem/MenuItem.js +5 -2
- package/dist/components/core/MenuItem/MenuItem.theme.d.ts +6 -0
- package/dist/components/core/MenuItem/MenuItem.theme.js +19 -16
- package/dist/components/core/MenuItem/MenuItem.types.d.ts +2 -0
- package/dist/components/core/Modal/Modal.d.ts +1 -1
- package/dist/components/core/Modal/Modal.js +2 -7
- package/dist/components/core/Modal/Modal.theme.js +4 -8
- package/dist/components/core/Modal/Modal.types.d.ts +0 -10
- package/dist/components/core/Modal/index.d.ts +1 -1
- package/dist/components/core/ModalStack/ModalStack.d.ts +1 -1
- package/dist/components/core/ModalStack/ModalStack.types.d.ts +1 -2
- package/dist/components/core/ModalStack/ModalStackModal.d.ts +1 -1
- package/dist/components/core/ModalStack/ModalStackModal.js +2 -7
- package/dist/components/core/NavItem/NavItem.js +20 -4
- package/dist/components/core/NavItem/NavItem.theme.js +13 -2
- package/dist/components/core/PageHeading/PageHeading.theme.js +2 -2
- package/dist/components/core/Popover/Popover.theme.js +1 -1
- package/dist/components/core/Popover/Popover.types.d.ts +6 -2
- package/dist/components/core/Popover/PopoverBody.js +10 -3
- package/dist/components/core/ScrollArea/ScrollArea.js +242 -4
- package/dist/components/core/ScrollArea/ScrollArea.types.d.ts +12 -1
- package/dist/components/core/ScrollArea/smooth/SmoothScrollEngine.d.ts +4 -0
- package/dist/components/core/ScrollArea/smooth/SmoothScrollEngine.js +23 -0
- package/dist/components/core/ScrollArea/smooth/useSmoothScroll.js +4 -0
- package/dist/components/core/ScrollArea/smooth/useSmoothScroll.types.d.ts +5 -0
- package/dist/components/core/Segmented/Segmented.theme.js +2 -2
- package/dist/components/core/Sidebar/Sidebar.d.ts +2 -0
- package/dist/components/core/Sidebar/Sidebar.js +15 -7
- package/dist/components/core/Sidebar/Sidebar.types.d.ts +92 -4
- package/dist/components/core/Sidebar/SidebarCard.d.ts +25 -0
- package/dist/components/core/Sidebar/SidebarCard.js +68 -0
- package/dist/components/core/Sidebar/SidebarCard.theme.d.ts +8 -0
- package/dist/components/core/Sidebar/SidebarCard.theme.js +18 -0
- package/dist/components/core/Sidebar/SidebarContent.js +5 -1
- package/dist/components/core/Sidebar/SidebarContext.js +1 -1
- package/dist/components/core/Sidebar/SidebarHeader.js +10 -2
- package/dist/components/core/Sidebar/SidebarLogo.js +38 -3
- package/dist/components/core/Sidebar/SidebarSearch.d.ts +22 -0
- package/dist/components/core/Sidebar/SidebarSearch.js +135 -0
- package/dist/components/core/Sidebar/SidebarToggle.js +1 -1
- package/dist/components/core/Sidebar/SidebarUserProfile.js +2 -2
- package/dist/components/core/Sidebar/index.d.ts +3 -1
- package/dist/components/core/Tag/Tag.js +29 -5
- package/dist/components/core/Tag/Tag.theme.js +13 -8
- package/dist/components/core/Tag/Tag.types.d.ts +7 -0
- package/dist/components/core/Tooltip/Tooltip.js +1 -1
- package/dist/components/core/Tooltip/Tooltip.theme.js +1 -2
- package/dist/components/core/index.d.ts +2 -0
- package/dist/components/core/index.js +6 -0
- package/dist/components/data-display/DescriptionList/DescriptionList.js +23 -7
- package/dist/components/data-display/DescriptionList/DescriptionList.theme.js +10 -3
- package/dist/components/data-display/DescriptionList/DescriptionList.types.d.ts +49 -10
- package/dist/components/data-display/DescriptionList/index.d.ts +1 -1
- package/dist/components/data-display/Feed/Feed.js +28 -5
- package/dist/components/data-display/Feed/Feed.theme.js +1 -1
- package/dist/components/data-display/Feed/Feed.types.d.ts +32 -1
- package/dist/components/data-display/Feed/index.d.ts +1 -1
- package/dist/components/data-display/GanttChart/GanttChart.d.ts +1 -1
- package/dist/components/data-display/GanttChart/GanttChart.js +31 -4
- package/dist/components/data-display/GanttChart/GanttChart.theme.js +19 -17
- package/dist/components/data-display/GanttChart/GanttChart.types.d.ts +19 -0
- package/dist/components/data-display/GanttChart/GanttChart.utils.js +1 -1
- package/dist/components/data-display/GanttChart/GanttChartPanel.d.ts +1 -1
- package/dist/components/data-display/GanttChart/GanttChartPanel.js +3 -3
- package/dist/components/data-display/GanttChart/GanttDependencyArrows.js +7 -4
- package/dist/components/data-display/GanttChart/GanttMilestone.js +5 -5
- package/dist/components/data-display/GanttChart/GanttTablePanel.js +1 -1
- package/dist/components/data-display/GanttChart/GanttTableTaskRow.js +2 -2
- package/dist/components/data-display/GanttChart/GanttTaskBar.js +37 -16
- package/dist/components/data-display/GanttChart/GanttTimelineGrid.js +2 -1
- package/dist/components/data-display/GanttChart/GanttTimelineHeader.js +35 -11
- package/dist/components/data-display/GanttChart/GanttToolbar.js +2 -2
- package/dist/components/data-display/GanttChart/hooks/useGanttDrag.js +3 -2
- package/dist/components/data-display/GanttChart/index.d.ts +1 -1
- package/dist/components/data-display/Metric/Metric.js +8 -8
- package/dist/components/data-display/Metric/Metric.theme.d.ts +3 -2
- package/dist/components/data-display/Metric/Metric.theme.js +50 -68
- package/dist/components/data-display/Metric/Metric.types.d.ts +19 -21
- package/dist/components/data-display/Table/Table.js +2 -2
- package/dist/components/data-display/Table/Table.theme.js +27 -9
- package/dist/components/data-display/Table/Table.types.d.ts +8 -0
- package/dist/components/data-display/Table/TableBody.js +2 -2
- package/dist/components/data-display/Table/TableCell.js +1 -1
- package/dist/components/data-display/Table/TableRow.d.ts +1 -1
- package/dist/components/data-display/Table/TableRow.js +9 -2
- package/dist/components/data-display/Timeline/Timeline.js +27 -5
- package/dist/components/data-display/Timeline/Timeline.theme.d.ts +10 -2
- package/dist/components/data-display/Timeline/Timeline.theme.js +14 -8
- package/dist/components/data-display/Timeline/Timeline.types.d.ts +48 -16
- package/dist/components/data-display/Timeline/Timeline.utils.d.ts +6 -0
- package/dist/components/data-display/Timeline/Timeline.utils.js +11 -0
- package/dist/components/data-display/Timeline/TimelineItem.js +13 -20
- package/dist/components/data-display/Timeline/TimelineMarker.js +10 -8
- package/dist/components/data-display/Timeline/index.d.ts +2 -2
- package/dist/components/effects/3d/index.d.ts +0 -2
- package/dist/components/effects/3d/index.js +0 -1
- package/dist/components/effects/Aurora/Aurora.d.ts +6 -17
- package/dist/components/effects/Aurora/Aurora.js +297 -131
- package/dist/components/effects/Aurora/Aurora.types.d.ts +6 -0
- package/dist/components/effects/DotPattern/DotPattern.js +1 -1
- package/dist/components/effects/Overlay/Overlay.theme.js +1 -2
- package/dist/components/effects/Preloader/Preloader.animations.d.ts +23 -0
- package/dist/components/effects/Preloader/Preloader.animations.js +150 -0
- package/dist/components/effects/Preloader/Preloader.d.ts +3 -0
- package/dist/components/effects/Preloader/Preloader.js +119 -0
- package/dist/components/effects/Preloader/Preloader.types.d.ts +63 -0
- package/dist/components/effects/Preloader/index.d.ts +2 -0
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.js +25 -14
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.types.d.ts +2 -0
- package/dist/components/effects/TiltCard/TiltCard.d.ts +12 -0
- package/dist/components/effects/TiltCard/TiltCard.glow.d.ts +28 -0
- package/dist/components/effects/TiltCard/TiltCard.glow.js +114 -0
- package/dist/components/effects/TiltCard/TiltCard.js +177 -0
- package/dist/components/effects/{SpotlightBorder/SpotlightBorder.shaders.d.ts → TiltCard/TiltCard.shaders.d.ts} +1 -1
- package/dist/components/effects/{SpotlightBorder/SpotlightBorder.shaders.js → TiltCard/TiltCard.shaders.js} +1 -1
- package/dist/components/effects/TiltCard/TiltCard.types.d.ts +88 -0
- package/dist/components/effects/TiltCard/index.d.ts +2 -0
- package/dist/components/effects/index.d.ts +4 -12
- package/dist/components/effects/index.js +2 -6
- package/dist/components/forms/Checkbox/Checkbox.js +7 -1
- package/dist/components/forms/Combobox/Combobox.js +1 -1
- package/dist/components/forms/Combobox/Combobox.theme.js +2 -4
- package/dist/components/forms/DatePicker/DatePicker.theme.js +11 -18
- package/dist/components/forms/DatePicker/DatePickerTrigger.js +1 -1
- package/dist/components/forms/DateRangePicker/DateRangePicker.theme.js +6 -13
- package/dist/components/forms/DateRangePicker/DateRangePickerTrigger.js +1 -1
- package/dist/components/forms/FileUpload/FileUpload.animations.d.ts +29 -0
- package/dist/components/forms/FileUpload/FileUpload.animations.js +19 -0
- package/dist/components/forms/FileUpload/FileUpload.js +85 -134
- package/dist/components/forms/FileUpload/FileUpload.theme.d.ts +2 -10
- package/dist/components/forms/FileUpload/FileUpload.theme.js +16 -30
- package/dist/components/forms/FileUpload/FileUpload.types.d.ts +26 -10
- package/dist/components/forms/FormLabel/FormLabel.theme.js +1 -1
- package/dist/components/forms/Input/Input.theme.js +13 -10
- package/dist/components/forms/InputCounter/InputCounter.theme.js +1 -1
- package/dist/components/forms/Mention/Mention.js +152 -57
- package/dist/components/forms/Mention/Mention.theme.js +16 -23
- package/dist/components/forms/Mention/Mention.types.d.ts +12 -12
- package/dist/components/forms/Mention/Mention.utils.js +32 -4
- package/dist/components/forms/RichTextEditor/RichTextEditor.js +3 -3
- package/dist/components/forms/RichTextEditor/RichTextEditor.theme.js +5 -5
- package/dist/components/forms/Select/Select.js +2 -2
- package/dist/components/forms/Select/Select.theme.js +3 -3
- package/dist/components/forms/Slider/Slider.theme.js +1 -1
- package/dist/components/forms/Switch/Switch.js +27 -15
- package/dist/components/forms/Switch/Switch.theme.d.ts +36 -6
- package/dist/components/forms/Switch/Switch.theme.js +33 -4
- package/dist/components/forms/Switch/Switch.types.d.ts +12 -2
- package/dist/components/forms/TimePicker/TimePicker.theme.js +1 -2
- package/dist/components/forms/TimePicker/TimePickerContent.js +1 -87
- package/dist/components/forms/TimePicker/TimePickerTrigger.js +1 -1
- package/dist/components/forms/forms.theme.js +21 -16
- package/dist/components/forms/index.d.ts +0 -4
- package/dist/components/forms/index.js +0 -89
- package/dist/components/generative/GenerativeView.d.ts +21 -0
- package/dist/components/generative/GenerativeView.js +116 -0
- package/dist/components/generative/actions.d.ts +26 -0
- package/dist/components/generative/actions.js +51 -0
- package/dist/components/generative/index.d.ts +11 -0
- package/dist/components/generative/index.js +9 -0
- package/dist/components/generative/registry.d.ts +43 -0
- package/dist/components/generative/registry.js +114 -0
- package/dist/components/generative/resolvers.d.ts +35 -0
- package/dist/components/generative/resolvers.js +93 -0
- package/dist/components/generative/schema.generated.d.ts +2 -0
- package/dist/components/generative/schema.generated.js +1639 -0
- package/dist/components/generative/schemaTypes.d.ts +30 -0
- package/dist/components/generative/streaming.d.ts +39 -0
- package/dist/components/generative/streaming.js +283 -0
- package/dist/components/generative/tools.d.ts +21 -0
- package/dist/components/generative/tools.js +54 -0
- package/dist/components/generative/types.d.ts +41 -0
- package/dist/components/generative/useGenerativeStream.d.ts +37 -0
- package/dist/components/generative/useGenerativeStream.js +36 -0
- package/dist/components/generative/validate.d.ts +24 -0
- package/dist/components/generative/validate.js +259 -0
- package/dist/components/layout/AppShell/AppShell.d.ts +10 -0
- package/dist/components/layout/AppShell/AppShell.js +84 -0
- package/dist/components/layout/AppShell/AppShell.theme.d.ts +3 -0
- package/dist/components/layout/AppShell/AppShell.theme.js +42 -0
- package/dist/components/layout/AppShell/AppShell.types.d.ts +127 -0
- package/dist/components/layout/AppShell/AppShellContext.d.ts +14 -0
- package/dist/components/layout/AppShell/AppShellContext.js +19 -0
- package/dist/components/layout/AppShell/AppShellFooter.d.ts +3 -0
- package/dist/components/layout/AppShell/AppShellFooter.js +12 -0
- package/dist/components/layout/AppShell/AppShellHeader.d.ts +3 -0
- package/dist/components/layout/AppShell/AppShellHeader.js +12 -0
- package/dist/components/layout/AppShell/AppShellMain.d.ts +3 -0
- package/dist/components/layout/AppShell/AppShellMain.js +19 -0
- package/dist/components/layout/AppShell/AppShellRightPanel.d.ts +3 -0
- package/dist/components/layout/AppShell/AppShellRightPanel.js +16 -0
- package/dist/components/layout/AppShell/AppShellSidebar.d.ts +3 -0
- package/dist/components/layout/AppShell/AppShellSidebar.js +16 -0
- package/dist/components/layout/AppShell/AppShellTopbar.d.ts +3 -0
- package/dist/components/layout/AppShell/AppShellTopbar.js +12 -0
- package/dist/components/layout/AppShell/index.d.ts +3 -0
- package/dist/components/layout/FormLayout/FormLayout.js +1 -87
- package/dist/components/layout/Grid/Grid.d.ts +3 -0
- package/dist/components/layout/Grid/Grid.js +50 -0
- package/dist/components/layout/Grid/Grid.theme.d.ts +2 -0
- package/dist/components/layout/Grid/Grid.theme.js +35 -0
- package/dist/components/layout/Grid/Grid.types.d.ts +57 -0
- package/dist/components/layout/Grid/index.d.ts +3 -0
- package/dist/components/layout/Section/Section.d.ts +3 -0
- package/dist/components/layout/Section/Section.js +18 -0
- package/dist/components/layout/Section/Section.theme.d.ts +2 -0
- package/dist/components/layout/Section/Section.theme.js +10 -0
- package/dist/components/layout/Section/Section.types.d.ts +34 -0
- package/dist/components/layout/Section/index.d.ts +3 -0
- package/dist/components/layout/Stack/Stack.d.ts +3 -0
- package/dist/components/layout/Stack/Stack.js +19 -0
- package/dist/components/layout/Stack/Stack.theme.d.ts +2 -0
- package/dist/components/layout/Stack/Stack.theme.js +10 -0
- package/dist/components/layout/Stack/Stack.types.d.ts +39 -0
- package/dist/components/layout/Stack/index.d.ts +3 -0
- package/dist/components/layout/index.d.ts +4 -0
- package/dist/components/layout/index.js +8 -0
- package/dist/generative.schema.json +1637 -0
- package/dist/hooks/useSelectPortal.d.ts +10 -2
- package/dist/hooks/useSelectPortal.js +45 -24
- package/dist/index.js +180 -174
- package/dist/registry.json +10205 -0
- package/dist/styles.css +1 -1
- package/dist/tools.json +1731 -0
- package/dist/utils/dateUtils.js +11 -1
- package/package.json +19 -4
- package/src/global.scss +82 -109
- package/src/styles/theme.css +707 -474
- package/dist/bg/1.jpg +0 -0
- package/dist/bg/10.jpg +0 -0
- package/dist/bg/11.jpg +0 -0
- package/dist/bg/14.jpg +0 -0
- package/dist/bg/15.jpg +0 -0
- package/dist/bg/16.jpg +0 -0
- package/dist/bg/17.jpg +0 -0
- package/dist/bg/18.jpg +0 -0
- package/dist/bg/19.jpg +0 -0
- package/dist/bg/2.jpg +0 -0
- package/dist/bg/20.jpg +0 -0
- package/dist/bg/21.jpg +0 -0
- package/dist/bg/22.jpg +0 -0
- package/dist/bg/23.jpg +0 -0
- package/dist/bg/24.jpg +0 -0
- package/dist/bg/3.jpg +0 -0
- package/dist/bg/4.jpg +0 -0
- package/dist/bg/5.jpg +0 -0
- package/dist/bg/6.jpg +0 -0
- package/dist/bg/7.jpg +0 -0
- package/dist/bg/8.jpg +0 -0
- package/dist/bg/9.jpg +0 -0
- package/dist/components/effects/MorphingText/MorphingText.d.ts +0 -17
- package/dist/components/effects/MorphingText/MorphingText.js +0 -125
- package/dist/components/effects/MorphingText/MorphingText.types.d.ts +0 -18
- package/dist/components/effects/MorphingText/index.d.ts +0 -2
- package/dist/components/effects/PageTransition/PageTransition.animations.d.ts +0 -8
- package/dist/components/effects/PageTransition/PageTransition.animations.js +0 -53
- package/dist/components/effects/PageTransition/PageTransition.d.ts +0 -3
- package/dist/components/effects/PageTransition/PageTransition.js +0 -82
- package/dist/components/effects/PageTransition/PageTransition.types.d.ts +0 -15
- package/dist/components/effects/PageTransition/index.d.ts +0 -2
- package/dist/components/effects/ParallaxSection/ParallaxSection.d.ts +0 -26
- package/dist/components/effects/ParallaxSection/ParallaxSection.js +0 -71
- package/dist/components/effects/ParallaxSection/ParallaxSection.types.d.ts +0 -11
- package/dist/components/effects/ParallaxSection/index.d.ts +0 -2
- package/dist/components/effects/Spotlight/Spotlight.d.ts +0 -36
- package/dist/components/effects/Spotlight/Spotlight.js +0 -112
- package/dist/components/effects/Spotlight/Spotlight.types.d.ts +0 -29
- package/dist/components/effects/Spotlight/index.d.ts +0 -2
- package/dist/components/effects/SpotlightBorder/SpotlightBorder.d.ts +0 -18
- package/dist/components/effects/SpotlightBorder/SpotlightBorder.js +0 -213
- package/dist/components/effects/SpotlightBorder/SpotlightBorder.types.d.ts +0 -61
- package/dist/components/effects/SpotlightBorder/index.d.ts +0 -2
- package/dist/components/effects/StickyScroll/StickyScroll.d.ts +0 -30
- package/dist/components/effects/StickyScroll/StickyScroll.js +0 -128
- package/dist/components/effects/StickyScroll/StickyScroll.types.d.ts +0 -19
- package/dist/components/effects/StickyScroll/index.d.ts +0 -2
- package/dist/components/forms/CronInput/CronInput.d.ts +0 -3
- package/dist/components/forms/CronInput/CronInput.js +0 -113
- package/dist/components/forms/CronInput/CronInput.theme.d.ts +0 -6
- package/dist/components/forms/CronInput/CronInput.theme.js +0 -84
- package/dist/components/forms/CronInput/CronInput.types.d.ts +0 -109
- package/dist/components/forms/CronInput/CronInput.utils.d.ts +0 -67
- package/dist/components/forms/CronInput/CronInput.utils.js +0 -505
- package/dist/components/forms/CronInput/index.d.ts +0 -4
- /package/dist/components/effects/{SpotlightBorder/SpotlightBorder.types.js → TiltCard/TiltCard.types.js} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const POSITIONS: {
|
|
2
|
+
readonly "bottom-left": "bottom-4 left-4";
|
|
3
|
+
readonly "bottom-right": "bottom-4 right-4";
|
|
4
|
+
readonly "top-left": "top-4 left-4";
|
|
5
|
+
readonly "top-right": "top-4 right-4";
|
|
6
|
+
};
|
|
7
|
+
export interface NodeControlsProps {
|
|
8
|
+
position?: keyof typeof POSITIONS;
|
|
9
|
+
showZoom?: boolean;
|
|
10
|
+
showFitView?: boolean;
|
|
11
|
+
showLock?: boolean;
|
|
12
|
+
/** Zoom step per click. Defaults to `1.2`. */
|
|
13
|
+
zoomStep?: number;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Opt-in control cluster: zoom in/out (anchored to canvas center), fit-view, and a
|
|
18
|
+
* lock toggle (disables pan / node drag / connections). Pane-level chrome — render
|
|
19
|
+
* as a child of `NodeCanvas`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function NodeControls({ position, showZoom, showFitView, showLock, zoomStep, className, }: NodeControlsProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare namespace NodeControls {
|
|
23
|
+
var displayName: string;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { PlusIcon, MinusIcon, ArrowsPointingOutIcon, LockClosedIcon, LockOpenIcon } from '@heroicons/react/24/outline';
|
|
3
|
+
import { cn } from '../../utils/cn.js';
|
|
4
|
+
import { Button } from '../core/Button/Button.js';
|
|
5
|
+
import 'react';
|
|
6
|
+
import { useNodeCanvasContext } from './context/CanvasContext.js';
|
|
7
|
+
import { clamp } from './utils.js';
|
|
8
|
+
|
|
9
|
+
const POSITIONS = {
|
|
10
|
+
"bottom-left": "bottom-4 left-4",
|
|
11
|
+
"bottom-right": "bottom-4 right-4",
|
|
12
|
+
"top-left": "top-4 left-4",
|
|
13
|
+
"top-right": "top-4 right-4",
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Opt-in control cluster: zoom in/out (anchored to canvas center), fit-view, and a
|
|
17
|
+
* lock toggle (disables pan / node drag / connections). Pane-level chrome — render
|
|
18
|
+
* as a child of `NodeCanvas`.
|
|
19
|
+
*/
|
|
20
|
+
function NodeControls({ position = "bottom-right", showZoom = true, showFitView = true, showLock = true, zoomStep = 1.2, className, }) {
|
|
21
|
+
const { setViewport, fitView, minZoom, maxZoom, paneRef, locked, setLocked } = useNodeCanvasContext();
|
|
22
|
+
const zoomBy = (factor) => {
|
|
23
|
+
const pane = paneRef.current;
|
|
24
|
+
if (!pane)
|
|
25
|
+
return;
|
|
26
|
+
const r = pane.getBoundingClientRect();
|
|
27
|
+
const sx = r.width / 2;
|
|
28
|
+
const sy = r.height / 2;
|
|
29
|
+
setViewport((v) => {
|
|
30
|
+
const zoom = clamp(v.zoom * factor, minZoom, maxZoom);
|
|
31
|
+
const k = zoom / v.zoom;
|
|
32
|
+
return { zoom, x: sx - (sx - v.x) * k, y: sy - (sy - v.y) * k };
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
const ctrlBtn = "size-8 rounded-none";
|
|
36
|
+
return (jsxs("div", { "data-flikkui-controls": "", className: cn("absolute z-20 flex flex-col overflow-hidden rounded-lg border border-[var(--color-border)] divide-y divide-[var(--color-border)] bg-[var(--color-surface-overlay)]/60 backdrop-blur-lg shadow-real-lg", POSITIONS[position], className), children: [showZoom && (jsxs(Fragment, { children: [jsx(Button, { variant: "ghost", color: "neutral", size: "sm", iconOnly: true, className: ctrlBtn, onClick: () => zoomBy(zoomStep), "aria-label": "Zoom in", children: jsx(PlusIcon, { className: "size-4" }) }), jsx(Button, { variant: "ghost", color: "neutral", size: "sm", iconOnly: true, className: ctrlBtn, onClick: () => zoomBy(1 / zoomStep), "aria-label": "Zoom out", children: jsx(MinusIcon, { className: "size-4" }) })] })), showFitView && (jsx(Button, { variant: "ghost", color: "neutral", size: "sm", iconOnly: true, className: ctrlBtn, onClick: () => fitView(), "aria-label": "Fit view", children: jsx(ArrowsPointingOutIcon, { className: "size-4" }) })), showLock && (jsx(Button, { variant: locked ? "soft" : "ghost", color: locked ? "primary" : "neutral", size: "sm", iconOnly: true, className: ctrlBtn, onClick: () => setLocked(!locked), "aria-label": locked ? "Unlock canvas" : "Lock canvas", "aria-pressed": locked, children: locked ? jsx(LockClosedIcon, { className: "size-4" }) : jsx(LockOpenIcon, { className: "size-4" }) }))] }));
|
|
37
|
+
}
|
|
38
|
+
NodeControls.displayName = "NodeControls";
|
|
39
|
+
|
|
40
|
+
export { NodeControls };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { NodeCanvasNode, NodeCanvasNodeTypes, NodeChange } from "./NodeCanvas.types";
|
|
3
|
+
interface NodeRendererProps {
|
|
4
|
+
nodes: NodeCanvasNode[];
|
|
5
|
+
nodeTypes: NodeCanvasNodeTypes;
|
|
6
|
+
/** Show omnidirectional "+" connect handles on every node. */
|
|
7
|
+
autoConnect: boolean;
|
|
8
|
+
/** Emits drag `position` change-objects. */
|
|
9
|
+
onNodeChanges: (changes: NodeChange[]) => void;
|
|
10
|
+
/** Selection is owned by NodeCanvas so node/edge selection can cross-clear. */
|
|
11
|
+
onSelectNode: (id: string, additive: boolean) => void;
|
|
12
|
+
onNodeClick?: (event: React.MouseEvent, node: NodeCanvasNode) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Renders nodes from data: maps each `node.type` to its registered component and
|
|
16
|
+
* wraps it in a positioned, focusable, draggable shell.
|
|
17
|
+
*/
|
|
18
|
+
export declare function NodeRenderer({ nodes, nodeTypes, autoConnect, onNodeChanges, onSelectNode, onNodeClick, }: NodeRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useCallback, useRef, useEffect } from 'react';
|
|
3
|
+
import { PlusIcon } from '@heroicons/react/16/solid';
|
|
4
|
+
import { cn } from '../../utils/cn.js';
|
|
5
|
+
import { NodeIdProvider } from './context/NodeIdContext.js';
|
|
6
|
+
import { useNodeCanvasContext } from './context/CanvasContext.js';
|
|
7
|
+
import { useHandleRegistry, handleKey } from './context/HandleRegistry.js';
|
|
8
|
+
import { useNodeDrag } from './hooks/useNodeDrag.js';
|
|
9
|
+
import { useConnection } from './hooks/useConnection.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Renders nodes from data: maps each `node.type` to its registered component and
|
|
13
|
+
* wraps it in a positioned, focusable, draggable shell.
|
|
14
|
+
*/
|
|
15
|
+
function NodeRenderer({ nodes, nodeTypes, autoConnect, onNodeChanges, onSelectNode, onNodeClick, }) {
|
|
16
|
+
return (jsx(Fragment, { children: nodes.map((node) => {
|
|
17
|
+
const NodeComponent = nodeTypes[node.type];
|
|
18
|
+
if (process.env.NODE_ENV !== "production" && !NodeComponent) {
|
|
19
|
+
console.warn(`[NodeCanvas]: no nodeTypes entry for type "${node.type}" (node "${node.id}")`);
|
|
20
|
+
}
|
|
21
|
+
if (!NodeComponent)
|
|
22
|
+
return null;
|
|
23
|
+
return (jsx(NodeWrapper, { node: node, NodeComponent: NodeComponent, autoConnect: autoConnect, emit: onNodeChanges, onSelect: onSelectNode, onNodeClick: onNodeClick }, node.id));
|
|
24
|
+
}) }));
|
|
25
|
+
}
|
|
26
|
+
const AUTO_SIDES = ["top", "right", "bottom", "left"];
|
|
27
|
+
const AUTO_SIDE_CLASSES = {
|
|
28
|
+
top: "top-0 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
29
|
+
right: "right-0 top-1/2 translate-x-1/2 -translate-y-1/2",
|
|
30
|
+
bottom: "bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2",
|
|
31
|
+
left: "left-0 top-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* An omnidirectional connect-from-anywhere handle: a "+" on one node side, revealed
|
|
35
|
+
* on node hover, draggable to any other node. Registers its flow-coord offset like
|
|
36
|
+
* `Handle` so edges anchor to it, with `kind: 'auto'` so the connection rules allow
|
|
37
|
+
* any node → any node.
|
|
38
|
+
*/
|
|
39
|
+
function AutoHandle({ nodeId, position }) {
|
|
40
|
+
const ref = useRef(null);
|
|
41
|
+
const { register, unregister } = useHandleRegistry();
|
|
42
|
+
const { viewportRef, tool, locked } = useNodeCanvasContext();
|
|
43
|
+
const handleId = `__${position}`;
|
|
44
|
+
const { onPointerDown } = useConnection({ nodeId, handleId, type: "source", kind: "auto" });
|
|
45
|
+
const disabled = tool === "pan" || locked;
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const el = ref.current;
|
|
48
|
+
if (!el)
|
|
49
|
+
return;
|
|
50
|
+
const nodeEl = el.closest("[data-flikkui-node]");
|
|
51
|
+
if (!nodeEl)
|
|
52
|
+
return;
|
|
53
|
+
const measure = () => {
|
|
54
|
+
const hr = el.getBoundingClientRect();
|
|
55
|
+
const nr = nodeEl.getBoundingClientRect();
|
|
56
|
+
const zoom = viewportRef.current.zoom || 1;
|
|
57
|
+
register(nodeId, {
|
|
58
|
+
id: handleId,
|
|
59
|
+
type: "source",
|
|
60
|
+
position,
|
|
61
|
+
kind: "auto",
|
|
62
|
+
offset: {
|
|
63
|
+
x: (hr.left + hr.width / 2 - nr.left) / zoom,
|
|
64
|
+
y: (hr.top + hr.height / 2 - nr.top) / zoom,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
measure();
|
|
69
|
+
const ro = new ResizeObserver(measure);
|
|
70
|
+
ro.observe(nodeEl);
|
|
71
|
+
return () => {
|
|
72
|
+
ro.disconnect();
|
|
73
|
+
unregister(nodeId, handleKey("source", handleId));
|
|
74
|
+
};
|
|
75
|
+
}, [nodeId, handleId, position, register, unregister, viewportRef]);
|
|
76
|
+
return (jsx("button", { ref: ref, type: "button", "data-flikkui-handle": "", "data-node-id": nodeId, "data-handle-type": "source", "data-handle-id": handleId, "data-handle-kind": "auto", "aria-label": `Connect from ${position}`, className: cn("nodrag absolute z-20 grid place-items-center size-4 rounded-full", "bg-[var(--color-primary)] text-white shadow-md ring-2 ring-[var(--color-surface)] cursor-crosshair", "opacity-0 scale-75 pointer-events-none transition-[opacity,transform,box-shadow] duration-150 ease-out", "hover:scale-110 hover:shadow-lg hover:ring-4 active:scale-95", !disabled &&
|
|
77
|
+
"group-hover:opacity-100 group-hover:scale-100 group-hover:pointer-events-auto group-focus-within:opacity-100 group-focus-within:scale-100 group-focus-within:pointer-events-auto", AUTO_SIDE_CLASSES[position]), onPointerDown: disabled ? undefined : onPointerDown, children: jsx(PlusIcon, { className: "size-2.5" }) }));
|
|
78
|
+
}
|
|
79
|
+
function NodeWrapper({ node, NodeComponent, autoConnect, emit, onSelect, onNodeClick, }) {
|
|
80
|
+
const { tool } = useNodeCanvasContext();
|
|
81
|
+
const getNode = useCallback(() => node, [node]);
|
|
82
|
+
const { dragging, onPointerDown, onPointerMove, onPointerUp } = useNodeDrag({
|
|
83
|
+
nodeId: node.id,
|
|
84
|
+
getNode,
|
|
85
|
+
emit,
|
|
86
|
+
});
|
|
87
|
+
const handlePointerDown = (e) => {
|
|
88
|
+
// In pan mode let the press fall through to the pane (which pans).
|
|
89
|
+
if (tool === "pan")
|
|
90
|
+
return;
|
|
91
|
+
// Select first (so dragging an unselected node grabs it), then begin drag.
|
|
92
|
+
if (e.button === 0)
|
|
93
|
+
onSelect(node.id, e.shiftKey);
|
|
94
|
+
onPointerDown(e);
|
|
95
|
+
};
|
|
96
|
+
const handleKeyDown = (e) => {
|
|
97
|
+
if (e.target !== e.currentTarget)
|
|
98
|
+
return; // ignore keys from inner controls
|
|
99
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
onSelect(node.id, e.shiftKey);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const selected = !!node.selected;
|
|
105
|
+
return (jsx("div", { className: cn("group absolute top-0 left-0 rounded-[var(--canvas-node-radius,0.75rem)]", "transition-[box-shadow,filter,opacity] duration-150 ease-out", "focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--color-background)]", tool === "pan"
|
|
106
|
+
? "cursor-grab"
|
|
107
|
+
: node.draggable !== false && "cursor-grab active:cursor-grabbing",
|
|
108
|
+
// Selection visuals belong to the node component (BaseNode is the
|
|
109
|
+
// reference impl — border-secondary + primary whisper); the shell only
|
|
110
|
+
// marks state (data-selected) and keeps the keyboard focus-visible
|
|
111
|
+
// ring. A shell outline stacked on the card's border reads as a fat
|
|
112
|
+
// double frame.
|
|
113
|
+
dragging && "opacity-95 shadow-[0_18px_40px_rgba(0,0,0,0.16)]", (selected || dragging) && "z-10"), style: { transform: `translate(${node.position.x}px, ${node.position.y}px)` }, role: "group", "aria-roledescription": "node", "aria-label": `${node.type} node`, "data-flikkui-node": node.id, "data-selected": selected || undefined, "data-dragging": dragging || undefined, tabIndex: 0, onPointerDown: handlePointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerUp, onKeyDown: handleKeyDown, onClick: onNodeClick ? (e) => onNodeClick(e, node) : undefined, children: jsxs(NodeIdProvider, { value: node.id, children: [jsx(NodeComponent, { id: node.id, type: node.type, data: node.data, selected: selected, position: node.position, dragging: dragging }), autoConnect &&
|
|
114
|
+
AUTO_SIDES.map((side) => (jsx(AutoHandle, { nodeId: node.id, position: side }, side)))] }) }));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export { NodeRenderer };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EdgeChange, NodeCanvasEdge, NodeCanvasNode, NodeChange } from "./NodeCanvas.types";
|
|
2
|
+
/**
|
|
3
|
+
* Fold a batch of {@link NodeChange}s into a nodes array, returning a new array.
|
|
4
|
+
* Consumers call this from `onNodesChange` when controlling node state.
|
|
5
|
+
*
|
|
6
|
+
* Note (issue 2): `dimensions` is accepted but not yet persisted on the node
|
|
7
|
+
* (real measured sizes are stored in issue 4); it is currently a no-op update.
|
|
8
|
+
*/
|
|
9
|
+
export declare function applyNodeChanges(changes: NodeChange[], nodes: NodeCanvasNode[]): NodeCanvasNode[];
|
|
10
|
+
/** Fold a batch of {@link EdgeChange}s into an edges array, returning a new array. */
|
|
11
|
+
export declare function applyEdgeChanges(changes: EdgeChange[], edges: NodeCanvasEdge[]): NodeCanvasEdge[];
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fold a batch of {@link NodeChange}s into a nodes array, returning a new array.
|
|
3
|
+
* Consumers call this from `onNodesChange` when controlling node state.
|
|
4
|
+
*
|
|
5
|
+
* Note (issue 2): `dimensions` is accepted but not yet persisted on the node
|
|
6
|
+
* (real measured sizes are stored in issue 4); it is currently a no-op update.
|
|
7
|
+
*/
|
|
8
|
+
function applyNodeChanges(changes, nodes) {
|
|
9
|
+
if (changes.length === 0)
|
|
10
|
+
return nodes;
|
|
11
|
+
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
12
|
+
const removed = new Set();
|
|
13
|
+
const added = [];
|
|
14
|
+
for (const change of changes) {
|
|
15
|
+
switch (change.type) {
|
|
16
|
+
case "add":
|
|
17
|
+
added.push(change.item);
|
|
18
|
+
break;
|
|
19
|
+
case "remove":
|
|
20
|
+
removed.add(change.id);
|
|
21
|
+
break;
|
|
22
|
+
case "position": {
|
|
23
|
+
const node = byId.get(change.id);
|
|
24
|
+
if (node)
|
|
25
|
+
byId.set(change.id, { ...node, position: change.position });
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
case "select": {
|
|
29
|
+
const node = byId.get(change.id);
|
|
30
|
+
if (node)
|
|
31
|
+
byId.set(change.id, { ...node, selected: change.selected });
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
let next = nodes
|
|
37
|
+
.filter((n) => !removed.has(n.id))
|
|
38
|
+
.map((n) => { var _a; return (_a = byId.get(n.id)) !== null && _a !== void 0 ? _a : n; });
|
|
39
|
+
if (added.length > 0) {
|
|
40
|
+
next = next.concat(added.filter((a) => !nodes.some((n) => n.id === a.id)));
|
|
41
|
+
}
|
|
42
|
+
return next;
|
|
43
|
+
}
|
|
44
|
+
/** Fold a batch of {@link EdgeChange}s into an edges array, returning a new array. */
|
|
45
|
+
function applyEdgeChanges(changes, edges) {
|
|
46
|
+
if (changes.length === 0)
|
|
47
|
+
return edges;
|
|
48
|
+
const byId = new Map(edges.map((e) => [e.id, e]));
|
|
49
|
+
const removed = new Set();
|
|
50
|
+
const added = [];
|
|
51
|
+
for (const change of changes) {
|
|
52
|
+
switch (change.type) {
|
|
53
|
+
case "add":
|
|
54
|
+
added.push(change.item);
|
|
55
|
+
break;
|
|
56
|
+
case "remove":
|
|
57
|
+
removed.add(change.id);
|
|
58
|
+
break;
|
|
59
|
+
case "select": {
|
|
60
|
+
const edge = byId.get(change.id);
|
|
61
|
+
if (edge)
|
|
62
|
+
byId.set(change.id, { ...edge, selected: change.selected });
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
let next = edges
|
|
68
|
+
.filter((e) => !removed.has(e.id))
|
|
69
|
+
.map((e) => { var _a; return (_a = byId.get(e.id)) !== null && _a !== void 0 ? _a : e; });
|
|
70
|
+
if (added.length > 0) {
|
|
71
|
+
next = next.concat(added.filter((a) => !edges.some((e) => e.id === a.id)));
|
|
72
|
+
}
|
|
73
|
+
return next;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { applyEdgeChanges, applyNodeChanges };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { NodeCanvasNode, NodeCanvasViewport, SetViewport, XYPosition } from "../NodeCanvas.types";
|
|
3
|
+
export interface CanvasContextValue {
|
|
4
|
+
/** Current nodes (for overview chrome like MiniMap). */
|
|
5
|
+
nodes: NodeCanvasNode[];
|
|
6
|
+
viewport: NodeCanvasViewport;
|
|
7
|
+
/** Always-current viewport, safe to read inside pointer handlers (e.g. node drag). */
|
|
8
|
+
viewportRef: React.MutableRefObject<NodeCanvasViewport>;
|
|
9
|
+
setViewport: SetViewport;
|
|
10
|
+
minZoom: number;
|
|
11
|
+
maxZoom: number;
|
|
12
|
+
/** The clipping pane element (gesture target + measurement origin). */
|
|
13
|
+
paneRef: React.RefObject<HTMLDivElement | null>;
|
|
14
|
+
/** Flow coords → pane-local screen coords. */
|
|
15
|
+
flowToScreen: (point: XYPosition) => XYPosition;
|
|
16
|
+
/** Pane-local screen coords → flow coords. */
|
|
17
|
+
screenToFlow: (point: XYPosition) => XYPosition;
|
|
18
|
+
/** Fit all nodes into the viewport. */
|
|
19
|
+
fitView: () => void;
|
|
20
|
+
/** When locked, pan, node drag, and connections are disabled (zoom still works). */
|
|
21
|
+
locked: boolean;
|
|
22
|
+
setLocked: (locked: boolean) => void;
|
|
23
|
+
/** Active snap grid `[x, y]` in flow units, or `null` when snapping is off. */
|
|
24
|
+
snapGrid: [number, number] | null;
|
|
25
|
+
/** Active tool: `select` (drag = select/move) or `pan` (drag anywhere = pan). */
|
|
26
|
+
tool: CanvasTool;
|
|
27
|
+
setTool: (tool: CanvasTool) => void;
|
|
28
|
+
}
|
|
29
|
+
export type CanvasTool = "select" | "pan";
|
|
30
|
+
export declare const CanvasProvider: React.Provider<CanvasContextValue | undefined>;
|
|
31
|
+
/** Access the canvas viewport + coordinate transforms. Throws outside `<NodeCanvas>`. */
|
|
32
|
+
export declare function useNodeCanvasContext(): CanvasContextValue;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const CanvasContext = createContext(undefined);
|
|
4
|
+
const CanvasProvider = CanvasContext.Provider;
|
|
5
|
+
/** Access the canvas viewport + coordinate transforms. Throws outside `<NodeCanvas>`. */
|
|
6
|
+
function useNodeCanvasContext() {
|
|
7
|
+
const ctx = useContext(CanvasContext);
|
|
8
|
+
if (!ctx) {
|
|
9
|
+
throw new Error("NodeCanvas compound parts must be used within <NodeCanvas>");
|
|
10
|
+
}
|
|
11
|
+
return ctx;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { CanvasProvider, useNodeCanvasContext };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { HandleType, XYPosition } from "../NodeCanvas.types";
|
|
2
|
+
/** An in-progress connection drag (from a source handle toward the cursor). */
|
|
3
|
+
export interface ConnectionState {
|
|
4
|
+
sourceNodeId: string;
|
|
5
|
+
sourceHandleId?: string;
|
|
6
|
+
sourceType: HandleType;
|
|
7
|
+
/** `auto` when started from an omnidirectional connect-from-anywhere handle. */
|
|
8
|
+
sourceKind?: "auto";
|
|
9
|
+
/** Source handle anchor, in flow coords. */
|
|
10
|
+
from: XYPosition;
|
|
11
|
+
/** Current cursor position, in flow coords. */
|
|
12
|
+
to: XYPosition;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Stable connection-drag actions consumed by `Handle`. The volatile connection
|
|
16
|
+
* *state* is passed to `EdgeLayer` as a prop (not via context) so that a connect
|
|
17
|
+
* drag re-renders only the edge layer, not every handle.
|
|
18
|
+
*/
|
|
19
|
+
export interface ConnectionActions {
|
|
20
|
+
beginConnection: (args: {
|
|
21
|
+
nodeId: string;
|
|
22
|
+
handleId?: string;
|
|
23
|
+
type: HandleType;
|
|
24
|
+
kind?: "auto";
|
|
25
|
+
clientX: number;
|
|
26
|
+
clientY: number;
|
|
27
|
+
}) => void;
|
|
28
|
+
updateConnection: (clientX: number, clientY: number) => void;
|
|
29
|
+
endConnection: (clientX: number, clientY: number) => void;
|
|
30
|
+
cancelConnection: () => void;
|
|
31
|
+
}
|
|
32
|
+
export declare const ConnectionActionsProvider: import("react").Provider<ConnectionActions | undefined>;
|
|
33
|
+
export declare function useConnectionActions(): ConnectionActions;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const ConnectionActionsContext = createContext(undefined);
|
|
4
|
+
const ConnectionActionsProvider = ConnectionActionsContext.Provider;
|
|
5
|
+
function useConnectionActions() {
|
|
6
|
+
const ctx = useContext(ConnectionActionsContext);
|
|
7
|
+
if (!ctx) {
|
|
8
|
+
throw new Error("<Handle> must be used within <NodeCanvas>");
|
|
9
|
+
}
|
|
10
|
+
return ctx;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { ConnectionActionsProvider, useConnectionActions };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { HandlePosition, HandleType, XYPosition } from "../NodeCanvas.types";
|
|
3
|
+
/** A measured handle: its side + offset in flow coords relative to its node origin. */
|
|
4
|
+
export interface RegisteredHandle {
|
|
5
|
+
id?: string;
|
|
6
|
+
type: HandleType;
|
|
7
|
+
position: HandlePosition;
|
|
8
|
+
/** Center offset from the node's top-left, in flow units (zoom-independent). */
|
|
9
|
+
offset: XYPosition;
|
|
10
|
+
/** `auto` = omnidirectional connect-from-anywhere handle (any node ↔ any node). */
|
|
11
|
+
kind?: "auto";
|
|
12
|
+
}
|
|
13
|
+
export interface HandleRegistryValue {
|
|
14
|
+
register: (nodeId: string, handle: RegisteredHandle) => void;
|
|
15
|
+
unregister: (nodeId: string, key: string) => void;
|
|
16
|
+
/** nodeId → its registered handles. Read during edge anchoring. */
|
|
17
|
+
handlesRef: React.MutableRefObject<Map<string, RegisteredHandle[]>>;
|
|
18
|
+
/** Bumped on every register/unregister so consumers (EdgeLayer) recompute. */
|
|
19
|
+
version: number;
|
|
20
|
+
}
|
|
21
|
+
export declare const HandleRegistryProvider: React.Provider<HandleRegistryValue | undefined>;
|
|
22
|
+
export declare function useHandleRegistry(): HandleRegistryValue;
|
|
23
|
+
/** Stable registry key for a handle within its node. */
|
|
24
|
+
export declare const handleKey: (type: HandleType, id?: string) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const HandleRegistryContext = createContext(undefined);
|
|
4
|
+
const HandleRegistryProvider = HandleRegistryContext.Provider;
|
|
5
|
+
function useHandleRegistry() {
|
|
6
|
+
const ctx = useContext(HandleRegistryContext);
|
|
7
|
+
if (!ctx) {
|
|
8
|
+
throw new Error("<Handle> must be used within <NodeCanvas>");
|
|
9
|
+
}
|
|
10
|
+
return ctx;
|
|
11
|
+
}
|
|
12
|
+
/** Stable registry key for a handle within its node. */
|
|
13
|
+
const handleKey = (type, id) => `${type}:${id !== null && id !== void 0 ? id : ""}`;
|
|
14
|
+
|
|
15
|
+
export { HandleRegistryProvider, handleKey, useHandleRegistry };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Holds transient interaction state shared between the pane and the nodes/edges
|
|
4
|
+
* (node drag, connection drag). Kept separate from {@link CanvasContextValue} so
|
|
5
|
+
* that high-frequency interaction updates don't re-render viewport consumers.
|
|
6
|
+
*
|
|
7
|
+
* In the foundation this only tracks whether an interaction (node drag / connect)
|
|
8
|
+
* owns the current gesture, so the pane can decline to pan. Selection and
|
|
9
|
+
* connection state are layered on in later issues.
|
|
10
|
+
*/
|
|
11
|
+
export interface InteractionContextValue {
|
|
12
|
+
/** True while a node drag or connection drag owns the pointer gesture. */
|
|
13
|
+
interactingRef: React.MutableRefObject<boolean>;
|
|
14
|
+
setInteracting: (interacting: boolean) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const InteractionProvider: React.Provider<InteractionContextValue | undefined>;
|
|
17
|
+
/** Access transient interaction state. Throws outside `<NodeCanvas>`. */
|
|
18
|
+
export declare function useCanvasInteraction(): InteractionContextValue;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const InteractionContext = createContext(undefined);
|
|
4
|
+
const InteractionProvider = InteractionContext.Provider;
|
|
5
|
+
/** Access transient interaction state. Throws outside `<NodeCanvas>`. */
|
|
6
|
+
function useCanvasInteraction() {
|
|
7
|
+
const ctx = useContext(InteractionContext);
|
|
8
|
+
if (!ctx) {
|
|
9
|
+
throw new Error("NodeCanvas compound parts must be used within <NodeCanvas>");
|
|
10
|
+
}
|
|
11
|
+
return ctx;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { InteractionProvider, useCanvasInteraction };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
/** Provides the current node's id to anything rendered inside it (e.g. `Handle`). */
|
|
4
|
+
const NodeIdContext = createContext(undefined);
|
|
5
|
+
const NodeIdProvider = NodeIdContext.Provider;
|
|
6
|
+
/** Read the id of the node a component is rendered inside. Throws if used outside a node. */
|
|
7
|
+
function useNodeId() {
|
|
8
|
+
const id = useContext(NodeIdContext);
|
|
9
|
+
if (id === undefined) {
|
|
10
|
+
throw new Error("<Handle> must be rendered inside a NodeCanvas node component");
|
|
11
|
+
}
|
|
12
|
+
return id;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { NodeIdProvider, useNodeId };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { HandleType } from "../NodeCanvas.types";
|
|
3
|
+
interface UseConnectionParams {
|
|
4
|
+
nodeId: string;
|
|
5
|
+
handleId?: string;
|
|
6
|
+
type: HandleType;
|
|
7
|
+
kind?: "auto";
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Wires a `Handle`'s pointer-down to a connection drag: begins the connection,
|
|
11
|
+
* tracks the cursor on `window` (so it follows past the handle), and completes /
|
|
12
|
+
* cancels on release. Stops propagation so the node neither drags nor selects.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useConnection(params: UseConnectionParams): {
|
|
15
|
+
onPointerDown: (e: React.PointerEvent) => void;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useConnectionActions } from '../context/ConnectionContext.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Wires a `Handle`'s pointer-down to a connection drag: begins the connection,
|
|
5
|
+
* tracks the cursor on `window` (so it follows past the handle), and completes /
|
|
6
|
+
* cancels on release. Stops propagation so the node neither drags nor selects.
|
|
7
|
+
*/
|
|
8
|
+
function useConnection(params) {
|
|
9
|
+
const { nodeId, handleId, type, kind } = params;
|
|
10
|
+
const { beginConnection, updateConnection, endConnection } = useConnectionActions();
|
|
11
|
+
const onPointerDown = (e) => {
|
|
12
|
+
if (e.button !== 0)
|
|
13
|
+
return;
|
|
14
|
+
e.preventDefault();
|
|
15
|
+
e.stopPropagation();
|
|
16
|
+
beginConnection({ nodeId, handleId, type, kind, clientX: e.clientX, clientY: e.clientY });
|
|
17
|
+
const move = (ev) => updateConnection(ev.clientX, ev.clientY);
|
|
18
|
+
const up = (ev) => {
|
|
19
|
+
window.removeEventListener("pointermove", move);
|
|
20
|
+
window.removeEventListener("pointerup", up);
|
|
21
|
+
endConnection(ev.clientX, ev.clientY);
|
|
22
|
+
};
|
|
23
|
+
window.addEventListener("pointermove", move);
|
|
24
|
+
window.addEventListener("pointerup", up);
|
|
25
|
+
};
|
|
26
|
+
return { onPointerDown };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { useConnection };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export interface MarqueeRect {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
interface UseMarqueeParams {
|
|
9
|
+
paneRef: React.RefObject<HTMLDivElement | null>;
|
|
10
|
+
lockedRef: React.MutableRefObject<boolean>;
|
|
11
|
+
/** Marquee is select-tool only. */
|
|
12
|
+
toolRef: React.MutableRefObject<"select" | "pan">;
|
|
13
|
+
/** Set true while marqueeing so the pane declines to pan. */
|
|
14
|
+
interactingRef: React.MutableRefObject<boolean>;
|
|
15
|
+
/** Replace selection with exactly these node ids (live, during the drag). */
|
|
16
|
+
onSelect: (nodeIds: string[]) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Shift + drag on the empty canvas draws a selection rectangle and selects every
|
|
20
|
+
* intersecting node (live). Intersection is tested in screen coords against each
|
|
21
|
+
* node's real rendered rect, so it's accurate regardless of node size or zoom.
|
|
22
|
+
* Returns the pane-local rect to render, or `null` when inactive.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useMarquee({ paneRef, lockedRef, toolRef, interactingRef, onSelect, }: UseMarqueeParams): MarqueeRect | null;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
const IGNORE = "[data-flikkui-node],[data-flikkui-handle],[data-flikkui-edge],[data-flikkui-controls],[data-flikkui-nopan],[data-flikkui-portal]";
|
|
4
|
+
/**
|
|
5
|
+
* Shift + drag on the empty canvas draws a selection rectangle and selects every
|
|
6
|
+
* intersecting node (live). Intersection is tested in screen coords against each
|
|
7
|
+
* node's real rendered rect, so it's accurate regardless of node size or zoom.
|
|
8
|
+
* Returns the pane-local rect to render, or `null` when inactive.
|
|
9
|
+
*/
|
|
10
|
+
function useMarquee({ paneRef, lockedRef, toolRef, interactingRef, onSelect, }) {
|
|
11
|
+
const [rect, setRect] = useState(null);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const pane = paneRef.current;
|
|
14
|
+
if (!pane)
|
|
15
|
+
return;
|
|
16
|
+
let start = null;
|
|
17
|
+
let active = false;
|
|
18
|
+
const onDown = (e) => {
|
|
19
|
+
if (e.button !== 0 || !e.shiftKey || lockedRef.current || toolRef.current === "pan")
|
|
20
|
+
return;
|
|
21
|
+
const target = e.target;
|
|
22
|
+
if (target === null || target === void 0 ? void 0 : target.closest(IGNORE))
|
|
23
|
+
return; // only on empty canvas
|
|
24
|
+
const r = pane.getBoundingClientRect();
|
|
25
|
+
start = { x: e.clientX - r.left, y: e.clientY - r.top };
|
|
26
|
+
active = true;
|
|
27
|
+
interactingRef.current = true;
|
|
28
|
+
try {
|
|
29
|
+
pane.setPointerCapture(e.pointerId);
|
|
30
|
+
}
|
|
31
|
+
catch (_a) {
|
|
32
|
+
/* noop */
|
|
33
|
+
}
|
|
34
|
+
setRect({ x: start.x, y: start.y, width: 0, height: 0 });
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
};
|
|
37
|
+
const onMove = (e) => {
|
|
38
|
+
if (!active || !start)
|
|
39
|
+
return;
|
|
40
|
+
const r = pane.getBoundingClientRect();
|
|
41
|
+
const cx = e.clientX - r.left;
|
|
42
|
+
const cy = e.clientY - r.top;
|
|
43
|
+
const x = Math.min(start.x, cx);
|
|
44
|
+
const y = Math.min(start.y, cy);
|
|
45
|
+
const width = Math.abs(cx - start.x);
|
|
46
|
+
const height = Math.abs(cy - start.y);
|
|
47
|
+
setRect({ x, y, width, height });
|
|
48
|
+
const mLeft = r.left + x;
|
|
49
|
+
const mTop = r.top + y;
|
|
50
|
+
const mRight = mLeft + width;
|
|
51
|
+
const mBottom = mTop + height;
|
|
52
|
+
const ids = [];
|
|
53
|
+
pane.querySelectorAll("[data-flikkui-node]").forEach((el) => {
|
|
54
|
+
const nr = el.getBoundingClientRect();
|
|
55
|
+
if (nr.left < mRight && nr.right > mLeft && nr.top < mBottom && nr.bottom > mTop) {
|
|
56
|
+
const id = el.getAttribute("data-flikkui-node");
|
|
57
|
+
if (id)
|
|
58
|
+
ids.push(id);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
onSelect(ids);
|
|
62
|
+
};
|
|
63
|
+
const onUp = (e) => {
|
|
64
|
+
if (!active)
|
|
65
|
+
return;
|
|
66
|
+
active = false;
|
|
67
|
+
start = null;
|
|
68
|
+
interactingRef.current = false;
|
|
69
|
+
setRect(null);
|
|
70
|
+
try {
|
|
71
|
+
pane.releasePointerCapture(e.pointerId);
|
|
72
|
+
}
|
|
73
|
+
catch (_a) {
|
|
74
|
+
/* noop */
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
pane.addEventListener("pointerdown", onDown);
|
|
78
|
+
pane.addEventListener("pointermove", onMove);
|
|
79
|
+
pane.addEventListener("pointerup", onUp);
|
|
80
|
+
pane.addEventListener("pointercancel", onUp);
|
|
81
|
+
return () => {
|
|
82
|
+
pane.removeEventListener("pointerdown", onDown);
|
|
83
|
+
pane.removeEventListener("pointermove", onMove);
|
|
84
|
+
pane.removeEventListener("pointerup", onUp);
|
|
85
|
+
pane.removeEventListener("pointercancel", onUp);
|
|
86
|
+
};
|
|
87
|
+
}, [paneRef, lockedRef, toolRef, interactingRef, onSelect]);
|
|
88
|
+
return rect;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export { useMarquee };
|