solid-js 1.9.0 → 1.9.2
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/README.md +1 -1
- package/dist/dev.cjs +1 -1
- package/dist/dev.js +318 -559
- package/dist/server.js +74 -168
- package/dist/solid.cjs +1 -1
- package/dist/solid.js +276 -486
- package/h/dist/h.js +9 -40
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +8 -11
- package/h/jsx-runtime/types/jsx.d.ts +196 -59
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.cjs +1 -1
- package/html/dist/html.js +94 -219
- package/html/types/lit.d.ts +33 -52
- package/package.json +1 -1
- package/store/dist/dev.js +43 -123
- package/store/dist/server.js +8 -20
- package/store/dist/store.js +40 -114
- package/store/types/index.d.ts +7 -21
- package/store/types/modifiers.d.ts +3 -6
- package/store/types/mutable.d.ts +2 -5
- package/store/types/server.d.ts +5 -25
- package/store/types/store.d.ts +61 -218
- package/types/index.d.ts +10 -75
- package/types/jsx.d.ts +195 -47
- package/types/reactive/array.d.ts +4 -12
- package/types/reactive/observable.d.ts +17 -25
- package/types/reactive/scheduler.d.ts +6 -9
- package/types/reactive/signal.d.ts +142 -233
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +42 -73
- package/types/render/flow.d.ts +31 -43
- package/types/render/hydration.d.ts +15 -15
- package/types/server/index.d.ts +2 -57
- package/types/server/reactive.d.ts +42 -73
- package/types/server/rendering.d.ts +98 -169
- package/universal/dist/dev.js +12 -28
- package/universal/dist/universal.js +12 -28
- package/universal/types/index.d.ts +1 -3
- package/universal/types/universal.d.ts +1 -0
- package/web/dist/dev.cjs +15 -15
- package/web/dist/dev.js +89 -635
- package/web/dist/server.cjs +14 -14
- package/web/dist/server.js +108 -635
- package/web/dist/web.cjs +15 -15
- package/web/dist/web.js +87 -623
- package/web/storage/dist/storage.js +3 -3
- package/web/types/core.d.ts +1 -10
- package/web/types/index.d.ts +10 -27
- package/web/types/server-mock.d.ts +32 -47
|
@@ -4,43 +4,43 @@ 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 type Component<P = {}> = (props: P) => JSX.Element;
|
|
7
|
+
export type Component<P extends Record<string, any> = {}> = (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 type VoidProps<P = {}> = P & {
|
|
14
|
-
|
|
13
|
+
export type VoidProps<P extends Record<string, any> = {}> = P & {
|
|
14
|
+
children?: never;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* `VoidComponent` forbids the `children` prop.
|
|
18
18
|
* Use this to prevent accidentally passing `children` to components that
|
|
19
19
|
* would silently throw them away.
|
|
20
20
|
*/
|
|
21
|
-
export type VoidComponent<P = {}> = Component<VoidProps<P>>;
|
|
21
|
+
export type VoidComponent<P extends Record<string, any> = {}> = 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 type ParentProps<P = {}> = P & {
|
|
28
|
-
|
|
27
|
+
export type ParentProps<P extends Record<string, any> = {}> = P & {
|
|
28
|
+
children?: JSX.Element;
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* `ParentComponent` allows an optional `children` prop with the usual
|
|
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 type ParentComponent<P = {}> = Component<ParentProps<P>>;
|
|
35
|
+
export type ParentComponent<P extends Record<string, any> = {}> = 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 type FlowProps<P = {}, C = JSX.Element> = P & {
|
|
43
|
-
|
|
42
|
+
export type FlowProps<P extends Record<string, any> = {}, C = JSX.Element> = P & {
|
|
43
|
+
children: C;
|
|
44
44
|
};
|
|
45
45
|
/**
|
|
46
46
|
* `FlowComponent` requires a `children` prop with the specified type.
|
|
@@ -48,9 +48,9 @@ export 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 type FlowComponent<P = {}, C = JSX.Element> = Component<FlowProps<P, C>>;
|
|
51
|
+
export type FlowComponent<P extends Record<string, any> = {}, C = JSX.Element> = Component<FlowProps<P, C>>;
|
|
52
52
|
/** @deprecated: use `ParentProps` instead */
|
|
53
|
-
export type PropsWithChildren<P = {}> = ParentProps<P>;
|
|
53
|
+
export type PropsWithChildren<P extends Record<string, any> = {}> = ParentProps<P>;
|
|
54
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
|
|
@@ -59,84 +59,53 @@ export type ValidComponent = keyof JSX.IntrinsicElements | Component<any> | (str
|
|
|
59
59
|
* ComponentProps<typeof Portal> // { mount?: Node; useShadow?: boolean; children: JSX.Element }
|
|
60
60
|
* ComponentProps<'div'> // JSX.HTMLAttributes<HTMLDivElement>
|
|
61
61
|
*/
|
|
62
|
-
export type ComponentProps<T extends ValidComponent> = T extends Component<infer P>
|
|
63
|
-
? P
|
|
64
|
-
: T extends keyof JSX.IntrinsicElements
|
|
65
|
-
? JSX.IntrinsicElements[T]
|
|
66
|
-
: Record<string, unknown>;
|
|
62
|
+
export type ComponentProps<T extends ValidComponent> = T extends Component<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : Record<string, unknown>;
|
|
67
63
|
/**
|
|
68
64
|
* Type of `props.ref`, for use in `Component` or `props` typing.
|
|
69
65
|
*
|
|
70
66
|
* @example Component<{ref: Ref<Element>}>
|
|
71
67
|
*/
|
|
72
68
|
export type Ref<T> = T | ((val: T) => void);
|
|
73
|
-
export declare function createComponent<T
|
|
69
|
+
export declare function createComponent<T extends Record<string, any>>(Comp: Component<T>, props: T): JSX.Element;
|
|
74
70
|
type DistributeOverride<T, F> = T extends undefined ? F : T;
|
|
75
|
-
type Override<T, U> = T extends any
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
: T & U
|
|
83
|
-
: T & U;
|
|
84
|
-
type OverrideSpread<T, U> = T extends any
|
|
85
|
-
? {
|
|
86
|
-
[K in keyof ({
|
|
71
|
+
type Override<T, U> = T extends any ? U extends any ? {
|
|
72
|
+
[K in keyof T]: K extends keyof U ? DistributeOverride<U[K], T[K]> : T[K];
|
|
73
|
+
} & {
|
|
74
|
+
[K in keyof U]: K extends keyof T ? DistributeOverride<U[K], T[K]> : U[K];
|
|
75
|
+
} : T & U : T & U;
|
|
76
|
+
type OverrideSpread<T, U> = T extends any ? {
|
|
77
|
+
[K in keyof ({
|
|
87
78
|
[K in keyof T]: any;
|
|
88
|
-
|
|
79
|
+
} & {
|
|
89
80
|
[K in keyof U]?: any;
|
|
90
|
-
|
|
81
|
+
} & {
|
|
91
82
|
[K in U extends any ? keyof U : keyof U]?: any;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
: T & U;
|
|
99
|
-
type Simplify<T> = T extends any
|
|
100
|
-
? {
|
|
101
|
-
[K in keyof T]: T[K];
|
|
102
|
-
}
|
|
103
|
-
: T;
|
|
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
|
+
} : T & U;
|
|
85
|
+
type Simplify<T> = T extends any ? {
|
|
86
|
+
[K in keyof T]: T[K];
|
|
87
|
+
} : T;
|
|
104
88
|
type _MergeProps<T extends unknown[], Curr = {}> = T extends [
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
]
|
|
108
|
-
? _MergeProps<Rest, Override<Curr, Next>>
|
|
109
|
-
: T extends [...infer Rest, infer Next | (() => infer Next)]
|
|
110
|
-
? Override<_MergeProps<Rest, Curr>, Next>
|
|
111
|
-
: T extends []
|
|
112
|
-
? Curr
|
|
113
|
-
: T extends (infer I | (() => infer I))[]
|
|
114
|
-
? OverrideSpread<Curr, I>
|
|
115
|
-
: Curr;
|
|
89
|
+
infer Next | (() => infer Next),
|
|
90
|
+
...infer Rest
|
|
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;
|
|
116
92
|
export type MergeProps<T extends unknown[]> = Simplify<_MergeProps<T>>;
|
|
117
93
|
export declare function mergeProps<T extends unknown[]>(...sources: T): MergeProps<T>;
|
|
118
94
|
export type SplitProps<T, K extends (readonly (keyof T)[])[]> = [
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
[P in keyof T as Exclude<P, K[number][number]>]: T[P];
|
|
126
|
-
}
|
|
95
|
+
...{
|
|
96
|
+
[P in keyof K]: P extends `${number}` ? Pick<T, Extract<K[P], readonly (keyof T)[]>[number]> : never;
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
[P in keyof T as Exclude<P, K[number][number]>]: T[P];
|
|
100
|
+
}
|
|
127
101
|
];
|
|
128
|
-
export declare function splitProps<
|
|
129
|
-
|
|
130
|
-
K extends [readonly (keyof T)[], ...(readonly (keyof T)[])[]]
|
|
131
|
-
>(props: T, ...keys: K): SplitProps<T, K>;
|
|
132
|
-
export declare function lazy<T extends Component<any>>(
|
|
133
|
-
fn: () => Promise<{
|
|
134
|
-
default: T;
|
|
135
|
-
}>
|
|
136
|
-
): T & {
|
|
137
|
-
preload: () => Promise<{
|
|
102
|
+
export declare function splitProps<T extends Record<any, any>, K extends [readonly (keyof T)[], ...(readonly (keyof T)[])[]]>(props: T, ...keys: K): SplitProps<T, K>;
|
|
103
|
+
export declare function lazy<T extends Component<any>>(fn: () => Promise<{
|
|
138
104
|
default: T;
|
|
139
|
-
|
|
105
|
+
}>): T & {
|
|
106
|
+
preload: () => Promise<{
|
|
107
|
+
default: T;
|
|
108
|
+
}>;
|
|
140
109
|
};
|
|
141
110
|
export declare function createUniqueId(): string;
|
|
142
111
|
export {};
|
package/types/render/flow.d.ts
CHANGED
|
@@ -14,9 +14,9 @@ import type { JSX } from "../jsx.js";
|
|
|
14
14
|
* @description https://docs.solidjs.com/reference/components/for
|
|
15
15
|
*/
|
|
16
16
|
export declare function For<T extends readonly any[], U extends JSX.Element>(props: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
each: T | undefined | null | false;
|
|
18
|
+
fallback?: JSX.Element;
|
|
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
|
|
@@ -32,32 +32,26 @@ export declare function For<T extends readonly any[], U extends JSX.Element>(pro
|
|
|
32
32
|
* @description https://docs.solidjs.com/reference/components/index
|
|
33
33
|
*/
|
|
34
34
|
export declare function Index<T extends readonly any[], U extends JSX.Element>(props: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
each: T | undefined | null | false;
|
|
36
|
+
fallback?: JSX.Element;
|
|
37
|
+
children: (item: Accessor<T[number]>, index: number) => U;
|
|
38
38
|
}): JSX.Element;
|
|
39
39
|
type RequiredParameter<T> = T extends () => unknown ? never : T;
|
|
40
40
|
/**
|
|
41
41
|
* Conditionally render its children or an optional fallback component
|
|
42
42
|
* @description https://docs.solidjs.com/reference/components/show
|
|
43
43
|
*/
|
|
44
|
-
export declare function Show<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
keyed?: false;
|
|
50
|
-
fallback?: JSX.Element;
|
|
51
|
-
children: JSX.Element | RequiredParameter<TRenderFunction>;
|
|
44
|
+
export declare function Show<T, TRenderFunction extends (item: Accessor<NonNullable<T>>) => JSX.Element>(props: {
|
|
45
|
+
when: T | undefined | null | false;
|
|
46
|
+
keyed?: false;
|
|
47
|
+
fallback?: JSX.Element;
|
|
48
|
+
children: JSX.Element | RequiredParameter<TRenderFunction>;
|
|
52
49
|
}): JSX.Element;
|
|
53
|
-
export declare function Show<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
keyed: true;
|
|
59
|
-
fallback?: JSX.Element;
|
|
60
|
-
children: JSX.Element | RequiredParameter<TRenderFunction>;
|
|
50
|
+
export declare function Show<T, TRenderFunction extends (item: NonNullable<T>) => JSX.Element>(props: {
|
|
51
|
+
when: T | undefined | null | false;
|
|
52
|
+
keyed: true;
|
|
53
|
+
fallback?: JSX.Element;
|
|
54
|
+
children: JSX.Element | RequiredParameter<TRenderFunction>;
|
|
61
55
|
}): JSX.Element;
|
|
62
56
|
/**
|
|
63
57
|
* Switches between content based on mutually exclusive conditions
|
|
@@ -74,13 +68,13 @@ export declare function Show<
|
|
|
74
68
|
* @description https://docs.solidjs.com/reference/components/switch-and-match
|
|
75
69
|
*/
|
|
76
70
|
export declare function Switch(props: {
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
fallback?: JSX.Element;
|
|
72
|
+
children: JSX.Element;
|
|
79
73
|
}): JSX.Element;
|
|
80
74
|
export type MatchProps<T> = {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
when: T | undefined | null | false;
|
|
76
|
+
keyed?: boolean;
|
|
77
|
+
children: JSX.Element | ((item: NonNullable<T> | Accessor<NonNullable<T>>) => JSX.Element);
|
|
84
78
|
};
|
|
85
79
|
/**
|
|
86
80
|
* Selects a content based on condition when inside a `<Switch>` control flow
|
|
@@ -91,21 +85,15 @@ export type MatchProps<T> = {
|
|
|
91
85
|
* ```
|
|
92
86
|
* @description https://docs.solidjs.com/reference/components/switch-and-match
|
|
93
87
|
*/
|
|
94
|
-
export declare function Match<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
when: T | undefined | null | false;
|
|
99
|
-
keyed?: false;
|
|
100
|
-
children: JSX.Element | RequiredParameter<TRenderFunction>;
|
|
88
|
+
export declare function Match<T, TRenderFunction extends (item: Accessor<NonNullable<T>>) => JSX.Element>(props: {
|
|
89
|
+
when: T | undefined | null | false;
|
|
90
|
+
keyed?: false;
|
|
91
|
+
children: JSX.Element | RequiredParameter<TRenderFunction>;
|
|
101
92
|
}): JSX.Element;
|
|
102
|
-
export declare function Match<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
when: T | undefined | null | false;
|
|
107
|
-
keyed: true;
|
|
108
|
-
children: JSX.Element | RequiredParameter<TRenderFunction>;
|
|
93
|
+
export declare function Match<T, TRenderFunction extends (item: NonNullable<T>) => JSX.Element>(props: {
|
|
94
|
+
when: T | undefined | null | false;
|
|
95
|
+
keyed: true;
|
|
96
|
+
children: JSX.Element | RequiredParameter<TRenderFunction>;
|
|
109
97
|
}): JSX.Element;
|
|
110
98
|
export declare function resetErrorBoundaries(): void;
|
|
111
99
|
/**
|
|
@@ -124,7 +112,7 @@ export declare function resetErrorBoundaries(): void;
|
|
|
124
112
|
* @description https://docs.solidjs.com/reference/components/error-boundary
|
|
125
113
|
*/
|
|
126
114
|
export declare function ErrorBoundary(props: {
|
|
127
|
-
|
|
128
|
-
|
|
115
|
+
fallback: JSX.Element | ((err: any, reset: () => void) => JSX.Element);
|
|
116
|
+
children: JSX.Element;
|
|
129
117
|
}): JSX.Element;
|
|
130
118
|
export {};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { Computation } from "../reactive/signal.js";
|
|
2
2
|
export type HydrationContext = {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
id: string;
|
|
4
|
+
count: number;
|
|
5
5
|
};
|
|
6
6
|
type SharedConfig = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
context?: HydrationContext;
|
|
8
|
+
resources?: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
load?: (id: string) => Promise<any> | any;
|
|
12
|
+
has?: (id: string) => boolean;
|
|
13
|
+
gather?: (key: string) => void;
|
|
14
|
+
registry?: Map<string, Element>;
|
|
15
|
+
done?: boolean;
|
|
16
|
+
count?: number;
|
|
17
|
+
effects?: Computation<any, any>[];
|
|
18
|
+
getContextId(): string;
|
|
19
|
+
getNextContextId(): string;
|
|
20
20
|
};
|
|
21
21
|
export declare const sharedConfig: SharedConfig;
|
|
22
22
|
export declare function setHydrateContext(context?: HydrationContext): void;
|
package/types/server/index.d.ts
CHANGED
|
@@ -1,58 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
createRoot,
|
|
4
|
-
createSignal,
|
|
5
|
-
createComputed,
|
|
6
|
-
createRenderEffect,
|
|
7
|
-
createEffect,
|
|
8
|
-
createReaction,
|
|
9
|
-
createDeferred,
|
|
10
|
-
createSelector,
|
|
11
|
-
createMemo,
|
|
12
|
-
getListener,
|
|
13
|
-
onMount,
|
|
14
|
-
onCleanup,
|
|
15
|
-
onError,
|
|
16
|
-
untrack,
|
|
17
|
-
batch,
|
|
18
|
-
on,
|
|
19
|
-
children,
|
|
20
|
-
createContext,
|
|
21
|
-
useContext,
|
|
22
|
-
getOwner,
|
|
23
|
-
runWithOwner,
|
|
24
|
-
equalFn,
|
|
25
|
-
requestCallback,
|
|
26
|
-
mapArray,
|
|
27
|
-
indexArray,
|
|
28
|
-
observable,
|
|
29
|
-
from,
|
|
30
|
-
$PROXY,
|
|
31
|
-
$DEVCOMP,
|
|
32
|
-
$TRACK,
|
|
33
|
-
DEV,
|
|
34
|
-
enableExternalSource
|
|
35
|
-
} from "./reactive.js";
|
|
36
|
-
export {
|
|
37
|
-
mergeProps,
|
|
38
|
-
splitProps,
|
|
39
|
-
createComponent,
|
|
40
|
-
For,
|
|
41
|
-
Index,
|
|
42
|
-
Show,
|
|
43
|
-
Switch,
|
|
44
|
-
Match,
|
|
45
|
-
ErrorBoundary,
|
|
46
|
-
Suspense,
|
|
47
|
-
SuspenseList,
|
|
48
|
-
createResource,
|
|
49
|
-
resetErrorBoundaries,
|
|
50
|
-
enableScheduling,
|
|
51
|
-
enableHydration,
|
|
52
|
-
startTransition,
|
|
53
|
-
useTransition,
|
|
54
|
-
createUniqueId,
|
|
55
|
-
lazy,
|
|
56
|
-
sharedConfig
|
|
57
|
-
} from "./rendering.js";
|
|
1
|
+
export { catchError, createRoot, createSignal, createComputed, createRenderEffect, createEffect, createReaction, createDeferred, createSelector, createMemo, getListener, onMount, onCleanup, onError, untrack, batch, on, children, createContext, useContext, getOwner, runWithOwner, equalFn, requestCallback, mapArray, indexArray, observable, from, $PROXY, $DEVCOMP, $TRACK, DEV, enableExternalSource } from "./reactive.js";
|
|
2
|
+
export { mergeProps, splitProps, createComponent, For, Index, Show, Switch, Match, ErrorBoundary, Suspense, SuspenseList, createResource, resetErrorBoundaries, enableScheduling, enableHydration, startTransition, useTransition, createUniqueId, lazy, sharedConfig } from "./rendering.js";
|
|
58
3
|
export type { Component, Resource } from "./rendering.js";
|
|
@@ -4,118 +4,87 @@ export declare const $TRACK: unique symbol;
|
|
|
4
4
|
export declare const $DEVCOMP: unique symbol;
|
|
5
5
|
export declare const DEV: undefined;
|
|
6
6
|
export type Accessor<T> = () => T;
|
|
7
|
-
export type Setter<T> = undefined extends T
|
|
8
|
-
? <U extends T>(value?: (U extends Function ? never : U) | ((prev?: T) => U)) => U
|
|
9
|
-
: <U extends T>(value: (U extends Function ? never : U) | ((prev: T) => U)) => U;
|
|
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;
|
|
10
8
|
export type Signal<T> = [get: Accessor<T>, set: Setter<T>];
|
|
11
9
|
export declare function castError(err: unknown): Error;
|
|
12
10
|
export declare let Owner: Owner | null;
|
|
13
11
|
interface Owner {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
owner: Owner | null;
|
|
13
|
+
context: any | null;
|
|
14
|
+
owned: Owner[] | null;
|
|
15
|
+
cleanups: (() => void)[] | null;
|
|
18
16
|
}
|
|
19
17
|
export declare function createOwner(): Owner;
|
|
20
|
-
export declare function createRoot<T>(
|
|
21
|
-
|
|
22
|
-
detachedOwner?: typeof Owner
|
|
23
|
-
): T;
|
|
24
|
-
export declare function createSignal<T>(
|
|
25
|
-
value: T,
|
|
26
|
-
options?: {
|
|
18
|
+
export declare function createRoot<T>(fn: (dispose: () => void) => T, detachedOwner?: typeof Owner): T;
|
|
19
|
+
export declare function createSignal<T>(value: T, options?: {
|
|
27
20
|
equals?: false | ((prev: T, next: T) => boolean);
|
|
28
21
|
name?: string;
|
|
29
|
-
|
|
30
|
-
): [get: () => T, set: (v: (T extends Function ? never : T) | ((prev: T) => T)) => T];
|
|
22
|
+
}): [get: () => T, set: (v: (T extends Function ? never : T) | ((prev: T) => T)) => T];
|
|
31
23
|
export declare function createComputed<T>(fn: (v?: T) => T, value?: T): void;
|
|
32
24
|
export declare const createRenderEffect: typeof createComputed;
|
|
33
25
|
export declare function createEffect<T>(fn: (v?: T) => T, value?: T): void;
|
|
34
26
|
export declare function createReaction(fn: () => void): (fn: () => void) => void;
|
|
35
27
|
export declare function createMemo<T>(fn: (v?: T) => T, value?: T): () => T;
|
|
36
28
|
export declare function createDeferred<T>(source: () => T): () => T;
|
|
37
|
-
export declare function createSelector<T>(
|
|
38
|
-
source: () => T,
|
|
39
|
-
fn?: (k: T, value: T) => boolean
|
|
40
|
-
): (k: T) => boolean;
|
|
29
|
+
export declare function createSelector<T>(source: () => T, fn?: (k: T, value: T) => boolean): (k: T) => boolean;
|
|
41
30
|
export declare function batch<T>(fn: () => T): T;
|
|
42
31
|
export declare const untrack: typeof batch;
|
|
43
|
-
export declare function on<T, U>(
|
|
44
|
-
deps: Array<() => T> | (() => T),
|
|
45
|
-
fn: (value: Array<T> | T, prev?: Array<T> | T, prevResults?: U) => U,
|
|
46
|
-
options?: {
|
|
32
|
+
export declare function on<T, U>(deps: Array<() => T> | (() => T), fn: (value: Array<T> | T, prev?: Array<T> | T, prevResults?: U) => U, options?: {
|
|
47
33
|
defer?: boolean;
|
|
48
|
-
|
|
49
|
-
): (prev?: U) => U | undefined;
|
|
34
|
+
}): (prev?: U) => U | undefined;
|
|
50
35
|
export declare function onMount(fn: () => void): void;
|
|
51
36
|
export declare function onCleanup(fn: () => void): () => void;
|
|
52
37
|
export declare function cleanNode(node: Owner): void;
|
|
53
38
|
export declare function catchError<T>(fn: () => T, handler: (err: Error) => void): T | undefined;
|
|
54
39
|
export declare function getListener(): null;
|
|
55
40
|
export interface Context<T> {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
41
|
+
id: symbol;
|
|
42
|
+
Provider: (props: {
|
|
43
|
+
value: T;
|
|
44
|
+
children: any;
|
|
45
|
+
}) => any;
|
|
46
|
+
defaultValue?: T;
|
|
59
47
|
}
|
|
60
48
|
export declare function createContext<T>(defaultValue?: T): Context<T>;
|
|
61
49
|
export declare function useContext<T>(context: Context<T>): T;
|
|
62
50
|
export declare function getOwner(): Owner | null;
|
|
63
51
|
type ChildrenReturn = Accessor<any> & {
|
|
64
|
-
|
|
52
|
+
toArray: () => any[];
|
|
65
53
|
};
|
|
66
54
|
export declare function children(fn: () => any): ChildrenReturn;
|
|
67
55
|
export declare function runWithOwner<T>(o: typeof Owner, fn: () => T): T | undefined;
|
|
68
56
|
export interface Task {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
57
|
+
id: number;
|
|
58
|
+
fn: ((didTimeout: boolean) => void) | null;
|
|
59
|
+
startTime: number;
|
|
60
|
+
expirationTime: number;
|
|
73
61
|
}
|
|
74
|
-
export declare function requestCallback(
|
|
75
|
-
fn: () => void,
|
|
76
|
-
options?: {
|
|
62
|
+
export declare function requestCallback(fn: () => void, options?: {
|
|
77
63
|
timeout: number;
|
|
78
|
-
|
|
79
|
-
): Task;
|
|
64
|
+
}): Task;
|
|
80
65
|
export declare function cancelCallback(task: Task): void;
|
|
81
|
-
export declare function mapArray<T, U>(
|
|
82
|
-
list: Accessor<readonly T[] | undefined | null | false>,
|
|
83
|
-
mapFn: (v: T, i: Accessor<number>) => U,
|
|
84
|
-
options?: {
|
|
66
|
+
export declare function mapArray<T, U>(list: Accessor<readonly T[] | undefined | null | false>, mapFn: (v: T, i: Accessor<number>) => U, options?: {
|
|
85
67
|
fallback?: Accessor<any>;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
export declare function indexArray<T, U>(
|
|
89
|
-
list: Accessor<readonly T[] | undefined | null | false>,
|
|
90
|
-
mapFn: (v: Accessor<T>, i: number) => U,
|
|
91
|
-
options?: {
|
|
68
|
+
}): () => U[];
|
|
69
|
+
export declare function indexArray<T, U>(list: Accessor<readonly T[] | undefined | null | false>, mapFn: (v: Accessor<T>, i: number) => U, options?: {
|
|
92
70
|
fallback?: Accessor<any>;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
error?: (v: any) => void;
|
|
100
|
-
complete?: (v: boolean) => void;
|
|
101
|
-
};
|
|
71
|
+
}): () => U[];
|
|
72
|
+
export type ObservableObserver<T> = ((v: T) => void) | {
|
|
73
|
+
next: (v: T) => void;
|
|
74
|
+
error?: (v: any) => void;
|
|
75
|
+
complete?: (v: boolean) => void;
|
|
76
|
+
};
|
|
102
77
|
export declare function observable<T>(input: Accessor<T>): {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
78
|
+
subscribe(observer: ObservableObserver<T>): {
|
|
79
|
+
unsubscribe(): void;
|
|
80
|
+
};
|
|
81
|
+
[Symbol.observable](): any;
|
|
107
82
|
};
|
|
108
|
-
export declare function from<T>(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
| (() => void)
|
|
114
|
-
| {
|
|
115
|
-
unsubscribe: () => void;
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
): Accessor<T>;
|
|
83
|
+
export declare function from<T>(producer: ((setter: Setter<T>) => () => void) | {
|
|
84
|
+
subscribe: (fn: (v: T) => void) => (() => void) | {
|
|
85
|
+
unsubscribe: () => void;
|
|
86
|
+
};
|
|
87
|
+
}): Accessor<T>;
|
|
119
88
|
export declare function enableExternalSource(factory: any): void;
|
|
120
89
|
/**
|
|
121
90
|
* @deprecated since version 1.7.0 and will be removed in next major - use catchError instead
|