solid-ctrl-flow 1.0.40 → 1.0.41
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.d.ts +5 -3
- package/dist/index.mjs +5 -12
- package/dist/index.umd.js +5 -12
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -19,11 +19,12 @@ declare const BASE_CTOR: new <T>() => Accessor<T>;
|
|
|
19
19
|
* @param source The getter of the source of the binding
|
|
20
20
|
* @param dest The setter of the destination of the binding
|
|
21
21
|
* @param to Conversion function from {@link S} to {@link D}
|
|
22
|
+
* @param skip If it is `true`, {@link dest} won't be executed until the next change
|
|
22
23
|
* @returns A function that disposes the binding
|
|
23
24
|
*/
|
|
24
|
-
export declare function bind<S>(source: Accessor<S>, dest: Setter<S
|
|
25
|
+
export declare function bind<S>(source: Accessor<S>, dest: Setter<S>, to?: undefined, skip?: boolean): () => void;
|
|
25
26
|
|
|
26
|
-
export declare function bind<S, D>(source: Accessor<S>, dest: Setter<D>, to: Convert<S, D
|
|
27
|
+
export declare function bind<S, D>(source: Accessor<S>, dest: Setter<D>, to: Convert<S, D>, skip?: boolean): () => void;
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Creates a two-way binding between two {@link Signal}s calling {@link bind} two times
|
|
@@ -293,7 +294,8 @@ declare type Unkeyed<T> = Standard<T> & {
|
|
|
293
294
|
export declare function untrackCall<F extends (...args: any[]) => unknown>(this: ThisParameterType<F>, f: F, ...args: Parameters<F>): ReturnType<F>;
|
|
294
295
|
|
|
295
296
|
/**
|
|
296
|
-
* Calls an {@link Accessor} maintaining its reactivity at 1 level
|
|
297
|
+
* Calls an {@link Accessor} maintaining its reactivity at 1 level.
|
|
298
|
+
* The `typeof` operator on the output returns `"function"`, so you have to wrap it if you use it in, for example, in a {@link Setter} and you don't want it to be invoked
|
|
297
299
|
* @param f The {@link Accessor} to the value to emulate
|
|
298
300
|
* @returns A {@link Proxy} that copies the functionalities of the result of {@link f} calling it for each interaction, thus maintaining reactivity
|
|
299
301
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -81,12 +81,7 @@ function When(props) {
|
|
|
81
81
|
function memoProps(obj, keys = Object.keys(obj), equals = false) {
|
|
82
82
|
const out = {};
|
|
83
83
|
for (const elm of keys)
|
|
84
|
-
Object.defineProperty(out, elm, {
|
|
85
|
-
enumerable: true,
|
|
86
|
-
get: createMemo(() => obj[elm], void 0, {
|
|
87
|
-
equals
|
|
88
|
-
})
|
|
89
|
-
});
|
|
84
|
+
Object.defineProperty(out, elm, { enumerable: true, get: createMemo(() => obj[elm], void 0, { equals }) });
|
|
90
85
|
return out;
|
|
91
86
|
}
|
|
92
87
|
function splitAndMemoProps(obj, keys, equals) {
|
|
@@ -98,9 +93,7 @@ function createReactiveResource(f) {
|
|
|
98
93
|
var refetch;
|
|
99
94
|
const memo = createMemo(f);
|
|
100
95
|
createEffect(on(memo, () => refetch?.()));
|
|
101
|
-
const [get] = [, {
|
|
102
|
-
refetch
|
|
103
|
-
}] = createResource(memo);
|
|
96
|
+
const [get] = [, { refetch }] = createResource(memo);
|
|
104
97
|
return get;
|
|
105
98
|
}
|
|
106
99
|
function untrackCall(f, ...args) {
|
|
@@ -217,13 +210,13 @@ function Nest(props) {
|
|
|
217
210
|
return createMemo(() => content().reduceRight((a, b) => b(a), memo.children));
|
|
218
211
|
}
|
|
219
212
|
const IDENTITY = (x) => x;
|
|
220
|
-
function bind(source, dest, to = IDENTITY) {
|
|
221
|
-
const d = createRoot((d2) => (createRenderEffect(on(source, (x) => dest((prev) => to(x, prev)))), d2));
|
|
213
|
+
function bind(source, dest, to = IDENTITY, skip = false) {
|
|
214
|
+
const d = createRoot((d2) => (createRenderEffect(on(source, (x) => skip ? skip = false : dest((prev) => to(x, prev)))), d2));
|
|
222
215
|
return onCleanup(d), d;
|
|
223
216
|
}
|
|
224
217
|
function bindTwoWay(source, dest, to, from) {
|
|
225
218
|
const a = bind(source[0], dest[1], to);
|
|
226
|
-
const b = bind(dest[0], source[1], from);
|
|
219
|
+
const b = bind(dest[0], source[1], from, true);
|
|
227
220
|
return () => (a(), b());
|
|
228
221
|
}
|
|
229
222
|
function toSetter(get, set) {
|
package/dist/index.umd.js
CHANGED
|
@@ -83,12 +83,7 @@
|
|
|
83
83
|
function memoProps(obj, keys = Object.keys(obj), equals = false) {
|
|
84
84
|
const out = {};
|
|
85
85
|
for (const elm of keys)
|
|
86
|
-
Object.defineProperty(out, elm, {
|
|
87
|
-
enumerable: true,
|
|
88
|
-
get: solidJs.createMemo(() => obj[elm], void 0, {
|
|
89
|
-
equals
|
|
90
|
-
})
|
|
91
|
-
});
|
|
86
|
+
Object.defineProperty(out, elm, { enumerable: true, get: solidJs.createMemo(() => obj[elm], void 0, { equals }) });
|
|
92
87
|
return out;
|
|
93
88
|
}
|
|
94
89
|
function splitAndMemoProps(obj, keys, equals) {
|
|
@@ -100,9 +95,7 @@
|
|
|
100
95
|
var refetch;
|
|
101
96
|
const memo = solidJs.createMemo(f);
|
|
102
97
|
solidJs.createEffect(solidJs.on(memo, () => refetch?.()));
|
|
103
|
-
const [get] = [, {
|
|
104
|
-
refetch
|
|
105
|
-
}] = solidJs.createResource(memo);
|
|
98
|
+
const [get] = [, { refetch }] = solidJs.createResource(memo);
|
|
106
99
|
return get;
|
|
107
100
|
}
|
|
108
101
|
function untrackCall(f, ...args) {
|
|
@@ -219,13 +212,13 @@
|
|
|
219
212
|
return solidJs.createMemo(() => content().reduceRight((a, b) => b(a), memo.children));
|
|
220
213
|
}
|
|
221
214
|
const IDENTITY = (x) => x;
|
|
222
|
-
function bind(source, dest, to = IDENTITY) {
|
|
223
|
-
const d = solidJs.createRoot((d2) => (solidJs.createRenderEffect(solidJs.on(source, (x) => dest((prev) => to(x, prev)))), d2));
|
|
215
|
+
function bind(source, dest, to = IDENTITY, skip = false) {
|
|
216
|
+
const d = solidJs.createRoot((d2) => (solidJs.createRenderEffect(solidJs.on(source, (x) => skip ? skip = false : dest((prev) => to(x, prev)))), d2));
|
|
224
217
|
return solidJs.onCleanup(d), d;
|
|
225
218
|
}
|
|
226
219
|
function bindTwoWay(source, dest, to, from) {
|
|
227
220
|
const a = bind(source[0], dest[1], to);
|
|
228
|
-
const b = bind(dest[0], source[1], from);
|
|
221
|
+
const b = bind(dest[0], source[1], from, true);
|
|
229
222
|
return () => (a(), b());
|
|
230
223
|
}
|
|
231
224
|
function toSetter(get, set) {
|