@html-graph/html-graph 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -76
- package/dist/html-graph.d.ts +143 -133
- package/dist/html-graph.js +166 -154
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -35,7 +35,7 @@ class pt {
|
|
|
35
35
|
this.container.removeChild(e.element);
|
|
36
36
|
}
|
|
37
37
|
attachEdge(t) {
|
|
38
|
-
const e = this.graphStore.getEdge(t).shape.svg;
|
|
38
|
+
const e = this.graphStore.getEdge(t).payload.shape.svg;
|
|
39
39
|
this.edgeIdToElementMap.set(t, e), this.container.appendChild(e), this.renderEdge(t), this.updateEdgePriority(t);
|
|
40
40
|
}
|
|
41
41
|
detachEdge(t) {
|
|
@@ -53,18 +53,18 @@ class pt {
|
|
|
53
53
|
this.viewportStore.onAfterUpdated.unsubscribe(this.applyTransform), this.clear(), this.element.removeChild(this.host), this.host.removeChild(this.container);
|
|
54
54
|
}
|
|
55
55
|
updateNodePosition(t) {
|
|
56
|
-
const e = this.graphStore.getNode(t), { width: s, height: i } = e.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, a = e.centerFn(s, i), h = e.x - n * a.x, d = e.y - n * a.y;
|
|
56
|
+
const e = this.graphStore.getNode(t), { width: s, height: i } = e.element.getBoundingClientRect(), n = this.viewportStore.getViewportMatrix().scale, a = e.payload.centerFn(s, i), h = e.payload.x - n * a.x, d = e.payload.y - n * a.y;
|
|
57
57
|
e.element.style.transform = `translate(${h}px, ${d}px)`;
|
|
58
58
|
}
|
|
59
59
|
updateNodePriority(t) {
|
|
60
60
|
const e = this.graphStore.getNode(t);
|
|
61
|
-
e.element.style.zIndex = `${e.priority}`;
|
|
61
|
+
e.element.style.zIndex = `${e.payload.priority}`;
|
|
62
62
|
}
|
|
63
63
|
updateEdgeShape(t) {
|
|
64
64
|
const e = this.edgeIdToElementMap.get(t);
|
|
65
65
|
this.container.removeChild(e);
|
|
66
|
-
const
|
|
67
|
-
this.edgeIdToElementMap.set(t,
|
|
66
|
+
const i = this.graphStore.getEdge(t).payload.shape.svg;
|
|
67
|
+
this.edgeIdToElementMap.set(t, i), this.container.appendChild(i);
|
|
68
68
|
}
|
|
69
69
|
renderEdge(t) {
|
|
70
70
|
const e = this.graphStore.getEdge(t), s = this.graphStore.getPort(e.from), i = this.graphStore.getPort(e.to), n = s.element.getBoundingClientRect(), a = i.element.getBoundingClientRect(), h = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix(), c = this.createEdgeRenderPort(
|
|
@@ -79,11 +79,11 @@ class pt {
|
|
|
79
79
|
d
|
|
80
80
|
);
|
|
81
81
|
let g = C.Line;
|
|
82
|
-
s.element === i.element ? g = C.PortCycle : s.nodeId === i.nodeId && (g = C.NodeCycle), e.shape.render({ from: c, to: l, category: g });
|
|
82
|
+
s.element === i.element ? g = C.PortCycle : s.nodeId === i.nodeId && (g = C.NodeCycle), e.payload.shape.render({ from: c, to: l, category: g });
|
|
83
83
|
}
|
|
84
84
|
updateEdgePriority(t) {
|
|
85
85
|
const e = this.graphStore.getEdge(t);
|
|
86
|
-
e.shape.svg.style.zIndex = `${e.priority}`;
|
|
86
|
+
e.payload.shape.svg.style.zIndex = `${e.payload.priority}`;
|
|
87
87
|
}
|
|
88
88
|
createEdgeRenderPort(t, e, s, i) {
|
|
89
89
|
const n = {
|
|
@@ -95,7 +95,7 @@ class pt {
|
|
|
95
95
|
y: a.y,
|
|
96
96
|
width: e.width * i.scale,
|
|
97
97
|
height: e.height * i.scale,
|
|
98
|
-
direction: t.direction
|
|
98
|
+
direction: t.payload.direction
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -111,11 +111,11 @@ class Vt {
|
|
|
111
111
|
this.xFrom = t.x, this.xTo = t.x + t.width, this.yFrom = t.y, this.yTo = t.y + t.height;
|
|
112
112
|
}
|
|
113
113
|
hasNode(t) {
|
|
114
|
-
const e = this.graphStore.getNode(t);
|
|
114
|
+
const e = this.graphStore.getNode(t).payload;
|
|
115
115
|
return e.x >= this.xFrom && e.x <= this.xTo && e.y >= this.yFrom && e.y <= this.yTo;
|
|
116
116
|
}
|
|
117
117
|
hasEdge(t) {
|
|
118
|
-
const e = this.graphStore.getEdge(t), s = this.graphStore.getPort(e.from).nodeId, i = this.graphStore.getPort(e.to).nodeId, n = this.graphStore.getNode(s), a = this.graphStore.getNode(i), h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), l = Math.max(n.y, a.y);
|
|
118
|
+
const e = this.graphStore.getEdge(t), s = this.graphStore.getPort(e.from).nodeId, i = this.graphStore.getPort(e.to).nodeId, n = this.graphStore.getNode(s).payload, a = this.graphStore.getNode(i).payload, h = Math.min(n.x, a.x), d = Math.max(n.x, a.x), c = Math.min(n.y, a.y), l = Math.max(n.y, a.y);
|
|
119
119
|
return h <= this.xTo && d >= this.xFrom && c <= this.yTo && l >= this.yFrom;
|
|
120
120
|
}
|
|
121
121
|
}
|
|
@@ -248,12 +248,15 @@ class Wt {
|
|
|
248
248
|
}
|
|
249
249
|
getNode(t) {
|
|
250
250
|
const e = this.graphStore.getNode(t);
|
|
251
|
-
|
|
251
|
+
if (e === void 0)
|
|
252
|
+
return null;
|
|
253
|
+
const s = e.payload;
|
|
254
|
+
return {
|
|
252
255
|
element: e.element,
|
|
253
|
-
x:
|
|
254
|
-
y:
|
|
255
|
-
centerFn:
|
|
256
|
-
priority:
|
|
256
|
+
x: s.x,
|
|
257
|
+
y: s.y,
|
|
258
|
+
centerFn: s.centerFn,
|
|
259
|
+
priority: s.priority
|
|
257
260
|
};
|
|
258
261
|
}
|
|
259
262
|
getElementNodeId(t) {
|
|
@@ -266,7 +269,7 @@ class Wt {
|
|
|
266
269
|
const e = this.graphStore.getPort(t);
|
|
267
270
|
return e === void 0 ? null : {
|
|
268
271
|
element: e.element,
|
|
269
|
-
direction: e.direction,
|
|
272
|
+
direction: e.payload.direction,
|
|
270
273
|
nodeId: e.nodeId
|
|
271
274
|
};
|
|
272
275
|
}
|
|
@@ -284,11 +287,14 @@ class Wt {
|
|
|
284
287
|
}
|
|
285
288
|
getEdge(t) {
|
|
286
289
|
const e = this.graphStore.getEdge(t);
|
|
287
|
-
|
|
290
|
+
if (e === void 0)
|
|
291
|
+
return null;
|
|
292
|
+
const s = e.payload;
|
|
293
|
+
return {
|
|
288
294
|
from: e.from,
|
|
289
295
|
to: e.to,
|
|
290
|
-
priority:
|
|
291
|
-
shape:
|
|
296
|
+
priority: s.priority,
|
|
297
|
+
shape: s.shape
|
|
292
298
|
};
|
|
293
299
|
}
|
|
294
300
|
getPortIncomingEdgeIds(t) {
|
|
@@ -420,7 +426,7 @@ class ft {
|
|
|
420
426
|
*/
|
|
421
427
|
addNode(t) {
|
|
422
428
|
const e = this.nodeIdGenerator.create(t.id);
|
|
423
|
-
if (this.
|
|
429
|
+
if (this.graphStore.getNode(e) !== void 0)
|
|
424
430
|
throw new S("failed to add node with existing id");
|
|
425
431
|
if (this.graphStore.getElementNodeId(t.element) !== void 0)
|
|
426
432
|
throw new S(
|
|
@@ -447,7 +453,7 @@ class ft {
|
|
|
447
453
|
* updates node parameters
|
|
448
454
|
*/
|
|
449
455
|
updateNode(t, e) {
|
|
450
|
-
if (this.
|
|
456
|
+
if (this.graphStore.getNode(t) === void 0)
|
|
451
457
|
throw new S("failed to update non existing node");
|
|
452
458
|
return this.graphStore.updateNode(t, e ?? {}), this;
|
|
453
459
|
}
|
|
@@ -457,7 +463,7 @@ class ft {
|
|
|
457
463
|
* all the edges adjacent to node get removed
|
|
458
464
|
*/
|
|
459
465
|
removeNode(t) {
|
|
460
|
-
if (this.
|
|
466
|
+
if (this.graphStore.getNode(t) === void 0)
|
|
461
467
|
throw new S("failed to remove non existing node");
|
|
462
468
|
return this.graphStore.removeNode(t), this;
|
|
463
469
|
}
|
|
@@ -466,9 +472,9 @@ class ft {
|
|
|
466
472
|
*/
|
|
467
473
|
markPort(t) {
|
|
468
474
|
const e = this.portIdGenerator.create(t.id);
|
|
469
|
-
if (this.
|
|
475
|
+
if (this.graphStore.getPort(e) !== void 0)
|
|
470
476
|
throw new S("failed to add port with existing id");
|
|
471
|
-
if (this.
|
|
477
|
+
if (this.graphStore.getNode(t.nodeId) === void 0)
|
|
472
478
|
throw new S("failed to mark port for nonexistent node");
|
|
473
479
|
return this.graphStore.addPort({
|
|
474
480
|
id: e,
|
|
@@ -481,7 +487,7 @@ class ft {
|
|
|
481
487
|
* updates port and edges attached to it
|
|
482
488
|
*/
|
|
483
489
|
updatePort(t, e) {
|
|
484
|
-
if (this.
|
|
490
|
+
if (this.graphStore.getPort(t) === void 0)
|
|
485
491
|
throw new S("failed to update nonexistent port");
|
|
486
492
|
return this.graphStore.updatePort(t, e ?? {}), this;
|
|
487
493
|
}
|
|
@@ -490,7 +496,7 @@ class ft {
|
|
|
490
496
|
* all the edges adjacent to the port get removed
|
|
491
497
|
*/
|
|
492
498
|
unmarkPort(t) {
|
|
493
|
-
if (this.
|
|
499
|
+
if (this.graphStore.getPort(t) === void 0)
|
|
494
500
|
throw new S("failed to unmark non existing port");
|
|
495
501
|
return this.graphStore.removePort(t), this;
|
|
496
502
|
}
|
|
@@ -499,11 +505,11 @@ class ft {
|
|
|
499
505
|
*/
|
|
500
506
|
addEdge(t) {
|
|
501
507
|
const e = this.edgeIdGenerator.create(t.id);
|
|
502
|
-
if (this.
|
|
508
|
+
if (this.graphStore.getEdge(e) !== void 0)
|
|
503
509
|
throw new S("failed to add edge with existing id");
|
|
504
|
-
if (this.
|
|
510
|
+
if (this.graphStore.getPort(t.from) === void 0)
|
|
505
511
|
throw new S("failed to add edge from nonexistent port");
|
|
506
|
-
if (this.
|
|
512
|
+
if (this.graphStore.getPort(t.to) === void 0)
|
|
507
513
|
throw new S("failed to add edge to nonexistent port");
|
|
508
514
|
return this.graphStore.addEdge({
|
|
509
515
|
id: e,
|
|
@@ -517,7 +523,7 @@ class ft {
|
|
|
517
523
|
* updates specified edge
|
|
518
524
|
*/
|
|
519
525
|
updateEdge(t, e) {
|
|
520
|
-
if (this.
|
|
526
|
+
if (this.graphStore.getEdge(t) === void 0)
|
|
521
527
|
throw new S("failed to update nonexistent edge");
|
|
522
528
|
return this.graphStore.updateEdge(t, e ?? {}), this;
|
|
523
529
|
}
|
|
@@ -525,7 +531,7 @@ class ft {
|
|
|
525
531
|
* removes specified edge
|
|
526
532
|
*/
|
|
527
533
|
removeEdge(t) {
|
|
528
|
-
if (this.
|
|
534
|
+
if (this.graphStore.getEdge(t) === void 0)
|
|
529
535
|
throw new S("failed to remove nonexistent edge");
|
|
530
536
|
return this.graphStore.removeEdge(t), this;
|
|
531
537
|
}
|
|
@@ -602,7 +608,7 @@ class $t {
|
|
|
602
608
|
return this.multiToSingleMap.get(t) !== void 0;
|
|
603
609
|
}
|
|
604
610
|
}
|
|
605
|
-
class
|
|
611
|
+
class yt {
|
|
606
612
|
constructor() {
|
|
607
613
|
o(this, "nodes", /* @__PURE__ */ new Map());
|
|
608
614
|
o(this, "ports", /* @__PURE__ */ new Map());
|
|
@@ -643,10 +649,12 @@ class mt {
|
|
|
643
649
|
addNode(t) {
|
|
644
650
|
const e = /* @__PURE__ */ new Map(), s = {
|
|
645
651
|
element: t.element,
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
652
|
+
payload: {
|
|
653
|
+
x: t.x,
|
|
654
|
+
y: t.y,
|
|
655
|
+
centerFn: t.centerFn,
|
|
656
|
+
priority: t.priority
|
|
657
|
+
},
|
|
650
658
|
ports: e
|
|
651
659
|
};
|
|
652
660
|
this.nodes.set(t.id, s), this.nodesElementsMap.set(t.element, t.id), this.afterNodeAddedEmitter.emit(t.id);
|
|
@@ -661,7 +669,7 @@ class mt {
|
|
|
661
669
|
return this.nodesElementsMap.get(t);
|
|
662
670
|
}
|
|
663
671
|
updateNode(t, e) {
|
|
664
|
-
const s = this.nodes.get(t);
|
|
672
|
+
const s = this.nodes.get(t).payload;
|
|
665
673
|
s.x = e.x ?? s.x, s.y = e.y ?? s.y, s.centerFn = e.centerFn ?? s.centerFn, e.priority !== void 0 && (s.priority = e.priority, this.afterNodePriorityUpdatedEmitter.emit(t)), this.afterNodeUpdatedEmitter.emit(t);
|
|
666
674
|
}
|
|
667
675
|
removeNode(t) {
|
|
@@ -672,7 +680,9 @@ class mt {
|
|
|
672
680
|
addPort(t) {
|
|
673
681
|
this.ports.set(t.id, {
|
|
674
682
|
element: t.element,
|
|
675
|
-
|
|
683
|
+
payload: {
|
|
684
|
+
direction: t.direction
|
|
685
|
+
},
|
|
676
686
|
nodeId: t.nodeId
|
|
677
687
|
}), this.elementPorts.addRecord(t.element, t.id), this.cycleEdges.set(t.id, /* @__PURE__ */ new Set()), this.incomingEdges.set(t.id, /* @__PURE__ */ new Set()), this.outcomingEdges.set(t.id, /* @__PURE__ */ new Set()), this.nodes.get(t.nodeId).ports.set(t.id, t.element), this.afterPortAddedEmitter.emit(t.id);
|
|
678
688
|
}
|
|
@@ -680,7 +690,7 @@ class mt {
|
|
|
680
690
|
return this.ports.get(t);
|
|
681
691
|
}
|
|
682
692
|
updatePort(t, e) {
|
|
683
|
-
const s = this.ports.get(t);
|
|
693
|
+
const s = this.ports.get(t).payload;
|
|
684
694
|
s.direction = e.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(t);
|
|
685
695
|
}
|
|
686
696
|
getAllPortIds() {
|
|
@@ -703,17 +713,17 @@ class mt {
|
|
|
703
713
|
}
|
|
704
714
|
updateEdge(t, e) {
|
|
705
715
|
if (e.from !== void 0 || e.to !== void 0) {
|
|
706
|
-
const i = this.edges.get(t);
|
|
716
|
+
const i = this.edges.get(t), n = i.payload;
|
|
707
717
|
this.removeEdgeInternal(t), this.addEdgeInternal({
|
|
708
718
|
id: t,
|
|
709
719
|
from: e.from ?? i.from,
|
|
710
720
|
to: e.to ?? i.to,
|
|
711
|
-
shape:
|
|
712
|
-
priority:
|
|
721
|
+
shape: n.shape,
|
|
722
|
+
priority: n.priority
|
|
713
723
|
});
|
|
714
724
|
}
|
|
715
725
|
const s = this.edges.get(t);
|
|
716
|
-
e.shape !== void 0 && (s.shape = e.shape, this.afterEdgeShapeUpdatedEmitter.emit(t)), e.priority !== void 0 && (s.priority = e.priority, this.afterEdgePriorityUpdatedEmitter.emit(t)), this.afterEdgeUpdatedEmitter.emit(t);
|
|
726
|
+
e.shape !== void 0 && (s.payload.shape = e.shape, this.afterEdgeShapeUpdatedEmitter.emit(t)), e.priority !== void 0 && (s.payload.priority = e.priority, this.afterEdgePriorityUpdatedEmitter.emit(t)), this.afterEdgeUpdatedEmitter.emit(t);
|
|
717
727
|
}
|
|
718
728
|
getAllEdgeIds() {
|
|
719
729
|
return Array.from(this.edges.keys());
|
|
@@ -775,8 +785,10 @@ class mt {
|
|
|
775
785
|
this.edges.set(t.id, {
|
|
776
786
|
from: t.from,
|
|
777
787
|
to: t.to,
|
|
778
|
-
|
|
779
|
-
|
|
788
|
+
payload: {
|
|
789
|
+
shape: t.shape,
|
|
790
|
+
priority: t.priority
|
|
791
|
+
}
|
|
780
792
|
}), t.from !== t.to ? (this.outcomingEdges.get(t.from).add(t.id), this.incomingEdges.get(t.to).add(t.id)) : this.cycleEdges.get(t.from).add(t.id);
|
|
781
793
|
}
|
|
782
794
|
removeEdgeInternal(t) {
|
|
@@ -877,7 +889,7 @@ const Ft = (r, t, e) => {
|
|
|
877
889
|
for (; e !== null && (s = r.getElementPortIds(e)[0] ?? null, s === null); )
|
|
878
890
|
e = e.parentElement;
|
|
879
891
|
return s;
|
|
880
|
-
},
|
|
892
|
+
}, mt = (r, t) => {
|
|
881
893
|
const e = document.elementsFromPoint(t.x, t.y);
|
|
882
894
|
for (const s of e) {
|
|
883
895
|
const i = kt(r, s);
|
|
@@ -890,7 +902,7 @@ var P = /* @__PURE__ */ ((r) => (r.Static = "static", r.Dragging = "dragging", r
|
|
|
890
902
|
const vt = (r, t) => ({
|
|
891
903
|
x: r / 2,
|
|
892
904
|
y: t / 2
|
|
893
|
-
}),
|
|
905
|
+
}), y = (r, t, e) => ({
|
|
894
906
|
x: t.x * r.x - t.y * r.y + ((1 - t.x) * e.x + t.y * e.y),
|
|
895
907
|
y: t.y * r.x + t.x * r.y + ((1 - t.x) * e.y - t.y * e.x)
|
|
896
908
|
}), u = {
|
|
@@ -904,11 +916,11 @@ class zt {
|
|
|
904
916
|
this.params = t;
|
|
905
917
|
const e = this.params.to;
|
|
906
918
|
this.midpoint = { x: e.x / 2, y: e.y / 2 };
|
|
907
|
-
const s =
|
|
919
|
+
const s = y(
|
|
908
920
|
{ x: this.params.arrowLength, y: u.y },
|
|
909
921
|
this.params.sourceDirection,
|
|
910
922
|
u
|
|
911
|
-
), i =
|
|
923
|
+
), i = y(
|
|
912
924
|
{ x: this.params.to.x - this.params.arrowLength, y: this.params.to.y },
|
|
913
925
|
this.params.targetDirection,
|
|
914
926
|
this.params.to
|
|
@@ -931,25 +943,25 @@ class Xt {
|
|
|
931
943
|
o(this, "path");
|
|
932
944
|
o(this, "midpoint");
|
|
933
945
|
this.params = t;
|
|
934
|
-
const e = this.params.hasSourceArrow ?
|
|
946
|
+
const e = this.params.hasSourceArrow ? y(
|
|
935
947
|
{ x: this.params.arrowLength, y: u.y },
|
|
936
948
|
this.params.sourceDirection,
|
|
937
949
|
u
|
|
938
|
-
) : u, s = this.params.hasTargetArrow ?
|
|
950
|
+
) : u, s = this.params.hasTargetArrow ? y(
|
|
939
951
|
{
|
|
940
952
|
x: this.params.to.x - this.params.arrowLength,
|
|
941
953
|
y: this.params.to.y
|
|
942
954
|
},
|
|
943
955
|
this.params.targetDirection,
|
|
944
956
|
this.params.to
|
|
945
|
-
) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c =
|
|
957
|
+
) : this.params.to, i = this.params.arrowLength, n = Math.cos(this.params.detourDirection) * this.params.detourDistance, a = Math.sin(this.params.detourDirection) * this.params.detourDistance, h = n * this.params.flipX, d = a * this.params.flipY, c = y(
|
|
946
958
|
{ x: i, y: u.y },
|
|
947
959
|
this.params.sourceDirection,
|
|
948
960
|
u
|
|
949
961
|
), l = {
|
|
950
962
|
x: c.x + h,
|
|
951
963
|
y: c.y + d
|
|
952
|
-
}, g =
|
|
964
|
+
}, g = y(
|
|
953
965
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
954
966
|
this.params.targetDirection,
|
|
955
967
|
this.params.to
|
|
@@ -959,7 +971,7 @@ class Xt {
|
|
|
959
971
|
}, f = {
|
|
960
972
|
x: (l.x + w.x) / 2,
|
|
961
973
|
y: (l.y + w.y) / 2
|
|
962
|
-
},
|
|
974
|
+
}, m = {
|
|
963
975
|
x: c.x + this.params.curvature * this.params.sourceDirection.x,
|
|
964
976
|
y: c.y + this.params.curvature * this.params.sourceDirection.y
|
|
965
977
|
}, v = {
|
|
@@ -975,7 +987,7 @@ class Xt {
|
|
|
975
987
|
this.path = [
|
|
976
988
|
`M ${e.x} ${e.y}`,
|
|
977
989
|
`L ${c.x} ${c.y}`,
|
|
978
|
-
`C ${
|
|
990
|
+
`C ${m.x} ${m.y} ${E.x} ${E.y} ${f.x} ${f.y}`,
|
|
979
991
|
`C ${x.x} ${x.y} ${v.x} ${v.y} ${g.x} ${g.y}`,
|
|
980
992
|
`L ${s.x} ${s.y}`
|
|
981
993
|
].join(" "), this.midpoint = B(f, t.flipX, t.flipY, t.to);
|
|
@@ -988,13 +1000,13 @@ const M = (r, t) => {
|
|
|
988
1000
|
let i = 0, n = 0, a = 0;
|
|
989
1001
|
r.forEach((h, d) => {
|
|
990
1002
|
let c = 0, l = 0, g = 0;
|
|
991
|
-
const w = d > 0, f = d < s,
|
|
1003
|
+
const w = d > 0, f = d < s, m = w && f;
|
|
992
1004
|
if (w && (c = -i, l = -n, g = a), f) {
|
|
993
1005
|
const V = r[d + 1];
|
|
994
1006
|
i = V.x - h.x, n = V.y - h.y, a = Math.sqrt(i * i + n * n);
|
|
995
1007
|
}
|
|
996
|
-
const E = a !== 0 ? Math.min((
|
|
997
|
-
d > 0 && e.push(`L ${D.x} ${D.y}`),
|
|
1008
|
+
const E = a !== 0 ? Math.min((m ? t : 0) / a, d < s - 1 ? 0.5 : 1) : 0, x = m ? { x: h.x + i * E, y: h.y + n * E } : h, b = g !== 0 ? Math.min((m ? t : 0) / g, d > 1 ? 0.5 : 1) : 0, D = m ? { x: h.x + c * b, y: h.y + l * b } : h;
|
|
1009
|
+
d > 0 && e.push(`L ${D.x} ${D.y}`), m && e.push(
|
|
998
1010
|
`C ${h.x} ${h.y} ${h.x} ${h.y} ${x.x} ${x.y}`
|
|
999
1011
|
);
|
|
1000
1012
|
});
|
|
@@ -1008,22 +1020,22 @@ class Yt {
|
|
|
1008
1020
|
this.params = t;
|
|
1009
1021
|
const e = this.params.to;
|
|
1010
1022
|
this.midpoint = { x: e.x / 2, y: e.y / 2 };
|
|
1011
|
-
const s = this.params.hasSourceArrow ?
|
|
1023
|
+
const s = this.params.hasSourceArrow ? y(
|
|
1012
1024
|
{ x: this.params.arrowLength, y: u.y },
|
|
1013
1025
|
this.params.sourceDirection,
|
|
1014
1026
|
u
|
|
1015
|
-
) : u, i = this.params.hasTargetArrow ?
|
|
1027
|
+
) : u, i = this.params.hasTargetArrow ? y(
|
|
1016
1028
|
{
|
|
1017
1029
|
x: this.params.to.x - this.params.arrowLength,
|
|
1018
1030
|
y: this.params.to.y
|
|
1019
1031
|
},
|
|
1020
1032
|
this.params.targetDirection,
|
|
1021
1033
|
this.params.to
|
|
1022
|
-
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h =
|
|
1034
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = y(
|
|
1023
1035
|
{ x: a, y: u.y },
|
|
1024
1036
|
this.params.sourceDirection,
|
|
1025
1037
|
u
|
|
1026
|
-
), d =
|
|
1038
|
+
), d = y(
|
|
1027
1039
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1028
1040
|
this.params.targetDirection,
|
|
1029
1041
|
this.params.to
|
|
@@ -1033,9 +1045,9 @@ class Yt {
|
|
|
1033
1045
|
}, w = { x: g.x, y: l }, f = {
|
|
1034
1046
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
1035
1047
|
y: d.y
|
|
1036
|
-
},
|
|
1048
|
+
}, m = { x: f.x, y: l };
|
|
1037
1049
|
this.path = M(
|
|
1038
|
-
[s, h, g, w,
|
|
1050
|
+
[s, h, g, w, m, f, d, i],
|
|
1039
1051
|
this.params.roundness
|
|
1040
1052
|
);
|
|
1041
1053
|
}
|
|
@@ -1045,22 +1057,22 @@ class Ht {
|
|
|
1045
1057
|
o(this, "path");
|
|
1046
1058
|
o(this, "midpoint");
|
|
1047
1059
|
this.params = t;
|
|
1048
|
-
const e = this.params.hasSourceArrow ?
|
|
1060
|
+
const e = this.params.hasSourceArrow ? y(
|
|
1049
1061
|
{ x: this.params.arrowLength, y: u.y },
|
|
1050
1062
|
this.params.sourceDirection,
|
|
1051
1063
|
u
|
|
1052
|
-
) : u, s = this.params.hasTargetArrow ?
|
|
1064
|
+
) : u, s = this.params.hasTargetArrow ? y(
|
|
1053
1065
|
{
|
|
1054
1066
|
x: this.params.to.x - this.params.arrowLength,
|
|
1055
1067
|
y: this.params.to.y
|
|
1056
1068
|
},
|
|
1057
1069
|
this.params.targetDirection,
|
|
1058
1070
|
this.params.to
|
|
1059
|
-
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n =
|
|
1071
|
+
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
|
|
1060
1072
|
{ x: i, y: u.y },
|
|
1061
1073
|
this.params.sourceDirection,
|
|
1062
1074
|
u
|
|
1063
|
-
), a = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = a * this.params.flipX, c = h * this.params.flipY, l = { x: n.x + d, y: n.y + c }, g =
|
|
1075
|
+
), a = Math.cos(this.params.detourDirection) * this.params.detourDistance, h = Math.sin(this.params.detourDirection) * this.params.detourDistance, d = a * this.params.flipX, c = h * this.params.flipY, l = { x: n.x + d, y: n.y + c }, g = y(
|
|
1064
1076
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1065
1077
|
this.params.targetDirection,
|
|
1066
1078
|
this.params.to
|
|
@@ -1078,22 +1090,22 @@ class jt {
|
|
|
1078
1090
|
this.params = t;
|
|
1079
1091
|
const e = this.params.to;
|
|
1080
1092
|
this.midpoint = { x: e.x / 2, y: e.y / 2 };
|
|
1081
|
-
const s = this.params.hasSourceArrow ?
|
|
1093
|
+
const s = this.params.hasSourceArrow ? y(
|
|
1082
1094
|
{ x: this.params.arrowLength, y: u.y },
|
|
1083
1095
|
this.params.sourceDirection,
|
|
1084
1096
|
u
|
|
1085
|
-
) : u, i = this.params.hasTargetArrow ?
|
|
1097
|
+
) : u, i = this.params.hasTargetArrow ? y(
|
|
1086
1098
|
{
|
|
1087
1099
|
x: this.params.to.x - this.params.arrowLength,
|
|
1088
1100
|
y: this.params.to.y
|
|
1089
1101
|
},
|
|
1090
1102
|
this.params.targetDirection,
|
|
1091
1103
|
this.params.to
|
|
1092
|
-
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a =
|
|
1104
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = y(
|
|
1093
1105
|
{ x: n, y: u.y },
|
|
1094
1106
|
this.params.sourceDirection,
|
|
1095
1107
|
u
|
|
1096
|
-
), h =
|
|
1108
|
+
), h = y(
|
|
1097
1109
|
{ x: this.params.to.x - n, y: this.params.to.y },
|
|
1098
1110
|
this.params.targetDirection,
|
|
1099
1111
|
this.params.to
|
|
@@ -1108,22 +1120,22 @@ class Gt {
|
|
|
1108
1120
|
this.params = t;
|
|
1109
1121
|
const e = this.params.to;
|
|
1110
1122
|
this.midpoint = { x: e.x / 2, y: e.y / 2 };
|
|
1111
|
-
const s = this.params.hasSourceArrow ?
|
|
1123
|
+
const s = this.params.hasSourceArrow ? y(
|
|
1112
1124
|
{ x: this.params.arrowLength, y: u.y },
|
|
1113
1125
|
this.params.sourceDirection,
|
|
1114
1126
|
u
|
|
1115
|
-
) : u, i = this.params.hasTargetArrow ?
|
|
1127
|
+
) : u, i = this.params.hasTargetArrow ? y(
|
|
1116
1128
|
{
|
|
1117
1129
|
x: this.params.to.x - this.params.arrowLength,
|
|
1118
1130
|
y: this.params.to.y
|
|
1119
1131
|
},
|
|
1120
1132
|
this.params.targetDirection,
|
|
1121
1133
|
this.params.to
|
|
1122
|
-
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h =
|
|
1134
|
+
) : this.params.to, n = this.params.arrowLength + this.params.arrowOffset, a = n - this.params.roundness, h = y(
|
|
1123
1135
|
{ x: a, y: u.y },
|
|
1124
1136
|
this.params.sourceDirection,
|
|
1125
1137
|
u
|
|
1126
|
-
), d =
|
|
1138
|
+
), d = y(
|
|
1127
1139
|
{ x: this.params.to.x - a, y: this.params.to.y },
|
|
1128
1140
|
this.params.targetDirection,
|
|
1129
1141
|
this.params.to
|
|
@@ -1133,9 +1145,9 @@ class Gt {
|
|
|
1133
1145
|
}, w = { x: l, y: g.y }, f = {
|
|
1134
1146
|
x: d.x,
|
|
1135
1147
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1136
|
-
},
|
|
1148
|
+
}, m = { x: l, y: f.y };
|
|
1137
1149
|
this.path = M(
|
|
1138
|
-
[s, h, g, w,
|
|
1150
|
+
[s, h, g, w, m, f, d, i],
|
|
1139
1151
|
this.params.roundness
|
|
1140
1152
|
);
|
|
1141
1153
|
}
|
|
@@ -1155,7 +1167,7 @@ class G {
|
|
|
1155
1167
|
{ x: i, y: u.y },
|
|
1156
1168
|
{ x: this.params.arrowLength, y: u.y }
|
|
1157
1169
|
].map(
|
|
1158
|
-
(c) =>
|
|
1170
|
+
(c) => y(c, this.params.sourceDirection, u)
|
|
1159
1171
|
), d = `M ${u.x} ${u.y} L ${h[0].x} ${h[0].y} `;
|
|
1160
1172
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${M(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
|
|
1161
1173
|
}
|
|
@@ -1171,7 +1183,7 @@ class Kt {
|
|
|
1171
1183
|
{ x: c, y: -n },
|
|
1172
1184
|
{ x: d, y: 0 }
|
|
1173
1185
|
].map(
|
|
1174
|
-
(
|
|
1186
|
+
(m) => y(m, this.params.sourceDirection, u)
|
|
1175
1187
|
), w = [
|
|
1176
1188
|
`M ${g[0].x} ${g[0].y}`,
|
|
1177
1189
|
`A ${e} ${e} 0 0 1 ${g[1].x} ${g[1].y}`,
|
|
@@ -1222,22 +1234,22 @@ class Jt {
|
|
|
1222
1234
|
o(this, "path");
|
|
1223
1235
|
o(this, "midpoint");
|
|
1224
1236
|
this.params = t;
|
|
1225
|
-
const e = this.params.hasSourceArrow ?
|
|
1237
|
+
const e = this.params.hasSourceArrow ? y(
|
|
1226
1238
|
{ x: this.params.arrowLength, y: u.y },
|
|
1227
1239
|
this.params.sourceDirection,
|
|
1228
1240
|
u
|
|
1229
|
-
) : u, s = this.params.hasTargetArrow ?
|
|
1241
|
+
) : u, s = this.params.hasTargetArrow ? y(
|
|
1230
1242
|
{
|
|
1231
1243
|
x: this.params.to.x - this.params.arrowLength,
|
|
1232
1244
|
y: this.params.to.y
|
|
1233
1245
|
},
|
|
1234
1246
|
this.params.targetDirection,
|
|
1235
1247
|
this.params.to
|
|
1236
|
-
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n =
|
|
1248
|
+
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
|
|
1237
1249
|
{ x: i, y: u.y },
|
|
1238
1250
|
this.params.sourceDirection,
|
|
1239
1251
|
u
|
|
1240
|
-
), a =
|
|
1252
|
+
), a = y(
|
|
1241
1253
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1242
1254
|
this.params.targetDirection,
|
|
1243
1255
|
this.params.to
|
|
@@ -1263,22 +1275,22 @@ class Qt {
|
|
|
1263
1275
|
o(this, "path");
|
|
1264
1276
|
o(this, "midpoint");
|
|
1265
1277
|
this.params = t;
|
|
1266
|
-
const e = this.params.hasSourceArrow ?
|
|
1278
|
+
const e = this.params.hasSourceArrow ? y(
|
|
1267
1279
|
{ x: this.params.arrowLength, y: u.y },
|
|
1268
1280
|
this.params.sourceDirection,
|
|
1269
1281
|
u
|
|
1270
|
-
) : u, s = this.params.hasTargetArrow ?
|
|
1282
|
+
) : u, s = this.params.hasTargetArrow ? y(
|
|
1271
1283
|
{
|
|
1272
1284
|
x: this.params.to.x - this.params.arrowLength,
|
|
1273
1285
|
y: this.params.to.y
|
|
1274
1286
|
},
|
|
1275
1287
|
this.params.targetDirection,
|
|
1276
1288
|
this.params.to
|
|
1277
|
-
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n =
|
|
1289
|
+
) : this.params.to, i = this.params.arrowLength + this.params.arrowOffset, n = y(
|
|
1278
1290
|
{ x: i, y: u.y },
|
|
1279
1291
|
this.params.sourceDirection,
|
|
1280
1292
|
u
|
|
1281
|
-
), a =
|
|
1293
|
+
), a = y(
|
|
1282
1294
|
{ x: this.params.to.x - i, y: this.params.to.y },
|
|
1283
1295
|
this.params.targetDirection,
|
|
1284
1296
|
this.params.to
|
|
@@ -1336,7 +1348,7 @@ const Et = (r, t) => {
|
|
|
1336
1348
|
u,
|
|
1337
1349
|
{ x: e, y: s },
|
|
1338
1350
|
{ x: e, y: -s }
|
|
1339
|
-
].map((c) =>
|
|
1351
|
+
].map((c) => y(c, r, u)).map((c) => ({ x: c.x + t.x, y: c.y + t.y })), a = `M ${n[0].x} ${n[0].y}`, h = `L ${n[1].x} ${n[1].y}`, d = `L ${n[2].x} ${n[2].y}`;
|
|
1340
1352
|
return `${a} ${h} ${d} Z`;
|
|
1341
1353
|
}, p = Object.freeze({
|
|
1342
1354
|
color: "#777777",
|
|
@@ -1388,14 +1400,14 @@ class F {
|
|
|
1388
1400
|
};
|
|
1389
1401
|
let g = c, w = -this.params.arrowLength, f;
|
|
1390
1402
|
t.category === C.PortCycle ? (f = this.params.createCyclePath, g = d, w = this.params.arrowLength) : t.category === C.NodeCycle ? f = this.params.createDetourPath : f = this.params.createLinePath;
|
|
1391
|
-
const
|
|
1403
|
+
const m = f(
|
|
1392
1404
|
d,
|
|
1393
1405
|
c,
|
|
1394
1406
|
l,
|
|
1395
1407
|
a,
|
|
1396
1408
|
h
|
|
1397
1409
|
);
|
|
1398
|
-
this.line.setAttribute("d",
|
|
1410
|
+
this.line.setAttribute("d", m.path);
|
|
1399
1411
|
let v = null;
|
|
1400
1412
|
this.sourceArrow && (v = X(
|
|
1401
1413
|
d,
|
|
@@ -1410,7 +1422,7 @@ class F {
|
|
|
1410
1422
|
w,
|
|
1411
1423
|
this.params.arrowWidth
|
|
1412
1424
|
), this.targetArrow.setAttribute("d", E)), this.afterRenderEmitter.emit({
|
|
1413
|
-
edgePath:
|
|
1425
|
+
edgePath: m,
|
|
1414
1426
|
sourceArrowPath: v,
|
|
1415
1427
|
targetArrowPath: E
|
|
1416
1428
|
});
|
|
@@ -1831,7 +1843,7 @@ class Ne {
|
|
|
1831
1843
|
}
|
|
1832
1844
|
}
|
|
1833
1845
|
const Dt = (r, t) => {
|
|
1834
|
-
const e = new
|
|
1846
|
+
const e = new yt(), s = new pt(e, t, r), i = {
|
|
1835
1847
|
nodes: {
|
|
1836
1848
|
centerFn: vt,
|
|
1837
1849
|
priorityFn: () => 0
|
|
@@ -2502,9 +2514,9 @@ class _ {
|
|
|
2502
2514
|
portDirection: this.params.dragPortDirection
|
|
2503
2515
|
};
|
|
2504
2516
|
this.isTargetDragging = s === "direct";
|
|
2505
|
-
const [
|
|
2506
|
-
this.overlayCanvas.addNode(W(
|
|
2507
|
-
from:
|
|
2517
|
+
const [m, v] = this.isTargetDragging ? [w, f] : [f, w];
|
|
2518
|
+
this.overlayCanvas.addNode(W(m)), this.overlayCanvas.addNode(W(v)), this.overlayCanvas.addEdge({
|
|
2519
|
+
from: m.overlayId,
|
|
2508
2520
|
to: v.overlayId,
|
|
2509
2521
|
shape: this.params.edgeShapeFactory(P.Edge)
|
|
2510
2522
|
});
|
|
@@ -2513,16 +2525,16 @@ class _ {
|
|
|
2513
2525
|
this.staticPortId = null, this.isTargetDragging = !0, this.overlayCanvas.clear();
|
|
2514
2526
|
}
|
|
2515
2527
|
tryCreateConnection(t) {
|
|
2516
|
-
const e =
|
|
2528
|
+
const e = mt(this.canvas.graph, t), s = this.staticPortId;
|
|
2517
2529
|
if (e === null) {
|
|
2518
2530
|
this.params.onEdgeCreationInterrupted({
|
|
2519
|
-
staticPortId:
|
|
2531
|
+
staticPortId: s,
|
|
2520
2532
|
isDirect: this.isTargetDragging
|
|
2521
2533
|
});
|
|
2522
2534
|
return;
|
|
2523
2535
|
}
|
|
2524
|
-
const
|
|
2525
|
-
|
|
2536
|
+
const i = this.isTargetDragging ? s : e, n = this.isTargetDragging ? e : s, a = { from: i, to: n }, h = this.params.connectionPreprocessor(a);
|
|
2537
|
+
h !== null ? (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(h), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated)) : this.params.onEdgeCreationPrevented(a);
|
|
2526
2538
|
}
|
|
2527
2539
|
moveDraggingPort(t) {
|
|
2528
2540
|
const e = this.overlayLayer.getBoundingClientRect(), s = {
|
|
@@ -2588,7 +2600,7 @@ class q {
|
|
|
2588
2600
|
const d = this.canvas.graph.getPort(t), c = this.canvas.graph.getPort(h), l = c.element.getBoundingClientRect(), g = {
|
|
2589
2601
|
x: l.x + l.width / 2,
|
|
2590
2602
|
y: l.y + l.height / 2
|
|
2591
|
-
}, w = this.canvas.viewport.getViewportMatrix(), f = this.overlayLayer.getBoundingClientRect(),
|
|
2603
|
+
}, w = this.canvas.viewport.getViewportMatrix(), f = this.overlayLayer.getBoundingClientRect(), m = T(w, {
|
|
2592
2604
|
x: g.x - f.x,
|
|
2593
2605
|
y: g.y - f.y
|
|
2594
2606
|
}), v = T(w, {
|
|
@@ -2604,7 +2616,7 @@ class q {
|
|
|
2604
2616
|
}, this.canvas.removeEdge(s);
|
|
2605
2617
|
const E = {
|
|
2606
2618
|
overlayId: P.Static,
|
|
2607
|
-
portCoords:
|
|
2619
|
+
portCoords: m,
|
|
2608
2620
|
portDirection: c.direction
|
|
2609
2621
|
}, x = {
|
|
2610
2622
|
overlayId: P.Dragging,
|
|
@@ -2634,7 +2646,7 @@ class q {
|
|
|
2634
2646
|
});
|
|
2635
2647
|
}
|
|
2636
2648
|
tryCreateConnection(t) {
|
|
2637
|
-
const e =
|
|
2649
|
+
const e = mt(this.canvas.graph, t);
|
|
2638
2650
|
if (this.overlayCanvas.removeEdge(P.Edge), e === null) {
|
|
2639
2651
|
const d = this.draggingEdgePayload;
|
|
2640
2652
|
this.params.onEdgeReattachInterrupted({
|
|
@@ -2790,10 +2802,10 @@ const H = (r) => () => r, gt = H(0), le = () => {
|
|
|
2790
2802
|
}
|
|
2791
2803
|
};
|
|
2792
2804
|
}, we = (r) => {
|
|
2793
|
-
var w, f,
|
|
2805
|
+
var w, f, m, v, E;
|
|
2794
2806
|
const t = ((w = r.events) == null ? void 0 : w.onNodeDrag) ?? (() => {
|
|
2795
2807
|
}), e = r.nodeDragVerifier ?? (() => !0), s = ((f = r.events) == null ? void 0 : f.onNodeDragFinished) ?? (() => {
|
|
2796
|
-
}), i = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && i, a = (
|
|
2808
|
+
}), i = r.moveOnTop !== !1, n = r.moveEdgesOnTop !== !1 && i, a = (m = r.mouse) == null ? void 0 : m.dragCursor, h = a !== void 0 ? a : "grab", d = (v = r.mouse) == null ? void 0 : v.mouseDownEventVerifier, c = d !== void 0 ? d : (x) => x.button === 0, l = (E = r.mouse) == null ? void 0 : E.mouseUpEventVerifier, g = l !== void 0 ? l : (x) => x.button === 0;
|
|
2797
2809
|
return {
|
|
2798
2810
|
moveOnTop: i,
|
|
2799
2811
|
moveEdgesOnTop: n,
|
|
@@ -2815,7 +2827,7 @@ const H = (r) => () => r, gt = H(0), le = () => {
|
|
|
2815
2827
|
const l = n.canvasHeight * n.prevTransform.scale, g = i - l;
|
|
2816
2828
|
return h > g && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, g)), { scale: n.nextTransform.scale, x: a, y: h };
|
|
2817
2829
|
};
|
|
2818
|
-
},
|
|
2830
|
+
}, ye = (r) => {
|
|
2819
2831
|
const t = r.maxContentScale, e = r.minContentScale, s = t !== null ? 1 / t : 0, i = e !== null ? 1 / e : 1 / 0;
|
|
2820
2832
|
return (n) => {
|
|
2821
2833
|
const a = n.prevTransform, h = n.nextTransform;
|
|
@@ -2836,7 +2848,7 @@ const H = (r) => () => r, gt = H(0), le = () => {
|
|
|
2836
2848
|
y: l
|
|
2837
2849
|
};
|
|
2838
2850
|
};
|
|
2839
|
-
},
|
|
2851
|
+
}, me = (r) => (t) => r.reduce(
|
|
2840
2852
|
(e, s) => s({
|
|
2841
2853
|
prevTransform: t.prevTransform,
|
|
2842
2854
|
nextTransform: e,
|
|
@@ -2849,7 +2861,7 @@ const H = (r) => () => r, gt = H(0), le = () => {
|
|
|
2849
2861
|
return r;
|
|
2850
2862
|
switch (r.type) {
|
|
2851
2863
|
case "scale-limit":
|
|
2852
|
-
return
|
|
2864
|
+
return ye({
|
|
2853
2865
|
minContentScale: r.minContentScale ?? 0,
|
|
2854
2866
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
2855
2867
|
});
|
|
@@ -2862,10 +2874,10 @@ const H = (r) => () => r, gt = H(0), le = () => {
|
|
|
2862
2874
|
});
|
|
2863
2875
|
}
|
|
2864
2876
|
}, ut = (r) => {
|
|
2865
|
-
var
|
|
2866
|
-
const t = (
|
|
2877
|
+
var m, v, E, x, L, b, D, V, et, rt, ot, st;
|
|
2878
|
+
const t = (m = r == null ? void 0 : r.scale) == null ? void 0 : m.mouseWheelSensitivity, e = t !== void 0 ? t : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
|
|
2867
2879
|
let i;
|
|
2868
|
-
s !== void 0 ? Array.isArray(s) ? i =
|
|
2880
|
+
s !== void 0 ? Array.isArray(s) ? i = me(
|
|
2869
2881
|
s.map(
|
|
2870
2882
|
(N) => lt(N)
|
|
2871
2883
|
)
|
|
@@ -2979,9 +2991,11 @@ class Me {
|
|
|
2979
2991
|
o(this, "hasBackground", !1);
|
|
2980
2992
|
o(this, "hasUserConnectablePorts", !1);
|
|
2981
2993
|
o(this, "hasUserDraggableEdges", !1);
|
|
2982
|
-
o(this, "boxRenderingTrigger");
|
|
2994
|
+
o(this, "boxRenderingTrigger", new wt());
|
|
2995
|
+
o(this, "graphStore", new yt());
|
|
2996
|
+
o(this, "viewportStore", new Bt());
|
|
2983
2997
|
o(this, "window", window);
|
|
2984
|
-
this.element = t
|
|
2998
|
+
this.element = t;
|
|
2985
2999
|
}
|
|
2986
3000
|
/**
|
|
2987
3001
|
* specifies default values for graph entities
|
|
@@ -3024,7 +3038,7 @@ class Me {
|
|
|
3024
3038
|
* enables edge creation by dragging one port to another
|
|
3025
3039
|
*/
|
|
3026
3040
|
enableUserConnectablePorts(t) {
|
|
3027
|
-
return this.connectablePortsConfig = t ?? {}, this
|
|
3041
|
+
return this.hasUserConnectablePorts = !0, this.connectablePortsConfig = t ?? {}, this;
|
|
3028
3042
|
}
|
|
3029
3043
|
enableUserDraggableEdges(t) {
|
|
3030
3044
|
return this.hasUserDraggableEdges = !0, this.draggableEdgesConfig = t ?? {}, this;
|
|
@@ -3036,79 +3050,77 @@ class Me {
|
|
|
3036
3050
|
if (this.used)
|
|
3037
3051
|
throw new Te("CanvasBuilder is a single use object");
|
|
3038
3052
|
this.used = !0;
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
s,
|
|
3045
|
-
i.main
|
|
3053
|
+
const t = new ge(this.element);
|
|
3054
|
+
let e = new pt(
|
|
3055
|
+
this.graphStore,
|
|
3056
|
+
this.viewportStore,
|
|
3057
|
+
t.main
|
|
3046
3058
|
);
|
|
3047
|
-
|
|
3048
|
-
n,
|
|
3059
|
+
this.virtualScrollConfig !== void 0 && (e = new It(
|
|
3049
3060
|
e,
|
|
3050
|
-
|
|
3061
|
+
this.graphStore,
|
|
3062
|
+
this.boxRenderingTrigger,
|
|
3051
3063
|
be(this.virtualScrollConfig)
|
|
3052
3064
|
));
|
|
3053
|
-
const
|
|
3065
|
+
const s = pe(this.canvasDefaults), i = new ft(
|
|
3066
|
+
this.graphStore,
|
|
3067
|
+
this.viewportStore,
|
|
3054
3068
|
e,
|
|
3055
|
-
s
|
|
3056
|
-
n,
|
|
3057
|
-
a
|
|
3069
|
+
s
|
|
3058
3070
|
);
|
|
3059
3071
|
if (this.hasBackground && Q.configure(
|
|
3060
|
-
|
|
3072
|
+
i,
|
|
3061
3073
|
Ae(this.backgroundConfig),
|
|
3062
|
-
|
|
3063
|
-
), this.hasNodeResizeReactiveEdges && j.configure(
|
|
3064
|
-
|
|
3065
|
-
|
|
3074
|
+
t.background
|
|
3075
|
+
), this.hasNodeResizeReactiveEdges && j.configure(i), this.hasDraggableNode && Z.configure(
|
|
3076
|
+
i,
|
|
3077
|
+
t.main,
|
|
3066
3078
|
this.window,
|
|
3067
3079
|
we(this.dragConfig)
|
|
3068
3080
|
), this.hasUserConnectablePorts) {
|
|
3069
|
-
const
|
|
3081
|
+
const a = xe(
|
|
3070
3082
|
this.connectablePortsConfig,
|
|
3071
|
-
|
|
3072
|
-
|
|
3083
|
+
s.edges.shapeFactory,
|
|
3084
|
+
s.ports.direction
|
|
3073
3085
|
);
|
|
3074
3086
|
_.configure(
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3087
|
+
i,
|
|
3088
|
+
t.overlayConnectablePorts,
|
|
3089
|
+
this.viewportStore,
|
|
3078
3090
|
this.window,
|
|
3079
|
-
|
|
3091
|
+
a
|
|
3080
3092
|
);
|
|
3081
3093
|
}
|
|
3082
3094
|
if (this.hasUserDraggableEdges) {
|
|
3083
|
-
const
|
|
3095
|
+
const a = Se(
|
|
3084
3096
|
this.draggableEdgesConfig,
|
|
3085
|
-
|
|
3097
|
+
i.graph
|
|
3086
3098
|
);
|
|
3087
3099
|
q.configure(
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3100
|
+
i,
|
|
3101
|
+
t.overlayDraggableEdges,
|
|
3102
|
+
this.viewportStore,
|
|
3091
3103
|
this.window,
|
|
3092
|
-
|
|
3104
|
+
a
|
|
3093
3105
|
);
|
|
3094
3106
|
}
|
|
3095
3107
|
this.virtualScrollConfig !== void 0 ? J.configure(
|
|
3096
|
-
|
|
3097
|
-
|
|
3108
|
+
i,
|
|
3109
|
+
t.main,
|
|
3098
3110
|
this.window,
|
|
3099
3111
|
ut(this.transformConfig),
|
|
3100
|
-
|
|
3112
|
+
this.boxRenderingTrigger,
|
|
3101
3113
|
Pe(this.virtualScrollConfig)
|
|
3102
3114
|
) : this.hasTransformableViewport && k.configure(
|
|
3103
|
-
|
|
3104
|
-
|
|
3115
|
+
i,
|
|
3116
|
+
t.main,
|
|
3105
3117
|
this.window,
|
|
3106
3118
|
ut(this.transformConfig)
|
|
3107
3119
|
);
|
|
3108
|
-
const
|
|
3109
|
-
|
|
3120
|
+
const n = () => {
|
|
3121
|
+
t.destroy(), i.onBeforeDestroy.unsubscribe(n);
|
|
3110
3122
|
};
|
|
3111
|
-
return
|
|
3123
|
+
return i.onBeforeDestroy.subscribe(n), i;
|
|
3112
3124
|
}
|
|
3113
3125
|
}
|
|
3114
3126
|
export {
|