@kortexya/nodus 0.1.0 → 0.1.1
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/nodus.src.bundle.js +608 -158
- package/package.json +5 -2
- package/types/renderers/WasmGraphRenderer.d.ts +60 -2
package/nodus.src.bundle.js
CHANGED
|
@@ -531,11 +531,11 @@ function N(e, t, n) {
|
|
|
531
531
|
}));
|
|
532
532
|
return a.sort((e, t) => n(e.el, t.el)), r(new Uint32Array(a.map((e) => e.idx)));
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function P(e, t) {
|
|
535
535
|
let n = e.getObjectList(t.isNode);
|
|
536
536
|
return Array.from(t._indexes).map((e) => n.get(e));
|
|
537
537
|
}
|
|
538
|
-
var
|
|
538
|
+
var F = class {
|
|
539
539
|
isList = !0;
|
|
540
540
|
isNode = !0;
|
|
541
541
|
_indexes;
|
|
@@ -622,7 +622,7 @@ var P = class {
|
|
|
622
622
|
return this;
|
|
623
623
|
}
|
|
624
624
|
toArray() {
|
|
625
|
-
return
|
|
625
|
+
return P(this._nodus.modules.graph, this);
|
|
626
626
|
}
|
|
627
627
|
clone() {
|
|
628
628
|
return this._nodus.nodeList(this._indexes.slice());
|
|
@@ -770,7 +770,7 @@ var P = class {
|
|
|
770
770
|
};
|
|
771
771
|
//#endregion
|
|
772
772
|
//#region src/core/EdgeList.ts
|
|
773
|
-
function
|
|
773
|
+
function ee(e, t, n) {
|
|
774
774
|
let r = e.getObjectList(t.isNode);
|
|
775
775
|
for (let e = 0; e < t._indexes.length; e++) n(r.get(t._indexes[e]), e, t);
|
|
776
776
|
}
|
|
@@ -941,7 +941,7 @@ var de = class {
|
|
|
941
941
|
return ie(this._nodus.modules.graph, this, e);
|
|
942
942
|
}
|
|
943
943
|
forEach(e) {
|
|
944
|
-
|
|
944
|
+
ee(this._nodus.modules.graph, this, e);
|
|
945
945
|
}
|
|
946
946
|
find(e) {
|
|
947
947
|
return R(this._nodus.modules.graph, this, e);
|
|
@@ -2915,7 +2915,8 @@ var fn = class extends z {
|
|
|
2915
2915
|
}
|
|
2916
2916
|
getElements(e, t) {
|
|
2917
2917
|
let n = e ? this.nodeList : this.edgeList;
|
|
2918
|
-
if (e ? this._nodes.get(1)?.constructor : this._edges.get(1)?.constructor, t
|
|
2918
|
+
if (e ? this._nodes.get(1)?.constructor : this._edges.get(1)?.constructor, typeof t == "function") return this.getElements(e, "visible").filter(t);
|
|
2919
|
+
if (t && typeof t != "string") {
|
|
2919
2920
|
let r = this.acquireIndexList(e), i = this.storage.fetch(e);
|
|
2920
2921
|
if (t._index !== void 0) r.push(t._index);
|
|
2921
2922
|
else if (Array.isArray(t) || ArrayBuffer.isView(t)) for (let e of t) if (e && e._index !== void 0) r.push(e._index);
|
|
@@ -7178,8 +7179,8 @@ function Mo(e, t, n, r, i, a, o, s) {
|
|
|
7178
7179
|
g.get(e) === "fixed" && (n /= l);
|
|
7179
7180
|
let a = f.get(e), h = p.get(e);
|
|
7180
7181
|
typeof t == "number" && (t = t.toString());
|
|
7181
|
-
let [S, E, M, N,
|
|
7182
|
-
te ? (M += L, N += R, L /= l, R /= l,
|
|
7182
|
+
let [S, E, M, N, P, F, ee, I, L, R] = r(e), te = !v.get(e), ne = te ? l : 1, re = g.get(e) === "fixed" ? l : 1;
|
|
7183
|
+
te ? (M += L, N += R, L /= l, R /= l, ee /= l, I /= l) : (M += L * l, N += R * l), S = S / ne + M / l + P / re, E = E / ne + N / l + F / re, uo(a - L, h - R, ee, I, -c, u, -d, O), k[0] = a - L, k[1] = h - R, k[2] = ee, k[3] = I, k[4] = c;
|
|
7183
7184
|
let ie = d * S - u * E, ae = u * S + d * E;
|
|
7184
7185
|
O[0] += ie, O[1] += ae, O[2] += ie, O[3] += ae, k[0] += ie, k[1] += ae;
|
|
7185
7186
|
let oe = [
|
|
@@ -7214,8 +7215,8 @@ function Mo(e, t, n, r, i, a, o, s) {
|
|
|
7214
7215
|
let t = E[e];
|
|
7215
7216
|
if (t) for (let e = t.length - 1; e >= 0; e--) M(t[e]);
|
|
7216
7217
|
}
|
|
7217
|
-
let N = i.remove.nodes,
|
|
7218
|
-
for (let t of e) i.indexToRemoveNodeText[t] ? N.push(t) : i.indexToRedrawNodeText[t] &&
|
|
7218
|
+
let N = i.remove.nodes, P = i.redraw.nodes;
|
|
7219
|
+
for (let t of e) i.indexToRemoveNodeText[t] ? N.push(t) : i.indexToRedrawNodeText[t] && P.push(t);
|
|
7219
7220
|
return i;
|
|
7220
7221
|
}
|
|
7221
7222
|
//#endregion
|
|
@@ -7235,7 +7236,7 @@ var No = "shifted", Po = {
|
|
|
7235
7236
|
function Bo(e, t, n, r, i, a, o, s, c) {
|
|
7236
7237
|
let { angle: l, zoom: u } = t, d = r.x, f = r.y, p = r.radius, { source: m, target: h, scalingMethod: g } = n, _ = n.width, v = n.curvature, y = n.layer, b = n.text.content, x = n.text.scaling, S = n.text.size, C = n.text.font, w = n.text.style, T = n.text.scale, E = n.text.maxLineLength, D = n.text.margin, O = n.text.minVisibleSize, k = n.text.padding, A = n.text.adjustAngle, j = n.text.position, M = n.animationDuration;
|
|
7237
7238
|
a.indexToLayer = {}, a.indexToRemoveNodeText = a.indexToRemoveNodeText || {}, a.indexToRemoveEdgeText = {}, a.indexToQuadIndex = a.indexToQuadIndex || {}, a.byLayer = [];
|
|
7238
|
-
let { indexToLayer: N, indexToRedrawEdgeText:
|
|
7239
|
+
let { indexToLayer: N, indexToRedrawEdgeText: P, indexToRemoveEdgeText: F, indexToQuadIndex: ee, byLayer: I } = a;
|
|
7239
7240
|
for (let t = e.length - 1; t >= 0; t--) {
|
|
7240
7241
|
let n = e[t], r = y.get(n) - -1;
|
|
7241
7242
|
(I[r] = I[r] || []).push(n), N[n] = r;
|
|
@@ -7257,11 +7258,11 @@ function Bo(e, t, n, r, i, a, o, s, c) {
|
|
|
7257
7258
|
0,
|
|
7258
7259
|
0
|
|
7259
7260
|
], { bboxes: te, rects: ne } = a, re = (e) => {
|
|
7260
|
-
if (
|
|
7261
|
+
if (P[e] || F[e] || M.get(e) !== 0) return !1;
|
|
7261
7262
|
let t = b ? b.get(e) : "";
|
|
7262
7263
|
if (!t) return !1;
|
|
7263
7264
|
let n = _.get(e), r = O.get(e);
|
|
7264
|
-
if (n * u < r) return
|
|
7265
|
+
if (n * u < r) return F[e] = !0, !1;
|
|
7265
7266
|
g.get(e) === "fixed" && (n /= u);
|
|
7266
7267
|
let a = m.get(e), o = h.get(e), y = d.get(a), N = f.get(a), I = d.get(o), re = f.get(o);
|
|
7267
7268
|
if (y === I && N === re && v.get(e) === 0) return !1;
|
|
@@ -7286,7 +7287,7 @@ function Bo(e, t, n, r, i, a, o, s, c) {
|
|
|
7286
7287
|
R[3],
|
|
7287
7288
|
R[4]
|
|
7288
7289
|
], De = c.getNearbyElements(R[0], R[1], R[2], R[3]), Oe = !1;
|
|
7289
|
-
for (let t of De) if (t !==
|
|
7290
|
+
for (let t of De) if (t !== ee[-e] && t !== void 0) {
|
|
7290
7291
|
let e = 5 * t;
|
|
7291
7292
|
if (go(Ee, [
|
|
7292
7293
|
ne[e],
|
|
@@ -7299,9 +7300,9 @@ function Bo(e, t, n, r, i, a, o, s, c) {
|
|
|
7299
7300
|
break;
|
|
7300
7301
|
}
|
|
7301
7302
|
}
|
|
7302
|
-
if (Oe) return
|
|
7303
|
+
if (Oe) return F[e] = !0, !1;
|
|
7303
7304
|
let ke = te.length / 6;
|
|
7304
|
-
|
|
7305
|
+
ee[-e] = ke, c.insert(ke, R[0], R[1], R[2], R[3]), P[e] = !0, F[e] = !1;
|
|
7305
7306
|
let Ae = Lo - he - l;
|
|
7306
7307
|
return uo(oe - Se, se - Ce, 2 * Se, 2 * Ce, Ae, void 0, void 0, L), vo(L, Ae, Te, L), te.push(L[0], L[1], L[2], L[3], 0, e), ne.push(R[0], R[1], R[2], R[3], R[4]), !0;
|
|
7307
7308
|
};
|
|
@@ -14320,11 +14321,11 @@ function vp(e, t, n, r, i, a) {
|
|
|
14320
14321
|
};
|
|
14321
14322
|
}
|
|
14322
14323
|
function yp(e, t, n, r, i, a, o, s, c) {
|
|
14323
|
-
let l = (e + r + o) / 3, u = (t + i + s) / 3, d = e - l, f = t - u, p = r - l, m = i - u, h = o - l, g = s - u, _ = d - p, v = d - h, y = f - m, b = f - g, x = a - n, S = c - n, C = d * d + f * f - n * n, w = C - p * p - m * m + a * a, T = C - h * h - g * g + c * c, E = v * y - _ * b, D = (y * T - b * w) / (2 * E) - d, O = (b * x - y * S) / E, k = (_ * T - v * w) / (2 * E) - f, A = (v * x - _ * S) / E, j = O * O + A * A - 1, M = 2 * (n + D * O + k * A), N = D * D + k * k - n * n,
|
|
14324
|
+
let l = (e + r + o) / 3, u = (t + i + s) / 3, d = e - l, f = t - u, p = r - l, m = i - u, h = o - l, g = s - u, _ = d - p, v = d - h, y = f - m, b = f - g, x = a - n, S = c - n, C = d * d + f * f - n * n, w = C - p * p - m * m + a * a, T = C - h * h - g * g + c * c, E = v * y - _ * b, D = (y * T - b * w) / (2 * E) - d, O = (b * x - y * S) / E, k = (_ * T - v * w) / (2 * E) - f, A = (v * x - _ * S) / E, j = O * O + A * A - 1, M = 2 * (n + D * O + k * A), N = D * D + k * k - n * n, P = -(Math.abs(j) > 1e-6 ? (M + Math.sqrt(M * M - 4 * j * N)) / (2 * j) : N / M);
|
|
14324
14325
|
return {
|
|
14325
|
-
x: l + d + D + O *
|
|
14326
|
-
y: u + f + k + A *
|
|
14327
|
-
r:
|
|
14326
|
+
x: l + d + D + O * P,
|
|
14327
|
+
y: u + f + k + A * P,
|
|
14328
|
+
r: P
|
|
14328
14329
|
};
|
|
14329
14330
|
}
|
|
14330
14331
|
function bp(e, t, n, r) {
|
|
@@ -14832,28 +14833,28 @@ function Jp(e, t, n, r, i, a) {
|
|
|
14832
14833
|
}
|
|
14833
14834
|
}
|
|
14834
14835
|
u.length = 0, d.length = 0;
|
|
14835
|
-
let N = 1 - .1 ** (1 / C / 2),
|
|
14836
|
+
let N = 1 - .1 ** (1 / C / 2), P = .9 / C, F = null, ee = .5, I = () => {
|
|
14836
14837
|
O += (0 - O) * N;
|
|
14837
|
-
let r = i(O, u, d), a = O <=
|
|
14838
|
+
let r = i(O, u, d), a = O <= ee || r < w;
|
|
14838
14839
|
if (D === 0 || a) {
|
|
14839
14840
|
let e = E.pop();
|
|
14840
14841
|
if (e) {
|
|
14841
|
-
|
|
14842
|
+
F && (ee = F.reduce((e, t) => Math.max(e, Math.abs(y - o[t]), Math.abs(b - s[t])), 0)), u.push(...e);
|
|
14842
14843
|
for (let t = 0; t < e.length; t++) {
|
|
14843
14844
|
let n = e[t], r = m[n];
|
|
14844
14845
|
if (r !== -1) {
|
|
14845
14846
|
let e = l[n] > 1 ? 2 : 1, t = c[r] + c[n];
|
|
14846
14847
|
h[r] -= h[n], o[n] = o[r] + e * t * (2 * Zf() - 1), s[n] = s[r] + e * t * (2 * Zf() - 1);
|
|
14847
|
-
} else
|
|
14848
|
+
} else F && (o[n] = y + 2 * ee * (1 - 2 * Zf()), s[n] = b + 2 * ee * (1 - 2 * Zf()));
|
|
14848
14849
|
}
|
|
14849
|
-
|
|
14850
|
+
F = e;
|
|
14850
14851
|
let n = u.reduce((e, t) => (e[t] = !0, e), {});
|
|
14851
14852
|
d.length = 0;
|
|
14852
14853
|
for (let e = 0; e < t.length; e++) {
|
|
14853
14854
|
let { source: r, target: i, id: a } = t[e];
|
|
14854
14855
|
n[r] && n[i] && d.push(j[Number(a) || e]);
|
|
14855
14856
|
}
|
|
14856
|
-
a = !1, E.length === 0 ? (O = .2,
|
|
14857
|
+
a = !1, E.length === 0 ? (O = .2, ee = .1) : (O = .1 + 2 * P, ee = .1);
|
|
14857
14858
|
}
|
|
14858
14859
|
}
|
|
14859
14860
|
if (D % T === 0 && (x(e, o, s), S(n)), ++D >= Infinity || a) return A();
|
|
@@ -19698,7 +19699,7 @@ var sv = class e {
|
|
|
19698
19699
|
}
|
|
19699
19700
|
let E = this.nodus.nodeList(ev(Array.from(i))), D = s.getSubEdges(C), O = D.size ? D : this.nodus.edgeList(new Uint32Array(Array.from(p)));
|
|
19700
19701
|
D.setVisible(!1), C.setVisible(!0);
|
|
19701
|
-
let k = this.nodus.edgeList(), A = /* @__PURE__ */ new Set(), j = /* @__PURE__ */ new Set(), M = this.nodus.createEdgeList(), N = this.nodus.createNodeList(),
|
|
19702
|
+
let k = this.nodus.edgeList(), A = /* @__PURE__ */ new Set(), j = /* @__PURE__ */ new Set(), M = this.nodus.createEdgeList(), N = this.nodus.createNodeList(), P = [], F = [], ee = this.module.animations, I = this.module.groupController;
|
|
19702
19703
|
I.setPadding(l, this.padding);
|
|
19703
19704
|
for (let e of r) {
|
|
19704
19705
|
let t = this.nodus.modules.graph.getObjectList(!0).get(e);
|
|
@@ -19706,7 +19707,7 @@ var sv = class e {
|
|
|
19706
19707
|
let n = s.getSubNodes(t), r = I.isClose(t), i = !r && !I.isOpen(t), a = I.collapsedGroups.has(t._index), o = this.showContents(t);
|
|
19707
19708
|
(r || a) && j.add(t._index), i && (A.add(t._index), I.getGroupXYR(t, s.getSubNodes(t), void 0));
|
|
19708
19709
|
let c = f.get(t._index), l = c ? this.nodus.edgeList(new Uint32Array(c)) : null;
|
|
19709
|
-
if (l && (M = M.concat(l), o ? a || r ?
|
|
19710
|
+
if (l && (M = M.concat(l), o ? a || r ? ee.fadeInEdges(l._indexes) : l.setExcluded(!1) : r || a ? l.setExcluded(!0) : ee.fadeOutEdges(l._indexes)), k.setVisible(!0), N = N.concat(n), o) P.push(this.module.layoutController.getLayoutFunction(this.onGroupUpdate, t, n, o)()), r ? I.expandGroup(t, n) : I.addOpenGroup(t), F.push(t);
|
|
19710
19711
|
else {
|
|
19711
19712
|
let e = I.getGroupXYR(t, n);
|
|
19712
19713
|
I.closeGroup(t, n, e.x, e.y);
|
|
@@ -19723,7 +19724,7 @@ var sv = class e {
|
|
|
19723
19724
|
subNodesPerMetaNode: a,
|
|
19724
19725
|
intraEdges: M,
|
|
19725
19726
|
subRadiuses: /* @__PURE__ */ new Map()
|
|
19726
|
-
}, await this.module.layoutController.handleLayoutFunctions(
|
|
19727
|
+
}, await this.module.layoutController.handleLayoutFunctions(P), F.forEach((e) => I.setGroupXYR(e)), I.updateGroupLayer();
|
|
19727
19728
|
}
|
|
19728
19729
|
undo() {
|
|
19729
19730
|
let { metaNodes: e, metaEdges: t, subNodes: n, subEdges: r, intraEdges: i } = this.context;
|
|
@@ -21634,8 +21635,8 @@ var wb = class {
|
|
|
21634
21635
|
storeGenericObject(e, t, n) {
|
|
21635
21636
|
let r = this._shapeManager.getIdFromName(n.shape), i = n.pieceId, a = this._dashLengthToBytes(n.dashLength), o = n.isText ? n.gapLength : this._gapLengthToBytes(n.gapLength), s = +n.hasHead, c = +n.hasTail, l = n.isBadge ? +(n.rotateWithEdge ?? !1) : +n.isBodyTriangle, u = +n.isSelfLoop, d = this._patternScaleToBytes(n.patternScale), f = this._offsetAngleToBytes(n.offsetAngle), p = +n.isText, m = +n.adjustTextAngle, h = +n.isBadge, g = +n.bentEnable, _ = +n.bentVertical, v = this._opacityToBytes(n.opacity), y = this._minVisibleSizeToBytes(n.globalMinVisibleSize), b = this._minVisibleSizeToBytes(n.strokeMinVisibleSize), x = this._minVisibleSizeToBytes(n.patternMinVisibleSize), S = this._symbolicSizeToBytes(n.symbolicSize), C = this._curvatureToBytes(n.curvature), w = n.pattern.attributes.colors;
|
|
21636
21637
|
w && (n.pattern.attributes.colors = w.split(";").map((e) => Cb(this._colorToBytes(e.trim()))).join(";"));
|
|
21637
|
-
let T = this._patternManager.getIdFromDefinition(n.pattern), E = this._colorToBytes(n.fillColor), D = this._colorToBytes(n.strokeColor), O = this._colorToBytes(n.patternColor), { x1: k, y1: A, x2: j, y2: M } = n, N = this._fixedSizeToBytes(n.rectWidthOrSourceRadiusFixed),
|
|
21638
|
-
this._setUint16(e, t + 0, ie), this._setUint16(e, t + 2, ae), this._setUint16(e, t + 4, oe), this._setUint16(e, t + 6, se), this._setUint16(e, t + 8, T), this._setUint16(e, t + 10, E), this._setUint16(e, t + 12, D), this._setUint16(e, t + 14, O), this._setFloat32(e, t + 16, k), this._setFloat32(e, t + 20, A), this._setFloat32(e, t + 24, j), this._setFloat32(e, t + 28, M), this._setFloat16(e, t + 32, ce), this._setUint16(e, t + 34, N), this._setFloat16(e, t + 36, le), this._setUint16(e, t + 38,
|
|
21638
|
+
let T = this._patternManager.getIdFromDefinition(n.pattern), E = this._colorToBytes(n.fillColor), D = this._colorToBytes(n.strokeColor), O = this._colorToBytes(n.patternColor), { x1: k, y1: A, x2: j, y2: M } = n, N = this._fixedSizeToBytes(n.rectWidthOrSourceRadiusFixed), P = this._fixedSizeToBytes(n.rectHeightOrTargetRadiusFixed), F = this._scaledSizeToBytes(n.thicknessOrFontSizeScaled), ee = this._fixedSizeToBytes(n.thicknessOrFontSizeFixed), I = this._scaledSizeToBytes(n.strokeWidthScaled), L = this._fixedSizeToBytes(n.strokeWidthFixed), R = this._scaledSizeToBytes(n.offsetScaled), te = this._fixedSizeToBytes(n.offsetFixed), ne = this._fixedSizeToBytes(n.pattern.attributes.paddingTop || 0), re = this._fixedSizeToBytes(n.pattern.attributes.paddingLeft || 0), ie = _b(r, i, a, o, s, c, l, u), ae = vb(d, f, p, m, h, g, _), oe = yb(v, y, b, x), se = bb(S, C), ce = n.rectWidthOrSourceRadiusScaled / this._maxScaledSize * cy, le = n.rectHeightOrTargetRadiusScaled / this._maxScaledSize * cy;
|
|
21639
|
+
this._setUint16(e, t + 0, ie), this._setUint16(e, t + 2, ae), this._setUint16(e, t + 4, oe), this._setUint16(e, t + 6, se), this._setUint16(e, t + 8, T), this._setUint16(e, t + 10, E), this._setUint16(e, t + 12, D), this._setUint16(e, t + 14, O), this._setFloat32(e, t + 16, k), this._setFloat32(e, t + 20, A), this._setFloat32(e, t + 24, j), this._setFloat32(e, t + 28, M), this._setFloat16(e, t + 32, ce), this._setUint16(e, t + 34, N), this._setFloat16(e, t + 36, le), this._setUint16(e, t + 38, P), this._setUint16(e, t + 40, F), this._setUint16(e, t + 42, ee), this._setUint16(e, t + 44, I), this._setUint16(e, t + 46, L), this._setUint16(e, t + 48, R), this._setInt16(e, t + 50, te), this._setInt16(e, t + 52, ne), this._setInt16(e, t + 54, re);
|
|
21639
21640
|
}
|
|
21640
21641
|
_setUint16(e, t, n) {
|
|
21641
21642
|
e.setUint16(t, n, this._littleEndian);
|
|
@@ -21710,8 +21711,8 @@ var wb = class {
|
|
|
21710
21711
|
return s;
|
|
21711
21712
|
}
|
|
21712
21713
|
_extractGenericObject(e, t, n, { bytesToActualCoord: r, bytesToActualScaledSize: i, bytesToActualMinVisibleSize: a, bytesToActualPatternScale: o, bytesToActualSymbolicSize: s, bytesToActualDashLength: c, bytesToActualGapLength: l }) {
|
|
21713
|
-
let u = t, d = n, f = this._littleEndian, p = u.getUint16(d, f), m = G(p, 0, 4), h = G(p, 4, 8), g = G(p, 8, 10), _ = G(p, 10, 12), v = G(p, 12, 13), y = G(p, 13, 14), b = G(p, 14, 15), x = G(p, 15, 16), S = u.getUint16(d + 2, f), C = G(S, 0, 8), w = G(S, 8, 11), T = G(S, 11, 12), E = G(S, 12, 13), D = G(S, 13, 14), O = G(S, 14, 15), k = G(S, 15, 16), A = u.getUint16(d + 4, f), j = G(A, 0, 4), M = G(A, 4, 8), N = G(A, 8, 12),
|
|
21714
|
-
e.pieceId = h, e.shape = this._shapeManager.getNameFromId(m), e.x1 = xb(re, r), e.y1 = xb(ie, r), e.x2 = xb(ae, r), e.y2 = xb(oe, r), e.rectWidthOrSourceRadiusScaled = Xy(se) * this._maxScaledSize / cy, e.rectWidthOrSourceRadiusFixed = ce, e.rectHeightOrTargetRadiusScaled = Xy(le) * this._maxScaledSize / cy, e.rectHeightOrTargetRadiusFixed = ue, e.thicknessOrFontSizeScaled = xb(de, i), e.thicknessOrFontSizeFixed = z, e.strokeWidthScaled = xb(fe, i), e.strokeWidthFixed = pe, e.offsetScaled = xb(me, i), e.offsetFixed = he, e.pattern = this._patternManager.getDefinitionFromId(L), e.pattern.attributes.paddingTop = B, e.pattern.attributes.paddingLeft = ge, e.opacity = j / 15, e.fillColor = Cb(R), e.strokeColor = Cb(te), e.patternColor = Cb(ne), e.globalMinVisibleSize = xb(M, a), e.strokeMinVisibleSize = xb(N, a), e.patternMinVisibleSize = xb(
|
|
21714
|
+
let u = t, d = n, f = this._littleEndian, p = u.getUint16(d, f), m = G(p, 0, 4), h = G(p, 4, 8), g = G(p, 8, 10), _ = G(p, 10, 12), v = G(p, 12, 13), y = G(p, 13, 14), b = G(p, 14, 15), x = G(p, 15, 16), S = u.getUint16(d + 2, f), C = G(S, 0, 8), w = G(S, 8, 11), T = G(S, 11, 12), E = G(S, 12, 13), D = G(S, 13, 14), O = G(S, 14, 15), k = G(S, 15, 16), A = u.getUint16(d + 4, f), j = G(A, 0, 4), M = G(A, 4, 8), N = G(A, 8, 12), P = G(A, 12, 16), F = u.getUint16(d + 6, f), ee = G(F, 0, 8), I = G(F, 8, 16), L = u.getUint16(d + 8, f), R = u.getUint16(d + 10, f), te = u.getUint16(d + 12, f), ne = u.getUint16(d + 14, f), re = u.getFloat32(d + 16, f), ie = u.getFloat32(d + 20, f), ae = u.getFloat32(d + 24, f), oe = u.getFloat32(d + 28, f), se = u.getUint16(d + 32, f), ce = u.getUint16(d + 34, f), le = u.getUint16(d + 36, f), ue = u.getUint16(d + 38, f), de = u.getUint16(d + 40, f), z = u.getUint16(d + 42, f), fe = u.getUint16(d + 44, f), pe = u.getUint16(d + 46, f), me = u.getUint16(d + 48, f), he = ob(u.getUint16(d + 50, f)), B = ob(u.getUint16(d + 52, f)), ge = ob(u.getUint16(d + 54, f));
|
|
21715
|
+
e.pieceId = h, e.shape = this._shapeManager.getNameFromId(m), e.x1 = xb(re, r), e.y1 = xb(ie, r), e.x2 = xb(ae, r), e.y2 = xb(oe, r), e.rectWidthOrSourceRadiusScaled = Xy(se) * this._maxScaledSize / cy, e.rectWidthOrSourceRadiusFixed = ce, e.rectHeightOrTargetRadiusScaled = Xy(le) * this._maxScaledSize / cy, e.rectHeightOrTargetRadiusFixed = ue, e.thicknessOrFontSizeScaled = xb(de, i), e.thicknessOrFontSizeFixed = z, e.strokeWidthScaled = xb(fe, i), e.strokeWidthFixed = pe, e.offsetScaled = xb(me, i), e.offsetFixed = he, e.pattern = this._patternManager.getDefinitionFromId(L), e.pattern.attributes.paddingTop = B, e.pattern.attributes.paddingLeft = ge, e.opacity = j / 15, e.fillColor = Cb(R), e.strokeColor = Cb(te), e.patternColor = Cb(ne), e.globalMinVisibleSize = xb(M, a), e.strokeMinVisibleSize = xb(N, a), e.patternMinVisibleSize = xb(P, a), e.offsetAngle = w * (2 * Math.PI / 8), e.patternScale = C * o, e.symbolicSize = ee * s, e.curvature = ab(I), e.dashLength = g * c, e.gapLength = T ? _ : _ * l, e.hasHead = !!v, e.hasTail = !!y, e.isBodyTriangle = !!b, e.isSelfLoop = !!x, e.isText = !!T, e.adjustTextAngle = !!E, e.isBadge = !!D, e.bentEnable = !!O, e.bentVertical = !!k;
|
|
21715
21716
|
}
|
|
21716
21717
|
_extractAnimationInformation(e, t, n) {
|
|
21717
21718
|
let r = this._littleEndian, i = t.getFloat32(n, r), a = t.getFloat32(n + 4, r), o = t.getUint16(n + 8, r), s = t.getUint16(n + 10, r), c = t.getUint16(n + 12, r), l = t.getUint16(n + 14, r), u = (o >> 8) - 128, d = (s >> 8) - 128, f = (c >> 8) - 128, p = (l >> 8) - 128, m = o % 256 - 128, h = s % 256 - 128, g = c % 256 - 128, _ = l % 256 - 128;
|
|
@@ -22152,8 +22153,8 @@ function Fb(e, t, n, r, i, a) {
|
|
|
22152
22153
|
function Ib(e, t, n, r) {
|
|
22153
22154
|
let i = Math.abs(e.x - t.x - n.x + r.x) + Math.abs(e.y - t.y - n.y + r.y) < .01, a = 9 * (t.x - e.x) ** 2, o = (-243 * e.x + 189 * t.x + 51 * n.x + 3 * r.x) ** 2 / 1e4, s = (-48 * e.x + 24 * t.x + 21 * n.x + 3 * r.x) ** 2 / 625, c = (-147 * e.x + 21 * t.x + 99 * n.x + 27 * r.x) ** 2 / 1e4, l = (-27 * e.x - 9 * t.x + 24 * n.x + 12 * r.x) ** 2 / 625, u = 9 / 16 * (n.x + r.x - e.x - t.x) ** 2, d = 9 * (t.y - e.y) ** 2, f = (-243 * e.y + 189 * t.y + 51 * n.y + 3 * r.y) ** 2 / 1e4, p = (-48 * e.y + 24 * t.y + 21 * n.y + 3 * r.y) ** 2 / 625, m = (-147 * e.y + 21 * t.y + 99 * n.y + 27 * r.y) ** 2 / 1e4, h = (-27 * e.y - 9 * t.y + 24 * n.y + 12 * r.y) ** 2 / 625, g = 9 / 16 * (n.y + r.y - e.y - t.y) ** 2, _ = Math.sqrt(a + d), v = Math.sqrt(o + f), y = Math.sqrt(s + p), b = Math.sqrt(c + m), x = Math.sqrt(l + h), S = Math.sqrt(u + g);
|
|
22154
22155
|
if (i) return 5 / 2993760 * (32134 * _ + 212600 * v - 97050 * y + 544800 * b - 521100 * x + 427368 * S);
|
|
22155
|
-
let C = (-12 * e.x - 24 * t.x + 9 * n.x + 27 * r.x) ** 2 / 625, w = (-27 * e.x - 99 * t.x - 21 * n.x + 147 * r.x) ** 2 / 1e4, T = (-3 * e.x - 21 * t.x - 24 * n.x + 48 * r.x) ** 2 / 625, E = (-3 * e.x - 51 * t.x - 189 * n.x + 243 * r.x) ** 2 / 1e4, D = 9 * (r.x - n.x) ** 2, O = (-12 * e.y - 24 * t.y + 9 * n.y + 27 * r.y) ** 2 / 625, k = (-27 * e.y - 99 * t.y - 21 * n.y + 147 * r.y) ** 2 / 1e4, A = (-3 * e.y - 21 * t.y - 24 * n.y + 48 * r.y) ** 2 / 625, j = (-3 * e.y - 51 * t.y - 189 * n.y + 243 * r.y) ** 2 / 1e4, M = 9 * (r.y - n.y) ** 2, N = Math.sqrt(C + O),
|
|
22156
|
-
return 5 / 2993760 * (16067 * (_ + Math.sqrt(D + M)) + 106300 * (v +
|
|
22156
|
+
let C = (-12 * e.x - 24 * t.x + 9 * n.x + 27 * r.x) ** 2 / 625, w = (-27 * e.x - 99 * t.x - 21 * n.x + 147 * r.x) ** 2 / 1e4, T = (-3 * e.x - 21 * t.x - 24 * n.x + 48 * r.x) ** 2 / 625, E = (-3 * e.x - 51 * t.x - 189 * n.x + 243 * r.x) ** 2 / 1e4, D = 9 * (r.x - n.x) ** 2, O = (-12 * e.y - 24 * t.y + 9 * n.y + 27 * r.y) ** 2 / 625, k = (-27 * e.y - 99 * t.y - 21 * n.y + 147 * r.y) ** 2 / 1e4, A = (-3 * e.y - 21 * t.y - 24 * n.y + 48 * r.y) ** 2 / 625, j = (-3 * e.y - 51 * t.y - 189 * n.y + 243 * r.y) ** 2 / 1e4, M = 9 * (r.y - n.y) ** 2, N = Math.sqrt(C + O), P = Math.sqrt(w + k), F = Math.sqrt(T + A), ee = Math.sqrt(E + j);
|
|
22157
|
+
return 5 / 2993760 * (16067 * (_ + Math.sqrt(D + M)) + 106300 * (v + ee) - 48525 * (y + F) + 272400 * (b + P) - 260550 * (x + N) + 427368 * S);
|
|
22157
22158
|
}
|
|
22158
22159
|
function Lb(e, t, n) {
|
|
22159
22160
|
let r = Math.abs(e) / 5 + dy, i = r * r, a = n - .5, o = a * a, s = 1 / (16 * i), c = Math.sqrt(o + s), l = .5 / r * Math.sqrt(i + .25);
|
|
@@ -23159,13 +23160,14 @@ var cx = class extends Yb {
|
|
|
23159
23160
|
square: 1,
|
|
23160
23161
|
triangleUp: 2,
|
|
23161
23162
|
triangleDown: 3,
|
|
23162
|
-
triangleLeft:
|
|
23163
|
-
triangleRight:
|
|
23163
|
+
triangleLeft: 5,
|
|
23164
|
+
triangleRight: 4,
|
|
23164
23165
|
cross: 6,
|
|
23165
23166
|
diamond: 7,
|
|
23166
23167
|
pentagon: 8,
|
|
23167
23168
|
hexagon: 9,
|
|
23168
|
-
star: 10
|
|
23169
|
+
star: 10,
|
|
23170
|
+
triangle: 4
|
|
23169
23171
|
};
|
|
23170
23172
|
function ux() {
|
|
23171
23173
|
let e = document.createElement("canvas").getContext("2d", { willReadFrequently: !0 });
|
|
@@ -23188,16 +23190,24 @@ var dx = class e {
|
|
|
23188
23190
|
_raf = 0;
|
|
23189
23191
|
_toLinear = ux();
|
|
23190
23192
|
_styleVersion = null;
|
|
23193
|
+
_styleDirty = !0;
|
|
23194
|
+
_frameScheduled = !1;
|
|
23191
23195
|
_radii = new Float32Array();
|
|
23192
23196
|
_fill = new Float32Array();
|
|
23193
23197
|
_shape = new Uint32Array();
|
|
23194
23198
|
_stroke = new Float32Array();
|
|
23195
23199
|
_sw = new Float32Array();
|
|
23200
|
+
_swMinVis = new Float32Array();
|
|
23201
|
+
_layer = new Float32Array();
|
|
23202
|
+
_pulses = [];
|
|
23196
23203
|
_outline = new Float32Array();
|
|
23197
23204
|
_haloCol = new Float32Array();
|
|
23198
23205
|
_haloW = new Float32Array();
|
|
23206
|
+
_outerCol = new Float32Array();
|
|
23207
|
+
_outerW = new Float32Array();
|
|
23199
23208
|
_imageTile = new Uint32Array();
|
|
23200
23209
|
_atlasKey = "";
|
|
23210
|
+
_pieColors = [];
|
|
23201
23211
|
_pieOffset = new Uint32Array();
|
|
23202
23212
|
_pieCount = new Uint32Array();
|
|
23203
23213
|
_pieSegs = new Float32Array();
|
|
@@ -23205,6 +23215,19 @@ var dx = class e {
|
|
|
23205
23215
|
_edgeColor = new Float32Array();
|
|
23206
23216
|
_edgeWidth = new Float32Array();
|
|
23207
23217
|
_edgeCurv = new Float32Array();
|
|
23218
|
+
_edgeArrows = new Uint8Array();
|
|
23219
|
+
_edgeDash = new Uint8Array();
|
|
23220
|
+
_edgeHaloCol = [];
|
|
23221
|
+
_edgeHaloW = [];
|
|
23222
|
+
_edgeOutlineCol = [];
|
|
23223
|
+
_edgeOutlineW = [];
|
|
23224
|
+
_edgeLabel = [];
|
|
23225
|
+
_edgeLabelFont = [];
|
|
23226
|
+
_edgeLabelCol = [];
|
|
23227
|
+
_edgeLabelSize = [];
|
|
23228
|
+
_edgeLabelSec = [];
|
|
23229
|
+
_edgeLabelSecFont = [];
|
|
23230
|
+
_edgeLabelSecCol = [];
|
|
23208
23231
|
_xs = new Float32Array();
|
|
23209
23232
|
_ys = new Float32Array();
|
|
23210
23233
|
_nodeIds = [];
|
|
@@ -23214,9 +23237,27 @@ var dx = class e {
|
|
|
23214
23237
|
cy: 0,
|
|
23215
23238
|
zoom: 1
|
|
23216
23239
|
};
|
|
23217
|
-
|
|
23240
|
+
_autoFrame = !0;
|
|
23241
|
+
_selfMovingCamera = !1;
|
|
23242
|
+
_lastFit = null;
|
|
23218
23243
|
_glyphs = null;
|
|
23244
|
+
_glyphKey = "";
|
|
23245
|
+
_textFonts = [];
|
|
23246
|
+
_labelCol = new Float32Array();
|
|
23247
|
+
_labelMinVis = new Float32Array();
|
|
23248
|
+
_labelMaxLine = new Float32Array();
|
|
23249
|
+
_labelSize = new Float32Array();
|
|
23250
|
+
_labelSecSize = new Float32Array();
|
|
23251
|
+
_labelPos = [];
|
|
23252
|
+
_labelSecondary = [];
|
|
23253
|
+
_labelSecCol = new Float32Array();
|
|
23254
|
+
_labelSecFont = [];
|
|
23255
|
+
_labelSecBg = new Float32Array();
|
|
23256
|
+
_labelBgCol = new Float32Array();
|
|
23257
|
+
_icons = [];
|
|
23219
23258
|
_fontPx = 13;
|
|
23259
|
+
_targetAtlasPx = 48;
|
|
23260
|
+
_quadScale = 64 / 48;
|
|
23220
23261
|
_highlight = /* @__PURE__ */ new Set();
|
|
23221
23262
|
_pieData = /* @__PURE__ */ new Map();
|
|
23222
23263
|
_badgeNode = [];
|
|
@@ -23227,9 +23268,38 @@ var dx = class e {
|
|
|
23227
23268
|
_badgeStrokeCol = [];
|
|
23228
23269
|
_badgeStrokeW = [];
|
|
23229
23270
|
_badgeText = [];
|
|
23271
|
+
_badgeFont = [];
|
|
23230
23272
|
_badgeTextCol = [];
|
|
23231
23273
|
constructor(e, t, n) {
|
|
23232
23274
|
this._nodus = e, this._canvas = t, this._opts = n;
|
|
23275
|
+
try {
|
|
23276
|
+
let t = e?.modules?.events;
|
|
23277
|
+
t?.on("updateAttributes", (e) => {
|
|
23278
|
+
let t = e?.nodeAttributesSet, n = e?.edgeAttributes;
|
|
23279
|
+
if (t || n) {
|
|
23280
|
+
let e = t ? [...t].every((e) => e === "x" || e === "y") : !0;
|
|
23281
|
+
(t && t.size && !e || n && n.length) && (this._styleDirty = !0);
|
|
23282
|
+
} else this._styleDirty = !0;
|
|
23283
|
+
this._scheduleFrame();
|
|
23284
|
+
});
|
|
23285
|
+
let n = () => {
|
|
23286
|
+
this._styleDirty = !0, this._scheduleFrame();
|
|
23287
|
+
};
|
|
23288
|
+
t?.on("addNodes", n), t?.on("addEdges", n), t?.on("removeNodes", n), t?.on("removeEdges", n), t?.on("clearGraph", n), t?.on("move", () => {
|
|
23289
|
+
this._selfMovingCamera || (this._autoFrame = !1), this._scheduleFrame();
|
|
23290
|
+
});
|
|
23291
|
+
} catch {}
|
|
23292
|
+
}
|
|
23293
|
+
_scheduleFrame() {
|
|
23294
|
+
if (!this._frameScheduled) {
|
|
23295
|
+
if (typeof requestAnimationFrame != "function") {
|
|
23296
|
+
this.renderFrame();
|
|
23297
|
+
return;
|
|
23298
|
+
}
|
|
23299
|
+
this._frameScheduled = !0, requestAnimationFrame(() => {
|
|
23300
|
+
this._frameScheduled = !1, this.renderFrame();
|
|
23301
|
+
});
|
|
23302
|
+
}
|
|
23233
23303
|
}
|
|
23234
23304
|
static async create(t, n, r, i = {}) {
|
|
23235
23305
|
let a = new e(t, n, {
|
|
@@ -23240,22 +23310,63 @@ var dx = class e {
|
|
|
23240
23310
|
return a._sizeCanvas(), a._wasm = await new r(n), a._buildAtlas(), a;
|
|
23241
23311
|
}
|
|
23242
23312
|
_buildAtlas() {
|
|
23243
|
-
let
|
|
23244
|
-
|
|
23245
|
-
|
|
23246
|
-
|
|
23247
|
-
|
|
23248
|
-
|
|
23249
|
-
|
|
23250
|
-
|
|
23251
|
-
|
|
23252
|
-
|
|
23253
|
-
|
|
23254
|
-
|
|
23255
|
-
|
|
23256
|
-
|
|
23257
|
-
|
|
23258
|
-
|
|
23313
|
+
let t = /* @__PURE__ */ new Map(), n = (e, n) => {
|
|
23314
|
+
let r = e + " " + n;
|
|
23315
|
+
t.has(r) || t.set(r, {
|
|
23316
|
+
font: e,
|
|
23317
|
+
ch: n
|
|
23318
|
+
});
|
|
23319
|
+
};
|
|
23320
|
+
for (let e = 0; e < this._labels.length; e++) {
|
|
23321
|
+
let t = this._textFonts[e] || "sans-serif";
|
|
23322
|
+
for (let r of this._labels[e] || "") n(t, r);
|
|
23323
|
+
let r = this._labelSecondary[e];
|
|
23324
|
+
if (r) {
|
|
23325
|
+
let i = this._labelSecFont[e] || t;
|
|
23326
|
+
for (let e of r) n(i, e);
|
|
23327
|
+
}
|
|
23328
|
+
let i = this._icons[e];
|
|
23329
|
+
if (i && i.ch) for (let e of i.ch) n(i.font || "sans-serif", e);
|
|
23330
|
+
}
|
|
23331
|
+
for (let e = 0; e < this._badgeText.length; e++) {
|
|
23332
|
+
let t = this._badgeText[e];
|
|
23333
|
+
if (t) for (let r of t) n(this._badgeFont[e] || "sans-serif", r);
|
|
23334
|
+
}
|
|
23335
|
+
for (let e = 0; e < this._edgeLabel.length; e++) {
|
|
23336
|
+
let t = this._edgeLabel[e];
|
|
23337
|
+
if (t) for (let r of t) n(this._edgeLabelFont[e] || "sans-serif", r);
|
|
23338
|
+
let r = this._edgeLabelSec[e];
|
|
23339
|
+
if (r) for (let t of r) n(this._edgeLabelSecFont[e] || "sans-serif", t);
|
|
23340
|
+
}
|
|
23341
|
+
let r = Math.max(48, Math.min(512, this._targetAtlasPx || 48)), i = r <= 48 ? 48 : r <= 96 ? 96 : r <= 192 ? 192 : r <= 384 ? 384 : 512, a = [...t.keys()].sort().join("") + "@" + i;
|
|
23342
|
+
if (a === this._glyphKey && this._glyphs) return;
|
|
23343
|
+
this._glyphKey = a;
|
|
23344
|
+
let o = e._QUAD_SCALE, s = Math.max(2, Math.ceil(Math.sqrt(Math.max(1, t.size)))), c = Math.round(i * o), l = Math.floor(4096 / s);
|
|
23345
|
+
c > l && (c = l);
|
|
23346
|
+
let u = Math.max(8, Math.round(c / o));
|
|
23347
|
+
this._quadScale = c / u;
|
|
23348
|
+
let d = s * c, f = document.createElement("canvas");
|
|
23349
|
+
f.width = d, f.height = d;
|
|
23350
|
+
let p = f.getContext("2d", { willReadFrequently: !0 });
|
|
23351
|
+
p.clearRect(0, 0, d, d), p.fillStyle = "#fff", p.textBaseline = "middle", p.textAlign = "center", this._glyphs = {};
|
|
23352
|
+
let m = 0;
|
|
23353
|
+
for (let { font: e, ch: n } of t.values()) {
|
|
23354
|
+
if (m >= s * s) break;
|
|
23355
|
+
let t = m % s * c, r = Math.floor(m / s) * c, i = e.match(/^((?:(?:bold|bolder|lighter|italic|oblique|normal|[1-9]00)\s+)*)(.*)$/), a = i[1].trim(), o = i[2] || "sans-serif", l = /[\s,]/.test(o) ? `"${o.replace(/["']/g, "")}"` : o;
|
|
23356
|
+
p.font = `${a ? a + " " : ""}${u}px ${l}`, p.fillText(n, t + c / 2, r + c / 2);
|
|
23357
|
+
let f = p.measureText(n).width / u;
|
|
23358
|
+
this._glyphs[e + " " + n] = {
|
|
23359
|
+
u0: t / d,
|
|
23360
|
+
v0: r / d,
|
|
23361
|
+
u1: (t + c) / d,
|
|
23362
|
+
v1: (r + c) / d,
|
|
23363
|
+
adv: f
|
|
23364
|
+
}, m++;
|
|
23365
|
+
}
|
|
23366
|
+
let h = p.getImageData(0, 0, d, d).data;
|
|
23367
|
+
this._wasm.set_text_atlas(d, d, new Uint8Array(h.buffer));
|
|
23368
|
+
}
|
|
23369
|
+
static _QUAD_SCALE = 64 / 48;
|
|
23259
23370
|
async _loadAtlas(e) {
|
|
23260
23371
|
let t = 1024, n = document.createElement("canvas");
|
|
23261
23372
|
n.width = t, n.height = t;
|
|
@@ -23274,22 +23385,123 @@ var dx = class e {
|
|
|
23274
23385
|
}
|
|
23275
23386
|
_buildText(e) {
|
|
23276
23387
|
if (!this._glyphs) return new Float32Array();
|
|
23277
|
-
let t = this.
|
|
23278
|
-
|
|
23279
|
-
|
|
23280
|
-
.
|
|
23281
|
-
|
|
23282
|
-
|
|
23283
|
-
|
|
23284
|
-
let
|
|
23285
|
-
|
|
23286
|
-
|
|
23287
|
-
|
|
23288
|
-
|
|
23289
|
-
|
|
23388
|
+
let t = this._dpr() / Math.max(e, 1e-6);
|
|
23389
|
+
this._fontPx * t;
|
|
23390
|
+
let n = this._quadScale, r = [], i = (e, t, n, i, a) => {
|
|
23391
|
+
r.push(e - n / 2, t - n / 2, n, n), r.push(a[0], a[1], a[2], a[3]), r.push(i.u0, i.v0, i.u1, i.v1), r.push(a[0], a[1], a[2], a[3]), r.push(1, 0, 0, 0);
|
|
23392
|
+
}, a = (e, t, n, i, a) => {
|
|
23393
|
+
r.push(e - n / 2, t - i / 2, n, i), r.push(a[0], a[1], a[2], a[3]), r.push(-1, -1, -1, -1), r.push(a[0], a[1], a[2], a[3]), r.push(1, 0, 0, 0);
|
|
23394
|
+
}, o = [], s = (e, t, r, s, c, l, u, d, f, p, m = !0) => {
|
|
23395
|
+
let h = [];
|
|
23396
|
+
for (let t of e.split("\n")) {
|
|
23397
|
+
if (d <= 0) {
|
|
23398
|
+
h.push(t);
|
|
23399
|
+
continue;
|
|
23400
|
+
}
|
|
23401
|
+
let e = "";
|
|
23402
|
+
for (let n of t.split(" ")) e && e.length + 1 + n.length > d ? (h.push(e), e = n) : e = e ? e + " " + n : n;
|
|
23403
|
+
h.push(e);
|
|
23404
|
+
}
|
|
23405
|
+
let g = h.map((e) => {
|
|
23406
|
+
let n = 0;
|
|
23407
|
+
for (let r of e) n += this._glyphs[t + " " + r]?.adv ?? .5;
|
|
23408
|
+
return n;
|
|
23409
|
+
}), _ = g.reduce((e, t) => Math.max(e, t), 0), v = p * 1.15, y = _ * p + p * .9, b = (h.length - 1) * v / 2, x = p * .85, S = c, C;
|
|
23410
|
+
f === "top" ? C = l - u - x - (h.length - 1) * v : f === "center" ? C = l - b : f === "left" ? (S = c - u - p * .5 - y / 2, C = l - b) : f === "right" ? (S = c + u + p * .5 + y / 2, C = l - b) : C = f === "under" ? l : l + u + x;
|
|
23411
|
+
let w = C + b, T = y, E = h.length * v + p * .3;
|
|
23412
|
+
if (m) {
|
|
23413
|
+
for (let e of o) if (Math.abs(S - e.x) < (T + e.w) / 2 && Math.abs(w - e.y) < (E + e.h) / 2) return null;
|
|
23414
|
+
o.push({
|
|
23415
|
+
x: S,
|
|
23416
|
+
y: w,
|
|
23417
|
+
w: T,
|
|
23418
|
+
h: E
|
|
23419
|
+
});
|
|
23420
|
+
}
|
|
23421
|
+
s && s[3] > 0 && a(S, w, T, E, s);
|
|
23422
|
+
for (let e = 0; e < h.length; e++) {
|
|
23423
|
+
let a = C + e * v, o = S - g[e] * p / 2;
|
|
23424
|
+
for (let s of h[e]) {
|
|
23425
|
+
let e = this._glyphs[t + " " + s], c = (e?.adv ?? .5) * p;
|
|
23426
|
+
e && i(o + c / 2, a, p * n, e, r), o += c;
|
|
23427
|
+
}
|
|
23428
|
+
}
|
|
23429
|
+
return C + h.length * v;
|
|
23430
|
+
};
|
|
23431
|
+
for (let r = 0; r < this._radii.length; r++) {
|
|
23432
|
+
let a = this._icons[r];
|
|
23433
|
+
if (a && a.ch) {
|
|
23434
|
+
let e = this._glyphs[(a.font || "sans-serif") + " " + [...a.ch][0]];
|
|
23435
|
+
e && i(this._xs[r], this._ys[r], (a.scale || .7) * this._radii[r] * 2 * n, e, a.col);
|
|
23436
|
+
}
|
|
23437
|
+
let o = this._labels[r], c = this._labelMinVis[r];
|
|
23438
|
+
if (o && (c <= 0 || 2 * this._radii[r] * e / this._dpr() >= c)) {
|
|
23439
|
+
let e = this._textFonts[r] || "sans-serif", n = this._labelCol, i = [
|
|
23440
|
+
n[r * 4],
|
|
23441
|
+
n[r * 4 + 1],
|
|
23442
|
+
n[r * 4 + 2],
|
|
23443
|
+
n[r * 4 + 3] || 1
|
|
23444
|
+
], a = this._labelBgCol, c = a[r * 4 + 3] > 0 ? [
|
|
23445
|
+
a[r * 4],
|
|
23446
|
+
a[r * 4 + 1],
|
|
23447
|
+
a[r * 4 + 2],
|
|
23448
|
+
a[r * 4 + 3]
|
|
23449
|
+
] : null, l = (this._labelSize[r] || this._fontPx) * t, u = s(String(o), e, i, c, this._xs[r], this._ys[r], this._radii[r], this._labelMaxLine[r], this._labelPos[r] || "bottom", l), d = this._labelSecondary[r];
|
|
23450
|
+
if (d && u != null) {
|
|
23451
|
+
let n = this._labelSecFont[r] || e, i = this._labelSecCol, a = [
|
|
23452
|
+
i[r * 4],
|
|
23453
|
+
i[r * 4 + 1],
|
|
23454
|
+
i[r * 4 + 2],
|
|
23455
|
+
i[r * 4 + 3] || 1
|
|
23456
|
+
], o = this._labelSecBg, c = o[r * 4 + 3] > 0 ? [
|
|
23457
|
+
o[r * 4],
|
|
23458
|
+
o[r * 4 + 1],
|
|
23459
|
+
o[r * 4 + 2],
|
|
23460
|
+
o[r * 4 + 3]
|
|
23461
|
+
] : null, l = (this._labelSecSize[r] || this._labelSize[r] || this._fontPx) * t;
|
|
23462
|
+
s(d, n, a, c, this._xs[r], u, 0, this._labelMaxLine[r], "under", l, !1);
|
|
23463
|
+
}
|
|
23464
|
+
}
|
|
23465
|
+
}
|
|
23466
|
+
for (let e = 0; e < this._edgeLabel.length; e++) {
|
|
23467
|
+
let i = this._edgeLabel[e];
|
|
23468
|
+
if (!i || !this._glyphs) continue;
|
|
23469
|
+
let a = this._edges[e * 2], o = this._edges[e * 2 + 1], s = this._xs[a], c = this._ys[a], l = this._xs[o], u = this._ys[o], d = Math.atan2(u - c, l - s);
|
|
23470
|
+
(d > Math.PI / 2 || d < -Math.PI / 2) && (d += Math.PI);
|
|
23471
|
+
let f = (this._edgeLabelSize[e] || this._fontPx) * t, p = Math.cos(d), m = Math.sin(d), h = f * n / 2, g = this._edgeLabelFont[e] || "sans-serif", _ = this._edgeLabelCol, v = [
|
|
23472
|
+
_[e * 4],
|
|
23473
|
+
_[e * 4 + 1],
|
|
23474
|
+
_[e * 4 + 2],
|
|
23475
|
+
_[e * 4 + 3] || 1
|
|
23476
|
+
], y = f * .85, b = f * 1.15, x = (s + l) / 2, S = (c + u) / 2, C = (e, t, i, a) => {
|
|
23477
|
+
let o = e.split("\n"), s = a ? -1 : 1;
|
|
23478
|
+
for (let e = 0; e < o.length; e++) {
|
|
23479
|
+
let c = o[e], l = 0;
|
|
23480
|
+
for (let e of c) l += this._glyphs[t + " " + e]?.adv ?? .5;
|
|
23481
|
+
let u = s * (y + (a ? o.length - 1 - e : e) * b), d = x + -m * u, g = S + p * u, _ = -(l * f) / 2;
|
|
23482
|
+
for (let e of c) {
|
|
23483
|
+
let a = this._glyphs[t + " " + e], o = (a?.adv ?? .5) * f;
|
|
23484
|
+
if (a) {
|
|
23485
|
+
let e = d + (_ + o / 2) * p, t = g + (_ + o / 2) * m;
|
|
23486
|
+
r.push(e - h * (p - m), t - h * (m + p), f * n, f * n), r.push(i[0], i[1], i[2], i[3]), r.push(a.u0, a.v0, a.u1, a.v1), r.push(i[0], i[1], i[2], i[3]), r.push(p, m, 0, 0);
|
|
23487
|
+
}
|
|
23488
|
+
_ += o;
|
|
23489
|
+
}
|
|
23490
|
+
}
|
|
23491
|
+
};
|
|
23492
|
+
C(i, g, v, !0);
|
|
23493
|
+
let w = this._edgeLabelSec[e];
|
|
23494
|
+
if (w) {
|
|
23495
|
+
let t = this._edgeLabelSecFont[e] || g, n = this._edgeLabelSecCol;
|
|
23496
|
+
C(w, t, [
|
|
23497
|
+
n[e * 4],
|
|
23498
|
+
n[e * 4 + 1],
|
|
23499
|
+
n[e * 4 + 2],
|
|
23500
|
+
n[e * 4 + 3] || 1
|
|
23501
|
+
], !1);
|
|
23290
23502
|
}
|
|
23291
23503
|
}
|
|
23292
|
-
return new Float32Array(
|
|
23504
|
+
return new Float32Array(r);
|
|
23293
23505
|
}
|
|
23294
23506
|
_dpr() {
|
|
23295
23507
|
return Math.max(window.devicePixelRatio || 1, this._opts.pixelRatio || 1);
|
|
@@ -23298,6 +23510,12 @@ var dx = class e {
|
|
|
23298
23510
|
let e = this._dpr(), t = this._canvas.clientWidth || parseInt(this._canvas.style.width) || 320, n = this._canvas.clientHeight || parseInt(this._canvas.style.height) || 320;
|
|
23299
23511
|
this._canvas.width = Math.max(1, Math.round(t * e)), this._canvas.height = Math.max(1, Math.round(n * e));
|
|
23300
23512
|
}
|
|
23513
|
+
_syncCanvasSize() {
|
|
23514
|
+
let e = this._canvas.clientWidth, t = this._canvas.clientHeight;
|
|
23515
|
+
if (!e || !t) return;
|
|
23516
|
+
let n = this._dpr(), r = Math.max(1, Math.round(e * n)), i = Math.max(1, Math.round(t * n));
|
|
23517
|
+
r === this._canvas.width && i === this._canvas.height || (this._canvas.width = r, this._canvas.height = i, this._wasm?.resize(r, i));
|
|
23518
|
+
}
|
|
23301
23519
|
_safeAttr(e, t) {
|
|
23302
23520
|
try {
|
|
23303
23521
|
return e.getAttribute(t);
|
|
@@ -23313,8 +23531,8 @@ var dx = class e {
|
|
|
23313
23531
|
}
|
|
23314
23532
|
_rebuildStyle() {
|
|
23315
23533
|
let e = this._nodus, t = e.getNodes(), n = t.size, r = n + ":" + e.getEdges().size;
|
|
23316
|
-
if (r === this._styleVersion) return;
|
|
23317
|
-
this._styleVersion = r, this._radii = new Float32Array(n), this._fill = new Float32Array(n * 4), this._shape = new Uint32Array(n), this._stroke = new Float32Array(n * 4), this._sw = new Float32Array(n), this._outline = new Float32Array(n * 4), this._haloCol = new Float32Array(n * 4), this._haloW = new Float32Array(n), this._imageTile = new Uint32Array(n), this._pieOffset = new Uint32Array(n), this._pieCount = new Uint32Array(n), this._badgeNode = [], this._badgeAngle = [], this._badgeScale = [], this._badgePosScale = [], this._badgeFill = [], this._badgeStrokeCol = [], this._badgeStrokeW = [], this._badgeText = [], this._badgeTextCol = [], this._xs = new Float32Array(n);
|
|
23534
|
+
if (!this._styleDirty && r === this._styleVersion) return;
|
|
23535
|
+
this._styleDirty = !1, this._styleVersion = r, this._radii = new Float32Array(n), this._fill = new Float32Array(n * 4), this._shape = new Uint32Array(n), this._stroke = new Float32Array(n * 4), this._sw = new Float32Array(n), this._swMinVis = new Float32Array(n), this._layer = new Float32Array(n), this._pulses = [], this._outline = new Float32Array(n * 4), this._haloCol = new Float32Array(n * 4), this._haloW = new Float32Array(n), this._outerCol = new Float32Array(n * 4), this._outerW = new Float32Array(n), this._imageTile = new Uint32Array(n), this._labelCol = new Float32Array(n * 4), this._labelMinVis = new Float32Array(n), this._labelMaxLine = new Float32Array(n), this._labelSize = new Float32Array(n), this._labelSecSize = new Float32Array(n), this._labelPos = Array(n), this._labelSecondary = Array(n), this._labelSecCol = new Float32Array(n * 4), this._labelSecFont = Array(n), this._labelSecBg = new Float32Array(n * 4), this._labelBgCol = new Float32Array(n * 4), this._textFonts = Array(n), this._icons = Array(n), this._pieColors = Array(n), this._pieOffset = new Uint32Array(n), this._pieCount = new Uint32Array(n), this._badgeNode = [], this._badgeAngle = [], this._badgeScale = [], this._badgePosScale = [], this._badgeFill = [], this._badgeStrokeCol = [], this._badgeStrokeW = [], this._badgeText = [], this._badgeFont = [], this._badgeTextCol = [], this._xs = new Float32Array(n);
|
|
23318
23536
|
let i = /* @__PURE__ */ new Map(), a = [], o = [];
|
|
23319
23537
|
this._ys = new Float32Array(n);
|
|
23320
23538
|
let s = {};
|
|
@@ -23326,26 +23544,122 @@ var dx = class e {
|
|
|
23326
23544
|
r = e.getAttribute("text");
|
|
23327
23545
|
} catch {}
|
|
23328
23546
|
typeof r == "object" && r && (r = r.content), this._labels[t] = r != null && r !== "" ? String(r) : "";
|
|
23329
|
-
let
|
|
23330
|
-
this.
|
|
23331
|
-
let
|
|
23547
|
+
let c = String(this._safeAttr(e, "text.font") ?? "sans-serif").replace(/["']/g, "") || "sans-serif", l = String(this._safeAttr(e, "text.style") ?? "normal");
|
|
23548
|
+
this._textFonts[t] = (l && l !== "normal" ? l + " " : "") + c;
|
|
23549
|
+
let u = this._styleColor(this._safeAttr(e, "text.color")) || [
|
|
23550
|
+
0,
|
|
23551
|
+
0,
|
|
23552
|
+
0,
|
|
23553
|
+
1
|
|
23554
|
+
];
|
|
23555
|
+
this._labelCol[t * 4] = u[0], this._labelCol[t * 4 + 1] = u[1], this._labelCol[t * 4 + 2] = u[2], this._labelCol[t * 4 + 3] = u[3];
|
|
23556
|
+
let d = Number(this._safeAttr(e, "text.minVisibleSize"));
|
|
23557
|
+
this._labelMinVis[t] = isFinite(d) ? d : 0;
|
|
23558
|
+
let f = Number(this._safeAttr(e, "text.maxLineLength"));
|
|
23559
|
+
this._labelMaxLine[t] = isFinite(f) && f > 0 ? f : 0;
|
|
23560
|
+
let p = Number(this._safeAttr(e, "text.size"));
|
|
23561
|
+
this._labelSize[t] = isFinite(p) && p > 0 ? p : 0;
|
|
23562
|
+
let m = Number(this._safeAttr(e, "text.secondary.size"));
|
|
23563
|
+
this._labelSecSize[t] = isFinite(m) && m > 0 ? m : 0, this._labelPos[t] = String(this._safeAttr(e, "text.position") ?? "bottom");
|
|
23564
|
+
let h = this._safeAttr(e, "text.secondary.content");
|
|
23565
|
+
if (this._labelSecondary[t] = h != null && h !== "" ? String(h) : "", this._labelSecondary[t]) {
|
|
23566
|
+
let n = String(this._safeAttr(e, "text.secondary.font") ?? this._safeAttr(e, "text.font") ?? "sans-serif").replace(/["']/g, "") || "sans-serif", r = String(this._safeAttr(e, "text.secondary.style") ?? "normal");
|
|
23567
|
+
this._labelSecFont[t] = (r && r !== "normal" ? r + " " : "") + n;
|
|
23568
|
+
let i = this._styleColor(this._safeAttr(e, "text.secondary.color")) || [
|
|
23569
|
+
0,
|
|
23570
|
+
0,
|
|
23571
|
+
0,
|
|
23572
|
+
1
|
|
23573
|
+
];
|
|
23574
|
+
this._labelSecCol[t * 4] = i[0], this._labelSecCol[t * 4 + 1] = i[1], this._labelSecCol[t * 4 + 2] = i[2], this._labelSecCol[t * 4 + 3] = i[3];
|
|
23575
|
+
}
|
|
23576
|
+
let g = this._safeAttr(e, "icon.content");
|
|
23577
|
+
g != null && g !== "" ? this._icons[t] = {
|
|
23578
|
+
ch: String(g),
|
|
23579
|
+
font: String(this._safeAttr(e, "icon.font") ?? "sans-serif").replace(/["']/g, "") || "sans-serif",
|
|
23580
|
+
col: this._styleColor(this._safeAttr(e, "icon.color")) || [
|
|
23581
|
+
0,
|
|
23582
|
+
0,
|
|
23583
|
+
0,
|
|
23584
|
+
1
|
|
23585
|
+
],
|
|
23586
|
+
scale: Number(this._safeAttr(e, "icon.scale")) || .7
|
|
23587
|
+
} : this._icons[t] = null;
|
|
23588
|
+
let _ = e.getAttribute("color"), v = Array.isArray(_) && _.length ? _ : null;
|
|
23589
|
+
this._pieColors[t] = v;
|
|
23590
|
+
let [y, b, x, S] = this._toLinear((v ? v[0] : _) || "#617083");
|
|
23591
|
+
this._fill[t * 4] = y, this._fill[t * 4 + 1] = b, this._fill[t * 4 + 2] = x, this._fill[t * 4 + 3] = S;
|
|
23592
|
+
let C = this._safeAttr(e, "text.backgroundColor"), w = C === "inherit" ? [
|
|
23593
|
+
this._fill[t * 4],
|
|
23594
|
+
this._fill[t * 4 + 1],
|
|
23595
|
+
this._fill[t * 4 + 2],
|
|
23596
|
+
1
|
|
23597
|
+
] : this._styleColor(C);
|
|
23598
|
+
if (w && (this._labelBgCol[t * 4] = w[0], this._labelBgCol[t * 4 + 1] = w[1], this._labelBgCol[t * 4 + 2] = w[2], this._labelBgCol[t * 4 + 3] = w[3]), this._labelSecondary[t]) {
|
|
23599
|
+
let n = this._safeAttr(e, "text.secondary.backgroundColor"), r = n === "inherit" ? [
|
|
23600
|
+
this._fill[t * 4],
|
|
23601
|
+
this._fill[t * 4 + 1],
|
|
23602
|
+
this._fill[t * 4 + 2],
|
|
23603
|
+
1
|
|
23604
|
+
] : this._styleColor(n);
|
|
23605
|
+
r && (this._labelSecBg[t * 4] = r[0], this._labelSecBg[t * 4 + 1] = r[1], this._labelSecBg[t * 4 + 2] = r[2], this._labelSecBg[t * 4 + 3] = r[3]);
|
|
23606
|
+
}
|
|
23607
|
+
if (this._radii[t] = Number(e.getAttribute("radius")) || 14, this._shape[t] = lx[e.getAttribute("shape")] ?? 0, this._layer[t] = Number(this._safeAttr(e, "layer")) || 0, this._safeAttr(e, "pulse.enabled")) {
|
|
23608
|
+
let n = [
|
|
23609
|
+
this._fill[t * 4],
|
|
23610
|
+
this._fill[t * 4 + 1],
|
|
23611
|
+
this._fill[t * 4 + 2],
|
|
23612
|
+
this._fill[t * 4 + 3]
|
|
23613
|
+
], r = this._safeAttr(e, "pulse.startColor"), i = this._safeAttr(e, "pulse.endColor"), a = r == null || r === "inherit" ? n : this._styleColor(r) || n, o = i === "inherit" ? n.slice(0, 3).concat(0) : i == null || i === "transparent" ? [
|
|
23614
|
+
a[0],
|
|
23615
|
+
a[1],
|
|
23616
|
+
a[2],
|
|
23617
|
+
0
|
|
23618
|
+
] : this._styleColor(i) || [
|
|
23619
|
+
a[0],
|
|
23620
|
+
a[1],
|
|
23621
|
+
a[2],
|
|
23622
|
+
0
|
|
23623
|
+
];
|
|
23624
|
+
this._pulses.push({
|
|
23625
|
+
i: t,
|
|
23626
|
+
sr: Number(this._safeAttr(e, "pulse.startRatio")) || 1,
|
|
23627
|
+
er: Number(this._safeAttr(e, "pulse.endRatio")) || 2,
|
|
23628
|
+
w: Number(this._safeAttr(e, "pulse.width")) || 2,
|
|
23629
|
+
sc: a,
|
|
23630
|
+
ec: o,
|
|
23631
|
+
iv: Number(this._safeAttr(e, "pulse.interval")) || 1e3,
|
|
23632
|
+
du: Number(this._safeAttr(e, "pulse.duration")) || 500
|
|
23633
|
+
});
|
|
23634
|
+
}
|
|
23635
|
+
let T = this._styleColor(this._safeAttr(e, "innerStroke")), E = T || [
|
|
23332
23636
|
1,
|
|
23333
23637
|
1,
|
|
23334
23638
|
1,
|
|
23335
23639
|
1
|
|
23336
23640
|
];
|
|
23337
|
-
this._stroke[t * 4] =
|
|
23338
|
-
let
|
|
23339
|
-
|
|
23340
|
-
let
|
|
23341
|
-
|
|
23342
|
-
let
|
|
23343
|
-
|
|
23344
|
-
|
|
23345
|
-
|
|
23346
|
-
|
|
23347
|
-
|
|
23348
|
-
|
|
23641
|
+
this._stroke[t * 4] = E[0], this._stroke[t * 4 + 1] = E[1], this._stroke[t * 4 + 2] = E[2], this._stroke[t * 4 + 3] = E[3];
|
|
23642
|
+
let D = Number(this._safeAttr(e, "innerStroke.width"));
|
|
23643
|
+
this._sw[t] = T ? isFinite(D) ? D : 2 : 0;
|
|
23644
|
+
let O = Number(this._safeAttr(e, "innerStroke.minVisibleSize"));
|
|
23645
|
+
this._swMinVis[t] = isFinite(O) ? O : 12;
|
|
23646
|
+
let k = this._styleColor(this._safeAttr(e, "outerStroke.color"));
|
|
23647
|
+
k && (this._outerCol[t * 4] = k[0], this._outerCol[t * 4 + 1] = k[1], this._outerCol[t * 4 + 2] = k[2], this._outerCol[t * 4 + 3] = k[3], this._outerW[t] = Number(this._safeAttr(e, "outerStroke.width")) || 5);
|
|
23648
|
+
let A = this._safeAttr(e, "outline") ? this._styleColor(this._safeAttr(e, "outline.color")) : null;
|
|
23649
|
+
A && (this._outline[t * 4] = A[0], this._outline[t * 4 + 1] = A[1], this._outline[t * 4 + 2] = A[2], this._outline[t * 4 + 3] = A[3]);
|
|
23650
|
+
let j = this._safeAttr(e, "halo"), M = this._styleColor(j);
|
|
23651
|
+
if (M) {
|
|
23652
|
+
this._haloCol[t * 4] = M[0], this._haloCol[t * 4 + 1] = M[1], this._haloCol[t * 4 + 2] = M[2], this._haloCol[t * 4 + 3] = M[3];
|
|
23653
|
+
let n = Number(this._safeAttr(e, "halo.width"));
|
|
23654
|
+
this._haloW[t] = isFinite(n) ? n : 10;
|
|
23655
|
+
}
|
|
23656
|
+
let N = this._safeAttr(e, "image");
|
|
23657
|
+
if (N && typeof N == "string") {
|
|
23658
|
+
let e = i.get(N);
|
|
23659
|
+
e === void 0 && a.length < 256 && (e = a.length, i.set(N, e), a.push(N)), this._imageTile[t] = e === void 0 ? 0 : e + 1;
|
|
23660
|
+
}
|
|
23661
|
+
let P = this._safeAttr(e, "badges");
|
|
23662
|
+
if (P && typeof P == "object") {
|
|
23349
23663
|
let e = {
|
|
23350
23664
|
topLeft: 5 / 4 * Math.PI,
|
|
23351
23665
|
topRight: 7 / 4 * Math.PI,
|
|
@@ -23358,7 +23672,7 @@ var dx = class e {
|
|
|
23358
23672
|
"bottomLeft",
|
|
23359
23673
|
"bottomRight"
|
|
23360
23674
|
]) {
|
|
23361
|
-
let r =
|
|
23675
|
+
let r = P[n];
|
|
23362
23676
|
if (!r) continue;
|
|
23363
23677
|
let i = typeof r == "object" && r.text != null && (typeof r.text == "object" ? r.text.content != null && r.text.content !== "" : r.text !== ""), a = typeof r == "object" && r.image != null && (typeof r.image == "object" ? r.image.url != null : !0);
|
|
23364
23678
|
if (!i && !a) continue;
|
|
@@ -23372,21 +23686,21 @@ var dx = class e {
|
|
|
23372
23686
|
0,
|
|
23373
23687
|
0,
|
|
23374
23688
|
1
|
|
23375
|
-
], l = s && typeof s == "object" && s.width != null ? Number(s.width) : 1.5, u = r && typeof r == "object" ? r.text : null, d = null;
|
|
23376
|
-
typeof u == "object" && u && (d = this._styleColor(u.color), u = u.content), this._badgeNode.push(t), this._badgeAngle.push(e[n]), this._badgeScale.push(r && typeof r == "object" && r.scale != null ? Number(r.scale) : .45), this._badgePosScale.push(r && typeof r == "object" && r.positionScale != null ? Number(r.positionScale) : 1), this._badgeFill.push(o[0], o[1], o[2], o[3]), this._badgeStrokeCol.push(c[0], c[1], c[2], c[3]), this._badgeStrokeW.push(l), this._badgeText.push(u != null && u !== "" ? String(u) : "");
|
|
23377
|
-
let
|
|
23689
|
+
], l = s && typeof s == "object" && s.width != null ? Number(s.width) : 1.5, u = r && typeof r == "object" ? r.text : null, d = null, f = "sans-serif";
|
|
23690
|
+
typeof u == "object" && u && (d = this._styleColor(u.color), f = String(u.font ?? "sans-serif").replace(/["']/g, "") || "sans-serif", u = u.content), this._badgeFont.push(f), this._badgeNode.push(t), this._badgeAngle.push(e[n]), this._badgeScale.push(r && typeof r == "object" && r.scale != null ? Number(r.scale) : .45), this._badgePosScale.push(r && typeof r == "object" && r.positionScale != null ? Number(r.positionScale) : 1), this._badgeFill.push(o[0], o[1], o[2], o[3]), this._badgeStrokeCol.push(c[0], c[1], c[2], c[3]), this._badgeStrokeW.push(l), this._badgeText.push(u != null && u !== "" ? String(u) : "");
|
|
23691
|
+
let p = d || [
|
|
23378
23692
|
0,
|
|
23379
23693
|
0,
|
|
23380
23694
|
0,
|
|
23381
23695
|
1
|
|
23382
23696
|
];
|
|
23383
|
-
this._badgeTextCol.push(
|
|
23697
|
+
this._badgeTextCol.push(p[0], p[1], p[2], p[3]);
|
|
23384
23698
|
}
|
|
23385
23699
|
}
|
|
23386
|
-
let
|
|
23387
|
-
if (Array.isArray(
|
|
23388
|
-
this._pieOffset[t] = o.length / 4, this._pieCount[t] =
|
|
23389
|
-
for (let e of
|
|
23700
|
+
let F = this._pieData.get(n) ?? this._pieColors[t] ?? this._safeAttr(e, "pie");
|
|
23701
|
+
if (Array.isArray(F) && F.length > 0) {
|
|
23702
|
+
this._pieOffset[t] = o.length / 4, this._pieCount[t] = F.length;
|
|
23703
|
+
for (let e of F) {
|
|
23390
23704
|
let t = this._styleColor(typeof e == "string" ? e : e && e.color) || [
|
|
23391
23705
|
.5,
|
|
23392
23706
|
.5,
|
|
@@ -23404,8 +23718,8 @@ var dx = class e {
|
|
|
23404
23718
|
]);
|
|
23405
23719
|
let c = a.join("|");
|
|
23406
23720
|
c !== this._atlasKey && (this._atlasKey = c, a.length && this._loadAtlas(a));
|
|
23407
|
-
let l = e.getEdges(), u = [], d = [], f = [], p = [];
|
|
23408
|
-
l.forEach((e) => {
|
|
23721
|
+
let l = e.getEdges(), u = [], d = [], f = [], p = [], m = [], h = [];
|
|
23722
|
+
this._edgeLabel = [], this._edgeLabelFont = [], this._edgeLabelCol = [], this._edgeLabelSize = [], this._edgeLabelSec = [], this._edgeLabelSecFont = [], this._edgeLabelSecCol = [], this._edgeHaloCol = [], this._edgeHaloW = [], this._edgeOutlineCol = [], this._edgeOutlineW = [], l.forEach((e) => {
|
|
23409
23723
|
u.push(s[e.getSource().getId()], s[e.getTarget().getId()]);
|
|
23410
23724
|
let t = this._safeAttr(e, "color"), n = t ? this._toLinear(String(t)) : [
|
|
23411
23725
|
.55,
|
|
@@ -23416,25 +23730,73 @@ var dx = class e {
|
|
|
23416
23730
|
d.push(n[0], n[1], n[2], n[3]);
|
|
23417
23731
|
let r = Number(this._safeAttr(e, "width"));
|
|
23418
23732
|
f.push(r || 3), p.push(Number(this._safeAttr(e, "curvature")) || 0);
|
|
23419
|
-
|
|
23733
|
+
let i = (e) => {
|
|
23734
|
+
let t = e == null ? "none" : String(e);
|
|
23735
|
+
return t === "none" || t === "null" ? 0 : t === "square" ? 2 : t === "circle" ? 3 : t === "open-arrow" ? 4 : 1;
|
|
23736
|
+
}, a = this._safeAttr(e, "shape.head"), o = this._safeAttr(e, "shape.tail");
|
|
23737
|
+
m.push(i(a) | i(o) << 3);
|
|
23738
|
+
let c = this._safeAttr(e, "shape.style");
|
|
23739
|
+
h.push(c === "dashed" ? 1 : c === "dotted" ? 2 : 0);
|
|
23740
|
+
let l = null;
|
|
23741
|
+
try {
|
|
23742
|
+
l = e.getAttribute("text");
|
|
23743
|
+
} catch {}
|
|
23744
|
+
typeof l == "object" && l && (l = l.content), this._edgeLabel.push(l != null && l !== "" ? String(l) : "");
|
|
23745
|
+
let g = String(this._safeAttr(e, "text.font") ?? "sans-serif").replace(/["']/g, "") || "sans-serif", _ = String(this._safeAttr(e, "text.style") ?? "normal");
|
|
23746
|
+
this._edgeLabelFont.push((_ && _ !== "normal" ? _ + " " : "") + g);
|
|
23747
|
+
let v = this._styleColor(this._safeAttr(e, "text.color")) || [
|
|
23748
|
+
0,
|
|
23749
|
+
0,
|
|
23750
|
+
0,
|
|
23751
|
+
1
|
|
23752
|
+
];
|
|
23753
|
+
this._edgeLabelCol.push(v[0], v[1], v[2], v[3]);
|
|
23754
|
+
let y = Number(this._safeAttr(e, "text.size"));
|
|
23755
|
+
this._edgeLabelSize.push(isFinite(y) && y > 0 ? y : 0);
|
|
23756
|
+
let b = this._safeAttr(e, "text.secondary.content");
|
|
23757
|
+
this._edgeLabelSec.push(b != null && b !== "" ? String(b) : "");
|
|
23758
|
+
let x = String(this._safeAttr(e, "text.secondary.font") ?? g).replace(/["']/g, "") || "sans-serif", S = String(this._safeAttr(e, "text.secondary.style") ?? "normal");
|
|
23759
|
+
this._edgeLabelSecFont.push((S && S !== "normal" ? S + " " : "") + x);
|
|
23760
|
+
let C = this._styleColor(this._safeAttr(e, "text.secondary.color")) || [
|
|
23761
|
+
0,
|
|
23762
|
+
0,
|
|
23763
|
+
0,
|
|
23764
|
+
1
|
|
23765
|
+
];
|
|
23766
|
+
this._edgeLabelSecCol.push(C[0], C[1], C[2], C[3]);
|
|
23767
|
+
let w = this._styleColor(this._safeAttr(e, "halo"));
|
|
23768
|
+
w ? (this._edgeHaloCol.push(w[0], w[1], w[2], w[3]), this._edgeHaloW.push(Number(this._safeAttr(e, "halo.width")) || 8)) : (this._edgeHaloCol.push(0, 0, 0, 0), this._edgeHaloW.push(0));
|
|
23769
|
+
let T = this._safeAttr(e, "outline") ? this._styleColor(this._safeAttr(e, "outline.color")) : null;
|
|
23770
|
+
T ? (this._edgeOutlineCol.push(T[0], T[1], T[2], T[3]), this._edgeOutlineW.push(Number(this._safeAttr(e, "outline.width")) || 1)) : (this._edgeOutlineCol.push(0, 0, 0, 0), this._edgeOutlineW.push(0));
|
|
23771
|
+
}), this._edges = new Uint32Array(u), this._edgeColor = new Float32Array(d), this._edgeWidth = new Float32Array(f), this._edgeCurv = new Float32Array(p), this._edgeArrows = new Uint8Array(m), this._edgeDash = new Uint8Array(h);
|
|
23420
23772
|
}
|
|
23421
23773
|
_camera() {
|
|
23422
23774
|
let e = this._nodus.getNodes(), t = 1e9, n = 1e9, r = -1e9, i = -1e9;
|
|
23423
23775
|
if (e.forEach((e, a) => {
|
|
23424
23776
|
let o = e.getPosition();
|
|
23425
|
-
this._xs[a] = o.x, this._ys[a] = o.y
|
|
23777
|
+
this._xs[a] = o.x, this._ys[a] = o.y;
|
|
23778
|
+
let s = this._radii[a] || 0;
|
|
23779
|
+
o.x - s < t && (t = o.x - s), o.x + s > r && (r = o.x + s), o.y - s < n && (n = o.y - s), o.y + s > i && (i = o.y + s);
|
|
23426
23780
|
}), this._opts.camera === "follow") {
|
|
23427
23781
|
let e = this._nodus.modules?.camera;
|
|
23428
|
-
if (e?.setView &&
|
|
23429
|
-
let a = this._canvas.clientWidth || this._canvas.width, o = this._canvas.clientHeight || this._canvas.height, s = Math.max((r - t) / 2, 1), c = Math.max((i - n) / 2, 1), l = .85 * Math.min(a / (2 * s), o / (2 * c)), u = (t + r) / 2, d = (n + i) / 2;
|
|
23430
|
-
|
|
23431
|
-
|
|
23432
|
-
|
|
23433
|
-
|
|
23782
|
+
if (e?.setView && this._autoFrame && isFinite(t) && r > t) {
|
|
23783
|
+
let a = this._canvas.clientWidth || this._canvas.width, o = this._canvas.clientHeight || this._canvas.height, s = Math.max((r - t) / 2, 1), c = Math.max((i - n) / 2, 1), l = .85 * Math.min(a / (2 * s), o / (2 * c)), u = (t + r) / 2, d = (n + i) / 2, f = this._lastFit;
|
|
23784
|
+
if (!f || Math.abs(f.cx - u) > .001 || Math.abs(f.cy - d) > .001 || Math.abs(f.zoom - l) > 1e-6) {
|
|
23785
|
+
this._selfMovingCamera = !0;
|
|
23786
|
+
try {
|
|
23787
|
+
e.setView({
|
|
23788
|
+
x: u,
|
|
23789
|
+
y: d,
|
|
23790
|
+
zoom: l
|
|
23791
|
+
}, { duration: 0 });
|
|
23792
|
+
} catch {}
|
|
23793
|
+
this._selfMovingCamera = !1, this._lastFit = {
|
|
23794
|
+
cx: u,
|
|
23795
|
+
cy: d,
|
|
23434
23796
|
zoom: l
|
|
23435
|
-
}
|
|
23436
|
-
}
|
|
23437
|
-
return
|
|
23797
|
+
};
|
|
23798
|
+
}
|
|
23799
|
+
return {
|
|
23438
23800
|
cx: u,
|
|
23439
23801
|
cy: d,
|
|
23440
23802
|
zoom: l * this._dpr()
|
|
@@ -23461,60 +23823,148 @@ var dx = class e {
|
|
|
23461
23823
|
t && t.length ? this._pieData.set(e, t) : this._pieData.delete(e), this._styleVersion = null;
|
|
23462
23824
|
}
|
|
23463
23825
|
_buildNodeAttrs() {
|
|
23464
|
-
let e = this._radii.length, t = new Float32Array(e * 28), n = this._fill, r = this._stroke, i = this._sw, a = this._shape, o = this._highlight, s = this._haloW, c = this._haloCol, l = this._outline;
|
|
23465
|
-
for (let
|
|
23466
|
-
let e =
|
|
23467
|
-
t[e] = n[
|
|
23826
|
+
let e = this._radii.length, t = new Float32Array(e * 28), n = this._fill, r = this._stroke, i = this._sw, a = this._shape, o = this._highlight, s = this._haloW, c = this._haloCol, l = this._outline, u = this._outerW, d = this._outerCol, f = this._dpr();
|
|
23827
|
+
for (let p = 0; p < e; p++) {
|
|
23828
|
+
let e = p * 28, m = p * 4;
|
|
23829
|
+
t[e] = n[m], t[e + 1] = n[m + 1], t[e + 2] = n[m + 2], t[e + 3] = n[m + 3], t[e + 4] = a[p], t[e + 5] = this._imageTile[p], t[e + 6] = i[p] * f, t[e + 7] = s[p] * f, t[e + 8] = r[m], t[e + 9] = r[m + 1], t[e + 10] = r[m + 2], t[e + 11] = r[m + 3], t[e + 12] = c[m], t[e + 13] = c[m + 1], t[e + 14] = c[m + 2], t[e + 15] = c[m + 3], t[e + 16] = this._pieOffset[p], t[e + 17] = this._pieCount[p], t[e + 18] = this._swMinVis[p] * f, t[e + 24] = l[m], t[e + 25] = l[m + 1], t[e + 26] = l[m + 2], t[e + 27] = l[m + 3], u[p] > 0 ? (t[e + 19] = u[p] * f, t[e + 20] = d[m], t[e + 21] = d[m + 1], t[e + 22] = d[m + 2], t[e + 23] = d[m + 3]) : o.size && o.has(this._nodeIds[p]) && (t[e + 19] = 4, t[e + 20] = .18, t[e + 21] = .5, t[e + 22] = 1, t[e + 23] = 1);
|
|
23468
23830
|
}
|
|
23469
23831
|
return t;
|
|
23470
23832
|
}
|
|
23471
23833
|
_buildEdgeAttrs() {
|
|
23472
|
-
let e = this._edges.length / 2, t = new Uint32Array(e * 2), n = this._edgeColor, r = this._edgeWidth, i = this._edgeCurv, a = this._opts.arrows === "both" ? 3 :
|
|
23473
|
-
for (let
|
|
23474
|
-
let e =
|
|
23475
|
-
t[
|
|
23476
|
-
let
|
|
23477
|
-
|
|
23834
|
+
let e = this._edges.length / 2, t = new Uint32Array(e * 2), n = this._edgeColor, r = this._edgeWidth, i = this._edgeCurv, a = this._edgeArrows, o = this._edgeDash, s = this._opts.arrows === "both" ? 3 : this._opts.arrows === "target" ? 1 : -1, c = (e) => Math.round(Math.min(Math.max(e, 0), 1) * 255);
|
|
23835
|
+
for (let l = 0; l < e; l++) {
|
|
23836
|
+
let e = l * 4, u, d;
|
|
23837
|
+
s === 3 ? (u = 1, d = 1) : s === 1 ? (u = 1, d = 0) : (u = (a[l] || 0) & 7, d = (a[l] || 0) >> 3 & 7), t[l * 2] = (c(n[e]) | c(n[e + 1]) << 8 | c(n[e + 2]) << 16 | c(n[e + 3]) << 24) >>> 0;
|
|
23838
|
+
let f = Math.max(-128, Math.min(127, Math.round((i[l] || 0) * 64)));
|
|
23839
|
+
f < 0 && (f += 256), t[l * 2 + 1] = (Math.min(Math.round(r[l]), 16383) & 16383 | ((o[l] || 0) & 3) << 14 | (u & 7) << 16 | (d & 7) << 19 | 1 << 22 | f << 24) >>> 0;
|
|
23478
23840
|
}
|
|
23479
23841
|
return t;
|
|
23480
23842
|
}
|
|
23843
|
+
_buildEdgeHalos(e) {
|
|
23844
|
+
let t = [], n = [], r = (e) => Math.round(Math.min(Math.max(e, 0), 1) * 255), i = this._dpr(), a = this._edges.length / 2, o = (a, o, s) => {
|
|
23845
|
+
t.push(this._edges[o / 4 * 2], this._edges[o / 4 * 2 + 1]);
|
|
23846
|
+
let c = (r(a[o]) | r(a[o + 1]) << 8 | r(a[o + 2]) << 16 | r(a[o + 3]) << 24) >>> 0, l = Math.min(Math.round((this._edgeWidth[o / 4] || 3) * e + 2 * s * i), 16383) & 16383, u = Math.max(-128, Math.min(127, Math.round((this._edgeCurv[o / 4] || 0) * 64)));
|
|
23847
|
+
u < 0 && (u += 256), n.push(c, (l | u << 24) >>> 0);
|
|
23848
|
+
};
|
|
23849
|
+
for (let e = 0; e < a; e++) this._edgeHaloW[e] && o(this._edgeHaloCol, e * 4, this._edgeHaloW[e]);
|
|
23850
|
+
for (let e = 0; e < a; e++) this._edgeOutlineW[e] && o(this._edgeOutlineCol, e * 4, this._edgeOutlineW[e]);
|
|
23851
|
+
return {
|
|
23852
|
+
edges: t,
|
|
23853
|
+
attrs: n,
|
|
23854
|
+
n: t.length / 2
|
|
23855
|
+
};
|
|
23856
|
+
}
|
|
23857
|
+
_buildPulseRings(e) {
|
|
23858
|
+
let t = [], n = [], r = [], i = [];
|
|
23859
|
+
for (let a of this._pulses) {
|
|
23860
|
+
let o = this._radii[a.i], s = this._xs[a.i], c = this._ys[a.i], l = o * a.sr, u = o * a.er, d = Math.floor(e / a.iv), f = Math.ceil((e - a.du) / a.iv);
|
|
23861
|
+
for (let o = f; o <= d; o++) {
|
|
23862
|
+
let d = (e - o * a.iv) / a.du;
|
|
23863
|
+
if (d < 0 || d > 1) continue;
|
|
23864
|
+
let f = l + (u - l) * d, p = 1 - d, m = a.sc[0] * p + a.ec[0] * d, h = a.sc[1] * p + a.ec[1] * d, g = a.sc[2] * p + a.ec[2] * d, _ = a.sc[3] * p + a.ec[3] * d;
|
|
23865
|
+
t.push(s), n.push(c), r.push(f);
|
|
23866
|
+
let v = i.length;
|
|
23867
|
+
for (let e = 0; e < 28; e++) i.push(0);
|
|
23868
|
+
i[v + 6] = a.w, i[v + 8] = m, i[v + 9] = h, i[v + 10] = g, i[v + 11] = _;
|
|
23869
|
+
}
|
|
23870
|
+
}
|
|
23871
|
+
return {
|
|
23872
|
+
xs: new Float32Array(t),
|
|
23873
|
+
ys: new Float32Array(n),
|
|
23874
|
+
radii: new Float32Array(r),
|
|
23875
|
+
attrs: new Float32Array(i),
|
|
23876
|
+
n: r.length
|
|
23877
|
+
};
|
|
23878
|
+
}
|
|
23481
23879
|
renderFrame() {
|
|
23482
23880
|
if (!this._wasm) return;
|
|
23483
|
-
this._rebuildStyle();
|
|
23881
|
+
this._syncCanvasSize(), this._rebuildStyle();
|
|
23484
23882
|
let e = this._camera();
|
|
23485
23883
|
this._lastCam = e;
|
|
23486
|
-
let t =
|
|
23487
|
-
|
|
23488
|
-
let
|
|
23489
|
-
|
|
23490
|
-
|
|
23491
|
-
|
|
23492
|
-
|
|
23493
|
-
|
|
23494
|
-
|
|
23495
|
-
|
|
23884
|
+
let t = 0;
|
|
23885
|
+
for (let e = 0; e < this._icons.length; e++) {
|
|
23886
|
+
let n = this._icons[e];
|
|
23887
|
+
n && n.ch && (t = Math.max(t, (n.scale || .7) * this._radii[e] * 2));
|
|
23888
|
+
}
|
|
23889
|
+
let n = this._fontPx;
|
|
23890
|
+
for (let e = 0; e < this._labelSize.length; e++) this._labelSize[e] > n && (n = this._labelSize[e]);
|
|
23891
|
+
for (let e = 0; e < this._edgeLabelSize.length; e++) this._edgeLabelSize[e] > n && (n = this._edgeLabelSize[e]);
|
|
23892
|
+
this._targetAtlasPx = Math.max(n * this._dpr(), t * e.zoom), this._buildAtlas();
|
|
23893
|
+
let r = this._buildText(e.zoom), i = this._xs, a = this._ys, o = this._radii, s = this._buildNodeAttrs(), c = this._buildEdgeAttrs(), l = this._badgeNode.length;
|
|
23894
|
+
if (l) {
|
|
23895
|
+
let e = this._radii.length, t = new Float32Array(e + l);
|
|
23896
|
+
t.set(i);
|
|
23897
|
+
let n = new Float32Array(e + l);
|
|
23898
|
+
n.set(a);
|
|
23899
|
+
let c = new Float32Array(e + l);
|
|
23900
|
+
c.set(o);
|
|
23901
|
+
let u = new Float32Array((e + l) * 28);
|
|
23902
|
+
u.set(s);
|
|
23496
23903
|
let d = [];
|
|
23497
|
-
for (let
|
|
23498
|
-
let
|
|
23499
|
-
|
|
23500
|
-
let g = h * 28, _ =
|
|
23501
|
-
u[g] = this._badgeFill[_], u[g + 1] = this._badgeFill[_ + 1], u[g + 2] = this._badgeFill[_ + 2], u[g + 3] = this._badgeFill[_ + 3], u[g + 4] = 0, u[g + 6] = this._badgeStrokeW[
|
|
23502
|
-
let v = this._badgeText[
|
|
23904
|
+
for (let r = 0; r < l; r++) {
|
|
23905
|
+
let o = this._badgeNode[r], s = this._radii[o], l = 2 * s * this._badgePosScale[r] / 2, f = i[o] + Math.cos(this._badgeAngle[r]) * l, p = a[o] + Math.sin(this._badgeAngle[r]) * l, m = s * this._badgeScale[r], h = e + r;
|
|
23906
|
+
t[h] = f, n[h] = p, c[h] = m;
|
|
23907
|
+
let g = h * 28, _ = r * 4;
|
|
23908
|
+
u[g] = this._badgeFill[_], u[g + 1] = this._badgeFill[_ + 1], u[g + 2] = this._badgeFill[_ + 2], u[g + 3] = this._badgeFill[_ + 3], u[g + 4] = 0, u[g + 6] = this._badgeStrokeW[r], u[g + 8] = this._badgeStrokeCol[_], u[g + 9] = this._badgeStrokeCol[_ + 1], u[g + 10] = this._badgeStrokeCol[_ + 2], u[g + 11] = this._badgeStrokeCol[_ + 3];
|
|
23909
|
+
let v = this._badgeText[r];
|
|
23503
23910
|
if (v && this._glyphs) {
|
|
23504
|
-
let e =
|
|
23505
|
-
for (let
|
|
23506
|
-
|
|
23507
|
-
|
|
23911
|
+
let e = this._badgeFont[r] || "sans-serif", t = m * 1.3, n = t * this._quadScale, i = 0;
|
|
23912
|
+
for (let t of v) i += this._glyphs[e + " " + t]?.adv ?? .6;
|
|
23913
|
+
let a = f - i * t / 2;
|
|
23914
|
+
for (let r of v) {
|
|
23915
|
+
let i = this._glyphs[e + " " + r], o = (i?.adv ?? .6) * t;
|
|
23916
|
+
i && (d.push(a + o / 2 - n / 2, p - n / 2, n, n), d.push(this._badgeTextCol[_], this._badgeTextCol[_ + 1], this._badgeTextCol[_ + 2], this._badgeTextCol[_ + 3]), d.push(i.u0, i.v0, i.u1, i.v1), d.push(this._badgeTextCol[_], this._badgeTextCol[_ + 1], this._badgeTextCol[_ + 2], this._badgeTextCol[_ + 3]), d.push(1, 0, 0, 0)), a += o;
|
|
23508
23917
|
}
|
|
23509
23918
|
}
|
|
23510
23919
|
}
|
|
23511
23920
|
if (d.length) {
|
|
23512
|
-
let e = new Float32Array(
|
|
23513
|
-
e.set(
|
|
23921
|
+
let e = new Float32Array(r.length + d.length);
|
|
23922
|
+
e.set(r), e.set(d, r.length), r = e;
|
|
23514
23923
|
}
|
|
23515
|
-
|
|
23924
|
+
i = t, a = n, o = c, s = u;
|
|
23516
23925
|
}
|
|
23517
|
-
|
|
23926
|
+
let u = null;
|
|
23927
|
+
for (let e = 0; e < this._layer.length; e++) this._layer[e] > 0 && (u ||= []).push(e);
|
|
23928
|
+
if (u) {
|
|
23929
|
+
u.sort((e, t) => this._layer[e] - this._layer[t]);
|
|
23930
|
+
let e = i.length, t = u.length, n = new Float32Array(e + t);
|
|
23931
|
+
n.set(i);
|
|
23932
|
+
let r = new Float32Array(e + t);
|
|
23933
|
+
r.set(a);
|
|
23934
|
+
let c = new Float32Array(e + t);
|
|
23935
|
+
c.set(o);
|
|
23936
|
+
let l = new Float32Array((e + t) * 28);
|
|
23937
|
+
l.set(s);
|
|
23938
|
+
for (let i = 0; i < t; i++) {
|
|
23939
|
+
let t = u[i], a = e + i;
|
|
23940
|
+
n[a] = this._xs[t], r[a] = this._ys[t], c[a] = this._radii[t];
|
|
23941
|
+
let o = t * 28, d = a * 28;
|
|
23942
|
+
for (let e = 0; e < 28; e++) l[d + e] = s[o + e];
|
|
23943
|
+
}
|
|
23944
|
+
i = n, a = r, o = c, s = l;
|
|
23945
|
+
}
|
|
23946
|
+
let d = this._edges, f = c, p = this._buildEdgeHalos(e.zoom);
|
|
23947
|
+
if (p.n) {
|
|
23948
|
+
let e = new Uint32Array(p.edges), t = new Uint32Array(p.attrs), n = new Uint32Array(e.length + d.length);
|
|
23949
|
+
n.set(e), n.set(d, e.length);
|
|
23950
|
+
let r = new Uint32Array(t.length + f.length);
|
|
23951
|
+
r.set(t), r.set(f, t.length), d = n, f = r;
|
|
23952
|
+
}
|
|
23953
|
+
let m = this._pulses.length ? this._buildPulseRings(typeof performance < "u" ? performance.now() : Date.now()) : null;
|
|
23954
|
+
if (m && m.n) {
|
|
23955
|
+
let e = i.length, t = m.n, n = new Float32Array(t + e);
|
|
23956
|
+
n.set(m.xs), n.set(i, t);
|
|
23957
|
+
let r = new Float32Array(t + e);
|
|
23958
|
+
r.set(m.ys), r.set(a, t);
|
|
23959
|
+
let c = new Float32Array(t + e);
|
|
23960
|
+
c.set(m.radii), c.set(o, t);
|
|
23961
|
+
let l = new Float32Array((t + e) * 28);
|
|
23962
|
+
l.set(m.attrs), l.set(s, t * 28), i = n, a = r, o = c, s = l;
|
|
23963
|
+
let u = new Uint32Array(d.length);
|
|
23964
|
+
for (let e = 0; e < d.length; e++) u[e] = d[e] + t;
|
|
23965
|
+
d = u;
|
|
23966
|
+
}
|
|
23967
|
+
this._wasm.render_attrs(i, a, o, s, d, f, this._pieSegs, r, e.cx, e.cy, e.zoom);
|
|
23518
23968
|
}
|
|
23519
23969
|
pick(e, t) {
|
|
23520
23970
|
let n = this._dpr(), { cx: r, cy: i, zoom: a } = this._lastCam, o = (e * n - this._canvas.width / 2) / a + r, s = (t * n - this._canvas.height / 2) / a + i, c = -1, l = Infinity;
|
|
@@ -27587,10 +28037,10 @@ function zD(e, t, n, r, i, a) {
|
|
|
27587
28037
|
BD(e, t, n, r, i, a), VD(e, t.badge, n.badge, r), HD(e, t.texts.primary, n.text, r, t), HD(e, t.texts.secondary, n.text.secondary, r, t);
|
|
27588
28038
|
}
|
|
27589
28039
|
function BD(e, t, n, r, i, a) {
|
|
27590
|
-
let o = i.source, s = i.target, c = n.source.get(r), l = n.target.get(r), u = o.x.get(c), d = o.y.get(c), f = o.radius.get(c), p = o.innerStroke.width.get(c), m = Number(o.innerStroke.color.get(c) !== null), h = +(o.innerStroke.scalingMethod.get(c) === "scaled"), g = o.outerStroke.width.get(c), _ = Number(o.outerStroke.color.get(c) !== null), v = +(o.outerStroke.scalingMethod.get(c) === "scaled"), y = o.color.get(c), b = +(o.scalingMethod.get(c) === "scaled"), x = s.x.get(l), S = s.y.get(l), C = s.radius.get(l), w = s.innerStroke.width.get(l), T = Number(s.innerStroke.color.get(l) !== null), E = +(s.innerStroke.scalingMethod.get(l) === "scaled"), D = s.outerStroke.width.get(l), O = Number(s.outerStroke.color.get(l) !== null), k = +(s.outerStroke.scalingMethod.get(l) === "scaled"), A = s.color.get(l), j = +(s.scalingMethod.get(l) === "scaled"), M = DE(n.color.get(r), y, A), N = n.width.get(r),
|
|
27591
|
-
t.source = c, t.target = l, t.sourceX = u, t.sourceY = d, t.targetX = x, t.targetY = S, t.sourceRadiusScaled = p * m * h + g * _ * v + f * b, t.sourceRadiusFixed = p * m * (1 - h) + g * _ * (1 - v) + f * (1 - b), t.targetRadiusScaled = w * T * E + D * O * k + C * j, t.targetRadiusFixed = w * T * (1 - E) + D * O * (1 - k) + C * (1 - j), t.widthScaled = N *
|
|
28040
|
+
let o = i.source, s = i.target, c = n.source.get(r), l = n.target.get(r), u = o.x.get(c), d = o.y.get(c), f = o.radius.get(c), p = o.innerStroke.width.get(c), m = Number(o.innerStroke.color.get(c) !== null), h = +(o.innerStroke.scalingMethod.get(c) === "scaled"), g = o.outerStroke.width.get(c), _ = Number(o.outerStroke.color.get(c) !== null), v = +(o.outerStroke.scalingMethod.get(c) === "scaled"), y = o.color.get(c), b = +(o.scalingMethod.get(c) === "scaled"), x = s.x.get(l), S = s.y.get(l), C = s.radius.get(l), w = s.innerStroke.width.get(l), T = Number(s.innerStroke.color.get(l) !== null), E = +(s.innerStroke.scalingMethod.get(l) === "scaled"), D = s.outerStroke.width.get(l), O = Number(s.outerStroke.color.get(l) !== null), k = +(s.outerStroke.scalingMethod.get(l) === "scaled"), A = s.color.get(l), j = +(s.scalingMethod.get(l) === "scaled"), M = DE(n.color.get(r), y, A), N = n.width.get(r), P = +(n.scalingMethod.get(r) === "scaled"), F = n.stroke.width.get(r), ee = +(n.stroke.scalingMethod.get(r) === "scaled"), I = Cy[n.shape.style.get(r)], L = n.adjustAnchors.get(r);
|
|
28041
|
+
t.source = c, t.target = l, t.sourceX = u, t.sourceY = d, t.targetX = x, t.targetY = S, t.sourceRadiusScaled = p * m * h + g * _ * v + f * b, t.sourceRadiusFixed = p * m * (1 - h) + g * _ * (1 - v) + f * (1 - b), t.targetRadiusScaled = w * T * E + D * O * k + C * j, t.targetRadiusFixed = w * T * (1 - E) + D * O * (1 - k) + C * (1 - j), t.widthScaled = N * P, t.widthFixed = N * (1 - P), t.curvature = n.curvature.get(r), t.isSelfLoop = c === l, t.color = M, t.opacity = n.opacity.get(r), t.minVisibleSize = n.minVisibleSize.get(r), t.shape.body = n.shape.body.get(r), t.shape.head = n.shape.head.get(r), t.shape.tail = n.shape.tail.get(r), t.shape.dashLength = I.dash, t.shape.gapLength = I.gap, t.shape.isBodyTriangle = t.shape.body === "triangle";
|
|
27592
28042
|
let R = t.shape.head === ME, te = t.shape.tail === ME;
|
|
27593
|
-
if (t.shape.body = R && te ? IE : R ? PE : te ? NE : FE, t.stroke.color = EE(n.stroke.color.get(r), M), t.stroke.widthScaled =
|
|
28043
|
+
if (t.shape.body = R && te ? IE : R ? PE : te ? NE : FE, t.stroke.color = EE(n.stroke.color.get(r), M), t.stroke.widthScaled = F * ee, t.stroke.widthFixed = F * (1 - ee), t.stroke.minVisibleSize = n.stroke.minVisibleSize.get(r), t.halo.color = n.halo.color.get(r), t.outline.enabled = n.outline.enabled.get(r), t.textHidden = n.textHidden.get(r) === 1, L && (t.shape.head || t.shape.tail || t.shape.body === "triangle")) {
|
|
27594
28044
|
let e = t.curvature, n = t.sourceX, r = t.sourceY, i = t.targetX, u = t.targetY, d = 1, f = 1;
|
|
27595
28045
|
if (e) {
|
|
27596
28046
|
if (!t.isSelfLoop) {
|
|
@@ -28462,8 +28912,8 @@ function OO(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
28462
28912
|
if (!n) continue;
|
|
28463
28913
|
let r = d(h.text.content.get(m) || null), i = h.textHidden.get(m), a = h.text.minVisibleSize.get(m), o = E ? 2 * D : Infinity;
|
|
28464
28914
|
if (i || !r || o < a) continue;
|
|
28465
|
-
let s = kE(r, h.text.maxLineLength.get(m)), c = h.innerStroke.width.get(m), u = h.text.margin.get(m), f = h.text.padding.get(m), p = h.text.size.get(m), g = h.text.scale.get(m), _ = h.text.scaling.get(m), v = h.text.font.get(m), y = h.text.style.get(m), b = h.text.position.get(m), x = l.measureText(s, v, y, 1), S = _ ? g * D * 2 : p, T = x.width * S / 2 + f, O = x.height * S / 2 + f, k = wO[b], A = c + u + D, j = C + (A + T) * k.x, M = w + (A + O) * k.y, N = j + T,
|
|
28466
|
-
if (e <= j - T || e >= N || t <=
|
|
28915
|
+
let s = kE(r, h.text.maxLineLength.get(m)), c = h.innerStroke.width.get(m), u = h.text.margin.get(m), f = h.text.padding.get(m), p = h.text.size.get(m), g = h.text.scale.get(m), _ = h.text.scaling.get(m), v = h.text.font.get(m), y = h.text.style.get(m), b = h.text.position.get(m), x = l.measureText(s, v, y, 1), S = _ ? g * D * 2 : p, T = x.width * S / 2 + f, O = x.height * S / 2 + f, k = wO[b], A = c + u + D, j = C + (A + T) * k.x, M = w + (A + O) * k.y, N = j + T, P = M - O, F = M + O;
|
|
28916
|
+
if (e <= j - T || e >= N || t <= P || t >= F) continue;
|
|
28467
28917
|
}
|
|
28468
28918
|
_ = m, v = x;
|
|
28469
28919
|
}
|
|
@@ -28796,7 +29246,7 @@ var AO = class extends z {
|
|
|
28796
29246
|
return this._attributesManager.getAnimationInformation(e);
|
|
28797
29247
|
}
|
|
28798
29248
|
_toSubGraph(e) {
|
|
28799
|
-
if (e instanceof
|
|
29249
|
+
if (e instanceof F || e instanceof m) return {
|
|
28800
29250
|
nodes: e.toList(),
|
|
28801
29251
|
edges: e.getAdjacentEdges()
|
|
28802
29252
|
};
|
|
@@ -32536,7 +32986,7 @@ var Gj = class extends V {
|
|
|
32536
32986
|
return this._nodus.modules.lasso.disable();
|
|
32537
32987
|
}
|
|
32538
32988
|
enabled() {
|
|
32539
|
-
return this._nodus.modules.lasso.
|
|
32989
|
+
return this._nodus.modules.lasso.enabled();
|
|
32540
32990
|
}
|
|
32541
32991
|
}, Xj = class extends V {
|
|
32542
32992
|
enable(e) {
|
|
@@ -32546,7 +32996,7 @@ var Gj = class extends V {
|
|
|
32546
32996
|
return this._nodus.modules.connectNodes.disable();
|
|
32547
32997
|
}
|
|
32548
32998
|
enabled() {
|
|
32549
|
-
return this._nodus.modules.connectNodes.
|
|
32999
|
+
return this._nodus.modules.connectNodes.enabled();
|
|
32550
33000
|
}
|
|
32551
33001
|
}, Zj = class extends V {
|
|
32552
33002
|
enable(e) {
|
|
@@ -32556,7 +33006,7 @@ var Gj = class extends V {
|
|
|
32556
33006
|
return this._nodus.modules.rectangleSelect.disable();
|
|
32557
33007
|
}
|
|
32558
33008
|
enabled() {
|
|
32559
|
-
return this._nodus.modules.rectangleSelect.
|
|
33009
|
+
return this._nodus.modules.rectangleSelect.enabled();
|
|
32560
33010
|
}
|
|
32561
33011
|
}, Qj = class extends V {
|
|
32562
33012
|
enable(e) {
|
|
@@ -32566,7 +33016,7 @@ var Gj = class extends V {
|
|
|
32566
33016
|
return this._nodus.modules.resizing.disable();
|
|
32567
33017
|
}
|
|
32568
33018
|
enabled() {
|
|
32569
|
-
return this._nodus.modules.resizing.
|
|
33019
|
+
return this._nodus.modules.resizing.enabled();
|
|
32570
33020
|
}
|
|
32571
33021
|
}, $j = class extends V {
|
|
32572
33022
|
enable(e) {
|
|
@@ -32579,7 +33029,7 @@ var Gj = class extends V {
|
|
|
32579
33029
|
return this._nodus.modules.rewiring.disable();
|
|
32580
33030
|
}
|
|
32581
33031
|
enabled() {
|
|
32582
|
-
return this._nodus.modules.rewiring.
|
|
33032
|
+
return this._nodus.modules.rewiring.enabled();
|
|
32583
33033
|
}
|
|
32584
33034
|
}, eM = class extends V {
|
|
32585
33035
|
enable(e) {
|
|
@@ -32589,7 +33039,7 @@ var Gj = class extends V {
|
|
|
32589
33039
|
return this._nodus.modules.snapping.disable();
|
|
32590
33040
|
}
|
|
32591
33041
|
enabled() {
|
|
32592
|
-
return this._nodus.modules.snapping.
|
|
33042
|
+
return this._nodus.modules.snapping.enabled();
|
|
32593
33043
|
}
|
|
32594
33044
|
}, tM = class extends V {
|
|
32595
33045
|
onNodeHover(e, t) {
|
|
@@ -33031,7 +33481,7 @@ function vM(e, t, n, r, i) {
|
|
|
33031
33481
|
return yM(e, t, n, !1, r, i);
|
|
33032
33482
|
}
|
|
33033
33483
|
async function yM(e, t, n, r, i, a = {}) {
|
|
33034
|
-
!Array.isArray(i) && !(i instanceof (r ?
|
|
33484
|
+
!Array.isArray(i) && !(i instanceof (r ? F : de)) && (i = [i]);
|
|
33035
33485
|
let { virtual: o = !1 } = a;
|
|
33036
33486
|
!o && t.isRefreshing() && await new Promise((e) => {
|
|
33037
33487
|
n.once("idle", e);
|
|
@@ -33536,7 +33986,7 @@ var BM = [
|
|
|
33536
33986
|
static algorithms = tA;
|
|
33537
33987
|
static utils = R_;
|
|
33538
33988
|
constructor(e = {}) {
|
|
33539
|
-
this.node = (e) => new m(e, this), this.edge = (e) => new b(e, this), this.nodeList = (e) => new
|
|
33989
|
+
this.node = (e) => new m(e, this), this.edge = (e) => new b(e, this), this.nodeList = (e) => new F(e || new Uint32Array(), this), this.edgeList = (e) => new de(e || new Uint32Array(), this), this._onReady = [], this.build = VM, this._init(e);
|
|
33540
33990
|
}
|
|
33541
33991
|
_init(e) {
|
|
33542
33992
|
this._initParameters = e, this._debug = !!e.debug, this._token = HM++, this.modules = new jO(this, e), this.styles = new qr(this), this.algorithms = new oA(this), this.export = new fA(this), this.keyboard = new pA(this), this.generate = new kA(this), this.layouts = new Gj(this), this.transformations = new Kj(this), this.tools = new nM(this), this.view = new rM(this), this.mouse = new iM(this), this.events = new aM(this), this.schema = new oM(this), this.rules = new sM(this), this.geo = new cM(this), this.layers = new lM(this), this.hypergraph = new uM(this), this.debug = new dM(this), this._onReady.forEach((e) => e(this)), this.safelyBindToInstance(), this.modules.events.register(["destroy"]), this.build = {
|
|
@@ -33574,4 +34024,4 @@ zM(UM, BM);
|
|
|
33574
34024
|
//#region src/index.ts
|
|
33575
34025
|
var WM = () => typeof navigator < "u" && !!navigator.gpu;
|
|
33576
34026
|
//#endregion
|
|
33577
|
-
export { An as BoundingBox, b as Edge, de as EdgeList, m as Node,
|
|
34027
|
+
export { An as BoundingBox, b as Edge, de as EdgeList, m as Node, F as NodeList, UM as Nodus, UM as default, Xa as NonObjectPropertyWatcher, Za as ObjectPropertyWatcher, Yr as StyleClass, Jr as StyleRule, X_ as Transformation, dx as WasmGraphRenderer, fx as WasmRendererAdapter, Wj as concentricFactory, i as configureBackends, f as enableWasmBackend, Dh as forceFactory, LA as forceLinkFactory, jn as geometry, HA as gridFactory, jj as hierarchicalFactory, Gl as hypergraph, WM as isWebGpuSupported, TM as parse, Bj as radialFactory, Nj as sequentialFactory, a as useWasm };
|