wrec 0.24.11 → 0.25.0
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/wrec.es.js +246 -238
- package/package.json +1 -1
package/dist/wrec.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var Tt = (c) => {
|
|
2
2
|
throw TypeError(c);
|
|
3
3
|
};
|
|
4
|
-
var st = (c,
|
|
5
|
-
var h = (c,
|
|
4
|
+
var st = (c, f, t) => f.has(c) || Tt("Cannot " + t);
|
|
5
|
+
var h = (c, f, t) => (st(c, f, "read from private field"), t ? t.call(c) : f.get(c)), y = (c, f, t) => f.has(c) ? Tt("Cannot add the same private member more than once") : f instanceof WeakSet ? f.add(c) : f.set(c, t), M = (c, f, t, e) => (st(c, f, "write to private field"), e ? e.call(c, t) : f.set(c, t), t), a = (c, f, t) => (st(c, f, "access private method"), t);
|
|
6
6
|
import Mt from "xss";
|
|
7
|
-
function
|
|
7
|
+
function Ot(c, f, t = "") {
|
|
8
8
|
const e = /* @__PURE__ */ new WeakMap(), s = {
|
|
9
9
|
// Intercept property reads.
|
|
10
10
|
// This creates nested proxies lazily.
|
|
@@ -13,7 +13,7 @@ function Rt(c, a, t = "") {
|
|
|
13
13
|
if (r === null || typeof r != "object") return r;
|
|
14
14
|
const l = e.get(r);
|
|
15
15
|
if (l) return l;
|
|
16
|
-
const p = t ? `${t}.${n}` : n, u =
|
|
16
|
+
const p = t ? `${t}.${n}` : n, u = Ot(r, f, p);
|
|
17
17
|
return e.set(r, u), u;
|
|
18
18
|
},
|
|
19
19
|
// Intercept property writes.
|
|
@@ -22,27 +22,27 @@ function Rt(c, a, t = "") {
|
|
|
22
22
|
if (l !== r) {
|
|
23
23
|
Reflect.set(o, n, r);
|
|
24
24
|
const p = t ? `${t}.${n}` : n;
|
|
25
|
-
|
|
25
|
+
f(p, l, r);
|
|
26
26
|
}
|
|
27
27
|
return !0;
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
return new Proxy(c, s);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const
|
|
32
|
+
function Nt(c) {
|
|
33
|
+
const f = {};
|
|
34
34
|
for (const [t, e] of Object.entries(c)) {
|
|
35
35
|
const s = typeof e == "object" && e !== null;
|
|
36
|
-
|
|
36
|
+
f[t] = s ? Nt(e) : e;
|
|
37
37
|
}
|
|
38
|
-
return
|
|
38
|
+
return f;
|
|
39
39
|
}
|
|
40
40
|
const Z = typeof window < "u" && typeof window.document < "u";
|
|
41
41
|
let At = class extends Error {
|
|
42
42
|
};
|
|
43
|
-
var
|
|
44
|
-
const
|
|
45
|
-
constructor(
|
|
43
|
+
var $, tt, A, X, U, x, et, Lt;
|
|
44
|
+
const N = class N {
|
|
45
|
+
constructor(f, t, e) {
|
|
46
46
|
y(this, et);
|
|
47
47
|
y(this, tt, /* @__PURE__ */ Symbol("objectId"));
|
|
48
48
|
// This cannot be replaced by a WeakMap<ChangeListener, Set<string>>
|
|
@@ -51,17 +51,17 @@ const O = class O {
|
|
|
51
51
|
y(this, X);
|
|
52
52
|
y(this, U);
|
|
53
53
|
y(this, x);
|
|
54
|
-
if (!
|
|
55
|
-
if (h(
|
|
56
|
-
throw new At(`WrecState with name "${
|
|
57
|
-
if (M(this, X,
|
|
58
|
-
const s = sessionStorage.getItem("wrec-state-" +
|
|
54
|
+
if (!f) throw new At("name cannot be empty");
|
|
55
|
+
if (h(N, $).has(f))
|
|
56
|
+
throw new At(`WrecState with name "${f}" already exists`);
|
|
57
|
+
if (M(this, X, f), M(this, U, t), M(this, x, Ot({}, a(this, et, Lt).bind(this))), t && Z) {
|
|
58
|
+
const s = sessionStorage.getItem("wrec-state-" + f), o = s ? JSON.parse(s) : void 0;
|
|
59
59
|
o && (e = o);
|
|
60
60
|
}
|
|
61
61
|
if (e)
|
|
62
62
|
for (const [s, o] of Object.entries(e))
|
|
63
63
|
this.addProperty(s, o);
|
|
64
|
-
h(
|
|
64
|
+
h(N, $).set(f, this);
|
|
65
65
|
}
|
|
66
66
|
// This static method is useful for accessing a specific WrecState object
|
|
67
67
|
// from the DevTools console. For example:
|
|
@@ -73,16 +73,16 @@ const O = class O {
|
|
|
73
73
|
// Properties can be directly modified as follows:
|
|
74
74
|
// state.color = 'blue';
|
|
75
75
|
// state.team.leader.name = 'Mark';
|
|
76
|
-
static get(
|
|
77
|
-
return h(this,
|
|
76
|
+
static get(f) {
|
|
77
|
+
return h(this, $).get(f);
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* @param listener - object that has a "changed" method
|
|
81
81
|
* @param map - map from state property paths to component properties
|
|
82
82
|
*/
|
|
83
|
-
addListener(
|
|
83
|
+
addListener(f, t = {}) {
|
|
84
84
|
const e = h(this, A).find(
|
|
85
|
-
(s) => s.listenerRef.deref() ===
|
|
85
|
+
(s) => s.listenerRef.deref() === f
|
|
86
86
|
);
|
|
87
87
|
if (e) {
|
|
88
88
|
const { propertyMap: s } = e;
|
|
@@ -90,20 +90,20 @@ const O = class O {
|
|
|
90
90
|
s[o] = n;
|
|
91
91
|
} else
|
|
92
92
|
h(this, A).push({
|
|
93
|
-
listenerRef: new WeakRef(
|
|
93
|
+
listenerRef: new WeakRef(f),
|
|
94
94
|
propertyMap: t
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
addProperty(
|
|
98
|
-
Object.defineProperty(this,
|
|
97
|
+
addProperty(f, t) {
|
|
98
|
+
Object.defineProperty(this, f, {
|
|
99
99
|
enumerable: !0,
|
|
100
100
|
get() {
|
|
101
|
-
return h(this, x)[
|
|
101
|
+
return h(this, x)[f];
|
|
102
102
|
},
|
|
103
103
|
set(e) {
|
|
104
|
-
h(this, x)[
|
|
104
|
+
h(this, x)[f] = e;
|
|
105
105
|
}
|
|
106
|
-
}), h(this, x)[
|
|
106
|
+
}), h(this, x)[f] = t;
|
|
107
107
|
}
|
|
108
108
|
get id() {
|
|
109
109
|
return h(this, tt);
|
|
@@ -112,14 +112,14 @@ const O = class O {
|
|
|
112
112
|
// For example: state.log()
|
|
113
113
|
log() {
|
|
114
114
|
console.log("WrecState:", h(this, X));
|
|
115
|
-
for (const [
|
|
116
|
-
console.log(` ${
|
|
115
|
+
for (const [f, t] of Object.entries(h(this, x)))
|
|
116
|
+
console.log(` ${f} = ${JSON.stringify(t)}`);
|
|
117
117
|
}
|
|
118
|
-
removeListener(
|
|
119
|
-
M(this, A, h(this, A).filter((t) => t.listenerRef.deref() !==
|
|
118
|
+
removeListener(f) {
|
|
119
|
+
M(this, A, h(this, A).filter((t) => t.listenerRef.deref() !== f));
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
|
-
|
|
122
|
+
$ = new WeakMap(), tt = new WeakMap(), A = new WeakMap(), X = new WeakMap(), U = new WeakMap(), x = new WeakMap(), et = new WeakSet(), Lt = function(f, t, e) {
|
|
123
123
|
const s = /* @__PURE__ */ new Set();
|
|
124
124
|
for (const o of h(this, A)) {
|
|
125
125
|
const n = o.listenerRef.deref();
|
|
@@ -129,9 +129,9 @@ P = new WeakMap(), tt = new WeakMap(), A = new WeakMap(), X = new WeakMap(), U =
|
|
|
129
129
|
s.add(o);
|
|
130
130
|
else {
|
|
131
131
|
const { propertyMap: r } = o, l = Object.keys(r);
|
|
132
|
-
(l.length === 0 || l.includes(
|
|
133
|
-
|
|
134
|
-
r[
|
|
132
|
+
(l.length === 0 || l.includes(f)) && n.changed(
|
|
133
|
+
f,
|
|
134
|
+
r[f],
|
|
135
135
|
e,
|
|
136
136
|
t,
|
|
137
137
|
this
|
|
@@ -141,34 +141,34 @@ P = new WeakMap(), tt = new WeakMap(), A = new WeakMap(), X = new WeakMap(), U =
|
|
|
141
141
|
M(this, A, h(this, A).filter(
|
|
142
142
|
(o) => !s.has(o)
|
|
143
143
|
));
|
|
144
|
-
}, y(
|
|
145
|
-
for (const [
|
|
144
|
+
}, y(N, $, /* @__PURE__ */ new Map()), Z && window.addEventListener("beforeunload", () => {
|
|
145
|
+
for (const [f, t] of h(N, $).entries())
|
|
146
146
|
if (h(t, U)) {
|
|
147
|
-
const e =
|
|
148
|
-
sessionStorage.setItem("wrec-state-" +
|
|
147
|
+
const e = Nt(t);
|
|
148
|
+
sessionStorage.setItem("wrec-state-" + f, JSON.stringify(e));
|
|
149
149
|
}
|
|
150
150
|
});
|
|
151
|
-
let ct =
|
|
151
|
+
let ct = N;
|
|
152
152
|
Z && process.env.NODE_ENV === "development" && (window.WrecState = ct);
|
|
153
|
-
function St(c,
|
|
153
|
+
function St(c, f) {
|
|
154
154
|
let t = c;
|
|
155
|
-
for (const e of
|
|
155
|
+
for (const e of f.split("."))
|
|
156
156
|
t = t[e];
|
|
157
157
|
return t;
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
const e =
|
|
159
|
+
function te(c, f, t) {
|
|
160
|
+
const e = f.split("."), s = e.length - 1;
|
|
161
161
|
let o = c;
|
|
162
162
|
e.forEach((n, r) => {
|
|
163
163
|
r === s ? o[n] = t : o = o[n];
|
|
164
164
|
});
|
|
165
165
|
}
|
|
166
|
-
const
|
|
167
|
-
function
|
|
168
|
-
const
|
|
166
|
+
const ee = /* @__PURE__ */ new Set(["button", "input", "label", "option", "th"]), vt = "__WREC", xt = "__";
|
|
167
|
+
function se(c) {
|
|
168
|
+
const f = {
|
|
169
169
|
allowCommentTag: !0,
|
|
170
170
|
onTag: (s, o) => {
|
|
171
|
-
if (
|
|
171
|
+
if (ee.has(s)) return o;
|
|
172
172
|
},
|
|
173
173
|
onTagAttr(s, o, n) {
|
|
174
174
|
if (o.startsWith("on")) return "";
|
|
@@ -190,7 +190,7 @@ function te(c) {
|
|
|
190
190
|
while (c.includes(o));
|
|
191
191
|
return t.push(s), o;
|
|
192
192
|
});
|
|
193
|
-
let e = Mt(c,
|
|
193
|
+
let e = Mt(c, f);
|
|
194
194
|
return t.forEach((s, o) => {
|
|
195
195
|
const n = new RegExp(
|
|
196
196
|
`${vt}${o}${xt}`,
|
|
@@ -199,14 +199,14 @@ function te(c) {
|
|
|
199
199
|
e = e.replace(n, s);
|
|
200
200
|
}), e;
|
|
201
201
|
}
|
|
202
|
-
const
|
|
202
|
+
const oe = /* @__PURE__ */ new Set([
|
|
203
203
|
"class",
|
|
204
204
|
"disabled",
|
|
205
205
|
"hidden",
|
|
206
206
|
"id",
|
|
207
207
|
"tabindex",
|
|
208
208
|
"title"
|
|
209
|
-
]),
|
|
209
|
+
]), Ct = globalThis.HTMLElement ?? class {
|
|
210
210
|
}, at = globalThis.customElements ?? {
|
|
211
211
|
get: (c) => {
|
|
212
212
|
},
|
|
@@ -221,78 +221,78 @@ const ee = /* @__PURE__ */ new Set([
|
|
|
221
221
|
};
|
|
222
222
|
class v extends Error {
|
|
223
223
|
}
|
|
224
|
-
const
|
|
225
|
-
function
|
|
224
|
+
const ie = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, jt = "a-zA-Z_$", ne = jt + "0-9", B = `[${jt}][${ne}]*`, $t = new RegExp(`this\\.(${B})\\s*\\(`, "g"), re = /<!--\s*(.*?)\s*-->/, ce = /<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g, ot = new RegExp(`^this\\.${B}$`), it = new RegExp(`this\\.${B}(\\.${B})*`, "g"), Ht = new RegExp(`this\\.${B}(\\.${B})*`), ae = 5;
|
|
225
|
+
function fe(c) {
|
|
226
226
|
return c instanceof HTMLButtonElement || c instanceof HTMLFieldSetElement || c instanceof HTMLInputElement || c instanceof HTMLSelectElement || c instanceof HTMLTextAreaElement || c instanceof K;
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function be(c, f, t) {
|
|
229
229
|
const e = document.createElement(c);
|
|
230
|
-
if (
|
|
231
|
-
for (const [s, o] of Object.entries(
|
|
230
|
+
if (f)
|
|
231
|
+
for (const [s, o] of Object.entries(f))
|
|
232
232
|
e.setAttribute(s, o);
|
|
233
233
|
return t && (e.innerHTML = t), e;
|
|
234
234
|
}
|
|
235
|
-
const Pt = (c) => Array.isArray(c.values) && c.values.length > 0 ? c.values[0] :
|
|
235
|
+
const Pt = (c) => Array.isArray(c.values) && c.values.length > 0 ? c.values[0] : he(c.type), he = (c) => c === String ? "" : c === Number ? 0 : c === Boolean ? !1 : c === Array ? [] : c === Object ? {} : void 0;
|
|
236
236
|
function Q(c) {
|
|
237
|
-
const
|
|
237
|
+
const f = [];
|
|
238
238
|
let t = c.firstElementChild;
|
|
239
239
|
for (; t; )
|
|
240
|
-
|
|
241
|
-
return
|
|
240
|
+
f.push(t), t.shadowRoot && f.push(...Q(t.shadowRoot)), t.firstElementChild && f.push(...Q(t)), t = t.nextElementSibling;
|
|
241
|
+
return f;
|
|
242
242
|
}
|
|
243
|
-
const
|
|
244
|
-
function
|
|
243
|
+
const _ = (c) => c.substring(ae).split(".")[0];
|
|
244
|
+
function kt(c, f) {
|
|
245
245
|
let t = c[0];
|
|
246
|
-
return
|
|
246
|
+
return f.forEach((e, s) => {
|
|
247
247
|
t += e + c[s + 1];
|
|
248
248
|
}), t;
|
|
249
249
|
}
|
|
250
250
|
function Y(c) {
|
|
251
|
-
const
|
|
252
|
-
return
|
|
251
|
+
const f = typeof c;
|
|
252
|
+
return f === "string" || f === "number" || f === "boolean";
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function V(c) {
|
|
255
255
|
return c.localName === "textarea";
|
|
256
256
|
}
|
|
257
257
|
function Et(c) {
|
|
258
|
-
const { localName:
|
|
259
|
-
return
|
|
258
|
+
const { localName: f } = c;
|
|
259
|
+
return f === "input" || f === "select";
|
|
260
260
|
}
|
|
261
|
-
const
|
|
262
|
-
function
|
|
263
|
-
return c.slice(0,
|
|
261
|
+
const le = (c) => c.replace(/<!--[\s\S]*?-->/g, "");
|
|
262
|
+
function Ft(c, f, t, e) {
|
|
263
|
+
return c.slice(0, f) + e + c.slice(f + t);
|
|
264
264
|
}
|
|
265
265
|
function nt(c) {
|
|
266
|
-
const
|
|
267
|
-
if (isNaN(
|
|
268
|
-
return
|
|
266
|
+
const f = Number(c);
|
|
267
|
+
if (isNaN(f)) throw new v(`can't convert "${c}" to a number`);
|
|
268
|
+
return f;
|
|
269
269
|
}
|
|
270
|
-
function
|
|
271
|
-
const [e, s] =
|
|
270
|
+
function It(c, f, t) {
|
|
271
|
+
const [e, s] = f.split(":");
|
|
272
272
|
if (Y(t))
|
|
273
273
|
if (typeof t == "boolean") {
|
|
274
274
|
t ? c.setAttribute(e, e) : c.removeAttribute(e);
|
|
275
275
|
const o = K.getPropName(e);
|
|
276
276
|
c[o] = t;
|
|
277
277
|
} else {
|
|
278
|
-
const o = c.getAttribute(
|
|
278
|
+
const o = c.getAttribute(f), n = String(t);
|
|
279
279
|
o !== n && (c.setAttribute(e, n), e === "value" && Et(c) && (c.value = n));
|
|
280
280
|
}
|
|
281
281
|
else {
|
|
282
|
-
const o = K.getPropName(
|
|
282
|
+
const o = K.getPropName(f);
|
|
283
283
|
c[o] = t;
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
function rt(c,
|
|
287
|
-
const [e, s] =
|
|
288
|
-
c instanceof CSSStyleRule ? c.style.setProperty(e, t) : (
|
|
286
|
+
function rt(c, f, t) {
|
|
287
|
+
const [e, s] = f.split(":");
|
|
288
|
+
c instanceof CSSStyleRule ? c.style.setProperty(e, t) : (It(c, e, t), e === "value" && Et(c) && (c.value = t));
|
|
289
289
|
}
|
|
290
|
-
const
|
|
291
|
-
async function
|
|
292
|
-
const
|
|
290
|
+
const Rt = (c) => typeof c == "string" ? [c] : c;
|
|
291
|
+
async function pe(c) {
|
|
292
|
+
const f = /* @__PURE__ */ new Set();
|
|
293
293
|
for (const e of Q(c.content)) {
|
|
294
294
|
const { localName: s } = e;
|
|
295
|
-
s.includes("-") &&
|
|
295
|
+
s.includes("-") && f.add(s);
|
|
296
296
|
}
|
|
297
297
|
function t(e) {
|
|
298
298
|
return new Promise((s, o) => {
|
|
@@ -303,7 +303,7 @@ async function le(c) {
|
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
305
|
return Promise.all(
|
|
306
|
-
[...
|
|
306
|
+
[...f].map(
|
|
307
307
|
async (e) => Promise.race([
|
|
308
308
|
at.whenDefined(e),
|
|
309
309
|
t(e)
|
|
@@ -311,30 +311,30 @@ async function le(c) {
|
|
|
311
311
|
)
|
|
312
312
|
);
|
|
313
313
|
}
|
|
314
|
-
var
|
|
315
|
-
const
|
|
314
|
+
var L, j, m, T, H, C, k, F, I, P, i, Bt, Dt, _t, ft, ht, Vt, lt, S, Wt, zt, R, W, z, pt, ut, dt, mt, qt, q, J, Jt, g, O, bt, yt, Kt, Xt, gt, Ut, Zt, Yt, G, Gt, Qt, wt;
|
|
315
|
+
const w = class w extends Ct {
|
|
316
316
|
constructor() {
|
|
317
317
|
super();
|
|
318
318
|
y(this, i);
|
|
319
319
|
// This is true while the batchSet method is running.
|
|
320
|
-
y(this,
|
|
320
|
+
y(this, L, !1);
|
|
321
321
|
// This holds the names of computed properties
|
|
322
322
|
// that are currently being updated.
|
|
323
|
-
y(this,
|
|
323
|
+
y(this, j, /* @__PURE__ */ new Set());
|
|
324
324
|
y(this, m, this.constructor);
|
|
325
325
|
// This is a map from expressions to references to them
|
|
326
326
|
// which can be found in element text content,
|
|
327
327
|
// attribute values, and CSS property values.
|
|
328
328
|
// Each component instance needs its own map.
|
|
329
329
|
y(this, T, /* @__PURE__ */ new Map());
|
|
330
|
-
y(this,
|
|
330
|
+
y(this, H, {});
|
|
331
331
|
y(this, C);
|
|
332
332
|
// For components that set `formAssociated` to true,
|
|
333
333
|
// this stores in the initial value of each property
|
|
334
334
|
// in the formAssociatedCallback method
|
|
335
335
|
// so they can be restored in the formResetCallback method.
|
|
336
|
-
y(this,
|
|
337
|
-
y(this,
|
|
336
|
+
y(this, k, {});
|
|
337
|
+
y(this, F, null);
|
|
338
338
|
// This is a map from properties in this web component
|
|
339
339
|
// to corresponding properties in a parent web component.
|
|
340
340
|
// This must be an instance property because
|
|
@@ -342,14 +342,14 @@ const g = class g extends se {
|
|
|
342
342
|
// to the properties of different parent components.
|
|
343
343
|
// This is used to update a parent property
|
|
344
344
|
// when the corresponding child property value changes.
|
|
345
|
-
y(this,
|
|
345
|
+
y(this, I, /* @__PURE__ */ new Map());
|
|
346
346
|
// This is a map from component properties to state bindings.
|
|
347
347
|
// It must be instance-specific because each component instance
|
|
348
348
|
// can bind the same property to a different WrecState/path.
|
|
349
|
-
y(this,
|
|
349
|
+
y(this, P, /* @__PURE__ */ new Map());
|
|
350
350
|
this.attachShadow({ mode: "open" });
|
|
351
351
|
const t = h(this, m);
|
|
352
|
-
|
|
352
|
+
a(this, i, R).call(this, "attrToPropMap") || (t.attrToPropMap = /* @__PURE__ */ new Map()), a(this, i, R).call(this, "properties") || (t.properties = {}), a(this, i, R).call(this, "propToAttrMap") || (t.propToAttrMap = /* @__PURE__ */ new Map()), a(this, i, R).call(this, "propToComputedMap") || (t.propToComputedMap = /* @__PURE__ */ new Map()), a(this, i, R).call(this, "propToExprsMap") || (t.propToExprsMap = /* @__PURE__ */ new Map());
|
|
353
353
|
}
|
|
354
354
|
static define(t) {
|
|
355
355
|
if (this.elementName = t, at.get(t))
|
|
@@ -357,19 +357,19 @@ const g = class g extends se {
|
|
|
357
357
|
at.define(t, this);
|
|
358
358
|
}
|
|
359
359
|
attributeChangedCallback(t, e, s) {
|
|
360
|
-
t === "disabled" &&
|
|
361
|
-
const o =
|
|
362
|
-
if (!
|
|
363
|
-
const n =
|
|
360
|
+
t === "disabled" && a(this, i, ht).call(this);
|
|
361
|
+
const o = w.getPropName(t);
|
|
362
|
+
if (!a(this, i, z).call(this, o) && a(this, i, W).call(this, o)) {
|
|
363
|
+
const n = a(this, i, yt).call(this, o, s);
|
|
364
364
|
this[o] = n;
|
|
365
|
-
const r = h(this,
|
|
365
|
+
const r = h(this, H)[o];
|
|
366
366
|
r && this.setFormValue(r, String(n));
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
// This applies multiple property changes and only updates
|
|
370
370
|
// the affected parts of the DOM after all of them are made.
|
|
371
371
|
batchSet(t) {
|
|
372
|
-
M(this,
|
|
372
|
+
M(this, L, !0);
|
|
373
373
|
const e = h(this, m).propToExprsMap, s = /* @__PURE__ */ new Set();
|
|
374
374
|
for (const [l, p] of Object.entries(t)) {
|
|
375
375
|
this[l] = p;
|
|
@@ -385,7 +385,7 @@ const g = class g extends se {
|
|
|
385
385
|
}
|
|
386
386
|
for (const l of n) {
|
|
387
387
|
const p = r[l];
|
|
388
|
-
|
|
388
|
+
a(this, i, q).call(this, l, a(this, i, S).call(this, p));
|
|
389
389
|
const u = e.get(l) ?? [];
|
|
390
390
|
for (const d of u)
|
|
391
391
|
s.add(d);
|
|
@@ -393,12 +393,12 @@ const g = class g extends se {
|
|
|
393
393
|
for (; ; ) {
|
|
394
394
|
let l = !1;
|
|
395
395
|
for (const p of n) {
|
|
396
|
-
const u = r[p], d =
|
|
397
|
-
JSON.stringify(d) !== JSON.stringify(b) && (
|
|
396
|
+
const u = r[p], d = a(this, i, S).call(this, u), b = this[p];
|
|
397
|
+
JSON.stringify(d) !== JSON.stringify(b) && (a(this, i, q).call(this, p, d), l = !0);
|
|
398
398
|
}
|
|
399
399
|
if (!l) break;
|
|
400
400
|
}
|
|
401
|
-
|
|
401
|
+
a(this, i, lt).call(this, [...s]), M(this, L, !1);
|
|
402
402
|
}
|
|
403
403
|
static buildHTML() {
|
|
404
404
|
let t = `<style>
|
|
@@ -413,12 +413,12 @@ const g = class g extends se {
|
|
|
413
413
|
this[e] = s;
|
|
414
414
|
}
|
|
415
415
|
async connectedCallback() {
|
|
416
|
-
|
|
416
|
+
a(this, i, Yt).call(this), a(this, i, _t).call(this), await a(this, i, Bt).call(this), this.hasAttribute("disabled") && a(this, i, ht).call(this), a(this, i, wt).call(this, this.shadowRoot), a(this, i, pt).call(this, this.shadowRoot), a(this, i, Zt).call(this), a(this, i, Dt).call(this);
|
|
417
417
|
}
|
|
418
418
|
disconnectedCallback() {
|
|
419
|
-
for (const { state: t } of h(this,
|
|
419
|
+
for (const { state: t } of h(this, P).values())
|
|
420
420
|
t.removeListener(this);
|
|
421
|
-
h(this, T).clear(), h(this,
|
|
421
|
+
h(this, T).clear(), h(this, k).clear(), h(this, I).clear(), h(this, P).clear();
|
|
422
422
|
}
|
|
423
423
|
dispatch(t, e) {
|
|
424
424
|
this.dispatchEvent(
|
|
@@ -443,7 +443,7 @@ const g = class g extends se {
|
|
|
443
443
|
if (!t) {
|
|
444
444
|
const r = this.getAttribute("name");
|
|
445
445
|
if (r)
|
|
446
|
-
if (
|
|
446
|
+
if (a(this, i, W).call(this, "value"))
|
|
447
447
|
t = `value:${r}`;
|
|
448
448
|
else
|
|
449
449
|
return;
|
|
@@ -455,20 +455,20 @@ const g = class g extends se {
|
|
|
455
455
|
const [l, p] = r.split(":");
|
|
456
456
|
e[l.trim()] = p.trim();
|
|
457
457
|
}
|
|
458
|
-
M(this,
|
|
458
|
+
M(this, H, e), M(this, C, new FormData()), M(this, F, this.attachInternals()), h(this, F).setFormValue(h(this, C));
|
|
459
459
|
for (const [r, l] of Object.entries(e)) {
|
|
460
460
|
const p = this[r];
|
|
461
461
|
Y(p) && this.setFormValue(l, String(p));
|
|
462
462
|
}
|
|
463
|
-
const o = Object.keys(h(this, m).properties), n = h(this,
|
|
463
|
+
const o = Object.keys(h(this, m).properties), n = h(this, k);
|
|
464
464
|
for (const r of o)
|
|
465
465
|
n[r] = this[r];
|
|
466
466
|
}
|
|
467
467
|
formResetCallback() {
|
|
468
|
-
const t = h(this,
|
|
468
|
+
const t = h(this, k);
|
|
469
469
|
for (const e of Object.keys(t)) {
|
|
470
470
|
let s = t[e];
|
|
471
|
-
ot.test(s) && (s =
|
|
471
|
+
ot.test(s) && (s = a(this, i, S).call(this, s)), this[e] = s;
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
static getAttrName(t) {
|
|
@@ -480,7 +480,7 @@ const g = class g extends se {
|
|
|
480
480
|
return e || (e = t.replace(/-([a-z])/g, (s, o) => o.toUpperCase()), this.attrToPropMap.set(t, e)), e;
|
|
481
481
|
}
|
|
482
482
|
static get observedAttributes() {
|
|
483
|
-
const t = Object.entries(this.properties || {}).filter(([e, s]) => !s.computed).map(([e]) =>
|
|
483
|
+
const t = Object.entries(this.properties || {}).filter(([e, s]) => !s.computed).map(([e]) => w.getAttrName(e));
|
|
484
484
|
return t.includes("disabled") || t.push("disabled"), t;
|
|
485
485
|
}
|
|
486
486
|
// Subclasses can override this to add functionality.
|
|
@@ -492,7 +492,7 @@ const g = class g extends se {
|
|
|
492
492
|
this.hasAttribute(t) || this.setAttribute(t, e);
|
|
493
493
|
}
|
|
494
494
|
setFormValue(t, e) {
|
|
495
|
-
!h(this, C) || !Y(e) || (h(this, C).set(t, e), h(this,
|
|
495
|
+
!h(this, C) || !Y(e) || (h(this, C).set(t, e), h(this, F)?.setFormValue(h(this, C)));
|
|
496
496
|
}
|
|
497
497
|
static ssr(t = {}) {
|
|
498
498
|
throw new v('Import Wrec from "wrec/ssr" to use the ssr method.');
|
|
@@ -508,51 +508,51 @@ const g = class g extends se {
|
|
|
508
508
|
for (const s of Object.keys(t))
|
|
509
509
|
e[s] = s;
|
|
510
510
|
}
|
|
511
|
-
|
|
511
|
+
a(this, i, Gt).call(this, t, e);
|
|
512
512
|
for (const [s, o] of Object.entries(e))
|
|
513
|
-
if (
|
|
513
|
+
if (a(this, i, W).call(this, o)) {
|
|
514
514
|
const n = St(t, s);
|
|
515
|
-
n !== void 0 && (this[o] = n), h(this,
|
|
515
|
+
n !== void 0 && (this[o] = n), h(this, P).set(o, { state: t, stateProp: s });
|
|
516
516
|
}
|
|
517
517
|
t.addListener(this, e);
|
|
518
518
|
}
|
|
519
519
|
};
|
|
520
|
-
|
|
520
|
+
L = new WeakMap(), j = new WeakMap(), m = new WeakMap(), T = new WeakMap(), H = new WeakMap(), C = new WeakMap(), k = new WeakMap(), F = new WeakMap(), I = new WeakMap(), P = new WeakMap(), i = new WeakSet(), Bt = async function() {
|
|
521
521
|
const t = h(this, m);
|
|
522
522
|
let { template: e } = t;
|
|
523
|
-
e || (e = t.template = document.createElement("template"), e.innerHTML = t.buildHTML()), await
|
|
524
|
-
},
|
|
523
|
+
e || (e = t.template = document.createElement("template"), e.innerHTML = t.buildHTML()), await pe(e), this.shadowRoot.replaceChildren(e.content.cloneNode(!0));
|
|
524
|
+
}, Dt = function() {
|
|
525
525
|
const t = h(this, m), { properties: e } = t;
|
|
526
526
|
for (const [s, { computed: o }] of Object.entries(e))
|
|
527
|
-
o &&
|
|
528
|
-
},
|
|
527
|
+
o && a(this, i, q).call(this, s, a(this, i, S).call(this, o));
|
|
528
|
+
}, _t = function() {
|
|
529
529
|
const t = h(this, m), { observedAttributes: e, properties: s } = t;
|
|
530
530
|
for (const [o, n] of Object.entries(s))
|
|
531
|
-
n.computed ||
|
|
531
|
+
n.computed || a(this, i, ft).call(this, o, n, e);
|
|
532
532
|
for (const [o, n] of Object.entries(s))
|
|
533
|
-
n.computed &&
|
|
533
|
+
n.computed && a(this, i, ft).call(this, o, n, e);
|
|
534
534
|
}, ft = function(t, e, s) {
|
|
535
535
|
if (t === "class" || t === "style")
|
|
536
536
|
throw new v(`"${t}" is a reserved property`);
|
|
537
|
-
const o =
|
|
538
|
-
e.required && !n &&
|
|
537
|
+
const o = w.getAttrName(t), n = this.hasAttribute(o);
|
|
538
|
+
e.required && !n && a(this, i, g).call(this, this, o, "is a required attribute");
|
|
539
539
|
let r = e.value;
|
|
540
540
|
this.hasOwnProperty(t) && (r = this[t], delete this[t]);
|
|
541
|
-
const { type: l } = e, p = l === Boolean ? r || n : s.includes(o) && n ?
|
|
542
|
-
this[u] = p, e.computed &&
|
|
541
|
+
const { type: l } = e, p = l === Boolean ? r || n : s.includes(o) && n ? a(this, i, bt).call(this, t, o) : r ?? Pt(e), u = "#" + t;
|
|
542
|
+
this[u] = p, e.computed && a(this, i, qt).call(this, t, e), Object.defineProperty(this, t, {
|
|
543
543
|
enumerable: !0,
|
|
544
544
|
get() {
|
|
545
545
|
return this[u];
|
|
546
546
|
},
|
|
547
547
|
set(d) {
|
|
548
|
-
e.computed && !h(this,
|
|
548
|
+
e.computed && !h(this, j).has(t) && a(this, i, g).call(this, null, t, "is a computed property and cannot be set directly"), l === Number && typeof d == "string" && (d = nt(d));
|
|
549
549
|
const b = this[u];
|
|
550
550
|
if (d === b) return;
|
|
551
|
-
|
|
552
|
-
const E = h(this,
|
|
553
|
-
E &&
|
|
554
|
-
const
|
|
555
|
-
|
|
551
|
+
a(this, i, Qt).call(this, t, l, d), this[u] = d;
|
|
552
|
+
const E = h(this, P).get(t);
|
|
553
|
+
E && te(E.state, E.stateProp, d), a(this, i, Kt).call(this, t, l, d, o), h(this, L) || (a(this, i, Xt).call(this, t), a(this, i, mt).call(this, t)), a(this, i, Ut).call(this, t, d);
|
|
554
|
+
const D = h(this, H)[t];
|
|
555
|
+
D && this.setFormValue(D, String(d)), this.propertyChangedCallback(t, b, d), e.dispatch && this.dispatch("change", {
|
|
556
556
|
tagName: this.localName,
|
|
557
557
|
property: t,
|
|
558
558
|
oldValue: b,
|
|
@@ -563,27 +563,32 @@ N = new WeakMap(), L = new WeakMap(), m = new WeakMap(), T = new WeakMap(), j =
|
|
|
563
563
|
}, ht = function() {
|
|
564
564
|
const t = this.hasAttribute("disabled"), e = Q(this.shadowRoot);
|
|
565
565
|
for (const s of e)
|
|
566
|
-
|
|
567
|
-
},
|
|
566
|
+
fe(s) && (s.disabled = t);
|
|
567
|
+
}, Vt = function(t) {
|
|
568
568
|
var s;
|
|
569
|
-
const e = t instanceof
|
|
569
|
+
const e = t instanceof w;
|
|
570
570
|
for (const o of t.getAttributeNames()) {
|
|
571
|
-
const n = t.getAttribute(o)
|
|
571
|
+
const n = t.getAttribute(o);
|
|
572
|
+
if (o === "ref") {
|
|
573
|
+
a(this, i, Jt).call(this, t, n);
|
|
574
|
+
continue;
|
|
575
|
+
}
|
|
576
|
+
const r = a(this, i, dt).call(this, t, n);
|
|
572
577
|
if (r) {
|
|
573
578
|
const l = this[r];
|
|
574
|
-
l === void 0 &&
|
|
579
|
+
l === void 0 && a(this, i, O).call(this, t, o, r);
|
|
575
580
|
let [p, u] = o.split(":");
|
|
576
|
-
const d =
|
|
577
|
-
e &&
|
|
578
|
-
|
|
581
|
+
const d = w.getPropName(p), b = a(this, i, z).call(this, r);
|
|
582
|
+
e && a(s = t, i, z).call(s, d) || (t[d] = l), p === "value" && (u ? (t["on" + u] === void 0 && a(this, i, g).call(this, t, o, "refers to an unsupported event name"), t.setAttribute(p, this[r])) : u = "change"), e && !b && h(t, I).set(
|
|
583
|
+
w.getPropName(p),
|
|
579
584
|
r
|
|
580
585
|
);
|
|
581
586
|
}
|
|
582
|
-
|
|
587
|
+
a(this, i, J).call(this, n, t, o);
|
|
583
588
|
}
|
|
584
589
|
}, lt = function(t) {
|
|
585
590
|
for (const e of t) {
|
|
586
|
-
const s =
|
|
591
|
+
const s = a(this, i, S).call(this, e), o = h(this, T).get(e) ?? [], n = /* @__PURE__ */ new Set();
|
|
587
592
|
for (const r of o) {
|
|
588
593
|
const l = r instanceof HTMLElement || r instanceof CSSStyleRule ? r : r.element;
|
|
589
594
|
if (l instanceof HTMLElement && !l.isConnected) {
|
|
@@ -591,7 +596,7 @@ N = new WeakMap(), L = new WeakMap(), m = new WeakMap(), T = new WeakMap(), j =
|
|
|
591
596
|
continue;
|
|
592
597
|
}
|
|
593
598
|
if (r instanceof HTMLElement)
|
|
594
|
-
|
|
599
|
+
a(this, i, gt).call(this, r, s);
|
|
595
600
|
else if (!(r instanceof CSSStyleRule)) {
|
|
596
601
|
const { element: p, attrName: u } = r;
|
|
597
602
|
p instanceof CSSStyleRule ? p.style.setProperty(u, s) : rt(p, u, s);
|
|
@@ -608,7 +613,7 @@ N = new WeakMap(), L = new WeakMap(), m = new WeakMap(), T = new WeakMap(), j =
|
|
|
608
613
|
"context",
|
|
609
614
|
`const {${Object.keys(e).join(",")}} = context; return ${t};`
|
|
610
615
|
).call(this, e);
|
|
611
|
-
},
|
|
616
|
+
}, Wt = function(t) {
|
|
612
617
|
const { localName: e } = t;
|
|
613
618
|
if (e === "style") {
|
|
614
619
|
const { sheet: s } = t, o = s?.cssRules ?? [], n = Array.from(o);
|
|
@@ -618,14 +623,14 @@ N = new WeakMap(), L = new WeakMap(), m = new WeakMap(), T = new WeakMap(), j =
|
|
|
618
623
|
for (const p of l)
|
|
619
624
|
if (p.startsWith("--")) {
|
|
620
625
|
const u = r.style.getPropertyValue(p);
|
|
621
|
-
|
|
626
|
+
a(this, i, J).call(this, u, r, p);
|
|
622
627
|
}
|
|
623
628
|
}
|
|
624
629
|
} else {
|
|
625
630
|
let s = "";
|
|
626
|
-
if (
|
|
627
|
-
|
|
628
|
-
const o = t.textContent?.match(
|
|
631
|
+
if (V(t)) {
|
|
632
|
+
a(this, i, J).call(this, t.textContent, t);
|
|
633
|
+
const o = t.textContent?.match(re);
|
|
629
634
|
o && (s = o[1]);
|
|
630
635
|
} else {
|
|
631
636
|
const o = Array.from(t.childNodes).find(
|
|
@@ -634,48 +639,48 @@ N = new WeakMap(), L = new WeakMap(), m = new WeakMap(), T = new WeakMap(), j =
|
|
|
634
639
|
o && (s = o.textContent?.trim() ?? "");
|
|
635
640
|
}
|
|
636
641
|
if (s) {
|
|
637
|
-
const o =
|
|
638
|
-
o &&
|
|
642
|
+
const o = a(this, i, dt).call(this, t, s);
|
|
643
|
+
o && V(t) ? t.textContent = this[o] : a(this, i, J).call(this, s, t);
|
|
639
644
|
}
|
|
640
645
|
}
|
|
641
|
-
},
|
|
646
|
+
}, zt = function(t, e, s) {
|
|
642
647
|
if (s.length !== 1) return;
|
|
643
648
|
const [o] = s;
|
|
644
649
|
if (!ot.test(o)) return;
|
|
645
|
-
const n = Et(t) ||
|
|
650
|
+
const n = Et(t) || V(t);
|
|
646
651
|
let [r, l] = (e ?? "").split(":");
|
|
647
|
-
if (!(n && r === "value" ||
|
|
648
|
-
l ? t["on" + l] === void 0 &&
|
|
649
|
-
const u =
|
|
652
|
+
if (!(n && r === "value" || V(t))) return;
|
|
653
|
+
l ? t["on" + l] === void 0 && a(this, i, g).call(this, t, e, "refers to an unsupported event name") : l = "change";
|
|
654
|
+
const u = _(o);
|
|
650
655
|
t.addEventListener(l, (d) => {
|
|
651
656
|
const { target: b } = d;
|
|
652
657
|
if (!b) return;
|
|
653
|
-
const E = b.value, { type:
|
|
654
|
-
this[u] =
|
|
658
|
+
const E = b.value, { type: D } = h(this, m).properties[u];
|
|
659
|
+
this[u] = D === Number ? nt(E) : E, a(this, i, mt).call(this, u);
|
|
655
660
|
});
|
|
656
661
|
}, R = function(t) {
|
|
657
662
|
return Object.hasOwn(h(this, m), t);
|
|
658
|
-
}, V = function(t) {
|
|
659
|
-
return !!h(this, m).properties[t];
|
|
660
663
|
}, W = function(t) {
|
|
664
|
+
return !!h(this, m).properties[t];
|
|
665
|
+
}, z = function(t) {
|
|
661
666
|
return !!h(this, m).properties[t]?.computed;
|
|
662
667
|
}, pt = function(t) {
|
|
663
668
|
const e = Array.from(t.querySelectorAll("*"));
|
|
664
669
|
for (const s of e)
|
|
665
|
-
|
|
670
|
+
a(this, i, Vt).call(this, s), s.firstElementChild || a(this, i, Wt).call(this, s);
|
|
666
671
|
}, // formAssociated is only needed when the component is inside a form.
|
|
667
672
|
ut = function() {
|
|
668
673
|
if (h(this, m).formAssociated || this.closest("form") === null) return;
|
|
669
674
|
const t = h(this, m).name;
|
|
670
|
-
|
|
675
|
+
a(this, i, g).call(this, this, void 0, `inside form, class ${t} requires "static formAssociated = true;"`);
|
|
671
676
|
}, dt = function(t, e) {
|
|
672
677
|
if (!e || !ot.test(e)) return;
|
|
673
|
-
const s =
|
|
674
|
-
return this[s] === void 0 &&
|
|
678
|
+
const s = _(e);
|
|
679
|
+
return this[s] === void 0 && a(this, i, O).call(this, t, "", s), s;
|
|
675
680
|
}, mt = function(t) {
|
|
676
681
|
const e = h(this, m).propToExprsMap.get(t) || [];
|
|
677
|
-
|
|
678
|
-
},
|
|
682
|
+
a(this, i, lt).call(this, e);
|
|
683
|
+
}, qt = function(t, e) {
|
|
679
684
|
const s = h(this, m), o = s.propToComputedMap;
|
|
680
685
|
function n(p, u) {
|
|
681
686
|
let d = o.get(p);
|
|
@@ -683,30 +688,30 @@ ut = function() {
|
|
|
683
688
|
}
|
|
684
689
|
const { computed: r } = e, l = r.match(it) || [];
|
|
685
690
|
for (const p of l) {
|
|
686
|
-
const u =
|
|
687
|
-
this[u] === void 0 &&
|
|
691
|
+
const u = _(p);
|
|
692
|
+
this[u] === void 0 && a(this, i, O).call(this, null, t, u), typeof this[u] != "function" && n(u, r);
|
|
688
693
|
}
|
|
689
|
-
for (const p of r.matchAll(
|
|
694
|
+
for (const p of r.matchAll($t)) {
|
|
690
695
|
const u = p[1];
|
|
691
696
|
if (typeof this[u] != "function")
|
|
692
697
|
throw new v(
|
|
693
698
|
`property ${t} computed calls non-method ${u}`
|
|
694
699
|
);
|
|
695
700
|
for (const [d, b] of Object.entries(s.properties))
|
|
696
|
-
|
|
701
|
+
Rt(b.usedBy)?.includes(u) && n(d, r);
|
|
697
702
|
}
|
|
698
|
-
},
|
|
699
|
-
h(this,
|
|
703
|
+
}, q = function(t, e) {
|
|
704
|
+
h(this, j).add(t);
|
|
700
705
|
try {
|
|
701
706
|
this[t] = e;
|
|
702
707
|
} finally {
|
|
703
|
-
h(this,
|
|
708
|
+
h(this, j).delete(t);
|
|
704
709
|
}
|
|
705
710
|
}, // WARNING: Do not place untrusted JavaScript expressions
|
|
706
711
|
// in attribute values or the text content of elements!
|
|
707
|
-
|
|
712
|
+
J = function(t, e, s = void 0) {
|
|
708
713
|
if (!t) return;
|
|
709
|
-
const o =
|
|
714
|
+
const o = a(this, i, G).call(this, e, s, t);
|
|
710
715
|
if (!o) {
|
|
711
716
|
const p = t.replaceAll("this..", "this.");
|
|
712
717
|
s ? rt(e, s, p) : "textContent" in e && (e.textContent = p);
|
|
@@ -714,7 +719,7 @@ q = function(t, e, s = void 0) {
|
|
|
714
719
|
}
|
|
715
720
|
const n = h(this, m);
|
|
716
721
|
o.forEach((p) => {
|
|
717
|
-
const u =
|
|
722
|
+
const u = _(p);
|
|
718
723
|
if (typeof this[u] == "function") return;
|
|
719
724
|
const d = n.propToExprsMap;
|
|
720
725
|
let b = d.get(u);
|
|
@@ -729,27 +734,30 @@ q = function(t, e, s = void 0) {
|
|
|
729
734
|
);
|
|
730
735
|
}
|
|
731
736
|
let r = h(this, T).get(t);
|
|
732
|
-
r || (r = [], h(this, T).set(t, r)), r.push(s ? { element: e, attrName: s } : e), e instanceof HTMLElement &&
|
|
733
|
-
const l =
|
|
734
|
-
s ? rt(e, s, l) :
|
|
735
|
-
},
|
|
737
|
+
r || (r = [], h(this, T).set(t, r)), r.push(s ? { element: e, attrName: s } : e), e instanceof HTMLElement && a(this, i, zt).call(this, e, s, o);
|
|
738
|
+
const l = a(this, i, S).call(this, t);
|
|
739
|
+
s ? rt(e, s, l) : a(this, i, gt).call(this, e, l);
|
|
740
|
+
}, Jt = function(t, e) {
|
|
741
|
+
const s = e?.trim() ?? "", o = h(this, m).properties[s];
|
|
742
|
+
o || a(this, i, O).call(this, t, "ref", s), o.type !== Ct && a(this, i, g).call(this, t, "ref", `refers to property "${s}" whose type is not HTMLElement`), this[s] = t;
|
|
743
|
+
}, g = function(t, e, s) {
|
|
736
744
|
const o = t instanceof HTMLElement ? t.localName : "CSS rule";
|
|
737
745
|
throw new v(
|
|
738
746
|
`component ${h(this, m).elementName}` + (t ? `, element "${o}"` : "") + (e ? `, attribute "${e}"` : "") + ` ${s}`
|
|
739
747
|
);
|
|
740
|
-
},
|
|
741
|
-
|
|
748
|
+
}, O = function(t, e, s) {
|
|
749
|
+
a(this, i, g).call(this, t, e, `refers to missing property "${s}"`);
|
|
742
750
|
}, bt = function(t, e) {
|
|
743
|
-
return
|
|
751
|
+
return a(this, i, yt).call(this, t, this.getAttribute(e));
|
|
744
752
|
}, yt = function(t, e) {
|
|
745
753
|
if (e?.match(it)) return e;
|
|
746
754
|
const o = h(this, m).properties[t], { type: n, values: r } = o;
|
|
747
|
-
if (n ||
|
|
755
|
+
if (n || a(this, i, g).call(this, null, t, "does not specify its type"), e === null)
|
|
748
756
|
return n === Boolean ? !1 : Pt(o);
|
|
749
757
|
if (n === String) {
|
|
750
758
|
if (r && !r.includes(e)) {
|
|
751
759
|
const l = r.map((p) => `"${p}"`).join(", ");
|
|
752
|
-
|
|
760
|
+
a(this, i, g).call(this, null, t, `must be one of ${l}`);
|
|
753
761
|
}
|
|
754
762
|
return e;
|
|
755
763
|
}
|
|
@@ -757,39 +765,39 @@ q = function(t, e, s = void 0) {
|
|
|
757
765
|
if (n === Boolean) {
|
|
758
766
|
if (e === "true") return !0;
|
|
759
767
|
if (e === "false" || e === "null") return !1;
|
|
760
|
-
const l =
|
|
761
|
-
return e && e !== l &&
|
|
768
|
+
const l = w.getAttrName(t);
|
|
769
|
+
return e && e !== l && a(this, i, g).call(this, null, t, "is a Boolean attribute, so its value must match attribute name or be missing"), e === "" || e === l;
|
|
762
770
|
}
|
|
763
771
|
}, // Updates the matching attribute for a property.
|
|
764
772
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
765
|
-
|
|
766
|
-
if (Y(s) && !
|
|
767
|
-
const n = e === Boolean ? this.hasAttribute(o) :
|
|
768
|
-
s !== n &&
|
|
773
|
+
Kt = function(t, e, s, o) {
|
|
774
|
+
if (Y(s) && !a(this, i, z).call(this, t)) {
|
|
775
|
+
const n = e === Boolean ? this.hasAttribute(o) : a(this, i, bt).call(this, t, o);
|
|
776
|
+
s !== n && It(this, o || t, s);
|
|
769
777
|
}
|
|
770
778
|
}, // Updates all computed properties that reference this property.
|
|
771
779
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
772
|
-
|
|
780
|
+
Xt = function(t) {
|
|
773
781
|
const s = h(this, m).propToComputedMap.get(t) || [];
|
|
774
782
|
for (const [o, n] of s)
|
|
775
|
-
|
|
783
|
+
a(this, i, q).call(this, o, a(this, i, S).call(this, n));
|
|
776
784
|
}, gt = function(t, e) {
|
|
777
785
|
if (e === void 0) return;
|
|
778
786
|
const s = t instanceof HTMLElement;
|
|
779
787
|
Array.isArray(e) && (e = e.join(""));
|
|
780
788
|
const o = typeof e;
|
|
781
|
-
o !== "string" && o !== "number" &&
|
|
789
|
+
o !== "string" && o !== "number" && a(this, i, g).call(this, t, void 0, " computed content is not a string or number");
|
|
782
790
|
const n = String(e);
|
|
783
|
-
if (t instanceof HTMLElement &&
|
|
791
|
+
if (t instanceof HTMLElement && V(t))
|
|
784
792
|
t.value = n;
|
|
785
793
|
else if (s && o === "string" && n.trim().startsWith("<")) {
|
|
786
|
-
const r =
|
|
787
|
-
t.innerHTML = r,
|
|
794
|
+
const r = se(n);
|
|
795
|
+
t.innerHTML = r, a(this, i, wt).call(this, t), a(this, i, pt).call(this, t);
|
|
788
796
|
} else s && (t.textContent = n);
|
|
789
797
|
}, // Update corresponding parent web component property if bound to one.
|
|
790
798
|
// VS Code thinks this is never called, but it is called by #defineProp.
|
|
791
|
-
|
|
792
|
-
const s = h(this,
|
|
799
|
+
Ut = function(t, e) {
|
|
800
|
+
const s = h(this, I).get(t);
|
|
793
801
|
if (!s) return;
|
|
794
802
|
const o = this.getRootNode();
|
|
795
803
|
if (!(o instanceof ShadowRoot)) return;
|
|
@@ -799,14 +807,14 @@ Kt = function(t, e) {
|
|
|
799
807
|
r[s] = e;
|
|
800
808
|
}, // This adds expressions to the expressions arrays in propToExprsMap
|
|
801
809
|
// that contain calls to methods listed the usedBy array or each property.
|
|
802
|
-
|
|
810
|
+
Zt = function() {
|
|
803
811
|
const t = h(this, m);
|
|
804
812
|
function e() {
|
|
805
813
|
const n = /* @__PURE__ */ new Map();
|
|
806
814
|
t.methodToExprsMap = n;
|
|
807
815
|
const r = Array.from(h(this, T).keys());
|
|
808
816
|
for (const l of r)
|
|
809
|
-
for (const p of l.matchAll(
|
|
817
|
+
for (const p of l.matchAll($t)) {
|
|
810
818
|
const u = p[1];
|
|
811
819
|
let d = n.get(u);
|
|
812
820
|
d || (d = [], n.set(u, d)), d.includes(l) || d.push(l);
|
|
@@ -814,7 +822,7 @@ Xt = function() {
|
|
|
814
822
|
}
|
|
815
823
|
const { properties: s, propToExprsMap: o } = t;
|
|
816
824
|
for (const [n, r] of Object.entries(s)) {
|
|
817
|
-
const l =
|
|
825
|
+
const l = Rt(r.usedBy);
|
|
818
826
|
if (!l) continue;
|
|
819
827
|
t.methodToExprsMap || e.call(this);
|
|
820
828
|
const { methodToExprsMap: p } = t;
|
|
@@ -830,49 +838,49 @@ Xt = function() {
|
|
|
830
838
|
u.includes(E) || u.push(E);
|
|
831
839
|
}
|
|
832
840
|
}
|
|
833
|
-
},
|
|
841
|
+
}, Yt = function() {
|
|
834
842
|
const t = new Set(Object.keys(h(this, m).properties));
|
|
835
843
|
for (const e of this.getAttributeNames())
|
|
836
|
-
if (!
|
|
844
|
+
if (!oe.has(e) && !e.startsWith("on")) {
|
|
837
845
|
if (e === "form-assoc") {
|
|
838
|
-
|
|
846
|
+
a(this, i, ut).call(this);
|
|
839
847
|
continue;
|
|
840
848
|
}
|
|
841
|
-
if (!t.has(
|
|
849
|
+
if (!t.has(w.getPropName(e))) {
|
|
842
850
|
if (e === "name") {
|
|
843
|
-
|
|
851
|
+
a(this, i, ut).call(this);
|
|
844
852
|
continue;
|
|
845
853
|
}
|
|
846
|
-
|
|
854
|
+
a(this, i, g).call(this, null, e, "is not a supported attribute");
|
|
847
855
|
}
|
|
848
856
|
}
|
|
849
857
|
}, G = function(t, e, s) {
|
|
850
858
|
const o = s.match(it);
|
|
851
859
|
if (o)
|
|
852
860
|
return o.forEach((n) => {
|
|
853
|
-
const r =
|
|
854
|
-
this[r] === void 0 &&
|
|
861
|
+
const r = _(n);
|
|
862
|
+
this[r] === void 0 && a(this, i, O).call(this, t, e, r);
|
|
855
863
|
}), o;
|
|
856
|
-
},
|
|
864
|
+
}, Gt = function(t, e) {
|
|
857
865
|
for (const [s, o] of Object.entries(e)) {
|
|
858
866
|
let n = St(t, s);
|
|
859
|
-
n === void 0 &&
|
|
867
|
+
n === void 0 && a(this, i, g).call(this, this, void 0, `invalid state path "${s}"`), n = this[o], a(this, i, W).call(this, o) || a(this, i, g).call(this, null, o, "refers to missing property in useState map");
|
|
860
868
|
}
|
|
861
869
|
}, // When type is an array, this can't validate the type of the array elements.
|
|
862
870
|
// This is called by #defineProp.
|
|
863
|
-
|
|
871
|
+
Qt = function(t, e, s) {
|
|
864
872
|
const { values: o } = h(this, m).properties[t];
|
|
865
873
|
if (o) {
|
|
866
874
|
let r;
|
|
867
|
-
e !== String ? r = "declares allowed values, but its type is not String" : typeof s != "string" ? r = `value is a ${typeof s}, but type is String` : o.includes(s) || (r = `must be one of ${o.map((p) => `"${p}"`).join(", ")}`), r &&
|
|
875
|
+
e !== String ? r = "declares allowed values, but its type is not String" : typeof s != "string" ? r = `value is a ${typeof s}, but type is String` : o.includes(s) || (r = `must be one of ${o.map((p) => `"${p}"`).join(", ")}`), r && a(this, i, g).call(this, null, t, r);
|
|
868
876
|
}
|
|
869
877
|
if (s instanceof e) return;
|
|
870
878
|
let n = typeof s;
|
|
871
879
|
if (n === "object") {
|
|
872
880
|
const { constructor: r } = s;
|
|
873
|
-
n = r.name, r !== e &&
|
|
881
|
+
n = r.name, r !== e && a(this, i, g).call(this, null, t, `was set to a ${n}, but must be a ${e.name}`);
|
|
874
882
|
}
|
|
875
|
-
n !== e.name.toLowerCase() &&
|
|
883
|
+
n !== e.name.toLowerCase() && a(this, i, g).call(this, null, t, `was set to a ${n}, but must be a ${e.name}`);
|
|
876
884
|
}, wt = function(t) {
|
|
877
885
|
const e = Array.from(t.querySelectorAll("*"));
|
|
878
886
|
for (const s of e) {
|
|
@@ -883,42 +891,42 @@ Yt = function(t, e, s) {
|
|
|
883
891
|
let l = r.slice(2);
|
|
884
892
|
l = l[0].toLowerCase() + l.slice(1).toLowerCase();
|
|
885
893
|
const p = n.value;
|
|
886
|
-
|
|
894
|
+
a(this, i, G).call(this, s, r, p);
|
|
887
895
|
let u;
|
|
888
|
-
typeof this[p] == "function" ? u = (d) => this[p](d) : (
|
|
896
|
+
typeof this[p] == "function" ? u = (d) => this[p](d) : (a(this, i, G).call(this, s, r, p), u = () => a(this, i, S).call(this, p)), s.addEventListener(l, u), o.push(r);
|
|
889
897
|
}
|
|
890
898
|
}
|
|
891
899
|
for (const n of o)
|
|
892
900
|
s.removeAttribute(n);
|
|
893
901
|
}
|
|
894
|
-
},
|
|
895
|
-
let K =
|
|
896
|
-
function
|
|
897
|
-
let t =
|
|
902
|
+
}, w.attrToPropMap = /* @__PURE__ */ new Map(), w.propToAttrMap = /* @__PURE__ */ new Map(), w.context = {}, w.css = "", w.elementName = "", w.formAssociated = !1, w.html = "", w.template = null;
|
|
903
|
+
let K = w;
|
|
904
|
+
function ye(c, ...f) {
|
|
905
|
+
let t = kt(c, f);
|
|
898
906
|
for (; ; ) {
|
|
899
|
-
const e =
|
|
907
|
+
const e = ie.exec(t);
|
|
900
908
|
if (!e) break;
|
|
901
909
|
const s = e[2];
|
|
902
|
-
if (
|
|
910
|
+
if (Ht.test(s)) {
|
|
903
911
|
const o = e[1];
|
|
904
912
|
if (!o.startsWith("--")) {
|
|
905
913
|
const n = `--${o}: ${s};
|
|
906
914
|
${o}: var(--${o})`;
|
|
907
|
-
t =
|
|
915
|
+
t = Ft(t, e.index, e[0].length, n);
|
|
908
916
|
}
|
|
909
917
|
}
|
|
910
918
|
}
|
|
911
919
|
return t;
|
|
912
920
|
}
|
|
913
|
-
function
|
|
914
|
-
let t =
|
|
921
|
+
function ge(c, ...f) {
|
|
922
|
+
let t = kt(c, f);
|
|
915
923
|
for (; ; ) {
|
|
916
|
-
const e =
|
|
924
|
+
const e = ce.exec(t);
|
|
917
925
|
if (!e || e[1] === "style") break;
|
|
918
|
-
const s =
|
|
919
|
-
if (
|
|
926
|
+
const s = le(e[2]);
|
|
927
|
+
if (Ht.test(s)) {
|
|
920
928
|
const o = `<!-- ${s.trim()} -->`, n = e.index + e[0].indexOf(">") + 1;
|
|
921
|
-
t =
|
|
929
|
+
t = Ft(t, n, s.length, o);
|
|
922
930
|
}
|
|
923
931
|
}
|
|
924
932
|
return t;
|
|
@@ -926,7 +934,7 @@ function ye(c, ...a) {
|
|
|
926
934
|
export {
|
|
927
935
|
K as Wrec,
|
|
928
936
|
ct as WrecState,
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
937
|
+
be as createElement,
|
|
938
|
+
ye as css,
|
|
939
|
+
ge as html
|
|
932
940
|
};
|