@yh-ui/flow 1.0.25 → 1.0.30

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 (143) hide show
  1. package/package.json +13 -11
  2. package/LICENSE +0 -21
  3. package/dist/__tests__/ai-workflow.ssr.test.cjs +0 -352
  4. package/dist/__tests__/ai-workflow.ssr.test.d.ts +0 -1
  5. package/dist/__tests__/ai-workflow.ssr.test.mjs +0 -283
  6. package/dist/__tests__/ai-workflow.test.cjs +0 -109
  7. package/dist/__tests__/ai-workflow.test.d.ts +0 -1
  8. package/dist/__tests__/ai-workflow.test.mjs +0 -112
  9. package/dist/__tests__/bpmn-engine.test.cjs +0 -357
  10. package/dist/__tests__/bpmn-engine.test.d.ts +0 -1
  11. package/dist/__tests__/bpmn-engine.test.mjs +0 -406
  12. package/dist/__tests__/bpmn-utils.test.cjs +0 -268
  13. package/dist/__tests__/bpmn-utils.test.d.ts +0 -1
  14. package/dist/__tests__/bpmn-utils.test.mjs +0 -227
  15. package/dist/__tests__/bpmn-xml.test.cjs +0 -150
  16. package/dist/__tests__/bpmn-xml.test.d.ts +0 -1
  17. package/dist/__tests__/bpmn-xml.test.mjs +0 -112
  18. package/dist/__tests__/bpmn.ssr.test.cjs +0 -278
  19. package/dist/__tests__/bpmn.ssr.test.d.ts +0 -1
  20. package/dist/__tests__/bpmn.ssr.test.mjs +0 -237
  21. package/dist/__tests__/bpmn.test.cjs +0 -103
  22. package/dist/__tests__/bpmn.test.d.ts +0 -1
  23. package/dist/__tests__/bpmn.test.mjs +0 -106
  24. package/dist/__tests__/collaboration.test.cjs +0 -487
  25. package/dist/__tests__/collaboration.test.d.ts +0 -1
  26. package/dist/__tests__/collaboration.test.mjs +0 -424
  27. package/dist/__tests__/custom-types.test.cjs +0 -300
  28. package/dist/__tests__/custom-types.test.d.ts +0 -1
  29. package/dist/__tests__/custom-types.test.mjs +0 -248
  30. package/dist/__tests__/edge-types.test.cjs +0 -275
  31. package/dist/__tests__/edge-types.test.d.ts +0 -1
  32. package/dist/__tests__/edge-types.test.mjs +0 -234
  33. package/dist/__tests__/edge-utils.test.cjs +0 -375
  34. package/dist/__tests__/edge-utils.test.d.ts +0 -1
  35. package/dist/__tests__/edge-utils.test.mjs +0 -376
  36. package/dist/__tests__/edge.test.cjs +0 -56
  37. package/dist/__tests__/edge.test.d.ts +0 -1
  38. package/dist/__tests__/edge.test.mjs +0 -69
  39. package/dist/__tests__/event-bus.test.cjs +0 -80
  40. package/dist/__tests__/event-bus.test.d.ts +0 -1
  41. package/dist/__tests__/event-bus.test.mjs +0 -51
  42. package/dist/__tests__/events-types.test.cjs +0 -184
  43. package/dist/__tests__/events-types.test.d.ts +0 -1
  44. package/dist/__tests__/events-types.test.mjs +0 -184
  45. package/dist/__tests__/export-image-plugin.test.cjs +0 -142
  46. package/dist/__tests__/export-image-plugin.test.d.ts +0 -1
  47. package/dist/__tests__/export-image-plugin.test.mjs +0 -118
  48. package/dist/__tests__/export.test.cjs +0 -237
  49. package/dist/__tests__/export.test.d.ts +0 -1
  50. package/dist/__tests__/export.test.mjs +0 -171
  51. package/dist/__tests__/flow-context.test.cjs +0 -16
  52. package/dist/__tests__/flow-context.test.d.ts +0 -1
  53. package/dist/__tests__/flow-context.test.mjs +0 -16
  54. package/dist/__tests__/flow-props.test.cjs +0 -94
  55. package/dist/__tests__/flow-props.test.d.ts +0 -1
  56. package/dist/__tests__/flow-props.test.mjs +0 -92
  57. package/dist/__tests__/flow.ssr.test.cjs +0 -156
  58. package/dist/__tests__/flow.ssr.test.d.ts +0 -1
  59. package/dist/__tests__/flow.ssr.test.mjs +0 -112
  60. package/dist/__tests__/geometry.test.cjs +0 -191
  61. package/dist/__tests__/geometry.test.d.ts +0 -1
  62. package/dist/__tests__/geometry.test.mjs +0 -105
  63. package/dist/__tests__/graph.test.cjs +0 -115
  64. package/dist/__tests__/graph.test.d.ts +0 -1
  65. package/dist/__tests__/graph.test.mjs +0 -85
  66. package/dist/__tests__/history-plugin.test.cjs +0 -191
  67. package/dist/__tests__/history-plugin.test.d.ts +0 -1
  68. package/dist/__tests__/history-plugin.test.mjs +0 -161
  69. package/dist/__tests__/history.test.cjs +0 -81
  70. package/dist/__tests__/history.test.d.ts +0 -1
  71. package/dist/__tests__/history.test.mjs +0 -43
  72. package/dist/__tests__/layout-plugin.test.cjs +0 -233
  73. package/dist/__tests__/layout-plugin.test.d.ts +0 -1
  74. package/dist/__tests__/layout-plugin.test.mjs +0 -215
  75. package/dist/__tests__/layout.test.cjs +0 -213
  76. package/dist/__tests__/layout.test.d.ts +0 -1
  77. package/dist/__tests__/layout.test.mjs +0 -170
  78. package/dist/__tests__/node-edit-panel.ssr.test.cjs +0 -168
  79. package/dist/__tests__/node-edit-panel.ssr.test.d.ts +0 -1
  80. package/dist/__tests__/node-edit-panel.ssr.test.mjs +0 -118
  81. package/dist/__tests__/node-group-plugin.test.cjs +0 -235
  82. package/dist/__tests__/node-group-plugin.test.d.ts +0 -1
  83. package/dist/__tests__/node-group-plugin.test.mjs +0 -187
  84. package/dist/__tests__/node-handles.test.cjs +0 -340
  85. package/dist/__tests__/node-handles.test.d.ts +0 -1
  86. package/dist/__tests__/node-handles.test.mjs +0 -230
  87. package/dist/__tests__/node-types.test.cjs +0 -368
  88. package/dist/__tests__/node-types.test.d.ts +0 -1
  89. package/dist/__tests__/node-types.test.mjs +0 -292
  90. package/dist/__tests__/performance.test.cjs +0 -313
  91. package/dist/__tests__/performance.test.d.ts +0 -1
  92. package/dist/__tests__/performance.test.mjs +0 -218
  93. package/dist/__tests__/plugin-advanced.test.cjs +0 -301
  94. package/dist/__tests__/plugin-advanced.test.d.ts +0 -1
  95. package/dist/__tests__/plugin-advanced.test.mjs +0 -225
  96. package/dist/__tests__/plugin.test.cjs +0 -151
  97. package/dist/__tests__/plugin.test.d.ts +0 -1
  98. package/dist/__tests__/plugin.test.mjs +0 -116
  99. package/dist/__tests__/plugins.test.cjs +0 -412
  100. package/dist/__tests__/plugins.test.d.ts +0 -1
  101. package/dist/__tests__/plugins.test.mjs +0 -402
  102. package/dist/__tests__/screenshot-capture.test.cjs +0 -183
  103. package/dist/__tests__/screenshot-capture.test.d.ts +0 -1
  104. package/dist/__tests__/screenshot-capture.test.mjs +0 -124
  105. package/dist/__tests__/screenshot.test.cjs +0 -74
  106. package/dist/__tests__/screenshot.test.d.ts +0 -1
  107. package/dist/__tests__/screenshot.test.mjs +0 -69
  108. package/dist/__tests__/theme.test.cjs +0 -185
  109. package/dist/__tests__/theme.test.d.ts +0 -1
  110. package/dist/__tests__/theme.test.mjs +0 -191
  111. package/dist/__tests__/transform.test.cjs +0 -384
  112. package/dist/__tests__/transform.test.d.ts +0 -1
  113. package/dist/__tests__/transform.test.mjs +0 -239
  114. package/dist/__tests__/useAlignment.test.cjs +0 -128
  115. package/dist/__tests__/useAlignment.test.d.ts +0 -1
  116. package/dist/__tests__/useAlignment.test.mjs +0 -72
  117. package/dist/__tests__/useEdges.test.cjs +0 -117
  118. package/dist/__tests__/useEdges.test.d.ts +0 -1
  119. package/dist/__tests__/useEdges.test.mjs +0 -80
  120. package/dist/__tests__/useKeyboard.test.cjs +0 -88
  121. package/dist/__tests__/useKeyboard.test.d.ts +0 -1
  122. package/dist/__tests__/useKeyboard.test.mjs +0 -56
  123. package/dist/__tests__/useNodeDistribution.test.cjs +0 -643
  124. package/dist/__tests__/useNodeDistribution.test.d.ts +0 -1
  125. package/dist/__tests__/useNodeDistribution.test.mjs +0 -297
  126. package/dist/__tests__/useNodes.test.cjs +0 -150
  127. package/dist/__tests__/useNodes.test.d.ts +0 -1
  128. package/dist/__tests__/useNodes.test.mjs +0 -80
  129. package/dist/__tests__/useSelection.test.cjs +0 -112
  130. package/dist/__tests__/useSelection.test.d.ts +0 -1
  131. package/dist/__tests__/useSelection.test.mjs +0 -76
  132. package/dist/__tests__/useViewport.test.cjs +0 -171
  133. package/dist/__tests__/useViewport.test.d.ts +0 -1
  134. package/dist/__tests__/useViewport.test.mjs +0 -82
  135. package/dist/__tests__/utils/ssr.cjs +0 -124
  136. package/dist/__tests__/utils/ssr.d.ts +0 -33
  137. package/dist/__tests__/utils/ssr.mjs +0 -129
  138. package/dist/__tests__/validation.test.cjs +0 -95
  139. package/dist/__tests__/validation.test.d.ts +0 -1
  140. package/dist/__tests__/validation.test.mjs +0 -36
  141. package/dist/__tests__/viewport-types.test.cjs +0 -324
  142. package/dist/__tests__/viewport-types.test.d.ts +0 -1
  143. package/dist/__tests__/viewport-types.test.mjs +0 -207
