solid-ctrl-flow 1.0.28 → 1.0.30
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 -7
- package/dist/index.mjs +13 -20
- package/dist/index.umd.js +12 -19
- package/package.json +1 -1
- package/readMe.md +0 -9
package/dist/index.d.ts
CHANGED
|
@@ -157,11 +157,6 @@ export declare const Debug: {
|
|
|
157
157
|
read: Accessor<boolean>;
|
|
158
158
|
};
|
|
159
159
|
|
|
160
|
-
/** Component that gives you the owner {@link Document} */
|
|
161
|
-
export declare function Doc(props: {
|
|
162
|
-
ref: Ref<Document>;
|
|
163
|
-
}): Text;
|
|
164
|
-
|
|
165
160
|
/** Informations about a {@link Source} component */
|
|
166
161
|
declare type Info = {
|
|
167
162
|
/** Order of the current source if there are many */
|
|
@@ -187,13 +182,14 @@ export declare function memoProps<T, K extends readonly (keyof T)[] = (keyof T)[
|
|
|
187
182
|
export declare function refCall<T, U extends T = T>(ref: Ref<T> | undefined, value: U): U;
|
|
188
183
|
|
|
189
184
|
/**
|
|
190
|
-
* Executes {@link f} with the provided {@link Context}
|
|
185
|
+
* Executes {@link f} with the provided value for the specified {@link Context}.
|
|
186
|
+
* You can pass `undefined` to {@link value} in order to get back the default value for {@link ctx}
|
|
191
187
|
* @param ctx The context to which to set the value
|
|
192
188
|
* @param value The value for the context
|
|
193
189
|
* @param f The function to run
|
|
194
190
|
* @returns The same thing {@link f} returned
|
|
195
191
|
*/
|
|
196
|
-
export declare function runWithContext<T, R>(ctx: Context<T>, value: T, f: (x: T) => R): R;
|
|
192
|
+
export declare function runWithContext<T, R>(ctx: Context<T>, value: T | undefined, f: (x: T | undefined) => R): R;
|
|
197
193
|
|
|
198
194
|
/**
|
|
199
195
|
* 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 } 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;
|
|
@@ -188,15 +187,9 @@ function Joint(props) {
|
|
|
188
187
|
});
|
|
189
188
|
}
|
|
190
189
|
const Debug = createOption(false, true, "debug-scope");
|
|
191
|
-
function Doc(props) {
|
|
192
|
-
const node = document.createTextNode("");
|
|
193
|
-
onMount(() => (refCall(props.ref, node.ownerDocument), node.remove()));
|
|
194
|
-
return node;
|
|
195
|
-
}
|
|
196
190
|
export {
|
|
197
191
|
Case,
|
|
198
192
|
Debug,
|
|
199
|
-
Doc,
|
|
200
193
|
When,
|
|
201
194
|
bind,
|
|
202
195
|
bindTwoWay,
|
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;
|
|
@@ -190,14 +189,8 @@
|
|
|
190
189
|
});
|
|
191
190
|
}
|
|
192
191
|
const Debug = createOption(false, true, "debug-scope");
|
|
193
|
-
function Doc(props) {
|
|
194
|
-
const node = document.createTextNode("");
|
|
195
|
-
solidJs.onMount(() => (refCall(props.ref, node.ownerDocument), node.remove()));
|
|
196
|
-
return node;
|
|
197
|
-
}
|
|
198
192
|
exports2.Case = Case;
|
|
199
193
|
exports2.Debug = Debug;
|
|
200
|
-
exports2.Doc = Doc;
|
|
201
194
|
exports2.When = When;
|
|
202
195
|
exports2.bind = bind;
|
|
203
196
|
exports2.bindTwoWay = bindTwoWay;
|
package/package.json
CHANGED
package/readMe.md
CHANGED
|
@@ -47,15 +47,6 @@ return <>
|
|
|
47
47
|
</>
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
### `Doc`
|
|
51
|
-
Gives back the current document
|
|
52
|
-
```tsx
|
|
53
|
-
var doc: Document;
|
|
54
|
-
return <>
|
|
55
|
-
<Doc ref={doc} />
|
|
56
|
-
</>
|
|
57
|
-
```
|
|
58
|
-
|
|
59
50
|
### `createExtractor()`
|
|
60
51
|
Creates a context for components that may need to be out of their parent in certain conditions.
|
|
61
52
|
If you have this component
|