@yh-ui/flow 0.1.21
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/LICENSE +21 -0
- package/README.md +234 -0
- package/dist/Flow.d.vue.ts +306 -0
- package/dist/Flow.vue +959 -0
- package/dist/Flow.vue.d.ts +306 -0
- package/dist/__tests__/ai-workflow.ssr.test.cjs +352 -0
- package/dist/__tests__/ai-workflow.ssr.test.d.ts +1 -0
- package/dist/__tests__/ai-workflow.ssr.test.mjs +283 -0
- package/dist/__tests__/ai-workflow.test.cjs +109 -0
- package/dist/__tests__/ai-workflow.test.d.ts +1 -0
- package/dist/__tests__/ai-workflow.test.mjs +112 -0
- package/dist/__tests__/bpmn.ssr.test.cjs +278 -0
- package/dist/__tests__/bpmn.ssr.test.d.ts +1 -0
- package/dist/__tests__/bpmn.ssr.test.mjs +237 -0
- package/dist/__tests__/bpmn.test.cjs +103 -0
- package/dist/__tests__/bpmn.test.d.ts +1 -0
- package/dist/__tests__/bpmn.test.mjs +106 -0
- package/dist/__tests__/custom-types.test.cjs +300 -0
- package/dist/__tests__/custom-types.test.d.ts +1 -0
- package/dist/__tests__/custom-types.test.mjs +248 -0
- package/dist/__tests__/edge.test.cjs +56 -0
- package/dist/__tests__/edge.test.d.ts +1 -0
- package/dist/__tests__/edge.test.mjs +69 -0
- package/dist/__tests__/event-bus.test.cjs +80 -0
- package/dist/__tests__/event-bus.test.d.ts +1 -0
- package/dist/__tests__/event-bus.test.mjs +51 -0
- package/dist/__tests__/flow.ssr.test.cjs +156 -0
- package/dist/__tests__/flow.ssr.test.d.ts +1 -0
- package/dist/__tests__/flow.ssr.test.mjs +112 -0
- package/dist/__tests__/geometry.test.cjs +191 -0
- package/dist/__tests__/geometry.test.d.ts +1 -0
- package/dist/__tests__/geometry.test.mjs +105 -0
- package/dist/__tests__/graph.test.cjs +115 -0
- package/dist/__tests__/graph.test.d.ts +1 -0
- package/dist/__tests__/graph.test.mjs +85 -0
- package/dist/__tests__/history-plugin.test.cjs +191 -0
- package/dist/__tests__/history-plugin.test.d.ts +1 -0
- package/dist/__tests__/history-plugin.test.mjs +161 -0
- package/dist/__tests__/history.test.cjs +81 -0
- package/dist/__tests__/history.test.d.ts +1 -0
- package/dist/__tests__/history.test.mjs +43 -0
- package/dist/__tests__/layout.test.cjs +213 -0
- package/dist/__tests__/layout.test.d.ts +1 -0
- package/dist/__tests__/layout.test.mjs +170 -0
- package/dist/__tests__/node-edit-panel.ssr.test.cjs +168 -0
- package/dist/__tests__/node-edit-panel.ssr.test.d.ts +1 -0
- package/dist/__tests__/node-edit-panel.ssr.test.mjs +118 -0
- package/dist/__tests__/node-group-plugin.test.cjs +235 -0
- package/dist/__tests__/node-group-plugin.test.d.ts +1 -0
- package/dist/__tests__/node-group-plugin.test.mjs +187 -0
- package/dist/__tests__/node-handles.test.cjs +340 -0
- package/dist/__tests__/node-handles.test.d.ts +1 -0
- package/dist/__tests__/node-handles.test.mjs +230 -0
- package/dist/__tests__/plugin.test.cjs +151 -0
- package/dist/__tests__/plugin.test.d.ts +1 -0
- package/dist/__tests__/plugin.test.mjs +116 -0
- package/dist/__tests__/transform.test.cjs +58 -0
- package/dist/__tests__/transform.test.d.ts +1 -0
- package/dist/__tests__/transform.test.mjs +38 -0
- package/dist/__tests__/useAlignment.test.cjs +91 -0
- package/dist/__tests__/useAlignment.test.d.ts +1 -0
- package/dist/__tests__/useAlignment.test.mjs +52 -0
- package/dist/__tests__/useEdges.test.cjs +117 -0
- package/dist/__tests__/useEdges.test.d.ts +1 -0
- package/dist/__tests__/useEdges.test.mjs +80 -0
- package/dist/__tests__/useKeyboard.test.cjs +88 -0
- package/dist/__tests__/useKeyboard.test.d.ts +1 -0
- package/dist/__tests__/useKeyboard.test.mjs +56 -0
- package/dist/__tests__/useNodes.test.cjs +150 -0
- package/dist/__tests__/useNodes.test.d.ts +1 -0
- package/dist/__tests__/useNodes.test.mjs +80 -0
- package/dist/__tests__/useSelection.test.cjs +112 -0
- package/dist/__tests__/useSelection.test.d.ts +1 -0
- package/dist/__tests__/useSelection.test.mjs +76 -0
- package/dist/__tests__/useViewport.test.cjs +171 -0
- package/dist/__tests__/useViewport.test.d.ts +1 -0
- package/dist/__tests__/useViewport.test.mjs +82 -0
- package/dist/__tests__/utils/ssr.cjs +124 -0
- package/dist/__tests__/utils/ssr.d.ts +33 -0
- package/dist/__tests__/utils/ssr.mjs +129 -0
- package/dist/__tests__/validation.test.cjs +95 -0
- package/dist/__tests__/validation.test.d.ts +1 -0
- package/dist/__tests__/validation.test.mjs +36 -0
- package/dist/components/AiNodeEditPanel.d.vue.ts +13 -0
- package/dist/components/AiNodeEditPanel.vue +413 -0
- package/dist/components/AiNodeEditPanel.vue.d.ts +13 -0
- package/dist/components/EdgeEditPanel.d.vue.ts +14 -0
- package/dist/components/EdgeEditPanel.vue +205 -0
- package/dist/components/EdgeEditPanel.vue.d.ts +14 -0
- package/dist/components/NodeEditPanel.d.vue.ts +13 -0
- package/dist/components/NodeEditPanel.vue +214 -0
- package/dist/components/NodeEditPanel.vue.d.ts +13 -0
- package/dist/components/edges/BaseEdge.d.vue.ts +23 -0
- package/dist/components/edges/BaseEdge.vue +55 -0
- package/dist/components/edges/BaseEdge.vue.d.ts +23 -0
- package/dist/components/edges/BezierEdge.d.vue.ts +22 -0
- package/dist/components/edges/BezierEdge.vue +57 -0
- package/dist/components/edges/BezierEdge.vue.d.ts +22 -0
- package/dist/components/edges/DataFlowEdge.d.vue.ts +41 -0
- package/dist/components/edges/DataFlowEdge.vue +211 -0
- package/dist/components/edges/DataFlowEdge.vue.d.ts +41 -0
- package/dist/components/edges/SmoothEdge.d.vue.ts +22 -0
- package/dist/components/edges/SmoothEdge.vue +53 -0
- package/dist/components/edges/SmoothEdge.vue.d.ts +22 -0
- package/dist/components/edges/StepEdge.d.vue.ts +22 -0
- package/dist/components/edges/StepEdge.vue +42 -0
- package/dist/components/edges/StepEdge.vue.d.ts +22 -0
- package/dist/components/edges/index.cjs +41 -0
- package/dist/components/edges/index.d.ts +5 -0
- package/dist/components/edges/index.mjs +5 -0
- package/dist/components/nodes/BaseNode.d.vue.ts +25 -0
- package/dist/components/nodes/BaseNode.vue +93 -0
- package/dist/components/nodes/BaseNode.vue.d.ts +25 -0
- package/dist/components/nodes/CustomNode.d.vue.ts +36 -0
- package/dist/components/nodes/CustomNode.vue +44 -0
- package/dist/components/nodes/CustomNode.vue.d.ts +36 -0
- package/dist/components/nodes/DatabaseNode.d.vue.ts +19 -0
- package/dist/components/nodes/DatabaseNode.vue +62 -0
- package/dist/components/nodes/DatabaseNode.vue.d.ts +19 -0
- package/dist/components/nodes/DiamondNode.d.vue.ts +19 -0
- package/dist/components/nodes/DiamondNode.vue +62 -0
- package/dist/components/nodes/DiamondNode.vue.d.ts +19 -0
- package/dist/components/nodes/GroupNode.d.vue.ts +31 -0
- package/dist/components/nodes/GroupNode.vue +48 -0
- package/dist/components/nodes/GroupNode.vue.d.ts +31 -0
- package/dist/components/nodes/InputNode.d.vue.ts +23 -0
- package/dist/components/nodes/InputNode.vue +63 -0
- package/dist/components/nodes/InputNode.vue.d.ts +23 -0
- package/dist/components/nodes/NodeResizer.d.vue.ts +27 -0
- package/dist/components/nodes/NodeResizer.vue +89 -0
- package/dist/components/nodes/NodeResizer.vue.d.ts +27 -0
- package/dist/components/nodes/NodeToolbar.d.vue.ts +32 -0
- package/dist/components/nodes/NodeToolbar.vue +101 -0
- package/dist/components/nodes/NodeToolbar.vue.d.ts +32 -0
- package/dist/components/nodes/OutputNode.d.vue.ts +21 -0
- package/dist/components/nodes/OutputNode.vue +53 -0
- package/dist/components/nodes/OutputNode.vue.d.ts +21 -0
- package/dist/components/nodes/ai-workflow/AiAgentNode.d.vue.ts +20 -0
- package/dist/components/nodes/ai-workflow/AiAgentNode.vue +59 -0
- package/dist/components/nodes/ai-workflow/AiAgentNode.vue.d.ts +20 -0
- package/dist/components/nodes/ai-workflow/AiConditionNode.d.vue.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiConditionNode.vue +65 -0
- package/dist/components/nodes/ai-workflow/AiConditionNode.vue.d.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiEndNode.d.vue.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiEndNode.vue +47 -0
- package/dist/components/nodes/ai-workflow/AiEndNode.vue.d.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiLlmNode.d.vue.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiLlmNode.vue +64 -0
- package/dist/components/nodes/ai-workflow/AiLlmNode.vue.d.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiMemoryNode.d.vue.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiMemoryNode.vue +59 -0
- package/dist/components/nodes/ai-workflow/AiMemoryNode.vue.d.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiPromptNode.d.vue.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiPromptNode.vue +61 -0
- package/dist/components/nodes/ai-workflow/AiPromptNode.vue.d.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiStartNode.d.vue.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiStartNode.vue +47 -0
- package/dist/components/nodes/ai-workflow/AiStartNode.vue.d.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiToolNode.d.vue.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiToolNode.vue +59 -0
- package/dist/components/nodes/ai-workflow/AiToolNode.vue.d.ts +19 -0
- package/dist/components/nodes/ai-workflow/index.cjs +109 -0
- package/dist/components/nodes/ai-workflow/index.d.ts +23 -0
- package/dist/components/nodes/ai-workflow/index.mjs +37 -0
- package/dist/components/nodes/bpmn/BpmnEndEvent.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnEndEvent.vue +50 -0
- package/dist/components/nodes/bpmn/BpmnEndEvent.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnExclusiveGateway.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnExclusiveGateway.vue +60 -0
- package/dist/components/nodes/bpmn/BpmnExclusiveGateway.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnInclusiveGateway.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnInclusiveGateway.vue +60 -0
- package/dist/components/nodes/bpmn/BpmnInclusiveGateway.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnParallelGateway.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnParallelGateway.vue +60 -0
- package/dist/components/nodes/bpmn/BpmnParallelGateway.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnServiceTask.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnServiceTask.vue +55 -0
- package/dist/components/nodes/bpmn/BpmnServiceTask.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnStartEvent.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnStartEvent.vue +50 -0
- package/dist/components/nodes/bpmn/BpmnStartEvent.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnTask.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnTask.vue +54 -0
- package/dist/components/nodes/bpmn/BpmnTask.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnUserTask.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnUserTask.vue +55 -0
- package/dist/components/nodes/bpmn/BpmnUserTask.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/index.cjs +109 -0
- package/dist/components/nodes/bpmn/index.d.ts +23 -0
- package/dist/components/nodes/bpmn/index.mjs +37 -0
- package/dist/components/nodes/index.cjs +246 -0
- package/dist/components/nodes/index.d.ts +13 -0
- package/dist/components/nodes/index.mjs +44 -0
- package/dist/core/FlowContext.cjs +21 -0
- package/dist/core/FlowContext.d.ts +10 -0
- package/dist/core/FlowContext.mjs +13 -0
- package/dist/core/index.cjs +104 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.mjs +9 -0
- package/dist/core/useAlignment.cjs +81 -0
- package/dist/core/useAlignment.d.ts +33 -0
- package/dist/core/useAlignment.mjs +71 -0
- package/dist/core/useEdges.cjs +132 -0
- package/dist/core/useEdges.d.ts +29 -0
- package/dist/core/useEdges.mjs +89 -0
- package/dist/core/useFlow.cjs +40 -0
- package/dist/core/useFlow.d.ts +31 -0
- package/dist/core/useFlow.mjs +32 -0
- package/dist/core/useHistory.cjs +63 -0
- package/dist/core/useHistory.d.ts +15 -0
- package/dist/core/useHistory.mjs +54 -0
- package/dist/core/useKeyboard.cjs +54 -0
- package/dist/core/useKeyboard.d.ts +18 -0
- package/dist/core/useKeyboard.mjs +45 -0
- package/dist/core/useNodeDistribution.cjs +171 -0
- package/dist/core/useNodeDistribution.d.ts +12 -0
- package/dist/core/useNodeDistribution.mjs +145 -0
- package/dist/core/useNodes.cjs +146 -0
- package/dist/core/useNodes.d.ts +26 -0
- package/dist/core/useNodes.mjs +101 -0
- package/dist/core/useSelection.cjs +83 -0
- package/dist/core/useSelection.d.ts +18 -0
- package/dist/core/useSelection.mjs +53 -0
- package/dist/core/useViewport.cjs +157 -0
- package/dist/core/useViewport.d.ts +65 -0
- package/dist/core/useViewport.mjs +125 -0
- package/dist/flow.cjs +240 -0
- package/dist/flow.d.ts +276 -0
- package/dist/flow.mjs +230 -0
- package/dist/index.cjs +378 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.mjs +50 -0
- package/dist/plugins/index.cjs +96 -0
- package/dist/plugins/index.d.ts +34 -0
- package/dist/plugins/index.mjs +47 -0
- package/dist/plugins/plugin.cjs +117 -0
- package/dist/plugins/plugin.d.ts +72 -0
- package/dist/plugins/plugin.mjs +110 -0
- package/dist/plugins/plugins/controls.cjs +38 -0
- package/dist/plugins/plugins/controls.d.ts +12 -0
- package/dist/plugins/plugins/controls.mjs +28 -0
- package/dist/plugins/plugins/export.cjs +102 -0
- package/dist/plugins/plugins/export.d.ts +12 -0
- package/dist/plugins/plugins/export.mjs +89 -0
- package/dist/plugins/plugins/grid.cjs +36 -0
- package/dist/plugins/plugins/grid.d.ts +11 -0
- package/dist/plugins/plugins/grid.mjs +26 -0
- package/dist/plugins/plugins/history.cjs +140 -0
- package/dist/plugins/plugins/history.d.ts +53 -0
- package/dist/plugins/plugins/history.mjs +132 -0
- package/dist/plugins/plugins/index.cjs +104 -0
- package/dist/plugins/plugins/index.d.ts +9 -0
- package/dist/plugins/plugins/index.mjs +9 -0
- package/dist/plugins/plugins/keyboard.cjs +27 -0
- package/dist/plugins/plugins/keyboard.d.ts +10 -0
- package/dist/plugins/plugins/keyboard.mjs +18 -0
- package/dist/plugins/plugins/layout.cjs +275 -0
- package/dist/plugins/plugins/layout.d.ts +34 -0
- package/dist/plugins/plugins/layout.mjs +246 -0
- package/dist/plugins/plugins/minimap.cjs +60 -0
- package/dist/plugins/plugins/minimap.d.ts +25 -0
- package/dist/plugins/plugins/minimap.mjs +50 -0
- package/dist/plugins/plugins/node-group.cjs +209 -0
- package/dist/plugins/plugins/node-group.d.ts +26 -0
- package/dist/plugins/plugins/node-group.mjs +178 -0
- package/dist/plugins/plugins/snap.cjs +36 -0
- package/dist/plugins/plugins/snap.d.ts +12 -0
- package/dist/plugins/plugins/snap.mjs +26 -0
- package/dist/renderer/AlignmentLines.d.vue.ts +5 -0
- package/dist/renderer/AlignmentLines.vue +113 -0
- package/dist/renderer/AlignmentLines.vue.d.ts +5 -0
- package/dist/renderer/Background.d.vue.ts +7 -0
- package/dist/renderer/Background.vue +86 -0
- package/dist/renderer/Background.vue.d.ts +7 -0
- package/dist/renderer/Controls.d.vue.ts +13 -0
- package/dist/renderer/Controls.vue +82 -0
- package/dist/renderer/Controls.vue.d.ts +13 -0
- package/dist/renderer/EdgeHandlesRenderer.d.vue.ts +11 -0
- package/dist/renderer/EdgeHandlesRenderer.vue +75 -0
- package/dist/renderer/EdgeHandlesRenderer.vue.d.ts +11 -0
- package/dist/renderer/EdgeRenderer.d.vue.ts +39 -0
- package/dist/renderer/EdgeRenderer.vue +204 -0
- package/dist/renderer/EdgeRenderer.vue.d.ts +39 -0
- package/dist/renderer/FlowBackground.d.vue.ts +11 -0
- package/dist/renderer/FlowBackground.vue +82 -0
- package/dist/renderer/FlowBackground.vue.d.ts +11 -0
- package/dist/renderer/Minimap.d.vue.ts +30 -0
- package/dist/renderer/Minimap.vue +290 -0
- package/dist/renderer/Minimap.vue.d.ts +30 -0
- package/dist/renderer/NodeRenderer.d.vue.ts +56 -0
- package/dist/renderer/NodeRenderer.vue +328 -0
- package/dist/renderer/NodeRenderer.vue.d.ts +56 -0
- package/dist/renderer/SelectionBox.d.vue.ts +11 -0
- package/dist/renderer/SelectionBox.vue +28 -0
- package/dist/renderer/SelectionBox.vue.d.ts +11 -0
- package/dist/types/edge.cjs +13 -0
- package/dist/types/edge.d.ts +65 -0
- package/dist/types/edge.mjs +6 -0
- package/dist/types/events.cjs +1 -0
- package/dist/types/events.d.ts +115 -0
- package/dist/types/events.mjs +0 -0
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.d.ts +366 -0
- package/dist/types/index.mjs +0 -0
- package/dist/types/node.cjs +9 -0
- package/dist/types/node.d.ts +90 -0
- package/dist/types/node.mjs +3 -0
- package/dist/types/viewport.cjs +42 -0
- package/dist/types/viewport.d.ts +62 -0
- package/dist/types/viewport.mjs +36 -0
- package/dist/utils/bpmn-engine.cjs +390 -0
- package/dist/utils/bpmn-engine.d.ts +164 -0
- package/dist/utils/bpmn-engine.mjs +378 -0
- package/dist/utils/bpmn.cjs +492 -0
- package/dist/utils/bpmn.d.ts +53 -0
- package/dist/utils/bpmn.mjs +430 -0
- package/dist/utils/collaboration.cjs +537 -0
- package/dist/utils/collaboration.d.ts +189 -0
- package/dist/utils/collaboration.mjs +521 -0
- package/dist/utils/custom-types.cjs +138 -0
- package/dist/utils/custom-types.d.ts +78 -0
- package/dist/utils/custom-types.mjs +108 -0
- package/dist/utils/edge.cjs +235 -0
- package/dist/utils/edge.d.ts +79 -0
- package/dist/utils/edge.mjs +172 -0
- package/dist/utils/event-bus.cjs +91 -0
- package/dist/utils/event-bus.d.ts +39 -0
- package/dist/utils/event-bus.mjs +82 -0
- package/dist/utils/geometry.cjs +178 -0
- package/dist/utils/geometry.d.ts +186 -0
- package/dist/utils/geometry.mjs +144 -0
- package/dist/utils/graph.cjs +158 -0
- package/dist/utils/graph.d.ts +40 -0
- package/dist/utils/graph.mjs +147 -0
- package/dist/utils/index.cjs +137 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.mjs +12 -0
- package/dist/utils/performance.cjs +94 -0
- package/dist/utils/performance.d.ts +18 -0
- package/dist/utils/performance.mjs +82 -0
- package/dist/utils/screenshot.cjs +87 -0
- package/dist/utils/screenshot.d.ts +22 -0
- package/dist/utils/screenshot.mjs +66 -0
- package/dist/utils/theme.cjs +228 -0
- package/dist/utils/theme.d.ts +92 -0
- package/dist/utils/theme.mjs +217 -0
- package/dist/utils/transform.cjs +76 -0
- package/dist/utils/transform.d.ts +45 -0
- package/dist/utils/transform.mjs +57 -0
- package/dist/utils/validation.cjs +107 -0
- package/dist/utils/validation.d.ts +29 -0
- package/dist/utils/validation.mjs +85 -0
- package/package.json +61 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { nextTick } from "vue";
|
|
2
|
+
import { captureElement, triggerDownload, copyBlobToClipboard } from "../../utils/screenshot.mjs";
|
|
3
|
+
const defaultOptions = {
|
|
4
|
+
enabled: true,
|
|
5
|
+
fileName: "flow-chart",
|
|
6
|
+
exportImage: true,
|
|
7
|
+
exportJson: true,
|
|
8
|
+
imageType: "png",
|
|
9
|
+
imageQuality: 1,
|
|
10
|
+
pixelRatio: 2,
|
|
11
|
+
backgroundColor: "#ffffff"
|
|
12
|
+
};
|
|
13
|
+
function normalizeOptions(pluginOptions, arg) {
|
|
14
|
+
if (arg == null) {
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
17
|
+
if (arg instanceof HTMLElement) {
|
|
18
|
+
return { container: arg };
|
|
19
|
+
}
|
|
20
|
+
return { ...arg };
|
|
21
|
+
}
|
|
22
|
+
function mergeCaptureOptions(plugin, options) {
|
|
23
|
+
return {
|
|
24
|
+
imageType: options.imageType ?? plugin.imageType,
|
|
25
|
+
imageQuality: options.imageQuality ?? plugin.imageQuality,
|
|
26
|
+
pixelRatio: options.pixelRatio ?? plugin.pixelRatio,
|
|
27
|
+
backgroundColor: options.backgroundColor ?? plugin.backgroundColor
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function createExportPlugin(options = {}) {
|
|
31
|
+
const mergedOptions = { ...defaultOptions, ...options };
|
|
32
|
+
return {
|
|
33
|
+
id: "export",
|
|
34
|
+
name: "Export",
|
|
35
|
+
version: "1.0.0",
|
|
36
|
+
description: "Provides methods to export the flow chart as JSON or Image",
|
|
37
|
+
install(flow) {
|
|
38
|
+
if (!mergedOptions.enabled) return;
|
|
39
|
+
if (mergedOptions.exportJson) {
|
|
40
|
+
flow.exportJson = () => {
|
|
41
|
+
return JSON.stringify(
|
|
42
|
+
{
|
|
43
|
+
nodes: flow.nodes.value,
|
|
44
|
+
edges: flow.edges.value,
|
|
45
|
+
viewport: flow.viewport.value
|
|
46
|
+
},
|
|
47
|
+
null,
|
|
48
|
+
2
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (mergedOptions.exportImage) {
|
|
53
|
+
flow.exportImage = async (optionsOrContainer) => {
|
|
54
|
+
const opts = normalizeOptions(mergedOptions, optionsOrContainer);
|
|
55
|
+
const container = opts.container ?? flow.$el;
|
|
56
|
+
if (!container) {
|
|
57
|
+
throw new Error("[Export Plugin] No element found for export");
|
|
58
|
+
}
|
|
59
|
+
const mode = opts.mode ?? "viewport";
|
|
60
|
+
const download = opts.download !== false;
|
|
61
|
+
const copyToClipboard = opts.copyToClipboard === true;
|
|
62
|
+
const fileName = opts.fileName ?? mergedOptions.fileName;
|
|
63
|
+
const fullModePadding = opts.fullModePadding ?? 20;
|
|
64
|
+
let savedViewport = null;
|
|
65
|
+
try {
|
|
66
|
+
if (mode === "full") {
|
|
67
|
+
savedViewport = { ...flow.getViewport() };
|
|
68
|
+
flow.fitView?.({ padding: fullModePadding });
|
|
69
|
+
await nextTick();
|
|
70
|
+
}
|
|
71
|
+
const captureOpts = mergeCaptureOptions(mergedOptions, opts);
|
|
72
|
+
const result = await captureElement(container, captureOpts);
|
|
73
|
+
if (download) {
|
|
74
|
+
triggerDownload(result.dataUrl, fileName, result.extension);
|
|
75
|
+
}
|
|
76
|
+
if (copyToClipboard) {
|
|
77
|
+
await copyBlobToClipboard(result.blob);
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
} finally {
|
|
81
|
+
if (savedViewport) {
|
|
82
|
+
flow.setViewport(savedViewport);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createGridPlugin = createGridPlugin;
|
|
7
|
+
var _vue = require("vue");
|
|
8
|
+
var _Background = _interopRequireDefault(require("../../renderer/Background.vue"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const defaultGridOptions = {
|
|
11
|
+
enabled: true,
|
|
12
|
+
type: "dots",
|
|
13
|
+
color: "#e5e5e5",
|
|
14
|
+
gap: 20
|
|
15
|
+
};
|
|
16
|
+
function createGridPlugin(options = {}) {
|
|
17
|
+
const mergedOptions = {
|
|
18
|
+
...defaultGridOptions,
|
|
19
|
+
...options
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
id: "grid",
|
|
23
|
+
name: "Grid",
|
|
24
|
+
version: "1.0.0",
|
|
25
|
+
description: "Displays a grid or dots background",
|
|
26
|
+
component: (0, _vue.markRaw)(_Background.default),
|
|
27
|
+
componentProps: {
|
|
28
|
+
type: mergedOptions.type,
|
|
29
|
+
color: mergedOptions.color,
|
|
30
|
+
gap: mergedOptions.gap
|
|
31
|
+
},
|
|
32
|
+
install(_flow) {
|
|
33
|
+
console.log(`[Grid Plugin] Installed`);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FlowPlugin } from '../plugin';
|
|
2
|
+
export interface GridPluginOptions {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
type?: 'dots' | 'grid';
|
|
5
|
+
color?: string;
|
|
6
|
+
gap?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 创建网格插件
|
|
10
|
+
*/
|
|
11
|
+
export declare function createGridPlugin(options?: GridPluginOptions): FlowPlugin;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { markRaw } from "vue";
|
|
2
|
+
import Background from "../../renderer/Background.vue";
|
|
3
|
+
const defaultGridOptions = {
|
|
4
|
+
enabled: true,
|
|
5
|
+
type: "dots",
|
|
6
|
+
color: "#e5e5e5",
|
|
7
|
+
gap: 20
|
|
8
|
+
};
|
|
9
|
+
export function createGridPlugin(options = {}) {
|
|
10
|
+
const mergedOptions = { ...defaultGridOptions, ...options };
|
|
11
|
+
return {
|
|
12
|
+
id: "grid",
|
|
13
|
+
name: "Grid",
|
|
14
|
+
version: "1.0.0",
|
|
15
|
+
description: "Displays a grid or dots background",
|
|
16
|
+
component: markRaw(Background),
|
|
17
|
+
componentProps: {
|
|
18
|
+
type: mergedOptions.type,
|
|
19
|
+
color: mergedOptions.color,
|
|
20
|
+
gap: mergedOptions.gap
|
|
21
|
+
},
|
|
22
|
+
install(_flow) {
|
|
23
|
+
console.log(`[Grid Plugin] Installed`);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createHistoryPlugin = createHistoryPlugin;
|
|
7
|
+
var _vue = require("vue");
|
|
8
|
+
const defaultOptions = {
|
|
9
|
+
enabled: true,
|
|
10
|
+
maxHistory: 100,
|
|
11
|
+
enableKeyboard: true,
|
|
12
|
+
onHistoryChange: () => {},
|
|
13
|
+
autoCapture: false
|
|
14
|
+
};
|
|
15
|
+
function snapshot(data) {
|
|
16
|
+
return JSON.parse(JSON.stringify(data));
|
|
17
|
+
}
|
|
18
|
+
function createHistoryPlugin(options = {}) {
|
|
19
|
+
const opts = {
|
|
20
|
+
...defaultOptions,
|
|
21
|
+
...options
|
|
22
|
+
};
|
|
23
|
+
const historyStack = (0, _vue.ref)([]);
|
|
24
|
+
const pointer = (0, _vue.ref)(-1);
|
|
25
|
+
const canUndo = (0, _vue.computed)(() => pointer.value > 0);
|
|
26
|
+
const canRedo = (0, _vue.computed)(() => pointer.value < historyStack.value.length - 1);
|
|
27
|
+
const historyLength = (0, _vue.computed)(() => historyStack.value.length);
|
|
28
|
+
let _flow = null;
|
|
29
|
+
let _keydownHandler = null;
|
|
30
|
+
const notifyChange = () => {
|
|
31
|
+
opts.onHistoryChange(canUndo.value, canRedo.value, historyStack.value.length);
|
|
32
|
+
};
|
|
33
|
+
const saveSnapshot = description => {
|
|
34
|
+
if (!_flow) return;
|
|
35
|
+
const newStack = historyStack.value.slice(0, pointer.value + 1);
|
|
36
|
+
newStack.push({
|
|
37
|
+
nodes: snapshot(_flow.nodes.value),
|
|
38
|
+
edges: snapshot(_flow.edges.value),
|
|
39
|
+
timestamp: Date.now(),
|
|
40
|
+
description
|
|
41
|
+
});
|
|
42
|
+
if (newStack.length > opts.maxHistory) {
|
|
43
|
+
newStack.shift();
|
|
44
|
+
}
|
|
45
|
+
historyStack.value = newStack;
|
|
46
|
+
pointer.value = newStack.length - 1;
|
|
47
|
+
notifyChange();
|
|
48
|
+
};
|
|
49
|
+
const undo = () => {
|
|
50
|
+
if (!_flow || !canUndo.value) return;
|
|
51
|
+
pointer.value--;
|
|
52
|
+
const prevState = historyStack.value[pointer.value];
|
|
53
|
+
if (prevState) {
|
|
54
|
+
_flow.nodes.value = snapshot(prevState.nodes);
|
|
55
|
+
_flow.edges.value = snapshot(prevState.edges);
|
|
56
|
+
}
|
|
57
|
+
notifyChange();
|
|
58
|
+
};
|
|
59
|
+
const redo = () => {
|
|
60
|
+
if (!_flow || !canRedo.value) return;
|
|
61
|
+
pointer.value++;
|
|
62
|
+
const nextState = historyStack.value[pointer.value];
|
|
63
|
+
if (nextState) {
|
|
64
|
+
_flow.nodes.value = snapshot(nextState.nodes);
|
|
65
|
+
_flow.edges.value = snapshot(nextState.edges);
|
|
66
|
+
}
|
|
67
|
+
notifyChange();
|
|
68
|
+
};
|
|
69
|
+
const clearHistory = () => {
|
|
70
|
+
historyStack.value = [];
|
|
71
|
+
pointer.value = -1;
|
|
72
|
+
notifyChange();
|
|
73
|
+
};
|
|
74
|
+
const getHistory = () => historyStack.value;
|
|
75
|
+
const jumpToStep = index => {
|
|
76
|
+
if (!_flow || index < 0 || index >= historyStack.value.length) return;
|
|
77
|
+
pointer.value = index;
|
|
78
|
+
const state = historyStack.value[index];
|
|
79
|
+
if (state) {
|
|
80
|
+
_flow.nodes.value = snapshot(state.nodes);
|
|
81
|
+
_flow.edges.value = snapshot(state.edges);
|
|
82
|
+
}
|
|
83
|
+
notifyChange();
|
|
84
|
+
};
|
|
85
|
+
const plugin = {
|
|
86
|
+
id: "history",
|
|
87
|
+
name: "History",
|
|
88
|
+
version: "1.0.0",
|
|
89
|
+
description: "Provides undo/redo history for flow graph with keyboard shortcut support",
|
|
90
|
+
// 将响应式状态和方法挂到插件上,方便外部访问
|
|
91
|
+
canUndo,
|
|
92
|
+
canRedo,
|
|
93
|
+
historyLength,
|
|
94
|
+
saveSnapshot,
|
|
95
|
+
undo,
|
|
96
|
+
redo,
|
|
97
|
+
clearHistory,
|
|
98
|
+
getHistory,
|
|
99
|
+
jumpToStep,
|
|
100
|
+
install(flow) {
|
|
101
|
+
if (!opts.enabled) return;
|
|
102
|
+
_flow = flow;
|
|
103
|
+
flow.undo = undo;
|
|
104
|
+
flow.redo = redo;
|
|
105
|
+
flow.saveSnapshot = saveSnapshot;
|
|
106
|
+
flow.canUndo = canUndo;
|
|
107
|
+
flow.canRedo = canRedo;
|
|
108
|
+
flow.historyLength = historyLength;
|
|
109
|
+
flow.clearHistory = clearHistory;
|
|
110
|
+
flow.getHistory = getHistory;
|
|
111
|
+
flow.jumpToStep = jumpToStep;
|
|
112
|
+
saveSnapshot("initial");
|
|
113
|
+
if (opts.enableKeyboard) {
|
|
114
|
+
_keydownHandler = e => {
|
|
115
|
+
const isCtrl = e.ctrlKey || e.metaKey;
|
|
116
|
+
if (!isCtrl) return;
|
|
117
|
+
if (e.key === "z" && !e.shiftKey) {
|
|
118
|
+
e.preventDefault();
|
|
119
|
+
undo();
|
|
120
|
+
} else if (e.key === "y" || e.key === "z" && e.shiftKey) {
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
redo();
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
window.addEventListener("keydown", _keydownHandler);
|
|
126
|
+
}
|
|
127
|
+
console.log("[History Plugin] Installed \u2014 Ctrl+Z to undo, Ctrl+Y to redo");
|
|
128
|
+
},
|
|
129
|
+
destroy() {
|
|
130
|
+
if (_keydownHandler) {
|
|
131
|
+
window.removeEventListener("keydown", _keydownHandler);
|
|
132
|
+
_keydownHandler = null;
|
|
133
|
+
}
|
|
134
|
+
_flow = null;
|
|
135
|
+
historyStack.value = [];
|
|
136
|
+
pointer.value = -1;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
return plugin;
|
|
140
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
import type { FlowPlugin } from '../plugin';
|
|
3
|
+
import type { Node, Edge } from '../../types';
|
|
4
|
+
export interface HistoryPluginOptions {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
/** 最大历史步骤数, 默认 100 */
|
|
7
|
+
maxHistory?: number;
|
|
8
|
+
/** 是否启用键盘快捷键 (Ctrl+Z/Y), 默认 true */
|
|
9
|
+
enableKeyboard?: boolean;
|
|
10
|
+
/** 历史变化回调 */
|
|
11
|
+
onHistoryChange?: (canUndo: boolean, canRedo: boolean, historyLength: number) => void;
|
|
12
|
+
/** 启用自动捕获节点/边变化(注意性能影响),默认 false */
|
|
13
|
+
autoCapture?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface HistorySnapshot {
|
|
16
|
+
nodes: Node[];
|
|
17
|
+
edges: Edge[];
|
|
18
|
+
timestamp: number;
|
|
19
|
+
description?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface HistoryPluginReturn {
|
|
22
|
+
/** 撤销 */
|
|
23
|
+
undo: () => void;
|
|
24
|
+
/** 重做 */
|
|
25
|
+
redo: () => void;
|
|
26
|
+
/** 手动保存当前状态快照 */
|
|
27
|
+
saveSnapshot: (description?: string) => void;
|
|
28
|
+
/** 是否可撤销 */
|
|
29
|
+
canUndo: Ref<boolean>;
|
|
30
|
+
/** 是否可重做 */
|
|
31
|
+
canRedo: Ref<boolean>;
|
|
32
|
+
/** 历史记录数量 */
|
|
33
|
+
historyLength: Ref<number>;
|
|
34
|
+
/** 清空历史 */
|
|
35
|
+
clearHistory: () => void;
|
|
36
|
+
/** 获取历史列表(用于时间旅行功能) */
|
|
37
|
+
getHistory: () => HistorySnapshot[];
|
|
38
|
+
/** 跳转到指定历史步骤 */
|
|
39
|
+
jumpToStep: (index: number) => void;
|
|
40
|
+
}
|
|
41
|
+
export declare function createHistoryPlugin(options?: HistoryPluginOptions): FlowPlugin & {
|
|
42
|
+
getHistory: () => HistorySnapshot[];
|
|
43
|
+
undo: () => void;
|
|
44
|
+
redo: () => void;
|
|
45
|
+
saveSnapshot: (description?: string) => void;
|
|
46
|
+
canUndo: Ref<boolean>;
|
|
47
|
+
canRedo: Ref<boolean>;
|
|
48
|
+
historyLength: Ref<number>;
|
|
49
|
+
clearHistory: () => void;
|
|
50
|
+
jumpToStep: (index: number) => void;
|
|
51
|
+
};
|
|
52
|
+
/** 导出快照类型 */
|
|
53
|
+
export type { HistorySnapshot as FlowHistorySnapshot };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { ref, computed } from "vue";
|
|
2
|
+
const defaultOptions = {
|
|
3
|
+
enabled: true,
|
|
4
|
+
maxHistory: 100,
|
|
5
|
+
enableKeyboard: true,
|
|
6
|
+
onHistoryChange: () => {
|
|
7
|
+
},
|
|
8
|
+
autoCapture: false
|
|
9
|
+
};
|
|
10
|
+
function snapshot(data) {
|
|
11
|
+
return JSON.parse(JSON.stringify(data));
|
|
12
|
+
}
|
|
13
|
+
export function createHistoryPlugin(options = {}) {
|
|
14
|
+
const opts = { ...defaultOptions, ...options };
|
|
15
|
+
const historyStack = ref([]);
|
|
16
|
+
const pointer = ref(-1);
|
|
17
|
+
const canUndo = computed(() => pointer.value > 0);
|
|
18
|
+
const canRedo = computed(() => pointer.value < historyStack.value.length - 1);
|
|
19
|
+
const historyLength = computed(() => historyStack.value.length);
|
|
20
|
+
let _flow = null;
|
|
21
|
+
let _keydownHandler = null;
|
|
22
|
+
const notifyChange = () => {
|
|
23
|
+
opts.onHistoryChange(canUndo.value, canRedo.value, historyStack.value.length);
|
|
24
|
+
};
|
|
25
|
+
const saveSnapshot = (description) => {
|
|
26
|
+
if (!_flow) return;
|
|
27
|
+
const newStack = historyStack.value.slice(0, pointer.value + 1);
|
|
28
|
+
newStack.push({
|
|
29
|
+
nodes: snapshot(_flow.nodes.value),
|
|
30
|
+
edges: snapshot(_flow.edges.value),
|
|
31
|
+
timestamp: Date.now(),
|
|
32
|
+
description
|
|
33
|
+
});
|
|
34
|
+
if (newStack.length > opts.maxHistory) {
|
|
35
|
+
newStack.shift();
|
|
36
|
+
}
|
|
37
|
+
historyStack.value = newStack;
|
|
38
|
+
pointer.value = newStack.length - 1;
|
|
39
|
+
notifyChange();
|
|
40
|
+
};
|
|
41
|
+
const undo = () => {
|
|
42
|
+
if (!_flow || !canUndo.value) return;
|
|
43
|
+
pointer.value--;
|
|
44
|
+
const prevState = historyStack.value[pointer.value];
|
|
45
|
+
if (prevState) {
|
|
46
|
+
_flow.nodes.value = snapshot(prevState.nodes);
|
|
47
|
+
_flow.edges.value = snapshot(prevState.edges);
|
|
48
|
+
}
|
|
49
|
+
notifyChange();
|
|
50
|
+
};
|
|
51
|
+
const redo = () => {
|
|
52
|
+
if (!_flow || !canRedo.value) return;
|
|
53
|
+
pointer.value++;
|
|
54
|
+
const nextState = historyStack.value[pointer.value];
|
|
55
|
+
if (nextState) {
|
|
56
|
+
_flow.nodes.value = snapshot(nextState.nodes);
|
|
57
|
+
_flow.edges.value = snapshot(nextState.edges);
|
|
58
|
+
}
|
|
59
|
+
notifyChange();
|
|
60
|
+
};
|
|
61
|
+
const clearHistory = () => {
|
|
62
|
+
historyStack.value = [];
|
|
63
|
+
pointer.value = -1;
|
|
64
|
+
notifyChange();
|
|
65
|
+
};
|
|
66
|
+
const getHistory = () => historyStack.value;
|
|
67
|
+
const jumpToStep = (index) => {
|
|
68
|
+
if (!_flow || index < 0 || index >= historyStack.value.length) return;
|
|
69
|
+
pointer.value = index;
|
|
70
|
+
const state = historyStack.value[index];
|
|
71
|
+
if (state) {
|
|
72
|
+
_flow.nodes.value = snapshot(state.nodes);
|
|
73
|
+
_flow.edges.value = snapshot(state.edges);
|
|
74
|
+
}
|
|
75
|
+
notifyChange();
|
|
76
|
+
};
|
|
77
|
+
const plugin = {
|
|
78
|
+
id: "history",
|
|
79
|
+
name: "History",
|
|
80
|
+
version: "1.0.0",
|
|
81
|
+
description: "Provides undo/redo history for flow graph with keyboard shortcut support",
|
|
82
|
+
// 将响应式状态和方法挂到插件上,方便外部访问
|
|
83
|
+
canUndo,
|
|
84
|
+
canRedo,
|
|
85
|
+
historyLength,
|
|
86
|
+
saveSnapshot,
|
|
87
|
+
undo,
|
|
88
|
+
redo,
|
|
89
|
+
clearHistory,
|
|
90
|
+
getHistory,
|
|
91
|
+
jumpToStep,
|
|
92
|
+
install(flow) {
|
|
93
|
+
if (!opts.enabled) return;
|
|
94
|
+
_flow = flow;
|
|
95
|
+
flow.undo = undo;
|
|
96
|
+
flow.redo = redo;
|
|
97
|
+
flow.saveSnapshot = saveSnapshot;
|
|
98
|
+
flow.canUndo = canUndo;
|
|
99
|
+
flow.canRedo = canRedo;
|
|
100
|
+
flow.historyLength = historyLength;
|
|
101
|
+
flow.clearHistory = clearHistory;
|
|
102
|
+
flow.getHistory = getHistory;
|
|
103
|
+
flow.jumpToStep = jumpToStep;
|
|
104
|
+
saveSnapshot("initial");
|
|
105
|
+
if (opts.enableKeyboard) {
|
|
106
|
+
_keydownHandler = (e) => {
|
|
107
|
+
const isCtrl = e.ctrlKey || e.metaKey;
|
|
108
|
+
if (!isCtrl) return;
|
|
109
|
+
if (e.key === "z" && !e.shiftKey) {
|
|
110
|
+
e.preventDefault();
|
|
111
|
+
undo();
|
|
112
|
+
} else if (e.key === "y" || e.key === "z" && e.shiftKey) {
|
|
113
|
+
e.preventDefault();
|
|
114
|
+
redo();
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
window.addEventListener("keydown", _keydownHandler);
|
|
118
|
+
}
|
|
119
|
+
console.log("[History Plugin] Installed \u2014 Ctrl+Z to undo, Ctrl+Y to redo");
|
|
120
|
+
},
|
|
121
|
+
destroy() {
|
|
122
|
+
if (_keydownHandler) {
|
|
123
|
+
window.removeEventListener("keydown", _keydownHandler);
|
|
124
|
+
_keydownHandler = null;
|
|
125
|
+
}
|
|
126
|
+
_flow = null;
|
|
127
|
+
historyStack.value = [];
|
|
128
|
+
pointer.value = -1;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
return plugin;
|
|
132
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _minimap = require("./minimap.cjs");
|
|
7
|
+
Object.keys(_minimap).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _minimap[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _minimap[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _controls = require("./controls.cjs");
|
|
18
|
+
Object.keys(_controls).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _controls[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _controls[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _grid = require("./grid.cjs");
|
|
29
|
+
Object.keys(_grid).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _grid[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _grid[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _snap = require("./snap.cjs");
|
|
40
|
+
Object.keys(_snap).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _snap[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _snap[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _keyboard = require("./keyboard.cjs");
|
|
51
|
+
Object.keys(_keyboard).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _keyboard[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _keyboard[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _export = require("./export.cjs");
|
|
62
|
+
Object.keys(_export).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _export[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _export[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var _layout = require("./layout.cjs");
|
|
73
|
+
Object.keys(_layout).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _layout[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _layout[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
var _nodeGroup = require("./node-group.cjs");
|
|
84
|
+
Object.keys(_nodeGroup).forEach(function (key) {
|
|
85
|
+
if (key === "default" || key === "__esModule") return;
|
|
86
|
+
if (key in exports && exports[key] === _nodeGroup[key]) return;
|
|
87
|
+
Object.defineProperty(exports, key, {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () {
|
|
90
|
+
return _nodeGroup[key];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
var _history = require("./history.cjs");
|
|
95
|
+
Object.keys(_history).forEach(function (key) {
|
|
96
|
+
if (key === "default" || key === "__esModule") return;
|
|
97
|
+
if (key in exports && exports[key] === _history[key]) return;
|
|
98
|
+
Object.defineProperty(exports, key, {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function () {
|
|
101
|
+
return _history[key];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./minimap.mjs";
|
|
2
|
+
export * from "./controls.mjs";
|
|
3
|
+
export * from "./grid.mjs";
|
|
4
|
+
export * from "./snap.mjs";
|
|
5
|
+
export * from "./keyboard.mjs";
|
|
6
|
+
export * from "./export.mjs";
|
|
7
|
+
export * from "./layout.mjs";
|
|
8
|
+
export * from "./node-group.mjs";
|
|
9
|
+
export * from "./history.mjs";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createKeyboardPlugin = createKeyboardPlugin;
|
|
7
|
+
const defaultOptions = {
|
|
8
|
+
enabled: true,
|
|
9
|
+
delete: true,
|
|
10
|
+
backspace: true,
|
|
11
|
+
ctrlZ: true,
|
|
12
|
+
ctrlY: true,
|
|
13
|
+
escape: true
|
|
14
|
+
};
|
|
15
|
+
function createKeyboardPlugin(options = {}) {
|
|
16
|
+
const mergedOptions = {
|
|
17
|
+
...defaultOptions,
|
|
18
|
+
...options
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
id: "keyboard",
|
|
22
|
+
name: "Keyboard",
|
|
23
|
+
install(_flow) {
|
|
24
|
+
console.log("Keyboard plugin installed", mergedOptions);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FlowPlugin } from '../plugin';
|
|
2
|
+
export interface KeyboardOptions {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
delete?: boolean;
|
|
5
|
+
backspace?: boolean;
|
|
6
|
+
ctrlZ?: boolean;
|
|
7
|
+
ctrlY?: boolean;
|
|
8
|
+
escape?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function createKeyboardPlugin(options?: KeyboardOptions): FlowPlugin;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const defaultOptions = {
|
|
2
|
+
enabled: true,
|
|
3
|
+
delete: true,
|
|
4
|
+
backspace: true,
|
|
5
|
+
ctrlZ: true,
|
|
6
|
+
ctrlY: true,
|
|
7
|
+
escape: true
|
|
8
|
+
};
|
|
9
|
+
export function createKeyboardPlugin(options = {}) {
|
|
10
|
+
const mergedOptions = { ...defaultOptions, ...options };
|
|
11
|
+
return {
|
|
12
|
+
id: "keyboard",
|
|
13
|
+
name: "Keyboard",
|
|
14
|
+
install(_flow) {
|
|
15
|
+
console.log("Keyboard plugin installed", mergedOptions);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|