solely 0.1.5 → 0.1.7
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 +37 -0
- package/dist/compiler/ir/buildIR.d.ts +14 -0
- package/dist/compiler/parser/parser.d.ts +2 -0
- package/dist/index.js +873 -831
- package/dist/index.umd.cjs +10 -10
- package/dist/runtime/component/decorators.d.ts +13 -0
- package/dist/runtime/reactivity/index.d.ts +2 -2
- package/dist/runtime/reactivity/observe.d.ts +31 -1
- package/dist/runtime/renderer/renderIR.d.ts +13 -0
- package/dist/runtime/router/core.d.ts +13 -0
- package/dist/shared/functions.d.ts +6 -0
- package/dist/shared/gen-function.d.ts +8 -0
- package/dist/shared/is-object.d.ts +5 -0
- package/dist/shared/url.d.ts +2 -2
- package/dist/types/ast.d.ts +4 -0
- package/dist/types/lifecycle.d.ts +12 -0
- package/dist/types/loop.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var re = Object.defineProperty;
|
|
2
|
+
var Nt = (n) => {
|
|
3
3
|
throw TypeError(n);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
const
|
|
5
|
+
var ie = (n, t, e) => t in n ? re(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
6
|
+
var S = (n, t, e) => ie(n, typeof t != "symbol" ? t + "" : t, e), pt = (n, t, e) => t.has(n) || Nt("Cannot " + e);
|
|
7
|
+
var C = (n, t, e) => (pt(n, t, "read from private field"), e ? e.call(n) : t.get(n)), M = (n, t, e) => t.has(n) ? Nt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), A = (n, t, e, s) => (pt(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), I = (n, t, e) => (pt(n, t, "access private method"), e);
|
|
8
|
+
const oe = {
|
|
9
9
|
dark: {
|
|
10
10
|
gutter: "#858585",
|
|
11
11
|
errorLineBg: "#3c1e1e",
|
|
@@ -16,8 +16,8 @@ const te = {
|
|
|
16
16
|
exprLabel: "#a0a0a0",
|
|
17
17
|
exprCode: "#5ddcff"
|
|
18
18
|
}
|
|
19
|
-
},
|
|
20
|
-
function
|
|
19
|
+
}, P = oe.dark;
|
|
20
|
+
function st(n) {
|
|
21
21
|
let t = 0;
|
|
22
22
|
for (let e = 0; e < n.length; ) {
|
|
23
23
|
const s = n.codePointAt(e);
|
|
@@ -29,97 +29,97 @@ function it(n) {
|
|
|
29
29
|
}
|
|
30
30
|
return t;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function _t(n, t = {}) {
|
|
33
33
|
const { lineIndex: e = 0, totalLines: s = 1 } = t, r = Math.max(1, Math.floor(n));
|
|
34
34
|
return (s <= 1 || e === 0 ? "^" : "~").repeat(r);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
var
|
|
38
|
-
const r = (n == null ? void 0 : n.message) ?? String(n),
|
|
39
|
-
`color:${
|
|
40
|
-
`color:${
|
|
36
|
+
function ae(n, t = "", e, s = "component") {
|
|
37
|
+
var et;
|
|
38
|
+
const r = (n == null ? void 0 : n.message) ?? String(n), o = `%cTemplate Error%c in <${s}> → ${r}`, i = [
|
|
39
|
+
`color:${P.badgeFg};background:${P.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,
|
|
40
|
+
`color:${P.arrow};font-weight:bold;`
|
|
41
41
|
];
|
|
42
42
|
if (!t || !(e != null && e.loc) || e.loc.length < 2) {
|
|
43
|
-
console.error(
|
|
43
|
+
console.error(o, ...i), e != null && e.expr && console.log(`Expression: ${e.expr.trim()}`);
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
const
|
|
47
|
-
let a =
|
|
48
|
-
a |= 0,
|
|
49
|
-
const
|
|
46
|
+
const l = e.loc;
|
|
47
|
+
let a = l[0] || 0, c = l[1] || 0;
|
|
48
|
+
a |= 0, c |= 0, a < 1 && (a = 1), c < 1 && (c = 1);
|
|
49
|
+
const h = t.split(`
|
|
50
50
|
`);
|
|
51
|
-
if (a >
|
|
51
|
+
if (a > h.length) {
|
|
52
52
|
console.error(`[Template Error] 行号 ${a} 超出范围`);
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
const
|
|
56
|
-
`) : [],
|
|
55
|
+
const u = a - 1, p = Math.max(0, u - 3), v = Math.min(h.length - 1, u + 3), f = String(v + 1).length, d = ((et = e.expr) == null ? void 0 : et.trim()) ?? "", $ = d ? d.split(`
|
|
56
|
+
`) : [], m = d ? Math.max(...$.map(st)) : 0, y = $.length > 1, g = `color:${P.gutter};`, b = `color:${P.arrow};font-weight:bold;`, E = `color:${P.gutter};`, x = `color:${P.errorLineFg};background:${P.errorLineBg};padding:0 4px;`, R = `color:${P.gutter};`, L = `color:${P.arrow};font-weight:bold;padding:0 4px;`;
|
|
57
57
|
console.groupCollapsed(
|
|
58
|
-
`${
|
|
59
|
-
...
|
|
60
|
-
`color:${
|
|
58
|
+
`${o} %c(Line:${a}, Col:${c})`,
|
|
59
|
+
...i,
|
|
60
|
+
`color:${P.gutter};font-weight:normal;`
|
|
61
61
|
);
|
|
62
|
-
for (let
|
|
63
|
-
const
|
|
64
|
-
if (!(
|
|
65
|
-
console.log(`%c${
|
|
62
|
+
for (let G = p; G <= v; G++) {
|
|
63
|
+
const ht = h[G], Lt = String(G + 1).padStart(f, " ");
|
|
64
|
+
if (!(G === u)) {
|
|
65
|
+
console.log(`%c${Lt} │%c ${ht}`, g, E);
|
|
66
66
|
continue;
|
|
67
67
|
}
|
|
68
|
-
const
|
|
69
|
-
if (console.log(`%c${
|
|
70
|
-
for (let
|
|
71
|
-
const
|
|
72
|
-
let
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
else if (
|
|
76
|
-
const
|
|
77
|
-
|
|
68
|
+
const te = ht.slice(0, Math.max(0, c - 1)), It = st(te), Mt = " ".repeat(f + 3), ee = Lt.padEnd(f, " ");
|
|
69
|
+
if (console.log(`%c${ee} │%c ${ht}`, b, x), y)
|
|
70
|
+
for (let _ = 0; _ < $.length; _++) {
|
|
71
|
+
const ft = $[_], Z = u + _;
|
|
72
|
+
let dt = 0;
|
|
73
|
+
if (_ === 0)
|
|
74
|
+
dt = It;
|
|
75
|
+
else if (Z < h.length) {
|
|
76
|
+
const J = h[Z], nt = J.search(/\S/), se = nt === -1 ? J : J.slice(0, nt);
|
|
77
|
+
dt = st(se);
|
|
78
78
|
}
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
console.log(`%c${
|
|
82
|
-
else if (
|
|
83
|
-
const
|
|
84
|
-
console.log(`%c${
|
|
79
|
+
const ne = Math.max(1, st(ft.trim())), Pt = _t(ne, { lineIndex: _, totalLines: $.length }), Ot = Mt + " ".repeat(dt);
|
|
80
|
+
if (_ === 0)
|
|
81
|
+
console.log(`%c${Ot}%c${Pt}`, R, L);
|
|
82
|
+
else if (Z < h.length) {
|
|
83
|
+
const J = String(Z + 1).padEnd(f, " "), nt = h[Z];
|
|
84
|
+
console.log(`%c${J} │%c ${nt}`, b, x), console.log(`%c${Ot}%c${Pt}`, R, L);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
else {
|
|
88
|
-
const
|
|
89
|
-
console.log(`%c${
|
|
88
|
+
const _ = Mt + " ".repeat(It), ft = _t(m || 1);
|
|
89
|
+
console.log(`%c${_}%c${ft}`, R, L);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
`%cExpression:%c ${
|
|
94
|
-
`color:${
|
|
95
|
-
`color:${
|
|
92
|
+
d && console.log(
|
|
93
|
+
`%cExpression:%c ${d}`,
|
|
94
|
+
`color:${P.exprLabel};font-weight:bold;`,
|
|
95
|
+
`color:${P.exprCode};font-family:monospace;`
|
|
96
96
|
), console.groupEnd();
|
|
97
97
|
}
|
|
98
|
-
const
|
|
99
|
-
function
|
|
98
|
+
const mt = {};
|
|
99
|
+
function ce(n) {
|
|
100
100
|
const t = n.map((e) => e.replace(/[',"]/g, "")).join(",");
|
|
101
|
-
if (!
|
|
101
|
+
if (!mt[t]) {
|
|
102
102
|
const e = n[n.length - 1];
|
|
103
103
|
if (e.trim() === "")
|
|
104
104
|
throw new Error("Function body cannot be empty");
|
|
105
|
-
if (
|
|
105
|
+
if (ue(e))
|
|
106
106
|
throw new Error("Input contains potentially dangerous code: " + e);
|
|
107
|
-
|
|
107
|
+
mt[t] = new Function(...n);
|
|
108
108
|
}
|
|
109
|
-
return
|
|
109
|
+
return mt[t];
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
function
|
|
113
|
-
return
|
|
111
|
+
const le = ["eval", "Function", "process", "require"];
|
|
112
|
+
function ue(n) {
|
|
113
|
+
return le.some((t) => new RegExp(`\\b${t}\\b`, "g").test(n));
|
|
114
114
|
}
|
|
115
|
-
const
|
|
116
|
-
function
|
|
115
|
+
const he = /\{\{\{\s*[\s\S]*?\s*\}\}\}/, fe = /\{\{\s*([\s\S]*?)\s*\}\}/g;
|
|
116
|
+
function de(n, t) {
|
|
117
117
|
if (!(n != null && n.trim())) return "";
|
|
118
|
-
if (
|
|
118
|
+
if (he.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(fe, (e, s) => `\${${s.trim()}}`) : n;
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function pe(n, t) {
|
|
123
123
|
const e = (s) => s.endsWith(";") ? s : s + ";";
|
|
124
124
|
switch (t) {
|
|
125
125
|
case "template":
|
|
@@ -131,7 +131,7 @@ function ce(n, t) {
|
|
|
131
131
|
return e(n);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function me(n) {
|
|
135
135
|
if (!n.length) return { loopValues: "", loopIndices: "" };
|
|
136
136
|
const t = n.map((s) => s.item).join(", "), e = n.map((s) => s.index).join(", ");
|
|
137
137
|
return {
|
|
@@ -139,22 +139,22 @@ function le(n) {
|
|
|
139
139
|
loopIndices: `var [${e}] = loops.map(l => l.idxVal);`
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
const r = n === "lifecycle" ? ["el", "loops"] : n === "handler" ? ["event", "loops"] : ["loops"],
|
|
142
|
+
function ge(n, t, e, s) {
|
|
143
|
+
const r = n === "lifecycle" ? ["el", "loops"] : n === "handler" ? ["event", "loops"] : ["loops"], i = `
|
|
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(i), r;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function ye(n, t, e) {
|
|
153
153
|
if (!(n != null && n.trim())) return () => "";
|
|
154
|
-
const s =
|
|
155
|
-
return
|
|
154
|
+
const s = de(n, t), r = pe(s, t), { loopValues: o, loopIndices: i } = me(e), l = ge(t, r, o, i);
|
|
155
|
+
return ce(l);
|
|
156
156
|
}
|
|
157
|
-
const
|
|
157
|
+
const be = /* @__PURE__ */ new Set([
|
|
158
158
|
"onabort",
|
|
159
159
|
"onautocomplete",
|
|
160
160
|
"onautocompleteerror",
|
|
@@ -217,7 +217,7 @@ const fe = /* @__PURE__ */ new Set([
|
|
|
217
217
|
"ontoggle",
|
|
218
218
|
"onvolumechange",
|
|
219
219
|
"onwaiting"
|
|
220
|
-
]),
|
|
220
|
+
]), V = (n) => {
|
|
221
221
|
if (n === null || typeof n != "object") return !1;
|
|
222
222
|
const t = Object.prototype.toString.call(n);
|
|
223
223
|
return ![
|
|
@@ -230,43 +230,43 @@ const fe = /* @__PURE__ */ new Set([
|
|
|
230
230
|
"[object WeakSet]"
|
|
231
231
|
].includes(t);
|
|
232
232
|
};
|
|
233
|
-
function
|
|
233
|
+
function on(n = window.location) {
|
|
234
234
|
let t;
|
|
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 [
|
|
241
|
-
|
|
238
|
+
const r = e[1], o = {};
|
|
239
|
+
return s = s.replace(/^#\/?/, ""), r && r.split("&").forEach((i) => {
|
|
240
|
+
const [l, a] = i.split("=");
|
|
241
|
+
l && a && (o[decodeURIComponent(l)] = decodeURIComponent(a));
|
|
242
242
|
}), {
|
|
243
243
|
path: s.split("/").filter(Boolean),
|
|
244
244
|
// 将路径分割成数组并过滤空字符串
|
|
245
|
-
query:
|
|
245
|
+
query: o
|
|
246
246
|
// 查询参数对象
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
|
-
var
|
|
250
|
-
const
|
|
249
|
+
var w = /* @__PURE__ */ ((n) => (n[n.Element = 0] = "Element", n[n.Text = 1] = "Text", n[n.Comment = 2] = "Comment", n[n.If = 3] = "If", n[n.ElseIf = 4] = "ElseIf", n[n.Else = 5] = "Else", n[n.For = 6] = "For", n[n.Conditional = 7] = "Conditional", n[n.Other = 99] = "Other", n))(w || {});
|
|
250
|
+
const we = {
|
|
251
251
|
// 可选别名
|
|
252
252
|
onMounted: "mounted",
|
|
253
253
|
onUpdated: "updated",
|
|
254
254
|
onUnmounted: "unmounted"
|
|
255
255
|
};
|
|
256
|
-
function
|
|
257
|
-
return
|
|
256
|
+
function Ee(n) {
|
|
257
|
+
return we[n] ?? null;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function ve(n) {
|
|
260
260
|
return n === "mounted" || n === "updated" || n === "unmounted";
|
|
261
261
|
}
|
|
262
|
-
const
|
|
263
|
-
class
|
|
262
|
+
const wt = Symbol.for("solely.irMeta"), Y = process.env.NODE_ENV !== "production", $e = /\{\{[\s\S]*?\}\}/;
|
|
263
|
+
class xe {
|
|
264
264
|
constructor() {
|
|
265
|
-
|
|
265
|
+
S(this, "compilers", /* @__PURE__ */ new Map());
|
|
266
266
|
}
|
|
267
267
|
get(t = "anonymous") {
|
|
268
268
|
let e = this.compilers.get(t);
|
|
269
|
-
return e || (e = new
|
|
269
|
+
return e || (e = new Se(), this.compilers.set(t, e)), e;
|
|
270
270
|
}
|
|
271
271
|
clear(t) {
|
|
272
272
|
var e;
|
|
@@ -278,31 +278,31 @@ class ye {
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
const
|
|
282
|
-
class
|
|
281
|
+
const Gt = new xe();
|
|
282
|
+
class Se {
|
|
283
283
|
constructor() {
|
|
284
|
-
|
|
285
|
-
|
|
284
|
+
S(this, "cache", /* @__PURE__ */ new Map());
|
|
285
|
+
S(this, "functions", []);
|
|
286
286
|
}
|
|
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((o) => Object.keys(o).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 (
|
|
298
|
-
let
|
|
296
|
+
const o = this.makeCacheKey(t, r, s), i = this.cache.get(o);
|
|
297
|
+
if (i !== void 0) return i;
|
|
298
|
+
let l;
|
|
299
299
|
try {
|
|
300
|
-
|
|
301
|
-
} catch (
|
|
302
|
-
|
|
300
|
+
l = ye(r, t, s);
|
|
301
|
+
} catch (c) {
|
|
302
|
+
Y && console.error(`[IR Compile Error] Type: ${t}, Expr: "${r}"`, c), l = () => "";
|
|
303
303
|
}
|
|
304
|
-
const a = this.functions.push(
|
|
305
|
-
return this.cache.set(
|
|
304
|
+
const a = this.functions.push(l);
|
|
305
|
+
return this.cache.set(o, a), a;
|
|
306
306
|
}
|
|
307
307
|
getFunctions() {
|
|
308
308
|
return this.functions;
|
|
@@ -314,32 +314,32 @@ class be {
|
|
|
314
314
|
this.cache.clear(), this.functions = [];
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function qt(n) {
|
|
318
318
|
const t = n[0];
|
|
319
|
-
return t === ":" ? { isDynamic: !0, type: "expression" } : t === "@" ? { isDynamic: !0, type: "handler" } :
|
|
319
|
+
return t === ":" ? { isDynamic: !0, type: "expression" } : t === "@" ? { isDynamic: !0, type: "handler" } : ve(n) ? { isDynamic: !0, type: "lifecycle" } : { isDynamic: !1, type: null };
|
|
320
320
|
}
|
|
321
|
-
function
|
|
322
|
-
return n ?
|
|
321
|
+
function ke(n) {
|
|
322
|
+
return n ? $e.test(n) : !1;
|
|
323
323
|
}
|
|
324
|
-
function
|
|
325
|
-
|
|
324
|
+
function Et(n, t, e) {
|
|
325
|
+
Y && (n[wt] = { expr: t ?? "", loc: e ?? null });
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function Ce(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(), o = n.attrs.find((a) => a.key === "type"), i = (o == null ? void 0 : o.value) ?? "text";
|
|
332
332
|
n.attrs = n.attrs.filter((a) => a !== t);
|
|
333
|
-
const
|
|
334
|
-
var
|
|
335
|
-
(
|
|
333
|
+
const l = (a, c, h) => {
|
|
334
|
+
var u;
|
|
335
|
+
(u = n.attrs) == null || u.push({ key: a, value: c, role: h, loc: s });
|
|
336
336
|
};
|
|
337
337
|
if (r === "input") {
|
|
338
|
-
if (
|
|
339
|
-
const a = n.attrs.find((
|
|
340
|
-
|
|
341
|
-
const
|
|
342
|
-
const _v = ${
|
|
338
|
+
if (i === "checkbox") {
|
|
339
|
+
const a = n.attrs.find((p) => p.key === "value"), c = a ? JSON.stringify(a.value) : '"on"', h = `Array.isArray(${e}) ? ${e}.includes(${c}) : ${e}`;
|
|
340
|
+
l(":checked", h);
|
|
341
|
+
const u = `
|
|
342
|
+
const _v = ${c};
|
|
343
343
|
if(Array.isArray(${e})) {
|
|
344
344
|
const _i = ${e}.indexOf(_v);
|
|
345
345
|
if(checked && _i === -1) ${e}.push(_v);
|
|
@@ -347,135 +347,135 @@ function Ee(n) {
|
|
|
347
347
|
} else {
|
|
348
348
|
${e} = checked;
|
|
349
349
|
}`;
|
|
350
|
-
|
|
350
|
+
l("@change", u, "model");
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
353
|
-
if (
|
|
354
|
-
const a = n.attrs.find((
|
|
355
|
-
|
|
353
|
+
if (i === "radio") {
|
|
354
|
+
const a = n.attrs.find((h) => h.key === "value"), c = (a == null ? void 0 : a.value) ?? "null";
|
|
355
|
+
l(":checked", `${e} == ${JSON.stringify(c)}`), l("@change", `if (checked) ${e} = ${JSON.stringify(c)}`, "model");
|
|
356
356
|
return;
|
|
357
357
|
}
|
|
358
|
-
|
|
358
|
+
l(":value", e), l("@input", `${e} = value`, "model");
|
|
359
359
|
return;
|
|
360
360
|
}
|
|
361
361
|
if (r === "textarea") {
|
|
362
|
-
|
|
362
|
+
l(":value", e), l("@input", `${e} = value`, "model");
|
|
363
363
|
return;
|
|
364
364
|
}
|
|
365
365
|
if (r === "select") {
|
|
366
|
-
n.attrs.some((
|
|
366
|
+
n.attrs.some((c) => c.key === "multiple") ? (l("updated", `
|
|
367
367
|
const values = Array.isArray(${e}) ? ${e} : ${e} != null ? [${e}] : [];
|
|
368
368
|
for (const opt of el.options) {
|
|
369
369
|
opt.selected = values.includes(opt.value);
|
|
370
|
-
}`),
|
|
370
|
+
}`), l("@change", `${e} = Array.from(event.target.selectedOptions).map(o => o.value)`, "model")) : (l(":value", e), l("@change", `${e} = value`, "model"));
|
|
371
371
|
return;
|
|
372
372
|
}
|
|
373
|
-
|
|
373
|
+
l(":value", e), l("@input", `${e} = $event`, "model");
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function ot(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:
|
|
381
|
-
if (
|
|
382
|
-
const
|
|
383
|
-
|
|
378
|
+
for (const o of n.attrs) {
|
|
379
|
+
if (s && s.has(o.key)) continue;
|
|
380
|
+
const { key: i, value: l, role: a } = o, { isDynamic: c, type: h } = qt(i);
|
|
381
|
+
if (c && h) {
|
|
382
|
+
const u = e.compile(h, l ?? "", t), p = { key: i, fid: u, dynamic: 1, role: a };
|
|
383
|
+
Et(p, l, o.loc ?? n.loc), r.push(p);
|
|
384
384
|
} else
|
|
385
|
-
r.push({ key:
|
|
385
|
+
r.push({ key: i, value: l, dynamic: 0, role: a });
|
|
386
386
|
}
|
|
387
387
|
return r;
|
|
388
388
|
}
|
|
389
|
-
function
|
|
390
|
-
var
|
|
389
|
+
function Re(n, t, e) {
|
|
390
|
+
var o, i, l, a, c, h;
|
|
391
391
|
const s = { type: n.type, dynamic: 0 };
|
|
392
392
|
let r = !1;
|
|
393
|
-
switch (n.type ===
|
|
394
|
-
case
|
|
395
|
-
const
|
|
396
|
-
r ? (s.fid = e.compile("template",
|
|
393
|
+
switch (n.type === w.Text ? ke(n.content) && (r = !0) : ((o = n.attrs) != null && o.some((u) => u.key === "s-model" || qt(u.key).isDynamic) && (r = !0), n.type === w.For && (r = !0)), s.dynamic = r ? 1 : 0, n.type) {
|
|
394
|
+
case w.Text: {
|
|
395
|
+
const u = n.content ?? "";
|
|
396
|
+
r ? (s.fid = e.compile("template", u, t), Et(s, u, n.loc)) : s.txt = u;
|
|
397
397
|
break;
|
|
398
398
|
}
|
|
399
|
-
case
|
|
400
|
-
s.tag = n.tag,
|
|
399
|
+
case w.Element: {
|
|
400
|
+
s.tag = n.tag, Ce(n), s.attrs = ot(n, t, e), n.children && (s.children = X(n.children, t, e));
|
|
401
401
|
break;
|
|
402
402
|
}
|
|
403
|
-
case
|
|
404
|
-
const
|
|
405
|
-
s.fid = e.compile("expression",
|
|
406
|
-
const
|
|
407
|
-
s.attrs =
|
|
408
|
-
const
|
|
409
|
-
n.children && (s.children =
|
|
403
|
+
case w.For: {
|
|
404
|
+
const u = (i = n.attrs) == null ? void 0 : i.find((d) => d.key === "each"), p = (u == null ? void 0 : u.value) ?? "";
|
|
405
|
+
s.fid = e.compile("expression", p, t), s.item = ((a = (l = n.attrs) == null ? void 0 : l.find((d) => d.key === "item")) == null ? void 0 : a.value) ?? "item", s.index = ((h = (c = n.attrs) == null ? void 0 : c.find((d) => d.key === "index")) == null ? void 0 : h.value) ?? "index", Et(s, p, (u == null ? void 0 : u.loc) ?? n.loc);
|
|
406
|
+
const v = /* @__PURE__ */ new Set(["each", "item", "index"]);
|
|
407
|
+
s.attrs = ot(n, t, e, v);
|
|
408
|
+
const f = [...t, { item: s.item, index: s.index }];
|
|
409
|
+
n.children && (s.children = X(n.children, f, e));
|
|
410
410
|
break;
|
|
411
411
|
}
|
|
412
|
-
case
|
|
413
|
-
case
|
|
414
|
-
case
|
|
415
|
-
|
|
412
|
+
case w.If:
|
|
413
|
+
case w.ElseIf:
|
|
414
|
+
case w.Else: {
|
|
415
|
+
Y && console.warn(`[IR] Orphaned conditional node found: ${w[n.type]}`), s.attrs = ot(n, t, e), n.children && (s.children = X(n.children, t, e));
|
|
416
416
|
break;
|
|
417
417
|
}
|
|
418
|
-
case
|
|
418
|
+
case w.Comment: {
|
|
419
419
|
s.txt = n.content ?? "";
|
|
420
420
|
break;
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
return s;
|
|
424
424
|
}
|
|
425
|
-
function
|
|
426
|
-
var
|
|
425
|
+
function X(n, t, e) {
|
|
426
|
+
var o;
|
|
427
427
|
const s = [];
|
|
428
428
|
let r = 0;
|
|
429
429
|
for (; r < n.length; ) {
|
|
430
|
-
const
|
|
431
|
-
if (
|
|
432
|
-
const
|
|
430
|
+
const i = n[r];
|
|
431
|
+
if (i.type === w.If) {
|
|
432
|
+
const l = [];
|
|
433
433
|
let a = r;
|
|
434
434
|
for (; a < n.length; ) {
|
|
435
|
-
const
|
|
436
|
-
if (
|
|
435
|
+
const c = n[a], h = c.type;
|
|
436
|
+
if (h !== w.If && h !== w.ElseIf && h !== w.Else || h === w.If && l.length > 0)
|
|
437
437
|
break;
|
|
438
|
-
let
|
|
439
|
-
if (
|
|
440
|
-
const
|
|
441
|
-
(
|
|
438
|
+
let u = null, p = "", v = null;
|
|
439
|
+
if (h !== w.Else) {
|
|
440
|
+
const m = (o = c.attrs) == null ? void 0 : o.find(
|
|
441
|
+
(y) => y.key === "test" || y.key === "condition"
|
|
442
442
|
);
|
|
443
|
-
|
|
443
|
+
p = (m == null ? void 0 : m.value) ?? "false", u = e.compile("expression", p, t), v = (m == null ? void 0 : m.loc) ?? c.loc;
|
|
444
444
|
}
|
|
445
|
-
const
|
|
446
|
-
if (
|
|
447
|
-
condFid:
|
|
448
|
-
children:
|
|
449
|
-
attrs:
|
|
450
|
-
[
|
|
451
|
-
}), a++,
|
|
445
|
+
const f = c.children ? X(c.children, t, e) : [], $ = ot(c, t, e, /* @__PURE__ */ new Set(["test", "condition"]));
|
|
446
|
+
if (l.push({
|
|
447
|
+
condFid: u,
|
|
448
|
+
children: f,
|
|
449
|
+
attrs: $.length > 0 ? $ : void 0,
|
|
450
|
+
[wt]: Y ? { expr: p, loc: v } : void 0
|
|
451
|
+
}), a++, h === w.Else) break;
|
|
452
452
|
}
|
|
453
453
|
s.push({
|
|
454
|
-
type:
|
|
454
|
+
type: w.Conditional,
|
|
455
455
|
dynamic: 1,
|
|
456
|
-
branches:
|
|
457
|
-
...
|
|
456
|
+
branches: l,
|
|
457
|
+
...Y && { [wt]: { loc: i.loc } }
|
|
458
458
|
}), r = a;
|
|
459
459
|
} else
|
|
460
|
-
s.push(
|
|
460
|
+
s.push(Re(i, t, e)), r++;
|
|
461
461
|
}
|
|
462
462
|
return s;
|
|
463
463
|
}
|
|
464
|
-
function
|
|
465
|
-
const { filename: e = "anonymous", source: s } = t, r =
|
|
464
|
+
function Ae(n, t = {}) {
|
|
465
|
+
const { filename: e = "anonymous", source: s } = t, r = Gt.get(e);
|
|
466
466
|
r.clear();
|
|
467
|
-
const
|
|
467
|
+
const o = performance.now(), i = X(n, [], r), l = performance.now(), a = r.getStats(), c = i.filter((u) => u.dynamic === 1).length, h = {
|
|
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: i,
|
|
474
474
|
stats: {
|
|
475
475
|
totalFunctions: a.total,
|
|
476
476
|
cachedFunctions: a.cached,
|
|
477
|
-
dynamicNodes:
|
|
478
|
-
totalNodes:
|
|
477
|
+
dynamicNodes: c,
|
|
478
|
+
totalNodes: i.length
|
|
479
479
|
},
|
|
480
480
|
metadata: {
|
|
481
481
|
compiledAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -484,14 +484,14 @@ function xe(n, t = {}) {
|
|
|
484
484
|
...s && { source: s }
|
|
485
485
|
}
|
|
486
486
|
};
|
|
487
|
-
return
|
|
488
|
-
`[IRBuilder] ${e} | ${(
|
|
489
|
-
),
|
|
487
|
+
return Y && console.log(
|
|
488
|
+
`[IRBuilder] ${e} | ${(l - o).toFixed(2)}ms | Nodes: ${i.length} | Fns: ${a.total}`
|
|
489
|
+
), h;
|
|
490
490
|
}
|
|
491
|
-
function
|
|
492
|
-
|
|
491
|
+
function an(n) {
|
|
492
|
+
Gt.clear(n);
|
|
493
493
|
}
|
|
494
|
-
const
|
|
494
|
+
const Le = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, Ie = /* @__PURE__ */ new Set([
|
|
495
495
|
"area",
|
|
496
496
|
"base",
|
|
497
497
|
"br",
|
|
@@ -506,457 +506,496 @@ const $e = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, Se = /* @__PURE__ */ new Set
|
|
|
506
506
|
"source",
|
|
507
507
|
"track",
|
|
508
508
|
"wbr"
|
|
509
|
-
]),
|
|
510
|
-
function
|
|
509
|
+
]), Me = /\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;
|
|
510
|
+
function Pe(n, t) {
|
|
511
511
|
const e = [];
|
|
512
512
|
let s;
|
|
513
|
-
const r = n.replace(/^\s*[^\s"'/>]+/, ""),
|
|
514
|
-
for (; (s =
|
|
515
|
-
const
|
|
516
|
-
if (!
|
|
517
|
-
const
|
|
518
|
-
let a =
|
|
519
|
-
|
|
520
|
-
const
|
|
521
|
-
let
|
|
522
|
-
if (
|
|
523
|
-
|
|
513
|
+
const r = n.replace(/^\s*[^\s"'/>]+/, ""), o = n.length - r.length;
|
|
514
|
+
for (; (s = Me.exec(r)) !== null; ) {
|
|
515
|
+
const i = s[1];
|
|
516
|
+
if (!i) continue;
|
|
517
|
+
const l = s[2] ?? s[3] ?? s[4] ?? "";
|
|
518
|
+
let a = i;
|
|
519
|
+
be.has(i) && (a = a.replace(/^on/, "@")), a !== "s-model" && (a = a.replace(/^on-/, "@").replace(/^s-/, ":")), a = Ee(a) || a;
|
|
520
|
+
const c = s[0], h = c.indexOf("=");
|
|
521
|
+
let u;
|
|
522
|
+
if (h === -1)
|
|
523
|
+
u = c.indexOf(i) + i.length;
|
|
524
524
|
else {
|
|
525
|
-
let
|
|
526
|
-
for (;
|
|
527
|
-
if (
|
|
528
|
-
let
|
|
529
|
-
for (;
|
|
530
|
-
|
|
531
|
-
|
|
525
|
+
let m = h + 1;
|
|
526
|
+
for (; m < c.length && /\s/.test(c[m]); ) m++;
|
|
527
|
+
if (c[m] === '"' || c[m] === "'") {
|
|
528
|
+
let y = m + 1;
|
|
529
|
+
for (; y < c.length && /\s/.test(c[y]); )
|
|
530
|
+
y++;
|
|
531
|
+
u = y;
|
|
532
532
|
} else {
|
|
533
|
-
let
|
|
534
|
-
for (;
|
|
535
|
-
|
|
533
|
+
let y = m;
|
|
534
|
+
for (; y < c.length && /\s/.test(c[y]); ) y++;
|
|
535
|
+
u = y;
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
let
|
|
539
|
-
const
|
|
540
|
-
`),
|
|
541
|
-
e.push({ key: a, value:
|
|
538
|
+
let p = s.index + u + o;
|
|
539
|
+
const f = n.slice(0, p).split(`
|
|
540
|
+
`), d = t[0] + f.length - 1, $ = f.length > 1 ? f[f.length - 1].length + 1 : t[1] + p;
|
|
541
|
+
e.push({ key: a, value: l, loc: [d, $] });
|
|
542
542
|
}
|
|
543
543
|
return e;
|
|
544
544
|
}
|
|
545
|
-
function
|
|
546
|
-
var
|
|
547
|
-
const e = ((
|
|
545
|
+
function Oe(n, t) {
|
|
546
|
+
var i;
|
|
547
|
+
const e = ((i = (n.match(Le) || [])[1]) == null ? void 0 : i.toLowerCase()) ?? "", s = Pe(n, t);
|
|
548
548
|
return {
|
|
549
549
|
type: {
|
|
550
|
-
for:
|
|
551
|
-
if:
|
|
552
|
-
elseif:
|
|
553
|
-
else:
|
|
554
|
-
}[e] ??
|
|
550
|
+
for: w.For,
|
|
551
|
+
if: w.If,
|
|
552
|
+
elseif: w.ElseIf,
|
|
553
|
+
else: w.Else
|
|
554
|
+
}[e] ?? w.Element,
|
|
555
555
|
tag: e,
|
|
556
556
|
loc: t,
|
|
557
557
|
children: [],
|
|
558
558
|
attrs: s
|
|
559
559
|
};
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function Ne(n, t) {
|
|
562
562
|
const e = n.length;
|
|
563
563
|
if (n.startsWith("!--", t)) {
|
|
564
|
-
const
|
|
565
|
-
return
|
|
564
|
+
const i = n.indexOf("-->", t + 3);
|
|
565
|
+
return i === -1 ? -1 : i + 2;
|
|
566
566
|
}
|
|
567
567
|
if (n.startsWith("![CDATA[", t)) {
|
|
568
|
-
const
|
|
569
|
-
return
|
|
568
|
+
const i = n.indexOf("]]>", t + 8);
|
|
569
|
+
return i === -1 ? -1 : i + 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 i = n.indexOf("?>", t + 1);
|
|
575
|
+
return i === -1 ? -1 : i + 1;
|
|
576
576
|
}
|
|
577
|
-
let s = !1, r = !1,
|
|
578
|
-
for (;
|
|
579
|
-
const
|
|
580
|
-
if (
|
|
577
|
+
let s = !1, r = !1, o = t;
|
|
578
|
+
for (; o < e; ) {
|
|
579
|
+
const i = n[o];
|
|
580
|
+
if (i === "'" && !r)
|
|
581
581
|
s = !s;
|
|
582
|
-
else if (
|
|
582
|
+
else if (i === '"' && !s)
|
|
583
583
|
r = !r;
|
|
584
|
-
else if (
|
|
585
|
-
return
|
|
586
|
-
|
|
584
|
+
else if (i === ">" && !s && !r)
|
|
585
|
+
return o;
|
|
586
|
+
o++;
|
|
587
587
|
}
|
|
588
588
|
return -1;
|
|
589
589
|
}
|
|
590
|
-
function
|
|
590
|
+
function _e(n) {
|
|
591
591
|
const t = [];
|
|
592
592
|
if (!n) return [];
|
|
593
593
|
const e = [], s = [], r = () => {
|
|
594
|
-
var
|
|
595
|
-
return e.length === 0 ? t : (
|
|
594
|
+
var c;
|
|
595
|
+
return e.length === 0 ? t : (c = e[e.length - 1]).children || (c.children = []);
|
|
596
596
|
};
|
|
597
|
-
let
|
|
598
|
-
const
|
|
599
|
-
for (let
|
|
600
|
-
` &&
|
|
601
|
-
function a(
|
|
602
|
-
let
|
|
603
|
-
for (let
|
|
604
|
-
|
|
605
|
-
return [
|
|
606
|
-
}
|
|
607
|
-
for (;
|
|
608
|
-
const
|
|
609
|
-
if (
|
|
610
|
-
const
|
|
611
|
-
if (
|
|
612
|
-
const
|
|
597
|
+
let o = 0;
|
|
598
|
+
const i = n.length, l = [0];
|
|
599
|
+
for (let c = 0; c < i; c++) n[c] === `
|
|
600
|
+
` && l.push(c + 1);
|
|
601
|
+
function a(c) {
|
|
602
|
+
let h = 0;
|
|
603
|
+
for (let u = 1; u < l.length && !(l[u] > c); u++)
|
|
604
|
+
h = u;
|
|
605
|
+
return [h + 1, c - l[h] + 1];
|
|
606
|
+
}
|
|
607
|
+
for (; o < i; ) {
|
|
608
|
+
const c = n.indexOf("<", o);
|
|
609
|
+
if (c === -1 || c > o) {
|
|
610
|
+
const g = n.substring(o, c === -1 ? void 0 : c), b = g.trim();
|
|
611
|
+
if (b) {
|
|
612
|
+
const E = g.indexOf(b), x = o + E, R = a(x);
|
|
613
613
|
r().push({
|
|
614
|
-
type:
|
|
614
|
+
type: w.Text,
|
|
615
615
|
tag: "text",
|
|
616
|
-
content:
|
|
617
|
-
loc:
|
|
616
|
+
content: b,
|
|
617
|
+
loc: R,
|
|
618
618
|
children: []
|
|
619
619
|
});
|
|
620
620
|
}
|
|
621
|
-
if (
|
|
622
|
-
|
|
621
|
+
if (c === -1) break;
|
|
622
|
+
o = c;
|
|
623
623
|
}
|
|
624
|
-
const
|
|
625
|
-
if (
|
|
626
|
-
const
|
|
627
|
-
|
|
628
|
-
type:
|
|
624
|
+
const h = Ne(n, o + 1);
|
|
625
|
+
if (h === -1) {
|
|
626
|
+
const g = n.substring(o);
|
|
627
|
+
g.trim() && r().push({
|
|
628
|
+
type: w.Text,
|
|
629
629
|
tag: "text",
|
|
630
|
-
content:
|
|
630
|
+
content: g.trim(),
|
|
631
631
|
children: [],
|
|
632
|
-
loc: a(
|
|
632
|
+
loc: a(o)
|
|
633
633
|
});
|
|
634
634
|
break;
|
|
635
635
|
}
|
|
636
|
-
const
|
|
637
|
-
if (
|
|
638
|
-
|
|
639
|
-
type:
|
|
636
|
+
const u = n.substring(o, h + 1), p = r(), v = a(o);
|
|
637
|
+
if (u.startsWith("<!--")) {
|
|
638
|
+
p.push({
|
|
639
|
+
type: w.Comment,
|
|
640
640
|
tag: "comment",
|
|
641
|
-
content:
|
|
642
|
-
loc:
|
|
641
|
+
content: u.slice(4, -3),
|
|
642
|
+
loc: v,
|
|
643
643
|
children: []
|
|
644
|
-
}),
|
|
644
|
+
}), o = h + 1;
|
|
645
645
|
continue;
|
|
646
646
|
}
|
|
647
|
-
if (
|
|
648
|
-
|
|
649
|
-
type:
|
|
647
|
+
if (u.startsWith("<![CDATA[")) {
|
|
648
|
+
p.push({
|
|
649
|
+
type: w.Text,
|
|
650
650
|
tag: "text",
|
|
651
|
-
content:
|
|
652
|
-
loc:
|
|
651
|
+
content: u.slice(9, -3),
|
|
652
|
+
loc: v,
|
|
653
653
|
children: []
|
|
654
|
-
}),
|
|
654
|
+
}), o = h + 1;
|
|
655
655
|
continue;
|
|
656
656
|
}
|
|
657
|
-
if (
|
|
658
|
-
|
|
659
|
-
type:
|
|
657
|
+
if (u.startsWith("<!") && !u.startsWith("<!--")) {
|
|
658
|
+
p.push({
|
|
659
|
+
type: w.Comment,
|
|
660
660
|
tag: "comment",
|
|
661
|
-
content:
|
|
662
|
-
loc:
|
|
661
|
+
content: u.slice(2, -1),
|
|
662
|
+
loc: v,
|
|
663
663
|
children: []
|
|
664
|
-
}),
|
|
664
|
+
}), o = h + 1;
|
|
665
665
|
continue;
|
|
666
666
|
}
|
|
667
|
-
if (
|
|
668
|
-
|
|
669
|
-
type:
|
|
667
|
+
if (u.startsWith("<?")) {
|
|
668
|
+
p.push({
|
|
669
|
+
type: w.Comment,
|
|
670
670
|
tag: "comment",
|
|
671
|
-
content:
|
|
672
|
-
loc:
|
|
671
|
+
content: u.slice(2, -2),
|
|
672
|
+
loc: v,
|
|
673
673
|
children: []
|
|
674
|
-
}),
|
|
674
|
+
}), o = h + 1;
|
|
675
675
|
continue;
|
|
676
676
|
}
|
|
677
|
-
if (
|
|
678
|
-
const
|
|
677
|
+
if (u.startsWith("</")) {
|
|
678
|
+
const g = s.pop();
|
|
679
679
|
for (; e.length > 0; ) {
|
|
680
|
-
if ((e[e.length - 1].tag || "").toLowerCase() === (
|
|
680
|
+
if ((e[e.length - 1].tag || "").toLowerCase() === (g == null ? void 0 : g.toLowerCase())) {
|
|
681
681
|
e.pop();
|
|
682
682
|
break;
|
|
683
683
|
}
|
|
684
684
|
e.pop();
|
|
685
685
|
}
|
|
686
|
-
|
|
686
|
+
o = h + 1;
|
|
687
687
|
continue;
|
|
688
688
|
}
|
|
689
|
-
const
|
|
690
|
-
|
|
691
|
-
const
|
|
692
|
-
if ((
|
|
693
|
-
const
|
|
694
|
-
if (
|
|
695
|
-
const
|
|
696
|
-
|
|
697
|
-
type:
|
|
689
|
+
const f = Oe(u, v);
|
|
690
|
+
p.push(f);
|
|
691
|
+
const d = f.tag || "", $ = d.toLowerCase().startsWith("script"), m = d.toLowerCase().startsWith("style"), y = u.endsWith("/>") || Ie.has(d.toLowerCase());
|
|
692
|
+
if (($ || m) && !y) {
|
|
693
|
+
const g = `</${d}>`, b = n.toLowerCase().indexOf(g, h + 1);
|
|
694
|
+
if (b !== -1) {
|
|
695
|
+
const E = n.substring(h + 1, b);
|
|
696
|
+
E.length && f.children.push({
|
|
697
|
+
type: w.Text,
|
|
698
698
|
tag: "text",
|
|
699
|
-
content:
|
|
700
|
-
loc: a(
|
|
699
|
+
content: E,
|
|
700
|
+
loc: a(h + 1),
|
|
701
701
|
children: []
|
|
702
|
-
}),
|
|
702
|
+
}), o = b + g.length;
|
|
703
703
|
continue;
|
|
704
704
|
} else {
|
|
705
|
-
const
|
|
706
|
-
|
|
707
|
-
type:
|
|
705
|
+
const E = n.substring(h + 1);
|
|
706
|
+
E.length && f.children.push({
|
|
707
|
+
type: w.Text,
|
|
708
708
|
tag: "text",
|
|
709
|
-
content:
|
|
710
|
-
loc: a(
|
|
709
|
+
content: E,
|
|
710
|
+
loc: a(h + 1),
|
|
711
711
|
children: []
|
|
712
|
-
}),
|
|
712
|
+
}), o = i;
|
|
713
713
|
continue;
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
|
-
!
|
|
716
|
+
!y && f.type !== w.Text && f.type !== w.Comment && (e.push(f), s.push(d)), o = h + 1;
|
|
717
717
|
}
|
|
718
718
|
return t;
|
|
719
719
|
}
|
|
720
|
-
const
|
|
721
|
-
function
|
|
722
|
-
|
|
723
|
-
|
|
720
|
+
const ct = Symbol("solely.raw"), F = /* @__PURE__ */ new WeakMap(), Tt = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakMap(), Wt = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap();
|
|
721
|
+
function Te(n) {
|
|
722
|
+
if (n && typeof n == "object") {
|
|
723
|
+
const t = n[ct];
|
|
724
|
+
if (t) return t;
|
|
725
|
+
}
|
|
726
|
+
return n;
|
|
724
727
|
}
|
|
725
|
-
|
|
726
|
-
|
|
728
|
+
const Dt = (n) => !n || typeof n != "object" ? !1 : n instanceof File || n instanceof Blob || n instanceof FormData || n instanceof ArrayBuffer || n instanceof Response || n instanceof Request;
|
|
729
|
+
function We(n) {
|
|
730
|
+
return !!(n && n[ct]);
|
|
727
731
|
}
|
|
728
|
-
const
|
|
732
|
+
const vt = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
|
|
729
733
|
if (n === t) return !0;
|
|
730
734
|
if (n == null || t == null || typeof n != "object" || typeof t != "object") return n === t;
|
|
731
|
-
if (Array.isArray(n)
|
|
735
|
+
if (Array.isArray(n) !== Array.isArray(t)) return !1;
|
|
736
|
+
if (e.has(n))
|
|
737
|
+
return e.get(n) === t;
|
|
738
|
+
if (e.set(n, t), Array.isArray(n) && Array.isArray(t)) {
|
|
732
739
|
if (n.length !== t.length) return !1;
|
|
733
|
-
if (e.has(n)) return e.get(n) === t;
|
|
734
|
-
e.set(n, t);
|
|
735
740
|
for (let r = 0; r < n.length; r++)
|
|
736
|
-
if (
|
|
741
|
+
if (!vt(n[r], t[r], e)) return !1;
|
|
737
742
|
return !0;
|
|
738
743
|
}
|
|
739
|
-
if (Array.isArray(n) !== Array.isArray(t)) return !1;
|
|
740
|
-
if (e.has(n)) return e.get(n) === t;
|
|
741
|
-
e.set(n, t);
|
|
742
744
|
const s = Reflect.ownKeys(n);
|
|
743
745
|
if (s.length !== Reflect.ownKeys(t).length) return !1;
|
|
744
|
-
for (const r of s)
|
|
745
|
-
if (!Reflect.has(t, r)
|
|
746
|
+
for (const r of s) {
|
|
747
|
+
if (!Reflect.has(t, r)) return !1;
|
|
748
|
+
const o = n[r], i = t[r];
|
|
749
|
+
if (!vt(o, i, e)) return !1;
|
|
750
|
+
}
|
|
746
751
|
return !0;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
if (
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
752
|
+
}, Ft = (n) => {
|
|
753
|
+
const t = [];
|
|
754
|
+
let e = n;
|
|
755
|
+
for (; e; ) {
|
|
756
|
+
const s = At.get(e);
|
|
757
|
+
if (!s || s.key == null) break;
|
|
758
|
+
t.unshift(s.key), e = s.parent;
|
|
759
|
+
}
|
|
760
|
+
return t;
|
|
761
|
+
}, De = (n) => n.map((t) => {
|
|
762
|
+
if (t === "") return /^.*$/;
|
|
763
|
+
const e = t.replace(/\./g, "\\.").replace(/\*\*/g, "(.+)").replace(/\*/g, "[^.]+").replace(/\[\d+\]/g, "\\[\\d+\\]");
|
|
764
|
+
return new RegExp(`^${e}$`);
|
|
765
|
+
}), Fe = (n, t) => {
|
|
766
|
+
if (t.length === 0) return !0;
|
|
767
|
+
const e = n.map(String).join(".");
|
|
768
|
+
return t.some((s) => s.test(e));
|
|
769
|
+
}, N = (n, t) => {
|
|
770
|
+
const e = Ft(n);
|
|
771
|
+
let s = n;
|
|
772
|
+
for (; s; ) {
|
|
773
|
+
const r = F.get(s);
|
|
774
|
+
r && r.forEach((i) => {
|
|
775
|
+
var h;
|
|
776
|
+
if (!i.active) return;
|
|
777
|
+
const l = Ft(s), a = [...l, ...e.slice(l.length)];
|
|
778
|
+
if (!Fe(a, i.filterRegexes)) return;
|
|
779
|
+
const c = { ...t, path: a };
|
|
780
|
+
i.throttle > 0 ? (i.pending.push(c), i.timer || (i.timer = setTimeout(() => {
|
|
781
|
+
var p;
|
|
782
|
+
if (!i.active) return;
|
|
783
|
+
const u = [...i.pending];
|
|
784
|
+
i.pending = [], i.timer = null, u.length > 0 && ((p = i.onBatch) == null || p.call(i, u), u.forEach((v) => i.callback(v)));
|
|
785
|
+
}, i.throttle))) : ((h = i.onBatch) == null || h.call(i, [c]), i.callback(c));
|
|
758
786
|
});
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
s > 0 ? (l.push(b), a || (a = setTimeout(() => {
|
|
774
|
-
const L = [...l];
|
|
775
|
-
l = [], a = null, c && (r == null || r(L), L.forEach(t));
|
|
776
|
-
}, s))) : (r == null || r([b]), t(b));
|
|
777
|
-
}, v = (f, w) => {
|
|
787
|
+
const o = At.get(s);
|
|
788
|
+
s = (o == null ? void 0 : o.parent) || null;
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
function Ve(n, t, e = {}) {
|
|
792
|
+
const { throttle: s = 0, onBatch: r, immediate: o = !1, deepCompare: i = !1 } = e, l = Array.isArray(e.filter) ? e.filter : e.filter ? [e.filter] : [], a = De(l), c = {
|
|
793
|
+
callback: t,
|
|
794
|
+
onBatch: r,
|
|
795
|
+
throttle: s,
|
|
796
|
+
filterRegexes: a,
|
|
797
|
+
pending: [],
|
|
798
|
+
timer: null,
|
|
799
|
+
active: !0
|
|
800
|
+
}, h = (f, d) => {
|
|
778
801
|
const $ = {};
|
|
779
|
-
return ["push", "pop", "shift", "unshift", "splice"].forEach((
|
|
780
|
-
$[
|
|
781
|
-
|
|
782
|
-
const
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
else if (
|
|
788
|
-
|
|
789
|
-
else if (
|
|
790
|
-
|
|
791
|
-
else if (
|
|
792
|
-
|
|
793
|
-
|
|
802
|
+
return ["push", "pop", "shift", "unshift", "splice"].forEach((m) => {
|
|
803
|
+
$[m] = function(...y) {
|
|
804
|
+
if (!d) return;
|
|
805
|
+
const g = W.get(d) || 0;
|
|
806
|
+
W.set(d, g + 1);
|
|
807
|
+
const b = f[m].apply(f, y);
|
|
808
|
+
if (W.set(d, g), m === "push")
|
|
809
|
+
N(d, { type: "array-push", index: f.length - y.length, values: y });
|
|
810
|
+
else if (m === "unshift")
|
|
811
|
+
N(d, { type: "array-push", index: 0, values: y });
|
|
812
|
+
else if (m === "pop")
|
|
813
|
+
N(d, { type: "array-splice", index: f.length, deleteCount: 1, insert: [] });
|
|
814
|
+
else if (m === "shift")
|
|
815
|
+
N(d, { type: "array-splice", index: 0, deleteCount: 1, insert: [] });
|
|
816
|
+
else if (m === "splice") {
|
|
817
|
+
const [E, x, ...R] = y;
|
|
818
|
+
N(d, { type: "array-splice", index: E, deleteCount: x, insert: R });
|
|
794
819
|
}
|
|
795
|
-
return
|
|
820
|
+
return b;
|
|
796
821
|
};
|
|
797
|
-
}), ["sort", "reverse", "fill", "copyWithin"].forEach((
|
|
798
|
-
$[
|
|
799
|
-
|
|
800
|
-
const
|
|
801
|
-
|
|
822
|
+
}), ["sort", "reverse", "fill", "copyWithin"].forEach((m) => {
|
|
823
|
+
$[m] = function(...y) {
|
|
824
|
+
if (!d) return;
|
|
825
|
+
const g = W.get(d) || 0;
|
|
826
|
+
W.set(d, g + 1);
|
|
827
|
+
const b = f[m].apply(f, y);
|
|
828
|
+
return W.set(d, g), N(d, { type: "array-reset", method: m }), b;
|
|
802
829
|
};
|
|
803
|
-
}), ["indexOf", "lastIndexOf", "includes"].forEach((
|
|
804
|
-
$[
|
|
805
|
-
let
|
|
806
|
-
return (
|
|
830
|
+
}), ["indexOf", "lastIndexOf", "includes"].forEach((m) => {
|
|
831
|
+
$[m] = function(y, ...g) {
|
|
832
|
+
let b = f[m].apply(f, [y, ...g]);
|
|
833
|
+
return (b === -1 || b === !1) && We(y) && (b = f[m].apply(f, [Te(y), ...g])), b;
|
|
807
834
|
};
|
|
808
835
|
}), $;
|
|
809
|
-
},
|
|
810
|
-
if (!Object.isExtensible(f) || f[
|
|
836
|
+
}, u = (f, d, $) => {
|
|
837
|
+
if (!Object.isExtensible(f) || Dt(f) || f[ct])
|
|
811
838
|
return f;
|
|
812
|
-
const
|
|
813
|
-
if (
|
|
814
|
-
return
|
|
815
|
-
const
|
|
816
|
-
get(
|
|
817
|
-
if (
|
|
818
|
-
if (Array.isArray(
|
|
819
|
-
const
|
|
820
|
-
if (
|
|
821
|
-
return Reflect.get(
|
|
839
|
+
const m = Tt.get(f);
|
|
840
|
+
if (m)
|
|
841
|
+
return m;
|
|
842
|
+
const y = {
|
|
843
|
+
get(b, E, x) {
|
|
844
|
+
if (E === ct) return b;
|
|
845
|
+
if (Array.isArray(b)) {
|
|
846
|
+
const L = Wt.get(g);
|
|
847
|
+
if (L && Object.prototype.hasOwnProperty.call(L, E))
|
|
848
|
+
return Reflect.get(L, E, x);
|
|
822
849
|
}
|
|
823
|
-
const
|
|
824
|
-
return typeof
|
|
850
|
+
const R = Reflect.get(b, E, x);
|
|
851
|
+
return typeof E == "symbol" ? R : V(R) && !Dt(R) ? u(R, g, E) : R;
|
|
825
852
|
},
|
|
826
|
-
set(
|
|
827
|
-
const
|
|
828
|
-
if (
|
|
829
|
-
const
|
|
830
|
-
return
|
|
853
|
+
set(b, E, x, R) {
|
|
854
|
+
const L = b[E];
|
|
855
|
+
if (i ? vt(L, x) : L === x) return !0;
|
|
856
|
+
const et = Reflect.set(b, E, x, R);
|
|
857
|
+
return (W.get(g) || 0) === 0 && (Array.isArray(L) && Array.isArray(x) ? N(g, { type: "array-replace", oldValue: L, newValue: x }) : N(g, { type: "set", key: E, newValue: x, oldValue: L })), et;
|
|
831
858
|
},
|
|
832
|
-
deleteProperty(
|
|
833
|
-
if (!Reflect.has(
|
|
834
|
-
const
|
|
835
|
-
return
|
|
859
|
+
deleteProperty(b, E) {
|
|
860
|
+
if (!Reflect.has(b, E)) return !1;
|
|
861
|
+
const x = b[E], R = Reflect.deleteProperty(b, E), L = W.get(g) || 0;
|
|
862
|
+
return R && L === 0 && N(g, { type: "delete", key: E, oldValue: x }), R;
|
|
836
863
|
}
|
|
837
|
-
},
|
|
838
|
-
return
|
|
839
|
-
},
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
864
|
+
}, g = new Proxy(f, y);
|
|
865
|
+
return Tt.set(f, g), At.set(g, { parent: d, key: $ }), Array.isArray(f) && Wt.set(g, h(f, g)), g;
|
|
866
|
+
}, p = u(n, null, null);
|
|
867
|
+
let v = F.get(p);
|
|
868
|
+
if (v || (v = /* @__PURE__ */ new Set(), F.set(p, v)), v.add(c), o) {
|
|
869
|
+
const f = (d, $, m = /* @__PURE__ */ new WeakSet()) => {
|
|
870
|
+
!V(d) || m.has(d) || (m.add(d), Reflect.ownKeys(d).forEach((y) => {
|
|
871
|
+
const g = d[y];
|
|
872
|
+
V(g) && m.has(g) || (N($, { type: "set", key: y, newValue: g, oldValue: void 0 }), V(g) && f(g, u(g, $, y), m));
|
|
845
873
|
}));
|
|
846
874
|
};
|
|
847
|
-
f(n,
|
|
875
|
+
f(n, p);
|
|
848
876
|
}
|
|
849
877
|
return {
|
|
850
|
-
proxy:
|
|
878
|
+
proxy: p,
|
|
851
879
|
unobserve: () => {
|
|
852
|
-
c = !1,
|
|
880
|
+
c.active = !1, c.pending = [], c.timer && (clearTimeout(c.timer), c.timer = null);
|
|
881
|
+
const f = F.get(p);
|
|
882
|
+
f && f.delete(c);
|
|
853
883
|
},
|
|
854
884
|
resume: () => {
|
|
855
|
-
c
|
|
885
|
+
if (c.active) return;
|
|
886
|
+
c.active = !0;
|
|
887
|
+
let f = F.get(p);
|
|
888
|
+
f || (f = /* @__PURE__ */ new Set(), F.set(p, f)), f.has(c) || f.add(c);
|
|
889
|
+
},
|
|
890
|
+
dispose: () => {
|
|
891
|
+
c.active = !1, c.pending = [], c.timer && (clearTimeout(c.timer), c.timer = null);
|
|
892
|
+
const f = F.get(p);
|
|
893
|
+
f && f.delete(c), c.callback = () => {
|
|
894
|
+
}, c.onBatch = void 0;
|
|
856
895
|
}
|
|
857
896
|
};
|
|
858
897
|
}
|
|
859
|
-
const
|
|
898
|
+
const rt = Symbol("solely.irCtx"), it = Symbol("solely.irEvents"), O = Symbol.for("solely.irMeta"), gt = Symbol("solely.prevClassObj"), yt = Symbol("solely.prevStyleObj"), Be = {
|
|
860
899
|
xml: "http://www.w3.org/XML/1998/namespace",
|
|
861
900
|
xlink: "http://www.w3.org/1999/xlink",
|
|
862
901
|
xmlns: "http://www.w3.org/2000/xmlns/"
|
|
863
|
-
},
|
|
902
|
+
}, Vt = {
|
|
864
903
|
readonly: "readOnly",
|
|
865
904
|
for: "htmlFor",
|
|
866
905
|
tabindex: "tabIndex",
|
|
867
906
|
contenteditable: "contentEditable",
|
|
868
907
|
maxlength: "maxLength"
|
|
869
|
-
},
|
|
908
|
+
}, je = /* @__PURE__ */ new Set(["data-", "aria-", "role", "form"]), Ge = /* @__PURE__ */ new Set([
|
|
870
909
|
"value",
|
|
871
910
|
"selectedIndex"
|
|
872
911
|
]);
|
|
873
|
-
function
|
|
912
|
+
function qe(n, t) {
|
|
874
913
|
var s;
|
|
875
914
|
const e = (s = t.attrs) == null ? void 0 : s.find((r) => r.key === "class" && !r.dynamic);
|
|
876
915
|
e != null && e.value && n.setAttribute("class", e.value);
|
|
877
916
|
}
|
|
878
|
-
function
|
|
879
|
-
var
|
|
917
|
+
function ze(n, t) {
|
|
918
|
+
var o;
|
|
880
919
|
if (!n.style) return;
|
|
881
|
-
const s = (
|
|
882
|
-
for (const
|
|
883
|
-
const
|
|
884
|
-
|
|
920
|
+
const s = (o = t.attrs) == null ? void 0 : o.find((i) => i.key === "style" && !i.dynamic), r = s ? zt(s.value) : {};
|
|
921
|
+
for (const i in r) {
|
|
922
|
+
const l = r[i];
|
|
923
|
+
i.startsWith("--") ? n.style.setProperty(i, l) : n.style[i] = l;
|
|
885
924
|
}
|
|
886
925
|
}
|
|
887
|
-
const
|
|
888
|
-
const e = n, s =
|
|
926
|
+
const Ue = (n, t) => {
|
|
927
|
+
const e = n, s = zt(t), r = e[yt];
|
|
889
928
|
if (!r) {
|
|
890
|
-
for (const
|
|
891
|
-
const
|
|
892
|
-
|
|
929
|
+
for (const i in s) {
|
|
930
|
+
const l = s[i];
|
|
931
|
+
i.startsWith("--") ? n.style.setProperty(i, l) : n.style[i] = l;
|
|
893
932
|
}
|
|
894
|
-
e[
|
|
933
|
+
e[yt] = s;
|
|
895
934
|
return;
|
|
896
935
|
}
|
|
897
|
-
let
|
|
898
|
-
for (const
|
|
899
|
-
|
|
900
|
-
for (const
|
|
901
|
-
const
|
|
902
|
-
|
|
936
|
+
let o = !1;
|
|
937
|
+
for (const i in r)
|
|
938
|
+
i in s || (i.startsWith("--") ? n.style.removeProperty(i) : n.style[i] = "", o = !0);
|
|
939
|
+
for (const i in s) {
|
|
940
|
+
const l = s[i], a = r[i];
|
|
941
|
+
l !== a && (i.startsWith("--") ? n.style.setProperty(i, l) : n.style[i] = l, o = !0);
|
|
903
942
|
}
|
|
904
|
-
|
|
905
|
-
},
|
|
906
|
-
const e = n, s = e[
|
|
943
|
+
o && (e[yt] = s);
|
|
944
|
+
}, Ke = (n, t) => {
|
|
945
|
+
const e = n, s = e[gt], r = He(t);
|
|
907
946
|
if (!s) {
|
|
908
|
-
for (const
|
|
909
|
-
n.classList.add(
|
|
910
|
-
e[
|
|
947
|
+
for (const i in r)
|
|
948
|
+
n.classList.add(i);
|
|
949
|
+
e[gt] = r;
|
|
911
950
|
return;
|
|
912
951
|
}
|
|
913
|
-
let
|
|
914
|
-
for (const
|
|
915
|
-
r[
|
|
916
|
-
for (const
|
|
917
|
-
s[
|
|
918
|
-
|
|
952
|
+
let o = !1;
|
|
953
|
+
for (const i in s)
|
|
954
|
+
r[i] || (n.classList.remove(i), o = !0);
|
|
955
|
+
for (const i in r)
|
|
956
|
+
s[i] || (n.classList.add(i), o = !0);
|
|
957
|
+
o && (e[gt] = r);
|
|
919
958
|
};
|
|
920
|
-
function
|
|
959
|
+
function zt(n) {
|
|
921
960
|
const t = {}, e = [[n]];
|
|
922
961
|
for (; e.length; ) {
|
|
923
962
|
const [s, r] = e.pop();
|
|
924
963
|
if (s) {
|
|
925
964
|
if (typeof s == "string") {
|
|
926
|
-
const
|
|
927
|
-
let
|
|
928
|
-
for (; (
|
|
929
|
-
const
|
|
930
|
-
|
|
965
|
+
const o = /([^:;]+)\s*:\s*([^;]*\(.*?\)[^;]*|[^;]+)/g;
|
|
966
|
+
let i;
|
|
967
|
+
for (; (i = o.exec(s)) !== null; ) {
|
|
968
|
+
const l = i[1].trim(), a = i[2].trim();
|
|
969
|
+
l && a && (t[l] = a);
|
|
931
970
|
}
|
|
932
971
|
continue;
|
|
933
972
|
}
|
|
934
973
|
if (Array.isArray(s)) {
|
|
935
|
-
for (let
|
|
936
|
-
e.push([s[
|
|
974
|
+
for (let o = s.length - 1; o >= 0; o--)
|
|
975
|
+
e.push([s[o]]);
|
|
937
976
|
continue;
|
|
938
977
|
}
|
|
939
978
|
if (typeof s == "object")
|
|
940
|
-
for (const
|
|
941
|
-
const
|
|
942
|
-
if (
|
|
943
|
-
const
|
|
944
|
-
typeof
|
|
979
|
+
for (const o in s) {
|
|
980
|
+
const i = s[o];
|
|
981
|
+
if (i == null) continue;
|
|
982
|
+
const l = r ? `${r}-${o}` : o;
|
|
983
|
+
typeof i == "object" && !Array.isArray(i) ? e.push([i, l]) : t[l] = String(i);
|
|
945
984
|
}
|
|
946
985
|
}
|
|
947
986
|
}
|
|
948
987
|
return t;
|
|
949
988
|
}
|
|
950
|
-
function
|
|
989
|
+
function He(n) {
|
|
951
990
|
const t = {}, e = [n];
|
|
952
991
|
for (; e.length; ) {
|
|
953
992
|
const s = e.pop();
|
|
954
993
|
if (s) {
|
|
955
994
|
if (typeof s == "string") {
|
|
956
995
|
const r = s.split(" ");
|
|
957
|
-
for (let
|
|
958
|
-
const
|
|
959
|
-
|
|
996
|
+
for (let o = 0; o < r.length; o++) {
|
|
997
|
+
const i = r[o].trim();
|
|
998
|
+
i && (t[i] = !0);
|
|
960
999
|
}
|
|
961
1000
|
} else if (Array.isArray(s))
|
|
962
1001
|
for (let r = s.length - 1; r >= 0; r--)
|
|
@@ -968,39 +1007,39 @@ function Ve(n) {
|
|
|
968
1007
|
}
|
|
969
1008
|
return t;
|
|
970
1009
|
}
|
|
971
|
-
function
|
|
1010
|
+
function $t(n, t, e) {
|
|
972
1011
|
const s = e == null ? "" : String(e), r = t.indexOf(":");
|
|
973
1012
|
if (r > 0) {
|
|
974
|
-
const
|
|
975
|
-
if (
|
|
976
|
-
n.getAttributeNS(
|
|
1013
|
+
const o = t.slice(0, r), i = Be[o];
|
|
1014
|
+
if (i) {
|
|
1015
|
+
n.getAttributeNS(i, t) !== s && n.setAttributeNS(i, t, s);
|
|
977
1016
|
return;
|
|
978
1017
|
}
|
|
979
1018
|
}
|
|
980
1019
|
n.getAttribute(t) !== s && n.setAttribute(t, s);
|
|
981
1020
|
}
|
|
982
|
-
function
|
|
983
|
-
const s =
|
|
984
|
-
if (t.startsWith("data-") || t.startsWith("aria-") ||
|
|
985
|
-
|
|
1021
|
+
function Bt(n, t, e) {
|
|
1022
|
+
const s = Vt[t] || t;
|
|
1023
|
+
if (t.startsWith("data-") || t.startsWith("aria-") || je.has(t)) {
|
|
1024
|
+
$t(n, t, e);
|
|
986
1025
|
return;
|
|
987
1026
|
}
|
|
988
|
-
const r = n,
|
|
1027
|
+
const r = n, o = r.tagName;
|
|
989
1028
|
if (e == null) {
|
|
990
1029
|
if (typeof r[s] == "boolean")
|
|
991
1030
|
r[s] !== !1 && (r[s] = !1);
|
|
992
1031
|
else {
|
|
993
|
-
const
|
|
994
|
-
|
|
1032
|
+
const l = r[s];
|
|
1033
|
+
l !== "" && l !== void 0 && (r[s] = ""), n.hasAttribute(t) && n.removeAttribute(t);
|
|
995
1034
|
}
|
|
996
1035
|
return;
|
|
997
1036
|
}
|
|
998
1037
|
if (s === "src" || s === "href") {
|
|
999
|
-
const
|
|
1000
|
-
if (r[s] ===
|
|
1038
|
+
const l = String(e);
|
|
1039
|
+
if (r[s] === l || n.getAttribute(s) === l)
|
|
1001
1040
|
return;
|
|
1002
1041
|
}
|
|
1003
|
-
if (s === "value" && (
|
|
1042
|
+
if (s === "value" && (o === "INPUT" || o === "TEXTAREA") && r.value === e)
|
|
1004
1043
|
return;
|
|
1005
1044
|
if (typeof e == "boolean") {
|
|
1006
1045
|
if (r[s] === e)
|
|
@@ -1008,21 +1047,21 @@ function _t(n, t, e) {
|
|
|
1008
1047
|
r[s] = e;
|
|
1009
1048
|
return;
|
|
1010
1049
|
}
|
|
1011
|
-
(n instanceof SVGElement || r.ownerSVGElement !== void 0) && !
|
|
1050
|
+
(n instanceof SVGElement || r.ownerSVGElement !== void 0) && !Vt[t] ? $t(n, t, e) : r[s] !== e && (r[s] = e);
|
|
1012
1051
|
}
|
|
1013
|
-
class
|
|
1052
|
+
class Ye {
|
|
1014
1053
|
constructor(t, e, s = {}) {
|
|
1015
|
-
|
|
1016
|
-
|
|
1054
|
+
S(this, "nodeMap", /* @__PURE__ */ new Map());
|
|
1055
|
+
S(this, "marker", !1);
|
|
1017
1056
|
this.ir = t, this.container = e, this.scope = s;
|
|
1018
1057
|
}
|
|
1019
1058
|
evalIR(t, e, s) {
|
|
1020
|
-
var
|
|
1059
|
+
var o;
|
|
1021
1060
|
const r = this.ir.functions[t - 1];
|
|
1022
1061
|
try {
|
|
1023
1062
|
return r ? r.apply(this.scope, e) : "";
|
|
1024
|
-
} catch (
|
|
1025
|
-
return
|
|
1063
|
+
} catch (i) {
|
|
1064
|
+
return ae(i.message || i.toString(), ((o = this.ir.metadata) == null ? void 0 : o.source) || "", s, this.scope.tagName), "";
|
|
1026
1065
|
}
|
|
1027
1066
|
}
|
|
1028
1067
|
// ================ 创建节点 ================
|
|
@@ -1031,144 +1070,144 @@ class De {
|
|
|
1031
1070
|
return e instanceof SVGElement || s === "svg" ? document.createElementNS("http://www.w3.org/2000/svg", s) : document.createElement(s);
|
|
1032
1071
|
}
|
|
1033
1072
|
createText(t, e) {
|
|
1034
|
-
const s = t.dynamic ? this.evalIR(t.fid, [e], t[
|
|
1073
|
+
const s = t.dynamic ? this.evalIR(t.fid, [e], t[O]) : t.txt || "";
|
|
1035
1074
|
return document.createTextNode(s);
|
|
1036
1075
|
}
|
|
1037
1076
|
createComment(t, e) {
|
|
1038
|
-
const s = t.dynamic ? this.evalIR(t.fid, [e], t[
|
|
1077
|
+
const s = t.dynamic ? this.evalIR(t.fid, [e], t[O]) : t.txt || "";
|
|
1039
1078
|
return document.createComment(s);
|
|
1040
1079
|
}
|
|
1041
1080
|
// ================ 属性全量应用(创建或更新时用) ================
|
|
1042
1081
|
applyAttrs(t, e, s, r = !1) {
|
|
1043
|
-
const
|
|
1044
|
-
|
|
1082
|
+
const o = [], i = t;
|
|
1083
|
+
i[rt] || (i[rt] = {
|
|
1045
1084
|
loops: null
|
|
1046
|
-
}),
|
|
1047
|
-
let
|
|
1048
|
-
for (const
|
|
1049
|
-
const { key:
|
|
1050
|
-
if (
|
|
1051
|
-
|
|
1085
|
+
}), i[rt].loops = s, i[it] || (i[it] = /* @__PURE__ */ Object.create(null));
|
|
1086
|
+
let l, a = !1, c, h = !1;
|
|
1087
|
+
for (const u of e) {
|
|
1088
|
+
const { key: p, fid: v, dynamic: f, value: d } = u;
|
|
1089
|
+
if (p === ":class") {
|
|
1090
|
+
l = this.evalIR(v, [s], u[O]), a = !0;
|
|
1052
1091
|
continue;
|
|
1053
1092
|
}
|
|
1054
|
-
if (
|
|
1055
|
-
|
|
1093
|
+
if (p === ":style") {
|
|
1094
|
+
c = this.evalIR(v, [s], u[O]), h = !0;
|
|
1056
1095
|
continue;
|
|
1057
1096
|
}
|
|
1058
|
-
if (
|
|
1097
|
+
if (p === "class" || p === "style")
|
|
1059
1098
|
continue;
|
|
1060
|
-
const
|
|
1061
|
-
if (
|
|
1062
|
-
const
|
|
1063
|
-
let
|
|
1064
|
-
if (
|
|
1099
|
+
const $ = p[0];
|
|
1100
|
+
if ($ === "@") {
|
|
1101
|
+
const y = p.slice(1), g = u.role ?? "user";
|
|
1102
|
+
let b = i[it][y];
|
|
1103
|
+
if (b || (b = i[it][y] = {
|
|
1065
1104
|
model: [],
|
|
1066
1105
|
user: []
|
|
1067
|
-
}, t.addEventListener(
|
|
1068
|
-
for (const
|
|
1069
|
-
|
|
1070
|
-
for (const
|
|
1071
|
-
|
|
1106
|
+
}, t.addEventListener(y, (E) => {
|
|
1107
|
+
for (const x of b.model)
|
|
1108
|
+
x(E);
|
|
1109
|
+
for (const x of b.user)
|
|
1110
|
+
x(E);
|
|
1072
1111
|
})), !r) {
|
|
1073
|
-
const
|
|
1074
|
-
|
|
1075
|
-
[
|
|
1076
|
-
|
|
1112
|
+
const E = (x) => this.evalIR(
|
|
1113
|
+
v,
|
|
1114
|
+
[x, i[rt].loops],
|
|
1115
|
+
u[O]
|
|
1077
1116
|
);
|
|
1078
|
-
|
|
1117
|
+
b[g].push(E);
|
|
1079
1118
|
}
|
|
1080
1119
|
continue;
|
|
1081
1120
|
}
|
|
1082
|
-
if (
|
|
1121
|
+
if (p === "mounted") {
|
|
1083
1122
|
r || requestAnimationFrame(
|
|
1084
|
-
() => this.evalIR(
|
|
1123
|
+
() => this.evalIR(v, [t, s], u[O])
|
|
1085
1124
|
);
|
|
1086
1125
|
continue;
|
|
1087
1126
|
}
|
|
1088
|
-
if (
|
|
1127
|
+
if (p === "updated") {
|
|
1089
1128
|
r && requestAnimationFrame(
|
|
1090
|
-
() => this.evalIR(
|
|
1129
|
+
() => this.evalIR(v, [t, s], u[O])
|
|
1091
1130
|
);
|
|
1092
1131
|
continue;
|
|
1093
1132
|
}
|
|
1094
|
-
if (
|
|
1095
|
-
this.scope.$refs = this.scope.$refs || {}, this.scope.$refs[
|
|
1133
|
+
if (p === "ref" && d) {
|
|
1134
|
+
this.scope.$refs = this.scope.$refs || {}, this.scope.$refs[d] = t;
|
|
1096
1135
|
continue;
|
|
1097
1136
|
}
|
|
1098
|
-
const
|
|
1099
|
-
if (
|
|
1100
|
-
const
|
|
1101
|
-
t.tagName === "SELECT" &&
|
|
1102
|
-
} else r ||
|
|
1137
|
+
const m = f ? this.evalIR(v, [s], u[O]) : d ?? "";
|
|
1138
|
+
if ($ === ":") {
|
|
1139
|
+
const y = p.slice(1);
|
|
1140
|
+
t.tagName === "SELECT" && Ge.has(y) ? o.push(() => Bt(t, y, m)) : Bt(t, y, m);
|
|
1141
|
+
} else r || $t(t, p, String(m));
|
|
1103
1142
|
}
|
|
1104
|
-
return a &&
|
|
1143
|
+
return a && Ke(t, l), h && Ue(t, c), o;
|
|
1105
1144
|
}
|
|
1106
1145
|
// ================ 更新已有节点 Text Or Comment ================
|
|
1107
1146
|
updateNode(t, e, s) {
|
|
1108
|
-
const r = e.dynamic ? this.evalIR(e.fid, [s], e[
|
|
1147
|
+
const r = e.dynamic ? this.evalIR(e.fid, [s], e[O]) : e.txt || "";
|
|
1109
1148
|
e.dynamic && t.textContent !== r && (t.textContent = r);
|
|
1110
1149
|
}
|
|
1111
1150
|
// ================ 核心遍历 ================
|
|
1112
|
-
irToNode(t, e, s, r,
|
|
1113
|
-
var
|
|
1114
|
-
const
|
|
1151
|
+
irToNode(t, e, s, r, o) {
|
|
1152
|
+
var c, h, u, p;
|
|
1153
|
+
const i = s + "-" + e, l = this.nodeMap.get(i);
|
|
1115
1154
|
let a;
|
|
1116
|
-
if (
|
|
1117
|
-
a =
|
|
1118
|
-
let
|
|
1119
|
-
t.dynamic && (t.type ===
|
|
1155
|
+
if (l) {
|
|
1156
|
+
a = l.node, l.marker = this.marker;
|
|
1157
|
+
let v = [];
|
|
1158
|
+
t.dynamic && (t.type === w.Element ? v = this.applyAttrs(
|
|
1120
1159
|
a,
|
|
1121
1160
|
t.attrs ?? [],
|
|
1122
|
-
|
|
1161
|
+
o,
|
|
1123
1162
|
!0
|
|
1124
|
-
) : this.updateNode(a, t,
|
|
1125
|
-
this.irToNode(
|
|
1126
|
-
}),
|
|
1163
|
+
) : this.updateNode(a, t, o)), (c = t.children) == null || c.forEach((f, d) => {
|
|
1164
|
+
this.irToNode(f, d, i, a, o);
|
|
1165
|
+
}), v.forEach((f) => f());
|
|
1127
1166
|
} else
|
|
1128
1167
|
switch (t.type) {
|
|
1129
|
-
case
|
|
1130
|
-
a = this.createElement(t, r),
|
|
1131
|
-
const
|
|
1132
|
-
r.appendChild(a), this.nodeMap.set(
|
|
1133
|
-
this.irToNode(
|
|
1134
|
-
}),
|
|
1168
|
+
case w.Element:
|
|
1169
|
+
a = this.createElement(t, r), qe(a, t), ze(a, t);
|
|
1170
|
+
const v = this.applyAttrs(a, t.attrs ?? [], o);
|
|
1171
|
+
r.appendChild(a), this.nodeMap.set(i, { irNode: t, node: a, loops: o, marker: this.marker }), (h = t.children) == null || h.forEach((f, d) => {
|
|
1172
|
+
this.irToNode(f, d, i, a, o);
|
|
1173
|
+
}), v.forEach((f) => f());
|
|
1135
1174
|
break;
|
|
1136
|
-
case
|
|
1137
|
-
a = this.createText(t,
|
|
1175
|
+
case w.Text:
|
|
1176
|
+
a = this.createText(t, o), r.appendChild(a), this.nodeMap.set(i, { irNode: t, node: a, loops: o, marker: this.marker });
|
|
1138
1177
|
break;
|
|
1139
|
-
case
|
|
1140
|
-
a = this.createComment(t,
|
|
1178
|
+
case w.Comment:
|
|
1179
|
+
a = this.createComment(t, o), r.appendChild(a), this.nodeMap.set(i, { irNode: t, node: a, loops: o, marker: this.marker });
|
|
1141
1180
|
break;
|
|
1142
|
-
case
|
|
1143
|
-
const
|
|
1144
|
-
let
|
|
1145
|
-
|
|
1146
|
-
irNode: { type:
|
|
1147
|
-
node:
|
|
1148
|
-
loops:
|
|
1181
|
+
case w.For: {
|
|
1182
|
+
const f = `${i}-end`;
|
|
1183
|
+
let d = (u = this.nodeMap.get(f)) == null ? void 0 : u.node;
|
|
1184
|
+
d ? this.nodeMap.get(f).marker = this.marker : (d = document.createComment(`for:${i}`), r.appendChild(d), this.nodeMap.set(f, {
|
|
1185
|
+
irNode: { type: w.Comment },
|
|
1186
|
+
node: d,
|
|
1187
|
+
loops: o,
|
|
1149
1188
|
marker: this.marker
|
|
1150
1189
|
}));
|
|
1151
|
-
const
|
|
1152
|
-
|
|
1153
|
-
var
|
|
1154
|
-
const
|
|
1155
|
-
(
|
|
1156
|
-
this.irToNode(
|
|
1190
|
+
const $ = this.evalIR(t.fid, [o], t[O]) || [], m = document.createDocumentFragment();
|
|
1191
|
+
$.forEach((y, g) => {
|
|
1192
|
+
var E;
|
|
1193
|
+
const b = [...o, { itmVal: y, idxVal: g }];
|
|
1194
|
+
(E = t.children) == null || E.forEach((x, R) => {
|
|
1195
|
+
this.irToNode(x, R, `${i}-for-${g}`, m, b);
|
|
1157
1196
|
});
|
|
1158
|
-
}),
|
|
1197
|
+
}), d.parentNode.insertBefore(m, d);
|
|
1159
1198
|
break;
|
|
1160
1199
|
}
|
|
1161
|
-
case
|
|
1162
|
-
const
|
|
1163
|
-
let
|
|
1164
|
-
|
|
1165
|
-
for (let
|
|
1166
|
-
const
|
|
1167
|
-
if (
|
|
1168
|
-
const
|
|
1169
|
-
|
|
1170
|
-
this.irToNode(
|
|
1171
|
-
}),
|
|
1200
|
+
case w.Conditional: {
|
|
1201
|
+
const f = `${i}-end`;
|
|
1202
|
+
let d = (p = this.nodeMap.get(f)) == null ? void 0 : p.node;
|
|
1203
|
+
d ? this.nodeMap.get(f).marker = this.marker : (d = document.createComment(`if:${i}`), r.appendChild(d), this.nodeMap.set(f, { irNode: {}, node: d, loops: o, marker: this.marker }));
|
|
1204
|
+
for (let $ = 0; $ < (t.branches || []).length; $++) {
|
|
1205
|
+
const m = t.branches[$];
|
|
1206
|
+
if (m.condFid === null || this.evalIR(m.condFid, [o], m[O])) {
|
|
1207
|
+
const g = document.createDocumentFragment();
|
|
1208
|
+
m.children.forEach((b, E) => {
|
|
1209
|
+
this.irToNode(b, E, `${i}-if-${$}`, g, o);
|
|
1210
|
+
}), d.parentNode.insertBefore(g, d);
|
|
1172
1211
|
break;
|
|
1173
1212
|
}
|
|
1174
1213
|
}
|
|
@@ -1180,18 +1219,18 @@ class De {
|
|
|
1180
1219
|
cleanupOldNodes() {
|
|
1181
1220
|
for (const [t, e] of this.nodeMap.entries())
|
|
1182
1221
|
if (e.marker !== this.marker) {
|
|
1183
|
-
const { irNode: s, node: r, loops:
|
|
1222
|
+
const { irNode: s, node: r, loops: o } = e;
|
|
1184
1223
|
if (s.attrs) {
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1224
|
+
const i = s.attrs.find((a) => a.key === "unmounted");
|
|
1225
|
+
i && requestAnimationFrame(() => {
|
|
1187
1226
|
this.evalIR(
|
|
1188
|
-
|
|
1189
|
-
[r,
|
|
1190
|
-
|
|
1227
|
+
i.fid,
|
|
1228
|
+
[r, o],
|
|
1229
|
+
i[O]
|
|
1191
1230
|
);
|
|
1192
1231
|
});
|
|
1193
|
-
const
|
|
1194
|
-
|
|
1232
|
+
const l = s.attrs.find((a) => a.key === "ref");
|
|
1233
|
+
l && l.value && delete this.scope.$refs[l.value];
|
|
1195
1234
|
}
|
|
1196
1235
|
r == null || r.remove(), this.nodeMap.delete(t);
|
|
1197
1236
|
}
|
|
@@ -1211,83 +1250,84 @@ class De {
|
|
|
1211
1250
|
this.container.innerHTML = "", this.nodeMap.clear();
|
|
1212
1251
|
}
|
|
1213
1252
|
}
|
|
1214
|
-
const
|
|
1215
|
-
const s = new
|
|
1253
|
+
const Ze = (n, t, e = {}) => {
|
|
1254
|
+
const s = new Ye(n, t, e);
|
|
1216
1255
|
return s.mount(), {
|
|
1217
1256
|
update: () => s.update(),
|
|
1218
1257
|
destroy: () => s.destroy()
|
|
1219
1258
|
};
|
|
1220
|
-
},
|
|
1221
|
-
var
|
|
1222
|
-
class
|
|
1259
|
+
}, jt = Symbol.for("solely.manifest");
|
|
1260
|
+
var T, D, z, Q, U, B, K, H, j, tt, k, Ut, xt, Kt, Ht, St, at, Yt, Zt, kt, Rt;
|
|
1261
|
+
class lt extends HTMLElement {
|
|
1223
1262
|
/* -------------------- 构造 -------------------- */
|
|
1224
1263
|
constructor(e = {}) {
|
|
1225
|
-
var
|
|
1264
|
+
var o;
|
|
1226
1265
|
super();
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1266
|
+
M(this, k);
|
|
1267
|
+
M(this, T);
|
|
1268
|
+
M(this, D);
|
|
1269
|
+
M(this, z);
|
|
1270
|
+
M(this, Q);
|
|
1271
|
+
M(this, U);
|
|
1272
|
+
M(this, B);
|
|
1273
|
+
M(this, K, !1);
|
|
1274
|
+
M(this, H, !1);
|
|
1275
|
+
M(this, j, !1);
|
|
1276
|
+
M(this, tt, !1);
|
|
1238
1277
|
const s = this.constructor;
|
|
1239
|
-
|
|
1240
|
-
const r =
|
|
1241
|
-
|
|
1278
|
+
A(this, T, s[jt] || { tagName: "base-element" });
|
|
1279
|
+
const r = C(this, T);
|
|
1280
|
+
A(this, U, (o = r.shadowDOM) != null && o.use ? this.attachShadow({ mode: r.shadowDOM.mode || "open" }) : this), I(this, k, xt).call(this, e), I(this, k, Ht).call(this, r), queueMicrotask(() => I(this, k, kt).call(this));
|
|
1242
1281
|
}
|
|
1243
1282
|
// 需要在元素定义前设置的属性列表(Upgrade Property)
|
|
1244
1283
|
/* -------------------- observedAttributes -------------------- */
|
|
1245
1284
|
static get observedAttributes() {
|
|
1246
|
-
const e = this[
|
|
1285
|
+
const e = this[jt];
|
|
1247
1286
|
return e != null && e.propMap ? Array.from(e.propMap.keys()) : [];
|
|
1248
1287
|
}
|
|
1249
1288
|
/* -------------------- $data -------------------- */
|
|
1250
1289
|
get $data() {
|
|
1251
|
-
return
|
|
1290
|
+
return C(this, Q);
|
|
1252
1291
|
}
|
|
1253
1292
|
set $data(e) {
|
|
1254
1293
|
var s;
|
|
1255
|
-
|
|
1294
|
+
V(e) || (e = {}), (s = C(this, B)) == null || s.call(this), I(this, k, xt).call(this, e), I(this, k, at).call(this);
|
|
1256
1295
|
}
|
|
1257
1296
|
refresh() {
|
|
1258
|
-
|
|
1297
|
+
I(this, k, at).call(this);
|
|
1259
1298
|
}
|
|
1260
1299
|
/* -------------------- 生命周期 -------------------- */
|
|
1261
1300
|
connectedCallback() {
|
|
1262
|
-
var
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
this
|
|
1272
|
-
|
|
1301
|
+
var l;
|
|
1302
|
+
const s = this.constructor.upgradeProps;
|
|
1303
|
+
let r;
|
|
1304
|
+
Array.isArray(s) ? r = s.includes("$data") ? s : [...s, "$data"] : r = ["$data"], I(this, k, Ut).call(this, r), I(this, k, kt).call(this);
|
|
1305
|
+
const o = C(this, T);
|
|
1306
|
+
if ((o.className || o.tagName || "").split(" ").forEach((a) => a && this.classList.add(a)), I(this, k, Zt).call(this), o.propMap && V(this.$data))
|
|
1307
|
+
for (const [a, c] of o.propMap) {
|
|
1308
|
+
const h = c.name;
|
|
1309
|
+
if (this.hasAttribute(a)) {
|
|
1310
|
+
const u = this.getAttribute(a), p = I(this, k, St).call(this, u, c.default, c.type);
|
|
1311
|
+
this.$data[h] = p;
|
|
1312
|
+
} else "default" in c && (this.$data[h] = c.default);
|
|
1273
1313
|
}
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1314
|
+
C(this, z) && A(this, D, Ze(
|
|
1315
|
+
C(this, z),
|
|
1316
|
+
C(this, U),
|
|
1277
1317
|
this
|
|
1278
|
-
)), this.mounted(), (
|
|
1318
|
+
)), this.mounted(), (l = this.onInit) == null || l.call(this);
|
|
1279
1319
|
}
|
|
1280
1320
|
disconnectedCallback() {
|
|
1281
|
-
var e;
|
|
1282
|
-
this.unmounted(), (e =
|
|
1321
|
+
var e, s, r;
|
|
1322
|
+
this.unmounted(), (e = C(this, B)) == null || e.call(this), A(this, B, void 0), (r = (s = C(this, D)) == null ? void 0 : s.destroy) == null || r.call(s), A(this, D, null);
|
|
1283
1323
|
}
|
|
1284
1324
|
attributeChangedCallback(e, s, r) {
|
|
1285
|
-
var
|
|
1286
|
-
if (s === r || !
|
|
1287
|
-
const
|
|
1288
|
-
if (!
|
|
1289
|
-
const
|
|
1290
|
-
this.$data[
|
|
1325
|
+
var h;
|
|
1326
|
+
if (s === r || !V(this.$data)) return;
|
|
1327
|
+
const i = (h = C(this, T).propMap) == null ? void 0 : h.get(e);
|
|
1328
|
+
if (!i) return;
|
|
1329
|
+
const l = i.name, a = this.$data[l], c = I(this, k, St).call(this, r, i.default ?? a, i.type);
|
|
1330
|
+
this.$data[l] = c, A(this, j, !0), this.attributeChanged(e, a, c);
|
|
1291
1331
|
}
|
|
1292
1332
|
/* -------------------- 事件派发 -------------------- */
|
|
1293
1333
|
emit(e, s, r) {
|
|
@@ -1320,48 +1360,48 @@ class ft extends HTMLElement {
|
|
|
1320
1360
|
afterAttributesUpdate() {
|
|
1321
1361
|
}
|
|
1322
1362
|
}
|
|
1323
|
-
|
|
1324
|
-
|
|
1363
|
+
T = new WeakMap(), D = new WeakMap(), z = new WeakMap(), Q = new WeakMap(), U = new WeakMap(), B = new WeakMap(), K = new WeakMap(), H = new WeakMap(), j = new WeakMap(), tt = new WeakMap(), k = new WeakSet(), // 升级属性(Upgrade Property), 保障在元素被定义前设置的属性能正确触发响应式更新
|
|
1364
|
+
Ut = function(e) {
|
|
1325
1365
|
for (const s of e)
|
|
1326
1366
|
if (this.hasOwnProperty(s)) {
|
|
1327
1367
|
const r = this[s];
|
|
1328
1368
|
delete this[s], this[s] = r;
|
|
1329
1369
|
}
|
|
1330
1370
|
}, /* -------------------- 初始化 -------------------- */
|
|
1331
|
-
|
|
1332
|
-
const { proxy: s,
|
|
1333
|
-
var
|
|
1334
|
-
if (
|
|
1335
|
-
const { key: a, newValue:
|
|
1336
|
-
|
|
1337
|
-
)) || Array.from(((
|
|
1338
|
-
|
|
1371
|
+
xt = function(e) {
|
|
1372
|
+
const { proxy: s, dispose: r } = Ve(e, (o) => {
|
|
1373
|
+
var i, l;
|
|
1374
|
+
if (o.type === "set") {
|
|
1375
|
+
const { key: a, newValue: c } = o, h = C(this, T), u = String(a), p = ((i = h.propMap) == null ? void 0 : i.get(
|
|
1376
|
+
u.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()
|
|
1377
|
+
)) || Array.from(((l = h.propMap) == null ? void 0 : l.values()) || []).find((v) => v.name === u);
|
|
1378
|
+
p != null && p.reflect && I(this, k, Kt).call(this, p, c);
|
|
1339
1379
|
}
|
|
1340
1380
|
this.emit("change", {
|
|
1341
1381
|
source: "state",
|
|
1342
|
-
...
|
|
1343
|
-
}),
|
|
1382
|
+
...o
|
|
1383
|
+
}), I(this, k, at).call(this);
|
|
1344
1384
|
});
|
|
1345
|
-
|
|
1346
|
-
},
|
|
1385
|
+
A(this, Q, s), A(this, B, r);
|
|
1386
|
+
}, Kt = function(e, s) {
|
|
1347
1387
|
const r = e.name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1348
1388
|
if (e.type === "boolean")
|
|
1349
1389
|
s ? this.setAttribute(r, "") : this.removeAttribute(r);
|
|
1350
1390
|
else {
|
|
1351
|
-
const
|
|
1352
|
-
this.setAttribute(r,
|
|
1391
|
+
const o = typeof s == "object" ? JSON.stringify(s) : String(s);
|
|
1392
|
+
this.setAttribute(r, o);
|
|
1353
1393
|
}
|
|
1354
|
-
},
|
|
1355
|
-
e.ir &&
|
|
1356
|
-
},
|
|
1394
|
+
}, Ht = function(e) {
|
|
1395
|
+
e.ir && A(this, z, e.ir);
|
|
1396
|
+
}, St = function(e, s, r) {
|
|
1357
1397
|
if (e === null)
|
|
1358
1398
|
return r === "boolean" ? s ?? !1 : s;
|
|
1359
1399
|
switch (r) {
|
|
1360
1400
|
case "boolean":
|
|
1361
1401
|
return !0;
|
|
1362
1402
|
case "number": {
|
|
1363
|
-
const
|
|
1364
|
-
return isNaN(
|
|
1403
|
+
const o = Number(e);
|
|
1404
|
+
return isNaN(o) ? s : o;
|
|
1365
1405
|
}
|
|
1366
1406
|
case "object":
|
|
1367
1407
|
try {
|
|
@@ -1373,31 +1413,31 @@ kt = function(e) {
|
|
|
1373
1413
|
return e;
|
|
1374
1414
|
}
|
|
1375
1415
|
}, /* -------------------- 刷新调度 -------------------- */
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1416
|
+
at = function() {
|
|
1417
|
+
C(this, H) || !C(this, D) || (A(this, H, !0), queueMicrotask(() => {
|
|
1418
|
+
A(this, H, !1), I(this, k, Yt).call(this);
|
|
1379
1419
|
}));
|
|
1380
|
-
},
|
|
1381
|
-
|
|
1382
|
-
},
|
|
1383
|
-
const e =
|
|
1420
|
+
}, Yt = function() {
|
|
1421
|
+
C(this, K) || !this.isConnected || (A(this, K, !0), C(this, j) && this.beforeAttributesUpdate(), this.beforeUpdate(), C(this, D).update(), this.updated(), C(this, j) && (this.afterAttributesUpdate(), A(this, j, !1)), A(this, K, !1));
|
|
1422
|
+
}, Zt = function() {
|
|
1423
|
+
const e = C(this, T);
|
|
1384
1424
|
if (!e.styles) return;
|
|
1385
|
-
const s =
|
|
1425
|
+
const s = C(this, U);
|
|
1386
1426
|
if (e.sheet && s instanceof ShadowRoot && "adoptedStyleSheets" in s) {
|
|
1387
1427
|
s.adoptedStyleSheets.includes(e.sheet) || (s.adoptedStyleSheets = [...s.adoptedStyleSheets, e.sheet]);
|
|
1388
1428
|
return;
|
|
1389
1429
|
}
|
|
1390
|
-
const r = s instanceof ShadowRoot ? s : document.head,
|
|
1391
|
-
if (!r.querySelector(`#${
|
|
1392
|
-
const
|
|
1393
|
-
|
|
1430
|
+
const r = s instanceof ShadowRoot ? s : document.head, o = `solely-style-${e.tagName}`;
|
|
1431
|
+
if (!r.querySelector(`#${o}`)) {
|
|
1432
|
+
const i = document.createElement("style");
|
|
1433
|
+
i.id = o, i.textContent = e.styles, r.appendChild(i);
|
|
1394
1434
|
}
|
|
1395
1435
|
}, /* -------------------- created 保障 -------------------- */
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
},
|
|
1399
|
-
|
|
1400
|
-
const
|
|
1436
|
+
kt = function() {
|
|
1437
|
+
C(this, tt) || (A(this, tt, !0), this.created());
|
|
1438
|
+
}, Rt = new WeakMap(), S(lt, "upgradeProps"), /* -------------------- DEV define 保护 -------------------- */
|
|
1439
|
+
M(lt, Rt, !1);
|
|
1440
|
+
const Je = Symbol.for("solely.manifest"), Jt = (n) => {
|
|
1401
1441
|
const t = n;
|
|
1402
1442
|
return (e) => {
|
|
1403
1443
|
const { tagName: s } = t;
|
|
@@ -1405,113 +1445,113 @@ const Be = Symbol.for("solely.manifest"), Kt = (n) => {
|
|
|
1405
1445
|
return e;
|
|
1406
1446
|
if (typeof t.template == "string" && !t.ir)
|
|
1407
1447
|
try {
|
|
1408
|
-
const
|
|
1409
|
-
t.ir =
|
|
1448
|
+
const o = _e(t.template);
|
|
1449
|
+
t.ir = Ae(o, {
|
|
1410
1450
|
source: t.template,
|
|
1411
1451
|
filename: s
|
|
1412
1452
|
});
|
|
1413
|
-
} catch (
|
|
1414
|
-
console.error(`[Compiler Error] <${s}>:`,
|
|
1453
|
+
} catch (o) {
|
|
1454
|
+
console.error(`[Compiler Error] <${s}>:`, o);
|
|
1415
1455
|
}
|
|
1416
1456
|
if (t.styles && !t.sheet && "CSSStyleSheet" in window)
|
|
1417
1457
|
try {
|
|
1418
|
-
const
|
|
1419
|
-
|
|
1420
|
-
} catch (
|
|
1421
|
-
console.error(`[Style Error] <${s}>:`,
|
|
1458
|
+
const o = new CSSStyleSheet();
|
|
1459
|
+
o.replaceSync(t.styles), t.sheet = o;
|
|
1460
|
+
} catch (o) {
|
|
1461
|
+
console.error(`[Style Error] <${s}>:`, o);
|
|
1422
1462
|
}
|
|
1423
1463
|
if (t.props && !t.propMap) {
|
|
1424
|
-
const
|
|
1425
|
-
t.props.forEach((
|
|
1426
|
-
const
|
|
1427
|
-
|
|
1428
|
-
}), t.propMap =
|
|
1464
|
+
const o = /* @__PURE__ */ new Map();
|
|
1465
|
+
t.props.forEach((i) => {
|
|
1466
|
+
const l = typeof i == "string" ? { name: i } : i, a = l.name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), c = a.replace(/-([a-z])/g, (h, u) => u.toUpperCase());
|
|
1467
|
+
o.set(a, { ...l, name: c });
|
|
1468
|
+
}), t.propMap = o;
|
|
1429
1469
|
}
|
|
1430
1470
|
class r extends e {
|
|
1431
1471
|
}
|
|
1432
|
-
return r[
|
|
1472
|
+
return r[Je] = t, customElements.define(s, r), r;
|
|
1433
1473
|
};
|
|
1434
1474
|
};
|
|
1435
|
-
let
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1475
|
+
let q = null, Xt;
|
|
1476
|
+
const Qt = new Promise((n) => {
|
|
1477
|
+
Xt = n;
|
|
1438
1478
|
});
|
|
1439
|
-
function
|
|
1440
|
-
return
|
|
1479
|
+
function cn(n) {
|
|
1480
|
+
return q || (q = new Xe(n), Xt(q), q);
|
|
1441
1481
|
}
|
|
1442
|
-
function
|
|
1443
|
-
return
|
|
1482
|
+
function bt() {
|
|
1483
|
+
return q;
|
|
1444
1484
|
}
|
|
1445
|
-
class
|
|
1485
|
+
class Xe {
|
|
1446
1486
|
constructor(t) {
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1487
|
+
S(this, "routes");
|
|
1488
|
+
S(this, "base");
|
|
1489
|
+
S(this, "mode");
|
|
1490
|
+
S(this, "beforeEachGuard");
|
|
1491
|
+
S(this, "afterEachGuard");
|
|
1492
|
+
S(this, "currentRoute", null);
|
|
1493
|
+
S(this, "listeners", /* @__PURE__ */ new Set());
|
|
1494
|
+
S(this, "isStarted", !1);
|
|
1455
1495
|
this.routes = t.routes, this.base = t.base ?? "/", this.mode = t.mode || "history", this.beforeEachGuard = t.beforeEach, this.afterEachGuard = t.afterEach;
|
|
1456
1496
|
}
|
|
1457
1497
|
// --- 核心匹配逻辑 ---
|
|
1458
1498
|
matchRoute(t = "/") {
|
|
1459
|
-
const e = t.startsWith("/") ? t : "/" + t, [s, r] = e.split("?"),
|
|
1460
|
-
if (
|
|
1461
|
-
const a =
|
|
1499
|
+
const e = t.startsWith("/") ? t : "/" + t, [s, r] = e.split("?"), o = s.split("/").filter(Boolean), i = this.parseQuery(r), l = this.recursiveMatch(this.routes, o);
|
|
1500
|
+
if (l) {
|
|
1501
|
+
const a = l.matched[l.matched.length - 1];
|
|
1462
1502
|
return a.config.redirect ? this.matchRoute(a.config.redirect) : {
|
|
1463
|
-
matched:
|
|
1503
|
+
matched: l.matched,
|
|
1464
1504
|
// 这里的结构已经是 [{config, params}, ...]
|
|
1465
|
-
params:
|
|
1505
|
+
params: l.params,
|
|
1466
1506
|
// 全局合并后的 params
|
|
1467
|
-
query:
|
|
1507
|
+
query: i,
|
|
1468
1508
|
fullPath: e,
|
|
1469
1509
|
// 合并所有层级的 meta
|
|
1470
|
-
meta:
|
|
1510
|
+
meta: l.matched.reduce((c, h) => ({ ...c, ...h.config.meta || {} }), {})
|
|
1471
1511
|
};
|
|
1472
1512
|
}
|
|
1473
1513
|
return null;
|
|
1474
1514
|
}
|
|
1475
1515
|
recursiveMatch(t, e) {
|
|
1476
|
-
const s = [...t].sort((r,
|
|
1516
|
+
const s = [...t].sort((r, o) => this.calculateScore(o.path) - this.calculateScore(r.path));
|
|
1477
1517
|
for (const r of s) {
|
|
1478
|
-
const
|
|
1479
|
-
let
|
|
1480
|
-
if (
|
|
1518
|
+
const o = r.path.split("/").filter(Boolean), i = {};
|
|
1519
|
+
let l = !0;
|
|
1520
|
+
if (o.length === 0 && e.length === 0)
|
|
1481
1521
|
return {
|
|
1482
1522
|
matched: [{ config: r, params: {} }],
|
|
1483
1523
|
params: {}
|
|
1484
1524
|
};
|
|
1485
|
-
for (let a = 0; a <
|
|
1486
|
-
const
|
|
1487
|
-
if (
|
|
1488
|
-
if (!
|
|
1489
|
-
|
|
1525
|
+
for (let a = 0; a < o.length; a++) {
|
|
1526
|
+
const c = o[a], h = e[a];
|
|
1527
|
+
if (c.startsWith(":")) {
|
|
1528
|
+
if (!h) {
|
|
1529
|
+
l = !1;
|
|
1490
1530
|
break;
|
|
1491
1531
|
}
|
|
1492
|
-
|
|
1493
|
-
} else if (
|
|
1494
|
-
|
|
1532
|
+
i[c.slice(1)] = h;
|
|
1533
|
+
} else if (c === "*") {
|
|
1534
|
+
l = !0;
|
|
1495
1535
|
break;
|
|
1496
|
-
} else if (
|
|
1497
|
-
|
|
1536
|
+
} else if (c !== h) {
|
|
1537
|
+
l = !1;
|
|
1498
1538
|
break;
|
|
1499
1539
|
}
|
|
1500
1540
|
}
|
|
1501
|
-
if (
|
|
1502
|
-
const a =
|
|
1503
|
-
if (
|
|
1504
|
-
const
|
|
1505
|
-
if (
|
|
1541
|
+
if (l) {
|
|
1542
|
+
const a = o.length, c = e.slice(a), h = { config: r, params: i };
|
|
1543
|
+
if (c.length > 0 && r.children) {
|
|
1544
|
+
const u = this.recursiveMatch(r.children, c);
|
|
1545
|
+
if (u)
|
|
1506
1546
|
return {
|
|
1507
|
-
matched: [
|
|
1508
|
-
params: { ...
|
|
1547
|
+
matched: [h, ...u.matched],
|
|
1548
|
+
params: { ...i, ...u.params }
|
|
1509
1549
|
// 全局合并 params
|
|
1510
1550
|
};
|
|
1511
|
-
} else if (
|
|
1551
|
+
} else if (c.length === 0 || o.includes("*"))
|
|
1512
1552
|
return {
|
|
1513
|
-
matched: [
|
|
1514
|
-
params:
|
|
1553
|
+
matched: [h],
|
|
1554
|
+
params: i
|
|
1515
1555
|
};
|
|
1516
1556
|
}
|
|
1517
1557
|
}
|
|
@@ -1523,8 +1563,8 @@ class Ge {
|
|
|
1523
1563
|
}
|
|
1524
1564
|
parseQuery(t) {
|
|
1525
1565
|
const e = {};
|
|
1526
|
-
return t && new URLSearchParams(t).forEach((r,
|
|
1527
|
-
e[
|
|
1566
|
+
return t && new URLSearchParams(t).forEach((r, o) => {
|
|
1567
|
+
e[o] = r;
|
|
1528
1568
|
}), e;
|
|
1529
1569
|
}
|
|
1530
1570
|
normalizePath(t = "/") {
|
|
@@ -1547,26 +1587,26 @@ class Ge {
|
|
|
1547
1587
|
if (this.mode === "hash")
|
|
1548
1588
|
e ? window.location.replace(`#${s}`) : window.location.hash = s;
|
|
1549
1589
|
else {
|
|
1550
|
-
const
|
|
1551
|
-
e ? window.history.replaceState({ path:
|
|
1590
|
+
const o = r.endsWith("/") ? r.slice(0, -1) : r, i = o === "/" ? s : o + s;
|
|
1591
|
+
e ? window.history.replaceState({ path: i }, "", i) : window.history.pushState({ path: i }, "", i);
|
|
1552
1592
|
}
|
|
1553
1593
|
}
|
|
1554
1594
|
/**
|
|
1555
1595
|
* @param fromEvent 标志位:是否由浏览器 popstate 事件触发
|
|
1556
1596
|
*/
|
|
1557
1597
|
async navigate(t = "/", e = !1, s = !1) {
|
|
1558
|
-
const r = this.normalizePath(t),
|
|
1559
|
-
if (!
|
|
1560
|
-
if (
|
|
1598
|
+
const r = this.normalizePath(t), o = this.currentRoute, i = this.matchRoute(r);
|
|
1599
|
+
if (!i) return { success: !1, error: `No route matched: ${r}` };
|
|
1600
|
+
if (o && o.fullPath === i.fullPath) return { success: !0 };
|
|
1561
1601
|
if (this.beforeEachGuard)
|
|
1562
1602
|
try {
|
|
1563
|
-
const
|
|
1564
|
-
if (
|
|
1565
|
-
if (typeof
|
|
1566
|
-
} catch (
|
|
1567
|
-
return { success: !1, error:
|
|
1603
|
+
const l = await this.beforeEachGuard(i, o);
|
|
1604
|
+
if (l === !1) return { success: !1, cancelled: !0 };
|
|
1605
|
+
if (typeof l == "string") return this.navigate(l, e);
|
|
1606
|
+
} catch (l) {
|
|
1607
|
+
return { success: !1, error: l instanceof Error ? l.message : "Guard Error" };
|
|
1568
1608
|
}
|
|
1569
|
-
return this.currentRoute =
|
|
1609
|
+
return this.currentRoute = i, s || this.updateBrowserHistory(r, e), this.notifyListeners(), this.afterEachGuard && this.afterEachGuard(i, o), { success: !0 };
|
|
1570
1610
|
}
|
|
1571
1611
|
// --- 路径解析逻辑 ---
|
|
1572
1612
|
/**
|
|
@@ -1615,28 +1655,28 @@ class Ge {
|
|
|
1615
1655
|
return this.currentRoute;
|
|
1616
1656
|
}
|
|
1617
1657
|
}
|
|
1618
|
-
var
|
|
1619
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
1620
|
-
(
|
|
1658
|
+
var Qe = Object.getOwnPropertyDescriptor, tn = (n, t, e, s) => {
|
|
1659
|
+
for (var r = s > 1 ? void 0 : s ? Qe(t, e) : t, o = n.length - 1, i; o >= 0; o--)
|
|
1660
|
+
(i = n[o]) && (r = i(r) || r);
|
|
1621
1661
|
return r;
|
|
1622
1662
|
};
|
|
1623
|
-
let
|
|
1663
|
+
let ut = class extends lt {
|
|
1624
1664
|
constructor() {
|
|
1625
1665
|
super(...arguments);
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1666
|
+
S(this, "unsubscribe");
|
|
1667
|
+
S(this, "level", 0);
|
|
1668
|
+
S(this, "currentElement", null);
|
|
1669
|
+
S(this, "currentTagName", null);
|
|
1670
|
+
S(this, "routerAttrs", /* @__PURE__ */ new Set());
|
|
1671
|
+
S(this, "prevPropKeys", /* @__PURE__ */ new Set());
|
|
1672
|
+
S(this, "scheduled", !1);
|
|
1673
|
+
S(this, "cache", /* @__PURE__ */ new Map());
|
|
1674
|
+
S(this, "latestLoadId", 0);
|
|
1635
1675
|
}
|
|
1636
1676
|
/* -------------------- 生命周期 -------------------- */
|
|
1637
1677
|
async mounted() {
|
|
1638
1678
|
this.detectLevel();
|
|
1639
|
-
const t = await
|
|
1679
|
+
const t = await Qt;
|
|
1640
1680
|
this.unsubscribe = t.listen(() => {
|
|
1641
1681
|
this.scheduleLoad(t.getCurrentRoute());
|
|
1642
1682
|
}), this.loadRoute(t.getCurrentRoute());
|
|
@@ -1654,7 +1694,7 @@ let dt = class extends ft {
|
|
|
1654
1694
|
detectLevel() {
|
|
1655
1695
|
let t = 0, e = this.parentElement;
|
|
1656
1696
|
for (; e; )
|
|
1657
|
-
e instanceof
|
|
1697
|
+
e instanceof ut && t++, e = e.parentElement;
|
|
1658
1698
|
this.level = t;
|
|
1659
1699
|
}
|
|
1660
1700
|
async loadRoute(t) {
|
|
@@ -1664,29 +1704,29 @@ let dt = class extends ft {
|
|
|
1664
1704
|
return;
|
|
1665
1705
|
}
|
|
1666
1706
|
const { config: r } = s;
|
|
1667
|
-
let
|
|
1668
|
-
if (!
|
|
1707
|
+
let o = r.tagName;
|
|
1708
|
+
if (!o && typeof r.component == "function") {
|
|
1669
1709
|
this.renderLoading();
|
|
1670
1710
|
try {
|
|
1671
|
-
const
|
|
1672
|
-
|
|
1673
|
-
} catch (
|
|
1674
|
-
this.renderError(`Load Error: ${
|
|
1711
|
+
const l = await r.component();
|
|
1712
|
+
o = typeof l == "string" ? l : l.tagName;
|
|
1713
|
+
} catch (l) {
|
|
1714
|
+
this.renderError(`Load Error: ${l}`);
|
|
1675
1715
|
return;
|
|
1676
1716
|
}
|
|
1677
1717
|
}
|
|
1678
1718
|
if (e !== this.latestLoadId) return;
|
|
1679
|
-
if (!
|
|
1719
|
+
if (!o) {
|
|
1680
1720
|
this.clear();
|
|
1681
1721
|
return;
|
|
1682
1722
|
}
|
|
1683
|
-
if (!r.forceReload && this.currentElement && this.currentTagName ===
|
|
1723
|
+
if (!r.forceReload && this.currentElement && this.currentTagName === o.toLowerCase()) {
|
|
1684
1724
|
this.syncState(this.currentElement, t == null ? void 0 : t.params, (t == null ? void 0 : t.query) || {}, r.props);
|
|
1685
1725
|
return;
|
|
1686
1726
|
}
|
|
1687
1727
|
this.clear(r.keepAlive);
|
|
1688
|
-
const
|
|
1689
|
-
this.syncState(
|
|
1728
|
+
const i = this.getOrCreateComponent(o, r);
|
|
1729
|
+
this.syncState(i, t == null ? void 0 : t.params, (t == null ? void 0 : t.query) || {}, r.props), this.appendChild(i), this.currentElement = i, this.currentTagName = o.toLowerCase();
|
|
1690
1730
|
}
|
|
1691
1731
|
getOrCreateComponent(t, e) {
|
|
1692
1732
|
const s = t.toLowerCase();
|
|
@@ -1696,18 +1736,18 @@ let dt = class extends ft {
|
|
|
1696
1736
|
return e.keepAlive && this.cache.set(s, r), r;
|
|
1697
1737
|
}
|
|
1698
1738
|
syncState(t, e, s, r = {}) {
|
|
1699
|
-
const
|
|
1700
|
-
Object.entries(e).forEach(([a,
|
|
1701
|
-
|
|
1702
|
-
}),
|
|
1703
|
-
t.getAttribute(
|
|
1739
|
+
const o = (a) => a.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), i = /* @__PURE__ */ new Map();
|
|
1740
|
+
Object.entries(e).forEach(([a, c]) => i.set(o(a), String(c))), Object.entries(s).forEach(([a, c]) => i.set(`query-${o(a)}`, String(c))), this.routerAttrs.forEach((a) => {
|
|
1741
|
+
i.has(a) || (t.removeAttribute(a), this.routerAttrs.delete(a));
|
|
1742
|
+
}), i.forEach((a, c) => {
|
|
1743
|
+
t.getAttribute(c) !== a && t.setAttribute(c, a), this.routerAttrs.add(c);
|
|
1704
1744
|
});
|
|
1705
|
-
const
|
|
1745
|
+
const l = new Set(Object.keys(r));
|
|
1706
1746
|
this.prevPropKeys.forEach((a) => {
|
|
1707
|
-
|
|
1708
|
-
}), Object.entries(r).forEach(([a,
|
|
1709
|
-
t[a] !==
|
|
1710
|
-
}), this.prevPropKeys =
|
|
1747
|
+
l.has(a) || (t[a] = void 0);
|
|
1748
|
+
}), Object.entries(r).forEach(([a, c]) => {
|
|
1749
|
+
t[a] !== c && (t[a] = c);
|
|
1750
|
+
}), this.prevPropKeys = l;
|
|
1711
1751
|
}
|
|
1712
1752
|
handleEmptyRoute() {
|
|
1713
1753
|
this.clear(), this.level === 0 && this.renderError("404 Not Found");
|
|
@@ -1722,22 +1762,22 @@ let dt = class extends ft {
|
|
|
1722
1762
|
this.currentElement ? this.contains(this.currentElement) && this.removeChild(this.currentElement) : t || (this.innerHTML = ""), this.currentElement = null, this.currentTagName = null, this.routerAttrs.clear(), this.prevPropKeys.clear();
|
|
1723
1763
|
}
|
|
1724
1764
|
};
|
|
1725
|
-
|
|
1726
|
-
|
|
1765
|
+
ut = tn([
|
|
1766
|
+
Jt({
|
|
1727
1767
|
tagName: "router-view"
|
|
1728
1768
|
// 注意:删除了 shadowDOM 配置,默认为 false
|
|
1729
1769
|
})
|
|
1730
|
-
],
|
|
1731
|
-
const
|
|
1732
|
-
var
|
|
1733
|
-
for (var r = s > 1 ? void 0 : s ?
|
|
1734
|
-
(
|
|
1770
|
+
], ut);
|
|
1771
|
+
const ln = ut;
|
|
1772
|
+
var en = Object.getOwnPropertyDescriptor, nn = (n, t, e, s) => {
|
|
1773
|
+
for (var r = s > 1 ? void 0 : s ? en(t, e) : t, o = n.length - 1, i; o >= 0; o--)
|
|
1774
|
+
(i = n[o]) && (r = i(r) || r);
|
|
1735
1775
|
return r;
|
|
1736
1776
|
};
|
|
1737
|
-
let
|
|
1777
|
+
let Ct = class extends lt {
|
|
1738
1778
|
constructor() {
|
|
1739
1779
|
super(...arguments);
|
|
1740
|
-
|
|
1780
|
+
S(this, "_prefetched", !1);
|
|
1741
1781
|
}
|
|
1742
1782
|
set to(t) {
|
|
1743
1783
|
this.$data.to = t, this.updateState();
|
|
@@ -1746,15 +1786,15 @@ let At = class extends ft {
|
|
|
1746
1786
|
return this.$data.to;
|
|
1747
1787
|
}
|
|
1748
1788
|
async mounted() {
|
|
1749
|
-
(await
|
|
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(), (
|
|
1789
|
+
(await Qt).listen(() => this.updateState()), this.updateState(), this.addEventListener("click", (e) => {
|
|
1790
|
+
var r, o;
|
|
1791
|
+
e.defaultPrevented || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || e.button !== 0 || (r = e.target.closest("a")) != null && r.getAttribute("target") || (e.preventDefault(), (o = bt()) == null || o.push(this.$data.to));
|
|
1752
1792
|
}), this.addEventListener("mouseenter", () => {
|
|
1753
1793
|
this.prefetchRoute();
|
|
1754
1794
|
}, { once: !0 });
|
|
1755
1795
|
}
|
|
1756
1796
|
updateState() {
|
|
1757
|
-
const t =
|
|
1797
|
+
const t = bt();
|
|
1758
1798
|
if (!t) return;
|
|
1759
1799
|
this.$data.href = t.resolve(this.$data.to);
|
|
1760
1800
|
let e = !1;
|
|
@@ -1763,8 +1803,8 @@ let At = class extends ft {
|
|
|
1763
1803
|
else {
|
|
1764
1804
|
const r = t.getCurrentRoute();
|
|
1765
1805
|
if (r) {
|
|
1766
|
-
const
|
|
1767
|
-
this.hasAttribute("exact") ? e =
|
|
1806
|
+
const o = r.fullPath;
|
|
1807
|
+
this.hasAttribute("exact") ? e = o === this.$data.to : e = o === this.$data.to || o.startsWith(this.$data.to + "/");
|
|
1768
1808
|
}
|
|
1769
1809
|
}
|
|
1770
1810
|
this.$data.isActive = e;
|
|
@@ -1774,12 +1814,12 @@ let At = class extends ft {
|
|
|
1774
1814
|
// 预加载路由的具体实现
|
|
1775
1815
|
prefetchRoute() {
|
|
1776
1816
|
if (this._prefetched || !this.hasAttribute("prefetch")) return;
|
|
1777
|
-
const t =
|
|
1817
|
+
const t = bt();
|
|
1778
1818
|
t && typeof t.prefetch == "function" && (t.prefetch(this.$data.to), this._prefetched = !0);
|
|
1779
1819
|
}
|
|
1780
1820
|
};
|
|
1781
|
-
|
|
1782
|
-
|
|
1821
|
+
Ct = nn([
|
|
1822
|
+
Jt({
|
|
1783
1823
|
tagName: "router-link",
|
|
1784
1824
|
// template 中 slot 包裹 label 作为 fallback:
|
|
1785
1825
|
// 如果有子节点,显示子节点;如果没有,显示 label 属性的内容。
|
|
@@ -1812,32 +1852,34 @@ At = Ue([
|
|
|
1812
1852
|
// 注册所有支持的 props
|
|
1813
1853
|
props: ["to", "active", "exact", "label", "custom", "activeClass", "prefetch"]
|
|
1814
1854
|
})
|
|
1815
|
-
],
|
|
1816
|
-
const
|
|
1855
|
+
], Ct);
|
|
1856
|
+
const un = Ct;
|
|
1817
1857
|
export {
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1858
|
+
w as ASTType,
|
|
1859
|
+
lt as BaseElement,
|
|
1860
|
+
Jt as CustomElement,
|
|
1861
|
+
Ye as IRRenderer,
|
|
1862
|
+
we as LIFECYCLE_ATTRS_MAP,
|
|
1863
|
+
Xe as Router,
|
|
1864
|
+
un as RouterLink,
|
|
1865
|
+
ln as RouterView,
|
|
1866
|
+
Ae as buildIR,
|
|
1867
|
+
an as clearIRCache,
|
|
1868
|
+
ce as createFunction,
|
|
1869
|
+
Ze as createRender,
|
|
1870
|
+
cn as createRouter,
|
|
1871
|
+
ye as genFunction,
|
|
1872
|
+
bt as getRouter,
|
|
1873
|
+
ve as isLifecycleKind,
|
|
1874
|
+
V as isObject,
|
|
1875
|
+
We as isProxy,
|
|
1876
|
+
be as listeners,
|
|
1877
|
+
Ee as mapAttrKeyToLifecycleKind,
|
|
1878
|
+
Ve as observe,
|
|
1879
|
+
on as parseHashUrl,
|
|
1880
|
+
_e as parseHtml,
|
|
1881
|
+
Qt as routerReady,
|
|
1882
|
+
ae as showTemplateError,
|
|
1883
|
+
Te as toRaw,
|
|
1884
|
+
Ce as transformModel
|
|
1843
1885
|
};
|