@html-graph/html-graph 8.7.3 → 8.8.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.js +484 -436
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/html-graph.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var i = (r, e, t) =>
|
|
4
|
-
var
|
|
5
|
-
const
|
|
1
|
+
var Qe = Object.defineProperty;
|
|
2
|
+
var Ze = (r, e, t) => e in r ? Qe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var i = (r, e, t) => Ze(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
var R = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(R || {});
|
|
5
|
+
const _e = () => {
|
|
6
6
|
const r = document.createElement("div");
|
|
7
7
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r.style.overflow = "hidden", r;
|
|
8
|
-
},
|
|
8
|
+
}, qe = () => {
|
|
9
9
|
const r = document.createElement("div");
|
|
10
10
|
return r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.width = "0", r.style.height = "0", r;
|
|
11
|
-
}, _e = (r) => {
|
|
12
|
-
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
13
11
|
}, et = (r) => {
|
|
12
|
+
r.style.position = "absolute", r.style.top = "0", r.style.left = "0", r.style.visibility = "hidden";
|
|
13
|
+
}, tt = (r) => {
|
|
14
14
|
r.style.removeProperty("position"), r.style.removeProperty("top"), r.style.removeProperty("left"), r.style.removeProperty("visibility"), r.style.removeProperty("transform");
|
|
15
15
|
};
|
|
16
|
-
class
|
|
16
|
+
class Se {
|
|
17
17
|
constructor(e, t, s) {
|
|
18
|
-
i(this, "host",
|
|
19
|
-
i(this, "container",
|
|
18
|
+
i(this, "host", _e());
|
|
19
|
+
i(this, "container", qe());
|
|
20
20
|
i(this, "edgeIdToElementMap", /* @__PURE__ */ new Map());
|
|
21
21
|
i(this, "attachedNodeIds", /* @__PURE__ */ new Set());
|
|
22
22
|
i(this, "applyTransform", () => {
|
|
@@ -27,11 +27,11 @@ class Ee {
|
|
|
27
27
|
}
|
|
28
28
|
attachNode(e) {
|
|
29
29
|
const t = this.graphStore.getNode(e);
|
|
30
|
-
|
|
30
|
+
et(t.element), this.attachedNodeIds.add(e), this.container.appendChild(t.element), this.updateNodePosition(e), this.updateNodePriority(e), t.element.style.visibility = "visible";
|
|
31
31
|
}
|
|
32
32
|
detachNode(e) {
|
|
33
33
|
const t = this.graphStore.getNode(e);
|
|
34
|
-
|
|
34
|
+
tt(t.element), this.container.removeChild(t.element), this.attachedNodeIds.delete(e);
|
|
35
35
|
}
|
|
36
36
|
attachEdge(e) {
|
|
37
37
|
const t = this.graphStore.getEdge(e).payload.shape.svg;
|
|
@@ -72,8 +72,8 @@ class Ee {
|
|
|
72
72
|
h,
|
|
73
73
|
d
|
|
74
74
|
), g = this.createEdgeRenderPort(o, a, h, d);
|
|
75
|
-
let l =
|
|
76
|
-
s.element === o.element ? l =
|
|
75
|
+
let l = R.Line;
|
|
76
|
+
s.element === o.element ? l = R.PortCycle : s.nodeId === o.nodeId && (l = R.NodeCycle), t.payload.shape.render({ from: c, to: g, category: l });
|
|
77
77
|
}
|
|
78
78
|
updateEdgePriority(e) {
|
|
79
79
|
const t = this.graphStore.getEdge(e);
|
|
@@ -93,7 +93,7 @@ class Ee {
|
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
class
|
|
96
|
+
class rt {
|
|
97
97
|
constructor(e) {
|
|
98
98
|
i(this, "xFrom", 1 / 0);
|
|
99
99
|
i(this, "yFrom", 1 / 0);
|
|
@@ -113,7 +113,7 @@ class tt {
|
|
|
113
113
|
return h <= this.xTo && d >= this.xFrom && c <= this.yTo && g >= this.yFrom;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
class
|
|
116
|
+
class st {
|
|
117
117
|
constructor(e, t, s, o) {
|
|
118
118
|
i(this, "attachedNodes", /* @__PURE__ */ new Set());
|
|
119
119
|
i(this, "attachedEdges", /* @__PURE__ */ new Set());
|
|
@@ -137,7 +137,7 @@ class rt {
|
|
|
137
137
|
this.handleAttachEdge(a);
|
|
138
138
|
});
|
|
139
139
|
});
|
|
140
|
-
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = o, this.renderingBox = new
|
|
140
|
+
this.htmlView = e, this.graphStore = t, this.trigger = s, this.params = o, this.renderingBox = new rt(this.graphStore), this.trigger.subscribe(this.updateViewport);
|
|
141
141
|
}
|
|
142
142
|
attachNode(e) {
|
|
143
143
|
this.renderingBox.hasNode(e) && this.handleAttachNode(e);
|
|
@@ -191,7 +191,7 @@ class rt {
|
|
|
191
191
|
this.htmlView.detachEdge(e), this.attachedEdges.delete(e);
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
class
|
|
194
|
+
class ot {
|
|
195
195
|
constructor(e, t) {
|
|
196
196
|
i(this, "deferredNodes", /* @__PURE__ */ new Set());
|
|
197
197
|
i(this, "deferredEdges", /* @__PURE__ */ new Set());
|
|
@@ -245,7 +245,7 @@ class st {
|
|
|
245
245
|
this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
class
|
|
248
|
+
class Q {
|
|
249
249
|
constructor() {
|
|
250
250
|
i(this, "callbacks", /* @__PURE__ */ new Set());
|
|
251
251
|
}
|
|
@@ -261,16 +261,16 @@ class K {
|
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
|
-
const
|
|
265
|
-
const r = new
|
|
264
|
+
const b = () => {
|
|
265
|
+
const r = new Q();
|
|
266
266
|
return [r, r];
|
|
267
267
|
};
|
|
268
|
-
class
|
|
268
|
+
class be {
|
|
269
269
|
constructor(e, t, s, o) {
|
|
270
270
|
i(this, "beforeDestroyEmitter");
|
|
271
271
|
i(this, "destroyed", !1);
|
|
272
272
|
i(this, "onBeforeDestroy");
|
|
273
|
-
this.graph = e, this.viewport = t, this.graphController = s, this.viewportController = o, [this.beforeDestroyEmitter, this.onBeforeDestroy] =
|
|
273
|
+
this.graph = e, this.viewport = t, this.graphController = s, this.viewportController = o, [this.beforeDestroyEmitter, this.onBeforeDestroy] = b();
|
|
274
274
|
}
|
|
275
275
|
addNode(e) {
|
|
276
276
|
return this.graphController.addNode(e), this;
|
|
@@ -318,7 +318,7 @@ class Se {
|
|
|
318
318
|
this.destroyed || (this.destroyed = !0, this.beforeDestroyEmitter.emit(), this.graphController.destroy(), this.viewportController.destroy());
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
class
|
|
321
|
+
class it {
|
|
322
322
|
constructor() {
|
|
323
323
|
i(this, "singleToMultiMap", /* @__PURE__ */ new Map());
|
|
324
324
|
i(this, "multiToSingleMap", /* @__PURE__ */ new Map());
|
|
@@ -358,13 +358,35 @@ class ot {
|
|
|
358
358
|
return this.multiToSingleMap.get(e) !== void 0;
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
class
|
|
361
|
+
class A extends Error {
|
|
362
362
|
constructor() {
|
|
363
363
|
super(...arguments);
|
|
364
364
|
i(this, "name", "CanvasError");
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
|
-
|
|
367
|
+
const E = Object.freeze({
|
|
368
|
+
accessNonexistingNode: (r) => `Failed to access node with ID ${JSON.stringify(r)} because it does not exist`,
|
|
369
|
+
addNodeWithExistingId: (r) => `Failed to add node with ID ${JSON.stringify(r)} because a node with this ID already exists`,
|
|
370
|
+
addNodeWithElementInUse: (r, e) => `Failed to add node with ID ${JSON.stringify(r)} because its HTML element is already attached to node with ID ${JSON.stringify(e)}`,
|
|
371
|
+
updateNonexistentNode: (r) => `Failed to update node with ID ${JSON.stringify(r)} because it does not exist`,
|
|
372
|
+
removeNonexistentNode: (r) => `Failed to remove node with ID ${JSON.stringify(r)} because it does not exist`,
|
|
373
|
+
accessNonexistentPort: (r) => `Failed to access port with ID ${JSON.stringify(r)} because it does not exist`,
|
|
374
|
+
addPortWithExistingId: (r) => `Failed to add port with ID ${JSON.stringify(r)} because a port with this ID already exists`,
|
|
375
|
+
addPortToNonexistentNode: (r, e) => `Failed to add port with ID ${JSON.stringify(r)} to node with ID ${JSON.stringify(e)} because the node does not exist`,
|
|
376
|
+
updateNonexistentPort: (r) => `Failed to update port with ID ${JSON.stringify(r)} because it does not exist`,
|
|
377
|
+
accessPortsOfNonexistentNode: (r) => `Failed to access ports of node with ID ${JSON.stringify(r)} because the node does not exist`,
|
|
378
|
+
removeNonexistentPort: (r) => `Failed to remove port with ID ${JSON.stringify(r)} because it does not exist`,
|
|
379
|
+
accessNonexistentEdge: (r) => `Failed to access edge with ID ${JSON.stringify(r)} because it does not exist`,
|
|
380
|
+
addEdgeWithExistingId: (r) => `Failed to add edge with ID ${JSON.stringify(r)} because an edge with this ID already exists`,
|
|
381
|
+
addEdgeFromNonexistentPort: (r, e) => `Failed to add edge with ID ${JSON.stringify(r)} from port with ID ${JSON.stringify(e)} because the port does not exist`,
|
|
382
|
+
addEdgeToNonexistentPort: (r, e) => `Failed to add edge with ID ${JSON.stringify(r)} to port with ID ${JSON.stringify(e)} because the port does not exist`,
|
|
383
|
+
updateNonexistentEdge: (r) => `Failed to update edge with ID ${JSON.stringify(r)} because it does not exist`,
|
|
384
|
+
updateNonexistentEdgeSource: (r, e) => `Failed to update source of edge with ID ${JSON.stringify(r)} because source port with ID ${JSON.stringify(e)} does not exist`,
|
|
385
|
+
updateNonexistentEdgeTarget: (r, e) => `Failed to update target of edge with ID ${JSON.stringify(r)} because target port with ID ${JSON.stringify(e)} does not exist`,
|
|
386
|
+
removeNonexistentEdge: (r) => `Failed to remove edge with ID ${JSON.stringify(r)} because it does not exist`,
|
|
387
|
+
accessEdgesForNonexistentPort: (r) => `Failed to access edges for port with ID ${JSON.stringify(r)} because the port does not exist`
|
|
388
|
+
});
|
|
389
|
+
class Ne {
|
|
368
390
|
constructor() {
|
|
369
391
|
i(this, "nodes", /* @__PURE__ */ new Map());
|
|
370
392
|
i(this, "ports", /* @__PURE__ */ new Map());
|
|
@@ -373,7 +395,7 @@ class be {
|
|
|
373
395
|
i(this, "portIncomingEdges", /* @__PURE__ */ new Map());
|
|
374
396
|
i(this, "portOutgoingEdges", /* @__PURE__ */ new Map());
|
|
375
397
|
i(this, "portCycleEdges", /* @__PURE__ */ new Map());
|
|
376
|
-
i(this, "elementPorts", new
|
|
398
|
+
i(this, "elementPorts", new it());
|
|
377
399
|
i(this, "afterNodeAddedEmitter");
|
|
378
400
|
i(this, "onAfterNodeAdded");
|
|
379
401
|
i(this, "afterNodeUpdatedEmitter");
|
|
@@ -400,7 +422,7 @@ class be {
|
|
|
400
422
|
i(this, "onBeforeEdgeRemoved");
|
|
401
423
|
i(this, "beforeClearEmitter");
|
|
402
424
|
i(this, "onBeforeClear");
|
|
403
|
-
[this.afterNodeAddedEmitter, this.onAfterNodeAdded] =
|
|
425
|
+
[this.afterNodeAddedEmitter, this.onAfterNodeAdded] = b(), [this.afterNodeUpdatedEmitter, this.onAfterNodeUpdated] = b(), [this.afterNodePriorityUpdatedEmitter, this.onAfterNodePriorityUpdated] = b(), [this.beforeNodeRemovedEmitter, this.onBeforeNodeRemoved] = b(), [this.afterPortAddedEmitter, this.onAfterPortAdded] = b(), [this.afterPortUpdatedEmitter, this.onAfterPortUpdated] = b(), [this.beforePortRemovedEmitter, this.onBeforePortRemoved] = b(), [this.afterEdgeAddedEmitter, this.onAfterEdgeAdded] = b(), [this.afterEdgeShapeUpdatedEmitter, this.onAfterEdgeShapeUpdated] = b(), [this.afterEdgeUpdatedEmitter, this.onAfterEdgeUpdated] = b(), [this.afterEdgePriorityUpdatedEmitter, this.onAfterEdgePriorityUpdated] = b(), [this.beforeEdgeRemovedEmitter, this.onBeforeEdgeRemoved] = b(), [this.beforeClearEmitter, this.onBeforeClear] = b();
|
|
404
426
|
}
|
|
405
427
|
hasNode(e) {
|
|
406
428
|
return this.nodes.has(e);
|
|
@@ -408,17 +430,18 @@ class be {
|
|
|
408
430
|
getNode(e) {
|
|
409
431
|
const t = this.nodes.get(e);
|
|
410
432
|
if (t === void 0)
|
|
411
|
-
throw new
|
|
433
|
+
throw new A(E.accessNonexistingNode(e));
|
|
412
434
|
return t;
|
|
413
435
|
}
|
|
414
436
|
addNode(e) {
|
|
415
437
|
if (this.hasNode(e.id))
|
|
416
|
-
throw new
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
438
|
+
throw new A(E.addNodeWithExistingId(e.id));
|
|
439
|
+
const t = this.findNodeIdByElement(e.element);
|
|
440
|
+
if (t !== void 0)
|
|
441
|
+
throw new A(
|
|
442
|
+
E.addNodeWithElementInUse(e.id, t)
|
|
420
443
|
);
|
|
421
|
-
const
|
|
444
|
+
const s = /* @__PURE__ */ new Map(), o = {
|
|
422
445
|
element: e.element,
|
|
423
446
|
payload: {
|
|
424
447
|
x: e.x,
|
|
@@ -426,9 +449,9 @@ class be {
|
|
|
426
449
|
centerFn: e.centerFn,
|
|
427
450
|
priority: e.priority
|
|
428
451
|
},
|
|
429
|
-
ports:
|
|
452
|
+
ports: s
|
|
430
453
|
};
|
|
431
|
-
this.nodes.set(e.id,
|
|
454
|
+
this.nodes.set(e.id, o), this.nodesElementsMap.set(e.element, e.id), this.afterNodeAddedEmitter.emit(e.id);
|
|
432
455
|
}
|
|
433
456
|
getAllNodeIds() {
|
|
434
457
|
return Array.from(this.nodes.keys());
|
|
@@ -438,15 +461,15 @@ class be {
|
|
|
438
461
|
}
|
|
439
462
|
updateNode(e, t) {
|
|
440
463
|
if (!this.hasNode(e))
|
|
441
|
-
throw new
|
|
464
|
+
throw new A(E.updateNonexistentNode(e));
|
|
442
465
|
const { payload: s } = this.nodes.get(e);
|
|
443
466
|
s.x = t.x ?? s.x, s.y = t.y ?? s.y, s.centerFn = t.centerFn ?? s.centerFn, t.priority !== void 0 && (s.priority = t.priority, this.afterNodePriorityUpdatedEmitter.emit(e)), this.afterNodeUpdatedEmitter.emit(e);
|
|
444
467
|
}
|
|
445
468
|
removeNode(e) {
|
|
446
469
|
if (!this.hasNode(e))
|
|
447
|
-
throw new
|
|
470
|
+
throw new A(E.removeNonexistentNode(e));
|
|
448
471
|
this.beforeNodeRemovedEmitter.emit(e);
|
|
449
|
-
const t = this.
|
|
472
|
+
const t = this.getNode(e);
|
|
450
473
|
this.nodesElementsMap.delete(t.element), this.nodes.delete(e);
|
|
451
474
|
}
|
|
452
475
|
hasPort(e) {
|
|
@@ -455,26 +478,28 @@ class be {
|
|
|
455
478
|
getPort(e) {
|
|
456
479
|
const t = this.ports.get(e);
|
|
457
480
|
if (t === void 0)
|
|
458
|
-
throw new
|
|
481
|
+
throw new A(E.accessNonexistentPort(e));
|
|
459
482
|
return t;
|
|
460
483
|
}
|
|
461
484
|
addPort(e) {
|
|
462
485
|
if (this.hasPort(e.id))
|
|
463
|
-
throw new
|
|
486
|
+
throw new A(E.addPortWithExistingId(e.id));
|
|
464
487
|
if (!this.hasNode(e.nodeId))
|
|
465
|
-
throw new
|
|
488
|
+
throw new A(
|
|
489
|
+
E.addPortToNonexistentNode(e.id, e.nodeId)
|
|
490
|
+
);
|
|
466
491
|
this.ports.set(e.id, {
|
|
467
492
|
element: e.element,
|
|
468
493
|
payload: {
|
|
469
494
|
direction: e.direction
|
|
470
495
|
},
|
|
471
496
|
nodeId: e.nodeId
|
|
472
|
-
}), this.elementPorts.addRecord(e.element, e.id), this.portCycleEdges.set(e.id, /* @__PURE__ */ new Set()), this.portIncomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.portOutgoingEdges.set(e.id, /* @__PURE__ */ new Set()), this.
|
|
497
|
+
}), this.elementPorts.addRecord(e.element, e.id), this.portCycleEdges.set(e.id, /* @__PURE__ */ new Set()), this.portIncomingEdges.set(e.id, /* @__PURE__ */ new Set()), this.portOutgoingEdges.set(e.id, /* @__PURE__ */ new Set()), this.getNode(e.nodeId).ports.set(e.id, e.element), this.afterPortAddedEmitter.emit(e.id);
|
|
473
498
|
}
|
|
474
499
|
updatePort(e, t) {
|
|
475
500
|
if (!this.hasPort(e))
|
|
476
|
-
throw new
|
|
477
|
-
const s = this.
|
|
501
|
+
throw new A(E.updateNonexistentPort(e));
|
|
502
|
+
const s = this.getPort(e).payload;
|
|
478
503
|
s.direction = t.direction ?? s.direction, this.afterPortUpdatedEmitter.emit(e);
|
|
479
504
|
}
|
|
480
505
|
getAllPortIds() {
|
|
@@ -486,14 +511,16 @@ class be {
|
|
|
486
511
|
getNodePortIds(e) {
|
|
487
512
|
const t = this.nodes.get(e);
|
|
488
513
|
if (t === void 0)
|
|
489
|
-
throw new
|
|
514
|
+
throw new A(
|
|
515
|
+
E.accessPortsOfNonexistentNode(e)
|
|
516
|
+
);
|
|
490
517
|
return Array.from(t.ports.keys());
|
|
491
518
|
}
|
|
492
519
|
removePort(e) {
|
|
493
520
|
if (!this.hasPort(e))
|
|
494
|
-
throw new
|
|
495
|
-
const t = this.
|
|
496
|
-
this.beforePortRemovedEmitter.emit(e), this.
|
|
521
|
+
throw new A(E.removeNonexistentPort(e));
|
|
522
|
+
const t = this.getPort(e).nodeId;
|
|
523
|
+
this.beforePortRemovedEmitter.emit(e), this.getNode(t).ports.delete(e), this.ports.delete(e), this.elementPorts.removeByMulti(e);
|
|
497
524
|
}
|
|
498
525
|
hasEdge(e) {
|
|
499
526
|
return this.edges.has(e);
|
|
@@ -501,23 +528,35 @@ class be {
|
|
|
501
528
|
getEdge(e) {
|
|
502
529
|
const t = this.edges.get(e);
|
|
503
530
|
if (t === void 0)
|
|
504
|
-
throw new
|
|
531
|
+
throw new A(E.accessNonexistentEdge(e));
|
|
505
532
|
return t;
|
|
506
533
|
}
|
|
507
534
|
addEdge(e) {
|
|
508
535
|
if (this.hasEdge(e.id))
|
|
509
|
-
throw new
|
|
536
|
+
throw new A(E.addEdgeWithExistingId(e.id));
|
|
510
537
|
if (!this.hasPort(e.from))
|
|
511
|
-
throw new
|
|
538
|
+
throw new A(
|
|
539
|
+
E.addEdgeFromNonexistentPort(e.id, e.from)
|
|
540
|
+
);
|
|
512
541
|
if (!this.hasPort(e.to))
|
|
513
|
-
throw new
|
|
542
|
+
throw new A(
|
|
543
|
+
E.addEdgeToNonexistentPort(e.id, e.to)
|
|
544
|
+
);
|
|
514
545
|
this.addEdgeInternal(e), this.afterEdgeAddedEmitter.emit(e.id);
|
|
515
546
|
}
|
|
516
547
|
updateEdge(e, t) {
|
|
517
548
|
if (!this.hasEdge(e))
|
|
518
|
-
throw new
|
|
549
|
+
throw new A(E.updateNonexistentEdge(e));
|
|
519
550
|
if (t.from !== void 0 || t.to !== void 0) {
|
|
520
|
-
|
|
551
|
+
if (t.from !== void 0 && !this.hasPort(t.from))
|
|
552
|
+
throw new A(
|
|
553
|
+
E.updateNonexistentEdgeSource(e, t.from)
|
|
554
|
+
);
|
|
555
|
+
if (t.to !== void 0 && !this.hasPort(t.to))
|
|
556
|
+
throw new A(
|
|
557
|
+
E.updateNonexistentEdgeTarget(e, t.to)
|
|
558
|
+
);
|
|
559
|
+
const o = this.getEdge(e), n = o.payload;
|
|
521
560
|
this.removeEdgeInternal(e), this.addEdgeInternal({
|
|
522
561
|
id: e,
|
|
523
562
|
from: t.from ?? o.from,
|
|
@@ -534,7 +573,7 @@ class be {
|
|
|
534
573
|
}
|
|
535
574
|
removeEdge(e) {
|
|
536
575
|
if (!this.hasEdge(e))
|
|
537
|
-
throw new
|
|
576
|
+
throw new A(E.removeNonexistentEdge(e));
|
|
538
577
|
this.beforeEdgeRemovedEmitter.emit(e), this.removeEdgeInternal(e);
|
|
539
578
|
}
|
|
540
579
|
clear() {
|
|
@@ -543,19 +582,25 @@ class be {
|
|
|
543
582
|
getPortIncomingEdgeIds(e) {
|
|
544
583
|
const t = this.portIncomingEdges.get(e);
|
|
545
584
|
if (t === void 0)
|
|
546
|
-
throw new
|
|
585
|
+
throw new A(
|
|
586
|
+
E.accessEdgesForNonexistentPort(e)
|
|
587
|
+
);
|
|
547
588
|
return Array.from(t);
|
|
548
589
|
}
|
|
549
590
|
getPortOutgoingEdgeIds(e) {
|
|
550
591
|
const t = this.portOutgoingEdges.get(e);
|
|
551
592
|
if (t === void 0)
|
|
552
|
-
throw new
|
|
593
|
+
throw new A(
|
|
594
|
+
E.accessEdgesForNonexistentPort(e)
|
|
595
|
+
);
|
|
553
596
|
return Array.from(t);
|
|
554
597
|
}
|
|
555
598
|
getPortCycleEdgeIds(e) {
|
|
556
599
|
const t = this.portCycleEdges.get(e);
|
|
557
600
|
if (t === void 0)
|
|
558
|
-
throw new
|
|
601
|
+
throw new A(
|
|
602
|
+
E.accessEdgesForNonexistentPort(e)
|
|
603
|
+
);
|
|
559
604
|
return Array.from(t);
|
|
560
605
|
}
|
|
561
606
|
getPortAdjacentEdgeIds(e) {
|
|
@@ -623,26 +668,26 @@ class be {
|
|
|
623
668
|
}), e.from !== e.to ? (this.portOutgoingEdges.get(e.from).add(e.id), this.portIncomingEdges.get(e.to).add(e.id)) : this.portCycleEdges.get(e.from).add(e.id);
|
|
624
669
|
}
|
|
625
670
|
removeEdgeInternal(e) {
|
|
626
|
-
const
|
|
627
|
-
this.portCycleEdges.get(
|
|
671
|
+
const { from: t, to: s } = this.getEdge(e);
|
|
672
|
+
this.portCycleEdges.get(t).delete(e), this.portCycleEdges.get(s).delete(e), this.portIncomingEdges.get(t).delete(e), this.portIncomingEdges.get(s).delete(e), this.portOutgoingEdges.get(t).delete(e), this.portOutgoingEdges.get(s).delete(e), this.edges.delete(e);
|
|
628
673
|
}
|
|
629
674
|
}
|
|
630
|
-
const
|
|
675
|
+
const pe = (r) => ({
|
|
631
676
|
scale: 1 / r.scale,
|
|
632
677
|
x: -r.x / r.scale,
|
|
633
678
|
y: -r.y / r.scale
|
|
634
|
-
}),
|
|
679
|
+
}), we = {
|
|
635
680
|
scale: 1,
|
|
636
681
|
x: 0,
|
|
637
682
|
y: 0
|
|
638
|
-
},
|
|
683
|
+
}, ye = (r, e) => ({
|
|
639
684
|
x: r.scale * e.x + r.x,
|
|
640
685
|
y: r.scale * e.y + r.y
|
|
641
686
|
});
|
|
642
|
-
class
|
|
687
|
+
class nt {
|
|
643
688
|
constructor(e) {
|
|
644
|
-
i(this, "viewportMatrix",
|
|
645
|
-
i(this, "contentMatrix",
|
|
689
|
+
i(this, "viewportMatrix", we);
|
|
690
|
+
i(this, "contentMatrix", we);
|
|
646
691
|
i(this, "beforeUpdateEmitter");
|
|
647
692
|
i(this, "onBeforeUpdated");
|
|
648
693
|
i(this, "afterUpdateEmitter");
|
|
@@ -652,7 +697,7 @@ class it {
|
|
|
652
697
|
i(this, "observer", new ResizeObserver(() => {
|
|
653
698
|
this.afterResizeEmitter.emit();
|
|
654
699
|
}));
|
|
655
|
-
this.host = e, [this.afterUpdateEmitter, this.onAfterUpdated] =
|
|
700
|
+
this.host = e, [this.afterUpdateEmitter, this.onAfterUpdated] = b(), [this.beforeUpdateEmitter, this.onBeforeUpdated] = b(), [this.afterResizeEmitter, this.onAfterResize] = b(), this.observer.observe(this.host);
|
|
656
701
|
}
|
|
657
702
|
getViewportMatrix() {
|
|
658
703
|
return this.viewportMatrix;
|
|
@@ -665,30 +710,30 @@ class it {
|
|
|
665
710
|
scale: e.scale ?? this.viewportMatrix.scale,
|
|
666
711
|
x: e.x ?? this.viewportMatrix.x,
|
|
667
712
|
y: e.y ?? this.viewportMatrix.y
|
|
668
|
-
}, this.beforeUpdateEmitter.emit(), this.contentMatrix =
|
|
713
|
+
}, this.beforeUpdateEmitter.emit(), this.contentMatrix = pe(this.viewportMatrix), this.afterUpdateEmitter.emit();
|
|
669
714
|
}
|
|
670
715
|
patchContentMatrix(e) {
|
|
671
716
|
this.contentMatrix = {
|
|
672
717
|
scale: e.scale ?? this.contentMatrix.scale,
|
|
673
718
|
x: e.x ?? this.contentMatrix.x,
|
|
674
719
|
y: e.y ?? this.contentMatrix.y
|
|
675
|
-
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix =
|
|
720
|
+
}, this.beforeUpdateEmitter.emit(), this.viewportMatrix = pe(this.contentMatrix), this.afterUpdateEmitter.emit();
|
|
676
721
|
}
|
|
677
722
|
getDimensions() {
|
|
678
723
|
const { width: e, height: t } = this.host.getBoundingClientRect();
|
|
679
724
|
return { width: e, height: t };
|
|
680
725
|
}
|
|
681
726
|
createContentCoords(e) {
|
|
682
|
-
return
|
|
727
|
+
return ye(this.viewportMatrix, e);
|
|
683
728
|
}
|
|
684
729
|
createViewportCoords(e) {
|
|
685
|
-
return
|
|
730
|
+
return ye(this.contentMatrix, e);
|
|
686
731
|
}
|
|
687
732
|
destroy() {
|
|
688
733
|
this.observer.disconnect();
|
|
689
734
|
}
|
|
690
735
|
}
|
|
691
|
-
class
|
|
736
|
+
class Z {
|
|
692
737
|
constructor(e) {
|
|
693
738
|
i(this, "elementToNodeId", /* @__PURE__ */ new Map());
|
|
694
739
|
i(this, "nodesResizeObserver");
|
|
@@ -714,19 +759,19 @@ class Q {
|
|
|
714
759
|
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
715
760
|
}
|
|
716
761
|
static configure(e) {
|
|
717
|
-
new
|
|
762
|
+
new Z(e);
|
|
718
763
|
}
|
|
719
764
|
handleNodeResize(e) {
|
|
720
765
|
const t = this.elementToNodeId.get(e);
|
|
721
766
|
this.canvas.updateNode(t);
|
|
722
767
|
}
|
|
723
768
|
}
|
|
724
|
-
const
|
|
769
|
+
const at = (r, e, t) => {
|
|
725
770
|
const { x: s, y: o, width: n, height: a } = r.getBoundingClientRect();
|
|
726
771
|
return e >= s && e <= s + n && t >= o && t <= o + a;
|
|
727
|
-
},
|
|
772
|
+
}, ht = (r, e, t) => e >= 0 && e <= r.innerWidth && t >= 0 && t <= r.innerHeight, L = (r, e, t, s) => at(e, t, s) && ht(r, t, s), O = (r, e) => {
|
|
728
773
|
e !== null ? r.style.cursor = e : r.style.removeProperty("cursor");
|
|
729
|
-
},
|
|
774
|
+
}, W = (r) => {
|
|
730
775
|
const e = document.createElement("div");
|
|
731
776
|
return {
|
|
732
777
|
id: r.overlayNodeId,
|
|
@@ -741,7 +786,7 @@ const nt = (r, e, t) => {
|
|
|
741
786
|
}
|
|
742
787
|
]
|
|
743
788
|
};
|
|
744
|
-
},
|
|
789
|
+
}, dt = (r, e) => {
|
|
745
790
|
let t = e;
|
|
746
791
|
for (; t !== null; ) {
|
|
747
792
|
const s = r.findPortIdsByElement(t)[0] ?? null;
|
|
@@ -774,7 +819,7 @@ function* Pe(r, e) {
|
|
|
774
819
|
const Ce = (r, e) => {
|
|
775
820
|
const t = Pe(document, e);
|
|
776
821
|
for (const s of t) {
|
|
777
|
-
const o =
|
|
822
|
+
const o = dt(r, s);
|
|
778
823
|
if (o.status === "portFound")
|
|
779
824
|
return o.portId;
|
|
780
825
|
if (o.status === "nodeEncountered")
|
|
@@ -783,7 +828,7 @@ const Ce = (r, e) => {
|
|
|
783
828
|
return null;
|
|
784
829
|
};
|
|
785
830
|
var C = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(C || {});
|
|
786
|
-
const
|
|
831
|
+
const Te = (r, e) => ({
|
|
787
832
|
x: r / 2,
|
|
788
833
|
y: e / 2
|
|
789
834
|
}), y = {
|
|
@@ -792,7 +837,7 @@ const Ne = (r, e) => ({
|
|
|
792
837
|
}, m = (r, e, t) => ({
|
|
793
838
|
x: e.x * r.x - e.y * r.y + ((1 - e.x) * t.x + e.y * t.y),
|
|
794
839
|
y: e.y * r.x + e.x * r.y + ((1 - e.x) * t.y - e.y * t.x)
|
|
795
|
-
}),
|
|
840
|
+
}), Me = (r, e) => {
|
|
796
841
|
const t = {
|
|
797
842
|
x: r.x + r.width / 2,
|
|
798
843
|
y: r.y + r.height / 2
|
|
@@ -808,11 +853,11 @@ const Ne = (r, e) => ({
|
|
|
808
853
|
flipX: d,
|
|
809
854
|
flipY: c
|
|
810
855
|
};
|
|
811
|
-
},
|
|
856
|
+
}, k = (r, e, t, s) => ({
|
|
812
857
|
x: e * r.x + (1 - e) / 2 * s.x,
|
|
813
858
|
y: t * r.y + (1 - t) / 2 * s.y
|
|
814
859
|
});
|
|
815
|
-
class
|
|
860
|
+
class ct {
|
|
816
861
|
constructor(e) {
|
|
817
862
|
i(this, "path");
|
|
818
863
|
i(this, "midpoint");
|
|
@@ -837,7 +882,7 @@ class dt {
|
|
|
837
882
|
this.path = `${d}${h}${c}`;
|
|
838
883
|
}
|
|
839
884
|
}
|
|
840
|
-
class
|
|
885
|
+
class lt {
|
|
841
886
|
constructor(e) {
|
|
842
887
|
i(this, "path");
|
|
843
888
|
i(this, "midpoint");
|
|
@@ -876,39 +921,39 @@ class ct {
|
|
|
876
921
|
}, v = {
|
|
877
922
|
x: l.x - this.params.curvature * this.params.targetDirection.x,
|
|
878
923
|
y: l.y - this.params.curvature * this.params.targetDirection.y
|
|
879
|
-
},
|
|
924
|
+
}, S = {
|
|
880
925
|
x: c.x + h,
|
|
881
926
|
y: c.y + d
|
|
882
|
-
},
|
|
927
|
+
}, N = {
|
|
883
928
|
x: l.x + h,
|
|
884
929
|
y: l.y + d
|
|
885
930
|
};
|
|
886
931
|
this.path = [
|
|
887
932
|
`M ${t.x} ${t.y}`,
|
|
888
933
|
`L ${c.x} ${c.y}`,
|
|
889
|
-
`C ${p.x} ${p.y} ${
|
|
890
|
-
`C ${
|
|
934
|
+
`C ${p.x} ${p.y} ${S.x} ${S.y} ${w.x} ${w.y}`,
|
|
935
|
+
`C ${N.x} ${N.y} ${v.x} ${v.y} ${l.x} ${l.y}`,
|
|
891
936
|
`L ${s.x} ${s.y}`
|
|
892
|
-
].join(" "), this.midpoint =
|
|
937
|
+
].join(" "), this.midpoint = k(w, e.flipX, e.flipY, e.to);
|
|
893
938
|
}
|
|
894
939
|
}
|
|
895
|
-
const
|
|
940
|
+
const _ = Object.freeze({
|
|
896
941
|
edgeColor: "--edge-color"
|
|
897
|
-
}),
|
|
942
|
+
}), De = (r) => {
|
|
898
943
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
899
|
-
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(
|
|
900
|
-
},
|
|
944
|
+
return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(_.edgeColor, r), e;
|
|
945
|
+
}, Re = (r) => {
|
|
901
946
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
902
|
-
return e.setAttribute("stroke", `var(${
|
|
903
|
-
},
|
|
947
|
+
return e.setAttribute("stroke", `var(${_.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
|
|
948
|
+
}, z = () => {
|
|
904
949
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
905
|
-
return r.setAttribute("fill", `var(${
|
|
906
|
-
},
|
|
950
|
+
return r.setAttribute("fill", `var(${_.edgeColor})`), r;
|
|
951
|
+
}, Le = () => {
|
|
907
952
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
908
953
|
return r.style.transformOrigin = "50% 50%", r;
|
|
909
|
-
},
|
|
954
|
+
}, Fe = (r, e) => {
|
|
910
955
|
r.style.transform = `translate(${e.x}px, ${e.y}px)`, r.style.width = `${Math.max(e.width, 1)}px`, r.style.height = `${Math.max(e.height, 1)}px`;
|
|
911
|
-
},
|
|
956
|
+
}, D = (r, e) => {
|
|
912
957
|
const t = [];
|
|
913
958
|
if (r.length > 0 && t.push(`M ${r[0].x} ${r[0].y}`), r.length === 2 && t.push(`L ${r[1].x} ${r[1].y}`), r.length > 2) {
|
|
914
959
|
const s = r.length - 1;
|
|
@@ -920,15 +965,15 @@ const Z = Object.freeze({
|
|
|
920
965
|
const V = r[d + 1];
|
|
921
966
|
o = V.x - h.x, n = V.y - h.y, a = Math.sqrt(o * o + n * n);
|
|
922
967
|
}
|
|
923
|
-
const
|
|
924
|
-
d > 0 && t.push(`L ${
|
|
925
|
-
`C ${h.x} ${h.y} ${h.x} ${h.y} ${
|
|
968
|
+
const S = a !== 0 ? Math.min((p ? e : 0) / a, d < s - 1 ? 0.5 : 1) : 0, N = p ? { x: h.x + o * S, y: h.y + n * S } : h, P = l !== 0 ? Math.min((p ? e : 0) / l, d > 1 ? 0.5 : 1) : 0, F = p ? { x: h.x + c * P, y: h.y + g * P } : h;
|
|
969
|
+
d > 0 && t.push(`L ${F.x} ${F.y}`), p && t.push(
|
|
970
|
+
`C ${h.x} ${h.y} ${h.x} ${h.y} ${N.x} ${N.y}`
|
|
926
971
|
);
|
|
927
972
|
});
|
|
928
973
|
}
|
|
929
974
|
return t.join(" ");
|
|
930
975
|
};
|
|
931
|
-
class
|
|
976
|
+
class gt {
|
|
932
977
|
constructor(e) {
|
|
933
978
|
i(this, "path");
|
|
934
979
|
i(this, "midpoint");
|
|
@@ -961,13 +1006,13 @@ class lt {
|
|
|
961
1006
|
x: this.params.flipX > 0 ? this.params.to.x - c : this.params.to.x + n,
|
|
962
1007
|
y: d.y
|
|
963
1008
|
}, p = { x: w.x, y: g };
|
|
964
|
-
this.path =
|
|
1009
|
+
this.path = D(
|
|
965
1010
|
[s, h, l, u, p, w, d, o],
|
|
966
1011
|
this.params.roundness
|
|
967
1012
|
);
|
|
968
1013
|
}
|
|
969
1014
|
}
|
|
970
|
-
class
|
|
1015
|
+
class ut {
|
|
971
1016
|
constructor(e) {
|
|
972
1017
|
i(this, "path");
|
|
973
1018
|
i(this, "midpoint");
|
|
@@ -992,13 +1037,13 @@ class gt {
|
|
|
992
1037
|
this.params.targetDirection,
|
|
993
1038
|
this.params.to
|
|
994
1039
|
), u = { x: l.x + d, y: l.y + c }, w = { x: (g.x + u.x) / 2, y: (g.y + u.y) / 2 };
|
|
995
|
-
this.midpoint =
|
|
1040
|
+
this.midpoint = k(w, e.flipX, e.flipY, e.to), this.path = D(
|
|
996
1041
|
[t, n, g, u, l, s],
|
|
997
1042
|
this.params.roundness
|
|
998
1043
|
);
|
|
999
1044
|
}
|
|
1000
1045
|
}
|
|
1001
|
-
class
|
|
1046
|
+
class pt {
|
|
1002
1047
|
constructor(e) {
|
|
1003
1048
|
i(this, "path");
|
|
1004
1049
|
i(this, "midpoint");
|
|
@@ -1025,10 +1070,10 @@ class ut {
|
|
|
1025
1070
|
this.params.targetDirection,
|
|
1026
1071
|
this.params.to
|
|
1027
1072
|
);
|
|
1028
|
-
this.path =
|
|
1073
|
+
this.path = D([s, a, h, o], this.params.roundness);
|
|
1029
1074
|
}
|
|
1030
1075
|
}
|
|
1031
|
-
class
|
|
1076
|
+
class wt {
|
|
1032
1077
|
constructor(e) {
|
|
1033
1078
|
i(this, "path");
|
|
1034
1079
|
i(this, "midpoint");
|
|
@@ -1061,13 +1106,13 @@ class pt {
|
|
|
1061
1106
|
x: d.x,
|
|
1062
1107
|
y: this.params.flipY > 0 ? this.params.to.y - c : this.params.to.y + n
|
|
1063
1108
|
}, p = { x: g, y: w.y };
|
|
1064
|
-
this.path =
|
|
1109
|
+
this.path = D(
|
|
1065
1110
|
[s, h, l, u, p, w, d, o],
|
|
1066
1111
|
this.params.roundness
|
|
1067
1112
|
);
|
|
1068
1113
|
}
|
|
1069
1114
|
}
|
|
1070
|
-
class
|
|
1115
|
+
class q {
|
|
1071
1116
|
constructor(e) {
|
|
1072
1117
|
i(this, "path");
|
|
1073
1118
|
i(this, "midpoint");
|
|
@@ -1084,10 +1129,10 @@ class J {
|
|
|
1084
1129
|
].map(
|
|
1085
1130
|
(c) => m(c, this.params.sourceDirection, y)
|
|
1086
1131
|
), d = `M ${y.x} ${y.y} L ${h[0].x} ${h[0].y} `;
|
|
1087
|
-
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${
|
|
1132
|
+
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : d}${D(h, this.params.roundness)}`, this.midpoint = { x: (h[3].x + h[4].x) / 2, y: (h[3].y + h[4].y) / 2 };
|
|
1088
1133
|
}
|
|
1089
1134
|
}
|
|
1090
|
-
class
|
|
1135
|
+
class yt {
|
|
1091
1136
|
constructor(e) {
|
|
1092
1137
|
i(this, "path");
|
|
1093
1138
|
i(this, "midpoint");
|
|
@@ -1108,7 +1153,7 @@ class wt {
|
|
|
1108
1153
|
this.path = `${this.params.hasSourceArrow || this.params.hasTargetArrow ? "" : w}${u}`, this.midpoint = l[3];
|
|
1109
1154
|
}
|
|
1110
1155
|
}
|
|
1111
|
-
class
|
|
1156
|
+
class ft {
|
|
1112
1157
|
constructor(e) {
|
|
1113
1158
|
i(this, "path");
|
|
1114
1159
|
i(this, "midpoint");
|
|
@@ -1144,7 +1189,7 @@ class yt {
|
|
|
1144
1189
|
};
|
|
1145
1190
|
}
|
|
1146
1191
|
}
|
|
1147
|
-
class
|
|
1192
|
+
class mt {
|
|
1148
1193
|
constructor(e) {
|
|
1149
1194
|
i(this, "path");
|
|
1150
1195
|
i(this, "midpoint");
|
|
@@ -1172,7 +1217,7 @@ class ft {
|
|
|
1172
1217
|
x: (n.x + a.x) / 2,
|
|
1173
1218
|
y: g
|
|
1174
1219
|
};
|
|
1175
|
-
this.midpoint =
|
|
1220
|
+
this.midpoint = k(l, e.flipX, e.flipY, e.to), this.path = D(
|
|
1176
1221
|
[
|
|
1177
1222
|
t,
|
|
1178
1223
|
n,
|
|
@@ -1185,7 +1230,7 @@ class ft {
|
|
|
1185
1230
|
);
|
|
1186
1231
|
}
|
|
1187
1232
|
}
|
|
1188
|
-
class
|
|
1233
|
+
class vt {
|
|
1189
1234
|
constructor(e) {
|
|
1190
1235
|
i(this, "path");
|
|
1191
1236
|
i(this, "midpoint");
|
|
@@ -1213,7 +1258,7 @@ class mt {
|
|
|
1213
1258
|
x: g,
|
|
1214
1259
|
y: (n.y + a.y) / 2
|
|
1215
1260
|
};
|
|
1216
|
-
this.midpoint =
|
|
1261
|
+
this.midpoint = k(l, e.flipX, e.flipY, e.to), this.path = D(
|
|
1217
1262
|
[
|
|
1218
1263
|
t,
|
|
1219
1264
|
n,
|
|
@@ -1248,30 +1293,30 @@ const f = Object.freeze({
|
|
|
1248
1293
|
curvature: 90,
|
|
1249
1294
|
interactiveWidth: 10,
|
|
1250
1295
|
preOffset: 0
|
|
1251
|
-
}),
|
|
1252
|
-
class
|
|
1296
|
+
}), fe = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
|
|
1297
|
+
class H {
|
|
1253
1298
|
constructor(e) {
|
|
1254
1299
|
i(this, "svg");
|
|
1255
|
-
i(this, "group",
|
|
1300
|
+
i(this, "group", Le());
|
|
1256
1301
|
i(this, "line");
|
|
1257
1302
|
i(this, "sourceArrow", null);
|
|
1258
1303
|
i(this, "targetArrow", null);
|
|
1259
1304
|
i(this, "onAfterRender");
|
|
1260
1305
|
i(this, "afterRenderEmitter");
|
|
1261
1306
|
i(this, "arrowRenderer");
|
|
1262
|
-
this.params = e, [this.afterRenderEmitter, this.onAfterRender] =
|
|
1307
|
+
this.params = e, [this.afterRenderEmitter, this.onAfterRender] = b(), this.arrowRenderer = this.params.arrowRenderer, this.svg = De(e.color), this.svg.appendChild(this.group), this.line = Re(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = z(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = z(), this.group.appendChild(this.targetArrow));
|
|
1263
1308
|
}
|
|
1264
1309
|
render(e) {
|
|
1265
|
-
const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } =
|
|
1310
|
+
const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = Me(
|
|
1266
1311
|
e.from,
|
|
1267
1312
|
e.to
|
|
1268
1313
|
);
|
|
1269
|
-
|
|
1270
|
-
const d =
|
|
1314
|
+
Fe(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1315
|
+
const d = fe(
|
|
1271
1316
|
e.from.direction,
|
|
1272
1317
|
a,
|
|
1273
1318
|
h
|
|
1274
|
-
), c =
|
|
1319
|
+
), c = fe(
|
|
1275
1320
|
e.to.direction,
|
|
1276
1321
|
a,
|
|
1277
1322
|
h
|
|
@@ -1280,7 +1325,7 @@ class k {
|
|
|
1280
1325
|
y: n
|
|
1281
1326
|
};
|
|
1282
1327
|
let l = { x: -c.x, y: -c.y }, u;
|
|
1283
|
-
e.category ===
|
|
1328
|
+
e.category === R.PortCycle ? (u = this.params.createCyclePath, l = d) : e.category === R.NodeCycle ? u = this.params.createDetourPath : u = this.params.createLinePath;
|
|
1284
1329
|
const w = u(
|
|
1285
1330
|
d,
|
|
1286
1331
|
c,
|
|
@@ -1307,7 +1352,7 @@ class k {
|
|
|
1307
1352
|
});
|
|
1308
1353
|
}
|
|
1309
1354
|
}
|
|
1310
|
-
const
|
|
1355
|
+
const xt = (r) => (e) => {
|
|
1311
1356
|
const s = [
|
|
1312
1357
|
y,
|
|
1313
1358
|
{ x: e.arrowLength, y: r.radius },
|
|
@@ -1327,7 +1372,7 @@ const vt = (r) => (e) => {
|
|
|
1327
1372
|
y: p.y + e.shift.y
|
|
1328
1373
|
})), g = `M ${c[0].x} ${c[0].y}`, l = `A ${o} ${o} 0 0 0 ${c[1].x} ${c[1].y}`, u = `A ${t} ${t} 0 0 0 ${c[2].x} ${c[2].y}`, w = `A ${o} ${o} 0 0 0 ${c[0].x} ${c[0].y}`;
|
|
1329
1374
|
return `${g} ${l} ${u} ${w}`;
|
|
1330
|
-
},
|
|
1375
|
+
}, Et = (r) => (e) => {
|
|
1331
1376
|
const t = r.smallRadius, s = r.radius, o = m(
|
|
1332
1377
|
{
|
|
1333
1378
|
x: e.arrowLength,
|
|
@@ -1348,12 +1393,12 @@ const vt = (r) => (e) => {
|
|
|
1348
1393
|
y: l.y + e.shift.y
|
|
1349
1394
|
})), h = `M ${a[0].x} ${a[0].y}`, d = `A ${s} ${s} 0 0 1 ${a[1].x} ${a[1].y}`, c = `A ${t} ${t} 0 0 1 ${a[2].x} ${a[2].y}`, g = `A ${s} ${s} 0 0 1 ${a[0].x} ${a[0].y}`;
|
|
1350
1395
|
return `${h} ${d} ${c} ${g}`;
|
|
1351
|
-
},
|
|
1396
|
+
}, $ = (r) => {
|
|
1352
1397
|
if (typeof r == "function")
|
|
1353
1398
|
return r;
|
|
1354
1399
|
switch (r.type) {
|
|
1355
1400
|
case "triangle":
|
|
1356
|
-
return
|
|
1401
|
+
return xt({
|
|
1357
1402
|
radius: r.radius ?? f.polygonArrowRadius
|
|
1358
1403
|
});
|
|
1359
1404
|
case "arc":
|
|
@@ -1361,14 +1406,14 @@ const vt = (r) => (e) => {
|
|
|
1361
1406
|
radius: r.radius ?? f.circleArrowRadius
|
|
1362
1407
|
});
|
|
1363
1408
|
default:
|
|
1364
|
-
return
|
|
1409
|
+
return Et({
|
|
1365
1410
|
smallRadius: r.smallRadius ?? f.wedgeArrowSmallRadius,
|
|
1366
1411
|
angle: r.angle ?? f.wedgeArrowAngle,
|
|
1367
1412
|
radius: r.radius ?? f.wedgeArrowRadius
|
|
1368
1413
|
});
|
|
1369
1414
|
}
|
|
1370
1415
|
};
|
|
1371
|
-
class
|
|
1416
|
+
class St {
|
|
1372
1417
|
constructor(e) {
|
|
1373
1418
|
i(this, "svg");
|
|
1374
1419
|
i(this, "group");
|
|
@@ -1385,7 +1430,7 @@ class Et {
|
|
|
1385
1430
|
i(this, "hasSourceArrow");
|
|
1386
1431
|
i(this, "hasTargetArrow");
|
|
1387
1432
|
i(this, "pathShape");
|
|
1388
|
-
i(this, "createCyclePath", (e) => new
|
|
1433
|
+
i(this, "createCyclePath", (e) => new yt({
|
|
1389
1434
|
sourceDirection: e,
|
|
1390
1435
|
radius: this.portCycleRadius,
|
|
1391
1436
|
smallRadius: this.portCycleSmallRadius,
|
|
@@ -1393,7 +1438,7 @@ class Et {
|
|
|
1393
1438
|
hasSourceArrow: this.hasSourceArrow,
|
|
1394
1439
|
hasTargetArrow: this.hasTargetArrow
|
|
1395
1440
|
}));
|
|
1396
|
-
i(this, "createDetourPath", (e, t, s, o, n) => new
|
|
1441
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new lt({
|
|
1397
1442
|
to: s,
|
|
1398
1443
|
sourceDirection: e,
|
|
1399
1444
|
targetDirection: t,
|
|
@@ -1406,7 +1451,7 @@ class Et {
|
|
|
1406
1451
|
hasSourceArrow: this.hasSourceArrow,
|
|
1407
1452
|
hasTargetArrow: this.hasTargetArrow
|
|
1408
1453
|
}));
|
|
1409
|
-
i(this, "createLinePath", (e, t, s) => new
|
|
1454
|
+
i(this, "createLinePath", (e, t, s) => new ct({
|
|
1410
1455
|
to: s,
|
|
1411
1456
|
sourceDirection: e,
|
|
1412
1457
|
targetDirection: t,
|
|
@@ -1415,10 +1460,10 @@ class Et {
|
|
|
1415
1460
|
hasSourceArrow: this.hasSourceArrow,
|
|
1416
1461
|
hasTargetArrow: this.hasTargetArrow
|
|
1417
1462
|
}));
|
|
1418
|
-
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? f.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? f.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? f.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new
|
|
1463
|
+
this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.curvature = (e == null ? void 0 : e.curvature) ?? f.curvature, this.portCycleRadius = (e == null ? void 0 : e.cycleRadius) ?? f.cycleRadius, this.portCycleSmallRadius = (e == null ? void 0 : e.smallCycleRadius) ?? f.smallCycleRadius, this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new H({
|
|
1419
1464
|
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1420
1465
|
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1421
|
-
arrowRenderer:
|
|
1466
|
+
arrowRenderer: $((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1422
1467
|
arrowLength: this.arrowLength,
|
|
1423
1468
|
hasSourceArrow: this.hasSourceArrow,
|
|
1424
1469
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1431,7 +1476,7 @@ class Et {
|
|
|
1431
1476
|
this.pathShape.render(e);
|
|
1432
1477
|
}
|
|
1433
1478
|
}
|
|
1434
|
-
class
|
|
1479
|
+
class bt {
|
|
1435
1480
|
constructor(e) {
|
|
1436
1481
|
i(this, "svg");
|
|
1437
1482
|
i(this, "group");
|
|
@@ -1447,7 +1492,7 @@ class St {
|
|
|
1447
1492
|
i(this, "hasSourceArrow");
|
|
1448
1493
|
i(this, "hasTargetArrow");
|
|
1449
1494
|
i(this, "pathShape");
|
|
1450
|
-
i(this, "createCyclePath", (e) => new
|
|
1495
|
+
i(this, "createCyclePath", (e) => new q({
|
|
1451
1496
|
sourceDirection: e,
|
|
1452
1497
|
arrowLength: this.arrowLength,
|
|
1453
1498
|
side: this.cycleSquareSide,
|
|
@@ -1456,7 +1501,7 @@ class St {
|
|
|
1456
1501
|
hasSourceArrow: this.hasSourceArrow,
|
|
1457
1502
|
hasTargetArrow: this.hasTargetArrow
|
|
1458
1503
|
}));
|
|
1459
|
-
i(this, "createDetourPath", (e, t, s, o, n) => new
|
|
1504
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new mt({
|
|
1460
1505
|
to: s,
|
|
1461
1506
|
sourceDirection: e,
|
|
1462
1507
|
targetDirection: t,
|
|
@@ -1469,7 +1514,7 @@ class St {
|
|
|
1469
1514
|
hasSourceArrow: this.hasSourceArrow,
|
|
1470
1515
|
hasTargetArrow: this.hasTargetArrow
|
|
1471
1516
|
}));
|
|
1472
|
-
i(this, "createLinePath", (e, t, s, o) => new
|
|
1517
|
+
i(this, "createLinePath", (e, t, s, o) => new gt({
|
|
1473
1518
|
to: s,
|
|
1474
1519
|
sourceDirection: e,
|
|
1475
1520
|
targetDirection: t,
|
|
@@ -1486,10 +1531,10 @@ class St {
|
|
|
1486
1531
|
t,
|
|
1487
1532
|
this.arrowOffset,
|
|
1488
1533
|
this.cycleSquareSide / 2
|
|
1489
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new
|
|
1534
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new H({
|
|
1490
1535
|
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1491
1536
|
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1492
|
-
arrowRenderer:
|
|
1537
|
+
arrowRenderer: $((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1493
1538
|
arrowLength: this.arrowLength,
|
|
1494
1539
|
hasSourceArrow: this.hasSourceArrow,
|
|
1495
1540
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1502,7 +1547,7 @@ class St {
|
|
|
1502
1547
|
this.pathShape.render(e);
|
|
1503
1548
|
}
|
|
1504
1549
|
}
|
|
1505
|
-
class
|
|
1550
|
+
class Nt {
|
|
1506
1551
|
constructor(e) {
|
|
1507
1552
|
i(this, "svg");
|
|
1508
1553
|
i(this, "group");
|
|
@@ -1519,7 +1564,7 @@ class bt {
|
|
|
1519
1564
|
i(this, "hasSourceArrow");
|
|
1520
1565
|
i(this, "hasTargetArrow");
|
|
1521
1566
|
i(this, "pathShape");
|
|
1522
|
-
i(this, "createCyclePath", (e) => new
|
|
1567
|
+
i(this, "createCyclePath", (e) => new q({
|
|
1523
1568
|
sourceDirection: e,
|
|
1524
1569
|
arrowLength: this.arrowLength,
|
|
1525
1570
|
side: this.cycleSquareSide,
|
|
@@ -1528,7 +1573,7 @@ class bt {
|
|
|
1528
1573
|
hasSourceArrow: this.hasSourceArrow,
|
|
1529
1574
|
hasTargetArrow: this.hasTargetArrow
|
|
1530
1575
|
}));
|
|
1531
|
-
i(this, "createDetourPath", (e, t, s, o, n) => new
|
|
1576
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new ut({
|
|
1532
1577
|
to: s,
|
|
1533
1578
|
sourceDirection: e,
|
|
1534
1579
|
targetDirection: t,
|
|
@@ -1542,7 +1587,7 @@ class bt {
|
|
|
1542
1587
|
hasSourceArrow: this.hasSourceArrow,
|
|
1543
1588
|
hasTargetArrow: this.hasTargetArrow
|
|
1544
1589
|
}));
|
|
1545
|
-
i(this, "createLinePath", (e, t, s) => new
|
|
1590
|
+
i(this, "createLinePath", (e, t, s) => new pt({
|
|
1546
1591
|
to: s,
|
|
1547
1592
|
sourceDirection: e,
|
|
1548
1593
|
targetDirection: t,
|
|
@@ -1558,10 +1603,10 @@ class bt {
|
|
|
1558
1603
|
t,
|
|
1559
1604
|
this.arrowOffset,
|
|
1560
1605
|
this.cycleSquareSide / 2
|
|
1561
|
-
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new
|
|
1606
|
+
), this.detourDirection = (e == null ? void 0 : e.detourDirection) ?? f.detourDirection, this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new H({
|
|
1562
1607
|
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1563
1608
|
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1564
|
-
arrowRenderer:
|
|
1609
|
+
arrowRenderer: $((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1565
1610
|
arrowLength: this.arrowLength,
|
|
1566
1611
|
hasSourceArrow: this.hasSourceArrow,
|
|
1567
1612
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1590,7 +1635,7 @@ class Pt {
|
|
|
1590
1635
|
i(this, "hasSourceArrow");
|
|
1591
1636
|
i(this, "hasTargetArrow");
|
|
1592
1637
|
i(this, "pathShape");
|
|
1593
|
-
i(this, "createCyclePath", (e) => new
|
|
1638
|
+
i(this, "createCyclePath", (e) => new q({
|
|
1594
1639
|
sourceDirection: e,
|
|
1595
1640
|
arrowLength: this.arrowLength,
|
|
1596
1641
|
side: this.cycleSquareSide,
|
|
@@ -1599,7 +1644,7 @@ class Pt {
|
|
|
1599
1644
|
hasSourceArrow: this.hasSourceArrow,
|
|
1600
1645
|
hasTargetArrow: this.hasTargetArrow
|
|
1601
1646
|
}));
|
|
1602
|
-
i(this, "createDetourPath", (e, t, s, o, n) => new
|
|
1647
|
+
i(this, "createDetourPath", (e, t, s, o, n) => new vt({
|
|
1603
1648
|
to: s,
|
|
1604
1649
|
sourceDirection: e,
|
|
1605
1650
|
targetDirection: t,
|
|
@@ -1612,7 +1657,7 @@ class Pt {
|
|
|
1612
1657
|
hasSourceArrow: this.hasSourceArrow,
|
|
1613
1658
|
hasTargetArrow: this.hasTargetArrow
|
|
1614
1659
|
}));
|
|
1615
|
-
i(this, "createLinePath", (e, t, s, o, n) => new
|
|
1660
|
+
i(this, "createLinePath", (e, t, s, o, n) => new wt({
|
|
1616
1661
|
to: s,
|
|
1617
1662
|
sourceDirection: e,
|
|
1618
1663
|
targetDirection: t,
|
|
@@ -1629,10 +1674,10 @@ class Pt {
|
|
|
1629
1674
|
t,
|
|
1630
1675
|
this.arrowOffset,
|
|
1631
1676
|
this.cycleSquareSide / 2
|
|
1632
|
-
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new
|
|
1677
|
+
), this.detourDistance = (e == null ? void 0 : e.detourDistance) ?? f.detourDistance, this.hasSourceArrow = (e == null ? void 0 : e.hasSourceArrow) ?? f.hasSourceArrow, this.hasTargetArrow = (e == null ? void 0 : e.hasTargetArrow) ?? f.hasTargetArrow, this.pathShape = new H({
|
|
1633
1678
|
color: (e == null ? void 0 : e.color) ?? f.color,
|
|
1634
1679
|
width: (e == null ? void 0 : e.width) ?? f.width,
|
|
1635
|
-
arrowRenderer:
|
|
1680
|
+
arrowRenderer: $((e == null ? void 0 : e.arrowRenderer) ?? {}),
|
|
1636
1681
|
arrowLength: this.arrowLength,
|
|
1637
1682
|
hasSourceArrow: this.hasSourceArrow,
|
|
1638
1683
|
hasTargetArrow: this.hasTargetArrow,
|
|
@@ -1648,7 +1693,7 @@ class Pt {
|
|
|
1648
1693
|
class Ve {
|
|
1649
1694
|
constructor(e) {
|
|
1650
1695
|
i(this, "svg");
|
|
1651
|
-
i(this, "group",
|
|
1696
|
+
i(this, "group", Le());
|
|
1652
1697
|
i(this, "line");
|
|
1653
1698
|
i(this, "sourceArrow", null);
|
|
1654
1699
|
i(this, "targetArrow", null);
|
|
@@ -1660,15 +1705,15 @@ class Ve {
|
|
|
1660
1705
|
i(this, "onAfterRender");
|
|
1661
1706
|
i(this, "afterRenderEmitter");
|
|
1662
1707
|
i(this, "arrowRenderer");
|
|
1663
|
-
[this.afterRenderEmitter, this.onAfterRender] =
|
|
1708
|
+
[this.afterRenderEmitter, this.onAfterRender] = b(), this.color = (e == null ? void 0 : e.color) ?? f.color, this.width = (e == null ? void 0 : e.width) ?? f.width, this.arrowLength = (e == null ? void 0 : e.arrowLength) ?? f.arrowLength, this.arrowRenderer = $((e == null ? void 0 : e.arrowRenderer) ?? {}), this.sourceOffset = (e == null ? void 0 : e.sourceOffset) ?? f.preOffset, this.targetOffset = (e == null ? void 0 : e.targetOffset) ?? f.preOffset, this.svg = De(this.color), this.svg.appendChild(this.group), this.line = Re(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = z(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = z(), this.group.appendChild(this.targetArrow));
|
|
1664
1709
|
}
|
|
1665
1710
|
render(e) {
|
|
1666
|
-
const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } =
|
|
1711
|
+
const { x: t, y: s, width: o, height: n, flipX: a, flipY: h } = Me(
|
|
1667
1712
|
e.from,
|
|
1668
1713
|
e.to
|
|
1669
1714
|
);
|
|
1670
|
-
|
|
1671
|
-
const d = { x: o, y: n }, c = new
|
|
1715
|
+
Fe(this.svg, { x: t, y: s, width: o, height: n }), this.group.style.transform = `scale(${a}, ${h})`;
|
|
1716
|
+
const d = { x: o, y: n }, c = new ft({
|
|
1672
1717
|
to: d,
|
|
1673
1718
|
sourceOffset: this.sourceOffset,
|
|
1674
1719
|
targetOffset: this.targetOffset,
|
|
@@ -1722,19 +1767,19 @@ class Ve {
|
|
|
1722
1767
|
const Ct = () => {
|
|
1723
1768
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1724
1769
|
return r.style.pointerEvents = "auto", r.style.cursor = "pointer", r;
|
|
1725
|
-
},
|
|
1770
|
+
}, Tt = (r) => {
|
|
1726
1771
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1727
1772
|
return e.setAttribute("stroke", "transparent"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e.setAttribute("stroke-linecap", "round"), e;
|
|
1728
|
-
},
|
|
1773
|
+
}, me = (r) => {
|
|
1729
1774
|
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1730
1775
|
return e.setAttribute("stroke-linejoin", "round"), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "transparent"), e.setAttribute("stroke", "transparent"), e;
|
|
1731
1776
|
};
|
|
1732
|
-
class
|
|
1777
|
+
class Mt extends Error {
|
|
1733
1778
|
constructor(e) {
|
|
1734
1779
|
super(e), this.name = "InteractiveEdgeError";
|
|
1735
1780
|
}
|
|
1736
1781
|
}
|
|
1737
|
-
class
|
|
1782
|
+
class Ie {
|
|
1738
1783
|
constructor(e, t) {
|
|
1739
1784
|
i(this, "svg");
|
|
1740
1785
|
i(this, "group");
|
|
@@ -1746,13 +1791,13 @@ class Fe {
|
|
|
1746
1791
|
i(this, "interactiveLine");
|
|
1747
1792
|
i(this, "interactiveSourceArrow", null);
|
|
1748
1793
|
i(this, "interactiveTargetArrow", null);
|
|
1749
|
-
if (this.baseEdge = e, e instanceof
|
|
1750
|
-
throw new
|
|
1794
|
+
if (this.baseEdge = e, e instanceof Ie)
|
|
1795
|
+
throw new Mt(
|
|
1751
1796
|
"interactive edge can be configured only once"
|
|
1752
1797
|
);
|
|
1753
1798
|
this.svg = this.baseEdge.svg, this.group = this.baseEdge.group, this.line = this.baseEdge.line, this.sourceArrow = this.baseEdge.sourceArrow, this.targetArrow = this.baseEdge.targetArrow, this.onAfterRender = this.baseEdge.onAfterRender;
|
|
1754
1799
|
const s = (t == null ? void 0 : t.distance) ?? f.interactiveWidth;
|
|
1755
|
-
this.interactiveLine =
|
|
1800
|
+
this.interactiveLine = Tt(s), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = me(s), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = me(s), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((o) => {
|
|
1756
1801
|
this.interactiveLine.setAttribute("d", o.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", o.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", o.targetArrowPath);
|
|
1757
1802
|
});
|
|
1758
1803
|
}
|
|
@@ -1777,7 +1822,7 @@ class Cr {
|
|
|
1777
1822
|
this.baseShape.render(e);
|
|
1778
1823
|
}
|
|
1779
1824
|
}
|
|
1780
|
-
class
|
|
1825
|
+
class $e {
|
|
1781
1826
|
constructor(e) {
|
|
1782
1827
|
i(this, "onAfterNodeAdded");
|
|
1783
1828
|
i(this, "onAfterNodeUpdated");
|
|
@@ -1873,7 +1918,7 @@ class Ie {
|
|
|
1873
1918
|
return this.graphStore.getNodeAdjacentEdgeIds(e);
|
|
1874
1919
|
}
|
|
1875
1920
|
}
|
|
1876
|
-
class
|
|
1921
|
+
class G {
|
|
1877
1922
|
constructor(e) {
|
|
1878
1923
|
i(this, "counter", 0);
|
|
1879
1924
|
this.checkExists = e;
|
|
@@ -1891,13 +1936,13 @@ class X {
|
|
|
1891
1936
|
}
|
|
1892
1937
|
class Be {
|
|
1893
1938
|
constructor(e, t, s) {
|
|
1894
|
-
i(this, "nodeIdGenerator", new
|
|
1939
|
+
i(this, "nodeIdGenerator", new G(
|
|
1895
1940
|
(e) => this.graphStore.hasNode(e)
|
|
1896
1941
|
));
|
|
1897
|
-
i(this, "portIdGenerator", new
|
|
1942
|
+
i(this, "portIdGenerator", new G(
|
|
1898
1943
|
(e) => this.graphStore.hasPort(e)
|
|
1899
1944
|
));
|
|
1900
|
-
i(this, "edgeIdGenerator", new
|
|
1945
|
+
i(this, "edgeIdGenerator", new G(
|
|
1901
1946
|
(e) => this.graphStore.hasEdge(e)
|
|
1902
1947
|
));
|
|
1903
1948
|
i(this, "onAfterNodeAdded", (e) => {
|
|
@@ -2020,18 +2065,18 @@ class Be {
|
|
|
2020
2065
|
), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
|
|
2021
2066
|
}
|
|
2022
2067
|
}
|
|
2023
|
-
const
|
|
2068
|
+
const Dt = (r) => {
|
|
2024
2069
|
setTimeout(() => {
|
|
2025
2070
|
r();
|
|
2026
2071
|
});
|
|
2027
|
-
},
|
|
2072
|
+
}, Rt = (r) => {
|
|
2028
2073
|
queueMicrotask(() => {
|
|
2029
2074
|
r();
|
|
2030
2075
|
});
|
|
2031
|
-
},
|
|
2076
|
+
}, ee = (r) => {
|
|
2032
2077
|
r();
|
|
2033
2078
|
};
|
|
2034
|
-
class
|
|
2079
|
+
class Ue {
|
|
2035
2080
|
constructor(e) {
|
|
2036
2081
|
i(this, "onBeforeUpdated");
|
|
2037
2082
|
i(this, "onAfterUpdated");
|
|
@@ -2054,7 +2099,7 @@ class $e {
|
|
|
2054
2099
|
return this.viewportStore.createViewportCoords(e);
|
|
2055
2100
|
}
|
|
2056
2101
|
}
|
|
2057
|
-
const
|
|
2102
|
+
const Lt = (r, e) => Symbol.iterator in r ? {
|
|
2058
2103
|
minContentScale: e.focus.minContentScale,
|
|
2059
2104
|
nodes: r,
|
|
2060
2105
|
contentOffset: e.focus.contentOffset
|
|
@@ -2062,16 +2107,16 @@ const Rt = (r, e) => Symbol.iterator in r ? {
|
|
|
2062
2107
|
minContentScale: r.minContentScale ?? e.focus.minContentScale,
|
|
2063
2108
|
nodes: r.nodes ?? [],
|
|
2064
2109
|
contentOffset: r.contentOffset ?? e.focus.contentOffset
|
|
2065
|
-
},
|
|
2110
|
+
}, Oe = (r, e, t) => ({
|
|
2066
2111
|
scale: r.scale,
|
|
2067
2112
|
x: r.x + r.scale * e,
|
|
2068
2113
|
y: r.y + r.scale * t
|
|
2069
|
-
}),
|
|
2114
|
+
}), We = (r, e, t, s) => ({
|
|
2070
2115
|
scale: r.scale * e,
|
|
2071
2116
|
x: r.scale * (1 - e) * t + r.x,
|
|
2072
2117
|
y: r.scale * (1 - e) * s + r.y
|
|
2073
2118
|
});
|
|
2074
|
-
class
|
|
2119
|
+
class ze {
|
|
2075
2120
|
constructor(e, t, s) {
|
|
2076
2121
|
this.graphStore = e, this.viewportStore = t, this.params = s;
|
|
2077
2122
|
}
|
|
@@ -2083,11 +2128,11 @@ class We {
|
|
|
2083
2128
|
}
|
|
2084
2129
|
center(e, t) {
|
|
2085
2130
|
const { width: s, height: o } = this.viewportStore.getDimensions(), n = { x: s / 2, y: o / 2 }, a = this.viewportStore.getViewportMatrix(), h = this.viewportStore.createViewportCoords(e), d = h.x - n.x, c = h.y - n.y;
|
|
2086
|
-
let g =
|
|
2131
|
+
let g = Oe(a, d, c);
|
|
2087
2132
|
const l = t == null ? void 0 : t.contentScale;
|
|
2088
2133
|
if (l !== void 0) {
|
|
2089
2134
|
const u = 1 / l;
|
|
2090
|
-
g =
|
|
2135
|
+
g = We(
|
|
2091
2136
|
g,
|
|
2092
2137
|
u / a.scale,
|
|
2093
2138
|
n.x,
|
|
@@ -2097,7 +2142,7 @@ class We {
|
|
|
2097
2142
|
this.viewportStore.patchViewportMatrix(g);
|
|
2098
2143
|
}
|
|
2099
2144
|
focus(e) {
|
|
2100
|
-
const t =
|
|
2145
|
+
const t = Lt(e ?? {}, this.params);
|
|
2101
2146
|
this.params.focus.schedule(() => {
|
|
2102
2147
|
this.navigate(t);
|
|
2103
2148
|
});
|
|
@@ -2121,15 +2166,15 @@ class We {
|
|
|
2121
2166
|
}, { scale: c } = this.viewportStore.getContentMatrix(), g = (n - o) * c, l = (s - t) * c, { width: u, height: w } = this.viewportStore.getDimensions(), p = Math.max(
|
|
2122
2167
|
l / u,
|
|
2123
2168
|
g / w
|
|
2124
|
-
), v = p > 1 ? c / p : c,
|
|
2125
|
-
this.center(d, { contentScale:
|
|
2169
|
+
), v = p > 1 ? c / p : c, S = Math.max(v, e.minContentScale);
|
|
2170
|
+
this.center(d, { contentScale: S });
|
|
2126
2171
|
}
|
|
2127
2172
|
}
|
|
2128
2173
|
}
|
|
2129
|
-
const
|
|
2130
|
-
const t = new
|
|
2174
|
+
const ke = (r, e) => {
|
|
2175
|
+
const t = new Ne(), s = new $e(t), o = new Ue(e), n = new Se(t, e, r), a = {
|
|
2131
2176
|
nodes: {
|
|
2132
|
-
centerFn:
|
|
2177
|
+
centerFn: Te,
|
|
2133
2178
|
priorityFn: () => 0
|
|
2134
2179
|
},
|
|
2135
2180
|
edges: {
|
|
@@ -2147,16 +2192,16 @@ const ze = (r, e) => {
|
|
|
2147
2192
|
focus: {
|
|
2148
2193
|
contentOffset: 0,
|
|
2149
2194
|
minContentScale: 0,
|
|
2150
|
-
schedule:
|
|
2195
|
+
schedule: ee
|
|
2151
2196
|
}
|
|
2152
|
-
}, c = new
|
|
2197
|
+
}, c = new ze(
|
|
2153
2198
|
t,
|
|
2154
2199
|
e,
|
|
2155
2200
|
d
|
|
2156
2201
|
);
|
|
2157
|
-
return new
|
|
2202
|
+
return new be(s, o, h, c);
|
|
2158
2203
|
};
|
|
2159
|
-
class
|
|
2204
|
+
class Y {
|
|
2160
2205
|
constructor(e, t, s, o) {
|
|
2161
2206
|
i(this, "onAfterPortMarked", (e) => {
|
|
2162
2207
|
const t = this.canvas.graph.getPort(e);
|
|
@@ -2181,7 +2226,7 @@ class H {
|
|
|
2181
2226
|
}));
|
|
2182
2227
|
});
|
|
2183
2228
|
i(this, "onWindowMouseMove", (e) => {
|
|
2184
|
-
if (!
|
|
2229
|
+
if (!L(
|
|
2185
2230
|
this.window,
|
|
2186
2231
|
this.element,
|
|
2187
2232
|
e.clientX,
|
|
@@ -2213,7 +2258,7 @@ class H {
|
|
|
2213
2258
|
});
|
|
2214
2259
|
i(this, "onWindowTouchMove", (e) => {
|
|
2215
2260
|
const t = e.touches[0];
|
|
2216
|
-
if (!
|
|
2261
|
+
if (!L(
|
|
2217
2262
|
this.window,
|
|
2218
2263
|
this.element,
|
|
2219
2264
|
t.clientX,
|
|
@@ -2240,7 +2285,7 @@ class H {
|
|
|
2240
2285
|
this.canvas = e, this.element = t, this.window = s, this.params = o, this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
2241
2286
|
}
|
|
2242
2287
|
static configure(e, t, s, o) {
|
|
2243
|
-
new
|
|
2288
|
+
new Y(e, t, s, o);
|
|
2244
2289
|
}
|
|
2245
2290
|
hookPortEvents(e) {
|
|
2246
2291
|
e.addEventListener("mousedown", this.onPortMouseDown, {
|
|
@@ -2265,7 +2310,7 @@ class H {
|
|
|
2265
2310
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
2266
2311
|
}
|
|
2267
2312
|
}
|
|
2268
|
-
class
|
|
2313
|
+
class Ft {
|
|
2269
2314
|
constructor(e, t, s) {
|
|
2270
2315
|
this.canvas = e, this.layoutAlgorithm = t, this.params = s;
|
|
2271
2316
|
}
|
|
@@ -2294,7 +2339,7 @@ class Vt {
|
|
|
2294
2339
|
}), this.params.onAfterApplied();
|
|
2295
2340
|
}
|
|
2296
2341
|
}
|
|
2297
|
-
class
|
|
2342
|
+
class te {
|
|
2298
2343
|
constructor(e, t, s, o) {
|
|
2299
2344
|
i(this, "grabbedNode", null);
|
|
2300
2345
|
i(this, "maxNodePriority", 0);
|
|
@@ -2331,7 +2376,7 @@ class ee {
|
|
|
2331
2376
|
nodeId: o,
|
|
2332
2377
|
dx: h.x - n.x,
|
|
2333
2378
|
dy: h.y - n.y
|
|
2334
|
-
},
|
|
2379
|
+
}, O(this.element, this.params.dragCursor), this.moveNodeOnTop(o), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2335
2380
|
passive: !0
|
|
2336
2381
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2337
2382
|
passive: !0
|
|
@@ -2367,7 +2412,7 @@ class ee {
|
|
|
2367
2412
|
});
|
|
2368
2413
|
});
|
|
2369
2414
|
i(this, "onWindowMouseMove", (e) => {
|
|
2370
|
-
if (!
|
|
2415
|
+
if (!L(
|
|
2371
2416
|
this.window,
|
|
2372
2417
|
this.element,
|
|
2373
2418
|
e.clientX,
|
|
@@ -2388,7 +2433,7 @@ class ee {
|
|
|
2388
2433
|
if (e.touches.length !== 1)
|
|
2389
2434
|
return;
|
|
2390
2435
|
const t = e.touches[0];
|
|
2391
|
-
if (!
|
|
2436
|
+
if (!L(
|
|
2392
2437
|
this.window,
|
|
2393
2438
|
this.element,
|
|
2394
2439
|
t.clientX,
|
|
@@ -2417,7 +2462,7 @@ class ee {
|
|
|
2417
2462
|
this.canvas = e, this.element = t, this.window = s, this.params = o, this.graph = e.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.reset), this.canvas.onBeforeDestroy.subscribe(this.revert);
|
|
2418
2463
|
}
|
|
2419
2464
|
static configure(e, t, s, o) {
|
|
2420
|
-
new
|
|
2465
|
+
new te(e, t, s, o);
|
|
2421
2466
|
}
|
|
2422
2467
|
moveNode(e, t) {
|
|
2423
2468
|
if (!this.graph.hasNode(e.nodeId))
|
|
@@ -2443,7 +2488,7 @@ class ee {
|
|
|
2443
2488
|
}
|
|
2444
2489
|
}
|
|
2445
2490
|
cancelMouseDrag() {
|
|
2446
|
-
this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null,
|
|
2491
|
+
this.grabbedNode !== null && this.graph.hasNode(this.grabbedNode.nodeId) && this.params.onNodeDragFinished(this.grabbedNode.nodeId), this.grabbedNode = null, O(this.element, null), this.removeMouseDragListeners();
|
|
2447
2492
|
}
|
|
2448
2493
|
removeMouseDragListeners() {
|
|
2449
2494
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
@@ -2505,7 +2550,7 @@ const B = (r) => {
|
|
|
2505
2550
|
touches: e
|
|
2506
2551
|
};
|
|
2507
2552
|
};
|
|
2508
|
-
class
|
|
2553
|
+
class X {
|
|
2509
2554
|
constructor(e, t, s, o) {
|
|
2510
2555
|
i(this, "viewport");
|
|
2511
2556
|
i(this, "prevTouches", null);
|
|
@@ -2515,14 +2560,14 @@ class Y {
|
|
|
2515
2560
|
this.removeMouseDragListeners(), this.removeTouchDragListeners();
|
|
2516
2561
|
});
|
|
2517
2562
|
i(this, "onMouseDown", (e) => {
|
|
2518
|
-
this.params.mouseDownEventVerifier(e) && (
|
|
2563
|
+
this.params.mouseDownEventVerifier(e) && (O(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, {
|
|
2519
2564
|
passive: !0
|
|
2520
2565
|
}), this.window.addEventListener("mouseup", this.onWindowMouseUp, {
|
|
2521
2566
|
passive: !0
|
|
2522
2567
|
}), this.startRegisteredTransform());
|
|
2523
2568
|
});
|
|
2524
2569
|
i(this, "onWindowMouseMove", (e) => {
|
|
2525
|
-
const t =
|
|
2570
|
+
const t = L(
|
|
2526
2571
|
this.window,
|
|
2527
2572
|
this.element,
|
|
2528
2573
|
e.clientX,
|
|
@@ -2562,7 +2607,7 @@ class Y {
|
|
|
2562
2607
|
i(this, "onWindowTouchMove", (e) => {
|
|
2563
2608
|
const t = B(e);
|
|
2564
2609
|
if (!t.touches.every(
|
|
2565
|
-
(o) =>
|
|
2610
|
+
(o) => L(this.window, this.element, o[0], o[1])
|
|
2566
2611
|
)) {
|
|
2567
2612
|
this.stopTouchDrag();
|
|
2568
2613
|
return;
|
|
@@ -2595,10 +2640,10 @@ class Y {
|
|
|
2595
2640
|
}), e.onBeforeDestroy.subscribe(this.revert);
|
|
2596
2641
|
}
|
|
2597
2642
|
static configure(e, t, s, o) {
|
|
2598
|
-
new
|
|
2643
|
+
new X(e, t, s, o);
|
|
2599
2644
|
}
|
|
2600
2645
|
moveViewport(e, t) {
|
|
2601
|
-
const s = this.viewport.getViewportMatrix(), o =
|
|
2646
|
+
const s = this.viewport.getViewportMatrix(), o = Oe(s, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
|
|
2602
2647
|
prevTransform: s,
|
|
2603
2648
|
nextTransform: o,
|
|
2604
2649
|
canvasWidth: n,
|
|
@@ -2607,7 +2652,7 @@ class Y {
|
|
|
2607
2652
|
this.performTransform(h);
|
|
2608
2653
|
}
|
|
2609
2654
|
scaleViewport(e, t, s) {
|
|
2610
|
-
const o = this.canvas.viewport.getViewportMatrix(), n =
|
|
2655
|
+
const o = this.canvas.viewport.getViewportMatrix(), n = We(o, e, t, s), { width: a, height: h } = this.viewport.getDimensions(), d = this.params.transformPreprocessor({
|
|
2611
2656
|
prevTransform: o,
|
|
2612
2657
|
nextTransform: n,
|
|
2613
2658
|
canvasWidth: a,
|
|
@@ -2616,7 +2661,7 @@ class Y {
|
|
|
2616
2661
|
this.performTransform(d);
|
|
2617
2662
|
}
|
|
2618
2663
|
stopMouseDrag() {
|
|
2619
|
-
|
|
2664
|
+
O(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
|
|
2620
2665
|
}
|
|
2621
2666
|
removeMouseDragListeners() {
|
|
2622
2667
|
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
@@ -2646,7 +2691,7 @@ class Y {
|
|
|
2646
2691
|
this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(o), this.params.onResizeTransformFinished();
|
|
2647
2692
|
}
|
|
2648
2693
|
}
|
|
2649
|
-
class
|
|
2694
|
+
class re {
|
|
2650
2695
|
constructor(e, t, s, o, n, a) {
|
|
2651
2696
|
i(this, "nodeHorizontal");
|
|
2652
2697
|
i(this, "nodeVertical");
|
|
@@ -2693,7 +2738,7 @@ class te {
|
|
|
2693
2738
|
this.scheduleLoadAreaAroundViewport(), o.onTransformFinished();
|
|
2694
2739
|
}
|
|
2695
2740
|
};
|
|
2696
|
-
|
|
2741
|
+
X.configure(
|
|
2697
2742
|
e,
|
|
2698
2743
|
this.element,
|
|
2699
2744
|
this.window,
|
|
@@ -2701,7 +2746,7 @@ class te {
|
|
|
2701
2746
|
), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
|
|
2702
2747
|
}
|
|
2703
2748
|
static configure(e, t, s, o, n, a) {
|
|
2704
|
-
new
|
|
2749
|
+
new re(
|
|
2705
2750
|
e,
|
|
2706
2751
|
t,
|
|
2707
2752
|
s,
|
|
@@ -2731,10 +2776,10 @@ class te {
|
|
|
2731
2776
|
});
|
|
2732
2777
|
}
|
|
2733
2778
|
}
|
|
2734
|
-
const
|
|
2779
|
+
const It = () => {
|
|
2735
2780
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2736
2781
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
2737
|
-
},
|
|
2782
|
+
}, $t = () => {
|
|
2738
2783
|
const r = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2739
2784
|
return r.setAttribute("fill", "url(#pattern)"), r;
|
|
2740
2785
|
}, Bt = () => {
|
|
@@ -2744,10 +2789,10 @@ const Ft = () => {
|
|
|
2744
2789
|
);
|
|
2745
2790
|
return r.setAttribute("id", "pattern"), r;
|
|
2746
2791
|
};
|
|
2747
|
-
class
|
|
2792
|
+
class se {
|
|
2748
2793
|
constructor(e, t, s) {
|
|
2749
|
-
i(this, "svg",
|
|
2750
|
-
i(this, "patternRenderingRectangle",
|
|
2794
|
+
i(this, "svg", It());
|
|
2795
|
+
i(this, "patternRenderingRectangle", $t());
|
|
2751
2796
|
i(this, "pattern", Bt());
|
|
2752
2797
|
i(this, "patternContent");
|
|
2753
2798
|
i(this, "tileWidth");
|
|
@@ -2769,7 +2814,7 @@ class re {
|
|
|
2769
2814
|
}), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
|
|
2770
2815
|
}
|
|
2771
2816
|
static configure(e, t, s) {
|
|
2772
|
-
new
|
|
2817
|
+
new se(e, t, s);
|
|
2773
2818
|
}
|
|
2774
2819
|
updateVisibility() {
|
|
2775
2820
|
const { scale: e } = this.canvas.viewport.getViewportMatrix(), t = e > this.maxViewportScale;
|
|
@@ -2782,7 +2827,7 @@ class re {
|
|
|
2782
2827
|
this.pattern.setAttribute("width", `${s}`), this.pattern.setAttribute("height", `${o}`);
|
|
2783
2828
|
}
|
|
2784
2829
|
}
|
|
2785
|
-
class
|
|
2830
|
+
class oe {
|
|
2786
2831
|
constructor(e, t, s, o, n) {
|
|
2787
2832
|
i(this, "overlayCanvas");
|
|
2788
2833
|
i(this, "staticPortId", null);
|
|
@@ -2790,10 +2835,10 @@ class se {
|
|
|
2790
2835
|
i(this, "onEdgeCreated", (e) => {
|
|
2791
2836
|
this.params.onAfterEdgeCreated(e);
|
|
2792
2837
|
});
|
|
2793
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas =
|
|
2838
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = ke(
|
|
2794
2839
|
this.overlayLayer,
|
|
2795
2840
|
this.viewportStore
|
|
2796
|
-
),
|
|
2841
|
+
), Y.configure(
|
|
2797
2842
|
this.canvas,
|
|
2798
2843
|
this.overlayLayer,
|
|
2799
2844
|
this.window,
|
|
@@ -2817,7 +2862,7 @@ class se {
|
|
|
2817
2862
|
);
|
|
2818
2863
|
}
|
|
2819
2864
|
static configure(e, t, s, o, n) {
|
|
2820
|
-
new
|
|
2865
|
+
new oe(
|
|
2821
2866
|
e,
|
|
2822
2867
|
t,
|
|
2823
2868
|
s,
|
|
@@ -2845,7 +2890,7 @@ class se {
|
|
|
2845
2890
|
};
|
|
2846
2891
|
this.isTargetDragging = s === "direct";
|
|
2847
2892
|
const [w, p] = this.isTargetDragging ? [l, u] : [u, l];
|
|
2848
|
-
this.overlayCanvas.addNode(
|
|
2893
|
+
this.overlayCanvas.addNode(W(w)), this.overlayCanvas.addNode(W(p)), this.overlayCanvas.addEdge({
|
|
2849
2894
|
from: w.overlayNodeId,
|
|
2850
2895
|
to: p.overlayNodeId,
|
|
2851
2896
|
shape: this.params.edgeShapeFactory(C.EdgeId)
|
|
@@ -2877,7 +2922,7 @@ class se {
|
|
|
2877
2922
|
});
|
|
2878
2923
|
}
|
|
2879
2924
|
}
|
|
2880
|
-
class
|
|
2925
|
+
class ie {
|
|
2881
2926
|
constructor(e, t, s, o, n) {
|
|
2882
2927
|
i(this, "overlayCanvas");
|
|
2883
2928
|
i(this, "staticPortId", null);
|
|
@@ -2886,10 +2931,10 @@ class oe {
|
|
|
2886
2931
|
i(this, "onEdgeReattached", (e) => {
|
|
2887
2932
|
this.params.onAfterEdgeReattached(e);
|
|
2888
2933
|
});
|
|
2889
|
-
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas =
|
|
2934
|
+
this.canvas = e, this.overlayLayer = t, this.viewportStore = s, this.window = o, this.params = n, this.overlayCanvas = ke(
|
|
2890
2935
|
this.overlayLayer,
|
|
2891
2936
|
this.viewportStore
|
|
2892
|
-
),
|
|
2937
|
+
), Y.configure(
|
|
2893
2938
|
this.canvas,
|
|
2894
2939
|
this.overlayLayer,
|
|
2895
2940
|
this.window,
|
|
@@ -2910,7 +2955,7 @@ class oe {
|
|
|
2910
2955
|
);
|
|
2911
2956
|
}
|
|
2912
2957
|
static configure(e, t, s, o, n) {
|
|
2913
|
-
new
|
|
2958
|
+
new ie(
|
|
2914
2959
|
e,
|
|
2915
2960
|
t,
|
|
2916
2961
|
s,
|
|
@@ -2945,17 +2990,17 @@ class oe {
|
|
|
2945
2990
|
overlayNodeId: C.StaticNodeId,
|
|
2946
2991
|
portCoords: w,
|
|
2947
2992
|
portDirection: c.direction
|
|
2948
|
-
},
|
|
2993
|
+
}, S = {
|
|
2949
2994
|
overlayNodeId: C.DraggingNodeId,
|
|
2950
2995
|
portCoords: p,
|
|
2951
2996
|
portDirection: d.direction
|
|
2952
|
-
}, [
|
|
2953
|
-
this.overlayCanvas.addNode(
|
|
2997
|
+
}, [N, T] = this.isTargetDragging ? [v, S] : [S, v];
|
|
2998
|
+
this.overlayCanvas.addNode(W(N)), this.overlayCanvas.addNode(W(T));
|
|
2954
2999
|
const P = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(C.EdgeId) : o.shape;
|
|
2955
3000
|
return this.overlayCanvas.addEdge({
|
|
2956
3001
|
id: C.EdgeId,
|
|
2957
|
-
from:
|
|
2958
|
-
to:
|
|
3002
|
+
from: N.overlayNodeId,
|
|
3003
|
+
to: T.overlayNodeId,
|
|
2959
3004
|
shape: P
|
|
2960
3005
|
}), !0;
|
|
2961
3006
|
}
|
|
@@ -3006,17 +3051,17 @@ class oe {
|
|
|
3006
3051
|
}
|
|
3007
3052
|
}
|
|
3008
3053
|
}
|
|
3009
|
-
class
|
|
3054
|
+
class ne {
|
|
3010
3055
|
constructor(e, t) {
|
|
3011
3056
|
this.applier = e, this.trigger = t, this.trigger.subscribe(() => {
|
|
3012
3057
|
this.applier.apply();
|
|
3013
3058
|
});
|
|
3014
3059
|
}
|
|
3015
3060
|
static configure(e, t) {
|
|
3016
|
-
new
|
|
3061
|
+
new ne(e, t);
|
|
3017
3062
|
}
|
|
3018
3063
|
}
|
|
3019
|
-
class
|
|
3064
|
+
class ae {
|
|
3020
3065
|
constructor(e, t, s) {
|
|
3021
3066
|
i(this, "applyScheduled", !1);
|
|
3022
3067
|
i(this, "apply", () => {
|
|
@@ -3033,7 +3078,7 @@ class ne {
|
|
|
3033
3078
|
});
|
|
3034
3079
|
}
|
|
3035
3080
|
static configure(e, t, s) {
|
|
3036
|
-
new
|
|
3081
|
+
new ae(
|
|
3037
3082
|
e,
|
|
3038
3083
|
t,
|
|
3039
3084
|
s
|
|
@@ -3043,23 +3088,23 @@ class ne {
|
|
|
3043
3088
|
this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
|
|
3044
3089
|
}
|
|
3045
3090
|
}
|
|
3046
|
-
class
|
|
3091
|
+
class Ut {
|
|
3047
3092
|
static configure(e, t) {
|
|
3048
|
-
const s = t.applyOn, o = new
|
|
3093
|
+
const s = t.applyOn, o = new Ft(e, t.algorithm, {
|
|
3049
3094
|
staticNodeResolver: t.staticNodeResolver,
|
|
3050
3095
|
onBeforeApplied: t.onBeforeApplied,
|
|
3051
3096
|
onAfterApplied: t.onAfterApplied
|
|
3052
3097
|
});
|
|
3053
3098
|
switch (s.type) {
|
|
3054
3099
|
case "trigger": {
|
|
3055
|
-
|
|
3100
|
+
ne.configure(
|
|
3056
3101
|
o,
|
|
3057
3102
|
s.trigger
|
|
3058
3103
|
);
|
|
3059
3104
|
break;
|
|
3060
3105
|
}
|
|
3061
3106
|
case "topologyChangeSchedule": {
|
|
3062
|
-
|
|
3107
|
+
ae.configure(
|
|
3063
3108
|
e.graph,
|
|
3064
3109
|
o,
|
|
3065
3110
|
s.schedule
|
|
@@ -3069,7 +3114,7 @@ class $t {
|
|
|
3069
3114
|
}
|
|
3070
3115
|
}
|
|
3071
3116
|
}
|
|
3072
|
-
class
|
|
3117
|
+
class Ot {
|
|
3073
3118
|
constructor(e, t) {
|
|
3074
3119
|
i(this, "previousTimeStamp");
|
|
3075
3120
|
i(this, "step", (e) => {
|
|
@@ -3084,7 +3129,7 @@ class Ut {
|
|
|
3084
3129
|
this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
|
|
3085
3130
|
}
|
|
3086
3131
|
}
|
|
3087
|
-
class
|
|
3132
|
+
class he {
|
|
3088
3133
|
constructor(e, t, s) {
|
|
3089
3134
|
i(this, "applier");
|
|
3090
3135
|
i(this, "step", (e) => {
|
|
@@ -3094,41 +3139,41 @@ class ae {
|
|
|
3094
3139
|
staticNodeResolver: t.staticNodeResolver,
|
|
3095
3140
|
onBeforeApplied: t.onBeforeApplied,
|
|
3096
3141
|
onAfterApplied: t.onAfterApplied
|
|
3097
|
-
}), new
|
|
3142
|
+
}), new Ot(this.win, this.step);
|
|
3098
3143
|
}
|
|
3099
3144
|
static configure(e, t, s) {
|
|
3100
|
-
new
|
|
3145
|
+
new he(e, t, s);
|
|
3101
3146
|
}
|
|
3102
3147
|
}
|
|
3103
|
-
const
|
|
3148
|
+
const Wt = () => {
|
|
3104
3149
|
const r = document.createElement("div");
|
|
3105
3150
|
return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
|
|
3106
|
-
},
|
|
3151
|
+
}, J = () => {
|
|
3107
3152
|
const r = document.createElement("div");
|
|
3108
3153
|
return r.style.position = "absolute", r.style.inset = "0", r;
|
|
3109
|
-
},
|
|
3110
|
-
const r =
|
|
3154
|
+
}, ve = () => {
|
|
3155
|
+
const r = J();
|
|
3111
3156
|
return r.style.pointerEvents = "none", r;
|
|
3112
3157
|
};
|
|
3113
|
-
class
|
|
3158
|
+
class zt {
|
|
3114
3159
|
constructor(e) {
|
|
3115
|
-
i(this, "background",
|
|
3116
|
-
i(this, "main",
|
|
3117
|
-
i(this, "overlayConnectablePorts",
|
|
3118
|
-
i(this, "overlayDraggableEdges",
|
|
3119
|
-
i(this, "host",
|
|
3160
|
+
i(this, "background", J());
|
|
3161
|
+
i(this, "main", J());
|
|
3162
|
+
i(this, "overlayConnectablePorts", ve());
|
|
3163
|
+
i(this, "overlayDraggableEdges", ve());
|
|
3164
|
+
i(this, "host", Wt());
|
|
3120
3165
|
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);
|
|
3121
3166
|
}
|
|
3122
3167
|
destroy() {
|
|
3123
3168
|
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);
|
|
3124
3169
|
}
|
|
3125
3170
|
}
|
|
3126
|
-
const
|
|
3127
|
-
var w, p, v,
|
|
3171
|
+
const kt = (r) => {
|
|
3172
|
+
var w, p, v, S, N, T;
|
|
3128
3173
|
const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
|
|
3129
3174
|
}), t = ((p = r.events) == null ? void 0 : p.onNodeDrag) ?? (() => {
|
|
3130
3175
|
}), s = r.nodeDragVerifier ?? (() => !0), o = ((v = r.events) == null ? void 0 : v.onNodeDragFinished) ?? (() => {
|
|
3131
|
-
}), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (
|
|
3176
|
+
}), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (S = r.mouse) == null ? void 0 : S.dragCursor, d = h !== void 0 ? h : "grab", c = (N = r.mouse) == null ? void 0 : N.mouseDownEventVerifier, g = c !== void 0 ? c : (P) => P.button === 0, l = (T = r.mouse) == null ? void 0 : T.mouseUpEventVerifier, u = l !== void 0 ? l : (P) => P.button === 0;
|
|
3132
3177
|
return {
|
|
3133
3178
|
moveOnTop: n,
|
|
3134
3179
|
moveEdgesOnTop: a,
|
|
@@ -3141,7 +3186,7 @@ const zt = (r) => {
|
|
|
3141
3186
|
nodeDragVerifier: s,
|
|
3142
3187
|
onNodeDragFinished: o
|
|
3143
3188
|
};
|
|
3144
|
-
},
|
|
3189
|
+
}, Ht = (r) => {
|
|
3145
3190
|
const e = r.minX !== null ? r.minX : -1 / 0, t = r.maxX !== null ? r.maxX : 1 / 0, s = r.minY !== null ? r.minY : -1 / 0, o = r.maxY !== null ? r.maxY : 1 / 0;
|
|
3146
3191
|
return (n) => {
|
|
3147
3192
|
let a = n.nextTransform.x, h = n.nextTransform.y;
|
|
@@ -3151,7 +3196,7 @@ const zt = (r) => {
|
|
|
3151
3196
|
const g = n.canvasHeight * n.prevTransform.scale, l = o - g;
|
|
3152
3197
|
return h > l && h > n.prevTransform.y && (h = Math.max(n.prevTransform.y, l)), { scale: n.nextTransform.scale, x: a, y: h };
|
|
3153
3198
|
};
|
|
3154
|
-
},
|
|
3199
|
+
}, Yt = (r) => {
|
|
3155
3200
|
const e = r.maxContentScale, t = r.minContentScale, s = e !== null ? 1 / e : 0, o = t !== null ? 1 / t : 1 / 0;
|
|
3156
3201
|
return (n) => {
|
|
3157
3202
|
const a = n.prevTransform, h = n.nextTransform;
|
|
@@ -3172,7 +3217,7 @@ const zt = (r) => {
|
|
|
3172
3217
|
y: g
|
|
3173
3218
|
};
|
|
3174
3219
|
};
|
|
3175
|
-
},
|
|
3220
|
+
}, Xt = (r) => (e) => r.reduce(
|
|
3176
3221
|
(t, s) => s({
|
|
3177
3222
|
prevTransform: e.prevTransform,
|
|
3178
3223
|
nextTransform: t,
|
|
@@ -3180,17 +3225,17 @@ const zt = (r) => {
|
|
|
3180
3225
|
canvasHeight: e.canvasHeight
|
|
3181
3226
|
}),
|
|
3182
3227
|
e.nextTransform
|
|
3183
|
-
),
|
|
3228
|
+
), xe = (r) => {
|
|
3184
3229
|
if (typeof r == "function")
|
|
3185
3230
|
return r;
|
|
3186
3231
|
switch (r.type) {
|
|
3187
3232
|
case "scale-limit":
|
|
3188
|
-
return
|
|
3233
|
+
return Yt({
|
|
3189
3234
|
minContentScale: r.minContentScale ?? 0,
|
|
3190
3235
|
maxContentScale: r.maxContentScale ?? 1 / 0
|
|
3191
3236
|
});
|
|
3192
3237
|
case "shift-limit":
|
|
3193
|
-
return
|
|
3238
|
+
return Ht({
|
|
3194
3239
|
minX: r.minX ?? -1 / 0,
|
|
3195
3240
|
maxX: r.maxX ?? 1 / 0,
|
|
3196
3241
|
minY: r.minY ?? -1 / 0,
|
|
@@ -3198,22 +3243,22 @@ const zt = (r) => {
|
|
|
3198
3243
|
});
|
|
3199
3244
|
}
|
|
3200
3245
|
}, Ae = (r) => {
|
|
3201
|
-
var p, v,
|
|
3246
|
+
var p, v, S, N, T, P, F, V, ce, le, ge, ue;
|
|
3202
3247
|
const e = (p = r == null ? void 0 : r.scale) == null ? void 0 : p.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, s = r == null ? void 0 : r.transformPreprocessor;
|
|
3203
3248
|
let o;
|
|
3204
|
-
s !== void 0 ? Array.isArray(s) ? o =
|
|
3249
|
+
s !== void 0 ? Array.isArray(s) ? o = Xt(
|
|
3205
3250
|
s.map(
|
|
3206
|
-
(
|
|
3251
|
+
(M) => xe(M)
|
|
3207
3252
|
)
|
|
3208
|
-
) : o =
|
|
3209
|
-
const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((
|
|
3210
|
-
}), h = ((
|
|
3211
|
-
}), d = (
|
|
3253
|
+
) : o = xe(s) : o = (M) => M.nextTransform;
|
|
3254
|
+
const n = ((v = r == null ? void 0 : r.shift) == null ? void 0 : v.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((S = r == null ? void 0 : r.events) == null ? void 0 : S.onBeforeTransformChange) ?? (() => {
|
|
3255
|
+
}), h = ((N = r == null ? void 0 : r.events) == null ? void 0 : N.onTransformChange) ?? (() => {
|
|
3256
|
+
}), d = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseDownEventVerifier, c = d !== void 0 ? d : (M) => M.button === 0, g = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseUpEventVerifier, l = g !== void 0 ? g : (M) => M.button === 0, u = (F = r == null ? void 0 : r.scale) == null ? void 0 : F.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
|
|
3212
3257
|
return {
|
|
3213
3258
|
wheelSensitivity: t,
|
|
3214
3259
|
onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
|
|
3215
3260
|
}),
|
|
3216
|
-
onTransformFinished: ((
|
|
3261
|
+
onTransformFinished: ((ce = r == null ? void 0 : r.events) == null ? void 0 : ce.onTransformFinished) ?? (() => {
|
|
3217
3262
|
}),
|
|
3218
3263
|
onBeforeTransformChange: a,
|
|
3219
3264
|
onTransformChange: h,
|
|
@@ -3222,35 +3267,35 @@ const zt = (r) => {
|
|
|
3222
3267
|
mouseDownEventVerifier: c,
|
|
3223
3268
|
mouseUpEventVerifier: l,
|
|
3224
3269
|
mouseWheelEventVerifier: w,
|
|
3225
|
-
scaleWheelFinishTimeout: ((
|
|
3226
|
-
onResizeTransformStarted: ((
|
|
3270
|
+
scaleWheelFinishTimeout: ((le = r == null ? void 0 : r.scale) == null ? void 0 : le.wheelFinishTimeout) ?? 500,
|
|
3271
|
+
onResizeTransformStarted: ((ge = r == null ? void 0 : r.events) == null ? void 0 : ge.onResizeTransformStarted) ?? (() => {
|
|
3227
3272
|
}),
|
|
3228
|
-
onResizeTransformFinished: ((
|
|
3273
|
+
onResizeTransformFinished: ((ue = r == null ? void 0 : r.events) == null ? void 0 : ue.onResizeTransformFinished) ?? (() => {
|
|
3229
3274
|
})
|
|
3230
3275
|
};
|
|
3231
|
-
},
|
|
3276
|
+
}, Gt = (r, e) => {
|
|
3232
3277
|
const t = document.createElementNS(
|
|
3233
3278
|
"http://www.w3.org/2000/svg",
|
|
3234
3279
|
"circle"
|
|
3235
3280
|
);
|
|
3236
3281
|
return t.setAttribute("cx", "0"), t.setAttribute("cy", "0"), t.setAttribute("r", `${r}`), t.setAttribute("fill", `${e}`), t;
|
|
3237
|
-
},
|
|
3282
|
+
}, jt = (r) => r instanceof SVGElement ? r : Gt(
|
|
3238
3283
|
(r == null ? void 0 : r.radius) ?? 1.5,
|
|
3239
3284
|
(r == null ? void 0 : r.color) ?? "#d8d8d8"
|
|
3240
|
-
),
|
|
3241
|
-
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, o =
|
|
3285
|
+
), Jt = (r) => {
|
|
3286
|
+
const e = r.tileDimensions, t = (e == null ? void 0 : e.width) ?? 25, s = (e == null ? void 0 : e.height) ?? 25, o = jt(r.renderer ?? {});
|
|
3242
3287
|
return {
|
|
3243
3288
|
tileWidth: t,
|
|
3244
3289
|
tileHeight: s,
|
|
3245
3290
|
renderer: o,
|
|
3246
3291
|
maxViewportScale: r.maxViewportScale ?? 10
|
|
3247
3292
|
};
|
|
3248
|
-
},
|
|
3293
|
+
}, de = (r) => {
|
|
3249
3294
|
if (typeof r == "function")
|
|
3250
3295
|
return r;
|
|
3251
3296
|
switch (r.type) {
|
|
3252
3297
|
case "straight":
|
|
3253
|
-
return () => new
|
|
3298
|
+
return () => new Nt({
|
|
3254
3299
|
color: r.color,
|
|
3255
3300
|
width: r.width,
|
|
3256
3301
|
arrowLength: r.arrowLength,
|
|
@@ -3264,7 +3309,7 @@ const zt = (r) => {
|
|
|
3264
3309
|
detourDirection: r.detourDirection
|
|
3265
3310
|
});
|
|
3266
3311
|
case "horizontal":
|
|
3267
|
-
return () => new
|
|
3312
|
+
return () => new bt({
|
|
3268
3313
|
color: r.color,
|
|
3269
3314
|
width: r.width,
|
|
3270
3315
|
arrowLength: r.arrowLength,
|
|
@@ -3301,7 +3346,7 @@ const zt = (r) => {
|
|
|
3301
3346
|
targetOffset: r.targetOffset
|
|
3302
3347
|
});
|
|
3303
3348
|
default:
|
|
3304
|
-
return () => new
|
|
3349
|
+
return () => new St({
|
|
3305
3350
|
color: r.color,
|
|
3306
3351
|
width: r.width,
|
|
3307
3352
|
arrowLength: r.arrowLength,
|
|
@@ -3315,7 +3360,7 @@ const zt = (r) => {
|
|
|
3315
3360
|
detourDirection: r.detourDirection
|
|
3316
3361
|
});
|
|
3317
3362
|
}
|
|
3318
|
-
},
|
|
3363
|
+
}, Kt = (r, e, t) => {
|
|
3319
3364
|
var c, g, l;
|
|
3320
3365
|
const s = () => "direct", o = (u) => u, n = (u) => u.button === 0, a = () => {
|
|
3321
3366
|
}, h = () => {
|
|
@@ -3330,9 +3375,9 @@ const zt = (r) => {
|
|
|
3330
3375
|
onEdgeCreationInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeCreationInterrupted) ?? d,
|
|
3331
3376
|
onEdgeCreationPrevented: ((l = r.events) == null ? void 0 : l.onEdgeCreationPrevented) ?? h,
|
|
3332
3377
|
dragPortDirection: r.dragPortDirection ?? t,
|
|
3333
|
-
edgeShapeFactory: r.edgeShape !== void 0 ?
|
|
3378
|
+
edgeShapeFactory: r.edgeShape !== void 0 ? de(r.edgeShape) : e
|
|
3334
3379
|
};
|
|
3335
|
-
},
|
|
3380
|
+
}, Qt = (r, e) => {
|
|
3336
3381
|
var c, g, l;
|
|
3337
3382
|
const t = (u) => u, s = (u) => u.button === 0 && u.ctrlKey, o = (u) => u.button === 0, n = (u) => {
|
|
3338
3383
|
const w = e.getPortAdjacentEdgeIds(u);
|
|
@@ -3346,15 +3391,15 @@ const zt = (r) => {
|
|
|
3346
3391
|
mouseDownEventVerifier: r.mouseDownEventVerifier ?? s,
|
|
3347
3392
|
mouseUpEventVerifier: r.mouseUpEventVerifier ?? o,
|
|
3348
3393
|
draggingEdgeResolver: r.draggingEdgeResolver ?? n,
|
|
3349
|
-
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ?
|
|
3394
|
+
draggingEdgeShapeFactory: r.draggingEdgeShape !== void 0 ? de(r.draggingEdgeShape) : null,
|
|
3350
3395
|
onAfterEdgeReattached: ((c = r.events) == null ? void 0 : c.onAfterEdgeReattached) ?? a,
|
|
3351
3396
|
onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
|
|
3352
3397
|
onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
|
|
3353
3398
|
};
|
|
3354
|
-
},
|
|
3399
|
+
}, Zt = (r) => ({
|
|
3355
3400
|
nodeVerticalRadius: r.nodeContainingRadius.vertical,
|
|
3356
3401
|
nodeHorizontalRadius: r.nodeContainingRadius.horizontal
|
|
3357
|
-
}),
|
|
3402
|
+
}), _t = (r) => {
|
|
3358
3403
|
var e, t;
|
|
3359
3404
|
return {
|
|
3360
3405
|
onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
|
|
@@ -3363,13 +3408,13 @@ const zt = (r) => {
|
|
|
3363
3408
|
})
|
|
3364
3409
|
};
|
|
3365
3410
|
};
|
|
3366
|
-
class
|
|
3411
|
+
class qt extends Error {
|
|
3367
3412
|
constructor() {
|
|
3368
3413
|
super(...arguments);
|
|
3369
3414
|
i(this, "name", "CanvasBuilderError");
|
|
3370
3415
|
}
|
|
3371
3416
|
}
|
|
3372
|
-
class
|
|
3417
|
+
class He {
|
|
3373
3418
|
constructor(e, t, s) {
|
|
3374
3419
|
i(this, "dt");
|
|
3375
3420
|
i(this, "nodeMass");
|
|
@@ -3407,7 +3452,7 @@ class ke {
|
|
|
3407
3452
|
});
|
|
3408
3453
|
}
|
|
3409
3454
|
}
|
|
3410
|
-
class
|
|
3455
|
+
class Ye {
|
|
3411
3456
|
constructor(e) {
|
|
3412
3457
|
i(this, "PI2", 2 * Math.PI);
|
|
3413
3458
|
this.rand = e;
|
|
@@ -3426,13 +3471,13 @@ class He {
|
|
|
3426
3471
|
return { ex: h, ey: d, d: a };
|
|
3427
3472
|
}
|
|
3428
3473
|
}
|
|
3429
|
-
const
|
|
3474
|
+
const Xe = (r) => {
|
|
3430
3475
|
if (r.distance === 0)
|
|
3431
3476
|
return r.maxForce;
|
|
3432
3477
|
const e = r.coefficient * (r.sourceCharge * r.targetCharge / (r.distance * r.distance));
|
|
3433
3478
|
return Math.min(e, r.maxForce);
|
|
3434
3479
|
};
|
|
3435
|
-
class
|
|
3480
|
+
class er {
|
|
3436
3481
|
constructor(e) {
|
|
3437
3482
|
i(this, "nodeCharge");
|
|
3438
3483
|
i(this, "distanceVectorGenerator");
|
|
@@ -3447,19 +3492,19 @@ class _t {
|
|
|
3447
3492
|
const d = s[h], c = e.get(a), g = e.get(d), l = this.distanceVectorGenerator.create(
|
|
3448
3493
|
c,
|
|
3449
3494
|
g
|
|
3450
|
-
), u =
|
|
3495
|
+
), u = Xe({
|
|
3451
3496
|
coefficient: 1,
|
|
3452
3497
|
sourceCharge: this.nodeCharge,
|
|
3453
3498
|
targetCharge: this.nodeCharge,
|
|
3454
3499
|
distance: l.d,
|
|
3455
3500
|
maxForce: this.maxForce
|
|
3456
|
-
}), w = u * l.ex, p = u * l.ey, v = t.get(a),
|
|
3457
|
-
v.x -= w, v.y -= p,
|
|
3501
|
+
}), w = u * l.ex, p = u * l.ey, v = t.get(a), S = t.get(d);
|
|
3502
|
+
v.x -= w, v.y -= p, S.x += w, S.y += p;
|
|
3458
3503
|
}
|
|
3459
3504
|
}
|
|
3460
3505
|
}
|
|
3461
3506
|
}
|
|
3462
|
-
const
|
|
3507
|
+
const tr = (r) => {
|
|
3463
3508
|
if (r.size === 0)
|
|
3464
3509
|
return {
|
|
3465
3510
|
centerX: 0,
|
|
@@ -3477,7 +3522,7 @@ const er = (r) => {
|
|
|
3477
3522
|
radius: h / 2
|
|
3478
3523
|
};
|
|
3479
3524
|
};
|
|
3480
|
-
class
|
|
3525
|
+
class rr {
|
|
3481
3526
|
constructor(e) {
|
|
3482
3527
|
i(this, "root");
|
|
3483
3528
|
i(this, "leaves", /* @__PURE__ */ new Map());
|
|
@@ -3634,7 +3679,7 @@ class tr {
|
|
|
3634
3679
|
}), { x: t / e.size, y: s / e.size };
|
|
3635
3680
|
}
|
|
3636
3681
|
}
|
|
3637
|
-
class
|
|
3682
|
+
class sr {
|
|
3638
3683
|
constructor(e) {
|
|
3639
3684
|
i(this, "areaRadiusThreshold");
|
|
3640
3685
|
i(this, "nodeMass");
|
|
@@ -3646,7 +3691,7 @@ class rr {
|
|
|
3646
3691
|
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;
|
|
3647
3692
|
}
|
|
3648
3693
|
apply(e, t) {
|
|
3649
|
-
const s =
|
|
3694
|
+
const s = tr(e), o = new rr({
|
|
3650
3695
|
box: s,
|
|
3651
3696
|
coords: e,
|
|
3652
3697
|
areaRadiusThreshold: this.areaRadiusThreshold,
|
|
@@ -3761,7 +3806,7 @@ class rr {
|
|
|
3761
3806
|
const t = this.distanceVectorGenerator.create(
|
|
3762
3807
|
e.sourceCoords,
|
|
3763
3808
|
e.targetCoords
|
|
3764
|
-
), s =
|
|
3809
|
+
), s = Xe({
|
|
3765
3810
|
coefficient: this.nodeForceCoefficient,
|
|
3766
3811
|
sourceCharge: e.sourceCharge,
|
|
3767
3812
|
targetCharge: e.targetCharge,
|
|
@@ -3796,7 +3841,7 @@ class rr {
|
|
|
3796
3841
|
}
|
|
3797
3842
|
}
|
|
3798
3843
|
}
|
|
3799
|
-
const
|
|
3844
|
+
const Ge = (r) => r.theta !== 0 ? new sr({
|
|
3800
3845
|
nodeCharge: r.nodeCharge,
|
|
3801
3846
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3802
3847
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
@@ -3804,13 +3849,13 @@ const Xe = (r) => r.theta !== 0 ? new rr({
|
|
|
3804
3849
|
theta: r.theta,
|
|
3805
3850
|
nodeMass: r.nodeMass,
|
|
3806
3851
|
areaRadiusThreshold: r.areaRadiusThreshold
|
|
3807
|
-
}) : new
|
|
3852
|
+
}) : new er({
|
|
3808
3853
|
nodeCharge: r.nodeCharge,
|
|
3809
3854
|
nodeForceCoefficient: r.nodeForceCoefficient,
|
|
3810
3855
|
distanceVectorGenerator: r.distanceVectorGenerator,
|
|
3811
3856
|
maxForce: r.maxForce
|
|
3812
3857
|
});
|
|
3813
|
-
class
|
|
3858
|
+
class je {
|
|
3814
3859
|
constructor(e) {
|
|
3815
3860
|
i(this, "rand");
|
|
3816
3861
|
i(this, "sparsity");
|
|
@@ -3833,7 +3878,7 @@ class Ge {
|
|
|
3833
3878
|
}), o;
|
|
3834
3879
|
}
|
|
3835
3880
|
}
|
|
3836
|
-
class
|
|
3881
|
+
class or {
|
|
3837
3882
|
constructor(e) {
|
|
3838
3883
|
i(this, "distanceVectorGenerator");
|
|
3839
3884
|
i(this, "nodeForcesApplicationStrategy");
|
|
@@ -3844,7 +3889,7 @@ class sr {
|
|
|
3844
3889
|
i(this, "edgeEquilibriumLength");
|
|
3845
3890
|
i(this, "edgeStiffness");
|
|
3846
3891
|
i(this, "convergenceVelocity");
|
|
3847
|
-
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new
|
|
3892
|
+
this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new Ye(e.rand), this.nodeForcesApplicationStrategy = Ge({
|
|
3848
3893
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
3849
3894
|
nodeCharge: e.nodeCharge,
|
|
3850
3895
|
maxForce: e.maxForce,
|
|
@@ -3852,7 +3897,7 @@ class sr {
|
|
|
3852
3897
|
theta: e.barnesHutTheta,
|
|
3853
3898
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
3854
3899
|
nodeMass: e.nodeMass
|
|
3855
|
-
}), this.fillerLayoutAlgorithm = new
|
|
3900
|
+
}), this.fillerLayoutAlgorithm = new je({
|
|
3856
3901
|
rand: e.rand,
|
|
3857
3902
|
sparsity: e.edgeEquilibriumLength
|
|
3858
3903
|
});
|
|
@@ -3862,7 +3907,7 @@ class sr {
|
|
|
3862
3907
|
graph: t,
|
|
3863
3908
|
viewport: s
|
|
3864
3909
|
});
|
|
3865
|
-
for (let n = 0; n < this.maxIterations && !(new
|
|
3910
|
+
for (let n = 0; n < this.maxIterations && !(new He(
|
|
3866
3911
|
t,
|
|
3867
3912
|
o,
|
|
3868
3913
|
{
|
|
@@ -3878,7 +3923,7 @@ class sr {
|
|
|
3878
3923
|
return o;
|
|
3879
3924
|
}
|
|
3880
3925
|
}
|
|
3881
|
-
class
|
|
3926
|
+
class ir {
|
|
3882
3927
|
constructor(e) {
|
|
3883
3928
|
i(this, "forest", /* @__PURE__ */ new Set());
|
|
3884
3929
|
i(this, "remainingNodeIds");
|
|
@@ -3897,10 +3942,10 @@ class or {
|
|
|
3897
3942
|
}, s = [];
|
|
3898
3943
|
this.forest.add({ root: t, sequence: s });
|
|
3899
3944
|
let o = [t];
|
|
3900
|
-
for (; o.length > 0; ) {
|
|
3945
|
+
for (this.remainingNodeIds.delete(t.nodeId); o.length > 0; ) {
|
|
3901
3946
|
const n = [];
|
|
3902
3947
|
o.forEach((a) => {
|
|
3903
|
-
s.push(a)
|
|
3948
|
+
s.push(a);
|
|
3904
3949
|
const h = this.graph.getNodeOutgoingEdgeIds(a.nodeId).map((g) => {
|
|
3905
3950
|
const l = this.graph.getEdge(g);
|
|
3906
3951
|
return this.graph.getPort(l.to).nodeId;
|
|
@@ -3914,6 +3959,7 @@ class or {
|
|
|
3914
3959
|
])).forEach((g) => {
|
|
3915
3960
|
if (!this.remainingNodeIds.has(g))
|
|
3916
3961
|
return;
|
|
3962
|
+
this.remainingNodeIds.delete(g);
|
|
3917
3963
|
const l = {
|
|
3918
3964
|
nodeId: g,
|
|
3919
3965
|
children: /* @__PURE__ */ new Set()
|
|
@@ -3924,7 +3970,7 @@ class or {
|
|
|
3924
3970
|
}
|
|
3925
3971
|
}
|
|
3926
3972
|
}
|
|
3927
|
-
class
|
|
3973
|
+
class nr {
|
|
3928
3974
|
constructor(e) {
|
|
3929
3975
|
this.params = e;
|
|
3930
3976
|
}
|
|
@@ -3965,12 +4011,12 @@ class ir {
|
|
|
3965
4011
|
return s - 2 * this.params.spaceAroundRadius;
|
|
3966
4012
|
}
|
|
3967
4013
|
}
|
|
3968
|
-
class
|
|
4014
|
+
class ar {
|
|
3969
4015
|
constructor(e, t) {
|
|
3970
4016
|
i(this, "offsets", /* @__PURE__ */ new Map());
|
|
3971
4017
|
i(this, "treeSpans", /* @__PURE__ */ new Map());
|
|
3972
4018
|
this.tree = e;
|
|
3973
|
-
const s = t.spaceAroundRadius, o = new
|
|
4019
|
+
const s = t.spaceAroundRadius, o = new nr({
|
|
3974
4020
|
spaceAroundRadius: s
|
|
3975
4021
|
});
|
|
3976
4022
|
[...this.tree.sequence].reverse().forEach((n) => {
|
|
@@ -3992,16 +4038,16 @@ class nr {
|
|
|
3992
4038
|
return this.offsets;
|
|
3993
4039
|
}
|
|
3994
4040
|
}
|
|
3995
|
-
class
|
|
4041
|
+
class hr {
|
|
3996
4042
|
constructor(e) {
|
|
3997
4043
|
this.params = e;
|
|
3998
4044
|
}
|
|
3999
4045
|
calculateCoordinates(e) {
|
|
4000
|
-
const t = /* @__PURE__ */ new Map(), o = new
|
|
4046
|
+
const t = /* @__PURE__ */ new Map(), o = new ir(e.graph).generate();
|
|
4001
4047
|
let n = 0;
|
|
4002
4048
|
return o.forEach((a) => {
|
|
4003
4049
|
t.set(a.root.nodeId, { x: n, y: 0 });
|
|
4004
|
-
const d = new
|
|
4050
|
+
const d = new ar(a, {
|
|
4005
4051
|
spaceAroundRadius: this.params.layerSpace / 2
|
|
4006
4052
|
}).generate();
|
|
4007
4053
|
let c = [a.root];
|
|
@@ -4022,7 +4068,7 @@ class ar {
|
|
|
4022
4068
|
}), t;
|
|
4023
4069
|
}
|
|
4024
4070
|
}
|
|
4025
|
-
class
|
|
4071
|
+
class dr {
|
|
4026
4072
|
constructor(e) {
|
|
4027
4073
|
i(this, "distanceVectorGenerator");
|
|
4028
4074
|
i(this, "nodeForcesApplicationStrategy");
|
|
@@ -4032,7 +4078,7 @@ class hr {
|
|
|
4032
4078
|
i(this, "edgeEquilibriumLength");
|
|
4033
4079
|
i(this, "edgeStiffness");
|
|
4034
4080
|
i(this, "fillerLayoutAlgorithm");
|
|
4035
|
-
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new
|
|
4081
|
+
this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new Ye(e.rand), this.nodeForcesApplicationStrategy = Ge({
|
|
4036
4082
|
distanceVectorGenerator: this.distanceVectorGenerator,
|
|
4037
4083
|
nodeCharge: e.nodeCharge,
|
|
4038
4084
|
maxForce: e.maxForce,
|
|
@@ -4040,7 +4086,7 @@ class hr {
|
|
|
4040
4086
|
theta: e.barnesHutTheta,
|
|
4041
4087
|
areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
|
|
4042
4088
|
nodeMass: e.nodeMass
|
|
4043
|
-
}), this.fillerLayoutAlgorithm = new
|
|
4089
|
+
}), this.fillerLayoutAlgorithm = new je({
|
|
4044
4090
|
rand: e.rand,
|
|
4045
4091
|
sparsity: e.edgeEquilibriumLength
|
|
4046
4092
|
});
|
|
@@ -4050,7 +4096,7 @@ class hr {
|
|
|
4050
4096
|
graph: t,
|
|
4051
4097
|
viewport: s
|
|
4052
4098
|
});
|
|
4053
|
-
return new
|
|
4099
|
+
return new He(
|
|
4054
4100
|
t,
|
|
4055
4101
|
n,
|
|
4056
4102
|
{
|
|
@@ -4067,16 +4113,16 @@ class hr {
|
|
|
4067
4113
|
}) ? /* @__PURE__ */ new Map() : n;
|
|
4068
4114
|
}
|
|
4069
4115
|
}
|
|
4070
|
-
const
|
|
4116
|
+
const Je = (r) => {
|
|
4071
4117
|
let e = 1779033703, t = 3144134277, s = 1013904242, o = 2773480762;
|
|
4072
4118
|
for (let n = 0, a; n < r.length; n++)
|
|
4073
4119
|
a = r.charCodeAt(n), e = t ^ Math.imul(e ^ a, 597399067), t = s ^ Math.imul(t ^ a, 2869860233), s = o ^ Math.imul(s ^ a, 951274213), o = e ^ Math.imul(o ^ a, 2716044179);
|
|
4074
4120
|
return e = Math.imul(s ^ e >>> 18, 597399067), t = Math.imul(o ^ t >>> 22, 2869860233), s = Math.imul(e ^ s >>> 17, 951274213), o = Math.imul(t ^ o >>> 19, 2716044179), e ^= t ^ s ^ o, t ^= e, s ^= e, o ^= e, [e >>> 0, t >>> 0, s >>> 0, o >>> 0];
|
|
4075
|
-
},
|
|
4121
|
+
}, Ke = (r, e, t, s) => function() {
|
|
4076
4122
|
r |= 0, e |= 0, t |= 0, s |= 0;
|
|
4077
4123
|
const o = (r + e | 0) + s | 0;
|
|
4078
4124
|
return s = s + 1 | 0, r = e ^ e >>> 9, e = t + (t << 3) | 0, t = t << 21 | t >>> 11, t = t + o | 0, (o >>> 0) / 4294967296;
|
|
4079
|
-
},
|
|
4125
|
+
}, x = Object.freeze({
|
|
4080
4126
|
seed: "HTMLGraph is awesome",
|
|
4081
4127
|
maxTimeDeltaSec: 0.01,
|
|
4082
4128
|
nodeCharge: 1e5,
|
|
@@ -4090,52 +4136,52 @@ const je = (r) => {
|
|
|
4090
4136
|
nodeForceCoefficient: 1,
|
|
4091
4137
|
barnesHutAreaRadiusThreshold: 0.01,
|
|
4092
4138
|
barnesHutTheta: 1
|
|
4093
|
-
}),
|
|
4139
|
+
}), cr = (r) => {
|
|
4094
4140
|
var e, t;
|
|
4095
4141
|
switch (r == null ? void 0 : r.type) {
|
|
4096
4142
|
case "custom":
|
|
4097
4143
|
return r.instance;
|
|
4098
4144
|
default: {
|
|
4099
|
-
const s =
|
|
4100
|
-
return new
|
|
4145
|
+
const s = Je((r == null ? void 0 : r.seed) ?? x.seed), o = Ke(s[0], s[1], s[2], s[3]);
|
|
4146
|
+
return new dr({
|
|
4101
4147
|
rand: o,
|
|
4102
|
-
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ??
|
|
4103
|
-
nodeCharge: (r == null ? void 0 : r.nodeCharge) ??
|
|
4104
|
-
nodeMass: (r == null ? void 0 : r.nodeMass) ??
|
|
4105
|
-
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ??
|
|
4106
|
-
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ??
|
|
4107
|
-
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ??
|
|
4108
|
-
maxForce: (r == null ? void 0 : r.maxForce) ??
|
|
4109
|
-
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ??
|
|
4110
|
-
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ??
|
|
4111
|
-
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ??
|
|
4148
|
+
maxTimeDeltaSec: (r == null ? void 0 : r.maxTimeDeltaSec) ?? x.maxTimeDeltaSec,
|
|
4149
|
+
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? x.nodeCharge,
|
|
4150
|
+
nodeMass: (r == null ? void 0 : r.nodeMass) ?? x.nodeMass,
|
|
4151
|
+
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? x.edgeEquilibriumLength,
|
|
4152
|
+
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? x.edgeStiffness,
|
|
4153
|
+
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? x.convergenceVelocity,
|
|
4154
|
+
maxForce: (r == null ? void 0 : r.maxForce) ?? x.maxForce,
|
|
4155
|
+
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? x.nodeForceCoefficient,
|
|
4156
|
+
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? x.barnesHutTheta,
|
|
4157
|
+
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? x.barnesHutAreaRadiusThreshold
|
|
4112
4158
|
});
|
|
4113
4159
|
}
|
|
4114
4160
|
}
|
|
4115
|
-
},
|
|
4161
|
+
}, j = {
|
|
4116
4162
|
staticNodeResolver: () => !1,
|
|
4117
4163
|
onBeforeApplied: () => {
|
|
4118
4164
|
},
|
|
4119
4165
|
onAfterApplied: () => {
|
|
4120
4166
|
}
|
|
4121
|
-
},
|
|
4167
|
+
}, lr = (r) => {
|
|
4122
4168
|
var t, s;
|
|
4123
4169
|
return {
|
|
4124
|
-
algorithm:
|
|
4125
|
-
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ??
|
|
4126
|
-
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ??
|
|
4127
|
-
onAfterApplied: ((s = r == null ? void 0 : r.events) == null ? void 0 : s.onAfterApplied) ??
|
|
4170
|
+
algorithm: cr((r == null ? void 0 : r.algorithm) ?? {}),
|
|
4171
|
+
staticNodeResolver: (r == null ? void 0 : r.staticNodeResolver) ?? j.staticNodeResolver,
|
|
4172
|
+
onBeforeApplied: ((t = r == null ? void 0 : r.events) == null ? void 0 : t.onBeforeApplied) ?? j.onBeforeApplied,
|
|
4173
|
+
onAfterApplied: ((s = r == null ? void 0 : r.events) == null ? void 0 : s.onAfterApplied) ?? j.onAfterApplied
|
|
4128
4174
|
};
|
|
4129
|
-
},
|
|
4175
|
+
}, gr = (r) => r instanceof Q ? {
|
|
4130
4176
|
type: "trigger",
|
|
4131
4177
|
trigger: r
|
|
4132
4178
|
} : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
|
|
4133
4179
|
type: "topologyChangeSchedule",
|
|
4134
|
-
schedule:
|
|
4180
|
+
schedule: Dt
|
|
4135
4181
|
} : {
|
|
4136
4182
|
type: "topologyChangeSchedule",
|
|
4137
|
-
schedule:
|
|
4138
|
-
},
|
|
4183
|
+
schedule: Rt
|
|
4184
|
+
}, I = Object.freeze({
|
|
4139
4185
|
staticNodeResolver: () => !1,
|
|
4140
4186
|
onBeforeApplied: () => {
|
|
4141
4187
|
},
|
|
@@ -4145,14 +4191,14 @@ const je = (r) => {
|
|
|
4145
4191
|
layerWidth: 300,
|
|
4146
4192
|
layerSpace: 300
|
|
4147
4193
|
}
|
|
4148
|
-
}),
|
|
4194
|
+
}), U = (r, e) => ({
|
|
4149
4195
|
a: r.a * e.a + r.b * e.d,
|
|
4150
4196
|
b: r.a * e.b + r.b * e.e,
|
|
4151
4197
|
c: r.a * e.c + r.b * e.f + r.c,
|
|
4152
4198
|
d: r.d * e.a + r.e * e.d,
|
|
4153
4199
|
e: r.d * e.b + r.e * e.e,
|
|
4154
4200
|
f: r.d * e.c + r.e * e.f + r.f
|
|
4155
|
-
}),
|
|
4201
|
+
}), ur = (r) => {
|
|
4156
4202
|
const { a: e, b: t, c: s, d: o, e: n, f: a } = r, h = e * n - t * o;
|
|
4157
4203
|
return {
|
|
4158
4204
|
a: n / h,
|
|
@@ -4163,7 +4209,7 @@ const je = (r) => {
|
|
|
4163
4209
|
f: (s * o - e * a) / h
|
|
4164
4210
|
};
|
|
4165
4211
|
};
|
|
4166
|
-
class
|
|
4212
|
+
class pr {
|
|
4167
4213
|
resolve(e) {
|
|
4168
4214
|
if ("shift" in e)
|
|
4169
4215
|
return this.createShiftBaseMatrix(e.shift);
|
|
@@ -4197,18 +4243,18 @@ class ur {
|
|
|
4197
4243
|
return this.createRelativeTransform(s, o);
|
|
4198
4244
|
}
|
|
4199
4245
|
createMirrorRelativeMatrix(e, t) {
|
|
4200
|
-
const s = this.createMirrorYBaseMatrix(), o =
|
|
4246
|
+
const s = this.createMirrorYBaseMatrix(), o = U(
|
|
4201
4247
|
this.createShiftBaseMatrix(t),
|
|
4202
4248
|
this.createRotateBaseMatrix(e)
|
|
4203
4249
|
);
|
|
4204
4250
|
return this.createRelativeTransform(s, o);
|
|
4205
4251
|
}
|
|
4206
4252
|
createRelativeTransform(e, t) {
|
|
4207
|
-
const s =
|
|
4253
|
+
const s = U(
|
|
4208
4254
|
t,
|
|
4209
4255
|
e
|
|
4210
|
-
), o =
|
|
4211
|
-
return
|
|
4256
|
+
), o = ur(t);
|
|
4257
|
+
return U(s, o);
|
|
4212
4258
|
}
|
|
4213
4259
|
createShiftBaseMatrix(e) {
|
|
4214
4260
|
return {
|
|
@@ -4252,7 +4298,7 @@ class ur {
|
|
|
4252
4298
|
};
|
|
4253
4299
|
}
|
|
4254
4300
|
}
|
|
4255
|
-
const
|
|
4301
|
+
const wr = (r) => {
|
|
4256
4302
|
if (r === void 0)
|
|
4257
4303
|
return (o) => o;
|
|
4258
4304
|
if (typeof r == "function")
|
|
@@ -4266,10 +4312,10 @@ const pr = (r) => {
|
|
|
4266
4312
|
e: 1,
|
|
4267
4313
|
f: 0
|
|
4268
4314
|
};
|
|
4269
|
-
const s = new
|
|
4315
|
+
const s = new pr();
|
|
4270
4316
|
return e.forEach((o) => {
|
|
4271
4317
|
const n = s.resolve(o);
|
|
4272
|
-
t =
|
|
4318
|
+
t = U(t, n);
|
|
4273
4319
|
}), (o) => {
|
|
4274
4320
|
const { x: n, y: a } = o;
|
|
4275
4321
|
return {
|
|
@@ -4277,45 +4323,45 @@ const pr = (r) => {
|
|
|
4277
4323
|
y: t.d * n + t.e * a + t.f
|
|
4278
4324
|
};
|
|
4279
4325
|
};
|
|
4280
|
-
},
|
|
4326
|
+
}, yr = (r) => {
|
|
4281
4327
|
var e, t;
|
|
4282
4328
|
switch (r == null ? void 0 : r.type) {
|
|
4283
4329
|
case "custom":
|
|
4284
4330
|
return r.instance;
|
|
4285
4331
|
case "hierarchical":
|
|
4286
|
-
return new
|
|
4287
|
-
layerWidth: r.layerWidth ??
|
|
4288
|
-
layerSpace: r.layerSpace ??
|
|
4289
|
-
transform:
|
|
4332
|
+
return new hr({
|
|
4333
|
+
layerWidth: r.layerWidth ?? I.hierarchicalLayout.layerWidth,
|
|
4334
|
+
layerSpace: r.layerSpace ?? I.hierarchicalLayout.layerSpace,
|
|
4335
|
+
transform: wr(r.transform)
|
|
4290
4336
|
});
|
|
4291
4337
|
default: {
|
|
4292
|
-
const s =
|
|
4293
|
-
return new
|
|
4294
|
-
dtSec: (r == null ? void 0 : r.dtSec) ??
|
|
4295
|
-
maxIterations: (r == null ? void 0 : r.maxIterations) ??
|
|
4338
|
+
const s = Je((r == null ? void 0 : r.seed) ?? x.seed), o = Ke(s[0], s[1], s[2], s[3]);
|
|
4339
|
+
return new or({
|
|
4340
|
+
dtSec: (r == null ? void 0 : r.dtSec) ?? x.dtSec,
|
|
4341
|
+
maxIterations: (r == null ? void 0 : r.maxIterations) ?? x.maxIterations,
|
|
4296
4342
|
rand: o,
|
|
4297
|
-
nodeCharge: (r == null ? void 0 : r.nodeCharge) ??
|
|
4298
|
-
nodeMass: (r == null ? void 0 : r.nodeMass) ??
|
|
4299
|
-
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ??
|
|
4300
|
-
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ??
|
|
4301
|
-
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ??
|
|
4302
|
-
maxForce: (r == null ? void 0 : r.maxForce) ??
|
|
4303
|
-
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ??
|
|
4304
|
-
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ??
|
|
4305
|
-
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ??
|
|
4343
|
+
nodeCharge: (r == null ? void 0 : r.nodeCharge) ?? x.nodeCharge,
|
|
4344
|
+
nodeMass: (r == null ? void 0 : r.nodeMass) ?? x.nodeMass,
|
|
4345
|
+
edgeEquilibriumLength: (r == null ? void 0 : r.edgeEquilibriumLength) ?? x.edgeEquilibriumLength,
|
|
4346
|
+
edgeStiffness: (r == null ? void 0 : r.edgeStiffness) ?? x.edgeStiffness,
|
|
4347
|
+
convergenceVelocity: (r == null ? void 0 : r.convergenceVelocity) ?? x.convergenceVelocity,
|
|
4348
|
+
maxForce: (r == null ? void 0 : r.maxForce) ?? x.maxForce,
|
|
4349
|
+
nodeForceCoefficient: (r == null ? void 0 : r.nodeForceCoefficient) ?? x.nodeForceCoefficient,
|
|
4350
|
+
barnesHutTheta: ((e = r == null ? void 0 : r.barnesHut) == null ? void 0 : e.theta) ?? x.barnesHutTheta,
|
|
4351
|
+
barnesHutAreaRadiusThreshold: ((t = r == null ? void 0 : r.barnesHut) == null ? void 0 : t.areaRadiusThreshold) ?? x.barnesHutAreaRadiusThreshold
|
|
4306
4352
|
});
|
|
4307
4353
|
}
|
|
4308
4354
|
}
|
|
4309
|
-
},
|
|
4355
|
+
}, fr = (r) => {
|
|
4310
4356
|
var e, t;
|
|
4311
4357
|
return {
|
|
4312
|
-
algorithm:
|
|
4313
|
-
applyOn:
|
|
4314
|
-
staticNodeResolver: r.staticNodeResolver ??
|
|
4315
|
-
onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ??
|
|
4316
|
-
onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ??
|
|
4358
|
+
algorithm: yr(r.algorithm),
|
|
4359
|
+
applyOn: gr(r.applyOn),
|
|
4360
|
+
staticNodeResolver: r.staticNodeResolver ?? I.staticNodeResolver,
|
|
4361
|
+
onBeforeApplied: ((e = r.events) == null ? void 0 : e.onBeforeApplied) ?? I.onBeforeApplied,
|
|
4362
|
+
onAfterApplied: ((t = r.events) == null ? void 0 : t.onAfterApplied) ?? I.onAfterApplied
|
|
4317
4363
|
};
|
|
4318
|
-
},
|
|
4364
|
+
}, mr = (r, e) => ({
|
|
4319
4365
|
...r,
|
|
4320
4366
|
onNodeDragStarted: (t) => {
|
|
4321
4367
|
e.add(t), r.onNodeDragStarted(t);
|
|
@@ -4323,7 +4369,7 @@ const pr = (r) => {
|
|
|
4323
4369
|
onNodeDragFinished: (t) => {
|
|
4324
4370
|
e.delete(t), r.onNodeDragFinished(t);
|
|
4325
4371
|
}
|
|
4326
|
-
}),
|
|
4372
|
+
}), vr = (r, e) => {
|
|
4327
4373
|
r.graph.onBeforeNodeRemoved.subscribe((t) => {
|
|
4328
4374
|
e.delete(t);
|
|
4329
4375
|
}), r.graph.onBeforeClear.subscribe(() => {
|
|
@@ -4331,41 +4377,41 @@ const pr = (r) => {
|
|
|
4331
4377
|
}), r.onBeforeDestroy.subscribe(() => {
|
|
4332
4378
|
e.clear();
|
|
4333
4379
|
});
|
|
4334
|
-
},
|
|
4380
|
+
}, xr = (r, e) => ({
|
|
4335
4381
|
...r,
|
|
4336
4382
|
staticNodeResolver: (t) => r.staticNodeResolver(t) || e.has(t)
|
|
4337
|
-
}),
|
|
4383
|
+
}), K = (r) => () => r, Ee = K(0), Ar = () => {
|
|
4338
4384
|
let r = 0;
|
|
4339
4385
|
return () => r++;
|
|
4340
|
-
},
|
|
4341
|
-
let t =
|
|
4386
|
+
}, Er = (r, e) => {
|
|
4387
|
+
let t = Ee, s = Ee;
|
|
4342
4388
|
const o = Ar();
|
|
4343
|
-
return r === "incremental" && (t = o), e === "incremental" && (s = o), typeof r == "number" && (t =
|
|
4389
|
+
return r === "incremental" && (t = o), e === "incremental" && (s = o), typeof r == "number" && (t = K(r)), typeof e == "number" && (s = K(e)), typeof r == "function" && (t = r), typeof e == "function" && (s = e), {
|
|
4344
4390
|
nodesPriorityFn: t,
|
|
4345
4391
|
edgesPriorityFn: s
|
|
4346
4392
|
};
|
|
4347
|
-
},
|
|
4393
|
+
}, Sr = (r) => {
|
|
4348
4394
|
var t, s, o, n, a;
|
|
4349
|
-
const e =
|
|
4395
|
+
const e = Er(
|
|
4350
4396
|
(t = r.nodes) == null ? void 0 : t.priority,
|
|
4351
4397
|
(s = r.edges) == null ? void 0 : s.priority
|
|
4352
4398
|
);
|
|
4353
4399
|
return {
|
|
4354
4400
|
nodes: {
|
|
4355
|
-
centerFn: ((o = r.nodes) == null ? void 0 : o.centerFn) ??
|
|
4401
|
+
centerFn: ((o = r.nodes) == null ? void 0 : o.centerFn) ?? Te,
|
|
4356
4402
|
priorityFn: e.nodesPriorityFn
|
|
4357
4403
|
},
|
|
4358
4404
|
ports: {
|
|
4359
4405
|
direction: ((n = r.ports) == null ? void 0 : n.direction) ?? 0
|
|
4360
4406
|
},
|
|
4361
4407
|
edges: {
|
|
4362
|
-
shapeFactory:
|
|
4408
|
+
shapeFactory: de(((a = r.edges) == null ? void 0 : a.shape) ?? {}),
|
|
4363
4409
|
priorityFn: e.edgesPriorityFn
|
|
4364
4410
|
}
|
|
4365
4411
|
};
|
|
4366
|
-
},
|
|
4412
|
+
}, br = (r) => r.applyOn.type === "topologyChangeSchedule" ? r.applyOn.schedule : ee, Nr = (r) => {
|
|
4367
4413
|
var s, o;
|
|
4368
|
-
const { canvasDefaults: e } = r, t = r.hasLayout ?
|
|
4414
|
+
const { canvasDefaults: e } = r, t = r.hasLayout ? br(r.layoutParams) : ee;
|
|
4369
4415
|
return {
|
|
4370
4416
|
focus: {
|
|
4371
4417
|
contentOffset: ((s = e.focus) == null ? void 0 : s.contentOffset) ?? 100,
|
|
@@ -4374,7 +4420,7 @@ const pr = (r) => {
|
|
|
4374
4420
|
}
|
|
4375
4421
|
};
|
|
4376
4422
|
};
|
|
4377
|
-
class
|
|
4423
|
+
class Tr {
|
|
4378
4424
|
constructor(e) {
|
|
4379
4425
|
i(this, "used", !1);
|
|
4380
4426
|
i(this, "canvasDefaults", {});
|
|
@@ -4394,7 +4440,7 @@ class Nr {
|
|
|
4394
4440
|
i(this, "hasUserDraggableEdges", !1);
|
|
4395
4441
|
i(this, "hasAnimatedLayout", !1);
|
|
4396
4442
|
i(this, "hasLayout", !1);
|
|
4397
|
-
i(this, "boxRenderingTrigger", new
|
|
4443
|
+
i(this, "boxRenderingTrigger", new Q());
|
|
4398
4444
|
i(this, "window", window);
|
|
4399
4445
|
i(this, "animationStaticNodes", /* @__PURE__ */ new Set());
|
|
4400
4446
|
this.element = e;
|
|
@@ -4431,42 +4477,44 @@ class Nr {
|
|
|
4431
4477
|
}
|
|
4432
4478
|
build() {
|
|
4433
4479
|
if (this.used)
|
|
4434
|
-
throw new
|
|
4480
|
+
throw new qt(
|
|
4481
|
+
"Failed to build Canvas because CanvasBuilder is a single-use object"
|
|
4482
|
+
);
|
|
4435
4483
|
this.used = !0;
|
|
4436
|
-
const e = new
|
|
4484
|
+
const e = new nt(this.element), t = new Ne(), s = new zt(this.element), o = this.createHtmlView(
|
|
4437
4485
|
s.main,
|
|
4438
4486
|
t,
|
|
4439
4487
|
e
|
|
4440
|
-
), n =
|
|
4488
|
+
), n = Sr(
|
|
4441
4489
|
this.canvasDefaults
|
|
4442
4490
|
), a = new Be(
|
|
4443
4491
|
t,
|
|
4444
4492
|
o,
|
|
4445
4493
|
n
|
|
4446
|
-
), h =
|
|
4494
|
+
), h = fr(this.layoutConfig), d = Nr({
|
|
4447
4495
|
canvasDefaults: this.canvasDefaults,
|
|
4448
4496
|
hasLayout: this.hasLayout,
|
|
4449
4497
|
layoutParams: h
|
|
4450
|
-
}), c = new
|
|
4498
|
+
}), c = new ze(
|
|
4451
4499
|
t,
|
|
4452
4500
|
e,
|
|
4453
4501
|
d
|
|
4454
|
-
), g = new
|
|
4502
|
+
), g = new Ue(e), l = new $e(t), u = new be(
|
|
4455
4503
|
l,
|
|
4456
4504
|
g,
|
|
4457
4505
|
a,
|
|
4458
4506
|
c
|
|
4459
4507
|
);
|
|
4460
|
-
if (this.hasBackground &&
|
|
4508
|
+
if (this.hasBackground && se.configure(
|
|
4461
4509
|
u,
|
|
4462
|
-
|
|
4510
|
+
Jt(this.backgroundConfig),
|
|
4463
4511
|
s.background
|
|
4464
|
-
), this.hasNodeResizeReactiveEdges &&
|
|
4465
|
-
let p =
|
|
4466
|
-
this.hasAnimatedLayout && (p =
|
|
4512
|
+
), this.hasNodeResizeReactiveEdges && Z.configure(u), this.hasDraggableNodes) {
|
|
4513
|
+
let p = kt(this.dragConfig);
|
|
4514
|
+
this.hasAnimatedLayout && (p = mr(
|
|
4467
4515
|
p,
|
|
4468
4516
|
this.animationStaticNodes
|
|
4469
|
-
)),
|
|
4517
|
+
)), te.configure(
|
|
4470
4518
|
u,
|
|
4471
4519
|
s.main,
|
|
4472
4520
|
this.window,
|
|
@@ -4474,12 +4522,12 @@ class Nr {
|
|
|
4474
4522
|
);
|
|
4475
4523
|
}
|
|
4476
4524
|
if (this.hasUserConnectablePorts) {
|
|
4477
|
-
const p =
|
|
4525
|
+
const p = Kt(
|
|
4478
4526
|
this.connectablePortsConfig,
|
|
4479
4527
|
n.edges.shapeFactory,
|
|
4480
4528
|
n.ports.direction
|
|
4481
4529
|
);
|
|
4482
|
-
|
|
4530
|
+
oe.configure(
|
|
4483
4531
|
u,
|
|
4484
4532
|
s.overlayConnectablePorts,
|
|
4485
4533
|
e,
|
|
@@ -4488,11 +4536,11 @@ class Nr {
|
|
|
4488
4536
|
);
|
|
4489
4537
|
}
|
|
4490
4538
|
if (this.hasUserDraggableEdges) {
|
|
4491
|
-
const p =
|
|
4539
|
+
const p = Qt(
|
|
4492
4540
|
this.draggableEdgesConfig,
|
|
4493
4541
|
u.graph
|
|
4494
4542
|
);
|
|
4495
|
-
|
|
4543
|
+
ie.configure(
|
|
4496
4544
|
u,
|
|
4497
4545
|
s.overlayDraggableEdges,
|
|
4498
4546
|
e,
|
|
@@ -4500,29 +4548,29 @@ class Nr {
|
|
|
4500
4548
|
p
|
|
4501
4549
|
);
|
|
4502
4550
|
}
|
|
4503
|
-
if (this.virtualScrollConfig !== void 0 ?
|
|
4551
|
+
if (this.virtualScrollConfig !== void 0 ? re.configure(
|
|
4504
4552
|
u,
|
|
4505
4553
|
s.main,
|
|
4506
4554
|
this.window,
|
|
4507
4555
|
Ae(this.transformConfig),
|
|
4508
4556
|
this.boxRenderingTrigger,
|
|
4509
|
-
|
|
4510
|
-
) : this.hasTransformableViewport &&
|
|
4557
|
+
Zt(this.virtualScrollConfig)
|
|
4558
|
+
) : this.hasTransformableViewport && X.configure(
|
|
4511
4559
|
u,
|
|
4512
4560
|
s.main,
|
|
4513
4561
|
this.window,
|
|
4514
4562
|
Ae(this.transformConfig)
|
|
4515
|
-
), this.hasLayout &&
|
|
4516
|
-
let p =
|
|
4563
|
+
), this.hasLayout && Ut.configure(u, h), this.hasAnimatedLayout) {
|
|
4564
|
+
let p = lr(
|
|
4517
4565
|
this.animatedLayoutConfig
|
|
4518
4566
|
);
|
|
4519
|
-
this.hasDraggableNodes && (
|
|
4567
|
+
this.hasDraggableNodes && (vr(
|
|
4520
4568
|
u,
|
|
4521
4569
|
this.animationStaticNodes
|
|
4522
|
-
), p =
|
|
4570
|
+
), p = xr(
|
|
4523
4571
|
p,
|
|
4524
4572
|
this.animationStaticNodes
|
|
4525
|
-
)),
|
|
4573
|
+
)), he.configure(u, p, this.window);
|
|
4526
4574
|
}
|
|
4527
4575
|
const w = () => {
|
|
4528
4576
|
s.destroy(), u.onBeforeDestroy.unsubscribe(w);
|
|
@@ -4530,27 +4578,27 @@ class Nr {
|
|
|
4530
4578
|
return u.onBeforeDestroy.subscribe(w), u;
|
|
4531
4579
|
}
|
|
4532
4580
|
createHtmlView(e, t, s) {
|
|
4533
|
-
let o = new
|
|
4534
|
-
return this.virtualScrollConfig !== void 0 && (o = new
|
|
4581
|
+
let o = new Se(t, s, e);
|
|
4582
|
+
return this.virtualScrollConfig !== void 0 && (o = new st(
|
|
4535
4583
|
o,
|
|
4536
4584
|
t,
|
|
4537
4585
|
this.boxRenderingTrigger,
|
|
4538
|
-
|
|
4539
|
-
)), o = new
|
|
4586
|
+
_t(this.virtualScrollConfig)
|
|
4587
|
+
)), o = new ot(o, t), o;
|
|
4540
4588
|
}
|
|
4541
4589
|
}
|
|
4542
4590
|
export {
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4591
|
+
St as BezierEdgeShape,
|
|
4592
|
+
Tr as CanvasBuilder,
|
|
4593
|
+
qt as CanvasBuilderError,
|
|
4594
|
+
A as CanvasError,
|
|
4595
|
+
R as ConnectionCategory,
|
|
4548
4596
|
Ve as DirectEdgeShape,
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4597
|
+
Q as EventSubject,
|
|
4598
|
+
bt as HorizontalEdgeShape,
|
|
4599
|
+
Mt as InteractiveEdgeError,
|
|
4600
|
+
Ie as InteractiveEdgeShape,
|
|
4553
4601
|
Cr as MidpointEdgeShape,
|
|
4554
|
-
|
|
4602
|
+
Nt as StraightEdgeShape,
|
|
4555
4603
|
Pt as VerticalEdgeShape
|
|
4556
4604
|
};
|