wrec 0.42.0 → 0.42.1
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-RkviIlbF.js → wrec-ClOIAA9J.js} +292 -232
- package/dist/wrec-ssr.es.js +5 -5
- package/dist/wrec.es.js +1 -1
- package/package.json +10 -10
- package/scripts/lint.js +62 -0
- package/dist/wrec-ssr.d.ts +0 -97
- package/dist/wrec.d.ts +0 -97
|
@@ -140,20 +140,20 @@ function l(e, t, n) {
|
|
|
140
140
|
}
|
|
141
141
|
//#endregion
|
|
142
142
|
//#region src/evaluation.ts
|
|
143
|
-
var u = "a-zA-Z_$
|
|
144
|
-
function
|
|
143
|
+
var u = "[a-zA-Z_$][a-zA-Z_$0-9]*", d = RegExp(`this\\.(${u})\\s*\\(`, "g"), ee = /<!--\s*(.*?)\s*-->/, f = RegExp(`^this\\.${u}$`), p = RegExp(`this\\.${u}(\\.${u})*`, "g"), m = RegExp(`this\\.${u}(\\.${u})*`);
|
|
144
|
+
function h(e, t) {
|
|
145
145
|
for (let [n, r] of Object.entries(t)) e[n] === void 0 && (e[n] = te(r));
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function g(e, t) {
|
|
148
148
|
let n = Object.entries(t).filter(([e, t]) => !!t.computed).map(([e]) => e), r = new Set(n), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
|
|
149
149
|
for (let o of n) {
|
|
150
150
|
let n = t[o].computed, s = /* @__PURE__ */ new Set();
|
|
151
|
-
for (let r of n.matchAll(
|
|
152
|
-
let n =
|
|
151
|
+
for (let r of n.matchAll(p)) {
|
|
152
|
+
let n = y(r[0]), i = x(n), a = !1;
|
|
153
153
|
for (let [e, n] of Object.entries(t)) S(n.usedBy)?.includes(i) && (s.add(e), a = !0);
|
|
154
154
|
!a && typeof e[n] != "function" && s.add(n);
|
|
155
155
|
}
|
|
156
|
-
for (let e of n.matchAll(
|
|
156
|
+
for (let e of n.matchAll(d)) {
|
|
157
157
|
let n = e[1];
|
|
158
158
|
for (let [e, r] of Object.entries(t)) S(r.usedBy)?.includes(n) && s.add(e);
|
|
159
159
|
}
|
|
@@ -165,8 +165,8 @@ function v(e, t) {
|
|
|
165
165
|
expressions: a
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
|
-
function
|
|
169
|
-
let { computedNames: n, dependenciesMap: r, expressions: i } =
|
|
168
|
+
function _(e, t) {
|
|
169
|
+
let { computedNames: n, dependenciesMap: r, expressions: i } = g(t, e.properties ?? {}), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = [];
|
|
170
170
|
for (let e of n) {
|
|
171
171
|
let t = r.get(e) ?? [];
|
|
172
172
|
o.set(e, t.length), t.length === 0 && s.push(e);
|
|
@@ -190,25 +190,25 @@ function ee(e, t) {
|
|
|
190
190
|
throw Error(`computed properties form a cycle: ${e.join(", ")}`);
|
|
191
191
|
}
|
|
192
192
|
let l = e.context ?? {};
|
|
193
|
-
for (let e of c) t[e] =
|
|
193
|
+
for (let e of c) t[e] = v(i.get(e), t, l);
|
|
194
194
|
}
|
|
195
195
|
function te(e) {
|
|
196
|
-
return e.value === void 0 ? Array.isArray(e.values) && e.values.length > 0 ? e.values[0] :
|
|
196
|
+
return e.value === void 0 ? Array.isArray(e.values) && e.values.length > 0 ? e.values[0] : ne(e.type) : e.value;
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function ne(e) {
|
|
199
199
|
return e === String ? "" : e === Number ? 0 : e === Boolean ? !1 : e === Array ? [] : e === Object ? {} : void 0;
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function v(e, t, n = {}) {
|
|
202
202
|
return Function("context", `const {${Object.keys(n).join(",")}} = context; return ${e};`).call(t, n);
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function y(e) {
|
|
205
205
|
return e.substring(5).split(".")[0];
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function b(e, t = {}) {
|
|
208
208
|
let n = Object.create(e.prototype);
|
|
209
|
-
return Object.assign(n, t),
|
|
209
|
+
return Object.assign(n, t), h(n, e.properties ?? {}), _(e, n), n;
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function x(e) {
|
|
212
212
|
return `get ${e}`;
|
|
213
213
|
}
|
|
214
214
|
function S(e) {
|
|
@@ -216,7 +216,7 @@ function S(e) {
|
|
|
216
216
|
}
|
|
217
217
|
//#endregion
|
|
218
218
|
//#region src/sanitize-xss.ts
|
|
219
|
-
var
|
|
219
|
+
var C = "__WREC", re = "__", ie = "[A-Za-z_$][A-Za-z0-9_$]*", ae = new Set([
|
|
220
220
|
"checked",
|
|
221
221
|
"colspan",
|
|
222
222
|
"disabled",
|
|
@@ -231,26 +231,26 @@ var ie = "__WREC", ae = "__", oe = "[A-Za-z_$][A-Za-z0-9_$]*", se = new Set([
|
|
|
231
231
|
"type",
|
|
232
232
|
"value"
|
|
233
233
|
]);
|
|
234
|
-
function
|
|
235
|
-
return `${
|
|
234
|
+
function oe(e, t) {
|
|
235
|
+
return `${C}${e}_${t}${re}`;
|
|
236
236
|
}
|
|
237
237
|
function w(e) {
|
|
238
238
|
return e.replaceAll("&", "&").replaceAll("\"", """).replaceAll("<", "<").replaceAll(">", ">");
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function T(e) {
|
|
241
241
|
let t = e.trim();
|
|
242
|
-
return t ? RegExp(`^${
|
|
242
|
+
return t ? RegExp(`^${ie}$`).test(t) ? !0 : t.startsWith("this.") : !1;
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function se(t) {
|
|
245
245
|
let n = {
|
|
246
246
|
allowCommentTag: !0,
|
|
247
247
|
onTagAttr(e, t, n) {
|
|
248
|
-
if (t.startsWith("on")) return
|
|
248
|
+
if (t.startsWith("on")) return T(n) ? `${t}="${w(n)}"` : "";
|
|
249
249
|
if (t === "title" || t.startsWith("aria-") || t.startsWith("data-")) return `${t}="${w(n)}"`;
|
|
250
250
|
if (e === "a" && t === "href" && n.startsWith("javascript")) return "";
|
|
251
251
|
},
|
|
252
252
|
safeAttrValue(e, t, n) {
|
|
253
|
-
return t === "class" ||
|
|
253
|
+
return t === "class" || ae.has(t) || e === "a" && t === "href" || e === "img" && t === "src" ? n : "";
|
|
254
254
|
},
|
|
255
255
|
stripIgnoreTagBody: [
|
|
256
256
|
"script",
|
|
@@ -297,7 +297,7 @@ function T(t) {
|
|
|
297
297
|
}
|
|
298
298
|
}, r = [], i = Date.now() + Math.floor(Math.random() * 1e6);
|
|
299
299
|
t = t.replace(/<!--[\s\S]*?-->/g, (e) => {
|
|
300
|
-
let t =
|
|
300
|
+
let t = oe(i, r.length);
|
|
301
301
|
return r.push({
|
|
302
302
|
comment: e,
|
|
303
303
|
token: t
|
|
@@ -376,7 +376,7 @@ function K(e) {
|
|
|
376
376
|
let { localName: t } = e;
|
|
377
377
|
return t === "input" || t === "select";
|
|
378
378
|
}
|
|
379
|
-
var q = (e) => `get ${e}`,
|
|
379
|
+
var q = (e) => `get ${e}`, ce = (e) => e.replace(/<!--[\s\S]*?-->/g, "");
|
|
380
380
|
function J(e, t, n, r) {
|
|
381
381
|
return e.slice(0, t) + r + e.slice(t + n);
|
|
382
382
|
}
|
|
@@ -410,7 +410,7 @@ function Z(e, t, n) {
|
|
|
410
410
|
e instanceof CSSStyleRule ? e.style.getPropertyValue(r) !== n && e.style.setProperty(r, n) : (X(e, r, n), r === "value" && K(e) && e.value !== n && (e.value = n));
|
|
411
411
|
}
|
|
412
412
|
var Q = (e) => typeof e == "string" ? [e] : e;
|
|
413
|
-
async function
|
|
413
|
+
async function le(e) {
|
|
414
414
|
let t = /* @__PURE__ */ new Set();
|
|
415
415
|
for (let n of L(e.content)) {
|
|
416
416
|
let { localName: e } = n;
|
|
@@ -454,16 +454,17 @@ var $ = class e extends O {
|
|
|
454
454
|
#e = !1;
|
|
455
455
|
#t = /* @__PURE__ */ new Set();
|
|
456
456
|
#n = this.constructor;
|
|
457
|
-
#r =
|
|
458
|
-
#i =
|
|
459
|
-
#a;
|
|
460
|
-
#o
|
|
461
|
-
#s =
|
|
462
|
-
#c =
|
|
457
|
+
#r = !1;
|
|
458
|
+
#i = /* @__PURE__ */ new Map();
|
|
459
|
+
#a = {};
|
|
460
|
+
#o;
|
|
461
|
+
#s = {};
|
|
462
|
+
#c = null;
|
|
463
463
|
#l = /* @__PURE__ */ new Map();
|
|
464
|
-
#u = /* @__PURE__ */ new
|
|
465
|
-
#d = /* @__PURE__ */ new
|
|
466
|
-
#f = /* @__PURE__ */ new
|
|
464
|
+
#u = /* @__PURE__ */ new Map();
|
|
465
|
+
#d = /* @__PURE__ */ new WeakMap();
|
|
466
|
+
#f = /* @__PURE__ */ new WeakSet();
|
|
467
|
+
#p = /* @__PURE__ */ new Map();
|
|
467
468
|
static define(e) {
|
|
468
469
|
if (this.elementName = e, k.get(e)) throw new A(`custom element ${e} is already defined`);
|
|
469
470
|
k.define(e, this);
|
|
@@ -471,37 +472,49 @@ var $ = class e extends O {
|
|
|
471
472
|
constructor() {
|
|
472
473
|
super(), this.attachShadow({ mode: "open" });
|
|
473
474
|
let e = this.#n;
|
|
474
|
-
this.#
|
|
475
|
+
this.#A("attrToPropMap") || (e.attrToPropMap = /* @__PURE__ */ new Map()), this.#A("computedGraph") || (e.computedGraph = null), this.#A("computedPropsRegistered") || (e.computedPropsRegistered = !1), this.#A("properties") || (e.properties = {}), this.#A("propToAttrMap") || (e.propToAttrMap = /* @__PURE__ */ new Map()), this.#A("propToComputedMap") || (e.propToComputedMap = /* @__PURE__ */ new Map()), this.#A("propToExprsMap") || (e.propToExprsMap = /* @__PURE__ */ new Map()), this.#A("registeredComputedProps") || (e.registeredComputedProps = /* @__PURE__ */ new Set());
|
|
475
476
|
}
|
|
476
477
|
attributeChangedCallback(t, n, r) {
|
|
477
|
-
t === "disabled" && this.#
|
|
478
|
+
t === "disabled" && this.#y();
|
|
478
479
|
let i = e.getPropName(t);
|
|
479
|
-
if (!this.#
|
|
480
|
-
let e = this.#
|
|
481
|
-
this.#
|
|
482
|
-
let t = this.#
|
|
480
|
+
if (!this.#M(i) && this.#j(i)) {
|
|
481
|
+
let e = this.#K(i, r);
|
|
482
|
+
this.#B(i, e);
|
|
483
|
+
let t = this.#a[i];
|
|
483
484
|
t && this.setFormValue(t, String(e));
|
|
484
485
|
}
|
|
485
486
|
}
|
|
486
487
|
batchSet(e) {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
488
|
+
let t = this.#$(e);
|
|
489
|
+
if (t.entries.length === 0) return;
|
|
490
|
+
let [n, r] = t.entries[0];
|
|
491
|
+
if (t.errors.length) {
|
|
492
|
+
this.#b(n, r, t.errors);
|
|
493
|
+
return;
|
|
493
494
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
let
|
|
498
|
-
|
|
495
|
+
this.#e = !0;
|
|
496
|
+
let i = this.#n.propToExprsMap, a = /* @__PURE__ */ new Set();
|
|
497
|
+
try {
|
|
498
|
+
for (let [e, n] of t.entries) {
|
|
499
|
+
this.#B(e, n);
|
|
500
|
+
let t = i.get(e) ?? [];
|
|
501
|
+
for (let e of t) a.add(e);
|
|
502
|
+
}
|
|
503
|
+
let e = this.#E(t.entries.map(([e]) => e));
|
|
504
|
+
for (let [t, n] of e) {
|
|
505
|
+
this.#z(t, this.#C(n));
|
|
506
|
+
let e = i.get(t) ?? [];
|
|
507
|
+
for (let t of e) a.add(t);
|
|
508
|
+
}
|
|
509
|
+
this.#S([...a]);
|
|
510
|
+
} finally {
|
|
511
|
+
this.#e = !1;
|
|
499
512
|
}
|
|
500
|
-
|
|
513
|
+
for (let [e, n] of t.entries) this.#n.properties[e] && this.#b(e, n, []);
|
|
501
514
|
}
|
|
502
|
-
async #
|
|
515
|
+
async #m() {
|
|
503
516
|
let e = this.#n, { template: t } = e;
|
|
504
|
-
t || (t = e.template = document.createElement("template"), t.innerHTML = e.buildHTML()), await
|
|
517
|
+
t || (t = e.template = document.createElement("template"), t.innerHTML = e.buildHTML()), await le(t), this.shadowRoot.replaceChildren(t.content.cloneNode(!0));
|
|
505
518
|
}
|
|
506
519
|
static buildHTML() {
|
|
507
520
|
let e = "<style>\n :host([hidden]) { display: none; }";
|
|
@@ -511,42 +524,48 @@ var $ = class e extends O {
|
|
|
511
524
|
return t.startsWith("<") || (t = `<span><!--${t}--></span>`), e + t;
|
|
512
525
|
}
|
|
513
526
|
changed(e, t, n) {
|
|
514
|
-
this.#
|
|
527
|
+
this.#B(t, n);
|
|
515
528
|
}
|
|
516
|
-
|
|
517
|
-
this.#X(), this.#h(), await this.#p(), this.hasAttribute("disabled") && this.#v(), this.#ne(this.shadowRoot), this.#M(this.shadowRoot), this.#Y(), this.#m(), this.ready();
|
|
518
|
-
}
|
|
519
|
-
#m() {
|
|
529
|
+
#h() {
|
|
520
530
|
let { properties: e } = this.#n;
|
|
521
|
-
for (let [t, { computed: n }] of Object.entries(e)) n && this.#
|
|
531
|
+
for (let [t, { computed: n }] of Object.entries(e)) n && this.#z(t, this.#C(n));
|
|
522
532
|
}
|
|
523
|
-
|
|
533
|
+
async connectedCallback() {
|
|
534
|
+
this.#Q(), this.#g(), await this.#m(), this.hasAttribute("disabled") && this.#y(), this.#ae(this.shadowRoot), this.#P(this.shadowRoot), this.#Z(), this.#h(), this.ready();
|
|
535
|
+
}
|
|
536
|
+
#g() {
|
|
524
537
|
let { observedAttributes: e, properties: t } = this.#n;
|
|
525
|
-
for (let [n, r] of Object.entries(t)) r.computed || this.#
|
|
526
|
-
for (let [n, r] of Object.entries(t)) r.computed && this.#
|
|
527
|
-
this.#
|
|
538
|
+
for (let [n, r] of Object.entries(t)) r.computed || this.#_(n, r, e);
|
|
539
|
+
for (let [n, r] of Object.entries(t)) r.computed && this.#_(n, r, e);
|
|
540
|
+
this.#L();
|
|
528
541
|
}
|
|
529
|
-
#
|
|
542
|
+
#_(t, n, r) {
|
|
530
543
|
if (t === "class" || t === "style") throw new A(`"${t}" is a reserved property`);
|
|
531
544
|
let i = e.getAttrName(t), a = this.hasAttribute(i);
|
|
532
|
-
n.required && !a && this.#
|
|
545
|
+
n.required && !a && this.#U(this, i, "is a required attribute");
|
|
533
546
|
let o = n.value;
|
|
534
|
-
this.hasOwnProperty(t) && (o = this.#
|
|
535
|
-
let { type: s } = n, c = s === Boolean ? o || a : r.includes(i) && a ? this.#
|
|
536
|
-
this.#
|
|
547
|
+
this.hasOwnProperty(t) && (o = this.#D(t), this.#v(t));
|
|
548
|
+
let { type: s } = n, c = s === Boolean ? o || a : r.includes(i) && a ? this.#G(t, i) : o ?? F(n), u = "#" + t;
|
|
549
|
+
this.#B(u, this.#N(t, s, c)), Object.defineProperty(this, t, {
|
|
537
550
|
enumerable: !0,
|
|
538
551
|
get() {
|
|
539
|
-
return this.#
|
|
552
|
+
return this.#D(u);
|
|
540
553
|
},
|
|
541
554
|
set(e) {
|
|
542
|
-
n.computed && !this.#t.has(t) && this.#
|
|
543
|
-
let r = this.#
|
|
544
|
-
if (e === r
|
|
545
|
-
|
|
546
|
-
let a = this.#
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
555
|
+
n.computed && !this.#t.has(t) && this.#U(null, t, "is a computed property and cannot be set directly"), s === Number && typeof e == "string" && (e = Y(e));
|
|
556
|
+
let r = this.#D(u);
|
|
557
|
+
if (e === r) return;
|
|
558
|
+
this.#re(t, s, e);
|
|
559
|
+
let a = this.#ee(n, t, e);
|
|
560
|
+
if (!a.skipped && a.errors.length) {
|
|
561
|
+
this.#b(t, e, a.errors);
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
e = this.#N(t, s, e), this.#B(u, e);
|
|
565
|
+
let o = this.#u.get(t);
|
|
566
|
+
o && l(o.state, o.stateProp, e), this.#q(t, s, e, i), this.#e || (this.#J(t), this.#I(t)), this.#X(t, e);
|
|
567
|
+
let c = this.#a[t];
|
|
568
|
+
c && this.setFormValue(c, String(e)), this.propertyChangedCallback(t, r, e), a.skipped || this.#b(t, e, a.errors), n.dispatch && this.dispatch("change", {
|
|
550
569
|
tagName: this.localName,
|
|
551
570
|
property: t,
|
|
552
571
|
oldValue: r,
|
|
@@ -555,16 +574,16 @@ var $ = class e extends O {
|
|
|
555
574
|
}
|
|
556
575
|
});
|
|
557
576
|
}
|
|
558
|
-
#
|
|
577
|
+
#v(e) {
|
|
559
578
|
delete this[e];
|
|
560
579
|
}
|
|
561
|
-
#
|
|
580
|
+
#y() {
|
|
562
581
|
let t = this.hasAttribute("disabled"), n = L(this.shadowRoot);
|
|
563
582
|
for (let r of n) N(r) && (r instanceof e ? t ? r.setAttribute("disabled", "") : r.removeAttribute("disabled") : r.disabled = t);
|
|
564
583
|
}
|
|
565
584
|
disconnectedCallback() {
|
|
566
|
-
for (let { unsubscribe: e } of this.#
|
|
567
|
-
this.#
|
|
585
|
+
for (let { unsubscribe: e } of this.#p.values()) e();
|
|
586
|
+
this.#i.clear(), this.#s = {}, this.#l.clear(), this.#u.clear(), this.#p.clear();
|
|
568
587
|
}
|
|
569
588
|
dispatch(e, t) {
|
|
570
589
|
this.dispatchEvent(new CustomEvent(e, {
|
|
@@ -573,42 +592,57 @@ var $ = class e extends O {
|
|
|
573
592
|
detail: t
|
|
574
593
|
}));
|
|
575
594
|
}
|
|
595
|
+
#b(e, t, n) {
|
|
596
|
+
let r = n.length === 0;
|
|
597
|
+
this.#r = !0;
|
|
598
|
+
try {
|
|
599
|
+
this.dispatch("validation", {
|
|
600
|
+
instance: this,
|
|
601
|
+
property: e,
|
|
602
|
+
valid: r,
|
|
603
|
+
value: t,
|
|
604
|
+
errors: n
|
|
605
|
+
});
|
|
606
|
+
} finally {
|
|
607
|
+
this.#r = !1;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
576
610
|
displayIfSet(e, t = "block") {
|
|
577
611
|
return `display: ${e == null ? "none" : t}`;
|
|
578
612
|
}
|
|
579
|
-
#
|
|
613
|
+
#x(t) {
|
|
580
614
|
let n = t instanceof e;
|
|
581
615
|
for (let r of t.getAttributeNames()) {
|
|
582
616
|
let i = t.getAttribute(r);
|
|
583
617
|
if (r === "ref") {
|
|
584
|
-
this.#
|
|
618
|
+
this.#H(t, i);
|
|
585
619
|
continue;
|
|
586
620
|
}
|
|
587
|
-
let a = this.#
|
|
621
|
+
let a = this.#F(t, i);
|
|
588
622
|
if (a) {
|
|
589
|
-
let i = this.#
|
|
590
|
-
i === void 0 && this.#
|
|
623
|
+
let i = this.#D(a);
|
|
624
|
+
i === void 0 && this.#W(t, r, a);
|
|
591
625
|
let [o, s] = r.split(":"), c = e.getPropName(o);
|
|
592
626
|
if (o === "checked") {
|
|
593
627
|
let { type: e } = this.#n.properties[a];
|
|
594
|
-
V(t) && e !== Boolean && this.#
|
|
628
|
+
V(t) && e !== Boolean && this.#U(t, r, `refers to property "${a}" whose type is not Boolean`), W(t) && e !== String && this.#U(t, r, `refers to property "${a}" whose type is not String`);
|
|
595
629
|
}
|
|
596
|
-
let l = this.#
|
|
597
|
-
n && t.#
|
|
630
|
+
let l = this.#M(a);
|
|
631
|
+
n && t.#M(c) || (o === "checked" && W(t) ? t.checked = t.value === i : t[c] = i), o === "value" && (s ? (t["on" + s] === void 0 && this.#U(t, r, "refers to an unsupported event name"), t.setAttribute(o, this.#D(a))) : s = "change"), n && !l && t.#l.set(e.getPropName(o), a);
|
|
598
632
|
}
|
|
599
|
-
this.#
|
|
633
|
+
this.#V(i, t, r);
|
|
600
634
|
}
|
|
601
635
|
}
|
|
602
|
-
#
|
|
636
|
+
#S(e) {
|
|
603
637
|
for (let t of e) {
|
|
604
|
-
let e = this.#
|
|
638
|
+
let e = this.#C(t), n = this.#i.get(t) ?? [], r = /* @__PURE__ */ new Set();
|
|
605
639
|
for (let t of n) {
|
|
606
640
|
let n = t instanceof HTMLElement || t instanceof CSSStyleRule ? t : t.element;
|
|
607
641
|
if (n instanceof HTMLElement && !n.isConnected) {
|
|
608
642
|
r.add(t);
|
|
609
643
|
continue;
|
|
610
644
|
}
|
|
611
|
-
if (t instanceof HTMLElement) this.#
|
|
645
|
+
if (t instanceof HTMLElement) this.#Y(t, e);
|
|
612
646
|
else if (!(t instanceof CSSStyleRule)) {
|
|
613
647
|
let { element: n, attrName: r } = t;
|
|
614
648
|
n instanceof CSSStyleRule ? n.style.setProperty(r, e) : Z(n, r, e);
|
|
@@ -616,14 +650,14 @@ var $ = class e extends O {
|
|
|
616
650
|
}
|
|
617
651
|
if (r.size > 0) {
|
|
618
652
|
let e = n.filter((e) => !r.has(e));
|
|
619
|
-
e.length === 0 ? this.#
|
|
653
|
+
e.length === 0 ? this.#i.delete(t) : this.#i.set(t, e);
|
|
620
654
|
}
|
|
621
655
|
}
|
|
622
656
|
}
|
|
623
|
-
#
|
|
624
|
-
return
|
|
657
|
+
#C(e) {
|
|
658
|
+
return v(e, this, this.#n.context);
|
|
625
659
|
}
|
|
626
|
-
#
|
|
660
|
+
#w(e) {
|
|
627
661
|
let { localName: t } = e;
|
|
628
662
|
if (t === "style") {
|
|
629
663
|
let { sheet: t } = e, n = t?.cssRules ?? [], r = Array.from(n);
|
|
@@ -631,22 +665,22 @@ var $ = class e extends O {
|
|
|
631
665
|
let t = Array.from(e.style);
|
|
632
666
|
for (let n of t) if (n.startsWith("--")) {
|
|
633
667
|
let t = e.style.getPropertyValue(n);
|
|
634
|
-
this.#
|
|
668
|
+
this.#V(t, e, n);
|
|
635
669
|
}
|
|
636
670
|
}
|
|
637
671
|
} else {
|
|
638
672
|
let t = "";
|
|
639
673
|
if (G(e)) {
|
|
640
|
-
this.#
|
|
641
|
-
let n = e.textContent?.match(
|
|
674
|
+
this.#V(e.textContent, e);
|
|
675
|
+
let n = e.textContent?.match(ee);
|
|
642
676
|
n && (t = n[1]);
|
|
643
677
|
} else {
|
|
644
678
|
let n = Array.from(e.childNodes).find((e) => e.nodeType === Node.COMMENT_NODE);
|
|
645
679
|
n && (t = n.textContent?.trim() ?? "");
|
|
646
680
|
}
|
|
647
681
|
if (t) {
|
|
648
|
-
let n = this.#
|
|
649
|
-
n && G(e) ? e.textContent = this.#
|
|
682
|
+
let n = this.#F(e, t);
|
|
683
|
+
n && G(e) ? e.textContent = this.#D(n) : this.#V(t, e);
|
|
650
684
|
}
|
|
651
685
|
}
|
|
652
686
|
}
|
|
@@ -654,7 +688,7 @@ var $ = class e extends O {
|
|
|
654
688
|
let e = this.getAttribute("form-assoc");
|
|
655
689
|
if (!e) {
|
|
656
690
|
let t = this.getAttribute("name");
|
|
657
|
-
if (t) if (this.#
|
|
691
|
+
if (t) if (this.#j("value")) e = `value:${t}`;
|
|
658
692
|
else return;
|
|
659
693
|
else return;
|
|
660
694
|
}
|
|
@@ -663,26 +697,26 @@ var $ = class e extends O {
|
|
|
663
697
|
let [n, r] = e.split(":");
|
|
664
698
|
t[n.trim()] = r.trim();
|
|
665
699
|
}
|
|
666
|
-
this.#
|
|
700
|
+
this.#a = t, this.#o = new FormData(), this.#c = this.attachInternals(), this.#c.setFormValue(this.#o);
|
|
667
701
|
for (let [e, n] of Object.entries(t)) {
|
|
668
|
-
let t = this.#
|
|
702
|
+
let t = this.#D(e);
|
|
669
703
|
U(t) && this.setFormValue(n, String(t));
|
|
670
704
|
}
|
|
671
|
-
let r = Object.keys(this.#n.properties), i = this.#
|
|
672
|
-
for (let e of r) i[e] = this.#
|
|
705
|
+
let r = Object.keys(this.#n.properties), i = this.#s;
|
|
706
|
+
for (let e of r) i[e] = this.#D(e);
|
|
673
707
|
}
|
|
674
708
|
formResetCallback() {
|
|
675
|
-
let e = this.#
|
|
709
|
+
let e = this.#s;
|
|
676
710
|
for (let t of Object.keys(e)) {
|
|
677
711
|
let n = e[t];
|
|
678
|
-
|
|
712
|
+
f.test(n) && (n = this.#C(n)), this.#B(t, n);
|
|
679
713
|
}
|
|
680
714
|
}
|
|
681
715
|
static getAttrName(e) {
|
|
682
716
|
let t = this.propToAttrMap.get(e);
|
|
683
717
|
return t || (t = e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), this.propToAttrMap.set(e, t)), t;
|
|
684
718
|
}
|
|
685
|
-
#
|
|
719
|
+
#T() {
|
|
686
720
|
let e = this.#n, t = e.computedGraph;
|
|
687
721
|
if (t) return t;
|
|
688
722
|
let n = E(), r = E(), i = {};
|
|
@@ -699,8 +733,8 @@ var $ = class e extends O {
|
|
|
699
733
|
computedToExprMap: i
|
|
700
734
|
}, e.computedGraph = t, t;
|
|
701
735
|
}
|
|
702
|
-
#
|
|
703
|
-
let { computedToDependenciesMap: t, computedToDependentsMap: n, computedToExprMap: r } = this.#
|
|
736
|
+
#E(e) {
|
|
737
|
+
let { computedToDependenciesMap: t, computedToDependentsMap: n, computedToExprMap: r } = this.#T(), i = this.#n.propToComputedMap, a = /* @__PURE__ */ new Set(), o = [...new Set(e)];
|
|
704
738
|
for (let e = 0; e < o.length; e++) {
|
|
705
739
|
let t = o[e], n = i.get(t) || [];
|
|
706
740
|
for (let [e, t] of n) r[e] = t, a.has(e) || (a.add(e), o.push(e));
|
|
@@ -724,77 +758,77 @@ var $ = class e extends O {
|
|
|
724
758
|
if (c.length !== a.size) throw new A(`computed properties form a cycle: ${[...a].filter((e) => l.get(e) > 0).sort().join(", ")}`);
|
|
725
759
|
return c.map((e) => [e, r[e]]);
|
|
726
760
|
}
|
|
727
|
-
#
|
|
761
|
+
#D(e) {
|
|
728
762
|
return this[e];
|
|
729
763
|
}
|
|
730
764
|
static getPropName(e) {
|
|
731
765
|
let t = this.attrToPropMap.get(e);
|
|
732
766
|
return t || (t = e.replace(/-([a-z])/g, (e, t) => t.toUpperCase()), this.attrToPropMap.set(e, t)), t;
|
|
733
767
|
}
|
|
734
|
-
#
|
|
735
|
-
let r = this.#
|
|
736
|
-
i && l(i.state, i.stateProp, r), this.#e || (this.#
|
|
768
|
+
#O(e, t, n) {
|
|
769
|
+
let r = this.#D("#" + e), i = this.#u.get(e);
|
|
770
|
+
i && l(i.state, i.stateProp, r), this.#e || (this.#J(e), this.#I(e)), this.#X(e, r), this.propertyChangedCallback(e, t, n);
|
|
737
771
|
}
|
|
738
|
-
#
|
|
772
|
+
#k(e, t, n) {
|
|
739
773
|
if (n.length !== 1) return;
|
|
740
774
|
let [r] = n;
|
|
741
|
-
if (!
|
|
775
|
+
if (!f.test(r)) return;
|
|
742
776
|
let i = V(e), a = W(e), o = K(e) || G(e), [s, c] = (t ?? "").split(":");
|
|
743
777
|
if (!(o && s === "value" || i && s === "checked" || a && s === "checked" || G(e))) return;
|
|
744
|
-
c ? e["on" + c] === void 0 && this.#
|
|
745
|
-
let l =
|
|
778
|
+
c ? e["on" + c] === void 0 && this.#U(e, t, "refers to an unsupported event name") : c = "change";
|
|
779
|
+
let l = y(r);
|
|
746
780
|
e.addEventListener(c, (e) => {
|
|
747
781
|
let { target: t } = e;
|
|
748
782
|
if (!t) return;
|
|
749
783
|
let { type: n } = this.#n.properties[l], r = t, { value: o } = r;
|
|
750
|
-
s === "checked" ? i ? this.#
|
|
784
|
+
s === "checked" ? i ? this.#B(l, r.checked) : a && r.checked && this.#B(l, o) : this.#B(l, n === Number ? Y(o) : o), this.#I(l);
|
|
751
785
|
});
|
|
752
786
|
}
|
|
753
|
-
#
|
|
787
|
+
#A(e) {
|
|
754
788
|
return Object.hasOwn(this.#n, e);
|
|
755
789
|
}
|
|
756
|
-
#
|
|
790
|
+
#j(e) {
|
|
757
791
|
return !!this.#n.properties[e];
|
|
758
792
|
}
|
|
759
|
-
#
|
|
793
|
+
#M(e) {
|
|
760
794
|
return !!this.#n.properties[e]?.computed;
|
|
761
795
|
}
|
|
762
|
-
#
|
|
763
|
-
if (typeof r != "object" || !r || n !== Array && n !== Object || this.#
|
|
764
|
-
let i = this.#
|
|
796
|
+
#N(e, n, r) {
|
|
797
|
+
if (typeof r != "object" || !r || n !== Array && n !== Object || this.#f.has(r)) return r;
|
|
798
|
+
let i = this.#d.get(r);
|
|
765
799
|
if (i) return i;
|
|
766
800
|
let a = t(r, (t, n, r) => {
|
|
767
|
-
this.#
|
|
801
|
+
this.#O(e, n, r);
|
|
768
802
|
});
|
|
769
|
-
return this.#
|
|
803
|
+
return this.#d.set(r, a), this.#f.add(a), a;
|
|
770
804
|
}
|
|
771
|
-
#
|
|
805
|
+
#P(e) {
|
|
772
806
|
let t = Array.from(e.querySelectorAll("*"));
|
|
773
|
-
for (let e of t) this.#
|
|
807
|
+
for (let e of t) this.#x(e), e.firstElementChild || this.#w(e);
|
|
774
808
|
}
|
|
775
809
|
static get observedAttributes() {
|
|
776
810
|
let t = Object.entries(this.properties || {}).filter(([e, t]) => !t.computed).map(([t]) => e.getAttrName(t));
|
|
777
811
|
return t.includes("disabled") || t.push("disabled"), t;
|
|
778
812
|
}
|
|
779
813
|
propertyChangedCallback(e, t, n) {}
|
|
780
|
-
#
|
|
781
|
-
if (!t || !
|
|
782
|
-
let n =
|
|
783
|
-
return this.#
|
|
814
|
+
#F(e, t) {
|
|
815
|
+
if (!t || !f.test(t)) return;
|
|
816
|
+
let n = y(t);
|
|
817
|
+
return this.#D(n) === void 0 && this.#W(e, "", n), n;
|
|
784
818
|
}
|
|
785
|
-
#
|
|
819
|
+
#I(e) {
|
|
786
820
|
let t = this.#n.propToExprsMap.get(e) || [];
|
|
787
|
-
this.#
|
|
821
|
+
this.#S(t);
|
|
788
822
|
}
|
|
789
823
|
ready() {}
|
|
790
|
-
#
|
|
824
|
+
#L() {
|
|
791
825
|
let e = this.#n;
|
|
792
826
|
if (!e.computedPropsRegistered) {
|
|
793
827
|
e.computedPropsRegistered = !0, e.computedGraph = null;
|
|
794
|
-
for (let [t, n] of Object.entries(e.properties)) n.computed && this.#
|
|
828
|
+
for (let [t, n] of Object.entries(e.properties)) n.computed && this.#R(t, n);
|
|
795
829
|
}
|
|
796
830
|
}
|
|
797
|
-
#
|
|
831
|
+
#R(e, t) {
|
|
798
832
|
let n = this.#n;
|
|
799
833
|
n.registeredComputedProps.add(e);
|
|
800
834
|
let r = n.propToComputedMap;
|
|
@@ -803,33 +837,33 @@ var $ = class e extends O {
|
|
|
803
837
|
i || (i = [], r.set(t, i)), i.push([e, n]);
|
|
804
838
|
}
|
|
805
839
|
let a = t.computed;
|
|
806
|
-
for (let t of a.matchAll(
|
|
807
|
-
let r =
|
|
808
|
-
this.#
|
|
840
|
+
for (let t of a.matchAll(p)) {
|
|
841
|
+
let r = y(t[0]);
|
|
842
|
+
this.#D(r) === void 0 && this.#W(null, e, r);
|
|
809
843
|
let o = q(r), s = !1;
|
|
810
844
|
for (let [e, t] of Object.entries(n.properties)) Q(t.usedBy)?.includes(o) && (i(e, a), s = !0);
|
|
811
|
-
!s && typeof this.#
|
|
845
|
+
!s && typeof this.#D(r) != "function" && i(r, a);
|
|
812
846
|
}
|
|
813
|
-
for (let t of a.matchAll(
|
|
847
|
+
for (let t of a.matchAll(d)) {
|
|
814
848
|
let r = t[1];
|
|
815
|
-
if (typeof this.#
|
|
849
|
+
if (typeof this.#D(r) != "function") throw new A(`property ${e} computed calls non-method ${r}`);
|
|
816
850
|
for (let [e, t] of Object.entries(n.properties)) Q(t.usedBy)?.includes(r) && i(e, a);
|
|
817
851
|
}
|
|
818
852
|
}
|
|
819
|
-
#
|
|
853
|
+
#z(e, t) {
|
|
820
854
|
this.#t.add(e);
|
|
821
855
|
try {
|
|
822
|
-
this.#
|
|
856
|
+
this.#B(e, t);
|
|
823
857
|
} finally {
|
|
824
858
|
this.#t.delete(e);
|
|
825
859
|
}
|
|
826
860
|
}
|
|
827
|
-
#
|
|
861
|
+
#B(e, t) {
|
|
828
862
|
this[e] = t;
|
|
829
863
|
}
|
|
830
|
-
#
|
|
864
|
+
#V(e, t, n = void 0) {
|
|
831
865
|
if (!e) return;
|
|
832
|
-
let r = this.#
|
|
866
|
+
let r = this.#te(t, n, e);
|
|
833
867
|
if (!r) {
|
|
834
868
|
let r = e.replaceAll("this..", "this.");
|
|
835
869
|
n ? Z(t, n, r) : "textContent" in t && (t.textContent = r);
|
|
@@ -837,54 +871,54 @@ var $ = class e extends O {
|
|
|
837
871
|
}
|
|
838
872
|
let i = this.#n;
|
|
839
873
|
r.forEach((t) => {
|
|
840
|
-
let n =
|
|
841
|
-
if (typeof this.#
|
|
874
|
+
let n = y(t);
|
|
875
|
+
if (typeof this.#D(n) == "function") return;
|
|
842
876
|
let r = i.propToExprsMap, a = r.get(n);
|
|
843
877
|
a || (a = [], r.set(n, a)), a.includes(e) || a.push(e);
|
|
844
878
|
});
|
|
845
|
-
for (let [e, t] of this.#
|
|
879
|
+
for (let [e, t] of this.#i.entries()) for (let n of t) {
|
|
846
880
|
let r = n instanceof HTMLElement || n instanceof CSSStyleRule ? n : n.element;
|
|
847
|
-
r instanceof CSSStyleRule || r.isConnected || this.#
|
|
881
|
+
r instanceof CSSStyleRule || r.isConnected || this.#i.set(e, t.filter((e) => e !== n));
|
|
848
882
|
}
|
|
849
|
-
let a = this.#
|
|
850
|
-
a || (a = [], this.#
|
|
883
|
+
let a = this.#i.get(e);
|
|
884
|
+
a || (a = [], this.#i.set(e, a)), a.push(n ? {
|
|
851
885
|
element: t,
|
|
852
886
|
attrName: n
|
|
853
|
-
} : t), t instanceof HTMLElement && this.#
|
|
854
|
-
let o = this.#
|
|
855
|
-
n ? Z(t, n, o) : this.#
|
|
887
|
+
} : t), t instanceof HTMLElement && this.#k(t, n, r);
|
|
888
|
+
let o = this.#C(e);
|
|
889
|
+
n ? Z(t, n, o) : this.#Y(t, o);
|
|
856
890
|
}
|
|
857
|
-
#
|
|
891
|
+
#H(e, t) {
|
|
858
892
|
let n = t?.trim() ?? "", r = this.#n.properties[n];
|
|
859
|
-
r || this.#
|
|
893
|
+
r || this.#W(e, "ref", n), r.type !== O && this.#U(e, "ref", `refers to property "${n}" whose type is not HTMLElement`), this.#D(n) && this.#U(e, "ref", `is a duplicate reference to the property "${n}"`), this.#B(n, e), e.removeAttribute("ref");
|
|
860
894
|
}
|
|
861
895
|
setAttributeSafe(e, t) {
|
|
862
896
|
this.hasAttribute(e) || this.setAttribute(e, t);
|
|
863
897
|
}
|
|
864
898
|
setFormValue(e, t) {
|
|
865
|
-
!this.#
|
|
899
|
+
!this.#o || !U(t) || (this.#o.set(e, t), this.#c?.setFormValue(this.#o));
|
|
866
900
|
}
|
|
867
901
|
static ssr(e = {}) {
|
|
868
902
|
throw new A("SSR is not available in the browser build.");
|
|
869
903
|
}
|
|
870
|
-
#
|
|
904
|
+
#U(e, t, n) {
|
|
871
905
|
let r = e instanceof HTMLElement ? e.localName : "CSS rule";
|
|
872
906
|
throw new A(`component ${this.#n.elementName}` + (e ? `, element "${r}"` : "") + (t ? `, attribute "${t}"` : "") + ` ${n}`);
|
|
873
907
|
}
|
|
874
|
-
#
|
|
875
|
-
this.#
|
|
908
|
+
#W(e, t, n) {
|
|
909
|
+
this.#U(e, t, `refers to missing property "${n}"`);
|
|
876
910
|
}
|
|
877
|
-
#
|
|
878
|
-
return this.#
|
|
911
|
+
#G(e, t) {
|
|
912
|
+
return this.#K(e, this.getAttribute(t));
|
|
879
913
|
}
|
|
880
|
-
#
|
|
881
|
-
if (n?.match(
|
|
914
|
+
#K(t, n) {
|
|
915
|
+
if (n?.match(p)) return n;
|
|
882
916
|
let r = this.#n.properties[t], { type: i, values: a } = r;
|
|
883
|
-
if (i || this.#
|
|
917
|
+
if (i || this.#U(null, t, "does not specify its type"), n === null) return i === Boolean ? !1 : F(r);
|
|
884
918
|
if (i === String) {
|
|
885
919
|
if (a && !a.includes(n)) {
|
|
886
920
|
let e = a.map((e) => `"${e}"`).join(", ");
|
|
887
|
-
this.#
|
|
921
|
+
this.#U(null, t, `must be one of ${e}`);
|
|
888
922
|
}
|
|
889
923
|
return n;
|
|
890
924
|
}
|
|
@@ -893,31 +927,31 @@ var $ = class e extends O {
|
|
|
893
927
|
if (n === "true") return !0;
|
|
894
928
|
if (n === "false" || n === "null") return !1;
|
|
895
929
|
let r = e.getAttrName(t);
|
|
896
|
-
return n && n !== r && this.#
|
|
930
|
+
return n && n !== r && this.#U(null, t, "is a Boolean attribute, so its value must match attribute name or be missing"), n === "" || n === r;
|
|
897
931
|
}
|
|
898
932
|
}
|
|
899
|
-
#
|
|
900
|
-
U(n) && !this.#
|
|
933
|
+
#q(e, t, n, r) {
|
|
934
|
+
U(n) && !this.#M(e) && n !== (t === Boolean ? this.hasAttribute(r) : this.#G(e, r)) && X(this, r || e, n);
|
|
901
935
|
}
|
|
902
|
-
#
|
|
903
|
-
for (let [t, n] of this.#
|
|
936
|
+
#J(e) {
|
|
937
|
+
for (let [t, n] of this.#E([e])) this.#z(t, this.#C(n));
|
|
904
938
|
}
|
|
905
|
-
#
|
|
939
|
+
#Y(e, t) {
|
|
906
940
|
if (t === void 0) return;
|
|
907
941
|
let n = e instanceof HTMLElement;
|
|
908
942
|
Array.isArray(t) && (t = t.join(""));
|
|
909
943
|
let r = typeof t;
|
|
910
|
-
r !== "string" && r !== "number" && this.#
|
|
944
|
+
r !== "string" && r !== "number" && this.#U(e, void 0, " computed content is not a string or number");
|
|
911
945
|
let i = String(t);
|
|
912
946
|
if (e instanceof HTMLElement && G(e)) e.value !== i && (e.value = i);
|
|
913
947
|
else if (n && r === "string" && i.trim().startsWith("<")) {
|
|
914
|
-
let t =
|
|
948
|
+
let t = se(i);
|
|
915
949
|
if (e.innerHTML === t) return;
|
|
916
|
-
e.innerHTML = t, this.#
|
|
950
|
+
e.innerHTML = t, this.#ae(e), this.#P(e);
|
|
917
951
|
} else n && e.textContent !== i && (e.textContent = i);
|
|
918
952
|
}
|
|
919
|
-
#
|
|
920
|
-
let n = this.#
|
|
953
|
+
#X(e, t) {
|
|
954
|
+
let n = this.#l.get(e);
|
|
921
955
|
if (!n) return;
|
|
922
956
|
let r = this.getRootNode();
|
|
923
957
|
if (!(r instanceof ShadowRoot)) return;
|
|
@@ -926,17 +960,17 @@ var $ = class e extends O {
|
|
|
926
960
|
let a = i;
|
|
927
961
|
a[n] = t;
|
|
928
962
|
}
|
|
929
|
-
#
|
|
963
|
+
#Z() {
|
|
930
964
|
let e = this.#n, t = (e, t, n) => {
|
|
931
965
|
let r = e.get(t);
|
|
932
966
|
r || (r = [], e.set(t, r)), r.includes(n) || r.push(n);
|
|
933
967
|
}, n = () => {
|
|
934
968
|
let n = E();
|
|
935
969
|
e.methodToExprsMap = n;
|
|
936
|
-
let r = Array.from(this.#
|
|
970
|
+
let r = Array.from(this.#i.keys());
|
|
937
971
|
for (let e of r) {
|
|
938
|
-
for (let r of e.matchAll(
|
|
939
|
-
for (let r of e.matchAll(
|
|
972
|
+
for (let r of e.matchAll(d)) t(n, r[1], e);
|
|
973
|
+
for (let r of e.matchAll(p)) t(n, q(y(r[0])), e);
|
|
940
974
|
}
|
|
941
975
|
}, { properties: r, propToExprsMap: i } = e;
|
|
942
976
|
for (let [t, a] of Object.entries(r)) {
|
|
@@ -949,7 +983,7 @@ var $ = class e extends O {
|
|
|
949
983
|
if (H(e)) {
|
|
950
984
|
let n = z(e);
|
|
951
985
|
if (typeof R(this, n)?.get != "function") throw new A(`property ${t} usedBy contains non-getter ${e}`);
|
|
952
|
-
} else if (typeof this.#
|
|
986
|
+
} else if (typeof this.#D(e) != "function") throw new A(`property ${t} usedBy contains non-method ${e}`);
|
|
953
987
|
let n = o.get(e) || [];
|
|
954
988
|
for (let e of n) s.includes(e) || s.push(e);
|
|
955
989
|
}
|
|
@@ -960,15 +994,15 @@ var $ = class e extends O {
|
|
|
960
994
|
t = {};
|
|
961
995
|
for (let n of Object.keys(e)) t[n] = n;
|
|
962
996
|
}
|
|
963
|
-
this.#
|
|
964
|
-
for (let [n, r] of Object.entries(t)) if (this.#
|
|
997
|
+
this.#ne(e, t);
|
|
998
|
+
for (let [n, r] of Object.entries(t)) if (this.#j(r)) {
|
|
965
999
|
let t = o(e, n);
|
|
966
|
-
t !== void 0 && this.#
|
|
1000
|
+
t !== void 0 && this.#B(r, t), this.#u.set(r, {
|
|
967
1001
|
state: e,
|
|
968
1002
|
stateProp: n
|
|
969
1003
|
});
|
|
970
1004
|
}
|
|
971
|
-
let n = this.#
|
|
1005
|
+
let n = this.#p.get(e), r = {
|
|
972
1006
|
...n?.map,
|
|
973
1007
|
...t
|
|
974
1008
|
};
|
|
@@ -976,77 +1010,103 @@ var $ = class e extends O {
|
|
|
976
1010
|
let i = e.subscribe(({ statePath: t, newValue: n }) => {
|
|
977
1011
|
let i = r[t];
|
|
978
1012
|
if (i) {
|
|
979
|
-
this.#
|
|
1013
|
+
this.#B(i, n);
|
|
980
1014
|
return;
|
|
981
1015
|
}
|
|
982
1016
|
let a = Object.keys(r).find((e) => t.startsWith(e + ".") || e.startsWith(t + "."));
|
|
983
1017
|
if (!a) return;
|
|
984
1018
|
let s = r[a];
|
|
985
|
-
this.#
|
|
1019
|
+
this.#B(s, o(e, a));
|
|
986
1020
|
}, Object.keys(r));
|
|
987
|
-
this.#
|
|
1021
|
+
this.#p.set(e, {
|
|
988
1022
|
map: r,
|
|
989
1023
|
unsubscribe: i
|
|
990
1024
|
});
|
|
991
1025
|
}
|
|
992
|
-
|
|
1026
|
+
validate(e) {
|
|
1027
|
+
return [];
|
|
1028
|
+
}
|
|
1029
|
+
#Q() {
|
|
993
1030
|
let t = new Set(Object.keys(this.#n.properties));
|
|
994
1031
|
for (let n of this.getAttributeNames()) if (!D.has(n) && !n.startsWith("on") && n !== "ref") {
|
|
995
1032
|
if (n === "form-assoc") {
|
|
996
|
-
this.#
|
|
1033
|
+
this.#ie();
|
|
997
1034
|
continue;
|
|
998
1035
|
}
|
|
999
1036
|
if (!t.has(e.getPropName(n))) {
|
|
1000
1037
|
if (n === "name") {
|
|
1001
|
-
this.#
|
|
1038
|
+
this.#ie();
|
|
1002
1039
|
continue;
|
|
1003
1040
|
}
|
|
1004
|
-
this.#
|
|
1041
|
+
this.#U(null, n, "is not a supported attribute");
|
|
1005
1042
|
}
|
|
1006
1043
|
}
|
|
1007
1044
|
}
|
|
1008
|
-
|
|
1009
|
-
let r =
|
|
1045
|
+
#$(e) {
|
|
1046
|
+
let t = [], n = [], r = { ...this };
|
|
1047
|
+
for (let [i, a] of Object.entries(e)) {
|
|
1048
|
+
let e = this.#n.properties[i], o = a;
|
|
1049
|
+
if (e) {
|
|
1050
|
+
e.computed && this.#U(null, i, "is a computed property and cannot be set directly"), e.type === Number && typeof o == "string" && (o = Y(o)), this.#re(i, e.type, o);
|
|
1051
|
+
let t = e.validate?.(o);
|
|
1052
|
+
typeof t == "string" && n.push(t);
|
|
1053
|
+
}
|
|
1054
|
+
t.push([i, o]), r[i] = o;
|
|
1055
|
+
}
|
|
1056
|
+
return this.#r || n.push(...this.validate(r)), {
|
|
1057
|
+
entries: t,
|
|
1058
|
+
errors: n
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
#ee(e, t, n) {
|
|
1062
|
+
if (this.#e || this.#r) return {
|
|
1063
|
+
errors: [],
|
|
1064
|
+
skipped: !0
|
|
1065
|
+
};
|
|
1066
|
+
let r = [], { validate: i } = e, a = i?.(n);
|
|
1067
|
+
typeof a == "string" && r.push(a);
|
|
1068
|
+
let o = {
|
|
1069
|
+
...this,
|
|
1070
|
+
[t]: n
|
|
1071
|
+
};
|
|
1072
|
+
return r.push(...this.validate(o)), {
|
|
1073
|
+
errors: r,
|
|
1074
|
+
skipped: !1
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
#te(e, t, n) {
|
|
1078
|
+
let r = n.match(p);
|
|
1010
1079
|
if (r) return r.forEach((n) => {
|
|
1011
|
-
let r =
|
|
1012
|
-
this.#
|
|
1080
|
+
let r = y(n);
|
|
1081
|
+
this.#D(r) === void 0 && this.#W(e, t, r);
|
|
1013
1082
|
}), r;
|
|
1014
1083
|
}
|
|
1015
|
-
#
|
|
1084
|
+
#ne(e, t) {
|
|
1016
1085
|
for (let [n, r] of Object.entries(t)) {
|
|
1017
1086
|
let t = o(e, n);
|
|
1018
|
-
t === void 0 && this.#
|
|
1087
|
+
t === void 0 && this.#U(this, void 0, `invalid state path "${n}"`), t = this.#D(r), this.#j(r) || this.#U(null, r, "refers to missing property in useState map");
|
|
1019
1088
|
}
|
|
1020
1089
|
}
|
|
1021
|
-
|
|
1090
|
+
#re(e, t, n) {
|
|
1022
1091
|
let { values: r } = this.#n.properties[e];
|
|
1023
1092
|
if (r) {
|
|
1024
1093
|
let i;
|
|
1025
|
-
t === String ? typeof n == "string" ? r.includes(n) || (i = `must be one of ${r.map((e) => `"${e}"`).join(", ")}`) : i = `value is a ${typeof n}, but type is String` : i = "declares allowed values, but its type is not String", i && this.#
|
|
1094
|
+
t === String ? typeof n == "string" ? r.includes(n) || (i = `must be one of ${r.map((e) => `"${e}"`).join(", ")}`) : i = `value is a ${typeof n}, but type is String` : i = "declares allowed values, but its type is not String", i && this.#U(null, e, i);
|
|
1026
1095
|
}
|
|
1027
1096
|
if (n instanceof t) return;
|
|
1028
1097
|
let i = typeof n;
|
|
1029
1098
|
if (i === "object") {
|
|
1030
1099
|
let { constructor: r } = n;
|
|
1031
|
-
i = r.name, r !== t && this.#
|
|
1100
|
+
i = r.name, r !== t && this.#U(null, e, `was set to a ${i}, but must be a ${t.name}`);
|
|
1032
1101
|
}
|
|
1033
|
-
i !== t.name.toLowerCase() && this.#
|
|
1102
|
+
i !== t.name.toLowerCase() && this.#U(null, e, `was set to a ${i}, but must be a ${t.name}`);
|
|
1034
1103
|
}
|
|
1035
|
-
#
|
|
1036
|
-
let r = t.validate?.(n), i = typeof r != "string";
|
|
1037
|
-
return i || this.dispatch("validation", {
|
|
1038
|
-
object: this,
|
|
1039
|
-
property: e,
|
|
1040
|
-
value: n,
|
|
1041
|
-
message: r
|
|
1042
|
-
}), i;
|
|
1043
|
-
}
|
|
1044
|
-
#te() {
|
|
1104
|
+
#ie() {
|
|
1045
1105
|
if (this.#n.formAssociated || this.closest("form") === null) return;
|
|
1046
1106
|
let e = this.#n.name;
|
|
1047
|
-
this.#
|
|
1107
|
+
this.#U(this, void 0, `inside form, class ${e} requires "static formAssociated = true;"`);
|
|
1048
1108
|
}
|
|
1049
|
-
#
|
|
1109
|
+
#ae(e) {
|
|
1050
1110
|
let t = Array.from(e.querySelectorAll("*"));
|
|
1051
1111
|
for (let e of t) {
|
|
1052
1112
|
let t = [];
|
|
@@ -1056,22 +1116,22 @@ var $ = class e extends O {
|
|
|
1056
1116
|
let i = r.slice(2);
|
|
1057
1117
|
i = i[0].toLowerCase() + i.slice(1).toLowerCase();
|
|
1058
1118
|
let a = n.value;
|
|
1059
|
-
this.#
|
|
1119
|
+
this.#te(e, r, a);
|
|
1060
1120
|
let o;
|
|
1061
|
-
typeof this.#
|
|
1121
|
+
typeof this.#D(a) == "function" ? o = (e) => this.#D(a).call(this, e) : (this.#te(e, r, a), o = () => this.#C(a)), e.addEventListener(i, o), t.push(r);
|
|
1062
1122
|
}
|
|
1063
1123
|
}
|
|
1064
1124
|
for (let n of t) e.removeAttribute(n);
|
|
1065
1125
|
}
|
|
1066
1126
|
}
|
|
1067
1127
|
};
|
|
1068
|
-
function
|
|
1128
|
+
function ue(e, ...t) {
|
|
1069
1129
|
let n = B(e, t);
|
|
1070
1130
|
for (;;) {
|
|
1071
1131
|
let e = j.exec(n);
|
|
1072
1132
|
if (!e) break;
|
|
1073
1133
|
let t = e[2];
|
|
1074
|
-
if (
|
|
1134
|
+
if (m.test(t)) {
|
|
1075
1135
|
let r = e[1];
|
|
1076
1136
|
if (!r.startsWith("--")) {
|
|
1077
1137
|
let i = `--${r}: ${t};
|
|
@@ -1082,13 +1142,13 @@ function de(e, ...t) {
|
|
|
1082
1142
|
}
|
|
1083
1143
|
return n;
|
|
1084
1144
|
}
|
|
1085
|
-
function
|
|
1145
|
+
function de(e, ...t) {
|
|
1086
1146
|
let n = B(e, t);
|
|
1087
1147
|
for (;;) {
|
|
1088
1148
|
let e = M.exec(n);
|
|
1089
1149
|
if (!e || e[1] === "style") break;
|
|
1090
|
-
let t =
|
|
1091
|
-
if (
|
|
1150
|
+
let t = ce(e[2]);
|
|
1151
|
+
if (m.test(t)) {
|
|
1092
1152
|
let r = `<!-- ${t.trim()} -->`, i = e.index + e[0].indexOf(">") + 1;
|
|
1093
1153
|
n = J(n, i, t.length, r);
|
|
1094
1154
|
}
|
|
@@ -1096,4 +1156,4 @@ function fe(e, ...t) {
|
|
|
1096
1156
|
return n;
|
|
1097
1157
|
}
|
|
1098
1158
|
//#endregion
|
|
1099
|
-
export {
|
|
1159
|
+
export { m as a, y as c, de as i, b as l, P as n, f as o, ue as r, v as s, $ as t, a as u };
|