thunderous 2.0.3 → 2.0.5
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/index.cjs +14 -3
- package/dist/index.js +14 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -608,7 +608,6 @@ var customElement = (render, options) => {
|
|
608
608
|
#formResetCallbackFns = /* @__PURE__ */ new Set();
|
609
609
|
#formStateRestoreCallbackFns = /* @__PURE__ */ new Set();
|
610
610
|
#clientOnlyCallbackFns = /* @__PURE__ */ new Set();
|
611
|
-
__customCallbackFns = /* @__PURE__ */ new Map();
|
612
611
|
#shadowRoot = attachShadow ? this.attachShadow(shadowRootOptions) : null;
|
613
612
|
#internals = this.attachInternals();
|
614
613
|
#observer = options?.observedAttributes !== void 0 ? null : new MutationObserver((mutations) => {
|
@@ -648,7 +647,7 @@ var customElement = (render, options) => {
|
|
648
647
|
},
|
649
648
|
customCallback: (fn) => {
|
650
649
|
const key = crypto.randomUUID();
|
651
|
-
this.__customCallbackFns
|
650
|
+
this.__customCallbackFns?.set(key, fn);
|
652
651
|
return `this.getRootNode().host.__customCallbackFns.get('${key}')(event)`;
|
653
652
|
},
|
654
653
|
attrSignals: new Proxy(
|
@@ -670,8 +669,9 @@ var customElement = (render, options) => {
|
|
670
669
|
get: (_, prop) => {
|
671
670
|
if (!(prop in this.#propSignals)) this.#propSignals[prop] = createSignal();
|
672
671
|
const [_getter, _setter] = this.#propSignals[prop];
|
672
|
+
let setFromProp = false;
|
673
673
|
const setter = (newValue) => {
|
674
|
-
this[prop] = newValue;
|
674
|
+
if (!setFromProp) this[prop] = newValue;
|
675
675
|
_setter(newValue);
|
676
676
|
};
|
677
677
|
const getter = () => {
|
@@ -688,6 +688,14 @@ You must set an initial value before calling a property signal's getter.
|
|
688
688
|
return value;
|
689
689
|
};
|
690
690
|
getter.getter = true;
|
691
|
+
Object.defineProperty(this, prop, {
|
692
|
+
get: getter,
|
693
|
+
set: (newValue) => {
|
694
|
+
setFromProp = true;
|
695
|
+
_setter(newValue);
|
696
|
+
setFromProp = false;
|
697
|
+
}
|
698
|
+
});
|
691
699
|
return [getter, setter];
|
692
700
|
},
|
693
701
|
set: () => {
|
@@ -743,6 +751,9 @@ You must set an initial value before calling a property signal's getter.
|
|
743
751
|
}
|
744
752
|
constructor() {
|
745
753
|
super();
|
754
|
+
if (Object.prototype.hasOwnProperty.call(this, "__customCallbackFns")) {
|
755
|
+
this.__customCallbackFns = /* @__PURE__ */ new Map();
|
756
|
+
}
|
746
757
|
for (const [attrName, attr] of this.#attributesAsPropertiesMap) {
|
747
758
|
this.#attrSignals[attrName] = createSignal(null);
|
748
759
|
Object.defineProperty(this, attr.prop, {
|
package/dist/index.js
CHANGED
@@ -573,7 +573,6 @@ var customElement = (render, options) => {
|
|
573
573
|
#formResetCallbackFns = /* @__PURE__ */ new Set();
|
574
574
|
#formStateRestoreCallbackFns = /* @__PURE__ */ new Set();
|
575
575
|
#clientOnlyCallbackFns = /* @__PURE__ */ new Set();
|
576
|
-
__customCallbackFns = /* @__PURE__ */ new Map();
|
577
576
|
#shadowRoot = attachShadow ? this.attachShadow(shadowRootOptions) : null;
|
578
577
|
#internals = this.attachInternals();
|
579
578
|
#observer = options?.observedAttributes !== void 0 ? null : new MutationObserver((mutations) => {
|
@@ -613,7 +612,7 @@ var customElement = (render, options) => {
|
|
613
612
|
},
|
614
613
|
customCallback: (fn) => {
|
615
614
|
const key = crypto.randomUUID();
|
616
|
-
this.__customCallbackFns
|
615
|
+
this.__customCallbackFns?.set(key, fn);
|
617
616
|
return `this.getRootNode().host.__customCallbackFns.get('${key}')(event)`;
|
618
617
|
},
|
619
618
|
attrSignals: new Proxy(
|
@@ -635,8 +634,9 @@ var customElement = (render, options) => {
|
|
635
634
|
get: (_, prop) => {
|
636
635
|
if (!(prop in this.#propSignals)) this.#propSignals[prop] = createSignal();
|
637
636
|
const [_getter, _setter] = this.#propSignals[prop];
|
637
|
+
let setFromProp = false;
|
638
638
|
const setter = (newValue) => {
|
639
|
-
this[prop] = newValue;
|
639
|
+
if (!setFromProp) this[prop] = newValue;
|
640
640
|
_setter(newValue);
|
641
641
|
};
|
642
642
|
const getter = () => {
|
@@ -653,6 +653,14 @@ You must set an initial value before calling a property signal's getter.
|
|
653
653
|
return value;
|
654
654
|
};
|
655
655
|
getter.getter = true;
|
656
|
+
Object.defineProperty(this, prop, {
|
657
|
+
get: getter,
|
658
|
+
set: (newValue) => {
|
659
|
+
setFromProp = true;
|
660
|
+
_setter(newValue);
|
661
|
+
setFromProp = false;
|
662
|
+
}
|
663
|
+
});
|
656
664
|
return [getter, setter];
|
657
665
|
},
|
658
666
|
set: () => {
|
@@ -708,6 +716,9 @@ You must set an initial value before calling a property signal's getter.
|
|
708
716
|
}
|
709
717
|
constructor() {
|
710
718
|
super();
|
719
|
+
if (Object.prototype.hasOwnProperty.call(this, "__customCallbackFns")) {
|
720
|
+
this.__customCallbackFns = /* @__PURE__ */ new Map();
|
721
|
+
}
|
711
722
|
for (const [attrName, attr] of this.#attributesAsPropertiesMap) {
|
712
723
|
this.#attrSignals[attrName] = createSignal(null);
|
713
724
|
Object.defineProperty(this, attr.prop, {
|