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

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.4 kB · gzip 122.8 kB |
241
+ | **All 14 files** | 416.5 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,10 +256,10 @@ _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-DS-O0c4v.js** | 44.9 kB · gzip 13.6 kB · 10.8% of the build |
260
- |     src → networkDiagram.ts | `█████░░░░░░░░░░░░░░░` 26.7% · 12.0 kB |
259
+ | **dist/networkDiagram-DAy9A8N3.js** | 45.0 kB · gzip 13.6 kB · 10.8% of the build |
260
+ |     src → networkDiagram.ts | `█████░░░░░░░░░░░░░░░` 26.8% · 12.1 kB |
261
261
  |     d3-zoom → dist/d3-zoom.mjs | `█████░░░░░░░░░░░░░░░` 23.9% · 10.7 kB |
262
- |     d3-force → dist/d3-force.mjs | `███░░░░░░░░░░░░░░░░░` 17.0% · 7.6 kB |
262
+ |     d3-force → dist/d3-force.mjs | `███░░░░░░░░░░░░░░░░░` 16.9% · 7.6 kB |
263
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 |
@@ -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 437 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-DS-O0c4v.js"), a = i(e, t, n);
35
+ let { renderNetworkDiagram: i } = await import("./networkDiagram-DAy9A8N3.js"), a = i(e, t, n);
36
36
  return r?.(), {
37
37
  destroy: a.destroy,
38
38
  resize: a.resize,
@@ -935,19 +935,19 @@ function Ne() {
935
935
  }, x;
936
936
  }
