@oscherbakov/react-flow-automated-layout 1.3.2 → 1.3.3
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.
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { Position as A, useReactFlow as
|
|
4
|
-
import
|
|
5
|
-
const Lt =
|
|
6
|
-
function
|
|
7
|
-
const t =
|
|
1
|
+
import { jsx as u, jsxs as T, Fragment as P } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Ft, useContext as Vt, useState as B, useEffect as V, useRef as dt, useCallback as U } from "react";
|
|
3
|
+
import { Position as A, useReactFlow as It, useNodes as Yt, useEdges as Pt, useOnSelectionChange as jt, ControlButton as D, Controls as Xt } from "@xyflow/react";
|
|
4
|
+
import ut from "@dagrejs/dagre";
|
|
5
|
+
const Lt = Ft(void 0);
|
|
6
|
+
function I() {
|
|
7
|
+
const t = Vt(Lt);
|
|
8
8
|
if (t === void 0)
|
|
9
9
|
throw new Error("useLayoutContext must be used within a LayoutProvider");
|
|
10
10
|
return t;
|
|
@@ -35,7 +35,7 @@ const ft = (t) => {
|
|
|
35
35
|
default:
|
|
36
36
|
return "DOWN";
|
|
37
37
|
}
|
|
38
|
-
},
|
|
38
|
+
}, Jt = {
|
|
39
39
|
enabled: !0,
|
|
40
40
|
padding: {
|
|
41
41
|
horizontal: 80,
|
|
@@ -44,7 +44,7 @@ const ft = (t) => {
|
|
|
44
44
|
respectHeaderHeight: !0,
|
|
45
45
|
minWidth: 200,
|
|
46
46
|
minHeight: 100
|
|
47
|
-
},
|
|
47
|
+
}, Zt = (t) => {
|
|
48
48
|
switch (t) {
|
|
49
49
|
case "DOWN":
|
|
50
50
|
return A.Bottom;
|
|
@@ -57,7 +57,7 @@ const ft = (t) => {
|
|
|
57
57
|
default:
|
|
58
58
|
return A.Bottom;
|
|
59
59
|
}
|
|
60
|
-
},
|
|
60
|
+
}, qt = (t) => {
|
|
61
61
|
switch (t) {
|
|
62
62
|
case "DOWN":
|
|
63
63
|
return A.Top;
|
|
@@ -71,7 +71,7 @@ const ft = (t) => {
|
|
|
71
71
|
return A.Top;
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
function
|
|
74
|
+
function Qt(t, r, e) {
|
|
75
75
|
if (e)
|
|
76
76
|
return { nodes: t, edges: r };
|
|
77
77
|
const o = t.filter((l) => !l.hidden), n = new Set(o.map((l) => l.id)), i = r.filter(
|
|
@@ -79,8 +79,8 @@ function qt(t, r, e) {
|
|
|
79
79
|
);
|
|
80
80
|
return { nodes: o, edges: i };
|
|
81
81
|
}
|
|
82
|
-
const
|
|
83
|
-
const a = new
|
|
82
|
+
const Wt = 172, Kt = 36, X = async (t, r, e, o = 0, n = 50, i = 50, l = Wt, c = Kt, h = !1) => {
|
|
83
|
+
const a = new ut.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
|
|
84
84
|
a.setGraph({
|
|
85
85
|
rankdir: e,
|
|
86
86
|
marginx: o,
|
|
@@ -91,55 +91,55 @@ const Qt = 172, Wt = 36, X = async (t, r, e, o = 0, n = 50, i = 50, l = Qt, c =
|
|
|
91
91
|
//When we have siblings, we want their top edges to be aligned
|
|
92
92
|
ranker: "tight-tree"
|
|
93
93
|
});
|
|
94
|
-
const s = h ? t : t.filter((
|
|
94
|
+
const s = h ? t : t.filter((f) => !f.hidden);
|
|
95
95
|
if (s.length === 0)
|
|
96
96
|
return { nodes: [], edges: [], width: 0, height: 0 };
|
|
97
|
-
s.forEach((
|
|
98
|
-
var
|
|
99
|
-
const
|
|
100
|
-
a.setNode(
|
|
101
|
-
}), r.forEach((
|
|
102
|
-
var
|
|
103
|
-
const
|
|
104
|
-
let
|
|
105
|
-
|
|
106
|
-
}),
|
|
107
|
-
const
|
|
97
|
+
s.forEach((f) => {
|
|
98
|
+
var w, y;
|
|
99
|
+
const p = Number((w = f.style) == null ? void 0 : w.width) || l, m = Number((y = f.style) == null ? void 0 : y.height) || c;
|
|
100
|
+
a.setNode(f.id, { width: p, height: m });
|
|
101
|
+
}), r.forEach((f) => {
|
|
102
|
+
var C, b;
|
|
103
|
+
const p = f.sourceHandle, m = f.targetHandle, w = !!((C = f.data) != null && C.isReciprocal), y = !!((b = f.data) != null && b.isSyntheticBridge);
|
|
104
|
+
let g = {};
|
|
105
|
+
w ? g = { constraint: !1, minlen: 1, weight: 5 } : y ? g = { constraint: !0, minlen: 1, weight: 4 } : p === "right" && m === "left" ? g = { constraint: !1, minlen: 1 } : p === "bottom" && m === "top" ? g = { constraint: !0, minlen: 1 } : g = { constraint: !0, minlen: 2 }, a.setEdge(f.source, f.target, g);
|
|
106
|
+
}), ut.layout(a);
|
|
107
|
+
const d = a.graph().width || 0, x = a.graph().height || 0, N = Zt(pt(e)), L = qt(pt(e));
|
|
108
108
|
return {
|
|
109
|
-
nodes: s.map((
|
|
110
|
-
var
|
|
111
|
-
const
|
|
112
|
-
...
|
|
109
|
+
nodes: s.map((f) => {
|
|
110
|
+
var b;
|
|
111
|
+
const p = a.node(f.id), { width: m, height: w } = p, y = {
|
|
112
|
+
...f,
|
|
113
113
|
sourcePosition: N,
|
|
114
|
-
targetPosition:
|
|
114
|
+
targetPosition: L,
|
|
115
115
|
selected: !1
|
|
116
|
-
},
|
|
117
|
-
switch ((
|
|
116
|
+
}, g = p.x, C = p.y;
|
|
117
|
+
switch ((b = f.data) == null ? void 0 : b.positionType) {
|
|
118
118
|
case "center":
|
|
119
|
-
|
|
119
|
+
y.position = { x: g, y: C };
|
|
120
120
|
break;
|
|
121
121
|
case "topRight":
|
|
122
|
-
|
|
122
|
+
y.position = { x: g + m / 2, y: C - w / 2 };
|
|
123
123
|
break;
|
|
124
124
|
case "bottomLeft":
|
|
125
|
-
|
|
125
|
+
y.position = { x: g - m / 2, y: C + w / 2 };
|
|
126
126
|
break;
|
|
127
127
|
case "bottomRight":
|
|
128
|
-
|
|
128
|
+
y.position = { x: g + m / 2, y: C + w / 2 };
|
|
129
129
|
break;
|
|
130
130
|
case "topLeft":
|
|
131
131
|
default:
|
|
132
|
-
|
|
132
|
+
y.position = { x: g - m / 2, y: C - w / 2 };
|
|
133
133
|
}
|
|
134
|
-
return
|
|
134
|
+
return y;
|
|
135
135
|
}),
|
|
136
136
|
edges: r,
|
|
137
|
-
width:
|
|
138
|
-
height:
|
|
137
|
+
width: d,
|
|
138
|
+
height: x
|
|
139
139
|
};
|
|
140
|
-
},
|
|
140
|
+
}, te = {
|
|
141
141
|
calculate: async (t, r, e) => {
|
|
142
|
-
const o = e.nodes || t, n = e.edges || r, l = e.dagreDirection || typeof e.direction == "string" && (e.direction === "RIGHT" || e.direction === "LEFT" ? "LR" : "TB") || "TB", c = e.margin ?? (typeof e.padding == "number" ? e.padding : 0), h = e.nodeSpacing ?? 50, a = e.layerSpacing ?? 50, s = e.nodeWidth ?? 172,
|
|
142
|
+
const o = e.nodes || t, n = e.edges || r, l = e.dagreDirection || typeof e.direction == "string" && (e.direction === "RIGHT" || e.direction === "LEFT" ? "LR" : "TB") || "TB", c = e.margin ?? (typeof e.padding == "number" ? e.padding : 0), h = e.nodeSpacing ?? 50, a = e.layerSpacing ?? 50, s = e.nodeWidth ?? 172, d = e.nodeHeight ?? 36, x = e.layoutHidden ?? !1;
|
|
143
143
|
return X(
|
|
144
144
|
o,
|
|
145
145
|
n,
|
|
@@ -148,14 +148,14 @@ const Qt = 172, Wt = 36, X = async (t, r, e, o = 0, n = 50, i = 50, l = Qt, c =
|
|
|
148
148
|
h,
|
|
149
149
|
a,
|
|
150
150
|
s,
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
d,
|
|
152
|
+
x
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
|
-
},
|
|
156
|
-
dagre:
|
|
155
|
+
}, ee = {
|
|
156
|
+
dagre: te
|
|
157
157
|
};
|
|
158
|
-
function
|
|
158
|
+
function re({
|
|
159
159
|
initialDirection: t = "DOWN",
|
|
160
160
|
initialAlgorithm: r = "layered",
|
|
161
161
|
initialAutoLayout: e = !0,
|
|
@@ -166,38 +166,38 @@ function ee({
|
|
|
166
166
|
includeHidden: c = !1,
|
|
167
167
|
layoutEngines: h
|
|
168
168
|
}) {
|
|
169
|
-
const [a, s] = B(t), [
|
|
170
|
-
...
|
|
169
|
+
const [a, s] = B(t), [d, x] = B(r), [N, L] = B(e), [E, f] = B(!1), [p, m] = B(c), [w, y] = B({
|
|
170
|
+
...ee,
|
|
171
171
|
...h
|
|
172
|
-
}), [
|
|
173
|
-
...
|
|
172
|
+
}), [g, C] = B({}), [b, M] = B(o), [G, O] = B(n.node || 150), [k, v] = B(n.layer || 180), [S, R] = B(i.width || 100), [_, J] = B(i.height || 100), [Z, q] = B({
|
|
173
|
+
...Jt,
|
|
174
174
|
...l,
|
|
175
175
|
enabled: e
|
|
176
|
-
}), [
|
|
176
|
+
}), [Y, Q] = B([]);
|
|
177
177
|
return {
|
|
178
178
|
// State
|
|
179
179
|
direction: a,
|
|
180
|
-
algorithm:
|
|
180
|
+
algorithm: d,
|
|
181
181
|
autoLayout: N,
|
|
182
|
-
layoutInProgress:
|
|
183
|
-
layoutHidden:
|
|
184
|
-
layoutEngines:
|
|
185
|
-
layoutEngineOptions:
|
|
186
|
-
padding:
|
|
182
|
+
layoutInProgress: E,
|
|
183
|
+
layoutHidden: p,
|
|
184
|
+
layoutEngines: w,
|
|
185
|
+
layoutEngineOptions: g,
|
|
186
|
+
padding: b,
|
|
187
187
|
nodeSpacing: G,
|
|
188
188
|
layerSpacing: k,
|
|
189
189
|
nodeWidth: S,
|
|
190
190
|
nodeHeight: _,
|
|
191
191
|
parentResizingOptions: Z,
|
|
192
|
-
selectedNodes:
|
|
192
|
+
selectedNodes: Y,
|
|
193
193
|
// Setters
|
|
194
194
|
setDirection: s,
|
|
195
|
-
setAlgorithm:
|
|
196
|
-
setAutoLayout:
|
|
197
|
-
setLayoutInProgress:
|
|
195
|
+
setAlgorithm: x,
|
|
196
|
+
setAutoLayout: L,
|
|
197
|
+
setLayoutInProgress: f,
|
|
198
198
|
setLayoutHidden: m,
|
|
199
|
-
setLayoutEngines:
|
|
200
|
-
setLayoutEngineOptions:
|
|
199
|
+
setLayoutEngines: y,
|
|
200
|
+
setLayoutEngineOptions: C,
|
|
201
201
|
setPadding: M,
|
|
202
202
|
setNodeSpacing: O,
|
|
203
203
|
setLayerSpacing: v,
|
|
@@ -207,49 +207,50 @@ function ee({
|
|
|
207
207
|
setSelectedNodes: Q
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function ne({
|
|
211
211
|
nodes: t,
|
|
212
212
|
externalNodeIdWithNode: r,
|
|
213
213
|
externalNodeParentIdMapWithChildIdSet: e,
|
|
214
214
|
noParentKey: o = "no-parent"
|
|
215
215
|
}) {
|
|
216
|
-
const [n, i] = B(/* @__PURE__ */ new Map()), [l, c] = B(/* @__PURE__ */ new Map()), [h, a] = B({}), [s,
|
|
216
|
+
const [n, i] = B(/* @__PURE__ */ new Map()), [l, c] = B(/* @__PURE__ */ new Map()), [h, a] = B({}), [s, d] = B(t.length), [x, N] = B(!1), [L, E] = B(!1), f = r || n, p = e || l, m = f.size;
|
|
217
217
|
return V(() => {
|
|
218
218
|
if (!r || !e) {
|
|
219
|
-
const
|
|
220
|
-
t.forEach((
|
|
221
|
-
var
|
|
222
|
-
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
}), r || i(
|
|
219
|
+
const w = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map();
|
|
220
|
+
E(!1), t.forEach((g) => {
|
|
221
|
+
var b;
|
|
222
|
+
w.set(g.id, g);
|
|
223
|
+
const C = g.parentId || o;
|
|
224
|
+
y.has(C) || y.set(C, /* @__PURE__ */ new Set()), (b = y.get(C)) == null || b.add(g.id);
|
|
225
|
+
}), r || i(w), e || c(y);
|
|
226
226
|
}
|
|
227
227
|
}, [t, r, e, o]), V(() => {
|
|
228
|
-
t.length !== s &&
|
|
228
|
+
t.length !== s && d(t.length);
|
|
229
229
|
}, [t]), V(() => {
|
|
230
|
-
|
|
231
|
-
}, [
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
230
|
+
f.size > 0 && p.size > 0 && !x && (N(!0), E(!0));
|
|
231
|
+
}, [f, p, x]), V(() => {
|
|
232
|
+
const w = {};
|
|
233
|
+
p.forEach((g, C) => {
|
|
234
|
+
w[C] = g.size;
|
|
235
235
|
});
|
|
236
|
-
let
|
|
237
|
-
for (const
|
|
238
|
-
if (!h.hasOwnProperty(
|
|
239
|
-
|
|
236
|
+
let y = !1;
|
|
237
|
+
for (const g in w)
|
|
238
|
+
if (!h.hasOwnProperty(g) || w[g] !== h[g]) {
|
|
239
|
+
y = !0;
|
|
240
240
|
break;
|
|
241
241
|
}
|
|
242
|
-
|
|
243
|
-
}, [
|
|
244
|
-
nodeIdWithNode:
|
|
245
|
-
nodeParentIdMapWithChildIdSet:
|
|
246
|
-
numberOfNodes:
|
|
242
|
+
y && a(w);
|
|
243
|
+
}, [p]), {
|
|
244
|
+
nodeIdWithNode: f,
|
|
245
|
+
nodeParentIdMapWithChildIdSet: p,
|
|
246
|
+
numberOfNodes: m,
|
|
247
247
|
nodesLength: s,
|
|
248
|
-
|
|
248
|
+
nodesInitialized: L,
|
|
249
|
+
childrenInitialized: x,
|
|
249
250
|
parentChildStructure: h
|
|
250
251
|
};
|
|
251
252
|
}
|
|
252
|
-
function
|
|
253
|
+
function oe({
|
|
253
254
|
nodes: t,
|
|
254
255
|
edges: r,
|
|
255
256
|
selectedNodes: e,
|
|
@@ -262,22 +263,22 @@ function ne({
|
|
|
262
263
|
setNodeSpacing: a,
|
|
263
264
|
setLayerSpacing: s
|
|
264
265
|
}) {
|
|
265
|
-
const
|
|
266
|
-
|
|
266
|
+
const d = It(), x = dt(null), N = dt(null), L = U(async (f = [], p = []) => {
|
|
267
|
+
x.current && x.current.abort();
|
|
267
268
|
const m = new AbortController();
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
if (
|
|
271
|
-
return { nodes:
|
|
269
|
+
x.current = m;
|
|
270
|
+
const w = f.length > 0 ? f : t, y = p.length > 0 ? p : r;
|
|
271
|
+
if (w.length === 0)
|
|
272
|
+
return { nodes: w, edges: y };
|
|
272
273
|
try {
|
|
273
274
|
if (h(!0), m.signal.aborted)
|
|
274
|
-
return { nodes:
|
|
275
|
-
const { nodes:
|
|
276
|
-
return m.signal.aborted ? { nodes:
|
|
277
|
-
} catch (
|
|
278
|
-
return m.signal.aborted || console.error("Error applying layout:",
|
|
275
|
+
return { nodes: w, edges: y };
|
|
276
|
+
const { nodes: g, edges: C } = Qt(w, y, o), b = await n(g, C, e, m.signal);
|
|
277
|
+
return m.signal.aborted ? { nodes: w, edges: y } : (x.current === m && (l ? l(b.nodes) : d != null && d.setNodes && d.setNodes(b.nodes), c ? c(b.edges) : d != null && d.setEdges && d.setEdges(b.edges), N.current && (N.current.node !== void 0 && a(N.current.node), N.current.layer !== void 0 && s(N.current.layer), N.current = null)), b);
|
|
278
|
+
} catch (g) {
|
|
279
|
+
return m.signal.aborted || console.error("Error applying layout:", g), { nodes: w, edges: y };
|
|
279
280
|
} finally {
|
|
280
|
-
|
|
281
|
+
x.current === m && (h(!1), x.current = null);
|
|
281
282
|
}
|
|
282
283
|
}, [
|
|
283
284
|
t,
|
|
@@ -286,32 +287,32 @@ function ne({
|
|
|
286
287
|
n,
|
|
287
288
|
l,
|
|
288
289
|
c,
|
|
289
|
-
|
|
290
|
+
d,
|
|
290
291
|
o,
|
|
291
292
|
h,
|
|
292
293
|
a,
|
|
293
294
|
s
|
|
294
|
-
]),
|
|
295
|
-
|
|
296
|
-
const
|
|
297
|
-
if (
|
|
295
|
+
]), E = U(async (f) => {
|
|
296
|
+
x.current && x.current.abort();
|
|
297
|
+
const p = new AbortController();
|
|
298
|
+
if (x.current = p, t.length === 0) return { nodes: t, edges: r };
|
|
298
299
|
try {
|
|
299
|
-
if (h(!0),
|
|
300
|
-
const m = await i(
|
|
301
|
-
return
|
|
300
|
+
if (h(!0), p.signal.aborted) return { nodes: t, edges: r };
|
|
301
|
+
const m = await i(f, t, r, p.signal);
|
|
302
|
+
return p.signal.aborted ? { nodes: t, edges: r } : (x.current === p && (l ? l(m.nodes) : d != null && d.setNodes && d.setNodes(m.nodes), c ? c(m.edges) : d != null && d.setEdges && d.setEdges(m.edges)), m);
|
|
302
303
|
} catch (m) {
|
|
303
|
-
return
|
|
304
|
+
return p.signal.aborted || console.error("Error applying container layout:", m), { nodes: t, edges: r };
|
|
304
305
|
} finally {
|
|
305
|
-
|
|
306
|
+
x.current === p && (h(!1), x.current = null);
|
|
306
307
|
}
|
|
307
|
-
}, [t, r, i, l, c,
|
|
308
|
+
}, [t, r, i, l, c, d, h]);
|
|
308
309
|
return {
|
|
309
|
-
applyLayout:
|
|
310
|
-
applyContainerLayout:
|
|
310
|
+
applyLayout: L,
|
|
311
|
+
applyContainerLayout: E,
|
|
311
312
|
pendingSpacingUpdateRef: N
|
|
312
313
|
};
|
|
313
314
|
}
|
|
314
|
-
const
|
|
315
|
+
const ie = (t, r, e = "no-parent") => {
|
|
315
316
|
const o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map();
|
|
316
317
|
t.forEach((c, h) => {
|
|
317
318
|
const a = r.get(h);
|
|
@@ -327,11 +328,11 @@ const oe = (t, r, e = "no-parent") => {
|
|
|
327
328
|
o.add(c);
|
|
328
329
|
const s = n.get(c);
|
|
329
330
|
s.depth = h;
|
|
330
|
-
const
|
|
331
|
-
for (const
|
|
332
|
-
if (t.has(
|
|
333
|
-
const
|
|
334
|
-
|
|
331
|
+
const d = t.get(c) || /* @__PURE__ */ new Set();
|
|
332
|
+
for (const x of d)
|
|
333
|
+
if (t.has(x) && r.get(x)) {
|
|
334
|
+
const L = i(x, h + 1);
|
|
335
|
+
L && s.children.push(L);
|
|
335
336
|
}
|
|
336
337
|
return s;
|
|
337
338
|
}, l = [];
|
|
@@ -340,13 +341,13 @@ const oe = (t, r, e = "no-parent") => {
|
|
|
340
341
|
if (a) {
|
|
341
342
|
const s = a.parentId;
|
|
342
343
|
if (!s || s === e) {
|
|
343
|
-
const
|
|
344
|
-
|
|
344
|
+
const d = i(h, 0);
|
|
345
|
+
d && l.push(d);
|
|
345
346
|
}
|
|
346
347
|
}
|
|
347
348
|
}), l;
|
|
348
349
|
};
|
|
349
|
-
function
|
|
350
|
+
function tt(t, r, e = "no-parent") {
|
|
350
351
|
const o = [];
|
|
351
352
|
let n = t;
|
|
352
353
|
const i = /* @__PURE__ */ new Set();
|
|
@@ -368,29 +369,29 @@ function et(t, r, e = "no-parent") {
|
|
|
368
369
|
function z(t, r, e, o = "no-parent") {
|
|
369
370
|
if (t === r)
|
|
370
371
|
return t;
|
|
371
|
-
const n =
|
|
372
|
+
const n = tt(t, e, o), i = n.indexOf(r);
|
|
372
373
|
return i === -1 ? null : i === 0 ? t : n[i - 1] || null;
|
|
373
374
|
}
|
|
374
375
|
function F(t, r, e, o = "no-parent") {
|
|
375
|
-
const n =
|
|
376
|
+
const n = tt(t, e, o), i = tt(r, e, o), l = new Set(i);
|
|
376
377
|
let c = null, h = -1;
|
|
377
|
-
for (let
|
|
378
|
-
if (l.has(n[
|
|
379
|
-
c = n[
|
|
378
|
+
for (let x = 0; x < n.length; x++)
|
|
379
|
+
if (l.has(n[x])) {
|
|
380
|
+
c = n[x], h = x;
|
|
380
381
|
break;
|
|
381
382
|
}
|
|
382
383
|
if (!c)
|
|
383
384
|
return { lca: null, sourceChild: null, targetChild: null };
|
|
384
|
-
const a = i.indexOf(c), s = h > 0 ? n[h - 1] : t,
|
|
385
|
-
return { lca: c, sourceChild: s, targetChild:
|
|
385
|
+
const a = i.indexOf(c), s = h > 0 ? n[h - 1] : t, d = a > 0 ? i[a - 1] : r;
|
|
386
|
+
return { lca: c, sourceChild: s, targetChild: d };
|
|
386
387
|
}
|
|
387
|
-
const
|
|
388
|
-
const i =
|
|
388
|
+
const se = (t) => JSON.parse(JSON.stringify(t)), Et = (t, r, e, o, n) => {
|
|
389
|
+
const i = se(t);
|
|
389
390
|
return i.source = r, i.target = e, i.id = o, i.data = {
|
|
390
391
|
...i.data,
|
|
391
392
|
...n
|
|
392
393
|
}, i;
|
|
393
|
-
},
|
|
394
|
+
}, ce = (t) => {
|
|
394
395
|
for (const r of t.values()) {
|
|
395
396
|
const e = /* @__PURE__ */ new Map();
|
|
396
397
|
r.forEach((n) => {
|
|
@@ -413,7 +414,7 @@ const ie = (t) => JSON.parse(JSON.stringify(t)), Et = (t, r, e, o, n) => {
|
|
|
413
414
|
}), o.add(i), o.add(l);
|
|
414
415
|
});
|
|
415
416
|
}
|
|
416
|
-
},
|
|
417
|
+
}, ae = (t, r, e, o) => {
|
|
417
418
|
const n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
418
419
|
t.forEach((c) => {
|
|
419
420
|
const h = n.get(c.target) || [];
|
|
@@ -425,82 +426,82 @@ const ie = (t) => JSON.parse(JSON.stringify(t)), Et = (t, r, e, o, n) => {
|
|
|
425
426
|
i.forEach((c, h) => {
|
|
426
427
|
const a = n.get(h) || [];
|
|
427
428
|
a.length !== 0 && a.forEach((s) => {
|
|
428
|
-
c.forEach((
|
|
429
|
-
if (s.source ===
|
|
429
|
+
c.forEach((d) => {
|
|
430
|
+
if (s.source === d.target)
|
|
430
431
|
return;
|
|
431
|
-
const { lca:
|
|
432
|
+
const { lca: x, sourceChild: N, targetChild: L } = F(
|
|
432
433
|
s.source,
|
|
433
|
-
|
|
434
|
+
d.target,
|
|
434
435
|
r,
|
|
435
436
|
o
|
|
436
|
-
),
|
|
437
|
+
), E = F(
|
|
437
438
|
s.source,
|
|
438
439
|
h,
|
|
439
440
|
r,
|
|
440
441
|
o
|
|
441
|
-
).lca,
|
|
442
|
+
).lca, f = F(
|
|
442
443
|
h,
|
|
443
|
-
|
|
444
|
+
d.target,
|
|
444
445
|
r,
|
|
445
446
|
o
|
|
446
447
|
).lca;
|
|
447
|
-
if (!
|
|
448
|
+
if (!E || E !== f)
|
|
448
449
|
return;
|
|
449
|
-
const
|
|
450
|
+
const p = z(
|
|
450
451
|
s.source,
|
|
451
|
-
|
|
452
|
+
E,
|
|
452
453
|
r,
|
|
453
454
|
o
|
|
454
455
|
), m = z(
|
|
455
|
-
|
|
456
|
-
|
|
456
|
+
d.target,
|
|
457
|
+
E,
|
|
457
458
|
r,
|
|
458
459
|
o
|
|
459
|
-
),
|
|
460
|
+
), w = z(
|
|
460
461
|
h,
|
|
461
|
-
|
|
462
|
+
E,
|
|
462
463
|
r,
|
|
463
464
|
o
|
|
464
465
|
);
|
|
465
|
-
if (!
|
|
466
|
+
if (!p || !m || !w || p !== m || p === w)
|
|
466
467
|
return;
|
|
467
|
-
const
|
|
468
|
+
const y = p, g = z(
|
|
468
469
|
s.source,
|
|
469
|
-
|
|
470
|
+
y,
|
|
470
471
|
r,
|
|
471
472
|
o
|
|
472
|
-
),
|
|
473
|
-
|
|
474
|
-
|
|
473
|
+
), C = z(
|
|
474
|
+
d.target,
|
|
475
|
+
y,
|
|
475
476
|
r,
|
|
476
477
|
o
|
|
477
478
|
);
|
|
478
|
-
if (!
|
|
479
|
+
if (!x || !N || !L || !g || !C || g === C)
|
|
479
480
|
return;
|
|
480
|
-
const
|
|
481
|
-
if (l.has(
|
|
481
|
+
const b = `synthetic_bridge_${s.id}_${h}_${d.id}_${y}`;
|
|
482
|
+
if (l.has(b))
|
|
482
483
|
return;
|
|
483
484
|
const M = Et(
|
|
484
485
|
s,
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
g,
|
|
487
|
+
C,
|
|
488
|
+
b,
|
|
488
489
|
{
|
|
489
490
|
isTemporary: !0,
|
|
490
491
|
isSyntheticBridge: !0,
|
|
491
492
|
bridgeNode: h,
|
|
492
|
-
bridgeBranch:
|
|
493
|
-
anchorBranch:
|
|
493
|
+
bridgeBranch: w,
|
|
494
|
+
anchorBranch: p,
|
|
494
495
|
originalSource: s.source,
|
|
495
|
-
originalTarget:
|
|
496
|
+
originalTarget: d.target
|
|
496
497
|
}
|
|
497
498
|
);
|
|
498
|
-
e.has(
|
|
499
|
+
e.has(y) || e.set(y, []), e.get(y).push(M), l.add(b);
|
|
499
500
|
});
|
|
500
501
|
});
|
|
501
502
|
});
|
|
502
503
|
};
|
|
503
|
-
function
|
|
504
|
+
function et(t, r, e = "no-parent") {
|
|
504
505
|
const o = /* @__PURE__ */ new Map();
|
|
505
506
|
for (const n of t) {
|
|
506
507
|
const { lca: i, sourceChild: l, targetChild: c } = F(
|
|
@@ -524,9 +525,9 @@ function rt(t, r, e = "no-parent") {
|
|
|
524
525
|
o.has(i) || o.set(i, []), o.get(i).push(h);
|
|
525
526
|
}
|
|
526
527
|
}
|
|
527
|
-
return
|
|
528
|
+
return ae(t, r, o, e), ce(o), o;
|
|
528
529
|
}
|
|
529
|
-
const
|
|
530
|
+
const rt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
|
|
530
531
|
var c, h;
|
|
531
532
|
const o = e.get(t);
|
|
532
533
|
if (!o)
|
|
@@ -551,13 +552,13 @@ const nt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
|
|
|
551
552
|
x: t.position.x + r / 2,
|
|
552
553
|
y: t.position.y + e / 2
|
|
553
554
|
};
|
|
554
|
-
},
|
|
555
|
+
}, le = (t, r) => {
|
|
555
556
|
if (t.length === 0)
|
|
556
557
|
return { nodes: t, width: 0, height: 0 };
|
|
557
558
|
let e = Number.POSITIVE_INFINITY, o = Number.POSITIVE_INFINITY, n = Number.NEGATIVE_INFINITY, i = Number.NEGATIVE_INFINITY;
|
|
558
559
|
t.forEach((s) => {
|
|
559
|
-
const { width:
|
|
560
|
-
e = Math.min(e, s.position.x), o = Math.min(o, s.position.y), n = Math.max(n, s.position.x +
|
|
560
|
+
const { width: d, height: x } = $(s);
|
|
561
|
+
e = Math.min(e, s.position.x), o = Math.min(o, s.position.y), n = Math.max(n, s.position.x + d), i = Math.max(i, s.position.y + x);
|
|
561
562
|
});
|
|
562
563
|
const l = r - e, c = r - o;
|
|
563
564
|
t.forEach((s) => {
|
|
@@ -568,7 +569,7 @@ const nt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
|
|
|
568
569
|
});
|
|
569
570
|
const h = n - e + r * 2, a = i - o + r * 2;
|
|
570
571
|
return { nodes: t, width: h, height: a };
|
|
571
|
-
},
|
|
572
|
+
}, he = (t, r, e, o) => {
|
|
572
573
|
if (!(t.length < 2 || o.size === 0))
|
|
573
574
|
if (r === "TB" || r === "BT") {
|
|
574
575
|
const n = [...t].sort((i, l) => i.position.x - l.position.x);
|
|
@@ -577,8 +578,8 @@ const nt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
|
|
|
577
578
|
return;
|
|
578
579
|
let c = i.position.x + $(i).width;
|
|
579
580
|
for (let h = l + 1; h < n.length; h++) {
|
|
580
|
-
const a = n[h], { width: s } = $(a),
|
|
581
|
-
a.position.x <
|
|
581
|
+
const a = n[h], { width: s } = $(a), d = c + e;
|
|
582
|
+
a.position.x < d && (a.position.x = d), c = a.position.x + s;
|
|
582
583
|
}
|
|
583
584
|
});
|
|
584
585
|
} else {
|
|
@@ -588,12 +589,12 @@ const nt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
|
|
|
588
589
|
return;
|
|
589
590
|
let c = i.position.y + $(i).height;
|
|
590
591
|
for (let h = l + 1; h < n.length; h++) {
|
|
591
|
-
const a = n[h], { height: s } = $(a),
|
|
592
|
-
a.position.y <
|
|
592
|
+
const a = n[h], { height: s } = $(a), d = c + e;
|
|
593
|
+
a.position.y < d && (a.position.y = d), c = a.position.y + s;
|
|
593
594
|
}
|
|
594
595
|
});
|
|
595
596
|
}
|
|
596
|
-
},
|
|
597
|
+
}, de = (t, r, e, o) => {
|
|
597
598
|
const n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
598
599
|
r.forEach((c) => {
|
|
599
600
|
const h = n.get(c.target) || [];
|
|
@@ -605,88 +606,88 @@ const nt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
|
|
|
605
606
|
return i.forEach((c, h) => {
|
|
606
607
|
const a = n.get(h) || [];
|
|
607
608
|
a.length !== 0 && a.forEach((s) => {
|
|
608
|
-
c.forEach((
|
|
609
|
-
if (s.source ===
|
|
609
|
+
c.forEach((d) => {
|
|
610
|
+
if (s.source === d.target)
|
|
610
611
|
return;
|
|
611
|
-
const
|
|
612
|
+
const x = F(
|
|
612
613
|
s.source,
|
|
613
614
|
h,
|
|
614
615
|
e,
|
|
615
616
|
o
|
|
616
617
|
).lca, N = F(
|
|
617
618
|
h,
|
|
618
|
-
|
|
619
|
+
d.target,
|
|
619
620
|
e,
|
|
620
621
|
o
|
|
621
622
|
).lca;
|
|
622
|
-
if (
|
|
623
|
+
if (x !== t || N !== t)
|
|
623
624
|
return;
|
|
624
|
-
const
|
|
625
|
+
const L = z(
|
|
625
626
|
s.source,
|
|
626
627
|
t,
|
|
627
628
|
e,
|
|
628
629
|
o
|
|
629
|
-
),
|
|
630
|
-
|
|
630
|
+
), E = z(
|
|
631
|
+
d.target,
|
|
631
632
|
t,
|
|
632
633
|
e,
|
|
633
634
|
o
|
|
634
|
-
),
|
|
635
|
+
), f = z(
|
|
635
636
|
h,
|
|
636
637
|
t,
|
|
637
638
|
e,
|
|
638
639
|
o
|
|
639
640
|
);
|
|
640
|
-
if (!
|
|
641
|
+
if (!L || !E || !f || L !== E || L === f)
|
|
641
642
|
return;
|
|
642
|
-
const
|
|
643
|
+
const p = z(
|
|
643
644
|
s.source,
|
|
644
|
-
|
|
645
|
+
L,
|
|
645
646
|
e,
|
|
646
647
|
o
|
|
647
648
|
), m = z(
|
|
648
|
-
|
|
649
|
-
|
|
649
|
+
d.target,
|
|
650
|
+
L,
|
|
650
651
|
e,
|
|
651
652
|
o
|
|
652
653
|
);
|
|
653
|
-
if (!
|
|
654
|
+
if (!p || !m || p === m)
|
|
654
655
|
return;
|
|
655
|
-
const
|
|
656
|
-
l.set(
|
|
657
|
-
anchorContainerId:
|
|
658
|
-
bridgeContainerId:
|
|
659
|
-
sourceNodeId:
|
|
656
|
+
const w = `${L}:${f}:${p}:${m}`;
|
|
657
|
+
l.set(w, {
|
|
658
|
+
anchorContainerId: L,
|
|
659
|
+
bridgeContainerId: f,
|
|
660
|
+
sourceNodeId: p,
|
|
660
661
|
targetNodeId: m
|
|
661
662
|
});
|
|
662
663
|
});
|
|
663
664
|
});
|
|
664
665
|
}), [...l.values()];
|
|
665
666
|
}, ue = (t, r, e, o, n, i, l) => {
|
|
666
|
-
const c =
|
|
667
|
+
const c = de(r, n, i, l), h = /* @__PURE__ */ new Set();
|
|
667
668
|
return c.forEach((a) => {
|
|
668
|
-
const s = gt(t, a.anchorContainerId),
|
|
669
|
-
if (!s || !
|
|
669
|
+
const s = gt(t, a.anchorContainerId), d = gt(t, a.bridgeContainerId);
|
|
670
|
+
if (!s || !d)
|
|
670
671
|
return;
|
|
671
|
-
const
|
|
672
|
-
if (!
|
|
672
|
+
const x = yt(a.sourceNodeId, r, i), N = yt(a.targetNodeId, r, i);
|
|
673
|
+
if (!x || !N)
|
|
673
674
|
return;
|
|
674
|
-
const { width:
|
|
675
|
+
const { width: L, height: E } = $(d), { width: f, height: p } = $(s), m = xt(s), w = xt(d);
|
|
675
676
|
if (e === "TB" || e === "BT") {
|
|
676
|
-
const
|
|
677
|
-
|
|
678
|
-
const
|
|
679
|
-
|
|
677
|
+
const y = (x.y + N.y) / 2;
|
|
678
|
+
d.position.y = y - E / 2;
|
|
679
|
+
const g = w.x >= m.x, C = g ? d.position.x - (s.position.x + f) : s.position.x - (d.position.x + L), b = Math.max(o, C);
|
|
680
|
+
d.position.x = g ? s.position.x + f + b : s.position.x - L - b;
|
|
680
681
|
} else {
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
const
|
|
684
|
-
|
|
682
|
+
const y = (x.x + N.x) / 2;
|
|
683
|
+
d.position.x = y - L / 2;
|
|
684
|
+
const g = w.y >= m.y, C = g ? d.position.y - (s.position.y + p) : s.position.y - (d.position.y + E), b = Math.max(o, C);
|
|
685
|
+
d.position.y = g ? s.position.y + p + b : s.position.y - E - b;
|
|
685
686
|
}
|
|
686
|
-
h.add(
|
|
687
|
+
h.add(d.id);
|
|
687
688
|
}), h;
|
|
688
|
-
}, Nt = async (t, r, e, o, n, i =
|
|
689
|
-
const N =
|
|
689
|
+
}, Nt = async (t, r, e, o, n, i = rt, l = 50, c = 50, h = 172, a = 36, s = X, d = !1, x = "no-parent") => {
|
|
690
|
+
const N = et(n, o, x), { updatedNodes: L } = await j(
|
|
690
691
|
t,
|
|
691
692
|
r,
|
|
692
693
|
e,
|
|
@@ -698,14 +699,14 @@ const nt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
|
|
|
698
699
|
h,
|
|
699
700
|
a,
|
|
700
701
|
s,
|
|
701
|
-
|
|
702
|
+
d,
|
|
702
703
|
N,
|
|
703
|
-
|
|
704
|
-
),
|
|
705
|
-
if (!
|
|
706
|
-
return { updatedNodes:
|
|
707
|
-
const { updatedNodes:
|
|
708
|
-
|
|
704
|
+
x
|
|
705
|
+
), E = o.get(t);
|
|
706
|
+
if (!E)
|
|
707
|
+
return { updatedNodes: L, updatedEdges: n };
|
|
708
|
+
const { updatedNodes: f } = await Nt(
|
|
709
|
+
E.parentId || x,
|
|
709
710
|
r,
|
|
710
711
|
e,
|
|
711
712
|
o,
|
|
@@ -716,83 +717,83 @@ const nt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
|
|
|
716
717
|
h,
|
|
717
718
|
a,
|
|
718
719
|
s,
|
|
719
|
-
|
|
720
|
-
|
|
720
|
+
d,
|
|
721
|
+
x
|
|
721
722
|
);
|
|
722
723
|
return {
|
|
723
|
-
updatedNodes: [...
|
|
724
|
+
updatedNodes: [...f, ...L],
|
|
724
725
|
updatedEdges: n
|
|
725
726
|
// Always return original edges unchanged
|
|
726
727
|
};
|
|
727
|
-
}, j = async (t, r, e, o, n, i =
|
|
728
|
-
const
|
|
729
|
-
if (!
|
|
728
|
+
}, j = async (t, r, e, o, n, i = rt, l = 50, c = 50, h = 172, a = 36, s = X, d = !1, x = /* @__PURE__ */ new Map(), N = "no-parent") => {
|
|
729
|
+
const L = e.get(t);
|
|
730
|
+
if (!L || L.size === 0)
|
|
730
731
|
return { updatedNodes: [] };
|
|
731
|
-
const
|
|
732
|
-
if (
|
|
733
|
-
const M = o.get(
|
|
734
|
-
M &&
|
|
735
|
-
}),
|
|
732
|
+
const E = [];
|
|
733
|
+
if (L.forEach((b) => {
|
|
734
|
+
const M = o.get(b);
|
|
735
|
+
M && E.push(M);
|
|
736
|
+
}), E.length === 0)
|
|
736
737
|
return { updatedNodes: [] };
|
|
737
|
-
let
|
|
738
|
-
const
|
|
739
|
-
|
|
740
|
-
const m =
|
|
741
|
-
|
|
738
|
+
let f = r;
|
|
739
|
+
const p = o.get(t);
|
|
740
|
+
p && p.data.layoutDirection && (f = p.data.layoutDirection);
|
|
741
|
+
const m = x.get(t) || [], { nodes: w, edges: y } = await s(
|
|
742
|
+
E,
|
|
742
743
|
m,
|
|
743
744
|
// Only use temporary edges for layout
|
|
744
|
-
|
|
745
|
+
f,
|
|
745
746
|
i,
|
|
746
747
|
l,
|
|
747
748
|
c,
|
|
748
749
|
h,
|
|
749
750
|
a,
|
|
750
|
-
|
|
751
|
+
d
|
|
751
752
|
);
|
|
752
|
-
|
|
753
|
-
o.set(
|
|
753
|
+
w.forEach((b) => {
|
|
754
|
+
o.set(b.id, b);
|
|
754
755
|
});
|
|
755
|
-
const
|
|
756
|
-
|
|
756
|
+
const g = ue(
|
|
757
|
+
w,
|
|
757
758
|
t,
|
|
758
|
-
|
|
759
|
+
f,
|
|
759
760
|
l,
|
|
760
761
|
n,
|
|
761
762
|
o,
|
|
762
763
|
N
|
|
763
764
|
);
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
765
|
+
he(
|
|
766
|
+
w,
|
|
767
|
+
f,
|
|
767
768
|
l,
|
|
768
|
-
|
|
769
|
-
),
|
|
770
|
-
o.set(
|
|
769
|
+
g
|
|
770
|
+
), w.forEach((b) => {
|
|
771
|
+
o.set(b.id, b);
|
|
771
772
|
});
|
|
772
|
-
const
|
|
773
|
-
return
|
|
774
|
-
o.set(
|
|
775
|
-
}),
|
|
776
|
-
updatedNodes: [...
|
|
777
|
-
udpatedParentNode:
|
|
773
|
+
const C = le(w, i);
|
|
774
|
+
return C.nodes.forEach((b) => {
|
|
775
|
+
o.set(b.id, b);
|
|
776
|
+
}), p && C.width && C.height && fe(p, C.width, C.height), {
|
|
777
|
+
updatedNodes: [...C.nodes],
|
|
778
|
+
udpatedParentNode: p || void 0
|
|
778
779
|
};
|
|
779
|
-
},
|
|
780
|
+
}, fe = (t, r, e) => (t.style || (t.style = {}), t.width = r, t.height = e, t.measured = {
|
|
780
781
|
width: r,
|
|
781
782
|
height: e
|
|
782
|
-
}, t.style.width = r, t.style.height = e, t),
|
|
783
|
+
}, t.style.width = r, t.style.height = e, t), pe = async (t, r, e, o, n, i = rt, l = 50, c = 50, h = 172, a = 36, s = X, d = !1, x = "no-parent") => {
|
|
783
784
|
let N = [];
|
|
784
|
-
const
|
|
785
|
-
let
|
|
786
|
-
const
|
|
787
|
-
|
|
788
|
-
for (const
|
|
789
|
-
|
|
785
|
+
const L = et(n, o, x), E = /* @__PURE__ */ new Map();
|
|
786
|
+
let f = 0;
|
|
787
|
+
const p = (w, y) => {
|
|
788
|
+
y > f && (f = y);
|
|
789
|
+
for (const g of w)
|
|
790
|
+
E.has(y) || E.set(y, []), E.get(y).push(g.id), g.children.length > 0 && p(g.children, y + 1);
|
|
790
791
|
};
|
|
791
|
-
|
|
792
|
-
for (let
|
|
793
|
-
const
|
|
794
|
-
(
|
|
795
|
-
|
|
792
|
+
p(t, 0);
|
|
793
|
+
for (let w = f; w >= 0; w--) {
|
|
794
|
+
const y = E.get(w) || [], g = await Promise.all(y.map(
|
|
795
|
+
(C) => j(
|
|
796
|
+
C,
|
|
796
797
|
r,
|
|
797
798
|
e,
|
|
798
799
|
o,
|
|
@@ -804,17 +805,17 @@ const nt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
|
|
|
804
805
|
h,
|
|
805
806
|
a,
|
|
806
807
|
s,
|
|
807
|
-
|
|
808
|
-
|
|
808
|
+
d,
|
|
809
|
+
L,
|
|
809
810
|
// Pass the global temporary edges map
|
|
810
|
-
|
|
811
|
+
x
|
|
811
812
|
)
|
|
812
813
|
));
|
|
813
|
-
for (const { updatedNodes:
|
|
814
|
-
N = [...
|
|
814
|
+
for (const { updatedNodes: C } of g)
|
|
815
|
+
N = [...C, ...N];
|
|
815
816
|
}
|
|
816
817
|
const { updatedNodes: m } = await j(
|
|
817
|
-
|
|
818
|
+
x,
|
|
818
819
|
r,
|
|
819
820
|
e,
|
|
820
821
|
o,
|
|
@@ -826,17 +827,17 @@ const nt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
|
|
|
826
827
|
h,
|
|
827
828
|
a,
|
|
828
829
|
s,
|
|
829
|
-
|
|
830
|
-
|
|
830
|
+
d,
|
|
831
|
+
L,
|
|
831
832
|
// Process root-level temporary edges
|
|
832
|
-
|
|
833
|
+
x
|
|
833
834
|
);
|
|
834
835
|
return N = [...m, ...N], {
|
|
835
836
|
updatedNodes: N,
|
|
836
837
|
updatedEdges: n
|
|
837
838
|
// Always return original edges unchanged
|
|
838
839
|
};
|
|
839
|
-
},
|
|
840
|
+
}, ge = (t, r, e, o = "no-parent") => {
|
|
840
841
|
const n = t.map((a) => a.id), i = t.map((a) => {
|
|
841
842
|
var s;
|
|
842
843
|
return ((s = e.get(a.id)) == null ? void 0 : s.parentId) || a.parentId;
|
|
@@ -847,7 +848,7 @@ const nt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
|
|
|
847
848
|
return s ? !s.parentId || !c.includes(s.parentId) : !0;
|
|
848
849
|
});
|
|
849
850
|
return h.length === 0 ? [o] : h;
|
|
850
|
-
},
|
|
851
|
+
}, ye = async (t, r, e) => {
|
|
851
852
|
const {
|
|
852
853
|
dagreDirection: o,
|
|
853
854
|
nodeParentIdMapWithChildIdSet: n,
|
|
@@ -857,24 +858,24 @@ const nt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
|
|
|
857
858
|
margin: h,
|
|
858
859
|
nodeSpacing: a,
|
|
859
860
|
layerSpacing: s,
|
|
860
|
-
nodeWidth:
|
|
861
|
-
nodeHeight:
|
|
861
|
+
nodeWidth: d,
|
|
862
|
+
nodeHeight: x,
|
|
862
863
|
layoutHidden: N = !1,
|
|
863
|
-
noParentKey:
|
|
864
|
-
} = r,
|
|
864
|
+
noParentKey: L = "no-parent"
|
|
865
|
+
} = r, E = ge(
|
|
865
866
|
t,
|
|
866
867
|
n,
|
|
867
868
|
i,
|
|
868
|
-
|
|
869
|
+
L
|
|
869
870
|
);
|
|
870
|
-
if (
|
|
871
|
+
if (E.length === 0)
|
|
871
872
|
return { nodes: l, edges: c };
|
|
872
|
-
const
|
|
873
|
+
const f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
873
874
|
if (e != null && e.aborted)
|
|
874
875
|
return { nodes: l, edges: c };
|
|
875
876
|
(await Promise.all(
|
|
876
|
-
|
|
877
|
-
|
|
877
|
+
E.map(async (g) => e != null && e.aborted ? { updatedNodes: [], updatedEdges: [] } : Nt(
|
|
878
|
+
g,
|
|
878
879
|
o,
|
|
879
880
|
n,
|
|
880
881
|
i,
|
|
@@ -882,74 +883,74 @@ const nt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
|
|
|
882
883
|
h,
|
|
883
884
|
a,
|
|
884
885
|
s,
|
|
885
|
-
|
|
886
|
-
|
|
886
|
+
d,
|
|
887
|
+
x,
|
|
887
888
|
void 0,
|
|
888
889
|
N
|
|
889
890
|
))
|
|
890
|
-
)).forEach(({ updatedNodes:
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
}),
|
|
894
|
-
|
|
891
|
+
)).forEach(({ updatedNodes: g, updatedEdges: C }) => {
|
|
892
|
+
g.forEach((b) => {
|
|
893
|
+
f.set(b.id, b);
|
|
894
|
+
}), C.forEach((b) => {
|
|
895
|
+
p.set(b.id, b);
|
|
895
896
|
});
|
|
896
897
|
});
|
|
897
|
-
const
|
|
898
|
-
(
|
|
899
|
-
),
|
|
900
|
-
(
|
|
898
|
+
const w = l.map(
|
|
899
|
+
(g) => f.has(g.id) ? f.get(g.id) : g
|
|
900
|
+
), y = c.map(
|
|
901
|
+
(g) => p.has(g.id) ? p.get(g.id) : g
|
|
901
902
|
);
|
|
902
|
-
return { nodes:
|
|
903
|
-
},
|
|
904
|
-
const
|
|
903
|
+
return { nodes: w, edges: y };
|
|
904
|
+
}, xe = (t, r, e, o, n, i, l, c, h = 172, a = 36, s = !1, d = "no-parent") => {
|
|
905
|
+
const x = U(async (L, E, f, p) => {
|
|
905
906
|
if (!(t[e] || t.dagre))
|
|
906
|
-
return console.error(`Layout engine "${e}" not found`), { nodes:
|
|
907
|
-
const
|
|
908
|
-
(k) =>
|
|
909
|
-
),
|
|
907
|
+
return console.error(`Layout engine "${e}" not found`), { nodes: L, edges: E };
|
|
908
|
+
const w = s ? L : L.filter((k) => !k.hidden), y = new Set(w.map((k) => k.id)), g = s ? E : E.filter(
|
|
909
|
+
(k) => y.has(k.source) && y.has(k.target)
|
|
910
|
+
), C = ft(r), b = o.padding.horizontal;
|
|
910
911
|
let M = [], G = [];
|
|
911
|
-
if (
|
|
912
|
-
const k = s ?
|
|
912
|
+
if (f && f.length > 0) {
|
|
913
|
+
const k = s ? f : f.filter((S) => !S.hidden), v = await ye(
|
|
913
914
|
k,
|
|
914
915
|
{
|
|
915
|
-
dagreDirection:
|
|
916
|
+
dagreDirection: C,
|
|
916
917
|
nodeParentIdMapWithChildIdSet: n,
|
|
917
918
|
nodeIdWithNode: i,
|
|
918
|
-
nodes:
|
|
919
|
-
edges:
|
|
920
|
-
margin:
|
|
919
|
+
nodes: w,
|
|
920
|
+
edges: g,
|
|
921
|
+
margin: b,
|
|
921
922
|
nodeSpacing: l,
|
|
922
923
|
layerSpacing: c,
|
|
923
924
|
nodeWidth: h,
|
|
924
925
|
nodeHeight: a,
|
|
925
926
|
layoutHidden: s,
|
|
926
|
-
noParentKey:
|
|
927
|
+
noParentKey: d
|
|
927
928
|
},
|
|
928
|
-
|
|
929
|
+
p
|
|
929
930
|
);
|
|
930
931
|
M = v.nodes, G = v.edges;
|
|
931
932
|
} else {
|
|
932
|
-
if (
|
|
933
|
-
return { nodes:
|
|
934
|
-
const k =
|
|
933
|
+
if (p != null && p.aborted)
|
|
934
|
+
return { nodes: L, edges: E };
|
|
935
|
+
const k = ie(n, i, d), v = await pe(
|
|
935
936
|
k,
|
|
936
|
-
|
|
937
|
+
C,
|
|
937
938
|
n,
|
|
938
939
|
i,
|
|
939
|
-
|
|
940
|
-
|
|
940
|
+
g,
|
|
941
|
+
b,
|
|
941
942
|
l,
|
|
942
943
|
c,
|
|
943
944
|
h,
|
|
944
945
|
a,
|
|
945
946
|
void 0,
|
|
946
947
|
s,
|
|
947
|
-
|
|
948
|
+
d
|
|
948
949
|
);
|
|
949
950
|
M = v.updatedNodes, G = v.updatedEdges;
|
|
950
951
|
}
|
|
951
952
|
return {
|
|
952
|
-
nodes:
|
|
953
|
+
nodes: L.map((k) => !s && k.hidden ? k : M.find((S) => S.id === k.id) || k),
|
|
953
954
|
edges: G
|
|
954
955
|
};
|
|
955
956
|
}, [
|
|
@@ -964,37 +965,37 @@ const nt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
|
|
|
964
965
|
h,
|
|
965
966
|
a,
|
|
966
967
|
s,
|
|
967
|
-
|
|
968
|
-
]), N = U(async (
|
|
969
|
-
if (
|
|
970
|
-
const m = ft(r),
|
|
968
|
+
d
|
|
969
|
+
]), N = U(async (L, E, f, p) => {
|
|
970
|
+
if (p != null && p.aborted) return { nodes: E, edges: f };
|
|
971
|
+
const m = ft(r), w = o.padding.horizontal, y = s ? E : E.filter((v) => !v.hidden), g = new Set(y.map((v) => v.id)), C = s ? f : f.filter((v) => g.has(v.source) && g.has(v.target)), b = et(C, i, d), M = (v) => {
|
|
971
972
|
const S = [], R = n.get(v);
|
|
972
973
|
if (R)
|
|
973
974
|
for (const _ of R)
|
|
974
975
|
n.has(_) && S.push(...M(_));
|
|
975
976
|
return S.push(v), S;
|
|
976
|
-
}, G = M(
|
|
977
|
+
}, G = M(L), O = /* @__PURE__ */ new Map();
|
|
977
978
|
for (const v of G) {
|
|
978
|
-
if (
|
|
979
|
+
if (p != null && p.aborted) return { nodes: E, edges: f };
|
|
979
980
|
const { updatedNodes: S, udpatedParentNode: R } = await j(
|
|
980
981
|
v,
|
|
981
982
|
m,
|
|
982
983
|
n,
|
|
983
984
|
i,
|
|
984
|
-
|
|
985
|
-
|
|
985
|
+
C,
|
|
986
|
+
w,
|
|
986
987
|
l,
|
|
987
988
|
c,
|
|
988
989
|
h,
|
|
989
990
|
a,
|
|
990
991
|
void 0,
|
|
991
992
|
s,
|
|
992
|
-
|
|
993
|
-
|
|
993
|
+
b,
|
|
994
|
+
d
|
|
994
995
|
);
|
|
995
996
|
S.forEach((_) => O.set(_.id, _)), R && O.set(R.id, { ...R });
|
|
996
997
|
}
|
|
997
|
-
return { nodes:
|
|
998
|
+
return { nodes: E.map((v) => O.get(v.id) ?? v), edges: f };
|
|
998
999
|
}, [
|
|
999
1000
|
r,
|
|
1000
1001
|
o.padding.horizontal,
|
|
@@ -1005,11 +1006,11 @@ const nt = 10, gt = (t, r) => t.find((e) => e.id === r), yt = (t, r, e) => {
|
|
|
1005
1006
|
h,
|
|
1006
1007
|
a,
|
|
1007
1008
|
s,
|
|
1008
|
-
|
|
1009
|
+
d
|
|
1009
1010
|
]);
|
|
1010
|
-
return { calculateLayout:
|
|
1011
|
+
return { calculateLayout: x, calculateContainerLayout: N };
|
|
1011
1012
|
};
|
|
1012
|
-
function
|
|
1013
|
+
function Le({
|
|
1013
1014
|
children: t,
|
|
1014
1015
|
initialDirection: r = "DOWN",
|
|
1015
1016
|
initialAlgorithm: e = "layered",
|
|
@@ -1021,19 +1022,19 @@ function Ce({
|
|
|
1021
1022
|
includeHidden: h = !1,
|
|
1022
1023
|
layoutEngines: a,
|
|
1023
1024
|
updateNodes: s,
|
|
1024
|
-
updateEdges:
|
|
1025
|
-
nodeParentIdMapWithChildIdSet:
|
|
1025
|
+
updateEdges: d,
|
|
1026
|
+
nodeParentIdMapWithChildIdSet: x,
|
|
1026
1027
|
nodeIdWithNode: N,
|
|
1027
|
-
noParentKey:
|
|
1028
|
-
disableAutoLayoutEffect:
|
|
1028
|
+
noParentKey: L = "no-parent",
|
|
1029
|
+
disableAutoLayoutEffect: E = !1
|
|
1029
1030
|
}) {
|
|
1030
|
-
const
|
|
1031
|
+
const f = Yt(), p = Pt(), {
|
|
1031
1032
|
direction: m,
|
|
1032
|
-
algorithm:
|
|
1033
|
-
autoLayout:
|
|
1034
|
-
layoutInProgress:
|
|
1035
|
-
layoutHidden:
|
|
1036
|
-
layoutEngines:
|
|
1033
|
+
algorithm: w,
|
|
1034
|
+
autoLayout: y,
|
|
1035
|
+
layoutInProgress: g,
|
|
1036
|
+
layoutHidden: C,
|
|
1037
|
+
layoutEngines: b,
|
|
1037
1038
|
layoutEngineOptions: M,
|
|
1038
1039
|
padding: G,
|
|
1039
1040
|
nodeSpacing: O,
|
|
@@ -1045,18 +1046,18 @@ function Ce({
|
|
|
1045
1046
|
setDirection: J,
|
|
1046
1047
|
setAlgorithm: Z,
|
|
1047
1048
|
setAutoLayout: q,
|
|
1048
|
-
setLayoutInProgress:
|
|
1049
|
+
setLayoutInProgress: Y,
|
|
1049
1050
|
setLayoutHidden: Q,
|
|
1050
|
-
setLayoutEngines:
|
|
1051
|
+
setLayoutEngines: nt,
|
|
1051
1052
|
setLayoutEngineOptions: vt,
|
|
1052
1053
|
setPadding: Tt,
|
|
1053
|
-
setNodeSpacing:
|
|
1054
|
-
setLayerSpacing:
|
|
1054
|
+
setNodeSpacing: ot,
|
|
1055
|
+
setLayerSpacing: it,
|
|
1055
1056
|
setNodeWidth: kt,
|
|
1056
1057
|
setNodeHeight: Bt,
|
|
1057
|
-
setParentResizingOptionsState:
|
|
1058
|
-
setSelectedNodes:
|
|
1059
|
-
} =
|
|
1058
|
+
setParentResizingOptionsState: st,
|
|
1059
|
+
setSelectedNodes: ct
|
|
1060
|
+
} = re({
|
|
1060
1061
|
initialDirection: r,
|
|
1061
1062
|
initialAlgorithm: e,
|
|
1062
1063
|
initialAutoLayout: o,
|
|
@@ -1068,99 +1069,100 @@ function Ce({
|
|
|
1068
1069
|
layoutEngines: a
|
|
1069
1070
|
}), {
|
|
1070
1071
|
nodeIdWithNode: W,
|
|
1071
|
-
nodeParentIdMapWithChildIdSet:
|
|
1072
|
+
nodeParentIdMapWithChildIdSet: at,
|
|
1072
1073
|
numberOfNodes: Mt,
|
|
1073
1074
|
nodesLength: St,
|
|
1074
|
-
childrenInitialized:
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1075
|
+
childrenInitialized: lt,
|
|
1076
|
+
nodesInitialized: Dt,
|
|
1077
|
+
parentChildStructure: Rt
|
|
1078
|
+
} = ne({
|
|
1079
|
+
nodes: f,
|
|
1078
1080
|
externalNodeIdWithNode: N,
|
|
1079
|
-
externalNodeParentIdMapWithChildIdSet:
|
|
1080
|
-
noParentKey:
|
|
1081
|
-
}),
|
|
1082
|
-
|
|
1083
|
-
}, [
|
|
1084
|
-
|
|
1085
|
-
onChange:
|
|
1081
|
+
externalNodeParentIdMapWithChildIdSet: x,
|
|
1082
|
+
noParentKey: L
|
|
1083
|
+
}), Ot = U(({ nodes: H }) => {
|
|
1084
|
+
ct(H);
|
|
1085
|
+
}, [ct]);
|
|
1086
|
+
jt({
|
|
1087
|
+
onChange: Ot
|
|
1086
1088
|
});
|
|
1087
|
-
const { calculateLayout:
|
|
1088
|
-
|
|
1089
|
+
const { calculateLayout: At, calculateContainerLayout: zt } = xe(
|
|
1090
|
+
b,
|
|
1089
1091
|
m,
|
|
1090
|
-
|
|
1092
|
+
w,
|
|
1091
1093
|
R,
|
|
1092
|
-
|
|
1094
|
+
at,
|
|
1093
1095
|
W,
|
|
1094
1096
|
O,
|
|
1095
1097
|
k,
|
|
1096
1098
|
v,
|
|
1097
1099
|
S,
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
), { applyLayout: ht, applyContainerLayout:
|
|
1101
|
-
nodes:
|
|
1102
|
-
edges:
|
|
1100
|
+
C,
|
|
1101
|
+
L
|
|
1102
|
+
), { applyLayout: ht, applyContainerLayout: Gt } = oe({
|
|
1103
|
+
nodes: f,
|
|
1104
|
+
edges: p,
|
|
1103
1105
|
selectedNodes: _,
|
|
1104
|
-
layoutHidden:
|
|
1105
|
-
calculateLayout:
|
|
1106
|
-
calculateContainerLayout:
|
|
1106
|
+
layoutHidden: C,
|
|
1107
|
+
calculateLayout: At,
|
|
1108
|
+
calculateContainerLayout: zt,
|
|
1107
1109
|
updateNodes: s,
|
|
1108
|
-
updateEdges:
|
|
1109
|
-
setLayoutInProgress:
|
|
1110
|
-
setNodeSpacing:
|
|
1111
|
-
setLayerSpacing:
|
|
1112
|
-
}),
|
|
1113
|
-
|
|
1114
|
-
}, [
|
|
1115
|
-
|
|
1116
|
-
...
|
|
1110
|
+
updateEdges: d,
|
|
1111
|
+
setLayoutInProgress: Y,
|
|
1112
|
+
setNodeSpacing: ot,
|
|
1113
|
+
setLayerSpacing: it
|
|
1114
|
+
}), _t = U((H, K) => {
|
|
1115
|
+
nt((Ut) => ({ ...Ut, [H]: K }));
|
|
1116
|
+
}, [nt]), Ht = U((H) => {
|
|
1117
|
+
st((K) => ({
|
|
1118
|
+
...K,
|
|
1117
1119
|
...H,
|
|
1118
|
-
enabled:
|
|
1120
|
+
enabled: y
|
|
1119
1121
|
}));
|
|
1120
|
-
}, [
|
|
1122
|
+
}, [y, st]);
|
|
1121
1123
|
V(() => {
|
|
1122
1124
|
var H;
|
|
1123
|
-
|
|
1124
|
-
}, [
|
|
1125
|
-
const
|
|
1125
|
+
E || W.has((H = f[f.length - 1]) == null ? void 0 : H.id) && lt && y && ht();
|
|
1126
|
+
}, [lt, y, m, Mt, O, k, Rt, St]);
|
|
1127
|
+
const $t = {
|
|
1126
1128
|
direction: m,
|
|
1127
|
-
algorithm:
|
|
1128
|
-
autoLayout:
|
|
1129
|
-
layoutInProgress:
|
|
1130
|
-
|
|
1129
|
+
algorithm: w,
|
|
1130
|
+
autoLayout: y,
|
|
1131
|
+
layoutInProgress: g,
|
|
1132
|
+
nodesInitialized: Dt,
|
|
1131
1133
|
padding: G,
|
|
1132
1134
|
nodeSpacing: O,
|
|
1133
1135
|
layerSpacing: k,
|
|
1134
1136
|
nodeWidth: v,
|
|
1135
1137
|
nodeHeight: S,
|
|
1136
|
-
layoutHidden:
|
|
1138
|
+
layoutHidden: C,
|
|
1137
1139
|
parentResizingOptions: R,
|
|
1138
|
-
layoutEngines:
|
|
1140
|
+
layoutEngines: b,
|
|
1139
1141
|
layoutEngineOptions: M,
|
|
1140
|
-
nodeParentIdMapWithChildIdSet:
|
|
1142
|
+
nodeParentIdMapWithChildIdSet: at,
|
|
1141
1143
|
nodeIdWithNode: W,
|
|
1142
|
-
noParentKey:
|
|
1144
|
+
noParentKey: L,
|
|
1143
1145
|
updateNodes: s,
|
|
1144
|
-
updateEdges:
|
|
1146
|
+
updateEdges: d,
|
|
1145
1147
|
setDirection: J,
|
|
1146
1148
|
setAlgorithm: Z,
|
|
1147
1149
|
setAutoLayout: q,
|
|
1148
|
-
setLayoutInProgress:
|
|
1150
|
+
setLayoutInProgress: Y,
|
|
1149
1151
|
setPadding: Tt,
|
|
1150
|
-
setNodeSpacing:
|
|
1151
|
-
setLayerSpacing:
|
|
1152
|
+
setNodeSpacing: ot,
|
|
1153
|
+
setLayerSpacing: it,
|
|
1152
1154
|
setNodeWidth: kt,
|
|
1153
1155
|
setNodeHeight: Bt,
|
|
1154
1156
|
setLayoutHidden: Q,
|
|
1155
|
-
setParentResizingOptions:
|
|
1157
|
+
setParentResizingOptions: Ht,
|
|
1156
1158
|
setLayoutEngineOptions: vt,
|
|
1157
1159
|
applyLayout: ht,
|
|
1158
|
-
applyContainerLayout:
|
|
1160
|
+
applyContainerLayout: Gt,
|
|
1159
1161
|
clearLayoutCache: () => {
|
|
1160
1162
|
},
|
|
1161
|
-
registerLayoutEngine:
|
|
1163
|
+
registerLayoutEngine: _t
|
|
1162
1164
|
};
|
|
1163
|
-
return /* @__PURE__ */
|
|
1165
|
+
return /* @__PURE__ */ u(Lt.Provider, { value: $t, children: t });
|
|
1164
1166
|
}
|
|
1165
1167
|
const wt = ({
|
|
1166
1168
|
compact: t = !1
|
|
@@ -1169,57 +1171,57 @@ const wt = ({
|
|
|
1169
1171
|
direction: r,
|
|
1170
1172
|
setDirection: e,
|
|
1171
1173
|
clearLayoutCache: o
|
|
1172
|
-
} =
|
|
1174
|
+
} = I(), n = (i) => {
|
|
1173
1175
|
e(i), o && o();
|
|
1174
1176
|
};
|
|
1175
|
-
return t ? /* @__PURE__ */
|
|
1177
|
+
return t ? /* @__PURE__ */ u(
|
|
1176
1178
|
D,
|
|
1177
1179
|
{
|
|
1178
1180
|
onClick: () => n(r === "DOWN" ? "RIGHT" : "DOWN"),
|
|
1179
1181
|
title: `Switch to ${r === "DOWN" ? "horizontal" : "vertical"} layout`,
|
|
1180
|
-
children: /* @__PURE__ */
|
|
1182
|
+
children: /* @__PURE__ */ u("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: r === "DOWN" ? (
|
|
1181
1183
|
// Horizontal layout icon
|
|
1182
|
-
/* @__PURE__ */
|
|
1184
|
+
/* @__PURE__ */ u("path", { d: "M4 12h16M16 6l6 6-6 6" })
|
|
1183
1185
|
) : (
|
|
1184
1186
|
// Vertical layout icon
|
|
1185
|
-
/* @__PURE__ */
|
|
1187
|
+
/* @__PURE__ */ u("path", { d: "M12 4v16M6 16l6 6 6-6" })
|
|
1186
1188
|
) })
|
|
1187
1189
|
}
|
|
1188
1190
|
) : /* @__PURE__ */ T(P, { children: [
|
|
1189
|
-
/* @__PURE__ */
|
|
1191
|
+
/* @__PURE__ */ u(
|
|
1190
1192
|
D,
|
|
1191
1193
|
{
|
|
1192
1194
|
onClick: () => n("DOWN"),
|
|
1193
1195
|
className: r === "DOWN" ? "selected" : "",
|
|
1194
1196
|
title: "Top to Bottom",
|
|
1195
|
-
children: /* @__PURE__ */
|
|
1197
|
+
children: /* @__PURE__ */ u("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: /* @__PURE__ */ u("path", { d: "M12 4v16M6 16l6 6 6-6" }) })
|
|
1196
1198
|
}
|
|
1197
1199
|
),
|
|
1198
|
-
/* @__PURE__ */
|
|
1200
|
+
/* @__PURE__ */ u(
|
|
1199
1201
|
D,
|
|
1200
1202
|
{
|
|
1201
1203
|
onClick: () => n("RIGHT"),
|
|
1202
1204
|
className: r === "RIGHT" ? "selected" : "",
|
|
1203
1205
|
title: "Left to Right",
|
|
1204
|
-
children: /* @__PURE__ */
|
|
1206
|
+
children: /* @__PURE__ */ u("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: /* @__PURE__ */ u("path", { d: "M4 12h16M16 6l6 6-6 6" }) })
|
|
1205
1207
|
}
|
|
1206
1208
|
),
|
|
1207
|
-
/* @__PURE__ */
|
|
1209
|
+
/* @__PURE__ */ u(
|
|
1208
1210
|
D,
|
|
1209
1211
|
{
|
|
1210
1212
|
onClick: () => n("LEFT"),
|
|
1211
1213
|
className: r === "LEFT" ? "selected" : "",
|
|
1212
1214
|
title: "Right to Left",
|
|
1213
|
-
children: /* @__PURE__ */
|
|
1215
|
+
children: /* @__PURE__ */ u("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: /* @__PURE__ */ u("path", { d: "M20 12H4M8 6L2 12l6 6" }) })
|
|
1214
1216
|
}
|
|
1215
1217
|
),
|
|
1216
|
-
/* @__PURE__ */
|
|
1218
|
+
/* @__PURE__ */ u(
|
|
1217
1219
|
D,
|
|
1218
1220
|
{
|
|
1219
1221
|
onClick: () => n("UP"),
|
|
1220
1222
|
className: r === "UP" ? "selected" : "",
|
|
1221
1223
|
title: "Bottom to Top",
|
|
1222
|
-
children: /* @__PURE__ */
|
|
1224
|
+
children: /* @__PURE__ */ u("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: /* @__PURE__ */ u("path", { d: "M12 20V4M6 8l6-6 6 6" }) })
|
|
1223
1225
|
}
|
|
1224
1226
|
)
|
|
1225
1227
|
] });
|
|
@@ -1232,23 +1234,23 @@ const wt = ({
|
|
|
1232
1234
|
setNodeSpacing: o,
|
|
1233
1235
|
setLayerSpacing: n,
|
|
1234
1236
|
clearLayoutCache: i
|
|
1235
|
-
} =
|
|
1237
|
+
} = I(), [l, c] = B(!1), h = (s) => {
|
|
1236
1238
|
o(s), i && i();
|
|
1237
1239
|
}, a = (s) => {
|
|
1238
1240
|
n(s), i && i();
|
|
1239
1241
|
};
|
|
1240
1242
|
return t ? /* @__PURE__ */ T("div", { style: { position: "relative" }, children: [
|
|
1241
|
-
/* @__PURE__ */
|
|
1243
|
+
/* @__PURE__ */ u(
|
|
1242
1244
|
D,
|
|
1243
1245
|
{
|
|
1244
1246
|
onClick: () => c(!l),
|
|
1245
1247
|
title: "Adjust node and layer spacing",
|
|
1246
1248
|
children: /* @__PURE__ */ T("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: [
|
|
1247
|
-
/* @__PURE__ */
|
|
1248
|
-
/* @__PURE__ */
|
|
1249
|
-
/* @__PURE__ */
|
|
1250
|
-
/* @__PURE__ */
|
|
1251
|
-
/* @__PURE__ */
|
|
1249
|
+
/* @__PURE__ */ u("rect", { x: "3", y: "3", width: "7", height: "7", rx: "1" }),
|
|
1250
|
+
/* @__PURE__ */ u("rect", { x: "14", y: "3", width: "7", height: "7", rx: "1" }),
|
|
1251
|
+
/* @__PURE__ */ u("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1" }),
|
|
1252
|
+
/* @__PURE__ */ u("rect", { x: "14", y: "14", width: "7", height: "7", rx: "1" }),
|
|
1253
|
+
/* @__PURE__ */ u("path", { d: "M7 10v4M17 10v4M10 7h4M10 17h4" })
|
|
1252
1254
|
] })
|
|
1253
1255
|
}
|
|
1254
1256
|
),
|
|
@@ -1276,7 +1278,7 @@ const wt = ({
|
|
|
1276
1278
|
r,
|
|
1277
1279
|
"px"
|
|
1278
1280
|
] }),
|
|
1279
|
-
/* @__PURE__ */
|
|
1281
|
+
/* @__PURE__ */ u("div", { style: { display: "flex", gap: "4px" }, children: [50, 100, 150, 200].map((s) => /* @__PURE__ */ u(
|
|
1280
1282
|
"button",
|
|
1281
1283
|
{
|
|
1282
1284
|
onClick: () => h(s),
|
|
@@ -1299,7 +1301,7 @@ const wt = ({
|
|
|
1299
1301
|
e,
|
|
1300
1302
|
"px"
|
|
1301
1303
|
] }),
|
|
1302
|
-
/* @__PURE__ */
|
|
1304
|
+
/* @__PURE__ */ u("div", { style: { display: "flex", gap: "4px" }, children: [50, 100, 150, 200].map((s) => /* @__PURE__ */ u(
|
|
1303
1305
|
"button",
|
|
1304
1306
|
{
|
|
1305
1307
|
onClick: () => a(s),
|
|
@@ -1316,7 +1318,7 @@ const wt = ({
|
|
|
1316
1318
|
s
|
|
1317
1319
|
)) })
|
|
1318
1320
|
] }),
|
|
1319
|
-
/* @__PURE__ */
|
|
1321
|
+
/* @__PURE__ */ u("div", { style: { marginTop: "12px", textAlign: "right" }, children: /* @__PURE__ */ u(
|
|
1320
1322
|
"button",
|
|
1321
1323
|
{
|
|
1322
1324
|
onClick: () => c(!1),
|
|
@@ -1341,16 +1343,16 @@ const wt = ({
|
|
|
1341
1343
|
title: "Decrease node spacing",
|
|
1342
1344
|
children: [
|
|
1343
1345
|
/* @__PURE__ */ T("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: [
|
|
1344
|
-
/* @__PURE__ */
|
|
1345
|
-
/* @__PURE__ */
|
|
1346
|
-
/* @__PURE__ */
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
/* @__PURE__ */
|
|
1349
|
-
/* @__PURE__ */
|
|
1350
|
-
/* @__PURE__ */
|
|
1351
|
-
/* @__PURE__ */
|
|
1346
|
+
/* @__PURE__ */ u("rect", { x: "3", y: "3", width: "7", height: "7", rx: "1" }),
|
|
1347
|
+
/* @__PURE__ */ u("rect", { x: "14", y: "3", width: "7", height: "7", rx: "1" }),
|
|
1348
|
+
/* @__PURE__ */ u("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1" }),
|
|
1349
|
+
/* @__PURE__ */ u("rect", { x: "14", y: "14", width: "7", height: "7", rx: "1" }),
|
|
1350
|
+
/* @__PURE__ */ u("line", { x1: "7", y1: "10", x2: "7", y2: "14" }),
|
|
1351
|
+
/* @__PURE__ */ u("line", { x1: "17", y1: "10", x2: "17", y2: "14" }),
|
|
1352
|
+
/* @__PURE__ */ u("line", { x1: "10", y1: "7", x2: "14", y2: "7" }),
|
|
1353
|
+
/* @__PURE__ */ u("line", { x1: "10", y1: "17", x2: "14", y2: "17" })
|
|
1352
1354
|
] }),
|
|
1353
|
-
/* @__PURE__ */
|
|
1355
|
+
/* @__PURE__ */ u("span", { style: { marginLeft: "4px" }, children: "-" })
|
|
1354
1356
|
]
|
|
1355
1357
|
}
|
|
1356
1358
|
),
|
|
@@ -1374,20 +1376,20 @@ const wt = ({
|
|
|
1374
1376
|
title: "Increase node spacing",
|
|
1375
1377
|
children: [
|
|
1376
1378
|
/* @__PURE__ */ T("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: [
|
|
1377
|
-
/* @__PURE__ */
|
|
1378
|
-
/* @__PURE__ */
|
|
1379
|
-
/* @__PURE__ */
|
|
1380
|
-
/* @__PURE__ */
|
|
1381
|
-
/* @__PURE__ */
|
|
1382
|
-
/* @__PURE__ */
|
|
1383
|
-
/* @__PURE__ */
|
|
1384
|
-
/* @__PURE__ */
|
|
1379
|
+
/* @__PURE__ */ u("rect", { x: "3", y: "3", width: "7", height: "7", rx: "1" }),
|
|
1380
|
+
/* @__PURE__ */ u("rect", { x: "14", y: "3", width: "7", height: "7", rx: "1" }),
|
|
1381
|
+
/* @__PURE__ */ u("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1" }),
|
|
1382
|
+
/* @__PURE__ */ u("rect", { x: "14", y: "14", width: "7", height: "7", rx: "1" }),
|
|
1383
|
+
/* @__PURE__ */ u("line", { x1: "7", y1: "10", x2: "7", y2: "14" }),
|
|
1384
|
+
/* @__PURE__ */ u("line", { x1: "17", y1: "10", x2: "17", y2: "14" }),
|
|
1385
|
+
/* @__PURE__ */ u("line", { x1: "10", y1: "7", x2: "14", y2: "7" }),
|
|
1386
|
+
/* @__PURE__ */ u("line", { x1: "10", y1: "17", x2: "14", y2: "17" })
|
|
1385
1387
|
] }),
|
|
1386
|
-
/* @__PURE__ */
|
|
1388
|
+
/* @__PURE__ */ u("span", { style: { marginLeft: "4px" }, children: "+" })
|
|
1387
1389
|
]
|
|
1388
1390
|
}
|
|
1389
1391
|
),
|
|
1390
|
-
/* @__PURE__ */
|
|
1392
|
+
/* @__PURE__ */ u("div", { style: { display: "inline-block", width: "1px", height: "24px", background: "#ddd", margin: "0 10px" } }),
|
|
1391
1393
|
/* @__PURE__ */ T(
|
|
1392
1394
|
D,
|
|
1393
1395
|
{
|
|
@@ -1395,11 +1397,11 @@ const wt = ({
|
|
|
1395
1397
|
title: "Decrease layer spacing",
|
|
1396
1398
|
children: [
|
|
1397
1399
|
/* @__PURE__ */ T("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: [
|
|
1398
|
-
/* @__PURE__ */
|
|
1399
|
-
/* @__PURE__ */
|
|
1400
|
-
/* @__PURE__ */
|
|
1400
|
+
/* @__PURE__ */ u("line", { x1: "4", y1: "6", x2: "20", y2: "6" }),
|
|
1401
|
+
/* @__PURE__ */ u("line", { x1: "4", y1: "12", x2: "20", y2: "12" }),
|
|
1402
|
+
/* @__PURE__ */ u("line", { x1: "4", y1: "18", x2: "20", y2: "18" })
|
|
1401
1403
|
] }),
|
|
1402
|
-
/* @__PURE__ */
|
|
1404
|
+
/* @__PURE__ */ u("span", { style: { marginLeft: "4px" }, children: "-" })
|
|
1403
1405
|
]
|
|
1404
1406
|
}
|
|
1405
1407
|
),
|
|
@@ -1423,11 +1425,11 @@ const wt = ({
|
|
|
1423
1425
|
title: "Increase layer spacing",
|
|
1424
1426
|
children: [
|
|
1425
1427
|
/* @__PURE__ */ T("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "2", fill: "none", children: [
|
|
1426
|
-
/* @__PURE__ */
|
|
1427
|
-
/* @__PURE__ */
|
|
1428
|
-
/* @__PURE__ */
|
|
1428
|
+
/* @__PURE__ */ u("line", { x1: "4", y1: "6", x2: "20", y2: "6" }),
|
|
1429
|
+
/* @__PURE__ */ u("line", { x1: "4", y1: "12", x2: "20", y2: "12" }),
|
|
1430
|
+
/* @__PURE__ */ u("line", { x1: "4", y1: "18", x2: "20", y2: "18" })
|
|
1429
1431
|
] }),
|
|
1430
|
-
/* @__PURE__ */
|
|
1432
|
+
/* @__PURE__ */ u("span", { style: { marginLeft: "4px" }, children: "+" })
|
|
1431
1433
|
]
|
|
1432
1434
|
}
|
|
1433
1435
|
)
|
|
@@ -1438,8 +1440,8 @@ const wt = ({
|
|
|
1438
1440
|
const {
|
|
1439
1441
|
autoLayout: r,
|
|
1440
1442
|
setAutoLayout: e
|
|
1441
|
-
} =
|
|
1442
|
-
return /* @__PURE__ */
|
|
1443
|
+
} = I();
|
|
1444
|
+
return /* @__PURE__ */ u(
|
|
1443
1445
|
D,
|
|
1444
1446
|
{
|
|
1445
1447
|
onClick: () => {
|
|
@@ -1449,12 +1451,12 @@ const wt = ({
|
|
|
1449
1451
|
title: r ? "Disable automatic layout" : "Enable automatic layout",
|
|
1450
1452
|
style: { color: r ? "green" : "inherit" },
|
|
1451
1453
|
children: t ? /* @__PURE__ */ T("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "1.5", fill: "none", children: [
|
|
1452
|
-
/* @__PURE__ */
|
|
1453
|
-
/* @__PURE__ */
|
|
1454
|
-
/* @__PURE__ */
|
|
1454
|
+
/* @__PURE__ */ u("rect", { x: "4", y: "4", width: "4", height: "4", rx: "1" }),
|
|
1455
|
+
/* @__PURE__ */ u("rect", { x: "4", y: "16", width: "4", height: "4", rx: "1" }),
|
|
1456
|
+
/* @__PURE__ */ u("rect", { x: "16", y: "10", width: "4", height: "4", rx: "1" }),
|
|
1455
1457
|
/* @__PURE__ */ T(P, { children: [
|
|
1456
|
-
/* @__PURE__ */
|
|
1457
|
-
/* @__PURE__ */
|
|
1458
|
+
/* @__PURE__ */ u("path", { d: "M8 6c6 0 3 8 8 6" }),
|
|
1459
|
+
/* @__PURE__ */ u("path", { d: "M8 18c3-3 2-8 6-6" })
|
|
1458
1460
|
] })
|
|
1459
1461
|
] }) : /* @__PURE__ */ T(P, { children: [
|
|
1460
1462
|
"Auto-Layout ",
|
|
@@ -1469,7 +1471,7 @@ const wt = ({
|
|
|
1469
1471
|
layoutInProgress: r,
|
|
1470
1472
|
setLayoutInProgress: e,
|
|
1471
1473
|
applyLayout: o
|
|
1472
|
-
} =
|
|
1474
|
+
} = I();
|
|
1473
1475
|
return /* @__PURE__ */ T(
|
|
1474
1476
|
D,
|
|
1475
1477
|
{
|
|
@@ -1486,19 +1488,19 @@ const wt = ({
|
|
|
1486
1488
|
style: { color: r ? "#999" : "#000" },
|
|
1487
1489
|
children: [
|
|
1488
1490
|
/* @__PURE__ */ T("svg", { viewBox: "0 0 24 24", width: "16", height: "16", stroke: "currentColor", strokeWidth: "1.5", fill: "none", children: [
|
|
1489
|
-
/* @__PURE__ */
|
|
1490
|
-
/* @__PURE__ */
|
|
1491
|
-
/* @__PURE__ */
|
|
1492
|
-
/* @__PURE__ */
|
|
1493
|
-
/* @__PURE__ */
|
|
1494
|
-
/* @__PURE__ */
|
|
1495
|
-
/* @__PURE__ */
|
|
1491
|
+
/* @__PURE__ */ u("rect", { x: "3", y: "3", width: "5", height: "5", rx: "1" }),
|
|
1492
|
+
/* @__PURE__ */ u("rect", { x: "16", y: "3", width: "5", height: "5", rx: "1" }),
|
|
1493
|
+
/* @__PURE__ */ u("rect", { x: "3", y: "16", width: "5", height: "5", rx: "1" }),
|
|
1494
|
+
/* @__PURE__ */ u("rect", { x: "16", y: "16", width: "5", height: "5", rx: "1" }),
|
|
1495
|
+
/* @__PURE__ */ u("path", { d: "M8 5.5h8M5.5 8v8M18.5 8v8M8 18.5h8" }),
|
|
1496
|
+
/* @__PURE__ */ u("circle", { cx: "12", cy: "12", r: "3" }),
|
|
1497
|
+
/* @__PURE__ */ u("path", { d: "M11 10.5v3l2-1.5z", fill: "currentColor" })
|
|
1496
1498
|
] }),
|
|
1497
|
-
!t && /* @__PURE__ */
|
|
1499
|
+
!t && /* @__PURE__ */ u("span", { style: { marginLeft: "4px" }, children: "Apply Layout" })
|
|
1498
1500
|
]
|
|
1499
1501
|
}
|
|
1500
1502
|
);
|
|
1501
|
-
},
|
|
1503
|
+
}, Ee = ({
|
|
1502
1504
|
showDirectionControls: t = !0,
|
|
1503
1505
|
showSpacingControls: r = !0,
|
|
1504
1506
|
showAutoLayoutToggle: e = !0,
|
|
@@ -1507,54 +1509,54 @@ const wt = ({
|
|
|
1507
1509
|
standalone: n = !1,
|
|
1508
1510
|
position: i = "top-right"
|
|
1509
1511
|
}) => {
|
|
1510
|
-
const l =
|
|
1512
|
+
const l = I(), {
|
|
1511
1513
|
autoLayout: c
|
|
1512
1514
|
} = l;
|
|
1513
|
-
return n ? /* @__PURE__ */ T(
|
|
1514
|
-
o && !c && /* @__PURE__ */
|
|
1515
|
+
return n ? /* @__PURE__ */ T(Xt, { position: i, showZoom: !1, showFitView: !1, showInteractive: !1, children: [
|
|
1516
|
+
o && !c && /* @__PURE__ */ u(
|
|
1515
1517
|
Ct,
|
|
1516
1518
|
{
|
|
1517
1519
|
compact: !0
|
|
1518
1520
|
}
|
|
1519
1521
|
),
|
|
1520
|
-
t && /* @__PURE__ */
|
|
1522
|
+
t && /* @__PURE__ */ u(
|
|
1521
1523
|
wt,
|
|
1522
1524
|
{
|
|
1523
1525
|
compact: !0
|
|
1524
1526
|
}
|
|
1525
1527
|
),
|
|
1526
|
-
r && /* @__PURE__ */
|
|
1528
|
+
r && /* @__PURE__ */ u(
|
|
1527
1529
|
mt,
|
|
1528
1530
|
{
|
|
1529
1531
|
compact: !0
|
|
1530
1532
|
}
|
|
1531
1533
|
),
|
|
1532
|
-
e && /* @__PURE__ */
|
|
1534
|
+
e && /* @__PURE__ */ u(
|
|
1533
1535
|
bt,
|
|
1534
1536
|
{
|
|
1535
1537
|
compact: !0
|
|
1536
1538
|
}
|
|
1537
1539
|
)
|
|
1538
1540
|
] }) : /* @__PURE__ */ T(P, { children: [
|
|
1539
|
-
o && !c && /* @__PURE__ */
|
|
1541
|
+
o && !c && /* @__PURE__ */ u(
|
|
1540
1542
|
Ct,
|
|
1541
1543
|
{
|
|
1542
1544
|
compact: !0
|
|
1543
1545
|
}
|
|
1544
1546
|
),
|
|
1545
|
-
t && /* @__PURE__ */
|
|
1547
|
+
t && /* @__PURE__ */ u(
|
|
1546
1548
|
wt,
|
|
1547
1549
|
{
|
|
1548
1550
|
compact: !0
|
|
1549
1551
|
}
|
|
1550
1552
|
),
|
|
1551
|
-
r && /* @__PURE__ */
|
|
1553
|
+
r && /* @__PURE__ */ u(
|
|
1552
1554
|
mt,
|
|
1553
1555
|
{
|
|
1554
1556
|
compact: !0
|
|
1555
1557
|
}
|
|
1556
1558
|
),
|
|
1557
|
-
e && /* @__PURE__ */
|
|
1559
|
+
e && /* @__PURE__ */ u(
|
|
1558
1560
|
bt,
|
|
1559
1561
|
{
|
|
1560
1562
|
compact: !0
|
|
@@ -1564,11 +1566,11 @@ const wt = ({
|
|
|
1564
1566
|
};
|
|
1565
1567
|
export {
|
|
1566
1568
|
bt as AutoLayoutToggle,
|
|
1567
|
-
|
|
1569
|
+
te as DagreEngine,
|
|
1568
1570
|
wt as DirectionControls,
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
+
Ee as LayoutControls,
|
|
1572
|
+
Le as LayoutProvider,
|
|
1571
1573
|
mt as SpacingControls,
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
+
ee as engines,
|
|
1575
|
+
I as useLayoutContext
|
|
1574
1576
|
};
|