dishui 0.0.64 → 0.0.66
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/_virtual/_rolldown/runtime.js +10 -11
- package/dist/chart.js +12 -46
- package/dist/code-editor.js +16 -43
- package/dist/components/Badge/index.js +11 -13
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Button/index.js +62 -86
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Card/index.d.ts +87 -0
- package/dist/components/Card/index.js +178 -44
- package/dist/components/Card/index.js.map +1 -1
- package/dist/components/Chart/Chart.js +25 -25
- package/dist/components/Chart/Chart.js.map +1 -1
- package/dist/components/Checkbox/index.js +57 -63
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/ChoicePicker/index.d.ts +44 -0
- package/dist/components/ChoicePicker/index.js +81 -0
- package/dist/components/ChoicePicker/index.js.map +1 -0
- package/dist/components/Column/index.d.ts +28 -0
- package/dist/components/Column/index.js +30 -0
- package/dist/components/Column/index.js.map +1 -0
- package/dist/components/DateTimeInput/index.d.ts +44 -0
- package/dist/components/DateTimeInput/index.js +48 -0
- package/dist/components/DateTimeInput/index.js.map +1 -0
- package/dist/components/Demo/index.js +107 -107
- package/dist/components/Demo/index.js.map +1 -1
- package/dist/components/Divider/index.d.ts +20 -0
- package/dist/components/Divider/index.js +30 -0
- package/dist/components/Divider/index.js.map +1 -0
- package/dist/components/EmptyState/index.d.ts +4 -1
- package/dist/components/EmptyState/index.js +24 -24
- package/dist/components/EmptyState/index.js.map +1 -1
- package/dist/components/FileUploader/DropZone.js +134 -136
- package/dist/components/FileUploader/DropZone.js.map +1 -1
- package/dist/components/FileUploader/FileItem.js +159 -163
- package/dist/components/FileUploader/FileItem.js.map +1 -1
- package/dist/components/FileUploader/FileUploader.js +126 -127
- package/dist/components/FileUploader/FileUploader.js.map +1 -1
- package/dist/components/FileUploader/UploadQueue.js +62 -62
- package/dist/components/FileUploader/UploadQueue.js.map +1 -1
- package/dist/components/FloatWindow/index.d.ts +28 -0
- package/dist/components/GridLayout/index.d.ts +42 -0
- package/dist/components/Icon/index.d.ts +24 -0
- package/dist/components/Icon/index.js +26 -0
- package/dist/components/Icon/index.js.map +1 -0
- package/dist/components/Image/index.d.ts +33 -0
- package/dist/components/Image/index.js +44 -0
- package/dist/components/Image/index.js.map +1 -0
- package/dist/components/Input/index.js +196 -197
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Label/index.js +62 -73
- package/dist/components/Label/index.js.map +1 -1
- package/dist/components/Layout/index.js +134 -139
- package/dist/components/Layout/index.js.map +1 -1
- package/dist/components/List/index.js +45 -43
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/Markdown/Markdown.js +106 -103
- package/dist/components/Markdown/Markdown.js.map +1 -1
- package/dist/components/Markdown/codeThemes.js +24 -33
- package/dist/components/Markdown/codeThemes.js.map +1 -1
- package/dist/components/Markdown/markdownComponents.js +203 -208
- package/dist/components/Markdown/markdownComponents.js.map +1 -1
- package/dist/components/Markdown/parseCodeBlockMeta.js +22 -22
- package/dist/components/Markdown/parseCodeBlockMeta.js.map +1 -1
- package/dist/components/Markdown/useMarkdownSource.js +46 -46
- package/dist/components/Markdown/useMarkdownSource.js.map +1 -1
- package/dist/components/Markdown/useMarkmapRenderer.js +35 -36
- package/dist/components/Markdown/useMarkmapRenderer.js.map +1 -1
- package/dist/components/Markdown/useMermaidRenderer.js +41 -42
- package/dist/components/Markdown/useMermaidRenderer.js.map +1 -1
- package/dist/components/Modal/index.d.ts +7 -3
- package/dist/components/Modal/index.js +82 -70
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/MultipleChoice/index.d.ts +44 -0
- package/dist/components/MultipleChoice/index.js +52 -0
- package/dist/components/MultipleChoice/index.js.map +1 -0
- package/dist/components/Notification/index.d.ts +17 -0
- package/dist/components/Page/index.d.ts +58 -0
- package/dist/components/Page/index.js +43 -0
- package/dist/components/Page/index.js.map +1 -0
- package/dist/components/PageHeader/index.js +28 -28
- package/dist/components/PageHeader/index.js.map +1 -1
- package/dist/components/ProtectedRoute/index.js +8 -9
- package/dist/components/ProtectedRoute/index.js.map +1 -1
- package/dist/components/Row/index.d.ts +28 -0
- package/dist/components/Row/index.js +30 -0
- package/dist/components/Row/index.js.map +1 -0
- package/dist/components/Select/index.js +251 -257
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/SidebarToggleButton/index.js +56 -59
- package/dist/components/SidebarToggleButton/index.js.map +1 -1
- package/dist/components/Slider/index.d.ts +39 -0
- package/dist/components/Slider/index.js +52 -0
- package/dist/components/Slider/index.js.map +1 -0
- package/dist/components/StatCard/index.d.ts +31 -1
- package/dist/components/StatCard/index.js +189 -58
- package/dist/components/StatCard/index.js.map +1 -1
- package/dist/components/Switch/index.d.ts +34 -0
- package/dist/components/Switch/index.js +55 -0
- package/dist/components/Switch/index.js.map +1 -0
- package/dist/components/Tab/index.d.ts +40 -0
- package/dist/components/Table/index.js +109 -103
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +19 -5
- package/dist/components/Tabs/index.js +30 -21
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Text/index.d.ts +43 -0
- package/dist/components/Text/index.js +55 -0
- package/dist/components/Text/index.js.map +1 -0
- package/dist/components/Tooltip/index.d.ts +23 -0
- package/dist/components/Tooltip/index.js +34 -0
- package/dist/components/Tooltip/index.js.map +1 -0
- package/dist/components/Tree/Tree.js +205 -205
- package/dist/components/Tree/Tree.js.map +1 -1
- package/dist/components/pro/ArticleContextMenu/index.js +86 -87
- package/dist/components/pro/ArticleContextMenu/index.js.map +1 -1
- package/dist/components/pro/ArticleControl/ArticleControl2.js +250 -250
- package/dist/components/pro/ArticleControl/ArticleControl2.js.map +1 -1
- package/dist/components/pro/ArticleControl/buildHeadingTree.js +31 -32
- package/dist/components/pro/ArticleControl/buildHeadingTree.js.map +1 -1
- package/dist/components/pro/ArticleControl/useArticleToc.js +100 -102
- package/dist/components/pro/ArticleControl/useArticleToc.js.map +1 -1
- package/dist/components/pro/Calendar/Calendar.d.ts +10 -0
- package/dist/components/pro/Calendar/hooks/useCalendarDrag.d.ts +47 -0
- package/dist/components/pro/Calendar/hooks/useCalendarState.d.ts +56 -0
- package/dist/components/pro/Calendar/index.d.ts +7 -0
- package/dist/components/pro/Calendar/types.d.ts +151 -0
- package/dist/components/pro/Calendar/utils.d.ts +94 -0
- package/dist/components/pro/Chat/Chat.d.ts +6 -0
- package/dist/components/pro/Chat/index.d.ts +2 -0
- package/dist/components/pro/Chat/types.d.ts +84 -0
- package/dist/components/pro/CodeEditor/editors/CodeEditor.js +287 -320
- package/dist/components/pro/CodeEditor/editors/CodeEditor.js.map +1 -1
- package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js +167 -221
- package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js.map +1 -1
- package/dist/components/pro/CodeEditor/editors/markdownExtensions.js +594 -613
- package/dist/components/pro/CodeEditor/editors/markdownExtensions.js.map +1 -1
- package/dist/components/pro/CodeEditor/extensions/contextMenu.js +54 -55
- package/dist/components/pro/CodeEditor/extensions/contextMenu.js.map +1 -1
- package/dist/components/pro/CodeEditor/extensions/index.js +152 -160
- package/dist/components/pro/CodeEditor/extensions/index.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/index.js +7 -15
- package/dist/components/pro/CodeEditor/langs/index.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/javascript.js +11 -48
- package/dist/components/pro/CodeEditor/langs/javascript.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/python.js +4 -40
- package/dist/components/pro/CodeEditor/langs/python.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/snippets.js +118 -147
- package/dist/components/pro/CodeEditor/langs/snippets.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/FootnotePanel.js +153 -153
- package/dist/components/pro/CodeEditor/panels/FootnotePanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/HistoryPanel.js +180 -190
- package/dist/components/pro/CodeEditor/panels/HistoryPanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/OutlinePanel.js +130 -137
- package/dist/components/pro/CodeEditor/panels/OutlinePanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/TableOfContentsPanel.js +228 -242
- package/dist/components/pro/CodeEditor/panels/TableOfContentsPanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/VariablePanel.js +208 -248
- package/dist/components/pro/CodeEditor/panels/VariablePanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/themes.js +513 -483
- package/dist/components/pro/CodeEditor/themes.js.map +1 -1
- package/dist/components/pro/CodeEditor/types.d.ts +1 -1
- package/dist/components/pro/CodeEditor/utils.js +171 -175
- package/dist/components/pro/CodeEditor/utils.js.map +1 -1
- package/dist/components/pro/DataTable/DataTable.js +305 -305
- package/dist/components/pro/DataTable/DataTable.js.map +1 -1
- package/dist/components/pro/DataTable/Filters.js +299 -314
- package/dist/components/pro/DataTable/Filters.js.map +1 -1
- package/dist/components/pro/DataTable/PivotPanel.js +203 -204
- package/dist/components/pro/DataTable/PivotPanel.js.map +1 -1
- package/dist/components/pro/DataTable/PivotView.js +142 -141
- package/dist/components/pro/DataTable/PivotView.js.map +1 -1
- package/dist/components/pro/DataTable/components/BulkActions.js +42 -42
- package/dist/components/pro/DataTable/components/BulkActions.js.map +1 -1
- package/dist/components/pro/DataTable/components/ColumnSelector.js +84 -84
- package/dist/components/pro/DataTable/components/ColumnSelector.js.map +1 -1
- package/dist/components/pro/DataTable/components/FilterBar.js +58 -58
- package/dist/components/pro/DataTable/components/FilterBar.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableBody.js +93 -94
- package/dist/components/pro/DataTable/components/TableBody.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableHeader.js +78 -78
- package/dist/components/pro/DataTable/components/TableHeader.js.map +1 -1
- package/dist/components/pro/DataTable/components/TablePagination.js +77 -77
- package/dist/components/pro/DataTable/components/TablePagination.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableToolbar.js +40 -40
- package/dist/components/pro/DataTable/components/TableToolbar.js.map +1 -1
- package/dist/components/pro/DataTable/extension.js +5 -5
- package/dist/components/pro/DataTable/extension.js.map +1 -1
- package/dist/components/pro/DataTable/pivotEngine.js +84 -92
- package/dist/components/pro/DataTable/pivotEngine.js.map +1 -1
- package/dist/components/pro/DataTable/pivotExtension.js +93 -93
- package/dist/components/pro/DataTable/pivotExtension.js.map +1 -1
- package/dist/components/pro/DataTable/rowDetailExtension.js +30 -30
- package/dist/components/pro/DataTable/rowDetailExtension.js.map +1 -1
- package/dist/components/pro/DataTable/tanstack-table.js +45 -62
- package/dist/components/pro/DataTable/tanstack-table.js.map +1 -1
- package/dist/components/pro/DataTable/treeDataUtils.js +37 -48
- package/dist/components/pro/DataTable/treeDataUtils.js.map +1 -1
- package/dist/components/pro/DataTable/useColumnDragReorder.js +68 -68
- package/dist/components/pro/DataTable/useColumnDragReorder.js.map +1 -1
- package/dist/components/pro/DataTable/utils.js +156 -168
- package/dist/components/pro/DataTable/utils.js.map +1 -1
- package/dist/components/pro/FileExplorer/Breadcrumb.js +180 -180
- package/dist/components/pro/FileExplorer/Breadcrumb.js.map +1 -1
- package/dist/components/pro/FileExplorer/CreateDialog.js +78 -78
- package/dist/components/pro/FileExplorer/CreateDialog.js.map +1 -1
- package/dist/components/pro/FileExplorer/FileExplorer.js +202 -205
- package/dist/components/pro/FileExplorer/FileExplorer.js.map +1 -1
- package/dist/components/pro/FileExplorer/FileIcon.js +190 -190
- package/dist/components/pro/FileExplorer/FileIcon.js.map +1 -1
- package/dist/components/pro/FileExplorer/GridView.js +100 -100
- package/dist/components/pro/FileExplorer/GridView.js.map +1 -1
- package/dist/components/pro/FileExplorer/ListView.js +209 -209
- package/dist/components/pro/FileExplorer/ListView.js.map +1 -1
- package/dist/components/pro/FileExplorer/Toolbar.js +199 -199
- package/dist/components/pro/FileExplorer/Toolbar.js.map +1 -1
- package/dist/components/pro/Flow/Flow.js +920 -946
- package/dist/components/pro/Flow/Flow.js.map +1 -1
- package/dist/components/pro/Flow/FlowCanvas.js +1626 -1663
- package/dist/components/pro/Flow/FlowCanvas.js.map +1 -1
- package/dist/components/pro/Flow/archify/build.js +85 -94
- package/dist/components/pro/Flow/archify/build.js.map +1 -1
- package/dist/components/pro/Flow/archify/convert.js +512 -519
- package/dist/components/pro/Flow/archify/convert.js.map +1 -1
- package/dist/components/pro/Flow/archify/palette.js +87 -104
- package/dist/components/pro/Flow/archify/palette.js.map +1 -1
- package/dist/components/pro/Flow/archify/presets.js +34 -37
- package/dist/components/pro/Flow/archify/presets.js.map +1 -1
- package/dist/components/pro/Flow/archify/spec.js +7 -7
- package/dist/components/pro/Flow/archify/spec.js.map +1 -1
- package/dist/components/pro/Flow/canvas/AlignmentGuides.js +25 -25
- package/dist/components/pro/Flow/canvas/AlignmentGuides.js.map +1 -1
- package/dist/components/pro/Flow/canvas/GridRenderer.js +54 -55
- package/dist/components/pro/Flow/canvas/GridRenderer.js.map +1 -1
- package/dist/components/pro/Flow/canvas/MiniMapRenderer.js +54 -58
- package/dist/components/pro/Flow/canvas/MiniMapRenderer.js.map +1 -1
- package/dist/components/pro/Flow/canvas/PixiApp.js +105 -102
- package/dist/components/pro/Flow/canvas/PixiApp.js.map +1 -1
- package/dist/components/pro/Flow/canvas/SelectionOverlay.js +38 -38
- package/dist/components/pro/Flow/canvas/SelectionOverlay.js.map +1 -1
- package/dist/components/pro/Flow/canvas/ViewportContainer.js +117 -117
- package/dist/components/pro/Flow/canvas/ViewportContainer.js.map +1 -1
- package/dist/components/pro/Flow/constants.js +266 -278
- package/dist/components/pro/Flow/constants.js.map +1 -1
- package/dist/components/pro/Flow/context/FlowAIContext.js +27 -28
- package/dist/components/pro/Flow/context/FlowAIContext.js.map +1 -1
- package/dist/components/pro/Flow/context/FlowContext.js +60 -61
- package/dist/components/pro/Flow/context/FlowContext.js.map +1 -1
- package/dist/components/pro/Flow/context/FlowUIContext.js +115 -117
- package/dist/components/pro/Flow/context/FlowUIContext.js.map +1 -1
- package/dist/components/pro/Flow/edges/EdgeRenderer.js +135 -138
- package/dist/components/pro/Flow/edges/EdgeRenderer.js.map +1 -1
- package/dist/components/pro/Flow/edges/edgeMarkers.js +11 -14
- package/dist/components/pro/Flow/edges/edgeMarkers.js.map +1 -1
- package/dist/components/pro/Flow/edges/edgePaths.js +351 -367
- package/dist/components/pro/Flow/edges/edgePaths.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useAlignmentGuides.js +49 -52
- package/dist/components/pro/Flow/hooks/useAlignmentGuides.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useClipboard.js +154 -154
- package/dist/components/pro/Flow/hooks/useClipboard.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useCompactMode.js +17 -17
- package/dist/components/pro/Flow/hooks/useCompactMode.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useDeleteSelection.js +40 -40
- package/dist/components/pro/Flow/hooks/useDeleteSelection.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useDraggablePanel.js +51 -51
- package/dist/components/pro/Flow/hooks/useDraggablePanel.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useEdgeMutations.js +157 -157
- package/dist/components/pro/Flow/hooks/useEdgeMutations.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useFlowImportExport.js +190 -201
- package/dist/components/pro/Flow/hooks/useFlowImportExport.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.js +32 -38
- package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useLayoutActions.js +172 -182
- package/dist/components/pro/Flow/hooks/useLayoutActions.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useLineMutations.js +57 -57
- package/dist/components/pro/Flow/hooks/useLineMutations.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useMindMap.js +229 -238
- package/dist/components/pro/Flow/hooks/useMindMap.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useNodeMutations.js +102 -102
- package/dist/components/pro/Flow/hooks/useNodeMutations.js.map +1 -1
- package/dist/components/pro/Flow/hooks/usePdfExport.js +55 -56
- package/dist/components/pro/Flow/hooks/usePdfExport.js.map +1 -1
- package/dist/components/pro/Flow/hooks/usePixiApp.js +55 -57
- package/dist/components/pro/Flow/hooks/usePixiApp.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useResizablePanel.js +31 -31
- package/dist/components/pro/Flow/hooks/useResizablePanel.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useSelection.js +69 -69
- package/dist/components/pro/Flow/hooks/useSelection.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useUndoRedo.js +27 -27
- package/dist/components/pro/Flow/hooks/useUndoRedo.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useViewport.js +28 -28
- package/dist/components/pro/Flow/hooks/useViewport.js.map +1 -1
- package/dist/components/pro/Flow/lines/FreehandTool.js +63 -63
- package/dist/components/pro/Flow/lines/FreehandTool.js.map +1 -1
- package/dist/components/pro/Flow/lines/GeometricLineTool.js +80 -80
- package/dist/components/pro/Flow/lines/GeometricLineTool.js.map +1 -1
- package/dist/components/pro/Flow/lines/LineRenderer.js +88 -88
- package/dist/components/pro/Flow/lines/LineRenderer.js.map +1 -1
- package/dist/components/pro/Flow/lines/lineSmoothing.js +32 -34
- package/dist/components/pro/Flow/lines/lineSmoothing.js.map +1 -1
- package/dist/components/pro/Flow/nodes/DataNodeView.js +236 -222
- package/dist/components/pro/Flow/nodes/DataNodeView.js.map +1 -1
- package/dist/components/pro/Flow/nodes/MediaContent.js +236 -246
- package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
- package/dist/components/pro/Flow/nodes/MediaOverlay.js +63 -63
- package/dist/components/pro/Flow/nodes/MediaOverlay.js.map +1 -1
- package/dist/components/pro/Flow/nodes/Model3DView.js +111 -113
- package/dist/components/pro/Flow/nodes/Model3DView.js.map +1 -1
- package/dist/components/pro/Flow/nodes/NodeHandles.js +74 -80
- package/dist/components/pro/Flow/nodes/NodeHandles.js.map +1 -1
- package/dist/components/pro/Flow/nodes/NodeRenderer.js +303 -314
- package/dist/components/pro/Flow/nodes/NodeRenderer.js.map +1 -1
- package/dist/components/pro/Flow/nodes/NodeText.js +25 -29
- package/dist/components/pro/Flow/nodes/NodeText.js.map +1 -1
- package/dist/components/pro/Flow/nodes/aiClient.js +124 -137
- package/dist/components/pro/Flow/nodes/aiClient.js.map +1 -1
- package/dist/components/pro/Flow/nodes/animAnchors.js +42 -49
- package/dist/components/pro/Flow/nodes/animAnchors.js.map +1 -1
- package/dist/components/pro/Flow/nodes/dataUtils.js +246 -267
- package/dist/components/pro/Flow/nodes/dataUtils.js.map +1 -1
- package/dist/components/pro/Flow/nodes/nodeUtils.js +23 -28
- package/dist/components/pro/Flow/nodes/nodeUtils.js.map +1 -1
- package/dist/components/pro/Flow/nodes/shapes.js +556 -591
- package/dist/components/pro/Flow/nodes/shapes.js.map +1 -1
- package/dist/components/pro/Flow/nodes/svgIconTexture.js +37 -39
- package/dist/components/pro/Flow/nodes/svgIconTexture.js.map +1 -1
- package/dist/components/pro/Flow/nodes/svgIcons.js +684 -689
- package/dist/components/pro/Flow/nodes/svgIcons.js.map +1 -1
- package/dist/components/pro/Flow/panels/AIPanel.js +464 -491
- package/dist/components/pro/Flow/panels/AIPanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/Breadcrumb.js +41 -41
- package/dist/components/pro/Flow/panels/Breadcrumb.js.map +1 -1
- package/dist/components/pro/Flow/panels/ContextMenu.js +37 -37
- package/dist/components/pro/Flow/panels/ContextMenu.js.map +1 -1
- package/dist/components/pro/Flow/panels/DataInspectorSection.js +428 -432
- package/dist/components/pro/Flow/panels/DataInspectorSection.js.map +1 -1
- package/dist/components/pro/Flow/panels/ExpandableTextarea.js +61 -62
- package/dist/components/pro/Flow/panels/ExpandableTextarea.js.map +1 -1
- package/dist/components/pro/Flow/panels/FlowPanelGroup.js +114 -114
- package/dist/components/pro/Flow/panels/FlowPanelGroup.js.map +1 -1
- package/dist/components/pro/Flow/panels/FlowToolbar.js +347 -391
- package/dist/components/pro/Flow/panels/FlowToolbar.js.map +1 -1
- package/dist/components/pro/Flow/panels/InspectorPanel.js +1792 -1798
- package/dist/components/pro/Flow/panels/InspectorPanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/OutlinePanel.js +242 -244
- package/dist/components/pro/Flow/panels/OutlinePanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/PresentationMode.js +137 -138
- package/dist/components/pro/Flow/panels/PresentationMode.js.map +1 -1
- package/dist/components/pro/Flow/panels/ProjectTitle.js +46 -46
- package/dist/components/pro/Flow/panels/ProjectTitle.js.map +1 -1
- package/dist/components/pro/Flow/panels/ShapePalette.js +557 -567
- package/dist/components/pro/Flow/panels/ShapePalette.js.map +1 -1
- package/dist/components/pro/Flow/panels/toolbarIcons.d.ts +0 -1
- package/dist/components/pro/Flow/panels/toolbarIcons.js +508 -557
- package/dist/components/pro/Flow/panels/toolbarIcons.js.map +1 -1
- package/dist/components/pro/Flow/types.js +26 -26
- package/dist/components/pro/Flow/types.js.map +1 -1
- package/dist/components/pro/Flow/utils/dashedLine.js +113 -117
- package/dist/components/pro/Flow/utils/dashedLine.js.map +1 -1
- package/dist/components/pro/Flow/utils/gradient.js +55 -55
- package/dist/components/pro/Flow/utils/gradient.js.map +1 -1
- package/dist/components/pro/Flow/utils/pdfExport.js +50 -89
- package/dist/components/pro/Flow/utils/pdfExport.js.map +1 -1
- package/dist/components/pro/Flow/utils/themeColor.js +185 -195
- package/dist/components/pro/Flow/utils/themeColor.js.map +1 -1
- package/dist/components/pro/Gantt/Gantt.d.ts +7 -0
- package/dist/components/pro/Gantt/hooks/useGanttDrag.d.ts +31 -0
- package/dist/components/pro/Gantt/hooks/useGanttState.d.ts +58 -0
- package/dist/components/pro/Gantt/index.d.ts +6 -0
- package/dist/components/pro/Gantt/types.d.ts +478 -0
- package/dist/components/pro/Gantt/utils.d.ts +124 -0
- package/dist/components/pro/Resizable/Resizable.d.ts +30 -0
- package/dist/components/pro/Resizable/index.d.ts +2 -0
- package/dist/components/pro/RichTextEditor/AIRewrite.js +323 -334
- package/dist/components/pro/RichTextEditor/AIRewrite.js.map +1 -1
- package/dist/components/pro/RichTextEditor/BlockHandle.js +314 -316
- package/dist/components/pro/RichTextEditor/BlockHandle.js.map +1 -1
- package/dist/components/pro/RichTextEditor/BubbleToolbar.js +97 -97
- package/dist/components/pro/RichTextEditor/BubbleToolbar.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentDialog.js +88 -88
- package/dist/components/pro/RichTextEditor/CommentDialog.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentPanel.js +240 -240
- package/dist/components/pro/RichTextEditor/CommentPanel.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentPopover.js +234 -234
- package/dist/components/pro/RichTextEditor/CommentPopover.js.map +1 -1
- package/dist/components/pro/RichTextEditor/ContextMenu.js +251 -252
- package/dist/components/pro/RichTextEditor/ContextMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/RichTextEditor.js +267 -271
- package/dist/components/pro/RichTextEditor/RichTextEditor.js.map +1 -1
- package/dist/components/pro/RichTextEditor/SlashMenu.js +214 -214
- package/dist/components/pro/RichTextEditor/SlashMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js +44 -75
- package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js +261 -261
- package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js +172 -526
- package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/SelectDropdown.js +112 -114
- package/dist/components/pro/RichTextEditor/Toolbar/SelectDropdown.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js +194 -194
- package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js +970 -973
- package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.js +11 -12
- package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js +310 -344
- package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/CommentMark.js +38 -39
- package/dist/components/pro/RichTextEditor/extensions/CommentMark.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js +620 -625
- package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/FontSize.js +25 -25
- package/dist/components/pro/RichTextEditor/extensions/FontSize.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js +167 -176
- package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js.map +1 -1
- package/dist/components/pro/RichTextEditor/types.js +75 -75
- package/dist/components/pro/RichTextEditor/types.js.map +1 -1
- package/dist/contexts/AppContext.d.ts +1 -1
- package/dist/contexts/AppContext.js +216 -221
- package/dist/contexts/AppContext.js.map +1 -1
- package/dist/data-table.js +15 -41
- package/dist/data-table.js.map +1 -1
- package/dist/dishui.css +1 -1
- package/dist/flow.js +27 -83
- package/dist/hooks/useClickOutside.js +18 -18
- package/dist/hooks/useClickOutside.js.map +1 -1
- package/dist/hooks/useContainerElement.js +9 -9
- package/dist/hooks/useContainerElement.js.map +1 -1
- package/dist/hooks/useControllableState.js +33 -35
- package/dist/hooks/useControllableState.js.map +1 -1
- package/dist/hooks/useCopyToClipboard.js +16 -16
- package/dist/hooks/useCopyToClipboard.js.map +1 -1
- package/dist/hooks/useDebounce.js +14 -14
- package/dist/hooks/useDebounce.js.map +1 -1
- package/dist/hooks/useDraggable.js +50 -50
- package/dist/hooks/useDraggable.js.map +1 -1
- package/dist/hooks/useTableColumns.js +39 -42
- package/dist/hooks/useTableColumns.js.map +1 -1
- package/dist/hooks/useTableData.js +67 -68
- package/dist/hooks/useTableData.js.map +1 -1
- package/dist/index-nostyled.d.ts +8 -0
- package/dist/index.d.ts +29 -1
- package/dist/index.js +106 -236
- package/dist/layouts/MainLayout.js +56 -56
- package/dist/layouts/MainLayout.js.map +1 -1
- package/dist/layouts/Navbar.js +214 -214
- package/dist/layouts/Navbar.js.map +1 -1
- package/dist/layouts/Sidebar.js +184 -165
- package/dist/layouts/Sidebar.js.map +1 -1
- package/dist/layouts/headbar/Headbar.js +25 -25
- package/dist/layouts/headbar/Headbar.js.map +1 -1
- package/dist/layouts/headbar/HeadbarLangSwitcher.js +39 -39
- package/dist/layouts/headbar/HeadbarLangSwitcher.js.map +1 -1
- package/dist/layouts/headbar/HeadbarSearch.js +120 -120
- package/dist/layouts/headbar/HeadbarSearch.js.map +1 -1
- package/dist/layouts/headbar/HeadbarThemeSwitcher.js +27 -27
- package/dist/layouts/headbar/HeadbarThemeSwitcher.js.map +1 -1
- package/dist/layouts/headbar/HeadbarTitle.js +26 -26
- package/dist/layouts/headbar/HeadbarTitle.js.map +1 -1
- package/dist/lite.js +9 -24
- package/dist/markdown.js +4 -9
- package/dist/pages/components/Calendar/index.d.ts +3 -0
- package/dist/pages/components/Calendar/index.en.d.ts +3 -0
- package/dist/pages/components/Calendar/index.zh.d.ts +3 -0
- package/dist/pages/components/Chat/index.d.ts +3 -0
- package/dist/pages/components/Chat/index.en.d.ts +3 -0
- package/dist/pages/components/Chat/index.zh.d.ts +3 -0
- package/dist/pages/components/FloatWindow/index.d.ts +3 -0
- package/dist/pages/components/FloatWindow/index.en.d.ts +3 -0
- package/dist/pages/components/FloatWindow/index.zh.d.ts +3 -0
- package/dist/pages/components/Gantt/index.d.ts +3 -0
- package/dist/pages/components/Gantt/index.en.d.ts +3 -0
- package/dist/pages/components/Gantt/index.zh.d.ts +3 -0
- package/dist/pages/components/GridLayout/index.d.ts +3 -0
- package/dist/pages/components/GridLayout/index.en.d.ts +3 -0
- package/dist/pages/components/GridLayout/index.zh.d.ts +3 -0
- package/dist/pages/components/Notification/index.d.ts +3 -0
- package/dist/pages/components/Notification/index.en.d.ts +3 -0
- package/dist/pages/components/Notification/index.zh.d.ts +3 -0
- package/dist/pages/components/Resizable/index.d.ts +3 -0
- package/dist/pages/components/Resizable/index.en.d.ts +3 -0
- package/dist/pages/components/Resizable/index.zh.d.ts +3 -0
- package/dist/pages/components/Tab/index.d.ts +3 -0
- package/dist/pages/components/Tab/index.en.d.ts +3 -0
- package/dist/pages/components/Tab/index.zh.d.ts +3 -0
- package/dist/styles/themeStyles.js +87 -86
- package/dist/styles/themeStyles.js.map +1 -1
- package/dist/utils/cn.d.ts +13 -0
- package/dist/utils/cn.js +16 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/i18n.js +690 -602
- package/dist/utils/i18n.js.map +1 -1
- package/dist/utils/menu.js +94 -94
- package/dist/utils/menu.js.map +1 -1
- package/dist/utils/rehype-code-meta.js +14 -14
- package/dist/utils/rehype-code-meta.js.map +1 -1
- package/dist/utils/remark-code-meta.js +9 -9
- package/dist/utils/remark-code-meta.js.map +1 -1
- package/dist/utils/routerBuilder.js +59 -58
- package/dist/utils/routerBuilder.js.map +1 -1
- package/dist/utils/selection.js +28 -29
- package/dist/utils/selection.js.map +1 -1
- package/dist/utils/themes.js +275 -255
- package/dist/utils/themes.js.map +1 -1
- package/package.json +23 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edgePaths.js","names":[],"sources":["../../../../../src/components/pro/Flow/edges/edgePaths.ts"],"sourcesContent":["import type { FlowEdgeTypeName, FlowBezierControl, FlowEdge, FlowNode } from '../types';\nimport { getHandlePositions, type HandleDef } from '../nodes/NodeHandles';\n\n/** Outward unit normal for a handle side */\nconst SIDE_NORMAL: Record<string, { dx: number; dy: number }> = {\n top: { dx: 0, dy: -1 },\n bottom: { dx: 0, dy: 1 },\n left: { dx: -1, dy: 0 },\n right: { dx: 1, dy: 0 },\n};\n\n/** Perpendicular clearance (px) from node edge for step / smoothstep paths */\nconst EDGE_OFFSET = 20;\n/** Bezier control-arm length multiplier (fraction of inter-node distance, clamped) */\nconst BEZ_ARM_MIN = 30;\nconst BEZ_ARM_FRAC = 0.3;\n\nexport interface EdgeEndpoints {\n sx: number; sy: number;\n tx: number; ty: number;\n /** Outward unit-normal at source handle */\n snx: number; sny: number;\n /** Outward unit-normal at target handle */\n tnx: number; tny: number;\n}\n\nexport interface PathSegment {\n type: 'M' | 'L' | 'C' | 'Q';\n x: number; y: number;\n cp1x?: number; cp1y?: number;\n cp2x?: number; cp2y?: number;\n}\n\n/**\n * Build a path (array of segments) for the given edge type.\n * Returns segments that can be drawn with PixiJS Graphics.\n */\nexport function buildEdgePath(\n type: FlowEdgeTypeName,\n endpoints: EdgeEndpoints,\n waypoints?: Array<{ x: number; y: number }>,\n bezierControls?: Array<FlowBezierControl | null> | null,\n): PathSegment[] {\n const src = { x: endpoints.sx, y: endpoints.sy };\n const tgt = { x: endpoints.tx, y: endpoints.ty };\n const wps = waypoints ?? [];\n\n switch (type) {\n case 'straight':\n return buildStraightPath([src, ...wps, tgt]);\n\n case 'step':\n case 'smoothstep': {\n const radius = type === 'smoothstep' ? 8 : 0;\n return buildStepPathWithOffsets(src, tgt, wps, endpoints, radius);\n }\n\n case 'simplebezier':\n return buildBezierPath([src, ...wps, tgt], bezierControls, endpoints);\n\n default:\n return buildStraightPath([src, ...wps, tgt]);\n }\n}\n\nfunction buildStraightPath(points: Array<{ x: number; y: number }>): PathSegment[] {\n const segs: PathSegment[] = [{ type: 'M', x: points[0].x, y: points[0].y }];\n for (let i = 1; i < points.length; i++) {\n segs.push({ type: 'L', x: points[i].x, y: points[i].y });\n }\n return segs;\n}\n\n/**\n * Step path with perpendicular exit / entry offsets.\n *\n * Produces clean orthogonal \"elbow\" routing:\n * 1. source → exit stub (perpendicular to the source face)\n * 2. exit → waypoints → approach (orthogonal)\n * 3. approach stub → target (perpendicular into the target face)\n *\n * The middle routing picks the split axis from the two handle orientations so\n * opposing/aligned handles produce a single clean bend instead of an S/Z jog,\n * and collinear points are collapsed at the end.\n */\nfunction buildStepPathWithOffsets(\n src: { x: number; y: number },\n tgt: { x: number; y: number },\n waypoints: Array<{ x: number; y: number }>,\n ep: EdgeEndpoints,\n borderRadius: number,\n): PathSegment[] {\n const dist = Math.hypot(tgt.x - src.x, tgt.y - src.y);\n const offset = Math.min(EDGE_OFFSET, dist / 4);\n\n const exitPt = { x: src.x + ep.snx * offset, y: src.y + ep.sny * offset };\n const approPt = { x: tgt.x + ep.tnx * offset, y: tgt.y + ep.tny * offset };\n\n const srcVertical = Math.abs(ep.sny) > Math.abs(ep.snx);\n const tgtVertical = Math.abs(ep.tny) > Math.abs(ep.tnx);\n\n // Build the raw corner list (no rounding yet), then simplify + round.\n const corners: Array<{ x: number; y: number }> = [{ x: src.x, y: src.y }, exitPt];\n\n const mids = [exitPt, ...waypoints, approPt];\n for (let i = 0; i < mids.length - 1; i++) {\n const a = mids[i];\n const b = mids[i + 1];\n // Orientation of this leg: first leg follows source, last leg follows target.\n const vertical = i === 0 ? srcVertical : (i === mids.length - 2 ? tgtVertical : srcVertical);\n if (vertical) {\n // V-H-V: go vertically to the mid-Y, across, then down/up.\n const midY = (a.y + b.y) / 2;\n corners.push({ x: a.x, y: midY }, { x: b.x, y: midY });\n } else {\n // H-V-H: go horizontally to the mid-X, vertically, then across.\n const midX = (a.x + b.x) / 2;\n corners.push({ x: midX, y: a.y }, { x: midX, y: b.y });\n }\n corners.push({ x: b.x, y: b.y });\n }\n corners.push({ x: tgt.x, y: tgt.y });\n\n const simplified = simplifyOrthogonal(corners);\n return roundedOrthogonalPath(simplified, borderRadius);\n}\n\n/**\n * Remove collinear / duplicate points from an orthogonal polyline so we don't\n * emit degenerate zero-length jogs (a common source of \"unnatural\" bends).\n */\nfunction simplifyOrthogonal(pts: Array<{ x: number; y: number }>): Array<{ x: number; y: number }> {\n const out: Array<{ x: number; y: number }> = [];\n for (const p of pts) {\n const last = out[out.length - 1];\n if (last && Math.abs(last.x - p.x) < 0.01 && Math.abs(last.y - p.y) < 0.01) continue;\n out.push({ x: p.x, y: p.y });\n }\n // Drop the middle of any 3 collinear points.\n const res: Array<{ x: number; y: number }> = [];\n for (let i = 0; i < out.length; i++) {\n const prev = res[res.length - 1];\n const cur = out[i];\n const next = out[i + 1];\n if (prev && next) {\n const collinearX = Math.abs(prev.x - cur.x) < 0.01 && Math.abs(cur.x - next.x) < 0.01;\n const collinearY = Math.abs(prev.y - cur.y) < 0.01 && Math.abs(cur.y - next.y) < 0.01;\n if (collinearX || collinearY) continue;\n }\n res.push(cur);\n }\n return res;\n}\n\n/**\n * Convert an orthogonal polyline into path segments, rounding each corner.\n */\nfunction roundedOrthogonalPath(\n pts: Array<{ x: number; y: number }>,\n borderRadius: number,\n): PathSegment[] {\n if (pts.length === 0) return [];\n const segs: PathSegment[] = [{ type: 'M', x: pts[0].x, y: pts[0].y }];\n if (pts.length === 1) return segs;\n if (borderRadius <= 0.5) {\n for (let i = 1; i < pts.length; i++) segs.push({ type: 'L', x: pts[i].x, y: pts[i].y });\n return segs;\n }\n for (let i = 1; i < pts.length - 1; i++) {\n const prev = pts[i - 1];\n const cur = pts[i];\n const next = pts[i + 1];\n const inLen = Math.hypot(cur.x - prev.x, cur.y - prev.y);\n const outLen = Math.hypot(next.x - cur.x, next.y - cur.y);\n const r = Math.min(borderRadius, inLen / 2, outLen / 2);\n if (r < 0.5) {\n segs.push({ type: 'L', x: cur.x, y: cur.y });\n continue;\n }\n const inDx = Math.sign(cur.x - prev.x);\n const inDy = Math.sign(cur.y - prev.y);\n const outDx = Math.sign(next.x - cur.x);\n const outDy = Math.sign(next.y - cur.y);\n segs.push({ type: 'L', x: cur.x - inDx * r, y: cur.y - inDy * r });\n segs.push({ type: 'Q', x: cur.x + outDx * r, y: cur.y + outDy * r, cp1x: cur.x, cp1y: cur.y });\n }\n const end = pts[pts.length - 1];\n segs.push({ type: 'L', x: end.x, y: end.y });\n return segs;\n}\n\n/**\n * Cubic bezier path between consecutive points.\n * Uses handle normals on the first / last segment for perpendicular exit/entry.\n */\nfunction buildBezierPath(\n points: Array<{ x: number; y: number }>,\n controls?: Array<FlowBezierControl | null> | null,\n ep?: EdgeEndpoints,\n): PathSegment[] {\n const segs: PathSegment[] = [{ type: 'M', x: points[0].x, y: points[0].y }];\n const lastIdx = points.length - 2;\n\n for (let i = 0; i <= lastIdx; i++) {\n const a = points[i];\n const b = points[i + 1];\n const ctrl = controls?.[i];\n\n if (ctrl) {\n segs.push({\n type: 'C', x: b.x, y: b.y,\n cp1x: ctrl.c1x, cp1y: ctrl.c1y,\n cp2x: ctrl.c2x, cp2y: ctrl.c2y,\n });\n } else {\n const dist = Math.hypot(b.x - a.x, b.y - a.y);\n const arm = Math.max(BEZ_ARM_MIN, dist * BEZ_ARM_FRAC);\n\n let c1x: number, c1y: number;\n if (i === 0 && ep) {\n c1x = a.x + ep.snx * arm;\n c1y = a.y + ep.sny * arm;\n } else {\n c1x = a.x + (b.x - a.x) * 0.4;\n c1y = a.y;\n }\n\n let c2x: number, c2y: number;\n if (i === lastIdx && ep) {\n c2x = b.x + ep.tnx * arm;\n c2y = b.y + ep.tny * arm;\n } else {\n c2x = b.x - (b.x - a.x) * 0.4;\n c2y = b.y;\n }\n\n segs.push({\n type: 'C', x: b.x, y: b.y,\n cp1x: c1x, cp1y: c1y,\n cp2x: c2x, cp2y: c2y,\n });\n }\n }\n return segs;\n}\n\n/**\n * Compute the center point of a path (for label placement).\n */\nexport function getPathCenter(segs: PathSegment[]): { x: number; y: number } {\n if (segs.length < 2) return { x: segs[0]?.x ?? 0, y: segs[0]?.y ?? 0 };\n const mid = Math.floor(segs.length / 2);\n const a = segs[mid - 1];\n const b = segs[mid];\n return { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 };\n}\n\n/**\n * Get a point on a path at parameter t (0-1), approximate.\n */\nexport function getPointOnPath(segs: PathSegment[], t: number): { x: number; y: number } {\n if (segs.length < 2) return { x: segs[0]?.x ?? 0, y: segs[0]?.y ?? 0 };\n const totalSegs = segs.length - 1;\n const segIdx = Math.min(Math.floor(t * totalSegs), totalSegs - 1);\n const localT = (t * totalSegs) - segIdx;\n const a = segs[segIdx];\n const b = segs[segIdx + 1];\n return {\n x: a.x + (b.x - a.x) * localT,\n y: a.y + (b.y - a.y) * localT,\n };\n}\n\n/**\n * Resolve source/target anchor positions for an edge.\n * Uses stored handle IDs when available; falls back to closest-handle heuristic.\n */\n/**\n * Transform a handle's local-space position into world space,\n * accounting for the node's rotation (degrees, stored in data.rotation).\n */\nfunction handleToWorld(\n hx: number, hy: number,\n node: FlowNode,\n): { x: number; y: number } {\n const deg = node.data.rotation ?? 0;\n if (deg === 0) {\n return { x: node.position.x + hx, y: node.position.y + hy };\n }\n const rad = (deg * Math.PI) / 180;\n const cx = node.width / 2, cy = node.height / 2;\n const dx = hx - cx, dy = hy - cy;\n const cos = Math.cos(rad), sin = Math.sin(rad);\n return {\n x: node.position.x + cx + dx * cos - dy * sin,\n y: node.position.y + cy + dx * sin + dy * cos,\n };\n}\n\n/**\n * Compute the outward unit-normal for a handle, accounting for node rotation.\n */\nfunction handleNormal(h: HandleDef | null, node: FlowNode): { nx: number; ny: number } {\n const base = SIDE_NORMAL[h?.side ?? 'right'] ?? SIDE_NORMAL.right;\n const deg = node.data.rotation ?? 0;\n if (deg === 0) return { nx: base.dx, ny: base.dy };\n const rad = (deg * Math.PI) / 180;\n const cos = Math.cos(rad), sin = Math.sin(rad);\n return {\n nx: base.dx * cos - base.dy * sin,\n ny: base.dx * sin + base.dy * cos,\n };\n}\n\nexport function resolveEdgeEndpoints(\n edge: FlowEdge,\n nodeMap: Map<string, FlowNode>,\n): EdgeEndpoints | null {\n const sn = nodeMap.get(edge.source);\n const tn = nodeMap.get(edge.target);\n if (!sn || !tn) return null;\n\n const sHandles = getHandlePositions(sn.width, sn.height);\n const tHandles = getHandlePositions(tn.width, tn.height);\n\n let sx: number, sy: number, sH: HandleDef | null;\n if (edge.sourceHandle) {\n sH = sHandles.find(h => h.id === edge.sourceHandle) ?? null;\n const pos = handleToWorld(sH ? sH.x : sn.width / 2, sH ? sH.y : sn.height / 2, sn);\n sx = pos.x; sy = pos.y;\n } else {\n // Floating anchor: pick the side by direction, then slide the point along\n // that side to align with the target so aligned nodes connect with a\n // straight line instead of a forced mid-handle jog.\n const anchor = floatingAnchor(sn, tn);\n sx = anchor.x; sy = anchor.y; sH = anchor.handleLike;\n }\n\n let tx: number, ty: number, tH: HandleDef | null;\n if (edge.targetHandle) {\n tH = tHandles.find(h => h.id === edge.targetHandle) ?? null;\n const pos = handleToWorld(tH ? tH.x : tn.width / 2, tH ? tH.y : tn.height / 2, tn);\n tx = pos.x; ty = pos.y;\n } else {\n const anchor = floatingAnchor(tn, sn);\n tx = anchor.x; ty = anchor.y; tH = anchor.handleLike;\n }\n\n const sN = handleNormal(sH, sn);\n const tN = handleNormal(tH, tn);\n\n return { sx, sy, tx, ty, snx: sN.nx, sny: sN.ny, tnx: tN.nx, tny: tN.ny };\n}\n\n/**\n * Compute a floating connection anchor on `self` facing `other`.\n * Chooses the side by dominant direction, then slides the anchor along that\n * side to line up with the other node's center (clamped to the side extent).\n * Returns the world point plus a synthetic handle carrying only the `side`\n * (used for the outward normal).\n */\nfunction floatingAnchor(\n self: FlowNode,\n other: FlowNode,\n): { x: number; y: number; handleLike: HandleDef } {\n const sx = self.position.x, sy = self.position.y;\n const sw = self.width, sh = self.height;\n const sCx = sx + sw / 2, sCy = sy + sh / 2;\n let oCx = other.position.x + other.width / 2;\n let oCy = other.position.y + other.height / 2;\n\n const deg = self.data.rotation ?? 0;\n if (deg !== 0) {\n // Work in the node's local (unrotated) frame: rotate the other node's\n // center into that frame so side-picking and the slide-to-align run in the\n // same space the anchor is computed in. The anchor is mapped back to world\n // space below via `handleToWorld`, so it rides on the rotated border.\n const rad = (deg * Math.PI) / 180;\n const cos = Math.cos(-rad), sin = Math.sin(-rad);\n const dx = oCx - sCx;\n const dy = oCy - sCy;\n oCx = sCx + dx * cos - dy * sin;\n oCy = sCy + dx * sin + dy * cos;\n }\n\n const dx = oCx - sCx;\n const dy = oCy - sCy;\n // Inset so the anchor never sits exactly on a corner.\n const inset = Math.min(12, sw / 2 - 1, sh / 2 - 1);\n\n let side: HandleDef['side'];\n let x: number, y: number;\n if (Math.abs(dx) >= Math.abs(dy)) {\n side = dx >= 0 ? 'right' : 'left';\n x = side === 'right' ? sx + sw : sx;\n // Slide vertically to align with the other center, clamped to the side.\n y = Math.max(sy + inset, Math.min(sy + sh - inset, oCy));\n } else {\n side = dy >= 0 ? 'bottom' : 'top';\n y = side === 'bottom' ? sy + sh : sy;\n x = Math.max(sx + inset, Math.min(sx + sw - inset, oCx));\n }\n\n if (deg !== 0) {\n // Map the (locally chosen) anchor back onto the rotated border.\n const pos = handleToWorld(x - sx, y - sy, self);\n return { x: pos.x, y: pos.y, handleLike: { id: `float_${side}`, x: 0, y: 0, side } };\n }\n\n return { x, y, handleLike: { id: `float_${side}`, x: 0, y: 0, side } };\n}\n\n/**\n * Previously this pinned auto-resolved edges to a fixed middle handle at load\n * time, which forced ugly jogs between misaligned nodes. Edges without an\n * explicit handle are now left \"floating\" and resolved dynamically in\n * `resolveEdgeEndpoints` (see `floatingAnchor`), so this is a no-op that simply\n * preserves any user-pinned handles.\n */\nexport function normalizeEdgeHandles(\n edges: FlowEdge[],\n _nodeMap: Map<string, FlowNode>,\n): FlowEdge[] {\n const legacyOffsets = new Map([\n ['0.25', String(2 / 6)],\n ['0.5', String(3 / 6)],\n ['0.75', String(4 / 6)],\n ]);\n let changed = false;\n const migrate = (handle: string | undefined) => {\n if (!handle) return handle;\n const [side, offset] = handle.split('_');\n const nextOffset = legacyOffsets.get(offset);\n if (!nextOffset || !side) return handle;\n changed = true;\n return `${side}_${nextOffset}`;\n };\n const normalized = edges.map(edge => {\n const sourceHandle = migrate(edge.sourceHandle);\n const targetHandle = migrate(edge.targetHandle);\n return sourceHandle === edge.sourceHandle && targetHandle === edge.targetHandle\n ? edge\n : { ...edge, sourceHandle, targetHandle };\n });\n return changed ? normalized : edges;\n}\n\n/**\n * Convert PathSegments into a polyline by sampling curves.\n */\nexport function linearizeSegments(\n segs: PathSegment[],\n samplesPerCurve = 8,\n): Array<{ x: number; y: number }> {\n const pts: Array<{ x: number; y: number }> = [];\n let cx = 0, cy = 0;\n for (const seg of segs) {\n switch (seg.type) {\n case 'M':\n case 'L':\n cx = seg.x; cy = seg.y;\n pts.push({ x: cx, y: cy });\n break;\n case 'Q': {\n const cpx = seg.cp1x!, cpy = seg.cp1y!;\n for (let i = 1; i <= samplesPerCurve; i++) {\n const t = i / samplesPerCurve, mt = 1 - t;\n pts.push({\n x: mt * mt * cx + 2 * mt * t * cpx + t * t * seg.x,\n y: mt * mt * cy + 2 * mt * t * cpy + t * t * seg.y,\n });\n }\n cx = seg.x; cy = seg.y;\n break;\n }\n case 'C': {\n const c1x = seg.cp1x!, c1y = seg.cp1y!, c2x = seg.cp2x!, c2y = seg.cp2y!;\n for (let i = 1; i <= samplesPerCurve; i++) {\n const t = i / samplesPerCurve, mt = 1 - t;\n pts.push({\n x: mt ** 3 * cx + 3 * mt ** 2 * t * c1x + 3 * mt * t ** 2 * c2x + t ** 3 * seg.x,\n y: mt ** 3 * cy + 3 * mt ** 2 * t * c1y + 3 * mt * t ** 2 * c2y + t ** 3 * seg.y,\n });\n }\n cx = seg.x; cy = seg.y;\n break;\n }\n }\n }\n return pts;\n}\n"],"mappings":";AAIA,IAAM,IAA0D;AAAA,EAC9D,KAAQ;AAAA,IAAE,IAAK;AAAA,IAAG,IAAI;AAAA,EAAG;AAAA,EACzB,QAAQ;AAAA,IAAE,IAAK;AAAA,IA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G,KAAM,IAAI,IAAK,IAAI,KAAM,IAAI,IAAI,IAAM,IAAI,IAAK,KAAK,IAAI,IAAM,KAAK,IAAI,EAAI;AAAA,QACjF,CAAC;AAAA,MACH;AACA,MAAA,IAAK,EAAI,GAAG,IAAK,EAAI;AACrB;AAAA,IACF;AAAA,EACF;AAEF,SAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"edgePaths.js","names":[],"sources":["../../../../../src/components/pro/Flow/edges/edgePaths.ts"],"sourcesContent":["import type { FlowEdgeTypeName, FlowBezierControl, FlowEdge, FlowNode } from '../types';\nimport { getHandlePositions, type HandleDef } from '../nodes/NodeHandles';\n\n/** Outward unit normal for a handle side */\nconst SIDE_NORMAL: Record<string, { dx: number; dy: number }> = {\n top: { dx: 0, dy: -1 },\n bottom: { dx: 0, dy: 1 },\n left: { dx: -1, dy: 0 },\n right: { dx: 1, dy: 0 },\n};\n\n/** Perpendicular clearance (px) from node edge for step / smoothstep paths */\nconst EDGE_OFFSET = 20;\n/** Bezier control-arm length multiplier (fraction of inter-node distance, clamped) */\nconst BEZ_ARM_MIN = 30;\nconst BEZ_ARM_FRAC = 0.3;\n\nexport interface EdgeEndpoints {\n sx: number; sy: number;\n tx: number; ty: number;\n /** Outward unit-normal at source handle */\n snx: number; sny: number;\n /** Outward unit-normal at target handle */\n tnx: number; tny: number;\n}\n\nexport interface PathSegment {\n type: 'M' | 'L' | 'C' | 'Q';\n x: number; y: number;\n cp1x?: number; cp1y?: number;\n cp2x?: number; cp2y?: number;\n}\n\n/**\n * Build a path (array of segments) for the given edge type.\n * Returns segments that can be drawn with PixiJS Graphics.\n */\nexport function buildEdgePath(\n type: FlowEdgeTypeName,\n endpoints: EdgeEndpoints,\n waypoints?: Array<{ x: number; y: number }>,\n bezierControls?: Array<FlowBezierControl | null> | null,\n): PathSegment[] {\n const src = { x: endpoints.sx, y: endpoints.sy };\n const tgt = { x: endpoints.tx, y: endpoints.ty };\n const wps = waypoints ?? [];\n\n switch (type) {\n case 'straight':\n return buildStraightPath([src, ...wps, tgt]);\n\n case 'step':\n case 'smoothstep': {\n const radius = type === 'smoothstep' ? 8 : 0;\n return buildStepPathWithOffsets(src, tgt, wps, endpoints, radius);\n }\n\n case 'simplebezier':\n return buildBezierPath([src, ...wps, tgt], bezierControls, endpoints);\n\n default:\n return buildStraightPath([src, ...wps, tgt]);\n }\n}\n\nfunction buildStraightPath(points: Array<{ x: number; y: number }>): PathSegment[] {\n const segs: PathSegment[] = [{ type: 'M', x: points[0].x, y: points[0].y }];\n for (let i = 1; i < points.length; i++) {\n segs.push({ type: 'L', x: points[i].x, y: points[i].y });\n }\n return segs;\n}\n\n/**\n * Step path with perpendicular exit / entry offsets.\n *\n * Produces clean orthogonal \"elbow\" routing:\n * 1. source → exit stub (perpendicular to the source face)\n * 2. exit → waypoints → approach (orthogonal)\n * 3. approach stub → target (perpendicular into the target face)\n *\n * The middle routing picks the split axis from the two handle orientations so\n * opposing/aligned handles produce a single clean bend instead of an S/Z jog,\n * and collinear points are collapsed at the end.\n */\nfunction buildStepPathWithOffsets(\n src: { x: number; y: number },\n tgt: { x: number; y: number },\n waypoints: Array<{ x: number; y: number }>,\n ep: EdgeEndpoints,\n borderRadius: number,\n): PathSegment[] {\n const dist = Math.hypot(tgt.x - src.x, tgt.y - src.y);\n const offset = Math.min(EDGE_OFFSET, dist / 4);\n\n const exitPt = { x: src.x + ep.snx * offset, y: src.y + ep.sny * offset };\n const approPt = { x: tgt.x + ep.tnx * offset, y: tgt.y + ep.tny * offset };\n\n const srcVertical = Math.abs(ep.sny) > Math.abs(ep.snx);\n const tgtVertical = Math.abs(ep.tny) > Math.abs(ep.tnx);\n\n // Build the raw corner list (no rounding yet), then simplify + round.\n const corners: Array<{ x: number; y: number }> = [{ x: src.x, y: src.y }, exitPt];\n\n const mids = [exitPt, ...waypoints, approPt];\n for (let i = 0; i < mids.length - 1; i++) {\n const a = mids[i];\n const b = mids[i + 1];\n // Orientation of this leg: first leg follows source, last leg follows target.\n const vertical = i === 0 ? srcVertical : (i === mids.length - 2 ? tgtVertical : srcVertical);\n if (vertical) {\n // V-H-V: go vertically to the mid-Y, across, then down/up.\n const midY = (a.y + b.y) / 2;\n corners.push({ x: a.x, y: midY }, { x: b.x, y: midY });\n } else {\n // H-V-H: go horizontally to the mid-X, vertically, then across.\n const midX = (a.x + b.x) / 2;\n corners.push({ x: midX, y: a.y }, { x: midX, y: b.y });\n }\n corners.push({ x: b.x, y: b.y });\n }\n corners.push({ x: tgt.x, y: tgt.y });\n\n const simplified = simplifyOrthogonal(corners);\n return roundedOrthogonalPath(simplified, borderRadius);\n}\n\n/**\n * Remove collinear / duplicate points from an orthogonal polyline so we don't\n * emit degenerate zero-length jogs (a common source of \"unnatural\" bends).\n */\nfunction simplifyOrthogonal(pts: Array<{ x: number; y: number }>): Array<{ x: number; y: number }> {\n const out: Array<{ x: number; y: number }> = [];\n for (const p of pts) {\n const last = out[out.length - 1];\n if (last && Math.abs(last.x - p.x) < 0.01 && Math.abs(last.y - p.y) < 0.01) continue;\n out.push({ x: p.x, y: p.y });\n }\n // Drop the middle of any 3 collinear points.\n const res: Array<{ x: number; y: number }> = [];\n for (let i = 0; i < out.length; i++) {\n const prev = res[res.length - 1];\n const cur = out[i];\n const next = out[i + 1];\n if (prev && next) {\n const collinearX = Math.abs(prev.x - cur.x) < 0.01 && Math.abs(cur.x - next.x) < 0.01;\n const collinearY = Math.abs(prev.y - cur.y) < 0.01 && Math.abs(cur.y - next.y) < 0.01;\n if (collinearX || collinearY) continue;\n }\n res.push(cur);\n }\n return res;\n}\n\n/**\n * Convert an orthogonal polyline into path segments, rounding each corner.\n */\nfunction roundedOrthogonalPath(\n pts: Array<{ x: number; y: number }>,\n borderRadius: number,\n): PathSegment[] {\n if (pts.length === 0) return [];\n const segs: PathSegment[] = [{ type: 'M', x: pts[0].x, y: pts[0].y }];\n if (pts.length === 1) return segs;\n if (borderRadius <= 0.5) {\n for (let i = 1; i < pts.length; i++) segs.push({ type: 'L', x: pts[i].x, y: pts[i].y });\n return segs;\n }\n for (let i = 1; i < pts.length - 1; i++) {\n const prev = pts[i - 1];\n const cur = pts[i];\n const next = pts[i + 1];\n const inLen = Math.hypot(cur.x - prev.x, cur.y - prev.y);\n const outLen = Math.hypot(next.x - cur.x, next.y - cur.y);\n const r = Math.min(borderRadius, inLen / 2, outLen / 2);\n if (r < 0.5) {\n segs.push({ type: 'L', x: cur.x, y: cur.y });\n continue;\n }\n const inDx = Math.sign(cur.x - prev.x);\n const inDy = Math.sign(cur.y - prev.y);\n const outDx = Math.sign(next.x - cur.x);\n const outDy = Math.sign(next.y - cur.y);\n segs.push({ type: 'L', x: cur.x - inDx * r, y: cur.y - inDy * r });\n segs.push({ type: 'Q', x: cur.x + outDx * r, y: cur.y + outDy * r, cp1x: cur.x, cp1y: cur.y });\n }\n const end = pts[pts.length - 1];\n segs.push({ type: 'L', x: end.x, y: end.y });\n return segs;\n}\n\n/**\n * Cubic bezier path between consecutive points.\n * Uses handle normals on the first / last segment for perpendicular exit/entry.\n */\nfunction buildBezierPath(\n points: Array<{ x: number; y: number }>,\n controls?: Array<FlowBezierControl | null> | null,\n ep?: EdgeEndpoints,\n): PathSegment[] {\n const segs: PathSegment[] = [{ type: 'M', x: points[0].x, y: points[0].y }];\n const lastIdx = points.length - 2;\n\n for (let i = 0; i <= lastIdx; i++) {\n const a = points[i];\n const b = points[i + 1];\n const ctrl = controls?.[i];\n\n if (ctrl) {\n segs.push({\n type: 'C', x: b.x, y: b.y,\n cp1x: ctrl.c1x, cp1y: ctrl.c1y,\n cp2x: ctrl.c2x, cp2y: ctrl.c2y,\n });\n } else {\n const dist = Math.hypot(b.x - a.x, b.y - a.y);\n const arm = Math.max(BEZ_ARM_MIN, dist * BEZ_ARM_FRAC);\n\n let c1x: number, c1y: number;\n if (i === 0 && ep) {\n c1x = a.x + ep.snx * arm;\n c1y = a.y + ep.sny * arm;\n } else {\n c1x = a.x + (b.x - a.x) * 0.4;\n c1y = a.y;\n }\n\n let c2x: number, c2y: number;\n if (i === lastIdx && ep) {\n c2x = b.x + ep.tnx * arm;\n c2y = b.y + ep.tny * arm;\n } else {\n c2x = b.x - (b.x - a.x) * 0.4;\n c2y = b.y;\n }\n\n segs.push({\n type: 'C', x: b.x, y: b.y,\n cp1x: c1x, cp1y: c1y,\n cp2x: c2x, cp2y: c2y,\n });\n }\n }\n return segs;\n}\n\n/**\n * Compute the center point of a path (for label placement).\n */\nexport function getPathCenter(segs: PathSegment[]): { x: number; y: number } {\n if (segs.length < 2) return { x: segs[0]?.x ?? 0, y: segs[0]?.y ?? 0 };\n const mid = Math.floor(segs.length / 2);\n const a = segs[mid - 1];\n const b = segs[mid];\n return { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 };\n}\n\n/**\n * Get a point on a path at parameter t (0-1), approximate.\n */\nexport function getPointOnPath(segs: PathSegment[], t: number): { x: number; y: number } {\n if (segs.length < 2) return { x: segs[0]?.x ?? 0, y: segs[0]?.y ?? 0 };\n const totalSegs = segs.length - 1;\n const segIdx = Math.min(Math.floor(t * totalSegs), totalSegs - 1);\n const localT = (t * totalSegs) - segIdx;\n const a = segs[segIdx];\n const b = segs[segIdx + 1];\n return {\n x: a.x + (b.x - a.x) * localT,\n y: a.y + (b.y - a.y) * localT,\n };\n}\n\n/**\n * Resolve source/target anchor positions for an edge.\n * Uses stored handle IDs when available; falls back to closest-handle heuristic.\n */\n/**\n * Transform a handle's local-space position into world space,\n * accounting for the node's rotation (degrees, stored in data.rotation).\n */\nfunction handleToWorld(\n hx: number, hy: number,\n node: FlowNode,\n): { x: number; y: number } {\n const deg = node.data.rotation ?? 0;\n if (deg === 0) {\n return { x: node.position.x + hx, y: node.position.y + hy };\n }\n const rad = (deg * Math.PI) / 180;\n const cx = node.width / 2, cy = node.height / 2;\n const dx = hx - cx, dy = hy - cy;\n const cos = Math.cos(rad), sin = Math.sin(rad);\n return {\n x: node.position.x + cx + dx * cos - dy * sin,\n y: node.position.y + cy + dx * sin + dy * cos,\n };\n}\n\n/**\n * Compute the outward unit-normal for a handle, accounting for node rotation.\n */\nfunction handleNormal(h: HandleDef | null, node: FlowNode): { nx: number; ny: number } {\n const base = SIDE_NORMAL[h?.side ?? 'right'] ?? SIDE_NORMAL.right;\n const deg = node.data.rotation ?? 0;\n if (deg === 0) return { nx: base.dx, ny: base.dy };\n const rad = (deg * Math.PI) / 180;\n const cos = Math.cos(rad), sin = Math.sin(rad);\n return {\n nx: base.dx * cos - base.dy * sin,\n ny: base.dx * sin + base.dy * cos,\n };\n}\n\nexport function resolveEdgeEndpoints(\n edge: FlowEdge,\n nodeMap: Map<string, FlowNode>,\n): EdgeEndpoints | null {\n const sn = nodeMap.get(edge.source);\n const tn = nodeMap.get(edge.target);\n if (!sn || !tn) return null;\n\n const sHandles = getHandlePositions(sn.width, sn.height);\n const tHandles = getHandlePositions(tn.width, tn.height);\n\n let sx: number, sy: number, sH: HandleDef | null;\n if (edge.sourceHandle) {\n sH = sHandles.find(h => h.id === edge.sourceHandle) ?? null;\n const pos = handleToWorld(sH ? sH.x : sn.width / 2, sH ? sH.y : sn.height / 2, sn);\n sx = pos.x; sy = pos.y;\n } else {\n // Floating anchor: pick the side by direction, then slide the point along\n // that side to align with the target so aligned nodes connect with a\n // straight line instead of a forced mid-handle jog.\n const anchor = floatingAnchor(sn, tn);\n sx = anchor.x; sy = anchor.y; sH = anchor.handleLike;\n }\n\n let tx: number, ty: number, tH: HandleDef | null;\n if (edge.targetHandle) {\n tH = tHandles.find(h => h.id === edge.targetHandle) ?? null;\n const pos = handleToWorld(tH ? tH.x : tn.width / 2, tH ? tH.y : tn.height / 2, tn);\n tx = pos.x; ty = pos.y;\n } else {\n const anchor = floatingAnchor(tn, sn);\n tx = anchor.x; ty = anchor.y; tH = anchor.handleLike;\n }\n\n const sN = handleNormal(sH, sn);\n const tN = handleNormal(tH, tn);\n\n return { sx, sy, tx, ty, snx: sN.nx, sny: sN.ny, tnx: tN.nx, tny: tN.ny };\n}\n\n/**\n * Compute a floating connection anchor on `self` facing `other`.\n * Chooses the side by dominant direction, then slides the anchor along that\n * side to line up with the other node's center (clamped to the side extent).\n * Returns the world point plus a synthetic handle carrying only the `side`\n * (used for the outward normal).\n */\nfunction floatingAnchor(\n self: FlowNode,\n other: FlowNode,\n): { x: number; y: number; handleLike: HandleDef } {\n const sx = self.position.x, sy = self.position.y;\n const sw = self.width, sh = self.height;\n const sCx = sx + sw / 2, sCy = sy + sh / 2;\n let oCx = other.position.x + other.width / 2;\n let oCy = other.position.y + other.height / 2;\n\n const deg = self.data.rotation ?? 0;\n if (deg !== 0) {\n // Work in the node's local (unrotated) frame: rotate the other node's\n // center into that frame so side-picking and the slide-to-align run in the\n // same space the anchor is computed in. The anchor is mapped back to world\n // space below via `handleToWorld`, so it rides on the rotated border.\n const rad = (deg * Math.PI) / 180;\n const cos = Math.cos(-rad), sin = Math.sin(-rad);\n const dx = oCx - sCx;\n const dy = oCy - sCy;\n oCx = sCx + dx * cos - dy * sin;\n oCy = sCy + dx * sin + dy * cos;\n }\n\n const dx = oCx - sCx;\n const dy = oCy - sCy;\n // Inset so the anchor never sits exactly on a corner.\n const inset = Math.min(12, sw / 2 - 1, sh / 2 - 1);\n\n let side: HandleDef['side'];\n let x: number, y: number;\n if (Math.abs(dx) >= Math.abs(dy)) {\n side = dx >= 0 ? 'right' : 'left';\n x = side === 'right' ? sx + sw : sx;\n // Slide vertically to align with the other center, clamped to the side.\n y = Math.max(sy + inset, Math.min(sy + sh - inset, oCy));\n } else {\n side = dy >= 0 ? 'bottom' : 'top';\n y = side === 'bottom' ? sy + sh : sy;\n x = Math.max(sx + inset, Math.min(sx + sw - inset, oCx));\n }\n\n if (deg !== 0) {\n // Map the (locally chosen) anchor back onto the rotated border.\n const pos = handleToWorld(x - sx, y - sy, self);\n return { x: pos.x, y: pos.y, handleLike: { id: `float_${side}`, x: 0, y: 0, side } };\n }\n\n return { x, y, handleLike: { id: `float_${side}`, x: 0, y: 0, side } };\n}\n\n/**\n * Previously this pinned auto-resolved edges to a fixed middle handle at load\n * time, which forced ugly jogs between misaligned nodes. Edges without an\n * explicit handle are now left \"floating\" and resolved dynamically in\n * `resolveEdgeEndpoints` (see `floatingAnchor`), so this is a no-op that simply\n * preserves any user-pinned handles.\n */\nexport function normalizeEdgeHandles(\n edges: FlowEdge[],\n _nodeMap: Map<string, FlowNode>,\n): FlowEdge[] {\n const legacyOffsets = new Map([\n ['0.25', String(2 / 6)],\n ['0.5', String(3 / 6)],\n ['0.75', String(4 / 6)],\n ]);\n let changed = false;\n const migrate = (handle: string | undefined) => {\n if (!handle) return handle;\n const [side, offset] = handle.split('_');\n const nextOffset = legacyOffsets.get(offset);\n if (!nextOffset || !side) return handle;\n changed = true;\n return `${side}_${nextOffset}`;\n };\n const normalized = edges.map(edge => {\n const sourceHandle = migrate(edge.sourceHandle);\n const targetHandle = migrate(edge.targetHandle);\n return sourceHandle === edge.sourceHandle && targetHandle === edge.targetHandle\n ? edge\n : { ...edge, sourceHandle, targetHandle };\n });\n return changed ? normalized : edges;\n}\n\n/**\n * Convert PathSegments into a polyline by sampling curves.\n */\nexport function linearizeSegments(\n segs: PathSegment[],\n samplesPerCurve = 8,\n): Array<{ x: number; y: number }> {\n const pts: Array<{ x: number; y: number }> = [];\n let cx = 0, cy = 0;\n for (const seg of segs) {\n switch (seg.type) {\n case 'M':\n case 'L':\n cx = seg.x; cy = seg.y;\n pts.push({ x: cx, y: cy });\n break;\n case 'Q': {\n const cpx = seg.cp1x!, cpy = seg.cp1y!;\n for (let i = 1; i <= samplesPerCurve; i++) {\n const t = i / samplesPerCurve, mt = 1 - t;\n pts.push({\n x: mt * mt * cx + 2 * mt * t * cpx + t * t * seg.x,\n y: mt * mt * cy + 2 * mt * t * cpy + t * t * seg.y,\n });\n }\n cx = seg.x; cy = seg.y;\n break;\n }\n case 'C': {\n const c1x = seg.cp1x!, c1y = seg.cp1y!, c2x = seg.cp2x!, c2y = seg.cp2y!;\n for (let i = 1; i <= samplesPerCurve; i++) {\n const t = i / samplesPerCurve, mt = 1 - t;\n pts.push({\n x: mt ** 3 * cx + 3 * mt ** 2 * t * c1x + 3 * mt * t ** 2 * c2x + t ** 3 * seg.x,\n y: mt ** 3 * cy + 3 * mt ** 2 * t * c1y + 3 * mt * t ** 2 * c2y + t ** 3 * seg.y,\n });\n }\n cx = seg.x; cy = seg.y;\n break;\n }\n }\n }\n return pts;\n}\n"],"mappings":";;AAIA,IAAM,IAA0D;CAC9D,KAAQ;EAAE,IAAK;EAAG,IAAI;CAAG;CACzB,QAAQ;EAAE,IAAK;EAAG,IAAK;CAAE;CACzB,MAAQ;EAAE,IAAI;EAAI,IAAK;CAAE;CACzB,OAAQ;EAAE,IAAK;EAAG,IAAK;CAAE;AAC3B,GAGM,IAAc,IAEd,IAAc,IACd,IAAe;AAsBrB,SAAgB,EACd,GACA,GACA,GACA,GACe;CACf,IAAM,IAAM;EAAE,GAAG,EAAU;EAAI,GAAG,EAAU;CAAG,GACzC,IAAM;EAAE,GAAG,EAAU;EAAI,GAAG,EAAU;CAAG,GACzC,IAAM,KAAa,CAAC;CAE1B,QAAQ,GAAR;EACE,KAAK,YACH,OAAO,EAAkB;GAAC;GAAK,GAAG;GAAK;EAAG,CAAC;EAE7C,KAAK;EACL,KAAK,cAEH,OAAO,EAAyB,GAAK,GAAK,GAAK,GADhC,MAAS,eAAe,IAAI,CACqB;EAGlE,KAAK,gBACH,OAAO,EAAgB;GAAC;GAAK,GAAG;GAAK;EAAG,GAAG,GAAgB,CAAS;EAEtE,SACE,OAAO,EAAkB;GAAC;GAAK,GAAG;GAAK;EAAG,CAAC;CAC/C;AACF;AAEA,SAAS,EAAkB,GAAwD;CACjF,IAAM,IAAsB,CAAC;EAAE,MAAM;EAAK,GAAG,EAAO,EAAE,CAAC;EAAG,GAAG,EAAO,EAAE,CAAC;CAAE,CAAC;CAC1E,KAAK,IAAI,IAAI,GAAG,IAAI,EAAO,QAAQ,KACjC,EAAK,KAAK;EAAE,MAAM;EAAK,GAAG,EAAO,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AAK,IAAI,EAAI;KAC/E,GAAG,KAAM,IAAI,IAAK,IAAI,KAAM,IAAI,IAAI,IAAM,IAAI,IAAK,KAAK,IAAI,IAAM,KAAK,IAAI,EAAI;IACjF,CAAC;GACH;GACY,AAAZ,IAAK,EAAI,GAAG,IAAK,EAAI;GACrB;EACF;CACF;CAEF,OAAO;AACT"}
|
|
@@ -1,55 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
guides: l
|
|
49
|
-
};
|
|
1
|
+
//#region src/components/pro/Flow/hooks/useAlignmentGuides.ts
|
|
2
|
+
function e(e, t, n = 5) {
|
|
3
|
+
if (e.length === 0) return {
|
|
4
|
+
dx: 0,
|
|
5
|
+
dy: 0,
|
|
6
|
+
guides: []
|
|
7
|
+
};
|
|
8
|
+
let r = new Set(e.map((e) => e.id)), i = t.filter((e) => !r.has(e.id));
|
|
9
|
+
if (i.length === 0) return {
|
|
10
|
+
dx: 0,
|
|
11
|
+
dy: 0,
|
|
12
|
+
guides: []
|
|
13
|
+
};
|
|
14
|
+
let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity;
|
|
15
|
+
for (let t of e) a = Math.min(a, t.position.x), o = Math.max(o, t.position.x + t.width), s = Math.min(s, t.position.y), c = Math.max(c, t.position.y + t.height);
|
|
16
|
+
let l = (a + o) / 2, u = (s + c) / 2, d = [], f = [];
|
|
17
|
+
for (let e of i) d.push(e.position.x, e.position.x + e.width / 2, e.position.x + e.width), f.push(e.position.y, e.position.y + e.height / 2, e.position.y + e.height);
|
|
18
|
+
let p = [
|
|
19
|
+
a,
|
|
20
|
+
l,
|
|
21
|
+
o
|
|
22
|
+
], m = [
|
|
23
|
+
s,
|
|
24
|
+
u,
|
|
25
|
+
c
|
|
26
|
+
], h = 0, g = n + 1, _ = null;
|
|
27
|
+
for (let e of p) for (let t of d) {
|
|
28
|
+
let n = Math.abs(e - t);
|
|
29
|
+
n < g && (g = n, h = t - e, _ = t);
|
|
30
|
+
}
|
|
31
|
+
let v = 0, y = n + 1, b = null;
|
|
32
|
+
for (let e of m) for (let t of f) {
|
|
33
|
+
let n = Math.abs(e - t);
|
|
34
|
+
n < y && (y = n, v = t - e, b = t);
|
|
35
|
+
}
|
|
36
|
+
let x = [], S = g <= n ? h : 0, C = y <= n ? v : 0;
|
|
37
|
+
return g <= n && _ !== null && x.push({
|
|
38
|
+
type: "vertical",
|
|
39
|
+
position: _
|
|
40
|
+
}), y <= n && b !== null && x.push({
|
|
41
|
+
type: "horizontal",
|
|
42
|
+
position: b
|
|
43
|
+
}), {
|
|
44
|
+
dx: S,
|
|
45
|
+
dy: C,
|
|
46
|
+
guides: x
|
|
47
|
+
};
|
|
50
48
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
49
|
+
//#endregion
|
|
50
|
+
export { e as computeAlignmentSnap };
|
|
54
51
|
|
|
55
52
|
//# sourceMappingURL=useAlignmentGuides.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAlignmentGuides.js","names":[],"sources":["../../../../../src/components/pro/Flow/hooks/useAlignmentGuides.ts"],"sourcesContent":["import { useMemo, useRef } from 'react';\nimport type { FlowNode } from '../types';\nimport { SNAP_THRESHOLD } from '../constants';\n\nexport interface AlignGuide {\n type: 'vertical' | 'horizontal';\n position: number;\n}\n\n/**\n * Computes alignment snap guides during node drag.\n * Returns snap offsets and guide lines to render.\n */\nexport function computeAlignmentSnap(\n draggingNodes: FlowNode[],\n allNodes: FlowNode[],\n threshold = SNAP_THRESHOLD,\n): { dx: number; dy: number; guides: AlignGuide[] } {\n if (draggingNodes.length === 0) return { dx: 0, dy: 0, guides: [] };\n\n const dragIds = new Set(draggingNodes.map(n => n.id));\n const staticNodes = allNodes.filter(n => !dragIds.has(n.id));\n\n if (staticNodes.length === 0) return { dx: 0, dy: 0, guides: [] };\n\n // Compute drag bounds\n let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;\n for (const n of draggingNodes) {\n minX = Math.min(minX, n.position.x);\n maxX = Math.max(maxX, n.position.x + n.width);\n minY = Math.min(minY, n.position.y);\n maxY = Math.max(maxY, n.position.y + n.height);\n }\n const dragCx = (minX + maxX) / 2;\n const dragCy = (minY + maxY) / 2;\n\n // Collect snap lines from static nodes\n const xSnaps: number[] = [];\n const ySnaps: number[] = [];\n for (const n of staticNodes) {\n xSnaps.push(n.position.x, n.position.x + n.width / 2, n.position.x + n.width);\n ySnaps.push(n.position.y, n.position.y + n.height / 2, n.position.y + n.height);\n }\n\n // Dragging node snap points\n const dragXPoints = [minX, dragCx, maxX];\n const dragYPoints = [minY, dragCy, maxY];\n\n let bestDx = 0;\n let bestDistX = threshold + 1;\n let snapXLine: number | null = null;\n\n for (const dx of dragXPoints) {\n for (const sx of xSnaps) {\n const dist = Math.abs(dx - sx);\n if (dist < bestDistX) {\n bestDistX = dist;\n bestDx = sx - dx;\n snapXLine = sx;\n }\n }\n }\n\n let bestDy = 0;\n let bestDistY = threshold + 1;\n let snapYLine: number | null = null;\n\n for (const dy of dragYPoints) {\n for (const sy of ySnaps) {\n const dist = Math.abs(dy - sy);\n if (dist < bestDistY) {\n bestDistY = dist;\n bestDy = sy - dy;\n snapYLine = sy;\n }\n }\n }\n\n const guides: AlignGuide[] = [];\n const dx = bestDistX <= threshold ? bestDx : 0;\n const dy = bestDistY <= threshold ? bestDy : 0;\n if (bestDistX <= threshold && snapXLine !== null) guides.push({ type: 'vertical', position: snapXLine });\n if (bestDistY <= threshold && snapYLine !== null) guides.push({ type: 'horizontal', position: snapYLine });\n\n return { dx, dy, guides };\n}\n"],"mappings":"AAaA,SAAgB,EACd,GACA,GACA,IAAA,GACkD;
|
|
1
|
+
{"version":3,"file":"useAlignmentGuides.js","names":[],"sources":["../../../../../src/components/pro/Flow/hooks/useAlignmentGuides.ts"],"sourcesContent":["import { useMemo, useRef } from 'react';\nimport type { FlowNode } from '../types';\nimport { SNAP_THRESHOLD } from '../constants';\n\nexport interface AlignGuide {\n type: 'vertical' | 'horizontal';\n position: number;\n}\n\n/**\n * Computes alignment snap guides during node drag.\n * Returns snap offsets and guide lines to render.\n */\nexport function computeAlignmentSnap(\n draggingNodes: FlowNode[],\n allNodes: FlowNode[],\n threshold = SNAP_THRESHOLD,\n): { dx: number; dy: number; guides: AlignGuide[] } {\n if (draggingNodes.length === 0) return { dx: 0, dy: 0, guides: [] };\n\n const dragIds = new Set(draggingNodes.map(n => n.id));\n const staticNodes = allNodes.filter(n => !dragIds.has(n.id));\n\n if (staticNodes.length === 0) return { dx: 0, dy: 0, guides: [] };\n\n // Compute drag bounds\n let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;\n for (const n of draggingNodes) {\n minX = Math.min(minX, n.position.x);\n maxX = Math.max(maxX, n.position.x + n.width);\n minY = Math.min(minY, n.position.y);\n maxY = Math.max(maxY, n.position.y + n.height);\n }\n const dragCx = (minX + maxX) / 2;\n const dragCy = (minY + maxY) / 2;\n\n // Collect snap lines from static nodes\n const xSnaps: number[] = [];\n const ySnaps: number[] = [];\n for (const n of staticNodes) {\n xSnaps.push(n.position.x, n.position.x + n.width / 2, n.position.x + n.width);\n ySnaps.push(n.position.y, n.position.y + n.height / 2, n.position.y + n.height);\n }\n\n // Dragging node snap points\n const dragXPoints = [minX, dragCx, maxX];\n const dragYPoints = [minY, dragCy, maxY];\n\n let bestDx = 0;\n let bestDistX = threshold + 1;\n let snapXLine: number | null = null;\n\n for (const dx of dragXPoints) {\n for (const sx of xSnaps) {\n const dist = Math.abs(dx - sx);\n if (dist < bestDistX) {\n bestDistX = dist;\n bestDx = sx - dx;\n snapXLine = sx;\n }\n }\n }\n\n let bestDy = 0;\n let bestDistY = threshold + 1;\n let snapYLine: number | null = null;\n\n for (const dy of dragYPoints) {\n for (const sy of ySnaps) {\n const dist = Math.abs(dy - sy);\n if (dist < bestDistY) {\n bestDistY = dist;\n bestDy = sy - dy;\n snapYLine = sy;\n }\n }\n }\n\n const guides: AlignGuide[] = [];\n const dx = bestDistX <= threshold ? bestDx : 0;\n const dy = bestDistY <= threshold ? bestDy : 0;\n if (bestDistX <= threshold && snapXLine !== null) guides.push({ type: 'vertical', position: snapXLine });\n if (bestDistY <= threshold && snapYLine !== null) guides.push({ type: 'horizontal', position: snapYLine });\n\n return { dx, dy, guides };\n}\n"],"mappings":";AAaA,SAAgB,EACd,GACA,GACA,IAAA,GACkD;CAClD,IAAI,EAAc,WAAW,GAAG,OAAO;EAAE,IAAI;EAAG,IAAI;EAAG,QAAQ,CAAC;CAAE;CAElE,IAAM,IAAU,IAAI,IAAI,EAAc,KAAI,MAAK,EAAE,EAAE,CAAC,GAC9C,IAAc,EAAS,QAAO,MAAK,CAAC,EAAQ,IAAI,EAAE,EAAE,CAAC;CAE3D,IAAI,EAAY,WAAW,GAAG,OAAO;EAAE,IAAI;EAAG,IAAI;EAAG,QAAQ,CAAC;CAAE;CAGhE,IAAI,IAAO,UAAU,IAAO,WAAW,IAAO,UAAU,IAAO;CAC/D,KAAK,IAAM,KAAK,GAId,AAHA,IAAO,KAAK,IAAI,GAAM,EAAE,SAAS,CAAC,GAClC,IAAO,KAAK,IAA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GAElG;EAAE;EAAI;EAAI;CAAO;AAC1B"}
|
|
@@ -1,157 +1,157 @@
|
|
|
1
|
-
import { useFlowContext as
|
|
2
|
-
import { generateId as
|
|
3
|
-
import { useCallback as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
1
|
+
import { useFlowContext as e } from "../context/FlowContext.js";
|
|
2
|
+
import { generateId as t } from "../nodes/nodeUtils.js";
|
|
3
|
+
import { useCallback as n, useRef as r } from "react";
|
|
4
|
+
//#region src/components/pro/Flow/hooks/useClipboard.ts
|
|
5
|
+
function i() {
|
|
6
|
+
let { currentCanvas: i, selection: a, setDoc: o, currentCanvasId: s, setSelection: c } = e(), l = r(null), u = n(() => {
|
|
7
|
+
let e = i.nodes.filter((e) => a.nodeIds.has(e.id)), t = i.edges.filter((e) => a.edgeIds.has(e.id)), n = i.lines.filter((e) => a.lineIds.has(e.id)), r = new Set(e.map((e) => e.id)), o = i.edges.filter((e) => r.has(e.source) && r.has(e.target) && !a.edgeIds.has(e.id));
|
|
8
|
+
l.current = {
|
|
9
|
+
nodes: [...e],
|
|
10
|
+
edges: [...t, ...o],
|
|
11
|
+
lines: [...n]
|
|
12
|
+
};
|
|
13
|
+
}, [i, a]), d = n(() => {
|
|
14
|
+
u(), o((e) => {
|
|
15
|
+
let t = e.canvases[s];
|
|
16
|
+
return t ? {
|
|
17
|
+
...e,
|
|
18
|
+
canvases: {
|
|
19
|
+
...e.canvases,
|
|
20
|
+
[s]: {
|
|
21
|
+
...t,
|
|
22
|
+
nodes: t.nodes.filter((e) => !a.nodeIds.has(e.id)),
|
|
23
|
+
edges: t.edges.filter((e) => !a.edgeIds.has(e.id) && !a.nodeIds.has(e.source) && !a.nodeIds.has(e.target)),
|
|
24
|
+
lines: t.lines.filter((e) => !a.lineIds.has(e.id))
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
} : e;
|
|
28
|
+
}), c({
|
|
29
|
+
nodeIds: /* @__PURE__ */ new Set(),
|
|
30
|
+
edgeIds: /* @__PURE__ */ new Set(),
|
|
31
|
+
lineIds: /* @__PURE__ */ new Set()
|
|
32
|
+
});
|
|
33
|
+
}, [
|
|
34
|
+
u,
|
|
35
|
+
o,
|
|
36
|
+
s,
|
|
37
|
+
a,
|
|
38
|
+
c
|
|
39
|
+
]), f = n((e = 20, n = 20) => {
|
|
40
|
+
let r = l.current;
|
|
41
|
+
if (!r) return;
|
|
42
|
+
let i = /* @__PURE__ */ new Map(), a = r.nodes.map((r) => {
|
|
43
|
+
let a = t("node");
|
|
44
|
+
return i.set(r.id, a), {
|
|
45
|
+
...r,
|
|
46
|
+
id: a,
|
|
47
|
+
position: {
|
|
48
|
+
x: r.position.x + e,
|
|
49
|
+
y: r.position.y + n
|
|
50
|
+
},
|
|
51
|
+
data: { ...r.data }
|
|
52
|
+
};
|
|
53
|
+
}), u = r.edges.filter((e) => i.has(e.source) && i.has(e.target)).map((e) => ({
|
|
54
|
+
...e,
|
|
55
|
+
id: t("edge"),
|
|
56
|
+
source: i.get(e.source),
|
|
57
|
+
target: i.get(e.target),
|
|
58
|
+
data: { ...e.data }
|
|
59
|
+
})), d = r.lines.map((r) => ({
|
|
60
|
+
...r,
|
|
61
|
+
id: t("line"),
|
|
62
|
+
points: r.points.map((t) => ({
|
|
63
|
+
x: t.x + e,
|
|
64
|
+
y: t.y + n
|
|
65
|
+
}))
|
|
66
|
+
}));
|
|
67
|
+
o((e) => {
|
|
68
|
+
let t = e.canvases[s];
|
|
69
|
+
return t ? {
|
|
70
|
+
...e,
|
|
71
|
+
canvases: {
|
|
72
|
+
...e.canvases,
|
|
73
|
+
[s]: {
|
|
74
|
+
...t,
|
|
75
|
+
nodes: [...t.nodes, ...a],
|
|
76
|
+
edges: [...t.edges, ...u],
|
|
77
|
+
lines: [...t.lines, ...d]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} : e;
|
|
81
|
+
}), c({
|
|
82
|
+
nodeIds: new Set(a.map((e) => e.id)),
|
|
83
|
+
edgeIds: new Set(u.map((e) => e.id)),
|
|
84
|
+
lineIds: new Set(d.map((e) => e.id))
|
|
85
|
+
});
|
|
86
|
+
}, [
|
|
87
|
+
o,
|
|
88
|
+
s,
|
|
89
|
+
c
|
|
90
|
+
]), p = l.current !== null;
|
|
91
|
+
return {
|
|
92
|
+
copy: u,
|
|
93
|
+
cut: d,
|
|
94
|
+
paste: f,
|
|
95
|
+
duplicate: n((e = 24, n = 24, r) => {
|
|
96
|
+
let l = r?.nodeIds ?? a.nodeIds, u = r?.edgeIds ?? a.edgeIds, d = r?.lineIds ?? a.lineIds, f = i.nodes.filter((e) => l.has(e.id)), p = i.lines.filter((e) => d.has(e.id)), m = new Set(f.map((e) => e.id)), h = i.edges.filter((e) => u.has(e.id) || m.has(e.source) && m.has(e.target));
|
|
97
|
+
if (f.length === 0 && p.length === 0 && h.length === 0) return;
|
|
98
|
+
let g = /* @__PURE__ */ new Map(), _ = f.map((r) => {
|
|
99
|
+
let i = t("node");
|
|
100
|
+
return g.set(r.id, i), {
|
|
101
|
+
...r,
|
|
102
|
+
id: i,
|
|
103
|
+
position: {
|
|
104
|
+
x: r.position.x + e,
|
|
105
|
+
y: r.position.y + n
|
|
106
|
+
},
|
|
107
|
+
data: { ...r.data }
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
for (let e of _) e.parentId && g.has(e.parentId) && (e.parentId = g.get(e.parentId));
|
|
111
|
+
let v = h.filter((e) => g.has(e.source) && g.has(e.target)).map((e) => ({
|
|
112
|
+
...e,
|
|
113
|
+
id: t("edge"),
|
|
114
|
+
source: g.get(e.source),
|
|
115
|
+
target: g.get(e.target),
|
|
116
|
+
data: { ...e.data }
|
|
117
|
+
})), y = p.map((r) => ({
|
|
118
|
+
...r,
|
|
119
|
+
id: t("line"),
|
|
120
|
+
points: r.points.map((t) => ({
|
|
121
|
+
x: t.x + e,
|
|
122
|
+
y: t.y + n
|
|
123
|
+
}))
|
|
124
|
+
}));
|
|
125
|
+
o((e) => {
|
|
126
|
+
let t = e.canvases[s];
|
|
127
|
+
return t ? {
|
|
128
|
+
...e,
|
|
129
|
+
canvases: {
|
|
130
|
+
...e.canvases,
|
|
131
|
+
[s]: {
|
|
132
|
+
...t,
|
|
133
|
+
nodes: [...t.nodes, ..._],
|
|
134
|
+
edges: [...t.edges, ...v],
|
|
135
|
+
lines: [...t.lines, ...y]
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
} : e;
|
|
139
|
+
}), c({
|
|
140
|
+
nodeIds: new Set(_.map((e) => e.id)),
|
|
141
|
+
edgeIds: new Set(v.map((e) => e.id)),
|
|
142
|
+
lineIds: new Set(y.map((e) => e.id))
|
|
143
|
+
});
|
|
144
|
+
}, [
|
|
145
|
+
i,
|
|
146
|
+
a,
|
|
147
|
+
o,
|
|
148
|
+
s,
|
|
149
|
+
c
|
|
150
|
+
]),
|
|
151
|
+
hasClipboard: p
|
|
152
|
+
};
|
|
152
153
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
};
|
|
154
|
+
//#endregion
|
|
155
|
+
export { i as useClipboard };
|
|
156
156
|
|
|
157
157
|
//# sourceMappingURL=useClipboard.js.map
|