@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,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.bfs = bfs;
|
|
7
|
+
exports.dfs = dfs;
|
|
8
|
+
exports.findAllPaths = findAllPaths;
|
|
9
|
+
exports.findConnectedComponents = findConnectedComponents;
|
|
10
|
+
exports.hasCycle = hasCycle;
|
|
11
|
+
exports.topologicalSort = topologicalSort;
|
|
12
|
+
function hasCycle(edges, startNodeId, visited = /* @__PURE__ */new Set(), recursionStack = /* @__PURE__ */new Set()) {
|
|
13
|
+
visited.add(startNodeId);
|
|
14
|
+
recursionStack.add(startNodeId);
|
|
15
|
+
const outgoingEdges = edges.filter(e => e.source === startNodeId);
|
|
16
|
+
for (const edge of outgoingEdges) {
|
|
17
|
+
if (!visited.has(edge.target)) {
|
|
18
|
+
if (hasCycle(edges, edge.target, visited, recursionStack)) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
} else if (recursionStack.has(edge.target)) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
recursionStack.delete(startNodeId);
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
function topologicalSort(nodes, edges) {
|
|
29
|
+
const inDegree = /* @__PURE__ */new Map();
|
|
30
|
+
const adjacency = /* @__PURE__ */new Map();
|
|
31
|
+
for (const node of nodes) {
|
|
32
|
+
inDegree.set(node.id, 0);
|
|
33
|
+
adjacency.set(node.id, []);
|
|
34
|
+
}
|
|
35
|
+
for (const edge of edges) {
|
|
36
|
+
const current = inDegree.get(edge.target) || 0;
|
|
37
|
+
inDegree.set(edge.target, current + 1);
|
|
38
|
+
const adj = adjacency.get(edge.source) || [];
|
|
39
|
+
adj.push(edge.target);
|
|
40
|
+
adjacency.set(edge.source, adj);
|
|
41
|
+
}
|
|
42
|
+
const queue = [];
|
|
43
|
+
for (const [nodeId, degree] of inDegree) {
|
|
44
|
+
if (degree === 0) {
|
|
45
|
+
queue.push(nodeId);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const result = [];
|
|
49
|
+
while (queue.length > 0) {
|
|
50
|
+
const nodeId = queue.shift();
|
|
51
|
+
result.push(nodeId);
|
|
52
|
+
const neighbors = adjacency.get(nodeId) || [];
|
|
53
|
+
for (const neighbor of neighbors) {
|
|
54
|
+
const degree = inDegree.get(neighbor) - 1;
|
|
55
|
+
inDegree.set(neighbor, degree);
|
|
56
|
+
if (degree === 0) {
|
|
57
|
+
queue.push(neighbor);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
function findAllPaths(edges, startId, endId) {
|
|
64
|
+
const adjacency = /* @__PURE__ */new Map();
|
|
65
|
+
for (const edge of edges) {
|
|
66
|
+
const adj = adjacency.get(edge.source) || [];
|
|
67
|
+
adj.push(edge.target);
|
|
68
|
+
adjacency.set(edge.source, adj);
|
|
69
|
+
}
|
|
70
|
+
const paths = [];
|
|
71
|
+
const currentPath = [];
|
|
72
|
+
function dfs2(node) {
|
|
73
|
+
currentPath.push(node);
|
|
74
|
+
if (node === endId) {
|
|
75
|
+
paths.push([...currentPath]);
|
|
76
|
+
} else {
|
|
77
|
+
const neighbors = adjacency.get(node) || [];
|
|
78
|
+
for (const neighbor of neighbors) {
|
|
79
|
+
if (!currentPath.includes(neighbor)) {
|
|
80
|
+
dfs2(neighbor);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
currentPath.pop();
|
|
85
|
+
}
|
|
86
|
+
dfs2(startId);
|
|
87
|
+
return paths;
|
|
88
|
+
}
|
|
89
|
+
function findConnectedComponents(nodes, edges) {
|
|
90
|
+
const adjacency = /* @__PURE__ */new Map();
|
|
91
|
+
for (const node of nodes) {
|
|
92
|
+
adjacency.set(node.id, []);
|
|
93
|
+
}
|
|
94
|
+
for (const edge of edges) {
|
|
95
|
+
const sourceAdj = adjacency.get(edge.source) || [];
|
|
96
|
+
sourceAdj.push(edge.target);
|
|
97
|
+
adjacency.set(edge.source, sourceAdj);
|
|
98
|
+
const targetAdj = adjacency.get(edge.target) || [];
|
|
99
|
+
targetAdj.push(edge.source);
|
|
100
|
+
adjacency.set(edge.target, targetAdj);
|
|
101
|
+
}
|
|
102
|
+
const visited = /* @__PURE__ */new Set();
|
|
103
|
+
const components = [];
|
|
104
|
+
for (const node of nodes) {
|
|
105
|
+
if (!visited.has(node.id)) {
|
|
106
|
+
const component = [];
|
|
107
|
+
const queue = [node.id];
|
|
108
|
+
while (queue.length > 0) {
|
|
109
|
+
const current = queue.shift();
|
|
110
|
+
if (!visited.has(current)) {
|
|
111
|
+
visited.add(current);
|
|
112
|
+
component.push(current);
|
|
113
|
+
const neighbors = adjacency.get(current) || [];
|
|
114
|
+
for (const neighbor of neighbors) {
|
|
115
|
+
if (!visited.has(neighbor)) {
|
|
116
|
+
queue.push(neighbor);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
components.push(component);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return components;
|
|
125
|
+
}
|
|
126
|
+
function bfs(adjacency, startId) {
|
|
127
|
+
const visited = /* @__PURE__ */new Set([startId]);
|
|
128
|
+
const queue = [startId];
|
|
129
|
+
const result = [];
|
|
130
|
+
while (queue.length > 0) {
|
|
131
|
+
const node = queue.shift();
|
|
132
|
+
result.push(node);
|
|
133
|
+
const neighbors = adjacency.get(node) || [];
|
|
134
|
+
for (const neighbor of neighbors) {
|
|
135
|
+
if (!visited.has(neighbor)) {
|
|
136
|
+
visited.add(neighbor);
|
|
137
|
+
queue.push(neighbor);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
function dfs(adjacency, startId) {
|
|
144
|
+
const visited = /* @__PURE__ */new Set();
|
|
145
|
+
const result = [];
|
|
146
|
+
function _dfs(node) {
|
|
147
|
+
visited.add(node);
|
|
148
|
+
result.push(node);
|
|
149
|
+
const neighbors = adjacency.get(node) || [];
|
|
150
|
+
for (const neighbor of neighbors) {
|
|
151
|
+
if (!visited.has(neighbor)) {
|
|
152
|
+
_dfs(neighbor);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
_dfs(startId);
|
|
157
|
+
return result;
|
|
158
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 检查图中是否存在环
|
|
3
|
+
*/
|
|
4
|
+
export declare function hasCycle(edges: {
|
|
5
|
+
source: string;
|
|
6
|
+
target: string;
|
|
7
|
+
}[], startNodeId: string, visited?: Set<string>, recursionStack?: Set<string>): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* 拓扑排序
|
|
10
|
+
*/
|
|
11
|
+
export declare function topologicalSort(nodes: {
|
|
12
|
+
id: string;
|
|
13
|
+
}[], edges: {
|
|
14
|
+
source: string;
|
|
15
|
+
target: string;
|
|
16
|
+
}[]): string[];
|
|
17
|
+
/**
|
|
18
|
+
* 查找两个节点之间的所有路径
|
|
19
|
+
*/
|
|
20
|
+
export declare function findAllPaths(edges: {
|
|
21
|
+
source: string;
|
|
22
|
+
target: string;
|
|
23
|
+
}[], startId: string, endId: string): string[][];
|
|
24
|
+
/**
|
|
25
|
+
* 查找图中所有连通分量
|
|
26
|
+
*/
|
|
27
|
+
export declare function findConnectedComponents(nodes: {
|
|
28
|
+
id: string;
|
|
29
|
+
}[], edges: {
|
|
30
|
+
source: string;
|
|
31
|
+
target: string;
|
|
32
|
+
}[]): string[][];
|
|
33
|
+
/**
|
|
34
|
+
* 广度优先搜索
|
|
35
|
+
*/
|
|
36
|
+
export declare function bfs(adjacency: Map<string, string[]>, startId: string): string[];
|
|
37
|
+
/**
|
|
38
|
+
* 深度优先搜索
|
|
39
|
+
*/
|
|
40
|
+
export declare function dfs(adjacency: Map<string, string[]>, startId: string): string[];
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
export function hasCycle(edges, startNodeId, visited = /* @__PURE__ */ new Set(), recursionStack = /* @__PURE__ */ new Set()) {
|
|
2
|
+
visited.add(startNodeId);
|
|
3
|
+
recursionStack.add(startNodeId);
|
|
4
|
+
const outgoingEdges = edges.filter((e) => e.source === startNodeId);
|
|
5
|
+
for (const edge of outgoingEdges) {
|
|
6
|
+
if (!visited.has(edge.target)) {
|
|
7
|
+
if (hasCycle(edges, edge.target, visited, recursionStack)) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
} else if (recursionStack.has(edge.target)) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
recursionStack.delete(startNodeId);
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
export function topologicalSort(nodes, edges) {
|
|
18
|
+
const inDegree = /* @__PURE__ */ new Map();
|
|
19
|
+
const adjacency = /* @__PURE__ */ new Map();
|
|
20
|
+
for (const node of nodes) {
|
|
21
|
+
inDegree.set(node.id, 0);
|
|
22
|
+
adjacency.set(node.id, []);
|
|
23
|
+
}
|
|
24
|
+
for (const edge of edges) {
|
|
25
|
+
const current = inDegree.get(edge.target) || 0;
|
|
26
|
+
inDegree.set(edge.target, current + 1);
|
|
27
|
+
const adj = adjacency.get(edge.source) || [];
|
|
28
|
+
adj.push(edge.target);
|
|
29
|
+
adjacency.set(edge.source, adj);
|
|
30
|
+
}
|
|
31
|
+
const queue = [];
|
|
32
|
+
for (const [nodeId, degree] of inDegree) {
|
|
33
|
+
if (degree === 0) {
|
|
34
|
+
queue.push(nodeId);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const result = [];
|
|
38
|
+
while (queue.length > 0) {
|
|
39
|
+
const nodeId = queue.shift();
|
|
40
|
+
result.push(nodeId);
|
|
41
|
+
const neighbors = adjacency.get(nodeId) || [];
|
|
42
|
+
for (const neighbor of neighbors) {
|
|
43
|
+
const degree = inDegree.get(neighbor) - 1;
|
|
44
|
+
inDegree.set(neighbor, degree);
|
|
45
|
+
if (degree === 0) {
|
|
46
|
+
queue.push(neighbor);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
export function findAllPaths(edges, startId, endId) {
|
|
53
|
+
const adjacency = /* @__PURE__ */ new Map();
|
|
54
|
+
for (const edge of edges) {
|
|
55
|
+
const adj = adjacency.get(edge.source) || [];
|
|
56
|
+
adj.push(edge.target);
|
|
57
|
+
adjacency.set(edge.source, adj);
|
|
58
|
+
}
|
|
59
|
+
const paths = [];
|
|
60
|
+
const currentPath = [];
|
|
61
|
+
function dfs2(node) {
|
|
62
|
+
currentPath.push(node);
|
|
63
|
+
if (node === endId) {
|
|
64
|
+
paths.push([...currentPath]);
|
|
65
|
+
} else {
|
|
66
|
+
const neighbors = adjacency.get(node) || [];
|
|
67
|
+
for (const neighbor of neighbors) {
|
|
68
|
+
if (!currentPath.includes(neighbor)) {
|
|
69
|
+
dfs2(neighbor);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
currentPath.pop();
|
|
74
|
+
}
|
|
75
|
+
dfs2(startId);
|
|
76
|
+
return paths;
|
|
77
|
+
}
|
|
78
|
+
export function findConnectedComponents(nodes, edges) {
|
|
79
|
+
const adjacency = /* @__PURE__ */ new Map();
|
|
80
|
+
for (const node of nodes) {
|
|
81
|
+
adjacency.set(node.id, []);
|
|
82
|
+
}
|
|
83
|
+
for (const edge of edges) {
|
|
84
|
+
const sourceAdj = adjacency.get(edge.source) || [];
|
|
85
|
+
sourceAdj.push(edge.target);
|
|
86
|
+
adjacency.set(edge.source, sourceAdj);
|
|
87
|
+
const targetAdj = adjacency.get(edge.target) || [];
|
|
88
|
+
targetAdj.push(edge.source);
|
|
89
|
+
adjacency.set(edge.target, targetAdj);
|
|
90
|
+
}
|
|
91
|
+
const visited = /* @__PURE__ */ new Set();
|
|
92
|
+
const components = [];
|
|
93
|
+
for (const node of nodes) {
|
|
94
|
+
if (!visited.has(node.id)) {
|
|
95
|
+
const component = [];
|
|
96
|
+
const queue = [node.id];
|
|
97
|
+
while (queue.length > 0) {
|
|
98
|
+
const current = queue.shift();
|
|
99
|
+
if (!visited.has(current)) {
|
|
100
|
+
visited.add(current);
|
|
101
|
+
component.push(current);
|
|
102
|
+
const neighbors = adjacency.get(current) || [];
|
|
103
|
+
for (const neighbor of neighbors) {
|
|
104
|
+
if (!visited.has(neighbor)) {
|
|
105
|
+
queue.push(neighbor);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
components.push(component);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return components;
|
|
114
|
+
}
|
|
115
|
+
export function bfs(adjacency, startId) {
|
|
116
|
+
const visited = /* @__PURE__ */ new Set([startId]);
|
|
117
|
+
const queue = [startId];
|
|
118
|
+
const result = [];
|
|
119
|
+
while (queue.length > 0) {
|
|
120
|
+
const node = queue.shift();
|
|
121
|
+
result.push(node);
|
|
122
|
+
const neighbors = adjacency.get(node) || [];
|
|
123
|
+
for (const neighbor of neighbors) {
|
|
124
|
+
if (!visited.has(neighbor)) {
|
|
125
|
+
visited.add(neighbor);
|
|
126
|
+
queue.push(neighbor);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
export function dfs(adjacency, startId) {
|
|
133
|
+
const visited = /* @__PURE__ */ new Set();
|
|
134
|
+
const result = [];
|
|
135
|
+
function _dfs(node) {
|
|
136
|
+
visited.add(node);
|
|
137
|
+
result.push(node);
|
|
138
|
+
const neighbors = adjacency.get(node) || [];
|
|
139
|
+
for (const neighbor of neighbors) {
|
|
140
|
+
if (!visited.has(neighbor)) {
|
|
141
|
+
_dfs(neighbor);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
_dfs(startId);
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _transform = require("./transform.cjs");
|
|
7
|
+
Object.keys(_transform).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _transform[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _transform[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _edge = require("./edge.cjs");
|
|
18
|
+
Object.keys(_edge).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _edge[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _edge[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _graph = require("./graph.cjs");
|
|
29
|
+
Object.keys(_graph).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _graph[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _graph[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _geometry = require("./geometry.cjs");
|
|
40
|
+
Object.keys(_geometry).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _geometry[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _geometry[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _validation = require("./validation.cjs");
|
|
51
|
+
Object.keys(_validation).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _validation[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _validation[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _customTypes = require("./custom-types.cjs");
|
|
62
|
+
Object.keys(_customTypes).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _customTypes[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _customTypes[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var _performance = require("./performance.cjs");
|
|
73
|
+
Object.keys(_performance).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _performance[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _performance[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
var _screenshot = require("./screenshot.cjs");
|
|
84
|
+
Object.keys(_screenshot).forEach(function (key) {
|
|
85
|
+
if (key === "default" || key === "__esModule") return;
|
|
86
|
+
if (key in exports && exports[key] === _screenshot[key]) return;
|
|
87
|
+
Object.defineProperty(exports, key, {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () {
|
|
90
|
+
return _screenshot[key];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
var _bpmn = require("./bpmn.cjs");
|
|
95
|
+
Object.keys(_bpmn).forEach(function (key) {
|
|
96
|
+
if (key === "default" || key === "__esModule") return;
|
|
97
|
+
if (key in exports && exports[key] === _bpmn[key]) return;
|
|
98
|
+
Object.defineProperty(exports, key, {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function () {
|
|
101
|
+
return _bpmn[key];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
var _bpmnEngine = require("./bpmn-engine.cjs");
|
|
106
|
+
Object.keys(_bpmnEngine).forEach(function (key) {
|
|
107
|
+
if (key === "default" || key === "__esModule") return;
|
|
108
|
+
if (key in exports && exports[key] === _bpmnEngine[key]) return;
|
|
109
|
+
Object.defineProperty(exports, key, {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () {
|
|
112
|
+
return _bpmnEngine[key];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
var _theme = require("./theme.cjs");
|
|
117
|
+
Object.keys(_theme).forEach(function (key) {
|
|
118
|
+
if (key === "default" || key === "__esModule") return;
|
|
119
|
+
if (key in exports && exports[key] === _theme[key]) return;
|
|
120
|
+
Object.defineProperty(exports, key, {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () {
|
|
123
|
+
return _theme[key];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
var _collaboration = require("./collaboration.cjs");
|
|
128
|
+
Object.keys(_collaboration).forEach(function (key) {
|
|
129
|
+
if (key === "default" || key === "__esModule") return;
|
|
130
|
+
if (key in exports && exports[key] === _collaboration[key]) return;
|
|
131
|
+
Object.defineProperty(exports, key, {
|
|
132
|
+
enumerable: true,
|
|
133
|
+
get: function () {
|
|
134
|
+
return _collaboration[key];
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './transform';
|
|
2
|
+
export * from './edge';
|
|
3
|
+
export * from './graph';
|
|
4
|
+
export * from './geometry';
|
|
5
|
+
export * from './validation';
|
|
6
|
+
export * from './custom-types';
|
|
7
|
+
export * from './performance';
|
|
8
|
+
export * from './screenshot';
|
|
9
|
+
export * from './bpmn';
|
|
10
|
+
export * from './bpmn-engine';
|
|
11
|
+
export * from './theme';
|
|
12
|
+
export * from './collaboration';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./transform.mjs";
|
|
2
|
+
export * from "./edge.mjs";
|
|
3
|
+
export * from "./graph.mjs";
|
|
4
|
+
export * from "./geometry.mjs";
|
|
5
|
+
export * from "./validation.mjs";
|
|
6
|
+
export * from "./custom-types.mjs";
|
|
7
|
+
export * from "./performance.mjs";
|
|
8
|
+
export * from "./screenshot.mjs";
|
|
9
|
+
export * from "./bpmn.mjs";
|
|
10
|
+
export * from "./bpmn-engine.mjs";
|
|
11
|
+
export * from "./theme.mjs";
|
|
12
|
+
export * from "./collaboration.mjs";
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ReactiveGraph = void 0;
|
|
7
|
+
exports.clearMemoCache = clearMemoCache;
|
|
8
|
+
exports.debounce = debounce;
|
|
9
|
+
exports.generateId = generateId;
|
|
10
|
+
exports.memo = memo;
|
|
11
|
+
exports.throttle = throttle;
|
|
12
|
+
var _vue = require("vue");
|
|
13
|
+
class ReactiveGraph {
|
|
14
|
+
_nodes = (0, _vue.shallowRef)([]);
|
|
15
|
+
_edges = (0, _vue.shallowRef)([]);
|
|
16
|
+
get nodes() {
|
|
17
|
+
return this._nodes.value;
|
|
18
|
+
}
|
|
19
|
+
set nodes(value) {
|
|
20
|
+
this._nodes.value = value;
|
|
21
|
+
}
|
|
22
|
+
get edges() {
|
|
23
|
+
return this._edges.value;
|
|
24
|
+
}
|
|
25
|
+
set edges(value) {
|
|
26
|
+
this._edges.value = value;
|
|
27
|
+
}
|
|
28
|
+
// Get edges connected to a specific node
|
|
29
|
+
getConnectedEdges(nodeId) {
|
|
30
|
+
return this._edges.value.filter(e => e.source === nodeId || e.target === nodeId);
|
|
31
|
+
}
|
|
32
|
+
// Get nodes connected to a specific node
|
|
33
|
+
getConnectedNodes(nodeId) {
|
|
34
|
+
const connectedIds = /* @__PURE__ */new Set();
|
|
35
|
+
const edges = this.getConnectedEdges(nodeId);
|
|
36
|
+
for (const edge of edges) {
|
|
37
|
+
if (edge.source === nodeId) {
|
|
38
|
+
connectedIds.add(edge.target);
|
|
39
|
+
} else {
|
|
40
|
+
connectedIds.add(edge.source);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return this._nodes.value.filter(n => connectedIds.has(n.id));
|
|
44
|
+
}
|
|
45
|
+
// Batch update nodes without triggering multiple renders
|
|
46
|
+
batchUpdateNodes(updater) {
|
|
47
|
+
this._nodes.value = updater(this._nodes.value);
|
|
48
|
+
}
|
|
49
|
+
// Batch update edges without triggering multiple renders
|
|
50
|
+
batchUpdateEdges(updater) {
|
|
51
|
+
this._edges.value = updater(this._edges.value);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.ReactiveGraph = ReactiveGraph;
|
|
55
|
+
let idCounter = 0;
|
|
56
|
+
function generateId(prefix = "id") {
|
|
57
|
+
return `${prefix}-${Date.now()}-${++idCounter}`;
|
|
58
|
+
}
|
|
59
|
+
function debounce(fn, delay) {
|
|
60
|
+
let timeoutId = null;
|
|
61
|
+
return (...args) => {
|
|
62
|
+
if (timeoutId) {
|
|
63
|
+
clearTimeout(timeoutId);
|
|
64
|
+
}
|
|
65
|
+
timeoutId = setTimeout(() => {
|
|
66
|
+
fn(...args);
|
|
67
|
+
timeoutId = null;
|
|
68
|
+
}, delay);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function throttle(fn, limit) {
|
|
72
|
+
let inThrottle = false;
|
|
73
|
+
return (...args) => {
|
|
74
|
+
if (!inThrottle) {
|
|
75
|
+
fn(...args);
|
|
76
|
+
inThrottle = true;
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
inThrottle = false;
|
|
79
|
+
}, limit);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const memoCache = /* @__PURE__ */new Map();
|
|
84
|
+
function memo(key, fn) {
|
|
85
|
+
if (memoCache.has(key)) {
|
|
86
|
+
return memoCache.get(key);
|
|
87
|
+
}
|
|
88
|
+
const result = fn();
|
|
89
|
+
memoCache.set(key, result);
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
function clearMemoCache() {
|
|
93
|
+
memoCache.clear();
|
|
94
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Node, Edge } from '../types';
|
|
2
|
+
export declare class ReactiveGraph<N extends Node = Node, E extends Edge = Edge> {
|
|
3
|
+
private _nodes;
|
|
4
|
+
private _edges;
|
|
5
|
+
get nodes(): N[];
|
|
6
|
+
set nodes(value: N[]);
|
|
7
|
+
get edges(): E[];
|
|
8
|
+
set edges(value: E[]);
|
|
9
|
+
getConnectedEdges(nodeId: string): E[];
|
|
10
|
+
getConnectedNodes(nodeId: string): N[];
|
|
11
|
+
batchUpdateNodes(updater: (nodes: N[]) => N[]): void;
|
|
12
|
+
batchUpdateEdges(updater: (edges: E[]) => E[]): void;
|
|
13
|
+
}
|
|
14
|
+
export declare function generateId(prefix?: string): string;
|
|
15
|
+
export declare function debounce<T extends (...args: unknown[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void;
|
|
16
|
+
export declare function throttle<T extends (...args: unknown[]) => void>(fn: T, limit: number): (...args: Parameters<T>) => void;
|
|
17
|
+
export declare function memo<T>(key: string, fn: () => T): T;
|
|
18
|
+
export declare function clearMemoCache(): void;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { shallowRef } from "vue";
|
|
2
|
+
export class ReactiveGraph {
|
|
3
|
+
_nodes = shallowRef([]);
|
|
4
|
+
_edges = shallowRef([]);
|
|
5
|
+
get nodes() {
|
|
6
|
+
return this._nodes.value;
|
|
7
|
+
}
|
|
8
|
+
set nodes(value) {
|
|
9
|
+
this._nodes.value = value;
|
|
10
|
+
}
|
|
11
|
+
get edges() {
|
|
12
|
+
return this._edges.value;
|
|
13
|
+
}
|
|
14
|
+
set edges(value) {
|
|
15
|
+
this._edges.value = value;
|
|
16
|
+
}
|
|
17
|
+
// Get edges connected to a specific node
|
|
18
|
+
getConnectedEdges(nodeId) {
|
|
19
|
+
return this._edges.value.filter((e) => e.source === nodeId || e.target === nodeId);
|
|
20
|
+
}
|
|
21
|
+
// Get nodes connected to a specific node
|
|
22
|
+
getConnectedNodes(nodeId) {
|
|
23
|
+
const connectedIds = /* @__PURE__ */ new Set();
|
|
24
|
+
const edges = this.getConnectedEdges(nodeId);
|
|
25
|
+
for (const edge of edges) {
|
|
26
|
+
if (edge.source === nodeId) {
|
|
27
|
+
connectedIds.add(edge.target);
|
|
28
|
+
} else {
|
|
29
|
+
connectedIds.add(edge.source);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return this._nodes.value.filter((n) => connectedIds.has(n.id));
|
|
33
|
+
}
|
|
34
|
+
// Batch update nodes without triggering multiple renders
|
|
35
|
+
batchUpdateNodes(updater) {
|
|
36
|
+
this._nodes.value = updater(this._nodes.value);
|
|
37
|
+
}
|
|
38
|
+
// Batch update edges without triggering multiple renders
|
|
39
|
+
batchUpdateEdges(updater) {
|
|
40
|
+
this._edges.value = updater(this._edges.value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
let idCounter = 0;
|
|
44
|
+
export function generateId(prefix = "id") {
|
|
45
|
+
return `${prefix}-${Date.now()}-${++idCounter}`;
|
|
46
|
+
}
|
|
47
|
+
export function debounce(fn, delay) {
|
|
48
|
+
let timeoutId = null;
|
|
49
|
+
return (...args) => {
|
|
50
|
+
if (timeoutId) {
|
|
51
|
+
clearTimeout(timeoutId);
|
|
52
|
+
}
|
|
53
|
+
timeoutId = setTimeout(() => {
|
|
54
|
+
fn(...args);
|
|
55
|
+
timeoutId = null;
|
|
56
|
+
}, delay);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export function throttle(fn, limit) {
|
|
60
|
+
let inThrottle = false;
|
|
61
|
+
return (...args) => {
|
|
62
|
+
if (!inThrottle) {
|
|
63
|
+
fn(...args);
|
|
64
|
+
inThrottle = true;
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
inThrottle = false;
|
|
67
|
+
}, limit);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const memoCache = /* @__PURE__ */ new Map();
|
|
72
|
+
export function memo(key, fn) {
|
|
73
|
+
if (memoCache.has(key)) {
|
|
74
|
+
return memoCache.get(key);
|
|
75
|
+
}
|
|
76
|
+
const result = fn();
|
|
77
|
+
memoCache.set(key, result);
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
export function clearMemoCache() {
|
|
81
|
+
memoCache.clear();
|
|
82
|
+
}
|