@popcorn245/cornfield-components 0.49.0 → 0.50.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/dist/chunks/{_corn-default-tokens-CoghUocx.js → _corn-default-tokens-DfrjTpZt.js} +725 -654
- package/dist/chunks/{corn-map-C9msiSKP.js → corn-map-Bd7PO6yD.js} +451 -412
- package/dist/chunks/{scope-vxRGj-2V.js → scope-HD2C0JDl.js} +89 -89
- package/dist/corn-map.js +1 -1
- package/dist/corn-scope.js +3 -3
- package/dist/index.js +2 -2
- package/dist/manifest.json +13 -13
- package/dist/version.json +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { n as e, r as t, t as n } from "./runtime-DFu6W5g-.js";
|
|
2
|
-
import { $ as r, B as i, C as a, D as o, E as s, F as c, G as l, H as u, I as d, J as f, K as p, L as m, M as h, N as g, O as _, P as v, Q as y, R as b, S as x, T as S, U as C, V as w, W as T, X as E, Z as D, _ as O, a as k, b as A, c as j, ct as M, d as N,
|
|
3
|
-
var K = 96,
|
|
4
|
-
function
|
|
2
|
+
import { $ as r, B as i, C as a, D as o, E as s, F as c, G as l, H as u, I as d, J as f, K as p, L as m, M as h, N as g, O as _, P as v, Q as y, R as b, S as x, T as S, U as C, V as w, W as T, X as E, Z as D, _ as O, a as k, b as A, c as j, ct as M, d as N, et as P, f as F, g as I, h as ee, it as te, j as L, k as R, l as ne, lt as z, m as B, mt as V, nt as H, o as U, p as re, pt as W, q as G, rt as ie, s as ae, t as oe, tt as se, ut as ce, v as le, w as ue, x as de, y as fe, z as pe } from "./_corn-default-tokens-DfrjTpZt.js";
|
|
3
|
+
var K = 96, me = "letters:", he = (e) => `${me}${e}`, ge = (e) => typeof e == "string" && e.startsWith(me), _e = (e) => e.slice(8), ve = (e, t) => !!e.letters && !e.icon && e.r * 2 * t >= 14, ye = /* @__PURE__ */ new Map();
|
|
4
|
+
function be(e, t = null) {
|
|
5
5
|
if (typeof e != "string" || !e) return null;
|
|
6
6
|
let n = `${typeof t == "string" ? t : ""}|${e}`;
|
|
7
|
-
if (
|
|
8
|
-
if (
|
|
7
|
+
if (ye.has(n)) return ye.get(n);
|
|
8
|
+
if (ye.size >= 128) return null;
|
|
9
9
|
let r = null;
|
|
10
10
|
try {
|
|
11
11
|
let n = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(K, K) : typeof document < "u" ? Object.assign(document.createElement("canvas"), {
|
|
@@ -13,20 +13,20 @@ function ve(e, t = null) {
|
|
|
13
13
|
height: K
|
|
14
14
|
}) : null, i = n && n.getContext && n.getContext("2d");
|
|
15
15
|
if (i && i.fillText) {
|
|
16
|
-
i.font = `700 ${e.length > 1 ? 56 : 72}px ${
|
|
16
|
+
i.font = `700 ${e.length > 1 ? 56 : 72}px ${L}`, i.textAlign = "center", i.textBaseline = "middle", i.lineJoin = "round", i.lineWidth = 10;
|
|
17
17
|
let a = typeof t == "string" ? t : f;
|
|
18
|
-
i.strokeStyle =
|
|
18
|
+
i.strokeStyle = P(a) === "#ffffff" ? "rgba(11, 18, 32, 0.92)" : "rgba(255, 255, 255, 0.92)", i.strokeText(e, K / 2, 51), i.fillStyle = a, i.fillText(e, K / 2, 51), r = n;
|
|
19
19
|
}
|
|
20
20
|
} catch {
|
|
21
21
|
r = null;
|
|
22
22
|
}
|
|
23
|
-
return
|
|
23
|
+
return ye.set(n, r), r;
|
|
24
24
|
}
|
|
25
25
|
// ../explorer/renderer-canvas2d.js
|
|
26
|
-
var
|
|
27
|
-
e.beginPath(), e.arc(t, n, r, 0,
|
|
26
|
+
var xe = Math.PI * 2, Se = 1.5, q = (e, t, n, r) => {
|
|
27
|
+
e.beginPath(), e.arc(t, n, r, 0, xe);
|
|
28
28
|
};
|
|
29
|
-
function
|
|
29
|
+
function Ce(e, t, n, r, i) {
|
|
30
30
|
if (t === "rounded-square" || t === "square") {
|
|
31
31
|
let a = i * (t === "square" ? v.squareHalf : v.roundedHalf), o = i * (t === "square" ? v.squareCorner : v.roundedCorner);
|
|
32
32
|
e.beginPath(), e.roundRect ? e.roundRect(n - a, r - a, a * 2, a * 2, o) : e.rect(n - a, r - a, a * 2, a * 2);
|
|
@@ -43,25 +43,25 @@ function xe(e, t, n, r, i) {
|
|
|
43
43
|
e.beginPath(), e.moveTo(n, r - t), e.lineTo(n + t, r), e.lineTo(n, r + t), e.lineTo(n - t, r), e.closePath();
|
|
44
44
|
} else q(e, n, r, i);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function we(e, t, n, r, i) {
|
|
47
47
|
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;
|
|
48
48
|
e.beginPath(), e.strokeStyle = t.color, e.lineWidth = t.width;
|
|
49
49
|
for (let n = Math.floor(a / t.size) * t.size; n < o; n += t.size) e.moveTo(n, s), e.lineTo(n, c);
|
|
50
50
|
for (let n = Math.floor(s / t.size) * t.size; n < c; n += t.size) e.moveTo(a, n), e.lineTo(o, n);
|
|
51
51
|
e.stroke();
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function Te(e, t) {
|
|
54
54
|
e.save(), t.forEach((t) => {
|
|
55
55
|
e.lineWidth = t.width, e.setLineDash(t.dash), e.strokeStyle = t.color, q(e, t.x, t.y, t.r), e.stroke();
|
|
56
56
|
}), e.restore();
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function Ee(e, t) {
|
|
59
59
|
e.save(), t.forEach((t) => {
|
|
60
60
|
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();
|
|
61
61
|
}), e.restore();
|
|
62
62
|
}
|
|
63
|
-
function
|
|
64
|
-
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, g.edge / r) : t.width, e.setLineDash(t.dash || []), t.glow && t.glow * r >=
|
|
63
|
+
function De(e, t, n, r, i = !0) {
|
|
64
|
+
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, g.edge / r) : t.width, e.setLineDash(t.dash || []), t.glow && t.glow * r >= Se) {
|
|
65
65
|
let n = e.lineWidth;
|
|
66
66
|
e.save(), e.globalAlpha = t.alpha * .3, e.strokeStyle = t.glowColor || t.color, e.lineWidth = n + t.glow * .6, e.stroke(), e.restore();
|
|
67
67
|
}
|
|
@@ -69,60 +69,60 @@ function Te(e, t, n, r, i = !0) {
|
|
|
69
69
|
let n = m(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];
|
|
70
70
|
e.beginPath(), e.moveTo(n.x - o * _.halfLength, n.y + a * _.halfLength), e.lineTo(n.x + o * _.halfLength, n.y - a * _.halfLength), e.lineWidth = Math.max(_.width, 1.5 / r), e.stroke();
|
|
71
71
|
}
|
|
72
|
-
if (t.ticks &&
|
|
72
|
+
if (t.ticks && ke(e, t, r), t.arrow) {
|
|
73
73
|
let { cx: n, cy: i } = t.curve || {
|
|
74
74
|
cx: t.x1,
|
|
75
75
|
cy: t.y1
|
|
76
76
|
};
|
|
77
|
-
|
|
77
|
+
Oe(e, t, Math.atan2(t.y2 - i, t.x2 - n), r);
|
|
78
78
|
}
|
|
79
|
-
i && t.packet &&
|
|
79
|
+
i && t.packet && Ae(e, t, n, r), e.restore();
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
let i = t.end || "triangle", { x2: a, y2: o, color: c } = t, l = Math.cos(n), u = Math.sin(n), d = (e, t) => [a - l * e - u * t, o - u * e + l * t], f = Math.max(
|
|
81
|
+
function Oe(e, t, n, r) {
|
|
82
|
+
let i = t.end || "triangle", { x2: a, y2: o, color: c } = t, l = Math.cos(n), u = Math.sin(n), d = (e, t) => [a - l * e - u * t, o - u * e + l * t], f = Math.max(R.strokeWidth, 1.2 / r);
|
|
83
83
|
if (e.beginPath(), i === "triangle") e.moveTo(a, o), e.lineTo(a - Math.cos(n - s.spread) * s.length, o - Math.sin(n - s.spread) * s.length), e.lineTo(a - Math.cos(n + s.spread) * s.length, o - Math.sin(n + s.spread) * s.length), e.closePath(), e.fillStyle = c, e.fill();
|
|
84
84
|
else {
|
|
85
85
|
if (e.strokeStyle = c, e.lineWidth = f, e.lineJoin = "miter", i === "chevron") {
|
|
86
86
|
let t = s.length * Math.cos(s.spread), n = s.length * Math.sin(s.spread);
|
|
87
87
|
e.moveTo(...d(t, n)), e.lineTo(a, o), e.lineTo(...d(t, -n));
|
|
88
|
-
} else if (i === "bar") e.moveTo(...d(f / 2,
|
|
88
|
+
} else if (i === "bar") e.moveTo(...d(f / 2, R.barHalf)), e.lineTo(...d(f / 2, -R.barHalf));
|
|
89
89
|
else {
|
|
90
|
-
let t =
|
|
91
|
-
e.moveTo(a, o), e.lineTo(...d(t,
|
|
90
|
+
let t = R.diamondHalf;
|
|
91
|
+
e.moveTo(a, o), e.lineTo(...d(t, R.diamondAcross)), e.lineTo(...d(2 * t, 0)), e.lineTo(...d(t, -R.diamondAcross)), e.closePath();
|
|
92
92
|
}
|
|
93
93
|
e.stroke();
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function ke(e, t, n) {
|
|
97
97
|
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 = m(t, .5);
|
|
98
98
|
e.beginPath();
|
|
99
99
|
for (let n = 0; n < t.ticks; n++) {
|
|
100
|
-
let r = (n - (t.ticks - 1) / 2) *
|
|
101
|
-
e.moveTo(s - a *
|
|
100
|
+
let r = (n - (t.ticks - 1) / 2) * R.tickGap, s = o.x + i * r, c = o.y + a * r;
|
|
101
|
+
e.moveTo(s - a * R.tickHalf, c + i * R.tickHalf), e.lineTo(s + a * R.tickHalf, c - i * R.tickHalf);
|
|
102
102
|
}
|
|
103
|
-
e.strokeStyle = t.color, e.lineWidth = Math.max(
|
|
103
|
+
e.strokeStyle = t.color, e.lineWidth = Math.max(R.tickWidth, 1.5 / n), e.setLineDash([]), e.stroke();
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function Ae(e, t, n, r) {
|
|
106
106
|
let i = w(t, n), { packet: a } = t;
|
|
107
|
-
a.glow && a.glow * r >=
|
|
107
|
+
a.glow && a.glow * r >= Se && (e.beginPath(), e.arc(i.x, i.y, a.radius + a.glow * .5, 0, xe), 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, xe), e.fillStyle = a.color, e.fill();
|
|
108
108
|
}
|
|
109
|
-
function
|
|
110
|
-
e.save(), e.globalAlpha = t.alpha,
|
|
109
|
+
function je(e, t, n, r) {
|
|
110
|
+
e.save(), e.globalAlpha = t.alpha, Ae(e, t, n, r), e.restore();
|
|
111
111
|
}
|
|
112
|
-
var
|
|
113
|
-
function
|
|
114
|
-
let t =
|
|
112
|
+
var Me = 16, Ne = /* @__PURE__ */ new WeakMap();
|
|
113
|
+
function Pe(e) {
|
|
114
|
+
let t = Ne.get(e);
|
|
115
115
|
return t || (t = new Float64Array(e.edges.length * 4), e.edges.forEach((e, n) => {
|
|
116
|
-
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 +
|
|
116
|
+
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 + Me;
|
|
117
117
|
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;
|
|
118
|
-
}),
|
|
118
|
+
}), Ne.set(e, t)), t;
|
|
119
119
|
}
|
|
120
|
-
function
|
|
121
|
-
let i =
|
|
120
|
+
function Fe(e, t, n, r) {
|
|
121
|
+
let i = Pe(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 = [];
|
|
122
122
|
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]);
|
|
123
123
|
return d;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function Ie(e, t, n, r, i) {
|
|
126
126
|
e.save(), e.globalAlpha = t.alpha;
|
|
127
127
|
let a = r.halo[t.halo];
|
|
128
128
|
a && (a.fill && (q(e, t.x, t.y, t.r + a.fillR), e.fillStyle = a.fill, e.fill()), q(e, t.x, t.y, t.r + a.ringR), e.strokeStyle = a.ring, e.lineWidth = a.ringWidth, e.stroke());
|
|
@@ -131,13 +131,13 @@ function Pe(e, t, n, r, i) {
|
|
|
131
131
|
let r = t.r + Math.max(s.ringR, g.gap / n);
|
|
132
132
|
q(e, t.x, t.y, r), e.strokeStyle = s.color, e.lineWidth = Math.max(s.ringWidth, g.ring / n), e.setLineDash(s.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());
|
|
133
133
|
}
|
|
134
|
-
|
|
135
|
-
let c = t.icon && i.icons ? i.icons.get(t.icon) : null, l = !c &&
|
|
136
|
-
if (u || (q(e, t.x, t.y, t.r * o), e.fillStyle = r.core, e.fill()), t.stroke && (
|
|
137
|
-
let n = t.r *
|
|
134
|
+
Ce(e, t.shape, t.x, t.y, t.r), t.glow && t.glow * n >= Se && (e.save(), e.globalAlpha = t.alpha * .28, q(e, t.x, t.y, t.r + t.glow * .7), e.fillStyle = t.color, e.fill(), e.restore(), Ce(e, t.shape, t.x, t.y, t.r)), e.fillStyle = t.color, e.fill();
|
|
135
|
+
let c = t.icon && i.icons ? i.icons.get(t.icon) : null, l = !c && ve(t, n), u = !c && !l && H(t, n) ? E(t.glyph, D(t, i)) : null;
|
|
136
|
+
if (u || (q(e, t.x, t.y, t.r * o), e.fillStyle = r.core, e.fill()), t.stroke && (Ce(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()), c) {
|
|
137
|
+
let n = t.r * de;
|
|
138
138
|
e.imageSmoothingEnabled = !i.pixelated, e.drawImage(c, t.x - n / 2, t.y - n / 2, n, n);
|
|
139
139
|
} else if (l) {
|
|
140
|
-
let n =
|
|
140
|
+
let n = be(t.letters, i.values && i.values["--corn-map-glyph"]);
|
|
141
141
|
if (n) {
|
|
142
142
|
let r = t.r * 1;
|
|
143
143
|
e.imageSmoothingEnabled = !0, e.drawImage(n, t.x - r / 2, t.y - r / 2, r, r);
|
|
@@ -148,7 +148,7 @@ function Pe(e, t, n, r, i) {
|
|
|
148
148
|
}
|
|
149
149
|
e.restore();
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function Le(e, t = {}) {
|
|
152
152
|
let n = t.mapStyle || (() => x), r = e.getContext("2d"), o = 0, s = 0, c = 1, l = null, u = null, d = null, f = () => {
|
|
153
153
|
if (l) return l;
|
|
154
154
|
try {
|
|
@@ -161,7 +161,7 @@ function Fe(e, t = {}) {
|
|
|
161
161
|
function g(e, t, n) {
|
|
162
162
|
e.save(), e.translate(n.x, n.y), e.scale(n.zoom, n.zoom);
|
|
163
163
|
let { decor: r } = t;
|
|
164
|
-
r.grid &&
|
|
164
|
+
r.grid && we(e, r.grid, n, o, s), r.lanes.length && Ee(e, r.lanes), r.rings.length && Te(e, r.rings), Fe(t, n, o, s).forEach((t) => De(e, t, 0, n.zoom, !1)), e.restore();
|
|
165
165
|
}
|
|
166
166
|
return {
|
|
167
167
|
kind: "canvas2d",
|
|
@@ -171,7 +171,7 @@ function Fe(e, t = {}) {
|
|
|
171
171
|
draw(t, m, _) {
|
|
172
172
|
let v = n(), y = S(t, v);
|
|
173
173
|
r.clearRect(0, 0, o, s);
|
|
174
|
-
let b = a(i(y.theme), v), x =
|
|
174
|
+
let b = a(i(y.theme), v), x = Fe(y, m, o, s);
|
|
175
175
|
if (h(y) && x.length > p && f()) {
|
|
176
176
|
d && d.scene === y && d.x === m.x && d.y === m.y && d.zoom === m.zoom && d.w === e.width && d.h === e.height || ((l.width !== e.width || l.height !== e.height) && (l.width = e.width, l.height = e.height), u.setTransform(c, 0, 0, c, 0, 0), u.clearRect(0, 0, o, s), g(u, y, m), d = {
|
|
177
177
|
scene: y,
|
|
@@ -181,25 +181,25 @@ function Fe(e, t = {}) {
|
|
|
181
181
|
w: e.width,
|
|
182
182
|
h: e.height
|
|
183
183
|
}), r.save(), r.setTransform(1, 0, 0, 1, 0, 0), r.drawImage(l, 0, 0), r.restore(), r.save(), r.translate(m.x, m.y), r.scale(m.zoom, m.zoom), x.forEach((e) => {
|
|
184
|
-
e.packet &&
|
|
185
|
-
}), y.nodes.forEach((e) =>
|
|
184
|
+
e.packet && je(r, e, _, m.zoom);
|
|
185
|
+
}), y.nodes.forEach((e) => Ie(r, e, m.zoom, b, v)), r.restore();
|
|
186
186
|
return;
|
|
187
187
|
}
|
|
188
188
|
r.save(), r.translate(m.x, m.y), r.scale(m.zoom, m.zoom);
|
|
189
189
|
let { decor: C } = y;
|
|
190
|
-
C.grid &&
|
|
190
|
+
C.grid && we(r, C.grid, m, o, s), C.lanes.length && Ee(r, C.lanes), C.rings.length && Te(r, C.rings), x.forEach((e) => De(r, e, _, m.zoom)), y.nodes.forEach((e) => Ie(r, e, m.zoom, b, v)), r.restore();
|
|
191
191
|
},
|
|
192
192
|
destroy() {
|
|
193
193
|
l = null, u = null, d = null;
|
|
194
194
|
}
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
|
-
var
|
|
198
|
-
function
|
|
197
|
+
var Re = (e) => typeof e.hitR == "number" && e.hitR > e.r ? e.hitR : e.r;
|
|
198
|
+
function ze(e, { cellSize: t = 64 } = {}) {
|
|
199
199
|
let n = /* @__PURE__ */ new Map(), r = 0, i = (e, t) => e * 4194304 + t;
|
|
200
200
|
for (let a = 0; a < e.length; a++) {
|
|
201
201
|
let o = e[a];
|
|
202
|
-
|
|
202
|
+
Re(o) > r && (r = Re(o));
|
|
203
203
|
let s = i(Math.floor(o.x / t), Math.floor(o.y / t)), c = n.get(s);
|
|
204
204
|
c ? c.push(a) : n.set(s, [a]);
|
|
205
205
|
}
|
|
@@ -215,7 +215,7 @@ function Le(e, { cellSize: t = 64 } = {}) {
|
|
|
215
215
|
if (a) for (let t = 0; t < a.length; t++) {
|
|
216
216
|
let n = a[t];
|
|
217
217
|
if (n <= _) continue;
|
|
218
|
-
let r = e[n], i = Math.max(
|
|
218
|
+
let r = e[n], i = Math.max(Re(r) + u, d);
|
|
219
219
|
Math.hypot(r.x - s, r.y - c) <= i && (_ = n);
|
|
220
220
|
}
|
|
221
221
|
}
|
|
@@ -228,32 +228,32 @@ function Le(e, { cellSize: t = 64 } = {}) {
|
|
|
228
228
|
let a = n.get(i(t, r));
|
|
229
229
|
if (a) for (let t = 0; t < a.length; t++) {
|
|
230
230
|
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);
|
|
231
|
-
i * i + u * u <=
|
|
231
|
+
i * i + u * u <= Re(r) ** 2 && m.push(n);
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
return m.sort((e, t) => e - t).map((t) => e[t]);
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function Be(e, t, n, r, i = !1) {
|
|
239
239
|
let a = t.zoom;
|
|
240
240
|
return e.nodeAt((n - t.x) / a, (r - t.y) / a, {
|
|
241
241
|
pad: (i ? 16 : 6) / a,
|
|
242
242
|
min: (i ? 32 : 12) / a
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function Ve(e) {
|
|
246
246
|
let t = null, n = null, r = {
|
|
247
247
|
builds: 0,
|
|
248
248
|
get(i) {
|
|
249
|
-
return n && t === i || (n =
|
|
249
|
+
return n && t === i || (n = ze(i.nodes, e), t = i, r.builds++), n;
|
|
250
250
|
}
|
|
251
251
|
};
|
|
252
252
|
return r;
|
|
253
253
|
}
|
|
254
254
|
// ../explorer/frame.js
|
|
255
|
-
var
|
|
256
|
-
function
|
|
255
|
+
var He = 3e4;
|
|
256
|
+
function Ue({ dirty: e, packetsVisible: t, hidden: n, reduceMotion: r, idleMs: i, clientsWant: a = !1 }) {
|
|
257
257
|
if (n) return {
|
|
258
258
|
draw: !1,
|
|
259
259
|
again: !1
|
|
@@ -264,8 +264,8 @@ function Ve({ dirty: e, packetsVisible: t, hidden: n, reduceMotion: r, idleMs: i
|
|
|
264
264
|
again: o
|
|
265
265
|
};
|
|
266
266
|
}
|
|
267
|
-
function
|
|
268
|
-
let i =
|
|
267
|
+
function We(e, t, n, r) {
|
|
268
|
+
let i = Ke(e);
|
|
269
269
|
if (i.length === 0) return !1;
|
|
270
270
|
if (!(n > 0) || !(r > 0)) return !0;
|
|
271
271
|
let a = -t.x / t.zoom, o = -t.y / t.zoom, s = (n - t.x) / t.zoom, c = (r - t.y) / t.zoom;
|
|
@@ -275,12 +275,12 @@ function He(e, t, n, r) {
|
|
|
275
275
|
}
|
|
276
276
|
return !1;
|
|
277
277
|
}
|
|
278
|
-
var
|
|
279
|
-
function
|
|
280
|
-
let t =
|
|
281
|
-
return t || (t = e.edges.filter((e) => e.packet),
|
|
278
|
+
var Ge = /* @__PURE__ */ new WeakMap();
|
|
279
|
+
function Ke(e) {
|
|
280
|
+
let t = Ge.get(e);
|
|
281
|
+
return t || (t = e.edges.filter((e) => e.packet), Ge.set(e, t)), t;
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function qe(e) {
|
|
284
284
|
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(), _ = () => {
|
|
285
285
|
if (g.size === 0) return;
|
|
286
286
|
let e = [...g];
|
|
@@ -293,7 +293,7 @@ function Ge(e) {
|
|
|
293
293
|
let n = o && !r() ? o(e) : !1, i = d || (a ? a() : !1), { draw: s, again: c } = b(i, n);
|
|
294
294
|
s && (i || e - p >= 31) && (d = !1, p = e, x.draws++, t()), x.frames++, c && v();
|
|
295
295
|
}
|
|
296
|
-
let b = (e, t) =>
|
|
296
|
+
let b = (e, t) => Ue({
|
|
297
297
|
dirty: e,
|
|
298
298
|
packetsVisible: n(),
|
|
299
299
|
hidden: r(),
|
|
@@ -313,7 +313,7 @@ function Ge(e) {
|
|
|
313
313
|
v();
|
|
314
314
|
},
|
|
315
315
|
noteInput() {
|
|
316
|
-
let e = c(), t = e - m >=
|
|
316
|
+
let e = c(), t = e - m >= He;
|
|
317
317
|
m = e, t && v();
|
|
318
318
|
},
|
|
319
319
|
shown() {
|
|
@@ -336,7 +336,7 @@ function Ge(e) {
|
|
|
336
336
|
};
|
|
337
337
|
return x;
|
|
338
338
|
}
|
|
339
|
-
var
|
|
339
|
+
var Je = 1, Ye = .3, Xe = .58, Ze = 3, Qe = 100, J = 64, Y = {
|
|
340
340
|
selected: 0,
|
|
341
341
|
current: 1,
|
|
342
342
|
match: 2,
|
|
@@ -345,19 +345,19 @@ var Ke = 1, qe = .3, Je = .58, Ye = 3, Xe = 100, J = 64, Y = {
|
|
|
345
345
|
hub: 5,
|
|
346
346
|
rest: 6,
|
|
347
347
|
greyed: 7
|
|
348
|
-
},
|
|
349
|
-
function
|
|
350
|
-
let { measure: r = null } = n, i =
|
|
348
|
+
}, $e = 1.5, et = (e) => Number.isFinite(e) && e >= 9 ? Math.max(11, e) : 11, tt = (e) => et(e.labelMin), nt = (e) => h.includes(e.type) && !e.greyed, rt = (e, t) => e.selected ? Y.selected : e.current ? Y.current : e.match ? Y.match : t && e.connected ? Y.lit : e.mark && e.mark !== "none" || e.labelKeep && !nt(e) ? Y.marked : e.greyed ? Y.greyed : nt(e) ? Y.hub : Y.rest;
|
|
349
|
+
function it(e, t, n = {}) {
|
|
350
|
+
let { measure: r = null } = n, i = tt(e), a = e.nodes.some((e) => e.selected || !e.connected), o = [];
|
|
351
351
|
e.nodes.forEach((e, t) => {
|
|
352
352
|
e.label && e.labelAlpha >= .15 && o.push({
|
|
353
353
|
node: e,
|
|
354
354
|
index: t,
|
|
355
|
-
tier:
|
|
355
|
+
tier: rt(e, a)
|
|
356
356
|
});
|
|
357
357
|
}), 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);
|
|
358
|
-
let s = /* @__PURE__ */ new Map(), c = (e, t) => (e + 8192) * 16384 + (t + 8192), l = [], u = Math.max(
|
|
358
|
+
let s = /* @__PURE__ */ new Map(), c = (e, t) => (e + 8192) * 16384 + (t + 8192), l = [], u = Math.max(Ze, Ze * t);
|
|
359
359
|
for (let { node: e, index: n, tier: a } of o) {
|
|
360
|
-
let o =
|
|
360
|
+
let o = nt(e), d = !e.greyed && (!!e.labelBold || o), f = Math.max(o ? i + 2 : i, e.labelSize * t), p = r ? r(e.label, Qe, d) * f / Qe : e.label.length * f * Xe, m = e.x * t, h = e.y * t + e.r * t + u + f, g = m - p / 2, _ = m + p / 2, v = h - f * Je, y = h + f * Ye, b = a === Y.greyed ? 2 + f * $e : 2, x = Math.floor((g - b) / J), S = Math.floor((_ + b) / J), C = Math.floor((v - b) / J), w = Math.floor((y + b) / J), T = !1;
|
|
361
361
|
for (let e = x; e <= S && !T; e++) for (let t = C; t <= w && !T; t++) {
|
|
362
362
|
let n = s.get(c(e, t));
|
|
363
363
|
if (n) for (let e = 0; e < n.length; e++) {
|
|
@@ -395,7 +395,7 @@ function nt(e, t, n = {}) {
|
|
|
395
395
|
}
|
|
396
396
|
return l;
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function at(e, t, n, r = {}) {
|
|
399
399
|
let { max: a = 400, margin: o = 32, measure: s = null, hover: c = null } = r, l = [], u = e.labelOutline || i(e.theme).labelOutline;
|
|
400
400
|
for (let t of e.decor.lanes) for (let n of [
|
|
401
401
|
t.title,
|
|
@@ -415,7 +415,7 @@ function rt(e, t, n, r = {}) {
|
|
|
415
415
|
align: "center",
|
|
416
416
|
family: e.labelFont || "\"Segoe UI\", -apple-system, BlinkMacSystemFont, Roboto, sans-serif"
|
|
417
417
|
});
|
|
418
|
-
let { zoom: d } = t, f = r.placed ||
|
|
418
|
+
let { zoom: d } = t, f = r.placed || it(e, d, { measure: s }), p = -o - t.x, m = n.width + o - t.x, h = -o - t.y, g = n.height + o - t.y, _ = f.filter((e) => e.r >= p && e.l <= m && e.b >= h && e.t <= g);
|
|
419
419
|
_.length > a && (_ = _.slice(0, Math.max(0, a))), _.sort((e, t) => e.index - t.index);
|
|
420
420
|
let v = e.labelFont || "\"Segoe UI\", -apple-system, BlinkMacSystemFont, Roboto, sans-serif";
|
|
421
421
|
for (let e of _) {
|
|
@@ -442,7 +442,7 @@ function rt(e, t, n, r = {}) {
|
|
|
442
442
|
screen: e.screen
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
|
-
let y =
|
|
445
|
+
let y = tt(e), b = _.map((e) => ({
|
|
446
446
|
l: t.x + e.l,
|
|
447
447
|
r: t.x + e.r,
|
|
448
448
|
t: t.y + e.t,
|
|
@@ -490,7 +490,7 @@ function rt(e, t, n, r = {}) {
|
|
|
490
490
|
if (c) {
|
|
491
491
|
let n = e.nodes.find((e) => e.id === c);
|
|
492
492
|
if (n && n.label && !f.some((e) => e.id === c && _.includes(e))) {
|
|
493
|
-
let r =
|
|
493
|
+
let r = tt(e), i = t.y + n.y * d - n.r * d > 40 ? n.y - n.r - 5 / d : n.y + n.r + (5 + r) / d;
|
|
494
494
|
l.push({
|
|
495
495
|
kind: "chip",
|
|
496
496
|
id: n.id,
|
|
@@ -513,17 +513,17 @@ function rt(e, t, n, r = {}) {
|
|
|
513
513
|
}
|
|
514
514
|
return l;
|
|
515
515
|
}
|
|
516
|
-
var
|
|
516
|
+
var ot = (e) => `${e.italic ? "italic " : ""}${e.bold ? "bold " : ""}${e.screen ? e.px : e.size}px ${e.family}`, st = {
|
|
517
517
|
ox: 0,
|
|
518
518
|
oy: 0,
|
|
519
519
|
k: 1
|
|
520
520
|
};
|
|
521
|
-
function
|
|
522
|
-
e.font =
|
|
523
|
-
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 *
|
|
521
|
+
function ct(e, t, n) {
|
|
522
|
+
e.font = ot(t);
|
|
523
|
+
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 * Je - 2;
|
|
524
524
|
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);
|
|
525
525
|
}
|
|
526
|
-
function
|
|
526
|
+
function lt() {
|
|
527
527
|
return {
|
|
528
528
|
font: "",
|
|
529
529
|
alpha: -1,
|
|
@@ -533,13 +533,13 @@ function st() {
|
|
|
533
533
|
align: ""
|
|
534
534
|
};
|
|
535
535
|
}
|
|
536
|
-
function
|
|
536
|
+
function ut(e, t, n, r = st) {
|
|
537
537
|
if (t.kind === "chip") {
|
|
538
|
-
|
|
538
|
+
ct(e, t, r);
|
|
539
539
|
return;
|
|
540
540
|
}
|
|
541
541
|
n.alpha !== t.alpha && (e.globalAlpha = t.alpha, n.alpha = t.alpha);
|
|
542
|
-
let i =
|
|
542
|
+
let i = ot(t);
|
|
543
543
|
n.font !== i && (e.font = i, n.font = i), n.align !== t.align && (e.textAlign = t.align, n.align = t.align);
|
|
544
544
|
let a = r.ox + t.x * r.k, o = r.oy + t.y * r.k;
|
|
545
545
|
if (t.outline) {
|
|
@@ -552,15 +552,15 @@ function ct(e, t, n, r = at) {
|
|
|
552
552
|
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;
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
|
-
function
|
|
555
|
+
function dt(e, t, n, r) {
|
|
556
556
|
let i = null;
|
|
557
557
|
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);
|
|
558
558
|
return i ? i.id : null;
|
|
559
559
|
}
|
|
560
|
-
function
|
|
561
|
-
let n = t.mapStyle || (() => x), 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 =
|
|
560
|
+
function ft(e, t = {}) {
|
|
561
|
+
let n = t.mapStyle || (() => x), 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 = L, y = (e, t, n) => {
|
|
562
562
|
let i = `${n ? "b" : "n"}${t}|${v}|${e}`, a = _.get(i);
|
|
563
|
-
return a === void 0 && (_.size > 2e4 && _.clear(), r.font =
|
|
563
|
+
return a === void 0 && (_.size > 2e4 && _.clear(), r.font = ot({
|
|
564
564
|
italic: !1,
|
|
565
565
|
bold: n,
|
|
566
566
|
size: t,
|
|
@@ -569,7 +569,7 @@ function ut(e, t = {}) {
|
|
|
569
569
|
};
|
|
570
570
|
return {
|
|
571
571
|
hit(e, t) {
|
|
572
|
-
return m && s ?
|
|
572
|
+
return m && s ? dt(m, {
|
|
573
573
|
x: l,
|
|
574
574
|
y: u,
|
|
575
575
|
zoom: d
|
|
@@ -585,27 +585,27 @@ function ut(e, t = {}) {
|
|
|
585
585
|
let w = m && e === s && e.version === c && t.zoom === d && x === f && !h;
|
|
586
586
|
s = e, c = e.version, l = t.x, u = t.y, d = t.zoom, f = x, p = C, h = !1;
|
|
587
587
|
let T = S(e, b);
|
|
588
|
-
v = T.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), w || (m =
|
|
589
|
-
let E =
|
|
588
|
+
v = T.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), w || (m = it(T, t.zoom, { measure: y }));
|
|
589
|
+
let E = at(T, t, {
|
|
590
590
|
width: i,
|
|
591
591
|
height: a
|
|
592
592
|
}, {
|
|
593
593
|
measure: y,
|
|
594
594
|
hover: C,
|
|
595
595
|
placed: m
|
|
596
|
-
}), D =
|
|
597
|
-
for (let e of E) e.kind === "lane" &&
|
|
598
|
-
for (let e of E) e.kind === "node" && !e.screen &&
|
|
596
|
+
}), D = lt();
|
|
597
|
+
for (let e of E) e.kind === "lane" && ut(r, e, D);
|
|
598
|
+
for (let e of E) e.kind === "node" && !e.screen && ut(r, e, D);
|
|
599
599
|
r.restore();
|
|
600
600
|
let O = {
|
|
601
601
|
ox: t.x,
|
|
602
602
|
oy: t.y,
|
|
603
603
|
k: t.zoom
|
|
604
604
|
};
|
|
605
|
-
D =
|
|
606
|
-
for (let e of E) e.kind === "node" && e.screen &&
|
|
607
|
-
for (let e of E) e.kind === "edge" &&
|
|
608
|
-
for (let e of E) e.kind === "chip" &&
|
|
605
|
+
D = lt();
|
|
606
|
+
for (let e of E) e.kind === "node" && e.screen && ut(r, e, D, O);
|
|
607
|
+
for (let e of E) e.kind === "edge" && ut(r, e, D, O);
|
|
608
|
+
for (let e of E) e.kind === "chip" && ut(r, e, D, O);
|
|
609
609
|
return !0;
|
|
610
610
|
},
|
|
611
611
|
destroy() {
|
|
@@ -614,7 +614,7 @@ function ut(e, t = {}) {
|
|
|
614
614
|
};
|
|
615
615
|
}
|
|
616
616
|
// ../explorer/engine/render.js
|
|
617
|
-
var
|
|
617
|
+
var pt = [
|
|
618
618
|
"pointerdown",
|
|
619
619
|
"pointermove",
|
|
620
620
|
"mousedown",
|
|
@@ -624,18 +624,18 @@ var dt = [
|
|
|
624
624
|
"touchmove",
|
|
625
625
|
"keydown"
|
|
626
626
|
];
|
|
627
|
-
function
|
|
627
|
+
function mt(e, t = {}) {
|
|
628
628
|
if (e.map) return e.map;
|
|
629
|
-
let { state: n } = e, r = t.measureCovered || (() => n.coveredBottom || 0), i =
|
|
629
|
+
let { state: n } = e, r = t.measureCovered || (() => n.coveredBottom || 0), i = ue(e).get, a = !1, o = (e) => pe(n, e), s = (e) => pe(n, e, { viewer: !0 }), l = (t, r = e.viewEdges(), i = {
|
|
630
630
|
throughChildren: !!n.throughChildren,
|
|
631
631
|
kind: n.selectedKind || null
|
|
632
|
-
}) => b(t, r, i), f = d((t) => c(t, { reduceMotion: e.reducedMotion })), p = () => f.get(n), m = () => f.builds, h =
|
|
632
|
+
}) => b(t, r, i), f = d((t) => c(t, { reduceMotion: e.reducedMotion })), p = () => f.get(n), m = () => f.builds, h = Ve(), g = () => h.get(p()), _ = () => h.builds, v = null, y = null;
|
|
633
633
|
function x() {
|
|
634
|
-
return v && y === n.canvas || (v && v.destroy(), v =
|
|
634
|
+
return v && y === n.canvas || (v && v.destroy(), v = Le(n.canvas, { mapStyle: i }), y = n.canvas, n.width && v.resize(n.width, n.height, e.dpr())), v;
|
|
635
635
|
}
|
|
636
636
|
let S = null, w = null;
|
|
637
637
|
function T() {
|
|
638
|
-
return n.labelCanvas ? (S && w === n.labelCanvas || (S && S.destroy(), S =
|
|
638
|
+
return n.labelCanvas ? (S && w === n.labelCanvas || (S && S.destroy(), S = ft(n.labelCanvas, { mapStyle: i }), w = n.labelCanvas, n.width && S.resize(n.width, n.height, e.dpr())), S) : null;
|
|
639
639
|
}
|
|
640
640
|
function E(t) {
|
|
641
641
|
v && v !== t && v.destroy(), v = t, y = n.canvas, n.width && v.resize(n.width, n.height, e.dpr()), V();
|
|
@@ -703,22 +703,22 @@ function ft(e, t = {}) {
|
|
|
703
703
|
let e = p();
|
|
704
704
|
I = e.version, x().draw(e, n.camera, performance.now());
|
|
705
705
|
let t = T();
|
|
706
|
-
t && t.draw(e, n.camera, { hover: n.hoverNodeId }),
|
|
706
|
+
t && t.draw(e, n.camera, { hover: n.hoverNodeId }), R.forEach((t) => t(e, n.camera));
|
|
707
707
|
}
|
|
708
708
|
function te(e, t) {
|
|
709
709
|
let n = T();
|
|
710
710
|
return n ? n.hit(e, t) : null;
|
|
711
711
|
}
|
|
712
|
-
function
|
|
712
|
+
function L(e) {
|
|
713
713
|
let t = e || null;
|
|
714
714
|
if (n.hoverNodeId === t) return;
|
|
715
715
|
n.hoverNodeId = t;
|
|
716
716
|
let r = T();
|
|
717
717
|
r && n.canvas && n.width && r.draw(p(), n.camera, { hover: t });
|
|
718
718
|
}
|
|
719
|
-
let
|
|
719
|
+
let R = /* @__PURE__ */ new Set(), ne = (e) => (R.add(e), () => R.delete(e)), z = /* @__PURE__ */ new Set(), B = qe({
|
|
720
720
|
draw: ee,
|
|
721
|
-
packetsVisible: () => !!n.canvas &&
|
|
721
|
+
packetsVisible: () => !!n.canvas && We(p(), n.camera, n.width, n.height),
|
|
722
722
|
isHidden: () => e.hidden(),
|
|
723
723
|
tickClients: (e) => {
|
|
724
724
|
let t = !1;
|
|
@@ -744,16 +744,16 @@ function ft(e, t = {}) {
|
|
|
744
744
|
}
|
|
745
745
|
if (e.root) {
|
|
746
746
|
let t = () => B.noteInput();
|
|
747
|
-
for (let n of
|
|
747
|
+
for (let n of pt) e.listen(e.root, n, t, {
|
|
748
748
|
passive: !0,
|
|
749
749
|
capture: !0
|
|
750
750
|
});
|
|
751
751
|
}
|
|
752
752
|
e.onShown(() => B.shown());
|
|
753
|
-
function
|
|
754
|
-
a = !0, e.map ===
|
|
753
|
+
function re() {
|
|
754
|
+
a = !0, e.map === W && (e.map = null), B.cancel(), v && (v.release ? v.release() : v.destroy(), v = null, y = null), S && (S.destroy(), S = null, w = null), R.clear(), z.clear();
|
|
755
755
|
}
|
|
756
|
-
let
|
|
756
|
+
let W = {
|
|
757
757
|
isNodeVisible: o,
|
|
758
758
|
isNodeVisibleToViewer: s,
|
|
759
759
|
getActiveSubgraph: l,
|
|
@@ -770,8 +770,8 @@ function ft(e, t = {}) {
|
|
|
770
770
|
fitPadding: P,
|
|
771
771
|
screenToWorld: F,
|
|
772
772
|
labelNodeAt: te,
|
|
773
|
-
setHoverNode:
|
|
774
|
-
onPaint:
|
|
773
|
+
setHoverNode: L,
|
|
774
|
+
onPaint: ne,
|
|
775
775
|
render: V,
|
|
776
776
|
renderNow: H,
|
|
777
777
|
addFrameClient: U,
|
|
@@ -789,12 +789,144 @@ function ft(e, t = {}) {
|
|
|
789
789
|
ensureFlowLoop: () => {
|
|
790
790
|
a || B.wake();
|
|
791
791
|
},
|
|
792
|
-
destroy:
|
|
792
|
+
destroy: re
|
|
793
793
|
};
|
|
794
|
-
return e.map =
|
|
794
|
+
return e.map = W, e.own(re), W;
|
|
795
|
+
}
|
|
796
|
+
// ../explorer/flow-build.js
|
|
797
|
+
function ht(e, t) {
|
|
798
|
+
let n = new Map(e.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map();
|
|
799
|
+
t.forEach((e) => {
|
|
800
|
+
!e.kind && !e.dashed && n.get(e.from)?.type === "app" && n.get(e.to)?.type === "page" && r.set(e.to, e.from);
|
|
801
|
+
});
|
|
802
|
+
let i = e.filter((e) => e.type === "container" && e.selfHosted), a = /* @__PURE__ */ new Map();
|
|
803
|
+
t.forEach((e) => {
|
|
804
|
+
let t = n.get(e.from);
|
|
805
|
+
if (e.kind !== "delivers" || t?.type !== "container" || t.selfHosted || n.get(e.to)?.type !== "page") return;
|
|
806
|
+
let r = i.filter((e) => e.stack === t.stack);
|
|
807
|
+
r.length === 1 && a.set(t.id, r[0].id);
|
|
808
|
+
});
|
|
809
|
+
let o = (e) => n.get(e)?.type === "page" ? r.get(e) || e : a.get(e) || e, s = new Set([...r].filter(([e]) => Array.isArray(n.get(e)?.methods) && n.get(e).methods.length).map(([, e]) => e)), c = (e) => e.type === "store" && (e.tier === "browser" || e.id === "store-idb"), l = /* @__PURE__ */ new Set();
|
|
810
|
+
t.forEach((e) => {
|
|
811
|
+
if (e.kind === "reads" || e.kind === "writes") {
|
|
812
|
+
let t = e.kind === "reads" ? e.to : e.from;
|
|
813
|
+
n.get(t)?.type === "page" && l.add(o(t));
|
|
814
|
+
}
|
|
815
|
+
}), t.forEach((e) => {
|
|
816
|
+
e.kind === "flow" && e.flow === "api" && n.get(e.from)?.type === "app" && l.add(e.from);
|
|
817
|
+
});
|
|
818
|
+
let u = new Set(t.filter((e) => e.kind === "flow" && e.flow === "api").map((e) => `${o(e.from)}|${o(e.to)}`)), d = (t) => e.filter(t).sort((e, t) => String(e.label).localeCompare(String(t.label))), f = [
|
|
819
|
+
{
|
|
820
|
+
key: "browser",
|
|
821
|
+
title: "Browser",
|
|
822
|
+
note: "saved on the device first",
|
|
823
|
+
nodes: d(c)
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
key: "servers",
|
|
827
|
+
title: "App servers",
|
|
828
|
+
note: "pages, no-JS forms",
|
|
829
|
+
nodes: d((e) => e.type === "app" && !s.has(e.id) && l.has(e.id))
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
key: "api",
|
|
833
|
+
title: "API",
|
|
834
|
+
note: "where the endpoints are",
|
|
835
|
+
nodes: d((e) => s.has(e.id))
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
key: "tables",
|
|
839
|
+
title: "Tables",
|
|
840
|
+
note: "stores and tables",
|
|
841
|
+
nodes: [...d((e) => e.type === "store" && !c(e)), ...d((e) => e.type === "table")]
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
key: "services",
|
|
845
|
+
title: "Services",
|
|
846
|
+
note: "jobs, hooks, webhooks",
|
|
847
|
+
nodes: d((e) => e.type === "service")
|
|
848
|
+
},
|
|
849
|
+
{
|
|
850
|
+
key: "outside",
|
|
851
|
+
title: "Outside",
|
|
852
|
+
note: "systems the API reaches",
|
|
853
|
+
nodes: [...d((e) => e.type === "external"), ...d((e) => e.type === "container" && e.selfHosted)]
|
|
854
|
+
}
|
|
855
|
+
], p = new Set(f.flatMap((e) => e.nodes.map((e) => e.id))), m = [], h = /* @__PURE__ */ new Set(), g = (e, t, n) => {
|
|
856
|
+
if (t === n || !p.has(t) || !p.has(n)) return;
|
|
857
|
+
let r = `${t}|${n}|${e.kind}|${e.flow || ""}`;
|
|
858
|
+
h.has(r) || (h.add(r), m.push({
|
|
859
|
+
...e,
|
|
860
|
+
from: t,
|
|
861
|
+
to: n,
|
|
862
|
+
status: e.status || "live",
|
|
863
|
+
phase: void 0
|
|
864
|
+
}));
|
|
865
|
+
};
|
|
866
|
+
return t.forEach((e) => {
|
|
867
|
+
if (!(e.kind === "calls" && u.has(`${o(e.from)}|${o(e.to)}`)) && (e.kind !== "calls" || n.get(e.from)?.type !== "container")) {
|
|
868
|
+
if (e.kind === "flow" || [
|
|
869
|
+
"calls",
|
|
870
|
+
"triggers",
|
|
871
|
+
"delivers"
|
|
872
|
+
].includes(e.kind)) return g(e, o(e.from), o(e.to));
|
|
873
|
+
if (e.kind === "reads" || e.kind === "writes") {
|
|
874
|
+
let t = e.kind === "reads" ? e.to : e.from;
|
|
875
|
+
return n.get(t)?.type === "page" && !s.has(o(t)) ? void 0 : g(e, o(e.from), o(e.to));
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
}), {
|
|
879
|
+
tiers: f,
|
|
880
|
+
ids: p,
|
|
881
|
+
edges: m
|
|
882
|
+
};
|
|
883
|
+
}
|
|
884
|
+
// ../explorer/engine/topology.js
|
|
885
|
+
function gt(e) {
|
|
886
|
+
return {
|
|
887
|
+
nodes: e && Array.isArray(e.nodes) ? e.nodes.filter((e) => e && typeof e.id == "string") : [],
|
|
888
|
+
edges: e && Array.isArray(e.edges) ? e.edges.filter((e) => e && typeof e.from == "string" && typeof e.to == "string") : []
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
function _t(e, t) {
|
|
892
|
+
let { state: n } = e, { nodes: r, edges: i } = gt(t), a = n.selectedNode ? n.selectedNode.id : null;
|
|
893
|
+
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 = ht(n.nodes, n.edges);
|
|
894
|
+
let o = a && n.nodes.find((e) => e.id === a) || null;
|
|
895
|
+
return o ? (n.selectedEdge = null, n.selectedNode = o) : (n.selectedNode || n.selectedEdge) && (n.selectedNode = null, n.selectedEdge = null), e.touchScene(), n.nodes.length > 0;
|
|
896
|
+
}
|
|
897
|
+
function vt(e, { placeLive: t } = {}) {
|
|
898
|
+
let { state: n } = e;
|
|
899
|
+
I(e), n.view === "dataflow" && n.flow ? (n.flow.tiers.forEach((e) => e.nodes.forEach((e) => {
|
|
900
|
+
e.r = Math.min(e.r, 13);
|
|
901
|
+
})), n.proposal && n.baseNodes && yt(e) || O(e, n.flow)) : n.baseNodes && (n.proposal || n.nodes.some((e) => e.live)) ? bt(e, t) : le(e);
|
|
902
|
+
}
|
|
903
|
+
function yt(e) {
|
|
904
|
+
let { state: t } = e, n = {
|
|
905
|
+
nodes: t.nodes,
|
|
906
|
+
edges: t.edges
|
|
907
|
+
}, r = t.baseNodes.map((e) => ({ ...e }));
|
|
908
|
+
t.nodes = r, t.edges = t.baseEdges, I(e);
|
|
909
|
+
let i = ht(r, t.baseEdges);
|
|
910
|
+
i.tiers.forEach((e) => e.nodes.forEach((e) => {
|
|
911
|
+
e.r = Math.min(e.r, 13);
|
|
912
|
+
})), O(e, i), t.nodes = n.nodes, t.edges = n.edges;
|
|
913
|
+
let a = z(t.flow, i);
|
|
914
|
+
return e.touchScene(), a;
|
|
915
|
+
}
|
|
916
|
+
function bt(e, t) {
|
|
917
|
+
let { state: n } = e, r = {
|
|
918
|
+
nodes: n.nodes,
|
|
919
|
+
edges: n.edges
|
|
920
|
+
}, i = n.baseNodes.map((e) => ({ ...e }));
|
|
921
|
+
n.nodes = i, n.edges = n.baseEdges, I(e), le(e);
|
|
922
|
+
let a = new Map(i.map((e) => [e.id, e]));
|
|
923
|
+
n.nodes = r.nodes, n.edges = r.edges, I(e), n.nodes.forEach((e) => {
|
|
924
|
+
let t = a.get(e.id);
|
|
925
|
+
t && (e.x = t.x, e.y = t.y, e.r = t.r);
|
|
926
|
+
}), ce(n.nodes, n.edges), t && t(n.nodes, n.edges), e.touchScene();
|
|
795
927
|
}
|
|
796
928
|
// ../explorer/shaders.js
|
|
797
|
-
var X = "#version 300 es\nprecision highp float;\nuniform vec2 u_viewport;\nuniform vec3 u_cam;\nuniform float u_dpr;\n", Z = "\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", Q = "\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",
|
|
929
|
+
var X = "#version 300 es\nprecision highp float;\nuniform vec2 u_viewport;\nuniform vec3 u_cam;\nuniform float u_dpr;\n", Z = "\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", Q = "\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", xt = `${X}
|
|
798
930
|
layout(location = 0) in vec2 a_corner;
|
|
799
931
|
layout(location = 1) in vec4 a_grid; // size, width
|
|
800
932
|
layout(location = 2) in vec4 a_color;
|
|
@@ -807,7 +939,7 @@ void main() {
|
|
|
807
939
|
v_color = a_color;
|
|
808
940
|
gl_Position = vec4(a_corner, 0.0, 1.0);
|
|
809
941
|
}
|
|
810
|
-
`,
|
|
942
|
+
`, St = `${X}${Q}
|
|
811
943
|
in vec2 v_pos;
|
|
812
944
|
flat in vec4 v_grid;
|
|
813
945
|
flat in vec4 v_color;
|
|
@@ -820,7 +952,7 @@ void main() {
|
|
|
820
952
|
float cover = max(coverBand(dist.x, hw, pix), coverBand(dist.y, hw, pix));
|
|
821
953
|
outColor = vec4(v_color.rgb * v_color.a, v_color.a) * cover;
|
|
822
954
|
}
|
|
823
|
-
`,
|
|
955
|
+
`, Ct = `${X}${Z}
|
|
824
956
|
layout(location = 0) in vec2 a_corner;
|
|
825
957
|
layout(location = 1) in vec4 a_rect; // x, y, w, h (world)
|
|
826
958
|
layout(location = 2) in vec4 a_fill;
|
|
@@ -844,7 +976,7 @@ void main() {
|
|
|
844
976
|
v_stroke = a_stroke;
|
|
845
977
|
gl_Position = toClip(pos);
|
|
846
978
|
}
|
|
847
|
-
`,
|
|
979
|
+
`, wt = `${X}${Q}
|
|
848
980
|
in vec2 v_local;
|
|
849
981
|
flat in vec2 v_half;
|
|
850
982
|
flat in vec2 v_style;
|
|
@@ -861,7 +993,7 @@ void main() {
|
|
|
861
993
|
over(acc, v_stroke.rgb, v_stroke.a * coverBand(abs(sd), v_style.y * zoom * 0.5, pix));
|
|
862
994
|
outColor = acc;
|
|
863
995
|
}
|
|
864
|
-
`,
|
|
996
|
+
`, Tt = `${X}${Z}
|
|
865
997
|
layout(location = 0) in vec2 a_corner;
|
|
866
998
|
layout(location = 1) in vec4 a_geom; // x, y, r, width (world)
|
|
867
999
|
layout(location = 2) in vec4 a_color;
|
|
@@ -881,7 +1013,7 @@ void main() {
|
|
|
881
1013
|
v_dash = a_dash;
|
|
882
1014
|
gl_Position = toClip(pos);
|
|
883
1015
|
}
|
|
884
|
-
`,
|
|
1016
|
+
`, Et = `${X}${Q}
|
|
885
1017
|
in vec2 v_local;
|
|
886
1018
|
flat in vec4 v_geom;
|
|
887
1019
|
flat in vec4 v_color;
|
|
@@ -896,7 +1028,7 @@ void main() {
|
|
|
896
1028
|
cover *= coverDash(arc, v_dash.x, v_dash.y, pix / zoom);
|
|
897
1029
|
outColor = vec4(v_color.rgb * v_color.a, v_color.a) * cover;
|
|
898
1030
|
}
|
|
899
|
-
`,
|
|
1031
|
+
`, Dt = `${X}${Z}
|
|
900
1032
|
layout(location = 0) in vec2 a_corner;
|
|
901
1033
|
layout(location = 1) in vec4 a_geom; // x, y, r (world), alpha
|
|
902
1034
|
layout(location = 2) in vec4 a_color; // r, g, b (0..1), glow (px)
|
|
@@ -924,7 +1056,7 @@ void main() {
|
|
|
924
1056
|
v_kind = a_kind;
|
|
925
1057
|
gl_Position = toClip(centre + v_local);
|
|
926
1058
|
}
|
|
927
|
-
`,
|
|
1059
|
+
`, Ot = `${X}${Q}
|
|
928
1060
|
in vec2 v_local;
|
|
929
1061
|
flat in vec4 v_geom;
|
|
930
1062
|
flat in vec4 v_color;
|
|
@@ -1014,7 +1146,7 @@ void main() {
|
|
|
1014
1146
|
|
|
1015
1147
|
outColor = acc;
|
|
1016
1148
|
}
|
|
1017
|
-
`,
|
|
1149
|
+
`, kt = "\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", At = "\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", jt = (e) => `${X}${kt}
|
|
1018
1150
|
#define SEGS ${e}
|
|
1019
1151
|
layout(location = 1) in vec4 a_ends; // x1, y1, x2, y2 (world)
|
|
1020
1152
|
layout(location = 2) in vec4 a_geom; // control x, y (world), width (world), glow blur (px)
|
|
@@ -1056,7 +1188,7 @@ void main() {
|
|
|
1056
1188
|
v_dash = a_dash;
|
|
1057
1189
|
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);
|
|
1058
1190
|
}
|
|
1059
|
-
`,
|
|
1191
|
+
`, Mt = `${X}${Q}
|
|
1060
1192
|
in float v_across;
|
|
1061
1193
|
in float v_arc;
|
|
1062
1194
|
flat in float v_len;
|
|
@@ -1106,7 +1238,7 @@ void main() {
|
|
|
1106
1238
|
over(acc, v_color.rgb, v_color.a * cover);
|
|
1107
1239
|
outColor = acc;
|
|
1108
1240
|
}
|
|
1109
|
-
`,
|
|
1241
|
+
`, Nt = `${X}${Z}
|
|
1110
1242
|
layout(location = 0) in vec2 a_corner;
|
|
1111
1243
|
layout(location = 1) in vec4 a_tip; // x, y (world), direction x, y (unit)
|
|
1112
1244
|
layout(location = 2) in vec4 a_color;
|
|
@@ -1126,7 +1258,7 @@ void main() {
|
|
|
1126
1258
|
v_kind = a_kind;
|
|
1127
1259
|
gl_Position = toClip(u_cam.xy + a_tip.xy * zoom + off);
|
|
1128
1260
|
}
|
|
1129
|
-
`,
|
|
1261
|
+
`, Pt = `${X}${Q}
|
|
1130
1262
|
in vec2 v_local;
|
|
1131
1263
|
flat in vec4 v_color;
|
|
1132
1264
|
flat in float v_kind;
|
|
@@ -1182,7 +1314,7 @@ void main() {
|
|
|
1182
1314
|
}
|
|
1183
1315
|
outColor = vec4(v_color.rgb * v_color.a, v_color.a) * coverEdge(sd, pix);
|
|
1184
1316
|
}
|
|
1185
|
-
`,
|
|
1317
|
+
`, Ft = `${X}${Z}${kt}${At}
|
|
1186
1318
|
layout(location = 0) in vec2 a_corner;
|
|
1187
1319
|
layout(location = 1) in vec4 a_ends; // x1, y1, x2, y2 (world)
|
|
1188
1320
|
layout(location = 2) in vec4 a_mot; // control x, y (world), speed (trips per second), phase
|
|
@@ -1203,7 +1335,7 @@ void main() {
|
|
|
1203
1335
|
v_glow = a_glow;
|
|
1204
1336
|
gl_Position = toClip(centre + v_local);
|
|
1205
1337
|
}
|
|
1206
|
-
`,
|
|
1338
|
+
`, It = `${X}${Q}
|
|
1207
1339
|
in vec2 v_local;
|
|
1208
1340
|
flat in vec4 v_size;
|
|
1209
1341
|
flat in vec4 v_color;
|
|
@@ -1218,7 +1350,7 @@ void main() {
|
|
|
1218
1350
|
over(acc, v_color.rgb, v_color.a * coverEdge(len - R, pix));
|
|
1219
1351
|
outColor = acc;
|
|
1220
1352
|
}
|
|
1221
|
-
`,
|
|
1353
|
+
`, Lt = `${X}${Z}
|
|
1222
1354
|
layout(location = 0) in vec2 a_corner;
|
|
1223
1355
|
layout(location = 1) in vec4 a_geom; // x, y, side (world), alpha
|
|
1224
1356
|
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
|
|
@@ -1233,7 +1365,7 @@ void main() {
|
|
|
1233
1365
|
v_alpha = a_geom.w;
|
|
1234
1366
|
gl_Position = toClip(pos);
|
|
1235
1367
|
}
|
|
1236
|
-
`,
|
|
1368
|
+
`, Rt = `${X}
|
|
1237
1369
|
uniform sampler2D u_tex;
|
|
1238
1370
|
in vec2 v_uv;
|
|
1239
1371
|
flat in float v_alpha;
|
|
@@ -1241,34 +1373,34 @@ out vec4 outColor;
|
|
|
1241
1373
|
void main() {
|
|
1242
1374
|
outColor = texture(u_tex, v_uv) * v_alpha; // the texture is uploaded premultiplied
|
|
1243
1375
|
}
|
|
1244
|
-
`,
|
|
1376
|
+
`, zt = {
|
|
1245
1377
|
none: 0,
|
|
1246
1378
|
selected: 1,
|
|
1247
1379
|
match: 2,
|
|
1248
1380
|
child: 3
|
|
1249
|
-
},
|
|
1381
|
+
}, Bt = {
|
|
1250
1382
|
arrow: 1,
|
|
1251
1383
|
strike: 2,
|
|
1252
1384
|
chevron: 3,
|
|
1253
1385
|
bar: 4,
|
|
1254
1386
|
diamond: 5,
|
|
1255
1387
|
tick: 6
|
|
1256
|
-
},
|
|
1388
|
+
}, Vt = Object.freeze(Object.fromEntries(M.map((e, t) => [e, t]))), Ht = {
|
|
1257
1389
|
none: 0,
|
|
1258
1390
|
added: 1,
|
|
1259
1391
|
changed: 2,
|
|
1260
1392
|
removed: 3,
|
|
1261
1393
|
edit: 4
|
|
1262
1394
|
}, $ = (e) => {
|
|
1263
|
-
let [t, n, r, i] =
|
|
1395
|
+
let [t, n, r, i] = te(e);
|
|
1264
1396
|
return [
|
|
1265
1397
|
t / 255,
|
|
1266
1398
|
n / 255,
|
|
1267
1399
|
r / 255,
|
|
1268
1400
|
i
|
|
1269
1401
|
];
|
|
1270
|
-
},
|
|
1271
|
-
function
|
|
1402
|
+
}, Ut = (e, t) => Object.hasOwn(e, t) ? e[t] : 0;
|
|
1403
|
+
function Wt(e) {
|
|
1272
1404
|
let { nodes: t } = e, n = new Float32Array(t.length * 12);
|
|
1273
1405
|
return t.forEach((e, t) => {
|
|
1274
1406
|
let [r, i, a, o] = $(e.color);
|
|
@@ -1281,10 +1413,10 @@ function It(e) {
|
|
|
1281
1413
|
i,
|
|
1282
1414
|
a,
|
|
1283
1415
|
e.glow || 0,
|
|
1284
|
-
|
|
1285
|
-
|
|
1416
|
+
Ut(zt, e.halo),
|
|
1417
|
+
Ut(Ht, e.mark),
|
|
1286
1418
|
o,
|
|
1287
|
-
|
|
1419
|
+
Ut(Vt, e.shape) + (e.glyph && !e.icon && !e.letters ? 8 : 0)
|
|
1288
1420
|
], t * 12);
|
|
1289
1421
|
}), {
|
|
1290
1422
|
data: n,
|
|
@@ -1292,7 +1424,7 @@ function It(e) {
|
|
|
1292
1424
|
stride: 12
|
|
1293
1425
|
};
|
|
1294
1426
|
}
|
|
1295
|
-
function
|
|
1427
|
+
function Gt(e) {
|
|
1296
1428
|
let { grid: t, rings: n, lanes: r } = e.decor, i = new Float32Array(t ? 8 : 0);
|
|
1297
1429
|
t && i.set([
|
|
1298
1430
|
t.size,
|
|
@@ -1344,7 +1476,7 @@ function Lt(e) {
|
|
|
1344
1476
|
}
|
|
1345
1477
|
};
|
|
1346
1478
|
}
|
|
1347
|
-
function
|
|
1479
|
+
function Kt(e) {
|
|
1348
1480
|
let t = {
|
|
1349
1481
|
straight: [],
|
|
1350
1482
|
curved: [],
|
|
@@ -1379,7 +1511,7 @@ function Rt(e) {
|
|
|
1379
1511
|
l,
|
|
1380
1512
|
v
|
|
1381
1513
|
]), e.arrow) {
|
|
1382
|
-
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" &&
|
|
1514
|
+
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" && Ut(Bt, e.end) || Bt.arrow;
|
|
1383
1515
|
t.tips.push([
|
|
1384
1516
|
e.x2,
|
|
1385
1517
|
e.y2,
|
|
@@ -1395,7 +1527,7 @@ function Rt(e) {
|
|
|
1395
1527
|
if (e.ticks) {
|
|
1396
1528
|
let a = m(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];
|
|
1397
1529
|
for (let o = 0; o < e.ticks; o++) {
|
|
1398
|
-
let u = (o - (e.ticks - 1) / 2) *
|
|
1530
|
+
let u = (o - (e.ticks - 1) / 2) * R.tickGap;
|
|
1399
1531
|
t.tips.push([
|
|
1400
1532
|
a.x + c * u,
|
|
1401
1533
|
a.y + l * u,
|
|
@@ -1405,7 +1537,7 @@ function Rt(e) {
|
|
|
1405
1537
|
r,
|
|
1406
1538
|
i,
|
|
1407
1539
|
s,
|
|
1408
|
-
|
|
1540
|
+
Bt.tick
|
|
1409
1541
|
]);
|
|
1410
1542
|
}
|
|
1411
1543
|
}
|
|
@@ -1420,7 +1552,7 @@ function Rt(e) {
|
|
|
1420
1552
|
r,
|
|
1421
1553
|
i,
|
|
1422
1554
|
s,
|
|
1423
|
-
|
|
1555
|
+
Bt.strike
|
|
1424
1556
|
]);
|
|
1425
1557
|
}
|
|
1426
1558
|
if (e.packet) {
|
|
@@ -1462,12 +1594,12 @@ function Rt(e) {
|
|
|
1462
1594
|
packets: n(t.packets, 18)
|
|
1463
1595
|
};
|
|
1464
1596
|
}
|
|
1465
|
-
var
|
|
1466
|
-
...
|
|
1467
|
-
nodes:
|
|
1468
|
-
...
|
|
1597
|
+
var qt = (e) => ({
|
|
1598
|
+
...Gt(e),
|
|
1599
|
+
nodes: Wt(e),
|
|
1600
|
+
...Kt(e)
|
|
1469
1601
|
});
|
|
1470
|
-
function
|
|
1602
|
+
function Jt(e) {
|
|
1471
1603
|
let t = [];
|
|
1472
1604
|
e.nodes.forEach((e) => {
|
|
1473
1605
|
if (!e.stroke) return;
|
|
@@ -1492,11 +1624,11 @@ function Bt(e) {
|
|
|
1492
1624
|
stride: 10
|
|
1493
1625
|
};
|
|
1494
1626
|
}
|
|
1495
|
-
function
|
|
1627
|
+
function Yt(e, t, n = null) {
|
|
1496
1628
|
let r = /* @__PURE__ */ new Map();
|
|
1497
1629
|
e.nodes.forEach((e) => {
|
|
1498
|
-
let i = e.icon && t(e.icon) ? e.icon : null, a = e.r *
|
|
1499
|
-
if (!i && !e.icon && e.letters && t(
|
|
1630
|
+
let i = e.icon && t(e.icon) ? e.icon : null, a = e.r * de;
|
|
1631
|
+
if (!i && !e.icon && e.letters && t(he(e.letters)) && (i = he(e.letters), a = e.r * 1), !i && !e.icon && !e.letters && e.glyph) {
|
|
1500
1632
|
let r = y(e.glyph, D(e, n));
|
|
1501
1633
|
t(r) && (i = r, a = e.r * G);
|
|
1502
1634
|
}
|
|
@@ -1530,9 +1662,9 @@ function Vt(e, t, n = null) {
|
|
|
1530
1662
|
groups: i
|
|
1531
1663
|
};
|
|
1532
1664
|
}
|
|
1533
|
-
function
|
|
1665
|
+
function Xt(e = "dark", t = null) {
|
|
1534
1666
|
let { halo: n, mark: r, core: s } = t ? a(i(e), t) : i(e), c = /* @__PURE__ */ new Float32Array(16), l = /* @__PURE__ */ new Float32Array(16), u = /* @__PURE__ */ new Float32Array(16);
|
|
1535
|
-
Object.entries(
|
|
1667
|
+
Object.entries(zt).forEach(([e, t]) => {
|
|
1536
1668
|
let r = n[e];
|
|
1537
1669
|
t && r && (c.set($(r.fill), t * 4), l.set($(r.ring), t * 4), u.set([
|
|
1538
1670
|
r.fillR,
|
|
@@ -1542,7 +1674,7 @@ function Ht(e = "dark", t = null) {
|
|
|
1542
1674
|
], t * 4));
|
|
1543
1675
|
});
|
|
1544
1676
|
let d = /* @__PURE__ */ new Float32Array(20), f = /* @__PURE__ */ new Float32Array(20);
|
|
1545
|
-
return Object.entries(
|
|
1677
|
+
return Object.entries(Ht).forEach(([e, t]) => {
|
|
1546
1678
|
if (!t) return;
|
|
1547
1679
|
let n = r[e];
|
|
1548
1680
|
d.set($(n.color), t * 4);
|
|
@@ -1568,11 +1700,11 @@ function Ht(e = "dark", t = null) {
|
|
|
1568
1700
|
coreRatio: o
|
|
1569
1701
|
};
|
|
1570
1702
|
}
|
|
1571
|
-
var
|
|
1703
|
+
var Zt = [
|
|
1572
1704
|
{
|
|
1573
1705
|
name: "grid",
|
|
1574
|
-
vert:
|
|
1575
|
-
frag:
|
|
1706
|
+
vert: xt,
|
|
1707
|
+
frag: St,
|
|
1576
1708
|
stride: 8,
|
|
1577
1709
|
attribs: [[
|
|
1578
1710
|
1,
|
|
@@ -1586,8 +1718,8 @@ var Ut = [
|
|
|
1586
1718
|
},
|
|
1587
1719
|
{
|
|
1588
1720
|
name: "lanes",
|
|
1589
|
-
vert:
|
|
1590
|
-
frag:
|
|
1721
|
+
vert: Ct,
|
|
1722
|
+
frag: wt,
|
|
1591
1723
|
stride: 14,
|
|
1592
1724
|
attribs: [
|
|
1593
1725
|
[
|
|
@@ -1614,8 +1746,8 @@ var Ut = [
|
|
|
1614
1746
|
},
|
|
1615
1747
|
{
|
|
1616
1748
|
name: "rings",
|
|
1617
|
-
vert:
|
|
1618
|
-
frag:
|
|
1749
|
+
vert: Tt,
|
|
1750
|
+
frag: Et,
|
|
1619
1751
|
stride: 10,
|
|
1620
1752
|
attribs: [
|
|
1621
1753
|
[
|
|
@@ -1637,8 +1769,8 @@ var Ut = [
|
|
|
1637
1769
|
},
|
|
1638
1770
|
{
|
|
1639
1771
|
name: "straight",
|
|
1640
|
-
vert:
|
|
1641
|
-
frag:
|
|
1772
|
+
vert: jt(1),
|
|
1773
|
+
frag: Mt,
|
|
1642
1774
|
stride: 19,
|
|
1643
1775
|
verts: 8,
|
|
1644
1776
|
attribs: [
|
|
@@ -1677,8 +1809,8 @@ var Ut = [
|
|
|
1677
1809
|
},
|
|
1678
1810
|
{
|
|
1679
1811
|
name: "curved",
|
|
1680
|
-
vert:
|
|
1681
|
-
frag:
|
|
1812
|
+
vert: jt(24),
|
|
1813
|
+
frag: Mt,
|
|
1682
1814
|
stride: 19,
|
|
1683
1815
|
verts: 54,
|
|
1684
1816
|
attribs: [
|
|
@@ -1717,8 +1849,8 @@ var Ut = [
|
|
|
1717
1849
|
},
|
|
1718
1850
|
{
|
|
1719
1851
|
name: "tips",
|
|
1720
|
-
vert:
|
|
1721
|
-
frag:
|
|
1852
|
+
vert: Nt,
|
|
1853
|
+
frag: Pt,
|
|
1722
1854
|
stride: 9,
|
|
1723
1855
|
attribs: [
|
|
1724
1856
|
[
|
|
@@ -1741,8 +1873,8 @@ var Ut = [
|
|
|
1741
1873
|
},
|
|
1742
1874
|
{
|
|
1743
1875
|
name: "packets",
|
|
1744
|
-
vert:
|
|
1745
|
-
frag:
|
|
1876
|
+
vert: Ft,
|
|
1877
|
+
frag: It,
|
|
1746
1878
|
stride: 18,
|
|
1747
1879
|
attribs: [
|
|
1748
1880
|
[
|
|
@@ -1775,8 +1907,8 @@ var Ut = [
|
|
|
1775
1907
|
},
|
|
1776
1908
|
{
|
|
1777
1909
|
name: "nodes",
|
|
1778
|
-
vert:
|
|
1779
|
-
frag:
|
|
1910
|
+
vert: Dt,
|
|
1911
|
+
frag: Ot,
|
|
1780
1912
|
stride: 12,
|
|
1781
1913
|
attribs: [
|
|
1782
1914
|
[
|
|
@@ -1797,7 +1929,7 @@ var Ut = [
|
|
|
1797
1929
|
],
|
|
1798
1930
|
constants: "nodes"
|
|
1799
1931
|
}
|
|
1800
|
-
],
|
|
1932
|
+
], Qt = {
|
|
1801
1933
|
nodes(e, t, n) {
|
|
1802
1934
|
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"), v.roundedHalf, v.roundedCorner, v.hexInradius, v.squareHalf), e.uniform2f(t("u_shape2"), v.squareCorner, v.diamondHalf), e.uniform1f(t("u_glyphMin"), 14);
|
|
1803
1935
|
},
|
|
@@ -1805,9 +1937,9 @@ var Ut = [
|
|
|
1805
1937
|
e.uniform3fv(t("u_markMin"), n.markMin);
|
|
1806
1938
|
},
|
|
1807
1939
|
tips(e, t) {
|
|
1808
|
-
e.uniform4f(t("u_tip"), s.length, s.spread, _.halfLength, _.width), e.uniform4f(t("u_end"),
|
|
1940
|
+
e.uniform4f(t("u_tip"), s.length, s.spread, _.halfLength, _.width), e.uniform4f(t("u_end"), R.strokeWidth, R.barHalf, R.diamondHalf, R.diamondAcross), e.uniform2f(t("u_tick"), R.tickHalf, R.tickWidth);
|
|
1809
1941
|
}
|
|
1810
|
-
},
|
|
1942
|
+
}, $t = {
|
|
1811
1943
|
alpha: !0,
|
|
1812
1944
|
premultipliedAlpha: !0,
|
|
1813
1945
|
antialias: !1,
|
|
@@ -1816,7 +1948,7 @@ var Ut = [
|
|
|
1816
1948
|
preserveDrawingBuffer: !1,
|
|
1817
1949
|
powerPreference: "high-performance"
|
|
1818
1950
|
};
|
|
1819
|
-
function
|
|
1951
|
+
function en(e, t, n, r) {
|
|
1820
1952
|
let i = e.createShader(t);
|
|
1821
1953
|
if (e.shaderSource(i, n), e.compileShader(i), !e.getShaderParameter(i, e.COMPILE_STATUS)) {
|
|
1822
1954
|
let t = e.getShaderInfoLog(i);
|
|
@@ -1824,23 +1956,23 @@ function Kt(e, t, n, r) {
|
|
|
1824
1956
|
}
|
|
1825
1957
|
return i;
|
|
1826
1958
|
}
|
|
1827
|
-
function
|
|
1828
|
-
let i =
|
|
1959
|
+
function tn(e, t, n, r) {
|
|
1960
|
+
let i = en(e, e.VERTEX_SHADER, t, `${r} vertex`), a = en(e, e.FRAGMENT_SHADER, n, `${r} fragment`), o = e.createProgram();
|
|
1829
1961
|
if (e.attachShader(o, i), e.attachShader(o, a), e.linkProgram(o), e.deleteShader(i), e.deleteShader(a), !e.getProgramParameter(o, e.LINK_STATUS)) {
|
|
1830
1962
|
let t = e.getProgramInfoLog(o);
|
|
1831
1963
|
throw e.deleteProgram(o), Error(`${r} program did not link: ${t}`);
|
|
1832
1964
|
}
|
|
1833
1965
|
return o;
|
|
1834
1966
|
}
|
|
1835
|
-
var
|
|
1836
|
-
function
|
|
1837
|
-
let i =
|
|
1967
|
+
var nn = (e) => !e || e.plain ? 0 : e.version;
|
|
1968
|
+
function rn(e, t, n, r = null) {
|
|
1969
|
+
let i = Xt(n, r);
|
|
1838
1970
|
t.passes.forEach((t) => {
|
|
1839
|
-
t.spec.constants && (e.useProgram(t.program),
|
|
1840
|
-
}), t.theme = n, t.styleKey =
|
|
1971
|
+
t.spec.constants && (e.useProgram(t.program), Qt[t.spec.constants](e, t.at, i));
|
|
1972
|
+
}), t.theme = n, t.styleKey = nn(r);
|
|
1841
1973
|
}
|
|
1842
|
-
function
|
|
1843
|
-
let r =
|
|
1974
|
+
function an(e, t, n) {
|
|
1975
|
+
let r = tn(e, t.vert, t.frag, t.name), i = e.createVertexArray(), a = e.createBuffer();
|
|
1844
1976
|
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]) => {
|
|
1845
1977
|
e.enableVertexAttribArray(n), e.vertexAttribPointer(n, r, e.FLOAT, !1, t.stride * 4, i * 4), e.vertexAttribDivisor(n, 1);
|
|
1846
1978
|
}), e.bindVertexArray(null);
|
|
@@ -1860,11 +1992,11 @@ function Xt(e, t, n) {
|
|
|
1860
1992
|
}
|
|
1861
1993
|
};
|
|
1862
1994
|
}
|
|
1863
|
-
var
|
|
1995
|
+
var on = {
|
|
1864
1996
|
strokes: {
|
|
1865
1997
|
name: "strokes",
|
|
1866
|
-
vert:
|
|
1867
|
-
frag:
|
|
1998
|
+
vert: Tt,
|
|
1999
|
+
frag: Et,
|
|
1868
2000
|
stride: 10,
|
|
1869
2001
|
attribs: [
|
|
1870
2002
|
[
|
|
@@ -1886,8 +2018,8 @@ var Zt = {
|
|
|
1886
2018
|
},
|
|
1887
2019
|
icons: {
|
|
1888
2020
|
name: "icons",
|
|
1889
|
-
vert:
|
|
1890
|
-
frag:
|
|
2021
|
+
vert: Lt,
|
|
2022
|
+
frag: Rt,
|
|
1891
2023
|
stride: 4,
|
|
1892
2024
|
attribs: [[
|
|
1893
2025
|
1,
|
|
@@ -1896,7 +2028,7 @@ var Zt = {
|
|
|
1896
2028
|
]]
|
|
1897
2029
|
}
|
|
1898
2030
|
};
|
|
1899
|
-
function
|
|
2031
|
+
function sn(e, t = "dark", n = null) {
|
|
1900
2032
|
let r = e.createBuffer();
|
|
1901
2033
|
e.bindBuffer(e.ARRAY_BUFFER, r), e.bufferData(e.ARRAY_BUFFER, new Float32Array([
|
|
1902
2034
|
-1,
|
|
@@ -1910,7 +2042,7 @@ function Qt(e, t = "dark", n = null) {
|
|
|
1910
2042
|
]), e.STATIC_DRAW);
|
|
1911
2043
|
let i = {
|
|
1912
2044
|
corners: r,
|
|
1913
|
-
passes:
|
|
2045
|
+
passes: Zt.map((t) => an(e, t, r)),
|
|
1914
2046
|
theme: t,
|
|
1915
2047
|
styleKey: 0,
|
|
1916
2048
|
extras: {
|
|
@@ -1920,29 +2052,29 @@ function Qt(e, t = "dark", n = null) {
|
|
|
1920
2052
|
textures: /* @__PURE__ */ new Map(),
|
|
1921
2053
|
iconStore: null
|
|
1922
2054
|
};
|
|
1923
|
-
return
|
|
2055
|
+
return rn(e, i, t, n), i;
|
|
1924
2056
|
}
|
|
1925
|
-
function
|
|
2057
|
+
function cn(e, t) {
|
|
1926
2058
|
e.deleteBuffer(t.corners), t.textures.forEach(({ texture: t }) => e.deleteTexture(t)), [...t.passes, ...Object.values(t.extras).filter(Boolean)].forEach((t) => {
|
|
1927
2059
|
e.deleteProgram(t.program), e.deleteVertexArray(t.vao), e.deleteBuffer(t.buffer);
|
|
1928
2060
|
});
|
|
1929
2061
|
}
|
|
1930
|
-
function
|
|
1931
|
-
let n = t.gl || e.getContext("webgl2",
|
|
2062
|
+
function ln(e, t = {}) {
|
|
2063
|
+
let n = t.gl || e.getContext("webgl2", $t);
|
|
1932
2064
|
if (!n) throw Error("WebGL2 is not available");
|
|
1933
2065
|
let i = t.mapStyle || (() => x), a = {
|
|
1934
2066
|
uploads: 0,
|
|
1935
2067
|
draws: 0
|
|
1936
|
-
}, o =
|
|
2068
|
+
}, o = sn(n), s = !1, c = 0, l = 0, u = null, d = null, f, p = null;
|
|
1937
2069
|
function m(e) {
|
|
1938
|
-
return o.extras[e] || (o.extras[e] =
|
|
2070
|
+
return o.extras[e] || (o.extras[e] = an(n, on[e], o.corners)), o.extras[e];
|
|
1939
2071
|
}
|
|
1940
2072
|
function h() {
|
|
1941
2073
|
o.passes.forEach((e) => {
|
|
1942
2074
|
let t = u[e.spec.name];
|
|
1943
2075
|
e.count = t.count, t.count && (n.bindBuffer(n.ARRAY_BUFFER, e.buffer), n.bufferData(n.ARRAY_BUFFER, t.data, n.DYNAMIC_DRAW));
|
|
1944
2076
|
});
|
|
1945
|
-
for (let e of Object.keys(
|
|
2077
|
+
for (let e of Object.keys(on)) {
|
|
1946
2078
|
let t = u[e];
|
|
1947
2079
|
if (!t.count && !o.extras[e]) continue;
|
|
1948
2080
|
let r = m(e);
|
|
@@ -1974,12 +2106,12 @@ function en(e, t = {}) {
|
|
|
1974
2106
|
], s || !o || !c || !l) return;
|
|
1975
2107
|
let v = i(), y = S(t, v), b = v.values ? v.values[A] : void 0;
|
|
1976
2108
|
(o.iconStore !== v.icons || o.glyphInk !== b) && (o.textures.forEach(({ texture: e }) => n.deleteTexture(e)), o.textures.clear(), o.iconStore = v.icons, o.glyphInk = b, d = null), (y !== d || y.version !== f) && (u = {
|
|
1977
|
-
...
|
|
1978
|
-
strokes:
|
|
1979
|
-
icons:
|
|
2109
|
+
...qt(y),
|
|
2110
|
+
strokes: Jt(y),
|
|
2111
|
+
icons: Yt(y, (e) => ge(e) ? !!be(_e(e), b) : se(e) ? !!E(r(e).type, r(e).ink) : !!(v.icons && v.icons.get(e)), v)
|
|
1980
2112
|
}, d = y, f = y.version, h());
|
|
1981
2113
|
let x = y.theme || "dark";
|
|
1982
|
-
(o.theme !== x || o.styleKey !==
|
|
2114
|
+
(o.theme !== x || o.styleKey !== nn(v)) && rn(n, o, x, v), 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), o.passes.forEach((t) => {
|
|
1983
2115
|
t.count && (n.useProgram(t.program), n.uniform2f(t.uniforms.viewport, c, l), n.uniform3f(t.uniforms.cam, m.x, m.y, m.zoom), n.uniform1f(t.uniforms.dpr, e.width / c), n.bindVertexArray(t.vao), t.uniforms.time && n.uniform1f(t.uniforms.time, (g || 0) / 1e3), n.drawArraysInstanced(n.TRIANGLE_STRIP, 0, t.spec.verts || 4, t.count), a.draws++);
|
|
1984
2116
|
});
|
|
1985
2117
|
let C = o.extras.strokes;
|
|
@@ -1988,10 +2120,10 @@ function en(e, t = {}) {
|
|
|
1988
2120
|
if (w && w.count) {
|
|
1989
2121
|
n.useProgram(w.program), n.uniform2f(w.uniforms.viewport, c, l), n.uniform3f(w.uniforms.cam, m.x, m.y, m.zoom), n.uniform1f(w.uniforms.dpr, e.width / c), n.uniform1i(w.at("u_tex"), 0), n.activeTexture(n.TEXTURE0), n.bindVertexArray(w.vao), n.bindBuffer(n.ARRAY_BUFFER, w.buffer);
|
|
1990
2122
|
for (let e of u.icons.groups) {
|
|
1991
|
-
let t =
|
|
2123
|
+
let t = ge(e.kind), i = se(e.kind), o = t || i ? 14 : 0;
|
|
1992
2124
|
if (o && e.maxR * 2 * m.zoom < o) continue;
|
|
1993
2125
|
n.uniform1f(w.at("u_minR"), o / 2), n.uniform1f(w.at("u_sideRatio"), t ? 1 : i ? G : 1);
|
|
1994
|
-
let s = t ?
|
|
2126
|
+
let s = t ? be(_e(e.kind), v.values && v.values["--corn-map-glyph"]) : i ? E(r(e.kind).type, r(e.kind).ink) : v.icons && v.icons.get(e.kind);
|
|
1995
2127
|
s && (n.bindTexture(n.TEXTURE_2D, _(e.kind, s, !!v.pixelated && !t && !i)), n.vertexAttribPointer(1, 4, n.FLOAT, !1, 16, e.first * 4 * 4), n.drawArraysInstanced(n.TRIANGLE_STRIP, 0, 4, e.count), a.draws++);
|
|
1996
2128
|
}
|
|
1997
2129
|
}
|
|
@@ -2001,7 +2133,7 @@ function en(e, t = {}) {
|
|
|
2001
2133
|
e.preventDefault(), s = !0, o = null;
|
|
2002
2134
|
}, b = () => {
|
|
2003
2135
|
try {
|
|
2004
|
-
o =
|
|
2136
|
+
o = sn(n, p && p[0].theme || "dark", i()), s = !1, u && h(), p && v(...p);
|
|
2005
2137
|
} catch (e) {
|
|
2006
2138
|
console.warn("WebGL2 context restored but the renderer could not be rebuilt:", e.message);
|
|
2007
2139
|
}
|
|
@@ -2024,30 +2156,30 @@ function en(e, t = {}) {
|
|
|
2024
2156
|
}
|
|
2025
2157
|
};
|
|
2026
2158
|
function C() {
|
|
2027
|
-
e.removeEventListener("webglcontextlost", y), e.removeEventListener("webglcontextrestored", b), o && !s &&
|
|
2159
|
+
e.removeEventListener("webglcontextlost", y), e.removeEventListener("webglcontextrestored", b), o && !s && cn(n, o), o = null, s = !0;
|
|
2028
2160
|
}
|
|
2029
2161
|
}
|
|
2030
2162
|
// ../explorer/renderer.js
|
|
2031
|
-
function
|
|
2163
|
+
function un(e) {
|
|
2032
2164
|
let t = e.ownerDocument.createElement("canvas");
|
|
2033
2165
|
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;
|
|
2034
2166
|
}
|
|
2035
|
-
function
|
|
2167
|
+
function dn(e, t = {}) {
|
|
2036
2168
|
let n = t.prefer || null, r = t.mapStyle ? { mapStyle: t.mapStyle } : {};
|
|
2037
|
-
if (n === "canvas2d") return
|
|
2169
|
+
if (n === "canvas2d") return Le(e, r);
|
|
2038
2170
|
let i = null;
|
|
2039
2171
|
try {
|
|
2040
|
-
i = e.getContext("webgl2",
|
|
2172
|
+
i = e.getContext("webgl2", $t);
|
|
2041
2173
|
} catch {}
|
|
2042
|
-
if (!i) return
|
|
2174
|
+
if (!i) return Le(e, r);
|
|
2043
2175
|
try {
|
|
2044
|
-
return
|
|
2176
|
+
return ln(e, {
|
|
2045
2177
|
gl: i,
|
|
2046
2178
|
...r
|
|
2047
2179
|
});
|
|
2048
2180
|
} catch (n) {
|
|
2049
2181
|
console.warn(`WebGL2 renderer unavailable, drawing with Canvas 2D: ${n.message}`);
|
|
2050
|
-
let i = (t.makeStandIn ||
|
|
2182
|
+
let i = (t.makeStandIn || un)(e), a = Le(i, r);
|
|
2051
2183
|
return {
|
|
2052
2184
|
...a,
|
|
2053
2185
|
destroy() {
|
|
@@ -2057,7 +2189,7 @@ function nn(e, t = {}) {
|
|
|
2057
2189
|
}
|
|
2058
2190
|
}
|
|
2059
2191
|
// ../explorer/cluster.js
|
|
2060
|
-
function
|
|
2192
|
+
function fn(e, t) {
|
|
2061
2193
|
let n = /* @__PURE__ */ new Map();
|
|
2062
2194
|
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);
|
|
2063
2195
|
let r = /* @__PURE__ */ new Set([e]), i = [e];
|
|
@@ -2065,7 +2197,7 @@ function rn(e, t) {
|
|
|
2065
2197
|
return r;
|
|
2066
2198
|
}
|
|
2067
2199
|
// ../explorer/input.js
|
|
2068
|
-
function
|
|
2200
|
+
function pn(e) {
|
|
2069
2201
|
let { state: t } = e, { render: n, getSpatialIndex: r, queueFrameWork: i, screenToWorld: a, getMinZoom: o, setHoverNode: s, labelNodeAt: c, fitGraphToViewport: u, fitPadding: d } = e.map, f = (t) => e.emit("select", t), m = () => e.emit("background"), g = () => e.emit("grab"), _ = !1, v = null, y = {
|
|
2070
2202
|
x: 0,
|
|
2071
2203
|
y: 0
|
|
@@ -2093,20 +2225,20 @@ function an(e) {
|
|
|
2093
2225
|
}), F.map.get(e) || null;
|
|
2094
2226
|
}
|
|
2095
2227
|
function ee(e, n, i) {
|
|
2096
|
-
let a =
|
|
2228
|
+
let a = Be(r(), t.camera, e, n, i);
|
|
2097
2229
|
return a ? I(a.id) : null;
|
|
2098
2230
|
}
|
|
2099
2231
|
let te = (e) => Math.hypot(e.touches[0].clientX - e.touches[1].clientX, e.touches[0].clientY - e.touches[1].clientY);
|
|
2100
|
-
function
|
|
2232
|
+
function L(e) {
|
|
2101
2233
|
let n = t.canvas.getBoundingClientRect();
|
|
2102
2234
|
return {
|
|
2103
2235
|
x: (e.touches[0].clientX + e.touches[1].clientX) / 2 - n.left,
|
|
2104
2236
|
y: (e.touches[0].clientY + e.touches[1].clientY) / 2 - n.top
|
|
2105
2237
|
};
|
|
2106
2238
|
}
|
|
2107
|
-
function
|
|
2239
|
+
function R(e) {
|
|
2108
2240
|
if (D = !0, g(), s(null), e.touches && e.touches.length === 2) {
|
|
2109
|
-
E = l(t.camera, te(e),
|
|
2241
|
+
E = l(t.camera, te(e), L(e)), O = null, _ = !1, v = null, S = null;
|
|
2110
2242
|
return;
|
|
2111
2243
|
}
|
|
2112
2244
|
let n = !!(e.touches && e.touches.length > 0), r = P(e);
|
|
@@ -2115,7 +2247,7 @@ function an(e) {
|
|
|
2115
2247
|
y: r.y
|
|
2116
2248
|
}, x = !1, O = null, S = ee(r.x, r.y, n), N() && S ? (v = S, e.cancelable && e.preventDefault()) : (_ = !0, y = r);
|
|
2117
2249
|
}
|
|
2118
|
-
function
|
|
2250
|
+
function ne() {
|
|
2119
2251
|
k && E && Object.assign(t.camera, T(E, k.dist, k.mid, o())), k = null;
|
|
2120
2252
|
let n = O;
|
|
2121
2253
|
if (O = null, n) {
|
|
@@ -2124,7 +2256,7 @@ function an(e) {
|
|
|
2124
2256
|
v.x = r.x, v.y = r.y, t.freeformPositions[v.id] = {
|
|
2125
2257
|
x: r.x,
|
|
2126
2258
|
y: r.y
|
|
2127
|
-
}, e.touchScene(),
|
|
2259
|
+
}, e.touchScene(), fe(e);
|
|
2128
2260
|
} else _ && (t.camera.x += n.x - y.x, t.camera.y += n.y - y.y, y = n);
|
|
2129
2261
|
}
|
|
2130
2262
|
}
|
|
@@ -2141,15 +2273,15 @@ function an(e) {
|
|
|
2141
2273
|
if (e.touches && e.touches.length === 2 && E) {
|
|
2142
2274
|
e.cancelable && e.preventDefault(), k = {
|
|
2143
2275
|
dist: te(e),
|
|
2144
|
-
mid:
|
|
2145
|
-
}, i(
|
|
2276
|
+
mid: L(e)
|
|
2277
|
+
}, i(ne);
|
|
2146
2278
|
return;
|
|
2147
2279
|
}
|
|
2148
2280
|
let t = P(e);
|
|
2149
|
-
Math.hypot(t.x - b.x, t.y - b.y) > 8 && (x = !0), v && N() || _ ? (e.cancelable && e.preventDefault(), O = t, i(
|
|
2281
|
+
Math.hypot(t.x - b.x, t.y - b.y) > 8 && (x = !0), v && N() || _ ? (e.cancelable && e.preventDefault(), O = t, i(ne)) : e.touches || (A = t, i(z, { draw: !1 }));
|
|
2150
2282
|
}
|
|
2151
2283
|
function H(e) {
|
|
2152
|
-
|
|
2284
|
+
ne();
|
|
2153
2285
|
let n = !!(e.changedTouches && e.changedTouches.length > 0), r = t.canvas.getBoundingClientRect(), i = n ? {
|
|
2154
2286
|
x: e.changedTouches[0].clientX - r.left,
|
|
2155
2287
|
y: e.changedTouches[0].clientY - r.top
|
|
@@ -2166,125 +2298,37 @@ function an(e) {
|
|
|
2166
2298
|
}
|
|
2167
2299
|
} else {
|
|
2168
2300
|
let e = I(c(i.x, i.y));
|
|
2169
|
-
e && h.includes(e.type) && e.id !== "root" ? u(d(),
|
|
2301
|
+
e && h.includes(e.type) && e.id !== "root" ? u(d(), fn(e.id, t.edges)) : t.selectedNode && m();
|
|
2170
2302
|
}
|
|
2171
2303
|
}
|
|
2172
2304
|
_ = !1, v = null, S = null, E = null, k = null, D = !1;
|
|
2173
2305
|
}
|
|
2174
|
-
let { canvas: U } = t,
|
|
2175
|
-
if (
|
|
2306
|
+
let { canvas: U } = t, re = !(e.root && e.root.nodeType === 9), W = (r) => {
|
|
2307
|
+
if (re && !r.ctrlKey && !r.metaKey && e.active() !== t.canvas) return;
|
|
2176
2308
|
r.preventDefault(), g();
|
|
2177
2309
|
let i = P(r);
|
|
2178
2310
|
Object.assign(t.camera, p(t.camera, r.deltaY < 0 ? 1.12 : .88, i.x, i.y, o())), n();
|
|
2179
|
-
},
|
|
2180
|
-
e.listen(U, "mousedown",
|
|
2311
|
+
}, G = e.root || U, ie = [
|
|
2312
|
+
e.listen(U, "mousedown", R),
|
|
2181
2313
|
e.listen(U, "mousemove", V),
|
|
2182
2314
|
e.listen(U, "mouseleave", () => {
|
|
2183
2315
|
A = null, B(!1), s(null);
|
|
2184
2316
|
}),
|
|
2185
|
-
e.listen(
|
|
2186
|
-
e.listen(U, "touchstart",
|
|
2317
|
+
e.listen(G, "mouseup", H),
|
|
2318
|
+
e.listen(U, "touchstart", R, { passive: !1 }),
|
|
2187
2319
|
e.listen(U, "touchmove", V, { passive: !1 }),
|
|
2188
|
-
e.listen(
|
|
2189
|
-
e.listen(
|
|
2190
|
-
e.listen(U, "wheel",
|
|
2320
|
+
e.listen(G, "touchend", H, { passive: !1 }),
|
|
2321
|
+
e.listen(G, "touchcancel", H, { passive: !1 }),
|
|
2322
|
+
e.listen(U, "wheel", W, { passive: !1 })
|
|
2191
2323
|
];
|
|
2192
2324
|
return () => ie.forEach((e) => e());
|
|
2193
2325
|
}
|
|
2194
|
-
// ../explorer/flow-build.js
|
|
2195
|
-
function on(e, t) {
|
|
2196
|
-
let n = new Map(e.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map();
|
|
2197
|
-
t.forEach((e) => {
|
|
2198
|
-
!e.kind && !e.dashed && n.get(e.from)?.type === "app" && n.get(e.to)?.type === "page" && r.set(e.to, e.from);
|
|
2199
|
-
});
|
|
2200
|
-
let i = e.filter((e) => e.type === "container" && e.selfHosted), a = /* @__PURE__ */ new Map();
|
|
2201
|
-
t.forEach((e) => {
|
|
2202
|
-
let t = n.get(e.from);
|
|
2203
|
-
if (e.kind !== "delivers" || t?.type !== "container" || t.selfHosted || n.get(e.to)?.type !== "page") return;
|
|
2204
|
-
let r = i.filter((e) => e.stack === t.stack);
|
|
2205
|
-
r.length === 1 && a.set(t.id, r[0].id);
|
|
2206
|
-
});
|
|
2207
|
-
let o = (e) => n.get(e)?.type === "page" ? r.get(e) || e : a.get(e) || e, s = new Set([...r].filter(([e]) => Array.isArray(n.get(e)?.methods) && n.get(e).methods.length).map(([, e]) => e)), c = (e) => e.type === "store" && (e.tier === "browser" || e.id === "store-idb"), l = /* @__PURE__ */ new Set();
|
|
2208
|
-
t.forEach((e) => {
|
|
2209
|
-
if (e.kind === "reads" || e.kind === "writes") {
|
|
2210
|
-
let t = e.kind === "reads" ? e.to : e.from;
|
|
2211
|
-
n.get(t)?.type === "page" && l.add(o(t));
|
|
2212
|
-
}
|
|
2213
|
-
}), t.forEach((e) => {
|
|
2214
|
-
e.kind === "flow" && e.flow === "api" && n.get(e.from)?.type === "app" && l.add(e.from);
|
|
2215
|
-
});
|
|
2216
|
-
let u = new Set(t.filter((e) => e.kind === "flow" && e.flow === "api").map((e) => `${o(e.from)}|${o(e.to)}`)), d = (t) => e.filter(t).sort((e, t) => String(e.label).localeCompare(String(t.label))), f = [
|
|
2217
|
-
{
|
|
2218
|
-
key: "browser",
|
|
2219
|
-
title: "Browser",
|
|
2220
|
-
note: "saved on the device first",
|
|
2221
|
-
nodes: d(c)
|
|
2222
|
-
},
|
|
2223
|
-
{
|
|
2224
|
-
key: "servers",
|
|
2225
|
-
title: "App servers",
|
|
2226
|
-
note: "pages, no-JS forms",
|
|
2227
|
-
nodes: d((e) => e.type === "app" && !s.has(e.id) && l.has(e.id))
|
|
2228
|
-
},
|
|
2229
|
-
{
|
|
2230
|
-
key: "api",
|
|
2231
|
-
title: "API",
|
|
2232
|
-
note: "where the endpoints are",
|
|
2233
|
-
nodes: d((e) => s.has(e.id))
|
|
2234
|
-
},
|
|
2235
|
-
{
|
|
2236
|
-
key: "tables",
|
|
2237
|
-
title: "Tables",
|
|
2238
|
-
note: "stores and tables",
|
|
2239
|
-
nodes: [...d((e) => e.type === "store" && !c(e)), ...d((e) => e.type === "table")]
|
|
2240
|
-
},
|
|
2241
|
-
{
|
|
2242
|
-
key: "services",
|
|
2243
|
-
title: "Services",
|
|
2244
|
-
note: "jobs, hooks, webhooks",
|
|
2245
|
-
nodes: d((e) => e.type === "service")
|
|
2246
|
-
},
|
|
2247
|
-
{
|
|
2248
|
-
key: "outside",
|
|
2249
|
-
title: "Outside",
|
|
2250
|
-
note: "systems the API reaches",
|
|
2251
|
-
nodes: [...d((e) => e.type === "external"), ...d((e) => e.type === "container" && e.selfHosted)]
|
|
2252
|
-
}
|
|
2253
|
-
], p = new Set(f.flatMap((e) => e.nodes.map((e) => e.id))), m = [], h = /* @__PURE__ */ new Set(), g = (e, t, n) => {
|
|
2254
|
-
if (t === n || !p.has(t) || !p.has(n)) return;
|
|
2255
|
-
let r = `${t}|${n}|${e.kind}|${e.flow || ""}`;
|
|
2256
|
-
h.has(r) || (h.add(r), m.push({
|
|
2257
|
-
...e,
|
|
2258
|
-
from: t,
|
|
2259
|
-
to: n,
|
|
2260
|
-
status: e.status || "live",
|
|
2261
|
-
phase: void 0
|
|
2262
|
-
}));
|
|
2263
|
-
};
|
|
2264
|
-
return t.forEach((e) => {
|
|
2265
|
-
if (!(e.kind === "calls" && u.has(`${o(e.from)}|${o(e.to)}`)) && (e.kind !== "calls" || n.get(e.from)?.type !== "container")) {
|
|
2266
|
-
if (e.kind === "flow" || [
|
|
2267
|
-
"calls",
|
|
2268
|
-
"triggers",
|
|
2269
|
-
"delivers"
|
|
2270
|
-
].includes(e.kind)) return g(e, o(e.from), o(e.to));
|
|
2271
|
-
if (e.kind === "reads" || e.kind === "writes") {
|
|
2272
|
-
let t = e.kind === "reads" ? e.to : e.from;
|
|
2273
|
-
return n.get(t)?.type === "page" && !s.has(o(t)) ? void 0 : g(e, o(e.from), o(e.to));
|
|
2274
|
-
}
|
|
2275
|
-
}
|
|
2276
|
-
}), {
|
|
2277
|
-
tiers: f,
|
|
2278
|
-
ids: p,
|
|
2279
|
-
edges: m
|
|
2280
|
-
};
|
|
2281
|
-
}
|
|
2282
2326
|
// ../explorer/pieces/map.js
|
|
2283
|
-
var
|
|
2284
|
-
<p id="map-keys-help" class="hx-sr-only">${
|
|
2327
|
+
var mn = "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.", hn = "<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>", gn = ({ keysHelp: e = mn } = {}) => ({ stage: `${hn}
|
|
2328
|
+
<p id="map-keys-help" class="hx-sr-only">${W(e)}</p>
|
|
2285
2329
|
<p id="map-announcer" class="hx-sr-only" role="status" aria-live="polite"></p>
|
|
2286
2330
|
<canvas id="label-canvas" data-corn="label-canvas" aria-hidden="true"></canvas>` });
|
|
2287
|
-
function
|
|
2331
|
+
function _n(e, t, n) {
|
|
2288
2332
|
let r = j(t, e, "<div data-corn=\"map-stage\"></div>", null, "stage"), i = n.mountStatus(r[0], t, { follow: !1 });
|
|
2289
2333
|
i.refuse("second-map"), t.emit("piece:refused", {
|
|
2290
2334
|
piece: "map",
|
|
@@ -2307,16 +2351,16 @@ function un(e, t, n) {
|
|
|
2307
2351
|
}
|
|
2308
2352
|
};
|
|
2309
2353
|
}
|
|
2310
|
-
function
|
|
2354
|
+
function vn(e) {
|
|
2311
2355
|
let t = e.nodeType === 11 ? e.host : e;
|
|
2312
2356
|
return t && typeof t.getRootNode == "function" ? t.getRootNode() : null;
|
|
2313
2357
|
}
|
|
2314
|
-
function
|
|
2315
|
-
return !t && n.src !== void 0 && n.src !== null && n.src !== "" ?
|
|
2358
|
+
function yn(e, t, n = {}) {
|
|
2359
|
+
return !t && n.src !== void 0 && n.src !== null && n.src !== "" ? bn(e, n) : xn(e, t, n, null);
|
|
2316
2360
|
}
|
|
2317
|
-
function
|
|
2361
|
+
function bn(e, t) {
|
|
2318
2362
|
let n = e.nodeType === 11 ? e.host : e, r = {}, i = null, a = !1;
|
|
2319
|
-
return import("./scope-
|
|
2363
|
+
return import("./scope-HD2C0JDl.js").then((e) => e.n).then(({ mountScope: o }) => {
|
|
2320
2364
|
if (a) return;
|
|
2321
2365
|
let s = o(n, {
|
|
2322
2366
|
src: t.src,
|
|
@@ -2328,7 +2372,7 @@ function pn(e, t) {
|
|
|
2328
2372
|
onAuth: t.onAuth,
|
|
2329
2373
|
onError: t.onError
|
|
2330
2374
|
});
|
|
2331
|
-
i =
|
|
2375
|
+
i = xn(e, s.instance, {
|
|
2332
2376
|
...t,
|
|
2333
2377
|
...r
|
|
2334
2378
|
}, s);
|
|
@@ -2364,9 +2408,9 @@ function pn(e, t) {
|
|
|
2364
2408
|
}
|
|
2365
2409
|
};
|
|
2366
2410
|
}
|
|
2367
|
-
function
|
|
2411
|
+
function xn(e, t, n, r) {
|
|
2368
2412
|
let i = !t;
|
|
2369
|
-
i && (t =
|
|
2413
|
+
i && (t = V({
|
|
2370
2414
|
root: e,
|
|
2371
2415
|
base: n.base || "",
|
|
2372
2416
|
fetch: n.fetch,
|
|
@@ -2376,20 +2420,20 @@ function mn(e, t, n, r) {
|
|
|
2376
2420
|
if (a) try {
|
|
2377
2421
|
o = t.attach(e);
|
|
2378
2422
|
} catch {
|
|
2379
|
-
return r && r.destroy(),
|
|
2423
|
+
return r && r.destroy(), _n(e, t, a);
|
|
2380
2424
|
}
|
|
2381
2425
|
let { state: s } = t, c = a ? a.source : null;
|
|
2382
2426
|
if (n.tokens) {
|
|
2383
|
-
let t =
|
|
2384
|
-
t &&
|
|
2427
|
+
let t = vn(e);
|
|
2428
|
+
t && ae(t.nodeType === 9 ? t : t.ownerDocument, n.tokens), t && t.nodeType === 11 && ae(t, n.tokens);
|
|
2385
2429
|
}
|
|
2386
|
-
let l =
|
|
2430
|
+
let l = ne(t);
|
|
2387
2431
|
l.own(o), r && l.own(() => r.destroy());
|
|
2388
2432
|
let u = (e) => e === "canvas2d" ? "canvas2d" : "auto", d = (e) => e === "light" || e === "dark" ? e : "auto", f = {
|
|
2389
2433
|
renderer: u(n.renderer),
|
|
2390
2434
|
theme: d(n.theme),
|
|
2391
2435
|
topology: void 0
|
|
2392
|
-
}, p = n.topology !== void 0 && n.topology !== null, m = !1, h = !1, g =
|
|
2436
|
+
}, p = n.topology !== void 0 && n.topology !== null, m = !1, h = !1, g = gn({ keysHelp: n.keysHelp }).stage, _ = n.slots && n.slots.stage ? n.slots : null, v = j(t, e, _ ? g : `<div data-corn="map-stage">${g}</div>`, _, "stage"), y = (e) => v.map((t) => t.matches(e) ? t : t.querySelector(e)).find(Boolean);
|
|
2393
2437
|
l.own(() => {
|
|
2394
2438
|
for (let e of [...v, s.canvas]) e && e.remove();
|
|
2395
2439
|
});
|
|
@@ -2404,9 +2448,9 @@ function mn(e, t, n, r) {
|
|
|
2404
2448
|
l.own(e.destroy);
|
|
2405
2449
|
}
|
|
2406
2450
|
s.canvas = y("[data-corn=\"map-canvas\"]"), s.labelCanvas = y("[data-corn=\"label-canvas\"]"), s.ctx = t.doc.createElement("canvas").getContext("2d");
|
|
2407
|
-
let x =
|
|
2451
|
+
let x = mt(t, n.measureCovered ? { measureCovered: n.measureCovered } : {}), S = ue(t);
|
|
2408
2452
|
l.own(S.watch()), l.own(S.onChange(() => x.render()));
|
|
2409
|
-
let C = () => f.renderer === "canvas2d" ? "canvas2d" : null, w = () => x.setRenderer(
|
|
2453
|
+
let C = () => f.renderer === "canvas2d" ? "canvas2d" : null, w = () => x.setRenderer(dn(s.canvas, {
|
|
2410
2454
|
prefer: C(),
|
|
2411
2455
|
mapStyle: S.get
|
|
2412
2456
|
})), T = t.win && t.win.matchMedia ? t.win.matchMedia("(prefers-color-scheme: light)") : null;
|
|
@@ -2414,7 +2458,7 @@ function mn(e, t, n, r) {
|
|
|
2414
2458
|
if (f.theme === "light" || f.theme === "dark") return f.theme;
|
|
2415
2459
|
if (a && (a.theme === "light" || a.theme === "dark")) return a.theme;
|
|
2416
2460
|
let e = t.doc && t.doc.documentElement, n = e ? e.getAttribute("data-theme") : null;
|
|
2417
|
-
return n === "light" || n === "dark" ? n :
|
|
2461
|
+
return n === "light" || n === "dark" ? n : ie("system", !!(T && T.matches));
|
|
2418
2462
|
}
|
|
2419
2463
|
function D() {
|
|
2420
2464
|
if (m) return;
|
|
@@ -2422,25 +2466,20 @@ function mn(e, t, n, r) {
|
|
|
2422
2466
|
S.refresh(), s.theme !== e && (s.theme = e, t.touchScene()), x.render();
|
|
2423
2467
|
}
|
|
2424
2468
|
s.theme = E(), a && l.own(a.serverTheme.adopt(e)), a && (l.on("theme", () => D()), l.on("scope:theme", () => D())), T && T.addEventListener && (T.addEventListener("change", D), l.own(() => T.removeEventListener("change", D)));
|
|
2425
|
-
let
|
|
2426
|
-
if (
|
|
2427
|
-
let e = new
|
|
2469
|
+
let O = t.win && t.win.MutationObserver;
|
|
2470
|
+
if (O && t.doc && t.doc.documentElement) {
|
|
2471
|
+
let e = new O(D);
|
|
2428
2472
|
e.observe(t.doc.documentElement, {
|
|
2429
2473
|
attributes: !0,
|
|
2430
2474
|
attributeFilter: ["data-theme", "class"]
|
|
2431
2475
|
}), l.own(() => e.disconnect());
|
|
2432
2476
|
}
|
|
2433
2477
|
w();
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
let M = !1, P = () => {
|
|
2440
|
-
s.nodes.length && (M = !s.width || !s.height, M || x.fitGraphToViewport(x.fitPadding()));
|
|
2441
|
-
}, F = (e) => s.nodes.find((t) => t.id === e) || null, L = null;
|
|
2442
|
-
l.on("select", (e) => V(t, e, { source: "tap" })), l.on("background", () => W(t, { source: "tap" })), l.on("grab", () => ne(t)), l.on("selection", ({ node: e, edge: t, source: r }) => {
|
|
2443
|
-
m || ((e || t) && (L = null), n.onSelect && (e ? n.onSelect({
|
|
2478
|
+
let k = () => vt(t), A = !1, M = () => {
|
|
2479
|
+
s.nodes.length && (A = !s.width || !s.height, A || x.fitGraphToViewport(x.fitPadding()));
|
|
2480
|
+
}, P = (e) => s.nodes.find((t) => t.id === e) || null, I = null;
|
|
2481
|
+
l.on("select", (e) => B(t, e, { source: "tap" })), l.on("background", () => re(t, { source: "tap" })), l.on("grab", () => ee(t)), l.on("selection", ({ node: e, edge: t, source: r }) => {
|
|
2482
|
+
m || ((e || t) && (I = null), n.onSelect && (e ? n.onSelect({
|
|
2444
2483
|
id: e.id,
|
|
2445
2484
|
kind: "node",
|
|
2446
2485
|
source: r
|
|
@@ -2456,95 +2495,95 @@ function mn(e, t, n, r) {
|
|
|
2456
2495
|
source: r
|
|
2457
2496
|
})));
|
|
2458
2497
|
});
|
|
2459
|
-
function
|
|
2460
|
-
let n =
|
|
2461
|
-
return !n || m ? !1 : (
|
|
2498
|
+
function te(e) {
|
|
2499
|
+
let n = P(String(e));
|
|
2500
|
+
return !n || m ? !1 : (B(t, n, {
|
|
2462
2501
|
frame: !0,
|
|
2463
2502
|
source: "api"
|
|
2464
2503
|
}), !0);
|
|
2465
2504
|
}
|
|
2466
|
-
let
|
|
2467
|
-
function
|
|
2468
|
-
let e = s.canvas, n = [
|
|
2469
|
-
|
|
2505
|
+
let L = () => {}, R = !!t.root && t.root.nodeType === 9;
|
|
2506
|
+
function z() {
|
|
2507
|
+
let e = s.canvas, n = [pn(t)];
|
|
2508
|
+
R || n.push(t.listen(e, "pointerdown", (t) => {
|
|
2470
2509
|
if (t.pointerType === "mouse" && e.setPointerCapture) try {
|
|
2471
2510
|
e.setPointerCapture(t.pointerId);
|
|
2472
2511
|
} catch {}
|
|
2473
|
-
})),
|
|
2512
|
+
})), F(t), N(t), n.push(() => F(t)), L = () => n.forEach((e) => e());
|
|
2474
2513
|
}
|
|
2475
2514
|
l.own(x.onPaint(() => {
|
|
2476
|
-
|
|
2477
|
-
})),
|
|
2478
|
-
let
|
|
2479
|
-
!p && c && c.topology && c.topology !== f.topology && (f.topology = c.topology,
|
|
2515
|
+
A && s.width && s.height && M(), !h && s.nodes.length && (h = !0, n.onReady && n.onReady());
|
|
2516
|
+
})), z(), l.own(() => L());
|
|
2517
|
+
let H = () => {
|
|
2518
|
+
!p && c && c.topology && c.topology !== f.topology && (f.topology = c.topology, W(c.topology));
|
|
2480
2519
|
};
|
|
2481
2520
|
c && l.on("source", (e) => {
|
|
2482
|
-
e.state === "ready" &&
|
|
2521
|
+
e.state === "ready" && H();
|
|
2483
2522
|
}), l.own(x.watchSize()), x.resize();
|
|
2484
|
-
function
|
|
2485
|
-
let n =
|
|
2486
|
-
|
|
2487
|
-
let
|
|
2488
|
-
|
|
2489
|
-
let
|
|
2490
|
-
|
|
2491
|
-
}
|
|
2492
|
-
function
|
|
2523
|
+
function W(e) {
|
|
2524
|
+
let n = s.selectedNode ? s.selectedNode.id : null;
|
|
2525
|
+
_t(t, e);
|
|
2526
|
+
let r = n ? P(n) : null;
|
|
2527
|
+
s.nodes.length && (k(), M());
|
|
2528
|
+
let i = !r && I ? P(I) : null;
|
|
2529
|
+
i && B(t, i, { source: "api" }), x.render(), x.ensureFlowLoop();
|
|
2530
|
+
}
|
|
2531
|
+
function G(e) {
|
|
2493
2532
|
let n = e === "dataflow" ? "dataflow" : "orbit";
|
|
2494
|
-
s.view !== n && (s.view = n, t.touchScene(), s.nodes.length && (
|
|
2533
|
+
s.view !== n && (s.view = n, t.touchScene(), s.nodes.length && (k(), M(), x.ensureFlowLoop()));
|
|
2495
2534
|
}
|
|
2496
|
-
function
|
|
2535
|
+
function oe() {
|
|
2497
2536
|
let e = x.getRenderer();
|
|
2498
|
-
e.release ? e.release() : e.destroy(),
|
|
2537
|
+
e.release ? e.release() : e.destroy(), L();
|
|
2499
2538
|
let n = t.doc.createElement("template");
|
|
2500
|
-
n.innerHTML =
|
|
2539
|
+
n.innerHTML = hn;
|
|
2501
2540
|
let r = n.content.firstElementChild;
|
|
2502
2541
|
r.setAttribute("part", "map-canvas");
|
|
2503
2542
|
let i = t.active() === s.canvas;
|
|
2504
|
-
s.canvas.replaceWith(r), s.canvas = r,
|
|
2543
|
+
s.canvas.replaceWith(r), s.canvas = r, z(), w(), x.resize(), i && r.focus();
|
|
2505
2544
|
}
|
|
2506
|
-
function
|
|
2545
|
+
function se(e = {}) {
|
|
2507
2546
|
if (!m) {
|
|
2508
2547
|
if ("renderer" in e) {
|
|
2509
2548
|
let t = u(e.renderer);
|
|
2510
|
-
t !== f.renderer && (f.renderer = t,
|
|
2549
|
+
t !== f.renderer && (f.renderer = t, oe());
|
|
2511
2550
|
}
|
|
2512
2551
|
if ("theme" in e) {
|
|
2513
2552
|
let t = d(e.theme);
|
|
2514
2553
|
t !== f.theme && (f.theme = t, D());
|
|
2515
2554
|
}
|
|
2516
|
-
if ("topology" in e && (p = e.topology !== void 0 && e.topology !== null, p && e.topology !== f.topology ? (f.topology = e.topology,
|
|
2555
|
+
if ("topology" in e && (p = e.topology !== void 0 && e.topology !== null, p && e.topology !== f.topology ? (f.topology = e.topology, W(e.topology)) : !p && c && c.topology ? (f.topology = void 0, H()) : !p && e.topology !== f.topology && (f.topology = e.topology, W(e.topology))), "view" in e && G(e.view === "dataflow" ? "dataflow" : "orbit"), "node" in e) {
|
|
2517
2556
|
let n = e.node == null || e.node === "" ? null : String(e.node);
|
|
2518
|
-
if (n === null)
|
|
2557
|
+
if (n === null) I = null, (s.selectedNode || s.selectedEdge) && re(t, { source: "api" });
|
|
2519
2558
|
else {
|
|
2520
|
-
let e =
|
|
2521
|
-
e ? s.selectedNode && s.selectedNode.id === n ||
|
|
2559
|
+
let e = P(n);
|
|
2560
|
+
e ? s.selectedNode && s.selectedNode.id === n || B(t, e, { source: "api" }) : I = n;
|
|
2522
2561
|
}
|
|
2523
2562
|
}
|
|
2524
2563
|
}
|
|
2525
2564
|
}
|
|
2526
|
-
function
|
|
2565
|
+
function ce() {
|
|
2527
2566
|
m || (m = !0, l.destroy(), x.destroy(), i && t.destroy());
|
|
2528
2567
|
}
|
|
2529
|
-
let
|
|
2568
|
+
let le = {};
|
|
2530
2569
|
for (let e of [
|
|
2531
2570
|
"topology",
|
|
2532
2571
|
"view",
|
|
2533
2572
|
"node"
|
|
2534
|
-
]) n[e] !== void 0 && (
|
|
2535
|
-
return
|
|
2573
|
+
]) n[e] !== void 0 && (le[e] = n[e]);
|
|
2574
|
+
return se(le), H(), D(), {
|
|
2536
2575
|
inst: t,
|
|
2537
2576
|
map: x,
|
|
2538
|
-
update:
|
|
2539
|
-
destroy:
|
|
2540
|
-
fit:
|
|
2541
|
-
focusNode:
|
|
2577
|
+
update: se,
|
|
2578
|
+
destroy: ce,
|
|
2579
|
+
fit: M,
|
|
2580
|
+
focusNode: te,
|
|
2542
2581
|
refresh: D,
|
|
2543
2582
|
applyTheme: (e) => S.applyTheme(e)
|
|
2544
2583
|
};
|
|
2545
2584
|
}
|
|
2546
2585
|
// \0stencil-css:/home/runner/work/CornField/CornField/explorer/pieces/map-stage?tag=corn-map&encapsulation=shadow&__ext=css
|
|
2547
|
-
var
|
|
2586
|
+
var Sn = () => "[data-corn=map-stage]{background:var(--corn-ground-image), var(--corn-ground);width:100%;height:100%;min-height:16rem;display:block;position:relative;overflow:hidden}[data-corn=map-canvas]{cursor:grab;touch-action:none;width:100%;height:100%;display:block;position:absolute;inset:0}[data-corn=map-canvas]:active{cursor:grabbing}[data-corn=map-canvas]:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:calc(var(--corn-focus-width) * -1)}[data-corn=label-canvas]{pointer-events:none;width:100%;height:100%;position:absolute;inset:0}[data-corn=map-overlay]{pointer-events:none;width:100%;height:100%;position:absolute;top:0;left:0}.hx-sr-only{clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;width:1px;height:1px;margin:0;padding:0;overflow:hidden;position:absolute!important}", Cn = () => "[data-corn=source-status]{z-index:2;box-sizing:border-box;align-items:center;gap:var(--corn-space-3);width:min(26rem, calc(100% - var(--corn-space-6) * 2));padding:var(--corn-space-6);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius-lg);background:var(--corn-surface-1);color:var(--corn-text-2);box-shadow:var(--corn-shadow);text-align:center;font-family:var(--corn-font);font-size:var(--corn-text-md);flex-direction:column;line-height:1.5;display:flex;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}[data-corn=source-status][hidden]{display:none}[data-corn=source-status]:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}[data-corn=source-status][data-corn-state=running]{box-shadow:none;color:var(--corn-text-3);background:0 0;border-color:#0000;padding:0}[data-corn=source-status][data-corn-state=running] [data-corn=source-title]{font-size:var(--corn-text-md);color:var(--corn-text-3);font-weight:400}[data-corn=source-status][data-corn-state=failure] [data-corn=source-title]{color:var(--corn-bad)}[data-corn=source-status][data-corn-state=waiting] [data-corn=source-title]{color:var(--corn-accent-text)}[data-corn=source-title],[data-corn=source-text]{margin:0}[data-corn=source-title]{font-size:var(--corn-text-lg);color:var(--corn-text);font-weight:600}[data-corn=source-text]{overflow-wrap:anywhere;user-select:text}[data-corn=source-origin]{font-family:var(--corn-mono);color:var(--corn-warn);overflow-wrap:anywhere;user-select:all}[data-corn=source-sign-in],[data-corn=source-retry]{box-sizing:border-box;min-height:max(var(--corn-control-height), 2.75rem);padding:0 var(--corn-space-6);border:var(--corn-border) solid var(--corn-line);border-radius:var(--corn-radius);background:var(--corn-surface-2);color:var(--corn-text);font-family:inherit;font-size:inherit;cursor:pointer;justify-content:center;align-items:center;text-decoration:none;display:inline-flex}[data-corn=source-sign-in]{border-color:var(--corn-accent);background:var(--corn-accent);color:var(--corn-text-on-accent);font-weight:600}[data-corn=source-sign-in]:hover{background:var(--corn-accent-hover)}[data-corn=source-retry]:hover{background:var(--corn-surface-3)}[data-corn=source-sign-in]:focus-visible,[data-corn=source-retry]:focus-visible{outline:var(--corn-focus-width) solid var(--corn-focus);outline-offset:var(--corn-focus-offset)}[data-corn=source-notice]{z-index:2;box-sizing:border-box;padding:var(--corn-space-3) var(--corn-space-6);background:var(--corn-surface-1);border-top:var(--corn-border) solid var(--corn-line-soft);color:var(--corn-text-2);font-family:var(--corn-font);font-size:var(--corn-text-sm);text-align:center;overflow-wrap:anywhere;margin:0;position:absolute;bottom:0;left:0;right:0}[data-corn=source-notice][hidden]{display:none}", wn = () => ":host{contain:layout;min-width:0;color:var(--corn-text);font-family:var(--corn-font);display:block;position:relative}:host([hidden]){display:none!important}", Tn = class extends n {
|
|
2548
2587
|
constructor(t) {
|
|
2549
2588
|
super(), t !== !1 && this.__registerHost(), this.__attachShadow(), this.cornSelect = e(this, "cornSelect", 7), this.cornReady = e(this, "cornReady", 7), this.cornAuth = e(this, "cornAuth", 7), this.cornError = e(this, "cornError", 7);
|
|
2550
2589
|
}
|
|
@@ -2582,16 +2621,16 @@ var hn = () => "[data-corn=map-stage]{background:var(--corn-ground-image), var(-
|
|
|
2582
2621
|
this.unmountPiece(), this.loaded && this.el.isConnected && this.mountPiece();
|
|
2583
2622
|
}
|
|
2584
2623
|
mountPiece() {
|
|
2585
|
-
!this.piece && this.el.shadowRoot && (this.changes = {}, this.scope = k(this.el, () => this.remount()), this.piece =
|
|
2624
|
+
!this.piece && this.el.shadowRoot && (this.changes = {}, this.scope = k(this.el, () => this.remount()), this.piece = yn(this.el.shadowRoot, this.scope.inst, {
|
|
2586
2625
|
topology: this.topology,
|
|
2587
2626
|
view: this.view,
|
|
2588
2627
|
node: this.node,
|
|
2589
2628
|
theme: this.theme,
|
|
2590
2629
|
renderer: this.renderer,
|
|
2591
|
-
tokens:
|
|
2630
|
+
tokens: oe,
|
|
2592
2631
|
src: this.src,
|
|
2593
2632
|
useTheme: this.useTheme,
|
|
2594
|
-
version: "0.
|
|
2633
|
+
version: "0.50.1",
|
|
2595
2634
|
pageUrl: () => typeof location > "u" ? "" : location.href,
|
|
2596
2635
|
onAuth: (e) => this.cornAuth.emit(e),
|
|
2597
2636
|
onError: (e) => this.cornError.emit(e),
|
|
@@ -2632,10 +2671,10 @@ var hn = () => "[data-corn=map-stage]{background:var(--corn-ground-image), var(-
|
|
|
2632
2671
|
};
|
|
2633
2672
|
}
|
|
2634
2673
|
static get style() {
|
|
2635
|
-
return
|
|
2674
|
+
return Sn() + Cn() + wn();
|
|
2636
2675
|
}
|
|
2637
2676
|
};
|
|
2638
|
-
t(
|
|
2677
|
+
t(Tn, [
|
|
2639
2678
|
513,
|
|
2640
2679
|
"corn-map",
|
|
2641
2680
|
{
|
|
@@ -2661,4 +2700,4 @@ t(vn, [
|
|
|
2661
2700
|
useTheme: [{ addressChanged: 0 }]
|
|
2662
2701
|
}
|
|
2663
2702
|
]);
|
|
2664
|
-
export {
|
|
2703
|
+
export { Tn as t };
|