solid-js 1.8.17 → 1.8.19
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 +223 -223
- package/dist/dev.cjs +29 -24
- package/dist/dev.js +344 -580
- package/dist/server.cjs +31 -18
- package/dist/server.js +103 -185
- package/dist/solid.cjs +29 -24
- package/dist/solid.js +302 -507
- package/h/dist/h.cjs +12 -1
- package/h/dist/h.js +19 -34
- 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 +5 -0
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +94 -216
- package/html/types/lit.d.ts +33 -47
- package/package.json +3 -3
- package/store/dist/dev.js +43 -122
- package/store/dist/server.js +8 -19
- package/store/dist/store.js +40 -113
- 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 +4 -12
- package/store/types/store.d.ts +62 -219
- package/types/index.d.ts +10 -75
- package/types/jsx.d.ts +5 -0
- package/types/reactive/array.d.ts +6 -14
- package/types/reactive/observable.d.ts +18 -26
- package/types/reactive/scheduler.d.ts +6 -9
- package/types/reactive/signal.d.ts +164 -255
- package/types/render/Suspense.d.ts +7 -7
- package/types/render/component.d.ts +33 -64
- package/types/render/flow.d.ts +37 -49
- package/types/render/hydration.d.ts +15 -13
- package/types/server/index.d.ts +2 -57
- package/types/server/reactive.d.ts +42 -73
- package/types/server/rendering.d.ts +99 -168
- 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 +6 -4
- package/web/dist/dev.js +88 -630
- package/web/dist/server.cjs +6 -6
- package/web/dist/server.js +102 -216
- package/web/dist/web.cjs +6 -4
- package/web/dist/web.js +86 -621
- package/web/storage/dist/storage.js +3 -3
- package/web/types/client.d.ts +2 -2
- package/web/types/core.d.ts +1 -10
- package/web/types/index.d.ts +12 -29
- package/web/types/server-mock.d.ts +32 -47
|
@@ -32,61 +32,58 @@ export declare var Owner: Owner | null;
|
|
|
32
32
|
export declare let Transition: TransitionState | null;
|
|
33
33
|
/** Object storing callbacks for debugging during development */
|
|
34
34
|
export declare const DevHooks: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
afterUpdate: (() => void) | null;
|
|
36
|
+
afterCreateOwner: ((owner: Owner) => void) | null;
|
|
37
|
+
afterCreateSignal: ((signal: SignalState<any>) => void) | null;
|
|
38
38
|
};
|
|
39
39
|
export type ComputationState = 0 | 1 | 2;
|
|
40
40
|
export interface SourceMapValue {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
value: unknown;
|
|
42
|
+
name?: string;
|
|
43
|
+
graph?: Owner;
|
|
44
44
|
}
|
|
45
45
|
export interface SignalState<T> extends SourceMapValue {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
value: T;
|
|
47
|
+
observers: Computation<any>[] | null;
|
|
48
|
+
observerSlots: number[] | null;
|
|
49
|
+
tValue?: T;
|
|
50
|
+
comparator?: (prev: T, next: T) => boolean;
|
|
51
51
|
}
|
|
52
52
|
export interface Owner {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
owned: Computation<any>[] | null;
|
|
54
|
+
cleanups: (() => void)[] | null;
|
|
55
|
+
owner: Owner | null;
|
|
56
|
+
context: any | null;
|
|
57
|
+
sourceMap?: SourceMapValue[];
|
|
58
|
+
name?: string;
|
|
59
59
|
}
|
|
60
60
|
export interface Computation<Init, Next extends Init = Init> extends Owner {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
fn: EffectFunction<Init, Next>;
|
|
62
|
+
state: ComputationState;
|
|
63
|
+
tState?: ComputationState;
|
|
64
|
+
sources: SignalState<Next>[] | null;
|
|
65
|
+
sourceSlots: number[] | null;
|
|
66
|
+
value?: Init;
|
|
67
|
+
updatedAt: number | null;
|
|
68
|
+
pure: boolean;
|
|
69
|
+
user?: boolean;
|
|
70
|
+
suspense?: SuspenseContextType;
|
|
71
71
|
}
|
|
72
72
|
export interface TransitionState {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
sources: Set<SignalState<any>>;
|
|
74
|
+
effects: Computation<any>[];
|
|
75
|
+
promises: Set<Promise<any>>;
|
|
76
|
+
disposed: Set<Computation<any>>;
|
|
77
|
+
queue: Set<Computation<any>>;
|
|
78
|
+
scheduler?: (fn: () => void) => unknown;
|
|
79
|
+
running: boolean;
|
|
80
|
+
done?: Promise<void>;
|
|
81
|
+
resolve?: () => void;
|
|
82
82
|
}
|
|
83
|
-
type ExternalSourceFactory = <Prev, Next extends Prev = Prev>(
|
|
84
|
-
fn: EffectFunction<Prev, Next>,
|
|
85
|
-
trigger: () => void
|
|
86
|
-
) => ExternalSource;
|
|
83
|
+
type ExternalSourceFactory = <Prev, Next extends Prev = Prev>(fn: EffectFunction<Prev, Next>, trigger: () => void) => ExternalSource;
|
|
87
84
|
export interface ExternalSource {
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
track: EffectFunction<any, any>;
|
|
86
|
+
dispose: () => void;
|
|
90
87
|
}
|
|
91
88
|
export type RootFunction<T> = (dispose: () => void) => T;
|
|
92
89
|
/**
|
|
@@ -96,21 +93,19 @@ export type RootFunction<T> = (dispose: () => void) => T;
|
|
|
96
93
|
* @param detachedOwner optional reactive context to bind the root to
|
|
97
94
|
* @returns the output of `fn`.
|
|
98
95
|
*
|
|
99
|
-
* @description https://
|
|
96
|
+
* @description https://docs.solidjs.com/reference/reactive-utilities/create-root
|
|
100
97
|
*/
|
|
101
98
|
export declare function createRoot<T>(fn: RootFunction<T>, detachedOwner?: typeof Owner): T;
|
|
102
99
|
export type Accessor<T> = () => T;
|
|
103
100
|
export type Setter<in out T> = {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
: U;
|
|
107
|
-
|
|
108
|
-
<U extends T>(value: Exclude<U, Function>): U;
|
|
109
|
-
<U extends T>(value: Exclude<U, Function> | ((prev: T) => U)): U;
|
|
101
|
+
<U extends T>(...args: undefined extends T ? [] : [value: (prev: T) => U]): undefined extends T ? undefined : U;
|
|
102
|
+
<U extends T>(value: (prev: T) => U): U;
|
|
103
|
+
<U extends T>(value: Exclude<U, Function>): U;
|
|
104
|
+
<U extends T>(value: Exclude<U, Function> | ((prev: T) => U)): U;
|
|
110
105
|
};
|
|
111
106
|
export type Signal<T> = [get: Accessor<T>, set: Setter<T>];
|
|
112
107
|
export interface SignalOptions<T> extends MemoOptions<T> {
|
|
113
|
-
|
|
108
|
+
internal?: boolean;
|
|
114
109
|
}
|
|
115
110
|
/**
|
|
116
111
|
* Creates a simple reactive state with a getter and setter
|
|
@@ -133,15 +128,16 @@ export interface SignalOptions<T> extends MemoOptions<T> {
|
|
|
133
128
|
* setCount(count => count + 1);
|
|
134
129
|
* ```
|
|
135
130
|
*
|
|
136
|
-
* @description https://
|
|
131
|
+
* @description https://docs.solidjs.com/reference/basic-reactivity/create-signal
|
|
137
132
|
*/
|
|
138
133
|
export declare function createSignal<T>(): Signal<T | undefined>;
|
|
139
134
|
export declare function createSignal<T>(value: T, options?: SignalOptions<T>): Signal<T>;
|
|
140
135
|
export interface BaseOptions {
|
|
141
|
-
|
|
136
|
+
name?: string;
|
|
142
137
|
}
|
|
143
138
|
export type NoInfer<T extends any> = [T][T extends any ? 0 : never];
|
|
144
|
-
export interface EffectOptions extends BaseOptions {
|
|
139
|
+
export interface EffectOptions extends BaseOptions {
|
|
140
|
+
}
|
|
145
141
|
export type EffectFunction<Prev, Next extends Prev = Prev> = (v: Prev) => Next;
|
|
146
142
|
/**
|
|
147
143
|
* Creates a reactive computation that runs immediately before render, mainly used to write to other reactive primitives
|
|
@@ -156,16 +152,10 @@ export type EffectFunction<Prev, Next extends Prev = Prev> = (v: Prev) => Next;
|
|
|
156
152
|
* @param value an optional initial value for the computation; if set, fn will never receive undefined as first argument
|
|
157
153
|
* @param options allows to set a name in dev mode for debugging purposes
|
|
158
154
|
*
|
|
159
|
-
* @description https://
|
|
155
|
+
* @description https://docs.solidjs.com/reference/secondary-primitives/create-computed
|
|
160
156
|
*/
|
|
161
|
-
export declare function createComputed<Next>(
|
|
162
|
-
|
|
163
|
-
): void;
|
|
164
|
-
export declare function createComputed<Next, Init = Next>(
|
|
165
|
-
fn: EffectFunction<Init | Next, Next>,
|
|
166
|
-
value: Init,
|
|
167
|
-
options?: EffectOptions
|
|
168
|
-
): void;
|
|
157
|
+
export declare function createComputed<Next>(fn: EffectFunction<undefined | NoInfer<Next>, Next>): void;
|
|
158
|
+
export declare function createComputed<Next, Init = Next>(fn: EffectFunction<Init | Next, Next>, value: Init, options?: EffectOptions): void;
|
|
169
159
|
/**
|
|
170
160
|
* Creates a reactive computation that runs during the render phase as DOM elements are created and updated but not necessarily connected
|
|
171
161
|
* ```typescript
|
|
@@ -179,16 +169,10 @@ export declare function createComputed<Next, Init = Next>(
|
|
|
179
169
|
* @param value an optional initial value for the computation; if set, fn will never receive undefined as first argument
|
|
180
170
|
* @param options allows to set a name in dev mode for debugging purposes
|
|
181
171
|
*
|
|
182
|
-
* @description https://
|
|
172
|
+
* @description https://docs.solidjs.com/reference/secondary-primitives/create-render-effect
|
|
183
173
|
*/
|
|
184
|
-
export declare function createRenderEffect<Next>(
|
|
185
|
-
|
|
186
|
-
): void;
|
|
187
|
-
export declare function createRenderEffect<Next, Init = Next>(
|
|
188
|
-
fn: EffectFunction<Init | Next, Next>,
|
|
189
|
-
value: Init,
|
|
190
|
-
options?: EffectOptions
|
|
191
|
-
): void;
|
|
174
|
+
export declare function createRenderEffect<Next>(fn: EffectFunction<undefined | NoInfer<Next>, Next>): void;
|
|
175
|
+
export declare function createRenderEffect<Next, Init = Next>(fn: EffectFunction<Init | Next, Next>, value: Init, options?: EffectOptions): void;
|
|
192
176
|
/**
|
|
193
177
|
* Creates a reactive computation that runs after the render phase
|
|
194
178
|
* ```typescript
|
|
@@ -202,18 +186,12 @@ export declare function createRenderEffect<Next, Init = Next>(
|
|
|
202
186
|
* @param value an optional initial value for the computation; if set, fn will never receive undefined as first argument
|
|
203
187
|
* @param options allows to set a name in dev mode for debugging purposes
|
|
204
188
|
*
|
|
205
|
-
* @description https://
|
|
189
|
+
* @description https://docs.solidjs.com/reference/basic-reactivity/create-effect
|
|
206
190
|
*/
|
|
207
|
-
export declare function createEffect<Next>(
|
|
208
|
-
|
|
209
|
-
): void;
|
|
210
|
-
export declare function createEffect<Next, Init = Next>(
|
|
211
|
-
fn: EffectFunction<Init | Next, Next>,
|
|
212
|
-
value: Init,
|
|
213
|
-
options?: EffectOptions & {
|
|
191
|
+
export declare function createEffect<Next>(fn: EffectFunction<undefined | NoInfer<Next>, Next>): void;
|
|
192
|
+
export declare function createEffect<Next, Init = Next>(fn: EffectFunction<Init | Next, Next>, value: Init, options?: EffectOptions & {
|
|
214
193
|
render?: boolean;
|
|
215
|
-
|
|
216
|
-
): void;
|
|
194
|
+
}): void;
|
|
217
195
|
/**
|
|
218
196
|
* Creates a reactive computation that runs after the render phase with flexible tracking
|
|
219
197
|
* ```typescript
|
|
@@ -225,18 +203,15 @@ export declare function createEffect<Next, Init = Next>(
|
|
|
225
203
|
* @param invalidated a function that is called when tracked function is invalidated.
|
|
226
204
|
* @param options allows to set a name in dev mode for debugging purposes
|
|
227
205
|
*
|
|
228
|
-
* @description https://
|
|
206
|
+
* @description https://docs.solidjs.com/reference/secondary-primitives/create-reaction
|
|
229
207
|
*/
|
|
230
|
-
export declare function createReaction(
|
|
231
|
-
onInvalidate: () => void,
|
|
232
|
-
options?: EffectOptions
|
|
233
|
-
): (tracking: () => void) => void;
|
|
208
|
+
export declare function createReaction(onInvalidate: () => void, options?: EffectOptions): (tracking: () => void) => void;
|
|
234
209
|
export interface Memo<Prev, Next = Prev> extends SignalState<Next>, Computation<Next> {
|
|
235
|
-
|
|
236
|
-
|
|
210
|
+
value: Next;
|
|
211
|
+
tOwned?: Computation<Prev | Next, Next>[];
|
|
237
212
|
}
|
|
238
213
|
export interface MemoOptions<T> extends EffectOptions {
|
|
239
|
-
|
|
214
|
+
equals?: false | ((prev: T, next: T) => boolean);
|
|
240
215
|
}
|
|
241
216
|
/**
|
|
242
217
|
* Creates a readonly derived reactive memoized signal
|
|
@@ -251,86 +226,74 @@ export interface MemoOptions<T> extends EffectOptions {
|
|
|
251
226
|
* @param value an optional initial value for the computation; if set, fn will never receive undefined as first argument
|
|
252
227
|
* @param options allows to set a name in dev mode for debugging purposes and use a custom comparison function in equals
|
|
253
228
|
*
|
|
254
|
-
* @description https://
|
|
229
|
+
* @description https://docs.solidjs.com/reference/basic-reactivity/create-memo
|
|
255
230
|
*/
|
|
256
|
-
export declare function createMemo<Next extends Prev, Prev = Next>(
|
|
257
|
-
|
|
258
|
-
): Accessor<Next>;
|
|
259
|
-
export declare function createMemo<Next extends Prev, Init = Next, Prev = Next>(
|
|
260
|
-
fn: EffectFunction<Init | Prev, Next>,
|
|
261
|
-
value: Init,
|
|
262
|
-
options?: MemoOptions<Next>
|
|
263
|
-
): Accessor<Next>;
|
|
231
|
+
export declare function createMemo<Next extends Prev, Prev = Next>(fn: EffectFunction<undefined | NoInfer<Prev>, Next>): Accessor<Next>;
|
|
232
|
+
export declare function createMemo<Next extends Prev, Init = Next, Prev = Next>(fn: EffectFunction<Init | Prev, Next>, value: Init, options?: MemoOptions<Next>): Accessor<Next>;
|
|
264
233
|
interface Unresolved {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
234
|
+
state: "unresolved";
|
|
235
|
+
loading: false;
|
|
236
|
+
error: undefined;
|
|
237
|
+
latest: undefined;
|
|
238
|
+
(): undefined;
|
|
270
239
|
}
|
|
271
240
|
interface Pending {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
241
|
+
state: "pending";
|
|
242
|
+
loading: true;
|
|
243
|
+
error: undefined;
|
|
244
|
+
latest: undefined;
|
|
245
|
+
(): undefined;
|
|
277
246
|
}
|
|
278
247
|
interface Ready<T> {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
248
|
+
state: "ready";
|
|
249
|
+
loading: false;
|
|
250
|
+
error: undefined;
|
|
251
|
+
latest: T;
|
|
252
|
+
(): T;
|
|
284
253
|
}
|
|
285
254
|
interface Refreshing<T> {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
255
|
+
state: "refreshing";
|
|
256
|
+
loading: true;
|
|
257
|
+
error: undefined;
|
|
258
|
+
latest: T;
|
|
259
|
+
(): T;
|
|
291
260
|
}
|
|
292
261
|
interface Errored {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
262
|
+
state: "errored";
|
|
263
|
+
loading: false;
|
|
264
|
+
error: any;
|
|
265
|
+
latest: never;
|
|
266
|
+
(): never;
|
|
298
267
|
}
|
|
299
268
|
export type Resource<T> = Unresolved | Pending | Ready<T> | Refreshing<T> | Errored;
|
|
300
269
|
export type InitializedResource<T> = Ready<T> | Refreshing<T> | Errored;
|
|
301
270
|
export type ResourceActions<T, R = unknown> = {
|
|
302
|
-
|
|
303
|
-
|
|
271
|
+
mutate: Setter<T>;
|
|
272
|
+
refetch: (info?: R) => T | Promise<T> | undefined | null;
|
|
304
273
|
};
|
|
305
274
|
export type ResourceSource<S> = S | false | null | undefined | (() => S | false | null | undefined);
|
|
306
|
-
export type ResourceFetcher<S, T, R = unknown> = (
|
|
307
|
-
k: S,
|
|
308
|
-
info: ResourceFetcherInfo<T, R>
|
|
309
|
-
) => T | Promise<T>;
|
|
275
|
+
export type ResourceFetcher<S, T, R = unknown> = (k: S, info: ResourceFetcherInfo<T, R>) => T | Promise<T>;
|
|
310
276
|
export type ResourceFetcherInfo<T, R = unknown> = {
|
|
311
|
-
|
|
312
|
-
|
|
277
|
+
value: T | undefined;
|
|
278
|
+
refetching: R | boolean;
|
|
313
279
|
};
|
|
314
280
|
export type ResourceOptions<T, S = unknown> = {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
value: T | undefined;
|
|
324
|
-
}
|
|
325
|
-
) => void;
|
|
281
|
+
initialValue?: T;
|
|
282
|
+
name?: string;
|
|
283
|
+
deferStream?: boolean;
|
|
284
|
+
ssrLoadFrom?: "initial" | "server";
|
|
285
|
+
storage?: (init: T | undefined) => [Accessor<T | undefined>, Setter<T | undefined>];
|
|
286
|
+
onHydrated?: (k: S | undefined, info: {
|
|
287
|
+
value: T | undefined;
|
|
288
|
+
}) => void;
|
|
326
289
|
};
|
|
327
290
|
export type InitializedResourceOptions<T, S = unknown> = ResourceOptions<T, S> & {
|
|
328
|
-
|
|
291
|
+
initialValue: T;
|
|
329
292
|
};
|
|
330
293
|
export type ResourceReturn<T, R = unknown> = [Resource<T>, ResourceActions<T | undefined, R>];
|
|
331
294
|
export type InitializedResourceReturn<T, R = unknown> = [
|
|
332
|
-
|
|
333
|
-
|
|
295
|
+
InitializedResource<T>,
|
|
296
|
+
ResourceActions<T, R>
|
|
334
297
|
];
|
|
335
298
|
/**
|
|
336
299
|
* Creates a resource that wraps a repeated promise in a reactive pattern:
|
|
@@ -358,30 +321,16 @@ export type InitializedResourceReturn<T, R = unknown> = [
|
|
|
358
321
|
* * `mutate` allows to manually overwrite the resource without calling the fetcher
|
|
359
322
|
* * `refetch` will re-run the fetcher without changing the source, and if called with a value, that value will be passed to the fetcher via the `refetching` property on the fetcher's second parameter
|
|
360
323
|
*
|
|
361
|
-
* @description https://
|
|
324
|
+
* @description https://docs.solidjs.com/reference/basic-reactivity/create-resource
|
|
362
325
|
*/
|
|
363
|
-
export declare function createResource<T, R = unknown>(
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
):
|
|
367
|
-
export declare function createResource<T, R = unknown>(
|
|
368
|
-
fetcher: ResourceFetcher<true, T, R>,
|
|
369
|
-
options?: ResourceOptions<NoInfer<T>, true>
|
|
370
|
-
): ResourceReturn<T, R>;
|
|
371
|
-
export declare function createResource<T, S, R = unknown>(
|
|
372
|
-
source: ResourceSource<S>,
|
|
373
|
-
fetcher: ResourceFetcher<S, T, R>,
|
|
374
|
-
options: InitializedResourceOptions<NoInfer<T>, S>
|
|
375
|
-
): InitializedResourceReturn<T, R>;
|
|
376
|
-
export declare function createResource<T, S, R = unknown>(
|
|
377
|
-
source: ResourceSource<S>,
|
|
378
|
-
fetcher: ResourceFetcher<S, T, R>,
|
|
379
|
-
options?: ResourceOptions<NoInfer<T>, S>
|
|
380
|
-
): ResourceReturn<T, R>;
|
|
326
|
+
export declare function createResource<T, R = unknown>(fetcher: ResourceFetcher<true, T, R>, options: InitializedResourceOptions<NoInfer<T>, true>): InitializedResourceReturn<T, R>;
|
|
327
|
+
export declare function createResource<T, R = unknown>(fetcher: ResourceFetcher<true, T, R>, options?: ResourceOptions<NoInfer<T>, true>): ResourceReturn<T, R>;
|
|
328
|
+
export declare function createResource<T, S, R = unknown>(source: ResourceSource<S>, fetcher: ResourceFetcher<S, T, R>, options: InitializedResourceOptions<NoInfer<T>, S>): InitializedResourceReturn<T, R>;
|
|
329
|
+
export declare function createResource<T, S, R = unknown>(source: ResourceSource<S>, fetcher: ResourceFetcher<S, T, R>, options?: ResourceOptions<NoInfer<T>, S>): ResourceReturn<T, R>;
|
|
381
330
|
export interface DeferredOptions<T> {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
331
|
+
equals?: false | ((prev: T, next: T) => boolean);
|
|
332
|
+
name?: string;
|
|
333
|
+
timeoutMs?: number;
|
|
385
334
|
}
|
|
386
335
|
/**
|
|
387
336
|
* Creates a reactive computation that only runs and notifies the reactive context when the browser is idle
|
|
@@ -394,12 +343,9 @@ export interface DeferredOptions<T> {
|
|
|
394
343
|
* @param fn a function that receives its previous or the initial value, if set, and returns a new value used to react on a computation
|
|
395
344
|
* @param options allows to set the timeout in milliseconds, use a custom comparison function and set a name in dev mode for debugging purposes
|
|
396
345
|
*
|
|
397
|
-
* @description https://
|
|
346
|
+
* @description https://docs.solidjs.com/reference/secondary-primitives/create-deferred
|
|
398
347
|
*/
|
|
399
|
-
export declare function createDeferred<T>(
|
|
400
|
-
source: Accessor<T>,
|
|
401
|
-
options?: DeferredOptions<T>
|
|
402
|
-
): Accessor<T>;
|
|
348
|
+
export declare function createDeferred<T>(source: Accessor<T>, options?: DeferredOptions<T>): Accessor<T>;
|
|
403
349
|
export type EqualityCheckerFunction<T, U> = (a: U, b: T) => boolean;
|
|
404
350
|
/**
|
|
405
351
|
* Creates a conditional signal that only notifies subscribers when entering or exiting their key matching the value
|
|
@@ -423,19 +369,15 @@ export type EqualityCheckerFunction<T, U> = (a: U, b: T) => boolean;
|
|
|
423
369
|
*
|
|
424
370
|
* This makes the operation O(2) instead of O(n).
|
|
425
371
|
*
|
|
426
|
-
* @description https://
|
|
372
|
+
* @description https://docs.solidjs.com/reference/secondary-primitives/create-selector
|
|
427
373
|
*/
|
|
428
|
-
export declare function createSelector<T, U = T>(
|
|
429
|
-
source: Accessor<T>,
|
|
430
|
-
fn?: EqualityCheckerFunction<T, U>,
|
|
431
|
-
options?: BaseOptions
|
|
432
|
-
): (key: U) => boolean;
|
|
374
|
+
export declare function createSelector<T, U = T>(source: Accessor<T>, fn?: EqualityCheckerFunction<T, U>, options?: BaseOptions): (key: U) => boolean;
|
|
433
375
|
/**
|
|
434
376
|
* Holds changes inside the block before the reactive context is updated
|
|
435
377
|
* @param fn wraps the reactive updates that should be batched
|
|
436
378
|
* @returns the return value from `fn`
|
|
437
379
|
*
|
|
438
|
-
* @description https://
|
|
380
|
+
* @description https://docs.solidjs.com/reference/reactive-utilities/batch
|
|
439
381
|
*/
|
|
440
382
|
export declare function batch<T>(fn: Accessor<T>): T;
|
|
441
383
|
/**
|
|
@@ -443,32 +385,19 @@ export declare function batch<T>(fn: Accessor<T>): T;
|
|
|
443
385
|
* @param fn the scope that is out of the tracking context
|
|
444
386
|
* @returns the return value of `fn`
|
|
445
387
|
*
|
|
446
|
-
* @description https://
|
|
388
|
+
* @description https://docs.solidjs.com/reference/reactive-utilities/untrack
|
|
447
389
|
*/
|
|
448
390
|
export declare function untrack<T>(fn: Accessor<T>): T;
|
|
449
391
|
/** @deprecated */
|
|
450
|
-
export type ReturnTypes<T> = T extends readonly Accessor<unknown>[]
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
export type AccessorArray<T> = [
|
|
458
|
-
...Extract<
|
|
459
|
-
{
|
|
460
|
-
[K in keyof T]: Accessor<T[K]>;
|
|
461
|
-
},
|
|
462
|
-
readonly unknown[]
|
|
463
|
-
>
|
|
464
|
-
];
|
|
465
|
-
export type OnEffectFunction<S, Prev, Next extends Prev = Prev> = (
|
|
466
|
-
input: S,
|
|
467
|
-
prevInput: S | undefined,
|
|
468
|
-
prev: Prev
|
|
469
|
-
) => Next;
|
|
392
|
+
export type ReturnTypes<T> = T extends readonly Accessor<unknown>[] ? {
|
|
393
|
+
[K in keyof T]: T[K] extends Accessor<infer I> ? I : never;
|
|
394
|
+
} : T extends Accessor<infer I> ? I : never;
|
|
395
|
+
export type AccessorArray<T> = [...Extract<{
|
|
396
|
+
[K in keyof T]: Accessor<T[K]>;
|
|
397
|
+
}, readonly unknown[]>];
|
|
398
|
+
export type OnEffectFunction<S, Prev, Next extends Prev = Prev> = (input: S, prevInput: S | undefined, prev: Prev) => Next;
|
|
470
399
|
export interface OnOptions {
|
|
471
|
-
|
|
400
|
+
defer?: boolean;
|
|
472
401
|
}
|
|
473
402
|
/**
|
|
474
403
|
* Makes dependencies of a computation explicit
|
|
@@ -494,29 +423,19 @@ export interface OnOptions {
|
|
|
494
423
|
* });
|
|
495
424
|
* ```
|
|
496
425
|
*
|
|
497
|
-
* @description https://
|
|
426
|
+
* @description https://docs.solidjs.com/reference/jsx-attributes/on_
|
|
498
427
|
*/
|
|
499
|
-
export declare function on<S, Next extends Prev, Prev = Next>(
|
|
500
|
-
deps: AccessorArray<S> | Accessor<S>,
|
|
501
|
-
fn: OnEffectFunction<S, undefined | NoInfer<Prev>, Next>,
|
|
502
|
-
options?: OnOptions & {
|
|
428
|
+
export declare function on<S, Next extends Prev, Prev = Next>(deps: AccessorArray<S> | Accessor<S>, fn: OnEffectFunction<S, undefined | NoInfer<Prev>, Next>, options?: OnOptions & {
|
|
503
429
|
defer?: false;
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
fn: OnEffectFunction<S, undefined | NoInfer<Prev>, Next>,
|
|
509
|
-
options:
|
|
510
|
-
| OnOptions
|
|
511
|
-
| {
|
|
512
|
-
defer: true;
|
|
513
|
-
}
|
|
514
|
-
): EffectFunction<undefined | NoInfer<Next>>;
|
|
430
|
+
}): EffectFunction<undefined | NoInfer<Next>, NoInfer<Next>>;
|
|
431
|
+
export declare function on<S, Next extends Prev, Prev = Next>(deps: AccessorArray<S> | Accessor<S>, fn: OnEffectFunction<S, undefined | NoInfer<Prev>, Next>, options: OnOptions | {
|
|
432
|
+
defer: true;
|
|
433
|
+
}): EffectFunction<undefined | NoInfer<Next>>;
|
|
515
434
|
/**
|
|
516
435
|
* Runs an effect only after initial render on mount
|
|
517
436
|
* @param fn an effect that should run only once on mount
|
|
518
437
|
*
|
|
519
|
-
* @description https://
|
|
438
|
+
* @description https://docs.solidjs.com/reference/lifecycle/on-mount
|
|
520
439
|
*/
|
|
521
440
|
export declare function onMount(fn: () => void): void;
|
|
522
441
|
/**
|
|
@@ -525,7 +444,7 @@ export declare function onMount(fn: () => void): void;
|
|
|
525
444
|
*
|
|
526
445
|
* @returns the same {@link fn} function that was passed in
|
|
527
446
|
*
|
|
528
|
-
* @description https://
|
|
447
|
+
* @description https://docs.solidjs.com/reference/lifecycle/on-cleanup
|
|
529
448
|
*/
|
|
530
449
|
export declare function onCleanup<T extends () => any>(fn: T): T;
|
|
531
450
|
/**
|
|
@@ -535,7 +454,7 @@ export declare function onCleanup<T extends () => any>(fn: T): T;
|
|
|
535
454
|
*
|
|
536
455
|
* * If the error is thrown again inside the error handler, it will trigger the next available parent handler
|
|
537
456
|
*
|
|
538
|
-
* @description https://
|
|
457
|
+
* @description https://docs.solidjs.com/reference/reactive-utilities/catch-error
|
|
539
458
|
*/
|
|
540
459
|
export declare function catchError<T>(fn: () => T, handler: (err: Error) => void): T | undefined;
|
|
541
460
|
export declare function getListener(): Computation<any, any> | null;
|
|
@@ -547,7 +466,7 @@ export declare function enableScheduling(scheduler?: typeof requestCallback): vo
|
|
|
547
466
|
* export function startTransition(fn: () => void) => Promise<void>
|
|
548
467
|
* ```
|
|
549
468
|
*
|
|
550
|
-
* @description https://
|
|
469
|
+
* @description https://docs.solidjs.com/reference/reactive-utilities/start-transition
|
|
551
470
|
*/
|
|
552
471
|
export declare function startTransition(fn: () => unknown): Promise<void>;
|
|
553
472
|
export type Transition = [Accessor<boolean>, (fn: () => void) => Promise<void>];
|
|
@@ -559,24 +478,24 @@ export type Transition = [Accessor<boolean>, (fn: () => void) => Promise<void>];
|
|
|
559
478
|
* ];
|
|
560
479
|
* @returns a tuple; first value is an accessor if the transition is pending and a callback to start the transition
|
|
561
480
|
*
|
|
562
|
-
* @description https://
|
|
481
|
+
* @description https://docs.solidjs.com/reference/reactive-utilities/use-transition
|
|
563
482
|
*/
|
|
564
483
|
export declare function useTransition(): Transition;
|
|
565
484
|
export declare function resumeEffects(e: Computation<any>[]): void;
|
|
566
485
|
export interface DevComponent<T> extends Memo<unknown> {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
486
|
+
props: T;
|
|
487
|
+
name: string;
|
|
488
|
+
component: (props: T) => unknown;
|
|
570
489
|
}
|
|
571
490
|
export declare function devComponent<P, V>(Comp: (props: P) => V, props: P): V;
|
|
572
491
|
export declare function registerGraph(value: SourceMapValue): void;
|
|
573
492
|
export type ContextProviderComponent<T> = FlowComponent<{
|
|
574
|
-
|
|
493
|
+
value: T;
|
|
575
494
|
}>;
|
|
576
495
|
export interface Context<T> {
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
496
|
+
id: symbol;
|
|
497
|
+
Provider: ContextProviderComponent<T>;
|
|
498
|
+
defaultValue: T;
|
|
580
499
|
}
|
|
581
500
|
/**
|
|
582
501
|
* Creates a Context to handle a state scoped for the children of a component
|
|
@@ -595,12 +514,9 @@ export interface Context<T> {
|
|
|
595
514
|
* @param options allows to set a name in dev mode for debugging purposes
|
|
596
515
|
* @returns The context that contains the Provider Component and that can be used with `useContext`
|
|
597
516
|
*
|
|
598
|
-
* @description https://
|
|
517
|
+
* @description https://docs.solidjs.com/reference/component-apis/create-context
|
|
599
518
|
*/
|
|
600
|
-
export declare function createContext<T>(
|
|
601
|
-
defaultValue?: undefined,
|
|
602
|
-
options?: EffectOptions
|
|
603
|
-
): Context<T | undefined>;
|
|
519
|
+
export declare function createContext<T>(defaultValue?: undefined, options?: EffectOptions): Context<T | undefined>;
|
|
604
520
|
export declare function createContext<T>(defaultValue: T, options?: EffectOptions): Context<T>;
|
|
605
521
|
/**
|
|
606
522
|
* Uses a context to receive a scoped state from a parent's Context.Provider
|
|
@@ -608,13 +524,13 @@ export declare function createContext<T>(defaultValue: T, options?: EffectOption
|
|
|
608
524
|
* @param context Context object made by `createContext`
|
|
609
525
|
* @returns the current or `defaultValue`, if present
|
|
610
526
|
*
|
|
611
|
-
* @description https://
|
|
527
|
+
* @description https://docs.solidjs.com/reference/component-apis/use-context
|
|
612
528
|
*/
|
|
613
529
|
export declare function useContext<T>(context: Context<T>): T;
|
|
614
530
|
export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement>;
|
|
615
531
|
export type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
|
|
616
532
|
export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
617
|
-
|
|
533
|
+
toArray: () => ResolvedJSXElement[];
|
|
618
534
|
};
|
|
619
535
|
/**
|
|
620
536
|
* Resolves child elements to help interact with children
|
|
@@ -622,33 +538,26 @@ export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
|
622
538
|
* @param fn an accessor for the children
|
|
623
539
|
* @returns a accessor of the same children, but resolved
|
|
624
540
|
*
|
|
625
|
-
* @description https://
|
|
541
|
+
* @description https://docs.solidjs.com/reference/component-apis/children
|
|
626
542
|
*/
|
|
627
543
|
export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn;
|
|
628
544
|
export type SuspenseContextType = {
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
545
|
+
increment?: () => void;
|
|
546
|
+
decrement?: () => void;
|
|
547
|
+
inFallback?: () => boolean;
|
|
548
|
+
effects?: Computation<any>[];
|
|
549
|
+
resolved?: boolean;
|
|
634
550
|
};
|
|
635
551
|
type SuspenseContext = Context<SuspenseContextType | undefined> & {
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
552
|
+
active?(): boolean;
|
|
553
|
+
increment?(): void;
|
|
554
|
+
decrement?(): void;
|
|
639
555
|
};
|
|
640
556
|
declare let SuspenseContext: SuspenseContext;
|
|
641
557
|
export declare function getSuspenseContext(): SuspenseContext;
|
|
642
|
-
export declare function enableExternalSource(
|
|
643
|
-
factory: ExternalSourceFactory,
|
|
644
|
-
untrack?: <V>(fn: () => V) => V
|
|
645
|
-
): void;
|
|
558
|
+
export declare function enableExternalSource(factory: ExternalSourceFactory, untrack?: <V>(fn: () => V) => V): void;
|
|
646
559
|
export declare function readSignal(this: SignalState<any> | Memo<any>): any;
|
|
647
|
-
export declare function writeSignal(
|
|
648
|
-
node: SignalState<any> | Memo<any>,
|
|
649
|
-
value: any,
|
|
650
|
-
isComp?: boolean
|
|
651
|
-
): any;
|
|
560
|
+
export declare function writeSignal(node: SignalState<any> | Memo<any>, value: any, isComp?: boolean): any;
|
|
652
561
|
/**
|
|
653
562
|
* @deprecated since version 1.7.0 and will be removed in next major - use catchError instead
|
|
654
563
|
* onError - run an effect whenever an error is thrown within the context of the child scopes
|
|
@@ -656,7 +565,7 @@ export declare function writeSignal(
|
|
|
656
565
|
*
|
|
657
566
|
* * If the error is thrown again inside the error handler, it will trigger the next available parent handler
|
|
658
567
|
*
|
|
659
|
-
* @description https://www.solidjs.com/docs/latest/api#onerror
|
|
568
|
+
* @description https://www.solidjs.com/docs/latest/api#onerror | https://docs.solidjs.com/reference/reactive-utilities/catch-error
|
|
660
569
|
*/
|
|
661
570
|
export declare function onError(fn: (err: Error) => void): void;
|
|
662
571
|
export {};
|