@html-graph/html-graph 8.15.1 → 8.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/html-graph.d.ts +13 -0
- package/dist/html-graph.js +299 -256
- package/dist/html-graph.min.js +654 -613
- package/dist/html-graph.min.umd.cjs +1 -1
- package/dist/html-graph.umd.cjs +299 -256
- package/package.json +1 -1
package/dist/html-graph.min.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (r, e, t) =>
|
|
4
|
-
var
|
|
5
|
-
const
|
|
1
|
+
var qe = Object.defineProperty;
|
|
2
|
+
var et = (r, e, t) => e in r ? qe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var i = (r, e, t) => et(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
var V = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(V || {});
|
|
5
|
+
const tt = () => {
|
|
6
6
|
const r = document.createElement("div");
|
|
7
7
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
|
|
8
|
-
},
|
|
8
|
+
}, rt = () => {
|
|
9
9
|
const r = document.createElement("div");
|
|
10
10
|
return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
|
|
11
|
-
},
|
|
11
|
+
}, ot = (r) => {
|
|
12
12
|
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
13
|
-
},
|
|
13
|
+
}, st = (r) => {
|
|
14
14
|
r.style.removeProperty("position"), r.style.removeProperty("top"), r.style.removeProperty("left"), r.style.removeProperty("visibility"), r.style.removeProperty("transform");
|
|
15
15
|
};
|
|
16
|
-
class
|
|
16
|
+
class Ce {
|
|
17
17
|
constructor(e, t, o) {
|
|
18
|
-
i(this, "host",
|
|
19
|
-
i(this, "container",
|
|
18
|
+
i(this, "host", tt());
|
|
19
|
+
i(this, "container", rt());
|
|
20
20
|
i(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
|
|
21
21
|
i(this, "attachedNodeIds", /* @__PURE__ */ new Set());
|
|
22
22
|
i(this, "applyTransform", () => {
|
|
@@ -27,11 +27,11 @@ class Ne {
|
|
|
27
27
|
}
|
|
28
28
|
attachNode(e) {
|
|
29
29
|
const t = this.graphStore.getNode(e);
|
|
30
|
-
|
|
30
|
+
ot(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
|
|
31
31
|
}
|
|
32
32
|
detachNode(e) {
|
|
33
33
|
const t = this.graphStore.getNode(e);
|
|
34
|
-
|
|
34
|
+
st(t.element), this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
|
|
35
35
|
}
|
|
36
36
|
attachEdge(e) {
|
|
37
37
|
const t = this.graphStore.getEdge(e).payload.shape.svg;
|
|
@@ -72,8 +72,8 @@ class Ne {
|
|
|
72
72
|
h,
|
|
73
73
|
d
|
|
74
74
|
), u = this.createEdgeRenderPort(s, a, h, d);
|
|
75
|
-
let g =
|
|
76
|
-
o.element === s.element ? g =
|
|
75
|
+
let g = V.Line;
|
|
76
|
+
o.element === s.element ? g = V.PortCycle : o.nodeId === s.nodeId && (g = V.NodeCycle), t.payload.shape.render({ from: c, to: u, category: g });
|
|
77
77
|
}
|
|
78
78
|
updateEdgePriority(e) {
|
|
79
79
|
const t = this.graphStore.getEdge(e);
|
|
@@ -93,7 +93,7 @@ class Ne {
|
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
class
|
|
96
|
+
class it {
|
|
97
97
|
constructor(e) {
|
|
98
98
|
i(this, "xFrom", 1 / 0);
|
|
99
99
|
i(this, "yFrom", 1 / 0);
|
|
@@ -113,7 +113,7 @@ class rt {
|
|
|
113
113
|
return h <= this.xTo && d >= this.xFrom && c <= this.yTo && u >= this.yFrom;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
class
|
|
116
|
+
class nt {
|
|
117
117
|
constructor(e, t, o, s) {
|
|
118
118
|
i(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
119
119
|
i(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
@@ -137,7 +137,7 @@ class ot {
|
|
|
137
137
|
this.handleAttachEdge(a);
|
|
138
138
|
});
|
|
139
139
|
});
|
|
140
|
-
this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new
|
|
140
|
+
this.htmlView = e, this.graphStore = t, this.trigger = o, this.params = s, this.renderingBox = new it(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
141
141
|
}
|
|
142
142
|
attachNode(e) {
|
|
143
143
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -191,7 +191,7 @@ class ot {
|
|
|
191
191
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
class
|
|
194
|
+
class at {
|
|
195
195
|
constructor(e, t) {
|
|
196
196
|
i(this, "deferredNodes", /* @__PURE__ */ new Set());
|
|
197
197
|
i(this, "deferredEdges", /* @__PURE__ */ new Set());
|
|
@@ -265,7 +265,7 @@ const P = () => {
|
|
|
265
265
|
const r = new _();
|
|
266
266
|
return [r, r];
|
|
267
267
|
};
|
|
268
|
-
class
|
|
268
|
+
class Te {
|
|
269
269
|
constructor(e, t, o, s) {
|
|
270
270
|
i(this, "beforeDestroyEmitter");
|
|
271
271
|
i(this, "destroyed", !1);
|
|
@@ -318,7 +318,7 @@ class be {
|
|
|
318
318
|
this.destroyed || (this.destroyed = !0, this.beforeDestroyEmitter.emit(), this.graphController.destroy(), this.viewportController.destroy());
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
class
|
|
321
|
+
class ht {
|
|
322
322
|
constructor() {
|
|
323
323
|
i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
324
324
|
i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
@@ -358,13 +358,13 @@ class it {
|
|
|
358
358
|
return this.multiToSingleMap.get(e) !== void 0;
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
class
|
|
361
|
+
class A extends Error {
|
|
362
362
|
constructor() {
|
|
363
363
|
super(...arguments);
|
|
364
364
|
i(this, "name", "CanvasError");
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
|
-
const
|
|
367
|
+
const S = Object.freeze({
|
|
368
368
|
accessNonexistingNode: (r) => `Failed to access node with ID ${JSON.stringify(r)} because it does not exist`,
|
|
369
369
|
addNodeWithExistingId: (r) => `Failed to add node with ID ${JSON.stringify(r)} because a node with this ID already exists`,
|
|
370
370
|
addNodeWithElementInUse: (r, e) => `Failed to add node with ID ${JSON.stringify(r)} because its HTML element is already attached to node with ID ${JSON.stringify(e)}`,
|
|
@@ -378,6 +378,7 @@ const N = Object.freeze({
|
|
|
378
378
|
removeNonexistentPort: (r) => `Failed to remove port with ID ${JSON.stringify(r)} because it does not exist`,
|
|
379
379
|
accessNonexistentEdge: (r) => `Failed to access edge with ID ${JSON.stringify(r)} because it does not exist`,
|
|
380
380
|
addEdgeWithExistingId: (r) => `Failed to add edge with ID ${JSON.stringify(r)} because an edge with this ID already exists`,
|
|
381
|
+
addEdgeWithElementInUse: (r, e) => `Failed to add edge with ID ${JSON.stringify(r)} because its SVG element is already attached to edge with ID ${JSON.stringify(e)}`,
|
|
381
382
|
addEdgeFromNonexistentPort: (r, e) => `Failed to add edge with ID ${JSON.stringify(r)} from port with ID ${JSON.stringify(e)} because the port does not exist`,
|
|
382
383
|
addEdgeToNonexistentPort: (r, e) => `Failed to add edge with ID ${JSON.stringify(r)} to port with ID ${JSON.stringify(e)} because the port does not exist`,
|
|
383
384
|
updateNonexistentEdge: (r) => `Failed to update edge with ID ${JSON.stringify(r)} because it does not exist`,
|
|
@@ -386,7 +387,7 @@ const N = Object.freeze({
|
|
|
386
387
|
removeNonexistentEdge: (r) => `Failed to remove edge with ID ${JSON.stringify(r)} because it does not exist`,
|
|
387
388
|
accessEdgesForNonexistentPort: (r) => `Failed to access edges for port with ID ${JSON.stringify(r)} because the port does not exist`
|
|
388
389
|
});
|
|
389
|
-
class
|
|
390
|
+
class Me {
|
|
390
391
|
constructor() {
|
|
391
392
|
i(this, "nodes", /* @__PURE__ */ new Map());
|
|
392
393
|
i(this, "ports", /* @__PURE__ */ new Map());
|
|
@@ -395,7 +396,8 @@ class Pe {
|
|
|
395
396
|
i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
|
|
396
397
|
i(this, "portOutgoingEdges", /* @__PURE__ */ new Map());
|
|
397
398
|
i(this, "portCycleEdges", /* @__PURE__ */ new Map());
|
|
398
|
-
i(this, "elementPorts", new
|
|
399
|
+
i(this, "elementPorts", new ht());
|
|
400
|
+
i(this, "edgesElementsMap", /* @__PURE__ */ new Map());
|
|
399
401
|
i(this, "afterNodeAddedEmitter");
|
|
400
402
|
i(this, "onAfterNodeAdded");
|
|
401
403
|
i(this, "afterNodeUpdatedEmitter");
|
|
@@ -430,16 +432,16 @@ class Pe {
|
|
|
430
432
|
getNode(e) {
|
|
431
433
|
const t = this.nodes.get(e);
|
|
432
434
|
if (t === void 0)
|
|
433
|
-
throw new S
|
|
435
|
+
throw new A(S.accessNonexistingNode(e));
|
|
434
436
|
return t;
|
|
435
437
|
}
|
|
436
438
|
addNode(e) {
|
|
437
439
|
if (this.hasNode(e.id))
|
|
438
|
-
throw new S
|
|
440
|
+
throw new A(S.addNodeWithExistingId(e.id));
|
|
439
441
|
const t = this.findNodeIdByElement(e.element);
|
|
440
442
|
if (t !== void 0)
|
|
441
|
-
throw new
|
|
442
|
-
|
|
443
|
+
throw new A(
|
|
444
|
+
S.addNodeWithElementInUse(e.id, t)
|
|
443
445
|
);
|
|
444
446
|
const o = /* @__PURE__ */ new Map(), s = {
|
|
445
447
|
element: e.element,
|
|
@@ -461,13 +463,13 @@ class Pe {
|
|
|
461
463
|
}
|
|
462
464
|
updateNode(e, t) {
|
|
463
465
|
if (!this.hasNode(e))
|
|
464
|
-
throw new S
|
|
466
|
+
throw new A(S.updateNonexistentNode(e));
|
|
465
467
|
const { payload: o } = this.nodes.get(e);
|
|
466
468
|
o.x = t.x ?? o.x, o.y = t.y ?? o.y, o.centerFn = t.centerFn ?? o.centerFn, t.priority !== void 0 && (o.priority = t.priority, this.afterNodePriorityUpdatedEmitter.emit(e)), this.afterNodeUpdatedEmitter.emit(e);
|
|
467
469
|
}
|
|
468
470
|
removeNode(e) {
|
|
469
471
|
if (!this.hasNode(e))
|
|
470
|
-
throw new S
|
|
472
|
+
throw new A(S.removeNonexistentNode(e));
|
|
471
473
|
this.beforeNodeRemovedEmitter.emit(e);
|
|
472
474
|
const t = this.getNode(e);
|
|
473
475
|
this.nodesElementsMap.delete(t.element), this.nodes.delete(e);
|
|
@@ -478,15 +480,15 @@ class Pe {
|
|
|
478
480
|
getPort(e) {
|
|
479
481
|
const t = this.ports.get(e);
|
|
480
482
|
if (t === void 0)
|
|
481
|
-
throw new S
|
|
483
|
+
throw new A(S.accessNonexistentPort(e));
|
|
482
484
|
return t;
|
|
483
485
|
}
|
|
484
486
|
addPort(e) {
|
|
485
487
|
if (this.hasPort(e.id))
|
|
486
|
-
throw new S
|
|
488
|
+
throw new A(S.addPortWithExistingId(e.id));
|
|
487
489
|
if (!this.hasNode(e.nodeId))
|
|
488
|
-
throw new
|
|
489
|
-
|
|
490
|
+
throw new A(
|
|
491
|
+
S.addPortToNonexistentNode(e.id, e.nodeId)
|
|
490
492
|
);
|
|
491
493
|
this.ports.set(e.id, {
|
|
492
494
|
element: e.element,
|
|
@@ -498,7 +500,7 @@ class Pe {
|
|
|
498
500
|
}
|
|
499
501
|
updatePort(e, t) {
|
|
500
502
|
if (!this.hasPort(e))
|
|
501
|
-
throw new S
|
|
503
|
+
throw new A(S.updateNonexistentPort(e));
|
|
502
504
|
const o = this.getPort(e).payload;
|
|
503
505
|
o.direction = t.direction ?? o.direction, this.afterPortUpdatedEmitter.emit(e);
|
|
504
506
|
}
|
|
@@ -511,14 +513,14 @@ class Pe {
|
|
|
511
513
|
getNodePortIds(e) {
|
|
512
514
|
const t = this.nodes.get(e);
|
|
513
515
|
if (t === void 0)
|
|
514
|
-
throw new
|
|
515
|
-
|
|
516
|
+
throw new A(
|
|
517
|
+
S.accessPortsOfNonexistentNode(e)
|
|
516
518
|
);
|
|
517
519
|
return Array.from(t.ports.keys());
|
|
518
520
|
}
|
|
519
521
|
removePort(e) {
|
|
520
522
|
if (!this.hasPort(e))
|
|
521
|
-
throw new S
|
|
523
|
+
throw new A(S.removeNonexistentPort(e));
|
|
522
524
|
const t = this.getPort(e).nodeId;
|
|
523
525
|
this.beforePortRemovedEmitter.emit(e), this.getNode(t).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
|
|
524
526
|
}
|
|
@@ -528,33 +530,41 @@ class Pe {
|
|
|
528
530
|
getEdge(e) {
|
|
529
531
|
const t = this.edges.get(e);
|
|
530
532
|
if (t === void 0)
|
|
531
|
-
throw new S
|
|
533
|
+
throw new A(S.accessNonexistentEdge(e));
|
|
532
534
|
return t;
|
|
533
535
|
}
|
|
536
|
+
findEdgeIdByElement(e) {
|
|
537
|
+
return this.edgesElementsMap.get(e);
|
|
538
|
+
}
|
|
534
539
|
addEdge(e) {
|
|
535
540
|
if (this.hasEdge(e.id))
|
|
536
|
-
throw new S
|
|
541
|
+
throw new A(S.addEdgeWithExistingId(e.id));
|
|
537
542
|
if (!this.hasPort(e.from))
|
|
538
|
-
throw new
|
|
539
|
-
|
|
543
|
+
throw new A(
|
|
544
|
+
S.addEdgeFromNonexistentPort(e.id, e.from)
|
|
540
545
|
);
|
|
541
546
|
if (!this.hasPort(e.to))
|
|
542
|
-
throw new
|
|
543
|
-
|
|
547
|
+
throw new A(
|
|
548
|
+
S.addEdgeToNonexistentPort(e.id, e.to)
|
|
549
|
+
);
|
|
550
|
+
const t = this.findEdgeIdByElement(e.shape.svg);
|
|
551
|
+
if (t !== void 0)
|
|
552
|
+
throw new A(
|
|
553
|
+
S.addEdgeWithElementInUse(e.id, t)
|
|
544
554
|
);
|
|
545
555
|
this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
|
|
546
556
|
}
|
|
547
557
|
updateEdge(e, t) {
|
|
548
558
|
if (!this.hasEdge(e))
|
|
549
|
-
throw new S
|
|
559
|
+
throw new A(S.updateNonexistentEdge(e));
|
|
550
560
|
if (t.from !== void 0 || t.to !== void 0) {
|
|
551
561
|
if (t.from !== void 0 && !this.hasPort(t.from))
|
|
552
|
-
throw new
|
|
553
|
-
|
|
562
|
+
throw new A(
|
|
563
|
+
S.updateNonexistentEdgeSource(e, t.from)
|
|
554
564
|
);
|
|
555
565
|
if (t.to !== void 0 && !this.hasPort(t.to))
|
|
556
|
-
throw new
|
|
557
|
-
|
|
566
|
+
throw new A(
|
|
567
|
+
S.updateNonexistentEdgeTarget(e, t.to)
|
|
558
568
|
);
|
|
559
569
|
const s = this.getEdge(e), n = s.payload;
|
|
560
570
|
this.removeEdgeInternal(e), this.addEdgeInternal({
|
|
@@ -573,33 +583,33 @@ class Pe {
|
|
|
573
583
|
}
|
|
574
584
|
removeEdge(e) {
|
|
575
585
|
if (!this.hasEdge(e))
|
|
576
|
-
throw new S
|
|
586
|
+
throw new A(S.removeNonexistentEdge(e));
|
|
577
587
|
this.beforeEdgeRemovedEmitter.emit(e), this.removeEdgeInternal(e);
|
|
578
588
|
}
|
|
579
589
|
clear() {
|
|
580
|
-
this.beforeClearEmitter.emit(), this.portIncomingEdges.clear(), this.portOutgoingEdges.clear(), this.portCycleEdges.clear(), this.elementPorts.clear(), this.nodesElementsMap.clear(), this.edges.clear(), this.ports.clear(), this.nodes.clear();
|
|
590
|
+
this.beforeClearEmitter.emit(), this.portIncomingEdges.clear(), this.portOutgoingEdges.clear(), this.portCycleEdges.clear(), this.elementPorts.clear(), this.nodesElementsMap.clear(), this.edgesElementsMap.clear(), this.edges.clear(), this.ports.clear(), this.nodes.clear();
|
|
581
591
|
}
|
|
582
592
|
getPortIncomingEdgeIds(e) {
|
|
583
593
|
const t = this.portIncomingEdges.get(e);
|
|
584
594
|
if (t === void 0)
|
|
585
|
-
throw new
|
|
586
|
-
|
|
595
|
+
throw new A(
|
|
596
|
+
S.accessEdgesForNonexistentPort(e)
|
|
587
597
|
);
|
|
588
598
|
return Array.from(t);
|
|
589
599
|
}
|
|
590
600
|
getPortOutgoingEdgeIds(e) {
|
|
591
601
|
const t = this.portOutgoingEdges.get(e);
|
|
592
602
|
if (t === void 0)
|
|
593
|
-
throw new
|
|
594
|
-
|
|
603
|
+
throw new A(
|
|
604
|
+
S.accessEdgesForNonexistentPort(e)
|
|
595
605
|
);
|
|
596
606
|
return Array.from(t);
|
|
597
607
|
}
|
|
598
608
|
getPortCycleEdgeIds(e) {
|
|
599
609
|
const t = this.portCycleEdges.get(e);
|
|
600
610
|
if (t === void 0)
|
|
601
|
-
throw new
|
|
602
|
-
|
|
611
|
+
throw new A(
|
|
612
|
+
S.accessEdgesForNonexistentPort(e)
|
|
603
613
|
);
|
|
604
614
|
return Array.from(t);
|
|
605
615
|
}
|
|
@@ -665,29 +675,29 @@ class Pe {
|
|
|
665
675
|
shape: e.shape,
|
|
666
676
|
priority: e.priority
|
|
667
677
|
}
|
|
668
|
-
}), e.from !== e.to ? (this.portOutgoingEdges.get(e.from).add(e.id), this.portIncomingEdges.get(e.to).add(e.id)) : this.portCycleEdges.get(e.from).add(e.id);
|
|
678
|
+
}), this.edgesElementsMap.set(e.shape.svg, e.id), e.from !== e.to ? (this.portOutgoingEdges.get(e.from).add(e.id), this.portIncomingEdges.get(e.to).add(e.id)) : this.portCycleEdges.get(e.from).add(e.id);
|
|
669
679
|
}
|
|
670
680
|
removeEdgeInternal(e) {
|
|
671
|
-
const { from: t, to: o } = this.getEdge(e);
|
|
672
|
-
this.portCycleEdges.get(t).delete(e), this.portCycleEdges.get(o).delete(e), this.portIncomingEdges.get(t).delete(e), this.portIncomingEdges.get(o).delete(e), this.portOutgoingEdges.get(t).delete(e), this.portOutgoingEdges.get(o).delete(e), this.edges.delete(e);
|
|
681
|
+
const { from: t, to: o, payload: s } = this.getEdge(e);
|
|
682
|
+
this.portCycleEdges.get(t).delete(e), this.portCycleEdges.get(o).delete(e), this.portIncomingEdges.get(t).delete(e), this.portIncomingEdges.get(o).delete(e), this.portOutgoingEdges.get(t).delete(e), this.portOutgoingEdges.get(o).delete(e), this.edges.delete(e), this.edgesElementsMap.delete(s.shape.svg);
|
|
673
683
|
}
|
|
674
684
|
}
|
|
675
|
-
const
|
|
685
|
+
const ve = (r) => ({
|
|
676
686
|
scale: 1 / r.scale,
|
|
677
687
|
x: -r.x / r.scale,
|
|
678
688
|
y: -r.y / r.scale
|
|
679
|
-
}),
|
|
689
|
+
}), me = {
|
|
680
690
|
scale: 1,
|
|
681
691
|
x: 0,
|
|
682
692
|
y: 0
|
|
683
|
-
},
|
|
693
|
+
}, xe = (r, e) => ({
|
|
684
694
|
x: r.scale * e.x + r.x,
|
|
685
695
|
y: r.scale * e.y + r.y
|
|
686
696
|
});
|
|
687
|
-
class
|
|
697
|
+
class dt {
|
|
688
698
|
constructor(e) {
|
|
689
|
-
i(this, "viewportMatrix",
|
|
690
|
-
i(this, "contentMatrix",
|
|
699
|
+
i(this, "viewportMatrix", me);
|
|
700
|
+
i(this, "contentMatrix", me);
|
|
691
701
|
i(this, "beforeUpdateEmitter");
|
|
692
702
|
i(this, "onBeforeUpdated");
|
|
693
703
|
i(this, "afterUpdateEmitter");
|
|
@@ -710,24 +720,24 @@ class nt {
|
|
|
710
720
|
scale: e.scale ?? this.viewportMatrix.scale,
|
|
711
721
|
x: e.x ?? this.viewportMatrix.x,
|
|
712
722
|
y: e.y ?? this.viewportMatrix.y
|
|
713
|
-
}, this.beforeUpdateEmitter.emit(), this.contentMatrix =
|
|
723
|
+
}, this.beforeUpdateEmitter.emit(), this.contentMatrix = ve(this.viewportMatrix), this.afterUpdateEmitter.emit();
|
|
714
724
|
}
|
|
715
725
|
patchContentMatrix(e) {
|
|
716
726
|
this.contentMatrix = {
|
|
717
727
|
scale: e.scale ?? this.contentMatrix.scale,
|
|
718
728
|
x: e.x ?? this.contentMatrix.x,
|
|
719
729
|
y: e.y ?? this.contentMatrix.y
|
|
720
|
-
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix =
|
|
730
|
+
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix = ve(this.contentMatrix), this.afterUpdateEmitter.emit();
|
|
721
731
|
}
|
|
722
732
|
getDimensions() {
|
|
723
733
|
const { width: e, height: t } = this.host.getBoundingClientRect();
|
|
724
734
|
return { width: e, height: t };
|
|
725
735
|
}
|
|
726
736
|
createContentCoords(e) {
|
|
727
|
-
return
|
|
737
|
+
return xe(this.viewportMatrix, e);
|
|
728
738
|
}
|
|
729
739
|
createViewportCoords(e) {
|
|
730
|
-
return
|
|
740
|
+
return xe(this.contentMatrix, e);
|
|
731
741
|
}
|
|
732
742
|
destroy() {
|
|
733
743
|
this.observer.disconnect();
|
|
@@ -766,21 +776,21 @@ class q {
|
|
|
766
776
|
this.canvas.updateNode(t);
|
|
767
777
|
}
|
|
768
778
|
}
|
|
769
|
-
const
|
|
779
|
+
const ct = (r, e, t) => {
|
|
770
780
|
const { x: o, y: s, width: n, height: a } = r.getBoundingClientRect();
|
|
771
781
|
return e >= o && e <= o + n && t >= s && t <= s + a;
|
|
772
|
-
},
|
|
773
|
-
class
|
|
782
|
+
}, lt = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight;
|
|
783
|
+
class ut {
|
|
774
784
|
constructor(e, t) {
|
|
775
785
|
this.element = e, this.win = t;
|
|
776
786
|
}
|
|
777
787
|
verify(e, t) {
|
|
778
|
-
return
|
|
788
|
+
return ct(this.element, e, t) && lt(this.win, e, t);
|
|
779
789
|
}
|
|
780
790
|
}
|
|
781
791
|
const k = (r, e) => {
|
|
782
792
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
783
|
-
},
|
|
793
|
+
}, H = (r) => {
|
|
784
794
|
const e = document.createElement("div");
|
|
785
795
|
return {
|
|
786
796
|
id: r.overlayNodeId,
|
|
@@ -795,7 +805,7 @@ const k = (r, e) => {
|
|
|
795
805
|
}
|
|
796
806
|
]
|
|
797
807
|
};
|
|
798
|
-
},
|
|
808
|
+
}, gt = (r, e) => {
|
|
799
809
|
let t = e;
|
|
800
810
|
for (; t !== null; ) {
|
|
801
811
|
const o = r.findPortIdsByElement(t)[0] ?? null;
|
|
@@ -814,21 +824,21 @@ const k = (r, e) => {
|
|
|
814
824
|
status: "notFound"
|
|
815
825
|
};
|
|
816
826
|
};
|
|
817
|
-
function*
|
|
827
|
+
function* De(r, e) {
|
|
818
828
|
const t = r.elementsFromPoint(e.x, e.y);
|
|
819
829
|
for (const o of t) {
|
|
820
830
|
if (o.shadowRoot !== null) {
|
|
821
|
-
const s =
|
|
831
|
+
const s = De(o.shadowRoot, e);
|
|
822
832
|
for (const n of s)
|
|
823
833
|
yield n;
|
|
824
834
|
}
|
|
825
835
|
yield o;
|
|
826
836
|
}
|
|
827
837
|
}
|
|
828
|
-
const
|
|
829
|
-
const t =
|
|
838
|
+
const Re = (r, e) => {
|
|
839
|
+
const t = De(document, e);
|
|
830
840
|
for (const o of t) {
|
|
831
|
-
const s =
|
|
841
|
+
const s = gt(r, o);
|
|
832
842
|
if (s.status === "portFound")
|
|
833
843
|
return s.portId;
|
|
834
844
|
if (s.status === "nodeEncountered")
|
|
@@ -837,13 +847,13 @@ const Ce = (r, e) => {
|
|
|
837
847
|
return null;
|
|
838
848
|
};
|
|
839
849
|
var M = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(M || {});
|
|
840
|
-
const
|
|
850
|
+
const Le = (r, e) => ({
|
|
841
851
|
x: r / 2,
|
|
842
852
|
y: e / 2
|
|
843
853
|
}), m = (r, e, t) => ({
|
|
844
854
|
x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
|
|
845
855
|
y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
|
|
846
|
-
}),
|
|
856
|
+
}), Ve = (r, e, t) => {
|
|
847
857
|
const o = {
|
|
848
858
|
x: r.x + r.width / 2,
|
|
849
859
|
y: r.y + r.height / 2
|
|
@@ -860,7 +870,7 @@ const Me = (r, e) => ({
|
|
|
860
870
|
to: { x: s.x - n, y: s.y - a }
|
|
861
871
|
};
|
|
862
872
|
};
|
|
863
|
-
class
|
|
873
|
+
class pt {
|
|
864
874
|
constructor(e) {
|
|
865
875
|
i(this, "path");
|
|
866
876
|
i(this, "midpoint");
|
|
@@ -893,7 +903,7 @@ class lt {
|
|
|
893
903
|
this.path = `${x}${f}${E}`;
|
|
894
904
|
}
|
|
895
905
|
}
|
|
896
|
-
class
|
|
906
|
+
class wt {
|
|
897
907
|
constructor(e) {
|
|
898
908
|
i(this, "path");
|
|
899
909
|
i(this, "midpoint");
|
|
@@ -930,13 +940,13 @@ class ut {
|
|
|
930
940
|
{ x: c.x - u, y: c.y },
|
|
931
941
|
a,
|
|
932
942
|
c
|
|
933
|
-
),
|
|
943
|
+
), N = {
|
|
934
944
|
x: E.x + p,
|
|
935
945
|
y: E.y + y
|
|
936
|
-
}, T = {
|
|
937
|
-
x: (x.x + b.x) / 2,
|
|
938
|
-
y: (x.y + b.y) / 2
|
|
939
946
|
}, C = {
|
|
947
|
+
x: (x.x + N.x) / 2,
|
|
948
|
+
y: (x.y + N.y) / 2
|
|
949
|
+
}, T = {
|
|
940
950
|
x: f.x + s * n.x,
|
|
941
951
|
y: f.y + s * n.y
|
|
942
952
|
}, I = {
|
|
@@ -952,24 +962,24 @@ class ut {
|
|
|
952
962
|
this.path = [
|
|
953
963
|
`M ${l.x} ${l.y}`,
|
|
954
964
|
`L ${f.x} ${f.y}`,
|
|
955
|
-
`C ${
|
|
965
|
+
`C ${T.x} ${T.y} ${F.x} ${F.y} ${C.x} ${C.y}`,
|
|
956
966
|
`C ${U.x} ${U.y} ${I.x} ${I.y} ${E.x} ${E.y}`,
|
|
957
967
|
`L ${w.x} ${w.y}`
|
|
958
|
-
].join(" "), this.midpoint =
|
|
968
|
+
].join(" "), this.midpoint = C;
|
|
959
969
|
}
|
|
960
970
|
}
|
|
961
971
|
const ee = Object.freeze({
|
|
962
972
|
edgeColor: "--edge-color"
|
|
963
|
-
}),
|
|
973
|
+
}), Ie = (r) => {
|
|
964
974
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
965
975
|
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(ee.edgeColor, r), e;
|
|
966
|
-
},
|
|
976
|
+
}, Fe = (r) => {
|
|
967
977
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
968
978
|
return e.setAttribute("stroke", `var(${ee.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
969
|
-
},
|
|
979
|
+
}, Y = () => {
|
|
970
980
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
971
981
|
return r.setAttribute("fill", `var(${ee.edgeColor})`), r;
|
|
972
|
-
},
|
|
982
|
+
}, Ue = (r, e) => {
|
|
973
983
|
r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${e.width}px`, r.style.height = `${e.height}px`;
|
|
974
984
|
}, L = (r, e) => {
|
|
975
985
|
const t = [];
|
|
@@ -980,17 +990,17 @@ const ee = Object.freeze({
|
|
|
980
990
|
let c = 0, u = 0, g = 0;
|
|
981
991
|
const l = d > 0, w = d < o, p = l && w;
|
|
982
992
|
if (l && (c = -s, u = -n, g = a), w) {
|
|
983
|
-
const
|
|
984
|
-
s =
|
|
993
|
+
const T = r[d + 1];
|
|
994
|
+
s = T.x - h.x, n = T.y - h.y, a = Math.sqrt(s * s + n * n);
|
|
985
995
|
}
|
|
986
|
-
const f = a !== 0 ? Math.min((p ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, x = p ? { x: h.x + s * f, y: h.y + n * f } : h,
|
|
987
|
-
d > 0 && t.push(`L ${
|
|
996
|
+
const f = a !== 0 ? Math.min((p ? e : 0) / a, d < o - 1 ? 0.5 : 1) : 0, x = p ? { x: h.x + s * f, y: h.y + n * f } : h, N = g !== 0 ? Math.min((p ? e : 0) / g, d > 1 ? 0.5 : 1) : 0, C = p ? { x: h.x + c * N, y: h.y + u * N } : h;
|
|
997
|
+
d > 0 && t.push(`L ${C.x} ${C.y}`), p && t.push(
|
|
988
998
|
`C ${h.x} ${h.y} ${h.x} ${h.y} ${x.x} ${x.y}`
|
|
989
999
|
);
|
|
990
1000
|
});
|
|
991
1001
|
}
|
|
992
1002
|
return t.join(" ");
|
|
993
|
-
},
|
|
1003
|
+
}, yt = (r, e) => {
|
|
994
1004
|
const t = e.x - r.x >= 0, o = r.dirX >= 0, s = e.dirX >= 0;
|
|
995
1005
|
if (o === s) {
|
|
996
1006
|
const c = o === t, u = (r.x + e.x) / 2, g = (r.y + e.y) / 2, l = { x: u, y: g };
|
|
@@ -1026,7 +1036,7 @@ const ee = Object.freeze({
|
|
|
1026
1036
|
midpoint: { x: d.x, y: h }
|
|
1027
1037
|
};
|
|
1028
1038
|
};
|
|
1029
|
-
class
|
|
1039
|
+
class ft {
|
|
1030
1040
|
constructor(e) {
|
|
1031
1041
|
i(this, "path");
|
|
1032
1042
|
i(this, "midpoint");
|
|
@@ -1055,7 +1065,7 @@ class pt {
|
|
|
1055
1065
|
{ x: t.x + w, y: t.y },
|
|
1056
1066
|
s,
|
|
1057
1067
|
t
|
|
1058
|
-
), y = m({ x: o.x - w, y: o.y }, n, o), f =
|
|
1068
|
+
), y = m({ x: o.x - w, y: o.y }, n, o), f = yt(
|
|
1059
1069
|
{
|
|
1060
1070
|
x: p.x,
|
|
1061
1071
|
y: p.y,
|
|
@@ -1073,7 +1083,7 @@ class pt {
|
|
|
1073
1083
|
), this.midpoint = f.midpoint;
|
|
1074
1084
|
}
|
|
1075
1085
|
}
|
|
1076
|
-
class
|
|
1086
|
+
class vt {
|
|
1077
1087
|
constructor(e) {
|
|
1078
1088
|
i(this, "path");
|
|
1079
1089
|
i(this, "midpoint");
|
|
@@ -1104,27 +1114,27 @@ class wt {
|
|
|
1104
1114
|
{ x: s.x + y, y: s.y },
|
|
1105
1115
|
h,
|
|
1106
1116
|
s
|
|
1107
|
-
),
|
|
1117
|
+
), N = {
|
|
1108
1118
|
x: E.x + f,
|
|
1109
1119
|
y: E.y + x
|
|
1110
|
-
},
|
|
1120
|
+
}, C = m(
|
|
1111
1121
|
{ x: n.x - y, y: n.y },
|
|
1112
1122
|
d,
|
|
1113
1123
|
n
|
|
1114
|
-
),
|
|
1115
|
-
x:
|
|
1116
|
-
y:
|
|
1124
|
+
), T = {
|
|
1125
|
+
x: C.x + f,
|
|
1126
|
+
y: C.y + x
|
|
1117
1127
|
};
|
|
1118
1128
|
this.midpoint = {
|
|
1119
|
-
x: (
|
|
1120
|
-
y: (
|
|
1129
|
+
x: (N.x + T.x) / 2,
|
|
1130
|
+
y: (N.y + T.y) / 2
|
|
1121
1131
|
}, this.path = L(
|
|
1122
|
-
[w, E,
|
|
1132
|
+
[w, E, N, T, C, p],
|
|
1123
1133
|
l
|
|
1124
1134
|
);
|
|
1125
1135
|
}
|
|
1126
1136
|
}
|
|
1127
|
-
class
|
|
1137
|
+
class mt {
|
|
1128
1138
|
constructor(e) {
|
|
1129
1139
|
i(this, "path");
|
|
1130
1140
|
i(this, "midpoint");
|
|
@@ -1153,8 +1163,8 @@ class yt {
|
|
|
1153
1163
|
[g, y, x, l],
|
|
1154
1164
|
u
|
|
1155
1165
|
);
|
|
1156
|
-
const E = (y.x + x.x) / 2,
|
|
1157
|
-
this.midpoint = { x: E, y:
|
|
1166
|
+
const E = (y.x + x.x) / 2, N = (y.y + x.y) / 2;
|
|
1167
|
+
this.midpoint = { x: E, y: N };
|
|
1158
1168
|
}
|
|
1159
1169
|
createArrowPoint(e, t, o, s) {
|
|
1160
1170
|
if (!e)
|
|
@@ -1166,7 +1176,7 @@ class yt {
|
|
|
1166
1176
|
return m(n, t, o);
|
|
1167
1177
|
}
|
|
1168
1178
|
}
|
|
1169
|
-
const
|
|
1179
|
+
const xt = (r, e) => {
|
|
1170
1180
|
const t = e.y - r.y >= 0, o = r.dirY >= 0, s = e.dirY >= 0;
|
|
1171
1181
|
if (o === s) {
|
|
1172
1182
|
const c = o === t, u = (r.x + e.x) / 2, g = (r.y + e.y) / 2, l = { x: u, y: g };
|
|
@@ -1202,7 +1212,7 @@ const ft = (r, e) => {
|
|
|
1202
1212
|
midpoint: { x: h, y: d.y }
|
|
1203
1213
|
};
|
|
1204
1214
|
};
|
|
1205
|
-
class
|
|
1215
|
+
class Et {
|
|
1206
1216
|
constructor(e) {
|
|
1207
1217
|
i(this, "path");
|
|
1208
1218
|
i(this, "midpoint");
|
|
@@ -1231,7 +1241,7 @@ class vt {
|
|
|
1231
1241
|
{ x: t.x + w, y: t.y },
|
|
1232
1242
|
d,
|
|
1233
1243
|
t
|
|
1234
|
-
), y = m({ x: o.x - w, y: o.y }, c, o), f =
|
|
1244
|
+
), y = m({ x: o.x - w, y: o.y }, c, o), f = xt(
|
|
1235
1245
|
{
|
|
1236
1246
|
x: p.x,
|
|
1237
1247
|
y: p.y,
|
|
@@ -1266,7 +1276,7 @@ class te {
|
|
|
1266
1276
|
this.path = `${h ? "" : l}${L(g, e.roundness)}`, this.midpoint = { x: (g[3].x + g[4].x) / 2, y: (g[3].y + g[4].y) / 2 };
|
|
1267
1277
|
}
|
|
1268
1278
|
}
|
|
1269
|
-
class
|
|
1279
|
+
class At {
|
|
1270
1280
|
constructor(e) {
|
|
1271
1281
|
i(this, "path");
|
|
1272
1282
|
i(this, "midpoint");
|
|
@@ -1284,7 +1294,7 @@ class mt {
|
|
|
1284
1294
|
this.path = `${h ? "" : x}${f}`, this.midpoint = y[3];
|
|
1285
1295
|
}
|
|
1286
1296
|
}
|
|
1287
|
-
class
|
|
1297
|
+
class St {
|
|
1288
1298
|
constructor(e) {
|
|
1289
1299
|
i(this, "path");
|
|
1290
1300
|
i(this, "midpoint");
|
|
@@ -1329,11 +1339,11 @@ class xt {
|
|
|
1329
1339
|
};
|
|
1330
1340
|
}
|
|
1331
1341
|
}
|
|
1332
|
-
const
|
|
1342
|
+
const bt = (r, e, t) => {
|
|
1333
1343
|
const o = Math.max(r.y, e.y), s = Math.min(r.y, e.y);
|
|
1334
1344
|
return (t >= 0 ? o : s) + t;
|
|
1335
1345
|
};
|
|
1336
|
-
class
|
|
1346
|
+
class Nt {
|
|
1337
1347
|
constructor(e) {
|
|
1338
1348
|
i(this, "path");
|
|
1339
1349
|
i(this, "midpoint");
|
|
@@ -1367,7 +1377,7 @@ class At {
|
|
|
1367
1377
|
{ x: a.x - p, y: a.y },
|
|
1368
1378
|
d,
|
|
1369
1379
|
a
|
|
1370
|
-
), x =
|
|
1380
|
+
), x = bt(y, f, g);
|
|
1371
1381
|
this.midpoint = {
|
|
1372
1382
|
x: (y.x + f.x) / 2,
|
|
1373
1383
|
y: x
|
|
@@ -1384,11 +1394,11 @@ class At {
|
|
|
1384
1394
|
);
|
|
1385
1395
|
}
|
|
1386
1396
|
}
|
|
1387
|
-
const
|
|
1397
|
+
const Pt = (r, e, t) => {
|
|
1388
1398
|
const o = Math.max(r.x, e.x), s = Math.min(r.x, e.x);
|
|
1389
1399
|
return (t >= 0 ? o : s) + t;
|
|
1390
1400
|
};
|
|
1391
|
-
class
|
|
1401
|
+
class Ct {
|
|
1392
1402
|
constructor(e) {
|
|
1393
1403
|
i(this, "path");
|
|
1394
1404
|
i(this, "midpoint");
|
|
@@ -1422,7 +1432,7 @@ class Nt {
|
|
|
1422
1432
|
{ x: d.x - p, y: d.y },
|
|
1423
1433
|
a,
|
|
1424
1434
|
d
|
|
1425
|
-
), x =
|
|
1435
|
+
), x = Pt(y, f, u);
|
|
1426
1436
|
this.midpoint = {
|
|
1427
1437
|
x,
|
|
1428
1438
|
y: (y.y + f.y) / 2
|
|
@@ -1461,8 +1471,8 @@ const v = Object.freeze({
|
|
|
1461
1471
|
curvature: 90,
|
|
1462
1472
|
interactiveWidth: 10,
|
|
1463
1473
|
preOffset: 0
|
|
1464
|
-
}),
|
|
1465
|
-
class
|
|
1474
|
+
}), Ee = (r) => ({ x: Math.cos(r), y: Math.sin(r) });
|
|
1475
|
+
class X {
|
|
1466
1476
|
constructor(e) {
|
|
1467
1477
|
i(this, "svg");
|
|
1468
1478
|
i(this, "group", document.createElementNS(
|
|
@@ -1475,18 +1485,18 @@ class H {
|
|
|
1475
1485
|
i(this, "onAfterRender");
|
|
1476
1486
|
i(this, "afterRenderEmitter");
|
|
1477
1487
|
i(this, "arrowRenderer");
|
|
1478
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = P(), this.arrowRenderer = this.params.arrowRenderer, this.svg =
|
|
1488
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = P(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Ie(e.color), this.svg.appendChild(this.group), this.line = Fe(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = Y(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = Y(), this.group.appendChild(this.targetArrow));
|
|
1479
1489
|
}
|
|
1480
1490
|
render(e) {
|
|
1481
|
-
const { x: t, y: o, width: s, height: n, from: a, to: h } =
|
|
1491
|
+
const { x: t, y: o, width: s, height: n, from: a, to: h } = Ve(
|
|
1482
1492
|
e.from,
|
|
1483
1493
|
e.to,
|
|
1484
1494
|
this.params.padding
|
|
1485
1495
|
);
|
|
1486
|
-
|
|
1487
|
-
const d =
|
|
1496
|
+
Ue(this.svg, { x: t, y: o, width: s, height: n });
|
|
1497
|
+
const d = Ee(e.from.direction), c = Ee(e.to.direction);
|
|
1488
1498
|
let u = { x: -c.x, y: -c.y }, g;
|
|
1489
|
-
e.category ===
|
|
1499
|
+
e.category === V.PortCycle ? (g = this.params.createCyclePath, u = d) : e.category === V.NodeCycle ? g = this.params.createDetourPath : g = this.params.createLinePath;
|
|
1490
1500
|
const l = g(a, h, d, c);
|
|
1491
1501
|
this.line.setAttribute("d", l.path);
|
|
1492
1502
|
let w = null;
|
|
@@ -1507,7 +1517,7 @@ class H {
|
|
|
1507
1517
|
});
|
|
1508
1518
|
}
|
|
1509
1519
|
}
|
|
1510
|
-
const
|
|
1520
|
+
const Tt = (r) => (e) => {
|
|
1511
1521
|
const o = [
|
|
1512
1522
|
{ x: 0, y: 0 },
|
|
1513
1523
|
{ x: e.arrowLength, y: r.radius },
|
|
@@ -1519,7 +1529,7 @@ const bt = (r) => (e) => {
|
|
|
1519
1529
|
y: h.y + e.shift.y
|
|
1520
1530
|
})), s = `M ${o[0].x} ${o[0].y}`, n = `L ${o[1].x} ${o[1].y}`, a = `L ${o[2].x} ${o[2].y}`;
|
|
1521
1531
|
return `${s} ${n} ${a} Z`;
|
|
1522
|
-
},
|
|
1532
|
+
}, Mt = (r) => (e) => {
|
|
1523
1533
|
const t = r.radius, o = e.arrowLength, s = (o * o + 2 * o * t) / (2 * t), n = s + t, a = o + t - t * (o + t) / n, h = t * s / n, c = [
|
|
1524
1534
|
{ x: 0, y: 0 },
|
|
1525
1535
|
{ x: a, y: -h },
|
|
@@ -1531,7 +1541,7 @@ const bt = (r) => (e) => {
|
|
|
1531
1541
|
y: p.y + e.shift.y
|
|
1532
1542
|
})), u = `M ${c[0].x} ${c[0].y}`, g = `A ${s} ${s} 0 0 0 ${c[1].x} ${c[1].y}`, l = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${s} ${s} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1533
1543
|
return `${u} ${g} ${l} ${w}`;
|
|
1534
|
-
},
|
|
1544
|
+
}, Dt = (r) => (e) => {
|
|
1535
1545
|
const t = r.smallRadius, o = r.radius, s = m(
|
|
1536
1546
|
{
|
|
1537
1547
|
x: e.arrowLength,
|
|
@@ -1557,22 +1567,22 @@ const bt = (r) => (e) => {
|
|
|
1557
1567
|
return r;
|
|
1558
1568
|
switch (r.type) {
|
|
1559
1569
|
case "triangle":
|
|
1560
|
-
return
|
|
1570
|
+
return Tt({
|
|
1561
1571
|
radius: r.radius ?? v.polygonArrowRadius
|
|
1562
1572
|
});
|
|
1563
1573
|
case "arc":
|
|
1564
|
-
return
|
|
1574
|
+
return Mt({
|
|
1565
1575
|
radius: r.radius ?? v.circleArrowRadius
|
|
1566
1576
|
});
|
|
1567
1577
|
default:
|
|
1568
|
-
return
|
|
1578
|
+
return Dt({
|
|
1569
1579
|
smallRadius: r.smallRadius ?? v.wedgeArrowSmallRadius,
|
|
1570
1580
|
angle: r.angle ?? v.wedgeArrowAngle,
|
|
1571
1581
|
radius: r.radius ?? v.wedgeArrowRadius
|
|
1572
1582
|
});
|
|
1573
1583
|
}
|
|
1574
|
-
},
|
|
1575
|
-
class
|
|
1584
|
+
}, O = 50;
|
|
1585
|
+
class Rt {
|
|
1576
1586
|
constructor(e) {
|
|
1577
1587
|
i(this, "svg");
|
|
1578
1588
|
i(this, "group");
|
|
@@ -1589,7 +1599,7 @@ class Ct {
|
|
|
1589
1599
|
i(this, "hasSourceArrow");
|
|
1590
1600
|
i(this, "hasTargetArrow");
|
|
1591
1601
|
i(this, "pathShape");
|
|
1592
|
-
i(this, "createCyclePath", (e, t, o) => new
|
|
1602
|
+
i(this, "createCyclePath", (e, t, o) => new At({
|
|
1593
1603
|
origin: e,
|
|
1594
1604
|
dir: o,
|
|
1595
1605
|
radius: this.portCycleRadius,
|
|
@@ -1597,7 +1607,7 @@ class Ct {
|
|
|
1597
1607
|
arrowLength: this.arrowLength,
|
|
1598
1608
|
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
1599
1609
|
}));
|
|
1600
|
-
i(this, "createDetourPath", (e, t, o, s) => new
|
|
1610
|
+
i(this, "createDetourPath", (e, t, o, s) => new wt({
|
|
1601
1611
|
from: e,
|
|
1602
1612
|
to: t,
|
|
1603
1613
|
fromDir: o,
|
|
@@ -1609,7 +1619,7 @@ class Ct {
|
|
|
1609
1619
|
hasSourceArrow: this.hasSourceArrow,
|
|
1610
1620
|
hasTargetArrow: this.hasTargetArrow
|
|
1611
1621
|
}));
|
|
1612
|
-
i(this, "createLinePath", (e, t, o, s) => new
|
|
1622
|
+
i(this, "createLinePath", (e, t, o, s) => new pt({
|
|
1613
1623
|
from: e,
|
|
1614
1624
|
to: t,
|
|
1615
1625
|
fromDir: o,
|
|
@@ -1619,7 +1629,7 @@ class Ct {
|
|
|
1619
1629
|
hasSourceArrow: this.hasSourceArrow,
|
|
1620
1630
|
hasTargetArrow: this.hasTargetArrow
|
|
1621
1631
|
}));
|
|
1622
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? v.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? v.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? v.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new
|
|
1632
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? v.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? v.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? v.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new X({
|
|
1623
1633
|
color: (e == null ? void 0 : e.color) ?? v.color,
|
|
1624
1634
|
width: (e == null ? void 0 : e.width) ?? v.width,
|
|
1625
1635
|
arrowRenderer: B((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
@@ -1629,14 +1639,14 @@ class Ct {
|
|
|
1629
1639
|
createCyclePath: this.createCyclePath,
|
|
1630
1640
|
createDetourPath: this.createDetourPath,
|
|
1631
1641
|
createLinePath: this.createLinePath,
|
|
1632
|
-
padding:
|
|
1642
|
+
padding: O
|
|
1633
1643
|
}), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
1634
1644
|
}
|
|
1635
1645
|
render(e) {
|
|
1636
1646
|
this.pathShape.render(e);
|
|
1637
1647
|
}
|
|
1638
1648
|
}
|
|
1639
|
-
class
|
|
1649
|
+
class Lt {
|
|
1640
1650
|
constructor(e) {
|
|
1641
1651
|
i(this, "svg");
|
|
1642
1652
|
i(this, "group");
|
|
@@ -1661,7 +1671,7 @@ class Mt {
|
|
|
1661
1671
|
roundness: this.roundness,
|
|
1662
1672
|
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
1663
1673
|
}));
|
|
1664
|
-
i(this, "createDetourPath", (e, t, o, s) => new
|
|
1674
|
+
i(this, "createDetourPath", (e, t, o, s) => new Nt({
|
|
1665
1675
|
from: e,
|
|
1666
1676
|
to: t,
|
|
1667
1677
|
fromDir: o,
|
|
@@ -1673,7 +1683,7 @@ class Mt {
|
|
|
1673
1683
|
hasSourceArrow: this.hasSourceArrow,
|
|
1674
1684
|
hasTargetArrow: this.hasTargetArrow
|
|
1675
1685
|
}));
|
|
1676
|
-
i(this, "createLinePath", (e, t, o, s) => new
|
|
1686
|
+
i(this, "createLinePath", (e, t, o, s) => new ft({
|
|
1677
1687
|
from: e,
|
|
1678
1688
|
to: t,
|
|
1679
1689
|
fromDir: o,
|
|
@@ -1690,7 +1700,7 @@ class Mt {
|
|
|
1690
1700
|
t,
|
|
1691
1701
|
this.arrowOffset,
|
|
1692
1702
|
this.cycleSquareSide / 2
|
|
1693
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new
|
|
1703
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new X({
|
|
1694
1704
|
color: (e == null ? void 0 : e.color) ?? v.color,
|
|
1695
1705
|
width: (e == null ? void 0 : e.width) ?? v.width,
|
|
1696
1706
|
arrowRenderer: B((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
@@ -1700,14 +1710,14 @@ class Mt {
|
|
|
1700
1710
|
createCyclePath: this.createCyclePath,
|
|
1701
1711
|
createDetourPath: this.createDetourPath,
|
|
1702
1712
|
createLinePath: this.createLinePath,
|
|
1703
|
-
padding:
|
|
1713
|
+
padding: O
|
|
1704
1714
|
}), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
1705
1715
|
}
|
|
1706
1716
|
render(e) {
|
|
1707
1717
|
this.pathShape.render(e);
|
|
1708
1718
|
}
|
|
1709
1719
|
}
|
|
1710
|
-
class
|
|
1720
|
+
class Vt {
|
|
1711
1721
|
constructor(e) {
|
|
1712
1722
|
i(this, "svg");
|
|
1713
1723
|
i(this, "group");
|
|
@@ -1733,7 +1743,7 @@ class Dt {
|
|
|
1733
1743
|
roundness: this.roundness,
|
|
1734
1744
|
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
1735
1745
|
}));
|
|
1736
|
-
i(this, "createDetourPath", (e, t, o, s) => new
|
|
1746
|
+
i(this, "createDetourPath", (e, t, o, s) => new vt({
|
|
1737
1747
|
from: e,
|
|
1738
1748
|
to: t,
|
|
1739
1749
|
fromDir: o,
|
|
@@ -1746,7 +1756,7 @@ class Dt {
|
|
|
1746
1756
|
hasSourceArrow: this.hasSourceArrow,
|
|
1747
1757
|
hasTargetArrow: this.hasTargetArrow
|
|
1748
1758
|
}));
|
|
1749
|
-
i(this, "createLinePath", (e, t, o, s) => new
|
|
1759
|
+
i(this, "createLinePath", (e, t, o, s) => new mt({
|
|
1750
1760
|
from: e,
|
|
1751
1761
|
to: t,
|
|
1752
1762
|
fromDir: o,
|
|
@@ -1763,7 +1773,7 @@ class Dt {
|
|
|
1763
1773
|
t,
|
|
1764
1774
|
this.arrowOffset,
|
|
1765
1775
|
this.cycleSquareSide / 2
|
|
1766
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new
|
|
1776
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? v.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new X({
|
|
1767
1777
|
color: (e == null ? void 0 : e.color) ?? v.color,
|
|
1768
1778
|
width: (e == null ? void 0 : e.width) ?? v.width,
|
|
1769
1779
|
arrowRenderer: B((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
@@ -1773,14 +1783,14 @@ class Dt {
|
|
|
1773
1783
|
createCyclePath: this.createCyclePath,
|
|
1774
1784
|
createDetourPath: this.createDetourPath,
|
|
1775
1785
|
createLinePath: this.createLinePath,
|
|
1776
|
-
padding:
|
|
1786
|
+
padding: O
|
|
1777
1787
|
}), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
1778
1788
|
}
|
|
1779
1789
|
render(e) {
|
|
1780
1790
|
this.pathShape.render(e);
|
|
1781
1791
|
}
|
|
1782
1792
|
}
|
|
1783
|
-
class
|
|
1793
|
+
class It {
|
|
1784
1794
|
constructor(e) {
|
|
1785
1795
|
i(this, "svg");
|
|
1786
1796
|
i(this, "group");
|
|
@@ -1805,7 +1815,7 @@ class Lt {
|
|
|
1805
1815
|
roundness: this.roundness,
|
|
1806
1816
|
hasArrow: this.hasSourceArrow || this.hasTargetArrow
|
|
1807
1817
|
}));
|
|
1808
|
-
i(this, "createDetourPath", (e, t, o, s) => new
|
|
1818
|
+
i(this, "createDetourPath", (e, t, o, s) => new Ct({
|
|
1809
1819
|
from: e,
|
|
1810
1820
|
to: t,
|
|
1811
1821
|
fromDir: o,
|
|
@@ -1817,7 +1827,7 @@ class Lt {
|
|
|
1817
1827
|
hasSourceArrow: this.hasSourceArrow,
|
|
1818
1828
|
hasTargetArrow: this.hasTargetArrow
|
|
1819
1829
|
}));
|
|
1820
|
-
i(this, "createLinePath", (e, t, o, s) => new
|
|
1830
|
+
i(this, "createLinePath", (e, t, o, s) => new Et({
|
|
1821
1831
|
from: e,
|
|
1822
1832
|
to: t,
|
|
1823
1833
|
fromDir: o,
|
|
@@ -1834,7 +1844,7 @@ class Lt {
|
|
|
1834
1844
|
t,
|
|
1835
1845
|
this.arrowOffset,
|
|
1836
1846
|
this.cycleSquareSide / 2
|
|
1837
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new
|
|
1847
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? v.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? v.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? v.hasTargetArrow, this.pathShape = new X({
|
|
1838
1848
|
color: (e == null ? void 0 : e.color) ?? v.color,
|
|
1839
1849
|
width: (e == null ? void 0 : e.width) ?? v.width,
|
|
1840
1850
|
arrowRenderer: B((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
@@ -1844,14 +1854,14 @@ class Lt {
|
|
|
1844
1854
|
createCyclePath: this.createCyclePath,
|
|
1845
1855
|
createDetourPath: this.createDetourPath,
|
|
1846
1856
|
createLinePath: this.createLinePath,
|
|
1847
|
-
padding:
|
|
1857
|
+
padding: O
|
|
1848
1858
|
}), this.svg = this.pathShape.svg, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
|
|
1849
1859
|
}
|
|
1850
1860
|
render(e) {
|
|
1851
1861
|
this.pathShape.render(e);
|
|
1852
1862
|
}
|
|
1853
1863
|
}
|
|
1854
|
-
class
|
|
1864
|
+
class $e {
|
|
1855
1865
|
constructor(e) {
|
|
1856
1866
|
i(this, "svg");
|
|
1857
1867
|
i(this, "group", document.createElementNS(
|
|
@@ -1869,16 +1879,16 @@ class Ie {
|
|
|
1869
1879
|
i(this, "onAfterRender");
|
|
1870
1880
|
i(this, "afterRenderEmitter");
|
|
1871
1881
|
i(this, "arrowRenderer");
|
|
1872
|
-
[this.afterRenderEmitter, this.onAfterRender] = P(), this.color = (e == null ? void 0 : e.color) ?? v.color, this.width = (e == null ? void 0 : e.width) ?? v.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.arrowRenderer = B((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? v.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? v.preOffset, this.svg =
|
|
1882
|
+
[this.afterRenderEmitter, this.onAfterRender] = P(), this.color = (e == null ? void 0 : e.color) ?? v.color, this.width = (e == null ? void 0 : e.width) ?? v.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? v.arrowLength, this.arrowRenderer = B((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? v.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? v.preOffset, this.svg = Ie(this.color), this.svg.appendChild(this.group), this.line = Fe(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = Y(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = Y(), this.group.appendChild(this.targetArrow));
|
|
1873
1883
|
}
|
|
1874
1884
|
render(e) {
|
|
1875
|
-
const { x: t, y: o, width: s, height: n, from: a, to: h } =
|
|
1885
|
+
const { x: t, y: o, width: s, height: n, from: a, to: h } = Ve(
|
|
1876
1886
|
e.from,
|
|
1877
1887
|
e.to,
|
|
1878
|
-
|
|
1888
|
+
O
|
|
1879
1889
|
);
|
|
1880
|
-
|
|
1881
|
-
const d = new
|
|
1890
|
+
Ue(this.svg, { x: t, y: o, width: s, height: n });
|
|
1891
|
+
const d = new St({
|
|
1882
1892
|
from: a,
|
|
1883
1893
|
to: h,
|
|
1884
1894
|
sourceOffset: this.sourceOffset,
|
|
@@ -1930,40 +1940,40 @@ class Ie {
|
|
|
1930
1940
|
});
|
|
1931
1941
|
}
|
|
1932
1942
|
}
|
|
1933
|
-
const
|
|
1943
|
+
const Ft = () => {
|
|
1934
1944
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1935
1945
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
1936
|
-
},
|
|
1946
|
+
}, Ut = (r) => {
|
|
1937
1947
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1938
1948
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
1939
|
-
},
|
|
1949
|
+
}, Ae = (r) => {
|
|
1940
1950
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1941
1951
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
1942
1952
|
};
|
|
1943
|
-
class
|
|
1953
|
+
class $t extends Error {
|
|
1944
1954
|
constructor(e) {
|
|
1945
1955
|
super(e), this.name = "InteractiveEdgeError";
|
|
1946
1956
|
}
|
|
1947
1957
|
}
|
|
1948
|
-
class
|
|
1958
|
+
class Be {
|
|
1949
1959
|
constructor(e, t) {
|
|
1950
1960
|
i(this, "svg");
|
|
1951
1961
|
i(this, "group");
|
|
1952
1962
|
i(this, "line");
|
|
1953
1963
|
i(this, "sourceArrow");
|
|
1954
1964
|
i(this, "targetArrow");
|
|
1955
|
-
i(this, "handle",
|
|
1965
|
+
i(this, "handle", Ft());
|
|
1956
1966
|
i(this, "onAfterRender");
|
|
1957
1967
|
i(this, "interactiveLine");
|
|
1958
1968
|
i(this, "interactiveSourceArrow", null);
|
|
1959
1969
|
i(this, "interactiveTargetArrow", null);
|
|
1960
|
-
if (this.baseEdge = e, e instanceof
|
|
1961
|
-
throw new
|
|
1970
|
+
if (this.baseEdge = e, e instanceof Be)
|
|
1971
|
+
throw new $t(
|
|
1962
1972
|
"interactive edge can be configured only once"
|
|
1963
1973
|
);
|
|
1964
1974
|
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;
|
|
1965
1975
|
const o = (t == null ? void 0 : t.distance) ?? v.interactiveWidth;
|
|
1966
|
-
this.interactiveLine =
|
|
1976
|
+
this.interactiveLine = Ut(o), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = Ae(o), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = Ae(o), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((s) => {
|
|
1967
1977
|
this.interactiveLine.setAttribute("d", s.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", s.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", s.targetArrowPath);
|
|
1968
1978
|
});
|
|
1969
1979
|
}
|
|
@@ -1971,7 +1981,7 @@ class Fe {
|
|
|
1971
1981
|
this.baseEdge.render(e);
|
|
1972
1982
|
}
|
|
1973
1983
|
}
|
|
1974
|
-
class
|
|
1984
|
+
class Hr {
|
|
1975
1985
|
constructor(e, t) {
|
|
1976
1986
|
i(this, "group");
|
|
1977
1987
|
i(this, "line");
|
|
@@ -1988,7 +1998,7 @@ class Br {
|
|
|
1988
1998
|
this.baseShape.render(e);
|
|
1989
1999
|
}
|
|
1990
2000
|
}
|
|
1991
|
-
class
|
|
2001
|
+
class Oe {
|
|
1992
2002
|
constructor(e) {
|
|
1993
2003
|
i(this, "onAfterNodeAdded");
|
|
1994
2004
|
i(this, "onAfterNodeUpdated");
|
|
@@ -2059,6 +2069,9 @@ class Ue {
|
|
|
2059
2069
|
shape: o.shape
|
|
2060
2070
|
};
|
|
2061
2071
|
}
|
|
2072
|
+
findEdgeIdByElement(e) {
|
|
2073
|
+
return this.graphStore.findEdgeIdByElement(e);
|
|
2074
|
+
}
|
|
2062
2075
|
getPortIncomingEdgeIds(e) {
|
|
2063
2076
|
return this.graphStore.getPortIncomingEdgeIds(e);
|
|
2064
2077
|
}
|
|
@@ -2100,7 +2113,7 @@ class J {
|
|
|
2100
2113
|
this.counter = 0;
|
|
2101
2114
|
}
|
|
2102
2115
|
}
|
|
2103
|
-
class
|
|
2116
|
+
class We {
|
|
2104
2117
|
constructor(e, t, o) {
|
|
2105
2118
|
i(this, "nodeIdGenerator", new J(
|
|
2106
2119
|
(e) => this.graphStore.hasNode(e)
|
|
@@ -2231,18 +2244,18 @@ class $e {
|
|
|
2231
2244
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
|
|
2232
2245
|
}
|
|
2233
2246
|
}
|
|
2234
|
-
const
|
|
2247
|
+
const Bt = (r) => {
|
|
2235
2248
|
setTimeout(() => {
|
|
2236
2249
|
r();
|
|
2237
2250
|
});
|
|
2238
|
-
},
|
|
2251
|
+
}, Ot = (r) => {
|
|
2239
2252
|
queueMicrotask(() => {
|
|
2240
2253
|
r();
|
|
2241
2254
|
});
|
|
2242
2255
|
}, re = (r) => {
|
|
2243
2256
|
r();
|
|
2244
2257
|
};
|
|
2245
|
-
class
|
|
2258
|
+
class ze {
|
|
2246
2259
|
constructor(e) {
|
|
2247
2260
|
i(this, "onBeforeUpdated");
|
|
2248
2261
|
i(this, "onAfterUpdated");
|
|
@@ -2265,7 +2278,7 @@ class Be {
|
|
|
2265
2278
|
return this.viewportStore.createViewportCoords(e);
|
|
2266
2279
|
}
|
|
2267
2280
|
}
|
|
2268
|
-
const
|
|
2281
|
+
const Wt = (r, e) => Symbol.iterator in r ? {
|
|
2269
2282
|
minContentScale: e.focus.minContentScale,
|
|
2270
2283
|
nodes: r,
|
|
2271
2284
|
contentPadding: e.focus.contentPadding,
|
|
@@ -2275,16 +2288,16 @@ const $t = (r, e) => Symbol.iterator in r ? {
|
|
|
2275
2288
|
nodes: r.nodes ?? [],
|
|
2276
2289
|
contentPadding: r.contentPadding ?? r.contentOffset ?? e.focus.contentPadding,
|
|
2277
2290
|
animationDuration: r.animationDuration ?? e.focus.animationDuration
|
|
2278
|
-
},
|
|
2291
|
+
}, ke = (r, e, t) => ({
|
|
2279
2292
|
scale: r.scale,
|
|
2280
2293
|
x: r.x + r.scale * e,
|
|
2281
2294
|
y: r.y + r.scale * t
|
|
2282
|
-
}),
|
|
2295
|
+
}), He = (r, e, t, o) => ({
|
|
2283
2296
|
scale: r.scale * e,
|
|
2284
2297
|
x: r.scale * (1 - e) * t + r.x,
|
|
2285
2298
|
y: r.scale * (1 - e) * o + r.y
|
|
2286
2299
|
});
|
|
2287
|
-
class
|
|
2300
|
+
class Ye {
|
|
2288
2301
|
constructor(e, t, o, s) {
|
|
2289
2302
|
this.graphStore = e, this.viewportStore = t, this.params = o, this.win = s;
|
|
2290
2303
|
}
|
|
@@ -2296,11 +2309,11 @@ class ze {
|
|
|
2296
2309
|
}
|
|
2297
2310
|
center(e, t) {
|
|
2298
2311
|
const { width: o, height: s } = this.viewportStore.getDimensions(), n = { x: o / 2, y: s / 2 }, a = this.viewportStore.getViewportMatrix(), h = this.viewportStore.createViewportCoords(e), d = h.x - n.x, c = h.y - n.y;
|
|
2299
|
-
let u =
|
|
2312
|
+
let u = ke(a, d, c);
|
|
2300
2313
|
const g = t == null ? void 0 : t.contentScale;
|
|
2301
2314
|
if (g !== void 0) {
|
|
2302
2315
|
const w = 1 / g;
|
|
2303
|
-
u =
|
|
2316
|
+
u = He(
|
|
2304
2317
|
u,
|
|
2305
2318
|
w / a.scale,
|
|
2306
2319
|
n.x,
|
|
@@ -2311,7 +2324,7 @@ class ze {
|
|
|
2311
2324
|
l > 0 ? this.animateNavigation(a, u, l) : this.viewportStore.patchViewportMatrix(u);
|
|
2312
2325
|
}
|
|
2313
2326
|
focus(e) {
|
|
2314
|
-
const t =
|
|
2327
|
+
const t = Wt(e ?? {}, this.params);
|
|
2315
2328
|
this.params.focus.schedule(() => {
|
|
2316
2329
|
this.navigate(t);
|
|
2317
2330
|
});
|
|
@@ -2360,20 +2373,20 @@ class ze {
|
|
|
2360
2373
|
this.win.requestAnimationFrame(a);
|
|
2361
2374
|
}
|
|
2362
2375
|
}
|
|
2363
|
-
const
|
|
2364
|
-
const o = new
|
|
2376
|
+
const Xe = (r, e, t) => {
|
|
2377
|
+
const o = new Me(), s = new Oe(o), n = new ze(e), a = new Ce(o, e, r), h = {
|
|
2365
2378
|
nodes: {
|
|
2366
|
-
centerFn:
|
|
2379
|
+
centerFn: Le,
|
|
2367
2380
|
priorityFn: () => 0
|
|
2368
2381
|
},
|
|
2369
2382
|
edges: {
|
|
2370
|
-
shapeFactory: () => new
|
|
2383
|
+
shapeFactory: () => new $e(),
|
|
2371
2384
|
priorityFn: () => 0
|
|
2372
2385
|
},
|
|
2373
2386
|
ports: {
|
|
2374
2387
|
direction: 0
|
|
2375
2388
|
}
|
|
2376
|
-
}, d = new
|
|
2389
|
+
}, d = new We(
|
|
2377
2390
|
o,
|
|
2378
2391
|
a,
|
|
2379
2392
|
h
|
|
@@ -2384,13 +2397,13 @@ const ke = (r, e, t) => {
|
|
|
2384
2397
|
schedule: re,
|
|
2385
2398
|
animationDuration: 0
|
|
2386
2399
|
}
|
|
2387
|
-
}, u = new
|
|
2400
|
+
}, u = new Ye(
|
|
2388
2401
|
o,
|
|
2389
2402
|
e,
|
|
2390
2403
|
c,
|
|
2391
2404
|
t
|
|
2392
2405
|
);
|
|
2393
|
-
return new
|
|
2406
|
+
return new Te(s, n, d, u);
|
|
2394
2407
|
};
|
|
2395
2408
|
class G {
|
|
2396
2409
|
constructor(e, t, o, s) {
|
|
@@ -2497,7 +2510,7 @@ class G {
|
|
|
2497
2510
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2498
2511
|
}
|
|
2499
2512
|
}
|
|
2500
|
-
class
|
|
2513
|
+
class zt {
|
|
2501
2514
|
constructor(e, t, o) {
|
|
2502
2515
|
this.canvas = e, this.layoutAlgorithm = t, this.params = o;
|
|
2503
2516
|
}
|
|
@@ -2511,7 +2524,7 @@ class Bt {
|
|
|
2511
2524
|
}), this.params.onAfterApplied();
|
|
2512
2525
|
}
|
|
2513
2526
|
}
|
|
2514
|
-
class
|
|
2527
|
+
class kt {
|
|
2515
2528
|
constructor(e, t, o) {
|
|
2516
2529
|
this.canvas = e, this.layoutAlgorithm = t, this.params = o;
|
|
2517
2530
|
}
|
|
@@ -2526,7 +2539,111 @@ class Wt {
|
|
|
2526
2539
|
}), this.params.onAfterApplied();
|
|
2527
2540
|
}
|
|
2528
2541
|
}
|
|
2529
|
-
class
|
|
2542
|
+
class Ht {
|
|
2543
|
+
constructor() {
|
|
2544
|
+
i(this, "field", "_htmlGraphTags");
|
|
2545
|
+
}
|
|
2546
|
+
has(e, t) {
|
|
2547
|
+
const s = e[this.field];
|
|
2548
|
+
return s !== void 0 && s.has(t);
|
|
2549
|
+
}
|
|
2550
|
+
tag(e, t) {
|
|
2551
|
+
const o = e, s = o[this.field];
|
|
2552
|
+
s === void 0 ? o[this.field] = /* @__PURE__ */ new Set([t]) : s.add(t);
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
const oe = Symbol();
|
|
2556
|
+
class se {
|
|
2557
|
+
constructor(e, t, o) {
|
|
2558
|
+
i(this, "onSelected");
|
|
2559
|
+
i(this, "mouseDownEventVerifier");
|
|
2560
|
+
i(this, "mouseUpEventVerifier");
|
|
2561
|
+
i(this, "movementThreshold");
|
|
2562
|
+
i(this, "selectionCandidate", null);
|
|
2563
|
+
i(this, "previousMouse", null);
|
|
2564
|
+
i(this, "previousTouch", null);
|
|
2565
|
+
i(this, "movedDistance", 0);
|
|
2566
|
+
i(this, "onElementMouseDown", (e) => {
|
|
2567
|
+
const t = e;
|
|
2568
|
+
this.mouseDownEventVerifier(t) && (this.selectionCandidate = t.currentTarget, this.previousMouse = { x: t.clientX, y: t.clientY }, this.movedDistance = 0, this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2569
|
+
passive: !0
|
|
2570
|
+
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2571
|
+
passive: !0
|
|
2572
|
+
}));
|
|
2573
|
+
});
|
|
2574
|
+
i(this, "onElementTouchStart", (e) => {
|
|
2575
|
+
const t = e, o = t.touches;
|
|
2576
|
+
o.length === 1 && (this.selectionCandidate = t.currentTarget, this.previousTouch = o[0], this.movedDistance = 0, this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
2577
|
+
passive: !0
|
|
2578
|
+
}), this.window.addEventListener("touchend", this.onWindowTouchEnd, {
|
|
2579
|
+
passive: !0
|
|
2580
|
+
}), this.window.addEventListener("touchcancel", this.onWindowTouchCancel, {
|
|
2581
|
+
passive: !0
|
|
2582
|
+
}));
|
|
2583
|
+
});
|
|
2584
|
+
i(this, "onWindowMouseMove", (e) => {
|
|
2585
|
+
const t = e;
|
|
2586
|
+
if (!this.pointInsideVerifier.verify(
|
|
2587
|
+
t.clientX,
|
|
2588
|
+
t.clientY
|
|
2589
|
+
)) {
|
|
2590
|
+
this.removeWindowMouseListeners();
|
|
2591
|
+
return;
|
|
2592
|
+
}
|
|
2593
|
+
const s = this.previousMouse, n = t.clientX - s.x, a = t.clientY - s.y;
|
|
2594
|
+
this.previousMouse = { x: t.clientX, y: t.clientY }, this.processMoveThresholdVerification(n, a, () => {
|
|
2595
|
+
this.removeWindowMouseListeners();
|
|
2596
|
+
});
|
|
2597
|
+
});
|
|
2598
|
+
i(this, "onWindowMouseUp", (e) => {
|
|
2599
|
+
const t = e;
|
|
2600
|
+
this.mouseUpEventVerifier(t) && (this.removeWindowMouseListeners(), this.onSelected(this.selectionCandidate, e));
|
|
2601
|
+
});
|
|
2602
|
+
i(this, "onWindowTouchMove", (e) => {
|
|
2603
|
+
const o = e.touches;
|
|
2604
|
+
if (o.length !== 1) {
|
|
2605
|
+
this.removeWindowTouchListeners();
|
|
2606
|
+
return;
|
|
2607
|
+
}
|
|
2608
|
+
const s = o[0];
|
|
2609
|
+
if (!this.pointInsideVerifier.verify(
|
|
2610
|
+
s.clientX,
|
|
2611
|
+
s.clientY
|
|
2612
|
+
)) {
|
|
2613
|
+
this.removeWindowTouchListeners();
|
|
2614
|
+
return;
|
|
2615
|
+
}
|
|
2616
|
+
const a = this.previousTouch, h = s.clientX - a.clientX, d = s.clientY - a.clientY;
|
|
2617
|
+
this.previousTouch = s, this.processMoveThresholdVerification(h, d, () => {
|
|
2618
|
+
this.removeWindowTouchListeners();
|
|
2619
|
+
});
|
|
2620
|
+
});
|
|
2621
|
+
i(this, "onWindowTouchEnd", (e) => {
|
|
2622
|
+
this.removeWindowTouchListeners(), this.onSelected(this.selectionCandidate, e);
|
|
2623
|
+
});
|
|
2624
|
+
i(this, "onWindowTouchCancel", () => {
|
|
2625
|
+
this.removeWindowTouchListeners();
|
|
2626
|
+
});
|
|
2627
|
+
this.window = e, this.pointInsideVerifier = t, this.mouseDownEventVerifier = o.mouseDownEventVerifier, this.mouseUpEventVerifier = o.mouseUpEventVerifier, this.onSelected = o.onSelected, this.movementThreshold = o.movementThreshold;
|
|
2628
|
+
}
|
|
2629
|
+
enable(e) {
|
|
2630
|
+
e.addEventListener("mousedown", this.onElementMouseDown), e.addEventListener("touchstart", this.onElementTouchStart);
|
|
2631
|
+
}
|
|
2632
|
+
disable(e) {
|
|
2633
|
+
e.removeEventListener("mousedown", this.onElementMouseDown), e.removeEventListener("touchstart", this.onElementTouchStart), e === this.selectionCandidate && (this.removeWindowMouseListeners(), this.removeWindowTouchListeners());
|
|
2634
|
+
}
|
|
2635
|
+
removeWindowMouseListeners() {
|
|
2636
|
+
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
2637
|
+
}
|
|
2638
|
+
removeWindowTouchListeners() {
|
|
2639
|
+
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchEnd), this.window.removeEventListener("touchcancel", this.onWindowTouchCancel);
|
|
2640
|
+
}
|
|
2641
|
+
processMoveThresholdVerification(e, t, o) {
|
|
2642
|
+
const s = Math.sqrt(e * e + t * t);
|
|
2643
|
+
this.movedDistance += s, this.movedDistance > this.movementThreshold && o();
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
class ie {
|
|
2530
2647
|
constructor(e, t, o, s, n) {
|
|
2531
2648
|
i(this, "grabbedNode", null);
|
|
2532
2649
|
i(this, "maxNodePriority", 0);
|
|
@@ -2645,7 +2762,7 @@ class oe {
|
|
|
2645
2762
|
this.canvas = e, this.element = t, this.window = o, this.pointInsideVerifier = s, this.params = n, 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.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
2646
2763
|
}
|
|
2647
2764
|
static configure(e, t, o, s, n) {
|
|
2648
|
-
new
|
|
2765
|
+
new ie(
|
|
2649
2766
|
e,
|
|
2650
2767
|
t,
|
|
2651
2768
|
o,
|
|
@@ -2720,7 +2837,7 @@ class oe {
|
|
|
2720
2837
|
return e;
|
|
2721
2838
|
}
|
|
2722
2839
|
}
|
|
2723
|
-
const
|
|
2840
|
+
const W = (r) => {
|
|
2724
2841
|
const e = [], t = r.touches.length;
|
|
2725
2842
|
for (let h = 0; h < t; h++)
|
|
2726
2843
|
e.push([r.touches[h].clientX, r.touches[h].clientY]);
|
|
@@ -2780,10 +2897,10 @@ class j {
|
|
|
2780
2897
|
});
|
|
2781
2898
|
i(this, "onTouchStart", (e) => {
|
|
2782
2899
|
if (this.prevTouches !== null) {
|
|
2783
|
-
this.prevTouches =
|
|
2900
|
+
this.prevTouches = W(e);
|
|
2784
2901
|
return;
|
|
2785
2902
|
}
|
|
2786
|
-
this.prevTouches =
|
|
2903
|
+
this.prevTouches = W(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
2787
2904
|
passive: !0
|
|
2788
2905
|
}), this.window.addEventListener("touchend", this.onWindowTouchFinish, {
|
|
2789
2906
|
passive: !0
|
|
@@ -2792,7 +2909,7 @@ class j {
|
|
|
2792
2909
|
}), this.startRegisteredTransform();
|
|
2793
2910
|
});
|
|
2794
2911
|
i(this, "onWindowTouchMove", (e) => {
|
|
2795
|
-
const t =
|
|
2912
|
+
const t = W(e);
|
|
2796
2913
|
if (!t.touches.every(
|
|
2797
2914
|
(s) => this.pointInsideVerifier.verify(s[0], s[1])
|
|
2798
2915
|
)) {
|
|
@@ -2809,7 +2926,7 @@ class j {
|
|
|
2809
2926
|
this.prevTouches = t;
|
|
2810
2927
|
});
|
|
2811
2928
|
i(this, "onWindowTouchFinish", (e) => {
|
|
2812
|
-
e.touches.length > 0 ? this.prevTouches =
|
|
2929
|
+
e.touches.length > 0 ? this.prevTouches = W(e) : this.stopTouchDrag();
|
|
2813
2930
|
});
|
|
2814
2931
|
i(this, "preventWheelScaleListener", (e) => {
|
|
2815
2932
|
e.preventDefault();
|
|
@@ -2836,7 +2953,7 @@ class j {
|
|
|
2836
2953
|
);
|
|
2837
2954
|
}
|
|
2838
2955
|
moveViewport(e, t) {
|
|
2839
|
-
const o = this.viewport.getViewportMatrix(), s =
|
|
2956
|
+
const o = this.viewport.getViewportMatrix(), s = ke(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
|
|
2840
2957
|
prevTransform: o,
|
|
2841
2958
|
nextTransform: s,
|
|
2842
2959
|
canvasWidth: n,
|
|
@@ -2845,7 +2962,7 @@ class j {
|
|
|
2845
2962
|
this.performTransform(h);
|
|
2846
2963
|
}
|
|
2847
2964
|
scaleViewport(e, t, o) {
|
|
2848
|
-
const s = this.canvas.viewport.getViewportMatrix(), n =
|
|
2965
|
+
const s = this.canvas.viewport.getViewportMatrix(), n = He(s, e, t, o), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
|
|
2849
2966
|
prevTransform: s,
|
|
2850
2967
|
nextTransform: n,
|
|
2851
2968
|
canvasWidth: a,
|
|
@@ -2884,7 +3001,7 @@ class j {
|
|
|
2884
3001
|
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(s), this.params.onResizeTransformFinished();
|
|
2885
3002
|
}
|
|
2886
3003
|
}
|
|
2887
|
-
class
|
|
3004
|
+
class ne {
|
|
2888
3005
|
constructor(e, t, o, s, n, a, h) {
|
|
2889
3006
|
i(this, "nodeHorizontal");
|
|
2890
3007
|
i(this, "nodeVertical");
|
|
@@ -2940,7 +3057,7 @@ class se {
|
|
|
2940
3057
|
), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
|
|
2941
3058
|
}
|
|
2942
3059
|
static configure(e, t, o, s, n, a, h) {
|
|
2943
|
-
new
|
|
3060
|
+
new ne(
|
|
2944
3061
|
e,
|
|
2945
3062
|
t,
|
|
2946
3063
|
o,
|
|
@@ -2971,24 +3088,24 @@ class se {
|
|
|
2971
3088
|
});
|
|
2972
3089
|
}
|
|
2973
3090
|
}
|
|
2974
|
-
const
|
|
3091
|
+
const Yt = () => {
|
|
2975
3092
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2976
3093
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2977
|
-
},
|
|
3094
|
+
}, Xt = () => {
|
|
2978
3095
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2979
3096
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
2980
|
-
},
|
|
3097
|
+
}, Gt = () => {
|
|
2981
3098
|
const r = document.createElementNS(
|
|
2982
3099
|
"http://www.w3.org/2000/svg",
|
|
2983
3100
|
"pattern"
|
|
2984
3101
|
);
|
|
2985
3102
|
return r.setAttribute("id", "pattern"), r;
|
|
2986
3103
|
};
|
|
2987
|
-
class
|
|
3104
|
+
class ae {
|
|
2988
3105
|
constructor(e, t, o) {
|
|
2989
|
-
i(this, "svg",
|
|
2990
|
-
i(this, "patternRenderingRectangle",
|
|
2991
|
-
i(this, "pattern",
|
|
3106
|
+
i(this, "svg", Yt());
|
|
3107
|
+
i(this, "patternRenderingRectangle", Xt());
|
|
3108
|
+
i(this, "pattern", Gt());
|
|
2992
3109
|
i(this, "patternContent");
|
|
2993
3110
|
i(this, "tileWidth");
|
|
2994
3111
|
i(this, "tileHeight");
|
|
@@ -3009,7 +3126,7 @@ class ie {
|
|
|
3009
3126
|
}), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
|
|
3010
3127
|
}
|
|
3011
3128
|
static configure(e, t, o) {
|
|
3012
|
-
new
|
|
3129
|
+
new ae(e, t, o);
|
|
3013
3130
|
}
|
|
3014
3131
|
updateVisibility() {
|
|
3015
3132
|
const { scale: e } = this.canvas.viewport.getViewportMatrix(), t = e > this.maxViewportScale;
|
|
@@ -3023,7 +3140,7 @@ class ie {
|
|
|
3023
3140
|
}
|
|
3024
3141
|
}
|
|
3025
3142
|
}
|
|
3026
|
-
class
|
|
3143
|
+
class he {
|
|
3027
3144
|
constructor(e, t, o, s, n, a) {
|
|
3028
3145
|
i(this, "overlayCanvas");
|
|
3029
3146
|
i(this, "staticPortId", null);
|
|
@@ -3031,7 +3148,7 @@ class ne {
|
|
|
3031
3148
|
i(this, "onEdgeCreated", (e) => {
|
|
3032
3149
|
this.params.onAfterEdgeCreated(e);
|
|
3033
3150
|
});
|
|
3034
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas =
|
|
3151
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = Xe(
|
|
3035
3152
|
this.overlayLayer,
|
|
3036
3153
|
this.viewportStore,
|
|
3037
3154
|
this.window
|
|
@@ -3062,7 +3179,7 @@ class ne {
|
|
|
3062
3179
|
);
|
|
3063
3180
|
}
|
|
3064
3181
|
static configure(e, t, o, s, n, a) {
|
|
3065
|
-
new
|
|
3182
|
+
new he(
|
|
3066
3183
|
e,
|
|
3067
3184
|
t,
|
|
3068
3185
|
o,
|
|
@@ -3091,7 +3208,7 @@ class ne {
|
|
|
3091
3208
|
};
|
|
3092
3209
|
this.isTargetDragging = o === "direct";
|
|
3093
3210
|
const [w, p] = this.isTargetDragging ? [g, l] : [l, g];
|
|
3094
|
-
this.overlayCanvas.addNode(
|
|
3211
|
+
this.overlayCanvas.addNode(H(w)), this.overlayCanvas.addNode(H(p)), this.overlayCanvas.addEdge({
|
|
3095
3212
|
from: w.overlayNodeId,
|
|
3096
3213
|
to: p.overlayNodeId,
|
|
3097
3214
|
shape: this.params.edgeShapeFactory(M.EdgeId)
|
|
@@ -3101,7 +3218,7 @@ class ne {
|
|
|
3101
3218
|
this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
3102
3219
|
}
|
|
3103
3220
|
tryCreateConnection(e) {
|
|
3104
|
-
const t =
|
|
3221
|
+
const t = Re(this.canvas.graph, e);
|
|
3105
3222
|
if (t === null) {
|
|
3106
3223
|
this.handleEdgeCreationInterrupted();
|
|
3107
3224
|
return;
|
|
@@ -3127,7 +3244,7 @@ class ne {
|
|
|
3127
3244
|
});
|
|
3128
3245
|
}
|
|
3129
3246
|
}
|
|
3130
|
-
class
|
|
3247
|
+
class de {
|
|
3131
3248
|
constructor(e, t, o, s, n, a) {
|
|
3132
3249
|
i(this, "overlayCanvas");
|
|
3133
3250
|
i(this, "staticPortId", null);
|
|
@@ -3136,7 +3253,7 @@ class ae {
|
|
|
3136
3253
|
i(this, "onEdgeReattached", (e) => {
|
|
3137
3254
|
this.params.onAfterEdgeReattached(e);
|
|
3138
3255
|
});
|
|
3139
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas =
|
|
3256
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = o, this.window = s, this.pointInsideVerifier = n, this.params = a, this.overlayCanvas = Xe(
|
|
3140
3257
|
this.overlayLayer,
|
|
3141
3258
|
this.viewportStore,
|
|
3142
3259
|
this.window
|
|
@@ -3173,7 +3290,7 @@ class ae {
|
|
|
3173
3290
|
);
|
|
3174
3291
|
}
|
|
3175
3292
|
static configure(e, t, o, s, n, a) {
|
|
3176
|
-
new
|
|
3293
|
+
new de(
|
|
3177
3294
|
e,
|
|
3178
3295
|
t,
|
|
3179
3296
|
o,
|
|
@@ -3214,13 +3331,13 @@ class ae {
|
|
|
3214
3331
|
portCoords: p,
|
|
3215
3332
|
portDirection: d.direction
|
|
3216
3333
|
}, [x, E] = this.isTargetDragging ? [y, f] : [f, y];
|
|
3217
|
-
this.overlayCanvas.addNode(
|
|
3218
|
-
const
|
|
3334
|
+
this.overlayCanvas.addNode(H(x)), this.overlayCanvas.addNode(H(E));
|
|
3335
|
+
const N = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(M.EdgeId) : s.shape;
|
|
3219
3336
|
return this.overlayCanvas.addEdge({
|
|
3220
3337
|
id: M.EdgeId,
|
|
3221
3338
|
from: x.overlayNodeId,
|
|
3222
3339
|
to: E.overlayNodeId,
|
|
3223
|
-
shape:
|
|
3340
|
+
shape: N
|
|
3224
3341
|
}), !0;
|
|
3225
3342
|
}
|
|
3226
3343
|
resetDragState() {
|
|
@@ -3237,7 +3354,7 @@ class ae {
|
|
|
3237
3354
|
});
|
|
3238
3355
|
}
|
|
3239
3356
|
tryCreateConnection(e) {
|
|
3240
|
-
const t =
|
|
3357
|
+
const t = Re(this.canvas.graph, e);
|
|
3241
3358
|
if (this.overlayCanvas.removeEdge(M.EdgeId), t === null) {
|
|
3242
3359
|
this.handleEdgeReattachInterrupted();
|
|
3243
3360
|
return;
|
|
@@ -3273,17 +3390,17 @@ class ae {
|
|
|
3273
3390
|
});
|
|
3274
3391
|
}
|
|
3275
3392
|
}
|
|
3276
|
-
class
|
|
3393
|
+
class ce {
|
|
3277
3394
|
constructor(e, t) {
|
|
3278
3395
|
this.applier = e, this.trigger = t, this.trigger.subscribe(() => {
|
|
3279
3396
|
this.applier.apply();
|
|
3280
3397
|
});
|
|
3281
3398
|
}
|
|
3282
3399
|
static configure(e, t) {
|
|
3283
|
-
new
|
|
3400
|
+
new ce(e, t);
|
|
3284
3401
|
}
|
|
3285
3402
|
}
|
|
3286
|
-
class
|
|
3403
|
+
class le {
|
|
3287
3404
|
constructor(e, t, o) {
|
|
3288
3405
|
i(this, "applyScheduled", !1);
|
|
3289
3406
|
i(this, "apply", () => {
|
|
@@ -3300,7 +3417,7 @@ class de {
|
|
|
3300
3417
|
});
|
|
3301
3418
|
}
|
|
3302
3419
|
static configure(e, t, o) {
|
|
3303
|
-
new
|
|
3420
|
+
new le(
|
|
3304
3421
|
e,
|
|
3305
3422
|
t,
|
|
3306
3423
|
o
|
|
@@ -3310,23 +3427,23 @@ class de {
|
|
|
3310
3427
|
this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
|
|
3311
3428
|
}
|
|
3312
3429
|
}
|
|
3313
|
-
class
|
|
3430
|
+
class jt {
|
|
3314
3431
|
static configure(e, t) {
|
|
3315
|
-
const o = t.applyOn, s = new
|
|
3432
|
+
const o = t.applyOn, s = new zt(e, t.algorithm, {
|
|
3316
3433
|
staticNodeResolver: t.staticNodeResolver,
|
|
3317
3434
|
onBeforeApplied: t.onBeforeApplied,
|
|
3318
3435
|
onAfterApplied: t.onAfterApplied
|
|
3319
3436
|
});
|
|
3320
3437
|
switch (o.type) {
|
|
3321
3438
|
case "trigger": {
|
|
3322
|
-
|
|
3439
|
+
ce.configure(
|
|
3323
3440
|
s,
|
|
3324
3441
|
o.trigger
|
|
3325
3442
|
);
|
|
3326
3443
|
break;
|
|
3327
3444
|
}
|
|
3328
3445
|
case "topologyChangeSchedule": {
|
|
3329
|
-
|
|
3446
|
+
le.configure(
|
|
3330
3447
|
e.graph,
|
|
3331
3448
|
s,
|
|
3332
3449
|
o.schedule
|
|
@@ -3336,7 +3453,7 @@ class Yt {
|
|
|
3336
3453
|
}
|
|
3337
3454
|
}
|
|
3338
3455
|
}
|
|
3339
|
-
class
|
|
3456
|
+
class Jt {
|
|
3340
3457
|
constructor(e, t) {
|
|
3341
3458
|
i(this, "previousTimeStamp");
|
|
3342
3459
|
i(this, "step", (e) => {
|
|
@@ -3351,222 +3468,100 @@ class Xt {
|
|
|
3351
3468
|
this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
|
|
3352
3469
|
}
|
|
3353
3470
|
}
|
|
3354
|
-
class
|
|
3471
|
+
class ue {
|
|
3355
3472
|
constructor(e, t, o) {
|
|
3356
3473
|
i(this, "applier");
|
|
3357
3474
|
i(this, "step", (e) => {
|
|
3358
3475
|
this.applier.apply(e);
|
|
3359
3476
|
});
|
|
3360
|
-
this.win = o, this.applier = new
|
|
3477
|
+
this.win = o, this.applier = new kt(e, t.algorithm, {
|
|
3361
3478
|
staticNodeResolver: t.staticNodeResolver,
|
|
3362
3479
|
onBeforeApplied: t.onBeforeApplied,
|
|
3363
3480
|
onAfterApplied: t.onAfterApplied
|
|
3364
|
-
}), new
|
|
3481
|
+
}), new Jt(this.win, this.step);
|
|
3365
3482
|
}
|
|
3366
3483
|
static configure(e, t, o) {
|
|
3367
|
-
new
|
|
3484
|
+
new ue(e, t, o);
|
|
3368
3485
|
}
|
|
3369
3486
|
}
|
|
3370
|
-
class
|
|
3371
|
-
constructor(e, t, o, s) {
|
|
3487
|
+
class ge {
|
|
3488
|
+
constructor(e, t, o, s, n) {
|
|
3489
|
+
i(this, "configurator");
|
|
3372
3490
|
i(this, "onNodeSelected");
|
|
3373
|
-
i(this, "
|
|
3374
|
-
i(this, "mouseUpEventVerifier");
|
|
3375
|
-
i(this, "movementThreshold");
|
|
3376
|
-
i(this, "selectionCandidateNodeId", null);
|
|
3377
|
-
i(this, "movedDistance", 0);
|
|
3378
|
-
i(this, "previousMouse", null);
|
|
3379
|
-
i(this, "previousTouch", null);
|
|
3491
|
+
i(this, "selectionHandledTag", oe);
|
|
3380
3492
|
i(this, "onAfterNodeAdded", (e) => {
|
|
3381
3493
|
const { element: t } = this.canvas.graph.getNode(e);
|
|
3382
|
-
|
|
3383
|
-
passive: !0
|
|
3384
|
-
}), t.addEventListener("touchstart", this.onNodeTouchStart, {
|
|
3385
|
-
passive: !0
|
|
3386
|
-
});
|
|
3494
|
+
this.configurator.enable(t);
|
|
3387
3495
|
});
|
|
3388
3496
|
i(this, "onBeforeNodeRemoved", (e) => {
|
|
3389
3497
|
const { element: t } = this.canvas.graph.getNode(e);
|
|
3390
|
-
|
|
3498
|
+
this.configurator.disable(t);
|
|
3391
3499
|
});
|
|
3392
3500
|
i(this, "reset", () => {
|
|
3393
3501
|
this.canvas.graph.getAllNodeIds().forEach((e) => {
|
|
3394
3502
|
const { element: t } = this.canvas.graph.getNode(e);
|
|
3395
|
-
|
|
3503
|
+
this.configurator.disable(t);
|
|
3396
3504
|
});
|
|
3397
3505
|
});
|
|
3398
|
-
|
|
3399
|
-
this.
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
passive: !0
|
|
3410
|
-
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
3411
|
-
passive: !0
|
|
3412
|
-
});
|
|
3413
|
-
});
|
|
3414
|
-
i(this, "onNodeTouchStart", (e) => {
|
|
3415
|
-
const t = e;
|
|
3416
|
-
if (t.touches.length !== 1)
|
|
3417
|
-
return;
|
|
3418
|
-
const o = this.canvas.graph.findNodeIdByElement(
|
|
3419
|
-
t.currentTarget
|
|
3420
|
-
);
|
|
3421
|
-
this.selectionCandidateNodeId = o, this.previousTouch = t.touches[0], this.movedDistance = 0, this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
3422
|
-
passive: !0
|
|
3423
|
-
}), this.window.addEventListener("touchend", this.onWindowTouchEnd, {
|
|
3424
|
-
passive: !0
|
|
3425
|
-
}), this.window.addEventListener("touchcancel", this.onWindowTouchCancel, {
|
|
3426
|
-
passive: !0
|
|
3427
|
-
});
|
|
3428
|
-
});
|
|
3429
|
-
i(this, "onWindowMouseMove", (e) => {
|
|
3430
|
-
const t = e, o = this.previousMouse, s = t.clientX - o.x, n = t.clientY - o.y;
|
|
3431
|
-
if (!this.pointInsideVerifier.verify(t.clientX, t.clientY)) {
|
|
3432
|
-
this.removeWindowMouseListeners();
|
|
3433
|
-
return;
|
|
3434
|
-
}
|
|
3435
|
-
this.processMoveThresholdVerification(s, n, () => {
|
|
3436
|
-
this.removeWindowMouseListeners();
|
|
3437
|
-
}), this.previousMouse = { x: t.clientX, y: t.clientY };
|
|
3438
|
-
});
|
|
3439
|
-
i(this, "onWindowTouchMove", (e) => {
|
|
3440
|
-
const t = e;
|
|
3441
|
-
if (t.touches.length !== 1) {
|
|
3442
|
-
this.removeWindowTouchListeners();
|
|
3443
|
-
return;
|
|
3444
|
-
}
|
|
3445
|
-
const o = t.touches[0];
|
|
3446
|
-
if (!this.pointInsideVerifier.verify(o.clientX, o.clientY)) {
|
|
3447
|
-
this.removeWindowTouchListeners();
|
|
3448
|
-
return;
|
|
3506
|
+
this.canvas = e, this.window = t, this.pointInsideVerifier = o, this.eventTagger = s, this.onNodeSelected = n.onNodeSelected, this.configurator = new se(
|
|
3507
|
+
this.window,
|
|
3508
|
+
this.pointInsideVerifier,
|
|
3509
|
+
{
|
|
3510
|
+
onSelected: (a, h) => {
|
|
3511
|
+
const d = this.canvas.graph.findNodeIdByElement(a);
|
|
3512
|
+
this.eventTagger.tag(h, this.selectionHandledTag), this.onNodeSelected(d);
|
|
3513
|
+
},
|
|
3514
|
+
movementThreshold: n.movementThreshold,
|
|
3515
|
+
mouseDownEventVerifier: n.mouseDownEventVerifier,
|
|
3516
|
+
mouseUpEventVerifier: n.mouseUpEventVerifier
|
|
3449
3517
|
}
|
|
3450
|
-
|
|
3451
|
-
this.processMoveThresholdVerification(n, a, () => {
|
|
3452
|
-
this.removeWindowTouchListeners();
|
|
3453
|
-
}), this.previousTouch = o;
|
|
3454
|
-
});
|
|
3455
|
-
i(this, "onWindowMouseUp", (e) => {
|
|
3456
|
-
const t = e;
|
|
3457
|
-
this.mouseUpEventVerifier(t) && (this.removeWindowMouseListeners(), this.trySelectNode(e));
|
|
3458
|
-
});
|
|
3459
|
-
i(this, "onWindowTouchEnd", (e) => {
|
|
3460
|
-
this.removeWindowTouchListeners(), this.trySelectNode(e);
|
|
3461
|
-
});
|
|
3462
|
-
i(this, "onWindowTouchCancel", () => {
|
|
3463
|
-
this.removeWindowTouchListeners();
|
|
3464
|
-
});
|
|
3465
|
-
this.canvas = e, this.window = t, this.pointInsideVerifier = o, this.mouseDownEventVerifier = s.mouseDownEventVerifier, this.mouseUpEventVerifier = s.mouseUpEventVerifier, this.onNodeSelected = s.onNodeSelected, this.movementThreshold = s.movementThreshold, this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
3518
|
+
), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.reset);
|
|
3466
3519
|
}
|
|
3467
|
-
static configure(e, t, o, s) {
|
|
3468
|
-
new
|
|
3520
|
+
static configure(e, t, o, s, n) {
|
|
3521
|
+
new ge(
|
|
3469
3522
|
e,
|
|
3470
3523
|
t,
|
|
3471
3524
|
o,
|
|
3472
|
-
s
|
|
3525
|
+
s,
|
|
3526
|
+
n
|
|
3473
3527
|
);
|
|
3474
3528
|
}
|
|
3475
|
-
removeWindowMouseListeners() {
|
|
3476
|
-
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
3477
|
-
}
|
|
3478
|
-
removeWindowTouchListeners() {
|
|
3479
|
-
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchEnd), this.window.removeEventListener("touchcancel", this.onWindowTouchCancel);
|
|
3480
|
-
}
|
|
3481
|
-
trySelectNode(e) {
|
|
3482
|
-
const t = this.selectionCandidateNodeId;
|
|
3483
|
-
this.canvas.graph.hasNode(t) && (this.onNodeSelected(t), e.ignoreCanvasSelection = !0);
|
|
3484
|
-
}
|
|
3485
|
-
processMoveThresholdVerification(e, t, o) {
|
|
3486
|
-
const s = Math.sqrt(e * e + t * t);
|
|
3487
|
-
this.movedDistance += s, this.movedDistance > this.movementThreshold && o();
|
|
3488
|
-
}
|
|
3489
3529
|
}
|
|
3490
|
-
class
|
|
3530
|
+
class pe {
|
|
3491
3531
|
constructor(e, t, o, s, n) {
|
|
3492
|
-
i(this, "
|
|
3493
|
-
i(this, "
|
|
3494
|
-
i(this, "
|
|
3495
|
-
i(this, "
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
i(this, "previousTouch", null);
|
|
3499
|
-
i(this, "onMouseDown", (e) => {
|
|
3500
|
-
const t = e;
|
|
3501
|
-
this.mouseDownEventVerifier(t) && (this.previousMouseDown = { x: t.clientX, y: t.clientY }, this.movedDistance = 0, this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
3502
|
-
passive: !0
|
|
3503
|
-
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
3504
|
-
passive: !0
|
|
3505
|
-
}));
|
|
3532
|
+
i(this, "configurator");
|
|
3533
|
+
i(this, "selectionHandledTag", oe);
|
|
3534
|
+
i(this, "onEdgeSelected");
|
|
3535
|
+
i(this, "onAfterEdgeAdded", (e) => {
|
|
3536
|
+
const { shape: t } = this.canvas.graph.getEdge(e);
|
|
3537
|
+
this.configurator.enable(t.svg);
|
|
3506
3538
|
});
|
|
3507
|
-
i(this, "
|
|
3508
|
-
const t = e;
|
|
3509
|
-
|
|
3510
|
-
return;
|
|
3511
|
-
const o = t.touches[0];
|
|
3512
|
-
this.previousTouch = o, this.movedDistance = 0, this.window.addEventListener("touchmove", this.onWindowTouchMove, {
|
|
3513
|
-
passive: !0
|
|
3514
|
-
}), this.window.addEventListener("touchend", this.onWindowTouchEnd, {
|
|
3515
|
-
passive: !0
|
|
3516
|
-
}), this.window.addEventListener("touchcancel", this.onWindowTouchCancel, {
|
|
3517
|
-
passive: !0
|
|
3518
|
-
});
|
|
3539
|
+
i(this, "onBeforeEdgeRemoved", (e) => {
|
|
3540
|
+
const { shape: t } = this.canvas.graph.getEdge(e);
|
|
3541
|
+
this.configurator.disable(t.svg);
|
|
3519
3542
|
});
|
|
3520
|
-
i(this, "
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
this.
|
|
3524
|
-
|
|
3525
|
-
}
|
|
3526
|
-
const o = this.previousMouseDown, s = t.clientX - o.x, n = t.clientY - o.y;
|
|
3527
|
-
this.processMoveThresholdVerification(s, n, () => {
|
|
3528
|
-
this.removeWindowMouseListeners();
|
|
3529
|
-
}), this.previousMouseDown = { x: t.clientX, y: t.clientY };
|
|
3543
|
+
i(this, "reset", () => {
|
|
3544
|
+
this.canvas.graph.getAllEdgeIds().forEach((e) => {
|
|
3545
|
+
const { shape: t } = this.canvas.graph.getEdge(e);
|
|
3546
|
+
this.configurator.disable(t.svg);
|
|
3547
|
+
});
|
|
3530
3548
|
});
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3549
|
+
this.canvas = e, this.window = t, this.pointInsideVerifier = o, this.eventTagger = s, this.onEdgeSelected = n.onEdgeSelected, this.configurator = new se(
|
|
3550
|
+
this.window,
|
|
3551
|
+
this.pointInsideVerifier,
|
|
3552
|
+
{
|
|
3553
|
+
onSelected: (a, h) => {
|
|
3554
|
+
const d = this.canvas.graph.findEdgeIdByElement(a);
|
|
3555
|
+
this.eventTagger.tag(h, this.selectionHandledTag), this.onEdgeSelected(d);
|
|
3556
|
+
},
|
|
3557
|
+
movementThreshold: n.movementThreshold,
|
|
3558
|
+
mouseDownEventVerifier: n.mouseDownEventVerifier,
|
|
3559
|
+
mouseUpEventVerifier: n.mouseUpEventVerifier
|
|
3541
3560
|
}
|
|
3542
|
-
|
|
3543
|
-
this.processMoveThresholdVerification(n, a, () => {
|
|
3544
|
-
this.removeWindowTouchListeners();
|
|
3545
|
-
}), this.previousTouch = o;
|
|
3546
|
-
});
|
|
3547
|
-
i(this, "onWindowMouseUp", (e) => {
|
|
3548
|
-
const t = e;
|
|
3549
|
-
if (!this.mouseUpEventVerifier(t))
|
|
3550
|
-
return;
|
|
3551
|
-
e.ignoreCanvasSelection !== !0 && this.onCanvasSelected(), this.removeWindowMouseListeners();
|
|
3552
|
-
});
|
|
3553
|
-
i(this, "onWindowTouchEnd", () => {
|
|
3554
|
-
this.onCanvasSelected(), this.removeWindowTouchListeners();
|
|
3555
|
-
});
|
|
3556
|
-
i(this, "onWindowTouchCancel", () => {
|
|
3557
|
-
this.removeWindowTouchListeners();
|
|
3558
|
-
});
|
|
3559
|
-
i(this, "restore", () => {
|
|
3560
|
-
this.element.removeEventListener("mousedown", this.onMouseDown), this.element.removeEventListener("touchstart", this.onTouchStart), this.removeWindowMouseListeners(), this.removeWindowTouchListeners();
|
|
3561
|
-
});
|
|
3562
|
-
this.canvas = e, this.element = t, this.window = o, this.pointInsideVerifier = s, this.onCanvasSelected = n.onCanvasSelected, this.movementThreshold = n.movementThreshold, this.mouseDownEventVerifier = n.mouseDownEventVerifier, this.mouseUpEventVerifier = n.mouseUpEventVerifier, this.canvas.onBeforeDestroy.subscribe(this.restore), this.element.addEventListener("mousedown", this.onMouseDown, {
|
|
3563
|
-
passive: !0
|
|
3564
|
-
}), this.element.addEventListener("touchstart", this.onTouchStart, {
|
|
3565
|
-
passive: !0
|
|
3566
|
-
});
|
|
3561
|
+
), this.canvas.graph.onAfterEdgeAdded.subscribe(this.onAfterEdgeAdded), this.canvas.graph.onBeforeEdgeRemoved.subscribe(this.onBeforeEdgeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.reset);
|
|
3567
3562
|
}
|
|
3568
3563
|
static configure(e, t, o, s, n) {
|
|
3569
|
-
new
|
|
3564
|
+
new pe(
|
|
3570
3565
|
e,
|
|
3571
3566
|
t,
|
|
3572
3567
|
o,
|
|
@@ -3574,46 +3569,68 @@ class ue {
|
|
|
3574
3569
|
n
|
|
3575
3570
|
);
|
|
3576
3571
|
}
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3572
|
+
}
|
|
3573
|
+
class we {
|
|
3574
|
+
constructor(e, t, o, s, n, a) {
|
|
3575
|
+
i(this, "configurator");
|
|
3576
|
+
i(this, "onCanvasSelected");
|
|
3577
|
+
i(this, "selectionHandledTag", oe);
|
|
3578
|
+
i(this, "restore", () => {
|
|
3579
|
+
this.configurator.disable(this.element);
|
|
3580
|
+
});
|
|
3581
|
+
this.canvas = e, this.element = t, this.window = o, this.pointInsideVerifier = s, this.eventTagger = n, this.onCanvasSelected = a.onCanvasSelected, this.configurator = new se(
|
|
3582
|
+
this.window,
|
|
3583
|
+
this.pointInsideVerifier,
|
|
3584
|
+
{
|
|
3585
|
+
onSelected: (h, d) => {
|
|
3586
|
+
this.eventTagger.has(d, this.selectionHandledTag) || this.onCanvasSelected();
|
|
3587
|
+
},
|
|
3588
|
+
movementThreshold: a.movementThreshold,
|
|
3589
|
+
mouseDownEventVerifier: a.mouseDownEventVerifier,
|
|
3590
|
+
mouseUpEventVerifier: a.mouseUpEventVerifier
|
|
3591
|
+
}
|
|
3592
|
+
), this.configurator.enable(this.element), this.canvas.onBeforeDestroy.subscribe(this.restore);
|
|
3582
3593
|
}
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3594
|
+
static configure(e, t, o, s, n, a) {
|
|
3595
|
+
new we(
|
|
3596
|
+
e,
|
|
3597
|
+
t,
|
|
3598
|
+
o,
|
|
3599
|
+
s,
|
|
3600
|
+
n,
|
|
3601
|
+
a
|
|
3602
|
+
);
|
|
3586
3603
|
}
|
|
3587
3604
|
}
|
|
3588
|
-
const
|
|
3605
|
+
const Kt = () => {
|
|
3589
3606
|
const r = document.createElement("div");
|
|
3590
3607
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
3591
3608
|
}, Q = () => {
|
|
3592
3609
|
const r = document.createElement("div");
|
|
3593
3610
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
3594
|
-
},
|
|
3611
|
+
}, Se = () => {
|
|
3595
3612
|
const r = Q();
|
|
3596
3613
|
return r.style.pointerEvents = "none", r;
|
|
3597
3614
|
};
|
|
3598
|
-
class
|
|
3615
|
+
class Qt {
|
|
3599
3616
|
constructor(e) {
|
|
3600
3617
|
i(this, "background", Q());
|
|
3601
3618
|
i(this, "main", Q());
|
|
3602
|
-
i(this, "overlayConnectablePorts",
|
|
3603
|
-
i(this, "overlayDraggableEdges",
|
|
3604
|
-
i(this, "host",
|
|
3619
|
+
i(this, "overlayConnectablePorts", Se());
|
|
3620
|
+
i(this, "overlayDraggableEdges", Se());
|
|
3621
|
+
i(this, "host", Kt());
|
|
3605
3622
|
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);
|
|
3606
3623
|
}
|
|
3607
3624
|
destroy() {
|
|
3608
3625
|
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);
|
|
3609
3626
|
}
|
|
3610
3627
|
}
|
|
3611
|
-
const
|
|
3628
|
+
const Zt = (r) => {
|
|
3612
3629
|
var w, p, y, f, x, E;
|
|
3613
3630
|
const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
|
|
3614
3631
|
}), t = ((p = r.events) == null ? void 0 : p.onNodeDrag) ?? (() => {
|
|
3615
3632
|
}), o = r.nodeDragVerifier ?? (() => !0), s = ((y = r.events) == null ? void 0 : y.onNodeDragFinished) ?? (() => {
|
|
3616
|
-
}), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (f = r.mouse) == null ? void 0 : f.dragCursor, d = h !== void 0 ? h : "grab", c = (x = r.mouse) == null ? void 0 : x.mouseDownEventVerifier, u = c !== void 0 ? c : (
|
|
3633
|
+
}), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (f = r.mouse) == null ? void 0 : f.dragCursor, d = h !== void 0 ? h : "grab", c = (x = r.mouse) == null ? void 0 : x.mouseDownEventVerifier, u = c !== void 0 ? c : (N) => N.button === 0, g = (E = r.mouse) == null ? void 0 : E.mouseUpEventVerifier, l = g !== void 0 ? g : (N) => N.button === 0;
|
|
3617
3634
|
return {
|
|
3618
3635
|
moveOnTop: n,
|
|
3619
3636
|
moveEdgesOnTop: a,
|
|
@@ -3626,7 +3643,7 @@ const jt = (r) => {
|
|
|
3626
3643
|
nodeDragVerifier: o,
|
|
3627
3644
|
onNodeDragFinished: s
|
|
3628
3645
|
};
|
|
3629
|
-
},
|
|
3646
|
+
}, _t = (r) => {
|
|
3630
3647
|
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, s = r.maxY !== null ? r.maxY : 1 / 0;
|
|
3631
3648
|
return (n) => {
|
|
3632
3649
|
let a = n.nextTransform.x, h = n.nextTransform.y;
|
|
@@ -3636,7 +3653,7 @@ const jt = (r) => {
|
|
|
3636
3653
|
const u = n.canvasHeight * n.prevTransform.scale, g = s - u;
|
|
3637
3654
|
return h > g && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, g)), { scale: n.nextTransform.scale, x: a, y: h };
|
|
3638
3655
|
};
|
|
3639
|
-
},
|
|
3656
|
+
}, qt = (r) => {
|
|
3640
3657
|
const e = r.maxContentScale, t = r.minContentScale, o = e !== null ? 1 / e : 0, s = t !== null ? 1 / t : 1 / 0;
|
|
3641
3658
|
return (n) => {
|
|
3642
3659
|
const a = n.prevTransform, h = n.nextTransform;
|
|
@@ -3657,7 +3674,7 @@ const jt = (r) => {
|
|
|
3657
3674
|
y: u
|
|
3658
3675
|
};
|
|
3659
3676
|
};
|
|
3660
|
-
},
|
|
3677
|
+
}, er = (r) => (e) => r.reduce(
|
|
3661
3678
|
(t, o) => o({
|
|
3662
3679
|
prevTransform: e.prevTransform,
|
|
3663
3680
|
nextTransform: t,
|
|
@@ -3665,38 +3682,38 @@ const jt = (r) => {
|
|
|
3665
3682
|
canvasHeight: e.canvasHeight
|
|
3666
3683
|
}),
|
|
3667
3684
|
e.nextTransform
|
|
3668
|
-
),
|
|
3685
|
+
), be = (r) => {
|
|
3669
3686
|
if (typeof r == "function")
|
|
3670
3687
|
return r;
|
|
3671
3688
|
switch (r.type) {
|
|
3672
3689
|
case "scale-limit":
|
|
3673
|
-
return
|
|
3690
|
+
return qt({
|
|
3674
3691
|
minContentScale: r.minContentScale ?? 0,
|
|
3675
3692
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
3676
3693
|
});
|
|
3677
3694
|
case "shift-limit":
|
|
3678
|
-
return
|
|
3695
|
+
return _t({
|
|
3679
3696
|
minX: r.minX ?? -1 / 0,
|
|
3680
3697
|
maxX: r.maxX ?? 1 / 0,
|
|
3681
3698
|
minY: r.minY ?? -1 / 0,
|
|
3682
3699
|
maxY: r.maxY ?? 1 / 0
|
|
3683
3700
|
});
|
|
3684
3701
|
}
|
|
3685
|
-
},
|
|
3686
|
-
var p, y, f, x, E,
|
|
3702
|
+
}, Ne = (r) => {
|
|
3703
|
+
var p, y, f, x, E, N, C, T, I, F, U, fe;
|
|
3687
3704
|
const e = (p = r == null ? void 0 : r.scale) == null ? void 0 : p.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, o = r == null ? void 0 : r.transformPreprocessor;
|
|
3688
3705
|
let s;
|
|
3689
|
-
o !== void 0 ? Array.isArray(o) ? s =
|
|
3706
|
+
o !== void 0 ? Array.isArray(o) ? s = er(
|
|
3690
3707
|
o.map(
|
|
3691
|
-
(
|
|
3708
|
+
(R) => be(R)
|
|
3692
3709
|
)
|
|
3693
|
-
) : s =
|
|
3710
|
+
) : s = be(o) : s = (R) => R.nextTransform;
|
|
3694
3711
|
const n = ((y = r == null ? void 0 : r.shift) == null ? void 0 : y.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((f = r == null ? void 0 : r.events) == null ? void 0 : f.onBeforeTransformChange) ?? (() => {
|
|
3695
3712
|
}), h = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onTransformChange) ?? (() => {
|
|
3696
|
-
}), d = (E = r == null ? void 0 : r.shift) == null ? void 0 : E.mouseDownEventVerifier, c = d !== void 0 ? d : (
|
|
3713
|
+
}), d = (E = r == null ? void 0 : r.shift) == null ? void 0 : E.mouseDownEventVerifier, c = d !== void 0 ? d : (R) => R.button === 0, u = (N = r == null ? void 0 : r.shift) == null ? void 0 : N.mouseUpEventVerifier, g = u !== void 0 ? u : (R) => R.button === 0, l = (C = r == null ? void 0 : r.scale) == null ? void 0 : C.mouseWheelEventVerifier, w = l !== void 0 ? l : () => !0;
|
|
3697
3714
|
return {
|
|
3698
3715
|
wheelSensitivity: t,
|
|
3699
|
-
onTransformStarted: ((
|
|
3716
|
+
onTransformStarted: ((T = r == null ? void 0 : r.events) == null ? void 0 : T.onTransformStarted) ?? (() => {
|
|
3700
3717
|
}),
|
|
3701
3718
|
onTransformFinished: ((I = r == null ? void 0 : r.events) == null ? void 0 : I.onTransformFinished) ?? (() => {
|
|
3702
3719
|
}),
|
|
@@ -3710,32 +3727,32 @@ const jt = (r) => {
|
|
|
3710
3727
|
scaleWheelFinishTimeout: ((F = r == null ? void 0 : r.scale) == null ? void 0 : F.wheelFinishTimeout) ?? 500,
|
|
3711
3728
|
onResizeTransformStarted: ((U = r == null ? void 0 : r.events) == null ? void 0 : U.onResizeTransformStarted) ?? (() => {
|
|
3712
3729
|
}),
|
|
3713
|
-
onResizeTransformFinished: ((
|
|
3730
|
+
onResizeTransformFinished: ((fe = r == null ? void 0 : r.events) == null ? void 0 : fe.onResizeTransformFinished) ?? (() => {
|
|
3714
3731
|
})
|
|
3715
3732
|
};
|
|
3716
|
-
},
|
|
3733
|
+
}, tr = (r, e) => {
|
|
3717
3734
|
const t = document.createElementNS(
|
|
3718
3735
|
"http://www.w3.org/2000/svg",
|
|
3719
3736
|
"circle"
|
|
3720
3737
|
);
|
|
3721
3738
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
3722
|
-
},
|
|
3739
|
+
}, rr = (r) => r instanceof SVGElement ? r : tr(
|
|
3723
3740
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
3724
3741
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
3725
|
-
),
|
|
3726
|
-
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s =
|
|
3742
|
+
), or = (r) => {
|
|
3743
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, o = (e == null ? void 0 : e.height) ?? 25, s = rr(r.renderer ?? {});
|
|
3727
3744
|
return {
|
|
3728
3745
|
tileWidth: t,
|
|
3729
3746
|
tileHeight: o,
|
|
3730
3747
|
renderer: s,
|
|
3731
3748
|
maxViewportScale: r.maxViewportScale ?? 10
|
|
3732
3749
|
};
|
|
3733
|
-
},
|
|
3750
|
+
}, ye = (r) => {
|
|
3734
3751
|
if (typeof r == "function")
|
|
3735
3752
|
return r;
|
|
3736
3753
|
switch (r.type) {
|
|
3737
3754
|
case "straight":
|
|
3738
|
-
return () => new
|
|
3755
|
+
return () => new Vt({
|
|
3739
3756
|
color: r.color,
|
|
3740
3757
|
width: r.width,
|
|
3741
3758
|
arrowLength: r.arrowLength,
|
|
@@ -3749,7 +3766,7 @@ const jt = (r) => {
|
|
|
3749
3766
|
detourDirection: r.detourDirection
|
|
3750
3767
|
});
|
|
3751
3768
|
case "horizontal":
|
|
3752
|
-
return () => new
|
|
3769
|
+
return () => new Lt({
|
|
3753
3770
|
color: r.color,
|
|
3754
3771
|
width: r.width,
|
|
3755
3772
|
arrowLength: r.arrowLength,
|
|
@@ -3762,7 +3779,7 @@ const jt = (r) => {
|
|
|
3762
3779
|
detourDistance: r.detourDistance
|
|
3763
3780
|
});
|
|
3764
3781
|
case "vertical":
|
|
3765
|
-
return () => new
|
|
3782
|
+
return () => new It({
|
|
3766
3783
|
color: r.color,
|
|
3767
3784
|
width: r.width,
|
|
3768
3785
|
arrowLength: r.arrowLength,
|
|
@@ -3775,7 +3792,7 @@ const jt = (r) => {
|
|
|
3775
3792
|
detourDistance: r.detourDistance
|
|
3776
3793
|
});
|
|
3777
3794
|
case "direct":
|
|
3778
|
-
return () => new
|
|
3795
|
+
return () => new $e({
|
|
3779
3796
|
color: r.color,
|
|
3780
3797
|
width: r.width,
|
|
3781
3798
|
arrowLength: r.arrowLength,
|
|
@@ -3786,7 +3803,7 @@ const jt = (r) => {
|
|
|
3786
3803
|
targetOffset: r.targetOffset
|
|
3787
3804
|
});
|
|
3788
3805
|
default:
|
|
3789
|
-
return () => new
|
|
3806
|
+
return () => new Rt({
|
|
3790
3807
|
color: r.color,
|
|
3791
3808
|
width: r.width,
|
|
3792
3809
|
arrowLength: r.arrowLength,
|
|
@@ -3800,7 +3817,7 @@ const jt = (r) => {
|
|
|
3800
3817
|
detourDirection: r.detourDirection
|
|
3801
3818
|
});
|
|
3802
3819
|
}
|
|
3803
|
-
},
|
|
3820
|
+
}, sr = (r, e, t) => {
|
|
3804
3821
|
var c, u, g;
|
|
3805
3822
|
const o = () => "direct", s = (l) => l, n = (l) => l.button === 0, a = () => {
|
|
3806
3823
|
}, h = () => {
|
|
@@ -3815,9 +3832,9 @@ const jt = (r) => {
|
|
|
3815
3832
|
onEdgeCreationInterrupted: ((u = r.events) == null ? void 0 : u.onEdgeCreationInterrupted) ?? d,
|
|
3816
3833
|
onEdgeCreationPrevented: ((g = r.events) == null ? void 0 : g.onEdgeCreationPrevented) ?? h,
|
|
3817
3834
|
dragPortDirection: r.dragPortDirection ?? t,
|
|
3818
|
-
edgeShapeFactory: r.edgeShape !== void 0 ?
|
|
3835
|
+
edgeShapeFactory: r.edgeShape !== void 0 ? ye(r.edgeShape) : e
|
|
3819
3836
|
};
|
|
3820
|
-
},
|
|
3837
|
+
}, ir = (r, e) => {
|
|
3821
3838
|
var c, u, g;
|
|
3822
3839
|
const t = (l) => l, o = (l) => l.button === 0 && l.ctrlKey, s = (l) => l.button === 0, n = (l) => {
|
|
3823
3840
|
const w = e.getPortAdjacentEdgeIds(l);
|
|
@@ -3831,15 +3848,15 @@ const jt = (r) => {
|
|
|
3831
3848
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? o,
|
|
3832
3849
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? s,
|
|
3833
3850
|
draggingEdgeResolver: r.draggingEdgeResolver ?? n,
|
|
3834
|
-
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ?
|
|
3851
|
+
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? ye(r.draggingEdgeShape) : null,
|
|
3835
3852
|
onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
|
|
3836
3853
|
onEdgeReattachInterrupted: ((u = r.events) == null ? void 0 : u.onEdgeReattachInterrupted) ?? d,
|
|
3837
3854
|
onEdgeReattachPrevented: ((g = r.events) == null ? void 0 : g.onEdgeReattachPrevented) ?? h
|
|
3838
3855
|
};
|
|
3839
|
-
},
|
|
3856
|
+
}, nr = (r) => ({
|
|
3840
3857
|
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
3841
3858
|
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
3842
|
-
}),
|
|
3859
|
+
}), ar = (r) => {
|
|
3843
3860
|
var e, t;
|
|
3844
3861
|
return {
|
|
3845
3862
|
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
|
|
@@ -3848,13 +3865,13 @@ const jt = (r) => {
|
|
|
3848
3865
|
})
|
|
3849
3866
|
};
|
|
3850
3867
|
};
|
|
3851
|
-
class
|
|
3868
|
+
class hr extends Error {
|
|
3852
3869
|
constructor() {
|
|
3853
3870
|
super(...arguments);
|
|
3854
3871
|
i(this, "name", "CanvasBuilderError");
|
|
3855
3872
|
}
|
|
3856
3873
|
}
|
|
3857
|
-
class
|
|
3874
|
+
class Ge {
|
|
3858
3875
|
constructor(e, t, o) {
|
|
3859
3876
|
i(this, "dt");
|
|
3860
3877
|
i(this, "nodeMass");
|
|
@@ -3892,7 +3909,7 @@ class Ye {
|
|
|
3892
3909
|
});
|
|
3893
3910
|
}
|
|
3894
3911
|
}
|
|
3895
|
-
class
|
|
3912
|
+
class je {
|
|
3896
3913
|
constructor(e) {
|
|
3897
3914
|
i(this, "PI2", 2 * Math.PI);
|
|
3898
3915
|
this.rand = e;
|
|
@@ -3911,13 +3928,13 @@ class Xe {
|
|
|
3911
3928
|
return { ex: h, ey: d, d: a };
|
|
3912
3929
|
}
|
|
3913
3930
|
}
|
|
3914
|
-
const
|
|
3931
|
+
const Je = (r) => {
|
|
3915
3932
|
if (r.distance === 0)
|
|
3916
3933
|
return r.maxForce;
|
|
3917
3934
|
const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
|
|
3918
3935
|
return Math.min(e, r.maxForce);
|
|
3919
3936
|
};
|
|
3920
|
-
class
|
|
3937
|
+
class dr {
|
|
3921
3938
|
constructor(e) {
|
|
3922
3939
|
i(this, "nodeCharge");
|
|
3923
3940
|
i(this, "distanceVectorGenerator");
|
|
@@ -3932,7 +3949,7 @@ class ir {
|
|
|
3932
3949
|
const d = o[h], c = e.get(a), u = e.get(d), g = this.distanceVectorGenerator.create(
|
|
3933
3950
|
c,
|
|
3934
3951
|
u
|
|
3935
|
-
), l =
|
|
3952
|
+
), l = Je({
|
|
3936
3953
|
coefficient: 1,
|
|
3937
3954
|
sourceCharge: this.nodeCharge,
|
|
3938
3955
|
targetCharge: this.nodeCharge,
|
|
@@ -3944,7 +3961,7 @@ class ir {
|
|
|
3944
3961
|
}
|
|
3945
3962
|
}
|
|
3946
3963
|
}
|
|
3947
|
-
const
|
|
3964
|
+
const cr = (r) => {
|
|
3948
3965
|
if (r.size === 0)
|
|
3949
3966
|
return {
|
|
3950
3967
|
centerX: 0,
|
|
@@ -3962,7 +3979,7 @@ const nr = (r) => {
|
|
|
3962
3979
|
radius: h / 2
|
|
3963
3980
|
};
|
|
3964
3981
|
};
|
|
3965
|
-
class
|
|
3982
|
+
class lr {
|
|
3966
3983
|
constructor(e) {
|
|
3967
3984
|
i(this, "root");
|
|
3968
3985
|
i(this, "leaves", /* @__PURE__ */ new Map());
|
|
@@ -4119,7 +4136,7 @@ class ar {
|
|
|
4119
4136
|
}), { x: t / e.size, y: o / e.size };
|
|
4120
4137
|
}
|
|
4121
4138
|
}
|
|
4122
|
-
class
|
|
4139
|
+
class ur {
|
|
4123
4140
|
constructor(e) {
|
|
4124
4141
|
i(this, "areaRadiusThreshold");
|
|
4125
4142
|
i(this, "nodeMass");
|
|
@@ -4131,7 +4148,7 @@ class hr {
|
|
|
4131
4148
|
this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.theta = e.theta, this.distanceVectorGenerator = e.distanceVectorGenerator, this.nodeForceCoefficient = e.nodeForceCoefficient, this.maxForce = e.maxForce;
|
|
4132
4149
|
}
|
|
4133
4150
|
apply(e, t) {
|
|
4134
|
-
const o =
|
|
4151
|
+
const o = cr(e), s = new lr({
|
|
4135
4152
|
box: o,
|
|
4136
4153
|
coords: e,
|
|
4137
4154
|
areaRadiusThreshold: this.areaRadiusThreshold,
|
|
@@ -4246,7 +4263,7 @@ class hr {
|
|
|
4246
4263
|
const t = this.distanceVectorGenerator.create(
|
|
4247
4264
|
e.sourceCoords,
|
|
4248
4265
|
e.targetCoords
|
|
4249
|
-
), o =
|
|
4266
|
+
), o = Je({
|
|
4250
4267
|
coefficient: this.nodeForceCoefficient,
|
|
4251
4268
|
sourceCharge: e.sourceCharge,
|
|
4252
4269
|
targetCharge: e.targetCharge,
|
|
@@ -4281,7 +4298,7 @@ class hr {
|
|
|
4281
4298
|
}
|
|
4282
4299
|
}
|
|
4283
4300
|
}
|
|
4284
|
-
const
|
|
4301
|
+
const Ke = (r) => r.theta !== 0 ? new ur({
|
|
4285
4302
|
nodeCharge: r.nodeCharge,
|
|
4286
4303
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
4287
4304
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
@@ -4289,13 +4306,13 @@ const Ge = (r) => r.theta !== 0 ? new hr({
|
|
|
4289
4306
|
theta: r.theta,
|
|
4290
4307
|
nodeMass: r.nodeMass,
|
|
4291
4308
|
areaRadiusThreshold: r.areaRadiusThreshold
|
|
4292
|
-
}) : new
|
|
4309
|
+
}) : new dr({
|
|
4293
4310
|
nodeCharge: r.nodeCharge,
|
|
4294
4311
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
4295
4312
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
4296
4313
|
maxForce: r.maxForce
|
|
4297
4314
|
});
|
|
4298
|
-
class
|
|
4315
|
+
class Qe {
|
|
4299
4316
|
constructor(e) {
|
|
4300
4317
|
i(this, "rand");
|
|
4301
4318
|
i(this, "sparsity");
|
|
@@ -4318,7 +4335,7 @@ class je {
|
|
|
4318
4335
|
}), s;
|
|
4319
4336
|
}
|
|
4320
4337
|
}
|
|
4321
|
-
class
|
|
4338
|
+
class gr {
|
|
4322
4339
|
constructor(e) {
|
|
4323
4340
|
i(this, "distanceVectorGenerator");
|
|
4324
4341
|
i(this, "nodeForcesApplicationStrategy");
|
|
@@ -4329,7 +4346,7 @@ class dr {
|
|
|
4329
4346
|
i(this, "edgeEquilibriumLength");
|
|
4330
4347
|
i(this, "edgeStiffness");
|
|
4331
4348
|
i(this, "convergenceVelocity");
|
|
4332
|
-
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new
|
|
4349
|
+
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new je(e.rand), this.nodeForcesApplicationStrategy = Ke({
|
|
4333
4350
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4334
4351
|
nodeCharge: e.nodeCharge,
|
|
4335
4352
|
maxForce: e.maxForce,
|
|
@@ -4337,7 +4354,7 @@ class dr {
|
|
|
4337
4354
|
theta: e.barnesHutTheta,
|
|
4338
4355
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4339
4356
|
nodeMass: e.nodeMass
|
|
4340
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4357
|
+
}), this.fillerLayoutAlgorithm = new Qe({
|
|
4341
4358
|
rand: e.rand,
|
|
4342
4359
|
sparsity: e.edgeEquilibriumLength
|
|
4343
4360
|
});
|
|
@@ -4347,7 +4364,7 @@ class dr {
|
|
|
4347
4364
|
graph: t,
|
|
4348
4365
|
viewport: o
|
|
4349
4366
|
});
|
|
4350
|
-
for (let n = 0; n < this.maxIterations && !(new
|
|
4367
|
+
for (let n = 0; n < this.maxIterations && !(new Ge(
|
|
4351
4368
|
t,
|
|
4352
4369
|
s,
|
|
4353
4370
|
{
|
|
@@ -4363,7 +4380,7 @@ class dr {
|
|
|
4363
4380
|
return s;
|
|
4364
4381
|
}
|
|
4365
4382
|
}
|
|
4366
|
-
class
|
|
4383
|
+
class pr {
|
|
4367
4384
|
constructor(e, t) {
|
|
4368
4385
|
i(this, "forest", /* @__PURE__ */ new Set());
|
|
4369
4386
|
i(this, "remainingNodeIds");
|
|
@@ -4404,7 +4421,7 @@ class cr {
|
|
|
4404
4421
|
}
|
|
4405
4422
|
}
|
|
4406
4423
|
}
|
|
4407
|
-
class
|
|
4424
|
+
class wr {
|
|
4408
4425
|
constructor(e) {
|
|
4409
4426
|
this.params = e;
|
|
4410
4427
|
}
|
|
@@ -4445,12 +4462,12 @@ class lr {
|
|
|
4445
4462
|
return o - 2 * this.params.spaceAroundRadius;
|
|
4446
4463
|
}
|
|
4447
4464
|
}
|
|
4448
|
-
class
|
|
4465
|
+
class yr {
|
|
4449
4466
|
constructor(e, t) {
|
|
4450
4467
|
i(this, "offsets", /* @__PURE__ */ new Map());
|
|
4451
4468
|
i(this, "treeSpans", /* @__PURE__ */ new Map());
|
|
4452
4469
|
this.tree = e;
|
|
4453
|
-
const o = t.spaceAroundRadius, s = new
|
|
4470
|
+
const o = t.spaceAroundRadius, s = new wr({
|
|
4454
4471
|
spaceAroundRadius: o
|
|
4455
4472
|
});
|
|
4456
4473
|
[...this.tree.sequence].reverse().forEach((n) => {
|
|
@@ -4472,19 +4489,19 @@ class ur {
|
|
|
4472
4489
|
return this.offsets;
|
|
4473
4490
|
}
|
|
4474
4491
|
}
|
|
4475
|
-
class
|
|
4492
|
+
class fr {
|
|
4476
4493
|
constructor(e) {
|
|
4477
4494
|
this.params = e;
|
|
4478
4495
|
}
|
|
4479
4496
|
calculateCoordinates(e) {
|
|
4480
|
-
const t = /* @__PURE__ */ new Map(), s = new
|
|
4497
|
+
const t = /* @__PURE__ */ new Map(), s = new pr(
|
|
4481
4498
|
e.graph,
|
|
4482
4499
|
this.params.nextLayerNodesResolver
|
|
4483
4500
|
).generate();
|
|
4484
4501
|
let n = 0;
|
|
4485
4502
|
return s.forEach((a) => {
|
|
4486
4503
|
t.set(a.root.nodeId, { x: n, y: 0 });
|
|
4487
|
-
const d = new
|
|
4504
|
+
const d = new yr(a, {
|
|
4488
4505
|
spaceAroundRadius: this.params.layerSpace / 2
|
|
4489
4506
|
}).generate();
|
|
4490
4507
|
let c = [a.root];
|
|
@@ -4505,7 +4522,7 @@ class gr {
|
|
|
4505
4522
|
}), t;
|
|
4506
4523
|
}
|
|
4507
4524
|
}
|
|
4508
|
-
const
|
|
4525
|
+
const vr = (r) => {
|
|
4509
4526
|
const { graph: e, currentNodeId: t } = r, o = e.getNodeOutgoingEdgeIds(t).map((n) => {
|
|
4510
4527
|
const a = e.getEdge(n);
|
|
4511
4528
|
return e.getPort(a.to).nodeId;
|
|
@@ -4514,20 +4531,20 @@ const pr = (r) => {
|
|
|
4514
4531
|
return e.getPort(a.from).nodeId;
|
|
4515
4532
|
});
|
|
4516
4533
|
return /* @__PURE__ */ new Set([...o, ...s]);
|
|
4517
|
-
},
|
|
4534
|
+
}, mr = (r) => {
|
|
4518
4535
|
const { graph: e, currentNodeId: t } = r, o = e.getNodeOutgoingEdgeIds(t).map((s) => {
|
|
4519
4536
|
const n = e.getEdge(s);
|
|
4520
4537
|
return e.getPort(n.to).nodeId;
|
|
4521
4538
|
});
|
|
4522
4539
|
return new Set(o);
|
|
4523
|
-
},
|
|
4540
|
+
}, xr = (r) => {
|
|
4524
4541
|
const { graph: e, currentNodeId: t } = r, o = e.getNodeIncomingEdgeIds(t).map((s) => {
|
|
4525
4542
|
const n = e.getEdge(s);
|
|
4526
4543
|
return e.getPort(n.from).nodeId;
|
|
4527
4544
|
});
|
|
4528
4545
|
return new Set(o);
|
|
4529
4546
|
};
|
|
4530
|
-
class
|
|
4547
|
+
class Er {
|
|
4531
4548
|
constructor(e) {
|
|
4532
4549
|
i(this, "distanceVectorGenerator");
|
|
4533
4550
|
i(this, "nodeForcesApplicationStrategy");
|
|
@@ -4537,7 +4554,7 @@ class fr {
|
|
|
4537
4554
|
i(this, "edgeEquilibriumLength");
|
|
4538
4555
|
i(this, "edgeStiffness");
|
|
4539
4556
|
i(this, "fillerLayoutAlgorithm");
|
|
4540
|
-
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new
|
|
4557
|
+
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new je(e.rand), this.nodeForcesApplicationStrategy = Ke({
|
|
4541
4558
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4542
4559
|
nodeCharge: e.nodeCharge,
|
|
4543
4560
|
maxForce: e.maxForce,
|
|
@@ -4545,7 +4562,7 @@ class fr {
|
|
|
4545
4562
|
theta: e.barnesHutTheta,
|
|
4546
4563
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4547
4564
|
nodeMass: e.nodeMass
|
|
4548
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4565
|
+
}), this.fillerLayoutAlgorithm = new Qe({
|
|
4549
4566
|
rand: e.rand,
|
|
4550
4567
|
sparsity: e.edgeEquilibriumLength
|
|
4551
4568
|
});
|
|
@@ -4555,7 +4572,7 @@ class fr {
|
|
|
4555
4572
|
graph: t,
|
|
4556
4573
|
viewport: o
|
|
4557
4574
|
});
|
|
4558
|
-
return new
|
|
4575
|
+
return new Ge(
|
|
4559
4576
|
t,
|
|
4560
4577
|
n,
|
|
4561
4578
|
{
|
|
@@ -4572,16 +4589,16 @@ class fr {
|
|
|
4572
4589
|
}) ? /* @__PURE__ */ new Map() : n;
|
|
4573
4590
|
}
|
|
4574
4591
|
}
|
|
4575
|
-
const
|
|
4592
|
+
const Ze = (r) => {
|
|
4576
4593
|
let e = 1779033703, t = 3144134277, o = 1013904242, s = 2773480762;
|
|
4577
4594
|
for (let n = 0, a; n < r.length; n++)
|
|
4578
4595
|
a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = o ^ Math.imul(t ^ a, 2869860233), o = s ^ Math.imul(o ^ a, 951274213), s = e ^ Math.imul(s ^ a, 2716044179);
|
|
4579
4596
|
return e = Math.imul(o ^ e >>> 18, 597399067), t = Math.imul(s ^ t >>> 22, 2869860233), o = Math.imul(e ^ o >>> 17, 951274213), s = Math.imul(t ^ s >>> 19, 2716044179), e ^= t ^ o ^ s, t ^= e, o ^= e, s ^= e, [e >>> 0, t >>> 0, o >>> 0, s >>> 0];
|
|
4580
|
-
},
|
|
4597
|
+
}, _e = (r, e, t, o) => function() {
|
|
4581
4598
|
r |= 0, e |= 0, t |= 0, o |= 0;
|
|
4582
4599
|
const s = (r + e | 0) + o | 0;
|
|
4583
4600
|
return o = o + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + s | 0, (s >>> 0) / 4294967296;
|
|
4584
|
-
},
|
|
4601
|
+
}, b = Object.freeze({
|
|
4585
4602
|
seed: "HTMLGraph is awesome",
|
|
4586
4603
|
maxTimeDeltaSec: 0.01,
|
|
4587
4604
|
nodeCharge: 1e5,
|
|
@@ -4595,29 +4612,29 @@ const Je = (r) => {
|
|
|
4595
4612
|
nodeForceCoefficient: 1,
|
|
4596
4613
|
barnesHutAreaRadiusThreshold: 0.01,
|
|
4597
4614
|
barnesHutTheta: 1
|
|
4598
|
-
}),
|
|
4615
|
+
}), D = Object.freeze({
|
|
4599
4616
|
mouseDownEventVerifier: (r) => r.button === 0,
|
|
4600
4617
|
mouseUpEventVerifier: (r) => r.button === 0,
|
|
4601
4618
|
movementThreshold: 10
|
|
4602
|
-
}),
|
|
4619
|
+
}), Ar = (r) => {
|
|
4603
4620
|
var e, t;
|
|
4604
4621
|
switch (r == null ? void 0 : r.type) {
|
|
4605
4622
|
case "custom":
|
|
4606
4623
|
return r.instance;
|
|
4607
4624
|
default: {
|
|
4608
|
-
const o =
|
|
4609
|
-
return new
|
|
4625
|
+
const o = Ze((r == null ? void 0 : r.seed) ?? b.seed), s = _e(o[0], o[1], o[2], o[3]);
|
|
4626
|
+
return new Er({
|
|
4610
4627
|
rand: s,
|
|
4611
|
-
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ??
|
|
4612
|
-
nodeCharge: (r == null ? void 0 : r.nodeCharge) ??
|
|
4613
|
-
nodeMass: (r == null ? void 0 : r.nodeMass) ??
|
|
4614
|
-
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ??
|
|
4615
|
-
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ??
|
|
4616
|
-
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ??
|
|
4617
|
-
maxForce: (r == null ? void 0 : r.maxForce) ??
|
|
4618
|
-
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ??
|
|
4619
|
-
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ??
|
|
4620
|
-
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ??
|
|
4628
|
+
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? b.maxTimeDeltaSec,
|
|
4629
|
+
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? b.nodeCharge,
|
|
4630
|
+
nodeMass: (r == null ? void 0 : r.nodeMass) ?? b.nodeMass,
|
|
4631
|
+
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? b.edgeEquilibriumLength,
|
|
4632
|
+
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? b.edgeStiffness,
|
|
4633
|
+
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? b.convergenceVelocity,
|
|
4634
|
+
maxForce: (r == null ? void 0 : r.maxForce) ?? b.maxForce,
|
|
4635
|
+
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? b.nodeForceCoefficient,
|
|
4636
|
+
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? b.barnesHutTheta,
|
|
4637
|
+
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? b.barnesHutAreaRadiusThreshold
|
|
4621
4638
|
});
|
|
4622
4639
|
}
|
|
4623
4640
|
}
|
|
@@ -4627,23 +4644,23 @@ const Je = (r) => {
|
|
|
4627
4644
|
},
|
|
4628
4645
|
onAfterApplied: () => {
|
|
4629
4646
|
}
|
|
4630
|
-
},
|
|
4647
|
+
}, Sr = (r) => {
|
|
4631
4648
|
var t, o;
|
|
4632
4649
|
return {
|
|
4633
|
-
algorithm:
|
|
4650
|
+
algorithm: Ar((r == null ? void 0 : r.algorithm) ?? {}),
|
|
4634
4651
|
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? K.staticNodeResolver,
|
|
4635
4652
|
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? K.onBeforeApplied,
|
|
4636
4653
|
onAfterApplied: ((o = r == null ? void 0 : r.events) == null ? void 0 : o.onAfterApplied) ?? K.onAfterApplied
|
|
4637
4654
|
};
|
|
4638
|
-
},
|
|
4655
|
+
}, br = (r) => r instanceof _ ? {
|
|
4639
4656
|
type: "trigger",
|
|
4640
4657
|
trigger: r
|
|
4641
4658
|
} : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
|
|
4642
4659
|
type: "topologyChangeSchedule",
|
|
4643
|
-
schedule:
|
|
4660
|
+
schedule: Bt
|
|
4644
4661
|
} : {
|
|
4645
4662
|
type: "topologyChangeSchedule",
|
|
4646
|
-
schedule:
|
|
4663
|
+
schedule: Ot
|
|
4647
4664
|
}, $ = Object.freeze({
|
|
4648
4665
|
staticNodeResolver: () => !1,
|
|
4649
4666
|
onBeforeApplied: () => {
|
|
@@ -4661,7 +4678,7 @@ const Je = (r) => {
|
|
|
4661
4678
|
d: r.d * e.a + r.e * e.d,
|
|
4662
4679
|
e: r.d * e.b + r.e * e.e,
|
|
4663
4680
|
f: r.d * e.c + r.e * e.f + r.f
|
|
4664
|
-
}),
|
|
4681
|
+
}), Nr = (r) => {
|
|
4665
4682
|
const { a: e, b: t, c: o, d: s, e: n, f: a } = r, h = e * n - t * s;
|
|
4666
4683
|
return {
|
|
4667
4684
|
a: n / h,
|
|
@@ -4672,7 +4689,7 @@ const Je = (r) => {
|
|
|
4672
4689
|
f: (o * s - e * a) / h
|
|
4673
4690
|
};
|
|
4674
4691
|
};
|
|
4675
|
-
class
|
|
4692
|
+
class Pr {
|
|
4676
4693
|
resolve(e) {
|
|
4677
4694
|
if ("shift" in e)
|
|
4678
4695
|
return this.createShiftBaseMatrix(e.shift);
|
|
@@ -4716,7 +4733,7 @@ class Ar {
|
|
|
4716
4733
|
const o = z(
|
|
4717
4734
|
t,
|
|
4718
4735
|
e
|
|
4719
|
-
), s =
|
|
4736
|
+
), s = Nr(t);
|
|
4720
4737
|
return z(o, s);
|
|
4721
4738
|
}
|
|
4722
4739
|
createShiftBaseMatrix(e) {
|
|
@@ -4761,7 +4778,7 @@ class Ar {
|
|
|
4761
4778
|
};
|
|
4762
4779
|
}
|
|
4763
4780
|
}
|
|
4764
|
-
const
|
|
4781
|
+
const Cr = (r) => {
|
|
4765
4782
|
if (r === void 0)
|
|
4766
4783
|
return (s) => s;
|
|
4767
4784
|
if (typeof r == "function")
|
|
@@ -4775,7 +4792,7 @@ const Sr = (r) => {
|
|
|
4775
4792
|
e: 1,
|
|
4776
4793
|
f: 0
|
|
4777
4794
|
};
|
|
4778
|
-
const o = new
|
|
4795
|
+
const o = new Pr();
|
|
4779
4796
|
return e.forEach((s) => {
|
|
4780
4797
|
const n = o.resolve(s);
|
|
4781
4798
|
t = z(t, n);
|
|
@@ -4786,59 +4803,59 @@ const Sr = (r) => {
|
|
|
4786
4803
|
y: t.d * n + t.e * a + t.f
|
|
4787
4804
|
};
|
|
4788
4805
|
};
|
|
4789
|
-
},
|
|
4806
|
+
}, Tr = (r) => {
|
|
4790
4807
|
if (typeof r == "function")
|
|
4791
4808
|
return r;
|
|
4792
4809
|
switch (r) {
|
|
4793
4810
|
case "outgoing":
|
|
4794
|
-
return
|
|
4811
|
+
return mr;
|
|
4795
4812
|
case "incoming":
|
|
4796
|
-
return
|
|
4813
|
+
return xr;
|
|
4797
4814
|
default:
|
|
4798
|
-
return
|
|
4815
|
+
return vr;
|
|
4799
4816
|
}
|
|
4800
|
-
},
|
|
4817
|
+
}, Mr = (r) => {
|
|
4801
4818
|
var e, t;
|
|
4802
4819
|
switch (r == null ? void 0 : r.type) {
|
|
4803
4820
|
case "custom":
|
|
4804
4821
|
return r.instance;
|
|
4805
4822
|
case "hierarchical":
|
|
4806
|
-
return new
|
|
4823
|
+
return new fr({
|
|
4807
4824
|
layerWidth: r.layerWidth ?? $.hierarchicalLayout.layerWidth,
|
|
4808
4825
|
layerSpace: r.layerSpace ?? $.hierarchicalLayout.layerSpace,
|
|
4809
|
-
transform:
|
|
4810
|
-
nextLayerNodesResolver:
|
|
4826
|
+
transform: Cr(r.transform),
|
|
4827
|
+
nextLayerNodesResolver: Tr(
|
|
4811
4828
|
r.nextLayerNodesResolver
|
|
4812
4829
|
)
|
|
4813
4830
|
});
|
|
4814
4831
|
default: {
|
|
4815
|
-
const o =
|
|
4816
|
-
return new
|
|
4817
|
-
dtSec: (r == null ? void 0 : r.dtSec) ??
|
|
4818
|
-
maxIterations: (r == null ? void 0 : r.maxIterations) ??
|
|
4832
|
+
const o = Ze((r == null ? void 0 : r.seed) ?? b.seed), s = _e(o[0], o[1], o[2], o[3]);
|
|
4833
|
+
return new gr({
|
|
4834
|
+
dtSec: (r == null ? void 0 : r.dtSec) ?? b.dtSec,
|
|
4835
|
+
maxIterations: (r == null ? void 0 : r.maxIterations) ?? b.maxIterations,
|
|
4819
4836
|
rand: s,
|
|
4820
|
-
nodeCharge: (r == null ? void 0 : r.nodeCharge) ??
|
|
4821
|
-
nodeMass: (r == null ? void 0 : r.nodeMass) ??
|
|
4822
|
-
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ??
|
|
4823
|
-
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ??
|
|
4824
|
-
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ??
|
|
4825
|
-
maxForce: (r == null ? void 0 : r.maxForce) ??
|
|
4826
|
-
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ??
|
|
4827
|
-
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ??
|
|
4828
|
-
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ??
|
|
4837
|
+
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? b.nodeCharge,
|
|
4838
|
+
nodeMass: (r == null ? void 0 : r.nodeMass) ?? b.nodeMass,
|
|
4839
|
+
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? b.edgeEquilibriumLength,
|
|
4840
|
+
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? b.edgeStiffness,
|
|
4841
|
+
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? b.convergenceVelocity,
|
|
4842
|
+
maxForce: (r == null ? void 0 : r.maxForce) ?? b.maxForce,
|
|
4843
|
+
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? b.nodeForceCoefficient,
|
|
4844
|
+
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? b.barnesHutTheta,
|
|
4845
|
+
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? b.barnesHutAreaRadiusThreshold
|
|
4829
4846
|
});
|
|
4830
4847
|
}
|
|
4831
4848
|
}
|
|
4832
|
-
},
|
|
4849
|
+
}, Dr = (r) => {
|
|
4833
4850
|
var e, t;
|
|
4834
4851
|
return {
|
|
4835
|
-
algorithm:
|
|
4836
|
-
applyOn:
|
|
4852
|
+
algorithm: Mr(r.algorithm),
|
|
4853
|
+
applyOn: br(r.applyOn),
|
|
4837
4854
|
staticNodeResolver: r.staticNodeResolver ?? $.staticNodeResolver,
|
|
4838
4855
|
onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ?? $.onBeforeApplied,
|
|
4839
4856
|
onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ?? $.onAfterApplied
|
|
4840
4857
|
};
|
|
4841
|
-
},
|
|
4858
|
+
}, Rr = (r, e) => ({
|
|
4842
4859
|
...r,
|
|
4843
4860
|
onNodeDragStarted: (t) => {
|
|
4844
4861
|
e.add(t), r.onNodeDragStarted(t);
|
|
@@ -4846,7 +4863,7 @@ const Sr = (r) => {
|
|
|
4846
4863
|
onNodeDragFinished: (t) => {
|
|
4847
4864
|
e.delete(t), r.onNodeDragFinished(t);
|
|
4848
4865
|
}
|
|
4849
|
-
}),
|
|
4866
|
+
}), Lr = (r, e) => {
|
|
4850
4867
|
r.graph.onBeforeNodeRemoved.subscribe((t) => {
|
|
4851
4868
|
e.delete(t);
|
|
4852
4869
|
}), r.graph.onBeforeClear.subscribe(() => {
|
|
@@ -4854,41 +4871,41 @@ const Sr = (r) => {
|
|
|
4854
4871
|
}), r.onBeforeDestroy.subscribe(() => {
|
|
4855
4872
|
e.clear();
|
|
4856
4873
|
});
|
|
4857
|
-
},
|
|
4874
|
+
}, Vr = (r, e) => ({
|
|
4858
4875
|
...r,
|
|
4859
4876
|
staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
|
|
4860
|
-
}), Z = (r) => () => r,
|
|
4877
|
+
}), Z = (r) => () => r, Pe = Z(0), Ir = () => {
|
|
4861
4878
|
let r = 0;
|
|
4862
4879
|
return () => r++;
|
|
4863
|
-
},
|
|
4864
|
-
let t =
|
|
4865
|
-
const s =
|
|
4880
|
+
}, Fr = (r, e) => {
|
|
4881
|
+
let t = Pe, o = Pe;
|
|
4882
|
+
const s = Ir();
|
|
4866
4883
|
return r === "incremental" && (t = s), e === "incremental" && (o = s), typeof r == "number" && (t = Z(r)), typeof e == "number" && (o = Z(e)), typeof r == "function" && (t = r), typeof e == "function" && (o = e), {
|
|
4867
4884
|
nodesPriorityFn: t,
|
|
4868
4885
|
edgesPriorityFn: o
|
|
4869
4886
|
};
|
|
4870
|
-
},
|
|
4887
|
+
}, Ur = (r) => {
|
|
4871
4888
|
var t, o, s, n, a;
|
|
4872
|
-
const e =
|
|
4889
|
+
const e = Fr(
|
|
4873
4890
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
4874
4891
|
(o = r.edges) == null ? void 0 : o.priority
|
|
4875
4892
|
);
|
|
4876
4893
|
return {
|
|
4877
4894
|
nodes: {
|
|
4878
|
-
centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ??
|
|
4895
|
+
centerFn: ((s = r.nodes) == null ? void 0 : s.centerFn) ?? Le,
|
|
4879
4896
|
priorityFn: e.nodesPriorityFn
|
|
4880
4897
|
},
|
|
4881
4898
|
ports: {
|
|
4882
4899
|
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
4883
4900
|
},
|
|
4884
4901
|
edges: {
|
|
4885
|
-
shapeFactory:
|
|
4902
|
+
shapeFactory: ye(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
|
|
4886
4903
|
priorityFn: e.edgesPriorityFn
|
|
4887
4904
|
}
|
|
4888
4905
|
};
|
|
4889
|
-
},
|
|
4906
|
+
}, $r = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : re, Br = (r) => {
|
|
4890
4907
|
var o, s, n, a;
|
|
4891
|
-
const { canvasDefaults: e } = r, t = r.hasLayout ?
|
|
4908
|
+
const { canvasDefaults: e } = r, t = r.hasLayout ? $r(r.layoutParams) : re;
|
|
4892
4909
|
return {
|
|
4893
4910
|
focus: {
|
|
4894
4911
|
contentPadding: ((o = e.focus) == null ? void 0 : o.contentPadding) ?? ((s = e.focus) == null ? void 0 : s.contentOffset) ?? 100,
|
|
@@ -4897,18 +4914,23 @@ const Sr = (r) => {
|
|
|
4897
4914
|
animationDuration: ((a = e.focus) == null ? void 0 : a.animationDuration) ?? 0
|
|
4898
4915
|
}
|
|
4899
4916
|
};
|
|
4900
|
-
},
|
|
4917
|
+
}, Or = (r) => ({
|
|
4901
4918
|
onNodeSelected: r.onNodeSelected,
|
|
4902
|
-
mouseDownEventVerifier: r.mouseDownEventVerifier ??
|
|
4903
|
-
mouseUpEventVerifier: r.mouseUpEventVerifier ??
|
|
4904
|
-
movementThreshold: r.movementThreshold ??
|
|
4905
|
-
}),
|
|
4919
|
+
mouseDownEventVerifier: r.mouseDownEventVerifier ?? D.mouseDownEventVerifier,
|
|
4920
|
+
mouseUpEventVerifier: r.mouseUpEventVerifier ?? D.mouseUpEventVerifier,
|
|
4921
|
+
movementThreshold: r.movementThreshold ?? D.movementThreshold
|
|
4922
|
+
}), Wr = (r) => ({
|
|
4906
4923
|
onCanvasSelected: r.onCanvasSelected,
|
|
4907
|
-
mouseDownEventVerifier: r.mouseDownEventVerifier ??
|
|
4908
|
-
mouseUpEventVerifier: r.mouseUpEventVerifier ??
|
|
4909
|
-
movementThreshold: r.movementThreshold ??
|
|
4924
|
+
mouseDownEventVerifier: r.mouseDownEventVerifier ?? D.mouseDownEventVerifier,
|
|
4925
|
+
mouseUpEventVerifier: r.mouseUpEventVerifier ?? D.mouseUpEventVerifier,
|
|
4926
|
+
movementThreshold: r.movementThreshold ?? D.movementThreshold
|
|
4927
|
+
}), zr = (r) => ({
|
|
4928
|
+
onEdgeSelected: r.onEdgeSelected,
|
|
4929
|
+
mouseDownEventVerifier: r.mouseDownEventVerifier ?? D.mouseDownEventVerifier,
|
|
4930
|
+
mouseUpEventVerifier: r.mouseUpEventVerifier ?? D.mouseUpEventVerifier,
|
|
4931
|
+
movementThreshold: r.movementThreshold ?? D.movementThreshold
|
|
4910
4932
|
});
|
|
4911
|
-
class
|
|
4933
|
+
class Yr {
|
|
4912
4934
|
constructor(e) {
|
|
4913
4935
|
i(this, "used", !1);
|
|
4914
4936
|
i(this, "canvasDefaults", {});
|
|
@@ -4921,6 +4943,7 @@ class Wr {
|
|
|
4921
4943
|
i(this, "layoutConfig", {});
|
|
4922
4944
|
i(this, "animatedLayoutConfig", {});
|
|
4923
4945
|
i(this, "userSelectableNodesConfig");
|
|
4946
|
+
i(this, "userSelectableEdgesConfig");
|
|
4924
4947
|
i(this, "userSelectableCanvasConfig");
|
|
4925
4948
|
i(this, "hasDraggableNodes", !1);
|
|
4926
4949
|
i(this, "hasTransformableViewport", !1);
|
|
@@ -4934,7 +4957,8 @@ class Wr {
|
|
|
4934
4957
|
i(this, "window", window);
|
|
4935
4958
|
i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
4936
4959
|
i(this, "pointInsideVerifier");
|
|
4937
|
-
this
|
|
4960
|
+
i(this, "eventTagger", new Ht());
|
|
4961
|
+
this.element = e, this.pointInsideVerifier = new ut(e, this.window);
|
|
4938
4962
|
}
|
|
4939
4963
|
setDefaults(e) {
|
|
4940
4964
|
return this.canvasDefaults = e, this;
|
|
@@ -4969,73 +4993,90 @@ class Wr {
|
|
|
4969
4993
|
enableUserSelectableNodes(e) {
|
|
4970
4994
|
return this.userSelectableNodesConfig = e, this;
|
|
4971
4995
|
}
|
|
4996
|
+
enableUserSelectableEdges(e) {
|
|
4997
|
+
return this.userSelectableEdgesConfig = e, this;
|
|
4998
|
+
}
|
|
4972
4999
|
enableUserSelectableCanvas(e) {
|
|
4973
5000
|
return this.userSelectableCanvasConfig = e, this;
|
|
4974
5001
|
}
|
|
4975
5002
|
build() {
|
|
4976
5003
|
if (this.used)
|
|
4977
|
-
throw new
|
|
5004
|
+
throw new hr(
|
|
4978
5005
|
"Failed to build Canvas because CanvasBuilder is a single-use object"
|
|
4979
5006
|
);
|
|
4980
5007
|
this.used = !0;
|
|
4981
|
-
const e = new
|
|
5008
|
+
const e = new dt(this.element), t = new Me(), o = new Qt(this.element), s = this.createHtmlView(
|
|
4982
5009
|
o.main,
|
|
4983
5010
|
t,
|
|
4984
5011
|
e
|
|
4985
|
-
), n =
|
|
5012
|
+
), n = Ur(
|
|
4986
5013
|
this.canvasDefaults
|
|
4987
|
-
), a = new
|
|
5014
|
+
), a = new We(
|
|
4988
5015
|
t,
|
|
4989
5016
|
s,
|
|
4990
5017
|
n
|
|
4991
|
-
), h =
|
|
5018
|
+
), h = Dr(this.layoutConfig), d = Br({
|
|
4992
5019
|
canvasDefaults: this.canvasDefaults,
|
|
4993
5020
|
hasLayout: this.hasLayout,
|
|
4994
5021
|
layoutParams: h
|
|
4995
|
-
}), c = new
|
|
5022
|
+
}), c = new Ye(
|
|
4996
5023
|
t,
|
|
4997
5024
|
e,
|
|
4998
5025
|
d,
|
|
4999
5026
|
this.window
|
|
5000
|
-
), u = new
|
|
5027
|
+
), u = new ze(e), g = new Oe(t), l = new Te(
|
|
5001
5028
|
g,
|
|
5002
5029
|
u,
|
|
5003
5030
|
a,
|
|
5004
5031
|
c
|
|
5005
5032
|
);
|
|
5006
|
-
if (this.hasBackground &&
|
|
5033
|
+
if (this.hasBackground && ae.configure(
|
|
5007
5034
|
l,
|
|
5008
|
-
|
|
5035
|
+
or(this.backgroundConfig),
|
|
5009
5036
|
o.background
|
|
5010
|
-
), this.hasNodeResizeReactiveEdges && q.configure(l), this.
|
|
5011
|
-
const p =
|
|
5037
|
+
), this.hasNodeResizeReactiveEdges && q.configure(l), this.userSelectableEdgesConfig !== void 0) {
|
|
5038
|
+
const p = zr(
|
|
5039
|
+
this.userSelectableEdgesConfig
|
|
5040
|
+
);
|
|
5041
|
+
pe.configure(
|
|
5042
|
+
l,
|
|
5043
|
+
this.window,
|
|
5044
|
+
this.pointInsideVerifier,
|
|
5045
|
+
this.eventTagger,
|
|
5046
|
+
p
|
|
5047
|
+
);
|
|
5048
|
+
}
|
|
5049
|
+
if (this.userSelectableNodesConfig !== void 0) {
|
|
5050
|
+
const p = Or(
|
|
5012
5051
|
this.userSelectableNodesConfig
|
|
5013
5052
|
);
|
|
5014
|
-
|
|
5053
|
+
ge.configure(
|
|
5015
5054
|
l,
|
|
5016
5055
|
this.window,
|
|
5017
5056
|
this.pointInsideVerifier,
|
|
5057
|
+
this.eventTagger,
|
|
5018
5058
|
p
|
|
5019
5059
|
);
|
|
5020
5060
|
}
|
|
5021
5061
|
if (this.userSelectableCanvasConfig !== void 0) {
|
|
5022
|
-
const p =
|
|
5062
|
+
const p = Wr(
|
|
5023
5063
|
this.userSelectableCanvasConfig
|
|
5024
5064
|
);
|
|
5025
|
-
|
|
5065
|
+
we.configure(
|
|
5026
5066
|
l,
|
|
5027
5067
|
o.main,
|
|
5028
5068
|
this.window,
|
|
5029
5069
|
this.pointInsideVerifier,
|
|
5070
|
+
this.eventTagger,
|
|
5030
5071
|
p
|
|
5031
5072
|
);
|
|
5032
5073
|
}
|
|
5033
5074
|
if (this.hasDraggableNodes) {
|
|
5034
|
-
let p =
|
|
5035
|
-
this.hasAnimatedLayout && (p =
|
|
5075
|
+
let p = Zt(this.dragConfig);
|
|
5076
|
+
this.hasAnimatedLayout && (p = Rr(
|
|
5036
5077
|
p,
|
|
5037
5078
|
this.animationStaticNodes
|
|
5038
|
-
)),
|
|
5079
|
+
)), ie.configure(
|
|
5039
5080
|
l,
|
|
5040
5081
|
o.main,
|
|
5041
5082
|
this.window,
|
|
@@ -5044,12 +5085,12 @@ class Wr {
|
|
|
5044
5085
|
);
|
|
5045
5086
|
}
|
|
5046
5087
|
if (this.hasUserConnectablePorts) {
|
|
5047
|
-
const p =
|
|
5088
|
+
const p = sr(
|
|
5048
5089
|
this.connectablePortsConfig,
|
|
5049
5090
|
n.edges.shapeFactory,
|
|
5050
5091
|
n.ports.direction
|
|
5051
5092
|
);
|
|
5052
|
-
|
|
5093
|
+
he.configure(
|
|
5053
5094
|
l,
|
|
5054
5095
|
o.overlayConnectablePorts,
|
|
5055
5096
|
e,
|
|
@@ -5059,11 +5100,11 @@ class Wr {
|
|
|
5059
5100
|
);
|
|
5060
5101
|
}
|
|
5061
5102
|
if (this.hasUserDraggableEdges) {
|
|
5062
|
-
const p =
|
|
5103
|
+
const p = ir(
|
|
5063
5104
|
this.draggableEdgesConfig,
|
|
5064
5105
|
l.graph
|
|
5065
5106
|
);
|
|
5066
|
-
|
|
5107
|
+
de.configure(
|
|
5067
5108
|
l,
|
|
5068
5109
|
o.overlayDraggableEdges,
|
|
5069
5110
|
e,
|
|
@@ -5072,31 +5113,31 @@ class Wr {
|
|
|
5072
5113
|
p
|
|
5073
5114
|
);
|
|
5074
5115
|
}
|
|
5075
|
-
if (this.virtualScrollConfig !== void 0 ?
|
|
5116
|
+
if (this.virtualScrollConfig !== void 0 ? ne.configure(
|
|
5076
5117
|
l,
|
|
5077
5118
|
o.main,
|
|
5078
5119
|
this.window,
|
|
5079
|
-
|
|
5120
|
+
Ne(this.transformConfig),
|
|
5080
5121
|
this.boxRenderingTrigger,
|
|
5081
5122
|
this.pointInsideVerifier,
|
|
5082
|
-
|
|
5123
|
+
nr(this.virtualScrollConfig)
|
|
5083
5124
|
) : this.hasTransformableViewport && j.configure(
|
|
5084
5125
|
l,
|
|
5085
5126
|
o.main,
|
|
5086
5127
|
this.window,
|
|
5087
5128
|
this.pointInsideVerifier,
|
|
5088
|
-
|
|
5089
|
-
), this.hasLayout &&
|
|
5090
|
-
let p =
|
|
5129
|
+
Ne(this.transformConfig)
|
|
5130
|
+
), this.hasLayout && jt.configure(l, h), this.hasAnimatedLayout) {
|
|
5131
|
+
let p = Sr(
|
|
5091
5132
|
this.animatedLayoutConfig
|
|
5092
5133
|
);
|
|
5093
|
-
this.hasDraggableNodes && (
|
|
5134
|
+
this.hasDraggableNodes && (Lr(
|
|
5094
5135
|
l,
|
|
5095
5136
|
this.animationStaticNodes
|
|
5096
|
-
), p =
|
|
5137
|
+
), p = Vr(
|
|
5097
5138
|
p,
|
|
5098
5139
|
this.animationStaticNodes
|
|
5099
|
-
)),
|
|
5140
|
+
)), ue.configure(l, p, this.window);
|
|
5100
5141
|
}
|
|
5101
5142
|
const w = () => {
|
|
5102
5143
|
o.destroy(), l.onBeforeDestroy.unsubscribe(w);
|
|
@@ -5104,27 +5145,27 @@ class Wr {
|
|
|
5104
5145
|
return l.onBeforeDestroy.subscribe(w), l;
|
|
5105
5146
|
}
|
|
5106
5147
|
createHtmlView(e, t, o) {
|
|
5107
|
-
let s = new
|
|
5108
|
-
return this.virtualScrollConfig !== void 0 && (s = new
|
|
5148
|
+
let s = new Ce(t, o, e);
|
|
5149
|
+
return this.virtualScrollConfig !== void 0 && (s = new nt(
|
|
5109
5150
|
s,
|
|
5110
5151
|
t,
|
|
5111
5152
|
this.boxRenderingTrigger,
|
|
5112
|
-
|
|
5113
|
-
)), s = new
|
|
5153
|
+
ar(this.virtualScrollConfig)
|
|
5154
|
+
)), s = new at(s, t), s;
|
|
5114
5155
|
}
|
|
5115
5156
|
}
|
|
5116
5157
|
export {
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5158
|
+
Rt as BezierEdgeShape,
|
|
5159
|
+
Yr as CanvasBuilder,
|
|
5160
|
+
hr as CanvasBuilderError,
|
|
5161
|
+
A as CanvasError,
|
|
5162
|
+
V as ConnectionCategory,
|
|
5163
|
+
$e as DirectEdgeShape,
|
|
5123
5164
|
_ as EventSubject,
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5165
|
+
Lt as HorizontalEdgeShape,
|
|
5166
|
+
$t as InteractiveEdgeError,
|
|
5167
|
+
Be as InteractiveEdgeShape,
|
|
5168
|
+
Hr as MidpointEdgeShape,
|
|
5169
|
+
Vt as StraightEdgeShape,
|
|
5170
|
+
It as VerticalEdgeShape
|
|
5130
5171
|
};
|