solid-ctrl-flow 1.0.28 → 1.0.29
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 +3 -2
- package/dist/index.mjs +13 -14
- package/dist/index.umd.js +12 -13
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -187,13 +187,14 @@ export declare function memoProps<T, K extends readonly (keyof T)[] = (keyof T)[
|
|
|
187
187
|
export declare function refCall<T, U extends T = T>(ref: Ref<T> | undefined, value: U): U;
|
|
188
188
|
|
|
189
189
|
/**
|
|
190
|
-
* Executes {@link f} with the provided {@link Context}
|
|
190
|
+
* Executes {@link f} with the provided value for the specified {@link Context}.
|
|
191
|
+
* You can pass `undefined` to {@link value} in order to get back the default value for {@link ctx}
|
|
191
192
|
* @param ctx The context to which to set the value
|
|
192
193
|
* @param value The value for the context
|
|
193
194
|
* @param f The function to run
|
|
194
195
|
* @returns The same thing {@link f} returned
|
|
195
196
|
*/
|
|
196
|
-
export declare function runWithContext<T, R>(ctx: Context<T>, value: T, f: (x: T) => R): R;
|
|
197
|
+
export declare function runWithContext<T, R>(ctx: Context<T>, value: T | undefined, f: (x: T | undefined) => R): R;
|
|
197
198
|
|
|
198
199
|
/**
|
|
199
200
|
* Executes {@link splitProps} and memoizes the first of the two returned objects
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { untrack, createMemo, splitProps, createContext,
|
|
1
|
+
import { untrack, createMemo, splitProps, createContext, getOwner, runWithOwner, createEffect, on, createResource, createComponent, useContext, createRoot, createRenderEffect, onCleanup, Match, mergeProps, For, Show, onMount } from "solid-js";
|
|
2
2
|
import { createMutable } from "solid-js/store";
|
|
3
3
|
function untrackCall(f, ...args) {
|
|
4
4
|
return untrack(() => f.apply(this, args));
|
|
@@ -43,19 +43,18 @@ function createOption(init, def = init, name) {
|
|
|
43
43
|
return provider;
|
|
44
44
|
}
|
|
45
45
|
function runWithContext(ctx2, value, f) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
});
|
|
46
|
+
const owner = getOwner();
|
|
47
|
+
const context = {
|
|
48
|
+
...owner?.context,
|
|
49
|
+
[ctx2.id]: value
|
|
50
|
+
};
|
|
51
|
+
const temp = {
|
|
52
|
+
context,
|
|
53
|
+
owner,
|
|
54
|
+
owned: null,
|
|
55
|
+
cleanups: null
|
|
56
|
+
};
|
|
57
|
+
return runWithOwner(temp, () => f(value));
|
|
59
58
|
}
|
|
60
59
|
function createReactiveResource(f) {
|
|
61
60
|
var refetch;
|
package/dist/index.umd.js
CHANGED
|
@@ -45,19 +45,18 @@
|
|
|
45
45
|
return provider;
|
|
46
46
|
}
|
|
47
47
|
function runWithContext(ctx2, value, f) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
48
|
+
const owner = solidJs.getOwner();
|
|
49
|
+
const context = {
|
|
50
|
+
...owner?.context,
|
|
51
|
+
[ctx2.id]: value
|
|
52
|
+
};
|
|
53
|
+
const temp = {
|
|
54
|
+
context,
|
|
55
|
+
owner,
|
|
56
|
+
owned: null,
|
|
57
|
+
cleanups: null
|
|
58
|
+
};
|
|
59
|
+
return solidJs.runWithOwner(temp, () => f(value));
|
|
61
60
|
}
|
|
62
61
|
function createReactiveResource(f) {
|
|
63
62
|
var refetch;
|