solid-ctrl-flow 1.0.42 → 1.0.44
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 +7 -7
- package/dist/index.mjs +16 -5
- package/dist/index.umd.js +15 -4
- package/package.json +1 -1
- package/readMe.md +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export declare const Case: (props: {
|
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* Returns a {@link Signal} that applies the `??=` operator to the input one.
|
|
78
|
-
* If the getter of {@link param0} is like
|
|
78
|
+
* If the getter of {@link param0} is like `x`, then the result one is like "(x ??= {@link f}())"
|
|
79
79
|
* @param param0 The {@link Signal} to which to coalesce the getter
|
|
80
80
|
* @param f An {@link Accessor} to the value to use when there's a nullish value
|
|
81
81
|
*/
|
|
@@ -97,8 +97,8 @@ export declare type Convert<S, D> = (x: S, prev: D) => D;
|
|
|
97
97
|
* </div>
|
|
98
98
|
* <div id="something-else">
|
|
99
99
|
* <e.Source>
|
|
100
|
-
* This text will be shown instead of
|
|
101
|
-
* If there weren't to be any
|
|
100
|
+
* This text will be shown instead of `e.Dest`.
|
|
101
|
+
* If there weren't to be any `e.Joint` ancestor, then this text would have stayed here
|
|
102
102
|
* </e.Source>
|
|
103
103
|
* </div>
|
|
104
104
|
* </e.Joint>
|
|
@@ -335,11 +335,11 @@ export declare const unwrap: <T extends object>(f: Accessor<T>) => T;
|
|
|
335
335
|
* Calls {@link f} maintaining its reactivity at 2 levels.
|
|
336
336
|
* Unlike the normal {@link unwrap}, this maintains reactivity on the elements of the array too, which means that it can be destructured
|
|
337
337
|
* ```ts
|
|
338
|
-
* const first = unwrap(f); // The value of
|
|
339
|
-
* const [ getFirst ] = first; // The value of
|
|
338
|
+
* const first = unwrap(f); // The value of `first` is reactive but CANNOT be destructured
|
|
339
|
+
* const [ getFirst ] = first; // The value of `getFirst()` is NOT reactive, it's the first element of the CURRENT signal returned by `f()`
|
|
340
340
|
*
|
|
341
|
-
* const second = unwrapSignal(f); // The value of
|
|
342
|
-
* const [ getSecond ] = second; // The value of
|
|
341
|
+
* const second = unwrapSignal(f); // The value of `second` is reactive and CAN be destructured
|
|
342
|
+
* const [ getSecond ] = second; // The value of `getSecond()` IS reactive, it's a function that calls `f()`, gets the first element and calls that too
|
|
343
343
|
* ```
|
|
344
344
|
* @param f An {@link Accessor} to a {@link Signal}
|
|
345
345
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useContext, createMemo, createComponent, createContext, createRoot, getOwner, Match, mergeProps, splitProps, createEffect, on, createResource, untrack, Show, onCleanup, For, mapArray, createSignal, onMount, createRenderEffect } from "solid-js";
|
|
1
|
+
import { useContext, createMemo, createComponent, createContext, createRoot, getOwner, Match, mergeProps, splitProps, createEffect, on, createResource, untrack, Show, onCleanup, For, mapArray, createSignal, onMount, createRenderEffect, getListener } from "solid-js";
|
|
2
2
|
import { createMutable } from "solid-js/store";
|
|
3
3
|
const BASE_CTOR = Function;
|
|
4
4
|
class ReactiveContext extends BASE_CTOR {
|
|
@@ -131,7 +131,7 @@ var Slot;
|
|
|
131
131
|
if (i >= list.length)
|
|
132
132
|
return;
|
|
133
133
|
const last = list.pop();
|
|
134
|
-
if (i === list.length
|
|
134
|
+
if (i === list.length)
|
|
135
135
|
return last;
|
|
136
136
|
const out = list[i];
|
|
137
137
|
out.slot = void 0;
|
|
@@ -246,12 +246,23 @@ function toSignal(obj, k) {
|
|
|
246
246
|
const get = () => obj()[k()];
|
|
247
247
|
return [get, toSetter(get, (v) => obj()[k()] = v)];
|
|
248
248
|
}
|
|
249
|
-
function coalesceSignal([get, set], f) {
|
|
250
|
-
return [() => get() ?? set(f), set];
|
|
251
|
-
}
|
|
252
249
|
function unwrapSignal(f) {
|
|
253
250
|
return [() => f()[0](), (x) => f()[1](x)];
|
|
254
251
|
}
|
|
252
|
+
function coalesceSignal([get, set], f) {
|
|
253
|
+
return [getter, set];
|
|
254
|
+
function getter() {
|
|
255
|
+
const out = get();
|
|
256
|
+
if (out != null)
|
|
257
|
+
return out;
|
|
258
|
+
const listener = getListener(), { state } = listener;
|
|
259
|
+
try {
|
|
260
|
+
return set(f);
|
|
261
|
+
} finally {
|
|
262
|
+
listener.state = state;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
255
266
|
const debug = ReactiveContext.create(false, "debug-scope");
|
|
256
267
|
export {
|
|
257
268
|
Case,
|
package/dist/index.umd.js
CHANGED
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
if (i >= list.length)
|
|
134
134
|
return;
|
|
135
135
|
const last = list.pop();
|
|
136
|
-
if (i === list.length
|
|
136
|
+
if (i === list.length)
|
|
137
137
|
return last;
|
|
138
138
|
const out = list[i];
|
|
139
139
|
out.slot = void 0;
|
|
@@ -248,12 +248,23 @@
|
|
|
248
248
|
const get = () => obj()[k()];
|
|
249
249
|
return [get, toSetter(get, (v) => obj()[k()] = v)];
|
|
250
250
|
}
|
|
251
|
-
function coalesceSignal([get, set], f) {
|
|
252
|
-
return [() => get() ?? set(f), set];
|
|
253
|
-
}
|
|
254
251
|
function unwrapSignal(f) {
|
|
255
252
|
return [() => f()[0](), (x) => f()[1](x)];
|
|
256
253
|
}
|
|
254
|
+
function coalesceSignal([get, set], f) {
|
|
255
|
+
return [getter, set];
|
|
256
|
+
function getter() {
|
|
257
|
+
const out = get();
|
|
258
|
+
if (out != null)
|
|
259
|
+
return out;
|
|
260
|
+
const listener = solidJs.getListener(), { state } = listener;
|
|
261
|
+
try {
|
|
262
|
+
return set(f);
|
|
263
|
+
} finally {
|
|
264
|
+
listener.state = state;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
257
268
|
const debug = ReactiveContext.create(false, "debug-scope");
|
|
258
269
|
exports2.Case = Case;
|
|
259
270
|
exports2.Enfold = Enfold;
|
package/package.json
CHANGED
package/readMe.md
CHANGED
|
@@ -180,11 +180,11 @@ Functions that create bindings between `Signal`s
|
|
|
180
180
|
> #### `toSignal()`
|
|
181
181
|
> Creates a `Signal` from a property of an object
|
|
182
182
|
>
|
|
183
|
-
> #### `coalesceSignal()`
|
|
184
|
-
> Creates a non nullable `Signal` from a nullable one
|
|
185
|
-
>
|
|
186
183
|
> #### `unwrapSignal()`
|
|
187
184
|
> A `Signal`-specific version of `unwrap()` that allows the destructuring of its result
|
|
185
|
+
>
|
|
186
|
+
> #### `coalesceSignal()`
|
|
187
|
+
> Creates a non nullable `Signal` from a nullable one
|
|
188
188
|
|
|
189
189
|
### `ReactiveContext.create()`
|
|
190
190
|
Method that creates a reactive version of a solid `Context` with some additional built-in functionalities
|