@dpuse/dpuse-tool-d3-visualiser 1.0.125 → 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** |
|
|
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-
|
|
260
|
-
| d3-zoom → dist/d3-zoom.mjs | `█████░░░░░░░░░░░░░░░` 25.
|
|
261
|
-
| src → networkDiagram.ts |
|
|
262
|
-
| d3-force → dist/d3-force.mjs | `████░░░░░░░░░░░░░░░░`
|
|
263
|
-
| d3-quadtree → src/add.js + 13 more | `███░░░░░░░░░░░░░░░░░` 14.
|
|
264
|
-
| d3-drag → dist/d3-drag.mjs | `██░░░░░░░░░░░░░░░░░░` 10.
|
|
265
|
-
| d3-interpolate → src/zoom.js | `░░░░░░░░░░░░░░░░░░░░` 2.
|
|
266
|
-
| (bundler output, whitespace & JSON) | `█░░░░░░░░░░░░░░░░░░░` 7.
|
|
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
|
+
| d3-interpolate → src/zoom.js | `░░░░░░░░░░░░░░░░░░░░` 2.3% · 1007 B |
|
|
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 |
|
|
@@ -370,7 +370,7 @@ Please do not open public GitHub issues for security vulnerabilities. Use [GitHu
|
|
|
370
370
|
|
|
371
371
|
## Contributing
|
|
372
372
|
|
|
373
|
-
This repository is maintained solely by its owner and does not, at present, accept external contributions.
|
|
373
|
+
This repository is maintained solely by its owner and does not, at present, accept external contributions.
|
|
374
374
|
|
|
375
375
|
For security vulnerabilities, see [Reporting Vulnerabilities](#reporting-vulnerabilities). For bugs, inconsistencies, or other feedback, [open a GitHub issue](https://github.com/dpuse/dpuse-tool-d3-visualiser/issues) — feedback is read, but responses and fixes are at the maintainer's discretion.
|
|
376
376
|
|
|
@@ -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-
|
|
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,
|
|
@@ -935,12 +935,19 @@ function Ne() {
|
|
|
935
935
|
}, x;
|
|
936
936
|
}
|
|
937
937
|
// src/networkDiagram.ts
|
|
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 =
|
|
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
|
-
},
|
|
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,22 +984,25 @@ var Pe = -300, Fe = 100, Ie = 400, W = 640, G = 480, Le = 180, Re = 1, ze = 2, B
|
|
|
977
984
|
strokeHovered: "#be185d"
|
|
978
985
|
}
|
|
979
986
|
];
|
|
980
|
-
function
|
|
987
|
+
function st(e, t, n = {}) {
|
|
981
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
|
-
n.reservesLabelRoom === !0 && l.force("collide", ee((e) => Z(e).radius +
|
|
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.");
|
|
985
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) => {
|
|
986
993
|
let r = v.get(e) ?? [];
|
|
987
|
-
if (r.length <
|
|
988
|
-
let
|
|
994
|
+
if (r.length < tt) return 0;
|
|
995
|
+
let a = 0, o = 0;
|
|
989
996
|
for (let e of r) {
|
|
990
997
|
let r = t.get(e);
|
|
991
998
|
if (!r) continue;
|
|
992
|
-
let
|
|
993
|
-
|
|
999
|
+
let i = r.label == null ? 0 : ct(J(r, n.wrapsLabels === !0)) * Qe;
|
|
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);
|
|
1003
|
+
if (i === "below" || c?.label == null) return s;
|
|
1004
|
+
let l = ct(J(c, n.wrapsLabels === !0));
|
|
1005
|
+
return Math.max(s, Z(c).radius + 16 + l + o);
|
|
996
1006
|
};
|
|
997
1007
|
c.distance((e) => {
|
|
998
1008
|
let t = n.linkDistance ?? Fe;
|
|
@@ -1000,25 +1010,25 @@ function rt(e, t, n = {}) {
|
|
|
1000
1010
|
let r = new Map(g.map((e) => [e.id, e]));
|
|
1001
1011
|
return Math.max(t, w(Y(e.source), r), w(Y(e.target), r));
|
|
1002
1012
|
});
|
|
1003
|
-
let T = () => {
|
|
1004
|
-
C.select("circle").attr("fill", (e) => e
|
|
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));
|
|
1005
1015
|
};
|
|
1006
1016
|
u.on("click", () => {
|
|
1007
|
-
b = null,
|
|
1017
|
+
b = null, E();
|
|
1008
1018
|
});
|
|
1009
|
-
let
|
|
1019
|
+
let O = Ne().scaleExtent([Ue, We]).on("zoom", (e) => {
|
|
1010
1020
|
d.attr("transform", e.transform.toString());
|
|
1011
1021
|
});
|
|
1012
|
-
u.call(
|
|
1013
|
-
let
|
|
1022
|
+
u.call(O).on("dblclick.zoom", null);
|
|
1023
|
+
let k = () => {
|
|
1014
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)})`);
|
|
1015
1025
|
let e = new Map(g.map((e) => [e.id, e]));
|
|
1016
1026
|
C.each((t, a, o) => {
|
|
1017
1027
|
if (t.label == null) return;
|
|
1018
|
-
let s = (v.get(t.id) ?? []).map((t) => e.get(t)).filter((e) => e !== void 0),
|
|
1019
|
-
r($(o[a])).select("text").attr("text-anchor",
|
|
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));
|
|
1029
|
+
r($(o[a])).select("text").attr("text-anchor", s.anchor).attr("y", s.y).selectAll("tspan").attr("x", s.x);
|
|
1020
1030
|
});
|
|
1021
|
-
},
|
|
1031
|
+
}, A = () => {
|
|
1022
1032
|
if (g.length === 0) return;
|
|
1023
1033
|
let e = g.map((e) => e.x ?? 0), n = g.map((e) => e.y ?? 0), [r, a, o, s] = [
|
|
1024
1034
|
Math.min(...e),
|
|
@@ -1027,49 +1037,49 @@ function rt(e, t, n = {}) {
|
|
|
1027
1037
|
Math.max(...n)
|
|
1028
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)));
|
|
1029
1039
|
return V.translate(c / 2, l / 2).scale(d).translate(-(r + a) / 2, -(o + s) / 2);
|
|
1030
|
-
},
|
|
1040
|
+
}, j = (e) => {
|
|
1031
1041
|
u.call((t) => {
|
|
1032
|
-
|
|
1042
|
+
O.transform(t, e);
|
|
1033
1043
|
});
|
|
1034
|
-
},
|
|
1044
|
+
}, M = () => {
|
|
1035
1045
|
l.alpha(1);
|
|
1036
1046
|
for (let e = 0; e < Le; e += 1) l.tick();
|
|
1037
1047
|
l.stop();
|
|
1038
|
-
},
|
|
1048
|
+
}, N = () => {
|
|
1039
1049
|
y !== void 0 && cancelAnimationFrame(y), y = void 0;
|
|
1040
|
-
},
|
|
1050
|
+
}, ne = (e) => {
|
|
1041
1051
|
let t = new Map(g.map((e) => [e.id, e]));
|
|
1042
|
-
h = e, v =
|
|
1052
|
+
h = e, v = ut(e), g = e.nodes.map((e) => ({ ...e })), _ = e.links.map((e) => ({ ...e }));
|
|
1043
1053
|
let r = Math.min(o, s) * .22;
|
|
1044
1054
|
for (let [e, n] of g.entries()) {
|
|
1045
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;
|
|
1046
|
-
i ? (n.x = i.x, n.y = i.y) : c ? (n.x = (c.x ?? 0) + Math.cos(l) *
|
|
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);
|
|
1047
1057
|
}
|
|
1048
1058
|
l.nodes(g), c.links(_);
|
|
1049
|
-
let i = S.data(_,
|
|
1059
|
+
let i = S.data(_, dt), a = i.exit();
|
|
1050
1060
|
S = i.enter().append("line").attr("stroke", q.linkStroke).attr("stroke-width", 2).merge(i);
|
|
1051
1061
|
let u = C.data(g, (e) => e.id), d = u.exit().style("pointer-events", "none"), f = u.enter().append("g").style("cursor", "pointer");
|
|
1052
|
-
return f.append("circle").attr("stroke-width", 2), f.append("text"), f.on("mouseenter", (e, t) => {
|
|
1053
|
-
x = t.id,
|
|
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();
|
|
1054
1064
|
}).on("mouseleave", (e, t) => {
|
|
1055
|
-
x === t.id && (x = null),
|
|
1065
|
+
x === t.id && (x = null), E();
|
|
1056
1066
|
}).on("click", (e, t) => {
|
|
1057
|
-
e.stopPropagation(), b = b === t.id ? null : t.id,
|
|
1067
|
+
e.stopPropagation(), b = b === t.id ? null : t.id, E(), n.onNodeClick?.($(h.nodes.find((e) => e.id === t.id)));
|
|
1058
1068
|
}).call(we().on("start", (e, t) => {
|
|
1059
1069
|
e.sourceEvent?.stopPropagation(), t.fx = t.x, t.fy = t.y;
|
|
1060
1070
|
}).on("drag", (e, t) => {
|
|
1061
|
-
t.x = e.x, t.y = e.y, t.fx = e.x, t.fy = e.y,
|
|
1071
|
+
t.x = e.x, t.y = e.y, t.fx = e.x, t.fy = e.y, k();
|
|
1062
1072
|
}).on("end", (e, t) => {
|
|
1063
1073
|
t.fx = null, t.fy = null;
|
|
1064
|
-
})), 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),
|
|
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(), {
|
|
1065
1075
|
enteringNodes: f,
|
|
1066
1076
|
exitingLinks: a,
|
|
1067
1077
|
exitingNodes: d
|
|
1068
1078
|
};
|
|
1069
1079
|
};
|
|
1070
|
-
return
|
|
1080
|
+
return ne(e), k(), {
|
|
1071
1081
|
destroy: () => {
|
|
1072
|
-
|
|
1082
|
+
N(), l.stop(), u.remove();
|
|
1073
1083
|
},
|
|
1074
1084
|
resize: () => {
|
|
1075
1085
|
let e = t.clientWidth || W, n = t.clientHeight || G;
|
|
@@ -1077,26 +1087,26 @@ function rt(e, t, n = {}) {
|
|
|
1077
1087
|
},
|
|
1078
1088
|
svg: m,
|
|
1079
1089
|
triggerAutoLayout: () => {
|
|
1080
|
-
|
|
1081
|
-
let e = n.fitsView === !0 ?
|
|
1082
|
-
e &&
|
|
1090
|
+
N(), M(), k();
|
|
1091
|
+
let e = n.fitsView === !0 ? A() : void 0;
|
|
1092
|
+
e && j(e);
|
|
1083
1093
|
},
|
|
1084
1094
|
update: (e) => {
|
|
1085
|
-
|
|
1086
|
-
let { enteringNodes: t, exitingLinks: r, exitingNodes: i } =
|
|
1095
|
+
N();
|
|
1096
|
+
let { enteringNodes: t, exitingLinks: r, exitingNodes: i } = ne(e), o = new Map(g.map((e) => [e.id, {
|
|
1087
1097
|
x: e.x ?? 0,
|
|
1088
1098
|
y: e.y ?? 0
|
|
1089
1099
|
}]));
|
|
1090
|
-
|
|
1100
|
+
M();
|
|
1091
1101
|
let s = new Map(g.map((e) => [e.id, {
|
|
1092
1102
|
x: e.x ?? 0,
|
|
1093
1103
|
y: e.y ?? 0
|
|
1094
|
-
}])), c = Ee(m), l = (n.fitsView === !0 ?
|
|
1104
|
+
}])), c = Ee(m), l = (n.fitsView === !0 ? A() : void 0) ?? c, u = (e) => {
|
|
1095
1105
|
for (let t of g) {
|
|
1096
|
-
let n =
|
|
1106
|
+
let n = ft($(o.get(t.id)), $(s.get(t.id)), e);
|
|
1097
1107
|
t.x = n.x, t.y = n.y;
|
|
1098
1108
|
}
|
|
1099
|
-
|
|
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());
|
|
1100
1110
|
};
|
|
1101
1111
|
if (a <= 0) {
|
|
1102
1112
|
u(1);
|
|
@@ -1105,23 +1115,24 @@ function rt(e, t, n = {}) {
|
|
|
1105
1115
|
u(0);
|
|
1106
1116
|
let d = performance.now(), f = (e) => {
|
|
1107
1117
|
let t = Math.min(1, (e - d) / a);
|
|
1108
|
-
u(
|
|
1118
|
+
u(pt(t)), y = t < 1 ? requestAnimationFrame(f) : void 0;
|
|
1109
1119
|
};
|
|
1110
1120
|
y = requestAnimationFrame(f);
|
|
1111
1121
|
}
|
|
1112
1122
|
};
|
|
1113
1123
|
}
|
|
1114
1124
|
function J(e, t) {
|
|
1125
|
+
if (e.label == null && e.symbol != null) return [];
|
|
1115
1126
|
let n = e.label ?? e.id;
|
|
1116
|
-
if (!t || e.label == null || n.length <=
|
|
1127
|
+
if (!t || e.label == null || n.length <= Ze) return [n];
|
|
1117
1128
|
let r = n.length / 2, i = -1;
|
|
1118
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);
|
|
1119
1130
|
return i === -1 ? [n] : [n.slice(0, i), n.slice(i + 1)];
|
|
1120
1131
|
}
|
|
1121
|
-
function
|
|
1122
|
-
return Math.max(...e.map((e) => e.length)) * Ke;
|
|
1132
|
+
function ct(e) {
|
|
1133
|
+
return e.length === 0 ? 0 : Math.max(...e.map((e) => e.length)) * Ke;
|
|
1123
1134
|
}
|
|
1124
|
-
function
|
|
1135
|
+
function lt(e, t, n, r) {
|
|
1125
1136
|
let { radius: i } = Z(e), a = {
|
|
1126
1137
|
anchor: "middle",
|
|
1127
1138
|
x: 0,
|
|
@@ -1133,25 +1144,33 @@ function at(e, t, n, r) {
|
|
|
1133
1144
|
let n = e === o.length - 1 ? $(o[0]) + Math.PI * 2 : $(o[e + 1]);
|
|
1134
1145
|
n - t <= s || (s = n - t, c = t + s / 2);
|
|
1135
1146
|
}
|
|
1136
|
-
let l = Math.cos(c), u = Math.sin(c), d = (r - 1) * K;
|
|
1147
|
+
let l = Math.cos(c), u = Math.sin(c), d = (r.length - 1) * K;
|
|
1148
|
+
if (s < Xe) {
|
|
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);
|
|
1150
|
+
return {
|
|
1151
|
+
anchor: "middle",
|
|
1152
|
+
x: l * f,
|
|
1153
|
+
y: u * f + Ge / 3 - d / 2
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1137
1156
|
if (Math.abs(l) < Ye) return u > 0 ? a : {
|
|
1138
1157
|
anchor: "middle",
|
|
1139
1158
|
x: 0,
|
|
1140
1159
|
y: -(i + Je) - d
|
|
1141
1160
|
};
|
|
1142
|
-
let f = i + Je + Math.abs(u) * r * K / 2;
|
|
1161
|
+
let f = i + Je + Math.abs(u) * r.length * K / 2;
|
|
1143
1162
|
return {
|
|
1144
1163
|
anchor: l > 0 ? "start" : "end",
|
|
1145
1164
|
x: l * f,
|
|
1146
1165
|
y: u * f + Ge / 3 - d / 2
|
|
1147
1166
|
};
|
|
1148
1167
|
}
|
|
1149
|
-
function
|
|
1168
|
+
function ut(e) {
|
|
1150
1169
|
let t = /* @__PURE__ */ new Map();
|
|
1151
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]);
|
|
1152
1171
|
return t;
|
|
1153
1172
|
}
|
|
1154
|
-
function
|
|
1173
|
+
function dt(e) {
|
|
1155
1174
|
return `${Y(e.source)}>${Y(e.target)}`;
|
|
1156
1175
|
}
|
|
1157
1176
|
function Y(e) {
|
|
@@ -1161,22 +1180,22 @@ function X(e, t) {
|
|
|
1161
1180
|
return typeof e == "object" ? e[t] ?? 0 : 0;
|
|
1162
1181
|
}
|
|
1163
1182
|
function Z(e) {
|
|
1164
|
-
return $(
|
|
1183
|
+
return e.isAction === !0 ? rt : $(ot[Math.max(0, Math.min(e.level ?? Re, ot.length - 1))]);
|
|
1165
1184
|
}
|
|
1166
1185
|
function Q(e, t, n) {
|
|
1167
1186
|
return e + (t - e) * n;
|
|
1168
1187
|
}
|
|
1169
|
-
function
|
|
1188
|
+
function ft(e, t, n) {
|
|
1170
1189
|
return {
|
|
1171
1190
|
x: Q(e.x, t.x, n),
|
|
1172
1191
|
y: Q(e.y, t.y, n)
|
|
1173
1192
|
};
|
|
1174
1193
|
}
|
|
1175
|
-
function
|
|
1194
|
+
function pt(e) {
|
|
1176
1195
|
return e < .5 ? 4 * e ** 3 : 1 - (-2 * e + 2) ** 3 / 2;
|
|
1177
1196
|
}
|
|
1178
1197
|
function $(e) {
|
|
1179
1198
|
if (e === void 0) throw Error("Expected a value in the network diagram.");
|
|
1180
1199
|
return e;
|
|
1181
1200
|
}
|
|
1182
|
-
export {
|
|
1201
|
+
export { st as renderNetworkDiagram };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dpuse/dpuse-tool-d3-visualiser",
|
|
3
|
-
"version": "1.0.
|
|
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",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"d3-zoom": "^3.0.1"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@dpuse/dpuse-development": "^1.1.
|
|
79
|
+
"@dpuse/dpuse-development": "^1.1.105",
|
|
80
80
|
"@dpuse/eslint-config-dpuse": "^1.1.108",
|
|
81
81
|
"@types/d3-drag": "^3.0.7",
|
|
82
82
|
"@types/d3-force": "^3.0.10",
|