@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,230 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- const getHandles = (node, type) => {
3
- if (node.handleBounds) {
4
- const handles = [];
5
- if (node.handleBounds.top) handles.push(...node.handleBounds.top);
6
- if (node.handleBounds.right) handles.push(...node.handleBounds.right);
7
- if (node.handleBounds.bottom) handles.push(...node.handleBounds.bottom);
8
- if (node.handleBounds.left) handles.push(...node.handleBounds.left);
9
- return handles.filter((h) => h.type === type);
10
- }
11
- if (node.type === "group") {
12
- return [];
13
- }
14
- if (node.type === "input") {
15
- return type === "source" ? [{ type: "source", position: "right" }] : [];
16
- }
17
- if (node.type === "output") {
18
- return type === "target" ? [{ type: "target", position: "left" }] : [];
19
- }
20
- if (node.type === "bpmn-start") {
21
- return type === "source" ? [{ type: "source", position: "right" }] : [];
22
- }
23
- if (node.type === "bpmn-end") {
24
- return type === "target" ? [{ type: "target", position: "left" }] : [];
25
- }
26
- if (node.type === "bpmn-task" || node.type === "bpmn-service-task" || node.type === "bpmn-user-task") {
27
- return [
28
- { type: "target", position: "left" },
29
- { type: "source", position: "right" }
30
- ].filter((h) => h.type === type);
31
- }
32
- if (node.type === "bpmn-exclusive-gateway" || node.type === "bpmn-parallel-gateway" || node.type === "bpmn-inclusive-gateway") {
33
- return [
34
- { type: "target", position: "left" },
35
- { type: "source", position: "right" },
36
- { type: "target", position: "top" },
37
- { type: "source", position: "bottom" }
38
- ].filter((h) => h.type === type);
39
- }
40
- if (node.type === "ai-start") {
41
- return type === "source" ? [{ type: "source", position: "right" }] : [];
42
- }
43
- if (node.type === "ai-end") {
44
- return type === "target" ? [{ type: "target", position: "left" }] : [];
45
- }
46
- if (node.type === "ai-condition") {
47
- return [
48
- { type: "target", position: "left" },
49
- { type: "source", position: "right" },
50
- // true
51
- { type: "source", position: "bottom" }
52
- // false
53
- ].filter((h) => h.type === type);
54
- }
55
- if (node.type === "ai-llm" || node.type === "ai-prompt" || node.type === "ai-agent" || node.type === "ai-tool" || node.type === "ai-memory") {
56
- return [
57
- { type: "target", position: "left" },
58
- { type: "source", position: "right" }
59
- ].filter((h) => h.type === type);
60
- }
61
- return [
62
- { type: "target", position: "left" },
63
- { type: "source", position: "right" }
64
- ].filter((h) => h.type === type);
65
- };
66
- describe("flow/utils/node-handles", () => {
67
- describe("Default node handles", () => {
68
- it("should return handles for default node type", () => {
69
- const node = {
70
- id: "1",
71
- type: "default",
72
- position: { x: 0, y: 0 },
73
- data: { label: "Test" }
74
- };
75
- const handles = getHandles(node, "source");
76
- expect(handles).toBeDefined();
77
- expect(handles.length).toBeGreaterThan(0);
78
- });
79
- it("should return source and target handles for default node", () => {
80
- const node = {
81
- id: "1",
82
- type: "default",
83
- position: { x: 0, y: 0 },
84
- data: { label: "Test" }
85
- };
86
- const sourceHandles = getHandles(node, "source");
87
- const targetHandles = getHandles(node, "target");
88
- expect(sourceHandles.length).toBe(1);
89
- expect(sourceHandles[0]?.position).toBe("right");
90
- expect(targetHandles.length).toBe(1);
91
- expect(targetHandles[0]?.position).toBe("left");
92
- });
93
- });
94
- describe("BPMN node handles", () => {
95
- it("should return source handle for bpmn-start", () => {
96
- const node = {
97
- id: "start1",
98
- type: "bpmn-start",
99
- position: { x: 0, y: 0 },
100
- data: { label: "Start" }
101
- };
102
- const handles = getHandles(node, "source");
103
- expect(handles.length).toBe(1);
104
- expect(handles[0]?.position).toBe("right");
105
- });
106
- it("should return target handle for bpmn-end", () => {
107
- const node = {
108
- id: "end1",
109
- type: "bpmn-end",
110
- position: { x: 0, y: 0 },
111
- data: { label: "End" }
112
- };
113
- const handles = getHandles(node, "target");
114
- expect(handles.length).toBe(1);
115
- expect(handles[0]?.position).toBe("left");
116
- });
117
- it("should return both handles for bpmn-task", () => {
118
- const node = {
119
- id: "task1",
120
- type: "bpmn-task",
121
- position: { x: 0, y: 0 },
122
- data: { label: "Task" }
123
- };
124
- const sourceHandles = getHandles(node, "source");
125
- const targetHandles = getHandles(node, "target");
126
- expect(sourceHandles.length).toBe(1);
127
- expect(targetHandles.length).toBe(1);
128
- });
129
- it("should return 4 handles for bpmn-exclusive-gateway", () => {
130
- const node = {
131
- id: "gw1",
132
- type: "bpmn-exclusive-gateway",
133
- position: { x: 0, y: 0 },
134
- data: { label: "Gateway" }
135
- };
136
- const sourceHandles = getHandles(node, "source");
137
- const targetHandles = getHandles(node, "target");
138
- expect(sourceHandles.length).toBe(2);
139
- expect(targetHandles.length).toBe(2);
140
- });
141
- });
142
- describe("AI Workflow node handles", () => {
143
- it("should return handles for ai-llm", () => {
144
- const node = {
145
- id: "llm1",
146
- type: "ai-llm",
147
- position: { x: 0, y: 0 },
148
- data: { label: "LLM", model: "gpt-4" }
149
- };
150
- const sourceHandles = getHandles(node, "source");
151
- const targetHandles = getHandles(node, "target");
152
- expect(sourceHandles.length).toBe(1);
153
- expect(targetHandles.length).toBe(1);
154
- });
155
- it("should return source handle for ai-start", () => {
156
- const node = {
157
- id: "start1",
158
- type: "ai-start",
159
- position: { x: 0, y: 0 },
160
- data: { label: "Start" }
161
- };
162
- const handles = getHandles(node, "source");
163
- expect(handles.length).toBe(1);
164
- expect(handles[0]?.position).toBe("right");
165
- });
166
- it("should return target handle for ai-end", () => {
167
- const node = {
168
- id: "end1",
169
- type: "ai-end",
170
- position: { x: 0, y: 0 },
171
- data: { label: "End" }
172
- };
173
- const handles = getHandles(node, "target");
174
- expect(handles.length).toBe(1);
175
- expect(handles[0]?.position).toBe("left");
176
- });
177
- it("should return 3 handles for ai-condition (left target, right source, bottom source)", () => {
178
- const node = {
179
- id: "cond1",
180
- type: "ai-condition",
181
- position: { x: 0, y: 0 },
182
- data: { label: "Condition", condition: "if" }
183
- };
184
- const sourceHandles = getHandles(node, "source");
185
- const targetHandles = getHandles(node, "target");
186
- expect(sourceHandles.length).toBe(2);
187
- expect(targetHandles.length).toBe(1);
188
- });
189
- });
190
- describe("Input/Output node handles", () => {
191
- it("should return only source handle for input node", () => {
192
- const node = {
193
- id: "input1",
194
- type: "input",
195
- position: { x: 0, y: 0 },
196
- data: { label: "Input" }
197
- };
198
- const sourceHandles = getHandles(node, "source");
199
- const targetHandles = getHandles(node, "target");
200
- expect(sourceHandles.length).toBe(1);
201
- expect(targetHandles.length).toBe(0);
202
- });
203
- it("should return only target handle for output node", () => {
204
- const node = {
205
- id: "output1",
206
- type: "output",
207
- position: { x: 0, y: 0 },
208
- data: { label: "Output" }
209
- };
210
- const sourceHandles = getHandles(node, "source");
211
- const targetHandles = getHandles(node, "target");
212
- expect(sourceHandles.length).toBe(0);
213
- expect(targetHandles.length).toBe(1);
214
- });
215
- });
216
- describe("Group node handles", () => {
217
- it("should return empty array for group node", () => {
218
- const node = {
219
- id: "group1",
220
- type: "group",
221
- position: { x: 0, y: 0 },
222
- data: { label: "Group" }
223
- };
224
- const sourceHandles = getHandles(node, "source");
225
- const targetHandles = getHandles(node, "target");
226
- expect(sourceHandles.length).toBe(0);
227
- expect(targetHandles.length).toBe(0);
228
- });
229
- });
230
- });
@@ -1,368 +0,0 @@
1
- "use strict";
2
-
3
- var _vitest = require("vitest");
4
- var _node = require("../types/node.cjs");
5
- (0, _vitest.describe)("flow/types/node", () => {
6
- (0, _vitest.describe)("NodeHandle", () => {
7
- (0, _vitest.it)("should define handle with type and position", () => {
8
- const handle = {
9
- type: "source",
10
- position: "right"
11
- };
12
- (0, _vitest.expect)(handle.type).toBe("source");
13
- (0, _vitest.expect)(handle.position).toBe("right");
14
- });
15
- (0, _vitest.it)("should support optional properties", () => {
16
- const handle = {
17
- type: "target",
18
- position: "left",
19
- id: "handle-1",
20
- style: {
21
- background: "#fff"
22
- },
23
- class: "custom-handle",
24
- isConnectable: true
25
- };
26
- (0, _vitest.expect)(handle.id).toBe("handle-1");
27
- (0, _vitest.expect)(handle.class).toBe("custom-handle");
28
- (0, _vitest.expect)(handle.isConnectable).toBe(true);
29
- });
30
- });
31
- (0, _vitest.describe)("NodeStyle", () => {
32
- (0, _vitest.it)("should allow CSS-like properties", () => {
33
- const style = {
34
- background: "#f0f0f0",
35
- border: "1px solid #ccc",
36
- width: 200
37
- };
38
- (0, _vitest.expect)(style.background).toBe("#f0f0f0");
39
- (0, _vitest.expect)(style.width).toBe(200);
40
- });
41
- (0, _vitest.it)("should support undefined values", () => {
42
- const style = {
43
- background: "#fff",
44
- border: void 0
45
- };
46
- (0, _vitest.expect)(style.border).toBeUndefined();
47
- });
48
- });
49
- (0, _vitest.describe)("NodeData", () => {
50
- (0, _vitest.it)("should define basic node data", () => {
51
- const data = {
52
- label: "Test Node"
53
- };
54
- (0, _vitest.expect)(data.label).toBe("Test Node");
55
- });
56
- (0, _vitest.it)("should support extended data fields", () => {
57
- const data = {
58
- label: "AI Node",
59
- style: {
60
- background: "#e0f7fa"
61
- },
62
- class: "ai-node",
63
- icon: "robot",
64
- description: "An AI processing node"
65
- };
66
- (0, _vitest.expect)(data.icon).toBe("robot");
67
- (0, _vitest.expect)(data.description).toBe("An AI processing node");
68
- });
69
- (0, _vitest.it)("should support AI workflow specific fields", () => {
70
- const data = {
71
- label: "LLM Node",
72
- model: "gpt-4",
73
- prompt: "You are a helpful assistant",
74
- temperature: 0.7,
75
- maxTokens: 2e3,
76
- tools: ["search", "calculator"],
77
- toolName: "web_search",
78
- condition: 'status == "success"',
79
- memoryType: "vector",
80
- status: "running",
81
- streamOutput: "partial"
82
- };
83
- (0, _vitest.expect)(data.model).toBe("gpt-4");
84
- (0, _vitest.expect)(data.temperature).toBe(0.7);
85
- (0, _vitest.expect)(data.status).toBe("running");
86
- });
87
- });
88
- (0, _vitest.describe)("NodePosition", () => {
89
- (0, _vitest.it)("should define position with x and y", () => {
90
- const pos = {
91
- x: 100,
92
- y: 200
93
- };
94
- (0, _vitest.expect)(pos.x).toBe(100);
95
- (0, _vitest.expect)(pos.y).toBe(200);
96
- });
97
- (0, _vitest.it)("should support negative coordinates", () => {
98
- const pos = {
99
- x: -50,
100
- y: -100
101
- };
102
- (0, _vitest.expect)(pos.x).toBe(-50);
103
- (0, _vitest.expect)(pos.y).toBe(-100);
104
- });
105
- });
106
- (0, _vitest.describe)("NodeDimension", () => {
107
- (0, _vitest.it)("should define width and height", () => {
108
- const dim = {
109
- width: 150,
110
- height: 80
111
- };
112
- (0, _vitest.expect)(dim.width).toBe(150);
113
- (0, _vitest.expect)(dim.height).toBe(80);
114
- });
115
- });
116
- (0, _vitest.describe)("NodeHandleBounds", () => {
117
- (0, _vitest.it)("should define handle bounds", () => {
118
- const bounds = {
119
- top: [{
120
- type: "source",
121
- position: "top"
122
- }],
123
- right: [{
124
- type: "target",
125
- position: "right"
126
- }]
127
- };
128
- (0, _vitest.expect)(bounds.top).toHaveLength(1);
129
- (0, _vitest.expect)(bounds.right).toHaveLength(1);
130
- });
131
- });
132
- (0, _vitest.describe)("Node", () => {
133
- (0, _vitest.it)("should create basic node", () => {
134
- const node = {
135
- id: "node-1",
136
- type: "default",
137
- position: {
138
- x: 0,
139
- y: 0
140
- },
141
- data: {
142
- label: "Basic Node"
143
- }
144
- };
145
- (0, _vitest.expect)(node.id).toBe("node-1");
146
- (0, _vitest.expect)(node.type).toBe("default");
147
- });
148
- (0, _vitest.it)("should support all optional properties", () => {
149
- const node = {
150
- id: "node-1",
151
- type: "custom",
152
- position: {
153
- x: 100,
154
- y: 200
155
- },
156
- data: {
157
- label: "Test"
158
- },
159
- style: {
160
- background: "#fff"
161
- },
162
- class: "custom-node",
163
- draggable: true,
164
- selectable: true,
165
- connectable: true,
166
- resizable: true,
167
- deletable: true,
168
- hidden: false,
169
- selected: false,
170
- dragging: false,
171
- width: 200,
172
- height: 100,
173
- parentId: "parent-1",
174
- zIndex: 1,
175
- extent: "parent",
176
- expandParent: true,
177
- positionAbsolute: {
178
- x: 150,
179
- y: 250
180
- },
181
- handleBounds: {
182
- top: [{
183
- type: "source",
184
- position: "top"
185
- }],
186
- right: [{
187
- type: "target",
188
- position: "right"
189
- }]
190
- }
191
- };
192
- (0, _vitest.expect)(node.draggable).toBe(true);
193
- (0, _vitest.expect)(node.width).toBe(200);
194
- (0, _vitest.expect)(node.parentId).toBe("parent-1");
195
- });
196
- (0, _vitest.it)("should support nested children", () => {
197
- const node = {
198
- id: "parent",
199
- type: "group",
200
- position: {
201
- x: 0,
202
- y: 0
203
- },
204
- data: {
205
- label: "Parent"
206
- },
207
- children: ["child-1", "child-2"],
208
- computed: true
209
- };
210
- (0, _vitest.expect)(node.children).toEqual(["child-1", "child-2"]);
211
- (0, _vitest.expect)(node.computed).toBe(true);
212
- });
213
- });
214
- (0, _vitest.describe)("NodeChangeType", () => {
215
- (0, _vitest.it)("should define all change types", () => {
216
- const types = ["select", "position", "remove", "dimensions", "style", "data", "selectMulti", "unselect"];
217
- (0, _vitest.expect)(types).toContain("select");
218
- (0, _vitest.expect)(types).toContain("position");
219
- (0, _vitest.expect)(types).toContain("remove");
220
- });
221
- });
222
- (0, _vitest.describe)("NodeChange", () => {
223
- (0, _vitest.it)("should create select change", () => {
224
- const node = {
225
- id: "node-1",
226
- type: "default",
227
- position: {
228
- x: 0,
229
- y: 0
230
- },
231
- data: {}
232
- };
233
- const change = {
234
- type: "select",
235
- id: "node-1",
236
- item: node,
237
- selected: true
238
- };
239
- (0, _vitest.expect)(change.type).toBe("select");
240
- (0, _vitest.expect)(change.selected).toBe(true);
241
- });
242
- (0, _vitest.it)("should create position change", () => {
243
- const node = {
244
- id: "node-1",
245
- type: "default",
246
- position: {
247
- x: 0,
248
- y: 0
249
- },
250
- data: {}
251
- };
252
- const change = {
253
- type: "position",
254
- id: "node-1",
255
- item: node,
256
- position: {
257
- x: 100,
258
- y: 200
259
- }
260
- };
261
- (0, _vitest.expect)(change.position?.x).toBe(100);
262
- (0, _vitest.expect)(change.position?.y).toBe(200);
263
- });
264
- (0, _vitest.it)("should create dimensions change", () => {
265
- const node = {
266
- id: "node-1",
267
- type: "default",
268
- position: {
269
- x: 0,
270
- y: 0
271
- },
272
- data: {}
273
- };
274
- const change = {
275
- type: "dimensions",
276
- id: "node-1",
277
- item: node,
278
- dimensions: {
279
- width: 200,
280
- height: 100
281
- }
282
- };
283
- (0, _vitest.expect)(change.dimensions?.width).toBe(200);
284
- });
285
- (0, _vitest.it)("should create drag change", () => {
286
- const node = {
287
- id: "node-1",
288
- type: "default",
289
- position: {
290
- x: 0,
291
- y: 0
292
- },
293
- data: {}
294
- };
295
- const change = {
296
- type: "position",
297
- id: "node-1",
298
- item: node,
299
- drag: true
300
- };
301
- (0, _vitest.expect)(change.drag).toBe(true);
302
- });
303
- });
304
- (0, _vitest.describe)("isNode", () => {
305
- (0, _vitest.it)("should return true for valid node objects", () => {
306
- const node = {
307
- id: "node-1",
308
- type: "default",
309
- position: {
310
- x: 0,
311
- y: 0
312
- },
313
- data: {}
314
- };
315
- (0, _vitest.expect)((0, _node.isNode)(node)).toBe(true);
316
- });
317
- (0, _vitest.it)("should return true for node with extended properties", () => {
318
- const node = {
319
- id: "node-1",
320
- type: "custom",
321
- position: {
322
- x: 100,
323
- y: 200
324
- },
325
- data: {
326
- label: "Test"
327
- },
328
- width: 200,
329
- height: 100
330
- };
331
- (0, _vitest.expect)((0, _node.isNode)(node)).toBe(true);
332
- });
333
- (0, _vitest.it)("should return false for null", () => {
334
- (0, _vitest.expect)((0, _node.isNode)(null)).toBe(false);
335
- });
336
- (0, _vitest.it)("should return false for undefined", () => {
337
- (0, _vitest.expect)((0, _node.isNode)(void 0)).toBe(false);
338
- });
339
- (0, _vitest.it)("should return false for object missing id", () => {
340
- (0, _vitest.expect)((0, _node.isNode)({
341
- type: "default",
342
- position: {
343
- x: 0,
344
- y: 0
345
- },
346
- data: {}
347
- })).toBe(false);
348
- });
349
- (0, _vitest.it)("should return false for object missing type", () => {
350
- (0, _vitest.expect)((0, _node.isNode)({
351
- id: "node-1",
352
- position: {
353
- x: 0,
354
- y: 0
355
- },
356
- data: {}
357
- })).toBe(false);
358
- });
359
- (0, _vitest.it)("should return false for primitive values", () => {
360
- (0, _vitest.expect)((0, _node.isNode)("node")).toBe(false);
361
- (0, _vitest.expect)((0, _node.isNode)(123)).toBe(false);
362
- (0, _vitest.expect)((0, _node.isNode)(true)).toBe(false);
363
- });
364
- (0, _vitest.it)("should return false for arrays", () => {
365
- (0, _vitest.expect)((0, _node.isNode)([])).toBe(false);
366
- });
367
- });
368
- });
@@ -1 +0,0 @@
1
- export {};