solid-ctrl-flow 1.0.48 → 1.0.49
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 -3
- package/dist/index.mjs +2 -2
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
- package/readMe.md +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -167,7 +167,7 @@ export declare function memoProps<T, K extends readonly (keyof T)[]>(obj: T, key
|
|
|
167
167
|
* Example:
|
|
168
168
|
* ```tsx
|
|
169
169
|
* return <>
|
|
170
|
-
* <Nest each={[ 1, 2, 3 ]} template={(c, x) => <>({x}, {c}, -{x})</>}>
|
|
170
|
+
* <Nest each={[ 1, 2, 3 ]} template={(c, x) => <>({x}, {c()}, -{x})</>}>
|
|
171
171
|
* CONTENT
|
|
172
172
|
* </Nest>
|
|
173
173
|
* </>
|
|
@@ -176,7 +176,7 @@ export declare function memoProps<T, K extends readonly (keyof T)[]>(obj: T, key
|
|
|
176
176
|
*/
|
|
177
177
|
export declare function Nest<T>(props: ParentProps<{
|
|
178
178
|
each: readonly T[] | undefined;
|
|
179
|
-
template: (c: JSX.Element
|
|
179
|
+
template: (c: Accessor<JSX.Element>, x: T, i: Accessor<number>) => JSX.Element;
|
|
180
180
|
}>): JSX.Element;
|
|
181
181
|
|
|
182
182
|
/**
|
|
@@ -311,7 +311,7 @@ declare type Standard<T> = ParentProps<{
|
|
|
311
311
|
}>;
|
|
312
312
|
|
|
313
313
|
/** Type of an element wrapping call-back which accepts an additional parameter */
|
|
314
|
-
declare type Template<T> = (c: JSX.Element
|
|
314
|
+
declare type Template<T> = (c: Accessor<JSX.Element>, x: T) => JSX.Element;
|
|
315
315
|
|
|
316
316
|
/**
|
|
317
317
|
* Creates a full-fledged solid {@link Setter} from a normal one
|
package/dist/index.mjs
CHANGED
|
@@ -106,7 +106,7 @@ function Enfold(props) {
|
|
|
106
106
|
get fallback() {
|
|
107
107
|
return children();
|
|
108
108
|
},
|
|
109
|
-
children: (x) => createMemo(() => untrackCall(props.template,
|
|
109
|
+
children: (x) => createMemo(() => untrackCall(props.template, children, x))
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
var Slot;
|
|
@@ -221,7 +221,7 @@ function Nest(props) {
|
|
|
221
221
|
const memo = memoProps(props, ["template", "children"]);
|
|
222
222
|
const content = mapArray(() => props.each, (x, i) => {
|
|
223
223
|
const [get, set] = createSignal();
|
|
224
|
-
const out = createMemo(() => untrackCall(memo.template,
|
|
224
|
+
const out = createMemo(() => untrackCall(memo.template, get, x, i));
|
|
225
225
|
return (x2) => {
|
|
226
226
|
onMount(() => set(() => x2));
|
|
227
227
|
onCleanup(() => set(void 0));
|
package/dist/index.umd.js
CHANGED
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
get fallback() {
|
|
109
109
|
return children();
|
|
110
110
|
},
|
|
111
|
-
children: (x) => solidJs.createMemo(() => untrackCall(props.template,
|
|
111
|
+
children: (x) => solidJs.createMemo(() => untrackCall(props.template, children, x))
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
exports2.Slot = void 0;
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
const memo = memoProps(props, ["template", "children"]);
|
|
224
224
|
const content = solidJs.mapArray(() => props.each, (x, i) => {
|
|
225
225
|
const [get, set] = solidJs.createSignal();
|
|
226
|
-
const out = solidJs.createMemo(() => untrackCall(memo.template,
|
|
226
|
+
const out = solidJs.createMemo(() => untrackCall(memo.template, get, x, i));
|
|
227
227
|
return (x2) => {
|
|
228
228
|
solidJs.onMount(() => set(() => x2));
|
|
229
229
|
solidJs.onCleanup(() => set(void 0));
|
package/package.json
CHANGED
package/readMe.md
CHANGED
|
@@ -22,7 +22,7 @@ The following code
|
|
|
22
22
|
```tsx
|
|
23
23
|
const value = true;
|
|
24
24
|
return <>
|
|
25
|
-
<Enfold when={value} template={c => <div style={{ background: "red" }}>{c}</div>}>
|
|
25
|
+
<Enfold when={value} template={c => <div style={{ background: "red" }}>{c()}</div>}>
|
|
26
26
|
CONTENT
|
|
27
27
|
</Enfold>
|
|
28
28
|
</>
|
|
@@ -42,7 +42,7 @@ return <>CONTENT</>
|
|
|
42
42
|
If you are wrapping the content with a context provider you need to set the `unrecycled` attribute to `true` to run again the whole content, otherwise the `Owner` of the content won't be child of the template one
|
|
43
43
|
```tsx
|
|
44
44
|
return <>
|
|
45
|
-
<Enfold unrecycled when={value} template={c => <ctx.Provider value={2} children={c} />}>
|
|
45
|
+
<Enfold unrecycled when={value} template={c => <ctx.Provider value={2} children={c()} />}>
|
|
46
46
|
{useContext(ctx)}
|
|
47
47
|
</Enfold>
|
|
48
48
|
</>
|
|
@@ -53,7 +53,7 @@ Like a `For`, but instead of putting an element after another it nests them.
|
|
|
53
53
|
The following code
|
|
54
54
|
```tsx
|
|
55
55
|
return <>
|
|
56
|
-
<Nest each={[ "red", "green", "blue" ]} template={(c, x) => <div style={{ background: x, padding: "1ch" }}>{c}</div>}>
|
|
56
|
+
<Nest each={[ "red", "green", "blue" ]} template={(c, x) => <div style={{ background: x, padding: "1ch" }}>{c()}</div>}>
|
|
57
57
|
CONTENT
|
|
58
58
|
</Nest>
|
|
59
59
|
</>
|