solid-js 1.6.10 → 1.7.0-beta.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/dev.cjs +45 -96
- package/dist/dev.js +45 -96
- package/dist/server.cjs +9 -8
- package/dist/server.js +9 -8
- package/dist/solid.cjs +24 -17
- package/dist/solid.js +24 -17
- 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 +1 -0
- package/package.json +3 -2
- package/store/dist/dev.cjs +26 -34
- package/store/dist/dev.js +26 -33
- package/store/dist/store.cjs +6 -7
- package/store/dist/store.js +6 -7
- package/store/types/index.d.ts +8 -7
- package/store/types/modifiers.d.ts +1 -1
- package/store/types/server.d.ts +2 -2
- package/store/types/store.d.ts +27 -26
- package/types/index.d.ts +6 -7
- package/types/jsx.d.ts +1 -4
- package/types/reactive/observable.d.ts +1 -1
- package/types/reactive/signal.d.ts +42 -47
- package/types/render/component.d.ts +18 -18
- package/types/render/flow.d.ts +8 -8
- package/types/render/hydration.d.ts +2 -2
- package/types/server/reactive.d.ts +10 -10
- package/types/server/rendering.d.ts +21 -21
- package/web/dist/server.cjs +8 -1
- package/web/dist/server.js +8 -1
- package/web/types/index.d.ts +3 -3
- package/web/types/server-mock.d.ts +1 -1
package/store/types/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { createStore, unwrap
|
|
2
|
-
export type {
|
|
1
|
+
export { $RAW, createStore, unwrap } from "./store.js";
|
|
2
|
+
export type { ArrayFilterFn, DeepMutable, DeepReadonly, NotWrappable, Part, SetStoreFunction, SolidStore, Store, StoreNode, StorePathRange, StoreSetter } from "./store.js";
|
|
3
3
|
export * from "./mutable.js";
|
|
4
4
|
export * from "./modifiers.js";
|
|
5
|
-
import { $
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import { $NODE, isWrappable, DevHooks } from "./store.js";
|
|
6
|
+
declare let DEV: {
|
|
7
|
+
$NODE: typeof $NODE;
|
|
8
|
+
isWrappable: typeof isWrappable;
|
|
9
|
+
hooks: typeof DevHooks;
|
|
10
10
|
} | undefined;
|
|
11
|
+
export { DEV };
|
package/store/types/server.d.ts
CHANGED
|
@@ -6,11 +6,11 @@ export declare function setProperty(state: any, property: PropertyKey, value: an
|
|
|
6
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
8
|
export declare function createMutable<T>(state: T | Store<T>): T;
|
|
9
|
-
|
|
9
|
+
type ReconcileOptions = {
|
|
10
10
|
key?: string | null;
|
|
11
11
|
merge?: boolean;
|
|
12
12
|
};
|
|
13
|
-
export declare function reconcile<T extends U, U>(value: T, options?: ReconcileOptions): (state: U) => T;
|
|
13
|
+
export declare function reconcile<T extends U, U extends object>(value: T, options?: ReconcileOptions): (state: U) => T;
|
|
14
14
|
export declare function produce<T>(fn: (state: T) => void): (state: T) => T;
|
|
15
15
|
export declare const DEV: undefined;
|
|
16
16
|
export {};
|
package/store/types/store.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
export declare const $RAW: unique symbol, $NODE: unique symbol
|
|
2
|
-
declare
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
1
|
+
export declare const $RAW: unique symbol, $NODE: unique symbol;
|
|
2
|
+
export declare const DevHooks: {
|
|
3
|
+
onStoreNodeUpdate: OnStoreNodeUpdate | null;
|
|
4
|
+
};
|
|
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
|
-
[$NAME]?: string;
|
|
13
12
|
[$NODE]?: DataNodes;
|
|
14
13
|
[key: PropertyKey]: any;
|
|
15
14
|
}
|
|
@@ -17,8 +16,8 @@ export declare namespace SolidStore {
|
|
|
17
16
|
interface Unwrappable {
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
|
-
export
|
|
21
|
-
export
|
|
19
|
+
export type NotWrappable = string | number | bigint | symbol | boolean | Function | null | undefined | SolidStore.Unwrappable[keyof SolidStore.Unwrappable];
|
|
20
|
+
export type Store<T> = T;
|
|
22
21
|
export declare function isWrappable<T>(obj: T | NotWrappable): obj is T;
|
|
23
22
|
/**
|
|
24
23
|
* Returns the underlying data in the store without a proxy.
|
|
@@ -34,45 +33,47 @@ export declare function isWrappable<T>(obj: T | NotWrappable): obj is T;
|
|
|
34
33
|
export declare function unwrap<T>(item: T, set?: Set<unknown>): T;
|
|
35
34
|
export declare function getDataNodes(target: StoreNode): DataNodes;
|
|
36
35
|
export declare function getDataNode(nodes: DataNodes, property: PropertyKey, value: any): DataNode;
|
|
37
|
-
export declare function proxyDescriptor(target: StoreNode, property: PropertyKey):
|
|
36
|
+
export declare function proxyDescriptor(target: StoreNode, property: PropertyKey): TypedPropertyDescriptor<any> | undefined;
|
|
38
37
|
export declare function trackSelf(target: StoreNode): void;
|
|
39
38
|
export declare function ownKeys(target: StoreNode): (string | symbol)[];
|
|
40
39
|
export declare function setProperty(state: StoreNode, property: PropertyKey, value: any, deleting?: boolean): void;
|
|
41
40
|
export declare function updatePath(current: StoreNode, path: any[], traversed?: PropertyKey[]): void;
|
|
42
41
|
/** @deprecated */
|
|
43
|
-
export
|
|
42
|
+
export type DeepReadonly<T> = 0 extends 1 & T ? T : T extends NotWrappable ? T : {
|
|
44
43
|
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
45
44
|
};
|
|
46
45
|
/** @deprecated */
|
|
47
|
-
export
|
|
46
|
+
export type DeepMutable<T> = 0 extends 1 & T ? T : T extends NotWrappable ? T : {
|
|
48
47
|
-readonly [K in keyof T]: DeepMutable<T[K]>;
|
|
49
48
|
};
|
|
50
|
-
export
|
|
49
|
+
export type CustomPartial<T> = T extends readonly unknown[] ? "0" extends keyof T ? {
|
|
51
50
|
[K in Extract<keyof T, `${number}`>]?: T[K];
|
|
52
51
|
} : {
|
|
53
52
|
[x: number]: T[number];
|
|
54
53
|
} : Partial<T>;
|
|
55
|
-
export
|
|
54
|
+
export type PickMutable<T> = {
|
|
56
55
|
[K in keyof T as (<U>() => U extends {
|
|
57
56
|
[V in K]: T[V];
|
|
58
57
|
} ? 1 : 2) extends <U>() => U extends {
|
|
59
58
|
-readonly [V in K]: T[V];
|
|
60
59
|
} ? 1 : 2 ? K : never]: T[K];
|
|
61
60
|
};
|
|
62
|
-
export
|
|
61
|
+
export type StorePathRange = {
|
|
63
62
|
from?: number;
|
|
64
63
|
to?: number;
|
|
65
64
|
by?: number;
|
|
66
65
|
};
|
|
67
|
-
export
|
|
68
|
-
export
|
|
69
|
-
export
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
export type ArrayFilterFn<T> = (item: T, index: number) => boolean;
|
|
67
|
+
export type StoreSetter<T, U extends PropertyKey[] = []> = T | CustomPartial<T> | ((prevState: T, traversed: U) => T | CustomPartial<T>);
|
|
68
|
+
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);
|
|
69
|
+
type W<T> = Exclude<T, NotWrappable>;
|
|
70
|
+
type KeyOf<T> = number extends keyof T ? 0 extends 1 & T ? keyof T : [T] extends [never] ? never : [
|
|
71
|
+
T
|
|
72
|
+
] extends [readonly unknown[]] ? number : keyof T : keyof T;
|
|
73
|
+
type MutableKeyOf<T> = KeyOf<T> & keyof PickMutable<T>;
|
|
74
|
+
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;
|
|
75
|
+
type RestContinue<T, U extends PropertyKey[]> = 0 extends 1 & T ? [...Part<any>[], StoreSetter<any, PropertyKey[]>] : Rest<W<T>, U>;
|
|
76
|
+
type RestSetterOrContinue<T, U extends PropertyKey[]> = [StoreSetter<T, U>] | RestContinue<T, U>;
|
|
76
77
|
export interface SetStoreFunction<T> {
|
|
77
78
|
<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
79
|
K7,
|
|
@@ -83,7 +84,7 @@ export interface SetStoreFunction<T> {
|
|
|
83
84
|
K2,
|
|
84
85
|
K1
|
|
85
86
|
]>): 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
|
|
87
|
+
<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
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 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
89
|
<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
90
|
<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,15 +5,14 @@ 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
|
-
import {
|
|
10
|
+
import { registerGraph, writeSignal, DevHooks } from "./reactive/signal.js";
|
|
11
11
|
declare let DEV: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
registerGraph: typeof registerGraph;
|
|
15
|
-
|
|
16
|
-
};
|
|
12
|
+
readonly hooks: typeof DevHooks;
|
|
13
|
+
readonly writeSignal: typeof writeSignal;
|
|
14
|
+
readonly registerGraph: typeof registerGraph;
|
|
15
|
+
} | undefined;
|
|
17
16
|
export { DEV };
|
|
18
17
|
declare global {
|
|
19
18
|
var Solid$$: boolean;
|
package/types/jsx.d.ts
CHANGED
|
@@ -12,16 +12,12 @@ export namespace JSX {
|
|
|
12
12
|
type Element =
|
|
13
13
|
| Node
|
|
14
14
|
| ArrayElement
|
|
15
|
-
| FunctionElement
|
|
16
15
|
| (string & {})
|
|
17
16
|
| number
|
|
18
17
|
| boolean
|
|
19
18
|
| null
|
|
20
19
|
| undefined;
|
|
21
20
|
interface ArrayElement extends Array<Element> {}
|
|
22
|
-
interface FunctionElement {
|
|
23
|
-
(): Element;
|
|
24
|
-
}
|
|
25
21
|
interface ElementClass {
|
|
26
22
|
// empty, libs can define requirements downstream
|
|
27
23
|
}
|
|
@@ -1702,6 +1698,7 @@ export namespace JSX {
|
|
|
1702
1698
|
patternUnits?: SVGUnits;
|
|
1703
1699
|
patternContentUnits?: SVGUnits;
|
|
1704
1700
|
patternTransform?: string;
|
|
1701
|
+
href?: string;
|
|
1705
1702
|
}
|
|
1706
1703
|
interface PolygonSVGAttributes<T>
|
|
1707
1704
|
extends GraphicsElementSVGAttributes<T>,
|
|
@@ -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;
|
|
@@ -8,13 +8,15 @@ export declare const $DEVCOMP: unique symbol;
|
|
|
8
8
|
export declare var Owner: Owner | null;
|
|
9
9
|
export declare let Transition: TransitionState | null;
|
|
10
10
|
declare let ExternalSourceFactory: ExternalSourceFactory | null;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
/** Object storing callbacks for debugging during development */
|
|
12
|
+
export declare const DevHooks: {
|
|
13
|
+
afterUpdate: (() => void) | null;
|
|
14
|
+
afterCreateOwner: ((owner: Owner) => void) | null;
|
|
15
|
+
};
|
|
16
|
+
export type ComputationState = 0 | 1 | 2;
|
|
16
17
|
export interface SourceMapValue {
|
|
17
18
|
value: unknown;
|
|
19
|
+
name?: string;
|
|
18
20
|
graph?: Owner;
|
|
19
21
|
}
|
|
20
22
|
export interface SignalState<T> extends SourceMapValue {
|
|
@@ -23,16 +25,14 @@ export interface SignalState<T> extends SourceMapValue {
|
|
|
23
25
|
observerSlots: number[] | null;
|
|
24
26
|
tValue?: T;
|
|
25
27
|
comparator?: (prev: T, next: T) => boolean;
|
|
26
|
-
name?: string;
|
|
27
28
|
}
|
|
28
29
|
export interface Owner {
|
|
29
30
|
owned: Computation<any>[] | null;
|
|
30
31
|
cleanups: (() => void)[] | null;
|
|
31
32
|
owner: Owner | null;
|
|
32
33
|
context: any | null;
|
|
33
|
-
sourceMap?:
|
|
34
|
+
sourceMap?: SourceMapValue[];
|
|
34
35
|
name?: string;
|
|
35
|
-
componentName?: string;
|
|
36
36
|
}
|
|
37
37
|
export interface Computation<Init, Next extends Init = Init> extends Owner {
|
|
38
38
|
fn: EffectFunction<Init, Next>;
|
|
@@ -57,12 +57,12 @@ export interface TransitionState {
|
|
|
57
57
|
done?: Promise<void>;
|
|
58
58
|
resolve?: () => void;
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
type ExternalSourceFactory = <Prev, Next extends Prev = Prev>(fn: EffectFunction<Prev, Next>, trigger: () => void) => ExternalSource;
|
|
61
61
|
export interface ExternalSource {
|
|
62
62
|
track: EffectFunction<any, any>;
|
|
63
63
|
dispose: () => void;
|
|
64
64
|
}
|
|
65
|
-
export
|
|
65
|
+
export type RootFunction<T> = (dispose: () => void) => T;
|
|
66
66
|
/**
|
|
67
67
|
* Creates a new non-tracked reactive context that doesn't auto-dispose
|
|
68
68
|
*
|
|
@@ -72,10 +72,10 @@ export declare type RootFunction<T> = (dispose: () => void) => T;
|
|
|
72
72
|
*
|
|
73
73
|
* @description https://www.solidjs.com/docs/latest/api#createroot
|
|
74
74
|
*/
|
|
75
|
-
export declare function createRoot<T>(fn: RootFunction<T>, detachedOwner?: Owner): T;
|
|
76
|
-
export
|
|
77
|
-
export
|
|
78
|
-
export
|
|
75
|
+
export declare function createRoot<T>(fn: RootFunction<T>, detachedOwner?: typeof Owner): T;
|
|
76
|
+
export type Accessor<T> = () => T;
|
|
77
|
+
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);
|
|
78
|
+
export type Signal<T> = [get: Accessor<T>, set: Setter<T>];
|
|
79
79
|
export interface SignalOptions<T> extends MemoOptions<T> {
|
|
80
80
|
internal?: boolean;
|
|
81
81
|
}
|
|
@@ -107,10 +107,10 @@ export declare function createSignal<T>(value: T, options?: SignalOptions<T>): S
|
|
|
107
107
|
export interface BaseOptions {
|
|
108
108
|
name?: string;
|
|
109
109
|
}
|
|
110
|
-
export
|
|
110
|
+
export type NoInfer<T extends any> = [T][T extends any ? 0 : never];
|
|
111
111
|
export interface EffectOptions extends BaseOptions {
|
|
112
112
|
}
|
|
113
|
-
export
|
|
113
|
+
export type EffectFunction<Prev, Next extends Prev = Prev> = (v: Prev) => Next;
|
|
114
114
|
/**
|
|
115
115
|
* Creates a reactive computation that runs immediately before render, mainly used to write to other reactive primitives
|
|
116
116
|
* ```typescript
|
|
@@ -235,19 +235,19 @@ interface Errored {
|
|
|
235
235
|
latest: never;
|
|
236
236
|
(): never;
|
|
237
237
|
}
|
|
238
|
-
export
|
|
239
|
-
export
|
|
240
|
-
export
|
|
238
|
+
export type Resource<T> = Unresolved | Pending | Ready<T> | Refreshing<T> | Errored;
|
|
239
|
+
export type InitializedResource<T> = Ready<T> | Refreshing<T> | Errored;
|
|
240
|
+
export type ResourceActions<T, R = unknown> = {
|
|
241
241
|
mutate: Setter<T>;
|
|
242
242
|
refetch: (info?: R) => T | Promise<T> | undefined | null;
|
|
243
243
|
};
|
|
244
|
-
export
|
|
245
|
-
export
|
|
246
|
-
export
|
|
244
|
+
export type ResourceSource<S> = S | false | null | undefined | (() => S | false | null | undefined);
|
|
245
|
+
export type ResourceFetcher<S, T, R = unknown> = (k: S, info: ResourceFetcherInfo<T, R>) => T | Promise<T>;
|
|
246
|
+
export type ResourceFetcherInfo<T, R = unknown> = {
|
|
247
247
|
value: T | undefined;
|
|
248
248
|
refetching: R | boolean;
|
|
249
249
|
};
|
|
250
|
-
export
|
|
250
|
+
export type ResourceOptions<T, S = unknown> = {
|
|
251
251
|
initialValue?: T;
|
|
252
252
|
name?: string;
|
|
253
253
|
deferStream?: boolean;
|
|
@@ -257,11 +257,11 @@ export declare type ResourceOptions<T, S = unknown> = {
|
|
|
257
257
|
value: T | undefined;
|
|
258
258
|
}) => void;
|
|
259
259
|
};
|
|
260
|
-
export
|
|
260
|
+
export type InitializedResourceOptions<T, S = unknown> = ResourceOptions<T, S> & {
|
|
261
261
|
initialValue: T;
|
|
262
262
|
};
|
|
263
|
-
export
|
|
264
|
-
export
|
|
263
|
+
export type ResourceReturn<T, R = unknown> = [Resource<T>, ResourceActions<T | undefined, R>];
|
|
264
|
+
export type InitializedResourceReturn<T, R = unknown> = [
|
|
265
265
|
InitializedResource<T>,
|
|
266
266
|
ResourceActions<T, R>
|
|
267
267
|
];
|
|
@@ -316,7 +316,7 @@ export interface DeferredOptions<T> {
|
|
|
316
316
|
* @description https://www.solidjs.com/docs/latest/api#createdeferred
|
|
317
317
|
*/
|
|
318
318
|
export declare function createDeferred<T>(source: Accessor<T>, options?: DeferredOptions<T>): Accessor<T>;
|
|
319
|
-
export
|
|
319
|
+
export type EqualityCheckerFunction<T, U> = (a: U, b: T) => boolean;
|
|
320
320
|
/**
|
|
321
321
|
* Creates a conditional signal that only notifies subscribers when entering or exiting their key matching the value
|
|
322
322
|
* ```typescript
|
|
@@ -359,13 +359,13 @@ export declare function batch<T>(fn: Accessor<T>): T;
|
|
|
359
359
|
*/
|
|
360
360
|
export declare function untrack<T>(fn: Accessor<T>): T;
|
|
361
361
|
/** @deprecated */
|
|
362
|
-
export
|
|
362
|
+
export type ReturnTypes<T> = T extends readonly Accessor<unknown>[] ? {
|
|
363
363
|
[K in keyof T]: T[K] extends Accessor<infer I> ? I : never;
|
|
364
364
|
} : T extends Accessor<infer I> ? I : never;
|
|
365
|
-
export
|
|
365
|
+
export type AccessorArray<T> = [...Extract<{
|
|
366
366
|
[K in keyof T]: Accessor<T[K]>;
|
|
367
367
|
}, readonly unknown[]>];
|
|
368
|
-
export
|
|
368
|
+
export type OnEffectFunction<S, Prev, Next extends Prev = Prev> = (input: S, prevInput: S | undefined, prev: Prev) => Next;
|
|
369
369
|
export interface OnOptions {
|
|
370
370
|
defer?: boolean;
|
|
371
371
|
}
|
|
@@ -425,10 +425,10 @@ export declare function onCleanup<T extends () => any>(fn: T): T;
|
|
|
425
425
|
*
|
|
426
426
|
* @description https://www.solidjs.com/docs/latest/api#onerror
|
|
427
427
|
*/
|
|
428
|
-
export declare function onError(fn: (err:
|
|
428
|
+
export declare function onError(fn: (err: Error) => void): void;
|
|
429
429
|
export declare function getListener(): Computation<any, any> | null;
|
|
430
430
|
export declare function getOwner(): Owner | null;
|
|
431
|
-
export declare function runWithOwner<T>(o: Owner, fn: () => T): T | undefined;
|
|
431
|
+
export declare function runWithOwner<T>(o: typeof Owner, fn: () => T): T | undefined;
|
|
432
432
|
export declare function enableScheduling(scheduler?: typeof requestCallback): void;
|
|
433
433
|
/**
|
|
434
434
|
* ```typescript
|
|
@@ -437,7 +437,7 @@ export declare function enableScheduling(scheduler?: typeof requestCallback): vo
|
|
|
437
437
|
* @description https://www.solidjs.com/docs/latest/api#usetransition
|
|
438
438
|
*/
|
|
439
439
|
export declare function startTransition(fn: () => unknown): Promise<void>;
|
|
440
|
-
export
|
|
440
|
+
export type Transition = [Accessor<boolean>, (fn: () => void) => Promise<void>];
|
|
441
441
|
/**
|
|
442
442
|
* ```typescript
|
|
443
443
|
* export function useTransition(): [
|
|
@@ -450,18 +450,13 @@ export declare type Transition = [Accessor<boolean>, (fn: () => void) => Promise
|
|
|
450
450
|
*/
|
|
451
451
|
export declare function useTransition(): Transition;
|
|
452
452
|
export declare function resumeEffects(e: Computation<any>[]): void;
|
|
453
|
-
export interface DevComponent<T> extends Memo<
|
|
453
|
+
export interface DevComponent<T> extends Memo<unknown> {
|
|
454
454
|
props: T;
|
|
455
455
|
componentName: string;
|
|
456
456
|
}
|
|
457
|
-
export declare function devComponent<
|
|
458
|
-
export declare function
|
|
459
|
-
export
|
|
460
|
-
interface GraphRecord {
|
|
461
|
-
[k: string]: GraphRecord | unknown;
|
|
462
|
-
}
|
|
463
|
-
export declare function serializeGraph(owner?: Owner | null): GraphRecord;
|
|
464
|
-
export declare type ContextProviderComponent<T> = FlowComponent<{
|
|
457
|
+
export declare function devComponent<P, V>(Comp: (props: P) => V, props: P): V;
|
|
458
|
+
export declare function registerGraph(value: SourceMapValue): void;
|
|
459
|
+
export type ContextProviderComponent<T> = FlowComponent<{
|
|
465
460
|
value: T;
|
|
466
461
|
}>;
|
|
467
462
|
export interface Context<T> {
|
|
@@ -499,9 +494,9 @@ export declare function createContext<T>(defaultValue: T, options?: EffectOption
|
|
|
499
494
|
* @description https://www.solidjs.com/docs/latest/api#usecontext
|
|
500
495
|
*/
|
|
501
496
|
export declare function useContext<T>(context: Context<T>): T;
|
|
502
|
-
export
|
|
503
|
-
export
|
|
504
|
-
export
|
|
497
|
+
export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement>;
|
|
498
|
+
export type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
|
|
499
|
+
export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
505
500
|
toArray: () => ResolvedJSXElement[];
|
|
506
501
|
};
|
|
507
502
|
/**
|
|
@@ -513,14 +508,14 @@ export declare type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
|
513
508
|
* @description https://www.solidjs.com/docs/latest/api#children
|
|
514
509
|
*/
|
|
515
510
|
export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn;
|
|
516
|
-
export
|
|
511
|
+
export type SuspenseContextType = {
|
|
517
512
|
increment?: () => void;
|
|
518
513
|
decrement?: () => void;
|
|
519
514
|
inFallback?: () => boolean;
|
|
520
515
|
effects?: Computation<any>[];
|
|
521
516
|
resolved?: boolean;
|
|
522
517
|
};
|
|
523
|
-
|
|
518
|
+
type SuspenseContext = Context<SuspenseContextType> & {
|
|
524
519
|
active?(): boolean;
|
|
525
520
|
increment?(): void;
|
|
526
521
|
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
|
@@ -17,7 +17,7 @@ export declare function For<T extends readonly any[], U extends JSX.Element>(pro
|
|
|
17
17
|
each: T | undefined | null | false;
|
|
18
18
|
fallback?: JSX.Element;
|
|
19
19
|
children: (item: T[number], index: Accessor<number>) => U;
|
|
20
|
-
}):
|
|
20
|
+
}): JSX.Element;
|
|
21
21
|
/**
|
|
22
22
|
* Non-keyed iteration over a list creating elements from its items
|
|
23
23
|
*
|
|
@@ -35,7 +35,7 @@ export declare function Index<T extends readonly any[], U extends JSX.Element>(p
|
|
|
35
35
|
each: T | undefined | null | false;
|
|
36
36
|
fallback?: JSX.Element;
|
|
37
37
|
children: (item: Accessor<T[number]>, index: number) => U;
|
|
38
|
-
}):
|
|
38
|
+
}): JSX.Element;
|
|
39
39
|
/**
|
|
40
40
|
* Conditionally render its children or an optional fallback component
|
|
41
41
|
* @description https://www.solidjs.com/docs/latest/api#show
|
|
@@ -45,13 +45,13 @@ export declare function Show<T>(props: {
|
|
|
45
45
|
keyed: true;
|
|
46
46
|
fallback?: JSX.Element;
|
|
47
47
|
children: JSX.Element | ((item: NonNullable<T>) => JSX.Element);
|
|
48
|
-
}):
|
|
48
|
+
}): JSX.Element;
|
|
49
49
|
export declare function Show<T>(props: {
|
|
50
50
|
when: T | undefined | null | false;
|
|
51
51
|
keyed?: false;
|
|
52
52
|
fallback?: JSX.Element;
|
|
53
|
-
children: JSX.Element;
|
|
54
|
-
}):
|
|
53
|
+
children: JSX.Element | ((item: Accessor<NonNullable<T>>) => JSX.Element);
|
|
54
|
+
}): JSX.Element;
|
|
55
55
|
/**
|
|
56
56
|
* switches between content based on mutually exclusive conditions
|
|
57
57
|
* ```typescript
|
|
@@ -69,8 +69,8 @@ export declare function Show<T>(props: {
|
|
|
69
69
|
export declare function Switch(props: {
|
|
70
70
|
fallback?: JSX.Element;
|
|
71
71
|
children: JSX.Element;
|
|
72
|
-
}):
|
|
73
|
-
export
|
|
72
|
+
}): JSX.Element;
|
|
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);
|
|
@@ -113,4 +113,4 @@ export declare function resetErrorBoundaries(): void;
|
|
|
113
113
|
export declare function ErrorBoundary(props: {
|
|
114
114
|
fallback: JSX.Element | ((err: any, reset: () => void) => JSX.Element);
|
|
115
115
|
children: JSX.Element;
|
|
116
|
-
}):
|
|
116
|
+
}): JSX.Element;
|