@yh-ui/flow 1.0.26 → 1.0.36

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 (142) hide show
  1. package/package.json +6 -6
  2. package/dist/__tests__/ai-workflow.ssr.test.cjs +0 -352
  3. package/dist/__tests__/ai-workflow.ssr.test.d.ts +0 -1
  4. package/dist/__tests__/ai-workflow.ssr.test.mjs +0 -283
  5. package/dist/__tests__/ai-workflow.test.cjs +0 -109
  6. package/dist/__tests__/ai-workflow.test.d.ts +0 -1
  7. package/dist/__tests__/ai-workflow.test.mjs +0 -112
  8. package/dist/__tests__/bpmn-engine.test.cjs +0 -357
  9. package/dist/__tests__/bpmn-engine.test.d.ts +0 -1
  10. package/dist/__tests__/bpmn-engine.test.mjs +0 -406
  11. package/dist/__tests__/bpmn-utils.test.cjs +0 -268
  12. package/dist/__tests__/bpmn-utils.test.d.ts +0 -1
  13. package/dist/__tests__/bpmn-utils.test.mjs +0 -227
  14. package/dist/__tests__/bpmn-xml.test.cjs +0 -150
  15. package/dist/__tests__/bpmn-xml.test.d.ts +0 -1
  16. package/dist/__tests__/bpmn-xml.test.mjs +0 -112
  17. package/dist/__tests__/bpmn.ssr.test.cjs +0 -278
  18. package/dist/__tests__/bpmn.ssr.test.d.ts +0 -1
  19. package/dist/__tests__/bpmn.ssr.test.mjs +0 -237
  20. package/dist/__tests__/bpmn.test.cjs +0 -103
  21. package/dist/__tests__/bpmn.test.d.ts +0 -1
  22. package/dist/__tests__/bpmn.test.mjs +0 -106
  23. package/dist/__tests__/collaboration.test.cjs +0 -487
  24. package/dist/__tests__/collaboration.test.d.ts +0 -1
  25. package/dist/__tests__/collaboration.test.mjs +0 -424
  26. package/dist/__tests__/custom-types.test.cjs +0 -300
  27. package/dist/__tests__/custom-types.test.d.ts +0 -1
  28. package/dist/__tests__/custom-types.test.mjs +0 -248
  29. package/dist/__tests__/edge-types.test.cjs +0 -275
  30. package/dist/__tests__/edge-types.test.d.ts +0 -1
  31. package/dist/__tests__/edge-types.test.mjs +0 -234
  32. package/dist/__tests__/edge-utils.test.cjs +0 -375
  33. package/dist/__tests__/edge-utils.test.d.ts +0 -1
  34. package/dist/__tests__/edge-utils.test.mjs +0 -376
  35. package/dist/__tests__/edge.test.cjs +0 -56
  36. package/dist/__tests__/edge.test.d.ts +0 -1
  37. package/dist/__tests__/edge.test.mjs +0 -69
  38. package/dist/__tests__/event-bus.test.cjs +0 -80
  39. package/dist/__tests__/event-bus.test.d.ts +0 -1
  40. package/dist/__tests__/event-bus.test.mjs +0 -51
  41. package/dist/__tests__/events-types.test.cjs +0 -184
  42. package/dist/__tests__/events-types.test.d.ts +0 -1
  43. package/dist/__tests__/events-types.test.mjs +0 -184
  44. package/dist/__tests__/export-image-plugin.test.cjs +0 -142
  45. package/dist/__tests__/export-image-plugin.test.d.ts +0 -1
  46. package/dist/__tests__/export-image-plugin.test.mjs +0 -118
  47. package/dist/__tests__/export.test.cjs +0 -237
  48. package/dist/__tests__/export.test.d.ts +0 -1
  49. package/dist/__tests__/export.test.mjs +0 -171
  50. package/dist/__tests__/flow-context.test.cjs +0 -16
  51. package/dist/__tests__/flow-context.test.d.ts +0 -1
  52. package/dist/__tests__/flow-context.test.mjs +0 -16
  53. package/dist/__tests__/flow-props.test.cjs +0 -94
  54. package/dist/__tests__/flow-props.test.d.ts +0 -1
  55. package/dist/__tests__/flow-props.test.mjs +0 -92
  56. package/dist/__tests__/flow.ssr.test.cjs +0 -156
  57. package/dist/__tests__/flow.ssr.test.d.ts +0 -1
  58. package/dist/__tests__/flow.ssr.test.mjs +0 -112
  59. package/dist/__tests__/geometry.test.cjs +0 -191
  60. package/dist/__tests__/geometry.test.d.ts +0 -1
  61. package/dist/__tests__/geometry.test.mjs +0 -105
  62. package/dist/__tests__/graph.test.cjs +0 -115
  63. package/dist/__tests__/graph.test.d.ts +0 -1
  64. package/dist/__tests__/graph.test.mjs +0 -85
  65. package/dist/__tests__/history-plugin.test.cjs +0 -191
  66. package/dist/__tests__/history-plugin.test.d.ts +0 -1
  67. package/dist/__tests__/history-plugin.test.mjs +0 -161
  68. package/dist/__tests__/history.test.cjs +0 -81
  69. package/dist/__tests__/history.test.d.ts +0 -1
  70. package/dist/__tests__/history.test.mjs +0 -43
  71. package/dist/__tests__/layout-plugin.test.cjs +0 -233
  72. package/dist/__tests__/layout-plugin.test.d.ts +0 -1
  73. package/dist/__tests__/layout-plugin.test.mjs +0 -215
  74. package/dist/__tests__/layout.test.cjs +0 -213
  75. package/dist/__tests__/layout.test.d.ts +0 -1
  76. package/dist/__tests__/layout.test.mjs +0 -170
  77. package/dist/__tests__/node-edit-panel.ssr.test.cjs +0 -168
  78. package/dist/__tests__/node-edit-panel.ssr.test.d.ts +0 -1
  79. package/dist/__tests__/node-edit-panel.ssr.test.mjs +0 -118
  80. package/dist/__tests__/node-group-plugin.test.cjs +0 -235
  81. package/dist/__tests__/node-group-plugin.test.d.ts +0 -1
  82. package/dist/__tests__/node-group-plugin.test.mjs +0 -187
  83. package/dist/__tests__/node-handles.test.cjs +0 -340
  84. package/dist/__tests__/node-handles.test.d.ts +0 -1
  85. package/dist/__tests__/node-handles.test.mjs +0 -230
  86. package/dist/__tests__/node-types.test.cjs +0 -368
  87. package/dist/__tests__/node-types.test.d.ts +0 -1
  88. package/dist/__tests__/node-types.test.mjs +0 -292
  89. package/dist/__tests__/performance.test.cjs +0 -313
  90. package/dist/__tests__/performance.test.d.ts +0 -1
  91. package/dist/__tests__/performance.test.mjs +0 -218
  92. package/dist/__tests__/plugin-advanced.test.cjs +0 -301
  93. package/dist/__tests__/plugin-advanced.test.d.ts +0 -1
  94. package/dist/__tests__/plugin-advanced.test.mjs +0 -225
  95. package/dist/__tests__/plugin.test.cjs +0 -151
  96. package/dist/__tests__/plugin.test.d.ts +0 -1
  97. package/dist/__tests__/plugin.test.mjs +0 -116
  98. package/dist/__tests__/plugins.test.cjs +0 -412
  99. package/dist/__tests__/plugins.test.d.ts +0 -1
  100. package/dist/__tests__/plugins.test.mjs +0 -402
  101. package/dist/__tests__/screenshot-capture.test.cjs +0 -183
  102. package/dist/__tests__/screenshot-capture.test.d.ts +0 -1
  103. package/dist/__tests__/screenshot-capture.test.mjs +0 -124
  104. package/dist/__tests__/screenshot.test.cjs +0 -74
  105. package/dist/__tests__/screenshot.test.d.ts +0 -1
  106. package/dist/__tests__/screenshot.test.mjs +0 -69
  107. package/dist/__tests__/theme.test.cjs +0 -185
  108. package/dist/__tests__/theme.test.d.ts +0 -1
  109. package/dist/__tests__/theme.test.mjs +0 -191
  110. package/dist/__tests__/transform.test.cjs +0 -384
  111. package/dist/__tests__/transform.test.d.ts +0 -1
  112. package/dist/__tests__/transform.test.mjs +0 -239
  113. package/dist/__tests__/useAlignment.test.cjs +0 -128
  114. package/dist/__tests__/useAlignment.test.d.ts +0 -1
  115. package/dist/__tests__/useAlignment.test.mjs +0 -72
  116. package/dist/__tests__/useEdges.test.cjs +0 -117
  117. package/dist/__tests__/useEdges.test.d.ts +0 -1
  118. package/dist/__tests__/useEdges.test.mjs +0 -80
  119. package/dist/__tests__/useKeyboard.test.cjs +0 -88
  120. package/dist/__tests__/useKeyboard.test.d.ts +0 -1
  121. package/dist/__tests__/useKeyboard.test.mjs +0 -56
  122. package/dist/__tests__/useNodeDistribution.test.cjs +0 -643
  123. package/dist/__tests__/useNodeDistribution.test.d.ts +0 -1
  124. package/dist/__tests__/useNodeDistribution.test.mjs +0 -297
  125. package/dist/__tests__/useNodes.test.cjs +0 -150
  126. package/dist/__tests__/useNodes.test.d.ts +0 -1
  127. package/dist/__tests__/useNodes.test.mjs +0 -80
  128. package/dist/__tests__/useSelection.test.cjs +0 -112
  129. package/dist/__tests__/useSelection.test.d.ts +0 -1
  130. package/dist/__tests__/useSelection.test.mjs +0 -76
  131. package/dist/__tests__/useViewport.test.cjs +0 -171
  132. package/dist/__tests__/useViewport.test.d.ts +0 -1
  133. package/dist/__tests__/useViewport.test.mjs +0 -82
  134. package/dist/__tests__/utils/ssr.cjs +0 -124
  135. package/dist/__tests__/utils/ssr.d.ts +0 -33
  136. package/dist/__tests__/utils/ssr.mjs +0 -129
  137. package/dist/__tests__/validation.test.cjs +0 -95
  138. package/dist/__tests__/validation.test.d.ts +0 -1
  139. package/dist/__tests__/validation.test.mjs +0 -36
  140. package/dist/__tests__/viewport-types.test.cjs +0 -324
  141. package/dist/__tests__/viewport-types.test.d.ts +0 -1
  142. package/dist/__tests__/viewport-types.test.mjs +0 -207
