@dpuse/dpuse-tool-d3-visualiser 1.0.130 → 1.0.132

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** | 416.1 kB · gzip 122.7 kB |
241
+ | **All 14 files** | 416.4 kB · gzip 122.8 kB |
242
242
  | **dist/tanStackCharts-DEINbmRi.js** | 125.4 kB · gzip 36.7 kB · 30.1% 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,11 +256,11 @@ _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-ICOsKqeF.js** | 44.5 kB · gzip 13.5 kB · 10.7% of the build |
260
- |     src → networkDiagram.ts | `█████░░░░░░░░░░░░░░░` 26.1% · 11.6 kB |
261
- |     d3-zoom → dist/d3-zoom.mjs | `█████░░░░░░░░░░░░░░░` 24.1% · 10.7 kB |
262
- |     d3-force → dist/d3-force.mjs | `███░░░░░░░░░░░░░░░░░` 17.1% · 7.6 kB |
263
- |     d3-quadtree → src/add.js + 13 more | `███░░░░░░░░░░░░░░░░░` 13.9% · 6.2 kB |
259
+ | **dist/networkDiagram-DS-O0c4v.js** | 44.9 kB · gzip 13.6 kB · 10.8% of the build |
260
+ |     src → networkDiagram.ts | `█████░░░░░░░░░░░░░░░` 26.7% · 12.0 kB |
261
+ |     d3-zoom → dist/d3-zoom.mjs | `█████░░░░░░░░░░░░░░░` 23.9% · 10.7 kB |
262
+ |     d3-force → dist/d3-force.mjs | `███░░░░░░░░░░░░░░░░░` 17.0% · 7.6 kB |
263
+ |     d3-quadtree → src/add.js + 13 more | `███░░░░░░░░░░░░░░░░░` 13.8% · 6.2 kB |
264
264
  |     d3-drag → dist/d3-drag.mjs | `██░░░░░░░░░░░░░░░░░░` 9.6% · 4.3 kB |
265
265
  |     d3-interpolate → src/zoom.js | `░░░░░░░░░░░░░░░░░░░░` 2.2% · 1007 B |
266
266
  |     (bundler output, whitespace & JSON) | `█░░░░░░░░░░░░░░░░░░░` 6.9% · 3.1 kB |
