@html-graph/html-graph 5.0.1 → 6.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 +55 -9
- package/dist/html-graph.js +475 -282
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var s = (r, e, t) =>
|
|
1
|
+
var Ce = Object.defineProperty;
|
|
2
|
+
var Ve = (r, e, t) => e in r ? Ce(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var s = (r, e, t) => Ve(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
const T = (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 R = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(R || {});
|
|
9
|
+
const $e = () => {
|
|
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
|
+
}, Ue = () => {
|
|
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
|
+
}, Ie = (r) => {
|
|
16
16
|
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
17
17
|
};
|
|
18
|
-
class
|
|
18
|
+
class ye {
|
|
19
19
|
constructor(e, t, o) {
|
|
20
|
-
s(this, "host",
|
|
21
|
-
s(this, "container",
|
|
20
|
+
s(this, "host", $e());
|
|
21
|
+
s(this, "container", Ue());
|
|
22
22
|
s(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
|
|
23
23
|
s(this, "attachedNodeIds", /* @__PURE__ */ new Set());
|
|
24
24
|
s(this, "applyTransform", () => {
|
|
@@ -29,7 +29,7 @@ class ue {
|
|
|
29
29
|
}
|
|
30
30
|
attachNode(e) {
|
|
31
31
|
const t = this.graphStore.getNode(e);
|
|
32
|
-
|
|
32
|
+
Ie(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: o, height: i } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, a = t.
|
|
57
|
+
const t = this.graphStore.getNode(e), { width: o, height: i } = t.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, { payload: a } = t, h = a.centerFn(o, 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) {
|
|
@@ -79,8 +79,8 @@ class ue {
|
|
|
79
79
|
h,
|
|
80
80
|
d
|
|
81
81
|
);
|
|
82
|
-
let g =
|
|
83
|
-
o.element === i.element ? g =
|
|
82
|
+
let g = R.Line;
|
|
83
|
+
o.element === i.element ? g = R.PortCycle : o.nodeId === i.nodeId && (g = R.NodeCycle), t.payload.shape.render({ from: c, to: l, category: g });
|
|
84
84
|
}
|
|
85
85
|
updateEdgePriority(e) {
|
|
86
86
|
const t = this.graphStore.getEdge(e);
|
|
@@ -100,7 +100,7 @@ class ue {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
class
|
|
103
|
+
class Be {
|
|
104
104
|
constructor(e) {
|
|
105
105
|
s(this, "xFrom", 1 / 0);
|
|
106
106
|
s(this, "yFrom", 1 / 0);
|
|
@@ -120,7 +120,7 @@ class $e {
|
|
|
120
120
|
return h <= this.xTo && d >= this.xFrom && c <= this.yTo && l >= this.yFrom;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
class
|
|
123
|
+
class Oe {
|
|
124
124
|
constructor(e, t, o, i) {
|
|
125
125
|
s(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
126
126
|
s(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
@@ -144,7 +144,7 @@ class Ue {
|
|
|
144
144
|
this.handleAttachEdge(a);
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
|
-
this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = i, this.renderingBox = new
|
|
147
|
+
this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = i, this.renderingBox = new Be(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
148
148
|
}
|
|
149
149
|
attachNode(e) {
|
|
150
150
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -198,40 +198,38 @@ class Ue {
|
|
|
198
198
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
class
|
|
201
|
+
class Fe {
|
|
202
202
|
constructor(e, t) {
|
|
203
203
|
s(this, "deferredNodes", /* @__PURE__ */ new Set());
|
|
204
204
|
s(this, "deferredEdges", /* @__PURE__ */ new Set());
|
|
205
205
|
this.htmlView = e, this.graphStore = t;
|
|
206
206
|
}
|
|
207
207
|
attachNode(e) {
|
|
208
|
-
|
|
209
|
-
t.payload.x !== null && t.payload.y !== null ? this.htmlView.attachNode(e) : this.deferredNodes.add(e);
|
|
208
|
+
this.isNodeValid(e) ? this.htmlView.attachNode(e) : this.deferredNodes.add(e);
|
|
210
209
|
}
|
|
211
210
|
detachNode(e) {
|
|
212
211
|
this.deferredNodes.has(e) ? this.deferredNodes.delete(e) : this.htmlView.detachNode(e);
|
|
213
212
|
}
|
|
214
213
|
attachEdge(e) {
|
|
215
|
-
|
|
216
|
-
this.deferredNodes.has(o.nodeId) || this.deferredNodes.has(i.nodeId) ? this.deferredEdges.add(e) : this.htmlView.attachEdge(e);
|
|
214
|
+
this.isEdgeValid(e) ? this.htmlView.attachEdge(e) : this.deferredEdges.add(e);
|
|
217
215
|
}
|
|
218
216
|
detachEdge(e) {
|
|
219
217
|
this.deferredEdges.has(e) ? this.deferredEdges.delete(e) : this.htmlView.detachEdge(e);
|
|
220
218
|
}
|
|
221
219
|
updateNodePosition(e) {
|
|
222
|
-
this.deferredNodes.has(e)
|
|
220
|
+
this.deferredNodes.has(e) ? this.tryAttachNode(e) : this.htmlView.updateNodePosition(e);
|
|
223
221
|
}
|
|
224
222
|
updateNodePriority(e) {
|
|
225
|
-
this.deferredNodes.has(e)
|
|
223
|
+
this.deferredNodes.has(e) ? this.tryAttachNode(e) : this.htmlView.updateNodePriority(e);
|
|
226
224
|
}
|
|
227
225
|
updateEdgeShape(e) {
|
|
228
|
-
this.deferredEdges.has(e)
|
|
226
|
+
this.deferredEdges.has(e) ? this.tryAttachEdge(e) : this.htmlView.updateEdgeShape(e);
|
|
229
227
|
}
|
|
230
228
|
renderEdge(e) {
|
|
231
|
-
this.deferredEdges.has(e)
|
|
229
|
+
this.deferredEdges.has(e) ? this.tryAttachEdge(e) : this.htmlView.renderEdge(e);
|
|
232
230
|
}
|
|
233
231
|
updateEdgePriority(e) {
|
|
234
|
-
this.deferredEdges.has(e)
|
|
232
|
+
this.deferredEdges.has(e) ? this.tryAttachEdge(e) : this.htmlView.updateEdgePriority(e);
|
|
235
233
|
}
|
|
236
234
|
clear() {
|
|
237
235
|
this.deferredNodes.clear(), this.deferredEdges.clear(), this.htmlView.clear();
|
|
@@ -239,8 +237,22 @@ class Ie {
|
|
|
239
237
|
destroy() {
|
|
240
238
|
this.htmlView.destroy();
|
|
241
239
|
}
|
|
240
|
+
isNodeValid(e) {
|
|
241
|
+
const t = this.graphStore.getNode(e);
|
|
242
|
+
return !(t.payload.x === null || t.payload.y === null);
|
|
243
|
+
}
|
|
244
|
+
tryAttachNode(e) {
|
|
245
|
+
this.isNodeValid(e) && (this.deferredNodes.delete(e), this.htmlView.attachNode(e));
|
|
246
|
+
}
|
|
247
|
+
isEdgeValid(e) {
|
|
248
|
+
const t = this.graphStore.getEdge(e), o = this.graphStore.getPort(t.from), i = this.graphStore.getPort(t.to);
|
|
249
|
+
return !(this.deferredNodes.has(o.nodeId) || this.deferredNodes.has(i.nodeId));
|
|
250
|
+
}
|
|
251
|
+
tryAttachEdge(e) {
|
|
252
|
+
this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
|
|
253
|
+
}
|
|
242
254
|
}
|
|
243
|
-
class
|
|
255
|
+
class j {
|
|
244
256
|
constructor() {
|
|
245
257
|
s(this, "callbacks", /* @__PURE__ */ new Set());
|
|
246
258
|
}
|
|
@@ -257,7 +269,7 @@ class pe {
|
|
|
257
269
|
}
|
|
258
270
|
}
|
|
259
271
|
const E = () => {
|
|
260
|
-
const r = new
|
|
272
|
+
const r = new j();
|
|
261
273
|
return [r, r];
|
|
262
274
|
};
|
|
263
275
|
class X {
|
|
@@ -282,16 +294,16 @@ class S extends Error {
|
|
|
282
294
|
s(this, "name", "CanvasError");
|
|
283
295
|
}
|
|
284
296
|
}
|
|
285
|
-
class
|
|
297
|
+
class me {
|
|
286
298
|
constructor(e, t, o, i, n, a) {
|
|
287
299
|
s(this, "nodeIdGenerator", new X(
|
|
288
|
-
(e) => this.
|
|
300
|
+
(e) => this.graphStore.getNode(e) !== void 0
|
|
289
301
|
));
|
|
290
302
|
s(this, "portIdGenerator", new X(
|
|
291
|
-
(e) => this.
|
|
303
|
+
(e) => this.graphStore.getPort(e) !== void 0
|
|
292
304
|
));
|
|
293
305
|
s(this, "edgeIdGenerator", new X(
|
|
294
|
-
(e) => this.
|
|
306
|
+
(e) => this.graphStore.getEdge(e) !== void 0
|
|
295
307
|
));
|
|
296
308
|
s(this, "onAfterNodeAdded", (e) => {
|
|
297
309
|
this.htmlView.attachNode(e);
|
|
@@ -365,8 +377,8 @@ class we {
|
|
|
365
377
|
if (this.graphStore.addNode({
|
|
366
378
|
id: t,
|
|
367
379
|
element: e.element,
|
|
368
|
-
x: e.x,
|
|
369
|
-
y: e.y,
|
|
380
|
+
x: e.x ?? null,
|
|
381
|
+
y: e.y ?? null,
|
|
370
382
|
centerFn: e.centerFn ?? this.params.nodes.centerFn,
|
|
371
383
|
priority: e.priority ?? this.params.nodes.priorityFn()
|
|
372
384
|
}), e.ports !== void 0)
|
|
@@ -498,7 +510,7 @@ class we {
|
|
|
498
510
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy(), this.destroyed = !0);
|
|
499
511
|
}
|
|
500
512
|
}
|
|
501
|
-
class
|
|
513
|
+
class We {
|
|
502
514
|
constructor() {
|
|
503
515
|
s(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
504
516
|
s(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
@@ -538,16 +550,16 @@ class Be {
|
|
|
538
550
|
return this.multiToSingleMap.get(e) !== void 0;
|
|
539
551
|
}
|
|
540
552
|
}
|
|
541
|
-
class
|
|
553
|
+
class ve {
|
|
542
554
|
constructor() {
|
|
543
555
|
s(this, "nodes", /* @__PURE__ */ new Map());
|
|
544
556
|
s(this, "ports", /* @__PURE__ */ new Map());
|
|
545
557
|
s(this, "edges", /* @__PURE__ */ new Map());
|
|
546
558
|
s(this, "nodesElementsMap", /* @__PURE__ */ new Map());
|
|
547
|
-
s(this, "
|
|
548
|
-
s(this, "
|
|
549
|
-
s(this, "
|
|
550
|
-
s(this, "elementPorts", new
|
|
559
|
+
s(this, "portIncomingEdges", /* @__PURE__ */ new Map());
|
|
560
|
+
s(this, "portOutcomingEdges", /* @__PURE__ */ new Map());
|
|
561
|
+
s(this, "portCycleEdges", /* @__PURE__ */ new Map());
|
|
562
|
+
s(this, "elementPorts", new We());
|
|
551
563
|
s(this, "afterNodeAddedEmitter");
|
|
552
564
|
s(this, "onAfterNodeAdded");
|
|
553
565
|
s(this, "afterNodeUpdatedEmitter");
|
|
@@ -614,7 +626,7 @@ class fe {
|
|
|
614
626
|
direction: e.direction
|
|
615
627
|
},
|
|
616
628
|
nodeId: e.nodeId
|
|
617
|
-
}), 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);
|
|
618
630
|
}
|
|
619
631
|
getPort(e) {
|
|
620
632
|
return this.ports.get(e);
|
|
@@ -665,16 +677,16 @@ class fe {
|
|
|
665
677
|
this.beforeEdgeRemovedEmitter.emit(e), this.removeEdgeInternal(e);
|
|
666
678
|
}
|
|
667
679
|
clear() {
|
|
668
|
-
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();
|
|
669
681
|
}
|
|
670
682
|
getPortIncomingEdgeIds(e) {
|
|
671
|
-
return Array.from(this.
|
|
683
|
+
return Array.from(this.portIncomingEdges.get(e));
|
|
672
684
|
}
|
|
673
685
|
getPortOutgoingEdgeIds(e) {
|
|
674
|
-
return Array.from(this.
|
|
686
|
+
return Array.from(this.portOutcomingEdges.get(e));
|
|
675
687
|
}
|
|
676
688
|
getPortCycleEdgeIds(e) {
|
|
677
|
-
return Array.from(this.
|
|
689
|
+
return Array.from(this.portCycleEdges.get(e));
|
|
678
690
|
}
|
|
679
691
|
getPortAdjacentEdgeIds(e) {
|
|
680
692
|
return [
|
|
@@ -684,32 +696,51 @@ class fe {
|
|
|
684
696
|
];
|
|
685
697
|
}
|
|
686
698
|
getNodeIncomingEdgeIds(e) {
|
|
687
|
-
const t = Array.from(this.nodes.get(e).ports.keys());
|
|
688
|
-
let o = [];
|
|
699
|
+
const t = Array.from(this.nodes.get(e).ports.keys()), o = [];
|
|
689
700
|
return t.forEach((i) => {
|
|
690
|
-
|
|
701
|
+
this.getPortIncomingEdgeIds(i).filter((n) => {
|
|
702
|
+
const a = this.getEdge(n);
|
|
703
|
+
return this.getPort(a.from).nodeId !== e;
|
|
704
|
+
}).forEach((n) => {
|
|
705
|
+
o.push(n);
|
|
706
|
+
});
|
|
691
707
|
}), o;
|
|
692
708
|
}
|
|
693
709
|
getNodeOutgoingEdgeIds(e) {
|
|
694
|
-
const t = Array.from(this.nodes.get(e).ports.keys());
|
|
695
|
-
let o = [];
|
|
710
|
+
const t = Array.from(this.nodes.get(e).ports.keys()), o = [];
|
|
696
711
|
return t.forEach((i) => {
|
|
697
|
-
|
|
712
|
+
this.getPortOutgoingEdgeIds(i).filter((n) => {
|
|
713
|
+
const a = this.getEdge(n);
|
|
714
|
+
return this.getPort(a.to).nodeId !== e;
|
|
715
|
+
}).forEach((n) => {
|
|
716
|
+
o.push(n);
|
|
717
|
+
});
|
|
698
718
|
}), o;
|
|
699
719
|
}
|
|
700
720
|
getNodeCycleEdgeIds(e) {
|
|
701
|
-
const t = Array.from(this.nodes.get(e).ports.keys());
|
|
702
|
-
let o = [];
|
|
721
|
+
const t = Array.from(this.nodes.get(e).ports.keys()), o = [];
|
|
703
722
|
return t.forEach((i) => {
|
|
704
|
-
|
|
723
|
+
this.getPortCycleEdgeIds(i).forEach((n) => {
|
|
724
|
+
o.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
|
+
o.push(n);
|
|
730
|
+
});
|
|
705
731
|
}), o;
|
|
706
732
|
}
|
|
707
733
|
getNodeAdjacentEdgeIds(e) {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
734
|
+
const t = Array.from(this.nodes.get(e).ports.keys()), o = [];
|
|
735
|
+
return t.forEach((i) => {
|
|
736
|
+
this.getPortIncomingEdgeIds(i).forEach((n) => {
|
|
737
|
+
o.push(n);
|
|
738
|
+
}), this.getPortOutgoingEdgeIds(i).forEach((n) => {
|
|
739
|
+
o.push(n);
|
|
740
|
+
}), this.getPortCycleEdgeIds(i).forEach((n) => {
|
|
741
|
+
o.push(n);
|
|
742
|
+
});
|
|
743
|
+
}), o;
|
|
713
744
|
}
|
|
714
745
|
addEdgeInternal(e) {
|
|
715
746
|
this.edges.set(e.id, {
|
|
@@ -719,26 +750,26 @@ class fe {
|
|
|
719
750
|
shape: e.shape,
|
|
720
751
|
priority: e.priority
|
|
721
752
|
}
|
|
722
|
-
}), 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);
|
|
723
754
|
}
|
|
724
755
|
removeEdgeInternal(e) {
|
|
725
756
|
const t = this.edges.get(e), o = t.from, i = t.to;
|
|
726
|
-
this.
|
|
757
|
+
this.portCycleEdges.get(o).delete(e), this.portCycleEdges.get(i).delete(e), this.portIncomingEdges.get(o).delete(e), this.portIncomingEdges.get(i).delete(e), this.portOutcomingEdges.get(o).delete(e), this.portOutcomingEdges.get(i).delete(e), this.edges.delete(e);
|
|
727
758
|
}
|
|
728
759
|
}
|
|
729
|
-
const
|
|
760
|
+
const de = (r) => ({
|
|
730
761
|
scale: 1 / r.scale,
|
|
731
762
|
x: -r.x / r.scale,
|
|
732
763
|
y: -r.y / r.scale
|
|
733
|
-
}),
|
|
764
|
+
}), ce = {
|
|
734
765
|
scale: 1,
|
|
735
766
|
x: 0,
|
|
736
767
|
y: 0
|
|
737
768
|
};
|
|
738
|
-
class
|
|
769
|
+
class ke {
|
|
739
770
|
constructor() {
|
|
740
|
-
s(this, "viewportMatrix",
|
|
741
|
-
s(this, "contentMatrix",
|
|
771
|
+
s(this, "viewportMatrix", ce);
|
|
772
|
+
s(this, "contentMatrix", ce);
|
|
742
773
|
s(this, "afterUpdateEmitter");
|
|
743
774
|
s(this, "onAfterUpdated");
|
|
744
775
|
[this.afterUpdateEmitter, this.onAfterUpdated] = E();
|
|
@@ -754,17 +785,17 @@ class Fe {
|
|
|
754
785
|
scale: e.scale ?? this.viewportMatrix.scale,
|
|
755
786
|
x: e.x ?? this.viewportMatrix.x,
|
|
756
787
|
y: e.y ?? this.viewportMatrix.y
|
|
757
|
-
}, this.contentMatrix =
|
|
788
|
+
}, this.contentMatrix = de(this.viewportMatrix), this.afterUpdateEmitter.emit();
|
|
758
789
|
}
|
|
759
790
|
patchContentMatrix(e) {
|
|
760
791
|
this.contentMatrix = {
|
|
761
792
|
scale: e.scale ?? this.contentMatrix.scale,
|
|
762
793
|
x: e.x ?? this.contentMatrix.x,
|
|
763
794
|
y: e.y ?? this.contentMatrix.y
|
|
764
|
-
}, this.viewportMatrix =
|
|
795
|
+
}, this.viewportMatrix = de(this.contentMatrix), this.afterUpdateEmitter.emit();
|
|
765
796
|
}
|
|
766
797
|
}
|
|
767
|
-
class
|
|
798
|
+
class G {
|
|
768
799
|
constructor(e) {
|
|
769
800
|
s(this, "elementToNodeId", /* @__PURE__ */ new Map());
|
|
770
801
|
s(this, "nodesResizeObserver");
|
|
@@ -787,17 +818,17 @@ class j {
|
|
|
787
818
|
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
|
|
788
819
|
}
|
|
789
820
|
static configure(e) {
|
|
790
|
-
new
|
|
821
|
+
new G(e);
|
|
791
822
|
}
|
|
792
823
|
handleNodeResize(e) {
|
|
793
824
|
const t = this.elementToNodeId.get(e);
|
|
794
825
|
this.canvas.updateNode(t);
|
|
795
826
|
}
|
|
796
827
|
}
|
|
797
|
-
const
|
|
828
|
+
const ze = (r, e, t) => {
|
|
798
829
|
const { x: o, y: i, width: n, height: a } = r.getBoundingClientRect();
|
|
799
830
|
return e >= o && e <= o + n && t >= i && t <= i + a;
|
|
800
|
-
},
|
|
831
|
+
}, Xe = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, C = (r, e, t, o) => ze(e, t, o) && Xe(r, t, o), I = (r, e) => {
|
|
801
832
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
802
833
|
}, B = (r) => {
|
|
803
834
|
const e = document.createElement("div");
|
|
@@ -814,22 +845,22 @@ const Oe = (r, e, t) => {
|
|
|
814
845
|
}
|
|
815
846
|
]
|
|
816
847
|
};
|
|
817
|
-
},
|
|
848
|
+
}, Ye = (r, e) => {
|
|
818
849
|
let t = e, o = null;
|
|
819
850
|
for (; t !== null && (o = r.getElementPortIds(t)[0] ?? null, o === null); )
|
|
820
851
|
t = t.parentElement;
|
|
821
852
|
return o;
|
|
822
|
-
},
|
|
853
|
+
}, Ee = (r, e) => {
|
|
823
854
|
const t = document.elementsFromPoint(e.x, e.y);
|
|
824
855
|
for (const o of t) {
|
|
825
|
-
const i =
|
|
856
|
+
const i = Ye(r, o);
|
|
826
857
|
if (i !== null)
|
|
827
858
|
return i;
|
|
828
859
|
}
|
|
829
860
|
return null;
|
|
830
861
|
};
|
|
831
862
|
var P = /* @__PURE__ */ ((r) => (r.Static = "static", r.Dragging = "dragging", r.Edge = "edge", r))(P || {});
|
|
832
|
-
const
|
|
863
|
+
const Ae = (r, e) => ({
|
|
833
864
|
x: r / 2,
|
|
834
865
|
y: e / 2
|
|
835
866
|
}), u = {
|
|
@@ -838,7 +869,7 @@ const me = (r, e) => ({
|
|
|
838
869
|
}, m = (r, e, t) => ({
|
|
839
870
|
x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
|
|
840
871
|
y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
|
|
841
|
-
}),
|
|
872
|
+
}), xe = (r, e) => {
|
|
842
873
|
const t = {
|
|
843
874
|
x: r.x + r.width / 2,
|
|
844
875
|
y: r.y + r.height / 2
|
|
@@ -854,11 +885,11 @@ const me = (r, e) => ({
|
|
|
854
885
|
flipX: d,
|
|
855
886
|
flipY: c
|
|
856
887
|
};
|
|
857
|
-
},
|
|
888
|
+
}, F = (r, e, t, o) => ({
|
|
858
889
|
x: e * r.x + (1 - e) / 2 * o.x,
|
|
859
890
|
y: t * r.y + (1 - t) / 2 * o.y
|
|
860
891
|
});
|
|
861
|
-
class
|
|
892
|
+
class He {
|
|
862
893
|
constructor(e) {
|
|
863
894
|
s(this, "path");
|
|
864
895
|
s(this, "midpoint");
|
|
@@ -883,7 +914,7 @@ class ze {
|
|
|
883
914
|
this.path = `${d}${h}${c}`;
|
|
884
915
|
}
|
|
885
916
|
}
|
|
886
|
-
class
|
|
917
|
+
class je {
|
|
887
918
|
constructor(e) {
|
|
888
919
|
s(this, "path");
|
|
889
920
|
s(this, "midpoint");
|
|
@@ -935,26 +966,26 @@ class Xe {
|
|
|
935
966
|
`C ${y.x} ${y.y} ${x.x} ${x.y} ${f.x} ${f.y}`,
|
|
936
967
|
`C ${A.x} ${A.y} ${v.x} ${v.y} ${g.x} ${g.y}`,
|
|
937
968
|
`L ${o.x} ${o.y}`
|
|
938
|
-
].join(" "), this.midpoint =
|
|
969
|
+
].join(" "), this.midpoint = F(f, e.flipX, e.flipY, e.to);
|
|
939
970
|
}
|
|
940
971
|
}
|
|
941
|
-
const
|
|
972
|
+
const K = Object.freeze({
|
|
942
973
|
edgeColor: "--edge-color"
|
|
943
|
-
}),
|
|
974
|
+
}), Se = (r) => {
|
|
944
975
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
945
|
-
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(
|
|
946
|
-
},
|
|
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(K.edgeColor, r), e;
|
|
977
|
+
}, Pe = (r) => {
|
|
947
978
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
948
|
-
return e.setAttribute("stroke", `var(${
|
|
949
|
-
},
|
|
979
|
+
return e.setAttribute("stroke", `var(${K.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
980
|
+
}, O = () => {
|
|
950
981
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
951
|
-
return r.setAttribute("fill", `var(${
|
|
952
|
-
},
|
|
982
|
+
return r.setAttribute("fill", `var(${K.edgeColor})`), r;
|
|
983
|
+
}, be = () => {
|
|
953
984
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
954
985
|
return r.style.transformOrigin = "50% 50%", r;
|
|
955
|
-
},
|
|
986
|
+
}, Te = (r, e) => {
|
|
956
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`;
|
|
957
|
-
},
|
|
988
|
+
}, L = (r, e) => {
|
|
958
989
|
const t = [];
|
|
959
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) {
|
|
960
991
|
const o = r.length - 1;
|
|
@@ -966,15 +997,15 @@ const G = Object.freeze({
|
|
|
966
997
|
const V = r[d + 1];
|
|
967
998
|
i = V.x - h.x, n = V.y - h.y, a = Math.sqrt(i * i + n * n);
|
|
968
999
|
}
|
|
969
|
-
const x = a !== 0 ? Math.min((y ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, A = y ? { x: h.x + i * x, y: h.y + n * x } : h, b = g !== 0 ? Math.min((y ? e : 0) / g, d > 1 ? 0.5 : 1) : 0,
|
|
970
|
-
d > 0 && t.push(`L ${
|
|
1000
|
+
const x = a !== 0 ? Math.min((y ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, A = y ? { x: h.x + i * x, y: h.y + n * x } : h, b = g !== 0 ? Math.min((y ? e : 0) / g, d > 1 ? 0.5 : 1) : 0, N = y ? { x: h.x + c * b, y: h.y + l * b } : h;
|
|
1001
|
+
d > 0 && t.push(`L ${N.x} ${N.y}`), y && t.push(
|
|
971
1002
|
`C ${h.x} ${h.y} ${h.x} ${h.y} ${A.x} ${A.y}`
|
|
972
1003
|
);
|
|
973
1004
|
});
|
|
974
1005
|
}
|
|
975
1006
|
return t.join(" ");
|
|
976
1007
|
};
|
|
977
|
-
class
|
|
1008
|
+
class Ge {
|
|
978
1009
|
constructor(e) {
|
|
979
1010
|
s(this, "path");
|
|
980
1011
|
s(this, "midpoint");
|
|
@@ -1007,13 +1038,13 @@ class Ye {
|
|
|
1007
1038
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
1008
1039
|
y: d.y
|
|
1009
1040
|
}, y = { x: f.x, y: l };
|
|
1010
|
-
this.path =
|
|
1041
|
+
this.path = L(
|
|
1011
1042
|
[o, h, g, p, y, f, d, i],
|
|
1012
1043
|
this.params.roundness
|
|
1013
1044
|
);
|
|
1014
1045
|
}
|
|
1015
1046
|
}
|
|
1016
|
-
class
|
|
1047
|
+
class Ke {
|
|
1017
1048
|
constructor(e) {
|
|
1018
1049
|
s(this, "path");
|
|
1019
1050
|
s(this, "midpoint");
|
|
@@ -1038,13 +1069,13 @@ class He {
|
|
|
1038
1069
|
this.params.targetDirection,
|
|
1039
1070
|
this.params.to
|
|
1040
1071
|
), p = { x: g.x + d, y: g.y + c }, f = { x: (l.x + p.x) / 2, y: (l.y + p.y) / 2 };
|
|
1041
|
-
this.midpoint =
|
|
1072
|
+
this.midpoint = F(f, e.flipX, e.flipY, e.to), this.path = L(
|
|
1042
1073
|
[t, n, l, p, g, o],
|
|
1043
1074
|
this.params.roundness
|
|
1044
1075
|
);
|
|
1045
1076
|
}
|
|
1046
1077
|
}
|
|
1047
|
-
class
|
|
1078
|
+
class Ze {
|
|
1048
1079
|
constructor(e) {
|
|
1049
1080
|
s(this, "path");
|
|
1050
1081
|
s(this, "midpoint");
|
|
@@ -1071,10 +1102,10 @@ class je {
|
|
|
1071
1102
|
this.params.targetDirection,
|
|
1072
1103
|
this.params.to
|
|
1073
1104
|
);
|
|
1074
|
-
this.path =
|
|
1105
|
+
this.path = L([o, a, h, i], this.params.roundness);
|
|
1075
1106
|
}
|
|
1076
1107
|
}
|
|
1077
|
-
class
|
|
1108
|
+
class Je {
|
|
1078
1109
|
constructor(e) {
|
|
1079
1110
|
s(this, "path");
|
|
1080
1111
|
s(this, "midpoint");
|
|
@@ -1107,13 +1138,13 @@ class Ge {
|
|
|
1107
1138
|
x: d.x,
|
|
1108
1139
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1109
1140
|
}, y = { x: l, y: f.y };
|
|
1110
|
-
this.path =
|
|
1141
|
+
this.path = L(
|
|
1111
1142
|
[o, h, g, p, y, f, d, i],
|
|
1112
1143
|
this.params.roundness
|
|
1113
1144
|
);
|
|
1114
1145
|
}
|
|
1115
1146
|
}
|
|
1116
|
-
class
|
|
1147
|
+
class Z {
|
|
1117
1148
|
constructor(e) {
|
|
1118
1149
|
s(this, "path");
|
|
1119
1150
|
s(this, "midpoint");
|
|
@@ -1130,10 +1161,10 @@ class K {
|
|
|
1130
1161
|
].map(
|
|
1131
1162
|
(c) => m(c, this.params.sourceDirection, u)
|
|
1132
1163
|
), d = `M ${u.x} ${u.y} L ${h[0].x} ${h[0].y} `;
|
|
1133
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${
|
|
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 };
|
|
1134
1165
|
}
|
|
1135
1166
|
}
|
|
1136
|
-
class
|
|
1167
|
+
class Qe {
|
|
1137
1168
|
constructor(e) {
|
|
1138
1169
|
s(this, "path");
|
|
1139
1170
|
s(this, "midpoint");
|
|
@@ -1154,7 +1185,7 @@ class Ke {
|
|
|
1154
1185
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : f}${p}`, this.midpoint = g[3];
|
|
1155
1186
|
}
|
|
1156
1187
|
}
|
|
1157
|
-
class
|
|
1188
|
+
class _e {
|
|
1158
1189
|
constructor(e) {
|
|
1159
1190
|
s(this, "path");
|
|
1160
1191
|
s(this, "midpoint");
|
|
@@ -1190,7 +1221,7 @@ class Ze {
|
|
|
1190
1221
|
};
|
|
1191
1222
|
}
|
|
1192
1223
|
}
|
|
1193
|
-
class
|
|
1224
|
+
class qe {
|
|
1194
1225
|
constructor(e) {
|
|
1195
1226
|
s(this, "path");
|
|
1196
1227
|
s(this, "midpoint");
|
|
@@ -1218,7 +1249,7 @@ class Je {
|
|
|
1218
1249
|
x: (n.x + a.x) / 2,
|
|
1219
1250
|
y: l
|
|
1220
1251
|
};
|
|
1221
|
-
this.midpoint =
|
|
1252
|
+
this.midpoint = F(g, e.flipX, e.flipY, e.to), this.path = L(
|
|
1222
1253
|
[
|
|
1223
1254
|
t,
|
|
1224
1255
|
n,
|
|
@@ -1231,7 +1262,7 @@ class Je {
|
|
|
1231
1262
|
);
|
|
1232
1263
|
}
|
|
1233
1264
|
}
|
|
1234
|
-
class
|
|
1265
|
+
class et {
|
|
1235
1266
|
constructor(e) {
|
|
1236
1267
|
s(this, "path");
|
|
1237
1268
|
s(this, "midpoint");
|
|
@@ -1259,7 +1290,7 @@ class Qe {
|
|
|
1259
1290
|
x: l,
|
|
1260
1291
|
y: (n.y + a.y) / 2
|
|
1261
1292
|
};
|
|
1262
|
-
this.midpoint =
|
|
1293
|
+
this.midpoint = F(g, e.flipX, e.flipY, e.to), this.path = L(
|
|
1263
1294
|
[
|
|
1264
1295
|
t,
|
|
1265
1296
|
n,
|
|
@@ -1294,30 +1325,30 @@ const w = Object.freeze({
|
|
|
1294
1325
|
curvature: 90,
|
|
1295
1326
|
interactiveWidth: 10,
|
|
1296
1327
|
preOffset: 0
|
|
1297
|
-
}),
|
|
1328
|
+
}), ge = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
|
|
1298
1329
|
class W {
|
|
1299
1330
|
constructor(e) {
|
|
1300
1331
|
s(this, "svg");
|
|
1301
|
-
s(this, "group",
|
|
1332
|
+
s(this, "group", be());
|
|
1302
1333
|
s(this, "line");
|
|
1303
1334
|
s(this, "sourceArrow", null);
|
|
1304
1335
|
s(this, "targetArrow", null);
|
|
1305
1336
|
s(this, "onAfterRender");
|
|
1306
1337
|
s(this, "afterRenderEmitter");
|
|
1307
1338
|
s(this, "arrowRenderer");
|
|
1308
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.arrowRenderer = this.params.arrowRenderer, this.svg =
|
|
1339
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Se(e.color), this.svg.appendChild(this.group), this.line = Pe(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));
|
|
1309
1340
|
}
|
|
1310
1341
|
render(e) {
|
|
1311
|
-
const { x: t, y: o, width: i, height: n, flipX: a, flipY: h } =
|
|
1342
|
+
const { x: t, y: o, width: i, height: n, flipX: a, flipY: h } = xe(
|
|
1312
1343
|
e.from,
|
|
1313
1344
|
e.to
|
|
1314
1345
|
);
|
|
1315
|
-
|
|
1316
|
-
const d =
|
|
1346
|
+
Te(this.svg, { x: t, y: o, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1347
|
+
const d = ge(
|
|
1317
1348
|
e.from.direction,
|
|
1318
1349
|
a,
|
|
1319
1350
|
h
|
|
1320
|
-
), c =
|
|
1351
|
+
), c = ge(
|
|
1321
1352
|
e.to.direction,
|
|
1322
1353
|
a,
|
|
1323
1354
|
h
|
|
@@ -1326,7 +1357,7 @@ class W {
|
|
|
1326
1357
|
y: n
|
|
1327
1358
|
};
|
|
1328
1359
|
let g = { x: -c.x, y: -c.y }, p;
|
|
1329
|
-
e.category ===
|
|
1360
|
+
e.category === R.PortCycle ? (p = this.params.createCyclePath, g = d) : e.category === R.NodeCycle ? p = this.params.createDetourPath : p = this.params.createLinePath;
|
|
1330
1361
|
const f = p(
|
|
1331
1362
|
d,
|
|
1332
1363
|
c,
|
|
@@ -1353,7 +1384,7 @@ class W {
|
|
|
1353
1384
|
});
|
|
1354
1385
|
}
|
|
1355
1386
|
}
|
|
1356
|
-
const
|
|
1387
|
+
const tt = (r) => (e) => {
|
|
1357
1388
|
const o = [
|
|
1358
1389
|
u,
|
|
1359
1390
|
{ x: e.arrowLength, y: r.radius },
|
|
@@ -1365,7 +1396,7 @@ const _e = (r) => (e) => {
|
|
|
1365
1396
|
y: h.y + e.shift.y
|
|
1366
1397
|
})), i = `M ${o[0].x} ${o[0].y}`, n = `L ${o[1].x} ${o[1].y}`, a = `L ${o[2].x} ${o[2].y}`;
|
|
1367
1398
|
return `${i} ${n} ${a} Z`;
|
|
1368
|
-
},
|
|
1399
|
+
}, rt = (r) => (e) => {
|
|
1369
1400
|
const t = r.radius, o = e.arrowLength, i = (o * o + 2 * o * t) / (2 * t), n = i + t, a = o + t - t * (o + t) / n, h = t * i / n, c = [u, { x: a, y: -h }, { x: a, y: h }].map(
|
|
1370
1401
|
(y) => m(y, e.direction, u)
|
|
1371
1402
|
).map((y) => ({
|
|
@@ -1373,7 +1404,7 @@ const _e = (r) => (e) => {
|
|
|
1373
1404
|
y: y.y + e.shift.y
|
|
1374
1405
|
})), l = `M ${c[0].x} ${c[0].y}`, g = `A ${i} ${i} 0 0 0 ${c[1].x} ${c[1].y}`, p = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, f = `A ${i} ${i} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1375
1406
|
return `${l} ${g} ${p} ${f}`;
|
|
1376
|
-
},
|
|
1407
|
+
}, ot = (r) => (e) => {
|
|
1377
1408
|
const t = r.smallRadius, o = r.radius, i = m(
|
|
1378
1409
|
{
|
|
1379
1410
|
x: e.arrowLength,
|
|
@@ -1399,22 +1430,22 @@ const _e = (r) => (e) => {
|
|
|
1399
1430
|
return r;
|
|
1400
1431
|
switch (r.type) {
|
|
1401
1432
|
case "triangle":
|
|
1402
|
-
return
|
|
1433
|
+
return tt({
|
|
1403
1434
|
radius: r.radius ?? w.polygonArrowRadius
|
|
1404
1435
|
});
|
|
1405
1436
|
case "arc":
|
|
1406
|
-
return
|
|
1437
|
+
return rt({
|
|
1407
1438
|
radius: r.radius ?? w.circleArrowRadius
|
|
1408
1439
|
});
|
|
1409
1440
|
default:
|
|
1410
|
-
return
|
|
1441
|
+
return ot({
|
|
1411
1442
|
smallRadius: r.smallRadius ?? w.wedgeArrowSmallRadius,
|
|
1412
1443
|
angle: r.angle ?? w.wedgeArrowAngle,
|
|
1413
1444
|
radius: r.radius ?? w.wedgeArrowRadius
|
|
1414
1445
|
});
|
|
1415
1446
|
}
|
|
1416
1447
|
};
|
|
1417
|
-
class
|
|
1448
|
+
class st {
|
|
1418
1449
|
constructor(e) {
|
|
1419
1450
|
s(this, "svg");
|
|
1420
1451
|
s(this, "group");
|
|
@@ -1431,7 +1462,7 @@ class tt {
|
|
|
1431
1462
|
s(this, "hasSourceArrow");
|
|
1432
1463
|
s(this, "hasTargetArrow");
|
|
1433
1464
|
s(this, "pathShape");
|
|
1434
|
-
s(this, "createCyclePath", (e) => new
|
|
1465
|
+
s(this, "createCyclePath", (e) => new Qe({
|
|
1435
1466
|
sourceDirection: e,
|
|
1436
1467
|
radius: this.portCycleRadius,
|
|
1437
1468
|
smallRadius: this.portCycleSmallRadius,
|
|
@@ -1439,7 +1470,7 @@ class tt {
|
|
|
1439
1470
|
hasSourceArrow: this.hasSourceArrow,
|
|
1440
1471
|
hasTargetArrow: this.hasTargetArrow
|
|
1441
1472
|
}));
|
|
1442
|
-
s(this, "createDetourPath", (e, t, o, i, n) => new
|
|
1473
|
+
s(this, "createDetourPath", (e, t, o, i, n) => new je({
|
|
1443
1474
|
to: o,
|
|
1444
1475
|
sourceDirection: e,
|
|
1445
1476
|
targetDirection: t,
|
|
@@ -1452,7 +1483,7 @@ class tt {
|
|
|
1452
1483
|
hasSourceArrow: this.hasSourceArrow,
|
|
1453
1484
|
hasTargetArrow: this.hasTargetArrow
|
|
1454
1485
|
}));
|
|
1455
|
-
s(this, "createLinePath", (e, t, o) => new
|
|
1486
|
+
s(this, "createLinePath", (e, t, o) => new He({
|
|
1456
1487
|
to: o,
|
|
1457
1488
|
sourceDirection: e,
|
|
1458
1489
|
targetDirection: t,
|
|
@@ -1477,7 +1508,7 @@ class tt {
|
|
|
1477
1508
|
this.pathShape.render(e);
|
|
1478
1509
|
}
|
|
1479
1510
|
}
|
|
1480
|
-
class
|
|
1511
|
+
class it {
|
|
1481
1512
|
constructor(e) {
|
|
1482
1513
|
s(this, "svg");
|
|
1483
1514
|
s(this, "group");
|
|
@@ -1493,7 +1524,7 @@ class rt {
|
|
|
1493
1524
|
s(this, "hasSourceArrow");
|
|
1494
1525
|
s(this, "hasTargetArrow");
|
|
1495
1526
|
s(this, "pathShape");
|
|
1496
|
-
s(this, "createCyclePath", (e) => new
|
|
1527
|
+
s(this, "createCyclePath", (e) => new Z({
|
|
1497
1528
|
sourceDirection: e,
|
|
1498
1529
|
arrowLength: this.arrowLength,
|
|
1499
1530
|
side: this.cycleSquareSide,
|
|
@@ -1502,7 +1533,7 @@ class rt {
|
|
|
1502
1533
|
hasSourceArrow: this.hasSourceArrow,
|
|
1503
1534
|
hasTargetArrow: this.hasTargetArrow
|
|
1504
1535
|
}));
|
|
1505
|
-
s(this, "createDetourPath", (e, t, o, i, n) => new
|
|
1536
|
+
s(this, "createDetourPath", (e, t, o, i, n) => new qe({
|
|
1506
1537
|
to: o,
|
|
1507
1538
|
sourceDirection: e,
|
|
1508
1539
|
targetDirection: t,
|
|
@@ -1515,7 +1546,7 @@ class rt {
|
|
|
1515
1546
|
hasSourceArrow: this.hasSourceArrow,
|
|
1516
1547
|
hasTargetArrow: this.hasTargetArrow
|
|
1517
1548
|
}));
|
|
1518
|
-
s(this, "createLinePath", (e, t, o, i) => new
|
|
1549
|
+
s(this, "createLinePath", (e, t, o, i) => new Ge({
|
|
1519
1550
|
to: o,
|
|
1520
1551
|
sourceDirection: e,
|
|
1521
1552
|
targetDirection: t,
|
|
@@ -1548,7 +1579,7 @@ class rt {
|
|
|
1548
1579
|
this.pathShape.render(e);
|
|
1549
1580
|
}
|
|
1550
1581
|
}
|
|
1551
|
-
class
|
|
1582
|
+
class nt {
|
|
1552
1583
|
constructor(e) {
|
|
1553
1584
|
s(this, "svg");
|
|
1554
1585
|
s(this, "group");
|
|
@@ -1565,7 +1596,7 @@ class ot {
|
|
|
1565
1596
|
s(this, "hasSourceArrow");
|
|
1566
1597
|
s(this, "hasTargetArrow");
|
|
1567
1598
|
s(this, "pathShape");
|
|
1568
|
-
s(this, "createCyclePath", (e) => new
|
|
1599
|
+
s(this, "createCyclePath", (e) => new Z({
|
|
1569
1600
|
sourceDirection: e,
|
|
1570
1601
|
arrowLength: this.arrowLength,
|
|
1571
1602
|
side: this.cycleSquareSide,
|
|
@@ -1574,7 +1605,7 @@ class ot {
|
|
|
1574
1605
|
hasSourceArrow: this.hasSourceArrow,
|
|
1575
1606
|
hasTargetArrow: this.hasTargetArrow
|
|
1576
1607
|
}));
|
|
1577
|
-
s(this, "createDetourPath", (e, t, o, i, n) => new
|
|
1608
|
+
s(this, "createDetourPath", (e, t, o, i, n) => new Ke({
|
|
1578
1609
|
to: o,
|
|
1579
1610
|
sourceDirection: e,
|
|
1580
1611
|
targetDirection: t,
|
|
@@ -1588,7 +1619,7 @@ class ot {
|
|
|
1588
1619
|
hasSourceArrow: this.hasSourceArrow,
|
|
1589
1620
|
hasTargetArrow: this.hasTargetArrow
|
|
1590
1621
|
}));
|
|
1591
|
-
s(this, "createLinePath", (e, t, o) => new
|
|
1622
|
+
s(this, "createLinePath", (e, t, o) => new Ze({
|
|
1592
1623
|
to: o,
|
|
1593
1624
|
sourceDirection: e,
|
|
1594
1625
|
targetDirection: t,
|
|
@@ -1620,7 +1651,7 @@ class ot {
|
|
|
1620
1651
|
this.pathShape.render(e);
|
|
1621
1652
|
}
|
|
1622
1653
|
}
|
|
1623
|
-
class
|
|
1654
|
+
class at {
|
|
1624
1655
|
constructor(e) {
|
|
1625
1656
|
s(this, "svg");
|
|
1626
1657
|
s(this, "group");
|
|
@@ -1636,7 +1667,7 @@ class st {
|
|
|
1636
1667
|
s(this, "hasSourceArrow");
|
|
1637
1668
|
s(this, "hasTargetArrow");
|
|
1638
1669
|
s(this, "pathShape");
|
|
1639
|
-
s(this, "createCyclePath", (e) => new
|
|
1670
|
+
s(this, "createCyclePath", (e) => new Z({
|
|
1640
1671
|
sourceDirection: e,
|
|
1641
1672
|
arrowLength: this.arrowLength,
|
|
1642
1673
|
side: this.cycleSquareSide,
|
|
@@ -1645,7 +1676,7 @@ class st {
|
|
|
1645
1676
|
hasSourceArrow: this.hasSourceArrow,
|
|
1646
1677
|
hasTargetArrow: this.hasTargetArrow
|
|
1647
1678
|
}));
|
|
1648
|
-
s(this, "createDetourPath", (e, t, o, i, n) => new
|
|
1679
|
+
s(this, "createDetourPath", (e, t, o, i, n) => new et({
|
|
1649
1680
|
to: o,
|
|
1650
1681
|
sourceDirection: e,
|
|
1651
1682
|
targetDirection: t,
|
|
@@ -1658,7 +1689,7 @@ class st {
|
|
|
1658
1689
|
hasSourceArrow: this.hasSourceArrow,
|
|
1659
1690
|
hasTargetArrow: this.hasTargetArrow
|
|
1660
1691
|
}));
|
|
1661
|
-
s(this, "createLinePath", (e, t, o, i, n) => new
|
|
1692
|
+
s(this, "createLinePath", (e, t, o, i, n) => new Je({
|
|
1662
1693
|
to: o,
|
|
1663
1694
|
sourceDirection: e,
|
|
1664
1695
|
targetDirection: t,
|
|
@@ -1691,10 +1722,10 @@ class st {
|
|
|
1691
1722
|
this.pathShape.render(e);
|
|
1692
1723
|
}
|
|
1693
1724
|
}
|
|
1694
|
-
class
|
|
1725
|
+
class Ne {
|
|
1695
1726
|
constructor(e) {
|
|
1696
1727
|
s(this, "svg");
|
|
1697
|
-
s(this, "group",
|
|
1728
|
+
s(this, "group", be());
|
|
1698
1729
|
s(this, "line");
|
|
1699
1730
|
s(this, "sourceArrow", null);
|
|
1700
1731
|
s(this, "targetArrow", null);
|
|
@@ -1706,15 +1737,15 @@ class Pe {
|
|
|
1706
1737
|
s(this, "onAfterRender");
|
|
1707
1738
|
s(this, "afterRenderEmitter");
|
|
1708
1739
|
s(this, "arrowRenderer");
|
|
1709
|
-
[this.afterRenderEmitter, this.onAfterRender] = E(), this.color = (e == null ? void 0 : e.color) ?? w.color, this.width = (e == null ? void 0 : e.width) ?? w.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? w.arrowLength, this.arrowRenderer = $((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? w.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? w.preOffset, this.svg =
|
|
1740
|
+
[this.afterRenderEmitter, this.onAfterRender] = E(), this.color = (e == null ? void 0 : e.color) ?? w.color, this.width = (e == null ? void 0 : e.width) ?? w.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? w.arrowLength, this.arrowRenderer = $((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? w.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? w.preOffset, this.svg = Se(this.color), this.svg.appendChild(this.group), this.line = Pe(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));
|
|
1710
1741
|
}
|
|
1711
1742
|
render(e) {
|
|
1712
|
-
const { x: t, y: o, width: i, height: n, flipX: a, flipY: h } =
|
|
1743
|
+
const { x: t, y: o, width: i, height: n, flipX: a, flipY: h } = xe(
|
|
1713
1744
|
e.from,
|
|
1714
1745
|
e.to
|
|
1715
1746
|
);
|
|
1716
|
-
|
|
1717
|
-
const d = { x: i, y: n }, c = new
|
|
1747
|
+
Te(this.svg, { x: t, y: o, width: i, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1748
|
+
const d = { x: i, y: n }, c = new _e({
|
|
1718
1749
|
to: d,
|
|
1719
1750
|
sourceOffset: this.sourceOffset,
|
|
1720
1751
|
targetOffset: this.targetOffset,
|
|
@@ -1765,40 +1796,40 @@ class Pe {
|
|
|
1765
1796
|
});
|
|
1766
1797
|
}
|
|
1767
1798
|
}
|
|
1768
|
-
const
|
|
1799
|
+
const ht = () => {
|
|
1769
1800
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1770
1801
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
1771
|
-
},
|
|
1802
|
+
}, dt = (r) => {
|
|
1772
1803
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1773
1804
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
1774
|
-
},
|
|
1805
|
+
}, le = (r) => {
|
|
1775
1806
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1776
1807
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
1777
1808
|
};
|
|
1778
|
-
class
|
|
1809
|
+
class ct extends Error {
|
|
1779
1810
|
constructor(e) {
|
|
1780
1811
|
super(e), this.name = "InteractiveEdgeError";
|
|
1781
1812
|
}
|
|
1782
1813
|
}
|
|
1783
|
-
class
|
|
1814
|
+
class De {
|
|
1784
1815
|
constructor(e, t) {
|
|
1785
1816
|
s(this, "svg");
|
|
1786
1817
|
s(this, "group");
|
|
1787
1818
|
s(this, "line");
|
|
1788
1819
|
s(this, "sourceArrow");
|
|
1789
1820
|
s(this, "targetArrow");
|
|
1790
|
-
s(this, "handle",
|
|
1821
|
+
s(this, "handle", ht());
|
|
1791
1822
|
s(this, "onAfterRender");
|
|
1792
1823
|
s(this, "interactiveLine");
|
|
1793
1824
|
s(this, "interactiveSourceArrow", null);
|
|
1794
1825
|
s(this, "interactiveTargetArrow", null);
|
|
1795
|
-
if (this.baseEdge = e, e instanceof
|
|
1796
|
-
throw new
|
|
1826
|
+
if (this.baseEdge = e, e instanceof De)
|
|
1827
|
+
throw new ct(
|
|
1797
1828
|
"interactive edge can be configured only once"
|
|
1798
1829
|
);
|
|
1799
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;
|
|
1800
1831
|
const o = (t == null ? void 0 : t.distance) ?? w.interactiveWidth;
|
|
1801
|
-
this.interactiveLine =
|
|
1832
|
+
this.interactiveLine = dt(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = le(o), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = le(o), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((i) => {
|
|
1802
1833
|
this.interactiveLine.setAttribute("d", i.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", i.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", i.targetArrowPath);
|
|
1803
1834
|
});
|
|
1804
1835
|
}
|
|
@@ -1806,7 +1837,7 @@ class be {
|
|
|
1806
1837
|
this.baseEdge.render(e);
|
|
1807
1838
|
}
|
|
1808
1839
|
}
|
|
1809
|
-
class
|
|
1840
|
+
class kt {
|
|
1810
1841
|
constructor(e, t) {
|
|
1811
1842
|
s(this, "group");
|
|
1812
1843
|
s(this, "line");
|
|
@@ -1823,7 +1854,7 @@ class Lt {
|
|
|
1823
1854
|
this.baseShape.render(e);
|
|
1824
1855
|
}
|
|
1825
1856
|
}
|
|
1826
|
-
class
|
|
1857
|
+
class Le {
|
|
1827
1858
|
constructor(e) {
|
|
1828
1859
|
s(this, "onAfterNodeAdded");
|
|
1829
1860
|
s(this, "onAfterNodeUpdated");
|
|
@@ -1916,7 +1947,7 @@ class Te {
|
|
|
1916
1947
|
return this.graphStore.getNode(e) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(e);
|
|
1917
1948
|
}
|
|
1918
1949
|
}
|
|
1919
|
-
class
|
|
1950
|
+
class Me {
|
|
1920
1951
|
constructor(e) {
|
|
1921
1952
|
s(this, "onAfterUpdated");
|
|
1922
1953
|
this.viewportStore = e, this.onAfterUpdated = this.viewportStore.onAfterUpdated;
|
|
@@ -1928,21 +1959,21 @@ class De {
|
|
|
1928
1959
|
return { ...this.viewportStore.getContentMatrix() };
|
|
1929
1960
|
}
|
|
1930
1961
|
}
|
|
1931
|
-
const
|
|
1932
|
-
const t = new
|
|
1962
|
+
const Re = (r, e) => {
|
|
1963
|
+
const t = new ve(), o = new Le(t), i = new Me(e), n = new ye(t, e, r), a = {
|
|
1933
1964
|
nodes: {
|
|
1934
|
-
centerFn:
|
|
1965
|
+
centerFn: Ae,
|
|
1935
1966
|
priorityFn: () => 0
|
|
1936
1967
|
},
|
|
1937
1968
|
edges: {
|
|
1938
|
-
shapeFactory: () => new
|
|
1969
|
+
shapeFactory: () => new Ne(),
|
|
1939
1970
|
priorityFn: () => 0
|
|
1940
1971
|
},
|
|
1941
1972
|
ports: {
|
|
1942
1973
|
direction: 0
|
|
1943
1974
|
}
|
|
1944
1975
|
};
|
|
1945
|
-
return new
|
|
1976
|
+
return new me(
|
|
1946
1977
|
o,
|
|
1947
1978
|
i,
|
|
1948
1979
|
t,
|
|
@@ -2058,7 +2089,7 @@ class k {
|
|
|
2058
2089
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2059
2090
|
}
|
|
2060
2091
|
}
|
|
2061
|
-
class
|
|
2092
|
+
class J {
|
|
2062
2093
|
constructor(e, t, o, i) {
|
|
2063
2094
|
s(this, "grabbedNode", null);
|
|
2064
2095
|
s(this, "maxNodePriority", 0);
|
|
@@ -2179,7 +2210,7 @@ class Z {
|
|
|
2179
2210
|
this.canvas = e, this.element = t, this.window = o, 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);
|
|
2180
2211
|
}
|
|
2181
2212
|
static configure(e, t, o, i) {
|
|
2182
|
-
new
|
|
2213
|
+
new J(e, t, o, i);
|
|
2183
2214
|
}
|
|
2184
2215
|
moveNode(e, t) {
|
|
2185
2216
|
if (this.graph.getNode(e.nodeId) === null)
|
|
@@ -2248,11 +2279,11 @@ class Z {
|
|
|
2248
2279
|
return e;
|
|
2249
2280
|
}
|
|
2250
2281
|
}
|
|
2251
|
-
const
|
|
2282
|
+
const gt = (r, e, t) => ({
|
|
2252
2283
|
scale: r.scale,
|
|
2253
2284
|
x: r.x + r.scale * e,
|
|
2254
2285
|
y: r.y + r.scale * t
|
|
2255
|
-
}),
|
|
2286
|
+
}), lt = (r, e, t, o) => ({
|
|
2256
2287
|
scale: r.scale * e,
|
|
2257
2288
|
x: r.scale * (1 - e) * t + r.x,
|
|
2258
2289
|
y: r.scale * (1 - e) * o + r.y
|
|
@@ -2375,7 +2406,7 @@ class z {
|
|
|
2375
2406
|
new z(e, t, o, i);
|
|
2376
2407
|
}
|
|
2377
2408
|
moveViewport(e, t) {
|
|
2378
|
-
const o = this.viewport.getViewportMatrix(), i =
|
|
2409
|
+
const o = this.viewport.getViewportMatrix(), i = gt(o, e, t), { width: n, height: a } = this.element.getBoundingClientRect(), h = this.params.transformPreprocessor({
|
|
2379
2410
|
prevTransform: o,
|
|
2380
2411
|
nextTransform: i,
|
|
2381
2412
|
canvasWidth: n,
|
|
@@ -2384,7 +2415,7 @@ class z {
|
|
|
2384
2415
|
this.performTransform(h);
|
|
2385
2416
|
}
|
|
2386
2417
|
scaleViewport(e, t, o) {
|
|
2387
|
-
const i = this.canvas.viewport.getViewportMatrix(), n =
|
|
2418
|
+
const i = this.canvas.viewport.getViewportMatrix(), n = lt(i, e, t, o), { width: a, height: h } = this.element.getBoundingClientRect(), d = this.params.transformPreprocessor({
|
|
2388
2419
|
prevTransform: i,
|
|
2389
2420
|
nextTransform: n,
|
|
2390
2421
|
canvasWidth: a,
|
|
@@ -2414,7 +2445,7 @@ class z {
|
|
|
2414
2445
|
this.transformInProgress = !1, this.params.onTransformFinished();
|
|
2415
2446
|
}
|
|
2416
2447
|
}
|
|
2417
|
-
class
|
|
2448
|
+
class Q {
|
|
2418
2449
|
constructor(e, t, o, i, n, a) {
|
|
2419
2450
|
s(this, "canvasResizeObserver");
|
|
2420
2451
|
s(this, "nodeHorizontal");
|
|
@@ -2473,7 +2504,7 @@ class J {
|
|
|
2473
2504
|
), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
|
|
2474
2505
|
}
|
|
2475
2506
|
static configure(e, t, o, i, n, a) {
|
|
2476
|
-
new
|
|
2507
|
+
new Q(
|
|
2477
2508
|
e,
|
|
2478
2509
|
t,
|
|
2479
2510
|
o,
|
|
@@ -2496,24 +2527,24 @@ class J {
|
|
|
2496
2527
|
this.trigger.emit({ x: o, y: i, width: n, height: a });
|
|
2497
2528
|
}
|
|
2498
2529
|
}
|
|
2499
|
-
const
|
|
2530
|
+
const ut = () => {
|
|
2500
2531
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2501
2532
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2502
|
-
},
|
|
2533
|
+
}, pt = () => {
|
|
2503
2534
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2504
2535
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
2505
|
-
},
|
|
2536
|
+
}, wt = () => {
|
|
2506
2537
|
const r = document.createElementNS(
|
|
2507
2538
|
"http://www.w3.org/2000/svg",
|
|
2508
2539
|
"pattern"
|
|
2509
2540
|
);
|
|
2510
2541
|
return r.setAttribute("id", "pattern"), r;
|
|
2511
2542
|
};
|
|
2512
|
-
class
|
|
2543
|
+
class _ {
|
|
2513
2544
|
constructor(e, t, o) {
|
|
2514
|
-
s(this, "svg",
|
|
2515
|
-
s(this, "patternRenderingRectangle",
|
|
2516
|
-
s(this, "pattern",
|
|
2545
|
+
s(this, "svg", ut());
|
|
2546
|
+
s(this, "patternRenderingRectangle", pt());
|
|
2547
|
+
s(this, "pattern", wt());
|
|
2517
2548
|
s(this, "patternContent");
|
|
2518
2549
|
s(this, "tileWidth");
|
|
2519
2550
|
s(this, "tileHeight");
|
|
@@ -2538,14 +2569,14 @@ class Q {
|
|
|
2538
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();
|
|
2539
2570
|
}
|
|
2540
2571
|
static configure(e, t, o) {
|
|
2541
|
-
new
|
|
2572
|
+
new _(e, t, o);
|
|
2542
2573
|
}
|
|
2543
2574
|
updateVisibility() {
|
|
2544
2575
|
const t = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
|
|
2545
2576
|
t && this.visible ? (this.visible = !1, this.backgroundHost.removeChild(this.svg)) : !t && !this.visible && (this.visible = !0, this.backgroundHost.appendChild(this.svg));
|
|
2546
2577
|
}
|
|
2547
2578
|
}
|
|
2548
|
-
class
|
|
2579
|
+
class q {
|
|
2549
2580
|
constructor(e, t, o, i, n) {
|
|
2550
2581
|
s(this, "overlayCanvas");
|
|
2551
2582
|
s(this, "staticPortId", null);
|
|
@@ -2553,7 +2584,7 @@ class _ {
|
|
|
2553
2584
|
s(this, "onEdgeCreated", (e) => {
|
|
2554
2585
|
this.params.onAfterEdgeCreated(e);
|
|
2555
2586
|
});
|
|
2556
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = i, this.params = n, this.overlayCanvas =
|
|
2587
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = i, this.params = n, this.overlayCanvas = Re(
|
|
2557
2588
|
this.overlayLayer,
|
|
2558
2589
|
this.viewportStore
|
|
2559
2590
|
), k.configure(
|
|
@@ -2580,7 +2611,7 @@ class _ {
|
|
|
2580
2611
|
);
|
|
2581
2612
|
}
|
|
2582
2613
|
static configure(e, t, o, i, n) {
|
|
2583
|
-
new
|
|
2614
|
+
new q(
|
|
2584
2615
|
e,
|
|
2585
2616
|
t,
|
|
2586
2617
|
o,
|
|
@@ -2618,7 +2649,7 @@ class _ {
|
|
|
2618
2649
|
this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
2619
2650
|
}
|
|
2620
2651
|
tryCreateConnection(e) {
|
|
2621
|
-
const t =
|
|
2652
|
+
const t = Ee(this.canvas.graph, e), o = this.staticPortId;
|
|
2622
2653
|
if (t === null) {
|
|
2623
2654
|
this.params.onEdgeCreationInterrupted({
|
|
2624
2655
|
staticPortId: o,
|
|
@@ -2640,7 +2671,7 @@ class _ {
|
|
|
2640
2671
|
});
|
|
2641
2672
|
}
|
|
2642
2673
|
}
|
|
2643
|
-
class
|
|
2674
|
+
class ee {
|
|
2644
2675
|
constructor(e, t, o, i, n) {
|
|
2645
2676
|
s(this, "overlayCanvas");
|
|
2646
2677
|
s(this, "staticPortId", null);
|
|
@@ -2649,7 +2680,7 @@ class q {
|
|
|
2649
2680
|
s(this, "onEdgeReattached", (e) => {
|
|
2650
2681
|
this.params.onAfterEdgeReattached(e);
|
|
2651
2682
|
});
|
|
2652
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = i, this.params = n, this.overlayCanvas =
|
|
2683
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = i, this.params = n, this.overlayCanvas = Re(
|
|
2653
2684
|
this.overlayLayer,
|
|
2654
2685
|
this.viewportStore
|
|
2655
2686
|
), k.configure(
|
|
@@ -2673,7 +2704,7 @@ class q {
|
|
|
2673
2704
|
);
|
|
2674
2705
|
}
|
|
2675
2706
|
static configure(e, t, o, i, n) {
|
|
2676
|
-
new
|
|
2707
|
+
new ee(
|
|
2677
2708
|
e,
|
|
2678
2709
|
t,
|
|
2679
2710
|
o,
|
|
@@ -2715,14 +2746,14 @@ class q {
|
|
|
2715
2746
|
overlayId: P.Dragging,
|
|
2716
2747
|
portCoords: v,
|
|
2717
2748
|
portDirection: d.direction
|
|
2718
|
-
}, [
|
|
2719
|
-
this.overlayCanvas.addNode(B(
|
|
2720
|
-
const
|
|
2749
|
+
}, [M, b] = this.isTargetDragging ? [x, A] : [A, x];
|
|
2750
|
+
this.overlayCanvas.addNode(B(M)), this.overlayCanvas.addNode(B(b));
|
|
2751
|
+
const N = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(P.Edge) : i.shape;
|
|
2721
2752
|
return this.overlayCanvas.addEdge({
|
|
2722
2753
|
id: P.Edge,
|
|
2723
|
-
from:
|
|
2754
|
+
from: M.overlayId,
|
|
2724
2755
|
to: b.overlayId,
|
|
2725
|
-
shape:
|
|
2756
|
+
shape: N
|
|
2726
2757
|
}), !0;
|
|
2727
2758
|
}
|
|
2728
2759
|
resetDragState() {
|
|
@@ -2739,7 +2770,7 @@ class q {
|
|
|
2739
2770
|
});
|
|
2740
2771
|
}
|
|
2741
2772
|
tryCreateConnection(e) {
|
|
2742
|
-
const t =
|
|
2773
|
+
const t = Ee(this.canvas.graph, e);
|
|
2743
2774
|
if (this.overlayCanvas.removeEdge(P.Edge), t === null) {
|
|
2744
2775
|
const d = this.draggingEdgePayload;
|
|
2745
2776
|
this.params.onEdgeReattachInterrupted({
|
|
@@ -2772,45 +2803,147 @@ class q {
|
|
|
2772
2803
|
}
|
|
2773
2804
|
}
|
|
2774
2805
|
}
|
|
2775
|
-
|
|
2806
|
+
class te {
|
|
2807
|
+
constructor(e, t, o) {
|
|
2808
|
+
this.canvas = e, this.layoutAlgorithm = t, this.trigger = o, this.trigger.subscribe(() => {
|
|
2809
|
+
this.applyLayout();
|
|
2810
|
+
});
|
|
2811
|
+
}
|
|
2812
|
+
static configure(e, t, o) {
|
|
2813
|
+
new te(
|
|
2814
|
+
e,
|
|
2815
|
+
t,
|
|
2816
|
+
o
|
|
2817
|
+
);
|
|
2818
|
+
}
|
|
2819
|
+
applyLayout() {
|
|
2820
|
+
this.layoutAlgorithm.calculateCoordinates(this.canvas.graph).forEach((t, o) => {
|
|
2821
|
+
this.canvas.updateNode(o, t);
|
|
2822
|
+
});
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
class re {
|
|
2826
|
+
constructor(e, t) {
|
|
2827
|
+
s(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 re(
|
|
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, o) => {
|
|
2851
|
+
this.canvas.updateNode(o, t);
|
|
2852
|
+
});
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
class ft {
|
|
2856
|
+
static configure(e, t) {
|
|
2857
|
+
const o = t.applyOn;
|
|
2858
|
+
switch (o.type) {
|
|
2859
|
+
case "manual": {
|
|
2860
|
+
te.configure(
|
|
2861
|
+
e,
|
|
2862
|
+
t.algorithm,
|
|
2863
|
+
o.trigger
|
|
2864
|
+
);
|
|
2865
|
+
break;
|
|
2866
|
+
}
|
|
2867
|
+
case "topologyChangeTimeout": {
|
|
2868
|
+
re.configure(
|
|
2869
|
+
e,
|
|
2870
|
+
t.algorithm
|
|
2871
|
+
);
|
|
2872
|
+
break;
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
}
|
|
2877
|
+
class yt {
|
|
2878
|
+
constructor(e, t) {
|
|
2879
|
+
s(this, "previousTimeStamp");
|
|
2880
|
+
s(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, o, i) {
|
|
2894
|
+
s(this, "step", (e) => {
|
|
2895
|
+
this.params.algorithm.calculateNextCoordinates(
|
|
2896
|
+
this.canvas.graph,
|
|
2897
|
+
e
|
|
2898
|
+
).forEach((o, i) => {
|
|
2899
|
+
this.staticNodes.has(i) || this.canvas.updateNode(i, { x: o.x, y: o.y });
|
|
2900
|
+
});
|
|
2901
|
+
});
|
|
2902
|
+
this.canvas = e, this.params = t, this.staticNodes = o, this.win = i, new yt(this.win, this.step);
|
|
2903
|
+
}
|
|
2904
|
+
static configure(e, t, o, i) {
|
|
2905
|
+
new oe(e, t, o, i);
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
const mt = () => {
|
|
2776
2909
|
const r = document.createElement("div");
|
|
2777
2910
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
2778
2911
|
}, Y = () => {
|
|
2779
2912
|
const r = document.createElement("div");
|
|
2780
2913
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2781
|
-
},
|
|
2914
|
+
}, ue = () => {
|
|
2782
2915
|
const r = Y();
|
|
2783
2916
|
return r.style.pointerEvents = "none", r;
|
|
2784
2917
|
};
|
|
2785
|
-
class
|
|
2918
|
+
class vt {
|
|
2786
2919
|
constructor(e) {
|
|
2787
2920
|
s(this, "background", Y());
|
|
2788
2921
|
s(this, "main", Y());
|
|
2789
|
-
s(this, "overlayConnectablePorts",
|
|
2790
|
-
s(this, "overlayDraggableEdges",
|
|
2791
|
-
s(this, "host",
|
|
2922
|
+
s(this, "overlayConnectablePorts", ue());
|
|
2923
|
+
s(this, "overlayDraggableEdges", ue());
|
|
2924
|
+
s(this, "host", mt());
|
|
2792
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);
|
|
2793
2926
|
}
|
|
2794
2927
|
destroy() {
|
|
2795
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);
|
|
2796
2929
|
}
|
|
2797
2930
|
}
|
|
2798
|
-
const H = (r) => () => r,
|
|
2931
|
+
const H = (r) => () => r, pe = H(0), Et = () => {
|
|
2799
2932
|
let r = 0;
|
|
2800
2933
|
return () => r++;
|
|
2801
|
-
},
|
|
2802
|
-
let t =
|
|
2803
|
-
const i =
|
|
2934
|
+
}, At = (r, e) => {
|
|
2935
|
+
let t = pe, o = pe;
|
|
2936
|
+
const i = Et();
|
|
2804
2937
|
return r === "incremental" && (t = i), e === "incremental" && (o = i), typeof r == "number" && (t = H(r)), typeof e == "number" && (o = H(e)), typeof r == "function" && (t = r), typeof e == "function" && (o = e), {
|
|
2805
2938
|
nodesPriorityFn: t,
|
|
2806
2939
|
edgesPriorityFn: o
|
|
2807
2940
|
};
|
|
2808
|
-
},
|
|
2941
|
+
}, se = (r) => {
|
|
2809
2942
|
if (typeof r == "function")
|
|
2810
2943
|
return r;
|
|
2811
2944
|
switch (r.type) {
|
|
2812
2945
|
case "straight":
|
|
2813
|
-
return () => new
|
|
2946
|
+
return () => new nt({
|
|
2814
2947
|
color: r.color,
|
|
2815
2948
|
width: r.width,
|
|
2816
2949
|
arrowLength: r.arrowLength,
|
|
@@ -2824,7 +2957,7 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
2824
2957
|
detourDirection: r.detourDirection
|
|
2825
2958
|
});
|
|
2826
2959
|
case "horizontal":
|
|
2827
|
-
return () => new
|
|
2960
|
+
return () => new it({
|
|
2828
2961
|
color: r.color,
|
|
2829
2962
|
width: r.width,
|
|
2830
2963
|
arrowLength: r.arrowLength,
|
|
@@ -2837,7 +2970,7 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
2837
2970
|
detourDistance: r.detourDistance
|
|
2838
2971
|
});
|
|
2839
2972
|
case "vertical":
|
|
2840
|
-
return () => new
|
|
2973
|
+
return () => new at({
|
|
2841
2974
|
color: r.color,
|
|
2842
2975
|
width: r.width,
|
|
2843
2976
|
arrowLength: r.arrowLength,
|
|
@@ -2850,7 +2983,7 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
2850
2983
|
detourDistance: r.detourDistance
|
|
2851
2984
|
});
|
|
2852
2985
|
case "direct":
|
|
2853
|
-
return () => new
|
|
2986
|
+
return () => new Ne({
|
|
2854
2987
|
color: r.color,
|
|
2855
2988
|
width: r.width,
|
|
2856
2989
|
arrowLength: r.arrowLength,
|
|
@@ -2861,7 +2994,7 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
2861
2994
|
targetOffset: r.targetOffset
|
|
2862
2995
|
});
|
|
2863
2996
|
default:
|
|
2864
|
-
return () => new
|
|
2997
|
+
return () => new st({
|
|
2865
2998
|
color: r.color,
|
|
2866
2999
|
width: r.width,
|
|
2867
3000
|
arrowLength: r.arrowLength,
|
|
@@ -2875,26 +3008,26 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
2875
3008
|
detourDirection: r.detourDirection
|
|
2876
3009
|
});
|
|
2877
3010
|
}
|
|
2878
|
-
},
|
|
3011
|
+
}, xt = (r) => {
|
|
2879
3012
|
var t, o, i, n, a;
|
|
2880
|
-
const e =
|
|
3013
|
+
const e = At(
|
|
2881
3014
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
2882
3015
|
(o = r.edges) == null ? void 0 : o.priority
|
|
2883
3016
|
);
|
|
2884
3017
|
return {
|
|
2885
3018
|
nodes: {
|
|
2886
|
-
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ??
|
|
3019
|
+
centerFn: ((i = r.nodes) == null ? void 0 : i.centerFn) ?? Ae,
|
|
2887
3020
|
priorityFn: e.nodesPriorityFn
|
|
2888
3021
|
},
|
|
2889
3022
|
ports: {
|
|
2890
3023
|
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
2891
3024
|
},
|
|
2892
3025
|
edges: {
|
|
2893
|
-
shapeFactory:
|
|
3026
|
+
shapeFactory: se(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
|
|
2894
3027
|
priorityFn: e.edgesPriorityFn
|
|
2895
3028
|
}
|
|
2896
3029
|
};
|
|
2897
|
-
},
|
|
3030
|
+
}, St = (r) => {
|
|
2898
3031
|
var p, f, y, v, x;
|
|
2899
3032
|
const e = ((p = r.events) == null ? void 0 : p.onNodeDrag) ?? (() => {
|
|
2900
3033
|
}), t = r.nodeDragVerifier ?? (() => !0), o = ((f = r.events) == null ? void 0 : f.onNodeDragFinished) ?? (() => {
|
|
@@ -2910,7 +3043,7 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
2910
3043
|
nodeDragVerifier: t,
|
|
2911
3044
|
onNodeDragFinished: o
|
|
2912
3045
|
};
|
|
2913
|
-
},
|
|
3046
|
+
}, Pt = (r) => {
|
|
2914
3047
|
const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, o = r.minY !== null ? r.minY : -1 / 0, i = r.maxY !== null ? r.maxY : 1 / 0;
|
|
2915
3048
|
return (n) => {
|
|
2916
3049
|
let a = n.nextTransform.x, h = n.nextTransform.y;
|
|
@@ -2920,7 +3053,7 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
2920
3053
|
const l = n.canvasHeight * n.prevTransform.scale, g = i - l;
|
|
2921
3054
|
return h > g && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, g)), { scale: n.nextTransform.scale, x: a, y: h };
|
|
2922
3055
|
};
|
|
2923
|
-
},
|
|
3056
|
+
}, bt = (r) => {
|
|
2924
3057
|
const e = r.maxContentScale, t = r.minContentScale, o = e !== null ? 1 / e : 0, i = t !== null ? 1 / t : 1 / 0;
|
|
2925
3058
|
return (n) => {
|
|
2926
3059
|
const a = n.prevTransform, h = n.nextTransform;
|
|
@@ -2941,7 +3074,7 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
2941
3074
|
y: l
|
|
2942
3075
|
};
|
|
2943
3076
|
};
|
|
2944
|
-
},
|
|
3077
|
+
}, Tt = (r) => (e) => r.reduce(
|
|
2945
3078
|
(t, o) => o({
|
|
2946
3079
|
prevTransform: e.prevTransform,
|
|
2947
3080
|
nextTransform: t,
|
|
@@ -2949,40 +3082,40 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
2949
3082
|
canvasHeight: e.canvasHeight
|
|
2950
3083
|
}),
|
|
2951
3084
|
e.nextTransform
|
|
2952
|
-
),
|
|
3085
|
+
), we = (r) => {
|
|
2953
3086
|
if (typeof r == "function")
|
|
2954
3087
|
return r;
|
|
2955
3088
|
switch (r.type) {
|
|
2956
3089
|
case "scale-limit":
|
|
2957
|
-
return
|
|
3090
|
+
return bt({
|
|
2958
3091
|
minContentScale: r.minContentScale ?? 0,
|
|
2959
3092
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
2960
3093
|
});
|
|
2961
3094
|
case "shift-limit":
|
|
2962
|
-
return
|
|
3095
|
+
return Pt({
|
|
2963
3096
|
minX: r.minX ?? -1 / 0,
|
|
2964
3097
|
maxX: r.maxX ?? 1 / 0,
|
|
2965
3098
|
minY: r.minY ?? -1 / 0,
|
|
2966
3099
|
maxY: r.maxY ?? 1 / 0
|
|
2967
3100
|
});
|
|
2968
3101
|
}
|
|
2969
|
-
},
|
|
2970
|
-
var y, v, x, A,
|
|
3102
|
+
}, fe = (r) => {
|
|
3103
|
+
var y, v, x, A, M, b, N, V, ie, ne, ae, he;
|
|
2971
3104
|
const e = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, o = r == null ? void 0 : r.transformPreprocessor;
|
|
2972
3105
|
let i;
|
|
2973
|
-
o !== void 0 ? Array.isArray(o) ? i =
|
|
3106
|
+
o !== void 0 ? Array.isArray(o) ? i = Tt(
|
|
2974
3107
|
o.map(
|
|
2975
|
-
(
|
|
3108
|
+
(D) => we(D)
|
|
2976
3109
|
)
|
|
2977
|
-
) : i =
|
|
3110
|
+
) : i = we(o) : i = (D) => D.nextTransform;
|
|
2978
3111
|
const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onBeforeTransformChange) ?? (() => {
|
|
2979
3112
|
}), h = ((A = r == null ? void 0 : r.events) == null ? void 0 : A.onTransformChange) ?? (() => {
|
|
2980
|
-
}), d = (
|
|
3113
|
+
}), d = (M = r == null ? void 0 : r.shift) == null ? void 0 : M.mouseDownEventVerifier, c = d !== void 0 ? d : (D) => D.button === 0, l = (b = r == null ? void 0 : r.shift) == null ? void 0 : b.mouseUpEventVerifier, g = l !== void 0 ? l : (D) => D.button === 0, p = (N = r == null ? void 0 : r.scale) == null ? void 0 : N.mouseWheelEventVerifier, f = p !== void 0 ? p : () => !0;
|
|
2981
3114
|
return {
|
|
2982
3115
|
wheelSensitivity: t,
|
|
2983
3116
|
onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
|
|
2984
3117
|
}),
|
|
2985
|
-
onTransformFinished: ((
|
|
3118
|
+
onTransformFinished: ((ie = r == null ? void 0 : r.events) == null ? void 0 : ie.onTransformFinished) ?? (() => {
|
|
2986
3119
|
}),
|
|
2987
3120
|
onBeforeTransformChange: a,
|
|
2988
3121
|
onTransformChange: h,
|
|
@@ -2991,30 +3124,30 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
2991
3124
|
mouseDownEventVerifier: c,
|
|
2992
3125
|
mouseUpEventVerifier: g,
|
|
2993
3126
|
mouseWheelEventVerifier: f,
|
|
2994
|
-
scaleWheelFinishTimeout: ((
|
|
2995
|
-
onResizeTransformStarted: ((
|
|
3127
|
+
scaleWheelFinishTimeout: ((ne = r == null ? void 0 : r.scale) == null ? void 0 : ne.wheelFinishTimeout) ?? 500,
|
|
3128
|
+
onResizeTransformStarted: ((ae = r == null ? void 0 : r.events) == null ? void 0 : ae.onResizeTransformStarted) ?? (() => {
|
|
2996
3129
|
}),
|
|
2997
|
-
onResizeTransformFinished: ((
|
|
3130
|
+
onResizeTransformFinished: ((he = r == null ? void 0 : r.events) == null ? void 0 : he.onResizeTransformFinished) ?? (() => {
|
|
2998
3131
|
})
|
|
2999
3132
|
};
|
|
3000
|
-
},
|
|
3133
|
+
}, Nt = (r, e) => {
|
|
3001
3134
|
const t = document.createElementNS(
|
|
3002
3135
|
"http://www.w3.org/2000/svg",
|
|
3003
3136
|
"circle"
|
|
3004
3137
|
);
|
|
3005
3138
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
3006
|
-
},
|
|
3139
|
+
}, Dt = (r) => r instanceof SVGElement ? r : Nt(
|
|
3007
3140
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
3008
3141
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
3009
|
-
),
|
|
3010
|
-
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, i =
|
|
3142
|
+
), Lt = (r) => {
|
|
3143
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, i = Dt(r.renderer ?? {});
|
|
3011
3144
|
return {
|
|
3012
3145
|
tileWidth: t,
|
|
3013
3146
|
tileHeight: o,
|
|
3014
3147
|
renderer: i,
|
|
3015
3148
|
maxViewportScale: r.maxViewportScale ?? 10
|
|
3016
3149
|
};
|
|
3017
|
-
},
|
|
3150
|
+
}, Mt = (r, e, t) => {
|
|
3018
3151
|
var c, l, g;
|
|
3019
3152
|
const o = () => "direct", i = (p) => p, n = (p) => p.button === 0, a = () => {
|
|
3020
3153
|
}, h = () => {
|
|
@@ -3029,9 +3162,9 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
3029
3162
|
onEdgeCreationInterrupted: ((l = r.events) == null ? void 0 : l.onEdgeCreationInterrupted) ?? d,
|
|
3030
3163
|
onEdgeCreationPrevented: ((g = r.events) == null ? void 0 : g.onEdgeCreationPrevented) ?? h,
|
|
3031
3164
|
dragPortDirection: r.dragPortDirection ?? t,
|
|
3032
|
-
edgeShapeFactory: r.edgeShape !== void 0 ?
|
|
3165
|
+
edgeShapeFactory: r.edgeShape !== void 0 ? se(r.edgeShape) : e
|
|
3033
3166
|
};
|
|
3034
|
-
},
|
|
3167
|
+
}, Rt = (r, e) => {
|
|
3035
3168
|
var c, l, g;
|
|
3036
3169
|
const t = (p) => p, o = (p) => p.button === 0 && p.ctrlKey, i = (p) => p.button === 0, n = (p) => {
|
|
3037
3170
|
const f = e.getPortAdjacentEdgeIds(p);
|
|
@@ -3045,15 +3178,15 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
3045
3178
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? o,
|
|
3046
3179
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? i,
|
|
3047
3180
|
draggingEdgeResolver: r.draggingEdgeResolver ?? n,
|
|
3048
|
-
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ?
|
|
3181
|
+
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? se(r.draggingEdgeShape) : null,
|
|
3049
3182
|
onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
|
|
3050
3183
|
onEdgeReattachInterrupted: ((l = r.events) == null ? void 0 : l.onEdgeReattachInterrupted) ?? d,
|
|
3051
3184
|
onEdgeReattachPrevented: ((g = r.events) == null ? void 0 : g.onEdgeReattachPrevented) ?? h
|
|
3052
3185
|
};
|
|
3053
|
-
},
|
|
3186
|
+
}, Ct = (r) => ({
|
|
3054
3187
|
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
3055
3188
|
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
3056
|
-
}),
|
|
3189
|
+
}), Vt = (r) => {
|
|
3057
3190
|
var e, t;
|
|
3058
3191
|
return {
|
|
3059
3192
|
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
|
|
@@ -3062,13 +3195,36 @@ const H = (r) => () => r, ce = H(0), wt = () => {
|
|
|
3062
3195
|
})
|
|
3063
3196
|
};
|
|
3064
3197
|
};
|
|
3065
|
-
class
|
|
3198
|
+
class $t extends Error {
|
|
3066
3199
|
constructor() {
|
|
3067
3200
|
super(...arguments);
|
|
3068
3201
|
s(this, "name", "CanvasBuilderError");
|
|
3069
3202
|
}
|
|
3070
3203
|
}
|
|
3071
|
-
|
|
3204
|
+
const Ut = (r) => ({
|
|
3205
|
+
algorithm: r.algorithm
|
|
3206
|
+
}), It = (r) => r instanceof j ? {
|
|
3207
|
+
type: "manual",
|
|
3208
|
+
trigger: r
|
|
3209
|
+
} : {
|
|
3210
|
+
type: "topologyChangeTimeout"
|
|
3211
|
+
}, Bt = (r) => ({
|
|
3212
|
+
algorithm: r.algorithm,
|
|
3213
|
+
applyOn: It(r.applyOn)
|
|
3214
|
+
}), Ot = (r, e) => ({
|
|
3215
|
+
...r,
|
|
3216
|
+
nodeDragVerifier: (t) => (e.add(t), r.nodeDragVerifier(t)),
|
|
3217
|
+
onNodeDragFinished: (t) => {
|
|
3218
|
+
e.delete(t), r.onNodeDragFinished(t);
|
|
3219
|
+
}
|
|
3220
|
+
}), Ft = (r, e) => {
|
|
3221
|
+
r.onBeforeNodeRemoved.subscribe((t) => {
|
|
3222
|
+
e.delete(t);
|
|
3223
|
+
}), r.onBeforeClear.subscribe(() => {
|
|
3224
|
+
e.clear();
|
|
3225
|
+
});
|
|
3226
|
+
};
|
|
3227
|
+
class zt {
|
|
3072
3228
|
constructor(e) {
|
|
3073
3229
|
s(this, "used", !1);
|
|
3074
3230
|
s(this, "canvasDefaults", {});
|
|
@@ -3078,18 +3234,21 @@ class Ct {
|
|
|
3078
3234
|
s(this, "connectablePortsConfig", {});
|
|
3079
3235
|
s(this, "draggableEdgesConfig", {});
|
|
3080
3236
|
s(this, "virtualScrollConfig");
|
|
3081
|
-
s(this, "
|
|
3237
|
+
s(this, "layoutConfig");
|
|
3238
|
+
s(this, "animatedLayoutConfig");
|
|
3239
|
+
s(this, "hasDraggableNodes", !1);
|
|
3082
3240
|
s(this, "hasTransformableViewport", !1);
|
|
3083
3241
|
s(this, "hasNodeResizeReactiveEdges", !1);
|
|
3084
3242
|
s(this, "hasBackground", !1);
|
|
3085
3243
|
s(this, "hasUserConnectablePorts", !1);
|
|
3086
3244
|
s(this, "hasUserDraggableEdges", !1);
|
|
3087
|
-
s(this, "boxRenderingTrigger", new
|
|
3088
|
-
s(this, "graphStore", new
|
|
3089
|
-
s(this, "viewportStore", new
|
|
3090
|
-
s(this, "graph", new
|
|
3091
|
-
s(this, "viewport", new
|
|
3245
|
+
s(this, "boxRenderingTrigger", new j());
|
|
3246
|
+
s(this, "graphStore", new ve());
|
|
3247
|
+
s(this, "viewportStore", new ke());
|
|
3248
|
+
s(this, "graph", new Le(this.graphStore));
|
|
3249
|
+
s(this, "viewport", new Me(this.viewportStore));
|
|
3092
3250
|
s(this, "window", window);
|
|
3251
|
+
s(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
3093
3252
|
this.element = e;
|
|
3094
3253
|
}
|
|
3095
3254
|
/**
|
|
@@ -3102,7 +3261,7 @@ class Ct {
|
|
|
3102
3261
|
* enables nodes draggable by user
|
|
3103
3262
|
*/
|
|
3104
3263
|
enableUserDraggableNodes(e) {
|
|
3105
|
-
return this.
|
|
3264
|
+
return this.hasDraggableNodes = !0, this.dragConfig = e ?? {}, this;
|
|
3106
3265
|
}
|
|
3107
3266
|
/**
|
|
3108
3267
|
* enables viewport transformable by user
|
|
@@ -3135,29 +3294,44 @@ class Ct {
|
|
|
3135
3294
|
enableUserConnectablePorts(e) {
|
|
3136
3295
|
return this.hasUserConnectablePorts = !0, this.connectablePortsConfig = e ?? {}, this;
|
|
3137
3296
|
}
|
|
3297
|
+
/**
|
|
3298
|
+
* enables edges dragging by dragging one of the adjacent ports
|
|
3299
|
+
*/
|
|
3138
3300
|
enableUserDraggableEdges(e) {
|
|
3139
3301
|
return this.hasUserDraggableEdges = !0, this.draggableEdgesConfig = e ?? {}, this;
|
|
3140
3302
|
}
|
|
3303
|
+
/**
|
|
3304
|
+
* enables nodes positioning with specified layout
|
|
3305
|
+
*/
|
|
3306
|
+
enableLayout(e) {
|
|
3307
|
+
return this.layoutConfig = e, this.animatedLayoutConfig = void 0, this;
|
|
3308
|
+
}
|
|
3309
|
+
/**
|
|
3310
|
+
* enables animated nodes positioning with specified layout
|
|
3311
|
+
*/
|
|
3312
|
+
enableAnimatedLayout(e) {
|
|
3313
|
+
return this.animatedLayoutConfig = e, this.layoutConfig = void 0, this;
|
|
3314
|
+
}
|
|
3141
3315
|
/**
|
|
3142
3316
|
* builds final canvas
|
|
3143
3317
|
*/
|
|
3144
3318
|
build() {
|
|
3145
3319
|
if (this.used)
|
|
3146
|
-
throw new
|
|
3320
|
+
throw new $t("CanvasBuilder is a single use object");
|
|
3147
3321
|
this.used = !0;
|
|
3148
|
-
const e = new
|
|
3149
|
-
let t = new
|
|
3322
|
+
const e = new vt(this.element);
|
|
3323
|
+
let t = new ye(
|
|
3150
3324
|
this.graphStore,
|
|
3151
3325
|
this.viewportStore,
|
|
3152
3326
|
e.main
|
|
3153
3327
|
);
|
|
3154
|
-
this.virtualScrollConfig !== void 0 && (t = new
|
|
3328
|
+
this.virtualScrollConfig !== void 0 && (t = new Oe(
|
|
3155
3329
|
t,
|
|
3156
3330
|
this.graphStore,
|
|
3157
3331
|
this.boxRenderingTrigger,
|
|
3158
|
-
|
|
3159
|
-
)), t = new
|
|
3160
|
-
const o =
|
|
3332
|
+
Vt(this.virtualScrollConfig)
|
|
3333
|
+
)), t = new Fe(t, this.graphStore);
|
|
3334
|
+
const o = xt(this.canvasDefaults), i = new me(
|
|
3161
3335
|
this.graph,
|
|
3162
3336
|
this.viewport,
|
|
3163
3337
|
this.graphStore,
|
|
@@ -3165,22 +3339,29 @@ class Ct {
|
|
|
3165
3339
|
t,
|
|
3166
3340
|
o
|
|
3167
3341
|
);
|
|
3168
|
-
if (this.hasBackground &&
|
|
3342
|
+
if (this.hasBackground && _.configure(
|
|
3169
3343
|
i,
|
|
3170
|
-
|
|
3344
|
+
Lt(this.backgroundConfig),
|
|
3171
3345
|
e.background
|
|
3172
|
-
), this.hasNodeResizeReactiveEdges &&
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3346
|
+
), this.hasNodeResizeReactiveEdges && G.configure(i), this.hasDraggableNodes) {
|
|
3347
|
+
let a = St(this.dragConfig);
|
|
3348
|
+
this.animatedLayoutConfig !== void 0 && (a = Ot(
|
|
3349
|
+
a,
|
|
3350
|
+
this.animationStaticNodes
|
|
3351
|
+
)), J.configure(
|
|
3352
|
+
i,
|
|
3353
|
+
e.main,
|
|
3354
|
+
this.window,
|
|
3355
|
+
a
|
|
3356
|
+
);
|
|
3357
|
+
}
|
|
3358
|
+
if (this.hasUserConnectablePorts) {
|
|
3359
|
+
const a = Mt(
|
|
3179
3360
|
this.connectablePortsConfig,
|
|
3180
3361
|
o.edges.shapeFactory,
|
|
3181
3362
|
o.ports.direction
|
|
3182
3363
|
);
|
|
3183
|
-
|
|
3364
|
+
q.configure(
|
|
3184
3365
|
i,
|
|
3185
3366
|
e.overlayConnectablePorts,
|
|
3186
3367
|
this.viewportStore,
|
|
@@ -3189,11 +3370,11 @@ class Ct {
|
|
|
3189
3370
|
);
|
|
3190
3371
|
}
|
|
3191
3372
|
if (this.hasUserDraggableEdges) {
|
|
3192
|
-
const a =
|
|
3373
|
+
const a = Rt(
|
|
3193
3374
|
this.draggableEdgesConfig,
|
|
3194
3375
|
i.graph
|
|
3195
3376
|
);
|
|
3196
|
-
|
|
3377
|
+
ee.configure(
|
|
3197
3378
|
i,
|
|
3198
3379
|
e.overlayDraggableEdges,
|
|
3199
3380
|
this.viewportStore,
|
|
@@ -3201,19 +3382,30 @@ class Ct {
|
|
|
3201
3382
|
a
|
|
3202
3383
|
);
|
|
3203
3384
|
}
|
|
3204
|
-
this.virtualScrollConfig !== void 0 ?
|
|
3385
|
+
this.virtualScrollConfig !== void 0 ? Q.configure(
|
|
3205
3386
|
i,
|
|
3206
3387
|
e.main,
|
|
3207
3388
|
this.window,
|
|
3208
|
-
|
|
3389
|
+
fe(this.transformConfig),
|
|
3209
3390
|
this.boxRenderingTrigger,
|
|
3210
|
-
|
|
3391
|
+
Ct(this.virtualScrollConfig)
|
|
3211
3392
|
) : this.hasTransformableViewport && z.configure(
|
|
3212
3393
|
i,
|
|
3213
3394
|
e.main,
|
|
3214
3395
|
this.window,
|
|
3215
|
-
|
|
3216
|
-
)
|
|
3396
|
+
fe(this.transformConfig)
|
|
3397
|
+
), this.layoutConfig !== void 0 && ft.configure(
|
|
3398
|
+
i,
|
|
3399
|
+
Bt(this.layoutConfig)
|
|
3400
|
+
), this.animatedLayoutConfig !== void 0 && (Ft(
|
|
3401
|
+
i.graph,
|
|
3402
|
+
this.animationStaticNodes
|
|
3403
|
+
), oe.configure(
|
|
3404
|
+
i,
|
|
3405
|
+
Ut(this.animatedLayoutConfig),
|
|
3406
|
+
this.animationStaticNodes,
|
|
3407
|
+
this.window
|
|
3408
|
+
));
|
|
3217
3409
|
const n = () => {
|
|
3218
3410
|
e.destroy(), i.onBeforeDestroy.unsubscribe(n);
|
|
3219
3411
|
};
|
|
@@ -3221,15 +3413,16 @@ class Ct {
|
|
|
3221
3413
|
}
|
|
3222
3414
|
}
|
|
3223
3415
|
export {
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3416
|
+
st as BezierEdgeShape,
|
|
3417
|
+
zt as CanvasBuilder,
|
|
3418
|
+
$t as CanvasBuilderError,
|
|
3227
3419
|
S as CanvasError,
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3420
|
+
Ne as DirectEdgeShape,
|
|
3421
|
+
j as EventSubject,
|
|
3422
|
+
it as HorizontalEdgeShape,
|
|
3423
|
+
ct as InteractiveEdgeError,
|
|
3424
|
+
De as InteractiveEdgeShape,
|
|
3425
|
+
kt as MidpointEdgeShape,
|
|
3426
|
+
nt as StraightEdgeShape,
|
|
3427
|
+
at as VerticalEdgeShape
|
|
3235
3428
|
};
|