937
937
  // src/networkDiagram.ts
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 = {
938
+ var Pe = -300, Fe = 100, Ie = 2, Le = 2, Re = 400, ze = 640, Be = 480, Ve = 180, He = 1, Ue = 2, We = 14, Ge = 70, Ke = 130, qe = .25, Je = 4, Ye = 12, W = 14, Xe = 6.2, Ze = 4, Qe = 8, $e = .35, et = Math.PI * .75, tt = 10, nt = .6, rt = 16, it = 10, at = 3, ot = 12, G = {
939
939
  linkStroke: "#9ca3af",
940
940
  nodeFillSelected: "#f59e0b",
941
941
  nodeStrokeSelected: "#b45309",
942
942
  nodeText: "#ffffff"
943
- }, ot = {
943
+ }, st = {
944
944
  fill: "#dbeafe",
945
945
  fillHovered: "#bfdbfe",
946
- radius: 16,
946
+ radius: 20,
947
947
  stroke: "#2563eb",
948
948
  strokeHovered: "#1d4ed8",
949
949
  symbol: "#1d4ed8"
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 = [
950
+ }, ct = "icon", lt = "#ffffff", ut = 20, dt = 24, K = "symbol", ft = 20, pt = 20, mt = 583 / 100, ht = Math.round(pt * 1.25 / 24 * 100) / 100, gt = [
951
951
  {
952
952
  fill: "#475569",
953
953
  fillHovered: "#64748b",
@@ -984,24 +984,24 @@ var Pe = -300, Fe = 100, Ie = 2, Le = 2, Re = 400, ze = 640, W = 480, Be = 180,
984
984
  strokeHovered: "#be185d"
985
985
  }
986
986
  ];
987
- function ht(e, t, n = {}) {
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();
987
+ function _t(e, t, n = {}) {
988
+ let i = n.labelPlacementId ?? "below", a = n.transitionDuration ?? Re, o = t.clientWidth || ze, s = t.clientHeight || Be, 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 + it)), 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) => {
993
993
  let r = v.get(e) ?? [];
994
- if (r.length < it) return 0;
994
+ if (r.length < at) return 0;
995
995
  let a = 0, o = 0;
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(J(r, n.wrapsLabels === !0)) * tt;
1000
- a += Math.max(Z(r).radius * 2, i) + nt, o = Math.max(o, Z(r).radius);
999
+ let i = r.label == null ? 0 : J(q(r, n.wrapsLabels === !0)) * nt;
1000
+ a += Math.max(Z(r).radius * 2, i) + rt, 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(J(c, n.wrapsLabels === !0));
1004
+ let l = J(q(c, n.wrapsLabels === !0));
1005
1005
  return Math.max(s, Z(c).radius + 16 + l + o);
1006
1006
  };
1007
1007
  c.distance((e) => {
@@ -1013,16 +1013,16 @@ function ht(e, t, n = {}) {
1013
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
1014
  let t = n.actionNodeColors;
1015
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) => {
1016
+ }, ne = (e) => e.id === x && n.hoveredIconNodeColor != null ? n.hoveredIconNodeColor : k(e) && n.selectedIconNodeColor != null ? n.selectedIconNodeColor : e.discColor ?? n.iconNodeColor ?? lt, j = () => {
1017
+ 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.isAction === !0 ? ee(e) : e.icon == null ? A(e) ? null : e.color ?? null : ne(e)).attr("stroke", (e) => A(e) ? G.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
1018
  let t = E(e) || e.id === x;
1019
- return Z(e).radius + (t && n.growsActiveNodes !== !1 ? He : 0);
1019
+ return Z(e).radius + (t && n.growsActiveNodes !== !1 ? Ue : 0);
1020
1020
  });
1021
1021
  };
1022
1022
  u.on("click", () => {
1023
1023
  b = null, j();
1024
1024
  });
1025
- let ie = Ne().scaleExtent([Ke, qe]).on("zoom", (e) => {
1025
+ let ie = Ne().scaleExtent([qe, Je]).on("zoom", (e) => {
1026
1026
  d.attr("transform", e.transform.toString());
1027
1027
  });
1028
1028
  u.call(ie).on("dblclick.zoom", null);
@@ -1031,7 +1031,7 @@ function ht(e, t, n = {}) {
1031
1031
  let e = new Map(g.map((e) => [e.id, e]));
1032
1032
  C.each((t, a, o) => {
1033
1033
  if (t.label == null) return;
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));
1034
+ let s = vt(t, (v.get(t.id) ?? []).map((t) => e.get(t)).filter((e) => e !== void 0), i, q(t, n.wrapsLabels === !0));
1035
1035
  r($(o[a])).select("text").attr("text-anchor", s.anchor).attr("y", s.y).selectAll("tspan").attr("x", s.x);
1036
1036
  });
1037
1037
  }, N = () => {
@@ -1041,7 +1041,7 @@ function ht(e, t, n = {}) {
1041
1041
  Math.max(...e),
1042
1042
  Math.min(...n),
1043
1043
  Math.max(...n)
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)));
1044
+ ], c = t.clientWidth || ze, l = t.clientHeight || Be, u = i === "outside" ? Ke : Ge, d = Math.max(qe, Math.min(1, c / (a - r + u * 2), l / (s - o + u * 2)));
1045
1045
  return H.translate(c / 2, l / 2).scale(d).translate(-(r + a) / 2, -(o + s) / 2);
