@html-graph/html-graph 2.1.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/html-graph.d.ts +10 -6
- package/dist/html-graph.js +242 -236
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,75 +1,7 @@
|
|
|
1
1
|
var tt = Object.defineProperty;
|
|
2
2
|
var et = (e, t, o) => t in e ? tt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
3
|
var i = (e, t, o) => et(e, typeof t != "symbol" ? t + "" : t, o);
|
|
4
|
-
class
|
|
5
|
-
constructor() {
|
|
6
|
-
i(this, "callbacks", /* @__PURE__ */ new Set());
|
|
7
|
-
}
|
|
8
|
-
subscribe(t) {
|
|
9
|
-
this.callbacks.add(t);
|
|
10
|
-
}
|
|
11
|
-
unsubscribe(t) {
|
|
12
|
-
this.callbacks.delete(t);
|
|
13
|
-
}
|
|
14
|
-
emit(t) {
|
|
15
|
-
this.callbacks.forEach((o) => {
|
|
16
|
-
o(t);
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const ot = () => {
|
|
21
|
-
const e = new O();
|
|
22
|
-
return [e, e];
|
|
23
|
-
}, _ = (e) => ({
|
|
24
|
-
scale: 1 / e.scale,
|
|
25
|
-
x: -e.x / e.scale,
|
|
26
|
-
y: -e.y / e.scale
|
|
27
|
-
}), J = {
|
|
28
|
-
scale: 1,
|
|
29
|
-
x: 0,
|
|
30
|
-
y: 0
|
|
31
|
-
};
|
|
32
|
-
class rt {
|
|
33
|
-
constructor() {
|
|
34
|
-
i(this, "viewportMatrix", J);
|
|
35
|
-
i(this, "contentMatrix", J);
|
|
36
|
-
i(this, "emitter");
|
|
37
|
-
i(this, "onAfterUpdate");
|
|
38
|
-
[this.emitter, this.onAfterUpdate] = ot();
|
|
39
|
-
}
|
|
40
|
-
getViewportMatrix() {
|
|
41
|
-
return this.viewportMatrix;
|
|
42
|
-
}
|
|
43
|
-
getContentMatrix() {
|
|
44
|
-
return this.contentMatrix;
|
|
45
|
-
}
|
|
46
|
-
patchViewportMatrix(t) {
|
|
47
|
-
this.viewportMatrix = {
|
|
48
|
-
scale: t.scale ?? this.viewportMatrix.scale,
|
|
49
|
-
x: t.x ?? this.viewportMatrix.x,
|
|
50
|
-
y: t.y ?? this.viewportMatrix.y
|
|
51
|
-
}, this.contentMatrix = _(this.viewportMatrix), this.emitter.emit();
|
|
52
|
-
}
|
|
53
|
-
patchContentMatrix(t) {
|
|
54
|
-
this.contentMatrix = {
|
|
55
|
-
scale: t.scale ?? this.contentMatrix.scale,
|
|
56
|
-
x: t.x ?? this.contentMatrix.x,
|
|
57
|
-
y: t.y ?? this.contentMatrix.y
|
|
58
|
-
}, this.viewportMatrix = _(this.contentMatrix), this.emitter.emit();
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
class it {
|
|
62
|
-
constructor(t) {
|
|
63
|
-
this.transformer = t;
|
|
64
|
-
}
|
|
65
|
-
getViewportMatrix() {
|
|
66
|
-
return { ...this.transformer.getViewportMatrix() };
|
|
67
|
-
}
|
|
68
|
-
getContentMatrix() {
|
|
69
|
-
return { ...this.transformer.getContentMatrix() };
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
class st {
|
|
4
|
+
class ot {
|
|
73
5
|
constructor(t) {
|
|
74
6
|
this.graphStore = t;
|
|
75
7
|
}
|
|
@@ -90,7 +22,8 @@ class st {
|
|
|
90
22
|
const o = this.graphStore.getPort(t);
|
|
91
23
|
return o === void 0 ? null : {
|
|
92
24
|
element: o.element,
|
|
93
|
-
direction: o.direction
|
|
25
|
+
direction: o.direction,
|
|
26
|
+
nodeId: o.nodeId
|
|
94
27
|
};
|
|
95
28
|
}
|
|
96
29
|
getAllPortIds() {
|
|
@@ -99,8 +32,13 @@ class st {
|
|
|
99
32
|
getNodePortIds(t) {
|
|
100
33
|
return this.graphStore.getNode(t) === void 0 ? null : this.graphStore.getNodePortIds(t);
|
|
101
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated
|
|
37
|
+
* use graph.getPort()?.nodeId ?? null instead
|
|
38
|
+
*/
|
|
102
39
|
getPortNodeId(t) {
|
|
103
|
-
|
|
40
|
+
var o;
|
|
41
|
+
return ((o = this.graphStore.getPort(t)) == null ? void 0 : o.nodeId) ?? null;
|
|
104
42
|
}
|
|
105
43
|
getAllEdgeIds() {
|
|
106
44
|
return this.graphStore.getAllEdgeIds();
|
|
@@ -134,11 +72,22 @@ class st {
|
|
|
134
72
|
return this.graphStore.getNode(t) === void 0 ? null : this.graphStore.getNodeAdjacentEdgeIds(t);
|
|
135
73
|
}
|
|
136
74
|
}
|
|
137
|
-
class
|
|
75
|
+
class rt {
|
|
76
|
+
constructor(t) {
|
|
77
|
+
this.transformer = t;
|
|
78
|
+
}
|
|
79
|
+
getViewportMatrix() {
|
|
80
|
+
return { ...this.transformer.getViewportMatrix() };
|
|
81
|
+
}
|
|
82
|
+
getContentMatrix() {
|
|
83
|
+
return { ...this.transformer.getContentMatrix() };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
class it {
|
|
138
87
|
constructor(t, o, r) {
|
|
139
88
|
i(this, "viewport");
|
|
140
89
|
i(this, "graph");
|
|
141
|
-
this.graphStore = t, this.
|
|
90
|
+
this.graphStore = t, this.viewportStore = o, this.htmlView = r, this.graph = new ot(this.graphStore), this.viewport = new rt(this.viewportStore);
|
|
142
91
|
}
|
|
143
92
|
attach(t) {
|
|
144
93
|
this.htmlView.attach(t);
|
|
@@ -158,7 +107,7 @@ class nt {
|
|
|
158
107
|
removeNode(t) {
|
|
159
108
|
this.graphStore.getNodePortIds(t).forEach((o) => {
|
|
160
109
|
this.unmarkPort(o);
|
|
161
|
-
}), this.
|
|
110
|
+
}), this.graphStore.removeNode(t), this.htmlView.detachNode(t);
|
|
162
111
|
}
|
|
163
112
|
markPort(t) {
|
|
164
113
|
this.graphStore.addPort(t);
|
|
@@ -182,13 +131,13 @@ class nt {
|
|
|
182
131
|
o.shape !== void 0 && (r.shape = o.shape, this.htmlView.updateEdgeShape(t)), o.from !== void 0 && this.graphStore.updateEdgeFrom(t, o.from), o.to !== void 0 && this.graphStore.updateEdgeTo(t, o.to), this.htmlView.renderEdge(t), o.priority !== void 0 && (r.priority = o.priority, this.htmlView.updateEdgePriority(t));
|
|
183
132
|
}
|
|
184
133
|
removeEdge(t) {
|
|
185
|
-
this.
|
|
134
|
+
this.graphStore.removeEdge(t), this.htmlView.detachEdge(t);
|
|
186
135
|
}
|
|
187
136
|
patchViewportMatrix(t) {
|
|
188
|
-
this.
|
|
137
|
+
this.viewportStore.patchViewportMatrix(t);
|
|
189
138
|
}
|
|
190
139
|
patchContentMatrix(t) {
|
|
191
|
-
this.
|
|
140
|
+
this.viewportStore.patchContentMatrix(t);
|
|
192
141
|
}
|
|
193
142
|
clear() {
|
|
194
143
|
this.htmlView.clear(), this.graphStore.clear();
|
|
@@ -202,7 +151,7 @@ const C = (e, t, o) => {
|
|
|
202
151
|
return t >= r && t <= r + h && o >= n && o <= n + s;
|
|
203
152
|
}, $ = (e, t, o) => t >= 0 && t <= e.innerWidth && o >= 0 && o <= e.innerHeight, W = (e, t) => {
|
|
204
153
|
t !== null ? e.style.cursor = t : e.style.removeProperty("cursor");
|
|
205
|
-
},
|
|
154
|
+
}, st = (e) => {
|
|
206
155
|
var g, y, x, v, A, S;
|
|
207
156
|
const t = ((g = e == null ? void 0 : e.events) == null ? void 0 : g.onNodeDrag) ?? (() => {
|
|
208
157
|
}), o = ((y = e == null ? void 0 : e.events) == null ? void 0 : y.onBeforeNodeDrag) ?? (() => !0), r = ((x = e == null ? void 0 : e.events) == null ? void 0 : x.onNodeDragFinished) ?? (() => {
|
|
@@ -217,7 +166,7 @@ const C = (e, t, o) => {
|
|
|
217
166
|
onNodeDragFinished: r
|
|
218
167
|
};
|
|
219
168
|
};
|
|
220
|
-
class
|
|
169
|
+
class nt {
|
|
221
170
|
constructor(t, o) {
|
|
222
171
|
i(this, "graph");
|
|
223
172
|
i(this, "viewport");
|
|
@@ -257,7 +206,7 @@ class ct {
|
|
|
257
206
|
i(this, "previousTouchCoords", null);
|
|
258
207
|
i(this, "window", window);
|
|
259
208
|
i(this, "options");
|
|
260
|
-
this.canvas = t, this.viewport = this.canvas.viewport, this.graph = this.canvas.graph, this.options =
|
|
209
|
+
this.canvas = t, this.viewport = this.canvas.viewport, this.graph = this.canvas.graph, this.options = st(o ?? {});
|
|
261
210
|
}
|
|
262
211
|
attach(t) {
|
|
263
212
|
this.detach(), this.element = t, this.canvas.attach(this.element);
|
|
@@ -388,7 +337,7 @@ class ct {
|
|
|
388
337
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
389
338
|
}
|
|
390
339
|
}
|
|
391
|
-
const
|
|
340
|
+
const ht = (e) => {
|
|
392
341
|
const t = e.minX !== null ? e.minX : -1 / 0, o = e.maxX !== null ? e.maxX : 1 / 0, r = e.minY !== null ? e.minY : -1 / 0, n = e.maxY !== null ? e.maxY : 1 / 0;
|
|
393
342
|
return (h) => {
|
|
394
343
|
let s = h.nextTransform.x, c = h.nextTransform.y;
|
|
@@ -398,7 +347,7 @@ const dt = (e) => {
|
|
|
398
347
|
const l = h.canvasHeight * h.prevTransform.scale, g = n - l;
|
|
399
348
|
return c > g && c > h.prevTransform.y && (c = Math.max(h.prevTransform.y, g)), { scale: h.nextTransform.scale, x: s, y: c };
|
|
400
349
|
};
|
|
401
|
-
},
|
|
350
|
+
}, ct = (e) => {
|
|
402
351
|
const t = e.maxContentScale, o = e.minContentScale, r = t !== null ? 1 / t : 0, n = o !== null ? 1 / o : 1 / 0;
|
|
403
352
|
return (h) => {
|
|
404
353
|
const s = h.prevTransform, c = h.nextTransform;
|
|
@@ -419,7 +368,7 @@ const dt = (e) => {
|
|
|
419
368
|
y: l
|
|
420
369
|
};
|
|
421
370
|
};
|
|
422
|
-
},
|
|
371
|
+
}, dt = (e) => (t) => e.reduce(
|
|
423
372
|
(o, r) => r({
|
|
424
373
|
prevTransform: t.prevTransform,
|
|
425
374
|
nextTransform: o,
|
|
@@ -427,38 +376,38 @@ const dt = (e) => {
|
|
|
427
376
|
canvasHeight: t.canvasHeight
|
|
428
377
|
}),
|
|
429
378
|
t.nextTransform
|
|
430
|
-
),
|
|
379
|
+
), _ = (e) => {
|
|
431
380
|
if (typeof e == "function")
|
|
432
381
|
return e;
|
|
433
382
|
switch (e.type) {
|
|
434
383
|
case "scale-limit":
|
|
435
|
-
return
|
|
384
|
+
return ct({
|
|
436
385
|
minContentScale: e.minContentScale ?? 0,
|
|
437
386
|
maxContentScale: e.maxContentScale ?? 1 / 0
|
|
438
387
|
});
|
|
439
388
|
case "shift-limit":
|
|
440
|
-
return
|
|
389
|
+
return ht({
|
|
441
390
|
minX: e.minX ?? -1 / 0,
|
|
442
391
|
maxX: e.maxX ?? 1 / 0,
|
|
443
392
|
minY: e.minY ?? -1 / 0,
|
|
444
393
|
maxY: e.maxY ?? 1 / 0
|
|
445
394
|
});
|
|
446
395
|
}
|
|
447
|
-
},
|
|
448
|
-
var v, A, S, T, z,
|
|
396
|
+
}, at = (e) => {
|
|
397
|
+
var v, A, S, T, z, L, D, P, U, j, G, K;
|
|
449
398
|
const t = (v = e == null ? void 0 : e.scale) == null ? void 0 : v.mouseWheelSensitivity, o = t !== void 0 ? t : 1.2, r = e == null ? void 0 : e.transformPreprocessor;
|
|
450
399
|
let n;
|
|
451
|
-
r !== void 0 ? Array.isArray(r) ? n =
|
|
400
|
+
r !== void 0 ? Array.isArray(r) ? n = dt(
|
|
452
401
|
r.map(
|
|
453
|
-
(V) =>
|
|
402
|
+
(V) => _(V)
|
|
454
403
|
)
|
|
455
|
-
) : n =
|
|
404
|
+
) : n = _(r) : n = (V) => V.nextTransform;
|
|
456
405
|
const h = ((A = e == null ? void 0 : e.shift) == null ? void 0 : A.cursor) !== void 0 ? e.shift.cursor : "grab", s = ((S = e == null ? void 0 : e.events) == null ? void 0 : S.onBeforeTransformChange) ?? (() => {
|
|
457
406
|
}), c = ((T = e == null ? void 0 : e.events) == null ? void 0 : T.onTransformChange) ?? (() => {
|
|
458
|
-
}), d = (z = e == null ? void 0 : e.shift) == null ? void 0 : z.mouseDownEventVerifier, a = d !== void 0 ? d : (V) => V.button === 0, l = (
|
|
407
|
+
}), d = (z = e == null ? void 0 : e.shift) == null ? void 0 : z.mouseDownEventVerifier, a = d !== void 0 ? d : (V) => V.button === 0, l = (L = e == null ? void 0 : e.shift) == null ? void 0 : L.mouseUpEventVerifier, g = l !== void 0 ? l : (V) => V.button === 0, y = (D = e == null ? void 0 : e.scale) == null ? void 0 : D.mouseWheelEventVerifier, x = y !== void 0 ? y : () => !0;
|
|
459
408
|
return {
|
|
460
409
|
wheelSensitivity: o,
|
|
461
|
-
onTransformStarted: ((
|
|
410
|
+
onTransformStarted: ((P = e == null ? void 0 : e.events) == null ? void 0 : P.onTransformStarted) ?? (() => {
|
|
462
411
|
}),
|
|
463
412
|
onTransformFinished: ((U = e == null ? void 0 : e.events) == null ? void 0 : U.onTransformFinished) ?? (() => {
|
|
464
413
|
}),
|
|
@@ -475,7 +424,7 @@ const dt = (e) => {
|
|
|
475
424
|
onResizeTransformFinished: ((K = e == null ? void 0 : e.events) == null ? void 0 : K.onResizeTransformFinished) ?? (() => {
|
|
476
425
|
})
|
|
477
426
|
};
|
|
478
|
-
},
|
|
427
|
+
}, m = (e) => {
|
|
479
428
|
const t = [], o = e.touches.length;
|
|
480
429
|
for (let c = 0; c < o; c++)
|
|
481
430
|
t.push([e.touches[c].clientX, e.touches[c].clientY]);
|
|
@@ -493,16 +442,16 @@ const dt = (e) => {
|
|
|
493
442
|
touchesCnt: o,
|
|
494
443
|
touches: t
|
|
495
444
|
};
|
|
496
|
-
},
|
|
445
|
+
}, lt = (e, t, o) => ({
|
|
497
446
|
scale: e.scale,
|
|
498
447
|
x: e.x + e.scale * t,
|
|
499
448
|
y: e.y + e.scale * o
|
|
500
|
-
}),
|
|
449
|
+
}), gt = (e, t, o, r) => ({
|
|
501
450
|
scale: e.scale * t,
|
|
502
451
|
x: e.scale * (1 - t) * o + e.x,
|
|
503
452
|
y: e.scale * (1 - t) * r + e.y
|
|
504
453
|
});
|
|
505
|
-
class
|
|
454
|
+
class O {
|
|
506
455
|
constructor(t, o) {
|
|
507
456
|
i(this, "graph");
|
|
508
457
|
i(this, "viewport");
|
|
@@ -535,16 +484,16 @@ class q {
|
|
|
535
484
|
});
|
|
536
485
|
i(this, "onTouchStart", (t) => {
|
|
537
486
|
if (this.prevTouches !== null) {
|
|
538
|
-
this.prevTouches =
|
|
487
|
+
this.prevTouches = m(t);
|
|
539
488
|
return;
|
|
540
489
|
}
|
|
541
|
-
this.prevTouches =
|
|
490
|
+
this.prevTouches = m(t), this.window.addEventListener("touchmove", this.onWindowTouchMove), this.window.addEventListener("touchend", this.onWindowTouchFinish), this.window.addEventListener("touchcancel", this.onWindowTouchFinish), this.options.onTransformStarted();
|
|
542
491
|
});
|
|
543
492
|
i(this, "onWindowTouchMove", (t) => {
|
|
544
493
|
const o = this.element;
|
|
545
494
|
if (o === null)
|
|
546
495
|
return;
|
|
547
|
-
const r =
|
|
496
|
+
const r = m(t);
|
|
548
497
|
if (!r.touches.every(
|
|
549
498
|
(h) => C(o, h[0], h[1]) && $(this.window, h[0], h[1])
|
|
550
499
|
)) {
|
|
@@ -562,7 +511,7 @@ class q {
|
|
|
562
511
|
this.prevTouches = r;
|
|
563
512
|
});
|
|
564
513
|
i(this, "onWindowTouchFinish", (t) => {
|
|
565
|
-
t.touches.length > 0 ? this.prevTouches =
|
|
514
|
+
t.touches.length > 0 ? this.prevTouches = m(t) : this.stopTouchDrag();
|
|
566
515
|
});
|
|
567
516
|
i(this, "observer", new ResizeObserver(() => {
|
|
568
517
|
const t = this.canvas.viewport.getViewportMatrix(), { width: o, height: r } = this.element.getBoundingClientRect(), n = this.options.transformPreprocessor({
|
|
@@ -574,7 +523,7 @@ class q {
|
|
|
574
523
|
this.options.onResizeTransformStarted(), this.canvas.patchViewportMatrix(n), this.options.onResizeTransformFinished();
|
|
575
524
|
}));
|
|
576
525
|
i(this, "options");
|
|
577
|
-
this.canvas = t, this.options =
|
|
526
|
+
this.canvas = t, this.options = at(o), this.viewport = this.canvas.viewport, this.graph = this.canvas.graph;
|
|
578
527
|
}
|
|
579
528
|
attach(t) {
|
|
580
529
|
this.detach(), this.element = t, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown), this.element.addEventListener("wheel", this.onWheelScroll), this.element.addEventListener("touchstart", this.onTouchStart), this.canvas.attach(this.element);
|
|
@@ -622,7 +571,7 @@ class q {
|
|
|
622
571
|
this.detach(), this.removeMouseDragListeners(), this.removeTouchDragListeners(), this.canvas.destroy();
|
|
623
572
|
}
|
|
624
573
|
moveViewport(t, o, r) {
|
|
625
|
-
const n = this.viewport.getViewportMatrix(), h =
|
|
574
|
+
const n = this.viewport.getViewportMatrix(), h = lt(n, o, r), { width: s, height: c } = t.getBoundingClientRect(), d = this.options.transformPreprocessor({
|
|
626
575
|
prevTransform: n,
|
|
627
576
|
nextTransform: h,
|
|
628
577
|
canvasWidth: s,
|
|
@@ -631,7 +580,7 @@ class q {
|
|
|
631
580
|
this.performTransform(d);
|
|
632
581
|
}
|
|
633
582
|
scaleViewport(t, o, r, n) {
|
|
634
|
-
const h = this.canvas.viewport.getViewportMatrix(), s =
|
|
583
|
+
const h = this.canvas.viewport.getViewportMatrix(), s = gt(h, o, r, n), { width: c, height: d } = t.getBoundingClientRect(), a = this.options.transformPreprocessor({
|
|
635
584
|
prevTransform: h,
|
|
636
585
|
nextTransform: s,
|
|
637
586
|
canvasWidth: c,
|
|
@@ -655,7 +604,7 @@ class q {
|
|
|
655
604
|
this.options.onBeforeTransformChange(), this.canvas.patchViewportMatrix(t), this.options.onTransformChange();
|
|
656
605
|
}
|
|
657
606
|
}
|
|
658
|
-
class
|
|
607
|
+
class ut {
|
|
659
608
|
constructor() {
|
|
660
609
|
i(this, "keyMap", /* @__PURE__ */ new Map());
|
|
661
610
|
i(this, "valueMap", /* @__PURE__ */ new Map());
|
|
@@ -692,11 +641,11 @@ class yt {
|
|
|
692
641
|
this.keyMap.clear(), this.valueMap.clear();
|
|
693
642
|
}
|
|
694
643
|
}
|
|
695
|
-
class
|
|
644
|
+
class wt {
|
|
696
645
|
constructor(t) {
|
|
697
646
|
i(this, "viewport");
|
|
698
647
|
i(this, "graph");
|
|
699
|
-
i(this, "nodes", new
|
|
648
|
+
i(this, "nodes", new ut());
|
|
700
649
|
i(this, "nodesResizeObserver");
|
|
701
650
|
i(this, "window", window);
|
|
702
651
|
this.canvas = t, this.nodesResizeObserver = new this.window.ResizeObserver((o) => {
|
|
@@ -760,7 +709,7 @@ class vt {
|
|
|
760
709
|
});
|
|
761
710
|
}
|
|
762
711
|
}
|
|
763
|
-
class
|
|
712
|
+
class yt {
|
|
764
713
|
constructor(t, o, r, n) {
|
|
765
714
|
i(this, "graph");
|
|
766
715
|
i(this, "viewport");
|
|
@@ -807,7 +756,7 @@ class ft {
|
|
|
807
756
|
}
|
|
808
757
|
}
|
|
809
758
|
};
|
|
810
|
-
this.canvas = new
|
|
759
|
+
this.canvas = new O(
|
|
811
760
|
t,
|
|
812
761
|
c
|
|
813
762
|
), this.viewportMatrix = this.canvas.viewport.getViewportMatrix(), this.viewport = this.canvas.viewport, this.graph = this.canvas.graph, this.trigger.subscribe(this.updateLoadedArea);
|
|
@@ -871,28 +820,28 @@ class ft {
|
|
|
871
820
|
this.trigger.emit({ x: r, y: n, width: h, height: s });
|
|
872
821
|
}
|
|
873
822
|
}
|
|
874
|
-
const
|
|
823
|
+
const vt = () => {
|
|
875
824
|
const e = document.createElement("div");
|
|
876
825
|
return e.style.width = "100%", e.style.height = "100%", e.style.position = "relative", e.style.overflow = "hidden", e;
|
|
877
|
-
},
|
|
826
|
+
}, ft = () => {
|
|
878
827
|
const e = document.createElement("div");
|
|
879
828
|
return e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.width = "0", e.style.height = "0", e;
|
|
880
|
-
},
|
|
829
|
+
}, xt = () => {
|
|
881
830
|
const e = document.createElement("div");
|
|
882
831
|
return e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.visibility = "hidden", e;
|
|
883
832
|
};
|
|
884
|
-
class
|
|
833
|
+
class Et {
|
|
885
834
|
constructor(t, o) {
|
|
886
835
|
i(this, "canvasWrapper", null);
|
|
887
|
-
i(this, "host",
|
|
888
|
-
i(this, "container",
|
|
836
|
+
i(this, "host", vt());
|
|
837
|
+
i(this, "container", ft());
|
|
889
838
|
i(this, "nodeIdToWrapperElementMap", /* @__PURE__ */ new Map());
|
|
890
839
|
i(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
|
|
891
840
|
i(this, "applyTransform", () => {
|
|
892
|
-
const t = this.
|
|
841
|
+
const t = this.viewportStore.getContentMatrix();
|
|
893
842
|
this.container.style.transform = `matrix(${t.scale}, 0, 0, ${t.scale}, ${t.x}, ${t.y})`;
|
|
894
843
|
});
|
|
895
|
-
this.graphStore = t, this.
|
|
844
|
+
this.graphStore = t, this.viewportStore = o, this.host.appendChild(this.container), this.viewportStore.onAfterUpdate.subscribe(this.applyTransform);
|
|
896
845
|
}
|
|
897
846
|
attach(t) {
|
|
898
847
|
this.detach(), this.canvasWrapper = t, this.canvasWrapper.appendChild(this.host);
|
|
@@ -901,20 +850,20 @@ class At {
|
|
|
901
850
|
this.canvasWrapper !== null && (this.canvasWrapper.removeChild(this.host), this.canvasWrapper = null);
|
|
902
851
|
}
|
|
903
852
|
attachNode(t) {
|
|
904
|
-
const o = this.graphStore.getNode(t), r =
|
|
853
|
+
const o = this.graphStore.getNode(t), r = xt();
|
|
905
854
|
r.appendChild(o.element), this.container.appendChild(r), this.nodeIdToWrapperElementMap.set(t, r), this.updateNodeCoordinates(t), this.updateNodePriority(t), r.style.visibility = "visible";
|
|
906
855
|
}
|
|
907
856
|
detachNode(t) {
|
|
908
|
-
const o = this.
|
|
909
|
-
|
|
857
|
+
const o = this.nodeIdToWrapperElementMap.get(t);
|
|
858
|
+
o.removeChild(o.firstChild), this.container.removeChild(o), this.nodeIdToWrapperElementMap.delete(t);
|
|
910
859
|
}
|
|
911
860
|
attachEdge(t) {
|
|
912
|
-
const o = this.graphStore.getEdge(t);
|
|
913
|
-
this.edgeIdToElementMap.set(t, o
|
|
861
|
+
const o = this.graphStore.getEdge(t).shape.svg;
|
|
862
|
+
this.edgeIdToElementMap.set(t, o), this.container.appendChild(o), this.renderEdge(t), this.updateEdgePriority(t);
|
|
914
863
|
}
|
|
915
864
|
detachEdge(t) {
|
|
916
|
-
const o = this.
|
|
917
|
-
this.container.removeChild(o
|
|
865
|
+
const o = this.edgeIdToElementMap.get(t);
|
|
866
|
+
this.container.removeChild(o), this.edgeIdToElementMap.delete(t);
|
|
918
867
|
}
|
|
919
868
|
clear() {
|
|
920
869
|
this.edgeIdToElementMap.forEach((t, o) => {
|
|
@@ -924,10 +873,10 @@ class At {
|
|
|
924
873
|
});
|
|
925
874
|
}
|
|
926
875
|
destroy() {
|
|
927
|
-
this.
|
|
876
|
+
this.viewportStore.onAfterUpdate.unsubscribe(this.applyTransform), this.clear(), this.detach(), this.host.removeChild(this.container);
|
|
928
877
|
}
|
|
929
878
|
updateNodeCoordinates(t) {
|
|
930
|
-
const o = this.nodeIdToWrapperElementMap.get(t), r = this.graphStore.getNode(t), { width: n, height: h } = r.element.getBoundingClientRect(), s = this.
|
|
879
|
+
const o = this.nodeIdToWrapperElementMap.get(t), r = this.graphStore.getNode(t), { width: n, height: h } = r.element.getBoundingClientRect(), s = this.viewportStore.getViewportMatrix().scale, c = r.centerFn(n, h), d = r.x - s * c.x, a = r.y - s * c.y;
|
|
931
880
|
o.style.transform = `translate(${d}px, ${a}px)`;
|
|
932
881
|
}
|
|
933
882
|
updateNodePriority(t) {
|
|
@@ -941,7 +890,7 @@ class At {
|
|
|
941
890
|
this.edgeIdToElementMap.set(t, r.shape.svg), this.container.appendChild(r.shape.svg);
|
|
942
891
|
}
|
|
943
892
|
renderEdge(t) {
|
|
944
|
-
const o = this.graphStore.getEdge(t), r = this.graphStore.getPort(o.from), n = this.graphStore.getPort(o.to), h = r.element.getBoundingClientRect(), s = n.element.getBoundingClientRect(), c = this.host.getBoundingClientRect(), d = this.
|
|
893
|
+
const o = this.graphStore.getEdge(t), r = this.graphStore.getPort(o.from), n = this.graphStore.getPort(o.to), h = r.element.getBoundingClientRect(), s = n.element.getBoundingClientRect(), c = this.host.getBoundingClientRect(), d = this.viewportStore.getViewportMatrix(), a = {
|
|
945
894
|
x: d.scale * (h.left - c.left) + d.x,
|
|
946
895
|
y: d.scale * (h.top - c.top) + d.y
|
|
947
896
|
}, l = {
|
|
@@ -954,7 +903,7 @@ class At {
|
|
|
954
903
|
height: h.height * d.scale,
|
|
955
904
|
direction: r.direction,
|
|
956
905
|
portId: o.from,
|
|
957
|
-
nodeId:
|
|
906
|
+
nodeId: r.nodeId
|
|
958
907
|
}, y = {
|
|
959
908
|
x: l.x,
|
|
960
909
|
y: l.y,
|
|
@@ -962,7 +911,7 @@ class At {
|
|
|
962
911
|
height: s.height * d.scale,
|
|
963
912
|
direction: n.direction,
|
|
964
913
|
portId: o.to,
|
|
965
|
-
nodeId:
|
|
914
|
+
nodeId: n.nodeId
|
|
966
915
|
};
|
|
967
916
|
o.shape.render({
|
|
968
917
|
from: g,
|
|
@@ -974,7 +923,7 @@ class At {
|
|
|
974
923
|
o.shape.svg.style.zIndex = `${o.priority}`;
|
|
975
924
|
}
|
|
976
925
|
}
|
|
977
|
-
class
|
|
926
|
+
class St {
|
|
978
927
|
constructor(t) {
|
|
979
928
|
i(this, "xFrom", 1 / 0);
|
|
980
929
|
i(this, "yFrom", 1 / 0);
|
|
@@ -990,11 +939,11 @@ class Tt {
|
|
|
990
939
|
return o.x >= this.xFrom && o.x <= this.xTo && o.y >= this.yFrom && o.y <= this.yTo;
|
|
991
940
|
}
|
|
992
941
|
hasEdge(t) {
|
|
993
|
-
const o = this.graphStore.getEdge(t), r = this.graphStore.
|
|
942
|
+
const o = this.graphStore.getEdge(t), r = this.graphStore.getPort(o.from).nodeId, n = this.graphStore.getPort(o.to).nodeId, h = this.graphStore.getNode(r), s = this.graphStore.getNode(n), c = Math.min(h.x, s.x), d = Math.max(h.x, s.x), a = Math.min(h.y, s.y), l = Math.max(h.y, s.y);
|
|
994
943
|
return c <= this.xTo && d >= this.xFrom && a <= this.yTo && l >= this.yFrom;
|
|
995
944
|
}
|
|
996
945
|
}
|
|
997
|
-
class
|
|
946
|
+
class At {
|
|
998
947
|
constructor(t, o, r) {
|
|
999
948
|
i(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
1000
949
|
i(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
@@ -1006,7 +955,7 @@ class pt {
|
|
|
1006
955
|
const c = this.renderingBox.hasNode(s), d = this.attachedNodes.has(s);
|
|
1007
956
|
c && !d ? o.add(s) : !c && d && r.add(s);
|
|
1008
957
|
}), this.graphStore.getAllEdgeIds().forEach((s) => {
|
|
1009
|
-
const c = this.renderingBox.hasEdge(s), d = this.attachedEdges.has(s), a = this.graphStore.getEdge(s), l = this.graphStore.
|
|
958
|
+
const c = this.renderingBox.hasEdge(s), d = this.attachedEdges.has(s), a = this.graphStore.getEdge(s), l = this.graphStore.getPort(a.from).nodeId, g = this.graphStore.getPort(a.to).nodeId;
|
|
1010
959
|
c && (this.renderingBox.hasNode(l) || (o.add(l), r.delete(l)), this.renderingBox.hasNode(g) || (o.add(g), r.delete(g))), c && !d ? n.add(s) : !c && d && h.add(s);
|
|
1011
960
|
}), h.forEach((s) => {
|
|
1012
961
|
this.handleDetachEdge(s);
|
|
@@ -1018,7 +967,7 @@ class pt {
|
|
|
1018
967
|
this.handleAttachEdge(s);
|
|
1019
968
|
});
|
|
1020
969
|
});
|
|
1021
|
-
this.htmlView = t, this.graphStore = o, this.trigger = r, this.renderingBox = new
|
|
970
|
+
this.htmlView = t, this.graphStore = o, this.trigger = r, this.renderingBox = new St(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
1022
971
|
}
|
|
1023
972
|
attach(t) {
|
|
1024
973
|
this.htmlView.attach(t);
|
|
@@ -1062,7 +1011,7 @@ class pt {
|
|
|
1062
1011
|
this.clear(), this.htmlView.destroy(), this.trigger.unsubscribe(this.updateViewport);
|
|
1063
1012
|
}
|
|
1064
1013
|
attachEdgeEntities(t) {
|
|
1065
|
-
const o = this.graphStore.getEdge(t), r = this.graphStore.
|
|
1014
|
+
const o = this.graphStore.getEdge(t), r = this.graphStore.getPort(o.from).nodeId, n = this.graphStore.getPort(o.to).nodeId;
|
|
1066
1015
|
this.attachedNodes.has(r) || this.handleAttachNode(r), this.attachedNodes.has(n) || this.handleAttachNode(n), this.handleAttachEdge(t);
|
|
1067
1016
|
}
|
|
1068
1017
|
handleAttachNode(t) {
|
|
@@ -1078,6 +1027,26 @@ class pt {
|
|
|
1078
1027
|
this.htmlView.detachEdge(t), this.attachedEdges.delete(t);
|
|
1079
1028
|
}
|
|
1080
1029
|
}
|
|
1030
|
+
class q {
|
|
1031
|
+
constructor() {
|
|
1032
|
+
i(this, "callbacks", /* @__PURE__ */ new Set());
|
|
1033
|
+
}
|
|
1034
|
+
subscribe(t) {
|
|
1035
|
+
this.callbacks.add(t);
|
|
1036
|
+
}
|
|
1037
|
+
unsubscribe(t) {
|
|
1038
|
+
this.callbacks.delete(t);
|
|
1039
|
+
}
|
|
1040
|
+
emit(t) {
|
|
1041
|
+
this.callbacks.forEach((o) => {
|
|
1042
|
+
o(t);
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
const Tt = () => {
|
|
1047
|
+
const e = new q();
|
|
1048
|
+
return [e, e];
|
|
1049
|
+
};
|
|
1081
1050
|
class Y {
|
|
1082
1051
|
constructor(t) {
|
|
1083
1052
|
i(this, "counter", 0);
|
|
@@ -1100,14 +1069,14 @@ class E extends Error {
|
|
|
1100
1069
|
i(this, "name", "HtmlGraphError");
|
|
1101
1070
|
}
|
|
1102
1071
|
}
|
|
1103
|
-
const
|
|
1072
|
+
const pt = (e, t) => ({
|
|
1104
1073
|
x: e / 2,
|
|
1105
1074
|
y: t / 2
|
|
1106
|
-
}), X = (e) => () => e,
|
|
1075
|
+
}), X = (e) => () => e, J = X(0), Mt = () => {
|
|
1107
1076
|
let e = 0;
|
|
1108
1077
|
return () => e++;
|
|
1109
|
-
},
|
|
1110
|
-
let o =
|
|
1078
|
+
}, Nt = (e, t) => {
|
|
1079
|
+
let o = J, r = J;
|
|
1111
1080
|
const n = Mt();
|
|
1112
1081
|
return e === "incremental" && (o = n), t === "incremental" && (r = n), typeof e == "number" && (o = X(e)), typeof t == "number" && (r = X(t)), typeof e == "function" && (o = e), typeof t == "function" && (r = t), {
|
|
1113
1082
|
nodesPriorityFn: o,
|
|
@@ -1119,14 +1088,14 @@ const Nt = (e, t) => ({
|
|
|
1119
1088
|
}), p = (e, t, o) => ({ x: t * Math.cos(e), y: o * Math.sin(e) }), w = {
|
|
1120
1089
|
x: 0,
|
|
1121
1090
|
y: 0
|
|
1122
|
-
},
|
|
1091
|
+
}, M = (e, t, o, r) => {
|
|
1123
1092
|
const h = [
|
|
1124
1093
|
w,
|
|
1125
1094
|
{ x: o, y: r },
|
|
1126
1095
|
{ x: o, y: -r }
|
|
1127
1096
|
].map((a) => f(a, e, w)).map((a) => ({ x: a.x + t.x, y: a.y + t.y })), s = `M ${h[0].x} ${h[0].y}`, c = `L ${h[1].x} ${h[1].y}`, d = `L ${h[2].x} ${h[2].y}`;
|
|
1128
1097
|
return `${s} ${c} ${d}`;
|
|
1129
|
-
},
|
|
1098
|
+
}, b = (e, t) => {
|
|
1130
1099
|
const o = [];
|
|
1131
1100
|
if (e.length > 0 && o.push(`M ${e[0].x} ${e[0].y}`), e.length === 2 && o.push(`L ${e[1].x} ${e[1].y}`), e.length > 2) {
|
|
1132
1101
|
const r = e.length - 1;
|
|
@@ -1135,26 +1104,26 @@ const Nt = (e, t) => ({
|
|
|
1135
1104
|
let a = 0, l = 0, g = 0;
|
|
1136
1105
|
const y = d > 0, x = d < r, v = y && x;
|
|
1137
1106
|
if (y && (a = -n, l = -h, g = s), x) {
|
|
1138
|
-
const
|
|
1139
|
-
n =
|
|
1107
|
+
const P = e[d + 1];
|
|
1108
|
+
n = P.x - c.x, h = P.y - c.y, s = Math.sqrt(n * n + h * h);
|
|
1140
1109
|
}
|
|
1141
|
-
const S = s !== 0 ? Math.min((v ? t : 0) / s, d < r - 1 ? 0.5 : 1) : 0, T = v ? { x: c.x + n * S, y: c.y + h * S } : c,
|
|
1142
|
-
d > 0 && o.push(`L ${
|
|
1110
|
+
const S = s !== 0 ? Math.min((v ? t : 0) / s, d < r - 1 ? 0.5 : 1) : 0, T = v ? { x: c.x + n * S, y: c.y + h * S } : c, L = g !== 0 ? Math.min((v ? t : 0) / g, d > 1 ? 0.5 : 1) : 0, D = v ? { x: c.x + a * L, y: c.y + l * L } : c;
|
|
1111
|
+
d > 0 && o.push(`L ${D.x} ${D.y}`), v && o.push(
|
|
1143
1112
|
`C ${c.x} ${c.y} ${c.x} ${c.y} ${T.x} ${T.y}`
|
|
1144
1113
|
);
|
|
1145
1114
|
});
|
|
1146
1115
|
}
|
|
1147
1116
|
return o.join(" ");
|
|
1148
|
-
},
|
|
1117
|
+
}, I = () => {
|
|
1149
1118
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1150
1119
|
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e;
|
|
1151
|
-
},
|
|
1120
|
+
}, F = () => {
|
|
1152
1121
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1153
1122
|
return e.style.transformOrigin = "50% 50%", e;
|
|
1154
1123
|
}, R = (e, t) => {
|
|
1155
1124
|
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1156
1125
|
return o.setAttribute("stroke", e), o.setAttribute("stroke-width", `${t}`), o.setAttribute("fill", "none"), o;
|
|
1157
|
-
},
|
|
1126
|
+
}, N = (e) => {
|
|
1158
1127
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1159
1128
|
return t.setAttribute("fill", e), t;
|
|
1160
1129
|
}, k = (e, t) => {
|
|
@@ -1173,7 +1142,7 @@ const Nt = (e, t) => ({
|
|
|
1173
1142
|
flipX: d,
|
|
1174
1143
|
flipY: a
|
|
1175
1144
|
};
|
|
1176
|
-
},
|
|
1145
|
+
}, Vt = (e) => {
|
|
1177
1146
|
const t = f(
|
|
1178
1147
|
{ x: e.arrowLength, y: w.y },
|
|
1179
1148
|
e.fromVect,
|
|
@@ -1233,7 +1202,7 @@ const Nt = (e, t) => ({
|
|
|
1233
1202
|
`C ${S.x} ${S.y} ${v.x} ${v.y} ${l.x} ${l.y}`,
|
|
1234
1203
|
`L ${o.x} ${o.y}`
|
|
1235
1204
|
].join(" ");
|
|
1236
|
-
},
|
|
1205
|
+
}, Dt = (e) => {
|
|
1237
1206
|
const t = e.hasSourceArrow ? f(
|
|
1238
1207
|
{ x: e.arrowLength, y: w.y },
|
|
1239
1208
|
e.fromVect,
|
|
@@ -1250,7 +1219,7 @@ const Nt = (e, t) => ({
|
|
|
1250
1219
|
x: e.flipX > 0 ? e.to.x - c : e.to.x + r,
|
|
1251
1220
|
y: s.y
|
|
1252
1221
|
}, y = { x: g.x, y: d };
|
|
1253
|
-
return
|
|
1222
|
+
return b(
|
|
1254
1223
|
[t, h, a, l, y, g, s, o],
|
|
1255
1224
|
e.roundness
|
|
1256
1225
|
);
|
|
@@ -1272,11 +1241,11 @@ const Nt = (e, t) => ({
|
|
|
1272
1241
|
e.toVect,
|
|
1273
1242
|
e.to
|
|
1274
1243
|
), g = { x: l.x + c, y: l.y + d };
|
|
1275
|
-
return
|
|
1244
|
+
return b(
|
|
1276
1245
|
[t, n, a, g, l, o],
|
|
1277
1246
|
e.roundness
|
|
1278
1247
|
);
|
|
1279
|
-
},
|
|
1248
|
+
}, Pt = (e) => {
|
|
1280
1249
|
const t = e.hasSourceArrow ? f(
|
|
1281
1250
|
{ x: e.arrowLength, y: w.y },
|
|
1282
1251
|
e.fromVect,
|
|
@@ -1290,7 +1259,7 @@ const Nt = (e, t) => ({
|
|
|
1290
1259
|
e.toVect,
|
|
1291
1260
|
e.to
|
|
1292
1261
|
);
|
|
1293
|
-
return
|
|
1262
|
+
return b([t, n, h, o], e.roundness);
|
|
1294
1263
|
}, bt = (e) => {
|
|
1295
1264
|
const t = e.hasSourceArrow ? f(
|
|
1296
1265
|
{ x: e.arrowLength, y: w.y },
|
|
@@ -1308,7 +1277,7 @@ const Nt = (e, t) => ({
|
|
|
1308
1277
|
x: s.x,
|
|
1309
1278
|
y: e.flipY > 0 ? e.to.y - c : e.to.y + r
|
|
1310
1279
|
}, y = { x: d, y: g.y };
|
|
1311
|
-
return
|
|
1280
|
+
return b(
|
|
1312
1281
|
[t, h, a, l, y, g, s, o],
|
|
1313
1282
|
e.roundness
|
|
1314
1283
|
);
|
|
@@ -1325,8 +1294,8 @@ const Nt = (e, t) => ({
|
|
|
1325
1294
|
].map(
|
|
1326
1295
|
(d) => f(d, e.fromVect, w)
|
|
1327
1296
|
), c = `M ${w.x} ${w.y} L ${s[0].x} ${s[0].y} `;
|
|
1328
|
-
return `${e.hasSourceArrow || e.hasTargetArrow ? "" : c}${
|
|
1329
|
-
},
|
|
1297
|
+
return `${e.hasSourceArrow || e.hasTargetArrow ? "" : c}${b(s, e.roundness)}`;
|
|
1298
|
+
}, mt = (e) => {
|
|
1330
1299
|
const t = e.smallRadius, o = e.radius, r = Math.sqrt(t * t + o * o), n = t + o, h = e.arrowLength + r * (1 - o / n), s = t * o / n, d = [
|
|
1331
1300
|
{ x: e.arrowLength, y: w.y },
|
|
1332
1301
|
{ x: h, y: s },
|
|
@@ -1355,10 +1324,10 @@ const Nt = (e, t) => ({
|
|
|
1355
1324
|
smallCycleRadius: 15,
|
|
1356
1325
|
curvature: 90
|
|
1357
1326
|
});
|
|
1358
|
-
class
|
|
1327
|
+
class Ct {
|
|
1359
1328
|
constructor(t) {
|
|
1360
|
-
i(this, "svg",
|
|
1361
|
-
i(this, "group",
|
|
1329
|
+
i(this, "svg", I());
|
|
1330
|
+
i(this, "group", F());
|
|
1362
1331
|
i(this, "line");
|
|
1363
1332
|
i(this, "sourceArrow", null);
|
|
1364
1333
|
i(this, "targetArrow", null);
|
|
@@ -1373,7 +1342,7 @@ class $t {
|
|
|
1373
1342
|
i(this, "hasTargetArrow");
|
|
1374
1343
|
this.arrowLength = (t == null ? void 0 : t.arrowLength) ?? u.arrowLength, this.arrowWidth = (t == null ? void 0 : t.arrowWidth) ?? u.arrowWidth, this.curvature = (t == null ? void 0 : t.curvature) ?? u.curvature, this.portCycleRadius = (t == null ? void 0 : t.cycleRadius) ?? u.cycleRadius, this.portCycleSmallRadius = (t == null ? void 0 : t.smallCycleRadius) ?? u.smallCycleRadius, this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? u.detourDirection, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? u.hasTargetArrow;
|
|
1375
1344
|
const o = (t == null ? void 0 : t.color) ?? u.color, r = (t == null ? void 0 : t.width) ?? u.width;
|
|
1376
|
-
this.svg.appendChild(this.group), this.line = R(o, r), this.group.appendChild(this.line), this.hasSourceArrow && (this.sourceArrow =
|
|
1345
|
+
this.svg.appendChild(this.group), this.line = R(o, r), this.group.appendChild(this.line), this.hasSourceArrow && (this.sourceArrow = N(o), this.group.appendChild(this.sourceArrow)), this.hasTargetArrow && (this.targetArrow = N(o), this.group.appendChild(this.targetArrow));
|
|
1377
1346
|
}
|
|
1378
1347
|
render(t) {
|
|
1379
1348
|
const { x: o, y: r, width: n, height: h, flipX: s, flipY: c } = k(
|
|
@@ -1390,7 +1359,7 @@ class $t {
|
|
|
1390
1359
|
y: h
|
|
1391
1360
|
};
|
|
1392
1361
|
let g, y = a, x = -this.arrowLength;
|
|
1393
|
-
if (t.from.portId === t.to.portId ? (g =
|
|
1362
|
+
if (t.from.portId === t.to.portId ? (g = mt({
|
|
1394
1363
|
fromVect: d,
|
|
1395
1364
|
radius: this.portCycleRadius,
|
|
1396
1365
|
smallRadius: this.portCycleSmallRadius,
|
|
@@ -1409,7 +1378,7 @@ class $t {
|
|
|
1409
1378
|
curvature: this.curvature,
|
|
1410
1379
|
hasSourceArrow: this.hasSourceArrow,
|
|
1411
1380
|
hasTargetArrow: this.hasTargetArrow
|
|
1412
|
-
}) : g =
|
|
1381
|
+
}) : g = Vt({
|
|
1413
1382
|
to: l,
|
|
1414
1383
|
fromVect: d,
|
|
1415
1384
|
toVect: a,
|
|
@@ -1418,7 +1387,7 @@ class $t {
|
|
|
1418
1387
|
hasSourceArrow: this.hasSourceArrow,
|
|
1419
1388
|
hasTargetArrow: this.hasTargetArrow
|
|
1420
1389
|
}), this.line.setAttribute("d", g), this.sourceArrow) {
|
|
1421
|
-
const v =
|
|
1390
|
+
const v = M(
|
|
1422
1391
|
d,
|
|
1423
1392
|
w,
|
|
1424
1393
|
this.arrowLength,
|
|
@@ -1427,7 +1396,7 @@ class $t {
|
|
|
1427
1396
|
this.sourceArrow.setAttribute("d", v);
|
|
1428
1397
|
}
|
|
1429
1398
|
if (this.targetArrow) {
|
|
1430
|
-
const v =
|
|
1399
|
+
const v = M(
|
|
1431
1400
|
y,
|
|
1432
1401
|
l,
|
|
1433
1402
|
x,
|
|
@@ -1437,10 +1406,10 @@ class $t {
|
|
|
1437
1406
|
}
|
|
1438
1407
|
}
|
|
1439
1408
|
}
|
|
1440
|
-
class
|
|
1409
|
+
class $t {
|
|
1441
1410
|
constructor(t) {
|
|
1442
|
-
i(this, "svg",
|
|
1443
|
-
i(this, "group",
|
|
1411
|
+
i(this, "svg", I());
|
|
1412
|
+
i(this, "group", F());
|
|
1444
1413
|
i(this, "line");
|
|
1445
1414
|
i(this, "sourceArrow", null);
|
|
1446
1415
|
i(this, "targetArrow", null);
|
|
@@ -1461,7 +1430,7 @@ class Wt {
|
|
|
1461
1430
|
this.cycleSquareSide / 2
|
|
1462
1431
|
), this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? u.detourDirection, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? u.hasTargetArrow;
|
|
1463
1432
|
const r = (t == null ? void 0 : t.color) ?? u.color, n = (t == null ? void 0 : t.width) ?? u.width;
|
|
1464
|
-
this.svg.appendChild(this.group), this.line = R(r, n), this.group.appendChild(this.line), this.hasSourceArrow && (this.sourceArrow =
|
|
1433
|
+
this.svg.appendChild(this.group), this.line = R(r, n), this.group.appendChild(this.line), this.hasSourceArrow && (this.sourceArrow = N(r), this.group.appendChild(this.sourceArrow)), this.hasTargetArrow && (this.targetArrow = N(r), this.group.appendChild(this.targetArrow));
|
|
1465
1434
|
}
|
|
1466
1435
|
render(t) {
|
|
1467
1436
|
const { x: o, y: r, width: n, height: h, flipX: s, flipY: c } = k(
|
|
@@ -1499,7 +1468,7 @@ class Wt {
|
|
|
1499
1468
|
detourDistance: this.detourDistance,
|
|
1500
1469
|
hasSourceArrow: this.hasSourceArrow,
|
|
1501
1470
|
hasTargetArrow: this.hasTargetArrow
|
|
1502
|
-
}) : g =
|
|
1471
|
+
}) : g = Dt({
|
|
1503
1472
|
to: l,
|
|
1504
1473
|
fromVect: d,
|
|
1505
1474
|
toVect: a,
|
|
@@ -1510,7 +1479,7 @@ class Wt {
|
|
|
1510
1479
|
hasSourceArrow: this.hasSourceArrow,
|
|
1511
1480
|
hasTargetArrow: this.hasTargetArrow
|
|
1512
1481
|
}), this.line.setAttribute("d", g), this.sourceArrow) {
|
|
1513
|
-
const v =
|
|
1482
|
+
const v = M(
|
|
1514
1483
|
d,
|
|
1515
1484
|
w,
|
|
1516
1485
|
this.arrowLength,
|
|
@@ -1519,7 +1488,7 @@ class Wt {
|
|
|
1519
1488
|
this.sourceArrow.setAttribute("d", v);
|
|
1520
1489
|
}
|
|
1521
1490
|
if (this.targetArrow) {
|
|
1522
|
-
const v =
|
|
1491
|
+
const v = M(
|
|
1523
1492
|
y,
|
|
1524
1493
|
l,
|
|
1525
1494
|
x,
|
|
@@ -1529,10 +1498,10 @@ class Wt {
|
|
|
1529
1498
|
}
|
|
1530
1499
|
}
|
|
1531
1500
|
}
|
|
1532
|
-
class
|
|
1501
|
+
class Wt {
|
|
1533
1502
|
constructor(t) {
|
|
1534
|
-
i(this, "svg",
|
|
1535
|
-
i(this, "group",
|
|
1503
|
+
i(this, "svg", I());
|
|
1504
|
+
i(this, "group", F());
|
|
1536
1505
|
i(this, "line");
|
|
1537
1506
|
i(this, "sourceArrow", null);
|
|
1538
1507
|
i(this, "targetArrow", null);
|
|
@@ -1553,7 +1522,7 @@ class Ft {
|
|
|
1553
1522
|
this.cycleSquareSide / 2
|
|
1554
1523
|
), this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? u.detourDirection, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? u.hasTargetArrow;
|
|
1555
1524
|
const r = (t == null ? void 0 : t.color) ?? u.color, n = (t == null ? void 0 : t.width) ?? u.width;
|
|
1556
|
-
this.svg.appendChild(this.group), this.line = R(r, n), this.group.appendChild(this.line), this.hasSourceArrow && (this.sourceArrow =
|
|
1525
|
+
this.svg.appendChild(this.group), this.line = R(r, n), this.group.appendChild(this.line), this.hasSourceArrow && (this.sourceArrow = N(r), this.group.appendChild(this.sourceArrow)), this.hasTargetArrow && (this.targetArrow = N(r), this.group.appendChild(this.targetArrow));
|
|
1557
1526
|
}
|
|
1558
1527
|
render(t) {
|
|
1559
1528
|
const { x: o, y: r, width: n, height: h, flipX: s, flipY: c } = k(
|
|
@@ -1591,7 +1560,7 @@ class Ft {
|
|
|
1591
1560
|
detourDistance: this.detourDistance,
|
|
1592
1561
|
hasSourceArrow: this.hasSourceArrow,
|
|
1593
1562
|
hasTargetArrow: this.hasTargetArrow
|
|
1594
|
-
}) : g =
|
|
1563
|
+
}) : g = Pt({
|
|
1595
1564
|
to: l,
|
|
1596
1565
|
fromVect: d,
|
|
1597
1566
|
toVect: a,
|
|
@@ -1601,7 +1570,7 @@ class Ft {
|
|
|
1601
1570
|
hasSourceArrow: this.hasSourceArrow,
|
|
1602
1571
|
hasTargetArrow: this.hasTargetArrow
|
|
1603
1572
|
}), this.line.setAttribute("d", g), this.sourceArrow) {
|
|
1604
|
-
const v =
|
|
1573
|
+
const v = M(
|
|
1605
1574
|
d,
|
|
1606
1575
|
w,
|
|
1607
1576
|
this.arrowLength,
|
|
@@ -1610,7 +1579,7 @@ class Ft {
|
|
|
1610
1579
|
this.sourceArrow.setAttribute("d", v);
|
|
1611
1580
|
}
|
|
1612
1581
|
if (this.targetArrow) {
|
|
1613
|
-
const v =
|
|
1582
|
+
const v = M(
|
|
1614
1583
|
y,
|
|
1615
1584
|
l,
|
|
1616
1585
|
x,
|
|
@@ -1622,8 +1591,8 @@ class Ft {
|
|
|
1622
1591
|
}
|
|
1623
1592
|
class It {
|
|
1624
1593
|
constructor(t) {
|
|
1625
|
-
i(this, "svg",
|
|
1626
|
-
i(this, "group",
|
|
1594
|
+
i(this, "svg", I());
|
|
1595
|
+
i(this, "group", F());
|
|
1627
1596
|
i(this, "line");
|
|
1628
1597
|
i(this, "sourceArrow", null);
|
|
1629
1598
|
i(this, "targetArrow", null);
|
|
@@ -1644,7 +1613,7 @@ class It {
|
|
|
1644
1613
|
this.cycleSquareSide / 2
|
|
1645
1614
|
), this.detourDirection = (t == null ? void 0 : t.detourDirection) ?? u.detourDirectionVertical, this.detourDistance = (t == null ? void 0 : t.detourDistance) ?? u.detourDistance, this.hasSourceArrow = (t == null ? void 0 : t.hasSourceArrow) ?? u.hasSourceArrow, this.hasTargetArrow = (t == null ? void 0 : t.hasTargetArrow) ?? u.hasTargetArrow;
|
|
1646
1615
|
const r = (t == null ? void 0 : t.color) ?? u.color, n = (t == null ? void 0 : t.width) ?? u.width;
|
|
1647
|
-
this.svg.appendChild(this.group), this.line = R(r, n), this.group.appendChild(this.line), this.hasSourceArrow && (this.sourceArrow =
|
|
1616
|
+
this.svg.appendChild(this.group), this.line = R(r, n), this.group.appendChild(this.line), this.hasSourceArrow && (this.sourceArrow = N(r), this.group.appendChild(this.sourceArrow)), this.hasTargetArrow && (this.targetArrow = N(r), this.group.appendChild(this.targetArrow));
|
|
1648
1617
|
}
|
|
1649
1618
|
render(t) {
|
|
1650
1619
|
const { x: o, y: r, width: n, height: h, flipX: s, flipY: c } = k(
|
|
@@ -1693,7 +1662,7 @@ class It {
|
|
|
1693
1662
|
hasSourceArrow: this.hasSourceArrow,
|
|
1694
1663
|
hasTargetArrow: this.hasTargetArrow
|
|
1695
1664
|
}), this.line.setAttribute("d", g), this.sourceArrow) {
|
|
1696
|
-
const v =
|
|
1665
|
+
const v = M(
|
|
1697
1666
|
d,
|
|
1698
1667
|
w,
|
|
1699
1668
|
this.arrowLength,
|
|
@@ -1702,7 +1671,7 @@ class It {
|
|
|
1702
1671
|
this.sourceArrow.setAttribute("d", v);
|
|
1703
1672
|
}
|
|
1704
1673
|
if (this.targetArrow) {
|
|
1705
|
-
const v =
|
|
1674
|
+
const v = M(
|
|
1706
1675
|
y,
|
|
1707
1676
|
l,
|
|
1708
1677
|
x,
|
|
@@ -1712,12 +1681,12 @@ class It {
|
|
|
1712
1681
|
}
|
|
1713
1682
|
}
|
|
1714
1683
|
}
|
|
1715
|
-
const
|
|
1684
|
+
const Ft = (e) => {
|
|
1716
1685
|
if (typeof e == "function")
|
|
1717
1686
|
return e;
|
|
1718
1687
|
switch (e == null ? void 0 : e.type) {
|
|
1719
1688
|
case "straight":
|
|
1720
|
-
return () => new
|
|
1689
|
+
return () => new Wt({
|
|
1721
1690
|
color: e.color,
|
|
1722
1691
|
width: e.width,
|
|
1723
1692
|
arrowLength: e.arrowLength,
|
|
@@ -1731,7 +1700,7 @@ const Rt = (e) => {
|
|
|
1731
1700
|
detourDirection: e.detourDirection
|
|
1732
1701
|
});
|
|
1733
1702
|
case "horizontal":
|
|
1734
|
-
return () => new
|
|
1703
|
+
return () => new $t({
|
|
1735
1704
|
color: e.color,
|
|
1736
1705
|
width: e.width,
|
|
1737
1706
|
arrowLength: e.arrowLength,
|
|
@@ -1759,7 +1728,7 @@ const Rt = (e) => {
|
|
|
1759
1728
|
detourDirection: e.detourDirection
|
|
1760
1729
|
});
|
|
1761
1730
|
default:
|
|
1762
|
-
return () => new
|
|
1731
|
+
return () => new Ct({
|
|
1763
1732
|
color: e.color,
|
|
1764
1733
|
width: e.width,
|
|
1765
1734
|
arrowLength: e.arrowLength,
|
|
@@ -1773,27 +1742,27 @@ const Rt = (e) => {
|
|
|
1773
1742
|
detourDirection: e.detourDirection
|
|
1774
1743
|
});
|
|
1775
1744
|
}
|
|
1776
|
-
},
|
|
1745
|
+
}, Rt = (e) => {
|
|
1777
1746
|
var o, r, n, h, s;
|
|
1778
|
-
const t =
|
|
1747
|
+
const t = Nt(
|
|
1779
1748
|
(o = e == null ? void 0 : e.nodes) == null ? void 0 : o.priority,
|
|
1780
1749
|
(r = e == null ? void 0 : e.edges) == null ? void 0 : r.priority
|
|
1781
1750
|
);
|
|
1782
1751
|
return {
|
|
1783
1752
|
nodes: {
|
|
1784
|
-
centerFn: ((n = e == null ? void 0 : e.nodes) == null ? void 0 : n.centerFn) ??
|
|
1753
|
+
centerFn: ((n = e == null ? void 0 : e.nodes) == null ? void 0 : n.centerFn) ?? pt,
|
|
1785
1754
|
priorityFn: t.nodesPriorityFn
|
|
1786
1755
|
},
|
|
1787
1756
|
ports: {
|
|
1788
1757
|
direction: ((h = e == null ? void 0 : e.ports) == null ? void 0 : h.direction) ?? 0
|
|
1789
1758
|
},
|
|
1790
1759
|
edges: {
|
|
1791
|
-
shapeFactory:
|
|
1760
|
+
shapeFactory: Ft(((s = e == null ? void 0 : e.edges) == null ? void 0 : s.shape) ?? {}),
|
|
1792
1761
|
priorityFn: t.edgesPriorityFn
|
|
1793
1762
|
}
|
|
1794
1763
|
};
|
|
1795
1764
|
};
|
|
1796
|
-
class
|
|
1765
|
+
class kt {
|
|
1797
1766
|
constructor(t, o) {
|
|
1798
1767
|
i(this, "nodeIdGenerator", new Y(
|
|
1799
1768
|
(t) => this.graph.getNode(t) !== null
|
|
@@ -1813,7 +1782,7 @@ class zt {
|
|
|
1813
1782
|
* provides api for accessing viewport state
|
|
1814
1783
|
*/
|
|
1815
1784
|
i(this, "viewport");
|
|
1816
|
-
this.controller = t, this.defaults =
|
|
1785
|
+
this.controller = t, this.defaults = Rt(o), this.graph = t.graph, this.viewport = t.viewport;
|
|
1817
1786
|
}
|
|
1818
1787
|
/**
|
|
1819
1788
|
* attaches canvas to given element
|
|
@@ -1835,21 +1804,22 @@ class zt {
|
|
|
1835
1804
|
const o = this.nodeIdGenerator.create(t.id);
|
|
1836
1805
|
if (this.graph.getNode(o) !== null)
|
|
1837
1806
|
throw new E("failed to add node with existing id");
|
|
1838
|
-
|
|
1807
|
+
if (this.controller.addNode({
|
|
1839
1808
|
id: o,
|
|
1840
1809
|
element: t.element,
|
|
1841
1810
|
x: t.x,
|
|
1842
1811
|
y: t.y,
|
|
1843
1812
|
centerFn: t.centerFn ?? this.defaults.nodes.centerFn,
|
|
1844
1813
|
priority: t.priority ?? this.defaults.nodes.priorityFn()
|
|
1845
|
-
}),
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1814
|
+
}), t.ports !== void 0)
|
|
1815
|
+
for (const r of t.ports)
|
|
1816
|
+
this.markPort({
|
|
1817
|
+
id: r.id,
|
|
1818
|
+
element: r.element,
|
|
1819
|
+
nodeId: o,
|
|
1820
|
+
direction: r.direction
|
|
1821
|
+
});
|
|
1822
|
+
return this;
|
|
1853
1823
|
}
|
|
1854
1824
|
/**
|
|
1855
1825
|
* updates node parameters
|
|
@@ -1964,25 +1934,25 @@ class zt {
|
|
|
1964
1934
|
this.controller.destroy();
|
|
1965
1935
|
}
|
|
1966
1936
|
}
|
|
1967
|
-
class
|
|
1937
|
+
class zt {
|
|
1968
1938
|
constructor() {
|
|
1969
1939
|
i(this, "nodes", /* @__PURE__ */ new Map());
|
|
1970
1940
|
i(this, "ports", /* @__PURE__ */ new Map());
|
|
1971
|
-
i(this, "nodePorts", /* @__PURE__ */ new Map());
|
|
1972
|
-
i(this, "portNodeId", /* @__PURE__ */ new Map());
|
|
1973
1941
|
i(this, "edges", /* @__PURE__ */ new Map());
|
|
1974
1942
|
i(this, "incommingEdges", /* @__PURE__ */ new Map());
|
|
1975
1943
|
i(this, "outcommingEdges", /* @__PURE__ */ new Map());
|
|
1976
1944
|
i(this, "cycleEdges", /* @__PURE__ */ new Map());
|
|
1977
1945
|
}
|
|
1978
1946
|
addNode(t) {
|
|
1979
|
-
|
|
1947
|
+
const o = /* @__PURE__ */ new Map(), r = {
|
|
1980
1948
|
element: t.element,
|
|
1981
1949
|
x: t.x,
|
|
1982
1950
|
y: t.y,
|
|
1983
1951
|
centerFn: t.centerFn,
|
|
1984
|
-
priority: t.priority
|
|
1985
|
-
|
|
1952
|
+
priority: t.priority,
|
|
1953
|
+
ports: o
|
|
1954
|
+
};
|
|
1955
|
+
this.nodes.set(t.id, r);
|
|
1986
1956
|
}
|
|
1987
1957
|
getAllNodeIds() {
|
|
1988
1958
|
return Array.from(this.nodes.keys());
|
|
@@ -1991,13 +1961,14 @@ class Yt {
|
|
|
1991
1961
|
return this.nodes.get(t);
|
|
1992
1962
|
}
|
|
1993
1963
|
removeNode(t) {
|
|
1994
|
-
this.nodes.delete(t)
|
|
1964
|
+
this.nodes.delete(t);
|
|
1995
1965
|
}
|
|
1996
1966
|
addPort(t) {
|
|
1997
1967
|
this.ports.set(t.id, {
|
|
1998
1968
|
element: t.element,
|
|
1999
|
-
direction: t.direction
|
|
2000
|
-
|
|
1969
|
+
direction: t.direction,
|
|
1970
|
+
nodeId: t.nodeId
|
|
1971
|
+
}), this.cycleEdges.set(t.id, /* @__PURE__ */ new Set()), this.incommingEdges.set(t.id, /* @__PURE__ */ new Set()), this.outcommingEdges.set(t.id, /* @__PURE__ */ new Set()), this.nodes.get(t.nodeId).ports.set(t.id, t.element);
|
|
2001
1972
|
}
|
|
2002
1973
|
getPort(t) {
|
|
2003
1974
|
return this.ports.get(t);
|
|
@@ -2006,16 +1977,13 @@ class Yt {
|
|
|
2006
1977
|
return Array.from(this.ports.keys());
|
|
2007
1978
|
}
|
|
2008
1979
|
getNodePortIds(t) {
|
|
2009
|
-
const o = this.
|
|
1980
|
+
const o = this.nodes.get(t);
|
|
2010
1981
|
if (o !== void 0)
|
|
2011
|
-
return Array.from(o.keys());
|
|
2012
|
-
}
|
|
2013
|
-
getPortNodeId(t) {
|
|
2014
|
-
return this.portNodeId.get(t);
|
|
1982
|
+
return Array.from(o.ports.keys());
|
|
2015
1983
|
}
|
|
2016
1984
|
removePort(t) {
|
|
2017
|
-
const o = this.
|
|
2018
|
-
this.
|
|
1985
|
+
const o = this.ports.get(t).nodeId;
|
|
1986
|
+
this.nodes.get(o).ports.delete(t), this.ports.delete(t);
|
|
2019
1987
|
}
|
|
2020
1988
|
addEdge(t) {
|
|
2021
1989
|
this.edges.set(t.id, {
|
|
@@ -2056,7 +2024,7 @@ class Yt {
|
|
|
2056
2024
|
this.cycleEdges.get(r).delete(t), this.cycleEdges.get(n).delete(t), this.incommingEdges.get(r).delete(t), this.incommingEdges.get(n).delete(t), this.outcommingEdges.get(r).delete(t), this.outcommingEdges.get(n).delete(t), this.edges.delete(t);
|
|
2057
2025
|
}
|
|
2058
2026
|
clear() {
|
|
2059
|
-
this.
|
|
2027
|
+
this.incommingEdges.clear(), this.outcommingEdges.clear(), this.cycleEdges.clear(), this.edges.clear(), this.ports.clear(), this.nodes.clear();
|
|
2060
2028
|
}
|
|
2061
2029
|
getPortIncomingEdgeIds(t) {
|
|
2062
2030
|
return Array.from(this.incommingEdges.get(t));
|
|
@@ -2075,21 +2043,21 @@ class Yt {
|
|
|
2075
2043
|
];
|
|
2076
2044
|
}
|
|
2077
2045
|
getNodeIncomingEdgeIds(t) {
|
|
2078
|
-
const o = Array.from(this.
|
|
2046
|
+
const o = Array.from(this.nodes.get(t).ports.keys());
|
|
2079
2047
|
let r = [];
|
|
2080
2048
|
return o.forEach((n) => {
|
|
2081
2049
|
r = [...r, ...this.getPortIncomingEdgeIds(n)];
|
|
2082
2050
|
}), r;
|
|
2083
2051
|
}
|
|
2084
2052
|
getNodeOutcomingEdgeIds(t) {
|
|
2085
|
-
const o = Array.from(this.
|
|
2053
|
+
const o = Array.from(this.nodes.get(t).ports.keys());
|
|
2086
2054
|
let r = [];
|
|
2087
2055
|
return o.forEach((n) => {
|
|
2088
2056
|
r = [...r, ...this.getPortOutcomingEdgeIds(n)];
|
|
2089
2057
|
}), r;
|
|
2090
2058
|
}
|
|
2091
2059
|
getNodeCycleEdgeIds(t) {
|
|
2092
|
-
const o = Array.from(this.
|
|
2060
|
+
const o = Array.from(this.nodes.get(t).ports.keys());
|
|
2093
2061
|
let r = [];
|
|
2094
2062
|
return o.forEach((n) => {
|
|
2095
2063
|
r = [...r, ...this.getPortCycleEdgeIds(n)];
|
|
@@ -2103,6 +2071,44 @@ class Yt {
|
|
|
2103
2071
|
];
|
|
2104
2072
|
}
|
|
2105
2073
|
}
|
|
2074
|
+
const Q = (e) => ({
|
|
2075
|
+
scale: 1 / e.scale,
|
|
2076
|
+
x: -e.x / e.scale,
|
|
2077
|
+
y: -e.y / e.scale
|
|
2078
|
+
}), Z = {
|
|
2079
|
+
scale: 1,
|
|
2080
|
+
x: 0,
|
|
2081
|
+
y: 0
|
|
2082
|
+
};
|
|
2083
|
+
class Yt {
|
|
2084
|
+
constructor() {
|
|
2085
|
+
i(this, "viewportMatrix", Z);
|
|
2086
|
+
i(this, "contentMatrix", Z);
|
|
2087
|
+
i(this, "emitter");
|
|
2088
|
+
i(this, "onAfterUpdate");
|
|
2089
|
+
[this.emitter, this.onAfterUpdate] = Tt();
|
|
2090
|
+
}
|
|
2091
|
+
getViewportMatrix() {
|
|
2092
|
+
return this.viewportMatrix;
|
|
2093
|
+
}
|
|
2094
|
+
getContentMatrix() {
|
|
2095
|
+
return this.contentMatrix;
|
|
2096
|
+
}
|
|
2097
|
+
patchViewportMatrix(t) {
|
|
2098
|
+
this.viewportMatrix = {
|
|
2099
|
+
scale: t.scale ?? this.viewportMatrix.scale,
|
|
2100
|
+
x: t.x ?? this.viewportMatrix.x,
|
|
2101
|
+
y: t.y ?? this.viewportMatrix.y
|
|
2102
|
+
}, this.contentMatrix = Q(this.viewportMatrix), this.emitter.emit();
|
|
2103
|
+
}
|
|
2104
|
+
patchContentMatrix(t) {
|
|
2105
|
+
this.contentMatrix = {
|
|
2106
|
+
scale: t.scale ?? this.contentMatrix.scale,
|
|
2107
|
+
x: t.x ?? this.contentMatrix.x,
|
|
2108
|
+
y: t.y ?? this.contentMatrix.y
|
|
2109
|
+
}, this.viewportMatrix = Q(this.contentMatrix), this.emitter.emit();
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2106
2112
|
class Bt {
|
|
2107
2113
|
constructor() {
|
|
2108
2114
|
i(this, "canvasDefaults", {});
|
|
@@ -2159,28 +2165,28 @@ class Bt {
|
|
|
2159
2165
|
*/
|
|
2160
2166
|
build() {
|
|
2161
2167
|
let t = this.boxRenderingTrigger;
|
|
2162
|
-
this.virtualScrollOptions !== void 0 && t === void 0 && (t = new
|
|
2163
|
-
const o = new
|
|
2164
|
-
let n = new
|
|
2165
|
-
t !== void 0 && (n = new
|
|
2166
|
-
let h = new
|
|
2168
|
+
this.virtualScrollOptions !== void 0 && t === void 0 && (t = new q());
|
|
2169
|
+
const o = new zt(), r = new Yt();
|
|
2170
|
+
let n = new Et(o, r);
|
|
2171
|
+
t !== void 0 && (n = new At(n, o, t));
|
|
2172
|
+
let h = new it(
|
|
2167
2173
|
o,
|
|
2168
2174
|
r,
|
|
2169
2175
|
n
|
|
2170
2176
|
);
|
|
2171
|
-
this.hasResizeReactiveNodes && (h = new
|
|
2177
|
+
this.hasResizeReactiveNodes && (h = new wt(h)), this.hasDraggableNode && (h = new nt(
|
|
2172
2178
|
h,
|
|
2173
2179
|
this.dragOptions
|
|
2174
|
-
)), this.virtualScrollOptions !== void 0 ? h = new
|
|
2180
|
+
)), this.virtualScrollOptions !== void 0 ? h = new yt(
|
|
2175
2181
|
h,
|
|
2176
2182
|
t,
|
|
2177
2183
|
this.transformOptions,
|
|
2178
2184
|
this.virtualScrollOptions
|
|
2179
|
-
) : this.hasTransformableViewport && (h = new
|
|
2185
|
+
) : this.hasTransformableViewport && (h = new O(
|
|
2180
2186
|
h,
|
|
2181
2187
|
this.transformOptions
|
|
2182
2188
|
));
|
|
2183
|
-
const s = new
|
|
2189
|
+
const s = new kt(h, this.canvasDefaults);
|
|
2184
2190
|
return this.reset(), s;
|
|
2185
2191
|
}
|
|
2186
2192
|
reset() {
|
|
@@ -2188,11 +2194,11 @@ class Bt {
|
|
|
2188
2194
|
}
|
|
2189
2195
|
}
|
|
2190
2196
|
export {
|
|
2191
|
-
|
|
2197
|
+
Ct as BezierEdgeShape,
|
|
2192
2198
|
Bt as CanvasBuilder,
|
|
2193
|
-
|
|
2194
|
-
|
|
2199
|
+
q as EventSubject,
|
|
2200
|
+
$t as HorizontalEdgeShape,
|
|
2195
2201
|
E as HtmlGraphError,
|
|
2196
|
-
|
|
2202
|
+
Wt as StraightEdgeShape,
|
|
2197
2203
|
It as VerticalEdgeShape
|
|
2198
2204
|
};
|