solid-js 1.6.10 → 1.6.12
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/LICENSE +1 -1
- package/dist/dev.cjs +20 -10
- package/dist/dev.js +20 -10
- package/dist/server.cjs +3 -4
- package/dist/server.js +3 -4
- package/dist/solid.cjs +18 -8
- package/dist/solid.js +18 -8
- package/h/jsx-runtime/dist/jsx.cjs +6 -3
- package/h/jsx-runtime/dist/jsx.js +5 -2
- package/h/jsx-runtime/types/index.d.ts +6 -2
- package/h/jsx-runtime/types/jsx.d.ts +2 -0
- package/html/dist/html.cjs +7 -3
- package/html/dist/html.js +7 -3
- package/package.json +3 -2
- package/store/dist/dev.cjs +2 -5
- package/store/dist/dev.js +2 -5
- package/store/dist/store.cjs +2 -5
- package/store/dist/store.js +2 -5
- package/store/types/modifiers.d.ts +1 -1
- package/store/types/server.d.ts +2 -2
- package/store/types/store.d.ts +23 -21
- package/types/index.d.ts +1 -1
- package/types/jsx.d.ts +2 -0
- package/types/reactive/array.d.ts +23 -0
- package/types/reactive/observable.d.ts +1 -1
- package/types/reactive/signal.d.ts +54 -31
- package/types/render/component.d.ts +18 -18
- package/types/render/flow.d.ts +1 -1
- package/types/render/hydration.d.ts +2 -2
- package/types/server/reactive.d.ts +7 -7
- package/types/server/rendering.d.ts +20 -20
- package/web/dist/dev.cjs +31 -25
- package/web/dist/dev.js +32 -27
- package/web/dist/server.cjs +10 -1
- package/web/dist/server.js +10 -2
- package/web/dist/web.cjs +38 -26
- package/web/dist/web.js +39 -28
- package/web/types/index.d.ts +3 -2
- package/web/types/server-mock.d.ts +1 -1
package/store/types/store.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ export declare const $RAW: unique symbol, $NODE: unique symbol, $NAME: unique sy
|
|
|
2
2
|
declare global {
|
|
3
3
|
var _$onStoreNodeUpdate: OnStoreNodeUpdate | undefined;
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
type DataNode = {
|
|
6
6
|
(): any;
|
|
7
7
|
$(value?: any): void;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
export
|
|
9
|
+
type DataNodes = Record<PropertyKey, DataNode>;
|
|
10
|
+
export type OnStoreNodeUpdate = (state: StoreNode, property: PropertyKey, value: StoreNode | NotWrappable, prev: StoreNode | NotWrappable) => void;
|
|
11
11
|
export interface StoreNode {
|
|
12
12
|
[$NAME]?: string;
|
|
13
13
|
[$NODE]?: DataNodes;
|
|
@@ -17,8 +17,8 @@ export declare namespace SolidStore {
|
|
|
17
17
|
interface Unwrappable {
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
export
|
|
21
|
-
export
|
|
20
|
+
export type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined | SolidStore.Unwrappable[keyof SolidStore.Unwrappable];
|
|
21
|
+
export type Store<T> = T;
|
|
22
22
|
export declare function isWrappable<T>(obj: T | NotWrappable): obj is T;
|
|
23
23
|
/**
|
|
24
24
|
* Returns the underlying data in the store without a proxy.
|
|
@@ -34,45 +34,47 @@ export declare function isWrappable<T>(obj: T | NotWrappable): obj is T;
|
|
|
34
34
|
export declare function unwrap<T>(item: T, set?: Set<unknown>): T;
|
|
35
35
|
export declare function getDataNodes(target: StoreNode): DataNodes;
|
|
36
36
|
export declare function getDataNode(nodes: DataNodes, property: PropertyKey, value: any): DataNode;
|
|
37
|
-
export declare function proxyDescriptor(target: StoreNode, property: PropertyKey):
|
|
37
|
+
export declare function proxyDescriptor(target: StoreNode, property: PropertyKey): TypedPropertyDescriptor<any> | undefined;
|
|
38
38
|
export declare function trackSelf(target: StoreNode): void;
|
|
39
39
|
export declare function ownKeys(target: StoreNode): (string | symbol)[];
|
|
40
40
|
export declare function setProperty(state: StoreNode, property: PropertyKey, value: any, deleting?: boolean): void;
|
|
41
41
|
export declare function updatePath(current: StoreNode, path: any[], traversed?: PropertyKey[]): void;
|
|
42
42
|
/** @deprecated */
|
|
43
|
-
export
|
|
43
|
+
export type DeepReadonly<T> = 0 extends 1 & T ? T : T extends NotWrappable ? T : {
|
|
44
44
|
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
45
45
|
};
|
|
46
46
|
/** @deprecated */
|
|
47
|
-
export
|
|
47
|
+
export type DeepMutable<T> = 0 extends 1 & T ? T : T extends NotWrappable ? T : {
|
|
48
48
|
-readonly [K in keyof T]: DeepMutable<T[K]>;
|
|
49
49
|
};
|
|
50
|
-
export
|
|
50
|
+
export type CustomPartial<T> = T extends readonly unknown[] ? "0" extends keyof T ? {
|
|
51
51
|
[K in Extract<keyof T, `${number}`>]?: T[K];
|
|
52
52
|
} : {
|
|
53
53
|
[x: number]: T[number];
|
|
54
54
|
} : Partial<T>;
|
|
55
|
-
export
|
|
55
|
+
export type PickMutable<T> = {
|
|
56
56
|
[K in keyof T as (<U>() => U extends {
|
|
57
57
|
[V in K]: T[V];
|
|
58
58
|
} ? 1 : 2) extends <U>() => U extends {
|
|
59
59
|
-readonly [V in K]: T[V];
|
|
60
60
|
} ? 1 : 2 ? K : never]: T[K];
|
|
61
61
|
};
|
|
62
|
-
export
|
|
62
|
+
export type StorePathRange = {
|
|
63
63
|
from?: number;
|
|
64
64
|
to?: number;
|
|
65
65
|
by?: number;
|
|
66
66
|
};
|
|
67
|
-
export
|
|
68
|
-
export
|
|
69
|
-
export
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
export type ArrayFilterFn<T> = (item: T, index: number) => boolean;
|
|
68
|
+
export type StoreSetter<T, U extends PropertyKey[] = []> = T | CustomPartial<T> | ((prevState: T, traversed: U) => T | CustomPartial<T>);
|
|
69
|
+
export type Part<T, K extends KeyOf<T> = KeyOf<T>> = K | ([K] extends [never] ? never : readonly K[]) | ([T] extends [readonly unknown[]] ? ArrayFilterFn<T[number]> | StorePathRange : never);
|
|
70
|
+
type W<T> = Exclude<T, NotWrappable>;
|
|
71
|
+
type KeyOf<T> = number extends keyof T ? 0 extends 1 & T ? keyof T : [T] extends [never] ? never : [
|
|
72
|
+
T
|
|
73
|
+
] extends [readonly unknown[]] ? number : keyof T : keyof T;
|
|
74
|
+
type MutableKeyOf<T> = KeyOf<T> & keyof PickMutable<T>;
|
|
75
|
+
type Rest<T, U extends PropertyKey[], K extends KeyOf<T> = KeyOf<T>> = [T] extends [never] ? never : K extends MutableKeyOf<T> ? [Part<T, K>, ...RestSetterOrContinue<T[K], [K, ...U]>] : K extends KeyOf<T> ? [Part<T, K>, ...RestContinue<T[K], [K, ...U]>] : never;
|
|
76
|
+
type RestContinue<T, U extends PropertyKey[]> = 0 extends 1 & T ? [...Part<any>[], StoreSetter<any, PropertyKey[]>] : Rest<W<T>, U>;
|
|
77
|
+
type RestSetterOrContinue<T, U extends PropertyKey[]> = [StoreSetter<T, U>] | RestContinue<T, U>;
|
|
76
78
|
export interface SetStoreFunction<T> {
|
|
77
79
|
<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 MutableKeyOf<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>, setter: StoreSetter<W<W<W<W<W<W<W<T>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7], [
|
|
78
80
|
K7,
|
|
@@ -83,7 +85,7 @@ export interface SetStoreFunction<T> {
|
|
|
83
85
|
K2,
|
|
84
86
|
K1
|
|
85
87
|
]>): void;
|
|
86
|
-
<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
|
|
88
|
+
<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 MutableKeyOf<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;
|
|
87
89
|
<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 MutableKeyOf<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;
|
|
88
90
|
<K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends KeyOf<W<W<W<T>[K1]>[K2]>>, K4 extends MutableKeyOf<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;
|
|
89
91
|
<K1 extends KeyOf<W<T>>, K2 extends KeyOf<W<W<T>[K1]>>, K3 extends MutableKeyOf<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;
|
package/types/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export * from "./reactive/scheduler.js";
|
|
|
5
5
|
export * from "./reactive/array.js";
|
|
6
6
|
export * from "./render/index.js";
|
|
7
7
|
import type { JSX } from "./jsx.js";
|
|
8
|
-
|
|
8
|
+
type JSXElement = JSX.Element;
|
|
9
9
|
export type { JSXElement, JSX };
|
|
10
10
|
import { hashValue, registerGraph, serializeGraph, writeSignal } from "./reactive/signal.js";
|
|
11
11
|
declare let DEV: {
|
package/types/jsx.d.ts
CHANGED
|
@@ -1301,6 +1301,7 @@ export namespace JSX {
|
|
|
1301
1301
|
gradientUnits?: SVGUnits;
|
|
1302
1302
|
gradientTransform?: string;
|
|
1303
1303
|
spreadMethod?: "pad" | "reflect" | "repeat";
|
|
1304
|
+
href?: string
|
|
1304
1305
|
}
|
|
1305
1306
|
interface GraphicsElementSVGAttributes<T>
|
|
1306
1307
|
extends CoreSVGAttributes<T>,
|
|
@@ -1702,6 +1703,7 @@ export namespace JSX {
|
|
|
1702
1703
|
patternUnits?: SVGUnits;
|
|
1703
1704
|
patternContentUnits?: SVGUnits;
|
|
1704
1705
|
patternTransform?: string;
|
|
1706
|
+
href?: string;
|
|
1705
1707
|
}
|
|
1706
1708
|
interface PolygonSVGAttributes<T>
|
|
1707
1709
|
extends GraphicsElementSVGAttributes<T>,
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import { Accessor } from "./signal.js";
|
|
2
|
+
/**
|
|
3
|
+
The MIT License (MIT)
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2017 Adam Haile
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
SOFTWARE.
|
|
24
|
+
*/
|
|
2
25
|
/**
|
|
3
26
|
* reactively transforms an array with a callback function - underlying helper for the `<For>` control flow
|
|
4
27
|
*
|
|
@@ -10,7 +10,7 @@ interface Observable<T> {
|
|
|
10
10
|
};
|
|
11
11
|
[Symbol.observable](): Observable<T>;
|
|
12
12
|
}
|
|
13
|
-
export
|
|
13
|
+
export type ObservableObserver<T> = ((v: T) => void) | {
|
|
14
14
|
next?: (v: T) => void;
|
|
15
15
|
error?: (v: any) => void;
|
|
16
16
|
complete?: (v: boolean) => void;
|
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The MIT License (MIT)
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2017 Adam Haile
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
*/
|
|
1
24
|
import { requestCallback } from "./scheduler.js";
|
|
2
25
|
import type { JSX } from "../jsx.js";
|
|
3
26
|
import type { FlowComponent } from "../render/index.js";
|
|
@@ -12,7 +35,7 @@ declare global {
|
|
|
12
35
|
var _$afterUpdate: (() => void) | undefined;
|
|
13
36
|
var _$afterCreateRoot: ((root: Owner) => void) | undefined;
|
|
14
37
|
}
|
|
15
|
-
export
|
|
38
|
+
export type ComputationState = 0 | 1 | 2;
|
|
16
39
|
export interface SourceMapValue {
|
|
17
40
|
value: unknown;
|
|
18
41
|
graph?: Owner;
|
|
@@ -57,12 +80,12 @@ export interface TransitionState {
|
|
|
57
80
|
done?: Promise<void>;
|
|
58
81
|
resolve?: () => void;
|
|
59
82
|
}
|
|
60
|
-
|
|
83
|
+
type ExternalSourceFactory = <Prev, Next extends Prev = Prev>(fn: EffectFunction<Prev, Next>, trigger: () => void) => ExternalSource;
|
|
61
84
|
export interface ExternalSource {
|
|
62
85
|
track: EffectFunction<any, any>;
|
|
63
86
|
dispose: () => void;
|
|
64
87
|
}
|
|
65
|
-
export
|
|
88
|
+
export type RootFunction<T> = (dispose: () => void) => T;
|
|
66
89
|
/**
|
|
67
90
|
* Creates a new non-tracked reactive context that doesn't auto-dispose
|
|
68
91
|
*
|
|
@@ -72,10 +95,10 @@ export declare type RootFunction<T> = (dispose: () => void) => T;
|
|
|
72
95
|
*
|
|
73
96
|
* @description https://www.solidjs.com/docs/latest/api#createroot
|
|
74
97
|
*/
|
|
75
|
-
export declare function createRoot<T>(fn: RootFunction<T>, detachedOwner?: Owner): T;
|
|
76
|
-
export
|
|
77
|
-
export
|
|
78
|
-
export
|
|
98
|
+
export declare function createRoot<T>(fn: RootFunction<T>, detachedOwner?: typeof Owner): T;
|
|
99
|
+
export type Accessor<T> = () => T;
|
|
100
|
+
export type Setter<T> = (undefined extends T ? () => undefined : {}) & (<U extends T>(value: (prev: T) => U) => U) & (<U extends T>(value: Exclude<U, Function>) => U) & (<U extends T>(value: Exclude<U, Function> | ((prev: T) => U)) => U);
|
|
101
|
+
export type Signal<T> = [get: Accessor<T>, set: Setter<T>];
|
|
79
102
|
export interface SignalOptions<T> extends MemoOptions<T> {
|
|
80
103
|
internal?: boolean;
|
|
81
104
|
}
|
|
@@ -107,10 +130,10 @@ export declare function createSignal<T>(value: T, options?: SignalOptions<T>): S
|
|
|
107
130
|
export interface BaseOptions {
|
|
108
131
|
name?: string;
|
|
109
132
|
}
|
|
110
|
-
export
|
|
133
|
+
export type NoInfer<T extends any> = [T][T extends any ? 0 : never];
|
|
111
134
|
export interface EffectOptions extends BaseOptions {
|
|
112
135
|
}
|
|
113
|
-
export
|
|
136
|
+
export type EffectFunction<Prev, Next extends Prev = Prev> = (v: Prev) => Next;
|
|
114
137
|
/**
|
|
115
138
|
* Creates a reactive computation that runs immediately before render, mainly used to write to other reactive primitives
|
|
116
139
|
* ```typescript
|
|
@@ -235,19 +258,19 @@ interface Errored {
|
|
|
235
258
|
latest: never;
|
|
236
259
|
(): never;
|
|
237
260
|
}
|
|
238
|
-
export
|
|
239
|
-
export
|
|
240
|
-
export
|
|
261
|
+
export type Resource<T> = Unresolved | Pending | Ready<T> | Refreshing<T> | Errored;
|
|
262
|
+
export type InitializedResource<T> = Ready<T> | Refreshing<T> | Errored;
|
|
263
|
+
export type ResourceActions<T, R = unknown> = {
|
|
241
264
|
mutate: Setter<T>;
|
|
242
265
|
refetch: (info?: R) => T | Promise<T> | undefined | null;
|
|
243
266
|
};
|
|
244
|
-
export
|
|
245
|
-
export
|
|
246
|
-
export
|
|
267
|
+
export type ResourceSource<S> = S | false | null | undefined | (() => S | false | null | undefined);
|
|
268
|
+
export type ResourceFetcher<S, T, R = unknown> = (k: S, info: ResourceFetcherInfo<T, R>) => T | Promise<T>;
|
|
269
|
+
export type ResourceFetcherInfo<T, R = unknown> = {
|
|
247
270
|
value: T | undefined;
|
|
248
271
|
refetching: R | boolean;
|
|
249
272
|
};
|
|
250
|
-
export
|
|
273
|
+
export type ResourceOptions<T, S = unknown> = {
|
|
251
274
|
initialValue?: T;
|
|
252
275
|
name?: string;
|
|
253
276
|
deferStream?: boolean;
|
|
@@ -257,11 +280,11 @@ export declare type ResourceOptions<T, S = unknown> = {
|
|
|
257
280
|
value: T | undefined;
|
|
258
281
|
}) => void;
|
|
259
282
|
};
|
|
260
|
-
export
|
|
283
|
+
export type InitializedResourceOptions<T, S = unknown> = ResourceOptions<T, S> & {
|
|
261
284
|
initialValue: T;
|
|
262
285
|
};
|
|
263
|
-
export
|
|
264
|
-
export
|
|
286
|
+
export type ResourceReturn<T, R = unknown> = [Resource<T>, ResourceActions<T | undefined, R>];
|
|
287
|
+
export type InitializedResourceReturn<T, R = unknown> = [
|
|
265
288
|
InitializedResource<T>,
|
|
266
289
|
ResourceActions<T, R>
|
|
267
290
|
];
|
|
@@ -316,7 +339,7 @@ export interface DeferredOptions<T> {
|
|
|
316
339
|
* @description https://www.solidjs.com/docs/latest/api#createdeferred
|
|
317
340
|
*/
|
|
318
341
|
export declare function createDeferred<T>(source: Accessor<T>, options?: DeferredOptions<T>): Accessor<T>;
|
|
319
|
-
export
|
|
342
|
+
export type EqualityCheckerFunction<T, U> = (a: U, b: T) => boolean;
|
|
320
343
|
/**
|
|
321
344
|
* Creates a conditional signal that only notifies subscribers when entering or exiting their key matching the value
|
|
322
345
|
* ```typescript
|
|
@@ -359,13 +382,13 @@ export declare function batch<T>(fn: Accessor<T>): T;
|
|
|
359
382
|
*/
|
|
360
383
|
export declare function untrack<T>(fn: Accessor<T>): T;
|
|
361
384
|
/** @deprecated */
|
|
362
|
-
export
|
|
385
|
+
export type ReturnTypes<T> = T extends readonly Accessor<unknown>[] ? {
|
|
363
386
|
[K in keyof T]: T[K] extends Accessor<infer I> ? I : never;
|
|
364
387
|
} : T extends Accessor<infer I> ? I : never;
|
|
365
|
-
export
|
|
388
|
+
export type AccessorArray<T> = [...Extract<{
|
|
366
389
|
[K in keyof T]: Accessor<T[K]>;
|
|
367
390
|
}, readonly unknown[]>];
|
|
368
|
-
export
|
|
391
|
+
export type OnEffectFunction<S, Prev, Next extends Prev = Prev> = (input: S, prevInput: S | undefined, prev: Prev) => Next;
|
|
369
392
|
export interface OnOptions {
|
|
370
393
|
defer?: boolean;
|
|
371
394
|
}
|
|
@@ -428,7 +451,7 @@ export declare function onCleanup<T extends () => any>(fn: T): T;
|
|
|
428
451
|
export declare function onError(fn: (err: any) => void): void;
|
|
429
452
|
export declare function getListener(): Computation<any, any> | null;
|
|
430
453
|
export declare function getOwner(): Owner | null;
|
|
431
|
-
export declare function runWithOwner<T>(o: Owner, fn: () => T): T | undefined;
|
|
454
|
+
export declare function runWithOwner<T>(o: typeof Owner, fn: () => T): T | undefined;
|
|
432
455
|
export declare function enableScheduling(scheduler?: typeof requestCallback): void;
|
|
433
456
|
/**
|
|
434
457
|
* ```typescript
|
|
@@ -437,7 +460,7 @@ export declare function enableScheduling(scheduler?: typeof requestCallback): vo
|
|
|
437
460
|
* @description https://www.solidjs.com/docs/latest/api#usetransition
|
|
438
461
|
*/
|
|
439
462
|
export declare function startTransition(fn: () => unknown): Promise<void>;
|
|
440
|
-
export
|
|
463
|
+
export type Transition = [Accessor<boolean>, (fn: () => void) => Promise<void>];
|
|
441
464
|
/**
|
|
442
465
|
* ```typescript
|
|
443
466
|
* export function useTransition(): [
|
|
@@ -461,7 +484,7 @@ interface GraphRecord {
|
|
|
461
484
|
[k: string]: GraphRecord | unknown;
|
|
462
485
|
}
|
|
463
486
|
export declare function serializeGraph(owner?: Owner | null): GraphRecord;
|
|
464
|
-
export
|
|
487
|
+
export type ContextProviderComponent<T> = FlowComponent<{
|
|
465
488
|
value: T;
|
|
466
489
|
}>;
|
|
467
490
|
export interface Context<T> {
|
|
@@ -499,9 +522,9 @@ export declare function createContext<T>(defaultValue: T, options?: EffectOption
|
|
|
499
522
|
* @description https://www.solidjs.com/docs/latest/api#usecontext
|
|
500
523
|
*/
|
|
501
524
|
export declare function useContext<T>(context: Context<T>): T;
|
|
502
|
-
export
|
|
503
|
-
export
|
|
504
|
-
export
|
|
525
|
+
export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement | JSX.FunctionElement>;
|
|
526
|
+
export type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
|
|
527
|
+
export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
505
528
|
toArray: () => ResolvedJSXElement[];
|
|
506
529
|
};
|
|
507
530
|
/**
|
|
@@ -513,14 +536,14 @@ export declare type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
|
513
536
|
* @description https://www.solidjs.com/docs/latest/api#children
|
|
514
537
|
*/
|
|
515
538
|
export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn;
|
|
516
|
-
export
|
|
539
|
+
export type SuspenseContextType = {
|
|
517
540
|
increment?: () => void;
|
|
518
541
|
decrement?: () => void;
|
|
519
542
|
inFallback?: () => boolean;
|
|
520
543
|
effects?: Computation<any>[];
|
|
521
544
|
resolved?: boolean;
|
|
522
545
|
};
|
|
523
|
-
|
|
546
|
+
type SuspenseContext = Context<SuspenseContextType> & {
|
|
524
547
|
active?(): boolean;
|
|
525
548
|
increment?(): void;
|
|
526
549
|
decrement?(): void;
|
|
@@ -4,13 +4,13 @@ export declare function enableHydration(): void;
|
|
|
4
4
|
* A general `Component` has no implicit `children` prop. If desired, you can
|
|
5
5
|
* specify one as in `Component<{name: String, children: JSX.Element}>`.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type Component<P = {}> = (props: P) => JSX.Element;
|
|
8
8
|
/**
|
|
9
9
|
* Extend props to forbid the `children` prop.
|
|
10
10
|
* Use this to prevent accidentally passing `children` to components that
|
|
11
11
|
* would silently throw them away.
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
13
|
+
export type VoidProps<P = {}> = P & {
|
|
14
14
|
children?: never;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
@@ -18,13 +18,13 @@ export declare type VoidProps<P = {}> = P & {
|
|
|
18
18
|
* Use this to prevent accidentally passing `children` to components that
|
|
19
19
|
* would silently throw them away.
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export type VoidComponent<P = {}> = Component<VoidProps<P>>;
|
|
22
22
|
/**
|
|
23
23
|
* Extend props to allow an optional `children` prop with the usual
|
|
24
24
|
* type in JSX, `JSX.Element` (which allows elements, arrays, functions, etc.).
|
|
25
25
|
* Use this for components that you want to accept children.
|
|
26
26
|
*/
|
|
27
|
-
export
|
|
27
|
+
export type ParentProps<P = {}> = P & {
|
|
28
28
|
children?: JSX.Element;
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
@@ -32,14 +32,14 @@ export declare type ParentProps<P = {}> = P & {
|
|
|
32
32
|
* type in JSX, `JSX.Element` (which allows elements, arrays, functions, etc.).
|
|
33
33
|
* Use this for components that you want to accept children.
|
|
34
34
|
*/
|
|
35
|
-
export
|
|
35
|
+
export type ParentComponent<P = {}> = Component<ParentProps<P>>;
|
|
36
36
|
/**
|
|
37
37
|
* Extend props to require a `children` prop with the specified type.
|
|
38
38
|
* Use this for components where you need a specific child type,
|
|
39
39
|
* typically a function that receives specific argument types.
|
|
40
40
|
* Note that all JSX <Elements> are of the type `JSX.Element`.
|
|
41
41
|
*/
|
|
42
|
-
export
|
|
42
|
+
export type FlowProps<P = {}, C = JSX.Element> = P & {
|
|
43
43
|
children: C;
|
|
44
44
|
};
|
|
45
45
|
/**
|
|
@@ -48,10 +48,10 @@ export declare type FlowProps<P = {}, C = JSX.Element> = P & {
|
|
|
48
48
|
* typically a function that receives specific argument types.
|
|
49
49
|
* Note that all JSX <Elements> are of the type `JSX.Element`.
|
|
50
50
|
*/
|
|
51
|
-
export
|
|
51
|
+
export type FlowComponent<P = {}, C = JSX.Element> = Component<FlowProps<P, C>>;
|
|
52
52
|
/** @deprecated: use `ParentProps` instead */
|
|
53
|
-
export
|
|
54
|
-
export
|
|
53
|
+
export type PropsWithChildren<P = {}> = ParentProps<P>;
|
|
54
|
+
export type ValidComponent = keyof JSX.IntrinsicElements | Component<any> | (string & {});
|
|
55
55
|
/**
|
|
56
56
|
* Takes the props of the passed component and returns its type
|
|
57
57
|
*
|
|
@@ -59,21 +59,21 @@ export declare type ValidComponent = keyof JSX.IntrinsicElements | Component<any
|
|
|
59
59
|
* ComponentProps<typeof Portal> // { mount?: Node; useShadow?: boolean; children: JSX.Element }
|
|
60
60
|
* ComponentProps<'div'> // JSX.HTMLAttributes<HTMLDivElement>
|
|
61
61
|
*/
|
|
62
|
-
export
|
|
62
|
+
export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
|
|
63
63
|
/**
|
|
64
64
|
* Type of `props.ref`, for use in `Component` or `props` typing.
|
|
65
65
|
*
|
|
66
66
|
* @example Component<{ref: Ref<Element>}>
|
|
67
67
|
*/
|
|
68
|
-
export
|
|
68
|
+
export type Ref<T> = T | ((val: T) => void);
|
|
69
69
|
export declare function createComponent<T>(Comp: Component<T>, props: T): JSX.Element;
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
type DistributeOverride<T, F> = T extends undefined ? F : T;
|
|
71
|
+
type Override<T, U> = T extends any ? U extends any ? {
|
|
72
72
|
[K in keyof T]: K extends keyof U ? DistributeOverride<U[K], T[K]> : T[K];
|
|
73
73
|
} & {
|
|
74
74
|
[K in keyof U]: K extends keyof T ? DistributeOverride<U[K], T[K]> : U[K];
|
|
75
75
|
} : T & U : T & U;
|
|
76
|
-
|
|
76
|
+
type OverrideSpread<T, U> = T extends any ? {
|
|
77
77
|
[K in keyof ({
|
|
78
78
|
[K in keyof T]: any;
|
|
79
79
|
} & {
|
|
@@ -82,16 +82,16 @@ declare type OverrideSpread<T, U> = T extends any ? {
|
|
|
82
82
|
[K in U extends any ? keyof U : keyof U]?: any;
|
|
83
83
|
})]: K extends keyof T ? Exclude<U extends any ? U[K & keyof U] : never, undefined> | T[K] : U extends any ? U[K & keyof U] : never;
|
|
84
84
|
} : T & U;
|
|
85
|
-
|
|
85
|
+
type Simplify<T> = T extends any ? {
|
|
86
86
|
[K in keyof T]: T[K];
|
|
87
87
|
} : T;
|
|
88
|
-
|
|
88
|
+
type _MergeProps<T extends unknown[], Curr = {}> = T extends [
|
|
89
89
|
infer Next | (() => infer Next),
|
|
90
90
|
...infer Rest
|
|
91
91
|
] ? _MergeProps<Rest, Override<Curr, Next>> : T extends [...infer Rest, infer Next | (() => infer Next)] ? Override<_MergeProps<Rest, Curr>, Next> : T extends [] ? Curr : T extends (infer I | (() => infer I))[] ? OverrideSpread<Curr, I> : Curr;
|
|
92
|
-
export
|
|
92
|
+
export type MergeProps<T extends unknown[]> = Simplify<_MergeProps<T>>;
|
|
93
93
|
export declare function mergeProps<T extends unknown[]>(...sources: T): MergeProps<T>;
|
|
94
|
-
export
|
|
94
|
+
export type SplitProps<T, K extends (readonly (keyof T)[])[]> = [
|
|
95
95
|
...{
|
|
96
96
|
[P in keyof K]: P extends `${number}` ? Pick<T, Extract<K[P], readonly (keyof T)[]>[number]> : never;
|
|
97
97
|
},
|
package/types/render/flow.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export declare function Switch(props: {
|
|
|
70
70
|
fallback?: JSX.Element;
|
|
71
71
|
children: JSX.Element;
|
|
72
72
|
}): Accessor<JSX.Element>;
|
|
73
|
-
export
|
|
73
|
+
export type MatchProps<T> = {
|
|
74
74
|
when: T | undefined | null | false;
|
|
75
75
|
keyed?: boolean;
|
|
76
76
|
children: JSX.Element | ((item: NonNullable<T>) => JSX.Element);
|
|
@@ -3,9 +3,9 @@ export declare const $PROXY: unique symbol;
|
|
|
3
3
|
export declare const $TRACK: unique symbol;
|
|
4
4
|
export declare const $DEVCOMP: unique symbol;
|
|
5
5
|
export declare const DEV: {};
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
6
|
+
export type Accessor<T> = () => T;
|
|
7
|
+
export type Setter<T> = undefined extends T ? <U extends T>(value?: (U extends Function ? never : U) | ((prev?: T) => U)) => U : <U extends T>(value: (U extends Function ? never : U) | ((prev: T) => U)) => U;
|
|
8
|
+
export type Signal<T> = [get: Accessor<T>, set: Setter<T>];
|
|
9
9
|
export declare const BRANCH: unique symbol;
|
|
10
10
|
export declare function castError(err: any): string | Error;
|
|
11
11
|
export declare let Owner: Owner | null;
|
|
@@ -13,7 +13,7 @@ interface Owner {
|
|
|
13
13
|
owner: Owner | null;
|
|
14
14
|
context: any | null;
|
|
15
15
|
}
|
|
16
|
-
export declare function createRoot<T>(fn: (dispose: () => void) => T, detachedOwner?: Owner): T;
|
|
16
|
+
export declare function createRoot<T>(fn: (dispose: () => void) => T, detachedOwner?: typeof Owner): T;
|
|
17
17
|
export declare function createSignal<T>(value: T, options?: {
|
|
18
18
|
equals?: false | ((prev: T, next: T) => boolean);
|
|
19
19
|
name?: string;
|
|
@@ -48,11 +48,11 @@ export interface Context<T> {
|
|
|
48
48
|
export declare function createContext<T>(defaultValue?: T): Context<T>;
|
|
49
49
|
export declare function useContext<T>(context: Context<T>): T;
|
|
50
50
|
export declare function getOwner(): Owner | null;
|
|
51
|
-
|
|
51
|
+
type ChildrenReturn = Accessor<any> & {
|
|
52
52
|
toArray: () => any[];
|
|
53
53
|
};
|
|
54
54
|
export declare function children(fn: () => any): ChildrenReturn;
|
|
55
|
-
export declare function runWithOwner<T>(o: Owner, fn: () => T): T | undefined;
|
|
55
|
+
export declare function runWithOwner<T>(o: typeof Owner, fn: () => T): T | undefined;
|
|
56
56
|
export declare function lookup(owner: Owner | null, key: symbol | string): any;
|
|
57
57
|
export interface Task {
|
|
58
58
|
id: number;
|
|
@@ -67,7 +67,7 @@ export declare function cancelCallback(task: Task): void;
|
|
|
67
67
|
export declare function mapArray<T, U>(list: () => T[], mapFn: (v: T, i: () => number) => U, options?: {
|
|
68
68
|
fallback?: () => any;
|
|
69
69
|
}): () => U[];
|
|
70
|
-
export
|
|
70
|
+
export type ObservableObserver<T> = ((v: T) => void) | {
|
|
71
71
|
next: (v: T) => void;
|
|
72
72
|
error?: (v: any) => void;
|
|
73
73
|
complete?: (v: boolean) => void;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { Setter, Signal } from "./reactive.js";
|
|
2
2
|
import type { JSX } from "../jsx.js";
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type Component<P = {}> = (props: P) => JSX.Element;
|
|
4
|
+
export type VoidProps<P = {}> = P & {
|
|
5
5
|
children?: never;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
8
|
-
export
|
|
7
|
+
export type VoidComponent<P = {}> = Component<VoidProps<P>>;
|
|
8
|
+
export type ParentProps<P = {}> = P & {
|
|
9
9
|
children?: JSX.Element;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
12
|
-
export
|
|
11
|
+
export type ParentComponent<P = {}> = Component<ParentProps<P>>;
|
|
12
|
+
export type FlowProps<P = {}, C = JSX.Element> = P & {
|
|
13
13
|
children: C;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
|
|
15
|
+
export type FlowComponent<P = {}, C = JSX.Element> = Component<FlowProps<P, C>>;
|
|
16
|
+
export type Ref<T> = T | ((val: T) => void);
|
|
17
|
+
export type ValidComponent = keyof JSX.IntrinsicElements | Component<any> | (string & {});
|
|
18
|
+
export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
|
|
19
|
+
type SharedConfig = {
|
|
20
20
|
context?: HydrationContext;
|
|
21
21
|
};
|
|
22
22
|
export declare const sharedConfig: SharedConfig;
|
|
@@ -57,7 +57,7 @@ export declare function Switch(props: {
|
|
|
57
57
|
fallback?: string;
|
|
58
58
|
children: MatchProps<unknown> | MatchProps<unknown>[];
|
|
59
59
|
}): string;
|
|
60
|
-
|
|
60
|
+
type MatchProps<T> = {
|
|
61
61
|
when: T | false;
|
|
62
62
|
keyed?: boolean;
|
|
63
63
|
children: string | ((item: T) => string);
|
|
@@ -77,25 +77,25 @@ export interface Resource<T> {
|
|
|
77
77
|
error: any;
|
|
78
78
|
latest: T | undefined;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
type SuspenseContextType = {
|
|
81
81
|
resources: Map<string, {
|
|
82
82
|
loading: boolean;
|
|
83
83
|
error: any;
|
|
84
84
|
}>;
|
|
85
85
|
completed: () => void;
|
|
86
86
|
};
|
|
87
|
-
export
|
|
87
|
+
export type ResourceActions<T> = {
|
|
88
88
|
mutate: Setter<T>;
|
|
89
89
|
refetch: (info?: unknown) => void;
|
|
90
90
|
};
|
|
91
|
-
export
|
|
92
|
-
export
|
|
93
|
-
export
|
|
94
|
-
export
|
|
91
|
+
export type ResourceReturn<T> = [Resource<T>, ResourceActions<T>];
|
|
92
|
+
export type ResourceSource<S> = S | false | null | undefined | (() => S | false | null | undefined);
|
|
93
|
+
export type ResourceFetcher<S, T> = (k: S, info: ResourceFetcherInfo<T>) => T | Promise<T>;
|
|
94
|
+
export type ResourceFetcherInfo<T> = {
|
|
95
95
|
value: T | undefined;
|
|
96
96
|
refetching?: unknown;
|
|
97
97
|
};
|
|
98
|
-
export
|
|
98
|
+
export type ResourceOptions<T> = undefined extends T ? {
|
|
99
99
|
initialValue?: T;
|
|
100
100
|
name?: string;
|
|
101
101
|
deferStream?: boolean;
|
|
@@ -125,7 +125,7 @@ export declare function enableScheduling(): void;
|
|
|
125
125
|
export declare function enableHydration(): void;
|
|
126
126
|
export declare function startTransition(fn: () => any): void;
|
|
127
127
|
export declare function useTransition(): [() => boolean, (fn: () => any) => void];
|
|
128
|
-
|
|
128
|
+
type HydrationContext = {
|
|
129
129
|
id: string;
|
|
130
130
|
count: number;
|
|
131
131
|
writeResource: (id: string, v: Promise<any> | any, error?: boolean, deferStream?: boolean) => void;
|