solid-ctrl-flow 1.0.18 → 1.0.19
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 +18 -9
- package/dist/index.mjs +1 -0
- package/dist/index.umd.js +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -77,24 +77,33 @@ export declare function createExtractor(name?: string): {
|
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
79
|
* Creates a context with a reactive value.
|
|
80
|
-
*
|
|
80
|
+
* Returns a provider with additional fields:
|
|
81
|
+
* - The `read` getter, which returns an {@link Accessor} to the value
|
|
82
|
+
* - The `runWith()` method, which executes {@link runWithContext} on the option
|
|
81
83
|
* @param init Initial value for the context
|
|
82
84
|
* @param def Default value to set when calling the provider without one
|
|
83
85
|
* @param name Name to give to the context
|
|
84
86
|
*/
|
|
85
|
-
export declare function createOption<T>(init: T, def?: T, name?: string):
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
export declare function createOption<T>(init: T, def?: T, name?: string): {
|
|
88
|
+
(props: {
|
|
89
|
+
value?: T;
|
|
90
|
+
children: JSX.Element;
|
|
91
|
+
}): JSX.Element;
|
|
92
|
+
/** Executes {@link runWithContext} on the provided option */
|
|
93
|
+
runWith<V extends T, R>(x: V, f: (x: V) => R): R;
|
|
94
|
+
} & {
|
|
89
95
|
/** Returns the {@link Accessor} for the value in the current context */
|
|
90
96
|
read: Accessor<T>;
|
|
91
97
|
};
|
|
92
98
|
|
|
93
99
|
/** Creates a scope for the value of {@link Debug.read}, which allows you to display different things in debug mode */
|
|
94
|
-
export declare const Debug:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
100
|
+
export declare const Debug: {
|
|
101
|
+
(props: {
|
|
102
|
+
value?: boolean | undefined;
|
|
103
|
+
children: JSX.Element;
|
|
104
|
+
}): JSX.Element;
|
|
105
|
+
runWith<V extends boolean, R>(x: V, f: (x: V) => R): R;
|
|
106
|
+
} & {
|
|
98
107
|
read: Accessor<boolean>;
|
|
99
108
|
};
|
|
100
109
|
|
package/dist/index.mjs
CHANGED
|
@@ -31,6 +31,7 @@ function createOption(init, def = init, name) {
|
|
|
31
31
|
Object.defineProperty(provider, prop, {
|
|
32
32
|
get: () => useContext(ctx2)
|
|
33
33
|
});
|
|
34
|
+
provider.runWith = (x, f) => runWithContext(ctx2, () => x, () => f(x));
|
|
34
35
|
return provider;
|
|
35
36
|
}
|
|
36
37
|
function runWithContext(ctx2, value, f) {
|
package/dist/index.umd.js
CHANGED