@@ -1,412 +0,0 @@
1
- "use strict";
2
-
3
- var _vitest = require("vitest");
4
- var _vue = require("vue");
5
- var _controls = require("../plugins/plugins/controls.cjs");
6
- var _grid = require("../plugins/plugins/grid.cjs");
7
- var _keyboard = require("../plugins/plugins/keyboard.cjs");
8
- var _minimap = require("../plugins/plugins/minimap.cjs");
9
- var _snap = require("../plugins/plugins/snap.cjs");
10
- function createMockFlowInstance() {
11
- const nodes = (0, _vue.ref)([]);
12
- const edges = (0, _vue.ref)([]);
13
- const viewport = (0, _vue.ref)({
14
- x: 0,
15
- y: 0,
16
- zoom: 1
17
- });
18
- const draggingNodeId = (0, _vue.ref)(null);
19
- return {
20
- nodes,
21
- edges,
22
- viewport,
23
- draggingNodeId,
24
- addNode: _vitest.vi.fn(),
25
- removeNode: _vitest.vi.fn(),
26
- updateNode: _vitest.vi.fn(),
27
- getNode: _vitest.vi.fn(),
28
- addEdge: _vitest.vi.fn(),
29
- removeEdge: _vitest.vi.fn(),
30
- updateEdge: _vitest.vi.fn(),
31
- getEdge: _vitest.vi.fn(),
32
- setViewport: _vitest.vi.fn(),
33
- fitView: _vitest.vi.fn(),
34
- zoomIn: _vitest.vi.fn(),
35
- zoomOut: _vitest.vi.fn(),
36
- centerView: _vitest.vi.fn(),
37
- selectNode: _vitest.vi.fn(),
38
- selectEdge: _vitest.vi.fn(),
39
- clearSelection: _vitest.vi.fn(),
40
- getNodes: _vitest.vi.fn(() => nodes.value),
41
- getEdges: _vitest.vi.fn(() => edges.value),
42
- getViewport: _vitest.vi.fn(() => viewport.value),
43
- screenToCanvas: _vitest.vi.fn(),
44
- canvasToScreen: _vitest.vi.fn(),
45
- on: _vitest.vi.fn(),
46
- off: _vitest.vi.fn(),
47
- emit: _vitest.vi.fn(),
48
- isValidConnection: _vitest.vi.fn(() => true),
49
- $el: void 0,
50
- usePlugin: _vitest.vi.fn(),
51
- removePlugin: _vitest.vi.fn()
52
- };
53
- }
54
- (0, _vitest.describe)("flow/plugins/plugins/controls", () => {
55
- let consoleLogSpy;
56
- (0, _vitest.beforeEach)(() => {
57
- consoleLogSpy = _vitest.vi.spyOn(console, "log").mockImplementation(() => {});
58
- });
59
- (0, _vitest.afterEach)(() => {
60
- consoleLogSpy.mockRestore();
61
- });
62
- (0, _vitest.describe)("createControlsPlugin", () => {
63
- (0, _vitest.it)("should create plugin with correct id and name", () => {
64
- const plugin = (0, _controls.createControlsPlugin)();
65
- (0, _vitest.expect)(plugin.id).toBe("controls");
66
- (0, _vitest.expect)(plugin.name).toBe("Controls");
67
- (0, _vitest.expect)(plugin.version).toBe("1.0.0");
68
- (0, _vitest.expect)(plugin.description).toBe("Displays a set of controls for zooming and fitting the view");
69
- });
70
- (0, _vitest.it)("should have a component", () => {
71
- const plugin = (0, _controls.createControlsPlugin)();
72
- (0, _vitest.expect)(plugin.component).toBeDefined();
73
- });
74
- (0, _vitest.it)("should install with default options", () => {
75
- const flow = createMockFlowInstance();
76
- const plugin = (0, _controls.createControlsPlugin)();
77
- plugin.install(flow);
78
- (0, _vitest.expect)(consoleLogSpy).toHaveBeenCalledWith("[Controls Plugin] Installed");
79
- });
80
- (0, _vitest.it)("should merge custom options", () => {
81
- const plugin = (0, _controls.createControlsPlugin)({
82
- enabled: true,
83
- position: "top-right",
84
- showZoom: true,
85
- showFitView: false,
86
- showInteractive: false
87
- });
88
- (0, _vitest.expect)(plugin.componentProps).toEqual({
89
- position: "top-right",
90
- showZoom: true,
91
- showFitView: false,
92
- showInteractive: false
93
- });
94
- });
95
- (0, _vitest.it)("should use default position when not provided", () => {
96
- const plugin = (0, _controls.createControlsPlugin)();
97
- (0, _vitest.expect)(plugin.componentProps?.position).toBe("bottom-left");
98
- });
99
- (0, _vitest.it)("should use default show options", () => {
100
- const plugin = (0, _controls.createControlsPlugin)();
101
- (0, _vitest.expect)(plugin.componentProps?.showZoom).toBe(true);
102
- (0, _vitest.expect)(plugin.componentProps?.showFitView).toBe(true);
103
- (0, _vitest.expect)(plugin.componentProps?.showInteractive).toBe(true);
104
- });
105
- (0, _vitest.it)("should support all position options", () => {
106
- const positions = ["top-left", "top-right", "bottom-left", "bottom-right"];
107
- for (const pos of positions) {
108
- const plugin = (0, _controls.createControlsPlugin)({
109
- position: pos
110
- });
111
- (0, _vitest.expect)(plugin.componentProps?.position).toBe(pos);
112
- }
113
- });
114
- });
115
- });
116
- (0, _vitest.describe)("flow/plugins/plugins/grid", () => {
117
- let consoleLogSpy;
118
- (0, _vitest.beforeEach)(() => {
119
- consoleLogSpy = _vitest.vi.spyOn(console, "log").mockImplementation(() => {});
120
- });
121
- (0, _vitest.afterEach)(() => {
122
- consoleLogSpy.mockRestore();
123
- });
124
- (0, _vitest.describe)("createGridPlugin", () => {
125
- (0, _vitest.it)("should create plugin with correct id and name", () => {
126
- const plugin = (0, _grid.createGridPlugin)();
127
- (0, _vitest.expect)(plugin.id).toBe("grid");
128
- (0, _vitest.expect)(plugin.name).toBe("Grid");
129
- (0, _vitest.expect)(plugin.version).toBe("1.0.0");
130
- (0, _vitest.expect)(plugin.description).toBe("Displays a grid or dots background");
131
- });
132
- (0, _vitest.it)("should have a component", () => {
133
- const plugin = (0, _grid.createGridPlugin)();
134
- (0, _vitest.expect)(plugin.component).toBeDefined();
135
- });
136
- (0, _vitest.it)("should install with default options", () => {
137
- const flow = createMockFlowInstance();
138
- const plugin = (0, _grid.createGridPlugin)();
139
- plugin.install(flow);
140
- (0, _vitest.expect)(consoleLogSpy).toHaveBeenCalledWith("[Grid Plugin] Installed");
141
- });
142
- (0, _vitest.it)("should merge custom options", () => {
143
- const plugin = (0, _grid.createGridPlugin)({
144
- enabled: true,
145
- type: "grid",
146
- color: "#ff0000",
147
- gap: 30
148
- });
149
- (0, _vitest.expect)(plugin.componentProps).toEqual({
150
- type: "grid",
151
- color: "#ff0000",
152
- gap: 30
153
- });
154
- });
155
- (0, _vitest.it)("should use default type dots", () => {
156
- const plugin = (0, _grid.createGridPlugin)();
157
- (0, _vitest.expect)(plugin.componentProps?.type).toBe("dots");
158
- });
159
- (0, _vitest.it)("should use default gap", () => {
160
- const plugin = (0, _grid.createGridPlugin)();
161
- (0, _vitest.expect)(plugin.componentProps?.gap).toBe(20);
162
- });
163
- (0, _vitest.it)("should use default color", () => {
164
- const plugin = (0, _grid.createGridPlugin)();
165
- (0, _vitest.expect)(plugin.componentProps?.color).toBe("#e5e5e5");
166
- });
167
- (0, _vitest.it)("should support grid type", () => {
168
- const plugin = (0, _grid.createGridPlugin)({
169
- type: "grid"
170
- });
171
- (0, _vitest.expect)(plugin.componentProps?.type).toBe("grid");
172
- });
173
- });
174
- });
175
- (0, _vitest.describe)("flow/plugins/plugins/keyboard", () => {
176
- let consoleLogSpy;
177
- (0, _vitest.beforeEach)(() => {
178
- consoleLogSpy = _vitest.vi.spyOn(console, "log").mockImplementation(() => {});
179
- });
180
- (0, _vitest.afterEach)(() => {
181
- consoleLogSpy.mockRestore();
182
- });
183
- (0, _vitest.describe)("createKeyboardPlugin", () => {
184
- (0, _vitest.it)("should create plugin with correct id and name", () => {
185
- const plugin = (0, _keyboard.createKeyboardPlugin)();
186
- (0, _vitest.expect)(plugin.id).toBe("keyboard");
187
- (0, _vitest.expect)(plugin.name).toBe("Keyboard");
188
- });
189
- (0, _vitest.it)("should install with default options", () => {
190
- const flow = createMockFlowInstance();
191
- const plugin = (0, _keyboard.createKeyboardPlugin)();
192
- plugin.install(flow);
193
- (0, _vitest.expect)(consoleLogSpy).toHaveBeenCalledWith("Keyboard plugin installed", {
194
- enabled: true,
195
- delete: true,
196
- backspace: true,
197
- ctrlZ: true,
198
- ctrlY: true,
199
- escape: true
200
- });
201
- });
202
- (0, _vitest.it)("should merge custom options", () => {
203
- const plugin = (0, _keyboard.createKeyboardPlugin)({
204
- enabled: false,
205
- delete: false,
206
- backspace: false,
207
- ctrlZ: false,
208
- ctrlY: false,
209
- escape: false
210
- });
211
- plugin.install(createMockFlowInstance());
212
- (0, _vitest.expect)(consoleLogSpy).toHaveBeenCalledWith("Keyboard plugin installed", {
213
- enabled: false,
214
- delete: false,
215
- backspace: false,
216
- ctrlZ: false,
217
- ctrlY: false,
218
- escape: false
219
- });
220
- });
221
- (0, _vitest.it)("should accept partial options", () => {
222
- const plugin = (0, _keyboard.createKeyboardPlugin)({
223
- delete: false
224
- });
225
- (0, _vitest.expect)(plugin.id).toBe("keyboard");
226
- });
227
- (0, _vitest.it)("should override individual options", () => {
228
- const plugin = (0, _keyboard.createKeyboardPlugin)({
229
- ctrlZ: false,
230
- ctrlY: false
231
- });
232
- plugin.install(createMockFlowInstance());
233
- (0, _vitest.expect)(consoleLogSpy).toHaveBeenCalledWith("Keyboard plugin installed", {
234
- enabled: true,
235
- delete: true,
236
- backspace: true,
237
- ctrlZ: false,
238
- ctrlY: false,
239
- escape: true
240
- });
241
- });
242
- });
243
- });
244
- (0, _vitest.describe)("flow/plugins/plugins/minimap", () => {
245
- let consoleLogSpy;
246
- (0, _vitest.beforeEach)(() => {
247
- consoleLogSpy = _vitest.vi.spyOn(console, "log").mockImplementation(() => {});
248
- });
249
- (0, _vitest.afterEach)(() => {
250
- consoleLogSpy.mockRestore();
251
- });
252
- (0, _vitest.describe)("createMiniMapPlugin", () => {
253
- (0, _vitest.it)("should create plugin with correct id and name", () => {
254
- const plugin = (0, _minimap.createMiniMapPlugin)();
255
- (0, _vitest.expect)(plugin.id).toBe("minimap");
256
- (0, _vitest.expect)(plugin.name).toBe("Minimap");
257
- (0, _vitest.expect)(plugin.version).toBe("1.0.0");
258
- (0, _vitest.expect)(plugin.description).toBe("Displays a minimap for navigation");
259
- });
260
- (0, _vitest.it)("should have a component", () => {
261
- const plugin = (0, _minimap.createMiniMapPlugin)();
262
- (0, _vitest.expect)(plugin.component).toBeDefined();
263
- });
264
- (0, _vitest.it)("should install with default options", () => {
265
- const flow = createMockFlowInstance();
266
- const plugin = (0, _minimap.createMiniMapPlugin)();
267
- plugin.install(flow);
268
- (0, _vitest.expect)(consoleLogSpy).toHaveBeenCalled();
269
- });
270
- (0, _vitest.it)("should use default position bottom-right", () => {
271
- const plugin = (0, _minimap.createMiniMapPlugin)();
272
- (0, _vitest.expect)(plugin.componentProps?.position).toBe("bottom-right");
273
- });
274
- (0, _vitest.it)("should use default dimensions", () => {
275
- const plugin = (0, _minimap.createMiniMapPlugin)();
276
- (0, _vitest.expect)(plugin.componentProps?.width).toBe(200);
277
- (0, _vitest.expect)(plugin.componentProps?.height).toBe(150);
278
- });
279
- (0, _vitest.it)("should use default mask colors", () => {
280
- const plugin = (0, _minimap.createMiniMapPlugin)();
281
- (0, _vitest.expect)(plugin.componentProps?.maskColor).toBe("rgba(240, 240, 240, 0.6)");
282
- (0, _vitest.expect)(plugin.componentProps?.maskStrokeColor).toBe("#ddd");
283
- (0, _vitest.expect)(plugin.componentProps?.maskStrokeWidth).toBe(1);
284
- });
285
- (0, _vitest.it)("should use default pannable and zoomable", () => {
286
- const plugin = (0, _minimap.createMiniMapPlugin)();
287
- (0, _vitest.expect)(plugin.componentProps?.pannable).toBe(true);
288
- (0, _vitest.expect)(plugin.componentProps?.zoomable).toBe(true);
289
- });
290
- (0, _vitest.it)("should support custom position", () => {
291
- const positions = ["top-left", "top-right", "bottom-left", "bottom-right"];
292
- for (const pos of positions) {
293
- const plugin = (0, _minimap.createMiniMapPlugin)({
294
- position: pos
295
- });
296
- (0, _vitest.expect)(plugin.componentProps?.position).toBe(pos);
297
- }
298
- });
299
- (0, _vitest.it)("should support custom dimensions", () => {
300
- const plugin = (0, _minimap.createMiniMapPlugin)({
301
- width: 300,
302
- height: 200
303
- });
304
- (0, _vitest.expect)(plugin.componentProps?.width).toBe(300);
305
- (0, _vitest.expect)(plugin.componentProps?.height).toBe(200);
306
- });
307
- (0, _vitest.it)("should support custom node color functions", () => {
308
- const customNodeColor = node => "#ff0000";
309
- const customNodeStrokeColor = node => "#00ff00";
310
- const plugin = (0, _minimap.createMiniMapPlugin)({
311
- nodeColor: customNodeColor,
312
- nodeStrokeColor: customNodeStrokeColor
313
- });
314
- (0, _vitest.expect)(plugin.componentProps?.nodeColor).toBe(customNodeColor);
315
- (0, _vitest.expect)(plugin.componentProps?.nodeStrokeColor).toBe(customNodeStrokeColor);
316
- });
317
- (0, _vitest.it)("should support interactive option", () => {
318
- const pluginEnabled = (0, _minimap.createMiniMapPlugin)({
319
- interactive: true
320
- });
321
- const pluginDisabled = (0, _minimap.createMiniMapPlugin)({
322
- interactive: false
323
- });
324
- (0, _vitest.expect)(pluginEnabled.componentProps?.interactive).toBe(true);
325
- (0, _vitest.expect)(pluginDisabled.componentProps?.interactive).toBe(false);
326
- });
327
- (0, _vitest.it)("should support layout controls options", () => {
328
- const plugin = (0, _minimap.createMiniMapPlugin)({
329
- showLayoutControls: true,
330
- layoutType: "dagre",
331
- layoutDirection: "LR"
332
- });
333
- (0, _vitest.expect)(plugin.componentProps?.showLayoutControls).toBe(true);
334
- (0, _vitest.expect)(plugin.componentProps?.layoutType).toBe("dagre");
335
- (0, _vitest.expect)(plugin.componentProps?.layoutDirection).toBe("LR");
336
- });
337
- (0, _vitest.it)("should support all layout directions", () => {
338
- const directions = ["TB", "BT", "LR", "RL"];
339
- for (const dir of directions) {
340
- const plugin = (0, _minimap.createMiniMapPlugin)({
341
- layoutDirection: dir
342
- });
343
- (0, _vitest.expect)(plugin.componentProps?.layoutDirection).toBe(dir);
344
- }
345
- });
346
- (0, _vitest.it)("should support all layout types", () => {
347
- const types = ["dagre", "elk", "force", "grid", "none"];
348
- for (const type of types) {
349
- const plugin = (0, _minimap.createMiniMapPlugin)({
350
- layoutType: type
351
- });
352
- (0, _vitest.expect)(plugin.componentProps?.layoutType).toBe(type);
353
- }
354
- });
355
- });
356
- });
357
- (0, _vitest.describe)("flow/plugins/plugins/snap", () => {
358
- let consoleLogSpy;
359
- (0, _vitest.beforeEach)(() => {
360
- consoleLogSpy = _vitest.vi.spyOn(console, "log").mockImplementation(() => {});
361
- });
362
- (0, _vitest.afterEach)(() => {
363
- consoleLogSpy.mockRestore();
364
- });
365
- (0, _vitest.describe)("createSnapPlugin", () => {
366
- (0, _vitest.it)("should create plugin with correct id and name", () => {
367
- const plugin = (0, _snap.createSnapPlugin)();
368
- (0, _vitest.expect)(plugin.id).toBe("snap");
369
- (0, _vitest.expect)(plugin.name).toBe("Snap");
370
- (0, _vitest.expect)(plugin.version).toBe("1.0.0");
371
- (0, _vitest.expect)(plugin.description).toBe("Enables grid snapping and alignment lines");
372
- });
373
- (0, _vitest.it)("should have a component when showAlignmentLines is true", () => {
374
- const plugin = (0, _snap.createSnapPlugin)({
375
- showAlignmentLines: true
376
- });
377
- (0, _vitest.expect)(plugin.component).toBeDefined();
378
- });
379
- (0, _vitest.it)("should not have a component when showAlignmentLines is false", () => {
380
- const plugin = (0, _snap.createSnapPlugin)({
381
- showAlignmentLines: false
382
- });
383
- (0, _vitest.expect)(plugin.component).toBeUndefined();
384
- });
385
- (0, _vitest.it)("should install with default options", () => {
386
- const flow = createMockFlowInstance();
387
- const plugin = (0, _snap.createSnapPlugin)();
388
- plugin.install(flow);
389
- (0, _vitest.expect)(consoleLogSpy).toHaveBeenCalled();
390
- });
391
- (0, _vitest.it)("should not install when enabled is false", () => {
392
- const flow = createMockFlowInstance();
393
- const plugin = (0, _snap.createSnapPlugin)({
394
- enabled: false
395
- });
396
- plugin.install(flow);
397
- (0, _vitest.expect)(consoleLogSpy).not.toHaveBeenCalled();
398
- });
399
- (0, _vitest.it)("should use default snap options", () => {
400
- const plugin = (0, _snap.createSnapPlugin)();
401
- (0, _vitest.expect)(plugin.componentProps?.snapThreshold).toBe(10);
402
- });
403
- (0, _vitest.it)("should support custom snap options", () => {
404
- const plugin = (0, _snap.createSnapPlugin)({
405
- snapToGrid: true,
406
- gridSize: 20,
407
- snapThreshold: 15
408
- });
409
- (0, _vitest.expect)(plugin.componentProps?.snapThreshold).toBe(15);
410
- });
411
- });
412
- });
@@ -1 +0,0 @@
1
- export {};