ladrillosjs 2.0.0-beta.2.2 → 2.0.0-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/core/main.d.ts +3 -1
- package/dist/index-DZgn4gH2.js +19 -0
- package/dist/index-DZgn4gH2.js.map +1 -0
- package/dist/index-DymB3-NG.mjs +554 -0
- package/dist/index-DymB3-NG.mjs.map +1 -0
- package/dist/index.d.ts +3 -6
- package/dist/ladrillosjs.cjs.js +1 -1
- package/dist/ladrillosjs.es.js +7 -7
- package/dist/ladrillosjs.umd.js +31 -20
- package/dist/ladrillosjs.umd.js.map +1 -1
- package/dist/types/LadrilloTypes.d.ts +7 -0
- package/dist/utils/devErrors.d.ts +60 -0
- package/dist/webcomponent-BQLjYvOH.js +79 -0
- package/dist/webcomponent-BQLjYvOH.js.map +1 -0
- package/dist/{webcomponent-UsabEy9d.mjs → webcomponent-DrCSyWrI.mjs} +322 -290
- package/dist/webcomponent-DrCSyWrI.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/index-CMmTngHq.js +0 -8
- package/dist/index-CMmTngHq.js.map +0 -1
- package/dist/index-CrzikOU3.mjs +0 -361
- package/dist/index-CrzikOU3.mjs.map +0 -1
- package/dist/webcomponent-BJpmLRdd.js +0 -79
- package/dist/webcomponent-BJpmLRdd.js.map +0 -1
- package/dist/webcomponent-UsabEy9d.mjs.map +0 -1
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
throw TypeError(
|
|
1
|
+
var ft = Object.defineProperty, ht = Object.defineProperties;
|
|
2
|
+
var pt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var K = Object.getOwnPropertySymbols;
|
|
4
|
+
var mt = Object.prototype.hasOwnProperty, bt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Y = (e) => {
|
|
6
|
+
throw TypeError(e);
|
|
7
7
|
};
|
|
8
|
-
var
|
|
9
|
-
for (var
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
for (var
|
|
13
|
-
|
|
14
|
-
return
|
|
15
|
-
},
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
8
|
+
var Q = (e, n, t) => n in e ? ft(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, O = (e, n) => {
|
|
9
|
+
for (var t in n || (n = {}))
|
|
10
|
+
mt.call(n, t) && Q(e, t, n[t]);
|
|
11
|
+
if (K)
|
|
12
|
+
for (var t of K(n))
|
|
13
|
+
bt.call(n, t) && Q(e, t, n[t]);
|
|
14
|
+
return e;
|
|
15
|
+
}, tt = (e, n) => ht(e, pt(n));
|
|
16
|
+
var U = (e, n, t) => n.has(e) || Y("Cannot " + t);
|
|
17
|
+
var A = (e, n, t) => (U(e, n, "read from private field"), t ? t.call(e) : n.get(e)), _ = (e, n, t) => n.has(e) ? Y("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(e) : n.set(e, t), M = (e, n, t, s) => (U(e, n, "write to private field"), s ? s.call(e, t) : n.set(e, t), t), W = (e, n, t) => (U(e, n, "access private method"), t);
|
|
18
|
+
var j = (e, n, t) => new Promise((s, o) => {
|
|
19
19
|
var i = (d) => {
|
|
20
20
|
try {
|
|
21
|
-
c(
|
|
21
|
+
c(t.next(d));
|
|
22
22
|
} catch (a) {
|
|
23
23
|
o(a);
|
|
24
24
|
}
|
|
25
25
|
}, r = (d) => {
|
|
26
26
|
try {
|
|
27
|
-
c(
|
|
27
|
+
c(t.throw(d));
|
|
28
28
|
} catch (a) {
|
|
29
29
|
o(a);
|
|
30
30
|
}
|
|
31
|
-
}, c = (d) => d.done ?
|
|
32
|
-
c((
|
|
31
|
+
}, c = (d) => d.done ? s(d.value) : Promise.resolve(d.value).then(i, r);
|
|
32
|
+
c((t = t.apply(e, n)).next());
|
|
33
33
|
});
|
|
34
|
-
import { R as
|
|
35
|
-
const
|
|
34
|
+
import { R as et, l as gt, a as X, c as R, b as Et, d as wt, e as $t, f as yt, g as vt, h as D, i as At } from "./index-DymB3-NG.mjs";
|
|
35
|
+
const xt = (e, n, t) => {
|
|
36
36
|
if (!n) return;
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
return { bindings:
|
|
43
|
-
},
|
|
44
|
-
const n = [],
|
|
45
|
-
if (!
|
|
46
|
-
const
|
|
47
|
-
return
|
|
37
|
+
const s = document.createElement("style");
|
|
38
|
+
s.textContent = n, t ? e.appendChild(s) : document.head.appendChild(s);
|
|
39
|
+
}, St = (e, n) => {
|
|
40
|
+
e.innerHTML = n;
|
|
41
|
+
const t = _t(e), s = Ct(e), o = Tt(e), i = Lt(e);
|
|
42
|
+
return { bindings: t, twoWayBindings: s, conditionals: o, loops: i };
|
|
43
|
+
}, nt = (e) => {
|
|
44
|
+
const n = [], t = e.match(/\((.*)\)/);
|
|
45
|
+
if (!t) return n;
|
|
46
|
+
const s = t[1].trim();
|
|
47
|
+
return s && s.split(",").map((i) => i.trim()).forEach((i) => {
|
|
48
48
|
if (/^['"]/.test(i) || /^\d+/.test(i)) return;
|
|
49
49
|
const r = i.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)/);
|
|
50
50
|
r && n.push(r[1]);
|
|
51
51
|
}), n;
|
|
52
|
-
},
|
|
53
|
-
const n = document.createTreeWalker(
|
|
54
|
-
let
|
|
52
|
+
}, _t = (e) => {
|
|
53
|
+
const n = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, null), t = [];
|
|
54
|
+
let s;
|
|
55
55
|
const o = (r) => {
|
|
56
56
|
let c = r.parentElement;
|
|
57
57
|
for (; c; ) {
|
|
@@ -61,38 +61,38 @@ const bt = (t, n, s) => {
|
|
|
61
61
|
}
|
|
62
62
|
return !1;
|
|
63
63
|
};
|
|
64
|
-
for (;
|
|
65
|
-
if (o(
|
|
64
|
+
for (; s = n.nextNode(); ) {
|
|
65
|
+
if (o(s))
|
|
66
66
|
continue;
|
|
67
|
-
const r = [...
|
|
67
|
+
const r = [...s.textContent.matchAll(et.bindings)];
|
|
68
68
|
if (r.length > 0) {
|
|
69
|
-
const c =
|
|
69
|
+
const c = s.textContent, d = r.map((a) => {
|
|
70
70
|
const l = a[1].trim(), u = l.includes("(") && l.includes(")"), f = /[+*/%<>=!&|]/.test(l) || // Math or logical operators (excluding hyphen)
|
|
71
71
|
/\s-\s/.test(l), p = /^(!|typeof\s|void\s|delete\s)/.test(l), E = f || p || // Expressions starting with operators
|
|
72
72
|
/\.(?![\s}])[a-zA-Z_$][\w]*\(/.test(l) || // Method calls like name.toLowerCase()
|
|
73
73
|
/\bnew\s+/.test(l) || // Object instantiation like new Date()
|
|
74
|
-
/\b(typeof|instanceof|void|delete)\b/.test(l), m = u ? [l.split("(")[0].trim()] : l.split(".").map((C) => C.trim()), b = u ?
|
|
74
|
+
/\b(typeof|instanceof|void|delete)\b/.test(l), m = u ? [l.split("(")[0].trim()] : l.split(".").map((C) => C.trim()), b = u ? nt(l) : [];
|
|
75
75
|
return { raw: l, path: m, isFunction: u, isExpression: E, functionArgs: b };
|
|
76
76
|
});
|
|
77
|
-
|
|
77
|
+
t.push({ node: s, bindings: d, original: c });
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return e.querySelectorAll("*").forEach((r) => {
|
|
81
81
|
if (!(r.hasAttribute("$for") || o(r)))
|
|
82
82
|
for (const c of r.attributes) {
|
|
83
83
|
if (c.name === "$if" || c.name === "$else-if" || c.name === "$else" || c.name === "$bind")
|
|
84
84
|
continue;
|
|
85
|
-
const d = [...c.value.matchAll(
|
|
85
|
+
const d = [...c.value.matchAll(et.bindings)];
|
|
86
86
|
if (d.length > 0) {
|
|
87
87
|
const a = c.value, l = d.map((u) => {
|
|
88
88
|
const f = u[1].trim(), p = f.includes("(") && f.includes(")"), E = /[+*/%<>=!&|]/.test(f) || // Math or logical operators (excluding hyphen)
|
|
89
89
|
/\s-\s/.test(f), m = /^(!|typeof\s|void\s|delete\s)/.test(f), b = E || m || // Expressions starting with operators
|
|
90
90
|
/\.(?![\s}])[a-zA-Z_$][\w]*\(/.test(f) || // Method calls like name.toLowerCase()
|
|
91
91
|
/\bnew\s+/.test(f) || // Object instantiation like new Date()
|
|
92
|
-
/\b(typeof|instanceof|void|delete)\b/.test(f), C = p ? [f.split("(")[0].trim()] : f.split(".").map((
|
|
93
|
-
return { raw: f, path: C, isFunction: p, isExpression: b, functionArgs:
|
|
92
|
+
/\b(typeof|instanceof|void|delete)\b/.test(f), C = p ? [f.split("(")[0].trim()] : f.split(".").map((z) => z.trim()), N = p ? nt(f) : [];
|
|
93
|
+
return { raw: f, path: C, isFunction: p, isExpression: b, functionArgs: N };
|
|
94
94
|
});
|
|
95
|
-
|
|
95
|
+
t.push({
|
|
96
96
|
node: r,
|
|
97
97
|
bindings: l,
|
|
98
98
|
original: a,
|
|
@@ -101,43 +101,43 @@ const bt = (t, n, s) => {
|
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
}),
|
|
105
|
-
},
|
|
104
|
+
}), t;
|
|
105
|
+
}, Ct = (e) => {
|
|
106
106
|
const n = [];
|
|
107
|
-
return
|
|
107
|
+
return e.querySelectorAll("[\\$bind]").forEach((s) => {
|
|
108
108
|
var c;
|
|
109
|
-
const o =
|
|
109
|
+
const o = s.getAttribute("$bind");
|
|
110
110
|
if (!o) return;
|
|
111
111
|
const i = o.trim(), r = i.split(".").map((d) => d.trim());
|
|
112
|
-
|
|
113
|
-
element:
|
|
112
|
+
s instanceof HTMLInputElement || s instanceof HTMLTextAreaElement || s instanceof HTMLSelectElement ? (n.push({
|
|
113
|
+
element: s,
|
|
114
114
|
path: r,
|
|
115
115
|
raw: i,
|
|
116
116
|
isContentEditable: !1,
|
|
117
|
-
initialValue:
|
|
118
|
-
}),
|
|
119
|
-
element:
|
|
117
|
+
initialValue: s.value || ""
|
|
118
|
+
}), s.removeAttribute("$bind")) : s instanceof HTMLElement && s.hasAttribute("contenteditable") && (n.push({
|
|
119
|
+
element: s,
|
|
120
120
|
path: r,
|
|
121
121
|
raw: i,
|
|
122
122
|
isContentEditable: !0,
|
|
123
|
-
initialValue: ((c =
|
|
124
|
-
}),
|
|
123
|
+
initialValue: ((c = s.textContent) == null ? void 0 : c.trim()) || ""
|
|
124
|
+
}), s.removeAttribute("$bind"));
|
|
125
125
|
}), n;
|
|
126
|
-
},
|
|
127
|
-
const n = [],
|
|
128
|
-
return
|
|
129
|
-
if (
|
|
126
|
+
}, Tt = (e) => {
|
|
127
|
+
const n = [], t = /* @__PURE__ */ new Set();
|
|
128
|
+
return e.querySelectorAll("[\\$if]").forEach((o) => {
|
|
129
|
+
if (t.has(o)) return;
|
|
130
130
|
const i = [];
|
|
131
131
|
let r = o;
|
|
132
132
|
for (; r; ) {
|
|
133
133
|
const c = r.hasAttribute("$if"), d = r.hasAttribute("$else-if"), a = r.hasAttribute("$else");
|
|
134
134
|
if (!c && !d && !a) break;
|
|
135
|
-
|
|
135
|
+
t.add(r);
|
|
136
136
|
let l, u = "";
|
|
137
137
|
c ? (l = "if", u = r.getAttribute("$if") || "", r.removeAttribute("$if")) : d ? (l = "else-if", u = r.getAttribute("$else-if") || "", r.removeAttribute("$else-if")) : (l = "else", r.removeAttribute("$else"));
|
|
138
138
|
const f = document.createComment(
|
|
139
139
|
`conditional:${l}:${u}`
|
|
140
|
-
), p = r.parentElement ||
|
|
140
|
+
), p = r.parentElement || e, E = r.nextSibling;
|
|
141
141
|
p.insertBefore(f, r);
|
|
142
142
|
const m = {
|
|
143
143
|
element: r,
|
|
@@ -158,11 +158,11 @@ const bt = (t, n, s) => {
|
|
|
158
158
|
c.group = i;
|
|
159
159
|
}), n.push(i);
|
|
160
160
|
}), n;
|
|
161
|
-
},
|
|
161
|
+
}, kt = (e) => {
|
|
162
162
|
const n = /* @__PURE__ */ new Set();
|
|
163
|
-
return
|
|
164
|
-
|
|
165
|
-
let o =
|
|
163
|
+
return e.forEach((t) => {
|
|
164
|
+
t.forEach((s) => {
|
|
165
|
+
let o = s.condition;
|
|
166
166
|
o = o.replace(/\{([^}]+)\}/g, "$1");
|
|
167
167
|
const i = /\b([a-zA-Z_$][a-zA-Z0-9_$]*(?:\.[a-zA-Z_$][a-zA-Z0-9_$]*)*)\b/g, r = /* @__PURE__ */ new Set([
|
|
168
168
|
"true",
|
|
@@ -190,23 +190,26 @@ const bt = (t, n, s) => {
|
|
|
190
190
|
}
|
|
191
191
|
});
|
|
192
192
|
}), n;
|
|
193
|
-
},
|
|
193
|
+
}, Lt = (e) => {
|
|
194
194
|
const n = [];
|
|
195
|
-
return
|
|
195
|
+
return e.querySelectorAll("[\\$for]").forEach((s) => {
|
|
196
196
|
var p;
|
|
197
|
-
const o =
|
|
197
|
+
const o = s.getAttribute("$for");
|
|
198
198
|
if (!o) return;
|
|
199
|
-
const i =
|
|
199
|
+
const i = s.getAttribute("$key") || void 0, r = o.match(
|
|
200
200
|
/^\s*(?:\(([^,]+),\s*([^)]+)\)|([^\s]+))\s+(?:in|of)\s+(.+)\s*$/
|
|
201
201
|
);
|
|
202
202
|
if (!r) {
|
|
203
|
-
|
|
203
|
+
gt(`Invalid $for expression: "${o}"`, {
|
|
204
|
+
expression: o,
|
|
205
|
+
lineHint: "$for attribute parsing"
|
|
206
|
+
});
|
|
204
207
|
return;
|
|
205
208
|
}
|
|
206
|
-
const c = (r[1] || r[3]).trim(), d = (p = r[2]) == null ? void 0 : p.trim(), a = r[4].trim(), l = document.createComment(`loop:${o}`), u =
|
|
207
|
-
u.insertBefore(l,
|
|
209
|
+
const c = (r[1] || r[3]).trim(), d = (p = r[2]) == null ? void 0 : p.trim(), a = r[4].trim(), l = document.createComment(`loop:${o}`), u = s.parentElement || e;
|
|
210
|
+
u.insertBefore(l, s), s.removeAttribute("$for"), i && s.removeAttribute("$key"), s.remove();
|
|
208
211
|
const f = {
|
|
209
|
-
template:
|
|
212
|
+
template: s,
|
|
210
213
|
expression: o,
|
|
211
214
|
itemName: c,
|
|
212
215
|
indexName: d,
|
|
@@ -218,53 +221,53 @@ const bt = (t, n, s) => {
|
|
|
218
221
|
};
|
|
219
222
|
n.push(f);
|
|
220
223
|
}), n;
|
|
221
|
-
},
|
|
224
|
+
}, Rt = (e) => {
|
|
222
225
|
const n = /* @__PURE__ */ new Set();
|
|
223
|
-
return
|
|
224
|
-
const
|
|
225
|
-
n.add(
|
|
226
|
+
return e.forEach((t) => {
|
|
227
|
+
const s = t.arrayName.split(".")[0];
|
|
228
|
+
n.add(s);
|
|
226
229
|
}), n;
|
|
227
|
-
},
|
|
228
|
-
const n =
|
|
230
|
+
}, F = /* @__PURE__ */ new Map(), Nt = 100, J = (e) => {
|
|
231
|
+
const n = F.get(e);
|
|
229
232
|
if (n)
|
|
230
|
-
return
|
|
231
|
-
const
|
|
233
|
+
return F.delete(e), F.set(e, n), n;
|
|
234
|
+
const t = new Function(
|
|
232
235
|
"component",
|
|
233
236
|
`
|
|
234
237
|
const { Date, Array, Math, String, Number, Boolean, Object, JSON, RegExp } = globalThis;
|
|
235
238
|
with(component) {
|
|
236
|
-
return ${
|
|
239
|
+
return ${e};
|
|
237
240
|
}
|
|
238
241
|
`
|
|
239
242
|
);
|
|
240
|
-
if (
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
+
if (F.size >= Nt) {
|
|
244
|
+
const s = F.keys().next().value;
|
|
245
|
+
s && F.delete(s);
|
|
243
246
|
}
|
|
244
|
-
return
|
|
245
|
-
},
|
|
246
|
-
if (!(
|
|
247
|
-
return s
|
|
248
|
-
},
|
|
247
|
+
return F.set(e, t), t;
|
|
248
|
+
}, q = (e, n) => n.reduce((t, s) => {
|
|
249
|
+
if (!(t == null || typeof t != "object"))
|
|
250
|
+
return t[s];
|
|
251
|
+
}, e), Z = (e, n, t) => {
|
|
249
252
|
if (n.length === 0) return;
|
|
250
|
-
const
|
|
251
|
-
let i =
|
|
253
|
+
const s = n[n.length - 1], o = n.slice(0, -1);
|
|
254
|
+
let i = e;
|
|
252
255
|
for (const r of o)
|
|
253
256
|
(i[r] === void 0 || i[r] === null) && (i[r] = {}), i = i[r];
|
|
254
|
-
i[
|
|
255
|
-
},
|
|
256
|
-
for (const
|
|
257
|
-
let o =
|
|
258
|
-
for (const { raw: c, path: d, isFunction: a, isExpression: l } of
|
|
257
|
+
i[s] = t;
|
|
258
|
+
}, st = (e, n, t) => {
|
|
259
|
+
for (const s of e) {
|
|
260
|
+
let o = s.original, i, r = !1;
|
|
261
|
+
for (const { raw: c, path: d, isFunction: a, isExpression: l } of s.bindings) {
|
|
259
262
|
let u, f = !1;
|
|
260
263
|
if (l || a)
|
|
261
264
|
try {
|
|
262
|
-
u =
|
|
265
|
+
u = J(c)(t || n);
|
|
263
266
|
} catch (E) {
|
|
264
|
-
|
|
267
|
+
X(c, E, R(t)), u = void 0, f = !0;
|
|
265
268
|
}
|
|
266
269
|
else
|
|
267
|
-
u =
|
|
270
|
+
u = q(n, d), u === void 0 && (f = !0);
|
|
268
271
|
if (f) {
|
|
269
272
|
r = !0;
|
|
270
273
|
continue;
|
|
@@ -272,12 +275,12 @@ const bt = (t, n, s) => {
|
|
|
272
275
|
const p = String(u != null ? u : "");
|
|
273
276
|
i = u, o = o.replace(`{${c}}`, p);
|
|
274
277
|
}
|
|
275
|
-
if (r &&
|
|
276
|
-
const c =
|
|
278
|
+
if (r && s.original, s.node.nodeType === Node.TEXT_NODE) {
|
|
279
|
+
const c = s.node, d = c.parentElement, a = o.trim().startsWith("<") && o.includes(">");
|
|
277
280
|
d && a ? d.innerHTML = o : c.textContent = o;
|
|
278
281
|
} else {
|
|
279
|
-
const c =
|
|
280
|
-
|
|
282
|
+
const c = s.node;
|
|
283
|
+
s.isAttribute && s.attributeName && ([
|
|
281
284
|
"disabled",
|
|
282
285
|
"checked",
|
|
283
286
|
"readonly",
|
|
@@ -290,13 +293,13 @@ const bt = (t, n, s) => {
|
|
|
290
293
|
"controls",
|
|
291
294
|
"loop",
|
|
292
295
|
"muted"
|
|
293
|
-
].includes(
|
|
296
|
+
].includes(s.attributeName.toLowerCase()) ? (typeof i == "boolean" ? i : i === "true" || i === "True") ? c.setAttribute(s.attributeName, "") : c.removeAttribute(s.attributeName) : c.setAttribute(s.attributeName, o));
|
|
294
297
|
}
|
|
295
298
|
}
|
|
296
|
-
},
|
|
297
|
-
if (!
|
|
298
|
-
let
|
|
299
|
-
|
|
299
|
+
}, Vt = (e, n, t) => {
|
|
300
|
+
if (!e) return !0;
|
|
301
|
+
let s = e.trim();
|
|
302
|
+
s = s.replace(/\{([^}]+)\}/g, "$1");
|
|
300
303
|
try {
|
|
301
304
|
return new Function(
|
|
302
305
|
"context",
|
|
@@ -304,18 +307,22 @@ const bt = (t, n, s) => {
|
|
|
304
307
|
`
|
|
305
308
|
with (context) {
|
|
306
309
|
try {
|
|
307
|
-
return Boolean(${
|
|
310
|
+
return Boolean(${s});
|
|
308
311
|
} catch (e) {
|
|
309
312
|
return false;
|
|
310
313
|
}
|
|
311
314
|
}
|
|
312
315
|
`
|
|
313
|
-
)(n,
|
|
316
|
+
)(n, t);
|
|
314
317
|
} catch (o) {
|
|
315
|
-
return
|
|
318
|
+
return wt(
|
|
319
|
+
e,
|
|
320
|
+
o,
|
|
321
|
+
R(t)
|
|
322
|
+
), !1;
|
|
316
323
|
}
|
|
317
|
-
},
|
|
318
|
-
const
|
|
324
|
+
}, it = (e, n) => {
|
|
325
|
+
const t = [
|
|
319
326
|
"click",
|
|
320
327
|
"dblclick",
|
|
321
328
|
"mousedown",
|
|
@@ -350,8 +357,8 @@ const bt = (t, n, s) => {
|
|
|
350
357
|
"dragleave",
|
|
351
358
|
"drop"
|
|
352
359
|
];
|
|
353
|
-
[
|
|
354
|
-
|
|
360
|
+
[e, ...e.querySelectorAll("*")].forEach((o) => {
|
|
361
|
+
t.forEach((i) => {
|
|
355
362
|
const r = `on${i}`, c = o.getAttribute(r);
|
|
356
363
|
if (c) {
|
|
357
364
|
const d = `__processed_${r}`;
|
|
@@ -370,10 +377,13 @@ const bt = (t, n, s) => {
|
|
|
370
377
|
`
|
|
371
378
|
).call(this, a, n);
|
|
372
379
|
} catch (l) {
|
|
373
|
-
|
|
374
|
-
|
|
380
|
+
$t(
|
|
381
|
+
i,
|
|
382
|
+
c,
|
|
375
383
|
l,
|
|
376
|
-
|
|
384
|
+
R(n, {
|
|
385
|
+
elementTag: o.tagName.toLowerCase()
|
|
386
|
+
})
|
|
377
387
|
);
|
|
378
388
|
}
|
|
379
389
|
}
|
|
@@ -381,20 +391,20 @@ const bt = (t, n, s) => {
|
|
|
381
391
|
}
|
|
382
392
|
});
|
|
383
393
|
});
|
|
384
|
-
},
|
|
385
|
-
var
|
|
386
|
-
for (const o of
|
|
394
|
+
}, ot = (e, n, t) => {
|
|
395
|
+
var s;
|
|
396
|
+
for (const o of e) {
|
|
387
397
|
let i = !1;
|
|
388
398
|
for (const r of o) {
|
|
389
399
|
const { element: c, condition: d, type: a, placeholder: l, originalParent: u } = r;
|
|
390
400
|
let f = !1;
|
|
391
|
-
a === "else" ? f = !i : i || (f =
|
|
401
|
+
a === "else" ? f = !i : i || (f = Vt(d, n, t), f && (i = !0));
|
|
392
402
|
const p = c.parentNode !== null;
|
|
393
|
-
f && !p ? ((
|
|
403
|
+
f && !p ? ((s = l.parentNode) == null || s.insertBefore(c, l.nextSibling), t && it(c, t)) : !f && p && c.remove();
|
|
394
404
|
}
|
|
395
405
|
}
|
|
396
|
-
},
|
|
397
|
-
for (const
|
|
406
|
+
}, rt = (e, n, t) => {
|
|
407
|
+
for (const s of e) {
|
|
398
408
|
const {
|
|
399
409
|
template: o,
|
|
400
410
|
itemName: i,
|
|
@@ -402,27 +412,33 @@ const bt = (t, n, s) => {
|
|
|
402
412
|
arrayName: c,
|
|
403
413
|
placeholder: d,
|
|
404
414
|
renderedElements: a
|
|
405
|
-
} =
|
|
415
|
+
} = s, l = q(n, c.split("."));
|
|
406
416
|
if (l !== void 0 && !Array.isArray(l)) {
|
|
407
|
-
|
|
417
|
+
Et(
|
|
418
|
+
`${i} in ${c}`,
|
|
419
|
+
new Error(`"${c}" is not an array, got: ${typeof l}`),
|
|
420
|
+
R(t, {
|
|
421
|
+
lineHint: "$for loop in template"
|
|
422
|
+
})
|
|
423
|
+
), a.forEach((u) => u.remove()), a.length = 0;
|
|
408
424
|
return;
|
|
409
425
|
}
|
|
410
426
|
if (!l)
|
|
411
427
|
return;
|
|
412
428
|
a.forEach((u) => u.remove()), a.length = 0, l.forEach((u, f) => {
|
|
413
429
|
var b;
|
|
414
|
-
const p = o.cloneNode(!0), E =
|
|
430
|
+
const p = o.cloneNode(!0), E = tt(O({}, n), {
|
|
415
431
|
[i]: u
|
|
416
432
|
});
|
|
417
|
-
r && (E[r] = f),
|
|
433
|
+
r && (E[r] = f), Bt(p, E, t);
|
|
418
434
|
const m = a.length > 0 ? a[a.length - 1] : d;
|
|
419
|
-
(b = m.parentNode) == null || b.insertBefore(p, m.nextSibling), a.push(p),
|
|
435
|
+
(b = m.parentNode) == null || b.insertBefore(p, m.nextSibling), a.push(p), t && it(p, t);
|
|
420
436
|
});
|
|
421
437
|
}
|
|
422
|
-
},
|
|
423
|
-
const
|
|
438
|
+
}, Bt = (e, n, t) => {
|
|
439
|
+
const s = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, null);
|
|
424
440
|
let o;
|
|
425
|
-
for (; o =
|
|
441
|
+
for (; o = s.nextNode(); )
|
|
426
442
|
if (o.textContent && o.textContent.includes("{")) {
|
|
427
443
|
let r = o.textContent;
|
|
428
444
|
[...o.textContent.matchAll(/\{([^}]+)\}/g)].forEach((d) => {
|
|
@@ -432,22 +448,25 @@ const bt = (t, n, s) => {
|
|
|
432
448
|
let p;
|
|
433
449
|
if (f || l)
|
|
434
450
|
try {
|
|
435
|
-
const E =
|
|
451
|
+
const E = J(a), m = typeof n == "object" && n !== null ? O(O({}, n), t || {}) : t || {};
|
|
436
452
|
p = E(m);
|
|
437
453
|
} catch (E) {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
E
|
|
454
|
+
X(
|
|
455
|
+
a,
|
|
456
|
+
E,
|
|
457
|
+
R(t, {
|
|
458
|
+
lineHint: "$for loop template binding"
|
|
459
|
+
})
|
|
441
460
|
), p = void 0;
|
|
442
461
|
}
|
|
443
462
|
else {
|
|
444
463
|
const E = a.split(".").map((m) => m.trim());
|
|
445
|
-
p =
|
|
464
|
+
p = q(n, E);
|
|
446
465
|
}
|
|
447
466
|
p !== void 0 && (r = r.replace(`{${a}}`, String(p != null ? p : "")));
|
|
448
467
|
}), o.textContent = r;
|
|
449
468
|
}
|
|
450
|
-
[
|
|
469
|
+
[e, ...e.querySelectorAll("*")].forEach((r) => {
|
|
451
470
|
Array.from(r.attributes).forEach((c) => {
|
|
452
471
|
if (c.value.includes("{")) {
|
|
453
472
|
let d = c.value;
|
|
@@ -458,32 +477,36 @@ const bt = (t, n, s) => {
|
|
|
458
477
|
let m;
|
|
459
478
|
if (E || f)
|
|
460
479
|
try {
|
|
461
|
-
const b =
|
|
480
|
+
const b = J(u), C = typeof n == "object" && n !== null ? O(O({}, n), t || {}) : t || {};
|
|
462
481
|
m = b(C);
|
|
463
482
|
} catch (b) {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
b
|
|
483
|
+
X(
|
|
484
|
+
u,
|
|
485
|
+
b,
|
|
486
|
+
R(t, {
|
|
487
|
+
attributeName: c.name,
|
|
488
|
+
lineHint: "$for loop attribute binding"
|
|
489
|
+
})
|
|
467
490
|
), m = void 0;
|
|
468
491
|
}
|
|
469
492
|
else {
|
|
470
493
|
const b = u.split(".").map((C) => C.trim());
|
|
471
|
-
m =
|
|
494
|
+
m = q(n, b);
|
|
472
495
|
}
|
|
473
496
|
m !== void 0 && (d = d.replace(`{${u}}`, String(m != null ? m : "")));
|
|
474
497
|
}), r.setAttribute(c.name, d);
|
|
475
498
|
}
|
|
476
499
|
});
|
|
477
500
|
});
|
|
478
|
-
},
|
|
479
|
-
const
|
|
501
|
+
}, ct = (e) => e instanceof ShadowRoot ? e.host : e, Ft = (e, n) => {
|
|
502
|
+
const t = /* @__PURE__ */ new Set();
|
|
480
503
|
n.forEach(({ path: o }) => {
|
|
481
504
|
const i = o[0];
|
|
482
|
-
|
|
505
|
+
t.add(i);
|
|
483
506
|
});
|
|
484
|
-
const
|
|
485
|
-
return
|
|
486
|
-
|
|
507
|
+
const s = [];
|
|
508
|
+
return t.forEach((o) => {
|
|
509
|
+
s.push(`
|
|
487
510
|
if (!Object.getOwnPropertyDescriptor(component, '${o}')) {
|
|
488
511
|
Object.defineProperty(component, '${o}', {
|
|
489
512
|
get() { return this.state.${o}; },
|
|
@@ -496,12 +519,12 @@ const bt = (t, n, s) => {
|
|
|
496
519
|
}), {
|
|
497
520
|
injectedCode: "",
|
|
498
521
|
// No longer needed in script scope
|
|
499
|
-
componentInjections:
|
|
522
|
+
componentInjections: s.join(`
|
|
500
523
|
`),
|
|
501
|
-
bindVarNames:
|
|
524
|
+
bindVarNames: t
|
|
502
525
|
};
|
|
503
|
-
},
|
|
504
|
-
const
|
|
526
|
+
}, Ot = (e, n, t = /* @__PURE__ */ new Set()) => {
|
|
527
|
+
const s = [], o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
|
|
505
528
|
n.forEach((d) => {
|
|
506
529
|
d.bindings.forEach((a) => {
|
|
507
530
|
const l = a.path[0];
|
|
@@ -509,97 +532,97 @@ const bt = (t, n, s) => {
|
|
|
509
532
|
i.add(u);
|
|
510
533
|
});
|
|
511
534
|
});
|
|
512
|
-
}),
|
|
535
|
+
}), t.forEach((d) => {
|
|
513
536
|
i.add(d);
|
|
514
537
|
});
|
|
515
538
|
const r = /(?:const|let|var)\s+(\w+)\s*=\s*([^;]+);?/g;
|
|
516
539
|
let c;
|
|
517
|
-
for (; (c = r.exec(
|
|
540
|
+
for (; (c = r.exec(e)) !== null; ) {
|
|
518
541
|
const d = c[1], a = c[2].trim();
|
|
519
|
-
i.has(d) && (
|
|
542
|
+
i.has(d) && (s.push(`component.state.${d} = ${d};`), o.set(d, a));
|
|
520
543
|
}
|
|
521
|
-
return { stateBindings:
|
|
522
|
-
},
|
|
523
|
-
if (n.size === 0) return
|
|
524
|
-
let
|
|
525
|
-
return n.forEach((
|
|
544
|
+
return { stateBindings: s, boundVarNames: i, defaultValues: o };
|
|
545
|
+
}, Mt = (e, n) => {
|
|
546
|
+
if (n.size === 0) return e;
|
|
547
|
+
let t = e;
|
|
548
|
+
return n.forEach((s) => {
|
|
526
549
|
const o = new RegExp(
|
|
527
|
-
`\\b${
|
|
550
|
+
`\\b${s}((?:\\[[^\\]]+\\])(?:\\.[\\w]+|\\[[^\\]]+\\])*)\\s*([=+\\-*/%&|^]|\\+\\+|\\-\\-)`,
|
|
528
551
|
"g"
|
|
529
552
|
);
|
|
530
|
-
|
|
553
|
+
t = t.replace(
|
|
531
554
|
o,
|
|
532
|
-
`component.state.${
|
|
555
|
+
`component.state.${s}$1 $2`
|
|
533
556
|
);
|
|
534
557
|
const i = new RegExp(
|
|
535
|
-
`(?<!component\\.state\\.)\\b${
|
|
558
|
+
`(?<!component\\.state\\.)\\b${s}((?:\\[[^\\]]+\\])(?:\\.[\\w]+|\\[[^\\]]+\\])*)(?![=+\\-*/%&|^]|\\+\\+|\\-\\-)`,
|
|
536
559
|
"g"
|
|
537
560
|
);
|
|
538
|
-
|
|
561
|
+
t = t.replace(
|
|
539
562
|
i,
|
|
540
|
-
`component.state.${
|
|
563
|
+
`component.state.${s}$1`
|
|
541
564
|
);
|
|
542
565
|
const r = new RegExp(
|
|
543
|
-
`\\b${
|
|
566
|
+
`\\b${s}\\.(\\w+(?:\\.\\w+)*)\\s*([=+\\-*/%&|^]|\\+\\+|\\-\\-)`,
|
|
544
567
|
"g"
|
|
545
568
|
);
|
|
546
|
-
|
|
569
|
+
t = t.replace(
|
|
547
570
|
r,
|
|
548
|
-
`component.state.${
|
|
571
|
+
`component.state.${s}.$1 $2`
|
|
549
572
|
);
|
|
550
573
|
const c = new RegExp(
|
|
551
|
-
`(?<!component\\.state\\.)(?<!const\\s${
|
|
574
|
+
`(?<!component\\.state\\.)(?<!const\\s${s}\\s*=\\s*{[^}]*)\\b${s}\\.(\\w+(?:\\.\\w+)*)(?![=+\\-*/%&|^]|\\+\\+|\\-\\-)`,
|
|
552
575
|
"g"
|
|
553
576
|
);
|
|
554
|
-
|
|
577
|
+
t = t.replace(
|
|
555
578
|
c,
|
|
556
|
-
`component.state.${
|
|
579
|
+
`component.state.${s}.$1`
|
|
557
580
|
);
|
|
558
581
|
const d = new RegExp(
|
|
559
|
-
`(?<!\\.)\\b(\\+\\+|\\-\\-)${
|
|
582
|
+
`(?<!\\.)\\b(\\+\\+|\\-\\-)${s}\\b|\\b${s}(\\+\\+|\\-\\-)`,
|
|
560
583
|
"g"
|
|
561
584
|
);
|
|
562
|
-
|
|
585
|
+
t = t.replace(d, (u) => {
|
|
563
586
|
if (u.startsWith("++") || u.startsWith("--"))
|
|
564
|
-
return `${u.substring(0, 2)}component.state.${
|
|
587
|
+
return `${u.substring(0, 2)}component.state.${s}`;
|
|
565
588
|
{
|
|
566
589
|
const f = u.substring(u.length - 2);
|
|
567
|
-
return `component.state.${
|
|
590
|
+
return `component.state.${s}${f}`;
|
|
568
591
|
}
|
|
569
592
|
});
|
|
570
593
|
const a = new RegExp(
|
|
571
|
-
`(?<!\\.)\\b${
|
|
594
|
+
`(?<!\\.)\\b${s}\\s*(\\+=|\\-=|\\*=|\\/=|%=|\\*\\*=|<<=|>>=|>>>=|&=|\\|=|\\^=)`,
|
|
572
595
|
"g"
|
|
573
596
|
);
|
|
574
|
-
|
|
597
|
+
t = t.replace(
|
|
575
598
|
a,
|
|
576
|
-
`component.state.${
|
|
599
|
+
`component.state.${s}$1`
|
|
577
600
|
);
|
|
578
601
|
const l = new RegExp(
|
|
579
|
-
`(?<!const\\s)(?<!let\\s)(?<!var\\s)(?<!\\.)\\b${
|
|
602
|
+
`(?<!const\\s)(?<!let\\s)(?<!var\\s)(?<!\\.)\\b${s}\\s*=\\s*([^=])`,
|
|
580
603
|
"g"
|
|
581
604
|
);
|
|
582
|
-
|
|
605
|
+
t = t.replace(
|
|
583
606
|
l,
|
|
584
|
-
`component.state.${
|
|
607
|
+
`component.state.${s} = $1`
|
|
585
608
|
);
|
|
586
|
-
}),
|
|
587
|
-
},
|
|
609
|
+
}), t;
|
|
610
|
+
}, at = (e, n, t, s, o, i = /* @__PURE__ */ new Set()) => {
|
|
588
611
|
try {
|
|
589
|
-
const { injectedCode: r, componentInjections: c, bindVarNames: d } =
|
|
612
|
+
const { injectedCode: r, componentInjections: c, bindVarNames: d } = Ft(e, t), a = /function\s+(\w+)|const\s+(\w+)\s*=\s*(?:\([^)]*\)|[\w\s]*)\s*=>/g, l = [];
|
|
590
613
|
let u;
|
|
591
|
-
for (; (u = a.exec(
|
|
614
|
+
for (; (u = a.exec(e)) !== null; ) {
|
|
592
615
|
const S = u[1] || u[2];
|
|
593
616
|
S && l.push(S);
|
|
594
617
|
}
|
|
595
618
|
const f = l.map(
|
|
596
619
|
(S) => `component.${S} = typeof ${S} !== 'undefined' ? ${S}.bind(component) : undefined;`
|
|
597
620
|
).join(`
|
|
598
|
-
`), { stateBindings: p, boundVarNames: E, defaultValues: m } =
|
|
599
|
-
`),
|
|
600
|
-
|
|
621
|
+
`), { stateBindings: p, boundVarNames: E, defaultValues: m } = Ot(e, n, i), b = /* @__PURE__ */ new Set([...E, ...d]), C = p.join(`
|
|
622
|
+
`), N = Mt(
|
|
623
|
+
e,
|
|
601
624
|
b
|
|
602
|
-
),
|
|
625
|
+
), z = `
|
|
603
626
|
(function() {
|
|
604
627
|
// Create component scope with direct access to state
|
|
605
628
|
const component = this;
|
|
@@ -634,7 +657,7 @@ const bt = (t, n, s) => {
|
|
|
634
657
|
|
|
635
658
|
// Execute script content within component scope so $bind variables are accessible
|
|
636
659
|
with(component) {
|
|
637
|
-
${
|
|
660
|
+
${N}
|
|
638
661
|
|
|
639
662
|
// Auto-bind variables to component state (e.g., const name = "value" → this.state.name = "value")
|
|
640
663
|
${C}
|
|
@@ -644,11 +667,11 @@ const bt = (t, n, s) => {
|
|
|
644
667
|
}
|
|
645
668
|
}).call(arguments[0], arguments[0], arguments[1], arguments[2])
|
|
646
669
|
`;
|
|
647
|
-
return new Function(
|
|
670
|
+
return new Function(z)(o, s, yt), m;
|
|
648
671
|
} catch (r) {
|
|
649
|
-
return
|
|
672
|
+
return vt(r, R(o)), /* @__PURE__ */ new Map();
|
|
650
673
|
}
|
|
651
|
-
},
|
|
674
|
+
}, lt = (e, n) => {
|
|
652
675
|
[
|
|
653
676
|
"click",
|
|
654
677
|
"dblclick",
|
|
@@ -683,14 +706,14 @@ const bt = (t, n, s) => {
|
|
|
683
706
|
"dragover",
|
|
684
707
|
"dragleave",
|
|
685
708
|
"drop"
|
|
686
|
-
].forEach((
|
|
687
|
-
const o = `on${
|
|
688
|
-
(
|
|
709
|
+
].forEach((s) => {
|
|
710
|
+
const o = `on${s}`;
|
|
711
|
+
(e instanceof ShadowRoot ? e.querySelectorAll(`[${o}]`) : n.querySelectorAll(`[${o}]`)).forEach((r) => {
|
|
689
712
|
const c = `${o}`;
|
|
690
713
|
if (r[`__processed_${c}`]) return;
|
|
691
714
|
const d = r.getAttribute(o);
|
|
692
715
|
d && (r.removeAttribute(o), r.addEventListener(
|
|
693
|
-
|
|
716
|
+
s,
|
|
694
717
|
function(a) {
|
|
695
718
|
new Function(
|
|
696
719
|
"event",
|
|
@@ -705,45 +728,45 @@ const bt = (t, n, s) => {
|
|
|
705
728
|
), r[`__processed_${c}`] = !0);
|
|
706
729
|
});
|
|
707
730
|
});
|
|
708
|
-
},
|
|
731
|
+
}, Wt = (i, r, c, ...d) => j(null, [i, r, c, ...d], function* (e, n, t, s = [], o = /* @__PURE__ */ new Set()) {
|
|
709
732
|
const a = /* @__PURE__ */ new Map();
|
|
710
733
|
if (!(n != null && n.length)) return a;
|
|
711
|
-
const l =
|
|
734
|
+
const l = ct(e);
|
|
712
735
|
for (const u of n)
|
|
713
|
-
u.content &&
|
|
736
|
+
u.content && at(
|
|
714
737
|
u.content,
|
|
738
|
+
t,
|
|
715
739
|
s,
|
|
716
740
|
e,
|
|
717
|
-
t,
|
|
718
741
|
l,
|
|
719
742
|
o
|
|
720
743
|
).forEach((p, E) => {
|
|
721
744
|
a.has(E) || a.set(E, p);
|
|
722
745
|
});
|
|
723
|
-
return
|
|
724
|
-
}),
|
|
746
|
+
return lt(e, l), a;
|
|
747
|
+
}), Ht = (e, n) => new Promise((t, s) => {
|
|
725
748
|
const o = document.querySelector(
|
|
726
|
-
`script[src="${
|
|
749
|
+
`script[src="${e}"]`
|
|
727
750
|
);
|
|
728
751
|
if (o) {
|
|
729
752
|
if (o.dataset.loaded === "true") {
|
|
730
|
-
|
|
753
|
+
t();
|
|
731
754
|
return;
|
|
732
755
|
}
|
|
733
|
-
o.addEventListener("load", () =>
|
|
756
|
+
o.addEventListener("load", () => t(), { once: !0 }), o.addEventListener(
|
|
734
757
|
"error",
|
|
735
|
-
() =>
|
|
758
|
+
() => s(new Error(`Failed to load external script: ${e}`)),
|
|
736
759
|
{ once: !0 }
|
|
737
760
|
);
|
|
738
761
|
return;
|
|
739
762
|
}
|
|
740
763
|
const i = document.createElement("script");
|
|
741
|
-
i.src =
|
|
742
|
-
i.dataset.loaded = "true",
|
|
743
|
-
}, i.onerror = () =>
|
|
744
|
-
}),
|
|
764
|
+
i.src = e, n && (i.type = n), i.onload = () => {
|
|
765
|
+
i.dataset.loaded = "true", t();
|
|
766
|
+
}, i.onerror = () => s(new Error(`Failed to load external script: ${e}`)), document.head.appendChild(i);
|
|
767
|
+
}), It = (r, c, d, ...a) => j(null, [r, c, d, ...a], function* (e, n, t, s = [], o = /* @__PURE__ */ new Set(), i) {
|
|
745
768
|
var u;
|
|
746
|
-
const l =
|
|
769
|
+
const l = ct(e);
|
|
747
770
|
for (const f of n) {
|
|
748
771
|
let p;
|
|
749
772
|
i ? i.startsWith("http://") || i.startsWith("https://") ? p = i : p = new URL(
|
|
@@ -752,12 +775,12 @@ const bt = (t, n, s) => {
|
|
|
752
775
|
).href : p = window.location.href;
|
|
753
776
|
const E = new URL(f.src, p).href;
|
|
754
777
|
if (f.external)
|
|
755
|
-
yield
|
|
778
|
+
yield Ht(E, f.type);
|
|
756
779
|
else if (f.type === "module") {
|
|
757
780
|
const m = l.tagName.toLowerCase();
|
|
758
781
|
window.__ladrilloContexts || (window.__ladrilloContexts = /* @__PURE__ */ new Map()), window.__ladrilloContexts.set(m, {
|
|
759
|
-
host:
|
|
760
|
-
shadowRoot:
|
|
782
|
+
host: e,
|
|
783
|
+
shadowRoot: e instanceof ShadowRoot ? e : null,
|
|
761
784
|
element: l,
|
|
762
785
|
state: l.state,
|
|
763
786
|
setState: (u = l.setState) == null ? void 0 : u.bind(l)
|
|
@@ -773,11 +796,11 @@ const bt = (t, n, s) => {
|
|
|
773
796
|
throw new Error(`Expected JavaScript but got ${b}`);
|
|
774
797
|
return m.text();
|
|
775
798
|
}).then((m) => {
|
|
776
|
-
|
|
799
|
+
at(
|
|
777
800
|
m,
|
|
801
|
+
t,
|
|
778
802
|
s,
|
|
779
803
|
e,
|
|
780
|
-
t,
|
|
781
804
|
l,
|
|
782
805
|
o
|
|
783
806
|
);
|
|
@@ -785,10 +808,10 @@ const bt = (t, n, s) => {
|
|
|
785
808
|
console.error(`Failed to load external script: ${f.src}`, m);
|
|
786
809
|
});
|
|
787
810
|
}
|
|
788
|
-
|
|
789
|
-
}),
|
|
790
|
-
var a, l, u, f, p, E, m, b,
|
|
791
|
-
const { tagName:
|
|
811
|
+
lt(e, l);
|
|
812
|
+
}), Ut = (e, n) => {
|
|
813
|
+
var a, l, u, f, p, E, m, b, G, N, ut, dt;
|
|
814
|
+
const { tagName: t, template: s, scripts: o, externalScripts: i, styles: r, sourcePath: c } = e, S = class S extends HTMLElement {
|
|
792
815
|
constructor() {
|
|
793
816
|
super();
|
|
794
817
|
_(this, b);
|
|
@@ -801,18 +824,18 @@ const bt = (t, n, s) => {
|
|
|
801
824
|
_(this, m, /* @__PURE__ */ new WeakMap());
|
|
802
825
|
n && this.attachShadow({ mode: "open" });
|
|
803
826
|
const h = {}, w = () => {
|
|
804
|
-
|
|
827
|
+
st(A(this, a), this.state, this), ot(A(this, u), this.state, this), rt(A(this, f), this.state, this), W(this, b, dt).call(this);
|
|
805
828
|
};
|
|
806
829
|
this.state = new Proxy(h, {
|
|
807
830
|
get: (y, g) => y[g],
|
|
808
831
|
set: (y, g, $) => {
|
|
809
|
-
const
|
|
810
|
-
return g in y && Object.is(
|
|
832
|
+
const x = y[g];
|
|
833
|
+
return g in y && Object.is(x, $) || ($ !== null && typeof $ == "object" ? y[g] = W(this, b, G).call(this, $, w) : y[g] = $, Object.getOwnPropertyDescriptor(this, g) || Object.defineProperty(this, g, {
|
|
811
834
|
get() {
|
|
812
835
|
return this.state[g];
|
|
813
836
|
},
|
|
814
|
-
set(
|
|
815
|
-
this.state[g] =
|
|
837
|
+
set(B) {
|
|
838
|
+
this.state[g] = B;
|
|
816
839
|
},
|
|
817
840
|
enumerable: !0,
|
|
818
841
|
configurable: !0
|
|
@@ -831,26 +854,26 @@ const bt = (t, n, s) => {
|
|
|
831
854
|
}
|
|
832
855
|
// Invoked when element is added to the DOM
|
|
833
856
|
connectedCallback() {
|
|
834
|
-
return
|
|
835
|
-
const h = n ? this.shadowRoot : this, { bindings: w, twoWayBindings: y, conditionals: g, loops: $ } =
|
|
857
|
+
return j(this, null, function* () {
|
|
858
|
+
const h = n ? this.shadowRoot : this, { bindings: w, twoWayBindings: y, conditionals: g, loops: $ } = St(
|
|
836
859
|
h,
|
|
837
|
-
|
|
860
|
+
s
|
|
838
861
|
);
|
|
839
|
-
|
|
840
|
-
const
|
|
841
|
-
|
|
862
|
+
M(this, a, w), M(this, l, y), M(this, u, g), M(this, f, $);
|
|
863
|
+
const x = kt(g), T = Rt($);
|
|
864
|
+
xt(h, r, n), yield It(
|
|
842
865
|
h,
|
|
843
866
|
i,
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
/* @__PURE__ */ new Set([...
|
|
847
|
-
|
|
848
|
-
), (yield
|
|
867
|
+
A(this, a),
|
|
868
|
+
A(this, l),
|
|
869
|
+
/* @__PURE__ */ new Set([...x, ...T]),
|
|
870
|
+
A(this, E)
|
|
871
|
+
), (yield Wt(
|
|
849
872
|
h,
|
|
850
873
|
o,
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
/* @__PURE__ */ new Set([...
|
|
874
|
+
A(this, a),
|
|
875
|
+
A(this, l),
|
|
876
|
+
/* @__PURE__ */ new Set([...x, ...T])
|
|
854
877
|
)).forEach((v, V) => {
|
|
855
878
|
if (this.state[V] === void 0)
|
|
856
879
|
try {
|
|
@@ -859,24 +882,33 @@ const bt = (t, n, s) => {
|
|
|
859
882
|
} catch (k) {
|
|
860
883
|
this.state[V] = v;
|
|
861
884
|
}
|
|
862
|
-
}), this._initializeStateFromAttributes(), this._setupTwoWayBindings(),
|
|
885
|
+
}), this._initializeStateFromAttributes(), this._setupTwoWayBindings(), st(A(this, a), this.state, this), ot(A(this, u), this.state, this), rt(A(this, f), this.state, this), this._setupAttributeObserver();
|
|
863
886
|
});
|
|
864
887
|
}
|
|
865
888
|
// Invoked when element is removed from the DOM
|
|
866
889
|
disconnectedCallback() {
|
|
867
|
-
this.__attributeObserver && (this.__attributeObserver.disconnect(), this.__attributeObserver = null),
|
|
890
|
+
this.__attributeObserver && (this.__attributeObserver.disconnect(), this.__attributeObserver = null), A(this, p).forEach((w) => {
|
|
868
891
|
try {
|
|
869
892
|
w();
|
|
870
893
|
} catch (y) {
|
|
871
|
-
|
|
894
|
+
At(
|
|
895
|
+
"cleanup",
|
|
896
|
+
y,
|
|
897
|
+
R(this, {
|
|
898
|
+
lineHint: "disconnectedCallback cleanup"
|
|
899
|
+
})
|
|
900
|
+
);
|
|
872
901
|
}
|
|
873
|
-
}),
|
|
902
|
+
}), M(this, p, []);
|
|
874
903
|
const h = this.__eventUnsubscribers;
|
|
875
904
|
h && Array.isArray(h) && (h.forEach((w) => {
|
|
876
905
|
try {
|
|
877
906
|
w();
|
|
878
907
|
} catch (y) {
|
|
879
|
-
|
|
908
|
+
D.error(
|
|
909
|
+
"⚠️ Event Bus Error: Failed to unsubscribe from event",
|
|
910
|
+
R(this)
|
|
911
|
+
), D.error(` Error details: ${y.message}`);
|
|
880
912
|
}
|
|
881
913
|
}), this.__eventUnsubscribers = []);
|
|
882
914
|
}
|
|
@@ -909,48 +941,48 @@ const bt = (t, n, s) => {
|
|
|
909
941
|
const $ = "this.state.";
|
|
910
942
|
h.startsWith($) && (h = h.slice($.length));
|
|
911
943
|
}
|
|
912
|
-
const y =
|
|
944
|
+
const y = W(g = S, N, ut).call(g, w);
|
|
913
945
|
this.state[h] = y;
|
|
914
946
|
}
|
|
915
947
|
// Setup two-way data bindings for input elements with $bind
|
|
916
948
|
_setupTwoWayBindings() {
|
|
917
|
-
|
|
949
|
+
A(this, l).forEach(
|
|
918
950
|
({ element: h, path: w, raw: y, isContentEditable: g, initialValue: $ }) => {
|
|
919
|
-
var T,
|
|
951
|
+
var T, B;
|
|
920
952
|
if (this._getNestedValue(w) === void 0) {
|
|
921
953
|
const v = $ || "";
|
|
922
|
-
|
|
954
|
+
Z(this.state, w, v);
|
|
923
955
|
}
|
|
924
956
|
if (g) {
|
|
925
957
|
const v = h;
|
|
926
958
|
v.textContent = (T = this._getNestedValue(w)) != null ? T : "";
|
|
927
|
-
const V = (
|
|
928
|
-
const L =
|
|
929
|
-
|
|
959
|
+
const V = (P) => {
|
|
960
|
+
const L = P.target.textContent || "";
|
|
961
|
+
Z(this.state, w, L);
|
|
930
962
|
};
|
|
931
963
|
v.addEventListener("input", V);
|
|
932
964
|
const k = () => {
|
|
933
965
|
v.removeEventListener("input", V);
|
|
934
966
|
};
|
|
935
|
-
|
|
967
|
+
A(this, p).push(k);
|
|
936
968
|
} else {
|
|
937
969
|
const v = h, V = v instanceof HTMLInputElement && v.type === "checkbox";
|
|
938
|
-
v instanceof HTMLInputElement && v.type, V ? v.checked = !!this._getNestedValue(w) : v.value = (
|
|
939
|
-
const k = (
|
|
940
|
-
const L =
|
|
941
|
-
let
|
|
942
|
-
L instanceof HTMLInputElement && L.type === "checkbox" ?
|
|
970
|
+
v instanceof HTMLInputElement && v.type, V ? v.checked = !!this._getNestedValue(w) : v.value = (B = this._getNestedValue(w)) != null ? B : "";
|
|
971
|
+
const k = (H) => {
|
|
972
|
+
const L = H.target;
|
|
973
|
+
let I;
|
|
974
|
+
L instanceof HTMLInputElement && L.type === "checkbox" ? I = L.checked : (L instanceof HTMLInputElement && L.type, I = L.value), Z(this.state, w, I);
|
|
943
975
|
};
|
|
944
976
|
v.addEventListener("input", k);
|
|
945
|
-
const
|
|
977
|
+
const P = () => {
|
|
946
978
|
v.removeEventListener("input", k);
|
|
947
979
|
};
|
|
948
|
-
if (
|
|
980
|
+
if (A(this, p).push(P), v instanceof HTMLSelectElement || v instanceof HTMLInputElement && ["checkbox", "radio", "file"].includes(v.type)) {
|
|
949
981
|
v.addEventListener("change", k);
|
|
950
|
-
const
|
|
982
|
+
const H = () => {
|
|
951
983
|
v.removeEventListener("change", k);
|
|
952
984
|
};
|
|
953
|
-
|
|
985
|
+
A(this, p).push(H);
|
|
954
986
|
}
|
|
955
987
|
}
|
|
956
988
|
}
|
|
@@ -966,15 +998,15 @@ const bt = (t, n, s) => {
|
|
|
966
998
|
* @param target - The object or array to make reactive
|
|
967
999
|
* @param callback - Function to call when any nested property changes
|
|
968
1000
|
*/
|
|
969
|
-
|
|
1001
|
+
G = function(h, w) {
|
|
970
1002
|
if (h === null || typeof h != "object" || h instanceof HTMLElement || h instanceof Node)
|
|
971
1003
|
return h;
|
|
972
|
-
if (
|
|
973
|
-
return
|
|
1004
|
+
if (A(this, m).has(h))
|
|
1005
|
+
return A(this, m).get(h);
|
|
974
1006
|
const y = new Proxy(h, {
|
|
975
1007
|
get: (g, $) => {
|
|
976
|
-
const
|
|
977
|
-
return Array.isArray(g) && typeof
|
|
1008
|
+
const x = g[$];
|
|
1009
|
+
return Array.isArray(g) && typeof x == "function" && [
|
|
978
1010
|
"push",
|
|
979
1011
|
"pop",
|
|
980
1012
|
"shift",
|
|
@@ -982,18 +1014,18 @@ const bt = (t, n, s) => {
|
|
|
982
1014
|
"splice",
|
|
983
1015
|
"sort",
|
|
984
1016
|
"reverse"
|
|
985
|
-
].includes($) ? (...
|
|
986
|
-
const v =
|
|
1017
|
+
].includes($) ? (...B) => {
|
|
1018
|
+
const v = x.apply(g, B);
|
|
987
1019
|
return w(), v;
|
|
988
|
-
} :
|
|
1020
|
+
} : x !== null && typeof x == "object" ? W(this, b, G).call(this, x, w) : x;
|
|
989
1021
|
},
|
|
990
|
-
set: (g, $,
|
|
1022
|
+
set: (g, $, x) => {
|
|
991
1023
|
const T = g[$];
|
|
992
|
-
return Object.is(T,
|
|
1024
|
+
return Object.is(T, x) || (g[$] = x, w()), !0;
|
|
993
1025
|
}
|
|
994
1026
|
});
|
|
995
|
-
return
|
|
996
|
-
},
|
|
1027
|
+
return A(this, m).set(h, y), y;
|
|
1028
|
+
}, N = new WeakSet(), ut = function(h) {
|
|
997
1029
|
if (h === null || h === "") return null;
|
|
998
1030
|
if (h !== "undefined")
|
|
999
1031
|
try {
|
|
@@ -1002,8 +1034,8 @@ const bt = (t, n, s) => {
|
|
|
1002
1034
|
return h;
|
|
1003
1035
|
}
|
|
1004
1036
|
}, // Update two-way bound elements when state changes
|
|
1005
|
-
|
|
1006
|
-
|
|
1037
|
+
dt = function() {
|
|
1038
|
+
A(this, l).forEach(({ element: h, path: w, isContentEditable: y }) => {
|
|
1007
1039
|
const g = this._getNestedValue(w);
|
|
1008
1040
|
if (y) {
|
|
1009
1041
|
const $ = h;
|
|
@@ -1011,17 +1043,17 @@ const bt = (t, n, s) => {
|
|
|
1011
1043
|
} else {
|
|
1012
1044
|
const $ = h;
|
|
1013
1045
|
if ($ instanceof HTMLInputElement && $.type === "checkbox") {
|
|
1014
|
-
const
|
|
1015
|
-
$.checked !==
|
|
1046
|
+
const x = !!g;
|
|
1047
|
+
$.checked !== x && ($.checked = x);
|
|
1016
1048
|
} else
|
|
1017
1049
|
$.value !== g && ($.value = g != null ? g : "");
|
|
1018
1050
|
}
|
|
1019
1051
|
});
|
|
1020
|
-
}, _(S,
|
|
1052
|
+
}, _(S, N);
|
|
1021
1053
|
let d = S;
|
|
1022
|
-
customElements.define(
|
|
1054
|
+
customElements.get(t) || (customElements.define(t, d), D.log(`Web component defined: <${t}></${t}>`));
|
|
1023
1055
|
};
|
|
1024
1056
|
export {
|
|
1025
|
-
|
|
1057
|
+
Ut as defineWebComponent
|
|
1026
1058
|
};
|
|
1027
|
-
//# sourceMappingURL=webcomponent-
|
|
1059
|
+
//# sourceMappingURL=webcomponent-DrCSyWrI.mjs.map
|