@html-graph/html-graph 5.1.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/html-graph.d.ts +82 -4
- package/dist/html-graph.js +1390 -1037
- 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 ye {
|
|
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 ue {
|
|
|
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 ue {
|
|
|
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 ue {
|
|
|
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 Ue {
|
|
|
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 Ue {
|
|
|
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 Ue {
|
|
|
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 Ie {
|
|
|
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 pe {
|
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
const
|
|
272
|
-
const r = new
|
|
271
|
+
const S = () => {
|
|
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] = S();
|
|
365
365
|
}
|
|
366
366
|
/**
|
|
367
367
|
* adds new node
|
|
@@ -369,9 +369,9 @@ class we {
|
|
|
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 we {
|
|
|
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 we {
|
|
|
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 we {
|
|
|
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 we {
|
|
|
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 we {
|
|
|
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 we {
|
|
|
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 we {
|
|
|
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 we {
|
|
|
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 we {
|
|
|
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 we {
|
|
|
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 Be {
|
|
|
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] = S(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = S(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = S(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = S(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = S(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = S(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = S(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = S(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = S(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = S(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = S(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = S(), [this.beforeClearEmitter, this.onBeforeClear] = S();
|
|
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 fe {
|
|
|
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 fe {
|
|
|
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);
|
|
@@ -626,14 +626,14 @@ class fe {
|
|
|
626
626
|
direction: e.direction
|
|
627
627
|
},
|
|
628
628
|
nodeId: e.nodeId
|
|
629
|
-
}), this.elementPorts.addRecord(e.element, e.id), this.
|
|
629
|
+
}), this.elementPorts.addRecord(e.element, e.id), this.portCycleEdges.set(e.id, /* @__PURE__ */ new Set()), this.portIncomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.portOutcomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.nodes.get(e.nodeId).ports.set(e.id, e.element), this.afterPortAddedEmitter.emit(e.id);
|
|
630
630
|
}
|
|
631
631
|
getPort(e) {
|
|
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 fe {
|
|
|
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());
|
|
@@ -677,16 +677,16 @@ class fe {
|
|
|
677
677
|
this.beforeEdgeRemovedEmitter.emit(e), this.removeEdgeInternal(e);
|
|
678
678
|
}
|
|
679
679
|
clear() {
|
|
680
|
-
this.beforeClearEmitter.emit(), this.
|
|
680
|
+
this.beforeClearEmitter.emit(), this.portIncomingEdges.clear(), this.portOutcomingEdges.clear(), this.portCycleEdges.clear(), this.elementPorts.clear(), this.nodesElementsMap.clear(), this.edges.clear(), this.ports.clear(), this.nodes.clear();
|
|
681
681
|
}
|
|
682
682
|
getPortIncomingEdgeIds(e) {
|
|
683
|
-
return Array.from(this.
|
|
683
|
+
return Array.from(this.portIncomingEdges.get(e));
|
|
684
684
|
}
|
|
685
685
|
getPortOutgoingEdgeIds(e) {
|
|
686
|
-
return Array.from(this.
|
|
686
|
+
return Array.from(this.portOutcomingEdges.get(e));
|
|
687
687
|
}
|
|
688
688
|
getPortCycleEdgeIds(e) {
|
|
689
|
-
return Array.from(this.
|
|
689
|
+
return Array.from(this.portCycleEdges.get(e));
|
|
690
690
|
}
|
|
691
691
|
getPortAdjacentEdgeIds(e) {
|
|
692
692
|
return [
|
|
@@ -696,32 +696,51 @@ class fe {
|
|
|
696
696
|
];
|
|
697
697
|
}
|
|
698
698
|
getNodeIncomingEdgeIds(e) {
|
|
699
|
-
const t = Array.from(this.nodes.get(e).ports.keys());
|
|
700
|
-
let o = [];
|
|
699
|
+
const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
|
|
701
700
|
return t.forEach((i) => {
|
|
702
|
-
|
|
703
|
-
|
|
701
|
+
this.getPortIncomingEdgeIds(i).filter((n) => {
|
|
702
|
+
const a = this.getEdge(n);
|
|
703
|
+
return this.getPort(a.from).nodeId !== e;
|
|
704
|
+
}).forEach((n) => {
|
|
705
|
+
s.push(n);
|
|
706
|
+
});
|
|
707
|
+
}), s;
|
|
704
708
|
}
|
|
705
709
|
getNodeOutgoingEdgeIds(e) {
|
|
706
|
-
const t = Array.from(this.nodes.get(e).ports.keys());
|
|
707
|
-
let o = [];
|
|
710
|
+
const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
|
|
708
711
|
return t.forEach((i) => {
|
|
709
|
-
|
|
710
|
-
|
|
712
|
+
this.getPortOutgoingEdgeIds(i).filter((n) => {
|
|
713
|
+
const a = this.getEdge(n);
|
|
714
|
+
return this.getPort(a.to).nodeId !== e;
|
|
715
|
+
}).forEach((n) => {
|
|
716
|
+
s.push(n);
|
|
717
|
+
});
|
|
718
|
+
}), s;
|
|
711
719
|
}
|
|
712
720
|
getNodeCycleEdgeIds(e) {
|
|
713
|
-
const t = Array.from(this.nodes.get(e).ports.keys());
|
|
714
|
-
let o = [];
|
|
721
|
+
const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
|
|
715
722
|
return t.forEach((i) => {
|
|
716
|
-
|
|
717
|
-
|
|
723
|
+
this.getPortCycleEdgeIds(i).forEach((n) => {
|
|
724
|
+
s.push(n);
|
|
725
|
+
}), this.getPortIncomingEdgeIds(i).filter((n) => {
|
|
726
|
+
const a = this.getEdge(n);
|
|
727
|
+
return this.getPort(a.to).nodeId === e;
|
|
728
|
+
}).forEach((n) => {
|
|
729
|
+
s.push(n);
|
|
730
|
+
});
|
|
731
|
+
}), s;
|
|
718
732
|
}
|
|
719
733
|
getNodeAdjacentEdgeIds(e) {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
734
|
+
const t = Array.from(this.nodes.get(e).ports.keys()), s = [];
|
|
735
|
+
return t.forEach((i) => {
|
|
736
|
+
this.getPortIncomingEdgeIds(i).forEach((n) => {
|
|
737
|
+
s.push(n);
|
|
738
|
+
}), this.getPortOutgoingEdgeIds(i).forEach((n) => {
|
|
739
|
+
s.push(n);
|
|
740
|
+
}), this.getPortCycleEdgeIds(i).forEach((n) => {
|
|
741
|
+
s.push(n);
|
|
742
|
+
});
|
|
743
|
+
}), s;
|
|
725
744
|
}
|
|
726
745
|
addEdgeInternal(e) {
|
|
727
746
|
this.edges.set(e.id, {
|
|
@@ -731,29 +750,29 @@ class fe {
|
|
|
731
750
|
shape: e.shape,
|
|
732
751
|
priority: e.priority
|
|
733
752
|
}
|
|
734
|
-
}), e.from !== e.to ? (this.
|
|
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);
|
|
735
754
|
}
|
|
736
755
|
removeEdgeInternal(e) {
|
|
737
|
-
const t = this.edges.get(e),
|
|
738
|
-
this.
|
|
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);
|
|
739
758
|
}
|
|
740
759
|
}
|
|
741
|
-
const
|
|
760
|
+
const ce = (r) => ({
|
|
742
761
|
scale: 1 / r.scale,
|
|
743
762
|
x: -r.x / r.scale,
|
|
744
763
|
y: -r.y / r.scale
|
|
745
|
-
}),
|
|
764
|
+
}), le = {
|
|
746
765
|
scale: 1,
|
|
747
766
|
x: 0,
|
|
748
767
|
y: 0
|
|
749
768
|
};
|
|
750
|
-
class
|
|
769
|
+
class je {
|
|
751
770
|
constructor() {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
[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] = S();
|
|
757
776
|
}
|
|
758
777
|
getViewportMatrix() {
|
|
759
778
|
return this.viewportMatrix;
|
|
@@ -766,52 +785,52 @@ class Fe {
|
|
|
766
785
|
scale: e.scale ?? this.viewportMatrix.scale,
|
|
767
786
|
x: e.x ?? this.viewportMatrix.x,
|
|
768
787
|
y: e.y ?? this.viewportMatrix.y
|
|
769
|
-
}, this.contentMatrix =
|
|
788
|
+
}, this.contentMatrix = ce(this.viewportMatrix), this.afterUpdateEmitter.emit();
|
|
770
789
|
}
|
|
771
790
|
patchContentMatrix(e) {
|
|
772
791
|
this.contentMatrix = {
|
|
773
792
|
scale: e.scale ?? this.contentMatrix.scale,
|
|
774
793
|
x: e.x ?? this.contentMatrix.x,
|
|
775
794
|
y: e.y ?? this.contentMatrix.y
|
|
776
|
-
}, this.viewportMatrix =
|
|
795
|
+
}, this.viewportMatrix = ce(this.contentMatrix), this.afterUpdateEmitter.emit();
|
|
777
796
|
}
|
|
778
797
|
}
|
|
779
|
-
class
|
|
798
|
+
class K {
|
|
780
799
|
constructor(e) {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
800
|
+
o(this, "elementToNodeId", /* @__PURE__ */ new Map());
|
|
801
|
+
o(this, "nodesResizeObserver");
|
|
802
|
+
o(this, "onAfterNodeAdded", (e) => {
|
|
784
803
|
const t = this.canvas.graph.getNode(e);
|
|
785
804
|
this.elementToNodeId.set(t.element, e), this.nodesResizeObserver.observe(t.element);
|
|
786
805
|
});
|
|
787
|
-
|
|
806
|
+
o(this, "onBeforeNodeRemoved", (e) => {
|
|
788
807
|
const t = this.canvas.graph.getNode(e);
|
|
789
808
|
this.elementToNodeId.delete(t.element), this.nodesResizeObserver.unobserve(t.element);
|
|
790
809
|
});
|
|
791
|
-
|
|
810
|
+
o(this, "onBeforeClear", () => {
|
|
792
811
|
this.nodesResizeObserver.disconnect(), this.elementToNodeId.clear();
|
|
793
812
|
});
|
|
794
813
|
this.canvas = e, this.nodesResizeObserver = new ResizeObserver((t) => {
|
|
795
|
-
t.forEach((
|
|
796
|
-
const i =
|
|
814
|
+
t.forEach((s) => {
|
|
815
|
+
const i = s.target;
|
|
797
816
|
this.handleNodeResize(i);
|
|
798
817
|
});
|
|
799
818
|
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
|
|
800
819
|
}
|
|
801
820
|
static configure(e) {
|
|
802
|
-
new
|
|
821
|
+
new K(e);
|
|
803
822
|
}
|
|
804
823
|
handleNodeResize(e) {
|
|
805
824
|
const t = this.elementToNodeId.get(e);
|
|
806
825
|
this.canvas.updateNode(t);
|
|
807
826
|
}
|
|
808
827
|
}
|
|
809
|
-
const
|
|
810
|
-
const { x:
|
|
811
|
-
return e >=
|
|
812
|
-
},
|
|
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) => {
|
|
813
832
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
814
|
-
},
|
|
833
|
+
}, F = (r) => {
|
|
815
834
|
const e = document.createElement("div");
|
|
816
835
|
return {
|
|
817
836
|
id: r.overlayId,
|
|
@@ -826,38 +845,38 @@ const Oe = (r, e, t) => {
|
|
|
826
845
|
}
|
|
827
846
|
]
|
|
828
847
|
};
|
|
829
|
-
},
|
|
830
|
-
let t = e,
|
|
831
|
-
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); )
|
|
832
851
|
t = t.parentElement;
|
|
833
|
-
return
|
|
834
|
-
},
|
|
852
|
+
return s;
|
|
853
|
+
}, Ae = (r, e) => {
|
|
835
854
|
const t = document.elementsFromPoint(e.x, e.y);
|
|
836
|
-
for (const
|
|
837
|
-
const i =
|
|
855
|
+
for (const s of t) {
|
|
856
|
+
const i = Ze(r, s);
|
|
838
857
|
if (i !== null)
|
|
839
858
|
return i;
|
|
840
859
|
}
|
|
841
860
|
return null;
|
|
842
861
|
};
|
|
843
|
-
var
|
|
844
|
-
const
|
|
862
|
+
var b = /* @__PURE__ */ ((r) => (r.Static = "static", r.Dragging = "dragging", r.Edge = "edge", r))(b || {});
|
|
863
|
+
const xe = (r, e) => ({
|
|
845
864
|
x: r / 2,
|
|
846
865
|
y: e / 2
|
|
847
|
-
}),
|
|
866
|
+
}), p = {
|
|
848
867
|
x: 0,
|
|
849
868
|
y: 0
|
|
850
|
-
},
|
|
869
|
+
}, y = (r, e, t) => ({
|
|
851
870
|
x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
|
|
852
871
|
y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
|
|
853
|
-
}),
|
|
872
|
+
}), Se = (r, e) => {
|
|
854
873
|
const t = {
|
|
855
874
|
x: r.x + r.width / 2,
|
|
856
875
|
y: r.y + r.height / 2
|
|
857
|
-
},
|
|
876
|
+
}, s = {
|
|
858
877
|
x: e.x + e.width / 2,
|
|
859
878
|
y: e.y + e.height / 2
|
|
860
|
-
}, 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;
|
|
861
880
|
return {
|
|
862
881
|
x: i,
|
|
863
882
|
y: n,
|
|
@@ -866,311 +885,311 @@ const me = (r, e) => ({
|
|
|
866
885
|
flipX: d,
|
|
867
886
|
flipY: c
|
|
868
887
|
};
|
|
869
|
-
},
|
|
870
|
-
x: e * r.x + (1 - e) / 2 *
|
|
871
|
-
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
|
|
872
891
|
});
|
|
873
|
-
class
|
|
892
|
+
class Je {
|
|
874
893
|
constructor(e) {
|
|
875
|
-
|
|
876
|
-
|
|
894
|
+
o(this, "path");
|
|
895
|
+
o(this, "midpoint");
|
|
877
896
|
this.params = e;
|
|
878
897
|
const t = this.params.to;
|
|
879
898
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
880
|
-
const
|
|
881
|
-
{ x: this.params.arrowLength, y:
|
|
899
|
+
const s = y(
|
|
900
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
882
901
|
this.params.sourceDirection,
|
|
883
|
-
|
|
884
|
-
), i =
|
|
902
|
+
p
|
|
903
|
+
), i = y(
|
|
885
904
|
{ x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
|
|
886
905
|
this.params.targetDirection,
|
|
887
906
|
this.params.to
|
|
888
907
|
), n = {
|
|
889
|
-
x:
|
|
890
|
-
y:
|
|
908
|
+
x: s.x + this.params.sourceDirection.x * this.params.curvature,
|
|
909
|
+
y: s.y + this.params.sourceDirection.y * this.params.curvature
|
|
891
910
|
}, a = {
|
|
892
911
|
x: i.x - this.params.targetDirection.x * this.params.curvature,
|
|
893
912
|
y: i.y - this.params.targetDirection.y * this.params.curvature
|
|
894
|
-
}, 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}`;
|
|
895
914
|
this.path = `${d}${h}${c}`;
|
|
896
915
|
}
|
|
897
916
|
}
|
|
898
|
-
class
|
|
917
|
+
class Qe {
|
|
899
918
|
constructor(e) {
|
|
900
|
-
|
|
901
|
-
|
|
919
|
+
o(this, "path");
|
|
920
|
+
o(this, "midpoint");
|
|
902
921
|
this.params = e;
|
|
903
|
-
const t = this.params.hasSourceArrow ?
|
|
904
|
-
{ x: this.params.arrowLength, y:
|
|
922
|
+
const t = this.params.hasSourceArrow ? y(
|
|
923
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
905
924
|
this.params.sourceDirection,
|
|
906
|
-
|
|
907
|
-
) :
|
|
925
|
+
p
|
|
926
|
+
) : p, s = this.params.hasTargetArrow ? y(
|
|
908
927
|
{
|
|
909
928
|
x: this.params.to.x - this.params.arrowLength,
|
|
910
929
|
y: this.params.to.y
|
|
911
930
|
},
|
|
912
931
|
this.params.targetDirection,
|
|
913
932
|
this.params.to
|
|
914
|
-
) : 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 =
|
|
915
|
-
{ x: i, y:
|
|
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 = y(
|
|
934
|
+
{ x: i, y: p.y },
|
|
916
935
|
this.params.sourceDirection,
|
|
917
|
-
|
|
918
|
-
),
|
|
936
|
+
p
|
|
937
|
+
), g = {
|
|
919
938
|
x: c.x + h,
|
|
920
939
|
y: c.y + d
|
|
921
|
-
},
|
|
940
|
+
}, l = y(
|
|
922
941
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
923
942
|
this.params.targetDirection,
|
|
924
943
|
this.params.to
|
|
925
|
-
),
|
|
926
|
-
x:
|
|
927
|
-
y:
|
|
928
|
-
},
|
|
929
|
-
x: (
|
|
930
|
-
y: (
|
|
931
|
-
},
|
|
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
|
+
}, m = {
|
|
932
951
|
x: c.x + this.params.curvature * this.params.sourceDirection.x,
|
|
933
952
|
y: c.y + this.params.curvature * this.params.sourceDirection.y
|
|
934
953
|
}, v = {
|
|
935
|
-
x:
|
|
936
|
-
y:
|
|
937
|
-
},
|
|
954
|
+
x: l.x - this.params.curvature * this.params.targetDirection.x,
|
|
955
|
+
y: l.y - this.params.curvature * this.params.targetDirection.y
|
|
956
|
+
}, E = {
|
|
938
957
|
x: c.x + h,
|
|
939
958
|
y: c.y + d
|
|
940
959
|
}, A = {
|
|
941
|
-
x:
|
|
942
|
-
y:
|
|
960
|
+
x: l.x + h,
|
|
961
|
+
y: l.y + d
|
|
943
962
|
};
|
|
944
963
|
this.path = [
|
|
945
964
|
`M ${t.x} ${t.y}`,
|
|
946
965
|
`L ${c.x} ${c.y}`,
|
|
947
|
-
`C ${
|
|
948
|
-
`C ${A.x} ${A.y} ${v.x} ${v.y} ${
|
|
949
|
-
`L ${
|
|
950
|
-
].join(" "), this.midpoint =
|
|
966
|
+
`C ${m.x} ${m.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);
|
|
951
970
|
}
|
|
952
971
|
}
|
|
953
|
-
const
|
|
972
|
+
const Z = Object.freeze({
|
|
954
973
|
edgeColor: "--edge-color"
|
|
955
|
-
}),
|
|
974
|
+
}), Pe = (r) => {
|
|
956
975
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
957
|
-
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(
|
|
958
|
-
},
|
|
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) => {
|
|
959
978
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
960
|
-
return e.setAttribute("stroke", `var(${
|
|
961
|
-
},
|
|
979
|
+
return e.setAttribute("stroke", `var(${Z.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
980
|
+
}, O = () => {
|
|
962
981
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
963
|
-
return r.setAttribute("fill", `var(${
|
|
964
|
-
},
|
|
982
|
+
return r.setAttribute("fill", `var(${Z.edgeColor})`), r;
|
|
983
|
+
}, Te = () => {
|
|
965
984
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
966
985
|
return r.style.transformOrigin = "50% 50%", r;
|
|
967
|
-
},
|
|
986
|
+
}, De = (r, e) => {
|
|
968
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`;
|
|
969
|
-
},
|
|
988
|
+
}, L = (r, e) => {
|
|
970
989
|
const t = [];
|
|
971
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) {
|
|
972
|
-
const
|
|
991
|
+
const s = r.length - 1;
|
|
973
992
|
let i = 0, n = 0, a = 0;
|
|
974
993
|
r.forEach((h, d) => {
|
|
975
|
-
let c = 0,
|
|
976
|
-
const
|
|
977
|
-
if (
|
|
978
|
-
const
|
|
979
|
-
i =
|
|
994
|
+
let c = 0, g = 0, l = 0;
|
|
995
|
+
const u = d > 0, w = d < s, m = 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);
|
|
980
999
|
}
|
|
981
|
-
const
|
|
982
|
-
d > 0 && t.push(`L ${
|
|
1000
|
+
const E = a !== 0 ? Math.min((m ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, A = m ? { x: h.x + i * E, y: h.y + n * E } : h, T = l !== 0 ? Math.min((m ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, N = m ? { x: h.x + c * T, y: h.y + g * T } : h;
|
|
1001
|
+
d > 0 && t.push(`L ${N.x} ${N.y}`), m && t.push(
|
|
983
1002
|
`C ${h.x} ${h.y} ${h.x} ${h.y} ${A.x} ${A.y}`
|
|
984
1003
|
);
|
|
985
1004
|
});
|
|
986
1005
|
}
|
|
987
1006
|
return t.join(" ");
|
|
988
1007
|
};
|
|
989
|
-
class
|
|
1008
|
+
class qe {
|
|
990
1009
|
constructor(e) {
|
|
991
|
-
|
|
992
|
-
|
|
1010
|
+
o(this, "path");
|
|
1011
|
+
o(this, "midpoint");
|
|
993
1012
|
this.params = e;
|
|
994
1013
|
const t = this.params.to;
|
|
995
1014
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
996
|
-
const
|
|
997
|
-
{ x: this.params.arrowLength, y:
|
|
1015
|
+
const s = this.params.hasSourceArrow ? y(
|
|
1016
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
998
1017
|
this.params.sourceDirection,
|
|
999
|
-
|
|
1000
|
-
) :
|
|
1018
|
+
p
|
|
1019
|
+
) : p, i = this.params.hasTargetArrow ? y(
|
|
1001
1020
|
{
|
|
1002
1021
|
x: this.params.to.x - this.params.arrowLength,
|
|
1003
1022
|
y: this.params.to.y
|
|
1004
1023
|
},
|
|
1005
1024
|
this.params.targetDirection,
|
|
1006
1025
|
this.params.to
|
|
1007
|
-
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h =
|
|
1008
|
-
{ x: a, y:
|
|
1026
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = y(
|
|
1027
|
+
{ x: a, y: p.y },
|
|
1009
1028
|
this.params.sourceDirection,
|
|
1010
|
-
|
|
1011
|
-
), d =
|
|
1029
|
+
p
|
|
1030
|
+
), d = y(
|
|
1012
1031
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1013
1032
|
this.params.targetDirection,
|
|
1014
1033
|
this.params.to
|
|
1015
|
-
), 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 = {
|
|
1016
1035
|
x: this.params.flipX > 0 ? c : -n,
|
|
1017
1036
|
y: h.y
|
|
1018
|
-
},
|
|
1037
|
+
}, u = { x: l.x, y: g }, w = {
|
|
1019
1038
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
1020
1039
|
y: d.y
|
|
1021
|
-
},
|
|
1022
|
-
this.path =
|
|
1023
|
-
[
|
|
1040
|
+
}, m = { x: w.x, y: g };
|
|
1041
|
+
this.path = L(
|
|
1042
|
+
[s, h, l, u, m, w, d, i],
|
|
1024
1043
|
this.params.roundness
|
|
1025
1044
|
);
|
|
1026
1045
|
}
|
|
1027
1046
|
}
|
|
1028
|
-
class
|
|
1047
|
+
class _e {
|
|
1029
1048
|
constructor(e) {
|
|
1030
|
-
|
|
1031
|
-
|
|
1049
|
+
o(this, "path");
|
|
1050
|
+
o(this, "midpoint");
|
|
1032
1051
|
this.params = e;
|
|
1033
|
-
const t = this.params.hasSourceArrow ?
|
|
1034
|
-
{ x: this.params.arrowLength, y:
|
|
1052
|
+
const t = this.params.hasSourceArrow ? y(
|
|
1053
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1035
1054
|
this.params.sourceDirection,
|
|
1036
|
-
|
|
1037
|
-
) :
|
|
1055
|
+
p
|
|
1056
|
+
) : p, s = this.params.hasTargetArrow ? y(
|
|
1038
1057
|
{
|
|
1039
1058
|
x: this.params.to.x - this.params.arrowLength,
|
|
1040
1059
|
y: this.params.to.y
|
|
1041
1060
|
},
|
|
1042
1061
|
this.params.targetDirection,
|
|
1043
1062
|
this.params.to
|
|
1044
|
-
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n =
|
|
1045
|
-
{ x: i, y:
|
|
1063
|
+
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
|
|
1064
|
+
{ x: i, y: p.y },
|
|
1046
1065
|
this.params.sourceDirection,
|
|
1047
|
-
|
|
1048
|
-
), 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 = y(
|
|
1049
1068
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1050
1069
|
this.params.targetDirection,
|
|
1051
1070
|
this.params.to
|
|
1052
|
-
),
|
|
1053
|
-
this.midpoint =
|
|
1054
|
-
[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],
|
|
1055
1074
|
this.params.roundness
|
|
1056
1075
|
);
|
|
1057
1076
|
}
|
|
1058
1077
|
}
|
|
1059
|
-
class
|
|
1078
|
+
class et {
|
|
1060
1079
|
constructor(e) {
|
|
1061
|
-
|
|
1062
|
-
|
|
1080
|
+
o(this, "path");
|
|
1081
|
+
o(this, "midpoint");
|
|
1063
1082
|
this.params = e;
|
|
1064
1083
|
const t = this.params.to;
|
|
1065
1084
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1066
|
-
const
|
|
1067
|
-
{ x: this.params.arrowLength, y:
|
|
1085
|
+
const s = this.params.hasSourceArrow ? y(
|
|
1086
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1068
1087
|
this.params.sourceDirection,
|
|
1069
|
-
|
|
1070
|
-
) :
|
|
1088
|
+
p
|
|
1089
|
+
) : p, i = this.params.hasTargetArrow ? y(
|
|
1071
1090
|
{
|
|
1072
1091
|
x: this.params.to.x - this.params.arrowLength,
|
|
1073
1092
|
y: this.params.to.y
|
|
1074
1093
|
},
|
|
1075
1094
|
this.params.targetDirection,
|
|
1076
1095
|
this.params.to
|
|
1077
|
-
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a =
|
|
1078
|
-
{ x: n, y:
|
|
1096
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = y(
|
|
1097
|
+
{ x: n, y: p.y },
|
|
1079
1098
|
this.params.sourceDirection,
|
|
1080
|
-
|
|
1081
|
-
), h =
|
|
1099
|
+
p
|
|
1100
|
+
), h = y(
|
|
1082
1101
|
{ x: this.params.to.x - n, y: this.params.to.y },
|
|
1083
1102
|
this.params.targetDirection,
|
|
1084
1103
|
this.params.to
|
|
1085
1104
|
);
|
|
1086
|
-
this.path =
|
|
1105
|
+
this.path = L([s, a, h, i], this.params.roundness);
|
|
1087
1106
|
}
|
|
1088
1107
|
}
|
|
1089
|
-
class
|
|
1108
|
+
class tt {
|
|
1090
1109
|
constructor(e) {
|
|
1091
|
-
|
|
1092
|
-
|
|
1110
|
+
o(this, "path");
|
|
1111
|
+
o(this, "midpoint");
|
|
1093
1112
|
this.params = e;
|
|
1094
1113
|
const t = this.params.to;
|
|
1095
1114
|
this.midpoint = { x: t.x / 2, y: t.y / 2 };
|
|
1096
|
-
const
|
|
1097
|
-
{ x: this.params.arrowLength, y:
|
|
1115
|
+
const s = this.params.hasSourceArrow ? y(
|
|
1116
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1098
1117
|
this.params.sourceDirection,
|
|
1099
|
-
|
|
1100
|
-
) :
|
|
1118
|
+
p
|
|
1119
|
+
) : p, i = this.params.hasTargetArrow ? y(
|
|
1101
1120
|
{
|
|
1102
1121
|
x: this.params.to.x - this.params.arrowLength,
|
|
1103
1122
|
y: this.params.to.y
|
|
1104
1123
|
},
|
|
1105
1124
|
this.params.targetDirection,
|
|
1106
1125
|
this.params.to
|
|
1107
|
-
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h =
|
|
1108
|
-
{ x: a, y:
|
|
1126
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = y(
|
|
1127
|
+
{ x: a, y: p.y },
|
|
1109
1128
|
this.params.sourceDirection,
|
|
1110
|
-
|
|
1111
|
-
), d =
|
|
1129
|
+
p
|
|
1130
|
+
), d = y(
|
|
1112
1131
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1113
1132
|
this.params.targetDirection,
|
|
1114
1133
|
this.params.to
|
|
1115
|
-
), 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 = {
|
|
1116
1135
|
x: h.x,
|
|
1117
1136
|
y: this.params.flipY > 0 ? c : -n
|
|
1118
|
-
},
|
|
1137
|
+
}, u = { x: g, y: l.y }, w = {
|
|
1119
1138
|
x: d.x,
|
|
1120
1139
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1121
|
-
},
|
|
1122
|
-
this.path =
|
|
1123
|
-
[
|
|
1140
|
+
}, m = { x: g, y: w.y };
|
|
1141
|
+
this.path = L(
|
|
1142
|
+
[s, h, l, u, m, w, d, i],
|
|
1124
1143
|
this.params.roundness
|
|
1125
1144
|
);
|
|
1126
1145
|
}
|
|
1127
1146
|
}
|
|
1128
|
-
class
|
|
1147
|
+
class J {
|
|
1129
1148
|
constructor(e) {
|
|
1130
|
-
|
|
1131
|
-
|
|
1149
|
+
o(this, "path");
|
|
1150
|
+
o(this, "midpoint");
|
|
1132
1151
|
this.params = e;
|
|
1133
|
-
const t = this.params.arrowOffset,
|
|
1134
|
-
{ x: this.params.arrowLength, y:
|
|
1135
|
-
{ 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 },
|
|
1136
1155
|
{ x: i, y: this.params.side },
|
|
1137
1156
|
{ x: n, y: this.params.side },
|
|
1138
1157
|
{ x: n, y: -this.params.side },
|
|
1139
1158
|
{ x: i, y: -this.params.side },
|
|
1140
|
-
{ x: i, y:
|
|
1141
|
-
{ x: this.params.arrowLength, y:
|
|
1159
|
+
{ x: i, y: p.y },
|
|
1160
|
+
{ x: this.params.arrowLength, y: p.y }
|
|
1142
1161
|
].map(
|
|
1143
|
-
(c) =>
|
|
1144
|
-
), d = `M ${
|
|
1145
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${
|
|
1162
|
+
(c) => y(c, this.params.sourceDirection, p)
|
|
1163
|
+
), d = `M ${p.x} ${p.y} L ${h[0].x} ${h[0].y} `;
|
|
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 };
|
|
1146
1165
|
}
|
|
1147
1166
|
}
|
|
1148
|
-
class
|
|
1167
|
+
class rt {
|
|
1149
1168
|
constructor(e) {
|
|
1150
|
-
|
|
1151
|
-
|
|
1169
|
+
o(this, "path");
|
|
1170
|
+
o(this, "midpoint");
|
|
1152
1171
|
this.params = e;
|
|
1153
|
-
const t = this.params.smallRadius,
|
|
1154
|
-
{ 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 },
|
|
1155
1174
|
{ x: c, y: n },
|
|
1156
1175
|
{ x: c, y: -n },
|
|
1157
1176
|
{ x: d, y: 0 }
|
|
1158
1177
|
].map(
|
|
1159
|
-
(
|
|
1160
|
-
),
|
|
1161
|
-
`M ${
|
|
1162
|
-
`A ${t} ${t} 0 0 1 ${
|
|
1163
|
-
`A ${
|
|
1164
|
-
`A ${t} ${t} 0 0 1 ${
|
|
1165
|
-
].join(" "),
|
|
1166
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" :
|
|
1178
|
+
(m) => y(m, 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];
|
|
1167
1186
|
}
|
|
1168
1187
|
}
|
|
1169
|
-
class
|
|
1188
|
+
class st {
|
|
1170
1189
|
constructor(e) {
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1190
|
+
o(this, "path");
|
|
1191
|
+
o(this, "midpoint");
|
|
1192
|
+
o(this, "diagonalDistance");
|
|
1174
1193
|
this.params = e;
|
|
1175
1194
|
const t = this.params.to;
|
|
1176
1195
|
if (this.midpoint = { x: t.x / 2, y: t.y / 2 }, this.diagonalDistance = Math.sqrt(
|
|
@@ -1185,7 +1204,7 @@ class Ze {
|
|
|
1185
1204
|
offset: this.params.sourceOffset,
|
|
1186
1205
|
hasArrow: this.params.hasSourceArrow,
|
|
1187
1206
|
flip: 1,
|
|
1188
|
-
shift:
|
|
1207
|
+
shift: p
|
|
1189
1208
|
}), n = this.createDirectLinePoint({
|
|
1190
1209
|
offset: this.params.targetOffset,
|
|
1191
1210
|
hasArrow: this.params.hasTargetArrow,
|
|
@@ -1195,96 +1214,96 @@ class Ze {
|
|
|
1195
1214
|
this.path = `M ${i.x} ${i.y} L ${n.x} ${n.y}`;
|
|
1196
1215
|
}
|
|
1197
1216
|
createDirectLinePoint(e) {
|
|
1198
|
-
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;
|
|
1199
1218
|
return {
|
|
1200
1219
|
x: this.params.to.x * i + e.shift.x,
|
|
1201
1220
|
y: this.params.to.y * i + e.shift.y
|
|
1202
1221
|
};
|
|
1203
1222
|
}
|
|
1204
1223
|
}
|
|
1205
|
-
class
|
|
1224
|
+
class ot {
|
|
1206
1225
|
constructor(e) {
|
|
1207
|
-
|
|
1208
|
-
|
|
1226
|
+
o(this, "path");
|
|
1227
|
+
o(this, "midpoint");
|
|
1209
1228
|
this.params = e;
|
|
1210
|
-
const t = this.params.hasSourceArrow ?
|
|
1211
|
-
{ x: this.params.arrowLength, y:
|
|
1229
|
+
const t = this.params.hasSourceArrow ? y(
|
|
1230
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1212
1231
|
this.params.sourceDirection,
|
|
1213
|
-
|
|
1214
|
-
) :
|
|
1232
|
+
p
|
|
1233
|
+
) : p, s = this.params.hasTargetArrow ? y(
|
|
1215
1234
|
{
|
|
1216
1235
|
x: this.params.to.x - this.params.arrowLength,
|
|
1217
1236
|
y: this.params.to.y
|
|
1218
1237
|
},
|
|
1219
1238
|
this.params.targetDirection,
|
|
1220
1239
|
this.params.to
|
|
1221
|
-
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n =
|
|
1222
|
-
{ x: i, y:
|
|
1240
|
+
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
|
|
1241
|
+
{ x: i, y: p.y },
|
|
1223
1242
|
this.params.sourceDirection,
|
|
1224
|
-
|
|
1225
|
-
), a =
|
|
1243
|
+
p
|
|
1244
|
+
), a = y(
|
|
1226
1245
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1227
1246
|
this.params.targetDirection,
|
|
1228
1247
|
this.params.to
|
|
1229
|
-
), 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 = {
|
|
1230
1249
|
x: (n.x + a.x) / 2,
|
|
1231
|
-
y:
|
|
1250
|
+
y: g
|
|
1232
1251
|
};
|
|
1233
|
-
this.midpoint =
|
|
1252
|
+
this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = L(
|
|
1234
1253
|
[
|
|
1235
1254
|
t,
|
|
1236
1255
|
n,
|
|
1237
|
-
{ x: n.x, y:
|
|
1238
|
-
{ x: a.x, y:
|
|
1256
|
+
{ x: n.x, y: g },
|
|
1257
|
+
{ x: a.x, y: g },
|
|
1239
1258
|
a,
|
|
1240
|
-
|
|
1259
|
+
s
|
|
1241
1260
|
],
|
|
1242
1261
|
this.params.roundness
|
|
1243
1262
|
);
|
|
1244
1263
|
}
|
|
1245
1264
|
}
|
|
1246
|
-
class
|
|
1265
|
+
class it {
|
|
1247
1266
|
constructor(e) {
|
|
1248
|
-
|
|
1249
|
-
|
|
1267
|
+
o(this, "path");
|
|
1268
|
+
o(this, "midpoint");
|
|
1250
1269
|
this.params = e;
|
|
1251
|
-
const t = this.params.hasSourceArrow ?
|
|
1252
|
-
{ x: this.params.arrowLength, y:
|
|
1270
|
+
const t = this.params.hasSourceArrow ? y(
|
|
1271
|
+
{ x: this.params.arrowLength, y: p.y },
|
|
1253
1272
|
this.params.sourceDirection,
|
|
1254
|
-
|
|
1255
|
-
) :
|
|
1273
|
+
p
|
|
1274
|
+
) : p, s = this.params.hasTargetArrow ? y(
|
|
1256
1275
|
{
|
|
1257
1276
|
x: this.params.to.x - this.params.arrowLength,
|
|
1258
1277
|
y: this.params.to.y
|
|
1259
1278
|
},
|
|
1260
1279
|
this.params.targetDirection,
|
|
1261
1280
|
this.params.to
|
|
1262
|
-
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n =
|
|
1263
|
-
{ x: i, y:
|
|
1281
|
+
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
|
|
1282
|
+
{ x: i, y: p.y },
|
|
1264
1283
|
this.params.sourceDirection,
|
|
1265
|
-
|
|
1266
|
-
), a =
|
|
1284
|
+
p
|
|
1285
|
+
), a = y(
|
|
1267
1286
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1268
1287
|
this.params.targetDirection,
|
|
1269
1288
|
this.params.to
|
|
1270
|
-
), h = this.params.detourDistance > 0 ? 1 : -1, d = this.params.to.x / 2, c = d + Math.abs(this.params.detourDistance),
|
|
1271
|
-
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,
|
|
1272
1291
|
y: (n.y + a.y) / 2
|
|
1273
1292
|
};
|
|
1274
|
-
this.midpoint =
|
|
1293
|
+
this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = L(
|
|
1275
1294
|
[
|
|
1276
1295
|
t,
|
|
1277
1296
|
n,
|
|
1278
|
-
{ x:
|
|
1279
|
-
{ x:
|
|
1297
|
+
{ x: g, y: n.y },
|
|
1298
|
+
{ x: g, y: a.y },
|
|
1280
1299
|
a,
|
|
1281
|
-
|
|
1300
|
+
s
|
|
1282
1301
|
],
|
|
1283
1302
|
this.params.roundness
|
|
1284
1303
|
);
|
|
1285
1304
|
}
|
|
1286
1305
|
}
|
|
1287
|
-
const
|
|
1306
|
+
const f = Object.freeze({
|
|
1288
1307
|
color: "#777777",
|
|
1289
1308
|
width: 1,
|
|
1290
1309
|
arrowLength: 20,
|
|
@@ -1306,87 +1325,87 @@ const w = Object.freeze({
|
|
|
1306
1325
|
curvature: 90,
|
|
1307
1326
|
interactiveWidth: 10,
|
|
1308
1327
|
preOffset: 0
|
|
1309
|
-
}),
|
|
1310
|
-
class
|
|
1328
|
+
}), ge = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
|
|
1329
|
+
class k {
|
|
1311
1330
|
constructor(e) {
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
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] = S(), 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));
|
|
1321
1340
|
}
|
|
1322
1341
|
render(e) {
|
|
1323
|
-
const { x: t, y:
|
|
1342
|
+
const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Se(
|
|
1324
1343
|
e.from,
|
|
1325
1344
|
e.to
|
|
1326
1345
|
);
|
|
1327
|
-
|
|
1328
|
-
const d =
|
|
1346
|
+
De(this.svg, { x: t, y: s, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1347
|
+
const d = ge(
|
|
1329
1348
|
e.from.direction,
|
|
1330
1349
|
a,
|
|
1331
1350
|
h
|
|
1332
|
-
), c =
|
|
1351
|
+
), c = ge(
|
|
1333
1352
|
e.to.direction,
|
|
1334
1353
|
a,
|
|
1335
1354
|
h
|
|
1336
|
-
),
|
|
1355
|
+
), g = {
|
|
1337
1356
|
x: i,
|
|
1338
1357
|
y: n
|
|
1339
1358
|
};
|
|
1340
|
-
let
|
|
1341
|
-
e.category ===
|
|
1342
|
-
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(
|
|
1343
1362
|
d,
|
|
1344
1363
|
c,
|
|
1345
|
-
|
|
1364
|
+
g,
|
|
1346
1365
|
a,
|
|
1347
1366
|
h
|
|
1348
1367
|
);
|
|
1349
|
-
this.line.setAttribute("d",
|
|
1350
|
-
let
|
|
1351
|
-
this.sourceArrow && (
|
|
1368
|
+
this.line.setAttribute("d", w.path);
|
|
1369
|
+
let m = null;
|
|
1370
|
+
this.sourceArrow && (m = this.arrowRenderer({
|
|
1352
1371
|
direction: d,
|
|
1353
|
-
shift:
|
|
1372
|
+
shift: p,
|
|
1354
1373
|
arrowLength: this.params.arrowLength
|
|
1355
|
-
}), this.sourceArrow.setAttribute("d",
|
|
1374
|
+
}), this.sourceArrow.setAttribute("d", m));
|
|
1356
1375
|
let v = null;
|
|
1357
1376
|
this.targetArrow && (v = this.arrowRenderer({
|
|
1358
|
-
direction:
|
|
1359
|
-
shift:
|
|
1377
|
+
direction: l,
|
|
1378
|
+
shift: g,
|
|
1360
1379
|
arrowLength: this.params.arrowLength
|
|
1361
1380
|
}), this.targetArrow.setAttribute("d", v)), this.afterRenderEmitter.emit({
|
|
1362
|
-
edgePath:
|
|
1363
|
-
sourceArrowPath:
|
|
1381
|
+
edgePath: w,
|
|
1382
|
+
sourceArrowPath: m,
|
|
1364
1383
|
targetArrowPath: v
|
|
1365
1384
|
});
|
|
1366
1385
|
}
|
|
1367
1386
|
}
|
|
1368
|
-
const
|
|
1369
|
-
const
|
|
1370
|
-
|
|
1387
|
+
const nt = (r) => (e) => {
|
|
1388
|
+
const s = [
|
|
1389
|
+
p,
|
|
1371
1390
|
{ x: e.arrowLength, y: r.radius },
|
|
1372
1391
|
{ x: e.arrowLength, y: -r.radius }
|
|
1373
1392
|
].map(
|
|
1374
|
-
(h) =>
|
|
1393
|
+
(h) => y(h, e.direction, p)
|
|
1375
1394
|
).map((h) => ({
|
|
1376
1395
|
x: h.x + e.shift.x,
|
|
1377
1396
|
y: h.y + e.shift.y
|
|
1378
|
-
})), 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}`;
|
|
1379
1398
|
return `${i} ${n} ${a} Z`;
|
|
1380
|
-
},
|
|
1381
|
-
const t = r.radius,
|
|
1382
|
-
(
|
|
1383
|
-
).map((
|
|
1384
|
-
x:
|
|
1385
|
-
y:
|
|
1386
|
-
})),
|
|
1387
|
-
return `${
|
|
1388
|
-
},
|
|
1389
|
-
const t = r.smallRadius,
|
|
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
|
+
(m) => y(m, e.direction, p)
|
|
1402
|
+
).map((m) => ({
|
|
1403
|
+
x: m.x + e.shift.x,
|
|
1404
|
+
y: m.y + e.shift.y
|
|
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 = y(
|
|
1390
1409
|
{
|
|
1391
1410
|
x: e.arrowLength,
|
|
1392
1411
|
y: 0
|
|
@@ -1399,51 +1418,51 @@ const _e = (r) => (e) => {
|
|
|
1399
1418
|
x: e.arrowLength + r.smallRadius,
|
|
1400
1419
|
y: 0
|
|
1401
1420
|
}
|
|
1402
|
-
), a = [
|
|
1403
|
-
(
|
|
1404
|
-
).map((
|
|
1405
|
-
x:
|
|
1406
|
-
y:
|
|
1407
|
-
})), h = `M ${a[0].x} ${a[0].y}`, d = `A ${
|
|
1408
|
-
return `${h} ${d} ${c} ${
|
|
1409
|
-
},
|
|
1421
|
+
), a = [p, { x: i.x, y: -i.y }, i].map(
|
|
1422
|
+
(l) => y(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) => {
|
|
1410
1429
|
if (typeof r == "function")
|
|
1411
1430
|
return r;
|
|
1412
1431
|
switch (r.type) {
|
|
1413
1432
|
case "triangle":
|
|
1414
|
-
return
|
|
1415
|
-
radius: r.radius ??
|
|
1433
|
+
return nt({
|
|
1434
|
+
radius: r.radius ?? f.polygonArrowRadius
|
|
1416
1435
|
});
|
|
1417
1436
|
case "arc":
|
|
1418
|
-
return
|
|
1419
|
-
radius: r.radius ??
|
|
1437
|
+
return at({
|
|
1438
|
+
radius: r.radius ?? f.circleArrowRadius
|
|
1420
1439
|
});
|
|
1421
1440
|
default:
|
|
1422
|
-
return
|
|
1423
|
-
smallRadius: r.smallRadius ??
|
|
1424
|
-
angle: r.angle ??
|
|
1425
|
-
radius: r.radius ??
|
|
1441
|
+
return ht({
|
|
1442
|
+
smallRadius: r.smallRadius ?? f.wedgeArrowSmallRadius,
|
|
1443
|
+
angle: r.angle ?? f.wedgeArrowAngle,
|
|
1444
|
+
radius: r.radius ?? f.wedgeArrowRadius
|
|
1426
1445
|
});
|
|
1427
1446
|
}
|
|
1428
1447
|
};
|
|
1429
|
-
class
|
|
1448
|
+
class dt {
|
|
1430
1449
|
constructor(e) {
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
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({
|
|
1447
1466
|
sourceDirection: e,
|
|
1448
1467
|
radius: this.portCycleRadius,
|
|
1449
1468
|
smallRadius: this.portCycleSmallRadius,
|
|
@@ -1451,8 +1470,8 @@ class tt {
|
|
|
1451
1470
|
hasSourceArrow: this.hasSourceArrow,
|
|
1452
1471
|
hasTargetArrow: this.hasTargetArrow
|
|
1453
1472
|
}));
|
|
1454
|
-
|
|
1455
|
-
to:
|
|
1473
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new Qe({
|
|
1474
|
+
to: s,
|
|
1456
1475
|
sourceDirection: e,
|
|
1457
1476
|
targetDirection: t,
|
|
1458
1477
|
flipX: i,
|
|
@@ -1464,8 +1483,8 @@ class tt {
|
|
|
1464
1483
|
hasSourceArrow: this.hasSourceArrow,
|
|
1465
1484
|
hasTargetArrow: this.hasTargetArrow
|
|
1466
1485
|
}));
|
|
1467
|
-
|
|
1468
|
-
to:
|
|
1486
|
+
o(this, "createLinePath", (e, t, s) => new Je({
|
|
1487
|
+
to: s,
|
|
1469
1488
|
sourceDirection: e,
|
|
1470
1489
|
targetDirection: t,
|
|
1471
1490
|
arrowLength: this.arrowLength,
|
|
@@ -1473,10 +1492,10 @@ class tt {
|
|
|
1473
1492
|
hasSourceArrow: this.hasSourceArrow,
|
|
1474
1493
|
hasTargetArrow: this.hasTargetArrow
|
|
1475
1494
|
}));
|
|
1476
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1477
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1478
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1479
|
-
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) ?? {}),
|
|
1480
1499
|
arrowLength: this.arrowLength,
|
|
1481
1500
|
hasSourceArrow: this.hasSourceArrow,
|
|
1482
1501
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1489,23 +1508,23 @@ class tt {
|
|
|
1489
1508
|
this.pathShape.render(e);
|
|
1490
1509
|
}
|
|
1491
1510
|
}
|
|
1492
|
-
class
|
|
1511
|
+
class ct {
|
|
1493
1512
|
constructor(e) {
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
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({
|
|
1509
1528
|
sourceDirection: e,
|
|
1510
1529
|
arrowLength: this.arrowLength,
|
|
1511
1530
|
side: this.cycleSquareSide,
|
|
@@ -1514,8 +1533,8 @@ class rt {
|
|
|
1514
1533
|
hasSourceArrow: this.hasSourceArrow,
|
|
1515
1534
|
hasTargetArrow: this.hasTargetArrow
|
|
1516
1535
|
}));
|
|
1517
|
-
|
|
1518
|
-
to:
|
|
1536
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new ot({
|
|
1537
|
+
to: s,
|
|
1519
1538
|
sourceDirection: e,
|
|
1520
1539
|
targetDirection: t,
|
|
1521
1540
|
flipX: i,
|
|
@@ -1527,8 +1546,8 @@ class rt {
|
|
|
1527
1546
|
hasSourceArrow: this.hasSourceArrow,
|
|
1528
1547
|
hasTargetArrow: this.hasTargetArrow
|
|
1529
1548
|
}));
|
|
1530
|
-
|
|
1531
|
-
to:
|
|
1549
|
+
o(this, "createLinePath", (e, t, s, i) => new qe({
|
|
1550
|
+
to: s,
|
|
1532
1551
|
sourceDirection: e,
|
|
1533
1552
|
targetDirection: t,
|
|
1534
1553
|
flipX: i,
|
|
@@ -1538,16 +1557,16 @@ class rt {
|
|
|
1538
1557
|
hasSourceArrow: this.hasSourceArrow,
|
|
1539
1558
|
hasTargetArrow: this.hasTargetArrow
|
|
1540
1559
|
}));
|
|
1541
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1542
|
-
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;
|
|
1543
1562
|
this.roundness = Math.min(
|
|
1544
1563
|
t,
|
|
1545
1564
|
this.arrowOffset,
|
|
1546
1565
|
this.cycleSquareSide / 2
|
|
1547
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ??
|
|
1548
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1549
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1550
|
-
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) ?? {}),
|
|
1551
1570
|
arrowLength: this.arrowLength,
|
|
1552
1571
|
hasSourceArrow: this.hasSourceArrow,
|
|
1553
1572
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1560,24 +1579,24 @@ class rt {
|
|
|
1560
1579
|
this.pathShape.render(e);
|
|
1561
1580
|
}
|
|
1562
1581
|
}
|
|
1563
|
-
class
|
|
1582
|
+
class lt {
|
|
1564
1583
|
constructor(e) {
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
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({
|
|
1581
1600
|
sourceDirection: e,
|
|
1582
1601
|
arrowLength: this.arrowLength,
|
|
1583
1602
|
side: this.cycleSquareSide,
|
|
@@ -1586,8 +1605,8 @@ class ot {
|
|
|
1586
1605
|
hasSourceArrow: this.hasSourceArrow,
|
|
1587
1606
|
hasTargetArrow: this.hasTargetArrow
|
|
1588
1607
|
}));
|
|
1589
|
-
|
|
1590
|
-
to:
|
|
1608
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new _e({
|
|
1609
|
+
to: s,
|
|
1591
1610
|
sourceDirection: e,
|
|
1592
1611
|
targetDirection: t,
|
|
1593
1612
|
flipX: i,
|
|
@@ -1600,8 +1619,8 @@ class ot {
|
|
|
1600
1619
|
hasSourceArrow: this.hasSourceArrow,
|
|
1601
1620
|
hasTargetArrow: this.hasTargetArrow
|
|
1602
1621
|
}));
|
|
1603
|
-
|
|
1604
|
-
to:
|
|
1622
|
+
o(this, "createLinePath", (e, t, s) => new et({
|
|
1623
|
+
to: s,
|
|
1605
1624
|
sourceDirection: e,
|
|
1606
1625
|
targetDirection: t,
|
|
1607
1626
|
arrowLength: this.arrowLength,
|
|
@@ -1610,16 +1629,16 @@ class ot {
|
|
|
1610
1629
|
hasSourceArrow: this.hasSourceArrow,
|
|
1611
1630
|
hasTargetArrow: this.hasTargetArrow
|
|
1612
1631
|
}));
|
|
1613
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1614
|
-
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;
|
|
1615
1634
|
this.roundness = Math.min(
|
|
1616
1635
|
t,
|
|
1617
1636
|
this.arrowOffset,
|
|
1618
1637
|
this.cycleSquareSide / 2
|
|
1619
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ??
|
|
1620
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1621
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1622
|
-
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) ?? {}),
|
|
1623
1642
|
arrowLength: this.arrowLength,
|
|
1624
1643
|
hasSourceArrow: this.hasSourceArrow,
|
|
1625
1644
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1632,23 +1651,23 @@ class ot {
|
|
|
1632
1651
|
this.pathShape.render(e);
|
|
1633
1652
|
}
|
|
1634
1653
|
}
|
|
1635
|
-
class
|
|
1654
|
+
class gt {
|
|
1636
1655
|
constructor(e) {
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
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({
|
|
1652
1671
|
sourceDirection: e,
|
|
1653
1672
|
arrowLength: this.arrowLength,
|
|
1654
1673
|
side: this.cycleSquareSide,
|
|
@@ -1657,8 +1676,8 @@ class st {
|
|
|
1657
1676
|
hasSourceArrow: this.hasSourceArrow,
|
|
1658
1677
|
hasTargetArrow: this.hasTargetArrow
|
|
1659
1678
|
}));
|
|
1660
|
-
|
|
1661
|
-
to:
|
|
1679
|
+
o(this, "createDetourPath", (e, t, s, i, n) => new it({
|
|
1680
|
+
to: s,
|
|
1662
1681
|
sourceDirection: e,
|
|
1663
1682
|
targetDirection: t,
|
|
1664
1683
|
flipX: i,
|
|
@@ -1670,8 +1689,8 @@ class st {
|
|
|
1670
1689
|
hasSourceArrow: this.hasSourceArrow,
|
|
1671
1690
|
hasTargetArrow: this.hasTargetArrow
|
|
1672
1691
|
}));
|
|
1673
|
-
|
|
1674
|
-
to:
|
|
1692
|
+
o(this, "createLinePath", (e, t, s, i, n) => new tt({
|
|
1693
|
+
to: s,
|
|
1675
1694
|
sourceDirection: e,
|
|
1676
1695
|
targetDirection: t,
|
|
1677
1696
|
flipY: n,
|
|
@@ -1681,16 +1700,16 @@ class st {
|
|
|
1681
1700
|
hasSourceArrow: this.hasSourceArrow,
|
|
1682
1701
|
hasTargetArrow: this.hasTargetArrow
|
|
1683
1702
|
}));
|
|
1684
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ??
|
|
1685
|
-
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;
|
|
1686
1705
|
this.roundness = Math.min(
|
|
1687
1706
|
t,
|
|
1688
1707
|
this.arrowOffset,
|
|
1689
1708
|
this.cycleSquareSide / 2
|
|
1690
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ??
|
|
1691
|
-
color: (e == null ? void 0 : e.color) ??
|
|
1692
|
-
width: (e == null ? void 0 : e.width) ??
|
|
1693
|
-
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) ?? {}),
|
|
1694
1713
|
arrowLength: this.arrowLength,
|
|
1695
1714
|
hasSourceArrow: this.hasSourceArrow,
|
|
1696
1715
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1703,30 +1722,30 @@ class st {
|
|
|
1703
1722
|
this.pathShape.render(e);
|
|
1704
1723
|
}
|
|
1705
1724
|
}
|
|
1706
|
-
class
|
|
1725
|
+
class Ne {
|
|
1707
1726
|
constructor(e) {
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
[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] = S(), 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));
|
|
1722
1741
|
}
|
|
1723
1742
|
render(e) {
|
|
1724
|
-
const { x: t, y:
|
|
1743
|
+
const { x: t, y: s, width: i, height: n, flipX: a, flipY: h } = Se(
|
|
1725
1744
|
e.from,
|
|
1726
1745
|
e.to
|
|
1727
1746
|
);
|
|
1728
|
-
|
|
1729
|
-
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({
|
|
1730
1749
|
to: d,
|
|
1731
1750
|
sourceOffset: this.sourceOffset,
|
|
1732
1751
|
targetOffset: this.targetOffset,
|
|
@@ -1735,82 +1754,82 @@ class Pe {
|
|
|
1735
1754
|
arrowLength: this.arrowLength
|
|
1736
1755
|
});
|
|
1737
1756
|
this.line.setAttribute("d", c.path);
|
|
1738
|
-
let
|
|
1739
|
-
const
|
|
1740
|
-
if (
|
|
1741
|
-
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));
|
|
1742
1761
|
else {
|
|
1743
|
-
const
|
|
1744
|
-
x: d.x /
|
|
1745
|
-
y: d.y /
|
|
1762
|
+
const w = {
|
|
1763
|
+
x: d.x / u,
|
|
1764
|
+
y: d.y / u
|
|
1746
1765
|
};
|
|
1747
1766
|
if (this.sourceArrow) {
|
|
1748
|
-
const
|
|
1749
|
-
x:
|
|
1750
|
-
y:
|
|
1767
|
+
const m = {
|
|
1768
|
+
x: w.x * this.sourceOffset,
|
|
1769
|
+
y: w.y * this.sourceOffset
|
|
1751
1770
|
};
|
|
1752
|
-
|
|
1753
|
-
direction:
|
|
1754
|
-
shift:
|
|
1771
|
+
g = this.arrowRenderer({
|
|
1772
|
+
direction: w,
|
|
1773
|
+
shift: m,
|
|
1755
1774
|
arrowLength: this.arrowLength
|
|
1756
|
-
}), this.sourceArrow.setAttribute("d",
|
|
1775
|
+
}), this.sourceArrow.setAttribute("d", g);
|
|
1757
1776
|
}
|
|
1758
1777
|
if (this.targetArrow) {
|
|
1759
|
-
const
|
|
1760
|
-
x:
|
|
1761
|
-
y:
|
|
1778
|
+
const m = {
|
|
1779
|
+
x: w.x * this.targetOffset,
|
|
1780
|
+
y: w.y * this.targetOffset
|
|
1762
1781
|
};
|
|
1763
|
-
|
|
1764
|
-
direction: { x: -
|
|
1782
|
+
l = this.arrowRenderer({
|
|
1783
|
+
direction: { x: -w.x, y: -w.y },
|
|
1765
1784
|
shift: {
|
|
1766
|
-
x: d.x -
|
|
1767
|
-
y: d.y -
|
|
1785
|
+
x: d.x - m.x,
|
|
1786
|
+
y: d.y - m.y
|
|
1768
1787
|
},
|
|
1769
1788
|
arrowLength: this.arrowLength
|
|
1770
|
-
}), this.targetArrow.setAttribute("d",
|
|
1789
|
+
}), this.targetArrow.setAttribute("d", l);
|
|
1771
1790
|
}
|
|
1772
1791
|
}
|
|
1773
1792
|
this.afterRenderEmitter.emit({
|
|
1774
1793
|
edgePath: c,
|
|
1775
|
-
sourceArrowPath:
|
|
1776
|
-
targetArrowPath:
|
|
1794
|
+
sourceArrowPath: g,
|
|
1795
|
+
targetArrowPath: l
|
|
1777
1796
|
});
|
|
1778
1797
|
}
|
|
1779
1798
|
}
|
|
1780
|
-
const
|
|
1799
|
+
const ut = () => {
|
|
1781
1800
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1782
1801
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
1783
|
-
},
|
|
1802
|
+
}, pt = (r) => {
|
|
1784
1803
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1785
1804
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
1786
|
-
},
|
|
1805
|
+
}, ue = (r) => {
|
|
1787
1806
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1788
1807
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
1789
1808
|
};
|
|
1790
|
-
class
|
|
1809
|
+
class wt extends Error {
|
|
1791
1810
|
constructor(e) {
|
|
1792
1811
|
super(e), this.name = "InteractiveEdgeError";
|
|
1793
1812
|
}
|
|
1794
1813
|
}
|
|
1795
|
-
class
|
|
1814
|
+
class Me {
|
|
1796
1815
|
constructor(e, t) {
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
if (this.baseEdge = e, e instanceof
|
|
1808
|
-
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(
|
|
1809
1828
|
"interactive edge can be configured only once"
|
|
1810
1829
|
);
|
|
1811
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;
|
|
1812
|
-
const
|
|
1813
|
-
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) => {
|
|
1814
1833
|
this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
|
|
1815
1834
|
});
|
|
1816
1835
|
}
|
|
@@ -1818,16 +1837,16 @@ class be {
|
|
|
1818
1837
|
this.baseEdge.render(e);
|
|
1819
1838
|
}
|
|
1820
1839
|
}
|
|
1821
|
-
class
|
|
1840
|
+
class Jt {
|
|
1822
1841
|
constructor(e, t) {
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
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((
|
|
1830
|
-
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)`;
|
|
1831
1850
|
this.midpointElement.style.setProperty("transform", n);
|
|
1832
1851
|
});
|
|
1833
1852
|
}
|
|
@@ -1835,34 +1854,34 @@ class Lt {
|
|
|
1835
1854
|
this.baseShape.render(e);
|
|
1836
1855
|
}
|
|
1837
1856
|
}
|
|
1838
|
-
class
|
|
1857
|
+
class Le {
|
|
1839
1858
|
constructor(e) {
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
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");
|
|
1853
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;
|
|
1854
1873
|
}
|
|
1855
1874
|
getNode(e) {
|
|
1856
1875
|
const t = this.graphStore.getNode(e);
|
|
1857
1876
|
if (t === void 0)
|
|
1858
1877
|
return null;
|
|
1859
|
-
const
|
|
1878
|
+
const s = t.payload;
|
|
1860
1879
|
return {
|
|
1861
1880
|
element: t.element,
|
|
1862
|
-
x:
|
|
1863
|
-
y:
|
|
1864
|
-
centerFn:
|
|
1865
|
-
priority:
|
|
1881
|
+
x: s.x,
|
|
1882
|
+
y: s.y,
|
|
1883
|
+
centerFn: s.centerFn,
|
|
1884
|
+
priority: s.priority
|
|
1866
1885
|
};
|
|
1867
1886
|
}
|
|
1868
1887
|
getElementNodeId(e) {
|
|
@@ -1895,12 +1914,12 @@ class Te {
|
|
|
1895
1914
|
const t = this.graphStore.getEdge(e);
|
|
1896
1915
|
if (t === void 0)
|
|
1897
1916
|
return null;
|
|
1898
|
-
const
|
|
1917
|
+
const s = t.payload;
|
|
1899
1918
|
return {
|
|
1900
1919
|
from: t.from,
|
|
1901
1920
|
to: t.to,
|
|
1902
|
-
priority:
|
|
1903
|
-
shape:
|
|
1921
|
+
priority: s.priority,
|
|
1922
|
+
shape: s.shape
|
|
1904
1923
|
};
|
|
1905
1924
|
}
|
|
1906
1925
|
getPortIncomingEdgeIds(e) {
|
|
@@ -1928,9 +1947,9 @@ class Te {
|
|
|
1928
1947
|
return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
|
|
1929
1948
|
}
|
|
1930
1949
|
}
|
|
1931
|
-
class
|
|
1950
|
+
class Re {
|
|
1932
1951
|
constructor(e) {
|
|
1933
|
-
|
|
1952
|
+
o(this, "onAfterUpdated");
|
|
1934
1953
|
this.viewportStore = e, this.onAfterUpdated = this.viewportStore.onAfterUpdated;
|
|
1935
1954
|
}
|
|
1936
1955
|
getViewportMatrix() {
|
|
@@ -1940,22 +1959,22 @@ class De {
|
|
|
1940
1959
|
return { ...this.viewportStore.getContentMatrix() };
|
|
1941
1960
|
}
|
|
1942
1961
|
}
|
|
1943
|
-
const
|
|
1944
|
-
const t = new
|
|
1962
|
+
const Ce = (r, e) => {
|
|
1963
|
+
const t = new Ee(), s = new Le(t), i = new Re(e), n = new ye(t, e, r), a = {
|
|
1945
1964
|
nodes: {
|
|
1946
|
-
centerFn:
|
|
1965
|
+
centerFn: xe,
|
|
1947
1966
|
priorityFn: () => 0
|
|
1948
1967
|
},
|
|
1949
1968
|
edges: {
|
|
1950
|
-
shapeFactory: () => new
|
|
1969
|
+
shapeFactory: () => new Ne(),
|
|
1951
1970
|
priorityFn: () => 0
|
|
1952
1971
|
},
|
|
1953
1972
|
ports: {
|
|
1954
1973
|
direction: 0
|
|
1955
1974
|
}
|
|
1956
1975
|
};
|
|
1957
|
-
return new
|
|
1958
|
-
|
|
1976
|
+
return new ve(
|
|
1977
|
+
s,
|
|
1959
1978
|
i,
|
|
1960
1979
|
t,
|
|
1961
1980
|
e,
|
|
@@ -1963,21 +1982,21 @@ const Ne = (r, e) => {
|
|
|
1963
1982
|
a
|
|
1964
1983
|
);
|
|
1965
1984
|
};
|
|
1966
|
-
class
|
|
1967
|
-
constructor(e, t,
|
|
1968
|
-
|
|
1985
|
+
class z {
|
|
1986
|
+
constructor(e, t, s, i) {
|
|
1987
|
+
o(this, "onAfterPortMarked", (e) => {
|
|
1969
1988
|
const t = this.canvas.graph.getPort(e);
|
|
1970
1989
|
this.canvas.graph.getElementPortIds(t.element).length === 1 && this.hookPortEvents(t.element);
|
|
1971
1990
|
});
|
|
1972
|
-
|
|
1991
|
+
o(this, "onBeforePortUnmarked", (e) => {
|
|
1973
1992
|
const t = this.canvas.graph.getPort(e);
|
|
1974
1993
|
this.canvas.graph.getElementPortIds(t.element).length === 1 && this.unhookPortEvents(t.element);
|
|
1975
1994
|
});
|
|
1976
|
-
|
|
1995
|
+
o(this, "onPortMouseDown", (e) => {
|
|
1977
1996
|
if (!this.params.mouseDownEventVerifier(e))
|
|
1978
1997
|
return;
|
|
1979
|
-
const t = e.currentTarget,
|
|
1980
|
-
this.params.onPortPointerDown(
|
|
1998
|
+
const t = e.currentTarget, s = this.canvas.graph.getElementPortIds(t)[0];
|
|
1999
|
+
this.params.onPortPointerDown(s, {
|
|
1981
2000
|
x: e.clientX,
|
|
1982
2001
|
y: e.clientY
|
|
1983
2002
|
}) && (e.stopPropagation(), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
@@ -1986,8 +2005,8 @@ class k {
|
|
|
1986
2005
|
passive: !0
|
|
1987
2006
|
}));
|
|
1988
2007
|
});
|
|
1989
|
-
|
|
1990
|
-
if (!
|
|
2008
|
+
o(this, "onWindowMouseMove", (e) => {
|
|
2009
|
+
if (!V(
|
|
1991
2010
|
this.window,
|
|
1992
2011
|
this.element,
|
|
1993
2012
|
e.clientX,
|
|
@@ -1998,13 +2017,13 @@ class k {
|
|
|
1998
2017
|
}
|
|
1999
2018
|
this.params.onPointerMove({ x: e.clientX, y: e.clientY });
|
|
2000
2019
|
});
|
|
2001
|
-
|
|
2020
|
+
o(this, "onWindowMouseUp", (e) => {
|
|
2002
2021
|
this.params.mouseUpEventVerifier(e) && (this.params.onPointerUp({ x: e.clientX, y: e.clientY }), this.stopMouseDrag());
|
|
2003
2022
|
});
|
|
2004
|
-
|
|
2023
|
+
o(this, "onPortTouchStart", (e) => {
|
|
2005
2024
|
if (e.touches.length !== 1)
|
|
2006
2025
|
return;
|
|
2007
|
-
const t = e.touches[0],
|
|
2026
|
+
const t = e.touches[0], s = e.currentTarget, i = this.canvas.graph.getElementPortIds(s)[0];
|
|
2008
2027
|
this.params.onPortPointerDown(i, {
|
|
2009
2028
|
x: t.clientX,
|
|
2010
2029
|
y: t.clientY
|
|
@@ -2016,9 +2035,9 @@ class k {
|
|
|
2016
2035
|
passive: !0
|
|
2017
2036
|
}));
|
|
2018
2037
|
});
|
|
2019
|
-
|
|
2038
|
+
o(this, "onWindowTouchMove", (e) => {
|
|
2020
2039
|
const t = e.touches[0];
|
|
2021
|
-
if (!
|
|
2040
|
+
if (!V(
|
|
2022
2041
|
this.window,
|
|
2023
2042
|
this.element,
|
|
2024
2043
|
t.clientX,
|
|
@@ -2029,23 +2048,23 @@ class k {
|
|
|
2029
2048
|
}
|
|
2030
2049
|
this.params.onPointerMove({ x: t.clientX, y: t.clientY });
|
|
2031
2050
|
});
|
|
2032
|
-
|
|
2051
|
+
o(this, "onWindowTouchFinish", (e) => {
|
|
2033
2052
|
const t = e.changedTouches[0];
|
|
2034
2053
|
this.params.onPointerUp({ x: t.clientX, y: t.clientY }), this.stopTouchDrag();
|
|
2035
2054
|
});
|
|
2036
|
-
|
|
2055
|
+
o(this, "onBeforeClear", () => {
|
|
2037
2056
|
this.canvas.graph.getAllPortIds().forEach((e) => {
|
|
2038
2057
|
const t = this.canvas.graph.getPort(e);
|
|
2039
2058
|
this.unhookPortEvents(t.element);
|
|
2040
2059
|
});
|
|
2041
2060
|
});
|
|
2042
|
-
|
|
2061
|
+
o(this, "onBeforeDestroy", () => {
|
|
2043
2062
|
this.params.onStopDrag(), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
2044
2063
|
});
|
|
2045
|
-
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);
|
|
2046
2065
|
}
|
|
2047
|
-
static configure(e, t,
|
|
2048
|
-
new
|
|
2066
|
+
static configure(e, t, s, i) {
|
|
2067
|
+
new z(e, t, s, i);
|
|
2049
2068
|
}
|
|
2050
2069
|
hookPortEvents(e) {
|
|
2051
2070
|
e.addEventListener("mousedown", this.onPortMouseDown, {
|
|
@@ -2070,12 +2089,12 @@ class k {
|
|
|
2070
2089
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2071
2090
|
}
|
|
2072
2091
|
}
|
|
2073
|
-
class
|
|
2074
|
-
constructor(e, t,
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
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) => {
|
|
2079
2098
|
this.updateMaxNodePriority(e);
|
|
2080
2099
|
const t = this.graph.getNode(e);
|
|
2081
2100
|
t.element.addEventListener("mousedown", this.onMouseDown, {
|
|
@@ -2084,27 +2103,27 @@ class Z {
|
|
|
2084
2103
|
passive: !0
|
|
2085
2104
|
});
|
|
2086
2105
|
});
|
|
2087
|
-
|
|
2106
|
+
o(this, "onAfterNodeUpdated", (e) => {
|
|
2088
2107
|
this.updateMaxNodePriority(e);
|
|
2089
2108
|
});
|
|
2090
|
-
|
|
2109
|
+
o(this, "onBeforeNodeRemoved", (e) => {
|
|
2091
2110
|
const t = this.graph.getNode(e);
|
|
2092
2111
|
t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
|
|
2093
2112
|
});
|
|
2094
|
-
|
|
2113
|
+
o(this, "onBeforeDestroy", () => {
|
|
2095
2114
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2096
2115
|
});
|
|
2097
|
-
|
|
2116
|
+
o(this, "onBeforeClear", () => {
|
|
2098
2117
|
this.canvas.graph.getAllNodeIds().forEach((e) => {
|
|
2099
2118
|
const t = this.canvas.graph.getNode(e);
|
|
2100
2119
|
t.element.removeEventListener("mousedown", this.onMouseDown), t.element.removeEventListener("touchstart", this.onTouchStart);
|
|
2101
2120
|
}), this.maxNodePriority = 0;
|
|
2102
2121
|
});
|
|
2103
|
-
|
|
2122
|
+
o(this, "onMouseDown", (e) => {
|
|
2104
2123
|
if (!this.params.mouseDownEventVerifier(e))
|
|
2105
2124
|
return;
|
|
2106
|
-
const t = e.currentTarget,
|
|
2107
|
-
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))
|
|
2108
2127
|
return;
|
|
2109
2128
|
e.stopPropagation();
|
|
2110
2129
|
const a = this.calculateContentPoint({
|
|
@@ -2112,20 +2131,20 @@ class Z {
|
|
|
2112
2131
|
y: e.clientY
|
|
2113
2132
|
});
|
|
2114
2133
|
this.grabbedNode = {
|
|
2115
|
-
nodeId:
|
|
2134
|
+
nodeId: s,
|
|
2116
2135
|
dx: a.x - i.x,
|
|
2117
2136
|
dy: a.y - i.y
|
|
2118
|
-
},
|
|
2137
|
+
}, B(this.element, this.params.dragCursor), this.moveNodeOnTop(s), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2119
2138
|
passive: !0
|
|
2120
2139
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2121
2140
|
passive: !0
|
|
2122
2141
|
});
|
|
2123
2142
|
});
|
|
2124
|
-
|
|
2143
|
+
o(this, "onTouchStart", (e) => {
|
|
2125
2144
|
if (e.touches.length !== 1)
|
|
2126
2145
|
return;
|
|
2127
2146
|
e.stopPropagation();
|
|
2128
|
-
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);
|
|
2129
2148
|
if (!this.params.nodeDragVerifier({
|
|
2130
2149
|
nodeId: i,
|
|
2131
2150
|
element: n.element,
|
|
@@ -2149,8 +2168,8 @@ class Z {
|
|
|
2149
2168
|
passive: !0
|
|
2150
2169
|
});
|
|
2151
2170
|
});
|
|
2152
|
-
|
|
2153
|
-
if (!
|
|
2171
|
+
o(this, "onWindowMouseMove", (e) => {
|
|
2172
|
+
if (!V(
|
|
2154
2173
|
this.window,
|
|
2155
2174
|
this.element,
|
|
2156
2175
|
e.clientX,
|
|
@@ -2164,14 +2183,14 @@ class Z {
|
|
|
2164
2183
|
y: e.clientY
|
|
2165
2184
|
});
|
|
2166
2185
|
});
|
|
2167
|
-
|
|
2186
|
+
o(this, "onWindowMouseUp", (e) => {
|
|
2168
2187
|
this.params.mouseUpEventVerifier(e) && this.cancelMouseDrag();
|
|
2169
2188
|
});
|
|
2170
|
-
|
|
2189
|
+
o(this, "onWindowTouchMove", (e) => {
|
|
2171
2190
|
if (e.touches.length !== 1)
|
|
2172
2191
|
return;
|
|
2173
2192
|
const t = e.touches[0];
|
|
2174
|
-
if (!
|
|
2193
|
+
if (!V(
|
|
2175
2194
|
this.window,
|
|
2176
2195
|
this.element,
|
|
2177
2196
|
t.clientX,
|
|
@@ -2185,13 +2204,13 @@ class Z {
|
|
|
2185
2204
|
y: t.clientY
|
|
2186
2205
|
});
|
|
2187
2206
|
});
|
|
2188
|
-
|
|
2207
|
+
o(this, "onWindowTouchFinish", () => {
|
|
2189
2208
|
this.cancelTouchDrag();
|
|
2190
2209
|
});
|
|
2191
|
-
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);
|
|
2192
2211
|
}
|
|
2193
|
-
static configure(e, t,
|
|
2194
|
-
new
|
|
2212
|
+
static configure(e, t, s, i) {
|
|
2213
|
+
new Q(e, t, s, i);
|
|
2195
2214
|
}
|
|
2196
2215
|
moveNode(e, t) {
|
|
2197
2216
|
if (this.graph.getNode(e.nodeId) === null)
|
|
@@ -2217,7 +2236,7 @@ class Z {
|
|
|
2217
2236
|
}
|
|
2218
2237
|
}
|
|
2219
2238
|
cancelMouseDrag() {
|
|
2220
|
-
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();
|
|
2221
2240
|
}
|
|
2222
2241
|
removeMouseDragListeners() {
|
|
2223
2242
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
@@ -2242,40 +2261,40 @@ class Z {
|
|
|
2242
2261
|
this.maxNodePriority = Math.max(this.maxNodePriority, t);
|
|
2243
2262
|
}
|
|
2244
2263
|
calculateContentPoint(e) {
|
|
2245
|
-
const t = this.element.getBoundingClientRect(),
|
|
2264
|
+
const t = this.element.getBoundingClientRect(), s = {
|
|
2246
2265
|
x: e.x - t.x,
|
|
2247
2266
|
y: e.y - t.y
|
|
2248
2267
|
}, i = this.canvas.viewport.getViewportMatrix();
|
|
2249
|
-
return
|
|
2268
|
+
return D(i, s);
|
|
2250
2269
|
}
|
|
2251
2270
|
adjustNodeCoords(e) {
|
|
2252
2271
|
const t = this.params.gridSize;
|
|
2253
2272
|
if (t !== null) {
|
|
2254
|
-
const
|
|
2273
|
+
const s = t / 2;
|
|
2255
2274
|
return {
|
|
2256
|
-
x: Math.floor((e.x +
|
|
2257
|
-
y: Math.floor((e.y +
|
|
2275
|
+
x: Math.floor((e.x + s) / t) * t,
|
|
2276
|
+
y: Math.floor((e.y + s) / t) * t
|
|
2258
2277
|
};
|
|
2259
2278
|
}
|
|
2260
2279
|
return e;
|
|
2261
2280
|
}
|
|
2262
2281
|
}
|
|
2263
|
-
const
|
|
2282
|
+
const ft = (r, e, t) => ({
|
|
2264
2283
|
scale: r.scale,
|
|
2265
2284
|
x: r.x + r.scale * e,
|
|
2266
2285
|
y: r.y + r.scale * t
|
|
2267
|
-
}),
|
|
2286
|
+
}), mt = (r, e, t, s) => ({
|
|
2268
2287
|
scale: r.scale * e,
|
|
2269
2288
|
x: r.scale * (1 - e) * t + r.x,
|
|
2270
|
-
y: r.scale * (1 - e) *
|
|
2289
|
+
y: r.scale * (1 - e) * s + r.y
|
|
2271
2290
|
}), U = (r) => {
|
|
2272
2291
|
const e = [], t = r.touches.length;
|
|
2273
2292
|
for (let h = 0; h < t; h++)
|
|
2274
2293
|
e.push([r.touches[h].clientX, r.touches[h].clientY]);
|
|
2275
|
-
const
|
|
2294
|
+
const s = e.reduce(
|
|
2276
2295
|
(h, d) => [h[0] + d[0], h[1] + d[1]],
|
|
2277
2296
|
[0, 0]
|
|
2278
|
-
), i = [
|
|
2297
|
+
), i = [s[0] / t, s[1] / t], a = e.map((h) => [h[0] - i[0], h[1] - i[1]]).reduce(
|
|
2279
2298
|
(h, d) => h + Math.sqrt(d[0] * d[0] + d[1] * d[1]),
|
|
2280
2299
|
0
|
|
2281
2300
|
);
|
|
@@ -2287,24 +2306,24 @@ const ht = (r, e, t) => ({
|
|
|
2287
2306
|
touches: e
|
|
2288
2307
|
};
|
|
2289
2308
|
};
|
|
2290
|
-
class
|
|
2291
|
-
constructor(e, t,
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
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", () => {
|
|
2297
2316
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2298
2317
|
});
|
|
2299
|
-
|
|
2300
|
-
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, {
|
|
2301
2320
|
passive: !0
|
|
2302
2321
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2303
2322
|
passive: !0
|
|
2304
2323
|
}), this.startRegisteredTransform());
|
|
2305
2324
|
});
|
|
2306
|
-
|
|
2307
|
-
const t =
|
|
2325
|
+
o(this, "onWindowMouseMove", (e) => {
|
|
2326
|
+
const t = V(
|
|
2308
2327
|
this.window,
|
|
2309
2328
|
this.element,
|
|
2310
2329
|
e.clientX,
|
|
@@ -2314,21 +2333,21 @@ class z {
|
|
|
2314
2333
|
this.stopMouseDrag();
|
|
2315
2334
|
return;
|
|
2316
2335
|
}
|
|
2317
|
-
const
|
|
2318
|
-
this.moveViewport(
|
|
2336
|
+
const s = -e.movementX, i = -e.movementY;
|
|
2337
|
+
this.moveViewport(s, i);
|
|
2319
2338
|
});
|
|
2320
|
-
|
|
2339
|
+
o(this, "onWindowMouseUp", (e) => {
|
|
2321
2340
|
this.element === null || !this.params.mouseUpEventVerifier(e) || this.stopMouseDrag();
|
|
2322
2341
|
});
|
|
2323
|
-
|
|
2342
|
+
o(this, "onWheelScroll", (e) => {
|
|
2324
2343
|
if (!this.params.mouseWheelEventVerifier(e))
|
|
2325
2344
|
return;
|
|
2326
|
-
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);
|
|
2327
2346
|
this.wheelFinishTimer === null && this.params.onTransformStarted(), this.scaleViewport(h, i, n), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
|
|
2328
2347
|
this.transformInProgress || this.params.onTransformFinished(), this.wheelFinishTimer = null;
|
|
2329
2348
|
}, this.params.scaleWheelFinishTimeout);
|
|
2330
2349
|
});
|
|
2331
|
-
|
|
2350
|
+
o(this, "onTouchStart", (e) => {
|
|
2332
2351
|
if (this.prevTouches !== null) {
|
|
2333
2352
|
this.prevTouches = U(e);
|
|
2334
2353
|
return;
|
|
@@ -2341,10 +2360,10 @@ class z {
|
|
|
2341
2360
|
passive: !0
|
|
2342
2361
|
}), this.startRegisteredTransform();
|
|
2343
2362
|
});
|
|
2344
|
-
|
|
2363
|
+
o(this, "onWindowTouchMove", (e) => {
|
|
2345
2364
|
const t = U(e);
|
|
2346
2365
|
if (!t.touches.every(
|
|
2347
|
-
(i) =>
|
|
2366
|
+
(i) => V(this.window, this.element, i[0], i[1])
|
|
2348
2367
|
)) {
|
|
2349
2368
|
this.stopTouchDrag();
|
|
2350
2369
|
return;
|
|
@@ -2358,22 +2377,22 @@ class z {
|
|
|
2358
2377
|
}
|
|
2359
2378
|
this.prevTouches = t;
|
|
2360
2379
|
});
|
|
2361
|
-
|
|
2380
|
+
o(this, "onWindowTouchFinish", (e) => {
|
|
2362
2381
|
e.touches.length > 0 ? this.prevTouches = U(e) : this.stopTouchDrag();
|
|
2363
2382
|
});
|
|
2364
|
-
|
|
2365
|
-
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({
|
|
2366
2385
|
prevTransform: e,
|
|
2367
2386
|
nextTransform: e,
|
|
2368
2387
|
canvasWidth: t,
|
|
2369
|
-
canvasHeight:
|
|
2388
|
+
canvasHeight: s
|
|
2370
2389
|
});
|
|
2371
2390
|
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(i), this.params.onResizeTransformFinished();
|
|
2372
2391
|
}));
|
|
2373
|
-
|
|
2392
|
+
o(this, "preventWheelScaleListener", (e) => {
|
|
2374
2393
|
e.preventDefault();
|
|
2375
2394
|
});
|
|
2376
|
-
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, {
|
|
2377
2396
|
passive: !1
|
|
2378
2397
|
}), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown, {
|
|
2379
2398
|
passive: !0
|
|
@@ -2383,20 +2402,20 @@ class z {
|
|
|
2383
2402
|
passive: !0
|
|
2384
2403
|
}), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2385
2404
|
}
|
|
2386
|
-
static configure(e, t,
|
|
2387
|
-
new
|
|
2405
|
+
static configure(e, t, s, i) {
|
|
2406
|
+
new X(e, t, s, i);
|
|
2388
2407
|
}
|
|
2389
2408
|
moveViewport(e, t) {
|
|
2390
|
-
const
|
|
2391
|
-
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,
|
|
2392
2411
|
nextTransform: i,
|
|
2393
2412
|
canvasWidth: n,
|
|
2394
2413
|
canvasHeight: a
|
|
2395
2414
|
});
|
|
2396
2415
|
this.performTransform(h);
|
|
2397
2416
|
}
|
|
2398
|
-
scaleViewport(e, t,
|
|
2399
|
-
const i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2417
|
+
scaleViewport(e, t, s) {
|
|
2418
|
+
const i = this.canvas.viewport.getViewportMatrix(), n = mt(i, e, t, s), { width: a, height: h } = this.element.getBoundingClientRect(), d = this.params.transformPreprocessor({
|
|
2400
2419
|
prevTransform: i,
|
|
2401
2420
|
nextTransform: n,
|
|
2402
2421
|
canvasWidth: a,
|
|
@@ -2405,7 +2424,7 @@ class z {
|
|
|
2405
2424
|
this.performTransform(d);
|
|
2406
2425
|
}
|
|
2407
2426
|
stopMouseDrag() {
|
|
2408
|
-
|
|
2427
|
+
B(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
|
|
2409
2428
|
}
|
|
2410
2429
|
removeMouseDragListeners() {
|
|
2411
2430
|
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
@@ -2426,22 +2445,22 @@ class z {
|
|
|
2426
2445
|
this.transformInProgress = !1, this.params.onTransformFinished();
|
|
2427
2446
|
}
|
|
2428
2447
|
}
|
|
2429
|
-
class
|
|
2430
|
-
constructor(e, t,
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
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", {
|
|
2439
2458
|
xFrom: 1 / 0,
|
|
2440
2459
|
xTo: 1 / 0,
|
|
2441
2460
|
yFrom: 1 / 0,
|
|
2442
2461
|
yTo: 1 / 0
|
|
2443
2462
|
});
|
|
2444
|
-
|
|
2463
|
+
o(this, "updateLoadedArea", (e) => {
|
|
2445
2464
|
this.loadedArea = {
|
|
2446
2465
|
xFrom: e.x,
|
|
2447
2466
|
xTo: e.x + e.width,
|
|
@@ -2449,11 +2468,11 @@ class J {
|
|
|
2449
2468
|
yTo: e.y + e.height
|
|
2450
2469
|
};
|
|
2451
2470
|
});
|
|
2452
|
-
|
|
2471
|
+
o(this, "onAfterViewportUpdated", () => {
|
|
2453
2472
|
this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
|
|
2454
2473
|
});
|
|
2455
|
-
|
|
2456
|
-
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) => {
|
|
2457
2476
|
const c = d[0];
|
|
2458
2477
|
this.viewportWidth = c.contentRect.width, this.viewportHeight = c.contentRect.height, this.scheduleLoadAreaAroundViewport();
|
|
2459
2478
|
}), this.viewport = e.viewport;
|
|
@@ -2477,18 +2496,18 @@ class J {
|
|
|
2477
2496
|
this.scheduleLoadAreaAroundViewport(), i.onTransformFinished();
|
|
2478
2497
|
}
|
|
2479
2498
|
};
|
|
2480
|
-
|
|
2499
|
+
X.configure(
|
|
2481
2500
|
e,
|
|
2482
2501
|
this.element,
|
|
2483
2502
|
this.window,
|
|
2484
2503
|
h
|
|
2485
2504
|
), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
|
|
2486
2505
|
}
|
|
2487
|
-
static configure(e, t,
|
|
2488
|
-
new
|
|
2506
|
+
static configure(e, t, s, i, n, a) {
|
|
2507
|
+
new q(
|
|
2489
2508
|
e,
|
|
2490
2509
|
t,
|
|
2491
|
-
|
|
2510
|
+
s,
|
|
2492
2511
|
i,
|
|
2493
2512
|
n,
|
|
2494
2513
|
a
|
|
@@ -2500,75 +2519,75 @@ class J {
|
|
|
2500
2519
|
});
|
|
2501
2520
|
}
|
|
2502
2521
|
scheduleEnsureViewportAreaLoaded() {
|
|
2503
|
-
const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale,
|
|
2504
|
-
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();
|
|
2505
2524
|
}
|
|
2506
2525
|
loadAreaAroundViewport() {
|
|
2507
|
-
const e = this.viewportWidth * this.viewportMatrix.scale, t = this.viewportHeight * this.viewportMatrix.scale,
|
|
2508
|
-
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 });
|
|
2509
2528
|
}
|
|
2510
2529
|
}
|
|
2511
|
-
const
|
|
2530
|
+
const yt = () => {
|
|
2512
2531
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2513
2532
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2514
|
-
},
|
|
2533
|
+
}, vt = () => {
|
|
2515
2534
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2516
2535
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
2517
|
-
},
|
|
2536
|
+
}, Et = () => {
|
|
2518
2537
|
const r = document.createElementNS(
|
|
2519
2538
|
"http://www.w3.org/2000/svg",
|
|
2520
2539
|
"pattern"
|
|
2521
2540
|
);
|
|
2522
2541
|
return r.setAttribute("id", "pattern"), r;
|
|
2523
2542
|
};
|
|
2524
|
-
class
|
|
2525
|
-
constructor(e, t,
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
const t = e[0], { width:
|
|
2538
|
-
this.svg.setAttribute("width", `${
|
|
2539
|
-
const n = this.tileWidth /
|
|
2543
|
+
class _ {
|
|
2544
|
+
constructor(e, t, s) {
|
|
2545
|
+
o(this, "svg", yt());
|
|
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;
|
|
2540
2559
|
this.pattern.setAttribute("width", `${n}`), this.pattern.setAttribute("height", `${a}`);
|
|
2541
2560
|
}));
|
|
2542
|
-
|
|
2543
|
-
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})`;
|
|
2544
2563
|
this.pattern.setAttribute("patternTransform", i), this.updateVisibility();
|
|
2545
2564
|
});
|
|
2546
|
-
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;
|
|
2547
2566
|
const i = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
|
|
2548
2567
|
this.patternContent.setAttribute("transform", i), this.pattern.appendChild(this.patternContent);
|
|
2549
2568
|
const n = document.createElementNS("http://www.w3.org/2000/svg", "defs");
|
|
2550
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();
|
|
2551
2570
|
}
|
|
2552
|
-
static configure(e, t,
|
|
2553
|
-
new
|
|
2571
|
+
static configure(e, t, s) {
|
|
2572
|
+
new _(e, t, s);
|
|
2554
2573
|
}
|
|
2555
2574
|
updateVisibility() {
|
|
2556
2575
|
const t = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
|
|
2557
2576
|
t && this.visible ? (this.visible = !1, this.backgroundHost.removeChild(this.svg)) : !t && !this.visible && (this.visible = !0, this.backgroundHost.appendChild(this.svg));
|
|
2558
2577
|
}
|
|
2559
2578
|
}
|
|
2560
|
-
class
|
|
2561
|
-
constructor(e, t,
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
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) => {
|
|
2566
2585
|
this.params.onAfterEdgeCreated(e);
|
|
2567
2586
|
});
|
|
2568
|
-
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(
|
|
2569
2588
|
this.overlayLayer,
|
|
2570
2589
|
this.viewportStore
|
|
2571
|
-
),
|
|
2590
|
+
), z.configure(
|
|
2572
2591
|
this.canvas,
|
|
2573
2592
|
this.overlayLayer,
|
|
2574
2593
|
this.window,
|
|
@@ -2591,80 +2610,80 @@ class _ {
|
|
|
2591
2610
|
}
|
|
2592
2611
|
);
|
|
2593
2612
|
}
|
|
2594
|
-
static configure(e, t,
|
|
2595
|
-
new
|
|
2613
|
+
static configure(e, t, s, i, n) {
|
|
2614
|
+
new ee(
|
|
2596
2615
|
e,
|
|
2597
2616
|
t,
|
|
2598
|
-
|
|
2617
|
+
s,
|
|
2599
2618
|
i,
|
|
2600
2619
|
n
|
|
2601
2620
|
);
|
|
2602
2621
|
}
|
|
2603
|
-
grabPort(e, t,
|
|
2622
|
+
grabPort(e, t, s) {
|
|
2604
2623
|
const i = this.canvas.graph.getPort(e);
|
|
2605
2624
|
this.staticPortId = e;
|
|
2606
|
-
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, {
|
|
2607
2626
|
x: a - d.x,
|
|
2608
2627
|
y: h - d.y
|
|
2609
|
-
}),
|
|
2628
|
+
}), l = D(c, {
|
|
2610
2629
|
x: t.x - d.x,
|
|
2611
2630
|
y: t.y - d.y
|
|
2612
|
-
}),
|
|
2613
|
-
overlayId:
|
|
2614
|
-
portCoords: l,
|
|
2615
|
-
portDirection: i.direction
|
|
2616
|
-
}, f = {
|
|
2617
|
-
overlayId: P.Dragging,
|
|
2631
|
+
}), u = {
|
|
2632
|
+
overlayId: b.Static,
|
|
2618
2633
|
portCoords: g,
|
|
2634
|
+
portDirection: i.direction
|
|
2635
|
+
}, w = {
|
|
2636
|
+
overlayId: b.Dragging,
|
|
2637
|
+
portCoords: l,
|
|
2619
2638
|
portDirection: this.params.dragPortDirection
|
|
2620
2639
|
};
|
|
2621
|
-
this.isTargetDragging =
|
|
2622
|
-
const [
|
|
2623
|
-
this.overlayCanvas.addNode(
|
|
2624
|
-
from:
|
|
2640
|
+
this.isTargetDragging = s === "direct";
|
|
2641
|
+
const [m, v] = this.isTargetDragging ? [u, w] : [w, u];
|
|
2642
|
+
this.overlayCanvas.addNode(F(m)), this.overlayCanvas.addNode(F(v)), this.overlayCanvas.addEdge({
|
|
2643
|
+
from: m.overlayId,
|
|
2625
2644
|
to: v.overlayId,
|
|
2626
|
-
shape: this.params.edgeShapeFactory(
|
|
2645
|
+
shape: this.params.edgeShapeFactory(b.Edge)
|
|
2627
2646
|
});
|
|
2628
2647
|
}
|
|
2629
2648
|
resetDragState() {
|
|
2630
2649
|
this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
2631
2650
|
}
|
|
2632
2651
|
tryCreateConnection(e) {
|
|
2633
|
-
const t =
|
|
2652
|
+
const t = Ae(this.canvas.graph, e), s = this.staticPortId;
|
|
2634
2653
|
if (t === null) {
|
|
2635
2654
|
this.params.onEdgeCreationInterrupted({
|
|
2636
|
-
staticPortId:
|
|
2655
|
+
staticPortId: s,
|
|
2637
2656
|
isDirect: this.isTargetDragging
|
|
2638
2657
|
});
|
|
2639
2658
|
return;
|
|
2640
2659
|
}
|
|
2641
|
-
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);
|
|
2642
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);
|
|
2643
2662
|
}
|
|
2644
2663
|
moveDraggingPort(e) {
|
|
2645
|
-
const t = this.overlayLayer.getBoundingClientRect(),
|
|
2664
|
+
const t = this.overlayLayer.getBoundingClientRect(), s = {
|
|
2646
2665
|
x: e.x - t.x,
|
|
2647
2666
|
y: e.y - t.y
|
|
2648
|
-
}, i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2649
|
-
this.overlayCanvas.updateNode(
|
|
2667
|
+
}, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
|
|
2668
|
+
this.overlayCanvas.updateNode(b.Dragging, {
|
|
2650
2669
|
x: n.x,
|
|
2651
2670
|
y: n.y
|
|
2652
2671
|
});
|
|
2653
2672
|
}
|
|
2654
2673
|
}
|
|
2655
|
-
class
|
|
2656
|
-
constructor(e, t,
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
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) => {
|
|
2662
2681
|
this.params.onAfterEdgeReattached(e);
|
|
2663
2682
|
});
|
|
2664
|
-
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(
|
|
2665
2684
|
this.overlayLayer,
|
|
2666
2685
|
this.viewportStore
|
|
2667
|
-
),
|
|
2686
|
+
), z.configure(
|
|
2668
2687
|
this.canvas,
|
|
2669
2688
|
this.overlayLayer,
|
|
2670
2689
|
this.window,
|
|
@@ -2684,75 +2703,75 @@ class q {
|
|
|
2684
2703
|
}
|
|
2685
2704
|
);
|
|
2686
2705
|
}
|
|
2687
|
-
static configure(e, t,
|
|
2688
|
-
new
|
|
2706
|
+
static configure(e, t, s, i, n) {
|
|
2707
|
+
new te(
|
|
2689
2708
|
e,
|
|
2690
2709
|
t,
|
|
2691
|
-
|
|
2710
|
+
s,
|
|
2692
2711
|
i,
|
|
2693
2712
|
n
|
|
2694
2713
|
);
|
|
2695
2714
|
}
|
|
2696
2715
|
tryStartEdgeDragging(e, t) {
|
|
2697
|
-
const
|
|
2698
|
-
if (
|
|
2716
|
+
const s = this.params.draggingEdgeResolver(e);
|
|
2717
|
+
if (s === null)
|
|
2699
2718
|
return !1;
|
|
2700
|
-
const i = this.canvas.graph.getEdge(
|
|
2719
|
+
const i = this.canvas.graph.getEdge(s);
|
|
2701
2720
|
if (i === null)
|
|
2702
2721
|
return !1;
|
|
2703
2722
|
const n = e === i.from, a = e === i.to, h = n ? i.to : i.from;
|
|
2704
2723
|
this.staticPortId = h, this.isTargetDragging = a;
|
|
2705
|
-
const d = this.canvas.graph.getPort(e), c = this.canvas.graph.getPort(h),
|
|
2706
|
-
x:
|
|
2707
|
-
y:
|
|
2708
|
-
},
|
|
2709
|
-
x:
|
|
2710
|
-
y:
|
|
2711
|
-
}), v =
|
|
2712
|
-
x: t.x -
|
|
2713
|
-
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(), m = 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
|
|
2714
2733
|
});
|
|
2715
2734
|
this.draggingEdgePayload = {
|
|
2716
|
-
id:
|
|
2735
|
+
id: s,
|
|
2717
2736
|
from: i.from,
|
|
2718
2737
|
to: i.to,
|
|
2719
2738
|
shape: i.shape,
|
|
2720
2739
|
priority: i.priority
|
|
2721
|
-
}, this.canvas.removeEdge(
|
|
2722
|
-
const
|
|
2723
|
-
overlayId:
|
|
2724
|
-
portCoords:
|
|
2740
|
+
}, this.canvas.removeEdge(s);
|
|
2741
|
+
const E = {
|
|
2742
|
+
overlayId: b.Static,
|
|
2743
|
+
portCoords: m,
|
|
2725
2744
|
portDirection: c.direction
|
|
2726
2745
|
}, A = {
|
|
2727
|
-
overlayId:
|
|
2746
|
+
overlayId: b.Dragging,
|
|
2728
2747
|
portCoords: v,
|
|
2729
2748
|
portDirection: d.direction
|
|
2730
|
-
}, [R,
|
|
2731
|
-
this.overlayCanvas.addNode(
|
|
2732
|
-
const
|
|
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;
|
|
2733
2752
|
return this.overlayCanvas.addEdge({
|
|
2734
|
-
id:
|
|
2753
|
+
id: b.Edge,
|
|
2735
2754
|
from: R.overlayId,
|
|
2736
|
-
to:
|
|
2737
|
-
shape:
|
|
2755
|
+
to: T.overlayId,
|
|
2756
|
+
shape: N
|
|
2738
2757
|
}), !0;
|
|
2739
2758
|
}
|
|
2740
2759
|
resetDragState() {
|
|
2741
2760
|
this.draggingEdgePayload = null, this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
2742
2761
|
}
|
|
2743
2762
|
moveDraggingPort(e) {
|
|
2744
|
-
const t = this.overlayLayer.getBoundingClientRect(),
|
|
2763
|
+
const t = this.overlayLayer.getBoundingClientRect(), s = {
|
|
2745
2764
|
x: e.x - t.x,
|
|
2746
2765
|
y: e.y - t.y
|
|
2747
|
-
}, i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2748
|
-
this.overlayCanvas.updateNode(
|
|
2766
|
+
}, i = this.canvas.viewport.getViewportMatrix(), n = D(i, s);
|
|
2767
|
+
this.overlayCanvas.updateNode(b.Dragging, {
|
|
2749
2768
|
x: n.x,
|
|
2750
2769
|
y: n.y
|
|
2751
2770
|
});
|
|
2752
2771
|
}
|
|
2753
2772
|
tryCreateConnection(e) {
|
|
2754
|
-
const t =
|
|
2755
|
-
if (this.overlayCanvas.removeEdge(
|
|
2773
|
+
const t = Ae(this.canvas.graph, e);
|
|
2774
|
+
if (this.overlayCanvas.removeEdge(b.Edge), t === null) {
|
|
2756
2775
|
const d = this.draggingEdgePayload;
|
|
2757
2776
|
this.params.onEdgeReattachInterrupted({
|
|
2758
2777
|
id: d.id,
|
|
@@ -2763,9 +2782,9 @@ class q {
|
|
|
2763
2782
|
});
|
|
2764
2783
|
return;
|
|
2765
2784
|
}
|
|
2766
|
-
const [
|
|
2785
|
+
const [s, i] = this.isTargetDragging ? [this.staticPortId, t] : [t, this.staticPortId], n = this.draggingEdgePayload, a = {
|
|
2767
2786
|
id: n.id,
|
|
2768
|
-
from:
|
|
2787
|
+
from: s,
|
|
2769
2788
|
to: i,
|
|
2770
2789
|
shape: n.shape,
|
|
2771
2790
|
priority: n.priority
|
|
@@ -2784,45 +2803,147 @@ class q {
|
|
|
2784
2803
|
}
|
|
2785
2804
|
}
|
|
2786
2805
|
}
|
|
2787
|
-
|
|
2806
|
+
class re {
|
|
2807
|
+
constructor(e, t, s) {
|
|
2808
|
+
this.canvas = e, this.layoutAlgorithm = t, this.trigger = s, this.trigger.subscribe(() => {
|
|
2809
|
+
this.applyLayout();
|
|
2810
|
+
});
|
|
2811
|
+
}
|
|
2812
|
+
static configure(e, t, s) {
|
|
2813
|
+
new re(
|
|
2814
|
+
e,
|
|
2815
|
+
t,
|
|
2816
|
+
s
|
|
2817
|
+
);
|
|
2818
|
+
}
|
|
2819
|
+
applyLayout() {
|
|
2820
|
+
this.layoutAlgorithm.calculateCoordinates(this.canvas.graph).forEach((t, s) => {
|
|
2821
|
+
this.canvas.updateNode(s, t);
|
|
2822
|
+
});
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
class se {
|
|
2826
|
+
constructor(e, t) {
|
|
2827
|
+
o(this, "applyScheduled", !1);
|
|
2828
|
+
this.canvas = e, this.layoutAlgorithm = t, this.canvas.graph.onAfterNodeAdded.subscribe(() => {
|
|
2829
|
+
this.scheduleApply();
|
|
2830
|
+
}), this.canvas.graph.onBeforeNodeRemoved.subscribe(() => {
|
|
2831
|
+
this.scheduleApply();
|
|
2832
|
+
}), this.canvas.graph.onAfterEdgeAdded.subscribe(() => {
|
|
2833
|
+
this.scheduleApply();
|
|
2834
|
+
}), this.canvas.graph.onBeforeEdgeRemoved.subscribe(() => {
|
|
2835
|
+
this.scheduleApply();
|
|
2836
|
+
});
|
|
2837
|
+
}
|
|
2838
|
+
static configure(e, t) {
|
|
2839
|
+
new se(
|
|
2840
|
+
e,
|
|
2841
|
+
t
|
|
2842
|
+
);
|
|
2843
|
+
}
|
|
2844
|
+
scheduleApply() {
|
|
2845
|
+
this.applyScheduled || (this.applyScheduled = !0, setTimeout(() => {
|
|
2846
|
+
this.applyScheduled = !1, this.applyLayout();
|
|
2847
|
+
}));
|
|
2848
|
+
}
|
|
2849
|
+
applyLayout() {
|
|
2850
|
+
this.layoutAlgorithm.calculateCoordinates(this.canvas.graph).forEach((t, s) => {
|
|
2851
|
+
this.canvas.updateNode(s, t);
|
|
2852
|
+
});
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
class At {
|
|
2856
|
+
static configure(e, t) {
|
|
2857
|
+
const s = t.applyOn;
|
|
2858
|
+
switch (s.type) {
|
|
2859
|
+
case "manual": {
|
|
2860
|
+
re.configure(
|
|
2861
|
+
e,
|
|
2862
|
+
t.algorithm,
|
|
2863
|
+
s.trigger
|
|
2864
|
+
);
|
|
2865
|
+
break;
|
|
2866
|
+
}
|
|
2867
|
+
case "topologyChangeTimeout": {
|
|
2868
|
+
se.configure(
|
|
2869
|
+
e,
|
|
2870
|
+
t.algorithm
|
|
2871
|
+
);
|
|
2872
|
+
break;
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
}
|
|
2877
|
+
class xt {
|
|
2878
|
+
constructor(e, t) {
|
|
2879
|
+
o(this, "previousTimeStamp");
|
|
2880
|
+
o(this, "step", (e) => {
|
|
2881
|
+
if (this.previousTimeStamp === void 0)
|
|
2882
|
+
this.previousTimeStamp = e;
|
|
2883
|
+
else {
|
|
2884
|
+
const t = (e - this.previousTimeStamp) / 1e3;
|
|
2885
|
+
this.previousTimeStamp = e, this.callback(t);
|
|
2886
|
+
}
|
|
2887
|
+
this.win.requestAnimationFrame(this.step);
|
|
2888
|
+
});
|
|
2889
|
+
this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
class oe {
|
|
2893
|
+
constructor(e, t, s, i) {
|
|
2894
|
+
o(this, "step", (e) => {
|
|
2895
|
+
this.algorithm.calculateNextCoordinates(
|
|
2896
|
+
this.canvas.graph,
|
|
2897
|
+
e
|
|
2898
|
+
).forEach((s, i) => {
|
|
2899
|
+
this.staticNodes.has(i) || this.canvas.updateNode(i, { x: s.x, y: s.y });
|
|
2900
|
+
});
|
|
2901
|
+
});
|
|
2902
|
+
this.canvas = e, this.algorithm = t, this.staticNodes = s, this.win = i, new xt(this.win, this.step);
|
|
2903
|
+
}
|
|
2904
|
+
static configure(e, t, s, i) {
|
|
2905
|
+
new oe(e, t, s, i);
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
const St = () => {
|
|
2788
2909
|
const r = document.createElement("div");
|
|
2789
2910
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
2790
|
-
},
|
|
2911
|
+
}, H = () => {
|
|
2791
2912
|
const r = document.createElement("div");
|
|
2792
2913
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2793
|
-
},
|
|
2794
|
-
const r =
|
|
2914
|
+
}, pe = () => {
|
|
2915
|
+
const r = H();
|
|
2795
2916
|
return r.style.pointerEvents = "none", r;
|
|
2796
2917
|
};
|
|
2797
|
-
class
|
|
2918
|
+
class Pt {
|
|
2798
2919
|
constructor(e) {
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
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());
|
|
2804
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);
|
|
2805
2926
|
}
|
|
2806
2927
|
destroy() {
|
|
2807
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);
|
|
2808
2929
|
}
|
|
2809
2930
|
}
|
|
2810
|
-
const
|
|
2931
|
+
const j = (r) => () => r, we = j(0), bt = () => {
|
|
2811
2932
|
let r = 0;
|
|
2812
2933
|
return () => r++;
|
|
2813
|
-
},
|
|
2814
|
-
let t =
|
|
2815
|
-
const i =
|
|
2816
|
-
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), {
|
|
2817
2938
|
nodesPriorityFn: t,
|
|
2818
|
-
edgesPriorityFn:
|
|
2939
|
+
edgesPriorityFn: s
|
|
2819
2940
|
};
|
|
2820
|
-
},
|
|
2941
|
+
}, ie = (r) => {
|
|
2821
2942
|
if (typeof r == "function")
|
|
2822
2943
|
return r;
|
|
2823
2944
|
switch (r.type) {
|
|
2824
2945
|
case "straight":
|
|
2825
|
-
return () => new
|
|
2946
|
+
return () => new lt({
|
|
2826
2947
|
color: r.color,
|
|
2827
2948
|
width: r.width,
|
|
2828
2949
|
arrowLength: r.arrowLength,
|
|
@@ -2836,7 +2957,7 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
2836
2957
|
detourDirection: r.detourDirection
|
|
2837
2958
|
});
|
|
2838
2959
|
case "horizontal":
|
|
2839
|
-
return () => new
|
|
2960
|
+
return () => new ct({
|
|
2840
2961
|
color: r.color,
|
|
2841
2962
|
width: r.width,
|
|
2842
2963
|
arrowLength: r.arrowLength,
|
|
@@ -2849,7 +2970,7 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
2849
2970
|
detourDistance: r.detourDistance
|
|
2850
2971
|
});
|
|
2851
2972
|
case "vertical":
|
|
2852
|
-
return () => new
|
|
2973
|
+
return () => new gt({
|
|
2853
2974
|
color: r.color,
|
|
2854
2975
|
width: r.width,
|
|
2855
2976
|
arrowLength: r.arrowLength,
|
|
@@ -2862,7 +2983,7 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
2862
2983
|
detourDistance: r.detourDistance
|
|
2863
2984
|
});
|
|
2864
2985
|
case "direct":
|
|
2865
|
-
return () => new
|
|
2986
|
+
return () => new Ne({
|
|
2866
2987
|
color: r.color,
|
|
2867
2988
|
width: r.width,
|
|
2868
2989
|
arrowLength: r.arrowLength,
|
|
@@ -2873,7 +2994,7 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
2873
2994
|
targetOffset: r.targetOffset
|
|
2874
2995
|
});
|
|
2875
2996
|
default:
|
|
2876
|
-
return () => new
|
|
2997
|
+
return () => new dt({
|
|
2877
2998
|
color: r.color,
|
|
2878
2999
|
width: r.width,
|
|
2879
3000
|
arrowLength: r.arrowLength,
|
|
@@ -2887,185 +3008,185 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
2887
3008
|
detourDirection: r.detourDirection
|
|
2888
3009
|
});
|
|
2889
3010
|
}
|
|
2890
|
-
},
|
|
2891
|
-
var t,
|
|
2892
|
-
const e =
|
|
3011
|
+
}, Dt = (r) => {
|
|
3012
|
+
var t, s, i, n, a;
|
|
3013
|
+
const e = Tt(
|
|
2893
3014
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
2894
|
-
(
|
|
3015
|
+
(s = r.edges) == null ? void 0 : s.priority
|
|
2895
3016
|
);
|
|
2896
3017
|
return {
|
|
2897
3018
|
nodes: {
|
|
2898
|
-
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ??
|
|
3019
|
+
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? xe,
|
|
2899
3020
|
priorityFn: e.nodesPriorityFn
|
|
2900
3021
|
},
|
|
2901
3022
|
ports: {
|
|
2902
3023
|
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
2903
3024
|
},
|
|
2904
3025
|
edges: {
|
|
2905
|
-
shapeFactory:
|
|
3026
|
+
shapeFactory: ie(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
|
|
2906
3027
|
priorityFn: e.edgesPriorityFn
|
|
2907
3028
|
}
|
|
2908
3029
|
};
|
|
2909
|
-
},
|
|
2910
|
-
var
|
|
2911
|
-
const e = ((
|
|
2912
|
-
}), t = r.nodeDragVerifier ?? (() => !0),
|
|
2913
|
-
}), i = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && i, a = (
|
|
3030
|
+
}, Nt = (r) => {
|
|
3031
|
+
var u, w, m, 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 = (m = r.mouse) == null ? void 0 : m.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;
|
|
2914
3035
|
return {
|
|
2915
3036
|
moveOnTop: i,
|
|
2916
3037
|
moveEdgesOnTop: n,
|
|
2917
3038
|
dragCursor: h,
|
|
2918
3039
|
gridSize: r.gridSize ?? null,
|
|
2919
3040
|
mouseDownEventVerifier: c,
|
|
2920
|
-
mouseUpEventVerifier:
|
|
3041
|
+
mouseUpEventVerifier: l,
|
|
2921
3042
|
onNodeDrag: e,
|
|
2922
3043
|
nodeDragVerifier: t,
|
|
2923
|
-
onNodeDragFinished:
|
|
3044
|
+
onNodeDragFinished: s
|
|
2924
3045
|
};
|
|
2925
|
-
},
|
|
2926
|
-
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;
|
|
2927
3048
|
return (n) => {
|
|
2928
3049
|
let a = n.nextTransform.x, h = n.nextTransform.y;
|
|
2929
3050
|
a < e && a < n.prevTransform.x && (a = Math.min(n.prevTransform.x, e));
|
|
2930
3051
|
const d = n.canvasWidth * n.prevTransform.scale, c = t - d;
|
|
2931
|
-
a > c && a > n.prevTransform.x && (a = Math.max(n.prevTransform.x, c)), h <
|
|
2932
|
-
const
|
|
2933
|
-
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 };
|
|
2934
3055
|
};
|
|
2935
|
-
},
|
|
2936
|
-
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;
|
|
2937
3058
|
return (n) => {
|
|
2938
3059
|
const a = n.prevTransform, h = n.nextTransform;
|
|
2939
|
-
let d = h.scale, c = h.x,
|
|
3060
|
+
let d = h.scale, c = h.x, g = h.y;
|
|
2940
3061
|
if (h.scale > i && h.scale > a.scale) {
|
|
2941
|
-
d = Math.max(a.scale, i), c = a.x,
|
|
2942
|
-
const
|
|
2943
|
-
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;
|
|
2944
3065
|
}
|
|
2945
|
-
if (h.scale <
|
|
2946
|
-
d = Math.min(a.scale,
|
|
2947
|
-
const
|
|
2948
|
-
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;
|
|
2949
3070
|
}
|
|
2950
3071
|
return {
|
|
2951
3072
|
scale: d,
|
|
2952
3073
|
x: c,
|
|
2953
|
-
y:
|
|
3074
|
+
y: g
|
|
2954
3075
|
};
|
|
2955
3076
|
};
|
|
2956
|
-
},
|
|
2957
|
-
(t,
|
|
3077
|
+
}, Rt = (r) => (e) => r.reduce(
|
|
3078
|
+
(t, s) => s({
|
|
2958
3079
|
prevTransform: e.prevTransform,
|
|
2959
3080
|
nextTransform: t,
|
|
2960
3081
|
canvasWidth: e.canvasWidth,
|
|
2961
3082
|
canvasHeight: e.canvasHeight
|
|
2962
3083
|
}),
|
|
2963
3084
|
e.nextTransform
|
|
2964
|
-
),
|
|
3085
|
+
), fe = (r) => {
|
|
2965
3086
|
if (typeof r == "function")
|
|
2966
3087
|
return r;
|
|
2967
3088
|
switch (r.type) {
|
|
2968
3089
|
case "scale-limit":
|
|
2969
|
-
return
|
|
3090
|
+
return Lt({
|
|
2970
3091
|
minContentScale: r.minContentScale ?? 0,
|
|
2971
3092
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
2972
3093
|
});
|
|
2973
3094
|
case "shift-limit":
|
|
2974
|
-
return
|
|
3095
|
+
return Mt({
|
|
2975
3096
|
minX: r.minX ?? -1 / 0,
|
|
2976
3097
|
maxX: r.maxX ?? 1 / 0,
|
|
2977
3098
|
minY: r.minY ?? -1 / 0,
|
|
2978
3099
|
maxY: r.maxY ?? 1 / 0
|
|
2979
3100
|
});
|
|
2980
3101
|
}
|
|
2981
|
-
},
|
|
2982
|
-
var
|
|
2983
|
-
const e = (
|
|
3102
|
+
}, me = (r) => {
|
|
3103
|
+
var m, v, E, A, R, T, N, $, ne, ae, he, de;
|
|
3104
|
+
const e = (m = r == null ? void 0 : r.scale) == null ? void 0 : m.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
|
|
2984
3105
|
let i;
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
(
|
|
3106
|
+
s !== void 0 ? Array.isArray(s) ? i = Rt(
|
|
3107
|
+
s.map(
|
|
3108
|
+
(M) => fe(M)
|
|
2988
3109
|
)
|
|
2989
|
-
) : i =
|
|
2990
|
-
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) ?? (() => {
|
|
2991
3112
|
}), h = ((A = r == null ? void 0 : r.events) == null ? void 0 : A.onTransformChange) ?? (() => {
|
|
2992
|
-
}), d = (R = r == null ? void 0 : r.shift) == null ? void 0 : R.mouseDownEventVerifier, c = d !== void 0 ? 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;
|
|
2993
3114
|
return {
|
|
2994
3115
|
wheelSensitivity: t,
|
|
2995
|
-
onTransformStarted: ((
|
|
3116
|
+
onTransformStarted: (($ = r == null ? void 0 : r.events) == null ? void 0 : $.onTransformStarted) ?? (() => {
|
|
2996
3117
|
}),
|
|
2997
|
-
onTransformFinished: ((
|
|
3118
|
+
onTransformFinished: ((ne = r == null ? void 0 : r.events) == null ? void 0 : ne.onTransformFinished) ?? (() => {
|
|
2998
3119
|
}),
|
|
2999
3120
|
onBeforeTransformChange: a,
|
|
3000
3121
|
onTransformChange: h,
|
|
3001
3122
|
transformPreprocessor: i,
|
|
3002
3123
|
shiftCursor: n,
|
|
3003
3124
|
mouseDownEventVerifier: c,
|
|
3004
|
-
mouseUpEventVerifier:
|
|
3005
|
-
mouseWheelEventVerifier:
|
|
3006
|
-
scaleWheelFinishTimeout: ((
|
|
3007
|
-
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) ?? (() => {
|
|
3008
3129
|
}),
|
|
3009
|
-
onResizeTransformFinished: ((
|
|
3130
|
+
onResizeTransformFinished: ((de = r == null ? void 0 : r.events) == null ? void 0 : de.onResizeTransformFinished) ?? (() => {
|
|
3010
3131
|
})
|
|
3011
3132
|
};
|
|
3012
|
-
},
|
|
3133
|
+
}, Ct = (r, e) => {
|
|
3013
3134
|
const t = document.createElementNS(
|
|
3014
3135
|
"http://www.w3.org/2000/svg",
|
|
3015
3136
|
"circle"
|
|
3016
3137
|
);
|
|
3017
3138
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
3018
|
-
},
|
|
3139
|
+
}, Vt = (r) => r instanceof SVGElement ? r : Ct(
|
|
3019
3140
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
3020
3141
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
3021
|
-
),
|
|
3022
|
-
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 ?? {});
|
|
3023
3144
|
return {
|
|
3024
3145
|
tileWidth: t,
|
|
3025
|
-
tileHeight:
|
|
3146
|
+
tileHeight: s,
|
|
3026
3147
|
renderer: i,
|
|
3027
3148
|
maxViewportScale: r.maxViewportScale ?? 10
|
|
3028
3149
|
};
|
|
3029
|
-
},
|
|
3030
|
-
var c,
|
|
3031
|
-
const
|
|
3150
|
+
}, It = (r, e, t) => {
|
|
3151
|
+
var c, g, l;
|
|
3152
|
+
const s = () => "direct", i = (u) => u, n = (u) => u.button === 0, a = () => {
|
|
3032
3153
|
}, h = () => {
|
|
3033
3154
|
}, d = () => {
|
|
3034
3155
|
};
|
|
3035
3156
|
return {
|
|
3036
|
-
connectionTypeResolver: r.connectionTypeResolver ??
|
|
3157
|
+
connectionTypeResolver: r.connectionTypeResolver ?? s,
|
|
3037
3158
|
connectionPreprocessor: r.connectionPreprocessor ?? i,
|
|
3038
3159
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? n,
|
|
3039
3160
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? n,
|
|
3040
3161
|
onAfterEdgeCreated: ((c = r.events) == null ? void 0 : c.onAfterEdgeCreated) ?? a,
|
|
3041
|
-
onEdgeCreationInterrupted: ((
|
|
3042
|
-
onEdgeCreationPrevented: ((
|
|
3162
|
+
onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
|
|
3163
|
+
onEdgeCreationPrevented: ((l = r.events) == null ? void 0 : l.onEdgeCreationPrevented) ?? h,
|
|
3043
3164
|
dragPortDirection: r.dragPortDirection ?? t,
|
|
3044
|
-
edgeShapeFactory: r.edgeShape !== void 0 ?
|
|
3165
|
+
edgeShapeFactory: r.edgeShape !== void 0 ? ie(r.edgeShape) : e
|
|
3045
3166
|
};
|
|
3046
|
-
},
|
|
3047
|
-
var c,
|
|
3048
|
-
const t = (
|
|
3049
|
-
const
|
|
3050
|
-
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;
|
|
3051
3172
|
}, a = () => {
|
|
3052
3173
|
}, h = () => {
|
|
3053
3174
|
}, d = () => {
|
|
3054
3175
|
};
|
|
3055
3176
|
return {
|
|
3056
3177
|
connectionPreprocessor: r.connectionPreprocessor ?? t,
|
|
3057
|
-
mouseDownEventVerifier: r.mouseDownEventVerifier ??
|
|
3178
|
+
mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
|
|
3058
3179
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? i,
|
|
3059
3180
|
draggingEdgeResolver: r.draggingEdgeResolver ?? n,
|
|
3060
|
-
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ?
|
|
3181
|
+
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ie(r.draggingEdgeShape) : null,
|
|
3061
3182
|
onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
|
|
3062
|
-
onEdgeReattachInterrupted: ((
|
|
3063
|
-
onEdgeReattachPrevented: ((
|
|
3183
|
+
onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
|
|
3184
|
+
onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
|
|
3064
3185
|
};
|
|
3065
|
-
},
|
|
3186
|
+
}, Bt = (r) => ({
|
|
3066
3187
|
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
3067
3188
|
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
3068
|
-
}),
|
|
3189
|
+
}), Ft = (r) => {
|
|
3069
3190
|
var e, t;
|
|
3070
3191
|
return {
|
|
3071
3192
|
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
|
|
@@ -3074,34 +3195,232 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
3074
3195
|
})
|
|
3075
3196
|
};
|
|
3076
3197
|
};
|
|
3077
|
-
class
|
|
3198
|
+
class Ot extends Error {
|
|
3078
3199
|
constructor() {
|
|
3079
3200
|
super(...arguments);
|
|
3080
|
-
|
|
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, m = u / 2, v = w / 2, E = t.get(h), A = t.get(c);
|
|
3245
|
+
E.x -= m, E.y -= v, A.x += m, 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, m = g.ey * u, v = t.get(d.nodeId), E = t.get(c.nodeId);
|
|
3250
|
+
v.x += w, v.y += m, E.x -= w, E.y -= m;
|
|
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;
|
|
3081
3291
|
}
|
|
3082
3292
|
}
|
|
3083
|
-
class
|
|
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;
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
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
|
+
}, x = 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) ?? x.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) ?? x.maxTimeDeltaSec,
|
|
3347
|
+
nodeCharge: (t == null ? void 0 : t.nodeCharge) ?? x.nodeCharge,
|
|
3348
|
+
nodeMass: (t == null ? void 0 : t.nodeMass) ?? x.nodeMass,
|
|
3349
|
+
edgeEquilibriumLength: (t == null ? void 0 : t.edgeEquilibriumLength) ?? x.edgeEquilibriumLength,
|
|
3350
|
+
effectiveDistance: x.effectiveDistance,
|
|
3351
|
+
edgeStiffness: (t == null ? void 0 : t.edgeStiffness) ?? x.edgeStiffness,
|
|
3352
|
+
convergenceDelta: (t == null ? void 0 : t.convergenceDelta) ?? x.convergenceDelta
|
|
3353
|
+
});
|
|
3354
|
+
}
|
|
3355
|
+
}
|
|
3356
|
+
}, Yt = (r) => r instanceof G ? {
|
|
3357
|
+
type: "manual",
|
|
3358
|
+
trigger: r
|
|
3359
|
+
} : {
|
|
3360
|
+
type: "topologyChangeTimeout"
|
|
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) ?? x.seed), t = Ue(e[0], e[1], e[2], e[3]);
|
|
3367
|
+
return new kt({
|
|
3368
|
+
dtSec: (r == null ? void 0 : r.dtSec) ?? x.dtSec,
|
|
3369
|
+
maxIterations: (r == null ? void 0 : r.maxIterations) ?? x.maxIterations,
|
|
3370
|
+
rand: t,
|
|
3371
|
+
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? x.maxTimeDeltaSec,
|
|
3372
|
+
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? x.nodeCharge,
|
|
3373
|
+
nodeMass: (r == null ? void 0 : r.nodeMass) ?? x.nodeMass,
|
|
3374
|
+
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? x.edgeEquilibriumLength,
|
|
3375
|
+
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? x.edgeStiffness,
|
|
3376
|
+
effectiveDistance: (r == null ? void 0 : r.effectiveDistance) ?? x.effectiveDistance,
|
|
3377
|
+
convergenceDelta: (r == null ? void 0 : r.convergenceDelta) ?? x.convergenceDelta
|
|
3378
|
+
});
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
}, jt = (r) => ({
|
|
3382
|
+
algorithm: Ht(r == null ? void 0 : r.algorithm),
|
|
3383
|
+
applyOn: Yt(r == null ? void 0 : r.applyOn)
|
|
3384
|
+
}), Gt = (r, e) => ({
|
|
3385
|
+
...r,
|
|
3386
|
+
nodeDragVerifier: (t) => (e.add(t), r.nodeDragVerifier(t)),
|
|
3387
|
+
onNodeDragFinished: (t) => {
|
|
3388
|
+
e.delete(t), r.onNodeDragFinished(t);
|
|
3389
|
+
}
|
|
3390
|
+
}), Kt = (r, e) => {
|
|
3391
|
+
r.onBeforeNodeRemoved.subscribe((t) => {
|
|
3392
|
+
e.delete(t);
|
|
3393
|
+
}), r.onBeforeClear.subscribe(() => {
|
|
3394
|
+
e.clear();
|
|
3395
|
+
});
|
|
3396
|
+
};
|
|
3397
|
+
class Qt {
|
|
3084
3398
|
constructor(e) {
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3399
|
+
o(this, "used", !1);
|
|
3400
|
+
o(this, "canvasDefaults", {});
|
|
3401
|
+
o(this, "dragConfig", {});
|
|
3402
|
+
o(this, "transformConfig", {});
|
|
3403
|
+
o(this, "backgroundConfig", {});
|
|
3404
|
+
o(this, "connectablePortsConfig", {});
|
|
3405
|
+
o(this, "draggableEdgesConfig", {});
|
|
3406
|
+
o(this, "virtualScrollConfig");
|
|
3407
|
+
o(this, "layoutConfig");
|
|
3408
|
+
o(this, "animatedLayoutConfig");
|
|
3409
|
+
o(this, "hasDraggableNodes", !1);
|
|
3410
|
+
o(this, "hasTransformableViewport", !1);
|
|
3411
|
+
o(this, "hasNodeResizeReactiveEdges", !1);
|
|
3412
|
+
o(this, "hasBackground", !1);
|
|
3413
|
+
o(this, "hasUserConnectablePorts", !1);
|
|
3414
|
+
o(this, "hasUserDraggableEdges", !1);
|
|
3415
|
+
o(this, "hasAnimatedLayout", !1);
|
|
3416
|
+
o(this, "hasLayout", !1);
|
|
3417
|
+
o(this, "boxRenderingTrigger", new G());
|
|
3418
|
+
o(this, "graphStore", new Ee());
|
|
3419
|
+
o(this, "viewportStore", new je());
|
|
3420
|
+
o(this, "graph", new Le(this.graphStore));
|
|
3421
|
+
o(this, "viewport", new Re(this.viewportStore));
|
|
3422
|
+
o(this, "window", window);
|
|
3423
|
+
o(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
3105
3424
|
this.element = e;
|
|
3106
3425
|
}
|
|
3107
3426
|
/**
|
|
@@ -3114,7 +3433,7 @@ class Ct {
|
|
|
3114
3433
|
* enables nodes draggable by user
|
|
3115
3434
|
*/
|
|
3116
3435
|
enableUserDraggableNodes(e) {
|
|
3117
|
-
return this.
|
|
3436
|
+
return this.hasDraggableNodes = !0, this.dragConfig = e ?? {}, this;
|
|
3118
3437
|
}
|
|
3119
3438
|
/**
|
|
3120
3439
|
* enables viewport transformable by user
|
|
@@ -3147,52 +3466,74 @@ class Ct {
|
|
|
3147
3466
|
enableUserConnectablePorts(e) {
|
|
3148
3467
|
return this.hasUserConnectablePorts = !0, this.connectablePortsConfig = e ?? {}, this;
|
|
3149
3468
|
}
|
|
3469
|
+
/**
|
|
3470
|
+
* enables edges dragging by dragging one of the adjacent ports
|
|
3471
|
+
*/
|
|
3150
3472
|
enableUserDraggableEdges(e) {
|
|
3151
3473
|
return this.hasUserDraggableEdges = !0, this.draggableEdgesConfig = e ?? {}, this;
|
|
3152
3474
|
}
|
|
3475
|
+
/**
|
|
3476
|
+
* enables nodes positioning with specified layout
|
|
3477
|
+
*/
|
|
3478
|
+
enableLayout(e) {
|
|
3479
|
+
return this.layoutConfig = e, this.hasLayout = !0, this.hasAnimatedLayout = !1, this;
|
|
3480
|
+
}
|
|
3481
|
+
/**
|
|
3482
|
+
* enables animated nodes positioning with specified layout
|
|
3483
|
+
*/
|
|
3484
|
+
enableAnimatedLayout(e) {
|
|
3485
|
+
return this.animatedLayoutConfig = e, this.hasAnimatedLayout = !0, this.hasLayout = !1, this;
|
|
3486
|
+
}
|
|
3153
3487
|
/**
|
|
3154
3488
|
* builds final canvas
|
|
3155
3489
|
*/
|
|
3156
3490
|
build() {
|
|
3157
3491
|
if (this.used)
|
|
3158
|
-
throw new
|
|
3492
|
+
throw new Ot("CanvasBuilder is a single use object");
|
|
3159
3493
|
this.used = !0;
|
|
3160
|
-
const e = new
|
|
3161
|
-
let t = new
|
|
3494
|
+
const e = new Pt(this.element);
|
|
3495
|
+
let t = new ye(
|
|
3162
3496
|
this.graphStore,
|
|
3163
3497
|
this.viewportStore,
|
|
3164
3498
|
e.main
|
|
3165
3499
|
);
|
|
3166
|
-
this.virtualScrollConfig !== void 0 && (t = new
|
|
3500
|
+
this.virtualScrollConfig !== void 0 && (t = new Xe(
|
|
3167
3501
|
t,
|
|
3168
3502
|
this.graphStore,
|
|
3169
3503
|
this.boxRenderingTrigger,
|
|
3170
|
-
|
|
3171
|
-
)), t = new
|
|
3172
|
-
const
|
|
3504
|
+
Ft(this.virtualScrollConfig)
|
|
3505
|
+
)), t = new Ye(t, this.graphStore);
|
|
3506
|
+
const s = Dt(this.canvasDefaults), i = new ve(
|
|
3173
3507
|
this.graph,
|
|
3174
3508
|
this.viewport,
|
|
3175
3509
|
this.graphStore,
|
|
3176
3510
|
this.viewportStore,
|
|
3177
3511
|
t,
|
|
3178
|
-
|
|
3512
|
+
s
|
|
3179
3513
|
);
|
|
3180
|
-
if (this.hasBackground &&
|
|
3514
|
+
if (this.hasBackground && _.configure(
|
|
3181
3515
|
i,
|
|
3182
|
-
|
|
3516
|
+
$t(this.backgroundConfig),
|
|
3183
3517
|
e.background
|
|
3184
|
-
), this.hasNodeResizeReactiveEdges &&
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3518
|
+
), this.hasNodeResizeReactiveEdges && K.configure(i), this.hasDraggableNodes) {
|
|
3519
|
+
let a = Nt(this.dragConfig);
|
|
3520
|
+
this.hasAnimatedLayout && (a = Gt(
|
|
3521
|
+
a,
|
|
3522
|
+
this.animationStaticNodes
|
|
3523
|
+
)), Q.configure(
|
|
3524
|
+
i,
|
|
3525
|
+
e.main,
|
|
3526
|
+
this.window,
|
|
3527
|
+
a
|
|
3528
|
+
);
|
|
3529
|
+
}
|
|
3530
|
+
if (this.hasUserConnectablePorts) {
|
|
3531
|
+
const a = It(
|
|
3191
3532
|
this.connectablePortsConfig,
|
|
3192
|
-
|
|
3193
|
-
|
|
3533
|
+
s.edges.shapeFactory,
|
|
3534
|
+
s.ports.direction
|
|
3194
3535
|
);
|
|
3195
|
-
|
|
3536
|
+
ee.configure(
|
|
3196
3537
|
i,
|
|
3197
3538
|
e.overlayConnectablePorts,
|
|
3198
3539
|
this.viewportStore,
|
|
@@ -3201,11 +3542,11 @@ class Ct {
|
|
|
3201
3542
|
);
|
|
3202
3543
|
}
|
|
3203
3544
|
if (this.hasUserDraggableEdges) {
|
|
3204
|
-
const a =
|
|
3545
|
+
const a = Ut(
|
|
3205
3546
|
this.draggableEdgesConfig,
|
|
3206
3547
|
i.graph
|
|
3207
3548
|
);
|
|
3208
|
-
|
|
3549
|
+
te.configure(
|
|
3209
3550
|
i,
|
|
3210
3551
|
e.overlayDraggableEdges,
|
|
3211
3552
|
this.viewportStore,
|
|
@@ -3213,19 +3554,30 @@ class Ct {
|
|
|
3213
3554
|
a
|
|
3214
3555
|
);
|
|
3215
3556
|
}
|
|
3216
|
-
this.virtualScrollConfig !== void 0 ?
|
|
3557
|
+
this.virtualScrollConfig !== void 0 ? q.configure(
|
|
3217
3558
|
i,
|
|
3218
3559
|
e.main,
|
|
3219
3560
|
this.window,
|
|
3220
|
-
|
|
3561
|
+
me(this.transformConfig),
|
|
3221
3562
|
this.boxRenderingTrigger,
|
|
3222
|
-
|
|
3223
|
-
) : this.hasTransformableViewport &&
|
|
3563
|
+
Bt(this.virtualScrollConfig)
|
|
3564
|
+
) : this.hasTransformableViewport && X.configure(
|
|
3224
3565
|
i,
|
|
3225
3566
|
e.main,
|
|
3226
3567
|
this.window,
|
|
3227
|
-
|
|
3228
|
-
)
|
|
3568
|
+
me(this.transformConfig)
|
|
3569
|
+
), this.hasLayout && At.configure(
|
|
3570
|
+
i,
|
|
3571
|
+
jt(this.layoutConfig)
|
|
3572
|
+
), this.hasAnimatedLayout && (Kt(
|
|
3573
|
+
i.graph,
|
|
3574
|
+
this.animationStaticNodes
|
|
3575
|
+
), oe.configure(
|
|
3576
|
+
i,
|
|
3577
|
+
Xt(this.animatedLayoutConfig),
|
|
3578
|
+
this.animationStaticNodes,
|
|
3579
|
+
this.window
|
|
3580
|
+
));
|
|
3229
3581
|
const n = () => {
|
|
3230
3582
|
e.destroy(), i.onBeforeDestroy.unsubscribe(n);
|
|
3231
3583
|
};
|
|
@@ -3233,15 +3585,16 @@ class Ct {
|
|
|
3233
3585
|
}
|
|
3234
3586
|
}
|
|
3235
3587
|
export {
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3588
|
+
dt as BezierEdgeShape,
|
|
3589
|
+
Qt as CanvasBuilder,
|
|
3590
|
+
Ot as CanvasBuilderError,
|
|
3591
|
+
P as CanvasError,
|
|
3592
|
+
Ne as DirectEdgeShape,
|
|
3593
|
+
G as EventSubject,
|
|
3594
|
+
ct as HorizontalEdgeShape,
|
|
3595
|
+
wt as InteractiveEdgeError,
|
|
3596
|
+
Me as InteractiveEdgeShape,
|
|
3597
|
+
Jt as MidpointEdgeShape,
|
|
3598
|
+
lt as StraightEdgeShape,
|
|
3599
|
+
gt as VerticalEdgeShape
|
|
3247
3600
|
};
|