@@ -1,237 +0,0 @@
1
- "use strict";
2
-
3
- var _vitest = require("vitest");
4
- var _vue = require("vue");
5
- var _export = require("../plugins/plugins/export.cjs");
6
- function createMockFlowInstance() {
7
- const nodes = (0, _vue.ref)([]);
8
- const edges = (0, _vue.ref)([]);
9
- const viewport = (0, _vue.ref)({
10
- x: 0,
11
- y: 0,
12
- zoom: 1
13
- });
14
- const draggingNodeId = (0, _vue.ref)(null);
15
- return {
16
- nodes,
17
- edges,
18
- viewport,
19
- draggingNodeId,
20
- addNode: _vitest.vi.fn(),
21
- removeNode: _vitest.vi.fn(),
22
- updateNode: _vitest.vi.fn(),
23
- getNode: _vitest.vi.fn(),
24
- addEdge: _vitest.vi.fn(),
25
- removeEdge: _vitest.vi.fn(),
26
- updateEdge: _vitest.vi.fn(),
27
- getEdge: _vitest.vi.fn(),
28
- setViewport: _vitest.vi.fn(),
29
- fitView: _vitest.vi.fn(),
30
- zoomIn: _vitest.vi.fn(),
31
- zoomOut: _vitest.vi.fn(),
32
- centerView: _vitest.vi.fn(),
33
- selectNode: _vitest.vi.fn(),
34
- selectEdge: _vitest.vi.fn(),
35
- clearSelection: _vitest.vi.fn(),
36
- getNodes: _vitest.vi.fn(() => nodes.value),
37
- getEdges: _vitest.vi.fn(() => edges.value),
38
- getViewport: _vitest.vi.fn(() => viewport.value),
39
- screenToCanvas: _vitest.vi.fn(),
40
- canvasToScreen: _vitest.vi.fn(),
41
- on: _vitest.vi.fn(),
42
- off: _vitest.vi.fn(),
43
- emit: _vitest.vi.fn(),
44
- isValidConnection: _vitest.vi.fn(() => true),
45
- $el: void 0,
46
- usePlugin: _vitest.vi.fn(),
47
- removePlugin: _vitest.vi.fn()
48
- };
49
- }
50
- (0, _vitest.describe)("flow/plugins/plugins/export", () => {
51
- let consoleLogSpy;
52
- (0, _vitest.beforeEach)(() => {
53
- consoleLogSpy = _vitest.vi.spyOn(console, "log").mockImplementation(() => {});
54
- _vitest.vi.useFakeTimers({
55
- shouldAdvanceTime: false
56
- });
57
- });
58
- (0, _vitest.afterEach)(() => {
59
- consoleLogSpy.mockRestore();
60
- _vitest.vi.useRealTimers();
61
- });
62
- (0, _vitest.describe)("createExportPlugin", () => {
63
- (0, _vitest.it)("should create plugin with correct id and name", () => {
64
- const plugin = (0, _export.createExportPlugin)();
65
- (0, _vitest.expect)(plugin.id).toBe("export");
66
- (0, _vitest.expect)(plugin.name).toBe("Export");
67
- });
68
- (0, _vitest.it)("should install exportJson method", () => {
69
- const flow = createMockFlowInstance();
70
- flow.nodes.value = [{
71
- id: "n1",
72
- type: "default",
73
- position: {
74
- x: 0,
75
- y: 0
76
- },
77
- data: {
78
- label: "Node 1"
79
- }
80
- }];
81
- flow.edges.value = [{
82
- id: "e1",
83
- source: "n1",
84
- target: "n2",
85
- type: "default"
86
- }];
87
- const plugin = (0, _export.createExportPlugin)();
88
- plugin.install(flow);
89
- (0, _vitest.expect)(typeof flow.exportJson).toBe("function");
90
- });
91
- (0, _vitest.it)("should exportJson return correct JSON structure", () => {
92
- const flow = createMockFlowInstance();
93
- const testNode = {
94
- id: "n1",
95
- type: "default",
96
- position: {
97
- x: 100,
98
- y: 200
99
- },
100
- data: {}
101
- };
102
- flow.nodes.value = [testNode];
103
- flow.edges.value = [{
104
- id: "e1",
105
- source: "n1",
106
- target: "n2",
107
- type: "default"
108
- }];
109
- const plugin = (0, _export.createExportPlugin)();
110
- plugin.install(flow);
111
- const json = flow.exportJson();
112
- const parsed = JSON.parse(json);
113
- (0, _vitest.expect)(parsed.nodes).toHaveLength(1);
114
- (0, _vitest.expect)(parsed.edges).toHaveLength(1);
115
- (0, _vitest.expect)(parsed.nodes[0].id).toBe("n1");
116
- });
117
- (0, _vitest.it)("should exportJson with formatted output", () => {
118
- const flow = createMockFlowInstance();
119
- flow.nodes.value = [];
120
- flow.edges.value = [];
121
- const plugin = (0, _export.createExportPlugin)();
122
- plugin.install(flow);
123
- const json = flow.exportJson();
124
- (0, _vitest.expect)(json).toContain("\n");
125
- });
126
- (0, _vitest.it)("should include viewport in exportJson", () => {
127
- const flow = createMockFlowInstance();
128
- flow.viewport.value = {
129
- x: 50,
130
- y: 100,
131
- zoom: 1.5
132
- };
133
- const plugin = (0, _export.createExportPlugin)();
134
- plugin.install(flow);
135
- const json = flow.exportJson();
136
- const parsed = JSON.parse(json);
137
- (0, _vitest.expect)(parsed.viewport).toEqual({
138
- x: 50,
139
- y: 100,
140
- zoom: 1.5
141
- });
142
- });
143
- (0, _vitest.it)("should support custom fileName option", () => {
144
- const plugin = (0, _export.createExportPlugin)({
145
- fileName: "custom-flow-name"
146
- });
147
- (0, _vitest.expect)(plugin.id).toBe("export");
148
- });
149
- (0, _vitest.it)("should support different image types", () => {
150
- const pluginPng = (0, _export.createExportPlugin)({
151
- imageType: "png"
152
- });
153
- const pluginJpeg = (0, _export.createExportPlugin)({
154
- imageType: "jpeg"
155
- });
156
- const pluginWebp = (0, _export.createExportPlugin)({
157
- imageType: "webp"
158
- });
159
- (0, _vitest.expect)(pluginPng.id).toBe("export");
160
- (0, _vitest.expect)(pluginJpeg.id).toBe("export");
161
- (0, _vitest.expect)(pluginWebp.id).toBe("export");
162
- });
163
- (0, _vitest.it)("should support custom imageQuality", () => {
164
- const plugin = (0, _export.createExportPlugin)({
165
- imageQuality: 0.8
166
- });
167
- (0, _vitest.expect)(plugin.id).toBe("export");
168
- });
169
- (0, _vitest.it)("should support custom pixelRatio", () => {
170
- const plugin = (0, _export.createExportPlugin)({
171
- pixelRatio: 3
172
- });
173
- (0, _vitest.expect)(plugin.id).toBe("export");
174
- });
175
- (0, _vitest.it)("should support custom backgroundColor", () => {
176
- const plugin = (0, _export.createExportPlugin)({
177
- backgroundColor: "#f0f0f0"
178
- });
179
- (0, _vitest.expect)(plugin.id).toBe("export");
180
- });
181
- (0, _vitest.it)("should support exportImage disabled", () => {
182
- const plugin = (0, _export.createExportPlugin)({
183
- exportImage: false
184
- });
185
- const flow = createMockFlowInstance();
186
- plugin.install(flow);
187
- (0, _vitest.expect)(flow.exportImage).toBeUndefined();
188
- });
189
- (0, _vitest.it)("should support exportJson disabled", () => {
190
- const plugin = (0, _export.createExportPlugin)({
191
- exportJson: false
192
- });
193
- const flow = createMockFlowInstance();
194
- plugin.install(flow);
195
- (0, _vitest.expect)(flow.exportJson).toBeUndefined();
196
- });
197
- (0, _vitest.it)("should not install when enabled is false", () => {
198
- const plugin = (0, _export.createExportPlugin)({
199
- enabled: false
200
- });
201
- const flow = createMockFlowInstance();
202
- plugin.install(flow);
203
- (0, _vitest.expect)(flow.exportJson).toBeUndefined();
204
- (0, _vitest.expect)(flow.exportImage).toBeUndefined();
205
- });
206
- (0, _vitest.it)("should merge default options with provided options", () => {
207
- const plugin = (0, _export.createExportPlugin)({
208
- fileName: "test",
209
- imageType: "jpeg"
210
- });
211
- (0, _vitest.expect)(plugin.id).toBe("export");
212
- (0, _vitest.expect)(plugin.name).toBe("Export");
213
- });
214
- });
215
- (0, _vitest.describe)("ExportPluginOptions interface", () => {
216
- (0, _vitest.it)("should accept all option fields", () => {
217
- const options = {
218
- enabled: true,
219
- fileName: "my-flow",
220
- exportImage: true,
221
- exportJson: true,
222
- imageType: "png",
223
- imageQuality: 0.9,
224
- pixelRatio: 2,
225
- backgroundColor: "#ffffff"
226
- };
227
- const plugin = (0, _export.createExportPlugin)(options);
228
- (0, _vitest.expect)(plugin.id).toBe("export");
229
- });
230
- (0, _vitest.it)("should accept partial options", () => {
231
- const plugin = (0, _export.createExportPlugin)({
232
- fileName: "partial"
233
- });
234
- (0, _vitest.expect)(plugin.id).toBe("export");
235
- });
236
- });
237
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,171 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
2
- import { ref } from "vue";
3
- import { createExportPlugin } from "../plugins/plugins/export.mjs";
4
- function createMockFlowInstance() {
5
- const nodes = ref([]);
6
- const edges = ref([]);
7
- const viewport = ref({ x: 0, y: 0, zoom: 1 });
8
- const draggingNodeId = ref(null);
9
- return {
10
- nodes,
11
- edges,
12
- viewport,
13
- draggingNodeId,
14
- addNode: vi.fn(),
15
- removeNode: vi.fn(),
16
- updateNode: vi.fn(),
17
- getNode: vi.fn(),
18
- addEdge: vi.fn(),
19
- removeEdge: vi.fn(),
20
- updateEdge: vi.fn(),
21
- getEdge: vi.fn(),
22
- setViewport: vi.fn(),
23
- fitView: vi.fn(),
24
- zoomIn: vi.fn(),
25
- zoomOut: vi.fn(),
26
- centerView: vi.fn(),
27
- selectNode: vi.fn(),
28
- selectEdge: vi.fn(),
29
- clearSelection: vi.fn(),
30
- getNodes: vi.fn(() => nodes.value),
31
- getEdges: vi.fn(() => edges.value),
32
- getViewport: vi.fn(() => viewport.value),
33
- screenToCanvas: vi.fn(),
34
- canvasToScreen: vi.fn(),
35
- on: vi.fn(),
36
- off: vi.fn(),
37
- emit: vi.fn(),
38
- isValidConnection: vi.fn(() => true),
39
- $el: void 0,
40
- usePlugin: vi.fn(),
41
- removePlugin: vi.fn()
42
- };
43
- }
44
- describe("flow/plugins/plugins/export", () => {
45
- let consoleLogSpy;
46
- beforeEach(() => {
47
- consoleLogSpy = vi.spyOn(console, "log").mockImplementation(() => {
48
- });
49
- vi.useFakeTimers({ shouldAdvanceTime: false });
50
- });
51
- afterEach(() => {
52
- consoleLogSpy.mockRestore();
53
- vi.useRealTimers();
54
- });
55
- describe("createExportPlugin", () => {
56
- it("should create plugin with correct id and name", () => {
57
- const plugin = createExportPlugin();
58
- expect(plugin.id).toBe("export");
59
- expect(plugin.name).toBe("Export");
60
- });
61
- it("should install exportJson method", () => {
62
- const flow = createMockFlowInstance();
63
- flow.nodes.value = [
64
- { id: "n1", type: "default", position: { x: 0, y: 0 }, data: { label: "Node 1" } }
65
- ];
66
- flow.edges.value = [{ id: "e1", source: "n1", target: "n2", type: "default" }];
67
- const plugin = createExportPlugin();
68
- plugin.install(flow);
69
- expect(typeof flow.exportJson).toBe("function");
70
- });
71
- it("should exportJson return correct JSON structure", () => {
72
- const flow = createMockFlowInstance();
73
- const testNode = { id: "n1", type: "default", position: { x: 100, y: 200 }, data: {} };
74
- flow.nodes.value = [testNode];
75
- flow.edges.value = [{ id: "e1", source: "n1", target: "n2", type: "default" }];
76
- const plugin = createExportPlugin();
77
- plugin.install(flow);
78
- const json = flow.exportJson();
79
- const parsed = JSON.parse(json);
80
- expect(parsed.nodes).toHaveLength(1);
81
- expect(parsed.edges).toHaveLength(1);
82
- expect(parsed.nodes[0].id).toBe("n1");
83
- });
84
- it("should exportJson with formatted output", () => {
85
- const flow = createMockFlowInstance();
86
- flow.nodes.value = [];
87
- flow.edges.value = [];
88
- const plugin = createExportPlugin();
89
- plugin.install(flow);
90
- const json = flow.exportJson();
91
- expect(json).toContain("\n");
92
- });
93
- it("should include viewport in exportJson", () => {
94
- const flow = createMockFlowInstance();
95
- flow.viewport.value = { x: 50, y: 100, zoom: 1.5 };
96
- const plugin = createExportPlugin();
97
- plugin.install(flow);
98
- const json = flow.exportJson();
99
- const parsed = JSON.parse(json);
100
- expect(parsed.viewport).toEqual({ x: 50, y: 100, zoom: 1.5 });
101
- });
102
- it("should support custom fileName option", () => {
103
- const plugin = createExportPlugin({ fileName: "custom-flow-name" });
104
- expect(plugin.id).toBe("export");
105
- });
106
- it("should support different image types", () => {
107
- const pluginPng = createExportPlugin({ imageType: "png" });
108
- const pluginJpeg = createExportPlugin({ imageType: "jpeg" });
109
- const pluginWebp = createExportPlugin({ imageType: "webp" });
110
- expect(pluginPng.id).toBe("export");
111
- expect(pluginJpeg.id).toBe("export");
112
- expect(pluginWebp.id).toBe("export");
113
- });
114
- it("should support custom imageQuality", () => {
115
- const plugin = createExportPlugin({ imageQuality: 0.8 });
116
- expect(plugin.id).toBe("export");
117
- });
118
- it("should support custom pixelRatio", () => {
119
- const plugin = createExportPlugin({ pixelRatio: 3 });
120
- expect(plugin.id).toBe("export");
121
- });
122
- it("should support custom backgroundColor", () => {
123
- const plugin = createExportPlugin({ backgroundColor: "#f0f0f0" });
124
- expect(plugin.id).toBe("export");
125
- });
126
- it("should support exportImage disabled", () => {
127
- const plugin = createExportPlugin({ exportImage: false });
128
- const flow = createMockFlowInstance();
129
- plugin.install(flow);
130
- expect(flow.exportImage).toBeUndefined();
131
- });
132
- it("should support exportJson disabled", () => {
133
- const plugin = createExportPlugin({ exportJson: false });
134
- const flow = createMockFlowInstance();
135
- plugin.install(flow);
136
- expect(flow.exportJson).toBeUndefined();
137
- });
138
- it("should not install when enabled is false", () => {
139
- const plugin = createExportPlugin({ enabled: false });
140
- const flow = createMockFlowInstance();
141
- plugin.install(flow);
142
- expect(flow.exportJson).toBeUndefined();
143
- expect(flow.exportImage).toBeUndefined();
144
- });
145
- it("should merge default options with provided options", () => {
146
- const plugin = createExportPlugin({ fileName: "test", imageType: "jpeg" });
147
- expect(plugin.id).toBe("export");
148
- expect(plugin.name).toBe("Export");
149
- });
150
- });
151
- describe("ExportPluginOptions interface", () => {
152
- it("should accept all option fields", () => {
153
- const options = {
154
- enabled: true,
155
- fileName: "my-flow",
156
- exportImage: true,
157
- exportJson: true,
158
- imageType: "png",
159
- imageQuality: 0.9,
160
- pixelRatio: 2,
161
- backgroundColor: "#ffffff"
162
- };
163
- const plugin = createExportPlugin(options);
164
- expect(plugin.id).toBe("export");
165
- });
166
- it("should accept partial options", () => {
167
- const plugin = createExportPlugin({ fileName: "partial" });
168
- expect(plugin.id).toBe("export");
169
- });
170
- });
171
- });
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- var _vitest = require("vitest");
4
- var _FlowContext = require("../core/FlowContext.cjs");
5
- (0, _vitest.describe)("flow/core/FlowContext", () => {
6
- (0, _vitest.describe)("provideFlowContext", () => {
7
- (0, _vitest.it)("should accept null without error", () => {
8
- (0, _vitest.expect)(() => (0, _FlowContext.provideFlowContext)(null)).not.toThrow();
9
- });
10
- });
11
- (0, _vitest.describe)("useFlowContext", () => {
12
- (0, _vitest.it)("should throw when used outside provider", () => {
13
- (0, _vitest.expect)(() => (0, _FlowContext.useFlowContext)()).toThrow("[YhFlow] FlowContext is not provided");
14
- });
15
- });
16
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,16 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { useFlowContext, provideFlowContext } from "../core/FlowContext.mjs";
3
- describe("flow/core/FlowContext", () => {
4
- describe("provideFlowContext", () => {
5
- it("should accept null without error", () => {
6
- expect(() => provideFlowContext(null)).not.toThrow();
7
- });
8
- });
9
- describe("useFlowContext", () => {
10
- it("should throw when used outside provider", () => {
11
- expect(() => useFlowContext()).toThrow(
12
- "[YhFlow] FlowContext is not provided"
13
- );
14
- });
15
- });
16
- });
@@ -1,94 +0,0 @@
1
- "use strict";
2
-
3
- var _vitest = require("vitest");
4
- var _flow = require("../flow.cjs");
5
- (0, _vitest.describe)("flow/flow", () => {
6
- (0, _vitest.describe)("flowProps", () => {
7
- (0, _vitest.it)("should have all required prop definitions", () => {
8
- (0, _vitest.expect)(_flow.flowProps.nodes).toBeDefined();
9
- (0, _vitest.expect)(_flow.flowProps.edges).toBeDefined();
10
- (0, _vitest.expect)(_flow.flowProps.modelValue).toBeDefined();
11
- (0, _vitest.expect)(_flow.flowProps.minZoom).toBeDefined();
12
- (0, _vitest.expect)(_flow.flowProps.maxZoom).toBeDefined();
13
- (0, _vitest.expect)(_flow.flowProps.zoomStep).toBeDefined();
14
- (0, _vitest.expect)(_flow.flowProps.nodesDraggable).toBeDefined();
15
- (0, _vitest.expect)(_flow.flowProps.edgesConnectable).toBeDefined();
16
- (0, _vitest.expect)(_flow.flowProps.selectable).toBeDefined();
17
- (0, _vitest.expect)(_flow.flowProps.background).toBeDefined();
18
- (0, _vitest.expect)(_flow.flowProps.gridSize).toBeDefined();
19
- (0, _vitest.expect)(_flow.flowProps.snapToGrid).toBeDefined();
20
- (0, _vitest.expect)(_flow.flowProps.readonly).toBeDefined();
21
- (0, _vitest.expect)(_flow.flowProps.keyboardShortcuts).toBeDefined();
22
- (0, _vitest.expect)(_flow.flowProps.showControls).toBeDefined();
23
- (0, _vitest.expect)(_flow.flowProps.showMinimap).toBeDefined();
24
- (0, _vitest.expect)(_flow.flowProps.history).toBeDefined();
25
- (0, _vitest.expect)(_flow.flowProps.maxHistory).toBeDefined();
26
- });
27
- (0, _vitest.it)("should have correct default values for numbers", () => {
28
- (0, _vitest.expect)(_flow.flowProps.minZoom.default).toBe(0.1);
29
- (0, _vitest.expect)(_flow.flowProps.maxZoom.default).toBe(5);
30
- (0, _vitest.expect)(_flow.flowProps.zoomStep.default).toBe(0.1);
31
- (0, _vitest.expect)(_flow.flowProps.panZoomSpeed.default).toBe(1);
32
- (0, _vitest.expect)(_flow.flowProps.gridSize.default).toBe(20);
33
- (0, _vitest.expect)(_flow.flowProps.maxHistory.default).toBe(50);
34
- (0, _vitest.expect)(_flow.flowProps.virtualizationThreshold.default).toBe(100);
35
- });
36
- (0, _vitest.it)("should have correct default values for booleans", () => {
37
- (0, _vitest.expect)(_flow.flowProps.nodesDraggable.default).toBe(true);
38
- (0, _vitest.expect)(_flow.flowProps.edgesConnectable.default).toBe(true);
39
- (0, _vitest.expect)(_flow.flowProps.selectable.default).toBe(true);
40
- (0, _vitest.expect)(_flow.flowProps.snapToGrid.default).toBe(false);
41
- (0, _vitest.expect)(_flow.flowProps.readonly.default).toBe(false);
42
- (0, _vitest.expect)(_flow.flowProps.keyboardShortcuts.default).toBe(true);
43
- (0, _vitest.expect)(_flow.flowProps.showControls.default).toBe(true);
44
- (0, _vitest.expect)(_flow.flowProps.showMinimap.default).toBe(false);
45
- (0, _vitest.expect)(_flow.flowProps.history.default).toBe(true);
46
- (0, _vitest.expect)(_flow.flowProps.showAlignmentGuides.default).toBe(true);
47
- (0, _vitest.expect)(_flow.flowProps.virtualized.default).toBe(false);
48
- });
49
- (0, _vitest.it)("should have correct default values for strings", () => {
50
- (0, _vitest.expect)(_flow.flowProps.background.default).toBe("dots");
51
- (0, _vitest.expect)(_flow.flowProps.backgroundColor.default).toBe("#f8f9fa");
52
- (0, _vitest.expect)(_flow.flowProps.defaultNodeType.default).toBe("default");
53
- (0, _vitest.expect)(_flow.flowProps.defaultEdgeType.default).toBe("bezier");
54
- (0, _vitest.expect)(_flow.flowProps.multiSelectKey.default).toBe("Shift");
55
- (0, _vitest.expect)(_flow.flowProps.minimapNodeColor.default).toBe("#b1b1b7");
56
- });
57
- (0, _vitest.it)("should have isValidConnection defaulting to null", () => {
58
- (0, _vitest.expect)(_flow.flowProps.isValidConnection.default).toBe(null);
59
- });
60
- (0, _vitest.it)("should have themeOverrides defaulting to undefined", () => {
61
- (0, _vitest.expect)(_flow.flowProps.themeOverrides.default).toBeUndefined();
62
- });
63
- });
64
- (0, _vitest.describe)("flowEmits", () => {
65
- (0, _vitest.it)("should have update:modelValue emit", () => {
66
- (0, _vitest.expect)(_flow.flowEmits["update:modelValue"]).toBeDefined();
67
- });
68
- (0, _vitest.it)("should have update:nodes emit", () => {
69
- (0, _vitest.expect)(_flow.flowEmits["update:nodes"]).toBeDefined();
70
- });
71
- (0, _vitest.it)("should have update:edges emit", () => {
72
- (0, _vitest.expect)(_flow.flowEmits["update:edges"]).toBeDefined();
73
- });
74
- (0, _vitest.it)("should have node event emits", () => {
75
- (0, _vitest.expect)(_flow.flowEmits.nodeClick).toBeDefined();
76
- (0, _vitest.expect)(_flow.flowEmits.nodeDblClick).toBeDefined();
77
- (0, _vitest.expect)(_flow.flowEmits.nodeDragStart).toBeDefined();
78
- (0, _vitest.expect)(_flow.flowEmits.nodeDrag).toBeDefined();
79
- (0, _vitest.expect)(_flow.flowEmits.nodeDragEnd).toBeDefined();
80
- (0, _vitest.expect)(_flow.flowEmits.nodeContextMenu).toBeDefined();
81
- });
82
- (0, _vitest.it)("should have edge event emits", () => {
83
- (0, _vitest.expect)(_flow.flowEmits.edgeClick).toBeDefined();
84
- (0, _vitest.expect)(_flow.flowEmits.edgeDblClick).toBeDefined();
85
- (0, _vitest.expect)(_flow.flowEmits.edgeContextMenu).toBeDefined();
86
- });
87
- (0, _vitest.it)("should have connection emits", () => {
88
- (0, _vitest.expect)(_flow.flowEmits.edgeConnect).toBeDefined();
89
- (0, _vitest.expect)(_flow.flowEmits.selectionChange).toBeDefined();
90
- (0, _vitest.expect)(_flow.flowEmits.historyChange).toBeDefined();
91
- (0, _vitest.expect)(_flow.flowEmits.viewportChange).toBeDefined();
92
- });
93
- });
94
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,92 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { flowProps, flowEmits } from "../flow.mjs";
3
- describe("flow/flow", () => {
4
- describe("flowProps", () => {
5
- it("should have all required prop definitions", () => {
6
- expect(flowProps.nodes).toBeDefined();
7
- expect(flowProps.edges).toBeDefined();
8
- expect(flowProps.modelValue).toBeDefined();
9
- expect(flowProps.minZoom).toBeDefined();
10
- expect(flowProps.maxZoom).toBeDefined();
11
- expect(flowProps.zoomStep).toBeDefined();
12
- expect(flowProps.nodesDraggable).toBeDefined();
13
- expect(flowProps.edgesConnectable).toBeDefined();
14
- expect(flowProps.selectable).toBeDefined();
15
- expect(flowProps.background).toBeDefined();
16
- expect(flowProps.gridSize).toBeDefined();
17
- expect(flowProps.snapToGrid).toBeDefined();
18
- expect(flowProps.readonly).toBeDefined();
19
- expect(flowProps.keyboardShortcuts).toBeDefined();
20
- expect(flowProps.showControls).toBeDefined();
21
- expect(flowProps.showMinimap).toBeDefined();
22
- expect(flowProps.history).toBeDefined();
23
- expect(flowProps.maxHistory).toBeDefined();
24
- });
25
- it("should have correct default values for numbers", () => {
26
- expect(flowProps.minZoom.default).toBe(0.1);
27
- expect(flowProps.maxZoom.default).toBe(5);
28
- expect(flowProps.zoomStep.default).toBe(0.1);
29
- expect(flowProps.panZoomSpeed.default).toBe(1);
30
- expect(flowProps.gridSize.default).toBe(20);
31
- expect(flowProps.maxHistory.default).toBe(50);
32
- expect(flowProps.virtualizationThreshold.default).toBe(100);
33
- });
34
- it("should have correct default values for booleans", () => {
35
- expect(flowProps.nodesDraggable.default).toBe(true);
36
- expect(flowProps.edgesConnectable.default).toBe(true);
37
- expect(flowProps.selectable.default).toBe(true);
38
- expect(flowProps.snapToGrid.default).toBe(false);
39
- expect(flowProps.readonly.default).toBe(false);
40
- expect(flowProps.keyboardShortcuts.default).toBe(true);
41
- expect(flowProps.showControls.default).toBe(true);
42
- expect(flowProps.showMinimap.default).toBe(false);
43
- expect(flowProps.history.default).toBe(true);
44
- expect(flowProps.showAlignmentGuides.default).toBe(true);
45
- expect(flowProps.virtualized.default).toBe(false);
46
- });
47
- it("should have correct default values for strings", () => {
48
- expect(flowProps.background.default).toBe("dots");
49
- expect(flowProps.backgroundColor.default).toBe("#f8f9fa");
50
- expect(flowProps.defaultNodeType.default).toBe("default");
51
- expect(flowProps.defaultEdgeType.default).toBe("bezier");
52
- expect(flowProps.multiSelectKey.default).toBe("Shift");
53
- expect(flowProps.minimapNodeColor.default).toBe("#b1b1b7");
54
- });
55
- it("should have isValidConnection defaulting to null", () => {
56
- expect(flowProps.isValidConnection.default).toBe(null);
57
- });
58
- it("should have themeOverrides defaulting to undefined", () => {
59
- expect(flowProps.themeOverrides.default).toBeUndefined();
60
- });
61
- });
62
- describe("flowEmits", () => {
63
- it("should have update:modelValue emit", () => {
64
- expect(flowEmits["update:modelValue"]).toBeDefined();
65
- });
66
- it("should have update:nodes emit", () => {
67
- expect(flowEmits["update:nodes"]).toBeDefined();
68
- });
69
- it("should have update:edges emit", () => {
70
- expect(flowEmits["update:edges"]).toBeDefined();
71
- });
72
- it("should have node event emits", () => {
73
- expect(flowEmits.nodeClick).toBeDefined();
74
- expect(flowEmits.nodeDblClick).toBeDefined();
75
- expect(flowEmits.nodeDragStart).toBeDefined();
76
- expect(flowEmits.nodeDrag).toBeDefined();
77
- expect(flowEmits.nodeDragEnd).toBeDefined();
78
- expect(flowEmits.nodeContextMenu).toBeDefined();
79
- });
80
- it("should have edge event emits", () => {
81
- expect(flowEmits.edgeClick).toBeDefined();
82
- expect(flowEmits.edgeDblClick).toBeDefined();
83
- expect(flowEmits.edgeContextMenu).toBeDefined();
84
- });
85
- it("should have connection emits", () => {
86
- expect(flowEmits.edgeConnect).toBeDefined();
87
- expect(flowEmits.selectionChange).toBeDefined();
88
- expect(flowEmits.historyChange).toBeDefined();
89
- expect(flowEmits.viewportChange).toBeDefined();
90
- });
91
- });
92
- });