solid-ctrl-flow 1.0.55 → 1.0.57
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 +0 -18
- package/dist/index.mjs +1 -24
- package/dist/index.umd.js +0 -23
- package/package.json +1 -1
- package/readMe.md +0 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { Accessor } from 'solid-js';
|
|
2
2
|
import { Context } from 'solid-js';
|
|
3
|
-
import { EffectFunction } from 'solid-js';
|
|
4
3
|
import { JSX } from 'solid-js';
|
|
5
4
|
import { MemoOptions } from 'solid-js';
|
|
6
5
|
import { Owner } from 'solid-js';
|
|
7
6
|
import { ParentProps } from 'solid-js';
|
|
8
|
-
import { Resource } from 'solid-js';
|
|
9
7
|
import { Setter } from 'solid-js';
|
|
10
8
|
import { Signal } from 'solid-js';
|
|
11
9
|
|
|
@@ -60,14 +58,6 @@ export declare function Case<T>(props: {
|
|
|
60
58
|
children(x: NonNullable<T>): JSX.Element;
|
|
61
59
|
}): JSX.Element;
|
|
62
60
|
|
|
63
|
-
/**
|
|
64
|
-
* Returns a {@link Signal} that applies the `??=` operator to the input one.
|
|
65
|
-
* If the getter of {@link param0} is like `x`, then the result one is like "(x ??= {@link f}())"
|
|
66
|
-
* @param param0 The {@link Signal} to which to coalesce the getter
|
|
67
|
-
* @param f An {@link Accessor} to the value to use when there's a nullish value
|
|
68
|
-
*/
|
|
69
|
-
export declare function coalesceSignal<T>([get, set]: Signal<T | undefined>, f: Accessor<T>): Signal<T>;
|
|
70
|
-
|
|
71
61
|
/** Conversion function for bindings */
|
|
72
62
|
export declare type Convert<S, D> = (x: S, prev: D) => D;
|
|
73
63
|
|
|
@@ -115,14 +105,6 @@ export declare function createExtractor(name?: string): {
|
|
|
115
105
|
readonly extracting: () => number | null;
|
|
116
106
|
};
|
|
117
107
|
|
|
118
|
-
/**
|
|
119
|
-
* Creates a {@link Resource} from the function {@link f}.
|
|
120
|
-
* The resource will be refetched each time one of the dependencies of {@link f} changes.
|
|
121
|
-
* The only dependant signals that will be tracked are the ones before the first `await`
|
|
122
|
-
* @param f A reactive resource fetcher
|
|
123
|
-
*/
|
|
124
|
-
export declare function createReactiveResource<R>(f: EffectFunction<R | undefined, R>): Resource<Awaited<R>>;
|
|
125
|
-
|
|
126
108
|
/** Built-in {@link ReactiveContext} which allows you to display different things in debug mode */
|
|
127
109
|
export declare const debug: ReactiveContext<boolean>;
|
|
128
110
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useContext, createMemo, createComponent, createContext, createRoot, getOwner, untrack,
|
|
1
|
+
import { useContext, createMemo, createComponent, createContext, createRoot, getOwner, untrack, splitProps, Show, onCleanup, For, Match, mergeProps, createComputed, on, createSignal } from "solid-js";
|
|
2
2
|
import { createMutable } from "solid-js/store";
|
|
3
3
|
const BASE_CTOR = Function;
|
|
4
4
|
class ReactiveContext extends BASE_CTOR {
|
|
@@ -67,13 +67,6 @@ function runWithContext(ctx2, value, f) {
|
|
|
67
67
|
function untrackCall(f, ...args) {
|
|
68
68
|
return untrack(() => f.apply(this, args));
|
|
69
69
|
}
|
|
70
|
-
function createReactiveResource(f) {
|
|
71
|
-
var refetch;
|
|
72
|
-
const memo = createMemo(f);
|
|
73
|
-
createEffect(on(memo, () => refetch?.()));
|
|
74
|
-
const [get] = [, { refetch }] = createResource(memo);
|
|
75
|
-
return get;
|
|
76
|
-
}
|
|
77
70
|
function memoProps(obj, keys = Object.keys(obj), equals = false) {
|
|
78
71
|
const out = {};
|
|
79
72
|
for (const elm of keys)
|
|
@@ -264,20 +257,6 @@ function forceSignal([get, set]) {
|
|
|
264
257
|
}
|
|
265
258
|
];
|
|
266
259
|
}
|
|
267
|
-
function coalesceSignal([get, set], f) {
|
|
268
|
-
return [getter, set];
|
|
269
|
-
function getter() {
|
|
270
|
-
const out = get();
|
|
271
|
-
if (out != null)
|
|
272
|
-
return out;
|
|
273
|
-
const listener = getListener(), { state } = listener;
|
|
274
|
-
try {
|
|
275
|
-
return set(f);
|
|
276
|
-
} finally {
|
|
277
|
-
listener.state = state;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
260
|
const debug = ReactiveContext.create(false, "debug-scope");
|
|
282
261
|
function SameContext(props) {
|
|
283
262
|
return createMemo(() => {
|
|
@@ -294,9 +273,7 @@ export {
|
|
|
294
273
|
Slot,
|
|
295
274
|
bind,
|
|
296
275
|
bindTwoWay,
|
|
297
|
-
coalesceSignal,
|
|
298
276
|
createExtractor,
|
|
299
|
-
createReactiveResource,
|
|
300
277
|
debug,
|
|
301
278
|
forceSignal,
|
|
302
279
|
memoProps,
|
package/dist/index.umd.js
CHANGED
|
@@ -69,13 +69,6 @@
|
|
|
69
69
|
function untrackCall(f, ...args) {
|
|
70
70
|
return solidJs.untrack(() => f.apply(this, args));
|
|
71
71
|
}
|
|
72
|
-
function createReactiveResource(f) {
|
|
73
|
-
var refetch;
|
|
74
|
-
const memo = solidJs.createMemo(f);
|
|
75
|
-
solidJs.createEffect(solidJs.on(memo, () => refetch?.()));
|
|
76
|
-
const [get] = [, { refetch }] = solidJs.createResource(memo);
|
|
77
|
-
return get;
|
|
78
|
-
}
|
|
79
72
|
function memoProps(obj, keys = Object.keys(obj), equals = false) {
|
|
80
73
|
const out = {};
|
|
81
74
|
for (const elm of keys)
|
|
@@ -266,20 +259,6 @@
|
|
|
266
259
|
}
|
|
267
260
|
];
|
|
268
261
|
}
|
|
269
|
-
function coalesceSignal([get, set], f) {
|
|
270
|
-
return [getter, set];
|
|
271
|
-
function getter() {
|
|
272
|
-
const out = get();
|
|
273
|
-
if (out != null)
|
|
274
|
-
return out;
|
|
275
|
-
const listener = solidJs.getListener(), { state } = listener;
|
|
276
|
-
try {
|
|
277
|
-
return set(f);
|
|
278
|
-
} finally {
|
|
279
|
-
listener.state = state;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
262
|
const debug = ReactiveContext.create(false, "debug-scope");
|
|
284
263
|
function SameContext(props) {
|
|
285
264
|
return solidJs.createMemo(() => {
|
|
@@ -294,9 +273,7 @@
|
|
|
294
273
|
exports2.SameContext = SameContext;
|
|
295
274
|
exports2.bind = bind;
|
|
296
275
|
exports2.bindTwoWay = bindTwoWay;
|
|
297
|
-
exports2.coalesceSignal = coalesceSignal;
|
|
298
276
|
exports2.createExtractor = createExtractor;
|
|
299
|
-
exports2.createReactiveResource = createReactiveResource;
|
|
300
277
|
exports2.debug = debug;
|
|
301
278
|
exports2.forceSignal = forceSignal;
|
|
302
279
|
exports2.memoProps = memoProps;
|
package/package.json
CHANGED
package/readMe.md
CHANGED
|
@@ -182,9 +182,6 @@ Functions that create bindings between `Signal`s
|
|
|
182
182
|
>
|
|
183
183
|
> #### `forceSignal()`
|
|
184
184
|
> Creates a `Signal` that behaves like the input one, with the only difference that each call to the setter will trigger the effects even if the value didn't change
|
|
185
|
-
>
|
|
186
|
-
> #### `coalesceSignal()`
|
|
187
|
-
> Creates a non nullable `Signal` from a nullable one
|
|
188
185
|
|
|
189
186
|
### `ReactiveContext.create()`
|
|
190
187
|
Method that creates a reactive version of a solid `Context` with some additional built-in functionalities
|
|
@@ -218,9 +215,6 @@ return <>
|
|
|
218
215
|
### `untrackCall()`
|
|
219
216
|
Calls a function untracking what happens inside of it but not what gets passed as its argument
|
|
220
217
|
|
|
221
|
-
### `createReactiveResource()`
|
|
222
|
-
Like `createResource()` but the provided function will be reactive
|
|
223
|
-
|
|
224
218
|
### `memoProps()`
|
|
225
219
|
Creates a partial version of an object with memoized remaining properties
|
|
226
220
|
|