@dpuse/dpuse-tool-d3-visualiser 1.0.126 → 1.0.127

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -238,7 +238,7 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
238
238
 
239
239
  | Chunk/Module/File | Composition |
240
240
  | :------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------- |
241
- | **All 14 files** | 413.7 kB · gzip 122.0 kB |
241
+ | **All 14 files** | 414.3 kB · gzip 122.2 kB |
242
242
  | **dist/tanStackCharts-DEINbmRi.js** | 125.4 kB · gzip 36.7 kB · 30.3% of the build |
243
243
  |     @tanstack/charts → dist/scene.js + 41 more | `██████████████████░░` 90.1% · 113.0 kB |
244
244
  |     d3-scale → src/band.js + 2 more | `░░░░░░░░░░░░░░░░░░░░` 1.7% · 2.1 kB |
@@ -256,14 +256,14 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
256
256
  |     src → chordDiagram.ts | `░░░░░░░░░░░░░░░░░░░░` 0.8% · 494 B |
257
257
  |     d3-array → src/group.js + 1 more | `░░░░░░░░░░░░░░░░░░░░` 0.8% · 487 B |
258
258
  |     (bundler output, whitespace & JSON) | `███░░░░░░░░░░░░░░░░░` 13.5% · 7.6 kB |
259
- | **dist/networkDiagram-BZuipuTx.js** | 42.2 kB · gzip 12.8 kB · 10.2% of the build |
260
- |     d3-zoom → dist/d3-zoom.mjs | `█████░░░░░░░░░░░░░░░` 25.5% · 10.7 kB |
261
- |     src → networkDiagram.ts | `████░░░░░░░░░░░░░░░░` 22.1% · 9.3 kB |
262
- |     d3-force → dist/d3-force.mjs | `████░░░░░░░░░░░░░░░░` 18.1% · 7.6 kB |
263
- |     d3-quadtree → src/add.js + 13 more | `███░░░░░░░░░░░░░░░░░` 14.7% · 6.2 kB |
264
- |     d3-drag → dist/d3-drag.mjs | `██░░░░░░░░░░░░░░░░░░` 10.2% · 4.3 kB |
259
+ | **dist/networkDiagram-CMZHykCO.js** | 42.8 kB · gzip 13.0 kB · 10.3% of the build |
260
+ |     d3-zoom → dist/d3-zoom.mjs | `█████░░░░░░░░░░░░░░░` 25.1% · 10.7 kB |
261
+ |     src → networkDiagram.ts | `█████░░░░░░░░░░░░░░░` 23.2% · 10.0 kB |
262
+ |     d3-force → dist/d3-force.mjs | `████░░░░░░░░░░░░░░░░` 17.8% · 7.6 kB |
263
+ |     d3-quadtree → src/add.js + 13 more | `███░░░░░░░░░░░░░░░░░` 14.5% · 6.2 kB |
264
+ |     d3-drag → dist/d3-drag.mjs | `██░░░░░░░░░░░░░░░░░░` 10.0% · 4.3 kB |
265
265
  |     d3-interpolate → src/zoom.js | `░░░░░░░░░░░░░░░░░░░░` 2.3% · 1007 B |
266
- |     (bundler output, whitespace & JSON) | `█░░░░░░░░░░░░░░░░░░░` 7.1% · 3.0 kB |
266
+ |     (bundler output, whitespace & JSON) | `█░░░░░░░░░░░░░░░░░░░` 7.0% · 3.0 kB |
267
267
  | **dist/d3-shape-gf8U18pS.js** | 36.9 kB · gzip 7.9 kB · 8.9% of the build |
268
268
  |     d3-shape → dist/d3-shape.mjs | `█████████████████░░░` 86.2% · 31.8 kB |
269
269
  |     d3-path → dist/d3-path.mjs | `██░░░░░░░░░░░░░░░░░░` 8.1% · 3.0 kB |
@@ -300,7 +300,7 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
300
300
  | **dist/treeDiagram-t0oFwi1c.js** | 2.2 kB · gzip 1.0 kB · 0.5% of the build |
301
301
  |     src → treeDiagram.ts | `█████████████████░░░` 87.2% · 1.9 kB |
302
302
  |     (bundler output, whitespace & JSON) | `███░░░░░░░░░░░░░░░░░` 12.8% · 290 B |
303
- | **dist/dpuse-tool-d3-visualiser.es.js** | 1.6 kB · gzip 438 B · 0.4% of the build |
303
+ | **dist/dpuse-tool-d3-visualiser.es.js** | 1.6 kB · gzip 439 B · 0.4% of the build |
304
304
  |     src → index.ts | `██████████████████░░` 88.0% · 1.4 kB |
305
305
  |     (bundler output, whitespace & JSON) | `██░░░░░░░░░░░░░░░░░░` 12.0% · 194 B |
306
306
  | **dist/palette-D5DTPmuA.js** | 1.2 kB · gzip 567 B · 0.3% of the build |
@@ -32,7 +32,7 @@ var e = class {
32
32
  };
33
33
  }
34
34
  async renderNetworkDiagram(e, t, n, r) {
35
- let { renderNetworkDiagram: i } = await import("./networkDiagram-BZuipuTx.js"), a = i(e, t, n);
35
+ let { renderNetworkDiagram: i } = await import("./networkDiagram-CMZHykCO.js"), a = i(e, t, n);
36
36
  return r?.(), {
37
37
  destroy: a.destroy,
38
38
  resize: a.resize,
@@ -497,7 +497,7 @@ function ye(e, t) {
497
497
  }, 0)), "onselectstart" in n ? i.on("selectstart.drag", null) : (n.style.MozUserSelect = n.__noselect, delete n.__noselect);
498
498
  }
499
499
  var L = (e) => () => e;
