@jasonshimmy/custom-elements-runtime 0.0.9-beta.1 → 0.0.9-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements-runtime.cjs.js +36 -10
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +791 -704
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.umd.js +35 -9
- package/dist/custom-elements-runtime.umd.js.map +1 -1
- package/dist/runtime.d.ts +16 -0
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
function j(
|
|
2
|
-
let
|
|
1
|
+
function j(e) {
|
|
2
|
+
let t = new Proxy(e, {
|
|
3
3
|
set: (i, a, c) => (i[a] = c, s(), !0)
|
|
4
4
|
});
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
|
|
5
|
+
const r = [];
|
|
6
|
+
function n(i) {
|
|
7
|
+
r.push(i), i(t);
|
|
8
8
|
}
|
|
9
9
|
function o() {
|
|
10
|
-
return
|
|
10
|
+
return t;
|
|
11
11
|
}
|
|
12
12
|
function s() {
|
|
13
|
-
|
|
13
|
+
r.forEach((i) => i(t));
|
|
14
14
|
}
|
|
15
|
-
return { subscribe:
|
|
15
|
+
return { subscribe: n, getState: o };
|
|
16
16
|
}
|
|
17
17
|
class y extends EventTarget {
|
|
18
18
|
handlers = {};
|
|
@@ -30,26 +30,26 @@ class y extends EventTarget {
|
|
|
30
30
|
* @param eventName - Name of the event
|
|
31
31
|
* @param data - Optional event payload
|
|
32
32
|
*/
|
|
33
|
-
emit(
|
|
34
|
-
const
|
|
35
|
-
if (!o ||
|
|
36
|
-
this.eventCounters.set(
|
|
37
|
-
else if (o.count++, o.count > 50 && (console.error(`Event storm detected for "${
|
|
38
|
-
console.warn(`Blocking further "${
|
|
33
|
+
emit(t, r) {
|
|
34
|
+
const n = Date.now(), o = this.eventCounters.get(t);
|
|
35
|
+
if (!o || n - o.window > 1e3)
|
|
36
|
+
this.eventCounters.set(t, { count: 1, window: n });
|
|
37
|
+
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
|
+
console.warn(`Blocking further "${t}" events to prevent infinite loop`);
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
this.dispatchEvent(new CustomEvent(
|
|
42
|
-
detail:
|
|
41
|
+
this.dispatchEvent(new CustomEvent(t, {
|
|
42
|
+
detail: r,
|
|
43
43
|
bubbles: !1,
|
|
44
44
|
// Global events don't need to bubble
|
|
45
45
|
cancelable: !0
|
|
46
46
|
}));
|
|
47
|
-
const s = this.handlers[
|
|
47
|
+
const s = this.handlers[t];
|
|
48
48
|
s && s.forEach((i) => {
|
|
49
49
|
try {
|
|
50
|
-
i(
|
|
50
|
+
i(r);
|
|
51
51
|
} catch (a) {
|
|
52
|
-
console.error(`Error in global event handler for "${
|
|
52
|
+
console.error(`Error in global event handler for "${t}":`, a);
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
}
|
|
@@ -58,24 +58,24 @@ class y extends EventTarget {
|
|
|
58
58
|
* @param eventName - Name of the event
|
|
59
59
|
* @param handler - Handler function
|
|
60
60
|
*/
|
|
61
|
-
on(
|
|
62
|
-
return this.handlers[
|
|
61
|
+
on(t, r) {
|
|
62
|
+
return this.handlers[t] || (this.handlers[t] = /* @__PURE__ */ new Set()), this.handlers[t].add(r), () => this.off(t, r);
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Remove a specific handler for a global event.
|
|
66
66
|
* @param eventName - Name of the event
|
|
67
67
|
* @param handler - Handler function to remove
|
|
68
68
|
*/
|
|
69
|
-
off(
|
|
70
|
-
const
|
|
71
|
-
|
|
69
|
+
off(t, r) {
|
|
70
|
+
const n = this.handlers[t];
|
|
71
|
+
n && n.delete(r);
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* Remove all handlers for a specific event.
|
|
75
75
|
* @param eventName - Name of the event
|
|
76
76
|
*/
|
|
77
|
-
offAll(
|
|
78
|
-
delete this.handlers[
|
|
77
|
+
offAll(t) {
|
|
78
|
+
delete this.handlers[t];
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
81
|
* Listen for a native CustomEvent. Returns an unsubscribe function.
|
|
@@ -83,18 +83,18 @@ class y extends EventTarget {
|
|
|
83
83
|
* @param handler - CustomEvent handler
|
|
84
84
|
* @param options - AddEventListener options
|
|
85
85
|
*/
|
|
86
|
-
listen(
|
|
87
|
-
return this.addEventListener(
|
|
86
|
+
listen(t, r, n) {
|
|
87
|
+
return this.addEventListener(t, r, n), () => this.removeEventListener(t, r);
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
90
|
* Register a one-time event handler. Returns a promise that resolves with the event data.
|
|
91
91
|
* @param eventName - Name of the event
|
|
92
92
|
* @param handler - Handler function
|
|
93
93
|
*/
|
|
94
|
-
once(
|
|
95
|
-
return new Promise((
|
|
96
|
-
const o = this.on(
|
|
97
|
-
o(),
|
|
94
|
+
once(t, r) {
|
|
95
|
+
return new Promise((n) => {
|
|
96
|
+
const o = this.on(t, (s) => {
|
|
97
|
+
o(), r(s), n(s);
|
|
98
98
|
});
|
|
99
99
|
});
|
|
100
100
|
}
|
|
@@ -103,7 +103,7 @@ class y extends EventTarget {
|
|
|
103
103
|
*/
|
|
104
104
|
getActiveEvents() {
|
|
105
105
|
return Object.keys(this.handlers).filter(
|
|
106
|
-
(
|
|
106
|
+
(t) => this.handlers[t] && this.handlers[t].size > 0
|
|
107
107
|
);
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
@@ -116,20 +116,20 @@ class y extends EventTarget {
|
|
|
116
116
|
* Get the number of handlers registered for a specific event.
|
|
117
117
|
* @param eventName - Name of the event
|
|
118
118
|
*/
|
|
119
|
-
getHandlerCount(
|
|
120
|
-
return this.handlers[
|
|
119
|
+
getHandlerCount(t) {
|
|
120
|
+
return this.handlers[t]?.size || 0;
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
123
|
* Get event statistics for debugging.
|
|
124
124
|
*/
|
|
125
125
|
getEventStats() {
|
|
126
|
-
const
|
|
127
|
-
for (const [
|
|
128
|
-
|
|
129
|
-
count:
|
|
130
|
-
handlersCount: this.getHandlerCount(
|
|
126
|
+
const t = {};
|
|
127
|
+
for (const [r, n] of this.eventCounters.entries())
|
|
128
|
+
t[r] = {
|
|
129
|
+
count: n.count,
|
|
130
|
+
handlersCount: this.getHandlerCount(r)
|
|
131
131
|
};
|
|
132
|
-
return
|
|
132
|
+
return t;
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
135
135
|
* Reset event counters (useful for testing or after resolving issues).
|
|
@@ -138,10 +138,10 @@ class y extends EventTarget {
|
|
|
138
138
|
this.eventCounters.clear();
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
const w = y.getInstance(),
|
|
142
|
-
function
|
|
141
|
+
const w = y.getInstance(), B = typeof window > "u" || typeof document > "u";
|
|
142
|
+
function G(e) {
|
|
143
143
|
return {
|
|
144
|
-
state:
|
|
144
|
+
state: e,
|
|
145
145
|
emit: () => {
|
|
146
146
|
},
|
|
147
147
|
// No-op on server
|
|
@@ -150,48 +150,50 @@ function U(t) {
|
|
|
150
150
|
offGlobal: () => {
|
|
151
151
|
},
|
|
152
152
|
emitGlobal: () => {
|
|
153
|
+
},
|
|
154
|
+
render: () => {
|
|
153
155
|
}
|
|
154
156
|
};
|
|
155
157
|
}
|
|
156
|
-
function
|
|
157
|
-
|
|
158
|
+
function Z(e, t = {}) {
|
|
159
|
+
B || console.warn("[SSR] renderToString should only be used on the server");
|
|
158
160
|
try {
|
|
159
|
-
const
|
|
161
|
+
const r = e.state, n = G(r), o = e.template(r, n);
|
|
160
162
|
let s = "";
|
|
161
|
-
|
|
162
|
-
const i =
|
|
163
|
-
return
|
|
164
|
-
} catch (
|
|
165
|
-
return console.error(`[SSR] Error rendering ${
|
|
163
|
+
t.includeStyles && e.style && (s = `<style>${typeof e.style == "function" ? e.style(r) : e.style}</style>`);
|
|
164
|
+
const i = t.sanitizeAttributes ? t.sanitizeAttributes(e.attrs || {}) : e.attrs || {}, a = Object.entries(i).map(([u, d]) => `${N(u)}="${N(d)}"`).join(" "), l = `${a ? `<${e.tag} ${a}>` : `<${e.tag}>`}${s}${o}</${e.tag}>`;
|
|
165
|
+
return t.prettyPrint ? V(l) : l;
|
|
166
|
+
} catch (r) {
|
|
167
|
+
return console.error(`[SSR] Error rendering ${e.tag}:`, r), `<${e.tag}><div style="color: red;">SSR Error: ${X(String(r))}</div></${e.tag}>`;
|
|
166
168
|
}
|
|
167
169
|
}
|
|
168
|
-
function
|
|
169
|
-
const
|
|
170
|
+
function ct(e, t = {}) {
|
|
171
|
+
const r = {
|
|
170
172
|
components: /* @__PURE__ */ new Map(),
|
|
171
173
|
styles: /* @__PURE__ */ new Set()
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
if (
|
|
174
|
+
}, n = [];
|
|
175
|
+
e.forEach((i) => {
|
|
176
|
+
if (r.components.set(i.tag, i), i.style) {
|
|
175
177
|
const c = typeof i.style == "function" ? i.style(i.state) : i.style;
|
|
176
|
-
|
|
178
|
+
r.styles.add(c);
|
|
177
179
|
}
|
|
178
|
-
const a =
|
|
179
|
-
|
|
180
|
+
const a = Z(i, { ...t, includeStyles: !1 });
|
|
181
|
+
n.push(a);
|
|
180
182
|
});
|
|
181
|
-
const o = Array.from(
|
|
183
|
+
const o = Array.from(r.styles).join(`
|
|
182
184
|
`);
|
|
183
|
-
return { html:
|
|
184
|
-
`), styles: o, context:
|
|
185
|
+
return { html: n.join(`
|
|
186
|
+
`), styles: o, context: r };
|
|
185
187
|
}
|
|
186
|
-
function
|
|
187
|
-
const
|
|
188
|
-
tag:
|
|
189
|
-
state:
|
|
188
|
+
function lt(e) {
|
|
189
|
+
const t = Array.from(e.components.entries()).map(([r, n]) => ({
|
|
190
|
+
tag: r,
|
|
191
|
+
state: n.state
|
|
190
192
|
}));
|
|
191
193
|
return `
|
|
192
194
|
<script type="module">
|
|
193
195
|
// Hydration data from SSR
|
|
194
|
-
window.__SSR_CONTEXT__ = ${JSON.stringify({ components:
|
|
196
|
+
window.__SSR_CONTEXT__ = ${JSON.stringify({ components: t })};
|
|
195
197
|
|
|
196
198
|
// Auto-hydrate when DOM is ready
|
|
197
199
|
if (document.readyState === 'loading') {
|
|
@@ -223,134 +225,134 @@ function at(t) {
|
|
|
223
225
|
}
|
|
224
226
|
<\/script>`.trim();
|
|
225
227
|
}
|
|
226
|
-
const
|
|
228
|
+
const X = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), N = (e) => e.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">"), V = (e) => e.replace(/></g, `>
|
|
227
229
|
<`).split(`
|
|
228
|
-
`).map((
|
|
229
|
-
const
|
|
230
|
-
return " ".repeat(Math.max(0,
|
|
230
|
+
`).map((t) => {
|
|
231
|
+
const r = (t.match(/^<[^\/]/g) || []).length - (t.match(/<\//g) || []).length;
|
|
232
|
+
return " ".repeat(Math.max(0, r)) + t.trim();
|
|
231
233
|
}).join(`
|
|
232
234
|
`);
|
|
233
|
-
function D(
|
|
234
|
-
return String(
|
|
235
|
+
function D(e) {
|
|
236
|
+
return String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
235
237
|
}
|
|
236
|
-
function
|
|
237
|
-
if (typeof
|
|
238
|
-
for (const
|
|
239
|
-
if (typeof
|
|
240
|
-
return D(
|
|
241
|
-
if (Array.isArray(
|
|
242
|
-
for (const
|
|
243
|
-
if (
|
|
244
|
-
for (const o in
|
|
245
|
-
if (typeof
|
|
246
|
-
return D(
|
|
238
|
+
function L(e, t) {
|
|
239
|
+
if (typeof e != "string" || !t) return String(e);
|
|
240
|
+
for (const r in t) {
|
|
241
|
+
if (typeof t[r] == "string" && e === t[r])
|
|
242
|
+
return D(e);
|
|
243
|
+
if (Array.isArray(t[r])) {
|
|
244
|
+
for (const n of t[r])
|
|
245
|
+
if (n && typeof n == "object") {
|
|
246
|
+
for (const o in n)
|
|
247
|
+
if (typeof n[o] == "string" && e === n[o])
|
|
248
|
+
return D(e);
|
|
247
249
|
}
|
|
248
250
|
}
|
|
249
251
|
}
|
|
250
|
-
return String(
|
|
252
|
+
return String(e);
|
|
251
253
|
}
|
|
252
|
-
function
|
|
253
|
-
function n
|
|
254
|
-
if (Array.isArray(
|
|
255
|
-
const i =
|
|
254
|
+
function T(e, ...t) {
|
|
255
|
+
function r(n, o, s) {
|
|
256
|
+
if (Array.isArray(n)) {
|
|
257
|
+
const i = n.map((a) => r(a, o, s));
|
|
256
258
|
return i.some((a) => a instanceof Promise) ? Promise.all(i).then((a) => a.join("")) : i.join("");
|
|
257
259
|
}
|
|
258
|
-
if (typeof
|
|
259
|
-
const i = n(
|
|
260
|
+
if (typeof n == "function") {
|
|
261
|
+
const i = r(n(o, s), o, s);
|
|
260
262
|
return i instanceof Promise, i;
|
|
261
263
|
}
|
|
262
|
-
return
|
|
264
|
+
return n == null ? "" : n instanceof Promise ? n : String(n);
|
|
263
265
|
}
|
|
264
|
-
return (
|
|
266
|
+
return (n, o) => {
|
|
265
267
|
let s = "", i = !1;
|
|
266
268
|
const a = [];
|
|
267
|
-
for (let c = 0; c <
|
|
268
|
-
if (s +=
|
|
269
|
-
let l =
|
|
270
|
-
const
|
|
271
|
-
l =
|
|
269
|
+
for (let c = 0; c < e.length; c++)
|
|
270
|
+
if (s += e[c], c < t.length) {
|
|
271
|
+
let l = t[c];
|
|
272
|
+
const u = e[c], d = /data-on-[a-z]+="?$/.test(u);
|
|
273
|
+
l = r(l, n, o), l instanceof Promise ? (i = !0, a.push(l)) : /=\s*"?$/.test(u) && typeof l == "string" && !d ? (l = l.replace(/"/g, """).replace(/'/g, "'"), s += l) : !d && !/=\s*"?$/.test(u) ? s += L(l, n) : s += l;
|
|
272
274
|
}
|
|
273
275
|
return i ? Promise.all(a).then((c) => {
|
|
274
|
-
let l = "",
|
|
275
|
-
for (let
|
|
276
|
-
if (l +=
|
|
277
|
-
let f =
|
|
278
|
-
const h =
|
|
279
|
-
f =
|
|
276
|
+
let l = "", u = 0;
|
|
277
|
+
for (let d = 0; d < e.length; d++)
|
|
278
|
+
if (l += e[d], d < t.length) {
|
|
279
|
+
let f = t[d];
|
|
280
|
+
const h = e[d], m = /data-on-[a-z]+="?$/.test(h);
|
|
281
|
+
f = r(f, n, o), f instanceof Promise ? l += c[u++] : /=\s*"?$/.test(h) && typeof f == "string" && !m ? (f = f.replace(/"/g, """).replace(/'/g, "'"), l += f) : !m && !/=\s*"?$/.test(h) ? l += L(f, n) : l += f;
|
|
280
282
|
}
|
|
281
283
|
return l;
|
|
282
284
|
}) : s;
|
|
283
285
|
};
|
|
284
286
|
}
|
|
285
|
-
function
|
|
286
|
-
const
|
|
287
|
-
function
|
|
288
|
-
return Array.isArray(s) ? s.map((c) =>
|
|
287
|
+
function ut(e, ...t) {
|
|
288
|
+
const r = "compiled-" + Math.random().toString(36).slice(2);
|
|
289
|
+
function n(s, i, a) {
|
|
290
|
+
return Array.isArray(s) ? s.map((c) => n(c, i, a)).join("") : typeof s == "function" ? n(s(i, a), i, a) : s == null ? "" : String(s);
|
|
289
291
|
}
|
|
290
292
|
const o = (s, i) => {
|
|
291
293
|
let a = "";
|
|
292
|
-
for (let c = 0; c <
|
|
293
|
-
if (a +=
|
|
294
|
-
let l =
|
|
295
|
-
const
|
|
296
|
-
l =
|
|
294
|
+
for (let c = 0; c < e.length; c++)
|
|
295
|
+
if (a += e[c], c < t.length) {
|
|
296
|
+
let l = t[c];
|
|
297
|
+
const u = e[c], d = /data-on-[a-z]+="?$/.test(u);
|
|
298
|
+
l = n(l, s, i), /=\s*"?$/.test(u) && typeof l == "string" && !d ? (l = l.replace(/"/g, """).replace(/'/g, "'"), a += l) : !d && !/=\s*"?$/.test(u) ? a += L(l, s) : a += l ?? "";
|
|
297
299
|
}
|
|
298
300
|
return a;
|
|
299
301
|
};
|
|
300
|
-
return o.id =
|
|
302
|
+
return o.id = r, o;
|
|
301
303
|
}
|
|
302
|
-
function
|
|
303
|
-
let
|
|
304
|
-
for (let
|
|
305
|
-
|
|
306
|
-
return
|
|
304
|
+
function Y(e, ...t) {
|
|
305
|
+
let r = "";
|
|
306
|
+
for (let n = 0; n < e.length; n++)
|
|
307
|
+
r += e[n], n < t.length && (r += t[n] ?? "");
|
|
308
|
+
return r;
|
|
307
309
|
}
|
|
308
|
-
function
|
|
309
|
-
return Object.keys(
|
|
310
|
+
function dt(e) {
|
|
311
|
+
return Object.keys(e).filter((t) => e[t]).join(" ");
|
|
310
312
|
}
|
|
311
|
-
function ft(
|
|
312
|
-
return Object.entries(
|
|
313
|
+
function ft(e) {
|
|
314
|
+
return Object.entries(e).map(([t, r]) => `${t}: ${r}`).join("; ");
|
|
313
315
|
}
|
|
314
|
-
function
|
|
315
|
-
const [
|
|
316
|
-
if (!
|
|
316
|
+
function J(e, t, r) {
|
|
317
|
+
const [n, ...o] = r.split("|").map((a) => a.trim());
|
|
318
|
+
if (!n || n === "__proto__" || n === "constructor" || n === "prototype") return;
|
|
317
319
|
function s(a, c, l) {
|
|
318
|
-
const
|
|
319
|
-
let
|
|
320
|
-
for (let f = 0; f <
|
|
321
|
-
|
|
322
|
-
u[
|
|
320
|
+
const u = c.split(".");
|
|
321
|
+
let d = a;
|
|
322
|
+
for (let f = 0; f < u.length - 1; f++)
|
|
323
|
+
u[f] in d || (d[u[f]] = {}), d = d[u[f]];
|
|
324
|
+
d[u[u.length - 1]] = l;
|
|
323
325
|
}
|
|
324
326
|
const i = (a) => {
|
|
325
327
|
let c;
|
|
326
|
-
if (
|
|
327
|
-
c =
|
|
328
|
-
const l =
|
|
329
|
-
let
|
|
330
|
-
if (
|
|
331
|
-
if (
|
|
332
|
-
|
|
328
|
+
if (e instanceof HTMLInputElement && e.type === "checkbox") {
|
|
329
|
+
c = e.value;
|
|
330
|
+
const l = e.getAttribute("data-true-value"), u = e.getAttribute("data-false-value");
|
|
331
|
+
let d = Array.isArray(t[n]) ? t[n] : void 0;
|
|
332
|
+
if (d) {
|
|
333
|
+
if (e.checked)
|
|
334
|
+
d.includes(c) || d.push(c);
|
|
333
335
|
else {
|
|
334
|
-
const f =
|
|
335
|
-
f !== -1 &&
|
|
336
|
+
const f = d.indexOf(c);
|
|
337
|
+
f !== -1 && d.splice(f, 1);
|
|
336
338
|
}
|
|
337
|
-
s(
|
|
339
|
+
s(t, n, [...d]);
|
|
338
340
|
} else
|
|
339
|
-
l !== null ||
|
|
340
|
-
} else
|
|
341
|
-
|
|
342
|
-
})) : (c =
|
|
343
|
-
if ("_vnode" in
|
|
344
|
-
let l =
|
|
341
|
+
l !== null || u !== null ? e.checked ? s(t, n, l) : s(t, n, u !== null ? u : !1) : s(t, n, e.checked);
|
|
342
|
+
} else e instanceof HTMLInputElement && e.type === "radio" ? (c = e.value, s(t, n, c), ((e.form || e.closest("form") || e.getRootNode()) instanceof Element ? (e.form || e.closest("form") || e.getRootNode()).querySelectorAll(`input[type="radio"][name="${e.name}"][data-model="${r}"]`) : []).forEach((u) => {
|
|
343
|
+
u.checked = u.value === String(c);
|
|
344
|
+
})) : (c = e.value, e instanceof HTMLInputElement && e.type === "number" && (c = Number(c)), o.includes("trim") && typeof c == "string" && (c = c.trim()), o.includes("number") && (c = Number(c)), s(t, n, c));
|
|
345
|
+
if ("_vnode" in e && typeof e._vnode == "object" && e._vnode?.props && (e._vnode.props.value = c), a.type === "input" && (e._isDirty = !0), a.type === "keydown" && a.key === "Enter" && (e._isDirty = !1, e instanceof HTMLElement && e.isConnected)) {
|
|
346
|
+
let l = e.parentElement;
|
|
345
347
|
for (; l && !(l instanceof HTMLElement && l.shadowRoot); )
|
|
346
348
|
l = l.parentElement;
|
|
347
349
|
l && typeof l == "object" && l !== null && "render" in l && typeof l.render == "function" && l.render();
|
|
348
350
|
}
|
|
349
|
-
a.type === "blur" && (
|
|
351
|
+
a.type === "blur" && (e._isDirty = !1);
|
|
350
352
|
};
|
|
351
|
-
|
|
353
|
+
e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("keydown", i), e.addEventListener("blur", i);
|
|
352
354
|
}
|
|
353
|
-
const
|
|
355
|
+
const x = (() => {
|
|
354
356
|
try {
|
|
355
357
|
if (typeof process < "u" && process.env)
|
|
356
358
|
return process.env.NODE_ENV === "development";
|
|
@@ -358,10 +360,10 @@ const H = (() => {
|
|
|
358
360
|
}
|
|
359
361
|
return typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" : !1;
|
|
360
362
|
})();
|
|
361
|
-
function ht(
|
|
362
|
-
const { development:
|
|
363
|
-
if (
|
|
364
|
-
if (
|
|
363
|
+
function ht(e, t = {}) {
|
|
364
|
+
const { development: r = x, cache: n = !0, optimize: o = !0 } = t, s = F(e);
|
|
365
|
+
if (n && S.has(s)) {
|
|
366
|
+
if (r) {
|
|
365
367
|
const i = v.get(s) || {
|
|
366
368
|
compilationTime: 0,
|
|
367
369
|
renderTime: 0,
|
|
@@ -371,9 +373,9 @@ function ht(t, e = {}) {
|
|
|
371
373
|
};
|
|
372
374
|
i.cacheHits++, v.set(s, i);
|
|
373
375
|
}
|
|
374
|
-
return
|
|
376
|
+
return S.get(s);
|
|
375
377
|
}
|
|
376
|
-
if (
|
|
378
|
+
if (r) {
|
|
377
379
|
const i = v.get(s) || {
|
|
378
380
|
compilationTime: 0,
|
|
379
381
|
renderTime: 0,
|
|
@@ -384,31 +386,31 @@ function ht(t, e = {}) {
|
|
|
384
386
|
i.cacheMisses++, v.set(s, i);
|
|
385
387
|
}
|
|
386
388
|
try {
|
|
387
|
-
const i =
|
|
388
|
-
return
|
|
389
|
+
const i = tt(e, { development: r, optimize: o });
|
|
390
|
+
return n && S.set(s, i), i;
|
|
389
391
|
} catch (i) {
|
|
390
|
-
return
|
|
391
|
-
statics: [
|
|
392
|
+
return r && (console.error("[Template Compiler] Error compiling template:", i), console.error("[Template Compiler] Template:", e)), {
|
|
393
|
+
statics: [e],
|
|
392
394
|
dynamics: [],
|
|
393
395
|
fragment: null,
|
|
394
396
|
id: s,
|
|
395
397
|
hasDynamics: !1,
|
|
396
|
-
render: () =>
|
|
398
|
+
render: () => e
|
|
397
399
|
};
|
|
398
400
|
}
|
|
399
401
|
}
|
|
400
|
-
function
|
|
402
|
+
function Q(e, t) {
|
|
401
403
|
if (typeof document > "u")
|
|
402
404
|
return [0];
|
|
403
405
|
try {
|
|
404
|
-
let
|
|
406
|
+
let r = function(a, c = []) {
|
|
405
407
|
if (a.nodeType === Node.TEXT_NODE) {
|
|
406
|
-
if (a.textContent?.includes(
|
|
408
|
+
if (a.textContent?.includes(t))
|
|
407
409
|
return c;
|
|
408
410
|
} else if (a.nodeType === Node.ELEMENT_NODE) {
|
|
409
411
|
let l = 0;
|
|
410
|
-
for (let
|
|
411
|
-
const
|
|
412
|
+
for (let u = 0; u < a.childNodes.length; u++) {
|
|
413
|
+
const d = a.childNodes[u], f = r(d, [...c, l]);
|
|
412
414
|
if (f)
|
|
413
415
|
return f;
|
|
414
416
|
l++;
|
|
@@ -416,39 +418,39 @@ function V(t, e) {
|
|
|
416
418
|
}
|
|
417
419
|
return null;
|
|
418
420
|
};
|
|
419
|
-
const s = new DOMParser().parseFromString(`<div>${
|
|
420
|
-
return
|
|
421
|
-
} catch (
|
|
422
|
-
return
|
|
421
|
+
const s = new DOMParser().parseFromString(`<div>${e}</div>`, "text/html").body.firstElementChild;
|
|
422
|
+
return r(s) || [0];
|
|
423
|
+
} catch (r) {
|
|
424
|
+
return x && console.warn("[Template Compiler] Error finding DOM path for placeholder:", t, r), [0];
|
|
423
425
|
}
|
|
424
426
|
}
|
|
425
|
-
function
|
|
426
|
-
return new
|
|
427
|
+
function tt(e, t) {
|
|
428
|
+
return new et(e, t).compile();
|
|
427
429
|
}
|
|
428
|
-
class
|
|
430
|
+
class et {
|
|
429
431
|
template;
|
|
430
432
|
options;
|
|
431
433
|
dynamics = [];
|
|
432
434
|
statics = [];
|
|
433
|
-
constructor(
|
|
434
|
-
this.template =
|
|
435
|
+
constructor(t, r) {
|
|
436
|
+
this.template = t, this.options = r;
|
|
435
437
|
}
|
|
436
438
|
compile() {
|
|
437
439
|
this.parseTemplate();
|
|
438
|
-
const
|
|
440
|
+
const t = this.createStaticFragment(), r = F(this.template), n = (o, s) => {
|
|
439
441
|
let i = "";
|
|
440
442
|
for (let a = 0; a < this.statics.length; a++)
|
|
441
443
|
if (i += this.statics[a], a < this.dynamics.length) {
|
|
442
444
|
let c = this.dynamics[a].getValue(o, s);
|
|
443
445
|
if (c instanceof Promise)
|
|
444
446
|
return Promise.all(this.dynamics.map((l) => {
|
|
445
|
-
const
|
|
446
|
-
return
|
|
447
|
+
const u = l.getValue(o, s);
|
|
448
|
+
return u instanceof Promise ? u : Promise.resolve(u);
|
|
447
449
|
})).then((l) => {
|
|
448
|
-
let
|
|
449
|
-
for (let
|
|
450
|
-
|
|
451
|
-
return
|
|
450
|
+
let u = "";
|
|
451
|
+
for (let d = 0; d < this.statics.length; d++)
|
|
452
|
+
u += this.statics[d], d < l.length && (u += l[d]);
|
|
453
|
+
return u;
|
|
452
454
|
});
|
|
453
455
|
i += c;
|
|
454
456
|
}
|
|
@@ -457,56 +459,56 @@ class J {
|
|
|
457
459
|
return {
|
|
458
460
|
statics: this.statics,
|
|
459
461
|
dynamics: this.dynamics,
|
|
460
|
-
fragment:
|
|
461
|
-
id:
|
|
462
|
+
fragment: t,
|
|
463
|
+
id: r,
|
|
462
464
|
hasDynamics: this.dynamics.length > 0,
|
|
463
|
-
render:
|
|
465
|
+
render: n
|
|
464
466
|
};
|
|
465
467
|
}
|
|
466
468
|
parseTemplate() {
|
|
467
|
-
const
|
|
468
|
-
let
|
|
469
|
-
for (; (
|
|
470
|
-
const s = this.template.slice(
|
|
469
|
+
const t = /\{\{([^}]+)\}\}/g;
|
|
470
|
+
let r = 0, n;
|
|
471
|
+
for (; (n = t.exec(this.template)) !== null; ) {
|
|
472
|
+
const s = this.template.slice(r, n.index);
|
|
471
473
|
this.statics.push(s);
|
|
472
474
|
let i = s.match(/([a-zA-Z0-9_-]+)\s*=\s*"?$/), a = i ? i[1] : void 0, c;
|
|
473
475
|
if (s.endsWith('style="color:'))
|
|
474
476
|
a = "style", c = "color";
|
|
475
477
|
else if (a === "style") {
|
|
476
|
-
const
|
|
477
|
-
|
|
478
|
+
const u = s.match(/style\s*=\s*"?([^:;]+):\s*$/);
|
|
479
|
+
u && (c = u[1].trim());
|
|
478
480
|
}
|
|
479
|
-
const l =
|
|
480
|
-
this.analyzeDynamicExpression(l, this.dynamics.length, a, c),
|
|
481
|
+
const l = n[1].trim();
|
|
482
|
+
this.analyzeDynamicExpression(l, this.dynamics.length, a, c), r = n.index + n[0].length;
|
|
481
483
|
}
|
|
482
|
-
const o = this.template.slice(
|
|
484
|
+
const o = this.template.slice(r);
|
|
483
485
|
this.statics.push(o);
|
|
484
486
|
}
|
|
485
|
-
analyzeDynamicExpression(
|
|
487
|
+
analyzeDynamicExpression(t, r, n, o) {
|
|
486
488
|
let s = "text", i;
|
|
487
|
-
|
|
488
|
-
const a = `__DYNAMIC_${
|
|
489
|
-
let l =
|
|
489
|
+
n ? n === "class" ? (s = "class", i = "class") : n === "style" ? (s = "style", i = o || "style") : n === "value" ? (s = "property", i = "value") : (s = "attribute", i = n) : t.includes("class.") ? (s = "class", i = t.split(".")[1]) : t.includes("style.") ? (s = "style", i = t.split(".")[1]) : t.includes("@") ? (s = "event", i = t.split("@")[1]) : t === "class" ? (s = "class", i = "class") : t === "style" ? (s = "style", i = "style") : t === "value" ? (s = "property", i = "value") : t === "title" && (s = "attribute", i = "title");
|
|
490
|
+
const a = `__DYNAMIC_${r}__`, c = this.statics.join(a);
|
|
491
|
+
let l = Q(c, a);
|
|
490
492
|
this.statics.length === 2 && s !== "text" ? l = [0] : this.statics.length === 2 && l.length === 0 && (l = [0]), this.dynamics.push({
|
|
491
493
|
path: l,
|
|
492
494
|
type: s,
|
|
493
495
|
target: i,
|
|
494
|
-
getValue: this.createValueGetter(
|
|
496
|
+
getValue: this.createValueGetter(t)
|
|
495
497
|
});
|
|
496
498
|
}
|
|
497
|
-
createValueGetter(
|
|
498
|
-
return (
|
|
499
|
+
createValueGetter(t) {
|
|
500
|
+
return (r, n) => {
|
|
499
501
|
try {
|
|
500
502
|
let o;
|
|
501
|
-
if (
|
|
502
|
-
o =
|
|
503
|
-
else if (typeof
|
|
504
|
-
const s =
|
|
505
|
-
o =
|
|
506
|
-
} else typeof
|
|
503
|
+
if (t && typeof t == "function")
|
|
504
|
+
o = t(r);
|
|
505
|
+
else if (typeof t == "string" && t.startsWith("state.")) {
|
|
506
|
+
const s = t.slice(6);
|
|
507
|
+
o = r[s];
|
|
508
|
+
} else typeof t == "string" && /^[a-zA-Z0-9_$]+$/.test(t) ? o = r[t] : (typeof t == "string" && t.includes("("), o = "");
|
|
507
509
|
return o;
|
|
508
510
|
} catch (o) {
|
|
509
|
-
return this.options.development && console.warn(`[Template Compiler] Error evaluating expression: ${
|
|
511
|
+
return this.options.development && console.warn(`[Template Compiler] Error evaluating expression: ${t}`, o), "";
|
|
510
512
|
}
|
|
511
513
|
};
|
|
512
514
|
}
|
|
@@ -514,276 +516,276 @@ class J {
|
|
|
514
516
|
if (typeof document > "u")
|
|
515
517
|
return null;
|
|
516
518
|
try {
|
|
517
|
-
const
|
|
518
|
-
if (!
|
|
519
|
+
const t = this.statics.join("");
|
|
520
|
+
if (!t.trim())
|
|
519
521
|
return null;
|
|
520
|
-
const
|
|
521
|
-
for (;
|
|
522
|
-
o.appendChild(
|
|
522
|
+
const n = new DOMParser().parseFromString(t, "text/html"), o = document.createDocumentFragment();
|
|
523
|
+
for (; n.body.firstChild; )
|
|
524
|
+
o.appendChild(n.body.firstChild);
|
|
523
525
|
return o;
|
|
524
|
-
} catch (
|
|
525
|
-
return this.options.development && console.warn("[Template Compiler] Could not create static fragment:",
|
|
526
|
+
} catch (t) {
|
|
527
|
+
return this.options.development && console.warn("[Template Compiler] Could not create static fragment:", t), null;
|
|
526
528
|
}
|
|
527
529
|
}
|
|
528
530
|
}
|
|
529
|
-
function
|
|
531
|
+
function R(e, t) {
|
|
530
532
|
try {
|
|
531
|
-
if (
|
|
532
|
-
return
|
|
533
|
-
let
|
|
534
|
-
for (let
|
|
535
|
-
const o =
|
|
536
|
-
if (!
|
|
533
|
+
if (t.length === 1 && t[0] === 0 && e instanceof Element)
|
|
534
|
+
return e;
|
|
535
|
+
let r = e;
|
|
536
|
+
for (let n = 0; n < t.length; n++) {
|
|
537
|
+
const o = t[n];
|
|
538
|
+
if (!r.childNodes || r.childNodes.length <= o)
|
|
537
539
|
return null;
|
|
538
|
-
|
|
540
|
+
r = r.childNodes[o];
|
|
539
541
|
}
|
|
540
|
-
return
|
|
542
|
+
return r;
|
|
541
543
|
} catch {
|
|
542
544
|
return null;
|
|
543
545
|
}
|
|
544
546
|
}
|
|
545
|
-
function I(
|
|
546
|
-
let
|
|
547
|
-
return
|
|
547
|
+
function I(e, t, r) {
|
|
548
|
+
let n;
|
|
549
|
+
return e.fragment && !e.hasDynamics ? n = e.fragment.cloneNode(!0) : n = nt(e, t, r), n;
|
|
548
550
|
}
|
|
549
|
-
function
|
|
550
|
-
if (
|
|
551
|
-
for (const s of
|
|
551
|
+
function rt(e, t, r, n, o) {
|
|
552
|
+
if (e.hasDynamics)
|
|
553
|
+
for (const s of e.dynamics)
|
|
552
554
|
try {
|
|
553
|
-
const i = s.getValue(
|
|
554
|
-
if (o !== void 0 && s.getValue(o,
|
|
555
|
+
const i = s.getValue(r, n);
|
|
556
|
+
if (o !== void 0 && s.getValue(o, n) === i)
|
|
555
557
|
continue;
|
|
556
|
-
|
|
558
|
+
W(t, s, i);
|
|
557
559
|
} catch (i) {
|
|
558
560
|
console.warn("[Template Compiler] Error applying update:", i);
|
|
559
561
|
}
|
|
560
562
|
}
|
|
561
|
-
function
|
|
562
|
-
let
|
|
563
|
-
for (let a = 0; a <
|
|
564
|
-
if (
|
|
565
|
-
const c =
|
|
563
|
+
function nt(e, t, r) {
|
|
564
|
+
let n = "";
|
|
565
|
+
for (let a = 0; a < e.statics.length; a++)
|
|
566
|
+
if (n += e.statics[a], a < e.dynamics.length) {
|
|
567
|
+
const c = e.dynamics[a];
|
|
566
568
|
if (c.type === "text" || c.type === "attribute") {
|
|
567
|
-
const l = c.getValue(
|
|
568
|
-
|
|
569
|
-
} else (c.type === "property" || c.type === "class" || c.type === "style") && (
|
|
569
|
+
const l = c.getValue(t, r);
|
|
570
|
+
n += String(l ?? "");
|
|
571
|
+
} else (c.type === "property" || c.type === "class" || c.type === "style") && (n += "");
|
|
570
572
|
}
|
|
571
573
|
if (typeof document > "u")
|
|
572
574
|
return new DocumentFragment();
|
|
573
|
-
const s = new DOMParser().parseFromString(
|
|
575
|
+
const s = new DOMParser().parseFromString(n, "text/html"), i = document.createDocumentFragment();
|
|
574
576
|
for (; s.body.firstChild; )
|
|
575
577
|
i.appendChild(s.body.firstChild);
|
|
576
|
-
for (const a of
|
|
577
|
-
const c = a.getValue(
|
|
578
|
-
|
|
578
|
+
for (const a of e.dynamics) {
|
|
579
|
+
const c = a.getValue(t, r), l = R(i, a.path);
|
|
580
|
+
W(l, a, c);
|
|
579
581
|
}
|
|
580
582
|
return i;
|
|
581
583
|
}
|
|
582
|
-
function
|
|
584
|
+
function W(e, t, r) {
|
|
583
585
|
try {
|
|
584
|
-
if (
|
|
586
|
+
if (t.type === "text") {
|
|
585
587
|
const o = document.createTreeWalker(
|
|
586
|
-
|
|
588
|
+
e,
|
|
587
589
|
NodeFilter.SHOW_TEXT
|
|
588
590
|
);
|
|
589
591
|
let s = !1, i;
|
|
590
592
|
for (; i = o.nextNode(); ) {
|
|
591
593
|
const c = i.textContent || "";
|
|
592
594
|
if (c.includes("Count: ")) {
|
|
593
|
-
const l = c.replace(/Count: \d+/, `Count: ${
|
|
595
|
+
const l = c.replace(/Count: \d+/, `Count: ${r}`);
|
|
594
596
|
i.textContent = l, s = !0;
|
|
595
597
|
}
|
|
596
598
|
}
|
|
597
599
|
if (s) return;
|
|
598
|
-
const a =
|
|
599
|
-
a && a.nodeType === Node.TEXT_NODE && (a.textContent =
|
|
600
|
+
const a = R(e, t.path);
|
|
601
|
+
a && a.nodeType === Node.TEXT_NODE && (a.textContent = r == null ? "" : String(r));
|
|
600
602
|
return;
|
|
601
603
|
}
|
|
602
|
-
const
|
|
603
|
-
if (!
|
|
604
|
+
const n = R(e, t.path);
|
|
605
|
+
if (!n)
|
|
604
606
|
return;
|
|
605
|
-
switch (
|
|
607
|
+
switch (t.type) {
|
|
606
608
|
case "attribute":
|
|
607
|
-
if (
|
|
608
|
-
const o =
|
|
609
|
-
|
|
609
|
+
if (n.nodeType === Node.ELEMENT_NODE && t.target) {
|
|
610
|
+
const o = n;
|
|
611
|
+
r == null || r === "" ? o.removeAttribute(t.target) : o.setAttribute(t.target, String(r));
|
|
610
612
|
}
|
|
611
613
|
break;
|
|
612
614
|
case "property":
|
|
613
|
-
|
|
615
|
+
n.nodeType === Node.ELEMENT_NODE && t.target && (n[t.target] = r ?? "", n.setAttribute(t.target, r == null ? "" : String(r)));
|
|
614
616
|
break;
|
|
615
617
|
case "class":
|
|
616
|
-
if (
|
|
617
|
-
const o =
|
|
618
|
-
o.className =
|
|
618
|
+
if (n.nodeType === Node.ELEMENT_NODE && t.target) {
|
|
619
|
+
const o = n;
|
|
620
|
+
o.className = r == null ? "" : String(r), o.setAttribute("class", r == null ? "" : String(r));
|
|
619
621
|
}
|
|
620
622
|
break;
|
|
621
623
|
case "style":
|
|
622
|
-
if (
|
|
623
|
-
const o =
|
|
624
|
-
o.style[
|
|
624
|
+
if (n.nodeType === Node.ELEMENT_NODE && t.target) {
|
|
625
|
+
const o = n;
|
|
626
|
+
o.style[t.target] = r == null ? "" : String(r), o.setAttribute("style", r == null ? `${t.target}:` : `${t.target}:${r}`);
|
|
625
627
|
}
|
|
626
628
|
break;
|
|
627
629
|
default:
|
|
628
|
-
throw new Error(`Unknown update type: ${
|
|
630
|
+
throw new Error(`Unknown update type: ${t.type}`);
|
|
629
631
|
}
|
|
630
|
-
} catch (
|
|
631
|
-
(typeof globalThis < "u" ? globalThis.isDevelopment :
|
|
632
|
+
} catch (n) {
|
|
633
|
+
(typeof globalThis < "u" ? globalThis.isDevelopment : x) && console.warn("[Template Compiler] Error applying update:", t, n);
|
|
632
634
|
}
|
|
633
635
|
}
|
|
634
|
-
const
|
|
635
|
-
function
|
|
636
|
-
let
|
|
637
|
-
for (let
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
}
|
|
641
|
-
return `tpl_${Math.abs(
|
|
636
|
+
const S = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
|
|
637
|
+
function F(e) {
|
|
638
|
+
let t = 0;
|
|
639
|
+
for (let r = 0; r < e.length; r++) {
|
|
640
|
+
const n = e.charCodeAt(r);
|
|
641
|
+
t = (t << 5) - t + n, t = t & t;
|
|
642
|
+
}
|
|
643
|
+
return `tpl_${Math.abs(t).toString(36)}`;
|
|
642
644
|
}
|
|
643
|
-
function
|
|
644
|
-
return
|
|
645
|
+
function P(e, t, r, n, o) {
|
|
646
|
+
return n && o ? `${t}.${e}[${r}]:${n}:${o}` : n ? `${t}.${e}[${r}]:${n}` : `${t}.${e}[${r}]`;
|
|
645
647
|
}
|
|
646
|
-
function
|
|
647
|
-
if (!(!
|
|
648
|
+
function q(e, t, r) {
|
|
649
|
+
if (!(!e || !(e instanceof Element)) && e.contains(r) && r.parentNode === e)
|
|
648
650
|
try {
|
|
649
|
-
|
|
650
|
-
} catch (
|
|
651
|
-
console.error("[VDOM] safeReplaceChild: error replacing child",
|
|
652
|
-
parent:
|
|
653
|
-
newChild:
|
|
654
|
-
oldChild:
|
|
655
|
-
parentHTML:
|
|
656
|
-
newChildHTML:
|
|
657
|
-
oldChildHTML:
|
|
651
|
+
e.replaceChild(t, r);
|
|
652
|
+
} catch (n) {
|
|
653
|
+
console.error("[VDOM] safeReplaceChild: error replacing child", n, {
|
|
654
|
+
parent: e,
|
|
655
|
+
newChild: t,
|
|
656
|
+
oldChild: r,
|
|
657
|
+
parentHTML: e.outerHTML,
|
|
658
|
+
newChildHTML: t.outerHTML,
|
|
659
|
+
oldChildHTML: r.outerHTML
|
|
658
660
|
});
|
|
659
661
|
}
|
|
660
662
|
}
|
|
661
|
-
function g(
|
|
662
|
-
if (
|
|
663
|
+
function g(e) {
|
|
664
|
+
if (e.type === "#whitespace")
|
|
663
665
|
return null;
|
|
664
|
-
if (
|
|
665
|
-
const
|
|
666
|
-
return
|
|
667
|
-
}
|
|
668
|
-
const
|
|
669
|
-
for (const [
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
for (const
|
|
673
|
-
const
|
|
674
|
-
|
|
675
|
-
}
|
|
676
|
-
return
|
|
666
|
+
if (e.type === "#text") {
|
|
667
|
+
const r = document.createTextNode(e.props.nodeValue ?? "");
|
|
668
|
+
return e.dom = r, r;
|
|
669
|
+
}
|
|
670
|
+
const t = document.createElement(e.type);
|
|
671
|
+
for (const [r, n] of Object.entries(e.props))
|
|
672
|
+
r === "value" && t instanceof HTMLInputElement ? t.type === "radio" ? t.setAttribute("value", n) : (t.type, t.value = n, t.setAttribute("value", n)) : t.setAttribute(r, n);
|
|
673
|
+
e.dom = t;
|
|
674
|
+
for (const r of e.children) {
|
|
675
|
+
const n = g(r);
|
|
676
|
+
n && t.appendChild(n);
|
|
677
|
+
}
|
|
678
|
+
return t;
|
|
677
679
|
}
|
|
678
|
-
function
|
|
679
|
-
const
|
|
680
|
-
|
|
681
|
-
const
|
|
682
|
-
return
|
|
680
|
+
function st(e) {
|
|
681
|
+
const t = document.createElement("template");
|
|
682
|
+
t.innerHTML = e.trim();
|
|
683
|
+
const r = Array.from(t.content.childNodes);
|
|
684
|
+
return r.length === 1 ? $(r[0]) : {
|
|
683
685
|
type: "#fragment",
|
|
684
686
|
key: void 0,
|
|
685
687
|
props: {},
|
|
686
|
-
children:
|
|
688
|
+
children: r.map((o, s) => $(o, "#fragment", s)),
|
|
687
689
|
dom: void 0
|
|
688
690
|
};
|
|
689
691
|
}
|
|
690
|
-
function
|
|
691
|
-
if (!
|
|
692
|
+
function $(e, t = "", r = 0) {
|
|
693
|
+
if (!e)
|
|
692
694
|
return { type: "#unknown", key: void 0, props: {}, children: [], dom: void 0 };
|
|
693
|
-
if (
|
|
694
|
-
return !
|
|
695
|
-
if (
|
|
696
|
-
const
|
|
697
|
-
Array.from(
|
|
695
|
+
if (e.nodeType === Node.TEXT_NODE)
|
|
696
|
+
return !e.nodeValue || /^\s*$/.test(e.nodeValue) ? { type: "#whitespace", key: void 0, props: {}, children: [], dom: void 0 } : { type: "#text", key: P("#text", t, r), props: { nodeValue: e.nodeValue }, children: [], dom: e };
|
|
697
|
+
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
698
|
+
const n = e, o = {};
|
|
699
|
+
Array.from(n.attributes).forEach((l) => {
|
|
698
700
|
o[l.name] = l.value;
|
|
699
701
|
});
|
|
700
|
-
const s =
|
|
702
|
+
const s = n.tagName.toLowerCase();
|
|
701
703
|
let i;
|
|
702
|
-
if ((s === "input" || s === "select" || s === "textarea") &&
|
|
703
|
-
const l =
|
|
704
|
-
i = `${s}:${l}:${
|
|
705
|
-
let
|
|
706
|
-
|
|
707
|
-
} else s === "input" || s === "textarea" || s === "select" ||
|
|
708
|
-
const a = Array.from(
|
|
704
|
+
if ((s === "input" || s === "select" || s === "textarea") && n.hasAttribute("data-model")) {
|
|
705
|
+
const l = n.getAttribute("data-model"), u = n.getAttribute("type") ?? "";
|
|
706
|
+
i = `${s}:${l}:${u}`, o["data-uid"] = i, n.setAttribute("data-uid", i);
|
|
707
|
+
let d = n.getAttribute("value"), f = n.getAttribute("checked");
|
|
708
|
+
d && (o.value = d), f && (o.checked = f);
|
|
709
|
+
} else s === "input" || s === "textarea" || s === "select" || n.hasAttribute("contenteditable") ? (i = `${s}:${t}:${r}`, o["data-uid"] = i, n.setAttribute("data-uid", i)) : (i = P(s, t, r), s === "li" && (o["data-uid"] = i, n.setAttribute("data-uid", i)));
|
|
710
|
+
const a = Array.from(n.childNodes).map((l, u) => $(l, i, u));
|
|
709
711
|
return {
|
|
710
712
|
type: s,
|
|
711
713
|
key: i,
|
|
712
714
|
props: o,
|
|
713
715
|
children: a,
|
|
714
|
-
dom:
|
|
716
|
+
dom: n
|
|
715
717
|
};
|
|
716
718
|
}
|
|
717
719
|
return { type: "#unknown", key: void 0, props: {}, children: [], dom: void 0 };
|
|
718
720
|
}
|
|
719
|
-
function M(
|
|
720
|
-
if (!
|
|
721
|
-
function
|
|
721
|
+
function M(e, t, r) {
|
|
722
|
+
if (!t || !r) return;
|
|
723
|
+
function n(c) {
|
|
722
724
|
return !!c && c.type !== "#whitespace" && !(c.type === "#text" && (!c.props?.nodeValue || /^\s*$/.test(c.props.nodeValue)));
|
|
723
725
|
}
|
|
724
|
-
const o = Array.isArray(
|
|
725
|
-
if (
|
|
726
|
-
const c = g(
|
|
727
|
-
if (c instanceof Node &&
|
|
728
|
-
if (
|
|
729
|
-
const l =
|
|
730
|
-
l.type === "radio" || l.type, l.value =
|
|
726
|
+
const o = Array.isArray(t.children) ? t.children.filter(n) : [], s = Array.isArray(r.children) ? r.children.filter(n) : [], i = r.type === "input" || r.type === "select" || r.type === "textarea";
|
|
727
|
+
if (t.type !== r.type || t.key !== r.key) {
|
|
728
|
+
const c = g(r);
|
|
729
|
+
if (c instanceof Node && t.dom instanceof Node && e.contains(t.dom)) {
|
|
730
|
+
if (q(e, c, t.dom), i && r.props && e.firstChild instanceof HTMLInputElement) {
|
|
731
|
+
const l = e.firstChild;
|
|
732
|
+
l.type === "radio" || l.type, l.value = r.props.value, l.setAttribute("value", r.props.value), "checked" in r.props && (l.checked = r.props.checked === !0 || r.props.checked === "true");
|
|
731
733
|
}
|
|
732
734
|
} else if (c instanceof Node)
|
|
733
735
|
if (c) {
|
|
734
|
-
if (
|
|
735
|
-
const l =
|
|
736
|
-
l.type === "radio" ? l.setAttribute("value",
|
|
736
|
+
if (e.appendChild(c), r.dom = c, i && r.props && e.firstChild instanceof HTMLInputElement) {
|
|
737
|
+
const l = e.firstChild;
|
|
738
|
+
l.type === "radio" ? l.setAttribute("value", r.props.value) : (l.type, l.value = r.props.value, l.setAttribute("value", r.props.value)), "checked" in r.props && (l.checked = r.props.checked === !0 || r.props.checked === "true");
|
|
737
739
|
}
|
|
738
740
|
} else
|
|
739
|
-
|
|
741
|
+
r.dom = void 0;
|
|
740
742
|
else
|
|
741
|
-
|
|
743
|
+
r.dom = void 0;
|
|
742
744
|
return;
|
|
743
745
|
}
|
|
744
|
-
if (i &&
|
|
745
|
-
for (const [c, l] of Object.entries(
|
|
746
|
-
if (c === "value" &&
|
|
747
|
-
|
|
748
|
-
else if (c === "checked" &&
|
|
749
|
-
|
|
750
|
-
else if (c in
|
|
746
|
+
if (i && t.dom instanceof HTMLElement && r.props) {
|
|
747
|
+
for (const [c, l] of Object.entries(r.props))
|
|
748
|
+
if (c === "value" && e.firstChild instanceof HTMLInputElement)
|
|
749
|
+
e.firstChild.value = l;
|
|
750
|
+
else if (c === "checked" && e.firstChild instanceof HTMLInputElement)
|
|
751
|
+
e.firstChild.checked = l === !0 || l === "true";
|
|
752
|
+
else if (c in t.dom)
|
|
751
753
|
try {
|
|
752
|
-
|
|
754
|
+
t.dom[c] = l;
|
|
753
755
|
} catch {
|
|
754
756
|
}
|
|
755
757
|
else
|
|
756
|
-
|
|
757
|
-
for (let c =
|
|
758
|
-
o[c] && o[c].dom &&
|
|
758
|
+
t.dom.setAttribute(c, l);
|
|
759
|
+
for (let c = r.children.length; c < o.length; c++)
|
|
760
|
+
o[c] && o[c].dom && t.dom && t.dom.contains(o[c].dom) && t.dom.removeChild(o[c].dom);
|
|
759
761
|
return;
|
|
760
762
|
}
|
|
761
|
-
const a =
|
|
762
|
-
if (a && a instanceof Element &&
|
|
763
|
+
const a = t.dom;
|
|
764
|
+
if (a && a instanceof Element && r.props) {
|
|
763
765
|
const c = a.tagName.toLowerCase() === "input" ? a.getAttribute("type") : void 0, l = a.tagName.includes("-");
|
|
764
|
-
for (const [
|
|
765
|
-
if (!(c === "radio" &&
|
|
766
|
-
if (c === "checkbox" &&
|
|
767
|
-
a.setAttribute("value",
|
|
766
|
+
for (const [u, d] of Object.entries(r.props))
|
|
767
|
+
if (!(c === "radio" && u === "value")) {
|
|
768
|
+
if (c === "checkbox" && u === "value") {
|
|
769
|
+
a.setAttribute("value", d);
|
|
768
770
|
continue;
|
|
769
771
|
}
|
|
770
|
-
a.setAttribute(
|
|
772
|
+
a.setAttribute(u, d);
|
|
771
773
|
}
|
|
772
774
|
if (l)
|
|
773
|
-
for (const [
|
|
774
|
-
a.setAttribute(
|
|
775
|
-
for (const
|
|
776
|
-
if (!(
|
|
777
|
-
if (c === "radio" &&
|
|
778
|
-
a.removeAttribute(
|
|
775
|
+
for (const [u, d] of Object.entries(r.props))
|
|
776
|
+
a.setAttribute(u, d);
|
|
777
|
+
for (const u of Array.from(a.attributes).map((d) => d.name))
|
|
778
|
+
if (!(u in r.props)) {
|
|
779
|
+
if (c === "radio" && u === "value" || c === "checkbox" && u === "value") continue;
|
|
780
|
+
a.removeAttribute(u);
|
|
779
781
|
}
|
|
780
782
|
}
|
|
781
|
-
if (
|
|
783
|
+
if (r.type === "#text") {
|
|
782
784
|
if (a && a.nodeType === Node.TEXT_NODE)
|
|
783
|
-
a.nodeValue !==
|
|
785
|
+
a.nodeValue !== r.props.nodeValue && (a.nodeValue = r.props.nodeValue), r.dom = a;
|
|
784
786
|
else {
|
|
785
|
-
const c = document.createTextNode(
|
|
786
|
-
a &&
|
|
787
|
+
const c = document.createTextNode(r.props.nodeValue ?? "");
|
|
788
|
+
a && e.contains(a) && a.parentNode === e ? q(e, c, a) : e.appendChild(c), r.dom = c;
|
|
787
789
|
}
|
|
788
790
|
return;
|
|
789
791
|
}
|
|
@@ -791,7 +793,7 @@ function M(t, e, n) {
|
|
|
791
793
|
const c = /* @__PURE__ */ new Map();
|
|
792
794
|
o.forEach((f) => f.key && c.set(f.key, f));
|
|
793
795
|
const l = new Set(s.map((f) => f.key));
|
|
794
|
-
let
|
|
796
|
+
let u = [];
|
|
795
797
|
for (let f = 0; f < s.length; f++) {
|
|
796
798
|
const h = s[f], m = h.key ? c.get(h.key) : o[f];
|
|
797
799
|
let p;
|
|
@@ -813,78 +815,78 @@ function M(t, e, n) {
|
|
|
813
815
|
a.insertBefore(p, a.childNodes[f] || null);
|
|
814
816
|
}
|
|
815
817
|
}
|
|
816
|
-
h.dom = p, p &&
|
|
818
|
+
h.dom = p, p && u.push(p);
|
|
817
819
|
}
|
|
818
820
|
for (o.forEach((f) => {
|
|
819
821
|
!l.has(f.key) && f.dom && a.contains(f.dom) && a.removeChild(f.dom);
|
|
820
822
|
}); a.childNodes.length > s.length; )
|
|
821
823
|
a.removeChild(a.lastChild);
|
|
822
|
-
for (let f = 0; f <
|
|
823
|
-
if (a.childNodes[f] !==
|
|
824
|
-
if ((
|
|
824
|
+
for (let f = 0; f < u.length; f++)
|
|
825
|
+
if (a.childNodes[f] !== u[f]) {
|
|
826
|
+
if ((u[f] instanceof Element || u[f] instanceof Node) && u[f].contains(a))
|
|
825
827
|
throw new Error("VDOM patch error: Attempted to insert a parent into its own child");
|
|
826
|
-
a.insertBefore(
|
|
828
|
+
a.insertBefore(u[f], a.childNodes[f] || null);
|
|
827
829
|
}
|
|
828
|
-
|
|
829
|
-
const
|
|
830
|
+
r.dom = a;
|
|
831
|
+
const d = new Set(s.map((f) => f.key));
|
|
830
832
|
Array.from(a.childNodes).forEach((f, h) => {
|
|
831
833
|
const m = f.getAttribute?.("data-uid");
|
|
832
|
-
(m && !
|
|
834
|
+
(m && !d.has(m) || h >= s.length) && a.removeChild(f);
|
|
833
835
|
});
|
|
834
836
|
}
|
|
835
837
|
}
|
|
836
|
-
const
|
|
837
|
-
for (const
|
|
838
|
-
const
|
|
838
|
+
const it = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, b = (e, t) => {
|
|
839
|
+
for (const r of e) {
|
|
840
|
+
const n = [], o = r.path.replace(/:[^/]+/g, (a) => (n.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${o}$`), i = t.match(s);
|
|
839
841
|
if (i) {
|
|
840
842
|
const a = {};
|
|
841
|
-
return
|
|
843
|
+
return n.forEach((c, l) => {
|
|
842
844
|
a[c] = i[l + 1];
|
|
843
|
-
}), { route:
|
|
845
|
+
}), { route: r, params: a };
|
|
844
846
|
}
|
|
845
847
|
}
|
|
846
848
|
return { route: null, params: {} };
|
|
847
|
-
},
|
|
848
|
-
async function
|
|
849
|
-
if (
|
|
850
|
-
if (
|
|
851
|
-
if (
|
|
849
|
+
}, k = {};
|
|
850
|
+
async function ot(e) {
|
|
851
|
+
if (e.component) return e.component;
|
|
852
|
+
if (e.load) {
|
|
853
|
+
if (k[e.path]) return k[e.path];
|
|
852
854
|
try {
|
|
853
|
-
const
|
|
854
|
-
return
|
|
855
|
+
const t = await e.load();
|
|
856
|
+
return k[e.path] = t.default, t.default;
|
|
855
857
|
} catch {
|
|
856
|
-
throw new Error(`Failed to load component for route: ${
|
|
858
|
+
throw new Error(`Failed to load component for route: ${e.path}`);
|
|
857
859
|
}
|
|
858
860
|
}
|
|
859
|
-
throw new Error(`No component or loader defined for route: ${
|
|
861
|
+
throw new Error(`No component or loader defined for route: ${e.path}`);
|
|
860
862
|
}
|
|
861
|
-
function
|
|
862
|
-
const { routes:
|
|
863
|
-
let
|
|
863
|
+
function at(e) {
|
|
864
|
+
const { routes: t, base: r = "" } = e;
|
|
865
|
+
let n, o, s, i, a, c, l;
|
|
864
866
|
if (typeof window < "u" && typeof document < "u") {
|
|
865
|
-
|
|
866
|
-
const
|
|
867
|
+
n = () => {
|
|
868
|
+
const d = new URL(window.location.href), f = d.pathname.replace(r, "") || "/", h = it(d.search);
|
|
867
869
|
return { path: f, query: h };
|
|
868
|
-
}, o =
|
|
869
|
-
const
|
|
870
|
+
}, o = n();
|
|
871
|
+
const u = b(t, o.path);
|
|
870
872
|
s = j({
|
|
871
873
|
path: o.path,
|
|
872
|
-
params:
|
|
874
|
+
params: u.params,
|
|
873
875
|
query: o.query
|
|
874
876
|
}), i = () => {
|
|
875
|
-
const
|
|
876
|
-
h.path =
|
|
877
|
-
}, window.addEventListener("popstate", i), a = (
|
|
878
|
-
window.history.pushState({}, "",
|
|
879
|
-
}, c = (
|
|
880
|
-
window.history.replaceState({}, "",
|
|
877
|
+
const d = n(), f = b(t, d.path), h = s.getState();
|
|
878
|
+
h.path = d.path, h.params = f.params, h.query = d.query;
|
|
879
|
+
}, window.addEventListener("popstate", i), a = (d) => {
|
|
880
|
+
window.history.pushState({}, "", r + d), i();
|
|
881
|
+
}, c = (d) => {
|
|
882
|
+
window.history.replaceState({}, "", r + d), i();
|
|
881
883
|
}, l = () => window.history.back();
|
|
882
884
|
} else {
|
|
883
|
-
|
|
884
|
-
const
|
|
885
|
+
n = () => ({ path: "/", query: {} }), o = n();
|
|
886
|
+
const u = b(t, o.path);
|
|
885
887
|
s = j({
|
|
886
888
|
path: o.path,
|
|
887
|
-
params:
|
|
889
|
+
params: u.params,
|
|
888
890
|
query: o.query
|
|
889
891
|
}), i = () => {
|
|
890
892
|
}, a = () => {
|
|
@@ -898,96 +900,96 @@ function st(t) {
|
|
|
898
900
|
replace: c,
|
|
899
901
|
back: l,
|
|
900
902
|
subscribe: s.subscribe,
|
|
901
|
-
matchRoute: (
|
|
903
|
+
matchRoute: (u) => b(t, u),
|
|
902
904
|
getCurrent: () => s.getState(),
|
|
903
|
-
resolveRouteComponent:
|
|
905
|
+
resolveRouteComponent: ot
|
|
904
906
|
};
|
|
905
907
|
}
|
|
906
|
-
function pt(
|
|
907
|
-
return b(
|
|
908
|
+
function pt(e, t) {
|
|
909
|
+
return b(e, t);
|
|
908
910
|
}
|
|
909
|
-
function
|
|
910
|
-
const
|
|
911
|
+
function H(e, t) {
|
|
912
|
+
const r = [], n = t ? Object.keys(t) : [], o = { ...e };
|
|
911
913
|
let s = null;
|
|
912
|
-
function i(
|
|
913
|
-
return
|
|
914
|
-
const
|
|
915
|
-
|
|
914
|
+
function i(u) {
|
|
915
|
+
return r.push(u), () => {
|
|
916
|
+
const d = r.indexOf(u);
|
|
917
|
+
d !== -1 && r.splice(d, 1);
|
|
916
918
|
};
|
|
917
919
|
}
|
|
918
|
-
function a(
|
|
919
|
-
Object.assign(s,
|
|
920
|
+
function a(u) {
|
|
921
|
+
Object.assign(s, u), r.forEach((d) => d(s));
|
|
920
922
|
}
|
|
921
923
|
const c = /* @__PURE__ */ new WeakMap();
|
|
922
|
-
function l(
|
|
923
|
-
if (c.has(
|
|
924
|
-
const
|
|
924
|
+
function l(u) {
|
|
925
|
+
if (c.has(u)) return c.get(u);
|
|
926
|
+
const d = new Proxy(u, {
|
|
925
927
|
get(f, h, m) {
|
|
926
928
|
if (h === "subscribe") return i;
|
|
927
929
|
if (h === "set") return a;
|
|
928
|
-
if (
|
|
929
|
-
return
|
|
930
|
+
if (t && n.includes(h))
|
|
931
|
+
return t[h](s);
|
|
930
932
|
const p = Reflect.get(f, h, m);
|
|
931
933
|
return typeof p == "object" && p !== null ? l(p) : p;
|
|
932
934
|
},
|
|
933
935
|
set(f, h, m, p) {
|
|
934
|
-
if (
|
|
936
|
+
if (t && n.includes(h))
|
|
935
937
|
return !1;
|
|
936
938
|
const C = f[h], E = Reflect.set(f, h, m, p);
|
|
937
|
-
return C !== m &&
|
|
939
|
+
return C !== m && r.forEach((U) => U(s)), E;
|
|
938
940
|
},
|
|
939
941
|
deleteProperty(f, h) {
|
|
940
|
-
if (
|
|
942
|
+
if (t && n.includes(h))
|
|
941
943
|
return !1;
|
|
942
944
|
const m = Reflect.deleteProperty(f, h);
|
|
943
|
-
return
|
|
945
|
+
return r.forEach((p) => p(s)), m;
|
|
944
946
|
}
|
|
945
947
|
});
|
|
946
|
-
return c.set(
|
|
948
|
+
return c.set(u, d), d;
|
|
947
949
|
}
|
|
948
950
|
return s = l(o), s;
|
|
949
951
|
}
|
|
950
|
-
const
|
|
951
|
-
function mt(
|
|
952
|
-
|
|
952
|
+
const A = [];
|
|
953
|
+
function mt(e) {
|
|
954
|
+
A.push(e);
|
|
953
955
|
}
|
|
954
|
-
function
|
|
955
|
-
if (
|
|
956
|
-
if (
|
|
957
|
-
Object.getPrototypeOf(
|
|
958
|
-
const
|
|
959
|
-
for (const o of Object.keys(
|
|
960
|
-
|
|
961
|
-
return
|
|
956
|
+
function _(e, t = /* @__PURE__ */ new WeakSet()) {
|
|
957
|
+
if (e === null || typeof e != "object" || t.has(e)) return e;
|
|
958
|
+
if (t.add(e), Array.isArray(e)) return e.map((o) => _(o, t));
|
|
959
|
+
Object.getPrototypeOf(e) !== Object.prototype && Object.getPrototypeOf(e) !== null && Object.setPrototypeOf(e, null);
|
|
960
|
+
const r = ["__proto__", "constructor", "prototype"], n = /* @__PURE__ */ Object.create(null);
|
|
961
|
+
for (const o of Object.keys(e))
|
|
962
|
+
r.includes(o) || (n[o] = _(e[o], t));
|
|
963
|
+
return n;
|
|
962
964
|
}
|
|
963
|
-
function O(
|
|
964
|
-
return !!
|
|
965
|
+
function O(e) {
|
|
966
|
+
return !!e && typeof e.then == "function";
|
|
965
967
|
}
|
|
966
|
-
let
|
|
967
|
-
typeof HTMLElement < "u" && (
|
|
968
|
+
let K;
|
|
969
|
+
typeof HTMLElement < "u" && (K = class extends HTMLElement {
|
|
968
970
|
/**
|
|
969
971
|
* Syncs whitelisted state properties to attributes after render.
|
|
970
972
|
* Only keys listed in config.reflect are reflected.
|
|
971
973
|
*/
|
|
972
974
|
syncStateToAttributes() {
|
|
973
975
|
if (!this.stateObj || !this.config?.reflect || !Array.isArray(this.config.reflect)) return;
|
|
974
|
-
const
|
|
975
|
-
this.config.reflect.forEach((
|
|
976
|
-
if (
|
|
977
|
-
this.removeAttribute(
|
|
976
|
+
const e = ["__proto__", "constructor", "prototype"];
|
|
977
|
+
this.config.reflect.forEach((t) => {
|
|
978
|
+
if (e.includes(t)) {
|
|
979
|
+
this.removeAttribute(t);
|
|
978
980
|
return;
|
|
979
981
|
}
|
|
980
|
-
const
|
|
981
|
-
["string", "number", "boolean"].includes(typeof
|
|
982
|
+
const r = this.stateObj[t];
|
|
983
|
+
["string", "number", "boolean"].includes(typeof r) ? r == null ? this.removeAttribute(t) : this.setAttribute(t, String(r)) : this.removeAttribute(t);
|
|
982
984
|
});
|
|
983
985
|
}
|
|
984
986
|
/**
|
|
985
987
|
* Allows updating the template function at runtime and triggers a re-render.
|
|
986
988
|
* @param newTemplate - New template function or string
|
|
987
989
|
*/
|
|
988
|
-
setTemplate(
|
|
989
|
-
const
|
|
990
|
-
typeof
|
|
990
|
+
setTemplate(e) {
|
|
991
|
+
const t = this.config;
|
|
992
|
+
typeof e == "function" ? t.template = e : t.template = () => e, this.render();
|
|
991
993
|
}
|
|
992
994
|
_hasError = !1;
|
|
993
995
|
_mountedCalled = !1;
|
|
@@ -999,115 +1001,117 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
999
1001
|
/**
|
|
1000
1002
|
* Override removeEventListener to support auto-wired config handler removal
|
|
1001
1003
|
*/
|
|
1002
|
-
removeEventListener(
|
|
1003
|
-
super.removeEventListener(
|
|
1004
|
+
removeEventListener(e, t, r) {
|
|
1005
|
+
super.removeEventListener(e, t, r), this._autoWiredHandlers[e] && (this._autoWiredHandlers[e] = this._autoWiredHandlers[e].filter((n) => n === t ? (super.removeEventListener(e, n, r), !1) : !0), this._autoWiredHandlers[e].length === 0 && delete this._autoWiredHandlers[e]);
|
|
1004
1006
|
}
|
|
1005
1007
|
/**
|
|
1006
1008
|
* observedAttributes automatically returns all primitive keys from static state.
|
|
1007
1009
|
* This enables automatic attribute observation for all primitive state properties.
|
|
1008
1010
|
*/
|
|
1009
1011
|
static get observedAttributes() {
|
|
1010
|
-
const
|
|
1011
|
-
return Object.keys(
|
|
1012
|
-
(
|
|
1012
|
+
const e = this.stateObj || {};
|
|
1013
|
+
return Object.keys(e).filter(
|
|
1014
|
+
(t) => ["string", "number", "boolean"].includes(typeof e[t])
|
|
1013
1015
|
);
|
|
1014
1016
|
}
|
|
1015
1017
|
/**
|
|
1016
1018
|
* Called when an observed attribute changes. Syncs attribute to state and triggers render.
|
|
1017
1019
|
*/
|
|
1018
|
-
attributeChangedCallback(
|
|
1019
|
-
if (
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1020
|
+
attributeChangedCallback(e, t, r) {
|
|
1021
|
+
if (e === "__proto__" || e === "constructor" || e === "prototype" || !this.stateObj) return;
|
|
1022
|
+
const n = e.replace(/-([a-z])/g, (s, i) => i.toUpperCase()), o = e in this.stateObj ? e : n in this.stateObj ? n : null;
|
|
1023
|
+
if (o) {
|
|
1024
|
+
const s = typeof this.config?.state?.[o];
|
|
1025
|
+
let i = r;
|
|
1026
|
+
if (r === null)
|
|
1027
|
+
i = void 0;
|
|
1028
|
+
else if (s === "number")
|
|
1029
|
+
if (i === void 0 || i === "")
|
|
1030
|
+
i = this.config?.state?.[o];
|
|
1027
1031
|
else {
|
|
1028
|
-
const
|
|
1029
|
-
|
|
1032
|
+
const a = Number(i);
|
|
1033
|
+
i = isNaN(a) ? this.config?.state?.[o] : a;
|
|
1030
1034
|
}
|
|
1031
|
-
else
|
|
1032
|
-
|
|
1035
|
+
else s === "boolean" && (i = i === "true");
|
|
1036
|
+
i = _(i), this.stateObj[o] !== i && (this.config?.debug && console.log("[runtime] state update:", { stateKey: o, value: i }), this.stateObj[o] = i, this.render());
|
|
1033
1037
|
}
|
|
1034
1038
|
}
|
|
1035
1039
|
/**
|
|
1036
1040
|
* Force sync all controlled input values and event listeners after VDOM patching.
|
|
1037
1041
|
*/
|
|
1038
1042
|
forceSyncControlledInputs() {
|
|
1039
|
-
this.shadowRoot && (this.shadowRoot.querySelectorAll("input[data-model]").forEach((
|
|
1040
|
-
const
|
|
1041
|
-
if (!
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
}),
|
|
1046
|
-
|
|
1047
|
-
}),
|
|
1048
|
-
const s = !!
|
|
1049
|
-
o || s ||
|
|
1043
|
+
this.shadowRoot && (this.shadowRoot.querySelectorAll("input[data-model]").forEach((e) => {
|
|
1044
|
+
const t = e.getAttribute("data-model");
|
|
1045
|
+
if (!t || !this.stateObj || typeof this.stateObj[t] > "u") return;
|
|
1046
|
+
const r = e, n = String(this.stateObj[t]), o = document.activeElement === r;
|
|
1047
|
+
r._hasDirtyListener || (r.addEventListener("input", () => {
|
|
1048
|
+
r._isDirty = !0;
|
|
1049
|
+
}), r.addEventListener("blur", () => {
|
|
1050
|
+
r._isDirty = !1;
|
|
1051
|
+
}), r._hasDirtyListener = !0);
|
|
1052
|
+
const s = !!r._isDirty;
|
|
1053
|
+
o || s || r.type !== "radio" && r.type !== "checkbox" && r.value !== n && (r.value = n);
|
|
1050
1054
|
}), this.rebindEventListeners());
|
|
1051
1055
|
}
|
|
1052
1056
|
/**
|
|
1053
1057
|
* Sync all controlled inputs and event listeners after render
|
|
1054
1058
|
*/
|
|
1055
1059
|
syncControlledInputsAndEvents() {
|
|
1056
|
-
this.shadowRoot && (this.shadowRoot.querySelectorAll('input[type="radio"][data-model]').forEach((
|
|
1057
|
-
const
|
|
1058
|
-
if (!
|
|
1060
|
+
this.shadowRoot && (this.shadowRoot.querySelectorAll('input[type="radio"][data-model]').forEach((e) => {
|
|
1061
|
+
const t = e.getAttribute("data-model");
|
|
1062
|
+
if (!t || !this.stateObj || typeof this.stateObj[t] > "u")
|
|
1059
1063
|
return;
|
|
1060
|
-
const
|
|
1061
|
-
|
|
1062
|
-
}), this.shadowRoot.querySelectorAll("input[data-model]").forEach((
|
|
1063
|
-
const
|
|
1064
|
-
if (!
|
|
1065
|
-
const
|
|
1066
|
-
if (
|
|
1067
|
-
const o = this.stateObj[
|
|
1064
|
+
const r = e, n = String(this.stateObj[t]);
|
|
1065
|
+
r.checked = r.value === n;
|
|
1066
|
+
}), this.shadowRoot.querySelectorAll("input[data-model]").forEach((e) => {
|
|
1067
|
+
const t = e.getAttribute("data-model");
|
|
1068
|
+
if (!t || !this.stateObj || typeof this.stateObj[t] > "u") return;
|
|
1069
|
+
const r = e, n = String(this.stateObj[t]);
|
|
1070
|
+
if (r.type === "checkbox") {
|
|
1071
|
+
const o = this.stateObj[t];
|
|
1068
1072
|
if (Array.isArray(o))
|
|
1069
|
-
|
|
1073
|
+
r.checked = o.includes(r.value);
|
|
1070
1074
|
else {
|
|
1071
|
-
const s =
|
|
1072
|
-
s !== null || i !== null ? String(o) === s ?
|
|
1075
|
+
const s = r.getAttribute("data-true-value"), i = r.getAttribute("data-false-value");
|
|
1076
|
+
s !== null || i !== null ? String(o) === s ? r.checked = !0 : String(o) === i ? r.checked = !1 : o === !0 ? r.checked = !0 : r.checked = !1 : r.checked = o === !0 || o === "true" || o === 1;
|
|
1073
1077
|
}
|
|
1074
|
-
} else
|
|
1075
|
-
}), this.shadowRoot.querySelectorAll("textarea[data-model]").forEach((
|
|
1076
|
-
const
|
|
1077
|
-
!
|
|
1078
|
-
}), this.shadowRoot.querySelectorAll("select[data-model]").forEach((
|
|
1079
|
-
const
|
|
1080
|
-
!
|
|
1078
|
+
} else r.type === "radio" || (r.value = n);
|
|
1079
|
+
}), this.shadowRoot.querySelectorAll("textarea[data-model]").forEach((e) => {
|
|
1080
|
+
const t = e.getAttribute("data-model");
|
|
1081
|
+
!t || !this.stateObj || typeof this.stateObj[t] > "u" || (e.value = String(this.stateObj[t]));
|
|
1082
|
+
}), this.shadowRoot.querySelectorAll("select[data-model]").forEach((e) => {
|
|
1083
|
+
const t = e.getAttribute("data-model");
|
|
1084
|
+
!t || !this.stateObj || typeof this.stateObj[t] > "u" || (e.value = String(this.stateObj[t]));
|
|
1081
1085
|
}));
|
|
1082
1086
|
}
|
|
1083
1087
|
/**
|
|
1084
1088
|
* Attach event listeners for input[data-bind] after VDOM patching
|
|
1085
1089
|
*/
|
|
1086
1090
|
attachListItemModelListeners() {
|
|
1087
|
-
this.shadowRoot && this.shadowRoot.querySelectorAll("input[data-bind]").forEach((
|
|
1088
|
-
const
|
|
1089
|
-
if (!
|
|
1090
|
-
|
|
1091
|
-
const
|
|
1092
|
-
if (
|
|
1093
|
-
const [, o, s, i] =
|
|
1094
|
-
|
|
1095
|
-
const l = (
|
|
1096
|
-
!Array.isArray(c) || !c[a] || (
|
|
1091
|
+
this.shadowRoot && this.shadowRoot.querySelectorAll("input[data-bind]").forEach((e) => {
|
|
1092
|
+
const t = e.getAttribute("data-bind");
|
|
1093
|
+
if (!t) return;
|
|
1094
|
+
e._listItemModelListener && (e.removeEventListener("input", e._listItemModelListener), e.removeEventListener("change", e._listItemModelListener), delete e._listItemModelListener);
|
|
1095
|
+
const r = t.match(/^([a-zA-Z0-9_]+)\[(\d+)\]\.([a-zA-Z0-9_]+)$/);
|
|
1096
|
+
if (r) {
|
|
1097
|
+
const [, o, s, i] = r, a = parseInt(s, 10), c = this.stateObj[o];
|
|
1098
|
+
e instanceof HTMLInputElement && e.type === "checkbox" && (e.checked = !!(Array.isArray(c) && c[a] && c[a][i]));
|
|
1099
|
+
const l = (u) => {
|
|
1100
|
+
!Array.isArray(c) || !c[a] || (e instanceof HTMLInputElement && e.type === "checkbox" ? c[a][i] = e.checked : c[a][i] = e.value);
|
|
1097
1101
|
};
|
|
1098
|
-
|
|
1102
|
+
e.addEventListener("input", l), e.addEventListener("change", l), e._listItemModelListener = l;
|
|
1099
1103
|
return;
|
|
1100
1104
|
}
|
|
1101
|
-
const
|
|
1102
|
-
if (
|
|
1103
|
-
const [, o, s, i] =
|
|
1104
|
-
|
|
1105
|
-
const l = (
|
|
1105
|
+
const n = t.match(/^([a-zA-Z0-9_]+)\.([a-zA-Z0-9_]+)((?:\|[a-zA-Z0-9_]+)*)$/);
|
|
1106
|
+
if (n) {
|
|
1107
|
+
const [, o, s, i] = n, a = this.stateObj[o], c = i ? i.split("|").map((u) => u.trim()).filter(Boolean) : [];
|
|
1108
|
+
e instanceof HTMLInputElement && e.type === "checkbox" ? e.checked = !!(a && a[s]) : e instanceof HTMLInputElement && (e.value = a ? String(a[s] ?? "") : "");
|
|
1109
|
+
const l = (u) => {
|
|
1106
1110
|
if (!a) return;
|
|
1107
|
-
let
|
|
1108
|
-
|
|
1111
|
+
let d;
|
|
1112
|
+
e instanceof HTMLInputElement && e.type === "checkbox" ? d = e.checked : (d = e.value, c.includes("number") && (d = Number(d)), c.includes("trim") && typeof d == "string" && (d = d.trim())), a[s] = d;
|
|
1109
1113
|
};
|
|
1110
|
-
|
|
1114
|
+
e.addEventListener("input", l), e.addEventListener("change", l), e._listItemModelListener = l;
|
|
1111
1115
|
}
|
|
1112
1116
|
});
|
|
1113
1117
|
}
|
|
@@ -1115,19 +1119,19 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1115
1119
|
* Attach controlled input listeners to sync DOM value to state
|
|
1116
1120
|
*/
|
|
1117
1121
|
attachControlledInputListeners() {
|
|
1118
|
-
const
|
|
1119
|
-
|
|
1120
|
-
const
|
|
1121
|
-
|
|
1122
|
-
}),
|
|
1123
|
-
const [
|
|
1124
|
-
if (!(!
|
|
1125
|
-
if (
|
|
1126
|
-
if (
|
|
1127
|
-
const
|
|
1128
|
-
Array.isArray(
|
|
1129
|
-
} else
|
|
1130
|
-
else (
|
|
1122
|
+
const e = this.shadowRoot;
|
|
1123
|
+
e && (e.querySelectorAll("[data-model]").forEach((t) => {
|
|
1124
|
+
const r = t.getAttribute("data-model");
|
|
1125
|
+
r && (t._dataModelBound || (J(t, this.stateObj, r), t._dataModelBound = !0));
|
|
1126
|
+
}), e.querySelectorAll("[data-model]").forEach((t) => {
|
|
1127
|
+
const [r] = t.getAttribute("data-model")?.split("|").map((n) => n.trim()) ?? [];
|
|
1128
|
+
if (!(!r || !(r in this.stateObj)))
|
|
1129
|
+
if (t instanceof HTMLInputElement)
|
|
1130
|
+
if (t.type === "checkbox") {
|
|
1131
|
+
const n = this.stateObj[r], o = t.getAttribute("data-true-value"), s = t.getAttribute("data-false-value");
|
|
1132
|
+
Array.isArray(n) ? t.checked = n.includes(t.value) : o !== null || s !== null ? String(n) === o ? t.checked = !0 : String(n) === s ? t.checked = !1 : n === !0 ? t.checked = !0 : t.checked = !1 : t.checked = n === !0 || n === "true" || n === 1;
|
|
1133
|
+
} else t.type === "radio" ? t.checked = t.value === String(this.stateObj[r]) : t.value = String(this.stateObj[r] ?? "");
|
|
1134
|
+
else (t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement) && (t.value = String(this.stateObj[r] ?? ""));
|
|
1131
1135
|
}));
|
|
1132
1136
|
}
|
|
1133
1137
|
config;
|
|
@@ -1147,14 +1151,14 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1147
1151
|
}
|
|
1148
1152
|
initializeConfig() {
|
|
1149
1153
|
if (this.config) return;
|
|
1150
|
-
const
|
|
1151
|
-
if (!
|
|
1154
|
+
const e = this.tagName.toLowerCase(), r = (window.__componentRegistry || {})[e];
|
|
1155
|
+
if (!r || typeof r != "object")
|
|
1152
1156
|
throw new Error("Invalid component config: must be an object");
|
|
1153
|
-
if (!
|
|
1157
|
+
if (!r.state || typeof r.state != "object")
|
|
1154
1158
|
throw new Error("Invalid component config: state must be an object");
|
|
1155
|
-
this.config =
|
|
1156
|
-
const
|
|
1157
|
-
if (this.stateObj =
|
|
1159
|
+
this.config = r;
|
|
1160
|
+
const n = r.computed ? H(r.state, r.computed) : H(r.state);
|
|
1161
|
+
if (this.stateObj = n, typeof this.stateObj.subscribe == "function" && this.unsubscribes.push(this.stateObj.subscribe(() => {
|
|
1158
1162
|
this.scheduleRender();
|
|
1159
1163
|
})), this.api = {
|
|
1160
1164
|
state: this.stateObj,
|
|
@@ -1164,7 +1168,8 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1164
1168
|
return this._globalUnsubscribes.push(a), a;
|
|
1165
1169
|
},
|
|
1166
1170
|
offGlobal: (s, i) => w.off(s, i),
|
|
1167
|
-
emitGlobal: (s, i) => w.emit(s, i)
|
|
1171
|
+
emitGlobal: (s, i) => w.emit(s, i),
|
|
1172
|
+
render: () => this.render()
|
|
1168
1173
|
}, Object.keys(this.config).forEach((s) => {
|
|
1169
1174
|
if (s.startsWith("on") && s.length > 2 && typeof this.config[s] == "function") {
|
|
1170
1175
|
const i = s.charAt(2).toLowerCase() + s.slice(3), a = (c) => {
|
|
@@ -1173,9 +1178,9 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1173
1178
|
};
|
|
1174
1179
|
this.addEventListener(i, a), this._autoWiredHandlers[i] || (this._autoWiredHandlers[i] = []), this._autoWiredHandlers[i].push(a);
|
|
1175
1180
|
}
|
|
1176
|
-
}), this.attachShadow({ mode: "open" }),
|
|
1181
|
+
}), this.attachShadow({ mode: "open" }), r.style) {
|
|
1177
1182
|
const s = document.createElement("style");
|
|
1178
|
-
s.textContent = typeof
|
|
1183
|
+
s.textContent = typeof r.style == "function" ? r.style(this.stateObj) : r.style, this.shadowRoot.appendChild(s);
|
|
1179
1184
|
}
|
|
1180
1185
|
if (typeof this.config.hydrate == "function") {
|
|
1181
1186
|
const s = this.shadowRoot?.querySelectorAll("[data-hydrate]");
|
|
@@ -1204,24 +1209,25 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1204
1209
|
}
|
|
1205
1210
|
}
|
|
1206
1211
|
connectedCallback() {
|
|
1207
|
-
if (this.initializeConfig(), this.stateObj)
|
|
1208
|
-
for (const
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1212
|
+
if (this.initializeConfig(), this.stateObj)
|
|
1213
|
+
for (const e of this.getAttributeNames()) {
|
|
1214
|
+
const r = e.replace(/-([a-z])/g, (n, o) => o.toUpperCase());
|
|
1215
|
+
if (r in this.stateObj) {
|
|
1216
|
+
const n = typeof this.config?.state?.[r];
|
|
1217
|
+
let o = this.getAttribute(e);
|
|
1218
|
+
n === "number" ? o = Number(o) : n === "boolean" && (o = o === "true"), this.stateObj[r] = o === null ? void 0 : o;
|
|
1213
1219
|
}
|
|
1214
|
-
|
|
1220
|
+
}
|
|
1215
1221
|
if (!this._mountedCalled && typeof this.config.onMounted == "function")
|
|
1216
1222
|
try {
|
|
1217
|
-
const
|
|
1218
|
-
O(
|
|
1219
|
-
typeof this.config.onError == "function" && this.config.onError(
|
|
1223
|
+
const e = this.config.onMounted(this.api.state, this.api);
|
|
1224
|
+
O(e) ? e.catch((t) => {
|
|
1225
|
+
typeof this.config.onError == "function" && this.config.onError(t, this.api.state, this.api), this._handleRenderError(t);
|
|
1220
1226
|
}).finally(() => {
|
|
1221
1227
|
this._mountedCalled = !0;
|
|
1222
1228
|
}) : this._mountedCalled = !0;
|
|
1223
|
-
} catch (
|
|
1224
|
-
typeof this.config.onError == "function" && this.config.onError(
|
|
1229
|
+
} catch (e) {
|
|
1230
|
+
typeof this.config.onError == "function" && this.config.onError(e, this.api.state, this.api), this._handleRenderError(e), this._mountedCalled = !0;
|
|
1225
1231
|
}
|
|
1226
1232
|
typeof this.render == "function" && this.render();
|
|
1227
1233
|
}
|
|
@@ -1229,20 +1235,20 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1229
1235
|
* Lifecycle: called when element is removed from DOM.
|
|
1230
1236
|
*/
|
|
1231
1237
|
disconnectedCallback() {
|
|
1232
|
-
if (Object.entries(this._autoWiredHandlers).forEach(([
|
|
1233
|
-
|
|
1234
|
-
super.removeEventListener(
|
|
1238
|
+
if (Object.entries(this._autoWiredHandlers).forEach(([e, t]) => {
|
|
1239
|
+
t.forEach((r) => {
|
|
1240
|
+
super.removeEventListener(e, r);
|
|
1235
1241
|
});
|
|
1236
|
-
}), this._autoWiredHandlers = {}, this.unsubscribes.forEach((
|
|
1242
|
+
}), this._autoWiredHandlers = {}, this.unsubscribes.forEach((e) => e()), this.unsubscribes = [], this._globalUnsubscribes.forEach((e) => e()), this._globalUnsubscribes = [], !this._unmountedCalled && typeof this.config.onUnmounted == "function")
|
|
1237
1243
|
try {
|
|
1238
|
-
const
|
|
1239
|
-
O(
|
|
1240
|
-
typeof this.config.onError == "function" && this.config.onError(
|
|
1244
|
+
const e = this.config.onUnmounted(this.api.state, this.api);
|
|
1245
|
+
O(e) ? e.catch((t) => {
|
|
1246
|
+
typeof this.config.onError == "function" && this.config.onError(t, this.api.state, this.api), this._handleRenderError(t);
|
|
1241
1247
|
}).finally(() => {
|
|
1242
1248
|
this._unmountedCalled = !0;
|
|
1243
1249
|
}) : this._unmountedCalled = !0;
|
|
1244
|
-
} catch (
|
|
1245
|
-
typeof this.config.onError == "function" && this.config.onError(
|
|
1250
|
+
} catch (e) {
|
|
1251
|
+
typeof this.config.onError == "function" && this.config.onError(e, this.api.state, this.api), this._handleRenderError(e), this._unmountedCalled = !0;
|
|
1246
1252
|
}
|
|
1247
1253
|
this._mountedCalled = !1, this._unmountedCalled = !1;
|
|
1248
1254
|
}
|
|
@@ -1252,27 +1258,27 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1252
1258
|
render() {
|
|
1253
1259
|
this._hasError = !1, this.syncControlledInputsAndEvents(), setTimeout(() => this.attachControlledInputListeners(), 0);
|
|
1254
1260
|
try {
|
|
1255
|
-
|
|
1261
|
+
A.forEach((t) => {
|
|
1256
1262
|
try {
|
|
1257
|
-
|
|
1258
|
-
} catch (
|
|
1259
|
-
this._handleRenderError(
|
|
1263
|
+
t.onRender?.(this.stateObj, this.api);
|
|
1264
|
+
} catch (r) {
|
|
1265
|
+
this._handleRenderError(r);
|
|
1260
1266
|
}
|
|
1261
|
-
}), this.config.computed && Object.values(this.config.computed).forEach((
|
|
1267
|
+
}), this.config.computed && Object.values(this.config.computed).forEach((t) => {
|
|
1262
1268
|
try {
|
|
1263
|
-
|
|
1264
|
-
} catch (
|
|
1265
|
-
this._handleRenderError(
|
|
1269
|
+
t(this.stateObj);
|
|
1270
|
+
} catch (r) {
|
|
1271
|
+
this._handleRenderError(r);
|
|
1266
1272
|
}
|
|
1267
1273
|
});
|
|
1268
|
-
const
|
|
1269
|
-
|
|
1270
|
-
this._hasError || (this._renderTemplateResult(
|
|
1271
|
-
}).catch((
|
|
1272
|
-
this._handleRenderError(
|
|
1273
|
-
}) : this._hasError || (this._renderTemplateResult(
|
|
1274
|
-
} catch (
|
|
1275
|
-
this._handleRenderError(
|
|
1274
|
+
const e = this.config.template(this.stateObj, this.api);
|
|
1275
|
+
e instanceof Promise ? e.then((t) => {
|
|
1276
|
+
this._hasError || (this._renderTemplateResult(t), this.syncStateToAttributes(), setTimeout(() => this.attachListItemModelListeners(), 0));
|
|
1277
|
+
}).catch((t) => {
|
|
1278
|
+
this._handleRenderError(t);
|
|
1279
|
+
}) : this._hasError || (this._renderTemplateResult(e), this.syncStateToAttributes(), setTimeout(() => this.attachListItemModelListeners(), 0));
|
|
1280
|
+
} catch (e) {
|
|
1281
|
+
this._handleRenderError(e), this.renderError(e instanceof Error ? e : new Error(String(e)));
|
|
1276
1282
|
}
|
|
1277
1283
|
}
|
|
1278
1284
|
/**
|
|
@@ -1284,16 +1290,16 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1284
1290
|
*/
|
|
1285
1291
|
rebindEventListeners() {
|
|
1286
1292
|
if (!this.shadowRoot) return;
|
|
1287
|
-
["data-on-input", "data-on-change", "data-on-blur", "data-on-click"].forEach((
|
|
1288
|
-
this.shadowRoot.querySelectorAll(`[${
|
|
1289
|
-
const
|
|
1293
|
+
["data-on-input", "data-on-change", "data-on-blur", "data-on-click"].forEach((t) => {
|
|
1294
|
+
this.shadowRoot.querySelectorAll(`[${t}]`).forEach((r) => {
|
|
1295
|
+
const n = t.replace("data-on-", ""), o = r.getAttribute(t);
|
|
1290
1296
|
if (!o || typeof this.config[o] != "function") return;
|
|
1291
|
-
|
|
1292
|
-
const s = this.config[o], i = (a) => s.call(this, a);
|
|
1293
|
-
|
|
1297
|
+
r._boundHandlers && r._boundHandlers[n] && r.removeEventListener(n, r._boundHandlers[n]);
|
|
1298
|
+
const s = this.config[o], i = (a) => s.call(this, a, this.stateObj, this.api);
|
|
1299
|
+
r.addEventListener(n, i), r._boundHandlers || (r._boundHandlers = {}), r._boundHandlers[n] = i;
|
|
1294
1300
|
});
|
|
1295
|
-
}), Array.from(this.shadowRoot.children).forEach((
|
|
1296
|
-
|
|
1301
|
+
}), Array.from(this.shadowRoot.children).forEach((t) => {
|
|
1302
|
+
t instanceof HTMLElement && typeof t.rebindEventListeners == "function" && t.rebindEventListeners();
|
|
1297
1303
|
});
|
|
1298
1304
|
}
|
|
1299
1305
|
/**
|
|
@@ -1301,32 +1307,32 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1301
1307
|
* Handles VDOM patching, style updates, refs, and event binding.
|
|
1302
1308
|
* @param templateResult - HTML string or compiled template
|
|
1303
1309
|
*/
|
|
1304
|
-
_renderTemplateResult(
|
|
1310
|
+
_renderTemplateResult(e) {
|
|
1305
1311
|
if (!this._hasError)
|
|
1306
1312
|
try {
|
|
1307
|
-
let
|
|
1308
|
-
const
|
|
1313
|
+
let t = function(r) {
|
|
1314
|
+
const n = /* @__PURE__ */ new WeakSet();
|
|
1309
1315
|
function o(s) {
|
|
1310
|
-
if (s === null || typeof s != "object" ||
|
|
1311
|
-
if (
|
|
1316
|
+
if (s === null || typeof s != "object" || n.has(s)) return s;
|
|
1317
|
+
if (n.add(s), Array.isArray(s)) return s.map(o);
|
|
1312
1318
|
const i = {};
|
|
1313
1319
|
for (const a in s)
|
|
1314
1320
|
Object.prototype.hasOwnProperty.call(s, a) && (i[a] = o(s[a]));
|
|
1315
1321
|
return i;
|
|
1316
1322
|
}
|
|
1317
|
-
return o(
|
|
1323
|
+
return o(r);
|
|
1318
1324
|
};
|
|
1319
|
-
if (typeof
|
|
1320
|
-
let
|
|
1321
|
-
return c.replace(/<([a-zA-Z0-9]+)([^>]*)>/g, (l,
|
|
1322
|
-
const f =
|
|
1323
|
-
return `<${
|
|
1325
|
+
if (typeof e == "string") {
|
|
1326
|
+
let r = function(c) {
|
|
1327
|
+
return c.replace(/<([a-zA-Z0-9]+)([^>]*)>/g, (l, u, d) => {
|
|
1328
|
+
const f = d.replace(/\s+on[a-zA-Z]+\s*=\s*(['"][^'"]*['"]|[^\s>]*)/gi, "");
|
|
1329
|
+
return `<${u}${f}>`;
|
|
1324
1330
|
});
|
|
1325
|
-
},
|
|
1326
|
-
c.children.forEach(
|
|
1331
|
+
}, n = function(c) {
|
|
1332
|
+
c.children.forEach(n);
|
|
1327
1333
|
};
|
|
1328
|
-
const o =
|
|
1329
|
-
|
|
1334
|
+
const o = r(e), s = st(o);
|
|
1335
|
+
n(s);
|
|
1330
1336
|
const i = this.shadowRoot;
|
|
1331
1337
|
if (!i)
|
|
1332
1338
|
return;
|
|
@@ -1336,8 +1342,8 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1336
1342
|
(l) => l.nodeType === 1 && l !== a
|
|
1337
1343
|
);
|
|
1338
1344
|
if (c) {
|
|
1339
|
-
Array.from(c.childNodes).forEach((
|
|
1340
|
-
|
|
1345
|
+
Array.from(c.childNodes).forEach((d) => {
|
|
1346
|
+
d.nodeType === 1 && d.nodeName === "STYLE" || c.removeChild(d);
|
|
1341
1347
|
});
|
|
1342
1348
|
const l = {
|
|
1343
1349
|
type: "#fragment",
|
|
@@ -1345,12 +1351,12 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1345
1351
|
children: s.children,
|
|
1346
1352
|
props: {},
|
|
1347
1353
|
key: void 0
|
|
1348
|
-
},
|
|
1349
|
-
M(c,
|
|
1354
|
+
}, u = this._prevVNode && this._prevVNode.type === "#fragment" ? { ...this._prevVNode, dom: c } : l;
|
|
1355
|
+
M(c, u, l);
|
|
1350
1356
|
} else
|
|
1351
1357
|
s.children.forEach((l) => {
|
|
1352
|
-
const
|
|
1353
|
-
|
|
1358
|
+
const u = g(l);
|
|
1359
|
+
u && i.appendChild(u), l.dom = u ?? void 0;
|
|
1354
1360
|
});
|
|
1355
1361
|
} else {
|
|
1356
1362
|
let c = Array.from(this.shadowRoot.childNodes).find(
|
|
@@ -1368,15 +1374,15 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1368
1374
|
}
|
|
1369
1375
|
this._prevVNode = s, this.forceSyncControlledInputs(), this.lastCompiledTemplate = null;
|
|
1370
1376
|
} else {
|
|
1371
|
-
const
|
|
1372
|
-
if (
|
|
1373
|
-
const o = I(
|
|
1377
|
+
const r = !this.shadowRoot.firstElementChild, n = this.lastCompiledTemplate?.id === e.id;
|
|
1378
|
+
if (r) {
|
|
1379
|
+
const o = I(e, this.stateObj, this.api);
|
|
1374
1380
|
this.shadowRoot.appendChild(o);
|
|
1375
|
-
} else if (
|
|
1381
|
+
} else if (n && this.shadowRoot.firstElementChild) {
|
|
1376
1382
|
const o = this.lastState;
|
|
1377
|
-
|
|
1383
|
+
rt(e, this.shadowRoot.firstElementChild, this.stateObj, this.api, o || void 0);
|
|
1378
1384
|
} else {
|
|
1379
|
-
const o = I(
|
|
1385
|
+
const o = I(e, this.stateObj, this.api);
|
|
1380
1386
|
let s = this.shadowRoot.querySelector("style");
|
|
1381
1387
|
s || (s = document.createElement("style"), this.shadowRoot.insertBefore(s, this.shadowRoot.firstChild)), this.config.style ? s.textContent = typeof this.config.style == "function" ? this.config.style(this.stateObj) : this.config.style : s.textContent = "";
|
|
1382
1388
|
let i = this.shadowRoot.querySelector("[data-root]");
|
|
@@ -1384,11 +1390,11 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1384
1390
|
i.removeChild(i.firstChild);
|
|
1385
1391
|
i.appendChild(o);
|
|
1386
1392
|
}
|
|
1387
|
-
this.lastCompiledTemplate =
|
|
1393
|
+
this.lastCompiledTemplate = e;
|
|
1388
1394
|
}
|
|
1389
|
-
this.lastState =
|
|
1390
|
-
} catch (
|
|
1391
|
-
this._handleRenderError(
|
|
1395
|
+
this.lastState = t(this.stateObj), this.updateStyle(), this.processRefs(), this.bindEvents(), this.syncControlledInputsAndEvents();
|
|
1396
|
+
} catch (t) {
|
|
1397
|
+
this._handleRenderError(t);
|
|
1392
1398
|
}
|
|
1393
1399
|
}
|
|
1394
1400
|
/**
|
|
@@ -1396,14 +1402,14 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1396
1402
|
* Logs details and allows fallback UI.
|
|
1397
1403
|
* @param error - Error object
|
|
1398
1404
|
*/
|
|
1399
|
-
_handleRenderError(
|
|
1400
|
-
if (this._hasError = !0, this.config.debug && console.error(`[runtime] Render error in <${this.tagName.toLowerCase()}>:`,
|
|
1405
|
+
_handleRenderError(e) {
|
|
1406
|
+
if (this._hasError = !0, this.config.debug && console.error(`[runtime] Render error in <${this.tagName.toLowerCase()}>:`, e), A.forEach((t) => t.onError?.(e instanceof Error ? e : new Error(String(e)), this.stateObj, this.api)), "onError" in this.config && typeof this.config.onError == "function")
|
|
1401
1407
|
try {
|
|
1402
|
-
this.config.onError(
|
|
1403
|
-
} catch (
|
|
1404
|
-
this.config.debug && console.error("[runtime] Error in onError handler:",
|
|
1408
|
+
this.config.onError(e instanceof Error ? e : new Error(String(e)), this.api.state, this.api);
|
|
1409
|
+
} catch (t) {
|
|
1410
|
+
this.config.debug && console.error("[runtime] Error in onError handler:", t);
|
|
1405
1411
|
}
|
|
1406
|
-
this.renderError(
|
|
1412
|
+
this.renderError(e instanceof Error ? e : new Error(String(e)));
|
|
1407
1413
|
}
|
|
1408
1414
|
/**
|
|
1409
1415
|
* Schedule a render using requestAnimationFrame, batching multiple state changes.
|
|
@@ -1417,28 +1423,28 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1417
1423
|
* Updates the style element in the shadow root based on the current state.
|
|
1418
1424
|
*/
|
|
1419
1425
|
updateStyle() {
|
|
1420
|
-
const
|
|
1421
|
-
if (!
|
|
1422
|
-
const
|
|
1423
|
-
|
|
1426
|
+
const e = this.shadowRoot.querySelector("style");
|
|
1427
|
+
if (!e || !this.config.style) return;
|
|
1428
|
+
const t = typeof this.config.style == "function" ? this.config.style(this.api.state) : this.config.style;
|
|
1429
|
+
e.textContent = t;
|
|
1424
1430
|
}
|
|
1425
1431
|
/**
|
|
1426
1432
|
* Processes and attaches ref handlers for elements with data-ref attributes.
|
|
1427
1433
|
*/
|
|
1428
1434
|
processRefs() {
|
|
1429
1435
|
if (!this.config.refs) return;
|
|
1430
|
-
const
|
|
1431
|
-
Object.entries(this.config.refs).forEach(([
|
|
1432
|
-
const
|
|
1433
|
-
if (
|
|
1434
|
-
|
|
1435
|
-
const o =
|
|
1436
|
-
|
|
1436
|
+
const e = /* @__PURE__ */ new WeakMap();
|
|
1437
|
+
Object.entries(this.config.refs).forEach(([t, r]) => {
|
|
1438
|
+
const n = this.shadowRoot.querySelector(`[data-ref="${t}"]`);
|
|
1439
|
+
if (n) {
|
|
1440
|
+
e.has(n) || e.set(n, /* @__PURE__ */ new Set());
|
|
1441
|
+
const o = e.get(n), s = n.addEventListener;
|
|
1442
|
+
n.addEventListener = function(i, a, c) {
|
|
1437
1443
|
const l = `${i}`;
|
|
1438
|
-
o.has(l) || (o.add(l), s.call(
|
|
1439
|
-
},
|
|
1444
|
+
o.has(l) || (o.add(l), s.call(n, i, a, c));
|
|
1445
|
+
}, n.setAttribute("data-refs-processed", "true");
|
|
1440
1446
|
try {
|
|
1441
|
-
n
|
|
1447
|
+
r(n, this.api.state, this.api);
|
|
1442
1448
|
} catch (i) {
|
|
1443
1449
|
this._handleRenderError(i);
|
|
1444
1450
|
}
|
|
@@ -1451,44 +1457,44 @@ typeof HTMLElement < "u" && (W = class extends HTMLElement {
|
|
|
1451
1457
|
*/
|
|
1452
1458
|
bindEvents() {
|
|
1453
1459
|
if (!this.shadowRoot) return;
|
|
1454
|
-
const
|
|
1455
|
-
let
|
|
1456
|
-
for (;
|
|
1457
|
-
const
|
|
1458
|
-
Array.from(
|
|
1459
|
-
if (
|
|
1460
|
-
const o =
|
|
1460
|
+
const e = document.createTreeWalker(this.shadowRoot, NodeFilter.SHOW_ELEMENT);
|
|
1461
|
+
let t = e.nextNode();
|
|
1462
|
+
for (; t; ) {
|
|
1463
|
+
const r = t;
|
|
1464
|
+
Array.from(r.attributes).forEach((n) => {
|
|
1465
|
+
if (n.name.startsWith("data-on-")) {
|
|
1466
|
+
const o = n.name.slice(8), s = n.value, i = this.config[s];
|
|
1461
1467
|
if (typeof i == "function") {
|
|
1462
|
-
|
|
1468
|
+
r._boundHandlers && r._boundHandlers[o] && r.removeEventListener(o, r._boundHandlers[o]);
|
|
1463
1469
|
const a = (c) => {
|
|
1464
1470
|
i.call(this.config, c, this.api.state, this.api), this.syncControlledInputsAndEvents();
|
|
1465
1471
|
};
|
|
1466
|
-
|
|
1472
|
+
r.addEventListener(o, a), r._boundHandlers || (r._boundHandlers = {}), r._boundHandlers[o] = a;
|
|
1467
1473
|
} else
|
|
1468
|
-
this.config.debug && console.warn(`[runtime] Handler '${s}' not found on config for event '${o}'`,
|
|
1474
|
+
this.config.debug && console.warn(`[runtime] Handler '${s}' not found on config for event '${o}'`, r);
|
|
1469
1475
|
}
|
|
1470
|
-
}),
|
|
1476
|
+
}), t = e.nextNode();
|
|
1471
1477
|
}
|
|
1472
1478
|
}
|
|
1473
1479
|
/**
|
|
1474
1480
|
* Renders a fallback error UI in the shadow root.
|
|
1475
1481
|
* @param error - Error object
|
|
1476
1482
|
*/
|
|
1477
|
-
renderError(
|
|
1478
|
-
const
|
|
1483
|
+
renderError(e) {
|
|
1484
|
+
const t = this.config.style ? typeof this.config.style == "function" ? this.config.style(this.api.state) : this.config.style : "";
|
|
1479
1485
|
this.shadowRoot.innerHTML = `
|
|
1480
|
-
<style>${
|
|
1486
|
+
<style>${t}</style>
|
|
1481
1487
|
<div style="color: red; border: 1px solid red; padding: 1rem; border-radius: 4px;">
|
|
1482
1488
|
<h3>Error Boundary</h3>
|
|
1483
|
-
<div>Error: ${
|
|
1489
|
+
<div>Error: ${e.message}</div>
|
|
1484
1490
|
</div>
|
|
1485
1491
|
`;
|
|
1486
1492
|
}
|
|
1487
1493
|
});
|
|
1488
|
-
function
|
|
1489
|
-
if (
|
|
1490
|
-
|
|
1491
|
-
state:
|
|
1494
|
+
function z(e, t) {
|
|
1495
|
+
if (t = _(t), t.debug && console.log(`[runtime] Debugging component: ${e}`, t), !e || !t.template) {
|
|
1496
|
+
t && typeof t.onError == "function" && t.onError(new Error("Component requires tag and template"), t.state ?? {}, {
|
|
1497
|
+
state: t.state ?? {},
|
|
1492
1498
|
emit: () => {
|
|
1493
1499
|
},
|
|
1494
1500
|
onGlobal: () => () => {
|
|
@@ -1497,15 +1503,15 @@ function it(t, e) {
|
|
|
1497
1503
|
},
|
|
1498
1504
|
emitGlobal: () => {
|
|
1499
1505
|
}
|
|
1500
|
-
}),
|
|
1506
|
+
}), t && t.debug && console.error("[runtime] Malformed config:", { tag: e, config: t });
|
|
1501
1507
|
return;
|
|
1502
1508
|
}
|
|
1503
|
-
if (
|
|
1509
|
+
if (A.forEach((u) => {
|
|
1504
1510
|
try {
|
|
1505
|
-
|
|
1506
|
-
} catch (
|
|
1507
|
-
|
|
1508
|
-
state:
|
|
1511
|
+
u.onInit?.(t);
|
|
1512
|
+
} catch (d) {
|
|
1513
|
+
t && typeof t.onError == "function" && t.onError(d instanceof Error ? d : new Error(String(d)), t.state, {
|
|
1514
|
+
state: t.state,
|
|
1509
1515
|
emit: () => {
|
|
1510
1516
|
},
|
|
1511
1517
|
onGlobal: () => () => {
|
|
@@ -1514,23 +1520,23 @@ function it(t, e) {
|
|
|
1514
1520
|
},
|
|
1515
1521
|
emitGlobal: () => {
|
|
1516
1522
|
}
|
|
1517
|
-
}),
|
|
1523
|
+
}), t && t.debug && console.error("[runtime] Plugin onInit error:", d);
|
|
1518
1524
|
}
|
|
1519
|
-
}), (typeof window < "u" && window.VITE_DEV_HMR || typeof import.meta < "u" && void 0) && customElements.get(
|
|
1525
|
+
}), (typeof window < "u" && window.VITE_DEV_HMR || typeof import.meta < "u" && void 0) && customElements.get(e))
|
|
1520
1526
|
try {
|
|
1521
|
-
document.querySelectorAll(
|
|
1527
|
+
document.querySelectorAll(e).forEach((u) => u.remove()), window.customElements._definitions && delete window.customElements._definitions[e];
|
|
1522
1528
|
} catch {
|
|
1523
1529
|
}
|
|
1524
|
-
if (customElements.get(
|
|
1525
|
-
|
|
1530
|
+
if (customElements.get(e)) {
|
|
1531
|
+
t.debug && console.warn(`[runtime] Component "${e}" already registered`);
|
|
1526
1532
|
return;
|
|
1527
1533
|
}
|
|
1528
|
-
const s =
|
|
1529
|
-
|
|
1530
|
-
const i =
|
|
1531
|
-
(
|
|
1534
|
+
const s = H(t.state ?? {}, t.computed);
|
|
1535
|
+
t.state = s, t._subscribe = s.subscribe;
|
|
1536
|
+
const i = t.state ?? {}, a = Object.keys(i).filter(
|
|
1537
|
+
(u) => ["string", "number", "boolean"].includes(typeof i[u])
|
|
1532
1538
|
);
|
|
1533
|
-
class c extends
|
|
1539
|
+
class c extends K {
|
|
1534
1540
|
static get observedAttributes() {
|
|
1535
1541
|
return a;
|
|
1536
1542
|
}
|
|
@@ -1539,47 +1545,128 @@ function it(t, e) {
|
|
|
1539
1545
|
}
|
|
1540
1546
|
}
|
|
1541
1547
|
const l = c;
|
|
1542
|
-
typeof customElements < "u" && !customElements.get(
|
|
1548
|
+
typeof customElements < "u" && !customElements.get(e) && (window.__componentRegistry = window.__componentRegistry || {}, window.__componentRegistry[e] = t, customElements.define(e, l));
|
|
1543
1549
|
}
|
|
1544
|
-
function yt(
|
|
1545
|
-
const
|
|
1546
|
-
return
|
|
1547
|
-
template: async (
|
|
1548
|
-
if (!
|
|
1549
|
-
const
|
|
1550
|
-
return
|
|
1550
|
+
function yt(e) {
|
|
1551
|
+
const t = at(e);
|
|
1552
|
+
return z("router-view", {
|
|
1553
|
+
template: async () => {
|
|
1554
|
+
if (!t) return "<div>Router not initialized.</div>";
|
|
1555
|
+
const r = t.getCurrent(), { path: n } = r, o = t.matchRoute(n);
|
|
1556
|
+
return o.route ? (o.route.load && await o.route.load(), `<${o.route.component}></${o.route.component}>`) : "<div>Not found</div>";
|
|
1557
|
+
},
|
|
1558
|
+
onMounted(r, n) {
|
|
1559
|
+
t && typeof t.subscribe == "function" && t.subscribe(() => {
|
|
1560
|
+
n.render();
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
}), z("router-link", {
|
|
1564
|
+
state: {
|
|
1565
|
+
to: "",
|
|
1566
|
+
tag: "a",
|
|
1567
|
+
replace: !1,
|
|
1568
|
+
exact: !1,
|
|
1569
|
+
activeClass: "active",
|
|
1570
|
+
exactActiveClass: "exact-active",
|
|
1571
|
+
ariaCurrentValue: "page",
|
|
1572
|
+
disabled: !1,
|
|
1573
|
+
external: !1,
|
|
1574
|
+
style: Y`
|
|
1575
|
+
[aria-disabled="true"] {
|
|
1576
|
+
pointer-events: none;
|
|
1577
|
+
opacity: 0.5;
|
|
1578
|
+
}
|
|
1579
|
+
`
|
|
1580
|
+
},
|
|
1581
|
+
computed: {
|
|
1582
|
+
current() {
|
|
1583
|
+
return t.getCurrent();
|
|
1584
|
+
},
|
|
1585
|
+
isExactActive(r) {
|
|
1586
|
+
return r.current.path === r.to;
|
|
1587
|
+
},
|
|
1588
|
+
isActive(r) {
|
|
1589
|
+
const n = r.current;
|
|
1590
|
+
return r.exact ? r.isExactActive : n && typeof n.path == "string" ? n.path.startsWith(r.to) : !1;
|
|
1591
|
+
},
|
|
1592
|
+
className(r) {
|
|
1593
|
+
return r.isExactActive ? r.exactActiveClass : r.isActive ? r.activeClass : "";
|
|
1594
|
+
},
|
|
1595
|
+
ariaCurrent(r) {
|
|
1596
|
+
return r.isExactActive ? `aria-current="${r.ariaCurrentValue}"` : "";
|
|
1597
|
+
},
|
|
1598
|
+
isButton(r) {
|
|
1599
|
+
return r.tag === "button";
|
|
1600
|
+
},
|
|
1601
|
+
disabledAttr(r) {
|
|
1602
|
+
return r.disabled ? r.isButton ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "";
|
|
1603
|
+
},
|
|
1604
|
+
externalAttr(r) {
|
|
1605
|
+
return r.external && (r.tag === "a" || !r.tag) ? 'target="_blank" rel="noopener noreferrer"' : "";
|
|
1606
|
+
}
|
|
1607
|
+
},
|
|
1608
|
+
reflect: ["to", "tag", "replace", "exact", "activeClass", "exactActiveClass", "ariaCurrentValue", "disabled", "external", "style"],
|
|
1609
|
+
style: (r) => r.style,
|
|
1610
|
+
template: (r) => T`
|
|
1611
|
+
${r.isButton ? T`
|
|
1612
|
+
<button
|
|
1613
|
+
part="button"
|
|
1614
|
+
class="${r.className}"
|
|
1615
|
+
${r.ariaCurrent}
|
|
1616
|
+
${r.disabledAttr}
|
|
1617
|
+
${r.externalAttr}
|
|
1618
|
+
data-on-click="navigate"
|
|
1619
|
+
><slot></slot></button>
|
|
1620
|
+
`(r) : T`
|
|
1621
|
+
<a
|
|
1622
|
+
part="link"
|
|
1623
|
+
href="${r.to}"
|
|
1624
|
+
class="${r.className}"
|
|
1625
|
+
${r.ariaCurrent}
|
|
1626
|
+
${r.disabledAttr}
|
|
1627
|
+
${r.externalAttr}
|
|
1628
|
+
data-on-click="navigate"
|
|
1629
|
+
><slot></slot></a>
|
|
1630
|
+
`(r)}
|
|
1631
|
+
`(r),
|
|
1632
|
+
navigate: (r, n) => {
|
|
1633
|
+
if (n.disabled) {
|
|
1634
|
+
r.preventDefault();
|
|
1635
|
+
return;
|
|
1636
|
+
}
|
|
1637
|
+
n.external && (n.tag === "a" || !n.tag) || (r.preventDefault(), n.replace ? t.replace(n.to) : t.push(n.to));
|
|
1551
1638
|
}
|
|
1552
|
-
}),
|
|
1639
|
+
}), t;
|
|
1553
1640
|
}
|
|
1554
1641
|
export {
|
|
1555
1642
|
j as Store,
|
|
1556
|
-
|
|
1557
|
-
|
|
1643
|
+
dt as classes,
|
|
1644
|
+
ut as compile,
|
|
1558
1645
|
ht as compileTemplate,
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1646
|
+
z as component,
|
|
1647
|
+
$ as createVNodeFromElement,
|
|
1648
|
+
Y as css,
|
|
1649
|
+
_ as deepSanitizeObject,
|
|
1563
1650
|
w as eventBus,
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1651
|
+
lt as generateHydrationScript,
|
|
1652
|
+
P as getVNodeKey,
|
|
1653
|
+
T as html,
|
|
1567
1654
|
yt as initRouter,
|
|
1568
1655
|
O as isPromise,
|
|
1569
1656
|
pt as matchRouteSSR,
|
|
1570
1657
|
g as mountVNode,
|
|
1571
|
-
|
|
1658
|
+
st as parseVNodeFromHTML,
|
|
1572
1659
|
M as patchVNode,
|
|
1573
1660
|
I as renderCompiledTemplate,
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1661
|
+
ct as renderComponentsToString,
|
|
1662
|
+
Z as renderToString,
|
|
1663
|
+
ot as resolveRouteComponent,
|
|
1664
|
+
A as runtimePlugins,
|
|
1665
|
+
q as safeReplaceChild,
|
|
1579
1666
|
ft as styles,
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1667
|
+
rt as updateCompiledTemplate,
|
|
1668
|
+
J as useDataModel,
|
|
1669
|
+
at as useRouter,
|
|
1583
1670
|
mt as useRuntimePlugin
|
|
1584
1671
|
};
|
|
1585
1672
|
//# sourceMappingURL=custom-elements-runtime.es.js.map
|