@@ -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-ICOsKqeF.js"), a = i(e, t, n);
35
+ let { renderNetworkDiagram: i } = await import("./networkDiagram-DS-O0c4v.js"), a = i(e, t, n);
36
36
  return r?.(), {
37
37
  destroy: a.destroy,
38
38
  resize: a.resize,
@@ -227,14 +227,14 @@ function k(e) {
227
227
  function A(e) {
228
228
  return e.x + e.vx;
229
229
  }
230
- function j(e) {
230
+ function ee(e) {
231
231
  return e.y + e.vy;
232
232
  }
233
- function ee(e) {
233
+ function te(e) {
234
234
  var t, n, r, i = 1, a = 1;
235
235
  typeof e != "function" && (e = O(e == null ? 1 : +e));
236
236
  function o() {
237
- for (var e, o = t.length, c, l, u, d, f, p, m = 0; m < a; ++m) for (c = C(t, A, j).visitAfter(s), e = 0; e < o; ++e) l = t[e], f = n[l.index], p = f * f, u = l.x + l.vx, d = l.y + l.vy, c.visit(h);
237
+ for (var e, o = t.length, c, l, u, d, f, p, m = 0; m < a; ++m) for (c = C(t, A, ee).visitAfter(s), e = 0; e < o; ++e) l = t[e], f = n[l.index], p = f * f, u = l.x + l.vx, d = l.y + l.vy, c.visit(h);
238
238
  function h(e, t, n, a, o) {
239
239
  var s = e.data, c = e.r, m = f + c;
240
240
  if (s) {
@@ -265,16 +265,16 @@ function ee(e) {
265
265
  return arguments.length ? (e = typeof t == "function" ? t : O(+t), c(), o) : e;
266
266
  }, o;
267
267
  }
268
- function M(e) {
268
+ function ne(e) {
269
269
  return e.index;
270
270
  }
271
- function N(e, t) {
271
+ function j(e, t) {
272
272
  var n = e.get(t);
273
273
  if (!n) throw Error("node not found: " + t);
274
274
  return n;
275
275
  }
276
- function te(e) {
277
- var t = M, n = d, r, i = O(30), a, o, s, c, l, u = 1;
276
+ function re(e) {
277
+ var t = ne, n = d, r, i = O(30), a, o, s, c, l, u = 1;
278
278
  e ??= [];
279
279
  function d(e) {
280
280
  return 1 / Math.min(s[e.source.index], s[e.target.index]);
@@ -285,7 +285,7 @@ function te(e) {
285
285
  function p() {
286
286
  if (o) {
287
287
  var n, i = o.length, l = e.length, u = new Map(o.map((e, n) => [t(e, n, o), e])), d;
288
- for (n = 0, s = Array(i); n < l; ++n) d = e[n], d.index = n, typeof d.source != "object" && (d.source = N(u, d.source)), typeof d.target != "object" && (d.target = N(u, d.target)), s[d.source.index] = (s[d.source.index] || 0) + 1, s[d.target.index] = (s[d.target.index] || 0) + 1;
288
+ for (n = 0, s = Array(i); n < l; ++n) d = e[n], d.index = n, typeof d.source != "object" && (d.source = j(u, d.source)), typeof d.target != "object" && (d.target = j(u, d.target)), s[d.source.index] = (s[d.source.index] || 0) + 1, s[d.target.index] = (s[d.target.index] || 0) + 1;
289
289
  for (n = 0, c = Array(l); n < l; ++n) d = e[n], c[n] = s[d.source.index] / (s[d.source.index] + s[d.target.index]);
290
290
  r = Array(l), m(), a = Array(l), h();
291
291
  }
@@ -310,20 +310,20 @@ function te(e) {
310
310
  return arguments.length ? (i = typeof e == "function" ? e : O(+e), h(), f) : i;
311
311
  }, f;
312
312
  }
313
- var P = 1664525, F = 1013904223, ne = 4294967296;
314
- function re() {
313
+ var ie = 1664525, M = 1013904223, N = 4294967296;
314
+ function P() {
315
315
  let e = 1;
316
- return () => (e = (P * e + F) % ne) / ne;
316
+ return () => (e = (ie * e + M) % N) / N;
317
317
  }
318
- function I(e) {
318
+ function ae(e) {
319
319
  return e.x;
320
320
  }
321
- function ie(e) {
321
+ function F(e) {
322
322
  return e.y;
323
323
  }
324
- var ae = 10, oe = Math.PI * (3 - Math.sqrt(5));
324
+ var I = 10, oe = Math.PI * (3 - Math.sqrt(5));
325
325
  function se(n) {
326
- var r, i = 1, a = .001, o = 1 - a ** (1 / 300), s = 0, c = .6, l = /* @__PURE__ */ new Map(), u = e(p), d = t("tick", "end"), f = re();
326
+ var r, i = 1, a = .001, o = 1 - a ** (1 / 300), s = 0, c = .6, l = /* @__PURE__ */ new Map(), u = e(p), d = t("tick", "end"), f = P();
327
327
  n ??= [];
328
328
  function p() {
329
329
  m(), d.call("tick", r), i < a && (u.stop(), d.call("end", r));
@@ -339,7 +339,7 @@ function se(n) {
339
339
  function h() {
340
340
  for (var e = 0, t = n.length, r; e < t; ++e) {
341
341
  if (r = n[e], r.index = e, r.fx != null && (r.x = r.fx), r.fy != null && (r.y = r.fy), isNaN(r.x) || isNaN(r.y)) {
342
- var i = ae * Math.sqrt(.5 + e), a = e * oe;
342
+ var i = I * Math.sqrt(.5 + e), a = e * oe;
343
343
  r.x = i * Math.cos(a), r.y = i * Math.sin(a);
344
344
  }
345
345
  (isNaN(r.vx) || isNaN(r.vy)) && (r.vx = r.vy = 0);
@@ -393,7 +393,7 @@ function se(n) {
393
393
  function ce() {
394
394
  var e, t, n, r, i = O(-30), a, o = 1, s = Infinity, c = .81;
395
395
  function l(n) {
396
- var i, a = e.length, o = C(e, I, ie).visitAfter(d);
396
+ var i, a = e.length, o = C(e, ae, F).visitAfter(d);
397
397
  for (r = n, i = 0; i < a; ++i) t = e[i], o.visit(f);
398
398
  }
399
399
  function u() {
@@ -755,7 +755,7 @@ function Me(e, t, n) {
755
755
  function Ne() {
756
756
  var e = De, a = Oe, o = Me, s = Ae, c = je, l = [0, Infinity], u = [[-Infinity, -Infinity], [Infinity, Infinity]], d = 250, f = pe, p = t("start", "zoom", "end"), m, h, g, _ = 500, v = 150, y = 0, b = 10;
757
757
  function x(e) {
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)");
758
+ e.property("__zoom", ke).on("wheel.zoom", O, { passive: !1 }).on("mousedown.zoom", k).on("dblclick.zoom", A).filter(c).on("touchstart.zoom", ee).on("touchmove.zoom", te).on("touchend.zoom touchcancel.zoom", ne).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;
@@ -869,7 +869,7 @@ function Ne() {
869
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
- function j(t, ...r) {
872
+ function ee(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
875
  for (Ee(t), l = 0; l < o; ++l) u = a[l], d = i(u, this), d = [
@@ -882,7 +882,7 @@ function Ne() {
882
882
  }, _)), n(this), s.start());
883
883
  }
884
884
  }
885
- function ee(e, ...t) {
885
+ function te(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
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);
@@ -894,7 +894,7 @@ function Ne() {
894
894
  n.zoom("touch", o(C(c, l, d), n.extent, u));
895
895
  }
896
896
  }
897
- function M(e, ...t) {
897
+ function ne(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
900
  for (Ee(e), g && clearTimeout(g), g = setTimeout(function() {
@@ -935,7 +935,7 @@ function Ne() {
935
935
  }, x;
936
936
  }
937
937
  // src/networkDiagram.ts
938
- var Pe = -300, Fe = 100, Ie = 2, Le = 400, Re = 640, ze = 480, Be = 180, Ve = 1, He = 2, Ue = 14, We = 70, Ge = 130, Ke = .25, qe = 4, Je = 12, W = 14, Ye = 6.2, Xe = 4, Ze = 8, Qe = .35, $e = Math.PI * .75, et = 10, tt = .6, nt = 16, rt = 10, it = 3, at = 12, G = {
938
+ var Pe = -300, Fe = 100, Ie = 2, Le = 2, Re = 400, ze = 640, W = 480, Be = 180, Ve = 1, He = 2, Ue = 14, We = 70, Ge = 130, Ke = .25, qe = 4, Je = 12, G = 14, Ye = 6.2, Xe = 4, Ze = 8, Qe = .35, $e = Math.PI * .75, et = 10, tt = .6, nt = 16, rt = 10, it = 3, at = 12, K = {
939
939
  linkStroke: "#9ca3af",
940
940
  nodeFillSelected: "#f59e0b",
941
941
  nodeStrokeSelected: "#b45309",
@@ -947,7 +947,7 @@ var Pe = -300, Fe = 100, Ie = 2, Le = 400, Re = 640, ze = 480, Be = 180, Ve = 1,
947
947
  stroke: "#2563eb",
948
948
  strokeHovered: "#1d4ed8",
949
949
  symbol: "#1d4ed8"
950
- }, st = "icon", ct = "#ffffff", lt = 16, ut = 1.2, K = "symbol", dt = 20, ft = 6, pt = 2.5, mt = [
950
+ }, st = "icon", ct = "#ffffff", lt = 16, ut = 20, q = "symbol", dt = 20, ft = 583 / 100, pt = Math.round(ut * 1.25 / 24 * 100) / 100, mt = [
951
951
  {
952
952
  fill: "#475569",
953
953
  fillHovered: "#64748b",
@@ -985,8 +985,8 @@ var Pe = -300, Fe = 100, Ie = 2, Le = 400, Re = 640, ze = 480, Be = 180, Ve = 1,
985
985
  }
986
986
  ];
987
987
  function ht(e, t, n = {}) {
988
- let i = n.labelPlacementId ?? "below", a = n.transitionDuration ?? Le, o = t.clientWidth || Re, s = t.clientHeight || ze, c = te().id((e) => e.id), l = se().force("link", c).force("charge", ce().strength(n.chargeStrength ?? Pe)).force("center", D(o / 2, s / 2));
989
- n.reservesLabelRoom === !0 && l.force("collide", ee((e) => Z(e).radius + rt)), l.stop();
988
+ let i = n.labelPlacementId ?? "below", a = n.transitionDuration ?? Re, o = t.clientWidth || ze, s = t.clientHeight || W, c = re().id((e) => e.id), l = se().force("link", c).force("charge", ce().strength(n.chargeStrength ?? Pe)).force("center", D(o / 2, s / 2));
989
+ n.reservesLabelRoom === !0 && l.force("collide", te((e) => Z(e).radius + rt)), l.stop();
990
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();
991
991
  if (m == null) throw Error("Failed to create network diagram SVG element.");
992
992
  let h = e, g = [], _ = [], v = /* @__PURE__ */ new Map(), y, b = null, x = null, S = f.selectAll("line"), C = p.selectAll("g"), w = (e, t) => {
@@ -996,12 +996,12 @@ function ht(e, t, n = {}) {
996
996
  for (let e of r) {
997
997
  let r = t.get(e);
998
998
  if (!r) continue;
999
- let i = r.label == null ? 0 : gt(q(r, n.wrapsLabels === !0)) * tt;
999
+ let i = r.label == null ? 0 : gt(J(r, n.wrapsLabels === !0)) * tt;
1000
1000
  a += Math.max(Z(r).radius * 2, i) + nt, o = Math.max(o, Z(r).radius);
1001
1001
  }
1002
1002
  let s = a / (Math.PI * 2), c = t.get(e);
1003
1003
  if (i === "below" || c?.label == null) return s;
1004
- let l = gt(q(c, n.wrapsLabels === !0));
1004
+ let l = gt(J(c, n.wrapsLabels === !0));
1005
1005
  return Math.max(s, Z(c).radius + 16 + l + o);
1006
1006
  };
1007
1007
  c.distance((e) => {
@@ -1010,42 +1010,48 @@ function ht(e, t, n = {}) {
1010
1010
  let r = new Map(g.map((e) => [e.id, e]));
1011
1011
  return Math.max(t, w(Y(e.source), r), w(Y(e.target), r));
1012
1012
  });
1013
- let T = n.selectsOnClick !== !1, E = (e) => e.isAction !== !0 && (T ? e.id === b : e.isSelected === !0), O = n.nodeBorderWidth ?? Ie, k = (e) => E(e) && e.icon != null && n.selectedIconNodeColor != null, A = (e) => E(e) && !k(e), j = () => {
1014
- C.select("circle").attr("fill", (e) => e.icon == null ? A(e) ? G.nodeFillSelected : e.id === x ? Z(e).fillHovered : Z(e).fill : null).style("fill", (e) => e.icon == null ? A(e) ? null : e.color ?? null : (k(e) ? n.selectedIconNodeColor : n.iconNodeColor) ?? ct).attr("stroke", (e) => A(e) ? G.nodeStrokeSelected : e.id === x ? Z(e).strokeHovered : Z(e).stroke).style("stroke", (e) => A(e) || e.isAction === !0 ? null : e.color ?? null).attr("stroke-width", (e) => A(e) ? O + 1 : O).attr("r", (e) => Z(e).radius + (E(e) || e.id === x ? He : 0));
1013
+ let T = n.selectsOnClick !== !1, E = (e) => e.isAction !== !0 && (T ? e.id === b : e.isSelected === !0), O = n.nodeBorderWidth ?? Le, k = (e) => E(e) && e.icon != null && n.selectedIconNodeColor != null, A = (e) => E(e) && !k(e), ee = (e) => {
1014
+ let t = n.actionNodeColors;
1015
+ return t == null ? null : e.id === x ? t.fillHovered ?? t.fill : t.fill;
1016
+ }, ne = (e) => e.id === x && n.hoveredIconNodeColor != null ? n.hoveredIconNodeColor : (k(e) ? n.selectedIconNodeColor : n.iconNodeColor) ?? ct, j = () => {
1017
+ C.select("circle").attr("fill", (e) => e.icon == null ? A(e) ? K.nodeFillSelected : e.id === x ? Z(e).fillHovered : Z(e).fill : null).style("fill", (e) => e.isAction === !0 ? ee(e) : e.icon == null ? A(e) ? null : e.color ?? null : ne(e)).attr("stroke", (e) => A(e) ? K.nodeStrokeSelected : e.id === x ? Z(e).strokeHovered : Z(e).stroke).style("stroke", (e) => e.isAction === !0 ? n.actionNodeColors?.border ?? null : A(e) ? null : e.color ?? null).attr("stroke-width", (e) => A(e) ? O + 1 : O).attr("r", (e) => {
1018
+ let t = E(e) || e.id === x;
1019
+ return Z(e).radius + (t && n.growsActiveNodes !== !1 ? He : 0);
1020
+ });
1015
1021
  };
1016
1022
  u.on("click", () => {
1017
1023
  b = null, j();
1018
1024
  });
1019
- let M = Ne().scaleExtent([Ke, qe]).on("zoom", (e) => {
1025
+ let ie = Ne().scaleExtent([Ke, qe]).on("zoom", (e) => {
1020
1026
  d.attr("transform", e.transform.toString());
1021
1027
  });
1022
- u.call(M).on("dblclick.zoom", null);
1023
- let N = () => {
1028
+ u.call(ie).on("dblclick.zoom", null);
1029
+ let M = () => {
1024
1030
  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)})`);
1025
1031
  let e = new Map(g.map((e) => [e.id, e]));
1026
1032
  C.each((t, a, o) => {
1027
1033
  if (t.label == null) return;
1028
- let s = _t(t, (v.get(t.id) ?? []).map((t) => e.get(t)).filter((e) => e !== void 0), i, q(t, n.wrapsLabels === !0));
1034
+ let s = _t(t, (v.get(t.id) ?? []).map((t) => e.get(t)).filter((e) => e !== void 0), i, J(t, n.wrapsLabels === !0));
1029
1035
  r($(o[a])).select("text").attr("text-anchor", s.anchor).attr("y", s.y).selectAll("tspan").attr("x", s.x);
1030
1036
  });
1031
- }, P = () => {
1037
+ }, N = () => {
1032
1038
  if (g.length === 0) return;
1033
1039
  let e = g.map((e) => e.x ?? 0), n = g.map((e) => e.y ?? 0), [r, a, o, s] = [
1034
1040
  Math.min(...e),
1035
1041
  Math.max(...e),
1036
1042
  Math.min(...n),
1037
1043
  Math.max(...n)
1038
- ], c = t.clientWidth || Re, l = t.clientHeight || ze, u = i === "outside" ? Ge : We, d = Math.max(Ke, Math.min(1, c / (a - r + u * 2), l / (s - o + u * 2)));
1044
+ ], c = t.clientWidth || ze, l = t.clientHeight || W, u = i === "outside" ? Ge : We, d = Math.max(Ke, Math.min(1, c / (a - r + u * 2), l / (s - o + u * 2)));
1039
1045
  return H.translate(c / 2, l / 2).scale(d).translate(-(r + a) / 2, -(o + s) / 2);
1040
- }, F = (e) => {
1046
+ }, P = (e) => {
1041
1047
  u.call((t) => {
1042
- M.transform(t, e);
1048
+ ie.transform(t, e);
1043
1049
  });
1044
- }, ne = () => {
1050
+ }, ae = () => {
1045
1051
  l.alpha(1);
1046
1052
  for (let e = 0; e < Be; e += 1) l.tick();
1047
1053
  l.stop();
1048
- }, re = () => {
1054
+ }, F = () => {
1049
1055
  y !== void 0 && cancelAnimationFrame(y), y = void 0;
1050
1056
  }, I = (e) => {
1051
1057
  let t = new Map(g.map((e) => [e.id, e]));
@@ -1057,7 +1063,7 @@ function ht(e, t, n = {}) {
1057
1063
  }
1058
1064
  l.nodes(g), c.links(_);
1059
1065
  let i = S.data(_, St), a = i.exit();
1060
- S = i.enter().append("line").attr("stroke", G.linkStroke).attr("stroke-width", 2).merge(i);
1066
+ S = i.enter().append("line").attr("stroke", K.linkStroke).attr("stroke-width", n.linkWidth ?? Ie).merge(i);
1061
1067
  let u = C.data(g, (e) => e.id), d = u.exit().style("pointer-events", "none"), f = u.enter().append("g").style("cursor", "pointer");
1062
1068
  return f.append("title"), f.append("circle"), f.append("text"), f.on("mouseenter", (e, t) => {
1063
1069
  x = t.id, j();
@@ -1068,53 +1074,53 @@ function ht(e, t, n = {}) {
1068
1074
  }).call(Ce().on("start", (e, t) => {
1069
1075
  e.sourceEvent?.stopPropagation(), t.fx = t.x, t.fy = t.y;
1070
1076
  }).on("drag", (e, t) => {
1071
- t.x = e.x, t.y = e.y, t.fx = e.x, t.fy = e.y, N();
1077
+ t.x = e.x, t.y = e.y, t.fx = e.x, t.fy = e.y, M();
1072
1078
  }).on("end", (e, t) => {
1073
1079
  t.fx = null, t.fy = null;
1074
- })), C = f.merge(u), C.select("text").attr("text-anchor", "middle").attr("y", (e) => e.label == null ? 4 : Z(e).radius + Ue).attr("font-size", (e) => e.label == null ? null : Je).attr("fill", (e) => e.label == null ? G.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(Xe)}px`).selectAll("tspan").data((e) => q(e, n.wrapsLabels === !0)).join("tspan").attr("x", 0).attr("dy", (e, t) => t === 0 ? 0 : W).text((e) => e), C.selectAll(`image.${st}`).data((e) => e.icon == null ? [] : [e]).join("image").attr("class", st).attr("href", (e) => `data:image/svg+xml,${encodeURIComponent(e.icon ?? "")}`).attr("x", (e) => -J(e) / 2).attr("y", (e) => -J(e) / 2).attr("width", J).attr("height", J).style("pointer-events", "none"), C.select("title").text((e) => e.title ?? ""), C.selectAll(`path.${K}`).data((e) => vt(e) == null ? [] : [e]).join("path").attr("class", K).attr("d", (e) => vt(e) ?? "").attr("fill", "none").attr("stroke", yt).attr("stroke-linecap", "round").attr("stroke-width", pt).style("pointer-events", "none"), C.selectAll(`text.${K}`).data((e) => e.symbol == null || vt(e) != null ? [] : [e]).join("text").attr("class", K).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("font-size", dt).attr("font-weight", 600).attr("fill", yt).style("pointer-events", "none").text((e) => e.symbol ?? ""), j(), {
1080
+ })), C = f.merge(u), C.select("text").attr("text-anchor", "middle").attr("y", (e) => e.label == null ? 4 : Z(e).radius + Ue).attr("font-size", (e) => e.label == null ? null : Je).attr("fill", (e) => e.label == null ? K.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(Xe)}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), C.selectAll(`image.${st}`).data((e) => e.icon == null ? [] : [e]).join("image").attr("class", st).attr("href", (e) => `data:image/svg+xml,${encodeURIComponent(e.icon ?? "")}`).attr("x", -10).attr("y", -10).attr("width", ut).attr("height", ut).style("pointer-events", "none"), C.select("title").text((e) => e.title ?? ""), C.selectAll(`path.${q}`).data((e) => vt(e) == null ? [] : [e]).join("path").attr("class", q).attr("d", (e) => vt(e) ?? "").attr("fill", "none").attr("stroke", yt).style("stroke", (e) => e.isAction === !0 ? n.actionNodeColors?.symbol ?? null : null).attr("stroke-linecap", "round").attr("stroke-width", pt).style("pointer-events", "none"), C.selectAll(`text.${q}`).data((e) => e.symbol == null || vt(e) != null ? [] : [e]).join("text").attr("class", q).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("font-size", dt).attr("font-weight", 600).attr("fill", yt).style("pointer-events", "none").text((e) => e.symbol ?? ""), j(), {
1075
1081
  enteringNodes: f,
1076
1082
  exitingLinks: a,
1077
1083
  exitingNodes: d
1078
1084
  };
1079
1085
  };
1080
- return I(e), N(), {
1086
+ return I(e), M(), {
1081
1087
  destroy: () => {
1082
- re(), l.stop(), u.remove();
1088
+ F(), l.stop(), u.remove();
1083
1089
  },
1084
1090
  resize: () => {
1085
- let e = t.clientWidth || Re, r = t.clientHeight || ze;
1091
+ let e = t.clientWidth || ze, r = t.clientHeight || W;
1086
1092
  if (u.attr("width", e).attr("height", r).attr("viewBox", `0 0 ${String(e)} ${String(r)}`), l.force("center", D(e / 2, r / 2)), y !== void 0 || n.fitsView !== !0) return;
1087
- let i = P();
1088
- i && F(i);
1093
+ let i = N();
1094
+ i && P(i);
1089
1095
  },
1090
1096
  svg: m,
1091
1097
  triggerAutoLayout: () => {
1092
- re(), ne(), N();
1093
- let e = n.fitsView === !0 ? P() : void 0;
1094
- e && F(e);
1098
+ F(), ae(), M();
1099
+ let e = n.fitsView === !0 ? N() : void 0;
1100
+ e && P(e);
1095
1101
  },
1096
1102
  update: (e) => {
1097
1103
  if (bt(e) === bt(h)) {
1098
- I(e), y === void 0 && N();
1104
+ I(e), y === void 0 && M();
1099
1105
  return;
1100
1106
  }
1101
- re();
1107
+ F();
1102
1108
  let { enteringNodes: t, exitingLinks: r, exitingNodes: i } = I(e), o = new Map(g.map((e) => [e.id, {
1103
1109
  x: e.x ?? 0,
1104
1110
  y: e.y ?? 0
1105
1111
  }]));
1106
- ne();
1112
+ ae();
1107
1113
  let s = new Map(g.map((e) => [e.id, {
1108
1114
  x: e.x ?? 0,
1109
1115
  y: e.y ?? 0
1110
- }])), c = Te(m), l = (n.fitsView === !0 ? P() : void 0) ?? c, u = (e) => {
1116
+ }])), c = Te(m), l = (n.fitsView === !0 ? N() : void 0) ?? c, u = (e) => {
1111
1117
  for (let t of g) {
1112
1118
  let n = Ct($(o.get(t.id)), $(s.get(t.id)), e);
1113
1119
  t.x = n.x, t.y = n.y;
1114
1120
  }
1115
- if (N(), t.style("opacity", e), i.style("opacity", 1 - e), r.style("opacity", 1 - e), F(H.translate(Q(c.x, l.x, e), Q(c.y, l.y, e)).scale(Q(c.k, l.k, e))), e < 1) return;
1116
- let a = n.fitsView === !0 ? P() : void 0;
1117
- a && F(a), t.style("opacity", null), i.remove(), r.remove();
1121
+ if (M(), t.style("opacity", e), i.style("opacity", 1 - e), r.style("opacity", 1 - e), P(H.translate(Q(c.x, l.x, e), Q(c.y, l.y, e)).scale(Q(c.k, l.k, e))), e < 1) return;
1122
+ let a = n.fitsView === !0 ? N() : void 0;
1123
+ a && P(a), t.style("opacity", null), i.remove(), r.remove();
1118
1124
  };
1119
1125
  if (a <= 0) {
1120
1126
  u(1);
@@ -1129,7 +1135,7 @@ function ht(e, t, n = {}) {
1129
1135
  }
1130
1136
  };
1131
1137
  }
1132
- function q(e, t) {
1138
+ function J(e, t) {
1133
1139
  if (e.label == null && e.symbol != null) return [];
1134
1140
  let n = e.label ?? e.id;
1135
1141
  if (!t || e.label == null || n.length <= et) return [n];
@@ -1152,9 +1158,9 @@ function _t(e, t, n, r) {
1152
1158
  let n = e === o.length - 1 ? $(o[0]) + Math.PI * 2 : $(o[e + 1]);
1153
1159
  n - t <= s || (s = n - t, c = t + s / 2);
1154
1160
  }
1155
- let l = Math.cos(c), u = Math.sin(c), d = (r.length - 1) * W;
1161
+ let l = Math.cos(c), u = Math.sin(c), d = (r.length - 1) * G;
1156
1162
  if (s < $e) {
1157
- let e = gt(r), t = r.length * W, n = (Math.abs(l) * e + Math.abs(u) * t) / 2, a = (Math.abs(l) * t + Math.abs(u) * e) / 2, o = i + Ze + n, c = a / Math.tan(s / 2) + n, f = Math.min(Math.max(o, c), o + e);
1163
+ let e = gt(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 + Ze + n, c = a / Math.tan(s / 2) + n, f = Math.min(Math.max(o, c), o + e);
1158
1164
  return {
1159
1165
  anchor: "middle",
1160
1166
  x: l * f,
@@ -1166,7 +1172,7 @@ function _t(e, t, n, r) {
1166
1172
  x: 0,
1167
1173
  y: -(i + Ze) - d
1168
1174
  };
1169
- let f = i + Ze + Math.abs(u) * r.length * W / 2;
1175
+ let f = i + Ze + Math.abs(u) * r.length * G / 2;
1170
1176
  return {
1171
1177
  anchor: l > 0 ? "start" : "end",
1172
1178
  x: l * f,
@@ -1175,13 +1181,10 @@ function _t(e, t, n, r) {
1175
1181
  }
1176
1182
  function vt(e) {
1177
1183
  let t = ft;
1178
- return e.symbol === "+" ? `M-6,0H${String(t)}M0,-6V${String(t)}` : void 0;
1184
+ return e.symbol === "+" ? `M-5.83,0H${String(t)}M0,-5.83V${String(t)}` : void 0;
1179
1185
  }
1180
1186
  function yt(e) {
1181
- return e.isAction === !0 ? ot.symbol : G.nodeText;
1182
- }
1183
- function J(e) {
1184
- return Math.round(Z(e).radius * ut);
1187
+ return e.isAction === !0 ? ot.symbol : K.nodeText;
1185
1188
  }
1186
1189
  function bt(e) {
1187
1190
  return JSON.stringify([e.nodes.map((e) => [
@@ -1211,7 +1214,7 @@ function Z(e) {
1211
1214
  let t = $(mt[Math.max(0, Math.min(e.level ?? Ve, mt.length - 1))]);
1212
1215
  return e.icon == null ? t : {
1213
1216
  ...t,
1214
- radius: Math.max(t.radius, lt),
1217
+ radius: lt,
1215
1218
  stroke: t.fill,
1216
1219
  strokeHovered: t.stroke
1217
1220
  };
@@ -8,7 +8,8 @@ import { TreeDiagramNode, TreeDiagramOptions } from './treeDiagram';
8
8
  export type { BarChartData, BarChartSeries } from './tanStackCharts';
9
9
  export type { ChordDiagramData, ChordDiagramLink, ChordDiagramNode, ChordDiagramOptions } from './chordDiagram';
10
10
  export type { ErdDiagramData, ErdDiagramEdge, ErdDiagramNode, ErdDiagramNodeTypeId, ErdDiagramOptions } from './erdDiagram';
11
- export type { NetworkDiagramData, NetworkDiagramLabelPlacementId, NetworkDiagramLink, NetworkDiagramNode, NetworkDiagramOptions } from './networkDiagram';
11
+ export type { NetworkDiagramActionNodeColors, NetworkDiagramData, NetworkDiagramLabelPlacementId } from './networkDiagram';
12
+ export type { NetworkDiagramLink, NetworkDiagramNode, NetworkDiagramOptions } from './networkDiagram';
12
13
  export type { SankeyDiagramData, SankeyDiagramLink, SankeyDiagramNode, SankeyDiagramOptions } from './sankeyDiagram';
13
14
  export type { TreeDiagramNode, TreeDiagramNodeRoleId, TreeDiagramOptions } from './treeDiagram';
14
15
  export interface D3View extends PresentationView {
@@ -18,12 +18,16 @@ export interface NetworkDiagramData {
18
18
  nodes: NetworkDiagramNode[];
19
19
  }
20
20
  export interface NetworkDiagramOptions {
21
+ actionNodeColors?: NetworkDiagramActionNodeColors;
21
22
  chargeStrength?: number;
22
23
  fitsView?: boolean;
24
+ growsActiveNodes?: boolean;
25
+ hoveredIconNodeColor?: string;
23
26
  iconNodeColor?: string;
24
27
  labelHaloColor?: string;
25
28
  labelPlacementId?: NetworkDiagramLabelPlacementId;
26
29
  linkDistance?: number;
30
+ linkWidth?: number;
27
31
  nodeBorderWidth?: number;
28
32
  onNodeClick?: (node: NetworkDiagramNode) => void;
29
33
  reservesLabelRoom?: boolean;
@@ -32,6 +36,12 @@ export interface NetworkDiagramOptions {
32
36
  transitionDuration?: number;
33
37
  wrapsLabels?: boolean;
34
38
  }
39
+ export interface NetworkDiagramActionNodeColors {
40
+ border: string;
41
+ fill: string;
42
+ fillHovered?: string;
43
+ symbol: string;
44
+ }
35
45
  export type NetworkDiagramLabelPlacementId = 'below' | 'outside';
36
46
  export interface NetworkDiagramHandle {
37
47
  destroy: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dpuse/dpuse-tool-d3-visualiser",
3
- "version": "1.0.130",
3
+ "version": "1.0.132",
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",