@html-graph/html-graph 8.4.0 → 8.5.0
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.
- package/dist/html-graph.d.ts +40 -15
- package/dist/html-graph.js +1223 -1084
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Xe = (r, e, t) => e in r ?
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
const
|
|
1
|
+
var Ye = Object.defineProperty;
|
|
2
|
+
var Xe = (r, e, t) => e in r ? Ye(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var i = (r, e, t) => Xe(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
var D = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(D || {});
|
|
5
|
+
const Ge = () => {
|
|
6
6
|
const r = document.createElement("div");
|
|
7
7
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
|
|
8
|
-
},
|
|
8
|
+
}, je = () => {
|
|
9
9
|
const r = document.createElement("div");
|
|
10
10
|
return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
|
|
11
|
-
},
|
|
11
|
+
}, qe = (r) => {
|
|
12
12
|
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
13
13
|
};
|
|
14
|
-
class
|
|
14
|
+
class xe {
|
|
15
15
|
constructor(e, t, s) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
i(this, "host", Ge());
|
|
17
|
+
i(this, "container", je());
|
|
18
|
+
i(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
|
|
19
|
+
i(this, "attachedNodeIds", /* @__PURE__ */ new Set());
|
|
20
|
+
i(this, "applyTransform", () => {
|
|
21
21
|
const e = this.viewportStore.getContentMatrix();
|
|
22
22
|
this.container.style.transform = `matrix(${e.scale}, 0, 0, ${e.scale}, ${e.x}, ${e.y})`;
|
|
23
23
|
});
|
|
@@ -25,7 +25,7 @@ class Ae {
|
|
|
25
25
|
}
|
|
26
26
|
attachNode(e) {
|
|
27
27
|
const t = this.graphStore.getNode(e);
|
|
28
|
-
|
|
28
|
+
qe(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
|
|
29
29
|
}
|
|
30
30
|
detachNode(e) {
|
|
31
31
|
const t = this.graphStore.getNode(e);
|
|
@@ -50,7 +50,7 @@ class Ae {
|
|
|
50
50
|
this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.element.removeChild(this.host), this.host.removeChild(this.container);
|
|
51
51
|
}
|
|
52
52
|
updateNodePosition(e) {
|
|
53
|
-
const t = this.graphStore.getNode(e), { width: s, height:
|
|
53
|
+
const t = this.graphStore.getNode(e), { width: s, height: o } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, { payload: a } = t, h = a.centerFn(s, o), d = a.x - n * h.x, c = a.y - n * h.y;
|
|
54
54
|
t.element.style.transform = `translate(${d}px, ${c}px)`;
|
|
55
55
|
}
|
|
56
56
|
updateNodePriority(e) {
|
|
@@ -60,24 +60,24 @@ class Ae {
|
|
|
60
60
|
updateEdgeShape(e) {
|
|
61
61
|
const t = this.edgeIdToElementMap.get(e);
|
|
62
62
|
this.container.removeChild(t);
|
|
63
|
-
const
|
|
64
|
-
this.edgeIdToElementMap.set(e,
|
|
63
|
+
const o = this.graphStore.getEdge(e).payload.shape.svg;
|
|
64
|
+
this.edgeIdToElementMap.set(e, o), this.container.appendChild(o);
|
|
65
65
|
}
|
|
66
66
|
renderEdge(e) {
|
|
67
|
-
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from),
|
|
67
|
+
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), o = this.graphStore.getPort(t.to), n = s.element.getBoundingClientRect(), a = o.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix().scale, c = this.createEdgeRenderPort(
|
|
68
68
|
s,
|
|
69
69
|
n,
|
|
70
70
|
h,
|
|
71
71
|
d
|
|
72
|
-
), g = this.createEdgeRenderPort(
|
|
73
|
-
let l =
|
|
74
|
-
s.element ===
|
|
72
|
+
), g = this.createEdgeRenderPort(o, a, h, d);
|
|
73
|
+
let l = D.Line;
|
|
74
|
+
s.element === o.element ? l = D.PortCycle : s.nodeId === o.nodeId && (l = D.NodeCycle), t.payload.shape.render({ from: c, to: g, category: l });
|
|
75
75
|
}
|
|
76
76
|
updateEdgePriority(e) {
|
|
77
77
|
const t = this.graphStore.getEdge(e);
|
|
78
78
|
t.payload.shape.svg.style.zIndex = `${t.payload.priority}`;
|
|
79
79
|
}
|
|
80
|
-
createEdgeRenderPort(e, t, s,
|
|
80
|
+
createEdgeRenderPort(e, t, s, o) {
|
|
81
81
|
const n = this.viewportStore.createContentCoords({
|
|
82
82
|
x: t.left - s.left,
|
|
83
83
|
y: t.top - s.top
|
|
@@ -85,57 +85,57 @@ class Ae {
|
|
|
85
85
|
return {
|
|
86
86
|
x: n.x,
|
|
87
87
|
y: n.y,
|
|
88
|
-
width: t.width *
|
|
89
|
-
height: t.height *
|
|
88
|
+
width: t.width * o,
|
|
89
|
+
height: t.height * o,
|
|
90
90
|
direction: e.payload.direction
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
class
|
|
94
|
+
class Ke {
|
|
95
95
|
constructor(e) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
i(this, "xFrom", 1 / 0);
|
|
97
|
+
i(this, "yFrom", 1 / 0);
|
|
98
|
+
i(this, "xTo", 1 / 0);
|
|
99
|
+
i(this, "yTo", 1 / 0);
|
|
100
100
|
this.graphStore = e;
|
|
101
101
|
}
|
|
102
102
|
setRenderingBox(e) {
|
|
103
103
|
this.xFrom = e.x, this.xTo = e.x + e.width, this.yFrom = e.y, this.yTo = e.y + e.height;
|
|
104
104
|
}
|
|
105
105
|
hasNode(e) {
|
|
106
|
-
const t = this.graphStore.getNode(e).payload, { x: s, y:
|
|
107
|
-
return s >= this.xFrom && s <= this.xTo &&
|
|
106
|
+
const t = this.graphStore.getNode(e).payload, { x: s, y: o } = t;
|
|
107
|
+
return s >= this.xFrom && s <= this.xTo && o >= this.yFrom && o <= this.yTo;
|
|
108
108
|
}
|
|
109
109
|
hasEdge(e) {
|
|
110
|
-
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId,
|
|
110
|
+
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, o = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(s).payload, a = this.graphStore.getNode(o).payload, h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), g = Math.max(n.y, a.y);
|
|
111
111
|
return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
class
|
|
115
|
-
constructor(e, t, s,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
class Qe {
|
|
115
|
+
constructor(e, t, s, o) {
|
|
116
|
+
i(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
117
|
+
i(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
118
|
+
i(this, "renderingBox");
|
|
119
|
+
i(this, "updateViewport", (e) => {
|
|
120
120
|
this.renderingBox.setRenderingBox(e);
|
|
121
|
-
const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(),
|
|
121
|
+
const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
122
122
|
this.graphStore.getAllNodeIds().forEach((a) => {
|
|
123
123
|
const h = this.renderingBox.hasNode(a), d = this.attachedNodes.has(a);
|
|
124
124
|
h && !d ? t.add(a) : !h && d && s.add(a);
|
|
125
125
|
}), this.graphStore.getAllEdgeIds().forEach((a) => {
|
|
126
126
|
const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a), g = this.graphStore.getPort(c.from).nodeId, l = this.graphStore.getPort(c.to).nodeId;
|
|
127
|
-
h && (this.renderingBox.hasNode(g) || (t.add(g), s.delete(g)), this.renderingBox.hasNode(l) || (t.add(l), s.delete(l))), h && !d ?
|
|
127
|
+
h && (this.renderingBox.hasNode(g) || (t.add(g), s.delete(g)), this.renderingBox.hasNode(l) || (t.add(l), s.delete(l))), h && !d ? o.add(a) : !h && d && n.add(a);
|
|
128
128
|
}), n.forEach((a) => {
|
|
129
129
|
this.handleDetachEdge(a);
|
|
130
130
|
}), s.forEach((a) => {
|
|
131
131
|
this.handleDetachNode(a);
|
|
132
132
|
}), t.forEach((a) => {
|
|
133
133
|
this.attachedNodes.has(a) || this.handleAttachNode(a);
|
|
134
|
-
}),
|
|
134
|
+
}), o.forEach((a) => {
|
|
135
135
|
this.handleAttachEdge(a);
|
|
136
136
|
});
|
|
137
137
|
});
|
|
138
|
-
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params =
|
|
138
|
+
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = o, this.renderingBox = new Ke(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
139
139
|
}
|
|
140
140
|
attachNode(e) {
|
|
141
141
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -173,8 +173,8 @@ class Ke {
|
|
|
173
173
|
this.clear(), this.htmlView.destroy(), this.trigger.unsubscribe(this.updateViewport);
|
|
174
174
|
}
|
|
175
175
|
attachEdgeEntities(e) {
|
|
176
|
-
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId,
|
|
177
|
-
this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(
|
|
176
|
+
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, o = this.graphStore.getPort(t.to).nodeId;
|
|
177
|
+
this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(o) || this.handleAttachNode(o), this.handleAttachEdge(e);
|
|
178
178
|
}
|
|
179
179
|
handleAttachNode(e) {
|
|
180
180
|
this.params.onBeforeNodeAttached(e), this.attachedNodes.add(e), this.htmlView.attachNode(e);
|
|
@@ -189,10 +189,10 @@ class Ke {
|
|
|
189
189
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
class
|
|
192
|
+
class Ze {
|
|
193
193
|
constructor(e, t) {
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
i(this, "deferredNodes", /* @__PURE__ */ new Set());
|
|
195
|
+
i(this, "deferredEdges", /* @__PURE__ */ new Set());
|
|
196
196
|
this.htmlView = e, this.graphStore = t;
|
|
197
197
|
}
|
|
198
198
|
attachNode(e) {
|
|
@@ -236,16 +236,16 @@ class Qe {
|
|
|
236
236
|
this.isNodeValid(e) && (this.deferredNodes.delete(e), this.htmlView.attachNode(e));
|
|
237
237
|
}
|
|
238
238
|
isEdgeValid(e) {
|
|
239
|
-
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from),
|
|
240
|
-
return !(this.deferredNodes.has(s.nodeId) || this.deferredNodes.has(
|
|
239
|
+
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), o = this.graphStore.getPort(t.to);
|
|
240
|
+
return !(this.deferredNodes.has(s.nodeId) || this.deferredNodes.has(o.nodeId));
|
|
241
241
|
}
|
|
242
242
|
tryAttachEdge(e) {
|
|
243
243
|
this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
class
|
|
246
|
+
class Q {
|
|
247
247
|
constructor() {
|
|
248
|
-
|
|
248
|
+
i(this, "callbacks", /* @__PURE__ */ new Set());
|
|
249
249
|
}
|
|
250
250
|
subscribe(e) {
|
|
251
251
|
this.callbacks.add(e);
|
|
@@ -259,13 +259,13 @@ class K {
|
|
|
259
259
|
});
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
const
|
|
263
|
-
const r = new
|
|
262
|
+
const E = () => {
|
|
263
|
+
const r = new Q();
|
|
264
264
|
return [r, r];
|
|
265
265
|
};
|
|
266
|
-
class
|
|
266
|
+
class G {
|
|
267
267
|
constructor(e) {
|
|
268
|
-
|
|
268
|
+
i(this, "counter", 0);
|
|
269
269
|
this.checkExists = e;
|
|
270
270
|
}
|
|
271
271
|
create(e) {
|
|
@@ -280,73 +280,73 @@ class Y {
|
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
class Ee {
|
|
283
|
-
constructor(e, t, s,
|
|
284
|
-
|
|
283
|
+
constructor(e, t, s, o, n, a) {
|
|
284
|
+
i(this, "nodeIdGenerator", new G(
|
|
285
285
|
(e) => this.graphStore.hasNode(e)
|
|
286
286
|
));
|
|
287
|
-
|
|
287
|
+
i(this, "portIdGenerator", new G(
|
|
288
288
|
(e) => this.graphStore.hasPort(e)
|
|
289
289
|
));
|
|
290
|
-
|
|
290
|
+
i(this, "edgeIdGenerator", new G(
|
|
291
291
|
(e) => this.graphStore.hasEdge(e)
|
|
292
292
|
));
|
|
293
|
-
|
|
293
|
+
i(this, "onAfterNodeAdded", (e) => {
|
|
294
294
|
this.htmlView.attachNode(e);
|
|
295
295
|
});
|
|
296
|
-
|
|
296
|
+
i(this, "onAfterNodeUpdated", (e) => {
|
|
297
297
|
this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((t) => {
|
|
298
298
|
this.htmlView.renderEdge(t);
|
|
299
299
|
});
|
|
300
300
|
});
|
|
301
|
-
|
|
301
|
+
i(this, "onAfterNodePriorityUpdated", (e) => {
|
|
302
302
|
this.htmlView.updateNodePriority(e);
|
|
303
303
|
});
|
|
304
|
-
|
|
304
|
+
i(this, "onBeforeNodeRemoved", (e) => {
|
|
305
305
|
this.graphStore.getNodePortIds(e).forEach((t) => {
|
|
306
306
|
this.unmarkPort(t);
|
|
307
307
|
}), this.htmlView.detachNode(e);
|
|
308
308
|
});
|
|
309
|
-
|
|
309
|
+
i(this, "onAfterPortUpdated", (e) => {
|
|
310
310
|
this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
|
|
311
311
|
this.htmlView.renderEdge(t);
|
|
312
312
|
});
|
|
313
313
|
});
|
|
314
|
-
|
|
314
|
+
i(this, "onBeforePortUnmarked", (e) => {
|
|
315
315
|
this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
|
|
316
316
|
this.removeEdge(t);
|
|
317
317
|
});
|
|
318
318
|
});
|
|
319
|
-
|
|
319
|
+
i(this, "onAfterEdgeAdded", (e) => {
|
|
320
320
|
this.htmlView.attachEdge(e);
|
|
321
321
|
});
|
|
322
|
-
|
|
322
|
+
i(this, "onAfterEdgeShapeUpdated", (e) => {
|
|
323
323
|
this.htmlView.updateEdgeShape(e);
|
|
324
324
|
});
|
|
325
|
-
|
|
325
|
+
i(this, "onAfterEdgeUpdated", (e) => {
|
|
326
326
|
this.htmlView.renderEdge(e);
|
|
327
327
|
});
|
|
328
|
-
|
|
328
|
+
i(this, "onAfterEdgePriorityUpdated", (e) => {
|
|
329
329
|
this.htmlView.updateEdgePriority(e);
|
|
330
330
|
});
|
|
331
|
-
|
|
331
|
+
i(this, "onBeforeEdgeRemoved", (e) => {
|
|
332
332
|
this.htmlView.detachEdge(e);
|
|
333
333
|
});
|
|
334
|
-
|
|
334
|
+
i(this, "onBeforeClear", () => {
|
|
335
335
|
this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
|
|
336
336
|
});
|
|
337
|
-
|
|
338
|
-
|
|
337
|
+
i(this, "onBeforeDestroyEmitter");
|
|
338
|
+
i(this, "destroyed", !1);
|
|
339
339
|
/**
|
|
340
340
|
* emits event just before destruction of canvas
|
|
341
341
|
*/
|
|
342
|
-
|
|
343
|
-
this.graph = e, this.viewport = t, this.graphStore = s, this.viewportStore =
|
|
342
|
+
i(this, "onBeforeDestroy");
|
|
343
|
+
this.graph = e, this.viewport = t, this.graphStore = s, this.viewportStore = o, this.htmlView = n, this.params = a, this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
|
|
344
344
|
this.onAfterNodePriorityUpdated
|
|
345
345
|
), this.graphStore.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graphStore.onAfterPortUpdated.subscribe(this.onAfterPortUpdated), this.graphStore.onBeforePortRemoved.subscribe(this.onBeforePortUnmarked), this.graphStore.onAfterEdgeAdded.subscribe(this.onAfterEdgeAdded), this.graphStore.onAfterEdgeShapeUpdated.subscribe(
|
|
346
346
|
this.onAfterEdgeShapeUpdated
|
|
347
347
|
), this.graphStore.onAfterEdgeUpdated.subscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.subscribe(
|
|
348
348
|
this.onAfterEdgePriorityUpdated
|
|
349
|
-
), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] =
|
|
349
|
+
), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = E();
|
|
350
350
|
}
|
|
351
351
|
/**
|
|
352
352
|
* adds new node
|
|
@@ -467,10 +467,10 @@ class Ee {
|
|
|
467
467
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy(), this.viewportStore.destroy(), this.destroyed = !0);
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
class
|
|
470
|
+
class Je {
|
|
471
471
|
constructor() {
|
|
472
|
-
|
|
473
|
-
|
|
472
|
+
i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
473
|
+
i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
474
474
|
}
|
|
475
475
|
addRecord(e, t) {
|
|
476
476
|
const s = this.singleToMultiMap.get(e);
|
|
@@ -507,49 +507,49 @@ class Ze {
|
|
|
507
507
|
return this.multiToSingleMap.get(e) !== void 0;
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
|
-
class
|
|
510
|
+
class x extends Error {
|
|
511
511
|
constructor() {
|
|
512
512
|
super(...arguments);
|
|
513
|
-
|
|
513
|
+
i(this, "name", "CanvasError");
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
-
class
|
|
516
|
+
class Se {
|
|
517
517
|
constructor() {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
[this.afterNodeAddedEmitter, this.onAfterNodeAdded] =
|
|
518
|
+
i(this, "nodes", /* @__PURE__ */ new Map());
|
|
519
|
+
i(this, "ports", /* @__PURE__ */ new Map());
|
|
520
|
+
i(this, "edges", /* @__PURE__ */ new Map());
|
|
521
|
+
i(this, "nodesElementsMap", /* @__PURE__ */ new Map());
|
|
522
|
+
i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
|
|
523
|
+
i(this, "portOutcomingEdges", /* @__PURE__ */ new Map());
|
|
524
|
+
i(this, "portCycleEdges", /* @__PURE__ */ new Map());
|
|
525
|
+
i(this, "elementPorts", new Je());
|
|
526
|
+
i(this, "afterNodeAddedEmitter");
|
|
527
|
+
i(this, "onAfterNodeAdded");
|
|
528
|
+
i(this, "afterNodeUpdatedEmitter");
|
|
529
|
+
i(this, "onAfterNodeUpdated");
|
|
530
|
+
i(this, "afterNodePriorityUpdatedEmitter");
|
|
531
|
+
i(this, "onAfterNodePriorityUpdated");
|
|
532
|
+
i(this, "beforeNodeRemovedEmitter");
|
|
533
|
+
i(this, "onBeforeNodeRemoved");
|
|
534
|
+
i(this, "afterPortAddedEmitter");
|
|
535
|
+
i(this, "onAfterPortAdded");
|
|
536
|
+
i(this, "afterPortUpdatedEmitter");
|
|
537
|
+
i(this, "onAfterPortUpdated");
|
|
538
|
+
i(this, "beforePortRemovedEmitter");
|
|
539
|
+
i(this, "onBeforePortRemoved");
|
|
540
|
+
i(this, "afterEdgeAddedEmitter");
|
|
541
|
+
i(this, "onAfterEdgeAdded");
|
|
542
|
+
i(this, "afterEdgeShapeUpdatedEmitter");
|
|
543
|
+
i(this, "onAfterEdgeShapeUpdated");
|
|
544
|
+
i(this, "afterEdgeUpdatedEmitter");
|
|
545
|
+
i(this, "onAfterEdgeUpdated");
|
|
546
|
+
i(this, "afterEdgePriorityUpdatedEmitter");
|
|
547
|
+
i(this, "onAfterEdgePriorityUpdated");
|
|
548
|
+
i(this, "beforeEdgeRemovedEmitter");
|
|
549
|
+
i(this, "onBeforeEdgeRemoved");
|
|
550
|
+
i(this, "beforeClearEmitter");
|
|
551
|
+
i(this, "onBeforeClear");
|
|
552
|
+
[this.afterNodeAddedEmitter, this.onAfterNodeAdded] = E(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = E(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = E(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = E(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = E(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = E(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = E(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = E(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = E(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = E(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = E(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = E(), [this.beforeClearEmitter, this.onBeforeClear] = E();
|
|
553
553
|
}
|
|
554
554
|
hasNode(e) {
|
|
555
555
|
return this.nodes.has(e);
|
|
@@ -557,14 +557,14 @@ class xe {
|
|
|
557
557
|
getNode(e) {
|
|
558
558
|
const t = this.nodes.get(e);
|
|
559
559
|
if (t === void 0)
|
|
560
|
-
throw new
|
|
560
|
+
throw new x("failed to access nonexistent node");
|
|
561
561
|
return t;
|
|
562
562
|
}
|
|
563
563
|
addNode(e) {
|
|
564
564
|
if (this.hasNode(e.id))
|
|
565
|
-
throw new
|
|
565
|
+
throw new x("failed to add node with existing id");
|
|
566
566
|
if (this.findNodeIdByElement(e.element) !== void 0)
|
|
567
|
-
throw new
|
|
567
|
+
throw new x(
|
|
568
568
|
"failed to add node with html element already in use by another node"
|
|
569
569
|
);
|
|
570
570
|
const t = /* @__PURE__ */ new Map(), s = {
|
|
@@ -587,13 +587,13 @@ class xe {
|
|
|
587
587
|
}
|
|
588
588
|
updateNode(e, t) {
|
|
589
589
|
if (!this.hasNode(e))
|
|
590
|
-
throw new
|
|
590
|
+
throw new x("failed to update nonexistent node");
|
|
591
591
|
const { payload: s } = this.nodes.get(e);
|
|
592
592
|
s.x = t.x ?? s.x, s.y = t.y ?? s.y, s.centerFn = t.centerFn ?? s.centerFn, t.priority !== void 0 && (s.priority = t.priority, this.afterNodePriorityUpdatedEmitter.emit(e)), this.afterNodeUpdatedEmitter.emit(e);
|
|
593
593
|
}
|
|
594
594
|
removeNode(e) {
|
|
595
595
|
if (!this.hasNode(e))
|
|
596
|
-
throw new
|
|
596
|
+
throw new x("failed to remove nonexistent node");
|
|
597
597
|
this.beforeNodeRemovedEmitter.emit(e);
|
|
598
598
|
const t = this.nodes.get(e);
|
|
599
599
|
this.nodesElementsMap.delete(t.element), this.nodes.delete(e);
|
|
@@ -604,14 +604,14 @@ class xe {
|
|
|
604
604
|
getPort(e) {
|
|
605
605
|
const t = this.ports.get(e);
|
|
606
606
|
if (t === void 0)
|
|
607
|
-
throw new
|
|
607
|
+
throw new x("failed to access nonexistent port");
|
|
608
608
|
return t;
|
|
609
609
|
}
|
|
610
610
|
addPort(e) {
|
|
611
611
|
if (this.hasPort(e.id))
|
|
612
|
-
throw new
|
|
612
|
+
throw new x("failed to add port with existing id");
|
|
613
613
|
if (!this.hasNode(e.nodeId))
|
|
614
|
-
throw new
|
|
614
|
+
throw new x("failed to add port to nonexistent node");
|
|
615
615
|
this.ports.set(e.id, {
|
|
616
616
|
element: e.element,
|
|
617
617
|
payload: {
|
|
@@ -622,7 +622,7 @@ class xe {
|
|
|
622
622
|
}
|
|
623
623
|
updatePort(e, t) {
|
|
624
624
|
if (!this.hasPort(e))
|
|
625
|
-
throw new
|
|
625
|
+
throw new x("failed to update nonexistent port");
|
|
626
626
|
const s = this.ports.get(e).payload;
|
|
627
627
|
s.direction = t.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(e);
|
|
628
628
|
}
|
|
@@ -635,12 +635,12 @@ class xe {
|
|
|
635
635
|
getNodePortIds(e) {
|
|
636
636
|
const t = this.nodes.get(e);
|
|
637
637
|
if (t === void 0)
|
|
638
|
-
throw new
|
|
638
|
+
throw new x("failed to access port ids of nonexistent node");
|
|
639
639
|
return Array.from(t.ports.keys());
|
|
640
640
|
}
|
|
641
641
|
removePort(e) {
|
|
642
642
|
if (!this.hasPort(e))
|
|
643
|
-
throw new
|
|
643
|
+
throw new x("failed to remove nonexistent port");
|
|
644
644
|
const t = this.ports.get(e).nodeId;
|
|
645
645
|
this.beforePortRemovedEmitter.emit(e), this.nodes.get(t).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
|
|
646
646
|
}
|
|
@@ -650,27 +650,27 @@ class xe {
|
|
|
650
650
|
getEdge(e) {
|
|
651
651
|
const t = this.edges.get(e);
|
|
652
652
|
if (t === void 0)
|
|
653
|
-
throw new
|
|
653
|
+
throw new x("failed to access nonexistent edge");
|
|
654
654
|
return t;
|
|
655
655
|
}
|
|
656
656
|
addEdge(e) {
|
|
657
657
|
if (this.hasEdge(e.id))
|
|
658
|
-
throw new
|
|
658
|
+
throw new x("failed to add edge with existing id");
|
|
659
659
|
if (!this.hasPort(e.from))
|
|
660
|
-
throw new
|
|
660
|
+
throw new x("failed to add edge from nonexistent port");
|
|
661
661
|
if (!this.hasPort(e.to))
|
|
662
|
-
throw new
|
|
662
|
+
throw new x("failed to add edge to nonexistent port");
|
|
663
663
|
this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
|
|
664
664
|
}
|
|
665
665
|
updateEdge(e, t) {
|
|
666
666
|
if (!this.hasEdge(e))
|
|
667
|
-
throw new
|
|
667
|
+
throw new x("failed to update nonexistent edge");
|
|
668
668
|
if (t.from !== void 0 || t.to !== void 0) {
|
|
669
|
-
const
|
|
669
|
+
const o = this.edges.get(e), n = o.payload;
|
|
670
670
|
this.removeEdgeInternal(e), this.addEdgeInternal({
|
|
671
671
|
id: e,
|
|
672
|
-
from: t.from ??
|
|
673
|
-
to: t.to ??
|
|
672
|
+
from: t.from ?? o.from,
|
|
673
|
+
to: t.to ?? o.to,
|
|
674
674
|
shape: n.shape,
|
|
675
675
|
priority: n.priority
|
|
676
676
|
});
|
|
@@ -683,7 +683,7 @@ class xe {
|
|
|
683
683
|
}
|
|
684
684
|
removeEdge(e) {
|
|
685
685
|
if (!this.hasEdge(e))
|
|
686
|
-
throw new
|
|
686
|
+
throw new x("failed to remove nonexistent edge");
|
|
687
687
|
this.beforeEdgeRemovedEmitter.emit(e), this.removeEdgeInternal(e);
|
|
688
688
|
}
|
|
689
689
|
clear() {
|
|
@@ -692,19 +692,19 @@ class xe {
|
|
|
692
692
|
getPortIncomingEdgeIds(e) {
|
|
693
693
|
const t = this.portIncomingEdges.get(e);
|
|
694
694
|
if (t === void 0)
|
|
695
|
-
throw new
|
|
695
|
+
throw new x("failed to access edges for nonexistent port");
|
|
696
696
|
return Array.from(t);
|
|
697
697
|
}
|
|
698
698
|
getPortOutgoingEdgeIds(e) {
|
|
699
699
|
const t = this.portOutcomingEdges.get(e);
|
|
700
700
|
if (t === void 0)
|
|
701
|
-
throw new
|
|
701
|
+
throw new x("failed to access edges for nonexistent port");
|
|
702
702
|
return Array.from(t);
|
|
703
703
|
}
|
|
704
704
|
getPortCycleEdgeIds(e) {
|
|
705
705
|
const t = this.portCycleEdges.get(e);
|
|
706
706
|
if (t === void 0)
|
|
707
|
-
throw new
|
|
707
|
+
throw new x("failed to access edges for nonexistent port");
|
|
708
708
|
return Array.from(t);
|
|
709
709
|
}
|
|
710
710
|
getPortAdjacentEdgeIds(e) {
|
|
@@ -716,8 +716,8 @@ class xe {
|
|
|
716
716
|
}
|
|
717
717
|
getNodeIncomingEdgeIds(e) {
|
|
718
718
|
const t = Array.from(this.getNode(e).ports.keys()), s = [];
|
|
719
|
-
return t.forEach((
|
|
720
|
-
this.getPortIncomingEdgeIds(
|
|
719
|
+
return t.forEach((o) => {
|
|
720
|
+
this.getPortIncomingEdgeIds(o).filter((n) => {
|
|
721
721
|
const a = this.getEdge(n);
|
|
722
722
|
return this.getPort(a.from).nodeId !== e;
|
|
723
723
|
}).forEach((n) => {
|
|
@@ -727,8 +727,8 @@ class xe {
|
|
|
727
727
|
}
|
|
728
728
|
getNodeOutgoingEdgeIds(e) {
|
|
729
729
|
const t = Array.from(this.getNode(e).ports.keys()), s = [];
|
|
730
|
-
return t.forEach((
|
|
731
|
-
this.getPortOutgoingEdgeIds(
|
|
730
|
+
return t.forEach((o) => {
|
|
731
|
+
this.getPortOutgoingEdgeIds(o).filter((n) => {
|
|
732
732
|
const a = this.getEdge(n);
|
|
733
733
|
return this.getPort(a.to).nodeId !== e;
|
|
734
734
|
}).forEach((n) => {
|
|
@@ -738,10 +738,10 @@ class xe {
|
|
|
738
738
|
}
|
|
739
739
|
getNodeCycleEdgeIds(e) {
|
|
740
740
|
const t = Array.from(this.getNode(e).ports.keys()), s = [];
|
|
741
|
-
return t.forEach((
|
|
742
|
-
this.getPortCycleEdgeIds(
|
|
741
|
+
return t.forEach((o) => {
|
|
742
|
+
this.getPortCycleEdgeIds(o).forEach((n) => {
|
|
743
743
|
s.push(n);
|
|
744
|
-
}), this.getPortIncomingEdgeIds(
|
|
744
|
+
}), this.getPortIncomingEdgeIds(o).filter((n) => {
|
|
745
745
|
const a = this.getEdge(n);
|
|
746
746
|
return this.getPort(a.to).nodeId === e;
|
|
747
747
|
}).forEach((n) => {
|
|
@@ -751,12 +751,12 @@ class xe {
|
|
|
751
751
|
}
|
|
752
752
|
getNodeAdjacentEdgeIds(e) {
|
|
753
753
|
const t = Array.from(this.getNode(e).ports.keys()), s = [];
|
|
754
|
-
return t.forEach((
|
|
755
|
-
this.getPortIncomingEdgeIds(
|
|
754
|
+
return t.forEach((o) => {
|
|
755
|
+
this.getPortIncomingEdgeIds(o).forEach((n) => {
|
|
756
756
|
s.push(n);
|
|
757
|
-
}), this.getPortOutgoingEdgeIds(
|
|
757
|
+
}), this.getPortOutgoingEdgeIds(o).forEach((n) => {
|
|
758
758
|
s.push(n);
|
|
759
|
-
}), this.getPortCycleEdgeIds(
|
|
759
|
+
}), this.getPortCycleEdgeIds(o).forEach((n) => {
|
|
760
760
|
s.push(n);
|
|
761
761
|
});
|
|
762
762
|
}), s;
|
|
@@ -772,36 +772,36 @@ class xe {
|
|
|
772
772
|
}), e.from !== e.to ? (this.portOutcomingEdges.get(e.from).add(e.id), this.portIncomingEdges.get(e.to).add(e.id)) : this.portCycleEdges.get(e.from).add(e.id);
|
|
773
773
|
}
|
|
774
774
|
removeEdgeInternal(e) {
|
|
775
|
-
const t = this.edges.get(e), s = t.from,
|
|
776
|
-
this.portCycleEdges.get(s).delete(e), this.portCycleEdges.get(
|
|
775
|
+
const t = this.edges.get(e), s = t.from, o = t.to;
|
|
776
|
+
this.portCycleEdges.get(s).delete(e), this.portCycleEdges.get(o).delete(e), this.portIncomingEdges.get(s).delete(e), this.portIncomingEdges.get(o).delete(e), this.portOutcomingEdges.get(s).delete(e), this.portOutcomingEdges.get(o).delete(e), this.edges.delete(e);
|
|
777
777
|
}
|
|
778
778
|
}
|
|
779
|
-
const
|
|
779
|
+
const ge = (r) => ({
|
|
780
780
|
scale: 1 / r.scale,
|
|
781
781
|
x: -r.x / r.scale,
|
|
782
782
|
y: -r.y / r.scale
|
|
783
|
-
}),
|
|
783
|
+
}), ue = {
|
|
784
784
|
scale: 1,
|
|
785
785
|
x: 0,
|
|
786
786
|
y: 0
|
|
787
|
-
},
|
|
787
|
+
}, pe = (r, e) => ({
|
|
788
788
|
x: r.scale * e.x + r.x,
|
|
789
789
|
y: r.scale * e.y + r.y
|
|
790
790
|
});
|
|
791
|
-
class
|
|
791
|
+
class _e {
|
|
792
792
|
constructor(e) {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
793
|
+
i(this, "viewportMatrix", ue);
|
|
794
|
+
i(this, "contentMatrix", ue);
|
|
795
|
+
i(this, "beforeUpdateEmitter");
|
|
796
|
+
i(this, "onBeforeUpdated");
|
|
797
|
+
i(this, "afterUpdateEmitter");
|
|
798
|
+
i(this, "onAfterUpdated");
|
|
799
|
+
i(this, "afterResizeEmitter");
|
|
800
|
+
i(this, "onAfterResize");
|
|
801
|
+
i(this, "observer", new ResizeObserver(() => {
|
|
802
802
|
this.afterResizeEmitter.emit();
|
|
803
803
|
}));
|
|
804
|
-
this.host = e, [this.afterUpdateEmitter, this.onAfterUpdated] =
|
|
804
|
+
this.host = e, [this.afterUpdateEmitter, this.onAfterUpdated] = E(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = E(), [this.afterResizeEmitter, this.onAfterResize] = E(), this.observer.observe(this.host);
|
|
805
805
|
}
|
|
806
806
|
getViewportMatrix() {
|
|
807
807
|
return this.viewportMatrix;
|
|
@@ -814,65 +814,65 @@ class Je {
|
|
|
814
814
|
scale: e.scale ?? this.viewportMatrix.scale,
|
|
815
815
|
x: e.x ?? this.viewportMatrix.x,
|
|
816
816
|
y: e.y ?? this.viewportMatrix.y
|
|
817
|
-
}, this.beforeUpdateEmitter.emit(), this.contentMatrix =
|
|
817
|
+
}, this.beforeUpdateEmitter.emit(), this.contentMatrix = ge(this.viewportMatrix), this.afterUpdateEmitter.emit();
|
|
818
818
|
}
|
|
819
819
|
patchContentMatrix(e) {
|
|
820
820
|
this.contentMatrix = {
|
|
821
821
|
scale: e.scale ?? this.contentMatrix.scale,
|
|
822
822
|
x: e.x ?? this.contentMatrix.x,
|
|
823
823
|
y: e.y ?? this.contentMatrix.y
|
|
824
|
-
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix =
|
|
824
|
+
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix = ge(this.contentMatrix), this.afterUpdateEmitter.emit();
|
|
825
825
|
}
|
|
826
826
|
getDimensions() {
|
|
827
827
|
const { width: e, height: t } = this.host.getBoundingClientRect();
|
|
828
828
|
return { width: e, height: t };
|
|
829
829
|
}
|
|
830
830
|
createContentCoords(e) {
|
|
831
|
-
return
|
|
831
|
+
return pe(this.viewportMatrix, e);
|
|
832
832
|
}
|
|
833
833
|
createViewportCoords(e) {
|
|
834
|
-
return
|
|
834
|
+
return pe(this.contentMatrix, e);
|
|
835
835
|
}
|
|
836
836
|
destroy() {
|
|
837
837
|
this.observer.disconnect();
|
|
838
838
|
}
|
|
839
839
|
}
|
|
840
|
-
class
|
|
840
|
+
class Z {
|
|
841
841
|
constructor(e) {
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
842
|
+
i(this, "elementToNodeId", /* @__PURE__ */ new Map());
|
|
843
|
+
i(this, "nodesResizeObserver");
|
|
844
|
+
i(this, "onAfterNodeAdded", (e) => {
|
|
845
845
|
const t = this.canvas.graph.getNode(e);
|
|
846
846
|
this.elementToNodeId.set(t.element, e), this.nodesResizeObserver.observe(t.element);
|
|
847
847
|
});
|
|
848
|
-
|
|
848
|
+
i(this, "onBeforeNodeRemoved", (e) => {
|
|
849
849
|
const t = this.canvas.graph.getNode(e);
|
|
850
850
|
this.elementToNodeId.delete(t.element), this.nodesResizeObserver.unobserve(t.element);
|
|
851
851
|
});
|
|
852
|
-
|
|
852
|
+
i(this, "onBeforeClear", () => {
|
|
853
853
|
this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
|
|
854
854
|
});
|
|
855
855
|
this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
|
|
856
856
|
t.forEach((s) => {
|
|
857
|
-
const
|
|
858
|
-
this.handleNodeResize(
|
|
857
|
+
const o = s.target;
|
|
858
|
+
this.handleNodeResize(o);
|
|
859
859
|
});
|
|
860
860
|
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
|
|
861
861
|
}
|
|
862
862
|
static configure(e) {
|
|
863
|
-
new
|
|
863
|
+
new Z(e);
|
|
864
864
|
}
|
|
865
865
|
handleNodeResize(e) {
|
|
866
866
|
const t = this.elementToNodeId.get(e);
|
|
867
867
|
this.canvas.updateNode(t);
|
|
868
868
|
}
|
|
869
869
|
}
|
|
870
|
-
const
|
|
871
|
-
const { x: s, y:
|
|
872
|
-
return e >= s && e <= s + n && t >=
|
|
873
|
-
},
|
|
870
|
+
const et = (r, e, t) => {
|
|
871
|
+
const { x: s, y: o, width: n, height: a } = r.getBoundingClientRect();
|
|
872
|
+
return e >= s && e <= s + n && t >= o && t <= o + a;
|
|
873
|
+
}, tt = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, R = (r, e, t, s) => et(e, t, s) && tt(r, t, s), U = (r, e) => {
|
|
874
874
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
875
|
-
},
|
|
875
|
+
}, O = (r) => {
|
|
876
876
|
const e = document.createElement("div");
|
|
877
877
|
return {
|
|
878
878
|
id: r.overlayNodeId,
|
|
@@ -887,7 +887,7 @@ const _e = (r, e, t) => {
|
|
|
887
887
|
}
|
|
888
888
|
]
|
|
889
889
|
};
|
|
890
|
-
},
|
|
890
|
+
}, rt = (r, e) => {
|
|
891
891
|
let t = e;
|
|
892
892
|
for (; t !== null; ) {
|
|
893
893
|
const s = r.findPortIdsByElement(t)[0] ?? null;
|
|
@@ -906,70 +906,70 @@ const _e = (r, e, t) => {
|
|
|
906
906
|
status: "notFound"
|
|
907
907
|
};
|
|
908
908
|
};
|
|
909
|
-
function*
|
|
909
|
+
function* be(r, e) {
|
|
910
910
|
const t = r.elementsFromPoint(e.x, e.y);
|
|
911
911
|
for (const s of t) {
|
|
912
912
|
if (s.shadowRoot !== null) {
|
|
913
|
-
const
|
|
914
|
-
for (const n of
|
|
913
|
+
const o = be(s.shadowRoot, e);
|
|
914
|
+
for (const n of o)
|
|
915
915
|
yield n;
|
|
916
916
|
}
|
|
917
917
|
yield s;
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
|
-
const
|
|
921
|
-
const t =
|
|
920
|
+
const Pe = (r, e) => {
|
|
921
|
+
const t = be(document, e);
|
|
922
922
|
for (const s of t) {
|
|
923
|
-
const
|
|
924
|
-
if (
|
|
925
|
-
return
|
|
926
|
-
if (
|
|
923
|
+
const o = rt(r, s);
|
|
924
|
+
if (o.status === "portFound")
|
|
925
|
+
return o.portId;
|
|
926
|
+
if (o.status === "nodeEncountered")
|
|
927
927
|
return null;
|
|
928
928
|
}
|
|
929
929
|
return null;
|
|
930
930
|
};
|
|
931
931
|
var N = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(N || {});
|
|
932
|
-
const
|
|
932
|
+
const Ne = (r, e) => ({
|
|
933
933
|
x: r / 2,
|
|
934
934
|
y: e / 2
|
|
935
|
-
}),
|
|
935
|
+
}), p = {
|
|
936
936
|
x: 0,
|
|
937
937
|
y: 0
|
|
938
938
|
}, m = (r, e, t) => ({
|
|
939
939
|
x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
|
|
940
940
|
y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
|
|
941
|
-
}),
|
|
941
|
+
}), Te = (r, e) => {
|
|
942
942
|
const t = {
|
|
943
943
|
x: r.x + r.width / 2,
|
|
944
944
|
y: r.y + r.height / 2
|
|
945
945
|
}, s = {
|
|
946
946
|
x: e.x + e.width / 2,
|
|
947
947
|
y: e.y + e.height / 2
|
|
948
|
-
},
|
|
948
|
+
}, o = Math.min(t.x, s.x), n = Math.min(t.y, s.y), a = Math.abs(s.x - t.x), h = Math.abs(s.y - t.y), d = t.x <= s.x ? 1 : -1, c = t.y <= s.y ? 1 : -1;
|
|
949
949
|
return {
|
|
950
|
-
x:
|
|
950
|
+
x: o,
|
|
951
951
|
y: n,
|
|
952
952
|
width: a,
|
|
953
953
|
height: h,
|
|
954
954
|
flipX: d,
|
|
955
955
|
flipY: c
|
|
956
956
|
};
|
|
957
|
-
},
|
|
957
|
+
}, k = (r, e, t, s) => ({
|
|
958
958
|
x: e * r.x + (1 - e) / 2 * s.x,
|
|
959
959
|
y: t * r.y + (1 - t) / 2 * s.y
|
|
960
960
|
});
|
|
961
|
-
class
|
|
961
|
+
class st {
|
|
962
962
|
constructor(e) {
|
|
963
|
-
|
|
964
|
-
|
|
963
|
+
i(this, "path");
|
|
964
|
+
i(this, "midpoint");
|
|
965
965
|
this.params = e;
|
|
966
966
|
const t = this.params.to;
|
|
967
967
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
968
968
|
const s = m(
|
|
969
|
-
{ x: this.params.arrowLength, y:
|
|
969
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
970
970
|
this.params.sourceDirection,
|
|
971
|
-
|
|
972
|
-
),
|
|
971
|
+
p
|
|
972
|
+
), o = m(
|
|
973
973
|
{ x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
|
|
974
974
|
this.params.targetDirection,
|
|
975
975
|
this.params.to
|
|
@@ -977,49 +977,49 @@ class rt {
|
|
|
977
977
|
x: s.x + this.params.sourceDirection.x * this.params.curvature,
|
|
978
978
|
y: s.y + this.params.sourceDirection.y * this.params.curvature
|
|
979
979
|
}, a = {
|
|
980
|
-
x:
|
|
981
|
-
y:
|
|
982
|
-
}, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${
|
|
980
|
+
x: o.x - this.params.targetDirection.x * this.params.curvature,
|
|
981
|
+
y: o.y - this.params.targetDirection.y * this.params.curvature
|
|
982
|
+
}, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${o.x} ${o.y}`, d = this.params.hasSourceArrow ? "" : `M ${p.x} ${p.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${o.x} ${o.y} L ${this.params.to.x} ${this.params.to.y}`;
|
|
983
983
|
this.path = `${d}${h}${c}`;
|
|
984
984
|
}
|
|
985
985
|
}
|
|
986
|
-
class
|
|
986
|
+
class ot {
|
|
987
987
|
constructor(e) {
|
|
988
|
-
|
|
989
|
-
|
|
988
|
+
i(this, "path");
|
|
989
|
+
i(this, "midpoint");
|
|
990
990
|
this.params = e;
|
|
991
991
|
const t = this.params.hasSourceArrow ? m(
|
|
992
|
-
{ x: this.params.arrowLength, y:
|
|
992
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
993
993
|
this.params.sourceDirection,
|
|
994
|
-
|
|
995
|
-
) :
|
|
994
|
+
p
|
|
995
|
+
) : p, s = this.params.hasTargetArrow ? m(
|
|
996
996
|
{
|
|
997
997
|
x: this.params.to.x - this.params.arrowLength,
|
|
998
998
|
y: this.params.to.y
|
|
999
999
|
},
|
|
1000
1000
|
this.params.targetDirection,
|
|
1001
1001
|
this.params.to
|
|
1002
|
-
) : this.params.to,
|
|
1003
|
-
{ x:
|
|
1002
|
+
) : this.params.to, o = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c = m(
|
|
1003
|
+
{ x: o, y: p.y },
|
|
1004
1004
|
this.params.sourceDirection,
|
|
1005
|
-
|
|
1005
|
+
p
|
|
1006
1006
|
), g = {
|
|
1007
1007
|
x: c.x + h,
|
|
1008
1008
|
y: c.y + d
|
|
1009
1009
|
}, l = m(
|
|
1010
|
-
{ x: this.params.to.x -
|
|
1010
|
+
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
1011
1011
|
this.params.targetDirection,
|
|
1012
1012
|
this.params.to
|
|
1013
1013
|
), u = {
|
|
1014
1014
|
x: l.x + h,
|
|
1015
1015
|
y: l.y + d
|
|
1016
|
-
},
|
|
1016
|
+
}, w = {
|
|
1017
1017
|
x: (g.x + u.x) / 2,
|
|
1018
1018
|
y: (g.y + u.y) / 2
|
|
1019
1019
|
}, f = {
|
|
1020
1020
|
x: c.x + this.params.curvature * this.params.sourceDirection.x,
|
|
1021
1021
|
y: c.y + this.params.curvature * this.params.sourceDirection.y
|
|
1022
|
-
},
|
|
1022
|
+
}, v = {
|
|
1023
1023
|
x: l.x - this.params.curvature * this.params.targetDirection.x,
|
|
1024
1024
|
y: l.y - this.params.curvature * this.params.targetDirection.y
|
|
1025
1025
|
}, S = {
|
|
@@ -1032,41 +1032,41 @@ class st {
|
|
|
1032
1032
|
this.path = [
|
|
1033
1033
|
`M ${t.x} ${t.y}`,
|
|
1034
1034
|
`L ${c.x} ${c.y}`,
|
|
1035
|
-
`C ${f.x} ${f.y} ${S.x} ${S.y} ${
|
|
1036
|
-
`C ${b.x} ${b.y} ${
|
|
1035
|
+
`C ${f.x} ${f.y} ${S.x} ${S.y} ${w.x} ${w.y}`,
|
|
1036
|
+
`C ${b.x} ${b.y} ${v.x} ${v.y} ${l.x} ${l.y}`,
|
|
1037
1037
|
`L ${s.x} ${s.y}`
|
|
1038
|
-
].join(" "), this.midpoint =
|
|
1038
|
+
].join(" "), this.midpoint = k(w, e.flipX, e.flipY, e.to);
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
|
-
const
|
|
1041
|
+
const J = Object.freeze({
|
|
1042
1042
|
edgeColor: "--edge-color"
|
|
1043
1043
|
}), Ce = (r) => {
|
|
1044
1044
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1045
|
-
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(
|
|
1046
|
-
},
|
|
1045
|
+
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(J.edgeColor, r), e;
|
|
1046
|
+
}, Me = (r) => {
|
|
1047
1047
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1048
|
-
return e.setAttribute("stroke", `var(${
|
|
1049
|
-
},
|
|
1048
|
+
return e.setAttribute("stroke", `var(${J.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
1049
|
+
}, W = () => {
|
|
1050
1050
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1051
|
-
return r.setAttribute("fill", `var(${
|
|
1051
|
+
return r.setAttribute("fill", `var(${J.edgeColor})`), r;
|
|
1052
1052
|
}, De = () => {
|
|
1053
1053
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1054
1054
|
return r.style.transformOrigin = "50% 50%", r;
|
|
1055
|
-
},
|
|
1055
|
+
}, Re = (r, e) => {
|
|
1056
1056
|
r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${Math.max(e.width, 1)}px`, r.style.height = `${Math.max(e.height, 1)}px`;
|
|
1057
|
-
},
|
|
1057
|
+
}, M = (r, e) => {
|
|
1058
1058
|
const t = [];
|
|
1059
1059
|
if (r.length > 0 && t.push(`M ${r[0].x} ${r[0].y}`), r.length === 2 && t.push(`L ${r[1].x} ${r[1].y}`), r.length > 2) {
|
|
1060
1060
|
const s = r.length - 1;
|
|
1061
|
-
let
|
|
1061
|
+
let o = 0, n = 0, a = 0;
|
|
1062
1062
|
r.forEach((h, d) => {
|
|
1063
1063
|
let c = 0, g = 0, l = 0;
|
|
1064
|
-
const u = d > 0,
|
|
1065
|
-
if (u && (c = -
|
|
1064
|
+
const u = d > 0, w = d < s, f = u && w;
|
|
1065
|
+
if (u && (c = -o, g = -n, l = a), w) {
|
|
1066
1066
|
const V = r[d + 1];
|
|
1067
|
-
|
|
1067
|
+
o = V.x - h.x, n = V.y - h.y, a = Math.sqrt(o * o + n * n);
|
|
1068
1068
|
}
|
|
1069
|
-
const S = a !== 0 ? Math.min((f ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, b = f ? { x: h.x +
|
|
1069
|
+
const S = a !== 0 ? Math.min((f ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, b = f ? { x: h.x + o * S, y: h.y + n * S } : h, P = l !== 0 ? Math.min((f ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, L = f ? { x: h.x + c * P, y: h.y + g * P } : h;
|
|
1070
1070
|
d > 0 && t.push(`L ${L.x} ${L.y}`), f && t.push(
|
|
1071
1071
|
`C ${h.x} ${h.y} ${h.x} ${h.y} ${b.x} ${b.y}`
|
|
1072
1072
|
);
|
|
@@ -1074,18 +1074,18 @@ const Z = Object.freeze({
|
|
|
1074
1074
|
}
|
|
1075
1075
|
return t.join(" ");
|
|
1076
1076
|
};
|
|
1077
|
-
class
|
|
1077
|
+
class it {
|
|
1078
1078
|
constructor(e) {
|
|
1079
|
-
|
|
1080
|
-
|
|
1079
|
+
i(this, "path");
|
|
1080
|
+
i(this, "midpoint");
|
|
1081
1081
|
this.params = e;
|
|
1082
1082
|
const t = this.params.to;
|
|
1083
1083
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1084
1084
|
const s = this.params.hasSourceArrow ? m(
|
|
1085
|
-
{ x: this.params.arrowLength, y:
|
|
1085
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1086
1086
|
this.params.sourceDirection,
|
|
1087
|
-
|
|
1088
|
-
) :
|
|
1087
|
+
p
|
|
1088
|
+
) : p, o = this.params.hasTargetArrow ? m(
|
|
1089
1089
|
{
|
|
1090
1090
|
x: this.params.to.x - this.params.arrowLength,
|
|
1091
1091
|
y: this.params.to.y
|
|
@@ -1093,9 +1093,9 @@ class ot {
|
|
|
1093
1093
|
this.params.targetDirection,
|
|
1094
1094
|
this.params.to
|
|
1095
1095
|
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
|
|
1096
|
-
{ x: a, y:
|
|
1096
|
+
{ x: a, y: p.y },
|
|
1097
1097
|
this.params.sourceDirection,
|
|
1098
|
-
|
|
1098
|
+
p
|
|
1099
1099
|
), d = m(
|
|
1100
1100
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1101
1101
|
this.params.targetDirection,
|
|
@@ -1103,59 +1103,59 @@ class ot {
|
|
|
1103
1103
|
), c = Math.max((h.x + d.x) / 2, n), g = this.params.to.y / 2, l = {
|
|
1104
1104
|
x: this.params.flipX > 0 ? c : -n,
|
|
1105
1105
|
y: h.y
|
|
1106
|
-
}, u = { x: l.x, y: g },
|
|
1106
|
+
}, u = { x: l.x, y: g }, w = {
|
|
1107
1107
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
1108
1108
|
y: d.y
|
|
1109
|
-
}, f = { x:
|
|
1110
|
-
this.path =
|
|
1111
|
-
[s, h, l, u, f,
|
|
1109
|
+
}, f = { x: w.x, y: g };
|
|
1110
|
+
this.path = M(
|
|
1111
|
+
[s, h, l, u, f, w, d, o],
|
|
1112
1112
|
this.params.roundness
|
|
1113
1113
|
);
|
|
1114
1114
|
}
|
|
1115
1115
|
}
|
|
1116
|
-
class
|
|
1116
|
+
class nt {
|
|
1117
1117
|
constructor(e) {
|
|
1118
|
-
|
|
1119
|
-
|
|
1118
|
+
i(this, "path");
|
|
1119
|
+
i(this, "midpoint");
|
|
1120
1120
|
this.params = e;
|
|
1121
1121
|
const t = this.params.hasSourceArrow ? m(
|
|
1122
|
-
{ x: this.params.arrowLength, y:
|
|
1122
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1123
1123
|
this.params.sourceDirection,
|
|
1124
|
-
|
|
1125
|
-
) :
|
|
1124
|
+
p
|
|
1125
|
+
) : p, s = this.params.hasTargetArrow ? m(
|
|
1126
1126
|
{
|
|
1127
1127
|
x: this.params.to.x - this.params.arrowLength,
|
|
1128
1128
|
y: this.params.to.y
|
|
1129
1129
|
},
|
|
1130
1130
|
this.params.targetDirection,
|
|
1131
1131
|
this.params.to
|
|
1132
|
-
) : this.params.to,
|
|
1133
|
-
{ x:
|
|
1132
|
+
) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1133
|
+
{ x: o, y: p.y },
|
|
1134
1134
|
this.params.sourceDirection,
|
|
1135
|
-
|
|
1135
|
+
p
|
|
1136
1136
|
), a = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = a * this.params.flipX, c = h * this.params.flipY, g = { x: n.x + d, y: n.y + c }, l = m(
|
|
1137
|
-
{ x: this.params.to.x -
|
|
1137
|
+
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
1138
1138
|
this.params.targetDirection,
|
|
1139
1139
|
this.params.to
|
|
1140
|
-
), u = { x: l.x + d, y: l.y + c },
|
|
1141
|
-
this.midpoint =
|
|
1140
|
+
), u = { x: l.x + d, y: l.y + c }, w = { x: (g.x + u.x) / 2, y: (g.y + u.y) / 2 };
|
|
1141
|
+
this.midpoint = k(w, e.flipX, e.flipY, e.to), this.path = M(
|
|
1142
1142
|
[t, n, g, u, l, s],
|
|
1143
1143
|
this.params.roundness
|
|
1144
1144
|
);
|
|
1145
1145
|
}
|
|
1146
1146
|
}
|
|
1147
|
-
class
|
|
1147
|
+
class at {
|
|
1148
1148
|
constructor(e) {
|
|
1149
|
-
|
|
1150
|
-
|
|
1149
|
+
i(this, "path");
|
|
1150
|
+
i(this, "midpoint");
|
|
1151
1151
|
this.params = e;
|
|
1152
1152
|
const t = this.params.to;
|
|
1153
1153
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1154
1154
|
const s = this.params.hasSourceArrow ? m(
|
|
1155
|
-
{ x: this.params.arrowLength, y:
|
|
1155
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1156
1156
|
this.params.sourceDirection,
|
|
1157
|
-
|
|
1158
|
-
) :
|
|
1157
|
+
p
|
|
1158
|
+
) : p, o = this.params.hasTargetArrow ? m(
|
|
1159
1159
|
{
|
|
1160
1160
|
x: this.params.to.x - this.params.arrowLength,
|
|
1161
1161
|
y: this.params.to.y
|
|
@@ -1163,29 +1163,29 @@ class nt {
|
|
|
1163
1163
|
this.params.targetDirection,
|
|
1164
1164
|
this.params.to
|
|
1165
1165
|
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = m(
|
|
1166
|
-
{ x: n, y:
|
|
1166
|
+
{ x: n, y: p.y },
|
|
1167
1167
|
this.params.sourceDirection,
|
|
1168
|
-
|
|
1168
|
+
p
|
|
1169
1169
|
), h = m(
|
|
1170
1170
|
{ x: this.params.to.x - n, y: this.params.to.y },
|
|
1171
1171
|
this.params.targetDirection,
|
|
1172
1172
|
this.params.to
|
|
1173
1173
|
);
|
|
1174
|
-
this.path =
|
|
1174
|
+
this.path = M([s, a, h, o], this.params.roundness);
|
|
1175
1175
|
}
|
|
1176
1176
|
}
|
|
1177
|
-
class
|
|
1177
|
+
class ht {
|
|
1178
1178
|
constructor(e) {
|
|
1179
|
-
|
|
1180
|
-
|
|
1179
|
+
i(this, "path");
|
|
1180
|
+
i(this, "midpoint");
|
|
1181
1181
|
this.params = e;
|
|
1182
1182
|
const t = this.params.to;
|
|
1183
1183
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1184
1184
|
const s = this.params.hasSourceArrow ? m(
|
|
1185
|
-
{ x: this.params.arrowLength, y:
|
|
1185
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1186
1186
|
this.params.sourceDirection,
|
|
1187
|
-
|
|
1188
|
-
) :
|
|
1187
|
+
p
|
|
1188
|
+
) : p, o = this.params.hasTargetArrow ? m(
|
|
1189
1189
|
{
|
|
1190
1190
|
x: this.params.to.x - this.params.arrowLength,
|
|
1191
1191
|
y: this.params.to.y
|
|
@@ -1193,9 +1193,9 @@ class at {
|
|
|
1193
1193
|
this.params.targetDirection,
|
|
1194
1194
|
this.params.to
|
|
1195
1195
|
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
|
|
1196
|
-
{ x: a, y:
|
|
1196
|
+
{ x: a, y: p.y },
|
|
1197
1197
|
this.params.sourceDirection,
|
|
1198
|
-
|
|
1198
|
+
p
|
|
1199
1199
|
), d = m(
|
|
1200
1200
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1201
1201
|
this.params.targetDirection,
|
|
@@ -1203,62 +1203,62 @@ class at {
|
|
|
1203
1203
|
), c = Math.max((h.y + d.y) / 2, n), g = this.params.to.x / 2, l = {
|
|
1204
1204
|
x: h.x,
|
|
1205
1205
|
y: this.params.flipY > 0 ? c : -n
|
|
1206
|
-
}, u = { x: g, y: l.y },
|
|
1206
|
+
}, u = { x: g, y: l.y }, w = {
|
|
1207
1207
|
x: d.x,
|
|
1208
1208
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1209
|
-
}, f = { x: g, y:
|
|
1210
|
-
this.path =
|
|
1211
|
-
[s, h, l, u, f,
|
|
1209
|
+
}, f = { x: g, y: w.y };
|
|
1210
|
+
this.path = M(
|
|
1211
|
+
[s, h, l, u, f, w, d, o],
|
|
1212
1212
|
this.params.roundness
|
|
1213
1213
|
);
|
|
1214
1214
|
}
|
|
1215
1215
|
}
|
|
1216
|
-
class
|
|
1216
|
+
class _ {
|
|
1217
1217
|
constructor(e) {
|
|
1218
|
-
|
|
1219
|
-
|
|
1218
|
+
i(this, "path");
|
|
1219
|
+
i(this, "midpoint");
|
|
1220
1220
|
this.params = e;
|
|
1221
|
-
const t = this.params.arrowOffset, s = this.params.side,
|
|
1222
|
-
{ x: this.params.arrowLength, y:
|
|
1223
|
-
{ x:
|
|
1224
|
-
{ x:
|
|
1221
|
+
const t = this.params.arrowOffset, s = this.params.side, o = this.params.arrowLength + t, n = o + 2 * s, h = [
|
|
1222
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1223
|
+
{ x: o, y: p.y },
|
|
1224
|
+
{ x: o, y: this.params.side },
|
|
1225
1225
|
{ x: n, y: this.params.side },
|
|
1226
1226
|
{ x: n, y: -this.params.side },
|
|
1227
|
-
{ x:
|
|
1228
|
-
{ x:
|
|
1229
|
-
{ x: this.params.arrowLength, y:
|
|
1227
|
+
{ x: o, y: -this.params.side },
|
|
1228
|
+
{ x: o, y: p.y },
|
|
1229
|
+
{ x: this.params.arrowLength, y: p.y }
|
|
1230
1230
|
].map(
|
|
1231
|
-
(c) => m(c, this.params.sourceDirection,
|
|
1232
|
-
), d = `M ${
|
|
1233
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${
|
|
1231
|
+
(c) => m(c, this.params.sourceDirection, p)
|
|
1232
|
+
), d = `M ${p.x} ${p.y} L ${h[0].x} ${h[0].y} `;
|
|
1233
|
+
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${M(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
|
|
1234
1234
|
}
|
|
1235
1235
|
}
|
|
1236
|
-
class
|
|
1236
|
+
class dt {
|
|
1237
1237
|
constructor(e) {
|
|
1238
|
-
|
|
1239
|
-
|
|
1238
|
+
i(this, "path");
|
|
1239
|
+
i(this, "midpoint");
|
|
1240
1240
|
this.params = e;
|
|
1241
|
-
const t = this.params.smallRadius, s = this.params.radius,
|
|
1242
|
-
{ x: this.params.arrowLength, y:
|
|
1241
|
+
const t = this.params.smallRadius, s = this.params.radius, o = t + s, n = t * s / o, a = Math.sqrt(o * o - t * t), h = a * t / o, d = a + s + this.params.arrowLength, c = this.params.arrowLength + h, l = [
|
|
1242
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1243
1243
|
{ x: c, y: n },
|
|
1244
1244
|
{ x: c, y: -n },
|
|
1245
1245
|
{ x: d, y: 0 }
|
|
1246
1246
|
].map(
|
|
1247
|
-
(f) => m(f, this.params.sourceDirection,
|
|
1247
|
+
(f) => m(f, this.params.sourceDirection, p)
|
|
1248
1248
|
), u = [
|
|
1249
1249
|
`M ${l[0].x} ${l[0].y}`,
|
|
1250
1250
|
`A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
|
|
1251
1251
|
`A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
|
|
1252
1252
|
`A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
|
|
1253
|
-
].join(" "),
|
|
1254
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" :
|
|
1253
|
+
].join(" "), w = `M 0 0 L ${l[0].x} ${l[0].y} `;
|
|
1254
|
+
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${u}`, this.midpoint = l[3];
|
|
1255
1255
|
}
|
|
1256
1256
|
}
|
|
1257
|
-
class
|
|
1257
|
+
class ct {
|
|
1258
1258
|
constructor(e) {
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1259
|
+
i(this, "path");
|
|
1260
|
+
i(this, "midpoint");
|
|
1261
|
+
i(this, "diagonalDistance");
|
|
1262
1262
|
this.params = e;
|
|
1263
1263
|
const t = this.params.to;
|
|
1264
1264
|
if (this.midpoint = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
|
|
@@ -1269,56 +1269,56 @@ class dt {
|
|
|
1269
1269
|
this.path = "";
|
|
1270
1270
|
return;
|
|
1271
1271
|
}
|
|
1272
|
-
const
|
|
1272
|
+
const o = this.createDirectLinePoint({
|
|
1273
1273
|
offset: this.params.sourceOffset,
|
|
1274
1274
|
hasArrow: this.params.hasSourceArrow,
|
|
1275
1275
|
flip: 1,
|
|
1276
|
-
shift:
|
|
1276
|
+
shift: p
|
|
1277
1277
|
}), n = this.createDirectLinePoint({
|
|
1278
1278
|
offset: this.params.targetOffset,
|
|
1279
1279
|
hasArrow: this.params.hasTargetArrow,
|
|
1280
1280
|
flip: -1,
|
|
1281
1281
|
shift: this.params.to
|
|
1282
1282
|
});
|
|
1283
|
-
this.path = `M ${
|
|
1283
|
+
this.path = `M ${o.x} ${o.y} L ${n.x} ${n.y}`;
|
|
1284
1284
|
}
|
|
1285
1285
|
createDirectLinePoint(e) {
|
|
1286
|
-
const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t,
|
|
1286
|
+
const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, o = e.flip * s / this.diagonalDistance;
|
|
1287
1287
|
return {
|
|
1288
|
-
x: this.params.to.x *
|
|
1289
|
-
y: this.params.to.y *
|
|
1288
|
+
x: this.params.to.x * o + e.shift.x,
|
|
1289
|
+
y: this.params.to.y * o + e.shift.y
|
|
1290
1290
|
};
|
|
1291
1291
|
}
|
|
1292
1292
|
}
|
|
1293
|
-
class
|
|
1293
|
+
class lt {
|
|
1294
1294
|
constructor(e) {
|
|
1295
|
-
|
|
1296
|
-
|
|
1295
|
+
i(this, "path");
|
|
1296
|
+
i(this, "midpoint");
|
|
1297
1297
|
this.params = e;
|
|
1298
1298
|
const t = this.params.hasSourceArrow ? m(
|
|
1299
|
-
{ x: this.params.arrowLength, y:
|
|
1299
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1300
1300
|
this.params.sourceDirection,
|
|
1301
|
-
|
|
1302
|
-
) :
|
|
1301
|
+
p
|
|
1302
|
+
) : p, s = this.params.hasTargetArrow ? m(
|
|
1303
1303
|
{
|
|
1304
1304
|
x: this.params.to.x - this.params.arrowLength,
|
|
1305
1305
|
y: this.params.to.y
|
|
1306
1306
|
},
|
|
1307
1307
|
this.params.targetDirection,
|
|
1308
1308
|
this.params.to
|
|
1309
|
-
) : this.params.to,
|
|
1310
|
-
{ x:
|
|
1309
|
+
) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1310
|
+
{ x: o, y: p.y },
|
|
1311
1311
|
this.params.sourceDirection,
|
|
1312
|
-
|
|
1312
|
+
p
|
|
1313
1313
|
), a = m(
|
|
1314
|
-
{ x: this.params.to.x -
|
|
1314
|
+
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
1315
1315
|
this.params.targetDirection,
|
|
1316
1316
|
this.params.to
|
|
1317
1317
|
), h = this.params.detourDistance > 0 ? 1 : -1, d = this.params.to.y / 2, c = d + Math.abs(this.params.detourDistance), g = d + c * this.params.flipY * h, l = {
|
|
1318
1318
|
x: (n.x + a.x) / 2,
|
|
1319
1319
|
y: g
|
|
1320
1320
|
};
|
|
1321
|
-
this.midpoint =
|
|
1321
|
+
this.midpoint = k(l, e.flipX, e.flipY, e.to), this.path = M(
|
|
1322
1322
|
[
|
|
1323
1323
|
t,
|
|
1324
1324
|
n,
|
|
@@ -1331,35 +1331,35 @@ class ct {
|
|
|
1331
1331
|
);
|
|
1332
1332
|
}
|
|
1333
1333
|
}
|
|
1334
|
-
class
|
|
1334
|
+
class gt {
|
|
1335
1335
|
constructor(e) {
|
|
1336
|
-
|
|
1337
|
-
|
|
1336
|
+
i(this, "path");
|
|
1337
|
+
i(this, "midpoint");
|
|
1338
1338
|
this.params = e;
|
|
1339
1339
|
const t = this.params.hasSourceArrow ? m(
|
|
1340
|
-
{ x: this.params.arrowLength, y:
|
|
1340
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1341
1341
|
this.params.sourceDirection,
|
|
1342
|
-
|
|
1343
|
-
) :
|
|
1342
|
+
p
|
|
1343
|
+
) : p, s = this.params.hasTargetArrow ? m(
|
|
1344
1344
|
{
|
|
1345
1345
|
x: this.params.to.x - this.params.arrowLength,
|
|
1346
1346
|
y: this.params.to.y
|
|
1347
1347
|
},
|
|
1348
1348
|
this.params.targetDirection,
|
|
1349
1349
|
this.params.to
|
|
1350
|
-
) : this.params.to,
|
|
1351
|
-
{ x:
|
|
1350
|
+
) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1351
|
+
{ x: o, y: p.y },
|
|
1352
1352
|
this.params.sourceDirection,
|
|
1353
|
-
|
|
1353
|
+
p
|
|
1354
1354
|
), a = m(
|
|
1355
|
-
{ x: this.params.to.x -
|
|
1355
|
+
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
1356
1356
|
this.params.targetDirection,
|
|
1357
1357
|
this.params.to
|
|
1358
1358
|
), h = this.params.detourDistance > 0 ? 1 : -1, d = this.params.to.x / 2, c = d + Math.abs(this.params.detourDistance), g = d + c * this.params.flipX * h, l = {
|
|
1359
1359
|
x: g,
|
|
1360
1360
|
y: (n.y + a.y) / 2
|
|
1361
1361
|
};
|
|
1362
|
-
this.midpoint =
|
|
1362
|
+
this.midpoint = k(l, e.flipX, e.flipY, e.to), this.path = M(
|
|
1363
1363
|
[
|
|
1364
1364
|
t,
|
|
1365
1365
|
n,
|
|
@@ -1394,87 +1394,87 @@ const y = Object.freeze({
|
|
|
1394
1394
|
curvature: 90,
|
|
1395
1395
|
interactiveWidth: 10,
|
|
1396
1396
|
preOffset: 0
|
|
1397
|
-
}),
|
|
1398
|
-
class
|
|
1397
|
+
}), we = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
|
|
1398
|
+
class H {
|
|
1399
1399
|
constructor(e) {
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] =
|
|
1400
|
+
i(this, "svg");
|
|
1401
|
+
i(this, "group", De());
|
|
1402
|
+
i(this, "line");
|
|
1403
|
+
i(this, "sourceArrow", null);
|
|
1404
|
+
i(this, "targetArrow", null);
|
|
1405
|
+
i(this, "onAfterRender");
|
|
1406
|
+
i(this, "afterRenderEmitter");
|
|
1407
|
+
i(this, "arrowRenderer");
|
|
1408
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Ce(e.color), this.svg.appendChild(this.group), this.line = Me(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = W(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = W(), this.group.appendChild(this.targetArrow));
|
|
1409
1409
|
}
|
|
1410
1410
|
render(e) {
|
|
1411
|
-
const { x: t, y: s, width:
|
|
1411
|
+
const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = Te(
|
|
1412
1412
|
e.from,
|
|
1413
1413
|
e.to
|
|
1414
1414
|
);
|
|
1415
|
-
|
|
1416
|
-
const d =
|
|
1415
|
+
Re(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1416
|
+
const d = we(
|
|
1417
1417
|
e.from.direction,
|
|
1418
1418
|
a,
|
|
1419
1419
|
h
|
|
1420
|
-
), c =
|
|
1420
|
+
), c = we(
|
|
1421
1421
|
e.to.direction,
|
|
1422
1422
|
a,
|
|
1423
1423
|
h
|
|
1424
1424
|
), g = {
|
|
1425
|
-
x:
|
|
1425
|
+
x: o,
|
|
1426
1426
|
y: n
|
|
1427
1427
|
};
|
|
1428
1428
|
let l = { x: -c.x, y: -c.y }, u;
|
|
1429
|
-
e.category ===
|
|
1430
|
-
const
|
|
1429
|
+
e.category === D.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === D.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
|
|
1430
|
+
const w = u(
|
|
1431
1431
|
d,
|
|
1432
1432
|
c,
|
|
1433
1433
|
g,
|
|
1434
1434
|
a,
|
|
1435
1435
|
h
|
|
1436
1436
|
);
|
|
1437
|
-
this.line.setAttribute("d",
|
|
1437
|
+
this.line.setAttribute("d", w.path);
|
|
1438
1438
|
let f = null;
|
|
1439
1439
|
this.sourceArrow && (f = this.arrowRenderer({
|
|
1440
1440
|
direction: d,
|
|
1441
|
-
shift:
|
|
1441
|
+
shift: p,
|
|
1442
1442
|
arrowLength: this.params.arrowLength
|
|
1443
1443
|
}), this.sourceArrow.setAttribute("d", f));
|
|
1444
|
-
let
|
|
1445
|
-
this.targetArrow && (
|
|
1444
|
+
let v = null;
|
|
1445
|
+
this.targetArrow && (v = this.arrowRenderer({
|
|
1446
1446
|
direction: l,
|
|
1447
1447
|
shift: g,
|
|
1448
1448
|
arrowLength: this.params.arrowLength
|
|
1449
|
-
}), this.targetArrow.setAttribute("d",
|
|
1450
|
-
edgePath:
|
|
1449
|
+
}), this.targetArrow.setAttribute("d", v)), this.afterRenderEmitter.emit({
|
|
1450
|
+
edgePath: w,
|
|
1451
1451
|
sourceArrowPath: f,
|
|
1452
|
-
targetArrowPath:
|
|
1452
|
+
targetArrowPath: v
|
|
1453
1453
|
});
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
|
-
const
|
|
1456
|
+
const ut = (r) => (e) => {
|
|
1457
1457
|
const s = [
|
|
1458
|
-
|
|
1458
|
+
p,
|
|
1459
1459
|
{ x: e.arrowLength, y: r.radius },
|
|
1460
1460
|
{ x: e.arrowLength, y: -r.radius }
|
|
1461
1461
|
].map(
|
|
1462
|
-
(h) => m(h, e.direction,
|
|
1462
|
+
(h) => m(h, e.direction, p)
|
|
1463
1463
|
).map((h) => ({
|
|
1464
1464
|
x: h.x + e.shift.x,
|
|
1465
1465
|
y: h.y + e.shift.y
|
|
1466
|
-
})),
|
|
1467
|
-
return `${
|
|
1468
|
-
},
|
|
1469
|
-
const t = r.radius, s = e.arrowLength,
|
|
1470
|
-
(f) => m(f, e.direction,
|
|
1466
|
+
})), o = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
|
|
1467
|
+
return `${o} ${n} ${a} Z`;
|
|
1468
|
+
}, pt = (r) => (e) => {
|
|
1469
|
+
const t = r.radius, s = e.arrowLength, o = (s * s + 2 * s * t) / (2 * t), n = o + t, a = s + t - t * (s + t) / n, h = t * o / n, c = [p, { x: a, y: -h }, { x: a, y: h }].map(
|
|
1470
|
+
(f) => m(f, e.direction, p)
|
|
1471
1471
|
).map((f) => ({
|
|
1472
1472
|
x: f.x + e.shift.x,
|
|
1473
1473
|
y: f.y + e.shift.y
|
|
1474
|
-
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${
|
|
1475
|
-
return `${g} ${l} ${u} ${
|
|
1476
|
-
},
|
|
1477
|
-
const t = r.smallRadius, s = r.radius,
|
|
1474
|
+
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${o} ${o} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${o} ${o} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1475
|
+
return `${g} ${l} ${u} ${w}`;
|
|
1476
|
+
}, wt = (r) => (e) => {
|
|
1477
|
+
const t = r.smallRadius, s = r.radius, o = m(
|
|
1478
1478
|
{
|
|
1479
1479
|
x: e.arrowLength,
|
|
1480
1480
|
y: 0
|
|
@@ -1487,8 +1487,8 @@ const gt = (r) => (e) => {
|
|
|
1487
1487
|
x: e.arrowLength + r.smallRadius,
|
|
1488
1488
|
y: 0
|
|
1489
1489
|
}
|
|
1490
|
-
), a = [
|
|
1491
|
-
(l) => m(l, e.direction,
|
|
1490
|
+
), a = [p, { x: o.x, y: -o.y }, o].map(
|
|
1491
|
+
(l) => m(l, e.direction, p)
|
|
1492
1492
|
).map((l) => ({
|
|
1493
1493
|
x: l.x + e.shift.x,
|
|
1494
1494
|
y: l.y + e.shift.y
|
|
@@ -1499,39 +1499,39 @@ const gt = (r) => (e) => {
|
|
|
1499
1499
|
return r;
|
|
1500
1500
|
switch (r.type) {
|
|
1501
1501
|
case "triangle":
|
|
1502
|
-
return
|
|
1502
|
+
return ut({
|
|
1503
1503
|
radius: r.radius ?? y.polygonArrowRadius
|
|
1504
1504
|
});
|
|
1505
1505
|
case "arc":
|
|
1506
|
-
return
|
|
1506
|
+
return pt({
|
|
1507
1507
|
radius: r.radius ?? y.circleArrowRadius
|
|
1508
1508
|
});
|
|
1509
1509
|
default:
|
|
1510
|
-
return
|
|
1510
|
+
return wt({
|
|
1511
1511
|
smallRadius: r.smallRadius ?? y.wedgeArrowSmallRadius,
|
|
1512
1512
|
angle: r.angle ?? y.wedgeArrowAngle,
|
|
1513
1513
|
radius: r.radius ?? y.wedgeArrowRadius
|
|
1514
1514
|
});
|
|
1515
1515
|
}
|
|
1516
1516
|
};
|
|
1517
|
-
class
|
|
1517
|
+
class ft {
|
|
1518
1518
|
constructor(e) {
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1519
|
+
i(this, "svg");
|
|
1520
|
+
i(this, "group");
|
|
1521
|
+
i(this, "line");
|
|
1522
|
+
i(this, "sourceArrow");
|
|
1523
|
+
i(this, "targetArrow");
|
|
1524
|
+
i(this, "onAfterRender");
|
|
1525
|
+
i(this, "arrowLength");
|
|
1526
|
+
i(this, "curvature");
|
|
1527
|
+
i(this, "portCycleRadius");
|
|
1528
|
+
i(this, "portCycleSmallRadius");
|
|
1529
|
+
i(this, "detourDirection");
|
|
1530
|
+
i(this, "detourDistance");
|
|
1531
|
+
i(this, "hasSourceArrow");
|
|
1532
|
+
i(this, "hasTargetArrow");
|
|
1533
|
+
i(this, "pathShape");
|
|
1534
|
+
i(this, "createCyclePath", (e) => new dt({
|
|
1535
1535
|
sourceDirection: e,
|
|
1536
1536
|
radius: this.portCycleRadius,
|
|
1537
1537
|
smallRadius: this.portCycleSmallRadius,
|
|
@@ -1539,11 +1539,11 @@ class wt {
|
|
|
1539
1539
|
hasSourceArrow: this.hasSourceArrow,
|
|
1540
1540
|
hasTargetArrow: this.hasTargetArrow
|
|
1541
1541
|
}));
|
|
1542
|
-
|
|
1542
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new ot({
|
|
1543
1543
|
to: s,
|
|
1544
1544
|
sourceDirection: e,
|
|
1545
1545
|
targetDirection: t,
|
|
1546
|
-
flipX:
|
|
1546
|
+
flipX: o,
|
|
1547
1547
|
flipY: n,
|
|
1548
1548
|
arrowLength: this.arrowLength,
|
|
1549
1549
|
detourDirection: this.detourDirection,
|
|
@@ -1552,7 +1552,7 @@ class wt {
|
|
|
1552
1552
|
hasSourceArrow: this.hasSourceArrow,
|
|
1553
1553
|
hasTargetArrow: this.hasTargetArrow
|
|
1554
1554
|
}));
|
|
1555
|
-
|
|
1555
|
+
i(this, "createLinePath", (e, t, s) => new st({
|
|
1556
1556
|
to: s,
|
|
1557
1557
|
sourceDirection: e,
|
|
1558
1558
|
targetDirection: t,
|
|
@@ -1561,7 +1561,7 @@ class wt {
|
|
|
1561
1561
|
hasSourceArrow: this.hasSourceArrow,
|
|
1562
1562
|
hasTargetArrow: this.hasTargetArrow
|
|
1563
1563
|
}));
|
|
1564
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? y.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? y.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? y.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? y.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new
|
|
1564
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? y.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? y.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? y.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? y.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new H({
|
|
1565
1565
|
color: (e == null ? void 0 : e.color) ?? y.color,
|
|
1566
1566
|
width: (e == null ? void 0 : e.width) ?? y.width,
|
|
1567
1567
|
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
@@ -1577,23 +1577,23 @@ class wt {
|
|
|
1577
1577
|
this.pathShape.render(e);
|
|
1578
1578
|
}
|
|
1579
1579
|
}
|
|
1580
|
-
class
|
|
1580
|
+
class yt {
|
|
1581
1581
|
constructor(e) {
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1582
|
+
i(this, "svg");
|
|
1583
|
+
i(this, "group");
|
|
1584
|
+
i(this, "line");
|
|
1585
|
+
i(this, "sourceArrow");
|
|
1586
|
+
i(this, "targetArrow");
|
|
1587
|
+
i(this, "onAfterRender");
|
|
1588
|
+
i(this, "arrowLength");
|
|
1589
|
+
i(this, "arrowOffset");
|
|
1590
|
+
i(this, "roundness");
|
|
1591
|
+
i(this, "cycleSquareSide");
|
|
1592
|
+
i(this, "detourDistance");
|
|
1593
|
+
i(this, "hasSourceArrow");
|
|
1594
|
+
i(this, "hasTargetArrow");
|
|
1595
|
+
i(this, "pathShape");
|
|
1596
|
+
i(this, "createCyclePath", (e) => new _({
|
|
1597
1597
|
sourceDirection: e,
|
|
1598
1598
|
arrowLength: this.arrowLength,
|
|
1599
1599
|
side: this.cycleSquareSide,
|
|
@@ -1602,11 +1602,11 @@ class ft {
|
|
|
1602
1602
|
hasSourceArrow: this.hasSourceArrow,
|
|
1603
1603
|
hasTargetArrow: this.hasTargetArrow
|
|
1604
1604
|
}));
|
|
1605
|
-
|
|
1605
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new lt({
|
|
1606
1606
|
to: s,
|
|
1607
1607
|
sourceDirection: e,
|
|
1608
1608
|
targetDirection: t,
|
|
1609
|
-
flipX:
|
|
1609
|
+
flipX: o,
|
|
1610
1610
|
flipY: n,
|
|
1611
1611
|
arrowLength: this.arrowLength,
|
|
1612
1612
|
arrowOffset: this.arrowOffset,
|
|
@@ -1615,11 +1615,11 @@ class ft {
|
|
|
1615
1615
|
hasSourceArrow: this.hasSourceArrow,
|
|
1616
1616
|
hasTargetArrow: this.hasTargetArrow
|
|
1617
1617
|
}));
|
|
1618
|
-
|
|
1618
|
+
i(this, "createLinePath", (e, t, s, o) => new it({
|
|
1619
1619
|
to: s,
|
|
1620
1620
|
sourceDirection: e,
|
|
1621
1621
|
targetDirection: t,
|
|
1622
|
-
flipX:
|
|
1622
|
+
flipX: o,
|
|
1623
1623
|
arrowLength: this.arrowLength,
|
|
1624
1624
|
arrowOffset: this.arrowOffset,
|
|
1625
1625
|
roundness: this.roundness,
|
|
@@ -1632,7 +1632,7 @@ class ft {
|
|
|
1632
1632
|
t,
|
|
1633
1633
|
this.arrowOffset,
|
|
1634
1634
|
this.cycleSquareSide / 2
|
|
1635
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new
|
|
1635
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new H({
|
|
1636
1636
|
color: (e == null ? void 0 : e.color) ?? y.color,
|
|
1637
1637
|
width: (e == null ? void 0 : e.width) ?? y.width,
|
|
1638
1638
|
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
@@ -1648,24 +1648,24 @@ class ft {
|
|
|
1648
1648
|
this.pathShape.render(e);
|
|
1649
1649
|
}
|
|
1650
1650
|
}
|
|
1651
|
-
class
|
|
1651
|
+
class mt {
|
|
1652
1652
|
constructor(e) {
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1653
|
+
i(this, "svg");
|
|
1654
|
+
i(this, "group");
|
|
1655
|
+
i(this, "line");
|
|
1656
|
+
i(this, "sourceArrow");
|
|
1657
|
+
i(this, "targetArrow");
|
|
1658
|
+
i(this, "onAfterRender");
|
|
1659
|
+
i(this, "arrowLength");
|
|
1660
|
+
i(this, "arrowOffset");
|
|
1661
|
+
i(this, "roundness");
|
|
1662
|
+
i(this, "cycleSquareSide");
|
|
1663
|
+
i(this, "detourDirection");
|
|
1664
|
+
i(this, "detourDistance");
|
|
1665
|
+
i(this, "hasSourceArrow");
|
|
1666
|
+
i(this, "hasTargetArrow");
|
|
1667
|
+
i(this, "pathShape");
|
|
1668
|
+
i(this, "createCyclePath", (e) => new _({
|
|
1669
1669
|
sourceDirection: e,
|
|
1670
1670
|
arrowLength: this.arrowLength,
|
|
1671
1671
|
side: this.cycleSquareSide,
|
|
@@ -1674,11 +1674,11 @@ class yt {
|
|
|
1674
1674
|
hasSourceArrow: this.hasSourceArrow,
|
|
1675
1675
|
hasTargetArrow: this.hasTargetArrow
|
|
1676
1676
|
}));
|
|
1677
|
-
|
|
1677
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new nt({
|
|
1678
1678
|
to: s,
|
|
1679
1679
|
sourceDirection: e,
|
|
1680
1680
|
targetDirection: t,
|
|
1681
|
-
flipX:
|
|
1681
|
+
flipX: o,
|
|
1682
1682
|
flipY: n,
|
|
1683
1683
|
arrowLength: this.arrowLength,
|
|
1684
1684
|
arrowOffset: this.arrowOffset,
|
|
@@ -1688,7 +1688,7 @@ class yt {
|
|
|
1688
1688
|
hasSourceArrow: this.hasSourceArrow,
|
|
1689
1689
|
hasTargetArrow: this.hasTargetArrow
|
|
1690
1690
|
}));
|
|
1691
|
-
|
|
1691
|
+
i(this, "createLinePath", (e, t, s) => new at({
|
|
1692
1692
|
to: s,
|
|
1693
1693
|
sourceDirection: e,
|
|
1694
1694
|
targetDirection: t,
|
|
@@ -1704,7 +1704,7 @@ class yt {
|
|
|
1704
1704
|
t,
|
|
1705
1705
|
this.arrowOffset,
|
|
1706
1706
|
this.cycleSquareSide / 2
|
|
1707
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? y.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new
|
|
1707
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? y.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new H({
|
|
1708
1708
|
color: (e == null ? void 0 : e.color) ?? y.color,
|
|
1709
1709
|
width: (e == null ? void 0 : e.width) ?? y.width,
|
|
1710
1710
|
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
@@ -1720,23 +1720,23 @@ class yt {
|
|
|
1720
1720
|
this.pathShape.render(e);
|
|
1721
1721
|
}
|
|
1722
1722
|
}
|
|
1723
|
-
class
|
|
1723
|
+
class vt {
|
|
1724
1724
|
constructor(e) {
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1725
|
+
i(this, "svg");
|
|
1726
|
+
i(this, "group");
|
|
1727
|
+
i(this, "line");
|
|
1728
|
+
i(this, "sourceArrow");
|
|
1729
|
+
i(this, "targetArrow");
|
|
1730
|
+
i(this, "onAfterRender");
|
|
1731
|
+
i(this, "arrowLength");
|
|
1732
|
+
i(this, "arrowOffset");
|
|
1733
|
+
i(this, "roundness");
|
|
1734
|
+
i(this, "cycleSquareSide");
|
|
1735
|
+
i(this, "detourDistance");
|
|
1736
|
+
i(this, "hasSourceArrow");
|
|
1737
|
+
i(this, "hasTargetArrow");
|
|
1738
|
+
i(this, "pathShape");
|
|
1739
|
+
i(this, "createCyclePath", (e) => new _({
|
|
1740
1740
|
sourceDirection: e,
|
|
1741
1741
|
arrowLength: this.arrowLength,
|
|
1742
1742
|
side: this.cycleSquareSide,
|
|
@@ -1745,11 +1745,11 @@ class mt {
|
|
|
1745
1745
|
hasSourceArrow: this.hasSourceArrow,
|
|
1746
1746
|
hasTargetArrow: this.hasTargetArrow
|
|
1747
1747
|
}));
|
|
1748
|
-
|
|
1748
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new gt({
|
|
1749
1749
|
to: s,
|
|
1750
1750
|
sourceDirection: e,
|
|
1751
1751
|
targetDirection: t,
|
|
1752
|
-
flipX:
|
|
1752
|
+
flipX: o,
|
|
1753
1753
|
flipY: n,
|
|
1754
1754
|
arrowLength: this.arrowLength,
|
|
1755
1755
|
arrowOffset: this.arrowOffset,
|
|
@@ -1758,7 +1758,7 @@ class mt {
|
|
|
1758
1758
|
hasSourceArrow: this.hasSourceArrow,
|
|
1759
1759
|
hasTargetArrow: this.hasTargetArrow
|
|
1760
1760
|
}));
|
|
1761
|
-
|
|
1761
|
+
i(this, "createLinePath", (e, t, s, o, n) => new ht({
|
|
1762
1762
|
to: s,
|
|
1763
1763
|
sourceDirection: e,
|
|
1764
1764
|
targetDirection: t,
|
|
@@ -1775,7 +1775,7 @@ class mt {
|
|
|
1775
1775
|
t,
|
|
1776
1776
|
this.arrowOffset,
|
|
1777
1777
|
this.cycleSquareSide / 2
|
|
1778
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new
|
|
1778
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? y.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? y.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? y.hasTargetArrow, this.pathShape = new H({
|
|
1779
1779
|
color: (e == null ? void 0 : e.color) ?? y.color,
|
|
1780
1780
|
width: (e == null ? void 0 : e.width) ?? y.width,
|
|
1781
1781
|
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
@@ -1791,30 +1791,30 @@ class mt {
|
|
|
1791
1791
|
this.pathShape.render(e);
|
|
1792
1792
|
}
|
|
1793
1793
|
}
|
|
1794
|
-
class
|
|
1794
|
+
class Le {
|
|
1795
1795
|
constructor(e) {
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
[this.afterRenderEmitter, this.onAfterRender] =
|
|
1796
|
+
i(this, "svg");
|
|
1797
|
+
i(this, "group", De());
|
|
1798
|
+
i(this, "line");
|
|
1799
|
+
i(this, "sourceArrow", null);
|
|
1800
|
+
i(this, "targetArrow", null);
|
|
1801
|
+
i(this, "color");
|
|
1802
|
+
i(this, "width");
|
|
1803
|
+
i(this, "arrowLength");
|
|
1804
|
+
i(this, "sourceOffset");
|
|
1805
|
+
i(this, "targetOffset");
|
|
1806
|
+
i(this, "onAfterRender");
|
|
1807
|
+
i(this, "afterRenderEmitter");
|
|
1808
|
+
i(this, "arrowRenderer");
|
|
1809
|
+
[this.afterRenderEmitter, this.onAfterRender] = E(), this.color = (e == null ? void 0 : e.color) ?? y.color, this.width = (e == null ? void 0 : e.width) ?? y.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? y.arrowLength, this.arrowRenderer = I((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? y.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? y.preOffset, this.svg = Ce(this.color), this.svg.appendChild(this.group), this.line = Me(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = W(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = W(), this.group.appendChild(this.targetArrow));
|
|
1810
1810
|
}
|
|
1811
1811
|
render(e) {
|
|
1812
|
-
const { x: t, y: s, width:
|
|
1812
|
+
const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = Te(
|
|
1813
1813
|
e.from,
|
|
1814
1814
|
e.to
|
|
1815
1815
|
);
|
|
1816
|
-
|
|
1817
|
-
const d = { x:
|
|
1816
|
+
Re(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1817
|
+
const d = { x: o, y: n }, c = new ct({
|
|
1818
1818
|
to: d,
|
|
1819
1819
|
sourceOffset: this.sourceOffset,
|
|
1820
1820
|
targetOffset: this.targetOffset,
|
|
@@ -1828,28 +1828,28 @@ class Re {
|
|
|
1828
1828
|
if (u === 0)
|
|
1829
1829
|
this.sourceArrow !== null && (g = "", this.sourceArrow.setAttribute("d", g)), this.targetArrow !== null && (l = "", this.targetArrow.setAttribute("d", l));
|
|
1830
1830
|
else {
|
|
1831
|
-
const
|
|
1831
|
+
const w = {
|
|
1832
1832
|
x: d.x / u,
|
|
1833
1833
|
y: d.y / u
|
|
1834
1834
|
};
|
|
1835
1835
|
if (this.sourceArrow) {
|
|
1836
1836
|
const f = {
|
|
1837
|
-
x:
|
|
1838
|
-
y:
|
|
1837
|
+
x: w.x * this.sourceOffset,
|
|
1838
|
+
y: w.y * this.sourceOffset
|
|
1839
1839
|
};
|
|
1840
1840
|
g = this.arrowRenderer({
|
|
1841
|
-
direction:
|
|
1841
|
+
direction: w,
|
|
1842
1842
|
shift: f,
|
|
1843
1843
|
arrowLength: this.arrowLength
|
|
1844
1844
|
}), this.sourceArrow.setAttribute("d", g);
|
|
1845
1845
|
}
|
|
1846
1846
|
if (this.targetArrow) {
|
|
1847
1847
|
const f = {
|
|
1848
|
-
x:
|
|
1849
|
-
y:
|
|
1848
|
+
x: w.x * this.targetOffset,
|
|
1849
|
+
y: w.y * this.targetOffset
|
|
1850
1850
|
};
|
|
1851
1851
|
l = this.arrowRenderer({
|
|
1852
|
-
direction: { x: -
|
|
1852
|
+
direction: { x: -w.x, y: -w.y },
|
|
1853
1853
|
shift: {
|
|
1854
1854
|
x: d.x - f.x,
|
|
1855
1855
|
y: d.y - f.y
|
|
@@ -1865,13 +1865,13 @@ class Re {
|
|
|
1865
1865
|
});
|
|
1866
1866
|
}
|
|
1867
1867
|
}
|
|
1868
|
-
const
|
|
1868
|
+
const At = () => {
|
|
1869
1869
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1870
1870
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
1871
|
-
},
|
|
1871
|
+
}, xt = (r) => {
|
|
1872
1872
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1873
1873
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
1874
|
-
},
|
|
1874
|
+
}, fe = (r) => {
|
|
1875
1875
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1876
1876
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
1877
1877
|
};
|
|
@@ -1880,42 +1880,42 @@ class Et extends Error {
|
|
|
1880
1880
|
super(e), this.name = "InteractiveEdgeError";
|
|
1881
1881
|
}
|
|
1882
1882
|
}
|
|
1883
|
-
class
|
|
1883
|
+
class Ve {
|
|
1884
1884
|
constructor(e, t) {
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
if (this.baseEdge = e, e instanceof
|
|
1885
|
+
i(this, "svg");
|
|
1886
|
+
i(this, "group");
|
|
1887
|
+
i(this, "line");
|
|
1888
|
+
i(this, "sourceArrow");
|
|
1889
|
+
i(this, "targetArrow");
|
|
1890
|
+
i(this, "handle", At());
|
|
1891
|
+
i(this, "onAfterRender");
|
|
1892
|
+
i(this, "interactiveLine");
|
|
1893
|
+
i(this, "interactiveSourceArrow", null);
|
|
1894
|
+
i(this, "interactiveTargetArrow", null);
|
|
1895
|
+
if (this.baseEdge = e, e instanceof Ve)
|
|
1896
1896
|
throw new Et(
|
|
1897
1897
|
"interactive edge can be configured only once"
|
|
1898
1898
|
);
|
|
1899
1899
|
this.svg = this.baseEdge.svg, this.group = this.baseEdge.group, this.line = this.baseEdge.line, this.sourceArrow = this.baseEdge.sourceArrow, this.targetArrow = this.baseEdge.targetArrow, this.onAfterRender = this.baseEdge.onAfterRender;
|
|
1900
1900
|
const s = (t == null ? void 0 : t.distance) ?? y.interactiveWidth;
|
|
1901
|
-
this.interactiveLine =
|
|
1902
|
-
this.interactiveLine.setAttribute("d",
|
|
1901
|
+
this.interactiveLine = xt(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = fe(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = fe(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((o) => {
|
|
1902
|
+
this.interactiveLine.setAttribute("d", o.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", o.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", o.targetArrowPath);
|
|
1903
1903
|
});
|
|
1904
1904
|
}
|
|
1905
1905
|
render(e) {
|
|
1906
1906
|
this.baseEdge.render(e);
|
|
1907
1907
|
}
|
|
1908
1908
|
}
|
|
1909
|
-
class
|
|
1909
|
+
class yr {
|
|
1910
1910
|
constructor(e, t) {
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1911
|
+
i(this, "group");
|
|
1912
|
+
i(this, "line");
|
|
1913
|
+
i(this, "sourceArrow");
|
|
1914
|
+
i(this, "targetArrow");
|
|
1915
|
+
i(this, "onAfterRender");
|
|
1916
|
+
i(this, "svg");
|
|
1917
1917
|
this.baseShape = e, this.midpointElement = t, this.svg = this.baseShape.svg, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.svg.append(this.midpointElement), this.baseShape.onAfterRender.subscribe((s) => {
|
|
1918
|
-
const
|
|
1918
|
+
const o = s.edgePath.midpoint, n = `translate(${o.x}px, ${o.y}px)`;
|
|
1919
1919
|
this.midpointElement.style.setProperty("transform", n);
|
|
1920
1920
|
});
|
|
1921
1921
|
}
|
|
@@ -1923,21 +1923,21 @@ class ur {
|
|
|
1923
1923
|
this.baseShape.render(e);
|
|
1924
1924
|
}
|
|
1925
1925
|
}
|
|
1926
|
-
class
|
|
1926
|
+
class Fe {
|
|
1927
1927
|
constructor(e) {
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1928
|
+
i(this, "onAfterNodeAdded");
|
|
1929
|
+
i(this, "onAfterNodeUpdated");
|
|
1930
|
+
i(this, "onAfterNodePriorityUpdated");
|
|
1931
|
+
i(this, "onBeforeNodeRemoved");
|
|
1932
|
+
i(this, "onAfterPortMarked");
|
|
1933
|
+
i(this, "onAfterPortUpdated");
|
|
1934
|
+
i(this, "onBeforePortUnmarked");
|
|
1935
|
+
i(this, "onAfterEdgeAdded");
|
|
1936
|
+
i(this, "onAfterEdgeShapeUpdated");
|
|
1937
|
+
i(this, "onAfterEdgeUpdated");
|
|
1938
|
+
i(this, "onAfterEdgePriorityUpdated");
|
|
1939
|
+
i(this, "onBeforeEdgeRemoved");
|
|
1940
|
+
i(this, "onBeforeClear");
|
|
1941
1941
|
this.graphStore = e, this.onAfterNodeAdded = this.graphStore.onAfterNodeAdded, this.onAfterNodeUpdated = this.graphStore.onAfterNodeUpdated, this.onAfterNodePriorityUpdated = this.graphStore.onAfterNodePriorityUpdated, this.onBeforeNodeRemoved = this.graphStore.onBeforeNodeRemoved, this.onAfterPortMarked = this.graphStore.onAfterPortAdded, this.onAfterPortUpdated = this.graphStore.onAfterPortUpdated, this.onBeforePortUnmarked = this.graphStore.onBeforePortRemoved, this.onAfterEdgeAdded = this.graphStore.onAfterEdgeAdded, this.onAfterEdgeShapeUpdated = this.graphStore.onAfterEdgeShapeUpdated, this.onAfterEdgeUpdated = this.graphStore.onAfterEdgeUpdated, this.onAfterEdgePriorityUpdated = this.graphStore.onAfterEdgePriorityUpdated, this.onBeforeEdgeRemoved = this.graphStore.onBeforeEdgeRemoved, this.onBeforeClear = this.graphStore.onBeforeClear;
|
|
1942
1942
|
}
|
|
1943
1943
|
hasNode(e) {
|
|
@@ -2019,11 +2019,11 @@ class Ve {
|
|
|
2019
2019
|
return this.graphStore.getNodeAdjacentEdgeIds(e);
|
|
2020
2020
|
}
|
|
2021
2021
|
}
|
|
2022
|
-
class
|
|
2022
|
+
class Ie {
|
|
2023
2023
|
constructor(e) {
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2024
|
+
i(this, "onBeforeUpdated");
|
|
2025
|
+
i(this, "onAfterUpdated");
|
|
2026
|
+
i(this, "onAfterResize");
|
|
2027
2027
|
this.viewportStore = e, this.onBeforeUpdated = this.viewportStore.onBeforeUpdated, this.onAfterUpdated = this.viewportStore.onAfterUpdated, this.onAfterResize = this.viewportStore.onAfterResize;
|
|
2028
2028
|
}
|
|
2029
2029
|
getViewportMatrix() {
|
|
@@ -2042,14 +2042,14 @@ class Fe {
|
|
|
2042
2042
|
return this.viewportStore.createViewportCoords(e);
|
|
2043
2043
|
}
|
|
2044
2044
|
}
|
|
2045
|
-
const
|
|
2046
|
-
const t = new
|
|
2045
|
+
const Be = (r, e) => {
|
|
2046
|
+
const t = new Se(), s = new Fe(t), o = new Ie(e), n = new xe(t, e, r), a = {
|
|
2047
2047
|
nodes: {
|
|
2048
|
-
centerFn:
|
|
2048
|
+
centerFn: Ne,
|
|
2049
2049
|
priorityFn: () => 0
|
|
2050
2050
|
},
|
|
2051
2051
|
edges: {
|
|
2052
|
-
shapeFactory: () => new
|
|
2052
|
+
shapeFactory: () => new Le(),
|
|
2053
2053
|
priorityFn: () => 0
|
|
2054
2054
|
},
|
|
2055
2055
|
ports: {
|
|
@@ -2058,29 +2058,29 @@ const Ie = (r, e) => {
|
|
|
2058
2058
|
};
|
|
2059
2059
|
return new Ee(
|
|
2060
2060
|
s,
|
|
2061
|
-
|
|
2061
|
+
o,
|
|
2062
2062
|
t,
|
|
2063
2063
|
e,
|
|
2064
2064
|
n,
|
|
2065
2065
|
a
|
|
2066
2066
|
);
|
|
2067
2067
|
};
|
|
2068
|
-
class
|
|
2069
|
-
constructor(e, t, s,
|
|
2070
|
-
|
|
2068
|
+
class Y {
|
|
2069
|
+
constructor(e, t, s, o) {
|
|
2070
|
+
i(this, "onAfterPortMarked", (e) => {
|
|
2071
2071
|
const t = this.canvas.graph.getPort(e);
|
|
2072
2072
|
this.canvas.graph.findPortIdsByElement(t.element).length === 1 && this.hookPortEvents(t.element);
|
|
2073
2073
|
});
|
|
2074
|
-
|
|
2074
|
+
i(this, "onBeforePortUnmarked", (e) => {
|
|
2075
2075
|
const t = this.canvas.graph.getPort(e);
|
|
2076
2076
|
this.canvas.graph.findPortIdsByElement(t.element).length === 1 && this.unhookPortEvents(t.element);
|
|
2077
2077
|
});
|
|
2078
|
-
|
|
2078
|
+
i(this, "onPortMouseDown", (e) => {
|
|
2079
2079
|
const t = e;
|
|
2080
2080
|
if (!this.params.mouseDownEventVerifier(t))
|
|
2081
2081
|
return;
|
|
2082
|
-
const s = e.currentTarget,
|
|
2083
|
-
this.params.onPortPointerDown(
|
|
2082
|
+
const s = e.currentTarget, o = this.canvas.graph.findPortIdsByElement(s)[0];
|
|
2083
|
+
this.params.onPortPointerDown(o, {
|
|
2084
2084
|
x: t.clientX,
|
|
2085
2085
|
y: t.clientY
|
|
2086
2086
|
}) && (e.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
@@ -2089,7 +2089,7 @@ class H {
|
|
|
2089
2089
|
passive: !0
|
|
2090
2090
|
}));
|
|
2091
2091
|
});
|
|
2092
|
-
|
|
2092
|
+
i(this, "onWindowMouseMove", (e) => {
|
|
2093
2093
|
if (!R(
|
|
2094
2094
|
this.window,
|
|
2095
2095
|
this.element,
|
|
@@ -2101,14 +2101,14 @@ class H {
|
|
|
2101
2101
|
}
|
|
2102
2102
|
this.params.onPointerMove({ x: e.clientX, y: e.clientY });
|
|
2103
2103
|
});
|
|
2104
|
-
|
|
2104
|
+
i(this, "onWindowMouseUp", (e) => {
|
|
2105
2105
|
this.params.mouseUpEventVerifier(e) && (this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
|
|
2106
2106
|
});
|
|
2107
|
-
|
|
2107
|
+
i(this, "onPortTouchStart", (e) => {
|
|
2108
2108
|
const t = e;
|
|
2109
2109
|
if (t.touches.length !== 1)
|
|
2110
2110
|
return;
|
|
2111
|
-
const s = t.touches[0],
|
|
2111
|
+
const s = t.touches[0], o = e.currentTarget, n = this.canvas.graph.findPortIdsByElement(o)[0];
|
|
2112
2112
|
this.params.onPortPointerDown(n, {
|
|
2113
2113
|
x: s.clientX,
|
|
2114
2114
|
y: s.clientY
|
|
@@ -2120,7 +2120,7 @@ class H {
|
|
|
2120
2120
|
passive: !0
|
|
2121
2121
|
}));
|
|
2122
2122
|
});
|
|
2123
|
-
|
|
2123
|
+
i(this, "onWindowTouchMove", (e) => {
|
|
2124
2124
|
const t = e.touches[0];
|
|
2125
2125
|
if (!R(
|
|
2126
2126
|
this.window,
|
|
@@ -2133,23 +2133,23 @@ class H {
|
|
|
2133
2133
|
}
|
|
2134
2134
|
this.params.onPointerMove({ x: t.clientX, y: t.clientY });
|
|
2135
2135
|
});
|
|
2136
|
-
|
|
2136
|
+
i(this, "onWindowTouchFinish", (e) => {
|
|
2137
2137
|
const t = e.changedTouches[0];
|
|
2138
2138
|
this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
|
|
2139
2139
|
});
|
|
2140
|
-
|
|
2140
|
+
i(this, "onBeforeClear", () => {
|
|
2141
2141
|
this.canvas.graph.getAllPortIds().forEach((e) => {
|
|
2142
2142
|
const t = this.canvas.graph.getPort(e);
|
|
2143
2143
|
this.unhookPortEvents(t.element);
|
|
2144
2144
|
});
|
|
2145
2145
|
});
|
|
2146
|
-
|
|
2146
|
+
i(this, "onBeforeDestroy", () => {
|
|
2147
2147
|
this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
2148
2148
|
});
|
|
2149
|
-
this.canvas = e, this.element = t, this.window = s, this.params =
|
|
2149
|
+
this.canvas = e, this.element = t, this.window = s, this.params = o, this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2150
2150
|
}
|
|
2151
|
-
static configure(e, t, s,
|
|
2152
|
-
new
|
|
2151
|
+
static configure(e, t, s, o) {
|
|
2152
|
+
new Y(e, t, s, o);
|
|
2153
2153
|
}
|
|
2154
2154
|
hookPortEvents(e) {
|
|
2155
2155
|
e.addEventListener("mousedown", this.onPortMouseDown, {
|
|
@@ -2174,7 +2174,7 @@ class H {
|
|
|
2174
2174
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2175
2175
|
}
|
|
2176
2176
|
}
|
|
2177
|
-
class
|
|
2177
|
+
class St {
|
|
2178
2178
|
constructor(e, t, s) {
|
|
2179
2179
|
this.canvas = e, this.layoutAlgorithm = t, this.params = s;
|
|
2180
2180
|
}
|
|
@@ -2188,7 +2188,7 @@ class xt {
|
|
|
2188
2188
|
}), this.params.onAfterApplied();
|
|
2189
2189
|
}
|
|
2190
2190
|
}
|
|
2191
|
-
class
|
|
2191
|
+
class bt {
|
|
2192
2192
|
constructor(e, t, s) {
|
|
2193
2193
|
this.canvas = e, this.layoutAlgorithm = t, this.params = s;
|
|
2194
2194
|
}
|
|
@@ -2198,17 +2198,17 @@ class St {
|
|
|
2198
2198
|
viewport: this.canvas.viewport,
|
|
2199
2199
|
dt: e
|
|
2200
2200
|
});
|
|
2201
|
-
this.params.onBeforeApplied(), t.forEach((s,
|
|
2202
|
-
this.params.staticNodeResolver(
|
|
2201
|
+
this.params.onBeforeApplied(), t.forEach((s, o) => {
|
|
2202
|
+
this.params.staticNodeResolver(o) || this.canvas.updateNode(o, s);
|
|
2203
2203
|
}), this.params.onAfterApplied();
|
|
2204
2204
|
}
|
|
2205
2205
|
}
|
|
2206
|
-
class
|
|
2207
|
-
constructor(e, t, s,
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2206
|
+
class ee {
|
|
2207
|
+
constructor(e, t, s, o) {
|
|
2208
|
+
i(this, "grabbedNode", null);
|
|
2209
|
+
i(this, "maxNodePriority", 0);
|
|
2210
|
+
i(this, "graph");
|
|
2211
|
+
i(this, "onAfterNodeAdded", (e) => {
|
|
2212
2212
|
this.updateMaxNodePriority(e);
|
|
2213
2213
|
const { element: t } = this.graph.getNode(e);
|
|
2214
2214
|
t.addEventListener("mousedown", this.onMouseDown, {
|
|
@@ -2217,50 +2217,50 @@ class _ {
|
|
|
2217
2217
|
passive: !0
|
|
2218
2218
|
});
|
|
2219
2219
|
});
|
|
2220
|
-
|
|
2220
|
+
i(this, "onAfterNodeUpdated", (e) => {
|
|
2221
2221
|
this.updateMaxNodePriority(e);
|
|
2222
2222
|
});
|
|
2223
|
-
|
|
2223
|
+
i(this, "onBeforeNodeRemoved", (e) => {
|
|
2224
2224
|
const { element: t } = this.graph.getNode(e);
|
|
2225
2225
|
t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
|
|
2226
2226
|
});
|
|
2227
|
-
|
|
2227
|
+
i(this, "onBeforeDestroy", () => {
|
|
2228
2228
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2229
2229
|
});
|
|
2230
|
-
|
|
2230
|
+
i(this, "onBeforeClear", () => {
|
|
2231
2231
|
this.canvas.graph.getAllNodeIds().forEach((e) => {
|
|
2232
2232
|
const { element: t } = this.canvas.graph.getNode(e);
|
|
2233
2233
|
t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
|
|
2234
2234
|
}), this.maxNodePriority = 0;
|
|
2235
2235
|
});
|
|
2236
|
-
|
|
2236
|
+
i(this, "onMouseDown", (e) => {
|
|
2237
2237
|
const t = e;
|
|
2238
2238
|
if (!this.params.mouseDownEventVerifier(t))
|
|
2239
2239
|
return;
|
|
2240
|
-
const s = e.currentTarget,
|
|
2241
|
-
if (!this.params.nodeDragVerifier(
|
|
2240
|
+
const s = e.currentTarget, o = this.graph.findNodeIdByElement(s), n = this.graph.getNode(o);
|
|
2241
|
+
if (!this.params.nodeDragVerifier(o))
|
|
2242
2242
|
return;
|
|
2243
|
-
this.params.onNodeDragStarted(
|
|
2243
|
+
this.params.onNodeDragStarted(o), e.stopPropagation();
|
|
2244
2244
|
const h = this.calculateContentPoint({
|
|
2245
2245
|
x: t.clientX,
|
|
2246
2246
|
y: t.clientY
|
|
2247
2247
|
});
|
|
2248
2248
|
this.grabbedNode = {
|
|
2249
|
-
nodeId:
|
|
2249
|
+
nodeId: o,
|
|
2250
2250
|
dx: h.x - n.x,
|
|
2251
2251
|
dy: h.y - n.y
|
|
2252
|
-
},
|
|
2252
|
+
}, U(this.element, this.params.dragCursor), this.moveNodeOnTop(o), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2253
2253
|
passive: !0
|
|
2254
2254
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2255
2255
|
passive: !0
|
|
2256
2256
|
});
|
|
2257
2257
|
});
|
|
2258
|
-
|
|
2258
|
+
i(this, "onTouchStart", (e) => {
|
|
2259
2259
|
const t = e;
|
|
2260
2260
|
if (t.touches.length !== 1)
|
|
2261
2261
|
return;
|
|
2262
2262
|
e.stopPropagation();
|
|
2263
|
-
const s = t.touches[0],
|
|
2263
|
+
const s = t.touches[0], o = e.currentTarget, n = this.canvas.graph.findNodeIdByElement(o), a = this.graph.getNode(n);
|
|
2264
2264
|
if (!this.params.nodeDragVerifier({
|
|
2265
2265
|
nodeId: n,
|
|
2266
2266
|
element: a.element,
|
|
@@ -2284,7 +2284,7 @@ class _ {
|
|
|
2284
2284
|
passive: !0
|
|
2285
2285
|
});
|
|
2286
2286
|
});
|
|
2287
|
-
|
|
2287
|
+
i(this, "onWindowMouseMove", (e) => {
|
|
2288
2288
|
if (!R(
|
|
2289
2289
|
this.window,
|
|
2290
2290
|
this.element,
|
|
@@ -2299,10 +2299,10 @@ class _ {
|
|
|
2299
2299
|
y: e.clientY
|
|
2300
2300
|
});
|
|
2301
2301
|
});
|
|
2302
|
-
|
|
2302
|
+
i(this, "onWindowMouseUp", (e) => {
|
|
2303
2303
|
this.params.mouseUpEventVerifier(e) && this.cancelMouseDrag();
|
|
2304
2304
|
});
|
|
2305
|
-
|
|
2305
|
+
i(this, "onWindowTouchMove", (e) => {
|
|
2306
2306
|
if (e.touches.length !== 1)
|
|
2307
2307
|
return;
|
|
2308
2308
|
const t = e.touches[0];
|
|
@@ -2320,21 +2320,21 @@ class _ {
|
|
|
2320
2320
|
y: t.clientY
|
|
2321
2321
|
});
|
|
2322
2322
|
});
|
|
2323
|
-
|
|
2323
|
+
i(this, "onWindowTouchFinish", () => {
|
|
2324
2324
|
this.cancelTouchDrag();
|
|
2325
2325
|
});
|
|
2326
|
-
this.canvas = e, this.element = t, this.window = s, this.params =
|
|
2326
|
+
this.canvas = e, this.element = t, this.window = s, this.params = o, this.graph = e.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2327
2327
|
}
|
|
2328
|
-
static configure(e, t, s,
|
|
2329
|
-
new
|
|
2328
|
+
static configure(e, t, s, o) {
|
|
2329
|
+
new ee(e, t, s, o);
|
|
2330
2330
|
}
|
|
2331
2331
|
moveNode(e, t) {
|
|
2332
2332
|
if (!this.graph.hasNode(e.nodeId))
|
|
2333
2333
|
return;
|
|
2334
|
-
const s = this.calculateContentPoint(t),
|
|
2334
|
+
const s = this.calculateContentPoint(t), o = {
|
|
2335
2335
|
x: s.x - e.dx,
|
|
2336
2336
|
y: s.y - e.dy
|
|
2337
|
-
}, n = this.adjustNodeCoords(
|
|
2337
|
+
}, n = this.adjustNodeCoords(o);
|
|
2338
2338
|
this.canvas.updateNode(e.nodeId, {
|
|
2339
2339
|
x: n.x,
|
|
2340
2340
|
y: n.y
|
|
@@ -2344,15 +2344,15 @@ class _ {
|
|
|
2344
2344
|
if (this.params.moveOnTop) {
|
|
2345
2345
|
if (this.maxNodePriority++, this.params.moveEdgesOnTop) {
|
|
2346
2346
|
const t = this.maxNodePriority;
|
|
2347
|
-
this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((
|
|
2348
|
-
this.canvas.updateEdge(
|
|
2347
|
+
this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((o) => {
|
|
2348
|
+
this.canvas.updateEdge(o, { priority: t });
|
|
2349
2349
|
});
|
|
2350
2350
|
}
|
|
2351
2351
|
this.canvas.updateNode(e, { priority: this.maxNodePriority });
|
|
2352
2352
|
}
|
|
2353
2353
|
}
|
|
2354
2354
|
cancelMouseDrag() {
|
|
2355
|
-
this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null,
|
|
2355
|
+
this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, U(this.element, null), this.removeMouseDragListeners();
|
|
2356
2356
|
}
|
|
2357
2357
|
removeMouseDragListeners() {
|
|
2358
2358
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
@@ -2395,11 +2395,11 @@ class _ {
|
|
|
2395
2395
|
return e;
|
|
2396
2396
|
}
|
|
2397
2397
|
}
|
|
2398
|
-
const
|
|
2398
|
+
const Pt = (r, e, t) => ({
|
|
2399
2399
|
scale: r.scale,
|
|
2400
2400
|
x: r.x + r.scale * e,
|
|
2401
2401
|
y: r.y + r.scale * t
|
|
2402
|
-
}),
|
|
2402
|
+
}), Nt = (r, e, t, s) => ({
|
|
2403
2403
|
scale: r.scale * e,
|
|
2404
2404
|
x: r.scale * (1 - e) * t + r.x,
|
|
2405
2405
|
y: r.scale * (1 - e) * s + r.y
|
|
@@ -2410,35 +2410,35 @@ const bt = (r, e, t) => ({
|
|
|
2410
2410
|
const s = e.reduce(
|
|
2411
2411
|
(h, d) => [h[0] + d[0], h[1] + d[1]],
|
|
2412
2412
|
[0, 0]
|
|
2413
|
-
),
|
|
2413
|
+
), o = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - o[0], h[1] - o[1]]).reduce(
|
|
2414
2414
|
(h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
|
|
2415
2415
|
0
|
|
2416
2416
|
);
|
|
2417
2417
|
return {
|
|
2418
|
-
x:
|
|
2419
|
-
y:
|
|
2418
|
+
x: o[0],
|
|
2419
|
+
y: o[1],
|
|
2420
2420
|
scale: a / t,
|
|
2421
2421
|
touchesCnt: t,
|
|
2422
2422
|
touches: e
|
|
2423
2423
|
};
|
|
2424
2424
|
};
|
|
2425
2425
|
class X {
|
|
2426
|
-
constructor(e, t, s,
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2426
|
+
constructor(e, t, s, o) {
|
|
2427
|
+
i(this, "viewport");
|
|
2428
|
+
i(this, "prevTouches", null);
|
|
2429
|
+
i(this, "wheelFinishTimer", null);
|
|
2430
|
+
i(this, "transformInProgress", !1);
|
|
2431
|
+
i(this, "onBeforeDestroy", () => {
|
|
2432
2432
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2433
2433
|
});
|
|
2434
|
-
|
|
2435
|
-
this.params.mouseDownEventVerifier(e) && (
|
|
2434
|
+
i(this, "onMouseDown", (e) => {
|
|
2435
|
+
this.params.mouseDownEventVerifier(e) && (U(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2436
2436
|
passive: !0
|
|
2437
2437
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2438
2438
|
passive: !0
|
|
2439
2439
|
}), this.startRegisteredTransform());
|
|
2440
2440
|
});
|
|
2441
|
-
|
|
2441
|
+
i(this, "onWindowMouseMove", (e) => {
|
|
2442
2442
|
const t = R(
|
|
2443
2443
|
this.window,
|
|
2444
2444
|
this.element,
|
|
@@ -2449,21 +2449,21 @@ class X {
|
|
|
2449
2449
|
this.stopMouseDrag();
|
|
2450
2450
|
return;
|
|
2451
2451
|
}
|
|
2452
|
-
const s = -e.movementX,
|
|
2453
|
-
this.moveViewport(s,
|
|
2452
|
+
const s = -e.movementX, o = -e.movementY;
|
|
2453
|
+
this.moveViewport(s, o);
|
|
2454
2454
|
});
|
|
2455
|
-
|
|
2455
|
+
i(this, "onWindowMouseUp", (e) => {
|
|
2456
2456
|
this.params.mouseUpEventVerifier(e) && this.stopMouseDrag();
|
|
2457
2457
|
});
|
|
2458
|
-
|
|
2458
|
+
i(this, "onWheelScroll", (e) => {
|
|
2459
2459
|
if (!this.params.mouseWheelEventVerifier(e))
|
|
2460
2460
|
return;
|
|
2461
|
-
const { left: t, top: s } = this.element.getBoundingClientRect(),
|
|
2462
|
-
this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h,
|
|
2461
|
+
const { left: t, top: s } = this.element.getBoundingClientRect(), o = e.clientX - t, n = e.clientY - s, h = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
|
|
2462
|
+
this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, o, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
|
|
2463
2463
|
this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
|
|
2464
2464
|
}, this.params.scaleWheelFinishTimeout);
|
|
2465
2465
|
});
|
|
2466
|
-
|
|
2466
|
+
i(this, "onTouchStart", (e) => {
|
|
2467
2467
|
if (this.prevTouches !== null) {
|
|
2468
2468
|
this.prevTouches = B(e);
|
|
2469
2469
|
return;
|
|
@@ -2476,10 +2476,10 @@ class X {
|
|
|
2476
2476
|
passive: !0
|
|
2477
2477
|
}), this.startRegisteredTransform();
|
|
2478
2478
|
});
|
|
2479
|
-
|
|
2479
|
+
i(this, "onWindowTouchMove", (e) => {
|
|
2480
2480
|
const t = B(e);
|
|
2481
2481
|
if (!t.touches.every(
|
|
2482
|
-
(
|
|
2482
|
+
(o) => R(this.window, this.element, o[0], o[1])
|
|
2483
2483
|
)) {
|
|
2484
2484
|
this.stopTouchDrag();
|
|
2485
2485
|
return;
|
|
@@ -2488,18 +2488,18 @@ class X {
|
|
|
2488
2488
|
-(t.x - this.prevTouches.x),
|
|
2489
2489
|
-(t.y - this.prevTouches.y)
|
|
2490
2490
|
), t.touchesCnt === 2) {
|
|
2491
|
-
const { left:
|
|
2491
|
+
const { left: o, top: n } = this.element.getBoundingClientRect(), a = this.prevTouches.x - o, h = this.prevTouches.y - n, c = 1 / (t.scale / this.prevTouches.scale);
|
|
2492
2492
|
this.scaleViewport(c, a, h);
|
|
2493
2493
|
}
|
|
2494
2494
|
this.prevTouches = t;
|
|
2495
2495
|
});
|
|
2496
|
-
|
|
2496
|
+
i(this, "onWindowTouchFinish", (e) => {
|
|
2497
2497
|
e.touches.length > 0 ? this.prevTouches = B(e) : this.stopTouchDrag();
|
|
2498
2498
|
});
|
|
2499
|
-
|
|
2499
|
+
i(this, "preventWheelScaleListener", (e) => {
|
|
2500
2500
|
e.preventDefault();
|
|
2501
2501
|
});
|
|
2502
|
-
this.canvas = e, this.element = t, this.window = s, this.params =
|
|
2502
|
+
this.canvas = e, this.element = t, this.window = s, this.params = o, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
|
|
2503
2503
|
passive: !1
|
|
2504
2504
|
}), this.viewport = e.viewport, this.handleResize(), this.viewport.onAfterResize.subscribe(() => {
|
|
2505
2505
|
this.handleResize();
|
|
@@ -2511,21 +2511,21 @@ class X {
|
|
|
2511
2511
|
passive: !0
|
|
2512
2512
|
}), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2513
2513
|
}
|
|
2514
|
-
static configure(e, t, s,
|
|
2515
|
-
new X(e, t, s,
|
|
2514
|
+
static configure(e, t, s, o) {
|
|
2515
|
+
new X(e, t, s, o);
|
|
2516
2516
|
}
|
|
2517
2517
|
moveViewport(e, t) {
|
|
2518
|
-
const s = this.viewport.getViewportMatrix(),
|
|
2518
|
+
const s = this.viewport.getViewportMatrix(), o = Pt(s, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
|
|
2519
2519
|
prevTransform: s,
|
|
2520
|
-
nextTransform:
|
|
2520
|
+
nextTransform: o,
|
|
2521
2521
|
canvasWidth: n,
|
|
2522
2522
|
canvasHeight: a
|
|
2523
2523
|
});
|
|
2524
2524
|
this.performTransform(h);
|
|
2525
2525
|
}
|
|
2526
2526
|
scaleViewport(e, t, s) {
|
|
2527
|
-
const
|
|
2528
|
-
prevTransform:
|
|
2527
|
+
const o = this.canvas.viewport.getViewportMatrix(), n = Nt(o, e, t, s), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
|
|
2528
|
+
prevTransform: o,
|
|
2529
2529
|
nextTransform: n,
|
|
2530
2530
|
canvasWidth: a,
|
|
2531
2531
|
canvasHeight: h
|
|
@@ -2533,7 +2533,7 @@ class X {
|
|
|
2533
2533
|
this.performTransform(d);
|
|
2534
2534
|
}
|
|
2535
2535
|
stopMouseDrag() {
|
|
2536
|
-
|
|
2536
|
+
U(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
|
|
2537
2537
|
}
|
|
2538
2538
|
removeMouseDragListeners() {
|
|
2539
2539
|
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
@@ -2554,28 +2554,28 @@ class X {
|
|
|
2554
2554
|
this.transformInProgress = !1, this.params.onTransformFinished();
|
|
2555
2555
|
}
|
|
2556
2556
|
handleResize() {
|
|
2557
|
-
const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.viewport.getDimensions(),
|
|
2557
|
+
const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.viewport.getDimensions(), o = this.params.transformPreprocessor({
|
|
2558
2558
|
prevTransform: e,
|
|
2559
2559
|
nextTransform: e,
|
|
2560
2560
|
canvasWidth: t,
|
|
2561
2561
|
canvasHeight: s
|
|
2562
2562
|
});
|
|
2563
|
-
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(
|
|
2563
|
+
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(o), this.params.onResizeTransformFinished();
|
|
2564
2564
|
}
|
|
2565
2565
|
}
|
|
2566
|
-
class
|
|
2567
|
-
constructor(e, t, s,
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2566
|
+
class te {
|
|
2567
|
+
constructor(e, t, s, o, n, a) {
|
|
2568
|
+
i(this, "nodeHorizontal");
|
|
2569
|
+
i(this, "nodeVertical");
|
|
2570
|
+
i(this, "viewport");
|
|
2571
|
+
i(this, "currentScale");
|
|
2572
|
+
i(this, "loadedArea", {
|
|
2573
2573
|
xFrom: 1 / 0,
|
|
2574
2574
|
xTo: 1 / 0,
|
|
2575
2575
|
yFrom: 1 / 0,
|
|
2576
2576
|
yTo: 1 / 0
|
|
2577
2577
|
});
|
|
2578
|
-
|
|
2578
|
+
i(this, "updateLoadedArea", (e) => {
|
|
2579
2579
|
this.loadedArea = {
|
|
2580
2580
|
xFrom: e.x,
|
|
2581
2581
|
xTo: e.x + e.width,
|
|
@@ -2583,31 +2583,31 @@ class ee {
|
|
|
2583
2583
|
yTo: e.y + e.height
|
|
2584
2584
|
};
|
|
2585
2585
|
});
|
|
2586
|
-
|
|
2586
|
+
i(this, "onAfterViewportUpdated", () => {
|
|
2587
2587
|
this.userTransformInProgress || this.loadAreaAroundViewport();
|
|
2588
2588
|
});
|
|
2589
|
-
|
|
2589
|
+
i(this, "userTransformInProgress", !1);
|
|
2590
2590
|
this.canvas = e, this.element = t, this.window = s, this.trigger = n, this.params = a, this.nodeHorizontal = this.params.nodeVerticalRadius, this.nodeVertical = this.params.nodeHorizontalRadius, this.viewport = e.viewport, this.currentScale = this.viewport.getViewportMatrix().scale, this.scheduleLoadAreaAroundViewport(), this.viewport.onAfterResize.subscribe(() => {
|
|
2591
2591
|
this.scheduleLoadAreaAroundViewport();
|
|
2592
2592
|
});
|
|
2593
2593
|
const h = {
|
|
2594
|
-
...
|
|
2594
|
+
...o,
|
|
2595
2595
|
onResizeTransformStarted: () => {
|
|
2596
|
-
this.userTransformInProgress = !0,
|
|
2596
|
+
this.userTransformInProgress = !0, o.onResizeTransformStarted();
|
|
2597
2597
|
},
|
|
2598
2598
|
onResizeTransformFinished: () => {
|
|
2599
|
-
this.userTransformInProgress = !1,
|
|
2599
|
+
this.userTransformInProgress = !1, o.onResizeTransformFinished();
|
|
2600
2600
|
},
|
|
2601
2601
|
onBeforeTransformChange: () => {
|
|
2602
|
-
this.userTransformInProgress = !0,
|
|
2602
|
+
this.userTransformInProgress = !0, o.onBeforeTransformChange();
|
|
2603
2603
|
},
|
|
2604
2604
|
onTransformChange: () => {
|
|
2605
2605
|
this.userTransformInProgress = !1;
|
|
2606
2606
|
const d = this.currentScale;
|
|
2607
|
-
this.currentScale = this.viewport.getViewportMatrix().scale, d !== this.currentScale && this.scheduleEnsureViewportAreaLoaded(),
|
|
2607
|
+
this.currentScale = this.viewport.getViewportMatrix().scale, d !== this.currentScale && this.scheduleEnsureViewportAreaLoaded(), o.onTransformChange();
|
|
2608
2608
|
},
|
|
2609
2609
|
onTransformFinished: () => {
|
|
2610
|
-
this.scheduleLoadAreaAroundViewport(),
|
|
2610
|
+
this.scheduleLoadAreaAroundViewport(), o.onTransformFinished();
|
|
2611
2611
|
}
|
|
2612
2612
|
};
|
|
2613
2613
|
X.configure(
|
|
@@ -2617,12 +2617,12 @@ class ee {
|
|
|
2617
2617
|
h
|
|
2618
2618
|
), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
|
|
2619
2619
|
}
|
|
2620
|
-
static configure(e, t, s,
|
|
2621
|
-
new
|
|
2620
|
+
static configure(e, t, s, o, n, a) {
|
|
2621
|
+
new te(
|
|
2622
2622
|
e,
|
|
2623
2623
|
t,
|
|
2624
2624
|
s,
|
|
2625
|
-
|
|
2625
|
+
o,
|
|
2626
2626
|
n,
|
|
2627
2627
|
a
|
|
2628
2628
|
);
|
|
@@ -2634,12 +2634,12 @@ class ee {
|
|
|
2634
2634
|
}
|
|
2635
2635
|
scheduleEnsureViewportAreaLoaded() {
|
|
2636
2636
|
setTimeout(() => {
|
|
2637
|
-
const { width: e, height: t } = this.viewport.getDimensions(), { scale: s, x:
|
|
2637
|
+
const { width: e, height: t } = this.viewport.getDimensions(), { scale: s, x: o, y: n } = this.viewport.getViewportMatrix(), a = e * s, h = t * s, d = o - this.nodeHorizontal, c = n - this.nodeVertical, g = o + a + this.nodeHorizontal, l = n + h + this.nodeVertical;
|
|
2638
2638
|
this.loadedArea.xFrom < d && this.loadedArea.xTo > g && this.loadedArea.yFrom < c && this.loadedArea.yTo > l || this.loadAreaAroundViewport();
|
|
2639
2639
|
});
|
|
2640
2640
|
}
|
|
2641
2641
|
loadAreaAroundViewport() {
|
|
2642
|
-
const { width: e, height: t } = this.viewport.getDimensions(), { scale: s, x:
|
|
2642
|
+
const { width: e, height: t } = this.viewport.getDimensions(), { scale: s, x: o, y: n } = this.viewport.getViewportMatrix(), a = e * s, h = t * s, d = o - a - this.nodeHorizontal, c = n - h - this.nodeVertical, g = 3 * a + 2 * this.nodeHorizontal, l = 3 * h + 2 * this.nodeVertical;
|
|
2643
2643
|
this.trigger.emit({
|
|
2644
2644
|
x: d,
|
|
2645
2645
|
y: c,
|
|
@@ -2648,69 +2648,69 @@ class ee {
|
|
|
2648
2648
|
});
|
|
2649
2649
|
}
|
|
2650
2650
|
}
|
|
2651
|
-
const
|
|
2651
|
+
const Tt = () => {
|
|
2652
2652
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2653
2653
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2654
2654
|
}, Ct = () => {
|
|
2655
2655
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2656
2656
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
2657
|
-
},
|
|
2657
|
+
}, Mt = () => {
|
|
2658
2658
|
const r = document.createElementNS(
|
|
2659
2659
|
"http://www.w3.org/2000/svg",
|
|
2660
2660
|
"pattern"
|
|
2661
2661
|
);
|
|
2662
2662
|
return r.setAttribute("id", "pattern"), r;
|
|
2663
2663
|
};
|
|
2664
|
-
class
|
|
2664
|
+
class re {
|
|
2665
2665
|
constructor(e, t, s) {
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
const e = this.canvas.viewport.getContentMatrix(), t = e.x - this.halfTileWidth * e.scale, s = e.y - this.halfTileHeight * e.scale,
|
|
2678
|
-
this.pattern.setAttribute("patternTransform",
|
|
2666
|
+
i(this, "svg", Tt());
|
|
2667
|
+
i(this, "patternRenderingRectangle", Ct());
|
|
2668
|
+
i(this, "pattern", Mt());
|
|
2669
|
+
i(this, "patternContent");
|
|
2670
|
+
i(this, "tileWidth");
|
|
2671
|
+
i(this, "tileHeight");
|
|
2672
|
+
i(this, "halfTileWidth");
|
|
2673
|
+
i(this, "halfTileHeight");
|
|
2674
|
+
i(this, "maxViewportScale");
|
|
2675
|
+
i(this, "visible", !1);
|
|
2676
|
+
i(this, "onAfterTransformUpdated", () => {
|
|
2677
|
+
const e = this.canvas.viewport.getContentMatrix(), t = e.x - this.halfTileWidth * e.scale, s = e.y - this.halfTileHeight * e.scale, o = `matrix(${e.scale}, 0, 0, ${e.scale}, ${t}, ${s})`;
|
|
2678
|
+
this.pattern.setAttribute("patternTransform", o), this.updateVisibility();
|
|
2679
2679
|
});
|
|
2680
2680
|
this.canvas = e, this.backgroundHost = s, this.tileWidth = t.tileWidth, this.tileHeight = t.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = t.renderer, this.maxViewportScale = t.maxViewportScale;
|
|
2681
|
-
const
|
|
2682
|
-
this.patternContent.setAttribute("transform",
|
|
2681
|
+
const o = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
|
|
2682
|
+
this.patternContent.setAttribute("transform", o), this.pattern.appendChild(this.patternContent);
|
|
2683
2683
|
const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
|
2684
2684
|
n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.updateDimensions(), this.canvas.viewport.onAfterResize.subscribe(() => {
|
|
2685
2685
|
this.updateDimensions();
|
|
2686
2686
|
}), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
|
|
2687
2687
|
}
|
|
2688
2688
|
static configure(e, t, s) {
|
|
2689
|
-
new
|
|
2689
|
+
new re(e, t, s);
|
|
2690
2690
|
}
|
|
2691
2691
|
updateVisibility() {
|
|
2692
|
-
const
|
|
2692
|
+
const { scale: e } = this.canvas.viewport.getViewportMatrix(), t = e > this.maxViewportScale;
|
|
2693
2693
|
t && this.visible ? (this.visible = !1, this.backgroundHost.removeChild(this.svg)) : !t && !this.visible && (this.visible = !0, this.backgroundHost.appendChild(this.svg));
|
|
2694
2694
|
}
|
|
2695
2695
|
updateDimensions() {
|
|
2696
2696
|
const { width: e, height: t } = this.canvas.viewport.getDimensions();
|
|
2697
2697
|
this.svg.setAttribute("width", `${e}`), this.svg.setAttribute("height", `${t}`), this.patternRenderingRectangle.setAttribute("width", `${e}`), this.patternRenderingRectangle.setAttribute("height", `${t}`);
|
|
2698
|
-
const s = this.tileWidth / e,
|
|
2699
|
-
this.pattern.setAttribute("width", `${s}`), this.pattern.setAttribute("height", `${
|
|
2698
|
+
const s = this.tileWidth / e, o = this.tileHeight / t;
|
|
2699
|
+
this.pattern.setAttribute("width", `${s}`), this.pattern.setAttribute("height", `${o}`);
|
|
2700
2700
|
}
|
|
2701
2701
|
}
|
|
2702
|
-
class
|
|
2703
|
-
constructor(e, t, s,
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2702
|
+
class se {
|
|
2703
|
+
constructor(e, t, s, o, n) {
|
|
2704
|
+
i(this, "overlayCanvas");
|
|
2705
|
+
i(this, "staticPortId", null);
|
|
2706
|
+
i(this, "isTargetDragging", !0);
|
|
2707
|
+
i(this, "onEdgeCreated", (e) => {
|
|
2708
2708
|
this.params.onAfterEdgeCreated(e);
|
|
2709
2709
|
});
|
|
2710
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window =
|
|
2710
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = Be(
|
|
2711
2711
|
this.overlayLayer,
|
|
2712
2712
|
this.viewportStore
|
|
2713
|
-
),
|
|
2713
|
+
), Y.configure(
|
|
2714
2714
|
this.canvas,
|
|
2715
2715
|
this.overlayLayer,
|
|
2716
2716
|
this.window,
|
|
@@ -2733,19 +2733,19 @@ class re {
|
|
|
2733
2733
|
}
|
|
2734
2734
|
);
|
|
2735
2735
|
}
|
|
2736
|
-
static configure(e, t, s,
|
|
2737
|
-
new
|
|
2736
|
+
static configure(e, t, s, o, n) {
|
|
2737
|
+
new se(
|
|
2738
2738
|
e,
|
|
2739
2739
|
t,
|
|
2740
2740
|
s,
|
|
2741
|
-
|
|
2741
|
+
o,
|
|
2742
2742
|
n
|
|
2743
2743
|
);
|
|
2744
2744
|
}
|
|
2745
2745
|
grabPort(e, t, s) {
|
|
2746
|
-
const
|
|
2746
|
+
const o = this.canvas.graph.getPort(e);
|
|
2747
2747
|
this.staticPortId = e;
|
|
2748
|
-
const n =
|
|
2748
|
+
const n = o.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.createContentCoords({
|
|
2749
2749
|
x: a - d.x,
|
|
2750
2750
|
y: h - d.y
|
|
2751
2751
|
}), g = this.canvas.viewport.createContentCoords({
|
|
@@ -2754,16 +2754,16 @@ class re {
|
|
|
2754
2754
|
}), l = {
|
|
2755
2755
|
overlayNodeId: N.StaticNodeId,
|
|
2756
2756
|
portCoords: c,
|
|
2757
|
-
portDirection:
|
|
2757
|
+
portDirection: o.direction
|
|
2758
2758
|
}, u = {
|
|
2759
2759
|
overlayNodeId: N.DraggingNodeId,
|
|
2760
2760
|
portCoords: g,
|
|
2761
2761
|
portDirection: this.params.dragPortDirection
|
|
2762
2762
|
};
|
|
2763
2763
|
this.isTargetDragging = s === "direct";
|
|
2764
|
-
const [
|
|
2765
|
-
this.overlayCanvas.addNode(
|
|
2766
|
-
from:
|
|
2764
|
+
const [w, f] = this.isTargetDragging ? [l, u] : [u, l];
|
|
2765
|
+
this.overlayCanvas.addNode(O(w)), this.overlayCanvas.addNode(O(f)), this.overlayCanvas.addEdge({
|
|
2766
|
+
from: w.overlayNodeId,
|
|
2767
2767
|
to: f.overlayNodeId,
|
|
2768
2768
|
shape: this.params.edgeShapeFactory(N.EdgeId)
|
|
2769
2769
|
});
|
|
@@ -2772,7 +2772,7 @@ class re {
|
|
|
2772
2772
|
this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
2773
2773
|
}
|
|
2774
2774
|
tryCreateConnection(e) {
|
|
2775
|
-
const t =
|
|
2775
|
+
const t = Pe(this.canvas.graph, e), s = this.staticPortId;
|
|
2776
2776
|
if (t === null) {
|
|
2777
2777
|
this.params.onEdgeCreationInterrupted({
|
|
2778
2778
|
staticPortId: s,
|
|
@@ -2780,7 +2780,7 @@ class re {
|
|
|
2780
2780
|
});
|
|
2781
2781
|
return;
|
|
2782
2782
|
}
|
|
2783
|
-
const
|
|
2783
|
+
const o = this.isTargetDragging ? s : t, n = this.isTargetDragging ? t : s, a = { from: o, to: n }, h = this.params.connectionPreprocessor(a);
|
|
2784
2784
|
h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(a);
|
|
2785
2785
|
}
|
|
2786
2786
|
moveDraggingPort(e) {
|
|
@@ -2794,19 +2794,19 @@ class re {
|
|
|
2794
2794
|
});
|
|
2795
2795
|
}
|
|
2796
2796
|
}
|
|
2797
|
-
class
|
|
2798
|
-
constructor(e, t, s,
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2797
|
+
class oe {
|
|
2798
|
+
constructor(e, t, s, o, n) {
|
|
2799
|
+
i(this, "overlayCanvas");
|
|
2800
|
+
i(this, "staticPortId", null);
|
|
2801
|
+
i(this, "isTargetDragging", !0);
|
|
2802
|
+
i(this, "draggingEdgePayload", null);
|
|
2803
|
+
i(this, "onEdgeReattached", (e) => {
|
|
2804
2804
|
this.params.onAfterEdgeReattached(e);
|
|
2805
2805
|
});
|
|
2806
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window =
|
|
2806
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = Be(
|
|
2807
2807
|
this.overlayLayer,
|
|
2808
2808
|
this.viewportStore
|
|
2809
|
-
),
|
|
2809
|
+
), Y.configure(
|
|
2810
2810
|
this.canvas,
|
|
2811
2811
|
this.overlayLayer,
|
|
2812
2812
|
this.window,
|
|
@@ -2826,12 +2826,12 @@ class se {
|
|
|
2826
2826
|
}
|
|
2827
2827
|
);
|
|
2828
2828
|
}
|
|
2829
|
-
static configure(e, t, s,
|
|
2830
|
-
new
|
|
2829
|
+
static configure(e, t, s, o, n) {
|
|
2830
|
+
new oe(
|
|
2831
2831
|
e,
|
|
2832
2832
|
t,
|
|
2833
2833
|
s,
|
|
2834
|
-
|
|
2834
|
+
o,
|
|
2835
2835
|
n
|
|
2836
2836
|
);
|
|
2837
2837
|
}
|
|
@@ -2839,12 +2839,12 @@ class se {
|
|
|
2839
2839
|
const s = this.params.draggingEdgeResolver(e);
|
|
2840
2840
|
if (s === null || !this.canvas.graph.hasEdge(s))
|
|
2841
2841
|
return !1;
|
|
2842
|
-
const
|
|
2842
|
+
const o = this.canvas.graph.getEdge(s), n = e === o.from, a = e === o.to, h = n ? o.to : o.from;
|
|
2843
2843
|
this.staticPortId = h, this.isTargetDragging = a;
|
|
2844
2844
|
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), l = {
|
|
2845
2845
|
x: g.x + g.width / 2,
|
|
2846
2846
|
y: g.y + g.height / 2
|
|
2847
|
-
}, u = this.overlayLayer.getBoundingClientRect(),
|
|
2847
|
+
}, u = this.overlayLayer.getBoundingClientRect(), w = this.canvas.viewport.createContentCoords({
|
|
2848
2848
|
x: l.x - u.x,
|
|
2849
2849
|
y: l.y - u.y
|
|
2850
2850
|
}), f = this.canvas.viewport.createContentCoords({
|
|
@@ -2853,26 +2853,26 @@ class se {
|
|
|
2853
2853
|
});
|
|
2854
2854
|
this.draggingEdgePayload = {
|
|
2855
2855
|
id: s,
|
|
2856
|
-
from:
|
|
2857
|
-
to:
|
|
2858
|
-
shape:
|
|
2859
|
-
priority:
|
|
2856
|
+
from: o.from,
|
|
2857
|
+
to: o.to,
|
|
2858
|
+
shape: o.shape,
|
|
2859
|
+
priority: o.priority
|
|
2860
2860
|
}, this.canvas.removeEdge(s);
|
|
2861
|
-
const
|
|
2861
|
+
const v = {
|
|
2862
2862
|
overlayNodeId: N.StaticNodeId,
|
|
2863
|
-
portCoords:
|
|
2863
|
+
portCoords: w,
|
|
2864
2864
|
portDirection: c.direction
|
|
2865
2865
|
}, S = {
|
|
2866
2866
|
overlayNodeId: N.DraggingNodeId,
|
|
2867
2867
|
portCoords: f,
|
|
2868
2868
|
portDirection: d.direction
|
|
2869
|
-
}, [b,
|
|
2870
|
-
this.overlayCanvas.addNode(
|
|
2871
|
-
const P = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(N.EdgeId) :
|
|
2869
|
+
}, [b, T] = this.isTargetDragging ? [v, S] : [S, v];
|
|
2870
|
+
this.overlayCanvas.addNode(O(b)), this.overlayCanvas.addNode(O(T));
|
|
2871
|
+
const P = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(N.EdgeId) : o.shape;
|
|
2872
2872
|
return this.overlayCanvas.addEdge({
|
|
2873
2873
|
id: N.EdgeId,
|
|
2874
2874
|
from: b.overlayNodeId,
|
|
2875
|
-
to:
|
|
2875
|
+
to: T.overlayNodeId,
|
|
2876
2876
|
shape: P
|
|
2877
2877
|
}), !0;
|
|
2878
2878
|
}
|
|
@@ -2883,14 +2883,14 @@ class se {
|
|
|
2883
2883
|
const t = this.overlayLayer.getBoundingClientRect(), s = {
|
|
2884
2884
|
x: e.x - t.x,
|
|
2885
2885
|
y: e.y - t.y
|
|
2886
|
-
},
|
|
2886
|
+
}, o = this.canvas.viewport.createContentCoords(s);
|
|
2887
2887
|
this.overlayCanvas.updateNode(N.DraggingNodeId, {
|
|
2888
|
-
x:
|
|
2889
|
-
y:
|
|
2888
|
+
x: o.x,
|
|
2889
|
+
y: o.y
|
|
2890
2890
|
});
|
|
2891
2891
|
}
|
|
2892
2892
|
tryCreateConnection(e) {
|
|
2893
|
-
const t =
|
|
2893
|
+
const t = Pe(this.canvas.graph, e);
|
|
2894
2894
|
if (this.overlayCanvas.removeEdge(N.EdgeId), t === null) {
|
|
2895
2895
|
const d = this.draggingEdgePayload;
|
|
2896
2896
|
this.params.onEdgeReattachInterrupted({
|
|
@@ -2902,10 +2902,10 @@ class se {
|
|
|
2902
2902
|
});
|
|
2903
2903
|
return;
|
|
2904
2904
|
}
|
|
2905
|
-
const [s,
|
|
2905
|
+
const [s, o] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
|
|
2906
2906
|
id: n.id,
|
|
2907
2907
|
from: s,
|
|
2908
|
-
to:
|
|
2908
|
+
to: o,
|
|
2909
2909
|
shape: n.shape,
|
|
2910
2910
|
priority: n.priority
|
|
2911
2911
|
}, h = this.params.connectionPreprocessor(a);
|
|
@@ -2923,20 +2923,20 @@ class se {
|
|
|
2923
2923
|
}
|
|
2924
2924
|
}
|
|
2925
2925
|
}
|
|
2926
|
-
class
|
|
2926
|
+
class ie {
|
|
2927
2927
|
constructor(e, t) {
|
|
2928
2928
|
this.applier = e, this.trigger = t, this.trigger.subscribe(() => {
|
|
2929
2929
|
this.applier.apply();
|
|
2930
2930
|
});
|
|
2931
2931
|
}
|
|
2932
2932
|
static configure(e, t) {
|
|
2933
|
-
new
|
|
2933
|
+
new ie(e, t);
|
|
2934
2934
|
}
|
|
2935
2935
|
}
|
|
2936
|
-
class
|
|
2936
|
+
class z {
|
|
2937
2937
|
constructor(e, t, s) {
|
|
2938
|
-
|
|
2939
|
-
|
|
2938
|
+
i(this, "applyScheduled", !1);
|
|
2939
|
+
i(this, "apply", () => {
|
|
2940
2940
|
this.applyScheduled = !1, this.applier.apply();
|
|
2941
2941
|
});
|
|
2942
2942
|
this.graph = e, this.applier = t, this.defererFn = s, this.graph.onAfterNodeAdded.subscribe(() => {
|
|
@@ -2950,7 +2950,7 @@ class W {
|
|
|
2950
2950
|
});
|
|
2951
2951
|
}
|
|
2952
2952
|
static configure(e, t, s) {
|
|
2953
|
-
new
|
|
2953
|
+
new z(
|
|
2954
2954
|
e,
|
|
2955
2955
|
t,
|
|
2956
2956
|
s
|
|
@@ -2962,23 +2962,23 @@ class W {
|
|
|
2962
2962
|
}
|
|
2963
2963
|
class Dt {
|
|
2964
2964
|
static configure(e, t) {
|
|
2965
|
-
const s = t.applyOn,
|
|
2965
|
+
const s = t.applyOn, o = new St(e, t.algorithm, {
|
|
2966
2966
|
staticNodeResolver: t.staticNodeResolver,
|
|
2967
2967
|
onBeforeApplied: t.onBeforeApplied,
|
|
2968
2968
|
onAfterApplied: t.onAfterApplied
|
|
2969
2969
|
});
|
|
2970
2970
|
switch (s.type) {
|
|
2971
2971
|
case "manual": {
|
|
2972
|
-
|
|
2973
|
-
|
|
2972
|
+
ie.configure(
|
|
2973
|
+
o,
|
|
2974
2974
|
s.trigger
|
|
2975
2975
|
);
|
|
2976
2976
|
break;
|
|
2977
2977
|
}
|
|
2978
2978
|
case "topologyChangeMacrotask": {
|
|
2979
|
-
|
|
2979
|
+
z.configure(
|
|
2980
2980
|
e.graph,
|
|
2981
|
-
|
|
2981
|
+
o,
|
|
2982
2982
|
(n) => {
|
|
2983
2983
|
setTimeout(() => {
|
|
2984
2984
|
n();
|
|
@@ -2988,9 +2988,9 @@ class Dt {
|
|
|
2988
2988
|
break;
|
|
2989
2989
|
}
|
|
2990
2990
|
case "topologyChangeMicrotask": {
|
|
2991
|
-
|
|
2991
|
+
z.configure(
|
|
2992
2992
|
e.graph,
|
|
2993
|
-
|
|
2993
|
+
o,
|
|
2994
2994
|
(n) => {
|
|
2995
2995
|
queueMicrotask(() => {
|
|
2996
2996
|
n();
|
|
@@ -3002,10 +3002,10 @@ class Dt {
|
|
|
3002
3002
|
}
|
|
3003
3003
|
}
|
|
3004
3004
|
}
|
|
3005
|
-
class
|
|
3005
|
+
class Rt {
|
|
3006
3006
|
constructor(e, t) {
|
|
3007
|
-
|
|
3008
|
-
|
|
3007
|
+
i(this, "previousTimeStamp");
|
|
3008
|
+
i(this, "step", (e) => {
|
|
3009
3009
|
if (this.previousTimeStamp === void 0)
|
|
3010
3010
|
this.previousTimeStamp = e;
|
|
3011
3011
|
else {
|
|
@@ -3017,61 +3017,61 @@ class Mt {
|
|
|
3017
3017
|
this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
|
|
3018
3018
|
}
|
|
3019
3019
|
}
|
|
3020
|
-
class
|
|
3020
|
+
class ne {
|
|
3021
3021
|
constructor(e, t, s) {
|
|
3022
|
-
|
|
3023
|
-
|
|
3022
|
+
i(this, "applier");
|
|
3023
|
+
i(this, "step", (e) => {
|
|
3024
3024
|
this.applier.apply(e);
|
|
3025
3025
|
});
|
|
3026
|
-
this.win = s, this.applier = new
|
|
3026
|
+
this.win = s, this.applier = new bt(e, t.algorithm, {
|
|
3027
3027
|
staticNodeResolver: t.staticNodeResolver,
|
|
3028
3028
|
onBeforeApplied: t.onBeforeApplied,
|
|
3029
3029
|
onAfterApplied: t.onAfterApplied
|
|
3030
|
-
}), new
|
|
3030
|
+
}), new Rt(this.win, this.step);
|
|
3031
3031
|
}
|
|
3032
3032
|
static configure(e, t, s) {
|
|
3033
|
-
new
|
|
3033
|
+
new ne(e, t, s);
|
|
3034
3034
|
}
|
|
3035
3035
|
}
|
|
3036
|
-
const
|
|
3036
|
+
const Lt = () => {
|
|
3037
3037
|
const r = document.createElement("div");
|
|
3038
3038
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
3039
|
-
},
|
|
3039
|
+
}, q = () => {
|
|
3040
3040
|
const r = document.createElement("div");
|
|
3041
3041
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
3042
|
-
},
|
|
3043
|
-
const r =
|
|
3042
|
+
}, ye = () => {
|
|
3043
|
+
const r = q();
|
|
3044
3044
|
return r.style.pointerEvents = "none", r;
|
|
3045
3045
|
};
|
|
3046
|
-
class
|
|
3046
|
+
class Vt {
|
|
3047
3047
|
constructor(e) {
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3048
|
+
i(this, "background", q());
|
|
3049
|
+
i(this, "main", q());
|
|
3050
|
+
i(this, "overlayConnectablePorts", ye());
|
|
3051
|
+
i(this, "overlayDraggableEdges", ye());
|
|
3052
|
+
i(this, "host", Lt());
|
|
3053
3053
|
this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges);
|
|
3054
3054
|
}
|
|
3055
3055
|
destroy() {
|
|
3056
3056
|
this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlayConnectablePorts), this.host.removeChild(this.overlayDraggableEdges), this.element.removeChild(this.host);
|
|
3057
3057
|
}
|
|
3058
3058
|
}
|
|
3059
|
-
const
|
|
3059
|
+
const K = (r) => () => r, me = K(0), Ft = () => {
|
|
3060
3060
|
let r = 0;
|
|
3061
3061
|
return () => r++;
|
|
3062
|
-
},
|
|
3063
|
-
let t =
|
|
3064
|
-
const
|
|
3065
|
-
return r === "incremental" && (t =
|
|
3062
|
+
}, It = (r, e) => {
|
|
3063
|
+
let t = me, s = me;
|
|
3064
|
+
const o = Ft();
|
|
3065
|
+
return r === "incremental" && (t = o), e === "incremental" && (s = o), typeof r == "number" && (t = K(r)), typeof e == "number" && (s = K(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
|
|
3066
3066
|
nodesPriorityFn: t,
|
|
3067
3067
|
edgesPriorityFn: s
|
|
3068
3068
|
};
|
|
3069
|
-
},
|
|
3069
|
+
}, ae = (r) => {
|
|
3070
3070
|
if (typeof r == "function")
|
|
3071
3071
|
return r;
|
|
3072
3072
|
switch (r.type) {
|
|
3073
3073
|
case "straight":
|
|
3074
|
-
return () => new
|
|
3074
|
+
return () => new mt({
|
|
3075
3075
|
color: r.color,
|
|
3076
3076
|
width: r.width,
|
|
3077
3077
|
arrowLength: r.arrowLength,
|
|
@@ -3085,7 +3085,7 @@ const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
|
3085
3085
|
detourDirection: r.detourDirection
|
|
3086
3086
|
});
|
|
3087
3087
|
case "horizontal":
|
|
3088
|
-
return () => new
|
|
3088
|
+
return () => new yt({
|
|
3089
3089
|
color: r.color,
|
|
3090
3090
|
width: r.width,
|
|
3091
3091
|
arrowLength: r.arrowLength,
|
|
@@ -3098,7 +3098,7 @@ const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
|
3098
3098
|
detourDistance: r.detourDistance
|
|
3099
3099
|
});
|
|
3100
3100
|
case "vertical":
|
|
3101
|
-
return () => new
|
|
3101
|
+
return () => new vt({
|
|
3102
3102
|
color: r.color,
|
|
3103
3103
|
width: r.width,
|
|
3104
3104
|
arrowLength: r.arrowLength,
|
|
@@ -3111,7 +3111,7 @@ const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
|
3111
3111
|
detourDistance: r.detourDistance
|
|
3112
3112
|
});
|
|
3113
3113
|
case "direct":
|
|
3114
|
-
return () => new
|
|
3114
|
+
return () => new Le({
|
|
3115
3115
|
color: r.color,
|
|
3116
3116
|
width: r.width,
|
|
3117
3117
|
arrowLength: r.arrowLength,
|
|
@@ -3122,7 +3122,7 @@ const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
|
3122
3122
|
targetOffset: r.targetOffset
|
|
3123
3123
|
});
|
|
3124
3124
|
default:
|
|
3125
|
-
return () => new
|
|
3125
|
+
return () => new ft({
|
|
3126
3126
|
color: r.color,
|
|
3127
3127
|
width: r.width,
|
|
3128
3128
|
arrowLength: r.arrowLength,
|
|
@@ -3136,31 +3136,31 @@ const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
|
3136
3136
|
detourDirection: r.detourDirection
|
|
3137
3137
|
});
|
|
3138
3138
|
}
|
|
3139
|
-
},
|
|
3140
|
-
var t, s,
|
|
3141
|
-
const e =
|
|
3139
|
+
}, Bt = (r) => {
|
|
3140
|
+
var t, s, o, n, a;
|
|
3141
|
+
const e = It(
|
|
3142
3142
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
3143
3143
|
(s = r.edges) == null ? void 0 : s.priority
|
|
3144
3144
|
);
|
|
3145
3145
|
return {
|
|
3146
3146
|
nodes: {
|
|
3147
|
-
centerFn: ((
|
|
3147
|
+
centerFn: ((o = r.nodes) == null ? void 0 : o.centerFn) ?? Ne,
|
|
3148
3148
|
priorityFn: e.nodesPriorityFn
|
|
3149
3149
|
},
|
|
3150
3150
|
ports: {
|
|
3151
3151
|
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
3152
3152
|
},
|
|
3153
3153
|
edges: {
|
|
3154
|
-
shapeFactory:
|
|
3154
|
+
shapeFactory: ae(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
|
|
3155
3155
|
priorityFn: e.edgesPriorityFn
|
|
3156
3156
|
}
|
|
3157
3157
|
};
|
|
3158
|
-
},
|
|
3159
|
-
var
|
|
3160
|
-
const e = ((
|
|
3158
|
+
}, $t = (r) => {
|
|
3159
|
+
var w, f, v, S, b, T;
|
|
3160
|
+
const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
|
|
3161
3161
|
}), t = ((f = r.events) == null ? void 0 : f.onNodeDrag) ?? (() => {
|
|
3162
|
-
}), s = r.nodeDragVerifier ?? (() => !0),
|
|
3163
|
-
}), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (S = r.mouse) == null ? void 0 : S.dragCursor, d = h !== void 0 ? h : "grab", c = (b = r.mouse) == null ? void 0 : b.mouseDownEventVerifier, g = c !== void 0 ? c : (P) => P.button === 0, l = (
|
|
3162
|
+
}), s = r.nodeDragVerifier ?? (() => !0), o = ((v = r.events) == null ? void 0 : v.onNodeDragFinished) ?? (() => {
|
|
3163
|
+
}), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (S = r.mouse) == null ? void 0 : S.dragCursor, d = h !== void 0 ? h : "grab", c = (b = r.mouse) == null ? void 0 : b.mouseDownEventVerifier, g = c !== void 0 ? c : (P) => P.button === 0, l = (T = r.mouse) == null ? void 0 : T.mouseUpEventVerifier, u = l !== void 0 ? l : (P) => P.button === 0;
|
|
3164
3164
|
return {
|
|
3165
3165
|
moveOnTop: n,
|
|
3166
3166
|
moveEdgesOnTop: a,
|
|
@@ -3171,25 +3171,25 @@ const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
|
3171
3171
|
onNodeDragStarted: e,
|
|
3172
3172
|
onNodeDrag: t,
|
|
3173
3173
|
nodeDragVerifier: s,
|
|
3174
|
-
onNodeDragFinished:
|
|
3174
|
+
onNodeDragFinished: o
|
|
3175
3175
|
};
|
|
3176
|
-
},
|
|
3177
|
-
const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, s = r.minY !== null ? r.minY : -1 / 0,
|
|
3176
|
+
}, Ut = (r) => {
|
|
3177
|
+
const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, s = r.minY !== null ? r.minY : -1 / 0, o = r.maxY !== null ? r.maxY : 1 / 0;
|
|
3178
3178
|
return (n) => {
|
|
3179
3179
|
let a = n.nextTransform.x, h = n.nextTransform.y;
|
|
3180
3180
|
a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
|
|
3181
3181
|
const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
|
|
3182
3182
|
a > c && a > n.prevTransform.x && (a = Math.max(n.prevTransform.x, c)), h < s && h < n.prevTransform.y && (h = Math.min(n.prevTransform.y, s));
|
|
3183
|
-
const g = n.canvasHeight * n.prevTransform.scale, l =
|
|
3183
|
+
const g = n.canvasHeight * n.prevTransform.scale, l = o - g;
|
|
3184
3184
|
return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
|
|
3185
3185
|
};
|
|
3186
|
-
},
|
|
3187
|
-
const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0,
|
|
3186
|
+
}, Ot = (r) => {
|
|
3187
|
+
const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, o = t !== null ? 1 / t : 1 / 0;
|
|
3188
3188
|
return (n) => {
|
|
3189
3189
|
const a = n.prevTransform, h = n.nextTransform;
|
|
3190
3190
|
let d = h.scale, c = h.x, g = h.y;
|
|
3191
|
-
if (h.scale >
|
|
3192
|
-
d = Math.max(a.scale,
|
|
3191
|
+
if (h.scale > o && h.scale > a.scale) {
|
|
3192
|
+
d = Math.max(a.scale, o), c = a.x, g = a.y;
|
|
3193
3193
|
const l = (d - a.scale) / (h.scale - a.scale);
|
|
3194
3194
|
c = a.x + (h.x - a.x) * l, g = a.y + (h.y - a.y) * l;
|
|
3195
3195
|
}
|
|
@@ -3204,7 +3204,7 @@ const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
|
3204
3204
|
y: g
|
|
3205
3205
|
};
|
|
3206
3206
|
};
|
|
3207
|
-
},
|
|
3207
|
+
}, Wt = (r) => (e) => r.reduce(
|
|
3208
3208
|
(t, s) => s({
|
|
3209
3209
|
prevTransform: e.prevTransform,
|
|
3210
3210
|
nextTransform: t,
|
|
@@ -3212,93 +3212,93 @@ const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
|
3212
3212
|
canvasHeight: e.canvasHeight
|
|
3213
3213
|
}),
|
|
3214
3214
|
e.nextTransform
|
|
3215
|
-
),
|
|
3215
|
+
), ve = (r) => {
|
|
3216
3216
|
if (typeof r == "function")
|
|
3217
3217
|
return r;
|
|
3218
3218
|
switch (r.type) {
|
|
3219
3219
|
case "scale-limit":
|
|
3220
|
-
return
|
|
3220
|
+
return Ot({
|
|
3221
3221
|
minContentScale: r.minContentScale ?? 0,
|
|
3222
3222
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
3223
3223
|
});
|
|
3224
3224
|
case "shift-limit":
|
|
3225
|
-
return
|
|
3225
|
+
return Ut({
|
|
3226
3226
|
minX: r.minX ?? -1 / 0,
|
|
3227
3227
|
maxX: r.maxX ?? 1 / 0,
|
|
3228
3228
|
minY: r.minY ?? -1 / 0,
|
|
3229
3229
|
maxY: r.maxY ?? 1 / 0
|
|
3230
3230
|
});
|
|
3231
3231
|
}
|
|
3232
|
-
},
|
|
3233
|
-
var f,
|
|
3232
|
+
}, Ae = (r) => {
|
|
3233
|
+
var f, v, S, b, T, P, L, V, he, de, ce, le;
|
|
3234
3234
|
const e = (f = r == null ? void 0 : r.scale) == null ? void 0 : f.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
|
|
3235
|
-
let
|
|
3236
|
-
s !== void 0 ? Array.isArray(s) ?
|
|
3235
|
+
let o;
|
|
3236
|
+
s !== void 0 ? Array.isArray(s) ? o = Wt(
|
|
3237
3237
|
s.map(
|
|
3238
|
-
(
|
|
3238
|
+
(C) => ve(C)
|
|
3239
3239
|
)
|
|
3240
|
-
) :
|
|
3241
|
-
const n = ((
|
|
3240
|
+
) : o = ve(s) : o = (C) => C.nextTransform;
|
|
3241
|
+
const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((S = r == null ? void 0 : r.events) == null ? void 0 : S.onBeforeTransformChange) ?? (() => {
|
|
3242
3242
|
}), h = ((b = r == null ? void 0 : r.events) == null ? void 0 : b.onTransformChange) ?? (() => {
|
|
3243
|
-
}), d = (
|
|
3243
|
+
}), d = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseDownEventVerifier, c = d !== void 0 ? d : (C) => C.button === 0, g = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseUpEventVerifier, l = g !== void 0 ? g : (C) => C.button === 0, u = (L = r == null ? void 0 : r.scale) == null ? void 0 : L.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
|
|
3244
3244
|
return {
|
|
3245
3245
|
wheelSensitivity: t,
|
|
3246
3246
|
onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
|
|
3247
3247
|
}),
|
|
3248
|
-
onTransformFinished: ((
|
|
3248
|
+
onTransformFinished: ((he = r == null ? void 0 : r.events) == null ? void 0 : he.onTransformFinished) ?? (() => {
|
|
3249
3249
|
}),
|
|
3250
3250
|
onBeforeTransformChange: a,
|
|
3251
3251
|
onTransformChange: h,
|
|
3252
|
-
transformPreprocessor:
|
|
3252
|
+
transformPreprocessor: o,
|
|
3253
3253
|
shiftCursor: n,
|
|
3254
3254
|
mouseDownEventVerifier: c,
|
|
3255
3255
|
mouseUpEventVerifier: l,
|
|
3256
|
-
mouseWheelEventVerifier:
|
|
3257
|
-
scaleWheelFinishTimeout: ((
|
|
3258
|
-
onResizeTransformStarted: ((
|
|
3256
|
+
mouseWheelEventVerifier: w,
|
|
3257
|
+
scaleWheelFinishTimeout: ((de = r == null ? void 0 : r.scale) == null ? void 0 : de.wheelFinishTimeout) ?? 500,
|
|
3258
|
+
onResizeTransformStarted: ((ce = r == null ? void 0 : r.events) == null ? void 0 : ce.onResizeTransformStarted) ?? (() => {
|
|
3259
3259
|
}),
|
|
3260
|
-
onResizeTransformFinished: ((
|
|
3260
|
+
onResizeTransformFinished: ((le = r == null ? void 0 : r.events) == null ? void 0 : le.onResizeTransformFinished) ?? (() => {
|
|
3261
3261
|
})
|
|
3262
3262
|
};
|
|
3263
|
-
},
|
|
3263
|
+
}, zt = (r, e) => {
|
|
3264
3264
|
const t = document.createElementNS(
|
|
3265
3265
|
"http://www.w3.org/2000/svg",
|
|
3266
3266
|
"circle"
|
|
3267
3267
|
);
|
|
3268
3268
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
3269
|
-
},
|
|
3269
|
+
}, kt = (r) => r instanceof SVGElement ? r : zt(
|
|
3270
3270
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
3271
3271
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
3272
|
-
),
|
|
3273
|
-
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25,
|
|
3272
|
+
), Ht = (r) => {
|
|
3273
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, o = kt(r.renderer ?? {});
|
|
3274
3274
|
return {
|
|
3275
3275
|
tileWidth: t,
|
|
3276
3276
|
tileHeight: s,
|
|
3277
|
-
renderer:
|
|
3277
|
+
renderer: o,
|
|
3278
3278
|
maxViewportScale: r.maxViewportScale ?? 10
|
|
3279
3279
|
};
|
|
3280
|
-
},
|
|
3280
|
+
}, Yt = (r, e, t) => {
|
|
3281
3281
|
var c, g, l;
|
|
3282
|
-
const s = () => "direct",
|
|
3282
|
+
const s = () => "direct", o = (u) => u, n = (u) => u.button === 0, a = () => {
|
|
3283
3283
|
}, h = () => {
|
|
3284
3284
|
}, d = () => {
|
|
3285
3285
|
};
|
|
3286
3286
|
return {
|
|
3287
3287
|
connectionTypeResolver: r.connectionTypeResolver ?? s,
|
|
3288
|
-
connectionPreprocessor: r.connectionPreprocessor ??
|
|
3288
|
+
connectionPreprocessor: r.connectionPreprocessor ?? o,
|
|
3289
3289
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
|
|
3290
3290
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
|
|
3291
3291
|
onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
|
|
3292
3292
|
onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
|
|
3293
3293
|
onEdgeCreationPrevented: ((l = r.events) == null ? void 0 : l.onEdgeCreationPrevented) ?? h,
|
|
3294
3294
|
dragPortDirection: r.dragPortDirection ?? t,
|
|
3295
|
-
edgeShapeFactory: r.edgeShape !== void 0 ?
|
|
3295
|
+
edgeShapeFactory: r.edgeShape !== void 0 ? ae(r.edgeShape) : e
|
|
3296
3296
|
};
|
|
3297
3297
|
}, Xt = (r, e) => {
|
|
3298
3298
|
var c, g, l;
|
|
3299
|
-
const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey,
|
|
3300
|
-
const
|
|
3301
|
-
return
|
|
3299
|
+
const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, o = (u) => u.button === 0, n = (u) => {
|
|
3300
|
+
const w = e.getPortAdjacentEdgeIds(u);
|
|
3301
|
+
return w.length > 0 ? w[w.length - 1] : null;
|
|
3302
3302
|
}, a = () => {
|
|
3303
3303
|
}, h = () => {
|
|
3304
3304
|
}, d = () => {
|
|
@@ -3306,17 +3306,17 @@ const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
|
3306
3306
|
return {
|
|
3307
3307
|
connectionPreprocessor: r.connectionPreprocessor ?? t,
|
|
3308
3308
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
|
|
3309
|
-
mouseUpEventVerifier: r.mouseUpEventVerifier ??
|
|
3309
|
+
mouseUpEventVerifier: r.mouseUpEventVerifier ?? o,
|
|
3310
3310
|
draggingEdgeResolver: r.draggingEdgeResolver ?? n,
|
|
3311
|
-
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ?
|
|
3311
|
+
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ae(r.draggingEdgeShape) : null,
|
|
3312
3312
|
onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
|
|
3313
3313
|
onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
|
|
3314
3314
|
onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
|
|
3315
3315
|
};
|
|
3316
|
-
},
|
|
3316
|
+
}, Gt = (r) => ({
|
|
3317
3317
|
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
3318
3318
|
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
3319
|
-
}),
|
|
3319
|
+
}), jt = (r) => {
|
|
3320
3320
|
var e, t;
|
|
3321
3321
|
return {
|
|
3322
3322
|
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
|
|
@@ -3325,28 +3325,28 @@ const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
|
3325
3325
|
})
|
|
3326
3326
|
};
|
|
3327
3327
|
};
|
|
3328
|
-
class
|
|
3328
|
+
class qt extends Error {
|
|
3329
3329
|
constructor() {
|
|
3330
3330
|
super(...arguments);
|
|
3331
|
-
|
|
3331
|
+
i(this, "name", "CanvasBuilderError");
|
|
3332
3332
|
}
|
|
3333
3333
|
}
|
|
3334
|
-
class
|
|
3334
|
+
class $e {
|
|
3335
3335
|
constructor(e, t, s) {
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3336
|
+
i(this, "dt");
|
|
3337
|
+
i(this, "nodeMass");
|
|
3338
|
+
i(this, "edgeEquilibriumLength");
|
|
3339
|
+
i(this, "edgeStiffness");
|
|
3340
|
+
i(this, "nodeForcesApplicationStrategy");
|
|
3341
|
+
i(this, "distanceVectorGenerator");
|
|
3342
3342
|
this.graph = e, this.currentCoords = t, this.dt = s.dtSec, this.nodeMass = s.nodeMass, this.edgeEquilibriumLength = s.edgeEquilibriumLength, this.edgeStiffness = s.edgeStiffness, this.distanceVectorGenerator = s.distanceVectorGenerator, this.nodeForcesApplicationStrategy = s.nodeForcesApplicationStrategy;
|
|
3343
3343
|
}
|
|
3344
3344
|
apply() {
|
|
3345
3345
|
let e = 0;
|
|
3346
3346
|
const t = /* @__PURE__ */ new Map();
|
|
3347
|
-
return this.graph.getAllNodeIds().forEach((
|
|
3348
|
-
t.set(
|
|
3349
|
-
}), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((
|
|
3347
|
+
return this.graph.getAllNodeIds().forEach((o) => {
|
|
3348
|
+
t.set(o, { x: 0, y: 0 });
|
|
3349
|
+
}), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((o, n) => {
|
|
3350
3350
|
const a = t.get(n), h = {
|
|
3351
3351
|
x: a.x / this.nodeMass * this.dt,
|
|
3352
3352
|
y: a.y / this.nodeMass * this.dt
|
|
@@ -3356,26 +3356,26 @@ class Be {
|
|
|
3356
3356
|
Math.sqrt(h.x * h.x + h.y * h.y)
|
|
3357
3357
|
);
|
|
3358
3358
|
const d = h.x * this.dt, c = h.y * this.dt;
|
|
3359
|
-
|
|
3359
|
+
o.x += d, o.y += c;
|
|
3360
3360
|
}), e;
|
|
3361
3361
|
}
|
|
3362
3362
|
applyEdgeForces(e) {
|
|
3363
3363
|
this.graph.getAllEdgeIds().forEach((t) => {
|
|
3364
|
-
const s = this.graph.getEdge(t),
|
|
3364
|
+
const s = this.graph.getEdge(t), o = this.graph.getPort(s.from), n = this.graph.getPort(s.to), a = this.currentCoords.get(o.nodeId), h = this.currentCoords.get(n.nodeId), d = this.distanceVectorGenerator.create(
|
|
3365
3365
|
a,
|
|
3366
3366
|
h
|
|
3367
|
-
), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g,
|
|
3368
|
-
|
|
3367
|
+
), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, w = e.get(o.nodeId), f = e.get(n.nodeId);
|
|
3368
|
+
w.x += l, w.y += u, f.x -= l, f.y -= u;
|
|
3369
3369
|
});
|
|
3370
3370
|
}
|
|
3371
3371
|
}
|
|
3372
|
-
class
|
|
3372
|
+
class Ue {
|
|
3373
3373
|
constructor(e) {
|
|
3374
|
-
|
|
3374
|
+
i(this, "PI2", 2 * Math.PI);
|
|
3375
3375
|
this.rand = e;
|
|
3376
3376
|
}
|
|
3377
3377
|
create(e, t) {
|
|
3378
|
-
const s = t.x - e.x,
|
|
3378
|
+
const s = t.x - e.x, o = t.y - e.y, n = s * s + o * o;
|
|
3379
3379
|
if (n === 0) {
|
|
3380
3380
|
const c = this.PI2 * this.rand();
|
|
3381
3381
|
return {
|
|
@@ -3384,70 +3384,70 @@ class $e {
|
|
|
3384
3384
|
d: 0
|
|
3385
3385
|
};
|
|
3386
3386
|
}
|
|
3387
|
-
const a = Math.sqrt(n), h = s / a, d =
|
|
3387
|
+
const a = Math.sqrt(n), h = s / a, d = o / a;
|
|
3388
3388
|
return { ex: h, ey: d, d: a };
|
|
3389
3389
|
}
|
|
3390
3390
|
}
|
|
3391
|
-
const
|
|
3391
|
+
const Oe = (r) => {
|
|
3392
3392
|
if (r.distance === 0)
|
|
3393
3393
|
return r.maxForce;
|
|
3394
3394
|
const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
|
|
3395
3395
|
return Math.min(e, r.maxForce);
|
|
3396
3396
|
};
|
|
3397
|
-
class
|
|
3397
|
+
class Kt {
|
|
3398
3398
|
constructor(e) {
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3399
|
+
i(this, "nodeCharge");
|
|
3400
|
+
i(this, "distanceVectorGenerator");
|
|
3401
|
+
i(this, "maxForce");
|
|
3402
3402
|
this.nodeCharge = e.nodeCharge, this.distanceVectorGenerator = e.distanceVectorGenerator, this.maxForce = e.maxForce;
|
|
3403
3403
|
}
|
|
3404
3404
|
apply(e, t) {
|
|
3405
|
-
const s = Array.from(t.keys()),
|
|
3406
|
-
for (let n = 0; n <
|
|
3405
|
+
const s = Array.from(t.keys()), o = s.length;
|
|
3406
|
+
for (let n = 0; n < o; n++) {
|
|
3407
3407
|
const a = s[n];
|
|
3408
|
-
for (let h = n + 1; h <
|
|
3408
|
+
for (let h = n + 1; h < o; h++) {
|
|
3409
3409
|
const d = s[h], c = e.get(a), g = e.get(d), l = this.distanceVectorGenerator.create(
|
|
3410
3410
|
c,
|
|
3411
3411
|
g
|
|
3412
|
-
), u =
|
|
3412
|
+
), u = Oe({
|
|
3413
3413
|
coefficient: 1,
|
|
3414
3414
|
sourceCharge: this.nodeCharge,
|
|
3415
3415
|
targetCharge: this.nodeCharge,
|
|
3416
3416
|
distance: l.d,
|
|
3417
3417
|
maxForce: this.maxForce
|
|
3418
|
-
}),
|
|
3419
|
-
|
|
3418
|
+
}), w = u * l.ex, f = u * l.ey, v = t.get(a), S = t.get(d);
|
|
3419
|
+
v.x -= w, v.y -= f, S.x += w, S.y += f;
|
|
3420
3420
|
}
|
|
3421
3421
|
}
|
|
3422
3422
|
}
|
|
3423
3423
|
}
|
|
3424
|
-
const
|
|
3424
|
+
const Qt = (r) => {
|
|
3425
3425
|
if (r.size === 0)
|
|
3426
3426
|
return {
|
|
3427
3427
|
centerX: 0,
|
|
3428
3428
|
centerY: 0,
|
|
3429
3429
|
radius: 0
|
|
3430
3430
|
};
|
|
3431
|
-
let e = 1 / 0, t = -1 / 0, s = 1 / 0,
|
|
3431
|
+
let e = 1 / 0, t = -1 / 0, s = 1 / 0, o = -1 / 0;
|
|
3432
3432
|
r.forEach((d) => {
|
|
3433
|
-
e = Math.min(e, d.x), t = Math.max(t, d.x), s = Math.min(s, d.y),
|
|
3433
|
+
e = Math.min(e, d.x), t = Math.max(t, d.x), s = Math.min(s, d.y), o = Math.max(o, d.y);
|
|
3434
3434
|
});
|
|
3435
|
-
const n = t - e, a =
|
|
3435
|
+
const n = t - e, a = o - s, h = Math.max(n, a);
|
|
3436
3436
|
return {
|
|
3437
3437
|
centerX: (e + t) / 2,
|
|
3438
|
-
centerY: (s +
|
|
3438
|
+
centerY: (s + o) / 2,
|
|
3439
3439
|
radius: h / 2
|
|
3440
3440
|
};
|
|
3441
3441
|
};
|
|
3442
|
-
class
|
|
3442
|
+
class Zt {
|
|
3443
3443
|
constructor(e) {
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3444
|
+
i(this, "root");
|
|
3445
|
+
i(this, "leaves", /* @__PURE__ */ new Map());
|
|
3446
|
+
i(this, "coords");
|
|
3447
|
+
i(this, "areaRadiusThreshold");
|
|
3448
|
+
i(this, "nodeMass");
|
|
3449
|
+
i(this, "nodeCharge");
|
|
3450
|
+
i(this, "sortedParentNodes", []);
|
|
3451
3451
|
this.coords = e.coords, this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.root = {
|
|
3452
3452
|
nodeIds: new Set(e.coords.keys()),
|
|
3453
3453
|
box: e.box,
|
|
@@ -3467,16 +3467,16 @@ class Qt {
|
|
|
3467
3467
|
for (; t.length > 0; ) {
|
|
3468
3468
|
const s = [];
|
|
3469
3469
|
for (; t.length > 0; ) {
|
|
3470
|
-
const
|
|
3471
|
-
this.processNode(
|
|
3470
|
+
const o = t.pop();
|
|
3471
|
+
this.processNode(o).forEach((a) => {
|
|
3472
3472
|
s.push(a);
|
|
3473
3473
|
});
|
|
3474
3474
|
}
|
|
3475
3475
|
t = s;
|
|
3476
3476
|
}
|
|
3477
3477
|
this.sortedParentNodes.reverse().forEach((s) => {
|
|
3478
|
-
let
|
|
3479
|
-
s.lb !== null && (a += s.lb.totalMass, h += s.lb.totalCharge,
|
|
3478
|
+
let o = 0, n = 0, a = 0, h = 0;
|
|
3479
|
+
s.lb !== null && (a += s.lb.totalMass, h += s.lb.totalCharge, o += s.lb.chargeCenter.x * s.lb.totalCharge, n += s.lb.chargeCenter.y * s.lb.totalCharge), s.lt !== null && (a += s.lt.totalMass, h += s.lt.totalCharge, o += s.lt.chargeCenter.x * s.lt.totalCharge, n += s.lt.chargeCenter.y * s.lt.totalCharge), s.rb !== null && (a += s.rb.totalMass, h += s.rb.totalCharge, o += s.rb.chargeCenter.x * s.rb.totalCharge, n += s.rb.chargeCenter.y * s.rb.totalCharge), s.rt !== null && (a += s.rt.totalMass, h += s.rt.totalCharge, o += s.rt.chargeCenter.x * s.rt.totalCharge, n += s.rt.chargeCenter.y * s.rt.totalCharge), s.totalMass = a, s.totalCharge = h, s.chargeCenter.x = o / h, s.chargeCenter.y = n / h;
|
|
3480
3480
|
});
|
|
3481
3481
|
}
|
|
3482
3482
|
getRoot() {
|
|
@@ -3488,14 +3488,14 @@ class Qt {
|
|
|
3488
3488
|
processNode(e) {
|
|
3489
3489
|
if (e.nodeIds.size < 2)
|
|
3490
3490
|
return this.setLeaf(e), [];
|
|
3491
|
-
const { centerX: t, centerY: s, radius:
|
|
3492
|
-
if (
|
|
3491
|
+
const { centerX: t, centerY: s, radius: o } = e.box;
|
|
3492
|
+
if (o < this.areaRadiusThreshold)
|
|
3493
3493
|
return this.setLeaf(e), [];
|
|
3494
3494
|
this.sortedParentNodes.push(e);
|
|
3495
|
-
const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c =
|
|
3495
|
+
const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = o / 2;
|
|
3496
3496
|
e.nodeIds.forEach((u) => {
|
|
3497
|
-
const { x:
|
|
3498
|
-
|
|
3497
|
+
const { x: w, y: f } = this.coords.get(u);
|
|
3498
|
+
w < t ? f < s ? d.add(u) : h.add(u) : f < s ? a.add(u) : n.add(u), e.nodeIds.delete(u);
|
|
3499
3499
|
});
|
|
3500
3500
|
const g = {
|
|
3501
3501
|
parent: e,
|
|
@@ -3590,25 +3590,25 @@ class Qt {
|
|
|
3590
3590
|
y: 0
|
|
3591
3591
|
};
|
|
3592
3592
|
let t = 0, s = 0;
|
|
3593
|
-
return e.forEach((
|
|
3594
|
-
const n = this.coords.get(
|
|
3593
|
+
return e.forEach((o) => {
|
|
3594
|
+
const n = this.coords.get(o);
|
|
3595
3595
|
t += n.x, s += n.y;
|
|
3596
3596
|
}), { x: t / e.size, y: s / e.size };
|
|
3597
3597
|
}
|
|
3598
3598
|
}
|
|
3599
|
-
class
|
|
3599
|
+
class Jt {
|
|
3600
3600
|
constructor(e) {
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3601
|
+
i(this, "areaRadiusThreshold");
|
|
3602
|
+
i(this, "nodeMass");
|
|
3603
|
+
i(this, "nodeCharge");
|
|
3604
|
+
i(this, "theta");
|
|
3605
|
+
i(this, "distanceVectorGenerator");
|
|
3606
|
+
i(this, "nodeForceCoefficient");
|
|
3607
|
+
i(this, "maxForce");
|
|
3608
3608
|
this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.theta = e.theta, this.distanceVectorGenerator = e.distanceVectorGenerator, this.nodeForceCoefficient = e.nodeForceCoefficient, this.maxForce = e.maxForce;
|
|
3609
3609
|
}
|
|
3610
3610
|
apply(e, t) {
|
|
3611
|
-
const s =
|
|
3611
|
+
const s = Qt(e), o = new Zt({
|
|
3612
3612
|
box: s,
|
|
3613
3613
|
coords: e,
|
|
3614
3614
|
areaRadiusThreshold: this.areaRadiusThreshold,
|
|
@@ -3617,7 +3617,7 @@ class Zt {
|
|
|
3617
3617
|
});
|
|
3618
3618
|
e.forEach((n, a) => {
|
|
3619
3619
|
const h = this.calculateForceForNode(
|
|
3620
|
-
|
|
3620
|
+
o.getLeaf(a),
|
|
3621
3621
|
a,
|
|
3622
3622
|
e
|
|
3623
3623
|
), d = t.get(a);
|
|
@@ -3625,14 +3625,14 @@ class Zt {
|
|
|
3625
3625
|
});
|
|
3626
3626
|
}
|
|
3627
3627
|
calculateForceForNode(e, t, s) {
|
|
3628
|
-
const
|
|
3628
|
+
const o = s.get(t), n = { x: 0, y: 0 };
|
|
3629
3629
|
e.nodeIds.forEach((h) => {
|
|
3630
3630
|
if (h !== t) {
|
|
3631
3631
|
const d = s.get(h), c = this.calculateNodeRepulsiveForce({
|
|
3632
3632
|
sourceCharge: this.nodeCharge,
|
|
3633
3633
|
targetCharge: this.nodeCharge,
|
|
3634
3634
|
sourceCoords: d,
|
|
3635
|
-
targetCoords:
|
|
3635
|
+
targetCoords: o
|
|
3636
3636
|
});
|
|
3637
3637
|
this.applyForce(n, c);
|
|
3638
3638
|
}
|
|
@@ -3643,49 +3643,49 @@ class Zt {
|
|
|
3643
3643
|
if (h !== null) {
|
|
3644
3644
|
const d = this.distanceVectorGenerator.create(
|
|
3645
3645
|
h.chargeCenter,
|
|
3646
|
-
|
|
3646
|
+
o
|
|
3647
3647
|
);
|
|
3648
3648
|
h.box.radius * 2 < d.d * this.theta ? (this.tryApplyFarForce({
|
|
3649
3649
|
totalForce: n,
|
|
3650
|
-
targetCoords:
|
|
3650
|
+
targetCoords: o,
|
|
3651
3651
|
target: h.lb,
|
|
3652
3652
|
current: a
|
|
3653
3653
|
}), this.tryApplyFarForce({
|
|
3654
3654
|
totalForce: n,
|
|
3655
|
-
targetCoords:
|
|
3655
|
+
targetCoords: o,
|
|
3656
3656
|
target: h.rb,
|
|
3657
3657
|
current: a
|
|
3658
3658
|
}), this.tryApplyFarForce({
|
|
3659
3659
|
totalForce: n,
|
|
3660
|
-
targetCoords:
|
|
3660
|
+
targetCoords: o,
|
|
3661
3661
|
target: h.rt,
|
|
3662
3662
|
current: a
|
|
3663
3663
|
}), this.tryApplyFarForce({
|
|
3664
3664
|
totalForce: n,
|
|
3665
|
-
targetCoords:
|
|
3665
|
+
targetCoords: o,
|
|
3666
3666
|
target: h.lt,
|
|
3667
3667
|
current: a
|
|
3668
3668
|
})) : (this.tryApplyNearForce({
|
|
3669
3669
|
totalForce: n,
|
|
3670
|
-
targetCoords:
|
|
3670
|
+
targetCoords: o,
|
|
3671
3671
|
target: h.lb,
|
|
3672
3672
|
current: a,
|
|
3673
3673
|
nodesCoords: s
|
|
3674
3674
|
}), this.tryApplyNearForce({
|
|
3675
3675
|
totalForce: n,
|
|
3676
|
-
targetCoords:
|
|
3676
|
+
targetCoords: o,
|
|
3677
3677
|
target: h.rb,
|
|
3678
3678
|
current: a,
|
|
3679
3679
|
nodesCoords: s
|
|
3680
3680
|
}), this.tryApplyNearForce({
|
|
3681
3681
|
totalForce: n,
|
|
3682
|
-
targetCoords:
|
|
3682
|
+
targetCoords: o,
|
|
3683
3683
|
target: h.rt,
|
|
3684
3684
|
current: a,
|
|
3685
3685
|
nodesCoords: s
|
|
3686
3686
|
}), this.tryApplyNearForce({
|
|
3687
3687
|
totalForce: n,
|
|
3688
|
-
targetCoords:
|
|
3688
|
+
targetCoords: o,
|
|
3689
3689
|
target: h.lt,
|
|
3690
3690
|
current: a,
|
|
3691
3691
|
nodesCoords: s
|
|
@@ -3696,7 +3696,7 @@ class Zt {
|
|
|
3696
3696
|
return n;
|
|
3697
3697
|
}
|
|
3698
3698
|
calculateExactForce(e, t, s) {
|
|
3699
|
-
const
|
|
3699
|
+
const o = { x: 0, y: 0 }, n = [e];
|
|
3700
3700
|
for (; n.length > 0; ) {
|
|
3701
3701
|
const a = n.pop();
|
|
3702
3702
|
a.nodeIds.forEach((h) => {
|
|
@@ -3706,10 +3706,10 @@ class Zt {
|
|
|
3706
3706
|
sourceCoords: d,
|
|
3707
3707
|
targetCoords: t
|
|
3708
3708
|
});
|
|
3709
|
-
this.applyForce(
|
|
3709
|
+
this.applyForce(o, c);
|
|
3710
3710
|
}), a.lb !== null && n.push(a.lb), a.rb !== null && n.push(a.rb), a.lt !== null && n.push(a.lt), a.rt !== null && n.push(a.rt);
|
|
3711
3711
|
}
|
|
3712
|
-
return
|
|
3712
|
+
return o;
|
|
3713
3713
|
}
|
|
3714
3714
|
calculateApproximateForce(e, t) {
|
|
3715
3715
|
return this.calculateNodeRepulsiveForce({
|
|
@@ -3723,7 +3723,7 @@ class Zt {
|
|
|
3723
3723
|
const t = this.distanceVectorGenerator.create(
|
|
3724
3724
|
e.sourceCoords,
|
|
3725
3725
|
e.targetCoords
|
|
3726
|
-
), s =
|
|
3726
|
+
), s = Oe({
|
|
3727
3727
|
coefficient: this.nodeForceCoefficient,
|
|
3728
3728
|
sourceCharge: e.sourceCharge,
|
|
3729
3729
|
targetCharge: e.targetCharge,
|
|
@@ -3758,7 +3758,7 @@ class Zt {
|
|
|
3758
3758
|
}
|
|
3759
3759
|
}
|
|
3760
3760
|
}
|
|
3761
|
-
const
|
|
3761
|
+
const We = (r) => r.theta !== 0 ? new Jt({
|
|
3762
3762
|
nodeCharge: r.nodeCharge,
|
|
3763
3763
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3764
3764
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
@@ -3766,44 +3766,47 @@ const Oe = (r) => r.theta !== 0 ? new Zt({
|
|
|
3766
3766
|
theta: r.theta,
|
|
3767
3767
|
nodeMass: r.nodeMass,
|
|
3768
3768
|
areaRadiusThreshold: r.areaRadiusThreshold
|
|
3769
|
-
}) : new
|
|
3769
|
+
}) : new Kt({
|
|
3770
3770
|
nodeCharge: r.nodeCharge,
|
|
3771
3771
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3772
3772
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
3773
3773
|
maxForce: r.maxForce
|
|
3774
3774
|
});
|
|
3775
|
-
class
|
|
3775
|
+
class ze {
|
|
3776
3776
|
constructor(e) {
|
|
3777
|
-
|
|
3778
|
-
|
|
3777
|
+
i(this, "rand");
|
|
3778
|
+
i(this, "sparsity");
|
|
3779
3779
|
this.rand = e.rand, this.sparsity = e.sparsity;
|
|
3780
3780
|
}
|
|
3781
3781
|
calculateCoordinates(e) {
|
|
3782
|
-
const { graph: t, viewport: s } = e,
|
|
3782
|
+
const { graph: t, viewport: s } = e, o = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((f) => {
|
|
3783
|
+
const v = t.getNode(f);
|
|
3784
|
+
return v.x === null || v.y === null;
|
|
3785
|
+
}), a = Math.sqrt(n.length) * this.sparsity, { width: h, height: d } = s.getDimensions(), c = { x: h / 2, y: d / 2 }, g = s.createContentCoords(c), l = a / 2, u = {
|
|
3783
3786
|
x: g.x - l,
|
|
3784
3787
|
y: g.y - l
|
|
3785
3788
|
};
|
|
3786
|
-
return
|
|
3787
|
-
const
|
|
3788
|
-
|
|
3789
|
-
x:
|
|
3790
|
-
y:
|
|
3789
|
+
return t.getAllNodeIds().forEach((f) => {
|
|
3790
|
+
const v = t.getNode(f);
|
|
3791
|
+
o.set(f, {
|
|
3792
|
+
x: v.x ?? u.x + a * this.rand(),
|
|
3793
|
+
y: v.y ?? u.y + a * this.rand()
|
|
3791
3794
|
});
|
|
3792
|
-
}),
|
|
3795
|
+
}), o;
|
|
3793
3796
|
}
|
|
3794
3797
|
}
|
|
3795
|
-
class
|
|
3798
|
+
class _t {
|
|
3796
3799
|
constructor(e) {
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new
|
|
3800
|
+
i(this, "distanceVectorGenerator");
|
|
3801
|
+
i(this, "nodeForcesApplicationStrategy");
|
|
3802
|
+
i(this, "fillerLayoutAlgorithm");
|
|
3803
|
+
i(this, "maxIterations");
|
|
3804
|
+
i(this, "dtSec");
|
|
3805
|
+
i(this, "nodeMass");
|
|
3806
|
+
i(this, "edgeEquilibriumLength");
|
|
3807
|
+
i(this, "edgeStiffness");
|
|
3808
|
+
i(this, "convergenceVelocity");
|
|
3809
|
+
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new Ue(e.rand), this.nodeForcesApplicationStrategy = We({
|
|
3807
3810
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
3808
3811
|
nodeCharge: e.nodeCharge,
|
|
3809
3812
|
maxForce: e.maxForce,
|
|
@@ -3811,19 +3814,19 @@ class Jt {
|
|
|
3811
3814
|
theta: e.barnesHutTheta,
|
|
3812
3815
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
3813
3816
|
nodeMass: e.nodeMass
|
|
3814
|
-
}), this.fillerLayoutAlgorithm = new
|
|
3817
|
+
}), this.fillerLayoutAlgorithm = new ze({
|
|
3815
3818
|
rand: e.rand,
|
|
3816
3819
|
sparsity: e.edgeEquilibriumLength
|
|
3817
3820
|
});
|
|
3818
3821
|
}
|
|
3819
3822
|
calculateCoordinates(e) {
|
|
3820
|
-
const { graph: t, viewport: s } = e,
|
|
3823
|
+
const { graph: t, viewport: s } = e, o = this.fillerLayoutAlgorithm.calculateCoordinates({
|
|
3821
3824
|
graph: t,
|
|
3822
3825
|
viewport: s
|
|
3823
3826
|
});
|
|
3824
|
-
for (let n = 0; n < this.maxIterations && !(new
|
|
3827
|
+
for (let n = 0; n < this.maxIterations && !(new $e(
|
|
3825
3828
|
t,
|
|
3826
|
-
|
|
3829
|
+
o,
|
|
3827
3830
|
{
|
|
3828
3831
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
3829
3832
|
nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
|
|
@@ -3834,13 +3837,13 @@ class Jt {
|
|
|
3834
3837
|
}
|
|
3835
3838
|
).apply() < this.convergenceVelocity); n++)
|
|
3836
3839
|
;
|
|
3837
|
-
return
|
|
3840
|
+
return o;
|
|
3838
3841
|
}
|
|
3839
3842
|
}
|
|
3840
|
-
class
|
|
3843
|
+
class er {
|
|
3841
3844
|
constructor(e) {
|
|
3842
|
-
|
|
3843
|
-
|
|
3845
|
+
i(this, "forest", /* @__PURE__ */ new Set());
|
|
3846
|
+
i(this, "remainingNodeIds");
|
|
3844
3847
|
for (this.graph = e, this.remainingNodeIds = new Set(this.graph.getAllNodeIds()); this.remainingNodeIds.size > 0; ) {
|
|
3845
3848
|
const [t] = this.remainingNodeIds;
|
|
3846
3849
|
this.traverse(t);
|
|
@@ -3855,10 +3858,10 @@ class _t {
|
|
|
3855
3858
|
children: /* @__PURE__ */ new Set()
|
|
3856
3859
|
}, s = [];
|
|
3857
3860
|
this.forest.add({ root: t, sequence: s });
|
|
3858
|
-
let
|
|
3859
|
-
for (;
|
|
3861
|
+
let o = [t];
|
|
3862
|
+
for (; o.length > 0; ) {
|
|
3860
3863
|
const n = [];
|
|
3861
|
-
|
|
3864
|
+
o.forEach((a) => {
|
|
3862
3865
|
s.push(a), this.remainingNodeIds.delete(a.nodeId);
|
|
3863
3866
|
const h = this.graph.getNodeOutgoingEdgeIds(a.nodeId).map((g) => {
|
|
3864
3867
|
const l = this.graph.getEdge(g);
|
|
@@ -3876,52 +3879,52 @@ class _t {
|
|
|
3876
3879
|
};
|
|
3877
3880
|
a.children.add(l), n.push(l);
|
|
3878
3881
|
});
|
|
3879
|
-
}),
|
|
3882
|
+
}), o = n;
|
|
3880
3883
|
}
|
|
3881
3884
|
}
|
|
3882
3885
|
}
|
|
3883
|
-
class
|
|
3886
|
+
class tr {
|
|
3884
3887
|
constructor(e) {
|
|
3885
|
-
|
|
3888
|
+
i(this, "baseRadius");
|
|
3886
3889
|
this.baseRadius = e.radius;
|
|
3887
3890
|
}
|
|
3888
3891
|
resolve(e) {
|
|
3889
3892
|
let t = 0, s = -1 / 0;
|
|
3890
|
-
const
|
|
3893
|
+
const o = [];
|
|
3891
3894
|
e.forEach((h) => {
|
|
3892
|
-
h === null ? (t += this.baseRadius,
|
|
3895
|
+
h === null ? (t += this.baseRadius, o.push(t), t += this.baseRadius) : t + this.baseRadius - h < s ? (s += h, o.push(s), t = s + this.baseRadius, s += h) : (t += this.baseRadius, o.push(t), s = t + h, t += this.baseRadius);
|
|
3893
3896
|
});
|
|
3894
3897
|
const n = t / 2;
|
|
3895
3898
|
let a = 0;
|
|
3896
3899
|
if (e.length > 0) {
|
|
3897
|
-
const h = e[e.length - 1] ?? 0, d =
|
|
3900
|
+
const h = e[e.length - 1] ?? 0, d = o[o.length - 1];
|
|
3898
3901
|
a = Math.max(
|
|
3899
3902
|
a,
|
|
3900
3903
|
d + h - t
|
|
3901
3904
|
);
|
|
3902
|
-
const c = e[0] ?? 0, g =
|
|
3905
|
+
const c = e[0] ?? 0, g = o[0];
|
|
3903
3906
|
a = Math.max(a, c - g);
|
|
3904
3907
|
}
|
|
3905
3908
|
return {
|
|
3906
|
-
offsets:
|
|
3909
|
+
offsets: o.map((h) => h - n),
|
|
3907
3910
|
radius: n + a
|
|
3908
3911
|
};
|
|
3909
3912
|
}
|
|
3910
3913
|
}
|
|
3911
|
-
class
|
|
3914
|
+
class rr {
|
|
3912
3915
|
constructor(e, t) {
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
this.tree = e, this.layerNodePlacementResolver = new
|
|
3916
|
+
i(this, "offsets", /* @__PURE__ */ new Map());
|
|
3917
|
+
i(this, "childrenRadii", /* @__PURE__ */ new Map());
|
|
3918
|
+
i(this, "layerNodePlacementResolver");
|
|
3919
|
+
this.tree = e, this.layerNodePlacementResolver = new tr({
|
|
3917
3920
|
radius: t.spaceAroundRadius
|
|
3918
3921
|
}), [...this.tree.sequence].reverse().forEach((s) => {
|
|
3919
3922
|
if (s.children.size === 0)
|
|
3920
3923
|
this.childrenRadii.set(s.nodeId, null);
|
|
3921
3924
|
else {
|
|
3922
|
-
const
|
|
3925
|
+
const o = Array.from(s.children).map(
|
|
3923
3926
|
(h) => this.childrenRadii.get(h.nodeId)
|
|
3924
|
-
), n = this.layerNodePlacementResolver.resolve(
|
|
3927
|
+
), n = this.layerNodePlacementResolver.resolve(o);
|
|
3925
3928
|
this.childrenRadii.set(s.nodeId, n.radius);
|
|
3926
3929
|
let a = 0;
|
|
3927
3930
|
s.children.forEach((h) => {
|
|
@@ -3934,16 +3937,16 @@ class tr {
|
|
|
3934
3937
|
return this.offsets;
|
|
3935
3938
|
}
|
|
3936
3939
|
}
|
|
3937
|
-
class
|
|
3940
|
+
class sr {
|
|
3938
3941
|
constructor(e) {
|
|
3939
3942
|
this.params = e;
|
|
3940
3943
|
}
|
|
3941
3944
|
calculateCoordinates(e) {
|
|
3942
|
-
const t = /* @__PURE__ */ new Map(),
|
|
3945
|
+
const t = /* @__PURE__ */ new Map(), o = new er(e.graph).generate();
|
|
3943
3946
|
let n = 0;
|
|
3944
|
-
return
|
|
3947
|
+
return o.forEach((a) => {
|
|
3945
3948
|
t.set(a.root.nodeId, { x: n, y: 0 });
|
|
3946
|
-
const d = new
|
|
3949
|
+
const d = new rr(a, {
|
|
3947
3950
|
spaceAroundRadius: this.params.layerSpace / 2
|
|
3948
3951
|
}).generate();
|
|
3949
3952
|
let c = [a.root];
|
|
@@ -3951,28 +3954,31 @@ class rr {
|
|
|
3951
3954
|
const g = [];
|
|
3952
3955
|
n += this.params.layerWidth, c.forEach((l) => {
|
|
3953
3956
|
l.children.forEach((u) => {
|
|
3954
|
-
const
|
|
3957
|
+
const w = t.get(l.nodeId).y;
|
|
3955
3958
|
t.set(u.nodeId, {
|
|
3956
|
-
y:
|
|
3959
|
+
y: w + d.get(u.nodeId),
|
|
3957
3960
|
x: n
|
|
3958
3961
|
}), g.push(u);
|
|
3959
3962
|
});
|
|
3960
3963
|
}), c = g;
|
|
3961
3964
|
}
|
|
3965
|
+
}), t.forEach((a) => {
|
|
3966
|
+
const h = this.params.transform(a);
|
|
3967
|
+
a.x = h.x, a.y = h.y;
|
|
3962
3968
|
}), t;
|
|
3963
3969
|
}
|
|
3964
3970
|
}
|
|
3965
|
-
class
|
|
3971
|
+
class or {
|
|
3966
3972
|
constructor(e) {
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new
|
|
3973
|
+
i(this, "distanceVectorGenerator");
|
|
3974
|
+
i(this, "nodeForcesApplicationStrategy");
|
|
3975
|
+
i(this, "convergenceVelocity");
|
|
3976
|
+
i(this, "maxTimeDeltaSec");
|
|
3977
|
+
i(this, "nodeMass");
|
|
3978
|
+
i(this, "edgeEquilibriumLength");
|
|
3979
|
+
i(this, "edgeStiffness");
|
|
3980
|
+
i(this, "fillerLayoutAlgorithm");
|
|
3981
|
+
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new Ue(e.rand), this.nodeForcesApplicationStrategy = We({
|
|
3976
3982
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
3977
3983
|
nodeCharge: e.nodeCharge,
|
|
3978
3984
|
maxForce: e.maxForce,
|
|
@@ -3980,23 +3986,23 @@ class sr {
|
|
|
3980
3986
|
theta: e.barnesHutTheta,
|
|
3981
3987
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
3982
3988
|
nodeMass: e.nodeMass
|
|
3983
|
-
}), this.fillerLayoutAlgorithm = new
|
|
3989
|
+
}), this.fillerLayoutAlgorithm = new ze({
|
|
3984
3990
|
rand: e.rand,
|
|
3985
3991
|
sparsity: e.edgeEquilibriumLength
|
|
3986
3992
|
});
|
|
3987
3993
|
}
|
|
3988
3994
|
calculateNextCoordinates(e) {
|
|
3989
|
-
const { graph: t, viewport: s, dt:
|
|
3995
|
+
const { graph: t, viewport: s, dt: o } = e, n = this.fillerLayoutAlgorithm.calculateCoordinates({
|
|
3990
3996
|
graph: t,
|
|
3991
3997
|
viewport: s
|
|
3992
3998
|
});
|
|
3993
|
-
return new
|
|
3999
|
+
return new $e(
|
|
3994
4000
|
t,
|
|
3995
4001
|
n,
|
|
3996
4002
|
{
|
|
3997
4003
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
3998
4004
|
nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
|
|
3999
|
-
dtSec: Math.min(
|
|
4005
|
+
dtSec: Math.min(o, this.maxTimeDeltaSec),
|
|
4000
4006
|
nodeMass: this.nodeMass,
|
|
4001
4007
|
edgeEquilibriumLength: this.edgeEquilibriumLength,
|
|
4002
4008
|
edgeStiffness: this.edgeStiffness
|
|
@@ -4007,16 +4013,16 @@ class sr {
|
|
|
4007
4013
|
}) ? /* @__PURE__ */ new Map() : n;
|
|
4008
4014
|
}
|
|
4009
4015
|
}
|
|
4010
|
-
const
|
|
4011
|
-
let e = 1779033703, t = 3144134277, s = 1013904242,
|
|
4016
|
+
const ke = (r) => {
|
|
4017
|
+
let e = 1779033703, t = 3144134277, s = 1013904242, o = 2773480762;
|
|
4012
4018
|
for (let n = 0, a; n < r.length; n++)
|
|
4013
|
-
a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = s ^ Math.imul(t ^ a, 2869860233), s =
|
|
4014
|
-
return e = Math.imul(s ^ e >>> 18, 597399067), t = Math.imul(
|
|
4015
|
-
},
|
|
4019
|
+
a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = s ^ Math.imul(t ^ a, 2869860233), s = o ^ Math.imul(s ^ a, 951274213), o = e ^ Math.imul(o ^ a, 2716044179);
|
|
4020
|
+
return e = Math.imul(s ^ e >>> 18, 597399067), t = Math.imul(o ^ t >>> 22, 2869860233), s = Math.imul(e ^ s >>> 17, 951274213), o = Math.imul(t ^ o >>> 19, 2716044179), e ^= t ^ s ^ o, t ^= e, s ^= e, o ^= e, [e >>> 0, t >>> 0, s >>> 0, o >>> 0];
|
|
4021
|
+
}, He = (r, e, t, s) => function() {
|
|
4016
4022
|
r |= 0, e |= 0, t |= 0, s |= 0;
|
|
4017
|
-
const
|
|
4018
|
-
return s = s + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t +
|
|
4019
|
-
},
|
|
4023
|
+
const o = (r + e | 0) + s | 0;
|
|
4024
|
+
return s = s + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + o | 0, (o >>> 0) / 4294967296;
|
|
4025
|
+
}, A = Object.freeze({
|
|
4020
4026
|
seed: "HTMLGraph is awesome",
|
|
4021
4027
|
maxTimeDeltaSec: 0.01,
|
|
4022
4028
|
nodeCharge: 1e5,
|
|
@@ -4030,43 +4036,43 @@ const ze = (r) => {
|
|
|
4030
4036
|
nodeForceCoefficient: 1,
|
|
4031
4037
|
barnesHutAreaRadiusThreshold: 0.01,
|
|
4032
4038
|
barnesHutTheta: 1
|
|
4033
|
-
}),
|
|
4039
|
+
}), ir = (r) => {
|
|
4034
4040
|
var e, t;
|
|
4035
4041
|
switch (r == null ? void 0 : r.type) {
|
|
4036
4042
|
case "custom":
|
|
4037
4043
|
return r.instance;
|
|
4038
4044
|
default: {
|
|
4039
|
-
const s =
|
|
4040
|
-
return new
|
|
4041
|
-
rand:
|
|
4042
|
-
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ??
|
|
4043
|
-
nodeCharge: (r == null ? void 0 : r.nodeCharge) ??
|
|
4044
|
-
nodeMass: (r == null ? void 0 : r.nodeMass) ??
|
|
4045
|
-
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ??
|
|
4046
|
-
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ??
|
|
4047
|
-
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ??
|
|
4048
|
-
maxForce: (r == null ? void 0 : r.maxForce) ??
|
|
4049
|
-
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ??
|
|
4050
|
-
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ??
|
|
4051
|
-
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ??
|
|
4045
|
+
const s = ke((r == null ? void 0 : r.seed) ?? A.seed), o = He(s[0], s[1], s[2], s[3]);
|
|
4046
|
+
return new or({
|
|
4047
|
+
rand: o,
|
|
4048
|
+
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? A.maxTimeDeltaSec,
|
|
4049
|
+
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? A.nodeCharge,
|
|
4050
|
+
nodeMass: (r == null ? void 0 : r.nodeMass) ?? A.nodeMass,
|
|
4051
|
+
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? A.edgeEquilibriumLength,
|
|
4052
|
+
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? A.edgeStiffness,
|
|
4053
|
+
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? A.convergenceVelocity,
|
|
4054
|
+
maxForce: (r == null ? void 0 : r.maxForce) ?? A.maxForce,
|
|
4055
|
+
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? A.nodeForceCoefficient,
|
|
4056
|
+
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? A.barnesHutTheta,
|
|
4057
|
+
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? A.barnesHutAreaRadiusThreshold
|
|
4052
4058
|
});
|
|
4053
4059
|
}
|
|
4054
4060
|
}
|
|
4055
|
-
},
|
|
4061
|
+
}, j = {
|
|
4056
4062
|
staticNodeResolver: () => !1,
|
|
4057
4063
|
onBeforeApplied: () => {
|
|
4058
4064
|
},
|
|
4059
4065
|
onAfterApplied: () => {
|
|
4060
4066
|
}
|
|
4061
|
-
},
|
|
4067
|
+
}, nr = (r) => {
|
|
4062
4068
|
var t, s;
|
|
4063
4069
|
return {
|
|
4064
|
-
algorithm:
|
|
4065
|
-
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ??
|
|
4066
|
-
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ??
|
|
4067
|
-
onAfterApplied: ((s = r == null ? void 0 : r.events) == null ? void 0 : s.onAfterApplied) ??
|
|
4070
|
+
algorithm: ir((r == null ? void 0 : r.algorithm) ?? {}),
|
|
4071
|
+
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? j.staticNodeResolver,
|
|
4072
|
+
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? j.onBeforeApplied,
|
|
4073
|
+
onAfterApplied: ((s = r == null ? void 0 : r.events) == null ? void 0 : s.onAfterApplied) ?? j.onAfterApplied
|
|
4068
4074
|
};
|
|
4069
|
-
},
|
|
4075
|
+
}, ar = (r) => r instanceof Q ? {
|
|
4070
4076
|
type: "manual",
|
|
4071
4077
|
trigger: r
|
|
4072
4078
|
} : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
|
|
@@ -4083,44 +4089,177 @@ const ze = (r) => {
|
|
|
4083
4089
|
layerWidth: 300,
|
|
4084
4090
|
layerSpace: 300
|
|
4085
4091
|
}
|
|
4086
|
-
}),
|
|
4092
|
+
}), $ = (r, e) => ({
|
|
4093
|
+
a: r.a * e.a + r.b * e.d,
|
|
4094
|
+
b: r.a * e.b + r.b * e.e,
|
|
4095
|
+
c: r.a * e.c + r.b * e.f + r.c,
|
|
4096
|
+
d: r.d * e.a + r.e * e.d,
|
|
4097
|
+
e: r.d * e.b + r.e * e.e,
|
|
4098
|
+
f: r.d * e.c + r.e * e.f + r.f
|
|
4099
|
+
}), hr = (r) => {
|
|
4100
|
+
const { a: e, b: t, c: s, d: o, e: n, f: a } = r, h = e * n - t * o;
|
|
4101
|
+
return {
|
|
4102
|
+
a: n / h,
|
|
4103
|
+
b: -t / h,
|
|
4104
|
+
c: (t * a - s * n) / h,
|
|
4105
|
+
d: -o / h,
|
|
4106
|
+
e: e / h,
|
|
4107
|
+
f: (s * o - e * a) / h
|
|
4108
|
+
};
|
|
4109
|
+
};
|
|
4110
|
+
class dr {
|
|
4111
|
+
resolve(e) {
|
|
4112
|
+
if ("shift" in e)
|
|
4113
|
+
return this.createShiftBaseMatrix(e.shift);
|
|
4114
|
+
if ("scale" in e) {
|
|
4115
|
+
const t = e.origin ?? { x: 0, y: 0 };
|
|
4116
|
+
return this.createScaleRelativeMatrix(e.scale, t);
|
|
4117
|
+
}
|
|
4118
|
+
if ("rotate" in e) {
|
|
4119
|
+
const t = e.origin ?? { x: 0, y: 0 };
|
|
4120
|
+
return this.createRotateRelativeMatrix(e.rotate, t);
|
|
4121
|
+
}
|
|
4122
|
+
if ("mirror" in e) {
|
|
4123
|
+
const t = e.origin ?? { x: 0, y: 0 };
|
|
4124
|
+
return this.createMirrorRelativeMatrix(e.mirror, t);
|
|
4125
|
+
}
|
|
4126
|
+
return {
|
|
4127
|
+
a: e.a ?? 1,
|
|
4128
|
+
b: e.b ?? 0,
|
|
4129
|
+
c: e.c ?? 0,
|
|
4130
|
+
d: e.d ?? 0,
|
|
4131
|
+
e: e.e ?? 1,
|
|
4132
|
+
f: e.f ?? 0
|
|
4133
|
+
};
|
|
4134
|
+
}
|
|
4135
|
+
createScaleRelativeMatrix(e, t) {
|
|
4136
|
+
const s = this.createScaleBaseMatrix(e), o = this.createShiftBaseMatrix(t);
|
|
4137
|
+
return this.createRelativeTransform(s, o);
|
|
4138
|
+
}
|
|
4139
|
+
createRotateRelativeMatrix(e, t) {
|
|
4140
|
+
const s = this.createRotateBaseMatrix(e), o = this.createShiftBaseMatrix(t);
|
|
4141
|
+
return this.createRelativeTransform(s, o);
|
|
4142
|
+
}
|
|
4143
|
+
createMirrorRelativeMatrix(e, t) {
|
|
4144
|
+
const s = this.createMirrorYBaseMatrix(), o = $(
|
|
4145
|
+
this.createShiftBaseMatrix(t),
|
|
4146
|
+
this.createRotateBaseMatrix(e)
|
|
4147
|
+
);
|
|
4148
|
+
return this.createRelativeTransform(s, o);
|
|
4149
|
+
}
|
|
4150
|
+
createRelativeTransform(e, t) {
|
|
4151
|
+
const s = $(
|
|
4152
|
+
t,
|
|
4153
|
+
e
|
|
4154
|
+
), o = hr(t);
|
|
4155
|
+
return $(s, o);
|
|
4156
|
+
}
|
|
4157
|
+
createShiftBaseMatrix(e) {
|
|
4158
|
+
return {
|
|
4159
|
+
a: 1,
|
|
4160
|
+
b: 0,
|
|
4161
|
+
c: e.x,
|
|
4162
|
+
d: 0,
|
|
4163
|
+
e: 1,
|
|
4164
|
+
f: e.y
|
|
4165
|
+
};
|
|
4166
|
+
}
|
|
4167
|
+
createScaleBaseMatrix(e) {
|
|
4168
|
+
return {
|
|
4169
|
+
a: e,
|
|
4170
|
+
b: 0,
|
|
4171
|
+
c: 0,
|
|
4172
|
+
d: 0,
|
|
4173
|
+
e,
|
|
4174
|
+
f: 0
|
|
4175
|
+
};
|
|
4176
|
+
}
|
|
4177
|
+
createRotateBaseMatrix(e) {
|
|
4178
|
+
const t = Math.sin(e), s = Math.cos(e);
|
|
4179
|
+
return {
|
|
4180
|
+
a: s,
|
|
4181
|
+
b: -t,
|
|
4182
|
+
c: 0,
|
|
4183
|
+
d: t,
|
|
4184
|
+
e: s,
|
|
4185
|
+
f: 0
|
|
4186
|
+
};
|
|
4187
|
+
}
|
|
4188
|
+
createMirrorYBaseMatrix() {
|
|
4189
|
+
return {
|
|
4190
|
+
a: 1,
|
|
4191
|
+
b: 0,
|
|
4192
|
+
c: 0,
|
|
4193
|
+
d: 0,
|
|
4194
|
+
e: -1,
|
|
4195
|
+
f: 0
|
|
4196
|
+
};
|
|
4197
|
+
}
|
|
4198
|
+
}
|
|
4199
|
+
const cr = (r) => {
|
|
4200
|
+
if (r === void 0)
|
|
4201
|
+
return (o) => o;
|
|
4202
|
+
if (typeof r == "function")
|
|
4203
|
+
return r;
|
|
4204
|
+
const e = Array.isArray(r) ? r : [r];
|
|
4205
|
+
let t = {
|
|
4206
|
+
a: 1,
|
|
4207
|
+
b: 0,
|
|
4208
|
+
c: 0,
|
|
4209
|
+
d: 0,
|
|
4210
|
+
e: 1,
|
|
4211
|
+
f: 0
|
|
4212
|
+
};
|
|
4213
|
+
const s = new dr();
|
|
4214
|
+
return e.forEach((o) => {
|
|
4215
|
+
const n = s.resolve(o);
|
|
4216
|
+
t = $(t, n);
|
|
4217
|
+
}), (o) => {
|
|
4218
|
+
const { x: n, y: a } = o;
|
|
4219
|
+
return {
|
|
4220
|
+
x: t.a * n + t.b * a + t.c,
|
|
4221
|
+
y: t.d * n + t.e * a + t.f
|
|
4222
|
+
};
|
|
4223
|
+
};
|
|
4224
|
+
}, lr = (r) => {
|
|
4087
4225
|
var e, t;
|
|
4088
4226
|
switch (r == null ? void 0 : r.type) {
|
|
4089
4227
|
case "custom":
|
|
4090
4228
|
return r.instance;
|
|
4091
4229
|
case "hierarchical":
|
|
4092
|
-
return new
|
|
4230
|
+
return new sr({
|
|
4093
4231
|
layerWidth: r.layerWidth ?? F.hierarchicalLayout.layerWidth,
|
|
4094
|
-
layerSpace: r.layerSpace ?? F.hierarchicalLayout.layerSpace
|
|
4232
|
+
layerSpace: r.layerSpace ?? F.hierarchicalLayout.layerSpace,
|
|
4233
|
+
transform: cr(r.transform)
|
|
4095
4234
|
});
|
|
4096
4235
|
default: {
|
|
4097
|
-
const s =
|
|
4098
|
-
return new
|
|
4099
|
-
dtSec: (r == null ? void 0 : r.dtSec) ??
|
|
4100
|
-
maxIterations: (r == null ? void 0 : r.maxIterations) ??
|
|
4101
|
-
rand:
|
|
4102
|
-
nodeCharge: (r == null ? void 0 : r.nodeCharge) ??
|
|
4103
|
-
nodeMass: (r == null ? void 0 : r.nodeMass) ??
|
|
4104
|
-
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ??
|
|
4105
|
-
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ??
|
|
4106
|
-
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ??
|
|
4107
|
-
maxForce: (r == null ? void 0 : r.maxForce) ??
|
|
4108
|
-
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ??
|
|
4109
|
-
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ??
|
|
4110
|
-
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ??
|
|
4236
|
+
const s = ke((r == null ? void 0 : r.seed) ?? A.seed), o = He(s[0], s[1], s[2], s[3]);
|
|
4237
|
+
return new _t({
|
|
4238
|
+
dtSec: (r == null ? void 0 : r.dtSec) ?? A.dtSec,
|
|
4239
|
+
maxIterations: (r == null ? void 0 : r.maxIterations) ?? A.maxIterations,
|
|
4240
|
+
rand: o,
|
|
4241
|
+
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? A.nodeCharge,
|
|
4242
|
+
nodeMass: (r == null ? void 0 : r.nodeMass) ?? A.nodeMass,
|
|
4243
|
+
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? A.edgeEquilibriumLength,
|
|
4244
|
+
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? A.edgeStiffness,
|
|
4245
|
+
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? A.convergenceVelocity,
|
|
4246
|
+
maxForce: (r == null ? void 0 : r.maxForce) ?? A.maxForce,
|
|
4247
|
+
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? A.nodeForceCoefficient,
|
|
4248
|
+
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? A.barnesHutTheta,
|
|
4249
|
+
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? A.barnesHutAreaRadiusThreshold
|
|
4111
4250
|
});
|
|
4112
4251
|
}
|
|
4113
4252
|
}
|
|
4114
|
-
},
|
|
4253
|
+
}, gr = (r) => {
|
|
4115
4254
|
var e, t;
|
|
4116
4255
|
return {
|
|
4117
|
-
algorithm:
|
|
4118
|
-
applyOn:
|
|
4256
|
+
algorithm: lr(r == null ? void 0 : r.algorithm),
|
|
4257
|
+
applyOn: ar(r == null ? void 0 : r.applyOn),
|
|
4119
4258
|
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? F.staticNodeResolver,
|
|
4120
4259
|
onBeforeApplied: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onBeforeApplied) ?? F.onBeforeApplied,
|
|
4121
4260
|
onAfterApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onAfterApplied) ?? F.onAfterApplied
|
|
4122
4261
|
};
|
|
4123
|
-
},
|
|
4262
|
+
}, ur = (r, e) => ({
|
|
4124
4263
|
...r,
|
|
4125
4264
|
onNodeDragStarted: (t) => {
|
|
4126
4265
|
e.add(t), r.onNodeDragStarted(t);
|
|
@@ -4128,44 +4267,44 @@ const ze = (r) => {
|
|
|
4128
4267
|
onNodeDragFinished: (t) => {
|
|
4129
4268
|
e.delete(t), r.onNodeDragFinished(t);
|
|
4130
4269
|
}
|
|
4131
|
-
}),
|
|
4270
|
+
}), pr = (r, e) => {
|
|
4132
4271
|
r.onBeforeNodeRemoved.subscribe((t) => {
|
|
4133
4272
|
e.delete(t);
|
|
4134
4273
|
}), r.onBeforeClear.subscribe(() => {
|
|
4135
4274
|
e.clear();
|
|
4136
4275
|
});
|
|
4137
|
-
},
|
|
4276
|
+
}, wr = (r, e) => ({
|
|
4138
4277
|
...r,
|
|
4139
4278
|
staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
|
|
4140
4279
|
});
|
|
4141
|
-
class
|
|
4280
|
+
class mr {
|
|
4142
4281
|
constructor(e) {
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
this.element = e, this.viewportStore = new
|
|
4282
|
+
i(this, "used", !1);
|
|
4283
|
+
i(this, "canvasDefaults", {});
|
|
4284
|
+
i(this, "dragConfig", {});
|
|
4285
|
+
i(this, "transformConfig", {});
|
|
4286
|
+
i(this, "backgroundConfig", {});
|
|
4287
|
+
i(this, "connectablePortsConfig", {});
|
|
4288
|
+
i(this, "draggableEdgesConfig", {});
|
|
4289
|
+
i(this, "virtualScrollConfig");
|
|
4290
|
+
i(this, "layoutConfig", {});
|
|
4291
|
+
i(this, "animatedLayoutConfig", {});
|
|
4292
|
+
i(this, "hasDraggableNodes", !1);
|
|
4293
|
+
i(this, "hasTransformableViewport", !1);
|
|
4294
|
+
i(this, "hasNodeResizeReactiveEdges", !1);
|
|
4295
|
+
i(this, "hasBackground", !1);
|
|
4296
|
+
i(this, "hasUserConnectablePorts", !1);
|
|
4297
|
+
i(this, "hasUserDraggableEdges", !1);
|
|
4298
|
+
i(this, "hasAnimatedLayout", !1);
|
|
4299
|
+
i(this, "hasLayout", !1);
|
|
4300
|
+
i(this, "boxRenderingTrigger", new Q());
|
|
4301
|
+
i(this, "graphStore");
|
|
4302
|
+
i(this, "viewportStore");
|
|
4303
|
+
i(this, "graph");
|
|
4304
|
+
i(this, "viewport");
|
|
4305
|
+
i(this, "window", window);
|
|
4306
|
+
i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
4307
|
+
this.element = e, this.viewportStore = new _e(this.element), this.viewport = new Ie(this.viewportStore), this.graphStore = new Se(), this.graph = new Fe(this.graphStore);
|
|
4169
4308
|
}
|
|
4170
4309
|
/**
|
|
4171
4310
|
* specifies default values for graph entities
|
|
@@ -4233,9 +4372,9 @@ class pr {
|
|
|
4233
4372
|
*/
|
|
4234
4373
|
build() {
|
|
4235
4374
|
if (this.used)
|
|
4236
|
-
throw new
|
|
4375
|
+
throw new qt("CanvasBuilder is a single use object");
|
|
4237
4376
|
this.used = !0;
|
|
4238
|
-
const e = new
|
|
4377
|
+
const e = new Vt(this.element), t = this.createHtmlView(e.main), s = Bt(this.canvasDefaults), o = new Ee(
|
|
4239
4378
|
this.graph,
|
|
4240
4379
|
this.viewport,
|
|
4241
4380
|
this.graphStore,
|
|
@@ -4243,30 +4382,30 @@ class pr {
|
|
|
4243
4382
|
t,
|
|
4244
4383
|
s
|
|
4245
4384
|
);
|
|
4246
|
-
if (this.hasBackground &&
|
|
4247
|
-
|
|
4248
|
-
|
|
4385
|
+
if (this.hasBackground && re.configure(
|
|
4386
|
+
o,
|
|
4387
|
+
Ht(this.backgroundConfig),
|
|
4249
4388
|
e.background
|
|
4250
|
-
), this.hasNodeResizeReactiveEdges &&
|
|
4251
|
-
let a =
|
|
4252
|
-
this.hasAnimatedLayout && (a =
|
|
4389
|
+
), this.hasNodeResizeReactiveEdges && Z.configure(o), this.hasDraggableNodes) {
|
|
4390
|
+
let a = $t(this.dragConfig);
|
|
4391
|
+
this.hasAnimatedLayout && (a = ur(
|
|
4253
4392
|
a,
|
|
4254
4393
|
this.animationStaticNodes
|
|
4255
|
-
)),
|
|
4256
|
-
|
|
4394
|
+
)), ee.configure(
|
|
4395
|
+
o,
|
|
4257
4396
|
e.main,
|
|
4258
4397
|
this.window,
|
|
4259
4398
|
a
|
|
4260
4399
|
);
|
|
4261
4400
|
}
|
|
4262
4401
|
if (this.hasUserConnectablePorts) {
|
|
4263
|
-
const a =
|
|
4402
|
+
const a = Yt(
|
|
4264
4403
|
this.connectablePortsConfig,
|
|
4265
4404
|
s.edges.shapeFactory,
|
|
4266
4405
|
s.ports.direction
|
|
4267
4406
|
);
|
|
4268
|
-
|
|
4269
|
-
|
|
4407
|
+
se.configure(
|
|
4408
|
+
o,
|
|
4270
4409
|
e.overlayConnectablePorts,
|
|
4271
4410
|
this.viewportStore,
|
|
4272
4411
|
this.window,
|
|
@@ -4276,74 +4415,74 @@ class pr {
|
|
|
4276
4415
|
if (this.hasUserDraggableEdges) {
|
|
4277
4416
|
const a = Xt(
|
|
4278
4417
|
this.draggableEdgesConfig,
|
|
4279
|
-
|
|
4418
|
+
o.graph
|
|
4280
4419
|
);
|
|
4281
|
-
|
|
4282
|
-
|
|
4420
|
+
oe.configure(
|
|
4421
|
+
o,
|
|
4283
4422
|
e.overlayDraggableEdges,
|
|
4284
4423
|
this.viewportStore,
|
|
4285
4424
|
this.window,
|
|
4286
4425
|
a
|
|
4287
4426
|
);
|
|
4288
4427
|
}
|
|
4289
|
-
if (this.virtualScrollConfig !== void 0 ?
|
|
4290
|
-
|
|
4428
|
+
if (this.virtualScrollConfig !== void 0 ? te.configure(
|
|
4429
|
+
o,
|
|
4291
4430
|
e.main,
|
|
4292
4431
|
this.window,
|
|
4293
|
-
|
|
4432
|
+
Ae(this.transformConfig),
|
|
4294
4433
|
this.boxRenderingTrigger,
|
|
4295
|
-
|
|
4434
|
+
Gt(this.virtualScrollConfig)
|
|
4296
4435
|
) : this.hasTransformableViewport && X.configure(
|
|
4297
|
-
|
|
4436
|
+
o,
|
|
4298
4437
|
e.main,
|
|
4299
4438
|
this.window,
|
|
4300
|
-
|
|
4439
|
+
Ae(this.transformConfig)
|
|
4301
4440
|
), this.hasLayout && Dt.configure(
|
|
4302
|
-
|
|
4303
|
-
|
|
4441
|
+
o,
|
|
4442
|
+
gr(this.layoutConfig)
|
|
4304
4443
|
), this.hasAnimatedLayout) {
|
|
4305
|
-
let a =
|
|
4444
|
+
let a = nr(
|
|
4306
4445
|
this.animatedLayoutConfig
|
|
4307
4446
|
);
|
|
4308
|
-
this.hasDraggableNodes && (
|
|
4309
|
-
|
|
4447
|
+
this.hasDraggableNodes && (pr(
|
|
4448
|
+
o.graph,
|
|
4310
4449
|
this.animationStaticNodes
|
|
4311
|
-
), a =
|
|
4450
|
+
), a = wr(
|
|
4312
4451
|
a,
|
|
4313
4452
|
this.animationStaticNodes
|
|
4314
|
-
)),
|
|
4453
|
+
)), ne.configure(o, a, this.window);
|
|
4315
4454
|
}
|
|
4316
4455
|
const n = () => {
|
|
4317
|
-
e.destroy(),
|
|
4456
|
+
e.destroy(), o.onBeforeDestroy.unsubscribe(n);
|
|
4318
4457
|
};
|
|
4319
|
-
return
|
|
4458
|
+
return o.onBeforeDestroy.subscribe(n), o;
|
|
4320
4459
|
}
|
|
4321
4460
|
createHtmlView(e) {
|
|
4322
|
-
let t = new
|
|
4461
|
+
let t = new xe(
|
|
4323
4462
|
this.graphStore,
|
|
4324
4463
|
this.viewportStore,
|
|
4325
4464
|
e
|
|
4326
4465
|
);
|
|
4327
|
-
return this.virtualScrollConfig !== void 0 && (t = new
|
|
4466
|
+
return this.virtualScrollConfig !== void 0 && (t = new Qe(
|
|
4328
4467
|
t,
|
|
4329
4468
|
this.graphStore,
|
|
4330
4469
|
this.boxRenderingTrigger,
|
|
4331
|
-
|
|
4332
|
-
)), new
|
|
4470
|
+
jt(this.virtualScrollConfig)
|
|
4471
|
+
)), new Ze(t, this.graphStore);
|
|
4333
4472
|
}
|
|
4334
4473
|
}
|
|
4335
4474
|
export {
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4475
|
+
ft as BezierEdgeShape,
|
|
4476
|
+
mr as CanvasBuilder,
|
|
4477
|
+
qt as CanvasBuilderError,
|
|
4478
|
+
x as CanvasError,
|
|
4479
|
+
D as ConnectionCategory,
|
|
4480
|
+
Le as DirectEdgeShape,
|
|
4481
|
+
Q as EventSubject,
|
|
4482
|
+
yt as HorizontalEdgeShape,
|
|
4344
4483
|
Et as InteractiveEdgeError,
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4484
|
+
Ve as InteractiveEdgeShape,
|
|
4485
|
+
yr as MidpointEdgeShape,
|
|
4486
|
+
mt as StraightEdgeShape,
|
|
4487
|
+
vt as VerticalEdgeShape
|
|
4349
4488
|
};
|