solely 0.1.4 → 0.1.5
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 -0
- package/dist/index.js +501 -501
- package/dist/index.umd.cjs +3 -3
- package/dist/runtime/reactivity/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/runtime/reactivity/types.d.ts +0 -51
- package/dist/types/component.d.ts +0 -66
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ const te = {
|
|
|
17
17
|
exprCode: "#5ddcff"
|
|
18
18
|
}
|
|
19
19
|
}, W = te.dark;
|
|
20
|
-
function
|
|
20
|
+
function it(n) {
|
|
21
21
|
let t = 0;
|
|
22
22
|
for (let e = 0; e < n.length; ) {
|
|
23
23
|
const s = n.codePointAt(e);
|
|
@@ -35,12 +35,12 @@ function Ot(n, t = {}) {
|
|
|
35
35
|
}
|
|
36
36
|
function ee(n, t = "", e, s = "component") {
|
|
37
37
|
var L;
|
|
38
|
-
const r = (n == null ? void 0 : n.message) ?? String(n),
|
|
38
|
+
const r = (n == null ? void 0 : n.message) ?? String(n), i = `%cTemplate Error%c in <${s}> → ${r}`, o = [
|
|
39
39
|
`color:${W.badgeFg};background:${W.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,
|
|
40
40
|
`color:${W.arrow};font-weight:bold;`
|
|
41
41
|
];
|
|
42
42
|
if (!t || !(e != null && e.loc) || e.loc.length < 2) {
|
|
43
|
-
console.error(
|
|
43
|
+
console.error(i, ...o), e != null && e.expr && console.log(`Expression: ${e.expr.trim()}`);
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
const c = e.loc;
|
|
@@ -53,19 +53,19 @@ function ee(n, t = "", e, s = "component") {
|
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
const h = a - 1, d = Math.max(0, h - 3), E = Math.min(u.length - 1, h + 3), m = String(E + 1).length, p = ((L = e.expr) == null ? void 0 : L.trim()) ?? "", R = p ? p.split(`
|
|
56
|
-
`) : [], g = p ? Math.max(...R.map(
|
|
56
|
+
`) : [], g = p ? Math.max(...R.map(it)) : 0, v = R.length > 1, S = `color:${W.gutter};`, A = `color:${W.arrow};font-weight:bold;`, f = `color:${W.gutter};`, w = `color:${W.errorLineFg};background:${W.errorLineBg};padding:0 4px;`, $ = `color:${W.gutter};`, b = `color:${W.arrow};font-weight:bold;padding:0 4px;`;
|
|
57
57
|
console.groupCollapsed(
|
|
58
|
-
`${
|
|
59
|
-
...
|
|
58
|
+
`${i} %c(Line:${a}, Col:${l})`,
|
|
59
|
+
...o,
|
|
60
60
|
`color:${W.gutter};font-weight:normal;`
|
|
61
61
|
);
|
|
62
|
-
for (let
|
|
63
|
-
const I = u[
|
|
64
|
-
if (!(
|
|
62
|
+
for (let x = d; x <= E; x++) {
|
|
63
|
+
const I = u[x], M = String(x + 1).padStart(m, " ");
|
|
64
|
+
if (!(x === h)) {
|
|
65
65
|
console.log(`%c${M} │%c ${I}`, S, f);
|
|
66
66
|
continue;
|
|
67
67
|
}
|
|
68
|
-
const D = I.slice(0, Math.max(0, l - 1)), F =
|
|
68
|
+
const D = I.slice(0, Math.max(0, l - 1)), F = it(D), rt = " ".repeat(m + 3), Yt = M.padEnd(m, " ");
|
|
69
69
|
if (console.log(`%c${Yt} │%c ${I}`, A, w), v)
|
|
70
70
|
for (let j = 0; j < R.length; j++) {
|
|
71
71
|
const pt = R[j], Q = h + j;
|
|
@@ -73,20 +73,20 @@ function ee(n, t = "", e, s = "component") {
|
|
|
73
73
|
if (j === 0)
|
|
74
74
|
mt = F;
|
|
75
75
|
else if (Q < u.length) {
|
|
76
|
-
const tt = u[Q],
|
|
77
|
-
mt =
|
|
76
|
+
const tt = u[Q], ot = tt.search(/\S/), Jt = ot === -1 ? tt : tt.slice(0, ot);
|
|
77
|
+
mt = it(Jt);
|
|
78
78
|
}
|
|
79
|
-
const Zt = Math.max(1,
|
|
79
|
+
const Zt = Math.max(1, it(pt.trim())), It = Ot(Zt, { lineIndex: j, totalLines: R.length }), Mt = rt + " ".repeat(mt);
|
|
80
80
|
if (j === 0)
|
|
81
|
-
console.log(`%c${Mt}%c${It}`,
|
|
81
|
+
console.log(`%c${Mt}%c${It}`, $, b);
|
|
82
82
|
else if (Q < u.length) {
|
|
83
|
-
const tt = String(Q + 1).padEnd(m, " "),
|
|
84
|
-
console.log(`%c${tt} │%c ${
|
|
83
|
+
const tt = String(Q + 1).padEnd(m, " "), ot = u[Q];
|
|
84
|
+
console.log(`%c${tt} │%c ${ot}`, A, w), console.log(`%c${Mt}%c${It}`, $, b);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
else {
|
|
88
88
|
const j = rt + " ".repeat(F), pt = Ot(g || 1);
|
|
89
|
-
console.log(`%c${j}%c${pt}`,
|
|
89
|
+
console.log(`%c${j}%c${pt}`, $, b);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
p && console.log(
|
|
@@ -112,12 +112,12 @@ const se = ["eval", "Function", "process", "require"];
|
|
|
112
112
|
function re(n) {
|
|
113
113
|
return se.some((t) => new RegExp(`\\b${t}\\b`, "g").test(n));
|
|
114
114
|
}
|
|
115
|
-
const
|
|
115
|
+
const oe = /\{\{\{\s*[\s\S]*?\s*\}\}\}/, ie = /\{\{\s*([\s\S]*?)\s*\}\}/g;
|
|
116
116
|
function ae(n, t) {
|
|
117
117
|
if (!(n != null && n.trim())) return "";
|
|
118
|
-
if (
|
|
118
|
+
if (oe.test(n))
|
|
119
119
|
throw new Error("Illegal interpolation syntax: use {{ }} instead of {{{ }}}");
|
|
120
|
-
return t === "template" ? n.replace(
|
|
120
|
+
return t === "template" ? n.replace(ie, (e, s) => `\${${s.trim()}}`) : n;
|
|
121
121
|
}
|
|
122
122
|
function ce(n, t) {
|
|
123
123
|
const e = (s) => s.endsWith(";") ? s : s + ";";
|
|
@@ -140,18 +140,18 @@ function le(n) {
|
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
142
|
function ue(n, t, e, s) {
|
|
143
|
-
const r = n === "lifecycle" ? ["el", "loops"] : n === "handler" ? ["event", "loops"] : ["loops"],
|
|
143
|
+
const r = n === "lifecycle" ? ["el", "loops"] : n === "handler" ? ["event", "loops"] : ["loops"], o = `
|
|
144
144
|
const { $data } = this;
|
|
145
145
|
${n === "handler" ? "const { value, checked } = event?.target || {};" : ""}
|
|
146
146
|
${e}
|
|
147
147
|
${s}
|
|
148
148
|
${t}
|
|
149
149
|
`.replace(/^\s+|\s+$/gm, "");
|
|
150
|
-
return r.push(
|
|
150
|
+
return r.push(o), r;
|
|
151
151
|
}
|
|
152
152
|
function he(n, t, e) {
|
|
153
153
|
if (!(n != null && n.trim())) return () => "";
|
|
154
|
-
const s = ae(n, t), r = ce(s, t), { loopValues:
|
|
154
|
+
const s = ae(n, t), r = ce(s, t), { loopValues: i, loopIndices: o } = le(e), c = ue(t, r, i, o);
|
|
155
155
|
return ne(c);
|
|
156
156
|
}
|
|
157
157
|
const fe = /* @__PURE__ */ new Set([
|
|
@@ -217,7 +217,7 @@ const fe = /* @__PURE__ */ new Set([
|
|
|
217
217
|
"ontoggle",
|
|
218
218
|
"onvolumechange",
|
|
219
219
|
"onwaiting"
|
|
220
|
-
]),
|
|
220
|
+
]), G = (n) => {
|
|
221
221
|
if (n === null || typeof n != "object") return !1;
|
|
222
222
|
const t = Object.prototype.toString.call(n);
|
|
223
223
|
return ![
|
|
@@ -235,14 +235,14 @@ function Ye(n = window.location) {
|
|
|
235
235
|
typeof n == "string" ? t = new URL(n).hash : t = n.hash;
|
|
236
236
|
const e = t.split("?");
|
|
237
237
|
let s = e[0];
|
|
238
|
-
const r = e[1],
|
|
239
|
-
return s = s.replace(/^#\/?/, ""), r && r.split("&").forEach((
|
|
240
|
-
const [c, a] =
|
|
241
|
-
c && a && (
|
|
238
|
+
const r = e[1], i = {};
|
|
239
|
+
return s = s.replace(/^#\/?/, ""), r && r.split("&").forEach((o) => {
|
|
240
|
+
const [c, a] = o.split("=");
|
|
241
|
+
c && a && (i[decodeURIComponent(c)] = decodeURIComponent(a));
|
|
242
242
|
}), {
|
|
243
243
|
path: s.split("/").filter(Boolean),
|
|
244
244
|
// 将路径分割成数组并过滤空字符串
|
|
245
|
-
query:
|
|
245
|
+
query: i
|
|
246
246
|
// 查询参数对象
|
|
247
247
|
};
|
|
248
248
|
}
|
|
@@ -287,14 +287,14 @@ class be {
|
|
|
287
287
|
// 缓存 key 生成优化:避免每次都重新分配数组
|
|
288
288
|
makeCacheKey(t, e, s) {
|
|
289
289
|
if (s.length === 0) return `${t}:${e}`;
|
|
290
|
-
const r = s.map((
|
|
290
|
+
const r = s.map((i) => Object.keys(i).sort().join(",")).join(";");
|
|
291
291
|
return `${t}:${e}:${r}`;
|
|
292
292
|
}
|
|
293
293
|
compile(t, e, s) {
|
|
294
294
|
const r = e == null ? void 0 : e.trim();
|
|
295
295
|
if (!r) return 0;
|
|
296
|
-
const
|
|
297
|
-
if (
|
|
296
|
+
const i = this.makeCacheKey(t, r, s), o = this.cache.get(i);
|
|
297
|
+
if (o !== void 0) return o;
|
|
298
298
|
let c;
|
|
299
299
|
try {
|
|
300
300
|
c = he(r, t, s);
|
|
@@ -302,7 +302,7 @@ class be {
|
|
|
302
302
|
X && console.error(`[IR Compile Error] Type: ${t}, Expr: "${r}"`, l), c = () => "";
|
|
303
303
|
}
|
|
304
304
|
const a = this.functions.push(c);
|
|
305
|
-
return this.cache.set(
|
|
305
|
+
return this.cache.set(i, a), a;
|
|
306
306
|
}
|
|
307
307
|
getFunctions() {
|
|
308
308
|
return this.functions;
|
|
@@ -328,14 +328,14 @@ function Ee(n) {
|
|
|
328
328
|
if (!n.attrs) return;
|
|
329
329
|
const t = n.attrs.find((a) => a.key === "s-model");
|
|
330
330
|
if (!t) return;
|
|
331
|
-
const e = "$data." + t.value.replace("this.", "").replace("$data.", ""), s = t.loc, r = (n.tag || "").toLowerCase(),
|
|
331
|
+
const e = "$data." + t.value.replace("this.", "").replace("$data.", ""), s = t.loc, r = (n.tag || "").toLowerCase(), i = n.attrs.find((a) => a.key === "type"), o = (i == null ? void 0 : i.value) ?? "text";
|
|
332
332
|
n.attrs = n.attrs.filter((a) => a !== t);
|
|
333
333
|
const c = (a, l, u) => {
|
|
334
334
|
var h;
|
|
335
335
|
(h = n.attrs) == null || h.push({ key: a, value: l, role: u, loc: s });
|
|
336
336
|
};
|
|
337
337
|
if (r === "input") {
|
|
338
|
-
if (
|
|
338
|
+
if (o === "checkbox") {
|
|
339
339
|
const a = n.attrs.find((d) => d.key === "value"), l = a ? JSON.stringify(a.value) : '"on"', u = `Array.isArray(${e}) ? ${e}.includes(${l}) : ${e}`;
|
|
340
340
|
c(":checked", u);
|
|
341
341
|
const h = `
|
|
@@ -350,7 +350,7 @@ function Ee(n) {
|
|
|
350
350
|
c("@change", h, "model");
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
353
|
-
if (
|
|
353
|
+
if (o === "radio") {
|
|
354
354
|
const a = n.attrs.find((u) => u.key === "value"), l = (a == null ? void 0 : a.value) ?? "null";
|
|
355
355
|
c(":checked", `${e} == ${JSON.stringify(l)}`), c("@change", `if (checked) ${e} = ${JSON.stringify(l)}`, "model");
|
|
356
356
|
return;
|
|
@@ -375,22 +375,22 @@ function Ee(n) {
|
|
|
375
375
|
function lt(n, t, e, s = null) {
|
|
376
376
|
if (!n.attrs || n.attrs.length === 0) return [];
|
|
377
377
|
const r = [];
|
|
378
|
-
for (const
|
|
379
|
-
if (s && s.has(
|
|
380
|
-
const { key:
|
|
378
|
+
for (const i of n.attrs) {
|
|
379
|
+
if (s && s.has(i.key)) continue;
|
|
380
|
+
const { key: o, value: c, role: a } = i, { isDynamic: l, type: u } = Ft(o);
|
|
381
381
|
if (l && u) {
|
|
382
|
-
const h = e.compile(u, c ?? "", t), d = { key:
|
|
383
|
-
xt(d, c,
|
|
382
|
+
const h = e.compile(u, c ?? "", t), d = { key: o, fid: h, dynamic: 1, role: a };
|
|
383
|
+
xt(d, c, i.loc ?? n.loc), r.push(d);
|
|
384
384
|
} else
|
|
385
|
-
r.push({ key:
|
|
385
|
+
r.push({ key: o, value: c, dynamic: 0, role: a });
|
|
386
386
|
}
|
|
387
387
|
return r;
|
|
388
388
|
}
|
|
389
389
|
function ve(n, t, e) {
|
|
390
|
-
var
|
|
390
|
+
var i, o, c, a, l, u;
|
|
391
391
|
const s = { type: n.type, dynamic: 0 };
|
|
392
392
|
let r = !1;
|
|
393
|
-
switch (n.type === y.Text ? we(n.content) && (r = !0) : ((
|
|
393
|
+
switch (n.type === y.Text ? we(n.content) && (r = !0) : ((i = n.attrs) != null && i.some((h) => h.key === "s-model" || Ft(h.key).isDynamic) && (r = !0), n.type === y.For && (r = !0)), s.dynamic = r ? 1 : 0, n.type) {
|
|
394
394
|
case y.Text: {
|
|
395
395
|
const h = n.content ?? "";
|
|
396
396
|
r ? (s.fid = e.compile("template", h, t), xt(s, h, n.loc)) : s.txt = h;
|
|
@@ -401,7 +401,7 @@ function ve(n, t, e) {
|
|
|
401
401
|
break;
|
|
402
402
|
}
|
|
403
403
|
case y.For: {
|
|
404
|
-
const h = (
|
|
404
|
+
const h = (o = n.attrs) == null ? void 0 : o.find((p) => p.key === "each"), d = (h == null ? void 0 : h.value) ?? "";
|
|
405
405
|
s.fid = e.compile("expression", d, t), s.item = ((a = (c = n.attrs) == null ? void 0 : c.find((p) => p.key === "item")) == null ? void 0 : a.value) ?? "item", s.index = ((u = (l = n.attrs) == null ? void 0 : l.find((p) => p.key === "index")) == null ? void 0 : u.value) ?? "index", xt(s, d, (h == null ? void 0 : h.loc) ?? n.loc);
|
|
406
406
|
const E = /* @__PURE__ */ new Set(["each", "item", "index"]);
|
|
407
407
|
s.attrs = lt(n, t, e, E);
|
|
@@ -423,12 +423,12 @@ function ve(n, t, e) {
|
|
|
423
423
|
return s;
|
|
424
424
|
}
|
|
425
425
|
function et(n, t, e) {
|
|
426
|
-
var
|
|
426
|
+
var i;
|
|
427
427
|
const s = [];
|
|
428
428
|
let r = 0;
|
|
429
429
|
for (; r < n.length; ) {
|
|
430
|
-
const
|
|
431
|
-
if (
|
|
430
|
+
const o = n[r];
|
|
431
|
+
if (o.type === y.If) {
|
|
432
432
|
const c = [];
|
|
433
433
|
let a = r;
|
|
434
434
|
for (; a < n.length; ) {
|
|
@@ -437,7 +437,7 @@ function et(n, t, e) {
|
|
|
437
437
|
break;
|
|
438
438
|
let h = null, d = "", E = null;
|
|
439
439
|
if (u !== y.Else) {
|
|
440
|
-
const g = (
|
|
440
|
+
const g = (i = l.attrs) == null ? void 0 : i.find(
|
|
441
441
|
(v) => v.key === "test" || v.key === "condition"
|
|
442
442
|
);
|
|
443
443
|
d = (g == null ? void 0 : g.value) ?? "false", h = e.compile("expression", d, t), E = (g == null ? void 0 : g.loc) ?? l.loc;
|
|
@@ -454,28 +454,28 @@ function et(n, t, e) {
|
|
|
454
454
|
type: y.Conditional,
|
|
455
455
|
dynamic: 1,
|
|
456
456
|
branches: c,
|
|
457
|
-
...X && { [vt]: { loc:
|
|
457
|
+
...X && { [vt]: { loc: o.loc } }
|
|
458
458
|
}), r = a;
|
|
459
459
|
} else
|
|
460
|
-
s.push(ve(
|
|
460
|
+
s.push(ve(o, t, e)), r++;
|
|
461
461
|
}
|
|
462
462
|
return s;
|
|
463
463
|
}
|
|
464
464
|
function xe(n, t = {}) {
|
|
465
465
|
const { filename: e = "anonymous", source: s } = t, r = Wt.get(e);
|
|
466
466
|
r.clear();
|
|
467
|
-
const
|
|
467
|
+
const i = performance.now(), o = et(n, [], r), c = performance.now(), a = r.getStats(), l = o.filter((h) => h.dynamic === 1).length, u = {
|
|
468
468
|
type: "root",
|
|
469
469
|
version: "1.1.0",
|
|
470
470
|
// Bump version
|
|
471
471
|
functions: r.getFunctions(),
|
|
472
472
|
// 获取函数列表快照
|
|
473
|
-
nodes:
|
|
473
|
+
nodes: o,
|
|
474
474
|
stats: {
|
|
475
475
|
totalFunctions: a.total,
|
|
476
476
|
cachedFunctions: a.cached,
|
|
477
477
|
dynamicNodes: l,
|
|
478
|
-
totalNodes:
|
|
478
|
+
totalNodes: o.length
|
|
479
479
|
},
|
|
480
480
|
metadata: {
|
|
481
481
|
compiledAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -485,7 +485,7 @@ function xe(n, t = {}) {
|
|
|
485
485
|
}
|
|
486
486
|
};
|
|
487
487
|
return X && console.log(
|
|
488
|
-
`[IRBuilder] ${e} | ${(c -
|
|
488
|
+
`[IRBuilder] ${e} | ${(c - i).toFixed(2)}ms | Nodes: ${o.length} | Fns: ${a.total}`
|
|
489
489
|
), u;
|
|
490
490
|
}
|
|
491
491
|
function Ze(n) {
|
|
@@ -510,17 +510,17 @@ const $e = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, Se = /* @__PURE__ */ new Set
|
|
|
510
510
|
function Ce(n, t) {
|
|
511
511
|
const e = [];
|
|
512
512
|
let s;
|
|
513
|
-
const r = n.replace(/^\s*[^\s"'/>]+/, ""),
|
|
513
|
+
const r = n.replace(/^\s*[^\s"'/>]+/, ""), i = n.length - r.length;
|
|
514
514
|
for (; (s = ke.exec(r)) !== null; ) {
|
|
515
|
-
const
|
|
516
|
-
if (!
|
|
515
|
+
const o = s[1];
|
|
516
|
+
if (!o) continue;
|
|
517
517
|
const c = s[2] ?? s[3] ?? s[4] ?? "";
|
|
518
|
-
let a =
|
|
519
|
-
fe.has(
|
|
518
|
+
let a = o;
|
|
519
|
+
fe.has(o) && (a = a.replace(/^on/, "@")), a !== "s-model" && (a = a.replace(/^on-/, "@").replace(/^s-/, ":")), a = pe(a) || a;
|
|
520
520
|
const l = s[0], u = l.indexOf("=");
|
|
521
521
|
let h;
|
|
522
522
|
if (u === -1)
|
|
523
|
-
h = l.indexOf(
|
|
523
|
+
h = l.indexOf(o) + o.length;
|
|
524
524
|
else {
|
|
525
525
|
let g = u + 1;
|
|
526
526
|
for (; g < l.length && /\s/.test(l[g]); ) g++;
|
|
@@ -535,7 +535,7 @@ function Ce(n, t) {
|
|
|
535
535
|
h = v;
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
let d = s.index + h +
|
|
538
|
+
let d = s.index + h + i;
|
|
539
539
|
const m = n.slice(0, d).split(`
|
|
540
540
|
`), p = t[0] + m.length - 1, R = m.length > 1 ? m[m.length - 1].length + 1 : t[1] + d;
|
|
541
541
|
e.push({ key: a, value: c, loc: [p, R] });
|
|
@@ -543,8 +543,8 @@ function Ce(n, t) {
|
|
|
543
543
|
return e;
|
|
544
544
|
}
|
|
545
545
|
function Re(n, t) {
|
|
546
|
-
var
|
|
547
|
-
const e = ((
|
|
546
|
+
var o;
|
|
547
|
+
const e = ((o = (n.match($e) || [])[1]) == null ? void 0 : o.toLowerCase()) ?? "", s = Ce(n, t);
|
|
548
548
|
return {
|
|
549
549
|
type: {
|
|
550
550
|
for: y.For,
|
|
@@ -561,29 +561,29 @@ function Re(n, t) {
|
|
|
561
561
|
function Ae(n, t) {
|
|
562
562
|
const e = n.length;
|
|
563
563
|
if (n.startsWith("!--", t)) {
|
|
564
|
-
const
|
|
565
|
-
return
|
|
564
|
+
const o = n.indexOf("-->", t + 3);
|
|
565
|
+
return o === -1 ? -1 : o + 2;
|
|
566
566
|
}
|
|
567
567
|
if (n.startsWith("![CDATA[", t)) {
|
|
568
|
-
const
|
|
569
|
-
return
|
|
568
|
+
const o = n.indexOf("]]>", t + 8);
|
|
569
|
+
return o === -1 ? -1 : o + 2;
|
|
570
570
|
}
|
|
571
571
|
if (n[t] === "!")
|
|
572
572
|
return n.indexOf(">", t + 1);
|
|
573
573
|
if (n[t] === "?") {
|
|
574
|
-
const
|
|
575
|
-
return
|
|
574
|
+
const o = n.indexOf("?>", t + 1);
|
|
575
|
+
return o === -1 ? -1 : o + 1;
|
|
576
576
|
}
|
|
577
|
-
let s = !1, r = !1,
|
|
578
|
-
for (;
|
|
579
|
-
const
|
|
580
|
-
if (
|
|
577
|
+
let s = !1, r = !1, i = t;
|
|
578
|
+
for (; i < e; ) {
|
|
579
|
+
const o = n[i];
|
|
580
|
+
if (o === "'" && !r)
|
|
581
581
|
s = !s;
|
|
582
|
-
else if (
|
|
582
|
+
else if (o === '"' && !s)
|
|
583
583
|
r = !r;
|
|
584
|
-
else if (
|
|
585
|
-
return
|
|
586
|
-
|
|
584
|
+
else if (o === ">" && !s && !r)
|
|
585
|
+
return i;
|
|
586
|
+
i++;
|
|
587
587
|
}
|
|
588
588
|
return -1;
|
|
589
589
|
}
|
|
@@ -594,9 +594,9 @@ function Le(n) {
|
|
|
594
594
|
var l;
|
|
595
595
|
return e.length === 0 ? t : (l = e[e.length - 1]).children || (l.children = []);
|
|
596
596
|
};
|
|
597
|
-
let
|
|
598
|
-
const
|
|
599
|
-
for (let l = 0; l <
|
|
597
|
+
let i = 0;
|
|
598
|
+
const o = n.length, c = [0];
|
|
599
|
+
for (let l = 0; l < o; l++) n[l] === `
|
|
600
600
|
` && c.push(l + 1);
|
|
601
601
|
function a(l) {
|
|
602
602
|
let u = 0;
|
|
@@ -604,36 +604,36 @@ function Le(n) {
|
|
|
604
604
|
u = h;
|
|
605
605
|
return [u + 1, l - c[u] + 1];
|
|
606
606
|
}
|
|
607
|
-
for (;
|
|
608
|
-
const l = n.indexOf("<",
|
|
609
|
-
if (l === -1 || l >
|
|
610
|
-
const S = n.substring(
|
|
607
|
+
for (; i < o; ) {
|
|
608
|
+
const l = n.indexOf("<", i);
|
|
609
|
+
if (l === -1 || l > i) {
|
|
610
|
+
const S = n.substring(i, l === -1 ? void 0 : l), A = S.trim();
|
|
611
611
|
if (A) {
|
|
612
|
-
const f = S.indexOf(A), w =
|
|
612
|
+
const f = S.indexOf(A), w = i + f, $ = a(w);
|
|
613
613
|
r().push({
|
|
614
614
|
type: y.Text,
|
|
615
615
|
tag: "text",
|
|
616
616
|
content: A,
|
|
617
|
-
loc:
|
|
617
|
+
loc: $,
|
|
618
618
|
children: []
|
|
619
619
|
});
|
|
620
620
|
}
|
|
621
621
|
if (l === -1) break;
|
|
622
|
-
|
|
622
|
+
i = l;
|
|
623
623
|
}
|
|
624
|
-
const u = Ae(n,
|
|
624
|
+
const u = Ae(n, i + 1);
|
|
625
625
|
if (u === -1) {
|
|
626
|
-
const S = n.substring(
|
|
626
|
+
const S = n.substring(i);
|
|
627
627
|
S.trim() && r().push({
|
|
628
628
|
type: y.Text,
|
|
629
629
|
tag: "text",
|
|
630
630
|
content: S.trim(),
|
|
631
631
|
children: [],
|
|
632
|
-
loc: a(
|
|
632
|
+
loc: a(i)
|
|
633
633
|
});
|
|
634
634
|
break;
|
|
635
635
|
}
|
|
636
|
-
const h = n.substring(
|
|
636
|
+
const h = n.substring(i, u + 1), d = r(), E = a(i);
|
|
637
637
|
if (h.startsWith("<!--")) {
|
|
638
638
|
d.push({
|
|
639
639
|
type: y.Comment,
|
|
@@ -641,7 +641,7 @@ function Le(n) {
|
|
|
641
641
|
content: h.slice(4, -3),
|
|
642
642
|
loc: E,
|
|
643
643
|
children: []
|
|
644
|
-
}),
|
|
644
|
+
}), i = u + 1;
|
|
645
645
|
continue;
|
|
646
646
|
}
|
|
647
647
|
if (h.startsWith("<![CDATA[")) {
|
|
@@ -651,7 +651,7 @@ function Le(n) {
|
|
|
651
651
|
content: h.slice(9, -3),
|
|
652
652
|
loc: E,
|
|
653
653
|
children: []
|
|
654
|
-
}),
|
|
654
|
+
}), i = u + 1;
|
|
655
655
|
continue;
|
|
656
656
|
}
|
|
657
657
|
if (h.startsWith("<!") && !h.startsWith("<!--")) {
|
|
@@ -661,7 +661,7 @@ function Le(n) {
|
|
|
661
661
|
content: h.slice(2, -1),
|
|
662
662
|
loc: E,
|
|
663
663
|
children: []
|
|
664
|
-
}),
|
|
664
|
+
}), i = u + 1;
|
|
665
665
|
continue;
|
|
666
666
|
}
|
|
667
667
|
if (h.startsWith("<?")) {
|
|
@@ -671,7 +671,7 @@ function Le(n) {
|
|
|
671
671
|
content: h.slice(2, -2),
|
|
672
672
|
loc: E,
|
|
673
673
|
children: []
|
|
674
|
-
}),
|
|
674
|
+
}), i = u + 1;
|
|
675
675
|
continue;
|
|
676
676
|
}
|
|
677
677
|
if (h.startsWith("</")) {
|
|
@@ -683,7 +683,7 @@ function Le(n) {
|
|
|
683
683
|
}
|
|
684
684
|
e.pop();
|
|
685
685
|
}
|
|
686
|
-
|
|
686
|
+
i = u + 1;
|
|
687
687
|
continue;
|
|
688
688
|
}
|
|
689
689
|
const m = Re(h, E);
|
|
@@ -699,7 +699,7 @@ function Le(n) {
|
|
|
699
699
|
content: f,
|
|
700
700
|
loc: a(u + 1),
|
|
701
701
|
children: []
|
|
702
|
-
}),
|
|
702
|
+
}), i = A + S.length;
|
|
703
703
|
continue;
|
|
704
704
|
} else {
|
|
705
705
|
const f = n.substring(u + 1);
|
|
@@ -709,11 +709,11 @@ function Le(n) {
|
|
|
709
709
|
content: f,
|
|
710
710
|
loc: a(u + 1),
|
|
711
711
|
children: []
|
|
712
|
-
}),
|
|
712
|
+
}), i = o;
|
|
713
713
|
continue;
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
|
-
!v && m.type !== y.Text && m.type !== y.Comment && (e.push(m), s.push(p)),
|
|
716
|
+
!v && m.type !== y.Text && m.type !== y.Comment && (e.push(m), s.push(p)), i = u + 1;
|
|
717
717
|
}
|
|
718
718
|
return t;
|
|
719
719
|
}
|
|
@@ -746,40 +746,40 @@ const $t = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
|
|
|
746
746
|
return !0;
|
|
747
747
|
};
|
|
748
748
|
function Me(n, t, e = {}) {
|
|
749
|
-
const { throttle: s = 0, onBatch: r, immediate:
|
|
749
|
+
const { throttle: s = 0, onBatch: r, immediate: i = !1, deepCompare: o = !1 } = e;
|
|
750
750
|
let c = !0, a = null, l = [], u = 0;
|
|
751
751
|
const h = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), m = Array.isArray(e.filter) ? e.filter : e.filter ? [e.filter] : [], p = (f) => {
|
|
752
752
|
if (m.length === 0) return !0;
|
|
753
753
|
const w = f.map(String).join(".");
|
|
754
|
-
return m.some((
|
|
755
|
-
if (
|
|
756
|
-
const b =
|
|
754
|
+
return m.some(($) => {
|
|
755
|
+
if ($ === "") return !0;
|
|
756
|
+
const b = $.replace(/\./g, "\\.").replace(/\*\*/g, "(.+)").replace(/\*/g, "[^.]+").replace(/\[\d+\]/g, "\\[\\d+\\]");
|
|
757
757
|
return new RegExp(`^${b}$`).test(w);
|
|
758
758
|
});
|
|
759
759
|
}, R = (f) => {
|
|
760
760
|
const w = [];
|
|
761
|
-
let
|
|
762
|
-
for (;
|
|
763
|
-
const b = d.get(
|
|
761
|
+
let $ = f;
|
|
762
|
+
for (; $; ) {
|
|
763
|
+
const b = d.get($);
|
|
764
764
|
if (!b || b.key == null) break;
|
|
765
|
-
w.unshift(b.key),
|
|
765
|
+
w.unshift(b.key), $ = b.parent;
|
|
766
766
|
}
|
|
767
767
|
return w;
|
|
768
768
|
}, g = (f, w) => {
|
|
769
769
|
if (!c) return;
|
|
770
|
-
const
|
|
771
|
-
if (!p(
|
|
772
|
-
const b = { ...w, path:
|
|
770
|
+
const $ = R(f);
|
|
771
|
+
if (!p($)) return;
|
|
772
|
+
const b = { ...w, path: $ };
|
|
773
773
|
s > 0 ? (l.push(b), a || (a = setTimeout(() => {
|
|
774
774
|
const L = [...l];
|
|
775
775
|
l = [], a = null, c && (r == null || r(L), L.forEach(t));
|
|
776
776
|
}, s))) : (r == null || r([b]), t(b));
|
|
777
777
|
}, v = (f, w) => {
|
|
778
|
-
const
|
|
778
|
+
const $ = {};
|
|
779
779
|
return ["push", "pop", "shift", "unshift", "splice"].forEach((b) => {
|
|
780
|
-
|
|
780
|
+
$[b] = function(...L) {
|
|
781
781
|
u++;
|
|
782
|
-
const
|
|
782
|
+
const x = f[b].apply(f, L);
|
|
783
783
|
if (u--, b === "push")
|
|
784
784
|
g(w, { type: "array-push", index: f.length - L.length, values: L });
|
|
785
785
|
else if (b === "unshift")
|
|
@@ -792,56 +792,56 @@ function Me(n, t, e = {}) {
|
|
|
792
792
|
const [I, M, ..._] = L;
|
|
793
793
|
g(w, { type: "array-splice", index: I, deleteCount: M, insert: _ });
|
|
794
794
|
}
|
|
795
|
-
return
|
|
795
|
+
return x;
|
|
796
796
|
};
|
|
797
797
|
}), ["sort", "reverse", "fill", "copyWithin"].forEach((b) => {
|
|
798
|
-
|
|
798
|
+
$[b] = function(...L) {
|
|
799
799
|
u++;
|
|
800
|
-
const
|
|
801
|
-
return u--, g(w, { type: "array-reset", method: b }),
|
|
800
|
+
const x = f[b].apply(f, L);
|
|
801
|
+
return u--, g(w, { type: "array-reset", method: b }), x;
|
|
802
802
|
};
|
|
803
803
|
}), ["indexOf", "lastIndexOf", "includes"].forEach((b) => {
|
|
804
|
-
|
|
805
|
-
let I = f[b].apply(f, [L,
|
|
806
|
-
return (I === -1 || I === !1) && Ie(L) && (I = f[b].apply(f, [Vt(L),
|
|
804
|
+
$[b] = function(L, ...x) {
|
|
805
|
+
let I = f[b].apply(f, [L, ...x]);
|
|
806
|
+
return (I === -1 || I === !1) && Ie(L) && (I = f[b].apply(f, [Vt(L), ...x])), I;
|
|
807
807
|
};
|
|
808
|
-
}),
|
|
809
|
-
}, S = (f, w,
|
|
808
|
+
}), $;
|
|
809
|
+
}, S = (f, w, $) => {
|
|
810
810
|
if (!Object.isExtensible(f) || f[ht])
|
|
811
811
|
return f;
|
|
812
812
|
const b = h.get(f);
|
|
813
813
|
if (b)
|
|
814
|
-
return d.set(b, { parent: w, key:
|
|
814
|
+
return d.set(b, { parent: w, key: $ }), b;
|
|
815
815
|
const L = {
|
|
816
816
|
get(I, M, _) {
|
|
817
817
|
if (M === ht) return I;
|
|
818
818
|
if (Array.isArray(I)) {
|
|
819
|
-
const F = E.get(
|
|
819
|
+
const F = E.get(x);
|
|
820
820
|
if (F && Object.prototype.hasOwnProperty.call(F, M))
|
|
821
821
|
return Reflect.get(F, M, _);
|
|
822
822
|
}
|
|
823
823
|
const D = Reflect.get(I, M, _);
|
|
824
|
-
return typeof M == "symbol" ? D :
|
|
824
|
+
return typeof M == "symbol" ? D : G(D) ? S(D, x, M) : D;
|
|
825
825
|
},
|
|
826
826
|
set(I, M, _, D) {
|
|
827
827
|
const F = I[M];
|
|
828
|
-
if (
|
|
828
|
+
if (o ? $t(F, _) : F === _) return !0;
|
|
829
829
|
const rt = Reflect.set(I, M, _, D);
|
|
830
|
-
return u === 0 && (Array.isArray(F) && Array.isArray(_) ? g(
|
|
830
|
+
return u === 0 && (Array.isArray(F) && Array.isArray(_) ? g(x, { type: "array-replace", oldValue: F, newValue: _ }) : g(x, { type: "set", key: M, newValue: _, oldValue: F })), rt;
|
|
831
831
|
},
|
|
832
832
|
deleteProperty(I, M) {
|
|
833
833
|
if (!Reflect.has(I, M)) return !1;
|
|
834
834
|
const _ = I[M], D = Reflect.deleteProperty(I, M);
|
|
835
|
-
return D && u === 0 && g(
|
|
835
|
+
return D && u === 0 && g(x, { type: "delete", key: M, oldValue: _ }), D;
|
|
836
836
|
}
|
|
837
|
-
},
|
|
838
|
-
return h.set(f,
|
|
837
|
+
}, x = new Proxy(f, L);
|
|
838
|
+
return h.set(f, x), d.set(x, { parent: w, key: $ }), Array.isArray(f) && E.set(x, v(f, x)), x;
|
|
839
839
|
}, A = S(n, null, null);
|
|
840
|
-
if (
|
|
841
|
-
const f = (w,
|
|
842
|
-
!
|
|
843
|
-
const
|
|
844
|
-
|
|
840
|
+
if (i) {
|
|
841
|
+
const f = (w, $, b = /* @__PURE__ */ new WeakSet()) => {
|
|
842
|
+
!G(w) || b.has(w) || (b.add(w), Reflect.ownKeys(w).forEach((L) => {
|
|
843
|
+
const x = w[L];
|
|
844
|
+
G(x) && b.has(x) || (g($, { type: "set", key: L, newValue: x, oldValue: void 0 }), G(x) && f(x, S(x, $, L), b));
|
|
845
845
|
}));
|
|
846
846
|
};
|
|
847
847
|
f(n, A);
|
|
@@ -856,321 +856,107 @@ function Me(n, t, e = {}) {
|
|
|
856
856
|
}
|
|
857
857
|
};
|
|
858
858
|
}
|
|
859
|
-
const
|
|
860
|
-
var B, U, H, nt, Y, G, Z, J, q, st, C, Dt, St, jt, Bt, kt, ut, Gt, qt, Ct, Lt;
|
|
861
|
-
class ft extends HTMLElement {
|
|
862
|
-
/* -------------------- 构造 -------------------- */
|
|
863
|
-
constructor(e = {}) {
|
|
864
|
-
var o;
|
|
865
|
-
super();
|
|
866
|
-
T(this, C);
|
|
867
|
-
T(this, B);
|
|
868
|
-
T(this, U);
|
|
869
|
-
T(this, H);
|
|
870
|
-
T(this, nt);
|
|
871
|
-
T(this, Y);
|
|
872
|
-
T(this, G);
|
|
873
|
-
T(this, Z, !1);
|
|
874
|
-
T(this, J, !1);
|
|
875
|
-
T(this, q, !1);
|
|
876
|
-
T(this, st, !1);
|
|
877
|
-
const s = this.constructor;
|
|
878
|
-
O(this, B, s[Nt] || { tagName: "base-element" });
|
|
879
|
-
const r = P(this, B);
|
|
880
|
-
O(this, Y, (o = r.shadowDOM) != null && o.use ? this.attachShadow({ mode: r.shadowDOM.mode || "open" }) : this), N(this, C, St).call(this, e), N(this, C, Bt).call(this, r), queueMicrotask(() => N(this, C, Ct).call(this));
|
|
881
|
-
}
|
|
882
|
-
// 需要在元素定义前设置的属性列表(Upgrade Property)
|
|
883
|
-
/* -------------------- observedAttributes -------------------- */
|
|
884
|
-
static get observedAttributes() {
|
|
885
|
-
const e = this[Nt];
|
|
886
|
-
return e != null && e.propMap ? Array.from(e.propMap.keys()) : [];
|
|
887
|
-
}
|
|
888
|
-
/* -------------------- $data -------------------- */
|
|
889
|
-
get $data() {
|
|
890
|
-
return P(this, nt);
|
|
891
|
-
}
|
|
892
|
-
set $data(e) {
|
|
893
|
-
var s;
|
|
894
|
-
K(e) || (e = {}), (s = P(this, G)) == null || s.call(this), N(this, C, St).call(this, e), N(this, C, ut).call(this);
|
|
895
|
-
}
|
|
896
|
-
refresh() {
|
|
897
|
-
N(this, C, ut).call(this);
|
|
898
|
-
}
|
|
899
|
-
/* -------------------- 生命周期 -------------------- */
|
|
900
|
-
connectedCallback() {
|
|
901
|
-
var o;
|
|
902
|
-
const e = this.constructor;
|
|
903
|
-
Array.isArray(e.upgradeProps) && N(this, C, Dt).call(this, e.upgradeProps), N(this, C, Ct).call(this);
|
|
904
|
-
const s = P(this, B);
|
|
905
|
-
if ((s.className || s.tagName || "").split(" ").forEach((i) => i && this.classList.add(i)), N(this, C, qt).call(this), s.propMap && K(this.$data))
|
|
906
|
-
for (const [i, c] of s.propMap) {
|
|
907
|
-
const a = c.name;
|
|
908
|
-
if (this.hasAttribute(i)) {
|
|
909
|
-
const l = this.getAttribute(i), u = N(this, C, kt).call(this, l, c.default, c.type);
|
|
910
|
-
this.$data[a] = u;
|
|
911
|
-
} else "default" in c && (this.$data[a] = c.default);
|
|
912
|
-
}
|
|
913
|
-
P(this, H) && O(this, U, Be(
|
|
914
|
-
P(this, H),
|
|
915
|
-
P(this, Y),
|
|
916
|
-
this
|
|
917
|
-
)), this.mounted(), (o = this.onInit) == null || o.call(this);
|
|
918
|
-
}
|
|
919
|
-
disconnectedCallback() {
|
|
920
|
-
var e;
|
|
921
|
-
this.unmounted(), (e = P(this, G)) == null || e.call(this), O(this, G, void 0);
|
|
922
|
-
}
|
|
923
|
-
attributeChangedCallback(e, s, r) {
|
|
924
|
-
var u;
|
|
925
|
-
if (s === r || !K(this.$data)) return;
|
|
926
|
-
const i = (u = P(this, B).propMap) == null ? void 0 : u.get(e);
|
|
927
|
-
if (!i) return;
|
|
928
|
-
const c = i.name, a = this.$data[c], l = N(this, C, kt).call(this, r, i.default ?? a, i.type);
|
|
929
|
-
this.$data[c] = l, O(this, q, !0), this.attributeChanged(e, a, l);
|
|
930
|
-
}
|
|
931
|
-
/* -------------------- 事件派发 -------------------- */
|
|
932
|
-
emit(e, s, r) {
|
|
933
|
-
this.dispatchEvent(
|
|
934
|
-
new CustomEvent(e, {
|
|
935
|
-
bubbles: !0,
|
|
936
|
-
composed: !0,
|
|
937
|
-
detail: s,
|
|
938
|
-
...r
|
|
939
|
-
})
|
|
940
|
-
);
|
|
941
|
-
}
|
|
942
|
-
/* -------------------- 钩子 -------------------- */
|
|
943
|
-
onInit() {
|
|
944
|
-
}
|
|
945
|
-
created() {
|
|
946
|
-
}
|
|
947
|
-
mounted() {
|
|
948
|
-
}
|
|
949
|
-
beforeUpdate() {
|
|
950
|
-
}
|
|
951
|
-
updated() {
|
|
952
|
-
}
|
|
953
|
-
unmounted() {
|
|
954
|
-
}
|
|
955
|
-
attributeChanged(e, s, r) {
|
|
956
|
-
}
|
|
957
|
-
beforeAttributesUpdate() {
|
|
958
|
-
}
|
|
959
|
-
afterAttributesUpdate() {
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
B = new WeakMap(), U = new WeakMap(), H = new WeakMap(), nt = new WeakMap(), Y = new WeakMap(), G = new WeakMap(), Z = new WeakMap(), J = new WeakMap(), q = new WeakMap(), st = new WeakMap(), C = new WeakSet(), // 升级属性(Upgrade Property), 保障在元素被定义前设置的属性能正确触发响应式更新
|
|
963
|
-
Dt = function(e) {
|
|
964
|
-
for (const s of e)
|
|
965
|
-
if (this.hasOwnProperty(s)) {
|
|
966
|
-
const r = this[s];
|
|
967
|
-
delete this[s], this[s] = r;
|
|
968
|
-
}
|
|
969
|
-
}, /* -------------------- 初始化 -------------------- */
|
|
970
|
-
St = function(e) {
|
|
971
|
-
const { proxy: s, unobserve: r } = Me(e, (o) => {
|
|
972
|
-
var i, c;
|
|
973
|
-
if (o.type === "set") {
|
|
974
|
-
const { key: a, newValue: l } = o, u = P(this, B), h = String(a), d = ((i = u.propMap) == null ? void 0 : i.get(
|
|
975
|
-
h.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()
|
|
976
|
-
)) || Array.from(((c = u.propMap) == null ? void 0 : c.values()) || []).find((E) => E.name === h);
|
|
977
|
-
d != null && d.reflect && N(this, C, jt).call(this, d, l);
|
|
978
|
-
}
|
|
979
|
-
this.emit("change", {
|
|
980
|
-
source: "state",
|
|
981
|
-
...o
|
|
982
|
-
}), N(this, C, ut).call(this);
|
|
983
|
-
});
|
|
984
|
-
O(this, nt, s), O(this, G, r);
|
|
985
|
-
}, jt = function(e, s) {
|
|
986
|
-
const r = e.name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
987
|
-
if (e.type === "boolean")
|
|
988
|
-
s ? this.setAttribute(r, "") : this.removeAttribute(r);
|
|
989
|
-
else {
|
|
990
|
-
const o = typeof s == "object" ? JSON.stringify(s) : String(s);
|
|
991
|
-
this.setAttribute(r, o);
|
|
992
|
-
}
|
|
993
|
-
}, Bt = function(e) {
|
|
994
|
-
e.ir && O(this, H, e.ir);
|
|
995
|
-
}, kt = function(e, s, r) {
|
|
996
|
-
if (e === null)
|
|
997
|
-
return r === "boolean" ? s ?? !1 : s;
|
|
998
|
-
switch (r) {
|
|
999
|
-
case "boolean":
|
|
1000
|
-
return !0;
|
|
1001
|
-
case "number": {
|
|
1002
|
-
const o = Number(e);
|
|
1003
|
-
return isNaN(o) ? s : o;
|
|
1004
|
-
}
|
|
1005
|
-
case "object":
|
|
1006
|
-
try {
|
|
1007
|
-
return JSON.parse(e);
|
|
1008
|
-
} catch {
|
|
1009
|
-
return s;
|
|
1010
|
-
}
|
|
1011
|
-
default:
|
|
1012
|
-
return e;
|
|
1013
|
-
}
|
|
1014
|
-
}, /* -------------------- 刷新调度 -------------------- */
|
|
1015
|
-
ut = function() {
|
|
1016
|
-
P(this, J) || !P(this, U) || (O(this, J, !0), queueMicrotask(() => {
|
|
1017
|
-
O(this, J, !1), N(this, C, Gt).call(this);
|
|
1018
|
-
}));
|
|
1019
|
-
}, Gt = function() {
|
|
1020
|
-
P(this, Z) || !this.isConnected || (O(this, Z, !0), P(this, q) && this.beforeAttributesUpdate(), this.beforeUpdate(), P(this, U).update(), this.updated(), P(this, q) && (this.afterAttributesUpdate(), O(this, q, !1)), O(this, Z, !1));
|
|
1021
|
-
}, qt = function() {
|
|
1022
|
-
const e = P(this, B);
|
|
1023
|
-
if (!e.styles) return;
|
|
1024
|
-
const s = P(this, Y);
|
|
1025
|
-
if (e.sheet && s instanceof ShadowRoot && "adoptedStyleSheets" in s) {
|
|
1026
|
-
s.adoptedStyleSheets.includes(e.sheet) || (s.adoptedStyleSheets = [...s.adoptedStyleSheets, e.sheet]);
|
|
1027
|
-
return;
|
|
1028
|
-
}
|
|
1029
|
-
const r = s instanceof ShadowRoot ? s : document.head, o = `solely-style-${e.tagName}`;
|
|
1030
|
-
if (!r.querySelector(`#${o}`)) {
|
|
1031
|
-
const i = document.createElement("style");
|
|
1032
|
-
i.id = o, i.textContent = e.styles, r.appendChild(i);
|
|
1033
|
-
}
|
|
1034
|
-
}, /* -------------------- created 保障 -------------------- */
|
|
1035
|
-
Ct = function() {
|
|
1036
|
-
P(this, st) || (O(this, st, !0), this.created());
|
|
1037
|
-
}, Lt = new WeakMap(), k(ft, "upgradeProps"), /* -------------------- DEV define 保护 -------------------- */
|
|
1038
|
-
T(ft, Lt, !1);
|
|
1039
|
-
const Pe = Symbol.for("solely.manifest"), zt = (n) => {
|
|
1040
|
-
const t = n;
|
|
1041
|
-
return (e) => {
|
|
1042
|
-
const { tagName: s } = t;
|
|
1043
|
-
if (customElements.get(s))
|
|
1044
|
-
return e;
|
|
1045
|
-
if (typeof t.template == "string" && !t.ir)
|
|
1046
|
-
try {
|
|
1047
|
-
const o = Le(t.template);
|
|
1048
|
-
t.ir = xe(o, {
|
|
1049
|
-
source: t.template,
|
|
1050
|
-
filename: s
|
|
1051
|
-
});
|
|
1052
|
-
} catch (o) {
|
|
1053
|
-
console.error(`[Compiler Error] <${s}>:`, o);
|
|
1054
|
-
}
|
|
1055
|
-
if (t.styles && !t.sheet && "CSSStyleSheet" in window)
|
|
1056
|
-
try {
|
|
1057
|
-
const o = new CSSStyleSheet();
|
|
1058
|
-
o.replaceSync(t.styles), t.sheet = o;
|
|
1059
|
-
} catch (o) {
|
|
1060
|
-
console.error(`[Style Error] <${s}>:`, o);
|
|
1061
|
-
}
|
|
1062
|
-
if (t.props && !t.propMap) {
|
|
1063
|
-
const o = /* @__PURE__ */ new Map();
|
|
1064
|
-
t.props.forEach((i) => {
|
|
1065
|
-
const c = typeof i == "string" ? { name: i } : i, a = c.name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1066
|
-
o.set(a, c);
|
|
1067
|
-
}), t.propMap = o;
|
|
1068
|
-
}
|
|
1069
|
-
class r extends e {
|
|
1070
|
-
}
|
|
1071
|
-
return r[Pe] = t, customElements.define(s, r), r;
|
|
1072
|
-
};
|
|
1073
|
-
}, at = Symbol("solely.irCtx"), ct = Symbol("solely.irEvents"), V = Symbol.for("solely.irMeta"), bt = Symbol("solely.prevClassObj"), wt = Symbol("solely.prevStyleObj"), Oe = {
|
|
859
|
+
const at = Symbol("solely.irCtx"), ct = Symbol("solely.irEvents"), V = Symbol.for("solely.irMeta"), bt = Symbol("solely.prevClassObj"), wt = Symbol("solely.prevStyleObj"), Pe = {
|
|
1074
860
|
xml: "http://www.w3.org/XML/1998/namespace",
|
|
1075
861
|
xlink: "http://www.w3.org/1999/xlink",
|
|
1076
862
|
xmlns: "http://www.w3.org/2000/xmlns/"
|
|
1077
|
-
},
|
|
863
|
+
}, Nt = {
|
|
1078
864
|
readonly: "readOnly",
|
|
1079
865
|
for: "htmlFor",
|
|
1080
866
|
tabindex: "tabIndex",
|
|
1081
867
|
contenteditable: "contentEditable",
|
|
1082
868
|
maxlength: "maxLength"
|
|
1083
|
-
},
|
|
869
|
+
}, Oe = /* @__PURE__ */ new Set(["data-", "aria-", "role", "form"]), Ne = /* @__PURE__ */ new Set([
|
|
1084
870
|
"value",
|
|
1085
871
|
"selectedIndex"
|
|
1086
872
|
]);
|
|
1087
|
-
function
|
|
873
|
+
function _e(n, t) {
|
|
1088
874
|
var s;
|
|
1089
875
|
const e = (s = t.attrs) == null ? void 0 : s.find((r) => r.key === "class" && !r.dynamic);
|
|
1090
876
|
e != null && e.value && n.setAttribute("class", e.value);
|
|
1091
877
|
}
|
|
1092
|
-
function
|
|
1093
|
-
var
|
|
878
|
+
function Te(n, t) {
|
|
879
|
+
var i;
|
|
1094
880
|
if (!n.style) return;
|
|
1095
|
-
const s = (
|
|
1096
|
-
for (const
|
|
1097
|
-
const c = r[
|
|
1098
|
-
|
|
881
|
+
const s = (i = t.attrs) == null ? void 0 : i.find((o) => o.key === "style" && !o.dynamic), r = s ? Dt(s.value) : {};
|
|
882
|
+
for (const o in r) {
|
|
883
|
+
const c = r[o];
|
|
884
|
+
o.startsWith("--") ? n.style.setProperty(o, c) : n.style[o] = c;
|
|
1099
885
|
}
|
|
1100
886
|
}
|
|
1101
|
-
const
|
|
1102
|
-
const e = n, s =
|
|
887
|
+
const We = (n, t) => {
|
|
888
|
+
const e = n, s = Dt(t), r = e[wt];
|
|
1103
889
|
if (!r) {
|
|
1104
|
-
for (const
|
|
1105
|
-
const c = s[
|
|
1106
|
-
|
|
890
|
+
for (const o in s) {
|
|
891
|
+
const c = s[o];
|
|
892
|
+
o.startsWith("--") ? n.style.setProperty(o, c) : n.style[o] = c;
|
|
1107
893
|
}
|
|
1108
894
|
e[wt] = s;
|
|
1109
895
|
return;
|
|
1110
896
|
}
|
|
1111
|
-
let
|
|
1112
|
-
for (const
|
|
1113
|
-
|
|
1114
|
-
for (const
|
|
1115
|
-
const c = s[
|
|
1116
|
-
c !== a && (
|
|
897
|
+
let i = !1;
|
|
898
|
+
for (const o in r)
|
|
899
|
+
o in s || (o.startsWith("--") ? n.style.removeProperty(o) : n.style[o] = "", i = !0);
|
|
900
|
+
for (const o in s) {
|
|
901
|
+
const c = s[o], a = r[o];
|
|
902
|
+
c !== a && (o.startsWith("--") ? n.style.setProperty(o, c) : n.style[o] = c, i = !0);
|
|
1117
903
|
}
|
|
1118
|
-
|
|
1119
|
-
},
|
|
1120
|
-
const e = n, s = e[bt], r =
|
|
904
|
+
i && (e[wt] = s);
|
|
905
|
+
}, Fe = (n, t) => {
|
|
906
|
+
const e = n, s = e[bt], r = Ve(t);
|
|
1121
907
|
if (!s) {
|
|
1122
|
-
for (const
|
|
1123
|
-
n.classList.add(
|
|
908
|
+
for (const o in r)
|
|
909
|
+
n.classList.add(o);
|
|
1124
910
|
e[bt] = r;
|
|
1125
911
|
return;
|
|
1126
912
|
}
|
|
1127
|
-
let
|
|
1128
|
-
for (const
|
|
1129
|
-
r[
|
|
1130
|
-
for (const
|
|
1131
|
-
s[
|
|
1132
|
-
|
|
913
|
+
let i = !1;
|
|
914
|
+
for (const o in s)
|
|
915
|
+
r[o] || (n.classList.remove(o), i = !0);
|
|
916
|
+
for (const o in r)
|
|
917
|
+
s[o] || (n.classList.add(o), i = !0);
|
|
918
|
+
i && (e[bt] = r);
|
|
1133
919
|
};
|
|
1134
|
-
function
|
|
920
|
+
function Dt(n) {
|
|
1135
921
|
const t = {}, e = [[n]];
|
|
1136
922
|
for (; e.length; ) {
|
|
1137
923
|
const [s, r] = e.pop();
|
|
1138
924
|
if (s) {
|
|
1139
925
|
if (typeof s == "string") {
|
|
1140
|
-
const
|
|
1141
|
-
let
|
|
1142
|
-
for (; (
|
|
1143
|
-
const c =
|
|
926
|
+
const i = /([^:;]+)\s*:\s*([^;]*\(.*?\)[^;]*|[^;]+)/g;
|
|
927
|
+
let o;
|
|
928
|
+
for (; (o = i.exec(s)) !== null; ) {
|
|
929
|
+
const c = o[1].trim(), a = o[2].trim();
|
|
1144
930
|
c && a && (t[c] = a);
|
|
1145
931
|
}
|
|
1146
932
|
continue;
|
|
1147
933
|
}
|
|
1148
934
|
if (Array.isArray(s)) {
|
|
1149
|
-
for (let
|
|
1150
|
-
e.push([s[
|
|
935
|
+
for (let i = s.length - 1; i >= 0; i--)
|
|
936
|
+
e.push([s[i]]);
|
|
1151
937
|
continue;
|
|
1152
938
|
}
|
|
1153
939
|
if (typeof s == "object")
|
|
1154
|
-
for (const
|
|
1155
|
-
const
|
|
1156
|
-
if (
|
|
1157
|
-
const c = r ? `${r}-${
|
|
1158
|
-
typeof
|
|
940
|
+
for (const i in s) {
|
|
941
|
+
const o = s[i];
|
|
942
|
+
if (o == null) continue;
|
|
943
|
+
const c = r ? `${r}-${i}` : i;
|
|
944
|
+
typeof o == "object" && !Array.isArray(o) ? e.push([o, c]) : t[c] = String(o);
|
|
1159
945
|
}
|
|
1160
946
|
}
|
|
1161
947
|
}
|
|
1162
948
|
return t;
|
|
1163
949
|
}
|
|
1164
|
-
function
|
|
950
|
+
function Ve(n) {
|
|
1165
951
|
const t = {}, e = [n];
|
|
1166
952
|
for (; e.length; ) {
|
|
1167
953
|
const s = e.pop();
|
|
1168
954
|
if (s) {
|
|
1169
955
|
if (typeof s == "string") {
|
|
1170
956
|
const r = s.split(" ");
|
|
1171
|
-
for (let
|
|
1172
|
-
const
|
|
1173
|
-
|
|
957
|
+
for (let i = 0; i < r.length; i++) {
|
|
958
|
+
const o = r[i].trim();
|
|
959
|
+
o && (t[o] = !0);
|
|
1174
960
|
}
|
|
1175
961
|
} else if (Array.isArray(s))
|
|
1176
962
|
for (let r = s.length - 1; r >= 0; r--)
|
|
@@ -1182,24 +968,24 @@ function De(n) {
|
|
|
1182
968
|
}
|
|
1183
969
|
return t;
|
|
1184
970
|
}
|
|
1185
|
-
function
|
|
971
|
+
function St(n, t, e) {
|
|
1186
972
|
const s = e == null ? "" : String(e), r = t.indexOf(":");
|
|
1187
973
|
if (r > 0) {
|
|
1188
|
-
const
|
|
1189
|
-
if (
|
|
1190
|
-
n.getAttributeNS(
|
|
974
|
+
const i = t.slice(0, r), o = Pe[i];
|
|
975
|
+
if (o) {
|
|
976
|
+
n.getAttributeNS(o, t) !== s && n.setAttributeNS(o, t, s);
|
|
1191
977
|
return;
|
|
1192
978
|
}
|
|
1193
979
|
}
|
|
1194
980
|
n.getAttribute(t) !== s && n.setAttribute(t, s);
|
|
1195
981
|
}
|
|
1196
|
-
function
|
|
1197
|
-
const s =
|
|
1198
|
-
if (t.startsWith("data-") || t.startsWith("aria-") ||
|
|
1199
|
-
|
|
982
|
+
function _t(n, t, e) {
|
|
983
|
+
const s = Nt[t] || t;
|
|
984
|
+
if (t.startsWith("data-") || t.startsWith("aria-") || Oe.has(t)) {
|
|
985
|
+
St(n, t, e);
|
|
1200
986
|
return;
|
|
1201
987
|
}
|
|
1202
|
-
const r = n,
|
|
988
|
+
const r = n, i = r.tagName;
|
|
1203
989
|
if (e == null) {
|
|
1204
990
|
if (typeof r[s] == "boolean")
|
|
1205
991
|
r[s] !== !1 && (r[s] = !1);
|
|
@@ -1214,7 +1000,7 @@ function Tt(n, t, e) {
|
|
|
1214
1000
|
if (r[s] === c || n.getAttribute(s) === c)
|
|
1215
1001
|
return;
|
|
1216
1002
|
}
|
|
1217
|
-
if (s === "value" && (
|
|
1003
|
+
if (s === "value" && (i === "INPUT" || i === "TEXTAREA") && r.value === e)
|
|
1218
1004
|
return;
|
|
1219
1005
|
if (typeof e == "boolean") {
|
|
1220
1006
|
if (r[s] === e)
|
|
@@ -1222,21 +1008,21 @@ function Tt(n, t, e) {
|
|
|
1222
1008
|
r[s] = e;
|
|
1223
1009
|
return;
|
|
1224
1010
|
}
|
|
1225
|
-
(n instanceof SVGElement || r.ownerSVGElement !== void 0) && !
|
|
1011
|
+
(n instanceof SVGElement || r.ownerSVGElement !== void 0) && !Nt[t] ? St(n, t, e) : r[s] !== e && (r[s] = e);
|
|
1226
1012
|
}
|
|
1227
|
-
class
|
|
1013
|
+
class De {
|
|
1228
1014
|
constructor(t, e, s = {}) {
|
|
1229
1015
|
k(this, "nodeMap", /* @__PURE__ */ new Map());
|
|
1230
1016
|
k(this, "marker", !1);
|
|
1231
1017
|
this.ir = t, this.container = e, this.scope = s;
|
|
1232
1018
|
}
|
|
1233
1019
|
evalIR(t, e, s) {
|
|
1234
|
-
var
|
|
1020
|
+
var i;
|
|
1235
1021
|
const r = this.ir.functions[t - 1];
|
|
1236
1022
|
try {
|
|
1237
1023
|
return r ? r.apply(this.scope, e) : "";
|
|
1238
|
-
} catch (
|
|
1239
|
-
return ee(
|
|
1024
|
+
} catch (o) {
|
|
1025
|
+
return ee(o.message || o.toString(), ((i = this.ir.metadata) == null ? void 0 : i.source) || "", s, this.scope.tagName), "";
|
|
1240
1026
|
}
|
|
1241
1027
|
}
|
|
1242
1028
|
// ================ 创建节点 ================
|
|
@@ -1254,10 +1040,10 @@ class je {
|
|
|
1254
1040
|
}
|
|
1255
1041
|
// ================ 属性全量应用(创建或更新时用) ================
|
|
1256
1042
|
applyAttrs(t, e, s, r = !1) {
|
|
1257
|
-
const
|
|
1258
|
-
|
|
1043
|
+
const i = [], o = t;
|
|
1044
|
+
o[at] || (o[at] = {
|
|
1259
1045
|
loops: null
|
|
1260
|
-
}),
|
|
1046
|
+
}), o[at].loops = s, o[ct] || (o[ct] = /* @__PURE__ */ Object.create(null));
|
|
1261
1047
|
let c, a = !1, l, u = !1;
|
|
1262
1048
|
for (const h of e) {
|
|
1263
1049
|
const { key: d, fid: E, dynamic: m, value: p } = h;
|
|
@@ -1274,8 +1060,8 @@ class je {
|
|
|
1274
1060
|
const R = d[0];
|
|
1275
1061
|
if (R === "@") {
|
|
1276
1062
|
const v = d.slice(1), S = h.role ?? "user";
|
|
1277
|
-
let A =
|
|
1278
|
-
if (A || (A =
|
|
1063
|
+
let A = o[ct][v];
|
|
1064
|
+
if (A || (A = o[ct][v] = {
|
|
1279
1065
|
model: [],
|
|
1280
1066
|
user: []
|
|
1281
1067
|
}, t.addEventListener(v, (f) => {
|
|
@@ -1286,7 +1072,7 @@ class je {
|
|
|
1286
1072
|
})), !r) {
|
|
1287
1073
|
const f = (w) => this.evalIR(
|
|
1288
1074
|
E,
|
|
1289
|
-
[w,
|
|
1075
|
+
[w, o[at].loops],
|
|
1290
1076
|
h[V]
|
|
1291
1077
|
);
|
|
1292
1078
|
A[S].push(f);
|
|
@@ -1312,10 +1098,10 @@ class je {
|
|
|
1312
1098
|
const g = m ? this.evalIR(E, [s], h[V]) : p ?? "";
|
|
1313
1099
|
if (R === ":") {
|
|
1314
1100
|
const v = d.slice(1);
|
|
1315
|
-
t.tagName === "SELECT" &&
|
|
1316
|
-
} else r ||
|
|
1101
|
+
t.tagName === "SELECT" && Ne.has(v) ? i.push(() => _t(t, v, g)) : _t(t, v, g);
|
|
1102
|
+
} else r || St(t, d, String(g));
|
|
1317
1103
|
}
|
|
1318
|
-
return a &&
|
|
1104
|
+
return a && Fe(t, c), u && We(t, l), i;
|
|
1319
1105
|
}
|
|
1320
1106
|
// ================ 更新已有节点 Text Or Comment ================
|
|
1321
1107
|
updateNode(t, e, s) {
|
|
@@ -1323,9 +1109,9 @@ class je {
|
|
|
1323
1109
|
e.dynamic && t.textContent !== r && (t.textContent = r);
|
|
1324
1110
|
}
|
|
1325
1111
|
// ================ 核心遍历 ================
|
|
1326
|
-
irToNode(t, e, s, r,
|
|
1112
|
+
irToNode(t, e, s, r, i) {
|
|
1327
1113
|
var l, u, h, d;
|
|
1328
|
-
const
|
|
1114
|
+
const o = s + "-" + e, c = this.nodeMap.get(o);
|
|
1329
1115
|
let a;
|
|
1330
1116
|
if (c) {
|
|
1331
1117
|
a = c.node, c.marker = this.marker;
|
|
@@ -1333,55 +1119,55 @@ class je {
|
|
|
1333
1119
|
t.dynamic && (t.type === y.Element ? E = this.applyAttrs(
|
|
1334
1120
|
a,
|
|
1335
1121
|
t.attrs ?? [],
|
|
1336
|
-
|
|
1122
|
+
i,
|
|
1337
1123
|
!0
|
|
1338
|
-
) : this.updateNode(a, t,
|
|
1339
|
-
this.irToNode(m, p,
|
|
1124
|
+
) : this.updateNode(a, t, i)), (l = t.children) == null || l.forEach((m, p) => {
|
|
1125
|
+
this.irToNode(m, p, o, a, i);
|
|
1340
1126
|
}), E.forEach((m) => m());
|
|
1341
1127
|
} else
|
|
1342
1128
|
switch (t.type) {
|
|
1343
1129
|
case y.Element:
|
|
1344
|
-
a = this.createElement(t, r),
|
|
1345
|
-
const E = this.applyAttrs(a, t.attrs ?? [],
|
|
1346
|
-
r.appendChild(a), this.nodeMap.set(
|
|
1347
|
-
this.irToNode(m, p,
|
|
1130
|
+
a = this.createElement(t, r), _e(a, t), Te(a, t);
|
|
1131
|
+
const E = this.applyAttrs(a, t.attrs ?? [], i);
|
|
1132
|
+
r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker }), (u = t.children) == null || u.forEach((m, p) => {
|
|
1133
|
+
this.irToNode(m, p, o, a, i);
|
|
1348
1134
|
}), E.forEach((m) => m());
|
|
1349
1135
|
break;
|
|
1350
1136
|
case y.Text:
|
|
1351
|
-
a = this.createText(t,
|
|
1137
|
+
a = this.createText(t, i), r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker });
|
|
1352
1138
|
break;
|
|
1353
1139
|
case y.Comment:
|
|
1354
|
-
a = this.createComment(t,
|
|
1140
|
+
a = this.createComment(t, i), r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker });
|
|
1355
1141
|
break;
|
|
1356
1142
|
case y.For: {
|
|
1357
|
-
const m = `${
|
|
1143
|
+
const m = `${o}-end`;
|
|
1358
1144
|
let p = (h = this.nodeMap.get(m)) == null ? void 0 : h.node;
|
|
1359
|
-
p ? this.nodeMap.get(m).marker = this.marker : (p = document.createComment(`for:${
|
|
1145
|
+
p ? this.nodeMap.get(m).marker = this.marker : (p = document.createComment(`for:${o}`), r.appendChild(p), this.nodeMap.set(m, {
|
|
1360
1146
|
irNode: { type: y.Comment },
|
|
1361
1147
|
node: p,
|
|
1362
|
-
loops:
|
|
1148
|
+
loops: i,
|
|
1363
1149
|
marker: this.marker
|
|
1364
1150
|
}));
|
|
1365
|
-
const R = this.evalIR(t.fid, [
|
|
1151
|
+
const R = this.evalIR(t.fid, [i], t[V]) || [], g = document.createDocumentFragment();
|
|
1366
1152
|
R.forEach((v, S) => {
|
|
1367
1153
|
var f;
|
|
1368
|
-
const A = [...
|
|
1369
|
-
(f = t.children) == null || f.forEach((w,
|
|
1370
|
-
this.irToNode(w,
|
|
1154
|
+
const A = [...i, { itmVal: v, idxVal: S }];
|
|
1155
|
+
(f = t.children) == null || f.forEach((w, $) => {
|
|
1156
|
+
this.irToNode(w, $, `${o}-for-${S}`, g, A);
|
|
1371
1157
|
});
|
|
1372
1158
|
}), p.parentNode.insertBefore(g, p);
|
|
1373
1159
|
break;
|
|
1374
1160
|
}
|
|
1375
1161
|
case y.Conditional: {
|
|
1376
|
-
const m = `${
|
|
1162
|
+
const m = `${o}-end`;
|
|
1377
1163
|
let p = (d = this.nodeMap.get(m)) == null ? void 0 : d.node;
|
|
1378
|
-
p ? this.nodeMap.get(m).marker = this.marker : (p = document.createComment(`if:${
|
|
1164
|
+
p ? this.nodeMap.get(m).marker = this.marker : (p = document.createComment(`if:${o}`), r.appendChild(p), this.nodeMap.set(m, { irNode: {}, node: p, loops: i, marker: this.marker }));
|
|
1379
1165
|
for (let R = 0; R < (t.branches || []).length; R++) {
|
|
1380
1166
|
const g = t.branches[R];
|
|
1381
|
-
if (g.condFid === null || this.evalIR(g.condFid, [
|
|
1167
|
+
if (g.condFid === null || this.evalIR(g.condFid, [i], g[V])) {
|
|
1382
1168
|
const S = document.createDocumentFragment();
|
|
1383
1169
|
g.children.forEach((A, f) => {
|
|
1384
|
-
this.irToNode(A, f, `${
|
|
1170
|
+
this.irToNode(A, f, `${o}-if-${R}`, S, i);
|
|
1385
1171
|
}), p.parentNode.insertBefore(S, p);
|
|
1386
1172
|
break;
|
|
1387
1173
|
}
|
|
@@ -1394,14 +1180,14 @@ class je {
|
|
|
1394
1180
|
cleanupOldNodes() {
|
|
1395
1181
|
for (const [t, e] of this.nodeMap.entries())
|
|
1396
1182
|
if (e.marker !== this.marker) {
|
|
1397
|
-
const { irNode: s, node: r, loops:
|
|
1183
|
+
const { irNode: s, node: r, loops: i } = e;
|
|
1398
1184
|
if (s.attrs) {
|
|
1399
|
-
const
|
|
1400
|
-
|
|
1185
|
+
const o = s.attrs.find((a) => a.key === "unmounted");
|
|
1186
|
+
o && requestAnimationFrame(() => {
|
|
1401
1187
|
this.evalIR(
|
|
1402
|
-
|
|
1403
|
-
[r,
|
|
1404
|
-
|
|
1188
|
+
o.fid,
|
|
1189
|
+
[r, i],
|
|
1190
|
+
o[V]
|
|
1405
1191
|
);
|
|
1406
1192
|
});
|
|
1407
1193
|
const c = s.attrs.find((a) => a.key === "ref");
|
|
@@ -1425,22 +1211,236 @@ class je {
|
|
|
1425
1211
|
this.container.innerHTML = "", this.nodeMap.clear();
|
|
1426
1212
|
}
|
|
1427
1213
|
}
|
|
1428
|
-
const
|
|
1429
|
-
const s = new
|
|
1214
|
+
const je = (n, t, e = {}) => {
|
|
1215
|
+
const s = new De(n, t, e);
|
|
1430
1216
|
return s.mount(), {
|
|
1431
1217
|
update: () => s.update(),
|
|
1432
1218
|
destroy: () => s.destroy()
|
|
1433
1219
|
};
|
|
1220
|
+
}, Tt = Symbol.for("solely.manifest");
|
|
1221
|
+
var B, U, H, nt, Y, q, Z, J, z, st, C, jt, kt, Bt, Gt, Ct, ut, qt, zt, Rt, Lt;
|
|
1222
|
+
class ft extends HTMLElement {
|
|
1223
|
+
/* -------------------- 构造 -------------------- */
|
|
1224
|
+
constructor(e = {}) {
|
|
1225
|
+
var i;
|
|
1226
|
+
super();
|
|
1227
|
+
T(this, C);
|
|
1228
|
+
T(this, B);
|
|
1229
|
+
T(this, U);
|
|
1230
|
+
T(this, H);
|
|
1231
|
+
T(this, nt);
|
|
1232
|
+
T(this, Y);
|
|
1233
|
+
T(this, q);
|
|
1234
|
+
T(this, Z, !1);
|
|
1235
|
+
T(this, J, !1);
|
|
1236
|
+
T(this, z, !1);
|
|
1237
|
+
T(this, st, !1);
|
|
1238
|
+
const s = this.constructor;
|
|
1239
|
+
O(this, B, s[Tt] || { tagName: "base-element" });
|
|
1240
|
+
const r = P(this, B);
|
|
1241
|
+
O(this, Y, (i = r.shadowDOM) != null && i.use ? this.attachShadow({ mode: r.shadowDOM.mode || "open" }) : this), N(this, C, kt).call(this, e), N(this, C, Gt).call(this, r), queueMicrotask(() => N(this, C, Rt).call(this));
|
|
1242
|
+
}
|
|
1243
|
+
// 需要在元素定义前设置的属性列表(Upgrade Property)
|
|
1244
|
+
/* -------------------- observedAttributes -------------------- */
|
|
1245
|
+
static get observedAttributes() {
|
|
1246
|
+
const e = this[Tt];
|
|
1247
|
+
return e != null && e.propMap ? Array.from(e.propMap.keys()) : [];
|
|
1248
|
+
}
|
|
1249
|
+
/* -------------------- $data -------------------- */
|
|
1250
|
+
get $data() {
|
|
1251
|
+
return P(this, nt);
|
|
1252
|
+
}
|
|
1253
|
+
set $data(e) {
|
|
1254
|
+
var s;
|
|
1255
|
+
G(e) || (e = {}), (s = P(this, q)) == null || s.call(this), N(this, C, kt).call(this, e), N(this, C, ut).call(this);
|
|
1256
|
+
}
|
|
1257
|
+
refresh() {
|
|
1258
|
+
N(this, C, ut).call(this);
|
|
1259
|
+
}
|
|
1260
|
+
/* -------------------- 生命周期 -------------------- */
|
|
1261
|
+
connectedCallback() {
|
|
1262
|
+
var i;
|
|
1263
|
+
const e = this.constructor;
|
|
1264
|
+
Array.isArray(e.upgradeProps) && N(this, C, jt).call(this, e.upgradeProps), N(this, C, Rt).call(this);
|
|
1265
|
+
const s = P(this, B);
|
|
1266
|
+
if ((s.className || s.tagName || "").split(" ").forEach((o) => o && this.classList.add(o)), N(this, C, zt).call(this), s.propMap && G(this.$data))
|
|
1267
|
+
for (const [o, c] of s.propMap) {
|
|
1268
|
+
const a = c.name;
|
|
1269
|
+
if (this.hasAttribute(o)) {
|
|
1270
|
+
const l = this.getAttribute(o), u = N(this, C, Ct).call(this, l, c.default, c.type);
|
|
1271
|
+
this.$data[a] = u;
|
|
1272
|
+
} else "default" in c && (this.$data[a] = c.default);
|
|
1273
|
+
}
|
|
1274
|
+
P(this, H) && O(this, U, je(
|
|
1275
|
+
P(this, H),
|
|
1276
|
+
P(this, Y),
|
|
1277
|
+
this
|
|
1278
|
+
)), this.mounted(), (i = this.onInit) == null || i.call(this);
|
|
1279
|
+
}
|
|
1280
|
+
disconnectedCallback() {
|
|
1281
|
+
var e;
|
|
1282
|
+
this.unmounted(), (e = P(this, q)) == null || e.call(this), O(this, q, void 0);
|
|
1283
|
+
}
|
|
1284
|
+
attributeChangedCallback(e, s, r) {
|
|
1285
|
+
var u;
|
|
1286
|
+
if (s === r || !G(this.$data)) return;
|
|
1287
|
+
const o = (u = P(this, B).propMap) == null ? void 0 : u.get(e);
|
|
1288
|
+
if (!o) return;
|
|
1289
|
+
const c = o.name, a = this.$data[c], l = N(this, C, Ct).call(this, r, o.default ?? a, o.type);
|
|
1290
|
+
this.$data[c] = l, O(this, z, !0), this.attributeChanged(e, a, l);
|
|
1291
|
+
}
|
|
1292
|
+
/* -------------------- 事件派发 -------------------- */
|
|
1293
|
+
emit(e, s, r) {
|
|
1294
|
+
this.dispatchEvent(
|
|
1295
|
+
new CustomEvent(e, {
|
|
1296
|
+
bubbles: !0,
|
|
1297
|
+
composed: !0,
|
|
1298
|
+
detail: s,
|
|
1299
|
+
...r
|
|
1300
|
+
})
|
|
1301
|
+
);
|
|
1302
|
+
}
|
|
1303
|
+
/* -------------------- 钩子 -------------------- */
|
|
1304
|
+
onInit() {
|
|
1305
|
+
}
|
|
1306
|
+
created() {
|
|
1307
|
+
}
|
|
1308
|
+
mounted() {
|
|
1309
|
+
}
|
|
1310
|
+
beforeUpdate() {
|
|
1311
|
+
}
|
|
1312
|
+
updated() {
|
|
1313
|
+
}
|
|
1314
|
+
unmounted() {
|
|
1315
|
+
}
|
|
1316
|
+
attributeChanged(e, s, r) {
|
|
1317
|
+
}
|
|
1318
|
+
beforeAttributesUpdate() {
|
|
1319
|
+
}
|
|
1320
|
+
afterAttributesUpdate() {
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
B = new WeakMap(), U = new WeakMap(), H = new WeakMap(), nt = new WeakMap(), Y = new WeakMap(), q = new WeakMap(), Z = new WeakMap(), J = new WeakMap(), z = new WeakMap(), st = new WeakMap(), C = new WeakSet(), // 升级属性(Upgrade Property), 保障在元素被定义前设置的属性能正确触发响应式更新
|
|
1324
|
+
jt = function(e) {
|
|
1325
|
+
for (const s of e)
|
|
1326
|
+
if (this.hasOwnProperty(s)) {
|
|
1327
|
+
const r = this[s];
|
|
1328
|
+
delete this[s], this[s] = r;
|
|
1329
|
+
}
|
|
1330
|
+
}, /* -------------------- 初始化 -------------------- */
|
|
1331
|
+
kt = function(e) {
|
|
1332
|
+
const { proxy: s, unobserve: r } = Me(e, (i) => {
|
|
1333
|
+
var o, c;
|
|
1334
|
+
if (i.type === "set") {
|
|
1335
|
+
const { key: a, newValue: l } = i, u = P(this, B), h = String(a), d = ((o = u.propMap) == null ? void 0 : o.get(
|
|
1336
|
+
h.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()
|
|
1337
|
+
)) || Array.from(((c = u.propMap) == null ? void 0 : c.values()) || []).find((E) => E.name === h);
|
|
1338
|
+
d != null && d.reflect && N(this, C, Bt).call(this, d, l);
|
|
1339
|
+
}
|
|
1340
|
+
this.emit("change", {
|
|
1341
|
+
source: "state",
|
|
1342
|
+
...i
|
|
1343
|
+
}), N(this, C, ut).call(this);
|
|
1344
|
+
});
|
|
1345
|
+
O(this, nt, s), O(this, q, r);
|
|
1346
|
+
}, Bt = function(e, s) {
|
|
1347
|
+
const r = e.name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1348
|
+
if (e.type === "boolean")
|
|
1349
|
+
s ? this.setAttribute(r, "") : this.removeAttribute(r);
|
|
1350
|
+
else {
|
|
1351
|
+
const i = typeof s == "object" ? JSON.stringify(s) : String(s);
|
|
1352
|
+
this.setAttribute(r, i);
|
|
1353
|
+
}
|
|
1354
|
+
}, Gt = function(e) {
|
|
1355
|
+
e.ir && O(this, H, e.ir);
|
|
1356
|
+
}, Ct = function(e, s, r) {
|
|
1357
|
+
if (e === null)
|
|
1358
|
+
return r === "boolean" ? s ?? !1 : s;
|
|
1359
|
+
switch (r) {
|
|
1360
|
+
case "boolean":
|
|
1361
|
+
return !0;
|
|
1362
|
+
case "number": {
|
|
1363
|
+
const i = Number(e);
|
|
1364
|
+
return isNaN(i) ? s : i;
|
|
1365
|
+
}
|
|
1366
|
+
case "object":
|
|
1367
|
+
try {
|
|
1368
|
+
return JSON.parse(e);
|
|
1369
|
+
} catch {
|
|
1370
|
+
return s;
|
|
1371
|
+
}
|
|
1372
|
+
default:
|
|
1373
|
+
return e;
|
|
1374
|
+
}
|
|
1375
|
+
}, /* -------------------- 刷新调度 -------------------- */
|
|
1376
|
+
ut = function() {
|
|
1377
|
+
P(this, J) || !P(this, U) || (O(this, J, !0), queueMicrotask(() => {
|
|
1378
|
+
O(this, J, !1), N(this, C, qt).call(this);
|
|
1379
|
+
}));
|
|
1380
|
+
}, qt = function() {
|
|
1381
|
+
P(this, Z) || !this.isConnected || (O(this, Z, !0), P(this, z) && this.beforeAttributesUpdate(), this.beforeUpdate(), P(this, U).update(), this.updated(), P(this, z) && (this.afterAttributesUpdate(), O(this, z, !1)), O(this, Z, !1));
|
|
1382
|
+
}, zt = function() {
|
|
1383
|
+
const e = P(this, B);
|
|
1384
|
+
if (!e.styles) return;
|
|
1385
|
+
const s = P(this, Y);
|
|
1386
|
+
if (e.sheet && s instanceof ShadowRoot && "adoptedStyleSheets" in s) {
|
|
1387
|
+
s.adoptedStyleSheets.includes(e.sheet) || (s.adoptedStyleSheets = [...s.adoptedStyleSheets, e.sheet]);
|
|
1388
|
+
return;
|
|
1389
|
+
}
|
|
1390
|
+
const r = s instanceof ShadowRoot ? s : document.head, i = `solely-style-${e.tagName}`;
|
|
1391
|
+
if (!r.querySelector(`#${i}`)) {
|
|
1392
|
+
const o = document.createElement("style");
|
|
1393
|
+
o.id = i, o.textContent = e.styles, r.appendChild(o);
|
|
1394
|
+
}
|
|
1395
|
+
}, /* -------------------- created 保障 -------------------- */
|
|
1396
|
+
Rt = function() {
|
|
1397
|
+
P(this, st) || (O(this, st, !0), this.created());
|
|
1398
|
+
}, Lt = new WeakMap(), k(ft, "upgradeProps"), /* -------------------- DEV define 保护 -------------------- */
|
|
1399
|
+
T(ft, Lt, !1);
|
|
1400
|
+
const Be = Symbol.for("solely.manifest"), Kt = (n) => {
|
|
1401
|
+
const t = n;
|
|
1402
|
+
return (e) => {
|
|
1403
|
+
const { tagName: s } = t;
|
|
1404
|
+
if (customElements.get(s))
|
|
1405
|
+
return e;
|
|
1406
|
+
if (typeof t.template == "string" && !t.ir)
|
|
1407
|
+
try {
|
|
1408
|
+
const i = Le(t.template);
|
|
1409
|
+
t.ir = xe(i, {
|
|
1410
|
+
source: t.template,
|
|
1411
|
+
filename: s
|
|
1412
|
+
});
|
|
1413
|
+
} catch (i) {
|
|
1414
|
+
console.error(`[Compiler Error] <${s}>:`, i);
|
|
1415
|
+
}
|
|
1416
|
+
if (t.styles && !t.sheet && "CSSStyleSheet" in window)
|
|
1417
|
+
try {
|
|
1418
|
+
const i = new CSSStyleSheet();
|
|
1419
|
+
i.replaceSync(t.styles), t.sheet = i;
|
|
1420
|
+
} catch (i) {
|
|
1421
|
+
console.error(`[Style Error] <${s}>:`, i);
|
|
1422
|
+
}
|
|
1423
|
+
if (t.props && !t.propMap) {
|
|
1424
|
+
const i = /* @__PURE__ */ new Map();
|
|
1425
|
+
t.props.forEach((o) => {
|
|
1426
|
+
const c = typeof o == "string" ? { name: o } : o, a = c.name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), l = a.replace(/-([a-z])/g, (u, h) => h.toUpperCase());
|
|
1427
|
+
i.set(a, { ...c, name: l });
|
|
1428
|
+
}), t.propMap = i;
|
|
1429
|
+
}
|
|
1430
|
+
class r extends e {
|
|
1431
|
+
}
|
|
1432
|
+
return r[Be] = t, customElements.define(s, r), r;
|
|
1433
|
+
};
|
|
1434
1434
|
};
|
|
1435
|
-
let
|
|
1435
|
+
let K = null, Ut;
|
|
1436
1436
|
const Ht = new Promise((n) => {
|
|
1437
1437
|
Ut = n;
|
|
1438
1438
|
});
|
|
1439
1439
|
function Je(n) {
|
|
1440
|
-
return
|
|
1440
|
+
return K || (K = new Ge(n), Ut(K), K);
|
|
1441
1441
|
}
|
|
1442
1442
|
function Et() {
|
|
1443
|
-
return
|
|
1443
|
+
return K;
|
|
1444
1444
|
}
|
|
1445
1445
|
class Ge {
|
|
1446
1446
|
constructor(t) {
|
|
@@ -1456,7 +1456,7 @@ class Ge {
|
|
|
1456
1456
|
}
|
|
1457
1457
|
// --- 核心匹配逻辑 ---
|
|
1458
1458
|
matchRoute(t = "/") {
|
|
1459
|
-
const e = t.startsWith("/") ? t : "/" + t, [s, r] = e.split("?"),
|
|
1459
|
+
const e = t.startsWith("/") ? t : "/" + t, [s, r] = e.split("?"), i = s.split("/").filter(Boolean), o = this.parseQuery(r), c = this.recursiveMatch(this.routes, i);
|
|
1460
1460
|
if (c) {
|
|
1461
1461
|
const a = c.matched[c.matched.length - 1];
|
|
1462
1462
|
return a.config.redirect ? this.matchRoute(a.config.redirect) : {
|
|
@@ -1464,7 +1464,7 @@ class Ge {
|
|
|
1464
1464
|
// 这里的结构已经是 [{config, params}, ...]
|
|
1465
1465
|
params: c.params,
|
|
1466
1466
|
// 全局合并后的 params
|
|
1467
|
-
query:
|
|
1467
|
+
query: o,
|
|
1468
1468
|
fullPath: e,
|
|
1469
1469
|
// 合并所有层级的 meta
|
|
1470
1470
|
meta: c.matched.reduce((l, u) => ({ ...l, ...u.config.meta || {} }), {})
|
|
@@ -1473,23 +1473,23 @@ class Ge {
|
|
|
1473
1473
|
return null;
|
|
1474
1474
|
}
|
|
1475
1475
|
recursiveMatch(t, e) {
|
|
1476
|
-
const s = [...t].sort((r,
|
|
1476
|
+
const s = [...t].sort((r, i) => this.calculateScore(i.path) - this.calculateScore(r.path));
|
|
1477
1477
|
for (const r of s) {
|
|
1478
|
-
const
|
|
1478
|
+
const i = r.path.split("/").filter(Boolean), o = {};
|
|
1479
1479
|
let c = !0;
|
|
1480
|
-
if (
|
|
1480
|
+
if (i.length === 0 && e.length === 0)
|
|
1481
1481
|
return {
|
|
1482
1482
|
matched: [{ config: r, params: {} }],
|
|
1483
1483
|
params: {}
|
|
1484
1484
|
};
|
|
1485
|
-
for (let a = 0; a <
|
|
1486
|
-
const l =
|
|
1485
|
+
for (let a = 0; a < i.length; a++) {
|
|
1486
|
+
const l = i[a], u = e[a];
|
|
1487
1487
|
if (l.startsWith(":")) {
|
|
1488
1488
|
if (!u) {
|
|
1489
1489
|
c = !1;
|
|
1490
1490
|
break;
|
|
1491
1491
|
}
|
|
1492
|
-
|
|
1492
|
+
o[l.slice(1)] = u;
|
|
1493
1493
|
} else if (l === "*") {
|
|
1494
1494
|
c = !0;
|
|
1495
1495
|
break;
|
|
@@ -1499,19 +1499,19 @@ class Ge {
|
|
|
1499
1499
|
}
|
|
1500
1500
|
}
|
|
1501
1501
|
if (c) {
|
|
1502
|
-
const a =
|
|
1502
|
+
const a = i.length, l = e.slice(a), u = { config: r, params: o };
|
|
1503
1503
|
if (l.length > 0 && r.children) {
|
|
1504
1504
|
const h = this.recursiveMatch(r.children, l);
|
|
1505
1505
|
if (h)
|
|
1506
1506
|
return {
|
|
1507
1507
|
matched: [u, ...h.matched],
|
|
1508
|
-
params: { ...
|
|
1508
|
+
params: { ...o, ...h.params }
|
|
1509
1509
|
// 全局合并 params
|
|
1510
1510
|
};
|
|
1511
|
-
} else if (l.length === 0 ||
|
|
1511
|
+
} else if (l.length === 0 || i.includes("*"))
|
|
1512
1512
|
return {
|
|
1513
1513
|
matched: [u],
|
|
1514
|
-
params:
|
|
1514
|
+
params: o
|
|
1515
1515
|
};
|
|
1516
1516
|
}
|
|
1517
1517
|
}
|
|
@@ -1523,8 +1523,8 @@ class Ge {
|
|
|
1523
1523
|
}
|
|
1524
1524
|
parseQuery(t) {
|
|
1525
1525
|
const e = {};
|
|
1526
|
-
return t && new URLSearchParams(t).forEach((r,
|
|
1527
|
-
e[
|
|
1526
|
+
return t && new URLSearchParams(t).forEach((r, i) => {
|
|
1527
|
+
e[i] = r;
|
|
1528
1528
|
}), e;
|
|
1529
1529
|
}
|
|
1530
1530
|
normalizePath(t = "/") {
|
|
@@ -1547,26 +1547,26 @@ class Ge {
|
|
|
1547
1547
|
if (this.mode === "hash")
|
|
1548
1548
|
e ? window.location.replace(`#${s}`) : window.location.hash = s;
|
|
1549
1549
|
else {
|
|
1550
|
-
const
|
|
1551
|
-
e ? window.history.replaceState({ path:
|
|
1550
|
+
const i = r.endsWith("/") ? r.slice(0, -1) : r, o = i === "/" ? s : i + s;
|
|
1551
|
+
e ? window.history.replaceState({ path: o }, "", o) : window.history.pushState({ path: o }, "", o);
|
|
1552
1552
|
}
|
|
1553
1553
|
}
|
|
1554
1554
|
/**
|
|
1555
1555
|
* @param fromEvent 标志位:是否由浏览器 popstate 事件触发
|
|
1556
1556
|
*/
|
|
1557
1557
|
async navigate(t = "/", e = !1, s = !1) {
|
|
1558
|
-
const r = this.normalizePath(t),
|
|
1559
|
-
if (!
|
|
1560
|
-
if (
|
|
1558
|
+
const r = this.normalizePath(t), i = this.currentRoute, o = this.matchRoute(r);
|
|
1559
|
+
if (!o) return { success: !1, error: `No route matched: ${r}` };
|
|
1560
|
+
if (i && i.fullPath === o.fullPath) return { success: !0 };
|
|
1561
1561
|
if (this.beforeEachGuard)
|
|
1562
1562
|
try {
|
|
1563
|
-
const c = await this.beforeEachGuard(
|
|
1563
|
+
const c = await this.beforeEachGuard(o, i);
|
|
1564
1564
|
if (c === !1) return { success: !1, cancelled: !0 };
|
|
1565
1565
|
if (typeof c == "string") return this.navigate(c, e);
|
|
1566
1566
|
} catch (c) {
|
|
1567
1567
|
return { success: !1, error: c instanceof Error ? c.message : "Guard Error" };
|
|
1568
1568
|
}
|
|
1569
|
-
return this.currentRoute =
|
|
1569
|
+
return this.currentRoute = o, s || this.updateBrowserHistory(r, e), this.notifyListeners(), this.afterEachGuard && this.afterEachGuard(o, i), { success: !0 };
|
|
1570
1570
|
}
|
|
1571
1571
|
// --- 路径解析逻辑 ---
|
|
1572
1572
|
/**
|
|
@@ -1616,8 +1616,8 @@ class Ge {
|
|
|
1616
1616
|
}
|
|
1617
1617
|
}
|
|
1618
1618
|
var qe = Object.getOwnPropertyDescriptor, ze = (n, t, e, s) => {
|
|
1619
|
-
for (var r = s > 1 ? void 0 : s ? qe(t, e) : t,
|
|
1620
|
-
(
|
|
1619
|
+
for (var r = s > 1 ? void 0 : s ? qe(t, e) : t, i = n.length - 1, o; i >= 0; i--)
|
|
1620
|
+
(o = n[i]) && (r = o(r) || r);
|
|
1621
1621
|
return r;
|
|
1622
1622
|
};
|
|
1623
1623
|
let dt = class extends ft {
|
|
@@ -1664,29 +1664,29 @@ let dt = class extends ft {
|
|
|
1664
1664
|
return;
|
|
1665
1665
|
}
|
|
1666
1666
|
const { config: r } = s;
|
|
1667
|
-
let
|
|
1668
|
-
if (!
|
|
1667
|
+
let i = r.tagName;
|
|
1668
|
+
if (!i && typeof r.component == "function") {
|
|
1669
1669
|
this.renderLoading();
|
|
1670
1670
|
try {
|
|
1671
1671
|
const c = await r.component();
|
|
1672
|
-
|
|
1672
|
+
i = typeof c == "string" ? c : c.tagName;
|
|
1673
1673
|
} catch (c) {
|
|
1674
1674
|
this.renderError(`Load Error: ${c}`);
|
|
1675
1675
|
return;
|
|
1676
1676
|
}
|
|
1677
1677
|
}
|
|
1678
1678
|
if (e !== this.latestLoadId) return;
|
|
1679
|
-
if (!
|
|
1679
|
+
if (!i) {
|
|
1680
1680
|
this.clear();
|
|
1681
1681
|
return;
|
|
1682
1682
|
}
|
|
1683
|
-
if (!r.forceReload && this.currentElement && this.currentTagName ===
|
|
1683
|
+
if (!r.forceReload && this.currentElement && this.currentTagName === i.toLowerCase()) {
|
|
1684
1684
|
this.syncState(this.currentElement, t == null ? void 0 : t.params, (t == null ? void 0 : t.query) || {}, r.props);
|
|
1685
1685
|
return;
|
|
1686
1686
|
}
|
|
1687
1687
|
this.clear(r.keepAlive);
|
|
1688
|
-
const
|
|
1689
|
-
this.syncState(
|
|
1688
|
+
const o = this.getOrCreateComponent(i, r);
|
|
1689
|
+
this.syncState(o, t == null ? void 0 : t.params, (t == null ? void 0 : t.query) || {}, r.props), this.appendChild(o), this.currentElement = o, this.currentTagName = i.toLowerCase();
|
|
1690
1690
|
}
|
|
1691
1691
|
getOrCreateComponent(t, e) {
|
|
1692
1692
|
const s = t.toLowerCase();
|
|
@@ -1696,10 +1696,10 @@ let dt = class extends ft {
|
|
|
1696
1696
|
return e.keepAlive && this.cache.set(s, r), r;
|
|
1697
1697
|
}
|
|
1698
1698
|
syncState(t, e, s, r = {}) {
|
|
1699
|
-
const
|
|
1700
|
-
Object.entries(e).forEach(([a, l]) =>
|
|
1701
|
-
|
|
1702
|
-
}),
|
|
1699
|
+
const i = (a) => a.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), o = /* @__PURE__ */ new Map();
|
|
1700
|
+
Object.entries(e).forEach(([a, l]) => o.set(i(a), String(l))), Object.entries(s).forEach(([a, l]) => o.set(`query-${i(a)}`, String(l))), this.routerAttrs.forEach((a) => {
|
|
1701
|
+
o.has(a) || (t.removeAttribute(a), this.routerAttrs.delete(a));
|
|
1702
|
+
}), o.forEach((a, l) => {
|
|
1703
1703
|
t.getAttribute(l) !== a && t.setAttribute(l, a), this.routerAttrs.add(l);
|
|
1704
1704
|
});
|
|
1705
1705
|
const c = new Set(Object.keys(r));
|
|
@@ -1723,15 +1723,15 @@ let dt = class extends ft {
|
|
|
1723
1723
|
}
|
|
1724
1724
|
};
|
|
1725
1725
|
dt = ze([
|
|
1726
|
-
|
|
1726
|
+
Kt({
|
|
1727
1727
|
tagName: "router-view"
|
|
1728
1728
|
// 注意:删除了 shadowDOM 配置,默认为 false
|
|
1729
1729
|
})
|
|
1730
1730
|
], dt);
|
|
1731
1731
|
const Xe = dt;
|
|
1732
1732
|
var Ke = Object.getOwnPropertyDescriptor, Ue = (n, t, e, s) => {
|
|
1733
|
-
for (var r = s > 1 ? void 0 : s ? Ke(t, e) : t,
|
|
1734
|
-
(
|
|
1733
|
+
for (var r = s > 1 ? void 0 : s ? Ke(t, e) : t, i = n.length - 1, o; i >= 0; i--)
|
|
1734
|
+
(o = n[i]) && (r = o(r) || r);
|
|
1735
1735
|
return r;
|
|
1736
1736
|
};
|
|
1737
1737
|
let At = class extends ft {
|
|
@@ -1747,8 +1747,8 @@ let At = class extends ft {
|
|
|
1747
1747
|
}
|
|
1748
1748
|
async mounted() {
|
|
1749
1749
|
(await Ht).listen(() => this.updateState()), this.updateState(), this.addEventListener("click", (e) => {
|
|
1750
|
-
var r,
|
|
1751
|
-
e.defaultPrevented || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || e.button !== 0 || (r = e.target.closest("a")) != null && r.getAttribute("target") || (e.preventDefault(), (
|
|
1750
|
+
var r, i;
|
|
1751
|
+
e.defaultPrevented || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || e.button !== 0 || (r = e.target.closest("a")) != null && r.getAttribute("target") || (e.preventDefault(), (i = Et()) == null || i.push(this.$data.to));
|
|
1752
1752
|
}), this.addEventListener("mouseenter", () => {
|
|
1753
1753
|
this.prefetchRoute();
|
|
1754
1754
|
}, { once: !0 });
|
|
@@ -1763,8 +1763,8 @@ let At = class extends ft {
|
|
|
1763
1763
|
else {
|
|
1764
1764
|
const r = t.getCurrentRoute();
|
|
1765
1765
|
if (r) {
|
|
1766
|
-
const
|
|
1767
|
-
this.hasAttribute("exact") ? e =
|
|
1766
|
+
const i = r.fullPath;
|
|
1767
|
+
this.hasAttribute("exact") ? e = i === this.$data.to : e = i === this.$data.to || i.startsWith(this.$data.to + "/");
|
|
1768
1768
|
}
|
|
1769
1769
|
}
|
|
1770
1770
|
this.$data.isActive = e;
|
|
@@ -1779,7 +1779,7 @@ let At = class extends ft {
|
|
|
1779
1779
|
}
|
|
1780
1780
|
};
|
|
1781
1781
|
At = Ue([
|
|
1782
|
-
|
|
1782
|
+
Kt({
|
|
1783
1783
|
tagName: "router-link",
|
|
1784
1784
|
// template 中 slot 包裹 label 作为 fallback:
|
|
1785
1785
|
// 如果有子节点,显示子节点;如果没有,显示 label 属性的内容。
|
|
@@ -1817,8 +1817,8 @@ const Qe = At;
|
|
|
1817
1817
|
export {
|
|
1818
1818
|
y as ASTType,
|
|
1819
1819
|
ft as BaseElement,
|
|
1820
|
-
|
|
1821
|
-
|
|
1820
|
+
Kt as CustomElement,
|
|
1821
|
+
De as IRRenderer,
|
|
1822
1822
|
de as LIFECYCLE_ATTRS_MAP,
|
|
1823
1823
|
Ge as Router,
|
|
1824
1824
|
Qe as RouterLink,
|
|
@@ -1826,12 +1826,12 @@ export {
|
|
|
1826
1826
|
xe as buildIR,
|
|
1827
1827
|
Ze as clearIRCache,
|
|
1828
1828
|
ne as createFunction,
|
|
1829
|
-
|
|
1829
|
+
je as createRender,
|
|
1830
1830
|
Je as createRouter,
|
|
1831
1831
|
he as genFunction,
|
|
1832
1832
|
Et as getRouter,
|
|
1833
1833
|
me as isLifecycleKind,
|
|
1834
|
-
|
|
1834
|
+
G as isObject,
|
|
1835
1835
|
fe as listeners,
|
|
1836
1836
|
pe as mapAttrKeyToLifecycleKind,
|
|
1837
1837
|
Me as observe,
|