@html-graph/html-graph 8.4.0 → 8.6.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 +136 -155
- package/dist/html-graph.js +1518 -1330
- 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
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
const
|
|
1
|
+
var Ke = Object.defineProperty;
|
|
2
|
+
var Qe = (r, e, t) => e in r ? Ke(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var i = (r, e, t) => Qe(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 Ze = () => {
|
|
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
|
+
}, _e = (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 Ee {
|
|
15
15
|
constructor(e, t, s) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
i(this, "host", Ze());
|
|
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
|
+
_e(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 et {
|
|
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 tt {
|
|
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 et(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 rt {
|
|
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,8 +236,8 @@ 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));
|
|
@@ -245,7 +245,7 @@ class Qe {
|
|
|
245
245
|
}
|
|
246
246
|
class K {
|
|
247
247
|
constructor() {
|
|
248
|
-
|
|
248
|
+
i(this, "callbacks", /* @__PURE__ */ new Set());
|
|
249
249
|
}
|
|
250
250
|
subscribe(e) {
|
|
251
251
|
this.callbacks.add(e);
|
|
@@ -259,218 +259,67 @@ class K {
|
|
|
259
259
|
});
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
const
|
|
262
|
+
const S = () => {
|
|
263
263
|
const r = new K();
|
|
264
264
|
return [r, r];
|
|
265
265
|
};
|
|
266
|
-
class
|
|
267
|
-
constructor(e) {
|
|
268
|
-
|
|
269
|
-
this
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
if (e !== void 0)
|
|
273
|
-
return e;
|
|
274
|
-
for (; this.checkExists(this.counter); )
|
|
275
|
-
this.counter++;
|
|
276
|
-
return this.counter;
|
|
277
|
-
}
|
|
278
|
-
reset() {
|
|
279
|
-
this.counter = 0;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
class Ee {
|
|
283
|
-
constructor(e, t, s, i, n, a) {
|
|
284
|
-
o(this, "nodeIdGenerator", new Y(
|
|
285
|
-
(e) => this.graphStore.hasNode(e)
|
|
286
|
-
));
|
|
287
|
-
o(this, "portIdGenerator", new Y(
|
|
288
|
-
(e) => this.graphStore.hasPort(e)
|
|
289
|
-
));
|
|
290
|
-
o(this, "edgeIdGenerator", new Y(
|
|
291
|
-
(e) => this.graphStore.hasEdge(e)
|
|
292
|
-
));
|
|
293
|
-
o(this, "onAfterNodeAdded", (e) => {
|
|
294
|
-
this.htmlView.attachNode(e);
|
|
295
|
-
});
|
|
296
|
-
o(this, "onAfterNodeUpdated", (e) => {
|
|
297
|
-
this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((t) => {
|
|
298
|
-
this.htmlView.renderEdge(t);
|
|
299
|
-
});
|
|
300
|
-
});
|
|
301
|
-
o(this, "onAfterNodePriorityUpdated", (e) => {
|
|
302
|
-
this.htmlView.updateNodePriority(e);
|
|
303
|
-
});
|
|
304
|
-
o(this, "onBeforeNodeRemoved", (e) => {
|
|
305
|
-
this.graphStore.getNodePortIds(e).forEach((t) => {
|
|
306
|
-
this.unmarkPort(t);
|
|
307
|
-
}), this.htmlView.detachNode(e);
|
|
308
|
-
});
|
|
309
|
-
o(this, "onAfterPortUpdated", (e) => {
|
|
310
|
-
this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
|
|
311
|
-
this.htmlView.renderEdge(t);
|
|
312
|
-
});
|
|
313
|
-
});
|
|
314
|
-
o(this, "onBeforePortUnmarked", (e) => {
|
|
315
|
-
this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
|
|
316
|
-
this.removeEdge(t);
|
|
317
|
-
});
|
|
318
|
-
});
|
|
319
|
-
o(this, "onAfterEdgeAdded", (e) => {
|
|
320
|
-
this.htmlView.attachEdge(e);
|
|
321
|
-
});
|
|
322
|
-
o(this, "onAfterEdgeShapeUpdated", (e) => {
|
|
323
|
-
this.htmlView.updateEdgeShape(e);
|
|
324
|
-
});
|
|
325
|
-
o(this, "onAfterEdgeUpdated", (e) => {
|
|
326
|
-
this.htmlView.renderEdge(e);
|
|
327
|
-
});
|
|
328
|
-
o(this, "onAfterEdgePriorityUpdated", (e) => {
|
|
329
|
-
this.htmlView.updateEdgePriority(e);
|
|
330
|
-
});
|
|
331
|
-
o(this, "onBeforeEdgeRemoved", (e) => {
|
|
332
|
-
this.htmlView.detachEdge(e);
|
|
333
|
-
});
|
|
334
|
-
o(this, "onBeforeClear", () => {
|
|
335
|
-
this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
|
|
336
|
-
});
|
|
337
|
-
o(this, "onBeforeDestroyEmitter");
|
|
338
|
-
o(this, "destroyed", !1);
|
|
339
|
-
/**
|
|
340
|
-
* emits event just before destruction of canvas
|
|
341
|
-
*/
|
|
342
|
-
o(this, "onBeforeDestroy");
|
|
343
|
-
this.graph = e, this.viewport = t, this.graphStore = s, this.viewportStore = i, this.htmlView = n, this.params = a, this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
|
|
344
|
-
this.onAfterNodePriorityUpdated
|
|
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
|
-
this.onAfterEdgeShapeUpdated
|
|
347
|
-
), this.graphStore.onAfterEdgeUpdated.subscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.subscribe(
|
|
348
|
-
this.onAfterEdgePriorityUpdated
|
|
349
|
-
), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = x();
|
|
266
|
+
class Se {
|
|
267
|
+
constructor(e, t, s, o) {
|
|
268
|
+
i(this, "beforeDestroyEmitter");
|
|
269
|
+
i(this, "destroyed", !1);
|
|
270
|
+
i(this, "onBeforeDestroy");
|
|
271
|
+
this.graph = e, this.viewport = t, this.graphController = s, this.viewportController = o, [this.beforeDestroyEmitter, this.onBeforeDestroy] = S();
|
|
350
272
|
}
|
|
351
|
-
/**
|
|
352
|
-
* adds new node
|
|
353
|
-
*/
|
|
354
273
|
addNode(e) {
|
|
355
|
-
|
|
356
|
-
if (this.graphStore.addNode({
|
|
357
|
-
id: t,
|
|
358
|
-
element: e.element,
|
|
359
|
-
x: e.x ?? null,
|
|
360
|
-
y: e.y ?? null,
|
|
361
|
-
centerFn: e.centerFn ?? this.params.nodes.centerFn,
|
|
362
|
-
priority: e.priority ?? this.params.nodes.priorityFn()
|
|
363
|
-
}), e.ports !== void 0)
|
|
364
|
-
for (const s of e.ports)
|
|
365
|
-
this.markPort({
|
|
366
|
-
id: s.id,
|
|
367
|
-
element: s.element,
|
|
368
|
-
nodeId: t,
|
|
369
|
-
direction: s.direction
|
|
370
|
-
});
|
|
371
|
-
return this;
|
|
274
|
+
return this.graphController.addNode(e), this;
|
|
372
275
|
}
|
|
373
|
-
/**
|
|
374
|
-
* updates node parameters
|
|
375
|
-
*/
|
|
376
276
|
updateNode(e, t) {
|
|
377
|
-
return this.
|
|
277
|
+
return this.graphController.updateNode(e, t), this;
|
|
378
278
|
}
|
|
379
|
-
/**
|
|
380
|
-
* removes specified node
|
|
381
|
-
* all the ports of node get unmarked
|
|
382
|
-
* all the edges adjacent to node get removed
|
|
383
|
-
*/
|
|
384
279
|
removeNode(e) {
|
|
385
|
-
return this.
|
|
280
|
+
return this.graphController.removeNode(e), this;
|
|
386
281
|
}
|
|
387
|
-
/**
|
|
388
|
-
* marks specified element as a port for specified node
|
|
389
|
-
*/
|
|
390
282
|
markPort(e) {
|
|
391
|
-
|
|
392
|
-
return this.graphStore.addPort({
|
|
393
|
-
id: t,
|
|
394
|
-
element: e.element,
|
|
395
|
-
nodeId: e.nodeId,
|
|
396
|
-
direction: e.direction ?? this.params.ports.direction
|
|
397
|
-
}), this;
|
|
283
|
+
return this.graphController.markPort(e), this;
|
|
398
284
|
}
|
|
399
|
-
/**
|
|
400
|
-
* updates port and edges attached to it
|
|
401
|
-
*/
|
|
402
285
|
updatePort(e, t) {
|
|
403
|
-
return this.
|
|
286
|
+
return this.graphController.updatePort(e, t), this;
|
|
404
287
|
}
|
|
405
|
-
/**
|
|
406
|
-
* unmarks specified port
|
|
407
|
-
* all the edges adjacent to the port get removed
|
|
408
|
-
*/
|
|
409
288
|
unmarkPort(e) {
|
|
410
|
-
return this.
|
|
289
|
+
return this.graphController.unmarkPort(e), this;
|
|
411
290
|
}
|
|
412
|
-
/**
|
|
413
|
-
* adds new edge
|
|
414
|
-
*/
|
|
415
291
|
addEdge(e) {
|
|
416
|
-
|
|
417
|
-
return this.graphStore.addEdge({
|
|
418
|
-
id: t,
|
|
419
|
-
from: e.from,
|
|
420
|
-
to: e.to,
|
|
421
|
-
shape: e.shape ?? this.params.edges.shapeFactory(t),
|
|
422
|
-
priority: e.priority ?? this.params.edges.priorityFn()
|
|
423
|
-
}), this;
|
|
292
|
+
return this.graphController.addEdge(e), this;
|
|
424
293
|
}
|
|
425
|
-
/**
|
|
426
|
-
* updates specified edge
|
|
427
|
-
*/
|
|
428
294
|
updateEdge(e, t) {
|
|
429
|
-
return this.
|
|
295
|
+
return this.graphController.updateEdge(e, t), this;
|
|
430
296
|
}
|
|
431
|
-
/**
|
|
432
|
-
* removes specified edge
|
|
433
|
-
*/
|
|
434
297
|
removeEdge(e) {
|
|
435
|
-
return this.
|
|
298
|
+
return this.graphController.removeEdge(e), this;
|
|
436
299
|
}
|
|
437
|
-
/**
|
|
438
|
-
* clears canvas from nodes and edges
|
|
439
|
-
* canvas gets rolled back to initial state and can be reused
|
|
440
|
-
*/
|
|
441
300
|
clear() {
|
|
442
|
-
return this.
|
|
301
|
+
return this.graphController.clear(), this;
|
|
302
|
+
}
|
|
303
|
+
focus(e) {
|
|
304
|
+
return this.viewportController.focus(e), this;
|
|
305
|
+
}
|
|
306
|
+
center(e, t) {
|
|
307
|
+
return this.viewportController.center(e, t), this;
|
|
443
308
|
}
|
|
444
|
-
/**
|
|
445
|
-
* applies transformation for viewport matrix
|
|
446
|
-
*/
|
|
447
309
|
patchViewportMatrix(e) {
|
|
448
|
-
return this.
|
|
310
|
+
return this.viewportController.patchViewportMatrix(e), this;
|
|
449
311
|
}
|
|
450
|
-
/**
|
|
451
|
-
* applies transformation for content matrix
|
|
452
|
-
*/
|
|
453
312
|
patchContentMatrix(e) {
|
|
454
|
-
return this.
|
|
313
|
+
return this.viewportController.patchContentMatrix(e), this;
|
|
455
314
|
}
|
|
456
|
-
/**
|
|
457
|
-
* destroys canvas
|
|
458
|
-
* canvas element gets rolled back to initial state, and can not be reused
|
|
459
|
-
*/
|
|
460
315
|
destroy() {
|
|
461
|
-
this.destroyed || (this.
|
|
462
|
-
this.onAfterNodePriorityUpdated
|
|
463
|
-
), this.graphStore.onBeforeNodeRemoved.unsubscribe(this.onBeforeNodeRemoved), this.graphStore.onAfterPortUpdated.unsubscribe(this.onAfterPortUpdated), this.graphStore.onBeforePortRemoved.unsubscribe(this.onBeforePortUnmarked), this.graphStore.onAfterEdgeAdded.unsubscribe(this.onAfterEdgeAdded), this.graphStore.onAfterEdgeShapeUpdated.unsubscribe(
|
|
464
|
-
this.onAfterEdgeShapeUpdated
|
|
465
|
-
), this.graphStore.onAfterEdgeUpdated.unsubscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.unsubscribe(
|
|
466
|
-
this.onAfterEdgePriorityUpdated
|
|
467
|
-
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy(), this.viewportStore.destroy(), this.destroyed = !0);
|
|
316
|
+
this.destroyed || (this.destroyed = !0, this.beforeDestroyEmitter.emit(), this.graphController.destroy(), this.viewportController.destroy());
|
|
468
317
|
}
|
|
469
318
|
}
|
|
470
|
-
class
|
|
319
|
+
class st {
|
|
471
320
|
constructor() {
|
|
472
|
-
|
|
473
|
-
|
|
321
|
+
i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
322
|
+
i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
474
323
|
}
|
|
475
324
|
addRecord(e, t) {
|
|
476
325
|
const s = this.singleToMultiMap.get(e);
|
|
@@ -507,49 +356,49 @@ class Ze {
|
|
|
507
356
|
return this.multiToSingleMap.get(e) !== void 0;
|
|
508
357
|
}
|
|
509
358
|
}
|
|
510
|
-
class
|
|
359
|
+
class E extends Error {
|
|
511
360
|
constructor() {
|
|
512
361
|
super(...arguments);
|
|
513
|
-
|
|
362
|
+
i(this, "name", "CanvasError");
|
|
514
363
|
}
|
|
515
364
|
}
|
|
516
|
-
class
|
|
365
|
+
class be {
|
|
517
366
|
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] =
|
|
367
|
+
i(this, "nodes", /* @__PURE__ */ new Map());
|
|
368
|
+
i(this, "ports", /* @__PURE__ */ new Map());
|
|
369
|
+
i(this, "edges", /* @__PURE__ */ new Map());
|
|
370
|
+
i(this, "nodesElementsMap", /* @__PURE__ */ new Map());
|
|
371
|
+
i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
|
|
372
|
+
i(this, "portOutgoingEdges", /* @__PURE__ */ new Map());
|
|
373
|
+
i(this, "portCycleEdges", /* @__PURE__ */ new Map());
|
|
374
|
+
i(this, "elementPorts", new st());
|
|
375
|
+
i(this, "afterNodeAddedEmitter");
|
|
376
|
+
i(this, "onAfterNodeAdded");
|
|
377
|
+
i(this, "afterNodeUpdatedEmitter");
|
|
378
|
+
i(this, "onAfterNodeUpdated");
|
|
379
|
+
i(this, "afterNodePriorityUpdatedEmitter");
|
|
380
|
+
i(this, "onAfterNodePriorityUpdated");
|
|
381
|
+
i(this, "beforeNodeRemovedEmitter");
|
|
382
|
+
i(this, "onBeforeNodeRemoved");
|
|
383
|
+
i(this, "afterPortAddedEmitter");
|
|
384
|
+
i(this, "onAfterPortAdded");
|
|
385
|
+
i(this, "afterPortUpdatedEmitter");
|
|
386
|
+
i(this, "onAfterPortUpdated");
|
|
387
|
+
i(this, "beforePortRemovedEmitter");
|
|
388
|
+
i(this, "onBeforePortRemoved");
|
|
389
|
+
i(this, "afterEdgeAddedEmitter");
|
|
390
|
+
i(this, "onAfterEdgeAdded");
|
|
391
|
+
i(this, "afterEdgeShapeUpdatedEmitter");
|
|
392
|
+
i(this, "onAfterEdgeShapeUpdated");
|
|
393
|
+
i(this, "afterEdgeUpdatedEmitter");
|
|
394
|
+
i(this, "onAfterEdgeUpdated");
|
|
395
|
+
i(this, "afterEdgePriorityUpdatedEmitter");
|
|
396
|
+
i(this, "onAfterEdgePriorityUpdated");
|
|
397
|
+
i(this, "beforeEdgeRemovedEmitter");
|
|
398
|
+
i(this, "onBeforeEdgeRemoved");
|
|
399
|
+
i(this, "beforeClearEmitter");
|
|
400
|
+
i(this, "onBeforeClear");
|
|
401
|
+
[this.afterNodeAddedEmitter, this.onAfterNodeAdded] = S(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = S(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = S(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = S(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = S(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = S(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = S(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = S(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = S(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = S(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = S(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = S(), [this.beforeClearEmitter, this.onBeforeClear] = S();
|
|
553
402
|
}
|
|
554
403
|
hasNode(e) {
|
|
555
404
|
return this.nodes.has(e);
|
|
@@ -557,14 +406,14 @@ class xe {
|
|
|
557
406
|
getNode(e) {
|
|
558
407
|
const t = this.nodes.get(e);
|
|
559
408
|
if (t === void 0)
|
|
560
|
-
throw new
|
|
409
|
+
throw new E("failed to access nonexistent node");
|
|
561
410
|
return t;
|
|
562
411
|
}
|
|
563
412
|
addNode(e) {
|
|
564
413
|
if (this.hasNode(e.id))
|
|
565
|
-
throw new
|
|
414
|
+
throw new E("failed to add node with existing id");
|
|
566
415
|
if (this.findNodeIdByElement(e.element) !== void 0)
|
|
567
|
-
throw new
|
|
416
|
+
throw new E(
|
|
568
417
|
"failed to add node with html element already in use by another node"
|
|
569
418
|
);
|
|
570
419
|
const t = /* @__PURE__ */ new Map(), s = {
|
|
@@ -587,13 +436,13 @@ class xe {
|
|
|
587
436
|
}
|
|
588
437
|
updateNode(e, t) {
|
|
589
438
|
if (!this.hasNode(e))
|
|
590
|
-
throw new
|
|
439
|
+
throw new E("failed to update nonexistent node");
|
|
591
440
|
const { payload: s } = this.nodes.get(e);
|
|
592
441
|
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
442
|
}
|
|
594
443
|
removeNode(e) {
|
|
595
444
|
if (!this.hasNode(e))
|
|
596
|
-
throw new
|
|
445
|
+
throw new E("failed to remove nonexistent node");
|
|
597
446
|
this.beforeNodeRemovedEmitter.emit(e);
|
|
598
447
|
const t = this.nodes.get(e);
|
|
599
448
|
this.nodesElementsMap.delete(t.element), this.nodes.delete(e);
|
|
@@ -604,25 +453,25 @@ class xe {
|
|
|
604
453
|
getPort(e) {
|
|
605
454
|
const t = this.ports.get(e);
|
|
606
455
|
if (t === void 0)
|
|
607
|
-
throw new
|
|
456
|
+
throw new E("failed to access nonexistent port");
|
|
608
457
|
return t;
|
|
609
458
|
}
|
|
610
459
|
addPort(e) {
|
|
611
460
|
if (this.hasPort(e.id))
|
|
612
|
-
throw new
|
|
461
|
+
throw new E("failed to add port with existing id");
|
|
613
462
|
if (!this.hasNode(e.nodeId))
|
|
614
|
-
throw new
|
|
463
|
+
throw new E("failed to add port to nonexistent node");
|
|
615
464
|
this.ports.set(e.id, {
|
|
616
465
|
element: e.element,
|
|
617
466
|
payload: {
|
|
618
467
|
direction: e.direction
|
|
619
468
|
},
|
|
620
469
|
nodeId: e.nodeId
|
|
621
|
-
}), this.elementPorts.addRecord(e.element, e.id), this.portCycleEdges.set(e.id, /* @__PURE__ */ new Set()), this.portIncomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.
|
|
470
|
+
}), this.elementPorts.addRecord(e.element, e.id), this.portCycleEdges.set(e.id, /* @__PURE__ */ new Set()), this.portIncomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.portOutgoingEdges.set(e.id, /* @__PURE__ */ new Set()), this.nodes.get(e.nodeId).ports.set(e.id, e.element), this.afterPortAddedEmitter.emit(e.id);
|
|
622
471
|
}
|
|
623
472
|
updatePort(e, t) {
|
|
624
473
|
if (!this.hasPort(e))
|
|
625
|
-
throw new
|
|
474
|
+
throw new E("failed to update nonexistent port");
|
|
626
475
|
const s = this.ports.get(e).payload;
|
|
627
476
|
s.direction = t.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(e);
|
|
628
477
|
}
|
|
@@ -635,12 +484,12 @@ class xe {
|
|
|
635
484
|
getNodePortIds(e) {
|
|
636
485
|
const t = this.nodes.get(e);
|
|
637
486
|
if (t === void 0)
|
|
638
|
-
throw new
|
|
487
|
+
throw new E("failed to access port ids of nonexistent node");
|
|
639
488
|
return Array.from(t.ports.keys());
|
|
640
489
|
}
|
|
641
490
|
removePort(e) {
|
|
642
491
|
if (!this.hasPort(e))
|
|
643
|
-
throw new
|
|
492
|
+
throw new E("failed to remove nonexistent port");
|
|
644
493
|
const t = this.ports.get(e).nodeId;
|
|
645
494
|
this.beforePortRemovedEmitter.emit(e), this.nodes.get(t).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
|
|
646
495
|
}
|
|
@@ -650,27 +499,27 @@ class xe {
|
|
|
650
499
|
getEdge(e) {
|
|
651
500
|
const t = this.edges.get(e);
|
|
652
501
|
if (t === void 0)
|
|
653
|
-
throw new
|
|
502
|
+
throw new E("failed to access nonexistent edge");
|
|
654
503
|
return t;
|
|
655
504
|
}
|
|
656
505
|
addEdge(e) {
|
|
657
506
|
if (this.hasEdge(e.id))
|
|
658
|
-
throw new
|
|
507
|
+
throw new E("failed to add edge with existing id");
|
|
659
508
|
if (!this.hasPort(e.from))
|
|
660
|
-
throw new
|
|
509
|
+
throw new E("failed to add edge from nonexistent port");
|
|
661
510
|
if (!this.hasPort(e.to))
|
|
662
|
-
throw new
|
|
511
|
+
throw new E("failed to add edge to nonexistent port");
|
|
663
512
|
this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
|
|
664
513
|
}
|
|
665
514
|
updateEdge(e, t) {
|
|
666
515
|
if (!this.hasEdge(e))
|
|
667
|
-
throw new
|
|
516
|
+
throw new E("failed to update nonexistent edge");
|
|
668
517
|
if (t.from !== void 0 || t.to !== void 0) {
|
|
669
|
-
const
|
|
518
|
+
const o = this.edges.get(e), n = o.payload;
|
|
670
519
|
this.removeEdgeInternal(e), this.addEdgeInternal({
|
|
671
520
|
id: e,
|
|
672
|
-
from: t.from ??
|
|
673
|
-
to: t.to ??
|
|
521
|
+
from: t.from ?? o.from,
|
|
522
|
+
to: t.to ?? o.to,
|
|
674
523
|
shape: n.shape,
|
|
675
524
|
priority: n.priority
|
|
676
525
|
});
|
|
@@ -683,28 +532,28 @@ class xe {
|
|
|
683
532
|
}
|
|
684
533
|
removeEdge(e) {
|
|
685
534
|
if (!this.hasEdge(e))
|
|
686
|
-
throw new
|
|
535
|
+
throw new E("failed to remove nonexistent edge");
|
|
687
536
|
this.beforeEdgeRemovedEmitter.emit(e), this.removeEdgeInternal(e);
|
|
688
537
|
}
|
|
689
538
|
clear() {
|
|
690
|
-
this.beforeClearEmitter.emit(), this.portIncomingEdges.clear(), this.
|
|
539
|
+
this.beforeClearEmitter.emit(), this.portIncomingEdges.clear(), this.portOutgoingEdges.clear(), this.portCycleEdges.clear(), this.elementPorts.clear(), this.nodesElementsMap.clear(), this.edges.clear(), this.ports.clear(), this.nodes.clear();
|
|
691
540
|
}
|
|
692
541
|
getPortIncomingEdgeIds(e) {
|
|
693
542
|
const t = this.portIncomingEdges.get(e);
|
|
694
543
|
if (t === void 0)
|
|
695
|
-
throw new
|
|
544
|
+
throw new E("failed to access edges for nonexistent port");
|
|
696
545
|
return Array.from(t);
|
|
697
546
|
}
|
|
698
547
|
getPortOutgoingEdgeIds(e) {
|
|
699
|
-
const t = this.
|
|
548
|
+
const t = this.portOutgoingEdges.get(e);
|
|
700
549
|
if (t === void 0)
|
|
701
|
-
throw new
|
|
550
|
+
throw new E("failed to access edges for nonexistent port");
|
|
702
551
|
return Array.from(t);
|
|
703
552
|
}
|
|
704
553
|
getPortCycleEdgeIds(e) {
|
|
705
554
|
const t = this.portCycleEdges.get(e);
|
|
706
555
|
if (t === void 0)
|
|
707
|
-
throw new
|
|
556
|
+
throw new E("failed to access edges for nonexistent port");
|
|
708
557
|
return Array.from(t);
|
|
709
558
|
}
|
|
710
559
|
getPortAdjacentEdgeIds(e) {
|
|
@@ -716,8 +565,8 @@ class xe {
|
|
|
716
565
|
}
|
|
717
566
|
getNodeIncomingEdgeIds(e) {
|
|
718
567
|
const t = Array.from(this.getNode(e).ports.keys()), s = [];
|
|
719
|
-
return t.forEach((
|
|
720
|
-
this.getPortIncomingEdgeIds(
|
|
568
|
+
return t.forEach((o) => {
|
|
569
|
+
this.getPortIncomingEdgeIds(o).filter((n) => {
|
|
721
570
|
const a = this.getEdge(n);
|
|
722
571
|
return this.getPort(a.from).nodeId !== e;
|
|
723
572
|
}).forEach((n) => {
|
|
@@ -727,8 +576,8 @@ class xe {
|
|
|
727
576
|
}
|
|
728
577
|
getNodeOutgoingEdgeIds(e) {
|
|
729
578
|
const t = Array.from(this.getNode(e).ports.keys()), s = [];
|
|
730
|
-
return t.forEach((
|
|
731
|
-
this.getPortOutgoingEdgeIds(
|
|
579
|
+
return t.forEach((o) => {
|
|
580
|
+
this.getPortOutgoingEdgeIds(o).filter((n) => {
|
|
732
581
|
const a = this.getEdge(n);
|
|
733
582
|
return this.getPort(a.to).nodeId !== e;
|
|
734
583
|
}).forEach((n) => {
|
|
@@ -738,10 +587,10 @@ class xe {
|
|
|
738
587
|
}
|
|
739
588
|
getNodeCycleEdgeIds(e) {
|
|
740
589
|
const t = Array.from(this.getNode(e).ports.keys()), s = [];
|
|
741
|
-
return t.forEach((
|
|
742
|
-
this.getPortCycleEdgeIds(
|
|
590
|
+
return t.forEach((o) => {
|
|
591
|
+
this.getPortCycleEdgeIds(o).forEach((n) => {
|
|
743
592
|
s.push(n);
|
|
744
|
-
}), this.getPortIncomingEdgeIds(
|
|
593
|
+
}), this.getPortIncomingEdgeIds(o).filter((n) => {
|
|
745
594
|
const a = this.getEdge(n);
|
|
746
595
|
return this.getPort(a.to).nodeId === e;
|
|
747
596
|
}).forEach((n) => {
|
|
@@ -751,12 +600,12 @@ class xe {
|
|
|
751
600
|
}
|
|
752
601
|
getNodeAdjacentEdgeIds(e) {
|
|
753
602
|
const t = Array.from(this.getNode(e).ports.keys()), s = [];
|
|
754
|
-
return t.forEach((
|
|
755
|
-
this.getPortIncomingEdgeIds(
|
|
603
|
+
return t.forEach((o) => {
|
|
604
|
+
this.getPortIncomingEdgeIds(o).forEach((n) => {
|
|
756
605
|
s.push(n);
|
|
757
|
-
}), this.getPortOutgoingEdgeIds(
|
|
606
|
+
}), this.getPortOutgoingEdgeIds(o).forEach((n) => {
|
|
758
607
|
s.push(n);
|
|
759
|
-
}), this.getPortCycleEdgeIds(
|
|
608
|
+
}), this.getPortCycleEdgeIds(o).forEach((n) => {
|
|
760
609
|
s.push(n);
|
|
761
610
|
});
|
|
762
611
|
}), s;
|
|
@@ -769,39 +618,39 @@ class xe {
|
|
|
769
618
|
shape: e.shape,
|
|
770
619
|
priority: e.priority
|
|
771
620
|
}
|
|
772
|
-
}), e.from !== e.to ? (this.
|
|
621
|
+
}), e.from !== e.to ? (this.portOutgoingEdges.get(e.from).add(e.id), this.portIncomingEdges.get(e.to).add(e.id)) : this.portCycleEdges.get(e.from).add(e.id);
|
|
773
622
|
}
|
|
774
623
|
removeEdgeInternal(e) {
|
|
775
|
-
const t = this.edges.get(e), s = t.from,
|
|
776
|
-
this.portCycleEdges.get(s).delete(e), this.portCycleEdges.get(
|
|
624
|
+
const t = this.edges.get(e), s = t.from, o = t.to;
|
|
625
|
+
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.portOutgoingEdges.get(s).delete(e), this.portOutgoingEdges.get(o).delete(e), this.edges.delete(e);
|
|
777
626
|
}
|
|
778
627
|
}
|
|
779
|
-
const
|
|
628
|
+
const ue = (r) => ({
|
|
780
629
|
scale: 1 / r.scale,
|
|
781
630
|
x: -r.x / r.scale,
|
|
782
631
|
y: -r.y / r.scale
|
|
783
|
-
}),
|
|
632
|
+
}), pe = {
|
|
784
633
|
scale: 1,
|
|
785
634
|
x: 0,
|
|
786
635
|
y: 0
|
|
787
|
-
},
|
|
636
|
+
}, we = (r, e) => ({
|
|
788
637
|
x: r.scale * e.x + r.x,
|
|
789
638
|
y: r.scale * e.y + r.y
|
|
790
639
|
});
|
|
791
|
-
class
|
|
640
|
+
class ot {
|
|
792
641
|
constructor(e) {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
642
|
+
i(this, "viewportMatrix", pe);
|
|
643
|
+
i(this, "contentMatrix", pe);
|
|
644
|
+
i(this, "beforeUpdateEmitter");
|
|
645
|
+
i(this, "onBeforeUpdated");
|
|
646
|
+
i(this, "afterUpdateEmitter");
|
|
647
|
+
i(this, "onAfterUpdated");
|
|
648
|
+
i(this, "afterResizeEmitter");
|
|
649
|
+
i(this, "onAfterResize");
|
|
650
|
+
i(this, "observer", new ResizeObserver(() => {
|
|
802
651
|
this.afterResizeEmitter.emit();
|
|
803
652
|
}));
|
|
804
|
-
this.host = e, [this.afterUpdateEmitter, this.onAfterUpdated] =
|
|
653
|
+
this.host = e, [this.afterUpdateEmitter, this.onAfterUpdated] = S(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = S(), [this.afterResizeEmitter, this.onAfterResize] = S(), this.observer.observe(this.host);
|
|
805
654
|
}
|
|
806
655
|
getViewportMatrix() {
|
|
807
656
|
return this.viewportMatrix;
|
|
@@ -814,24 +663,24 @@ class Je {
|
|
|
814
663
|
scale: e.scale ?? this.viewportMatrix.scale,
|
|
815
664
|
x: e.x ?? this.viewportMatrix.x,
|
|
816
665
|
y: e.y ?? this.viewportMatrix.y
|
|
817
|
-
}, this.beforeUpdateEmitter.emit(), this.contentMatrix =
|
|
666
|
+
}, this.beforeUpdateEmitter.emit(), this.contentMatrix = ue(this.viewportMatrix), this.afterUpdateEmitter.emit();
|
|
818
667
|
}
|
|
819
668
|
patchContentMatrix(e) {
|
|
820
669
|
this.contentMatrix = {
|
|
821
670
|
scale: e.scale ?? this.contentMatrix.scale,
|
|
822
671
|
x: e.x ?? this.contentMatrix.x,
|
|
823
672
|
y: e.y ?? this.contentMatrix.y
|
|
824
|
-
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix =
|
|
673
|
+
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix = ue(this.contentMatrix), this.afterUpdateEmitter.emit();
|
|
825
674
|
}
|
|
826
675
|
getDimensions() {
|
|
827
676
|
const { width: e, height: t } = this.host.getBoundingClientRect();
|
|
828
677
|
return { width: e, height: t };
|
|
829
678
|
}
|
|
830
679
|
createContentCoords(e) {
|
|
831
|
-
return
|
|
680
|
+
return we(this.viewportMatrix, e);
|
|
832
681
|
}
|
|
833
682
|
createViewportCoords(e) {
|
|
834
|
-
return
|
|
683
|
+
return we(this.contentMatrix, e);
|
|
835
684
|
}
|
|
836
685
|
destroy() {
|
|
837
686
|
this.observer.disconnect();
|
|
@@ -839,23 +688,23 @@ class Je {
|
|
|
839
688
|
}
|
|
840
689
|
class Q {
|
|
841
690
|
constructor(e) {
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
691
|
+
i(this, "elementToNodeId", /* @__PURE__ */ new Map());
|
|
692
|
+
i(this, "nodesResizeObserver");
|
|
693
|
+
i(this, "onAfterNodeAdded", (e) => {
|
|
845
694
|
const t = this.canvas.graph.getNode(e);
|
|
846
695
|
this.elementToNodeId.set(t.element, e), this.nodesResizeObserver.observe(t.element);
|
|
847
696
|
});
|
|
848
|
-
|
|
697
|
+
i(this, "onBeforeNodeRemoved", (e) => {
|
|
849
698
|
const t = this.canvas.graph.getNode(e);
|
|
850
699
|
this.elementToNodeId.delete(t.element), this.nodesResizeObserver.unobserve(t.element);
|
|
851
700
|
});
|
|
852
|
-
|
|
701
|
+
i(this, "onBeforeClear", () => {
|
|
853
702
|
this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
|
|
854
703
|
});
|
|
855
704
|
this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
|
|
856
705
|
t.forEach((s) => {
|
|
857
|
-
const
|
|
858
|
-
this.handleNodeResize(
|
|
706
|
+
const o = s.target;
|
|
707
|
+
this.handleNodeResize(o);
|
|
859
708
|
});
|
|
860
709
|
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
|
|
861
710
|
}
|
|
@@ -867,12 +716,12 @@ class Q {
|
|
|
867
716
|
this.canvas.updateNode(t);
|
|
868
717
|
}
|
|
869
718
|
}
|
|
870
|
-
const
|
|
871
|
-
const { x: s, y:
|
|
872
|
-
return e >= s && e <= s + n && t >=
|
|
873
|
-
},
|
|
719
|
+
const it = (r, e, t) => {
|
|
720
|
+
const { x: s, y: o, width: n, height: a } = r.getBoundingClientRect();
|
|
721
|
+
return e >= s && e <= s + n && t >= o && t <= o + a;
|
|
722
|
+
}, nt = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, R = (r, e, t, s) => it(e, t, s) && nt(r, t, s), U = (r, e) => {
|
|
874
723
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
875
|
-
},
|
|
724
|
+
}, O = (r) => {
|
|
876
725
|
const e = document.createElement("div");
|
|
877
726
|
return {
|
|
878
727
|
id: r.overlayNodeId,
|
|
@@ -887,7 +736,7 @@ const _e = (r, e, t) => {
|
|
|
887
736
|
}
|
|
888
737
|
]
|
|
889
738
|
};
|
|
890
|
-
},
|
|
739
|
+
}, at = (r, e) => {
|
|
891
740
|
let t = e;
|
|
892
741
|
for (; t !== null; ) {
|
|
893
742
|
const s = r.findPortIdsByElement(t)[0] ?? null;
|
|
@@ -906,30 +755,30 @@ const _e = (r, e, t) => {
|
|
|
906
755
|
status: "notFound"
|
|
907
756
|
};
|
|
908
757
|
};
|
|
909
|
-
function*
|
|
758
|
+
function* Pe(r, e) {
|
|
910
759
|
const t = r.elementsFromPoint(e.x, e.y);
|
|
911
760
|
for (const s of t) {
|
|
912
761
|
if (s.shadowRoot !== null) {
|
|
913
|
-
const
|
|
914
|
-
for (const n of
|
|
762
|
+
const o = Pe(s.shadowRoot, e);
|
|
763
|
+
for (const n of o)
|
|
915
764
|
yield n;
|
|
916
765
|
}
|
|
917
766
|
yield s;
|
|
918
767
|
}
|
|
919
768
|
}
|
|
920
|
-
const
|
|
921
|
-
const t =
|
|
769
|
+
const Ce = (r, e) => {
|
|
770
|
+
const t = Pe(document, e);
|
|
922
771
|
for (const s of t) {
|
|
923
|
-
const
|
|
924
|
-
if (
|
|
925
|
-
return
|
|
926
|
-
if (
|
|
772
|
+
const o = at(r, s);
|
|
773
|
+
if (o.status === "portFound")
|
|
774
|
+
return o.portId;
|
|
775
|
+
if (o.status === "nodeEncountered")
|
|
927
776
|
return null;
|
|
928
777
|
}
|
|
929
778
|
return null;
|
|
930
779
|
};
|
|
931
780
|
var N = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(N || {});
|
|
932
|
-
const
|
|
781
|
+
const Ne = (r, e) => ({
|
|
933
782
|
x: r / 2,
|
|
934
783
|
y: e / 2
|
|
935
784
|
}), w = {
|
|
@@ -938,16 +787,16 @@ const Pe = (r, e) => ({
|
|
|
938
787
|
}, m = (r, e, t) => ({
|
|
939
788
|
x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
|
|
940
789
|
y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
|
|
941
|
-
}),
|
|
790
|
+
}), Te = (r, e) => {
|
|
942
791
|
const t = {
|
|
943
792
|
x: r.x + r.width / 2,
|
|
944
793
|
y: r.y + r.height / 2
|
|
945
794
|
}, s = {
|
|
946
795
|
x: e.x + e.width / 2,
|
|
947
796
|
y: e.y + e.height / 2
|
|
948
|
-
},
|
|
797
|
+
}, 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
798
|
return {
|
|
950
|
-
x:
|
|
799
|
+
x: o,
|
|
951
800
|
y: n,
|
|
952
801
|
width: a,
|
|
953
802
|
height: h,
|
|
@@ -958,10 +807,10 @@ const Pe = (r, e) => ({
|
|
|
958
807
|
x: e * r.x + (1 - e) / 2 * s.x,
|
|
959
808
|
y: t * r.y + (1 - t) / 2 * s.y
|
|
960
809
|
});
|
|
961
|
-
class
|
|
810
|
+
class ht {
|
|
962
811
|
constructor(e) {
|
|
963
|
-
|
|
964
|
-
|
|
812
|
+
i(this, "path");
|
|
813
|
+
i(this, "midpoint");
|
|
965
814
|
this.params = e;
|
|
966
815
|
const t = this.params.to;
|
|
967
816
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
@@ -969,7 +818,7 @@ class rt {
|
|
|
969
818
|
{ x: this.params.arrowLength, y: w.y },
|
|
970
819
|
this.params.sourceDirection,
|
|
971
820
|
w
|
|
972
|
-
),
|
|
821
|
+
), o = m(
|
|
973
822
|
{ x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
|
|
974
823
|
this.params.targetDirection,
|
|
975
824
|
this.params.to
|
|
@@ -977,16 +826,16 @@ class rt {
|
|
|
977
826
|
x: s.x + this.params.sourceDirection.x * this.params.curvature,
|
|
978
827
|
y: s.y + this.params.sourceDirection.y * this.params.curvature
|
|
979
828
|
}, a = {
|
|
980
|
-
x:
|
|
981
|
-
y:
|
|
982
|
-
}, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${
|
|
829
|
+
x: o.x - this.params.targetDirection.x * this.params.curvature,
|
|
830
|
+
y: o.y - this.params.targetDirection.y * this.params.curvature
|
|
831
|
+
}, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${o.x} ${o.y}`, d = this.params.hasSourceArrow ? "" : `M ${w.x} ${w.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
832
|
this.path = `${d}${h}${c}`;
|
|
984
833
|
}
|
|
985
834
|
}
|
|
986
|
-
class
|
|
835
|
+
class dt {
|
|
987
836
|
constructor(e) {
|
|
988
|
-
|
|
989
|
-
|
|
837
|
+
i(this, "path");
|
|
838
|
+
i(this, "midpoint");
|
|
990
839
|
this.params = e;
|
|
991
840
|
const t = this.params.hasSourceArrow ? m(
|
|
992
841
|
{ x: this.params.arrowLength, y: w.y },
|
|
@@ -999,15 +848,15 @@ class st {
|
|
|
999
848
|
},
|
|
1000
849
|
this.params.targetDirection,
|
|
1001
850
|
this.params.to
|
|
1002
|
-
) : this.params.to,
|
|
1003
|
-
{ x:
|
|
851
|
+
) : 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(
|
|
852
|
+
{ x: o, y: w.y },
|
|
1004
853
|
this.params.sourceDirection,
|
|
1005
854
|
w
|
|
1006
855
|
), g = {
|
|
1007
856
|
x: c.x + h,
|
|
1008
857
|
y: c.y + d
|
|
1009
858
|
}, l = m(
|
|
1010
|
-
{ x: this.params.to.x -
|
|
859
|
+
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
1011
860
|
this.params.targetDirection,
|
|
1012
861
|
this.params.to
|
|
1013
862
|
), u = {
|
|
@@ -1019,10 +868,10 @@ class st {
|
|
|
1019
868
|
}, f = {
|
|
1020
869
|
x: c.x + this.params.curvature * this.params.sourceDirection.x,
|
|
1021
870
|
y: c.y + this.params.curvature * this.params.sourceDirection.y
|
|
1022
|
-
},
|
|
871
|
+
}, v = {
|
|
1023
872
|
x: l.x - this.params.curvature * this.params.targetDirection.x,
|
|
1024
873
|
y: l.y - this.params.curvature * this.params.targetDirection.y
|
|
1025
|
-
},
|
|
874
|
+
}, x = {
|
|
1026
875
|
x: c.x + h,
|
|
1027
876
|
y: c.y + d
|
|
1028
877
|
}, b = {
|
|
@@ -1032,41 +881,41 @@ class st {
|
|
|
1032
881
|
this.path = [
|
|
1033
882
|
`M ${t.x} ${t.y}`,
|
|
1034
883
|
`L ${c.x} ${c.y}`,
|
|
1035
|
-
`C ${f.x} ${f.y} ${
|
|
1036
|
-
`C ${b.x} ${b.y} ${
|
|
884
|
+
`C ${f.x} ${f.y} ${x.x} ${x.y} ${p.x} ${p.y}`,
|
|
885
|
+
`C ${b.x} ${b.y} ${v.x} ${v.y} ${l.x} ${l.y}`,
|
|
1037
886
|
`L ${s.x} ${s.y}`
|
|
1038
887
|
].join(" "), this.midpoint = z(p, e.flipX, e.flipY, e.to);
|
|
1039
888
|
}
|
|
1040
889
|
}
|
|
1041
890
|
const Z = Object.freeze({
|
|
1042
891
|
edgeColor: "--edge-color"
|
|
1043
|
-
}),
|
|
892
|
+
}), Me = (r) => {
|
|
1044
893
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1045
894
|
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(Z.edgeColor, r), e;
|
|
1046
|
-
},
|
|
895
|
+
}, De = (r) => {
|
|
1047
896
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1048
897
|
return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
1049
|
-
},
|
|
898
|
+
}, W = () => {
|
|
1050
899
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1051
900
|
return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
|
|
1052
|
-
},
|
|
901
|
+
}, Re = () => {
|
|
1053
902
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1054
903
|
return r.style.transformOrigin = "50% 50%", r;
|
|
1055
|
-
},
|
|
904
|
+
}, Le = (r, e) => {
|
|
1056
905
|
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
|
-
},
|
|
906
|
+
}, M = (r, e) => {
|
|
1058
907
|
const t = [];
|
|
1059
908
|
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
909
|
const s = r.length - 1;
|
|
1061
|
-
let
|
|
910
|
+
let o = 0, n = 0, a = 0;
|
|
1062
911
|
r.forEach((h, d) => {
|
|
1063
912
|
let c = 0, g = 0, l = 0;
|
|
1064
913
|
const u = d > 0, p = d < s, f = u && p;
|
|
1065
|
-
if (u && (c = -
|
|
914
|
+
if (u && (c = -o, g = -n, l = a), p) {
|
|
1066
915
|
const V = r[d + 1];
|
|
1067
|
-
|
|
916
|
+
o = V.x - h.x, n = V.y - h.y, a = Math.sqrt(o * o + n * n);
|
|
1068
917
|
}
|
|
1069
|
-
const
|
|
918
|
+
const x = a !== 0 ? Math.min((f ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, b = f ? { x: h.x + o * x, y: h.y + n * x } : h, C = l !== 0 ? Math.min((f ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, L = f ? { x: h.x + c * C, y: h.y + g * C } : h;
|
|
1070
919
|
d > 0 && t.push(`L ${L.x} ${L.y}`), f && t.push(
|
|
1071
920
|
`C ${h.x} ${h.y} ${h.x} ${h.y} ${b.x} ${b.y}`
|
|
1072
921
|
);
|
|
@@ -1074,10 +923,10 @@ const Z = Object.freeze({
|
|
|
1074
923
|
}
|
|
1075
924
|
return t.join(" ");
|
|
1076
925
|
};
|
|
1077
|
-
class
|
|
926
|
+
class ct {
|
|
1078
927
|
constructor(e) {
|
|
1079
|
-
|
|
1080
|
-
|
|
928
|
+
i(this, "path");
|
|
929
|
+
i(this, "midpoint");
|
|
1081
930
|
this.params = e;
|
|
1082
931
|
const t = this.params.to;
|
|
1083
932
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
@@ -1085,7 +934,7 @@ class ot {
|
|
|
1085
934
|
{ x: this.params.arrowLength, y: w.y },
|
|
1086
935
|
this.params.sourceDirection,
|
|
1087
936
|
w
|
|
1088
|
-
) : w,
|
|
937
|
+
) : w, o = this.params.hasTargetArrow ? m(
|
|
1089
938
|
{
|
|
1090
939
|
x: this.params.to.x - this.params.arrowLength,
|
|
1091
940
|
y: this.params.to.y
|
|
@@ -1107,16 +956,16 @@ class ot {
|
|
|
1107
956
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
1108
957
|
y: d.y
|
|
1109
958
|
}, f = { x: p.x, y: g };
|
|
1110
|
-
this.path =
|
|
1111
|
-
[s, h, l, u, f, p, d,
|
|
959
|
+
this.path = M(
|
|
960
|
+
[s, h, l, u, f, p, d, o],
|
|
1112
961
|
this.params.roundness
|
|
1113
962
|
);
|
|
1114
963
|
}
|
|
1115
964
|
}
|
|
1116
|
-
class
|
|
965
|
+
class lt {
|
|
1117
966
|
constructor(e) {
|
|
1118
|
-
|
|
1119
|
-
|
|
967
|
+
i(this, "path");
|
|
968
|
+
i(this, "midpoint");
|
|
1120
969
|
this.params = e;
|
|
1121
970
|
const t = this.params.hasSourceArrow ? m(
|
|
1122
971
|
{ x: this.params.arrowLength, y: w.y },
|
|
@@ -1129,25 +978,25 @@ class it {
|
|
|
1129
978
|
},
|
|
1130
979
|
this.params.targetDirection,
|
|
1131
980
|
this.params.to
|
|
1132
|
-
) : this.params.to,
|
|
1133
|
-
{ x:
|
|
981
|
+
) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
982
|
+
{ x: o, y: w.y },
|
|
1134
983
|
this.params.sourceDirection,
|
|
1135
984
|
w
|
|
1136
985
|
), 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 -
|
|
986
|
+
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
1138
987
|
this.params.targetDirection,
|
|
1139
988
|
this.params.to
|
|
1140
989
|
), u = { x: l.x + d, y: l.y + c }, p = { x: (g.x + u.x) / 2, y: (g.y + u.y) / 2 };
|
|
1141
|
-
this.midpoint = z(p, e.flipX, e.flipY, e.to), this.path =
|
|
990
|
+
this.midpoint = z(p, e.flipX, e.flipY, e.to), this.path = M(
|
|
1142
991
|
[t, n, g, u, l, s],
|
|
1143
992
|
this.params.roundness
|
|
1144
993
|
);
|
|
1145
994
|
}
|
|
1146
995
|
}
|
|
1147
|
-
class
|
|
996
|
+
class gt {
|
|
1148
997
|
constructor(e) {
|
|
1149
|
-
|
|
1150
|
-
|
|
998
|
+
i(this, "path");
|
|
999
|
+
i(this, "midpoint");
|
|
1151
1000
|
this.params = e;
|
|
1152
1001
|
const t = this.params.to;
|
|
1153
1002
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
@@ -1155,7 +1004,7 @@ class nt {
|
|
|
1155
1004
|
{ x: this.params.arrowLength, y: w.y },
|
|
1156
1005
|
this.params.sourceDirection,
|
|
1157
1006
|
w
|
|
1158
|
-
) : w,
|
|
1007
|
+
) : w, o = this.params.hasTargetArrow ? m(
|
|
1159
1008
|
{
|
|
1160
1009
|
x: this.params.to.x - this.params.arrowLength,
|
|
1161
1010
|
y: this.params.to.y
|
|
@@ -1171,13 +1020,13 @@ class nt {
|
|
|
1171
1020
|
this.params.targetDirection,
|
|
1172
1021
|
this.params.to
|
|
1173
1022
|
);
|
|
1174
|
-
this.path =
|
|
1023
|
+
this.path = M([s, a, h, o], this.params.roundness);
|
|
1175
1024
|
}
|
|
1176
1025
|
}
|
|
1177
|
-
class
|
|
1026
|
+
class ut {
|
|
1178
1027
|
constructor(e) {
|
|
1179
|
-
|
|
1180
|
-
|
|
1028
|
+
i(this, "path");
|
|
1029
|
+
i(this, "midpoint");
|
|
1181
1030
|
this.params = e;
|
|
1182
1031
|
const t = this.params.to;
|
|
1183
1032
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
@@ -1185,7 +1034,7 @@ class at {
|
|
|
1185
1034
|
{ x: this.params.arrowLength, y: w.y },
|
|
1186
1035
|
this.params.sourceDirection,
|
|
1187
1036
|
w
|
|
1188
|
-
) : w,
|
|
1037
|
+
) : w, o = this.params.hasTargetArrow ? m(
|
|
1189
1038
|
{
|
|
1190
1039
|
x: this.params.to.x - this.params.arrowLength,
|
|
1191
1040
|
y: this.params.to.y
|
|
@@ -1207,38 +1056,38 @@ class at {
|
|
|
1207
1056
|
x: d.x,
|
|
1208
1057
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1209
1058
|
}, f = { x: g, y: p.y };
|
|
1210
|
-
this.path =
|
|
1211
|
-
[s, h, l, u, f, p, d,
|
|
1059
|
+
this.path = M(
|
|
1060
|
+
[s, h, l, u, f, p, d, o],
|
|
1212
1061
|
this.params.roundness
|
|
1213
1062
|
);
|
|
1214
1063
|
}
|
|
1215
1064
|
}
|
|
1216
1065
|
class J {
|
|
1217
1066
|
constructor(e) {
|
|
1218
|
-
|
|
1219
|
-
|
|
1067
|
+
i(this, "path");
|
|
1068
|
+
i(this, "midpoint");
|
|
1220
1069
|
this.params = e;
|
|
1221
|
-
const t = this.params.arrowOffset, s = this.params.side,
|
|
1070
|
+
const t = this.params.arrowOffset, s = this.params.side, o = this.params.arrowLength + t, n = o + 2 * s, h = [
|
|
1222
1071
|
{ x: this.params.arrowLength, y: w.y },
|
|
1223
|
-
{ x:
|
|
1224
|
-
{ x:
|
|
1072
|
+
{ x: o, y: w.y },
|
|
1073
|
+
{ x: o, y: this.params.side },
|
|
1225
1074
|
{ x: n, y: this.params.side },
|
|
1226
1075
|
{ x: n, y: -this.params.side },
|
|
1227
|
-
{ x:
|
|
1228
|
-
{ x:
|
|
1076
|
+
{ x: o, y: -this.params.side },
|
|
1077
|
+
{ x: o, y: w.y },
|
|
1229
1078
|
{ x: this.params.arrowLength, y: w.y }
|
|
1230
1079
|
].map(
|
|
1231
1080
|
(c) => m(c, this.params.sourceDirection, w)
|
|
1232
1081
|
), d = `M ${w.x} ${w.y} L ${h[0].x} ${h[0].y} `;
|
|
1233
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${
|
|
1082
|
+
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
1083
|
}
|
|
1235
1084
|
}
|
|
1236
|
-
class
|
|
1085
|
+
class pt {
|
|
1237
1086
|
constructor(e) {
|
|
1238
|
-
|
|
1239
|
-
|
|
1087
|
+
i(this, "path");
|
|
1088
|
+
i(this, "midpoint");
|
|
1240
1089
|
this.params = e;
|
|
1241
|
-
const t = this.params.smallRadius, s = this.params.radius,
|
|
1090
|
+
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
1091
|
{ x: this.params.arrowLength, y: w.y },
|
|
1243
1092
|
{ x: c, y: n },
|
|
1244
1093
|
{ x: c, y: -n },
|
|
@@ -1254,11 +1103,11 @@ class ht {
|
|
|
1254
1103
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : p}${u}`, this.midpoint = l[3];
|
|
1255
1104
|
}
|
|
1256
1105
|
}
|
|
1257
|
-
class
|
|
1106
|
+
class wt {
|
|
1258
1107
|
constructor(e) {
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1108
|
+
i(this, "path");
|
|
1109
|
+
i(this, "midpoint");
|
|
1110
|
+
i(this, "diagonalDistance");
|
|
1262
1111
|
this.params = e;
|
|
1263
1112
|
const t = this.params.to;
|
|
1264
1113
|
if (this.midpoint = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
|
|
@@ -1269,7 +1118,7 @@ class dt {
|
|
|
1269
1118
|
this.path = "";
|
|
1270
1119
|
return;
|
|
1271
1120
|
}
|
|
1272
|
-
const
|
|
1121
|
+
const o = this.createDirectLinePoint({
|
|
1273
1122
|
offset: this.params.sourceOffset,
|
|
1274
1123
|
hasArrow: this.params.hasSourceArrow,
|
|
1275
1124
|
flip: 1,
|
|
@@ -1280,20 +1129,20 @@ class dt {
|
|
|
1280
1129
|
flip: -1,
|
|
1281
1130
|
shift: this.params.to
|
|
1282
1131
|
});
|
|
1283
|
-
this.path = `M ${
|
|
1132
|
+
this.path = `M ${o.x} ${o.y} L ${n.x} ${n.y}`;
|
|
1284
1133
|
}
|
|
1285
1134
|
createDirectLinePoint(e) {
|
|
1286
|
-
const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t,
|
|
1135
|
+
const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, o = e.flip * s / this.diagonalDistance;
|
|
1287
1136
|
return {
|
|
1288
|
-
x: this.params.to.x *
|
|
1289
|
-
y: this.params.to.y *
|
|
1137
|
+
x: this.params.to.x * o + e.shift.x,
|
|
1138
|
+
y: this.params.to.y * o + e.shift.y
|
|
1290
1139
|
};
|
|
1291
1140
|
}
|
|
1292
1141
|
}
|
|
1293
|
-
class
|
|
1142
|
+
class ft {
|
|
1294
1143
|
constructor(e) {
|
|
1295
|
-
|
|
1296
|
-
|
|
1144
|
+
i(this, "path");
|
|
1145
|
+
i(this, "midpoint");
|
|
1297
1146
|
this.params = e;
|
|
1298
1147
|
const t = this.params.hasSourceArrow ? m(
|
|
1299
1148
|
{ x: this.params.arrowLength, y: w.y },
|
|
@@ -1306,19 +1155,19 @@ class ct {
|
|
|
1306
1155
|
},
|
|
1307
1156
|
this.params.targetDirection,
|
|
1308
1157
|
this.params.to
|
|
1309
|
-
) : this.params.to,
|
|
1310
|
-
{ x:
|
|
1158
|
+
) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1159
|
+
{ x: o, y: w.y },
|
|
1311
1160
|
this.params.sourceDirection,
|
|
1312
1161
|
w
|
|
1313
1162
|
), a = m(
|
|
1314
|
-
{ x: this.params.to.x -
|
|
1163
|
+
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
1315
1164
|
this.params.targetDirection,
|
|
1316
1165
|
this.params.to
|
|
1317
1166
|
), 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
1167
|
x: (n.x + a.x) / 2,
|
|
1319
1168
|
y: g
|
|
1320
1169
|
};
|
|
1321
|
-
this.midpoint = z(l, e.flipX, e.flipY, e.to), this.path =
|
|
1170
|
+
this.midpoint = z(l, e.flipX, e.flipY, e.to), this.path = M(
|
|
1322
1171
|
[
|
|
1323
1172
|
t,
|
|
1324
1173
|
n,
|
|
@@ -1331,10 +1180,10 @@ class ct {
|
|
|
1331
1180
|
);
|
|
1332
1181
|
}
|
|
1333
1182
|
}
|
|
1334
|
-
class
|
|
1183
|
+
class yt {
|
|
1335
1184
|
constructor(e) {
|
|
1336
|
-
|
|
1337
|
-
|
|
1185
|
+
i(this, "path");
|
|
1186
|
+
i(this, "midpoint");
|
|
1338
1187
|
this.params = e;
|
|
1339
1188
|
const t = this.params.hasSourceArrow ? m(
|
|
1340
1189
|
{ x: this.params.arrowLength, y: w.y },
|
|
@@ -1347,19 +1196,19 @@ class lt {
|
|
|
1347
1196
|
},
|
|
1348
1197
|
this.params.targetDirection,
|
|
1349
1198
|
this.params.to
|
|
1350
|
-
) : this.params.to,
|
|
1351
|
-
{ x:
|
|
1199
|
+
) : this.params.to, o = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1200
|
+
{ x: o, y: w.y },
|
|
1352
1201
|
this.params.sourceDirection,
|
|
1353
1202
|
w
|
|
1354
1203
|
), a = m(
|
|
1355
|
-
{ x: this.params.to.x -
|
|
1204
|
+
{ x: this.params.to.x - o, y: this.params.to.y },
|
|
1356
1205
|
this.params.targetDirection,
|
|
1357
1206
|
this.params.to
|
|
1358
1207
|
), 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
1208
|
x: g,
|
|
1360
1209
|
y: (n.y + a.y) / 2
|
|
1361
1210
|
};
|
|
1362
|
-
this.midpoint = z(l, e.flipX, e.flipY, e.to), this.path =
|
|
1211
|
+
this.midpoint = z(l, e.flipX, e.flipY, e.to), this.path = M(
|
|
1363
1212
|
[
|
|
1364
1213
|
t,
|
|
1365
1214
|
n,
|
|
@@ -1394,39 +1243,39 @@ const y = Object.freeze({
|
|
|
1394
1243
|
curvature: 90,
|
|
1395
1244
|
interactiveWidth: 10,
|
|
1396
1245
|
preOffset: 0
|
|
1397
|
-
}),
|
|
1246
|
+
}), fe = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
|
|
1398
1247
|
class k {
|
|
1399
1248
|
constructor(e) {
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] =
|
|
1249
|
+
i(this, "svg");
|
|
1250
|
+
i(this, "group", Re());
|
|
1251
|
+
i(this, "line");
|
|
1252
|
+
i(this, "sourceArrow", null);
|
|
1253
|
+
i(this, "targetArrow", null);
|
|
1254
|
+
i(this, "onAfterRender");
|
|
1255
|
+
i(this, "afterRenderEmitter");
|
|
1256
|
+
i(this, "arrowRenderer");
|
|
1257
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = S(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Me(e.color), this.svg.appendChild(this.group), this.line = De(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
1258
|
}
|
|
1410
1259
|
render(e) {
|
|
1411
|
-
const { x: t, y: s, width:
|
|
1260
|
+
const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = Te(
|
|
1412
1261
|
e.from,
|
|
1413
1262
|
e.to
|
|
1414
1263
|
);
|
|
1415
|
-
|
|
1416
|
-
const d =
|
|
1264
|
+
Le(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1265
|
+
const d = fe(
|
|
1417
1266
|
e.from.direction,
|
|
1418
1267
|
a,
|
|
1419
1268
|
h
|
|
1420
|
-
), c =
|
|
1269
|
+
), c = fe(
|
|
1421
1270
|
e.to.direction,
|
|
1422
1271
|
a,
|
|
1423
1272
|
h
|
|
1424
1273
|
), g = {
|
|
1425
|
-
x:
|
|
1274
|
+
x: o,
|
|
1426
1275
|
y: n
|
|
1427
1276
|
};
|
|
1428
1277
|
let l = { x: -c.x, y: -c.y }, u;
|
|
1429
|
-
e.category ===
|
|
1278
|
+
e.category === D.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === D.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
|
|
1430
1279
|
const p = u(
|
|
1431
1280
|
d,
|
|
1432
1281
|
c,
|
|
@@ -1441,19 +1290,19 @@ class k {
|
|
|
1441
1290
|
shift: w,
|
|
1442
1291
|
arrowLength: this.params.arrowLength
|
|
1443
1292
|
}), this.sourceArrow.setAttribute("d", f));
|
|
1444
|
-
let
|
|
1445
|
-
this.targetArrow && (
|
|
1293
|
+
let v = null;
|
|
1294
|
+
this.targetArrow && (v = this.arrowRenderer({
|
|
1446
1295
|
direction: l,
|
|
1447
1296
|
shift: g,
|
|
1448
1297
|
arrowLength: this.params.arrowLength
|
|
1449
|
-
}), this.targetArrow.setAttribute("d",
|
|
1298
|
+
}), this.targetArrow.setAttribute("d", v)), this.afterRenderEmitter.emit({
|
|
1450
1299
|
edgePath: p,
|
|
1451
1300
|
sourceArrowPath: f,
|
|
1452
|
-
targetArrowPath:
|
|
1301
|
+
targetArrowPath: v
|
|
1453
1302
|
});
|
|
1454
1303
|
}
|
|
1455
1304
|
}
|
|
1456
|
-
const
|
|
1305
|
+
const mt = (r) => (e) => {
|
|
1457
1306
|
const s = [
|
|
1458
1307
|
w,
|
|
1459
1308
|
{ x: e.arrowLength, y: r.radius },
|
|
@@ -1463,18 +1312,18 @@ const gt = (r) => (e) => {
|
|
|
1463
1312
|
).map((h) => ({
|
|
1464
1313
|
x: h.x + e.shift.x,
|
|
1465
1314
|
y: h.y + e.shift.y
|
|
1466
|
-
})),
|
|
1467
|
-
return `${
|
|
1468
|
-
},
|
|
1469
|
-
const t = r.radius, s = e.arrowLength,
|
|
1315
|
+
})), o = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
|
|
1316
|
+
return `${o} ${n} ${a} Z`;
|
|
1317
|
+
}, vt = (r) => (e) => {
|
|
1318
|
+
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 = [w, { x: a, y: -h }, { x: a, y: h }].map(
|
|
1470
1319
|
(f) => m(f, e.direction, w)
|
|
1471
1320
|
).map((f) => ({
|
|
1472
1321
|
x: f.x + e.shift.x,
|
|
1473
1322
|
y: f.y + e.shift.y
|
|
1474
|
-
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${
|
|
1323
|
+
})), 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}`, p = `A ${o} ${o} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1475
1324
|
return `${g} ${l} ${u} ${p}`;
|
|
1476
|
-
},
|
|
1477
|
-
const t = r.smallRadius, s = r.radius,
|
|
1325
|
+
}, At = (r) => (e) => {
|
|
1326
|
+
const t = r.smallRadius, s = r.radius, o = m(
|
|
1478
1327
|
{
|
|
1479
1328
|
x: e.arrowLength,
|
|
1480
1329
|
y: 0
|
|
@@ -1487,7 +1336,7 @@ const gt = (r) => (e) => {
|
|
|
1487
1336
|
x: e.arrowLength + r.smallRadius,
|
|
1488
1337
|
y: 0
|
|
1489
1338
|
}
|
|
1490
|
-
), a = [w, { x:
|
|
1339
|
+
), a = [w, { x: o.x, y: -o.y }, o].map(
|
|
1491
1340
|
(l) => m(l, e.direction, w)
|
|
1492
1341
|
).map((l) => ({
|
|
1493
1342
|
x: l.x + e.shift.x,
|
|
@@ -1499,39 +1348,39 @@ const gt = (r) => (e) => {
|
|
|
1499
1348
|
return r;
|
|
1500
1349
|
switch (r.type) {
|
|
1501
1350
|
case "triangle":
|
|
1502
|
-
return
|
|
1351
|
+
return mt({
|
|
1503
1352
|
radius: r.radius ?? y.polygonArrowRadius
|
|
1504
1353
|
});
|
|
1505
1354
|
case "arc":
|
|
1506
|
-
return
|
|
1355
|
+
return vt({
|
|
1507
1356
|
radius: r.radius ?? y.circleArrowRadius
|
|
1508
1357
|
});
|
|
1509
1358
|
default:
|
|
1510
|
-
return
|
|
1359
|
+
return At({
|
|
1511
1360
|
smallRadius: r.smallRadius ?? y.wedgeArrowSmallRadius,
|
|
1512
1361
|
angle: r.angle ?? y.wedgeArrowAngle,
|
|
1513
1362
|
radius: r.radius ?? y.wedgeArrowRadius
|
|
1514
1363
|
});
|
|
1515
1364
|
}
|
|
1516
1365
|
};
|
|
1517
|
-
class
|
|
1366
|
+
class xt {
|
|
1518
1367
|
constructor(e) {
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1368
|
+
i(this, "svg");
|
|
1369
|
+
i(this, "group");
|
|
1370
|
+
i(this, "line");
|
|
1371
|
+
i(this, "sourceArrow");
|
|
1372
|
+
i(this, "targetArrow");
|
|
1373
|
+
i(this, "onAfterRender");
|
|
1374
|
+
i(this, "arrowLength");
|
|
1375
|
+
i(this, "curvature");
|
|
1376
|
+
i(this, "portCycleRadius");
|
|
1377
|
+
i(this, "portCycleSmallRadius");
|
|
1378
|
+
i(this, "detourDirection");
|
|
1379
|
+
i(this, "detourDistance");
|
|
1380
|
+
i(this, "hasSourceArrow");
|
|
1381
|
+
i(this, "hasTargetArrow");
|
|
1382
|
+
i(this, "pathShape");
|
|
1383
|
+
i(this, "createCyclePath", (e) => new pt({
|
|
1535
1384
|
sourceDirection: e,
|
|
1536
1385
|
radius: this.portCycleRadius,
|
|
1537
1386
|
smallRadius: this.portCycleSmallRadius,
|
|
@@ -1539,11 +1388,11 @@ class wt {
|
|
|
1539
1388
|
hasSourceArrow: this.hasSourceArrow,
|
|
1540
1389
|
hasTargetArrow: this.hasTargetArrow
|
|
1541
1390
|
}));
|
|
1542
|
-
|
|
1391
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new dt({
|
|
1543
1392
|
to: s,
|
|
1544
1393
|
sourceDirection: e,
|
|
1545
1394
|
targetDirection: t,
|
|
1546
|
-
flipX:
|
|
1395
|
+
flipX: o,
|
|
1547
1396
|
flipY: n,
|
|
1548
1397
|
arrowLength: this.arrowLength,
|
|
1549
1398
|
detourDirection: this.detourDirection,
|
|
@@ -1552,7 +1401,7 @@ class wt {
|
|
|
1552
1401
|
hasSourceArrow: this.hasSourceArrow,
|
|
1553
1402
|
hasTargetArrow: this.hasTargetArrow
|
|
1554
1403
|
}));
|
|
1555
|
-
|
|
1404
|
+
i(this, "createLinePath", (e, t, s) => new ht({
|
|
1556
1405
|
to: s,
|
|
1557
1406
|
sourceDirection: e,
|
|
1558
1407
|
targetDirection: t,
|
|
@@ -1577,23 +1426,23 @@ class wt {
|
|
|
1577
1426
|
this.pathShape.render(e);
|
|
1578
1427
|
}
|
|
1579
1428
|
}
|
|
1580
|
-
class
|
|
1429
|
+
class Et {
|
|
1581
1430
|
constructor(e) {
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1431
|
+
i(this, "svg");
|
|
1432
|
+
i(this, "group");
|
|
1433
|
+
i(this, "line");
|
|
1434
|
+
i(this, "sourceArrow");
|
|
1435
|
+
i(this, "targetArrow");
|
|
1436
|
+
i(this, "onAfterRender");
|
|
1437
|
+
i(this, "arrowLength");
|
|
1438
|
+
i(this, "arrowOffset");
|
|
1439
|
+
i(this, "roundness");
|
|
1440
|
+
i(this, "cycleSquareSide");
|
|
1441
|
+
i(this, "detourDistance");
|
|
1442
|
+
i(this, "hasSourceArrow");
|
|
1443
|
+
i(this, "hasTargetArrow");
|
|
1444
|
+
i(this, "pathShape");
|
|
1445
|
+
i(this, "createCyclePath", (e) => new J({
|
|
1597
1446
|
sourceDirection: e,
|
|
1598
1447
|
arrowLength: this.arrowLength,
|
|
1599
1448
|
side: this.cycleSquareSide,
|
|
@@ -1602,11 +1451,11 @@ class ft {
|
|
|
1602
1451
|
hasSourceArrow: this.hasSourceArrow,
|
|
1603
1452
|
hasTargetArrow: this.hasTargetArrow
|
|
1604
1453
|
}));
|
|
1605
|
-
|
|
1454
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new ft({
|
|
1606
1455
|
to: s,
|
|
1607
1456
|
sourceDirection: e,
|
|
1608
1457
|
targetDirection: t,
|
|
1609
|
-
flipX:
|
|
1458
|
+
flipX: o,
|
|
1610
1459
|
flipY: n,
|
|
1611
1460
|
arrowLength: this.arrowLength,
|
|
1612
1461
|
arrowOffset: this.arrowOffset,
|
|
@@ -1615,11 +1464,11 @@ class ft {
|
|
|
1615
1464
|
hasSourceArrow: this.hasSourceArrow,
|
|
1616
1465
|
hasTargetArrow: this.hasTargetArrow
|
|
1617
1466
|
}));
|
|
1618
|
-
|
|
1467
|
+
i(this, "createLinePath", (e, t, s, o) => new ct({
|
|
1619
1468
|
to: s,
|
|
1620
1469
|
sourceDirection: e,
|
|
1621
1470
|
targetDirection: t,
|
|
1622
|
-
flipX:
|
|
1471
|
+
flipX: o,
|
|
1623
1472
|
arrowLength: this.arrowLength,
|
|
1624
1473
|
arrowOffset: this.arrowOffset,
|
|
1625
1474
|
roundness: this.roundness,
|
|
@@ -1648,24 +1497,24 @@ class ft {
|
|
|
1648
1497
|
this.pathShape.render(e);
|
|
1649
1498
|
}
|
|
1650
1499
|
}
|
|
1651
|
-
class
|
|
1500
|
+
class St {
|
|
1652
1501
|
constructor(e) {
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1502
|
+
i(this, "svg");
|
|
1503
|
+
i(this, "group");
|
|
1504
|
+
i(this, "line");
|
|
1505
|
+
i(this, "sourceArrow");
|
|
1506
|
+
i(this, "targetArrow");
|
|
1507
|
+
i(this, "onAfterRender");
|
|
1508
|
+
i(this, "arrowLength");
|
|
1509
|
+
i(this, "arrowOffset");
|
|
1510
|
+
i(this, "roundness");
|
|
1511
|
+
i(this, "cycleSquareSide");
|
|
1512
|
+
i(this, "detourDirection");
|
|
1513
|
+
i(this, "detourDistance");
|
|
1514
|
+
i(this, "hasSourceArrow");
|
|
1515
|
+
i(this, "hasTargetArrow");
|
|
1516
|
+
i(this, "pathShape");
|
|
1517
|
+
i(this, "createCyclePath", (e) => new J({
|
|
1669
1518
|
sourceDirection: e,
|
|
1670
1519
|
arrowLength: this.arrowLength,
|
|
1671
1520
|
side: this.cycleSquareSide,
|
|
@@ -1674,11 +1523,11 @@ class yt {
|
|
|
1674
1523
|
hasSourceArrow: this.hasSourceArrow,
|
|
1675
1524
|
hasTargetArrow: this.hasTargetArrow
|
|
1676
1525
|
}));
|
|
1677
|
-
|
|
1526
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new lt({
|
|
1678
1527
|
to: s,
|
|
1679
1528
|
sourceDirection: e,
|
|
1680
1529
|
targetDirection: t,
|
|
1681
|
-
flipX:
|
|
1530
|
+
flipX: o,
|
|
1682
1531
|
flipY: n,
|
|
1683
1532
|
arrowLength: this.arrowLength,
|
|
1684
1533
|
arrowOffset: this.arrowOffset,
|
|
@@ -1688,7 +1537,7 @@ class yt {
|
|
|
1688
1537
|
hasSourceArrow: this.hasSourceArrow,
|
|
1689
1538
|
hasTargetArrow: this.hasTargetArrow
|
|
1690
1539
|
}));
|
|
1691
|
-
|
|
1540
|
+
i(this, "createLinePath", (e, t, s) => new gt({
|
|
1692
1541
|
to: s,
|
|
1693
1542
|
sourceDirection: e,
|
|
1694
1543
|
targetDirection: t,
|
|
@@ -1720,23 +1569,23 @@ class yt {
|
|
|
1720
1569
|
this.pathShape.render(e);
|
|
1721
1570
|
}
|
|
1722
1571
|
}
|
|
1723
|
-
class
|
|
1572
|
+
class bt {
|
|
1724
1573
|
constructor(e) {
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1574
|
+
i(this, "svg");
|
|
1575
|
+
i(this, "group");
|
|
1576
|
+
i(this, "line");
|
|
1577
|
+
i(this, "sourceArrow");
|
|
1578
|
+
i(this, "targetArrow");
|
|
1579
|
+
i(this, "onAfterRender");
|
|
1580
|
+
i(this, "arrowLength");
|
|
1581
|
+
i(this, "arrowOffset");
|
|
1582
|
+
i(this, "roundness");
|
|
1583
|
+
i(this, "cycleSquareSide");
|
|
1584
|
+
i(this, "detourDistance");
|
|
1585
|
+
i(this, "hasSourceArrow");
|
|
1586
|
+
i(this, "hasTargetArrow");
|
|
1587
|
+
i(this, "pathShape");
|
|
1588
|
+
i(this, "createCyclePath", (e) => new J({
|
|
1740
1589
|
sourceDirection: e,
|
|
1741
1590
|
arrowLength: this.arrowLength,
|
|
1742
1591
|
side: this.cycleSquareSide,
|
|
@@ -1745,11 +1594,11 @@ class mt {
|
|
|
1745
1594
|
hasSourceArrow: this.hasSourceArrow,
|
|
1746
1595
|
hasTargetArrow: this.hasTargetArrow
|
|
1747
1596
|
}));
|
|
1748
|
-
|
|
1597
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new yt({
|
|
1749
1598
|
to: s,
|
|
1750
1599
|
sourceDirection: e,
|
|
1751
1600
|
targetDirection: t,
|
|
1752
|
-
flipX:
|
|
1601
|
+
flipX: o,
|
|
1753
1602
|
flipY: n,
|
|
1754
1603
|
arrowLength: this.arrowLength,
|
|
1755
1604
|
arrowOffset: this.arrowOffset,
|
|
@@ -1758,7 +1607,7 @@ class mt {
|
|
|
1758
1607
|
hasSourceArrow: this.hasSourceArrow,
|
|
1759
1608
|
hasTargetArrow: this.hasTargetArrow
|
|
1760
1609
|
}));
|
|
1761
|
-
|
|
1610
|
+
i(this, "createLinePath", (e, t, s, o, n) => new ut({
|
|
1762
1611
|
to: s,
|
|
1763
1612
|
sourceDirection: e,
|
|
1764
1613
|
targetDirection: t,
|
|
@@ -1791,30 +1640,30 @@ class mt {
|
|
|
1791
1640
|
this.pathShape.render(e);
|
|
1792
1641
|
}
|
|
1793
1642
|
}
|
|
1794
|
-
class
|
|
1643
|
+
class Ve {
|
|
1795
1644
|
constructor(e) {
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
[this.afterRenderEmitter, this.onAfterRender] =
|
|
1645
|
+
i(this, "svg");
|
|
1646
|
+
i(this, "group", Re());
|
|
1647
|
+
i(this, "line");
|
|
1648
|
+
i(this, "sourceArrow", null);
|
|
1649
|
+
i(this, "targetArrow", null);
|
|
1650
|
+
i(this, "color");
|
|
1651
|
+
i(this, "width");
|
|
1652
|
+
i(this, "arrowLength");
|
|
1653
|
+
i(this, "sourceOffset");
|
|
1654
|
+
i(this, "targetOffset");
|
|
1655
|
+
i(this, "onAfterRender");
|
|
1656
|
+
i(this, "afterRenderEmitter");
|
|
1657
|
+
i(this, "arrowRenderer");
|
|
1658
|
+
[this.afterRenderEmitter, this.onAfterRender] = S(), 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 = Me(this.color), this.svg.appendChild(this.group), this.line = De(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
1659
|
}
|
|
1811
1660
|
render(e) {
|
|
1812
|
-
const { x: t, y: s, width:
|
|
1661
|
+
const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = Te(
|
|
1813
1662
|
e.from,
|
|
1814
1663
|
e.to
|
|
1815
1664
|
);
|
|
1816
|
-
|
|
1817
|
-
const d = { x:
|
|
1665
|
+
Le(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1666
|
+
const d = { x: o, y: n }, c = new wt({
|
|
1818
1667
|
to: d,
|
|
1819
1668
|
sourceOffset: this.sourceOffset,
|
|
1820
1669
|
targetOffset: this.targetOffset,
|
|
@@ -1865,57 +1714,57 @@ class Re {
|
|
|
1865
1714
|
});
|
|
1866
1715
|
}
|
|
1867
1716
|
}
|
|
1868
|
-
const
|
|
1717
|
+
const Pt = () => {
|
|
1869
1718
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1870
1719
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
1871
|
-
},
|
|
1720
|
+
}, Ct = (r) => {
|
|
1872
1721
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1873
1722
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
1874
|
-
},
|
|
1723
|
+
}, ye = (r) => {
|
|
1875
1724
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1876
1725
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
1877
1726
|
};
|
|
1878
|
-
class
|
|
1727
|
+
class Nt extends Error {
|
|
1879
1728
|
constructor(e) {
|
|
1880
1729
|
super(e), this.name = "InteractiveEdgeError";
|
|
1881
1730
|
}
|
|
1882
1731
|
}
|
|
1883
|
-
class
|
|
1732
|
+
class Fe {
|
|
1884
1733
|
constructor(e, t) {
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
if (this.baseEdge = e, e instanceof
|
|
1896
|
-
throw new
|
|
1734
|
+
i(this, "svg");
|
|
1735
|
+
i(this, "group");
|
|
1736
|
+
i(this, "line");
|
|
1737
|
+
i(this, "sourceArrow");
|
|
1738
|
+
i(this, "targetArrow");
|
|
1739
|
+
i(this, "handle", Pt());
|
|
1740
|
+
i(this, "onAfterRender");
|
|
1741
|
+
i(this, "interactiveLine");
|
|
1742
|
+
i(this, "interactiveSourceArrow", null);
|
|
1743
|
+
i(this, "interactiveTargetArrow", null);
|
|
1744
|
+
if (this.baseEdge = e, e instanceof Fe)
|
|
1745
|
+
throw new Nt(
|
|
1897
1746
|
"interactive edge can be configured only once"
|
|
1898
1747
|
);
|
|
1899
1748
|
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
1749
|
const s = (t == null ? void 0 : t.distance) ?? y.interactiveWidth;
|
|
1901
|
-
this.interactiveLine =
|
|
1902
|
-
this.interactiveLine.setAttribute("d",
|
|
1750
|
+
this.interactiveLine = Ct(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ye(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ye(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((o) => {
|
|
1751
|
+
this.interactiveLine.setAttribute("d", o.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", o.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", o.targetArrowPath);
|
|
1903
1752
|
});
|
|
1904
1753
|
}
|
|
1905
1754
|
render(e) {
|
|
1906
1755
|
this.baseEdge.render(e);
|
|
1907
1756
|
}
|
|
1908
1757
|
}
|
|
1909
|
-
class
|
|
1758
|
+
class Pr {
|
|
1910
1759
|
constructor(e, t) {
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1760
|
+
i(this, "group");
|
|
1761
|
+
i(this, "line");
|
|
1762
|
+
i(this, "sourceArrow");
|
|
1763
|
+
i(this, "targetArrow");
|
|
1764
|
+
i(this, "onAfterRender");
|
|
1765
|
+
i(this, "svg");
|
|
1917
1766
|
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
|
|
1767
|
+
const o = s.edgePath.midpoint, n = `translate(${o.x}px, ${o.y}px)`;
|
|
1919
1768
|
this.midpointElement.style.setProperty("transform", n);
|
|
1920
1769
|
});
|
|
1921
1770
|
}
|
|
@@ -1923,21 +1772,21 @@ class ur {
|
|
|
1923
1772
|
this.baseShape.render(e);
|
|
1924
1773
|
}
|
|
1925
1774
|
}
|
|
1926
|
-
class
|
|
1775
|
+
class Ie {
|
|
1927
1776
|
constructor(e) {
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1777
|
+
i(this, "onAfterNodeAdded");
|
|
1778
|
+
i(this, "onAfterNodeUpdated");
|
|
1779
|
+
i(this, "onAfterNodePriorityUpdated");
|
|
1780
|
+
i(this, "onBeforeNodeRemoved");
|
|
1781
|
+
i(this, "onAfterPortMarked");
|
|
1782
|
+
i(this, "onAfterPortUpdated");
|
|
1783
|
+
i(this, "onBeforePortUnmarked");
|
|
1784
|
+
i(this, "onAfterEdgeAdded");
|
|
1785
|
+
i(this, "onAfterEdgeShapeUpdated");
|
|
1786
|
+
i(this, "onAfterEdgeUpdated");
|
|
1787
|
+
i(this, "onAfterEdgePriorityUpdated");
|
|
1788
|
+
i(this, "onBeforeEdgeRemoved");
|
|
1789
|
+
i(this, "onBeforeClear");
|
|
1941
1790
|
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
1791
|
}
|
|
1943
1792
|
hasNode(e) {
|
|
@@ -2019,11 +1868,169 @@ class Ve {
|
|
|
2019
1868
|
return this.graphStore.getNodeAdjacentEdgeIds(e);
|
|
2020
1869
|
}
|
|
2021
1870
|
}
|
|
2022
|
-
class
|
|
1871
|
+
class X {
|
|
1872
|
+
constructor(e) {
|
|
1873
|
+
i(this, "counter", 0);
|
|
1874
|
+
this.checkExists = e;
|
|
1875
|
+
}
|
|
1876
|
+
create(e) {
|
|
1877
|
+
if (e !== void 0)
|
|
1878
|
+
return e;
|
|
1879
|
+
for (; this.checkExists(this.counter); )
|
|
1880
|
+
this.counter++;
|
|
1881
|
+
return this.counter;
|
|
1882
|
+
}
|
|
1883
|
+
reset() {
|
|
1884
|
+
this.counter = 0;
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
class Be {
|
|
1888
|
+
constructor(e, t, s) {
|
|
1889
|
+
i(this, "nodeIdGenerator", new X(
|
|
1890
|
+
(e) => this.graphStore.hasNode(e)
|
|
1891
|
+
));
|
|
1892
|
+
i(this, "portIdGenerator", new X(
|
|
1893
|
+
(e) => this.graphStore.hasPort(e)
|
|
1894
|
+
));
|
|
1895
|
+
i(this, "edgeIdGenerator", new X(
|
|
1896
|
+
(e) => this.graphStore.hasEdge(e)
|
|
1897
|
+
));
|
|
1898
|
+
i(this, "onAfterNodeAdded", (e) => {
|
|
1899
|
+
this.htmlView.attachNode(e);
|
|
1900
|
+
});
|
|
1901
|
+
i(this, "onAfterNodeUpdated", (e) => {
|
|
1902
|
+
this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((t) => {
|
|
1903
|
+
this.htmlView.renderEdge(t);
|
|
1904
|
+
});
|
|
1905
|
+
});
|
|
1906
|
+
i(this, "onAfterNodePriorityUpdated", (e) => {
|
|
1907
|
+
this.htmlView.updateNodePriority(e);
|
|
1908
|
+
});
|
|
1909
|
+
i(this, "onBeforeNodeRemoved", (e) => {
|
|
1910
|
+
this.graphStore.getNodePortIds(e).forEach((t) => {
|
|
1911
|
+
this.unmarkPort(t);
|
|
1912
|
+
}), this.htmlView.detachNode(e);
|
|
1913
|
+
});
|
|
1914
|
+
i(this, "onAfterPortUpdated", (e) => {
|
|
1915
|
+
this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
|
|
1916
|
+
this.htmlView.renderEdge(t);
|
|
1917
|
+
});
|
|
1918
|
+
});
|
|
1919
|
+
i(this, "onBeforePortUnmarked", (e) => {
|
|
1920
|
+
this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
|
|
1921
|
+
this.removeEdge(t);
|
|
1922
|
+
});
|
|
1923
|
+
});
|
|
1924
|
+
i(this, "onAfterEdgeAdded", (e) => {
|
|
1925
|
+
this.htmlView.attachEdge(e);
|
|
1926
|
+
});
|
|
1927
|
+
i(this, "onAfterEdgeShapeUpdated", (e) => {
|
|
1928
|
+
this.htmlView.updateEdgeShape(e);
|
|
1929
|
+
});
|
|
1930
|
+
i(this, "onAfterEdgeUpdated", (e) => {
|
|
1931
|
+
this.htmlView.renderEdge(e);
|
|
1932
|
+
});
|
|
1933
|
+
i(this, "onAfterEdgePriorityUpdated", (e) => {
|
|
1934
|
+
this.htmlView.updateEdgePriority(e);
|
|
1935
|
+
});
|
|
1936
|
+
i(this, "onBeforeEdgeRemoved", (e) => {
|
|
1937
|
+
this.htmlView.detachEdge(e);
|
|
1938
|
+
});
|
|
1939
|
+
i(this, "onBeforeClear", () => {
|
|
1940
|
+
this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
|
|
1941
|
+
});
|
|
1942
|
+
this.graphStore = e, this.htmlView = t, this.params = s, this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
|
|
1943
|
+
this.onAfterNodePriorityUpdated
|
|
1944
|
+
), 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(
|
|
1945
|
+
this.onAfterEdgeShapeUpdated
|
|
1946
|
+
), this.graphStore.onAfterEdgeUpdated.subscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.subscribe(
|
|
1947
|
+
this.onAfterEdgePriorityUpdated
|
|
1948
|
+
), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear);
|
|
1949
|
+
}
|
|
1950
|
+
addNode(e) {
|
|
1951
|
+
const t = this.nodeIdGenerator.create(e.id);
|
|
1952
|
+
if (this.graphStore.addNode({
|
|
1953
|
+
id: t,
|
|
1954
|
+
element: e.element,
|
|
1955
|
+
x: e.x ?? null,
|
|
1956
|
+
y: e.y ?? null,
|
|
1957
|
+
centerFn: e.centerFn ?? this.params.nodes.centerFn,
|
|
1958
|
+
priority: e.priority ?? this.params.nodes.priorityFn()
|
|
1959
|
+
}), e.ports !== void 0)
|
|
1960
|
+
for (const s of e.ports)
|
|
1961
|
+
this.markPort({
|
|
1962
|
+
id: s.id,
|
|
1963
|
+
element: s.element,
|
|
1964
|
+
nodeId: t,
|
|
1965
|
+
direction: s.direction
|
|
1966
|
+
});
|
|
1967
|
+
}
|
|
1968
|
+
updateNode(e, t) {
|
|
1969
|
+
this.graphStore.updateNode(e, t ?? {});
|
|
1970
|
+
}
|
|
1971
|
+
removeNode(e) {
|
|
1972
|
+
this.graphStore.removeNode(e);
|
|
1973
|
+
}
|
|
1974
|
+
markPort(e) {
|
|
1975
|
+
const t = this.portIdGenerator.create(e.id);
|
|
1976
|
+
this.graphStore.addPort({
|
|
1977
|
+
id: t,
|
|
1978
|
+
element: e.element,
|
|
1979
|
+
nodeId: e.nodeId,
|
|
1980
|
+
direction: e.direction ?? this.params.ports.direction
|
|
1981
|
+
});
|
|
1982
|
+
}
|
|
1983
|
+
updatePort(e, t) {
|
|
1984
|
+
this.graphStore.updatePort(e, t ?? {});
|
|
1985
|
+
}
|
|
1986
|
+
unmarkPort(e) {
|
|
1987
|
+
this.graphStore.removePort(e);
|
|
1988
|
+
}
|
|
1989
|
+
addEdge(e) {
|
|
1990
|
+
const t = this.edgeIdGenerator.create(e.id);
|
|
1991
|
+
this.graphStore.addEdge({
|
|
1992
|
+
id: t,
|
|
1993
|
+
from: e.from,
|
|
1994
|
+
to: e.to,
|
|
1995
|
+
shape: e.shape ?? this.params.edges.shapeFactory(t),
|
|
1996
|
+
priority: e.priority ?? this.params.edges.priorityFn()
|
|
1997
|
+
});
|
|
1998
|
+
}
|
|
1999
|
+
updateEdge(e, t) {
|
|
2000
|
+
this.graphStore.updateEdge(e, t ?? {});
|
|
2001
|
+
}
|
|
2002
|
+
removeEdge(e) {
|
|
2003
|
+
this.graphStore.removeEdge(e);
|
|
2004
|
+
}
|
|
2005
|
+
clear() {
|
|
2006
|
+
this.graphStore.clear();
|
|
2007
|
+
}
|
|
2008
|
+
destroy() {
|
|
2009
|
+
this.clear(), this.graphStore.onAfterNodeAdded.unsubscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.unsubscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.unsubscribe(
|
|
2010
|
+
this.onAfterNodePriorityUpdated
|
|
2011
|
+
), this.graphStore.onBeforeNodeRemoved.unsubscribe(this.onBeforeNodeRemoved), this.graphStore.onAfterPortUpdated.unsubscribe(this.onAfterPortUpdated), this.graphStore.onBeforePortRemoved.unsubscribe(this.onBeforePortUnmarked), this.graphStore.onAfterEdgeAdded.unsubscribe(this.onAfterEdgeAdded), this.graphStore.onAfterEdgeShapeUpdated.unsubscribe(
|
|
2012
|
+
this.onAfterEdgeShapeUpdated
|
|
2013
|
+
), this.graphStore.onAfterEdgeUpdated.unsubscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.unsubscribe(
|
|
2014
|
+
this.onAfterEdgePriorityUpdated
|
|
2015
|
+
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
const Tt = (r) => {
|
|
2019
|
+
setTimeout(() => {
|
|
2020
|
+
r();
|
|
2021
|
+
});
|
|
2022
|
+
}, Mt = (r) => {
|
|
2023
|
+
queueMicrotask(() => {
|
|
2024
|
+
r();
|
|
2025
|
+
});
|
|
2026
|
+
}, _ = (r) => {
|
|
2027
|
+
r();
|
|
2028
|
+
};
|
|
2029
|
+
class $e {
|
|
2023
2030
|
constructor(e) {
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2031
|
+
i(this, "onBeforeUpdated");
|
|
2032
|
+
i(this, "onAfterUpdated");
|
|
2033
|
+
i(this, "onAfterResize");
|
|
2027
2034
|
this.viewportStore = e, this.onBeforeUpdated = this.viewportStore.onBeforeUpdated, this.onAfterUpdated = this.viewportStore.onAfterUpdated, this.onAfterResize = this.viewportStore.onAfterResize;
|
|
2028
2035
|
}
|
|
2029
2036
|
getViewportMatrix() {
|
|
@@ -2042,45 +2049,124 @@ class Fe {
|
|
|
2042
2049
|
return this.viewportStore.createViewportCoords(e);
|
|
2043
2050
|
}
|
|
2044
2051
|
}
|
|
2045
|
-
const
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2052
|
+
const Dt = (r, e) => Symbol.iterator in r ? {
|
|
2053
|
+
minContentScale: e.focus.minContentScale,
|
|
2054
|
+
nodes: r,
|
|
2055
|
+
contentOffset: e.focus.contentOffset
|
|
2056
|
+
} : {
|
|
2057
|
+
minContentScale: r.minContentScale ?? e.focus.minContentScale,
|
|
2058
|
+
nodes: r.nodes ?? [],
|
|
2059
|
+
contentOffset: r.contentOffset ?? e.focus.contentOffset
|
|
2060
|
+
}, Ue = (r, e, t) => ({
|
|
2061
|
+
scale: r.scale,
|
|
2062
|
+
x: r.x + r.scale * e,
|
|
2063
|
+
y: r.y + r.scale * t
|
|
2064
|
+
}), Oe = (r, e, t, s) => ({
|
|
2065
|
+
scale: r.scale * e,
|
|
2066
|
+
x: r.scale * (1 - e) * t + r.x,
|
|
2067
|
+
y: r.scale * (1 - e) * s + r.y
|
|
2068
|
+
});
|
|
2069
|
+
class We {
|
|
2070
|
+
constructor(e, t, s) {
|
|
2071
|
+
this.graphStore = e, this.viewportStore = t, this.params = s;
|
|
2072
|
+
}
|
|
2073
|
+
patchViewportMatrix(e) {
|
|
2074
|
+
this.viewportStore.patchViewportMatrix(e);
|
|
2075
|
+
}
|
|
2076
|
+
patchContentMatrix(e) {
|
|
2077
|
+
this.viewportStore.patchContentMatrix(e);
|
|
2078
|
+
}
|
|
2079
|
+
center(e, t) {
|
|
2080
|
+
const { width: s, height: o } = this.viewportStore.getDimensions(), n = { x: s / 2, y: o / 2 }, a = this.viewportStore.getViewportMatrix(), h = this.viewportStore.createViewportCoords(e), d = h.x - n.x, c = h.y - n.y;
|
|
2081
|
+
let g = Ue(a, d, c);
|
|
2082
|
+
const l = t == null ? void 0 : t.contentScale;
|
|
2083
|
+
if (l !== void 0) {
|
|
2084
|
+
const u = 1 / l;
|
|
2085
|
+
g = Oe(
|
|
2086
|
+
g,
|
|
2087
|
+
u / a.scale,
|
|
2088
|
+
n.x,
|
|
2089
|
+
n.y
|
|
2090
|
+
);
|
|
2091
|
+
}
|
|
2092
|
+
this.viewportStore.patchViewportMatrix(g);
|
|
2093
|
+
}
|
|
2094
|
+
focus(e) {
|
|
2095
|
+
const t = Dt(e ?? {}, this.params);
|
|
2096
|
+
this.params.focus.schedule(() => {
|
|
2097
|
+
this.navigate(t);
|
|
2098
|
+
});
|
|
2099
|
+
}
|
|
2100
|
+
destroy() {
|
|
2101
|
+
this.viewportStore.destroy();
|
|
2102
|
+
}
|
|
2103
|
+
navigate(e) {
|
|
2104
|
+
let t = 1 / 0, s = -1 / 0, o = 1 / 0, n = -1 / 0, a = 0;
|
|
2105
|
+
const h = /* @__PURE__ */ new Set();
|
|
2106
|
+
for (const d of e.nodes)
|
|
2107
|
+
h.add(d);
|
|
2108
|
+
if (this.graphStore.getAllNodeIds().forEach((d) => {
|
|
2109
|
+
const { payload: c } = this.graphStore.getNode(d);
|
|
2110
|
+
c.x !== null && c.y !== null && (h.size === 0 || h.has(d)) && (t = Math.min(c.x, t), s = Math.max(c.x, s), o = Math.min(c.y, o), n = Math.max(c.y, n), a++);
|
|
2111
|
+
}), a > 0) {
|
|
2112
|
+
t -= e.contentOffset, o -= e.contentOffset, s += e.contentOffset, n += e.contentOffset;
|
|
2113
|
+
const d = {
|
|
2114
|
+
x: (t + s) / 2,
|
|
2115
|
+
y: (o + n) / 2
|
|
2116
|
+
}, c = (s - t) / 2, g = (n - o) / 2, { width: l, height: u } = this.viewportStore.getDimensions(), p = l / 2, f = u / 2, v = Math.max(
|
|
2117
|
+
c / p,
|
|
2118
|
+
g / f
|
|
2119
|
+
), { scale: x } = this.viewportStore.getContentMatrix(), b = v > 1 ? x / v : x, P = Math.max(b, e.minContentScale);
|
|
2120
|
+
this.center(d, { contentScale: P });
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
const ze = (r, e) => {
|
|
2125
|
+
const t = new be(), s = new Ie(t), o = new $e(e), n = new Ee(t, e, r), a = {
|
|
2126
|
+
nodes: {
|
|
2127
|
+
centerFn: Ne,
|
|
2128
|
+
priorityFn: () => 0
|
|
2129
|
+
},
|
|
2130
|
+
edges: {
|
|
2131
|
+
shapeFactory: () => new Ve(),
|
|
2132
|
+
priorityFn: () => 0
|
|
2133
|
+
},
|
|
2134
|
+
ports: {
|
|
2135
|
+
direction: 0
|
|
2136
|
+
}
|
|
2137
|
+
}, h = new Be(
|
|
2138
|
+
t,
|
|
2139
|
+
n,
|
|
2140
|
+
a
|
|
2141
|
+
), d = {
|
|
2142
|
+
focus: {
|
|
2143
|
+
contentOffset: 0,
|
|
2144
|
+
minContentScale: 0,
|
|
2145
|
+
schedule: _
|
|
2146
|
+
}
|
|
2147
|
+
}, c = new We(
|
|
2148
|
+
t,
|
|
2149
|
+
e,
|
|
2150
|
+
d
|
|
2066
2151
|
);
|
|
2152
|
+
return new Se(s, o, h, c);
|
|
2067
2153
|
};
|
|
2068
2154
|
class H {
|
|
2069
|
-
constructor(e, t, s,
|
|
2070
|
-
|
|
2155
|
+
constructor(e, t, s, o) {
|
|
2156
|
+
i(this, "onAfterPortMarked", (e) => {
|
|
2071
2157
|
const t = this.canvas.graph.getPort(e);
|
|
2072
2158
|
this.canvas.graph.findPortIdsByElement(t.element).length === 1 && this.hookPortEvents(t.element);
|
|
2073
2159
|
});
|
|
2074
|
-
|
|
2160
|
+
i(this, "onBeforePortUnmarked", (e) => {
|
|
2075
2161
|
const t = this.canvas.graph.getPort(e);
|
|
2076
2162
|
this.canvas.graph.findPortIdsByElement(t.element).length === 1 && this.unhookPortEvents(t.element);
|
|
2077
2163
|
});
|
|
2078
|
-
|
|
2164
|
+
i(this, "onPortMouseDown", (e) => {
|
|
2079
2165
|
const t = e;
|
|
2080
2166
|
if (!this.params.mouseDownEventVerifier(t))
|
|
2081
2167
|
return;
|
|
2082
|
-
const s = e.currentTarget,
|
|
2083
|
-
this.params.onPortPointerDown(
|
|
2168
|
+
const s = e.currentTarget, o = this.canvas.graph.findPortIdsByElement(s)[0];
|
|
2169
|
+
this.params.onPortPointerDown(o, {
|
|
2084
2170
|
x: t.clientX,
|
|
2085
2171
|
y: t.clientY
|
|
2086
2172
|
}) && (e.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
@@ -2089,7 +2175,7 @@ class H {
|
|
|
2089
2175
|
passive: !0
|
|
2090
2176
|
}));
|
|
2091
2177
|
});
|
|
2092
|
-
|
|
2178
|
+
i(this, "onWindowMouseMove", (e) => {
|
|
2093
2179
|
if (!R(
|
|
2094
2180
|
this.window,
|
|
2095
2181
|
this.element,
|
|
@@ -2101,14 +2187,14 @@ class H {
|
|
|
2101
2187
|
}
|
|
2102
2188
|
this.params.onPointerMove({ x: e.clientX, y: e.clientY });
|
|
2103
2189
|
});
|
|
2104
|
-
|
|
2190
|
+
i(this, "onWindowMouseUp", (e) => {
|
|
2105
2191
|
this.params.mouseUpEventVerifier(e) && (this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
|
|
2106
2192
|
});
|
|
2107
|
-
|
|
2193
|
+
i(this, "onPortTouchStart", (e) => {
|
|
2108
2194
|
const t = e;
|
|
2109
2195
|
if (t.touches.length !== 1)
|
|
2110
2196
|
return;
|
|
2111
|
-
const s = t.touches[0],
|
|
2197
|
+
const s = t.touches[0], o = e.currentTarget, n = this.canvas.graph.findPortIdsByElement(o)[0];
|
|
2112
2198
|
this.params.onPortPointerDown(n, {
|
|
2113
2199
|
x: s.clientX,
|
|
2114
2200
|
y: s.clientY
|
|
@@ -2120,7 +2206,7 @@ class H {
|
|
|
2120
2206
|
passive: !0
|
|
2121
2207
|
}));
|
|
2122
2208
|
});
|
|
2123
|
-
|
|
2209
|
+
i(this, "onWindowTouchMove", (e) => {
|
|
2124
2210
|
const t = e.touches[0];
|
|
2125
2211
|
if (!R(
|
|
2126
2212
|
this.window,
|
|
@@ -2133,23 +2219,23 @@ class H {
|
|
|
2133
2219
|
}
|
|
2134
2220
|
this.params.onPointerMove({ x: t.clientX, y: t.clientY });
|
|
2135
2221
|
});
|
|
2136
|
-
|
|
2222
|
+
i(this, "onWindowTouchFinish", (e) => {
|
|
2137
2223
|
const t = e.changedTouches[0];
|
|
2138
2224
|
this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
|
|
2139
2225
|
});
|
|
2140
|
-
|
|
2226
|
+
i(this, "onBeforeClear", () => {
|
|
2141
2227
|
this.canvas.graph.getAllPortIds().forEach((e) => {
|
|
2142
2228
|
const t = this.canvas.graph.getPort(e);
|
|
2143
2229
|
this.unhookPortEvents(t.element);
|
|
2144
2230
|
});
|
|
2145
2231
|
});
|
|
2146
|
-
|
|
2232
|
+
i(this, "onBeforeDestroy", () => {
|
|
2147
2233
|
this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
2148
2234
|
});
|
|
2149
|
-
this.canvas = e, this.element = t, this.window = s, this.params =
|
|
2235
|
+
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
2236
|
}
|
|
2151
|
-
static configure(e, t, s,
|
|
2152
|
-
new H(e, t, s,
|
|
2237
|
+
static configure(e, t, s, o) {
|
|
2238
|
+
new H(e, t, s, o);
|
|
2153
2239
|
}
|
|
2154
2240
|
hookPortEvents(e) {
|
|
2155
2241
|
e.addEventListener("mousedown", this.onPortMouseDown, {
|
|
@@ -2174,7 +2260,7 @@ class H {
|
|
|
2174
2260
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2175
2261
|
}
|
|
2176
2262
|
}
|
|
2177
|
-
class
|
|
2263
|
+
class Rt {
|
|
2178
2264
|
constructor(e, t, s) {
|
|
2179
2265
|
this.canvas = e, this.layoutAlgorithm = t, this.params = s;
|
|
2180
2266
|
}
|
|
@@ -2188,7 +2274,7 @@ class xt {
|
|
|
2188
2274
|
}), this.params.onAfterApplied();
|
|
2189
2275
|
}
|
|
2190
2276
|
}
|
|
2191
|
-
class
|
|
2277
|
+
class Lt {
|
|
2192
2278
|
constructor(e, t, s) {
|
|
2193
2279
|
this.canvas = e, this.layoutAlgorithm = t, this.params = s;
|
|
2194
2280
|
}
|
|
@@ -2198,17 +2284,17 @@ class St {
|
|
|
2198
2284
|
viewport: this.canvas.viewport,
|
|
2199
2285
|
dt: e
|
|
2200
2286
|
});
|
|
2201
|
-
this.params.onBeforeApplied(), t.forEach((s,
|
|
2202
|
-
this.params.staticNodeResolver(
|
|
2287
|
+
this.params.onBeforeApplied(), t.forEach((s, o) => {
|
|
2288
|
+
this.params.staticNodeResolver(o) || this.canvas.updateNode(o, s);
|
|
2203
2289
|
}), this.params.onAfterApplied();
|
|
2204
2290
|
}
|
|
2205
2291
|
}
|
|
2206
|
-
class
|
|
2207
|
-
constructor(e, t, s,
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2292
|
+
class ee {
|
|
2293
|
+
constructor(e, t, s, o) {
|
|
2294
|
+
i(this, "grabbedNode", null);
|
|
2295
|
+
i(this, "maxNodePriority", 0);
|
|
2296
|
+
i(this, "graph");
|
|
2297
|
+
i(this, "onAfterNodeAdded", (e) => {
|
|
2212
2298
|
this.updateMaxNodePriority(e);
|
|
2213
2299
|
const { element: t } = this.graph.getNode(e);
|
|
2214
2300
|
t.addEventListener("mousedown", this.onMouseDown, {
|
|
@@ -2217,50 +2303,50 @@ class _ {
|
|
|
2217
2303
|
passive: !0
|
|
2218
2304
|
});
|
|
2219
2305
|
});
|
|
2220
|
-
|
|
2306
|
+
i(this, "onAfterNodeUpdated", (e) => {
|
|
2221
2307
|
this.updateMaxNodePriority(e);
|
|
2222
2308
|
});
|
|
2223
|
-
|
|
2309
|
+
i(this, "onBeforeNodeRemoved", (e) => {
|
|
2224
2310
|
const { element: t } = this.graph.getNode(e);
|
|
2225
2311
|
t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
|
|
2226
2312
|
});
|
|
2227
|
-
|
|
2313
|
+
i(this, "onBeforeDestroy", () => {
|
|
2228
2314
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2229
2315
|
});
|
|
2230
|
-
|
|
2316
|
+
i(this, "onBeforeClear", () => {
|
|
2231
2317
|
this.canvas.graph.getAllNodeIds().forEach((e) => {
|
|
2232
2318
|
const { element: t } = this.canvas.graph.getNode(e);
|
|
2233
2319
|
t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
|
|
2234
2320
|
}), this.maxNodePriority = 0;
|
|
2235
2321
|
});
|
|
2236
|
-
|
|
2322
|
+
i(this, "onMouseDown", (e) => {
|
|
2237
2323
|
const t = e;
|
|
2238
2324
|
if (!this.params.mouseDownEventVerifier(t))
|
|
2239
2325
|
return;
|
|
2240
|
-
const s = e.currentTarget,
|
|
2241
|
-
if (!this.params.nodeDragVerifier(
|
|
2326
|
+
const s = e.currentTarget, o = this.graph.findNodeIdByElement(s), n = this.graph.getNode(o);
|
|
2327
|
+
if (!this.params.nodeDragVerifier(o))
|
|
2242
2328
|
return;
|
|
2243
|
-
this.params.onNodeDragStarted(
|
|
2329
|
+
this.params.onNodeDragStarted(o), e.stopPropagation();
|
|
2244
2330
|
const h = this.calculateContentPoint({
|
|
2245
2331
|
x: t.clientX,
|
|
2246
2332
|
y: t.clientY
|
|
2247
2333
|
});
|
|
2248
2334
|
this.grabbedNode = {
|
|
2249
|
-
nodeId:
|
|
2335
|
+
nodeId: o,
|
|
2250
2336
|
dx: h.x - n.x,
|
|
2251
2337
|
dy: h.y - n.y
|
|
2252
|
-
},
|
|
2338
|
+
}, U(this.element, this.params.dragCursor), this.moveNodeOnTop(o), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2253
2339
|
passive: !0
|
|
2254
2340
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2255
2341
|
passive: !0
|
|
2256
2342
|
});
|
|
2257
2343
|
});
|
|
2258
|
-
|
|
2344
|
+
i(this, "onTouchStart", (e) => {
|
|
2259
2345
|
const t = e;
|
|
2260
2346
|
if (t.touches.length !== 1)
|
|
2261
2347
|
return;
|
|
2262
2348
|
e.stopPropagation();
|
|
2263
|
-
const s = t.touches[0],
|
|
2349
|
+
const s = t.touches[0], o = e.currentTarget, n = this.canvas.graph.findNodeIdByElement(o), a = this.graph.getNode(n);
|
|
2264
2350
|
if (!this.params.nodeDragVerifier({
|
|
2265
2351
|
nodeId: n,
|
|
2266
2352
|
element: a.element,
|
|
@@ -2284,7 +2370,7 @@ class _ {
|
|
|
2284
2370
|
passive: !0
|
|
2285
2371
|
});
|
|
2286
2372
|
});
|
|
2287
|
-
|
|
2373
|
+
i(this, "onWindowMouseMove", (e) => {
|
|
2288
2374
|
if (!R(
|
|
2289
2375
|
this.window,
|
|
2290
2376
|
this.element,
|
|
@@ -2299,10 +2385,10 @@ class _ {
|
|
|
2299
2385
|
y: e.clientY
|
|
2300
2386
|
});
|
|
2301
2387
|
});
|
|
2302
|
-
|
|
2388
|
+
i(this, "onWindowMouseUp", (e) => {
|
|
2303
2389
|
this.params.mouseUpEventVerifier(e) && this.cancelMouseDrag();
|
|
2304
2390
|
});
|
|
2305
|
-
|
|
2391
|
+
i(this, "onWindowTouchMove", (e) => {
|
|
2306
2392
|
if (e.touches.length !== 1)
|
|
2307
2393
|
return;
|
|
2308
2394
|
const t = e.touches[0];
|
|
@@ -2320,21 +2406,21 @@ class _ {
|
|
|
2320
2406
|
y: t.clientY
|
|
2321
2407
|
});
|
|
2322
2408
|
});
|
|
2323
|
-
|
|
2409
|
+
i(this, "onWindowTouchFinish", () => {
|
|
2324
2410
|
this.cancelTouchDrag();
|
|
2325
2411
|
});
|
|
2326
|
-
this.canvas = e, this.element = t, this.window = s, this.params =
|
|
2412
|
+
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
2413
|
}
|
|
2328
|
-
static configure(e, t, s,
|
|
2329
|
-
new
|
|
2414
|
+
static configure(e, t, s, o) {
|
|
2415
|
+
new ee(e, t, s, o);
|
|
2330
2416
|
}
|
|
2331
2417
|
moveNode(e, t) {
|
|
2332
2418
|
if (!this.graph.hasNode(e.nodeId))
|
|
2333
2419
|
return;
|
|
2334
|
-
const s = this.calculateContentPoint(t),
|
|
2420
|
+
const s = this.calculateContentPoint(t), o = {
|
|
2335
2421
|
x: s.x - e.dx,
|
|
2336
2422
|
y: s.y - e.dy
|
|
2337
|
-
}, n = this.adjustNodeCoords(
|
|
2423
|
+
}, n = this.adjustNodeCoords(o);
|
|
2338
2424
|
this.canvas.updateNode(e.nodeId, {
|
|
2339
2425
|
x: n.x,
|
|
2340
2426
|
y: n.y
|
|
@@ -2344,15 +2430,15 @@ class _ {
|
|
|
2344
2430
|
if (this.params.moveOnTop) {
|
|
2345
2431
|
if (this.maxNodePriority++, this.params.moveEdgesOnTop) {
|
|
2346
2432
|
const t = this.maxNodePriority;
|
|
2347
|
-
this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((
|
|
2348
|
-
this.canvas.updateEdge(
|
|
2433
|
+
this.maxNodePriority++, this.graph.getNodeAdjacentEdgeIds(e).forEach((o) => {
|
|
2434
|
+
this.canvas.updateEdge(o, { priority: t });
|
|
2349
2435
|
});
|
|
2350
2436
|
}
|
|
2351
2437
|
this.canvas.updateNode(e, { priority: this.maxNodePriority });
|
|
2352
2438
|
}
|
|
2353
2439
|
}
|
|
2354
2440
|
cancelMouseDrag() {
|
|
2355
|
-
this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null,
|
|
2441
|
+
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
2442
|
}
|
|
2357
2443
|
removeMouseDragListeners() {
|
|
2358
2444
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
@@ -2395,50 +2481,42 @@ class _ {
|
|
|
2395
2481
|
return e;
|
|
2396
2482
|
}
|
|
2397
2483
|
}
|
|
2398
|
-
const
|
|
2399
|
-
scale: r.scale,
|
|
2400
|
-
x: r.x + r.scale * e,
|
|
2401
|
-
y: r.y + r.scale * t
|
|
2402
|
-
}), Pt = (r, e, t, s) => ({
|
|
2403
|
-
scale: r.scale * e,
|
|
2404
|
-
x: r.scale * (1 - e) * t + r.x,
|
|
2405
|
-
y: r.scale * (1 - e) * s + r.y
|
|
2406
|
-
}), B = (r) => {
|
|
2484
|
+
const B = (r) => {
|
|
2407
2485
|
const e = [], t = r.touches.length;
|
|
2408
2486
|
for (let h = 0; h < t; h++)
|
|
2409
2487
|
e.push([r.touches[h].clientX, r.touches[h].clientY]);
|
|
2410
2488
|
const s = e.reduce(
|
|
2411
2489
|
(h, d) => [h[0] + d[0], h[1] + d[1]],
|
|
2412
2490
|
[0, 0]
|
|
2413
|
-
),
|
|
2491
|
+
), o = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - o[0], h[1] - o[1]]).reduce(
|
|
2414
2492
|
(h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
|
|
2415
2493
|
0
|
|
2416
2494
|
);
|
|
2417
2495
|
return {
|
|
2418
|
-
x:
|
|
2419
|
-
y:
|
|
2496
|
+
x: o[0],
|
|
2497
|
+
y: o[1],
|
|
2420
2498
|
scale: a / t,
|
|
2421
2499
|
touchesCnt: t,
|
|
2422
2500
|
touches: e
|
|
2423
2501
|
};
|
|
2424
2502
|
};
|
|
2425
|
-
class
|
|
2426
|
-
constructor(e, t, s,
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2503
|
+
class Y {
|
|
2504
|
+
constructor(e, t, s, o) {
|
|
2505
|
+
i(this, "viewport");
|
|
2506
|
+
i(this, "prevTouches", null);
|
|
2507
|
+
i(this, "wheelFinishTimer", null);
|
|
2508
|
+
i(this, "transformInProgress", !1);
|
|
2509
|
+
i(this, "onBeforeDestroy", () => {
|
|
2432
2510
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2433
2511
|
});
|
|
2434
|
-
|
|
2435
|
-
this.params.mouseDownEventVerifier(e) && (
|
|
2512
|
+
i(this, "onMouseDown", (e) => {
|
|
2513
|
+
this.params.mouseDownEventVerifier(e) && (U(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2436
2514
|
passive: !0
|
|
2437
2515
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2438
2516
|
passive: !0
|
|
2439
2517
|
}), this.startRegisteredTransform());
|
|
2440
2518
|
});
|
|
2441
|
-
|
|
2519
|
+
i(this, "onWindowMouseMove", (e) => {
|
|
2442
2520
|
const t = R(
|
|
2443
2521
|
this.window,
|
|
2444
2522
|
this.element,
|
|
@@ -2449,21 +2527,21 @@ class X {
|
|
|
2449
2527
|
this.stopMouseDrag();
|
|
2450
2528
|
return;
|
|
2451
2529
|
}
|
|
2452
|
-
const s = -e.movementX,
|
|
2453
|
-
this.moveViewport(s,
|
|
2530
|
+
const s = -e.movementX, o = -e.movementY;
|
|
2531
|
+
this.moveViewport(s, o);
|
|
2454
2532
|
});
|
|
2455
|
-
|
|
2533
|
+
i(this, "onWindowMouseUp", (e) => {
|
|
2456
2534
|
this.params.mouseUpEventVerifier(e) && this.stopMouseDrag();
|
|
2457
2535
|
});
|
|
2458
|
-
|
|
2536
|
+
i(this, "onWheelScroll", (e) => {
|
|
2459
2537
|
if (!this.params.mouseWheelEventVerifier(e))
|
|
2460
2538
|
return;
|
|
2461
|
-
const { left: t, top: s } = this.element.getBoundingClientRect(),
|
|
2462
|
-
this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h,
|
|
2539
|
+
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);
|
|
2540
|
+
this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, o, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
|
|
2463
2541
|
this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
|
|
2464
2542
|
}, this.params.scaleWheelFinishTimeout);
|
|
2465
2543
|
});
|
|
2466
|
-
|
|
2544
|
+
i(this, "onTouchStart", (e) => {
|
|
2467
2545
|
if (this.prevTouches !== null) {
|
|
2468
2546
|
this.prevTouches = B(e);
|
|
2469
2547
|
return;
|
|
@@ -2476,10 +2554,10 @@ class X {
|
|
|
2476
2554
|
passive: !0
|
|
2477
2555
|
}), this.startRegisteredTransform();
|
|
2478
2556
|
});
|
|
2479
|
-
|
|
2557
|
+
i(this, "onWindowTouchMove", (e) => {
|
|
2480
2558
|
const t = B(e);
|
|
2481
2559
|
if (!t.touches.every(
|
|
2482
|
-
(
|
|
2560
|
+
(o) => R(this.window, this.element, o[0], o[1])
|
|
2483
2561
|
)) {
|
|
2484
2562
|
this.stopTouchDrag();
|
|
2485
2563
|
return;
|
|
@@ -2488,18 +2566,18 @@ class X {
|
|
|
2488
2566
|
-(t.x - this.prevTouches.x),
|
|
2489
2567
|
-(t.y - this.prevTouches.y)
|
|
2490
2568
|
), t.touchesCnt === 2) {
|
|
2491
|
-
const { left:
|
|
2569
|
+
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
2570
|
this.scaleViewport(c, a, h);
|
|
2493
2571
|
}
|
|
2494
2572
|
this.prevTouches = t;
|
|
2495
2573
|
});
|
|
2496
|
-
|
|
2574
|
+
i(this, "onWindowTouchFinish", (e) => {
|
|
2497
2575
|
e.touches.length > 0 ? this.prevTouches = B(e) : this.stopTouchDrag();
|
|
2498
2576
|
});
|
|
2499
|
-
|
|
2577
|
+
i(this, "preventWheelScaleListener", (e) => {
|
|
2500
2578
|
e.preventDefault();
|
|
2501
2579
|
});
|
|
2502
|
-
this.canvas = e, this.element = t, this.window = s, this.params =
|
|
2580
|
+
this.canvas = e, this.element = t, this.window = s, this.params = o, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
|
|
2503
2581
|
passive: !1
|
|
2504
2582
|
}), this.viewport = e.viewport, this.handleResize(), this.viewport.onAfterResize.subscribe(() => {
|
|
2505
2583
|
this.handleResize();
|
|
@@ -2511,21 +2589,21 @@ class X {
|
|
|
2511
2589
|
passive: !0
|
|
2512
2590
|
}), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2513
2591
|
}
|
|
2514
|
-
static configure(e, t, s,
|
|
2515
|
-
new
|
|
2592
|
+
static configure(e, t, s, o) {
|
|
2593
|
+
new Y(e, t, s, o);
|
|
2516
2594
|
}
|
|
2517
2595
|
moveViewport(e, t) {
|
|
2518
|
-
const s = this.viewport.getViewportMatrix(),
|
|
2596
|
+
const s = this.viewport.getViewportMatrix(), o = Ue(s, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
|
|
2519
2597
|
prevTransform: s,
|
|
2520
|
-
nextTransform:
|
|
2598
|
+
nextTransform: o,
|
|
2521
2599
|
canvasWidth: n,
|
|
2522
2600
|
canvasHeight: a
|
|
2523
2601
|
});
|
|
2524
2602
|
this.performTransform(h);
|
|
2525
2603
|
}
|
|
2526
2604
|
scaleViewport(e, t, s) {
|
|
2527
|
-
const
|
|
2528
|
-
prevTransform:
|
|
2605
|
+
const o = this.canvas.viewport.getViewportMatrix(), n = Oe(o, e, t, s), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
|
|
2606
|
+
prevTransform: o,
|
|
2529
2607
|
nextTransform: n,
|
|
2530
2608
|
canvasWidth: a,
|
|
2531
2609
|
canvasHeight: h
|
|
@@ -2533,7 +2611,7 @@ class X {
|
|
|
2533
2611
|
this.performTransform(d);
|
|
2534
2612
|
}
|
|
2535
2613
|
stopMouseDrag() {
|
|
2536
|
-
|
|
2614
|
+
U(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
|
|
2537
2615
|
}
|
|
2538
2616
|
removeMouseDragListeners() {
|
|
2539
2617
|
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
@@ -2554,28 +2632,28 @@ class X {
|
|
|
2554
2632
|
this.transformInProgress = !1, this.params.onTransformFinished();
|
|
2555
2633
|
}
|
|
2556
2634
|
handleResize() {
|
|
2557
|
-
const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.viewport.getDimensions(),
|
|
2635
|
+
const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.viewport.getDimensions(), o = this.params.transformPreprocessor({
|
|
2558
2636
|
prevTransform: e,
|
|
2559
2637
|
nextTransform: e,
|
|
2560
2638
|
canvasWidth: t,
|
|
2561
2639
|
canvasHeight: s
|
|
2562
2640
|
});
|
|
2563
|
-
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(
|
|
2641
|
+
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(o), this.params.onResizeTransformFinished();
|
|
2564
2642
|
}
|
|
2565
2643
|
}
|
|
2566
|
-
class
|
|
2567
|
-
constructor(e, t, s,
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2644
|
+
class te {
|
|
2645
|
+
constructor(e, t, s, o, n, a) {
|
|
2646
|
+
i(this, "nodeHorizontal");
|
|
2647
|
+
i(this, "nodeVertical");
|
|
2648
|
+
i(this, "viewport");
|
|
2649
|
+
i(this, "currentScale");
|
|
2650
|
+
i(this, "loadedArea", {
|
|
2573
2651
|
xFrom: 1 / 0,
|
|
2574
2652
|
xTo: 1 / 0,
|
|
2575
2653
|
yFrom: 1 / 0,
|
|
2576
2654
|
yTo: 1 / 0
|
|
2577
2655
|
});
|
|
2578
|
-
|
|
2656
|
+
i(this, "updateLoadedArea", (e) => {
|
|
2579
2657
|
this.loadedArea = {
|
|
2580
2658
|
xFrom: e.x,
|
|
2581
2659
|
xTo: e.x + e.width,
|
|
@@ -2583,46 +2661,46 @@ class ee {
|
|
|
2583
2661
|
yTo: e.y + e.height
|
|
2584
2662
|
};
|
|
2585
2663
|
});
|
|
2586
|
-
|
|
2664
|
+
i(this, "onAfterViewportUpdated", () => {
|
|
2587
2665
|
this.userTransformInProgress || this.loadAreaAroundViewport();
|
|
2588
2666
|
});
|
|
2589
|
-
|
|
2667
|
+
i(this, "userTransformInProgress", !1);
|
|
2590
2668
|
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
2669
|
this.scheduleLoadAreaAroundViewport();
|
|
2592
2670
|
});
|
|
2593
2671
|
const h = {
|
|
2594
|
-
...
|
|
2672
|
+
...o,
|
|
2595
2673
|
onResizeTransformStarted: () => {
|
|
2596
|
-
this.userTransformInProgress = !0,
|
|
2674
|
+
this.userTransformInProgress = !0, o.onResizeTransformStarted();
|
|
2597
2675
|
},
|
|
2598
2676
|
onResizeTransformFinished: () => {
|
|
2599
|
-
this.userTransformInProgress = !1,
|
|
2677
|
+
this.userTransformInProgress = !1, o.onResizeTransformFinished();
|
|
2600
2678
|
},
|
|
2601
2679
|
onBeforeTransformChange: () => {
|
|
2602
|
-
this.userTransformInProgress = !0,
|
|
2680
|
+
this.userTransformInProgress = !0, o.onBeforeTransformChange();
|
|
2603
2681
|
},
|
|
2604
2682
|
onTransformChange: () => {
|
|
2605
2683
|
this.userTransformInProgress = !1;
|
|
2606
2684
|
const d = this.currentScale;
|
|
2607
|
-
this.currentScale = this.viewport.getViewportMatrix().scale, d !== this.currentScale && this.scheduleEnsureViewportAreaLoaded(),
|
|
2685
|
+
this.currentScale = this.viewport.getViewportMatrix().scale, d !== this.currentScale && this.scheduleEnsureViewportAreaLoaded(), o.onTransformChange();
|
|
2608
2686
|
},
|
|
2609
2687
|
onTransformFinished: () => {
|
|
2610
|
-
this.scheduleLoadAreaAroundViewport(),
|
|
2688
|
+
this.scheduleLoadAreaAroundViewport(), o.onTransformFinished();
|
|
2611
2689
|
}
|
|
2612
2690
|
};
|
|
2613
|
-
|
|
2691
|
+
Y.configure(
|
|
2614
2692
|
e,
|
|
2615
2693
|
this.element,
|
|
2616
2694
|
this.window,
|
|
2617
2695
|
h
|
|
2618
2696
|
), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
|
|
2619
2697
|
}
|
|
2620
|
-
static configure(e, t, s,
|
|
2621
|
-
new
|
|
2698
|
+
static configure(e, t, s, o, n, a) {
|
|
2699
|
+
new te(
|
|
2622
2700
|
e,
|
|
2623
2701
|
t,
|
|
2624
2702
|
s,
|
|
2625
|
-
|
|
2703
|
+
o,
|
|
2626
2704
|
n,
|
|
2627
2705
|
a
|
|
2628
2706
|
);
|
|
@@ -2634,12 +2712,12 @@ class ee {
|
|
|
2634
2712
|
}
|
|
2635
2713
|
scheduleEnsureViewportAreaLoaded() {
|
|
2636
2714
|
setTimeout(() => {
|
|
2637
|
-
const { width: e, height: t } = this.viewport.getDimensions(), { scale: s, x:
|
|
2715
|
+
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
2716
|
this.loadedArea.xFrom < d && this.loadedArea.xTo > g && this.loadedArea.yFrom < c && this.loadedArea.yTo > l || this.loadAreaAroundViewport();
|
|
2639
2717
|
});
|
|
2640
2718
|
}
|
|
2641
2719
|
loadAreaAroundViewport() {
|
|
2642
|
-
const { width: e, height: t } = this.viewport.getDimensions(), { scale: s, x:
|
|
2720
|
+
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
2721
|
this.trigger.emit({
|
|
2644
2722
|
x: d,
|
|
2645
2723
|
y: c,
|
|
@@ -2648,66 +2726,66 @@ class ee {
|
|
|
2648
2726
|
});
|
|
2649
2727
|
}
|
|
2650
2728
|
}
|
|
2651
|
-
const
|
|
2729
|
+
const Vt = () => {
|
|
2652
2730
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2653
2731
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2654
|
-
},
|
|
2732
|
+
}, Ft = () => {
|
|
2655
2733
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2656
2734
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
2657
|
-
},
|
|
2735
|
+
}, It = () => {
|
|
2658
2736
|
const r = document.createElementNS(
|
|
2659
2737
|
"http://www.w3.org/2000/svg",
|
|
2660
2738
|
"pattern"
|
|
2661
2739
|
);
|
|
2662
2740
|
return r.setAttribute("id", "pattern"), r;
|
|
2663
2741
|
};
|
|
2664
|
-
class
|
|
2742
|
+
class re {
|
|
2665
2743
|
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",
|
|
2744
|
+
i(this, "svg", Vt());
|
|
2745
|
+
i(this, "patternRenderingRectangle", Ft());
|
|
2746
|
+
i(this, "pattern", It());
|
|
2747
|
+
i(this, "patternContent");
|
|
2748
|
+
i(this, "tileWidth");
|
|
2749
|
+
i(this, "tileHeight");
|
|
2750
|
+
i(this, "halfTileWidth");
|
|
2751
|
+
i(this, "halfTileHeight");
|
|
2752
|
+
i(this, "maxViewportScale");
|
|
2753
|
+
i(this, "visible", !1);
|
|
2754
|
+
i(this, "onAfterTransformUpdated", () => {
|
|
2755
|
+
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})`;
|
|
2756
|
+
this.pattern.setAttribute("patternTransform", o), this.updateVisibility();
|
|
2679
2757
|
});
|
|
2680
2758
|
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",
|
|
2759
|
+
const o = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
|
|
2760
|
+
this.patternContent.setAttribute("transform", o), this.pattern.appendChild(this.patternContent);
|
|
2683
2761
|
const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
|
2684
2762
|
n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.updateDimensions(), this.canvas.viewport.onAfterResize.subscribe(() => {
|
|
2685
2763
|
this.updateDimensions();
|
|
2686
2764
|
}), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
|
|
2687
2765
|
}
|
|
2688
2766
|
static configure(e, t, s) {
|
|
2689
|
-
new
|
|
2767
|
+
new re(e, t, s);
|
|
2690
2768
|
}
|
|
2691
2769
|
updateVisibility() {
|
|
2692
|
-
const
|
|
2770
|
+
const { scale: e } = this.canvas.viewport.getViewportMatrix(), t = e > this.maxViewportScale;
|
|
2693
2771
|
t && this.visible ? (this.visible = !1, this.backgroundHost.removeChild(this.svg)) : !t && !this.visible && (this.visible = !0, this.backgroundHost.appendChild(this.svg));
|
|
2694
2772
|
}
|
|
2695
2773
|
updateDimensions() {
|
|
2696
2774
|
const { width: e, height: t } = this.canvas.viewport.getDimensions();
|
|
2697
2775
|
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", `${
|
|
2776
|
+
const s = this.tileWidth / e, o = this.tileHeight / t;
|
|
2777
|
+
this.pattern.setAttribute("width", `${s}`), this.pattern.setAttribute("height", `${o}`);
|
|
2700
2778
|
}
|
|
2701
2779
|
}
|
|
2702
|
-
class
|
|
2703
|
-
constructor(e, t, s,
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2780
|
+
class se {
|
|
2781
|
+
constructor(e, t, s, o, n) {
|
|
2782
|
+
i(this, "overlayCanvas");
|
|
2783
|
+
i(this, "staticPortId", null);
|
|
2784
|
+
i(this, "isTargetDragging", !0);
|
|
2785
|
+
i(this, "onEdgeCreated", (e) => {
|
|
2708
2786
|
this.params.onAfterEdgeCreated(e);
|
|
2709
2787
|
});
|
|
2710
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window =
|
|
2788
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = ze(
|
|
2711
2789
|
this.overlayLayer,
|
|
2712
2790
|
this.viewportStore
|
|
2713
2791
|
), H.configure(
|
|
@@ -2733,19 +2811,19 @@ class re {
|
|
|
2733
2811
|
}
|
|
2734
2812
|
);
|
|
2735
2813
|
}
|
|
2736
|
-
static configure(e, t, s,
|
|
2737
|
-
new
|
|
2814
|
+
static configure(e, t, s, o, n) {
|
|
2815
|
+
new se(
|
|
2738
2816
|
e,
|
|
2739
2817
|
t,
|
|
2740
2818
|
s,
|
|
2741
|
-
|
|
2819
|
+
o,
|
|
2742
2820
|
n
|
|
2743
2821
|
);
|
|
2744
2822
|
}
|
|
2745
2823
|
grabPort(e, t, s) {
|
|
2746
|
-
const
|
|
2824
|
+
const o = this.canvas.graph.getPort(e);
|
|
2747
2825
|
this.staticPortId = e;
|
|
2748
|
-
const n =
|
|
2826
|
+
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
2827
|
x: a - d.x,
|
|
2750
2828
|
y: h - d.y
|
|
2751
2829
|
}), g = this.canvas.viewport.createContentCoords({
|
|
@@ -2754,7 +2832,7 @@ class re {
|
|
|
2754
2832
|
}), l = {
|
|
2755
2833
|
overlayNodeId: N.StaticNodeId,
|
|
2756
2834
|
portCoords: c,
|
|
2757
|
-
portDirection:
|
|
2835
|
+
portDirection: o.direction
|
|
2758
2836
|
}, u = {
|
|
2759
2837
|
overlayNodeId: N.DraggingNodeId,
|
|
2760
2838
|
portCoords: g,
|
|
@@ -2762,7 +2840,7 @@ class re {
|
|
|
2762
2840
|
};
|
|
2763
2841
|
this.isTargetDragging = s === "direct";
|
|
2764
2842
|
const [p, f] = this.isTargetDragging ? [l, u] : [u, l];
|
|
2765
|
-
this.overlayCanvas.addNode(
|
|
2843
|
+
this.overlayCanvas.addNode(O(p)), this.overlayCanvas.addNode(O(f)), this.overlayCanvas.addEdge({
|
|
2766
2844
|
from: p.overlayNodeId,
|
|
2767
2845
|
to: f.overlayNodeId,
|
|
2768
2846
|
shape: this.params.edgeShapeFactory(N.EdgeId)
|
|
@@ -2772,7 +2850,7 @@ class re {
|
|
|
2772
2850
|
this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
2773
2851
|
}
|
|
2774
2852
|
tryCreateConnection(e) {
|
|
2775
|
-
const t =
|
|
2853
|
+
const t = Ce(this.canvas.graph, e), s = this.staticPortId;
|
|
2776
2854
|
if (t === null) {
|
|
2777
2855
|
this.params.onEdgeCreationInterrupted({
|
|
2778
2856
|
staticPortId: s,
|
|
@@ -2780,7 +2858,7 @@ class re {
|
|
|
2780
2858
|
});
|
|
2781
2859
|
return;
|
|
2782
2860
|
}
|
|
2783
|
-
const
|
|
2861
|
+
const o = this.isTargetDragging ? s : t, n = this.isTargetDragging ? t : s, a = { from: o, to: n }, h = this.params.connectionPreprocessor(a);
|
|
2784
2862
|
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
2863
|
}
|
|
2786
2864
|
moveDraggingPort(e) {
|
|
@@ -2794,16 +2872,16 @@ class re {
|
|
|
2794
2872
|
});
|
|
2795
2873
|
}
|
|
2796
2874
|
}
|
|
2797
|
-
class
|
|
2798
|
-
constructor(e, t, s,
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2875
|
+
class oe {
|
|
2876
|
+
constructor(e, t, s, o, n) {
|
|
2877
|
+
i(this, "overlayCanvas");
|
|
2878
|
+
i(this, "staticPortId", null);
|
|
2879
|
+
i(this, "isTargetDragging", !0);
|
|
2880
|
+
i(this, "draggingEdgePayload", null);
|
|
2881
|
+
i(this, "onEdgeReattached", (e) => {
|
|
2804
2882
|
this.params.onAfterEdgeReattached(e);
|
|
2805
2883
|
});
|
|
2806
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window =
|
|
2884
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = ze(
|
|
2807
2885
|
this.overlayLayer,
|
|
2808
2886
|
this.viewportStore
|
|
2809
2887
|
), H.configure(
|
|
@@ -2826,12 +2904,12 @@ class se {
|
|
|
2826
2904
|
}
|
|
2827
2905
|
);
|
|
2828
2906
|
}
|
|
2829
|
-
static configure(e, t, s,
|
|
2830
|
-
new
|
|
2907
|
+
static configure(e, t, s, o, n) {
|
|
2908
|
+
new oe(
|
|
2831
2909
|
e,
|
|
2832
2910
|
t,
|
|
2833
2911
|
s,
|
|
2834
|
-
|
|
2912
|
+
o,
|
|
2835
2913
|
n
|
|
2836
2914
|
);
|
|
2837
2915
|
}
|
|
@@ -2839,7 +2917,7 @@ class se {
|
|
|
2839
2917
|
const s = this.params.draggingEdgeResolver(e);
|
|
2840
2918
|
if (s === null || !this.canvas.graph.hasEdge(s))
|
|
2841
2919
|
return !1;
|
|
2842
|
-
const
|
|
2920
|
+
const o = this.canvas.graph.getEdge(s), n = e === o.from, a = e === o.to, h = n ? o.to : o.from;
|
|
2843
2921
|
this.staticPortId = h, this.isTargetDragging = a;
|
|
2844
2922
|
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), l = {
|
|
2845
2923
|
x: g.x + g.width / 2,
|
|
@@ -2853,27 +2931,27 @@ class se {
|
|
|
2853
2931
|
});
|
|
2854
2932
|
this.draggingEdgePayload = {
|
|
2855
2933
|
id: s,
|
|
2856
|
-
from:
|
|
2857
|
-
to:
|
|
2858
|
-
shape:
|
|
2859
|
-
priority:
|
|
2934
|
+
from: o.from,
|
|
2935
|
+
to: o.to,
|
|
2936
|
+
shape: o.shape,
|
|
2937
|
+
priority: o.priority
|
|
2860
2938
|
}, this.canvas.removeEdge(s);
|
|
2861
|
-
const
|
|
2939
|
+
const v = {
|
|
2862
2940
|
overlayNodeId: N.StaticNodeId,
|
|
2863
2941
|
portCoords: p,
|
|
2864
2942
|
portDirection: c.direction
|
|
2865
|
-
},
|
|
2943
|
+
}, x = {
|
|
2866
2944
|
overlayNodeId: N.DraggingNodeId,
|
|
2867
2945
|
portCoords: f,
|
|
2868
2946
|
portDirection: d.direction
|
|
2869
|
-
}, [b,
|
|
2870
|
-
this.overlayCanvas.addNode(
|
|
2871
|
-
const
|
|
2947
|
+
}, [b, P] = this.isTargetDragging ? [v, x] : [x, v];
|
|
2948
|
+
this.overlayCanvas.addNode(O(b)), this.overlayCanvas.addNode(O(P));
|
|
2949
|
+
const C = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(N.EdgeId) : o.shape;
|
|
2872
2950
|
return this.overlayCanvas.addEdge({
|
|
2873
2951
|
id: N.EdgeId,
|
|
2874
2952
|
from: b.overlayNodeId,
|
|
2875
|
-
to:
|
|
2876
|
-
shape:
|
|
2953
|
+
to: P.overlayNodeId,
|
|
2954
|
+
shape: C
|
|
2877
2955
|
}), !0;
|
|
2878
2956
|
}
|
|
2879
2957
|
resetDragState() {
|
|
@@ -2883,14 +2961,14 @@ class se {
|
|
|
2883
2961
|
const t = this.overlayLayer.getBoundingClientRect(), s = {
|
|
2884
2962
|
x: e.x - t.x,
|
|
2885
2963
|
y: e.y - t.y
|
|
2886
|
-
},
|
|
2964
|
+
}, o = this.canvas.viewport.createContentCoords(s);
|
|
2887
2965
|
this.overlayCanvas.updateNode(N.DraggingNodeId, {
|
|
2888
|
-
x:
|
|
2889
|
-
y:
|
|
2966
|
+
x: o.x,
|
|
2967
|
+
y: o.y
|
|
2890
2968
|
});
|
|
2891
2969
|
}
|
|
2892
2970
|
tryCreateConnection(e) {
|
|
2893
|
-
const t =
|
|
2971
|
+
const t = Ce(this.canvas.graph, e);
|
|
2894
2972
|
if (this.overlayCanvas.removeEdge(N.EdgeId), t === null) {
|
|
2895
2973
|
const d = this.draggingEdgePayload;
|
|
2896
2974
|
this.params.onEdgeReattachInterrupted({
|
|
@@ -2902,10 +2980,10 @@ class se {
|
|
|
2902
2980
|
});
|
|
2903
2981
|
return;
|
|
2904
2982
|
}
|
|
2905
|
-
const [s,
|
|
2983
|
+
const [s, o] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
|
|
2906
2984
|
id: n.id,
|
|
2907
2985
|
from: s,
|
|
2908
|
-
to:
|
|
2986
|
+
to: o,
|
|
2909
2987
|
shape: n.shape,
|
|
2910
2988
|
priority: n.priority
|
|
2911
2989
|
}, h = this.params.connectionPreprocessor(a);
|
|
@@ -2923,20 +3001,20 @@ class se {
|
|
|
2923
3001
|
}
|
|
2924
3002
|
}
|
|
2925
3003
|
}
|
|
2926
|
-
class
|
|
3004
|
+
class ie {
|
|
2927
3005
|
constructor(e, t) {
|
|
2928
3006
|
this.applier = e, this.trigger = t, this.trigger.subscribe(() => {
|
|
2929
3007
|
this.applier.apply();
|
|
2930
3008
|
});
|
|
2931
3009
|
}
|
|
2932
3010
|
static configure(e, t) {
|
|
2933
|
-
new
|
|
3011
|
+
new ie(e, t);
|
|
2934
3012
|
}
|
|
2935
3013
|
}
|
|
2936
|
-
class
|
|
3014
|
+
class ne {
|
|
2937
3015
|
constructor(e, t, s) {
|
|
2938
|
-
|
|
2939
|
-
|
|
3016
|
+
i(this, "applyScheduled", !1);
|
|
3017
|
+
i(this, "apply", () => {
|
|
2940
3018
|
this.applyScheduled = !1, this.applier.apply();
|
|
2941
3019
|
});
|
|
2942
3020
|
this.graph = e, this.applier = t, this.defererFn = s, this.graph.onAfterNodeAdded.subscribe(() => {
|
|
@@ -2950,7 +3028,7 @@ class W {
|
|
|
2950
3028
|
});
|
|
2951
3029
|
}
|
|
2952
3030
|
static configure(e, t, s) {
|
|
2953
|
-
new
|
|
3031
|
+
new ne(
|
|
2954
3032
|
e,
|
|
2955
3033
|
t,
|
|
2956
3034
|
s
|
|
@@ -2960,52 +3038,36 @@ class W {
|
|
|
2960
3038
|
this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
|
|
2961
3039
|
}
|
|
2962
3040
|
}
|
|
2963
|
-
class
|
|
3041
|
+
class Bt {
|
|
2964
3042
|
static configure(e, t) {
|
|
2965
|
-
const s = t.applyOn,
|
|
3043
|
+
const s = t.applyOn, o = new Rt(e, t.algorithm, {
|
|
2966
3044
|
staticNodeResolver: t.staticNodeResolver,
|
|
2967
3045
|
onBeforeApplied: t.onBeforeApplied,
|
|
2968
3046
|
onAfterApplied: t.onAfterApplied
|
|
2969
3047
|
});
|
|
2970
3048
|
switch (s.type) {
|
|
2971
|
-
case "
|
|
2972
|
-
|
|
2973
|
-
|
|
3049
|
+
case "trigger": {
|
|
3050
|
+
ie.configure(
|
|
3051
|
+
o,
|
|
2974
3052
|
s.trigger
|
|
2975
3053
|
);
|
|
2976
3054
|
break;
|
|
2977
3055
|
}
|
|
2978
|
-
case "
|
|
2979
|
-
|
|
2980
|
-
e.graph,
|
|
2981
|
-
i,
|
|
2982
|
-
(n) => {
|
|
2983
|
-
setTimeout(() => {
|
|
2984
|
-
n();
|
|
2985
|
-
});
|
|
2986
|
-
}
|
|
2987
|
-
);
|
|
2988
|
-
break;
|
|
2989
|
-
}
|
|
2990
|
-
case "topologyChangeMicrotask": {
|
|
2991
|
-
W.configure(
|
|
3056
|
+
case "topologyChangeSchedule": {
|
|
3057
|
+
ne.configure(
|
|
2992
3058
|
e.graph,
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
queueMicrotask(() => {
|
|
2996
|
-
n();
|
|
2997
|
-
});
|
|
2998
|
-
}
|
|
3059
|
+
o,
|
|
3060
|
+
s.schedule
|
|
2999
3061
|
);
|
|
3000
3062
|
break;
|
|
3001
3063
|
}
|
|
3002
3064
|
}
|
|
3003
3065
|
}
|
|
3004
3066
|
}
|
|
3005
|
-
class
|
|
3067
|
+
class $t {
|
|
3006
3068
|
constructor(e, t) {
|
|
3007
|
-
|
|
3008
|
-
|
|
3069
|
+
i(this, "previousTimeStamp");
|
|
3070
|
+
i(this, "step", (e) => {
|
|
3009
3071
|
if (this.previousTimeStamp === void 0)
|
|
3010
3072
|
this.previousTimeStamp = e;
|
|
3011
3073
|
else {
|
|
@@ -3017,150 +3079,51 @@ class Mt {
|
|
|
3017
3079
|
this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
|
|
3018
3080
|
}
|
|
3019
3081
|
}
|
|
3020
|
-
class
|
|
3082
|
+
class ae {
|
|
3021
3083
|
constructor(e, t, s) {
|
|
3022
|
-
|
|
3023
|
-
|
|
3084
|
+
i(this, "applier");
|
|
3085
|
+
i(this, "step", (e) => {
|
|
3024
3086
|
this.applier.apply(e);
|
|
3025
3087
|
});
|
|
3026
|
-
this.win = s, this.applier = new
|
|
3088
|
+
this.win = s, this.applier = new Lt(e, t.algorithm, {
|
|
3027
3089
|
staticNodeResolver: t.staticNodeResolver,
|
|
3028
3090
|
onBeforeApplied: t.onBeforeApplied,
|
|
3029
3091
|
onAfterApplied: t.onAfterApplied
|
|
3030
|
-
}), new
|
|
3092
|
+
}), new $t(this.win, this.step);
|
|
3031
3093
|
}
|
|
3032
3094
|
static configure(e, t, s) {
|
|
3033
|
-
new
|
|
3095
|
+
new ae(e, t, s);
|
|
3034
3096
|
}
|
|
3035
3097
|
}
|
|
3036
|
-
const
|
|
3098
|
+
const Ut = () => {
|
|
3037
3099
|
const r = document.createElement("div");
|
|
3038
3100
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
3039
3101
|
}, j = () => {
|
|
3040
3102
|
const r = document.createElement("div");
|
|
3041
3103
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
3042
|
-
},
|
|
3104
|
+
}, me = () => {
|
|
3043
3105
|
const r = j();
|
|
3044
3106
|
return r.style.pointerEvents = "none", r;
|
|
3045
3107
|
};
|
|
3046
|
-
class
|
|
3108
|
+
class Ot {
|
|
3047
3109
|
constructor(e) {
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3110
|
+
i(this, "background", j());
|
|
3111
|
+
i(this, "main", j());
|
|
3112
|
+
i(this, "overlayConnectablePorts", me());
|
|
3113
|
+
i(this, "overlayDraggableEdges", me());
|
|
3114
|
+
i(this, "host", Ut());
|
|
3053
3115
|
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
3116
|
}
|
|
3055
3117
|
destroy() {
|
|
3056
3118
|
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
3119
|
}
|
|
3058
3120
|
}
|
|
3059
|
-
const
|
|
3060
|
-
|
|
3061
|
-
return () => r++;
|
|
3062
|
-
}, Ft = (r, e) => {
|
|
3063
|
-
let t = ye, s = ye;
|
|
3064
|
-
const i = Vt();
|
|
3065
|
-
return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = q(r)), typeof e == "number" && (s = q(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
|
|
3066
|
-
nodesPriorityFn: t,
|
|
3067
|
-
edgesPriorityFn: s
|
|
3068
|
-
};
|
|
3069
|
-
}, ne = (r) => {
|
|
3070
|
-
if (typeof r == "function")
|
|
3071
|
-
return r;
|
|
3072
|
-
switch (r.type) {
|
|
3073
|
-
case "straight":
|
|
3074
|
-
return () => new yt({
|
|
3075
|
-
color: r.color,
|
|
3076
|
-
width: r.width,
|
|
3077
|
-
arrowLength: r.arrowLength,
|
|
3078
|
-
arrowOffset: r.arrowOffset,
|
|
3079
|
-
arrowRenderer: r.arrowRenderer,
|
|
3080
|
-
hasSourceArrow: r.hasSourceArrow,
|
|
3081
|
-
hasTargetArrow: r.hasTargetArrow,
|
|
3082
|
-
cycleSquareSide: r.cycleSquareSide,
|
|
3083
|
-
roundness: r.roundness,
|
|
3084
|
-
detourDistance: r.detourDistance,
|
|
3085
|
-
detourDirection: r.detourDirection
|
|
3086
|
-
});
|
|
3087
|
-
case "horizontal":
|
|
3088
|
-
return () => new ft({
|
|
3089
|
-
color: r.color,
|
|
3090
|
-
width: r.width,
|
|
3091
|
-
arrowLength: r.arrowLength,
|
|
3092
|
-
arrowOffset: r.arrowOffset,
|
|
3093
|
-
arrowRenderer: r.arrowRenderer,
|
|
3094
|
-
hasSourceArrow: r.hasSourceArrow,
|
|
3095
|
-
hasTargetArrow: r.hasTargetArrow,
|
|
3096
|
-
cycleSquareSide: r.cycleSquareSide,
|
|
3097
|
-
roundness: r.roundness,
|
|
3098
|
-
detourDistance: r.detourDistance
|
|
3099
|
-
});
|
|
3100
|
-
case "vertical":
|
|
3101
|
-
return () => new mt({
|
|
3102
|
-
color: r.color,
|
|
3103
|
-
width: r.width,
|
|
3104
|
-
arrowLength: r.arrowLength,
|
|
3105
|
-
arrowOffset: r.arrowOffset,
|
|
3106
|
-
arrowRenderer: r.arrowRenderer,
|
|
3107
|
-
hasSourceArrow: r.hasSourceArrow,
|
|
3108
|
-
hasTargetArrow: r.hasTargetArrow,
|
|
3109
|
-
cycleSquareSide: r.cycleSquareSide,
|
|
3110
|
-
roundness: r.roundness,
|
|
3111
|
-
detourDistance: r.detourDistance
|
|
3112
|
-
});
|
|
3113
|
-
case "direct":
|
|
3114
|
-
return () => new Re({
|
|
3115
|
-
color: r.color,
|
|
3116
|
-
width: r.width,
|
|
3117
|
-
arrowLength: r.arrowLength,
|
|
3118
|
-
arrowRenderer: r.arrowRenderer,
|
|
3119
|
-
hasSourceArrow: r.hasSourceArrow,
|
|
3120
|
-
hasTargetArrow: r.hasTargetArrow,
|
|
3121
|
-
sourceOffset: r.sourceOffset,
|
|
3122
|
-
targetOffset: r.targetOffset
|
|
3123
|
-
});
|
|
3124
|
-
default:
|
|
3125
|
-
return () => new wt({
|
|
3126
|
-
color: r.color,
|
|
3127
|
-
width: r.width,
|
|
3128
|
-
arrowLength: r.arrowLength,
|
|
3129
|
-
arrowRenderer: r.arrowRenderer,
|
|
3130
|
-
hasSourceArrow: r.hasSourceArrow,
|
|
3131
|
-
hasTargetArrow: r.hasTargetArrow,
|
|
3132
|
-
cycleRadius: r.cycleRadius,
|
|
3133
|
-
smallCycleRadius: r.smallCycleRadius,
|
|
3134
|
-
curvature: r.curvature,
|
|
3135
|
-
detourDistance: r.detourDistance,
|
|
3136
|
-
detourDirection: r.detourDirection
|
|
3137
|
-
});
|
|
3138
|
-
}
|
|
3139
|
-
}, It = (r) => {
|
|
3140
|
-
var t, s, i, n, a;
|
|
3141
|
-
const e = Ft(
|
|
3142
|
-
(t = r.nodes) == null ? void 0 : t.priority,
|
|
3143
|
-
(s = r.edges) == null ? void 0 : s.priority
|
|
3144
|
-
);
|
|
3145
|
-
return {
|
|
3146
|
-
nodes: {
|
|
3147
|
-
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? Pe,
|
|
3148
|
-
priorityFn: e.nodesPriorityFn
|
|
3149
|
-
},
|
|
3150
|
-
ports: {
|
|
3151
|
-
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
3152
|
-
},
|
|
3153
|
-
edges: {
|
|
3154
|
-
shapeFactory: ne(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
|
|
3155
|
-
priorityFn: e.edgesPriorityFn
|
|
3156
|
-
}
|
|
3157
|
-
};
|
|
3158
|
-
}, Bt = (r) => {
|
|
3159
|
-
var p, f, E, S, b, C;
|
|
3121
|
+
const Wt = (r) => {
|
|
3122
|
+
var p, f, v, x, b, P;
|
|
3160
3123
|
const e = ((p = r.events) == null ? void 0 : p.onNodeDragStarted) ?? (() => {
|
|
3161
3124
|
}), 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 = (
|
|
3125
|
+
}), s = r.nodeDragVerifier ?? (() => !0), o = ((v = r.events) == null ? void 0 : v.onNodeDragFinished) ?? (() => {
|
|
3126
|
+
}), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (x = r.mouse) == null ? void 0 : x.dragCursor, d = h !== void 0 ? h : "grab", c = (b = r.mouse) == null ? void 0 : b.mouseDownEventVerifier, g = c !== void 0 ? c : (C) => C.button === 0, l = (P = r.mouse) == null ? void 0 : P.mouseUpEventVerifier, u = l !== void 0 ? l : (C) => C.button === 0;
|
|
3164
3127
|
return {
|
|
3165
3128
|
moveOnTop: n,
|
|
3166
3129
|
moveEdgesOnTop: a,
|
|
@@ -3171,25 +3134,25 @@ const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
|
3171
3134
|
onNodeDragStarted: e,
|
|
3172
3135
|
onNodeDrag: t,
|
|
3173
3136
|
nodeDragVerifier: s,
|
|
3174
|
-
onNodeDragFinished:
|
|
3137
|
+
onNodeDragFinished: o
|
|
3175
3138
|
};
|
|
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,
|
|
3139
|
+
}, zt = (r) => {
|
|
3140
|
+
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
3141
|
return (n) => {
|
|
3179
3142
|
let a = n.nextTransform.x, h = n.nextTransform.y;
|
|
3180
3143
|
a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
|
|
3181
3144
|
const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
|
|
3182
3145
|
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 =
|
|
3146
|
+
const g = n.canvasHeight * n.prevTransform.scale, l = o - g;
|
|
3184
3147
|
return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
|
|
3185
3148
|
};
|
|
3186
|
-
},
|
|
3187
|
-
const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0,
|
|
3149
|
+
}, kt = (r) => {
|
|
3150
|
+
const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, o = t !== null ? 1 / t : 1 / 0;
|
|
3188
3151
|
return (n) => {
|
|
3189
3152
|
const a = n.prevTransform, h = n.nextTransform;
|
|
3190
3153
|
let d = h.scale, c = h.x, g = h.y;
|
|
3191
|
-
if (h.scale >
|
|
3192
|
-
d = Math.max(a.scale,
|
|
3154
|
+
if (h.scale > o && h.scale > a.scale) {
|
|
3155
|
+
d = Math.max(a.scale, o), c = a.x, g = a.y;
|
|
3193
3156
|
const l = (d - a.scale) / (h.scale - a.scale);
|
|
3194
3157
|
c = a.x + (h.x - a.x) * l, g = a.y + (h.y - a.y) * l;
|
|
3195
3158
|
}
|
|
@@ -3204,7 +3167,7 @@ const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
|
3204
3167
|
y: g
|
|
3205
3168
|
};
|
|
3206
3169
|
};
|
|
3207
|
-
},
|
|
3170
|
+
}, Ht = (r) => (e) => r.reduce(
|
|
3208
3171
|
(t, s) => s({
|
|
3209
3172
|
prevTransform: e.prevTransform,
|
|
3210
3173
|
nextTransform: t,
|
|
@@ -3212,91 +3175,161 @@ const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
|
3212
3175
|
canvasHeight: e.canvasHeight
|
|
3213
3176
|
}),
|
|
3214
3177
|
e.nextTransform
|
|
3215
|
-
),
|
|
3178
|
+
), ve = (r) => {
|
|
3216
3179
|
if (typeof r == "function")
|
|
3217
3180
|
return r;
|
|
3218
3181
|
switch (r.type) {
|
|
3219
3182
|
case "scale-limit":
|
|
3220
|
-
return
|
|
3183
|
+
return kt({
|
|
3221
3184
|
minContentScale: r.minContentScale ?? 0,
|
|
3222
3185
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
3223
3186
|
});
|
|
3224
3187
|
case "shift-limit":
|
|
3225
|
-
return
|
|
3188
|
+
return zt({
|
|
3226
3189
|
minX: r.minX ?? -1 / 0,
|
|
3227
3190
|
maxX: r.maxX ?? 1 / 0,
|
|
3228
3191
|
minY: r.minY ?? -1 / 0,
|
|
3229
3192
|
maxY: r.maxY ?? 1 / 0
|
|
3230
3193
|
});
|
|
3231
3194
|
}
|
|
3232
|
-
},
|
|
3233
|
-
var f,
|
|
3195
|
+
}, Ae = (r) => {
|
|
3196
|
+
var f, v, x, b, P, C, L, V, de, ce, le, ge;
|
|
3234
3197
|
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) ?
|
|
3198
|
+
let o;
|
|
3199
|
+
s !== void 0 ? Array.isArray(s) ? o = Ht(
|
|
3237
3200
|
s.map(
|
|
3238
|
-
(T) =>
|
|
3201
|
+
(T) => ve(T)
|
|
3239
3202
|
)
|
|
3240
|
-
) :
|
|
3241
|
-
const n = ((
|
|
3203
|
+
) : o = ve(s) : o = (T) => T.nextTransform;
|
|
3204
|
+
const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onBeforeTransformChange) ?? (() => {
|
|
3242
3205
|
}), h = ((b = r == null ? void 0 : r.events) == null ? void 0 : b.onTransformChange) ?? (() => {
|
|
3243
|
-
}), d = (
|
|
3206
|
+
}), d = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseDownEventVerifier, c = d !== void 0 ? d : (T) => T.button === 0, g = (C = r == null ? void 0 : r.shift) == null ? void 0 : C.mouseUpEventVerifier, l = g !== void 0 ? g : (T) => T.button === 0, u = (L = r == null ? void 0 : r.scale) == null ? void 0 : L.mouseWheelEventVerifier, p = u !== void 0 ? u : () => !0;
|
|
3244
3207
|
return {
|
|
3245
3208
|
wheelSensitivity: t,
|
|
3246
3209
|
onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
|
|
3247
3210
|
}),
|
|
3248
|
-
onTransformFinished: ((
|
|
3211
|
+
onTransformFinished: ((de = r == null ? void 0 : r.events) == null ? void 0 : de.onTransformFinished) ?? (() => {
|
|
3249
3212
|
}),
|
|
3250
3213
|
onBeforeTransformChange: a,
|
|
3251
3214
|
onTransformChange: h,
|
|
3252
|
-
transformPreprocessor:
|
|
3215
|
+
transformPreprocessor: o,
|
|
3253
3216
|
shiftCursor: n,
|
|
3254
3217
|
mouseDownEventVerifier: c,
|
|
3255
3218
|
mouseUpEventVerifier: l,
|
|
3256
3219
|
mouseWheelEventVerifier: p,
|
|
3257
|
-
scaleWheelFinishTimeout: ((
|
|
3258
|
-
onResizeTransformStarted: ((
|
|
3220
|
+
scaleWheelFinishTimeout: ((ce = r == null ? void 0 : r.scale) == null ? void 0 : ce.wheelFinishTimeout) ?? 500,
|
|
3221
|
+
onResizeTransformStarted: ((le = r == null ? void 0 : r.events) == null ? void 0 : le.onResizeTransformStarted) ?? (() => {
|
|
3259
3222
|
}),
|
|
3260
|
-
onResizeTransformFinished: ((
|
|
3223
|
+
onResizeTransformFinished: ((ge = r == null ? void 0 : r.events) == null ? void 0 : ge.onResizeTransformFinished) ?? (() => {
|
|
3261
3224
|
})
|
|
3262
3225
|
};
|
|
3263
|
-
},
|
|
3226
|
+
}, Yt = (r, e) => {
|
|
3264
3227
|
const t = document.createElementNS(
|
|
3265
3228
|
"http://www.w3.org/2000/svg",
|
|
3266
3229
|
"circle"
|
|
3267
3230
|
);
|
|
3268
3231
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
3269
|
-
},
|
|
3232
|
+
}, Xt = (r) => r instanceof SVGElement ? r : Yt(
|
|
3270
3233
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
3271
3234
|
(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,
|
|
3235
|
+
), Gt = (r) => {
|
|
3236
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, o = Xt(r.renderer ?? {});
|
|
3274
3237
|
return {
|
|
3275
3238
|
tileWidth: t,
|
|
3276
3239
|
tileHeight: s,
|
|
3277
|
-
renderer:
|
|
3240
|
+
renderer: o,
|
|
3278
3241
|
maxViewportScale: r.maxViewportScale ?? 10
|
|
3279
3242
|
};
|
|
3280
|
-
},
|
|
3243
|
+
}, he = (r) => {
|
|
3244
|
+
if (typeof r == "function")
|
|
3245
|
+
return r;
|
|
3246
|
+
switch (r.type) {
|
|
3247
|
+
case "straight":
|
|
3248
|
+
return () => new St({
|
|
3249
|
+
color: r.color,
|
|
3250
|
+
width: r.width,
|
|
3251
|
+
arrowLength: r.arrowLength,
|
|
3252
|
+
arrowOffset: r.arrowOffset,
|
|
3253
|
+
arrowRenderer: r.arrowRenderer,
|
|
3254
|
+
hasSourceArrow: r.hasSourceArrow,
|
|
3255
|
+
hasTargetArrow: r.hasTargetArrow,
|
|
3256
|
+
cycleSquareSide: r.cycleSquareSide,
|
|
3257
|
+
roundness: r.roundness,
|
|
3258
|
+
detourDistance: r.detourDistance,
|
|
3259
|
+
detourDirection: r.detourDirection
|
|
3260
|
+
});
|
|
3261
|
+
case "horizontal":
|
|
3262
|
+
return () => new Et({
|
|
3263
|
+
color: r.color,
|
|
3264
|
+
width: r.width,
|
|
3265
|
+
arrowLength: r.arrowLength,
|
|
3266
|
+
arrowOffset: r.arrowOffset,
|
|
3267
|
+
arrowRenderer: r.arrowRenderer,
|
|
3268
|
+
hasSourceArrow: r.hasSourceArrow,
|
|
3269
|
+
hasTargetArrow: r.hasTargetArrow,
|
|
3270
|
+
cycleSquareSide: r.cycleSquareSide,
|
|
3271
|
+
roundness: r.roundness,
|
|
3272
|
+
detourDistance: r.detourDistance
|
|
3273
|
+
});
|
|
3274
|
+
case "vertical":
|
|
3275
|
+
return () => new bt({
|
|
3276
|
+
color: r.color,
|
|
3277
|
+
width: r.width,
|
|
3278
|
+
arrowLength: r.arrowLength,
|
|
3279
|
+
arrowOffset: r.arrowOffset,
|
|
3280
|
+
arrowRenderer: r.arrowRenderer,
|
|
3281
|
+
hasSourceArrow: r.hasSourceArrow,
|
|
3282
|
+
hasTargetArrow: r.hasTargetArrow,
|
|
3283
|
+
cycleSquareSide: r.cycleSquareSide,
|
|
3284
|
+
roundness: r.roundness,
|
|
3285
|
+
detourDistance: r.detourDistance
|
|
3286
|
+
});
|
|
3287
|
+
case "direct":
|
|
3288
|
+
return () => new Ve({
|
|
3289
|
+
color: r.color,
|
|
3290
|
+
width: r.width,
|
|
3291
|
+
arrowLength: r.arrowLength,
|
|
3292
|
+
arrowRenderer: r.arrowRenderer,
|
|
3293
|
+
hasSourceArrow: r.hasSourceArrow,
|
|
3294
|
+
hasTargetArrow: r.hasTargetArrow,
|
|
3295
|
+
sourceOffset: r.sourceOffset,
|
|
3296
|
+
targetOffset: r.targetOffset
|
|
3297
|
+
});
|
|
3298
|
+
default:
|
|
3299
|
+
return () => new xt({
|
|
3300
|
+
color: r.color,
|
|
3301
|
+
width: r.width,
|
|
3302
|
+
arrowLength: r.arrowLength,
|
|
3303
|
+
arrowRenderer: r.arrowRenderer,
|
|
3304
|
+
hasSourceArrow: r.hasSourceArrow,
|
|
3305
|
+
hasTargetArrow: r.hasTargetArrow,
|
|
3306
|
+
cycleRadius: r.cycleRadius,
|
|
3307
|
+
smallCycleRadius: r.smallCycleRadius,
|
|
3308
|
+
curvature: r.curvature,
|
|
3309
|
+
detourDistance: r.detourDistance,
|
|
3310
|
+
detourDirection: r.detourDirection
|
|
3311
|
+
});
|
|
3312
|
+
}
|
|
3313
|
+
}, jt = (r, e, t) => {
|
|
3281
3314
|
var c, g, l;
|
|
3282
|
-
const s = () => "direct",
|
|
3315
|
+
const s = () => "direct", o = (u) => u, n = (u) => u.button === 0, a = () => {
|
|
3283
3316
|
}, h = () => {
|
|
3284
3317
|
}, d = () => {
|
|
3285
3318
|
};
|
|
3286
3319
|
return {
|
|
3287
3320
|
connectionTypeResolver: r.connectionTypeResolver ?? s,
|
|
3288
|
-
connectionPreprocessor: r.connectionPreprocessor ??
|
|
3321
|
+
connectionPreprocessor: r.connectionPreprocessor ?? o,
|
|
3289
3322
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
|
|
3290
3323
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
|
|
3291
3324
|
onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
|
|
3292
3325
|
onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
|
|
3293
3326
|
onEdgeCreationPrevented: ((l = r.events) == null ? void 0 : l.onEdgeCreationPrevented) ?? h,
|
|
3294
3327
|
dragPortDirection: r.dragPortDirection ?? t,
|
|
3295
|
-
edgeShapeFactory: r.edgeShape !== void 0 ?
|
|
3328
|
+
edgeShapeFactory: r.edgeShape !== void 0 ? he(r.edgeShape) : e
|
|
3296
3329
|
};
|
|
3297
|
-
},
|
|
3330
|
+
}, qt = (r, e) => {
|
|
3298
3331
|
var c, g, l;
|
|
3299
|
-
const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey,
|
|
3332
|
+
const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, o = (u) => u.button === 0, n = (u) => {
|
|
3300
3333
|
const p = e.getPortAdjacentEdgeIds(u);
|
|
3301
3334
|
return p.length > 0 ? p[p.length - 1] : null;
|
|
3302
3335
|
}, a = () => {
|
|
@@ -3306,17 +3339,17 @@ const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
|
3306
3339
|
return {
|
|
3307
3340
|
connectionPreprocessor: r.connectionPreprocessor ?? t,
|
|
3308
3341
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
|
|
3309
|
-
mouseUpEventVerifier: r.mouseUpEventVerifier ??
|
|
3342
|
+
mouseUpEventVerifier: r.mouseUpEventVerifier ?? o,
|
|
3310
3343
|
draggingEdgeResolver: r.draggingEdgeResolver ?? n,
|
|
3311
|
-
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ?
|
|
3344
|
+
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? he(r.draggingEdgeShape) : null,
|
|
3312
3345
|
onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
|
|
3313
3346
|
onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
|
|
3314
3347
|
onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
|
|
3315
3348
|
};
|
|
3316
|
-
},
|
|
3349
|
+
}, Kt = (r) => ({
|
|
3317
3350
|
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
3318
3351
|
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
3319
|
-
}),
|
|
3352
|
+
}), Qt = (r) => {
|
|
3320
3353
|
var e, t;
|
|
3321
3354
|
return {
|
|
3322
3355
|
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
|
|
@@ -3325,28 +3358,28 @@ const q = (r) => () => r, ye = q(0), Vt = () => {
|
|
|
3325
3358
|
})
|
|
3326
3359
|
};
|
|
3327
3360
|
};
|
|
3328
|
-
class
|
|
3361
|
+
class Zt extends Error {
|
|
3329
3362
|
constructor() {
|
|
3330
3363
|
super(...arguments);
|
|
3331
|
-
|
|
3364
|
+
i(this, "name", "CanvasBuilderError");
|
|
3332
3365
|
}
|
|
3333
3366
|
}
|
|
3334
|
-
class
|
|
3367
|
+
class ke {
|
|
3335
3368
|
constructor(e, t, s) {
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3369
|
+
i(this, "dt");
|
|
3370
|
+
i(this, "nodeMass");
|
|
3371
|
+
i(this, "edgeEquilibriumLength");
|
|
3372
|
+
i(this, "edgeStiffness");
|
|
3373
|
+
i(this, "nodeForcesApplicationStrategy");
|
|
3374
|
+
i(this, "distanceVectorGenerator");
|
|
3342
3375
|
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
3376
|
}
|
|
3344
3377
|
apply() {
|
|
3345
3378
|
let e = 0;
|
|
3346
3379
|
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((
|
|
3380
|
+
return this.graph.getAllNodeIds().forEach((o) => {
|
|
3381
|
+
t.set(o, { x: 0, y: 0 });
|
|
3382
|
+
}), this.nodeForcesApplicationStrategy.apply(this.currentCoords, t), this.applyEdgeForces(t), this.currentCoords.forEach((o, n) => {
|
|
3350
3383
|
const a = t.get(n), h = {
|
|
3351
3384
|
x: a.x / this.nodeMass * this.dt,
|
|
3352
3385
|
y: a.y / this.nodeMass * this.dt
|
|
@@ -3356,26 +3389,26 @@ class Be {
|
|
|
3356
3389
|
Math.sqrt(h.x * h.x + h.y * h.y)
|
|
3357
3390
|
);
|
|
3358
3391
|
const d = h.x * this.dt, c = h.y * this.dt;
|
|
3359
|
-
|
|
3392
|
+
o.x += d, o.y += c;
|
|
3360
3393
|
}), e;
|
|
3361
3394
|
}
|
|
3362
3395
|
applyEdgeForces(e) {
|
|
3363
3396
|
this.graph.getAllEdgeIds().forEach((t) => {
|
|
3364
|
-
const s = this.graph.getEdge(t),
|
|
3397
|
+
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
3398
|
a,
|
|
3366
3399
|
h
|
|
3367
|
-
), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, p = e.get(
|
|
3400
|
+
), g = (d.d - this.edgeEquilibriumLength) * this.edgeStiffness, l = d.ex * g, u = d.ey * g, p = e.get(o.nodeId), f = e.get(n.nodeId);
|
|
3368
3401
|
p.x += l, p.y += u, f.x -= l, f.y -= u;
|
|
3369
3402
|
});
|
|
3370
3403
|
}
|
|
3371
3404
|
}
|
|
3372
|
-
class
|
|
3405
|
+
class He {
|
|
3373
3406
|
constructor(e) {
|
|
3374
|
-
|
|
3407
|
+
i(this, "PI2", 2 * Math.PI);
|
|
3375
3408
|
this.rand = e;
|
|
3376
3409
|
}
|
|
3377
3410
|
create(e, t) {
|
|
3378
|
-
const s = t.x - e.x,
|
|
3411
|
+
const s = t.x - e.x, o = t.y - e.y, n = s * s + o * o;
|
|
3379
3412
|
if (n === 0) {
|
|
3380
3413
|
const c = this.PI2 * this.rand();
|
|
3381
3414
|
return {
|
|
@@ -3384,70 +3417,70 @@ class $e {
|
|
|
3384
3417
|
d: 0
|
|
3385
3418
|
};
|
|
3386
3419
|
}
|
|
3387
|
-
const a = Math.sqrt(n), h = s / a, d =
|
|
3420
|
+
const a = Math.sqrt(n), h = s / a, d = o / a;
|
|
3388
3421
|
return { ex: h, ey: d, d: a };
|
|
3389
3422
|
}
|
|
3390
3423
|
}
|
|
3391
|
-
const
|
|
3424
|
+
const Ye = (r) => {
|
|
3392
3425
|
if (r.distance === 0)
|
|
3393
3426
|
return r.maxForce;
|
|
3394
3427
|
const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
|
|
3395
3428
|
return Math.min(e, r.maxForce);
|
|
3396
3429
|
};
|
|
3397
|
-
class
|
|
3430
|
+
class Jt {
|
|
3398
3431
|
constructor(e) {
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3432
|
+
i(this, "nodeCharge");
|
|
3433
|
+
i(this, "distanceVectorGenerator");
|
|
3434
|
+
i(this, "maxForce");
|
|
3402
3435
|
this.nodeCharge = e.nodeCharge, this.distanceVectorGenerator = e.distanceVectorGenerator, this.maxForce = e.maxForce;
|
|
3403
3436
|
}
|
|
3404
3437
|
apply(e, t) {
|
|
3405
|
-
const s = Array.from(t.keys()),
|
|
3406
|
-
for (let n = 0; n <
|
|
3438
|
+
const s = Array.from(t.keys()), o = s.length;
|
|
3439
|
+
for (let n = 0; n < o; n++) {
|
|
3407
3440
|
const a = s[n];
|
|
3408
|
-
for (let h = n + 1; h <
|
|
3441
|
+
for (let h = n + 1; h < o; h++) {
|
|
3409
3442
|
const d = s[h], c = e.get(a), g = e.get(d), l = this.distanceVectorGenerator.create(
|
|
3410
3443
|
c,
|
|
3411
3444
|
g
|
|
3412
|
-
), u =
|
|
3445
|
+
), u = Ye({
|
|
3413
3446
|
coefficient: 1,
|
|
3414
3447
|
sourceCharge: this.nodeCharge,
|
|
3415
3448
|
targetCharge: this.nodeCharge,
|
|
3416
3449
|
distance: l.d,
|
|
3417
3450
|
maxForce: this.maxForce
|
|
3418
|
-
}), p = u * l.ex, f = u * l.ey,
|
|
3419
|
-
|
|
3451
|
+
}), p = u * l.ex, f = u * l.ey, v = t.get(a), x = t.get(d);
|
|
3452
|
+
v.x -= p, v.y -= f, x.x += p, x.y += f;
|
|
3420
3453
|
}
|
|
3421
3454
|
}
|
|
3422
3455
|
}
|
|
3423
3456
|
}
|
|
3424
|
-
const
|
|
3457
|
+
const _t = (r) => {
|
|
3425
3458
|
if (r.size === 0)
|
|
3426
3459
|
return {
|
|
3427
3460
|
centerX: 0,
|
|
3428
3461
|
centerY: 0,
|
|
3429
3462
|
radius: 0
|
|
3430
3463
|
};
|
|
3431
|
-
let e = 1 / 0, t = -1 / 0, s = 1 / 0,
|
|
3464
|
+
let e = 1 / 0, t = -1 / 0, s = 1 / 0, o = -1 / 0;
|
|
3432
3465
|
r.forEach((d) => {
|
|
3433
|
-
e = Math.min(e, d.x), t = Math.max(t, d.x), s = Math.min(s, d.y),
|
|
3466
|
+
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
3467
|
});
|
|
3435
|
-
const n = t - e, a =
|
|
3468
|
+
const n = t - e, a = o - s, h = Math.max(n, a);
|
|
3436
3469
|
return {
|
|
3437
3470
|
centerX: (e + t) / 2,
|
|
3438
|
-
centerY: (s +
|
|
3471
|
+
centerY: (s + o) / 2,
|
|
3439
3472
|
radius: h / 2
|
|
3440
3473
|
};
|
|
3441
3474
|
};
|
|
3442
|
-
class
|
|
3475
|
+
class er {
|
|
3443
3476
|
constructor(e) {
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3477
|
+
i(this, "root");
|
|
3478
|
+
i(this, "leaves", /* @__PURE__ */ new Map());
|
|
3479
|
+
i(this, "coords");
|
|
3480
|
+
i(this, "areaRadiusThreshold");
|
|
3481
|
+
i(this, "nodeMass");
|
|
3482
|
+
i(this, "nodeCharge");
|
|
3483
|
+
i(this, "sortedParentNodes", []);
|
|
3451
3484
|
this.coords = e.coords, this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.root = {
|
|
3452
3485
|
nodeIds: new Set(e.coords.keys()),
|
|
3453
3486
|
box: e.box,
|
|
@@ -3467,16 +3500,16 @@ class Qt {
|
|
|
3467
3500
|
for (; t.length > 0; ) {
|
|
3468
3501
|
const s = [];
|
|
3469
3502
|
for (; t.length > 0; ) {
|
|
3470
|
-
const
|
|
3471
|
-
this.processNode(
|
|
3503
|
+
const o = t.pop();
|
|
3504
|
+
this.processNode(o).forEach((a) => {
|
|
3472
3505
|
s.push(a);
|
|
3473
3506
|
});
|
|
3474
3507
|
}
|
|
3475
3508
|
t = s;
|
|
3476
3509
|
}
|
|
3477
3510
|
this.sortedParentNodes.reverse().forEach((s) => {
|
|
3478
|
-
let
|
|
3479
|
-
s.lb !== null && (a += s.lb.totalMass, h += s.lb.totalCharge,
|
|
3511
|
+
let o = 0, n = 0, a = 0, h = 0;
|
|
3512
|
+
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
3513
|
});
|
|
3481
3514
|
}
|
|
3482
3515
|
getRoot() {
|
|
@@ -3488,11 +3521,11 @@ class Qt {
|
|
|
3488
3521
|
processNode(e) {
|
|
3489
3522
|
if (e.nodeIds.size < 2)
|
|
3490
3523
|
return this.setLeaf(e), [];
|
|
3491
|
-
const { centerX: t, centerY: s, radius:
|
|
3492
|
-
if (
|
|
3524
|
+
const { centerX: t, centerY: s, radius: o } = e.box;
|
|
3525
|
+
if (o < this.areaRadiusThreshold)
|
|
3493
3526
|
return this.setLeaf(e), [];
|
|
3494
3527
|
this.sortedParentNodes.push(e);
|
|
3495
|
-
const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c =
|
|
3528
|
+
const n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = o / 2;
|
|
3496
3529
|
e.nodeIds.forEach((u) => {
|
|
3497
3530
|
const { x: p, y: f } = this.coords.get(u);
|
|
3498
3531
|
p < t ? f < s ? d.add(u) : h.add(u) : f < s ? a.add(u) : n.add(u), e.nodeIds.delete(u);
|
|
@@ -3590,25 +3623,25 @@ class Qt {
|
|
|
3590
3623
|
y: 0
|
|
3591
3624
|
};
|
|
3592
3625
|
let t = 0, s = 0;
|
|
3593
|
-
return e.forEach((
|
|
3594
|
-
const n = this.coords.get(
|
|
3626
|
+
return e.forEach((o) => {
|
|
3627
|
+
const n = this.coords.get(o);
|
|
3595
3628
|
t += n.x, s += n.y;
|
|
3596
3629
|
}), { x: t / e.size, y: s / e.size };
|
|
3597
3630
|
}
|
|
3598
3631
|
}
|
|
3599
|
-
class
|
|
3632
|
+
class tr {
|
|
3600
3633
|
constructor(e) {
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3634
|
+
i(this, "areaRadiusThreshold");
|
|
3635
|
+
i(this, "nodeMass");
|
|
3636
|
+
i(this, "nodeCharge");
|
|
3637
|
+
i(this, "theta");
|
|
3638
|
+
i(this, "distanceVectorGenerator");
|
|
3639
|
+
i(this, "nodeForceCoefficient");
|
|
3640
|
+
i(this, "maxForce");
|
|
3608
3641
|
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
3642
|
}
|
|
3610
3643
|
apply(e, t) {
|
|
3611
|
-
const s =
|
|
3644
|
+
const s = _t(e), o = new er({
|
|
3612
3645
|
box: s,
|
|
3613
3646
|
coords: e,
|
|
3614
3647
|
areaRadiusThreshold: this.areaRadiusThreshold,
|
|
@@ -3617,7 +3650,7 @@ class Zt {
|
|
|
3617
3650
|
});
|
|
3618
3651
|
e.forEach((n, a) => {
|
|
3619
3652
|
const h = this.calculateForceForNode(
|
|
3620
|
-
|
|
3653
|
+
o.getLeaf(a),
|
|
3621
3654
|
a,
|
|
3622
3655
|
e
|
|
3623
3656
|
), d = t.get(a);
|
|
@@ -3625,14 +3658,14 @@ class Zt {
|
|
|
3625
3658
|
});
|
|
3626
3659
|
}
|
|
3627
3660
|
calculateForceForNode(e, t, s) {
|
|
3628
|
-
const
|
|
3661
|
+
const o = s.get(t), n = { x: 0, y: 0 };
|
|
3629
3662
|
e.nodeIds.forEach((h) => {
|
|
3630
3663
|
if (h !== t) {
|
|
3631
3664
|
const d = s.get(h), c = this.calculateNodeRepulsiveForce({
|
|
3632
3665
|
sourceCharge: this.nodeCharge,
|
|
3633
3666
|
targetCharge: this.nodeCharge,
|
|
3634
3667
|
sourceCoords: d,
|
|
3635
|
-
targetCoords:
|
|
3668
|
+
targetCoords: o
|
|
3636
3669
|
});
|
|
3637
3670
|
this.applyForce(n, c);
|
|
3638
3671
|
}
|
|
@@ -3643,49 +3676,49 @@ class Zt {
|
|
|
3643
3676
|
if (h !== null) {
|
|
3644
3677
|
const d = this.distanceVectorGenerator.create(
|
|
3645
3678
|
h.chargeCenter,
|
|
3646
|
-
|
|
3679
|
+
o
|
|
3647
3680
|
);
|
|
3648
3681
|
h.box.radius * 2 < d.d * this.theta ? (this.tryApplyFarForce({
|
|
3649
3682
|
totalForce: n,
|
|
3650
|
-
targetCoords:
|
|
3683
|
+
targetCoords: o,
|
|
3651
3684
|
target: h.lb,
|
|
3652
3685
|
current: a
|
|
3653
3686
|
}), this.tryApplyFarForce({
|
|
3654
3687
|
totalForce: n,
|
|
3655
|
-
targetCoords:
|
|
3688
|
+
targetCoords: o,
|
|
3656
3689
|
target: h.rb,
|
|
3657
3690
|
current: a
|
|
3658
3691
|
}), this.tryApplyFarForce({
|
|
3659
3692
|
totalForce: n,
|
|
3660
|
-
targetCoords:
|
|
3693
|
+
targetCoords: o,
|
|
3661
3694
|
target: h.rt,
|
|
3662
3695
|
current: a
|
|
3663
3696
|
}), this.tryApplyFarForce({
|
|
3664
3697
|
totalForce: n,
|
|
3665
|
-
targetCoords:
|
|
3698
|
+
targetCoords: o,
|
|
3666
3699
|
target: h.lt,
|
|
3667
3700
|
current: a
|
|
3668
3701
|
})) : (this.tryApplyNearForce({
|
|
3669
3702
|
totalForce: n,
|
|
3670
|
-
targetCoords:
|
|
3703
|
+
targetCoords: o,
|
|
3671
3704
|
target: h.lb,
|
|
3672
3705
|
current: a,
|
|
3673
3706
|
nodesCoords: s
|
|
3674
3707
|
}), this.tryApplyNearForce({
|
|
3675
3708
|
totalForce: n,
|
|
3676
|
-
targetCoords:
|
|
3709
|
+
targetCoords: o,
|
|
3677
3710
|
target: h.rb,
|
|
3678
3711
|
current: a,
|
|
3679
3712
|
nodesCoords: s
|
|
3680
3713
|
}), this.tryApplyNearForce({
|
|
3681
3714
|
totalForce: n,
|
|
3682
|
-
targetCoords:
|
|
3715
|
+
targetCoords: o,
|
|
3683
3716
|
target: h.rt,
|
|
3684
3717
|
current: a,
|
|
3685
3718
|
nodesCoords: s
|
|
3686
3719
|
}), this.tryApplyNearForce({
|
|
3687
3720
|
totalForce: n,
|
|
3688
|
-
targetCoords:
|
|
3721
|
+
targetCoords: o,
|
|
3689
3722
|
target: h.lt,
|
|
3690
3723
|
current: a,
|
|
3691
3724
|
nodesCoords: s
|
|
@@ -3696,7 +3729,7 @@ class Zt {
|
|
|
3696
3729
|
return n;
|
|
3697
3730
|
}
|
|
3698
3731
|
calculateExactForce(e, t, s) {
|
|
3699
|
-
const
|
|
3732
|
+
const o = { x: 0, y: 0 }, n = [e];
|
|
3700
3733
|
for (; n.length > 0; ) {
|
|
3701
3734
|
const a = n.pop();
|
|
3702
3735
|
a.nodeIds.forEach((h) => {
|
|
@@ -3706,10 +3739,10 @@ class Zt {
|
|
|
3706
3739
|
sourceCoords: d,
|
|
3707
3740
|
targetCoords: t
|
|
3708
3741
|
});
|
|
3709
|
-
this.applyForce(
|
|
3742
|
+
this.applyForce(o, c);
|
|
3710
3743
|
}), 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
3744
|
}
|
|
3712
|
-
return
|
|
3745
|
+
return o;
|
|
3713
3746
|
}
|
|
3714
3747
|
calculateApproximateForce(e, t) {
|
|
3715
3748
|
return this.calculateNodeRepulsiveForce({
|
|
@@ -3723,7 +3756,7 @@ class Zt {
|
|
|
3723
3756
|
const t = this.distanceVectorGenerator.create(
|
|
3724
3757
|
e.sourceCoords,
|
|
3725
3758
|
e.targetCoords
|
|
3726
|
-
), s =
|
|
3759
|
+
), s = Ye({
|
|
3727
3760
|
coefficient: this.nodeForceCoefficient,
|
|
3728
3761
|
sourceCharge: e.sourceCharge,
|
|
3729
3762
|
targetCharge: e.targetCharge,
|
|
@@ -3758,7 +3791,7 @@ class Zt {
|
|
|
3758
3791
|
}
|
|
3759
3792
|
}
|
|
3760
3793
|
}
|
|
3761
|
-
const
|
|
3794
|
+
const Xe = (r) => r.theta !== 0 ? new tr({
|
|
3762
3795
|
nodeCharge: r.nodeCharge,
|
|
3763
3796
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3764
3797
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
@@ -3766,44 +3799,47 @@ const Oe = (r) => r.theta !== 0 ? new Zt({
|
|
|
3766
3799
|
theta: r.theta,
|
|
3767
3800
|
nodeMass: r.nodeMass,
|
|
3768
3801
|
areaRadiusThreshold: r.areaRadiusThreshold
|
|
3769
|
-
}) : new
|
|
3802
|
+
}) : new Jt({
|
|
3770
3803
|
nodeCharge: r.nodeCharge,
|
|
3771
3804
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3772
3805
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
3773
3806
|
maxForce: r.maxForce
|
|
3774
3807
|
});
|
|
3775
|
-
class
|
|
3808
|
+
class Ge {
|
|
3776
3809
|
constructor(e) {
|
|
3777
|
-
|
|
3778
|
-
|
|
3810
|
+
i(this, "rand");
|
|
3811
|
+
i(this, "sparsity");
|
|
3779
3812
|
this.rand = e.rand, this.sparsity = e.sparsity;
|
|
3780
3813
|
}
|
|
3781
3814
|
calculateCoordinates(e) {
|
|
3782
|
-
const { graph: t, viewport: s } = e,
|
|
3815
|
+
const { graph: t, viewport: s } = e, o = /* @__PURE__ */ new Map(), n = t.getAllNodeIds().filter((f) => {
|
|
3816
|
+
const v = t.getNode(f);
|
|
3817
|
+
return v.x === null || v.y === null;
|
|
3818
|
+
}), 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
3819
|
x: g.x - l,
|
|
3784
3820
|
y: g.y - l
|
|
3785
3821
|
};
|
|
3786
|
-
return
|
|
3787
|
-
const
|
|
3788
|
-
|
|
3789
|
-
x:
|
|
3790
|
-
y:
|
|
3822
|
+
return t.getAllNodeIds().forEach((f) => {
|
|
3823
|
+
const v = t.getNode(f);
|
|
3824
|
+
o.set(f, {
|
|
3825
|
+
x: v.x ?? u.x + a * this.rand(),
|
|
3826
|
+
y: v.y ?? u.y + a * this.rand()
|
|
3791
3827
|
});
|
|
3792
|
-
}),
|
|
3828
|
+
}), o;
|
|
3793
3829
|
}
|
|
3794
3830
|
}
|
|
3795
|
-
class
|
|
3831
|
+
class rr {
|
|
3796
3832
|
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
|
|
3833
|
+
i(this, "distanceVectorGenerator");
|
|
3834
|
+
i(this, "nodeForcesApplicationStrategy");
|
|
3835
|
+
i(this, "fillerLayoutAlgorithm");
|
|
3836
|
+
i(this, "maxIterations");
|
|
3837
|
+
i(this, "dtSec");
|
|
3838
|
+
i(this, "nodeMass");
|
|
3839
|
+
i(this, "edgeEquilibriumLength");
|
|
3840
|
+
i(this, "edgeStiffness");
|
|
3841
|
+
i(this, "convergenceVelocity");
|
|
3842
|
+
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 He(e.rand), this.nodeForcesApplicationStrategy = Xe({
|
|
3807
3843
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
3808
3844
|
nodeCharge: e.nodeCharge,
|
|
3809
3845
|
maxForce: e.maxForce,
|
|
@@ -3811,19 +3847,19 @@ class Jt {
|
|
|
3811
3847
|
theta: e.barnesHutTheta,
|
|
3812
3848
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
3813
3849
|
nodeMass: e.nodeMass
|
|
3814
|
-
}), this.fillerLayoutAlgorithm = new
|
|
3850
|
+
}), this.fillerLayoutAlgorithm = new Ge({
|
|
3815
3851
|
rand: e.rand,
|
|
3816
3852
|
sparsity: e.edgeEquilibriumLength
|
|
3817
3853
|
});
|
|
3818
3854
|
}
|
|
3819
3855
|
calculateCoordinates(e) {
|
|
3820
|
-
const { graph: t, viewport: s } = e,
|
|
3856
|
+
const { graph: t, viewport: s } = e, o = this.fillerLayoutAlgorithm.calculateCoordinates({
|
|
3821
3857
|
graph: t,
|
|
3822
3858
|
viewport: s
|
|
3823
3859
|
});
|
|
3824
|
-
for (let n = 0; n < this.maxIterations && !(new
|
|
3860
|
+
for (let n = 0; n < this.maxIterations && !(new ke(
|
|
3825
3861
|
t,
|
|
3826
|
-
|
|
3862
|
+
o,
|
|
3827
3863
|
{
|
|
3828
3864
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
3829
3865
|
nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
|
|
@@ -3834,13 +3870,13 @@ class Jt {
|
|
|
3834
3870
|
}
|
|
3835
3871
|
).apply() < this.convergenceVelocity); n++)
|
|
3836
3872
|
;
|
|
3837
|
-
return
|
|
3873
|
+
return o;
|
|
3838
3874
|
}
|
|
3839
3875
|
}
|
|
3840
|
-
class
|
|
3876
|
+
class sr {
|
|
3841
3877
|
constructor(e) {
|
|
3842
|
-
|
|
3843
|
-
|
|
3878
|
+
i(this, "forest", /* @__PURE__ */ new Set());
|
|
3879
|
+
i(this, "remainingNodeIds");
|
|
3844
3880
|
for (this.graph = e, this.remainingNodeIds = new Set(this.graph.getAllNodeIds()); this.remainingNodeIds.size > 0; ) {
|
|
3845
3881
|
const [t] = this.remainingNodeIds;
|
|
3846
3882
|
this.traverse(t);
|
|
@@ -3855,10 +3891,10 @@ class _t {
|
|
|
3855
3891
|
children: /* @__PURE__ */ new Set()
|
|
3856
3892
|
}, s = [];
|
|
3857
3893
|
this.forest.add({ root: t, sequence: s });
|
|
3858
|
-
let
|
|
3859
|
-
for (;
|
|
3894
|
+
let o = [t];
|
|
3895
|
+
for (; o.length > 0; ) {
|
|
3860
3896
|
const n = [];
|
|
3861
|
-
|
|
3897
|
+
o.forEach((a) => {
|
|
3862
3898
|
s.push(a), this.remainingNodeIds.delete(a.nodeId);
|
|
3863
3899
|
const h = this.graph.getNodeOutgoingEdgeIds(a.nodeId).map((g) => {
|
|
3864
3900
|
const l = this.graph.getEdge(g);
|
|
@@ -3876,52 +3912,52 @@ class _t {
|
|
|
3876
3912
|
};
|
|
3877
3913
|
a.children.add(l), n.push(l);
|
|
3878
3914
|
});
|
|
3879
|
-
}),
|
|
3915
|
+
}), o = n;
|
|
3880
3916
|
}
|
|
3881
3917
|
}
|
|
3882
3918
|
}
|
|
3883
|
-
class
|
|
3919
|
+
class or {
|
|
3884
3920
|
constructor(e) {
|
|
3885
|
-
|
|
3921
|
+
i(this, "baseRadius");
|
|
3886
3922
|
this.baseRadius = e.radius;
|
|
3887
3923
|
}
|
|
3888
3924
|
resolve(e) {
|
|
3889
3925
|
let t = 0, s = -1 / 0;
|
|
3890
|
-
const
|
|
3926
|
+
const o = [];
|
|
3891
3927
|
e.forEach((h) => {
|
|
3892
|
-
h === null ? (t += this.baseRadius,
|
|
3928
|
+
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
3929
|
});
|
|
3894
3930
|
const n = t / 2;
|
|
3895
3931
|
let a = 0;
|
|
3896
3932
|
if (e.length > 0) {
|
|
3897
|
-
const h = e[e.length - 1] ?? 0, d =
|
|
3933
|
+
const h = e[e.length - 1] ?? 0, d = o[o.length - 1];
|
|
3898
3934
|
a = Math.max(
|
|
3899
3935
|
a,
|
|
3900
3936
|
d + h - t
|
|
3901
3937
|
);
|
|
3902
|
-
const c = e[0] ?? 0, g =
|
|
3938
|
+
const c = e[0] ?? 0, g = o[0];
|
|
3903
3939
|
a = Math.max(a, c - g);
|
|
3904
3940
|
}
|
|
3905
3941
|
return {
|
|
3906
|
-
offsets:
|
|
3942
|
+
offsets: o.map((h) => h - n),
|
|
3907
3943
|
radius: n + a
|
|
3908
3944
|
};
|
|
3909
3945
|
}
|
|
3910
3946
|
}
|
|
3911
|
-
class
|
|
3947
|
+
class ir {
|
|
3912
3948
|
constructor(e, t) {
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
this.tree = e, this.layerNodePlacementResolver = new
|
|
3949
|
+
i(this, "offsets", /* @__PURE__ */ new Map());
|
|
3950
|
+
i(this, "childrenRadii", /* @__PURE__ */ new Map());
|
|
3951
|
+
i(this, "layerNodePlacementResolver");
|
|
3952
|
+
this.tree = e, this.layerNodePlacementResolver = new or({
|
|
3917
3953
|
radius: t.spaceAroundRadius
|
|
3918
3954
|
}), [...this.tree.sequence].reverse().forEach((s) => {
|
|
3919
3955
|
if (s.children.size === 0)
|
|
3920
3956
|
this.childrenRadii.set(s.nodeId, null);
|
|
3921
3957
|
else {
|
|
3922
|
-
const
|
|
3958
|
+
const o = Array.from(s.children).map(
|
|
3923
3959
|
(h) => this.childrenRadii.get(h.nodeId)
|
|
3924
|
-
), n = this.layerNodePlacementResolver.resolve(
|
|
3960
|
+
), n = this.layerNodePlacementResolver.resolve(o);
|
|
3925
3961
|
this.childrenRadii.set(s.nodeId, n.radius);
|
|
3926
3962
|
let a = 0;
|
|
3927
3963
|
s.children.forEach((h) => {
|
|
@@ -3934,16 +3970,16 @@ class tr {
|
|
|
3934
3970
|
return this.offsets;
|
|
3935
3971
|
}
|
|
3936
3972
|
}
|
|
3937
|
-
class
|
|
3973
|
+
class nr {
|
|
3938
3974
|
constructor(e) {
|
|
3939
3975
|
this.params = e;
|
|
3940
3976
|
}
|
|
3941
3977
|
calculateCoordinates(e) {
|
|
3942
|
-
const t = /* @__PURE__ */ new Map(),
|
|
3978
|
+
const t = /* @__PURE__ */ new Map(), o = new sr(e.graph).generate();
|
|
3943
3979
|
let n = 0;
|
|
3944
|
-
return
|
|
3980
|
+
return o.forEach((a) => {
|
|
3945
3981
|
t.set(a.root.nodeId, { x: n, y: 0 });
|
|
3946
|
-
const d = new
|
|
3982
|
+
const d = new ir(a, {
|
|
3947
3983
|
spaceAroundRadius: this.params.layerSpace / 2
|
|
3948
3984
|
}).generate();
|
|
3949
3985
|
let c = [a.root];
|
|
@@ -3959,20 +3995,23 @@ class rr {
|
|
|
3959
3995
|
});
|
|
3960
3996
|
}), c = g;
|
|
3961
3997
|
}
|
|
3998
|
+
}), t.forEach((a) => {
|
|
3999
|
+
const h = this.params.transform(a);
|
|
4000
|
+
a.x = h.x, a.y = h.y;
|
|
3962
4001
|
}), t;
|
|
3963
4002
|
}
|
|
3964
4003
|
}
|
|
3965
|
-
class
|
|
4004
|
+
class ar {
|
|
3966
4005
|
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
|
|
4006
|
+
i(this, "distanceVectorGenerator");
|
|
4007
|
+
i(this, "nodeForcesApplicationStrategy");
|
|
4008
|
+
i(this, "convergenceVelocity");
|
|
4009
|
+
i(this, "maxTimeDeltaSec");
|
|
4010
|
+
i(this, "nodeMass");
|
|
4011
|
+
i(this, "edgeEquilibriumLength");
|
|
4012
|
+
i(this, "edgeStiffness");
|
|
4013
|
+
i(this, "fillerLayoutAlgorithm");
|
|
4014
|
+
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new He(e.rand), this.nodeForcesApplicationStrategy = Xe({
|
|
3976
4015
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
3977
4016
|
nodeCharge: e.nodeCharge,
|
|
3978
4017
|
maxForce: e.maxForce,
|
|
@@ -3980,23 +4019,23 @@ class sr {
|
|
|
3980
4019
|
theta: e.barnesHutTheta,
|
|
3981
4020
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
3982
4021
|
nodeMass: e.nodeMass
|
|
3983
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4022
|
+
}), this.fillerLayoutAlgorithm = new Ge({
|
|
3984
4023
|
rand: e.rand,
|
|
3985
4024
|
sparsity: e.edgeEquilibriumLength
|
|
3986
4025
|
});
|
|
3987
4026
|
}
|
|
3988
4027
|
calculateNextCoordinates(e) {
|
|
3989
|
-
const { graph: t, viewport: s, dt:
|
|
4028
|
+
const { graph: t, viewport: s, dt: o } = e, n = this.fillerLayoutAlgorithm.calculateCoordinates({
|
|
3990
4029
|
graph: t,
|
|
3991
4030
|
viewport: s
|
|
3992
4031
|
});
|
|
3993
|
-
return new
|
|
4032
|
+
return new ke(
|
|
3994
4033
|
t,
|
|
3995
4034
|
n,
|
|
3996
4035
|
{
|
|
3997
4036
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
3998
4037
|
nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
|
|
3999
|
-
dtSec: Math.min(
|
|
4038
|
+
dtSec: Math.min(o, this.maxTimeDeltaSec),
|
|
4000
4039
|
nodeMass: this.nodeMass,
|
|
4001
4040
|
edgeEquilibriumLength: this.edgeEquilibriumLength,
|
|
4002
4041
|
edgeStiffness: this.edgeStiffness
|
|
@@ -4007,16 +4046,16 @@ class sr {
|
|
|
4007
4046
|
}) ? /* @__PURE__ */ new Map() : n;
|
|
4008
4047
|
}
|
|
4009
4048
|
}
|
|
4010
|
-
const
|
|
4011
|
-
let e = 1779033703, t = 3144134277, s = 1013904242,
|
|
4049
|
+
const je = (r) => {
|
|
4050
|
+
let e = 1779033703, t = 3144134277, s = 1013904242, o = 2773480762;
|
|
4012
4051
|
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
|
-
},
|
|
4052
|
+
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);
|
|
4053
|
+
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];
|
|
4054
|
+
}, qe = (r, e, t, s) => function() {
|
|
4016
4055
|
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
|
-
},
|
|
4056
|
+
const o = (r + e | 0) + s | 0;
|
|
4057
|
+
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;
|
|
4058
|
+
}, A = Object.freeze({
|
|
4020
4059
|
seed: "HTMLGraph is awesome",
|
|
4021
4060
|
maxTimeDeltaSec: 0.01,
|
|
4022
4061
|
nodeCharge: 1e5,
|
|
@@ -4030,25 +4069,25 @@ const ze = (r) => {
|
|
|
4030
4069
|
nodeForceCoefficient: 1,
|
|
4031
4070
|
barnesHutAreaRadiusThreshold: 0.01,
|
|
4032
4071
|
barnesHutTheta: 1
|
|
4033
|
-
}),
|
|
4072
|
+
}), hr = (r) => {
|
|
4034
4073
|
var e, t;
|
|
4035
4074
|
switch (r == null ? void 0 : r.type) {
|
|
4036
4075
|
case "custom":
|
|
4037
4076
|
return r.instance;
|
|
4038
4077
|
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) ??
|
|
4078
|
+
const s = je((r == null ? void 0 : r.seed) ?? A.seed), o = qe(s[0], s[1], s[2], s[3]);
|
|
4079
|
+
return new ar({
|
|
4080
|
+
rand: o,
|
|
4081
|
+
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? A.maxTimeDeltaSec,
|
|
4082
|
+
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? A.nodeCharge,
|
|
4083
|
+
nodeMass: (r == null ? void 0 : r.nodeMass) ?? A.nodeMass,
|
|
4084
|
+
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? A.edgeEquilibriumLength,
|
|
4085
|
+
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? A.edgeStiffness,
|
|
4086
|
+
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? A.convergenceVelocity,
|
|
4087
|
+
maxForce: (r == null ? void 0 : r.maxForce) ?? A.maxForce,
|
|
4088
|
+
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? A.nodeForceCoefficient,
|
|
4089
|
+
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? A.barnesHutTheta,
|
|
4090
|
+
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? A.barnesHutAreaRadiusThreshold
|
|
4052
4091
|
});
|
|
4053
4092
|
}
|
|
4054
4093
|
}
|
|
@@ -4058,21 +4097,23 @@ const ze = (r) => {
|
|
|
4058
4097
|
},
|
|
4059
4098
|
onAfterApplied: () => {
|
|
4060
4099
|
}
|
|
4061
|
-
},
|
|
4100
|
+
}, dr = (r) => {
|
|
4062
4101
|
var t, s;
|
|
4063
4102
|
return {
|
|
4064
|
-
algorithm:
|
|
4103
|
+
algorithm: hr((r == null ? void 0 : r.algorithm) ?? {}),
|
|
4065
4104
|
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? G.staticNodeResolver,
|
|
4066
4105
|
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? G.onBeforeApplied,
|
|
4067
4106
|
onAfterApplied: ((s = r == null ? void 0 : r.events) == null ? void 0 : s.onAfterApplied) ?? G.onAfterApplied
|
|
4068
4107
|
};
|
|
4069
|
-
},
|
|
4070
|
-
type: "
|
|
4108
|
+
}, cr = (r) => r instanceof K ? {
|
|
4109
|
+
type: "trigger",
|
|
4071
4110
|
trigger: r
|
|
4072
4111
|
} : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
|
|
4073
|
-
type: "
|
|
4112
|
+
type: "topologyChangeSchedule",
|
|
4113
|
+
schedule: Tt
|
|
4074
4114
|
} : {
|
|
4075
|
-
type: "
|
|
4115
|
+
type: "topologyChangeSchedule",
|
|
4116
|
+
schedule: Mt
|
|
4076
4117
|
}, F = Object.freeze({
|
|
4077
4118
|
staticNodeResolver: () => !1,
|
|
4078
4119
|
onBeforeApplied: () => {
|
|
@@ -4083,44 +4124,177 @@ const ze = (r) => {
|
|
|
4083
4124
|
layerWidth: 300,
|
|
4084
4125
|
layerSpace: 300
|
|
4085
4126
|
}
|
|
4086
|
-
}),
|
|
4127
|
+
}), $ = (r, e) => ({
|
|
4128
|
+
a: r.a * e.a + r.b * e.d,
|
|
4129
|
+
b: r.a * e.b + r.b * e.e,
|
|
4130
|
+
c: r.a * e.c + r.b * e.f + r.c,
|
|
4131
|
+
d: r.d * e.a + r.e * e.d,
|
|
4132
|
+
e: r.d * e.b + r.e * e.e,
|
|
4133
|
+
f: r.d * e.c + r.e * e.f + r.f
|
|
4134
|
+
}), lr = (r) => {
|
|
4135
|
+
const { a: e, b: t, c: s, d: o, e: n, f: a } = r, h = e * n - t * o;
|
|
4136
|
+
return {
|
|
4137
|
+
a: n / h,
|
|
4138
|
+
b: -t / h,
|
|
4139
|
+
c: (t * a - s * n) / h,
|
|
4140
|
+
d: -o / h,
|
|
4141
|
+
e: e / h,
|
|
4142
|
+
f: (s * o - e * a) / h
|
|
4143
|
+
};
|
|
4144
|
+
};
|
|
4145
|
+
class gr {
|
|
4146
|
+
resolve(e) {
|
|
4147
|
+
if ("shift" in e)
|
|
4148
|
+
return this.createShiftBaseMatrix(e.shift);
|
|
4149
|
+
if ("scale" in e) {
|
|
4150
|
+
const t = e.origin ?? { x: 0, y: 0 };
|
|
4151
|
+
return this.createScaleRelativeMatrix(e.scale, t);
|
|
4152
|
+
}
|
|
4153
|
+
if ("rotate" in e) {
|
|
4154
|
+
const t = e.origin ?? { x: 0, y: 0 };
|
|
4155
|
+
return this.createRotateRelativeMatrix(e.rotate, t);
|
|
4156
|
+
}
|
|
4157
|
+
if ("mirror" in e) {
|
|
4158
|
+
const t = e.origin ?? { x: 0, y: 0 };
|
|
4159
|
+
return this.createMirrorRelativeMatrix(e.mirror, t);
|
|
4160
|
+
}
|
|
4161
|
+
return {
|
|
4162
|
+
a: e.a ?? 1,
|
|
4163
|
+
b: e.b ?? 0,
|
|
4164
|
+
c: e.c ?? 0,
|
|
4165
|
+
d: e.d ?? 0,
|
|
4166
|
+
e: e.e ?? 1,
|
|
4167
|
+
f: e.f ?? 0
|
|
4168
|
+
};
|
|
4169
|
+
}
|
|
4170
|
+
createScaleRelativeMatrix(e, t) {
|
|
4171
|
+
const s = this.createScaleBaseMatrix(e), o = this.createShiftBaseMatrix(t);
|
|
4172
|
+
return this.createRelativeTransform(s, o);
|
|
4173
|
+
}
|
|
4174
|
+
createRotateRelativeMatrix(e, t) {
|
|
4175
|
+
const s = this.createRotateBaseMatrix(e), o = this.createShiftBaseMatrix(t);
|
|
4176
|
+
return this.createRelativeTransform(s, o);
|
|
4177
|
+
}
|
|
4178
|
+
createMirrorRelativeMatrix(e, t) {
|
|
4179
|
+
const s = this.createMirrorYBaseMatrix(), o = $(
|
|
4180
|
+
this.createShiftBaseMatrix(t),
|
|
4181
|
+
this.createRotateBaseMatrix(e)
|
|
4182
|
+
);
|
|
4183
|
+
return this.createRelativeTransform(s, o);
|
|
4184
|
+
}
|
|
4185
|
+
createRelativeTransform(e, t) {
|
|
4186
|
+
const s = $(
|
|
4187
|
+
t,
|
|
4188
|
+
e
|
|
4189
|
+
), o = lr(t);
|
|
4190
|
+
return $(s, o);
|
|
4191
|
+
}
|
|
4192
|
+
createShiftBaseMatrix(e) {
|
|
4193
|
+
return {
|
|
4194
|
+
a: 1,
|
|
4195
|
+
b: 0,
|
|
4196
|
+
c: e.x,
|
|
4197
|
+
d: 0,
|
|
4198
|
+
e: 1,
|
|
4199
|
+
f: e.y
|
|
4200
|
+
};
|
|
4201
|
+
}
|
|
4202
|
+
createScaleBaseMatrix(e) {
|
|
4203
|
+
return {
|
|
4204
|
+
a: e,
|
|
4205
|
+
b: 0,
|
|
4206
|
+
c: 0,
|
|
4207
|
+
d: 0,
|
|
4208
|
+
e,
|
|
4209
|
+
f: 0
|
|
4210
|
+
};
|
|
4211
|
+
}
|
|
4212
|
+
createRotateBaseMatrix(e) {
|
|
4213
|
+
const t = Math.sin(e), s = Math.cos(e);
|
|
4214
|
+
return {
|
|
4215
|
+
a: s,
|
|
4216
|
+
b: -t,
|
|
4217
|
+
c: 0,
|
|
4218
|
+
d: t,
|
|
4219
|
+
e: s,
|
|
4220
|
+
f: 0
|
|
4221
|
+
};
|
|
4222
|
+
}
|
|
4223
|
+
createMirrorYBaseMatrix() {
|
|
4224
|
+
return {
|
|
4225
|
+
a: 1,
|
|
4226
|
+
b: 0,
|
|
4227
|
+
c: 0,
|
|
4228
|
+
d: 0,
|
|
4229
|
+
e: -1,
|
|
4230
|
+
f: 0
|
|
4231
|
+
};
|
|
4232
|
+
}
|
|
4233
|
+
}
|
|
4234
|
+
const ur = (r) => {
|
|
4235
|
+
if (r === void 0)
|
|
4236
|
+
return (o) => o;
|
|
4237
|
+
if (typeof r == "function")
|
|
4238
|
+
return r;
|
|
4239
|
+
const e = Array.isArray(r) ? r : [r];
|
|
4240
|
+
let t = {
|
|
4241
|
+
a: 1,
|
|
4242
|
+
b: 0,
|
|
4243
|
+
c: 0,
|
|
4244
|
+
d: 0,
|
|
4245
|
+
e: 1,
|
|
4246
|
+
f: 0
|
|
4247
|
+
};
|
|
4248
|
+
const s = new gr();
|
|
4249
|
+
return e.forEach((o) => {
|
|
4250
|
+
const n = s.resolve(o);
|
|
4251
|
+
t = $(t, n);
|
|
4252
|
+
}), (o) => {
|
|
4253
|
+
const { x: n, y: a } = o;
|
|
4254
|
+
return {
|
|
4255
|
+
x: t.a * n + t.b * a + t.c,
|
|
4256
|
+
y: t.d * n + t.e * a + t.f
|
|
4257
|
+
};
|
|
4258
|
+
};
|
|
4259
|
+
}, pr = (r) => {
|
|
4087
4260
|
var e, t;
|
|
4088
4261
|
switch (r == null ? void 0 : r.type) {
|
|
4089
4262
|
case "custom":
|
|
4090
4263
|
return r.instance;
|
|
4091
4264
|
case "hierarchical":
|
|
4092
|
-
return new
|
|
4265
|
+
return new nr({
|
|
4093
4266
|
layerWidth: r.layerWidth ?? F.hierarchicalLayout.layerWidth,
|
|
4094
|
-
layerSpace: r.layerSpace ?? F.hierarchicalLayout.layerSpace
|
|
4267
|
+
layerSpace: r.layerSpace ?? F.hierarchicalLayout.layerSpace,
|
|
4268
|
+
transform: ur(r.transform)
|
|
4095
4269
|
});
|
|
4096
4270
|
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) ??
|
|
4271
|
+
const s = je((r == null ? void 0 : r.seed) ?? A.seed), o = qe(s[0], s[1], s[2], s[3]);
|
|
4272
|
+
return new rr({
|
|
4273
|
+
dtSec: (r == null ? void 0 : r.dtSec) ?? A.dtSec,
|
|
4274
|
+
maxIterations: (r == null ? void 0 : r.maxIterations) ?? A.maxIterations,
|
|
4275
|
+
rand: o,
|
|
4276
|
+
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? A.nodeCharge,
|
|
4277
|
+
nodeMass: (r == null ? void 0 : r.nodeMass) ?? A.nodeMass,
|
|
4278
|
+
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? A.edgeEquilibriumLength,
|
|
4279
|
+
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? A.edgeStiffness,
|
|
4280
|
+
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? A.convergenceVelocity,
|
|
4281
|
+
maxForce: (r == null ? void 0 : r.maxForce) ?? A.maxForce,
|
|
4282
|
+
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? A.nodeForceCoefficient,
|
|
4283
|
+
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? A.barnesHutTheta,
|
|
4284
|
+
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? A.barnesHutAreaRadiusThreshold
|
|
4111
4285
|
});
|
|
4112
4286
|
}
|
|
4113
4287
|
}
|
|
4114
|
-
},
|
|
4288
|
+
}, wr = (r) => {
|
|
4115
4289
|
var e, t;
|
|
4116
4290
|
return {
|
|
4117
|
-
algorithm:
|
|
4118
|
-
applyOn:
|
|
4119
|
-
staticNodeResolver:
|
|
4120
|
-
onBeforeApplied: ((e = r
|
|
4121
|
-
onAfterApplied: ((t = r
|
|
4291
|
+
algorithm: pr(r.algorithm),
|
|
4292
|
+
applyOn: cr(r.applyOn),
|
|
4293
|
+
staticNodeResolver: r.staticNodeResolver ?? F.staticNodeResolver,
|
|
4294
|
+
onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ?? F.onBeforeApplied,
|
|
4295
|
+
onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ?? F.onAfterApplied
|
|
4122
4296
|
};
|
|
4123
|
-
},
|
|
4297
|
+
}, fr = (r, e) => ({
|
|
4124
4298
|
...r,
|
|
4125
4299
|
onNodeDragStarted: (t) => {
|
|
4126
4300
|
e.add(t), r.onNodeDragStarted(t);
|
|
@@ -4128,222 +4302,236 @@ const ze = (r) => {
|
|
|
4128
4302
|
onNodeDragFinished: (t) => {
|
|
4129
4303
|
e.delete(t), r.onNodeDragFinished(t);
|
|
4130
4304
|
}
|
|
4131
|
-
}),
|
|
4305
|
+
}), yr = (r, e) => {
|
|
4132
4306
|
r.onBeforeNodeRemoved.subscribe((t) => {
|
|
4133
4307
|
e.delete(t);
|
|
4134
4308
|
}), r.onBeforeClear.subscribe(() => {
|
|
4135
4309
|
e.clear();
|
|
4136
4310
|
});
|
|
4137
|
-
},
|
|
4311
|
+
}, mr = (r, e) => ({
|
|
4138
4312
|
...r,
|
|
4139
4313
|
staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
|
|
4140
|
-
})
|
|
4141
|
-
|
|
4314
|
+
}), q = (r) => () => r, xe = q(0), vr = () => {
|
|
4315
|
+
let r = 0;
|
|
4316
|
+
return () => r++;
|
|
4317
|
+
}, Ar = (r, e) => {
|
|
4318
|
+
let t = xe, s = xe;
|
|
4319
|
+
const o = vr();
|
|
4320
|
+
return r === "incremental" && (t = o), e === "incremental" && (s = o), typeof r == "number" && (t = q(r)), typeof e == "number" && (s = q(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
|
|
4321
|
+
nodesPriorityFn: t,
|
|
4322
|
+
edgesPriorityFn: s
|
|
4323
|
+
};
|
|
4324
|
+
}, xr = (r) => {
|
|
4325
|
+
var t, s, o, n, a;
|
|
4326
|
+
const e = Ar(
|
|
4327
|
+
(t = r.nodes) == null ? void 0 : t.priority,
|
|
4328
|
+
(s = r.edges) == null ? void 0 : s.priority
|
|
4329
|
+
);
|
|
4330
|
+
return {
|
|
4331
|
+
nodes: {
|
|
4332
|
+
centerFn: ((o = r.nodes) == null ? void 0 : o.centerFn) ?? Ne,
|
|
4333
|
+
priorityFn: e.nodesPriorityFn
|
|
4334
|
+
},
|
|
4335
|
+
ports: {
|
|
4336
|
+
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
4337
|
+
},
|
|
4338
|
+
edges: {
|
|
4339
|
+
shapeFactory: he(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
|
|
4340
|
+
priorityFn: e.edgesPriorityFn
|
|
4341
|
+
}
|
|
4342
|
+
};
|
|
4343
|
+
}, Er = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : _, Sr = (r) => {
|
|
4344
|
+
var s, o;
|
|
4345
|
+
const { canvasDefaults: e } = r, t = r.hasLayout ? Er(r.layoutParams) : _;
|
|
4346
|
+
return {
|
|
4347
|
+
focus: {
|
|
4348
|
+
contentOffset: ((s = e.focus) == null ? void 0 : s.contentOffset) ?? 100,
|
|
4349
|
+
minContentScale: ((o = e.focus) == null ? void 0 : o.minContentScale) ?? 0,
|
|
4350
|
+
schedule: t
|
|
4351
|
+
}
|
|
4352
|
+
};
|
|
4353
|
+
};
|
|
4354
|
+
class Cr {
|
|
4142
4355
|
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
|
|
4169
|
-
}
|
|
4170
|
-
/**
|
|
4171
|
-
* specifies default values for graph entities
|
|
4172
|
-
*/
|
|
4356
|
+
i(this, "used", !1);
|
|
4357
|
+
i(this, "canvasDefaults", {});
|
|
4358
|
+
i(this, "dragConfig", {});
|
|
4359
|
+
i(this, "transformConfig", {});
|
|
4360
|
+
i(this, "backgroundConfig", {});
|
|
4361
|
+
i(this, "connectablePortsConfig", {});
|
|
4362
|
+
i(this, "draggableEdgesConfig", {});
|
|
4363
|
+
i(this, "virtualScrollConfig");
|
|
4364
|
+
i(this, "layoutConfig", {});
|
|
4365
|
+
i(this, "animatedLayoutConfig", {});
|
|
4366
|
+
i(this, "hasDraggableNodes", !1);
|
|
4367
|
+
i(this, "hasTransformableViewport", !1);
|
|
4368
|
+
i(this, "hasNodeResizeReactiveEdges", !1);
|
|
4369
|
+
i(this, "hasBackground", !1);
|
|
4370
|
+
i(this, "hasUserConnectablePorts", !1);
|
|
4371
|
+
i(this, "hasUserDraggableEdges", !1);
|
|
4372
|
+
i(this, "hasAnimatedLayout", !1);
|
|
4373
|
+
i(this, "hasLayout", !1);
|
|
4374
|
+
i(this, "boxRenderingTrigger", new K());
|
|
4375
|
+
i(this, "graphStore");
|
|
4376
|
+
i(this, "viewportStore");
|
|
4377
|
+
i(this, "graph");
|
|
4378
|
+
i(this, "viewport");
|
|
4379
|
+
i(this, "window", window);
|
|
4380
|
+
i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
4381
|
+
this.element = e, this.viewportStore = new ot(this.element), this.viewport = new $e(this.viewportStore), this.graphStore = new be(), this.graph = new Ie(this.graphStore);
|
|
4382
|
+
}
|
|
4173
4383
|
setDefaults(e) {
|
|
4174
4384
|
return this.canvasDefaults = e, this;
|
|
4175
4385
|
}
|
|
4176
|
-
/**
|
|
4177
|
-
* enables nodes draggable by user
|
|
4178
|
-
*/
|
|
4179
4386
|
enableUserDraggableNodes(e) {
|
|
4180
4387
|
return this.hasDraggableNodes = !0, this.dragConfig = e ?? {}, this;
|
|
4181
4388
|
}
|
|
4182
|
-
/**
|
|
4183
|
-
* enables viewport transformable by user
|
|
4184
|
-
*/
|
|
4185
4389
|
enableUserTransformableViewport(e) {
|
|
4186
4390
|
return this.hasTransformableViewport = !0, this.transformConfig = e ?? {}, this;
|
|
4187
4391
|
}
|
|
4188
|
-
/**
|
|
4189
|
-
* enables automatic edges update on node resize
|
|
4190
|
-
*/
|
|
4191
4392
|
enableNodeResizeReactiveEdges() {
|
|
4192
4393
|
return this.hasNodeResizeReactiveEdges = !0, this;
|
|
4193
4394
|
}
|
|
4194
|
-
/**
|
|
4195
|
-
* enables built-in virtual scroll behavior, when only nodes and edges close
|
|
4196
|
-
* to viewport are rendered
|
|
4197
|
-
*/
|
|
4198
4395
|
enableVirtualScroll(e) {
|
|
4199
4396
|
return this.virtualScrollConfig = e, this;
|
|
4200
4397
|
}
|
|
4201
|
-
/**
|
|
4202
|
-
* enables built-in background rendering
|
|
4203
|
-
*/
|
|
4204
4398
|
enableBackground(e) {
|
|
4205
4399
|
return this.hasBackground = !0, this.backgroundConfig = e ?? {}, this;
|
|
4206
4400
|
}
|
|
4207
|
-
/**
|
|
4208
|
-
* enables edge creation by dragging one port to another
|
|
4209
|
-
*/
|
|
4210
4401
|
enableUserConnectablePorts(e) {
|
|
4211
4402
|
return this.hasUserConnectablePorts = !0, this.connectablePortsConfig = e ?? {}, this;
|
|
4212
4403
|
}
|
|
4213
|
-
/**
|
|
4214
|
-
* enables edges dragging by dragging one of the adjacent ports
|
|
4215
|
-
*/
|
|
4216
4404
|
enableUserDraggableEdges(e) {
|
|
4217
4405
|
return this.hasUserDraggableEdges = !0, this.draggableEdgesConfig = e ?? {}, this;
|
|
4218
4406
|
}
|
|
4219
|
-
/**
|
|
4220
|
-
* enables nodes positioning with specified layout
|
|
4221
|
-
*/
|
|
4222
4407
|
enableLayout(e) {
|
|
4223
4408
|
return this.layoutConfig = e ?? {}, this.hasLayout = !0, this.hasAnimatedLayout = !1, this;
|
|
4224
4409
|
}
|
|
4225
|
-
/**
|
|
4226
|
-
* enables animated nodes positioning with specified layout
|
|
4227
|
-
*/
|
|
4228
4410
|
enableAnimatedLayout(e) {
|
|
4229
4411
|
return this.animatedLayoutConfig = e ?? {}, this.hasAnimatedLayout = !0, this.hasLayout = !1, this;
|
|
4230
4412
|
}
|
|
4231
|
-
/**
|
|
4232
|
-
* builds final canvas
|
|
4233
|
-
*/
|
|
4234
4413
|
build() {
|
|
4235
4414
|
if (this.used)
|
|
4236
|
-
throw new
|
|
4415
|
+
throw new Zt("CanvasBuilder is a single use object");
|
|
4237
4416
|
this.used = !0;
|
|
4238
|
-
const e = new
|
|
4239
|
-
this.
|
|
4240
|
-
|
|
4417
|
+
const e = new Ot(this.element), t = this.createHtmlView(e.main), s = xr(
|
|
4418
|
+
this.canvasDefaults
|
|
4419
|
+
), o = new Be(
|
|
4241
4420
|
this.graphStore,
|
|
4242
|
-
this.viewportStore,
|
|
4243
4421
|
t,
|
|
4244
4422
|
s
|
|
4423
|
+
), n = wr(this.layoutConfig), a = Sr({
|
|
4424
|
+
canvasDefaults: this.canvasDefaults,
|
|
4425
|
+
hasLayout: this.hasLayout,
|
|
4426
|
+
layoutParams: n
|
|
4427
|
+
}), h = new We(
|
|
4428
|
+
this.graphStore,
|
|
4429
|
+
this.viewportStore,
|
|
4430
|
+
a
|
|
4431
|
+
), d = new Se(
|
|
4432
|
+
this.graph,
|
|
4433
|
+
this.viewport,
|
|
4434
|
+
o,
|
|
4435
|
+
h
|
|
4245
4436
|
);
|
|
4246
|
-
if (this.hasBackground &&
|
|
4247
|
-
|
|
4248
|
-
|
|
4437
|
+
if (this.hasBackground && re.configure(
|
|
4438
|
+
d,
|
|
4439
|
+
Gt(this.backgroundConfig),
|
|
4249
4440
|
e.background
|
|
4250
|
-
), this.hasNodeResizeReactiveEdges && Q.configure(
|
|
4251
|
-
let
|
|
4252
|
-
this.hasAnimatedLayout && (
|
|
4253
|
-
|
|
4441
|
+
), this.hasNodeResizeReactiveEdges && Q.configure(d), this.hasDraggableNodes) {
|
|
4442
|
+
let g = Wt(this.dragConfig);
|
|
4443
|
+
this.hasAnimatedLayout && (g = fr(
|
|
4444
|
+
g,
|
|
4254
4445
|
this.animationStaticNodes
|
|
4255
|
-
)),
|
|
4256
|
-
|
|
4446
|
+
)), ee.configure(
|
|
4447
|
+
d,
|
|
4257
4448
|
e.main,
|
|
4258
4449
|
this.window,
|
|
4259
|
-
|
|
4450
|
+
g
|
|
4260
4451
|
);
|
|
4261
4452
|
}
|
|
4262
4453
|
if (this.hasUserConnectablePorts) {
|
|
4263
|
-
const
|
|
4454
|
+
const g = jt(
|
|
4264
4455
|
this.connectablePortsConfig,
|
|
4265
4456
|
s.edges.shapeFactory,
|
|
4266
4457
|
s.ports.direction
|
|
4267
4458
|
);
|
|
4268
|
-
|
|
4269
|
-
|
|
4459
|
+
se.configure(
|
|
4460
|
+
d,
|
|
4270
4461
|
e.overlayConnectablePorts,
|
|
4271
4462
|
this.viewportStore,
|
|
4272
4463
|
this.window,
|
|
4273
|
-
|
|
4464
|
+
g
|
|
4274
4465
|
);
|
|
4275
4466
|
}
|
|
4276
4467
|
if (this.hasUserDraggableEdges) {
|
|
4277
|
-
const
|
|
4468
|
+
const g = qt(
|
|
4278
4469
|
this.draggableEdgesConfig,
|
|
4279
|
-
|
|
4470
|
+
d.graph
|
|
4280
4471
|
);
|
|
4281
|
-
|
|
4282
|
-
|
|
4472
|
+
oe.configure(
|
|
4473
|
+
d,
|
|
4283
4474
|
e.overlayDraggableEdges,
|
|
4284
4475
|
this.viewportStore,
|
|
4285
4476
|
this.window,
|
|
4286
|
-
|
|
4477
|
+
g
|
|
4287
4478
|
);
|
|
4288
4479
|
}
|
|
4289
|
-
if (this.virtualScrollConfig !== void 0 ?
|
|
4290
|
-
|
|
4480
|
+
if (this.virtualScrollConfig !== void 0 ? te.configure(
|
|
4481
|
+
d,
|
|
4291
4482
|
e.main,
|
|
4292
4483
|
this.window,
|
|
4293
|
-
|
|
4484
|
+
Ae(this.transformConfig),
|
|
4294
4485
|
this.boxRenderingTrigger,
|
|
4295
|
-
|
|
4296
|
-
) : this.hasTransformableViewport &&
|
|
4297
|
-
|
|
4486
|
+
Kt(this.virtualScrollConfig)
|
|
4487
|
+
) : this.hasTransformableViewport && Y.configure(
|
|
4488
|
+
d,
|
|
4298
4489
|
e.main,
|
|
4299
4490
|
this.window,
|
|
4300
|
-
|
|
4301
|
-
), this.hasLayout &&
|
|
4302
|
-
|
|
4303
|
-
hr(this.layoutConfig)
|
|
4304
|
-
), this.hasAnimatedLayout) {
|
|
4305
|
-
let a = ir(
|
|
4491
|
+
Ae(this.transformConfig)
|
|
4492
|
+
), this.hasLayout && Bt.configure(d, n), this.hasAnimatedLayout) {
|
|
4493
|
+
let g = dr(
|
|
4306
4494
|
this.animatedLayoutConfig
|
|
4307
4495
|
);
|
|
4308
|
-
this.hasDraggableNodes && (
|
|
4309
|
-
|
|
4496
|
+
this.hasDraggableNodes && (yr(
|
|
4497
|
+
d.graph,
|
|
4310
4498
|
this.animationStaticNodes
|
|
4311
|
-
),
|
|
4312
|
-
|
|
4499
|
+
), g = mr(
|
|
4500
|
+
g,
|
|
4313
4501
|
this.animationStaticNodes
|
|
4314
|
-
)),
|
|
4502
|
+
)), ae.configure(d, g, this.window);
|
|
4315
4503
|
}
|
|
4316
|
-
const
|
|
4317
|
-
e.destroy(),
|
|
4504
|
+
const c = () => {
|
|
4505
|
+
e.destroy(), d.onBeforeDestroy.unsubscribe(c);
|
|
4318
4506
|
};
|
|
4319
|
-
return
|
|
4507
|
+
return d.onBeforeDestroy.subscribe(c), d;
|
|
4320
4508
|
}
|
|
4321
4509
|
createHtmlView(e) {
|
|
4322
|
-
let t = new
|
|
4510
|
+
let t = new Ee(
|
|
4323
4511
|
this.graphStore,
|
|
4324
4512
|
this.viewportStore,
|
|
4325
4513
|
e
|
|
4326
4514
|
);
|
|
4327
|
-
return this.virtualScrollConfig !== void 0 && (t = new
|
|
4515
|
+
return this.virtualScrollConfig !== void 0 && (t = new tt(
|
|
4328
4516
|
t,
|
|
4329
4517
|
this.graphStore,
|
|
4330
4518
|
this.boxRenderingTrigger,
|
|
4331
|
-
|
|
4332
|
-
)), new
|
|
4519
|
+
Qt(this.virtualScrollConfig)
|
|
4520
|
+
)), t = new rt(t, this.graphStore), t;
|
|
4333
4521
|
}
|
|
4334
4522
|
}
|
|
4335
4523
|
export {
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4524
|
+
xt as BezierEdgeShape,
|
|
4525
|
+
Cr as CanvasBuilder,
|
|
4526
|
+
Zt as CanvasBuilderError,
|
|
4527
|
+
E as CanvasError,
|
|
4528
|
+
D as ConnectionCategory,
|
|
4529
|
+
Ve as DirectEdgeShape,
|
|
4342
4530
|
K as EventSubject,
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4531
|
+
Et as HorizontalEdgeShape,
|
|
4532
|
+
Nt as InteractiveEdgeError,
|
|
4533
|
+
Fe as InteractiveEdgeShape,
|
|
4534
|
+
Pr as MidpointEdgeShape,
|
|
4535
|
+
St as StraightEdgeShape,
|
|
4536
|
+
bt as VerticalEdgeShape
|
|
4349
4537
|
};
|