@html-graph/html-graph 9.0.0 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/html-graph.d.ts +49 -18
- package/dist/html-graph.js +251 -93
- package/dist/html-graph.min.js +330 -237
- package/dist/html-graph.min.umd.cjs +1 -1
- package/dist/html-graph.umd.cjs +251 -93
- package/package.json +1 -1
package/dist/html-graph.min.js
CHANGED
|
@@ -522,7 +522,7 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
522
522
|
if (t.from !== void 0 || t.to !== void 0) {
|
|
523
523
|
if (t.from !== void 0 && !this.hasPort(t.from)) throw new p(m.updateNonexistentEdgeSource(e, t.from));
|
|
524
524
|
if (t.to !== void 0 && !this.hasPort(t.to)) throw new p(m.updateNonexistentEdgeTarget(e, t.to));
|
|
525
|
-
let n = this.getEdge(e), r = n
|
|
525
|
+
let n = this.getEdge(e), { payload: r } = n;
|
|
526
526
|
this.removeEdgeInternal(e), this.addEdgeInternal({
|
|
527
527
|
id: e,
|
|
528
528
|
from: t.from ?? n.from,
|
|
@@ -531,7 +531,7 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
531
531
|
priority: r.priority
|
|
532
532
|
});
|
|
533
533
|
}
|
|
534
|
-
let n = this.
|
|
534
|
+
let n = this.getEdge(e);
|
|
535
535
|
t.shape !== void 0 && (n.payload.shape = t.shape, this.afterEdgeShapeUpdatedEmitter.emit(e)), t.priority !== void 0 && (n.payload.priority = t.priority, this.afterEdgePriorityUpdatedEmitter.emit(e)), this.afterEdgeUpdatedEmitter.emit(e);
|
|
536
536
|
}
|
|
537
537
|
getAllEdgeIds() {
|
|
@@ -750,16 +750,16 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
750
750
|
direction: e.portDirection
|
|
751
751
|
}]
|
|
752
752
|
};
|
|
753
|
-
}, ee = (e, t) => {
|
|
754
|
-
let
|
|
755
|
-
for (;
|
|
756
|
-
let t = e.findPortIdsByElement(
|
|
753
|
+
}, ee = (e, t, n) => {
|
|
754
|
+
let r = t;
|
|
755
|
+
for (; r !== null;) {
|
|
756
|
+
let t = n(e.findPortIdsByElement(r));
|
|
757
757
|
if (t !== null) return {
|
|
758
758
|
status: "portFound",
|
|
759
759
|
portId: t
|
|
760
760
|
};
|
|
761
|
-
if (e.findNodeIdByElement(
|
|
762
|
-
|
|
761
|
+
if (e.findNodeIdByElement(r) !== void 0) return { status: "nodeEncountered" };
|
|
762
|
+
r = r.parentElement;
|
|
763
763
|
}
|
|
764
764
|
return { status: "notFound" };
|
|
765
765
|
};
|
|
@@ -777,12 +777,12 @@ function* te(e, t) {
|
|
|
777
777
|
}
|
|
778
778
|
//#endregion
|
|
779
779
|
//#region src/configurators/shared/find-port-at-point/find-port-at-point.ts
|
|
780
|
-
var ne = (e, t) => {
|
|
781
|
-
let
|
|
782
|
-
for (let t of
|
|
783
|
-
let
|
|
784
|
-
if (
|
|
785
|
-
if (
|
|
780
|
+
var ne = (e, t, n) => {
|
|
781
|
+
let r = te(document, t);
|
|
782
|
+
for (let t of r) {
|
|
783
|
+
let r = ee(e, t, n);
|
|
784
|
+
if (r.status === "portFound") return r.portId;
|
|
785
|
+
if (r.status === "nodeEncountered") return null;
|
|
786
786
|
}
|
|
787
787
|
return null;
|
|
788
788
|
}, E = /* @__PURE__ */ function(e) {
|
|
@@ -2321,8 +2321,8 @@ var ne = (e, t) => {
|
|
|
2321
2321
|
onPortMouseDown = (e) => {
|
|
2322
2322
|
let t = e;
|
|
2323
2323
|
if (!this.params.mouseDownEventVerifier(t)) return;
|
|
2324
|
-
let n = e.currentTarget, r = this.canvas.graph.findPortIdsByElement(n)
|
|
2325
|
-
this.params.onPointerDownVerifier(
|
|
2324
|
+
let n = e.currentTarget, r = this.canvas.graph.findPortIdsByElement(n), i = this.params.grabbedPortIdResolver(r);
|
|
2325
|
+
i !== null && this.params.onPointerDownVerifier(i, {
|
|
2326
2326
|
x: t.clientX,
|
|
2327
2327
|
y: t.clientY
|
|
2328
2328
|
}) && (this.eventTagger.tag(e, V), this.window.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.window.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 }));
|
|
@@ -2519,7 +2519,7 @@ var ne = (e, t) => {
|
|
|
2519
2519
|
resolve() {
|
|
2520
2520
|
return this.direction;
|
|
2521
2521
|
}
|
|
2522
|
-
}, tt = class e {
|
|
2522
|
+
}, K = (e) => e.length > 0 ? e[0] : null, tt = class e {
|
|
2523
2523
|
canvas;
|
|
2524
2524
|
element;
|
|
2525
2525
|
window;
|
|
@@ -2678,7 +2678,7 @@ var ne = (e, t) => {
|
|
|
2678
2678
|
let e = this.grabbedNodeState.nodeId;
|
|
2679
2679
|
this.graph.hasNode(e) && this.params.onNodeDragFinished(e), this.grabbedNodeState = null;
|
|
2680
2680
|
}
|
|
2681
|
-
},
|
|
2681
|
+
}, q = (e) => {
|
|
2682
2682
|
let t = [], n = e.touches.length;
|
|
2683
2683
|
for (let r = 0; r < n; r++) t.push([e.touches[r].clientX, e.touches[r].clientY]);
|
|
2684
2684
|
let r = t.reduce((e, t) => [e[0] + t[0], e[1] + t[1]], [0, 0]), i = [r[0] / n, r[1] / n], a = t.map((e) => [e[0] - i[0], e[1] - i[1]]).reduce((e, t) => e + Math.sqrt(t[0] * t[0] + t[1] * t[1]), 0);
|
|
@@ -2728,14 +2728,14 @@ var ne = (e, t) => {
|
|
|
2728
2728
|
onTouchStart = (e) => {
|
|
2729
2729
|
if (!this.eventTagger.has(e, V)) {
|
|
2730
2730
|
if (this.prevTouches !== null) {
|
|
2731
|
-
this.prevTouches =
|
|
2731
|
+
this.prevTouches = q(e);
|
|
2732
2732
|
return;
|
|
2733
2733
|
}
|
|
2734
|
-
this.prevTouches =
|
|
2734
|
+
this.prevTouches = q(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, { passive: !0 }), this.window.addEventListener("touchend", this.onWindowTouchFinish, { passive: !0 }), this.window.addEventListener("touchcancel", this.onWindowTouchFinish, { passive: !0 }), this.startRegisteredTransform();
|
|
2735
2735
|
}
|
|
2736
2736
|
};
|
|
2737
2737
|
onWindowTouchMove = (e) => {
|
|
2738
|
-
let t =
|
|
2738
|
+
let t = q(e);
|
|
2739
2739
|
if (!t.touches.every((e) => this.pointInsideVerifier.verify(e[0], e[1]))) {
|
|
2740
2740
|
this.stopTouchDrag();
|
|
2741
2741
|
return;
|
|
@@ -2751,7 +2751,7 @@ var ne = (e, t) => {
|
|
|
2751
2751
|
this.prevTouches = t;
|
|
2752
2752
|
};
|
|
2753
2753
|
onWindowTouchFinish = (e) => {
|
|
2754
|
-
e.touches.length > 0 ? this.prevTouches =
|
|
2754
|
+
e.touches.length > 0 ? this.prevTouches = q(e) : this.stopTouchDrag();
|
|
2755
2755
|
};
|
|
2756
2756
|
preventWheelScaleListener = (e) => {
|
|
2757
2757
|
e.preventDefault();
|
|
@@ -2976,7 +2976,8 @@ var ne = (e, t) => {
|
|
|
2976
2976
|
onPointerOutside: () => {
|
|
2977
2977
|
let e = this.edgeInProgress;
|
|
2978
2978
|
this.resetDragState(), this.params.onEdgeCreationInterrupted(e);
|
|
2979
|
-
}
|
|
2979
|
+
},
|
|
2980
|
+
grabbedPortIdResolver: this.params.grabbedPortIdResolver
|
|
2980
2981
|
};
|
|
2981
2982
|
Ze.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, s);
|
|
2982
2983
|
}
|
|
@@ -3017,16 +3018,19 @@ var ne = (e, t) => {
|
|
|
3017
3018
|
this.edgeInProgress = null, this.overlayCanvas.clear();
|
|
3018
3019
|
}
|
|
3019
3020
|
tryCreateConnection(e) {
|
|
3020
|
-
let t = ne(this.canvas.graph, e);
|
|
3021
|
+
let t = ne(this.canvas.graph, e, this.params.releasedPortIdResolver);
|
|
3021
3022
|
if (t === null) {
|
|
3022
3023
|
this.params.onEdgeCreationInterrupted(this.edgeInProgress);
|
|
3023
3024
|
return;
|
|
3024
3025
|
}
|
|
3025
|
-
let n = G(this.edgeInProgress, t)
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3026
|
+
let n = G(this.edgeInProgress, t);
|
|
3027
|
+
if (this.params.connectionAllowedVerifier(n)) {
|
|
3028
|
+
let e = this.params.connectionPreprocessor({
|
|
3029
|
+
from: n.from,
|
|
3030
|
+
to: n.to
|
|
3031
|
+
});
|
|
3032
|
+
this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(e), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated);
|
|
3033
|
+
} else this.params.onEdgeCreationPrevented(n);
|
|
3030
3034
|
}
|
|
3031
3035
|
moveDraggingPort(e) {
|
|
3032
3036
|
let t = this.overlayLayer.getBoundingClientRect(), n = this.canvas.viewport.createContentCoords({
|
|
@@ -3076,7 +3080,8 @@ var ne = (e, t) => {
|
|
|
3076
3080
|
shape: e.shape,
|
|
3077
3081
|
priority: e.priority
|
|
3078
3082
|
});
|
|
3079
|
-
}
|
|
3083
|
+
},
|
|
3084
|
+
grabbedPortIdResolver: this.params.grabbedPortIdResolver
|
|
3080
3085
|
};
|
|
3081
3086
|
Ze.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, s);
|
|
3082
3087
|
}
|
|
@@ -3146,7 +3151,7 @@ var ne = (e, t) => {
|
|
|
3146
3151
|
}).updatePort(E.DraggingNodeId, { direction: i });
|
|
3147
3152
|
}
|
|
3148
3153
|
tryCreateConnection(e) {
|
|
3149
|
-
let t = ne(this.canvas.graph, e);
|
|
3154
|
+
let t = ne(this.canvas.graph, e, this.params.releasedPortIdResolver);
|
|
3150
3155
|
if (this.overlayCanvas.removeEdge(E.EdgeId), t === null) {
|
|
3151
3156
|
let e = this.draggingEdgePayload;
|
|
3152
3157
|
this.params.onEdgeReattachInterrupted({
|
|
@@ -3281,17 +3286,16 @@ var ne = (e, t) => {
|
|
|
3281
3286
|
}), this.params.onAfterApplied();
|
|
3282
3287
|
}
|
|
3283
3288
|
}, gt = class e {
|
|
3284
|
-
win;
|
|
3285
3289
|
applier;
|
|
3286
3290
|
step = (e) => {
|
|
3287
3291
|
this.applier.apply(e);
|
|
3288
3292
|
};
|
|
3289
3293
|
constructor(e, t, n) {
|
|
3290
|
-
this.
|
|
3294
|
+
this.applier = new ht(e, t.algorithm, {
|
|
3291
3295
|
staticNodeResolver: t.staticNodeResolver,
|
|
3292
3296
|
onBeforeApplied: t.onBeforeApplied,
|
|
3293
3297
|
onAfterApplied: t.onAfterApplied
|
|
3294
|
-
}), new mt(
|
|
3298
|
+
}), new mt(n, this.step);
|
|
3295
3299
|
}
|
|
3296
3300
|
static configure(t, n, r) {
|
|
3297
3301
|
new e(t, n, r);
|
|
@@ -3395,26 +3399,104 @@ var ne = (e, t) => {
|
|
|
3395
3399
|
}, bt = () => {
|
|
3396
3400
|
let e = document.createElement("div");
|
|
3397
3401
|
return e.style.width = "100%", e.style.height = "100%", e.style.position = "relative", e;
|
|
3398
|
-
}, q = () => {
|
|
3399
|
-
let e = document.createElement("div");
|
|
3400
|
-
return e.style.position = "absolute", e.style.inset = "0", e;
|
|
3401
3402
|
}, xt = () => {
|
|
3402
|
-
let e =
|
|
3403
|
-
return e.style.
|
|
3404
|
-
}, St = class {
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3403
|
+
let e = document.createElement("div");
|
|
3404
|
+
return e.style.position = "absolute", e;
|
|
3405
|
+
}, St = class e {
|
|
3406
|
+
canvas;
|
|
3407
|
+
mainElement;
|
|
3408
|
+
overlayLayer;
|
|
3409
|
+
pointInsideVerifier;
|
|
3410
|
+
eventTagger;
|
|
3411
|
+
win;
|
|
3412
|
+
params;
|
|
3410
3413
|
host = bt();
|
|
3414
|
+
selectionRectangleWrapper = xt();
|
|
3415
|
+
initialContentPoint = null;
|
|
3416
|
+
draggingViewportPoint = null;
|
|
3417
|
+
eventHandledTag = V;
|
|
3418
|
+
onAfterViewportUpdated = () => {
|
|
3419
|
+
this.updateSelectionRectangle();
|
|
3420
|
+
};
|
|
3421
|
+
onCanvasMouseDown = (e) => {
|
|
3422
|
+
let t = e;
|
|
3423
|
+
if (!this.params.mouseDownEventVerifier(t) || this.eventTagger.has(e, this.eventHandledTag)) return;
|
|
3424
|
+
this.params.onSelectionStarted();
|
|
3425
|
+
let n = this.mainElement.getBoundingClientRect(), r = {
|
|
3426
|
+
x: t.clientX - n.x,
|
|
3427
|
+
y: t.clientY - n.y
|
|
3428
|
+
};
|
|
3429
|
+
this.initialContentPoint = this.canvas.viewport.createContentCoords(r), this.draggingViewportPoint = r, this.updateSelectionRectangle(), this.host.appendChild(this.selectionRectangleWrapper), this.win.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.win.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 });
|
|
3430
|
+
};
|
|
3431
|
+
onWindowMouseMove = (e) => {
|
|
3432
|
+
let t = e;
|
|
3433
|
+
if (!this.pointInsideVerifier.verify(t.clientX, t.clientY)) {
|
|
3434
|
+
this.removeMouseListeners(), this.interruptSelection();
|
|
3435
|
+
return;
|
|
3436
|
+
}
|
|
3437
|
+
let n = this.mainElement.getBoundingClientRect(), r = {
|
|
3438
|
+
x: t.clientX - n.x,
|
|
3439
|
+
y: t.clientY - n.y
|
|
3440
|
+
};
|
|
3441
|
+
this.draggingViewportPoint = r, this.updateSelectionRectangle();
|
|
3442
|
+
let i = this.selectionRectangleWrapper.getBoundingClientRect();
|
|
3443
|
+
this.params.onSelectionChange(i);
|
|
3444
|
+
};
|
|
3445
|
+
onWindowMouseUp = (e) => {
|
|
3446
|
+
let t = e;
|
|
3447
|
+
this.params.mouseUpEventVerifier(t) && (this.removeMouseListeners(), this.finishSelection());
|
|
3448
|
+
};
|
|
3449
|
+
constructor(e, t, n, r, i, a, o) {
|
|
3450
|
+
this.canvas = e, this.mainElement = t, this.overlayLayer = n, this.pointInsideVerifier = r, this.eventTagger = i, this.win = a, this.params = o, this.overlayLayer.appendChild(this.host), this.selectionRectangleWrapper.appendChild(this.params.rectangleElement), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated), this.mainElement.addEventListener("mousedown", this.onCanvasMouseDown, { passive: !0 }), this.canvas.onBeforeDestroy.subscribe(() => {
|
|
3451
|
+
this.mainElement.removeEventListener("mousedown", this.onCanvasMouseDown), this.removeMouseListeners();
|
|
3452
|
+
});
|
|
3453
|
+
}
|
|
3454
|
+
static configure(t, n, r, i, a, o, s) {
|
|
3455
|
+
new e(t, n, r, i, a, o, s);
|
|
3456
|
+
}
|
|
3457
|
+
updateSelectionRectangle() {
|
|
3458
|
+
if (this.initialContentPoint === null || this.draggingViewportPoint === null) return;
|
|
3459
|
+
let e = this.canvas.viewport.createViewportCoords(this.initialContentPoint), t = this.draggingViewportPoint, n = Math.min(e.x, t.x), r = Math.min(e.y, t.y), i = Math.abs(t.x - e.x), a = Math.abs(t.y - e.y), { style: o } = this.selectionRectangleWrapper;
|
|
3460
|
+
o.left = `${n}px`, o.top = `${r}px`, o.width = `${i}px`, o.height = `${a}px`;
|
|
3461
|
+
}
|
|
3462
|
+
removeMouseListeners() {
|
|
3463
|
+
this.win.removeEventListener("mousemove", this.onWindowMouseMove), this.win.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
3464
|
+
}
|
|
3465
|
+
finishSelection() {
|
|
3466
|
+
let e = this.selectionRectangleWrapper.getBoundingClientRect();
|
|
3467
|
+
this.terminateSelection(), this.params.onSelectionFinished(e);
|
|
3468
|
+
}
|
|
3469
|
+
interruptSelection() {
|
|
3470
|
+
let e = this.selectionRectangleWrapper.getBoundingClientRect();
|
|
3471
|
+
this.terminateSelection(), this.params.onSelectionInterrupted(e);
|
|
3472
|
+
}
|
|
3473
|
+
terminateSelection() {
|
|
3474
|
+
this.host.removeChild(this.selectionRectangleWrapper), this.initialContentPoint = null, this.draggingViewportPoint = null;
|
|
3475
|
+
}
|
|
3476
|
+
}, Ct = () => {
|
|
3477
|
+
let e = document.createElement("div");
|
|
3478
|
+
return e.style.width = "100%", e.style.height = "100%", e.style.position = "relative", e;
|
|
3479
|
+
}, J = (e) => {
|
|
3480
|
+
let t = document.createElement("div");
|
|
3481
|
+
return t.style.position = "absolute", t.style.inset = "0", t.style.zIndex = `${e}`, t;
|
|
3482
|
+
}, wt = (e) => {
|
|
3483
|
+
let t = J(e);
|
|
3484
|
+
return t.style.pointerEvents = "none", t;
|
|
3485
|
+
}, Tt = class {
|
|
3486
|
+
element;
|
|
3487
|
+
background = J(0);
|
|
3488
|
+
main = J(1);
|
|
3489
|
+
overlayConnectablePorts = wt(1);
|
|
3490
|
+
overlayDraggableEdges = wt(1);
|
|
3491
|
+
overlayRectangularSelection = wt(2);
|
|
3492
|
+
host = Ct();
|
|
3411
3493
|
constructor(e) {
|
|
3412
|
-
this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges);
|
|
3494
|
+
this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges), this.host.appendChild(this.overlayRectangularSelection);
|
|
3413
3495
|
}
|
|
3414
3496
|
destroy() {
|
|
3415
|
-
this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlayConnectablePorts), this.host.removeChild(this.overlayDraggableEdges), this.element.removeChild(this.host);
|
|
3497
|
+
this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlayConnectablePorts), this.host.removeChild(this.overlayDraggableEdges), this.host.removeChild(this.overlayRectangularSelection), this.element.removeChild(this.host);
|
|
3416
3498
|
}
|
|
3417
|
-
},
|
|
3499
|
+
}, Y = Object.freeze({
|
|
3418
3500
|
seed: "HTMLGraph is awesome",
|
|
3419
3501
|
maxTimeDeltaSec: .01,
|
|
3420
3502
|
nodeCharge: 1e5,
|
|
@@ -3423,16 +3505,12 @@ var ne = (e, t) => {
|
|
|
3423
3505
|
edgeStiffness: 1e3,
|
|
3424
3506
|
dtSec: .01,
|
|
3425
3507
|
maxIterations: 1e3,
|
|
3426
|
-
|
|
3508
|
+
stopVelocity: 10,
|
|
3427
3509
|
maxForce: 1e7,
|
|
3428
3510
|
nodeForceCoefficient: 1,
|
|
3429
3511
|
barnesHutAreaRadiusThreshold: .01,
|
|
3430
3512
|
barnesHutTheta: 1
|
|
3431
|
-
}),
|
|
3432
|
-
mouseDownEventVerifier: (e) => e.button === 0,
|
|
3433
|
-
mouseUpEventVerifier: (e) => e.button === 0,
|
|
3434
|
-
movementThreshold: 10
|
|
3435
|
-
}), X = () => {}, Ct = (e, t, n) => e === "nearest-connectable-port" ? new $e(t, n) : typeof e == "number" ? new et(e) : new et(void 0), wt = (e) => {
|
|
3513
|
+
}), X = () => {}, Et = (e, t, n) => e === "nearest-connectable-port" ? new $e(t, n) : typeof e == "number" ? new et(e) : new et(void 0), Dt = (e) => {
|
|
3436
3514
|
if (typeof e == "function") return e;
|
|
3437
3515
|
switch (e.type) {
|
|
3438
3516
|
case "straight": return () => new Ae({
|
|
@@ -3484,21 +3562,21 @@ var ne = (e, t) => {
|
|
|
3484
3562
|
detourDirection: e.detourDirection
|
|
3485
3563
|
});
|
|
3486
3564
|
}
|
|
3487
|
-
},
|
|
3488
|
-
let t = e.
|
|
3565
|
+
}, Ot = (e) => e.button === 0 && e.ctrlKey, Z = (e) => e.button === 0, Q = (e) => e.button === 0 && !e.ctrlKey, kt = (e) => {
|
|
3566
|
+
let t = e.moveOnTop !== !1;
|
|
3489
3567
|
return {
|
|
3490
|
-
moveOnTop:
|
|
3491
|
-
moveEdgesOnTop:
|
|
3492
|
-
dragCursor:
|
|
3568
|
+
moveOnTop: t,
|
|
3569
|
+
moveEdgesOnTop: e.moveEdgesOnTop !== !1 && t,
|
|
3570
|
+
dragCursor: e.mouse?.dragCursor ?? "grab",
|
|
3493
3571
|
gridSize: e.gridSize ?? null,
|
|
3494
|
-
mouseDownEventVerifier:
|
|
3495
|
-
mouseUpEventVerifier:
|
|
3572
|
+
mouseDownEventVerifier: e.mouse?.mouseDownEventVerifier ?? Q,
|
|
3573
|
+
mouseUpEventVerifier: e.mouse?.mouseUpEventVerifier ?? Z,
|
|
3496
3574
|
onNodeDragStarted: e.events?.onNodeDragStarted ?? X,
|
|
3497
3575
|
onNodeDrag: e.events?.onNodeDrag ?? X,
|
|
3498
|
-
nodeDragVerifier:
|
|
3576
|
+
nodeDragVerifier: e.nodeDragVerifier ?? (() => !0),
|
|
3499
3577
|
onNodeDragFinished: e.events?.onNodeDragFinished ?? X
|
|
3500
3578
|
};
|
|
3501
|
-
},
|
|
3579
|
+
}, At = (e) => {
|
|
3502
3580
|
let t = e.minX === null ? -Infinity : e.minX, n = e.maxX === null ? Infinity : e.maxX, r = e.minY === null ? -Infinity : e.minY, i = e.maxY === null ? Infinity : e.maxY;
|
|
3503
3581
|
return (e) => {
|
|
3504
3582
|
let a = e.nextTransform.x, o = e.nextTransform.y;
|
|
@@ -3512,7 +3590,7 @@ var ne = (e, t) => {
|
|
|
3512
3590
|
y: o
|
|
3513
3591
|
};
|
|
3514
3592
|
};
|
|
3515
|
-
},
|
|
3593
|
+
}, jt = (e) => {
|
|
3516
3594
|
let t = e.maxContentScale, n = e.minContentScale, r = t === null ? 0 : 1 / t, i = n === null ? Infinity : 1 / n;
|
|
3517
3595
|
return (e) => {
|
|
3518
3596
|
let t = e.prevTransform, n = e.nextTransform, a = n.scale, o = n.x, s = n.y;
|
|
@@ -3532,104 +3610,103 @@ var ne = (e, t) => {
|
|
|
3532
3610
|
y: s
|
|
3533
3611
|
};
|
|
3534
3612
|
};
|
|
3535
|
-
},
|
|
3613
|
+
}, Mt = (e) => (t) => e.reduce((e, n) => n({
|
|
3536
3614
|
prevTransform: t.prevTransform,
|
|
3537
3615
|
nextTransform: e,
|
|
3538
3616
|
viewport: t.viewport
|
|
3539
|
-
}), t.nextTransform),
|
|
3617
|
+
}), t.nextTransform), Nt = (e) => {
|
|
3540
3618
|
if (typeof e == "function") return e;
|
|
3541
3619
|
switch (e.type) {
|
|
3542
|
-
case "scale-limit": return
|
|
3620
|
+
case "scale-limit": return jt({
|
|
3543
3621
|
minContentScale: e.minContentScale ?? 0,
|
|
3544
3622
|
maxContentScale: e.maxContentScale ?? Infinity
|
|
3545
3623
|
});
|
|
3546
|
-
case "shift-limit": return
|
|
3624
|
+
case "shift-limit": return At({
|
|
3547
3625
|
minX: e.minX ?? -Infinity,
|
|
3548
3626
|
maxX: e.maxX ?? Infinity,
|
|
3549
3627
|
minY: e.minY ?? -Infinity,
|
|
3550
3628
|
maxY: e.maxY ?? Infinity
|
|
3551
3629
|
});
|
|
3552
3630
|
}
|
|
3553
|
-
},
|
|
3554
|
-
let t = e?.
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
return {
|
|
3558
|
-
wheelSensitivity: n,
|
|
3631
|
+
}, Pt = (e) => {
|
|
3632
|
+
let t = e?.transformPreprocessor, n;
|
|
3633
|
+
return n = t === void 0 ? (e) => e.nextTransform : Array.isArray(t) ? Mt(t.map((e) => Nt(e))) : Nt(t), {
|
|
3634
|
+
wheelSensitivity: e?.scale?.mouseWheelSensitivity ?? 1.2,
|
|
3559
3635
|
onTransformStarted: e?.events?.onTransformStarted ?? X,
|
|
3560
3636
|
onTransformFinished: e?.events?.onTransformFinished ?? X,
|
|
3561
3637
|
onBeforeTransformChange: e?.events?.onBeforeTransformChange ?? X,
|
|
3562
3638
|
onTransformChange: e?.events?.onTransformChange ?? X,
|
|
3563
|
-
transformPreprocessor:
|
|
3564
|
-
shiftCursor:
|
|
3565
|
-
mouseDownEventVerifier:
|
|
3566
|
-
mouseUpEventVerifier:
|
|
3567
|
-
mouseWheelEventVerifier:
|
|
3639
|
+
transformPreprocessor: n,
|
|
3640
|
+
shiftCursor: e?.pan?.cursor ?? "grab",
|
|
3641
|
+
mouseDownEventVerifier: e?.pan?.mouseDownEventVerifier ?? Q,
|
|
3642
|
+
mouseUpEventVerifier: e?.pan?.mouseUpEventVerifier ?? Z,
|
|
3643
|
+
mouseWheelEventVerifier: e?.scale?.mouseWheelEventVerifier ?? (() => !0),
|
|
3568
3644
|
scaleWheelFinishTimeout: e?.scale?.wheelFinishTimeout ?? 500,
|
|
3569
3645
|
onResizeTransformStarted: e?.events?.onResizeTransformStarted ?? X,
|
|
3570
3646
|
onResizeTransformFinished: e?.events?.onResizeTransformFinished ?? X
|
|
3571
3647
|
};
|
|
3572
|
-
},
|
|
3648
|
+
}, Ft = (e, t) => {
|
|
3573
3649
|
let n = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
3574
3650
|
return n.setAttribute("cx", "0"), n.setAttribute("cy", "0"), n.setAttribute("r", `${e}`), n.setAttribute("fill", `${t}`), n;
|
|
3575
|
-
},
|
|
3651
|
+
}, It = (e) => e instanceof SVGElement ? e : Ft(e?.radius ?? 1.5, e?.color ?? "#d8d8d8"), Lt = (e) => {
|
|
3576
3652
|
let t = e.tileDimensions;
|
|
3577
3653
|
return {
|
|
3578
3654
|
tileWidth: t?.width ?? 25,
|
|
3579
3655
|
tileHeight: t?.height ?? 25,
|
|
3580
|
-
renderer:
|
|
3656
|
+
renderer: It(e.renderer ?? {}),
|
|
3581
3657
|
maxViewportScale: e.maxViewportScale ?? 10
|
|
3582
3658
|
};
|
|
3583
|
-
},
|
|
3659
|
+
}, Rt = Object.freeze({
|
|
3584
3660
|
connectionTypeResolver: () => "direct",
|
|
3585
3661
|
connectionPreprocessor: (e) => e,
|
|
3586
|
-
connectionAllowedVerifier: () => !0
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
let r = e.connectionAllowedVerifier ?? Z.connectionAllowedVerifier;
|
|
3662
|
+
connectionAllowedVerifier: () => !0
|
|
3663
|
+
}), zt = (e, t, n) => {
|
|
3664
|
+
let r = e.connectionAllowedVerifier ?? Rt.connectionAllowedVerifier;
|
|
3590
3665
|
return {
|
|
3591
|
-
connectionTypeResolver: e.connectionTypeResolver ??
|
|
3666
|
+
connectionTypeResolver: e.connectionTypeResolver ?? Rt.connectionTypeResolver,
|
|
3592
3667
|
connectionAllowedVerifier: r,
|
|
3593
|
-
draggingPortDirectionResolver:
|
|
3594
|
-
edgeShapeFactory: e.edgeShape === void 0 ? t :
|
|
3595
|
-
connectionPreprocessor: e.connectionPreprocessor ??
|
|
3596
|
-
mouseDownEventVerifier: e.mouseDownEventVerifier ??
|
|
3597
|
-
mouseUpEventVerifier: e.mouseUpEventVerifier ?? Z
|
|
3668
|
+
draggingPortDirectionResolver: Et(e.dragPortDirection, n, r),
|
|
3669
|
+
edgeShapeFactory: e.edgeShape === void 0 ? t : Dt(e.edgeShape),
|
|
3670
|
+
connectionPreprocessor: e.connectionPreprocessor ?? Rt.connectionPreprocessor,
|
|
3671
|
+
mouseDownEventVerifier: e.mouseDownEventVerifier ?? Q,
|
|
3672
|
+
mouseUpEventVerifier: e.mouseUpEventVerifier ?? Z,
|
|
3598
3673
|
onAfterEdgeCreated: e.events?.onAfterEdgeCreated ?? X,
|
|
3599
3674
|
onEdgeCreationInterrupted: e.events?.onEdgeCreationInterrupted ?? X,
|
|
3600
|
-
onEdgeCreationPrevented: e.events?.onEdgeCreationPrevented ?? X
|
|
3675
|
+
onEdgeCreationPrevented: e.events?.onEdgeCreationPrevented ?? X,
|
|
3676
|
+
grabbedPortIdResolver: e.grabbedPortIdResolver ?? K,
|
|
3677
|
+
releasedPortIdResolver: e.releasedPortIdResolver ?? K
|
|
3601
3678
|
};
|
|
3602
|
-
},
|
|
3679
|
+
}, Bt = Object.freeze({
|
|
3603
3680
|
connectionAllowedVerifier: () => !0,
|
|
3604
|
-
connectionPreprocessor: (e) => e
|
|
3605
|
-
|
|
3606
|
-
mouseUpEventVerifier: (e) => e.button === 0
|
|
3607
|
-
}), Ft = (e, t) => {
|
|
3681
|
+
connectionPreprocessor: (e) => e
|
|
3682
|
+
}), Vt = (e, t) => {
|
|
3608
3683
|
let n = (e) => {
|
|
3609
3684
|
let n = t.getPortAdjacentEdgeIds(e);
|
|
3610
3685
|
return n.length > 0 ? n[n.length - 1] : null;
|
|
3611
|
-
}, r = e.connectionAllowedVerifier ??
|
|
3686
|
+
}, r = e.connectionAllowedVerifier ?? Bt.connectionAllowedVerifier;
|
|
3612
3687
|
return {
|
|
3613
|
-
connectionPreprocessor: e.connectionPreprocessor ??
|
|
3688
|
+
connectionPreprocessor: e.connectionPreprocessor ?? Bt.connectionPreprocessor,
|
|
3614
3689
|
connectionAllowedVerifier: r,
|
|
3615
|
-
mouseDownEventVerifier: e.mouseDownEventVerifier ?? Q
|
|
3616
|
-
mouseUpEventVerifier: e.mouseUpEventVerifier ??
|
|
3690
|
+
mouseDownEventVerifier: e.mouseDownEventVerifier ?? Q,
|
|
3691
|
+
mouseUpEventVerifier: e.mouseUpEventVerifier ?? Z,
|
|
3617
3692
|
draggingEdgeResolver: e.draggingEdgeResolver ?? n,
|
|
3618
|
-
draggingEdgeShapeFactory: e.draggingEdgeShape === void 0 ? null :
|
|
3693
|
+
draggingEdgeShapeFactory: e.draggingEdgeShape === void 0 ? null : Dt(e.draggingEdgeShape),
|
|
3619
3694
|
onAfterEdgeReattached: e.events?.onAfterEdgeReattached ?? X,
|
|
3620
3695
|
onEdgeReattachInterrupted: e.events?.onEdgeReattachInterrupted ?? X,
|
|
3621
3696
|
onEdgeReattachPrevented: e.events?.onEdgeReattachPrevented ?? X,
|
|
3622
|
-
draggingPortDirectionResolver:
|
|
3697
|
+
draggingPortDirectionResolver: Et(e.dragPortDirection, t, r),
|
|
3698
|
+
grabbedPortIdResolver: e.grabbedPortIdResolver ?? K,
|
|
3699
|
+
releasedPortIdResolver: e.releasedPortIdResolver ?? K
|
|
3623
3700
|
};
|
|
3624
|
-
},
|
|
3701
|
+
}, Ht = (e) => ({
|
|
3625
3702
|
nodeVerticalRadius: e.nodeContainingRadius.vertical,
|
|
3626
3703
|
nodeHorizontalRadius: e.nodeContainingRadius.horizontal
|
|
3627
|
-
}),
|
|
3704
|
+
}), Ut = (e) => ({
|
|
3628
3705
|
onAfterNodeDetached: e?.events?.onAfterNodeDetached ?? X,
|
|
3629
3706
|
onBeforeNodeAttached: e?.events?.onBeforeNodeAttached ?? X
|
|
3630
|
-
}),
|
|
3707
|
+
}), Wt = class extends Error {
|
|
3631
3708
|
name = "CanvasBuilderError";
|
|
3632
|
-
},
|
|
3709
|
+
}, Gt = class {
|
|
3633
3710
|
graph;
|
|
3634
3711
|
currentCoords;
|
|
3635
3712
|
dt;
|
|
@@ -3664,7 +3741,7 @@ var ne = (e, t) => {
|
|
|
3664
3741
|
d.x += l, d.y += u, f.x -= l, f.y -= u;
|
|
3665
3742
|
});
|
|
3666
3743
|
}
|
|
3667
|
-
},
|
|
3744
|
+
}, Kt = class {
|
|
3668
3745
|
rand;
|
|
3669
3746
|
PI2 = 2 * Math.PI;
|
|
3670
3747
|
constructor(e) {
|
|
@@ -3687,11 +3764,11 @@ var ne = (e, t) => {
|
|
|
3687
3764
|
d: a
|
|
3688
3765
|
};
|
|
3689
3766
|
}
|
|
3690
|
-
},
|
|
3767
|
+
}, qt = (e) => {
|
|
3691
3768
|
if (e.distance === 0) return e.maxForce;
|
|
3692
3769
|
let t = e.coefficient * (e.sourceCharge * e.targetCharge / (e.distance * e.distance));
|
|
3693
3770
|
return Math.min(t, e.maxForce);
|
|
3694
|
-
},
|
|
3771
|
+
}, Jt = class {
|
|
3695
3772
|
nodeCharge;
|
|
3696
3773
|
distanceVectorGenerator;
|
|
3697
3774
|
maxForce;
|
|
@@ -3703,7 +3780,7 @@ var ne = (e, t) => {
|
|
|
3703
3780
|
for (let i = 0; i < r; i++) {
|
|
3704
3781
|
let a = n[i];
|
|
3705
3782
|
for (let o = i + 1; o < r; o++) {
|
|
3706
|
-
let r = n[o], i = e.get(a), s = e.get(r), c = this.distanceVectorGenerator.create(i, s), l =
|
|
3783
|
+
let r = n[o], i = e.get(a), s = e.get(r), c = this.distanceVectorGenerator.create(i, s), l = qt({
|
|
3707
3784
|
coefficient: 1,
|
|
3708
3785
|
sourceCharge: this.nodeCharge,
|
|
3709
3786
|
targetCharge: this.nodeCharge,
|
|
@@ -3714,7 +3791,7 @@ var ne = (e, t) => {
|
|
|
3714
3791
|
}
|
|
3715
3792
|
}
|
|
3716
3793
|
}
|
|
3717
|
-
},
|
|
3794
|
+
}, Yt = (e) => {
|
|
3718
3795
|
if (e.size === 0) return {
|
|
3719
3796
|
centerX: 0,
|
|
3720
3797
|
centerY: 0,
|
|
@@ -3730,7 +3807,7 @@ var ne = (e, t) => {
|
|
|
3730
3807
|
centerY: (r + i) / 2,
|
|
3731
3808
|
radius: s / 2
|
|
3732
3809
|
};
|
|
3733
|
-
},
|
|
3810
|
+
}, Xt = class {
|
|
3734
3811
|
root;
|
|
3735
3812
|
leaves = /* @__PURE__ */ new Map();
|
|
3736
3813
|
coords;
|
|
@@ -3886,7 +3963,7 @@ var ne = (e, t) => {
|
|
|
3886
3963
|
y: n / e.size
|
|
3887
3964
|
};
|
|
3888
3965
|
}
|
|
3889
|
-
},
|
|
3966
|
+
}, Zt = class {
|
|
3890
3967
|
areaRadiusThreshold;
|
|
3891
3968
|
nodeMass;
|
|
3892
3969
|
nodeCharge;
|
|
@@ -3898,8 +3975,8 @@ var ne = (e, t) => {
|
|
|
3898
3975
|
this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.theta = e.theta, this.distanceVectorGenerator = e.distanceVectorGenerator, this.nodeForceCoefficient = e.nodeForceCoefficient, this.maxForce = e.maxForce;
|
|
3899
3976
|
}
|
|
3900
3977
|
apply(e, t) {
|
|
3901
|
-
let n = new
|
|
3902
|
-
box:
|
|
3978
|
+
let n = new Xt({
|
|
3979
|
+
box: Yt(e),
|
|
3903
3980
|
coords: e,
|
|
3904
3981
|
areaRadiusThreshold: this.areaRadiusThreshold,
|
|
3905
3982
|
nodeMass: this.nodeMass,
|
|
@@ -4009,7 +4086,7 @@ var ne = (e, t) => {
|
|
|
4009
4086
|
});
|
|
4010
4087
|
}
|
|
4011
4088
|
calculateNodeRepulsiveForce(e) {
|
|
4012
|
-
let t = this.distanceVectorGenerator.create(e.sourceCoords, e.targetCoords), n =
|
|
4089
|
+
let t = this.distanceVectorGenerator.create(e.sourceCoords, e.targetCoords), n = qt({
|
|
4013
4090
|
coefficient: this.nodeForceCoefficient,
|
|
4014
4091
|
sourceCharge: e.sourceCharge,
|
|
4015
4092
|
targetCharge: e.targetCharge,
|
|
@@ -4036,12 +4113,12 @@ var ne = (e, t) => {
|
|
|
4036
4113
|
this.applyForce(e.totalForce, t);
|
|
4037
4114
|
}
|
|
4038
4115
|
}
|
|
4039
|
-
},
|
|
4116
|
+
}, Qt = (e) => e.theta === 0 ? new Jt({
|
|
4040
4117
|
nodeCharge: e.nodeCharge,
|
|
4041
4118
|
nodeForceCoefficient: e.nodeForceCoefficient,
|
|
4042
4119
|
distanceVectorGenerator: e.distanceVectorGenerator,
|
|
4043
4120
|
maxForce: e.maxForce
|
|
4044
|
-
}) : new
|
|
4121
|
+
}) : new Zt({
|
|
4045
4122
|
nodeCharge: e.nodeCharge,
|
|
4046
4123
|
nodeForceCoefficient: e.nodeForceCoefficient,
|
|
4047
4124
|
distanceVectorGenerator: e.distanceVectorGenerator,
|
|
@@ -4049,7 +4126,7 @@ var ne = (e, t) => {
|
|
|
4049
4126
|
theta: e.theta,
|
|
4050
4127
|
nodeMass: e.nodeMass,
|
|
4051
4128
|
areaRadiusThreshold: e.areaRadiusThreshold
|
|
4052
|
-
}),
|
|
4129
|
+
}), $t = class {
|
|
4053
4130
|
rand;
|
|
4054
4131
|
sparsity;
|
|
4055
4132
|
constructor(e) {
|
|
@@ -4074,7 +4151,7 @@ var ne = (e, t) => {
|
|
|
4074
4151
|
});
|
|
4075
4152
|
}), r;
|
|
4076
4153
|
}
|
|
4077
|
-
},
|
|
4154
|
+
}, en = class {
|
|
4078
4155
|
distanceVectorGenerator;
|
|
4079
4156
|
nodeForcesApplicationStrategy;
|
|
4080
4157
|
fillerLayoutAlgorithm;
|
|
@@ -4083,9 +4160,9 @@ var ne = (e, t) => {
|
|
|
4083
4160
|
nodeMass;
|
|
4084
4161
|
edgeEquilibriumLength;
|
|
4085
4162
|
edgeStiffness;
|
|
4086
|
-
|
|
4163
|
+
stopVelocity;
|
|
4087
4164
|
constructor(e) {
|
|
4088
|
-
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.
|
|
4165
|
+
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.stopVelocity = e.stopVelocity, this.distanceVectorGenerator = new Kt(e.rand), this.nodeForcesApplicationStrategy = Qt({
|
|
4089
4166
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4090
4167
|
nodeCharge: e.nodeCharge,
|
|
4091
4168
|
maxForce: e.maxForce,
|
|
@@ -4093,7 +4170,7 @@ var ne = (e, t) => {
|
|
|
4093
4170
|
theta: e.barnesHutTheta,
|
|
4094
4171
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4095
4172
|
nodeMass: e.nodeMass
|
|
4096
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4173
|
+
}), this.fillerLayoutAlgorithm = new $t({
|
|
4097
4174
|
rand: e.rand,
|
|
4098
4175
|
sparsity: e.edgeEquilibriumLength
|
|
4099
4176
|
});
|
|
@@ -4103,17 +4180,17 @@ var ne = (e, t) => {
|
|
|
4103
4180
|
graph: t,
|
|
4104
4181
|
viewport: n
|
|
4105
4182
|
});
|
|
4106
|
-
for (let e = 0; e < this.maxIterations && !(new
|
|
4183
|
+
for (let e = 0; e < this.maxIterations && !(new Gt(t, r, {
|
|
4107
4184
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4108
4185
|
nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
|
|
4109
4186
|
dtSec: this.dtSec,
|
|
4110
4187
|
nodeMass: this.nodeMass,
|
|
4111
4188
|
edgeEquilibriumLength: this.edgeEquilibriumLength,
|
|
4112
4189
|
edgeStiffness: this.edgeStiffness
|
|
4113
|
-
}).apply() < this.
|
|
4190
|
+
}).apply() < this.stopVelocity); e++);
|
|
4114
4191
|
return r;
|
|
4115
4192
|
}
|
|
4116
|
-
},
|
|
4193
|
+
}, tn = class {
|
|
4117
4194
|
graph;
|
|
4118
4195
|
nextLayerNodesResolver;
|
|
4119
4196
|
forest = /* @__PURE__ */ new Set();
|
|
@@ -4157,7 +4234,7 @@ var ne = (e, t) => {
|
|
|
4157
4234
|
}), r = e;
|
|
4158
4235
|
}
|
|
4159
4236
|
}
|
|
4160
|
-
},
|
|
4237
|
+
}, nn = class {
|
|
4161
4238
|
params;
|
|
4162
4239
|
constructor(e) {
|
|
4163
4240
|
this.params = e;
|
|
@@ -4196,13 +4273,13 @@ var ne = (e, t) => {
|
|
|
4196
4273
|
}
|
|
4197
4274
|
return n - 2 * this.params.spaceAroundRadius;
|
|
4198
4275
|
}
|
|
4199
|
-
},
|
|
4276
|
+
}, rn = class {
|
|
4200
4277
|
tree;
|
|
4201
4278
|
offsets = /* @__PURE__ */ new Map();
|
|
4202
4279
|
treeSpans = /* @__PURE__ */ new Map();
|
|
4203
4280
|
constructor(e, t) {
|
|
4204
4281
|
this.tree = e;
|
|
4205
|
-
let n = t.spaceAroundRadius, r = new
|
|
4282
|
+
let n = t.spaceAroundRadius, r = new nn({ spaceAroundRadius: n });
|
|
4206
4283
|
[...this.tree.sequence].reverse().forEach((e) => {
|
|
4207
4284
|
let t = Array.from(e.children).map((e) => this.treeSpans.get(e.nodeId)), i = r.generate(t), a = 0;
|
|
4208
4285
|
e.children.forEach((e) => {
|
|
@@ -4218,19 +4295,19 @@ var ne = (e, t) => {
|
|
|
4218
4295
|
generate() {
|
|
4219
4296
|
return this.offsets;
|
|
4220
4297
|
}
|
|
4221
|
-
},
|
|
4298
|
+
}, an = class {
|
|
4222
4299
|
params;
|
|
4223
4300
|
constructor(e) {
|
|
4224
4301
|
this.params = e;
|
|
4225
4302
|
}
|
|
4226
4303
|
calculateCoordinates(e) {
|
|
4227
|
-
let t = /* @__PURE__ */ new Map(), n = new
|
|
4304
|
+
let t = /* @__PURE__ */ new Map(), n = new tn(e.graph, this.params.nextLayerNodesResolver).generate(), r = 0;
|
|
4228
4305
|
return n.forEach((e) => {
|
|
4229
4306
|
t.set(e.root.nodeId, {
|
|
4230
4307
|
x: r,
|
|
4231
4308
|
y: 0
|
|
4232
4309
|
});
|
|
4233
|
-
let n = new
|
|
4310
|
+
let n = new rn(e, { spaceAroundRadius: this.params.layerSpace / 2 }).generate(), i = [e.root];
|
|
4234
4311
|
for (; i.length > 0;) {
|
|
4235
4312
|
let e = [];
|
|
4236
4313
|
r += this.params.layerWidth, i.forEach((i) => {
|
|
@@ -4247,7 +4324,7 @@ var ne = (e, t) => {
|
|
|
4247
4324
|
t.set(n, this.params.transform(e));
|
|
4248
4325
|
}), t;
|
|
4249
4326
|
}
|
|
4250
|
-
},
|
|
4327
|
+
}, on = (e) => {
|
|
4251
4328
|
let { graph: t, currentNodeId: n } = e, r = t.getNodeOutgoingEdgeIds(n).map((e) => {
|
|
4252
4329
|
let n = t.getEdge(e);
|
|
4253
4330
|
return t.getPort(n.to).nodeId;
|
|
@@ -4256,29 +4333,29 @@ var ne = (e, t) => {
|
|
|
4256
4333
|
return t.getPort(n.from).nodeId;
|
|
4257
4334
|
});
|
|
4258
4335
|
return /* @__PURE__ */ new Set([...r, ...i]);
|
|
4259
|
-
},
|
|
4336
|
+
}, sn = (e) => {
|
|
4260
4337
|
let { graph: t, currentNodeId: n } = e, r = t.getNodeOutgoingEdgeIds(n).map((e) => {
|
|
4261
4338
|
let n = t.getEdge(e);
|
|
4262
4339
|
return t.getPort(n.to).nodeId;
|
|
4263
4340
|
});
|
|
4264
4341
|
return new Set(r);
|
|
4265
|
-
},
|
|
4342
|
+
}, cn = (e) => {
|
|
4266
4343
|
let { graph: t, currentNodeId: n } = e, r = t.getNodeIncomingEdgeIds(n).map((e) => {
|
|
4267
4344
|
let n = t.getEdge(e);
|
|
4268
4345
|
return t.getPort(n.from).nodeId;
|
|
4269
4346
|
});
|
|
4270
4347
|
return new Set(r);
|
|
4271
|
-
},
|
|
4348
|
+
}, ln = class {
|
|
4272
4349
|
distanceVectorGenerator;
|
|
4273
4350
|
nodeForcesApplicationStrategy;
|
|
4274
|
-
|
|
4351
|
+
stopVelocity;
|
|
4275
4352
|
maxTimeDeltaSec;
|
|
4276
4353
|
nodeMass;
|
|
4277
4354
|
edgeEquilibriumLength;
|
|
4278
4355
|
edgeStiffness;
|
|
4279
4356
|
fillerLayoutAlgorithm;
|
|
4280
4357
|
constructor(e) {
|
|
4281
|
-
this.
|
|
4358
|
+
this.stopVelocity = e.stopVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new Kt(e.rand), this.nodeForcesApplicationStrategy = Qt({
|
|
4282
4359
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4283
4360
|
nodeCharge: e.nodeCharge,
|
|
4284
4361
|
maxForce: e.maxForce,
|
|
@@ -4286,7 +4363,7 @@ var ne = (e, t) => {
|
|
|
4286
4363
|
theta: e.barnesHutTheta,
|
|
4287
4364
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4288
4365
|
nodeMass: e.nodeMass
|
|
4289
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4366
|
+
}), this.fillerLayoutAlgorithm = new $t({
|
|
4290
4367
|
rand: e.rand,
|
|
4291
4368
|
sparsity: e.edgeEquilibriumLength
|
|
4292
4369
|
});
|
|
@@ -4296,19 +4373,19 @@ var ne = (e, t) => {
|
|
|
4296
4373
|
graph: t,
|
|
4297
4374
|
viewport: n
|
|
4298
4375
|
});
|
|
4299
|
-
return new
|
|
4376
|
+
return new Gt(t, i, {
|
|
4300
4377
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4301
4378
|
nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
|
|
4302
4379
|
dtSec: Math.min(r, this.maxTimeDeltaSec),
|
|
4303
4380
|
nodeMass: this.nodeMass,
|
|
4304
4381
|
edgeEquilibriumLength: this.edgeEquilibriumLength,
|
|
4305
4382
|
edgeStiffness: this.edgeStiffness
|
|
4306
|
-
}).apply() < this.
|
|
4383
|
+
}).apply() < this.stopVelocity && !t.getAllNodeIds().some((e) => {
|
|
4307
4384
|
let n = t.getNode(e);
|
|
4308
4385
|
return n.x === null || n.y === null;
|
|
4309
4386
|
}) ? /* @__PURE__ */ new Map() : i;
|
|
4310
4387
|
}
|
|
4311
|
-
},
|
|
4388
|
+
}, un = (e) => {
|
|
4312
4389
|
let t = 1779033703, n = 3144134277, r = 1013904242, i = 2773480762;
|
|
4313
4390
|
for (let a = 0, o; a < e.length; a++) o = e.charCodeAt(a), t = n ^ Math.imul(t ^ o, 597399067), n = r ^ Math.imul(n ^ o, 2869860233), r = i ^ Math.imul(r ^ o, 951274213), i = t ^ Math.imul(i ^ o, 2716044179);
|
|
4314
4391
|
return t = Math.imul(r ^ t >>> 18, 597399067), n = Math.imul(i ^ n >>> 22, 2869860233), r = Math.imul(t ^ r >>> 17, 951274213), i = Math.imul(n ^ i >>> 19, 2716044179), t ^= n ^ r ^ i, n ^= t, r ^= t, i ^= t, [
|
|
@@ -4317,42 +4394,42 @@ var ne = (e, t) => {
|
|
|
4317
4394
|
r >>> 0,
|
|
4318
4395
|
i >>> 0
|
|
4319
4396
|
];
|
|
4320
|
-
},
|
|
4397
|
+
}, dn = (e, t, n, r) => function() {
|
|
4321
4398
|
e |= 0, t |= 0, n |= 0, r |= 0;
|
|
4322
4399
|
let i = (e + t | 0) + r | 0;
|
|
4323
4400
|
return r = r + 1 | 0, e = t ^ t >>> 9, t = n + (n << 3) | 0, n = n << 21 | n >>> 11, n = n + i | 0, (i >>> 0) / 4294967296;
|
|
4324
|
-
},
|
|
4401
|
+
}, fn = (e) => {
|
|
4325
4402
|
switch (e?.type) {
|
|
4326
4403
|
case "custom": return e.instance;
|
|
4327
4404
|
default: {
|
|
4328
|
-
let t =
|
|
4329
|
-
return new
|
|
4330
|
-
rand:
|
|
4331
|
-
maxTimeDeltaSec: e?.maxTimeDeltaSec ??
|
|
4332
|
-
nodeCharge: e?.nodeCharge ??
|
|
4333
|
-
nodeMass: e?.nodeMass ??
|
|
4334
|
-
edgeEquilibriumLength: e?.edgeEquilibriumLength ??
|
|
4335
|
-
edgeStiffness: e?.edgeStiffness ??
|
|
4336
|
-
stopVelocity: e?.stopVelocity ??
|
|
4337
|
-
maxForce: e?.maxForce ??
|
|
4338
|
-
nodeForceCoefficient: e?.nodeForceCoefficient ??
|
|
4339
|
-
barnesHutTheta: e?.barnesHut?.theta ??
|
|
4340
|
-
barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ??
|
|
4405
|
+
let t = un(e?.seed ?? Y.seed);
|
|
4406
|
+
return new ln({
|
|
4407
|
+
rand: dn(t[0], t[1], t[2], t[3]),
|
|
4408
|
+
maxTimeDeltaSec: e?.maxTimeDeltaSec ?? Y.maxTimeDeltaSec,
|
|
4409
|
+
nodeCharge: e?.nodeCharge ?? Y.nodeCharge,
|
|
4410
|
+
nodeMass: e?.nodeMass ?? Y.nodeMass,
|
|
4411
|
+
edgeEquilibriumLength: e?.edgeEquilibriumLength ?? Y.edgeEquilibriumLength,
|
|
4412
|
+
edgeStiffness: e?.edgeStiffness ?? Y.edgeStiffness,
|
|
4413
|
+
stopVelocity: e?.stopVelocity ?? Y.stopVelocity,
|
|
4414
|
+
maxForce: e?.maxForce ?? Y.maxForce,
|
|
4415
|
+
nodeForceCoefficient: e?.nodeForceCoefficient ?? Y.nodeForceCoefficient,
|
|
4416
|
+
barnesHutTheta: e?.barnesHut?.theta ?? Y.barnesHutTheta,
|
|
4417
|
+
barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ?? Y.barnesHutAreaRadiusThreshold
|
|
4341
4418
|
});
|
|
4342
4419
|
}
|
|
4343
4420
|
}
|
|
4344
|
-
},
|
|
4345
|
-
algorithm:
|
|
4346
|
-
staticNodeResolver: e?.staticNodeResolver ??
|
|
4421
|
+
}, pn = { staticNodeResolver: () => !1 }, mn = (e) => ({
|
|
4422
|
+
algorithm: fn(e?.algorithm ?? {}),
|
|
4423
|
+
staticNodeResolver: e?.staticNodeResolver ?? pn.staticNodeResolver,
|
|
4347
4424
|
onBeforeApplied: e?.events?.onBeforeApplied ?? X,
|
|
4348
4425
|
onAfterApplied: e?.events?.onAfterApplied ?? X
|
|
4349
|
-
}),
|
|
4426
|
+
}), hn = (e) => e instanceof l ? {
|
|
4350
4427
|
type: "trigger",
|
|
4351
4428
|
trigger: e
|
|
4352
4429
|
} : {
|
|
4353
4430
|
type: "topologyChangeSchedule",
|
|
4354
4431
|
schedule: We
|
|
4355
|
-
},
|
|
4432
|
+
}, gn = Object.freeze({
|
|
4356
4433
|
staticNodeResolver: () => !1,
|
|
4357
4434
|
hierarchicalLayout: {
|
|
4358
4435
|
layerWidth: 300,
|
|
@@ -4365,7 +4442,7 @@ var ne = (e, t) => {
|
|
|
4365
4442
|
d: e.d * t.a + e.e * t.d,
|
|
4366
4443
|
e: e.d * t.b + e.e * t.e,
|
|
4367
4444
|
f: e.d * t.c + e.e * t.f + e.f
|
|
4368
|
-
}),
|
|
4445
|
+
}), _n = (e) => {
|
|
4369
4446
|
let { a: t, b: n, c: r, d: i, e: a, f: o } = e, s = t * a - n * i;
|
|
4370
4447
|
return {
|
|
4371
4448
|
a: a / s,
|
|
@@ -4375,7 +4452,7 @@ var ne = (e, t) => {
|
|
|
4375
4452
|
e: t / s,
|
|
4376
4453
|
f: (r * i - t * o) / s
|
|
4377
4454
|
};
|
|
4378
|
-
},
|
|
4455
|
+
}, vn = class {
|
|
4379
4456
|
resolve(e) {
|
|
4380
4457
|
if ("shift" in e) return this.createShiftBaseMatrix(e.shift);
|
|
4381
4458
|
if ("scale" in e) {
|
|
@@ -4421,7 +4498,7 @@ var ne = (e, t) => {
|
|
|
4421
4498
|
return this.createRelativeTransform(n, r);
|
|
4422
4499
|
}
|
|
4423
4500
|
createRelativeTransform(e, t) {
|
|
4424
|
-
return $($(t, e),
|
|
4501
|
+
return $($(t, e), _n(t));
|
|
4425
4502
|
}
|
|
4426
4503
|
createShiftBaseMatrix(e) {
|
|
4427
4504
|
return {
|
|
@@ -4464,7 +4541,7 @@ var ne = (e, t) => {
|
|
|
4464
4541
|
f: 0
|
|
4465
4542
|
};
|
|
4466
4543
|
}
|
|
4467
|
-
},
|
|
4544
|
+
}, yn = (e) => {
|
|
4468
4545
|
if (e === void 0) return (e) => e;
|
|
4469
4546
|
if (typeof e == "function") return e;
|
|
4470
4547
|
let t = Array.isArray(e) ? e : [e], n = {
|
|
@@ -4474,7 +4551,7 @@ var ne = (e, t) => {
|
|
|
4474
4551
|
d: 0,
|
|
4475
4552
|
e: 1,
|
|
4476
4553
|
f: 0
|
|
4477
|
-
}, r = new
|
|
4554
|
+
}, r = new vn();
|
|
4478
4555
|
return t.forEach((e) => {
|
|
4479
4556
|
let t = r.resolve(e);
|
|
4480
4557
|
n = $(n, t);
|
|
@@ -4485,47 +4562,47 @@ var ne = (e, t) => {
|
|
|
4485
4562
|
y: n.d * t + n.e * r + n.f
|
|
4486
4563
|
};
|
|
4487
4564
|
};
|
|
4488
|
-
},
|
|
4565
|
+
}, bn = (e) => {
|
|
4489
4566
|
if (typeof e == "function") return e;
|
|
4490
4567
|
switch (e) {
|
|
4491
|
-
case "outgoing": return
|
|
4492
|
-
case "incoming": return
|
|
4493
|
-
default: return
|
|
4568
|
+
case "outgoing": return sn;
|
|
4569
|
+
case "incoming": return cn;
|
|
4570
|
+
default: return on;
|
|
4494
4571
|
}
|
|
4495
|
-
},
|
|
4572
|
+
}, xn = (e) => {
|
|
4496
4573
|
switch (e?.type) {
|
|
4497
4574
|
case "custom": return e.instance;
|
|
4498
|
-
case "hierarchical": return new
|
|
4499
|
-
layerWidth: e.layerWidth ??
|
|
4500
|
-
layerSpace: e.layerSpace ??
|
|
4501
|
-
transform:
|
|
4502
|
-
nextLayerNodesResolver:
|
|
4575
|
+
case "hierarchical": return new an({
|
|
4576
|
+
layerWidth: e.layerWidth ?? gn.hierarchicalLayout.layerWidth,
|
|
4577
|
+
layerSpace: e.layerSpace ?? gn.hierarchicalLayout.layerSpace,
|
|
4578
|
+
transform: yn(e.transform),
|
|
4579
|
+
nextLayerNodesResolver: bn(e.nextLayerNodesResolver)
|
|
4503
4580
|
});
|
|
4504
4581
|
default: {
|
|
4505
|
-
let t =
|
|
4506
|
-
return new
|
|
4507
|
-
dtSec: e?.dtSec ??
|
|
4508
|
-
maxIterations: e?.maxIterations ??
|
|
4582
|
+
let t = un(e?.seed ?? Y.seed), n = dn(t[0], t[1], t[2], t[3]);
|
|
4583
|
+
return new en({
|
|
4584
|
+
dtSec: e?.dtSec ?? Y.dtSec,
|
|
4585
|
+
maxIterations: e?.maxIterations ?? Y.maxIterations,
|
|
4509
4586
|
rand: n,
|
|
4510
|
-
nodeCharge: e?.nodeCharge ??
|
|
4511
|
-
nodeMass: e?.nodeMass ??
|
|
4512
|
-
edgeEquilibriumLength: e?.edgeEquilibriumLength ??
|
|
4513
|
-
edgeStiffness: e?.edgeStiffness ??
|
|
4514
|
-
stopVelocity: e?.stopVelocity ??
|
|
4515
|
-
maxForce: e?.maxForce ??
|
|
4516
|
-
nodeForceCoefficient: e?.nodeForceCoefficient ??
|
|
4517
|
-
barnesHutTheta: e?.barnesHut?.theta ??
|
|
4518
|
-
barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ??
|
|
4587
|
+
nodeCharge: e?.nodeCharge ?? Y.nodeCharge,
|
|
4588
|
+
nodeMass: e?.nodeMass ?? Y.nodeMass,
|
|
4589
|
+
edgeEquilibriumLength: e?.edgeEquilibriumLength ?? Y.edgeEquilibriumLength,
|
|
4590
|
+
edgeStiffness: e?.edgeStiffness ?? Y.edgeStiffness,
|
|
4591
|
+
stopVelocity: e?.stopVelocity ?? Y.stopVelocity,
|
|
4592
|
+
maxForce: e?.maxForce ?? Y.maxForce,
|
|
4593
|
+
nodeForceCoefficient: e?.nodeForceCoefficient ?? Y.nodeForceCoefficient,
|
|
4594
|
+
barnesHutTheta: e?.barnesHut?.theta ?? Y.barnesHutTheta,
|
|
4595
|
+
barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ?? Y.barnesHutAreaRadiusThreshold
|
|
4519
4596
|
});
|
|
4520
4597
|
}
|
|
4521
4598
|
}
|
|
4522
|
-
},
|
|
4523
|
-
algorithm:
|
|
4524
|
-
applyOn:
|
|
4525
|
-
staticNodeResolver: e.staticNodeResolver ??
|
|
4599
|
+
}, Sn = (e) => ({
|
|
4600
|
+
algorithm: xn(e.algorithm),
|
|
4601
|
+
applyOn: hn(e.applyOn),
|
|
4602
|
+
staticNodeResolver: e.staticNodeResolver ?? gn.staticNodeResolver,
|
|
4526
4603
|
onBeforeApplied: e.events?.onBeforeApplied ?? X,
|
|
4527
4604
|
onAfterApplied: e.events?.onAfterApplied ?? X
|
|
4528
|
-
}),
|
|
4605
|
+
}), Cn = (e, t) => ({
|
|
4529
4606
|
...e,
|
|
4530
4607
|
onNodeDragStarted: (n) => {
|
|
4531
4608
|
t.add(n), e.onNodeDragStarted(n);
|
|
@@ -4533,7 +4610,7 @@ var ne = (e, t) => {
|
|
|
4533
4610
|
onNodeDragFinished: (n) => {
|
|
4534
4611
|
t.delete(n), e.onNodeDragFinished(n);
|
|
4535
4612
|
}
|
|
4536
|
-
}),
|
|
4613
|
+
}), wn = (e, t) => {
|
|
4537
4614
|
e.graph.onBeforeNodeRemoved.subscribe((e) => {
|
|
4538
4615
|
t.delete(e);
|
|
4539
4616
|
}), e.graph.onBeforeClear.subscribe(() => {
|
|
@@ -4541,20 +4618,20 @@ var ne = (e, t) => {
|
|
|
4541
4618
|
}), e.onBeforeDestroy.subscribe(() => {
|
|
4542
4619
|
t.clear();
|
|
4543
4620
|
});
|
|
4544
|
-
},
|
|
4621
|
+
}, Tn = (e, t) => ({
|
|
4545
4622
|
...e,
|
|
4546
4623
|
staticNodeResolver: (n) => e.staticNodeResolver(n) || t.has(n)
|
|
4547
|
-
}),
|
|
4624
|
+
}), En = (e) => () => e, Dn = En(0), On = () => {
|
|
4548
4625
|
let e = 0;
|
|
4549
4626
|
return () => e++;
|
|
4550
|
-
},
|
|
4551
|
-
let n =
|
|
4552
|
-
return e === "incremental" && (n = i), t === "incremental" && (r = i), typeof e == "number" && (n =
|
|
4627
|
+
}, kn = (e, t) => {
|
|
4628
|
+
let n = Dn, r = Dn, i = On();
|
|
4629
|
+
return e === "incremental" && (n = i), t === "incremental" && (r = i), typeof e == "number" && (n = En(e)), typeof t == "number" && (r = En(t)), typeof e == "function" && (n = e), typeof t == "function" && (r = t), {
|
|
4553
4630
|
nodesPriorityFn: n,
|
|
4554
4631
|
edgesPriorityFn: r
|
|
4555
4632
|
};
|
|
4556
|
-
},
|
|
4557
|
-
let t =
|
|
4633
|
+
}, An = (e) => {
|
|
4634
|
+
let t = kn(e.nodes?.priority, e.edges?.priority);
|
|
4558
4635
|
return {
|
|
4559
4636
|
nodes: {
|
|
4560
4637
|
centerFn: e.nodes?.centerFn ?? re,
|
|
@@ -4562,34 +4639,45 @@ var ne = (e, t) => {
|
|
|
4562
4639
|
},
|
|
4563
4640
|
ports: { direction: e.ports?.direction ?? 0 },
|
|
4564
4641
|
edges: {
|
|
4565
|
-
shapeFactory:
|
|
4642
|
+
shapeFactory: Dt(e.edges?.shape ?? {}),
|
|
4566
4643
|
priorityFn: t.edgesPriorityFn
|
|
4567
4644
|
}
|
|
4568
4645
|
};
|
|
4569
|
-
},
|
|
4570
|
-
let { canvasDefaults: t } = e, n = e.hasLayout ?
|
|
4646
|
+
}, jn = (e) => e.applyOn.type === "topologyChangeSchedule" ? e.applyOn.schedule : B, Mn = (e) => {
|
|
4647
|
+
let { canvasDefaults: t } = e, n = e.hasLayout ? jn(e.layoutParams) : B;
|
|
4571
4648
|
return { focus: {
|
|
4572
4649
|
contentPadding: t.focus?.contentPadding ?? 100,
|
|
4573
4650
|
minContentScale: t.focus?.minContentScale ?? 0,
|
|
4574
4651
|
schedule: n,
|
|
4575
4652
|
animationDuration: t.focus?.animationDuration ?? 0
|
|
4576
4653
|
} };
|
|
4577
|
-
},
|
|
4654
|
+
}, Nn = (e) => ({
|
|
4578
4655
|
onNodeSelected: e.onNodeSelected,
|
|
4579
|
-
mouseDownEventVerifier: e.mouseDownEventVerifier ??
|
|
4580
|
-
mouseUpEventVerifier: e.mouseUpEventVerifier ??
|
|
4581
|
-
movementThreshold: e.movementThreshold ??
|
|
4582
|
-
}),
|
|
4656
|
+
mouseDownEventVerifier: e.mouseDownEventVerifier ?? Q,
|
|
4657
|
+
mouseUpEventVerifier: e.mouseUpEventVerifier ?? Z,
|
|
4658
|
+
movementThreshold: e.movementThreshold ?? 10
|
|
4659
|
+
}), Pn = (e) => ({
|
|
4583
4660
|
onCanvasSelected: e.onCanvasSelected,
|
|
4584
|
-
mouseDownEventVerifier: e.mouseDownEventVerifier ??
|
|
4585
|
-
mouseUpEventVerifier: e.mouseUpEventVerifier ??
|
|
4586
|
-
movementThreshold: e.movementThreshold ??
|
|
4587
|
-
}),
|
|
4661
|
+
mouseDownEventVerifier: e.mouseDownEventVerifier ?? Q,
|
|
4662
|
+
mouseUpEventVerifier: e.mouseUpEventVerifier ?? Z,
|
|
4663
|
+
movementThreshold: e.movementThreshold ?? 10
|
|
4664
|
+
}), Fn = (e) => ({
|
|
4588
4665
|
onEdgeSelected: e.onEdgeSelected,
|
|
4589
|
-
mouseDownEventVerifier: e.mouseDownEventVerifier ??
|
|
4590
|
-
mouseUpEventVerifier: e.mouseUpEventVerifier ??
|
|
4591
|
-
movementThreshold: e.movementThreshold ??
|
|
4592
|
-
}),
|
|
4666
|
+
mouseDownEventVerifier: e.mouseDownEventVerifier ?? Q,
|
|
4667
|
+
mouseUpEventVerifier: e.mouseUpEventVerifier ?? Z,
|
|
4668
|
+
movementThreshold: e.movementThreshold ?? 10
|
|
4669
|
+
}), In = () => {
|
|
4670
|
+
let e = document.createElement("div");
|
|
4671
|
+
return e.style.width = "100%", e.style.height = "100%", e.style.background = "rgba(174, 238, 255, 0.34)", e.style.border = "1px dashed rgba(96, 96, 96, 0.47)", e;
|
|
4672
|
+
}, Ln = (e) => ({
|
|
4673
|
+
rectangleElement: e?.rectangleElement ?? In(),
|
|
4674
|
+
mouseDownEventVerifier: e?.mouseDownEventVerifier ?? Ot,
|
|
4675
|
+
mouseUpEventVerifier: e?.mouseUpEventVerifier ?? Z,
|
|
4676
|
+
onSelectionStarted: e?.onSelectionStarted ?? X,
|
|
4677
|
+
onSelectionChange: e?.onSelectionChange ?? X,
|
|
4678
|
+
onSelectionInterrupted: e?.onSelectionInterrupted ?? X,
|
|
4679
|
+
onSelectionFinished: e?.onSelectionFinished ?? X
|
|
4680
|
+
}), Rn = class {
|
|
4593
4681
|
element;
|
|
4594
4682
|
used = !1;
|
|
4595
4683
|
canvasDefaults = {};
|
|
@@ -4598,6 +4686,7 @@ var ne = (e, t) => {
|
|
|
4598
4686
|
backgroundConfig = {};
|
|
4599
4687
|
connectablePortsConfig = {};
|
|
4600
4688
|
draggableEdgesConfig = {};
|
|
4689
|
+
rectangularSelectionConfig = void 0;
|
|
4601
4690
|
virtualScrollConfig = void 0;
|
|
4602
4691
|
layoutConfig = {};
|
|
4603
4692
|
animatedLayoutConfig = {};
|
|
@@ -4610,6 +4699,7 @@ var ne = (e, t) => {
|
|
|
4610
4699
|
hasBackground = !1;
|
|
4611
4700
|
hasUserConnectablePorts = !1;
|
|
4612
4701
|
hasUserDraggableEdges = !1;
|
|
4702
|
+
hasRectangularSelection = !1;
|
|
4613
4703
|
hasAnimatedLayout = !1;
|
|
4614
4704
|
hasLayout = !1;
|
|
4615
4705
|
boxRenderingTrigger = new l();
|
|
@@ -4644,6 +4734,9 @@ var ne = (e, t) => {
|
|
|
4644
4734
|
enableUserDraggableEdges(e) {
|
|
4645
4735
|
return this.hasUserDraggableEdges = !0, this.draggableEdgesConfig = e ?? {}, this;
|
|
4646
4736
|
}
|
|
4737
|
+
enableRectangularSelection(e) {
|
|
4738
|
+
return this.hasRectangularSelection = !0, this.rectangularSelectionConfig = e, this;
|
|
4739
|
+
}
|
|
4647
4740
|
enableLayout(e) {
|
|
4648
4741
|
return this.layoutConfig = e ?? {}, this.hasLayout = !0, this.hasAnimatedLayout = !1, this;
|
|
4649
4742
|
}
|
|
@@ -4660,40 +4753,40 @@ var ne = (e, t) => {
|
|
|
4660
4753
|
return this.userSelectableCanvasConfig = e, this;
|
|
4661
4754
|
}
|
|
4662
4755
|
build() {
|
|
4663
|
-
if (this.used) throw new
|
|
4756
|
+
if (this.used) throw new Wt("Failed to build Canvas because CanvasBuilder is a single-use object");
|
|
4664
4757
|
this.used = !0;
|
|
4665
|
-
let e = new y(this.element), t = new h(), n = new
|
|
4758
|
+
let e = new y(this.element), t = new h(), n = new Tt(this.element), r = this.createHtmlView(n.main, t, e), i = An(this.canvasDefaults), a = new Ue(t, r, i), o = Sn(this.layoutConfig), s = new Ye(t, e, Mn({
|
|
4666
4759
|
canvasDefaults: this.canvasDefaults,
|
|
4667
4760
|
hasLayout: this.hasLayout,
|
|
4668
4761
|
layoutParams: o
|
|
4669
4762
|
}), this.window), c = new Ge(e), l = new d(new He(t), c, a, s);
|
|
4670
|
-
if (this.hasBackground && st.configure(l,
|
|
4671
|
-
let e =
|
|
4763
|
+
if (this.hasBackground && st.configure(l, Lt(this.backgroundConfig), n.background), this.hasNodeResizeReactiveEdges && b.configure(l), this.userSelectableEdgesConfig !== void 0) {
|
|
4764
|
+
let e = Fn(this.userSelectableEdgesConfig);
|
|
4672
4765
|
vt.configure(l, this.window, this.pointInsideVerifier, this.eventTagger, e);
|
|
4673
4766
|
}
|
|
4674
4767
|
if (this.userSelectableNodesConfig !== void 0) {
|
|
4675
|
-
let e =
|
|
4768
|
+
let e = Nn(this.userSelectableNodesConfig);
|
|
4676
4769
|
_t.configure(l, this.window, this.pointInsideVerifier, this.eventTagger, e);
|
|
4677
4770
|
}
|
|
4678
4771
|
if (this.userSelectableCanvasConfig !== void 0) {
|
|
4679
|
-
let e =
|
|
4772
|
+
let e = Pn(this.userSelectableCanvasConfig);
|
|
4680
4773
|
yt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, e);
|
|
4681
4774
|
}
|
|
4682
4775
|
if (this.hasDraggableNodes) {
|
|
4683
|
-
let e =
|
|
4684
|
-
this.hasAnimatedLayout && (e =
|
|
4776
|
+
let e = kt(this.dragConfig);
|
|
4777
|
+
this.hasAnimatedLayout && (e = Cn(e, this.animationStaticNodes)), tt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, e);
|
|
4685
4778
|
}
|
|
4686
4779
|
if (this.hasUserConnectablePorts) {
|
|
4687
|
-
let t =
|
|
4780
|
+
let t = zt(this.connectablePortsConfig, i.edges.shapeFactory, l.graph);
|
|
4688
4781
|
ct.configure(l, n.overlayConnectablePorts, e, this.window, this.pointInsideVerifier, this.eventTagger, t);
|
|
4689
4782
|
}
|
|
4690
4783
|
if (this.hasUserDraggableEdges) {
|
|
4691
|
-
let t =
|
|
4784
|
+
let t = Vt(this.draggableEdgesConfig, l.graph);
|
|
4692
4785
|
lt.configure(l, n.overlayDraggableEdges, e, this.window, this.pointInsideVerifier, this.eventTagger, t);
|
|
4693
4786
|
}
|
|
4694
|
-
if (this.virtualScrollConfig === void 0 ? this.hasTransformableViewport && nt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger,
|
|
4695
|
-
let e =
|
|
4696
|
-
this.hasDraggableNodes && (
|
|
4787
|
+
if (this.virtualScrollConfig === void 0 ? this.hasTransformableViewport && nt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, Pt(this.transformConfig)) : rt.configure(l, n.main, this.window, Pt(this.transformConfig), this.boxRenderingTrigger, this.pointInsideVerifier, this.eventTagger, Ht(this.virtualScrollConfig)), this.hasRectangularSelection && St.configure(l, n.main, n.overlayRectangularSelection, this.pointInsideVerifier, this.eventTagger, this.window, Ln(this.rectangularSelectionConfig)), this.hasLayout && pt.configure(l, o), this.hasAnimatedLayout) {
|
|
4788
|
+
let e = mn(this.animatedLayoutConfig);
|
|
4789
|
+
this.hasDraggableNodes && (wn(l, this.animationStaticNodes), e = Tn(e, this.animationStaticNodes)), gt.configure(l, e, this.window);
|
|
4697
4790
|
}
|
|
4698
4791
|
return l.onBeforeDestroy.subscribe(() => {
|
|
4699
4792
|
n.destroy();
|
|
@@ -4701,8 +4794,8 @@ var ne = (e, t) => {
|
|
|
4701
4794
|
}
|
|
4702
4795
|
createHtmlView(e, t, n) {
|
|
4703
4796
|
let r = new a(t, n, e);
|
|
4704
|
-
return this.virtualScrollConfig !== void 0 && (r = new s(r, t, this.boxRenderingTrigger,
|
|
4797
|
+
return this.virtualScrollConfig !== void 0 && (r = new s(r, t, this.boxRenderingTrigger, Ut(this.virtualScrollConfig))), r = new c(r, t), r;
|
|
4705
4798
|
}
|
|
4706
4799
|
};
|
|
4707
4800
|
//#endregion
|
|
4708
|
-
export { ke as BezierEdgeShape,
|
|
4801
|
+
export { ke as BezierEdgeShape, Rn as CanvasBuilder, Wt as CanvasBuilderError, p as CanvasError, e as ConnectionCategory, R as DirectEdgeShape, l as EventSubject, ze as InteractiveEdgeError, Be as InteractiveEdgeShape, Ve as MidpointEdgeShape, Me as OrthogonalEdgeShape, Ae as StraightEdgeShape };
|