wrec 0.43.0 → 0.43.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-DQFGT4l_.js → wrec-B9pzDXTH.js} +170 -165
- package/dist/wrec-ssr.es.js +1 -1
- package/dist/wrec.es.js +1 -1
- package/package.json +2 -2
|
@@ -458,14 +458,16 @@ var $ = class e extends O {
|
|
|
458
458
|
#i = /* @__PURE__ */ new Set();
|
|
459
459
|
#a = /* @__PURE__ */ new Map();
|
|
460
460
|
#o = {};
|
|
461
|
-
#s;
|
|
462
|
-
#c
|
|
463
|
-
#l =
|
|
464
|
-
#u =
|
|
461
|
+
#s = !1;
|
|
462
|
+
#c;
|
|
463
|
+
#l = {};
|
|
464
|
+
#u = null;
|
|
465
465
|
#d = /* @__PURE__ */ new Map();
|
|
466
|
-
#f = /* @__PURE__ */ new
|
|
467
|
-
#p =
|
|
468
|
-
#m = /* @__PURE__ */ new
|
|
466
|
+
#f = /* @__PURE__ */ new Map();
|
|
467
|
+
#p = !1;
|
|
468
|
+
#m = /* @__PURE__ */ new WeakMap();
|
|
469
|
+
#h = /* @__PURE__ */ new WeakSet();
|
|
470
|
+
#g = /* @__PURE__ */ new Map();
|
|
469
471
|
static define(e) {
|
|
470
472
|
if (this.elementName = e, k.get(e)) throw new A(`custom element ${e} is already defined`);
|
|
471
473
|
k.define(e, this);
|
|
@@ -473,16 +475,16 @@ var $ = class e extends O {
|
|
|
473
475
|
constructor() {
|
|
474
476
|
super(), this.attachShadow({ mode: "open" });
|
|
475
477
|
let e = this.#n;
|
|
476
|
-
this.#
|
|
478
|
+
this.#P("attrToPropMap") || (e.attrToPropMap = /* @__PURE__ */ new Map()), this.#P("computedGraph") || (e.computedGraph = null), this.#P("computedPropsRegistered") || (e.computedPropsRegistered = !1), this.#P("properties") || (e.properties = {}), this.#P("propToAttrMap") || (e.propToAttrMap = /* @__PURE__ */ new Map()), this.#P("propToComputedMap") || (e.propToComputedMap = /* @__PURE__ */ new Map()), this.#P("propToExprsMap") || (e.propToExprsMap = /* @__PURE__ */ new Map()), this.#P("registeredComputedProps") || (e.registeredComputedProps = /* @__PURE__ */ new Set());
|
|
477
479
|
}
|
|
478
480
|
attributeChangedCallback(t, n, r) {
|
|
479
481
|
if (this.#i.has(t)) return;
|
|
480
|
-
t === "disabled" && this.#
|
|
482
|
+
t === "disabled" && this.#S();
|
|
481
483
|
let i = e.getPropName(t);
|
|
482
|
-
if (!this.#
|
|
483
|
-
let e = this.#
|
|
484
|
-
if (this.#
|
|
485
|
-
this.#
|
|
484
|
+
if (!this.#I(i) && this.#F(i)) {
|
|
485
|
+
let e = this.#Z(i, r), a = this.#j(i);
|
|
486
|
+
if (this.#W(i, e), e !== a && this.#j(i) === a) {
|
|
487
|
+
this.#K(t, n);
|
|
486
488
|
return;
|
|
487
489
|
}
|
|
488
490
|
let o = this.#o[i];
|
|
@@ -490,34 +492,34 @@ var $ = class e extends O {
|
|
|
490
492
|
}
|
|
491
493
|
}
|
|
492
494
|
batchSet(e) {
|
|
493
|
-
let t = this.#
|
|
495
|
+
let t = this.#ie(e);
|
|
494
496
|
if (t.entries.length === 0) return;
|
|
495
497
|
let [n, r] = t.entries[0];
|
|
496
498
|
if (t.errors.length) {
|
|
497
|
-
this.#
|
|
499
|
+
this.#C(n, r, t.errors);
|
|
498
500
|
return;
|
|
499
501
|
}
|
|
500
502
|
this.#e = !0;
|
|
501
503
|
let i = this.#n.propToExprsMap, a = /* @__PURE__ */ new Set();
|
|
502
504
|
try {
|
|
503
505
|
for (let [e, n] of t.entries) {
|
|
504
|
-
this.#
|
|
506
|
+
this.#W(e, n);
|
|
505
507
|
let t = i.get(e) ?? [];
|
|
506
508
|
for (let e of t) a.add(e);
|
|
507
509
|
}
|
|
508
|
-
let e = this.#
|
|
510
|
+
let e = this.#A(t.entries.map(([e]) => e));
|
|
509
511
|
for (let [t, n] of e) {
|
|
510
|
-
this.#
|
|
512
|
+
this.#U(t, this.#E(n));
|
|
511
513
|
let e = i.get(t) ?? [];
|
|
512
514
|
for (let t of e) a.add(t);
|
|
513
515
|
}
|
|
514
|
-
this.#
|
|
516
|
+
this.#T([...a]);
|
|
515
517
|
} finally {
|
|
516
518
|
this.#e = !1;
|
|
517
519
|
}
|
|
518
|
-
for (let [e, n] of t.entries) this.#n.properties[e] && this.#
|
|
520
|
+
for (let [e, n] of t.entries) this.#n.properties[e] && this.#C(e, n, []);
|
|
519
521
|
}
|
|
520
|
-
async #
|
|
522
|
+
async #_() {
|
|
521
523
|
let e = this.#n, { template: t } = e;
|
|
522
524
|
t || (t = e.template = document.createElement("template"), t.innerHTML = e.buildHTML()), await le(t), this.shadowRoot.replaceChildren(t.content.cloneNode(!0));
|
|
523
525
|
}
|
|
@@ -529,48 +531,48 @@ var $ = class e extends O {
|
|
|
529
531
|
return t.startsWith("<") || (t = `<span><!--${t}--></span>`), e + t;
|
|
530
532
|
}
|
|
531
533
|
changed(e, t, n) {
|
|
532
|
-
this.#
|
|
534
|
+
this.#W(t, n);
|
|
533
535
|
}
|
|
534
|
-
#
|
|
536
|
+
#v() {
|
|
535
537
|
let { properties: e } = this.#n;
|
|
536
|
-
for (let [t, { computed: n }] of Object.entries(e)) n && this.#
|
|
538
|
+
for (let [t, { computed: n }] of Object.entries(e)) n && this.#U(t, this.#E(n));
|
|
537
539
|
}
|
|
538
540
|
async connectedCallback() {
|
|
539
|
-
this.#
|
|
541
|
+
this.#re(), this.#y(), this.#p = !0, this.#s && this.#O(), await this.#_(), this.hasAttribute("disabled") && this.#S(), this.#ue(this.shadowRoot), this.#R(this.shadowRoot), this.#ne(), this.#v(), this.ready();
|
|
540
542
|
}
|
|
541
|
-
#
|
|
543
|
+
#y() {
|
|
542
544
|
let { observedAttributes: e, properties: t } = this.#n;
|
|
543
|
-
for (let [n, r] of Object.entries(t)) r.computed || this.#
|
|
544
|
-
for (let [n, r] of Object.entries(t)) r.computed && this.#
|
|
545
|
-
this.#
|
|
545
|
+
for (let [n, r] of Object.entries(t)) r.computed || this.#b(n, r, e);
|
|
546
|
+
for (let [n, r] of Object.entries(t)) r.computed && this.#b(n, r, e);
|
|
547
|
+
this.#V();
|
|
546
548
|
}
|
|
547
|
-
#
|
|
549
|
+
#b(t, n, r) {
|
|
548
550
|
if (t === "class" || t === "style") throw new A(`"${t}" is a reserved property`);
|
|
549
551
|
let i = e.getAttrName(t), a = this.hasAttribute(i);
|
|
550
|
-
n.required && !a && this.#
|
|
552
|
+
n.required && !a && this.#J(this, i, "is a required attribute");
|
|
551
553
|
let o = n.value;
|
|
552
|
-
this.hasOwnProperty(t) && (o = this.#
|
|
553
|
-
let { type: s } = n, c = s === Boolean ? o || a : r.includes(i) && a ? this.#
|
|
554
|
-
this.#
|
|
554
|
+
this.hasOwnProperty(t) && (o = this.#j(t), this.#x(t));
|
|
555
|
+
let { type: s } = n, c = s === Boolean ? o || a : r.includes(i) && a ? this.#X(t, i) : o ?? F(n), u = "#" + t;
|
|
556
|
+
this.#W(u, this.#L(t, s, c)), Object.defineProperty(this, t, {
|
|
555
557
|
enumerable: !0,
|
|
556
558
|
get() {
|
|
557
|
-
return this.#
|
|
559
|
+
return this.#j(u);
|
|
558
560
|
},
|
|
559
561
|
set(e) {
|
|
560
|
-
n.computed && !this.#t.has(t) && this.#
|
|
561
|
-
let r = this.#
|
|
562
|
+
n.computed && !this.#t.has(t) && this.#J(null, t, "is a computed property and cannot be set directly"), s === Number && typeof e == "string" && (e = Y(e));
|
|
563
|
+
let r = this.#j(u);
|
|
562
564
|
if (e === r) return;
|
|
563
|
-
this.#
|
|
564
|
-
let a = this.#
|
|
565
|
+
this.#ce(t, s, e);
|
|
566
|
+
let a = this.#ae(n, t, e);
|
|
565
567
|
if (!a.skipped && a.errors.length) {
|
|
566
|
-
this.#
|
|
568
|
+
this.#C(t, e, a.errors);
|
|
567
569
|
return;
|
|
568
570
|
}
|
|
569
|
-
e = this.#
|
|
570
|
-
let o = this.#
|
|
571
|
-
o && l(o.state, o.stateProp, e), this.#
|
|
571
|
+
e = this.#L(t, s, e), this.#W(u, e);
|
|
572
|
+
let o = this.#f.get(t);
|
|
573
|
+
o && l(o.state, o.stateProp, e), this.#Q(t, s, e, i, n.reflect), this.#e || (this.#$(t), this.#B(t)), this.#te(t, e);
|
|
572
574
|
let c = this.#o[t];
|
|
573
|
-
c && this.setFormValue(c, String(e)), this.propertyChangedCallback(t, r, e), a.skipped || this.#
|
|
575
|
+
c && this.setFormValue(c, String(e)), this.propertyChangedCallback(t, r, e), a.skipped || this.#C(t, e, a.errors), n.dispatch && this.dispatch("change", {
|
|
574
576
|
tagName: this.localName,
|
|
575
577
|
property: t,
|
|
576
578
|
oldValue: r,
|
|
@@ -579,16 +581,16 @@ var $ = class e extends O {
|
|
|
579
581
|
}
|
|
580
582
|
});
|
|
581
583
|
}
|
|
582
|
-
#
|
|
584
|
+
#x(e) {
|
|
583
585
|
delete this[e];
|
|
584
586
|
}
|
|
585
|
-
#
|
|
587
|
+
#S() {
|
|
586
588
|
let t = this.hasAttribute("disabled"), n = L(this.shadowRoot);
|
|
587
589
|
for (let r of n) N(r) && (r instanceof e ? t ? r.setAttribute("disabled", "") : r.removeAttribute("disabled") : r.disabled = t);
|
|
588
590
|
}
|
|
589
591
|
disconnectedCallback() {
|
|
590
|
-
for (let { unsubscribe: e } of this.#
|
|
591
|
-
this.#a.clear(), this.#
|
|
592
|
+
for (let { unsubscribe: e } of this.#g.values()) e();
|
|
593
|
+
this.#a.clear(), this.#l = {}, this.#d.clear(), this.#f.clear(), this.#g.clear();
|
|
592
594
|
}
|
|
593
595
|
dispatch(e, t) {
|
|
594
596
|
this.dispatchEvent(new CustomEvent(e, {
|
|
@@ -597,7 +599,7 @@ var $ = class e extends O {
|
|
|
597
599
|
detail: t
|
|
598
600
|
}));
|
|
599
601
|
}
|
|
600
|
-
#
|
|
602
|
+
#C(e, t, n) {
|
|
601
603
|
this.#r = !0;
|
|
602
604
|
try {
|
|
603
605
|
this.dispatch("validation", {
|
|
@@ -613,39 +615,39 @@ var $ = class e extends O {
|
|
|
613
615
|
displayIfSet(e, t = "block") {
|
|
614
616
|
return `display: ${e == null ? "none" : t}`;
|
|
615
617
|
}
|
|
616
|
-
#
|
|
618
|
+
#w(t) {
|
|
617
619
|
let n = t instanceof e;
|
|
618
620
|
for (let r of t.getAttributeNames()) {
|
|
619
621
|
let i = t.getAttribute(r);
|
|
620
622
|
if (r === "ref") {
|
|
621
|
-
this.#
|
|
623
|
+
this.#q(t, i);
|
|
622
624
|
continue;
|
|
623
625
|
}
|
|
624
|
-
let a = this.#
|
|
626
|
+
let a = this.#z(t, i);
|
|
625
627
|
if (a) {
|
|
626
|
-
let i = this.#
|
|
627
|
-
i === void 0 && this.#
|
|
628
|
+
let i = this.#j(a);
|
|
629
|
+
i === void 0 && this.#Y(t, r, a);
|
|
628
630
|
let [o, s] = r.split(":"), c = e.getPropName(o);
|
|
629
631
|
if (o === "checked") {
|
|
630
632
|
let { type: e } = this.#n.properties[a];
|
|
631
|
-
V(t) && e !== Boolean && this.#
|
|
633
|
+
V(t) && e !== Boolean && this.#J(t, r, `refers to property "${a}" whose type is not Boolean`), W(t) && e !== String && this.#J(t, r, `refers to property "${a}" whose type is not String`);
|
|
632
634
|
}
|
|
633
|
-
let l = this.#
|
|
634
|
-
n && t.#
|
|
635
|
+
let l = this.#I(a);
|
|
636
|
+
n && t.#I(c) || (o === "checked" && W(t) ? t.checked = t.value === i : t[c] = i), o === "value" && (s ? (t["on" + s] === void 0 && this.#J(t, r, "refers to an unsupported event name"), t.setAttribute(o, this.#j(a))) : s = "change"), n && !l && t.#d.set(e.getPropName(o), a);
|
|
635
637
|
}
|
|
636
|
-
this.#
|
|
638
|
+
this.#G(i, t, r);
|
|
637
639
|
}
|
|
638
640
|
}
|
|
639
|
-
#
|
|
641
|
+
#T(e) {
|
|
640
642
|
for (let t of e) {
|
|
641
|
-
let e = this.#
|
|
643
|
+
let e = this.#E(t), n = this.#a.get(t) ?? [], r = /* @__PURE__ */ new Set();
|
|
642
644
|
for (let t of n) {
|
|
643
645
|
let n = t instanceof HTMLElement || t instanceof CSSStyleRule ? t : t.element;
|
|
644
646
|
if (n instanceof HTMLElement && !n.isConnected) {
|
|
645
647
|
r.add(t);
|
|
646
648
|
continue;
|
|
647
649
|
}
|
|
648
|
-
if (t instanceof HTMLElement) this.#
|
|
650
|
+
if (t instanceof HTMLElement) this.#ee(t, e);
|
|
649
651
|
else if (!(t instanceof CSSStyleRule)) {
|
|
650
652
|
let { element: n, attrName: r } = t;
|
|
651
653
|
n instanceof CSSStyleRule ? n.style.setProperty(r, e) : Z(n, r, e);
|
|
@@ -657,10 +659,10 @@ var $ = class e extends O {
|
|
|
657
659
|
}
|
|
658
660
|
}
|
|
659
661
|
}
|
|
660
|
-
#
|
|
662
|
+
#E(e) {
|
|
661
663
|
return v(e, this, this.#n.context);
|
|
662
664
|
}
|
|
663
|
-
#
|
|
665
|
+
#D(e) {
|
|
664
666
|
let { localName: t } = e;
|
|
665
667
|
if (t === "style") {
|
|
666
668
|
let { sheet: t } = e, n = t?.cssRules ?? [], r = Array.from(n);
|
|
@@ -668,13 +670,13 @@ var $ = class e extends O {
|
|
|
668
670
|
let t = Array.from(e.style);
|
|
669
671
|
for (let n of t) if (n.startsWith("--")) {
|
|
670
672
|
let t = e.style.getPropertyValue(n);
|
|
671
|
-
this.#
|
|
673
|
+
this.#G(t, e, n);
|
|
672
674
|
}
|
|
673
675
|
}
|
|
674
676
|
} else {
|
|
675
677
|
let t = "";
|
|
676
678
|
if (G(e)) {
|
|
677
|
-
this.#
|
|
679
|
+
this.#G(e.textContent, e);
|
|
678
680
|
let n = e.textContent?.match(ee);
|
|
679
681
|
n && (t = n[1]);
|
|
680
682
|
} else {
|
|
@@ -682,16 +684,19 @@ var $ = class e extends O {
|
|
|
682
684
|
n && (t = n.textContent?.trim() ?? "");
|
|
683
685
|
}
|
|
684
686
|
if (t) {
|
|
685
|
-
let n = this.#
|
|
686
|
-
n && G(e) ? e.textContent = this.#
|
|
687
|
+
let n = this.#z(e, t);
|
|
688
|
+
n && G(e) ? e.textContent = this.#j(n) : this.#G(t, e);
|
|
687
689
|
}
|
|
688
690
|
}
|
|
689
691
|
}
|
|
690
692
|
formAssociatedCallback() {
|
|
693
|
+
this.#s = !0, this.#p && this.#O();
|
|
694
|
+
}
|
|
695
|
+
#O() {
|
|
691
696
|
let e = this.getAttribute("form-assoc");
|
|
692
697
|
if (!e) {
|
|
693
698
|
let t = this.getAttribute("name");
|
|
694
|
-
if (t) if (this.#
|
|
699
|
+
if (t) if (this.#F("value")) e = `value:${t}`;
|
|
695
700
|
else return;
|
|
696
701
|
else return;
|
|
697
702
|
}
|
|
@@ -700,26 +705,26 @@ var $ = class e extends O {
|
|
|
700
705
|
let [n, r] = e.split(":");
|
|
701
706
|
t[n.trim()] = r.trim();
|
|
702
707
|
}
|
|
703
|
-
this.#o = t, this.#
|
|
708
|
+
this.#o = t, this.#c = new FormData(), this.#u ??= this.attachInternals(), this.#u.setFormValue(this.#c);
|
|
704
709
|
for (let [e, n] of Object.entries(t)) {
|
|
705
|
-
let t = this.#
|
|
710
|
+
let t = this.#j(e);
|
|
706
711
|
U(t) && this.setFormValue(n, String(t));
|
|
707
712
|
}
|
|
708
|
-
let r = Object.keys(this.#n.properties), i = this.#
|
|
709
|
-
for (let e of r) i[e] = this.#
|
|
713
|
+
let r = Object.keys(this.#n.properties), i = this.#l;
|
|
714
|
+
for (let e of r) i[e] = this.#j(e);
|
|
710
715
|
}
|
|
711
716
|
formResetCallback() {
|
|
712
|
-
let e = this.#
|
|
717
|
+
let e = this.#l;
|
|
713
718
|
for (let t of Object.keys(e)) {
|
|
714
719
|
let n = e[t];
|
|
715
|
-
f.test(n) && (n = this.#
|
|
720
|
+
f.test(n) && (n = this.#E(n)), this.#W(t, n);
|
|
716
721
|
}
|
|
717
722
|
}
|
|
718
723
|
static getAttrName(e) {
|
|
719
724
|
let t = this.propToAttrMap.get(e);
|
|
720
725
|
return t || (t = e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), this.propToAttrMap.set(e, t)), t;
|
|
721
726
|
}
|
|
722
|
-
#
|
|
727
|
+
#k() {
|
|
723
728
|
let e = this.#n, t = e.computedGraph;
|
|
724
729
|
if (t) return t;
|
|
725
730
|
let n = E(), r = E(), i = {};
|
|
@@ -736,8 +741,8 @@ var $ = class e extends O {
|
|
|
736
741
|
computedToExprMap: i
|
|
737
742
|
}, e.computedGraph = t, t;
|
|
738
743
|
}
|
|
739
|
-
#
|
|
740
|
-
let { computedToDependenciesMap: t, computedToDependentsMap: n, computedToExprMap: r } = this.#
|
|
744
|
+
#A(e) {
|
|
745
|
+
let { computedToDependenciesMap: t, computedToDependentsMap: n, computedToExprMap: r } = this.#k(), i = this.#n.propToComputedMap, a = /* @__PURE__ */ new Set(), o = [...new Set(e)];
|
|
741
746
|
for (let e = 0; e < o.length; e++) {
|
|
742
747
|
let t = o[e], n = i.get(t) || [];
|
|
743
748
|
for (let [e, t] of n) r[e] = t, a.has(e) || (a.add(e), o.push(e));
|
|
@@ -761,77 +766,77 @@ var $ = class e extends O {
|
|
|
761
766
|
if (c.length !== a.size) throw new A(`computed properties form a cycle: ${[...a].filter((e) => l.get(e) > 0).sort().join(", ")}`);
|
|
762
767
|
return c.map((e) => [e, r[e]]);
|
|
763
768
|
}
|
|
764
|
-
#
|
|
769
|
+
#j(e) {
|
|
765
770
|
return this[e];
|
|
766
771
|
}
|
|
767
772
|
static getPropName(e) {
|
|
768
773
|
let t = this.attrToPropMap.get(e);
|
|
769
774
|
return t || (t = e.replace(/-([a-z])/g, (e, t) => t.toUpperCase()), this.attrToPropMap.set(e, t)), t;
|
|
770
775
|
}
|
|
771
|
-
#
|
|
772
|
-
let r = this.#
|
|
773
|
-
i && l(i.state, i.stateProp, r), this.#e || (this
|
|
776
|
+
#M(e, t, n) {
|
|
777
|
+
let r = this.#j("#" + e), i = this.#f.get(e);
|
|
778
|
+
i && l(i.state, i.stateProp, r), this.#e || (this.#$(e), this.#B(e)), this.#te(e, r), this.propertyChangedCallback(e, t, n);
|
|
774
779
|
}
|
|
775
|
-
#
|
|
780
|
+
#N(e, t, n) {
|
|
776
781
|
if (n.length !== 1) return;
|
|
777
782
|
let [r] = n;
|
|
778
783
|
if (!f.test(r)) return;
|
|
779
784
|
let i = V(e), a = W(e), o = K(e) || G(e), [s, c] = (t ?? "").split(":");
|
|
780
785
|
if (!(o && s === "value" || i && s === "checked" || a && s === "checked" || G(e))) return;
|
|
781
|
-
c ? e["on" + c] === void 0 && this.#
|
|
786
|
+
c ? e["on" + c] === void 0 && this.#J(e, t, "refers to an unsupported event name") : c = "change";
|
|
782
787
|
let l = y(r);
|
|
783
788
|
e.addEventListener(c, (e) => {
|
|
784
789
|
let { target: t } = e;
|
|
785
790
|
if (!t) return;
|
|
786
791
|
let { type: n } = this.#n.properties[l], r = t, { value: o } = r;
|
|
787
|
-
s === "checked" ? i ? this.#
|
|
792
|
+
s === "checked" ? i ? this.#W(l, r.checked) : a && r.checked && this.#W(l, o) : this.#W(l, n === Number ? Y(o) : o), this.#B(l);
|
|
788
793
|
});
|
|
789
794
|
}
|
|
790
|
-
#
|
|
795
|
+
#P(e) {
|
|
791
796
|
return Object.hasOwn(this.#n, e);
|
|
792
797
|
}
|
|
793
|
-
#
|
|
798
|
+
#F(e) {
|
|
794
799
|
return !!this.#n.properties[e];
|
|
795
800
|
}
|
|
796
|
-
#
|
|
801
|
+
#I(e) {
|
|
797
802
|
return !!this.#n.properties[e]?.computed;
|
|
798
803
|
}
|
|
799
|
-
#
|
|
800
|
-
if (typeof r != "object" || !r || n !== Array && n !== Object || this.#
|
|
801
|
-
let i = this.#
|
|
804
|
+
#L(e, n, r) {
|
|
805
|
+
if (typeof r != "object" || !r || n !== Array && n !== Object || this.#h.has(r)) return r;
|
|
806
|
+
let i = this.#m.get(r);
|
|
802
807
|
if (i) return i;
|
|
803
808
|
let a = t(r, (t, n, r) => {
|
|
804
|
-
this.#
|
|
809
|
+
this.#M(e, n, r);
|
|
805
810
|
});
|
|
806
|
-
return this.#
|
|
811
|
+
return this.#m.set(r, a), this.#h.add(a), a;
|
|
807
812
|
}
|
|
808
|
-
#
|
|
813
|
+
#R(e) {
|
|
809
814
|
let t = Array.from(e.querySelectorAll("*"));
|
|
810
|
-
for (let e of t) this.#
|
|
815
|
+
for (let e of t) this.#w(e), e.firstElementChild || this.#D(e);
|
|
811
816
|
}
|
|
812
817
|
static get observedAttributes() {
|
|
813
818
|
let t = Object.entries(this.properties || {}).filter(([e, t]) => !t.computed).map(([t]) => e.getAttrName(t));
|
|
814
819
|
return t.includes("disabled") || t.push("disabled"), t;
|
|
815
820
|
}
|
|
816
821
|
propertyChangedCallback(e, t, n) {}
|
|
817
|
-
#
|
|
822
|
+
#z(e, t) {
|
|
818
823
|
if (!t || !f.test(t)) return;
|
|
819
824
|
let n = y(t);
|
|
820
|
-
return this.#
|
|
825
|
+
return this.#j(n) === void 0 && this.#Y(e, "", n), n;
|
|
821
826
|
}
|
|
822
|
-
#
|
|
827
|
+
#B(e) {
|
|
823
828
|
let t = this.#n.propToExprsMap.get(e) || [];
|
|
824
|
-
this.#
|
|
829
|
+
this.#T(t);
|
|
825
830
|
}
|
|
826
831
|
ready() {}
|
|
827
|
-
#
|
|
832
|
+
#V() {
|
|
828
833
|
let e = this.#n;
|
|
829
834
|
if (!e.computedPropsRegistered) {
|
|
830
835
|
e.computedPropsRegistered = !0, e.computedGraph = null;
|
|
831
|
-
for (let [t, n] of Object.entries(e.properties)) n.computed && this.#
|
|
836
|
+
for (let [t, n] of Object.entries(e.properties)) n.computed && this.#H(t, n);
|
|
832
837
|
}
|
|
833
838
|
}
|
|
834
|
-
#
|
|
839
|
+
#H(e, t) {
|
|
835
840
|
let n = this.#n;
|
|
836
841
|
n.registeredComputedProps.add(e);
|
|
837
842
|
let r = n.propToComputedMap;
|
|
@@ -842,31 +847,31 @@ var $ = class e extends O {
|
|
|
842
847
|
let a = t.computed;
|
|
843
848
|
for (let t of a.matchAll(p)) {
|
|
844
849
|
let r = y(t[0]);
|
|
845
|
-
this.#
|
|
850
|
+
this.#j(r) === void 0 && this.#Y(null, e, r);
|
|
846
851
|
let o = q(r), s = !1;
|
|
847
852
|
for (let [e, t] of Object.entries(n.properties)) Q(t.usedBy)?.includes(o) && (i(e, a), s = !0);
|
|
848
|
-
!s && typeof this.#
|
|
853
|
+
!s && typeof this.#j(r) != "function" && i(r, a);
|
|
849
854
|
}
|
|
850
855
|
for (let t of a.matchAll(d)) {
|
|
851
856
|
let r = t[1];
|
|
852
|
-
if (typeof this.#
|
|
857
|
+
if (typeof this.#j(r) != "function") throw new A(`property ${e} computed calls non-method ${r}`);
|
|
853
858
|
for (let [e, t] of Object.entries(n.properties)) Q(t.usedBy)?.includes(r) && i(e, a);
|
|
854
859
|
}
|
|
855
860
|
}
|
|
856
|
-
#
|
|
861
|
+
#U(e, t) {
|
|
857
862
|
this.#t.add(e);
|
|
858
863
|
try {
|
|
859
|
-
this.#
|
|
864
|
+
this.#W(e, t);
|
|
860
865
|
} finally {
|
|
861
866
|
this.#t.delete(e);
|
|
862
867
|
}
|
|
863
868
|
}
|
|
864
|
-
#
|
|
869
|
+
#W(e, t) {
|
|
865
870
|
this[e] = t;
|
|
866
871
|
}
|
|
867
|
-
#
|
|
872
|
+
#G(e, t, n = void 0) {
|
|
868
873
|
if (!e) return;
|
|
869
|
-
let r = this.#
|
|
874
|
+
let r = this.#oe(t, n, e);
|
|
870
875
|
if (!r) {
|
|
871
876
|
let r = e.replaceAll("this..", "this.");
|
|
872
877
|
n ? Z(t, n, r) : "textContent" in t && (t.textContent = r);
|
|
@@ -875,7 +880,7 @@ var $ = class e extends O {
|
|
|
875
880
|
let i = this.#n;
|
|
876
881
|
r.forEach((t) => {
|
|
877
882
|
let n = y(t);
|
|
878
|
-
if (typeof this.#
|
|
883
|
+
if (typeof this.#j(n) == "function") return;
|
|
879
884
|
let r = i.propToExprsMap, a = r.get(n);
|
|
880
885
|
a || (a = [], r.set(n, a)), a.includes(e) || a.push(e);
|
|
881
886
|
});
|
|
@@ -887,50 +892,50 @@ var $ = class e extends O {
|
|
|
887
892
|
a || (a = [], this.#a.set(e, a)), a.push(n ? {
|
|
888
893
|
element: t,
|
|
889
894
|
attrName: n
|
|
890
|
-
} : t), t instanceof HTMLElement && this.#
|
|
891
|
-
let o = this.#
|
|
892
|
-
n ? Z(t, n, o) : this.#
|
|
895
|
+
} : t), t instanceof HTMLElement && this.#N(t, n, r);
|
|
896
|
+
let o = this.#E(e);
|
|
897
|
+
n ? Z(t, n, o) : this.#ee(t, o);
|
|
893
898
|
}
|
|
894
|
-
#
|
|
899
|
+
#K(e, t) {
|
|
895
900
|
this.#i.add(e);
|
|
896
901
|
try {
|
|
897
902
|
t === null ? this.removeAttribute(e) : this.setAttribute(e, t);
|
|
898
903
|
} finally {
|
|
899
904
|
this.#i.delete(e);
|
|
900
905
|
}
|
|
901
|
-
e === "disabled" && this.#
|
|
906
|
+
e === "disabled" && this.#S();
|
|
902
907
|
}
|
|
903
|
-
#
|
|
908
|
+
#q(e, t) {
|
|
904
909
|
let n = t?.trim() ?? "", r = this.#n.properties[n];
|
|
905
|
-
r || this.#
|
|
910
|
+
r || this.#Y(e, "ref", n), r.type !== O && this.#J(e, "ref", `refers to property "${n}" whose type is not HTMLElement`), this.#j(n) && this.#J(e, "ref", `is a duplicate reference to the property "${n}"`), this.#W(n, e), e.removeAttribute("ref");
|
|
906
911
|
}
|
|
907
912
|
setAttributeSafe(e, t) {
|
|
908
913
|
this.hasAttribute(e) || this.setAttribute(e, t);
|
|
909
914
|
}
|
|
910
915
|
setFormValue(e, t) {
|
|
911
|
-
!this.#
|
|
916
|
+
!this.#c || !U(t) || (this.#c.set(e, t), this.#u?.setFormValue(this.#c));
|
|
912
917
|
}
|
|
913
918
|
static ssr(e = {}) {
|
|
914
919
|
throw new A("SSR is not available in the browser build.");
|
|
915
920
|
}
|
|
916
|
-
#
|
|
921
|
+
#J(e, t, n) {
|
|
917
922
|
let r = e instanceof HTMLElement ? e.localName : "CSS rule";
|
|
918
923
|
throw new A(`component ${this.#n.elementName}` + (e ? `, element "${r}"` : "") + (t ? `, attribute "${t}"` : "") + ` ${n}`);
|
|
919
924
|
}
|
|
920
|
-
#
|
|
921
|
-
this.#
|
|
925
|
+
#Y(e, t, n) {
|
|
926
|
+
this.#J(e, t, `refers to missing property "${n}"`);
|
|
922
927
|
}
|
|
923
|
-
#
|
|
924
|
-
return this.#
|
|
928
|
+
#X(e, t) {
|
|
929
|
+
return this.#Z(e, this.getAttribute(t));
|
|
925
930
|
}
|
|
926
|
-
#
|
|
931
|
+
#Z(t, n) {
|
|
927
932
|
if (n?.match(p)) return n;
|
|
928
933
|
let r = this.#n.properties[t], { type: i, values: a } = r;
|
|
929
|
-
if (i || this.#
|
|
934
|
+
if (i || this.#J(null, t, "does not specify its type"), n === null) return i === Boolean ? !1 : F(r);
|
|
930
935
|
if (i === String) {
|
|
931
936
|
if (a && !a.includes(n)) {
|
|
932
937
|
let e = a.map((e) => `"${e}"`).join(", ");
|
|
933
|
-
this.#
|
|
938
|
+
this.#J(null, t, `must be one of ${e}`);
|
|
934
939
|
}
|
|
935
940
|
return n;
|
|
936
941
|
}
|
|
@@ -939,31 +944,31 @@ var $ = class e extends O {
|
|
|
939
944
|
if (n === "true") return !0;
|
|
940
945
|
if (n === "false" || n === "null") return !1;
|
|
941
946
|
let r = e.getAttrName(t);
|
|
942
|
-
return n && n !== r && this.#
|
|
947
|
+
return n && n !== r && this.#J(null, t, "is a Boolean attribute, so its value must match attribute name or be missing"), n === "" || n === r;
|
|
943
948
|
}
|
|
944
949
|
}
|
|
945
|
-
#
|
|
946
|
-
i && U(n) && !this.#
|
|
950
|
+
#Q(e, t, n, r, i = !0) {
|
|
951
|
+
i && U(n) && !this.#I(e) && n !== (t === Boolean ? this.hasAttribute(r) : this.#X(e, r)) && X(this, r || e, n);
|
|
947
952
|
}
|
|
948
|
-
|
|
949
|
-
for (let [t, n] of this.#
|
|
953
|
+
#$(e) {
|
|
954
|
+
for (let [t, n] of this.#A([e])) this.#U(t, this.#E(n));
|
|
950
955
|
}
|
|
951
|
-
#
|
|
956
|
+
#ee(e, t) {
|
|
952
957
|
if (t === void 0) return;
|
|
953
958
|
let n = e instanceof HTMLElement;
|
|
954
959
|
Array.isArray(t) && (t = t.join(""));
|
|
955
960
|
let r = typeof t;
|
|
956
|
-
r !== "string" && r !== "number" && this.#
|
|
961
|
+
r !== "string" && r !== "number" && this.#J(e, void 0, " computed content is not a string or number");
|
|
957
962
|
let i = String(t);
|
|
958
963
|
if (e instanceof HTMLElement && G(e)) e.value !== i && (e.value = i);
|
|
959
964
|
else if (n && r === "string" && i.trim().startsWith("<")) {
|
|
960
965
|
let t = se(i);
|
|
961
966
|
if (e.innerHTML === t) return;
|
|
962
|
-
e.innerHTML = t, this.#
|
|
967
|
+
e.innerHTML = t, this.#ue(e), this.#R(e);
|
|
963
968
|
} else n && e.textContent !== i && (e.textContent = i);
|
|
964
969
|
}
|
|
965
|
-
#
|
|
966
|
-
let n = this.#
|
|
970
|
+
#te(e, t) {
|
|
971
|
+
let n = this.#d.get(e);
|
|
967
972
|
if (!n) return;
|
|
968
973
|
let r = this.getRootNode();
|
|
969
974
|
if (!(r instanceof ShadowRoot)) return;
|
|
@@ -972,7 +977,7 @@ var $ = class e extends O {
|
|
|
972
977
|
let a = i;
|
|
973
978
|
a[n] = t;
|
|
974
979
|
}
|
|
975
|
-
|
|
980
|
+
#ne() {
|
|
976
981
|
let e = this.#n, t = (e, t, n) => {
|
|
977
982
|
let r = e.get(t);
|
|
978
983
|
r || (r = [], e.set(t, r)), r.includes(n) || r.push(n);
|
|
@@ -995,7 +1000,7 @@ var $ = class e extends O {
|
|
|
995
1000
|
if (H(e)) {
|
|
996
1001
|
let n = z(e);
|
|
997
1002
|
if (typeof R(this, n)?.get != "function") throw new A(`property ${t} usedBy contains non-getter ${e}`);
|
|
998
|
-
} else if (typeof this.#
|
|
1003
|
+
} else if (typeof this.#j(e) != "function") throw new A(`property ${t} usedBy contains non-method ${e}`);
|
|
999
1004
|
let n = o.get(e) || [];
|
|
1000
1005
|
for (let e of n) s.includes(e) || s.push(e);
|
|
1001
1006
|
}
|
|
@@ -1006,15 +1011,15 @@ var $ = class e extends O {
|
|
|
1006
1011
|
t = {};
|
|
1007
1012
|
for (let n of Object.keys(e)) t[n] = n;
|
|
1008
1013
|
}
|
|
1009
|
-
this.#
|
|
1010
|
-
for (let [n, r] of Object.entries(t)) if (this.#
|
|
1014
|
+
this.#se(e, t);
|
|
1015
|
+
for (let [n, r] of Object.entries(t)) if (this.#F(r)) {
|
|
1011
1016
|
let t = o(e, n);
|
|
1012
|
-
t !== void 0 && this.#
|
|
1017
|
+
t !== void 0 && this.#W(r, t), this.#f.set(r, {
|
|
1013
1018
|
state: e,
|
|
1014
1019
|
stateProp: n
|
|
1015
1020
|
});
|
|
1016
1021
|
}
|
|
1017
|
-
let n = this.#
|
|
1022
|
+
let n = this.#g.get(e), r = {
|
|
1018
1023
|
...n?.map,
|
|
1019
1024
|
...t
|
|
1020
1025
|
};
|
|
@@ -1022,15 +1027,15 @@ var $ = class e extends O {
|
|
|
1022
1027
|
let i = e.subscribe(({ statePath: t, newValue: n }) => {
|
|
1023
1028
|
let i = r[t];
|
|
1024
1029
|
if (i) {
|
|
1025
|
-
this.#
|
|
1030
|
+
this.#W(i, n);
|
|
1026
1031
|
return;
|
|
1027
1032
|
}
|
|
1028
1033
|
let a = Object.keys(r).find((e) => t.startsWith(e + ".") || e.startsWith(t + "."));
|
|
1029
1034
|
if (!a) return;
|
|
1030
1035
|
let s = r[a];
|
|
1031
|
-
this.#
|
|
1036
|
+
this.#W(s, o(e, a));
|
|
1032
1037
|
}, Object.keys(r));
|
|
1033
|
-
this.#
|
|
1038
|
+
this.#g.set(e, {
|
|
1034
1039
|
map: r,
|
|
1035
1040
|
unsubscribe: i
|
|
1036
1041
|
});
|
|
@@ -1038,28 +1043,28 @@ var $ = class e extends O {
|
|
|
1038
1043
|
validate(e) {
|
|
1039
1044
|
return [];
|
|
1040
1045
|
}
|
|
1041
|
-
#
|
|
1046
|
+
#re() {
|
|
1042
1047
|
let t = new Set(Object.keys(this.#n.properties));
|
|
1043
1048
|
for (let n of this.getAttributeNames()) if (!D.has(n) && !n.startsWith("on") && n !== "ref") {
|
|
1044
1049
|
if (n === "form-assoc") {
|
|
1045
|
-
this.#
|
|
1050
|
+
this.#le();
|
|
1046
1051
|
continue;
|
|
1047
1052
|
}
|
|
1048
1053
|
if (!t.has(e.getPropName(n))) {
|
|
1049
1054
|
if (n === "name") {
|
|
1050
|
-
this.#
|
|
1055
|
+
this.#le();
|
|
1051
1056
|
continue;
|
|
1052
1057
|
}
|
|
1053
|
-
this.#
|
|
1058
|
+
this.#J(null, n, "is not a supported attribute");
|
|
1054
1059
|
}
|
|
1055
1060
|
}
|
|
1056
1061
|
}
|
|
1057
|
-
#
|
|
1062
|
+
#ie(e) {
|
|
1058
1063
|
let t = [], n = [], r = { ...this };
|
|
1059
1064
|
for (let [i, a] of Object.entries(e)) {
|
|
1060
1065
|
let e = this.#n.properties[i], o = a;
|
|
1061
1066
|
if (e) {
|
|
1062
|
-
e.computed && this.#
|
|
1067
|
+
e.computed && this.#J(null, i, "is a computed property and cannot be set directly"), e.type === Number && typeof o == "string" && (o = Y(o)), this.#ce(i, e.type, o);
|
|
1063
1068
|
let t = e.validate?.(o);
|
|
1064
1069
|
typeof t == "string" && n.push(t);
|
|
1065
1070
|
}
|
|
@@ -1070,7 +1075,7 @@ var $ = class e extends O {
|
|
|
1070
1075
|
errors: n
|
|
1071
1076
|
};
|
|
1072
1077
|
}
|
|
1073
|
-
#
|
|
1078
|
+
#ae(e, t, n) {
|
|
1074
1079
|
if (this.#e || this.#r) return {
|
|
1075
1080
|
errors: [],
|
|
1076
1081
|
skipped: !0
|
|
@@ -1086,39 +1091,39 @@ var $ = class e extends O {
|
|
|
1086
1091
|
skipped: !1
|
|
1087
1092
|
};
|
|
1088
1093
|
}
|
|
1089
|
-
#
|
|
1094
|
+
#oe(e, t, n) {
|
|
1090
1095
|
let r = n.match(p);
|
|
1091
1096
|
if (r) return r.forEach((n) => {
|
|
1092
1097
|
let r = y(n);
|
|
1093
|
-
this.#
|
|
1098
|
+
this.#j(r) === void 0 && this.#Y(e, t, r);
|
|
1094
1099
|
}), r;
|
|
1095
1100
|
}
|
|
1096
|
-
#
|
|
1101
|
+
#se(e, t) {
|
|
1097
1102
|
for (let [n, r] of Object.entries(t)) {
|
|
1098
1103
|
let t = o(e, n);
|
|
1099
|
-
t === void 0 && this.#
|
|
1104
|
+
t === void 0 && this.#J(this, void 0, `invalid state path "${n}"`), t = this.#j(r), this.#F(r) || this.#J(null, r, "refers to missing property in useState map");
|
|
1100
1105
|
}
|
|
1101
1106
|
}
|
|
1102
|
-
#
|
|
1107
|
+
#ce(e, t, n) {
|
|
1103
1108
|
let { values: r } = this.#n.properties[e];
|
|
1104
1109
|
if (r) {
|
|
1105
1110
|
let i;
|
|
1106
|
-
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.#
|
|
1111
|
+
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.#J(null, e, i);
|
|
1107
1112
|
}
|
|
1108
1113
|
if (n instanceof t) return;
|
|
1109
1114
|
let i = typeof n;
|
|
1110
1115
|
if (i === "object") {
|
|
1111
1116
|
let { constructor: r } = n;
|
|
1112
|
-
i = r.name, r !== t && this.#
|
|
1117
|
+
i = r.name, r !== t && this.#J(null, e, `was set to a ${i}, but must be a ${t.name}`);
|
|
1113
1118
|
}
|
|
1114
|
-
i !== t.name.toLowerCase() && this.#
|
|
1119
|
+
i !== t.name.toLowerCase() && this.#J(null, e, `was set to a ${i}, but must be a ${t.name}`);
|
|
1115
1120
|
}
|
|
1116
|
-
#
|
|
1121
|
+
#le() {
|
|
1117
1122
|
if (this.#n.formAssociated || this.closest("form") === null) return;
|
|
1118
1123
|
let e = this.#n.name;
|
|
1119
|
-
this.#
|
|
1124
|
+
this.#J(this, void 0, `inside form, class ${e} requires "static formAssociated = true;"`);
|
|
1120
1125
|
}
|
|
1121
|
-
#
|
|
1126
|
+
#ue(e) {
|
|
1122
1127
|
let t = Array.from(e.querySelectorAll("*"));
|
|
1123
1128
|
for (let e of t) {
|
|
1124
1129
|
let t = [];
|
|
@@ -1128,9 +1133,9 @@ var $ = class e extends O {
|
|
|
1128
1133
|
let i = r.slice(2);
|
|
1129
1134
|
i = i[0].toLowerCase() + i.slice(1).toLowerCase();
|
|
1130
1135
|
let a = n.value;
|
|
1131
|
-
this.#
|
|
1136
|
+
this.#oe(e, r, a);
|
|
1132
1137
|
let o;
|
|
1133
|
-
typeof this.#
|
|
1138
|
+
typeof this.#j(a) == "function" ? o = (e) => this.#j(a).call(this, e) : (this.#oe(e, r, a), o = () => this.#E(a)), e.addEventListener(i, o), t.push(r);
|
|
1134
1139
|
}
|
|
1135
1140
|
}
|
|
1136
1141
|
for (let n of t) e.removeAttribute(n);
|
package/dist/wrec-ssr.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./wrec-
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./wrec-B9pzDXTH.js";
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var u = Object.defineProperty, d = Object.getOwnPropertyDescriptor, f = Object.getOwnPropertyNames, p = Object.prototype.hasOwnProperty, m = (e, t) => () => (e && (t = e(e = 0)), t), h = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), g = (e, t) => {
|
|
4
4
|
let n = {};
|
package/dist/wrec.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as e, n as t, r as n, t as r, u as i } from "./wrec-
|
|
1
|
+
import { i as e, n as t, r as n, t as r, u as i } from "./wrec-B9pzDXTH.js";
|
|
2
2
|
export { r as Wrec, i as WrecState, t as createElement, n as css, e as html };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wrec",
|
|
3
|
-
"version": "0.43.
|
|
3
|
+
"version": "0.43.1",
|
|
4
4
|
"description": "a library that greatly simplifies building web components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"component",
|
|
@@ -69,6 +69,6 @@
|
|
|
69
69
|
"preview": "vite preview",
|
|
70
70
|
"test": "node port-check.js && playwright test",
|
|
71
71
|
"testui": "playwright test --ui",
|
|
72
|
-
"unittest": "vitest run"
|
|
72
|
+
"unittest": "vitest run --maxWorkers=1"
|
|
73
73
|
}
|
|
74
74
|
}
|