@dpuse/dpuse-tool-d3-visualiser 1.0.129 → 1.0.130
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
|
@@ -8,6 +8,7 @@ Consider an **eCharts** visualiser along with existing **Highcharts** (comercial
|
|
|
8
8
|
[](https://github.com/dpuse/dpuse-tool-d3-visualiser/actions/workflows/ci.yml)
|
|
9
9
|
[](https://github.com/dpuse/dpuse-tool-d3-visualiser/security/code-scanning)
|
|
10
10
|

|
|
11
|
+
[](https://sonarcloud.io/summary/new_code?id=dpuse_dpuse-tool-d3-visualiser)
|
|
11
12
|
[](https://github.com/dpuse/dpuse-tool-d3-visualiser/releases/latest)
|
|
12
13
|
[](https://www.npmjs.com/package/@dpuse/dpuse-tool-d3-visualiser)
|
|
13
14
|
|
|
@@ -237,8 +238,8 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
|
|
|
237
238
|
|
|
238
239
|
| Chunk/Module/File | Composition |
|
|
239
240
|
| :------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------- |
|
|
240
|
-
| **All 14 files** |
|
|
241
|
-
| **dist/tanStackCharts-DEINbmRi.js** | 125.4 kB · gzip 36.7 kB · 30.
|
|
241
|
+
| **All 14 files** | 416.1 kB · gzip 122.7 kB |
|
|
242
|
+
| **dist/tanStackCharts-DEINbmRi.js** | 125.4 kB · gzip 36.7 kB · 30.1% of the build |
|
|
242
243
|
| @tanstack/charts → dist/scene.js + 41 more | `██████████████████░░` 90.1% · 113.0 kB |
|
|
243
244
|
| d3-scale → src/band.js + 2 more | `░░░░░░░░░░░░░░░░░░░░` 1.7% · 2.1 kB |
|
|
244
245
|
| src → tanStackCharts.ts | `░░░░░░░░░░░░░░░░░░░░` 0.6% · 717 B |
|
|
@@ -247,7 +248,7 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
|
|
|
247
248
|
| @dagrejs/dagre → dist/dagre.esm.js | `██████████████████░░` 88.3% · 56.0 kB |
|
|
248
249
|
| src → erdDiagram.ts | `█░░░░░░░░░░░░░░░░░░░` 5.4% · 3.4 kB |
|
|
249
250
|
| (bundler output, whitespace & JSON) | `█░░░░░░░░░░░░░░░░░░░` 6.3% · 4.0 kB |
|
|
250
|
-
| **dist/chordDiagram-Cm91Tmgo.js** | 56.8 kB · gzip 17.7 kB · 13.
|
|
251
|
+
| **dist/chordDiagram-Cm91Tmgo.js** | 56.8 kB · gzip 17.7 kB · 13.6% of the build |
|
|
251
252
|
| @unovis/ts → components/chord-diagram/index.js + 36 more | `██████████████░░░░░░` 71.0% · 40.3 kB |
|
|
252
253
|
| stylis → src/Parser.js + 5 more | `██░░░░░░░░░░░░░░░░░░` 8.4% · 4.8 kB |
|
|
253
254
|
| d3-chord → dist/d3-chord.mjs | `█░░░░░░░░░░░░░░░░░░░` 4.2% · 2.4 kB |
|
|
@@ -255,12 +256,12 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
|
|
|
255
256
|
| src → chordDiagram.ts | `░░░░░░░░░░░░░░░░░░░░` 0.8% · 494 B |
|
|
256
257
|
| d3-array → src/group.js + 1 more | `░░░░░░░░░░░░░░░░░░░░` 0.8% · 487 B |
|
|
257
258
|
| (bundler output, whitespace & JSON) | `███░░░░░░░░░░░░░░░░░` 13.5% · 7.6 kB |
|
|
258
|
-
| **dist/networkDiagram-
|
|
259
|
-
| src → networkDiagram.ts | `█████░░░░░░░░░░░░░░░`
|
|
260
|
-
| d3-zoom → dist/d3-zoom.mjs | `█████░░░░░░░░░░░░░░░` 24.
|
|
261
|
-
| d3-force → dist/d3-force.mjs | `███░░░░░░░░░░░░░░░░░` 17.
|
|
262
|
-
| d3-quadtree → src/add.js + 13 more | `███░░░░░░░░░░░░░░░░░`
|
|
263
|
-
| d3-drag → dist/d3-drag.mjs | `██░░░░░░░░░░░░░░░░░░` 9.
|
|
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 |
|
|
264
|
+
| d3-drag → dist/d3-drag.mjs | `██░░░░░░░░░░░░░░░░░░` 9.6% · 4.3 kB |
|
|
264
265
|
| d3-interpolate → src/zoom.js | `░░░░░░░░░░░░░░░░░░░░` 2.2% · 1007 B |
|
|
265
266
|
| (bundler output, whitespace & JSON) | `█░░░░░░░░░░░░░░░░░░░` 6.9% · 3.1 kB |
|
|
266
267
|
| **dist/d3-shape-gf8U18pS.js** | 36.9 kB · gzip 7.9 kB · 8.9% of the build |
|
|
@@ -299,7 +300,7 @@ _Note: Sonda's Vite reports currently exclude CSS files, since Vite does not gen
|
|
|
299
300
|
| **dist/treeDiagram-t0oFwi1c.js** | 2.2 kB · gzip 1.0 kB · 0.5% of the build |
|
|
300
301
|
| src → treeDiagram.ts | `█████████████████░░░` 87.2% · 1.9 kB |
|
|
301
302
|
| (bundler output, whitespace & JSON) | `███░░░░░░░░░░░░░░░░░` 12.8% · 290 B |
|
|
302
|
-
| **dist/dpuse-tool-d3-visualiser.es.js** | 1.6 kB · gzip
|
|
303
|
+
| **dist/dpuse-tool-d3-visualiser.es.js** | 1.6 kB · gzip 438 B · 0.4% of the build |
|
|
303
304
|
| src → index.ts | `██████████████████░░` 88.0% · 1.4 kB |
|
|
304
305
|
| (bundler output, whitespace & JSON) | `██░░░░░░░░░░░░░░░░░░` 12.0% · 194 B |
|
|
305
306
|
| **dist/palette-D5DTPmuA.js** | 1.2 kB · gzip 567 B · 0.3% of the build |
|
|
@@ -334,7 +335,7 @@ This section is updated each time `npm run document` is run. Settings come from
|
|
|
334
335
|
| Check | Status | What it does |
|
|
335
336
|
| :------------ | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
336
337
|
| Linting | ✅ On | [ESLint](https://eslint.org) checks the code for errors and style problems, and the [TypeScript](https://www.typescriptlang.org/) compiler type-checks the whole project. Part of the [CI workflow](https://github.com/dpuse/dpuse-tool-d3-visualiser/actions/workflows/ci.yml) on every push and pull request to `main`. |
|
|
337
|
-
| Code analysis |
|
|
338
|
+
| Code analysis | ✅ On | [SonarCloud](https://sonarcloud.io) checks every push for bugs, code smells and vulnerabilities. |
|
|
338
339
|
|
|
339
340
|
### Security Analysis
|
|
340
341
|
|
|
@@ -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-ICOsKqeF.js"), a = i(e, t, n);
|
|
36
36
|
return r?.(), {
|
|
37
37
|
destroy: a.destroy,
|
|
38
38
|
resize: a.resize,
|
|
@@ -315,14 +315,14 @@ function re() {
|
|
|
315
315
|
let e = 1;
|
|
316
316
|
return () => (e = (P * e + F) % ne) / ne;
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function I(e) {
|
|
319
319
|
return e.x;
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function ie(e) {
|
|
322
322
|
return e.y;
|
|
323
323
|
}
|
|
324
|
-
var
|
|
325
|
-
function
|
|
324
|
+
var ae = 10, oe = Math.PI * (3 - Math.sqrt(5));
|
|
325
|
+
function se(n) {
|
|
326
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();
|
|
327
327
|
n ??= [];
|
|
328
328
|
function p() {
|
|
@@ -339,7 +339,7 @@ function ce(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 =
|
|
342
|
+
var i = ae * 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);
|
|
@@ -390,10 +390,10 @@ function ce(n) {
|
|
|
390
390
|
}
|
|
391
391
|
};
|
|
392
392
|
}
|
|
393
|
-
function
|
|
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,
|
|
396
|
+
var i, a = e.length, o = C(e, I, ie).visitAfter(d);
|
|
397
397
|
for (r = n, i = 0; i < a; ++i) t = e[i], o.visit(f);
|
|
398
398
|
}
|
|
399
399
|
function u() {
|
|
@@ -439,20 +439,20 @@ function le() {
|
|
|
439
439
|
}, l;
|
|
440
440
|
}
|
|
441
441
|
// node_modules/d3-interpolate/src/zoom.js
|
|
442
|
-
var
|
|
443
|
-
function
|
|
442
|
+
var le = 1e-12;
|
|
443
|
+
function ue(e) {
|
|
444
444
|
return ((e = Math.exp(e)) + 1 / e) / 2;
|
|
445
445
|
}
|
|
446
|
-
function
|
|
446
|
+
function de(e) {
|
|
447
447
|
return ((e = Math.exp(e)) - 1 / e) / 2;
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function fe(e) {
|
|
450
450
|
return ((e = Math.exp(2 * e)) - 1) / (e + 1);
|
|
451
451
|
}
|
|
452
|
-
var
|
|
452
|
+
var pe = (function e(t, n, r) {
|
|
453
453
|
function i(e, i) {
|
|
454
454
|
var a = e[0], o = e[1], s = e[2], c = i[0], l = i[1], u = i[2], d = c - a, f = l - o, p = d * d + f * f, m, h;
|
|
455
|
-
if (p <
|
|
455
|
+
if (p < le) h = Math.log(u / s) / t, m = function(e) {
|
|
456
456
|
return [
|
|
457
457
|
a + e * d,
|
|
458
458
|
o + e * f,
|
|
@@ -462,11 +462,11 @@ var me = (function e(t, n, r) {
|
|
|
462
462
|
else {
|
|
463
463
|
var g = Math.sqrt(p), _ = (u * u - s * s + r * p) / (2 * s * n * g), v = (u * u - s * s - r * p) / (2 * u * n * g), y = Math.log(Math.sqrt(_ * _ + 1) - _);
|
|
464
464
|
h = (Math.log(Math.sqrt(v * v + 1) - v) - y) / t, m = function(e) {
|
|
465
|
-
var r = e * h, i =
|
|
465
|
+
var r = e * h, i = ue(y), c = s / (n * g) * (i * fe(t * r + y) - de(y));
|
|
466
466
|
return [
|
|
467
467
|
a + c * d,
|
|
468
468
|
o + c * f,
|
|
469
|
-
s * i /
|
|
469
|
+
s * i / ue(t * r + y)
|
|
470
470
|
];
|
|
471
471
|
};
|
|
472
472
|
}
|
|
@@ -476,23 +476,23 @@ var me = (function e(t, n, r) {
|
|
|
476
476
|
var n = Math.max(.001, +t), r = n * n;
|
|
477
477
|
return e(n, r, r * r);
|
|
478
478
|
}, i;
|
|
479
|
-
})(Math.SQRT2, 2, 4),
|
|
479
|
+
})(Math.SQRT2, 2, 4), me = { passive: !1 }, L = {
|
|
480
480
|
capture: !0,
|
|
481
481
|
passive: !1
|
|
482
482
|
};
|
|
483
|
-
function
|
|
483
|
+
function he(e) {
|
|
484
484
|
e.stopImmediatePropagation();
|
|
485
485
|
}
|
|
486
486
|
function R(e) {
|
|
487
487
|
e.preventDefault(), e.stopImmediatePropagation();
|
|
488
488
|
}
|
|
489
489
|
function ge(e) {
|
|
490
|
-
var t = e.document.documentElement, n = r(e).on("dragstart.drag", R,
|
|
491
|
-
"onselectstart" in t ? n.on("selectstart.drag", R,
|
|
490
|
+
var t = e.document.documentElement, n = r(e).on("dragstart.drag", R, L);
|
|
491
|
+
"onselectstart" in t ? n.on("selectstart.drag", R, L) : (t.__noselect = t.style.MozUserSelect, t.style.MozUserSelect = "none");
|
|
492
492
|
}
|
|
493
493
|
function _e(e, t) {
|
|
494
494
|
var n = e.document.documentElement, i = r(e).on("dragstart.drag", null);
|
|
495
|
-
t && (i.on("click.drag", R,
|
|
495
|
+
t && (i.on("click.drag", R, L), setTimeout(function() {
|
|
496
496
|
i.on("click.drag", null);
|
|
497
497
|
}, 0)), "onselectstart" in n ? i.on("selectstart.drag", null) : (n.style.MozUserSelect = n.__noselect, delete n.__noselect);
|
|
498
498
|
}
|
|
@@ -574,12 +574,12 @@ function Se() {
|
|
|
574
574
|
function Ce() {
|
|
575
575
|
var e = ye, n = be, a = xe, o = Se, s = {}, c = t("start", "drag", "end"), l = 0, u, d, f, p, m = 0;
|
|
576
576
|
function h(e) {
|
|
577
|
-
e.on("mousedown.drag", g).filter(o).on("touchstart.drag", y).on("touchmove.drag", b,
|
|
577
|
+
e.on("mousedown.drag", g).filter(o).on("touchstart.drag", y).on("touchmove.drag", b, me).on("touchend.drag touchcancel.drag", x).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
|
|
578
578
|
}
|
|
579
579
|
function g(t, i) {
|
|
580
580
|
if (!p && e.call(this, t, i)) {
|
|
581
581
|
var a = S(this, n.call(this, t, i), t, i, "mouse");
|
|
582
|
-
a && (r(t.view).on("mousemove.drag", _,
|
|
582
|
+
a && (r(t.view).on("mousemove.drag", _, L).on("mouseup.drag", v, L), ge(t.view), he(t), f = !1, u = t.clientX, d = t.clientY, a("start", t));
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
585
|
function _(e) {
|
|
@@ -593,7 +593,7 @@ function Ce() {
|
|
|
593
593
|
r(e.view).on("mousemove.drag mouseup.drag", null), _e(e.view, f), R(e), s.mouse("end", e);
|
|
594
594
|
}
|
|
595
595
|
function y(t, r) {
|
|
596
|
-
if (e.call(this, t, r)) for (var i = t.changedTouches, a = n.call(this, t, r), o = i.length, s = 0, c; s < o; ++s) (c = S(this, a, t, r, i[s].identifier, i[s])) && (
|
|
596
|
+
if (e.call(this, t, r)) for (var i = t.changedTouches, a = n.call(this, t, r), o = i.length, s = 0, c; s < o; ++s) (c = S(this, a, t, r, i[s].identifier, i[s])) && (he(t), c("start", t, i[s]));
|
|
597
597
|
}
|
|
598
598
|
function b(e) {
|
|
599
599
|
for (var t = e.changedTouches, n = t.length, r = 0, i; r < n; ++r) (i = s[t[r].identifier]) && (R(e), i("drag", e, t[r]));
|
|
@@ -602,7 +602,7 @@ function Ce() {
|
|
|
602
602
|
var t = e.changedTouches, n = t.length, r, i;
|
|
603
603
|
for (p && clearTimeout(p), p = setTimeout(function() {
|
|
604
604
|
p = null;
|
|
605
|
-
}, 500), r = 0; r < n; ++r) (i = s[t[r].identifier]) && (
|
|
605
|
+
}, 500), r = 0; r < n; ++r) (i = s[t[r].identifier]) && (he(e), i("end", e, t[r]));
|
|
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;
|
|
@@ -753,7 +753,7 @@ function Me(e, t, n) {
|
|
|
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
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 =
|
|
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
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
|
}
|
|
@@ -935,19 +935,19 @@ function Ne() {
|
|
|
935
935
|
}, x;
|
|
936
936
|
}
|
|
937
937
|
// src/networkDiagram.ts
|
|
938
|
-
var Pe = -300, Fe = 100, Ie =
|
|
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 = {
|
|
939
939
|
linkStroke: "#9ca3af",
|
|
940
940
|
nodeFillSelected: "#f59e0b",
|
|
941
941
|
nodeStrokeSelected: "#b45309",
|
|
942
942
|
nodeText: "#ffffff"
|
|
943
|
-
},
|
|
943
|
+
}, ot = {
|
|
944
944
|
fill: "#dbeafe",
|
|
945
945
|
fillHovered: "#bfdbfe",
|
|
946
946
|
radius: 16,
|
|
947
947
|
stroke: "#2563eb",
|
|
948
948
|
strokeHovered: "#1d4ed8",
|
|
949
949
|
symbol: "#1d4ed8"
|
|
950
|
-
},
|
|
950
|
+
}, st = "icon", ct = "#ffffff", lt = 16, ut = 1.2, K = "symbol", dt = 20, ft = 6, pt = 2.5, mt = [
|
|
951
951
|
{
|
|
952
952
|
fill: "#475569",
|
|
953
953
|
fillHovered: "#64748b",
|
|
@@ -984,24 +984,24 @@ var Pe = -300, Fe = 100, Ie = 400, Le = 640, Re = 480, ze = 180, Be = 1, Ve = 2,
|
|
|
984
984
|
strokeHovered: "#be185d"
|
|
985
985
|
}
|
|
986
986
|
];
|
|
987
|
-
function
|
|
988
|
-
let i = n.labelPlacementId ?? "below", a = n.transitionDuration ??
|
|
989
|
-
n.reservesLabelRoom === !0 && l.force("collide", ee((e) => Z(e).radius +
|
|
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();
|
|
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 <
|
|
994
|
+
if (r.length < it) 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 :
|
|
1000
|
-
a += Math.max(Z(r).radius * 2, i) +
|
|
999
|
+
let i = r.label == null ? 0 : gt(q(r, n.wrapsLabels === !0)) * tt;
|
|
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 =
|
|
1004
|
+
let l = gt(q(c, n.wrapsLabels === !0));
|
|
1005
1005
|
return Math.max(s, Z(c).radius + 16 + l + o);
|
|
1006
1006
|
};
|
|
1007
1007
|
c.distance((e) => {
|
|
@@ -1010,111 +1010,111 @@ function mt(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 = () => {
|
|
1014
|
-
C.select("circle").attr("fill", (e) => e.icon == null ?
|
|
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));
|
|
1015
1015
|
};
|
|
1016
1016
|
u.on("click", () => {
|
|
1017
|
-
b = null,
|
|
1017
|
+
b = null, j();
|
|
1018
1018
|
});
|
|
1019
|
-
let
|
|
1019
|
+
let M = Ne().scaleExtent([Ke, qe]).on("zoom", (e) => {
|
|
1020
1020
|
d.attr("transform", e.transform.toString());
|
|
1021
1021
|
});
|
|
1022
|
-
u.call(
|
|
1023
|
-
let
|
|
1022
|
+
u.call(M).on("dblclick.zoom", null);
|
|
1023
|
+
let N = () => {
|
|
1024
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)})`);
|
|
1025
1025
|
let e = new Map(g.map((e) => [e.id, e]));
|
|
1026
1026
|
C.each((t, a, o) => {
|
|
1027
1027
|
if (t.label == null) return;
|
|
1028
|
-
let s =
|
|
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));
|
|
1029
1029
|
r($(o[a])).select("text").attr("text-anchor", s.anchor).attr("y", s.y).selectAll("tspan").attr("x", s.x);
|
|
1030
1030
|
});
|
|
1031
|
-
},
|
|
1031
|
+
}, P = () => {
|
|
1032
1032
|
if (g.length === 0) return;
|
|
1033
1033
|
let e = g.map((e) => e.x ?? 0), n = g.map((e) => e.y ?? 0), [r, a, o, s] = [
|
|
1034
1034
|
Math.min(...e),
|
|
1035
1035
|
Math.max(...e),
|
|
1036
1036
|
Math.min(...n),
|
|
1037
1037
|
Math.max(...n)
|
|
1038
|
-
], c = t.clientWidth ||
|
|
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)));
|
|
1039
1039
|
return H.translate(c / 2, l / 2).scale(d).translate(-(r + a) / 2, -(o + s) / 2);
|
|
1040
|
-
},
|
|
1040
|
+
}, F = (e) => {
|
|
1041
1041
|
u.call((t) => {
|
|
1042
|
-
|
|
1042
|
+
M.transform(t, e);
|
|
1043
1043
|
});
|
|
1044
|
-
},
|
|
1044
|
+
}, ne = () => {
|
|
1045
1045
|
l.alpha(1);
|
|
1046
|
-
for (let e = 0; e <
|
|
1046
|
+
for (let e = 0; e < Be; e += 1) l.tick();
|
|
1047
1047
|
l.stop();
|
|
1048
|
-
},
|
|
1048
|
+
}, re = () => {
|
|
1049
1049
|
y !== void 0 && cancelAnimationFrame(y), y = void 0;
|
|
1050
|
-
},
|
|
1050
|
+
}, I = (e) => {
|
|
1051
1051
|
let t = new Map(g.map((e) => [e.id, e]));
|
|
1052
|
-
h = e, v =
|
|
1052
|
+
h = e, v = xt(e), g = e.nodes.map((e) => ({ ...e })), _ = e.links.map((e) => ({ ...e }));
|
|
1053
1053
|
let r = Math.min(o, s) * .22;
|
|
1054
1054
|
for (let [e, n] of g.entries()) {
|
|
1055
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;
|
|
1056
|
-
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) * 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);
|
|
1057
1057
|
}
|
|
1058
1058
|
l.nodes(g), c.links(_);
|
|
1059
|
-
let i = S.data(_,
|
|
1059
|
+
let i = S.data(_, St), a = i.exit();
|
|
1060
1060
|
S = i.enter().append("line").attr("stroke", G.linkStroke).attr("stroke-width", 2).merge(i);
|
|
1061
1061
|
let u = C.data(g, (e) => e.id), d = u.exit().style("pointer-events", "none"), f = u.enter().append("g").style("cursor", "pointer");
|
|
1062
|
-
return f.append("title"), f.append("circle")
|
|
1063
|
-
x = t.id,
|
|
1062
|
+
return f.append("title"), f.append("circle"), f.append("text"), f.on("mouseenter", (e, t) => {
|
|
1063
|
+
x = t.id, j();
|
|
1064
1064
|
}).on("mouseleave", (e, t) => {
|
|
1065
|
-
x === t.id && (x = null),
|
|
1065
|
+
x === t.id && (x = null), j();
|
|
1066
1066
|
}).on("click", (e, t) => {
|
|
1067
|
-
e.stopPropagation(), T && (b = b === t.id ? null : t.id),
|
|
1067
|
+
e.stopPropagation(), T && (b = b === t.id ? null : t.id), j(), n.onNodeClick?.($(h.nodes.find((e) => e.id === t.id)));
|
|
1068
1068
|
}).call(Ce().on("start", (e, t) => {
|
|
1069
1069
|
e.sourceEvent?.stopPropagation(), t.fx = t.x, t.fy = t.y;
|
|
1070
1070
|
}).on("drag", (e, t) => {
|
|
1071
|
-
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, N();
|
|
1072
1072
|
}).on("end", (e, t) => {
|
|
1073
1073
|
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 +
|
|
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(), {
|
|
1075
1075
|
enteringNodes: f,
|
|
1076
1076
|
exitingLinks: a,
|
|
1077
1077
|
exitingNodes: d
|
|
1078
1078
|
};
|
|
1079
1079
|
};
|
|
1080
|
-
return
|
|
1080
|
+
return I(e), N(), {
|
|
1081
1081
|
destroy: () => {
|
|
1082
|
-
|
|
1082
|
+
re(), l.stop(), u.remove();
|
|
1083
1083
|
},
|
|
1084
1084
|
resize: () => {
|
|
1085
|
-
let e = t.clientWidth ||
|
|
1085
|
+
let e = t.clientWidth || Re, r = t.clientHeight || ze;
|
|
1086
1086
|
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 =
|
|
1088
|
-
i &&
|
|
1087
|
+
let i = P();
|
|
1088
|
+
i && F(i);
|
|
1089
1089
|
},
|
|
1090
1090
|
svg: m,
|
|
1091
1091
|
triggerAutoLayout: () => {
|
|
1092
|
-
|
|
1093
|
-
let e = n.fitsView === !0 ?
|
|
1094
|
-
e &&
|
|
1092
|
+
re(), ne(), N();
|
|
1093
|
+
let e = n.fitsView === !0 ? P() : void 0;
|
|
1094
|
+
e && F(e);
|
|
1095
1095
|
},
|
|
1096
1096
|
update: (e) => {
|
|
1097
|
-
if (
|
|
1098
|
-
|
|
1097
|
+
if (bt(e) === bt(h)) {
|
|
1098
|
+
I(e), y === void 0 && N();
|
|
1099
1099
|
return;
|
|
1100
1100
|
}
|
|
1101
|
-
|
|
1102
|
-
let { enteringNodes: t, exitingLinks: r, exitingNodes: i } =
|
|
1101
|
+
re();
|
|
1102
|
+
let { enteringNodes: t, exitingLinks: r, exitingNodes: i } = I(e), o = new Map(g.map((e) => [e.id, {
|
|
1103
1103
|
x: e.x ?? 0,
|
|
1104
1104
|
y: e.y ?? 0
|
|
1105
1105
|
}]));
|
|
1106
|
-
|
|
1106
|
+
ne();
|
|
1107
1107
|
let s = new Map(g.map((e) => [e.id, {
|
|
1108
1108
|
x: e.x ?? 0,
|
|
1109
1109
|
y: e.y ?? 0
|
|
1110
|
-
}])), c = Te(m), l = (n.fitsView === !0 ?
|
|
1110
|
+
}])), c = Te(m), l = (n.fitsView === !0 ? P() : void 0) ?? c, u = (e) => {
|
|
1111
1111
|
for (let t of g) {
|
|
1112
|
-
let n =
|
|
1112
|
+
let n = Ct($(o.get(t.id)), $(s.get(t.id)), e);
|
|
1113
1113
|
t.x = n.x, t.y = n.y;
|
|
1114
1114
|
}
|
|
1115
|
-
if (
|
|
1116
|
-
let a = n.fitsView === !0 ?
|
|
1117
|
-
a &&
|
|
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();
|
|
1118
1118
|
};
|
|
1119
1119
|
if (a <= 0) {
|
|
1120
1120
|
u(1);
|
|
@@ -1123,7 +1123,7 @@ function mt(e, t, n = {}) {
|
|
|
1123
1123
|
u(0);
|
|
1124
1124
|
let d = performance.now(), f = (e) => {
|
|
1125
1125
|
let t = Math.min(1, (e - d) / a);
|
|
1126
|
-
u(
|
|
1126
|
+
u(wt(t)), y = t < 1 ? requestAnimationFrame(f) : void 0;
|
|
1127
1127
|
};
|
|
1128
1128
|
y = requestAnimationFrame(f);
|
|
1129
1129
|
}
|
|
@@ -1132,19 +1132,19 @@ function mt(e, t, n = {}) {
|
|
|
1132
1132
|
function q(e, t) {
|
|
1133
1133
|
if (e.label == null && e.symbol != null) return [];
|
|
1134
1134
|
let n = e.label ?? e.id;
|
|
1135
|
-
if (!t || e.label == null || n.length <=
|
|
1135
|
+
if (!t || e.label == null || n.length <= et) return [n];
|
|
1136
1136
|
let r = n.length / 2, i = -1;
|
|
1137
1137
|
for (let e = n.indexOf(" "); e !== -1; e = n.indexOf(" ", e + 1)) (i === -1 || Math.abs(e - r) < Math.abs(i - r)) && (i = e);
|
|
1138
1138
|
return i === -1 ? [n] : [n.slice(0, i), n.slice(i + 1)];
|
|
1139
1139
|
}
|
|
1140
|
-
function
|
|
1141
|
-
return e.length === 0 ? 0 : Math.max(...e.map((e) => e.length)) *
|
|
1140
|
+
function gt(e) {
|
|
1141
|
+
return e.length === 0 ? 0 : Math.max(...e.map((e) => e.length)) * Ye;
|
|
1142
1142
|
}
|
|
1143
|
-
function
|
|
1143
|
+
function _t(e, t, n, r) {
|
|
1144
1144
|
let { radius: i } = Z(e), a = {
|
|
1145
1145
|
anchor: "middle",
|
|
1146
1146
|
x: 0,
|
|
1147
|
-
y: i +
|
|
1147
|
+
y: i + Ue
|
|
1148
1148
|
};
|
|
1149
1149
|
if (n === "below" || t.length === 0) return a;
|
|
1150
1150
|
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;
|
|
@@ -1153,37 +1153,37 @@ function gt(e, t, n, r) {
|
|
|
1153
1153
|
n - t <= s || (s = n - t, c = t + s / 2);
|
|
1154
1154
|
}
|
|
1155
1155
|
let l = Math.cos(c), u = Math.sin(c), d = (r.length - 1) * W;
|
|
1156
|
-
if (s <
|
|
1157
|
-
let e =
|
|
1156
|
+
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);
|
|
1158
1158
|
return {
|
|
1159
1159
|
anchor: "middle",
|
|
1160
1160
|
x: l * f,
|
|
1161
|
-
y: u * f +
|
|
1161
|
+
y: u * f + Je / 3 - d / 2
|
|
1162
1162
|
};
|
|
1163
1163
|
}
|
|
1164
|
-
if (Math.abs(l) <
|
|
1164
|
+
if (Math.abs(l) < Qe) return u > 0 ? a : {
|
|
1165
1165
|
anchor: "middle",
|
|
1166
1166
|
x: 0,
|
|
1167
|
-
y: -(i +
|
|
1167
|
+
y: -(i + Ze) - d
|
|
1168
1168
|
};
|
|
1169
|
-
let f = i +
|
|
1169
|
+
let f = i + Ze + Math.abs(u) * r.length * W / 2;
|
|
1170
1170
|
return {
|
|
1171
1171
|
anchor: l > 0 ? "start" : "end",
|
|
1172
1172
|
x: l * f,
|
|
1173
|
-
y: u * f +
|
|
1173
|
+
y: u * f + Je / 3 - d / 2
|
|
1174
1174
|
};
|
|
1175
1175
|
}
|
|
1176
|
-
function
|
|
1177
|
-
let t =
|
|
1176
|
+
function vt(e) {
|
|
1177
|
+
let t = ft;
|
|
1178
1178
|
return e.symbol === "+" ? `M-6,0H${String(t)}M0,-6V${String(t)}` : void 0;
|
|
1179
1179
|
}
|
|
1180
|
-
function
|
|
1181
|
-
return e.isAction === !0 ?
|
|
1180
|
+
function yt(e) {
|
|
1181
|
+
return e.isAction === !0 ? ot.symbol : G.nodeText;
|
|
1182
1182
|
}
|
|
1183
1183
|
function J(e) {
|
|
1184
|
-
return Math.round(Z(e).radius *
|
|
1184
|
+
return Math.round(Z(e).radius * ut);
|
|
1185
1185
|
}
|
|
1186
|
-
function
|
|
1186
|
+
function bt(e) {
|
|
1187
1187
|
return JSON.stringify([e.nodes.map((e) => [
|
|
1188
1188
|
e.id,
|
|
1189
1189
|
e.label,
|
|
@@ -1192,12 +1192,12 @@ function yt(e) {
|
|
|
1192
1192
|
e.icon != null
|
|
1193
1193
|
]), e.links.map((e) => [e.source, e.target])]);
|
|
1194
1194
|
}
|
|
1195
|
-
function
|
|
1195
|
+
function xt(e) {
|
|
1196
1196
|
let t = /* @__PURE__ */ new Map();
|
|
1197
1197
|
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]);
|
|
1198
1198
|
return t;
|
|
1199
1199
|
}
|
|
1200
|
-
function
|
|
1200
|
+
function St(e) {
|
|
1201
1201
|
return `${Y(e.source)}>${Y(e.target)}`;
|
|
1202
1202
|
}
|
|
1203
1203
|
function Y(e) {
|
|
@@ -1207,11 +1207,11 @@ function X(e, t) {
|
|
|
1207
1207
|
return typeof e == "object" ? e[t] ?? 0 : 0;
|
|
1208
1208
|
}
|
|
1209
1209
|
function Z(e) {
|
|
1210
|
-
if (e.isAction === !0) return
|
|
1211
|
-
let t = $(
|
|
1210
|
+
if (e.isAction === !0) return ot;
|
|
1211
|
+
let t = $(mt[Math.max(0, Math.min(e.level ?? Ve, mt.length - 1))]);
|
|
1212
1212
|
return e.icon == null ? t : {
|
|
1213
1213
|
...t,
|
|
1214
|
-
radius: Math.max(t.radius,
|
|
1214
|
+
radius: Math.max(t.radius, lt),
|
|
1215
1215
|
stroke: t.fill,
|
|
1216
1216
|
strokeHovered: t.stroke
|
|
1217
1217
|
};
|
|
@@ -1219,17 +1219,17 @@ function Z(e) {
|
|
|
1219
1219
|
function Q(e, t, n) {
|
|
1220
1220
|
return e + (t - e) * n;
|
|
1221
1221
|
}
|
|
1222
|
-
function
|
|
1222
|
+
function Ct(e, t, n) {
|
|
1223
1223
|
return {
|
|
1224
1224
|
x: Q(e.x, t.x, n),
|
|
1225
1225
|
y: Q(e.y, t.y, n)
|
|
1226
1226
|
};
|
|
1227
1227
|
}
|
|
1228
|
-
function
|
|
1228
|
+
function wt(e) {
|
|
1229
1229
|
return e < .5 ? 4 * e ** 3 : 1 - (-2 * e + 2) ** 3 / 2;
|
|
1230
1230
|
}
|
|
1231
1231
|
function $(e) {
|
|
1232
1232
|
if (e === void 0) throw Error("Expected a value in the network diagram.");
|
|
1233
1233
|
return e;
|
|
1234
1234
|
}
|
|
1235
|
-
export {
|
|
1235
|
+
export { ht as renderNetworkDiagram };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export interface NetworkDiagramNode {
|
|
2
2
|
id: string;
|
|
3
|
+
color?: string;
|
|
3
4
|
icon?: string;
|
|
4
5
|
isAction?: boolean;
|
|
5
6
|
isSelected?: boolean;
|
|
@@ -23,8 +24,10 @@ export interface NetworkDiagramOptions {
|
|
|
23
24
|
labelHaloColor?: string;
|
|
24
25
|
labelPlacementId?: NetworkDiagramLabelPlacementId;
|
|
25
26
|
linkDistance?: number;
|
|
27
|
+
nodeBorderWidth?: number;
|
|
26
28
|
onNodeClick?: (node: NetworkDiagramNode) => void;
|
|
27
29
|
reservesLabelRoom?: boolean;
|
|
30
|
+
selectedIconNodeColor?: string;
|
|
28
31
|
selectsOnClick?: boolean;
|
|
29
32
|
transitionDuration?: number;
|
|
30
33
|
wrapsLabels?: boolean;
|
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.130",
|
|
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",
|