thunderous 2.1.1 → 2.2.0
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 +6 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +6 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -744,7 +744,12 @@ You must set an initial value before calling a property signal's getter.
|
|
744
744
|
setFromProp = false;
|
745
745
|
}
|
746
746
|
});
|
747
|
-
|
747
|
+
const publicSignal = [getter, setter];
|
748
|
+
publicSignal.init = (value) => {
|
749
|
+
_setter(value);
|
750
|
+
return [getter, setter];
|
751
|
+
};
|
752
|
+
return publicSignal;
|
748
753
|
},
|
749
754
|
set: () => {
|
750
755
|
console.error("Signals must be assigned via setters.");
|
package/dist/index.d.cts
CHANGED
@@ -46,7 +46,7 @@ type RenderArgs<Props extends CustomElementProps> = {
|
|
46
46
|
customCallback: (fn: () => void) => `this.getRootNode().host.__customCallbackFns.get('${string}')(event)` | '';
|
47
47
|
attrSignals: Record<string, Signal<string | null>>;
|
48
48
|
propSignals: {
|
49
|
-
[K in keyof Props]:
|
49
|
+
[K in keyof Props]: SignalWithInit<Props[K]>;
|
50
50
|
};
|
51
51
|
refs: Record<string, HTMLElement | null>;
|
52
52
|
adoptStyleSheet: (stylesheet: Styles) => void;
|
@@ -102,6 +102,10 @@ type SignalGetter<T> = {
|
|
102
102
|
type SignalSetter<T> = (newValue: T, options?: SignalOptions) => void;
|
103
103
|
type Signal<T = unknown> = [SignalGetter<T>, SignalSetter<T>];
|
104
104
|
|
105
|
+
// TODO: add `| undefined` to the uninitialized signal.
|
106
|
+
// The reason I didn't do it yet is that it's a breaking change. I'll wait for the next major version.
|
107
|
+
type SignalWithInit<T = unknown> = Signal<T> & { init: (value: T) => Signal<T> };
|
108
|
+
|
105
109
|
// Flexible typing is necessary to support generic functions
|
106
110
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
107
111
|
type AnyFn = (...args: any[]) => any;
|
package/dist/index.d.ts
CHANGED
@@ -46,7 +46,7 @@ type RenderArgs<Props extends CustomElementProps> = {
|
|
46
46
|
customCallback: (fn: () => void) => `this.getRootNode().host.__customCallbackFns.get('${string}')(event)` | '';
|
47
47
|
attrSignals: Record<string, Signal<string | null>>;
|
48
48
|
propSignals: {
|
49
|
-
[K in keyof Props]:
|
49
|
+
[K in keyof Props]: SignalWithInit<Props[K]>;
|
50
50
|
};
|
51
51
|
refs: Record<string, HTMLElement | null>;
|
52
52
|
adoptStyleSheet: (stylesheet: Styles) => void;
|
@@ -102,6 +102,10 @@ type SignalGetter<T> = {
|
|
102
102
|
type SignalSetter<T> = (newValue: T, options?: SignalOptions) => void;
|
103
103
|
type Signal<T = unknown> = [SignalGetter<T>, SignalSetter<T>];
|
104
104
|
|
105
|
+
// TODO: add `| undefined` to the uninitialized signal.
|
106
|
+
// The reason I didn't do it yet is that it's a breaking change. I'll wait for the next major version.
|
107
|
+
type SignalWithInit<T = unknown> = Signal<T> & { init: (value: T) => Signal<T> };
|
108
|
+
|
105
109
|
// Flexible typing is necessary to support generic functions
|
106
110
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
107
111
|
type AnyFn = (...args: any[]) => any;
|
package/dist/index.js
CHANGED
@@ -709,7 +709,12 @@ You must set an initial value before calling a property signal's getter.
|
|
709
709
|
setFromProp = false;
|
710
710
|
}
|
711
711
|
});
|
712
|
-
|
712
|
+
const publicSignal = [getter, setter];
|
713
|
+
publicSignal.init = (value) => {
|
714
|
+
_setter(value);
|
715
|
+
return [getter, setter];
|
716
|
+
};
|
717
|
+
return publicSignal;
|
713
718
|
},
|
714
719
|
set: () => {
|
715
720
|
console.error("Signals must be assigned via setters.");
|