dishui 0.0.65 → 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 +10 -15
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Button/index.js +62 -89
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Card/index.d.ts +76 -0
- package/dist/components/Card/index.js +178 -69
- 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 -65
- 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.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 -74
- 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 -58
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/Markdown/Markdown.js +106 -107
- 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.js +82 -82
- 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.js +40 -71
- package/dist/components/Page/index.js.map +1 -1
- 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 -254
- 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 +29 -1
- package/dist/components/StatCard/index.js +189 -86
- 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 -121
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Tabs/index.js +28 -38
- 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 -327
- package/dist/components/pro/CodeEditor/editors/CodeEditor.js.map +1 -1
- package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js +167 -224
- 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 -306
- 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 -144
- 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 +189 -189
- 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 -948
- package/dist/components/pro/Flow/Flow.js.map +1 -1
- package/dist/components/pro/Flow/FlowCanvas.js +1626 -1662
- 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 -180
- 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 -242
- 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 -589
- 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 -248
- package/dist/components/pro/Flow/panels/OutlinePanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/PresentationMode.js +137 -140
- 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 -572
- 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 -41
- 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 +27 -1
- package/dist/index.js +105 -241
- 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 -186
- 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 -60
- 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 +19 -6
|
@@ -1,1676 +1,1640 @@
|
|
|
1
|
-
import { useFlowContext as
|
|
2
|
-
import { useFlowUI as
|
|
3
|
-
import { usePixiApp as
|
|
4
|
-
import { useViewport as
|
|
5
|
-
import { GridRenderer as
|
|
6
|
-
import { SelectionOverlay as
|
|
7
|
-
import { shapeDrawers as
|
|
8
|
-
import { findClosestHandleWorld as
|
|
9
|
-
import { distToSegment as
|
|
10
|
-
import { NodeRenderer as
|
|
11
|
-
import { buildEdgePath as
|
|
12
|
-
import { EdgeRenderer as
|
|
13
|
-
import { LineRenderer as
|
|
14
|
-
import { FreehandTool as
|
|
15
|
-
import { GeometricLineTool as
|
|
16
|
-
import { computeAlignmentSnap as
|
|
17
|
-
import { AlignmentGuidesRenderer as
|
|
18
|
-
import { getDocumentSlides as
|
|
19
|
-
import { useDeleteSelection as
|
|
20
|
-
import { useCallback as
|
|
21
|
-
import { jsx as
|
|
22
|
-
import { Graphics as
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
function
|
|
30
|
-
|
|
1
|
+
import { useFlowContext as e } from "./context/FlowContext.js";
|
|
2
|
+
import { useFlowUI as t } from "./context/FlowUIContext.js";
|
|
3
|
+
import { usePixiApp as n } from "./hooks/usePixiApp.js";
|
|
4
|
+
import { useViewport as r } from "./hooks/useViewport.js";
|
|
5
|
+
import { GridRenderer as i } from "./canvas/GridRenderer.js";
|
|
6
|
+
import { SelectionOverlay as a } from "./canvas/SelectionOverlay.js";
|
|
7
|
+
import { shapeDrawers as o } from "./nodes/shapes.js";
|
|
8
|
+
import { findClosestHandleWorld as s, getHandlePositions as c, handleWorldPos as l } from "./nodes/NodeHandles.js";
|
|
9
|
+
import { distToSegment as u, generateId as d, isPointInNode as f, rectsOverlap as p } from "./nodes/nodeUtils.js";
|
|
10
|
+
import { NodeRenderer as m } from "./nodes/NodeRenderer.js";
|
|
11
|
+
import { buildEdgePath as h, linearizeSegments as g, resolveEdgeEndpoints as _ } from "./edges/edgePaths.js";
|
|
12
|
+
import { EdgeRenderer as v } from "./edges/EdgeRenderer.js";
|
|
13
|
+
import { LineRenderer as ee } from "./lines/LineRenderer.js";
|
|
14
|
+
import { FreehandTool as te } from "./lines/FreehandTool.js";
|
|
15
|
+
import { GeometricLineTool as ne } from "./lines/GeometricLineTool.js";
|
|
16
|
+
import { computeAlignmentSnap as re } from "./hooks/useAlignmentGuides.js";
|
|
17
|
+
import { AlignmentGuidesRenderer as ie } from "./canvas/AlignmentGuides.js";
|
|
18
|
+
import { getDocumentSlides as ae, nextAnimIndex as oe } from "./nodes/animAnchors.js";
|
|
19
|
+
import { useDeleteSelection as se } from "./hooks/useDeleteSelection.js";
|
|
20
|
+
import { useCallback as y, useEffect as b, useRef as x, useState as S } from "react";
|
|
21
|
+
import { jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
22
|
+
import { Graphics as ce } from "pixi.js";
|
|
23
|
+
//#region src/components/pro/Flow/FlowCanvas.tsx
|
|
24
|
+
var le = {
|
|
25
|
+
nw: "nwse-resize",
|
|
26
|
+
ne: "nesw-resize",
|
|
27
|
+
se: "nwse-resize",
|
|
28
|
+
sw: "nesw-resize"
|
|
29
|
+
}, ue = typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(pointer: coarse)").matches, T = ue ? 2 : 1;
|
|
30
|
+
function E(e, t, n) {
|
|
31
|
+
return Math.min(t * T / e, n * T);
|
|
31
32
|
}
|
|
32
|
-
var
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
var de = 26;
|
|
34
|
+
function fe(e, t) {
|
|
35
|
+
return {
|
|
36
|
+
x: e.position.x + e.width / 2,
|
|
37
|
+
y: e.position.y - de / t
|
|
38
|
+
};
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
40
|
+
function pe(e, t, n) {
|
|
41
|
+
return !n || !(t > 0) ? e : Math.round(e / t) * t;
|
|
41
42
|
}
|
|
42
|
-
function
|
|
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
|
-
return M;
|
|
43
|
+
function me(e, t, n) {
|
|
44
|
+
let { x: r, y: i } = t.position, a = t.width, o = t.height, s = [
|
|
45
|
+
[
|
|
46
|
+
"nw",
|
|
47
|
+
r,
|
|
48
|
+
i
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
"ne",
|
|
52
|
+
r + a,
|
|
53
|
+
i
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
"se",
|
|
57
|
+
r + a,
|
|
58
|
+
i + o
|
|
59
|
+
],
|
|
60
|
+
[
|
|
61
|
+
"sw",
|
|
62
|
+
r,
|
|
63
|
+
i + o
|
|
64
|
+
]
|
|
65
|
+
], c = null, l = n;
|
|
66
|
+
for (let [t, n, r] of s) {
|
|
67
|
+
let i = Math.hypot(e.x - n, e.y - r);
|
|
68
|
+
i < l && (l = i, c = t);
|
|
69
|
+
}
|
|
70
|
+
return c;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
72
|
+
function he(e, t, n, r, i) {
|
|
73
|
+
let a = null, o = i;
|
|
74
|
+
for (let i of n) {
|
|
75
|
+
let n = _(i, r);
|
|
76
|
+
if (!n) continue;
|
|
77
|
+
let s = Math.hypot(e - n.sx, t - n.sy);
|
|
78
|
+
s < o && (o = s, a = {
|
|
79
|
+
edgeId: i.id,
|
|
80
|
+
end: "source",
|
|
81
|
+
worldX: n.sx,
|
|
82
|
+
worldY: n.sy
|
|
83
|
+
});
|
|
84
|
+
let c = Math.hypot(e - n.tx, t - n.ty);
|
|
85
|
+
c < o && (o = c, a = {
|
|
86
|
+
edgeId: i.id,
|
|
87
|
+
end: "target",
|
|
88
|
+
worldX: n.tx,
|
|
89
|
+
worldY: n.ty
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return a;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return P;
|
|
94
|
+
function ge(e, t, n, r) {
|
|
95
|
+
let i = null, a = r;
|
|
96
|
+
for (let r of n) {
|
|
97
|
+
let n = r.data.waypoints;
|
|
98
|
+
if (n) for (let o = 0; o < n.length; o++) {
|
|
99
|
+
let s = Math.hypot(e - n[o].x, t - n[o].y);
|
|
100
|
+
s < a && (a = s, i = {
|
|
101
|
+
edgeId: r.id,
|
|
102
|
+
waypointIndex: o,
|
|
103
|
+
wx: n[o].x,
|
|
104
|
+
wy: n[o].y
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return i;
|
|
110
109
|
}
|
|
111
|
-
function
|
|
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
|
-
|
|
110
|
+
function _e(e, t, n, r, i) {
|
|
111
|
+
let a = null, o = i;
|
|
112
|
+
for (let i of n) {
|
|
113
|
+
if (i.type !== "simplebezier") continue;
|
|
114
|
+
let n = _(i, r);
|
|
115
|
+
if (!n) continue;
|
|
116
|
+
let s = i.data.waypoints ?? [], c = [
|
|
117
|
+
{
|
|
118
|
+
x: n.sx,
|
|
119
|
+
y: n.sy
|
|
120
|
+
},
|
|
121
|
+
...s,
|
|
122
|
+
{
|
|
123
|
+
x: n.tx,
|
|
124
|
+
y: n.ty
|
|
125
|
+
}
|
|
126
|
+
], l = i.data.bezierControls, u = c.length - 2;
|
|
127
|
+
for (let r = 0; r <= u; r++) {
|
|
128
|
+
let s = c[r], d = c[r + 1], f = l?.[r], p = Math.hypot(d.x - s.x, d.y - s.y), m = Math.max(30, p * .3), h = f?.c1x ?? (r === 0 ? s.x + n.snx * m : s.x + (d.x - s.x) * .4), g = f?.c1y ?? (r === 0 ? s.y + n.sny * m : s.y), _ = f?.c2x ?? (r === u ? d.x + n.tnx * m : d.x - (d.x - s.x) * .4), v = f?.c2y ?? (r === u ? d.y + n.tny * m : d.y), ee = Math.hypot(e - h, t - g);
|
|
129
|
+
ee < o && (o = ee, a = {
|
|
130
|
+
edgeId: i.id,
|
|
131
|
+
segmentIndex: r,
|
|
132
|
+
controlEnd: "c1",
|
|
133
|
+
wx: h,
|
|
134
|
+
wy: g
|
|
135
|
+
});
|
|
136
|
+
let te = Math.hypot(e - _, t - v);
|
|
137
|
+
te < o && (o = te, a = {
|
|
138
|
+
edgeId: i.id,
|
|
139
|
+
segmentIndex: r,
|
|
140
|
+
controlEnd: "c2",
|
|
141
|
+
wx: _,
|
|
142
|
+
wy: v
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return a;
|
|
148
147
|
}
|
|
149
|
-
function
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return M;
|
|
148
|
+
function ve(e, t, n, r) {
|
|
149
|
+
let i = _(n, r);
|
|
150
|
+
if (!i) return 0;
|
|
151
|
+
let a = n.data.waypoints ?? [], o = [
|
|
152
|
+
{
|
|
153
|
+
x: i.sx,
|
|
154
|
+
y: i.sy
|
|
155
|
+
},
|
|
156
|
+
...a,
|
|
157
|
+
{
|
|
158
|
+
x: i.tx,
|
|
159
|
+
y: i.ty
|
|
160
|
+
}
|
|
161
|
+
], s = Infinity, c = 0;
|
|
162
|
+
for (let n = 0; n < o.length - 1; n++) {
|
|
163
|
+
let r = u(e, t, o[n].x, o[n].y, o[n + 1].x, o[n + 1].y);
|
|
164
|
+
r < s && (s = r, c = n);
|
|
165
|
+
}
|
|
166
|
+
return c;
|
|
169
167
|
}
|
|
170
|
-
function
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
};
|
|
168
|
+
function ye(e, t, n, r, i = 24) {
|
|
169
|
+
let { x: a, y: o, w: s, h: c } = { ...e }, l = t === "nw" || t === "sw", u = t === "ne" || t === "se", d = t === "nw" || t === "ne", f = t === "sw" || t === "se";
|
|
170
|
+
return l && (a += n, s -= n), u && (s += n), d && (o += r, c -= r), f && (c += r), s < i && (l && (a = e.x + e.w - i), s = i), c < i && (d && (o = e.y + e.h - i), c = i), {
|
|
171
|
+
x: a,
|
|
172
|
+
y: o,
|
|
173
|
+
w: s,
|
|
174
|
+
h: c
|
|
175
|
+
};
|
|
179
176
|
}
|
|
180
|
-
function
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
177
|
+
function be(e, t, n, r, i) {
|
|
178
|
+
let a = _(n, r);
|
|
179
|
+
if (!a) return !1;
|
|
180
|
+
let o = h(n.type, a, n.data.waypoints, n.data.bezierControls), s = g(o);
|
|
181
|
+
for (let n = 0; n < s.length - 1; n++) if (u(e, t, s[n].x, s[n].y, s[n + 1].x, s[n + 1].y) < i) return !0;
|
|
182
|
+
return !1;
|
|
186
183
|
}
|
|
187
|
-
function
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
184
|
+
function xe(e, t, n, r) {
|
|
185
|
+
let i = n.points;
|
|
186
|
+
for (let n = 0; n < i.length - 1; n++) if (u(e, t, i[n].x, i[n].y, i[n + 1].x, i[n + 1].y) < r) return !0;
|
|
187
|
+
return !1;
|
|
191
188
|
}
|
|
192
|
-
function
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
children: [/* @__PURE__ */ qt("span", {
|
|
1640
|
-
"aria-hidden": !0,
|
|
1641
|
-
children: "⎋"
|
|
1642
|
-
}), " 取消放置 (ESC)"]
|
|
1643
|
-
}),
|
|
1644
|
-
/* @__PURE__ */ Ie("button", {
|
|
1645
|
-
ref: Be,
|
|
1646
|
-
type: "button",
|
|
1647
|
-
className: "flow-delete-button",
|
|
1648
|
-
style: { display: "none" },
|
|
1649
|
-
onClick: () => Fe.current(),
|
|
1650
|
-
title: "删除所选 (Delete)",
|
|
1651
|
-
"aria-label": "删除所选",
|
|
1652
|
-
children: [/* @__PURE__ */ Ie("svg", {
|
|
1653
|
-
width: "12",
|
|
1654
|
-
height: "12",
|
|
1655
|
-
viewBox: "0 0 24 24",
|
|
1656
|
-
fill: "none",
|
|
1657
|
-
stroke: "currentColor",
|
|
1658
|
-
strokeWidth: "2.5",
|
|
1659
|
-
strokeLinecap: "round",
|
|
1660
|
-
strokeLinejoin: "round",
|
|
1661
|
-
"aria-hidden": !0,
|
|
1662
|
-
children: [
|
|
1663
|
-
/* @__PURE__ */ qt("path", { d: "M3 6h18" }),
|
|
1664
|
-
/* @__PURE__ */ qt("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }),
|
|
1665
|
-
/* @__PURE__ */ qt("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
|
|
1666
|
-
]
|
|
1667
|
-
}), "删除"]
|
|
1668
|
-
})
|
|
1669
|
-
]
|
|
1670
|
-
});
|
|
189
|
+
function D({ onPixiReady: u }) {
|
|
190
|
+
let T = x(null), D = x(null), Se = x(13751771), Ce = y((e) => {
|
|
191
|
+
Se.current = e.gridDot, D.current && (D.current.dotColor = e.gridDot);
|
|
192
|
+
}, []), { pixiRef: O, readyRef: we } = n(T, Ce), { setViewportInternal: Te, viewportReqRef: Ee, viewport: k, autoFocus: De, showGrid: Oe, showAnchors: A, gridSize: ke, toolMode: j, edgeType: Ae, focusOnRect: je, setFocusOnRect: Me, pendingPlacement: Ne, setPendingPlacement: Pe, setContextMenu: Fe, beginNodeDrag: Ie, endNodeDrag: Le, presentation: Re, editingNodeId: ze, setEditingNodeId: Be, readOnly: Ve, placementSnap: He } = t(), { currentCanvas: Ue, selection: We, setSelection: M, setDoc: N, currentCanvasId: Ge, pushCanvas: Ke, doc: qe } = e(), Je = se(), Ye = x(Je);
|
|
193
|
+
Ye.current = Je;
|
|
194
|
+
let Xe = x(null), Ze = x(Ve);
|
|
195
|
+
Ze.current = Ve;
|
|
196
|
+
let Qe = x(He);
|
|
197
|
+
Qe.current = He;
|
|
198
|
+
let P = x(ke);
|
|
199
|
+
P.current = ke;
|
|
200
|
+
let F = x(null), $e = x(null), et = x(null), tt = x(null), nt = x(null), rt = x(null), I = x(null), it = x(null), at = x(null), ot = x(null), L = x([]), st = x(null), ct = x(null), R = x(null), lt = x(null), ut = x({
|
|
201
|
+
time: 0,
|
|
202
|
+
wx: 0,
|
|
203
|
+
wy: 0
|
|
204
|
+
}), dt = x({
|
|
205
|
+
time: 0,
|
|
206
|
+
wx: 0,
|
|
207
|
+
wy: 0
|
|
208
|
+
}), ft = x(0), pt = x(null), mt = x({
|
|
209
|
+
x: 0,
|
|
210
|
+
y: 0
|
|
211
|
+
}), ht = A || Re ? Ue : {
|
|
212
|
+
...Ue,
|
|
213
|
+
nodes: Ue.nodes.filter((e) => e.type !== "animAnchor")
|
|
214
|
+
}, z = x(ht);
|
|
215
|
+
z.current = ht;
|
|
216
|
+
let B = x(Ge);
|
|
217
|
+
B.current = Ge;
|
|
218
|
+
let gt = x(We);
|
|
219
|
+
gt.current = We;
|
|
220
|
+
let _t = x(qe);
|
|
221
|
+
_t.current = qe;
|
|
222
|
+
let vt = x(j);
|
|
223
|
+
vt.current = j;
|
|
224
|
+
let yt = x(De);
|
|
225
|
+
yt.current = De;
|
|
226
|
+
let bt = x(je);
|
|
227
|
+
bt.current = je;
|
|
228
|
+
let xt = x(Ae);
|
|
229
|
+
xt.current = Ae;
|
|
230
|
+
let St = x(A);
|
|
231
|
+
St.current = A;
|
|
232
|
+
let V = x(Re);
|
|
233
|
+
V.current = Re;
|
|
234
|
+
let Ct = x(Ne);
|
|
235
|
+
Ct.current = Ne;
|
|
236
|
+
let wt = x(Ie);
|
|
237
|
+
wt.current = Ie;
|
|
238
|
+
let H = x(Le);
|
|
239
|
+
H.current = Le;
|
|
240
|
+
let U = x(null), W = x(null), G = x(null), K = x(null), q = x(null), J = x(null), Y = x(null), X = x(null), Tt = x(k), Et = x(0), Dt = y((e) => {
|
|
241
|
+
Tt.current = e, Et.current ||= requestAnimationFrame(() => {
|
|
242
|
+
Et.current = 0, Te(Tt.current);
|
|
243
|
+
});
|
|
244
|
+
}, [Te]), { vmRef: Z, screenToWorld: Ot } = r(O, Dt), Q = x(Ot);
|
|
245
|
+
Q.current = Ot;
|
|
246
|
+
let [$, kt] = S(null), [At, jt] = S(null), Mt = x($);
|
|
247
|
+
Mt.current = $;
|
|
248
|
+
let Nt = x(() => {});
|
|
249
|
+
Nt.current = (e, t, n) => {
|
|
250
|
+
Be(e === "node" ? t : null), kt({
|
|
251
|
+
kind: e,
|
|
252
|
+
id: t,
|
|
253
|
+
value: n
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
let Pt = y((e) => {
|
|
257
|
+
let t = Mt.current;
|
|
258
|
+
t && (N((n) => {
|
|
259
|
+
let r = B.current, i = n.canvases[r];
|
|
260
|
+
if (!i) return n;
|
|
261
|
+
let a = i;
|
|
262
|
+
if (t.kind === "node") a = {
|
|
263
|
+
...i,
|
|
264
|
+
nodes: i.nodes.map((n) => n.id === t.id ? {
|
|
265
|
+
...n,
|
|
266
|
+
data: {
|
|
267
|
+
...n.data,
|
|
268
|
+
label: e
|
|
269
|
+
}
|
|
270
|
+
} : n)
|
|
271
|
+
};
|
|
272
|
+
else if (t.kind === "edge") a = {
|
|
273
|
+
...i,
|
|
274
|
+
edges: i.edges.map((n) => n.id === t.id ? {
|
|
275
|
+
...n,
|
|
276
|
+
data: {
|
|
277
|
+
...n.data,
|
|
278
|
+
labelText: e
|
|
279
|
+
}
|
|
280
|
+
} : n)
|
|
281
|
+
};
|
|
282
|
+
else return n;
|
|
283
|
+
return {
|
|
284
|
+
...n,
|
|
285
|
+
canvases: {
|
|
286
|
+
...n.canvases,
|
|
287
|
+
[r]: a
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
}), kt(null), Be(null), jt(null));
|
|
291
|
+
}, [N, Be]), Ft = y(() => {
|
|
292
|
+
kt(null), Be(null), jt(null);
|
|
293
|
+
}, [Be]);
|
|
294
|
+
b(() => {
|
|
295
|
+
if (!ze || Mt.current?.id === ze) return;
|
|
296
|
+
let e = z.current.nodes.find((e) => e.id === ze);
|
|
297
|
+
e && Nt.current("node", e.id, e.data.label);
|
|
298
|
+
}, [ze]), b(() => {
|
|
299
|
+
if (!$) return;
|
|
300
|
+
let e = Z.current;
|
|
301
|
+
if (!e) return;
|
|
302
|
+
let t = z.current, n = null;
|
|
303
|
+
if ($.kind === "node") {
|
|
304
|
+
let e = t.nodes.find((e) => e.id === $.id);
|
|
305
|
+
e && (n = {
|
|
306
|
+
x: e.position.x + e.width / 2,
|
|
307
|
+
y: e.position.y + e.height / 2
|
|
308
|
+
});
|
|
309
|
+
} else if ($.kind === "edge") {
|
|
310
|
+
let e = t.edges.find((e) => e.id === $.id), r = /* @__PURE__ */ new Map();
|
|
311
|
+
for (let e of t.nodes) r.set(e.id, e);
|
|
312
|
+
if (e) {
|
|
313
|
+
let t = _(e, r);
|
|
314
|
+
if (t) {
|
|
315
|
+
let r = h(e.type, t, e.data.waypoints, e.data.bezierControls), i = g(r), a = i[Math.floor(i.length / 2)] ?? {
|
|
316
|
+
x: (t.sx + t.tx) / 2,
|
|
317
|
+
y: (t.sy + t.ty) / 2
|
|
318
|
+
};
|
|
319
|
+
n = {
|
|
320
|
+
x: a.x,
|
|
321
|
+
y: a.y
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
if (n) {
|
|
327
|
+
let t = e.worldToScreen(n.x, n.y);
|
|
328
|
+
jt({
|
|
329
|
+
x: t.x,
|
|
330
|
+
y: t.y
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}, [$, Z]);
|
|
334
|
+
let It = x(0);
|
|
335
|
+
b(() => {
|
|
336
|
+
Ee.current !== It.current && (It.current = Ee.current, Tt.current = k, Z.current?.setState(k));
|
|
337
|
+
}, [
|
|
338
|
+
k,
|
|
339
|
+
Z,
|
|
340
|
+
Ee
|
|
341
|
+
]), b(() => {
|
|
342
|
+
Me((e, t, n, r, i) => {
|
|
343
|
+
let a = Z.current, o = T.current;
|
|
344
|
+
if (!a || !o) return;
|
|
345
|
+
let s = o.clientWidth || 800, c = o.clientHeight || 600, l = Math.max(0, i?.padding ?? 60), u = Math.max(1, s - l * 2), d = Math.max(1, c - l * 2), f = i?.preserveZoom ? a.state.zoom : Math.min(u / Math.max(n, 1), d / Math.max(r, 1), i?.maxZoom ?? 2), p = e + n / 2, m = t + r / 2, h = s / 2 - p * f, g = c / 2 - m * f;
|
|
346
|
+
a.animateTo({
|
|
347
|
+
x: h,
|
|
348
|
+
y: g,
|
|
349
|
+
zoom: f
|
|
350
|
+
}, i?.duration ?? 350);
|
|
351
|
+
});
|
|
352
|
+
}, [Me, Z]);
|
|
353
|
+
let Lt = y((e) => {
|
|
354
|
+
N((t) => {
|
|
355
|
+
let n = t.canvases[B.current];
|
|
356
|
+
return n ? {
|
|
357
|
+
...t,
|
|
358
|
+
canvases: {
|
|
359
|
+
...t.canvases,
|
|
360
|
+
[B.current]: {
|
|
361
|
+
...n,
|
|
362
|
+
lines: [...n.lines, e]
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
} : t;
|
|
366
|
+
});
|
|
367
|
+
}, [N, Ge]), Rt = x(Lt);
|
|
368
|
+
return Rt.current = Lt, b(() => {
|
|
369
|
+
let e = O.current;
|
|
370
|
+
if (!e || e.destroyed) return;
|
|
371
|
+
let t = !1, n = null, r = null, h = null, g = () => {
|
|
372
|
+
if (t) return;
|
|
373
|
+
if (!we.current) {
|
|
374
|
+
setTimeout(g, 30);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
D.current = new i(e.app.stage, ke, Oe), D.current.dotColor = Se.current, F.current = new a(e.app.stage), $e.current = new m(e.world), et.current = new v(e.world), tt.current = new ee(e.world);
|
|
378
|
+
let se = new ce();
|
|
379
|
+
se.label = "connect-line", se.visible = !1, e.world.addChild(se), J.current = se;
|
|
380
|
+
let y = new ce();
|
|
381
|
+
y.label = "transform-handles", e.app.stage.addChild(y), it.current = y;
|
|
382
|
+
let b = new ce();
|
|
383
|
+
b.label = "handle-hover", e.world.addChild(b), at.current = b;
|
|
384
|
+
let x = new ce();
|
|
385
|
+
x.label = "edge-edit-handles", e.world.addChild(x), lt.current = x;
|
|
386
|
+
let S = new ce();
|
|
387
|
+
S.label = "ghost-placement", S.alpha = .5, e.world.addChild(S), pt.current = S, ot.current = new ie(e.world), nt.current = new te(e.app.stage, e.world, {
|
|
388
|
+
onLineComplete: (e) => Rt.current(e),
|
|
389
|
+
screenToWorld: (e, t) => Q.current(e, t)
|
|
390
|
+
}), rt.current = new ne(e.app.stage, e.world, {
|
|
391
|
+
onLineComplete: (e) => Rt.current(e),
|
|
392
|
+
screenToWorld: (e, t) => Q.current(e, t)
|
|
393
|
+
}), u?.(e);
|
|
394
|
+
let C = e.app.stage;
|
|
395
|
+
C.on("pointerdown", (e) => {
|
|
396
|
+
if (T.current?.focus({ preventScroll: !0 }), Z.current?.multiTouchActive || Z.current?.isPanning || Z.current?.isSpaceHeld || e.button !== 0) return;
|
|
397
|
+
let t = vt.current;
|
|
398
|
+
if (t === "pan") {
|
|
399
|
+
Z.current?.startPan(e.global.x, e.global.y);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (t === "freehand" || t === "line" || t === "polyline" || t === "arrow") return;
|
|
403
|
+
let n = Q.current(e.global.x, e.global.y), r = z.current.nodes, i = z.current.edges, a = z.current.lines, o = gt.current, u = e.metaKey || e.ctrlKey || e.shiftKey, d = Z.current?.state.zoom ?? 1;
|
|
404
|
+
if (Ct.current) return;
|
|
405
|
+
let p = Date.now(), m = ut.current, h = p - m.time < 350 && Math.hypot(n.x - m.wx, n.y - m.wy) < 8 / d;
|
|
406
|
+
if (ut.current = {
|
|
407
|
+
time: p,
|
|
408
|
+
wx: n.x,
|
|
409
|
+
wy: n.y
|
|
410
|
+
}, o.nodeIds.size === 1 && !u && t === "select" && !Ze.current) {
|
|
411
|
+
let e = r.find((e) => e.id === [...o.nodeIds][0]);
|
|
412
|
+
if (e) {
|
|
413
|
+
let t = fe(e, d);
|
|
414
|
+
if (Math.hypot(n.x - t.x, n.y - t.y) < E(d, 12, 24)) {
|
|
415
|
+
K.current = {
|
|
416
|
+
active: !0,
|
|
417
|
+
nodeId: e.id,
|
|
418
|
+
cx: e.position.x + e.width / 2,
|
|
419
|
+
cy: e.position.y + e.height / 2,
|
|
420
|
+
startPointerAngle: Math.atan2(n.y - (e.position.y + e.height / 2), n.x - (e.position.x + e.width / 2)),
|
|
421
|
+
startRotation: e.data.rotation ?? 0
|
|
422
|
+
}, wt.current();
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (o.nodeIds.size === 1 && !u && t === "select") {
|
|
428
|
+
let e = r.find((e) => e.id === [...o.nodeIds][0]);
|
|
429
|
+
if (e) {
|
|
430
|
+
let t = me(n, e, E(d, 10, 16));
|
|
431
|
+
if (t) {
|
|
432
|
+
let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = e.type === "geometryGroup", s = o || e.type === "flowGroup" || e.data.isGroup, c = e.position.x, l = e.position.y, u = e.width, d = e.height;
|
|
433
|
+
for (let t of r) t.id !== e.id && (t.parentId === e.id || o && t.position.x >= c && t.position.y >= l && t.position.x + t.width <= c + u && t.position.y + t.height <= l + d) && i.set(t.id, {
|
|
434
|
+
x: t.position.x,
|
|
435
|
+
y: t.position.y,
|
|
436
|
+
w: t.width,
|
|
437
|
+
h: t.height
|
|
438
|
+
});
|
|
439
|
+
if (s) for (let t of z.current.lines) (t.parentId === e.id || o && t.points.length > 0 && t.points.every((e) => e.x >= c && e.x <= c + u && e.y >= l && e.y <= l + d)) && a.set(t.id, t.points.map((e) => ({ ...e })));
|
|
440
|
+
Y.current = {
|
|
441
|
+
active: !0,
|
|
442
|
+
nodeId: e.id,
|
|
443
|
+
handle: t,
|
|
444
|
+
startWorld: n,
|
|
445
|
+
startBounds: {
|
|
446
|
+
x: e.position.x,
|
|
447
|
+
y: e.position.y,
|
|
448
|
+
w: e.width,
|
|
449
|
+
h: e.height
|
|
450
|
+
},
|
|
451
|
+
childStarts: i,
|
|
452
|
+
childLineStarts: a.size > 0 ? a : void 0
|
|
453
|
+
};
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
let g = null;
|
|
459
|
+
for (let e = r.length - 1; e >= 0; e--) if (f(n.x, n.y, r[e])) {
|
|
460
|
+
g = r[e];
|
|
461
|
+
break;
|
|
462
|
+
}
|
|
463
|
+
if (g?.parentId) {
|
|
464
|
+
let e = r.find((e) => e.id === g.parentId);
|
|
465
|
+
e && (g = e);
|
|
466
|
+
}
|
|
467
|
+
ue && (I.current = g ? g.parentId ? r.find((e) => e.id === g.parentId)?.id ?? g.id : g.id : null, st.current = null, ct.current = null);
|
|
468
|
+
let _ = !1;
|
|
469
|
+
if (g && t === "select" && (_ = Math.min(n.x - g.position.x, g.position.x + g.width - n.x, n.y - g.position.y, g.position.y + g.height - n.y) > Math.min(14, Math.min(g.width, g.height) * .3)), (t === "select" || t === "connect") && (g || ue) && !_) {
|
|
470
|
+
let e = g ? [g] : r, t = E(d, 14, 20), i = null, a = null, o = Infinity;
|
|
471
|
+
for (let r of e) {
|
|
472
|
+
let e = c(r.width, r.height), u = s(e, r, n.x, n.y, t);
|
|
473
|
+
if (!u) continue;
|
|
474
|
+
let d = l(u, r), f = Math.hypot(n.x - d.x, n.y - d.y);
|
|
475
|
+
f < o && (o = f, i = r, a = u);
|
|
476
|
+
}
|
|
477
|
+
if (i && a) {
|
|
478
|
+
G.current = {
|
|
479
|
+
active: !0,
|
|
480
|
+
sourceNodeId: i.id,
|
|
481
|
+
sourceHandleId: a.id
|
|
482
|
+
};
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
if ((t === "select" || t === "connect") && !u && o.edgeIds.size > 0) {
|
|
487
|
+
let e = /* @__PURE__ */ new Map();
|
|
488
|
+
for (let t of r) e.set(t.id, t);
|
|
489
|
+
let t = i.filter((e) => o.edgeIds.has(e.id)), a = he(n.x, n.y, t, e, E(d, 14, 20));
|
|
490
|
+
if (a) {
|
|
491
|
+
let e = i.find((e) => e.id === a.edgeId);
|
|
492
|
+
if (e) {
|
|
493
|
+
let t = a.end === "source" ? "target" : "source";
|
|
494
|
+
q.current = {
|
|
495
|
+
active: !0,
|
|
496
|
+
edgeId: e.id,
|
|
497
|
+
movingEnd: a.end,
|
|
498
|
+
fixedNodeId: t === "source" ? e.source : e.target,
|
|
499
|
+
fixedHandleId: t === "source" ? e.sourceHandle : e.targetHandle
|
|
500
|
+
};
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
if (t === "select" && o.edgeIds.size > 0 && !g) {
|
|
506
|
+
let e = /* @__PURE__ */ new Map();
|
|
507
|
+
for (let t of r) e.set(t.id, t);
|
|
508
|
+
let t = i.filter((e) => o.edgeIds.has(e.id)), a = E(d, 10, 14), s = _e(n.x, n.y, t, e, a);
|
|
509
|
+
if (s) {
|
|
510
|
+
R.current = {
|
|
511
|
+
active: !0,
|
|
512
|
+
edgeId: s.edgeId,
|
|
513
|
+
type: s.controlEnd === "c1" ? "bezierC1" : "bezierC2",
|
|
514
|
+
index: s.segmentIndex
|
|
515
|
+
};
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
let c = ge(n.x, n.y, t, a);
|
|
519
|
+
if (c) {
|
|
520
|
+
if (h) {
|
|
521
|
+
N((e) => {
|
|
522
|
+
let t = e.canvases[B.current];
|
|
523
|
+
return t ? {
|
|
524
|
+
...e,
|
|
525
|
+
canvases: {
|
|
526
|
+
...e.canvases,
|
|
527
|
+
[B.current]: {
|
|
528
|
+
...t,
|
|
529
|
+
edges: t.edges.map((e) => {
|
|
530
|
+
if (e.id !== c.edgeId) return e;
|
|
531
|
+
let t = [...e.data.waypoints ?? []];
|
|
532
|
+
t.splice(c.waypointIndex, 1);
|
|
533
|
+
let n = {
|
|
534
|
+
...e.data,
|
|
535
|
+
waypoints: t.length > 0 ? t : void 0
|
|
536
|
+
};
|
|
537
|
+
if (e.type === "simplebezier" && e.data.bezierControls) {
|
|
538
|
+
let t = [...e.data.bezierControls];
|
|
539
|
+
t.splice(c.waypointIndex, 2, null), n.bezierControls = t.some((e) => e !== null) ? t : void 0;
|
|
540
|
+
}
|
|
541
|
+
return {
|
|
542
|
+
...e,
|
|
543
|
+
data: n
|
|
544
|
+
};
|
|
545
|
+
})
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
} : e;
|
|
549
|
+
});
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
R.current = {
|
|
553
|
+
active: !0,
|
|
554
|
+
edgeId: c.edgeId,
|
|
555
|
+
type: "waypoint",
|
|
556
|
+
index: c.waypointIndex
|
|
557
|
+
};
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
if (h) {
|
|
561
|
+
for (let r of t) if (be(n.x, n.y, r, e, E(d, 8, 12))) {
|
|
562
|
+
let t = ve(n.x, n.y, r, e), i = {
|
|
563
|
+
x: n.x,
|
|
564
|
+
y: n.y
|
|
565
|
+
};
|
|
566
|
+
N((e) => {
|
|
567
|
+
let n = e.canvases[B.current];
|
|
568
|
+
return n ? {
|
|
569
|
+
...e,
|
|
570
|
+
canvases: {
|
|
571
|
+
...e.canvases,
|
|
572
|
+
[B.current]: {
|
|
573
|
+
...n,
|
|
574
|
+
edges: n.edges.map((e) => {
|
|
575
|
+
if (e.id !== r.id) return e;
|
|
576
|
+
let n = [...e.data.waypoints ?? []];
|
|
577
|
+
n.splice(t, 0, i);
|
|
578
|
+
let a = {
|
|
579
|
+
...e.data,
|
|
580
|
+
waypoints: n
|
|
581
|
+
};
|
|
582
|
+
if (e.type === "simplebezier" && e.data.bezierControls) {
|
|
583
|
+
let n = [...e.data.bezierControls];
|
|
584
|
+
for (; n.length < (e.data.waypoints ?? []).length + 1;) n.push(null);
|
|
585
|
+
n.splice(t, 1, null, null), a.bezierControls = n;
|
|
586
|
+
}
|
|
587
|
+
return {
|
|
588
|
+
...e,
|
|
589
|
+
data: a
|
|
590
|
+
};
|
|
591
|
+
})
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
} : e;
|
|
595
|
+
}), R.current = {
|
|
596
|
+
active: !0,
|
|
597
|
+
edgeId: r.id,
|
|
598
|
+
type: "waypoint",
|
|
599
|
+
index: t
|
|
600
|
+
};
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
if (g && (t === "select" || t === "connect")) {
|
|
606
|
+
!u && !o.nodeIds.has(g.id) ? M({
|
|
607
|
+
nodeIds: /* @__PURE__ */ new Set([g.id]),
|
|
608
|
+
edgeIds: /* @__PURE__ */ new Set(),
|
|
609
|
+
lineIds: /* @__PURE__ */ new Set()
|
|
610
|
+
}) : u && M((e) => {
|
|
611
|
+
let t = new Set(e.nodeIds);
|
|
612
|
+
return t.has(g.id) ? t.delete(g.id) : t.add(g.id), {
|
|
613
|
+
nodeIds: t,
|
|
614
|
+
edgeIds: /* @__PURE__ */ new Set(),
|
|
615
|
+
lineIds: /* @__PURE__ */ new Set()
|
|
616
|
+
};
|
|
617
|
+
}), yt.current && bt.current(g.position.x, g.position.y, g.width, g.height, {
|
|
618
|
+
padding: 80,
|
|
619
|
+
preserveZoom: !0,
|
|
620
|
+
duration: 280
|
|
621
|
+
});
|
|
622
|
+
let e = o.nodeIds.has(g.id) ? new Set(o.nodeIds) : /* @__PURE__ */ new Set([g.id]);
|
|
623
|
+
u && !o.nodeIds.has(g.id) && e.add(g.id);
|
|
624
|
+
let t = /* @__PURE__ */ new Set();
|
|
625
|
+
for (let n of e) {
|
|
626
|
+
let i = r.find((e) => e.id === n);
|
|
627
|
+
if (!i || i.type !== "flowGroup" && i.type !== "geometryGroup" && !i.data.isGroup) continue;
|
|
628
|
+
let a = i.type === "geometryGroup", o = i.position.x, s = i.position.y, c = i.width, l = i.height;
|
|
629
|
+
for (let t of r) if (!(e.has(t.id) || t.id === n)) {
|
|
630
|
+
if (t.parentId === n) {
|
|
631
|
+
e.add(t.id);
|
|
632
|
+
continue;
|
|
633
|
+
}
|
|
634
|
+
a && t.position.x >= o && t.position.y >= s && t.position.x + t.width <= o + c && t.position.y + t.height <= s + l && e.add(t.id);
|
|
635
|
+
}
|
|
636
|
+
for (let e of z.current.lines) e.parentId === n && t.add(e.id);
|
|
637
|
+
if (a) for (let e of z.current.lines) t.has(e.id) || e.points.length > 0 && e.points.every((e) => e.x >= o && e.x <= o + c && e.y >= s && e.y <= s + l) && t.add(e.id);
|
|
638
|
+
}
|
|
639
|
+
let i = /* @__PURE__ */ new Map();
|
|
640
|
+
for (let t of r) e.has(t.id) && i.set(t.id, { ...t.position });
|
|
641
|
+
let a = /* @__PURE__ */ new Map();
|
|
642
|
+
if (t.size > 0) for (let e of z.current.lines) t.has(e.id) && a.set(e.id, e.points.map((e) => ({ ...e })));
|
|
643
|
+
U.current = {
|
|
644
|
+
active: !0,
|
|
645
|
+
nodeIds: e,
|
|
646
|
+
lineIds: t.size > 0 ? t : void 0,
|
|
647
|
+
startWorld: n,
|
|
648
|
+
nodeStarts: i,
|
|
649
|
+
linePointStarts: a.size > 0 ? a : void 0
|
|
650
|
+
}, wt.current();
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
let v = /* @__PURE__ */ new Map();
|
|
654
|
+
for (let e of r) v.set(e.id, e);
|
|
655
|
+
let ee = E(d, 8, 12);
|
|
656
|
+
for (let e of i) if (be(n.x, n.y, e, v, ee)) {
|
|
657
|
+
if (M(u ? (t) => {
|
|
658
|
+
let n = new Set(t.edgeIds);
|
|
659
|
+
return n.has(e.id) ? n.delete(e.id) : n.add(e.id), {
|
|
660
|
+
...t,
|
|
661
|
+
edgeIds: n
|
|
662
|
+
};
|
|
663
|
+
} : {
|
|
664
|
+
nodeIds: /* @__PURE__ */ new Set(),
|
|
665
|
+
edgeIds: /* @__PURE__ */ new Set([e.id]),
|
|
666
|
+
lineIds: /* @__PURE__ */ new Set()
|
|
667
|
+
}), yt.current) {
|
|
668
|
+
let t = v.get(e.source), n = v.get(e.target);
|
|
669
|
+
if (t && n) {
|
|
670
|
+
let e = Math.min(t.position.x, n.position.x), r = Math.min(t.position.y, n.position.y), i = Math.max(t.position.x + t.width, n.position.x + n.width), a = Math.max(t.position.y + t.height, n.position.y + n.height);
|
|
671
|
+
bt.current(e, r, i - e, a - r, {
|
|
672
|
+
padding: 80,
|
|
673
|
+
preserveZoom: !0,
|
|
674
|
+
duration: 280
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
for (let e of a) if (xe(n.x, n.y, e, ee)) {
|
|
681
|
+
let t = o.lineIds.has(e.id);
|
|
682
|
+
if (u ? M((t) => {
|
|
683
|
+
let n = new Set(t.lineIds);
|
|
684
|
+
return n.has(e.id) ? n.delete(e.id) : n.add(e.id), {
|
|
685
|
+
...t,
|
|
686
|
+
lineIds: n
|
|
687
|
+
};
|
|
688
|
+
}) : t || M({
|
|
689
|
+
nodeIds: /* @__PURE__ */ new Set(),
|
|
690
|
+
edgeIds: /* @__PURE__ */ new Set(),
|
|
691
|
+
lineIds: /* @__PURE__ */ new Set([e.id])
|
|
692
|
+
}), yt.current && e.points.length > 0) {
|
|
693
|
+
let t = e.points.map((e) => e.x), n = e.points.map((e) => e.y), r = Math.min(...t), i = Math.min(...n), a = Math.max(...t), o = Math.max(...n);
|
|
694
|
+
bt.current(r, i, Math.max(1, a - r), Math.max(1, o - i), {
|
|
695
|
+
padding: 80,
|
|
696
|
+
preserveZoom: !0,
|
|
697
|
+
duration: 280
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
let r = t ? new Set(o.lineIds) : /* @__PURE__ */ new Set([e.id]), i = /* @__PURE__ */ new Map();
|
|
701
|
+
for (let e of a) r.has(e.id) && i.set(e.id, e.points.map((e) => ({ ...e })));
|
|
702
|
+
X.current = {
|
|
703
|
+
active: !0,
|
|
704
|
+
lineIds: r,
|
|
705
|
+
startWorld: n,
|
|
706
|
+
pointStarts: i
|
|
707
|
+
};
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
u || M({
|
|
711
|
+
nodeIds: /* @__PURE__ */ new Set(),
|
|
712
|
+
edgeIds: /* @__PURE__ */ new Set(),
|
|
713
|
+
lineIds: /* @__PURE__ */ new Set()
|
|
714
|
+
}), t === "select" && (W.current = {
|
|
715
|
+
active: !0,
|
|
716
|
+
startScreen: {
|
|
717
|
+
x: e.global.x,
|
|
718
|
+
y: e.global.y
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
}), C.on("globalpointermove", (e) => {
|
|
722
|
+
let t = Q.current(e.global.x, e.global.y);
|
|
723
|
+
if (mt.current = t, Z.current?.multiTouchActive) return;
|
|
724
|
+
let n = vt.current;
|
|
725
|
+
if (n === "freehand" || n === "line" || n === "polyline" || n === "arrow") return;
|
|
726
|
+
let r = z.current.nodes, i = z.current.edges, a = Z.current?.state.zoom ?? 1, o = !U.current?.active && !G.current?.active && !Y.current?.active && !q.current?.active && !R.current?.active && !X.current?.active && !K.current?.active, u = null;
|
|
727
|
+
for (let e = r.length - 1; e >= 0; e--) if (f(t.x, t.y, r[e])) {
|
|
728
|
+
let t = r[e];
|
|
729
|
+
u = t.parentId ? r.find((e) => e.id === t.parentId)?.id ?? t.id : t.id;
|
|
730
|
+
break;
|
|
731
|
+
}
|
|
732
|
+
if (I.current = u, o && (n === "select" || n === "connect")) {
|
|
733
|
+
let e = /* @__PURE__ */ new Map();
|
|
734
|
+
for (let t of r) e.set(t.id, t);
|
|
735
|
+
let n = gt.current, o = n.edgeIds.size > 0 ? i.filter((e) => n.edgeIds.has(e.id)) : [], d = o.length > 0 ? he(t.x, t.y, o, e, E(a, 12, 18)) : null;
|
|
736
|
+
ct.current = d;
|
|
737
|
+
let f = null;
|
|
738
|
+
if (u) {
|
|
739
|
+
let e = r.find((e) => e.id === u);
|
|
740
|
+
if (e) {
|
|
741
|
+
let n = c(e.width, e.height), r = s(n, e, t.x, t.y, E(a, 14, 20));
|
|
742
|
+
if (r) {
|
|
743
|
+
let t = l(r, e);
|
|
744
|
+
f = {
|
|
745
|
+
nodeId: e.id,
|
|
746
|
+
handleId: r.id,
|
|
747
|
+
wx: t.x,
|
|
748
|
+
wy: t.y
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
st.current = f;
|
|
754
|
+
}
|
|
755
|
+
let d = T.current;
|
|
756
|
+
if (d && o) {
|
|
757
|
+
let e = gt.current, o = "";
|
|
758
|
+
if (ct.current) o = "crosshair";
|
|
759
|
+
else if (st.current) o = "crosshair";
|
|
760
|
+
else if (e.edgeIds.size > 0 && n === "select") {
|
|
761
|
+
let n = i.filter((t) => e.edgeIds.has(t.id)), s = /* @__PURE__ */ new Map();
|
|
762
|
+
for (let e of r) s.set(e.id, e);
|
|
763
|
+
let c = E(a, 10, 14);
|
|
764
|
+
(ge(t.x, t.y, n, c) || _e(t.x, t.y, n, s, c)) && (o = "grab");
|
|
765
|
+
}
|
|
766
|
+
if (!o && e.nodeIds.size === 1 && n === "select") {
|
|
767
|
+
let n = r.find((t) => t.id === [...e.nodeIds][0]);
|
|
768
|
+
if (n) {
|
|
769
|
+
let e = me(t, n, E(a, 10, 16));
|
|
770
|
+
if (e) o = le[e];
|
|
771
|
+
else if (!Ze.current) {
|
|
772
|
+
let e = fe(n, a);
|
|
773
|
+
Math.hypot(t.x - e.x, t.y - e.y) < E(a, 12, 24) && (o = "grab");
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
if (!o && n === "select") {
|
|
778
|
+
let e = z.current.lines, n = E(a, 8, 12);
|
|
779
|
+
for (let r of e) if (xe(t.x, t.y, r, n)) {
|
|
780
|
+
o = "move";
|
|
781
|
+
break;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
d.style.cursor = o;
|
|
785
|
+
}
|
|
786
|
+
if (Y.current?.active) {
|
|
787
|
+
let e = Y.current, n = t.x - e.startWorld.x, r = t.y - e.startWorld.y, i = ye(e.startBounds, e.handle, n, r), a = z.current.nodes, o = {
|
|
788
|
+
id: e.nodeId,
|
|
789
|
+
type: "shapeRect",
|
|
790
|
+
position: {
|
|
791
|
+
x: i.x,
|
|
792
|
+
y: i.y
|
|
793
|
+
},
|
|
794
|
+
width: i.w,
|
|
795
|
+
height: i.h,
|
|
796
|
+
data: {}
|
|
797
|
+
}, s = re([o], a);
|
|
798
|
+
if (i.x += s.dx, i.y += s.dy, (e.handle === "ne" || e.handle === "se") && (i.w += s.dx), (e.handle === "se" || e.handle === "sw") && (i.h += s.dy), L.current = s.guides, Qe.current && P.current > 0 && s.guides.length === 0) {
|
|
799
|
+
let t = P.current;
|
|
800
|
+
(e.handle === "nw" || e.handle === "sw") && (i.x = Math.round(i.x / t) * t), (e.handle === "nw" || e.handle === "ne") && (i.y = Math.round(i.y / t) * t), (e.handle === "ne" || e.handle === "se") && (i.w = Math.round((i.x + i.w) / t) * t - i.x), (e.handle === "se" || e.handle === "sw") && (i.h = Math.round((i.y + i.h) / t) * t - i.y);
|
|
801
|
+
}
|
|
802
|
+
let c = e.startBounds, l = Math.max(i.w, 24), u = Math.max(i.h, 24), d = c.w > 0 ? l / c.w : 1, f = c.h > 0 ? u / c.h : 1;
|
|
803
|
+
N((t) => {
|
|
804
|
+
let n = t.canvases[B.current];
|
|
805
|
+
return n ? {
|
|
806
|
+
...t,
|
|
807
|
+
canvases: {
|
|
808
|
+
...t.canvases,
|
|
809
|
+
[B.current]: {
|
|
810
|
+
...n,
|
|
811
|
+
nodes: n.nodes.map((t) => {
|
|
812
|
+
if (t.id === e.nodeId) return {
|
|
813
|
+
...t,
|
|
814
|
+
position: {
|
|
815
|
+
x: i.x,
|
|
816
|
+
y: i.y
|
|
817
|
+
},
|
|
818
|
+
width: l,
|
|
819
|
+
height: u
|
|
820
|
+
};
|
|
821
|
+
let n = e.childStarts.get(t.id);
|
|
822
|
+
return n ? {
|
|
823
|
+
...t,
|
|
824
|
+
position: {
|
|
825
|
+
x: i.x + (n.x - c.x) * d,
|
|
826
|
+
y: i.y + (n.y - c.y) * f
|
|
827
|
+
},
|
|
828
|
+
width: Math.max(n.w * d, 24),
|
|
829
|
+
height: Math.max(n.h * f, 24)
|
|
830
|
+
} : t;
|
|
831
|
+
}),
|
|
832
|
+
lines: e.childLineStarts ? n.lines.map((t) => {
|
|
833
|
+
let n = e.childLineStarts.get(t.id);
|
|
834
|
+
return n ? {
|
|
835
|
+
...t,
|
|
836
|
+
points: n.map((e) => ({
|
|
837
|
+
x: i.x + (e.x - c.x) * d,
|
|
838
|
+
y: i.y + (e.y - c.y) * f
|
|
839
|
+
}))
|
|
840
|
+
} : t;
|
|
841
|
+
}) : n.lines
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
} : t;
|
|
845
|
+
});
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
if (K.current?.active) {
|
|
849
|
+
let n = K.current, r = (Math.atan2(t.y - n.cy, t.x - n.cx) - n.startPointerAngle) * 180 / Math.PI, i = ((n.startRotation + r) % 360 + 360) % 360;
|
|
850
|
+
if (e.shiftKey) i = Math.round(i / 15) * 15 % 360;
|
|
851
|
+
else {
|
|
852
|
+
let e = Math.round(i / 45) * 45;
|
|
853
|
+
Math.abs(i - e) < 4 && (i = (e % 360 + 360) % 360);
|
|
854
|
+
}
|
|
855
|
+
N((e) => {
|
|
856
|
+
let t = e.canvases[B.current];
|
|
857
|
+
return t ? {
|
|
858
|
+
...e,
|
|
859
|
+
canvases: {
|
|
860
|
+
...e.canvases,
|
|
861
|
+
[B.current]: {
|
|
862
|
+
...t,
|
|
863
|
+
nodes: t.nodes.map((e) => e.id === n.nodeId ? {
|
|
864
|
+
...e,
|
|
865
|
+
data: {
|
|
866
|
+
...e.data,
|
|
867
|
+
rotation: i
|
|
868
|
+
}
|
|
869
|
+
} : e)
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
} : e;
|
|
873
|
+
}), T.current && (T.current.style.cursor = "grabbing");
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
if (R.current?.active) {
|
|
877
|
+
let e = R.current, n = z.current.nodes, r = /* @__PURE__ */ new Map();
|
|
878
|
+
for (let e of n) r.set(e.id, e);
|
|
879
|
+
N((n) => {
|
|
880
|
+
let i = n.canvases[B.current];
|
|
881
|
+
return i ? {
|
|
882
|
+
...n,
|
|
883
|
+
canvases: {
|
|
884
|
+
...n.canvases,
|
|
885
|
+
[B.current]: {
|
|
886
|
+
...i,
|
|
887
|
+
edges: i.edges.map((n) => {
|
|
888
|
+
if (n.id !== e.edgeId) return n;
|
|
889
|
+
if (e.type === "waypoint") {
|
|
890
|
+
let r = [...n.data.waypoints ?? []];
|
|
891
|
+
return e.index < r.length && (r[e.index] = {
|
|
892
|
+
x: t.x,
|
|
893
|
+
y: t.y
|
|
894
|
+
}), {
|
|
895
|
+
...n,
|
|
896
|
+
data: {
|
|
897
|
+
...n.data,
|
|
898
|
+
waypoints: r
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
let i = _(n, r);
|
|
903
|
+
if (!i) return n;
|
|
904
|
+
let a = n.data.waypoints ?? [], o = [
|
|
905
|
+
{
|
|
906
|
+
x: i.sx,
|
|
907
|
+
y: i.sy
|
|
908
|
+
},
|
|
909
|
+
...a,
|
|
910
|
+
{
|
|
911
|
+
x: i.tx,
|
|
912
|
+
y: i.ty
|
|
913
|
+
}
|
|
914
|
+
], s = o.length - 1, c = [...n.data.bezierControls ?? []];
|
|
915
|
+
for (; c.length < s;) c.push(null);
|
|
916
|
+
let l = e.index;
|
|
917
|
+
if (l >= s) return n;
|
|
918
|
+
let u = o[l], d = o[l + 1], f = c[l], p = Math.hypot(d.x - u.x, d.y - u.y), m = Math.max(30, p * .3), h = s - 1, g = l === 0 ? u.x + i.snx * m : u.x + (d.x - u.x) * .4, v = l === 0 ? u.y + i.sny * m : u.y, ee = l === h ? d.x + i.tnx * m : d.x - (d.x - u.x) * .4, te = l === h ? d.y + i.tny * m : d.y;
|
|
919
|
+
return c[l] = e.type === "bezierC1" ? {
|
|
920
|
+
c1x: t.x,
|
|
921
|
+
c1y: t.y,
|
|
922
|
+
c2x: f?.c2x ?? ee,
|
|
923
|
+
c2y: f?.c2y ?? te
|
|
924
|
+
} : {
|
|
925
|
+
c1x: f?.c1x ?? g,
|
|
926
|
+
c1y: f?.c1y ?? v,
|
|
927
|
+
c2x: t.x,
|
|
928
|
+
c2y: t.y
|
|
929
|
+
}, {
|
|
930
|
+
...n,
|
|
931
|
+
data: {
|
|
932
|
+
...n.data,
|
|
933
|
+
bezierControls: c
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
})
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
} : n;
|
|
940
|
+
});
|
|
941
|
+
return;
|
|
942
|
+
}
|
|
943
|
+
if (X.current?.active) {
|
|
944
|
+
let e = X.current, n = t.x - e.startWorld.x, r = t.y - e.startWorld.y;
|
|
945
|
+
N((t) => {
|
|
946
|
+
let i = t.canvases[B.current];
|
|
947
|
+
return i ? {
|
|
948
|
+
...t,
|
|
949
|
+
canvases: {
|
|
950
|
+
...t.canvases,
|
|
951
|
+
[B.current]: {
|
|
952
|
+
...i,
|
|
953
|
+
lines: i.lines.map((t) => {
|
|
954
|
+
let i = e.pointStarts.get(t.id);
|
|
955
|
+
return i ? {
|
|
956
|
+
...t,
|
|
957
|
+
points: i.map((e) => ({
|
|
958
|
+
x: e.x + n,
|
|
959
|
+
y: e.y + r
|
|
960
|
+
}))
|
|
961
|
+
} : t;
|
|
962
|
+
})
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
} : t;
|
|
966
|
+
});
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
if (U.current?.active) {
|
|
970
|
+
let e = U.current, n = t.x - e.startWorld.x, r = t.y - e.startWorld.y, i = n, a = r;
|
|
971
|
+
if (Qe.current && P.current > 0 && e.nodeIds.size > 0) {
|
|
972
|
+
let t = P.current, o = e.nodeStarts.values().next().value;
|
|
973
|
+
o && (i = pe(o.x + n, t, !0) - o.x, a = pe(o.y + r, t, !0) - o.y);
|
|
974
|
+
}
|
|
975
|
+
let o = z.current.nodes, s = o.filter((t) => e.nodeIds.has(t.id)).map((t) => {
|
|
976
|
+
let n = e.nodeStarts.get(t.id);
|
|
977
|
+
return {
|
|
978
|
+
...t,
|
|
979
|
+
position: {
|
|
980
|
+
x: n.x + i,
|
|
981
|
+
y: n.y + a
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
}), c = re(s, o);
|
|
985
|
+
i += c.dx, a += c.dy, L.current = c.guides, N((t) => {
|
|
986
|
+
let n = t.canvases[B.current];
|
|
987
|
+
return n ? {
|
|
988
|
+
...t,
|
|
989
|
+
canvases: {
|
|
990
|
+
...t.canvases,
|
|
991
|
+
[B.current]: {
|
|
992
|
+
...n,
|
|
993
|
+
nodes: n.nodes.map((t) => {
|
|
994
|
+
let n = e.nodeStarts.get(t.id);
|
|
995
|
+
return n ? {
|
|
996
|
+
...t,
|
|
997
|
+
position: {
|
|
998
|
+
x: n.x + i,
|
|
999
|
+
y: n.y + a
|
|
1000
|
+
}
|
|
1001
|
+
} : t;
|
|
1002
|
+
}),
|
|
1003
|
+
lines: e.linePointStarts ? n.lines.map((t) => {
|
|
1004
|
+
let n = e.linePointStarts.get(t.id);
|
|
1005
|
+
return n ? {
|
|
1006
|
+
...t,
|
|
1007
|
+
points: n.map((e) => ({
|
|
1008
|
+
x: e.x + i,
|
|
1009
|
+
y: e.y + a
|
|
1010
|
+
}))
|
|
1011
|
+
} : t;
|
|
1012
|
+
}) : n.lines
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
} : t;
|
|
1016
|
+
});
|
|
1017
|
+
return;
|
|
1018
|
+
}
|
|
1019
|
+
if (W.current?.active && F.current) {
|
|
1020
|
+
let t = Math.min(W.current.startScreen.x, e.global.x), n = Math.min(W.current.startScreen.y, e.global.y), r = Math.abs(e.global.x - W.current.startScreen.x), i = Math.abs(e.global.y - W.current.startScreen.y);
|
|
1021
|
+
F.current.showMarquee(t, n, r, i);
|
|
1022
|
+
}
|
|
1023
|
+
if (G.current?.active && J.current) {
|
|
1024
|
+
let e = z.current.nodes.find((e) => e.id === G.current.sourceNodeId);
|
|
1025
|
+
if (e) {
|
|
1026
|
+
let n = c(e.width, e.height).find((e) => e.id === G.current.sourceHandleId);
|
|
1027
|
+
if (n) {
|
|
1028
|
+
let r = l(n, e), i = r.x, a = r.y, o = t.x, u = t.y, d = I.current;
|
|
1029
|
+
if (d && d !== G.current.sourceNodeId) {
|
|
1030
|
+
let e = z.current.nodes.find((e) => e.id === d);
|
|
1031
|
+
if (e) {
|
|
1032
|
+
let n = c(e.width, e.height), r = s(n, e, t.x, t.y, Infinity);
|
|
1033
|
+
if (r) {
|
|
1034
|
+
let t = l(r, e);
|
|
1035
|
+
o = t.x, u = t.y;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
let f = J.current;
|
|
1040
|
+
f.clear(), f.moveTo(i, a).lineTo(o, u).stroke({
|
|
1041
|
+
color: 3900150,
|
|
1042
|
+
width: 2,
|
|
1043
|
+
alpha: .6
|
|
1044
|
+
}), f.visible = !0;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
if (q.current?.active && J.current && !J.current.destroyed) {
|
|
1049
|
+
let e = q.current, n = z.current.nodes.find((t) => t.id === e.fixedNodeId);
|
|
1050
|
+
if (n) {
|
|
1051
|
+
let r = c(n.width, n.height).find((t) => t.id === e.fixedHandleId), i = r ? l(r, n) : {
|
|
1052
|
+
x: n.position.x + n.width / 2,
|
|
1053
|
+
y: n.position.y + n.height / 2
|
|
1054
|
+
}, a = i.x, o = i.y, u = t.x, d = t.y, f = I.current;
|
|
1055
|
+
if (f && f !== e.fixedNodeId) {
|
|
1056
|
+
let e = z.current.nodes.find((e) => e.id === f);
|
|
1057
|
+
if (e) {
|
|
1058
|
+
let n = c(e.width, e.height), r = s(n, e, t.x, t.y, Infinity);
|
|
1059
|
+
if (r) {
|
|
1060
|
+
let t = l(r, e);
|
|
1061
|
+
u = t.x, d = t.y;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
let p = J.current;
|
|
1066
|
+
p.clear(), p.moveTo(a, o).lineTo(u, d).stroke({
|
|
1067
|
+
color: 16347926,
|
|
1068
|
+
width: 2,
|
|
1069
|
+
alpha: .7
|
|
1070
|
+
}), p.visible = !0;
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
});
|
|
1074
|
+
let w = () => {
|
|
1075
|
+
L.current = [];
|
|
1076
|
+
try {
|
|
1077
|
+
ot.current?.clear();
|
|
1078
|
+
} catch {}
|
|
1079
|
+
try {
|
|
1080
|
+
let e = J.current;
|
|
1081
|
+
e && !e.destroyed && (e.clear(), e.visible = !1);
|
|
1082
|
+
} catch {}
|
|
1083
|
+
T.current && (T.current.style.cursor = "");
|
|
1084
|
+
};
|
|
1085
|
+
C.on("pointerup", (e) => {
|
|
1086
|
+
if (w(), K.current?.active) {
|
|
1087
|
+
K.current = null, H.current();
|
|
1088
|
+
return;
|
|
1089
|
+
}
|
|
1090
|
+
if (R.current?.active) {
|
|
1091
|
+
R.current = null;
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
if (Y.current?.active) {
|
|
1095
|
+
Y.current = null;
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
if (X.current?.active) {
|
|
1099
|
+
X.current = null;
|
|
1100
|
+
return;
|
|
1101
|
+
}
|
|
1102
|
+
if (U.current?.active && (U.current = null, H.current()), W.current?.active) {
|
|
1103
|
+
let t = Q.current(W.current.startScreen.x, W.current.startScreen.y), n = Q.current(e.global.x, e.global.y), r = Math.min(t.x, n.x), i = Math.min(t.y, n.y), a = Math.abs(n.x - t.x), o = Math.abs(n.y - t.y);
|
|
1104
|
+
if (a > 4 && o > 4) {
|
|
1105
|
+
let e = z.current.nodes.filter((e) => p(r, i, a, o, e.position.x, e.position.y, e.width, e.height)), t = z.current.lines.filter((e) => e.points.length !== 0 && e.points.every((e) => e.x >= r && e.x <= r + a && e.y >= i && e.y <= i + o));
|
|
1106
|
+
M({
|
|
1107
|
+
nodeIds: new Set(e.map((e) => e.id)),
|
|
1108
|
+
edgeIds: /* @__PURE__ */ new Set(),
|
|
1109
|
+
lineIds: new Set(t.map((e) => e.id))
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
W.current = null, F.current?.hideMarquee();
|
|
1113
|
+
}
|
|
1114
|
+
if (q.current?.active) {
|
|
1115
|
+
let t = q.current.edgeId, n = q.current.movingEnd, r = q.current.fixedNodeId;
|
|
1116
|
+
q.current = null;
|
|
1117
|
+
let i = Q.current(e.global.x, e.global.y), a = z.current.nodes, o = ue ? E(Z.current?.state.zoom ?? 1, 12, 24) : 0, l = null;
|
|
1118
|
+
for (let e = a.length - 1; e >= 0; e--) if (f(i.x, i.y, a[e], o) && a[e].id !== r) {
|
|
1119
|
+
l = a[e];
|
|
1120
|
+
break;
|
|
1121
|
+
}
|
|
1122
|
+
if (l) {
|
|
1123
|
+
let e = l.id, r = c(l.width, l.height), a = s(r, l, i.x, i.y, Infinity)?.id;
|
|
1124
|
+
N((r) => {
|
|
1125
|
+
let i = r.canvases[B.current];
|
|
1126
|
+
return i ? {
|
|
1127
|
+
...r,
|
|
1128
|
+
canvases: {
|
|
1129
|
+
...r.canvases,
|
|
1130
|
+
[B.current]: {
|
|
1131
|
+
...i,
|
|
1132
|
+
edges: i.edges.map((r) => r.id === t ? n === "source" ? {
|
|
1133
|
+
...r,
|
|
1134
|
+
source: e,
|
|
1135
|
+
sourceHandle: a
|
|
1136
|
+
} : {
|
|
1137
|
+
...r,
|
|
1138
|
+
target: e,
|
|
1139
|
+
targetHandle: a
|
|
1140
|
+
} : r)
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
} : r;
|
|
1144
|
+
});
|
|
1145
|
+
}
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
if (G.current?.active) {
|
|
1149
|
+
let t = G.current.sourceNodeId, n = G.current.sourceHandleId;
|
|
1150
|
+
G.current = null;
|
|
1151
|
+
let r = Q.current(e.global.x, e.global.y), i = z.current.nodes, a = ue ? E(Z.current?.state.zoom ?? 1, 12, 24) : 0, o = null;
|
|
1152
|
+
for (let e = i.length - 1; e >= 0; e--) if (f(r.x, r.y, i[e], a) && i[e].id !== t) {
|
|
1153
|
+
o = i[e];
|
|
1154
|
+
break;
|
|
1155
|
+
}
|
|
1156
|
+
if (o) {
|
|
1157
|
+
let e = o.id, i = c(o.width, o.height), a = s(i, o, r.x, r.y, Infinity)?.id, l = `edge_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 6)}`, u = xt.current;
|
|
1158
|
+
N((r) => {
|
|
1159
|
+
let i = r.canvases[B.current];
|
|
1160
|
+
return !i || i.edges.some((r) => r.source === t && r.target === e && r.sourceHandle === n && r.targetHandle === a) ? r : {
|
|
1161
|
+
...r,
|
|
1162
|
+
canvases: {
|
|
1163
|
+
...r.canvases,
|
|
1164
|
+
[B.current]: {
|
|
1165
|
+
...i,
|
|
1166
|
+
edges: [...i.edges, {
|
|
1167
|
+
id: l,
|
|
1168
|
+
source: t,
|
|
1169
|
+
target: e,
|
|
1170
|
+
sourceHandle: n,
|
|
1171
|
+
targetHandle: a,
|
|
1172
|
+
type: u,
|
|
1173
|
+
data: {
|
|
1174
|
+
strokeColor: "theme:base-content",
|
|
1175
|
+
strokeWidth: 2,
|
|
1176
|
+
lineStyle: "solid",
|
|
1177
|
+
markerEnd: "arrowclosed"
|
|
1178
|
+
}
|
|
1179
|
+
}]
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
}), C.on("pointerupoutside", () => {
|
|
1187
|
+
w(), U.current?.active && H.current(), K.current?.active && H.current(), U.current = null, K.current = null, Y.current = null, W.current = null, q.current = null, G.current = null, R.current = null, X.current = null, I.current = null, st.current = null, ct.current = null, F.current?.hideMarquee();
|
|
1188
|
+
});
|
|
1189
|
+
let Ce = T.current, O = null, Te = (e) => {
|
|
1190
|
+
let t = Ce.getBoundingClientRect(), n = e[0].clientX, r = e[0].clientY, i = e[1].clientX, a = e[1].clientY;
|
|
1191
|
+
return {
|
|
1192
|
+
dist: Math.hypot(i - n, a - r),
|
|
1193
|
+
midX: (n + i) / 2 - t.left,
|
|
1194
|
+
midY: (r + a) / 2 - t.top
|
|
1195
|
+
};
|
|
1196
|
+
}, Ee = () => {
|
|
1197
|
+
w(), U.current?.active && H.current(), K.current?.active && H.current(), U.current = null, K.current = null, Y.current = null, W.current = null, q.current = null, G.current = null, R.current = null, X.current = null, I.current = null, st.current = null, ct.current = null, F.current?.hideMarquee(), Z.current?.cancelPan();
|
|
1198
|
+
}, k = (e) => {
|
|
1199
|
+
if (e.touches.length < 2) return;
|
|
1200
|
+
let t = Z.current;
|
|
1201
|
+
t && (t.multiTouchActive = !0, Ee(), O = Te(e.touches), e.preventDefault());
|
|
1202
|
+
}, De = (e) => {
|
|
1203
|
+
if (!O || e.touches.length < 2) return;
|
|
1204
|
+
e.preventDefault();
|
|
1205
|
+
let t = Z.current;
|
|
1206
|
+
if (!t) return;
|
|
1207
|
+
let n = Te(e.touches), r = n.dist / Math.max(1, O.dist);
|
|
1208
|
+
Number.isFinite(r) && r > 0 && t.zoomAt(n.midX, n.midY, r), t.setState({
|
|
1209
|
+
x: t.state.x + (n.midX - O.midX),
|
|
1210
|
+
y: t.state.y + (n.midY - O.midY)
|
|
1211
|
+
}), O = n;
|
|
1212
|
+
}, A = (e) => {
|
|
1213
|
+
if (e.touches.length >= 2) {
|
|
1214
|
+
O = Te(e.touches);
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
if (O = null, e.touches.length === 0) {
|
|
1218
|
+
let e = Z.current;
|
|
1219
|
+
e && (e.multiTouchActive = !1), ft.current = performance.now() + 350;
|
|
1220
|
+
}
|
|
1221
|
+
};
|
|
1222
|
+
Ce?.addEventListener("touchstart", k, { passive: !1 }), Ce?.addEventListener("touchmove", De, { passive: !1 }), Ce?.addEventListener("touchend", A), Ce?.addEventListener("touchcancel", A), n = k, r = De, h = A, C.on("rightclick", (e) => {
|
|
1223
|
+
if (e.preventDefault?.(), Z.current?.didRightPan) return;
|
|
1224
|
+
let t = Q.current(e.global.x, e.global.y), n = z.current.nodes, r = null;
|
|
1225
|
+
for (let e = n.length - 1; e >= 0; e--) if (f(t.x, t.y, n[e])) {
|
|
1226
|
+
r = n[e].id;
|
|
1227
|
+
break;
|
|
1228
|
+
}
|
|
1229
|
+
let i = e.nativeEvent, a = i?.clientX ?? e.global.x, o = i?.clientY ?? e.global.y;
|
|
1230
|
+
Fe({
|
|
1231
|
+
x: a,
|
|
1232
|
+
y: o,
|
|
1233
|
+
nodeId: r
|
|
1234
|
+
});
|
|
1235
|
+
}), C.on("pointertap", (e) => {
|
|
1236
|
+
if (Z.current?.multiTouchActive || performance.now() < ft.current || e.button !== 0) return;
|
|
1237
|
+
let t = Date.now(), n = Q.current(e.global.x, e.global.y), r = Ct.current;
|
|
1238
|
+
if (r) {
|
|
1239
|
+
let e = d("node"), t = P.current, i = Qe.current, a = pe(n.x - r.width / 2, t, i), o = pe(n.y - r.height / 2, t, i), s = {
|
|
1240
|
+
id: "__ghost__",
|
|
1241
|
+
type: r.type,
|
|
1242
|
+
position: {
|
|
1243
|
+
x: a,
|
|
1244
|
+
y: o
|
|
1245
|
+
},
|
|
1246
|
+
width: r.width,
|
|
1247
|
+
height: r.height,
|
|
1248
|
+
data: {}
|
|
1249
|
+
}, c = re([s], z.current.nodes), l = a + c.dx, u = o + c.dy;
|
|
1250
|
+
N((t) => {
|
|
1251
|
+
let n = t.canvases[B.current];
|
|
1252
|
+
if (!n) return t;
|
|
1253
|
+
let i = {};
|
|
1254
|
+
r.type === "animAnchor" && (i.animIndex = oe(t));
|
|
1255
|
+
let a = Math.max(0, ...n.nodes.map((e) => e.zIndex ?? 0), ...n.lines.map((e) => e.zIndex ?? 0));
|
|
1256
|
+
return {
|
|
1257
|
+
...t,
|
|
1258
|
+
canvases: {
|
|
1259
|
+
...t.canvases,
|
|
1260
|
+
[B.current]: {
|
|
1261
|
+
...n,
|
|
1262
|
+
nodes: [...n.nodes, {
|
|
1263
|
+
id: e,
|
|
1264
|
+
type: r.type,
|
|
1265
|
+
position: {
|
|
1266
|
+
x: l,
|
|
1267
|
+
y: u
|
|
1268
|
+
},
|
|
1269
|
+
width: r.width,
|
|
1270
|
+
height: r.height,
|
|
1271
|
+
zIndex: a + 1,
|
|
1272
|
+
data: {
|
|
1273
|
+
...r.data,
|
|
1274
|
+
...i
|
|
1275
|
+
}
|
|
1276
|
+
}]
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
};
|
|
1280
|
+
}), M({
|
|
1281
|
+
nodeIds: /* @__PURE__ */ new Set([e]),
|
|
1282
|
+
edgeIds: /* @__PURE__ */ new Set(),
|
|
1283
|
+
lineIds: /* @__PURE__ */ new Set()
|
|
1284
|
+
}), yt.current && window.setTimeout(() => {
|
|
1285
|
+
bt.current(l, u, r.width, r.height, {
|
|
1286
|
+
padding: 80,
|
|
1287
|
+
preserveZoom: !0,
|
|
1288
|
+
duration: 280
|
|
1289
|
+
});
|
|
1290
|
+
}, 0), dt.current = {
|
|
1291
|
+
time: 0,
|
|
1292
|
+
wx: 0,
|
|
1293
|
+
wy: 0
|
|
1294
|
+
};
|
|
1295
|
+
return;
|
|
1296
|
+
}
|
|
1297
|
+
let i = dt.current, a = n.x - i.wx, o = n.y - i.wy;
|
|
1298
|
+
if (t - i.time < 400 && Math.abs(a) < 10 && Math.abs(o) < 10) {
|
|
1299
|
+
let e = z.current.nodes;
|
|
1300
|
+
for (let t = e.length - 1; t >= 0; t--) if (f(n.x, n.y, e[t])) {
|
|
1301
|
+
let n = e[t], r = n.data.childCanvasId;
|
|
1302
|
+
if (r) {
|
|
1303
|
+
Ke(r), dt.current = {
|
|
1304
|
+
time: 0,
|
|
1305
|
+
wx: 0,
|
|
1306
|
+
wy: 0
|
|
1307
|
+
};
|
|
1308
|
+
return;
|
|
1309
|
+
}
|
|
1310
|
+
Nt.current("node", n.id, n.data.label ?? ""), dt.current = {
|
|
1311
|
+
time: 0,
|
|
1312
|
+
wx: 0,
|
|
1313
|
+
wy: 0
|
|
1314
|
+
};
|
|
1315
|
+
return;
|
|
1316
|
+
}
|
|
1317
|
+
let t = z.current.edges, r = /* @__PURE__ */ new Map();
|
|
1318
|
+
for (let t of e) r.set(t.id, t);
|
|
1319
|
+
let i = Z.current?.state.zoom ?? 1;
|
|
1320
|
+
for (let e = t.length - 1; e >= 0; e--) if (be(n.x, n.y, t[e], r, E(i, 8, 12))) {
|
|
1321
|
+
Nt.current("edge", t[e].id, t[e].data.labelText ?? ""), dt.current = {
|
|
1322
|
+
time: 0,
|
|
1323
|
+
wx: 0,
|
|
1324
|
+
wy: 0
|
|
1325
|
+
};
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
dt.current = {
|
|
1330
|
+
time: t,
|
|
1331
|
+
wx: n.x,
|
|
1332
|
+
wy: n.y
|
|
1333
|
+
};
|
|
1334
|
+
});
|
|
1335
|
+
let j = !1;
|
|
1336
|
+
e.app.ticker.add((t) => {
|
|
1337
|
+
if (e.destroyed) return;
|
|
1338
|
+
let n = t.deltaMS, r = e.app.screen, i = Z.current?.state ?? {
|
|
1339
|
+
x: 0,
|
|
1340
|
+
y: 0,
|
|
1341
|
+
zoom: 1
|
|
1342
|
+
};
|
|
1343
|
+
D.current?.update(i, r.width, r.height);
|
|
1344
|
+
let a = Z.current?.isPanning ?? !1;
|
|
1345
|
+
a !== j && (j = a, T.current && (T.current.style.cursor = a ? "grabbing" : ""));
|
|
1346
|
+
let s = z.current, c = gt.current, l = ae(_t.current), u = /* @__PURE__ */ new Map();
|
|
1347
|
+
l.forEach((e, t) => u.set(e.node.id, t + 1)), $e.current?.advanceAnimation(n);
|
|
1348
|
+
let d = V.current ? l[V.current.current] : void 0;
|
|
1349
|
+
$e.current?.sync(s.nodes, c.nodeIds, I.current, u, {
|
|
1350
|
+
showAnchors: St.current,
|
|
1351
|
+
presentation: V.current !== null,
|
|
1352
|
+
presentationAnchorId: d?.node.id,
|
|
1353
|
+
presentationAnchorVisible: V.current?.showAnchor ?? !1
|
|
1354
|
+
});
|
|
1355
|
+
let f = /* @__PURE__ */ new Map();
|
|
1356
|
+
for (let e of s.nodes) f.set(e.id, e);
|
|
1357
|
+
et.current?.advanceAnimation(n), et.current?.sync(s.edges, f, c.edgeIds, null, { presentation: V.current !== null }), tt.current?.advanceAnimation(n), tt.current?.sync(s.lines, c.lineIds), ot.current?.update(L.current, r.width, r.height, i);
|
|
1358
|
+
let p = Xe.current;
|
|
1359
|
+
if (p) {
|
|
1360
|
+
let e = (c.nodeIds.size > 0 || c.edgeIds.size > 0 || c.lineIds.size > 0) && !Ze.current && !V.current && !Ct.current, t = !e;
|
|
1361
|
+
if (e) {
|
|
1362
|
+
let e = Infinity, n = Infinity, a = -Infinity, o = -Infinity, l = (t, r, i, s) => {
|
|
1363
|
+
e = Math.min(e, t), n = Math.min(n, r), a = Math.max(a, t + i), o = Math.max(o, r + s);
|
|
1364
|
+
};
|
|
1365
|
+
for (let e of s.nodes) c.nodeIds.has(e.id) && l(e.position.x, e.position.y, e.width, e.height);
|
|
1366
|
+
for (let e of s.edges) {
|
|
1367
|
+
if (!c.edgeIds.has(e.id)) continue;
|
|
1368
|
+
let t = f.get(e.source), n = f.get(e.target);
|
|
1369
|
+
t && l(t.position.x, t.position.y, t.width, t.height), n && l(n.position.x, n.position.y, n.width, n.height);
|
|
1370
|
+
}
|
|
1371
|
+
for (let e of s.lines) if (c.lineIds.has(e.id)) for (let t of e.points) l(t.x, t.y, 0, 0);
|
|
1372
|
+
if (e === Infinity) t = !0;
|
|
1373
|
+
else {
|
|
1374
|
+
let e = i.zoom, t = a * e + i.x + 8, o = n * e + i.y - 30 - 6;
|
|
1375
|
+
t + 66 > r.width - 6 && (t = Math.max(6, r.width - 66 - 6)), o < 6 && (o = n * e + i.y + 6), o + 30 > r.height - 6 && (o = Math.max(6, r.height - 30 - 6)), p.style.display = "flex", p.style.left = `${Math.round(t)}px`, p.style.top = `${Math.round(o)}px`;
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
t && p.style.display !== "none" && (p.style.display = "none");
|
|
1379
|
+
}
|
|
1380
|
+
let m = at.current;
|
|
1381
|
+
if (m) {
|
|
1382
|
+
m.clear();
|
|
1383
|
+
let e = st.current;
|
|
1384
|
+
e && (m.circle(e.wx, e.wy, 10).fill({
|
|
1385
|
+
color: 3900150,
|
|
1386
|
+
alpha: .12
|
|
1387
|
+
}).stroke({
|
|
1388
|
+
color: 3900150,
|
|
1389
|
+
width: 1.5,
|
|
1390
|
+
alpha: .5
|
|
1391
|
+
}), m.circle(e.wx, e.wy, 4).fill({
|
|
1392
|
+
color: 3900150,
|
|
1393
|
+
alpha: .9
|
|
1394
|
+
}));
|
|
1395
|
+
let t = ct.current;
|
|
1396
|
+
t && !e && (m.circle(t.worldX, t.worldY, 10).fill({
|
|
1397
|
+
color: 16347926,
|
|
1398
|
+
alpha: .12
|
|
1399
|
+
}).stroke({
|
|
1400
|
+
color: 16347926,
|
|
1401
|
+
width: 1.5,
|
|
1402
|
+
alpha: .5
|
|
1403
|
+
}), m.circle(t.worldX, t.worldY, 4).fill({
|
|
1404
|
+
color: 16347926,
|
|
1405
|
+
alpha: .9
|
|
1406
|
+
}));
|
|
1407
|
+
}
|
|
1408
|
+
let h = pt.current;
|
|
1409
|
+
if (h) {
|
|
1410
|
+
h.clear();
|
|
1411
|
+
let e = Ct.current;
|
|
1412
|
+
if (e) {
|
|
1413
|
+
let t = mt.current, n = P.current, r = Qe.current, i = pe(t.x - e.width / 2, n, r), a = pe(t.y - e.height / 2, n, r), c = {
|
|
1414
|
+
id: "__ghost__",
|
|
1415
|
+
type: e.type,
|
|
1416
|
+
position: {
|
|
1417
|
+
x: i,
|
|
1418
|
+
y: a
|
|
1419
|
+
},
|
|
1420
|
+
width: e.width,
|
|
1421
|
+
height: e.height,
|
|
1422
|
+
data: {}
|
|
1423
|
+
}, l = re([c], s.nodes);
|
|
1424
|
+
L.current = l.guides, h.position.set(i + l.dx, a + l.dy), (o[e.type] ?? o.shapeRect)(h, {
|
|
1425
|
+
width: e.width,
|
|
1426
|
+
height: e.height,
|
|
1427
|
+
fill: "#3b82f6",
|
|
1428
|
+
stroke: "#3b82f6",
|
|
1429
|
+
strokeWidth: 1.5,
|
|
1430
|
+
borderStyle: e.data.borderStyle
|
|
1431
|
+
});
|
|
1432
|
+
} else h.position.set(0, 0), !U.current?.active && !Y.current?.active && (L.current = []);
|
|
1433
|
+
}
|
|
1434
|
+
let g = lt.current;
|
|
1435
|
+
if (g && (g.clear(), c.edgeIds.size > 0 && vt.current === "select")) {
|
|
1436
|
+
let e = 1 / i.zoom;
|
|
1437
|
+
for (let t of s.edges) {
|
|
1438
|
+
if (!c.edgeIds.has(t.id)) continue;
|
|
1439
|
+
let n = _(t, f);
|
|
1440
|
+
n && (g.circle(n.sx, n.sy, 5 * e).fill({ color: 16777215 }).stroke({
|
|
1441
|
+
color: 16347926,
|
|
1442
|
+
width: 1.5 * e
|
|
1443
|
+
}), g.circle(n.tx, n.ty, 5 * e).fill({ color: 16777215 }).stroke({
|
|
1444
|
+
color: 16347926,
|
|
1445
|
+
width: 1.5 * e
|
|
1446
|
+
}));
|
|
1447
|
+
let r = t.data.waypoints;
|
|
1448
|
+
if (r) for (let t of r) g.circle(t.x, t.y, 5 * e).fill({ color: 16777215 }).stroke({
|
|
1449
|
+
color: 3900150,
|
|
1450
|
+
width: 1.5 * e
|
|
1451
|
+
});
|
|
1452
|
+
if (t.type === "simplebezier") {
|
|
1453
|
+
let n = _(t, f);
|
|
1454
|
+
if (!n) continue;
|
|
1455
|
+
let i = r ?? [], a = [
|
|
1456
|
+
{
|
|
1457
|
+
x: n.sx,
|
|
1458
|
+
y: n.sy
|
|
1459
|
+
},
|
|
1460
|
+
...i,
|
|
1461
|
+
{
|
|
1462
|
+
x: n.tx,
|
|
1463
|
+
y: n.ty
|
|
1464
|
+
}
|
|
1465
|
+
], o = t.data.bezierControls, s = a.length - 2;
|
|
1466
|
+
for (let t = 0; t <= s; t++) {
|
|
1467
|
+
let r = a[t], i = a[t + 1], c = o?.[t], l = Math.hypot(i.x - r.x, i.y - r.y), u = Math.max(30, l * .3), d = c?.c1x ?? (t === 0 ? r.x + n.snx * u : r.x + (i.x - r.x) * .4), f = c?.c1y ?? (t === 0 ? r.y + n.sny * u : r.y), p = c?.c2x ?? (t === s ? i.x + n.tnx * u : i.x - (i.x - r.x) * .4), m = c?.c2y ?? (t === s ? i.y + n.tny * u : i.y);
|
|
1468
|
+
g.moveTo(r.x, r.y).lineTo(d, f).stroke({
|
|
1469
|
+
color: 10265519,
|
|
1470
|
+
width: 1 * e
|
|
1471
|
+
}), g.moveTo(i.x, i.y).lineTo(p, m).stroke({
|
|
1472
|
+
color: 10265519,
|
|
1473
|
+
width: 1 * e
|
|
1474
|
+
});
|
|
1475
|
+
let h = 4 * e;
|
|
1476
|
+
g.circle(d, f, h).fill({ color: 16777215 }).stroke({
|
|
1477
|
+
color: 3900150,
|
|
1478
|
+
width: 1.5 * e
|
|
1479
|
+
}), g.circle(p, m, h).fill({ color: 16777215 }).stroke({
|
|
1480
|
+
color: 3900150,
|
|
1481
|
+
width: 1.5 * e
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
let v = it.current;
|
|
1488
|
+
if (v && (v.clear(), c.nodeIds.size === 1 && vt.current === "select")) {
|
|
1489
|
+
let e = [...c.nodeIds][0], t = s.nodes.find((t) => t.id === e);
|
|
1490
|
+
if (t) {
|
|
1491
|
+
let e = i.zoom, n = t.position.x * e + i.x, r = t.position.y * e + i.y, a = t.width * e, o = t.height * e;
|
|
1492
|
+
v.rect(n, r, a, o).stroke({
|
|
1493
|
+
color: 3900150,
|
|
1494
|
+
width: 1.5
|
|
1495
|
+
});
|
|
1496
|
+
let s = 7 / 2, c = [
|
|
1497
|
+
[n, r],
|
|
1498
|
+
[n + a, r],
|
|
1499
|
+
[n + a, r + o],
|
|
1500
|
+
[n, r + o]
|
|
1501
|
+
];
|
|
1502
|
+
for (let [e, t] of c) v.rect(e - s, t - s, 7, 7).fill({ color: 16777215 }).stroke({
|
|
1503
|
+
color: 3900150,
|
|
1504
|
+
width: 1.5
|
|
1505
|
+
});
|
|
1506
|
+
let l = [
|
|
1507
|
+
[n + a / 2, r],
|
|
1508
|
+
[n + a, r + o / 2],
|
|
1509
|
+
[n + a / 2, r + o],
|
|
1510
|
+
[n, r + o / 2]
|
|
1511
|
+
];
|
|
1512
|
+
for (let [e, t] of l) v.circle(e, t, 4).fill({
|
|
1513
|
+
color: 3900150,
|
|
1514
|
+
alpha: .9
|
|
1515
|
+
});
|
|
1516
|
+
if (!Ze.current) {
|
|
1517
|
+
let e = n + a / 2, t = r - de;
|
|
1518
|
+
v.moveTo(e, r).lineTo(e, t).stroke({
|
|
1519
|
+
color: 3900150,
|
|
1520
|
+
width: 1.5,
|
|
1521
|
+
alpha: .85
|
|
1522
|
+
}), v.circle(e, t, 6).fill({ color: 16777215 }).stroke({
|
|
1523
|
+
color: 3900150,
|
|
1524
|
+
width: 1.5
|
|
1525
|
+
}), v.circle(e, t, 2.5).fill({ color: 3900150 });
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
});
|
|
1530
|
+
};
|
|
1531
|
+
return g(), () => {
|
|
1532
|
+
if (t = !0, e && !e.destroyed) try {
|
|
1533
|
+
e.app.stage.removeAllListeners();
|
|
1534
|
+
} catch {}
|
|
1535
|
+
let i = T.current;
|
|
1536
|
+
n && i?.removeEventListener("touchstart", n), r && i?.removeEventListener("touchmove", r), h && (i?.removeEventListener("touchend", h), i?.removeEventListener("touchcancel", h));
|
|
1537
|
+
let a = (e) => {
|
|
1538
|
+
try {
|
|
1539
|
+
e?.destroy();
|
|
1540
|
+
} catch {}
|
|
1541
|
+
};
|
|
1542
|
+
a(D.current), a(F.current), a($e.current), a(et.current), a(tt.current), a(nt.current), a(rt.current), a(J.current), a(it.current), it.current = null, a(at.current), at.current = null, a(lt.current), lt.current = null, a(pt.current), pt.current = null, a(ot.current);
|
|
1543
|
+
};
|
|
1544
|
+
}, [O.current]), b(() => {
|
|
1545
|
+
let e = nt.current, t = rt.current;
|
|
1546
|
+
if (e && t) switch (e.deactivate(), t.deactivate(), j) {
|
|
1547
|
+
case "freehand":
|
|
1548
|
+
e.activate();
|
|
1549
|
+
break;
|
|
1550
|
+
case "line":
|
|
1551
|
+
t.activate("straight");
|
|
1552
|
+
break;
|
|
1553
|
+
case "polyline":
|
|
1554
|
+
t.activate("polyline");
|
|
1555
|
+
break;
|
|
1556
|
+
case "arrow": t.activate("arrow");
|
|
1557
|
+
}
|
|
1558
|
+
}, [j]), b(() => {
|
|
1559
|
+
D.current && (D.current.visible = Oe, D.current.gridSize = ke);
|
|
1560
|
+
}, [Oe, ke]), b(() => {
|
|
1561
|
+
let e = T.current;
|
|
1562
|
+
if (!e) return;
|
|
1563
|
+
let t = (t) => {
|
|
1564
|
+
t.preventDefault();
|
|
1565
|
+
let n = Z.current;
|
|
1566
|
+
if (!n) return;
|
|
1567
|
+
let r = e.getBoundingClientRect(), i = t.clientX - r.left, a = t.clientY - r.top, o = t.ctrlKey ? 3 : 1, s = -t.deltaY * .001 * o;
|
|
1568
|
+
n.zoomAt(i, a, 1 + s);
|
|
1569
|
+
};
|
|
1570
|
+
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
1571
|
+
}, [Z]), /* @__PURE__ */ w("div", {
|
|
1572
|
+
style: {
|
|
1573
|
+
position: "relative",
|
|
1574
|
+
width: "100%",
|
|
1575
|
+
height: "100%"
|
|
1576
|
+
},
|
|
1577
|
+
children: [
|
|
1578
|
+
/* @__PURE__ */ C("div", {
|
|
1579
|
+
ref: T,
|
|
1580
|
+
className: "flow-canvas-wrapper",
|
|
1581
|
+
tabIndex: -1,
|
|
1582
|
+
onContextMenu: (e) => e.preventDefault()
|
|
1583
|
+
}),
|
|
1584
|
+
$ && At && /* @__PURE__ */ C("input", {
|
|
1585
|
+
className: "flow-label-editor",
|
|
1586
|
+
autoFocus: !0,
|
|
1587
|
+
defaultValue: $.value,
|
|
1588
|
+
style: {
|
|
1589
|
+
left: At.x,
|
|
1590
|
+
top: At.y
|
|
1591
|
+
},
|
|
1592
|
+
onFocus: (e) => e.currentTarget.select(),
|
|
1593
|
+
onKeyDown: (e) => {
|
|
1594
|
+
e.key === "Enter" ? (e.preventDefault(), Pt(e.target.value)) : e.key === "Escape" && (e.preventDefault(), Ft()), e.stopPropagation();
|
|
1595
|
+
},
|
|
1596
|
+
onBlur: (e) => Pt(e.target.value),
|
|
1597
|
+
onPointerDown: (e) => e.stopPropagation()
|
|
1598
|
+
}),
|
|
1599
|
+
Ne && !Re && /* @__PURE__ */ w("button", {
|
|
1600
|
+
type: "button",
|
|
1601
|
+
className: "flow-esc-button",
|
|
1602
|
+
onClick: () => Pe(null),
|
|
1603
|
+
title: "取消连续放置 (Esc)",
|
|
1604
|
+
children: [/* @__PURE__ */ C("span", {
|
|
1605
|
+
"aria-hidden": !0,
|
|
1606
|
+
children: "⎋"
|
|
1607
|
+
}), " 取消放置 (ESC)"]
|
|
1608
|
+
}),
|
|
1609
|
+
/* @__PURE__ */ w("button", {
|
|
1610
|
+
ref: Xe,
|
|
1611
|
+
type: "button",
|
|
1612
|
+
className: "flow-delete-button",
|
|
1613
|
+
style: { display: "none" },
|
|
1614
|
+
onClick: () => Ye.current(),
|
|
1615
|
+
title: "删除所选 (Delete)",
|
|
1616
|
+
"aria-label": "删除所选",
|
|
1617
|
+
children: [/* @__PURE__ */ w("svg", {
|
|
1618
|
+
width: "12",
|
|
1619
|
+
height: "12",
|
|
1620
|
+
viewBox: "0 0 24 24",
|
|
1621
|
+
fill: "none",
|
|
1622
|
+
stroke: "currentColor",
|
|
1623
|
+
strokeWidth: "2.5",
|
|
1624
|
+
strokeLinecap: "round",
|
|
1625
|
+
strokeLinejoin: "round",
|
|
1626
|
+
"aria-hidden": !0,
|
|
1627
|
+
children: [
|
|
1628
|
+
/* @__PURE__ */ C("path", { d: "M3 6h18" }),
|
|
1629
|
+
/* @__PURE__ */ C("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }),
|
|
1630
|
+
/* @__PURE__ */ C("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
|
|
1631
|
+
]
|
|
1632
|
+
}), "删除"]
|
|
1633
|
+
})
|
|
1634
|
+
]
|
|
1635
|
+
});
|
|
1671
1636
|
}
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
};
|
|
1637
|
+
//#endregion
|
|
1638
|
+
export { D as default };
|
|
1675
1639
|
|
|
1676
1640
|
//# sourceMappingURL=FlowCanvas.js.map
|