solely 0.1.6 → 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 +453 -450
- package/dist/index.umd.cjs +8 -8
- 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 +27 -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 Nt = (
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var re = Object.defineProperty;
|
|
2
|
+
var Nt = (n) => {
|
|
3
|
+
throw TypeError(n);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var S = (
|
|
7
|
-
var C = (
|
|
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,26 +16,26 @@ const ie = {
|
|
|
16
16
|
exprLabel: "#a0a0a0",
|
|
17
17
|
exprCode: "#5ddcff"
|
|
18
18
|
}
|
|
19
|
-
}, P =
|
|
20
|
-
function st(
|
|
19
|
+
}, P = oe.dark;
|
|
20
|
+
function st(n) {
|
|
21
21
|
let t = 0;
|
|
22
|
-
for (let e = 0; e <
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
22
|
+
for (let e = 0; e < n.length; ) {
|
|
23
|
+
const s = n.codePointAt(e);
|
|
24
|
+
if (n[e] === " ") {
|
|
25
25
|
t += 4, e++;
|
|
26
26
|
continue;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
s >= 9472 && s <= 9599 || s > 255 ? t += 2 : t += 1, e += s > 65535 ? 2 : 1;
|
|
29
29
|
}
|
|
30
30
|
return t;
|
|
31
31
|
}
|
|
32
|
-
function _t(
|
|
33
|
-
const { lineIndex: e = 0, totalLines:
|
|
34
|
-
return (
|
|
32
|
+
function _t(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);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function ae(n, t = "", e, s = "component") {
|
|
37
37
|
var et;
|
|
38
|
-
const r = (
|
|
38
|
+
const r = (n == null ? void 0 : n.message) ?? String(n), o = `%cTemplate Error%c in <${s}> → ${r}`, i = [
|
|
39
39
|
`color:${P.badgeFg};background:${P.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,
|
|
40
40
|
`color:${P.arrow};font-weight:bold;`
|
|
41
41
|
];
|
|
@@ -65,18 +65,18 @@ function oe(s, t = "", e, n = "component") {
|
|
|
65
65
|
console.log(`%c${Lt} │%c ${ht}`, g, E);
|
|
66
66
|
continue;
|
|
67
67
|
}
|
|
68
|
-
const
|
|
69
|
-
if (console.log(`%c${
|
|
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
70
|
for (let _ = 0; _ < $.length; _++) {
|
|
71
71
|
const ft = $[_], Z = u + _;
|
|
72
72
|
let dt = 0;
|
|
73
73
|
if (_ === 0)
|
|
74
74
|
dt = It;
|
|
75
75
|
else if (Z < h.length) {
|
|
76
|
-
const J = h[Z], nt = J.search(/\S/),
|
|
77
|
-
dt = st(
|
|
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
|
|
79
|
+
const ne = Math.max(1, st(ft.trim())), Pt = _t(ne, { lineIndex: _, totalLines: $.length }), Ot = Mt + " ".repeat(dt);
|
|
80
80
|
if (_ === 0)
|
|
81
81
|
console.log(`%c${Ot}%c${Pt}`, R, L);
|
|
82
82
|
else if (Z < h.length) {
|
|
@@ -96,65 +96,65 @@ function oe(s, t = "", e, n = "component") {
|
|
|
96
96
|
), console.groupEnd();
|
|
97
97
|
}
|
|
98
98
|
const mt = {};
|
|
99
|
-
function
|
|
100
|
-
const t =
|
|
99
|
+
function ce(n) {
|
|
100
|
+
const t = n.map((e) => e.replace(/[',"]/g, "")).join(",");
|
|
101
101
|
if (!mt[t]) {
|
|
102
|
-
const e =
|
|
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
|
-
mt[t] = new Function(...
|
|
107
|
+
mt[t] = new Function(...n);
|
|
108
108
|
}
|
|
109
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
|
|
117
|
-
if (!(
|
|
118
|
-
if (
|
|
115
|
+
const he = /\{\{\{\s*[\s\S]*?\s*\}\}\}/, fe = /\{\{\s*([\s\S]*?)\s*\}\}/g;
|
|
116
|
+
function de(n, t) {
|
|
117
|
+
if (!(n != null && n.trim())) return "";
|
|
118
|
+
if (he.test(n))
|
|
119
119
|
throw new Error("Illegal interpolation syntax: use {{ }} instead of {{{ }}}");
|
|
120
|
-
return t === "template" ?
|
|
120
|
+
return t === "template" ? n.replace(fe, (e, s) => `\${${s.trim()}}`) : n;
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
const e = (
|
|
122
|
+
function pe(n, t) {
|
|
123
|
+
const e = (s) => s.endsWith(";") ? s : s + ";";
|
|
124
124
|
switch (t) {
|
|
125
125
|
case "template":
|
|
126
|
-
return `return \`${
|
|
126
|
+
return `return \`${n}\`;`;
|
|
127
127
|
case "expression":
|
|
128
|
-
return `return (${
|
|
128
|
+
return `return (${n});`;
|
|
129
129
|
case "handler":
|
|
130
130
|
case "lifecycle":
|
|
131
|
-
return e(
|
|
131
|
+
return e(n);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
if (!
|
|
136
|
-
const t =
|
|
134
|
+
function me(n) {
|
|
135
|
+
if (!n.length) return { loopValues: "", loopIndices: "" };
|
|
136
|
+
const t = n.map((s) => s.item).join(", "), e = n.map((s) => s.index).join(", ");
|
|
137
137
|
return {
|
|
138
138
|
loopValues: `var [${t}] = loops.map(l => l.itmVal);`,
|
|
139
139
|
loopIndices: `var [${e}] = loops.map(l => l.idxVal);`
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
const r =
|
|
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
150
|
return r.push(i), r;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
if (!(
|
|
154
|
-
const
|
|
155
|
-
return
|
|
152
|
+
function ye(n, t, e) {
|
|
153
|
+
if (!(n != null && n.trim())) 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,9 +217,9 @@ const ye = /* @__PURE__ */ new Set([
|
|
|
217
217
|
"ontoggle",
|
|
218
218
|
"onvolumechange",
|
|
219
219
|
"onwaiting"
|
|
220
|
-
]), V = (
|
|
221
|
-
if (
|
|
222
|
-
const t = Object.prototype.toString.call(
|
|
220
|
+
]), V = (n) => {
|
|
221
|
+
if (n === null || typeof n != "object") return !1;
|
|
222
|
+
const t = Object.prototype.toString.call(n);
|
|
223
223
|
return ![
|
|
224
224
|
"[object Function]",
|
|
225
225
|
"[object Date]",
|
|
@@ -230,74 +230,74 @@ const ye = /* @__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
|
-
typeof
|
|
235
|
+
typeof n == "string" ? t = new URL(n).hash : t = n.hash;
|
|
236
236
|
const e = t.split("?");
|
|
237
|
-
let
|
|
237
|
+
let s = e[0];
|
|
238
238
|
const r = e[1], o = {};
|
|
239
|
-
return
|
|
239
|
+
return s = s.replace(/^#\/?/, ""), r && r.split("&").forEach((i) => {
|
|
240
240
|
const [l, a] = i.split("=");
|
|
241
241
|
l && a && (o[decodeURIComponent(l)] = decodeURIComponent(a));
|
|
242
242
|
}), {
|
|
243
|
-
path:
|
|
243
|
+
path: s.split("/").filter(Boolean),
|
|
244
244
|
// 将路径分割成数组并过滤空字符串
|
|
245
245
|
query: o
|
|
246
246
|
// 查询参数对象
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
|
-
var w = /* @__PURE__ */ ((
|
|
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
|
|
260
|
-
return
|
|
259
|
+
function ve(n) {
|
|
260
|
+
return n === "mounted" || n === "updated" || n === "unmounted";
|
|
261
261
|
}
|
|
262
|
-
const wt = Symbol.for("solely.irMeta"), Y = process.env.NODE_ENV !== "production",
|
|
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;
|
|
273
273
|
if (t)
|
|
274
274
|
(e = this.compilers.get(t)) == null || e.clear(), this.compilers.delete(t);
|
|
275
275
|
else {
|
|
276
|
-
for (const
|
|
276
|
+
for (const s of this.compilers.values()) s.clear();
|
|
277
277
|
this.compilers.clear();
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
const
|
|
282
|
-
class
|
|
281
|
+
const Gt = new xe();
|
|
282
|
+
class Se {
|
|
283
283
|
constructor() {
|
|
284
284
|
S(this, "cache", /* @__PURE__ */ new Map());
|
|
285
285
|
S(this, "functions", []);
|
|
286
286
|
}
|
|
287
287
|
// 缓存 key 生成优化:避免每次都重新分配数组
|
|
288
|
-
makeCacheKey(t, e,
|
|
289
|
-
if (
|
|
290
|
-
const r =
|
|
288
|
+
makeCacheKey(t, e, s) {
|
|
289
|
+
if (s.length === 0) return `${t}:${e}`;
|
|
290
|
+
const r = s.map((o) => Object.keys(o).sort().join(",")).join(";");
|
|
291
291
|
return `${t}:${e}:${r}`;
|
|
292
292
|
}
|
|
293
|
-
compile(t, e,
|
|
293
|
+
compile(t, e, s) {
|
|
294
294
|
const r = e == null ? void 0 : e.trim();
|
|
295
295
|
if (!r) return 0;
|
|
296
|
-
const o = this.makeCacheKey(t, r,
|
|
296
|
+
const o = this.makeCacheKey(t, r, s), i = this.cache.get(o);
|
|
297
297
|
if (i !== void 0) return i;
|
|
298
298
|
let l;
|
|
299
299
|
try {
|
|
300
|
-
l =
|
|
300
|
+
l = ye(r, t, s);
|
|
301
301
|
} catch (c) {
|
|
302
302
|
Y && console.error(`[IR Compile Error] Type: ${t}, Expr: "${r}"`, c), l = () => "";
|
|
303
303
|
}
|
|
@@ -314,29 +314,29 @@ class xe {
|
|
|
314
314
|
this.cache.clear(), this.functions = [];
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
|
-
function
|
|
318
|
-
const t =
|
|
319
|
-
return t === ":" ? { isDynamic: !0, type: "expression" } : t === "@" ? { isDynamic: !0, type: "handler" } :
|
|
317
|
+
function qt(n) {
|
|
318
|
+
const t = n[0];
|
|
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
|
|
321
|
+
function ke(n) {
|
|
322
|
+
return n ? $e.test(n) : !1;
|
|
323
323
|
}
|
|
324
|
-
function Et(
|
|
325
|
-
Y && (
|
|
324
|
+
function Et(n, t, e) {
|
|
325
|
+
Y && (n[wt] = { expr: t ?? "", loc: e ?? null });
|
|
326
326
|
}
|
|
327
|
-
function
|
|
328
|
-
if (!
|
|
329
|
-
const t =
|
|
327
|
+
function Ce(n) {
|
|
328
|
+
if (!n.attrs) return;
|
|
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.", ""),
|
|
332
|
-
|
|
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
|
+
n.attrs = n.attrs.filter((a) => a !== t);
|
|
333
333
|
const l = (a, c, h) => {
|
|
334
334
|
var u;
|
|
335
|
-
(u =
|
|
335
|
+
(u = n.attrs) == null || u.push({ key: a, value: c, role: h, loc: s });
|
|
336
336
|
};
|
|
337
337
|
if (r === "input") {
|
|
338
338
|
if (i === "checkbox") {
|
|
339
|
-
const a =
|
|
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
340
|
l(":checked", h);
|
|
341
341
|
const u = `
|
|
342
342
|
const _v = ${c};
|
|
@@ -351,7 +351,7 @@ function ke(s) {
|
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
353
353
|
if (i === "radio") {
|
|
354
|
-
const a =
|
|
354
|
+
const a = n.attrs.find((h) => h.key === "value"), c = (a == null ? void 0 : a.value) ?? "null";
|
|
355
355
|
l(":checked", `${e} == ${JSON.stringify(c)}`), l("@change", `if (checked) ${e} = ${JSON.stringify(c)}`, "model");
|
|
356
356
|
return;
|
|
357
357
|
}
|
|
@@ -363,7 +363,7 @@ function ke(s) {
|
|
|
363
363
|
return;
|
|
364
364
|
}
|
|
365
365
|
if (r === "select") {
|
|
366
|
-
|
|
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);
|
|
@@ -372,67 +372,67 @@ function ke(s) {
|
|
|
372
372
|
}
|
|
373
373
|
l(":value", e), l("@input", `${e} = $event`, "model");
|
|
374
374
|
}
|
|
375
|
-
function ot(
|
|
376
|
-
if (!
|
|
375
|
+
function ot(n, t, e, s = null) {
|
|
376
|
+
if (!n.attrs || n.attrs.length === 0) return [];
|
|
377
377
|
const r = [];
|
|
378
|
-
for (const o of
|
|
379
|
-
if (
|
|
380
|
-
const { key: i, value: l, role: a } = o, { isDynamic: c, type: h } =
|
|
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
381
|
if (c && h) {
|
|
382
382
|
const u = e.compile(h, l ?? "", t), p = { key: i, fid: u, dynamic: 1, role: a };
|
|
383
|
-
Et(p, l, o.loc ??
|
|
383
|
+
Et(p, l, o.loc ?? n.loc), r.push(p);
|
|
384
384
|
} else
|
|
385
385
|
r.push({ key: i, value: l, dynamic: 0, role: a });
|
|
386
386
|
}
|
|
387
387
|
return r;
|
|
388
388
|
}
|
|
389
|
-
function
|
|
389
|
+
function Re(n, t, e) {
|
|
390
390
|
var o, i, l, a, c, h;
|
|
391
|
-
const
|
|
391
|
+
const s = { type: n.type, dynamic: 0 };
|
|
392
392
|
let r = !1;
|
|
393
|
-
switch (
|
|
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
394
|
case w.Text: {
|
|
395
|
-
const u =
|
|
396
|
-
r ? (
|
|
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
399
|
case w.Element: {
|
|
400
|
-
|
|
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
403
|
case w.For: {
|
|
404
|
-
const u = (i =
|
|
405
|
-
|
|
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
406
|
const v = /* @__PURE__ */ new Set(["each", "item", "index"]);
|
|
407
|
-
|
|
408
|
-
const f = [...t, { item:
|
|
409
|
-
|
|
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
412
|
case w.If:
|
|
413
413
|
case w.ElseIf:
|
|
414
414
|
case w.Else: {
|
|
415
|
-
Y && console.warn(`[IR] Orphaned conditional node found: ${w[
|
|
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
418
|
case w.Comment: {
|
|
419
|
-
|
|
419
|
+
s.txt = n.content ?? "";
|
|
420
420
|
break;
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
|
-
return
|
|
423
|
+
return s;
|
|
424
424
|
}
|
|
425
|
-
function X(
|
|
425
|
+
function X(n, t, e) {
|
|
426
426
|
var o;
|
|
427
|
-
const
|
|
427
|
+
const s = [];
|
|
428
428
|
let r = 0;
|
|
429
|
-
for (; r <
|
|
430
|
-
const i =
|
|
429
|
+
for (; r < n.length; ) {
|
|
430
|
+
const i = n[r];
|
|
431
431
|
if (i.type === w.If) {
|
|
432
432
|
const l = [];
|
|
433
433
|
let a = r;
|
|
434
|
-
for (; a <
|
|
435
|
-
const c =
|
|
434
|
+
for (; a < n.length; ) {
|
|
435
|
+
const c = n[a], h = c.type;
|
|
436
436
|
if (h !== w.If && h !== w.ElseIf && h !== w.Else || h === w.If && l.length > 0)
|
|
437
437
|
break;
|
|
438
438
|
let u = null, p = "", v = null;
|
|
@@ -450,21 +450,21 @@ function X(s, t, e) {
|
|
|
450
450
|
[wt]: Y ? { expr: p, loc: v } : void 0
|
|
451
451
|
}), a++, h === w.Else) break;
|
|
452
452
|
}
|
|
453
|
-
|
|
453
|
+
s.push({
|
|
454
454
|
type: w.Conditional,
|
|
455
455
|
dynamic: 1,
|
|
456
456
|
branches: l,
|
|
457
457
|
...Y && { [wt]: { loc: i.loc } }
|
|
458
458
|
}), r = a;
|
|
459
459
|
} else
|
|
460
|
-
|
|
460
|
+
s.push(Re(i, t, e)), r++;
|
|
461
461
|
}
|
|
462
|
-
return
|
|
462
|
+
return s;
|
|
463
463
|
}
|
|
464
|
-
function
|
|
465
|
-
const { filename: e = "anonymous", source:
|
|
464
|
+
function Ae(n, t = {}) {
|
|
465
|
+
const { filename: e = "anonymous", source: s } = t, r = Gt.get(e);
|
|
466
466
|
r.clear();
|
|
467
|
-
const o = performance.now(), i = X(
|
|
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
|
|
@@ -479,19 +479,19 @@ function Re(s, t = {}) {
|
|
|
479
479
|
},
|
|
480
480
|
metadata: {
|
|
481
481
|
compiledAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
482
|
-
astSize:
|
|
482
|
+
astSize: n.length,
|
|
483
483
|
filename: e,
|
|
484
|
-
...
|
|
484
|
+
...s && { source: s }
|
|
485
485
|
}
|
|
486
486
|
};
|
|
487
487
|
return Y && console.log(
|
|
488
488
|
`[IRBuilder] ${e} | ${(l - o).toFixed(2)}ms | Nodes: ${i.length} | Fns: ${a.total}`
|
|
489
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,18 +506,18 @@ const Ae = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, Le = /* @__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
|
-
let
|
|
513
|
-
const r =
|
|
514
|
-
for (; (
|
|
515
|
-
const i =
|
|
512
|
+
let s;
|
|
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
516
|
if (!i) continue;
|
|
517
|
-
const l =
|
|
517
|
+
const l = s[2] ?? s[3] ?? s[4] ?? "";
|
|
518
518
|
let a = i;
|
|
519
|
-
|
|
520
|
-
const c =
|
|
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
521
|
let u;
|
|
522
522
|
if (h === -1)
|
|
523
523
|
u = c.indexOf(i) + i.length;
|
|
@@ -535,16 +535,16 @@ function Me(s, t) {
|
|
|
535
535
|
u = y;
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
let p =
|
|
539
|
-
const f =
|
|
538
|
+
let p = s.index + u + o;
|
|
539
|
+
const f = n.slice(0, p).split(`
|
|
540
540
|
`), d = t[0] + f.length - 1, $ = f.length > 1 ? f[f.length - 1].length + 1 : t[1] + p;
|
|
541
541
|
e.push({ key: a, value: l, loc: [d, $] });
|
|
542
542
|
}
|
|
543
543
|
return e;
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function Oe(n, t) {
|
|
546
546
|
var i;
|
|
547
|
-
const e = ((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
550
|
for: w.For,
|
|
@@ -555,48 +555,48 @@ function Pe(s, t) {
|
|
|
555
555
|
tag: e,
|
|
556
556
|
loc: t,
|
|
557
557
|
children: [],
|
|
558
|
-
attrs:
|
|
558
|
+
attrs: s
|
|
559
559
|
};
|
|
560
560
|
}
|
|
561
|
-
function
|
|
562
|
-
const e =
|
|
563
|
-
if (
|
|
564
|
-
const i =
|
|
561
|
+
function Ne(n, t) {
|
|
562
|
+
const e = n.length;
|
|
563
|
+
if (n.startsWith("!--", t)) {
|
|
564
|
+
const i = n.indexOf("-->", t + 3);
|
|
565
565
|
return i === -1 ? -1 : i + 2;
|
|
566
566
|
}
|
|
567
|
-
if (
|
|
568
|
-
const i =
|
|
567
|
+
if (n.startsWith("![CDATA[", t)) {
|
|
568
|
+
const i = n.indexOf("]]>", t + 8);
|
|
569
569
|
return i === -1 ? -1 : i + 2;
|
|
570
570
|
}
|
|
571
|
-
if (
|
|
572
|
-
return
|
|
573
|
-
if (
|
|
574
|
-
const i =
|
|
571
|
+
if (n[t] === "!")
|
|
572
|
+
return n.indexOf(">", t + 1);
|
|
573
|
+
if (n[t] === "?") {
|
|
574
|
+
const i = n.indexOf("?>", t + 1);
|
|
575
575
|
return i === -1 ? -1 : i + 1;
|
|
576
576
|
}
|
|
577
|
-
let
|
|
577
|
+
let s = !1, r = !1, o = t;
|
|
578
578
|
for (; o < e; ) {
|
|
579
|
-
const i =
|
|
579
|
+
const i = n[o];
|
|
580
580
|
if (i === "'" && !r)
|
|
581
|
-
|
|
582
|
-
else if (i === '"' && !
|
|
581
|
+
s = !s;
|
|
582
|
+
else if (i === '"' && !s)
|
|
583
583
|
r = !r;
|
|
584
|
-
else if (i === ">" && !
|
|
584
|
+
else if (i === ">" && !s && !r)
|
|
585
585
|
return o;
|
|
586
586
|
o++;
|
|
587
587
|
}
|
|
588
588
|
return -1;
|
|
589
589
|
}
|
|
590
|
-
function
|
|
590
|
+
function _e(n) {
|
|
591
591
|
const t = [];
|
|
592
|
-
if (!
|
|
593
|
-
const e = [],
|
|
592
|
+
if (!n) return [];
|
|
593
|
+
const e = [], s = [], r = () => {
|
|
594
594
|
var c;
|
|
595
595
|
return e.length === 0 ? t : (c = e[e.length - 1]).children || (c.children = []);
|
|
596
596
|
};
|
|
597
597
|
let o = 0;
|
|
598
|
-
const i =
|
|
599
|
-
for (let c = 0; c < i; c++)
|
|
598
|
+
const i = n.length, l = [0];
|
|
599
|
+
for (let c = 0; c < i; c++) n[c] === `
|
|
600
600
|
` && l.push(c + 1);
|
|
601
601
|
function a(c) {
|
|
602
602
|
let h = 0;
|
|
@@ -605,9 +605,9 @@ function Ne(s) {
|
|
|
605
605
|
return [h + 1, c - l[h] + 1];
|
|
606
606
|
}
|
|
607
607
|
for (; o < i; ) {
|
|
608
|
-
const c =
|
|
608
|
+
const c = n.indexOf("<", o);
|
|
609
609
|
if (c === -1 || c > o) {
|
|
610
|
-
const g =
|
|
610
|
+
const g = n.substring(o, c === -1 ? void 0 : c), b = g.trim();
|
|
611
611
|
if (b) {
|
|
612
612
|
const E = g.indexOf(b), x = o + E, R = a(x);
|
|
613
613
|
r().push({
|
|
@@ -621,9 +621,9 @@ function Ne(s) {
|
|
|
621
621
|
if (c === -1) break;
|
|
622
622
|
o = c;
|
|
623
623
|
}
|
|
624
|
-
const h =
|
|
624
|
+
const h = Ne(n, o + 1);
|
|
625
625
|
if (h === -1) {
|
|
626
|
-
const g =
|
|
626
|
+
const g = n.substring(o);
|
|
627
627
|
g.trim() && r().push({
|
|
628
628
|
type: w.Text,
|
|
629
629
|
tag: "text",
|
|
@@ -633,7 +633,7 @@ function Ne(s) {
|
|
|
633
633
|
});
|
|
634
634
|
break;
|
|
635
635
|
}
|
|
636
|
-
const u =
|
|
636
|
+
const u = n.substring(o, h + 1), p = r(), v = a(o);
|
|
637
637
|
if (u.startsWith("<!--")) {
|
|
638
638
|
p.push({
|
|
639
639
|
type: w.Comment,
|
|
@@ -675,7 +675,7 @@ function Ne(s) {
|
|
|
675
675
|
continue;
|
|
676
676
|
}
|
|
677
677
|
if (u.startsWith("</")) {
|
|
678
|
-
const g =
|
|
678
|
+
const g = s.pop();
|
|
679
679
|
for (; e.length > 0; ) {
|
|
680
680
|
if ((e[e.length - 1].tag || "").toLowerCase() === (g == null ? void 0 : g.toLowerCase())) {
|
|
681
681
|
e.pop();
|
|
@@ -686,13 +686,13 @@ function Ne(s) {
|
|
|
686
686
|
o = h + 1;
|
|
687
687
|
continue;
|
|
688
688
|
}
|
|
689
|
-
const f =
|
|
689
|
+
const f = Oe(u, v);
|
|
690
690
|
p.push(f);
|
|
691
|
-
const d = f.tag || "", $ = d.toLowerCase().startsWith("script"), m = d.toLowerCase().startsWith("style"), y = u.endsWith("/>") ||
|
|
691
|
+
const d = f.tag || "", $ = d.toLowerCase().startsWith("script"), m = d.toLowerCase().startsWith("style"), y = u.endsWith("/>") || Ie.has(d.toLowerCase());
|
|
692
692
|
if (($ || m) && !y) {
|
|
693
|
-
const g = `</${d}>`, b =
|
|
693
|
+
const g = `</${d}>`, b = n.toLowerCase().indexOf(g, h + 1);
|
|
694
694
|
if (b !== -1) {
|
|
695
|
-
const E =
|
|
695
|
+
const E = n.substring(h + 1, b);
|
|
696
696
|
E.length && f.children.push({
|
|
697
697
|
type: w.Text,
|
|
698
698
|
tag: "text",
|
|
@@ -702,7 +702,7 @@ function Ne(s) {
|
|
|
702
702
|
}), o = b + g.length;
|
|
703
703
|
continue;
|
|
704
704
|
} else {
|
|
705
|
-
const E =
|
|
705
|
+
const E = n.substring(h + 1);
|
|
706
706
|
E.length && f.children.push({
|
|
707
707
|
type: w.Text,
|
|
708
708
|
tag: "text",
|
|
@@ -713,68 +713,69 @@ function Ne(s) {
|
|
|
713
713
|
continue;
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
|
-
!y && f.type !== w.Text && f.type !== w.Comment && (e.push(f),
|
|
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
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
|
|
722
|
-
if (
|
|
723
|
-
const t =
|
|
721
|
+
function Te(n) {
|
|
722
|
+
if (n && typeof n == "object") {
|
|
723
|
+
const t = n[ct];
|
|
724
724
|
if (t) return t;
|
|
725
725
|
}
|
|
726
|
-
return
|
|
726
|
+
return n;
|
|
727
727
|
}
|
|
728
|
-
|
|
729
|
-
|
|
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]);
|
|
730
731
|
}
|
|
731
|
-
const vt = (
|
|
732
|
-
if (
|
|
733
|
-
if (
|
|
734
|
-
if (Array.isArray(
|
|
735
|
-
if (e.has(
|
|
736
|
-
return e.get(
|
|
737
|
-
if (e.set(
|
|
738
|
-
if (
|
|
739
|
-
for (let r = 0; r <
|
|
740
|
-
if (!vt(
|
|
732
|
+
const vt = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
|
|
733
|
+
if (n === t) return !0;
|
|
734
|
+
if (n == null || t == null || typeof n != "object" || typeof t != "object") return n === t;
|
|
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)) {
|
|
739
|
+
if (n.length !== t.length) return !1;
|
|
740
|
+
for (let r = 0; r < n.length; r++)
|
|
741
|
+
if (!vt(n[r], t[r], e)) return !1;
|
|
741
742
|
return !0;
|
|
742
743
|
}
|
|
743
|
-
const
|
|
744
|
-
if (
|
|
745
|
-
for (const r of
|
|
744
|
+
const s = Reflect.ownKeys(n);
|
|
745
|
+
if (s.length !== Reflect.ownKeys(t).length) return !1;
|
|
746
|
+
for (const r of s) {
|
|
746
747
|
if (!Reflect.has(t, r)) return !1;
|
|
747
|
-
const o =
|
|
748
|
+
const o = n[r], i = t[r];
|
|
748
749
|
if (!vt(o, i, e)) return !1;
|
|
749
750
|
}
|
|
750
751
|
return !0;
|
|
751
|
-
},
|
|
752
|
+
}, Ft = (n) => {
|
|
752
753
|
const t = [];
|
|
753
|
-
let e =
|
|
754
|
+
let e = n;
|
|
754
755
|
for (; e; ) {
|
|
755
|
-
const
|
|
756
|
-
if (!
|
|
757
|
-
t.unshift(
|
|
756
|
+
const s = At.get(e);
|
|
757
|
+
if (!s || s.key == null) break;
|
|
758
|
+
t.unshift(s.key), e = s.parent;
|
|
758
759
|
}
|
|
759
760
|
return t;
|
|
760
|
-
},
|
|
761
|
+
}, De = (n) => n.map((t) => {
|
|
761
762
|
if (t === "") return /^.*$/;
|
|
762
763
|
const e = t.replace(/\./g, "\\.").replace(/\*\*/g, "(.+)").replace(/\*/g, "[^.]+").replace(/\[\d+\]/g, "\\[\\d+\\]");
|
|
763
764
|
return new RegExp(`^${e}$`);
|
|
764
|
-
}),
|
|
765
|
+
}), Fe = (n, t) => {
|
|
765
766
|
if (t.length === 0) return !0;
|
|
766
|
-
const e =
|
|
767
|
-
return t.some((
|
|
768
|
-
}, N = (
|
|
769
|
-
const e =
|
|
770
|
-
let
|
|
771
|
-
for (;
|
|
772
|
-
const r = F.get(
|
|
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);
|
|
773
774
|
r && r.forEach((i) => {
|
|
774
775
|
var h;
|
|
775
776
|
if (!i.active) return;
|
|
776
|
-
const l =
|
|
777
|
-
if (!
|
|
777
|
+
const l = Ft(s), a = [...l, ...e.slice(l.length)];
|
|
778
|
+
if (!Fe(a, i.filterRegexes)) return;
|
|
778
779
|
const c = { ...t, path: a };
|
|
779
780
|
i.throttle > 0 ? (i.pending.push(c), i.timer || (i.timer = setTimeout(() => {
|
|
780
781
|
var p;
|
|
@@ -783,15 +784,15 @@ const vt = (s, t, e = /* @__PURE__ */ new WeakMap()) => {
|
|
|
783
784
|
i.pending = [], i.timer = null, u.length > 0 && ((p = i.onBatch) == null || p.call(i, u), u.forEach((v) => i.callback(v)));
|
|
784
785
|
}, i.throttle))) : ((h = i.onBatch) == null || h.call(i, [c]), i.callback(c));
|
|
785
786
|
});
|
|
786
|
-
const o = At.get(
|
|
787
|
-
|
|
787
|
+
const o = At.get(s);
|
|
788
|
+
s = (o == null ? void 0 : o.parent) || null;
|
|
788
789
|
}
|
|
789
790
|
};
|
|
790
|
-
function
|
|
791
|
-
const { throttle:
|
|
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 = {
|
|
792
793
|
callback: t,
|
|
793
794
|
onBatch: r,
|
|
794
|
-
throttle:
|
|
795
|
+
throttle: s,
|
|
795
796
|
filterRegexes: a,
|
|
796
797
|
pending: [],
|
|
797
798
|
timer: null,
|
|
@@ -829,11 +830,11 @@ function Fe(s, t, e = {}) {
|
|
|
829
830
|
}), ["indexOf", "lastIndexOf", "includes"].forEach((m) => {
|
|
830
831
|
$[m] = function(y, ...g) {
|
|
831
832
|
let b = f[m].apply(f, [y, ...g]);
|
|
832
|
-
return (b === -1 || b === !1) &&
|
|
833
|
+
return (b === -1 || b === !1) && We(y) && (b = f[m].apply(f, [Te(y), ...g])), b;
|
|
833
834
|
};
|
|
834
835
|
}), $;
|
|
835
836
|
}, u = (f, d, $) => {
|
|
836
|
-
if (!Object.isExtensible(f) || f[ct])
|
|
837
|
+
if (!Object.isExtensible(f) || Dt(f) || f[ct])
|
|
837
838
|
return f;
|
|
838
839
|
const m = Tt.get(f);
|
|
839
840
|
if (m)
|
|
@@ -847,7 +848,7 @@ function Fe(s, t, e = {}) {
|
|
|
847
848
|
return Reflect.get(L, E, x);
|
|
848
849
|
}
|
|
849
850
|
const R = Reflect.get(b, E, x);
|
|
850
|
-
return typeof E == "symbol" ? R : V(R) ? u(R, g, E) : R;
|
|
851
|
+
return typeof E == "symbol" ? R : V(R) && !Dt(R) ? u(R, g, E) : R;
|
|
851
852
|
},
|
|
852
853
|
set(b, E, x, R) {
|
|
853
854
|
const L = b[E];
|
|
@@ -862,7 +863,7 @@ function Fe(s, t, e = {}) {
|
|
|
862
863
|
}
|
|
863
864
|
}, g = new Proxy(f, y);
|
|
864
865
|
return Tt.set(f, g), At.set(g, { parent: d, key: $ }), Array.isArray(f) && Wt.set(g, h(f, g)), g;
|
|
865
|
-
}, p = u(
|
|
866
|
+
}, p = u(n, null, null);
|
|
866
867
|
let v = F.get(p);
|
|
867
868
|
if (v || (v = /* @__PURE__ */ new Set(), F.set(p, v)), v.add(c), o) {
|
|
868
869
|
const f = (d, $, m = /* @__PURE__ */ new WeakSet()) => {
|
|
@@ -871,7 +872,7 @@ function Fe(s, t, e = {}) {
|
|
|
871
872
|
V(g) && m.has(g) || (N($, { type: "set", key: y, newValue: g, oldValue: void 0 }), V(g) && f(g, u(g, $, y), m));
|
|
872
873
|
}));
|
|
873
874
|
};
|
|
874
|
-
f(
|
|
875
|
+
f(n, p);
|
|
875
876
|
}
|
|
876
877
|
return {
|
|
877
878
|
proxy: p,
|
|
@@ -894,89 +895,89 @@ function Fe(s, t, e = {}) {
|
|
|
894
895
|
}
|
|
895
896
|
};
|
|
896
897
|
}
|
|
897
|
-
const rt = Symbol("solely.irCtx"), it = Symbol("solely.irEvents"), O = Symbol.for("solely.irMeta"), gt = Symbol("solely.prevClassObj"), yt = Symbol("solely.prevStyleObj"),
|
|
898
|
+
const rt = Symbol("solely.irCtx"), it = Symbol("solely.irEvents"), O = Symbol.for("solely.irMeta"), gt = Symbol("solely.prevClassObj"), yt = Symbol("solely.prevStyleObj"), Be = {
|
|
898
899
|
xml: "http://www.w3.org/XML/1998/namespace",
|
|
899
900
|
xlink: "http://www.w3.org/1999/xlink",
|
|
900
901
|
xmlns: "http://www.w3.org/2000/xmlns/"
|
|
901
|
-
},
|
|
902
|
+
}, Vt = {
|
|
902
903
|
readonly: "readOnly",
|
|
903
904
|
for: "htmlFor",
|
|
904
905
|
tabindex: "tabIndex",
|
|
905
906
|
contenteditable: "contentEditable",
|
|
906
907
|
maxlength: "maxLength"
|
|
907
|
-
}, je = /* @__PURE__ */ new Set(["data-", "aria-", "role", "form"]),
|
|
908
|
+
}, je = /* @__PURE__ */ new Set(["data-", "aria-", "role", "form"]), Ge = /* @__PURE__ */ new Set([
|
|
908
909
|
"value",
|
|
909
910
|
"selectedIndex"
|
|
910
911
|
]);
|
|
911
|
-
function
|
|
912
|
-
var
|
|
913
|
-
const e = (
|
|
914
|
-
e != null && e.value &&
|
|
912
|
+
function qe(n, t) {
|
|
913
|
+
var s;
|
|
914
|
+
const e = (s = t.attrs) == null ? void 0 : s.find((r) => r.key === "class" && !r.dynamic);
|
|
915
|
+
e != null && e.value && n.setAttribute("class", e.value);
|
|
915
916
|
}
|
|
916
|
-
function
|
|
917
|
+
function ze(n, t) {
|
|
917
918
|
var o;
|
|
918
|
-
if (!
|
|
919
|
-
const
|
|
919
|
+
if (!n.style) return;
|
|
920
|
+
const s = (o = t.attrs) == null ? void 0 : o.find((i) => i.key === "style" && !i.dynamic), r = s ? zt(s.value) : {};
|
|
920
921
|
for (const i in r) {
|
|
921
922
|
const l = r[i];
|
|
922
|
-
i.startsWith("--") ?
|
|
923
|
+
i.startsWith("--") ? n.style.setProperty(i, l) : n.style[i] = l;
|
|
923
924
|
}
|
|
924
925
|
}
|
|
925
|
-
const
|
|
926
|
-
const e =
|
|
926
|
+
const Ue = (n, t) => {
|
|
927
|
+
const e = n, s = zt(t), r = e[yt];
|
|
927
928
|
if (!r) {
|
|
928
|
-
for (const i in
|
|
929
|
-
const l =
|
|
930
|
-
i.startsWith("--") ?
|
|
929
|
+
for (const i in s) {
|
|
930
|
+
const l = s[i];
|
|
931
|
+
i.startsWith("--") ? n.style.setProperty(i, l) : n.style[i] = l;
|
|
931
932
|
}
|
|
932
|
-
e[yt] =
|
|
933
|
+
e[yt] = s;
|
|
933
934
|
return;
|
|
934
935
|
}
|
|
935
936
|
let o = !1;
|
|
936
937
|
for (const i in r)
|
|
937
|
-
i in
|
|
938
|
-
for (const i in
|
|
939
|
-
const l =
|
|
940
|
-
l !== a && (i.startsWith("--") ?
|
|
941
|
-
}
|
|
942
|
-
o && (e[yt] =
|
|
943
|
-
},
|
|
944
|
-
const e =
|
|
945
|
-
if (!
|
|
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);
|
|
942
|
+
}
|
|
943
|
+
o && (e[yt] = s);
|
|
944
|
+
}, Ke = (n, t) => {
|
|
945
|
+
const e = n, s = e[gt], r = He(t);
|
|
946
|
+
if (!s) {
|
|
946
947
|
for (const i in r)
|
|
947
|
-
|
|
948
|
+
n.classList.add(i);
|
|
948
949
|
e[gt] = r;
|
|
949
950
|
return;
|
|
950
951
|
}
|
|
951
952
|
let o = !1;
|
|
952
|
-
for (const i in
|
|
953
|
-
r[i] || (
|
|
953
|
+
for (const i in s)
|
|
954
|
+
r[i] || (n.classList.remove(i), o = !0);
|
|
954
955
|
for (const i in r)
|
|
955
|
-
|
|
956
|
+
s[i] || (n.classList.add(i), o = !0);
|
|
956
957
|
o && (e[gt] = r);
|
|
957
958
|
};
|
|
958
|
-
function
|
|
959
|
-
const t = {}, e = [[
|
|
959
|
+
function zt(n) {
|
|
960
|
+
const t = {}, e = [[n]];
|
|
960
961
|
for (; e.length; ) {
|
|
961
|
-
const [
|
|
962
|
-
if (
|
|
963
|
-
if (typeof
|
|
962
|
+
const [s, r] = e.pop();
|
|
963
|
+
if (s) {
|
|
964
|
+
if (typeof s == "string") {
|
|
964
965
|
const o = /([^:;]+)\s*:\s*([^;]*\(.*?\)[^;]*|[^;]+)/g;
|
|
965
966
|
let i;
|
|
966
|
-
for (; (i = o.exec(
|
|
967
|
+
for (; (i = o.exec(s)) !== null; ) {
|
|
967
968
|
const l = i[1].trim(), a = i[2].trim();
|
|
968
969
|
l && a && (t[l] = a);
|
|
969
970
|
}
|
|
970
971
|
continue;
|
|
971
972
|
}
|
|
972
|
-
if (Array.isArray(
|
|
973
|
-
for (let o =
|
|
974
|
-
e.push([
|
|
973
|
+
if (Array.isArray(s)) {
|
|
974
|
+
for (let o = s.length - 1; o >= 0; o--)
|
|
975
|
+
e.push([s[o]]);
|
|
975
976
|
continue;
|
|
976
977
|
}
|
|
977
|
-
if (typeof
|
|
978
|
-
for (const o in
|
|
979
|
-
const i =
|
|
978
|
+
if (typeof s == "object")
|
|
979
|
+
for (const o in s) {
|
|
980
|
+
const i = s[o];
|
|
980
981
|
if (i == null) continue;
|
|
981
982
|
const l = r ? `${r}-${o}` : o;
|
|
982
983
|
typeof i == "object" && !Array.isArray(i) ? e.push([i, l]) : t[l] = String(i);
|
|
@@ -985,112 +986,112 @@ function qt(s) {
|
|
|
985
986
|
}
|
|
986
987
|
return t;
|
|
987
988
|
}
|
|
988
|
-
function
|
|
989
|
-
const t = {}, e = [
|
|
989
|
+
function He(n) {
|
|
990
|
+
const t = {}, e = [n];
|
|
990
991
|
for (; e.length; ) {
|
|
991
|
-
const
|
|
992
|
-
if (
|
|
993
|
-
if (typeof
|
|
994
|
-
const r =
|
|
992
|
+
const s = e.pop();
|
|
993
|
+
if (s) {
|
|
994
|
+
if (typeof s == "string") {
|
|
995
|
+
const r = s.split(" ");
|
|
995
996
|
for (let o = 0; o < r.length; o++) {
|
|
996
997
|
const i = r[o].trim();
|
|
997
998
|
i && (t[i] = !0);
|
|
998
999
|
}
|
|
999
|
-
} else if (Array.isArray(
|
|
1000
|
-
for (let r =
|
|
1001
|
-
e.push(
|
|
1002
|
-
else if (typeof
|
|
1003
|
-
for (const r in
|
|
1004
|
-
|
|
1000
|
+
} else if (Array.isArray(s))
|
|
1001
|
+
for (let r = s.length - 1; r >= 0; r--)
|
|
1002
|
+
e.push(s[r]);
|
|
1003
|
+
else if (typeof s == "object")
|
|
1004
|
+
for (const r in s)
|
|
1005
|
+
s[r] && (t[r] = !0);
|
|
1005
1006
|
}
|
|
1006
1007
|
}
|
|
1007
1008
|
return t;
|
|
1008
1009
|
}
|
|
1009
|
-
function $t(
|
|
1010
|
-
const
|
|
1010
|
+
function $t(n, t, e) {
|
|
1011
|
+
const s = e == null ? "" : String(e), r = t.indexOf(":");
|
|
1011
1012
|
if (r > 0) {
|
|
1012
|
-
const o = t.slice(0, r), i =
|
|
1013
|
+
const o = t.slice(0, r), i = Be[o];
|
|
1013
1014
|
if (i) {
|
|
1014
|
-
|
|
1015
|
+
n.getAttributeNS(i, t) !== s && n.setAttributeNS(i, t, s);
|
|
1015
1016
|
return;
|
|
1016
1017
|
}
|
|
1017
1018
|
}
|
|
1018
|
-
|
|
1019
|
+
n.getAttribute(t) !== s && n.setAttribute(t, s);
|
|
1019
1020
|
}
|
|
1020
|
-
function
|
|
1021
|
-
const
|
|
1021
|
+
function Bt(n, t, e) {
|
|
1022
|
+
const s = Vt[t] || t;
|
|
1022
1023
|
if (t.startsWith("data-") || t.startsWith("aria-") || je.has(t)) {
|
|
1023
|
-
$t(
|
|
1024
|
+
$t(n, t, e);
|
|
1024
1025
|
return;
|
|
1025
1026
|
}
|
|
1026
|
-
const r =
|
|
1027
|
+
const r = n, o = r.tagName;
|
|
1027
1028
|
if (e == null) {
|
|
1028
|
-
if (typeof r[
|
|
1029
|
-
r[
|
|
1029
|
+
if (typeof r[s] == "boolean")
|
|
1030
|
+
r[s] !== !1 && (r[s] = !1);
|
|
1030
1031
|
else {
|
|
1031
|
-
const l = r[
|
|
1032
|
-
l !== "" && l !== void 0 && (r[
|
|
1032
|
+
const l = r[s];
|
|
1033
|
+
l !== "" && l !== void 0 && (r[s] = ""), n.hasAttribute(t) && n.removeAttribute(t);
|
|
1033
1034
|
}
|
|
1034
1035
|
return;
|
|
1035
1036
|
}
|
|
1036
|
-
if (
|
|
1037
|
+
if (s === "src" || s === "href") {
|
|
1037
1038
|
const l = String(e);
|
|
1038
|
-
if (r[
|
|
1039
|
+
if (r[s] === l || n.getAttribute(s) === l)
|
|
1039
1040
|
return;
|
|
1040
1041
|
}
|
|
1041
|
-
if (
|
|
1042
|
+
if (s === "value" && (o === "INPUT" || o === "TEXTAREA") && r.value === e)
|
|
1042
1043
|
return;
|
|
1043
1044
|
if (typeof e == "boolean") {
|
|
1044
|
-
if (r[
|
|
1045
|
+
if (r[s] === e)
|
|
1045
1046
|
return;
|
|
1046
|
-
r[
|
|
1047
|
+
r[s] = e;
|
|
1047
1048
|
return;
|
|
1048
1049
|
}
|
|
1049
|
-
(
|
|
1050
|
+
(n instanceof SVGElement || r.ownerSVGElement !== void 0) && !Vt[t] ? $t(n, t, e) : r[s] !== e && (r[s] = e);
|
|
1050
1051
|
}
|
|
1051
|
-
class
|
|
1052
|
-
constructor(t, e,
|
|
1052
|
+
class Ye {
|
|
1053
|
+
constructor(t, e, s = {}) {
|
|
1053
1054
|
S(this, "nodeMap", /* @__PURE__ */ new Map());
|
|
1054
1055
|
S(this, "marker", !1);
|
|
1055
|
-
this.ir = t, this.container = e, this.scope =
|
|
1056
|
+
this.ir = t, this.container = e, this.scope = s;
|
|
1056
1057
|
}
|
|
1057
|
-
evalIR(t, e,
|
|
1058
|
+
evalIR(t, e, s) {
|
|
1058
1059
|
var o;
|
|
1059
1060
|
const r = this.ir.functions[t - 1];
|
|
1060
1061
|
try {
|
|
1061
1062
|
return r ? r.apply(this.scope, e) : "";
|
|
1062
1063
|
} catch (i) {
|
|
1063
|
-
return
|
|
1064
|
+
return ae(i.message || i.toString(), ((o = this.ir.metadata) == null ? void 0 : o.source) || "", s, this.scope.tagName), "";
|
|
1064
1065
|
}
|
|
1065
1066
|
}
|
|
1066
1067
|
// ================ 创建节点 ================
|
|
1067
1068
|
createElement(t, e) {
|
|
1068
|
-
const
|
|
1069
|
-
return e instanceof SVGElement ||
|
|
1069
|
+
const s = t.tag;
|
|
1070
|
+
return e instanceof SVGElement || s === "svg" ? document.createElementNS("http://www.w3.org/2000/svg", s) : document.createElement(s);
|
|
1070
1071
|
}
|
|
1071
1072
|
createText(t, e) {
|
|
1072
|
-
const
|
|
1073
|
-
return document.createTextNode(
|
|
1073
|
+
const s = t.dynamic ? this.evalIR(t.fid, [e], t[O]) : t.txt || "";
|
|
1074
|
+
return document.createTextNode(s);
|
|
1074
1075
|
}
|
|
1075
1076
|
createComment(t, e) {
|
|
1076
|
-
const
|
|
1077
|
-
return document.createComment(
|
|
1077
|
+
const s = t.dynamic ? this.evalIR(t.fid, [e], t[O]) : t.txt || "";
|
|
1078
|
+
return document.createComment(s);
|
|
1078
1079
|
}
|
|
1079
1080
|
// ================ 属性全量应用(创建或更新时用) ================
|
|
1080
|
-
applyAttrs(t, e,
|
|
1081
|
+
applyAttrs(t, e, s, r = !1) {
|
|
1081
1082
|
const o = [], i = t;
|
|
1082
1083
|
i[rt] || (i[rt] = {
|
|
1083
1084
|
loops: null
|
|
1084
|
-
}), i[rt].loops =
|
|
1085
|
+
}), i[rt].loops = s, i[it] || (i[it] = /* @__PURE__ */ Object.create(null));
|
|
1085
1086
|
let l, a = !1, c, h = !1;
|
|
1086
1087
|
for (const u of e) {
|
|
1087
1088
|
const { key: p, fid: v, dynamic: f, value: d } = u;
|
|
1088
1089
|
if (p === ":class") {
|
|
1089
|
-
l = this.evalIR(v, [
|
|
1090
|
+
l = this.evalIR(v, [s], u[O]), a = !0;
|
|
1090
1091
|
continue;
|
|
1091
1092
|
}
|
|
1092
1093
|
if (p === ":style") {
|
|
1093
|
-
c = this.evalIR(v, [
|
|
1094
|
+
c = this.evalIR(v, [s], u[O]), h = !0;
|
|
1094
1095
|
continue;
|
|
1095
1096
|
}
|
|
1096
1097
|
if (p === "class" || p === "style")
|
|
@@ -1119,13 +1120,13 @@ class He {
|
|
|
1119
1120
|
}
|
|
1120
1121
|
if (p === "mounted") {
|
|
1121
1122
|
r || requestAnimationFrame(
|
|
1122
|
-
() => this.evalIR(v, [t,
|
|
1123
|
+
() => this.evalIR(v, [t, s], u[O])
|
|
1123
1124
|
);
|
|
1124
1125
|
continue;
|
|
1125
1126
|
}
|
|
1126
1127
|
if (p === "updated") {
|
|
1127
1128
|
r && requestAnimationFrame(
|
|
1128
|
-
() => this.evalIR(v, [t,
|
|
1129
|
+
() => this.evalIR(v, [t, s], u[O])
|
|
1129
1130
|
);
|
|
1130
1131
|
continue;
|
|
1131
1132
|
}
|
|
@@ -1133,23 +1134,23 @@ class He {
|
|
|
1133
1134
|
this.scope.$refs = this.scope.$refs || {}, this.scope.$refs[d] = t;
|
|
1134
1135
|
continue;
|
|
1135
1136
|
}
|
|
1136
|
-
const m = f ? this.evalIR(v, [
|
|
1137
|
+
const m = f ? this.evalIR(v, [s], u[O]) : d ?? "";
|
|
1137
1138
|
if ($ === ":") {
|
|
1138
1139
|
const y = p.slice(1);
|
|
1139
|
-
t.tagName === "SELECT" &&
|
|
1140
|
+
t.tagName === "SELECT" && Ge.has(y) ? o.push(() => Bt(t, y, m)) : Bt(t, y, m);
|
|
1140
1141
|
} else r || $t(t, p, String(m));
|
|
1141
1142
|
}
|
|
1142
|
-
return a &&
|
|
1143
|
+
return a && Ke(t, l), h && Ue(t, c), o;
|
|
1143
1144
|
}
|
|
1144
1145
|
// ================ 更新已有节点 Text Or Comment ================
|
|
1145
|
-
updateNode(t, e,
|
|
1146
|
-
const r = e.dynamic ? this.evalIR(e.fid, [
|
|
1146
|
+
updateNode(t, e, s) {
|
|
1147
|
+
const r = e.dynamic ? this.evalIR(e.fid, [s], e[O]) : e.txt || "";
|
|
1147
1148
|
e.dynamic && t.textContent !== r && (t.textContent = r);
|
|
1148
1149
|
}
|
|
1149
1150
|
// ================ 核心遍历 ================
|
|
1150
|
-
irToNode(t, e,
|
|
1151
|
+
irToNode(t, e, s, r, o) {
|
|
1151
1152
|
var c, h, u, p;
|
|
1152
|
-
const i =
|
|
1153
|
+
const i = s + "-" + e, l = this.nodeMap.get(i);
|
|
1153
1154
|
let a;
|
|
1154
1155
|
if (l) {
|
|
1155
1156
|
a = l.node, l.marker = this.marker;
|
|
@@ -1165,7 +1166,7 @@ class He {
|
|
|
1165
1166
|
} else
|
|
1166
1167
|
switch (t.type) {
|
|
1167
1168
|
case w.Element:
|
|
1168
|
-
a = this.createElement(t, r),
|
|
1169
|
+
a = this.createElement(t, r), qe(a, t), ze(a, t);
|
|
1169
1170
|
const v = this.applyAttrs(a, t.attrs ?? [], o);
|
|
1170
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) => {
|
|
1171
1172
|
this.irToNode(f, d, i, a, o);
|
|
@@ -1218,9 +1219,9 @@ class He {
|
|
|
1218
1219
|
cleanupOldNodes() {
|
|
1219
1220
|
for (const [t, e] of this.nodeMap.entries())
|
|
1220
1221
|
if (e.marker !== this.marker) {
|
|
1221
|
-
const { irNode:
|
|
1222
|
-
if (
|
|
1223
|
-
const i =
|
|
1222
|
+
const { irNode: s, node: r, loops: o } = e;
|
|
1223
|
+
if (s.attrs) {
|
|
1224
|
+
const i = s.attrs.find((a) => a.key === "unmounted");
|
|
1224
1225
|
i && requestAnimationFrame(() => {
|
|
1225
1226
|
this.evalIR(
|
|
1226
1227
|
i.fid,
|
|
@@ -1228,7 +1229,7 @@ class He {
|
|
|
1228
1229
|
i[O]
|
|
1229
1230
|
);
|
|
1230
1231
|
});
|
|
1231
|
-
const l =
|
|
1232
|
+
const l = s.attrs.find((a) => a.key === "ref");
|
|
1232
1233
|
l && l.value && delete this.scope.$refs[l.value];
|
|
1233
1234
|
}
|
|
1234
1235
|
r == null || r.remove(), this.nodeMap.delete(t);
|
|
@@ -1249,14 +1250,14 @@ class He {
|
|
|
1249
1250
|
this.container.innerHTML = "", this.nodeMap.clear();
|
|
1250
1251
|
}
|
|
1251
1252
|
}
|
|
1252
|
-
const
|
|
1253
|
-
const
|
|
1254
|
-
return
|
|
1255
|
-
update: () =>
|
|
1256
|
-
destroy: () =>
|
|
1253
|
+
const Ze = (n, t, e = {}) => {
|
|
1254
|
+
const s = new Ye(n, t, e);
|
|
1255
|
+
return s.mount(), {
|
|
1256
|
+
update: () => s.update(),
|
|
1257
|
+
destroy: () => s.destroy()
|
|
1257
1258
|
};
|
|
1258
1259
|
}, jt = Symbol.for("solely.manifest");
|
|
1259
|
-
var T, D, z, Q, U,
|
|
1260
|
+
var T, D, z, Q, U, B, K, H, j, tt, k, Ut, xt, Kt, Ht, St, at, Yt, Zt, kt, Rt;
|
|
1260
1261
|
class lt extends HTMLElement {
|
|
1261
1262
|
/* -------------------- 构造 -------------------- */
|
|
1262
1263
|
constructor(e = {}) {
|
|
@@ -1268,15 +1269,15 @@ class lt extends HTMLElement {
|
|
|
1268
1269
|
M(this, z);
|
|
1269
1270
|
M(this, Q);
|
|
1270
1271
|
M(this, U);
|
|
1271
|
-
M(this,
|
|
1272
|
+
M(this, B);
|
|
1272
1273
|
M(this, K, !1);
|
|
1273
1274
|
M(this, H, !1);
|
|
1274
|
-
M(this,
|
|
1275
|
+
M(this, j, !1);
|
|
1275
1276
|
M(this, tt, !1);
|
|
1276
|
-
const
|
|
1277
|
-
A(this, T,
|
|
1277
|
+
const s = this.constructor;
|
|
1278
|
+
A(this, T, s[jt] || { tagName: "base-element" });
|
|
1278
1279
|
const r = C(this, T);
|
|
1279
|
-
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,
|
|
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));
|
|
1280
1281
|
}
|
|
1281
1282
|
// 需要在元素定义前设置的属性列表(Upgrade Property)
|
|
1282
1283
|
/* -------------------- observedAttributes -------------------- */
|
|
@@ -1289,8 +1290,8 @@ class lt extends HTMLElement {
|
|
|
1289
1290
|
return C(this, Q);
|
|
1290
1291
|
}
|
|
1291
1292
|
set $data(e) {
|
|
1292
|
-
var
|
|
1293
|
-
V(e) || (e = {}), (
|
|
1293
|
+
var s;
|
|
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);
|
|
1294
1295
|
}
|
|
1295
1296
|
refresh() {
|
|
1296
1297
|
I(this, k, at).call(this);
|
|
@@ -1298,11 +1299,11 @@ class lt extends HTMLElement {
|
|
|
1298
1299
|
/* -------------------- 生命周期 -------------------- */
|
|
1299
1300
|
connectedCallback() {
|
|
1300
1301
|
var l;
|
|
1301
|
-
const
|
|
1302
|
+
const s = this.constructor.upgradeProps;
|
|
1302
1303
|
let r;
|
|
1303
|
-
Array.isArray(
|
|
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);
|
|
1304
1305
|
const o = C(this, T);
|
|
1305
|
-
if ((o.className || o.tagName || "").split(" ").forEach((a) => a && this.classList.add(a)), I(this, k,
|
|
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))
|
|
1306
1307
|
for (const [a, c] of o.propMap) {
|
|
1307
1308
|
const h = c.name;
|
|
1308
1309
|
if (this.hasAttribute(a)) {
|
|
@@ -1310,31 +1311,31 @@ class lt extends HTMLElement {
|
|
|
1310
1311
|
this.$data[h] = p;
|
|
1311
1312
|
} else "default" in c && (this.$data[h] = c.default);
|
|
1312
1313
|
}
|
|
1313
|
-
C(this, z) && A(this, D,
|
|
1314
|
+
C(this, z) && A(this, D, Ze(
|
|
1314
1315
|
C(this, z),
|
|
1315
1316
|
C(this, U),
|
|
1316
1317
|
this
|
|
1317
1318
|
)), this.mounted(), (l = this.onInit) == null || l.call(this);
|
|
1318
1319
|
}
|
|
1319
1320
|
disconnectedCallback() {
|
|
1320
|
-
var e,
|
|
1321
|
-
this.unmounted(), (e = C(this,
|
|
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);
|
|
1322
1323
|
}
|
|
1323
|
-
attributeChangedCallback(e,
|
|
1324
|
+
attributeChangedCallback(e, s, r) {
|
|
1324
1325
|
var h;
|
|
1325
|
-
if (
|
|
1326
|
+
if (s === r || !V(this.$data)) return;
|
|
1326
1327
|
const i = (h = C(this, T).propMap) == null ? void 0 : h.get(e);
|
|
1327
1328
|
if (!i) return;
|
|
1328
1329
|
const l = i.name, a = this.$data[l], c = I(this, k, St).call(this, r, i.default ?? a, i.type);
|
|
1329
|
-
this.$data[l] = c, A(this,
|
|
1330
|
+
this.$data[l] = c, A(this, j, !0), this.attributeChanged(e, a, c);
|
|
1330
1331
|
}
|
|
1331
1332
|
/* -------------------- 事件派发 -------------------- */
|
|
1332
|
-
emit(e,
|
|
1333
|
+
emit(e, s, r) {
|
|
1333
1334
|
this.dispatchEvent(
|
|
1334
1335
|
new CustomEvent(e, {
|
|
1335
1336
|
bubbles: !0,
|
|
1336
1337
|
composed: !0,
|
|
1337
|
-
detail:
|
|
1338
|
+
detail: s,
|
|
1338
1339
|
...r
|
|
1339
1340
|
})
|
|
1340
1341
|
);
|
|
@@ -1352,61 +1353,61 @@ class lt extends HTMLElement {
|
|
|
1352
1353
|
}
|
|
1353
1354
|
unmounted() {
|
|
1354
1355
|
}
|
|
1355
|
-
attributeChanged(e,
|
|
1356
|
+
attributeChanged(e, s, r) {
|
|
1356
1357
|
}
|
|
1357
1358
|
beforeAttributesUpdate() {
|
|
1358
1359
|
}
|
|
1359
1360
|
afterAttributesUpdate() {
|
|
1360
1361
|
}
|
|
1361
1362
|
}
|
|
1362
|
-
T = new WeakMap(), D = new WeakMap(), z = new WeakMap(), Q = new WeakMap(), U = new WeakMap(),
|
|
1363
|
-
|
|
1364
|
-
for (const
|
|
1365
|
-
if (this.hasOwnProperty(
|
|
1366
|
-
const r = this[
|
|
1367
|
-
delete this[
|
|
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) {
|
|
1365
|
+
for (const s of e)
|
|
1366
|
+
if (this.hasOwnProperty(s)) {
|
|
1367
|
+
const r = this[s];
|
|
1368
|
+
delete this[s], this[s] = r;
|
|
1368
1369
|
}
|
|
1369
1370
|
}, /* -------------------- 初始化 -------------------- */
|
|
1370
1371
|
xt = function(e) {
|
|
1371
|
-
const { proxy:
|
|
1372
|
+
const { proxy: s, dispose: r } = Ve(e, (o) => {
|
|
1372
1373
|
var i, l;
|
|
1373
1374
|
if (o.type === "set") {
|
|
1374
1375
|
const { key: a, newValue: c } = o, h = C(this, T), u = String(a), p = ((i = h.propMap) == null ? void 0 : i.get(
|
|
1375
1376
|
u.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()
|
|
1376
1377
|
)) || Array.from(((l = h.propMap) == null ? void 0 : l.values()) || []).find((v) => v.name === u);
|
|
1377
|
-
p != null && p.reflect && I(this, k,
|
|
1378
|
+
p != null && p.reflect && I(this, k, Kt).call(this, p, c);
|
|
1378
1379
|
}
|
|
1379
1380
|
this.emit("change", {
|
|
1380
1381
|
source: "state",
|
|
1381
1382
|
...o
|
|
1382
1383
|
}), I(this, k, at).call(this);
|
|
1383
1384
|
});
|
|
1384
|
-
A(this, Q,
|
|
1385
|
-
},
|
|
1385
|
+
A(this, Q, s), A(this, B, r);
|
|
1386
|
+
}, Kt = function(e, s) {
|
|
1386
1387
|
const r = e.name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
1387
1388
|
if (e.type === "boolean")
|
|
1388
|
-
|
|
1389
|
+
s ? this.setAttribute(r, "") : this.removeAttribute(r);
|
|
1389
1390
|
else {
|
|
1390
|
-
const o = typeof
|
|
1391
|
+
const o = typeof s == "object" ? JSON.stringify(s) : String(s);
|
|
1391
1392
|
this.setAttribute(r, o);
|
|
1392
1393
|
}
|
|
1393
|
-
},
|
|
1394
|
+
}, Ht = function(e) {
|
|
1394
1395
|
e.ir && A(this, z, e.ir);
|
|
1395
|
-
}, St = function(e,
|
|
1396
|
+
}, St = function(e, s, r) {
|
|
1396
1397
|
if (e === null)
|
|
1397
|
-
return r === "boolean" ?
|
|
1398
|
+
return r === "boolean" ? s ?? !1 : s;
|
|
1398
1399
|
switch (r) {
|
|
1399
1400
|
case "boolean":
|
|
1400
1401
|
return !0;
|
|
1401
1402
|
case "number": {
|
|
1402
1403
|
const o = Number(e);
|
|
1403
|
-
return isNaN(o) ?
|
|
1404
|
+
return isNaN(o) ? s : o;
|
|
1404
1405
|
}
|
|
1405
1406
|
case "object":
|
|
1406
1407
|
try {
|
|
1407
1408
|
return JSON.parse(e);
|
|
1408
1409
|
} catch {
|
|
1409
|
-
return
|
|
1410
|
+
return s;
|
|
1410
1411
|
}
|
|
1411
1412
|
default:
|
|
1412
1413
|
return e;
|
|
@@ -1414,19 +1415,19 @@ xt = function(e) {
|
|
|
1414
1415
|
}, /* -------------------- 刷新调度 -------------------- */
|
|
1415
1416
|
at = function() {
|
|
1416
1417
|
C(this, H) || !C(this, D) || (A(this, H, !0), queueMicrotask(() => {
|
|
1417
|
-
A(this, H, !1), I(this, k,
|
|
1418
|
+
A(this, H, !1), I(this, k, Yt).call(this);
|
|
1418
1419
|
}));
|
|
1419
|
-
}, Ht = function() {
|
|
1420
|
-
C(this, K) || !this.isConnected || (A(this, K, !0), C(this, B) && this.beforeAttributesUpdate(), this.beforeUpdate(), C(this, D).update(), this.updated(), C(this, B) && (this.afterAttributesUpdate(), A(this, B, !1)), A(this, K, !1));
|
|
1421
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() {
|
|
1422
1423
|
const e = C(this, T);
|
|
1423
1424
|
if (!e.styles) return;
|
|
1424
|
-
const
|
|
1425
|
-
if (e.sheet &&
|
|
1426
|
-
|
|
1425
|
+
const s = C(this, U);
|
|
1426
|
+
if (e.sheet && s instanceof ShadowRoot && "adoptedStyleSheets" in s) {
|
|
1427
|
+
s.adoptedStyleSheets.includes(e.sheet) || (s.adoptedStyleSheets = [...s.adoptedStyleSheets, e.sheet]);
|
|
1427
1428
|
return;
|
|
1428
1429
|
}
|
|
1429
|
-
const r =
|
|
1430
|
+
const r = s instanceof ShadowRoot ? s : document.head, o = `solely-style-${e.tagName}`;
|
|
1430
1431
|
if (!r.querySelector(`#${o}`)) {
|
|
1431
1432
|
const i = document.createElement("style");
|
|
1432
1433
|
i.id = o, i.textContent = e.styles, r.appendChild(i);
|
|
@@ -1436,28 +1437,28 @@ kt = function() {
|
|
|
1436
1437
|
C(this, tt) || (A(this, tt, !0), this.created());
|
|
1437
1438
|
}, Rt = new WeakMap(), S(lt, "upgradeProps"), /* -------------------- DEV define 保护 -------------------- */
|
|
1438
1439
|
M(lt, Rt, !1);
|
|
1439
|
-
const
|
|
1440
|
-
const t =
|
|
1440
|
+
const Je = Symbol.for("solely.manifest"), Jt = (n) => {
|
|
1441
|
+
const t = n;
|
|
1441
1442
|
return (e) => {
|
|
1442
|
-
const { tagName:
|
|
1443
|
-
if (customElements.get(
|
|
1443
|
+
const { tagName: s } = t;
|
|
1444
|
+
if (customElements.get(s))
|
|
1444
1445
|
return e;
|
|
1445
1446
|
if (typeof t.template == "string" && !t.ir)
|
|
1446
1447
|
try {
|
|
1447
|
-
const o =
|
|
1448
|
-
t.ir =
|
|
1448
|
+
const o = _e(t.template);
|
|
1449
|
+
t.ir = Ae(o, {
|
|
1449
1450
|
source: t.template,
|
|
1450
|
-
filename:
|
|
1451
|
+
filename: s
|
|
1451
1452
|
});
|
|
1452
1453
|
} catch (o) {
|
|
1453
|
-
console.error(`[Compiler Error] <${
|
|
1454
|
+
console.error(`[Compiler Error] <${s}>:`, o);
|
|
1454
1455
|
}
|
|
1455
1456
|
if (t.styles && !t.sheet && "CSSStyleSheet" in window)
|
|
1456
1457
|
try {
|
|
1457
1458
|
const o = new CSSStyleSheet();
|
|
1458
1459
|
o.replaceSync(t.styles), t.sheet = o;
|
|
1459
1460
|
} catch (o) {
|
|
1460
|
-
console.error(`[Style Error] <${
|
|
1461
|
+
console.error(`[Style Error] <${s}>:`, o);
|
|
1461
1462
|
}
|
|
1462
1463
|
if (t.props && !t.propMap) {
|
|
1463
1464
|
const o = /* @__PURE__ */ new Map();
|
|
@@ -1468,20 +1469,20 @@ const Ze = Symbol.for("solely.manifest"), Zt = (s) => {
|
|
|
1468
1469
|
}
|
|
1469
1470
|
class r extends e {
|
|
1470
1471
|
}
|
|
1471
|
-
return r[
|
|
1472
|
+
return r[Je] = t, customElements.define(s, r), r;
|
|
1472
1473
|
};
|
|
1473
1474
|
};
|
|
1474
|
-
let q = null,
|
|
1475
|
-
const
|
|
1476
|
-
|
|
1475
|
+
let q = null, Xt;
|
|
1476
|
+
const Qt = new Promise((n) => {
|
|
1477
|
+
Xt = n;
|
|
1477
1478
|
});
|
|
1478
|
-
function
|
|
1479
|
-
return q || (q = new
|
|
1479
|
+
function cn(n) {
|
|
1480
|
+
return q || (q = new Xe(n), Xt(q), q);
|
|
1480
1481
|
}
|
|
1481
1482
|
function bt() {
|
|
1482
1483
|
return q;
|
|
1483
1484
|
}
|
|
1484
|
-
class
|
|
1485
|
+
class Xe {
|
|
1485
1486
|
constructor(t) {
|
|
1486
1487
|
S(this, "routes");
|
|
1487
1488
|
S(this, "base");
|
|
@@ -1495,7 +1496,7 @@ class Je {
|
|
|
1495
1496
|
}
|
|
1496
1497
|
// --- 核心匹配逻辑 ---
|
|
1497
1498
|
matchRoute(t = "/") {
|
|
1498
|
-
const e = t.startsWith("/") ? t : "/" + t, [
|
|
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);
|
|
1499
1500
|
if (l) {
|
|
1500
1501
|
const a = l.matched[l.matched.length - 1];
|
|
1501
1502
|
return a.config.redirect ? this.matchRoute(a.config.redirect) : {
|
|
@@ -1512,8 +1513,8 @@ class Je {
|
|
|
1512
1513
|
return null;
|
|
1513
1514
|
}
|
|
1514
1515
|
recursiveMatch(t, e) {
|
|
1515
|
-
const
|
|
1516
|
-
for (const r of
|
|
1516
|
+
const s = [...t].sort((r, o) => this.calculateScore(o.path) - this.calculateScore(r.path));
|
|
1517
|
+
for (const r of s) {
|
|
1517
1518
|
const o = r.path.split("/").filter(Boolean), i = {};
|
|
1518
1519
|
let l = !0;
|
|
1519
1520
|
if (o.length === 0 && e.length === 0)
|
|
@@ -1558,7 +1559,7 @@ class Je {
|
|
|
1558
1559
|
}
|
|
1559
1560
|
calculateScore(t = "/") {
|
|
1560
1561
|
const e = t.split("/").filter(Boolean);
|
|
1561
|
-
return e.length === 0 ? 1 : e.reduce((
|
|
1562
|
+
return e.length === 0 ? 1 : e.reduce((s, r) => r.startsWith(":") ? s + 5 : r === "*" ? s + 0 : s + 10, 0);
|
|
1562
1563
|
}
|
|
1563
1564
|
parseQuery(t) {
|
|
1564
1565
|
const e = {};
|
|
@@ -1582,18 +1583,18 @@ class Je {
|
|
|
1582
1583
|
return e !== "/" && t.startsWith(e) && (t = t.slice(e.length) || "/"), this.normalizePath(t);
|
|
1583
1584
|
}
|
|
1584
1585
|
updateBrowserHistory(t = "/", e) {
|
|
1585
|
-
const
|
|
1586
|
+
const s = this.normalizePath(t), r = this.base || "/";
|
|
1586
1587
|
if (this.mode === "hash")
|
|
1587
|
-
e ? window.location.replace(`#${
|
|
1588
|
+
e ? window.location.replace(`#${s}`) : window.location.hash = s;
|
|
1588
1589
|
else {
|
|
1589
|
-
const o = r.endsWith("/") ? r.slice(0, -1) : r, i = o === "/" ?
|
|
1590
|
+
const o = r.endsWith("/") ? r.slice(0, -1) : r, i = o === "/" ? s : o + s;
|
|
1590
1591
|
e ? window.history.replaceState({ path: i }, "", i) : window.history.pushState({ path: i }, "", i);
|
|
1591
1592
|
}
|
|
1592
1593
|
}
|
|
1593
1594
|
/**
|
|
1594
1595
|
* @param fromEvent 标志位:是否由浏览器 popstate 事件触发
|
|
1595
1596
|
*/
|
|
1596
|
-
async navigate(t = "/", e = !1,
|
|
1597
|
+
async navigate(t = "/", e = !1, s = !1) {
|
|
1597
1598
|
const r = this.normalizePath(t), o = this.currentRoute, i = this.matchRoute(r);
|
|
1598
1599
|
if (!i) return { success: !1, error: `No route matched: ${r}` };
|
|
1599
1600
|
if (o && o.fullPath === i.fullPath) return { success: !0 };
|
|
@@ -1605,7 +1606,7 @@ class Je {
|
|
|
1605
1606
|
} catch (l) {
|
|
1606
1607
|
return { success: !1, error: l instanceof Error ? l.message : "Guard Error" };
|
|
1607
1608
|
}
|
|
1608
|
-
return this.currentRoute = i,
|
|
1609
|
+
return this.currentRoute = i, s || this.updateBrowserHistory(r, e), this.notifyListeners(), this.afterEachGuard && this.afterEachGuard(i, o), { success: !0 };
|
|
1609
1610
|
}
|
|
1610
1611
|
// --- 路径解析逻辑 ---
|
|
1611
1612
|
/**
|
|
@@ -1615,8 +1616,8 @@ class Je {
|
|
|
1615
1616
|
resolve(t = "/") {
|
|
1616
1617
|
const e = this.normalizePath(t);
|
|
1617
1618
|
if (this.mode === "hash") return `#${e}`;
|
|
1618
|
-
const
|
|
1619
|
-
return
|
|
1619
|
+
const s = this.base.endsWith("/") ? this.base.slice(0, -1) : this.base;
|
|
1620
|
+
return s === "/" ? e : s + e;
|
|
1620
1621
|
}
|
|
1621
1622
|
/**
|
|
1622
1623
|
* 获取当前模式(供外部组件判断,如 RouterLink)
|
|
@@ -1625,8 +1626,8 @@ class Je {
|
|
|
1625
1626
|
return this.mode;
|
|
1626
1627
|
}
|
|
1627
1628
|
pushWithQuery(t = "/", e) {
|
|
1628
|
-
const
|
|
1629
|
-
return this.push(t + (
|
|
1629
|
+
const s = new URLSearchParams(e).toString(), r = t.includes("?") ? "&" : "?";
|
|
1630
|
+
return this.push(t + (s ? r + s : ""));
|
|
1630
1631
|
}
|
|
1631
1632
|
push(t = "/") {
|
|
1632
1633
|
return this.navigate(t, !1);
|
|
@@ -1654,9 +1655,9 @@ class Je {
|
|
|
1654
1655
|
return this.currentRoute;
|
|
1655
1656
|
}
|
|
1656
1657
|
}
|
|
1657
|
-
var
|
|
1658
|
-
for (var r =
|
|
1659
|
-
(i =
|
|
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);
|
|
1660
1661
|
return r;
|
|
1661
1662
|
};
|
|
1662
1663
|
let ut = class extends lt {
|
|
@@ -1675,7 +1676,7 @@ let ut = class extends lt {
|
|
|
1675
1676
|
/* -------------------- 生命周期 -------------------- */
|
|
1676
1677
|
async mounted() {
|
|
1677
1678
|
this.detectLevel();
|
|
1678
|
-
const t = await
|
|
1679
|
+
const t = await Qt;
|
|
1679
1680
|
this.unsubscribe = t.listen(() => {
|
|
1680
1681
|
this.scheduleLoad(t.getCurrentRoute());
|
|
1681
1682
|
}), this.loadRoute(t.getCurrentRoute());
|
|
@@ -1697,12 +1698,12 @@ let ut = class extends lt {
|
|
|
1697
1698
|
this.level = t;
|
|
1698
1699
|
}
|
|
1699
1700
|
async loadRoute(t) {
|
|
1700
|
-
const e = ++this.latestLoadId,
|
|
1701
|
-
if (!
|
|
1701
|
+
const e = ++this.latestLoadId, s = t == null ? void 0 : t.matched[this.level];
|
|
1702
|
+
if (!s) {
|
|
1702
1703
|
this.handleEmptyRoute();
|
|
1703
1704
|
return;
|
|
1704
1705
|
}
|
|
1705
|
-
const { config: r } =
|
|
1706
|
+
const { config: r } = s;
|
|
1706
1707
|
let o = r.tagName;
|
|
1707
1708
|
if (!o && typeof r.component == "function") {
|
|
1708
1709
|
this.renderLoading();
|
|
@@ -1728,15 +1729,15 @@ let ut = class extends lt {
|
|
|
1728
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();
|
|
1729
1730
|
}
|
|
1730
1731
|
getOrCreateComponent(t, e) {
|
|
1731
|
-
const
|
|
1732
|
-
if (e.keepAlive && this.cache.has(
|
|
1733
|
-
return this.cache.get(
|
|
1732
|
+
const s = t.toLowerCase();
|
|
1733
|
+
if (e.keepAlive && this.cache.has(s))
|
|
1734
|
+
return this.cache.get(s);
|
|
1734
1735
|
const r = document.createElement(t);
|
|
1735
|
-
return e.keepAlive && this.cache.set(
|
|
1736
|
+
return e.keepAlive && this.cache.set(s, r), r;
|
|
1736
1737
|
}
|
|
1737
|
-
syncState(t, e,
|
|
1738
|
+
syncState(t, e, s, r = {}) {
|
|
1738
1739
|
const o = (a) => a.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), i = /* @__PURE__ */ new Map();
|
|
1739
|
-
Object.entries(e).forEach(([a, c]) => i.set(o(a), String(c))), Object.entries(
|
|
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) => {
|
|
1740
1741
|
i.has(a) || (t.removeAttribute(a), this.routerAttrs.delete(a));
|
|
1741
1742
|
}), i.forEach((a, c) => {
|
|
1742
1743
|
t.getAttribute(c) !== a && t.setAttribute(c, a), this.routerAttrs.add(c);
|
|
@@ -1761,16 +1762,16 @@ let ut = class extends lt {
|
|
|
1761
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();
|
|
1762
1763
|
}
|
|
1763
1764
|
};
|
|
1764
|
-
ut =
|
|
1765
|
-
|
|
1765
|
+
ut = tn([
|
|
1766
|
+
Jt({
|
|
1766
1767
|
tagName: "router-view"
|
|
1767
1768
|
// 注意:删除了 shadowDOM 配置,默认为 false
|
|
1768
1769
|
})
|
|
1769
1770
|
], ut);
|
|
1770
|
-
const
|
|
1771
|
-
var
|
|
1772
|
-
for (var r =
|
|
1773
|
-
(i =
|
|
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);
|
|
1774
1775
|
return r;
|
|
1775
1776
|
};
|
|
1776
1777
|
let Ct = class extends lt {
|
|
@@ -1785,7 +1786,7 @@ let Ct = class extends lt {
|
|
|
1785
1786
|
return this.$data.to;
|
|
1786
1787
|
}
|
|
1787
1788
|
async mounted() {
|
|
1788
|
-
(await
|
|
1789
|
+
(await Qt).listen(() => this.updateState()), this.updateState(), this.addEventListener("click", (e) => {
|
|
1789
1790
|
var r, o;
|
|
1790
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));
|
|
1791
1792
|
}), this.addEventListener("mouseenter", () => {
|
|
@@ -1807,8 +1808,8 @@ let Ct = class extends lt {
|
|
|
1807
1808
|
}
|
|
1808
1809
|
}
|
|
1809
1810
|
this.$data.isActive = e;
|
|
1810
|
-
const
|
|
1811
|
-
this.classList.toggle(
|
|
1811
|
+
const s = this.$data.activeClass || "active";
|
|
1812
|
+
this.classList.toggle(s, e);
|
|
1812
1813
|
}
|
|
1813
1814
|
// 预加载路由的具体实现
|
|
1814
1815
|
prefetchRoute() {
|
|
@@ -1817,8 +1818,8 @@ let Ct = class extends lt {
|
|
|
1817
1818
|
t && typeof t.prefetch == "function" && (t.prefetch(this.$data.to), this._prefetched = !0);
|
|
1818
1819
|
}
|
|
1819
1820
|
};
|
|
1820
|
-
Ct =
|
|
1821
|
-
|
|
1821
|
+
Ct = nn([
|
|
1822
|
+
Jt({
|
|
1822
1823
|
tagName: "router-link",
|
|
1823
1824
|
// template 中 slot 包裹 label 作为 fallback:
|
|
1824
1825
|
// 如果有子节点,显示子节点;如果没有,显示 label 属性的内容。
|
|
@@ -1852,31 +1853,33 @@ Ct = en([
|
|
|
1852
1853
|
props: ["to", "active", "exact", "label", "custom", "activeClass", "prefetch"]
|
|
1853
1854
|
})
|
|
1854
1855
|
], Ct);
|
|
1855
|
-
const
|
|
1856
|
+
const un = Ct;
|
|
1856
1857
|
export {
|
|
1857
1858
|
w as ASTType,
|
|
1858
1859
|
lt as BaseElement,
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
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,
|
|
1871
1872
|
bt as getRouter,
|
|
1872
|
-
|
|
1873
|
+
ve as isLifecycleKind,
|
|
1873
1874
|
V as isObject,
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
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
|
|
1882
1885
|
};
|