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