@popcorn245/cornfield-components 0.51.8 → 0.52.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/README.md +1 -1
- package/dist/chunks/around-BFqYTZ0K.js +78 -0
- package/dist/chunks/corn-layers-Cni5rISZ.js +275 -0
- package/dist/chunks/{corn-map-M7xt4MYk.js → corn-map-B2-YxiEL.js} +8 -5
- package/dist/chunks/corn-node-panel-BkvJThlp.js +42 -0
- package/dist/chunks/{corn-review-yQU3IpY5.js → corn-review-5wf7AT4o.js} +1047 -2564
- package/dist/chunks/corn-search-CXs5d06S.js +484 -0
- package/dist/chunks/{engine-ClfnAsgM.js → engine-BmXtSISH.js} +3691 -3577
- package/dist/chunks/layers-Bj4Tluxe.js +191 -0
- package/dist/chunks/{map-LS9aQk6z.js → map-BZRFOYkt.js} +803 -751
- package/dist/chunks/node-panel-BdvFvWCE.js +1291 -0
- package/dist/chunks/{review-source-CPiFTfyc.js → review-source-CK5tYIqk.js} +1 -1
- package/dist/chunks/{scope-Dg_uzefP.js → scope-CqPbHcKL.js} +24 -23
- package/dist/chunks/sheets-D-sMZzSs.js +204 -0
- package/dist/chunks/source-address-C70zNPIj.js +79 -0
- package/dist/chunks/{status-CYQD5PwL.js → status-DI5QLlAp.js} +78 -77
- package/dist/corn-layers.js +1 -0
- package/dist/corn-map.js +1 -1
- package/dist/corn-node-panel.js +1 -0
- package/dist/corn-review.js +1 -1
- package/dist/corn-scope.js +3 -3
- package/dist/corn-search.js +1 -0
- package/dist/index.js +8 -5
- package/dist/manifest.json +101 -36
- package/dist/tokens.css +8 -2
- package/dist/types/components.d.ts +90 -0
- package/dist/types/corn-layers.d.ts +2 -0
- package/dist/types/corn-node-panel.d.ts +2 -0
- package/dist/types/corn-search.d.ts +2 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/version.json +1 -1
- package/package.json +14 -2
- package/dist/chunks/source-address-B7hYRgt8.js +0 -251
|
@@ -1,154 +1,174 @@
|
|
|
1
|
-
import { $ as e,
|
|
2
|
-
var
|
|
3
|
-
function
|
|
1
|
+
import { $t as e, C as t, Cn as n, D as r, Dn as i, En as a, G as o, Gt as s, H as c, J as l, K as u, Kt as d, M as f, Mn as p, Mt as m, Nt as h, Pt as g, Qt as _, Sn as v, T as y, Tt as b, U as x, Wt as S, X as C, Xt as w, Y as T, Yt as E, Z as D, Zt as O, _ as k, _n as A, b as j, c as M, d as N, en as P, et as ee, f as F, g as I, i as L, it as R, j as z, k as B, l as te, ln as ne, m as V, n as H, nn as U, p as W, q as re, r as G, rn as ie, tn as K, u as ae, v as q, vn as oe, w as se, wn as ce, x as J } from "./engine-BmXtSISH.js";
|
|
2
|
+
var le = 96, ue = "letters:", de = (e) => `${ue}${e}`, fe = (e) => typeof e == "string" && e.startsWith(ue), pe = (e) => e.slice(8), me = (e, t) => !!e.letters && !e.icon && e.r * 2 * t >= 14, he = /* @__PURE__ */ new Map();
|
|
3
|
+
function ge(e, t = null) {
|
|
4
4
|
if (typeof e != "string" || !e) return null;
|
|
5
5
|
let n = `${typeof t == "string" ? t : ""}|${e}`;
|
|
6
|
-
if (
|
|
7
|
-
if (
|
|
6
|
+
if (he.has(n)) return he.get(n);
|
|
7
|
+
if (he.size >= 128) return null;
|
|
8
8
|
let r = null;
|
|
9
9
|
try {
|
|
10
|
-
let n = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(
|
|
11
|
-
width:
|
|
12
|
-
height:
|
|
10
|
+
let n = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(le, le) : typeof document < "u" ? Object.assign(document.createElement("canvas"), {
|
|
11
|
+
width: le,
|
|
12
|
+
height: le
|
|
13
13
|
}) : null, i = n && n.getContext && n.getContext("2d");
|
|
14
14
|
if (i && i.fillText) {
|
|
15
|
-
i.font = `700 ${e.length > 1 ? 56 : 72}px ${
|
|
16
|
-
let a = typeof t == "string" ? t :
|
|
17
|
-
i.strokeStyle =
|
|
15
|
+
i.font = `700 ${e.length > 1 ? 56 : 72}px ${I}`, i.textAlign = "center", i.textBaseline = "middle", i.lineJoin = "round", i.lineWidth = 10;
|
|
16
|
+
let a = typeof t == "string" ? t : x;
|
|
17
|
+
i.strokeStyle = T(a) === "#ffffff" ? "rgba(11, 18, 32, 0.92)" : "rgba(255, 255, 255, 0.92)", i.strokeText(e, le / 2, 51), i.fillStyle = a, i.fillText(e, le / 2, 51), r = n;
|
|
18
18
|
}
|
|
19
19
|
} catch {
|
|
20
20
|
r = null;
|
|
21
21
|
}
|
|
22
|
-
return
|
|
22
|
+
return he.set(n, r), r;
|
|
23
23
|
}
|
|
24
24
|
// ../explorer/renderer-canvas2d.js
|
|
25
|
-
var
|
|
26
|
-
|
|
25
|
+
var _e = Math.PI * 2, ve = 1.5, ye = /* @__PURE__ */ new Map();
|
|
26
|
+
function be(e) {
|
|
27
|
+
let t = ye.get(e);
|
|
28
|
+
return t === void 0 && (ye.size > 512 && ye.clear(), t = R(e)[3], ye.set(e, t)), t;
|
|
29
|
+
}
|
|
30
|
+
var Y = (e, t, n, r) => {
|
|
31
|
+
e.beginPath(), e.arc(t, n, r, 0, _e);
|
|
27
32
|
};
|
|
28
|
-
function
|
|
33
|
+
function xe(e, t, n, r, i, a = !1) {
|
|
34
|
+
let o = () => {
|
|
35
|
+
a || e.beginPath();
|
|
36
|
+
};
|
|
29
37
|
if (t === "rounded-square" || t === "square") {
|
|
30
|
-
let a = i * (t === "square" ?
|
|
31
|
-
|
|
38
|
+
let a = i * (t === "square" ? J.squareHalf : J.roundedHalf), s = i * (t === "square" ? J.squareCorner : J.roundedCorner);
|
|
39
|
+
o(), e.roundRect ? e.roundRect(n - a, r - a, a * 2, a * 2, s) : e.rect(n - a, r - a, a * 2, a * 2);
|
|
32
40
|
} else if (t === "hexagon") {
|
|
33
|
-
let t = i *
|
|
34
|
-
|
|
41
|
+
let t = i * J.hexInradius / Math.cos(Math.PI / 6);
|
|
42
|
+
o();
|
|
35
43
|
for (let i = 0; i < 6; i++) {
|
|
36
44
|
let a = Math.PI / 6 + i * Math.PI / 3, o = n + t * Math.cos(a), s = r + t * Math.sin(a);
|
|
37
45
|
i ? e.lineTo(o, s) : e.moveTo(o, s);
|
|
38
46
|
}
|
|
39
47
|
e.closePath();
|
|
40
48
|
} else if (t === "diamond") {
|
|
41
|
-
let t = i *
|
|
42
|
-
|
|
43
|
-
} else
|
|
49
|
+
let t = i * J.diamondHalf;
|
|
50
|
+
o(), e.moveTo(n, r - t), e.lineTo(n + t, r), e.lineTo(n, r + t), e.lineTo(n - t, r), e.closePath();
|
|
51
|
+
} else a ? (e.moveTo(n + i, r), e.arc(n, r, i, 0, _e)) : Y(e, n, r, i);
|
|
44
52
|
}
|
|
45
|
-
function
|
|
53
|
+
function Se(e, t, n, r, i) {
|
|
46
54
|
let a = -n.x / n.zoom - t.margin, o = (r - n.x) / n.zoom + t.margin, s = -n.y / n.zoom - t.margin, c = (i - n.y) / n.zoom + t.margin;
|
|
47
55
|
e.beginPath(), e.strokeStyle = t.color, e.lineWidth = t.width;
|
|
48
56
|
for (let n = Math.floor(a / t.size) * t.size; n < o; n += t.size) e.moveTo(n, s), e.lineTo(n, c);
|
|
49
57
|
for (let n = Math.floor(s / t.size) * t.size; n < c; n += t.size) e.moveTo(a, n), e.lineTo(o, n);
|
|
50
58
|
e.stroke();
|
|
51
59
|
}
|
|
52
|
-
function
|
|
60
|
+
function Ce(e, t) {
|
|
53
61
|
e.save(), t.forEach((t) => {
|
|
54
|
-
e.lineWidth = t.width, e.setLineDash(t.dash), e.strokeStyle = t.color,
|
|
62
|
+
e.lineWidth = t.width, e.setLineDash(t.dash), e.strokeStyle = t.color, Y(e, t.x, t.y, t.r), e.stroke();
|
|
55
63
|
}), e.restore();
|
|
56
64
|
}
|
|
57
|
-
function
|
|
65
|
+
function we(e, t) {
|
|
58
66
|
e.save(), t.forEach((t) => {
|
|
59
67
|
e.fillStyle = t.fill, e.strokeStyle = t.stroke, e.lineWidth = t.strokeWidth, e.beginPath(), e.roundRect(t.x, t.y, t.w, t.h, t.radius), e.fill(), e.stroke();
|
|
60
68
|
}), e.restore();
|
|
61
69
|
}
|
|
62
|
-
function
|
|
63
|
-
if (
|
|
64
|
-
let
|
|
65
|
-
|
|
70
|
+
function Te(e, t, n, r, i = !0) {
|
|
71
|
+
if (e.save(), e.globalAlpha = t.alpha, e.beginPath(), e.moveTo(t.x1, t.y1), t.curve ? e.quadraticCurveTo(t.curve.cx, t.curve.cy, t.x2, t.y2) : e.lineTo(t.x2, t.y2), e.strokeStyle = t.color, e.lineWidth = t.mark && t.mark !== "none" ? Math.max(t.width, q.edge / r) : t.width, e.setLineDash(t.dash || []), t.glow && t.glow * r >= ve) {
|
|
72
|
+
let n = e.lineWidth;
|
|
73
|
+
e.save(), e.globalAlpha = t.alpha * .3, e.strokeStyle = t.glowColor || t.color, e.lineWidth = n + t.glow * .6, e.stroke(), e.restore();
|
|
66
74
|
}
|
|
67
|
-
if (
|
|
68
|
-
let
|
|
69
|
-
|
|
75
|
+
if (e.stroke(), e.setLineDash([]), t.mark === "removed") {
|
|
76
|
+
let n = y(t, .5), i = Math.hypot(t.x2 - t.x1, t.y2 - t.y1), [a, o] = i > 0 ? [(t.x2 - t.x1) / i, (t.y2 - t.y1) / i] : [1, 0];
|
|
77
|
+
e.beginPath(), e.moveTo(n.x - o * W.halfLength, n.y + a * W.halfLength), e.lineTo(n.x + o * W.halfLength, n.y - a * W.halfLength), e.lineWidth = Math.max(W.width, 1.5 / r), e.stroke();
|
|
70
78
|
}
|
|
71
|
-
if (
|
|
72
|
-
let { cx:
|
|
73
|
-
cx:
|
|
74
|
-
cy:
|
|
79
|
+
if (t.ticks && De(e, t, r), t.arrow) {
|
|
80
|
+
let { cx: n, cy: i } = t.curve || {
|
|
81
|
+
cx: t.x1,
|
|
82
|
+
cy: t.y1
|
|
75
83
|
};
|
|
76
|
-
|
|
84
|
+
Ee(e, t, Math.atan2(t.y2 - i, t.x2 - n), r);
|
|
77
85
|
}
|
|
78
|
-
|
|
86
|
+
i && t.packet && Oe(e, t, n, r), e.restore();
|
|
79
87
|
}
|
|
80
|
-
function
|
|
81
|
-
let i = t.end || "triangle", { x2: a, y2: o, color:
|
|
82
|
-
if (e.beginPath(), i === "triangle") e.moveTo(a, o), e.lineTo(a - Math.cos(n -
|
|
88
|
+
function Ee(e, t, n, r) {
|
|
89
|
+
let i = t.end || "triangle", { x2: a, y2: o, color: s } = t, c = Math.cos(n), l = Math.sin(n), u = (e, t) => [a - c * e - l * t, o - l * e + c * t], d = Math.max(V.strokeWidth, 1.2 / r);
|
|
90
|
+
if (e.beginPath(), i === "triangle") e.moveTo(a, o), e.lineTo(a - Math.cos(n - N.spread) * N.length, o - Math.sin(n - N.spread) * N.length), e.lineTo(a - Math.cos(n + N.spread) * N.length, o - Math.sin(n + N.spread) * N.length), e.closePath(), e.fillStyle = s, e.fill();
|
|
83
91
|
else {
|
|
84
|
-
if (e.strokeStyle =
|
|
85
|
-
let t =
|
|
86
|
-
e.moveTo(...
|
|
87
|
-
} else if (i === "bar") e.moveTo(...
|
|
92
|
+
if (e.strokeStyle = s, e.lineWidth = d, e.lineJoin = "miter", i === "chevron") {
|
|
93
|
+
let t = N.length * Math.cos(N.spread), n = N.length * Math.sin(N.spread);
|
|
94
|
+
e.moveTo(...u(t, n)), e.lineTo(a, o), e.lineTo(...u(t, -n));
|
|
95
|
+
} else if (i === "bar") e.moveTo(...u(d / 2, V.barHalf)), e.lineTo(...u(d / 2, -V.barHalf));
|
|
88
96
|
else {
|
|
89
|
-
let t =
|
|
90
|
-
e.moveTo(a, o), e.lineTo(...
|
|
97
|
+
let t = V.diamondHalf;
|
|
98
|
+
e.moveTo(a, o), e.lineTo(...u(t, V.diamondAcross)), e.lineTo(...u(2 * t, 0)), e.lineTo(...u(t, -V.diamondAcross)), e.closePath();
|
|
91
99
|
}
|
|
92
100
|
e.stroke();
|
|
93
101
|
}
|
|
94
102
|
}
|
|
95
|
-
function
|
|
96
|
-
let
|
|
97
|
-
|
|
98
|
-
for (let
|
|
99
|
-
let r = (
|
|
100
|
-
|
|
103
|
+
function De(e, t, n) {
|
|
104
|
+
let r = Math.hypot(t.x2 - t.x1, t.y2 - t.y1), [i, a] = r > 0 ? [(t.x2 - t.x1) / r, (t.y2 - t.y1) / r] : [1, 0], o = y(t, .5);
|
|
105
|
+
e.beginPath();
|
|
106
|
+
for (let n = 0; n < t.ticks; n++) {
|
|
107
|
+
let r = (n - (t.ticks - 1) / 2) * V.tickGap, s = o.x + i * r, c = o.y + a * r;
|
|
108
|
+
e.moveTo(s - a * V.tickHalf, c + i * V.tickHalf), e.lineTo(s + a * V.tickHalf, c - i * V.tickHalf);
|
|
101
109
|
}
|
|
102
|
-
|
|
110
|
+
e.strokeStyle = t.color, e.lineWidth = Math.max(V.tickWidth, 1.5 / n), e.setLineDash([]), e.stroke();
|
|
103
111
|
}
|
|
104
|
-
function
|
|
105
|
-
let i =
|
|
106
|
-
a.glow && a.glow * r >=
|
|
112
|
+
function Oe(e, t, n, r) {
|
|
113
|
+
let i = f(t, n), { packet: a } = t;
|
|
114
|
+
a.glow && a.glow * r >= ve && (e.beginPath(), e.arc(i.x, i.y, a.radius + a.glow * .5, 0, _e), e.globalAlpha = t.alpha * .3, e.fillStyle = a.glowColor || a.color, e.fill(), e.globalAlpha = t.alpha), e.beginPath(), e.arc(i.x, i.y, a.radius, 0, _e), e.fillStyle = a.color, e.fill();
|
|
107
115
|
}
|
|
108
|
-
function
|
|
109
|
-
e.save(), e.globalAlpha = t.alpha,
|
|
116
|
+
function ke(e, t, n, r) {
|
|
117
|
+
e.save(), e.globalAlpha = t.alpha, Oe(e, t, n, r), e.restore();
|
|
110
118
|
}
|
|
111
|
-
var
|
|
112
|
-
function
|
|
113
|
-
let t =
|
|
119
|
+
var Ae = 16, je = /* @__PURE__ */ new WeakMap();
|
|
120
|
+
function Me(e) {
|
|
121
|
+
let t = je.get(e);
|
|
114
122
|
return t || (t = new Float64Array(e.edges.length * 4), e.edges.forEach((e, n) => {
|
|
115
|
-
let r = e.curve ? e.curve.cx : e.x1, i = e.curve ? e.curve.cy : e.y1, a = (e.glow || 0) * .6 + (e.packet ? e.packet.radius + (e.packet.glow || 0) * .5 : 0), o = (e.width || 0) / 2 + a +
|
|
123
|
+
let r = e.curve ? e.curve.cx : e.x1, i = e.curve ? e.curve.cy : e.y1, a = (e.glow || 0) * .6 + (e.packet ? e.packet.radius + (e.packet.glow || 0) * .5 : 0), o = (e.width || 0) / 2 + a + Ae;
|
|
116
124
|
t[n * 4] = Math.min(e.x1, e.x2, r) - o, t[n * 4 + 1] = Math.min(e.y1, e.y2, i) - o, t[n * 4 + 2] = Math.max(e.x1, e.x2, r) + o, t[n * 4 + 3] = Math.max(e.y1, e.y2, i) + o;
|
|
117
|
-
}),
|
|
125
|
+
}), je.set(e, t)), t;
|
|
118
126
|
}
|
|
119
|
-
function
|
|
120
|
-
let i =
|
|
127
|
+
function Ne(e, t, n, r) {
|
|
128
|
+
let i = Me(e), a = t.zoom || 1, o = 4 / a, s = -t.x / a - o, c = -t.y / a - o, l = (n - t.x) / a + o, u = (r - t.y) / a + o, d = [];
|
|
121
129
|
for (let t = 0; t < e.edges.length; t++) i[t * 4 + 2] < s || i[t * 4] > l || i[t * 4 + 3] < c || i[t * 4 + 1] > u || d.push(e.edges[t]);
|
|
122
130
|
return d;
|
|
123
131
|
}
|
|
124
|
-
function
|
|
132
|
+
function Pe(e, t, n, r, i, a) {
|
|
125
133
|
e.save(), e.globalAlpha = t.alpha;
|
|
126
|
-
let
|
|
127
|
-
|
|
128
|
-
let
|
|
129
|
-
if (
|
|
130
|
-
let r = t.r + Math.max(
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
134
|
+
let s = r.halo[t.halo];
|
|
135
|
+
s && (s.fill && (Y(e, t.x, t.y, t.r + s.fillR), e.fillStyle = s.fill, e.fill()), Y(e, t.x, t.y, t.r + s.ringR), e.strokeStyle = s.ring, e.lineWidth = s.ringWidth, e.stroke());
|
|
136
|
+
let l = r.mark[t.mark];
|
|
137
|
+
if (l) {
|
|
138
|
+
let r = t.r + Math.max(l.ringR, q.gap / n);
|
|
139
|
+
Y(e, t.x, t.y, r), e.strokeStyle = l.color, e.lineWidth = Math.max(l.ringWidth, q.ring / n), e.setLineDash(l.ringDash || []), e.stroke(), e.setLineDash([]), t.mark === "removed" && (e.beginPath(), e.moveTo(t.x - r, t.y), e.lineTo(t.x + r, t.y), e.stroke());
|
|
140
|
+
}
|
|
141
|
+
if (xe(e, t.shape, t.x, t.y, t.r), t.glow && t.glow * n >= ve) {
|
|
142
|
+
e.save(), e.globalAlpha = t.alpha * .28;
|
|
143
|
+
let n = t.r + t.glow * .7;
|
|
144
|
+
if (e.fillStyle = t.color, be(t.color) < 1) {
|
|
145
|
+
if (t.r * (j[t.shape] || 1) < n) Y(e, t.x, t.y, n), xe(e, t.shape, t.x, t.y, t.r, !0), e.fill("evenodd");
|
|
146
|
+
else {
|
|
147
|
+
let r = n + t.r;
|
|
148
|
+
e.beginPath(), e.rect(t.x - r, t.y - r, r * 2, r * 2), xe(e, t.shape, t.x, t.y, t.r, !0), e.clip("evenodd"), Y(e, t.x, t.y, n), e.fill();
|
|
149
|
+
}
|
|
150
|
+
} else Y(e, t.x, t.y, n), e.fill();
|
|
151
|
+
e.restore(), xe(e, t.shape, t.x, t.y, t.r);
|
|
152
|
+
}
|
|
153
|
+
e.fillStyle = t.color, e.fill();
|
|
154
|
+
let d = t.icon && i.icons ? i.icons.get(t.icon) : null, f = !d && me(t, n), p = !d && !f && D(t, n) ? o(t.glyph, u(t, i, a)) : null;
|
|
155
|
+
if (p || (Y(e, t.x, t.y, t.r * F), e.fillStyle = r.core, e.fill()), t.stroke && (xe(e, t.shape, t.x, t.y, Math.max(0, t.r - t.stroke.width / 2)), e.strokeStyle = t.stroke.color, e.lineWidth = t.stroke.width, e.stroke()), d) {
|
|
156
|
+
let n = t.r * G;
|
|
157
|
+
e.imageSmoothingEnabled = !i.pixelated, e.drawImage(d, t.x - n / 2, t.y - n / 2, n, n);
|
|
158
|
+
} else if (f) {
|
|
159
|
+
let n = ge(t.letters, i.values && i.values["--corn-map-glyph"]);
|
|
140
160
|
if (n) {
|
|
141
161
|
let r = t.r * 1;
|
|
142
162
|
e.imageSmoothingEnabled = !0, e.drawImage(n, t.x - r / 2, t.y - r / 2, r, r);
|
|
143
163
|
}
|
|
144
|
-
} else if (
|
|
145
|
-
let n = t.r *
|
|
146
|
-
e.imageSmoothingEnabled = !0, e.drawImage(
|
|
164
|
+
} else if (p) {
|
|
165
|
+
let n = t.r * c;
|
|
166
|
+
e.imageSmoothingEnabled = !0, e.drawImage(p, t.x - n / 2, t.y - n / 2, n, n);
|
|
147
167
|
}
|
|
148
168
|
e.restore();
|
|
149
169
|
}
|
|
150
|
-
function
|
|
151
|
-
let n = t.mapStyle || (() =>
|
|
170
|
+
function Fe(e, t = {}) {
|
|
171
|
+
let n = t.mapStyle || (() => L), r = e.getContext("2d"), i = 0, a = 0, o = 1, s = null, c = null, l = null, u = () => {
|
|
152
172
|
if (s) return s;
|
|
153
173
|
try {
|
|
154
174
|
s = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(e.width || 1, e.height || 1) : e.ownerDocument ? e.ownerDocument.createElement("canvas") : null, c = s && s.getContext ? s.getContext("2d") : null;
|
|
@@ -156,49 +176,49 @@ function Me(e, t = {}) {
|
|
|
156
176
|
c = null;
|
|
157
177
|
}
|
|
158
178
|
return c || (s = null), s;
|
|
159
|
-
},
|
|
160
|
-
function
|
|
179
|
+
}, d = t.layerMinEdges ?? 600, f = /* @__PURE__ */ new WeakMap(), p = (e) => (f.has(e) || f.set(e, e.edges.some((e) => e.packet)), f.get(e));
|
|
180
|
+
function m(e, t, n) {
|
|
161
181
|
e.save(), e.translate(n.x, n.y), e.scale(n.zoom, n.zoom);
|
|
162
182
|
let { decor: r } = t;
|
|
163
|
-
r.grid &&
|
|
183
|
+
r.grid && Se(e, r.grid, n, i, a), r.lanes.length && we(e, r.lanes), r.rings.length && Ce(e, r.rings), Ne(t, n, i, a).forEach((t) => Te(e, t, 0, n.zoom, !1)), e.restore();
|
|
164
184
|
}
|
|
165
185
|
return {
|
|
166
186
|
kind: "canvas2d",
|
|
167
187
|
resize(t, n, u) {
|
|
168
188
|
i = t, a = n, o = u, e.width = t * u, e.height = n * u, r.setTransform(u, 0, 0, u, 0, 0), l = null, s && (s.width = e.width, s.height = e.height, c.setTransform(u, 0, 0, u, 0, 0));
|
|
169
189
|
},
|
|
170
|
-
draw(t,
|
|
171
|
-
let g = n(), _ =
|
|
190
|
+
draw(t, f, h) {
|
|
191
|
+
let g = n(), _ = ae(t, g);
|
|
172
192
|
r.clearRect(0, 0, i, a);
|
|
173
|
-
let v =
|
|
174
|
-
if (
|
|
175
|
-
l && l.scene === _ && l.x ===
|
|
193
|
+
let v = M(z(_.theme), g), y = Ne(_, f, i, a);
|
|
194
|
+
if (p(_) && y.length > d && u()) {
|
|
195
|
+
l && l.scene === _ && l.x === f.x && l.y === f.y && l.zoom === f.zoom && l.w === e.width && l.h === e.height || ((s.width !== e.width || s.height !== e.height) && (s.width = e.width, s.height = e.height), c.setTransform(o, 0, 0, o, 0, 0), c.clearRect(0, 0, i, a), m(c, _, f), l = {
|
|
176
196
|
scene: _,
|
|
177
|
-
x:
|
|
178
|
-
y:
|
|
179
|
-
zoom:
|
|
197
|
+
x: f.x,
|
|
198
|
+
y: f.y,
|
|
199
|
+
zoom: f.zoom,
|
|
180
200
|
w: e.width,
|
|
181
201
|
h: e.height
|
|
182
|
-
}), r.save(), r.setTransform(1, 0, 0, 1, 0, 0), r.drawImage(s, 0, 0), r.restore(), r.save(), r.translate(
|
|
183
|
-
e.packet &&
|
|
184
|
-
}), _.nodes.forEach((e) =>
|
|
202
|
+
}), r.save(), r.setTransform(1, 0, 0, 1, 0, 0), r.drawImage(s, 0, 0), r.restore(), r.save(), r.translate(f.x, f.y), r.scale(f.zoom, f.zoom), y.forEach((e) => {
|
|
203
|
+
e.packet && ke(r, e, h, f.zoom);
|
|
204
|
+
}), _.nodes.forEach((e) => Pe(r, e, f.zoom, v, g, _.theme)), r.restore();
|
|
185
205
|
return;
|
|
186
206
|
}
|
|
187
|
-
r.save(), r.translate(
|
|
207
|
+
r.save(), r.translate(f.x, f.y), r.scale(f.zoom, f.zoom);
|
|
188
208
|
let { decor: b } = _;
|
|
189
|
-
b.grid &&
|
|
209
|
+
b.grid && Se(r, b.grid, f, i, a), b.lanes.length && we(r, b.lanes), b.rings.length && Ce(r, b.rings), y.forEach((e) => Te(r, e, h, f.zoom)), _.nodes.forEach((e) => Pe(r, e, f.zoom, v, g, _.theme)), r.restore();
|
|
190
210
|
},
|
|
191
211
|
destroy() {
|
|
192
212
|
s = null, c = null, l = null;
|
|
193
213
|
}
|
|
194
214
|
};
|
|
195
215
|
}
|
|
196
|
-
var
|
|
197
|
-
function
|
|
216
|
+
var Ie = (e) => typeof e.hitR == "number" && e.hitR > e.r ? e.hitR : e.r;
|
|
217
|
+
function Le(e, { cellSize: t = 64 } = {}) {
|
|
198
218
|
let n = /* @__PURE__ */ new Map(), r = 0, i = (e, t) => e * 4194304 + t;
|
|
199
219
|
for (let a = 0; a < e.length; a++) {
|
|
200
220
|
let o = e[a];
|
|
201
|
-
|
|
221
|
+
Ie(o) > r && (r = Ie(o));
|
|
202
222
|
let s = i(Math.floor(o.x / t), Math.floor(o.y / t)), c = n.get(s);
|
|
203
223
|
c ? c.push(a) : n.set(s, [a]);
|
|
204
224
|
}
|
|
@@ -214,7 +234,7 @@ function Pe(e, { cellSize: t = 64 } = {}) {
|
|
|
214
234
|
if (a) for (let t = 0; t < a.length; t++) {
|
|
215
235
|
let n = a[t];
|
|
216
236
|
if (n <= _) continue;
|
|
217
|
-
let r = e[n], i = Math.max(
|
|
237
|
+
let r = e[n], i = Math.max(Ie(r) + u, d);
|
|
218
238
|
Math.hypot(r.x - s, r.y - c) <= i && (_ = n);
|
|
219
239
|
}
|
|
220
240
|
}
|
|
@@ -227,32 +247,32 @@ function Pe(e, { cellSize: t = 64 } = {}) {
|
|
|
227
247
|
let a = n.get(i(t, r));
|
|
228
248
|
if (a) for (let t = 0; t < a.length; t++) {
|
|
229
249
|
let n = a[t], r = e[n], i = r.x - Math.min(Math.max(r.x, o), c), u = r.y - Math.min(Math.max(r.y, s), l);
|
|
230
|
-
i * i + u * u <=
|
|
250
|
+
i * i + u * u <= Ie(r) ** 2 && m.push(n);
|
|
231
251
|
}
|
|
232
252
|
}
|
|
233
253
|
return m.sort((e, t) => e - t).map((t) => e[t]);
|
|
234
254
|
}
|
|
235
255
|
};
|
|
236
256
|
}
|
|
237
|
-
function
|
|
257
|
+
function Re(e, t, n, r, i = !1) {
|
|
238
258
|
let a = t.zoom;
|
|
239
259
|
return e.nodeAt((n - t.x) / a, (r - t.y) / a, {
|
|
240
260
|
pad: (i ? 16 : 6) / a,
|
|
241
261
|
min: (i ? 32 : 12) / a
|
|
242
262
|
});
|
|
243
263
|
}
|
|
244
|
-
function
|
|
264
|
+
function ze(e) {
|
|
245
265
|
let t = null, n = null, r = {
|
|
246
266
|
builds: 0,
|
|
247
267
|
get(i) {
|
|
248
|
-
return n && t === i || (n =
|
|
268
|
+
return n && t === i || (n = Le(i.nodes, e), t = i, r.builds++), n;
|
|
249
269
|
}
|
|
250
270
|
};
|
|
251
271
|
return r;
|
|
252
272
|
}
|
|
253
273
|
// ../explorer/frame.js
|
|
254
|
-
var
|
|
255
|
-
function
|
|
274
|
+
var Be = 3e4;
|
|
275
|
+
function Ve({ dirty: e, packetsVisible: t, hidden: n, reduceMotion: r, idleMs: i, clientsWant: a = !1 }) {
|
|
256
276
|
if (n) return {
|
|
257
277
|
draw: !1,
|
|
258
278
|
again: !1
|
|
@@ -263,8 +283,8 @@ function Re({ dirty: e, packetsVisible: t, hidden: n, reduceMotion: r, idleMs: i
|
|
|
263
283
|
again: o
|
|
264
284
|
};
|
|
265
285
|
}
|
|
266
|
-
function
|
|
267
|
-
let i =
|
|
286
|
+
function He(e, t, n, r) {
|
|
287
|
+
let i = We(e);
|
|
268
288
|
if (i.length === 0) return !1;
|
|
269
289
|
if (!(n > 0) || !(r > 0)) return !0;
|
|
270
290
|
let a = -t.x / t.zoom, o = -t.y / t.zoom, s = (n - t.x) / t.zoom, c = (r - t.y) / t.zoom;
|
|
@@ -274,12 +294,12 @@ function ze(e, t, n, r) {
|
|
|
274
294
|
}
|
|
275
295
|
return !1;
|
|
276
296
|
}
|
|
277
|
-
var
|
|
278
|
-
function
|
|
279
|
-
let t =
|
|
280
|
-
return t || (t = e.edges.filter((e) => e.packet),
|
|
297
|
+
var Ue = /* @__PURE__ */ new WeakMap();
|
|
298
|
+
function We(e) {
|
|
299
|
+
let t = Ue.get(e);
|
|
300
|
+
return t || (t = e.edges.filter((e) => e.packet), Ue.set(e, t)), t;
|
|
281
301
|
}
|
|
282
|
-
function
|
|
302
|
+
function Ge(e) {
|
|
283
303
|
let { draw: t, packetsVisible: n, isHidden: r, reduceMotion: i, extraDirty: a, tickClients: o, clientsWant: s, now: c, raf: l, caf: u } = e, d = !0, f = null, p = -Infinity, m = c(), h = !1, g = /* @__PURE__ */ new Set(), _ = () => {
|
|
284
304
|
if (g.size === 0) return;
|
|
285
305
|
let e = [...g];
|
|
@@ -292,7 +312,7 @@ function He(e) {
|
|
|
292
312
|
let n = o && !r() ? o(e) : !1, i = d || (a ? a() : !1), { draw: s, again: c } = b(i, n);
|
|
293
313
|
s && (i || e - p >= 31) && (d = !1, p = e, x.draws++, t()), x.frames++, c && v();
|
|
294
314
|
}
|
|
295
|
-
let b = (e, t) =>
|
|
315
|
+
let b = (e, t) => Ve({
|
|
296
316
|
dirty: e,
|
|
297
317
|
packetsVisible: n(),
|
|
298
318
|
hidden: r(),
|
|
@@ -312,7 +332,7 @@ function He(e) {
|
|
|
312
332
|
v();
|
|
313
333
|
},
|
|
314
334
|
noteInput() {
|
|
315
|
-
let e = c(), t = e - m >=
|
|
335
|
+
let e = c(), t = e - m >= Be;
|
|
316
336
|
m = e, t && v();
|
|
317
337
|
},
|
|
318
338
|
shown() {
|
|
@@ -335,7 +355,7 @@ function He(e) {
|
|
|
335
355
|
};
|
|
336
356
|
return x;
|
|
337
357
|
}
|
|
338
|
-
var
|
|
358
|
+
var Ke = 1, qe = .3, Je = .58, Ye = 3, Xe = 100, X = 64, Z = {
|
|
339
359
|
selected: 0,
|
|
340
360
|
current: 1,
|
|
341
361
|
match: 2,
|
|
@@ -344,19 +364,19 @@ var Ue = 1, We = .3, Ge = .58, Ke = 3, qe = 100, Y = 64, X = {
|
|
|
344
364
|
hub: 5,
|
|
345
365
|
rest: 6,
|
|
346
366
|
greyed: 7
|
|
347
|
-
},
|
|
348
|
-
function
|
|
349
|
-
let { measure: r = null } = n, i =
|
|
367
|
+
}, Ze = 1.5, Qe = (e) => Number.isFinite(e) && e >= 9 ? Math.max(11, e) : 11, $e = (e) => Qe(e.labelMin), et = (e) => k.includes(e.type) && !e.greyed, tt = (e, t) => e.selected ? Z.selected : e.current ? Z.current : e.match ? Z.match : t && e.connected ? Z.lit : e.mark && e.mark !== "none" || e.labelKeep && !et(e) ? Z.marked : e.greyed ? Z.greyed : et(e) ? Z.hub : Z.rest;
|
|
368
|
+
function nt(e, t, n = {}) {
|
|
369
|
+
let { measure: r = null } = n, i = $e(e), a = e.nodes.some((e) => e.selected || !e.connected), o = [];
|
|
350
370
|
e.nodes.forEach((e, t) => {
|
|
351
371
|
e.label && e.labelAlpha >= .15 && o.push({
|
|
352
372
|
node: e,
|
|
353
373
|
index: t,
|
|
354
|
-
tier:
|
|
374
|
+
tier: tt(e, a)
|
|
355
375
|
});
|
|
356
376
|
}), o.sort((e, t) => e.tier - t.tier || t.node.r - e.node.r || (t.node.degree || 0) - (e.node.degree || 0) || e.index - t.index);
|
|
357
|
-
let s = /* @__PURE__ */ new Map(), c = (e, t) => (e + 8192) * 16384 + (t + 8192), l = [], u = Math.max(
|
|
377
|
+
let s = /* @__PURE__ */ new Map(), c = (e, t) => (e + 8192) * 16384 + (t + 8192), l = [], u = Math.max(Ye, Ye * t);
|
|
358
378
|
for (let { node: e, index: n, tier: a } of o) {
|
|
359
|
-
let o =
|
|
379
|
+
let o = et(e), d = !e.greyed && (!!e.labelBold || o), f = Math.max(o ? i + 2 : i, e.labelSize * t), p = r ? r(e.label, Xe, d) * f / Xe : e.label.length * f * Je, m = e.x * t, h = e.y * t + e.r * t + u + f, g = m - p / 2, _ = m + p / 2, v = h - f * Ke, y = h + f * qe, b = a === Z.greyed ? 2 + f * Ze : 2, x = Math.floor((g - b) / X), S = Math.floor((_ + b) / X), C = Math.floor((v - b) / X), w = Math.floor((y + b) / X), T = !1;
|
|
360
380
|
for (let e = x; e <= S && !T; e++) for (let t = C; t <= w && !T; t++) {
|
|
361
381
|
let n = s.get(c(e, t));
|
|
362
382
|
if (n) for (let e = 0; e < n.length; e++) {
|
|
@@ -386,16 +406,16 @@ function $e(e, t, n = {}) {
|
|
|
386
406
|
b: y
|
|
387
407
|
};
|
|
388
408
|
l.push(E);
|
|
389
|
-
let D = Math.floor(g /
|
|
390
|
-
for (let e = D; e <= O; e++) for (let t =
|
|
409
|
+
let D = Math.floor(g / X), O = Math.floor(_ / X), k = Math.floor(v / X), A = Math.floor(y / X);
|
|
410
|
+
for (let e = D; e <= O; e++) for (let t = k; t <= A; t++) {
|
|
391
411
|
let n = c(e, t), r = s.get(n);
|
|
392
412
|
r ? r.push(E) : s.set(n, [E]);
|
|
393
413
|
}
|
|
394
414
|
}
|
|
395
415
|
return l;
|
|
396
416
|
}
|
|
397
|
-
function
|
|
398
|
-
let { max: i = 400, margin: a = 32, measure: o = null, hover: s = null } = r, c = [], l = e.labelOutline ||
|
|
417
|
+
function rt(e, t, n, r = {}) {
|
|
418
|
+
let { max: i = 400, margin: a = 32, measure: o = null, hover: s = null } = r, c = [], l = e.labelOutline || z(e.theme).labelOutline;
|
|
399
419
|
for (let t of e.decor.lanes) for (let n of [
|
|
400
420
|
t.title,
|
|
401
421
|
t.note,
|
|
@@ -414,7 +434,7 @@ function et(e, t, n, r = {}) {
|
|
|
414
434
|
align: "center",
|
|
415
435
|
family: e.labelFont || "\"Segoe UI\", -apple-system, BlinkMacSystemFont, Roboto, sans-serif"
|
|
416
436
|
});
|
|
417
|
-
let { zoom: u } = t, d = r.placed ||
|
|
437
|
+
let { zoom: u } = t, d = r.placed || nt(e, u, { measure: o }), f = -a - t.x, p = n.width + a - t.x, m = -a - t.y, h = n.height + a - t.y, g = d.filter((e) => e.r >= f && e.l <= p && e.b >= m && e.t <= h);
|
|
418
438
|
g.length > i && (g = g.slice(0, Math.max(0, i))), g.sort((e, t) => e.index - t.index);
|
|
419
439
|
let _ = e.labelFont || "\"Segoe UI\", -apple-system, BlinkMacSystemFont, Roboto, sans-serif";
|
|
420
440
|
for (let e of g) {
|
|
@@ -441,7 +461,7 @@ function et(e, t, n, r = {}) {
|
|
|
441
461
|
screen: e.screen
|
|
442
462
|
});
|
|
443
463
|
}
|
|
444
|
-
let v =
|
|
464
|
+
let v = $e(e), y = g.map((e) => ({
|
|
445
465
|
l: t.x + e.l,
|
|
446
466
|
r: t.x + e.r,
|
|
447
467
|
t: t.y + e.t,
|
|
@@ -489,7 +509,7 @@ function et(e, t, n, r = {}) {
|
|
|
489
509
|
if (s) {
|
|
490
510
|
let n = e.nodes.find((e) => e.id === s);
|
|
491
511
|
if (n && n.label && !d.some((e) => e.id === s && g.includes(e))) {
|
|
492
|
-
let r =
|
|
512
|
+
let r = $e(e), i = t.y + n.y * u - n.r * u > 40 ? n.y - n.r - 5 / u : n.y + n.r + (5 + r) / u;
|
|
493
513
|
c.push({
|
|
494
514
|
kind: "chip",
|
|
495
515
|
id: n.id,
|
|
@@ -512,17 +532,17 @@ function et(e, t, n, r = {}) {
|
|
|
512
532
|
}
|
|
513
533
|
return c;
|
|
514
534
|
}
|
|
515
|
-
var
|
|
535
|
+
var it = (e) => `${e.italic ? "italic " : ""}${e.bold ? "bold " : ""}${e.screen ? e.px : e.size}px ${e.family}`, at = {
|
|
516
536
|
ox: 0,
|
|
517
537
|
oy: 0,
|
|
518
538
|
k: 1
|
|
519
539
|
};
|
|
520
|
-
function
|
|
521
|
-
e.font =
|
|
522
|
-
let r = e.measureText(t.text).width + 8, i = t.px * 1.3 + 4, a = n.ox + t.x * n.k, o = n.oy + t.y * n.k, s = a - r / 2, c = o - t.px *
|
|
540
|
+
function ot(e, t, n) {
|
|
541
|
+
e.font = it(t);
|
|
542
|
+
let r = e.measureText(t.text).width + 8, i = t.px * 1.3 + 4, a = n.ox + t.x * n.k, o = n.oy + t.y * n.k, s = a - r / 2, c = o - t.px * Ke - 2;
|
|
523
543
|
e.globalAlpha = 1, e.beginPath(), e.roundRect ? e.roundRect(s, c, r, i, 4) : e.rect(s, c, r, i), e.fillStyle = t.outline ? t.outline.color : "rgba(9, 13, 22, 0.95)", e.fill(), e.lineWidth = 1, e.strokeStyle = t.color, e.stroke(), e.textAlign = t.align, e.fillStyle = t.color, e.fillText(t.text, a, o);
|
|
524
544
|
}
|
|
525
|
-
function
|
|
545
|
+
function st() {
|
|
526
546
|
return {
|
|
527
547
|
font: "",
|
|
528
548
|
alpha: -1,
|
|
@@ -532,13 +552,13 @@ function it() {
|
|
|
532
552
|
align: ""
|
|
533
553
|
};
|
|
534
554
|
}
|
|
535
|
-
function
|
|
555
|
+
function ct(e, t, n, r = at) {
|
|
536
556
|
if (t.kind === "chip") {
|
|
537
|
-
|
|
557
|
+
ot(e, t, r);
|
|
538
558
|
return;
|
|
539
559
|
}
|
|
540
560
|
n.alpha !== t.alpha && (e.globalAlpha = t.alpha, n.alpha = t.alpha);
|
|
541
|
-
let i =
|
|
561
|
+
let i = it(t);
|
|
542
562
|
n.font !== i && (e.font = i, n.font = i), n.align !== t.align && (e.textAlign = t.align, n.align = t.align);
|
|
543
563
|
let a = r.ox + t.x * r.k, o = r.oy + t.y * r.k;
|
|
544
564
|
if (t.outline) {
|
|
@@ -551,69 +571,69 @@ function at(e, t, n, r = nt) {
|
|
|
551
571
|
e.beginPath(), e.moveTo(a - i, o - s * .32), e.lineTo(a + i, o - s * .32), e.strokeStyle = t.color, e.lineWidth = 1.4, e.stroke(), n.stroke = t.color, n.width = 1.4;
|
|
552
572
|
}
|
|
553
573
|
}
|
|
554
|
-
function
|
|
574
|
+
function lt(e, t, n, r) {
|
|
555
575
|
let i = null;
|
|
556
576
|
for (let a of e) n >= t.x + a.l && n <= t.x + a.r && r >= t.y + a.t && r <= t.y + a.b && (!i || a.index > i.index) && (i = a);
|
|
557
577
|
return i ? i.id : null;
|
|
558
578
|
}
|
|
559
|
-
function
|
|
560
|
-
let n = t.mapStyle || (() =>
|
|
561
|
-
let i = `${n ? "b" : "n"}${t}|${
|
|
562
|
-
return a === void 0 && (
|
|
579
|
+
function ut(e, t = {}) {
|
|
580
|
+
let n = t.mapStyle || (() => L), r = e.getContext("2d"), i = 0, a = 0, o = 1, s = null, c, l, u, d, f, p, m = null, h = !0, g = !1, _ = /* @__PURE__ */ new Map(), v = I, y = (e, t, n) => {
|
|
581
|
+
let i = `${n ? "b" : "n"}${t}|${v}|${e}`, a = _.get(i);
|
|
582
|
+
return a === void 0 && (_.size > 2e4 && _.clear(), r.font = it({
|
|
563
583
|
italic: !1,
|
|
564
584
|
bold: n,
|
|
565
585
|
size: t,
|
|
566
|
-
family:
|
|
567
|
-
}), a = r.measureText(e).width,
|
|
586
|
+
family: v
|
|
587
|
+
}), a = r.measureText(e).width, _.set(i, a)), a;
|
|
568
588
|
};
|
|
569
589
|
return {
|
|
570
590
|
hit(e, t) {
|
|
571
|
-
return
|
|
591
|
+
return m && s ? lt(m, {
|
|
572
592
|
x: l,
|
|
573
593
|
y: u,
|
|
574
|
-
zoom:
|
|
594
|
+
zoom: d
|
|
575
595
|
}, e, t) : null;
|
|
576
596
|
},
|
|
577
597
|
resize(t, n, s) {
|
|
578
|
-
i = t, a = n, o = s, e.width = t * s, e.height = n * s, r.setTransform(s, 0, 0, s, 0, 0),
|
|
598
|
+
i = t, a = n, o = s, e.width = t * s, e.height = n * s, r.setTransform(s, 0, 0, s, 0, 0), h = !0;
|
|
579
599
|
},
|
|
580
|
-
draw(e, t,
|
|
581
|
-
if (
|
|
582
|
-
let
|
|
583
|
-
if (!
|
|
584
|
-
let
|
|
585
|
-
s = e, c = e.version, l = t.x, u = t.y,
|
|
586
|
-
let
|
|
587
|
-
|
|
588
|
-
let
|
|
600
|
+
draw(e, t, _ = {}) {
|
|
601
|
+
if (g) return !1;
|
|
602
|
+
let b = n(), x = b.plain ? 0 : b.version, S = _.hover || null;
|
|
603
|
+
if (!h && e === s && e.version === c && t.x === l && t.y === u && t.zoom === d && x === f && S === p) return !1;
|
|
604
|
+
let C = m && e === s && e.version === c && t.zoom === d && x === f && !h;
|
|
605
|
+
s = e, c = e.version, l = t.x, u = t.y, d = t.zoom, f = x, p = S, h = !1;
|
|
606
|
+
let w = ae(e, b);
|
|
607
|
+
v = w.labelFont || "\"Segoe UI\", -apple-system, BlinkMacSystemFont, Roboto, sans-serif", r.setTransform(o, 0, 0, o, 0, 0), r.clearRect(0, 0, i, a), r.save(), r.translate(t.x, t.y), r.scale(t.zoom, t.zoom), C || (m = nt(w, t.zoom, { measure: y }));
|
|
608
|
+
let T = rt(w, t, {
|
|
589
609
|
width: i,
|
|
590
610
|
height: a
|
|
591
611
|
}, {
|
|
592
|
-
measure:
|
|
593
|
-
hover:
|
|
594
|
-
placed:
|
|
595
|
-
}),
|
|
596
|
-
for (let e of
|
|
597
|
-
for (let e of
|
|
612
|
+
measure: y,
|
|
613
|
+
hover: S,
|
|
614
|
+
placed: m
|
|
615
|
+
}), E = st();
|
|
616
|
+
for (let e of T) e.kind === "lane" && ct(r, e, E);
|
|
617
|
+
for (let e of T) e.kind === "node" && !e.screen && ct(r, e, E);
|
|
598
618
|
r.restore();
|
|
599
|
-
let
|
|
619
|
+
let D = {
|
|
600
620
|
ox: t.x,
|
|
601
621
|
oy: t.y,
|
|
602
622
|
k: t.zoom
|
|
603
623
|
};
|
|
604
|
-
|
|
605
|
-
for (let e of
|
|
606
|
-
for (let e of
|
|
607
|
-
for (let e of
|
|
624
|
+
E = st();
|
|
625
|
+
for (let e of T) e.kind === "node" && e.screen && ct(r, e, E, D);
|
|
626
|
+
for (let e of T) e.kind === "edge" && ct(r, e, E, D);
|
|
627
|
+
for (let e of T) e.kind === "chip" && ct(r, e, E, D);
|
|
608
628
|
return !0;
|
|
609
629
|
},
|
|
610
630
|
destroy() {
|
|
611
|
-
|
|
631
|
+
g = !0, s = null, m = null, _.clear(), r.setTransform(1, 0, 0, 1, 0, 0), r.clearRect(0, 0, i, a);
|
|
612
632
|
}
|
|
613
633
|
};
|
|
614
634
|
}
|
|
615
635
|
// ../explorer/engine/render.js
|
|
616
|
-
var
|
|
636
|
+
var dt = [
|
|
617
637
|
"pointerdown",
|
|
618
638
|
"pointermove",
|
|
619
639
|
"mousedown",
|
|
@@ -623,65 +643,65 @@ var ct = [
|
|
|
623
643
|
"touchmove",
|
|
624
644
|
"keydown"
|
|
625
645
|
];
|
|
626
|
-
function
|
|
646
|
+
function ft(e, n = {}) {
|
|
627
647
|
if (e.map) return e.map;
|
|
628
|
-
let { state:
|
|
629
|
-
throughChildren: !!
|
|
630
|
-
kind:
|
|
631
|
-
}) =>
|
|
648
|
+
let { state: i } = e, a = n.measureCovered || (() => i.coveredBottom || 0), o = te(e).get, s = !1, c = (e) => B(i, e), l = (e) => B(i, e, { viewer: !0 }), u = (t, n = e.viewEdges(), a = {
|
|
649
|
+
throughChildren: !!i.throughChildren,
|
|
650
|
+
kind: i.selectedKind || null
|
|
651
|
+
}) => r(t, n, a), d = se((n) => t(n, { reduceMotion: e.reducedMotion })), f = () => d.get(i), p = () => d.builds, m = ze(), h = () => m.get(f()), g = () => m.builds, _ = null, v = null;
|
|
632
652
|
function y() {
|
|
633
|
-
return _ && v ===
|
|
653
|
+
return _ && v === i.canvas || (_ && _.destroy(), _ = Fe(i.canvas, { mapStyle: o }), v = i.canvas, i.width && _.resize(i.width, i.height, e.dpr())), _;
|
|
634
654
|
}
|
|
635
655
|
let b = null, x = null;
|
|
636
656
|
function S() {
|
|
637
|
-
return
|
|
657
|
+
return i.labelCanvas ? (b && x === i.labelCanvas || (b && b.destroy(), b = ut(i.labelCanvas, { mapStyle: o }), x = i.labelCanvas, i.width && b.resize(i.width, i.height, e.dpr())), b) : null;
|
|
638
658
|
}
|
|
639
659
|
function C(t) {
|
|
640
|
-
_ && _ !== t && _.destroy(), _ = t, v =
|
|
660
|
+
_ && _ !== t && _.destroy(), _ = t, v = i.canvas, i.width && _.resize(i.width, i.height, e.dpr()), U();
|
|
641
661
|
}
|
|
642
662
|
function w() {
|
|
643
|
-
let { canvas: t } =
|
|
644
|
-
|
|
645
|
-
let
|
|
646
|
-
|
|
663
|
+
let { canvas: t } = i, n = `${i.width}x${i.height}`;
|
|
664
|
+
i.width = t.parentElement.clientWidth, i.height = t.parentElement.clientHeight, y().resize(i.width, i.height, e.dpr());
|
|
665
|
+
let r = S();
|
|
666
|
+
r && r.resize(i.width, i.height, e.dpr()), n !== `${i.width}x${i.height}` && E(), U();
|
|
647
667
|
}
|
|
648
|
-
let
|
|
668
|
+
let T = e.slot("fit", () => ({
|
|
649
669
|
lastFit: null,
|
|
650
670
|
waiting: null
|
|
651
671
|
}));
|
|
652
|
-
function
|
|
653
|
-
if (!
|
|
654
|
-
if (
|
|
655
|
-
let { padding: e, only: t } =
|
|
656
|
-
|
|
672
|
+
function E() {
|
|
673
|
+
if (!i.width || !i.height) return;
|
|
674
|
+
if (T.waiting) {
|
|
675
|
+
let { padding: e, only: t } = T.waiting;
|
|
676
|
+
N(e === null ? P() : e, t);
|
|
657
677
|
return;
|
|
658
678
|
}
|
|
659
|
-
let { camera: e } =
|
|
660
|
-
t && e.x === t.x && e.y === t.y && e.zoom === t.zoom &&
|
|
679
|
+
let { camera: e } = i, t = T.lastFit;
|
|
680
|
+
t && e.x === t.x && e.y === t.y && e.zoom === t.zoom && N(t.auto ? P() : t.padding, t.only);
|
|
661
681
|
}
|
|
662
|
-
function
|
|
663
|
-
let t =
|
|
682
|
+
function D() {
|
|
683
|
+
let t = i.canvas && i.canvas.parentElement, n = e.win && e.win.ResizeObserver;
|
|
664
684
|
if (!t || !n) return () => {};
|
|
665
|
-
let
|
|
666
|
-
|
|
685
|
+
let r = new n(() => {
|
|
686
|
+
i.canvas && (t.clientWidth !== i.width || t.clientHeight !== i.height) && w();
|
|
667
687
|
});
|
|
668
|
-
|
|
669
|
-
let a = () =>
|
|
688
|
+
r.observe(t);
|
|
689
|
+
let a = () => r.disconnect();
|
|
670
690
|
return e.own(a), a;
|
|
671
691
|
}
|
|
672
|
-
function
|
|
673
|
-
let { nodes: n, width:
|
|
692
|
+
function O(e, t = null) {
|
|
693
|
+
let { nodes: n, width: r, height: o } = i, s = n.filter(c);
|
|
674
694
|
if (t) {
|
|
675
|
-
let e =
|
|
676
|
-
e.length && (
|
|
695
|
+
let e = s.filter((e) => t.has(e.id));
|
|
696
|
+
e.length && (s = e);
|
|
677
697
|
}
|
|
678
|
-
if (
|
|
679
|
-
let l = Math.max(160, o -
|
|
680
|
-
|
|
698
|
+
if (s.length === 0) return null;
|
|
699
|
+
let l = Math.max(160, o - a()), u = Infinity, d = -Infinity, f = Infinity, p = -Infinity;
|
|
700
|
+
s.forEach((e) => {
|
|
681
701
|
let t = e.r || 18;
|
|
682
702
|
u = Math.min(u, e.x - t - 25), d = Math.max(d, e.x + t + 25), f = Math.min(f, e.y - t - 25), p = Math.max(p, e.y + t + 35);
|
|
683
|
-
}),
|
|
684
|
-
let m = Math.max(160,
|
|
703
|
+
}), i.view === "dataflow" && i.flow && (f = Math.min(f, i.flow.top - 10)), i.view === "house" && i.house && i.house.fit && !t && ({minX: u, maxX: d, minY: f, maxY: p} = i.house.fit);
|
|
704
|
+
let m = Math.max(160, r - e * 2), h = Math.max(160, l - e * 2), g = Math.min(m / (d - u), h / (p - f));
|
|
685
705
|
return {
|
|
686
706
|
minX: u,
|
|
687
707
|
maxX: d,
|
|
@@ -691,142 +711,145 @@ function lt(e, t = {}) {
|
|
|
691
711
|
raw: g
|
|
692
712
|
};
|
|
693
713
|
}
|
|
694
|
-
let k = "",
|
|
695
|
-
function
|
|
696
|
-
let e = `${
|
|
714
|
+
let k = "", j = oe;
|
|
715
|
+
function M() {
|
|
716
|
+
let e = `${i.sceneVersion}|${i.width}|${i.height}|${i.view}|${a()}`;
|
|
697
717
|
if (e !== k) {
|
|
698
718
|
k = e;
|
|
699
|
-
let t =
|
|
700
|
-
|
|
719
|
+
let t = O(P());
|
|
720
|
+
j = t && t.raw > 0 && Number.isFinite(t.raw) ? Math.max(A, Math.min(oe, t.raw)) : oe;
|
|
701
721
|
}
|
|
702
|
-
return
|
|
722
|
+
return j;
|
|
703
723
|
}
|
|
704
|
-
function
|
|
705
|
-
let { width: n, height:
|
|
706
|
-
if (!n || !
|
|
707
|
-
|
|
708
|
-
padding: e ===
|
|
724
|
+
function N(e = 40, t = null) {
|
|
725
|
+
let { width: n, height: r, camera: a } = i;
|
|
726
|
+
if (!n || !r) {
|
|
727
|
+
i.nodes.length && (T.waiting = {
|
|
728
|
+
padding: e === P() ? null : e,
|
|
709
729
|
only: t
|
|
710
730
|
});
|
|
711
731
|
return;
|
|
712
732
|
}
|
|
713
|
-
|
|
714
|
-
let o =
|
|
733
|
+
T.waiting = null;
|
|
734
|
+
let o = O(e, t);
|
|
715
735
|
if (!o) return;
|
|
716
|
-
let { minX: s, maxX: c, minY: l, maxY: u, mapHeight: d } = o, f = Math.min(1, Math.max(
|
|
717
|
-
a.zoom = f, a.x = n / 2 - (s + c) / 2 * f, a.y = d / 2 - (l + u) / 2 * f,
|
|
736
|
+
let { minX: s, maxX: c, minY: l, maxY: u, mapHeight: d } = o, f = Math.min(1, Math.max(A, o.raw));
|
|
737
|
+
a.zoom = f, a.x = n / 2 - (s + c) / 2 * f, a.y = d / 2 - (l + u) / 2 * f, T.lastFit = {
|
|
718
738
|
padding: e,
|
|
719
|
-
auto: e ===
|
|
739
|
+
auto: e === P(),
|
|
720
740
|
only: t,
|
|
721
741
|
x: a.x,
|
|
722
742
|
y: a.y,
|
|
723
743
|
zoom: a.zoom
|
|
724
|
-
},
|
|
725
|
-
}
|
|
726
|
-
let
|
|
727
|
-
x: (e -
|
|
728
|
-
y: (t -
|
|
729
|
-
}),
|
|
730
|
-
function
|
|
731
|
-
if (!
|
|
732
|
-
let e =
|
|
733
|
-
|
|
744
|
+
}, U();
|
|
745
|
+
}
|
|
746
|
+
let P = () => i.width < 640 ? 24 : 48, ee = (e, t) => ({
|
|
747
|
+
x: (e - i.camera.x) / i.camera.zoom,
|
|
748
|
+
y: (t - i.camera.y) / i.camera.zoom
|
|
749
|
+
}), F = -1;
|
|
750
|
+
function I() {
|
|
751
|
+
if (!i.canvas) return;
|
|
752
|
+
let e = f();
|
|
753
|
+
F = e.version, y().draw(e, i.camera, performance.now());
|
|
734
754
|
let t = S();
|
|
735
|
-
t && t.draw(e,
|
|
755
|
+
t && t.draw(e, i.camera, { hover: i.hoverNodeId }), z.forEach((t) => t(e, i.camera));
|
|
736
756
|
}
|
|
737
|
-
function
|
|
757
|
+
function L(e, t) {
|
|
738
758
|
let n = S();
|
|
739
759
|
return n ? n.hit(e, t) : null;
|
|
740
760
|
}
|
|
741
|
-
function
|
|
761
|
+
function R(e) {
|
|
742
762
|
let t = e || null;
|
|
743
|
-
if (
|
|
744
|
-
|
|
763
|
+
if (i.hoverNodeId === t) return;
|
|
764
|
+
i.hoverNodeId = t;
|
|
745
765
|
let n = S();
|
|
746
|
-
n &&
|
|
766
|
+
n && i.canvas && i.width && n.draw(f(), i.camera, { hover: t });
|
|
747
767
|
}
|
|
748
|
-
let
|
|
749
|
-
draw:
|
|
750
|
-
packetsVisible: () => !!
|
|
768
|
+
let z = /* @__PURE__ */ new Set(), ne = (e) => (z.add(e), () => z.delete(e)), V = /* @__PURE__ */ new Set(), H = Ge({
|
|
769
|
+
draw: I,
|
|
770
|
+
packetsVisible: () => !!i.canvas && He(f(), i.camera, i.width, i.height),
|
|
751
771
|
isHidden: () => e.hidden(),
|
|
752
772
|
tickClients: (e) => {
|
|
753
773
|
let t = !1;
|
|
754
|
-
return
|
|
774
|
+
return V.forEach((n) => {
|
|
755
775
|
n.tick(e), n.wants() && (t = !0);
|
|
756
776
|
}), t;
|
|
757
777
|
},
|
|
758
|
-
clientsWant: () => [...
|
|
778
|
+
clientsWant: () => [...V].some((e) => e.wants()),
|
|
759
779
|
reduceMotion: () => e.reducedMotion,
|
|
760
|
-
extraDirty: () =>
|
|
780
|
+
extraDirty: () => i.sceneVersion !== F,
|
|
761
781
|
now: () => performance.now(),
|
|
762
782
|
raf: (e) => requestAnimationFrame(e),
|
|
763
783
|
caf: (e) => cancelAnimationFrame(e)
|
|
764
784
|
});
|
|
765
|
-
function
|
|
766
|
-
!
|
|
785
|
+
function U() {
|
|
786
|
+
!s && i.canvas && H.markDirty();
|
|
767
787
|
}
|
|
768
|
-
function
|
|
769
|
-
!
|
|
788
|
+
function W() {
|
|
789
|
+
!s && i.canvas && H.drawNow();
|
|
770
790
|
}
|
|
771
|
-
function
|
|
772
|
-
return
|
|
791
|
+
function re(e) {
|
|
792
|
+
return V.add(e), () => V.delete(e);
|
|
773
793
|
}
|
|
794
|
+
let G = [];
|
|
774
795
|
if (e.root) {
|
|
775
|
-
let t = () =>
|
|
776
|
-
for (let n of
|
|
796
|
+
let t = () => H.noteInput();
|
|
797
|
+
for (let n of dt) G.push(e.listen(e.root, n, t, {
|
|
777
798
|
passive: !0,
|
|
778
799
|
capture: !0
|
|
779
|
-
});
|
|
800
|
+
}));
|
|
780
801
|
}
|
|
781
|
-
e.onShown(() =>
|
|
782
|
-
let e =
|
|
783
|
-
!
|
|
784
|
-
});
|
|
785
|
-
function
|
|
786
|
-
|
|
802
|
+
G.push(e.onShown(() => H.shown())), G.push(e.onShown(() => {
|
|
803
|
+
let e = i.canvas && i.canvas.parentElement;
|
|
804
|
+
!s && e && e.clientWidth && e.clientHeight && (e.clientWidth !== i.width || e.clientHeight !== i.height) && w();
|
|
805
|
+
}));
|
|
806
|
+
function ie() {
|
|
807
|
+
s = !0;
|
|
808
|
+
for (let e of G.splice(0)) e();
|
|
809
|
+
e.map === K && (e.map = null), H.cancel(), _ && (_.release ? _.release() : _.destroy(), _ = null, v = null), b && (b.destroy(), b = null, x = null), z.clear(), V.clear();
|
|
787
810
|
}
|
|
788
811
|
let K = {
|
|
789
|
-
isNodeVisible:
|
|
790
|
-
isNodeVisibleToViewer:
|
|
791
|
-
getActiveSubgraph:
|
|
792
|
-
getScene:
|
|
793
|
-
sceneBuilds:
|
|
794
|
-
getSpatialIndex:
|
|
795
|
-
spatialBuilds:
|
|
812
|
+
isNodeVisible: c,
|
|
813
|
+
isNodeVisibleToViewer: l,
|
|
814
|
+
getActiveSubgraph: u,
|
|
815
|
+
getScene: f,
|
|
816
|
+
sceneBuilds: p,
|
|
817
|
+
getSpatialIndex: h,
|
|
818
|
+
spatialBuilds: g,
|
|
796
819
|
getRenderer: y,
|
|
797
820
|
setRenderer: C,
|
|
798
821
|
resize: w,
|
|
799
|
-
watchSize:
|
|
800
|
-
getMinZoom:
|
|
801
|
-
fitGraphToViewport:
|
|
802
|
-
fitPadding:
|
|
803
|
-
screenToWorld:
|
|
804
|
-
labelNodeAt:
|
|
805
|
-
setHoverNode:
|
|
806
|
-
onPaint:
|
|
807
|
-
render:
|
|
808
|
-
renderNow:
|
|
809
|
-
addFrameClient:
|
|
822
|
+
watchSize: D,
|
|
823
|
+
getMinZoom: M,
|
|
824
|
+
fitGraphToViewport: N,
|
|
825
|
+
fitPadding: P,
|
|
826
|
+
screenToWorld: ee,
|
|
827
|
+
labelNodeAt: L,
|
|
828
|
+
setHoverNode: R,
|
|
829
|
+
onPaint: ne,
|
|
830
|
+
render: U,
|
|
831
|
+
renderNow: W,
|
|
832
|
+
addFrameClient: re,
|
|
810
833
|
queueFrameWork: (e, t) => {
|
|
811
|
-
|
|
834
|
+
s || H.queue(e, t);
|
|
812
835
|
},
|
|
813
836
|
frameStats: () => ({
|
|
814
|
-
frames:
|
|
815
|
-
draws:
|
|
837
|
+
frames: H.frames,
|
|
838
|
+
draws: H.draws
|
|
816
839
|
}),
|
|
817
840
|
holdFrames: (e) => {
|
|
818
|
-
|
|
841
|
+
s || H.hold(e);
|
|
819
842
|
},
|
|
820
|
-
cancelFrame: () =>
|
|
843
|
+
cancelFrame: () => H.cancel(),
|
|
821
844
|
ensureFlowLoop: () => {
|
|
822
|
-
|
|
845
|
+
s || H.wake();
|
|
823
846
|
},
|
|
824
|
-
destroy:
|
|
847
|
+
destroy: ie
|
|
825
848
|
};
|
|
826
|
-
return e.map = K, e.own(
|
|
849
|
+
return e.map = K, e.own(ie), K;
|
|
827
850
|
}
|
|
828
851
|
// ../explorer/flow-build.js
|
|
829
|
-
function
|
|
852
|
+
function pt(e, t) {
|
|
830
853
|
let n = new Map(e.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map();
|
|
831
854
|
t.forEach((e) => {
|
|
832
855
|
!e.kind && !e.dashed && n.get(e.from)?.type === "app" && n.get(e.to)?.type === "page" && r.set(e.to, e.from);
|
|
@@ -914,55 +937,55 @@ function ut(e, t) {
|
|
|
914
937
|
};
|
|
915
938
|
}
|
|
916
939
|
// ../explorer/engine/topology.js
|
|
917
|
-
function
|
|
940
|
+
function mt(e) {
|
|
918
941
|
return {
|
|
919
942
|
nodes: e && Array.isArray(e.nodes) ? e.nodes.filter((e) => e && typeof e.id == "string") : [],
|
|
920
943
|
edges: e && Array.isArray(e.edges) ? e.edges.filter((e) => e && typeof e.from == "string" && typeof e.to == "string") : []
|
|
921
944
|
};
|
|
922
945
|
}
|
|
923
|
-
function
|
|
924
|
-
let { state: n } = e, { nodes: r, edges: i } =
|
|
925
|
-
n.baseNodes = r, n.baseEdges = i, n.nodes = r.map((e) => ({ ...e })), n.edges = i.map((e) => ({ ...e })), n.mapNodes = n.nodes, n.mapEdges = n.edges, n.flow =
|
|
946
|
+
function ht(e, t) {
|
|
947
|
+
let { state: n } = e, { nodes: r, edges: i } = mt(t), a = n.selectedNode ? n.selectedNode.id : null;
|
|
948
|
+
n.baseNodes = r, n.baseEdges = i, n.nodes = r.map((e) => ({ ...e })), n.edges = i.map((e) => ({ ...e })), n.mapNodes = n.nodes, n.mapEdges = n.edges, n.flow = pt(n.nodes, n.edges);
|
|
926
949
|
let o = a && n.nodes.find((e) => e.id === a) || null;
|
|
927
950
|
return o ? (n.selectedEdge = null, n.selectedNode = o) : (n.selectedNode || n.selectedEdge) && (n.selectedNode = null, n.selectedEdge = null), e.touchScene(), n.nodes.length > 0;
|
|
928
951
|
}
|
|
929
|
-
function
|
|
930
|
-
let { state:
|
|
931
|
-
|
|
952
|
+
function gt(t, { placeLive: n } = {}) {
|
|
953
|
+
let { state: r } = t;
|
|
954
|
+
_(t), r.view === "dataflow" && r.flow ? (r.flow.tiers.forEach((e) => e.nodes.forEach((e) => {
|
|
932
955
|
e.r = Math.min(e.r, 13);
|
|
933
|
-
})),
|
|
956
|
+
})), r.proposal && r.baseNodes && vt(t) || e(t, r.flow)) : r.baseNodes && (r.proposal || r.nodes.some((e) => e.live)) ? yt(t, n) : P(t);
|
|
934
957
|
}
|
|
935
|
-
function
|
|
958
|
+
function _t(e, t, n) {
|
|
936
959
|
let { state: r } = e;
|
|
937
|
-
r.mapNodes = t, r.mapEdges = n, r.nodes = t, r.edges = n, r.flow =
|
|
938
|
-
}
|
|
939
|
-
function
|
|
940
|
-
let { state:
|
|
941
|
-
nodes:
|
|
942
|
-
edges:
|
|
943
|
-
},
|
|
944
|
-
|
|
945
|
-
let
|
|
946
|
-
|
|
960
|
+
r.mapNodes = t, r.mapEdges = n, r.nodes = t, r.edges = n, r.flow = pt(t, n), m(r.flow), e.touchScene(), gt(e);
|
|
961
|
+
}
|
|
962
|
+
function vt(t) {
|
|
963
|
+
let { state: n } = t, r = {
|
|
964
|
+
nodes: n.nodes,
|
|
965
|
+
edges: n.edges
|
|
966
|
+
}, i = n.baseNodes.map((e) => ({ ...e }));
|
|
967
|
+
n.nodes = i, n.edges = n.baseEdges, _(t);
|
|
968
|
+
let a = pt(i, n.baseEdges);
|
|
969
|
+
a.tiers.forEach((e) => e.nodes.forEach((e) => {
|
|
947
970
|
e.r = Math.min(e.r, 13);
|
|
948
|
-
})),
|
|
949
|
-
let
|
|
950
|
-
return
|
|
971
|
+
})), e(t, a), n.nodes = r.nodes, n.edges = r.edges;
|
|
972
|
+
let o = h(n.flow, a);
|
|
973
|
+
return t.touchScene(), o;
|
|
951
974
|
}
|
|
952
|
-
function
|
|
975
|
+
function yt(e, t) {
|
|
953
976
|
let { state: n } = e, r = {
|
|
954
977
|
nodes: n.nodes,
|
|
955
978
|
edges: n.edges
|
|
956
979
|
}, i = n.baseNodes.map((e) => ({ ...e }));
|
|
957
|
-
n.nodes = i, n.edges = n.baseEdges,
|
|
980
|
+
n.nodes = i, n.edges = n.baseEdges, _(e), P(e);
|
|
958
981
|
let a = new Map(i.map((e) => [e.id, e]));
|
|
959
|
-
n.nodes = r.nodes, n.edges = r.edges,
|
|
982
|
+
n.nodes = r.nodes, n.edges = r.edges, _(e), n.nodes.forEach((e) => {
|
|
960
983
|
let t = a.get(e.id);
|
|
961
984
|
t && (e.x = t.x, e.y = t.y, e.r = t.r);
|
|
962
|
-
}),
|
|
985
|
+
}), g(n.nodes, n.edges), t && t(n.nodes, n.edges), e.touchScene();
|
|
963
986
|
}
|
|
964
987
|
// ../explorer/shaders.js
|
|
965
|
-
var
|
|
988
|
+
var Q = "#version 300 es\nprecision highp float;\nuniform vec2 u_viewport;\nuniform vec3 u_cam;\nuniform float u_dpr;\n", bt = "\nvec4 toClip(vec2 pos) {\n return vec4(pos.x / u_viewport.x * 2.0 - 1.0, 1.0 - pos.y / u_viewport.y * 2.0, 0.0, 1.0);\n}\n", xt = "\nout vec4 outColor;\n\n// Coverage of one device pixel by the half plane d < 0 (d: signed distance in CSS px, pix: the pixel's size)\nfloat coverEdge(float d, float pix) {\n return clamp(0.5 - d / pix, 0.0, 1.0);\n}\n\n// Coverage of one pixel by a band of half width hw around dist = 0 (dist >= 0: distance from the centre line)\nfloat coverBand(float dist, float hw, float pix) {\n float hi = min(hw, dist + 0.5 * pix);\n float lo = max(-hw, dist - 0.5 * pix);\n return clamp((hi - lo) / pix, 0.0, 1.0);\n}\n\n// Coverage by a dash pattern along an arc (on / off in world units; on <= 0 or off <= 0 is solid)\nfloat coverDash(float arc, float on, float off, float pixWorld) {\n if (on <= 0.0 || off <= 0.0) return 1.0;\n float period = on + off;\n float u = mod(arc - on * 0.5 + period * 0.5, period) - period * 0.5;\n return clamp((on * 0.5 - abs(u)) / pixWorld + 0.5, 0.0, 1.0);\n}\n\n// Straight colour at alpha a, composited over acc (premultiplied)\nvoid over(inout vec4 acc, vec3 rgb, float a) {\n acc = vec4(rgb * a, a) + acc * (1.0 - a);\n}\n\n// What Canvas 2D's shadowBlur gives a disc of radius R at distance len from its centre: a blurred copy\n// of the disc. s is the blur's sigma in CSS px (shadowBlur is in DEVICE px and sigma = blur / 2). A big\n// disc has a straight-edge profile (a logistic stands in for the Gaussian's CDF); a small one is a\n// Gaussian bump whose height is what the blur leaves of it.\nfloat glowDisc(float len, float R, float s) {\n float wide = 1.0 / (1.0 + exp(clamp(1.702 * (len - R) / s, -30.0, 30.0)));\n float narrow = (1.0 - exp(-R * R / (2.0 * s * s))) * exp(-len * len / (2.0 * s * s));\n return mix(narrow, wide, smoothstep(0.5 * s, 2.5 * s, R));\n}\n\n// The normal distribution's CDF, as the same logistic (error under 0.01)\nfloat phi(float x) {\n return 1.0 / (1.0 + exp(clamp(-1.702 * x, -30.0, 30.0)));\n}\n", St = `${Q}
|
|
966
989
|
layout(location = 0) in vec2 a_corner;
|
|
967
990
|
layout(location = 1) in vec4 a_grid; // size, width
|
|
968
991
|
layout(location = 2) in vec4 a_color;
|
|
@@ -975,7 +998,7 @@ void main() {
|
|
|
975
998
|
v_color = a_color;
|
|
976
999
|
gl_Position = vec4(a_corner, 0.0, 1.0);
|
|
977
1000
|
}
|
|
978
|
-
`,
|
|
1001
|
+
`, Ct = `${Q}${xt}
|
|
979
1002
|
in vec2 v_pos;
|
|
980
1003
|
flat in vec4 v_grid;
|
|
981
1004
|
flat in vec4 v_color;
|
|
@@ -988,7 +1011,7 @@ void main() {
|
|
|
988
1011
|
float cover = max(coverBand(dist.x, hw, pix), coverBand(dist.y, hw, pix));
|
|
989
1012
|
outColor = vec4(v_color.rgb * v_color.a, v_color.a) * cover;
|
|
990
1013
|
}
|
|
991
|
-
`,
|
|
1014
|
+
`, wt = `${Q}${bt}
|
|
992
1015
|
layout(location = 0) in vec2 a_corner;
|
|
993
1016
|
layout(location = 1) in vec4 a_rect; // x, y, w, h (world)
|
|
994
1017
|
layout(location = 2) in vec4 a_fill;
|
|
@@ -1012,7 +1035,7 @@ void main() {
|
|
|
1012
1035
|
v_stroke = a_stroke;
|
|
1013
1036
|
gl_Position = toClip(pos);
|
|
1014
1037
|
}
|
|
1015
|
-
`,
|
|
1038
|
+
`, Tt = `${Q}${xt}
|
|
1016
1039
|
in vec2 v_local;
|
|
1017
1040
|
flat in vec2 v_half;
|
|
1018
1041
|
flat in vec2 v_style;
|
|
@@ -1029,7 +1052,7 @@ void main() {
|
|
|
1029
1052
|
over(acc, v_stroke.rgb, v_stroke.a * coverBand(abs(sd), v_style.y * zoom * 0.5, pix));
|
|
1030
1053
|
outColor = acc;
|
|
1031
1054
|
}
|
|
1032
|
-
`,
|
|
1055
|
+
`, Et = `${Q}${bt}
|
|
1033
1056
|
layout(location = 0) in vec2 a_corner;
|
|
1034
1057
|
layout(location = 1) in vec4 a_geom; // x, y, r, width (world)
|
|
1035
1058
|
layout(location = 2) in vec4 a_color;
|
|
@@ -1049,7 +1072,7 @@ void main() {
|
|
|
1049
1072
|
v_dash = a_dash;
|
|
1050
1073
|
gl_Position = toClip(pos);
|
|
1051
1074
|
}
|
|
1052
|
-
`,
|
|
1075
|
+
`, Dt = `${Q}${xt}
|
|
1053
1076
|
in vec2 v_local;
|
|
1054
1077
|
flat in vec4 v_geom;
|
|
1055
1078
|
flat in vec4 v_color;
|
|
@@ -1064,7 +1087,7 @@ void main() {
|
|
|
1064
1087
|
cover *= coverDash(arc, v_dash.x, v_dash.y, pix / zoom);
|
|
1065
1088
|
outColor = vec4(v_color.rgb * v_color.a, v_color.a) * cover;
|
|
1066
1089
|
}
|
|
1067
|
-
`,
|
|
1090
|
+
`, Ot = `${Q}${bt}
|
|
1068
1091
|
layout(location = 0) in vec2 a_corner;
|
|
1069
1092
|
layout(location = 1) in vec4 a_geom; // x, y, r (world), alpha
|
|
1070
1093
|
layout(location = 2) in vec4 a_color; // r, g, b (0..1), glow (px)
|
|
@@ -1092,7 +1115,7 @@ void main() {
|
|
|
1092
1115
|
v_kind = a_kind;
|
|
1093
1116
|
gl_Position = toClip(centre + v_local);
|
|
1094
1117
|
}
|
|
1095
|
-
`,
|
|
1118
|
+
`, kt = `${Q}${xt}
|
|
1096
1119
|
in vec2 v_local;
|
|
1097
1120
|
flat in vec4 v_geom;
|
|
1098
1121
|
flat in vec4 v_color;
|
|
@@ -1145,15 +1168,26 @@ void main() {
|
|
|
1145
1168
|
over(acc, ring.rgb, ring.a * al * coverBand(abs(len - (rw + u_haloGeom[halo].y) * zoom), u_haloGeom[halo].z * zoom * 0.5, pix));
|
|
1146
1169
|
}
|
|
1147
1170
|
|
|
1148
|
-
// Glow: a blurred copy of the disc under it (see glowDisc)
|
|
1149
|
-
float glow = v_color.w;
|
|
1150
|
-
if (glow > 0.0) over(acc, v_color.rgb, v_kind.z * al * glowDisc(len, R, glow * 0.5 / u_dpr));
|
|
1151
|
-
|
|
1152
|
-
// The silhouette, and its white core unless the type's glyph is drawn there (glyphs.js: the icon pass draws it once the node is wide enough)
|
|
1153
1171
|
int shapeCode = int(v_kind.w + 0.5);
|
|
1154
1172
|
bool glyph = shapeCode >= 8;
|
|
1155
1173
|
if (glyph) shapeCode -= 8;
|
|
1156
|
-
|
|
1174
|
+
float shapeCover = coverEdge(sdShape(v_local, R, shapeCode, len), pix); // how much of this pixel the silhouette covers
|
|
1175
|
+
|
|
1176
|
+
// Glow: a blurred copy of the disc under it (see glowDisc), then the silhouette. An opaque fill hides the glow under it: drawn as it always was.
|
|
1177
|
+
// Under a translucent fill the glow is left out, so the fill alone sets what is seen through it, as renderer-canvas2d.js drawNode does (a clip).
|
|
1178
|
+
// Glow and fill are the same colour, so that is ONE layer: the fill in the part of the pixel the silhouette covers, the glow in the rest. Two
|
|
1179
|
+
// layers (the glow times 1 - cover, then the fill times cover) would let the ground through both at the edge: a dark line round a square or a
|
|
1180
|
+
// diamond, whose sides lie inside the glow's disc
|
|
1181
|
+
float glow = v_color.w;
|
|
1182
|
+
if (v_kind.z < 1.0) {
|
|
1183
|
+
float soft = glow > 0.0 ? glowDisc(len, R, glow * 0.5 / u_dpr) : 0.0;
|
|
1184
|
+
over(acc, v_color.rgb, v_kind.z * al * mix(soft, 1.0, shapeCover));
|
|
1185
|
+
} else {
|
|
1186
|
+
if (glow > 0.0) over(acc, v_color.rgb, v_kind.z * al * glowDisc(len, R, glow * 0.5 / u_dpr));
|
|
1187
|
+
over(acc, v_color.rgb, v_kind.z * al * shapeCover);
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
// The white core unless the type's glyph is drawn there (glyphs.js: the icon pass draws it once the node is wide enough)
|
|
1157
1191
|
if (!glyph || 2.0 * R < u_glyphMin) over(acc, u_core.rgb, u_core.a * al * coverEdge(len - R * u_coreRatio, pix));
|
|
1158
1192
|
|
|
1159
1193
|
// Mark: a ring with the look of its own mark (dashed when its dash is set: added), and for removed a
|
|
@@ -1182,7 +1216,7 @@ void main() {
|
|
|
1182
1216
|
|
|
1183
1217
|
outColor = acc;
|
|
1184
1218
|
}
|
|
1185
|
-
`,
|
|
1219
|
+
`, At = "\nvec2 bez(vec2 a, vec2 c, vec2 b, float t) {\n float u = 1.0 - t;\n return u * u * a + 2.0 * u * t * c + t * t * b;\n}\nvec2 bezD(vec2 a, vec2 c, vec2 b, float t) {\n return 2.0 * (1.0 - t) * (c - a) + 2.0 * t * (b - c);\n}\n// Arc length from 0 to t, in world units (midpoint rule, 8 steps: the speed is smooth)\nfloat bezArc(vec2 a, vec2 c, vec2 b, float t) {\n float sum = 0.0;\n for (int j = 0; j < 8; j++) sum += length(bezD(a, c, b, (float(j) + 0.5) * t / 8.0));\n return sum * t / 8.0;\n}\n", jt = "\nvec2 packetPos(vec4 ends, vec4 mot, float timeSec) {\n float k = fract(timeSec * mot.z + mot.w);\n return bez(ends.xy, mot.xy, ends.zw, k);\n}\n", Mt = (e) => `${Q}${At}
|
|
1186
1220
|
#define SEGS ${e}
|
|
1187
1221
|
layout(location = 1) in vec4 a_ends; // x1, y1, x2, y2 (world)
|
|
1188
1222
|
layout(location = 2) in vec4 a_geom; // control x, y (world), width (world), glow blur (px)
|
|
@@ -1224,7 +1258,7 @@ void main() {
|
|
|
1224
1258
|
v_dash = a_dash;
|
|
1225
1259
|
gl_Position = vec4(pos.x / u_viewport.x * 2.0 - 1.0, 1.0 - pos.y / u_viewport.y * 2.0, 0.0, 1.0);
|
|
1226
1260
|
}
|
|
1227
|
-
`,
|
|
1261
|
+
`, Nt = `${Q}${xt}
|
|
1228
1262
|
in float v_across;
|
|
1229
1263
|
in float v_arc;
|
|
1230
1264
|
flat in float v_len;
|
|
@@ -1274,7 +1308,7 @@ void main() {
|
|
|
1274
1308
|
over(acc, v_color.rgb, v_color.a * cover);
|
|
1275
1309
|
outColor = acc;
|
|
1276
1310
|
}
|
|
1277
|
-
`,
|
|
1311
|
+
`, Pt = `${Q}${bt}
|
|
1278
1312
|
layout(location = 0) in vec2 a_corner;
|
|
1279
1313
|
layout(location = 1) in vec4 a_tip; // x, y (world), direction x, y (unit)
|
|
1280
1314
|
layout(location = 2) in vec4 a_color;
|
|
@@ -1294,7 +1328,7 @@ void main() {
|
|
|
1294
1328
|
v_kind = a_kind;
|
|
1295
1329
|
gl_Position = toClip(u_cam.xy + a_tip.xy * zoom + off);
|
|
1296
1330
|
}
|
|
1297
|
-
`,
|
|
1331
|
+
`, Ft = `${Q}${xt}
|
|
1298
1332
|
in vec2 v_local;
|
|
1299
1333
|
flat in vec4 v_color;
|
|
1300
1334
|
flat in float v_kind;
|
|
@@ -1350,7 +1384,7 @@ void main() {
|
|
|
1350
1384
|
}
|
|
1351
1385
|
outColor = vec4(v_color.rgb * v_color.a, v_color.a) * coverEdge(sd, pix);
|
|
1352
1386
|
}
|
|
1353
|
-
`,
|
|
1387
|
+
`, It = `${Q}${bt}${At}${jt}
|
|
1354
1388
|
layout(location = 0) in vec2 a_corner;
|
|
1355
1389
|
layout(location = 1) in vec4 a_ends; // x1, y1, x2, y2 (world)
|
|
1356
1390
|
layout(location = 2) in vec4 a_mot; // control x, y (world), speed (trips per second), phase
|
|
@@ -1371,7 +1405,7 @@ void main() {
|
|
|
1371
1405
|
v_glow = a_glow;
|
|
1372
1406
|
gl_Position = toClip(centre + v_local);
|
|
1373
1407
|
}
|
|
1374
|
-
`,
|
|
1408
|
+
`, Lt = `${Q}${xt}
|
|
1375
1409
|
in vec2 v_local;
|
|
1376
1410
|
flat in vec4 v_size;
|
|
1377
1411
|
flat in vec4 v_color;
|
|
@@ -1386,7 +1420,7 @@ void main() {
|
|
|
1386
1420
|
over(acc, v_color.rgb, v_color.a * coverEdge(len - R, pix));
|
|
1387
1421
|
outColor = acc;
|
|
1388
1422
|
}
|
|
1389
|
-
`,
|
|
1423
|
+
`, Rt = `${Q}${bt}
|
|
1390
1424
|
layout(location = 0) in vec2 a_corner;
|
|
1391
1425
|
layout(location = 1) in vec4 a_geom; // x, y, side (world), alpha
|
|
1392
1426
|
uniform float u_minR; // letters and glyphs: the least on-screen radius (px) of a node that shows them; 0 for a theme's icon
|
|
@@ -1401,7 +1435,7 @@ void main() {
|
|
|
1401
1435
|
v_alpha = a_geom.w;
|
|
1402
1436
|
gl_Position = toClip(pos);
|
|
1403
1437
|
}
|
|
1404
|
-
`,
|
|
1438
|
+
`, zt = `${Q}
|
|
1405
1439
|
uniform sampler2D u_tex;
|
|
1406
1440
|
in vec2 v_uv;
|
|
1407
1441
|
flat in float v_alpha;
|
|
@@ -1409,34 +1443,34 @@ out vec4 outColor;
|
|
|
1409
1443
|
void main() {
|
|
1410
1444
|
outColor = texture(u_tex, v_uv) * v_alpha; // the texture is uploaded premultiplied
|
|
1411
1445
|
}
|
|
1412
|
-
`,
|
|
1446
|
+
`, Bt = {
|
|
1413
1447
|
none: 0,
|
|
1414
1448
|
selected: 1,
|
|
1415
1449
|
match: 2,
|
|
1416
1450
|
child: 3
|
|
1417
|
-
},
|
|
1451
|
+
}, Vt = {
|
|
1418
1452
|
arrow: 1,
|
|
1419
1453
|
strike: 2,
|
|
1420
1454
|
chevron: 3,
|
|
1421
1455
|
bar: 4,
|
|
1422
1456
|
diamond: 5,
|
|
1423
1457
|
tick: 6
|
|
1424
|
-
},
|
|
1458
|
+
}, Ht = Object.freeze(Object.fromEntries(b.map((e, t) => [e, t]))), Ut = {
|
|
1425
1459
|
none: 0,
|
|
1426
1460
|
added: 1,
|
|
1427
1461
|
changed: 2,
|
|
1428
1462
|
removed: 3,
|
|
1429
1463
|
edit: 4
|
|
1430
1464
|
}, $ = (e) => {
|
|
1431
|
-
let [n, r, i
|
|
1465
|
+
let [t, n, r, i] = R(e);
|
|
1432
1466
|
return [
|
|
1467
|
+
t / 255,
|
|
1433
1468
|
n / 255,
|
|
1434
1469
|
r / 255,
|
|
1435
|
-
i
|
|
1436
|
-
a
|
|
1470
|
+
i
|
|
1437
1471
|
];
|
|
1438
|
-
},
|
|
1439
|
-
function
|
|
1472
|
+
}, Wt = (e, t) => Object.hasOwn(e, t) ? e[t] : 0;
|
|
1473
|
+
function Gt(e) {
|
|
1440
1474
|
let { nodes: t } = e, n = new Float32Array(t.length * 12);
|
|
1441
1475
|
return t.forEach((e, t) => {
|
|
1442
1476
|
let [r, i, a, o] = $(e.color);
|
|
@@ -1449,10 +1483,10 @@ function Vt(e) {
|
|
|
1449
1483
|
i,
|
|
1450
1484
|
a,
|
|
1451
1485
|
e.glow || 0,
|
|
1452
|
-
Bt
|
|
1453
|
-
|
|
1486
|
+
Wt(Bt, e.halo),
|
|
1487
|
+
Wt(Ut, e.mark),
|
|
1454
1488
|
o,
|
|
1455
|
-
|
|
1489
|
+
Wt(Ht, e.shape) + (e.glyph && !e.icon && !e.letters ? 8 : 0)
|
|
1456
1490
|
], t * 12);
|
|
1457
1491
|
}), {
|
|
1458
1492
|
data: n,
|
|
@@ -1460,7 +1494,7 @@ function Vt(e) {
|
|
|
1460
1494
|
stride: 12
|
|
1461
1495
|
};
|
|
1462
1496
|
}
|
|
1463
|
-
function
|
|
1497
|
+
function Kt(e) {
|
|
1464
1498
|
let { grid: t, rings: n, lanes: r } = e.decor, i = new Float32Array(t ? 8 : 0);
|
|
1465
1499
|
t && i.set([
|
|
1466
1500
|
t.size,
|
|
@@ -1512,110 +1546,110 @@ function Ht(e) {
|
|
|
1512
1546
|
}
|
|
1513
1547
|
};
|
|
1514
1548
|
}
|
|
1515
|
-
function
|
|
1516
|
-
let
|
|
1549
|
+
function qt(e) {
|
|
1550
|
+
let t = {
|
|
1517
1551
|
straight: [],
|
|
1518
1552
|
curved: [],
|
|
1519
1553
|
tips: [],
|
|
1520
1554
|
packets: []
|
|
1521
1555
|
};
|
|
1522
|
-
|
|
1523
|
-
let [r, i, a
|
|
1556
|
+
e.edges.forEach((e) => {
|
|
1557
|
+
let [n, r, i, a] = $(e.color), o = e.alpha, s = a * o, [c, l] = e.dash && e.dash.length >= 2 ? e.dash : [0, 0], u = e.glow > 0 && !!e.glowColor, [d, f, p, m] = u ? $(e.glowColor) : [
|
|
1524
1558
|
0,
|
|
1525
1559
|
0,
|
|
1526
1560
|
0,
|
|
1527
1561
|
0
|
|
1528
|
-
],
|
|
1529
|
-
if (
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1562
|
+
], h = e.curve ? e.curve.cx : (e.x1 + e.x2) / 2, g = e.curve ? e.curve.cy : (e.y1 + e.y2) / 2, _ = e.mark && e.mark !== "none" ? 1 : 0;
|
|
1563
|
+
if (t[e.curve ? "curved" : "straight"].push([
|
|
1564
|
+
e.x1,
|
|
1565
|
+
e.y1,
|
|
1566
|
+
e.x2,
|
|
1567
|
+
e.y2,
|
|
1568
|
+
h,
|
|
1569
|
+
g,
|
|
1570
|
+
e.width,
|
|
1571
|
+
u ? e.glow : 0,
|
|
1572
|
+
n,
|
|
1538
1573
|
r,
|
|
1539
1574
|
i,
|
|
1540
|
-
|
|
1541
|
-
l,
|
|
1542
|
-
p,
|
|
1543
|
-
m,
|
|
1544
|
-
h,
|
|
1545
|
-
g * l,
|
|
1546
|
-
u,
|
|
1575
|
+
s,
|
|
1547
1576
|
d,
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1577
|
+
f,
|
|
1578
|
+
p,
|
|
1579
|
+
m * s,
|
|
1580
|
+
c,
|
|
1581
|
+
l,
|
|
1582
|
+
_
|
|
1583
|
+
]), e.arrow) {
|
|
1584
|
+
let a = Math.atan2(e.y2 - (e.curve ? e.curve.cy : e.y1), e.x2 - (e.curve ? e.curve.cx : e.x1)), o = e.end && e.end !== "triangle" && Wt(Vt, e.end) || Vt.arrow;
|
|
1585
|
+
t.tips.push([
|
|
1586
|
+
e.x2,
|
|
1587
|
+
e.y2,
|
|
1588
|
+
Math.cos(a),
|
|
1589
|
+
Math.sin(a),
|
|
1590
|
+
n,
|
|
1556
1591
|
r,
|
|
1557
1592
|
i,
|
|
1558
|
-
|
|
1559
|
-
l,
|
|
1593
|
+
s,
|
|
1560
1594
|
o
|
|
1561
1595
|
]);
|
|
1562
1596
|
}
|
|
1563
|
-
if (
|
|
1564
|
-
let
|
|
1565
|
-
for (let
|
|
1566
|
-
let
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1597
|
+
if (e.ticks) {
|
|
1598
|
+
let a = y(e, .5), o = Math.hypot(e.x2 - e.x1, e.y2 - e.y1), [c, l] = o > 0 ? [(e.x2 - e.x1) / o, (e.y2 - e.y1) / o] : [1, 0];
|
|
1599
|
+
for (let o = 0; o < e.ticks; o++) {
|
|
1600
|
+
let u = (o - (e.ticks - 1) / 2) * V.tickGap;
|
|
1601
|
+
t.tips.push([
|
|
1602
|
+
a.x + c * u,
|
|
1603
|
+
a.y + l * u,
|
|
1604
|
+
c,
|
|
1605
|
+
l,
|
|
1606
|
+
n,
|
|
1572
1607
|
r,
|
|
1573
1608
|
i,
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
Lt.tick
|
|
1609
|
+
s,
|
|
1610
|
+
Vt.tick
|
|
1577
1611
|
]);
|
|
1578
1612
|
}
|
|
1579
1613
|
}
|
|
1580
|
-
if (
|
|
1581
|
-
let
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1614
|
+
if (e.mark === "removed") {
|
|
1615
|
+
let a = y(e, .5), o = Math.hypot(e.x2 - e.x1, e.y2 - e.y1), [c, l] = o > 0 ? [(e.x2 - e.x1) / o, (e.y2 - e.y1) / o] : [1, 0];
|
|
1616
|
+
t.tips.push([
|
|
1617
|
+
a.x,
|
|
1618
|
+
a.y,
|
|
1585
1619
|
c,
|
|
1586
|
-
|
|
1620
|
+
l,
|
|
1621
|
+
n,
|
|
1587
1622
|
r,
|
|
1588
1623
|
i,
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
Lt.strike
|
|
1624
|
+
s,
|
|
1625
|
+
Vt.strike
|
|
1592
1626
|
]);
|
|
1593
1627
|
}
|
|
1594
|
-
if (
|
|
1595
|
-
let
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1628
|
+
if (e.packet) {
|
|
1629
|
+
let n = e.packet, [r, i, a, s] = $(n.color), [c, l, u, d] = $(n.glowColor);
|
|
1630
|
+
t.packets.push([
|
|
1631
|
+
e.x1,
|
|
1632
|
+
e.y1,
|
|
1633
|
+
e.x2,
|
|
1634
|
+
e.y2,
|
|
1635
|
+
h,
|
|
1636
|
+
g,
|
|
1637
|
+
n.speed,
|
|
1638
|
+
n.phase,
|
|
1605
1639
|
r,
|
|
1606
1640
|
i,
|
|
1607
1641
|
a,
|
|
1608
|
-
|
|
1609
|
-
|
|
1642
|
+
s * o,
|
|
1643
|
+
c,
|
|
1610
1644
|
l,
|
|
1611
1645
|
u,
|
|
1612
|
-
d *
|
|
1613
|
-
|
|
1614
|
-
|
|
1646
|
+
d * s * o,
|
|
1647
|
+
n.radius,
|
|
1648
|
+
n.glow
|
|
1615
1649
|
]);
|
|
1616
1650
|
}
|
|
1617
1651
|
});
|
|
1618
|
-
let
|
|
1652
|
+
let n = (e, t) => {
|
|
1619
1653
|
let n = new Float32Array(e.length * t);
|
|
1620
1654
|
return e.forEach((e, r) => n.set(e, r * t)), {
|
|
1621
1655
|
data: n,
|
|
@@ -1624,18 +1658,18 @@ function Ut(t) {
|
|
|
1624
1658
|
};
|
|
1625
1659
|
};
|
|
1626
1660
|
return {
|
|
1627
|
-
straight:
|
|
1628
|
-
curved:
|
|
1629
|
-
tips:
|
|
1630
|
-
packets:
|
|
1661
|
+
straight: n(t.straight, 19),
|
|
1662
|
+
curved: n(t.curved, 19),
|
|
1663
|
+
tips: n(t.tips, 9),
|
|
1664
|
+
packets: n(t.packets, 18)
|
|
1631
1665
|
};
|
|
1632
1666
|
}
|
|
1633
|
-
var
|
|
1634
|
-
...
|
|
1635
|
-
nodes:
|
|
1636
|
-
...
|
|
1667
|
+
var Jt = (e) => ({
|
|
1668
|
+
...Kt(e),
|
|
1669
|
+
nodes: Gt(e),
|
|
1670
|
+
...qt(e)
|
|
1637
1671
|
});
|
|
1638
|
-
function
|
|
1672
|
+
function Yt(e) {
|
|
1639
1673
|
let t = [];
|
|
1640
1674
|
e.nodes.forEach((e) => {
|
|
1641
1675
|
if (!e.stroke) return;
|
|
@@ -1660,47 +1694,47 @@ function Gt(e) {
|
|
|
1660
1694
|
stride: 10
|
|
1661
1695
|
};
|
|
1662
1696
|
}
|
|
1663
|
-
function
|
|
1664
|
-
let
|
|
1665
|
-
e.nodes.forEach((
|
|
1666
|
-
let a =
|
|
1667
|
-
if (!a && !
|
|
1668
|
-
let
|
|
1669
|
-
t(
|
|
1697
|
+
function Xt(e, t, n = null) {
|
|
1698
|
+
let r = /* @__PURE__ */ new Map();
|
|
1699
|
+
e.nodes.forEach((i) => {
|
|
1700
|
+
let a = i.icon && t(i.icon) ? i.icon : null, o = i.r * G;
|
|
1701
|
+
if (!a && !i.icon && i.letters && t(de(i.letters)) && (a = de(i.letters), o = i.r * 1), !a && !i.icon && !i.letters && i.glyph) {
|
|
1702
|
+
let r = re(i.glyph, u(i, n, e.theme));
|
|
1703
|
+
t(r) && (a = r, o = i.r * c);
|
|
1670
1704
|
}
|
|
1671
1705
|
if (!a) return;
|
|
1672
|
-
|
|
1706
|
+
r.has(a) || r.set(a, {
|
|
1673
1707
|
rows: [],
|
|
1674
1708
|
minR: Infinity,
|
|
1675
1709
|
maxR: 0
|
|
1676
1710
|
});
|
|
1677
|
-
let s =
|
|
1678
|
-
s.maxR = Math.max(s.maxR,
|
|
1679
|
-
|
|
1680
|
-
|
|
1711
|
+
let s = r.get(a);
|
|
1712
|
+
s.maxR = Math.max(s.maxR, i.r), s.rows.push([
|
|
1713
|
+
i.x,
|
|
1714
|
+
i.y,
|
|
1681
1715
|
o,
|
|
1682
|
-
|
|
1683
|
-
]), s.minR = Math.min(s.minR,
|
|
1716
|
+
i.alpha
|
|
1717
|
+
]), s.minR = Math.min(s.minR, i.r);
|
|
1684
1718
|
});
|
|
1685
|
-
let
|
|
1686
|
-
for (let [e, { rows: t, minR: n, maxR:
|
|
1719
|
+
let i = [], a = [];
|
|
1720
|
+
for (let [e, { rows: t, minR: n, maxR: o }] of r) i.push({
|
|
1687
1721
|
kind: e,
|
|
1688
|
-
first:
|
|
1722
|
+
first: a.length,
|
|
1689
1723
|
count: t.length,
|
|
1690
1724
|
minR: n,
|
|
1691
|
-
maxR:
|
|
1692
|
-
}),
|
|
1693
|
-
let
|
|
1694
|
-
return
|
|
1695
|
-
data:
|
|
1696
|
-
count:
|
|
1725
|
+
maxR: o
|
|
1726
|
+
}), a.push(...t);
|
|
1727
|
+
let o = new Float32Array(a.length * 4);
|
|
1728
|
+
return a.forEach((e, t) => o.set(e, t * 4)), {
|
|
1729
|
+
data: o,
|
|
1730
|
+
count: a.length,
|
|
1697
1731
|
stride: 4,
|
|
1698
|
-
groups:
|
|
1732
|
+
groups: i
|
|
1699
1733
|
};
|
|
1700
1734
|
}
|
|
1701
|
-
function
|
|
1702
|
-
let { halo: n, mark: r, core: i } = t ?
|
|
1703
|
-
Object.entries(
|
|
1735
|
+
function Zt(e = "dark", t = null) {
|
|
1736
|
+
let { halo: n, mark: r, core: i } = t ? M(z(e), t) : z(e), a = /* @__PURE__ */ new Float32Array(16), o = /* @__PURE__ */ new Float32Array(16), s = /* @__PURE__ */ new Float32Array(16);
|
|
1737
|
+
Object.entries(Bt).forEach(([e, t]) => {
|
|
1704
1738
|
let r = n[e];
|
|
1705
1739
|
t && r && (a.set($(r.fill), t * 4), o.set($(r.ring), t * 4), s.set([
|
|
1706
1740
|
r.fillR,
|
|
@@ -1710,7 +1744,7 @@ function qt(e = "dark", t = null) {
|
|
|
1710
1744
|
], t * 4));
|
|
1711
1745
|
});
|
|
1712
1746
|
let c = /* @__PURE__ */ new Float32Array(20), l = /* @__PURE__ */ new Float32Array(20);
|
|
1713
|
-
return Object.entries(
|
|
1747
|
+
return Object.entries(Ut).forEach(([e, t]) => {
|
|
1714
1748
|
if (!t) return;
|
|
1715
1749
|
let n = r[e];
|
|
1716
1750
|
c.set($(n.color), t * 4);
|
|
@@ -1728,19 +1762,19 @@ function qt(e = "dark", t = null) {
|
|
|
1728
1762
|
markColor: c,
|
|
1729
1763
|
markGeom: l,
|
|
1730
1764
|
markMin: new Float32Array([
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1765
|
+
q.ring,
|
|
1766
|
+
q.edge,
|
|
1767
|
+
q.gap
|
|
1734
1768
|
]),
|
|
1735
1769
|
core: new Float32Array($(i)),
|
|
1736
|
-
coreRatio:
|
|
1770
|
+
coreRatio: F
|
|
1737
1771
|
};
|
|
1738
1772
|
}
|
|
1739
|
-
var
|
|
1773
|
+
var Qt = [
|
|
1740
1774
|
{
|
|
1741
1775
|
name: "grid",
|
|
1742
|
-
vert:
|
|
1743
|
-
frag:
|
|
1776
|
+
vert: St,
|
|
1777
|
+
frag: Ct,
|
|
1744
1778
|
stride: 8,
|
|
1745
1779
|
attribs: [[
|
|
1746
1780
|
1,
|
|
@@ -1754,8 +1788,8 @@ var Jt = [
|
|
|
1754
1788
|
},
|
|
1755
1789
|
{
|
|
1756
1790
|
name: "lanes",
|
|
1757
|
-
vert:
|
|
1758
|
-
frag:
|
|
1791
|
+
vert: wt,
|
|
1792
|
+
frag: Tt,
|
|
1759
1793
|
stride: 14,
|
|
1760
1794
|
attribs: [
|
|
1761
1795
|
[
|
|
@@ -1782,8 +1816,8 @@ var Jt = [
|
|
|
1782
1816
|
},
|
|
1783
1817
|
{
|
|
1784
1818
|
name: "rings",
|
|
1785
|
-
vert:
|
|
1786
|
-
frag:
|
|
1819
|
+
vert: Et,
|
|
1820
|
+
frag: Dt,
|
|
1787
1821
|
stride: 10,
|
|
1788
1822
|
attribs: [
|
|
1789
1823
|
[
|
|
@@ -1805,8 +1839,8 @@ var Jt = [
|
|
|
1805
1839
|
},
|
|
1806
1840
|
{
|
|
1807
1841
|
name: "straight",
|
|
1808
|
-
vert:
|
|
1809
|
-
frag:
|
|
1842
|
+
vert: Mt(1),
|
|
1843
|
+
frag: Nt,
|
|
1810
1844
|
stride: 19,
|
|
1811
1845
|
verts: 8,
|
|
1812
1846
|
attribs: [
|
|
@@ -1845,8 +1879,8 @@ var Jt = [
|
|
|
1845
1879
|
},
|
|
1846
1880
|
{
|
|
1847
1881
|
name: "curved",
|
|
1848
|
-
vert:
|
|
1849
|
-
frag:
|
|
1882
|
+
vert: Mt(24),
|
|
1883
|
+
frag: Nt,
|
|
1850
1884
|
stride: 19,
|
|
1851
1885
|
verts: 54,
|
|
1852
1886
|
attribs: [
|
|
@@ -1885,8 +1919,8 @@ var Jt = [
|
|
|
1885
1919
|
},
|
|
1886
1920
|
{
|
|
1887
1921
|
name: "tips",
|
|
1888
|
-
vert:
|
|
1889
|
-
frag:
|
|
1922
|
+
vert: Pt,
|
|
1923
|
+
frag: Ft,
|
|
1890
1924
|
stride: 9,
|
|
1891
1925
|
attribs: [
|
|
1892
1926
|
[
|
|
@@ -1909,8 +1943,8 @@ var Jt = [
|
|
|
1909
1943
|
},
|
|
1910
1944
|
{
|
|
1911
1945
|
name: "packets",
|
|
1912
|
-
vert:
|
|
1913
|
-
frag:
|
|
1946
|
+
vert: It,
|
|
1947
|
+
frag: Lt,
|
|
1914
1948
|
stride: 18,
|
|
1915
1949
|
attribs: [
|
|
1916
1950
|
[
|
|
@@ -1943,8 +1977,8 @@ var Jt = [
|
|
|
1943
1977
|
},
|
|
1944
1978
|
{
|
|
1945
1979
|
name: "nodes",
|
|
1946
|
-
vert:
|
|
1947
|
-
frag:
|
|
1980
|
+
vert: Ot,
|
|
1981
|
+
frag: kt,
|
|
1948
1982
|
stride: 12,
|
|
1949
1983
|
attribs: [
|
|
1950
1984
|
[
|
|
@@ -1965,17 +1999,17 @@ var Jt = [
|
|
|
1965
1999
|
],
|
|
1966
2000
|
constants: "nodes"
|
|
1967
2001
|
}
|
|
1968
|
-
],
|
|
2002
|
+
], $t = {
|
|
1969
2003
|
nodes(e, t, n) {
|
|
1970
|
-
e.uniform4fv(t("u_haloFill"), n.haloFill), e.uniform4fv(t("u_haloRing"), n.haloRing), e.uniform4fv(t("u_haloGeom"), n.haloGeom), e.uniform4fv(t("u_markColor"), n.markColor), e.uniform4fv(t("u_markGeom"), n.markGeom), e.uniform3fv(t("u_markMin"), n.markMin), e.uniform4fv(t("u_core"), n.core), e.uniform1f(t("u_coreRatio"), n.coreRatio), e.uniform4f(t("u_shape"),
|
|
2004
|
+
e.uniform4fv(t("u_haloFill"), n.haloFill), e.uniform4fv(t("u_haloRing"), n.haloRing), e.uniform4fv(t("u_haloGeom"), n.haloGeom), e.uniform4fv(t("u_markColor"), n.markColor), e.uniform4fv(t("u_markGeom"), n.markGeom), e.uniform3fv(t("u_markMin"), n.markMin), e.uniform4fv(t("u_core"), n.core), e.uniform1f(t("u_coreRatio"), n.coreRatio), e.uniform4f(t("u_shape"), J.roundedHalf, J.roundedCorner, J.hexInradius, J.squareHalf), e.uniform2f(t("u_shape2"), J.squareCorner, J.diamondHalf), e.uniform1f(t("u_glyphMin"), 14);
|
|
1971
2005
|
},
|
|
1972
2006
|
edges(e, t, n) {
|
|
1973
2007
|
e.uniform3fv(t("u_markMin"), n.markMin);
|
|
1974
2008
|
},
|
|
1975
2009
|
tips(e, t) {
|
|
1976
|
-
e.uniform4f(t("u_tip"),
|
|
2010
|
+
e.uniform4f(t("u_tip"), N.length, N.spread, W.halfLength, W.width), e.uniform4f(t("u_end"), V.strokeWidth, V.barHalf, V.diamondHalf, V.diamondAcross), e.uniform2f(t("u_tick"), V.tickHalf, V.tickWidth);
|
|
1977
2011
|
}
|
|
1978
|
-
},
|
|
2012
|
+
}, en = {
|
|
1979
2013
|
alpha: !0,
|
|
1980
2014
|
premultipliedAlpha: !0,
|
|
1981
2015
|
antialias: !1,
|
|
@@ -1984,7 +2018,7 @@ var Jt = [
|
|
|
1984
2018
|
preserveDrawingBuffer: !1,
|
|
1985
2019
|
powerPreference: "high-performance"
|
|
1986
2020
|
};
|
|
1987
|
-
function
|
|
2021
|
+
function tn(e, t, n, r) {
|
|
1988
2022
|
let i = e.createShader(t);
|
|
1989
2023
|
if (e.shaderSource(i, n), e.compileShader(i), !e.getShaderParameter(i, e.COMPILE_STATUS)) {
|
|
1990
2024
|
let t = e.getShaderInfoLog(i);
|
|
@@ -1992,23 +2026,23 @@ function Zt(e, t, n, r) {
|
|
|
1992
2026
|
}
|
|
1993
2027
|
return i;
|
|
1994
2028
|
}
|
|
1995
|
-
function
|
|
1996
|
-
let i =
|
|
2029
|
+
function nn(e, t, n, r) {
|
|
2030
|
+
let i = tn(e, e.VERTEX_SHADER, t, `${r} vertex`), a = tn(e, e.FRAGMENT_SHADER, n, `${r} fragment`), o = e.createProgram();
|
|
1997
2031
|
if (e.attachShader(o, i), e.attachShader(o, a), e.linkProgram(o), e.deleteShader(i), e.deleteShader(a), !e.getProgramParameter(o, e.LINK_STATUS)) {
|
|
1998
2032
|
let t = e.getProgramInfoLog(o);
|
|
1999
2033
|
throw e.deleteProgram(o), Error(`${r} program did not link: ${t}`);
|
|
2000
2034
|
}
|
|
2001
2035
|
return o;
|
|
2002
2036
|
}
|
|
2003
|
-
var
|
|
2004
|
-
function
|
|
2005
|
-
let i =
|
|
2037
|
+
var rn = (e) => !e || e.plain ? 0 : e.version;
|
|
2038
|
+
function an(e, t, n, r = null) {
|
|
2039
|
+
let i = Zt(n, r);
|
|
2006
2040
|
t.passes.forEach((t) => {
|
|
2007
|
-
t.spec.constants && (e.useProgram(t.program),
|
|
2008
|
-
}), t.theme = n, t.styleKey =
|
|
2041
|
+
t.spec.constants && (e.useProgram(t.program), $t[t.spec.constants](e, t.at, i));
|
|
2042
|
+
}), t.theme = n, t.styleKey = rn(r);
|
|
2009
2043
|
}
|
|
2010
|
-
function
|
|
2011
|
-
let r =
|
|
2044
|
+
function on(e, t, n) {
|
|
2045
|
+
let r = nn(e, t.vert, t.frag, t.name), i = e.createVertexArray(), a = e.createBuffer();
|
|
2012
2046
|
e.bindVertexArray(i), t.verts || (e.bindBuffer(e.ARRAY_BUFFER, n), e.enableVertexAttribArray(0), e.vertexAttribPointer(0, 2, e.FLOAT, !1, 0, 0), e.vertexAttribDivisor(0, 0)), e.bindBuffer(e.ARRAY_BUFFER, a), t.attribs.forEach(([n, r, i]) => {
|
|
2013
2047
|
e.enableVertexAttribArray(n), e.vertexAttribPointer(n, r, e.FLOAT, !1, t.stride * 4, i * 4), e.vertexAttribDivisor(n, 1);
|
|
2014
2048
|
}), e.bindVertexArray(null);
|
|
@@ -2028,11 +2062,11 @@ function tn(e, t, n) {
|
|
|
2028
2062
|
}
|
|
2029
2063
|
};
|
|
2030
2064
|
}
|
|
2031
|
-
var
|
|
2065
|
+
var sn = {
|
|
2032
2066
|
strokes: {
|
|
2033
2067
|
name: "strokes",
|
|
2034
|
-
vert:
|
|
2035
|
-
frag:
|
|
2068
|
+
vert: Et,
|
|
2069
|
+
frag: Dt,
|
|
2036
2070
|
stride: 10,
|
|
2037
2071
|
attribs: [
|
|
2038
2072
|
[
|
|
@@ -2054,8 +2088,8 @@ var nn = {
|
|
|
2054
2088
|
},
|
|
2055
2089
|
icons: {
|
|
2056
2090
|
name: "icons",
|
|
2057
|
-
vert:
|
|
2058
|
-
frag:
|
|
2091
|
+
vert: Rt,
|
|
2092
|
+
frag: zt,
|
|
2059
2093
|
stride: 4,
|
|
2060
2094
|
attribs: [[
|
|
2061
2095
|
1,
|
|
@@ -2064,7 +2098,7 @@ var nn = {
|
|
|
2064
2098
|
]]
|
|
2065
2099
|
}
|
|
2066
2100
|
};
|
|
2067
|
-
function
|
|
2101
|
+
function cn(e, t = "dark", n = null) {
|
|
2068
2102
|
let r = e.createBuffer();
|
|
2069
2103
|
e.bindBuffer(e.ARRAY_BUFFER, r), e.bufferData(e.ARRAY_BUFFER, new Float32Array([
|
|
2070
2104
|
-1,
|
|
@@ -2078,7 +2112,7 @@ function rn(e, t = "dark", n = null) {
|
|
|
2078
2112
|
]), e.STATIC_DRAW);
|
|
2079
2113
|
let i = {
|
|
2080
2114
|
corners: r,
|
|
2081
|
-
passes:
|
|
2115
|
+
passes: Qt.map((t) => on(e, t, r)),
|
|
2082
2116
|
theme: t,
|
|
2083
2117
|
styleKey: 0,
|
|
2084
2118
|
extras: {
|
|
@@ -2088,41 +2122,41 @@ function rn(e, t = "dark", n = null) {
|
|
|
2088
2122
|
textures: /* @__PURE__ */ new Map(),
|
|
2089
2123
|
iconStore: null
|
|
2090
2124
|
};
|
|
2091
|
-
return
|
|
2125
|
+
return an(e, i, t, n), i;
|
|
2092
2126
|
}
|
|
2093
|
-
function
|
|
2127
|
+
function ln(e, t) {
|
|
2094
2128
|
e.deleteBuffer(t.corners), t.textures.forEach(({ texture: t }) => e.deleteTexture(t)), [...t.passes, ...Object.values(t.extras).filter(Boolean)].forEach((t) => {
|
|
2095
2129
|
e.deleteProgram(t.program), e.deleteVertexArray(t.vao), e.deleteBuffer(t.buffer);
|
|
2096
2130
|
});
|
|
2097
2131
|
}
|
|
2098
|
-
function
|
|
2099
|
-
let n = t.gl || e.getContext("webgl2",
|
|
2132
|
+
function un(e, t = {}) {
|
|
2133
|
+
let n = t.gl || e.getContext("webgl2", en);
|
|
2100
2134
|
if (!n) throw Error("WebGL2 is not available");
|
|
2101
|
-
let r = t.mapStyle || (() =>
|
|
2135
|
+
let r = t.mapStyle || (() => L), i = {
|
|
2102
2136
|
uploads: 0,
|
|
2103
2137
|
draws: 0
|
|
2104
|
-
},
|
|
2105
|
-
function
|
|
2106
|
-
return
|
|
2138
|
+
}, a = cn(n), s = !1, u = 0, d = 0, f = null, p = null, m, h = null, g = null;
|
|
2139
|
+
function _(e) {
|
|
2140
|
+
return a.extras[e] || (a.extras[e] = on(n, sn[e], a.corners)), a.extras[e];
|
|
2107
2141
|
}
|
|
2108
|
-
function
|
|
2109
|
-
|
|
2142
|
+
function v() {
|
|
2143
|
+
a.passes.forEach((e) => {
|
|
2110
2144
|
let t = f[e.spec.name];
|
|
2111
2145
|
e.count = t.count, t.count && (n.bindBuffer(n.ARRAY_BUFFER, e.buffer), n.bufferData(n.ARRAY_BUFFER, t.data, n.DYNAMIC_DRAW));
|
|
2112
2146
|
});
|
|
2113
|
-
for (let e of Object.keys(
|
|
2147
|
+
for (let e of Object.keys(sn)) {
|
|
2114
2148
|
let t = f[e];
|
|
2115
|
-
if (!t.count && !
|
|
2116
|
-
let r =
|
|
2149
|
+
if (!t.count && !a.extras[e]) continue;
|
|
2150
|
+
let r = _(e);
|
|
2117
2151
|
r.count = t.count, t.count && (n.bindBuffer(n.ARRAY_BUFFER, r.buffer), n.bufferData(n.ARRAY_BUFFER, t.data, n.DYNAMIC_DRAW));
|
|
2118
2152
|
}
|
|
2119
2153
|
i.uploads++;
|
|
2120
2154
|
}
|
|
2121
|
-
function
|
|
2155
|
+
function y(e, t) {
|
|
2122
2156
|
n.bindTexture(n.TEXTURE_2D, e), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, t ? n.NEAREST : n.LINEAR_MIPMAP_LINEAR), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, t ? n.NEAREST : n.LINEAR);
|
|
2123
2157
|
}
|
|
2124
|
-
function
|
|
2125
|
-
let i =
|
|
2158
|
+
function b(e, t, r) {
|
|
2159
|
+
let i = a.textures.get(e);
|
|
2126
2160
|
if (!i || i.image !== t) {
|
|
2127
2161
|
i && n.deleteTexture(i.texture);
|
|
2128
2162
|
let r = n.createTexture();
|
|
@@ -2130,92 +2164,92 @@ function on(e, t = {}) {
|
|
|
2130
2164
|
image: t,
|
|
2131
2165
|
texture: r,
|
|
2132
2166
|
pixelated: null
|
|
2133
|
-
},
|
|
2167
|
+
}, a.textures.set(e, i);
|
|
2134
2168
|
}
|
|
2135
|
-
return i.pixelated !== r && (
|
|
2169
|
+
return i.pixelated !== r && (y(i.texture, r), i.pixelated = r), i.texture;
|
|
2136
2170
|
}
|
|
2137
|
-
function
|
|
2138
|
-
if (
|
|
2171
|
+
function x(t, _, y) {
|
|
2172
|
+
if (g = [
|
|
2139
2173
|
t,
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
],
|
|
2143
|
-
let
|
|
2144
|
-
(
|
|
2145
|
-
...
|
|
2146
|
-
strokes:
|
|
2147
|
-
icons:
|
|
2148
|
-
}, p =
|
|
2149
|
-
let
|
|
2150
|
-
(
|
|
2151
|
-
t.count && (n.useProgram(t.program), n.uniform2f(t.uniforms.viewport,
|
|
2174
|
+
_,
|
|
2175
|
+
y
|
|
2176
|
+
], s || !a || !u || !d) return;
|
|
2177
|
+
let x = r(), S = ae(t, x), w = x.values ? x.values[H] : void 0;
|
|
2178
|
+
(a.iconStore !== x.icons || a.glyphInk !== w) && (a.textures.forEach(({ texture: e }) => n.deleteTexture(e)), a.textures.clear(), a.iconStore = x.icons, a.glyphInk = w, p = null), h !== x.ground && (h = x.ground, p = null), (S !== p || S.version !== m) && (f = {
|
|
2179
|
+
...Jt(S),
|
|
2180
|
+
strokes: Yt(S),
|
|
2181
|
+
icons: Xt(S, (e) => fe(e) ? !!ge(pe(e), w) : C(e) ? !!o(l(e).type, l(e).ink) : !!(x.icons && x.icons.get(e)), x)
|
|
2182
|
+
}, p = S, m = S.version, v());
|
|
2183
|
+
let T = S.theme || "dark";
|
|
2184
|
+
(a.theme !== T || a.styleKey !== rn(x)) && an(n, a, T, x), n.viewport(0, 0, e.width, e.height), n.clearColor(0, 0, 0, 0), n.clear(n.COLOR_BUFFER_BIT), n.enable(n.BLEND), n.blendFunc(n.ONE, n.ONE_MINUS_SRC_ALPHA), a.passes.forEach((t) => {
|
|
2185
|
+
t.count && (n.useProgram(t.program), n.uniform2f(t.uniforms.viewport, u, d), n.uniform3f(t.uniforms.cam, _.x, _.y, _.zoom), n.uniform1f(t.uniforms.dpr, e.width / u), n.bindVertexArray(t.vao), t.uniforms.time && n.uniform1f(t.uniforms.time, (y || 0) / 1e3), n.drawArraysInstanced(n.TRIANGLE_STRIP, 0, t.spec.verts || 4, t.count), i.draws++);
|
|
2152
2186
|
});
|
|
2153
|
-
let
|
|
2154
|
-
|
|
2155
|
-
let
|
|
2156
|
-
if (
|
|
2157
|
-
n.useProgram(
|
|
2187
|
+
let E = a.extras.strokes;
|
|
2188
|
+
E && E.count && (n.useProgram(E.program), n.uniform2f(E.uniforms.viewport, u, d), n.uniform3f(E.uniforms.cam, _.x, _.y, _.zoom), n.uniform1f(E.uniforms.dpr, e.width / u), n.bindVertexArray(E.vao), n.drawArraysInstanced(n.TRIANGLE_STRIP, 0, 4, E.count), i.draws++);
|
|
2189
|
+
let D = a.extras.icons;
|
|
2190
|
+
if (D && D.count) {
|
|
2191
|
+
n.useProgram(D.program), n.uniform2f(D.uniforms.viewport, u, d), n.uniform3f(D.uniforms.cam, _.x, _.y, _.zoom), n.uniform1f(D.uniforms.dpr, e.width / u), n.uniform1i(D.at("u_tex"), 0), n.activeTexture(n.TEXTURE0), n.bindVertexArray(D.vao), n.bindBuffer(n.ARRAY_BUFFER, D.buffer);
|
|
2158
2192
|
for (let e of f.icons.groups) {
|
|
2159
|
-
let t =
|
|
2160
|
-
if (
|
|
2161
|
-
n.uniform1f(
|
|
2162
|
-
let s = t ?
|
|
2163
|
-
s && (n.bindTexture(n.TEXTURE_2D,
|
|
2193
|
+
let t = fe(e.kind), r = C(e.kind), a = t || r ? 14 : 0;
|
|
2194
|
+
if (a && e.maxR * 2 * _.zoom < a) continue;
|
|
2195
|
+
n.uniform1f(D.at("u_minR"), a / 2), n.uniform1f(D.at("u_sideRatio"), t ? 1 : r ? c : 1);
|
|
2196
|
+
let s = t ? ge(pe(e.kind), x.values && x.values["--corn-map-glyph"]) : r ? o(l(e.kind).type, l(e.kind).ink) : x.icons && x.icons.get(e.kind);
|
|
2197
|
+
s && (n.bindTexture(n.TEXTURE_2D, b(e.kind, s, !!x.pixelated && !t && !r)), n.vertexAttribPointer(1, 4, n.FLOAT, !1, 16, e.first * 4 * 4), n.drawArraysInstanced(n.TRIANGLE_STRIP, 0, 4, e.count), i.draws++);
|
|
2164
2198
|
}
|
|
2165
2199
|
}
|
|
2166
2200
|
n.bindVertexArray(null);
|
|
2167
2201
|
}
|
|
2168
2202
|
let S = (e) => {
|
|
2169
|
-
e.preventDefault(),
|
|
2170
|
-
},
|
|
2203
|
+
e.preventDefault(), s = !0, a = null;
|
|
2204
|
+
}, w = () => {
|
|
2171
2205
|
try {
|
|
2172
|
-
|
|
2206
|
+
a = cn(n, g && g[0].theme || "dark", r()), s = !1, f && v(), g && x(...g);
|
|
2173
2207
|
} catch (e) {
|
|
2174
2208
|
console.warn("WebGL2 context restored but the renderer could not be rebuilt:", e.message);
|
|
2175
2209
|
}
|
|
2176
2210
|
};
|
|
2177
|
-
return e.addEventListener("webglcontextlost", S), e.addEventListener("webglcontextrestored",
|
|
2211
|
+
return e.addEventListener("webglcontextlost", S), e.addEventListener("webglcontextrestored", w), {
|
|
2178
2212
|
kind: "webgl2",
|
|
2179
2213
|
stats: i,
|
|
2180
2214
|
resize(t, n, r) {
|
|
2181
|
-
|
|
2215
|
+
u = t, d = n, e.width = Math.round(t * r), e.height = Math.round(n * r), g && x(...g);
|
|
2182
2216
|
},
|
|
2183
|
-
draw:
|
|
2184
|
-
destroy:
|
|
2217
|
+
draw: x,
|
|
2218
|
+
destroy: T,
|
|
2185
2219
|
release() {
|
|
2186
|
-
let e =
|
|
2187
|
-
|
|
2220
|
+
let e = s;
|
|
2221
|
+
T();
|
|
2188
2222
|
try {
|
|
2189
2223
|
let t = !e && n.getExtension ? n.getExtension("WEBGL_lose_context") : null;
|
|
2190
2224
|
t && t.loseContext();
|
|
2191
2225
|
} catch {}
|
|
2192
2226
|
}
|
|
2193
2227
|
};
|
|
2194
|
-
function
|
|
2195
|
-
e.removeEventListener("webglcontextlost", S), e.removeEventListener("webglcontextrestored",
|
|
2228
|
+
function T() {
|
|
2229
|
+
e.removeEventListener("webglcontextlost", S), e.removeEventListener("webglcontextrestored", w), a && !s && ln(n, a), a = null, s = !0;
|
|
2196
2230
|
}
|
|
2197
2231
|
}
|
|
2198
2232
|
// ../explorer/renderer.js
|
|
2199
|
-
function
|
|
2233
|
+
function dn(e) {
|
|
2200
2234
|
let t = e.ownerDocument.createElement("canvas");
|
|
2201
2235
|
return t.className = "hx-overlay", t.setAttribute("data-corn", "map-overlay"), t.setAttribute("part", "map-overlay"), t.setAttribute("aria-hidden", "true"), e.after(t), t;
|
|
2202
2236
|
}
|
|
2203
|
-
function
|
|
2237
|
+
function fn(e, t = {}) {
|
|
2204
2238
|
let n = t.prefer || null, r = t.mapStyle ? { mapStyle: t.mapStyle } : {};
|
|
2205
|
-
if (n === "canvas2d") return
|
|
2239
|
+
if (n === "canvas2d") return Fe(e, r);
|
|
2206
2240
|
let i = null;
|
|
2207
2241
|
try {
|
|
2208
|
-
i = e.getContext("webgl2",
|
|
2242
|
+
i = e.getContext("webgl2", en);
|
|
2209
2243
|
} catch {}
|
|
2210
|
-
if (!i) return
|
|
2244
|
+
if (!i) return Fe(e, r);
|
|
2211
2245
|
try {
|
|
2212
|
-
return
|
|
2246
|
+
return un(e, {
|
|
2213
2247
|
gl: i,
|
|
2214
2248
|
...r
|
|
2215
2249
|
});
|
|
2216
2250
|
} catch (n) {
|
|
2217
2251
|
console.warn(`WebGL2 renderer unavailable, drawing with Canvas 2D: ${n.message}`);
|
|
2218
|
-
let i = (t.makeStandIn ||
|
|
2252
|
+
let i = (t.makeStandIn || dn)(e), a = Fe(i, r);
|
|
2219
2253
|
return {
|
|
2220
2254
|
...a,
|
|
2221
2255
|
destroy() {
|
|
@@ -2225,7 +2259,7 @@ function cn(e, t = {}) {
|
|
|
2225
2259
|
}
|
|
2226
2260
|
}
|
|
2227
2261
|
// ../explorer/cluster.js
|
|
2228
|
-
function
|
|
2262
|
+
function pn(e, t) {
|
|
2229
2263
|
let n = /* @__PURE__ */ new Map();
|
|
2230
2264
|
for (let e of t) !e.kind && !e.dashed && e.from && e.to && (n.get(e.from) || n.set(e.from, []).get(e.from)).push(e.to);
|
|
2231
2265
|
let r = /* @__PURE__ */ new Set([e]), i = [e];
|
|
@@ -2233,39 +2267,39 @@ function ln(e, t) {
|
|
|
2233
2267
|
return r;
|
|
2234
2268
|
}
|
|
2235
2269
|
// ../explorer/input.js
|
|
2236
|
-
function
|
|
2237
|
-
let { state: t } = e, { render:
|
|
2270
|
+
function mn(e) {
|
|
2271
|
+
let { state: t } = e, { render: r, getSpatialIndex: i, queueFrameWork: a, screenToWorld: o, getMinZoom: s, setHoverNode: c, labelNodeAt: l, fitGraphToViewport: u, fitPadding: d } = e.map, f = (t) => e.emit("select", t), p = () => e.emit("background"), m = () => e.emit("grab"), h = !1, g = null, _ = {
|
|
2238
2272
|
x: 0,
|
|
2239
2273
|
y: 0
|
|
2240
2274
|
}, y = {
|
|
2241
2275
|
x: 0,
|
|
2242
2276
|
y: 0
|
|
2243
|
-
}, b = !1, x = null, S = null, C = 0, w = null, T = !1, E = null, D = null, O = null,
|
|
2244
|
-
function
|
|
2277
|
+
}, b = !1, x = null, S = null, C = 0, w = null, T = !1, E = null, D = null, O = null, A = !1, j = "", M = () => t.isFreeform && t.view === "orbit";
|
|
2278
|
+
function N(e) {
|
|
2245
2279
|
let n = t.canvas.getBoundingClientRect(), r = e.touches ? e.touches[0] : e, i = n.width && t.width ? t.width / n.width : 1, a = n.height && t.height ? t.height / n.height : 1;
|
|
2246
2280
|
return {
|
|
2247
2281
|
x: (r.clientX - n.left) * i,
|
|
2248
2282
|
y: (r.clientY - n.top) * a
|
|
2249
2283
|
};
|
|
2250
2284
|
}
|
|
2251
|
-
let
|
|
2285
|
+
let P = {
|
|
2252
2286
|
nodes: null,
|
|
2253
2287
|
size: -1,
|
|
2254
2288
|
map: null
|
|
2255
2289
|
};
|
|
2256
|
-
function
|
|
2257
|
-
return (
|
|
2290
|
+
function ee(e) {
|
|
2291
|
+
return (P.nodes !== t.nodes || P.size !== t.nodes.length) && (P = {
|
|
2258
2292
|
nodes: t.nodes,
|
|
2259
2293
|
size: t.nodes.length,
|
|
2260
2294
|
map: new Map(t.nodes.map((e) => [e.id, e]))
|
|
2261
|
-
}),
|
|
2295
|
+
}), P.map.get(e) || null;
|
|
2262
2296
|
}
|
|
2263
|
-
function F(e, n,
|
|
2264
|
-
let a =
|
|
2265
|
-
return a ?
|
|
2297
|
+
function F(e, n, r) {
|
|
2298
|
+
let a = Re(i(), t.camera, e, n, r);
|
|
2299
|
+
return a ? ee(a.id) : null;
|
|
2266
2300
|
}
|
|
2267
|
-
let
|
|
2268
|
-
function
|
|
2301
|
+
let I = (e) => Math.hypot(e.touches[0].clientX - e.touches[1].clientX, e.touches[0].clientY - e.touches[1].clientY);
|
|
2302
|
+
function L(e) {
|
|
2269
2303
|
let n = t.canvas.getBoundingClientRect();
|
|
2270
2304
|
return {
|
|
2271
2305
|
x: (e.touches[0].clientX + e.touches[1].clientX) / 2 - n.left,
|
|
@@ -2273,130 +2307,131 @@ function un(e) {
|
|
|
2273
2307
|
};
|
|
2274
2308
|
}
|
|
2275
2309
|
function R(e) {
|
|
2276
|
-
if (T = !0, m(),
|
|
2277
|
-
w =
|
|
2310
|
+
if (T = !0, m(), c(null), e.touches && e.touches.length === 2) {
|
|
2311
|
+
w = n(t.camera, I(e), L(e)), E = null, h = !1, g = null, x = null;
|
|
2278
2312
|
return;
|
|
2279
2313
|
}
|
|
2280
|
-
let
|
|
2314
|
+
let r = !!(e.touches && e.touches.length > 0), i = N(e);
|
|
2281
2315
|
y = {
|
|
2282
|
-
x:
|
|
2283
|
-
y:
|
|
2284
|
-
}, b = !1, E = null, x = F(
|
|
2316
|
+
x: i.x,
|
|
2317
|
+
y: i.y
|
|
2318
|
+
}, b = !1, E = null, x = F(i.x, i.y, r), M() && x ? (g = x, e.cancelable && e.preventDefault()) : (h = !0, _ = i);
|
|
2285
2319
|
}
|
|
2286
|
-
function
|
|
2287
|
-
D && w && Object.assign(t.camera,
|
|
2320
|
+
function z() {
|
|
2321
|
+
D && w && Object.assign(t.camera, v(w, D.dist, D.mid, s())), D = null;
|
|
2288
2322
|
let n = E;
|
|
2289
2323
|
if (E = null, n) {
|
|
2290
|
-
if (
|
|
2291
|
-
let r =
|
|
2292
|
-
|
|
2324
|
+
if (g && M()) {
|
|
2325
|
+
let r = o(n.x, n.y);
|
|
2326
|
+
g.x = r.x, g.y = r.y, t.freeformPositions[g.id] = {
|
|
2293
2327
|
x: r.x,
|
|
2294
2328
|
y: r.y
|
|
2295
|
-
}, e.touchScene(),
|
|
2296
|
-
} else
|
|
2329
|
+
}, e.touchScene(), K(e);
|
|
2330
|
+
} else h && (t.camera.x += n.x - _.x, t.camera.y += n.y - _.y, _ = n);
|
|
2297
2331
|
}
|
|
2298
2332
|
}
|
|
2299
|
-
function
|
|
2333
|
+
function B() {
|
|
2300
2334
|
let e = O;
|
|
2301
|
-
if (O = null, !e ||
|
|
2335
|
+
if (O = null, !e || h || g) return;
|
|
2302
2336
|
let t = F(e.x, e.y, !1);
|
|
2303
|
-
|
|
2337
|
+
te(!!t), c(t ? t.id : null);
|
|
2304
2338
|
}
|
|
2305
|
-
function
|
|
2306
|
-
e !==
|
|
2339
|
+
function te(e) {
|
|
2340
|
+
e !== A && t.canvas && (e && (j = t.canvas.style.cursor), A = e, t.canvas.style.cursor = e ? "pointer" : j);
|
|
2307
2341
|
}
|
|
2308
|
-
function
|
|
2342
|
+
function ne(e) {
|
|
2309
2343
|
if (e.touches && e.touches.length === 2 && w) {
|
|
2310
2344
|
e.cancelable && e.preventDefault(), D = {
|
|
2311
|
-
dist:
|
|
2312
|
-
mid:
|
|
2313
|
-
},
|
|
2345
|
+
dist: I(e),
|
|
2346
|
+
mid: L(e)
|
|
2347
|
+
}, a(z);
|
|
2314
2348
|
return;
|
|
2315
2349
|
}
|
|
2316
|
-
let t =
|
|
2317
|
-
Math.hypot(t.x - y.x, t.y - y.y) > 8 && (b = !0),
|
|
2350
|
+
let t = N(e);
|
|
2351
|
+
Math.hypot(t.x - y.x, t.y - y.y) > 8 && (b = !0), g && M() || h ? (e.cancelable && e.preventDefault(), E = t, a(z)) : e.touches || (O = t, a(B, { draw: !1 }));
|
|
2318
2352
|
}
|
|
2319
2353
|
function V(e) {
|
|
2320
|
-
|
|
2354
|
+
z();
|
|
2321
2355
|
let n = !!(e.changedTouches && e.changedTouches.length > 0), r = t.canvas.getBoundingClientRect(), i = n ? {
|
|
2322
2356
|
x: e.changedTouches[0].clientX - r.left,
|
|
2323
2357
|
y: e.changedTouches[0].clientY - r.top
|
|
2324
|
-
} :
|
|
2358
|
+
} : N(e);
|
|
2325
2359
|
if (!b && T) {
|
|
2326
2360
|
if (x) {
|
|
2327
2361
|
let e = F(i.x, i.y, n);
|
|
2328
2362
|
if (e && e.id === x.id) {
|
|
2329
|
-
if (!
|
|
2363
|
+
if (!M()) f(x);
|
|
2330
2364
|
else {
|
|
2331
2365
|
let e = Date.now();
|
|
2332
2366
|
S && S.id === x.id && e - C < 380 ? (f(x), S = null, C = 0) : (S = x, C = e);
|
|
2333
2367
|
}
|
|
2334
2368
|
}
|
|
2335
2369
|
} else {
|
|
2336
|
-
let e =
|
|
2337
|
-
e &&
|
|
2370
|
+
let e = ee(l(i.x, i.y));
|
|
2371
|
+
e && k.includes(e.type) && e.id !== "root" ? u(d(), pn(e.id, t.edges)) : t.selectedNode && p();
|
|
2338
2372
|
}
|
|
2339
2373
|
}
|
|
2340
|
-
|
|
2341
|
-
}
|
|
2342
|
-
let { canvas: H } = t,
|
|
2343
|
-
if (
|
|
2344
|
-
|
|
2345
|
-
let i =
|
|
2346
|
-
Object.assign(t.camera,
|
|
2347
|
-
},
|
|
2374
|
+
h = !1, g = null, x = null, w = null, D = null, T = !1;
|
|
2375
|
+
}
|
|
2376
|
+
let { canvas: H } = t, U = !(e.root && e.root.nodeType === 9), W = (n) => {
|
|
2377
|
+
if (U && !n.ctrlKey && !n.metaKey && e.active() !== t.canvas) return;
|
|
2378
|
+
n.preventDefault(), m();
|
|
2379
|
+
let i = N(n);
|
|
2380
|
+
Object.assign(t.camera, ce(t.camera, n.deltaY < 0 ? 1.12 : .88, i.x, i.y, s())), r();
|
|
2381
|
+
}, re = e.root || H, G = [
|
|
2348
2382
|
e.listen(H, "mousedown", R),
|
|
2349
|
-
e.listen(H, "mousemove",
|
|
2383
|
+
e.listen(H, "mousemove", ne),
|
|
2350
2384
|
e.listen(H, "mouseleave", () => {
|
|
2351
|
-
O = null,
|
|
2385
|
+
O = null, te(!1), c(null);
|
|
2352
2386
|
}),
|
|
2353
|
-
e.listen(
|
|
2387
|
+
e.listen(re, "mouseup", V),
|
|
2354
2388
|
e.listen(H, "touchstart", R, { passive: !1 }),
|
|
2355
|
-
e.listen(H, "touchmove",
|
|
2356
|
-
e.listen(
|
|
2357
|
-
e.listen(
|
|
2358
|
-
e.listen(H, "wheel",
|
|
2389
|
+
e.listen(H, "touchmove", ne, { passive: !1 }),
|
|
2390
|
+
e.listen(re, "touchend", V, { passive: !1 }),
|
|
2391
|
+
e.listen(re, "touchcancel", V, { passive: !1 }),
|
|
2392
|
+
e.listen(H, "wheel", W, { passive: !1 })
|
|
2359
2393
|
];
|
|
2360
2394
|
return () => G.forEach((e) => e());
|
|
2361
2395
|
}
|
|
2362
2396
|
// ../explorer/pieces/map.js
|
|
2363
|
-
var
|
|
2364
|
-
<p id="map-keys-help" class="hx-sr-only">${
|
|
2397
|
+
var hn = "Arrow keys pan, plus and minus zoom, 0 fits the map. N and P select the next and the previous node, Home and End the first and the last. F frames the selected node and what it lights. Escape clears the selection.", gn = "<canvas id=\"graph-canvas\" data-corn=\"map-canvas\" tabindex=\"0\" role=\"application\" aria-roledescription=\"map\" aria-label=\"Topology map\" aria-describedby=\"map-keys-help\"></canvas>", _n = ({ keysHelp: e = hn } = {}) => ({ stage: `${gn}
|
|
2398
|
+
<p id="map-keys-help" class="hx-sr-only">${d(e)}</p>
|
|
2365
2399
|
<p id="map-announcer" class="hx-sr-only" role="status" aria-live="polite"></p>
|
|
2366
2400
|
<canvas id="label-canvas" data-corn="label-canvas" aria-hidden="true"></canvas>` });
|
|
2367
|
-
function
|
|
2368
|
-
let r =
|
|
2401
|
+
function vn(e, t, n) {
|
|
2402
|
+
let r = a(t, e, "<div data-corn=\"map-stage\"></div>", null, "stage"), i = n.mountStatus(r[0], t, { follow: !1 });
|
|
2369
2403
|
i.refuse("second-map"), t.emit("piece:refused", {
|
|
2370
2404
|
piece: "map",
|
|
2371
2405
|
reason: "second-map",
|
|
2372
2406
|
message: "A scope holds one map.",
|
|
2373
2407
|
host: e.nodeType === 11 ? e.host : e
|
|
2374
2408
|
});
|
|
2375
|
-
let
|
|
2409
|
+
let o = () => {};
|
|
2376
2410
|
return {
|
|
2377
2411
|
inst: t,
|
|
2378
2412
|
refused: !0,
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2413
|
+
selection: () => null,
|
|
2414
|
+
update: o,
|
|
2415
|
+
fit: o,
|
|
2416
|
+
refresh: o,
|
|
2382
2417
|
focusNode: () => !1,
|
|
2383
|
-
applyTheme:
|
|
2418
|
+
applyTheme: o,
|
|
2384
2419
|
destroy() {
|
|
2385
2420
|
i.destroy();
|
|
2386
2421
|
for (let e of r) e.remove();
|
|
2387
2422
|
}
|
|
2388
2423
|
};
|
|
2389
2424
|
}
|
|
2390
|
-
function
|
|
2425
|
+
function yn(e) {
|
|
2391
2426
|
let t = e.nodeType === 11 ? e.host : e;
|
|
2392
2427
|
return t && typeof t.getRootNode == "function" ? t.getRootNode() : null;
|
|
2393
2428
|
}
|
|
2394
|
-
function
|
|
2395
|
-
return !t && n.src !== void 0 && n.src !== null && n.src !== "" ?
|
|
2429
|
+
function bn(e, t, n = {}) {
|
|
2430
|
+
return !t && n.src !== void 0 && n.src !== null && n.src !== "" ? xn(e, n) : Sn(e, t, n, null);
|
|
2396
2431
|
}
|
|
2397
|
-
function
|
|
2432
|
+
function xn(e, t) {
|
|
2398
2433
|
let n = e.nodeType === 11 ? e.host : e, r = {}, i = null, a = !1;
|
|
2399
|
-
return import("./scope-
|
|
2434
|
+
return import("./scope-CqPbHcKL.js").then((e) => e.n).then(({ mountScope: o }) => {
|
|
2400
2435
|
if (a) return;
|
|
2401
2436
|
let s = o(n, {
|
|
2402
2437
|
src: t.src,
|
|
@@ -2408,7 +2443,7 @@ function _n(e, t) {
|
|
|
2408
2443
|
onAuth: t.onAuth,
|
|
2409
2444
|
onError: t.onError
|
|
2410
2445
|
});
|
|
2411
|
-
i =
|
|
2446
|
+
i = Sn(e, s.instance, {
|
|
2412
2447
|
...t,
|
|
2413
2448
|
...r
|
|
2414
2449
|
}, s);
|
|
@@ -2424,6 +2459,9 @@ function _n(e, t) {
|
|
|
2424
2459
|
get map() {
|
|
2425
2460
|
return i ? i.map : null;
|
|
2426
2461
|
},
|
|
2462
|
+
selection() {
|
|
2463
|
+
return i ? i.selection() : null;
|
|
2464
|
+
},
|
|
2427
2465
|
update(e = {}) {
|
|
2428
2466
|
i ? i.update(e) : Object.assign(r, e);
|
|
2429
2467
|
},
|
|
@@ -2444,178 +2482,192 @@ function _n(e, t) {
|
|
|
2444
2482
|
}
|
|
2445
2483
|
};
|
|
2446
2484
|
}
|
|
2447
|
-
function
|
|
2448
|
-
let
|
|
2449
|
-
|
|
2485
|
+
function Sn(e, t, n, r) {
|
|
2486
|
+
let o = !t;
|
|
2487
|
+
o && (t = p({
|
|
2450
2488
|
root: e,
|
|
2451
|
-
base:
|
|
2452
|
-
fetch:
|
|
2453
|
-
strings:
|
|
2489
|
+
base: n.base || "",
|
|
2490
|
+
fetch: n.fetch,
|
|
2491
|
+
strings: n.strings
|
|
2454
2492
|
}));
|
|
2455
|
-
let
|
|
2456
|
-
if (
|
|
2457
|
-
|
|
2493
|
+
let c = S(t), l = () => {};
|
|
2494
|
+
if (c) try {
|
|
2495
|
+
l = t.attach(e);
|
|
2458
2496
|
} catch {
|
|
2459
|
-
return
|
|
2460
|
-
}
|
|
2461
|
-
let { state:
|
|
2462
|
-
if (
|
|
2463
|
-
let t =
|
|
2464
|
-
t &&
|
|
2465
|
-
}
|
|
2466
|
-
let
|
|
2467
|
-
|
|
2468
|
-
let
|
|
2469
|
-
renderer:
|
|
2470
|
-
theme:
|
|
2497
|
+
return r && r.destroy(), vn(e, t, c);
|
|
2498
|
+
}
|
|
2499
|
+
let { state: u } = t, d = c ? c.source : null;
|
|
2500
|
+
if (n.tokens) {
|
|
2501
|
+
let t = yn(e);
|
|
2502
|
+
t && s(t.nodeType === 9 ? t : t.ownerDocument, n.tokens), t && t.nodeType === 11 && s(t, n.tokens);
|
|
2503
|
+
}
|
|
2504
|
+
let f = i(t);
|
|
2505
|
+
f.own(l), r && f.own(() => r.destroy());
|
|
2506
|
+
let m = (e) => e === "canvas2d" ? "canvas2d" : "auto", h = (e) => e === "light" || e === "dark" ? e : "auto", g = {
|
|
2507
|
+
renderer: m(n.renderer),
|
|
2508
|
+
theme: h(n.theme),
|
|
2471
2509
|
topology: void 0
|
|
2472
|
-
},
|
|
2473
|
-
|
|
2474
|
-
for (let e of [...
|
|
2510
|
+
}, _ = n.topology !== void 0 && n.topology !== null, v = !1, y = !1, b = _n({ keysHelp: n.keysHelp }).stage, x = n.slots && n.slots.stage ? n.slots : null, C = a(t, e, x ? b : `<div data-corn="map-stage">${b}</div>`, x, "stage"), T = (e) => C.map((t) => t.matches(e) ? t : t.querySelector(e)).find(Boolean);
|
|
2511
|
+
f.own(() => {
|
|
2512
|
+
for (let e of [...C, u.canvas]) e && e.remove();
|
|
2475
2513
|
});
|
|
2476
|
-
let
|
|
2477
|
-
if (
|
|
2478
|
-
let e =
|
|
2479
|
-
|
|
2514
|
+
let D = T("#map-announcer");
|
|
2515
|
+
if (D) {
|
|
2516
|
+
let e = O(t, D);
|
|
2517
|
+
f.on("announce:write", (t) => (e(t), !0));
|
|
2518
|
+
}
|
|
2519
|
+
let k = C.find((e) => e.matches("[data-corn=\"map-stage\"]")) || null;
|
|
2520
|
+
if (d && k) {
|
|
2521
|
+
let e = c.mountStatus(k, t, {
|
|
2522
|
+
onRetry: () => d.load(),
|
|
2480
2523
|
focusMap: () => {
|
|
2481
|
-
|
|
2524
|
+
u.canvas && u.canvas.focus();
|
|
2482
2525
|
}
|
|
2483
2526
|
});
|
|
2484
|
-
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2487
|
-
let
|
|
2488
|
-
|
|
2489
|
-
let
|
|
2490
|
-
prefer:
|
|
2491
|
-
mapStyle:
|
|
2492
|
-
})),
|
|
2493
|
-
function
|
|
2494
|
-
if (
|
|
2495
|
-
if (
|
|
2527
|
+
f.own(e.destroy);
|
|
2528
|
+
}
|
|
2529
|
+
u.canvas = T("[data-corn=\"map-canvas\"]"), u.labelCanvas = T("[data-corn=\"label-canvas\"]"), u.ctx = t.doc.createElement("canvas").getContext("2d");
|
|
2530
|
+
let A = ft(t, n.measureCovered ? { measureCovered: n.measureCovered } : {}), j = te(t);
|
|
2531
|
+
f.own(j.watch()), f.own(j.onChange(() => A.render()));
|
|
2532
|
+
let M = () => g.renderer === "canvas2d" ? "canvas2d" : null, N = () => A.setRenderer(fn(u.canvas, {
|
|
2533
|
+
prefer: M(),
|
|
2534
|
+
mapStyle: j.get
|
|
2535
|
+
})), P = t.win && t.win.matchMedia ? t.win.matchMedia("(prefers-color-scheme: light)") : null;
|
|
2536
|
+
function F() {
|
|
2537
|
+
if (g.theme === "light" || g.theme === "dark") return g.theme;
|
|
2538
|
+
if (c && (c.theme === "light" || c.theme === "dark")) return c.theme;
|
|
2496
2539
|
let e = t.doc && t.doc.documentElement, n = e ? e.getAttribute("data-theme") : null;
|
|
2497
|
-
return n === "light" || n === "dark" ? n :
|
|
2540
|
+
return n === "light" || n === "dark" ? n : ee("system", !!(P && P.matches));
|
|
2498
2541
|
}
|
|
2499
|
-
function
|
|
2500
|
-
if (
|
|
2501
|
-
let e =
|
|
2502
|
-
|
|
2503
|
-
}
|
|
2504
|
-
|
|
2505
|
-
let
|
|
2506
|
-
if (
|
|
2507
|
-
let e = new
|
|
2542
|
+
function I() {
|
|
2543
|
+
if (v) return;
|
|
2544
|
+
let e = F();
|
|
2545
|
+
j.refresh(), u.theme !== e && (u.theme = e, t.touchScene()), A.render();
|
|
2546
|
+
}
|
|
2547
|
+
u.theme = F(), c && f.own(c.serverTheme.adopt(e)), c && (f.on("theme", () => I()), f.on("scope:theme", () => I())), P && P.addEventListener && (P.addEventListener("change", I), f.own(() => P.removeEventListener("change", I)));
|
|
2548
|
+
let L = t.win && t.win.MutationObserver;
|
|
2549
|
+
if (L && t.doc && t.doc.documentElement) {
|
|
2550
|
+
let e = new L(I);
|
|
2508
2551
|
e.observe(t.doc.documentElement, {
|
|
2509
2552
|
attributes: !0,
|
|
2510
2553
|
attributeFilter: ["data-theme", "class"]
|
|
2511
|
-
}),
|
|
2512
|
-
}
|
|
2513
|
-
|
|
2514
|
-
let
|
|
2515
|
-
|
|
2516
|
-
},
|
|
2517
|
-
|
|
2518
|
-
|
|
2554
|
+
}), f.own(() => e.disconnect());
|
|
2555
|
+
}
|
|
2556
|
+
N();
|
|
2557
|
+
let R = () => gt(t), z = () => {
|
|
2558
|
+
u.nodes.length && A.fitGraphToViewport(A.fitPadding());
|
|
2559
|
+
}, B = (e) => u.nodes.find((t) => t.id === e) || null, V = null;
|
|
2560
|
+
f.on("select", (e) => ie(t, e, { source: "tap" })), f.on("background", () => U(t, { source: "tap" })), f.on("grab", () => ne(t)), f.on("selection", ({ node: e, edge: t, source: r }) => {
|
|
2561
|
+
v || ((e || t) && (V = null), n.onSelect && (e ? n.onSelect({
|
|
2519
2562
|
id: e.id,
|
|
2520
2563
|
kind: "node",
|
|
2521
|
-
source:
|
|
2522
|
-
}) : t ?
|
|
2564
|
+
source: r
|
|
2565
|
+
}) : t ? n.onSelect({
|
|
2523
2566
|
id: `${t.from}->${t.to}`,
|
|
2524
2567
|
kind: "edge",
|
|
2525
2568
|
from: t.from,
|
|
2526
2569
|
to: t.to,
|
|
2527
|
-
source:
|
|
2528
|
-
}) :
|
|
2570
|
+
source: r
|
|
2571
|
+
}) : n.onSelect({
|
|
2529
2572
|
id: null,
|
|
2530
2573
|
kind: null,
|
|
2531
|
-
source:
|
|
2574
|
+
source: r
|
|
2532
2575
|
})));
|
|
2533
2576
|
});
|
|
2534
|
-
function
|
|
2535
|
-
let n =
|
|
2536
|
-
return !n ||
|
|
2577
|
+
function H(e) {
|
|
2578
|
+
let n = B(String(e));
|
|
2579
|
+
return !n || v ? !1 : (ie(t, n, {
|
|
2537
2580
|
frame: !0,
|
|
2538
2581
|
source: "api"
|
|
2539
2582
|
}), !0);
|
|
2540
2583
|
}
|
|
2541
|
-
let
|
|
2542
|
-
function
|
|
2543
|
-
let e =
|
|
2544
|
-
|
|
2584
|
+
let W = () => {}, re = !!t.root && t.root.nodeType === 9;
|
|
2585
|
+
function G() {
|
|
2586
|
+
let e = u.canvas, n = [mn(t)];
|
|
2587
|
+
re || n.push(t.listen(e, "pointerdown", (t) => {
|
|
2545
2588
|
if (t.pointerType === "mouse" && e.setPointerCapture) try {
|
|
2546
2589
|
e.setPointerCapture(t.pointerId);
|
|
2547
2590
|
} catch {}
|
|
2548
|
-
})),
|
|
2591
|
+
})), w(t), E(t), n.push(() => w(t)), W = () => n.forEach((e) => e());
|
|
2549
2592
|
}
|
|
2550
|
-
|
|
2551
|
-
!
|
|
2552
|
-
})),
|
|
2553
|
-
let
|
|
2554
|
-
!
|
|
2593
|
+
f.own(A.onPaint(() => {
|
|
2594
|
+
!y && u.nodes.length && (y = !0, n.onReady && n.onReady());
|
|
2595
|
+
})), G(), f.own(() => W());
|
|
2596
|
+
let K = () => {
|
|
2597
|
+
!_ && d && d.topology && d.topology !== g.topology && (g.topology = d.topology, ae(d.topology));
|
|
2555
2598
|
};
|
|
2556
|
-
|
|
2557
|
-
e.state === "ready" &&
|
|
2558
|
-
}),
|
|
2559
|
-
function
|
|
2560
|
-
let n =
|
|
2561
|
-
|
|
2562
|
-
let r = n ?
|
|
2563
|
-
|
|
2564
|
-
let i = !r &&
|
|
2565
|
-
i &&
|
|
2566
|
-
}
|
|
2567
|
-
function
|
|
2599
|
+
d && f.on("source", (e) => {
|
|
2600
|
+
e.state === "ready" && K();
|
|
2601
|
+
}), f.own(A.watchSize()), A.resize();
|
|
2602
|
+
function ae(e) {
|
|
2603
|
+
let n = u.selectedNode ? u.selectedNode.id : null;
|
|
2604
|
+
ht(t, e);
|
|
2605
|
+
let r = n ? B(n) : null;
|
|
2606
|
+
u.nodes.length && (R(), z());
|
|
2607
|
+
let i = !r && V ? B(V) : null;
|
|
2608
|
+
i && ie(t, i, { source: "api" }), A.render(), A.ensureFlowLoop();
|
|
2609
|
+
}
|
|
2610
|
+
function q(e) {
|
|
2568
2611
|
let n = e === "dataflow" ? "dataflow" : "orbit";
|
|
2569
|
-
|
|
2612
|
+
u.view !== n && (u.view = n, t.touchScene(), u.nodes.length && (R(), z(), A.ensureFlowLoop()));
|
|
2570
2613
|
}
|
|
2571
|
-
function
|
|
2572
|
-
let e =
|
|
2573
|
-
e.release ? e.release() : e.destroy(),
|
|
2614
|
+
function oe() {
|
|
2615
|
+
let e = A.getRenderer();
|
|
2616
|
+
e.release ? e.release() : e.destroy(), W();
|
|
2574
2617
|
let n = t.doc.createElement("template");
|
|
2575
|
-
n.innerHTML =
|
|
2618
|
+
n.innerHTML = gn;
|
|
2576
2619
|
let r = n.content.firstElementChild;
|
|
2577
2620
|
r.setAttribute("part", "map-canvas");
|
|
2578
|
-
let i = t.active() ===
|
|
2579
|
-
|
|
2621
|
+
let i = t.active() === u.canvas;
|
|
2622
|
+
u.canvas.replaceWith(r), u.canvas = r, G(), N(), A.resize(), i && r.focus();
|
|
2580
2623
|
}
|
|
2581
|
-
function
|
|
2582
|
-
if (!
|
|
2624
|
+
function se(e = {}) {
|
|
2625
|
+
if (!v) {
|
|
2583
2626
|
if ("renderer" in e) {
|
|
2584
|
-
let t =
|
|
2585
|
-
t !==
|
|
2627
|
+
let t = m(e.renderer);
|
|
2628
|
+
t !== g.renderer && (g.renderer = t, oe());
|
|
2586
2629
|
}
|
|
2587
2630
|
if ("theme" in e) {
|
|
2588
|
-
let t =
|
|
2589
|
-
t !==
|
|
2631
|
+
let t = h(e.theme);
|
|
2632
|
+
t !== g.theme && (g.theme = t, I());
|
|
2590
2633
|
}
|
|
2591
|
-
if ("topology" in e && (
|
|
2634
|
+
if ("topology" in e && (_ = e.topology !== void 0 && e.topology !== null, _ && e.topology !== g.topology ? (g.topology = e.topology, ae(e.topology)) : !_ && d && d.topology ? (g.topology = void 0, K()) : !_ && e.topology !== g.topology && (g.topology = e.topology, ae(e.topology))), "view" in e && q(e.view === "dataflow" ? "dataflow" : "orbit"), "node" in e) {
|
|
2592
2635
|
let n = e.node == null || e.node === "" ? null : String(e.node);
|
|
2593
|
-
if (n === null)
|
|
2636
|
+
if (n === null) V = null, (u.selectedNode || u.selectedEdge) && U(t, { source: "api" });
|
|
2594
2637
|
else {
|
|
2595
|
-
let e =
|
|
2596
|
-
e ?
|
|
2638
|
+
let e = B(n);
|
|
2639
|
+
e ? u.selectedNode && u.selectedNode.id === n || ie(t, e, { source: "api" }) : V = n;
|
|
2597
2640
|
}
|
|
2598
2641
|
}
|
|
2599
2642
|
}
|
|
2600
2643
|
}
|
|
2601
|
-
function
|
|
2602
|
-
|
|
2644
|
+
function ce() {
|
|
2645
|
+
v || (v = !0, f.destroy(), A.destroy(), o && t.destroy());
|
|
2603
2646
|
}
|
|
2604
|
-
let
|
|
2647
|
+
let J = {};
|
|
2605
2648
|
for (let e of [
|
|
2606
2649
|
"topology",
|
|
2607
2650
|
"view",
|
|
2608
2651
|
"node"
|
|
2609
|
-
])
|
|
2610
|
-
return
|
|
2652
|
+
]) n[e] !== void 0 && (J[e] = n[e]);
|
|
2653
|
+
return se(J), K(), I(), f.own(() => t.emit("map:gone")), t.emit("map:ready"), {
|
|
2611
2654
|
inst: t,
|
|
2612
|
-
map:
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2655
|
+
map: A,
|
|
2656
|
+
selection() {
|
|
2657
|
+
return u.selectedNode ? {
|
|
2658
|
+
id: u.selectedNode.id,
|
|
2659
|
+
kind: "node"
|
|
2660
|
+
} : u.selectedEdge ? {
|
|
2661
|
+
id: `${u.selectedEdge.from}->${u.selectedEdge.to}`,
|
|
2662
|
+
kind: "edge"
|
|
2663
|
+
} : null;
|
|
2664
|
+
},
|
|
2665
|
+
update: se,
|
|
2666
|
+
destroy: ce,
|
|
2667
|
+
fit: z,
|
|
2668
|
+
focusNode: H,
|
|
2669
|
+
refresh: I,
|
|
2670
|
+
applyTheme: (e) => j.applyTheme(e)
|
|
2619
2671
|
};
|
|
2620
2672
|
}
|
|
2621
|
-
export {
|
|
2673
|
+
export { ht as i, gt as n, _t as r, bn as t };
|