@popcorn245/cornfield-components 0.50.1 → 0.51.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/dist/chunks/corn-map-up67JPxU.js +122 -0
- package/dist/chunks/corn-review-Dw-G3_0h.js +4417 -0
- package/dist/chunks/{_corn-default-tokens-DfrjTpZt.js → engine-ClfnAsgM.js} +990 -1046
- package/dist/chunks/{corn-map-Bd7PO6yD.js → map-B6AeKeiu.js} +772 -887
- package/dist/chunks/review-source-CPiFTfyc.js +60 -0
- package/dist/chunks/scope-Dg_uzefP.js +136 -0
- package/dist/chunks/source-address-B7hYRgt8.js +251 -0
- package/dist/chunks/status-CYQD5PwL.js +614 -0
- package/dist/corn-map.js +1 -1
- package/dist/corn-review.js +1 -0
- package/dist/corn-scope.js +3 -3
- package/dist/index.js +5 -4
- package/dist/manifest.json +57 -22
- package/dist/tokens.css +2 -0
- package/dist/types/components.d.ts +135 -0
- package/dist/types/corn-review.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/version.json +1 -1
- package/package.json +5 -1
- package/dist/chunks/scope-HD2C0JDl.js +0 -847
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
import { A as e, B as t, c as n, f as r, k as i } from "./engine-ClfnAsgM.js";
|
|
2
|
+
import { g as a, o, r as s, t as c } from "./source-address-B7hYRgt8.js";
|
|
3
|
+
// ../explorer/engine/source.js
|
|
4
|
+
var l = "/cornfield/config.json", u = "/topology.json", d = "/cornfield/theme.css";
|
|
5
|
+
Object.freeze([
|
|
6
|
+
"loading",
|
|
7
|
+
"ready",
|
|
8
|
+
"sign-in",
|
|
9
|
+
"not-allowed",
|
|
10
|
+
"offline",
|
|
11
|
+
"server",
|
|
12
|
+
"address",
|
|
13
|
+
"version"
|
|
14
|
+
]);
|
|
15
|
+
function f(e) {
|
|
16
|
+
switch (e.state) {
|
|
17
|
+
case "not-allowed": return {
|
|
18
|
+
kind: "not-listed",
|
|
19
|
+
message: e.origin
|
|
20
|
+
};
|
|
21
|
+
case "offline": return { kind: "offline" };
|
|
22
|
+
case "server": return {
|
|
23
|
+
kind: "server",
|
|
24
|
+
message: e.message
|
|
25
|
+
};
|
|
26
|
+
case "address": return {
|
|
27
|
+
kind: "address",
|
|
28
|
+
message: e.problem
|
|
29
|
+
};
|
|
30
|
+
case "version": return {
|
|
31
|
+
kind: "version",
|
|
32
|
+
message: `${e.package} / ${e.server}`
|
|
33
|
+
};
|
|
34
|
+
default: return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
var p = (e) => {
|
|
38
|
+
let t = /^\s*v?(\d{1,9})\.(\d{1,9})\.(\d{1,9})(?:[-+][0-9A-Za-z.-]{1,64})?\s*$/.exec(String(e ?? ""));
|
|
39
|
+
return t ? [
|
|
40
|
+
Number(t[1]),
|
|
41
|
+
Number(t[2]),
|
|
42
|
+
Number(t[3])
|
|
43
|
+
] : null;
|
|
44
|
+
};
|
|
45
|
+
function m(e, t) {
|
|
46
|
+
let n = p(e), r = p(t);
|
|
47
|
+
return !n || !r ? "unknown" : n[0] === r[0] ? n[1] === r[1] ? n[2] === r[2] ? "same" : "patch" : "minor" : "major";
|
|
48
|
+
}
|
|
49
|
+
var h = class extends Error {
|
|
50
|
+
constructor(e, t, { status: n = 0, cause: r } = {}) {
|
|
51
|
+
super(t), this.name = "SourceError", this.kind = e, this.status = n, r !== void 0 && (this.cause = r);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
function g(e, t, n, r) {
|
|
55
|
+
let i = { ...o(e, t, n) };
|
|
56
|
+
return r && (i.signal = r), Object.keys(i).length ? i : void 0;
|
|
57
|
+
}
|
|
58
|
+
async function _(e, t, n, r, i = t) {
|
|
59
|
+
let a;
|
|
60
|
+
try {
|
|
61
|
+
let i = g(e, t, n, r);
|
|
62
|
+
a = i ? await e.fetch(t, i) : await e.fetch(t);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
throw new h("network", e && e.message ? e.message : String(e), { cause: e });
|
|
65
|
+
}
|
|
66
|
+
if (a.status === 401 || a.status === 403) throw new h("auth", `GET ${i} answered ${a.status} ${a.statusText}`.trim(), { status: a.status });
|
|
67
|
+
if (!a.ok) throw new h("server", `GET ${i} answered ${a.status} ${a.statusText}`.trim(), { status: a.status });
|
|
68
|
+
return a;
|
|
69
|
+
}
|
|
70
|
+
async function v(e, { signal: t } = {}) {
|
|
71
|
+
let n = await _(e, l, { cache: "no-store" }, t), r;
|
|
72
|
+
try {
|
|
73
|
+
r = await n.json();
|
|
74
|
+
} catch (e) {
|
|
75
|
+
throw new h("server", `${l} is not JSON`, {
|
|
76
|
+
status: n.status,
|
|
77
|
+
cause: e
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (!r || typeof r != "object" || Array.isArray(r)) throw new h("server", `${l} is not a config`, { status: n.status });
|
|
81
|
+
return r;
|
|
82
|
+
}
|
|
83
|
+
async function y(e, t = u, { signal: n } = {}) {
|
|
84
|
+
let r = await _(e, t + (t.includes("?") ? "&v=" : "?v=") + Date.now(), void 0, n, t), i;
|
|
85
|
+
try {
|
|
86
|
+
i = await r.json();
|
|
87
|
+
} catch (e) {
|
|
88
|
+
throw new h("server", `${t} is not JSON`, {
|
|
89
|
+
status: r.status,
|
|
90
|
+
cause: e
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (!i || !Array.isArray(i.nodes) || i.nodes.length === 0) throw new h("server", `${t} has no nodes`, { status: r.status });
|
|
94
|
+
return i;
|
|
95
|
+
}
|
|
96
|
+
function b(e, n) {
|
|
97
|
+
n && typeof n == "object" && (i(e, n.strings), t(e).applyTheme(n.theme), a(e, n.layers));
|
|
98
|
+
}
|
|
99
|
+
function x(e, { version: t = "", pageUrl: n = () => "", onConfig: r = () => {} } = {}) {
|
|
100
|
+
let a = !1, o = null, l = null, f = 0, p = {
|
|
101
|
+
topology: null,
|
|
102
|
+
config: null,
|
|
103
|
+
strings: null
|
|
104
|
+
}, g = {
|
|
105
|
+
topology: null,
|
|
106
|
+
config: null,
|
|
107
|
+
state: () => o,
|
|
108
|
+
notice: null,
|
|
109
|
+
say(t) {
|
|
110
|
+
a || (t.state === "version" ? g.notice = t : o = t, e.emit("source", t));
|
|
111
|
+
},
|
|
112
|
+
provide({ topology: e, config: t, strings: n } = {}) {
|
|
113
|
+
a || (n !== void 0 && (p.strings = n, _(g.config)), t !== void 0 && (p.config = t, t ? x(t) : g.fetchedConfig && x(g.fetchedConfig)), e !== void 0 && (p.topology = e, g.topology = e || g.fetchedTopology || null, g.topology && g.say({ state: "ready" })));
|
|
114
|
+
},
|
|
115
|
+
fetchedConfig: null,
|
|
116
|
+
fetchedTopology: null,
|
|
117
|
+
async load() {
|
|
118
|
+
if (a || !e.base) return;
|
|
119
|
+
if (p.config && p.topology) {
|
|
120
|
+
g.topology = p.topology, g.say({ state: "ready" });
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
l && l.abort(), l = new AbortController();
|
|
124
|
+
let { signal: t } = l, n = ++f, r = () => !a && n === f && !t.aborted;
|
|
125
|
+
g.say({ state: "loading" });
|
|
126
|
+
try {
|
|
127
|
+
if (!p.config) {
|
|
128
|
+
let n = await v(e, { signal: t });
|
|
129
|
+
if (!r()) return;
|
|
130
|
+
g.fetchedConfig = n, x(n);
|
|
131
|
+
}
|
|
132
|
+
if (p.topology) g.topology = p.topology;
|
|
133
|
+
else {
|
|
134
|
+
let n = await y(e, u, { signal: t });
|
|
135
|
+
if (!r()) return;
|
|
136
|
+
g.fetchedTopology = n, g.topology = n;
|
|
137
|
+
}
|
|
138
|
+
g.say({ state: "ready" });
|
|
139
|
+
} catch (e) {
|
|
140
|
+
if (!r()) return;
|
|
141
|
+
let n = await C(e, t);
|
|
142
|
+
r() && g.say(n);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
function _(t) {
|
|
147
|
+
i(e, p.strings || t && t.strings);
|
|
148
|
+
}
|
|
149
|
+
function x(n) {
|
|
150
|
+
g.config = n, b(e, n), p.strings && _(n);
|
|
151
|
+
let i = m(t, n.version);
|
|
152
|
+
t && (i === "minor" || i === "major") && g.say({
|
|
153
|
+
state: "version",
|
|
154
|
+
server: String(n.version).trim(),
|
|
155
|
+
package: t,
|
|
156
|
+
drift: i
|
|
157
|
+
}), r(n);
|
|
158
|
+
}
|
|
159
|
+
async function C(t, r) {
|
|
160
|
+
if (!(t instanceof h)) return {
|
|
161
|
+
state: "server",
|
|
162
|
+
status: 0,
|
|
163
|
+
message: t && t.message ? t.message : String(t)
|
|
164
|
+
};
|
|
165
|
+
if (t.kind === "auth") return {
|
|
166
|
+
state: "sign-in",
|
|
167
|
+
status: t.status,
|
|
168
|
+
signIn: s(e.base, n())
|
|
169
|
+
};
|
|
170
|
+
if (t.kind === "server") return {
|
|
171
|
+
state: "server",
|
|
172
|
+
status: t.status,
|
|
173
|
+
message: t.message
|
|
174
|
+
};
|
|
175
|
+
if (e.win && e.win.navigator && e.win.navigator.onLine === !1) return { state: "offline" };
|
|
176
|
+
try {
|
|
177
|
+
await e.fetch(d, {
|
|
178
|
+
method: "HEAD",
|
|
179
|
+
mode: "no-cors",
|
|
180
|
+
credentials: "omit",
|
|
181
|
+
signal: r
|
|
182
|
+
});
|
|
183
|
+
} catch {
|
|
184
|
+
return { state: "offline" };
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
state: "not-allowed",
|
|
188
|
+
origin: c(n())
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
return S(e).source = g, e.own(() => {
|
|
192
|
+
a = !0, l && l.abort(), S(e).source = null;
|
|
193
|
+
}), g;
|
|
194
|
+
}
|
|
195
|
+
var S = (e) => e.slot("source", () => ({ source: null })), C = (e) => S(e).source, w = 524288, T = 4096, E = /^--corn-[a-z0-9]+(?:-[a-z0-9]+)*$/, D = /^[a-z0-9][a-z0-9-]{0,31}$/, O = "/cornfield/theme.css", k = (e) => `/cornfield/theme/${e}.css`, A = (e) => String(e).replace(/\s+/g, ""), j = (e) => {
|
|
196
|
+
let t = /^:where\((.*)\)$/.exec(e);
|
|
197
|
+
return t ? t[1] : e;
|
|
198
|
+
};
|
|
199
|
+
function M(e) {
|
|
200
|
+
let t = [], n = 0, r = 0, i = String(e);
|
|
201
|
+
for (let e = 0; e <= i.length; e++) {
|
|
202
|
+
let a = i[e];
|
|
203
|
+
a === "(" || a === "[" ? n++ : a === ")" || a === "]" ? n-- : (a === "," && !n || e === i.length) && (t.push(j(A(i.slice(r, e)))), r = e + 1);
|
|
204
|
+
}
|
|
205
|
+
return t.filter(Boolean);
|
|
206
|
+
}
|
|
207
|
+
function N(e, t, n = null) {
|
|
208
|
+
let r = e.startsWith(":root") ? ":root" : e.startsWith("html") ? "html" : null;
|
|
209
|
+
if (!r) return null;
|
|
210
|
+
let i = e.slice(r.length), a = n ? `[data-theme-name="${n}"]` : null;
|
|
211
|
+
if (a) {
|
|
212
|
+
if (i.includes(a)) i = i.replace(a, "");
|
|
213
|
+
else return null;
|
|
214
|
+
} else if (/\[data-theme-name=/.test(i)) return null;
|
|
215
|
+
return i === "" ? t || "base" : i === "[data-theme=\"light\"]" ? "light" : i === "[data-theme=\"dark\"]" ? "dark" : i === ":not([data-theme=\"dark\"])" && t === "light" ? "light" : i === ":not([data-theme=\"light\"])" && t === "dark" ? "dark" : null;
|
|
216
|
+
}
|
|
217
|
+
var P = /^data:image\/(?:png|gif|webp|avif|svg\+xml)[;,]/i, F = /(?<![\w-])(?:url|src|image|(?:-webkit-)?image-set)\(/i, I = /(?<![\w-])(url|src)\(\s*(?:"([^"]*)"|'([^']*)'|([^)\s"']*))\s*\)/gi, L = /"([^"]*)"|'([^']*)'/g;
|
|
218
|
+
function R(e) {
|
|
219
|
+
return String(e).replace(/\\([0-9a-f]{1,6})\s?|\\([^\n])/gi, (e, t, n) => {
|
|
220
|
+
if (t) {
|
|
221
|
+
let e = parseInt(t, 16);
|
|
222
|
+
return e > 0 && e <= 1114111 ? String.fromCodePoint(e) : "�";
|
|
223
|
+
}
|
|
224
|
+
return n;
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
function z(e, t) {
|
|
228
|
+
if (P.test(e)) return e;
|
|
229
|
+
try {
|
|
230
|
+
let n = new URL(t), r = e.startsWith("/") && !e.startsWith("//") ? new URL(n.pathname.replace(/\/+$/, "") + e, n) : new URL(e, `${t}/`);
|
|
231
|
+
return r.protocol !== "https:" && r.protocol !== "http:" || r.origin !== n.origin ? null : r.href;
|
|
232
|
+
} catch {
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function B(e, t) {
|
|
237
|
+
let n = String(e), r = R(n);
|
|
238
|
+
if (!F.test(r)) return n;
|
|
239
|
+
if (r !== n && F.test(r.replace(L, "\"\"")) || !t) return null;
|
|
240
|
+
let i = !0, a = n.replace(I, (e, n, r, a, o) => {
|
|
241
|
+
let s = z(r ?? a ?? o ?? "", t);
|
|
242
|
+
return s === null ? (i = !1, "") : `${n.toLowerCase()}("${s.replace(/["\\\n]/g, (e) => encodeURIComponent(e))}")`;
|
|
243
|
+
}), o = (a.replace(/(?<![\w-])(?:url|src)\("[^"]*"\)/gi, "").match(new RegExp(F.source, "gi")) || []).filter((e) => !/image-set\($/i.test(e));
|
|
244
|
+
return !i || o.length || /(?:-webkit-)?image-set\(/i.test(a) && (a = a.replace(/((?:-webkit-)?image-set\()([^]*)$/i, (e, n, r) => n + r.replace(L, (e, n, r) => {
|
|
245
|
+
let a = z(n ?? r ?? "", t);
|
|
246
|
+
return a === null ? (i = !1, "\"\"") : `"${a.replace(/["\\\n]/g, (e) => encodeURIComponent(e))}"`;
|
|
247
|
+
})), !i) ? null : a;
|
|
248
|
+
}
|
|
249
|
+
function V(e, t) {
|
|
250
|
+
let n = B(e, t);
|
|
251
|
+
return n !== null && n === e;
|
|
252
|
+
}
|
|
253
|
+
function H(e, { name: t = null, base: n = "" } = {}) {
|
|
254
|
+
let r = {
|
|
255
|
+
base: /* @__PURE__ */ new Map(),
|
|
256
|
+
light: /* @__PURE__ */ new Map(),
|
|
257
|
+
dark: /* @__PURE__ */ new Map()
|
|
258
|
+
}, i = (e, i) => {
|
|
259
|
+
let a = M(e.selectorText).map((e) => N(e, i, t)).find(Boolean);
|
|
260
|
+
if (!a) return;
|
|
261
|
+
let o = e.style;
|
|
262
|
+
for (let e = 0; e < o.length; e++) {
|
|
263
|
+
let t = o[e];
|
|
264
|
+
if (!E.test(t)) continue;
|
|
265
|
+
let i = o.getPropertyValue(t).trim();
|
|
266
|
+
!i || i.length > T || (n || F.test(R(i))) && (i = n ? B(i, n) : null, i === null) || r[a].set(t, i);
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
for (let t of Array.from(e.cssRules || [])) if (t.selectorText !== void 0) i(t, null);
|
|
270
|
+
else if (t.media && t.cssRules) {
|
|
271
|
+
let e = /^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(t.media.mediaText.trim());
|
|
272
|
+
if (e) for (let n of Array.from(t.cssRules)) n.selectorText !== void 0 && i(n, e[1]);
|
|
273
|
+
}
|
|
274
|
+
return r;
|
|
275
|
+
}
|
|
276
|
+
function U(e, t) {
|
|
277
|
+
let n = /* @__PURE__ */ new Map();
|
|
278
|
+
for (let r of e) {
|
|
279
|
+
for (let [e, t] of r.base) n.set(e, t);
|
|
280
|
+
for (let [e, i] of r[t]) n.set(e, i);
|
|
281
|
+
}
|
|
282
|
+
return n;
|
|
283
|
+
}
|
|
284
|
+
function W(e) {
|
|
285
|
+
let t = {
|
|
286
|
+
base: /* @__PURE__ */ new Map(),
|
|
287
|
+
light: /* @__PURE__ */ new Map(),
|
|
288
|
+
dark: /* @__PURE__ */ new Map()
|
|
289
|
+
};
|
|
290
|
+
for (let n of Object.keys(t)) for (let [r, i] of e[n]) /var\(/.test(i) && t[n].set(r, i);
|
|
291
|
+
return t;
|
|
292
|
+
}
|
|
293
|
+
async function G(e, t, n = "the answer") {
|
|
294
|
+
let r = () => /* @__PURE__ */ Error(`${n} is larger than ${t} characters`), i = Number(e.headers && e.headers.get ? e.headers.get("content-length") : NaN);
|
|
295
|
+
if (Number.isFinite(i) && i > t * 4) throw r();
|
|
296
|
+
if (!e.body || typeof e.body.getReader != "function") {
|
|
297
|
+
let n = await e.text();
|
|
298
|
+
if (n.length > t) throw r();
|
|
299
|
+
return n;
|
|
300
|
+
}
|
|
301
|
+
let a = e.body.getReader(), o = new TextDecoder(), s = "";
|
|
302
|
+
for (;;) {
|
|
303
|
+
let { done: e, value: n } = await a.read();
|
|
304
|
+
if (e) break;
|
|
305
|
+
if (s += o.decode(n, { stream: !0 }), s.length > t) throw a.cancel().catch(() => {}), r();
|
|
306
|
+
}
|
|
307
|
+
if (s += o.decode(), s.length > t) throw r();
|
|
308
|
+
return s;
|
|
309
|
+
}
|
|
310
|
+
function K(e, t) {
|
|
311
|
+
if (t === "light" || t === "dark") return t;
|
|
312
|
+
let n = e.doc && e.doc.documentElement, r = n ? n.getAttribute("data-theme") : null;
|
|
313
|
+
if (r === "light" || r === "dark") return r;
|
|
314
|
+
let i = e.win && e.win.matchMedia ? e.win.matchMedia("(prefers-color-scheme: light)") : null;
|
|
315
|
+
return i && i.matches ? "light" : "dark";
|
|
316
|
+
}
|
|
317
|
+
function q(e, t) {
|
|
318
|
+
let n = e.win && e.win.MutationObserver && e.doc && e.doc.documentElement ? new e.win.MutationObserver(t) : null;
|
|
319
|
+
n && (n.observe(e.doc.documentElement, {
|
|
320
|
+
attributes: !0,
|
|
321
|
+
attributeFilter: ["data-theme"]
|
|
322
|
+
}), e.own(() => n.disconnect()));
|
|
323
|
+
let r = e.win && e.win.matchMedia ? e.win.matchMedia("(prefers-color-scheme: light)") : null;
|
|
324
|
+
r && r.addEventListener && (r.addEventListener("change", t), e.own(() => r.removeEventListener("change", t)));
|
|
325
|
+
}
|
|
326
|
+
function J(e, { defaults: t = "" } = {}) {
|
|
327
|
+
let n = e.win, r = !1, i = null, a = null, o = /* @__PURE__ */ new Set(), s = null, c = [], l = [], u = null, d = "dark", f = "none", p = () => {
|
|
328
|
+
!a && n && typeof n.CSSStyleSheet == "function" && "replaceSync" in n.CSSStyleSheet.prototype && (a = new n.CSSStyleSheet());
|
|
329
|
+
}, m = () => {
|
|
330
|
+
if (u || !t) return u;
|
|
331
|
+
try {
|
|
332
|
+
let e = new n.CSSStyleSheet();
|
|
333
|
+
e.replaceSync(t), u = W(H(e));
|
|
334
|
+
} catch {
|
|
335
|
+
u = null;
|
|
336
|
+
}
|
|
337
|
+
return u;
|
|
338
|
+
}, h = () => {
|
|
339
|
+
if (!s) return;
|
|
340
|
+
for (let e of c) s.style.removeProperty(e);
|
|
341
|
+
if (c = [], !l.length) return;
|
|
342
|
+
let e = [], t = m();
|
|
343
|
+
t && e.push(t), e.push(...l);
|
|
344
|
+
let n = U(e, d);
|
|
345
|
+
for (let [e, t] of n) s.style.setProperty(e, t), c.push(e);
|
|
346
|
+
}, g = (t, n = {}) => {
|
|
347
|
+
f = t, e.emit("theme", {
|
|
348
|
+
state: t,
|
|
349
|
+
...n
|
|
350
|
+
});
|
|
351
|
+
}, _ = async (t, n) => {
|
|
352
|
+
let r = await e.fetch(t, {
|
|
353
|
+
credentials: "omit",
|
|
354
|
+
redirect: "error",
|
|
355
|
+
signal: n
|
|
356
|
+
});
|
|
357
|
+
if (!r.ok) throw Error(`GET ${t} answered ${r.status}`);
|
|
358
|
+
return G(r, w, t);
|
|
359
|
+
}, v = {
|
|
360
|
+
state: () => f,
|
|
361
|
+
sheet: () => a,
|
|
362
|
+
async load(t) {
|
|
363
|
+
if (r || !e.base) return;
|
|
364
|
+
i && i.abort(), i = new AbortController();
|
|
365
|
+
let { signal: o } = i;
|
|
366
|
+
g("loading");
|
|
367
|
+
try {
|
|
368
|
+
let i = t && t.theme && typeof t.theme.default == "string" && D.test(t.theme.default) ? t.theme.default : null, [s, c] = await Promise.all([_(O, o).catch((e) => {
|
|
369
|
+
if (o.aborted) throw e;
|
|
370
|
+
return null;
|
|
371
|
+
}), i ? _(k(i), o).catch((e) => {
|
|
372
|
+
if (o.aborted) throw e;
|
|
373
|
+
return null;
|
|
374
|
+
}) : Promise.resolve(null)]);
|
|
375
|
+
if (r || o.aborted) return;
|
|
376
|
+
if (s === null && c === null) {
|
|
377
|
+
g("failed");
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
if (p(), !a) {
|
|
381
|
+
g("failed", { reason: "constructable stylesheets are not available" });
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
a.replaceSync([s, c].filter((e) => e !== null).join("\n")), Y(a, e.base), l = [];
|
|
385
|
+
let u = (t, r) => {
|
|
386
|
+
let i = new n.CSSStyleSheet();
|
|
387
|
+
return i.replaceSync(t), H(i, {
|
|
388
|
+
name: r,
|
|
389
|
+
base: e.base
|
|
390
|
+
});
|
|
391
|
+
};
|
|
392
|
+
s !== null && l.push(u(s, null)), c !== null && l.push(u(c, i)), h(), g("ready");
|
|
393
|
+
} catch (e) {
|
|
394
|
+
if (r || o.aborted) return;
|
|
395
|
+
g("failed", { reason: e && e.message ? e.message : String(e) });
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
adopt(t) {
|
|
399
|
+
if (!t || !("adoptedStyleSheets" in t)) return () => {};
|
|
400
|
+
o.add(t);
|
|
401
|
+
let n = () => {
|
|
402
|
+
a && !t.adoptedStyleSheets.includes(a) && (t.adoptedStyleSheets = [...t.adoptedStyleSheets, a]);
|
|
403
|
+
};
|
|
404
|
+
n();
|
|
405
|
+
let r = e.on("theme", n);
|
|
406
|
+
return () => {
|
|
407
|
+
r(), o.delete(t), a && t.adoptedStyleSheets.includes(a) && (t.adoptedStyleSheets = t.adoptedStyleSheets.filter((e) => e !== a));
|
|
408
|
+
};
|
|
409
|
+
},
|
|
410
|
+
tokensOn(e) {
|
|
411
|
+
v.release(), s = e, h();
|
|
412
|
+
},
|
|
413
|
+
setMode(e) {
|
|
414
|
+
let t = e === "light" ? "light" : "dark";
|
|
415
|
+
t !== d && (d = t, h());
|
|
416
|
+
},
|
|
417
|
+
release() {
|
|
418
|
+
if (s) for (let e of c) s.style.removeProperty(e);
|
|
419
|
+
c = [], s = null;
|
|
420
|
+
},
|
|
421
|
+
unload() {
|
|
422
|
+
i && i.abort();
|
|
423
|
+
for (let e of o) a && e.adoptedStyleSheets.includes(a) && (e.adoptedStyleSheets = e.adoptedStyleSheets.filter((e) => e !== a));
|
|
424
|
+
a && a.replaceSync(""), a = null, l = [], h(), g("none");
|
|
425
|
+
},
|
|
426
|
+
destroy() {
|
|
427
|
+
r = !0, i && i.abort(), v.release();
|
|
428
|
+
for (let e of [...o]) a && e.adoptedStyleSheets.includes(a) && (e.adoptedStyleSheets = e.adoptedStyleSheets.filter((e) => e !== a));
|
|
429
|
+
o.clear(), a = null, l = [];
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
return v;
|
|
433
|
+
}
|
|
434
|
+
function Y(e, t) {
|
|
435
|
+
let n = (e) => {
|
|
436
|
+
let r = e.cssRules;
|
|
437
|
+
for (let i = r.length - 1; i >= 0; i--) {
|
|
438
|
+
let a = r[i];
|
|
439
|
+
if (a.cssRules && n(a), a.style) {
|
|
440
|
+
let e = a.style;
|
|
441
|
+
for (let n of Array.from({ length: e.length }, (t, n) => e[n])) {
|
|
442
|
+
let r = e.getPropertyValue(n);
|
|
443
|
+
if (!F.test(R(r))) continue;
|
|
444
|
+
let i = B(r, t);
|
|
445
|
+
i === null ? e.removeProperty(n) : i !== r && e.setProperty(n, i, e.getPropertyPriority(n));
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
let o = a.cssText;
|
|
449
|
+
o && F.test(R(o)) && !V(o, t) && (typeof a.keyText == "string" && typeof e.deleteRule == "function" && e.findRule ? e.deleteRule(a.keyText) : e.deleteRule(i));
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
n(e);
|
|
453
|
+
}
|
|
454
|
+
// ../explorer/engine/server-load.js
|
|
455
|
+
function X(e, t) {
|
|
456
|
+
let n = (e, ...t) => {
|
|
457
|
+
!r && typeof e == "function" && e(...t);
|
|
458
|
+
}, r = !1, i = J(e, { defaults: t.tokens || "" });
|
|
459
|
+
i.tokensOn(t.host);
|
|
460
|
+
let a = () => K(e, t.theme()), o = () => {
|
|
461
|
+
r || (i.setMode(a()), n(t.onMode));
|
|
462
|
+
}, s = x(e, {
|
|
463
|
+
version: t.version || "",
|
|
464
|
+
pageUrl: t.pageUrl,
|
|
465
|
+
onConfig: (e) => {
|
|
466
|
+
n(t.onConfig, e), !r && t.useTheme() && i.load(e);
|
|
467
|
+
}
|
|
468
|
+
}), c = [e.on("source", (e) => {
|
|
469
|
+
if (e.state === "ready") {
|
|
470
|
+
n(t.onReady);
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
if (e.state === "sign-in") {
|
|
474
|
+
n(t.onAuth, {
|
|
475
|
+
status: e.status,
|
|
476
|
+
signIn: e.signIn
|
|
477
|
+
});
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
let r = f(e);
|
|
481
|
+
r && n(t.onError, r);
|
|
482
|
+
}), e.on("theme", (e) => {
|
|
483
|
+
n(t.onSheet, e), e.state === "failed" && n(t.onError, {
|
|
484
|
+
kind: "theme",
|
|
485
|
+
message: e.reason
|
|
486
|
+
});
|
|
487
|
+
})];
|
|
488
|
+
return q(e, o), i.setMode(a()), {
|
|
489
|
+
source: s,
|
|
490
|
+
theme: i,
|
|
491
|
+
follow: o,
|
|
492
|
+
setUseTheme(e) {
|
|
493
|
+
r || (e ? s.config && i.load(s.config) : i.unload());
|
|
494
|
+
},
|
|
495
|
+
destroy() {
|
|
496
|
+
r || (r = !0, c.forEach((e) => e()), i.destroy());
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
// ../explorer/pieces/status.js
|
|
501
|
+
var Z = Object.freeze({
|
|
502
|
+
loading: "running",
|
|
503
|
+
"sign-in": "waiting",
|
|
504
|
+
"not-allowed": "failure",
|
|
505
|
+
offline: "stopped",
|
|
506
|
+
server: "failure",
|
|
507
|
+
address: "failure",
|
|
508
|
+
"second-map": "failure"
|
|
509
|
+
});
|
|
510
|
+
function Q(t, n) {
|
|
511
|
+
switch (n.state) {
|
|
512
|
+
case "loading": return {
|
|
513
|
+
title: e(t, "sourceLoading"),
|
|
514
|
+
text: ""
|
|
515
|
+
};
|
|
516
|
+
case "sign-in": return n.status === 403 ? {
|
|
517
|
+
title: e(t, "sourceNotMaintainer"),
|
|
518
|
+
text: e(t, "sourceNotMaintainerText"),
|
|
519
|
+
link: n.signIn
|
|
520
|
+
} : {
|
|
521
|
+
title: e(t, "sourceSignedOut"),
|
|
522
|
+
text: e(t, "sourceSignInText"),
|
|
523
|
+
link: n.signIn
|
|
524
|
+
};
|
|
525
|
+
case "not-allowed": return {
|
|
526
|
+
title: e(t, "sourceNotListed"),
|
|
527
|
+
text: e(t, "sourceNotListedHint"),
|
|
528
|
+
origin: n.origin,
|
|
529
|
+
retry: !0
|
|
530
|
+
};
|
|
531
|
+
case "offline": return {
|
|
532
|
+
title: e(t, "sourceOffline"),
|
|
533
|
+
text: e(t, "sourceOfflineText"),
|
|
534
|
+
retry: !0
|
|
535
|
+
};
|
|
536
|
+
case "server": return {
|
|
537
|
+
title: e(t, "errorTitle"),
|
|
538
|
+
text: n.message || "",
|
|
539
|
+
retry: !0
|
|
540
|
+
};
|
|
541
|
+
case "address": return {
|
|
542
|
+
title: e(t, "sourceBadAddress"),
|
|
543
|
+
text: n.problem || ""
|
|
544
|
+
};
|
|
545
|
+
case "second-map": return {
|
|
546
|
+
title: e(t, "sourceSecondMap"),
|
|
547
|
+
text: ""
|
|
548
|
+
};
|
|
549
|
+
default: return null;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
var $ = (e) => typeof e == "string" && /^https?:\/\/[^\s\\]+$/i.test(e) ? e : "";
|
|
553
|
+
function ee(t, r) {
|
|
554
|
+
let i = Q(t, r);
|
|
555
|
+
if (!i) return "";
|
|
556
|
+
let a = i.link ? $(i.link) : "", o = [`<p data-corn="source-title">${n(i.title)}</p>`];
|
|
557
|
+
return i.text && o.push(`<p data-corn="source-text">${n(i.text)}</p>`), i.origin && o.push(`<p data-corn="source-text"><code data-corn="source-origin">${n(i.origin)}</code></p>`), a && o.push(`<a data-corn="source-sign-in" data-corn-kind="primary" href="${n(a)}" target="_top" rel="noopener">${n(e(t, "sourceSignIn"))}</a>`), i.retry && o.push(`<button type="button" data-corn="source-retry" data-corn-kind="secondary">${n(e(t, "retry"))}</button>`), o.join("");
|
|
558
|
+
}
|
|
559
|
+
function te(e, t) {
|
|
560
|
+
let n = Q(e, t);
|
|
561
|
+
return n ? [
|
|
562
|
+
n.title,
|
|
563
|
+
n.text,
|
|
564
|
+
n.origin
|
|
565
|
+
].filter(Boolean).join(". ") : "";
|
|
566
|
+
}
|
|
567
|
+
function ne(t, n, { onRetry: i = () => {}, focusMap: a = () => {}, follow: o = !0 } = {}) {
|
|
568
|
+
let s = n.doc, c = () => {
|
|
569
|
+
let e = t.getRootNode();
|
|
570
|
+
return e && e.activeElement || null;
|
|
571
|
+
}, l = (e) => {
|
|
572
|
+
let t = s.createElement("template");
|
|
573
|
+
return t.innerHTML = r(e), t.content.firstElementChild;
|
|
574
|
+
}, u = l("<div data-corn=\"source-status\" hidden></div>"), d = l("<p data-corn=\"source-notice\" hidden></p>"), f = l("<p data-corn=\"source-announcer\" class=\"hx-sr-only\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"></p>");
|
|
575
|
+
t.append(u, d, f);
|
|
576
|
+
let p = null, m = !1, h = (e) => {
|
|
577
|
+
if (m || !e) return;
|
|
578
|
+
let t = Q(n, e), i = u.contains(c());
|
|
579
|
+
if (!t) {
|
|
580
|
+
u.hidden = !0, u.textContent = "", p = e.state, i && a();
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
u.innerHTML = r(ee(n, e)), u.setAttribute("data-corn-state", Z[e.state]), u.hidden = !1;
|
|
584
|
+
let o = p !== e.state || e.state === "server";
|
|
585
|
+
p = e.state, o && (f.textContent = te(n, e)), i && (u.setAttribute("tabindex", "-1"), u.focus());
|
|
586
|
+
}, g = (t) => {
|
|
587
|
+
m || (t ? (d.textContent = `${e(n, "sourceVersion")} (${t.package} / ${t.server})`, d.hidden = !1, f.textContent = `${f.textContent ? `${f.textContent}. ` : ""}${d.textContent}`) : (d.hidden = !0, d.textContent = ""));
|
|
588
|
+
}, _ = n.listen(u, "click", (e) => {
|
|
589
|
+
let t = e.target && e.target.closest ? e.target.closest("[data-corn=\"source-retry\"]") : null;
|
|
590
|
+
t && u.contains(t) && (e.preventDefault(), i());
|
|
591
|
+
}), v = o ? n.on("source", (e) => {
|
|
592
|
+
e.state === "version" ? g(e) : h(e);
|
|
593
|
+
}) : () => {}, y = o ? C(n) : null;
|
|
594
|
+
if (y) {
|
|
595
|
+
let e = y.state();
|
|
596
|
+
e && e.state !== "ready" && h(e), y.notice && g(y.notice);
|
|
597
|
+
}
|
|
598
|
+
return {
|
|
599
|
+
refuse(e = "second-map") {
|
|
600
|
+
h({ state: e });
|
|
601
|
+
},
|
|
602
|
+
show(e) {
|
|
603
|
+
h(e);
|
|
604
|
+
},
|
|
605
|
+
clear() {
|
|
606
|
+
let e = y ? y.state() : null;
|
|
607
|
+
h(e && e.state !== "ready" ? e : { state: "ready" });
|
|
608
|
+
},
|
|
609
|
+
destroy() {
|
|
610
|
+
m || (m = !0, v(), _(), u.remove(), d.remove(), f.remove());
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
export { X as n, ne as t };
|
package/dist/corn-map.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as CornMap } from "./chunks/corn-map-
|
|
1
|
+
export { t as CornMap } from "./chunks/corn-map-up67JPxU.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as CornReview } from "./chunks/corn-review-Dw-G3_0h.js";
|
package/dist/corn-scope.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as e, r as t, t as n } from "./chunks/runtime-DFu6W5g-.js";
|
|
2
|
-
import { t as r } from "./chunks/scope-
|
|
3
|
-
import { t as i } from "./chunks/
|
|
2
|
+
import { t as r } from "./chunks/scope-Dg_uzefP.js";
|
|
3
|
+
import { t as i } from "./chunks/engine-ClfnAsgM.js";
|
|
4
4
|
// src/components/corn-scope/corn-scope.tsx
|
|
5
5
|
var a = class extends n {
|
|
6
6
|
constructor(t) {
|
|
@@ -38,7 +38,7 @@ var a = class extends n {
|
|
|
38
38
|
config: this.config,
|
|
39
39
|
strings: this.strings,
|
|
40
40
|
tokens: i,
|
|
41
|
-
version: "0.
|
|
41
|
+
version: "0.51.1",
|
|
42
42
|
pageUrl: () => typeof location > "u" ? "" : location.href,
|
|
43
43
|
onReady: () => this.cornReady.emit(),
|
|
44
44
|
onAuth: (e) => this.cornAuth.emit(e),
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { t as e } from "./chunks/corn-map-
|
|
2
|
-
import {
|
|
1
|
+
import { t as e } from "./chunks/corn-map-up67JPxU.js";
|
|
2
|
+
import { t } from "./chunks/corn-review-Dw-G3_0h.js";
|
|
3
|
+
import { CornScope as n } from "./corn-scope.js";
|
|
3
4
|
// src/index.ts
|
|
4
|
-
var
|
|
5
|
-
export { e as CornMap, t as
|
|
5
|
+
var r = "0.51.1";
|
|
6
|
+
export { e as CornMap, t as CornReview, n as CornScope, r as version };
|