@html-graph/html-graph 7.7.0 → 7.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.
@@ -1,6 +1,6 @@
1
- var ze = Object.defineProperty;
2
- var ke = (r, e, t) => e in r ? ze(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var i = (r, e, t) => ke(r, typeof e != "symbol" ? e + "" : e, t);
1
+ var ke = Object.defineProperty;
2
+ var ze = (r, e, t) => e in r ? ke(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
4
  var M = /* @__PURE__ */ ((r) => (r.Line = "line", r.NodeCycle = "node-cycle", r.PortCycle = "port-cycle", r))(M || {});
5
5
  const He = () => {
6
6
  const r = document.createElement("div");
@@ -243,7 +243,7 @@ class qe {
243
243
  this.isEdgeValid(e) && (this.deferredEdges.delete(e), this.htmlView.attachEdge(e));
244
244
  }
245
245
  }
246
- class G {
246
+ class j {
247
247
  constructor() {
248
248
  i(this, "callbacks", /* @__PURE__ */ new Set());
249
249
  }
@@ -260,10 +260,10 @@ class G {
260
260
  }
261
261
  }
262
262
  const E = () => {
263
- const r = new G();
263
+ const r = new j();
264
264
  return [r, r];
265
265
  };
266
- class H {
266
+ class X {
267
267
  constructor(e) {
268
268
  i(this, "counter", 0);
269
269
  this.checkExists = e;
@@ -287,13 +287,13 @@ class b extends Error {
287
287
  }
288
288
  class ve {
289
289
  constructor(e, t, o, s, n, a) {
290
- i(this, "nodeIdGenerator", new H(
290
+ i(this, "nodeIdGenerator", new X(
291
291
  (e) => this.graphStore.getNode(e) !== void 0
292
292
  ));
293
- i(this, "portIdGenerator", new H(
293
+ i(this, "portIdGenerator", new X(
294
294
  (e) => this.graphStore.getPort(e) !== void 0
295
295
  ));
296
- i(this, "edgeIdGenerator", new H(
296
+ i(this, "edgeIdGenerator", new X(
297
297
  (e) => this.graphStore.getEdge(e) !== void 0
298
298
  ));
299
299
  i(this, "onAfterNodeAdded", (e) => {
@@ -809,7 +809,7 @@ class Qe {
809
809
  this.observer.disconnect();
810
810
  }
811
811
  }
812
- class j {
812
+ class q {
813
813
  constructor(e) {
814
814
  i(this, "elementToNodeId", /* @__PURE__ */ new Map());
815
815
  i(this, "nodesResizeObserver");
@@ -832,7 +832,7 @@ class j {
832
832
  }), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear);
833
833
  }
834
834
  static configure(e) {
835
- new j(e);
835
+ new q(e);
836
836
  }
837
837
  handleNodeResize(e) {
838
838
  const t = this.elementToNodeId.get(e);
@@ -900,7 +900,7 @@ const xe = (r, e) => {
900
900
  }
901
901
  return null;
902
902
  };
903
- var T = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(T || {});
903
+ var C = /* @__PURE__ */ ((r) => (r.StaticNodeId = "static", r.DraggingNodeId = "dragging", r.EdgeId = "edge", r))(C || {});
904
904
  const Se = (r, e) => ({
905
905
  x: r / 2,
906
906
  y: e / 2
@@ -926,7 +926,7 @@ const Se = (r, e) => ({
926
926
  flipX: d,
927
927
  flipY: c
928
928
  };
929
- }, O = (r, e, t, o) => ({
929
+ }, W = (r, e, t, o) => ({
930
930
  x: e * r.x + (1 - e) / 2 * o.x,
931
931
  y: t * r.y + (1 - t) / 2 * o.y
932
932
  });
@@ -1007,21 +1007,21 @@ class tt {
1007
1007
  `C ${y.x} ${y.y} ${x.x} ${x.y} ${w.x} ${w.y}`,
1008
1008
  `C ${S.x} ${S.y} ${A.x} ${A.y} ${l.x} ${l.y}`,
1009
1009
  `L ${o.x} ${o.y}`
1010
- ].join(" "), this.midpoint = O(w, e.flipX, e.flipY, e.to);
1010
+ ].join(" "), this.midpoint = W(w, e.flipX, e.flipY, e.to);
1011
1011
  }
1012
1012
  }
1013
- const q = Object.freeze({
1013
+ const K = Object.freeze({
1014
1014
  edgeColor: "--edge-color"
1015
1015
  }), Pe = (r) => {
1016
1016
  const e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1017
- return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(q.edgeColor, r), e;
1018
- }, Te = (r) => {
1017
+ return e.style.pointerEvents = "none", e.style.position = "absolute", e.style.top = "0", e.style.left = "0", e.style.overflow = "visible", e.style.setProperty(K.edgeColor, r), e;
1018
+ }, Ce = (r) => {
1019
1019
  const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
1020
- return e.setAttribute("stroke", `var(${q.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
1020
+ return e.setAttribute("stroke", `var(${K.edgeColor})`), e.setAttribute("stroke-width", `${r}`), e.setAttribute("fill", "none"), e;
1021
1021
  }, B = () => {
1022
1022
  const r = document.createElementNS("http://www.w3.org/2000/svg", "path");
1023
- return r.setAttribute("fill", `var(${q.edgeColor})`), r;
1024
- }, Ce = () => {
1023
+ return r.setAttribute("fill", `var(${K.edgeColor})`), r;
1024
+ }, Te = () => {
1025
1025
  const r = document.createElementNS("http://www.w3.org/2000/svg", "g");
1026
1026
  return r.style.transformOrigin = "50% 50%", r;
1027
1027
  }, De = (r, e) => {
@@ -1110,7 +1110,7 @@ class ot {
1110
1110
  this.params.targetDirection,
1111
1111
  this.params.to
1112
1112
  ), u = { x: l.x + d, y: l.y + c }, w = { x: (g.x + u.x) / 2, y: (g.y + u.y) / 2 };
1113
- this.midpoint = O(w, e.flipX, e.flipY, e.to), this.path = N(
1113
+ this.midpoint = W(w, e.flipX, e.flipY, e.to), this.path = N(
1114
1114
  [t, n, g, u, l, o],
1115
1115
  this.params.roundness
1116
1116
  );
@@ -1185,7 +1185,7 @@ class it {
1185
1185
  );
1186
1186
  }
1187
1187
  }
1188
- class K {
1188
+ class Q {
1189
1189
  constructor(e) {
1190
1190
  i(this, "path");
1191
1191
  i(this, "midpoint");
@@ -1290,7 +1290,7 @@ class ht {
1290
1290
  x: (n.x + a.x) / 2,
1291
1291
  y: g
1292
1292
  };
1293
- this.midpoint = O(l, e.flipX, e.flipY, e.to), this.path = N(
1293
+ this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = N(
1294
1294
  [
1295
1295
  t,
1296
1296
  n,
@@ -1331,7 +1331,7 @@ class dt {
1331
1331
  x: g,
1332
1332
  y: (n.y + a.y) / 2
1333
1333
  };
1334
- this.midpoint = O(l, e.flipX, e.flipY, e.to), this.path = N(
1334
+ this.midpoint = W(l, e.flipX, e.flipY, e.to), this.path = N(
1335
1335
  [
1336
1336
  t,
1337
1337
  n,
@@ -1367,17 +1367,17 @@ const f = Object.freeze({
1367
1367
  interactiveWidth: 10,
1368
1368
  preOffset: 0
1369
1369
  }), ge = (r, e, t) => ({ x: e * Math.cos(r), y: t * Math.sin(r) });
1370
- class W {
1370
+ class k {
1371
1371
  constructor(e) {
1372
1372
  i(this, "svg");
1373
- i(this, "group", Ce());
1373
+ i(this, "group", Te());
1374
1374
  i(this, "line");
1375
1375
  i(this, "sourceArrow", null);
1376
1376
  i(this, "targetArrow", null);
1377
1377
  i(this, "onAfterRender");
1378
1378
  i(this, "afterRenderEmitter");
1379
1379
  i(this, "arrowRenderer");
1380
- this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Pe(e.color), this.svg.appendChild(this.group), this.line = Te(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = B(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = B(), this.group.appendChild(this.targetArrow));
1380
+ this.params = e, [this.afterRenderEmitter, this.onAfterRender] = E(), this.arrowRenderer = this.params.arrowRenderer, this.svg = Pe(e.color), this.svg.appendChild(this.group), this.line = Ce(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = B(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = B(), this.group.appendChild(this.targetArrow));
1381
1381
  }
1382
1382
  render(e) {
1383
1383
  const { x: t, y: o, width: s, height: n, flipX: a, flipY: h } = be(
@@ -1533,7 +1533,7 @@ class ut {
1533
1533
  hasSourceArrow: this.hasSourceArrow,
1534
1534
  hasTargetArrow: this.hasTargetArrow
1535
1535
  }));
1536
- 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 W({
1536
+ 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 k({
1537
1537
  color: (e == null ? void 0 : e.color) ?? f.color,
1538
1538
  width: (e == null ? void 0 : e.width) ?? f.width,
1539
1539
  arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
@@ -1565,7 +1565,7 @@ class pt {
1565
1565
  i(this, "hasSourceArrow");
1566
1566
  i(this, "hasTargetArrow");
1567
1567
  i(this, "pathShape");
1568
- i(this, "createCyclePath", (e) => new K({
1568
+ i(this, "createCyclePath", (e) => new Q({
1569
1569
  sourceDirection: e,
1570
1570
  arrowLength: this.arrowLength,
1571
1571
  side: this.cycleSquareSide,
@@ -1604,7 +1604,7 @@ class pt {
1604
1604
  t,
1605
1605
  this.arrowOffset,
1606
1606
  this.cycleSquareSide / 2
1607
- ), 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 W({
1607
+ ), 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 k({
1608
1608
  color: (e == null ? void 0 : e.color) ?? f.color,
1609
1609
  width: (e == null ? void 0 : e.width) ?? f.width,
1610
1610
  arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
@@ -1637,7 +1637,7 @@ class wt {
1637
1637
  i(this, "hasSourceArrow");
1638
1638
  i(this, "hasTargetArrow");
1639
1639
  i(this, "pathShape");
1640
- i(this, "createCyclePath", (e) => new K({
1640
+ i(this, "createCyclePath", (e) => new Q({
1641
1641
  sourceDirection: e,
1642
1642
  arrowLength: this.arrowLength,
1643
1643
  side: this.cycleSquareSide,
@@ -1676,7 +1676,7 @@ class wt {
1676
1676
  t,
1677
1677
  this.arrowOffset,
1678
1678
  this.cycleSquareSide / 2
1679
- ), 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 W({
1679
+ ), 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 k({
1680
1680
  color: (e == null ? void 0 : e.color) ?? f.color,
1681
1681
  width: (e == null ? void 0 : e.width) ?? f.width,
1682
1682
  arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
@@ -1708,7 +1708,7 @@ class ft {
1708
1708
  i(this, "hasSourceArrow");
1709
1709
  i(this, "hasTargetArrow");
1710
1710
  i(this, "pathShape");
1711
- i(this, "createCyclePath", (e) => new K({
1711
+ i(this, "createCyclePath", (e) => new Q({
1712
1712
  sourceDirection: e,
1713
1713
  arrowLength: this.arrowLength,
1714
1714
  side: this.cycleSquareSide,
@@ -1747,7 +1747,7 @@ class ft {
1747
1747
  t,
1748
1748
  this.arrowOffset,
1749
1749
  this.cycleSquareSide / 2
1750
- ), 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 W({
1750
+ ), 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 k({
1751
1751
  color: (e == null ? void 0 : e.color) ?? f.color,
1752
1752
  width: (e == null ? void 0 : e.width) ?? f.width,
1753
1753
  arrowRenderer: F((e == null ? void 0 : e.arrowRenderer) ?? {}),
@@ -1766,7 +1766,7 @@ class ft {
1766
1766
  class Ne {
1767
1767
  constructor(e) {
1768
1768
  i(this, "svg");
1769
- i(this, "group", Ce());
1769
+ i(this, "group", Te());
1770
1770
  i(this, "line");
1771
1771
  i(this, "sourceArrow", null);
1772
1772
  i(this, "targetArrow", null);
@@ -1778,7 +1778,7 @@ class Ne {
1778
1778
  i(this, "onAfterRender");
1779
1779
  i(this, "afterRenderEmitter");
1780
1780
  i(this, "arrowRenderer");
1781
- [this.afterRenderEmitter, this.onAfterRender] = E(), 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 = F((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 = Pe(this.color), this.svg.appendChild(this.group), this.line = Te(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = B(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = B(), this.group.appendChild(this.targetArrow));
1781
+ [this.afterRenderEmitter, this.onAfterRender] = E(), 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 = F((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 = Pe(this.color), this.svg.appendChild(this.group), this.line = Ce(this.width), this.group.appendChild(this.line), e != null && e.hasSourceArrow && (this.sourceArrow = B(), this.group.appendChild(this.sourceArrow)), e != null && e.hasTargetArrow && (this.targetArrow = B(), this.group.appendChild(this.targetArrow));
1782
1782
  }
1783
1783
  render(e) {
1784
1784
  const { x: t, y: o, width: s, height: n, flipX: a, flipY: h } = be(
@@ -2141,7 +2141,7 @@ class z {
2141
2141
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2142
2142
  }
2143
2143
  }
2144
- class Q {
2144
+ class Z {
2145
2145
  constructor(e, t, o, s) {
2146
2146
  i(this, "grabbedNode", null);
2147
2147
  i(this, "maxNodePriority", 0);
@@ -2262,7 +2262,7 @@ class Q {
2262
2262
  this.canvas = e, this.element = t, this.window = o, this.params = s, 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.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2263
2263
  }
2264
2264
  static configure(e, t, o, s) {
2265
- new Q(e, t, o, s);
2265
+ new Z(e, t, o, s);
2266
2266
  }
2267
2267
  moveNode(e, t) {
2268
2268
  if (this.graph.getNode(e.nodeId) === null)
@@ -2358,7 +2358,7 @@ const At = (r, e, t) => ({
2358
2358
  touches: e
2359
2359
  };
2360
2360
  };
2361
- class k {
2361
+ class H {
2362
2362
  constructor(e, t, o, s) {
2363
2363
  i(this, "viewport");
2364
2364
  i(this, "prevTouches", null);
@@ -2448,7 +2448,7 @@ class k {
2448
2448
  }), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
2449
2449
  }
2450
2450
  static configure(e, t, o, s) {
2451
- new k(e, t, o, s);
2451
+ new H(e, t, o, s);
2452
2452
  }
2453
2453
  moveViewport(e, t) {
2454
2454
  const o = this.viewport.getViewportMatrix(), s = At(o, e, t), { width: n, height: a } = this.viewport.getDimensions(), h = this.params.transformPreprocessor({
@@ -2499,7 +2499,7 @@ class k {
2499
2499
  this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(s), this.params.onResizeTransformFinished();
2500
2500
  }
2501
2501
  }
2502
- class Z {
2502
+ class J {
2503
2503
  constructor(e, t, o, s, n, a) {
2504
2504
  i(this, "nodeHorizontal");
2505
2505
  i(this, "nodeVertical");
@@ -2546,7 +2546,7 @@ class Z {
2546
2546
  this.scheduleLoadAreaAroundViewport(), s.onTransformFinished();
2547
2547
  }
2548
2548
  };
2549
- k.configure(
2549
+ H.configure(
2550
2550
  e,
2551
2551
  this.element,
2552
2552
  this.window,
@@ -2554,7 +2554,7 @@ class Z {
2554
2554
  ), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
2555
2555
  }
2556
2556
  static configure(e, t, o, s, n, a) {
2557
- new Z(
2557
+ new J(
2558
2558
  e,
2559
2559
  t,
2560
2560
  o,
@@ -2597,7 +2597,7 @@ const xt = () => {
2597
2597
  );
2598
2598
  return r.setAttribute("id", "pattern"), r;
2599
2599
  };
2600
- class J {
2600
+ class _ {
2601
2601
  constructor(e, t, o) {
2602
2602
  i(this, "svg", xt());
2603
2603
  i(this, "patternRenderingRectangle", St());
@@ -2622,7 +2622,7 @@ class J {
2622
2622
  }), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated();
2623
2623
  }
2624
2624
  static configure(e, t, o) {
2625
- new J(e, t, o);
2625
+ new _(e, t, o);
2626
2626
  }
2627
2627
  updateVisibility() {
2628
2628
  const t = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
@@ -2635,7 +2635,7 @@ class J {
2635
2635
  this.pattern.setAttribute("width", `${o}`), this.pattern.setAttribute("height", `${s}`);
2636
2636
  }
2637
2637
  }
2638
- class _ {
2638
+ class ee {
2639
2639
  constructor(e, t, o, s, n) {
2640
2640
  i(this, "overlayCanvas");
2641
2641
  i(this, "staticPortId", null);
@@ -2670,7 +2670,7 @@ class _ {
2670
2670
  );
2671
2671
  }
2672
2672
  static configure(e, t, o, s, n) {
2673
- new _(
2673
+ new ee(
2674
2674
  e,
2675
2675
  t,
2676
2676
  o,
@@ -2688,11 +2688,11 @@ class _ {
2688
2688
  x: t.x - d.x,
2689
2689
  y: t.y - d.y
2690
2690
  }), l = {
2691
- overlayNodeId: T.StaticNodeId,
2691
+ overlayNodeId: C.StaticNodeId,
2692
2692
  portCoords: c,
2693
2693
  portDirection: s.direction
2694
2694
  }, u = {
2695
- overlayNodeId: T.DraggingNodeId,
2695
+ overlayNodeId: C.DraggingNodeId,
2696
2696
  portCoords: g,
2697
2697
  portDirection: this.params.dragPortDirection
2698
2698
  };
@@ -2701,7 +2701,7 @@ class _ {
2701
2701
  this.overlayCanvas.addNode(U(w)), this.overlayCanvas.addNode(U(y)), this.overlayCanvas.addEdge({
2702
2702
  from: w.overlayNodeId,
2703
2703
  to: y.overlayNodeId,
2704
- shape: this.params.edgeShapeFactory(T.EdgeId)
2704
+ shape: this.params.edgeShapeFactory(C.EdgeId)
2705
2705
  });
2706
2706
  }
2707
2707
  resetDragState() {
@@ -2724,13 +2724,13 @@ class _ {
2724
2724
  x: e.x - t.x,
2725
2725
  y: e.y - t.y
2726
2726
  });
2727
- this.overlayCanvas.updateNode(T.DraggingNodeId, {
2727
+ this.overlayCanvas.updateNode(C.DraggingNodeId, {
2728
2728
  x: o.x,
2729
2729
  y: o.y
2730
2730
  });
2731
2731
  }
2732
2732
  }
2733
- class ee {
2733
+ class te {
2734
2734
  constructor(e, t, o, s, n) {
2735
2735
  i(this, "overlayCanvas");
2736
2736
  i(this, "staticPortId", null);
@@ -2763,7 +2763,7 @@ class ee {
2763
2763
  );
2764
2764
  }
2765
2765
  static configure(e, t, o, s, n) {
2766
- new ee(
2766
+ new te(
2767
2767
  e,
2768
2768
  t,
2769
2769
  o,
@@ -2798,20 +2798,20 @@ class ee {
2798
2798
  priority: s.priority
2799
2799
  }, this.canvas.removeEdge(o);
2800
2800
  const A = {
2801
- overlayNodeId: T.StaticNodeId,
2801
+ overlayNodeId: C.StaticNodeId,
2802
2802
  portCoords: w,
2803
2803
  portDirection: c.direction
2804
2804
  }, x = {
2805
- overlayNodeId: T.DraggingNodeId,
2805
+ overlayNodeId: C.DraggingNodeId,
2806
2806
  portCoords: y,
2807
2807
  portDirection: d.direction
2808
- }, [S, C] = this.isTargetDragging ? [A, x] : [x, A];
2809
- this.overlayCanvas.addNode(U(S)), this.overlayCanvas.addNode(U(C));
2810
- const P = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(T.EdgeId) : s.shape;
2808
+ }, [S, T] = this.isTargetDragging ? [A, x] : [x, A];
2809
+ this.overlayCanvas.addNode(U(S)), this.overlayCanvas.addNode(U(T));
2810
+ const P = this.params.draggingEdgeShapeFactory !== null ? this.params.draggingEdgeShapeFactory(C.EdgeId) : s.shape;
2811
2811
  return this.overlayCanvas.addEdge({
2812
- id: T.EdgeId,
2812
+ id: C.EdgeId,
2813
2813
  from: S.overlayNodeId,
2814
- to: C.overlayNodeId,
2814
+ to: T.overlayNodeId,
2815
2815
  shape: P
2816
2816
  }), !0;
2817
2817
  }
@@ -2823,14 +2823,14 @@ class ee {
2823
2823
  x: e.x - t.x,
2824
2824
  y: e.y - t.y
2825
2825
  }, s = this.canvas.viewport.createContentCoords(o);
2826
- this.overlayCanvas.updateNode(T.DraggingNodeId, {
2826
+ this.overlayCanvas.updateNode(C.DraggingNodeId, {
2827
2827
  x: s.x,
2828
2828
  y: s.y
2829
2829
  });
2830
2830
  }
2831
2831
  tryCreateConnection(e) {
2832
2832
  const t = xe(this.canvas.graph, e);
2833
- if (this.overlayCanvas.removeEdge(T.EdgeId), t === null) {
2833
+ if (this.overlayCanvas.removeEdge(C.EdgeId), t === null) {
2834
2834
  const d = this.draggingEdgePayload;
2835
2835
  this.params.onEdgeReattachInterrupted({
2836
2836
  id: d.id,
@@ -2862,14 +2862,14 @@ class ee {
2862
2862
  }
2863
2863
  }
2864
2864
  }
2865
- class te {
2865
+ class re {
2866
2866
  constructor(e, t, o) {
2867
2867
  this.canvas = e, this.layoutAlgorithm = t, this.trigger = o, this.trigger.subscribe(() => {
2868
2868
  this.applyLayout();
2869
2869
  });
2870
2870
  }
2871
2871
  static configure(e, t, o) {
2872
- new te(
2872
+ new re(
2873
2873
  e,
2874
2874
  t,
2875
2875
  o
@@ -2884,10 +2884,18 @@ class te {
2884
2884
  });
2885
2885
  }
2886
2886
  }
2887
- class re {
2888
- constructor(e, t) {
2887
+ class O {
2888
+ constructor(e, t, o) {
2889
2889
  i(this, "applyScheduled", !1);
2890
- this.canvas = e, this.layoutAlgorithm = t, this.canvas.graph.onAfterNodeAdded.subscribe(() => {
2890
+ i(this, "apply", () => {
2891
+ this.applyScheduled = !1, this.layoutAlgorithm.calculateCoordinates(
2892
+ this.canvas.graph,
2893
+ this.canvas.viewport
2894
+ ).forEach((t, o) => {
2895
+ this.canvas.updateNode(o, t);
2896
+ });
2897
+ });
2898
+ this.canvas = e, this.layoutAlgorithm = t, this.defererFn = o, this.canvas.graph.onAfterNodeAdded.subscribe(() => {
2891
2899
  this.scheduleApply();
2892
2900
  }), this.canvas.graph.onBeforeNodeRemoved.subscribe(() => {
2893
2901
  this.scheduleApply();
@@ -2897,24 +2905,15 @@ class re {
2897
2905
  this.scheduleApply();
2898
2906
  });
2899
2907
  }
2900
- static configure(e, t) {
2901
- new re(
2908
+ static configure(e, t, o) {
2909
+ new O(
2902
2910
  e,
2903
- t
2911
+ t,
2912
+ o
2904
2913
  );
2905
2914
  }
2906
2915
  scheduleApply() {
2907
- this.applyScheduled || (this.applyScheduled = !0, setTimeout(() => {
2908
- this.applyScheduled = !1, this.applyLayout();
2909
- }));
2910
- }
2911
- applyLayout() {
2912
- this.layoutAlgorithm.calculateCoordinates(
2913
- this.canvas.graph,
2914
- this.canvas.viewport
2915
- ).forEach((t, o) => {
2916
- this.canvas.updateNode(o, t);
2917
- });
2916
+ this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
2918
2917
  }
2919
2918
  }
2920
2919
  class Pt {
@@ -2922,24 +2921,41 @@ class Pt {
2922
2921
  const o = t.applyOn;
2923
2922
  switch (o.type) {
2924
2923
  case "manual": {
2925
- te.configure(
2924
+ re.configure(
2926
2925
  e,
2927
2926
  t.algorithm,
2928
2927
  o.trigger
2929
2928
  );
2930
2929
  break;
2931
2930
  }
2932
- case "topologyChangeTimeout": {
2933
- re.configure(
2931
+ case "topologyChangeMacrotask": {
2932
+ O.configure(
2934
2933
  e,
2935
- t.algorithm
2934
+ t.algorithm,
2935
+ (s) => {
2936
+ setTimeout(() => {
2937
+ s();
2938
+ });
2939
+ }
2940
+ );
2941
+ break;
2942
+ }
2943
+ case "topologyChangeMicrotask": {
2944
+ O.configure(
2945
+ e,
2946
+ t.algorithm,
2947
+ (s) => {
2948
+ queueMicrotask(() => {
2949
+ s();
2950
+ });
2951
+ }
2936
2952
  );
2937
2953
  break;
2938
2954
  }
2939
2955
  }
2940
2956
  }
2941
2957
  }
2942
- class Tt {
2958
+ class Ct {
2943
2959
  constructor(e, t) {
2944
2960
  i(this, "previousTimeStamp");
2945
2961
  i(this, "step", (e) => {
@@ -2965,42 +2981,42 @@ class oe {
2965
2981
  this.staticNodes.has(s) || this.canvas.updateNode(s, { x: o.x, y: o.y });
2966
2982
  });
2967
2983
  });
2968
- this.canvas = e, this.algorithm = t, this.staticNodes = o, this.win = s, new Tt(this.win, this.step);
2984
+ this.canvas = e, this.algorithm = t, this.staticNodes = o, this.win = s, new Ct(this.win, this.step);
2969
2985
  }
2970
2986
  static configure(e, t, o, s) {
2971
2987
  new oe(e, t, o, s);
2972
2988
  }
2973
2989
  }
2974
- const Ct = () => {
2990
+ const Tt = () => {
2975
2991
  const r = document.createElement("div");
2976
2992
  return r.style.width = "100%", r.style.height = "100%", r.style.position = "relative", r;
2977
- }, X = () => {
2993
+ }, Y = () => {
2978
2994
  const r = document.createElement("div");
2979
2995
  return r.style.position = "absolute", r.style.inset = "0", r;
2980
2996
  }, pe = () => {
2981
- const r = X();
2997
+ const r = Y();
2982
2998
  return r.style.pointerEvents = "none", r;
2983
2999
  };
2984
3000
  class Dt {
2985
3001
  constructor(e) {
2986
- i(this, "background", X());
2987
- i(this, "main", X());
3002
+ i(this, "background", Y());
3003
+ i(this, "main", Y());
2988
3004
  i(this, "overlayConnectablePorts", pe());
2989
3005
  i(this, "overlayDraggableEdges", pe());
2990
- i(this, "host", Ct());
3006
+ i(this, "host", Tt());
2991
3007
  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);
2992
3008
  }
2993
3009
  destroy() {
2994
3010
  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);
2995
3011
  }
2996
3012
  }
2997
- const Y = (r) => () => r, we = Y(0), Nt = () => {
3013
+ const G = (r) => () => r, we = G(0), Nt = () => {
2998
3014
  let r = 0;
2999
3015
  return () => r++;
3000
3016
  }, Mt = (r, e) => {
3001
3017
  let t = we, o = we;
3002
3018
  const s = Nt();
3003
- return r === "incremental" && (t = s), e === "incremental" && (o = s), typeof r == "number" && (t = Y(r)), typeof e == "number" && (o = Y(e)), typeof r == "function" && (t = r), typeof e == "function" && (o = e), {
3019
+ return r === "incremental" && (t = s), e === "incremental" && (o = s), typeof r == "number" && (t = G(r)), typeof e == "number" && (o = G(e)), typeof r == "function" && (t = r), typeof e == "function" && (o = e), {
3004
3020
  nodesPriorityFn: t,
3005
3021
  edgesPriorityFn: o
3006
3022
  };
@@ -3094,11 +3110,11 @@ const Y = (r) => () => r, we = Y(0), Nt = () => {
3094
3110
  }
3095
3111
  };
3096
3112
  }, Rt = (r) => {
3097
- var w, y, A, x, S, C;
3113
+ var w, y, A, x, S, T;
3098
3114
  const e = ((w = r.events) == null ? void 0 : w.onNodeDragStarted) ?? (() => {
3099
3115
  }), t = ((y = r.events) == null ? void 0 : y.onNodeDrag) ?? (() => {
3100
3116
  }), o = r.nodeDragVerifier ?? (() => !0), s = ((A = r.events) == null ? void 0 : A.onNodeDragFinished) ?? (() => {
3101
- }), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (x = r.mouse) == null ? void 0 : x.dragCursor, d = h !== void 0 ? h : "grab", c = (S = r.mouse) == null ? void 0 : S.mouseDownEventVerifier, g = c !== void 0 ? c : (P) => P.button === 0, l = (C = r.mouse) == null ? void 0 : C.mouseUpEventVerifier, u = l !== void 0 ? l : (P) => P.button === 0;
3117
+ }), n = r.moveOnTop !== !1, a = r.moveEdgesOnTop !== !1 && n, h = (x = r.mouse) == null ? void 0 : x.dragCursor, d = h !== void 0 ? h : "grab", c = (S = r.mouse) == null ? void 0 : S.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;
3102
3118
  return {
3103
3119
  moveOnTop: n,
3104
3120
  moveEdgesOnTop: a,
@@ -3168,7 +3184,7 @@ const Y = (r) => () => r, we = Y(0), Nt = () => {
3168
3184
  });
3169
3185
  }
3170
3186
  }, ye = (r) => {
3171
- var y, A, x, S, C, P, R, V, ie, ne, ae, he;
3187
+ var y, A, x, S, T, P, R, V, ie, ne, ae, he;
3172
3188
  const e = (y = r == null ? void 0 : r.scale) == null ? void 0 : y.mouseWheelSensitivity, t = e !== void 0 ? e : 1.2, o = r == null ? void 0 : r.transformPreprocessor;
3173
3189
  let s;
3174
3190
  o !== void 0 ? Array.isArray(o) ? s = It(
@@ -3178,7 +3194,7 @@ const Y = (r) => () => r, we = Y(0), Nt = () => {
3178
3194
  ) : s = fe(o) : s = (D) => D.nextTransform;
3179
3195
  const n = ((A = r == null ? void 0 : r.shift) == null ? void 0 : A.cursor) !== void 0 ? r.shift.cursor : "grab", a = ((x = r == null ? void 0 : r.events) == null ? void 0 : x.onBeforeTransformChange) ?? (() => {
3180
3196
  }), h = ((S = r == null ? void 0 : r.events) == null ? void 0 : S.onTransformChange) ?? (() => {
3181
- }), d = (C = r == null ? void 0 : r.shift) == null ? void 0 : C.mouseDownEventVerifier, c = d !== void 0 ? d : (D) => D.button === 0, g = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseUpEventVerifier, l = g !== void 0 ? g : (D) => D.button === 0, u = (R = r == null ? void 0 : r.scale) == null ? void 0 : R.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
3197
+ }), d = (T = r == null ? void 0 : r.shift) == null ? void 0 : T.mouseDownEventVerifier, c = d !== void 0 ? d : (D) => D.button === 0, g = (P = r == null ? void 0 : r.shift) == null ? void 0 : P.mouseUpEventVerifier, l = g !== void 0 ? g : (D) => D.button === 0, u = (R = r == null ? void 0 : r.scale) == null ? void 0 : R.mouseWheelEventVerifier, w = u !== void 0 ? u : () => !0;
3182
3198
  return {
3183
3199
  wheelSensitivity: t,
3184
3200
  onTransformStarted: ((V = r == null ? void 0 : r.events) == null ? void 0 : V.onTransformStarted) ?? (() => {
@@ -3251,10 +3267,10 @@ const Y = (r) => () => r, we = Y(0), Nt = () => {
3251
3267
  onEdgeReattachInterrupted: ((g = r.events) == null ? void 0 : g.onEdgeReattachInterrupted) ?? d,
3252
3268
  onEdgeReattachPrevented: ((l = r.events) == null ? void 0 : l.onEdgeReattachPrevented) ?? h
3253
3269
  };
3254
- }, zt = (r) => ({
3270
+ }, kt = (r) => ({
3255
3271
  nodeVerticalRadius: r.nodeContainingRadius.vertical,
3256
3272
  nodeHorizontalRadius: r.nodeContainingRadius.horizontal
3257
- }), kt = (r) => {
3273
+ }), zt = (r) => {
3258
3274
  var e, t;
3259
3275
  return {
3260
3276
  onAfterNodeDetached: ((e = r == null ? void 0 : r.events) == null ? void 0 : e.onAfterNodeDetached) ?? (() => {
@@ -3881,11 +3897,15 @@ const Oe = (r) => {
3881
3897
  });
3882
3898
  }
3883
3899
  }
3884
- }, Zt = (r) => r instanceof G ? {
3900
+ }, Zt = (r) => r instanceof j ? {
3885
3901
  type: "manual",
3886
3902
  trigger: r
3903
+ } : (r == null ? void 0 : r.type) === "topologyChangeMacrotask" ? {
3904
+ type: "topologyChangeMacrotask"
3905
+ } : (r == null ? void 0 : r.type) === "topologyChangeTimeout" ? {
3906
+ type: "topologyChangeMacrotask"
3887
3907
  } : {
3888
- type: "topologyChangeTimeout"
3908
+ type: "topologyChangeMicrotask"
3889
3909
  }, Jt = (r) => {
3890
3910
  var e, t;
3891
3911
  switch (r == null ? void 0 : r.type) {
@@ -3949,7 +3969,7 @@ class sr {
3949
3969
  i(this, "hasUserDraggableEdges", !1);
3950
3970
  i(this, "hasAnimatedLayout", !1);
3951
3971
  i(this, "hasLayout", !1);
3952
- i(this, "boxRenderingTrigger", new G());
3972
+ i(this, "boxRenderingTrigger", new j());
3953
3973
  i(this, "graphStore");
3954
3974
  i(this, "viewportStore");
3955
3975
  i(this, "graph");
@@ -4034,16 +4054,16 @@ class sr {
4034
4054
  t,
4035
4055
  o
4036
4056
  );
4037
- if (this.hasBackground && J.configure(
4057
+ if (this.hasBackground && _.configure(
4038
4058
  s,
4039
4059
  Bt(this.backgroundConfig),
4040
4060
  e.background
4041
- ), this.hasNodeResizeReactiveEdges && j.configure(s), this.hasDraggableNodes) {
4061
+ ), this.hasNodeResizeReactiveEdges && q.configure(s), this.hasDraggableNodes) {
4042
4062
  let a = Rt(this.dragConfig);
4043
4063
  this.hasAnimatedLayout && (a = er(
4044
4064
  a,
4045
4065
  this.animationStaticNodes
4046
- )), Q.configure(
4066
+ )), Z.configure(
4047
4067
  s,
4048
4068
  e.main,
4049
4069
  this.window,
@@ -4056,7 +4076,7 @@ class sr {
4056
4076
  o.edges.shapeFactory,
4057
4077
  o.ports.direction
4058
4078
  );
4059
- _.configure(
4079
+ ee.configure(
4060
4080
  s,
4061
4081
  e.overlayConnectablePorts,
4062
4082
  this.viewportStore,
@@ -4069,7 +4089,7 @@ class sr {
4069
4089
  this.draggableEdgesConfig,
4070
4090
  s.graph
4071
4091
  );
4072
- ee.configure(
4092
+ te.configure(
4073
4093
  s,
4074
4094
  e.overlayDraggableEdges,
4075
4095
  this.viewportStore,
@@ -4077,14 +4097,14 @@ class sr {
4077
4097
  a
4078
4098
  );
4079
4099
  }
4080
- this.virtualScrollConfig !== void 0 ? Z.configure(
4100
+ this.virtualScrollConfig !== void 0 ? J.configure(
4081
4101
  s,
4082
4102
  e.main,
4083
4103
  this.window,
4084
4104
  ye(this.transformConfig),
4085
4105
  this.boxRenderingTrigger,
4086
- zt(this.virtualScrollConfig)
4087
- ) : this.hasTransformableViewport && k.configure(
4106
+ kt(this.virtualScrollConfig)
4107
+ ) : this.hasTransformableViewport && H.configure(
4088
4108
  s,
4089
4109
  e.main,
4090
4110
  this.window,
@@ -4116,7 +4136,7 @@ class sr {
4116
4136
  t,
4117
4137
  this.graphStore,
4118
4138
  this.boxRenderingTrigger,
4119
- kt(this.virtualScrollConfig)
4139
+ zt(this.virtualScrollConfig)
4120
4140
  )), new qe(t, this.graphStore);
4121
4141
  }
4122
4142
  }
@@ -4127,7 +4147,7 @@ export {
4127
4147
  b as CanvasError,
4128
4148
  M as ConnectionCategory,
4129
4149
  Ne as DirectEdgeShape,
4130
- G as EventSubject,
4150
+ j as EventSubject,
4131
4151
  pt as HorizontalEdgeShape,
4132
4152
  vt as InteractiveEdgeError,
4133
4153
  Me as InteractiveEdgeShape,