dishui 0.0.65 → 0.0.67
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/Accordion/index.d.ts +39 -0
- package/dist/components/Accordion/index.js +70 -0
- package/dist/components/Accordion/index.js.map +1 -0
- package/dist/components/Avatar/index.d.ts +48 -0
- package/dist/components/Avatar/index.js +71 -0
- package/dist/components/Avatar/index.js.map +1 -0
- 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 +142 -0
- package/dist/components/Card/index.js +368 -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 +26 -0
- package/dist/components/Icon/index.js +27 -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.d.ts +1 -1
- 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/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 +31 -3
- package/dist/index.js +106 -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 +700 -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
- package/dist/components/StatCard/index.d.ts +0 -24
- package/dist/components/StatCard/index.js +0 -90
- package/dist/components/StatCard/index.js.map +0 -1
|
@@ -1,968 +1,940 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { DEFAULT_NODE_DATA as
|
|
4
|
-
import { FlowProvider as
|
|
5
|
-
import { FlowUIProvider as
|
|
6
|
-
import { FlowAIProvider as
|
|
7
|
-
import { generateId as
|
|
8
|
-
import { normalizeEdgeHandles as
|
|
9
|
-
import { useDeleteSelection as
|
|
10
|
-
import
|
|
11
|
-
import { downloadDataURL as
|
|
12
|
-
import
|
|
13
|
-
import { MediaStampContent as
|
|
14
|
-
import { InspectorPanelContent as
|
|
15
|
-
import { OutlinePanelContent as
|
|
16
|
-
import { AIPanelContent as
|
|
17
|
-
import { PresentationMode as
|
|
18
|
-
import { MediaOverlay as
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import { MiniMapRenderer as
|
|
23
|
-
import { useUndoRedo as
|
|
24
|
-
import { useClipboard as
|
|
25
|
-
import { useCompactMode as
|
|
26
|
-
import { usePdfExport as
|
|
27
|
-
import { useKeyboardShortcuts as
|
|
28
|
-
import { useMindMap as
|
|
1
|
+
import e from "../../Select/index.js";
|
|
2
|
+
import t from "../CodeEditor/editors/CodeEditor.js";
|
|
3
|
+
import { DEFAULT_NODE_DATA as n, ROOT_CANVAS_ID as r, createEmptyDocument as i } from "./constants.js";
|
|
4
|
+
import { FlowProvider as a, useFlowContext as o } from "./context/FlowContext.js";
|
|
5
|
+
import { FlowUIProvider as s, useFlowUI as c } from "./context/FlowUIContext.js";
|
|
6
|
+
import { FlowAIProvider as l } from "./context/FlowAIContext.js";
|
|
7
|
+
import { generateId as u } from "./nodes/nodeUtils.js";
|
|
8
|
+
import { normalizeEdgeHandles as d } from "./edges/edgePaths.js";
|
|
9
|
+
import { useDeleteSelection as f } from "./hooks/useDeleteSelection.js";
|
|
10
|
+
import p from "./FlowCanvas.js";
|
|
11
|
+
import { downloadDataURL as m, safeFileBaseName as h } from "./hooks/useFlowImportExport.js";
|
|
12
|
+
import g, { FlowZoomControls as _ } from "./panels/FlowToolbar.js";
|
|
13
|
+
import { MediaStampContent as v, ShapePaletteContent as y, SvgStampContent as b } from "./panels/ShapePalette.js";
|
|
14
|
+
import { InspectorPanelContent as x } from "./panels/InspectorPanel.js";
|
|
15
|
+
import { OutlinePanelContent as S } from "./panels/OutlinePanel.js";
|
|
16
|
+
import { AIPanelContent as C } from "./panels/AIPanel.js";
|
|
17
|
+
import { PresentationMode as w } from "./panels/PresentationMode.js";
|
|
18
|
+
import { MediaOverlay as T } from "./nodes/MediaOverlay.js";
|
|
19
|
+
import E from "./panels/FlowPanelGroup.js";
|
|
20
|
+
import D from "./panels/Breadcrumb.js";
|
|
21
|
+
import O from "./panels/ContextMenu.js";
|
|
22
|
+
import { MiniMapRenderer as k } from "./canvas/MiniMapRenderer.js";
|
|
23
|
+
import { useUndoRedo as ee } from "./hooks/useUndoRedo.js";
|
|
24
|
+
import { useClipboard as A } from "./hooks/useClipboard.js";
|
|
25
|
+
import { useCompactMode as te } from "./hooks/useCompactMode.js";
|
|
26
|
+
import { usePdfExport as j } from "./hooks/usePdfExport.js";
|
|
27
|
+
import { useKeyboardShortcuts as M } from "./hooks/useKeyboardShortcuts.js";
|
|
28
|
+
import { useMindMap as N } from "./hooks/useMindMap.js";
|
|
29
29
|
/* empty css */
|
|
30
|
-
import { forwardRef as
|
|
31
|
-
import { jsx as
|
|
32
|
-
import { EditorView as
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
...o,
|
|
82
|
-
canvases: r
|
|
83
|
-
} : o;
|
|
30
|
+
import { forwardRef as P, useCallback as F, useEffect as I, useImperativeHandle as ne, useMemo as L, useRef as R, useState as z } from "react";
|
|
31
|
+
import { jsx as B, jsxs as V } from "react/jsx-runtime";
|
|
32
|
+
import { EditorView as H } from "@codemirror/view";
|
|
33
|
+
//#region src/components/pro/Flow/Flow.tsx
|
|
34
|
+
function re(e) {
|
|
35
|
+
let t = !1, n = { ...e.canvases };
|
|
36
|
+
for (let [e, r] of Object.entries(n)) {
|
|
37
|
+
let i = r.nodes.map((e) => {
|
|
38
|
+
if (e.type !== "shapeSvg") return e;
|
|
39
|
+
let n = e.data.labelPlacement, r = n === "above" ? "top" : n === "center" ? "middle" : n === "below" ? "bottom" : e.data.labelPlacement;
|
|
40
|
+
return r === e.data.labelPlacement ? e : (t = !0, {
|
|
41
|
+
...e,
|
|
42
|
+
data: {
|
|
43
|
+
...e.data,
|
|
44
|
+
labelPlacement: r
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}), a = !1, o = i.map((e) => {
|
|
48
|
+
if (!e.data.isMindMapNode) return e;
|
|
49
|
+
let t = e.data.fill === "#ffffff" || e.data.fill === "#eef2ff" ? "theme:base-100" : e.data.fill, n = e.data.stroke === "#6366f1" ? "theme:base-content" : e.data.stroke === "#4f46e5" ? "theme:primary" : e.data.stroke;
|
|
50
|
+
return t === e.data.fill && n === e.data.stroke ? e : (a = !0, {
|
|
51
|
+
...e,
|
|
52
|
+
data: {
|
|
53
|
+
...e.data,
|
|
54
|
+
fill: t,
|
|
55
|
+
stroke: n
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}), s = /* @__PURE__ */ new Map();
|
|
59
|
+
for (let e of o) s.set(e.id, e);
|
|
60
|
+
let c = !1, l = d(r.edges, s).map((e) => {
|
|
61
|
+
if (e.data.strokeColor !== "#94a3b8") return e;
|
|
62
|
+
let t = s.get(e.source), n = s.get(e.target);
|
|
63
|
+
return !t?.data.isMindMapNode || !n?.data.isMindMapNode ? e : (c = !0, {
|
|
64
|
+
...e,
|
|
65
|
+
data: {
|
|
66
|
+
...e.data,
|
|
67
|
+
strokeColor: "theme:base-content"
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
(a || c) && (t = !0), (o !== i || l !== r.edges) && (n[e] = {
|
|
72
|
+
...r,
|
|
73
|
+
nodes: o,
|
|
74
|
+
edges: l
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return t ? {
|
|
78
|
+
...e,
|
|
79
|
+
canvases: n
|
|
80
|
+
} : e;
|
|
84
81
|
}
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
var ie = {
|
|
83
|
+
nodeIds: /* @__PURE__ */ new Set(),
|
|
84
|
+
edgeIds: /* @__PURE__ */ new Set(),
|
|
85
|
+
lineIds: /* @__PURE__ */ new Set()
|
|
89
86
|
};
|
|
90
|
-
function
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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
|
-
P
|
|
344
|
-
]);
|
|
345
|
-
return Je(A), Oe(), null;
|
|
87
|
+
function ae({ onUndo: e, onRedo: t, groupRef: r, geoGroupRef: i, ungroupRef: a }) {
|
|
88
|
+
let { selection: s, setSelection: l, currentCanvas: d, setDoc: p, currentCanvasId: m } = o(), { viewport: h } = c(), { copy: g, cut: _, paste: v, duplicate: y } = A(), b = f(), x = F(() => {
|
|
89
|
+
l({
|
|
90
|
+
nodeIds: new Set(d.nodes.map((e) => e.id)),
|
|
91
|
+
edgeIds: new Set(d.edges.map((e) => e.id)),
|
|
92
|
+
lineIds: new Set(d.lines.map((e) => e.id))
|
|
93
|
+
});
|
|
94
|
+
}, [d, l]), S = F((e) => {
|
|
95
|
+
let t = s.nodeIds, r = s.lineIds;
|
|
96
|
+
if (t.size + r.size < 2) return;
|
|
97
|
+
let i = d.nodes.filter((e) => t.has(e.id)), a = d.lines.filter((e) => r.has(e.id)), o = Infinity, c = Infinity, f = -Infinity, h = -Infinity;
|
|
98
|
+
for (let e of i) o = Math.min(o, e.position.x), c = Math.min(c, e.position.y), f = Math.max(f, e.position.x + e.width), h = Math.max(h, e.position.y + e.height);
|
|
99
|
+
for (let e of a) for (let t of e.points) o = Math.min(o, t.x), c = Math.min(c, t.y), f = Math.max(f, t.x), h = Math.max(h, t.y);
|
|
100
|
+
let g = e === "geometryGroup", _ = u("group"), v = {
|
|
101
|
+
id: _,
|
|
102
|
+
type: e,
|
|
103
|
+
position: {
|
|
104
|
+
x: o - 20,
|
|
105
|
+
y: c - 20
|
|
106
|
+
},
|
|
107
|
+
width: f - o + 40,
|
|
108
|
+
height: h - c + 40,
|
|
109
|
+
data: {
|
|
110
|
+
...n,
|
|
111
|
+
label: g ? "Geo Group" : "Group",
|
|
112
|
+
fill: g ? "#fefce8" : "#f0f9ff",
|
|
113
|
+
stroke: "#9ca3af",
|
|
114
|
+
strokeWidth: 1.5,
|
|
115
|
+
borderStyle: g ? "dashed" : "dotted",
|
|
116
|
+
isGroup: !0
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
p((e) => {
|
|
120
|
+
let n = e.canvases[m];
|
|
121
|
+
return n ? {
|
|
122
|
+
...e,
|
|
123
|
+
canvases: {
|
|
124
|
+
...e.canvases,
|
|
125
|
+
[m]: {
|
|
126
|
+
...n,
|
|
127
|
+
nodes: g ? [v, ...n.nodes] : [v, ...n.nodes.map((e) => t.has(e.id) ? {
|
|
128
|
+
...e,
|
|
129
|
+
parentId: _
|
|
130
|
+
} : e)],
|
|
131
|
+
lines: g ? n.lines : n.lines.map((e) => r.has(e.id) ? {
|
|
132
|
+
...e,
|
|
133
|
+
parentId: _
|
|
134
|
+
} : e)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
} : e;
|
|
138
|
+
}), l({
|
|
139
|
+
nodeIds: /* @__PURE__ */ new Set([_]),
|
|
140
|
+
edgeIds: /* @__PURE__ */ new Set(),
|
|
141
|
+
lineIds: /* @__PURE__ */ new Set()
|
|
142
|
+
});
|
|
143
|
+
}, [
|
|
144
|
+
s,
|
|
145
|
+
d,
|
|
146
|
+
p,
|
|
147
|
+
m,
|
|
148
|
+
l
|
|
149
|
+
]), C = F(() => S("flowGroup"), [S]), w = F(() => S("geometryGroup"), [S]), T = F(() => {
|
|
150
|
+
let e = s.nodeIds;
|
|
151
|
+
if (e.size === 0) return;
|
|
152
|
+
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
153
|
+
for (let n of d.nodes) e.has(n.id) && (n.type === "flowGroup" || n.type === "geometryGroup" || n.data.isGroup) && t.add(n.id);
|
|
154
|
+
if (t.size !== 0) {
|
|
155
|
+
for (let e of d.nodes) e.parentId && t.has(e.parentId) && n.add(e.id);
|
|
156
|
+
for (let e of d.lines) e.parentId && t.has(e.parentId) && r.add(e.id);
|
|
157
|
+
p((e) => {
|
|
158
|
+
let i = e.canvases[m];
|
|
159
|
+
return i ? {
|
|
160
|
+
...e,
|
|
161
|
+
canvases: {
|
|
162
|
+
...e.canvases,
|
|
163
|
+
[m]: {
|
|
164
|
+
...i,
|
|
165
|
+
nodes: i.nodes.filter((e) => !t.has(e.id)).map((e) => n.has(e.id) ? {
|
|
166
|
+
...e,
|
|
167
|
+
parentId: void 0
|
|
168
|
+
} : e),
|
|
169
|
+
lines: i.lines.map((e) => r.has(e.id) ? {
|
|
170
|
+
...e,
|
|
171
|
+
parentId: void 0
|
|
172
|
+
} : e)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
} : e;
|
|
176
|
+
}), l({
|
|
177
|
+
nodeIds: n,
|
|
178
|
+
edgeIds: /* @__PURE__ */ new Set(),
|
|
179
|
+
lineIds: r
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}, [
|
|
183
|
+
s,
|
|
184
|
+
d,
|
|
185
|
+
p,
|
|
186
|
+
m,
|
|
187
|
+
l
|
|
188
|
+
]);
|
|
189
|
+
r.current = C, i.current = w, a.current = T;
|
|
190
|
+
let E = F((e) => {
|
|
191
|
+
let t = s.nodeIds, n = s.lineIds;
|
|
192
|
+
(t.size !== 0 || n.size !== 0) && p((r) => {
|
|
193
|
+
let i = r.canvases[m];
|
|
194
|
+
if (!i) return r;
|
|
195
|
+
let a = i.nodes.map((e) => e.zIndex ?? 0), o = a.length > 0 ? Math.max(...a) : 0, s = a.length > 0 ? Math.min(...a) : 0, c = i.lines.map((e) => e.zIndex ?? 0), l = c.length > 0 ? Math.max(...c) : 0, u = c.length > 0 ? Math.min(...c) : 0, d = (t, n, r) => e === "front" ? n + 1 : e === "back" ? r - 1 : e === "up" ? t + 1 : t - 1;
|
|
196
|
+
return {
|
|
197
|
+
...r,
|
|
198
|
+
canvases: {
|
|
199
|
+
...r.canvases,
|
|
200
|
+
[m]: {
|
|
201
|
+
...i,
|
|
202
|
+
nodes: i.nodes.map((e) => t.has(e.id) ? {
|
|
203
|
+
...e,
|
|
204
|
+
zIndex: d(e.zIndex ?? 0, o, s)
|
|
205
|
+
} : e),
|
|
206
|
+
lines: i.lines.map((e) => n.has(e.id) ? {
|
|
207
|
+
...e,
|
|
208
|
+
zIndex: d(e.zIndex ?? 0, l, u)
|
|
209
|
+
} : e)
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
}, [
|
|
215
|
+
s,
|
|
216
|
+
p,
|
|
217
|
+
m
|
|
218
|
+
]);
|
|
219
|
+
I(() => {
|
|
220
|
+
let e = (e) => {
|
|
221
|
+
let t = e.target;
|
|
222
|
+
if (t?.tagName === "INPUT" || t?.tagName === "TEXTAREA" || t?.isContentEditable) return;
|
|
223
|
+
let r = Array.from(e.clipboardData?.items ?? []).find((e) => e.type.startsWith("image/"));
|
|
224
|
+
if (!r) {
|
|
225
|
+
e.preventDefault(), v();
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
let i = r.getAsFile();
|
|
229
|
+
if (!i) return;
|
|
230
|
+
e.preventDefault();
|
|
231
|
+
let a = new FileReader();
|
|
232
|
+
a.onload = () => {
|
|
233
|
+
if (typeof a.result != "string") return;
|
|
234
|
+
let e = s.nodeIds.size === 1 ? d.nodes.find((e) => s.nodeIds.has(e.id) && e.type === "mediaNode" && e.data.mediaKind === "image") : void 0;
|
|
235
|
+
if (e) {
|
|
236
|
+
p((t) => {
|
|
237
|
+
let n = t.canvases[m];
|
|
238
|
+
return n ? {
|
|
239
|
+
...t,
|
|
240
|
+
canvases: {
|
|
241
|
+
...t.canvases,
|
|
242
|
+
[m]: {
|
|
243
|
+
...n,
|
|
244
|
+
nodes: n.nodes.map((t) => t.id === e.id ? {
|
|
245
|
+
...t,
|
|
246
|
+
data: {
|
|
247
|
+
...t.data,
|
|
248
|
+
mediaContent: a.result
|
|
249
|
+
}
|
|
250
|
+
} : t)
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
} : t;
|
|
254
|
+
});
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
let t = u("node"), r = window.innerWidth, o = window.innerHeight, c = (r / 2 - h.x) / h.zoom, f = (o / 2 - h.y) / h.zoom, g = Math.max(0, ...d.nodes.map((e) => e.zIndex ?? 0)), _ = {
|
|
258
|
+
id: t,
|
|
259
|
+
type: "mediaNode",
|
|
260
|
+
position: {
|
|
261
|
+
x: c - 160,
|
|
262
|
+
y: f - 110
|
|
263
|
+
},
|
|
264
|
+
width: 320,
|
|
265
|
+
height: 220,
|
|
266
|
+
zIndex: g + 1,
|
|
267
|
+
data: {
|
|
268
|
+
...n,
|
|
269
|
+
label: i.name || "Image",
|
|
270
|
+
fill: "theme:base-100",
|
|
271
|
+
stroke: "theme:base-content",
|
|
272
|
+
strokeWidth: 1.5,
|
|
273
|
+
color: "theme:base-content",
|
|
274
|
+
fontSize: 13,
|
|
275
|
+
borderStyle: "solid",
|
|
276
|
+
mediaKind: "image",
|
|
277
|
+
mediaContent: a.result
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
p((e) => {
|
|
281
|
+
let t = e.canvases[m];
|
|
282
|
+
return t ? {
|
|
283
|
+
...e,
|
|
284
|
+
canvases: {
|
|
285
|
+
...e.canvases,
|
|
286
|
+
[m]: {
|
|
287
|
+
...t,
|
|
288
|
+
nodes: [...t.nodes, _]
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
} : e;
|
|
292
|
+
}), l({
|
|
293
|
+
nodeIds: /* @__PURE__ */ new Set([t]),
|
|
294
|
+
edgeIds: /* @__PURE__ */ new Set(),
|
|
295
|
+
lineIds: /* @__PURE__ */ new Set()
|
|
296
|
+
});
|
|
297
|
+
}, a.readAsDataURL(i);
|
|
298
|
+
};
|
|
299
|
+
return window.addEventListener("paste", e), () => window.removeEventListener("paste", e);
|
|
300
|
+
}, [
|
|
301
|
+
d,
|
|
302
|
+
m,
|
|
303
|
+
v,
|
|
304
|
+
s,
|
|
305
|
+
p,
|
|
306
|
+
l,
|
|
307
|
+
h
|
|
308
|
+
]);
|
|
309
|
+
let D = L(() => ({
|
|
310
|
+
undo: e,
|
|
311
|
+
redo: t,
|
|
312
|
+
copy: g,
|
|
313
|
+
cut: _,
|
|
314
|
+
paste: v,
|
|
315
|
+
duplicate: y,
|
|
316
|
+
deleteSelected: b,
|
|
317
|
+
selectAll: x,
|
|
318
|
+
group: C,
|
|
319
|
+
geoGroup: w,
|
|
320
|
+
ungroup: T,
|
|
321
|
+
bringToFront: () => E("front"),
|
|
322
|
+
bringForward: () => E("up"),
|
|
323
|
+
sendBackward: () => E("down"),
|
|
324
|
+
sendToBack: () => E("back")
|
|
325
|
+
}), [
|
|
326
|
+
e,
|
|
327
|
+
t,
|
|
328
|
+
g,
|
|
329
|
+
_,
|
|
330
|
+
v,
|
|
331
|
+
y,
|
|
332
|
+
b,
|
|
333
|
+
x,
|
|
334
|
+
C,
|
|
335
|
+
w,
|
|
336
|
+
T,
|
|
337
|
+
E
|
|
338
|
+
]);
|
|
339
|
+
return M(D), N(), null;
|
|
346
340
|
}
|
|
347
|
-
function
|
|
348
|
-
|
|
341
|
+
function oe({ pixiRef: e, exportPdfRef: t }) {
|
|
342
|
+
return t.current = j(e), null;
|
|
349
343
|
}
|
|
350
|
-
var
|
|
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
|
-
});
|
|
344
|
+
var U = P(function({ initialDocument: e, onChange: t, width: n, height: r, readOnly: o = !1, onBack: c, onExportPNG: u, onPublish: d, showMiniMap: f = !0, showGrid: v = !0, gridSize: y = 20, className: b, showAI: x = !0, showAIConfig: S = !0, aiConfig: C }, E) {
|
|
345
|
+
let [O, A] = z(() => re(e ?? i())), [j, M] = z(ie), N = R(null), P = R(null), L = R(null), H = R(null), U = te(H), { wrappedSetDoc: W, undo: G, redo: K, canUndo: q, canRedo: J } = ee(O, A), Y = R(null), X = R(null), Z = R(null), Q = R(null), de = R(t);
|
|
346
|
+
de.current = t;
|
|
347
|
+
let $ = R(O);
|
|
348
|
+
$.current = O, ne(E, () => ({
|
|
349
|
+
exportPNG: async (e) => {
|
|
350
|
+
let t = N.current;
|
|
351
|
+
return !t || t.destroyed ? null : t.exportPNG(e);
|
|
352
|
+
},
|
|
353
|
+
getDocument: () => $.current
|
|
354
|
+
}), []);
|
|
355
|
+
let fe = F((e) => {
|
|
356
|
+
W((t) => {
|
|
357
|
+
let n = typeof e == "function" ? e(t) : e;
|
|
358
|
+
return o ? n.canvases === t.canvases && n.title === t.title ? n : t : (queueMicrotask(() => de.current?.(n)), n);
|
|
359
|
+
});
|
|
360
|
+
}, [W, o]), pe = F(() => {
|
|
361
|
+
o || G();
|
|
362
|
+
}, [o, G]), me = F(() => {
|
|
363
|
+
o || K();
|
|
364
|
+
}, [o, K]), he = F((e) => {
|
|
365
|
+
N.current = e, P.current && !L.current && (L.current = new k(P.current));
|
|
366
|
+
}, []), ge = F(async () => {
|
|
367
|
+
if (u) return void u();
|
|
368
|
+
let e = N.current;
|
|
369
|
+
if (!e || e.destroyed) return;
|
|
370
|
+
let t = await e.exportPNG(16777215);
|
|
371
|
+
t && m(t, `${h($.current.title)}.png`);
|
|
372
|
+
}, [u]), _e = F(async () => {
|
|
373
|
+
await Q.current?.();
|
|
374
|
+
}, []);
|
|
375
|
+
I(() => {
|
|
376
|
+
let e = !1, t = null, n = () => {
|
|
377
|
+
let e = N.current, t = L.current;
|
|
378
|
+
if (!e || e.destroyed || !t) return;
|
|
379
|
+
let n = {
|
|
380
|
+
x: e.world.position.x,
|
|
381
|
+
y: e.world.position.y,
|
|
382
|
+
zoom: e.world.scale.x
|
|
383
|
+
}, r = O.stack[O.stack.length - 1] ?? "root", i = O.canvases[r];
|
|
384
|
+
i && t.update(i.nodes, n, e.app.screen.width, e.app.screen.height);
|
|
385
|
+
}, r = () => {
|
|
386
|
+
if (e) return;
|
|
387
|
+
let i = N.current;
|
|
388
|
+
i && !i.destroyed && L.current ? (i.app.ticker.add(n), t = i) : requestAnimationFrame(r);
|
|
389
|
+
};
|
|
390
|
+
return r(), () => {
|
|
391
|
+
e = !0, t && !t.destroyed && t.app.ticker.remove(n);
|
|
392
|
+
};
|
|
393
|
+
}, [O]);
|
|
394
|
+
let ve = {
|
|
395
|
+
width: n ?? "100%",
|
|
396
|
+
height: r ?? "100%"
|
|
397
|
+
};
|
|
398
|
+
return /* @__PURE__ */ B("div", {
|
|
399
|
+
ref: H,
|
|
400
|
+
className: `flow-container ${b ?? ""}`,
|
|
401
|
+
style: ve,
|
|
402
|
+
children: /* @__PURE__ */ B(a, {
|
|
403
|
+
doc: O,
|
|
404
|
+
setDoc: fe,
|
|
405
|
+
selection: j,
|
|
406
|
+
setSelection: M,
|
|
407
|
+
children: /* @__PURE__ */ B(s, {
|
|
408
|
+
showMiniMap: f,
|
|
409
|
+
showGrid: v,
|
|
410
|
+
gridSize: y,
|
|
411
|
+
showAI: x,
|
|
412
|
+
readOnly: o,
|
|
413
|
+
children: /* @__PURE__ */ V(l, {
|
|
414
|
+
initialConfig: C,
|
|
415
|
+
showAIConfig: S,
|
|
416
|
+
children: [
|
|
417
|
+
/* @__PURE__ */ B(ae, {
|
|
418
|
+
onUndo: pe,
|
|
419
|
+
onRedo: me,
|
|
420
|
+
groupRef: Y,
|
|
421
|
+
geoGroupRef: X,
|
|
422
|
+
ungroupRef: Z
|
|
423
|
+
}),
|
|
424
|
+
/* @__PURE__ */ B(oe, {
|
|
425
|
+
pixiRef: N,
|
|
426
|
+
exportPdfRef: Q
|
|
427
|
+
}),
|
|
428
|
+
/* @__PURE__ */ V(ce, {
|
|
429
|
+
compact: U,
|
|
430
|
+
toolbar: o ? null : /* @__PURE__ */ B(g, {
|
|
431
|
+
compact: U,
|
|
432
|
+
onBack: c,
|
|
433
|
+
onUndo: pe,
|
|
434
|
+
onRedo: me,
|
|
435
|
+
canUndo: q,
|
|
436
|
+
canRedo: J,
|
|
437
|
+
onGroup: () => Y.current?.(),
|
|
438
|
+
onGeoGroup: () => X.current?.(),
|
|
439
|
+
onUngroup: () => Z.current?.(),
|
|
440
|
+
onExportPNG: ge,
|
|
441
|
+
onExportPDF: _e,
|
|
442
|
+
onPublish: d
|
|
443
|
+
}),
|
|
444
|
+
children: [
|
|
445
|
+
/* @__PURE__ */ B(p, { onPixiReady: he }),
|
|
446
|
+
/* @__PURE__ */ B(T, {}),
|
|
447
|
+
/* @__PURE__ */ V(se, { children: [!o && /* @__PURE__ */ B(_, {}), /* @__PURE__ */ B(D, {})] }),
|
|
448
|
+
!o && /* @__PURE__ */ B(ue, {}),
|
|
449
|
+
/* @__PURE__ */ B(le, {
|
|
450
|
+
canvasRef: P,
|
|
451
|
+
pixiRef: N,
|
|
452
|
+
miniMapRef: L
|
|
453
|
+
}),
|
|
454
|
+
/* @__PURE__ */ B(w, {})
|
|
455
|
+
]
|
|
456
|
+
})
|
|
457
|
+
]
|
|
458
|
+
})
|
|
459
|
+
})
|
|
460
|
+
})
|
|
461
|
+
});
|
|
469
462
|
});
|
|
470
|
-
function
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
463
|
+
function se({ children: e }) {
|
|
464
|
+
let { presentation: t } = c();
|
|
465
|
+
return /* @__PURE__ */ B("div", {
|
|
466
|
+
className: "flow-overlay",
|
|
467
|
+
style: { display: t ? "none" : void 0 },
|
|
468
|
+
children: e
|
|
469
|
+
});
|
|
477
470
|
}
|
|
478
|
-
var
|
|
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
|
-
|
|
471
|
+
var W = [
|
|
472
|
+
{
|
|
473
|
+
id: "shapes",
|
|
474
|
+
label: "Shapes",
|
|
475
|
+
icon: "▢",
|
|
476
|
+
showKey: "showPalette"
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
id: "icons",
|
|
480
|
+
label: "Icons",
|
|
481
|
+
icon: "★",
|
|
482
|
+
showKey: "showPalette"
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
id: "media",
|
|
486
|
+
label: "Media",
|
|
487
|
+
icon: "▶",
|
|
488
|
+
showKey: "showPalette"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
id: "inspector",
|
|
492
|
+
label: "Inspector",
|
|
493
|
+
icon: "⚙",
|
|
494
|
+
showKey: "showInspector"
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
id: "outline",
|
|
498
|
+
label: "Outline",
|
|
499
|
+
icon: "☰",
|
|
500
|
+
showKey: "showOutline"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
id: "json",
|
|
504
|
+
label: "JSON",
|
|
505
|
+
icon: "{ }",
|
|
506
|
+
showKey: "showJson"
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
id: "ai",
|
|
510
|
+
label: "AI",
|
|
511
|
+
icon: "✨",
|
|
512
|
+
showKey: "showAI"
|
|
513
|
+
}
|
|
521
514
|
];
|
|
522
|
-
function
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
return /* @__PURE__ */ i(Te, {});
|
|
534
|
-
case "json":
|
|
535
|
-
return /* @__PURE__ */ i(it, {});
|
|
536
|
-
case "ai":
|
|
537
|
-
return /* @__PURE__ */ i(Re, {});
|
|
538
|
-
default:
|
|
539
|
-
return null;
|
|
540
|
-
}
|
|
515
|
+
function G(e) {
|
|
516
|
+
switch (e) {
|
|
517
|
+
case "shapes": return /* @__PURE__ */ B(y, {});
|
|
518
|
+
case "icons": return /* @__PURE__ */ B(b, {});
|
|
519
|
+
case "media": return /* @__PURE__ */ B(v, {});
|
|
520
|
+
case "inspector": return /* @__PURE__ */ B(x, {});
|
|
521
|
+
case "outline": return /* @__PURE__ */ B(S, {});
|
|
522
|
+
case "json": return /* @__PURE__ */ B(X, {});
|
|
523
|
+
case "ai": return /* @__PURE__ */ B(C, {});
|
|
524
|
+
default: return null;
|
|
525
|
+
}
|
|
541
526
|
}
|
|
542
|
-
var
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
527
|
+
var K = /* @__PURE__ */ new Set([
|
|
528
|
+
"shapes",
|
|
529
|
+
"icons",
|
|
530
|
+
"media"
|
|
546
531
|
]);
|
|
547
|
-
function
|
|
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
|
-
|
|
532
|
+
function ce({ children: t, toolbar: n, compact: r }) {
|
|
533
|
+
let i = c(), { panelDocks: a, setPanelDock: o, presentation: s, readOnly: l, setPendingPlacement: u } = i, { setShowPalette: d, setShowInspector: f, setShowOutline: p, setShowJson: m, setShowAI: h } = i, g = l ? [] : W.filter((e) => !e.showKey || i[e.showKey]), _ = (e) => ({
|
|
534
|
+
id: e.id,
|
|
535
|
+
label: e.label,
|
|
536
|
+
icon: e.icon,
|
|
537
|
+
content: G(e.id)
|
|
538
|
+
}), [v, y] = z(null), b = R(null);
|
|
539
|
+
I(() => {
|
|
540
|
+
if (!r) {
|
|
541
|
+
b.current = null;
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
let e = i.pendingPlacement, t = e ? `${e.type}:${e.data?.svgId ?? ""}:${e.data?.mediaKind ?? ""}` : null, n = b.current;
|
|
545
|
+
b.current = t, t && t !== n && v && K.has(v) && y(null);
|
|
546
|
+
}, [
|
|
547
|
+
i.pendingPlacement,
|
|
548
|
+
r,
|
|
549
|
+
v
|
|
550
|
+
]);
|
|
551
|
+
let [x, S] = z(null), C = F((e, t) => o(e, t), [o]), w = F((e) => {
|
|
552
|
+
e === "inspector" ? f(!1) : e === "outline" ? p(!1) : e === "json" ? m(!1) : e === "ai" ? h(!1) : d(!1);
|
|
553
|
+
}, [
|
|
554
|
+
f,
|
|
555
|
+
p,
|
|
556
|
+
m,
|
|
557
|
+
h,
|
|
558
|
+
d
|
|
559
|
+
]);
|
|
560
|
+
if (r && !s) {
|
|
561
|
+
let r = g.find((e) => e.id === v) ?? null;
|
|
562
|
+
return /* @__PURE__ */ V("div", {
|
|
563
|
+
className: "flow-workspace",
|
|
564
|
+
children: [
|
|
565
|
+
n,
|
|
566
|
+
g.length > 0 && /* @__PURE__ */ B("div", {
|
|
567
|
+
className: "flow-mobile-panel-bar",
|
|
568
|
+
children: /* @__PURE__ */ B(e, {
|
|
569
|
+
placeholder: "选择面板…",
|
|
570
|
+
options: g.map((e) => ({
|
|
571
|
+
value: e.id,
|
|
572
|
+
label: e.label
|
|
573
|
+
})),
|
|
574
|
+
value: v ?? void 0,
|
|
575
|
+
onChange: (e) => {
|
|
576
|
+
u(null), y(String(e));
|
|
577
|
+
}
|
|
578
|
+
})
|
|
579
|
+
}),
|
|
580
|
+
/* @__PURE__ */ V("div", {
|
|
581
|
+
className: "flow-workspace-main",
|
|
582
|
+
children: [/* @__PURE__ */ B("div", {
|
|
583
|
+
className: "flow-stage",
|
|
584
|
+
children: t
|
|
585
|
+
}), r && /* @__PURE__ */ V("div", {
|
|
586
|
+
className: "flow-mobile-panel",
|
|
587
|
+
children: [/* @__PURE__ */ V("div", {
|
|
588
|
+
className: "flow-mobile-panel-header",
|
|
589
|
+
children: [/* @__PURE__ */ V("span", {
|
|
590
|
+
className: "flow-mobile-panel-title",
|
|
591
|
+
children: [r.icon && /* @__PURE__ */ B("span", {
|
|
592
|
+
className: "flow-panel-tab-icon",
|
|
593
|
+
children: r.icon
|
|
594
|
+
}), r.label]
|
|
595
|
+
}), /* @__PURE__ */ B("button", {
|
|
596
|
+
type: "button",
|
|
597
|
+
className: "flow-mobile-panel-close",
|
|
598
|
+
"aria-label": "关闭面板",
|
|
599
|
+
onClick: () => y(null),
|
|
600
|
+
children: "✕"
|
|
601
|
+
})]
|
|
602
|
+
}), /* @__PURE__ */ B("div", {
|
|
603
|
+
className: "flow-mobile-panel-body",
|
|
604
|
+
children: G(r.id)
|
|
605
|
+
})]
|
|
606
|
+
})]
|
|
607
|
+
})
|
|
608
|
+
]
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
let T = (e) => a[e] ?? "left", D = g.filter((e) => T(e.id) === "left").map(_), O = g.filter((e) => T(e.id) === "right").map(_), k = g.filter((e) => T(e.id) === "float");
|
|
612
|
+
return /* @__PURE__ */ V("div", {
|
|
613
|
+
className: "flow-workspace",
|
|
614
|
+
children: [!s && n, /* @__PURE__ */ V("div", {
|
|
615
|
+
className: "flow-workspace-main",
|
|
616
|
+
children: [
|
|
617
|
+
!s && D.length > 0 && /* @__PURE__ */ B(E, {
|
|
618
|
+
tabs: D,
|
|
619
|
+
defaultTab: D[0]?.id,
|
|
620
|
+
resizeEdge: "right",
|
|
621
|
+
defaultWidth: 220,
|
|
622
|
+
dock: "left",
|
|
623
|
+
onDock: C,
|
|
624
|
+
onClose: w
|
|
625
|
+
}),
|
|
626
|
+
/* @__PURE__ */ B("div", {
|
|
627
|
+
className: "flow-stage",
|
|
628
|
+
children: t
|
|
629
|
+
}),
|
|
630
|
+
!s && O.length > 0 && /* @__PURE__ */ B(E, {
|
|
631
|
+
tabs: O,
|
|
632
|
+
defaultTab: O[0]?.id,
|
|
633
|
+
resizeEdge: "left",
|
|
634
|
+
defaultWidth: 220,
|
|
635
|
+
dock: "right",
|
|
636
|
+
onDock: C,
|
|
637
|
+
onClose: w
|
|
638
|
+
}),
|
|
639
|
+
!s && k.map((e, t) => /* @__PURE__ */ B(E, {
|
|
640
|
+
tabs: [_(e)],
|
|
641
|
+
resizeEdge: "right",
|
|
642
|
+
defaultWidth: 220,
|
|
643
|
+
dock: "float",
|
|
644
|
+
style: {
|
|
645
|
+
top: 48 + t * 40,
|
|
646
|
+
left: 24 + t * 30
|
|
647
|
+
},
|
|
648
|
+
onDock: C,
|
|
649
|
+
onClose: w,
|
|
650
|
+
onDragHintChange: S
|
|
651
|
+
}, e.id)),
|
|
652
|
+
!s && x && /* @__PURE__ */ B("div", {
|
|
653
|
+
className: `flow-dock-dropzone flow-dock-dropzone--${x}`,
|
|
654
|
+
children: /* @__PURE__ */ B("span", { children: x === "left" ? "⇤ 停靠左侧" : "停靠右侧 ⇥" })
|
|
655
|
+
})
|
|
656
|
+
]
|
|
657
|
+
})]
|
|
658
|
+
});
|
|
674
659
|
}
|
|
675
|
-
function
|
|
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
|
-
});
|
|
660
|
+
function le({ canvasRef: e, pixiRef: t, miniMapRef: n }) {
|
|
661
|
+
let { showMiniMap: r, setViewport: i, presentation: a } = c(), o = R(!1), s = F((r, a) => {
|
|
662
|
+
let o = e.current, s = t.current, c = n.current;
|
|
663
|
+
if (!o || !s || s.destroyed || !c) return;
|
|
664
|
+
let l = o.getBoundingClientRect();
|
|
665
|
+
if (l.width === 0 || l.height === 0) return;
|
|
666
|
+
let { width: u, height: d } = c.size, f = (r - l.left) / l.width * u, p = (a - l.top) / l.height * d, m = c.minimapToWorld(f, p);
|
|
667
|
+
if (!m) return;
|
|
668
|
+
let h = s.world.scale.x || 1, g = s.app.screen.width, _ = s.app.screen.height;
|
|
669
|
+
i({
|
|
670
|
+
x: g / 2 - m.x * h,
|
|
671
|
+
y: _ / 2 - m.y * h,
|
|
672
|
+
zoom: h
|
|
673
|
+
});
|
|
674
|
+
}, [
|
|
675
|
+
e,
|
|
676
|
+
t,
|
|
677
|
+
n,
|
|
678
|
+
i
|
|
679
|
+
]), l = F((e) => {
|
|
680
|
+
e.preventDefault(), e.currentTarget.setPointerCapture(e.pointerId), o.current = !0, s(e.clientX, e.clientY);
|
|
681
|
+
}, [s]), u = F((e) => {
|
|
682
|
+
o.current && s(e.clientX, e.clientY);
|
|
683
|
+
}, [s]), d = F((e) => {
|
|
684
|
+
o.current = !1;
|
|
685
|
+
try {
|
|
686
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
687
|
+
} catch {}
|
|
688
|
+
}, []);
|
|
689
|
+
return /* @__PURE__ */ B("div", {
|
|
690
|
+
className: "flow-minimap",
|
|
691
|
+
style: {
|
|
692
|
+
display: r && !a ? void 0 : "none",
|
|
693
|
+
cursor: "pointer"
|
|
694
|
+
},
|
|
695
|
+
onPointerDown: l,
|
|
696
|
+
onPointerMove: u,
|
|
697
|
+
onPointerUp: d,
|
|
698
|
+
title: "点击或拖动以移动画布",
|
|
699
|
+
children: /* @__PURE__ */ B("canvas", {
|
|
700
|
+
ref: e,
|
|
701
|
+
width: 180,
|
|
702
|
+
height: 120,
|
|
703
|
+
style: {
|
|
704
|
+
width: "100%",
|
|
705
|
+
height: "100%",
|
|
706
|
+
pointerEvents: "none"
|
|
707
|
+
}
|
|
708
|
+
})
|
|
709
|
+
});
|
|
726
710
|
}
|
|
727
|
-
function
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
`).length,
|
|
750
|
-
endLine: o.slice(0, a + 1).split(`
|
|
751
|
-
`).length
|
|
752
|
-
};
|
|
711
|
+
function q(e, t) {
|
|
712
|
+
let n = `"id": "${t}"`, r = e.indexOf(n);
|
|
713
|
+
if (r === -1) return null;
|
|
714
|
+
let i = 0, a = -1;
|
|
715
|
+
for (let t = r; t >= 0; t--) if (e[t] === "}" && i++, e[t] === "{") {
|
|
716
|
+
if (i === 0) {
|
|
717
|
+
a = t;
|
|
718
|
+
break;
|
|
719
|
+
}
|
|
720
|
+
i--;
|
|
721
|
+
}
|
|
722
|
+
if (a === -1) return null;
|
|
723
|
+
i = 0;
|
|
724
|
+
let o = -1;
|
|
725
|
+
for (let t = a; t < e.length; t++) if (e[t] === "{" && i++, e[t] === "}" && (i--, i === 0)) {
|
|
726
|
+
o = t;
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
return o === -1 ? null : {
|
|
730
|
+
startLine: e.slice(0, a).split("\n").length,
|
|
731
|
+
endLine: e.slice(0, o + 1).split("\n").length
|
|
732
|
+
};
|
|
753
733
|
}
|
|
754
|
-
function
|
|
755
|
-
|
|
734
|
+
function J(e) {
|
|
735
|
+
e.querySelectorAll(".cm-line.flow-json-hl").forEach((e) => e.classList.remove("flow-json-hl"));
|
|
756
736
|
}
|
|
757
|
-
function
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
} catch {
|
|
764
|
-
}
|
|
737
|
+
function Y(e, t, n) {
|
|
738
|
+
let r = e.getView();
|
|
739
|
+
if (r) for (let e = t; e <= n; e++) try {
|
|
740
|
+
let t = r.state.doc.line(e), n = r.domAtPos(t.from), i = n.node instanceof HTMLElement ? n.node.closest(".cm-line") : n.node.parentElement?.closest(".cm-line");
|
|
741
|
+
i && i.classList.add("flow-json-hl");
|
|
742
|
+
} catch {}
|
|
765
743
|
}
|
|
766
|
-
function
|
|
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
|
-
});
|
|
744
|
+
function X() {
|
|
745
|
+
let { setDoc: e, currentCanvasId: n, selection: r, currentCanvas: i } = o(), [a, s] = z(""), [c, l] = z(null), u = R(!1), d = R(null), f = R(null), p = L(() => r.nodeIds.size + r.edgeIds.size + r.lineIds.size === 1 ? r.nodeIds.size === 1 ? [...r.nodeIds][0] : r.edgeIds.size === 1 ? [...r.edgeIds][0] : r.lineIds.size === 1 ? [...r.lineIds][0] : null : null, [r]);
|
|
746
|
+
I(() => {
|
|
747
|
+
if (u.current) {
|
|
748
|
+
u.current = !1;
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
s(JSON.stringify(i, null, 2)), l(null);
|
|
752
|
+
}, [i]), I(() => {
|
|
753
|
+
let e = f.current;
|
|
754
|
+
if (e && J(e), !p) return;
|
|
755
|
+
let t = setTimeout(() => {
|
|
756
|
+
let e = q(a, p);
|
|
757
|
+
if (!e || !f.current) return;
|
|
758
|
+
let t = d.current?.getView();
|
|
759
|
+
if (!t) return;
|
|
760
|
+
let n = f.current, r = t.scrollDOM;
|
|
761
|
+
r.style.scrollBehavior = "smooth";
|
|
762
|
+
let i = t.state.doc.line(e.startLine);
|
|
763
|
+
t.dispatch({ effects: H.scrollIntoView(i.from, {
|
|
764
|
+
y: "start",
|
|
765
|
+
yMargin: 0
|
|
766
|
+
}) });
|
|
767
|
+
let o = () => {
|
|
768
|
+
r.style.scrollBehavior = "", J(n), Y(d.current, e.startLine, e.endLine);
|
|
769
|
+
}, s, c = () => {
|
|
770
|
+
clearTimeout(s), s = setTimeout(o, 100);
|
|
771
|
+
};
|
|
772
|
+
r.addEventListener("scroll", c), s = setTimeout(() => {
|
|
773
|
+
r.removeEventListener("scroll", c), o();
|
|
774
|
+
}, 800);
|
|
775
|
+
}, 120);
|
|
776
|
+
return () => clearTimeout(t);
|
|
777
|
+
}, [p, a]);
|
|
778
|
+
let m = F((t) => {
|
|
779
|
+
s(t);
|
|
780
|
+
try {
|
|
781
|
+
let r = JSON.parse(t);
|
|
782
|
+
r && Array.isArray(r.nodes) && Array.isArray(r.edges) && Array.isArray(r.lines) ? (l(null), u.current = !0, e((e) => ({
|
|
783
|
+
...e,
|
|
784
|
+
canvases: {
|
|
785
|
+
...e.canvases,
|
|
786
|
+
[n]: r
|
|
787
|
+
}
|
|
788
|
+
}))) : l("JSON must have nodes, edges, lines arrays");
|
|
789
|
+
} catch (e) {
|
|
790
|
+
l(e.message?.slice(0, 60) ?? "Invalid JSON");
|
|
791
|
+
}
|
|
792
|
+
}, [e, n]), h = p ? r.nodeIds.has(p) ? "Node" : r.edgeIds.has(p) ? "Edge" : "Line" : null;
|
|
793
|
+
return /* @__PURE__ */ V("div", {
|
|
794
|
+
style: {
|
|
795
|
+
display: "flex",
|
|
796
|
+
flexDirection: "column",
|
|
797
|
+
height: "100%",
|
|
798
|
+
minHeight: 0
|
|
799
|
+
},
|
|
800
|
+
children: [
|
|
801
|
+
/* @__PURE__ */ B("div", {
|
|
802
|
+
className: "flow-json-header",
|
|
803
|
+
children: /* @__PURE__ */ B("span", {
|
|
804
|
+
className: "flow-json-scope",
|
|
805
|
+
children: h ? `${h}: ${p.slice(0, 8)}` : "Canvas"
|
|
806
|
+
})
|
|
807
|
+
}),
|
|
808
|
+
c && /* @__PURE__ */ B("div", {
|
|
809
|
+
style: {
|
|
810
|
+
fontSize: 11,
|
|
811
|
+
color: "oklch(var(--er))",
|
|
812
|
+
padding: "4px 0",
|
|
813
|
+
flexShrink: 0
|
|
814
|
+
},
|
|
815
|
+
children: c
|
|
816
|
+
}),
|
|
817
|
+
/* @__PURE__ */ B("div", {
|
|
818
|
+
ref: f,
|
|
819
|
+
style: {
|
|
820
|
+
flex: 1,
|
|
821
|
+
minHeight: 0
|
|
822
|
+
},
|
|
823
|
+
children: /* @__PURE__ */ B(t, {
|
|
824
|
+
ref: d,
|
|
825
|
+
value: a,
|
|
826
|
+
onChange: m,
|
|
827
|
+
language: "json",
|
|
828
|
+
lineNumbers: !1,
|
|
829
|
+
height: "100%",
|
|
830
|
+
highlightActiveLine: !1
|
|
831
|
+
})
|
|
832
|
+
})
|
|
833
|
+
]
|
|
834
|
+
});
|
|
859
835
|
}
|
|
860
|
-
function
|
|
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
|
-
items: I,
|
|
954
|
-
onClose: () => u(null)
|
|
955
|
-
});
|
|
836
|
+
function ue() {
|
|
837
|
+
let { contextMenu: e, setContextMenu: t } = c(), { doc: n, setDoc: i, currentCanvasId: a, pushCanvas: s, setSelection: l } = o(), { duplicate: d } = A();
|
|
838
|
+
if (!e) return null;
|
|
839
|
+
let f = n.canvases[a];
|
|
840
|
+
if (!f) return t(null), null;
|
|
841
|
+
let p = e.nodeId ? f.nodes.find((t) => t.id === e.nodeId) : null, m = [];
|
|
842
|
+
return p && (m.push({
|
|
843
|
+
label: "Duplicate",
|
|
844
|
+
icon: "⧉",
|
|
845
|
+
action: () => {
|
|
846
|
+
d(24, 24, { nodeIds: /* @__PURE__ */ new Set([p.id]) });
|
|
847
|
+
}
|
|
848
|
+
}), m.push({
|
|
849
|
+
label: "---",
|
|
850
|
+
action: () => {}
|
|
851
|
+
}), p.data.childCanvasId ? (m.push({
|
|
852
|
+
label: "Enter Sub-canvas",
|
|
853
|
+
icon: "↓",
|
|
854
|
+
action: () => {
|
|
855
|
+
s(p.data.childCanvasId), l({
|
|
856
|
+
nodeIds: /* @__PURE__ */ new Set(),
|
|
857
|
+
edgeIds: /* @__PURE__ */ new Set(),
|
|
858
|
+
lineIds: /* @__PURE__ */ new Set()
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
}), m.push({
|
|
862
|
+
label: "---",
|
|
863
|
+
action: () => {}
|
|
864
|
+
}), m.push({
|
|
865
|
+
label: "Delete Sub-canvas",
|
|
866
|
+
icon: "🗑",
|
|
867
|
+
danger: !0,
|
|
868
|
+
action: () => {
|
|
869
|
+
let e = p.data.childCanvasId;
|
|
870
|
+
i((t) => {
|
|
871
|
+
let n = { ...t.canvases };
|
|
872
|
+
Z(n, e);
|
|
873
|
+
let i = n[a];
|
|
874
|
+
if (!i) return t;
|
|
875
|
+
n[a] = {
|
|
876
|
+
...i,
|
|
877
|
+
nodes: i.nodes.map((e) => e.id === p.id ? {
|
|
878
|
+
...e,
|
|
879
|
+
data: {
|
|
880
|
+
...e.data,
|
|
881
|
+
childCanvasId: void 0
|
|
882
|
+
}
|
|
883
|
+
} : e)
|
|
884
|
+
};
|
|
885
|
+
let o = t.stack.filter((e) => n[e]);
|
|
886
|
+
return o.length === 0 && o.push(r), {
|
|
887
|
+
...t,
|
|
888
|
+
canvases: n,
|
|
889
|
+
stack: o
|
|
890
|
+
};
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
})) : m.push({
|
|
894
|
+
label: "Create Sub-canvas",
|
|
895
|
+
icon: "⊞",
|
|
896
|
+
action: () => {
|
|
897
|
+
let e = u("canvas");
|
|
898
|
+
i((t) => {
|
|
899
|
+
let n = t.canvases[a];
|
|
900
|
+
return n ? {
|
|
901
|
+
...t,
|
|
902
|
+
canvases: {
|
|
903
|
+
...t.canvases,
|
|
904
|
+
[a]: {
|
|
905
|
+
...n,
|
|
906
|
+
nodes: n.nodes.map((t) => t.id === p.id ? {
|
|
907
|
+
...t,
|
|
908
|
+
data: {
|
|
909
|
+
...t.data,
|
|
910
|
+
childCanvasId: e
|
|
911
|
+
}
|
|
912
|
+
} : t)
|
|
913
|
+
},
|
|
914
|
+
[e]: {
|
|
915
|
+
nodes: [],
|
|
916
|
+
edges: [],
|
|
917
|
+
lines: []
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
} : t;
|
|
921
|
+
}), s(e);
|
|
922
|
+
}
|
|
923
|
+
})), m.length === 0 ? null : /* @__PURE__ */ B(O, {
|
|
924
|
+
x: e.x,
|
|
925
|
+
y: e.y,
|
|
926
|
+
items: m,
|
|
927
|
+
onClose: () => t(null)
|
|
928
|
+
});
|
|
956
929
|
}
|
|
957
|
-
function
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
930
|
+
function Z(e, t) {
|
|
931
|
+
let n = e[t];
|
|
932
|
+
if (n) {
|
|
933
|
+
for (let t of n.nodes) t.data.childCanvasId && Z(e, t.data.childCanvasId);
|
|
934
|
+
delete e[t];
|
|
935
|
+
}
|
|
963
936
|
}
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
};
|
|
937
|
+
//#endregion
|
|
938
|
+
export { U as default };
|
|
967
939
|
|
|
968
940
|
//# sourceMappingURL=Flow.js.map
|