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.
@@ -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 = null;
464
- #u = /* @__PURE__ */ new Map();
461
+ #s = !1;
462
+ #c;
463
+ #l = {};
464
+ #u = null;
465
465
  #d = /* @__PURE__ */ new Map();
466
- #f = /* @__PURE__ */ new WeakMap();
467
- #p = /* @__PURE__ */ new WeakSet();
468
- #m = /* @__PURE__ */ new Map();
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.#j("attrToPropMap") || (e.attrToPropMap = /* @__PURE__ */ new Map()), this.#j("computedGraph") || (e.computedGraph = null), this.#j("computedPropsRegistered") || (e.computedPropsRegistered = !1), this.#j("properties") || (e.properties = {}), this.#j("propToAttrMap") || (e.propToAttrMap = /* @__PURE__ */ new Map()), this.#j("propToComputedMap") || (e.propToComputedMap = /* @__PURE__ */ new Map()), this.#j("propToExprsMap") || (e.propToExprsMap = /* @__PURE__ */ new Map()), this.#j("registeredComputedProps") || (e.registeredComputedProps = /* @__PURE__ */ new Set());
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.#b();
482
+ t === "disabled" && this.#S();
481
483
  let i = e.getPropName(t);
482
- if (!this.#N(i) && this.#M(i)) {
483
- let e = this.#J(i, r), a = this.#O(i);
484
- if (this.#V(i, e), e !== a && this.#O(i) === a) {
485
- this.#U(t, n);
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.#te(e);
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.#x(n, r, t.errors);
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.#V(e, n);
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.#D(t.entries.map(([e]) => e));
510
+ let e = this.#A(t.entries.map(([e]) => e));
509
511
  for (let [t, n] of e) {
510
- this.#B(t, this.#w(n));
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.#C([...a]);
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.#x(e, n, []);
520
+ for (let [e, n] of t.entries) this.#n.properties[e] && this.#C(e, n, []);
519
521
  }
520
- async #h() {
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.#V(t, n);
534
+ this.#W(t, n);
533
535
  }
534
- #g() {
536
+ #v() {
535
537
  let { properties: e } = this.#n;
536
- for (let [t, { computed: n }] of Object.entries(e)) n && this.#B(t, this.#w(n));
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.#ee(), this.#_(), await this.#h(), this.hasAttribute("disabled") && this.#b(), this.#se(this.shadowRoot), this.#F(this.shadowRoot), this.#$(), this.#g(), this.ready();
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.#v(n, r, e);
544
- for (let [n, r] of Object.entries(t)) r.computed && this.#v(n, r, e);
545
- this.#R();
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
- #v(t, n, r) {
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.#G(this, i, "is a required attribute");
552
+ n.required && !a && this.#J(this, i, "is a required attribute");
551
553
  let o = n.value;
552
- this.hasOwnProperty(t) && (o = this.#O(t), this.#y(t));
553
- let { type: s } = n, c = s === Boolean ? o || a : r.includes(i) && a ? this.#q(t, i) : o ?? F(n), u = "#" + t;
554
- this.#V(u, this.#P(t, s, c)), Object.defineProperty(this, t, {
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.#O(u);
559
+ return this.#j(u);
558
560
  },
559
561
  set(e) {
560
- n.computed && !this.#t.has(t) && this.#G(null, t, "is a computed property and cannot be set directly"), s === Number && typeof e == "string" && (e = Y(e));
561
- let r = this.#O(u);
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.#ae(t, s, e);
564
- let a = this.#ne(n, t, e);
565
+ this.#ce(t, s, e);
566
+ let a = this.#ae(n, t, e);
565
567
  if (!a.skipped && a.errors.length) {
566
- this.#x(t, e, a.errors);
568
+ this.#C(t, e, a.errors);
567
569
  return;
568
570
  }
569
- e = this.#P(t, s, e), this.#V(u, e);
570
- let o = this.#d.get(t);
571
- o && l(o.state, o.stateProp, e), this.#Y(t, s, e, i, n.reflect), this.#e || (this.#X(t), this.#L(t)), this.#Q(t, e);
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.#x(t, e, a.errors), n.dispatch && this.dispatch("change", {
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
- #y(e) {
584
+ #x(e) {
583
585
  delete this[e];
584
586
  }
585
- #b() {
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.#m.values()) e();
591
- this.#a.clear(), this.#c = {}, this.#u.clear(), this.#d.clear(), this.#m.clear();
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
- #x(e, t, n) {
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
- #S(t) {
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.#W(t, i);
623
+ this.#q(t, i);
622
624
  continue;
623
625
  }
624
- let a = this.#I(t, i);
626
+ let a = this.#z(t, i);
625
627
  if (a) {
626
- let i = this.#O(a);
627
- i === void 0 && this.#K(t, r, a);
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.#G(t, r, `refers to property "${a}" whose type is not Boolean`), W(t) && e !== String && this.#G(t, r, `refers to property "${a}" whose type is not String`);
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.#N(a);
634
- n && t.#N(c) || (o === "checked" && W(t) ? t.checked = t.value === i : t[c] = i), o === "value" && (s ? (t["on" + s] === void 0 && this.#G(t, r, "refers to an unsupported event name"), t.setAttribute(o, this.#O(a))) : s = "change"), n && !l && t.#u.set(e.getPropName(o), a);
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.#H(i, t, r);
638
+ this.#G(i, t, r);
637
639
  }