1046
1046
  }, P = (e) => {
1047
1047
  u.call((t) => {
@@ -1049,21 +1049,21 @@ function ht(e, t, n = {}) {
1049
1049
  });
1050
1050
  }, ae = () => {
1051
1051
  l.alpha(1);
1052
- for (let e = 0; e < Be; e += 1) l.tick();
1052
+ for (let e = 0; e < Ve; e += 1) l.tick();
1053
1053
  l.stop();
1054
1054
  }, F = () => {
1055
1055
  y !== void 0 && cancelAnimationFrame(y), y = void 0;
1056
1056
  }, I = (e) => {
1057
1057
  let t = new Map(g.map((e) => [e.id, e]));
1058
- h = e, v = xt(e), g = e.nodes.map((e) => ({ ...e })), _ = e.links.map((e) => ({ ...e }));
1058
+ h = e, v = St(e), g = e.nodes.map((e) => ({ ...e })), _ = e.links.map((e) => ({ ...e }));
1059
1059
  let r = Math.min(o, s) * .22;
1060
1060
  for (let [e, n] of g.entries()) {
1061
1061
  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;
1062
- i ? (n.x = i.x, n.y = i.y) : c ? (n.x = (c.x ?? 0) + Math.cos(l) * at, n.y = (c.y ?? 0) + Math.sin(l) * at) : (n.x = o / 2 + Math.cos(l) * r, n.y = s / 2 + Math.sin(l) * r);
1062
+ i ? (n.x = i.x, n.y = i.y) : c ? (n.x = (c.x ?? 0) + Math.cos(l) * ot, n.y = (c.y ?? 0) + Math.sin(l) * ot) : (n.x = o / 2 + Math.cos(l) * r, n.y = s / 2 + Math.sin(l) * r);
1063
1063
  }
1064
1064
  l.nodes(g), c.links(_);
1065
- let i = S.data(_, St), a = i.exit();
1066
- S = i.enter().append("line").attr("stroke", K.linkStroke).attr("stroke-width", n.linkWidth ?? Ie).merge(i);
1065
+ let i = S.data(_, Ct), a = i.exit();
1066
+ S = i.enter().append("line").attr("stroke", G.linkStroke).attr("stroke-width", n.linkWidth ?? Ie).merge(i);
1067
1067
  let u = C.data(g, (e) => e.id), d = u.exit().style("pointer-events", "none"), f = u.enter().append("g").style("cursor", "pointer");
1068
1068
  return f.append("title"), f.append("circle"), f.append("text"), f.on("mouseenter", (e, t) => {
1069
1069
  x = t.id, j();
@@ -1077,7 +1077,7 @@ function ht(e, t, n = {}) {
1077
1077
  t.x = e.x, t.y = e.y, t.fx = e.x, t.fy = e.y, M();
1078
1078
  }).on("end", (e, t) => {
1079
1079
  t.fx = null, t.fy = null;
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(), {
1080
+ })), C = f.merge(u), C.select("text").attr("text-anchor", "middle").attr("y", (e) => e.label == null ? 4 : Z(e).radius + We).attr("font-size", (e) => e.label == null ? null : Ye).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(Ze)}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.${ct}`).data((e) => e.icon == null ? [] : [e]).join("image").attr("class", ct).attr("href", (e) => `data:image/svg+xml,${encodeURIComponent(e.icon ?? "")}`).attr("x", -12).attr("y", -12).attr("width", dt).attr("height", dt).style("pointer-events", "none"), C.select("title").text((e) => e.title ?? ""), C.selectAll(`path.${K}`).data((e) => yt(e) == null ? [] : [e]).join("path").attr("class", K).attr("d", (e) => yt(e) ?? "").attr("fill", "none").attr("stroke", bt).style("stroke", (e) => e.isAction === !0 ? n.actionNodeColors?.symbol ?? null : null).attr("stroke-linecap", "round").attr("stroke-width", ht).style("pointer-events", "none"), C.selectAll(`text.${K}`).data((e) => e.symbol == null || yt(e) != null ? [] : [e]).join("text").attr("class", K).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("font-size", ft).attr("font-weight", 600).attr("fill", bt).style("pointer-events", "none").text((e) => e.symbol ?? ""), j(), {
1081
1081
  enteringNodes: f,
1082
1082
  exitingLinks: a,
1083
1083
  exitingNodes: d
@@ -1088,7 +1088,7 @@ function ht(e, t, n = {}) {
1088
1088
  F(), l.stop(), u.remove();
1089
1089
  },
1090
1090
  resize: () => {
1091
- let e = t.clientWidth || ze, r = t.clientHeight || W;
1091
+ let e = t.clientWidth || ze, r = t.clientHeight || Be;
1092
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;
1093
1093
  let i = N();
1094
1094
  i && P(i);
@@ -1100,7 +1100,7 @@ function ht(e, t, n = {}) {
1100
1100
  e && P(e);
1101
1101
  },
1102
1102
  update: (e) => {
1103
- if (bt(e) === bt(h)) {
1103
+ if (xt(e) === xt(h)) {
1104
1104
  I(e), y === void 0 && M();
1105
1105
  return;
1106
1106
  }
@@ -1115,7 +1115,7 @@ function ht(e, t, n = {}) {
1115
1115
  y: e.y ?? 0
1116
1116
  }])), c = Te(m), l = (n.fitsView === !0 ? N() : void 0) ?? c, u = (e) => {
1117
1117
  for (let t of g) {
1118
- let n = Ct($(o.get(t.id)), $(s.get(t.id)), e);
1118
+ let n = wt($(o.get(t.id)), $(s.get(t.id)), e);
1119
1119
  t.x = n.x, t.y = n.y;
1120
1120
  }
1121
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;
@@ -1129,28 +1129,28 @@ function ht(e, t, n = {}) {
1129
1129
  u(0);
1130
1130
  let d = performance.now(), f = (e) => {
1131
1131
  let t = Math.min(1, (e - d) / a);
1132
- u(wt(t)), y = t < 1 ? requestAnimationFrame(f) : void 0;
1132
+ u(Tt(t)), y = t < 1 ? requestAnimationFrame(f) : void 0;
1133
1133
  };
1134
1134
  y = requestAnimationFrame(f);
1135
1135
  }
1136
1136
  };
1137
1137
  }
1138
- function J(e, t) {
1138
+ function q(e, t) {
1139
1139
  if (e.label == null && e.symbol != null) return [];
1140
1140
  let n = e.label ?? e.id;
1141
- if (!t || e.label == null || n.length <= et) return [n];
1141
+ if (!t || e.label == null || n.length <= tt) return [n];
1142
1142
  let r = n.length / 2, i = -1;
1143
1143
  for (let e = n.indexOf(" "); e !== -1; e = n.indexOf(" ", e + 1)) (i === -1 || Math.abs(e - r) < Math.abs(i - r)) && (i = e);
1144
1144
  return i === -1 ? [n] : [n.slice(0, i), n.slice(i + 1)];
1145
1145
  }
1146
- function gt(e) {
1147
- return e.length === 0 ? 0 : Math.max(...e.map((e) => e.length)) * Ye;
1146
+ function J(e) {
1147
+ return e.length === 0 ? 0 : Math.max(...e.map((e) => e.length)) * Xe;
1148
1148
  }
1149
- function _t(e, t, n, r) {
1149
+ function vt(e, t, n, r) {
1150
1150
  let { radius: i } = Z(e), a = {
1151
1151
  anchor: "middle",
1152
1152
  x: 0,
1153
- y: i + Ue
1153
+ y: i + We
1154
1154
  };
1155
1155
  if (n === "below" || t.length === 0) return a;
1156
1156
  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;
@@ -1158,35 +1158,35 @@ function _t(e, t, n, r) {
1158
1158
  let n = e === o.length - 1 ? $(o[0]) + Math.PI * 2 : $(o[e + 1]);
1159
1159
  n - t <= s || (s = n - t, c = t + s / 2);
1160
1160
  }
1161
- let l = Math.cos(c), u = Math.sin(c), d = (r.length - 1) * G;
1162
- if (s < $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);
1161
+ let l = Math.cos(c), u = Math.sin(c), d = (r.length - 1) * W;
1162
+ if (s < et) {
1163
+ let e = J(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 + Qe + n, c = a / Math.tan(s / 2) + n, f = Math.min(Math.max(o, c), o + e);
1164
1164
  return {
1165
1165
  anchor: "middle",
1166
1166
  x: l * f,
1167
- y: u * f + Je / 3 - d / 2
1167
+ y: u * f + Ye / 3 - d / 2
1168
1168
  };
1169
1169
  }
1170
- if (Math.abs(l) < Qe) return u > 0 ? a : {
1170
+ if (Math.abs(l) < $e) return u > 0 ? a : {
1171
1171
  anchor: "middle",
1172
1172
  x: 0,
1173
- y: -(i + Ze) - d
1173
+ y: -(i + Qe) - d
1174
1174
  };
1175
- let f = i + Ze + Math.abs(u) * r.length * G / 2;
1175
+ let f = i + Qe + Math.abs(u) * r.length * W / 2;
1176
1176
  return {
1177
1177
  anchor: l > 0 ? "start" : "end",
1178
1178
  x: l * f,
1179
- y: u * f + Je / 3 - d / 2
1179
+ y: u * f + Ye / 3 - d / 2
1180
1180
  };
1181
1181
  }
1182
- function vt(e) {
1183
- let t = ft;
1184
- return e.symbol === "+" ? `M-5.83,0H${String(t)}M0,-5.83V${String(t)}` : void 0;
1185
- }
1186
1182
  function yt(e) {
1187
- return e.isAction === !0 ? ot.symbol : K.nodeText;
1183
+ let t = mt;
1184
+ return e.symbol === "+" ? `M-5.83,0H${String(t)}M0,-5.83V${String(t)}` : void 0;
1188
1185
  }
1189
1186
  function bt(e) {
1187
+ return e.isAction === !0 ? st.symbol : G.nodeText;
1188
+ }
1189
+ function xt(e) {
1190
1190
  return JSON.stringify([e.nodes.map((e) => [
1191
1191
  e.id,
1192
1192
  e.label,
@@ -1195,12 +1195,12 @@ function bt(e) {
1195
1195
  e.icon != null
1196
1196
  ]), e.links.map((e) => [e.source, e.target])]);
1197
1197
  }
1198
- function xt(e) {
1198
+ function St(e) {
1199
1199
  let t = /* @__PURE__ */ new Map();
1200
1200
  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]);
1201
1201
  return t;
1202
1202
  }
1203
- function St(e) {
1203
+ function Ct(e) {
1204
1204
  return `${Y(e.source)}>${Y(e.target)}`;
1205
1205
  }
1206
1206
  function Y(e) {
@@ -1210,11 +1210,11 @@ function X(e, t) {
1210
1210
  return typeof e == "object" ? e[t] ?? 0 : 0;
1211
1211
  }
1212
1212
  function Z(e) {
1213
- if (e.isAction === !0) return ot;
1214
- let t = $(mt[Math.max(0, Math.min(e.level ?? Ve, mt.length - 1))]);
1213
+ if (e.isAction === !0) return st;
1214
+ let t = $(gt[Math.max(0, Math.min(e.level ?? He, gt.length - 1))]);
1215
1215
  return e.icon == null ? t : {
1216
1216
  ...t,
1217
- radius: lt,
1217
+ radius: ut,
1218
1218
  stroke: t.fill,
1219
1219
  strokeHovered: t.stroke
1220
1220
  };
@@ -1222,17 +1222,17 @@ function Z(e) {
1222
1222
  function Q(e, t, n) {
1223
1223
  return e + (t - e) * n;
1224
1224
  }
1225
- function Ct(e, t, n) {
1225
+ function wt(e, t, n) {
1226
1226
  return {
1227
1227
  x: Q(e.x, t.x, n),
1228
1228
  y: Q(e.y, t.y, n)
1229
1229
  };
1230
1230
  }
1231
- function wt(e) {
1231
+ function Tt(e) {
1232
1232
  return e < .5 ? 4 * e ** 3 : 1 - (-2 * e + 2) ** 3 / 2;
1233
1233
  }
1234
1234
  function $(e) {
1235
1235
  if (e === void 0) throw Error("Expected a value in the network diagram.");
1236
1236
  return e;
1237
1237
  }
1238
- export { ht as renderNetworkDiagram };
1238
+ export { _t as renderNetworkDiagram };
@@ -1,5 +1,6 @@
1
1
  export interface NetworkDiagramNode {
2
2
  id: string;
3
+ discColor?: string;
3
4
  color?: string;
4
5
  icon?: string;
5
6
  isAction?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dpuse/dpuse-tool-d3-visualiser",
3
- "version": "1.0.132",
3
+ "version": "1.0.133",
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",