wrec 0.39.3 → 0.39.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{wrec-CtwG5h9M.js → wrec-1_q5NXuK.js} +182 -133
- package/dist/wrec-ssr.es.js +1 -1
- package/dist/wrec.es.js +1 -1
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ function t(e, n, r = "") {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
function n(e) {
|
|
21
|
-
let t = {};
|
|
21
|
+
let t = Array.isArray(e) ? [] : {};
|
|
22
22
|
for (let [r, i] of Object.entries(e)) t[r] = typeof i == "object" && i ? n(i) : i;
|
|
23
23
|
return t;
|
|
24
24
|
}
|
|
@@ -140,24 +140,41 @@ function l(e, t, n) {
|
|
|
140
140
|
}
|
|
141
141
|
//#endregion
|
|
142
142
|
//#region src/sanitize-xss.ts
|
|
143
|
-
var u = new Set([
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
var u = "__WREC", d = "__", f = "[A-Za-z_$][A-Za-z0-9_$]*", p = new Set([
|
|
144
|
+
"checked",
|
|
145
|
+
"colspan",
|
|
146
|
+
"disabled",
|
|
147
|
+
"for",
|
|
148
|
+
"id",
|
|
149
|
+
"max",
|
|
150
|
+
"min",
|
|
151
|
+
"name",
|
|
152
|
+
"rowspan",
|
|
153
|
+
"scope",
|
|
154
|
+
"selected",
|
|
155
|
+
"type",
|
|
156
|
+
"value"
|
|
157
|
+
]);
|
|
158
|
+
function m(e, t) {
|
|
159
|
+
return `${u}${e}_${t}${d}`;
|
|
160
|
+
}
|
|
161
|
+
function h(e) {
|
|
162
|
+
return e.replaceAll("&", "&").replaceAll("\"", """).replaceAll("<", "<").replaceAll(">", ">");
|
|
163
|
+
}
|
|
164
|
+
function g(e) {
|
|
165
|
+
let t = e.trim();
|
|
166
|
+
return t ? RegExp(`^${f}$`).test(t) ? !0 : t.startsWith("this.") : !1;
|
|
167
|
+
}
|
|
168
|
+
function _(t) {
|
|
151
169
|
let n = {
|
|
152
170
|
allowCommentTag: !0,
|
|
153
|
-
onTag: (e, t) => {
|
|
154
|
-
if (u.has(e)) return t;
|
|
155
|
-
},
|
|
156
171
|
onTagAttr(e, t, n) {
|
|
157
|
-
if (t.startsWith("on")) return "";
|
|
172
|
+
if (t.startsWith("on")) return g(n) ? `${t}="${h(n)}"` : "";
|
|
173
|
+
if (t === "title" || t.startsWith("aria-") || t.startsWith("data-")) return `${t}="${h(n)}"`;
|
|
174
|
+
if (e === "a" && t === "href" && n.startsWith("javascript")) return "";
|
|
158
175
|
},
|
|
159
176
|
safeAttrValue(e, t, n) {
|
|
160
|
-
return t === "class" || e === "a" && t === "href"
|
|
177
|
+
return t === "class" || p.has(t) || e === "a" && t === "href" || e === "img" && t === "src" ? n : "";
|
|
161
178
|
},
|
|
162
179
|
stripIgnoreTagBody: [
|
|
163
180
|
"script",
|
|
@@ -166,55 +183,87 @@ function p(t) {
|
|
|
166
183
|
],
|
|
167
184
|
whiteList: {
|
|
168
185
|
...e.getDefaultWhiteList(),
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
186
|
+
button: [
|
|
187
|
+
"class",
|
|
188
|
+
"id",
|
|
189
|
+
"type"
|
|
190
|
+
],
|
|
191
|
+
input: [
|
|
192
|
+
"checked",
|
|
193
|
+
"class",
|
|
194
|
+
"disabled",
|
|
195
|
+
"id",
|
|
196
|
+
"max",
|
|
197
|
+
"min",
|
|
198
|
+
"name",
|
|
199
|
+
"type",
|
|
200
|
+
"value"
|
|
201
|
+
],
|
|
202
|
+
label: [
|
|
203
|
+
"class",
|
|
204
|
+
"for",
|
|
205
|
+
"id"
|
|
206
|
+
],
|
|
207
|
+
option: [
|
|
208
|
+
"class",
|
|
209
|
+
"id",
|
|
210
|
+
"selected",
|
|
211
|
+
"value"
|
|
212
|
+
],
|
|
213
|
+
span: ["class", "id"],
|
|
214
|
+
th: [
|
|
215
|
+
"class",
|
|
216
|
+
"colspan",
|
|
217
|
+
"id",
|
|
218
|
+
"rowspan",
|
|
219
|
+
"scope"
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
}, r = [], i = Date.now() + Math.floor(Math.random() * 1e6);
|
|
173
223
|
t = t.replace(/<!--[\s\S]*?-->/g, (e) => {
|
|
174
|
-
let
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
224
|
+
let t = m(i, r.length);
|
|
225
|
+
return r.push({
|
|
226
|
+
comment: e,
|
|
227
|
+
token: t
|
|
228
|
+
}), t;
|
|
179
229
|
});
|
|
180
|
-
let
|
|
181
|
-
return r.forEach((e, t) => {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}), i;
|
|
230
|
+
let a = e(t, n);
|
|
231
|
+
return r.forEach(({ comment: e, token: t }) => {
|
|
232
|
+
a = a.replaceAll(t, e);
|
|
233
|
+
}), a;
|
|
185
234
|
}
|
|
186
235
|
//#endregion
|
|
187
236
|
//#region src/wrec.ts
|
|
188
|
-
var
|
|
237
|
+
var v = () => /* @__PURE__ */ new Map(), y = new Set([
|
|
189
238
|
"class",
|
|
190
239
|
"disabled",
|
|
191
240
|
"hidden",
|
|
192
241
|
"id",
|
|
193
242
|
"tabindex",
|
|
194
243
|
"title"
|
|
195
|
-
]),
|
|
244
|
+
]), b = globalThis.HTMLElement ?? class {}, x = globalThis.customElements ?? {
|
|
196
245
|
get: (e) => void 0,
|
|
197
246
|
getName: (e) => null,
|
|
198
247
|
define: () => {},
|
|
199
248
|
initialize: (e) => {},
|
|
200
249
|
upgrade: (e) => {},
|
|
201
250
|
whenDefined: () => Promise.reject(/* @__PURE__ */ Error("customElements is not available in this environment"))
|
|
202
|
-
},
|
|
203
|
-
function
|
|
204
|
-
return e instanceof HTMLButtonElement || e instanceof HTMLFieldSetElement || e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof
|
|
251
|
+
}, S = class extends Error {}, ee = /([a-zA-Z-]+)\s*:\s*([^;}]+)/g, C = "a-zA-Z_$", w = `[${C}][${C + "0-9"}]*`, T = RegExp(`this\\.(${w})\\s*\\(`, "g"), E = /<!--\s*(.*?)\s*-->/, D = /<(\w+)(?:\s[^>]*)?>((?:[^<]|<(?!\w))*?)<\/\1>/g, O = RegExp(`^this\\.${w}$`), k = RegExp(`this\\.${w}(\\.${w})*`, "g"), A = RegExp(`this\\.${w}(\\.${w})*`), j = 5;
|
|
252
|
+
function M(e) {
|
|
253
|
+
return e instanceof HTMLButtonElement || e instanceof HTMLFieldSetElement || e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof $;
|
|
205
254
|
}
|
|
206
|
-
function
|
|
255
|
+
function N(e, t, n) {
|
|
207
256
|
let r = document.createElement(e);
|
|
208
257
|
if (t) for (let [e, n] of Object.entries(t)) r.setAttribute(e, n);
|
|
209
258
|
return n && (r.innerHTML = n), r;
|
|
210
259
|
}
|
|
211
|
-
var
|
|
212
|
-
function
|
|
260
|
+
var P = (e) => Array.isArray(e.values) && e.values.length > 0 ? e.values[0] : F(e.type), F = (e) => e === String ? "" : e === Number ? 0 : e === Boolean ? !1 : e === Array ? [] : e === Object ? {} : void 0;
|
|
261
|
+
function I(e) {
|
|
213
262
|
let t = [], n = e.firstElementChild;
|
|
214
|
-
for (; n;) t.push(n), n.shadowRoot && t.push(...
|
|
263
|
+
for (; n;) t.push(n), n.shadowRoot && t.push(...I(n.shadowRoot)), n.firstElementChild && t.push(...I(n)), n = n.nextElementSibling;
|
|
215
264
|
return t;
|
|
216
265
|
}
|
|
217
|
-
function
|
|
266
|
+
function te(e, t) {
|
|
218
267
|
let n = e;
|
|
219
268
|
for (; n;) {
|
|
220
269
|
let e = Object.getOwnPropertyDescriptor(n, t);
|
|
@@ -222,73 +271,73 @@ function P(e, t) {
|
|
|
222
271
|
n = Object.getPrototypeOf(n);
|
|
223
272
|
}
|
|
224
273
|
}
|
|
225
|
-
var
|
|
226
|
-
function
|
|
274
|
+
var L = (e) => e.substring(j).split(".")[0];
|
|
275
|
+
function R(e) {
|
|
227
276
|
return e.substring(4).trim();
|
|
228
277
|
}
|
|
229
|
-
function
|
|
278
|
+
function z(e, t) {
|
|
230
279
|
let n = e[0];
|
|
231
280
|
return t.forEach((t, r) => {
|
|
232
281
|
n += t + e[r + 1];
|
|
233
282
|
}), n;
|
|
234
283
|
}
|
|
235
|
-
function
|
|
284
|
+
function B(e) {
|
|
236
285
|
return e instanceof HTMLInputElement && e.type === "checkbox";
|
|
237
286
|
}
|
|
238
|
-
function
|
|
287
|
+
function V(e) {
|
|
239
288
|
return e.startsWith("get ");
|
|
240
289
|
}
|
|
241
|
-
function
|
|
290
|
+
function H(e) {
|
|
242
291
|
let t = typeof e;
|
|
243
292
|
return t === "string" || t === "number" || t === "boolean";
|
|
244
293
|
}
|
|
245
|
-
function
|
|
294
|
+
function U(e) {
|
|
246
295
|
return e instanceof HTMLInputElement && e.type === "radio";
|
|
247
296
|
}
|
|
248
|
-
function
|
|
297
|
+
function W(e) {
|
|
249
298
|
return e.localName === "textarea";
|
|
250
299
|
}
|
|
251
|
-
function
|
|
300
|
+
function G(e) {
|
|
252
301
|
let { localName: t } = e;
|
|
253
302
|
return t === "input" || t === "select";
|
|
254
303
|
}
|
|
255
|
-
var
|
|
256
|
-
function
|
|
304
|
+
var K = (e) => `get ${e}`, q = (e) => e.replace(/<!--[\s\S]*?-->/g, "");
|
|
305
|
+
function J(e, t, n, r) {
|
|
257
306
|
return e.slice(0, t) + r + e.slice(t + n);
|
|
258
307
|
}
|
|
259
|
-
function
|
|
308
|
+
function Y(e) {
|
|
260
309
|
let t = Number(e);
|
|
261
|
-
if (isNaN(t)) throw new
|
|
310
|
+
if (isNaN(t)) throw new S(`can't convert "${e}" to a number`);
|
|
262
311
|
return t;
|
|
263
312
|
}
|
|
264
|
-
function
|
|
313
|
+
function X(e, t, n) {
|
|
265
314
|
let [r] = t.split(":");
|
|
266
|
-
if (r === "checked" &&
|
|
315
|
+
if (r === "checked" && U(e) && typeof n == "string") {
|
|
267
316
|
let t = e.value === n;
|
|
268
317
|
t ? e.setAttribute(r, r) : e.removeAttribute(r), e.checked = t;
|
|
269
318
|
return;
|
|
270
319
|
}
|
|
271
|
-
if (
|
|
320
|
+
if (H(n)) if (typeof n == "boolean") {
|
|
272
321
|
n ? e.setAttribute(r, r) : e.removeAttribute(r);
|
|
273
|
-
let t =
|
|
322
|
+
let t = $.getPropName(r);
|
|
274
323
|
e[t] = n;
|
|
275
324
|
} else {
|
|
276
325
|
let i = e.getAttribute(t), a = String(n);
|
|
277
|
-
i !== a && (e.setAttribute(r, a), r === "value" &&
|
|
326
|
+
i !== a && (e.setAttribute(r, a), r === "value" && G(e) && (e.value = a));
|
|
278
327
|
}
|
|
279
328
|
else {
|
|
280
|
-
let r =
|
|
329
|
+
let r = $.getPropName(t);
|
|
281
330
|
e[r] = n;
|
|
282
331
|
}
|
|
283
332
|
}
|
|
284
|
-
function
|
|
333
|
+
function Z(e, t, n) {
|
|
285
334
|
let [r] = t.split(":");
|
|
286
|
-
e instanceof CSSStyleRule ? e.style.getPropertyValue(r) !== n && e.style.setProperty(r, n) : (
|
|
335
|
+
e instanceof CSSStyleRule ? e.style.getPropertyValue(r) !== n && e.style.setProperty(r, n) : (X(e, r, n), r === "value" && G(e) && e.value !== n && (e.value = n));
|
|
287
336
|
}
|
|
288
|
-
var
|
|
289
|
-
async function
|
|
337
|
+
var Q = (e) => typeof e == "string" ? [e] : e;
|
|
338
|
+
async function ne(e) {
|
|
290
339
|
let t = /* @__PURE__ */ new Set();
|
|
291
|
-
for (let n of
|
|
340
|
+
for (let n of I(e.content)) {
|
|
292
341
|
let { localName: e } = n;
|
|
293
342
|
e.includes("-") && t.add(e);
|
|
294
343
|
}
|
|
@@ -300,9 +349,9 @@ async function Z(e) {
|
|
|
300
349
|
}, 1e3);
|
|
301
350
|
});
|
|
302
351
|
}
|
|
303
|
-
return Promise.all([...t].map(async (e) => Promise.race([
|
|
352
|
+
return Promise.all([...t].map(async (e) => Promise.race([x.whenDefined(e), n(e)])));
|
|
304
353
|
}
|
|
305
|
-
var
|
|
354
|
+
var $ = class e extends b {
|
|
306
355
|
static {
|
|
307
356
|
this.attrToPropMap = /* @__PURE__ */ new Map();
|
|
308
357
|
}
|
|
@@ -341,8 +390,8 @@ var Q = class e extends g {
|
|
|
341
390
|
#d = /* @__PURE__ */ new WeakSet();
|
|
342
391
|
#f = /* @__PURE__ */ new Map();
|
|
343
392
|
static define(e) {
|
|
344
|
-
if (this.elementName = e,
|
|
345
|
-
|
|
393
|
+
if (this.elementName = e, x.get(e)) throw new S(`custom element ${e} is already defined`);
|
|
394
|
+
x.define(e, this);
|
|
346
395
|
}
|
|
347
396
|
constructor() {
|
|
348
397
|
super(), this.attachShadow({ mode: "open" });
|
|
@@ -377,13 +426,13 @@ var Q = class e extends g {
|
|
|
377
426
|
}
|
|
378
427
|
async #p() {
|
|
379
428
|
let e = this.#n, { template: t } = e;
|
|
380
|
-
t || (t = e.template = document.createElement("template"), t.innerHTML = e.buildHTML()), await
|
|
429
|
+
t || (t = e.template = document.createElement("template"), t.innerHTML = e.buildHTML()), await ne(t), this.shadowRoot.replaceChildren(t.content.cloneNode(!0));
|
|
381
430
|
}
|
|
382
431
|
static buildHTML() {
|
|
383
432
|
let e = "<style>\n :host([hidden]) { display: none; }";
|
|
384
433
|
this.css && (e += this.css), e += "</style>\n";
|
|
385
434
|
let t = this.html.trim();
|
|
386
|
-
if (!t) throw new
|
|
435
|
+
if (!t) throw new S("static property html must be set");
|
|
387
436
|
return t.startsWith("<") || (t = `<span><!--${t}--></span>`), e + t;
|
|
388
437
|
}
|
|
389
438
|
changed(e, t, n) {
|
|
@@ -403,19 +452,19 @@ var Q = class e extends g {
|
|
|
403
452
|
this.#F();
|
|
404
453
|
}
|
|
405
454
|
#g(t, n, r) {
|
|
406
|
-
if (t === "class" || t === "style") throw new
|
|
455
|
+
if (t === "class" || t === "style") throw new S(`"${t}" is a reserved property`);
|
|
407
456
|
let i = e.getAttrName(t), a = this.hasAttribute(i);
|
|
408
457
|
n.required && !a && this.#V(this, i, "is a required attribute");
|
|
409
458
|
let o = n.value;
|
|
410
459
|
this.hasOwnProperty(t) && (o = this.#T(t), this.#_(t));
|
|
411
|
-
let { type: s } = n, c = s === Boolean ? o || a : r.includes(i) && a ? this.#U(t, i) : o ??
|
|
460
|
+
let { type: s } = n, c = s === Boolean ? o || a : r.includes(i) && a ? this.#U(t, i) : o ?? P(n), u = "#" + t;
|
|
412
461
|
this.#R(u, this.#j(t, s, c)), Object.defineProperty(this, t, {
|
|
413
462
|
enumerable: !0,
|
|
414
463
|
get() {
|
|
415
464
|
return this.#T(u);
|
|
416
465
|
},
|
|
417
466
|
set(e) {
|
|
418
|
-
n.computed && !this.#t.has(t) && this.#V(null, t, "is a computed property and cannot be set directly"), s === Number && typeof e == "string" && (e =
|
|
467
|
+
n.computed && !this.#t.has(t) && this.#V(null, t, "is a computed property and cannot be set directly"), s === Number && typeof e == "string" && (e = Y(e));
|
|
419
468
|
let r = this.#T(u);
|
|
420
469
|
if (e === r) return;
|
|
421
470
|
this.#$(t, s, e), e = this.#j(t, s, e), this.#R(u, e);
|
|
@@ -435,8 +484,8 @@ var Q = class e extends g {
|
|
|
435
484
|
delete this[e];
|
|
436
485
|
}
|
|
437
486
|
#v() {
|
|
438
|
-
let t = this.hasAttribute("disabled"), n =
|
|
439
|
-
for (let r of n)
|
|
487
|
+
let t = this.hasAttribute("disabled"), n = I(this.shadowRoot);
|
|
488
|
+
for (let r of n) M(r) && (r instanceof e ? t ? r.setAttribute("disabled", "") : r.removeAttribute("disabled") : r.disabled = t);
|
|
440
489
|
}
|
|
441
490
|
disconnectedCallback() {
|
|
442
491
|
for (let { unsubscribe: e } of this.#f.values()) e();
|
|
@@ -467,10 +516,10 @@ var Q = class e extends g {
|
|
|
467
516
|
let [o, s] = r.split(":"), c = e.getPropName(o);
|
|
468
517
|
if (o === "checked") {
|
|
469
518
|
let { type: e } = this.#n.properties[a];
|
|
470
|
-
|
|
519
|
+
B(t) && e !== Boolean && this.#V(t, r, `refers to property "${a}" whose type is not Boolean`), U(t) && e !== String && this.#V(t, r, `refers to property "${a}" whose type is not String`);
|
|
471
520
|
}
|
|
472
521
|
let l = this.#A(a);
|
|
473
|
-
n && t.#A(c) || (o === "checked" &&
|
|
522
|
+
n && t.#A(c) || (o === "checked" && U(t) ? t.checked = t.value === i : t[c] = i), o === "value" && (s ? (t["on" + s] === void 0 && this.#V(t, r, "refers to an unsupported event name"), t.setAttribute(o, this.#T(a))) : s = "change"), n && !l && t.#c.set(e.getPropName(o), a);
|
|
474
523
|
}
|
|
475
524
|
this.#z(i, t, r);
|
|
476
525
|
}
|
|
@@ -487,7 +536,7 @@ var Q = class e extends g {
|
|
|
487
536
|
if (t instanceof HTMLElement) this.#q(t, e);
|
|
488
537
|
else if (!(t instanceof CSSStyleRule)) {
|
|
489
538
|
let { element: n, attrName: r } = t;
|
|
490
|
-
n instanceof CSSStyleRule ? n.style.setProperty(r, e) :
|
|
539
|
+
n instanceof CSSStyleRule ? n.style.setProperty(r, e) : Z(n, r, e);
|
|
491
540
|
}
|
|
492
541
|
}
|
|
493
542
|
if (r.size > 0) {
|
|
@@ -513,9 +562,9 @@ var Q = class e extends g {
|
|
|
513
562
|
}
|
|
514
563
|
} else {
|
|
515
564
|
let t = "";
|
|
516
|
-
if (
|
|
565
|
+
if (W(e)) {
|
|
517
566
|
this.#z(e.textContent, e);
|
|
518
|
-
let n = e.textContent?.match(
|
|
567
|
+
let n = e.textContent?.match(E);
|
|
519
568
|
n && (t = n[1]);
|
|
520
569
|
} else {
|
|
521
570
|
let n = Array.from(e.childNodes).find((e) => e.nodeType === Node.COMMENT_NODE);
|
|
@@ -523,7 +572,7 @@ var Q = class e extends g {
|
|
|
523
572
|
}
|
|
524
573
|
if (t) {
|
|
525
574
|
let n = this.#N(e, t);
|
|
526
|
-
n &&
|
|
575
|
+
n && W(e) ? e.textContent = this.#T(n) : this.#z(t, e);
|
|
527
576
|
}
|
|
528
577
|
}
|
|
529
578
|
}
|
|
@@ -543,7 +592,7 @@ var Q = class e extends g {
|
|
|
543
592
|
this.#i = t, this.#a = new FormData(), this.#s = this.attachInternals(), this.#s.setFormValue(this.#a);
|
|
544
593
|
for (let [e, n] of Object.entries(t)) {
|
|
545
594
|
let t = this.#T(e);
|
|
546
|
-
|
|
595
|
+
H(t) && this.setFormValue(n, String(t));
|
|
547
596
|
}
|
|
548
597
|
let r = Object.keys(this.#n.properties), i = this.#o;
|
|
549
598
|
for (let e of r) i[e] = this.#T(e);
|
|
@@ -552,7 +601,7 @@ var Q = class e extends g {
|
|
|
552
601
|
let e = this.#o;
|
|
553
602
|
for (let t of Object.keys(e)) {
|
|
554
603
|
let n = e[t];
|
|
555
|
-
|
|
604
|
+
O.test(n) && (n = this.#x(n)), this.#R(t, n);
|
|
556
605
|
}
|
|
557
606
|
}
|
|
558
607
|
static getAttrName(e) {
|
|
@@ -562,7 +611,7 @@ var Q = class e extends g {
|
|
|
562
611
|
#C() {
|
|
563
612
|
let e = this.#n, t = e.computedGraph;
|
|
564
613
|
if (t) return t;
|
|
565
|
-
let n =
|
|
614
|
+
let n = v(), r = v(), i = {};
|
|
566
615
|
for (let t of e.registeredComputedProps) n.set(t, []);
|
|
567
616
|
for (let [t, a] of e.propToComputedMap) for (let [o, s] of a) {
|
|
568
617
|
if (i[o] = s, !e.registeredComputedProps.has(o) || (n.has(o) || n.set(o, []), !e.registeredComputedProps.has(t))) continue;
|
|
@@ -598,7 +647,7 @@ var Q = class e extends g {
|
|
|
598
647
|
l.set(e, t), t === 0 && s.push(e);
|
|
599
648
|
}
|
|
600
649
|
}
|
|
601
|
-
if (c.length !== a.size) throw new
|
|
650
|
+
if (c.length !== a.size) throw new S(`computed properties form a cycle: ${[...a].filter((e) => l.get(e) > 0).sort().join(", ")}`);
|
|
602
651
|
return c.map((e) => [e, r[e]]);
|
|
603
652
|
}
|
|
604
653
|
#T(e) {
|
|
@@ -615,16 +664,16 @@ var Q = class e extends g {
|
|
|
615
664
|
#D(e, t, n) {
|
|
616
665
|
if (n.length !== 1) return;
|
|
617
666
|
let [r] = n;
|
|
618
|
-
if (!
|
|
619
|
-
let i =
|
|
620
|
-
if (!(o && s === "value" || i && s === "checked" || a && s === "checked" ||
|
|
667
|
+
if (!O.test(r)) return;
|
|
668
|
+
let i = B(e), a = U(e), o = G(e) || W(e), [s, c] = (t ?? "").split(":");
|
|
669
|
+
if (!(o && s === "value" || i && s === "checked" || a && s === "checked" || W(e))) return;
|
|
621
670
|
c ? e["on" + c] === void 0 && this.#V(e, t, "refers to an unsupported event name") : c = "change";
|
|
622
|
-
let l =
|
|
671
|
+
let l = L(r);
|
|
623
672
|
e.addEventListener(c, (e) => {
|
|
624
673
|
let { target: t } = e;
|
|
625
674
|
if (!t) return;
|
|
626
675
|
let { type: n } = this.#n.properties[l], r = t, { value: o } = r;
|
|
627
|
-
s === "checked" ? i ? this.#R(l, r.checked) : a && r.checked && this.#R(l, o) : this.#R(l, n === Number ?
|
|
676
|
+
s === "checked" ? i ? this.#R(l, r.checked) : a && r.checked && this.#R(l, o) : this.#R(l, n === Number ? Y(o) : o), this.#P(l);
|
|
628
677
|
});
|
|
629
678
|
}
|
|
630
679
|
#O(e) {
|
|
@@ -655,8 +704,8 @@ var Q = class e extends g {
|
|
|
655
704
|
}
|
|
656
705
|
propertyChangedCallback(e, t, n) {}
|
|
657
706
|
#N(e, t) {
|
|
658
|
-
if (!t || !
|
|
659
|
-
let n =
|
|
707
|
+
if (!t || !O.test(t)) return;
|
|
708
|
+
let n = L(t);
|
|
660
709
|
return this.#T(n) === void 0 && this.#H(e, "", n), n;
|
|
661
710
|
}
|
|
662
711
|
#P(e) {
|
|
@@ -680,17 +729,17 @@ var Q = class e extends g {
|
|
|
680
729
|
i || (i = [], r.set(t, i)), i.push([e, n]);
|
|
681
730
|
}
|
|
682
731
|
let a = t.computed;
|
|
683
|
-
for (let t of a.matchAll(
|
|
684
|
-
let r =
|
|
732
|
+
for (let t of a.matchAll(k)) {
|
|
733
|
+
let r = L(t[0]);
|
|
685
734
|
this.#T(r) === void 0 && this.#H(null, e, r);
|
|
686
|
-
let o =
|
|
687
|
-
for (let [e, t] of Object.entries(n.properties))
|
|
735
|
+
let o = K(r), s = !1;
|
|
736
|
+
for (let [e, t] of Object.entries(n.properties)) Q(t.usedBy)?.includes(o) && (i(e, a), s = !0);
|
|
688
737
|
!s && typeof this.#T(r) != "function" && i(r, a);
|
|
689
738
|
}
|
|
690
|
-
for (let t of a.matchAll(
|
|
739
|
+
for (let t of a.matchAll(T)) {
|
|
691
740
|
let r = t[1];
|
|
692
|
-
if (typeof this.#T(r) != "function") throw new
|
|
693
|
-
for (let [e, t] of Object.entries(n.properties))
|
|
741
|
+
if (typeof this.#T(r) != "function") throw new S(`property ${e} computed calls non-method ${r}`);
|
|
742
|
+
for (let [e, t] of Object.entries(n.properties)) Q(t.usedBy)?.includes(r) && i(e, a);
|
|
694
743
|
}
|
|
695
744
|
}
|
|
696
745
|
#L(e, t) {
|
|
@@ -709,12 +758,12 @@ var Q = class e extends g {
|
|
|
709
758
|
let r = this.#Z(t, n, e);
|
|
710
759
|
if (!r) {
|
|
711
760
|
let r = e.replaceAll("this..", "this.");
|
|
712
|
-
n ?
|
|
761
|
+
n ? Z(t, n, r) : "textContent" in t && (t.textContent = r);
|
|
713
762
|
return;
|
|
714
763
|
}
|
|
715
764
|
let i = this.#n;
|
|
716
765
|
r.forEach((t) => {
|
|
717
|
-
let n =
|
|
766
|
+
let n = L(t);
|
|
718
767
|
if (typeof this.#T(n) == "function") return;
|
|
719
768
|
let r = i.propToExprsMap, a = r.get(n);
|
|
720
769
|
a || (a = [], r.set(n, a)), a.includes(e) || a.push(e);
|
|
@@ -729,24 +778,24 @@ var Q = class e extends g {
|
|
|
729
778
|
attrName: n
|
|
730
779
|
} : t), t instanceof HTMLElement && this.#D(t, n, r);
|
|
731
780
|
let o = this.#x(e);
|
|
732
|
-
n ?
|
|
781
|
+
n ? Z(t, n, o) : this.#q(t, o);
|
|
733
782
|
}
|
|
734
783
|
#B(e, t) {
|
|
735
784
|
let n = t?.trim() ?? "", r = this.#n.properties[n];
|
|
736
|
-
r || this.#H(e, "ref", n), r.type !==
|
|
785
|
+
r || this.#H(e, "ref", n), r.type !== b && this.#V(e, "ref", `refers to property "${n}" whose type is not HTMLElement`), this.#T(n) && this.#V(e, "ref", `is a duplicate reference to the property "${n}"`), this.#R(n, e), e.removeAttribute("ref");
|
|
737
786
|
}
|
|
738
787
|
setAttributeSafe(e, t) {
|
|
739
788
|
this.hasAttribute(e) || this.setAttribute(e, t);
|
|
740
789
|
}
|
|
741
790
|
setFormValue(e, t) {
|
|
742
|
-
!this.#a || !
|
|
791
|
+
!this.#a || !H(t) || (this.#a.set(e, t), this.#s?.setFormValue(this.#a));
|
|
743
792
|
}
|
|
744
793
|
static ssr(e = {}) {
|
|
745
|
-
throw new
|
|
794
|
+
throw new S("SSR is not available in the browser build.");
|
|
746
795
|
}
|
|
747
796
|
#V(e, t, n) {
|
|
748
797
|
let r = e instanceof HTMLElement ? e.localName : "CSS rule";
|
|
749
|
-
throw new
|
|
798
|
+
throw new S(`component ${this.#n.elementName}` + (e ? `, element "${r}"` : "") + (t ? `, attribute "${t}"` : "") + ` ${n}`);
|
|
750
799
|
}
|
|
751
800
|
#H(e, t, n) {
|
|
752
801
|
this.#V(e, t, `refers to missing property "${n}"`);
|
|
@@ -755,9 +804,9 @@ var Q = class e extends g {
|
|
|
755
804
|
return this.#W(e, this.getAttribute(t));
|
|
756
805
|
}
|
|
757
806
|
#W(t, n) {
|
|
758
|
-
if (n?.match(
|
|
807
|
+
if (n?.match(k)) return n;
|
|
759
808
|
let r = this.#n.properties[t], { type: i, values: a } = r;
|
|
760
|
-
if (i || this.#V(null, t, "does not specify its type"), n === null) return i === Boolean ? !1 :
|
|
809
|
+
if (i || this.#V(null, t, "does not specify its type"), n === null) return i === Boolean ? !1 : P(r);
|
|
761
810
|
if (i === String) {
|
|
762
811
|
if (a && !a.includes(n)) {
|
|
763
812
|
let e = a.map((e) => `"${e}"`).join(", ");
|
|
@@ -765,7 +814,7 @@ var Q = class e extends g {
|
|
|
765
814
|
}
|
|
766
815
|
return n;
|
|
767
816
|
}
|
|
768
|
-
if (i === Number) return
|
|
817
|
+
if (i === Number) return Y(n);
|
|
769
818
|
if (i === Boolean) {
|
|
770
819
|
if (n === "true") return !0;
|
|
771
820
|
if (n === "false" || n === "null") return !1;
|
|
@@ -774,7 +823,7 @@ var Q = class e extends g {
|
|
|
774
823
|
}
|
|
775
824
|
}
|
|
776
825
|
#G(e, t, n, r) {
|
|
777
|
-
|
|
826
|
+
H(n) && !this.#A(e) && n !== (t === Boolean ? this.hasAttribute(r) : this.#U(e, r)) && X(this, r || e, n);
|
|
778
827
|
}
|
|
779
828
|
#K(e) {
|
|
780
829
|
for (let [t, n] of this.#w([e])) this.#L(t, this.#x(n));
|
|
@@ -786,9 +835,9 @@ var Q = class e extends g {
|
|
|
786
835
|
let r = typeof t;
|
|
787
836
|
r !== "string" && r !== "number" && this.#V(e, void 0, " computed content is not a string or number");
|
|
788
837
|
let i = String(t);
|
|
789
|
-
if (e instanceof HTMLElement &&
|
|
838
|
+
if (e instanceof HTMLElement && W(e)) e.value !== i && (e.value = i);
|
|
790
839
|
else if (n && r === "string" && i.trim().startsWith("<")) {
|
|
791
|
-
let t =
|
|
840
|
+
let t = _(i);
|
|
792
841
|
if (e.innerHTML === t) return;
|
|
793
842
|
e.innerHTML = t, this.#te(e), this.#M(e);
|
|
794
843
|
} else n && e.textContent !== i && (e.textContent = i);
|
|
@@ -808,25 +857,25 @@ var Q = class e extends g {
|
|
|
808
857
|
let r = e.get(t);
|
|
809
858
|
r || (r = [], e.set(t, r)), r.includes(n) || r.push(n);
|
|
810
859
|
}, n = () => {
|
|
811
|
-
let n =
|
|
860
|
+
let n = v();
|
|
812
861
|
e.methodToExprsMap = n;
|
|
813
862
|
let r = Array.from(this.#r.keys());
|
|
814
863
|
for (let e of r) {
|
|
815
|
-
for (let r of e.matchAll(
|
|
816
|
-
for (let r of e.matchAll(
|
|
864
|
+
for (let r of e.matchAll(T)) t(n, r[1], e);
|
|
865
|
+
for (let r of e.matchAll(k)) t(n, K(L(r[0])), e);
|
|
817
866
|
}
|
|
818
867
|
}, { properties: r, propToExprsMap: i } = e;
|
|
819
868
|
for (let [t, a] of Object.entries(r)) {
|
|
820
|
-
let r =
|
|
869
|
+
let r = Q(a.usedBy);
|
|
821
870
|
if (!r) continue;
|
|
822
871
|
e.methodToExprsMap || n();
|
|
823
872
|
let { methodToExprsMap: o } = e, s = i.get(t);
|
|
824
873
|
s || (s = [], i.set(t, s));
|
|
825
874
|
for (let e of r) {
|
|
826
|
-
if (
|
|
827
|
-
let n =
|
|
828
|
-
if (typeof
|
|
829
|
-
} else if (typeof this.#T(e) != "function") throw new
|
|
875
|
+
if (V(e)) {
|
|
876
|
+
let n = R(e);
|
|
877
|
+
if (typeof te(this, n)?.get != "function") throw new S(`property ${t} usedBy contains non-getter ${e}`);
|
|
878
|
+
} else if (typeof this.#T(e) != "function") throw new S(`property ${t} usedBy contains non-method ${e}`);
|
|
830
879
|
let n = o.get(e) || [];
|
|
831
880
|
for (let e of n) s.includes(e) || s.push(e);
|
|
832
881
|
}
|
|
@@ -868,7 +917,7 @@ var Q = class e extends g {
|
|
|
868
917
|
}
|
|
869
918
|
#X() {
|
|
870
919
|
let t = new Set(Object.keys(this.#n.properties));
|
|
871
|
-
for (let n of this.getAttributeNames()) if (!
|
|
920
|
+
for (let n of this.getAttributeNames()) if (!y.has(n) && !n.startsWith("on") && n !== "ref") {
|
|
872
921
|
if (n === "form-assoc") {
|
|
873
922
|
this.#ee();
|
|
874
923
|
continue;
|
|
@@ -883,9 +932,9 @@ var Q = class e extends g {
|
|
|
883
932
|
}
|
|
884
933
|
}
|
|
885
934
|
#Z(e, t, n) {
|
|
886
|
-
let r = n.match(
|
|
935
|
+
let r = n.match(k);
|
|
887
936
|
if (r) return r.forEach((n) => {
|
|
888
|
-
let r =
|
|
937
|
+
let r = L(n);
|
|
889
938
|
this.#T(r) === void 0 && this.#H(e, t, r);
|
|
890
939
|
}), r;
|
|
891
940
|
}
|
|
@@ -933,35 +982,35 @@ var Q = class e extends g {
|
|
|
933
982
|
}
|
|
934
983
|
}
|
|
935
984
|
};
|
|
936
|
-
function
|
|
937
|
-
let n =
|
|
985
|
+
function re(e, ...t) {
|
|
986
|
+
let n = z(e, t);
|
|
938
987
|
for (;;) {
|
|
939
|
-
let e =
|
|
988
|
+
let e = ee.exec(n);
|
|
940
989
|
if (!e) break;
|
|
941
990
|
let t = e[2];
|
|
942
|
-
if (
|
|
991
|
+
if (A.test(t)) {
|
|
943
992
|
let r = e[1];
|
|
944
993
|
if (!r.startsWith("--")) {
|
|
945
994
|
let i = `--${r}: ${t};
|
|
946
995
|
${r}: var(--${r})`;
|
|
947
|
-
n =
|
|
996
|
+
n = J(n, e.index, e[0].length, i);
|
|
948
997
|
}
|
|
949
998
|
}
|
|
950
999
|
}
|
|
951
1000
|
return n;
|
|
952
1001
|
}
|
|
953
|
-
function
|
|
954
|
-
let n =
|
|
1002
|
+
function ie(e, ...t) {
|
|
1003
|
+
let n = z(e, t);
|
|
955
1004
|
for (;;) {
|
|
956
|
-
let e =
|
|
1005
|
+
let e = D.exec(n);
|
|
957
1006
|
if (!e || e[1] === "style") break;
|
|
958
|
-
let t =
|
|
959
|
-
if (
|
|
1007
|
+
let t = q(e[2]);
|
|
1008
|
+
if (A.test(t)) {
|
|
960
1009
|
let r = `<!-- ${t.trim()} -->`, i = e.index + e[0].indexOf(">") + 1;
|
|
961
|
-
n =
|
|
1010
|
+
n = J(n, i, t.length, r);
|
|
962
1011
|
}
|
|
963
1012
|
}
|
|
964
1013
|
return n;
|
|
965
1014
|
}
|
|
966
1015
|
//#endregion
|
|
967
|
-
export { a,
|
|
1016
|
+
export { a, ie as i, N as n, re as r, $ as t };
|
package/dist/wrec-ssr.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, i as t, n, r, t as i } from "./wrec-
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "./wrec-1_q5NXuK.js";
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var a = Object.defineProperty, o = Object.getOwnPropertyDescriptor, s = Object.getOwnPropertyNames, c = Object.prototype.hasOwnProperty, l = (e, t) => () => (e && (t = e(e = 0)), t), u = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), d = (e, t) => {
|
|
4
4
|
let n = {};
|
package/dist/wrec.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, i as t, n, r, t as i } from "./wrec-
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "./wrec-1_q5NXuK.js";
|
|
2
2
|
export { i as Wrec, e as WrecState, n as createElement, r as css, t as html };
|