638
640
  }
639
- #C(e) {
641
+ #T(e) {
640
642
  for (let t of e) {
641
- let e = this.#w(t), n = this.#a.get(t) ?? [], r = /* @__PURE__ */ new Set();
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.#Z(t, e);
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
- #w(e) {
662
+ #E(e) {
661
663
  return v(e, this, this.#n.context);
662
664
  }
663
- #T(e) {
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.#H(t, e, n);
673
+ this.#G(t, e, n);
672
674
  }
673
675
  }
674
676
  } else {
675
677
  let t = "";
676
678
  if (G(e)) {
677
- this.#H(e.textContent, e);
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.#I(e, t);
686
- n && G(e) ? e.textContent = this.#O(n) : this.#H(t, e);
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.#M("value")) e = `value:${t}`;
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.#s = new FormData(), this.#l = this.attachInternals(), this.#l.setFormValue(this.#s);
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.#O(e);
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.#c;
709
- for (let e of r) i[e] = this.#O(e);
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.#c;
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.#w(n)), this.#V(t, n);
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
- #E() {
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
- #D(e) {
740
- let { computedToDependenciesMap: t, computedToDependentsMap: n, computedToExprMap: r } = this.#E(), i = this.#n.propToComputedMap, a = /* @__PURE__ */ new Set(), o = [...new Set(e)];
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
- #O(e) {
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
- #k(e, t, n) {
772
- let r = this.#O("#" + e), i = this.#d.get(e);
773
- i && l(i.state, i.stateProp, r), this.#e || (this.#X(e), this.#L(e)), this.#Q(e, r), this.propertyChangedCallback(e, t, n);
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
- #A(e, t, n) {
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.#G(e, t, "refers to an unsupported event name") : c = "change";
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.#V(l, r.checked) : a && r.checked && this.#V(l, o) : this.#V(l, n === Number ? Y(o) : o), this.#L(l);
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
- #j(e) {
795
+ #P(e) {
791
796
  return Object.hasOwn(this.#n, e);
792
797
  }
793
- #M(e) {
798
+ #F(e) {
794
799
  return !!this.#n.properties[e];
795
800
  }
796
- #N(e) {
801
+ #I(e) {
797
802
  return !!this.#n.properties[e]?.computed;
798
803
  }
799
- #P(e, n, r) {
800
- if (typeof r != "object" || !r || n !== Array && n !== Object || this.#p.has(r)) return r;
801
- let i = this.#f.get(r);
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.#k(e, n, r);
809
+ this.#M(e, n, r);
805
810
  });
806
- return this.#f.set(r, a), this.#p.add(a), a;
811
+ return this.#m.set(r, a), this.#h.add(a), a;
807
812
  }
808
- #F(e) {
813
+ #R(e) {
809
814
  let t = Array.from(e.querySelectorAll("*"));
810
- for (let e of t) this.#S(e), e.firstElementChild || this.#T(e);
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
- #I(e, t) {
822
+ #z(e, t) {
818
823
  if (!t || !f.test(t)) return;
819
824
  let n = y(t);
820
- return this.#O(n) === void 0 && this.#K(e, "", n), n;
825
+ return this.#j(n) === void 0 && this.#Y(e, "", n), n;
821
826
  }
822
- #L(e) {
827
+ #B(e) {
823
828
  let t = this.#n.propToExprsMap.get(e) || [];
824
- this.#C(t);
829
+ this.#T(t);
825
830
  }
826
831
  ready() {}
827
- #R() {
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.#z(t, n);
836
+ for (let [t, n] of Object.entries(e.properties)) n.computed && this.#H(t, n);
832
837
  }
833
838
  }
834
- #z(e, t) {
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.#O(r) === void 0 && this.#K(null, e, r);
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.#O(r) != "function" && i(r, a);
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.#O(r) != "function") throw new A(`property ${e} computed calls non-method ${r}`);
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
- #B(e, t) {
861
+ #U(e, t) {
857
862
  this.#t.add(e);
858
863
  try {
859
- this.#V(e, t);
864
+ this.#W(e, t);
860
865
  } finally {
861
866
  this.#t.delete(e);
862
867
  }
863
868
  }
864
- #V(e, t) {
869
+ #W(e, t) {
865
870
  this[e] = t;
866
871
  }
867
- #H(e, t, n = void 0) {
872
+ #G(e, t, n = void 0) {
868
873
  if (!e) return;
869
- let r = this.#re(t, n, e);
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.#O(n) == "function") return;
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.#A(t, n, r);
891
- let o = this.#w(e);
892
- n ? Z(t, n, o) : this.#Z(t, o);
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
- #U(e, t) {
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.#b();
906
+ e === "disabled" && this.#S();
902
907
  }
