solid-js 1.3.8 → 1.3.9
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/package.json +2 -2
- package/store/dist/dev.cjs +1 -1
- package/store/dist/dev.js +1 -1
- package/store/dist/server.cjs +2 -1
- package/store/dist/server.js +2 -1
- package/store/types/index.d.ts +1 -1
- package/store/types/modifiers.d.ts +3 -3
- package/store/types/server.d.ts +6 -6
- package/store/types/store.d.ts +24 -23
- package/web/dist/dev.cjs +2 -3
- package/web/dist/dev.js +2 -3
- package/web/dist/web.cjs +2 -3
- package/web/dist/web.js +2 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "solid-js",
|
|
3
3
|
"description": "A declarative JavaScript library for building user interfaces.",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.9",
|
|
5
5
|
"author": "Ryan Carniato",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://solidjs.com",
|
|
@@ -144,5 +144,5 @@
|
|
|
144
144
|
"compiler",
|
|
145
145
|
"performance"
|
|
146
146
|
],
|
|
147
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "939e87af354cdd5f4fcc85d2e1c5df86eecec773"
|
|
148
148
|
}
|
package/store/dist/dev.cjs
CHANGED
|
@@ -215,7 +215,7 @@ const proxyTraps = {
|
|
|
215
215
|
node = nodes[property] || (nodes[property] = createDataNode());
|
|
216
216
|
node();
|
|
217
217
|
}
|
|
218
|
-
return wrappable ? wrap(value, target[$NAME] && `${target[$NAME]}:${property}`) : value;
|
|
218
|
+
return wrappable ? wrap(value, target[$NAME] && `${target[$NAME]}:${property.toString()}`) : value;
|
|
219
219
|
},
|
|
220
220
|
set(target, property, value) {
|
|
221
221
|
setProperty(target, property, unwrap(value));
|
package/store/dist/dev.js
CHANGED
|
@@ -211,7 +211,7 @@ const proxyTraps = {
|
|
|
211
211
|
node = nodes[property] || (nodes[property] = createDataNode());
|
|
212
212
|
node();
|
|
213
213
|
}
|
|
214
|
-
return wrappable ? wrap(value, target[$NAME] && `${target[$NAME]}:${property}`) : value;
|
|
214
|
+
return wrappable ? wrap(value, target[$NAME] && `${target[$NAME]}:${property.toString()}`) : value;
|
|
215
215
|
},
|
|
216
216
|
set(target, property, value) {
|
|
217
217
|
setProperty(target, property, unwrap(value));
|
package/store/dist/server.cjs
CHANGED
|
@@ -77,7 +77,7 @@ function createMutable(state) {
|
|
|
77
77
|
}
|
|
78
78
|
function reconcile(value, options = {}) {
|
|
79
79
|
return state => {
|
|
80
|
-
if (!isWrappable(state)) return value;
|
|
80
|
+
if (!isWrappable(state) || !isWrappable(value)) return value;
|
|
81
81
|
const targetKeys = Object.keys(value);
|
|
82
82
|
for (let i = 0, len = targetKeys.length; i < len; i++) {
|
|
83
83
|
const key = targetKeys[i];
|
|
@@ -87,6 +87,7 @@ function reconcile(value, options = {}) {
|
|
|
87
87
|
for (let i = 0, len = previousKeys.length; i < len; i++) {
|
|
88
88
|
if (value[previousKeys[i]] === undefined) setProperty(state, previousKeys[i], undefined);
|
|
89
89
|
}
|
|
90
|
+
return state;
|
|
90
91
|
};
|
|
91
92
|
}
|
|
92
93
|
function produce(fn) {
|
package/store/dist/server.js
CHANGED
|
@@ -73,7 +73,7 @@ function createMutable(state) {
|
|
|
73
73
|
}
|
|
74
74
|
function reconcile(value, options = {}) {
|
|
75
75
|
return state => {
|
|
76
|
-
if (!isWrappable(state)) return value;
|
|
76
|
+
if (!isWrappable(state) || !isWrappable(value)) return value;
|
|
77
77
|
const targetKeys = Object.keys(value);
|
|
78
78
|
for (let i = 0, len = targetKeys.length; i < len; i++) {
|
|
79
79
|
const key = targetKeys[i];
|
|
@@ -83,6 +83,7 @@ function reconcile(value, options = {}) {
|
|
|
83
83
|
for (let i = 0, len = previousKeys.length; i < len; i++) {
|
|
84
84
|
if (value[previousKeys[i]] === undefined) setProperty(state, previousKeys[i], undefined);
|
|
85
85
|
}
|
|
86
|
+
return state;
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
89
|
function produce(fn) {
|
package/store/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createStore, unwrap, $RAW } from "./store";
|
|
2
|
-
export type { Store, SetStoreFunction, NotWrappable, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, Part,
|
|
2
|
+
export type { Store, SetStoreFunction, NotWrappable, StoreNode, StoreSetter, StorePathRange, ArrayFilterFn, Part, DeepReadonly, DeepMutable } from "./store";
|
|
3
3
|
export * from "./mutable";
|
|
4
4
|
export * from "./modifiers";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DeepMutable, NotWrappable } from "./store";
|
|
2
2
|
export declare type ReconcileOptions = {
|
|
3
3
|
key?: string | null;
|
|
4
4
|
merge?: boolean;
|
|
5
5
|
};
|
|
6
|
-
export declare function reconcile<T>(value: T, options?: ReconcileOptions): (state:
|
|
7
|
-
export declare function produce<T>(fn: (state: T) => void): (state:
|
|
6
|
+
export declare function reconcile<T extends U, U>(value: T, options?: ReconcileOptions): (state: U) => T;
|
|
7
|
+
export declare function produce<T>(fn: (state: DeepMutable<Exclude<T, NotWrappable>>) => void): (state: T) => T;
|
package/store/types/server.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { SetStoreFunction, Store } from "store";
|
|
1
|
+
import type { DeepMutable, SetStoreFunction, Store } from "store";
|
|
2
2
|
export declare const $RAW: unique symbol;
|
|
3
3
|
export declare function isWrappable(obj: any): boolean;
|
|
4
4
|
export declare function unwrap<T>(item: any): T;
|
|
5
|
-
export declare function setProperty(state: any, property:
|
|
6
|
-
export declare function updatePath(current: any, path: any[], traversed?:
|
|
5
|
+
export declare function setProperty(state: any, property: PropertyKey, value: any, force?: boolean): void;
|
|
6
|
+
export declare function updatePath(current: any, path: any[], traversed?: PropertyKey[]): void;
|
|
7
7
|
export declare function createStore<T>(state: T | Store<T>): [Store<T>, SetStoreFunction<T>];
|
|
8
|
-
export declare function createMutable<T>(state: T | Store<T>):
|
|
8
|
+
export declare function createMutable<T>(state: T | Store<T>): T;
|
|
9
9
|
declare type ReconcileOptions = {
|
|
10
10
|
key?: string | null;
|
|
11
11
|
merge?: boolean;
|
|
12
12
|
};
|
|
13
|
-
export declare function reconcile<T>(value: T
|
|
14
|
-
export declare function produce<T>(fn: (state: T) => void): (state:
|
|
13
|
+
export declare function reconcile<T extends U, U>(value: T, options?: ReconcileOptions): (state: U) => T;
|
|
14
|
+
export declare function produce<T>(fn: (state: DeepMutable<T>) => void): (state: T) => T;
|
|
15
15
|
export {};
|
package/store/types/store.d.ts
CHANGED
|
@@ -1,44 +1,45 @@
|
|
|
1
1
|
import { Accessor } from "../..";
|
|
2
2
|
export declare const $RAW: unique symbol, $NODE: unique symbol, $NAME: unique symbol;
|
|
3
|
-
export declare type StoreNode = Record<
|
|
3
|
+
export declare type StoreNode = Record<PropertyKey, any>;
|
|
4
4
|
export declare type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined;
|
|
5
5
|
export declare type Store<T> = DeepReadonly<T>;
|
|
6
6
|
export declare function isWrappable(obj: any): any;
|
|
7
7
|
export declare function unwrap<T extends StoreNode>(item: any, set?: Set<unknown>): T;
|
|
8
8
|
export declare function getDataNodes(target: StoreNode): any;
|
|
9
|
-
export declare function proxyDescriptor(target: StoreNode, property:
|
|
9
|
+
export declare function proxyDescriptor(target: StoreNode, property: PropertyKey): PropertyDescriptor | undefined;
|
|
10
10
|
export declare function ownKeys(target: StoreNode): (string | symbol)[];
|
|
11
11
|
export declare function createDataNode(): Accessor<void> & {
|
|
12
12
|
$: () => void;
|
|
13
13
|
};
|
|
14
|
-
export declare function setProperty(state: StoreNode, property:
|
|
15
|
-
export declare function updatePath(current: StoreNode, path: any[], traversed?:
|
|
16
|
-
export declare type DeepReadonly<T> = {
|
|
14
|
+
export declare function setProperty(state: StoreNode, property: PropertyKey, value: any): void;
|
|
15
|
+
export declare function updatePath(current: StoreNode, path: any[], traversed?: PropertyKey[]): void;
|
|
16
|
+
export declare type DeepReadonly<T> = 0 extends 1 & T ? T : {
|
|
17
17
|
readonly [K in keyof T]: T[K] extends NotWrappable ? T[K] : DeepReadonly<T[K]>;
|
|
18
18
|
};
|
|
19
|
-
export declare type
|
|
19
|
+
export declare type DeepMutable<T> = 0 extends 1 & T ? T : {
|
|
20
|
+
-readonly [K in keyof T]: T[K] extends NotWrappable ? T[K] : DeepMutable<T[K]>;
|
|
21
|
+
};
|
|
20
22
|
export declare type StorePathRange = {
|
|
21
23
|
from?: number;
|
|
22
24
|
to?: number;
|
|
23
25
|
by?: number;
|
|
24
26
|
};
|
|
25
|
-
export declare type ArrayFilterFn<T> = (item: T
|
|
26
|
-
export declare type
|
|
27
|
-
export declare type
|
|
28
|
-
|
|
29
|
-
declare type
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
interface
|
|
33
|
-
<K1 extends
|
|
34
|
-
<K1 extends
|
|
35
|
-
<K1 extends
|
|
36
|
-
<K1 extends
|
|
37
|
-
<K1 extends
|
|
38
|
-
<K1 extends
|
|
39
|
-
<K1 extends
|
|
40
|
-
|
|
41
|
-
(setter: StoreSetter<T>): void;
|
|
27
|
+
export declare type ArrayFilterFn<T> = (item: DeepReadonly<T>, index: number) => boolean;
|
|
28
|
+
export declare type StoreSetter<T, U extends PropertyKey[] = []> = ((prevState: DeepReadonly<T>, traversed: U) => DeepReadonly<T> | Partial<DeepReadonly<T>> | void) | DeepReadonly<T> | Partial<DeepReadonly<T>>;
|
|
29
|
+
export declare type Part<T, K extends KeyOf<T> = KeyOf<T>> = [K] extends [never] ? never : K | readonly K[] | (number extends K ? ArrayFilterFn<T[number]> | StorePathRange : never);
|
|
30
|
+
declare type W<T> = Exclude<T, NotWrappable>;
|
|
31
|
+
declare type KeyOf<T> = number extends keyof T ? 0 extends 1 & T ? keyof T : [T] extends [never] ? never : number : keyof T;
|
|
32
|
+
declare type Rest<T, U extends PropertyKey[]> = [StoreSetter<T, U>] | (0 extends 1 & T ? [...Part<any>[], StoreSetter<any, PropertyKey[]>] : DistributeRest<W<T>, KeyOf<W<T>>, U>);
|
|
33
|
+
declare type DistributeRest<T, K, U extends PropertyKey[]> = [T] extends [never] ? never : K extends KeyOf<T> ? [Part<T, K>, ...Rest<T[K], [K, ...U]>] : never;
|
|
34
|
+
export interface SetStoreFunction<T> {
|
|
35
|
+
<K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>, K6 extends KeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>, K7 extends KeyOf<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>, k7: Part<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>, K7>, ...rest: Rest<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7], [K7, K6, K5, K4, K3, K2, K1]>): void;
|
|
36
|
+
<K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>, K6 extends KeyOf<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, k6: Part<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>, K6>, setter: StoreSetter<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6], [K6, K5, K4, K3, K2, K1]>): void;
|
|
37
|
+
<K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>, K5 extends KeyOf<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, k5: Part<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>, K5>, setter: StoreSetter<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5], [K5, K4, K3, K2, K1]>): void;
|
|
38
|
+
<K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends KeyOf<W<W<W<W<T>[K1]>[K2]>[K3]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, k4: Part<W<W<W<W<T>[K1]>[K2]>[K3]>, K4>, setter: StoreSetter<W<W<W<W<T>[K1]>[K2]>[K3]>[K4], [K4, K3, K2, K1]>): void;
|
|
39
|
+
<K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, k3: Part<W<W<W<T>[K1]>[K2]>, K3>, setter: StoreSetter<W<W<W<T>[K1]>[K2]>[K3], [K3, K2, K1]>): void;
|
|
40
|
+
<K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>>(k1: Part<W<T>, K1>, k2: Part<W<W<T>[K1]>, K2>, setter: StoreSetter<W<W<T>[K1]>[K2], [K2, K1]>): void;
|
|
41
|
+
<K1 extends KeyOf<W<T>>>(k1: Part<W<T>, K1>, setter: StoreSetter<W<T>[K1], [K1]>): void;
|
|
42
|
+
(setter: StoreSetter<T, []>): void;
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
44
45
|
* creates a reactive store that can be read through a proxy object and written with a setter function
|
package/web/dist/dev.cjs
CHANGED
|
@@ -385,11 +385,10 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
385
385
|
solidJs.createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
386
386
|
return () => current;
|
|
387
387
|
}
|
|
388
|
-
if (solidJs.sharedConfig.context
|
|
388
|
+
if (solidJs.sharedConfig.context) {
|
|
389
389
|
for (let i = 0; i < array.length; i++) {
|
|
390
390
|
if (array[i].parentNode) return current = array;
|
|
391
391
|
}
|
|
392
|
-
return current;
|
|
393
392
|
}
|
|
394
393
|
if (array.length === 0) {
|
|
395
394
|
current = cleanChildren(parent, current, marker);
|
|
@@ -404,7 +403,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
404
403
|
}
|
|
405
404
|
current = array;
|
|
406
405
|
} else if (value instanceof Node) {
|
|
407
|
-
if (solidJs.sharedConfig.context &&
|
|
406
|
+
if (solidJs.sharedConfig.context && value.parentNode) return current = multi ? [value] : value;
|
|
408
407
|
if (Array.isArray(current)) {
|
|
409
408
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
410
409
|
cleanChildren(parent, current, null, value);
|
package/web/dist/dev.js
CHANGED
|
@@ -382,11 +382,10 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
382
382
|
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
383
383
|
return () => current;
|
|
384
384
|
}
|
|
385
|
-
if (sharedConfig.context
|
|
385
|
+
if (sharedConfig.context) {
|
|
386
386
|
for (let i = 0; i < array.length; i++) {
|
|
387
387
|
if (array[i].parentNode) return current = array;
|
|
388
388
|
}
|
|
389
|
-
return current;
|
|
390
389
|
}
|
|
391
390
|
if (array.length === 0) {
|
|
392
391
|
current = cleanChildren(parent, current, marker);
|
|
@@ -401,7 +400,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
401
400
|
}
|
|
402
401
|
current = array;
|
|
403
402
|
} else if (value instanceof Node) {
|
|
404
|
-
if (sharedConfig.context &&
|
|
403
|
+
if (sharedConfig.context && value.parentNode) return current = multi ? [value] : value;
|
|
405
404
|
if (Array.isArray(current)) {
|
|
406
405
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
407
406
|
cleanChildren(parent, current, null, value);
|
package/web/dist/web.cjs
CHANGED
|
@@ -384,11 +384,10 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
384
384
|
solidJs.createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
385
385
|
return () => current;
|
|
386
386
|
}
|
|
387
|
-
if (solidJs.sharedConfig.context
|
|
387
|
+
if (solidJs.sharedConfig.context) {
|
|
388
388
|
for (let i = 0; i < array.length; i++) {
|
|
389
389
|
if (array[i].parentNode) return current = array;
|
|
390
390
|
}
|
|
391
|
-
return current;
|
|
392
391
|
}
|
|
393
392
|
if (array.length === 0) {
|
|
394
393
|
current = cleanChildren(parent, current, marker);
|
|
@@ -403,7 +402,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
403
402
|
}
|
|
404
403
|
current = array;
|
|
405
404
|
} else if (value instanceof Node) {
|
|
406
|
-
if (solidJs.sharedConfig.context &&
|
|
405
|
+
if (solidJs.sharedConfig.context && value.parentNode) return current = multi ? [value] : value;
|
|
407
406
|
if (Array.isArray(current)) {
|
|
408
407
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
409
408
|
cleanChildren(parent, current, null, value);
|
package/web/dist/web.js
CHANGED
|
@@ -381,11 +381,10 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
381
381
|
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
382
382
|
return () => current;
|
|
383
383
|
}
|
|
384
|
-
if (sharedConfig.context
|
|
384
|
+
if (sharedConfig.context) {
|
|
385
385
|
for (let i = 0; i < array.length; i++) {
|
|
386
386
|
if (array[i].parentNode) return current = array;
|
|
387
387
|
}
|
|
388
|
-
return current;
|
|
389
388
|
}
|
|
390
389
|
if (array.length === 0) {
|
|
391
390
|
current = cleanChildren(parent, current, marker);
|
|
@@ -400,7 +399,7 @@ function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
|
400
399
|
}
|
|
401
400
|
current = array;
|
|
402
401
|
} else if (value instanceof Node) {
|
|
403
|
-
if (sharedConfig.context &&
|
|
402
|
+
if (sharedConfig.context && value.parentNode) return current = multi ? [value] : value;
|
|
404
403
|
if (Array.isArray(current)) {
|
|
405
404
|
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
406
405
|
cleanChildren(parent, current, null, value);
|