@html-graph/html-graph 6.0.0 → 7.0.1
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 +36 -5
- package/dist/html-graph.js +1195 -1024
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
const
|
|
1
|
+
var Be = Object.defineProperty;
|
|
2
|
+
var Fe = (r, e, t) => e in r ? Be(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var o = (r, e, t) => Fe(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
const D = (r, e) => ({
|
|
5
5
|
x: r.scale * e.x + r.x,
|
|
6
6
|
y: r.scale * e.y + r.y
|
|
7
7
|
});
|
|
8
|
-
var
|
|
9
|
-
const
|
|
8
|
+
var C = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(C || {});
|
|
9
|
+
const Oe = () => {
|
|
10
10
|
const r = document.createElement("div");
|
|
11
11
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
|
|
12
|
-
},
|
|
12
|
+
}, We = () => {
|
|
13
13
|
const r = document.createElement("div");
|
|
14
14
|
return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
|
|
15
|
-
},
|
|
15
|
+
}, ke = (r) => {
|
|
16
16
|
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
17
17
|
};
|
|
18
|
-
class
|
|
19
|
-
constructor(e, t,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
class me {
|
|
19
|
+
constructor(e, t, s) {
|
|
20
|
+
o(this, "host", Oe());
|
|
21
|
+
o(this, "container", We());
|
|
22
|
+
o(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
|
|
23
|
+
o(this, "attachedNodeIds", /* @__PURE__ */ new Set());
|
|
24
|
+
o(this, "applyTransform", () => {
|
|
25
25
|
const e = this.viewportStore.getContentMatrix();
|
|
26
26
|
this.container.style.transform = `matrix(${e.scale}, 0, 0, ${e.scale}, ${e.x}, ${e.y})`;
|
|
27
27
|
});
|
|
28
|
-
this.graphStore = e, this.viewportStore = t, this.element =
|
|
28
|
+
this.graphStore = e, this.viewportStore = t, this.element = s, this.element.appendChild(this.host), this.host.appendChild(this.container), this.viewportStore.onAfterUpdated.subscribe(this.applyTransform);
|
|
29
29
|
}
|
|
30
30
|
attachNode(e) {
|
|
31
31
|
const t = this.graphStore.getNode(e);
|
|
32
|
-
|
|
32
|
+
ke(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
|
|
33
33
|
}
|
|
34
34
|
detachNode(e) {
|
|
35
35
|
const t = this.graphStore.getNode(e);
|
|
@@ -54,7 +54,7 @@ class ye {
|
|
|
54
54
|
this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.element.removeChild(this.host), this.host.removeChild(this.container);
|
|
55
55
|
}
|
|
56
56
|
updateNodePosition(e) {
|
|
57
|
-
const t = this.graphStore.getNode(e), { width:
|
|
57
|
+
const t = this.graphStore.getNode(e), { width: s, height: i } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, { payload: a } = t, h = a.centerFn(s, i), d = a.x - n * h.x, c = a.y - n * h.y;
|
|
58
58
|
t.element.style.transform = `translate(${d}px, ${c}px)`;
|
|
59
59
|
}
|
|
60
60
|
updateNodePriority(e) {
|
|
@@ -68,29 +68,29 @@ class ye {
|
|
|
68
68
|
this.edgeIdToElementMap.set(e, i), this.container.appendChild(i);
|
|
69
69
|
}
|
|
70
70
|
renderEdge(e) {
|
|
71
|
-
const t = this.graphStore.getEdge(e),
|
|
72
|
-
|
|
71
|
+
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), i = this.graphStore.getPort(t.to), n = s.element.getBoundingClientRect(), a = i.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix(), c = this.createEdgeRenderPort(
|
|
72
|
+
s,
|
|
73
73
|
n,
|
|
74
74
|
h,
|
|
75
75
|
d
|
|
76
|
-
),
|
|
76
|
+
), g = this.createEdgeRenderPort(
|
|
77
77
|
i,
|
|
78
78
|
a,
|
|
79
79
|
h,
|
|
80
80
|
d
|
|
81
81
|
);
|
|
82
|
-
let
|
|
83
|
-
|
|
82
|
+
let l = C.Line;
|
|
83
|
+
s.element === i.element ? l = C.PortCycle : s.nodeId === i.nodeId && (l = C.NodeCycle), t.payload.shape.render({ from: c, to: g, category: l });
|
|
84
84
|
}
|
|
85
85
|
updateEdgePriority(e) {
|
|
86
86
|
const t = this.graphStore.getEdge(e);
|
|
87
87
|
t.payload.shape.svg.style.zIndex = `${t.payload.priority}`;
|
|
88
88
|
}
|
|
89
|
-
createEdgeRenderPort(e, t,
|
|
89
|
+
createEdgeRenderPort(e, t, s, i) {
|
|
90
90
|
const n = {
|
|
91
|
-
x: t.left -
|
|
92
|
-
y: t.top -
|
|
93
|
-
}, a =
|
|
91
|
+
x: t.left - s.left,
|
|
92
|
+
y: t.top - s.top
|
|
93
|
+
}, a = D(i, n);
|
|
94
94
|
return {
|
|
95
95
|
x: a.x,
|
|
96
96
|
y: a.y,
|
|
@@ -100,43 +100,43 @@ class ye {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
class
|
|
103
|
+
class ze {
|
|
104
104
|
constructor(e) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
o(this, "xFrom", 1 / 0);
|
|
106
|
+
o(this, "yFrom", 1 / 0);
|
|
107
|
+
o(this, "xTo", 1 / 0);
|
|
108
|
+
o(this, "yTo", 1 / 0);
|
|
109
109
|
this.graphStore = e;
|
|
110
110
|
}
|
|
111
111
|
setRenderingBox(e) {
|
|
112
112
|
this.xFrom = e.x, this.xTo = e.x + e.width, this.yFrom = e.y, this.yTo = e.y + e.height;
|
|
113
113
|
}
|
|
114
114
|
hasNode(e) {
|
|
115
|
-
const t = this.graphStore.getNode(e).payload, { x:
|
|
116
|
-
return
|
|
115
|
+
const t = this.graphStore.getNode(e).payload, { x: s, y: i } = t;
|
|
116
|
+
return s >= this.xFrom && s <= this.xTo && i >= this.yFrom && i <= this.yTo;
|
|
117
117
|
}
|
|
118
118
|
hasEdge(e) {
|
|
119
|
-
const t = this.graphStore.getEdge(e),
|
|
120
|
-
return h <= this.xTo && d >= this.xFrom && c <= this.yTo &&
|
|
119
|
+
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, i = this.graphStore.getPort(t.to).nodeId, n = this.graphStore.getNode(s).payload, a = this.graphStore.getNode(i).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);
|
|
120
|
+
return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
class
|
|
124
|
-
constructor(e, t,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
class Xe {
|
|
124
|
+
constructor(e, t, s, i) {
|
|
125
|
+
o(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
126
|
+
o(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
127
|
+
o(this, "renderingBox");
|
|
128
|
+
o(this, "updateViewport", (e) => {
|
|
129
129
|
this.renderingBox.setRenderingBox(e);
|
|
130
|
-
const t = /* @__PURE__ */ new Set(),
|
|
130
|
+
const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
131
131
|
this.graphStore.getAllNodeIds().forEach((a) => {
|
|
132
132
|
const h = this.renderingBox.hasNode(a), d = this.attachedNodes.has(a);
|
|
133
|
-
h && !d ? t.add(a) : !h && d &&
|
|
133
|
+
h && !d ? t.add(a) : !h && d && s.add(a);
|
|
134
134
|
}), this.graphStore.getAllEdgeIds().forEach((a) => {
|
|
135
|
-
const h = this.renderingBox.hasEdge(a), d = this.attachedEdges.has(a), c = this.graphStore.getEdge(a),
|
|
136
|
-
h && (this.renderingBox.hasNode(
|
|
135
|
+
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;
|
|
136
|
+
h && (this.renderingBox.hasNode(g) || (t.add(g), s.delete(g)), this.renderingBox.hasNode(l) || (t.add(l), s.delete(l))), h && !d ? i.add(a) : !h && d && n.add(a);
|
|
137
137
|
}), n.forEach((a) => {
|
|
138
138
|
this.handleDetachEdge(a);
|
|
139
|
-
}),
|
|
139
|
+
}), s.forEach((a) => {
|
|
140
140
|
this.handleDetachNode(a);
|
|
141
141
|
}), t.forEach((a) => {
|
|
142
142
|
this.attachedNodes.has(a) || this.handleAttachNode(a);
|
|
@@ -144,7 +144,7 @@ class Oe {
|
|
|
144
144
|
this.handleAttachEdge(a);
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
|
-
this.htmlView = e, this.graphStore = t, this.trigger =
|
|
147
|
+
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = i, this.renderingBox = new ze(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
148
148
|
}
|
|
149
149
|
attachNode(e) {
|
|
150
150
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -182,8 +182,8 @@ class Oe {
|
|
|
182
182
|
this.clear(), this.htmlView.destroy(), this.trigger.unsubscribe(this.updateViewport);
|
|
183
183
|
}
|
|
184
184
|
attachEdgeEntities(e) {
|
|
185
|
-
const t = this.graphStore.getEdge(e),
|
|
186
|
-
this.attachedNodes.has(
|
|
185
|
+
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from).nodeId, i = this.graphStore.getPort(t.to).nodeId;
|
|
186
|
+
this.attachedNodes.has(s) || this.handleAttachNode(s), this.attachedNodes.has(i) || this.handleAttachNode(i), this.handleAttachEdge(e);
|
|
187
187
|
}
|
|
188
188
|
handleAttachNode(e) {
|
|
189
189
|
this.params.onBeforeNodeAttached(e), this.attachedNodes.add(e), this.htmlView.attachNode(e);
|
|
@@ -198,10 +198,10 @@ class Oe {
|
|
|
198
198
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
class
|
|
201
|
+
class Ye {
|
|
202
202
|
constructor(e, t) {
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
o(this, "deferredNodes", /* @__PURE__ */ new Set());
|
|
204
|
+
o(this, "deferredEdges", /* @__PURE__ */ new Set());
|
|
205
205
|
this.htmlView = e, this.graphStore = t;
|
|
206
206
|
}
|
|
207
207
|
attachNode(e) {
|
|
@@ -245,16 +245,16 @@ class Fe {
|
|
|
245
245
|
this.isNodeValid(e) && (this.deferredNodes.delete(e), this.htmlView.attachNode(e));
|
|
246
246
|
}
|
|
247
247
|
isEdgeValid(e) {
|
|
248
|
-
const t = this.graphStore.getEdge(e),
|
|
249
|
-
return !(this.deferredNodes.has(
|
|
248
|
+
const t = this.graphStore.getEdge(e), s = this.graphStore.getPort(t.from), i = this.graphStore.getPort(t.to);
|
|
249
|
+
return !(this.deferredNodes.has(s.nodeId) || this.deferredNodes.has(i.nodeId));
|
|
250
250
|
}
|
|
251
251
|
tryAttachEdge(e) {
|
|
252
252
|
this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
class
|
|
255
|
+
class G {
|
|
256
256
|
constructor() {
|
|
257
|
-
|
|
257
|
+
o(this, "callbacks", /* @__PURE__ */ new Set());
|
|
258
258
|
}
|
|
259
259
|
subscribe(e) {
|
|
260
260
|
this.callbacks.add(e);
|
|
@@ -268,13 +268,13 @@ class j {
|
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
const
|
|
272
|
-
const r = new
|
|
271
|
+
const x = () => {
|
|
272
|
+
const r = new G();
|
|
273
273
|
return [r, r];
|
|
274
274
|
};
|
|
275
|
-
class
|
|
275
|
+
class Y {
|
|
276
276
|
constructor(e) {
|
|
277
|
-
|
|
277
|
+
o(this, "counter", 0);
|
|
278
278
|
this.checkExists = e;
|
|
279
279
|
}
|
|
280
280
|
create(e) {
|
|
@@ -288,80 +288,80 @@ class X {
|
|
|
288
288
|
this.counter = 0;
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
class
|
|
291
|
+
class P extends Error {
|
|
292
292
|
constructor() {
|
|
293
293
|
super(...arguments);
|
|
294
|
-
|
|
294
|
+
o(this, "name", "CanvasError");
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
|
-
class
|
|
298
|
-
constructor(e, t,
|
|
299
|
-
|
|
297
|
+
class ve {
|
|
298
|
+
constructor(e, t, s, i, n, a) {
|
|
299
|
+
o(this, "nodeIdGenerator", new Y(
|
|
300
300
|
(e) => this.graphStore.getNode(e) !== void 0
|
|
301
301
|
));
|
|
302
|
-
|
|
302
|
+
o(this, "portIdGenerator", new Y(
|
|
303
303
|
(e) => this.graphStore.getPort(e) !== void 0
|
|
304
304
|
));
|
|
305
|
-
|
|
305
|
+
o(this, "edgeIdGenerator", new Y(
|
|
306
306
|
(e) => this.graphStore.getEdge(e) !== void 0
|
|
307
307
|
));
|
|
308
|
-
|
|
308
|
+
o(this, "onAfterNodeAdded", (e) => {
|
|
309
309
|
this.htmlView.attachNode(e);
|
|
310
310
|
});
|
|
311
|
-
|
|
312
|
-
this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((
|
|
313
|
-
this.htmlView.renderEdge(
|
|
311
|
+
o(this, "onAfterNodeUpdated", (e) => {
|
|
312
|
+
this.htmlView.updateNodePosition(e), this.graphStore.getNodeAdjacentEdgeIds(e).forEach((s) => {
|
|
313
|
+
this.htmlView.renderEdge(s);
|
|
314
314
|
});
|
|
315
315
|
});
|
|
316
|
-
|
|
316
|
+
o(this, "onAfterNodePriorityUpdated", (e) => {
|
|
317
317
|
this.htmlView.updateNodePriority(e);
|
|
318
318
|
});
|
|
319
|
-
|
|
319
|
+
o(this, "onBeforeNodeRemoved", (e) => {
|
|
320
320
|
this.graphStore.getNodePortIds(e).forEach((t) => {
|
|
321
321
|
this.unmarkPort(t);
|
|
322
322
|
}), this.htmlView.detachNode(e);
|
|
323
323
|
});
|
|
324
|
-
|
|
325
|
-
this.graphStore.getPortAdjacentEdgeIds(e).forEach((
|
|
326
|
-
this.htmlView.renderEdge(
|
|
324
|
+
o(this, "onAfterPortUpdated", (e) => {
|
|
325
|
+
this.graphStore.getPortAdjacentEdgeIds(e).forEach((s) => {
|
|
326
|
+
this.htmlView.renderEdge(s);
|
|
327
327
|
});
|
|
328
328
|
});
|
|
329
|
-
|
|
329
|
+
o(this, "onBeforePortUnmarked", (e) => {
|
|
330
330
|
this.graphStore.getPortAdjacentEdgeIds(e).forEach((t) => {
|
|
331
331
|
this.removeEdge(t);
|
|
332
332
|
});
|
|
333
333
|
});
|
|
334
|
-
|
|
334
|
+
o(this, "onAfterEdgeAdded", (e) => {
|
|
335
335
|
this.htmlView.attachEdge(e);
|
|
336
336
|
});
|
|
337
|
-
|
|
337
|
+
o(this, "onAfterEdgeShapeUpdated", (e) => {
|
|
338
338
|
this.htmlView.updateEdgeShape(e);
|
|
339
339
|
});
|
|
340
|
-
|
|
340
|
+
o(this, "onAfterEdgeUpdated", (e) => {
|
|
341
341
|
this.htmlView.renderEdge(e);
|
|
342
342
|
});
|
|
343
|
-
|
|
343
|
+
o(this, "onAfterEdgePriorityUpdated", (e) => {
|
|
344
344
|
this.htmlView.updateEdgePriority(e);
|
|
345
345
|
});
|
|
346
|
-
|
|
346
|
+
o(this, "onBeforeEdgeRemoved", (e) => {
|
|
347
347
|
this.htmlView.detachEdge(e);
|
|
348
348
|
});
|
|
349
|
-
|
|
349
|
+
o(this, "onBeforeClear", () => {
|
|
350
350
|
this.nodeIdGenerator.reset(), this.portIdGenerator.reset(), this.edgeIdGenerator.reset(), this.htmlView.clear();
|
|
351
351
|
});
|
|
352
|
-
|
|
353
|
-
|
|
352
|
+
o(this, "onBeforeDestroyEmitter");
|
|
353
|
+
o(this, "destroyed", !1);
|
|
354
354
|
/**
|
|
355
355
|
* emits event just before destruction of canvas
|
|
356
356
|
*/
|
|
357
|
-
|
|
358
|
-
this.graph = e, this.viewport = t, this.graphStore =
|
|
357
|
+
o(this, "onBeforeDestroy");
|
|
358
|
+
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(
|
|
359
359
|
this.onAfterNodePriorityUpdated
|
|
360
360
|
), 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(
|
|
361
361
|
this.onAfterEdgeShapeUpdated
|
|
362
362
|
), this.graphStore.onAfterEdgeUpdated.subscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.subscribe(
|
|
363
363
|
this.onAfterEdgePriorityUpdated
|
|
364
|
-
), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] =
|
|
364
|
+
), this.graphStore.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.subscribe(this.onBeforeClear), [this.onBeforeDestroyEmitter, this.onBeforeDestroy] = x();
|
|
365
365
|
}
|
|
366
366
|
/**
|
|
367
367
|
* adds new node
|
|
@@ -369,9 +369,9 @@ class me {
|
|
|
369
369
|
addNode(e) {
|
|
370
370
|
const t = this.nodeIdGenerator.create(e.id);
|
|
371
371
|
if (this.graphStore.getNode(t) !== void 0)
|
|
372
|
-
throw new
|
|
372
|
+
throw new P("failed to add node with existing id");
|
|
373
373
|
if (this.graphStore.getElementNodeId(e.element) !== void 0)
|
|
374
|
-
throw new
|
|
374
|
+
throw new P(
|
|
375
375
|
"failed to add node with html element already in use by another node"
|
|
376
376
|
);
|
|
377
377
|
if (this.graphStore.addNode({
|
|
@@ -382,12 +382,12 @@ class me {
|
|
|
382
382
|
centerFn: e.centerFn ?? this.params.nodes.centerFn,
|
|
383
383
|
priority: e.priority ?? this.params.nodes.priorityFn()
|
|
384
384
|
}), e.ports !== void 0)
|
|
385
|
-
for (const
|
|
385
|
+
for (const s of e.ports)
|
|
386
386
|
this.markPort({
|
|
387
|
-
id:
|
|
388
|
-
element:
|
|
387
|
+
id: s.id,
|
|
388
|
+
element: s.element,
|
|
389
389
|
nodeId: t,
|
|
390
|
-
direction:
|
|
390
|
+
direction: s.direction
|
|
391
391
|
});
|
|
392
392
|
return this;
|
|
393
393
|
}
|
|
@@ -396,7 +396,7 @@ class me {
|
|
|
396
396
|
*/
|
|
397
397
|
updateNode(e, t) {
|
|
398
398
|
if (this.graphStore.getNode(e) === void 0)
|
|
399
|
-
throw new
|
|
399
|
+
throw new P("failed to update nonexistent node");
|
|
400
400
|
return this.graphStore.updateNode(e, t ?? {}), this;
|
|
401
401
|
}
|
|
402
402
|
/**
|
|
@@ -406,7 +406,7 @@ class me {
|
|
|
406
406
|
*/
|
|
407
407
|
removeNode(e) {
|
|
408
408
|
if (this.graphStore.getNode(e) === void 0)
|
|
409
|
-
throw new
|
|
409
|
+
throw new P("failed to remove nonexistent node");
|
|
410
410
|
return this.graphStore.removeNode(e), this;
|
|
411
411
|
}
|
|
412
412
|
/**
|
|
@@ -415,9 +415,9 @@ class me {
|
|
|
415
415
|
markPort(e) {
|
|
416
416
|
const t = this.portIdGenerator.create(e.id);
|
|
417
417
|
if (this.graphStore.getPort(t) !== void 0)
|
|
418
|
-
throw new
|
|
418
|
+
throw new P("failed to add port with existing id");
|
|
419
419
|
if (this.graphStore.getNode(e.nodeId) === void 0)
|
|
420
|
-
throw new
|
|
420
|
+
throw new P("failed to mark port for nonexistent node");
|
|
421
421
|
return this.graphStore.addPort({
|
|
422
422
|
id: t,
|
|
423
423
|
element: e.element,
|
|
@@ -430,7 +430,7 @@ class me {
|
|
|
430
430
|
*/
|
|
431
431
|
updatePort(e, t) {
|
|
432
432
|
if (this.graphStore.getPort(e) === void 0)
|
|
433
|
-
throw new
|
|
433
|
+
throw new P("failed to update nonexistent port");
|
|
434
434
|
return this.graphStore.updatePort(e, t ?? {}), this;
|
|
435
435
|
}
|
|
436
436
|
/**
|
|
@@ -439,7 +439,7 @@ class me {
|
|
|
439
439
|
*/
|
|
440
440
|
unmarkPort(e) {
|
|
441
441
|
if (this.graphStore.getPort(e) === void 0)
|
|
442
|
-
throw new
|
|
442
|
+
throw new P("failed to unmark nonexistent port");
|
|
443
443
|
return this.graphStore.removePort(e), this;
|
|
444
444
|
}
|
|
445
445
|
/**
|
|
@@ -448,11 +448,11 @@ class me {
|
|
|
448
448
|
addEdge(e) {
|
|
449
449
|
const t = this.edgeIdGenerator.create(e.id);
|
|
450
450
|
if (this.graphStore.getEdge(t) !== void 0)
|
|
451
|
-
throw new
|
|
451
|
+
throw new P("failed to add edge with existing id");
|
|
452
452
|
if (this.graphStore.getPort(e.from) === void 0)
|
|
453
|
-
throw new
|
|
453
|
+
throw new P("failed to add edge from nonexistent port");
|
|
454
454
|
if (this.graphStore.getPort(e.to) === void 0)
|
|
455
|
-
throw new
|
|
455
|
+
throw new P("failed to add edge to nonexistent port");
|
|
456
456
|
return this.graphStore.addEdge({
|
|
457
457
|
id: t,
|
|
458
458
|
from: e.from,
|
|
@@ -466,7 +466,7 @@ class me {
|
|
|
466
466
|
*/
|
|
467
467
|
updateEdge(e, t) {
|
|
468
468
|
if (this.graphStore.getEdge(e) === void 0)
|
|
469
|
-
throw new
|
|
469
|
+
throw new P("failed to update nonexistent edge");
|
|
470
470
|
return this.graphStore.updateEdge(e, t ?? {}), this;
|
|
471
471
|
}
|
|
472
472
|
/**
|
|
@@ -474,7 +474,7 @@ class me {
|
|
|
474
474
|
*/
|
|
475
475
|
removeEdge(e) {
|
|
476
476
|
if (this.graphStore.getEdge(e) === void 0)
|
|
477
|
-
throw new
|
|
477
|
+
throw new P("failed to remove nonexistent edge");
|
|
478
478
|
return this.graphStore.removeEdge(e), this;
|
|
479
479
|
}
|
|
480
480
|
/**
|
|
@@ -510,37 +510,37 @@ class me {
|
|
|
510
510
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy(), this.destroyed = !0);
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
class
|
|
513
|
+
class He {
|
|
514
514
|
constructor() {
|
|
515
|
-
|
|
516
|
-
|
|
515
|
+
o(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
516
|
+
o(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
517
517
|
}
|
|
518
518
|
addRecord(e, t) {
|
|
519
|
-
const
|
|
520
|
-
|
|
519
|
+
const s = this.singleToMultiMap.get(e);
|
|
520
|
+
s === void 0 ? this.singleToMultiMap.set(e, /* @__PURE__ */ new Set([t])) : s.add(t), this.multiToSingleMap.set(t, e);
|
|
521
521
|
}
|
|
522
522
|
getMultiBySingle(e) {
|
|
523
523
|
const t = this.singleToMultiMap.get(e) ?? /* @__PURE__ */ new Set();
|
|
524
524
|
return Array.from(t.values());
|
|
525
525
|
}
|
|
526
526
|
removeByMulti(e) {
|
|
527
|
-
const t = this.multiToSingleMap.get(e),
|
|
528
|
-
|
|
527
|
+
const t = this.multiToSingleMap.get(e), s = this.singleToMultiMap.get(t);
|
|
528
|
+
s.delete(e), s.size === 0 && this.singleToMultiMap.delete(t), this.multiToSingleMap.delete(e);
|
|
529
529
|
}
|
|
530
530
|
getByMulti(e) {
|
|
531
531
|
return this.multiToSingleMap.get(e);
|
|
532
532
|
}
|
|
533
533
|
removeBySingle(e) {
|
|
534
|
-
this.singleToMultiMap.get(e).forEach((
|
|
535
|
-
this.multiToSingleMap.delete(
|
|
534
|
+
this.singleToMultiMap.get(e).forEach((s) => {
|
|
535
|
+
this.multiToSingleMap.delete(s);
|
|
536
536
|
}), this.singleToMultiMap.delete(e);
|
|
537
537
|
}
|
|
538
538
|
clear() {
|
|
539
539
|
this.singleToMultiMap.clear(), this.multiToSingleMap.clear();
|
|
540
540
|
}
|
|
541
541
|
forEachSingle(e) {
|
|
542
|
-
this.singleToMultiMap.forEach((t,
|
|
543
|
-
e(
|
|
542
|
+
this.singleToMultiMap.forEach((t, s) => {
|
|
543
|
+
e(s);
|
|
544
544
|
});
|
|
545
545
|
}
|
|
546
546
|
hasSingle(e) {
|
|
@@ -550,46 +550,46 @@ class We {
|
|
|
550
550
|
return this.multiToSingleMap.get(e) !== void 0;
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
|
-
class
|
|
553
|
+
class Ee {
|
|
554
554
|
constructor() {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
[this.afterNodeAddedEmitter, this.onAfterNodeAdded] =
|
|
555
|
+
o(this, "nodes", /* @__PURE__ */ new Map());
|
|
556
|
+
o(this, "ports", /* @__PURE__ */ new Map());
|
|
557
|
+
o(this, "edges", /* @__PURE__ */ new Map());
|
|
558
|
+
o(this, "nodesElementsMap", /* @__PURE__ */ new Map());
|
|
559
|
+
o(this, "portIncomingEdges", /* @__PURE__ */ new Map());
|
|
560
|
+
o(this, "portOutcomingEdges", /* @__PURE__ */ new Map());
|
|
561
|
+
o(this, "portCycleEdges", /* @__PURE__ */ new Map());
|
|
562
|
+
o(this, "elementPorts", new He());
|
|
563
|
+
o(this, "afterNodeAddedEmitter");
|
|
564
|
+
o(this, "onAfterNodeAdded");
|
|
565
|
+
o(this, "afterNodeUpdatedEmitter");
|
|
566
|
+
o(this, "onAfterNodeUpdated");
|
|
567
|
+
o(this, "afterNodePriorityUpdatedEmitter");
|
|
568
|
+
o(this, "onAfterNodePriorityUpdated");
|
|
569
|
+
o(this, "beforeNodeRemovedEmitter");
|
|
570
|
+
o(this, "onBeforeNodeRemoved");
|
|
571
|
+
o(this, "afterPortAddedEmitter");
|
|
572
|
+
o(this, "onAfterPortAdded");
|
|
573
|
+
o(this, "afterPortUpdatedEmitter");
|
|
574
|
+
o(this, "onAfterPortUpdated");
|
|
575
|
+
o(this, "beforePortRemovedEmitter");
|
|
576
|
+
o(this, "onBeforePortRemoved");
|
|
577
|
+
o(this, "afterEdgeAddedEmitter");
|
|
578
|
+
o(this, "onAfterEdgeAdded");
|
|
579
|
+
o(this, "afterEdgeShapeUpdatedEmitter");
|
|
580
|
+
o(this, "onAfterEdgeShapeUpdated");
|
|
581
|
+
o(this, "afterEdgeUpdatedEmitter");
|
|
582
|
+
o(this, "onAfterEdgeUpdated");
|
|
583
|
+
o(this, "afterEdgePriorityUpdatedEmitter");
|
|
584
|
+
o(this, "onAfterEdgePriorityUpdated");
|
|
585
|
+
o(this, "beforeEdgeRemovedEmitter");
|
|
586
|
+
o(this, "onBeforeEdgeRemoved");
|
|
587
|
+
o(this, "beforeClearEmitter");
|
|
588
|
+
o(this, "onBeforeClear");
|
|
589
|
+
[this.afterNodeAddedEmitter, this.onAfterNodeAdded] = x(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = x(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = x(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = x(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = x(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = x(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = x(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = x(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = x(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = x(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = x(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = x(), [this.beforeClearEmitter, this.onBeforeClear] = x();
|
|
590
590
|
}
|
|
591
591
|
addNode(e) {
|
|
592
|
-
const t = /* @__PURE__ */ new Map(),
|
|
592
|
+
const t = /* @__PURE__ */ new Map(), s = {
|
|
593
593
|
element: e.element,
|
|
594
594
|
payload: {
|
|
595
595
|
x: e.x,
|
|
@@ -599,7 +599,7 @@ class ve {
|
|
|
599
599
|
},
|
|
600
600
|
ports: t
|
|
601
601
|
};
|
|
602
|
-
this.nodes.set(e.id,
|
|
602
|
+
this.nodes.set(e.id, s), this.nodesElementsMap.set(e.element, e.id), this.afterNodeAddedEmitter.emit(e.id);
|
|
603
603
|
}
|
|
604
604
|
getAllNodeIds() {
|
|
605
605
|
return Array.from(this.nodes.keys());
|
|
@@ -611,8 +611,8 @@ class ve {
|
|
|
611
611
|
return this.nodesElementsMap.get(e);
|
|
612
612
|
}
|
|
613
613
|
updateNode(e, t) {
|
|
614
|
-
const
|
|
615
|
-
|
|
614
|
+
const s = this.nodes.get(e).payload;
|
|
615
|
+
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);
|
|
616
616
|
}
|
|
617
617
|
removeNode(e) {
|
|
618
618
|
this.beforeNodeRemovedEmitter.emit(e);
|
|
@@ -632,8 +632,8 @@ class ve {
|
|
|
632
632
|
return this.ports.get(e);
|
|
633
633
|
}
|
|
634
634
|
updatePort(e, t) {
|
|
635
|
-
const
|
|
636
|
-
|
|
635
|
+
const s = this.ports.get(e).payload;
|
|
636
|
+
s.direction = t.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(e);
|
|
637
637
|
}
|
|
638
638
|
getAllPortIds() {
|
|
639
639
|
return Array.from(this.ports.keys());
|
|
@@ -664,8 +664,8 @@ class ve {
|
|
|
664
664
|
priority: n.priority
|
|
665
665
|
});
|
|
666
666
|
}
|
|
667
|
-
const
|
|
668
|
-
t.shape !== void 0 && (
|
|
667
|
+
const s = this.edges.get(e);
|
|
668
|
+
t.shape !== void 0 && (s.payload.shape = t.shape, this.afterEdgeShapeUpdatedEmitter.emit(e)), t.priority !== void 0 && (s.payload.priority = t.priority, this.afterEdgePriorityUpdatedEmitter.emit(e)), this.afterEdgeUpdatedEmitter.emit(e);
|
|
669
669
|
}
|
|
670
670
|
getAllEdgeIds() {
|
|
671
671
|
return Array.from(this.edges.keys());
|
|
@@ -696,51 +696,51 @@ class ve {
|
|
|
696
696
|
];
|
|
697
697
|
}
|
|
698
698
|
getNodeIncomingEdgeIds(e) {
|
|
699
|
-
const t = Array.from(this.nodes.get(e).ports.keys()),
|
|
699
|
+
const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
|
|
700
700
|
return t.forEach((i) => {
|
|
701
701
|
this.getPortIncomingEdgeIds(i).filter((n) => {
|
|
702
702
|
const a = this.getEdge(n);
|
|
703
703
|
return this.getPort(a.from).nodeId !== e;
|
|
704
704
|
}).forEach((n) => {
|
|
705
|
-
|
|
705
|
+
s.push(n);
|
|
706
706
|
});
|
|
707
|
-
}),
|
|
707
|
+
}), s;
|
|
708
708
|
}
|
|
709
709
|
getNodeOutgoingEdgeIds(e) {
|
|
710
|
-
const t = Array.from(this.nodes.get(e).ports.keys()),
|
|
710
|
+
const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
|
|
711
711
|
return t.forEach((i) => {
|
|
712
712
|
this.getPortOutgoingEdgeIds(i).filter((n) => {
|
|
713
713
|
const a = this.getEdge(n);
|
|
714
714
|
return this.getPort(a.to).nodeId !== e;
|
|
715
715
|
}).forEach((n) => {
|
|
716
|
-
|
|
716
|
+
s.push(n);
|
|
717
717
|
});
|
|
718
|
-
}),
|
|
718
|
+
}), s;
|
|
719
719
|
}
|
|
720
720
|
getNodeCycleEdgeIds(e) {
|
|
721
|
-
const t = Array.from(this.nodes.get(e).ports.keys()),
|
|
721
|
+
const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
|
|
722
722
|
return t.forEach((i) => {
|
|
723
723
|
this.getPortCycleEdgeIds(i).forEach((n) => {
|
|
724
|
-
|
|
724
|
+
s.push(n);
|
|
725
725
|
}), this.getPortIncomingEdgeIds(i).filter((n) => {
|
|
726
726
|
const a = this.getEdge(n);
|
|
727
727
|
return this.getPort(a.to).nodeId === e;
|
|
728
728
|
}).forEach((n) => {
|
|
729
|
-
|
|
729
|
+
s.push(n);
|
|
730
730
|
});
|
|
731
|
-
}),
|
|
731
|
+
}), s;
|
|
732
732
|
}
|
|
733
733
|
getNodeAdjacentEdgeIds(e) {
|
|
734
|
-
const t = Array.from(this.nodes.get(e).ports.keys()),
|
|
734
|
+
const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
|
|
735
735
|
return t.forEach((i) => {
|
|
736
736
|
this.getPortIncomingEdgeIds(i).forEach((n) => {
|
|
737
|
-
|
|
737
|
+
s.push(n);
|
|
738
738
|
}), this.getPortOutgoingEdgeIds(i).forEach((n) => {
|
|
739
|
-
|
|
739
|
+
s.push(n);
|
|
740
740
|
}), this.getPortCycleEdgeIds(i).forEach((n) => {
|
|
741
|
-
|
|
741
|
+
s.push(n);
|
|
742
742
|
});
|
|
743
|
-
}),
|
|
743
|
+
}), s;
|
|
744
744
|
}
|
|
745
745
|
addEdgeInternal(e) {
|
|
746
746
|
this.edges.set(e.id, {
|
|
@@ -753,26 +753,26 @@ class ve {
|
|
|
753
753
|
}), e.from !== e.to ? (this.portOutcomingEdges.get(e.from).add(e.id), this.portIncomingEdges.get(e.to).add(e.id)) : this.portCycleEdges.get(e.from).add(e.id);
|
|
754
754
|
}
|
|
755
755
|
removeEdgeInternal(e) {
|
|
756
|
-
const t = this.edges.get(e),
|
|
757
|
-
this.portCycleEdges.get(
|
|
756
|
+
const t = this.edges.get(e), s = t.from, i = t.to;
|
|
757
|
+
this.portCycleEdges.get(s).delete(e), this.portCycleEdges.get(i).delete(e), this.portIncomingEdges.get(s).delete(e), this.portIncomingEdges.get(i).delete(e), this.portOutcomingEdges.get(s).delete(e), this.portOutcomingEdges.get(i).delete(e), this.edges.delete(e);
|
|
758
758
|
}
|
|
759
759
|
}
|
|
760
|
-
const
|
|
760
|
+
const ce = (r) => ({
|
|
761
761
|
scale: 1 / r.scale,
|
|
762
762
|
x: -r.x / r.scale,
|
|
763
763
|
y: -r.y / r.scale
|
|
764
|
-
}),
|
|
764
|
+
}), le = {
|
|
765
765
|
scale: 1,
|
|
766
766
|
x: 0,
|
|
767
767
|
y: 0
|
|
768
768
|
};
|
|
769
|
-
class
|
|
769
|
+
class je {
|
|
770
770
|
constructor() {
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
[this.afterUpdateEmitter, this.onAfterUpdated] =
|
|
771
|
+
o(this, "viewportMatrix", le);
|
|
772
|
+
o(this, "contentMatrix", le);
|
|
773
|
+
o(this, "afterUpdateEmitter");
|
|
774
|
+
o(this, "onAfterUpdated");
|
|
775
|
+
[this.afterUpdateEmitter, this.onAfterUpdated] = x();
|
|
776
776
|
}
|
|
777
777
|
getViewportMatrix() {
|
|
778
778
|
return this.viewportMatrix;
|
|
@@ -785,52 +785,52 @@ class ke {
|
|
|
785
785
|
scale: e.scale ?? this.viewportMatrix.scale,
|
|
786
786
|
x: e.x ?? this.viewportMatrix.x,
|
|
787
787
|
y: e.y ?? this.viewportMatrix.y
|
|
788
|
-
}, this.contentMatrix =
|
|
788
|
+
}, this.contentMatrix = ce(this.viewportMatrix), this.afterUpdateEmitter.emit();
|
|
789
789
|
}
|
|
790
790
|
patchContentMatrix(e) {
|
|
791
791
|
this.contentMatrix = {
|
|
792
792
|
scale: e.scale ?? this.contentMatrix.scale,
|
|
793
793
|
x: e.x ?? this.contentMatrix.x,
|
|
794
794
|
y: e.y ?? this.contentMatrix.y
|
|
795
|
-
}, this.viewportMatrix =
|
|
795
|
+
}, this.viewportMatrix = ce(this.contentMatrix), this.afterUpdateEmitter.emit();
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
|
-
class
|
|
798
|
+
class K {
|
|
799
799
|
constructor(e) {
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
800
|
+
o(this, "elementToNodeId", /* @__PURE__ */ new Map());
|
|
801
|
+
o(this, "nodesResizeObserver");
|
|
802
|
+
o(this, "onAfterNodeAdded", (e) => {
|
|
803
803
|
const t = this.canvas.graph.getNode(e);
|
|
804
804
|
this.elementToNodeId.set(t.element, e), this.nodesResizeObserver.observe(t.element);
|
|
805
805
|
});
|
|
806
|
-
|
|
806
|
+
o(this, "onBeforeNodeRemoved", (e) => {
|
|
807
807
|
const t = this.canvas.graph.getNode(e);
|
|
808
808
|
this.elementToNodeId.delete(t.element), this.nodesResizeObserver.unobserve(t.element);
|
|
809
809
|
});
|
|
810
|
-
|
|
810
|
+
o(this, "onBeforeClear", () => {
|
|
811
811
|
this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
|
|
812
812
|
});
|
|
813
813
|
this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
|
|
814
|
-
t.forEach((
|
|
815
|
-
const i =
|
|
814
|
+
t.forEach((s) => {
|
|
815
|
+
const i = s.target;
|
|
816
816
|
this.handleNodeResize(i);
|
|
817
817
|
});
|
|
818
818
|
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
|
|
819
819
|
}
|
|
820
820
|
static configure(e) {
|
|
821
|
-
new
|
|
821
|
+
new K(e);
|
|
822
822
|
}
|
|
823
823
|
handleNodeResize(e) {
|
|
824
824
|
const t = this.elementToNodeId.get(e);
|
|
825
825
|
this.canvas.updateNode(t);
|
|
826
826
|
}
|
|
827
827
|
}
|
|
828
|
-
const
|
|
829
|
-
const { x:
|
|
830
|
-
return e >=
|
|
831
|
-
},
|
|
828
|
+
const Ge = (r, e, t) => {
|
|
829
|
+
const { x: s, y: i, width: n, height: a } = r.getBoundingClientRect();
|
|
830
|
+
return e >= s && e <= s + n && t >= i && t <= i + a;
|
|
831
|
+
}, Ke = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, V = (r, e, t, s) => Ge(e, t, s) && Ke(r, t, s), B = (r, e) => {
|
|
832
832
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
833
|
-
},
|
|
833
|
+
}, F = (r) => {
|
|
834
834
|
const e = document.createElement("div");
|
|
835
835
|
return {
|
|
836
836
|
id: r.overlayId,
|
|
@@ -845,38 +845,38 @@ const ze = (r, e, t) => {
|
|
|
845
845
|
}
|
|
846
846
|
]
|
|
847
847
|
};
|
|
848
|
-
},
|
|
849
|
-
let t = e,
|
|
850
|
-
for (; t !== null && (
|
|
848
|
+
}, Ze = (r, e) => {
|
|
849
|
+
let t = e, s = null;
|
|
850
|
+
for (; t !== null && (s = r.getElementPortIds(t)[0] ?? null, s === null); )
|
|
851
851
|
t = t.parentElement;
|
|
852
|
-
return
|
|
853
|
-
},
|
|
852
|
+
return s;
|
|
853
|
+
}, Ae = (r, e) => {
|
|
854
854
|
const t = document.elementsFromPoint(e.x, e.y);
|
|
855
|
-
for (const
|
|
856
|
-
const i =
|
|
855
|
+
for (const s of t) {
|
|
856
|
+
const i = Ze(r, s);
|
|
857
857
|
if (i !== null)
|
|
858
858
|
return i;
|
|
859
859
|
}
|
|
860
860
|
return null;
|
|
861
861
|
};
|
|
862
|
-
var
|
|
863
|
-
const
|
|
862
|
+
var b = /* @__PURE__ */ ((r) => (r.Static = "static", r.Dragging = "dragging", r.Edge = "edge", r))(b || {});
|
|
863
|
+
const xe = (r, e) => ({
|
|
864
864
|
x: r / 2,
|
|
865
865
|
y: e / 2
|
|
866
|
-
}),
|
|
866
|
+
}), p = {
|
|
867
867
|
x: 0,
|
|
868
868
|
y: 0
|
|
869
869
|
}, m = (r, e, t) => ({
|
|
870
870
|
x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
|
|
871
871
|
y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
|
|
872
|
-
}),
|
|
872
|
+
}), Se = (r, e) => {
|
|
873
873
|
const t = {
|
|
874
874
|
x: r.x + r.width / 2,
|
|
875
875
|
y: r.y + r.height / 2
|
|
876
|
-
},
|
|
876
|
+
}, s = {
|
|
877
877
|
x: e.x + e.width / 2,
|
|
878
878
|
y: e.y + e.height / 2
|
|
879
|
-
}, i = Math.min(t.x,
|
|
879
|
+
}, i = 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;
|
|
880
880
|
return {
|
|
881
881
|
x: i,
|
|
882
882
|
y: n,
|
|
@@ -885,45 +885,45 @@ const Ae = (r, e) => ({
|
|
|
885
885
|
flipX: d,
|
|
886
886
|
flipY: c
|
|
887
887
|
};
|
|
888
|
-
},
|
|
889
|
-
x: e * r.x + (1 - e) / 2 *
|
|
890
|
-
y: t * r.y + (1 - t) / 2 *
|
|
888
|
+
}, W = (r, e, t, s) => ({
|
|
889
|
+
x: e * r.x + (1 - e) / 2 * s.x,
|
|
890
|
+
y: t * r.y + (1 - t) / 2 * s.y
|
|
891
891
|
});
|
|
892
|
-
class
|
|
892
|
+
class Je {
|
|
893
893
|
constructor(e) {
|
|
894
|
-
|
|
895
|
-
|
|
894
|
+
o(this, "path");
|
|
895
|
+
o(this, "midpoint");
|
|
896
896
|
this.params = e;
|
|
897
897
|
const t = this.params.to;
|
|
898
898
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
899
|
-
const
|
|
900
|
-
{ x: this.params.arrowLength, y:
|
|
899
|
+
const s = m(
|
|
900
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
901
901
|
this.params.sourceDirection,
|
|
902
|
-
|
|
902
|
+
p
|
|
903
903
|
), i = m(
|
|
904
904
|
{ x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
|
|
905
905
|
this.params.targetDirection,
|
|
906
906
|
this.params.to
|
|
907
907
|
), n = {
|
|
908
|
-
x:
|
|
909
|
-
y:
|
|
908
|
+
x: s.x + this.params.sourceDirection.x * this.params.curvature,
|
|
909
|
+
y: s.y + this.params.sourceDirection.y * this.params.curvature
|
|
910
910
|
}, a = {
|
|
911
911
|
x: i.x - this.params.targetDirection.x * this.params.curvature,
|
|
912
912
|
y: i.y - this.params.targetDirection.y * this.params.curvature
|
|
913
|
-
}, h = `M ${
|
|
913
|
+
}, h = `M ${s.x} ${s.y} C ${n.x} ${n.y}, ${a.x} ${a.y}, ${i.x} ${i.y}`, d = this.params.hasSourceArrow ? "" : `M ${p.x} ${p.y} L ${s.x} ${s.y} `, c = this.params.hasTargetArrow ? "" : ` M ${i.x} ${i.y} L ${this.params.to.x} ${this.params.to.y}`;
|
|
914
914
|
this.path = `${d}${h}${c}`;
|
|
915
915
|
}
|
|
916
916
|
}
|
|
917
|
-
class
|
|
917
|
+
class Qe {
|
|
918
918
|
constructor(e) {
|
|
919
|
-
|
|
920
|
-
|
|
919
|
+
o(this, "path");
|
|
920
|
+
o(this, "midpoint");
|
|
921
921
|
this.params = e;
|
|
922
922
|
const t = this.params.hasSourceArrow ? m(
|
|
923
|
-
{ x: this.params.arrowLength, y:
|
|
923
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
924
924
|
this.params.sourceDirection,
|
|
925
|
-
|
|
926
|
-
) :
|
|
925
|
+
p
|
|
926
|
+
) : p, s = this.params.hasTargetArrow ? m(
|
|
927
927
|
{
|
|
928
928
|
x: this.params.to.x - this.params.arrowLength,
|
|
929
929
|
y: this.params.to.y
|
|
@@ -931,73 +931,73 @@ class je {
|
|
|
931
931
|
this.params.targetDirection,
|
|
932
932
|
this.params.to
|
|
933
933
|
) : this.params.to, i = 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(
|
|
934
|
-
{ x: i, y:
|
|
934
|
+
{ x: i, y: p.y },
|
|
935
935
|
this.params.sourceDirection,
|
|
936
|
-
|
|
937
|
-
),
|
|
936
|
+
p
|
|
937
|
+
), g = {
|
|
938
938
|
x: c.x + h,
|
|
939
939
|
y: c.y + d
|
|
940
|
-
},
|
|
940
|
+
}, l = m(
|
|
941
941
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
942
942
|
this.params.targetDirection,
|
|
943
943
|
this.params.to
|
|
944
|
-
),
|
|
945
|
-
x:
|
|
946
|
-
y:
|
|
947
|
-
},
|
|
948
|
-
x: (
|
|
949
|
-
y: (
|
|
944
|
+
), u = {
|
|
945
|
+
x: l.x + h,
|
|
946
|
+
y: l.y + d
|
|
947
|
+
}, w = {
|
|
948
|
+
x: (g.x + u.x) / 2,
|
|
949
|
+
y: (g.y + u.y) / 2
|
|
950
950
|
}, y = {
|
|
951
951
|
x: c.x + this.params.curvature * this.params.sourceDirection.x,
|
|
952
952
|
y: c.y + this.params.curvature * this.params.sourceDirection.y
|
|
953
953
|
}, v = {
|
|
954
|
-
x:
|
|
955
|
-
y:
|
|
956
|
-
},
|
|
954
|
+
x: l.x - this.params.curvature * this.params.targetDirection.x,
|
|
955
|
+
y: l.y - this.params.curvature * this.params.targetDirection.y
|
|
956
|
+
}, E = {
|
|
957
957
|
x: c.x + h,
|
|
958
958
|
y: c.y + d
|
|
959
959
|
}, A = {
|
|
960
|
-
x:
|
|
961
|
-
y:
|
|
960
|
+
x: l.x + h,
|
|
961
|
+
y: l.y + d
|
|
962
962
|
};
|
|
963
963
|
this.path = [
|
|
964
964
|
`M ${t.x} ${t.y}`,
|
|
965
965
|
`L ${c.x} ${c.y}`,
|
|
966
|
-
`C ${y.x} ${y.y} ${
|
|
967
|
-
`C ${A.x} ${A.y} ${v.x} ${v.y} ${
|
|
968
|
-
`L ${
|
|
969
|
-
].join(" "), this.midpoint =
|
|
966
|
+
`C ${y.x} ${y.y} ${E.x} ${E.y} ${w.x} ${w.y}`,
|
|
967
|
+
`C ${A.x} ${A.y} ${v.x} ${v.y} ${l.x} ${l.y}`,
|
|
968
|
+
`L ${s.x} ${s.y}`
|
|
969
|
+
].join(" "), this.midpoint = W(w, e.flipX, e.flipY, e.to);
|
|
970
970
|
}
|
|
971
971
|
}
|
|
972
|
-
const
|
|
972
|
+
const Z = Object.freeze({
|
|
973
973
|
edgeColor: "--edge-color"
|
|
974
|
-
}),
|
|
974
|
+
}), Pe = (r) => {
|
|
975
975
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
976
|
-
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(
|
|
977
|
-
},
|
|
976
|
+
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;
|
|
977
|
+
}, be = (r) => {
|
|
978
978
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
979
|
-
return e.setAttribute("stroke", `var(${
|
|
979
|
+
return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
980
980
|
}, O = () => {
|
|
981
981
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
982
|
-
return r.setAttribute("fill", `var(${
|
|
983
|
-
},
|
|
982
|
+
return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
|
|
983
|
+
}, Te = () => {
|
|
984
984
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
985
985
|
return r.style.transformOrigin = "50% 50%", r;
|
|
986
|
-
},
|
|
986
|
+
}, De = (r, e) => {
|
|
987
987
|
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`;
|
|
988
988
|
}, L = (r, e) => {
|
|
989
989
|
const t = [];
|
|
990
990
|
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) {
|
|
991
|
-
const
|
|
991
|
+
const s = r.length - 1;
|
|
992
992
|
let i = 0, n = 0, a = 0;
|
|
993
993
|
r.forEach((h, d) => {
|
|
994
|
-
let c = 0,
|
|
995
|
-
const
|
|
996
|
-
if (
|
|
997
|
-
const
|
|
998
|
-
i =
|
|
994
|
+
let c = 0, g = 0, l = 0;
|
|
995
|
+
const u = d > 0, w = d < s, y = u && w;
|
|
996
|
+
if (u && (c = -i, g = -n, l = a), w) {
|
|
997
|
+
const $ = r[d + 1];
|
|
998
|
+
i = $.x - h.x, n = $.y - h.y, a = Math.sqrt(i * i + n * n);
|
|
999
999
|
}
|
|
1000
|
-
const
|
|
1000
|
+
const E = a !== 0 ? Math.min((y ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, A = y ? { x: h.x + i * E, y: h.y + n * E } : h, T = l !== 0 ? Math.min((y ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, N = y ? { x: h.x + c * T, y: h.y + g * T } : h;
|
|
1001
1001
|
d > 0 && t.push(`L ${N.x} ${N.y}`), y && t.push(
|
|
1002
1002
|
`C ${h.x} ${h.y} ${h.x} ${h.y} ${A.x} ${A.y}`
|
|
1003
1003
|
);
|
|
@@ -1005,18 +1005,18 @@ const K = Object.freeze({
|
|
|
1005
1005
|
}
|
|
1006
1006
|
return t.join(" ");
|
|
1007
1007
|
};
|
|
1008
|
-
class
|
|
1008
|
+
class qe {
|
|
1009
1009
|
constructor(e) {
|
|
1010
|
-
|
|
1011
|
-
|
|
1010
|
+
o(this, "path");
|
|
1011
|
+
o(this, "midpoint");
|
|
1012
1012
|
this.params = e;
|
|
1013
1013
|
const t = this.params.to;
|
|
1014
1014
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1015
|
-
const
|
|
1016
|
-
{ x: this.params.arrowLength, y:
|
|
1015
|
+
const s = this.params.hasSourceArrow ? m(
|
|
1016
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1017
1017
|
this.params.sourceDirection,
|
|
1018
|
-
|
|
1019
|
-
) :
|
|
1018
|
+
p
|
|
1019
|
+
) : p, i = this.params.hasTargetArrow ? m(
|
|
1020
1020
|
{
|
|
1021
1021
|
x: this.params.to.x - this.params.arrowLength,
|
|
1022
1022
|
y: this.params.to.y
|
|
@@ -1024,36 +1024,36 @@ class Ge {
|
|
|
1024
1024
|
this.params.targetDirection,
|
|
1025
1025
|
this.params.to
|
|
1026
1026
|
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
|
|
1027
|
-
{ x: a, y:
|
|
1027
|
+
{ x: a, y: p.y },
|
|
1028
1028
|
this.params.sourceDirection,
|
|
1029
|
-
|
|
1029
|
+
p
|
|
1030
1030
|
), d = m(
|
|
1031
1031
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1032
1032
|
this.params.targetDirection,
|
|
1033
1033
|
this.params.to
|
|
1034
|
-
), c = Math.max((h.x + d.x) / 2, n),
|
|
1034
|
+
), c = Math.max((h.x + d.x) / 2, n), g = this.params.to.y / 2, l = {
|
|
1035
1035
|
x: this.params.flipX > 0 ? c : -n,
|
|
1036
1036
|
y: h.y
|
|
1037
|
-
},
|
|
1037
|
+
}, u = { x: l.x, y: g }, w = {
|
|
1038
1038
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
1039
1039
|
y: d.y
|
|
1040
|
-
}, y = { x:
|
|
1040
|
+
}, y = { x: w.x, y: g };
|
|
1041
1041
|
this.path = L(
|
|
1042
|
-
[
|
|
1042
|
+
[s, h, l, u, y, w, d, i],
|
|
1043
1043
|
this.params.roundness
|
|
1044
1044
|
);
|
|
1045
1045
|
}
|
|
1046
1046
|
}
|
|
1047
|
-
class
|
|
1047
|
+
class _e {
|
|
1048
1048
|
constructor(e) {
|
|
1049
|
-
|
|
1050
|
-
|
|
1049
|
+
o(this, "path");
|
|
1050
|
+
o(this, "midpoint");
|
|
1051
1051
|
this.params = e;
|
|
1052
1052
|
const t = this.params.hasSourceArrow ? m(
|
|
1053
|
-
{ x: this.params.arrowLength, y:
|
|
1053
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1054
1054
|
this.params.sourceDirection,
|
|
1055
|
-
|
|
1056
|
-
) :
|
|
1055
|
+
p
|
|
1056
|
+
) : p, s = this.params.hasTargetArrow ? m(
|
|
1057
1057
|
{
|
|
1058
1058
|
x: this.params.to.x - this.params.arrowLength,
|
|
1059
1059
|
y: this.params.to.y
|
|
@@ -1061,32 +1061,32 @@ class Ke {
|
|
|
1061
1061
|
this.params.targetDirection,
|
|
1062
1062
|
this.params.to
|
|
1063
1063
|
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1064
|
-
{ x: i, y:
|
|
1064
|
+
{ x: i, y: p.y },
|
|
1065
1065
|
this.params.sourceDirection,
|
|
1066
|
-
|
|
1067
|
-
), 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,
|
|
1066
|
+
p
|
|
1067
|
+
), 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(
|
|
1068
1068
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1069
1069
|
this.params.targetDirection,
|
|
1070
1070
|
this.params.to
|
|
1071
|
-
),
|
|
1072
|
-
this.midpoint =
|
|
1073
|
-
[t, n,
|
|
1071
|
+
), u = { x: l.x + d, y: l.y + c }, w = { x: (g.x + u.x) / 2, y: (g.y + u.y) / 2 };
|
|
1072
|
+
this.midpoint = W(w, e.flipX, e.flipY, e.to), this.path = L(
|
|
1073
|
+
[t, n, g, u, l, s],
|
|
1074
1074
|
this.params.roundness
|
|
1075
1075
|
);
|
|
1076
1076
|
}
|
|
1077
1077
|
}
|
|
1078
|
-
class
|
|
1078
|
+
class et {
|
|
1079
1079
|
constructor(e) {
|
|
1080
|
-
|
|
1081
|
-
|
|
1080
|
+
o(this, "path");
|
|
1081
|
+
o(this, "midpoint");
|
|
1082
1082
|
this.params = e;
|
|
1083
1083
|
const t = this.params.to;
|
|
1084
1084
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1085
|
-
const
|
|
1086
|
-
{ x: this.params.arrowLength, y:
|
|
1085
|
+
const s = this.params.hasSourceArrow ? m(
|
|
1086
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1087
1087
|
this.params.sourceDirection,
|
|
1088
|
-
|
|
1089
|
-
) :
|
|
1088
|
+
p
|
|
1089
|
+
) : p, i = this.params.hasTargetArrow ? m(
|
|
1090
1090
|
{
|
|
1091
1091
|
x: this.params.to.x - this.params.arrowLength,
|
|
1092
1092
|
y: this.params.to.y
|
|
@@ -1094,29 +1094,29 @@ class Ze {
|
|
|
1094
1094
|
this.params.targetDirection,
|
|
1095
1095
|
this.params.to
|
|
1096
1096
|
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = m(
|
|
1097
|
-
{ x: n, y:
|
|
1097
|
+
{ x: n, y: p.y },
|
|
1098
1098
|
this.params.sourceDirection,
|
|
1099
|
-
|
|
1099
|
+
p
|
|
1100
1100
|
), h = m(
|
|
1101
1101
|
{ x: this.params.to.x - n, y: this.params.to.y },
|
|
1102
1102
|
this.params.targetDirection,
|
|
1103
1103
|
this.params.to
|
|
1104
1104
|
);
|
|
1105
|
-
this.path = L([
|
|
1105
|
+
this.path = L([s, a, h, i], this.params.roundness);
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
1108
|
-
class
|
|
1108
|
+
class tt {
|
|
1109
1109
|
constructor(e) {
|
|
1110
|
-
|
|
1111
|
-
|
|
1110
|
+
o(this, "path");
|
|
1111
|
+
o(this, "midpoint");
|
|
1112
1112
|
this.params = e;
|
|
1113
1113
|
const t = this.params.to;
|
|
1114
1114
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1115
|
-
const
|
|
1116
|
-
{ x: this.params.arrowLength, y:
|
|
1115
|
+
const s = this.params.hasSourceArrow ? m(
|
|
1116
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1117
1117
|
this.params.sourceDirection,
|
|
1118
|
-
|
|
1119
|
-
) :
|
|
1118
|
+
p
|
|
1119
|
+
) : p, i = this.params.hasTargetArrow ? m(
|
|
1120
1120
|
{
|
|
1121
1121
|
x: this.params.to.x - this.params.arrowLength,
|
|
1122
1122
|
y: this.params.to.y
|
|
@@ -1124,72 +1124,72 @@ class Je {
|
|
|
1124
1124
|
this.params.targetDirection,
|
|
1125
1125
|
this.params.to
|
|
1126
1126
|
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = m(
|
|
1127
|
-
{ x: a, y:
|
|
1127
|
+
{ x: a, y: p.y },
|
|
1128
1128
|
this.params.sourceDirection,
|
|
1129
|
-
|
|
1129
|
+
p
|
|
1130
1130
|
), d = m(
|
|
1131
1131
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1132
1132
|
this.params.targetDirection,
|
|
1133
1133
|
this.params.to
|
|
1134
|
-
), c = Math.max((h.y + d.y) / 2, n),
|
|
1134
|
+
), c = Math.max((h.y + d.y) / 2, n), g = this.params.to.x / 2, l = {
|
|
1135
1135
|
x: h.x,
|
|
1136
1136
|
y: this.params.flipY > 0 ? c : -n
|
|
1137
|
-
},
|
|
1137
|
+
}, u = { x: g, y: l.y }, w = {
|
|
1138
1138
|
x: d.x,
|
|
1139
1139
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1140
|
-
}, y = { x:
|
|
1140
|
+
}, y = { x: g, y: w.y };
|
|
1141
1141
|
this.path = L(
|
|
1142
|
-
[
|
|
1142
|
+
[s, h, l, u, y, w, d, i],
|
|
1143
1143
|
this.params.roundness
|
|
1144
1144
|
);
|
|
1145
1145
|
}
|
|
1146
1146
|
}
|
|
1147
|
-
class
|
|
1147
|
+
class J {
|
|
1148
1148
|
constructor(e) {
|
|
1149
|
-
|
|
1150
|
-
|
|
1149
|
+
o(this, "path");
|
|
1150
|
+
o(this, "midpoint");
|
|
1151
1151
|
this.params = e;
|
|
1152
|
-
const t = this.params.arrowOffset,
|
|
1153
|
-
{ x: this.params.arrowLength, y:
|
|
1154
|
-
{ x: i, y:
|
|
1152
|
+
const t = this.params.arrowOffset, s = this.params.side, i = this.params.arrowLength + t, n = i + 2 * s, h = [
|
|
1153
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1154
|
+
{ x: i, y: p.y },
|
|
1155
1155
|
{ x: i, y: this.params.side },
|
|
1156
1156
|
{ x: n, y: this.params.side },
|
|
1157
1157
|
{ x: n, y: -this.params.side },
|
|
1158
1158
|
{ x: i, y: -this.params.side },
|
|
1159
|
-
{ x: i, y:
|
|
1160
|
-
{ x: this.params.arrowLength, y:
|
|
1159
|
+
{ x: i, y: p.y },
|
|
1160
|
+
{ x: this.params.arrowLength, y: p.y }
|
|
1161
1161
|
].map(
|
|
1162
|
-
(c) => m(c, this.params.sourceDirection,
|
|
1163
|
-
), d = `M ${
|
|
1162
|
+
(c) => m(c, this.params.sourceDirection, p)
|
|
1163
|
+
), d = `M ${p.x} ${p.y} L ${h[0].x} ${h[0].y} `;
|
|
1164
1164
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${L(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
|
|
1165
1165
|
}
|
|
1166
1166
|
}
|
|
1167
|
-
class
|
|
1167
|
+
class rt {
|
|
1168
1168
|
constructor(e) {
|
|
1169
|
-
|
|
1170
|
-
|
|
1169
|
+
o(this, "path");
|
|
1170
|
+
o(this, "midpoint");
|
|
1171
1171
|
this.params = e;
|
|
1172
|
-
const t = this.params.smallRadius,
|
|
1173
|
-
{ x: this.params.arrowLength, y:
|
|
1172
|
+
const t = this.params.smallRadius, s = this.params.radius, i = t + s, n = t * s / i, a = Math.sqrt(i * i - t * t), h = a * t / i, d = a + s + this.params.arrowLength, c = this.params.arrowLength + h, l = [
|
|
1173
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1174
1174
|
{ x: c, y: n },
|
|
1175
1175
|
{ x: c, y: -n },
|
|
1176
1176
|
{ x: d, y: 0 }
|
|
1177
1177
|
].map(
|
|
1178
|
-
(y) => m(y, this.params.sourceDirection,
|
|
1179
|
-
),
|
|
1180
|
-
`M ${
|
|
1181
|
-
`A ${t} ${t} 0 0 1 ${
|
|
1182
|
-
`A ${
|
|
1183
|
-
`A ${t} ${t} 0 0 1 ${
|
|
1184
|
-
].join(" "),
|
|
1185
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" :
|
|
1178
|
+
(y) => m(y, this.params.sourceDirection, p)
|
|
1179
|
+
), u = [
|
|
1180
|
+
`M ${l[0].x} ${l[0].y}`,
|
|
1181
|
+
`A ${t} ${t} 0 0 1 ${l[1].x} ${l[1].y}`,
|
|
1182
|
+
`A ${s} ${s} 0 1 0 ${l[2].x} ${l[2].y}`,
|
|
1183
|
+
`A ${t} ${t} 0 0 1 ${l[0].x} ${l[0].y}`
|
|
1184
|
+
].join(" "), w = `M 0 0 L ${l[0].x} ${l[0].y} `;
|
|
1185
|
+
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${u}`, this.midpoint = l[3];
|
|
1186
1186
|
}
|
|
1187
1187
|
}
|
|
1188
|
-
class
|
|
1188
|
+
class st {
|
|
1189
1189
|
constructor(e) {
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1190
|
+
o(this, "path");
|
|
1191
|
+
o(this, "midpoint");
|
|
1192
|
+
o(this, "diagonalDistance");
|
|
1193
1193
|
this.params = e;
|
|
1194
1194
|
const t = this.params.to;
|
|
1195
1195
|
if (this.midpoint = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
|
|
@@ -1204,7 +1204,7 @@ class _e {
|
|
|
1204
1204
|
offset: this.params.sourceOffset,
|
|
1205
1205
|
hasArrow: this.params.hasSourceArrow,
|
|
1206
1206
|
flip: 1,
|
|
1207
|
-
shift:
|
|
1207
|
+
shift: p
|
|
1208
1208
|
}), n = this.createDirectLinePoint({
|
|
1209
1209
|
offset: this.params.targetOffset,
|
|
1210
1210
|
hasArrow: this.params.hasTargetArrow,
|
|
@@ -1214,23 +1214,23 @@ class _e {
|
|
|
1214
1214
|
this.path = `M ${i.x} ${i.y} L ${n.x} ${n.y}`;
|
|
1215
1215
|
}
|
|
1216
1216
|
createDirectLinePoint(e) {
|
|
1217
|
-
const t = e.hasArrow ? this.params.arrowLength : 0,
|
|
1217
|
+
const t = e.hasArrow ? this.params.arrowLength : 0, s = e.offset + t, i = e.flip * s / this.diagonalDistance;
|
|
1218
1218
|
return {
|
|
1219
1219
|
x: this.params.to.x * i + e.shift.x,
|
|
1220
1220
|
y: this.params.to.y * i + e.shift.y
|
|
1221
1221
|
};
|
|
1222
1222
|
}
|
|
1223
1223
|
}
|
|
1224
|
-
class
|
|
1224
|
+
class ot {
|
|
1225
1225
|
constructor(e) {
|
|
1226
|
-
|
|
1227
|
-
|
|
1226
|
+
o(this, "path");
|
|
1227
|
+
o(this, "midpoint");
|
|
1228
1228
|
this.params = e;
|
|
1229
1229
|
const t = this.params.hasSourceArrow ? m(
|
|
1230
|
-
{ x: this.params.arrowLength, y:
|
|
1230
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1231
1231
|
this.params.sourceDirection,
|
|
1232
|
-
|
|
1233
|
-
) :
|
|
1232
|
+
p
|
|
1233
|
+
) : p, s = this.params.hasTargetArrow ? m(
|
|
1234
1234
|
{
|
|
1235
1235
|
x: this.params.to.x - this.params.arrowLength,
|
|
1236
1236
|
y: this.params.to.y
|
|
@@ -1238,40 +1238,40 @@ class qe {
|
|
|
1238
1238
|
this.params.targetDirection,
|
|
1239
1239
|
this.params.to
|
|
1240
1240
|
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1241
|
-
{ x: i, y:
|
|
1241
|
+
{ x: i, y: p.y },
|
|
1242
1242
|
this.params.sourceDirection,
|
|
1243
|
-
|
|
1243
|
+
p
|
|
1244
1244
|
), a = m(
|
|
1245
1245
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1246
1246
|
this.params.targetDirection,
|
|
1247
1247
|
this.params.to
|
|
1248
|
-
), h = this.params.detourDistance > 0 ? 1 : -1, d = this.params.to.y / 2, c = d + Math.abs(this.params.detourDistance),
|
|
1248
|
+
), 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 = {
|
|
1249
1249
|
x: (n.x + a.x) / 2,
|
|
1250
|
-
y:
|
|
1250
|
+
y: g
|
|
1251
1251
|
};
|
|
1252
|
-
this.midpoint =
|
|
1252
|
+
this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = L(
|
|
1253
1253
|
[
|
|
1254
1254
|
t,
|
|
1255
1255
|
n,
|
|
1256
|
-
{ x: n.x, y:
|
|
1257
|
-
{ x: a.x, y:
|
|
1256
|
+
{ x: n.x, y: g },
|
|
1257
|
+
{ x: a.x, y: g },
|
|
1258
1258
|
a,
|
|
1259
|
-
|
|
1259
|
+
s
|
|
1260
1260
|
],
|
|
1261
1261
|
this.params.roundness
|
|
1262
1262
|
);
|
|
1263
1263
|
}
|
|
1264
1264
|
}
|
|
1265
|
-
class
|
|
1265
|
+
class it {
|
|
1266
1266
|
constructor(e) {
|
|
1267
|
-
|
|
1268
|
-
|
|
1267
|
+
o(this, "path");
|
|
1268
|
+
o(this, "midpoint");
|
|
1269
1269
|
this.params = e;
|
|
1270
1270
|
const t = this.params.hasSourceArrow ? m(
|
|
1271
|
-
{ x: this.params.arrowLength, y:
|
|
1271
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1272
1272
|
this.params.sourceDirection,
|
|
1273
|
-
|
|
1274
|
-
) :
|
|
1273
|
+
p
|
|
1274
|
+
) : p, s = this.params.hasTargetArrow ? m(
|
|
1275
1275
|
{
|
|
1276
1276
|
x: this.params.to.x - this.params.arrowLength,
|
|
1277
1277
|
y: this.params.to.y
|
|
@@ -1279,31 +1279,31 @@ class et {
|
|
|
1279
1279
|
this.params.targetDirection,
|
|
1280
1280
|
this.params.to
|
|
1281
1281
|
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = m(
|
|
1282
|
-
{ x: i, y:
|
|
1282
|
+
{ x: i, y: p.y },
|
|
1283
1283
|
this.params.sourceDirection,
|
|
1284
|
-
|
|
1284
|
+
p
|
|
1285
1285
|
), a = m(
|
|
1286
1286
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1287
1287
|
this.params.targetDirection,
|
|
1288
1288
|
this.params.to
|
|
1289
|
-
), h = this.params.detourDistance > 0 ? 1 : -1, d = this.params.to.x / 2, c = d + Math.abs(this.params.detourDistance),
|
|
1290
|
-
x:
|
|
1289
|
+
), 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 = {
|
|
1290
|
+
x: g,
|
|
1291
1291
|
y: (n.y + a.y) / 2
|
|
1292
1292
|
};
|
|
1293
|
-
this.midpoint =
|
|
1293
|
+
this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = L(
|
|
1294
1294
|
[
|
|
1295
1295
|
t,
|
|
1296
1296
|
n,
|
|
1297
|
-
{ x:
|
|
1298
|
-
{ x:
|
|
1297
|
+
{ x: g, y: n.y },
|
|
1298
|
+
{ x: g, y: a.y },
|
|
1299
1299
|
a,
|
|
1300
|
-
|
|
1300
|
+
s
|
|
1301
1301
|
],
|
|
1302
1302
|
this.params.roundness
|
|
1303
1303
|
);
|
|
1304
1304
|
}
|
|
1305
1305
|
}
|
|
1306
|
-
const
|
|
1306
|
+
const f = Object.freeze({
|
|
1307
1307
|
color: "#777777",
|
|
1308
1308
|
width: 1,
|
|
1309
1309
|
arrowLength: 20,
|
|
@@ -1326,24 +1326,24 @@ const w = Object.freeze({
|
|
|
1326
1326
|
interactiveWidth: 10,
|
|
1327
1327
|
preOffset: 0
|
|
1328
1328
|
}), ge = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
|
|
1329
|
-
class
|
|
1329
|
+
class k {
|
|
1330
1330
|
constructor(e) {
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] =
|
|
1331
|
+
o(this, "svg");
|
|
1332
|
+
o(this, "group", Te());
|
|
1333
|
+
o(this, "line");
|
|
1334
|
+
o(this, "sourceArrow", null);
|
|
1335
|
+
o(this, "targetArrow", null);
|
|
1336
|
+
o(this, "onAfterRender");
|
|
1337
|
+
o(this, "afterRenderEmitter");
|
|
1338
|
+
o(this, "arrowRenderer");
|
|
1339
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = x(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Pe(e.color), this.svg.appendChild(this.group), this.line = be(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = O(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = O(), this.group.appendChild(this.targetArrow));
|
|
1340
1340
|
}
|
|
1341
1341
|
render(e) {
|
|
1342
|
-
const { x: t, y:
|
|
1342
|
+
const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Se(
|
|
1343
1343
|
e.from,
|
|
1344
1344
|
e.to
|
|
1345
1345
|
);
|
|
1346
|
-
|
|
1346
|
+
De(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1347
1347
|
const d = ge(
|
|
1348
1348
|
e.from.direction,
|
|
1349
1349
|
a,
|
|
@@ -1352,60 +1352,60 @@ class W {
|
|
|
1352
1352
|
e.to.direction,
|
|
1353
1353
|
a,
|
|
1354
1354
|
h
|
|
1355
|
-
),
|
|
1355
|
+
), g = {
|
|
1356
1356
|
x: i,
|
|
1357
1357
|
y: n
|
|
1358
1358
|
};
|
|
1359
|
-
let
|
|
1360
|
-
e.category ===
|
|
1361
|
-
const
|
|
1359
|
+
let l = { x: -c.x, y: -c.y }, u;
|
|
1360
|
+
e.category === C.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === C.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
|
|
1361
|
+
const w = u(
|
|
1362
1362
|
d,
|
|
1363
1363
|
c,
|
|
1364
|
-
|
|
1364
|
+
g,
|
|
1365
1365
|
a,
|
|
1366
1366
|
h
|
|
1367
1367
|
);
|
|
1368
|
-
this.line.setAttribute("d",
|
|
1368
|
+
this.line.setAttribute("d", w.path);
|
|
1369
1369
|
let y = null;
|
|
1370
1370
|
this.sourceArrow && (y = this.arrowRenderer({
|
|
1371
1371
|
direction: d,
|
|
1372
|
-
shift:
|
|
1372
|
+
shift: p,
|
|
1373
1373
|
arrowLength: this.params.arrowLength
|
|
1374
1374
|
}), this.sourceArrow.setAttribute("d", y));
|
|
1375
1375
|
let v = null;
|
|
1376
1376
|
this.targetArrow && (v = this.arrowRenderer({
|
|
1377
|
-
direction:
|
|
1378
|
-
shift:
|
|
1377
|
+
direction: l,
|
|
1378
|
+
shift: g,
|
|
1379
1379
|
arrowLength: this.params.arrowLength
|
|
1380
1380
|
}), this.targetArrow.setAttribute("d", v)), this.afterRenderEmitter.emit({
|
|
1381
|
-
edgePath:
|
|
1381
|
+
edgePath: w,
|
|
1382
1382
|
sourceArrowPath: y,
|
|
1383
1383
|
targetArrowPath: v
|
|
1384
1384
|
});
|
|
1385
1385
|
}
|
|
1386
1386
|
}
|
|
1387
|
-
const
|
|
1388
|
-
const
|
|
1389
|
-
|
|
1387
|
+
const nt = (r) => (e) => {
|
|
1388
|
+
const s = [
|
|
1389
|
+
p,
|
|
1390
1390
|
{ x: e.arrowLength, y: r.radius },
|
|
1391
1391
|
{ x: e.arrowLength, y: -r.radius }
|
|
1392
1392
|
].map(
|
|
1393
|
-
(h) => m(h, e.direction,
|
|
1393
|
+
(h) => m(h, e.direction, p)
|
|
1394
1394
|
).map((h) => ({
|
|
1395
1395
|
x: h.x + e.shift.x,
|
|
1396
1396
|
y: h.y + e.shift.y
|
|
1397
|
-
})), i = `M ${
|
|
1397
|
+
})), i = `M ${s[0].x} ${s[0].y}`, n = `L ${s[1].x} ${s[1].y}`, a = `L ${s[2].x} ${s[2].y}`;
|
|
1398
1398
|
return `${i} ${n} ${a} Z`;
|
|
1399
|
-
},
|
|
1400
|
-
const t = r.radius,
|
|
1401
|
-
(y) => m(y, e.direction,
|
|
1399
|
+
}, at = (r) => (e) => {
|
|
1400
|
+
const t = r.radius, s = e.arrowLength, i = (s * s + 2 * s * t) / (2 * t), n = i + t, a = s + t - t * (s + t) / n, h = t * i / n, c = [p, { x: a, y: -h }, { x: a, y: h }].map(
|
|
1401
|
+
(y) => m(y, e.direction, p)
|
|
1402
1402
|
).map((y) => ({
|
|
1403
1403
|
x: y.x + e.shift.x,
|
|
1404
1404
|
y: y.y + e.shift.y
|
|
1405
|
-
})),
|
|
1406
|
-
return `${
|
|
1407
|
-
},
|
|
1408
|
-
const t = r.smallRadius,
|
|
1405
|
+
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${i} ${i} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${i} ${i} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1406
|
+
return `${g} ${l} ${u} ${w}`;
|
|
1407
|
+
}, ht = (r) => (e) => {
|
|
1408
|
+
const t = r.smallRadius, s = r.radius, i = m(
|
|
1409
1409
|
{
|
|
1410
1410
|
x: e.arrowLength,
|
|
1411
1411
|
y: 0
|
|
@@ -1418,51 +1418,51 @@ const tt = (r) => (e) => {
|
|
|
1418
1418
|
x: e.arrowLength + r.smallRadius,
|
|
1419
1419
|
y: 0
|
|
1420
1420
|
}
|
|
1421
|
-
), a = [
|
|
1422
|
-
(
|
|
1423
|
-
).map((
|
|
1424
|
-
x:
|
|
1425
|
-
y:
|
|
1426
|
-
})), h = `M ${a[0].x} ${a[0].y}`, d = `A ${
|
|
1427
|
-
return `${h} ${d} ${c} ${
|
|
1428
|
-
},
|
|
1421
|
+
), a = [p, { x: i.x, y: -i.y }, i].map(
|
|
1422
|
+
(l) => m(l, e.direction, p)
|
|
1423
|
+
).map((l) => ({
|
|
1424
|
+
x: l.x + e.shift.x,
|
|
1425
|
+
y: l.y + e.shift.y
|
|
1426
|
+
})), h = `M ${a[0].x} ${a[0].y}`, d = `A ${s} ${s} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, g = `A ${s} ${s} 0 0 1 ${a[0].x} ${a[0].y}`;
|
|
1427
|
+
return `${h} ${d} ${c} ${g}`;
|
|
1428
|
+
}, I = (r) => {
|
|
1429
1429
|
if (typeof r == "function")
|
|
1430
1430
|
return r;
|
|
1431
1431
|
switch (r.type) {
|
|
1432
1432
|
case "triangle":
|
|
1433
|
-
return
|
|
1434
|
-
radius: r.radius ??
|
|
1433
|
+
return nt({
|
|
1434
|
+
radius: r.radius ?? f.polygonArrowRadius
|
|
1435
1435
|
});
|
|
1436
1436
|
case "arc":
|
|
1437
|
-
return
|
|
1438
|
-
radius: r.radius ??
|
|
1437
|
+
return at({
|
|
1438
|
+
radius: r.radius ?? f.circleArrowRadius
|
|
1439
1439
|
});
|
|
1440
1440
|
default:
|
|
1441
|
-
return
|
|
1442
|
-
smallRadius: r.smallRadius ??
|
|
1443
|
-
angle: r.angle ??
|
|
1444
|
-
radius: r.radius ??
|
|
1441
|
+
return ht({
|
|
1442
|
+
smallRadius: r.smallRadius ?? f.wedgeArrowSmallRadius,
|
|
1443
|
+
angle: r.angle ?? f.wedgeArrowAngle,
|
|
1444
|
+
radius: r.radius ?? f.wedgeArrowRadius
|
|
1445
1445
|
});
|
|
1446
1446
|
}
|
|
1447
1447
|
};
|
|
1448
|
-
class
|
|
1448
|
+
class dt {
|
|
1449
1449
|
constructor(e) {
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1450
|
+
o(this, "svg");
|
|
1451
|
+
o(this, "group");
|
|
1452
|
+
o(this, "line");
|
|
1453
|
+
o(this, "sourceArrow");
|
|
1454
|
+
o(this, "targetArrow");
|
|
1455
|
+
o(this, "onAfterRender");
|
|
1456
|
+
o(this, "arrowLength");
|
|
1457
|
+
o(this, "curvature");
|
|
1458
|
+
o(this, "portCycleRadius");
|
|
1459
|
+
o(this, "portCycleSmallRadius");
|
|
1460
|
+
o(this, "detourDirection");
|
|
1461
|
+
o(this, "detourDistance");
|
|
1462
|
+
o(this, "hasSourceArrow");
|
|
1463
|
+
o(this, "hasTargetArrow");
|
|
1464
|
+
o(this, "pathShape");
|
|
1465
|
+
o(this, "createCyclePath", (e) => new rt({
|
|
1466
1466
|
sourceDirection: e,
|
|
1467
1467
|
radius: this.portCycleRadius,
|
|
1468
1468
|
smallRadius: this.portCycleSmallRadius,
|
|
@@ -1470,8 +1470,8 @@ class st {
|
|
|
1470
1470
|
hasSourceArrow: this.hasSourceArrow,
|
|
1471
1471
|
hasTargetArrow: this.hasTargetArrow
|
|
1472
1472
|
}));
|
|
1473
|
-
|
|
1474
|
-
to:
|
|
1473
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new Qe({
|
|
1474
|
+
to: s,
|
|
1475
1475
|
sourceDirection: e,
|
|
1476
1476
|
targetDirection: t,
|
|
1477
1477
|
flipX: i,
|
|
@@ -1483,8 +1483,8 @@ class st {
|
|
|
1483
1483
|
hasSourceArrow: this.hasSourceArrow,
|
|
1484
1484
|
hasTargetArrow: this.hasTargetArrow
|
|
1485
1485
|
}));
|
|
1486
|
-
|
|
1487
|
-
to:
|
|
1486
|
+
o(this, "createLinePath", (e, t, s) => new Je({
|
|
1487
|
+
to: s,
|
|
1488
1488
|
sourceDirection: e,
|
|
1489
1489
|
targetDirection: t,
|
|
1490
1490
|
arrowLength: this.arrowLength,
|
|
@@ -1492,10 +1492,10 @@ class st {
|
|
|
1492
1492
|
hasSourceArrow: this.hasSourceArrow,
|
|
1493
1493
|
hasTargetArrow: this.hasTargetArrow
|
|
1494
1494
|
}));
|
|
1495
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1496
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1497
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1498
|
-
arrowRenderer:
|
|
1495
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? f.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? f.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? f.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
|
|
1496
|
+
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1497
|
+
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1498
|
+
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1499
1499
|
arrowLength: this.arrowLength,
|
|
1500
1500
|
hasSourceArrow: this.hasSourceArrow,
|
|
1501
1501
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1508,23 +1508,23 @@ class st {
|
|
|
1508
1508
|
this.pathShape.render(e);
|
|
1509
1509
|
}
|
|
1510
1510
|
}
|
|
1511
|
-
class
|
|
1511
|
+
class ct {
|
|
1512
1512
|
constructor(e) {
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1513
|
+
o(this, "svg");
|
|
1514
|
+
o(this, "group");
|
|
1515
|
+
o(this, "line");
|
|
1516
|
+
o(this, "sourceArrow");
|
|
1517
|
+
o(this, "targetArrow");
|
|
1518
|
+
o(this, "onAfterRender");
|
|
1519
|
+
o(this, "arrowLength");
|
|
1520
|
+
o(this, "arrowOffset");
|
|
1521
|
+
o(this, "roundness");
|
|
1522
|
+
o(this, "cycleSquareSide");
|
|
1523
|
+
o(this, "detourDistance");
|
|
1524
|
+
o(this, "hasSourceArrow");
|
|
1525
|
+
o(this, "hasTargetArrow");
|
|
1526
|
+
o(this, "pathShape");
|
|
1527
|
+
o(this, "createCyclePath", (e) => new J({
|
|
1528
1528
|
sourceDirection: e,
|
|
1529
1529
|
arrowLength: this.arrowLength,
|
|
1530
1530
|
side: this.cycleSquareSide,
|
|
@@ -1533,8 +1533,8 @@ class it {
|
|
|
1533
1533
|
hasSourceArrow: this.hasSourceArrow,
|
|
1534
1534
|
hasTargetArrow: this.hasTargetArrow
|
|
1535
1535
|
}));
|
|
1536
|
-
|
|
1537
|
-
to:
|
|
1536
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new ot({
|
|
1537
|
+
to: s,
|
|
1538
1538
|
sourceDirection: e,
|
|
1539
1539
|
targetDirection: t,
|
|
1540
1540
|
flipX: i,
|
|
@@ -1546,8 +1546,8 @@ class it {
|
|
|
1546
1546
|
hasSourceArrow: this.hasSourceArrow,
|
|
1547
1547
|
hasTargetArrow: this.hasTargetArrow
|
|
1548
1548
|
}));
|
|
1549
|
-
|
|
1550
|
-
to:
|
|
1549
|
+
o(this, "createLinePath", (e, t, s, i) => new qe({
|
|
1550
|
+
to: s,
|
|
1551
1551
|
sourceDirection: e,
|
|
1552
1552
|
targetDirection: t,
|
|
1553
1553
|
flipX: i,
|
|
@@ -1557,16 +1557,16 @@ class it {
|
|
|
1557
1557
|
hasSourceArrow: this.hasSourceArrow,
|
|
1558
1558
|
hasTargetArrow: this.hasTargetArrow
|
|
1559
1559
|
}));
|
|
1560
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1561
|
-
const t = (e == null ? void 0 : e.roundness) ??
|
|
1560
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
|
|
1561
|
+
const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
|
|
1562
1562
|
this.roundness = Math.min(
|
|
1563
1563
|
t,
|
|
1564
1564
|
this.arrowOffset,
|
|
1565
1565
|
this.cycleSquareSide / 2
|
|
1566
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ??
|
|
1567
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1568
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1569
|
-
arrowRenderer:
|
|
1566
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
|
|
1567
|
+
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1568
|
+
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1569
|
+
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1570
1570
|
arrowLength: this.arrowLength,
|
|
1571
1571
|
hasSourceArrow: this.hasSourceArrow,
|
|
1572
1572
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1579,24 +1579,24 @@ class it {
|
|
|
1579
1579
|
this.pathShape.render(e);
|
|
1580
1580
|
}
|
|
1581
1581
|
}
|
|
1582
|
-
class
|
|
1582
|
+
class lt {
|
|
1583
1583
|
constructor(e) {
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1584
|
+
o(this, "svg");
|
|
1585
|
+
o(this, "group");
|
|
1586
|
+
o(this, "line");
|
|
1587
|
+
o(this, "sourceArrow");
|
|
1588
|
+
o(this, "targetArrow");
|
|
1589
|
+
o(this, "onAfterRender");
|
|
1590
|
+
o(this, "arrowLength");
|
|
1591
|
+
o(this, "arrowOffset");
|
|
1592
|
+
o(this, "roundness");
|
|
1593
|
+
o(this, "cycleSquareSide");
|
|
1594
|
+
o(this, "detourDirection");
|
|
1595
|
+
o(this, "detourDistance");
|
|
1596
|
+
o(this, "hasSourceArrow");
|
|
1597
|
+
o(this, "hasTargetArrow");
|
|
1598
|
+
o(this, "pathShape");
|
|
1599
|
+
o(this, "createCyclePath", (e) => new J({
|
|
1600
1600
|
sourceDirection: e,
|
|
1601
1601
|
arrowLength: this.arrowLength,
|
|
1602
1602
|
side: this.cycleSquareSide,
|
|
@@ -1605,8 +1605,8 @@ class nt {
|
|
|
1605
1605
|
hasSourceArrow: this.hasSourceArrow,
|
|
1606
1606
|
hasTargetArrow: this.hasTargetArrow
|
|
1607
1607
|
}));
|
|
1608
|
-
|
|
1609
|
-
to:
|
|
1608
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new _e({
|
|
1609
|
+
to: s,
|
|
1610
1610
|
sourceDirection: e,
|
|
1611
1611
|
targetDirection: t,
|
|
1612
1612
|
flipX: i,
|
|
@@ -1619,8 +1619,8 @@ class nt {
|
|
|
1619
1619
|
hasSourceArrow: this.hasSourceArrow,
|
|
1620
1620
|
hasTargetArrow: this.hasTargetArrow
|
|
1621
1621
|
}));
|
|
1622
|
-
|
|
1623
|
-
to:
|
|
1622
|
+
o(this, "createLinePath", (e, t, s) => new et({
|
|
1623
|
+
to: s,
|
|
1624
1624
|
sourceDirection: e,
|
|
1625
1625
|
targetDirection: t,
|
|
1626
1626
|
arrowLength: this.arrowLength,
|
|
@@ -1629,16 +1629,16 @@ class nt {
|
|
|
1629
1629
|
hasSourceArrow: this.hasSourceArrow,
|
|
1630
1630
|
hasTargetArrow: this.hasTargetArrow
|
|
1631
1631
|
}));
|
|
1632
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1633
|
-
const t = (e == null ? void 0 : e.roundness) ??
|
|
1632
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
|
|
1633
|
+
const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
|
|
1634
1634
|
this.roundness = Math.min(
|
|
1635
1635
|
t,
|
|
1636
1636
|
this.arrowOffset,
|
|
1637
1637
|
this.cycleSquareSide / 2
|
|
1638
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ??
|
|
1639
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1640
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1641
|
-
arrowRenderer:
|
|
1638
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
|
|
1639
|
+
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1640
|
+
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1641
|
+
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1642
1642
|
arrowLength: this.arrowLength,
|
|
1643
1643
|
hasSourceArrow: this.hasSourceArrow,
|
|
1644
1644
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1651,23 +1651,23 @@ class nt {
|
|
|
1651
1651
|
this.pathShape.render(e);
|
|
1652
1652
|
}
|
|
1653
1653
|
}
|
|
1654
|
-
class
|
|
1654
|
+
class gt {
|
|
1655
1655
|
constructor(e) {
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1656
|
+
o(this, "svg");
|
|
1657
|
+
o(this, "group");
|
|
1658
|
+
o(this, "line");
|
|
1659
|
+
o(this, "sourceArrow");
|
|
1660
|
+
o(this, "targetArrow");
|
|
1661
|
+
o(this, "onAfterRender");
|
|
1662
|
+
o(this, "arrowLength");
|
|
1663
|
+
o(this, "arrowOffset");
|
|
1664
|
+
o(this, "roundness");
|
|
1665
|
+
o(this, "cycleSquareSide");
|
|
1666
|
+
o(this, "detourDistance");
|
|
1667
|
+
o(this, "hasSourceArrow");
|
|
1668
|
+
o(this, "hasTargetArrow");
|
|
1669
|
+
o(this, "pathShape");
|
|
1670
|
+
o(this, "createCyclePath", (e) => new J({
|
|
1671
1671
|
sourceDirection: e,
|
|
1672
1672
|
arrowLength: this.arrowLength,
|
|
1673
1673
|
side: this.cycleSquareSide,
|
|
@@ -1676,8 +1676,8 @@ class at {
|
|
|
1676
1676
|
hasSourceArrow: this.hasSourceArrow,
|
|
1677
1677
|
hasTargetArrow: this.hasTargetArrow
|
|
1678
1678
|
}));
|
|
1679
|
-
|
|
1680
|
-
to:
|
|
1679
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new it({
|
|
1680
|
+
to: s,
|
|
1681
1681
|
sourceDirection: e,
|
|
1682
1682
|
targetDirection: t,
|
|
1683
1683
|
flipX: i,
|
|
@@ -1689,8 +1689,8 @@ class at {
|
|
|
1689
1689
|
hasSourceArrow: this.hasSourceArrow,
|
|
1690
1690
|
hasTargetArrow: this.hasTargetArrow
|
|
1691
1691
|
}));
|
|
1692
|
-
|
|
1693
|
-
to:
|
|
1692
|
+
o(this, "createLinePath", (e, t, s, i, n) => new tt({
|
|
1693
|
+
to: s,
|
|
1694
1694
|
sourceDirection: e,
|
|
1695
1695
|
targetDirection: t,
|
|
1696
1696
|
flipY: n,
|
|
@@ -1700,16 +1700,16 @@ class at {
|
|
|
1700
1700
|
hasSourceArrow: this.hasSourceArrow,
|
|
1701
1701
|
hasTargetArrow: this.hasTargetArrow
|
|
1702
1702
|
}));
|
|
1703
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1704
|
-
const t = (e == null ? void 0 : e.roundness) ??
|
|
1703
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowOffset = (e == null ? void 0 : e.arrowOffset) ?? f.arrowOffset, this.cycleSquareSide = (e == null ? void 0 : e.cycleSquareSide) ?? f.cycleSquareSide;
|
|
1704
|
+
const t = (e == null ? void 0 : e.roundness) ?? f.roundness;
|
|
1705
1705
|
this.roundness = Math.min(
|
|
1706
1706
|
t,
|
|
1707
1707
|
this.arrowOffset,
|
|
1708
1708
|
this.cycleSquareSide / 2
|
|
1709
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ??
|
|
1710
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1711
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1712
|
-
arrowRenderer:
|
|
1709
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new k({
|
|
1710
|
+
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1711
|
+
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1712
|
+
arrowRenderer: I((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1713
1713
|
arrowLength: this.arrowLength,
|
|
1714
1714
|
hasSourceArrow: this.hasSourceArrow,
|
|
1715
1715
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1724,28 +1724,28 @@ class at {
|
|
|
1724
1724
|
}
|
|
1725
1725
|
class Ne {
|
|
1726
1726
|
constructor(e) {
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
[this.afterRenderEmitter, this.onAfterRender] =
|
|
1727
|
+
o(this, "svg");
|
|
1728
|
+
o(this, "group", Te());
|
|
1729
|
+
o(this, "line");
|
|
1730
|
+
o(this, "sourceArrow", null);
|
|
1731
|
+
o(this, "targetArrow", null);
|
|
1732
|
+
o(this, "color");
|
|
1733
|
+
o(this, "width");
|
|
1734
|
+
o(this, "arrowLength");
|
|
1735
|
+
o(this, "sourceOffset");
|
|
1736
|
+
o(this, "targetOffset");
|
|
1737
|
+
o(this, "onAfterRender");
|
|
1738
|
+
o(this, "afterRenderEmitter");
|
|
1739
|
+
o(this, "arrowRenderer");
|
|
1740
|
+
[this.afterRenderEmitter, this.onAfterRender] = x(), this.color = (e == null ? void 0 : e.color) ?? f.color, this.width = (e == null ? void 0 : e.width) ?? f.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowRenderer = I((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? f.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? f.preOffset, this.svg = Pe(this.color), this.svg.appendChild(this.group), this.line = be(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = O(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = O(), this.group.appendChild(this.targetArrow));
|
|
1741
1741
|
}
|
|
1742
1742
|
render(e) {
|
|
1743
|
-
const { x: t, y:
|
|
1743
|
+
const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Se(
|
|
1744
1744
|
e.from,
|
|
1745
1745
|
e.to
|
|
1746
1746
|
);
|
|
1747
|
-
|
|
1748
|
-
const d = { x: i, y: n }, c = new
|
|
1747
|
+
De(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1748
|
+
const d = { x: i, y: n }, c = new st({
|
|
1749
1749
|
to: d,
|
|
1750
1750
|
sourceOffset: this.sourceOffset,
|
|
1751
1751
|
targetOffset: this.targetOffset,
|
|
@@ -1754,82 +1754,82 @@ class Ne {
|
|
|
1754
1754
|
arrowLength: this.arrowLength
|
|
1755
1755
|
});
|
|
1756
1756
|
this.line.setAttribute("d", c.path);
|
|
1757
|
-
let
|
|
1758
|
-
const
|
|
1759
|
-
if (
|
|
1760
|
-
this.sourceArrow !== null && (
|
|
1757
|
+
let g = null, l = null;
|
|
1758
|
+
const u = c.diagonalDistance;
|
|
1759
|
+
if (u === 0)
|
|
1760
|
+
this.sourceArrow !== null && (g = "", this.sourceArrow.setAttribute("d", g)), this.targetArrow !== null && (l = "", this.targetArrow.setAttribute("d", l));
|
|
1761
1761
|
else {
|
|
1762
|
-
const
|
|
1763
|
-
x: d.x /
|
|
1764
|
-
y: d.y /
|
|
1762
|
+
const w = {
|
|
1763
|
+
x: d.x / u,
|
|
1764
|
+
y: d.y / u
|
|
1765
1765
|
};
|
|
1766
1766
|
if (this.sourceArrow) {
|
|
1767
1767
|
const y = {
|
|
1768
|
-
x:
|
|
1769
|
-
y:
|
|
1768
|
+
x: w.x * this.sourceOffset,
|
|
1769
|
+
y: w.y * this.sourceOffset
|
|
1770
1770
|
};
|
|
1771
|
-
|
|
1772
|
-
direction:
|
|
1771
|
+
g = this.arrowRenderer({
|
|
1772
|
+
direction: w,
|
|
1773
1773
|
shift: y,
|
|
1774
1774
|
arrowLength: this.arrowLength
|
|
1775
|
-
}), this.sourceArrow.setAttribute("d",
|
|
1775
|
+
}), this.sourceArrow.setAttribute("d", g);
|
|
1776
1776
|
}
|
|
1777
1777
|
if (this.targetArrow) {
|
|
1778
1778
|
const y = {
|
|
1779
|
-
x:
|
|
1780
|
-
y:
|
|
1779
|
+
x: w.x * this.targetOffset,
|
|
1780
|
+
y: w.y * this.targetOffset
|
|
1781
1781
|
};
|
|
1782
|
-
|
|
1783
|
-
direction: { x: -
|
|
1782
|
+
l = this.arrowRenderer({
|
|
1783
|
+
direction: { x: -w.x, y: -w.y },
|
|
1784
1784
|
shift: {
|
|
1785
1785
|
x: d.x - y.x,
|
|
1786
1786
|
y: d.y - y.y
|
|
1787
1787
|
},
|
|
1788
1788
|
arrowLength: this.arrowLength
|
|
1789
|
-
}), this.targetArrow.setAttribute("d",
|
|
1789
|
+
}), this.targetArrow.setAttribute("d", l);
|
|
1790
1790
|
}
|
|
1791
1791
|
}
|
|
1792
1792
|
this.afterRenderEmitter.emit({
|
|
1793
1793
|
edgePath: c,
|
|
1794
|
-
sourceArrowPath:
|
|
1795
|
-
targetArrowPath:
|
|
1794
|
+
sourceArrowPath: g,
|
|
1795
|
+
targetArrowPath: l
|
|
1796
1796
|
});
|
|
1797
1797
|
}
|
|
1798
1798
|
}
|
|
1799
|
-
const
|
|
1799
|
+
const ut = () => {
|
|
1800
1800
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1801
1801
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
1802
|
-
},
|
|
1802
|
+
}, pt = (r) => {
|
|
1803
1803
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1804
1804
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
1805
|
-
},
|
|
1805
|
+
}, ue = (r) => {
|
|
1806
1806
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1807
1807
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
1808
1808
|
};
|
|
1809
|
-
class
|
|
1809
|
+
class wt extends Error {
|
|
1810
1810
|
constructor(e) {
|
|
1811
1811
|
super(e), this.name = "InteractiveEdgeError";
|
|
1812
1812
|
}
|
|
1813
1813
|
}
|
|
1814
|
-
class
|
|
1814
|
+
class Me {
|
|
1815
1815
|
constructor(e, t) {
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
if (this.baseEdge = e, e instanceof
|
|
1827
|
-
throw new
|
|
1816
|
+
o(this, "svg");
|
|
1817
|
+
o(this, "group");
|
|
1818
|
+
o(this, "line");
|
|
1819
|
+
o(this, "sourceArrow");
|
|
1820
|
+
o(this, "targetArrow");
|
|
1821
|
+
o(this, "handle", ut());
|
|
1822
|
+
o(this, "onAfterRender");
|
|
1823
|
+
o(this, "interactiveLine");
|
|
1824
|
+
o(this, "interactiveSourceArrow", null);
|
|
1825
|
+
o(this, "interactiveTargetArrow", null);
|
|
1826
|
+
if (this.baseEdge = e, e instanceof Me)
|
|
1827
|
+
throw new wt(
|
|
1828
1828
|
"interactive edge can be configured only once"
|
|
1829
1829
|
);
|
|
1830
1830
|
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;
|
|
1831
|
-
const
|
|
1832
|
-
this.interactiveLine =
|
|
1831
|
+
const s = (t == null ? void 0 : t.distance) ?? f.interactiveWidth;
|
|
1832
|
+
this.interactiveLine = pt(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ue(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ue(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
|
|
1833
1833
|
this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
|
|
1834
1834
|
});
|
|
1835
1835
|
}
|
|
@@ -1837,16 +1837,16 @@ class De {
|
|
|
1837
1837
|
this.baseEdge.render(e);
|
|
1838
1838
|
}
|
|
1839
1839
|
}
|
|
1840
|
-
class
|
|
1840
|
+
class Jt {
|
|
1841
1841
|
constructor(e, t) {
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
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((
|
|
1849
|
-
const i =
|
|
1842
|
+
o(this, "group");
|
|
1843
|
+
o(this, "line");
|
|
1844
|
+
o(this, "sourceArrow");
|
|
1845
|
+
o(this, "targetArrow");
|
|
1846
|
+
o(this, "onAfterRender");
|
|
1847
|
+
o(this, "svg");
|
|
1848
|
+
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) => {
|
|
1849
|
+
const i = s.edgePath.midpoint, n = `translate(${i.x}px, ${i.y}px)`;
|
|
1850
1850
|
this.midpointElement.style.setProperty("transform", n);
|
|
1851
1851
|
});
|
|
1852
1852
|
}
|
|
@@ -1856,32 +1856,32 @@ class kt {
|
|
|
1856
1856
|
}
|
|
1857
1857
|
class Le {
|
|
1858
1858
|
constructor(e) {
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1859
|
+
o(this, "onAfterNodeAdded");
|
|
1860
|
+
o(this, "onAfterNodeUpdated");
|
|
1861
|
+
o(this, "onAfterNodePriorityUpdated");
|
|
1862
|
+
o(this, "onBeforeNodeRemoved");
|
|
1863
|
+
o(this, "onAfterPortMarked");
|
|
1864
|
+
o(this, "onAfterPortUpdated");
|
|
1865
|
+
o(this, "onBeforePortUnmarked");
|
|
1866
|
+
o(this, "onAfterEdgeAdded");
|
|
1867
|
+
o(this, "onAfterEdgeShapeUpdated");
|
|
1868
|
+
o(this, "onAfterEdgeUpdated");
|
|
1869
|
+
o(this, "onAfterEdgePriorityUpdated");
|
|
1870
|
+
o(this, "onBeforeEdgeRemoved");
|
|
1871
|
+
o(this, "onBeforeClear");
|
|
1872
1872
|
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;
|
|
1873
1873
|
}
|
|
1874
1874
|
getNode(e) {
|
|
1875
1875
|
const t = this.graphStore.getNode(e);
|
|
1876
1876
|
if (t === void 0)
|
|
1877
1877
|
return null;
|
|
1878
|
-
const
|
|
1878
|
+
const s = t.payload;
|
|
1879
1879
|
return {
|
|
1880
1880
|
element: t.element,
|
|
1881
|
-
x:
|
|
1882
|
-
y:
|
|
1883
|
-
centerFn:
|
|
1884
|
-
priority:
|
|
1881
|
+
x: s.x,
|
|
1882
|
+
y: s.y,
|
|
1883
|
+
centerFn: s.centerFn,
|
|
1884
|
+
priority: s.priority
|
|
1885
1885
|
};
|
|
1886
1886
|
}
|
|
1887
1887
|
getElementNodeId(e) {
|
|
@@ -1914,12 +1914,12 @@ class Le {
|
|
|
1914
1914
|
const t = this.graphStore.getEdge(e);
|
|
1915
1915
|
if (t === void 0)
|
|
1916
1916
|
return null;
|
|
1917
|
-
const
|
|
1917
|
+
const s = t.payload;
|
|
1918
1918
|
return {
|
|
1919
1919
|
from: t.from,
|
|
1920
1920
|
to: t.to,
|
|
1921
|
-
priority:
|
|
1922
|
-
shape:
|
|
1921
|
+
priority: s.priority,
|
|
1922
|
+
shape: s.shape
|
|
1923
1923
|
};
|
|
1924
1924
|
}
|
|
1925
1925
|
getPortIncomingEdgeIds(e) {
|
|
@@ -1947,9 +1947,9 @@ class Le {
|
|
|
1947
1947
|
return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
|
|
1948
1948
|
}
|
|
1949
1949
|
}
|
|
1950
|
-
class
|
|
1950
|
+
class Re {
|
|
1951
1951
|
constructor(e) {
|
|
1952
|
-
|
|
1952
|
+
o(this, "onAfterUpdated");
|
|
1953
1953
|
this.viewportStore = e, this.onAfterUpdated = this.viewportStore.onAfterUpdated;
|
|
1954
1954
|
}
|
|
1955
1955
|
getViewportMatrix() {
|
|
@@ -1959,10 +1959,10 @@ class Me {
|
|
|
1959
1959
|
return { ...this.viewportStore.getContentMatrix() };
|
|
1960
1960
|
}
|
|
1961
1961
|
}
|
|
1962
|
-
const
|
|
1963
|
-
const t = new
|
|
1962
|
+
const Ce = (r, e) => {
|
|
1963
|
+
const t = new Ee(), s = new Le(t), i = new Re(e), n = new me(t, e, r), a = {
|
|
1964
1964
|
nodes: {
|
|
1965
|
-
centerFn:
|
|
1965
|
+
centerFn: xe,
|
|
1966
1966
|
priorityFn: () => 0
|
|
1967
1967
|
},
|
|
1968
1968
|
edges: {
|
|
@@ -1973,8 +1973,8 @@ const Re = (r, e) => {
|
|
|
1973
1973
|
direction: 0
|
|
1974
1974
|
}
|
|
1975
1975
|
};
|
|
1976
|
-
return new
|
|
1977
|
-
|
|
1976
|
+
return new ve(
|
|
1977
|
+
s,
|
|
1978
1978
|
i,
|
|
1979
1979
|
t,
|
|
1980
1980
|
e,
|
|
@@ -1982,21 +1982,21 @@ const Re = (r, e) => {
|
|
|
1982
1982
|
a
|
|
1983
1983
|
);
|
|
1984
1984
|
};
|
|
1985
|
-
class
|
|
1986
|
-
constructor(e, t,
|
|
1987
|
-
|
|
1985
|
+
class z {
|
|
1986
|
+
constructor(e, t, s, i) {
|
|
1987
|
+
o(this, "onAfterPortMarked", (e) => {
|
|
1988
1988
|
const t = this.canvas.graph.getPort(e);
|
|
1989
1989
|
this.canvas.graph.getElementPortIds(t.element).length === 1 && this.hookPortEvents(t.element);
|
|
1990
1990
|
});
|
|
1991
|
-
|
|
1991
|
+
o(this, "onBeforePortUnmarked", (e) => {
|
|
1992
1992
|
const t = this.canvas.graph.getPort(e);
|
|
1993
1993
|
this.canvas.graph.getElementPortIds(t.element).length === 1 && this.unhookPortEvents(t.element);
|
|
1994
1994
|
});
|
|
1995
|
-
|
|
1995
|
+
o(this, "onPortMouseDown", (e) => {
|
|
1996
1996
|
if (!this.params.mouseDownEventVerifier(e))
|
|
1997
1997
|
return;
|
|
1998
|
-
const t = e.currentTarget,
|
|
1999
|
-
this.params.onPortPointerDown(
|
|
1998
|
+
const t = e.currentTarget, s = this.canvas.graph.getElementPortIds(t)[0];
|
|
1999
|
+
this.params.onPortPointerDown(s, {
|
|
2000
2000
|
x: e.clientX,
|
|
2001
2001
|
y: e.clientY
|
|
2002
2002
|
}) && (e.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
@@ -2005,8 +2005,8 @@ class k {
|
|
|
2005
2005
|
passive: !0
|
|
2006
2006
|
}));
|
|
2007
2007
|
});
|
|
2008
|
-
|
|
2009
|
-
if (!
|
|
2008
|
+
o(this, "onWindowMouseMove", (e) => {
|
|
2009
|
+
if (!V(
|
|
2010
2010
|
this.window,
|
|
2011
2011
|
this.element,
|
|
2012
2012
|
e.clientX,
|
|
@@ -2017,13 +2017,13 @@ class k {
|
|
|
2017
2017
|
}
|
|
2018
2018
|
this.params.onPointerMove({ x: e.clientX, y: e.clientY });
|
|
2019
2019
|
});
|
|
2020
|
-
|
|
2020
|
+
o(this, "onWindowMouseUp", (e) => {
|
|
2021
2021
|
this.params.mouseUpEventVerifier(e) && (this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
|
|
2022
2022
|
});
|
|
2023
|
-
|
|
2023
|
+
o(this, "onPortTouchStart", (e) => {
|
|
2024
2024
|
if (e.touches.length !== 1)
|
|
2025
2025
|
return;
|
|
2026
|
-
const t = e.touches[0],
|
|
2026
|
+
const t = e.touches[0], s = e.currentTarget, i = this.canvas.graph.getElementPortIds(s)[0];
|
|
2027
2027
|
this.params.onPortPointerDown(i, {
|
|
2028
2028
|
x: t.clientX,
|
|
2029
2029
|
y: t.clientY
|
|
@@ -2035,9 +2035,9 @@ class k {
|
|
|
2035
2035
|
passive: !0
|
|
2036
2036
|
}));
|
|
2037
2037
|
});
|
|
2038
|
-
|
|
2038
|
+
o(this, "onWindowTouchMove", (e) => {
|
|
2039
2039
|
const t = e.touches[0];
|
|
2040
|
-
if (!
|
|
2040
|
+
if (!V(
|
|
2041
2041
|
this.window,
|
|
2042
2042
|
this.element,
|
|
2043
2043
|
t.clientX,
|
|
@@ -2048,23 +2048,23 @@ class k {
|
|
|
2048
2048
|
}
|
|
2049
2049
|
this.params.onPointerMove({ x: t.clientX, y: t.clientY });
|
|
2050
2050
|
});
|
|
2051
|
-
|
|
2051
|
+
o(this, "onWindowTouchFinish", (e) => {
|
|
2052
2052
|
const t = e.changedTouches[0];
|
|
2053
2053
|
this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
|
|
2054
2054
|
});
|
|
2055
|
-
|
|
2055
|
+
o(this, "onBeforeClear", () => {
|
|
2056
2056
|
this.canvas.graph.getAllPortIds().forEach((e) => {
|
|
2057
2057
|
const t = this.canvas.graph.getPort(e);
|
|
2058
2058
|
this.unhookPortEvents(t.element);
|
|
2059
2059
|
});
|
|
2060
2060
|
});
|
|
2061
|
-
|
|
2061
|
+
o(this, "onBeforeDestroy", () => {
|
|
2062
2062
|
this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
2063
2063
|
});
|
|
2064
|
-
this.canvas = e, this.element = t, this.window =
|
|
2064
|
+
this.canvas = e, this.element = t, this.window = s, this.params = i, 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);
|
|
2065
2065
|
}
|
|
2066
|
-
static configure(e, t,
|
|
2067
|
-
new
|
|
2066
|
+
static configure(e, t, s, i) {
|
|
2067
|
+
new z(e, t, s, i);
|
|
2068
2068
|
}
|
|
2069
2069
|
hookPortEvents(e) {
|
|
2070
2070
|
e.addEventListener("mousedown", this.onPortMouseDown, {
|
|
@@ -2089,12 +2089,12 @@ class k {
|
|
|
2089
2089
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2090
2090
|
}
|
|
2091
2091
|
}
|
|
2092
|
-
class
|
|
2093
|
-
constructor(e, t,
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2092
|
+
class Q {
|
|
2093
|
+
constructor(e, t, s, i) {
|
|
2094
|
+
o(this, "grabbedNode", null);
|
|
2095
|
+
o(this, "maxNodePriority", 0);
|
|
2096
|
+
o(this, "graph");
|
|
2097
|
+
o(this, "onAfterNodeAdded", (e) => {
|
|
2098
2098
|
this.updateMaxNodePriority(e);
|
|
2099
2099
|
const t = this.graph.getNode(e);
|
|
2100
2100
|
t.element.addEventListener("mousedown", this.onMouseDown, {
|
|
@@ -2103,27 +2103,27 @@ class J {
|
|
|
2103
2103
|
passive: !0
|
|
2104
2104
|
});
|
|
2105
2105
|
});
|
|
2106
|
-
|
|
2106
|
+
o(this, "onAfterNodeUpdated", (e) => {
|
|
2107
2107
|
this.updateMaxNodePriority(e);
|
|
2108
2108
|
});
|
|
2109
|
-
|
|
2109
|
+
o(this, "onBeforeNodeRemoved", (e) => {
|
|
2110
2110
|
const t = this.graph.getNode(e);
|
|
2111
2111
|
t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
|
|
2112
2112
|
});
|
|
2113
|
-
|
|
2113
|
+
o(this, "onBeforeDestroy", () => {
|
|
2114
2114
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2115
2115
|
});
|
|
2116
|
-
|
|
2116
|
+
o(this, "onBeforeClear", () => {
|
|
2117
2117
|
this.canvas.graph.getAllNodeIds().forEach((e) => {
|
|
2118
2118
|
const t = this.canvas.graph.getNode(e);
|
|
2119
2119
|
t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
|
|
2120
2120
|
}), this.maxNodePriority = 0;
|
|
2121
2121
|
});
|
|
2122
|
-
|
|
2122
|
+
o(this, "onMouseDown", (e) => {
|
|
2123
2123
|
if (!this.params.mouseDownEventVerifier(e))
|
|
2124
2124
|
return;
|
|
2125
|
-
const t = e.currentTarget,
|
|
2126
|
-
if (!this.params.nodeDragVerifier(
|
|
2125
|
+
const t = e.currentTarget, s = this.graph.getElementNodeId(t), i = this.graph.getNode(s);
|
|
2126
|
+
if (!this.params.nodeDragVerifier(s))
|
|
2127
2127
|
return;
|
|
2128
2128
|
e.stopPropagation();
|
|
2129
2129
|
const a = this.calculateContentPoint({
|
|
@@ -2131,20 +2131,20 @@ class J {
|
|
|
2131
2131
|
y: e.clientY
|
|
2132
2132
|
});
|
|
2133
2133
|
this.grabbedNode = {
|
|
2134
|
-
nodeId:
|
|
2134
|
+
nodeId: s,
|
|
2135
2135
|
dx: a.x - i.x,
|
|
2136
2136
|
dy: a.y - i.y
|
|
2137
|
-
},
|
|
2137
|
+
}, B(this.element, this.params.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2138
2138
|
passive: !0
|
|
2139
2139
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2140
2140
|
passive: !0
|
|
2141
2141
|
});
|
|
2142
2142
|
});
|
|
2143
|
-
|
|
2143
|
+
o(this, "onTouchStart", (e) => {
|
|
2144
2144
|
if (e.touches.length !== 1)
|
|
2145
2145
|
return;
|
|
2146
2146
|
e.stopPropagation();
|
|
2147
|
-
const t = e.touches[0],
|
|
2147
|
+
const t = e.touches[0], s = e.currentTarget, i = this.canvas.graph.getElementNodeId(s), n = this.graph.getNode(i);
|
|
2148
2148
|
if (!this.params.nodeDragVerifier({
|
|
2149
2149
|
nodeId: i,
|
|
2150
2150
|
element: n.element,
|
|
@@ -2168,8 +2168,8 @@ class J {
|
|
|
2168
2168
|
passive: !0
|
|
2169
2169
|
});
|
|
2170
2170
|
});
|
|
2171
|
-
|
|
2172
|
-
if (!
|
|
2171
|
+
o(this, "onWindowMouseMove", (e) => {
|
|
2172
|
+
if (!V(
|
|
2173
2173
|
this.window,
|
|
2174
2174
|
this.element,
|
|
2175
2175
|
e.clientX,
|
|
@@ -2183,14 +2183,14 @@ class J {
|
|
|
2183
2183
|
y: e.clientY
|
|
2184
2184
|
});
|
|
2185
2185
|
});
|
|
2186
|
-
|
|
2186
|
+
o(this, "onWindowMouseUp", (e) => {
|
|
2187
2187
|
this.params.mouseUpEventVerifier(e) && this.cancelMouseDrag();
|
|
2188
2188
|
});
|
|
2189
|
-
|
|
2189
|
+
o(this, "onWindowTouchMove", (e) => {
|
|
2190
2190
|
if (e.touches.length !== 1)
|
|
2191
2191
|
return;
|
|
2192
2192
|
const t = e.touches[0];
|
|
2193
|
-
if (!
|
|
2193
|
+
if (!V(
|
|
2194
2194
|
this.window,
|
|
2195
2195
|
this.element,
|
|
2196
2196
|
t.clientX,
|
|
@@ -2204,13 +2204,13 @@ class J {
|
|
|
2204
2204
|
y: t.clientY
|
|
2205
2205
|
});
|
|
2206
2206
|
});
|
|
2207
|
-
|
|
2207
|
+
o(this, "onWindowTouchFinish", () => {
|
|
2208
2208
|
this.cancelTouchDrag();
|
|
2209
2209
|
});
|
|
2210
|
-
this.canvas = e, this.element = t, this.window =
|
|
2210
|
+
this.canvas = e, this.element = t, this.window = s, this.params = i, 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);
|
|
2211
2211
|
}
|
|
2212
|
-
static configure(e, t,
|
|
2213
|
-
new
|
|
2212
|
+
static configure(e, t, s, i) {
|
|
2213
|
+
new Q(e, t, s, i);
|
|
2214
2214
|
}
|
|
2215
2215
|
moveNode(e, t) {
|
|
2216
2216
|
if (this.graph.getNode(e.nodeId) === null)
|
|
@@ -2236,7 +2236,7 @@ class J {
|
|
|
2236
2236
|
}
|
|
2237
2237
|
}
|
|
2238
2238
|
cancelMouseDrag() {
|
|
2239
|
-
this.grabbedNode !== null && this.graph.getNode(this.grabbedNode.nodeId) !== null && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null,
|
|
2239
|
+
this.grabbedNode !== null && this.graph.getNode(this.grabbedNode.nodeId) !== null && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, B(this.element, null), this.removeMouseDragListeners();
|
|
2240
2240
|
}
|
|
2241
2241
|
removeMouseDragListeners() {
|
|
2242
2242
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
@@ -2261,40 +2261,40 @@ class J {
|
|
|
2261
2261
|
this.maxNodePriority = Math.max(this.maxNodePriority, t);
|
|
2262
2262
|
}
|
|
2263
2263
|
calculateContentPoint(e) {
|
|
2264
|
-
const t = this.element.getBoundingClientRect(),
|
|
2264
|
+
const t = this.element.getBoundingClientRect(), s = {
|
|
2265
2265
|
x: e.x - t.x,
|
|
2266
2266
|
y: e.y - t.y
|
|
2267
2267
|
}, i = this.canvas.viewport.getViewportMatrix();
|
|
2268
|
-
return
|
|
2268
|
+
return D(i, s);
|
|
2269
2269
|
}
|
|
2270
2270
|
adjustNodeCoords(e) {
|
|
2271
2271
|
const t = this.params.gridSize;
|
|
2272
2272
|
if (t !== null) {
|
|
2273
|
-
const
|
|
2273
|
+
const s = t / 2;
|
|
2274
2274
|
return {
|
|
2275
|
-
x: Math.floor((e.x +
|
|
2276
|
-
y: Math.floor((e.y +
|
|
2275
|
+
x: Math.floor((e.x + s) / t) * t,
|
|
2276
|
+
y: Math.floor((e.y + s) / t) * t
|
|
2277
2277
|
};
|
|
2278
2278
|
}
|
|
2279
2279
|
return e;
|
|
2280
2280
|
}
|
|
2281
2281
|
}
|
|
2282
|
-
const
|
|
2282
|
+
const ft = (r, e, t) => ({
|
|
2283
2283
|
scale: r.scale,
|
|
2284
2284
|
x: r.x + r.scale * e,
|
|
2285
2285
|
y: r.y + r.scale * t
|
|
2286
|
-
}),
|
|
2286
|
+
}), yt = (r, e, t, s) => ({
|
|
2287
2287
|
scale: r.scale * e,
|
|
2288
2288
|
x: r.scale * (1 - e) * t + r.x,
|
|
2289
|
-
y: r.scale * (1 - e) *
|
|
2289
|
+
y: r.scale * (1 - e) * s + r.y
|
|
2290
2290
|
}), U = (r) => {
|
|
2291
2291
|
const e = [], t = r.touches.length;
|
|
2292
2292
|
for (let h = 0; h < t; h++)
|
|
2293
2293
|
e.push([r.touches[h].clientX, r.touches[h].clientY]);
|
|
2294
|
-
const
|
|
2294
|
+
const s = e.reduce(
|
|
2295
2295
|
(h, d) => [h[0] + d[0], h[1] + d[1]],
|
|
2296
2296
|
[0, 0]
|
|
2297
|
-
), i = [
|
|
2297
|
+
), i = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - i[0], h[1] - i[1]]).reduce(
|
|
2298
2298
|
(h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
|
|
2299
2299
|
0
|
|
2300
2300
|
);
|
|
@@ -2306,24 +2306,24 @@ const gt = (r, e, t) => ({
|
|
|
2306
2306
|
touches: e
|
|
2307
2307
|
};
|
|
2308
2308
|
};
|
|
2309
|
-
class
|
|
2310
|
-
constructor(e, t,
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2309
|
+
class X {
|
|
2310
|
+
constructor(e, t, s, i) {
|
|
2311
|
+
o(this, "viewport");
|
|
2312
|
+
o(this, "prevTouches", null);
|
|
2313
|
+
o(this, "wheelFinishTimer", null);
|
|
2314
|
+
o(this, "transformInProgress", !1);
|
|
2315
|
+
o(this, "onBeforeDestroy", () => {
|
|
2316
2316
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2317
2317
|
});
|
|
2318
|
-
|
|
2319
|
-
this.element === null || !this.params.mouseDownEventVerifier(e) || (
|
|
2318
|
+
o(this, "onMouseDown", (e) => {
|
|
2319
|
+
this.element === null || !this.params.mouseDownEventVerifier(e) || (B(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2320
2320
|
passive: !0
|
|
2321
2321
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2322
2322
|
passive: !0
|
|
2323
2323
|
}), this.startRegisteredTransform());
|
|
2324
2324
|
});
|
|
2325
|
-
|
|
2326
|
-
const t =
|
|
2325
|
+
o(this, "onWindowMouseMove", (e) => {
|
|
2326
|
+
const t = V(
|
|
2327
2327
|
this.window,
|
|
2328
2328
|
this.element,
|
|
2329
2329
|
e.clientX,
|
|
@@ -2333,21 +2333,21 @@ class z {
|
|
|
2333
2333
|
this.stopMouseDrag();
|
|
2334
2334
|
return;
|
|
2335
2335
|
}
|
|
2336
|
-
const
|
|
2337
|
-
this.moveViewport(
|
|
2336
|
+
const s = -e.movementX, i = -e.movementY;
|
|
2337
|
+
this.moveViewport(s, i);
|
|
2338
2338
|
});
|
|
2339
|
-
|
|
2339
|
+
o(this, "onWindowMouseUp", (e) => {
|
|
2340
2340
|
this.element === null || !this.params.mouseUpEventVerifier(e) || this.stopMouseDrag();
|
|
2341
2341
|
});
|
|
2342
|
-
|
|
2342
|
+
o(this, "onWheelScroll", (e) => {
|
|
2343
2343
|
if (!this.params.mouseWheelEventVerifier(e))
|
|
2344
2344
|
return;
|
|
2345
|
-
const { left: t, top:
|
|
2345
|
+
const { left: t, top: s } = this.element.getBoundingClientRect(), i = e.clientX - t, n = e.clientY - s, h = 1 / (e.deltaY < 0 ? this.params.wheelSensitivity : 1 / this.params.wheelSensitivity);
|
|
2346
2346
|
this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, i, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
|
|
2347
2347
|
this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
|
|
2348
2348
|
}, this.params.scaleWheelFinishTimeout);
|
|
2349
2349
|
});
|
|
2350
|
-
|
|
2350
|
+
o(this, "onTouchStart", (e) => {
|
|
2351
2351
|
if (this.prevTouches !== null) {
|
|
2352
2352
|
this.prevTouches = U(e);
|
|
2353
2353
|
return;
|
|
@@ -2360,10 +2360,10 @@ class z {
|
|
|
2360
2360
|
passive: !0
|
|
2361
2361
|
}), this.startRegisteredTransform();
|
|
2362
2362
|
});
|
|
2363
|
-
|
|
2363
|
+
o(this, "onWindowTouchMove", (e) => {
|
|
2364
2364
|
const t = U(e);
|
|
2365
2365
|
if (!t.touches.every(
|
|
2366
|
-
(i) =>
|
|
2366
|
+
(i) => V(this.window, this.element, i[0], i[1])
|
|
2367
2367
|
)) {
|
|
2368
2368
|
this.stopTouchDrag();
|
|
2369
2369
|
return;
|
|
@@ -2377,22 +2377,22 @@ class z {
|
|
|
2377
2377
|
}
|
|
2378
2378
|
this.prevTouches = t;
|
|
2379
2379
|
});
|
|
2380
|
-
|
|
2380
|
+
o(this, "onWindowTouchFinish", (e) => {
|
|
2381
2381
|
e.touches.length > 0 ? this.prevTouches = U(e) : this.stopTouchDrag();
|
|
2382
2382
|
});
|
|
2383
|
-
|
|
2384
|
-
const e = this.viewport.getViewportMatrix(), { width: t, height:
|
|
2383
|
+
o(this, "observer", new ResizeObserver(() => {
|
|
2384
|
+
const e = this.viewport.getViewportMatrix(), { width: t, height: s } = this.element.getBoundingClientRect(), i = this.params.transformPreprocessor({
|
|
2385
2385
|
prevTransform: e,
|
|
2386
2386
|
nextTransform: e,
|
|
2387
2387
|
canvasWidth: t,
|
|
2388
|
-
canvasHeight:
|
|
2388
|
+
canvasHeight: s
|
|
2389
2389
|
});
|
|
2390
2390
|
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.params.onResizeTransformFinished();
|
|
2391
2391
|
}));
|
|
2392
|
-
|
|
2392
|
+
o(this, "preventWheelScaleListener", (e) => {
|
|
2393
2393
|
e.preventDefault();
|
|
2394
2394
|
});
|
|
2395
|
-
this.canvas = e, this.element = t, this.window =
|
|
2395
|
+
this.canvas = e, this.element = t, this.window = s, this.params = i, this.element.addEventListener("wheel", this.preventWheelScaleListener, {
|
|
2396
2396
|
passive: !1
|
|
2397
2397
|
}), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
|
|
2398
2398
|
passive: !0
|
|
@@ -2402,20 +2402,20 @@ class z {
|
|
|
2402
2402
|
passive: !0
|
|
2403
2403
|
}), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2404
2404
|
}
|
|
2405
|
-
static configure(e, t,
|
|
2406
|
-
new
|
|
2405
|
+
static configure(e, t, s, i) {
|
|
2406
|
+
new X(e, t, s, i);
|
|
2407
2407
|
}
|
|
2408
2408
|
moveViewport(e, t) {
|
|
2409
|
-
const
|
|
2410
|
-
prevTransform:
|
|
2409
|
+
const s = this.viewport.getViewportMatrix(), i = ft(s, e, t), { width: n, height: a } = this.element.getBoundingClientRect(), h = this.params.transformPreprocessor({
|
|
2410
|
+
prevTransform: s,
|
|
2411
2411
|
nextTransform: i,
|
|
2412
2412
|
canvasWidth: n,
|
|
2413
2413
|
canvasHeight: a
|
|
2414
2414
|
});
|
|
2415
2415
|
this.performTransform(h);
|
|
2416
2416
|
}
|
|
2417
|
-
scaleViewport(e, t,
|
|
2418
|
-
const i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2417
|
+
scaleViewport(e, t, s) {
|
|
2418
|
+
const i = this.canvas.viewport.getViewportMatrix(), n = yt(i, e, t, s), { width: a, height: h } = this.element.getBoundingClientRect(), d = this.params.transformPreprocessor({
|
|
2419
2419
|
prevTransform: i,
|
|
2420
2420
|
nextTransform: n,
|
|
2421
2421
|
canvasWidth: a,
|
|
@@ -2424,7 +2424,7 @@ class z {
|
|
|
2424
2424
|
this.performTransform(d);
|
|
2425
2425
|
}
|
|
2426
2426
|
stopMouseDrag() {
|
|
2427
|
-
|
|
2427
|
+
B(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
|
|
2428
2428
|
}
|
|
2429
2429
|
removeMouseDragListeners() {
|
|
2430
2430
|
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
@@ -2445,22 +2445,22 @@ class z {
|
|
|
2445
2445
|
this.transformInProgress = !1, this.params.onTransformFinished();
|
|
2446
2446
|
}
|
|
2447
2447
|
}
|
|
2448
|
-
class
|
|
2449
|
-
constructor(e, t,
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2448
|
+
class q {
|
|
2449
|
+
constructor(e, t, s, i, n, a) {
|
|
2450
|
+
o(this, "canvasResizeObserver");
|
|
2451
|
+
o(this, "nodeHorizontal");
|
|
2452
|
+
o(this, "nodeVertical");
|
|
2453
|
+
o(this, "viewport");
|
|
2454
|
+
o(this, "viewportWidth", 0);
|
|
2455
|
+
o(this, "viewportHeight", 0);
|
|
2456
|
+
o(this, "viewportMatrix");
|
|
2457
|
+
o(this, "loadedArea", {
|
|
2458
2458
|
xFrom: 1 / 0,
|
|
2459
2459
|
xTo: 1 / 0,
|
|
2460
2460
|
yFrom: 1 / 0,
|
|
2461
2461
|
yTo: 1 / 0
|
|
2462
2462
|
});
|
|
2463
|
-
|
|
2463
|
+
o(this, "updateLoadedArea", (e) => {
|
|
2464
2464
|
this.loadedArea = {
|
|
2465
2465
|
xFrom: e.x,
|
|
2466
2466
|
xTo: e.x + e.width,
|
|
@@ -2468,11 +2468,11 @@ class Q {
|
|
|
2468
2468
|
yTo: e.y + e.height
|
|
2469
2469
|
};
|
|
2470
2470
|
});
|
|
2471
|
-
|
|
2471
|
+
o(this, "onAfterViewportUpdated", () => {
|
|
2472
2472
|
this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
|
|
2473
2473
|
});
|
|
2474
|
-
|
|
2475
|
-
this.canvas = e, this.element = t, this.window =
|
|
2474
|
+
o(this, "userTransformInProgress", !1);
|
|
2475
|
+
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.canvasResizeObserver = new ResizeObserver((d) => {
|
|
2476
2476
|
const c = d[0];
|
|
2477
2477
|
this.viewportWidth = c.contentRect.width, this.viewportHeight = c.contentRect.height, this.scheduleLoadAreaAroundViewport();
|
|
2478
2478
|
}), this.viewport = e.viewport;
|
|
@@ -2496,18 +2496,18 @@ class Q {
|
|
|
2496
2496
|
this.scheduleLoadAreaAroundViewport(), i.onTransformFinished();
|
|
2497
2497
|
}
|
|
2498
2498
|
};
|
|
2499
|
-
|
|
2499
|
+
X.configure(
|
|
2500
2500
|
e,
|
|
2501
2501
|
this.element,
|
|
2502
2502
|
this.window,
|
|
2503
2503
|
h
|
|
2504
2504
|
), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
|
|
2505
2505
|
}
|
|
2506
|
-
static configure(e, t,
|
|
2507
|
-
new
|
|
2506
|
+
static configure(e, t, s, i, n, a) {
|
|
2507
|
+
new q(
|
|
2508
2508
|
e,
|
|
2509
2509
|
t,
|
|
2510
|
-
|
|
2510
|
+
s,
|
|
2511
2511
|
i,
|
|
2512
2512
|
n,
|
|
2513
2513
|
a
|
|
@@ -2519,21 +2519,21 @@ class Q {
|
|
|
2519
2519
|
});
|
|
2520
2520
|
}
|
|
2521
2521
|
scheduleEnsureViewportAreaLoaded() {
|
|
2522
|
-
const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale,
|
|
2523
|
-
this.loadedArea.xFrom <
|
|
2522
|
+
const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - this.nodeHorizontal, i = this.viewportMatrix.y - this.nodeVertical, n = this.viewportMatrix.x + e + this.nodeHorizontal, a = this.viewportMatrix.y + t + this.nodeVertical;
|
|
2523
|
+
this.loadedArea.xFrom < s && this.loadedArea.xTo > n && this.loadedArea.yFrom < i && this.loadedArea.yTo > a || this.scheduleLoadAreaAroundViewport();
|
|
2524
2524
|
}
|
|
2525
2525
|
loadAreaAroundViewport() {
|
|
2526
|
-
const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale,
|
|
2527
|
-
this.trigger.emit({ x:
|
|
2526
|
+
const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale, s = this.viewportMatrix.x - e - this.nodeHorizontal, i = this.viewportMatrix.y - t - this.nodeVertical, n = 3 * e + 2 * this.nodeHorizontal, a = 3 * t + 2 * this.nodeVertical;
|
|
2527
|
+
this.trigger.emit({ x: s, y: i, width: n, height: a });
|
|
2528
2528
|
}
|
|
2529
2529
|
}
|
|
2530
|
-
const
|
|
2530
|
+
const mt = () => {
|
|
2531
2531
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2532
2532
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2533
|
-
},
|
|
2533
|
+
}, vt = () => {
|
|
2534
2534
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2535
2535
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
2536
|
-
},
|
|
2536
|
+
}, Et = () => {
|
|
2537
2537
|
const r = document.createElementNS(
|
|
2538
2538
|
"http://www.w3.org/2000/svg",
|
|
2539
2539
|
"pattern"
|
|
@@ -2541,53 +2541,53 @@ const ut = () => {
|
|
|
2541
2541
|
return r.setAttribute("id", "pattern"), r;
|
|
2542
2542
|
};
|
|
2543
2543
|
class _ {
|
|
2544
|
-
constructor(e, t,
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
const t = e[0], { width:
|
|
2557
|
-
this.svg.setAttribute("width", `${
|
|
2558
|
-
const n = this.tileWidth /
|
|
2544
|
+
constructor(e, t, s) {
|
|
2545
|
+
o(this, "svg", mt());
|
|
2546
|
+
o(this, "patternRenderingRectangle", vt());
|
|
2547
|
+
o(this, "pattern", Et());
|
|
2548
|
+
o(this, "patternContent");
|
|
2549
|
+
o(this, "tileWidth");
|
|
2550
|
+
o(this, "tileHeight");
|
|
2551
|
+
o(this, "halfTileWidth");
|
|
2552
|
+
o(this, "halfTileHeight");
|
|
2553
|
+
o(this, "maxViewportScale");
|
|
2554
|
+
o(this, "visible", !1);
|
|
2555
|
+
o(this, "resizeObserver", new ResizeObserver((e) => {
|
|
2556
|
+
const t = e[0], { width: s, height: i } = t.contentRect;
|
|
2557
|
+
this.svg.setAttribute("width", `${s}`), this.svg.setAttribute("height", `${i}`), this.patternRenderingRectangle.setAttribute("width", `${s}`), this.patternRenderingRectangle.setAttribute("height", `${i}`);
|
|
2558
|
+
const n = this.tileWidth / s, a = this.tileHeight / i;
|
|
2559
2559
|
this.pattern.setAttribute("width", `${n}`), this.pattern.setAttribute("height", `${a}`);
|
|
2560
2560
|
}));
|
|
2561
|
-
|
|
2562
|
-
const e = this.canvas.viewport.getContentMatrix(), t = e.x - this.halfTileWidth * e.scale,
|
|
2561
|
+
o(this, "onAfterTransformUpdated", () => {
|
|
2562
|
+
const e = this.canvas.viewport.getContentMatrix(), t = e.x - this.halfTileWidth * e.scale, s = e.y - this.halfTileHeight * e.scale, i = `matrix(${e.scale}, 0, 0, ${e.scale}, ${t}, ${s})`;
|
|
2563
2563
|
this.pattern.setAttribute("patternTransform", i), this.updateVisibility();
|
|
2564
2564
|
});
|
|
2565
|
-
this.canvas = e, this.backgroundHost =
|
|
2565
|
+
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;
|
|
2566
2566
|
const i = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
|
|
2567
2567
|
this.patternContent.setAttribute("transform", i), this.pattern.appendChild(this.patternContent);
|
|
2568
2568
|
const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
|
2569
2569
|
n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.resizeObserver.observe(this.backgroundHost), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
|
|
2570
2570
|
}
|
|
2571
|
-
static configure(e, t,
|
|
2572
|
-
new _(e, t,
|
|
2571
|
+
static configure(e, t, s) {
|
|
2572
|
+
new _(e, t, s);
|
|
2573
2573
|
}
|
|
2574
2574
|
updateVisibility() {
|
|
2575
2575
|
const t = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
|
|
2576
2576
|
t && this.visible ? (this.visible = !1, this.backgroundHost.removeChild(this.svg)) : !t && !this.visible && (this.visible = !0, this.backgroundHost.appendChild(this.svg));
|
|
2577
2577
|
}
|
|
2578
2578
|
}
|
|
2579
|
-
class
|
|
2580
|
-
constructor(e, t,
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2579
|
+
class ee {
|
|
2580
|
+
constructor(e, t, s, i, n) {
|
|
2581
|
+
o(this, "overlayCanvas");
|
|
2582
|
+
o(this, "staticPortId", null);
|
|
2583
|
+
o(this, "isTargetDragging", !0);
|
|
2584
|
+
o(this, "onEdgeCreated", (e) => {
|
|
2585
2585
|
this.params.onAfterEdgeCreated(e);
|
|
2586
2586
|
});
|
|
2587
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore =
|
|
2587
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ce(
|
|
2588
2588
|
this.overlayLayer,
|
|
2589
2589
|
this.viewportStore
|
|
2590
|
-
),
|
|
2590
|
+
), z.configure(
|
|
2591
2591
|
this.canvas,
|
|
2592
2592
|
this.overlayLayer,
|
|
2593
2593
|
this.window,
|
|
@@ -2610,80 +2610,80 @@ class q {
|
|
|
2610
2610
|
}
|
|
2611
2611
|
);
|
|
2612
2612
|
}
|
|
2613
|
-
static configure(e, t,
|
|
2614
|
-
new
|
|
2613
|
+
static configure(e, t, s, i, n) {
|
|
2614
|
+
new ee(
|
|
2615
2615
|
e,
|
|
2616
2616
|
t,
|
|
2617
|
-
|
|
2617
|
+
s,
|
|
2618
2618
|
i,
|
|
2619
2619
|
n
|
|
2620
2620
|
);
|
|
2621
2621
|
}
|
|
2622
|
-
grabPort(e, t,
|
|
2622
|
+
grabPort(e, t, s) {
|
|
2623
2623
|
const i = this.canvas.graph.getPort(e);
|
|
2624
2624
|
this.staticPortId = e;
|
|
2625
|
-
const n = i.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.getViewportMatrix(),
|
|
2625
|
+
const n = i.element.getBoundingClientRect(), a = n.x + n.width / 2, h = n.y + n.height / 2, d = this.overlayLayer.getBoundingClientRect(), c = this.canvas.viewport.getViewportMatrix(), g = D(c, {
|
|
2626
2626
|
x: a - d.x,
|
|
2627
2627
|
y: h - d.y
|
|
2628
|
-
}),
|
|
2628
|
+
}), l = D(c, {
|
|
2629
2629
|
x: t.x - d.x,
|
|
2630
2630
|
y: t.y - d.y
|
|
2631
|
-
}),
|
|
2632
|
-
overlayId:
|
|
2633
|
-
portCoords: l,
|
|
2634
|
-
portDirection: i.direction
|
|
2635
|
-
}, f = {
|
|
2636
|
-
overlayId: P.Dragging,
|
|
2631
|
+
}), u = {
|
|
2632
|
+
overlayId: b.Static,
|
|
2637
2633
|
portCoords: g,
|
|
2634
|
+
portDirection: i.direction
|
|
2635
|
+
}, w = {
|
|
2636
|
+
overlayId: b.Dragging,
|
|
2637
|
+
portCoords: l,
|
|
2638
2638
|
portDirection: this.params.dragPortDirection
|
|
2639
2639
|
};
|
|
2640
|
-
this.isTargetDragging =
|
|
2641
|
-
const [y, v] = this.isTargetDragging ? [
|
|
2642
|
-
this.overlayCanvas.addNode(
|
|
2640
|
+
this.isTargetDragging = s === "direct";
|
|
2641
|
+
const [y, v] = this.isTargetDragging ? [u, w] : [w, u];
|
|
2642
|
+
this.overlayCanvas.addNode(F(y)), this.overlayCanvas.addNode(F(v)), this.overlayCanvas.addEdge({
|
|
2643
2643
|
from: y.overlayId,
|
|
2644
2644
|
to: v.overlayId,
|
|
2645
|
-
shape: this.params.edgeShapeFactory(
|
|
2645
|
+
shape: this.params.edgeShapeFactory(b.Edge)
|
|
2646
2646
|
});
|
|
2647
2647
|
}
|
|
2648
2648
|
resetDragState() {
|
|
2649
2649
|
this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
2650
2650
|
}
|
|
2651
2651
|
tryCreateConnection(e) {
|
|
2652
|
-
const t =
|
|
2652
|
+
const t = Ae(this.canvas.graph, e), s = this.staticPortId;
|
|
2653
2653
|
if (t === null) {
|
|
2654
2654
|
this.params.onEdgeCreationInterrupted({
|
|
2655
|
-
staticPortId:
|
|
2655
|
+
staticPortId: s,
|
|
2656
2656
|
isDirect: this.isTargetDragging
|
|
2657
2657
|
});
|
|
2658
2658
|
return;
|
|
2659
2659
|
}
|
|
2660
|
-
const i = this.isTargetDragging ?
|
|
2660
|
+
const i = this.isTargetDragging ? s : t, n = this.isTargetDragging ? t : s, a = { from: i, to: n }, h = this.params.connectionPreprocessor(a);
|
|
2661
2661
|
h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(a);
|
|
2662
2662
|
}
|
|
2663
2663
|
moveDraggingPort(e) {
|
|
2664
|
-
const t = this.overlayLayer.getBoundingClientRect(),
|
|
2664
|
+
const t = this.overlayLayer.getBoundingClientRect(), s = {
|
|
2665
2665
|
x: e.x - t.x,
|
|
2666
2666
|
y: e.y - t.y
|
|
2667
|
-
}, i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2668
|
-
this.overlayCanvas.updateNode(
|
|
2667
|
+
}, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
|
|
2668
|
+
this.overlayCanvas.updateNode(b.Dragging, {
|
|
2669
2669
|
x: n.x,
|
|
2670
2670
|
y: n.y
|
|
2671
2671
|
});
|
|
2672
2672
|
}
|
|
2673
2673
|
}
|
|
2674
|
-
class
|
|
2675
|
-
constructor(e, t,
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2674
|
+
class te {
|
|
2675
|
+
constructor(e, t, s, i, n) {
|
|
2676
|
+
o(this, "overlayCanvas");
|
|
2677
|
+
o(this, "staticPortId", null);
|
|
2678
|
+
o(this, "isTargetDragging", !0);
|
|
2679
|
+
o(this, "draggingEdgePayload", null);
|
|
2680
|
+
o(this, "onEdgeReattached", (e) => {
|
|
2681
2681
|
this.params.onAfterEdgeReattached(e);
|
|
2682
2682
|
});
|
|
2683
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore =
|
|
2683
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = i, this.params = n, this.overlayCanvas = Ce(
|
|
2684
2684
|
this.overlayLayer,
|
|
2685
2685
|
this.viewportStore
|
|
2686
|
-
),
|
|
2686
|
+
), z.configure(
|
|
2687
2687
|
this.canvas,
|
|
2688
2688
|
this.overlayLayer,
|
|
2689
2689
|
this.window,
|
|
@@ -2703,56 +2703,56 @@ class ee {
|
|
|
2703
2703
|
}
|
|
2704
2704
|
);
|
|
2705
2705
|
}
|
|
2706
|
-
static configure(e, t,
|
|
2707
|
-
new
|
|
2706
|
+
static configure(e, t, s, i, n) {
|
|
2707
|
+
new te(
|
|
2708
2708
|
e,
|
|
2709
2709
|
t,
|
|
2710
|
-
|
|
2710
|
+
s,
|
|
2711
2711
|
i,
|
|
2712
2712
|
n
|
|
2713
2713
|
);
|
|
2714
2714
|
}
|
|
2715
2715
|
tryStartEdgeDragging(e, t) {
|
|
2716
|
-
const
|
|
2717
|
-
if (
|
|
2716
|
+
const s = this.params.draggingEdgeResolver(e);
|
|
2717
|
+
if (s === null)
|
|
2718
2718
|
return !1;
|
|
2719
|
-
const i = this.canvas.graph.getEdge(
|
|
2719
|
+
const i = this.canvas.graph.getEdge(s);
|
|
2720
2720
|
if (i === null)
|
|
2721
2721
|
return !1;
|
|
2722
2722
|
const n = e === i.from, a = e === i.to, h = n ? i.to : i.from;
|
|
2723
2723
|
this.staticPortId = h, this.isTargetDragging = a;
|
|
2724
|
-
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h),
|
|
2725
|
-
x:
|
|
2726
|
-
y:
|
|
2727
|
-
},
|
|
2728
|
-
x:
|
|
2729
|
-
y:
|
|
2730
|
-
}), v =
|
|
2731
|
-
x: t.x -
|
|
2732
|
-
y: t.y -
|
|
2724
|
+
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h), g = c.element.getBoundingClientRect(), l = {
|
|
2725
|
+
x: g.x + g.width / 2,
|
|
2726
|
+
y: g.y + g.height / 2
|
|
2727
|
+
}, u = this.canvas.viewport.getViewportMatrix(), w = this.overlayLayer.getBoundingClientRect(), y = D(u, {
|
|
2728
|
+
x: l.x - w.x,
|
|
2729
|
+
y: l.y - w.y
|
|
2730
|
+
}), v = D(u, {
|
|
2731
|
+
x: t.x - w.x,
|
|
2732
|
+
y: t.y - w.y
|
|
2733
2733
|
});
|
|
2734
2734
|
this.draggingEdgePayload = {
|
|
2735
|
-
id:
|
|
2735
|
+
id: s,
|
|
2736
2736
|
from: i.from,
|
|
2737
2737
|
to: i.to,
|
|
2738
2738
|
shape: i.shape,
|
|
2739
2739
|
priority: i.priority
|
|
2740
|
-
}, this.canvas.removeEdge(
|
|
2741
|
-
const
|
|
2742
|
-
overlayId:
|
|
2740
|
+
}, this.canvas.removeEdge(s);
|
|
2741
|
+
const E = {
|
|
2742
|
+
overlayId: b.Static,
|
|
2743
2743
|
portCoords: y,
|
|
2744
2744
|
portDirection: c.direction
|
|
2745
2745
|
}, A = {
|
|
2746
|
-
overlayId:
|
|
2746
|
+
overlayId: b.Dragging,
|
|
2747
2747
|
portCoords: v,
|
|
2748
2748
|
portDirection: d.direction
|
|
2749
|
-
}, [
|
|
2750
|
-
this.overlayCanvas.addNode(
|
|
2751
|
-
const N = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(
|
|
2749
|
+
}, [R, T] = this.isTargetDragging ? [E, A] : [A, E];
|
|
2750
|
+
this.overlayCanvas.addNode(F(R)), this.overlayCanvas.addNode(F(T));
|
|
2751
|
+
const N = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(b.Edge) : i.shape;
|
|
2752
2752
|
return this.overlayCanvas.addEdge({
|
|
2753
|
-
id:
|
|
2754
|
-
from:
|
|
2755
|
-
to:
|
|
2753
|
+
id: b.Edge,
|
|
2754
|
+
from: R.overlayId,
|
|
2755
|
+
to: T.overlayId,
|
|
2756
2756
|
shape: N
|
|
2757
2757
|
}), !0;
|
|
2758
2758
|
}
|
|
@@ -2760,18 +2760,18 @@ class ee {
|
|
|
2760
2760
|
this.draggingEdgePayload = null, this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
2761
2761
|
}
|
|
2762
2762
|
moveDraggingPort(e) {
|
|
2763
|
-
const t = this.overlayLayer.getBoundingClientRect(),
|
|
2763
|
+
const t = this.overlayLayer.getBoundingClientRect(), s = {
|
|
2764
2764
|
x: e.x - t.x,
|
|
2765
2765
|
y: e.y - t.y
|
|
2766
|
-
}, i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2767
|
-
this.overlayCanvas.updateNode(
|
|
2766
|
+
}, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
|
|
2767
|
+
this.overlayCanvas.updateNode(b.Dragging, {
|
|
2768
2768
|
x: n.x,
|
|
2769
2769
|
y: n.y
|
|
2770
2770
|
});
|
|
2771
2771
|
}
|
|
2772
2772
|
tryCreateConnection(e) {
|
|
2773
|
-
const t =
|
|
2774
|
-
if (this.overlayCanvas.removeEdge(
|
|
2773
|
+
const t = Ae(this.canvas.graph, e);
|
|
2774
|
+
if (this.overlayCanvas.removeEdge(b.Edge), t === null) {
|
|
2775
2775
|
const d = this.draggingEdgePayload;
|
|
2776
2776
|
this.params.onEdgeReattachInterrupted({
|
|
2777
2777
|
id: d.id,
|
|
@@ -2782,9 +2782,9 @@ class ee {
|
|
|
2782
2782
|
});
|
|
2783
2783
|
return;
|
|
2784
2784
|
}
|
|
2785
|
-
const [
|
|
2785
|
+
const [s, i] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
|
|
2786
2786
|
id: n.id,
|
|
2787
|
-
from:
|
|
2787
|
+
from: s,
|
|
2788
2788
|
to: i,
|
|
2789
2789
|
shape: n.shape,
|
|
2790
2790
|
priority: n.priority
|
|
@@ -2803,28 +2803,28 @@ class ee {
|
|
|
2803
2803
|
}
|
|
2804
2804
|
}
|
|
2805
2805
|
}
|
|
2806
|
-
class
|
|
2807
|
-
constructor(e, t,
|
|
2808
|
-
this.canvas = e, this.layoutAlgorithm = t, this.trigger =
|
|
2806
|
+
class re {
|
|
2807
|
+
constructor(e, t, s) {
|
|
2808
|
+
this.canvas = e, this.layoutAlgorithm = t, this.trigger = s, this.trigger.subscribe(() => {
|
|
2809
2809
|
this.applyLayout();
|
|
2810
2810
|
});
|
|
2811
2811
|
}
|
|
2812
|
-
static configure(e, t,
|
|
2813
|
-
new
|
|
2812
|
+
static configure(e, t, s) {
|
|
2813
|
+
new re(
|
|
2814
2814
|
e,
|
|
2815
2815
|
t,
|
|
2816
|
-
|
|
2816
|
+
s
|
|
2817
2817
|
);
|
|
2818
2818
|
}
|
|
2819
2819
|
applyLayout() {
|
|
2820
|
-
this.layoutAlgorithm.calculateCoordinates(this.canvas.graph).forEach((t,
|
|
2821
|
-
this.canvas.updateNode(
|
|
2820
|
+
this.layoutAlgorithm.calculateCoordinates(this.canvas.graph).forEach((t, s) => {
|
|
2821
|
+
this.canvas.updateNode(s, t);
|
|
2822
2822
|
});
|
|
2823
2823
|
}
|
|
2824
2824
|
}
|
|
2825
|
-
class
|
|
2825
|
+
class se {
|
|
2826
2826
|
constructor(e, t) {
|
|
2827
|
-
|
|
2827
|
+
o(this, "applyScheduled", !1);
|
|
2828
2828
|
this.canvas = e, this.layoutAlgorithm = t, this.canvas.graph.onAfterNodeAdded.subscribe(() => {
|
|
2829
2829
|
this.scheduleApply();
|
|
2830
2830
|
}), this.canvas.graph.onBeforeNodeRemoved.subscribe(() => {
|
|
@@ -2836,7 +2836,7 @@ class re {
|
|
|
2836
2836
|
});
|
|
2837
2837
|
}
|
|
2838
2838
|
static configure(e, t) {
|
|
2839
|
-
new
|
|
2839
|
+
new se(
|
|
2840
2840
|
e,
|
|
2841
2841
|
t
|
|
2842
2842
|
);
|
|
@@ -2847,25 +2847,25 @@ class re {
|
|
|
2847
2847
|
}));
|
|
2848
2848
|
}
|
|
2849
2849
|
applyLayout() {
|
|
2850
|
-
this.layoutAlgorithm.calculateCoordinates(this.canvas.graph).forEach((t,
|
|
2851
|
-
this.canvas.updateNode(
|
|
2850
|
+
this.layoutAlgorithm.calculateCoordinates(this.canvas.graph).forEach((t, s) => {
|
|
2851
|
+
this.canvas.updateNode(s, t);
|
|
2852
2852
|
});
|
|
2853
2853
|
}
|
|
2854
2854
|
}
|
|
2855
|
-
class
|
|
2855
|
+
class At {
|
|
2856
2856
|
static configure(e, t) {
|
|
2857
|
-
const
|
|
2858
|
-
switch (
|
|
2857
|
+
const s = t.applyOn;
|
|
2858
|
+
switch (s.type) {
|
|
2859
2859
|
case "manual": {
|
|
2860
|
-
|
|
2860
|
+
re.configure(
|
|
2861
2861
|
e,
|
|
2862
2862
|
t.algorithm,
|
|
2863
|
-
|
|
2863
|
+
s.trigger
|
|
2864
2864
|
);
|
|
2865
2865
|
break;
|
|
2866
2866
|
}
|
|
2867
2867
|
case "topologyChangeTimeout": {
|
|
2868
|
-
|
|
2868
|
+
se.configure(
|
|
2869
2869
|
e,
|
|
2870
2870
|
t.algorithm
|
|
2871
2871
|
);
|
|
@@ -2874,10 +2874,10 @@ class ft {
|
|
|
2874
2874
|
}
|
|
2875
2875
|
}
|
|
2876
2876
|
}
|
|
2877
|
-
class
|
|
2877
|
+
class xt {
|
|
2878
2878
|
constructor(e, t) {
|
|
2879
|
-
|
|
2880
|
-
|
|
2879
|
+
o(this, "previousTimeStamp");
|
|
2880
|
+
o(this, "step", (e) => {
|
|
2881
2881
|
if (this.previousTimeStamp === void 0)
|
|
2882
2882
|
this.previousTimeStamp = e;
|
|
2883
2883
|
else {
|
|
@@ -2890,60 +2890,60 @@ class yt {
|
|
|
2890
2890
|
}
|
|
2891
2891
|
}
|
|
2892
2892
|
class oe {
|
|
2893
|
-
constructor(e, t,
|
|
2894
|
-
|
|
2895
|
-
this.
|
|
2893
|
+
constructor(e, t, s, i) {
|
|
2894
|
+
o(this, "step", (e) => {
|
|
2895
|
+
this.algorithm.calculateNextCoordinates(
|
|
2896
2896
|
this.canvas.graph,
|
|
2897
2897
|
e
|
|
2898
|
-
).forEach((
|
|
2899
|
-
this.staticNodes.has(i) || this.canvas.updateNode(i, { x:
|
|
2898
|
+
).forEach((s, i) => {
|
|
2899
|
+
this.staticNodes.has(i) || this.canvas.updateNode(i, { x: s.x, y: s.y });
|
|
2900
2900
|
});
|
|
2901
2901
|
});
|
|
2902
|
-
this.canvas = e, this.
|
|
2902
|
+
this.canvas = e, this.algorithm = t, this.staticNodes = s, this.win = i, new xt(this.win, this.step);
|
|
2903
2903
|
}
|
|
2904
|
-
static configure(e, t,
|
|
2905
|
-
new oe(e, t,
|
|
2904
|
+
static configure(e, t, s, i) {
|
|
2905
|
+
new oe(e, t, s, i);
|
|
2906
2906
|
}
|
|
2907
2907
|
}
|
|
2908
|
-
const
|
|
2908
|
+
const St = () => {
|
|
2909
2909
|
const r = document.createElement("div");
|
|
2910
2910
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
2911
|
-
},
|
|
2911
|
+
}, H = () => {
|
|
2912
2912
|
const r = document.createElement("div");
|
|
2913
2913
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2914
|
-
},
|
|
2915
|
-
const r =
|
|
2914
|
+
}, pe = () => {
|
|
2915
|
+
const r = H();
|
|
2916
2916
|
return r.style.pointerEvents = "none", r;
|
|
2917
2917
|
};
|
|
2918
|
-
class
|
|
2918
|
+
class Pt {
|
|
2919
2919
|
constructor(e) {
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2920
|
+
o(this, "background", H());
|
|
2921
|
+
o(this, "main", H());
|
|
2922
|
+
o(this, "overlayConnectablePorts", pe());
|
|
2923
|
+
o(this, "overlayDraggableEdges", pe());
|
|
2924
|
+
o(this, "host", St());
|
|
2925
2925
|
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);
|
|
2926
2926
|
}
|
|
2927
2927
|
destroy() {
|
|
2928
2928
|
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);
|
|
2929
2929
|
}
|
|
2930
2930
|
}
|
|
2931
|
-
const
|
|
2931
|
+
const j = (r) => () => r, we = j(0), bt = () => {
|
|
2932
2932
|
let r = 0;
|
|
2933
2933
|
return () => r++;
|
|
2934
|
-
},
|
|
2935
|
-
let t =
|
|
2936
|
-
const i =
|
|
2937
|
-
return r === "incremental" && (t = i), e === "incremental" && (
|
|
2934
|
+
}, Tt = (r, e) => {
|
|
2935
|
+
let t = we, s = we;
|
|
2936
|
+
const i = bt();
|
|
2937
|
+
return r === "incremental" && (t = i), e === "incremental" && (s = i), typeof r == "number" && (t = j(r)), typeof e == "number" && (s = j(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
|
|
2938
2938
|
nodesPriorityFn: t,
|
|
2939
|
-
edgesPriorityFn:
|
|
2939
|
+
edgesPriorityFn: s
|
|
2940
2940
|
};
|
|
2941
|
-
},
|
|
2941
|
+
}, ie = (r) => {
|
|
2942
2942
|
if (typeof r == "function")
|
|
2943
2943
|
return r;
|
|
2944
2944
|
switch (r.type) {
|
|
2945
2945
|
case "straight":
|
|
2946
|
-
return () => new
|
|
2946
|
+
return () => new lt({
|
|
2947
2947
|
color: r.color,
|
|
2948
2948
|
width: r.width,
|
|
2949
2949
|
arrowLength: r.arrowLength,
|
|
@@ -2957,7 +2957,7 @@ const H = (r) => () => r, pe = H(0), Et = () => {
|
|
|
2957
2957
|
detourDirection: r.detourDirection
|
|
2958
2958
|
});
|
|
2959
2959
|
case "horizontal":
|
|
2960
|
-
return () => new
|
|
2960
|
+
return () => new ct({
|
|
2961
2961
|
color: r.color,
|
|
2962
2962
|
width: r.width,
|
|
2963
2963
|
arrowLength: r.arrowLength,
|
|
@@ -2970,7 +2970,7 @@ const H = (r) => () => r, pe = H(0), Et = () => {
|
|
|
2970
2970
|
detourDistance: r.detourDistance
|
|
2971
2971
|
});
|
|
2972
2972
|
case "vertical":
|
|
2973
|
-
return () => new
|
|
2973
|
+
return () => new gt({
|
|
2974
2974
|
color: r.color,
|
|
2975
2975
|
width: r.width,
|
|
2976
2976
|
arrowLength: r.arrowLength,
|
|
@@ -2994,7 +2994,7 @@ const H = (r) => () => r, pe = H(0), Et = () => {
|
|
|
2994
2994
|
targetOffset: r.targetOffset
|
|
2995
2995
|
});
|
|
2996
2996
|
default:
|
|
2997
|
-
return () => new
|
|
2997
|
+
return () => new dt({
|
|
2998
2998
|
color: r.color,
|
|
2999
2999
|
width: r.width,
|
|
3000
3000
|
arrowLength: r.arrowLength,
|
|
@@ -3008,185 +3008,185 @@ const H = (r) => () => r, pe = H(0), Et = () => {
|
|
|
3008
3008
|
detourDirection: r.detourDirection
|
|
3009
3009
|
});
|
|
3010
3010
|
}
|
|
3011
|
-
},
|
|
3012
|
-
var t,
|
|
3013
|
-
const e =
|
|
3011
|
+
}, Dt = (r) => {
|
|
3012
|
+
var t, s, i, n, a;
|
|
3013
|
+
const e = Tt(
|
|
3014
3014
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
3015
|
-
(
|
|
3015
|
+
(s = r.edges) == null ? void 0 : s.priority
|
|
3016
3016
|
);
|
|
3017
3017
|
return {
|
|
3018
3018
|
nodes: {
|
|
3019
|
-
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ??
|
|
3019
|
+
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? xe,
|
|
3020
3020
|
priorityFn: e.nodesPriorityFn
|
|
3021
3021
|
},
|
|
3022
3022
|
ports: {
|
|
3023
3023
|
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
3024
3024
|
},
|
|
3025
3025
|
edges: {
|
|
3026
|
-
shapeFactory:
|
|
3026
|
+
shapeFactory: ie(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
|
|
3027
3027
|
priorityFn: e.edgesPriorityFn
|
|
3028
3028
|
}
|
|
3029
3029
|
};
|
|
3030
|
-
},
|
|
3031
|
-
var
|
|
3032
|
-
const e = ((
|
|
3033
|
-
}), t = r.nodeDragVerifier ?? (() => !0),
|
|
3034
|
-
}), i = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && i, a = (y = r.mouse) == null ? void 0 : y.dragCursor, h = a !== void 0 ? a : "grab", d = (v = r.mouse) == null ? void 0 : v.mouseDownEventVerifier, c = d !== void 0 ? d : (A) => A.button === 0,
|
|
3030
|
+
}, Nt = (r) => {
|
|
3031
|
+
var u, w, y, v, E;
|
|
3032
|
+
const e = ((u = r.events) == null ? void 0 : u.onNodeDrag) ?? (() => {
|
|
3033
|
+
}), t = r.nodeDragVerifier ?? (() => !0), s = ((w = r.events) == null ? void 0 : w.onNodeDragFinished) ?? (() => {
|
|
3034
|
+
}), i = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && i, a = (y = r.mouse) == null ? void 0 : y.dragCursor, h = a !== void 0 ? a : "grab", d = (v = r.mouse) == null ? void 0 : v.mouseDownEventVerifier, c = d !== void 0 ? d : (A) => A.button === 0, g = (E = r.mouse) == null ? void 0 : E.mouseUpEventVerifier, l = g !== void 0 ? g : (A) => A.button === 0;
|
|
3035
3035
|
return {
|
|
3036
3036
|
moveOnTop: i,
|
|
3037
3037
|
moveEdgesOnTop: n,
|
|
3038
3038
|
dragCursor: h,
|
|
3039
3039
|
gridSize: r.gridSize ?? null,
|
|
3040
3040
|
mouseDownEventVerifier: c,
|
|
3041
|
-
mouseUpEventVerifier:
|
|
3041
|
+
mouseUpEventVerifier: l,
|
|
3042
3042
|
onNodeDrag: e,
|
|
3043
3043
|
nodeDragVerifier: t,
|
|
3044
|
-
onNodeDragFinished:
|
|
3044
|
+
onNodeDragFinished: s
|
|
3045
3045
|
};
|
|
3046
|
-
},
|
|
3047
|
-
const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0,
|
|
3046
|
+
}, Mt = (r) => {
|
|
3047
|
+
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, i = r.maxY !== null ? r.maxY : 1 / 0;
|
|
3048
3048
|
return (n) => {
|
|
3049
3049
|
let a = n.nextTransform.x, h = n.nextTransform.y;
|
|
3050
3050
|
a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
|
|
3051
3051
|
const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
|
|
3052
|
-
a > c && a > n.prevTransform.x && (a = Math.max(n.prevTransform.x, c)), h <
|
|
3053
|
-
const
|
|
3054
|
-
return h >
|
|
3052
|
+
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));
|
|
3053
|
+
const g = n.canvasHeight * n.prevTransform.scale, l = i - g;
|
|
3054
|
+
return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
|
|
3055
3055
|
};
|
|
3056
|
-
},
|
|
3057
|
-
const e = r.maxContentScale, t = r.minContentScale,
|
|
3056
|
+
}, Lt = (r) => {
|
|
3057
|
+
const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
|
|
3058
3058
|
return (n) => {
|
|
3059
3059
|
const a = n.prevTransform, h = n.nextTransform;
|
|
3060
|
-
let d = h.scale, c = h.x,
|
|
3060
|
+
let d = h.scale, c = h.x, g = h.y;
|
|
3061
3061
|
if (h.scale > i && h.scale > a.scale) {
|
|
3062
|
-
d = Math.max(a.scale, i), c = a.x,
|
|
3063
|
-
const
|
|
3064
|
-
c = a.x + (h.x - a.x) *
|
|
3062
|
+
d = Math.max(a.scale, i), c = a.x, g = a.y;
|
|
3063
|
+
const l = (d - a.scale) / (h.scale - a.scale);
|
|
3064
|
+
c = a.x + (h.x - a.x) * l, g = a.y + (h.y - a.y) * l;
|
|
3065
3065
|
}
|
|
3066
|
-
if (h.scale <
|
|
3067
|
-
d = Math.min(a.scale,
|
|
3068
|
-
const
|
|
3069
|
-
c = a.x + (h.x - a.x) *
|
|
3066
|
+
if (h.scale < s && h.scale < a.scale) {
|
|
3067
|
+
d = Math.min(a.scale, s), c = a.x, g = a.y;
|
|
3068
|
+
const l = (d - a.scale) / (h.scale - a.scale);
|
|
3069
|
+
c = a.x + (h.x - a.x) * l, g = a.y + (h.y - a.y) * l;
|
|
3070
3070
|
}
|
|
3071
3071
|
return {
|
|
3072
3072
|
scale: d,
|
|
3073
3073
|
x: c,
|
|
3074
|
-
y:
|
|
3074
|
+
y: g
|
|
3075
3075
|
};
|
|
3076
3076
|
};
|
|
3077
|
-
},
|
|
3078
|
-
(t,
|
|
3077
|
+
}, Rt = (r) => (e) => r.reduce(
|
|
3078
|
+
(t, s) => s({
|
|
3079
3079
|
prevTransform: e.prevTransform,
|
|
3080
3080
|
nextTransform: t,
|
|
3081
3081
|
canvasWidth: e.canvasWidth,
|
|
3082
3082
|
canvasHeight: e.canvasHeight
|
|
3083
3083
|
}),
|
|
3084
3084
|
e.nextTransform
|
|
3085
|
-
),
|
|
3085
|
+
), fe = (r) => {
|
|
3086
3086
|
if (typeof r == "function")
|
|
3087
3087
|
return r;
|
|
3088
3088
|
switch (r.type) {
|
|
3089
3089
|
case "scale-limit":
|
|
3090
|
-
return
|
|
3090
|
+
return Lt({
|
|
3091
3091
|
minContentScale: r.minContentScale ?? 0,
|
|
3092
3092
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
3093
3093
|
});
|
|
3094
3094
|
case "shift-limit":
|
|
3095
|
-
return
|
|
3095
|
+
return Mt({
|
|
3096
3096
|
minX: r.minX ?? -1 / 0,
|
|
3097
3097
|
maxX: r.maxX ?? 1 / 0,
|
|
3098
3098
|
minY: r.minY ?? -1 / 0,
|
|
3099
3099
|
maxY: r.maxY ?? 1 / 0
|
|
3100
3100
|
});
|
|
3101
3101
|
}
|
|
3102
|
-
},
|
|
3103
|
-
var y, v,
|
|
3104
|
-
const e = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2,
|
|
3102
|
+
}, ye = (r) => {
|
|
3103
|
+
var y, v, E, A, R, T, N, $, ne, ae, he, de;
|
|
3104
|
+
const e = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
|
|
3105
3105
|
let i;
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
(
|
|
3106
|
+
s !== void 0 ? Array.isArray(s) ? i = Rt(
|
|
3107
|
+
s.map(
|
|
3108
|
+
(M) => fe(M)
|
|
3109
3109
|
)
|
|
3110
|
-
) : i =
|
|
3111
|
-
const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((
|
|
3110
|
+
) : i = fe(s) : i = (M) => M.nextTransform;
|
|
3111
|
+
const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((E = r == null ? void 0 : r.events) == null ? void 0 : E.onBeforeTransformChange) ?? (() => {
|
|
3112
3112
|
}), h = ((A = r == null ? void 0 : r.events) == null ? void 0 : A.onTransformChange) ?? (() => {
|
|
3113
|
-
}), d = (
|
|
3113
|
+
}), d = (R = r == null ? void 0 : r.shift) == null ? void 0 : R.mouseDownEventVerifier, c = d !== void 0 ? d : (M) => M.button === 0, g = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseUpEventVerifier, l = g !== void 0 ? g : (M) => M.button === 0, u = (N = r == null ? void 0 : r.scale) == null ? void 0 : N.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
|
|
3114
3114
|
return {
|
|
3115
3115
|
wheelSensitivity: t,
|
|
3116
|
-
onTransformStarted: ((
|
|
3116
|
+
onTransformStarted: (($ = r == null ? void 0 : r.events) == null ? void 0 : $.onTransformStarted) ?? (() => {
|
|
3117
3117
|
}),
|
|
3118
|
-
onTransformFinished: ((
|
|
3118
|
+
onTransformFinished: ((ne = r == null ? void 0 : r.events) == null ? void 0 : ne.onTransformFinished) ?? (() => {
|
|
3119
3119
|
}),
|
|
3120
3120
|
onBeforeTransformChange: a,
|
|
3121
3121
|
onTransformChange: h,
|
|
3122
3122
|
transformPreprocessor: i,
|
|
3123
3123
|
shiftCursor: n,
|
|
3124
3124
|
mouseDownEventVerifier: c,
|
|
3125
|
-
mouseUpEventVerifier:
|
|
3126
|
-
mouseWheelEventVerifier:
|
|
3127
|
-
scaleWheelFinishTimeout: ((
|
|
3128
|
-
onResizeTransformStarted: ((
|
|
3125
|
+
mouseUpEventVerifier: l,
|
|
3126
|
+
mouseWheelEventVerifier: w,
|
|
3127
|
+
scaleWheelFinishTimeout: ((ae = r == null ? void 0 : r.scale) == null ? void 0 : ae.wheelFinishTimeout) ?? 500,
|
|
3128
|
+
onResizeTransformStarted: ((he = r == null ? void 0 : r.events) == null ? void 0 : he.onResizeTransformStarted) ?? (() => {
|
|
3129
3129
|
}),
|
|
3130
|
-
onResizeTransformFinished: ((
|
|
3130
|
+
onResizeTransformFinished: ((de = r == null ? void 0 : r.events) == null ? void 0 : de.onResizeTransformFinished) ?? (() => {
|
|
3131
3131
|
})
|
|
3132
3132
|
};
|
|
3133
|
-
},
|
|
3133
|
+
}, Ct = (r, e) => {
|
|
3134
3134
|
const t = document.createElementNS(
|
|
3135
3135
|
"http://www.w3.org/2000/svg",
|
|
3136
3136
|
"circle"
|
|
3137
3137
|
);
|
|
3138
3138
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
3139
|
-
},
|
|
3139
|
+
}, Vt = (r) => r instanceof SVGElement ? r : Ct(
|
|
3140
3140
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
3141
3141
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
3142
|
-
),
|
|
3143
|
-
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25,
|
|
3142
|
+
), $t = (r) => {
|
|
3143
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, i = Vt(r.renderer ?? {});
|
|
3144
3144
|
return {
|
|
3145
3145
|
tileWidth: t,
|
|
3146
|
-
tileHeight:
|
|
3146
|
+
tileHeight: s,
|
|
3147
3147
|
renderer: i,
|
|
3148
3148
|
maxViewportScale: r.maxViewportScale ?? 10
|
|
3149
3149
|
};
|
|
3150
|
-
},
|
|
3151
|
-
var c,
|
|
3152
|
-
const
|
|
3150
|
+
}, It = (r, e, t) => {
|
|
3151
|
+
var c, g, l;
|
|
3152
|
+
const s = () => "direct", i = (u) => u, n = (u) => u.button === 0, a = () => {
|
|
3153
3153
|
}, h = () => {
|
|
3154
3154
|
}, d = () => {
|
|
3155
3155
|
};
|
|
3156
3156
|
return {
|
|
3157
|
-
connectionTypeResolver: r.connectionTypeResolver ??
|
|
3157
|
+
connectionTypeResolver: r.connectionTypeResolver ?? s,
|
|
3158
3158
|
connectionPreprocessor: r.connectionPreprocessor ?? i,
|
|
3159
3159
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
|
|
3160
3160
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
|
|
3161
3161
|
onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
|
|
3162
|
-
onEdgeCreationInterrupted: ((
|
|
3163
|
-
onEdgeCreationPrevented: ((
|
|
3162
|
+
onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
|
|
3163
|
+
onEdgeCreationPrevented: ((l = r.events) == null ? void 0 : l.onEdgeCreationPrevented) ?? h,
|
|
3164
3164
|
dragPortDirection: r.dragPortDirection ?? t,
|
|
3165
|
-
edgeShapeFactory: r.edgeShape !== void 0 ?
|
|
3165
|
+
edgeShapeFactory: r.edgeShape !== void 0 ? ie(r.edgeShape) : e
|
|
3166
3166
|
};
|
|
3167
|
-
},
|
|
3168
|
-
var c,
|
|
3169
|
-
const t = (
|
|
3170
|
-
const
|
|
3171
|
-
return
|
|
3167
|
+
}, Ut = (r, e) => {
|
|
3168
|
+
var c, g, l;
|
|
3169
|
+
const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, i = (u) => u.button === 0, n = (u) => {
|
|
3170
|
+
const w = e.getPortAdjacentEdgeIds(u);
|
|
3171
|
+
return w.length > 0 ? w[w.length - 1] : null;
|
|
3172
3172
|
}, a = () => {
|
|
3173
3173
|
}, h = () => {
|
|
3174
3174
|
}, d = () => {
|
|
3175
3175
|
};
|
|
3176
3176
|
return {
|
|
3177
3177
|
connectionPreprocessor: r.connectionPreprocessor ?? t,
|
|
3178
|
-
mouseDownEventVerifier: r.mouseDownEventVerifier ??
|
|
3178
|
+
mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
|
|
3179
3179
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? i,
|
|
3180
3180
|
draggingEdgeResolver: r.draggingEdgeResolver ?? n,
|
|
3181
|
-
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ?
|
|
3181
|
+
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ie(r.draggingEdgeShape) : null,
|
|
3182
3182
|
onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
|
|
3183
|
-
onEdgeReattachInterrupted: ((
|
|
3184
|
-
onEdgeReattachPrevented: ((
|
|
3183
|
+
onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
|
|
3184
|
+
onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
|
|
3185
3185
|
};
|
|
3186
|
-
},
|
|
3186
|
+
}, Bt = (r) => ({
|
|
3187
3187
|
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
3188
3188
|
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
3189
|
-
}),
|
|
3189
|
+
}), Ft = (r) => {
|
|
3190
3190
|
var e, t;
|
|
3191
3191
|
return {
|
|
3192
3192
|
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
|
|
@@ -3195,60 +3195,231 @@ const H = (r) => () => r, pe = H(0), Et = () => {
|
|
|
3195
3195
|
})
|
|
3196
3196
|
};
|
|
3197
3197
|
};
|
|
3198
|
-
class
|
|
3198
|
+
class Ot extends Error {
|
|
3199
3199
|
constructor() {
|
|
3200
3200
|
super(...arguments);
|
|
3201
|
-
|
|
3201
|
+
o(this, "name", "CanvasBuilderError");
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
class Wt {
|
|
3205
|
+
constructor(e, t) {
|
|
3206
|
+
this.coordinates = e, this.rand = t;
|
|
3207
|
+
}
|
|
3208
|
+
getVector(e, t) {
|
|
3209
|
+
const s = this.coordinates.get(e), i = this.coordinates.get(t), n = i.x - s.x, a = i.y - s.y, h = n * n + a * a;
|
|
3210
|
+
if (h === 0) {
|
|
3211
|
+
const l = this.rand() * 2 * Math.PI;
|
|
3212
|
+
return { ex: Math.cos(l), ey: Math.sin(l), d2: 1, d: 1 };
|
|
3213
|
+
}
|
|
3214
|
+
const d = Math.sqrt(h), c = n / d, g = a / d;
|
|
3215
|
+
return { ex: c, ey: g, d2: h, d };
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
class Ve {
|
|
3219
|
+
constructor(e, t, s) {
|
|
3220
|
+
o(this, "dtSec");
|
|
3221
|
+
o(this, "k");
|
|
3222
|
+
o(this, "nodeMass");
|
|
3223
|
+
o(this, "edgeEquilibriumLength");
|
|
3224
|
+
o(this, "edgeStiffness");
|
|
3225
|
+
o(this, "effectiveDistance");
|
|
3226
|
+
this.graph = e, this.currentCoords = t, this.params = s, this.dtSec = this.params.dtSec, this.k = this.params.nodeCharge * this.params.nodeCharge, this.nodeMass = this.params.nodeMass, this.edgeEquilibriumLength = this.params.edgeEquilibriumLength, this.edgeStiffness = this.params.edgeStiffness, this.effectiveDistance = this.params.effectiveDistance;
|
|
3227
|
+
}
|
|
3228
|
+
next() {
|
|
3229
|
+
let e = 0;
|
|
3230
|
+
const t = /* @__PURE__ */ new Map(), s = this.graph.getAllNodeIds();
|
|
3231
|
+
s.forEach((a) => {
|
|
3232
|
+
t.set(a, { x: 0, y: 0 });
|
|
3233
|
+
});
|
|
3234
|
+
const i = new Wt(
|
|
3235
|
+
this.currentCoords,
|
|
3236
|
+
this.params.rand
|
|
3237
|
+
), n = s.length;
|
|
3238
|
+
for (let a = 0; a < n; a++) {
|
|
3239
|
+
const h = s[a];
|
|
3240
|
+
for (let d = a + 1; d < n; d++) {
|
|
3241
|
+
const c = s[d], g = i.getVector(h, c);
|
|
3242
|
+
if (g.d > this.effectiveDistance)
|
|
3243
|
+
continue;
|
|
3244
|
+
const l = this.k / g.d2, u = l * g.ex, w = l * g.ey, y = u / 2, v = w / 2, E = t.get(h), A = t.get(c);
|
|
3245
|
+
E.x -= y, E.y -= v, A.x += y, A.y += v;
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3248
|
+
return this.graph.getAllEdgeIds().forEach((a) => {
|
|
3249
|
+
const h = this.graph.getEdge(a), d = this.graph.getPort(h.from), c = this.graph.getPort(h.to), g = i.getVector(d.nodeId, c.nodeId), u = (g.d - this.edgeEquilibriumLength) * this.edgeStiffness / 2, w = g.ex * u, y = g.ey * u, v = t.get(d.nodeId), E = t.get(c.nodeId);
|
|
3250
|
+
v.x += w, v.y += y, E.x -= w, E.y -= y;
|
|
3251
|
+
}), this.currentCoords.forEach((a, h) => {
|
|
3252
|
+
const d = t.get(h), c = {
|
|
3253
|
+
x: d.x / this.nodeMass * this.dtSec,
|
|
3254
|
+
y: d.y / this.nodeMass * this.dtSec
|
|
3255
|
+
}, g = c.x * this.dtSec, l = c.y * this.dtSec;
|
|
3256
|
+
a.x += g, a.y += l, e = Math.max(e, Math.sqrt(g * g + l * l));
|
|
3257
|
+
}), e;
|
|
3258
|
+
}
|
|
3259
|
+
}
|
|
3260
|
+
const $e = (r, e, t) => {
|
|
3261
|
+
const s = /* @__PURE__ */ new Map(), i = r.getAllNodeIds(), n = Math.sqrt(i.length) * t;
|
|
3262
|
+
return i.forEach((a) => {
|
|
3263
|
+
const h = r.getNode(a);
|
|
3264
|
+
s.set(a, {
|
|
3265
|
+
x: h.x ?? n * e(),
|
|
3266
|
+
y: h.y ?? n * e()
|
|
3267
|
+
});
|
|
3268
|
+
}), s;
|
|
3269
|
+
};
|
|
3270
|
+
class kt {
|
|
3271
|
+
constructor(e) {
|
|
3272
|
+
this.params = e;
|
|
3273
|
+
}
|
|
3274
|
+
calculateCoordinates(e) {
|
|
3275
|
+
const t = $e(
|
|
3276
|
+
e,
|
|
3277
|
+
this.params.rand,
|
|
3278
|
+
this.params.edgeEquilibriumLength
|
|
3279
|
+
);
|
|
3280
|
+
for (let s = 0; s < this.params.maxIterations && !(new Ve(e, t, {
|
|
3281
|
+
rand: this.params.rand,
|
|
3282
|
+
dtSec: this.params.dtSec,
|
|
3283
|
+
nodeMass: this.params.nodeMass,
|
|
3284
|
+
nodeCharge: this.params.nodeCharge,
|
|
3285
|
+
edgeEquilibriumLength: this.params.edgeEquilibriumLength,
|
|
3286
|
+
effectiveDistance: this.params.effectiveDistance,
|
|
3287
|
+
edgeStiffness: this.params.edgeStiffness
|
|
3288
|
+
}).next() < this.params.convergenceDelta); s++)
|
|
3289
|
+
;
|
|
3290
|
+
return t;
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
class zt {
|
|
3294
|
+
constructor(e) {
|
|
3295
|
+
this.params = e;
|
|
3296
|
+
}
|
|
3297
|
+
calculateNextCoordinates(e, t) {
|
|
3298
|
+
const s = $e(
|
|
3299
|
+
e,
|
|
3300
|
+
this.params.rand,
|
|
3301
|
+
this.params.edgeEquilibriumLength
|
|
3302
|
+
);
|
|
3303
|
+
return new Ve(e, s, {
|
|
3304
|
+
rand: this.params.rand,
|
|
3305
|
+
dtSec: Math.min(t, this.params.maxTimeDeltaSec),
|
|
3306
|
+
nodeMass: this.params.nodeMass,
|
|
3307
|
+
nodeCharge: this.params.nodeCharge,
|
|
3308
|
+
edgeEquilibriumLength: this.params.edgeEquilibriumLength,
|
|
3309
|
+
effectiveDistance: this.params.effectiveDistance,
|
|
3310
|
+
edgeStiffness: this.params.edgeStiffness
|
|
3311
|
+
}).next() < this.params.convergenceDelta && !e.getAllNodeIds().some((h) => {
|
|
3312
|
+
const d = e.getNode(h);
|
|
3313
|
+
return d.x === null || d.y === null;
|
|
3314
|
+
}) ? /* @__PURE__ */ new Map() : s;
|
|
3202
3315
|
}
|
|
3203
3316
|
}
|
|
3204
|
-
const
|
|
3205
|
-
|
|
3206
|
-
|
|
3317
|
+
const Ie = (r) => {
|
|
3318
|
+
let e = 1779033703, t = 3144134277, s = 1013904242, i = 2773480762;
|
|
3319
|
+
for (let n = 0, a; n < r.length; n++)
|
|
3320
|
+
a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = s ^ Math.imul(t ^ a, 2869860233), s = i ^ Math.imul(s ^ a, 951274213), i = e ^ Math.imul(i ^ a, 2716044179);
|
|
3321
|
+
return e = Math.imul(s ^ e >>> 18, 597399067), t = Math.imul(i ^ t >>> 22, 2869860233), s = Math.imul(e ^ s >>> 17, 951274213), i = Math.imul(t ^ i >>> 19, 2716044179), e ^= t ^ s ^ i, t ^= e, s ^= e, i ^= e, [e >>> 0, t >>> 0, s >>> 0, i >>> 0];
|
|
3322
|
+
}, Ue = (r, e, t, s) => function() {
|
|
3323
|
+
r |= 0, e |= 0, t |= 0, s |= 0;
|
|
3324
|
+
const i = (r + e | 0) + s | 0;
|
|
3325
|
+
return s = s + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + i | 0, (i >>> 0) / 4294967296;
|
|
3326
|
+
}, S = Object.freeze({
|
|
3327
|
+
seed: "HTMLGraph is awesome",
|
|
3328
|
+
maxTimeDeltaSec: 0.1,
|
|
3329
|
+
nodeCharge: 1e5,
|
|
3330
|
+
nodeMass: 1,
|
|
3331
|
+
edgeEquilibriumLength: 300,
|
|
3332
|
+
edgeStiffness: 1e3,
|
|
3333
|
+
effectiveDistance: 1e3,
|
|
3334
|
+
dtSec: 0.02,
|
|
3335
|
+
maxIterations: 100,
|
|
3336
|
+
convergenceDelta: 1e-3
|
|
3337
|
+
}), Xt = (r) => {
|
|
3338
|
+
var e;
|
|
3339
|
+
switch ((e = r == null ? void 0 : r.algorithm) == null ? void 0 : e.type) {
|
|
3340
|
+
case "custom":
|
|
3341
|
+
return r.algorithm.instance;
|
|
3342
|
+
default: {
|
|
3343
|
+
const t = r == null ? void 0 : r.algorithm, s = Ie((t == null ? void 0 : t.seed) ?? S.seed), i = Ue(s[0], s[1], s[2], s[3]);
|
|
3344
|
+
return new zt({
|
|
3345
|
+
rand: i,
|
|
3346
|
+
maxTimeDeltaSec: (t == null ? void 0 : t.maxTimeDeltaSec) ?? S.maxTimeDeltaSec,
|
|
3347
|
+
nodeCharge: (t == null ? void 0 : t.nodeCharge) ?? S.nodeCharge,
|
|
3348
|
+
nodeMass: (t == null ? void 0 : t.nodeMass) ?? S.nodeMass,
|
|
3349
|
+
edgeEquilibriumLength: (t == null ? void 0 : t.edgeEquilibriumLength) ?? S.edgeEquilibriumLength,
|
|
3350
|
+
effectiveDistance: S.effectiveDistance,
|
|
3351
|
+
edgeStiffness: (t == null ? void 0 : t.edgeStiffness) ?? S.edgeStiffness,
|
|
3352
|
+
convergenceDelta: (t == null ? void 0 : t.convergenceDelta) ?? S.convergenceDelta
|
|
3353
|
+
});
|
|
3354
|
+
}
|
|
3355
|
+
}
|
|
3356
|
+
}, Yt = (r) => r instanceof G ? {
|
|
3207
3357
|
type: "manual",
|
|
3208
3358
|
trigger: r
|
|
3209
3359
|
} : {
|
|
3210
3360
|
type: "topologyChangeTimeout"
|
|
3211
|
-
},
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3361
|
+
}, Ht = (r) => {
|
|
3362
|
+
switch (r == null ? void 0 : r.type) {
|
|
3363
|
+
case "custom":
|
|
3364
|
+
return r.instance;
|
|
3365
|
+
default: {
|
|
3366
|
+
const e = Ie((r == null ? void 0 : r.seed) ?? S.seed), t = Ue(e[0], e[1], e[2], e[3]);
|
|
3367
|
+
return new kt({
|
|
3368
|
+
dtSec: (r == null ? void 0 : r.dtSec) ?? S.dtSec,
|
|
3369
|
+
maxIterations: (r == null ? void 0 : r.maxIterations) ?? S.maxIterations,
|
|
3370
|
+
rand: t,
|
|
3371
|
+
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? S.nodeCharge,
|
|
3372
|
+
nodeMass: (r == null ? void 0 : r.nodeMass) ?? S.nodeMass,
|
|
3373
|
+
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? S.edgeEquilibriumLength,
|
|
3374
|
+
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? S.edgeStiffness,
|
|
3375
|
+
effectiveDistance: (r == null ? void 0 : r.effectiveDistance) ?? S.effectiveDistance,
|
|
3376
|
+
convergenceDelta: (r == null ? void 0 : r.convergenceDelta) ?? S.convergenceDelta
|
|
3377
|
+
});
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
}, jt = (r) => ({
|
|
3381
|
+
algorithm: Ht(r == null ? void 0 : r.algorithm),
|
|
3382
|
+
applyOn: Yt(r == null ? void 0 : r.applyOn)
|
|
3383
|
+
}), Gt = (r, e) => ({
|
|
3215
3384
|
...r,
|
|
3216
3385
|
nodeDragVerifier: (t) => (e.add(t), r.nodeDragVerifier(t)),
|
|
3217
3386
|
onNodeDragFinished: (t) => {
|
|
3218
3387
|
e.delete(t), r.onNodeDragFinished(t);
|
|
3219
3388
|
}
|
|
3220
|
-
}),
|
|
3389
|
+
}), Kt = (r, e) => {
|
|
3221
3390
|
r.onBeforeNodeRemoved.subscribe((t) => {
|
|
3222
3391
|
e.delete(t);
|
|
3223
3392
|
}), r.onBeforeClear.subscribe(() => {
|
|
3224
3393
|
e.clear();
|
|
3225
3394
|
});
|
|
3226
3395
|
};
|
|
3227
|
-
class
|
|
3396
|
+
class Qt {
|
|
3228
3397
|
constructor(e) {
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3398
|
+
o(this, "used", !1);
|
|
3399
|
+
o(this, "canvasDefaults", {});
|
|
3400
|
+
o(this, "dragConfig", {});
|
|
3401
|
+
o(this, "transformConfig", {});
|
|
3402
|
+
o(this, "backgroundConfig", {});
|
|
3403
|
+
o(this, "connectablePortsConfig", {});
|
|
3404
|
+
o(this, "draggableEdgesConfig", {});
|
|
3405
|
+
o(this, "virtualScrollConfig");
|
|
3406
|
+
o(this, "layoutConfig");
|
|
3407
|
+
o(this, "animatedLayoutConfig");
|
|
3408
|
+
o(this, "hasDraggableNodes", !1);
|
|
3409
|
+
o(this, "hasTransformableViewport", !1);
|
|
3410
|
+
o(this, "hasNodeResizeReactiveEdges", !1);
|
|
3411
|
+
o(this, "hasBackground", !1);
|
|
3412
|
+
o(this, "hasUserConnectablePorts", !1);
|
|
3413
|
+
o(this, "hasUserDraggableEdges", !1);
|
|
3414
|
+
o(this, "hasAnimatedLayout", !1);
|
|
3415
|
+
o(this, "hasLayout", !1);
|
|
3416
|
+
o(this, "boxRenderingTrigger", new G());
|
|
3417
|
+
o(this, "graphStore", new Ee());
|
|
3418
|
+
o(this, "viewportStore", new je());
|
|
3419
|
+
o(this, "graph", new Le(this.graphStore));
|
|
3420
|
+
o(this, "viewport", new Re(this.viewportStore));
|
|
3421
|
+
o(this, "window", window);
|
|
3422
|
+
o(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
3252
3423
|
this.element = e;
|
|
3253
3424
|
}
|
|
3254
3425
|
/**
|
|
@@ -3304,51 +3475,51 @@ class zt {
|
|
|
3304
3475
|
* enables nodes positioning with specified layout
|
|
3305
3476
|
*/
|
|
3306
3477
|
enableLayout(e) {
|
|
3307
|
-
return this.layoutConfig = e, this.
|
|
3478
|
+
return this.layoutConfig = e, this.hasLayout = !0, this.hasAnimatedLayout = !1, this;
|
|
3308
3479
|
}
|
|
3309
3480
|
/**
|
|
3310
3481
|
* enables animated nodes positioning with specified layout
|
|
3311
3482
|
*/
|
|
3312
3483
|
enableAnimatedLayout(e) {
|
|
3313
|
-
return this.animatedLayoutConfig = e, this.
|
|
3484
|
+
return this.animatedLayoutConfig = e, this.hasAnimatedLayout = !0, this.hasLayout = !1, this;
|
|
3314
3485
|
}
|
|
3315
3486
|
/**
|
|
3316
3487
|
* builds final canvas
|
|
3317
3488
|
*/
|
|
3318
3489
|
build() {
|
|
3319
3490
|
if (this.used)
|
|
3320
|
-
throw new
|
|
3491
|
+
throw new Ot("CanvasBuilder is a single use object");
|
|
3321
3492
|
this.used = !0;
|
|
3322
|
-
const e = new
|
|
3323
|
-
let t = new
|
|
3493
|
+
const e = new Pt(this.element);
|
|
3494
|
+
let t = new me(
|
|
3324
3495
|
this.graphStore,
|
|
3325
3496
|
this.viewportStore,
|
|
3326
3497
|
e.main
|
|
3327
3498
|
);
|
|
3328
|
-
this.virtualScrollConfig !== void 0 && (t = new
|
|
3499
|
+
this.virtualScrollConfig !== void 0 && (t = new Xe(
|
|
3329
3500
|
t,
|
|
3330
3501
|
this.graphStore,
|
|
3331
3502
|
this.boxRenderingTrigger,
|
|
3332
|
-
|
|
3333
|
-
)), t = new
|
|
3334
|
-
const
|
|
3503
|
+
Ft(this.virtualScrollConfig)
|
|
3504
|
+
)), t = new Ye(t, this.graphStore);
|
|
3505
|
+
const s = Dt(this.canvasDefaults), i = new ve(
|
|
3335
3506
|
this.graph,
|
|
3336
3507
|
this.viewport,
|
|
3337
3508
|
this.graphStore,
|
|
3338
3509
|
this.viewportStore,
|
|
3339
3510
|
t,
|
|
3340
|
-
|
|
3511
|
+
s
|
|
3341
3512
|
);
|
|
3342
3513
|
if (this.hasBackground && _.configure(
|
|
3343
3514
|
i,
|
|
3344
|
-
|
|
3515
|
+
$t(this.backgroundConfig),
|
|
3345
3516
|
e.background
|
|
3346
|
-
), this.hasNodeResizeReactiveEdges &&
|
|
3347
|
-
let a =
|
|
3348
|
-
this.
|
|
3517
|
+
), this.hasNodeResizeReactiveEdges && K.configure(i), this.hasDraggableNodes) {
|
|
3518
|
+
let a = Nt(this.dragConfig);
|
|
3519
|
+
this.hasAnimatedLayout && (a = Gt(
|
|
3349
3520
|
a,
|
|
3350
3521
|
this.animationStaticNodes
|
|
3351
|
-
)),
|
|
3522
|
+
)), Q.configure(
|
|
3352
3523
|
i,
|
|
3353
3524
|
e.main,
|
|
3354
3525
|
this.window,
|
|
@@ -3356,12 +3527,12 @@ class zt {
|
|
|
3356
3527
|
);
|
|
3357
3528
|
}
|
|
3358
3529
|
if (this.hasUserConnectablePorts) {
|
|
3359
|
-
const a =
|
|
3530
|
+
const a = It(
|
|
3360
3531
|
this.connectablePortsConfig,
|
|
3361
|
-
|
|
3362
|
-
|
|
3532
|
+
s.edges.shapeFactory,
|
|
3533
|
+
s.ports.direction
|
|
3363
3534
|
);
|
|
3364
|
-
|
|
3535
|
+
ee.configure(
|
|
3365
3536
|
i,
|
|
3366
3537
|
e.overlayConnectablePorts,
|
|
3367
3538
|
this.viewportStore,
|
|
@@ -3370,11 +3541,11 @@ class zt {
|
|
|
3370
3541
|
);
|
|
3371
3542
|
}
|
|
3372
3543
|
if (this.hasUserDraggableEdges) {
|
|
3373
|
-
const a =
|
|
3544
|
+
const a = Ut(
|
|
3374
3545
|
this.draggableEdgesConfig,
|
|
3375
3546
|
i.graph
|
|
3376
3547
|
);
|
|
3377
|
-
|
|
3548
|
+
te.configure(
|
|
3378
3549
|
i,
|
|
3379
3550
|
e.overlayDraggableEdges,
|
|
3380
3551
|
this.viewportStore,
|
|
@@ -3382,27 +3553,27 @@ class zt {
|
|
|
3382
3553
|
a
|
|
3383
3554
|
);
|
|
3384
3555
|
}
|
|
3385
|
-
this.virtualScrollConfig !== void 0 ?
|
|
3556
|
+
this.virtualScrollConfig !== void 0 ? q.configure(
|
|
3386
3557
|
i,
|
|
3387
3558
|
e.main,
|
|
3388
3559
|
this.window,
|
|
3389
|
-
|
|
3560
|
+
ye(this.transformConfig),
|
|
3390
3561
|
this.boxRenderingTrigger,
|
|
3391
|
-
|
|
3392
|
-
) : this.hasTransformableViewport &&
|
|
3562
|
+
Bt(this.virtualScrollConfig)
|
|
3563
|
+
) : this.hasTransformableViewport && X.configure(
|
|
3393
3564
|
i,
|
|
3394
3565
|
e.main,
|
|
3395
3566
|
this.window,
|
|
3396
|
-
|
|
3397
|
-
), this.
|
|
3567
|
+
ye(this.transformConfig)
|
|
3568
|
+
), this.hasLayout && At.configure(
|
|
3398
3569
|
i,
|
|
3399
|
-
|
|
3400
|
-
), this.
|
|
3570
|
+
jt(this.layoutConfig)
|
|
3571
|
+
), this.hasAnimatedLayout && (Kt(
|
|
3401
3572
|
i.graph,
|
|
3402
3573
|
this.animationStaticNodes
|
|
3403
3574
|
), oe.configure(
|
|
3404
3575
|
i,
|
|
3405
|
-
|
|
3576
|
+
Xt(this.animatedLayoutConfig),
|
|
3406
3577
|
this.animationStaticNodes,
|
|
3407
3578
|
this.window
|
|
3408
3579
|
));
|
|
@@ -3413,16 +3584,16 @@ class zt {
|
|
|
3413
3584
|
}
|
|
3414
3585
|
}
|
|
3415
3586
|
export {
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3587
|
+
dt as BezierEdgeShape,
|
|
3588
|
+
Qt as CanvasBuilder,
|
|
3589
|
+
Ot as CanvasBuilderError,
|
|
3590
|
+
P as CanvasError,
|
|
3420
3591
|
Ne as DirectEdgeShape,
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3592
|
+
G as EventSubject,
|
|
3593
|
+
ct as HorizontalEdgeShape,
|
|
3594
|
+
wt as InteractiveEdgeError,
|
|
3595
|
+
Me as InteractiveEdgeShape,
|
|
3596
|
+
Jt as MidpointEdgeShape,
|
|
3597
|
+
lt as StraightEdgeShape,
|
|
3598
|
+
gt as VerticalEdgeShape
|
|
3428
3599
|
};
|