903
- #W(e, t) {
908
+ #q(e, t) {
904
909
  let n = t?.trim() ?? "", r = this.#n.properties[n];
905
- r || this.#K(e, "ref", n), r.type !== O && this.#G(e, "ref", `refers to property "${n}" whose type is not HTMLElement`), this.#O(n) && this.#G(e, "ref", `is a duplicate reference to the property "${n}"`), this.#V(n, e), e.removeAttribute("ref");
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.#s || !U(t) || (this.#s.set(e, t), this.#l?.setFormValue(this.#s));
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
- #G(e, t, n) {
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
- #K(e, t, n) {
921
- this.#G(e, t, `refers to missing property "${n}"`);
925
+ #Y(e, t, n) {
926
+ this.#J(e, t, `refers to missing property "${n}"`);
922
927
  }
923
- #q(e, t) {
924
- return this.#J(e, this.getAttribute(t));
928
+ #X(e, t) {
929
+ return this.#Z(e, this.getAttribute(t));
925
930
  }
926
- #J(t, n) {
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.#G(null, t, "does not specify its type"), n === null) return i === Boolean ? !1 : F(r);
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.#G(null, t, `must be one of ${e}`);
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.#G(null, t, "is a Boolean attribute, so its value must match attribute name or be missing"), n === "" || n === r;
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
- #Y(e, t, n, r, i = !0) {
946
- i && U(n) && !this.#N(e) && n !== (t === Boolean ? this.hasAttribute(r) : this.#q(e, r)) && X(this, r || e, n);
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
- #X(e) {
949
- for (let [t, n] of this.#D([e])) this.#B(t, this.#w(n));
953
+ #$(e) {
954
+ for (let [t, n] of this.#A([e])) this.#U(t, this.#E(n));
950
955
  }
951
- #Z(e, t) {
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.#G(e, void 0, " computed content is not a string or number");
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.#se(e), this.#F(e);
967
+ e.innerHTML = t, this.#ue(e), this.#R(e);
963
968
  } else n && e.textContent !== i && (e.textContent = i);
964
969
  }
965
- #Q(e, t) {
966
- let n = this.#u.get(e);
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.#O(e) != "function") throw new A(`property ${t} usedBy contains non-method ${e}`);
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.#ie(e, t);
1010
- for (let [n, r] of Object.entries(t)) if (this.#M(r)) {
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.#V(r, t), this.#d.set(r, {
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.#m.get(e), r = {
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.#V(i, n);
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.#V(s, o(e, a));
1036
+ this.#W(s, o(e, a));
1032
1037
  }, Object.keys(r));
1033
- this.#m.set(e, {
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
- #ee() {
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.#oe();
1050
+ this.#le();
1046
1051
  continue;
1047
1052
  }
1048
1053
  if (!t.has(e.getPropName(n))) {
1049
1054
  if (n === "name") {
1050
- this.#oe();
1055
+ this.#le();
1051
1056
  continue;
1052
1057
  }
1053
- this.#G(null, n, "is not a supported attribute");
1058
+ this.#J(null, n, "is not a supported attribute");
1054
1059
  }
1055
1060
  }
1056
1061
  }
1057
- #te(e) {
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.#G(null, i, "is a computed property and cannot be set directly"), e.type === Number && typeof o == "string" && (o = Y(o)), this.#ae(i, e.type, o);
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
- #ne(e, t, n) {
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
- #re(e, t, n) {
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.#O(r) === void 0 && this.#K(e, t, r);
1098
+ this.#j(r) === void 0 && this.#Y(e, t, r);
1094
1099
  }), r;
1095
1100
  }
1096
- #ie(e, t) {
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.#G(this, void 0, `invalid state path "${n}"`), t = this.#O(r), this.#M(r) || this.#G(null, r, "refers to missing property in useState map");
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
- #ae(e, t, n) {
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.#G(null, e, i);
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.#G(null, e, `was set to a ${i}, but must be a ${t.name}`);
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.#G(null, e, `was set to a ${i}, but must be a ${t.name}`);
1119
+ i !== t.name.toLowerCase() && this.#J(null, e, `was set to a ${i}, but must be a ${t.name}`);
1115
1120
  }
1116
- #oe() {
1121
+ #le() {
1117
1122
  if (this.#n.formAssociated || this.closest("form") === null) return;
1118
1123
  let e = this.#n.name;
1119
- this.#G(this, void 0, `inside form, class ${e} requires "static formAssociated = true;"`);
1124
+ this.#J(this, void 0, `inside form, class ${e} requires "static formAssociated = true;"`);
1120
1125
  }
1121
- #se(e) {
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.#re(e, r, a);
1136
+ this.#oe(e, r, a);
1132
1137
  let o;
1133
- typeof this.#O(a) == "function" ? o = (e) => this.#O(a).call(this, e) : (this.#re(e, r, a), o = () => this.#w(a)), e.addEventListener(i, o), t.push(r);
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);
@@ -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-DQFGT4l_.js";
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-DQFGT4l_.js";
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.0",
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
  }