@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.
Files changed (354) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +234 -0
  3. package/dist/Flow.d.vue.ts +306 -0
  4. package/dist/Flow.vue +959 -0
  5. package/dist/Flow.vue.d.ts +306 -0
  6. package/dist/__tests__/ai-workflow.ssr.test.cjs +352 -0
  7. package/dist/__tests__/ai-workflow.ssr.test.d.ts +1 -0
  8. package/dist/__tests__/ai-workflow.ssr.test.mjs +283 -0
  9. package/dist/__tests__/ai-workflow.test.cjs +109 -0
  10. package/dist/__tests__/ai-workflow.test.d.ts +1 -0
  11. package/dist/__tests__/ai-workflow.test.mjs +112 -0
  12. package/dist/__tests__/bpmn.ssr.test.cjs +278 -0
  13. package/dist/__tests__/bpmn.ssr.test.d.ts +1 -0
  14. package/dist/__tests__/bpmn.ssr.test.mjs +237 -0
  15. package/dist/__tests__/bpmn.test.cjs +103 -0
  16. package/dist/__tests__/bpmn.test.d.ts +1 -0
  17. package/dist/__tests__/bpmn.test.mjs +106 -0
  18. package/dist/__tests__/custom-types.test.cjs +300 -0
  19. package/dist/__tests__/custom-types.test.d.ts +1 -0
  20. package/dist/__tests__/custom-types.test.mjs +248 -0
  21. package/dist/__tests__/edge.test.cjs +56 -0
  22. package/dist/__tests__/edge.test.d.ts +1 -0
  23. package/dist/__tests__/edge.test.mjs +69 -0
  24. package/dist/__tests__/event-bus.test.cjs +80 -0
  25. package/dist/__tests__/event-bus.test.d.ts +1 -0
  26. package/dist/__tests__/event-bus.test.mjs +51 -0
  27. package/dist/__tests__/flow.ssr.test.cjs +156 -0
  28. package/dist/__tests__/flow.ssr.test.d.ts +1 -0
  29. package/dist/__tests__/flow.ssr.test.mjs +112 -0
  30. package/dist/__tests__/geometry.test.cjs +191 -0
  31. package/dist/__tests__/geometry.test.d.ts +1 -0
  32. package/dist/__tests__/geometry.test.mjs +105 -0
  33. package/dist/__tests__/graph.test.cjs +115 -0
  34. package/dist/__tests__/graph.test.d.ts +1 -0
  35. package/dist/__tests__/graph.test.mjs +85 -0
  36. package/dist/__tests__/history-plugin.test.cjs +191 -0
  37. package/dist/__tests__/history-plugin.test.d.ts +1 -0
  38. package/dist/__tests__/history-plugin.test.mjs +161 -0
  39. package/dist/__tests__/history.test.cjs +81 -0
  40. package/dist/__tests__/history.test.d.ts +1 -0
  41. package/dist/__tests__/history.test.mjs +43 -0
  42. package/dist/__tests__/layout.test.cjs +213 -0
  43. package/dist/__tests__/layout.test.d.ts +1 -0
  44. package/dist/__tests__/layout.test.mjs +170 -0
  45. package/dist/__tests__/node-edit-panel.ssr.test.cjs +168 -0
  46. package/dist/__tests__/node-edit-panel.ssr.test.d.ts +1 -0
  47. package/dist/__tests__/node-edit-panel.ssr.test.mjs +118 -0
  48. package/dist/__tests__/node-group-plugin.test.cjs +235 -0
  49. package/dist/__tests__/node-group-plugin.test.d.ts +1 -0
  50. package/dist/__tests__/node-group-plugin.test.mjs +187 -0
  51. package/dist/__tests__/node-handles.test.cjs +340 -0
  52. package/dist/__tests__/node-handles.test.d.ts +1 -0
  53. package/dist/__tests__/node-handles.test.mjs +230 -0
  54. package/dist/__tests__/plugin.test.cjs +151 -0
  55. package/dist/__tests__/plugin.test.d.ts +1 -0
  56. package/dist/__tests__/plugin.test.mjs +116 -0
  57. package/dist/__tests__/transform.test.cjs +58 -0
  58. package/dist/__tests__/transform.test.d.ts +1 -0
  59. package/dist/__tests__/transform.test.mjs +38 -0
  60. package/dist/__tests__/useAlignment.test.cjs +91 -0
  61. package/dist/__tests__/useAlignment.test.d.ts +1 -0
  62. package/dist/__tests__/useAlignment.test.mjs +52 -0
  63. package/dist/__tests__/useEdges.test.cjs +117 -0
  64. package/dist/__tests__/useEdges.test.d.ts +1 -0
  65. package/dist/__tests__/useEdges.test.mjs +80 -0
  66. package/dist/__tests__/useKeyboard.test.cjs +88 -0
  67. package/dist/__tests__/useKeyboard.test.d.ts +1 -0
  68. package/dist/__tests__/useKeyboard.test.mjs +56 -0
  69. package/dist/__tests__/useNodes.test.cjs +150 -0
  70. package/dist/__tests__/useNodes.test.d.ts +1 -0
  71. package/dist/__tests__/useNodes.test.mjs +80 -0
  72. package/dist/__tests__/useSelection.test.cjs +112 -0
  73. package/dist/__tests__/useSelection.test.d.ts +1 -0
  74. package/dist/__tests__/useSelection.test.mjs +76 -0
  75. package/dist/__tests__/useViewport.test.cjs +171 -0
  76. package/dist/__tests__/useViewport.test.d.ts +1 -0
  77. package/dist/__tests__/useViewport.test.mjs +82 -0
  78. package/dist/__tests__/utils/ssr.cjs +124 -0
  79. package/dist/__tests__/utils/ssr.d.ts +33 -0
  80. package/dist/__tests__/utils/ssr.mjs +129 -0
  81. package/dist/__tests__/validation.test.cjs +95 -0
  82. package/dist/__tests__/validation.test.d.ts +1 -0
  83. package/dist/__tests__/validation.test.mjs +36 -0
  84. package/dist/components/AiNodeEditPanel.d.vue.ts +13 -0
  85. package/dist/components/AiNodeEditPanel.vue +413 -0
  86. package/dist/components/AiNodeEditPanel.vue.d.ts +13 -0
  87. package/dist/components/EdgeEditPanel.d.vue.ts +14 -0
  88. package/dist/components/EdgeEditPanel.vue +205 -0
  89. package/dist/components/EdgeEditPanel.vue.d.ts +14 -0
  90. package/dist/components/NodeEditPanel.d.vue.ts +13 -0
  91. package/dist/components/NodeEditPanel.vue +214 -0
  92. package/dist/components/NodeEditPanel.vue.d.ts +13 -0
  93. package/dist/components/edges/BaseEdge.d.vue.ts +23 -0
  94. package/dist/components/edges/BaseEdge.vue +55 -0
  95. package/dist/components/edges/BaseEdge.vue.d.ts +23 -0
  96. package/dist/components/edges/BezierEdge.d.vue.ts +22 -0
  97. package/dist/components/edges/BezierEdge.vue +57 -0
  98. package/dist/components/edges/BezierEdge.vue.d.ts +22 -0
  99. package/dist/components/edges/DataFlowEdge.d.vue.ts +41 -0
  100. package/dist/components/edges/DataFlowEdge.vue +211 -0
  101. package/dist/components/edges/DataFlowEdge.vue.d.ts +41 -0
  102. package/dist/components/edges/SmoothEdge.d.vue.ts +22 -0
  103. package/dist/components/edges/SmoothEdge.vue +53 -0
  104. package/dist/components/edges/SmoothEdge.vue.d.ts +22 -0
  105. package/dist/components/edges/StepEdge.d.vue.ts +22 -0
  106. package/dist/components/edges/StepEdge.vue +42 -0
  107. package/dist/components/edges/StepEdge.vue.d.ts +22 -0
  108. package/dist/components/edges/index.cjs +41 -0
  109. package/dist/components/edges/index.d.ts +5 -0
  110. package/dist/components/edges/index.mjs +5 -0
  111. package/dist/components/nodes/BaseNode.d.vue.ts +25 -0
  112. package/dist/components/nodes/BaseNode.vue +93 -0
  113. package/dist/components/nodes/BaseNode.vue.d.ts +25 -0
  114. package/dist/components/nodes/CustomNode.d.vue.ts +36 -0
  115. package/dist/components/nodes/CustomNode.vue +44 -0
  116. package/dist/components/nodes/CustomNode.vue.d.ts +36 -0
  117. package/dist/components/nodes/DatabaseNode.d.vue.ts +19 -0
  118. package/dist/components/nodes/DatabaseNode.vue +62 -0
  119. package/dist/components/nodes/DatabaseNode.vue.d.ts +19 -0
  120. package/dist/components/nodes/DiamondNode.d.vue.ts +19 -0
  121. package/dist/components/nodes/DiamondNode.vue +62 -0
  122. package/dist/components/nodes/DiamondNode.vue.d.ts +19 -0
  123. package/dist/components/nodes/GroupNode.d.vue.ts +31 -0
  124. package/dist/components/nodes/GroupNode.vue +48 -0
  125. package/dist/components/nodes/GroupNode.vue.d.ts +31 -0
  126. package/dist/components/nodes/InputNode.d.vue.ts +23 -0
  127. package/dist/components/nodes/InputNode.vue +63 -0
  128. package/dist/components/nodes/InputNode.vue.d.ts +23 -0
  129. package/dist/components/nodes/NodeResizer.d.vue.ts +27 -0
  130. package/dist/components/nodes/NodeResizer.vue +89 -0
  131. package/dist/components/nodes/NodeResizer.vue.d.ts +27 -0
  132. package/dist/components/nodes/NodeToolbar.d.vue.ts +32 -0
  133. package/dist/components/nodes/NodeToolbar.vue +101 -0
  134. package/dist/components/nodes/NodeToolbar.vue.d.ts +32 -0
  135. package/dist/components/nodes/OutputNode.d.vue.ts +21 -0
  136. package/dist/components/nodes/OutputNode.vue +53 -0
  137. package/dist/components/nodes/OutputNode.vue.d.ts +21 -0
  138. package/dist/components/nodes/ai-workflow/AiAgentNode.d.vue.ts +20 -0
  139. package/dist/components/nodes/ai-workflow/AiAgentNode.vue +59 -0
  140. package/dist/components/nodes/ai-workflow/AiAgentNode.vue.d.ts +20 -0
  141. package/dist/components/nodes/ai-workflow/AiConditionNode.d.vue.ts +19 -0
  142. package/dist/components/nodes/ai-workflow/AiConditionNode.vue +65 -0
  143. package/dist/components/nodes/ai-workflow/AiConditionNode.vue.d.ts +19 -0
  144. package/dist/components/nodes/ai-workflow/AiEndNode.d.vue.ts +19 -0
  145. package/dist/components/nodes/ai-workflow/AiEndNode.vue +47 -0
  146. package/dist/components/nodes/ai-workflow/AiEndNode.vue.d.ts +19 -0
  147. package/dist/components/nodes/ai-workflow/AiLlmNode.d.vue.ts +19 -0
  148. package/dist/components/nodes/ai-workflow/AiLlmNode.vue +64 -0
  149. package/dist/components/nodes/ai-workflow/AiLlmNode.vue.d.ts +19 -0
  150. package/dist/components/nodes/ai-workflow/AiMemoryNode.d.vue.ts +19 -0
  151. package/dist/components/nodes/ai-workflow/AiMemoryNode.vue +59 -0
  152. package/dist/components/nodes/ai-workflow/AiMemoryNode.vue.d.ts +19 -0
  153. package/dist/components/nodes/ai-workflow/AiPromptNode.d.vue.ts +19 -0
  154. package/dist/components/nodes/ai-workflow/AiPromptNode.vue +61 -0
  155. package/dist/components/nodes/ai-workflow/AiPromptNode.vue.d.ts +19 -0
  156. package/dist/components/nodes/ai-workflow/AiStartNode.d.vue.ts +19 -0
  157. package/dist/components/nodes/ai-workflow/AiStartNode.vue +47 -0
  158. package/dist/components/nodes/ai-workflow/AiStartNode.vue.d.ts +19 -0
  159. package/dist/components/nodes/ai-workflow/AiToolNode.d.vue.ts +19 -0
  160. package/dist/components/nodes/ai-workflow/AiToolNode.vue +59 -0
  161. package/dist/components/nodes/ai-workflow/AiToolNode.vue.d.ts +19 -0
  162. package/dist/components/nodes/ai-workflow/index.cjs +109 -0
  163. package/dist/components/nodes/ai-workflow/index.d.ts +23 -0
  164. package/dist/components/nodes/ai-workflow/index.mjs +37 -0
  165. package/dist/components/nodes/bpmn/BpmnEndEvent.d.vue.ts +19 -0
  166. package/dist/components/nodes/bpmn/BpmnEndEvent.vue +50 -0
  167. package/dist/components/nodes/bpmn/BpmnEndEvent.vue.d.ts +19 -0
  168. package/dist/components/nodes/bpmn/BpmnExclusiveGateway.d.vue.ts +19 -0
  169. package/dist/components/nodes/bpmn/BpmnExclusiveGateway.vue +60 -0
  170. package/dist/components/nodes/bpmn/BpmnExclusiveGateway.vue.d.ts +19 -0
  171. package/dist/components/nodes/bpmn/BpmnInclusiveGateway.d.vue.ts +19 -0
  172. package/dist/components/nodes/bpmn/BpmnInclusiveGateway.vue +60 -0
  173. package/dist/components/nodes/bpmn/BpmnInclusiveGateway.vue.d.ts +19 -0
  174. package/dist/components/nodes/bpmn/BpmnParallelGateway.d.vue.ts +19 -0
  175. package/dist/components/nodes/bpmn/BpmnParallelGateway.vue +60 -0
  176. package/dist/components/nodes/bpmn/BpmnParallelGateway.vue.d.ts +19 -0
  177. package/dist/components/nodes/bpmn/BpmnServiceTask.d.vue.ts +19 -0
  178. package/dist/components/nodes/bpmn/BpmnServiceTask.vue +55 -0
  179. package/dist/components/nodes/bpmn/BpmnServiceTask.vue.d.ts +19 -0
  180. package/dist/components/nodes/bpmn/BpmnStartEvent.d.vue.ts +19 -0
  181. package/dist/components/nodes/bpmn/BpmnStartEvent.vue +50 -0
  182. package/dist/components/nodes/bpmn/BpmnStartEvent.vue.d.ts +19 -0
  183. package/dist/components/nodes/bpmn/BpmnTask.d.vue.ts +19 -0
  184. package/dist/components/nodes/bpmn/BpmnTask.vue +54 -0
  185. package/dist/components/nodes/bpmn/BpmnTask.vue.d.ts +19 -0
  186. package/dist/components/nodes/bpmn/BpmnUserTask.d.vue.ts +19 -0
  187. package/dist/components/nodes/bpmn/BpmnUserTask.vue +55 -0
  188. package/dist/components/nodes/bpmn/BpmnUserTask.vue.d.ts +19 -0
  189. package/dist/components/nodes/bpmn/index.cjs +109 -0
  190. package/dist/components/nodes/bpmn/index.d.ts +23 -0
  191. package/dist/components/nodes/bpmn/index.mjs +37 -0
  192. package/dist/components/nodes/index.cjs +246 -0
  193. package/dist/components/nodes/index.d.ts +13 -0
  194. package/dist/components/nodes/index.mjs +44 -0
  195. package/dist/core/FlowContext.cjs +21 -0
  196. package/dist/core/FlowContext.d.ts +10 -0
  197. package/dist/core/FlowContext.mjs +13 -0
  198. package/dist/core/index.cjs +104 -0
  199. package/dist/core/index.d.ts +9 -0
  200. package/dist/core/index.mjs +9 -0
  201. package/dist/core/useAlignment.cjs +81 -0
  202. package/dist/core/useAlignment.d.ts +33 -0
  203. package/dist/core/useAlignment.mjs +71 -0
  204. package/dist/core/useEdges.cjs +132 -0
  205. package/dist/core/useEdges.d.ts +29 -0
  206. package/dist/core/useEdges.mjs +89 -0
  207. package/dist/core/useFlow.cjs +40 -0
  208. package/dist/core/useFlow.d.ts +31 -0
  209. package/dist/core/useFlow.mjs +32 -0
  210. package/dist/core/useHistory.cjs +63 -0
  211. package/dist/core/useHistory.d.ts +15 -0
  212. package/dist/core/useHistory.mjs +54 -0
  213. package/dist/core/useKeyboard.cjs +54 -0
  214. package/dist/core/useKeyboard.d.ts +18 -0
  215. package/dist/core/useKeyboard.mjs +45 -0
  216. package/dist/core/useNodeDistribution.cjs +171 -0
  217. package/dist/core/useNodeDistribution.d.ts +12 -0
  218. package/dist/core/useNodeDistribution.mjs +145 -0
  219. package/dist/core/useNodes.cjs +146 -0
  220. package/dist/core/useNodes.d.ts +26 -0
  221. package/dist/core/useNodes.mjs +101 -0
  222. package/dist/core/useSelection.cjs +83 -0
  223. package/dist/core/useSelection.d.ts +18 -0
  224. package/dist/core/useSelection.mjs +53 -0
  225. package/dist/core/useViewport.cjs +157 -0
  226. package/dist/core/useViewport.d.ts +65 -0
  227. package/dist/core/useViewport.mjs +125 -0
  228. package/dist/flow.cjs +240 -0
  229. package/dist/flow.d.ts +276 -0
  230. package/dist/flow.mjs +230 -0
  231. package/dist/index.cjs +378 -0
  232. package/dist/index.d.ts +28 -0
  233. package/dist/index.mjs +50 -0
  234. package/dist/plugins/index.cjs +96 -0
  235. package/dist/plugins/index.d.ts +34 -0
  236. package/dist/plugins/index.mjs +47 -0
  237. package/dist/plugins/plugin.cjs +117 -0
  238. package/dist/plugins/plugin.d.ts +72 -0
  239. package/dist/plugins/plugin.mjs +110 -0
  240. package/dist/plugins/plugins/controls.cjs +38 -0
  241. package/dist/plugins/plugins/controls.d.ts +12 -0
  242. package/dist/plugins/plugins/controls.mjs +28 -0
  243. package/dist/plugins/plugins/export.cjs +102 -0
  244. package/dist/plugins/plugins/export.d.ts +12 -0
  245. package/dist/plugins/plugins/export.mjs +89 -0
  246. package/dist/plugins/plugins/grid.cjs +36 -0
  247. package/dist/plugins/plugins/grid.d.ts +11 -0
  248. package/dist/plugins/plugins/grid.mjs +26 -0
  249. package/dist/plugins/plugins/history.cjs +140 -0
  250. package/dist/plugins/plugins/history.d.ts +53 -0
  251. package/dist/plugins/plugins/history.mjs +132 -0
  252. package/dist/plugins/plugins/index.cjs +104 -0
  253. package/dist/plugins/plugins/index.d.ts +9 -0
  254. package/dist/plugins/plugins/index.mjs +9 -0
  255. package/dist/plugins/plugins/keyboard.cjs +27 -0
  256. package/dist/plugins/plugins/keyboard.d.ts +10 -0
  257. package/dist/plugins/plugins/keyboard.mjs +18 -0
  258. package/dist/plugins/plugins/layout.cjs +275 -0
  259. package/dist/plugins/plugins/layout.d.ts +34 -0
  260. package/dist/plugins/plugins/layout.mjs +246 -0
  261. package/dist/plugins/plugins/minimap.cjs +60 -0
  262. package/dist/plugins/plugins/minimap.d.ts +25 -0
  263. package/dist/plugins/plugins/minimap.mjs +50 -0
  264. package/dist/plugins/plugins/node-group.cjs +209 -0
  265. package/dist/plugins/plugins/node-group.d.ts +26 -0
  266. package/dist/plugins/plugins/node-group.mjs +178 -0
  267. package/dist/plugins/plugins/snap.cjs +36 -0
  268. package/dist/plugins/plugins/snap.d.ts +12 -0
  269. package/dist/plugins/plugins/snap.mjs +26 -0
  270. package/dist/renderer/AlignmentLines.d.vue.ts +5 -0
  271. package/dist/renderer/AlignmentLines.vue +113 -0
  272. package/dist/renderer/AlignmentLines.vue.d.ts +5 -0
  273. package/dist/renderer/Background.d.vue.ts +7 -0
  274. package/dist/renderer/Background.vue +86 -0
  275. package/dist/renderer/Background.vue.d.ts +7 -0
  276. package/dist/renderer/Controls.d.vue.ts +13 -0
  277. package/dist/renderer/Controls.vue +82 -0
  278. package/dist/renderer/Controls.vue.d.ts +13 -0
  279. package/dist/renderer/EdgeHandlesRenderer.d.vue.ts +11 -0
  280. package/dist/renderer/EdgeHandlesRenderer.vue +75 -0
  281. package/dist/renderer/EdgeHandlesRenderer.vue.d.ts +11 -0
  282. package/dist/renderer/EdgeRenderer.d.vue.ts +39 -0
  283. package/dist/renderer/EdgeRenderer.vue +204 -0
  284. package/dist/renderer/EdgeRenderer.vue.d.ts +39 -0
  285. package/dist/renderer/FlowBackground.d.vue.ts +11 -0
  286. package/dist/renderer/FlowBackground.vue +82 -0
  287. package/dist/renderer/FlowBackground.vue.d.ts +11 -0
  288. package/dist/renderer/Minimap.d.vue.ts +30 -0
  289. package/dist/renderer/Minimap.vue +290 -0
  290. package/dist/renderer/Minimap.vue.d.ts +30 -0
  291. package/dist/renderer/NodeRenderer.d.vue.ts +56 -0
  292. package/dist/renderer/NodeRenderer.vue +328 -0
  293. package/dist/renderer/NodeRenderer.vue.d.ts +56 -0
  294. package/dist/renderer/SelectionBox.d.vue.ts +11 -0
  295. package/dist/renderer/SelectionBox.vue +28 -0
  296. package/dist/renderer/SelectionBox.vue.d.ts +11 -0
  297. package/dist/types/edge.cjs +13 -0
  298. package/dist/types/edge.d.ts +65 -0
  299. package/dist/types/edge.mjs +6 -0
  300. package/dist/types/events.cjs +1 -0
  301. package/dist/types/events.d.ts +115 -0
  302. package/dist/types/events.mjs +0 -0
  303. package/dist/types/index.cjs +1 -0
  304. package/dist/types/index.d.ts +366 -0
  305. package/dist/types/index.mjs +0 -0
  306. package/dist/types/node.cjs +9 -0
  307. package/dist/types/node.d.ts +90 -0
  308. package/dist/types/node.mjs +3 -0
  309. package/dist/types/viewport.cjs +42 -0
  310. package/dist/types/viewport.d.ts +62 -0
  311. package/dist/types/viewport.mjs +36 -0
  312. package/dist/utils/bpmn-engine.cjs +390 -0
  313. package/dist/utils/bpmn-engine.d.ts +164 -0
  314. package/dist/utils/bpmn-engine.mjs +378 -0
  315. package/dist/utils/bpmn.cjs +492 -0
  316. package/dist/utils/bpmn.d.ts +53 -0
  317. package/dist/utils/bpmn.mjs +430 -0
  318. package/dist/utils/collaboration.cjs +537 -0
  319. package/dist/utils/collaboration.d.ts +189 -0
  320. package/dist/utils/collaboration.mjs +521 -0
  321. package/dist/utils/custom-types.cjs +138 -0
  322. package/dist/utils/custom-types.d.ts +78 -0
  323. package/dist/utils/custom-types.mjs +108 -0
  324. package/dist/utils/edge.cjs +235 -0
  325. package/dist/utils/edge.d.ts +79 -0
  326. package/dist/utils/edge.mjs +172 -0
  327. package/dist/utils/event-bus.cjs +91 -0
  328. package/dist/utils/event-bus.d.ts +39 -0
  329. package/dist/utils/event-bus.mjs +82 -0
  330. package/dist/utils/geometry.cjs +178 -0
  331. package/dist/utils/geometry.d.ts +186 -0
  332. package/dist/utils/geometry.mjs +144 -0
  333. package/dist/utils/graph.cjs +158 -0
  334. package/dist/utils/graph.d.ts +40 -0
  335. package/dist/utils/graph.mjs +147 -0
  336. package/dist/utils/index.cjs +137 -0
  337. package/dist/utils/index.d.ts +12 -0
  338. package/dist/utils/index.mjs +12 -0
  339. package/dist/utils/performance.cjs +94 -0
  340. package/dist/utils/performance.d.ts +18 -0
  341. package/dist/utils/performance.mjs +82 -0
  342. package/dist/utils/screenshot.cjs +87 -0
  343. package/dist/utils/screenshot.d.ts +22 -0
  344. package/dist/utils/screenshot.mjs +66 -0
  345. package/dist/utils/theme.cjs +228 -0
  346. package/dist/utils/theme.d.ts +92 -0
  347. package/dist/utils/theme.mjs +217 -0
  348. package/dist/utils/transform.cjs +76 -0
  349. package/dist/utils/transform.d.ts +45 -0
  350. package/dist/utils/transform.mjs +57 -0
  351. package/dist/utils/validation.cjs +107 -0
  352. package/dist/utils/validation.d.ts +29 -0
  353. package/dist/utils/validation.mjs +85 -0
  354. package/package.json +61 -0
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "PluginManager", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _plugin.PluginManager;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "createControlsPlugin", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _plugins.createControlsPlugin;
16
+ }
17
+ });
18
+ exports.createDefaultPluginSet = createDefaultPluginSet;
19
+ Object.defineProperty(exports, "createExportPlugin", {
20
+ enumerable: true,
21
+ get: function () {
22
+ return _plugins.createExportPlugin;
23
+ }
24
+ });
25
+ Object.defineProperty(exports, "createGridPlugin", {
26
+ enumerable: true,
27
+ get: function () {
28
+ return _plugins.createGridPlugin;
29
+ }
30
+ });
31
+ Object.defineProperty(exports, "createHistoryPlugin", {
32
+ enumerable: true,
33
+ get: function () {
34
+ return _plugins.createHistoryPlugin;
35
+ }
36
+ });
37
+ Object.defineProperty(exports, "createKeyboardPlugin", {
38
+ enumerable: true,
39
+ get: function () {
40
+ return _plugins.createKeyboardPlugin;
41
+ }
42
+ });
43
+ Object.defineProperty(exports, "createLayoutPlugin", {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _plugins.createLayoutPlugin;
47
+ }
48
+ });
49
+ Object.defineProperty(exports, "createMiniMapPlugin", {
50
+ enumerable: true,
51
+ get: function () {
52
+ return _plugins.createMiniMapPlugin;
53
+ }
54
+ });
55
+ Object.defineProperty(exports, "createNodeGroupPlugin", {
56
+ enumerable: true,
57
+ get: function () {
58
+ return _plugins.createNodeGroupPlugin;
59
+ }
60
+ });
61
+ Object.defineProperty(exports, "createPlugin", {
62
+ enumerable: true,
63
+ get: function () {
64
+ return _plugin.createPlugin;
65
+ }
66
+ });
67
+ Object.defineProperty(exports, "createSnapPlugin", {
68
+ enumerable: true,
69
+ get: function () {
70
+ return _plugins.createSnapPlugin;
71
+ }
72
+ });
73
+ exports.defaultPlugins = void 0;
74
+ Object.defineProperty(exports, "withHooks", {
75
+ enumerable: true,
76
+ get: function () {
77
+ return _plugin.withHooks;
78
+ }
79
+ });
80
+ var _index = require("./plugins/index.cjs");
81
+ var _plugin = require("./plugin.cjs");
82
+ var _plugins = require("./plugins/index.cjs");
83
+ const defaultPlugins = exports.defaultPlugins = {
84
+ minimap: _index.createMiniMapPlugin,
85
+ controls: _index.createControlsPlugin,
86
+ grid: _index.createGridPlugin,
87
+ snap: _index.createSnapPlugin,
88
+ keyboard: _index.createKeyboardPlugin,
89
+ export: _index.createExportPlugin,
90
+ layout: _index.createLayoutPlugin,
91
+ history: _index.createHistoryPlugin,
92
+ nodeGroup: _index.createNodeGroupPlugin
93
+ };
94
+ function createDefaultPluginSet(options) {
95
+ return [(0, _index.createMiniMapPlugin)(options?.minimap), (0, _index.createControlsPlugin)(options?.controls), (0, _index.createGridPlugin)(options?.grid), (0, _index.createSnapPlugin)(options?.snap), (0, _index.createKeyboardPlugin)(options?.keyboard), (0, _index.createExportPlugin)(options?.export), (0, _index.createLayoutPlugin)(options?.layout), (0, _index.createHistoryPlugin)(options?.history), (0, _index.createNodeGroupPlugin)(options?.nodeGroup)].filter(Boolean);
96
+ }
@@ -0,0 +1,34 @@
1
+ import { FlowPlugin } from './plugin';
2
+ import { createMiniMapPlugin, createControlsPlugin, createGridPlugin, createSnapPlugin, createKeyboardPlugin, createExportPlugin, createLayoutPlugin, createHistoryPlugin, createNodeGroupPlugin } from './plugins/index';
3
+ export type { FlowPlugin, FlowInstance, PluginHooks, PluginOptions } from './plugin';
4
+ export { PluginManager, createPlugin, withHooks } from './plugin';
5
+ export { createMiniMapPlugin, createControlsPlugin, createGridPlugin, createSnapPlugin, createKeyboardPlugin, createExportPlugin, createLayoutPlugin, createHistoryPlugin, createNodeGroupPlugin } from './plugins';
6
+ export type { MiniMapOptions as MiniMapPluginOptions, ControlsPluginOptions, GridPluginOptions, SnapPluginOptions, KeyboardOptions as KeyboardPluginOptions, ExportPluginOptions, LayoutOptions as LayoutPluginOptions, HistoryPluginOptions, FlowHistorySnapshot, NodeGroupOptions, NodeGroupInfo } from './plugins';
7
+ /**
8
+ * 默认插件预设
9
+ */
10
+ export declare const defaultPlugins: {
11
+ minimap: typeof createMiniMapPlugin;
12
+ controls: typeof createControlsPlugin;
13
+ grid: typeof createGridPlugin;
14
+ snap: typeof createSnapPlugin;
15
+ keyboard: typeof createKeyboardPlugin;
16
+ export: typeof createExportPlugin;
17
+ layout: typeof createLayoutPlugin;
18
+ history: typeof createHistoryPlugin;
19
+ nodeGroup: typeof createNodeGroupPlugin;
20
+ };
21
+ /**
22
+ * 创建完整插件集
23
+ */
24
+ export declare function createDefaultPluginSet(options?: {
25
+ minimap?: Parameters<typeof createMiniMapPlugin>[0];
26
+ controls?: Parameters<typeof createControlsPlugin>[0];
27
+ grid?: Parameters<typeof createGridPlugin>[0];
28
+ snap?: Parameters<typeof createSnapPlugin>[0];
29
+ keyboard?: Parameters<typeof createKeyboardPlugin>[0];
30
+ export?: Parameters<typeof createExportPlugin>[0];
31
+ layout?: Parameters<typeof createLayoutPlugin>[0];
32
+ history?: Parameters<typeof createHistoryPlugin>[0];
33
+ nodeGroup?: Parameters<typeof createNodeGroupPlugin>[0];
34
+ }): FlowPlugin[];
@@ -0,0 +1,47 @@
1
+ import {
2
+ createMiniMapPlugin,
3
+ createControlsPlugin,
4
+ createGridPlugin,
5
+ createSnapPlugin,
6
+ createKeyboardPlugin,
7
+ createExportPlugin,
8
+ createLayoutPlugin,
9
+ createHistoryPlugin,
10
+ createNodeGroupPlugin
11
+ } from "./plugins/index.mjs";
12
+ export { PluginManager, createPlugin, withHooks } from "./plugin.mjs";
13
+ export {
14
+ createMiniMapPlugin,
15
+ createControlsPlugin,
16
+ createGridPlugin,
17
+ createSnapPlugin,
18
+ createKeyboardPlugin,
19
+ createExportPlugin,
20
+ createLayoutPlugin,
21
+ createHistoryPlugin,
22
+ createNodeGroupPlugin
23
+ } from "./plugins/index.mjs";
24
+ export const defaultPlugins = {
25
+ minimap: createMiniMapPlugin,
26
+ controls: createControlsPlugin,
27
+ grid: createGridPlugin,
28
+ snap: createSnapPlugin,
29
+ keyboard: createKeyboardPlugin,
30
+ export: createExportPlugin,
31
+ layout: createLayoutPlugin,
32
+ history: createHistoryPlugin,
33
+ nodeGroup: createNodeGroupPlugin
34
+ };
35
+ export function createDefaultPluginSet(options) {
36
+ return [
37
+ createMiniMapPlugin(options?.minimap),
38
+ createControlsPlugin(options?.controls),
39
+ createGridPlugin(options?.grid),
40
+ createSnapPlugin(options?.snap),
41
+ createKeyboardPlugin(options?.keyboard),
42
+ createExportPlugin(options?.export),
43
+ createLayoutPlugin(options?.layout),
44
+ createHistoryPlugin(options?.history),
45
+ createNodeGroupPlugin(options?.nodeGroup)
46
+ ].filter(Boolean);
47
+ }
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PluginManager = void 0;
7
+ exports.createPlugin = createPlugin;
8
+ exports.withHooks = withHooks;
9
+ class PluginManager {
10
+ plugins = /* @__PURE__ */new Map();
11
+ flowInstance = null;
12
+ /**
13
+ * 初始化插件管理器
14
+ */
15
+ init(flow) {
16
+ this.flowInstance = flow;
17
+ }
18
+ /**
19
+ * 注册插件
20
+ */
21
+ register(plugin, options) {
22
+ if (this.plugins.has(plugin.id)) {
23
+ console.warn(`[YhFlow] Plugin ${plugin.id} is already registered, skipping...`);
24
+ return;
25
+ }
26
+ const flowInstance = this.flowInstance || options;
27
+ if (!flowInstance) {
28
+ console.error("[YhFlow] PluginManager not initialized, call init() first or provide flow instance");
29
+ return;
30
+ }
31
+ plugin.install(flowInstance, options);
32
+ this.plugins.set(plugin.id, plugin);
33
+ console.log(`[YhFlow] Plugin ${plugin.name} (${plugin.id}) registered`);
34
+ }
35
+ /**
36
+ * 卸载插件
37
+ */
38
+ unregister(pluginId) {
39
+ const plugin = this.plugins.get(pluginId);
40
+ if (!plugin) {
41
+ console.warn(`[YhFlow] Plugin ${pluginId} not found`);
42
+ return;
43
+ }
44
+ if (plugin.destroy) {
45
+ plugin.destroy();
46
+ }
47
+ this.plugins.delete(pluginId);
48
+ console.log(`[YhFlow] Plugin ${plugin.name} (${pluginId}) unregistered`);
49
+ }
50
+ /**
51
+ * 获取已注册的插件
52
+ */
53
+ getPlugin(pluginId) {
54
+ return this.plugins.get(pluginId);
55
+ }
56
+ /**
57
+ * 获取所有插件
58
+ */
59
+ getPlugins() {
60
+ return Array.from(this.plugins.values());
61
+ }
62
+ /**
63
+ * 检查插件是否已注册
64
+ */
65
+ hasPlugin(pluginId) {
66
+ return this.plugins.has(pluginId);
67
+ }
68
+ /**
69
+ * 销毁所有插件
70
+ */
71
+ destroyAll() {
72
+ this.plugins.forEach(plugin => {
73
+ if (plugin.destroy) {
74
+ plugin.destroy();
75
+ }
76
+ });
77
+ this.plugins.clear();
78
+ }
79
+ }
80
+ exports.PluginManager = PluginManager;
81
+ function createPlugin(options, install) {
82
+ return {
83
+ id: options.id,
84
+ name: options.name,
85
+ version: options.version,
86
+ description: options.description,
87
+ enabled: options.enabled ?? true,
88
+ install: flow => {
89
+ if (options.enabled !== false) {
90
+ install(flow, options);
91
+ }
92
+ }
93
+ };
94
+ }
95
+ function withHooks(plugin, hooks) {
96
+ const originalInstall = plugin.install;
97
+ return {
98
+ ...plugin,
99
+ install: (flow, options) => {
100
+ originalInstall(flow, options);
101
+ hooks.onInit?.();
102
+ if (hooks.onViewportChange) {
103
+ flow.on("viewport:change", event => hooks.onViewportChange?.(event.transform));
104
+ }
105
+ if (hooks.onNodesChange) {
106
+ flow.on("node:selected", () => hooks.onNodesChange?.(flow.nodes.value));
107
+ }
108
+ if (hooks.onEdgesChange) {
109
+ flow.on("edge:selected", () => hooks.onEdgesChange?.(flow.edges.value));
110
+ }
111
+ },
112
+ destroy: () => {
113
+ hooks.onDestroy?.();
114
+ plugin.destroy?.();
115
+ }
116
+ };
117
+ }
@@ -0,0 +1,72 @@
1
+ import type { Node, Edge, ViewportTransform, FlowInstance, FlowPlugin } from '../types';
2
+ export type { FlowInstance, FlowPlugin };
3
+ /**
4
+ * 插件生命周期钩子
5
+ */
6
+ export interface PluginHooks {
7
+ onInit?: () => void;
8
+ onDestroy?: () => void;
9
+ onViewportChange?: (viewport: ViewportTransform) => void;
10
+ onNodesChange?: (nodes: Node[]) => void;
11
+ onEdgesChange?: (edges: Edge[]) => void;
12
+ onSelectionChange?: (selectedNodes: Node[], selectedEdges: Edge[]) => void;
13
+ }
14
+ /**
15
+ * 插件配置选项
16
+ */
17
+ export interface PluginOptions {
18
+ id: string;
19
+ name: string;
20
+ version?: string;
21
+ description?: string;
22
+ enabled?: boolean;
23
+ }
24
+ /**
25
+ * 创建插件的配置工厂
26
+ */
27
+ export interface FlowPluginFactory<T = Record<string, unknown>> {
28
+ (options?: T): FlowPlugin;
29
+ }
30
+ /**
31
+ * 插件管理器 - 负责插件的注册、加载、卸载
32
+ */
33
+ export declare class PluginManager {
34
+ private plugins;
35
+ private flowInstance;
36
+ /**
37
+ * 初始化插件管理器
38
+ */
39
+ init(flow: FlowInstance): void;
40
+ /**
41
+ * 注册插件
42
+ */
43
+ register(plugin: FlowPlugin, options?: Record<string, unknown>): void;
44
+ /**
45
+ * 卸载插件
46
+ */
47
+ unregister(pluginId: string): void;
48
+ /**
49
+ * 获取已注册的插件
50
+ */
51
+ getPlugin(pluginId: string): FlowPlugin | undefined;
52
+ /**
53
+ * 获取所有插件
54
+ */
55
+ getPlugins(): FlowPlugin[];
56
+ /**
57
+ * 检查插件是否已注册
58
+ */
59
+ hasPlugin(pluginId: string): boolean;
60
+ /**
61
+ * 销毁所有插件
62
+ */
63
+ destroyAll(): void;
64
+ }
65
+ /**
66
+ * 创建插件的工厂函数
67
+ */
68
+ export declare function createPlugin<T extends PluginOptions>(options: T, install: (flow: FlowInstance, options: T) => void): FlowPlugin;
69
+ /**
70
+ * 插件高阶函数 - 添加生命周期钩子支持
71
+ */
72
+ export declare function withHooks(plugin: FlowPlugin, hooks: PluginHooks): FlowPlugin;
@@ -0,0 +1,110 @@
1
+ export class PluginManager {
2
+ plugins = /* @__PURE__ */ new Map();
3
+ flowInstance = null;
4
+ /**
5
+ * 初始化插件管理器
6
+ */
7
+ init(flow) {
8
+ this.flowInstance = flow;
9
+ }
10
+ /**
11
+ * 注册插件
12
+ */
13
+ register(plugin, options) {
14
+ if (this.plugins.has(plugin.id)) {
15
+ console.warn(`[YhFlow] Plugin ${plugin.id} is already registered, skipping...`);
16
+ return;
17
+ }
18
+ const flowInstance = this.flowInstance || options;
19
+ if (!flowInstance) {
20
+ console.error(
21
+ "[YhFlow] PluginManager not initialized, call init() first or provide flow instance"
22
+ );
23
+ return;
24
+ }
25
+ plugin.install(flowInstance, options);
26
+ this.plugins.set(plugin.id, plugin);
27
+ console.log(`[YhFlow] Plugin ${plugin.name} (${plugin.id}) registered`);
28
+ }
29
+ /**
30
+ * 卸载插件
31
+ */
32
+ unregister(pluginId) {
33
+ const plugin = this.plugins.get(pluginId);
34
+ if (!plugin) {
35
+ console.warn(`[YhFlow] Plugin ${pluginId} not found`);
36
+ return;
37
+ }
38
+ if (plugin.destroy) {
39
+ plugin.destroy();
40
+ }
41
+ this.plugins.delete(pluginId);
42
+ console.log(`[YhFlow] Plugin ${plugin.name} (${pluginId}) unregistered`);
43
+ }
44
+ /**
45
+ * 获取已注册的插件
46
+ */
47
+ getPlugin(pluginId) {
48
+ return this.plugins.get(pluginId);
49
+ }
50
+ /**
51
+ * 获取所有插件
52
+ */
53
+ getPlugins() {
54
+ return Array.from(this.plugins.values());
55
+ }
56
+ /**
57
+ * 检查插件是否已注册
58
+ */
59
+ hasPlugin(pluginId) {
60
+ return this.plugins.has(pluginId);
61
+ }
62
+ /**
63
+ * 销毁所有插件
64
+ */
65
+ destroyAll() {
66
+ this.plugins.forEach((plugin) => {
67
+ if (plugin.destroy) {
68
+ plugin.destroy();
69
+ }
70
+ });
71
+ this.plugins.clear();
72
+ }
73
+ }
74
+ export function createPlugin(options, install) {
75
+ return {
76
+ id: options.id,
77
+ name: options.name,
78
+ version: options.version,
79
+ description: options.description,
80
+ enabled: options.enabled ?? true,
81
+ install: (flow) => {
82
+ if (options.enabled !== false) {
83
+ install(flow, options);
84
+ }
85
+ }
86
+ };
87
+ }
88
+ export function withHooks(plugin, hooks) {
89
+ const originalInstall = plugin.install;
90
+ return {
91
+ ...plugin,
92
+ install: (flow, options) => {
93
+ originalInstall(flow, options);
94
+ hooks.onInit?.();
95
+ if (hooks.onViewportChange) {
96
+ flow.on("viewport:change", (event) => hooks.onViewportChange?.(event.transform));
97
+ }
98
+ if (hooks.onNodesChange) {
99
+ flow.on("node:selected", () => hooks.onNodesChange?.(flow.nodes.value));
100
+ }
101
+ if (hooks.onEdgesChange) {
102
+ flow.on("edge:selected", () => hooks.onEdgesChange?.(flow.edges.value));
103
+ }
104
+ },
105
+ destroy: () => {
106
+ hooks.onDestroy?.();
107
+ plugin.destroy?.();
108
+ }
109
+ };
110
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createControlsPlugin = createControlsPlugin;
7
+ var _vue = require("vue");
8
+ var _Controls = _interopRequireDefault(require("../../renderer/Controls.vue"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ const defaultControlsOptions = {
11
+ enabled: true,
12
+ position: "bottom-left",
13
+ showZoom: true,
14
+ showFitView: true,
15
+ showInteractive: true
16
+ };
17
+ function createControlsPlugin(options = {}) {
18
+ const mergedOptions = {
19
+ ...defaultControlsOptions,
20
+ ...options
21
+ };
22
+ return {
23
+ id: "controls",
24
+ name: "Controls",
25
+ version: "1.0.0",
26
+ description: "Displays a set of controls for zooming and fitting the view",
27
+ component: (0, _vue.markRaw)(_Controls.default),
28
+ componentProps: {
29
+ position: mergedOptions.position,
30
+ showZoom: mergedOptions.showZoom,
31
+ showFitView: mergedOptions.showFitView,
32
+ showInteractive: mergedOptions.showInteractive
33
+ },
34
+ install(_flow) {
35
+ console.log(`[Controls Plugin] Installed`);
36
+ }
37
+ };
38
+ }
@@ -0,0 +1,12 @@
1
+ import type { FlowPlugin } from '../plugin';
2
+ export interface ControlsPluginOptions {
3
+ enabled?: boolean;
4
+ position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
5
+ showZoom?: boolean;
6
+ showFitView?: boolean;
7
+ showInteractive?: boolean;
8
+ }
9
+ /**
10
+ * 创建控制栏插件
11
+ */
12
+ export declare function createControlsPlugin(options?: ControlsPluginOptions): FlowPlugin;
@@ -0,0 +1,28 @@
1
+ import { markRaw } from "vue";
2
+ import Controls from "../../renderer/Controls.vue";
3
+ const defaultControlsOptions = {
4
+ enabled: true,
5
+ position: "bottom-left",
6
+ showZoom: true,
7
+ showFitView: true,
8
+ showInteractive: true
9
+ };
10
+ export function createControlsPlugin(options = {}) {
11
+ const mergedOptions = { ...defaultControlsOptions, ...options };
12
+ return {
13
+ id: "controls",
14
+ name: "Controls",
15
+ version: "1.0.0",
16
+ description: "Displays a set of controls for zooming and fitting the view",
17
+ component: markRaw(Controls),
18
+ componentProps: {
19
+ position: mergedOptions.position,
20
+ showZoom: mergedOptions.showZoom,
21
+ showFitView: mergedOptions.showFitView,
22
+ showInteractive: mergedOptions.showInteractive
23
+ },
24
+ install(_flow) {
25
+ console.log(`[Controls Plugin] Installed`);
26
+ }
27
+ };
28
+ }
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createExportPlugin = createExportPlugin;
7
+ var _vue = require("vue");
8
+ var _screenshot = require("../../utils/screenshot.cjs");
9
+ const defaultOptions = {
10
+ enabled: true,
11
+ fileName: "flow-chart",
12
+ exportImage: true,
13
+ exportJson: true,
14
+ imageType: "png",
15
+ imageQuality: 1,
16
+ pixelRatio: 2,
17
+ backgroundColor: "#ffffff"
18
+ };
19
+ function normalizeOptions(pluginOptions, arg) {
20
+ if (arg == null) {
21
+ return {};
22
+ }
23
+ if (arg instanceof HTMLElement) {
24
+ return {
25
+ container: arg
26
+ };
27
+ }
28
+ return {
29
+ ...arg
30
+ };
31
+ }
32
+ function mergeCaptureOptions(plugin, options) {
33
+ return {
34
+ imageType: options.imageType ?? plugin.imageType,
35
+ imageQuality: options.imageQuality ?? plugin.imageQuality,
36
+ pixelRatio: options.pixelRatio ?? plugin.pixelRatio,
37
+ backgroundColor: options.backgroundColor ?? plugin.backgroundColor
38
+ };
39
+ }
40
+ function createExportPlugin(options = {}) {
41
+ const mergedOptions = {
42
+ ...defaultOptions,
43
+ ...options
44
+ };
45
+ return {
46
+ id: "export",
47
+ name: "Export",
48
+ version: "1.0.0",
49
+ description: "Provides methods to export the flow chart as JSON or Image",
50
+ install(flow) {
51
+ if (!mergedOptions.enabled) return;
52
+ if (mergedOptions.exportJson) {
53
+ flow.exportJson = () => {
54
+ return JSON.stringify({
55
+ nodes: flow.nodes.value,
56
+ edges: flow.edges.value,
57
+ viewport: flow.viewport.value
58
+ }, null, 2);
59
+ };
60
+ }
61
+ if (mergedOptions.exportImage) {
62
+ flow.exportImage = async optionsOrContainer => {
63
+ const opts = normalizeOptions(mergedOptions, optionsOrContainer);
64
+ const container = opts.container ?? flow.$el;
65
+ if (!container) {
66
+ throw new Error("[Export Plugin] No element found for export");
67
+ }
68
+ const mode = opts.mode ?? "viewport";
69
+ const download = opts.download !== false;
70
+ const copyToClipboard = opts.copyToClipboard === true;
71
+ const fileName = opts.fileName ?? mergedOptions.fileName;
72
+ const fullModePadding = opts.fullModePadding ?? 20;
73
+ let savedViewport = null;
74
+ try {
75
+ if (mode === "full") {
76
+ savedViewport = {
77
+ ...flow.getViewport()
78
+ };
79
+ flow.fitView?.({
80
+ padding: fullModePadding
81
+ });
82
+ await (0, _vue.nextTick)();
83
+ }
84
+ const captureOpts = mergeCaptureOptions(mergedOptions, opts);
85
+ const result = await (0, _screenshot.captureElement)(container, captureOpts);
86
+ if (download) {
87
+ (0, _screenshot.triggerDownload)(result.dataUrl, fileName, result.extension);
88
+ }
89
+ if (copyToClipboard) {
90
+ await (0, _screenshot.copyBlobToClipboard)(result.blob);
91
+ }
92
+ return result;
93
+ } finally {
94
+ if (savedViewport) {
95
+ flow.setViewport(savedViewport);
96
+ }
97
+ }
98
+ };
99
+ }
100
+ }
101
+ };
102
+ }
@@ -0,0 +1,12 @@
1
+ import type { FlowPlugin } from '../plugin';
2
+ export interface ExportPluginOptions {
3
+ enabled?: boolean;
4
+ fileName?: string;
5
+ exportImage?: boolean;
6
+ exportJson?: boolean;
7
+ imageType?: 'png' | 'jpeg' | 'webp';
8
+ imageQuality?: number;
9
+ pixelRatio?: number;
10
+ backgroundColor?: string;
11
+ }
12
+ export declare function createExportPlugin(options?: ExportPluginOptions): FlowPlugin;