500
- function be(e, { sourceEvent: t, subject: n, target: r, identifier: i, active: a, x: o, y: s, dx: c, dy: l, dispatch: u }) {
500
+ function R(e, { sourceEvent: t, subject: n, target: r, identifier: i, active: a, x: o, y: s, dx: c, dy: l, dispatch: u }) {
501
501
  Object.defineProperties(this, {
502
502
  type: {
503
503
  value: e,
@@ -552,27 +552,27 @@ function be(e, { sourceEvent: t, subject: n, target: r, identifier: i, active: a
552
552
  _: { value: u }
553
553
  });
554
554
  }
555
- be.prototype.on = function() {
555
+ R.prototype.on = function() {
556
556
  var e = this._.on.apply(this._, arguments);
557
557
  return e === this._ ? this : e;
558
558
  };
559
- function xe(e) {
559
+ function be(e) {
560
560
  return !e.ctrlKey && !e.button;
561
561
  }
562
- function Se() {
562
+ function xe() {
563
563
  return this.parentNode;
564
564
  }
565
- function Ce(e, t) {
565
+ function Se(e, t) {
566
566
  return t ?? {
567
567
  x: e.x,
568
568
  y: e.y
569
569
  };
570
570
  }
571
- function we() {
571
+ function Ce() {
572
572
  return navigator.maxTouchPoints || "ontouchstart" in this;
573
573
  }
574
- function Te() {
575
- var e = xe, n = Se, a = Ce, o = we, s = {}, c = t("start", "drag", "end"), l = 0, u, d, f, p, m = 0;
574
+ function we() {
575
+ var e = be, n = xe, a = Se, o = Ce, s = {}, c = t("start", "drag", "end"), l = 0, u, d, f, p, m = 0;
576
576
  function h(e) {
577
577
  e.on("mousedown.drag", g).filter(o).on("touchstart.drag", y).on("touchmove.drag", b, _e).on("touchend.drag touchcancel.drag", x).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
578
578
  }
@@ -606,7 +606,7 @@ function Te() {
606
606
  }
607
607
  function S(e, t, n, r, o, u) {
608
608
  var d = c.copy(), f = i(u || n, t), p, m, g;
609
- if ((g = a.call(e, new be("beforestart", {
609
+ if ((g = a.call(e, new R("beforestart", {
610
610
  sourceEvent: n,
611
611
  target: h,
612
612
  identifier: o,
@@ -625,7 +625,7 @@ function Te() {
625
625
  case "end": delete s[o], --l;
626
626
  case "drag": f = i(u || c, t), v = l;
627
627
  }
628
- d.call(a, e, new be(a, {
628
+ d.call(a, e, new R(a, {
629
629
  sourceEvent: c,
630
630
  subject: g,
631
631
  target: h,
@@ -655,8 +655,8 @@ function Te() {
655
655
  }, h;
656
656
  }
657
657
  // node_modules/d3-zoom/dist/d3-zoom.mjs
658
- var R = (e) => () => e;
659
- function Ee(e, { sourceEvent: t, target: n, transform: r, dispatch: i }) {
658
+ var z = (e) => () => e;
659
+ function Te(e, { sourceEvent: t, target: n, transform: r, dispatch: i }) {
660
660
  Object.defineProperties(this, {
661
661
  type: {
662
662
  value: e,
@@ -681,16 +681,16 @@ function Ee(e, { sourceEvent: t, target: n, transform: r, dispatch: i }) {
681
681
  _: { value: i }
682
682
  });
683
683
  }
684
- function z(e, t, n) {
684
+ function B(e, t, n) {
685
685
  this.k = e, this.x = t, this.y = n;
686
686
  }
687
- z.prototype = {
688
- constructor: z,
687
+ B.prototype = {
688
+ constructor: B,
689
689
  scale: function(e) {
690
- return e === 1 ? this : new z(this.k * e, this.x, this.y);
690
+ return e === 1 ? this : new B(this.k * e, this.x, this.y);
691
691
  },
692
692
  translate: function(e, t) {
693
- return e === 0 & t === 0 ? this : new z(this.k, this.x + this.k * e, this.y + this.k * t);
693
+ return e === 0 & t === 0 ? this : new B(this.k, this.x + this.k * e, this.y + this.k * t);
694
694
  },
695
695
  apply: function(e) {
696
696
  return [e[0] * this.k + this.x, e[1] * this.k + this.y];
@@ -720,46 +720,46 @@ z.prototype = {
720
720
  return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
721
721
  }
722
722
  };
723
- var B = new z(1, 0, 0);
724
- De.prototype = z.prototype;
725
- function De(e) {
726
- for (; !e.__zoom;) if (!(e = e.parentNode)) return B;
723
+ var V = new B(1, 0, 0);
724
+ Ee.prototype = B.prototype;
725
+ function Ee(e) {
726
+ for (; !e.__zoom;) if (!(e = e.parentNode)) return V;
727
727
  return e.__zoom;
728
728
  }
729
- function Oe(e) {
729
+ function H(e) {
730
730
  e.stopImmediatePropagation();
731
731
  }
732
- function V(e) {
732
+ function U(e) {
733
733
  e.preventDefault(), e.stopImmediatePropagation();
734
734
  }
735
- function ke(e) {
735
+ function De(e) {
736
736
  return (!e.ctrlKey || e.type === "wheel") && !e.button;
737
737
  }
738
- function Ae() {
738
+ function Oe() {
739
739
  var e = this;
740
740
  return e instanceof SVGElement ? (e = e.ownerSVGElement || e, e.hasAttribute("viewBox") ? (e = e.viewBox.baseVal, [[e.x, e.y], [e.x + e.width, e.y + e.height]]) : [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]]) : [[0, 0], [e.clientWidth, e.clientHeight]];
741
741
  }
742
- function je() {
743
- return this.__zoom || B;
742
+ function ke() {
743
+ return this.__zoom || V;
744
744
  }
745
- function Me(e) {
745
+ function Ae(e) {
746
746
  return -e.deltaY * (e.deltaMode === 1 ? .05 : e.deltaMode ? 1 : .002) * (e.ctrlKey ? 10 : 1);
747
747
  }
748
- function Ne() {
748
+ function je() {
749
749
  return navigator.maxTouchPoints || "ontouchstart" in this;
750
750
  }
751
- function Pe(e, t, n) {
751
+ function Me(e, t, n) {
752
752
  var r = e.invertX(t[0][0]) - n[0][0], i = e.invertX(t[1][0]) - n[1][0], a = e.invertY(t[0][1]) - n[0][1], o = e.invertY(t[1][1]) - n[1][1];
753
753
  return e.translate(i > r ? (r + i) / 2 : Math.min(0, r) || Math.max(0, i), o > a ? (a + o) / 2 : Math.min(0, a) || Math.max(0, o));
754
754
  }
755
- function Fe() {
756
- var e = ke, a = Ae, o = Pe, s = Me, c = Ne, l = [0, Infinity], u = [[-Infinity, -Infinity], [Infinity, Infinity]], d = 250, f = ge, p = t("start", "zoom", "end"), m, h, g, _ = 500, v = 150, y = 0, b = 10;
755
+ function Ne() {
756
+ var e = De, a = Oe, o = Me, s = Ae, c = je, l = [0, Infinity], u = [[-Infinity, -Infinity], [Infinity, Infinity]], d = 250, f = ge, p = t("start", "zoom", "end"), m, h, g, _ = 500, v = 150, y = 0, b = 10;
757
757
  function x(e) {
758
- e.property("__zoom", je).on("wheel.zoom", O, { passive: !1 }).on("mousedown.zoom", k).on("dblclick.zoom", A).filter(c).on("touchstart.zoom", j).on("touchmove.zoom", ee).on("touchend.zoom touchcancel.zoom", M).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
758
+ e.property("__zoom", ke).on("wheel.zoom", O, { passive: !1 }).on("mousedown.zoom", k).on("dblclick.zoom", A).filter(c).on("touchstart.zoom", j).on("touchmove.zoom", ee).on("touchend.zoom touchcancel.zoom", M).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
759
759
  }
760
760
  x.transform = function(e, t, n, r) {
761
761
  var i = e.selection ? e.selection() : e;
762
- i.property("__zoom", je), e === i ? i.interrupt().each(function() {
762
+ i.property("__zoom", ke), e === i ? i.interrupt().each(function() {
763
763
  E(this, arguments).event(r).start().zoom(null, typeof t == "function" ? t.apply(this, arguments) : t).end();
764
764
  }) : T(e, t, n, r);
765
765
  }, x.scaleBy = function(e, t, n, r) {
@@ -778,15 +778,15 @@ function Fe() {
778
778
  }, x.translateTo = function(e, t, n, r, i) {
779
779
  x.transform(e, function() {
780
780
  var e = a.apply(this, arguments), i = this.__zoom, s = r == null ? w(e) : typeof r == "function" ? r.apply(this, arguments) : r;
781
- return o(B.translate(s[0], s[1]).scale(i.k).translate(typeof t == "function" ? -t.apply(this, arguments) : -t, typeof n == "function" ? -n.apply(this, arguments) : -n), e, u);
781
+ return o(V.translate(s[0], s[1]).scale(i.k).translate(typeof t == "function" ? -t.apply(this, arguments) : -t, typeof n == "function" ? -n.apply(this, arguments) : -n), e, u);
782
782
  }, r, i);
783
783
  };
784
784
  function S(e, t) {
785
- return t = Math.max(l[0], Math.min(l[1], t)), t === e.k ? e : new z(t, e.x, e.y);
785
+ return t = Math.max(l[0], Math.min(l[1], t)), t === e.k ? e : new B(t, e.x, e.y);
786
786
  }
787
787
  function C(e, t, n) {
788
788
  var r = t[0] - n[0] * e.k, i = t[1] - n[1] * e.k;
789
- return r === e.x && i === e.y ? e : new z(e.k, r, i);
789
+ return r === e.x && i === e.y ? e : new B(e.k, r, i);
790
790
  }
791
791
  function w(e) {
792
792
  return [(+e[0][0] + +e[1][0]) / 2, (+e[0][1] + +e[1][1]) / 2];
@@ -802,7 +802,7 @@ function Fe() {
802
802
  if (e === 1) e = d;
803
803
  else {
804
804
  var t = p(e), n = l / t[2];
805
- e = new z(n, c[0] - t[0] * n, c[1] - t[1] * n);
805
+ e = new B(n, c[0] - t[0] * n, c[1] - t[1] * n);
806
806
  }
807
807
  o.zoom(null, e);
808
808
  };
@@ -829,7 +829,7 @@ function Fe() {
829
829
  },
830
830
  emit: function(e) {
831
831
  var t = r(this.that).datum();
832
- p.call(e, this.that, new Ee(e, {
832
+ p.call(e, this.that, new Te(e, {
833
833
  sourceEvent: this.sourceEvent,
834
834
  target: x,
835
835
  transform: this.that.__zoom,
@@ -843,7 +843,7 @@ function Fe() {
843
843
  if (a.wheel) (a.mouse[0][0] !== f[0] || a.mouse[0][1] !== f[1]) && (a.mouse[1] = c.invert(a.mouse[0] = f)), clearTimeout(a.wheel);
844
844
  else if (c.k === d) return;
845
845
  else a.mouse = [f, c.invert(f)], n(this), a.start();
846
- V(t), a.wheel = setTimeout(p, v), a.zoom("mouse", o(C(S(c, d), a.mouse[0], a.mouse[1]), a.extent, u));
846
+ U(t), a.wheel = setTimeout(p, v), a.zoom("mouse", o(C(S(c, d), a.mouse[0], a.mouse[1]), a.extent, u));
847
847
  function p() {
848
848
  a.wheel = null, a.end();
849
849
  }
@@ -851,28 +851,28 @@ function Fe() {
851
851
  function k(t, ...a) {
852
852
  if (g || !e.apply(this, arguments)) return;
853
853
  var s = t.currentTarget, c = E(this, a, !0).event(t), l = r(t.view).on("mousemove.zoom", m, !0).on("mouseup.zoom", h, !0), d = i(t, s), f = t.clientX, p = t.clientY;
854
- ve(t.view), Oe(t), c.mouse = [d, this.__zoom.invert(d)], n(this), c.start();
854
+ ve(t.view), H(t), c.mouse = [d, this.__zoom.invert(d)], n(this), c.start();
855
855
  function m(e) {
856
- if (V(e), !c.moved) {
856
+ if (U(e), !c.moved) {
857
857
  var t = e.clientX - f, n = e.clientY - p;
858
858
  c.moved = t * t + n * n > y;
859
859
  }
860
860
  c.event(e).zoom("mouse", o(C(c.that.__zoom, c.mouse[0] = i(e, s), c.mouse[1]), c.extent, u));
861
861
  }
862
862
  function h(e) {
863
- l.on("mousemove.zoom mouseup.zoom", null), ye(e.view, c.moved), V(e), c.event(e).end();
863
+ l.on("mousemove.zoom mouseup.zoom", null), ye(e.view, c.moved), U(e), c.event(e).end();
864
864
  }
865
865
  }
866
866
  function A(t, ...n) {
867
867
  if (e.apply(this, arguments)) {
868
868
  var s = this.__zoom, c = i(t.changedTouches ? t.changedTouches[0] : t, this), l = s.invert(c), f = s.k * (t.shiftKey ? .5 : 2), p = o(C(S(s, f), c, l), a.apply(this, n), u);
869
- V(t), d > 0 ? r(this).transition().duration(d).call(T, p, c, t) : r(this).call(x.transform, p, c, t);
869
+ U(t), d > 0 ? r(this).transition().duration(d).call(T, p, c, t) : r(this).call(x.transform, p, c, t);
870
870
  }
871
871
  }
872
872
  function j(t, ...r) {
873
873
  if (e.apply(this, arguments)) {
874
874
  var a = t.touches, o = a.length, s = E(this, r, t.changedTouches.length === o).event(t), c, l, u, d;
875
- for (Oe(t), l = 0; l < o; ++l) u = a[l], d = i(u, this), d = [
875
+ for (H(t), l = 0; l < o; ++l) u = a[l], d = i(u, this), d = [
876
876
  d,
877
877
  this.__zoom.invert(d),
878
878
  u.identifier
@@ -885,7 +885,7 @@ function Fe() {
885
885
  function ee(e, ...t) {
886
886
  if (this.__zooming) {
887
887
  var n = E(this, t).event(e), r = e.changedTouches, a = r.length, s, c, l, d;
888
- for (V(e), s = 0; s < a; ++s) c = r[s], l = i(c, this), n.touch0 && n.touch0[2] === c.identifier ? n.touch0[0] = l : n.touch1 && n.touch1[2] === c.identifier && (n.touch1[0] = l);
888
+ for (U(e), s = 0; s < a; ++s) c = r[s], l = i(c, this), n.touch0 && n.touch0[2] === c.identifier ? n.touch0[0] = l : n.touch1 && n.touch1[2] === c.identifier && (n.touch1[0] = l);
889
889
  if (c = n.that.__zoom, n.touch1) {
890
890
  var f = n.touch0[0], p = n.touch0[1], m = n.touch1[0], h = n.touch1[1], g = (g = m[0] - f[0]) * g + (g = m[1] - f[1]) * g, _ = (_ = h[0] - p[0]) * _ + (_ = h[1] - p[1]) * _;
891
891
  c = S(c, Math.sqrt(g / _)), l = [(f[0] + m[0]) / 2, (f[1] + m[1]) / 2], d = [(p[0] + h[0]) / 2, (p[1] + h[1]) / 2];
@@ -897,7 +897,7 @@ function Fe() {
897
897
  function M(e, ...t) {
898
898
  if (this.__zooming) {
899
899
  var n = E(this, t).event(e), a = e.changedTouches, o = a.length, s, c;
900
- for (Oe(e), g && clearTimeout(g), g = setTimeout(function() {
900
+ for (H(e), g && clearTimeout(g), g = setTimeout(function() {
901
901
  g = null;
902
902
  }, _), s = 0; s < o; ++s) c = a[s], n.touch0 && n.touch0[2] === c.identifier ? delete n.touch0 : n.touch1 && n.touch1[2] === c.identifier && delete n.touch1;
903
903
  if (n.touch1 && !n.touch0 && (n.touch0 = n.touch1, delete n.touch1), n.touch0) n.touch0[1] = this.__zoom.invert(n.touch0[0]);
@@ -908,13 +908,13 @@ function Fe() {
908
908
  }
909
909
  }
910
910
  return x.wheelDelta = function(e) {
911
- return arguments.length ? (s = typeof e == "function" ? e : R(+e), x) : s;
911
+ return arguments.length ? (s = typeof e == "function" ? e : z(+e), x) : s;
912
912
  }, x.filter = function(t) {
913
- return arguments.length ? (e = typeof t == "function" ? t : R(!!t), x) : e;
913
+ return arguments.length ? (e = typeof t == "function" ? t : z(!!t), x) : e;
914
914
  }, x.touchable = function(e) {
915
- return arguments.length ? (c = typeof e == "function" ? e : R(!!e), x) : c;
915
+ return arguments.length ? (c = typeof e == "function" ? e : z(!!e), x) : c;
916
916
  }, x.extent = function(e) {
917
- return arguments.length ? (a = typeof e == "function" ? e : R([[+e[0][0], +e[0][1]], [+e[1][0], +e[1][1]]]), x) : a;
917
+ return arguments.length ? (a = typeof e == "function" ? e : z([[+e[0][0], +e[0][1]], [+e[1][0], +e[1][1]]]), x) : a;
918
918
  }, x.scaleExtent = function(e) {
919
919
  return arguments.length ? (l[0] = +e[0], l[1] = +e[1], x) : [l[0], l[1]];
920
920
  }, x.translateExtent = function(e) {
@@ -935,12 +935,19 @@ function Fe() {
935
935
  }, x;
936
936
  }
937
937
  // src/networkDiagram.ts
938
- var Ie = -300, Le = 100, Re = 400, H = 640, U = 480, ze = 180, Be = 1, Ve = 2, He = 14, Ue = 70, We = 130, Ge = .25, Ke = 4, W = 12, G = 14, qe = 6.2, Je = 4, K = 8, Ye = .35, Xe = Math.PI * .75, Ze = 10, Qe = .6, $e = 16, et = 10, tt = 3, nt = 12, q = {
938
+ var Pe = -300, Fe = 100, Ie = 400, W = 640, G = 480, Le = 180, Re = 1, ze = 2, Be = 14, Ve = 70, He = 130, Ue = .25, We = 4, Ge = 12, K = 14, Ke = 6.2, qe = 4, Je = 8, Ye = .35, Xe = Math.PI * .75, Ze = 10, Qe = .6, $e = 16, et = 10, tt = 3, nt = 12, q = {
939
939
  linkStroke: "#9ca3af",
940
940
  nodeFillSelected: "#f59e0b",
941
941
  nodeStrokeSelected: "#b45309",
942
942
  nodeText: "#ffffff"
943
- }, rt = [
943
+ }, rt = {
944
+ fill: "#dbeafe",
945
+ fillHovered: "#bfdbfe",
946
+ radius: 16,
947
+ stroke: "#2563eb",
948
+ strokeHovered: "#1d4ed8",
949
+ symbol: "#1d4ed8"
950
+ }, it = "symbol", at = 20, ot = [
944
951
  {
945
952
  fill: "#475569",
946
953
  fillHovered: "#64748b",
@@ -977,8 +984,8 @@ var Ie = -300, Le = 100, Re = 400, H = 640, U = 480, ze = 180, Be = 1, Ve = 2, H
977
984
  strokeHovered: "#be185d"
978
985
  }
979
986
  ];
980
- function it(e, t, n = {}) {
981
- let i = n.labelPlacementId ?? "below", a = n.transitionDuration ?? Re, o = t.clientWidth || H, s = t.clientHeight || U, c = te().id((e) => e.id), l = ue().force("link", c).force("charge", de().strength(n.chargeStrength ?? Ie)).force("center", D(o / 2, s / 2));
987
+ function st(e, t, n = {}) {
988
+ let i = n.labelPlacementId ?? "below", a = n.transitionDuration ?? Ie, o = t.clientWidth || W, s = t.clientHeight || G, c = te().id((e) => e.id), l = ue().force("link", c).force("charge", de().strength(n.chargeStrength ?? Pe)).force("center", D(o / 2, s / 2));
982
989
  n.reservesLabelRoom === !0 && l.force("collide", ee((e) => Z(e).radius + et)), l.stop();
983
990
  let u = r(t).append("svg").attr("width", o).attr("height", s).attr("viewBox", `0 0 ${String(o)} ${String(s)}`).style("touch-action", "none"), d = u.append("g"), f = d.append("g"), p = d.append("g"), m = u.node();
984
991
  if (m == null) throw Error("Failed to create network diagram SVG element.");
@@ -989,117 +996,117 @@ function it(e, t, n = {}) {
989
996
  for (let e of r) {
990
997
  let r = t.get(e);
991
998
  if (!r) continue;
992
- let i = r.label == null ? 0 : at(J(r, n.wrapsLabels === !0)) * Qe;
999
+ let i = r.label == null ? 0 : ct(J(r, n.wrapsLabels === !0)) * Qe;
993
1000
  a += Math.max(Z(r).radius * 2, i) + $e, o = Math.max(o, Z(r).radius);
994
1001
  }
995
1002
  let s = a / (Math.PI * 2), c = t.get(e);
996
1003
  if (i === "below" || c?.label == null) return s;
997
- let l = at(J(c, n.wrapsLabels === !0));
1004
+ let l = ct(J(c, n.wrapsLabels === !0));
998
1005
  return Math.max(s, Z(c).radius + 16 + l + o);
999
1006
  };
1000
1007
  c.distance((e) => {
1001
- let t = n.linkDistance ?? Le;
1008
+ let t = n.linkDistance ?? Fe;
1002
1009
  if (n.reservesLabelRoom !== !0) return t;
1003
1010
  let r = new Map(g.map((e) => [e.id, e]));
1004
1011
  return Math.max(t, w(Y(e.source), r), w(Y(e.target), r));
1005
1012
  });
1006
- let T = () => {
1007
- C.select("circle").attr("fill", (e) => e.id === b ? q.nodeFillSelected : e.id === x ? Z(e).fillHovered : Z(e).fill).attr("stroke", (e) => e.id === b ? q.nodeStrokeSelected : e.id === x ? Z(e).strokeHovered : Z(e).stroke).attr("stroke-width", (e) => e.id === b ? 3 : 2).attr("r", (e) => Z(e).radius + (e.id === b || e.id === x ? Ve : 0));
1013
+ let T = (e) => e.id === b && e.isAction !== !0, E = () => {
1014
+ C.select("circle").attr("fill", (e) => T(e) ? q.nodeFillSelected : e.id === x ? Z(e).fillHovered : Z(e).fill).attr("stroke", (e) => T(e) ? q.nodeStrokeSelected : e.id === x ? Z(e).strokeHovered : Z(e).stroke).attr("stroke-width", (e) => T(e) ? 3 : 2).attr("r", (e) => Z(e).radius + (e.id === b || e.id === x ? ze : 0));
1008
1015
  };
1009
1016
  u.on("click", () => {
1010
- b = null, T();
1017
+ b = null, E();
1011
1018
  });
1012
- let E = Fe().scaleExtent([Ge, Ke]).on("zoom", (e) => {
1019
+ let O = Ne().scaleExtent([Ue, We]).on("zoom", (e) => {
1013
1020
  d.attr("transform", e.transform.toString());
1014
1021
  });
1015
- u.call(E).on("dblclick.zoom", null);
1016
- let O = () => {
1022
+ u.call(O).on("dblclick.zoom", null);
1023
+ let k = () => {
1017
1024
  S.attr("x1", (e) => X(e.source, "x")).attr("y1", (e) => X(e.source, "y")).attr("x2", (e) => X(e.target, "x")).attr("y2", (e) => X(e.target, "y")), C.attr("transform", (e) => `translate(${String(e.x ?? 0)},${String(e.y ?? 0)})`);
1018
1025
  let e = new Map(g.map((e) => [e.id, e]));
1019
1026
  C.each((t, a, o) => {
1020
1027
  if (t.label == null) return;
1021
- let s = ot(t, (v.get(t.id) ?? []).map((t) => e.get(t)).filter((e) => e !== void 0), i, J(t, n.wrapsLabels === !0));
1028
+ let s = lt(t, (v.get(t.id) ?? []).map((t) => e.get(t)).filter((e) => e !== void 0), i, J(t, n.wrapsLabels === !0));
1022
1029
  r($(o[a])).select("text").attr("text-anchor", s.anchor).attr("y", s.y).selectAll("tspan").attr("x", s.x);
1023
1030
  });
1024
- }, k = () => {
1031
+ }, A = () => {
1025
1032
  if (g.length === 0) return;
1026
1033
  let e = g.map((e) => e.x ?? 0), n = g.map((e) => e.y ?? 0), [r, a, o, s] = [
1027
1034
  Math.min(...e),
1028
1035
  Math.max(...e),
1029
1036
  Math.min(...n),
1030
1037
  Math.max(...n)
1031
- ], c = t.clientWidth || H, l = t.clientHeight || U, u = i === "outside" ? We : Ue, d = Math.max(Ge, Math.min(1, c / (a - r + u * 2), l / (s - o + u * 2)));
1032
- return B.translate(c / 2, l / 2).scale(d).translate(-(r + a) / 2, -(o + s) / 2);
1033
- }, A = (e) => {
1038
+ ], c = t.clientWidth || W, l = t.clientHeight || G, u = i === "outside" ? He : Ve, d = Math.max(Ue, Math.min(1, c / (a - r + u * 2), l / (s - o + u * 2)));
1039
+ return V.translate(c / 2, l / 2).scale(d).translate(-(r + a) / 2, -(o + s) / 2);
1040
+ }, j = (e) => {
1034
1041
  u.call((t) => {
1035
- E.transform(t, e);
1042
+ O.transform(t, e);
1036
1043
  });
1037
- }, j = () => {
1044
+ }, M = () => {
1038
1045
  l.alpha(1);
1039
- for (let e = 0; e < ze; e += 1) l.tick();
1046
+ for (let e = 0; e < Le; e += 1) l.tick();
1040
1047
  l.stop();
1041
- }, M = () => {
1048
+ }, N = () => {
1042
1049
  y !== void 0 && cancelAnimationFrame(y), y = void 0;
1043
- }, N = (e) => {
1050
+ }, ne = (e) => {
1044
1051
  let t = new Map(g.map((e) => [e.id, e]));
1045
- h = e, v = st(e), g = e.nodes.map((e) => ({ ...e })), _ = e.links.map((e) => ({ ...e }));
1052
+ h = e, v = ut(e), g = e.nodes.map((e) => ({ ...e })), _ = e.links.map((e) => ({ ...e }));
1046
1053
  let r = Math.min(o, s) * .22;
1047
1054
  for (let [e, n] of g.entries()) {
1048
1055
  let i = t.get(n.id), a = (v.get(n.id) ?? []).find((e) => t.has(e)), c = a == null ? void 0 : t.get(a), l = e / g.length * Math.PI * 2;
1049
1056
  i ? (n.x = i.x, n.y = i.y) : c ? (n.x = (c.x ?? 0) + Math.cos(l) * nt, n.y = (c.y ?? 0) + Math.sin(l) * nt) : (n.x = o / 2 + Math.cos(l) * r, n.y = s / 2 + Math.sin(l) * r);
1050
1057
  }
1051
1058
  l.nodes(g), c.links(_);
1052
- let i = S.data(_, ct), a = i.exit();
1059
+ let i = S.data(_, dt), a = i.exit();
1053
1060
  S = i.enter().append("line").attr("stroke", q.linkStroke).attr("stroke-width", 2).merge(i);
1054
1061
  let u = C.data(g, (e) => e.id), d = u.exit().style("pointer-events", "none"), f = u.enter().append("g").style("cursor", "pointer");
1055
- return f.append("circle").attr("stroke-width", 2), f.append("text"), f.on("mouseenter", (e, t) => {
1056
- x = t.id, T();
1062
+ return f.append("title"), f.append("circle").attr("stroke-width", 2), f.append("text"), f.on("mouseenter", (e, t) => {
1063
+ x = t.id, E();
1057
1064
  }).on("mouseleave", (e, t) => {
1058
- x === t.id && (x = null), T();
1065
+ x === t.id && (x = null), E();
1059
1066
  }).on("click", (e, t) => {
1060
- e.stopPropagation(), b = b === t.id ? null : t.id, T(), n.onNodeClick?.($(h.nodes.find((e) => e.id === t.id)));
1061
- }).call(Te().on("start", (e, t) => {
1067
+ e.stopPropagation(), b = b === t.id ? null : t.id, E(), n.onNodeClick?.($(h.nodes.find((e) => e.id === t.id)));
1068
+ }).call(we().on("start", (e, t) => {
1062
1069
  e.sourceEvent?.stopPropagation(), t.fx = t.x, t.fy = t.y;
1063
1070
  }).on("drag", (e, t) => {
1064
- t.x = e.x, t.y = e.y, t.fx = e.x, t.fy = e.y, O();
1071
+ t.x = e.x, t.y = e.y, t.fx = e.x, t.fy = e.y, k();
1065
1072
  }).on("end", (e, t) => {
1066
1073
  t.fx = null, t.fy = null;
1067
- })), C = f.merge(u), C.select("text").attr("text-anchor", "middle").attr("y", (e) => e.label == null ? 4 : Z(e).radius + He).attr("font-size", (e) => e.label == null ? null : W).attr("fill", (e) => e.label == null ? q.nodeText : "currentColor").style("paint-order", (e) => e.label == null || n.labelHaloColor == null ? null : "stroke").style("stroke", (e) => e.label == null ? null : n.labelHaloColor ?? null).style("stroke-linejoin", (e) => e.label == null || n.labelHaloColor == null ? null : "round").style("stroke-width", (e) => e.label == null || n.labelHaloColor == null ? null : `${String(Je)}px`).selectAll("tspan").data((e) => J(e, n.wrapsLabels === !0)).join("tspan").attr("x", 0).attr("dy", (e, t) => t === 0 ? 0 : G).text((e) => e), T(), {
1074
+ })), C = f.merge(u), C.select("text").attr("text-anchor", "middle").attr("y", (e) => e.label == null ? 4 : Z(e).radius + Be).attr("font-size", (e) => e.label == null ? null : Ge).attr("fill", (e) => e.label == null ? q.nodeText : "currentColor").style("paint-order", (e) => e.label == null || n.labelHaloColor == null ? null : "stroke").style("stroke", (e) => e.label == null ? null : n.labelHaloColor ?? null).style("stroke-linejoin", (e) => e.label == null || n.labelHaloColor == null ? null : "round").style("stroke-width", (e) => e.label == null || n.labelHaloColor == null ? null : `${String(qe)}px`).selectAll("tspan").data((e) => J(e, n.wrapsLabels === !0)).join("tspan").attr("x", 0).attr("dy", (e, t) => t === 0 ? 0 : K).text((e) => e), C.select("title").text((e) => e.title ?? ""), C.selectAll(`text.${it}`).data((e) => e.symbol == null ? [] : [e]).join("text").attr("class", it).attr("text-anchor", "middle").attr("dy", "0.35em").attr("font-size", at).attr("font-weight", 600).attr("fill", (e) => e.isAction === !0 ? rt.symbol : q.nodeText).style("pointer-events", "none").text((e) => e.symbol ?? ""), E(), {
1068
1075
  enteringNodes: f,
1069
1076
  exitingLinks: a,
1070
1077
  exitingNodes: d
1071
1078
  };
1072
1079
  };
1073
- return N(e), O(), {
1080
+ return ne(e), k(), {
1074
1081
  destroy: () => {
1075
- M(), l.stop(), u.remove();
1082
+ N(), l.stop(), u.remove();
1076
1083
  },
1077
1084
  resize: () => {
1078
- let e = t.clientWidth || H, n = t.clientHeight || U;
1085
+ let e = t.clientWidth || W, n = t.clientHeight || G;
1079
1086
  u.attr("width", e).attr("height", n).attr("viewBox", `0 0 ${String(e)} ${String(n)}`), l.force("center", D(e / 2, n / 2));
1080
1087
  },
1081
1088
  svg: m,
1082
1089
  triggerAutoLayout: () => {
1083
- M(), j(), O();
1084
- let e = n.fitsView === !0 ? k() : void 0;
1085
- e && A(e);
1090
+ N(), M(), k();
1091
+ let e = n.fitsView === !0 ? A() : void 0;
1092
+ e && j(e);
1086
1093
  },
1087
1094
  update: (e) => {
1088
- M();
1089
- let { enteringNodes: t, exitingLinks: r, exitingNodes: i } = N(e), o = new Map(g.map((e) => [e.id, {
1095
+ N();
1096
+ let { enteringNodes: t, exitingLinks: r, exitingNodes: i } = ne(e), o = new Map(g.map((e) => [e.id, {
1090
1097
  x: e.x ?? 0,
1091
1098
  y: e.y ?? 0
1092
1099
  }]));
1093
- j();
1100
+ M();
1094
1101
  let s = new Map(g.map((e) => [e.id, {
1095
1102
  x: e.x ?? 0,
1096
1103
  y: e.y ?? 0
1097
- }])), c = De(m), l = (n.fitsView === !0 ? k() : void 0) ?? c, u = (e) => {
1104
+ }])), c = Ee(m), l = (n.fitsView === !0 ? A() : void 0) ?? c, u = (e) => {
1098
1105
  for (let t of g) {
1099
- let n = lt($(o.get(t.id)), $(s.get(t.id)), e);
1106
+ let n = ft($(o.get(t.id)), $(s.get(t.id)), e);
1100
1107
  t.x = n.x, t.y = n.y;
1101
1108
  }
1102
- O(), t.style("opacity", e), i.style("opacity", 1 - e), r.style("opacity", 1 - e), A(B.translate(Q(c.x, l.x, e), Q(c.y, l.y, e)).scale(Q(c.k, l.k, e))), e < 1 || (t.style("opacity", null), i.remove(), r.remove());
1109
+ k(), t.style("opacity", e), i.style("opacity", 1 - e), r.style("opacity", 1 - e), j(V.translate(Q(c.x, l.x, e), Q(c.y, l.y, e)).scale(Q(c.k, l.k, e))), e < 1 || (t.style("opacity", null), i.remove(), r.remove());
1103
1110
  };
1104
1111
  if (a <= 0) {
1105
1112
  u(1);
@@ -1108,27 +1115,28 @@ function it(e, t, n = {}) {
1108
1115
  u(0);
1109
1116
  let d = performance.now(), f = (e) => {
1110
1117
  let t = Math.min(1, (e - d) / a);
1111
- u(ut(t)), y = t < 1 ? requestAnimationFrame(f) : void 0;
1118
+ u(pt(t)), y = t < 1 ? requestAnimationFrame(f) : void 0;
1112
1119
  };
1113
1120
  y = requestAnimationFrame(f);
1114
1121
  }
1115
1122
  };
1116
1123
  }
1117
1124
  function J(e, t) {
1125
+ if (e.label == null && e.symbol != null) return [];
1118
1126
  let n = e.label ?? e.id;
1119
1127
  if (!t || e.label == null || n.length <= Ze) return [n];
1120
1128
  let r = n.length / 2, i = -1;
1121
1129
  for (let e = n.indexOf(" "); e !== -1; e = n.indexOf(" ", e + 1)) (i === -1 || Math.abs(e - r) < Math.abs(i - r)) && (i = e);
1122
1130
  return i === -1 ? [n] : [n.slice(0, i), n.slice(i + 1)];
1123
1131
  }
1124
- function at(e) {
1125
- return Math.max(...e.map((e) => e.length)) * qe;
1132
+ function ct(e) {
1133
+ return e.length === 0 ? 0 : Math.max(...e.map((e) => e.length)) * Ke;
1126
1134
  }
1127
- function ot(e, t, n, r) {
1135
+ function lt(e, t, n, r) {
1128
1136
  let { radius: i } = Z(e), a = {
1129
1137
  anchor: "middle",
1130
1138
  x: 0,
1131
- y: i + He
1139
+ y: i + Be
1132
1140
  };
1133
1141
  if (n === "below" || t.length === 0) return a;
1134
1142
  let o = t.map((t) => Math.atan2((t.y ?? 0) - (e.y ?? 0), (t.x ?? 0) - (e.x ?? 0))).toSorted((e, t) => e - t), s = 0, c = 0;
@@ -1136,33 +1144,33 @@ function ot(e, t, n, r) {
1136
1144
  let n = e === o.length - 1 ? $(o[0]) + Math.PI * 2 : $(o[e + 1]);
1137
1145
  n - t <= s || (s = n - t, c = t + s / 2);
1138
1146
  }
1139
- let l = Math.cos(c), u = Math.sin(c), d = (r.length - 1) * G;
1147
+ let l = Math.cos(c), u = Math.sin(c), d = (r.length - 1) * K;
1140
1148
  if (s < Xe) {
1141
- let e = at(r), t = r.length * G, n = (Math.abs(l) * e + Math.abs(u) * t) / 2, a = (Math.abs(l) * t + Math.abs(u) * e) / 2, o = i + K + n, c = a / Math.tan(s / 2) + n, f = Math.min(Math.max(o, c), o + e);
1149
+ let e = ct(r), t = r.length * K, n = (Math.abs(l) * e + Math.abs(u) * t) / 2, a = (Math.abs(l) * t + Math.abs(u) * e) / 2, o = i + Je + n, c = a / Math.tan(s / 2) + n, f = Math.min(Math.max(o, c), o + e);
1142
1150
  return {
1143
1151
  anchor: "middle",
1144
1152
  x: l * f,
1145
- y: u * f + W / 3 - d / 2
1153
+ y: u * f + Ge / 3 - d / 2
1146
1154
  };
1147
1155
  }
1148
1156
  if (Math.abs(l) < Ye) return u > 0 ? a : {
1149
1157
  anchor: "middle",
1150
1158
  x: 0,
1151
- y: -(i + K) - d
1159
+ y: -(i + Je) - d
1152
1160
  };
1153
- let f = i + K + Math.abs(u) * r.length * G / 2;
1161
+ let f = i + Je + Math.abs(u) * r.length * K / 2;
1154
1162
  return {
1155
1163
  anchor: l > 0 ? "start" : "end",
1156
1164
  x: l * f,
1157
- y: u * f + W / 3 - d / 2
1165
+ y: u * f + Ge / 3 - d / 2
1158
1166
  };
1159
1167
  }
1160
- function st(e) {
1168
+ function ut(e) {
1161
1169
  let t = /* @__PURE__ */ new Map();
1162
1170
  for (let n of e.links) t.set(n.source, [...t.get(n.source) ?? [], n.target]), t.set(n.target, [...t.get(n.target) ?? [], n.source]);
1163
1171
  return t;
1164
1172
  }
1165
- function ct(e) {
1173
+ function dt(e) {
1166
1174
  return `${Y(e.source)}>${Y(e.target)}`;
1167
1175
  }
1168
1176
  function Y(e) {
@@ -1172,22 +1180,22 @@ function X(e, t) {
1172
1180
  return typeof e == "object" ? e[t] ?? 0 : 0;
1173
1181
  }
1174
1182
  function Z(e) {
1175
- return $(rt[Math.max(0, Math.min(e.level ?? Be, rt.length - 1))]);
1183
+ return e.isAction === !0 ? rt : $(ot[Math.max(0, Math.min(e.level ?? Re, ot.length - 1))]);
1176
1184
  }
1177
1185
  function Q(e, t, n) {
1178
1186
  return e + (t - e) * n;
1179
1187
  }
1180
- function lt(e, t, n) {
1188
+ function ft(e, t, n) {
1181
1189
  return {
1182
1190
  x: Q(e.x, t.x, n),
1183
1191
  y: Q(e.y, t.y, n)
1184
1192
  };
1185
1193
  }
1186
- function ut(e) {
1194
+ function pt(e) {
1187
1195
  return e < .5 ? 4 * e ** 3 : 1 - (-2 * e + 2) ** 3 / 2;
1188
1196
  }
1189
1197
  function $(e) {
1190
1198
  if (e === void 0) throw Error("Expected a value in the network diagram.");
1191
1199
  return e;
1192
1200
  }
1193
- export { it as renderNetworkDiagram };
1201
+ export { st as renderNetworkDiagram };
@@ -1,7 +1,10 @@
1
1
  export interface NetworkDiagramNode {
2
2
  id: string;
3
+ isAction?: boolean;
3
4
  label?: string;
4
5
  level?: number;
6
+ symbol?: string;
7
+ title?: string;
5
8
  }
6
9
  export interface NetworkDiagramLink {
7
10
  source: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dpuse/dpuse-tool-d3-visualiser",
3
- "version": "1.0.126",
3
+ "version": "1.0.127",
4
4
  "private": false,
5
5
  "description": "A TypeScript wrapper for D3, TanStack Charts, and Unovis that implements the Data Positioning chart-rendering interface, providing ERD (dagre), Sankey (d3-sankey), chord (Unovis), network (d3-force), tree (d3-hierarchy), and bar chart (TanStack Charts) renderers.",
6
6
  "license": "MIT",