solid-ctrl-flow 2.0.0 → 2.1.0
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 +6 -7
- package/dist/index.mjs +5 -4
- package/dist/index.umd.js +5 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { JSX } from 'solid-js';
|
|
|
4
4
|
import { MemoOptions } from 'solid-js';
|
|
5
5
|
import { Owner } from 'solid-js';
|
|
6
6
|
import { ParentProps } from 'solid-js';
|
|
7
|
+
import { splitProps } from 'solid-js';
|
|
7
8
|
|
|
8
9
|
/** Like a {@link Match} but gets the value from the closest {@link On} ancestor */
|
|
9
10
|
export declare function Case(props: ParentProps<{
|
|
@@ -28,7 +29,7 @@ export declare function Case(props: ParentProps<{
|
|
|
28
29
|
* </e.Source>
|
|
29
30
|
* </div>
|
|
30
31
|
* </e.Joint>
|
|
31
|
-
*
|
|
32
|
+
* </>
|
|
32
33
|
* ```
|
|
33
34
|
* @param name Name to give to the context of the extractor
|
|
34
35
|
*/
|
|
@@ -108,7 +109,7 @@ export declare function memoProps<T, K extends readonly (keyof T)[]>(obj: T, key
|
|
|
108
109
|
* Default
|
|
109
110
|
* </Match>
|
|
110
111
|
* </Switch>
|
|
111
|
-
*
|
|
112
|
+
* </>
|
|
112
113
|
* ```
|
|
113
114
|
*/
|
|
114
115
|
export declare function On<T>(props: ParentProps<{
|
|
@@ -163,13 +164,11 @@ export declare namespace Slot {
|
|
|
163
164
|
}
|
|
164
165
|
|
|
165
166
|
/**
|
|
166
|
-
* Executes {@link splitProps} and memoizes
|
|
167
|
-
* Unlike {@link splitProps}, this doesn't support multiple key-sets out of the box
|
|
167
|
+
* Executes {@link splitProps} and memoizes every returned object but the last one using {@link memoProps}
|
|
168
168
|
* @param obj Object to split and partially memoize
|
|
169
|
-
* @param keys The
|
|
170
|
-
* @param equals The comparator function to use on the newly created memos
|
|
169
|
+
* @param keys The lists of the keys to split from {@link obj}
|
|
171
170
|
*/
|
|
172
|
-
export declare
|
|
171
|
+
export declare const splitAndMemoProps: typeof splitProps;
|
|
173
172
|
|
|
174
173
|
/** Standard parameters to pass to an {@link Enfold} */
|
|
175
174
|
declare type Standard<T> = ParentProps<{
|
package/dist/index.mjs
CHANGED
|
@@ -6,11 +6,12 @@ function memoProps(obj, keys = Reflect.ownKeys(obj), equals = false) {
|
|
|
6
6
|
Object.defineProperty(out, elm, { enumerable: true, get: createMemo(() => obj[elm], void 0, { equals }) });
|
|
7
7
|
return out;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
const out = splitProps(obj, keys);
|
|
11
|
-
|
|
9
|
+
const splitAndMemoProps = (obj, ...keys) => {
|
|
10
|
+
const out = splitProps(obj, ...keys);
|
|
11
|
+
for (var i = 0; i < keys.length; i++)
|
|
12
|
+
out[i] = memoProps(out[i], keys[i]);
|
|
12
13
|
return out;
|
|
13
|
-
}
|
|
14
|
+
};
|
|
14
15
|
function untrackCall(f, ...args) {
|
|
15
16
|
return untrack(() => f.apply(this, args));
|
|
16
17
|
}
|
package/dist/index.umd.js
CHANGED
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
Object.defineProperty(out, elm, { enumerable: true, get: solidJs.createMemo(() => obj[elm], void 0, { equals }) });
|
|
9
9
|
return out;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
const out = solidJs.splitProps(obj, keys);
|
|
13
|
-
|
|
11
|
+
const splitAndMemoProps = (obj, ...keys) => {
|
|
12
|
+
const out = solidJs.splitProps(obj, ...keys);
|
|
13
|
+
for (var i = 0; i < keys.length; i++)
|
|
14
|
+
out[i] = memoProps(out[i], keys[i]);
|
|
14
15
|
return out;
|
|
15
|
-
}
|
|
16
|
+
};
|
|
16
17
|
function untrackCall(f, ...args) {
|
|
17
18
|
return solidJs.untrack(() => f.apply(this, args));
|
|
18
19
|
}
|