@jasonshimmy/custom-elements-runtime 0.1.2 → 0.1.4
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 +1 -0
- package/dist/custom-elements-runtime.cjs.js +30 -4
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +1247 -937
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.umd.js +30 -4
- package/dist/custom-elements-runtime.umd.js.map +1 -1
- package/dist/directives.d.ts +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.spec.d.ts +1 -0
- package/dist/router.d.ts +46 -5
- package/dist/router.spec.d.ts +1 -0
- package/dist/runtime/component.d.ts +5 -0
- package/dist/runtime/helpers.d.ts +2 -0
- package/dist/runtime/lifecycle.d.ts +13 -0
- package/dist/runtime/props.d.ts +8 -0
- package/dist/runtime/render.d.ts +17 -0
- package/dist/runtime/render.spec.d.ts +1 -0
- package/dist/runtime/style.d.ts +61 -0
- package/dist/runtime/template-compiler.d.ts +26 -0
- package/dist/{runtime.d.ts → runtime/types.d.ts} +44 -31
- package/dist/runtime/vdom.d.ts +67 -0
- package/dist/runtime/vdom.edge.spec.d.ts +1 -0
- package/dist/runtime/vdom.spec.d.ts +1 -0
- package/dist/runtime/watchers.d.ts +13 -0
- package/dist/store.d.ts +2 -4
- package/package.json +5 -6
- package/dist/style-utils.d.ts +0 -11
- package/dist/template-compiler.d.ts +0 -6
- package/dist/vdom.d.ts +0 -34
|
@@ -1,20 +1,42 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
function rt(e, t) {
|
|
2
|
+
return J(e ? t : [], "when-block");
|
|
3
|
+
}
|
|
4
|
+
function nt(e, t) {
|
|
5
|
+
return e.map((r, n) => {
|
|
6
|
+
const o = typeof r == "object" ? r?.key ?? r?.id ?? `idx-${n}` : String(r);
|
|
7
|
+
return J(t(r, n), `each-${o}`);
|
|
4
8
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
}
|
|
10
|
+
function ve() {
|
|
11
|
+
const e = [];
|
|
12
|
+
return {
|
|
13
|
+
when(t, r) {
|
|
14
|
+
return e.push([t, r]), this;
|
|
15
|
+
},
|
|
16
|
+
otherwise(t) {
|
|
17
|
+
return e.push([!0, t]), this;
|
|
18
|
+
},
|
|
19
|
+
done() {
|
|
20
|
+
return xe(...e);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function xe(...e) {
|
|
25
|
+
for (let t = 0; t < e.length; t++) {
|
|
26
|
+
const [r, n] = e[t];
|
|
27
|
+
if (r) return [J(n, `whenChain-branch-${t}`)];
|
|
14
28
|
}
|
|
15
|
-
return
|
|
29
|
+
return [J([], "whenChain-empty")];
|
|
30
|
+
}
|
|
31
|
+
function J(e, t) {
|
|
32
|
+
const r = e ? Array.isArray(e) ? e.filter(Boolean) : [e].filter(Boolean) : [];
|
|
33
|
+
return {
|
|
34
|
+
tag: "#anchor",
|
|
35
|
+
key: t,
|
|
36
|
+
children: r
|
|
37
|
+
};
|
|
16
38
|
}
|
|
17
|
-
class
|
|
39
|
+
class O extends EventTarget {
|
|
18
40
|
handlers = {};
|
|
19
41
|
static instance;
|
|
20
42
|
eventCounters = /* @__PURE__ */ new Map();
|
|
@@ -22,7 +44,7 @@ class B extends EventTarget {
|
|
|
22
44
|
* Returns the singleton instance of GlobalEventBus
|
|
23
45
|
*/
|
|
24
46
|
static getInstance() {
|
|
25
|
-
return
|
|
47
|
+
return O.instance || (O.instance = new O()), O.instance;
|
|
26
48
|
}
|
|
27
49
|
// Enhanced emit method with better typing and event storm protection
|
|
28
50
|
/**
|
|
@@ -30,16 +52,16 @@ class B extends EventTarget {
|
|
|
30
52
|
* @param eventName - Name of the event
|
|
31
53
|
* @param data - Optional event payload
|
|
32
54
|
*/
|
|
33
|
-
emit(t,
|
|
34
|
-
const
|
|
35
|
-
if (!o ||
|
|
36
|
-
this.eventCounters.set(t, { count: 1, window:
|
|
55
|
+
emit(t, r) {
|
|
56
|
+
const n = Date.now(), o = this.eventCounters.get(t);
|
|
57
|
+
if (!o || n - o.window > 1e3)
|
|
58
|
+
this.eventCounters.set(t, { count: 1, window: n });
|
|
37
59
|
else if (o.count++, o.count > 50 && (console.error(`Event storm detected for "${t}": ${o.count} events in 1 second. Throttling...`), o.count > 100)) {
|
|
38
60
|
console.warn(`Blocking further "${t}" events to prevent infinite loop`);
|
|
39
61
|
return;
|
|
40
62
|
}
|
|
41
63
|
this.dispatchEvent(new CustomEvent(t, {
|
|
42
|
-
detail:
|
|
64
|
+
detail: r,
|
|
43
65
|
bubbles: !1,
|
|
44
66
|
// Global events don't need to bubble
|
|
45
67
|
cancelable: !0
|
|
@@ -47,9 +69,9 @@ class B extends EventTarget {
|
|
|
47
69
|
const s = this.handlers[t];
|
|
48
70
|
s && s.forEach((i) => {
|
|
49
71
|
try {
|
|
50
|
-
i(
|
|
51
|
-
} catch (
|
|
52
|
-
console.error(`Error in global event handler for "${t}":`,
|
|
72
|
+
i(r);
|
|
73
|
+
} catch (a) {
|
|
74
|
+
console.error(`Error in global event handler for "${t}":`, a);
|
|
53
75
|
}
|
|
54
76
|
});
|
|
55
77
|
}
|
|
@@ -58,17 +80,17 @@ class B extends EventTarget {
|
|
|
58
80
|
* @param eventName - Name of the event
|
|
59
81
|
* @param handler - Handler function
|
|
60
82
|
*/
|
|
61
|
-
on(t,
|
|
62
|
-
return this.handlers[t] || (this.handlers[t] = /* @__PURE__ */ new Set()), this.handlers[t].add(
|
|
83
|
+
on(t, r) {
|
|
84
|
+
return this.handlers[t] || (this.handlers[t] = /* @__PURE__ */ new Set()), this.handlers[t].add(r), () => this.off(t, r);
|
|
63
85
|
}
|
|
64
86
|
/**
|
|
65
87
|
* Remove a specific handler for a global event.
|
|
66
88
|
* @param eventName - Name of the event
|
|
67
89
|
* @param handler - Handler function to remove
|
|
68
90
|
*/
|
|
69
|
-
off(t,
|
|
70
|
-
const
|
|
71
|
-
|
|
91
|
+
off(t, r) {
|
|
92
|
+
const n = this.handlers[t];
|
|
93
|
+
n && n.delete(r);
|
|
72
94
|
}
|
|
73
95
|
/**
|
|
74
96
|
* Remove all handlers for a specific event.
|
|
@@ -83,18 +105,18 @@ class B extends EventTarget {
|
|
|
83
105
|
* @param handler - CustomEvent handler
|
|
84
106
|
* @param options - AddEventListener options
|
|
85
107
|
*/
|
|
86
|
-
listen(t,
|
|
87
|
-
return this.addEventListener(t,
|
|
108
|
+
listen(t, r, n) {
|
|
109
|
+
return this.addEventListener(t, r, n), () => this.removeEventListener(t, r);
|
|
88
110
|
}
|
|
89
111
|
/**
|
|
90
112
|
* Register a one-time event handler. Returns a promise that resolves with the event data.
|
|
91
113
|
* @param eventName - Name of the event
|
|
92
114
|
* @param handler - Handler function
|
|
93
115
|
*/
|
|
94
|
-
once(t,
|
|
95
|
-
return new Promise((
|
|
116
|
+
once(t, r) {
|
|
117
|
+
return new Promise((n) => {
|
|
96
118
|
const o = this.on(t, (s) => {
|
|
97
|
-
o(),
|
|
119
|
+
o(), r(s), n(s);
|
|
98
120
|
});
|
|
99
121
|
});
|
|
100
122
|
}
|
|
@@ -124,10 +146,10 @@ class B extends EventTarget {
|
|
|
124
146
|
*/
|
|
125
147
|
getEventStats() {
|
|
126
148
|
const t = {};
|
|
127
|
-
for (const [
|
|
128
|
-
t[
|
|
129
|
-
count:
|
|
130
|
-
handlersCount: this.getHandlerCount(
|
|
149
|
+
for (const [r, n] of this.eventCounters.entries())
|
|
150
|
+
t[r] = {
|
|
151
|
+
count: n.count,
|
|
152
|
+
handlersCount: this.getHandlerCount(r)
|
|
131
153
|
};
|
|
132
154
|
return t;
|
|
133
155
|
}
|
|
@@ -138,437 +160,271 @@ class B extends EventTarget {
|
|
|
138
160
|
this.eventCounters.clear();
|
|
139
161
|
}
|
|
140
162
|
}
|
|
141
|
-
const
|
|
142
|
-
function
|
|
143
|
-
|
|
144
|
-
|
|
163
|
+
const H = O.getInstance(), ot = (e, t) => H.emit(e, t), it = (e, t) => H.on(e, t), st = (e, t) => H.off(e, t), at = (e, t) => H.once(e, t), lt = (e, t, r) => H.listen(e, t, r);
|
|
164
|
+
function ie(e) {
|
|
165
|
+
let t = { ...e };
|
|
166
|
+
const r = [];
|
|
167
|
+
function n(a) {
|
|
168
|
+
r.push(a), a(t);
|
|
169
|
+
}
|
|
170
|
+
function o() {
|
|
171
|
+
return t;
|
|
172
|
+
}
|
|
173
|
+
function s(a) {
|
|
174
|
+
const c = typeof a == "function" ? a(t) : a;
|
|
175
|
+
t = { ...t, ...c }, i();
|
|
176
|
+
}
|
|
177
|
+
function i() {
|
|
178
|
+
r.forEach((a) => a(t));
|
|
179
|
+
}
|
|
180
|
+
return { subscribe: n, getState: o, setState: s };
|
|
145
181
|
}
|
|
146
|
-
function
|
|
147
|
-
return
|
|
182
|
+
function ne(e) {
|
|
183
|
+
return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
148
184
|
}
|
|
149
|
-
function
|
|
150
|
-
return typeof e == "
|
|
185
|
+
function ee(e) {
|
|
186
|
+
return typeof e == "string" ? e.replace(
|
|
187
|
+
/[&<>"']/g,
|
|
188
|
+
(t) => ({
|
|
189
|
+
"&": "&",
|
|
190
|
+
"<": "<",
|
|
191
|
+
">": ">",
|
|
192
|
+
'"': """,
|
|
193
|
+
"'": "'"
|
|
194
|
+
})[t]
|
|
195
|
+
) : e;
|
|
151
196
|
}
|
|
152
|
-
function
|
|
153
|
-
|
|
197
|
+
function we(e, t, r) {
|
|
198
|
+
if (r)
|
|
199
|
+
for (const [n, o] of Object.entries(r)) {
|
|
200
|
+
let s, i = {};
|
|
201
|
+
if (Array.isArray(o) ? (s = o[0], i = o[1] || {}) : s = o, t.set(n, {
|
|
202
|
+
callback: s,
|
|
203
|
+
options: i,
|
|
204
|
+
oldValue: te(e, n)
|
|
205
|
+
}), i.immediate)
|
|
206
|
+
try {
|
|
207
|
+
const a = te(e, n);
|
|
208
|
+
s(a, void 0, e);
|
|
209
|
+
} catch (a) {
|
|
210
|
+
console.error(`Error in immediate watcher for "${n}":`, a);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
154
213
|
}
|
|
155
|
-
function
|
|
156
|
-
|
|
157
|
-
let l;
|
|
158
|
-
for (; l = i.exec(e); ) {
|
|
159
|
-
const c = l[1], d = l[2], p = (l[4] || l[6]) ?? "", u = p.match(/^{{(\d+)}}$/);
|
|
160
|
-
let f = u ? t[Number(u[1])] ?? null : p;
|
|
161
|
-
if (u || (f === "true" ? f = !0 : f === "false" ? f = !1 : f === "null" ? f = null : isNaN(Number(f)) || (f = Number(f))), c === ":")
|
|
162
|
-
typeof f == "boolean" ? o[d] = f : f != null && (r[d] = f);
|
|
163
|
-
else if (c === "@") {
|
|
164
|
-
const m = "on" + d.charAt(0).toUpperCase() + d.slice(1);
|
|
165
|
-
r[m] = typeof f == "function" ? f : typeof n[f] == "function" ? n[f] : void 0;
|
|
166
|
-
} else if (c === "#") {
|
|
167
|
-
const [m, ...h] = d.split("."), S = [...h];
|
|
168
|
-
let y = f, a = [...S];
|
|
169
|
-
if (m === "model" && typeof y == "string" && y.includes(".")) {
|
|
170
|
-
const b = ["trim", "number", "lazy"], g = y.split(".");
|
|
171
|
-
let x = y;
|
|
172
|
-
const w = [];
|
|
173
|
-
for (let k = g.length - 1; k > 0 && b.includes(g[k]); k--)
|
|
174
|
-
w.unshift(g[k]), x = g.slice(0, k).join(".");
|
|
175
|
-
y = x, a.push(...w);
|
|
176
|
-
}
|
|
177
|
-
s[m] = {
|
|
178
|
-
value: y,
|
|
179
|
-
modifiers: a
|
|
180
|
-
};
|
|
181
|
-
} else d === "ref" ? r.ref = f : o[d] = f;
|
|
182
|
-
}
|
|
183
|
-
return { props: r, attrs: o, directives: s };
|
|
214
|
+
function te(e, t) {
|
|
215
|
+
return t.split(".").reduce((r, n) => r?.[n], e);
|
|
184
216
|
}
|
|
185
|
-
function
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
""
|
|
200
|
-
), x = a.attrs.style.replace(/^;?\s*/, "");
|
|
201
|
-
u.attrs.style = g + "; " + x;
|
|
202
|
-
} else if (b === "class" && u.attrs.class) {
|
|
203
|
-
const g = u.attrs.class.trim().split(/\s+/).filter(Boolean), x = a.attrs.class.trim().split(/\s+/).filter(Boolean), w = [
|
|
204
|
-
.../* @__PURE__ */ new Set([...g, ...x])
|
|
205
|
-
];
|
|
206
|
-
u.attrs.class = w.join(" ");
|
|
207
|
-
} else
|
|
208
|
-
u.attrs[b] = a.attrs[b];
|
|
209
|
-
}))) : (u.props || (u.props = {}), Object.assign(u.props, a)));
|
|
210
|
-
}
|
|
211
|
-
function y(a, b) {
|
|
212
|
-
const g = p ? d : h;
|
|
213
|
-
if (I(a)) {
|
|
214
|
-
const x = a.key ?? b;
|
|
215
|
-
let w = a.children;
|
|
216
|
-
g.push({
|
|
217
|
-
...a,
|
|
218
|
-
key: x,
|
|
219
|
-
children: w
|
|
220
|
-
});
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
if (R(a)) {
|
|
224
|
-
g.push(le(a, void 0));
|
|
225
|
-
return;
|
|
217
|
+
function ke(e, t, r, n) {
|
|
218
|
+
const o = (i, a) => {
|
|
219
|
+
if (i === a) return !0;
|
|
220
|
+
if (typeof i != typeof a || typeof i != "object" || i === null || a === null) return !1;
|
|
221
|
+
if (Array.isArray(i) && Array.isArray(a))
|
|
222
|
+
return i.length !== a.length ? !1 : i.every((g, d) => o(g, a[d]));
|
|
223
|
+
const c = Object.keys(i), f = Object.keys(a);
|
|
224
|
+
return c.length !== f.length ? !1 : c.every((g) => o(i[g], a[g]));
|
|
225
|
+
}, s = t.get(r);
|
|
226
|
+
if (s && !o(n, s.oldValue))
|
|
227
|
+
try {
|
|
228
|
+
s.callback(n, s.oldValue, e), s.oldValue = n;
|
|
229
|
+
} catch (i) {
|
|
230
|
+
console.error(`Error in watcher for "${r}":`, i);
|
|
226
231
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
+
for (const [i, a] of t.entries())
|
|
233
|
+
if (a.options.deep && r.startsWith(i + "."))
|
|
234
|
+
try {
|
|
235
|
+
const c = te(e, i);
|
|
236
|
+
o(c, a.oldValue) || (a.callback(c, a.oldValue, e), a.oldValue = c);
|
|
237
|
+
} catch (c) {
|
|
238
|
+
console.error(`Error in deep watcher for "${i}":`, c);
|
|
232
239
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
g.push(r(String(a), b));
|
|
240
|
+
}
|
|
241
|
+
function $e(e, t, r) {
|
|
242
|
+
if (!t.props) return;
|
|
243
|
+
function n(o, s) {
|
|
244
|
+
return s === Boolean ? o === "true" : s === Number ? Number(o) : o;
|
|
240
245
|
}
|
|
241
|
-
|
|
242
|
-
if (
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
} = ce(c[2] || "", t, n), $ = { props: {}, attrs: {} };
|
|
248
|
-
for (const v in x) $.props[v] = x[v];
|
|
249
|
-
for (const v in w) $.attrs[v] = w[v];
|
|
250
|
-
for (const [v, _] of Object.entries(k))
|
|
251
|
-
if (v === "bind")
|
|
252
|
-
if (typeof _.value == "object" && _.value !== null)
|
|
253
|
-
for (const [A, E] of Object.entries(_.value))
|
|
254
|
-
typeof E == "boolean" ? $.attrs[A] = E : E != null && ($.attrs[A] = String(E));
|
|
255
|
-
else _.value != null && ($.attrs[v] = String(_.value));
|
|
256
|
-
else if (v === "show") {
|
|
257
|
-
const A = !!_.value;
|
|
258
|
-
$.attrs.style = ($.attrs.style || "") + (A ? "" : "; display: none !important");
|
|
259
|
-
} else if (v === "class") {
|
|
260
|
-
const A = _.value;
|
|
261
|
-
let E = [];
|
|
262
|
-
if (typeof A == "string")
|
|
263
|
-
E = A.split(/\s+/).filter(Boolean);
|
|
264
|
-
else if (Array.isArray(A)) {
|
|
265
|
-
for (const j of A)
|
|
266
|
-
if (typeof j == "string")
|
|
267
|
-
E.push(...j.split(/\s+/).filter(Boolean));
|
|
268
|
-
else if (j && typeof j == "object")
|
|
269
|
-
for (const [L, N] of Object.entries(j))
|
|
270
|
-
N && E.push(...L.split(/\s+/).filter(Boolean));
|
|
271
|
-
} else if (A && typeof A == "object")
|
|
272
|
-
for (const [j, L] of Object.entries(A))
|
|
273
|
-
L && E.push(...j.split(/\s+/).filter(Boolean));
|
|
274
|
-
const O = $.attrs.class || "", M = [
|
|
275
|
-
.../* @__PURE__ */ new Set([
|
|
276
|
-
...O.split(/\s+/).filter(Boolean),
|
|
277
|
-
...E
|
|
278
|
-
])
|
|
279
|
-
];
|
|
280
|
-
$.attrs.class = M.join(" ");
|
|
281
|
-
} else if (v === "style") {
|
|
282
|
-
const A = _.value;
|
|
283
|
-
let E = "";
|
|
284
|
-
if (typeof A == "string")
|
|
285
|
-
E = A;
|
|
286
|
-
else if (A && typeof A == "object") {
|
|
287
|
-
const M = [];
|
|
288
|
-
for (const [j, L] of Object.entries(A))
|
|
289
|
-
if (L != null && L !== "") {
|
|
290
|
-
const N = j.replace(
|
|
291
|
-
/[A-Z]/g,
|
|
292
|
-
(ae) => `-${ae.toLowerCase()}`
|
|
293
|
-
), se = [
|
|
294
|
-
"width",
|
|
295
|
-
"height",
|
|
296
|
-
"top",
|
|
297
|
-
"right",
|
|
298
|
-
"bottom",
|
|
299
|
-
"left",
|
|
300
|
-
"margin",
|
|
301
|
-
"margin-top",
|
|
302
|
-
"margin-right",
|
|
303
|
-
"margin-bottom",
|
|
304
|
-
"margin-left",
|
|
305
|
-
"padding",
|
|
306
|
-
"padding-top",
|
|
307
|
-
"padding-right",
|
|
308
|
-
"padding-bottom",
|
|
309
|
-
"padding-left",
|
|
310
|
-
"font-size",
|
|
311
|
-
"line-height",
|
|
312
|
-
"border-width",
|
|
313
|
-
"border-radius",
|
|
314
|
-
"min-width",
|
|
315
|
-
"max-width",
|
|
316
|
-
"min-height",
|
|
317
|
-
"max-height"
|
|
318
|
-
];
|
|
319
|
-
let X = String(L);
|
|
320
|
-
typeof L == "number" && se.includes(N) && (X = `${L}px`), M.push(`${N}: ${X}`);
|
|
321
|
-
}
|
|
322
|
-
E = M.join("; ") + (M.length > 0 ? ";" : "");
|
|
323
|
-
}
|
|
324
|
-
const O = $.attrs.style || "";
|
|
325
|
-
$.attrs.style = O + (O && !O.endsWith(";") ? "; " : "") + E;
|
|
326
|
-
}
|
|
327
|
-
const C = {};
|
|
328
|
-
for (const [v, _] of Object.entries(k))
|
|
329
|
-
["bind", "show", "class", "style"].includes(v) || (C[v] = _);
|
|
330
|
-
if (Object.keys(C).length > 0 && ($.directives = C), b) {
|
|
331
|
-
const v = P(
|
|
332
|
-
p,
|
|
333
|
-
u,
|
|
334
|
-
d.length === 1 && R(d[0]) && d[0].tag === "#text" ? typeof d[0].children == "string" ? d[0].children : "" : d.length ? d : void 0,
|
|
335
|
-
f
|
|
336
|
-
), _ = i.pop();
|
|
337
|
-
_ ? (p = _.tag, u = _.props, f = _.key, d = _.children, d.push(v)) : l = v;
|
|
338
|
-
} else g ? (p ? d : h).push(P(a, $, void 0, void 0)) : (p && i.push({
|
|
339
|
-
tag: p,
|
|
340
|
-
props: u,
|
|
341
|
-
children: d,
|
|
342
|
-
key: f
|
|
343
|
-
}), p = a, u = $, d = []);
|
|
344
|
-
} else if (typeof c[3] < "u") {
|
|
345
|
-
const a = Number(c[3]), b = t[a], g = `interp-${a}`;
|
|
346
|
-
y(b, g);
|
|
347
|
-
} else if (c[4]) {
|
|
348
|
-
const a = c[4], b = p ? d : h, g = a.split(/({{\d+}})/);
|
|
349
|
-
for (const x of g) {
|
|
350
|
-
if (!x) continue;
|
|
351
|
-
const w = x.match(/^{{(\d+)}}$/);
|
|
352
|
-
if (w) {
|
|
353
|
-
const k = Number(w[1]), $ = t[k], C = `interp-${k}`;
|
|
354
|
-
y($, C);
|
|
355
|
-
} else {
|
|
356
|
-
const k = `text-${m++}`;
|
|
357
|
-
b.push(r(x, k));
|
|
358
|
-
}
|
|
359
|
-
}
|
|
246
|
+
Object.entries(t.props).forEach(([o, s]) => {
|
|
247
|
+
if (s.type === Function && typeof e[o] == "function")
|
|
248
|
+
r[o] = e[o];
|
|
249
|
+
else {
|
|
250
|
+
const i = e.getAttribute(ne(o));
|
|
251
|
+
i !== null ? r[o] = ee(n(i, s.type)) : "default" in s && s.default !== void 0 && (r[o] = ee(s.default));
|
|
360
252
|
}
|
|
361
|
-
|
|
362
|
-
return R(l) && Array.isArray(l.children) && (l.children = l.children.filter(
|
|
363
|
-
(a) => R(a) ? a.tag !== "#text" || typeof a.children == "string" && a.children.trim() !== "" : !0
|
|
364
|
-
// keep non-element VNodes (including anchors) as-is
|
|
365
|
-
)), l;
|
|
366
|
-
if (h.length > 0) {
|
|
367
|
-
const a = h.filter(
|
|
368
|
-
(b) => R(b) ? b.tag !== "#text" || typeof b.children == "string" && b.children.trim() !== "" : !0
|
|
369
|
-
);
|
|
370
|
-
return a.length === 1 ? a[0] : a;
|
|
371
|
-
}
|
|
372
|
-
return P("div", {}, "", "fallback-root");
|
|
373
|
-
}
|
|
374
|
-
function Oe(e, ...t) {
|
|
375
|
-
const n = t[t.length - 1], r = typeof n == "object" && n && !Array.isArray(n) ? n : void 0;
|
|
376
|
-
return fe(e, t, r);
|
|
253
|
+
});
|
|
377
254
|
}
|
|
378
|
-
function
|
|
379
|
-
|
|
255
|
+
function Ce(e, t, r, n) {
|
|
256
|
+
e.onConnected && !r && (e.onConnected(t), n(!0));
|
|
380
257
|
}
|
|
381
|
-
function
|
|
382
|
-
|
|
383
|
-
const o = typeof n == "object" ? n?.key ?? n?.id ?? `idx-${r}` : String(n);
|
|
384
|
-
return K(t(n, r), `each-${o}`);
|
|
385
|
-
});
|
|
258
|
+
function Se(e, t, r, n, o, s, i, a) {
|
|
259
|
+
e.onDisconnected && e.onDisconnected(t), r.forEach((c) => c()), n(), o(), s(!1), i(null), a(!1);
|
|
386
260
|
}
|
|
387
|
-
function
|
|
388
|
-
|
|
389
|
-
return {
|
|
390
|
-
when(t, n) {
|
|
391
|
-
return e.push([t, n]), this;
|
|
392
|
-
},
|
|
393
|
-
otherwise(t) {
|
|
394
|
-
return e.push([!0, t]), this;
|
|
395
|
-
},
|
|
396
|
-
done() {
|
|
397
|
-
return ue(...e);
|
|
398
|
-
}
|
|
399
|
-
};
|
|
261
|
+
function _e(e, t, r, n, o) {
|
|
262
|
+
e.onAttributeChanged && e.onAttributeChanged(t, r, n, o);
|
|
400
263
|
}
|
|
401
|
-
function
|
|
402
|
-
|
|
403
|
-
const
|
|
404
|
-
|
|
264
|
+
function R(e, t) {
|
|
265
|
+
if (t && e instanceof HTMLElement) {
|
|
266
|
+
for (const r in t)
|
|
267
|
+
t[r] === e && delete t[r];
|
|
268
|
+
for (const r of Array.from(e.childNodes))
|
|
269
|
+
R(r, t);
|
|
405
270
|
}
|
|
406
|
-
return [K([], "whenChain-empty")];
|
|
407
271
|
}
|
|
408
|
-
function
|
|
409
|
-
|
|
410
|
-
return {
|
|
411
|
-
tag: "#anchor",
|
|
412
|
-
key: t,
|
|
413
|
-
children: n
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
function z(e, t) {
|
|
417
|
-
return t.split(".").reduce((n, r) => n?.[r], e);
|
|
272
|
+
function N(e, t) {
|
|
273
|
+
return t.split(".").reduce((r, n) => r?.[n], e);
|
|
418
274
|
}
|
|
419
|
-
function
|
|
420
|
-
const
|
|
275
|
+
function se(e, t, r) {
|
|
276
|
+
const n = t.split("."), o = n.pop();
|
|
421
277
|
if (!o) return;
|
|
422
|
-
const s =
|
|
423
|
-
s[o] =
|
|
278
|
+
const s = n.reduce((i, a) => (a in i || (i[a] = {}), i[a]), e);
|
|
279
|
+
s[o] = r;
|
|
424
280
|
}
|
|
425
|
-
function
|
|
281
|
+
function Ae(e, t, r, n, o, s, i) {
|
|
426
282
|
if (!s) return;
|
|
427
|
-
const
|
|
428
|
-
const
|
|
429
|
-
return
|
|
430
|
-
},
|
|
431
|
-
let
|
|
432
|
-
const
|
|
433
|
-
if (i instanceof HTMLInputElement ?
|
|
434
|
-
if (Array.isArray(
|
|
435
|
-
const
|
|
436
|
-
i && i.checked !==
|
|
283
|
+
const a = t.includes("lazy"), c = t.includes("trim"), f = t.includes("number"), g = () => {
|
|
284
|
+
const h = s._state || s;
|
|
285
|
+
return N(h, e);
|
|
286
|
+
}, d = g();
|
|
287
|
+
let u = "text";
|
|
288
|
+
const v = n?.type;
|
|
289
|
+
if (i instanceof HTMLInputElement ? u = v || i.type || "text" : i instanceof HTMLSelectElement ? u = "select" : i instanceof HTMLTextAreaElement && (u = "textarea"), u === "checkbox")
|
|
290
|
+
if (Array.isArray(d)) {
|
|
291
|
+
const h = i?.getAttribute("value") || n?.value || "", l = d.includes(h);
|
|
292
|
+
i && i.checked !== l && (r.checked = l);
|
|
437
293
|
} else {
|
|
438
|
-
const
|
|
439
|
-
i && i.checked !==
|
|
294
|
+
const h = i?.getAttribute("true-value") || !0, l = d === h;
|
|
295
|
+
i && i.checked !== l && (r.checked = l);
|
|
440
296
|
}
|
|
441
|
-
else if (
|
|
442
|
-
const
|
|
443
|
-
i && i.checked !==
|
|
444
|
-
} else if (
|
|
297
|
+
else if (u === "radio") {
|
|
298
|
+
const h = n?.value || "", l = d === h;
|
|
299
|
+
i && i.checked !== l && (r.checked = l);
|
|
300
|
+
} else if (u === "select")
|
|
445
301
|
if (i && i.hasAttribute("multiple")) {
|
|
446
|
-
const
|
|
302
|
+
const h = i, l = Array.isArray(d) ? d : [];
|
|
447
303
|
setTimeout(() => {
|
|
448
|
-
Array.from(
|
|
449
|
-
const
|
|
450
|
-
|
|
304
|
+
Array.from(h.options).forEach((p) => {
|
|
305
|
+
const m = l.includes(p.value);
|
|
306
|
+
p.selected !== m && (p.selected = m);
|
|
451
307
|
});
|
|
452
308
|
}, 0);
|
|
453
309
|
} else
|
|
454
310
|
setTimeout(() => {
|
|
455
|
-
i instanceof HTMLSelectElement && i.value !== String(
|
|
311
|
+
i instanceof HTMLSelectElement && i.value !== String(d) && (i.value = String(d));
|
|
456
312
|
}, 0);
|
|
457
313
|
else {
|
|
458
|
-
const
|
|
459
|
-
(!i || i.value !==
|
|
460
|
-
}
|
|
461
|
-
const
|
|
462
|
-
if (
|
|
463
|
-
const
|
|
464
|
-
if (
|
|
465
|
-
const
|
|
466
|
-
let
|
|
467
|
-
if (
|
|
468
|
-
if (Array.isArray(
|
|
469
|
-
const
|
|
470
|
-
if (
|
|
471
|
-
|
|
314
|
+
const h = String(d ?? "");
|
|
315
|
+
(!i || i.value !== h) && (r.value = d);
|
|
316
|
+
}
|
|
317
|
+
const y = a || u === "checkbox" || u === "radio" || u === "select" ? "change" : "input", b = (h) => {
|
|
318
|
+
if (h.isComposing || o._isComposing || h.isTrusted === !1) return;
|
|
319
|
+
const l = h.target;
|
|
320
|
+
if (l._modelUpdating) return;
|
|
321
|
+
const p = g();
|
|
322
|
+
let m = l.value;
|
|
323
|
+
if (u === "checkbox")
|
|
324
|
+
if (Array.isArray(p)) {
|
|
325
|
+
const S = l.getAttribute("value") || "", _ = [...p];
|
|
326
|
+
if (l.checked)
|
|
327
|
+
_.includes(S) || _.push(S);
|
|
472
328
|
else {
|
|
473
|
-
const
|
|
474
|
-
|
|
329
|
+
const w = _.indexOf(S);
|
|
330
|
+
w > -1 && _.splice(w, 1);
|
|
475
331
|
}
|
|
476
|
-
|
|
332
|
+
m = _;
|
|
477
333
|
} else {
|
|
478
|
-
const
|
|
479
|
-
|
|
334
|
+
const S = l.getAttribute("true-value") || !0, _ = l.getAttribute("false-value") || !1;
|
|
335
|
+
m = l.checked ? S : _;
|
|
480
336
|
}
|
|
481
|
-
else if (
|
|
482
|
-
|
|
483
|
-
else if (
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
(
|
|
337
|
+
else if (u === "radio")
|
|
338
|
+
m = l.getAttribute("value") || l.value;
|
|
339
|
+
else if (u === "select" && l.multiple) {
|
|
340
|
+
const S = l;
|
|
341
|
+
m = Array.from(S.selectedOptions).map(
|
|
342
|
+
(_) => _.value
|
|
487
343
|
);
|
|
488
|
-
} else if (c && (
|
|
489
|
-
const
|
|
490
|
-
isNaN(
|
|
344
|
+
} else if (c && (m = m.trim()), f) {
|
|
345
|
+
const S = Number(m);
|
|
346
|
+
isNaN(S) || (m = S);
|
|
491
347
|
}
|
|
492
|
-
const x = s._state || s,
|
|
493
|
-
if (Array.isArray(
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
|
|
348
|
+
const x = s._state || s, k = N(x, e);
|
|
349
|
+
if (Array.isArray(m) && Array.isArray(k) ? JSON.stringify([...m].sort()) !== JSON.stringify([...k].sort()) : m !== k) {
|
|
350
|
+
const S = h.target;
|
|
351
|
+
S._modelUpdating = !0, se(x, e, m), setTimeout(() => {
|
|
352
|
+
S._modelUpdating = !1;
|
|
497
353
|
}, 0), s._requestRender && s._requestRender();
|
|
498
354
|
}
|
|
499
355
|
};
|
|
500
|
-
if (o[
|
|
501
|
-
const
|
|
356
|
+
if (o[y] = b, u === "text" || u === "textarea") {
|
|
357
|
+
const h = () => {
|
|
502
358
|
o._isComposing = !0;
|
|
503
|
-
},
|
|
359
|
+
}, l = (p) => {
|
|
504
360
|
o._isComposing = !1;
|
|
505
|
-
const
|
|
361
|
+
const m = p.target;
|
|
506
362
|
setTimeout(() => {
|
|
507
|
-
if (
|
|
508
|
-
let x =
|
|
509
|
-
if (c && (x = x.trim()),
|
|
510
|
-
const
|
|
511
|
-
isNaN(
|
|
363
|
+
if (m) {
|
|
364
|
+
let x = m.value;
|
|
365
|
+
if (c && (x = x.trim()), f) {
|
|
366
|
+
const _ = Number(x);
|
|
367
|
+
isNaN(_) || (x = _);
|
|
512
368
|
}
|
|
513
|
-
const
|
|
514
|
-
(Array.isArray(x) && Array.isArray(
|
|
515
|
-
|
|
516
|
-
}, 0)),
|
|
369
|
+
const k = s._state || s, $ = N(k, e);
|
|
370
|
+
(Array.isArray(x) && Array.isArray($) ? JSON.stringify([...x].sort()) !== JSON.stringify([...$].sort()) : x !== $) && (m && (m._modelUpdating = !0, setTimeout(() => {
|
|
371
|
+
m._modelUpdating = !1;
|
|
372
|
+
}, 0)), se(k, e, x), s._requestRender && s._requestRender());
|
|
517
373
|
}
|
|
518
374
|
}, 0);
|
|
519
375
|
};
|
|
520
|
-
o.compositionstart =
|
|
376
|
+
o.compositionstart = h, o.compositionend = l;
|
|
521
377
|
}
|
|
522
378
|
}
|
|
523
|
-
function
|
|
524
|
-
if (
|
|
379
|
+
function Ee(e, t, r, n) {
|
|
380
|
+
if (n)
|
|
525
381
|
try {
|
|
526
382
|
const o = JSON.parse(e);
|
|
527
383
|
if (typeof o == "object")
|
|
528
384
|
for (const [s, i] of Object.entries(o))
|
|
529
385
|
t[s] = i;
|
|
530
386
|
} catch {
|
|
531
|
-
const o =
|
|
532
|
-
|
|
387
|
+
const o = N(n, e);
|
|
388
|
+
r[e] = o;
|
|
533
389
|
}
|
|
534
390
|
}
|
|
535
|
-
function
|
|
536
|
-
if (!
|
|
537
|
-
const
|
|
391
|
+
function Te(e, t, r) {
|
|
392
|
+
if (!r) return;
|
|
393
|
+
const n = N(r, e), o = t.style || "", s = n ? "" : "none";
|
|
538
394
|
if (o) {
|
|
539
|
-
const i = o.split(";").filter(Boolean),
|
|
395
|
+
const i = o.split(";").filter(Boolean), a = i.findIndex(
|
|
540
396
|
(c) => c.trim().startsWith("display:")
|
|
541
397
|
);
|
|
542
|
-
|
|
398
|
+
a >= 0 ? i[a] = `display: ${s}` : i.push(`display: ${s}`), t.style = i.join("; ");
|
|
543
399
|
} else
|
|
544
400
|
t.style = `display: ${s}`;
|
|
545
401
|
}
|
|
546
|
-
function
|
|
547
|
-
if (!
|
|
548
|
-
const
|
|
402
|
+
function je(e, t, r) {
|
|
403
|
+
if (!r) return;
|
|
404
|
+
const n = N(r, e);
|
|
549
405
|
let o = [];
|
|
550
|
-
typeof
|
|
406
|
+
typeof n == "string" ? o = [n] : Array.isArray(n) ? o = n.filter(Boolean) : typeof n == "object" && (o = Object.entries(n).filter(([, a]) => !!a).map(([a]) => a));
|
|
551
407
|
const s = t.class || "", i = s ? `${s} ${o.join(" ")}`.trim() : o.join(" ");
|
|
552
408
|
i && (t.class = i);
|
|
553
409
|
}
|
|
554
|
-
function
|
|
555
|
-
let
|
|
410
|
+
function Le(e, t, r) {
|
|
411
|
+
let n;
|
|
556
412
|
if (typeof e == "string") {
|
|
557
|
-
if (!
|
|
558
|
-
|
|
413
|
+
if (!r) return;
|
|
414
|
+
n = N(r, e);
|
|
559
415
|
} else
|
|
560
|
-
|
|
416
|
+
n = e;
|
|
561
417
|
let o = "";
|
|
562
|
-
if (typeof
|
|
563
|
-
o =
|
|
564
|
-
else if (
|
|
418
|
+
if (typeof n == "string")
|
|
419
|
+
o = n;
|
|
420
|
+
else if (n && typeof n == "object") {
|
|
565
421
|
const i = [];
|
|
566
|
-
for (const [
|
|
422
|
+
for (const [a, c] of Object.entries(n))
|
|
567
423
|
if (c != null && c !== "") {
|
|
568
|
-
const
|
|
424
|
+
const f = a.replace(
|
|
569
425
|
/[A-Z]/g,
|
|
570
|
-
(
|
|
571
|
-
),
|
|
426
|
+
(u) => `-${u.toLowerCase()}`
|
|
427
|
+
), g = [
|
|
572
428
|
"width",
|
|
573
429
|
"height",
|
|
574
430
|
"top",
|
|
@@ -594,336 +450,334 @@ function me(e, t, n) {
|
|
|
594
450
|
"min-height",
|
|
595
451
|
"max-height"
|
|
596
452
|
];
|
|
597
|
-
let
|
|
598
|
-
typeof c == "number" &&
|
|
453
|
+
let d = String(c);
|
|
454
|
+
typeof c == "number" && g.includes(f) && (d = `${c}px`), i.push(`${f}: ${d}`);
|
|
599
455
|
}
|
|
600
456
|
o = i.join("; ") + (i.length > 0 ? ";" : "");
|
|
601
457
|
}
|
|
602
458
|
const s = t.style || "";
|
|
603
459
|
t.style = s + (s && !s.endsWith(";") ? "; " : "") + o;
|
|
604
460
|
}
|
|
605
|
-
function
|
|
606
|
-
const o = {}, s = { ...
|
|
607
|
-
for (const [
|
|
608
|
-
const { value:
|
|
609
|
-
switch (
|
|
461
|
+
function he(e, t, r, n) {
|
|
462
|
+
const o = {}, s = { ...n || {} }, i = {};
|
|
463
|
+
for (const [a, c] of Object.entries(e)) {
|
|
464
|
+
const { value: f, modifiers: g } = c;
|
|
465
|
+
switch (a) {
|
|
610
466
|
case "model":
|
|
611
|
-
|
|
612
|
-
typeof
|
|
613
|
-
|
|
467
|
+
Ae(
|
|
468
|
+
typeof f == "string" ? f : String(f),
|
|
469
|
+
g,
|
|
614
470
|
o,
|
|
615
471
|
s,
|
|
616
472
|
i,
|
|
617
473
|
t,
|
|
618
|
-
|
|
474
|
+
r
|
|
619
475
|
);
|
|
620
476
|
break;
|
|
621
477
|
case "bind":
|
|
622
|
-
|
|
478
|
+
Ee(f, o, s, t);
|
|
623
479
|
break;
|
|
624
480
|
case "show":
|
|
625
|
-
|
|
481
|
+
Te(f, s, t);
|
|
626
482
|
break;
|
|
627
483
|
case "class":
|
|
628
|
-
|
|
484
|
+
je(f, s, t);
|
|
629
485
|
break;
|
|
630
486
|
case "style":
|
|
631
|
-
|
|
487
|
+
Le(f, s, t);
|
|
632
488
|
break;
|
|
633
489
|
}
|
|
634
490
|
}
|
|
635
491
|
return { props: o, attrs: s, listeners: i };
|
|
636
492
|
}
|
|
637
|
-
function
|
|
493
|
+
function re(e, t) {
|
|
638
494
|
if (Array.isArray(e)) {
|
|
639
495
|
const s = /* @__PURE__ */ new Set();
|
|
640
496
|
return e.map((i) => {
|
|
641
497
|
if (!i || typeof i != "object") return i;
|
|
642
|
-
let
|
|
643
|
-
if (!
|
|
644
|
-
const
|
|
645
|
-
|
|
498
|
+
let a = i.props?.key ?? i.key;
|
|
499
|
+
if (!a) {
|
|
500
|
+
const d = i.tag || "node", u = i.props?.attrs?.id ?? i.props?.attrs?.name ?? i.props?.attrs?.["data-key"] ?? "";
|
|
501
|
+
a = u ? `${t}:${d}:${u}` : `${t}:${d}`;
|
|
646
502
|
}
|
|
647
|
-
let c =
|
|
503
|
+
let c = a, f = 1;
|
|
648
504
|
for (; s.has(c); )
|
|
649
|
-
c = `${
|
|
505
|
+
c = `${a}#${f++}`;
|
|
650
506
|
s.add(c);
|
|
651
|
-
let
|
|
652
|
-
return Array.isArray(
|
|
507
|
+
let g = i.children;
|
|
508
|
+
return Array.isArray(g) && (g = re(g, c)), { ...i, key: c, children: g };
|
|
653
509
|
});
|
|
654
510
|
}
|
|
655
|
-
const
|
|
656
|
-
let
|
|
657
|
-
return Array.isArray(o) && (o =
|
|
511
|
+
const r = e;
|
|
512
|
+
let n = r.props?.key ?? r.key ?? t, o = r.children;
|
|
513
|
+
return Array.isArray(o) && (o = re(o, n)), { ...r, key: n, children: o };
|
|
658
514
|
}
|
|
659
|
-
function
|
|
660
|
-
const o =
|
|
515
|
+
function Be(e, t, r, n) {
|
|
516
|
+
const o = r.directives ?? {}, s = he(
|
|
661
517
|
o,
|
|
662
|
-
|
|
518
|
+
n,
|
|
663
519
|
e,
|
|
664
|
-
|
|
520
|
+
r.attrs
|
|
665
521
|
), i = {
|
|
666
522
|
...t.props,
|
|
667
|
-
...
|
|
523
|
+
...r.props,
|
|
668
524
|
...s.props
|
|
669
|
-
},
|
|
525
|
+
}, a = {
|
|
670
526
|
...t.attrs,
|
|
671
|
-
...
|
|
527
|
+
...r.attrs,
|
|
672
528
|
...s.attrs
|
|
673
|
-
}, c = t.props ?? {},
|
|
674
|
-
for (const
|
|
675
|
-
const
|
|
676
|
-
|
|
529
|
+
}, c = t.props ?? {}, f = i;
|
|
530
|
+
for (const u in { ...c, ...f }) {
|
|
531
|
+
const v = c[u], y = f[u];
|
|
532
|
+
v !== y && (u === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) ? e.value !== y && (e.value = y ?? "") : u === "checked" && e instanceof HTMLInputElement ? e.checked = !!y : u.startsWith("on") && typeof y == "function" ? (typeof v == "function" && e.removeEventListener(u.slice(2).toLowerCase(), v), e.addEventListener(u.slice(2).toLowerCase(), y)) : y == null || y === !1 ? e.removeAttribute(u) : e.setAttribute(u, String(y)));
|
|
677
533
|
}
|
|
678
|
-
for (const [
|
|
534
|
+
for (const [u, v] of Object.entries(
|
|
679
535
|
s.listeners || {}
|
|
680
536
|
))
|
|
681
|
-
e.addEventListener(
|
|
682
|
-
const
|
|
683
|
-
for (const
|
|
684
|
-
const
|
|
685
|
-
|
|
537
|
+
e.addEventListener(u, v);
|
|
538
|
+
const g = t.attrs ?? {}, d = a;
|
|
539
|
+
for (const u in { ...g, ...d }) {
|
|
540
|
+
const v = g[u], y = d[u];
|
|
541
|
+
v !== y && (y == null || y === !1 ? e.removeAttribute(u) : e.setAttribute(u, String(y)));
|
|
686
542
|
}
|
|
687
543
|
}
|
|
688
|
-
function T(e, t,
|
|
544
|
+
function T(e, t, r) {
|
|
689
545
|
if (typeof e == "string")
|
|
690
546
|
return document.createTextNode(e);
|
|
691
547
|
if (e.tag === "#text") {
|
|
692
|
-
const
|
|
548
|
+
const d = document.createTextNode(
|
|
693
549
|
typeof e.children == "string" ? e.children : ""
|
|
694
550
|
);
|
|
695
|
-
return e.key != null && (
|
|
551
|
+
return e.key != null && (d.key = e.key), d;
|
|
696
552
|
}
|
|
697
553
|
if (e.tag === "#anchor") {
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
const
|
|
701
|
-
|
|
702
|
-
for (const
|
|
703
|
-
|
|
704
|
-
return
|
|
705
|
-
}
|
|
706
|
-
const
|
|
707
|
-
e.key != null && (
|
|
708
|
-
const { props: o = {}, attrs: s = {}, directives: i = {} } = e.props ?? {},
|
|
554
|
+
const d = e, u = Array.isArray(d.children) ? d.children : [], v = document.createTextNode(""), y = document.createTextNode("");
|
|
555
|
+
d.key != null && (v.key = `${d.key}:start`, y.key = `${d.key}:end`), d._startNode = v, d._endNode = y;
|
|
556
|
+
const b = document.createDocumentFragment();
|
|
557
|
+
b.appendChild(v);
|
|
558
|
+
for (const h of u)
|
|
559
|
+
b.appendChild(T(h, t));
|
|
560
|
+
return b.appendChild(y), b;
|
|
561
|
+
}
|
|
562
|
+
const n = document.createElement(e.tag);
|
|
563
|
+
e.key != null && (n.key = e.key);
|
|
564
|
+
const { props: o = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a = he(i, t, n, s), c = {
|
|
709
565
|
...o,
|
|
710
|
-
...
|
|
711
|
-
},
|
|
566
|
+
...a.props
|
|
567
|
+
}, f = {
|
|
712
568
|
...s,
|
|
713
|
-
...
|
|
569
|
+
...a.attrs
|
|
714
570
|
};
|
|
715
|
-
for (const
|
|
716
|
-
const
|
|
717
|
-
typeof
|
|
718
|
-
}
|
|
719
|
-
for (const
|
|
720
|
-
const
|
|
721
|
-
if (
|
|
722
|
-
|
|
723
|
-
else if (
|
|
724
|
-
|
|
725
|
-
else if (
|
|
726
|
-
|
|
571
|
+
for (const d in f) {
|
|
572
|
+
const u = f[d];
|
|
573
|
+
typeof u == "boolean" ? u && n.setAttribute(d, "") : u != null && n.setAttribute(d, String(u));
|
|
574
|
+
}
|
|
575
|
+
for (const d in c) {
|
|
576
|
+
const u = c[d];
|
|
577
|
+
if (d === "value" && (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement))
|
|
578
|
+
n.value = u ?? "";
|
|
579
|
+
else if (d === "checked" && n instanceof HTMLInputElement)
|
|
580
|
+
n.checked = !!u;
|
|
581
|
+
else if (d.startsWith("on") && typeof u == "function")
|
|
582
|
+
n.addEventListener(d.slice(2).toLowerCase(), u);
|
|
727
583
|
else {
|
|
728
|
-
if (
|
|
584
|
+
if (d.startsWith("on") && u === void 0)
|
|
729
585
|
continue;
|
|
730
|
-
|
|
586
|
+
u == null || u === !1 ? n.removeAttribute(d) : n.setAttribute(d, String(u));
|
|
731
587
|
}
|
|
732
588
|
}
|
|
733
|
-
for (const [
|
|
734
|
-
|
|
589
|
+
for (const [d, u] of Object.entries(
|
|
590
|
+
a.listeners || {}
|
|
735
591
|
))
|
|
736
|
-
|
|
737
|
-
const
|
|
738
|
-
if (typeof e != "string" &&
|
|
739
|
-
for (const
|
|
740
|
-
|
|
741
|
-
else typeof e.children == "string" && (
|
|
742
|
-
return
|
|
592
|
+
n.addEventListener(d, u);
|
|
593
|
+
const g = e.props?.ref ?? (e.props?.props && e.props.props.ref);
|
|
594
|
+
if (typeof e != "string" && g && r && (r[g] = n), Array.isArray(e.children))
|
|
595
|
+
for (const d of e.children)
|
|
596
|
+
n.appendChild(T(d, t, r));
|
|
597
|
+
else typeof e.children == "string" && (n.textContent = e.children);
|
|
598
|
+
return n;
|
|
743
599
|
}
|
|
744
|
-
function
|
|
745
|
-
if (typeof
|
|
746
|
-
e.textContent !==
|
|
600
|
+
function ze(e, t, r, n, o) {
|
|
601
|
+
if (typeof r == "string") {
|
|
602
|
+
e.textContent !== r && (e.textContent = r);
|
|
747
603
|
return;
|
|
748
604
|
}
|
|
749
|
-
if (!Array.isArray(
|
|
750
|
-
const s = Array.from(e.childNodes), i = Array.isArray(t) ? t : [],
|
|
751
|
-
for (const
|
|
752
|
-
|
|
605
|
+
if (!Array.isArray(r)) return;
|
|
606
|
+
const s = Array.from(e.childNodes), i = Array.isArray(t) ? t : [], a = /* @__PURE__ */ new Map();
|
|
607
|
+
for (const v of i)
|
|
608
|
+
v && v.key != null && a.set(v.key, v);
|
|
753
609
|
const c = /* @__PURE__ */ new Map();
|
|
754
|
-
for (const
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
}
|
|
758
|
-
const
|
|
759
|
-
let
|
|
760
|
-
function
|
|
761
|
-
let
|
|
762
|
-
for (;
|
|
763
|
-
|
|
764
|
-
}
|
|
765
|
-
function
|
|
766
|
-
const
|
|
767
|
-
let
|
|
768
|
-
for (;
|
|
769
|
-
|
|
770
|
-
const
|
|
771
|
-
if (
|
|
772
|
-
const
|
|
773
|
-
for (const
|
|
774
|
-
|
|
775
|
-
for (const
|
|
776
|
-
const
|
|
777
|
-
|
|
610
|
+
for (const v of s) {
|
|
611
|
+
const y = v.key;
|
|
612
|
+
y != null && c.set(y, v);
|
|
613
|
+
}
|
|
614
|
+
const f = /* @__PURE__ */ new Set();
|
|
615
|
+
let g = e.firstChild;
|
|
616
|
+
function d(v, y) {
|
|
617
|
+
let b = v;
|
|
618
|
+
for (; b && (f.add(b), b !== y); )
|
|
619
|
+
b = b.nextSibling;
|
|
620
|
+
}
|
|
621
|
+
function u(v, y, b, h) {
|
|
622
|
+
const l = [];
|
|
623
|
+
let p = v.nextSibling;
|
|
624
|
+
for (; p && p !== y; )
|
|
625
|
+
l.push(p), p = p.nextSibling;
|
|
626
|
+
const m = Array.isArray(b) ? b : [];
|
|
627
|
+
if (h.some((k) => k && k.key != null) || m.some((k) => k && k.key != null)) {
|
|
628
|
+
const k = /* @__PURE__ */ new Map(), $ = /* @__PURE__ */ new Map();
|
|
629
|
+
for (const w of m)
|
|
630
|
+
w && w.key != null && k.set(w.key, w);
|
|
631
|
+
for (const w of l) {
|
|
632
|
+
const C = w.key;
|
|
633
|
+
C != null && $.set(C, w);
|
|
778
634
|
}
|
|
779
|
-
const
|
|
780
|
-
let
|
|
781
|
-
for (const
|
|
782
|
-
let
|
|
783
|
-
if (
|
|
784
|
-
const A =
|
|
785
|
-
|
|
786
|
-
|
|
635
|
+
const S = /* @__PURE__ */ new Set();
|
|
636
|
+
let _ = v.nextSibling;
|
|
637
|
+
for (const w of h) {
|
|
638
|
+
let C;
|
|
639
|
+
if (w.key != null && $.has(w.key)) {
|
|
640
|
+
const A = k.get(w.key);
|
|
641
|
+
C = K(
|
|
642
|
+
$.get(w.key),
|
|
787
643
|
A,
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
),
|
|
644
|
+
w,
|
|
645
|
+
n
|
|
646
|
+
), S.add(C), C !== _ && e.contains(C) && e.insertBefore(C, _);
|
|
791
647
|
} else
|
|
792
|
-
|
|
793
|
-
|
|
648
|
+
C = T(w, n), e.insertBefore(C, _), S.add(C);
|
|
649
|
+
_ = C.nextSibling;
|
|
794
650
|
}
|
|
795
|
-
for (const
|
|
796
|
-
|
|
651
|
+
for (const w of l)
|
|
652
|
+
!S.has(w) && e.contains(w) && e.removeChild(w);
|
|
797
653
|
} else {
|
|
798
|
-
const
|
|
799
|
-
|
|
800
|
-
|
|
654
|
+
const k = Math.min(
|
|
655
|
+
m.length,
|
|
656
|
+
h.length
|
|
801
657
|
);
|
|
802
|
-
for (let
|
|
803
|
-
const
|
|
804
|
-
|
|
658
|
+
for (let $ = 0; $ < k; $++) {
|
|
659
|
+
const S = m[$], _ = h[$], w = K(l[$], S, _, n);
|
|
660
|
+
w !== l[$] && (e.insertBefore(w, l[$]), e.removeChild(l[$]));
|
|
805
661
|
}
|
|
806
|
-
for (let
|
|
807
|
-
e.insertBefore(T(
|
|
808
|
-
for (let
|
|
809
|
-
e.removeChild(
|
|
662
|
+
for (let $ = k; $ < h.length; $++)
|
|
663
|
+
e.insertBefore(T(h[$], n), y);
|
|
664
|
+
for (let $ = k; $ < l.length; $++)
|
|
665
|
+
e.removeChild(l[$]);
|
|
810
666
|
}
|
|
811
667
|
}
|
|
812
|
-
for (const
|
|
813
|
-
let
|
|
814
|
-
if (
|
|
815
|
-
const
|
|
816
|
-
let
|
|
817
|
-
const x = Array.isArray(
|
|
818
|
-
if (
|
|
819
|
-
e.insertBefore(
|
|
820
|
-
for (const
|
|
821
|
-
e.insertBefore(T(
|
|
822
|
-
e.insertBefore(
|
|
668
|
+
for (const v of r) {
|
|
669
|
+
let y;
|
|
670
|
+
if (v.tag === "#anchor") {
|
|
671
|
+
const b = v.key, h = `${b}:start`, l = `${b}:end`;
|
|
672
|
+
let p = c.get(h), m = c.get(l);
|
|
673
|
+
const x = Array.isArray(v.children) ? v.children : [];
|
|
674
|
+
if (p || (p = document.createTextNode(""), p.key = h), m || (m = document.createTextNode(""), m.key = l), v._startNode = p, v._endNode = m, !e.contains(p) || !e.contains(m)) {
|
|
675
|
+
e.insertBefore(p, g);
|
|
676
|
+
for (const k of x)
|
|
677
|
+
e.insertBefore(T(k, n), g);
|
|
678
|
+
e.insertBefore(m, g);
|
|
823
679
|
} else
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
680
|
+
u(
|
|
681
|
+
p,
|
|
682
|
+
m,
|
|
683
|
+
a.get(b)?.children,
|
|
828
684
|
x
|
|
829
685
|
);
|
|
830
|
-
|
|
686
|
+
d(p, m), g = m.nextSibling;
|
|
831
687
|
continue;
|
|
832
688
|
}
|
|
833
|
-
if (
|
|
834
|
-
const
|
|
835
|
-
|
|
836
|
-
c.get(
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
689
|
+
if (v.key != null && c.has(v.key)) {
|
|
690
|
+
const b = a.get(v.key);
|
|
691
|
+
y = K(
|
|
692
|
+
c.get(v.key),
|
|
693
|
+
b,
|
|
694
|
+
v,
|
|
695
|
+
n,
|
|
840
696
|
o
|
|
841
|
-
),
|
|
697
|
+
), f.add(y), y !== g && e.contains(y) && (g && !e.contains(g) && (g = null), e.insertBefore(y, g));
|
|
842
698
|
} else
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
}
|
|
846
|
-
for (const
|
|
847
|
-
|
|
848
|
-
if (m instanceof HTMLElement && o)
|
|
849
|
-
for (const h in o)
|
|
850
|
-
o[h] === m && delete o[h];
|
|
851
|
-
e.removeChild(m);
|
|
852
|
-
}
|
|
699
|
+
y = T(v, n, o), g && !e.contains(g) && (g = null), e.insertBefore(y, g), f.add(y);
|
|
700
|
+
g = y.nextSibling;
|
|
701
|
+
}
|
|
702
|
+
for (const v of s)
|
|
703
|
+
!f.has(v) && e.contains(v) && (R(v, o), e.removeChild(v));
|
|
853
704
|
}
|
|
854
|
-
function
|
|
855
|
-
if (t && typeof t != "string" && t.props?.ref && o &&
|
|
856
|
-
if (typeof
|
|
705
|
+
function K(e, t, r, n, o) {
|
|
706
|
+
if (t && typeof t != "string" && t.props?.ref && o && R(e, o), t === r) return e;
|
|
707
|
+
if (typeof r == "string") {
|
|
857
708
|
if (e.nodeType === Node.TEXT_NODE)
|
|
858
|
-
return e.textContent !==
|
|
709
|
+
return e.textContent !== r && (e.textContent = r), e;
|
|
859
710
|
{
|
|
860
|
-
const i = document.createTextNode(
|
|
711
|
+
const i = document.createTextNode(r);
|
|
861
712
|
return e.parentNode?.replaceChild(i, e), i;
|
|
862
713
|
}
|
|
863
714
|
}
|
|
864
|
-
if (
|
|
865
|
-
const i =
|
|
866
|
-
i.key != null && (c.key = `${i.key}:start`,
|
|
867
|
-
const
|
|
868
|
-
|
|
869
|
-
for (const
|
|
870
|
-
|
|
871
|
-
return
|
|
715
|
+
if (r && typeof r != "string" && r.tag === "#anchor") {
|
|
716
|
+
const i = r, a = Array.isArray(i.children) ? i.children : [], c = i._startNode ?? document.createTextNode(""), f = i._endNode ?? document.createTextNode("");
|
|
717
|
+
i.key != null && (c.key = `${i.key}:start`, f.key = `${i.key}:end`), i._startNode = c, i._endNode = f;
|
|
718
|
+
const g = document.createDocumentFragment();
|
|
719
|
+
g.appendChild(c);
|
|
720
|
+
for (const d of a)
|
|
721
|
+
g.appendChild(T(d, n));
|
|
722
|
+
return g.appendChild(f), e.parentNode?.replaceChild(g, e), c;
|
|
872
723
|
}
|
|
873
|
-
if (!
|
|
724
|
+
if (!r) {
|
|
725
|
+
R(e, o);
|
|
874
726
|
const i = document.createComment("removed");
|
|
875
727
|
return e.parentNode?.replaceChild(i, e), i;
|
|
876
728
|
}
|
|
877
729
|
if (!t || typeof t == "string") {
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
730
|
+
R(e, o);
|
|
731
|
+
const i = T(r, n, o);
|
|
732
|
+
return typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), e.parentNode?.replaceChild(i, e), i;
|
|
733
|
+
}
|
|
734
|
+
if (r.tag === "#anchor") {
|
|
735
|
+
const i = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""), c = r._endNode ?? document.createTextNode("");
|
|
736
|
+
r.key != null && (a.key = `${r.key}:start`, c.key = `${r.key}:end`), r._startNode = a, r._endNode = c;
|
|
737
|
+
const f = document.createDocumentFragment();
|
|
738
|
+
f.appendChild(a);
|
|
739
|
+
for (const g of i)
|
|
740
|
+
f.appendChild(T(g, n));
|
|
741
|
+
return f.appendChild(c), e.parentNode?.replaceChild(f, e), a;
|
|
742
|
+
}
|
|
743
|
+
if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && t.key === r.key) {
|
|
891
744
|
const i = e;
|
|
892
|
-
return
|
|
745
|
+
return Be(i, t.props || {}, r.props || {}, n), ze(i, t.children, r.children, n, o), typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), i;
|
|
893
746
|
}
|
|
894
|
-
|
|
895
|
-
|
|
747
|
+
R(e, o);
|
|
748
|
+
const s = T(r, n, o);
|
|
749
|
+
return typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
|
|
896
750
|
}
|
|
897
|
-
function
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
s =
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
if (u !== c && u.nodeName !== "STYLE") {
|
|
908
|
-
if (u instanceof HTMLElement && r)
|
|
909
|
-
for (const f in r)
|
|
910
|
-
r[f] === u && delete r[f];
|
|
911
|
-
d.push(u);
|
|
912
|
-
}
|
|
751
|
+
function Re(e, t, r, n) {
|
|
752
|
+
let o;
|
|
753
|
+
Array.isArray(t) ? t.length === 1 ? (o = t[0], o && typeof o == "object" && o.key == null && (o = { ...o, key: "__root__" })) : o = { tag: "div", key: "__root__", children: t } : (o = t, o && typeof o == "object" && o.key == null && (o = { ...o, key: "__root__" })), o = re(o, String(o.key ?? "root"));
|
|
754
|
+
const s = e._prevVNode ?? null, i = e._prevDom ?? e.firstChild ?? null;
|
|
755
|
+
let a;
|
|
756
|
+
s && i ? typeof s != "string" && typeof o != "string" && s.tag === o.tag && s.key === o.key ? a = K(i, s, o, r, n) : (a = T(o, r, n), e.replaceChild(a, i)) : (a = T(o, r, n), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
|
|
757
|
+
const c = [];
|
|
758
|
+
for (let f = 0; f < e.childNodes.length; f++) {
|
|
759
|
+
const g = e.childNodes[f];
|
|
760
|
+
g !== a && g.nodeName !== "STYLE" && (R(g, n), c.push(g));
|
|
913
761
|
}
|
|
914
|
-
|
|
762
|
+
c.forEach((f) => e.removeChild(f)), e._prevVNode = o, e._prevDom = a;
|
|
763
|
+
}
|
|
764
|
+
function ge(e, ...t) {
|
|
765
|
+
let r = "";
|
|
766
|
+
for (let n = 0; n < e.length; n++)
|
|
767
|
+
r += e[n], n < t.length && (r += t[n]);
|
|
768
|
+
return r;
|
|
915
769
|
}
|
|
916
|
-
function
|
|
770
|
+
function ye(e) {
|
|
917
771
|
return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
|
|
918
772
|
}
|
|
919
|
-
let
|
|
920
|
-
function
|
|
921
|
-
return
|
|
773
|
+
let I = null;
|
|
774
|
+
function ae() {
|
|
775
|
+
return I || (I = new CSSStyleSheet(), I.replaceSync(ye(Me))), I;
|
|
922
776
|
}
|
|
923
|
-
function
|
|
777
|
+
function Ne(e) {
|
|
924
778
|
return e.replace(/url\s*\(\s*['"]?javascript:[^)]*\)/gi, "").replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/expression\s*\([^)]*\)/gi, "");
|
|
925
779
|
}
|
|
926
|
-
const
|
|
780
|
+
const Me = ge`
|
|
927
781
|
:host, *, ::before, ::after {
|
|
928
782
|
all: isolate;
|
|
929
783
|
box-sizing: border-box;
|
|
@@ -981,7 +835,7 @@ const we = `
|
|
|
981
835
|
sup { top: -.5em }
|
|
982
836
|
[disabled], [aria-disabled=true] { cursor: not-allowed }
|
|
983
837
|
[hidden] { display: none }
|
|
984
|
-
`,
|
|
838
|
+
`, Pe = {
|
|
985
839
|
gray: {
|
|
986
840
|
50: "var(--color-gray-50, #f9fafb)",
|
|
987
841
|
100: "var(--color-gray-100, #f3f4f6)",
|
|
@@ -1116,7 +970,7 @@ const we = `
|
|
|
1116
970
|
},
|
|
1117
971
|
white: { DEFAULT: "var(--color-white, #ffffff)" },
|
|
1118
972
|
black: { DEFAULT: "var(--color-black, #000000)" }
|
|
1119
|
-
},
|
|
973
|
+
}, Q = {
|
|
1120
974
|
/* Display */
|
|
1121
975
|
block: "display:block;",
|
|
1122
976
|
inline: "display:inline;",
|
|
@@ -1290,7 +1144,7 @@ const we = `
|
|
|
1290
1144
|
"transition-colors": "transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;",
|
|
1291
1145
|
"transition-opacity": "transition-property:opacity;",
|
|
1292
1146
|
"transition-transform": "transition-property:transform;"
|
|
1293
|
-
},
|
|
1147
|
+
}, Oe = "var(--spacing, 0.25rem)", le = {
|
|
1294
1148
|
m: ["margin"],
|
|
1295
1149
|
mx: ["margin-inline"],
|
|
1296
1150
|
my: ["margin-block"],
|
|
@@ -1321,7 +1175,7 @@ const we = `
|
|
|
1321
1175
|
gap: ["gap"],
|
|
1322
1176
|
"gap-x": ["column-gap"],
|
|
1323
1177
|
"gap-y": ["row-gap"]
|
|
1324
|
-
},
|
|
1178
|
+
}, We = {
|
|
1325
1179
|
// State variants
|
|
1326
1180
|
before: (e, t) => `${e}::before{${t}}`,
|
|
1327
1181
|
after: (e, t) => `${e}::after{${t}}`,
|
|
@@ -1347,7 +1201,7 @@ const we = `
|
|
|
1347
1201
|
"peer-focus": (e, t) => `.peer:focus ~ ${e}{${t}}`,
|
|
1348
1202
|
"peer-checked": (e, t) => `.peer:checked ~ ${e}{${t}}`,
|
|
1349
1203
|
"peer-disabled": (e, t) => `.peer:disabled ~ ${e}{${t}}`
|
|
1350
|
-
},
|
|
1204
|
+
}, ce = {
|
|
1351
1205
|
// Responsive
|
|
1352
1206
|
sm: "(min-width:640px)",
|
|
1353
1207
|
md: "(min-width:768px)",
|
|
@@ -1356,23 +1210,23 @@ const we = `
|
|
|
1356
1210
|
"2xl": "(min-width:1536px)",
|
|
1357
1211
|
// Dark mode (now plain string)
|
|
1358
1212
|
dark: "(prefers-color-scheme: dark)"
|
|
1359
|
-
},
|
|
1360
|
-
function
|
|
1361
|
-
const t = e.startsWith("-"),
|
|
1362
|
-
if (
|
|
1363
|
-
const o =
|
|
1364
|
-
if (Number.isNaN(i) || !
|
|
1365
|
-
const
|
|
1366
|
-
return
|
|
1213
|
+
}, Z = ["sm", "md", "lg", "xl", "2xl"];
|
|
1214
|
+
function X(e) {
|
|
1215
|
+
const t = e.startsWith("-"), n = (t ? e.slice(1) : e).split("-");
|
|
1216
|
+
if (n.length < 2) return null;
|
|
1217
|
+
const o = n.slice(0, -1).join("-"), s = n[n.length - 1], i = parseFloat(s);
|
|
1218
|
+
if (Number.isNaN(i) || !le[o]) return null;
|
|
1219
|
+
const a = t ? "-" : "";
|
|
1220
|
+
return le[o].map((c) => `${c}:calc(${a}${Oe} * ${i});`).join("");
|
|
1367
1221
|
}
|
|
1368
|
-
function
|
|
1369
|
-
const t = e.replace("#", ""),
|
|
1370
|
-
return `${
|
|
1222
|
+
function fe(e) {
|
|
1223
|
+
const t = e.replace("#", ""), r = parseInt(t, 16), n = r >> 16 & 255, o = r >> 8 & 255, s = r & 255;
|
|
1224
|
+
return `${n} ${o} ${s}`;
|
|
1371
1225
|
}
|
|
1372
|
-
function
|
|
1226
|
+
function De(e) {
|
|
1373
1227
|
const t = /^(bg|text|border|shadow|outline|caret|accent)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);
|
|
1374
1228
|
if (!t) return null;
|
|
1375
|
-
const [,
|
|
1229
|
+
const [, r, n, o = "DEFAULT"] = t, s = Pe[n]?.[o];
|
|
1376
1230
|
return s ? `${{
|
|
1377
1231
|
bg: "background-color",
|
|
1378
1232
|
text: "color",
|
|
@@ -1381,40 +1235,40 @@ function Se(e) {
|
|
|
1381
1235
|
outline: "outline-color",
|
|
1382
1236
|
caret: "caret-color",
|
|
1383
1237
|
accent: "accent-color"
|
|
1384
|
-
}[
|
|
1238
|
+
}[r]}:${s};` : null;
|
|
1385
1239
|
}
|
|
1386
|
-
function
|
|
1387
|
-
const [t,
|
|
1388
|
-
if (!
|
|
1389
|
-
const
|
|
1390
|
-
return isNaN(
|
|
1240
|
+
function He(e) {
|
|
1241
|
+
const [t, r] = e.split("/");
|
|
1242
|
+
if (!r) return { base: t };
|
|
1243
|
+
const n = parseInt(r, 10);
|
|
1244
|
+
return isNaN(n) || n < 0 || n > 100 ? { base: t } : { base: t, opacity: n / 100 };
|
|
1391
1245
|
}
|
|
1392
|
-
function
|
|
1393
|
-
const { base: t, opacity:
|
|
1394
|
-
if (
|
|
1395
|
-
if (
|
|
1396
|
-
const s = /#([0-9a-f]{6})/i.exec(
|
|
1246
|
+
function Y(e) {
|
|
1247
|
+
const { base: t, opacity: r } = He(e), n = De(t);
|
|
1248
|
+
if (n) {
|
|
1249
|
+
if (r !== void 0) {
|
|
1250
|
+
const s = /#([0-9a-f]{6})/i.exec(n);
|
|
1397
1251
|
if (s) {
|
|
1398
|
-
const i =
|
|
1399
|
-
return
|
|
1252
|
+
const i = fe(s[0]);
|
|
1253
|
+
return n.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
|
|
1400
1254
|
}
|
|
1401
1255
|
}
|
|
1402
|
-
return
|
|
1256
|
+
return n;
|
|
1403
1257
|
}
|
|
1404
|
-
const o =
|
|
1405
|
-
if (o &&
|
|
1258
|
+
const o = U(t);
|
|
1259
|
+
if (o && r !== void 0) {
|
|
1406
1260
|
const s = /#([0-9a-f]{6})/i.exec(o);
|
|
1407
1261
|
if (s) {
|
|
1408
|
-
const i =
|
|
1409
|
-
return o.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${
|
|
1262
|
+
const i = fe(s[0]);
|
|
1263
|
+
return o.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
|
|
1410
1264
|
}
|
|
1411
1265
|
}
|
|
1412
1266
|
return o;
|
|
1413
1267
|
}
|
|
1414
|
-
function
|
|
1415
|
-
const t = e.indexOf("-["),
|
|
1416
|
-
if (t > 0 &&
|
|
1417
|
-
const
|
|
1268
|
+
function U(e) {
|
|
1269
|
+
const t = e.indexOf("-["), r = e.endsWith("]");
|
|
1270
|
+
if (t > 0 && r) {
|
|
1271
|
+
const n = e.slice(0, t);
|
|
1418
1272
|
let o = e.slice(t + 2, -1);
|
|
1419
1273
|
o = o.replace(/_/g, " ");
|
|
1420
1274
|
const i = {
|
|
@@ -1456,108 +1310,145 @@ function W(e) {
|
|
|
1456
1310
|
weight: "font-weight",
|
|
1457
1311
|
leading: "line-height",
|
|
1458
1312
|
z: "z-index"
|
|
1459
|
-
}[
|
|
1313
|
+
}[n] ?? n.replace(/_/g, "-");
|
|
1460
1314
|
if (i && o) return `${i}:${o};`;
|
|
1461
1315
|
}
|
|
1462
1316
|
return null;
|
|
1463
1317
|
}
|
|
1464
|
-
function
|
|
1318
|
+
function qe(e) {
|
|
1465
1319
|
return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
|
|
1466
1320
|
}
|
|
1467
|
-
function
|
|
1468
|
-
const t = /class\s*=\s*["']([^"']+)["']/g,
|
|
1469
|
-
let
|
|
1470
|
-
for (;
|
|
1321
|
+
function Ie(e) {
|
|
1322
|
+
const t = /class\s*=\s*["']([^"']+)["']/g, r = [];
|
|
1323
|
+
let n;
|
|
1324
|
+
for (; n = t.exec(e); ) {
|
|
1471
1325
|
let o = "", s = !1;
|
|
1472
|
-
for (const i of
|
|
1473
|
-
i === "[" && (s = !0), i === "]" && (s = !1), i === " " && !s ? (o &&
|
|
1474
|
-
o &&
|
|
1326
|
+
for (const i of n[1])
|
|
1327
|
+
i === "[" && (s = !0), i === "]" && (s = !1), i === " " && !s ? (o && r.push(o), o = "") : o += i;
|
|
1328
|
+
o && r.push(o);
|
|
1475
1329
|
}
|
|
1476
|
-
return
|
|
1330
|
+
return r.filter(Boolean);
|
|
1477
1331
|
}
|
|
1478
|
-
const
|
|
1479
|
-
function
|
|
1480
|
-
const t = Date.now(),
|
|
1481
|
-
if (
|
|
1482
|
-
const
|
|
1483
|
-
function
|
|
1484
|
-
const
|
|
1485
|
-
if (
|
|
1486
|
-
const
|
|
1487
|
-
return
|
|
1488
|
-
}
|
|
1489
|
-
function
|
|
1490
|
-
const
|
|
1491
|
-
return
|
|
1492
|
-
}
|
|
1493
|
-
function
|
|
1494
|
-
const
|
|
1495
|
-
(
|
|
1332
|
+
const ue = /* @__PURE__ */ new Map(), Fe = 16;
|
|
1333
|
+
function Ke(e) {
|
|
1334
|
+
const t = Date.now(), r = ue.get(e);
|
|
1335
|
+
if (r && t - r.timestamp < Fe) return r.css;
|
|
1336
|
+
const n = Ie(e), o = new Set(n), s = [], i = [], a = [], c = [], f = {};
|
|
1337
|
+
function g(y, b = !1) {
|
|
1338
|
+
const h = (b ? "dark|" : "") + y;
|
|
1339
|
+
if (h in f) return f[h];
|
|
1340
|
+
const l = u(y, b);
|
|
1341
|
+
return f[h] = l, l;
|
|
1342
|
+
}
|
|
1343
|
+
function d(y) {
|
|
1344
|
+
const b = y.some((l) => Z.includes(l)), h = y.includes("dark");
|
|
1345
|
+
return y.length === 0 ? 1 : !b && !h ? 2 : b && !h ? 3 : 4;
|
|
1346
|
+
}
|
|
1347
|
+
function u(y, b = !1) {
|
|
1348
|
+
const h = y.split(":"), l = h.find(
|
|
1349
|
+
(C) => Q[C] || X(C) || Y(C) || U(C)
|
|
1496
1350
|
);
|
|
1497
|
-
if (!
|
|
1498
|
-
const
|
|
1499
|
-
if (!
|
|
1500
|
-
let
|
|
1501
|
-
const
|
|
1502
|
-
let
|
|
1503
|
-
|
|
1504
|
-
const
|
|
1505
|
-
for (const
|
|
1506
|
-
if (
|
|
1507
|
-
const A =
|
|
1508
|
-
typeof A == "function" && (
|
|
1351
|
+
if (!l) return null;
|
|
1352
|
+
const p = Q[l] ?? X(l) ?? Y(l) ?? U(l);
|
|
1353
|
+
if (!p) return null;
|
|
1354
|
+
let m = `.${qe(y)}`, x = p;
|
|
1355
|
+
const k = h.indexOf(l);
|
|
1356
|
+
let $ = k >= 0 ? h.slice(0, k) : [];
|
|
1357
|
+
b && ($ = $.filter((C) => C !== "dark"));
|
|
1358
|
+
const S = $.filter((C) => Z.includes(C)), _ = S.length ? S[S.length - 1] : null;
|
|
1359
|
+
for (const C of $) {
|
|
1360
|
+
if (Z.includes(C)) continue;
|
|
1361
|
+
const A = We[C];
|
|
1362
|
+
typeof A == "function" && (m = A(m, x).replace(/\{.*$/, ""));
|
|
1509
1363
|
}
|
|
1510
|
-
let
|
|
1511
|
-
return
|
|
1364
|
+
let w = `${m}{${x}}`;
|
|
1365
|
+
return b && _ ? w = `@media (prefers-color-scheme: dark) and ${ce[_]}{${w}}` : b ? w = `@media (prefers-color-scheme: dark){${w}}` : _ && (w = `@media ${ce[_]}{${w}}`), w;
|
|
1512
1366
|
}
|
|
1513
|
-
for (const
|
|
1514
|
-
const
|
|
1515
|
-
(x) =>
|
|
1367
|
+
for (const y of o) {
|
|
1368
|
+
const b = y.split(":"), h = b.find(
|
|
1369
|
+
(x) => Q[x] || X(x) || Y(x) || U(x)
|
|
1516
1370
|
);
|
|
1517
|
-
if (!
|
|
1518
|
-
const
|
|
1519
|
-
if (
|
|
1520
|
-
const x =
|
|
1371
|
+
if (!h) continue;
|
|
1372
|
+
const l = b.indexOf(h), p = l >= 0 ? b.slice(0, l) : [], m = d(p);
|
|
1373
|
+
if (m === 4) {
|
|
1374
|
+
const x = g(y, !0);
|
|
1521
1375
|
x && c.push(x);
|
|
1522
1376
|
} else {
|
|
1523
|
-
const x =
|
|
1524
|
-
x && (
|
|
1377
|
+
const x = g(y);
|
|
1378
|
+
x && (m === 1 ? s.push(x) : m === 2 ? i.push(x) : m === 3 && a.push(x));
|
|
1525
1379
|
}
|
|
1526
1380
|
}
|
|
1527
|
-
const
|
|
1528
|
-
return
|
|
1381
|
+
const v = [...s, ...i, ...a, ...c].join("");
|
|
1382
|
+
return ue.set(e, { css: v, timestamp: t }), v;
|
|
1529
1383
|
}
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1384
|
+
function Ue(e, t, r, n, o, s, i, a) {
|
|
1385
|
+
if (!e) return;
|
|
1386
|
+
if (t.loadingTemplate && r.isLoading) {
|
|
1387
|
+
M(e, t.loadingTemplate(r), r, n, o);
|
|
1388
|
+
return;
|
|
1389
|
+
}
|
|
1390
|
+
if (t.errorTemplate && r.hasError) {
|
|
1391
|
+
r.error instanceof Error && M(e, t.errorTemplate(r.error, r), r, n, o);
|
|
1392
|
+
return;
|
|
1393
|
+
}
|
|
1394
|
+
const c = t.render(r);
|
|
1395
|
+
if (c instanceof Promise) {
|
|
1396
|
+
s(!0), c.then((f) => {
|
|
1397
|
+
s(!1), i(null), M(e, f, r, n, o), a(e.innerHTML);
|
|
1398
|
+
}).catch((f) => {
|
|
1399
|
+
s(!1), i(f), t.errorTemplate && M(e, t.errorTemplate(f, r), r, n, o);
|
|
1400
|
+
}), t.loadingTemplate && M(e, t.loadingTemplate(r), r, n, o);
|
|
1401
|
+
return;
|
|
1402
|
+
}
|
|
1403
|
+
M(e, c, r, n, o), a(e.innerHTML);
|
|
1533
1404
|
}
|
|
1534
|
-
function
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
(t)
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
'"': """,
|
|
1542
|
-
"'": "'"
|
|
1543
|
-
})[t]
|
|
1544
|
-
) : e;
|
|
1405
|
+
function M(e, t, r, n, o) {
|
|
1406
|
+
e && (Re(
|
|
1407
|
+
e,
|
|
1408
|
+
Array.isArray(t) ? t : [t],
|
|
1409
|
+
r,
|
|
1410
|
+
n
|
|
1411
|
+
), o(e.innerHTML));
|
|
1545
1412
|
}
|
|
1546
|
-
function
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1413
|
+
function Ve(e, t, r, n, o, s, i) {
|
|
1414
|
+
if (s !== null && clearTimeout(s), Date.now() - t < 16) {
|
|
1415
|
+
if (o(r + 1), r > 10) {
|
|
1416
|
+
console.warn("Potential infinite render loop detected. Skipping render."), i(null);
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1419
|
+
} else
|
|
1420
|
+
o(0);
|
|
1421
|
+
const c = setTimeout(() => {
|
|
1422
|
+
n(Date.now()), e(), i(null);
|
|
1423
|
+
}, 0);
|
|
1424
|
+
i(c);
|
|
1551
1425
|
}
|
|
1552
|
-
function
|
|
1553
|
-
|
|
1554
|
-
|
|
1426
|
+
function Je(e, t, r, n, o, s) {
|
|
1427
|
+
if (!e) return;
|
|
1428
|
+
const i = Ke(n);
|
|
1429
|
+
if (!t.style && (!i || i.trim() === "")) {
|
|
1430
|
+
s(null), e.adoptedStyleSheets = [ae()];
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1433
|
+
let a = "";
|
|
1434
|
+
t.style && (typeof t.style == "string" ? a = t.style : typeof t.style == "function" && (a = t.style(r)));
|
|
1435
|
+
let c = Ne(`${a}
|
|
1436
|
+
${i}
|
|
1437
|
+
`);
|
|
1438
|
+
c = ye(c);
|
|
1439
|
+
let f = o;
|
|
1440
|
+
f || (f = new CSSStyleSheet()), (f.cssRules.length === 0 || f.toString() !== c) && f.replaceSync(c), e.adoptedStyleSheets = [ae(), f], s(f);
|
|
1441
|
+
}
|
|
1442
|
+
const Qe = /* @__PURE__ */ new Map();
|
|
1443
|
+
function de(e, t, r) {
|
|
1444
|
+
let n = ne(e);
|
|
1445
|
+
n.includes("-") || (n = `cer-${n}`);
|
|
1555
1446
|
let o;
|
|
1556
|
-
typeof t == "function" ? o = { ...
|
|
1557
|
-
console.error(`[${
|
|
1558
|
-
}),
|
|
1447
|
+
typeof t == "function" ? o = { ...r, render: t } : o = t, typeof o.onError != "function" && (o.onError = (s, i) => {
|
|
1448
|
+
console.error(`[${n}] Error:`, s, i);
|
|
1449
|
+
}), Qe.set(n, o), typeof window < "u" && !customElements.get(n) && customElements.define(n, Ze(o));
|
|
1559
1450
|
}
|
|
1560
|
-
function
|
|
1451
|
+
function Ze(e) {
|
|
1561
1452
|
if (!e.render)
|
|
1562
1453
|
throw new Error(
|
|
1563
1454
|
"Component must have a render function"
|
|
@@ -1577,6 +1468,24 @@ function ze(e) {
|
|
|
1577
1468
|
_initializing = !0;
|
|
1578
1469
|
_styleSheet = null;
|
|
1579
1470
|
_lastHtmlStringForJitCSS = "";
|
|
1471
|
+
/**
|
|
1472
|
+
* Returns the last rendered HTML string for JIT CSS.
|
|
1473
|
+
*/
|
|
1474
|
+
get lastHtmlStringForJitCSS() {
|
|
1475
|
+
return this._lastHtmlStringForJitCSS;
|
|
1476
|
+
}
|
|
1477
|
+
/**
|
|
1478
|
+
* Returns true if the component is currently loading.
|
|
1479
|
+
*/
|
|
1480
|
+
get isLoading() {
|
|
1481
|
+
return this._templateLoading;
|
|
1482
|
+
}
|
|
1483
|
+
/**
|
|
1484
|
+
* Returns the last error thrown during rendering, or null if none.
|
|
1485
|
+
*/
|
|
1486
|
+
get lastError() {
|
|
1487
|
+
return this._templateError;
|
|
1488
|
+
}
|
|
1580
1489
|
_cfg;
|
|
1581
1490
|
_lastRenderTime = 0;
|
|
1582
1491
|
_renderCount = 0;
|
|
@@ -1590,30 +1499,35 @@ function ze(e) {
|
|
|
1590
1499
|
writable: !1,
|
|
1591
1500
|
enumerable: !1,
|
|
1592
1501
|
configurable: !1
|
|
1502
|
+
}), Object.defineProperty(t, "requestRender", {
|
|
1503
|
+
value: () => this.requestRender(),
|
|
1504
|
+
writable: !1,
|
|
1505
|
+
enumerable: !1,
|
|
1506
|
+
configurable: !1
|
|
1593
1507
|
}), this.context = t, this._applyProps(e), Object.defineProperty(this.context, "emit", {
|
|
1594
|
-
value: (
|
|
1508
|
+
value: (r, n, o) => {
|
|
1595
1509
|
this.dispatchEvent(
|
|
1596
|
-
new CustomEvent(
|
|
1597
|
-
detail:
|
|
1510
|
+
new CustomEvent(r, {
|
|
1511
|
+
detail: n,
|
|
1598
1512
|
bubbles: !0,
|
|
1599
1513
|
composed: !0,
|
|
1600
1514
|
...o || {}
|
|
1601
1515
|
})
|
|
1602
1516
|
);
|
|
1603
|
-
const s = `on${
|
|
1604
|
-
i && i(
|
|
1517
|
+
const s = `on${r.charAt(0).toUpperCase()}${r.slice(1)}`, i = typeof this[s] == "function" ? this[s] : void 0, a = typeof this.context[s] == "function" ? this.context[s] : void 0, c = typeof e[s] == "function" ? e[s] : void 0;
|
|
1518
|
+
i && i(n, this.context), a && a !== i && a(n, this.context), c && c !== i && c !== a && c(n, this.context);
|
|
1605
1519
|
},
|
|
1606
1520
|
writable: !1,
|
|
1607
1521
|
enumerable: !1,
|
|
1608
1522
|
configurable: !1
|
|
1609
|
-
}), Object.keys(e).forEach((
|
|
1610
|
-
const
|
|
1611
|
-
if (typeof
|
|
1612
|
-
this.context[
|
|
1613
|
-
else if (
|
|
1614
|
-
const o =
|
|
1523
|
+
}), Object.keys(e).forEach((r) => {
|
|
1524
|
+
const n = e[r];
|
|
1525
|
+
if (typeof n == "function" && !r.startsWith("on"))
|
|
1526
|
+
this.context[r] = (...o) => n(...o, this.context);
|
|
1527
|
+
else if (r.startsWith("on") && r.length > 2 && r[2] === r[2].toUpperCase()) {
|
|
1528
|
+
const o = r.slice(2, 3).toLowerCase() + r.slice(3);
|
|
1615
1529
|
this.addEventListener(o, (s) => {
|
|
1616
|
-
const i = typeof this[
|
|
1530
|
+
const i = typeof this[r] == "function" ? this[r] : this.context[r];
|
|
1617
1531
|
typeof i == "function" && i(s.detail, this.context);
|
|
1618
1532
|
});
|
|
1619
1533
|
}
|
|
@@ -1621,34 +1535,61 @@ function ze(e) {
|
|
|
1621
1535
|
}
|
|
1622
1536
|
connectedCallback() {
|
|
1623
1537
|
this._runLogicWithinErrorBoundary(e, () => {
|
|
1624
|
-
|
|
1538
|
+
Ce(
|
|
1539
|
+
e,
|
|
1540
|
+
this.context,
|
|
1541
|
+
this._mounted,
|
|
1542
|
+
(t) => {
|
|
1543
|
+
this._mounted = t;
|
|
1544
|
+
}
|
|
1545
|
+
);
|
|
1625
1546
|
});
|
|
1626
1547
|
}
|
|
1627
1548
|
disconnectedCallback() {
|
|
1628
1549
|
this._runLogicWithinErrorBoundary(e, () => {
|
|
1629
|
-
|
|
1550
|
+
Se(
|
|
1551
|
+
e,
|
|
1552
|
+
this.context,
|
|
1553
|
+
this._listeners,
|
|
1554
|
+
() => {
|
|
1555
|
+
this._listeners = [];
|
|
1556
|
+
},
|
|
1557
|
+
() => {
|
|
1558
|
+
this._watchers.clear();
|
|
1559
|
+
},
|
|
1560
|
+
(t) => {
|
|
1561
|
+
this._templateLoading = t;
|
|
1562
|
+
},
|
|
1563
|
+
(t) => {
|
|
1564
|
+
this._templateError = t;
|
|
1565
|
+
},
|
|
1566
|
+
(t) => {
|
|
1567
|
+
this._mounted = t;
|
|
1568
|
+
}
|
|
1569
|
+
);
|
|
1630
1570
|
});
|
|
1631
1571
|
}
|
|
1632
|
-
attributeChangedCallback(t,
|
|
1572
|
+
attributeChangedCallback(t, r, n) {
|
|
1633
1573
|
this._runLogicWithinErrorBoundary(e, () => {
|
|
1634
|
-
this._applyProps(e),
|
|
1574
|
+
this._applyProps(e), _e(
|
|
1575
|
+
e,
|
|
1635
1576
|
t,
|
|
1636
|
-
n,
|
|
1637
1577
|
r,
|
|
1578
|
+
n,
|
|
1638
1579
|
this.context
|
|
1639
1580
|
);
|
|
1640
1581
|
});
|
|
1641
1582
|
}
|
|
1642
1583
|
static get observedAttributes() {
|
|
1643
|
-
return e.props ? Object.keys(e.props).map(
|
|
1584
|
+
return e.props ? Object.keys(e.props).map(ne) : [];
|
|
1644
1585
|
}
|
|
1645
1586
|
_applyComputed(t) {
|
|
1646
1587
|
this._runLogicWithinErrorBoundary(e, () => {
|
|
1647
|
-
t.computed && Object.entries(t.computed).forEach(([
|
|
1648
|
-
Object.defineProperty(this.context,
|
|
1588
|
+
t.computed && Object.entries(t.computed).forEach(([r, n]) => {
|
|
1589
|
+
Object.defineProperty(this.context, r, {
|
|
1649
1590
|
get: () => {
|
|
1650
|
-
const o =
|
|
1651
|
-
return
|
|
1591
|
+
const o = n(this.context);
|
|
1592
|
+
return ee(o);
|
|
1652
1593
|
},
|
|
1653
1594
|
enumerable: !0
|
|
1654
1595
|
});
|
|
@@ -1658,90 +1599,69 @@ function ze(e) {
|
|
|
1658
1599
|
// --- Render ---
|
|
1659
1600
|
_render(t) {
|
|
1660
1601
|
this._runLogicWithinErrorBoundary(t, () => {
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
throw r;
|
|
1678
|
-
}), t.loadingTemplate && this._renderOutput(t.loadingTemplate(this.context));
|
|
1679
|
-
return;
|
|
1680
|
-
}
|
|
1681
|
-
this._renderOutput(n), this._applyStyle(t);
|
|
1602
|
+
Ue(
|
|
1603
|
+
this.shadowRoot,
|
|
1604
|
+
t,
|
|
1605
|
+
this.context,
|
|
1606
|
+
this._refs,
|
|
1607
|
+
(r) => {
|
|
1608
|
+
this._lastHtmlStringForJitCSS = r, typeof this.onHtmlStringUpdate == "function" && this.onHtmlStringUpdate(r);
|
|
1609
|
+
},
|
|
1610
|
+
(r) => {
|
|
1611
|
+
this._templateLoading = r, typeof this.onLoadingStateChange == "function" && this.onLoadingStateChange(r);
|
|
1612
|
+
},
|
|
1613
|
+
(r) => {
|
|
1614
|
+
this._templateError = r, typeof this.onErrorStateChange == "function" && this.onErrorStateChange(r);
|
|
1615
|
+
},
|
|
1616
|
+
(r) => this._applyStyle(t, r)
|
|
1617
|
+
);
|
|
1682
1618
|
});
|
|
1683
1619
|
}
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
if (!this.shadowRoot) return;
|
|
1687
|
-
const n = new Proxy(this.context, {
|
|
1688
|
-
get: (r, o) => o === "_requestRender" ? () => this._requestRender() : o === "context" ? r : typeof o == "string" && o.includes(".") ? o.split(".").reduce((s, i) => s?.[i], r) : r[o],
|
|
1689
|
-
set: (r, o, s) => {
|
|
1690
|
-
if (typeof o == "string" && o.includes(".")) {
|
|
1691
|
-
const i = o.split("."), l = i.pop();
|
|
1692
|
-
if (!l) return !1;
|
|
1693
|
-
const c = i.reduce((d, p) => (p in d || (d[p] = {}), d[p]), r);
|
|
1694
|
-
return c[l] = s, !0;
|
|
1695
|
-
}
|
|
1696
|
-
return r[o] = s, !0;
|
|
1697
|
-
}
|
|
1698
|
-
});
|
|
1699
|
-
xe(
|
|
1700
|
-
this.shadowRoot,
|
|
1701
|
-
Array.isArray(t) ? t : [t],
|
|
1702
|
-
n,
|
|
1703
|
-
this._refs
|
|
1704
|
-
), this._lastHtmlStringForJitCSS = this.shadowRoot.innerHTML;
|
|
1620
|
+
requestRender() {
|
|
1621
|
+
this._requestRender();
|
|
1705
1622
|
}
|
|
1706
1623
|
_requestRender() {
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1624
|
+
this._runLogicWithinErrorBoundary(this._cfg, () => {
|
|
1625
|
+
Ve(
|
|
1626
|
+
() => this._render(this._cfg),
|
|
1627
|
+
this._lastRenderTime,
|
|
1628
|
+
this._renderCount,
|
|
1629
|
+
(t) => {
|
|
1630
|
+
this._lastRenderTime = t;
|
|
1631
|
+
},
|
|
1632
|
+
(t) => {
|
|
1633
|
+
this._renderCount = t;
|
|
1634
|
+
},
|
|
1635
|
+
this._renderTimeoutId,
|
|
1636
|
+
(t) => {
|
|
1637
|
+
this._renderTimeoutId = t;
|
|
1638
|
+
}
|
|
1639
|
+
);
|
|
1640
|
+
});
|
|
1719
1641
|
}
|
|
1720
1642
|
// --- Style ---
|
|
1721
|
-
_applyStyle(t) {
|
|
1643
|
+
_applyStyle(t, r) {
|
|
1722
1644
|
this._runLogicWithinErrorBoundary(t, () => {
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
this.
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
`);
|
|
1734
|
-
o = oe(o), this._styleSheet || (this._styleSheet = new CSSStyleSheet()), (this._styleSheet.cssRules.length === 0 || this._styleSheet.toString() !== o) && this._styleSheet.replaceSync(o), this.shadowRoot.adoptedStyleSheets = [G(), this._styleSheet];
|
|
1645
|
+
Je(
|
|
1646
|
+
this.shadowRoot,
|
|
1647
|
+
t,
|
|
1648
|
+
this.context,
|
|
1649
|
+
r,
|
|
1650
|
+
this._styleSheet,
|
|
1651
|
+
(n) => {
|
|
1652
|
+
this._styleSheet = n;
|
|
1653
|
+
}
|
|
1654
|
+
);
|
|
1735
1655
|
});
|
|
1736
1656
|
}
|
|
1737
1657
|
// --- Error Boundary function ---
|
|
1738
|
-
_runLogicWithinErrorBoundary(t,
|
|
1658
|
+
_runLogicWithinErrorBoundary(t, r) {
|
|
1739
1659
|
this._hasError && (this._hasError = !1);
|
|
1740
1660
|
try {
|
|
1741
|
-
|
|
1742
|
-
} catch (
|
|
1743
|
-
this._hasError = !0, t.onError && t.onError(
|
|
1744
|
-
|
|
1661
|
+
r();
|
|
1662
|
+
} catch (n) {
|
|
1663
|
+
this._hasError = !0, t.onError && t.onError(n, this.context), t.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = t.errorFallback(
|
|
1664
|
+
n,
|
|
1745
1665
|
this.context
|
|
1746
1666
|
));
|
|
1747
1667
|
}
|
|
@@ -1749,11 +1669,11 @@ ${n}
|
|
|
1749
1669
|
// --- State, props, computed ---
|
|
1750
1670
|
_initContext(t) {
|
|
1751
1671
|
try {
|
|
1752
|
-
let
|
|
1672
|
+
let r = function(o, s = "") {
|
|
1753
1673
|
return Array.isArray(o) ? new Proxy(o, {
|
|
1754
|
-
get(i,
|
|
1755
|
-
const
|
|
1756
|
-
return typeof
|
|
1674
|
+
get(i, a, c) {
|
|
1675
|
+
const f = Reflect.get(i, a, c);
|
|
1676
|
+
return typeof f == "function" && typeof a == "string" && [
|
|
1757
1677
|
"push",
|
|
1758
1678
|
"pop",
|
|
1759
1679
|
"shift",
|
|
@@ -1761,132 +1681,522 @@ ${n}
|
|
|
1761
1681
|
"splice",
|
|
1762
1682
|
"sort",
|
|
1763
1683
|
"reverse"
|
|
1764
|
-
].includes(
|
|
1765
|
-
const
|
|
1766
|
-
if (!
|
|
1767
|
-
const
|
|
1768
|
-
|
|
1684
|
+
].includes(a) ? function(...d) {
|
|
1685
|
+
const u = f.apply(i, d);
|
|
1686
|
+
if (!n._initializing) {
|
|
1687
|
+
const v = s || "root";
|
|
1688
|
+
n._triggerWatchers(v, i), n._render(t);
|
|
1769
1689
|
}
|
|
1770
|
-
return
|
|
1771
|
-
} :
|
|
1690
|
+
return u;
|
|
1691
|
+
} : f;
|
|
1772
1692
|
},
|
|
1773
|
-
set(i,
|
|
1774
|
-
if (i[
|
|
1775
|
-
const
|
|
1776
|
-
|
|
1693
|
+
set(i, a, c) {
|
|
1694
|
+
if (i[a] = c, !n._initializing) {
|
|
1695
|
+
const f = s ? `${s}.${String(a)}` : String(a);
|
|
1696
|
+
n._triggerWatchers(f, c), n._render(t);
|
|
1777
1697
|
}
|
|
1778
1698
|
return !0;
|
|
1779
1699
|
},
|
|
1780
|
-
deleteProperty(i,
|
|
1781
|
-
if (delete i[
|
|
1782
|
-
const c = s ? `${s}.${String(
|
|
1783
|
-
|
|
1700
|
+
deleteProperty(i, a) {
|
|
1701
|
+
if (delete i[a], !n._initializing) {
|
|
1702
|
+
const c = s ? `${s}.${String(a)}` : String(a);
|
|
1703
|
+
n._triggerWatchers(c, void 0), n._render(t);
|
|
1784
1704
|
}
|
|
1785
1705
|
return !0;
|
|
1786
1706
|
}
|
|
1787
1707
|
}) : o && typeof o == "object" ? (Object.keys(o).forEach((i) => {
|
|
1788
|
-
const
|
|
1789
|
-
o[i] =
|
|
1708
|
+
const a = s ? `${s}.${i}` : i;
|
|
1709
|
+
o[i] = r(o[i], a);
|
|
1790
1710
|
}), new Proxy(o, {
|
|
1791
|
-
set(i,
|
|
1792
|
-
const
|
|
1793
|
-
return i[
|
|
1794
|
-
|
|
1795
|
-
i[
|
|
1796
|
-
),
|
|
1711
|
+
set(i, a, c) {
|
|
1712
|
+
const f = s ? `${s}.${String(a)}` : String(a);
|
|
1713
|
+
return i[a] = r(c, f), n._initializing || (n._triggerWatchers(
|
|
1714
|
+
f,
|
|
1715
|
+
i[a]
|
|
1716
|
+
), n._render(t)), !0;
|
|
1797
1717
|
},
|
|
1798
|
-
get(i,
|
|
1799
|
-
return Reflect.get(i,
|
|
1718
|
+
get(i, a, c) {
|
|
1719
|
+
return Reflect.get(i, a, c);
|
|
1800
1720
|
}
|
|
1801
1721
|
})) : o;
|
|
1802
1722
|
};
|
|
1803
|
-
const
|
|
1804
|
-
return
|
|
1723
|
+
const n = this;
|
|
1724
|
+
return r({ ...t.state });
|
|
1805
1725
|
} catch {
|
|
1806
1726
|
return {};
|
|
1807
1727
|
}
|
|
1808
1728
|
}
|
|
1809
1729
|
_initWatchers(t) {
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
}), s.immediate)
|
|
1818
|
-
try {
|
|
1819
|
-
const i = this._getNestedValue(n);
|
|
1820
|
-
o(i, void 0, this.context);
|
|
1821
|
-
} catch (i) {
|
|
1822
|
-
console.error(`Error in immediate watcher for "${n}":`, i);
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1730
|
+
this._runLogicWithinErrorBoundary(t, () => {
|
|
1731
|
+
we(
|
|
1732
|
+
this.context,
|
|
1733
|
+
this._watchers,
|
|
1734
|
+
t.watch || {}
|
|
1735
|
+
);
|
|
1736
|
+
});
|
|
1825
1737
|
}
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
(n, r) => n?.[r],
|
|
1829
|
-
this.context
|
|
1830
|
-
);
|
|
1738
|
+
_triggerWatchers(t, r) {
|
|
1739
|
+
ke(this.context, this._watchers, t, r);
|
|
1831
1740
|
}
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
if (s === i) return !0;
|
|
1835
|
-
if (typeof s != typeof i || typeof s != "object" || s === null || i === null) return !1;
|
|
1836
|
-
if (Array.isArray(s) && Array.isArray(i))
|
|
1837
|
-
return s.length !== i.length ? !1 : s.every((d, p) => r(d, i[p]));
|
|
1838
|
-
const l = Object.keys(s), c = Object.keys(i);
|
|
1839
|
-
return l.length !== c.length ? !1 : l.every((d) => r(s[d], i[d]));
|
|
1840
|
-
}, o = this._watchers.get(t);
|
|
1841
|
-
if (o && !r(n, o.oldValue))
|
|
1741
|
+
_applyProps(t) {
|
|
1742
|
+
this._runLogicWithinErrorBoundary(t, () => {
|
|
1842
1743
|
try {
|
|
1843
|
-
|
|
1844
|
-
} catch (
|
|
1845
|
-
|
|
1744
|
+
$e(this, t, this.context);
|
|
1745
|
+
} catch (r) {
|
|
1746
|
+
this._hasError = !0, t.onError && t.onError(r, this.context), t.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = t.errorFallback(r, this.context));
|
|
1846
1747
|
}
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1750
|
+
};
|
|
1751
|
+
}
|
|
1752
|
+
function F(e, t = {}, r, n) {
|
|
1753
|
+
const o = n ?? t.key;
|
|
1754
|
+
return { tag: e, key: o, props: t, children: r };
|
|
1755
|
+
}
|
|
1756
|
+
function V(e) {
|
|
1757
|
+
return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
|
|
1758
|
+
}
|
|
1759
|
+
function P(e) {
|
|
1760
|
+
return typeof e == "object" && e !== null && "tag" in e && !V(e);
|
|
1761
|
+
}
|
|
1762
|
+
function Xe(e, t) {
|
|
1763
|
+
return e.key != null ? e : { ...e, key: t };
|
|
1764
|
+
}
|
|
1765
|
+
function Ye(e, t = [], r = {}) {
|
|
1766
|
+
const n = {}, o = {}, s = {}, i = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
|
|
1767
|
+
let a;
|
|
1768
|
+
for (; a = i.exec(e); ) {
|
|
1769
|
+
const c = a[1], f = a[2], g = (a[4] || a[6]) ?? "", d = g.match(/^{{(\d+)}}$/);
|
|
1770
|
+
let u = d ? t[Number(d[1])] ?? null : g;
|
|
1771
|
+
if (d || (u === "true" ? u = !0 : u === "false" ? u = !1 : u === "null" ? u = null : isNaN(Number(u)) || (u = Number(u))), c === ":")
|
|
1772
|
+
typeof u == "boolean" ? o[f] = u : u != null && (n[f] = u);
|
|
1773
|
+
else if (c === "@") {
|
|
1774
|
+
const v = "on" + f.charAt(0).toUpperCase() + f.slice(1);
|
|
1775
|
+
n[v] = typeof u == "function" ? u : typeof r[u] == "function" ? r[u] : void 0;
|
|
1776
|
+
} else if (c === "#") {
|
|
1777
|
+
const [v, ...y] = f.split("."), b = [...y];
|
|
1778
|
+
let h = u, l = [...b];
|
|
1779
|
+
if (v === "model" && typeof h == "string" && h.includes(".")) {
|
|
1780
|
+
const p = ["trim", "number", "lazy"], m = h.split(".");
|
|
1781
|
+
let x = h;
|
|
1782
|
+
const k = [];
|
|
1783
|
+
for (let $ = m.length - 1; $ > 0 && p.includes(m[$]); $--)
|
|
1784
|
+
k.unshift(m[$]), x = m.slice(0, $).join(".");
|
|
1785
|
+
h = x, l.push(...k);
|
|
1786
|
+
}
|
|
1787
|
+
s[v] = {
|
|
1788
|
+
value: h,
|
|
1789
|
+
modifiers: l
|
|
1790
|
+
};
|
|
1791
|
+
} else f === "ref" ? n.ref = u : o[f] = u;
|
|
1792
|
+
}
|
|
1793
|
+
return { props: n, attrs: o, directives: s };
|
|
1794
|
+
}
|
|
1795
|
+
function Ge(e, t, r) {
|
|
1796
|
+
function n(l, p) {
|
|
1797
|
+
return F("#text", {}, l, p);
|
|
1798
|
+
}
|
|
1799
|
+
let o = "";
|
|
1800
|
+
for (let l = 0; l < e.length; l++)
|
|
1801
|
+
o += e[l], l < t.length && (o += `{{${l}}}`);
|
|
1802
|
+
const s = /<\/?([a-zA-Z0-9-]+)([^>]*)\/?>|{{(\d+)}}|([^<]+)/g, i = [];
|
|
1803
|
+
let a = null, c, f = [], g = null, d = {}, u, v = 0, y = [];
|
|
1804
|
+
function b(l) {
|
|
1805
|
+
!l || typeof l != "object" || V(l) || (l.props || l.attrs ? (l.props && (d.props || (d.props = {}), Object.assign(d.props, l.props)), l.attrs && (d.attrs || (d.attrs = {}), Object.keys(l.attrs).forEach((p) => {
|
|
1806
|
+
if (p === "style" && d.attrs.style) {
|
|
1807
|
+
const m = d.attrs.style.replace(
|
|
1808
|
+
/;?\s*$/,
|
|
1809
|
+
""
|
|
1810
|
+
), x = l.attrs.style.replace(/^;?\s*/, "");
|
|
1811
|
+
d.attrs.style = m + "; " + x;
|
|
1812
|
+
} else if (p === "class" && d.attrs.class) {
|
|
1813
|
+
const m = d.attrs.class.trim().split(/\s+/).filter(Boolean), x = l.attrs.class.trim().split(/\s+/).filter(Boolean), k = [
|
|
1814
|
+
.../* @__PURE__ */ new Set([...m, ...x])
|
|
1815
|
+
];
|
|
1816
|
+
d.attrs.class = k.join(" ");
|
|
1817
|
+
} else
|
|
1818
|
+
d.attrs[p] = l.attrs[p];
|
|
1819
|
+
}))) : (d.props || (d.props = {}), Object.assign(d.props, l)));
|
|
1820
|
+
}
|
|
1821
|
+
function h(l, p) {
|
|
1822
|
+
const m = g ? f : y;
|
|
1823
|
+
if (V(l)) {
|
|
1824
|
+
const x = l.key ?? p;
|
|
1825
|
+
let k = l.children;
|
|
1826
|
+
m.push({
|
|
1827
|
+
...l,
|
|
1828
|
+
key: x,
|
|
1829
|
+
children: k
|
|
1830
|
+
});
|
|
1831
|
+
return;
|
|
1832
|
+
}
|
|
1833
|
+
if (P(l)) {
|
|
1834
|
+
m.push(Xe(l, void 0));
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1837
|
+
if (Array.isArray(l)) {
|
|
1838
|
+
if (l.length === 0) return;
|
|
1839
|
+
for (let x = 0; x < l.length; x++) {
|
|
1840
|
+
const k = l[x];
|
|
1841
|
+
V(k) || P(k) || Array.isArray(k) ? h(k, `${p}-${x}`) : k !== null && typeof k == "object" ? b(k) : m.push(n(String(k), `${p}-${x}`));
|
|
1842
|
+
}
|
|
1843
|
+
return;
|
|
1844
|
+
}
|
|
1845
|
+
if (l !== null && typeof l == "object") {
|
|
1846
|
+
b(l);
|
|
1847
|
+
return;
|
|
1848
|
+
}
|
|
1849
|
+
m.push(n(String(l), p));
|
|
1850
|
+
}
|
|
1851
|
+
for (; c = s.exec(o); )
|
|
1852
|
+
if (c[1]) {
|
|
1853
|
+
const l = c[1], p = c[0][1] === "/", m = c[0][c[0].length - 2] === "/", {
|
|
1854
|
+
props: x,
|
|
1855
|
+
attrs: k,
|
|
1856
|
+
directives: $
|
|
1857
|
+
} = Ye(c[2] || "", t, r), S = { props: {}, attrs: {} };
|
|
1858
|
+
for (const w in x) S.props[w] = x[w];
|
|
1859
|
+
for (const w in k) S.attrs[w] = k[w];
|
|
1860
|
+
for (const [w, C] of Object.entries($))
|
|
1861
|
+
if (w === "bind")
|
|
1862
|
+
if (typeof C.value == "object" && C.value !== null)
|
|
1863
|
+
for (const [A, E] of Object.entries(C.value))
|
|
1864
|
+
typeof E == "boolean" ? S.attrs[A] = E : E != null && (S.attrs[A] = String(E));
|
|
1865
|
+
else C.value != null && (S.attrs[w] = String(C.value));
|
|
1866
|
+
else if (w === "show") {
|
|
1867
|
+
const A = !!C.value;
|
|
1868
|
+
S.attrs.style = (S.attrs.style || "") + (A ? "" : "; display: none !important");
|
|
1869
|
+
} else if (w === "class") {
|
|
1870
|
+
const A = C.value;
|
|
1871
|
+
let E = [];
|
|
1872
|
+
if (typeof A == "string")
|
|
1873
|
+
E = A.split(/\s+/).filter(Boolean);
|
|
1874
|
+
else if (Array.isArray(A)) {
|
|
1875
|
+
for (const j of A)
|
|
1876
|
+
if (typeof j == "string")
|
|
1877
|
+
E.push(...j.split(/\s+/).filter(Boolean));
|
|
1878
|
+
else if (j && typeof j == "object")
|
|
1879
|
+
for (const [L, q] of Object.entries(j))
|
|
1880
|
+
q && E.push(...L.split(/\s+/).filter(Boolean));
|
|
1881
|
+
} else if (A && typeof A == "object")
|
|
1882
|
+
for (const [j, L] of Object.entries(A))
|
|
1883
|
+
L && E.push(...j.split(/\s+/).filter(Boolean));
|
|
1884
|
+
const W = S.attrs.class || "", D = [
|
|
1885
|
+
.../* @__PURE__ */ new Set([
|
|
1886
|
+
...W.split(/\s+/).filter(Boolean),
|
|
1887
|
+
...E
|
|
1888
|
+
])
|
|
1889
|
+
];
|
|
1890
|
+
S.attrs.class = D.join(" ");
|
|
1891
|
+
} else if (w === "style") {
|
|
1892
|
+
const A = C.value;
|
|
1893
|
+
let E = "";
|
|
1894
|
+
if (typeof A == "string")
|
|
1895
|
+
E = A;
|
|
1896
|
+
else if (A && typeof A == "object") {
|
|
1897
|
+
const D = [];
|
|
1898
|
+
for (const [j, L] of Object.entries(A))
|
|
1899
|
+
if (L != null && L !== "") {
|
|
1900
|
+
const q = j.replace(
|
|
1901
|
+
/[A-Z]/g,
|
|
1902
|
+
(be) => `-${be.toLowerCase()}`
|
|
1903
|
+
), me = [
|
|
1904
|
+
"width",
|
|
1905
|
+
"height",
|
|
1906
|
+
"top",
|
|
1907
|
+
"right",
|
|
1908
|
+
"bottom",
|
|
1909
|
+
"left",
|
|
1910
|
+
"margin",
|
|
1911
|
+
"margin-top",
|
|
1912
|
+
"margin-right",
|
|
1913
|
+
"margin-bottom",
|
|
1914
|
+
"margin-left",
|
|
1915
|
+
"padding",
|
|
1916
|
+
"padding-top",
|
|
1917
|
+
"padding-right",
|
|
1918
|
+
"padding-bottom",
|
|
1919
|
+
"padding-left",
|
|
1920
|
+
"font-size",
|
|
1921
|
+
"line-height",
|
|
1922
|
+
"border-width",
|
|
1923
|
+
"border-radius",
|
|
1924
|
+
"min-width",
|
|
1925
|
+
"max-width",
|
|
1926
|
+
"min-height",
|
|
1927
|
+
"max-height"
|
|
1928
|
+
];
|
|
1929
|
+
let oe = String(L);
|
|
1930
|
+
typeof L == "number" && me.includes(q) && (oe = `${L}px`), D.push(`${q}: ${oe}`);
|
|
1931
|
+
}
|
|
1932
|
+
E = D.join("; ") + (D.length > 0 ? ";" : "");
|
|
1854
1933
|
}
|
|
1934
|
+
const W = S.attrs.style || "";
|
|
1935
|
+
S.attrs.style = W + (W && !W.endsWith(";") ? "; " : "") + E;
|
|
1936
|
+
}
|
|
1937
|
+
const _ = {};
|
|
1938
|
+
for (const [w, C] of Object.entries($))
|
|
1939
|
+
["bind", "show", "class", "style"].includes(w) || (_[w] = C);
|
|
1940
|
+
if (Object.keys(_).length > 0 && (S.directives = _), p) {
|
|
1941
|
+
const w = F(
|
|
1942
|
+
g,
|
|
1943
|
+
d,
|
|
1944
|
+
f.length === 1 && P(f[0]) && f[0].tag === "#text" ? typeof f[0].children == "string" ? f[0].children : "" : f.length ? f : void 0,
|
|
1945
|
+
u
|
|
1946
|
+
), C = i.pop();
|
|
1947
|
+
C ? (g = C.tag, d = C.props, u = C.key, f = C.children, f.push(w)) : a = w;
|
|
1948
|
+
} else m ? (g ? f : y).push(F(l, S, void 0, void 0)) : (g && i.push({
|
|
1949
|
+
tag: g,
|
|
1950
|
+
props: d,
|
|
1951
|
+
children: f,
|
|
1952
|
+
key: u
|
|
1953
|
+
}), g = l, d = S, f = []);
|
|
1954
|
+
} else if (typeof c[3] < "u") {
|
|
1955
|
+
const l = Number(c[3]), p = t[l], m = `interp-${l}`;
|
|
1956
|
+
h(p, m);
|
|
1957
|
+
} else if (c[4]) {
|
|
1958
|
+
const l = c[4], p = g ? f : y, m = l.split(/({{\d+}})/);
|
|
1959
|
+
for (const x of m) {
|
|
1960
|
+
if (!x) continue;
|
|
1961
|
+
const k = x.match(/^{{(\d+)}}$/);
|
|
1962
|
+
if (k) {
|
|
1963
|
+
const $ = Number(k[1]), S = t[$], _ = `interp-${$}`;
|
|
1964
|
+
h(S, _);
|
|
1965
|
+
} else {
|
|
1966
|
+
const $ = `text-${v++}`;
|
|
1967
|
+
p.push(n(x, $));
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1855
1970
|
}
|
|
1856
|
-
|
|
1971
|
+
if (a)
|
|
1972
|
+
return P(a) && Array.isArray(a.children) && (a.children = a.children.filter(
|
|
1973
|
+
(l) => P(l) ? l.tag !== "#text" || typeof l.children == "string" && l.children.trim() !== "" : !0
|
|
1974
|
+
// keep non-element VNodes (including anchors) as-is
|
|
1975
|
+
)), a;
|
|
1976
|
+
if (y.length > 0) {
|
|
1977
|
+
const l = y.filter(
|
|
1978
|
+
(p) => P(p) ? p.tag !== "#text" || typeof p.children == "string" && p.children.trim() !== "" : !0
|
|
1979
|
+
);
|
|
1980
|
+
return l.length === 1 ? l[0] : l;
|
|
1981
|
+
}
|
|
1982
|
+
return F("div", {}, "", "fallback-root");
|
|
1983
|
+
}
|
|
1984
|
+
function z(e, ...t) {
|
|
1985
|
+
const r = t[t.length - 1], n = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
|
|
1986
|
+
return Ge(e, t, n);
|
|
1987
|
+
}
|
|
1988
|
+
const pe = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, B = (e, t) => {
|
|
1989
|
+
for (const r of e) {
|
|
1990
|
+
const n = [], o = r.path.replace(/:[^/]+/g, (a) => (n.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${o}$`), i = t.match(s);
|
|
1991
|
+
if (i) {
|
|
1992
|
+
const a = {};
|
|
1993
|
+
return n.forEach((c, f) => {
|
|
1994
|
+
a[c] = i[f + 1];
|
|
1995
|
+
}), { route: r, params: a };
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
return { route: null, params: {} };
|
|
1999
|
+
}, G = {};
|
|
2000
|
+
async function et(e) {
|
|
2001
|
+
if (e.component) return e.component;
|
|
2002
|
+
if (e.load) {
|
|
2003
|
+
if (G[e.path]) return G[e.path];
|
|
2004
|
+
try {
|
|
2005
|
+
const t = await e.load();
|
|
2006
|
+
return G[e.path] = t.default, t.default;
|
|
2007
|
+
} catch {
|
|
2008
|
+
throw new Error(`Failed to load component for route: ${e.path}`);
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
throw new Error(`No component or loader defined for route: ${e.path}`);
|
|
2012
|
+
}
|
|
2013
|
+
function tt(e) {
|
|
2014
|
+
const { routes: t, base: r = "", initialUrl: n } = e;
|
|
2015
|
+
let o, s, i, a, c, f, g;
|
|
2016
|
+
const d = async (b, h) => {
|
|
2017
|
+
const l = t.find((p) => B([p], b.path).route !== null);
|
|
2018
|
+
if (l?.beforeEnter)
|
|
1857
2019
|
try {
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
}
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
2020
|
+
const p = await l.beforeEnter(b, h);
|
|
2021
|
+
return typeof p == "string" ? (await y(p, !0), !1) : p !== !1;
|
|
2022
|
+
} catch (p) {
|
|
2023
|
+
return console.error("beforeEnter error", p), !1;
|
|
2024
|
+
}
|
|
2025
|
+
return !0;
|
|
2026
|
+
}, u = async (b, h) => {
|
|
2027
|
+
const l = t.find((p) => B([p], b.path).route !== null);
|
|
2028
|
+
if (l?.onEnter)
|
|
2029
|
+
try {
|
|
2030
|
+
const p = await l.onEnter(b, h);
|
|
2031
|
+
return typeof p == "string" ? (await y(p, !0), !1) : p !== !1;
|
|
2032
|
+
} catch (p) {
|
|
2033
|
+
return console.error("onEnter error", p), !1;
|
|
2034
|
+
}
|
|
2035
|
+
return !0;
|
|
2036
|
+
}, v = (b, h) => {
|
|
2037
|
+
const l = t.find((p) => B([p], b.path).route !== null);
|
|
2038
|
+
if (l?.afterEnter)
|
|
2039
|
+
try {
|
|
2040
|
+
l.afterEnter(b, h);
|
|
2041
|
+
} catch (p) {
|
|
2042
|
+
console.error("afterEnter error", p);
|
|
1877
2043
|
}
|
|
2044
|
+
}, y = async (b, h = !1) => {
|
|
2045
|
+
try {
|
|
2046
|
+
const l = {
|
|
2047
|
+
path: b.replace(r, "") || "/",
|
|
2048
|
+
query: {}
|
|
2049
|
+
}, p = B(t, l.path);
|
|
2050
|
+
if (!p) throw new Error(`No route found for ${l.path}`);
|
|
2051
|
+
const m = i.getState(), x = {
|
|
2052
|
+
path: l.path,
|
|
2053
|
+
params: p.params,
|
|
2054
|
+
query: l.query
|
|
2055
|
+
};
|
|
2056
|
+
if (!await d(x, m) || !await u(x, m)) return;
|
|
2057
|
+
typeof window < "u" && typeof document < "u" && (h ? window.history.replaceState({}, "", r + b) : window.history.pushState({}, "", r + b)), i.setState(x), v(x, m);
|
|
2058
|
+
} catch (l) {
|
|
2059
|
+
console.error("Navigation error:", l);
|
|
1878
2060
|
}
|
|
1879
2061
|
};
|
|
2062
|
+
if (typeof window < "u" && typeof document < "u") {
|
|
2063
|
+
o = () => {
|
|
2064
|
+
const h = new URL(window.location.href), l = h.pathname.replace(r, "") || "/", p = pe(h.search);
|
|
2065
|
+
return { path: l, query: p };
|
|
2066
|
+
}, s = o();
|
|
2067
|
+
const b = B(t, s.path);
|
|
2068
|
+
i = ie({
|
|
2069
|
+
path: s.path,
|
|
2070
|
+
params: b.params,
|
|
2071
|
+
query: s.query
|
|
2072
|
+
}), a = async (h = !1) => {
|
|
2073
|
+
const l = o();
|
|
2074
|
+
await y(l.path, h);
|
|
2075
|
+
}, window.addEventListener("popstate", () => a(!0)), c = (h) => y(h, !1), f = (h) => y(h, !0), g = () => window.history.back();
|
|
2076
|
+
} else {
|
|
2077
|
+
o = () => {
|
|
2078
|
+
const h = new URL(n || "/", "http://localhost"), l = h.pathname.replace(r, "") || "/", p = pe(h.search);
|
|
2079
|
+
return { path: l, query: p };
|
|
2080
|
+
}, s = o();
|
|
2081
|
+
const b = B(t, s.path);
|
|
2082
|
+
i = ie({
|
|
2083
|
+
path: s.path,
|
|
2084
|
+
params: b.params,
|
|
2085
|
+
query: s.query
|
|
2086
|
+
}), a = async () => {
|
|
2087
|
+
}, c = async () => {
|
|
2088
|
+
}, f = async () => {
|
|
2089
|
+
}, g = () => {
|
|
2090
|
+
};
|
|
2091
|
+
}
|
|
2092
|
+
return {
|
|
2093
|
+
store: i,
|
|
2094
|
+
push: c,
|
|
2095
|
+
replace: f,
|
|
2096
|
+
back: g,
|
|
2097
|
+
subscribe: i.subscribe,
|
|
2098
|
+
matchRoute: (b) => B(t, b),
|
|
2099
|
+
getCurrent: () => i.getState(),
|
|
2100
|
+
resolveRouteComponent: et
|
|
2101
|
+
};
|
|
2102
|
+
}
|
|
2103
|
+
function ct(e, t) {
|
|
2104
|
+
return B(e, t);
|
|
2105
|
+
}
|
|
2106
|
+
function ft(e) {
|
|
2107
|
+
const t = tt(e);
|
|
2108
|
+
return de("router-view", {
|
|
2109
|
+
async render() {
|
|
2110
|
+
if (!t) return z`<div>Router not initialized.</div>`;
|
|
2111
|
+
const r = t.getCurrent(), { path: n } = r, o = t.matchRoute(n);
|
|
2112
|
+
if (!o.route) return z`<div>Not found</div>`;
|
|
2113
|
+
let s = o.route.component;
|
|
2114
|
+
if (o.route.load) {
|
|
2115
|
+
const i = await o.route.load();
|
|
2116
|
+
typeof i.default == "string" && (s = i.default);
|
|
2117
|
+
}
|
|
2118
|
+
return typeof s == "string" ? z`<${s}></${s}>` : z`<div>Invalid route component</div>`;
|
|
2119
|
+
},
|
|
2120
|
+
onConnected(r) {
|
|
2121
|
+
t && typeof t.subscribe == "function" && t.subscribe(() => {
|
|
2122
|
+
typeof r.requestRender == "function" && r.requestRender();
|
|
2123
|
+
});
|
|
2124
|
+
}
|
|
2125
|
+
}), de("router-link", {
|
|
2126
|
+
state: {},
|
|
2127
|
+
props: {
|
|
2128
|
+
to: { type: String, default: "" },
|
|
2129
|
+
tag: { type: String, default: "a" },
|
|
2130
|
+
replace: { type: Boolean, default: !1 },
|
|
2131
|
+
exact: { type: Boolean, default: !1 },
|
|
2132
|
+
activeClass: { type: String, default: "active" },
|
|
2133
|
+
exactActiveClass: { type: String, default: "exact-active" },
|
|
2134
|
+
ariaCurrentValue: { type: String, default: "page" },
|
|
2135
|
+
disabled: { type: Boolean, default: !1 },
|
|
2136
|
+
external: { type: Boolean, default: !1 },
|
|
2137
|
+
style: { type: String, default: ge`
|
|
2138
|
+
[aria-disabled="true"] {
|
|
2139
|
+
pointer-events: none;
|
|
2140
|
+
opacity: 0.5;
|
|
2141
|
+
}
|
|
2142
|
+
` }
|
|
2143
|
+
},
|
|
2144
|
+
style: (r) => r.props.style,
|
|
2145
|
+
render: (r) => {
|
|
2146
|
+
const n = t.getCurrent(), o = r.props.to, s = r.props.exact, i = r.props.exactActiveClass, a = r.props.activeClass, c = r.props.ariaCurrentValue, f = r.props.tag, g = r.props.disabled, d = r.props.external, u = n.path === o, v = s ? u : n && typeof n.path == "string" ? n.path.startsWith(o) : !1, y = u ? i : v ? a : "", b = u ? `aria-current="${c}"` : "", h = f === "button", l = g ? h ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", p = d && (f === "a" || !f) ? 'target="_blank" rel="noopener noreferrer"' : "";
|
|
2147
|
+
return z`
|
|
2148
|
+
${ve().when(h, z`
|
|
2149
|
+
<button
|
|
2150
|
+
part="button"
|
|
2151
|
+
class="${y}"
|
|
2152
|
+
${b}
|
|
2153
|
+
${l}
|
|
2154
|
+
${p}
|
|
2155
|
+
data-on-click="navigate"
|
|
2156
|
+
><slot></slot></button>
|
|
2157
|
+
`).otherwise(z`
|
|
2158
|
+
<a
|
|
2159
|
+
part="link"
|
|
2160
|
+
href="${o}"
|
|
2161
|
+
class="${y}"
|
|
2162
|
+
${b}
|
|
2163
|
+
${l}
|
|
2164
|
+
${p}
|
|
2165
|
+
data-on-click="navigate"
|
|
2166
|
+
><slot></slot></a>
|
|
2167
|
+
`).done()}
|
|
2168
|
+
`;
|
|
2169
|
+
},
|
|
2170
|
+
navigate: (r, n) => {
|
|
2171
|
+
const { disabled: o, external: s, tag: i, replace: a, to: c } = n.props;
|
|
2172
|
+
if (o) {
|
|
2173
|
+
r.preventDefault();
|
|
2174
|
+
return;
|
|
2175
|
+
}
|
|
2176
|
+
s && (i === "a" || !i) || (r.preventDefault(), a ? t.replace(c) : t.push(c));
|
|
2177
|
+
}
|
|
2178
|
+
}), t;
|
|
1880
2179
|
}
|
|
1881
2180
|
export {
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
2181
|
+
O as GlobalEventBus,
|
|
2182
|
+
de as component,
|
|
2183
|
+
ie as createStore,
|
|
2184
|
+
ge as css,
|
|
2185
|
+
nt as each,
|
|
2186
|
+
ot as emit,
|
|
2187
|
+
H as eventBus,
|
|
2188
|
+
z as html,
|
|
2189
|
+
ft as initRouter,
|
|
2190
|
+
lt as listen,
|
|
2191
|
+
ve as match,
|
|
2192
|
+
B as matchRoute,
|
|
2193
|
+
ct as matchRouteSSR,
|
|
2194
|
+
st as off,
|
|
2195
|
+
it as on,
|
|
2196
|
+
at as once,
|
|
2197
|
+
pe as parseQuery,
|
|
2198
|
+
et as resolveRouteComponent,
|
|
2199
|
+
tt as useRouter,
|
|
2200
|
+
rt as when
|
|
1891
2201
|
};
|
|
1892
2202
|
//# sourceMappingURL=custom-elements-runtime.es.js.map
|