solid-js 1.7.8 → 1.7.10
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 +35 -19
- package/dist/dev.js +558 -309
- package/dist/server.cjs +38 -23
- package/dist/server.js +202 -94
- package/dist/solid.cjs +35 -19
- package/dist/solid.js +485 -267
- package/h/dist/h.cjs +2 -2
- package/h/dist/h.js +36 -10
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +11 -8
- package/h/jsx-runtime/types/jsx.d.ts +3 -0
- package/h/types/hyperscript.d.ts +11 -11
- package/h/types/index.d.ts +3 -2
- package/html/dist/html.cjs +2 -2
- package/html/dist/html.js +218 -96
- package/html/types/index.d.ts +3 -2
- package/html/types/lit.d.ts +45 -31
- package/package.json +1 -1
- package/store/dist/dev.cjs +36 -33
- package/store/dist/dev.js +143 -68
- package/store/dist/server.js +19 -8
- package/store/dist/store.cjs +36 -33
- package/store/dist/store.js +134 -65
- package/store/types/index.d.ts +21 -7
- package/store/types/modifiers.d.ts +6 -3
- package/store/types/mutable.d.ts +5 -2
- package/store/types/server.d.ts +12 -4
- package/store/types/store.d.ts +220 -63
- package/types/index.d.ts +72 -9
- package/types/jsx.d.ts +3 -0
- package/types/reactive/array.d.ts +12 -4
- package/types/reactive/observable.d.ts +25 -17
- package/types/reactive/scheduler.d.ts +9 -6
- package/types/reactive/signal.d.ts +237 -146
- package/types/render/Suspense.d.ts +5 -5
- package/types/render/component.d.ts +62 -31
- package/types/render/flow.d.ts +43 -31
- package/types/render/hydration.d.ts +12 -12
- package/types/server/index.d.ts +56 -2
- package/types/server/reactive.d.ts +71 -45
- package/types/server/rendering.d.ts +171 -95
- package/universal/dist/dev.js +28 -12
- package/universal/dist/universal.js +28 -12
- package/universal/types/index.d.ts +3 -1
- package/universal/types/universal.d.ts +0 -1
- package/web/dist/dev.js +610 -79
- package/web/dist/server.cjs +5 -1
- package/web/dist/server.js +181 -78
- package/web/dist/web.js +610 -79
- package/web/types/client.d.ts +2 -2
- package/web/types/core.d.ts +10 -1
- package/web/types/index.d.ts +27 -10
- package/web/types/server-mock.d.ts +47 -32
- package/web/types/server.d.ts +1 -1
|
@@ -33,57 +33,60 @@ export declare let Transition: TransitionState | null;
|
|
|
33
33
|
declare let ExternalSourceFactory: ExternalSourceFactory | null;
|
|
34
34
|
/** Object storing callbacks for debugging during development */
|
|
35
35
|
export declare const DevHooks: {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
afterUpdate: (() => void) | null;
|
|
37
|
+
afterCreateOwner: ((owner: Owner) => 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>(
|
|
83
|
+
type ExternalSourceFactory = <Prev, Next extends Prev = Prev>(
|
|
84
|
+
fn: EffectFunction<Prev, Next>,
|
|
85
|
+
trigger: () => void
|
|
86
|
+
) => ExternalSource;
|
|
84
87
|
export interface ExternalSource {
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
track: EffectFunction<any, any>;
|
|
89
|
+
dispose: () => void;
|
|
87
90
|
}
|
|
88
91
|
export type RootFunction<T> = (dispose: () => void) => T;
|
|
89
92
|
/**
|
|
@@ -97,10 +100,17 @@ export type RootFunction<T> = (dispose: () => void) => T;
|
|
|
97
100
|
*/
|
|
98
101
|
export declare function createRoot<T>(fn: RootFunction<T>, detachedOwner?: typeof Owner): T;
|
|
99
102
|
export type Accessor<T> = () => T;
|
|
100
|
-
export type Setter<T> =
|
|
103
|
+
export type Setter<in out T> = {
|
|
104
|
+
<U extends T>(...args: undefined extends T ? [] : [value: (prev: T) => U]): undefined extends T
|
|
105
|
+
? undefined
|
|
106
|
+
: U;
|
|
107
|
+
<U extends T>(value: (prev: T) => U): U;
|
|
108
|
+
<U extends T>(value: Exclude<U, Function>): U;
|
|
109
|
+
<U extends T>(value: Exclude<U, Function> | ((prev: T) => U)): U;
|
|
110
|
+
};
|
|
101
111
|
export type Signal<T> = [get: Accessor<T>, set: Setter<T>];
|
|
102
112
|
export interface SignalOptions<T> extends MemoOptions<T> {
|
|
103
|
-
|
|
113
|
+
internal?: boolean;
|
|
104
114
|
}
|
|
105
115
|
/**
|
|
106
116
|
* Creates a simple reactive state with a getter and setter
|
|
@@ -128,11 +138,10 @@ export interface SignalOptions<T> extends MemoOptions<T> {
|
|
|
128
138
|
export declare function createSignal<T>(): Signal<T | undefined>;
|
|
129
139
|
export declare function createSignal<T>(value: T, options?: SignalOptions<T>): Signal<T>;
|
|
130
140
|
export interface BaseOptions {
|
|
131
|
-
|
|
141
|
+
name?: string;
|
|
132
142
|
}
|
|
133
143
|
export type NoInfer<T extends any> = [T][T extends any ? 0 : never];
|
|
134
|
-
export interface EffectOptions extends BaseOptions {
|
|
135
|
-
}
|
|
144
|
+
export interface EffectOptions extends BaseOptions {}
|
|
136
145
|
export type EffectFunction<Prev, Next extends Prev = Prev> = (v: Prev) => Next;
|
|
137
146
|
/**
|
|
138
147
|
* Creates a reactive computation that runs immediately before render, mainly used to write to other reactive primitives
|
|
@@ -149,8 +158,14 @@ export type EffectFunction<Prev, Next extends Prev = Prev> = (v: Prev) => Next;
|
|
|
149
158
|
*
|
|
150
159
|
* @description https://www.solidjs.com/docs/latest/api#createcomputed
|
|
151
160
|
*/
|
|
152
|
-
export declare function createComputed<Next>(
|
|
153
|
-
|
|
161
|
+
export declare function createComputed<Next>(
|
|
162
|
+
fn: EffectFunction<undefined | NoInfer<Next>, Next>
|
|
163
|
+
): void;
|
|
164
|
+
export declare function createComputed<Next, Init = Next>(
|
|
165
|
+
fn: EffectFunction<Init | Next, Next>,
|
|
166
|
+
value: Init,
|
|
167
|
+
options?: EffectOptions
|
|
168
|
+
): void;
|
|
154
169
|
/**
|
|
155
170
|
* Creates a reactive computation that runs during the render phase as DOM elements are created and updated but not necessarily connected
|
|
156
171
|
* ```typescript
|
|
@@ -166,8 +181,14 @@ export declare function createComputed<Next, Init = Next>(fn: EffectFunction<Ini
|
|
|
166
181
|
*
|
|
167
182
|
* @description https://www.solidjs.com/docs/latest/api#createrendereffect
|
|
168
183
|
*/
|
|
169
|
-
export declare function createRenderEffect<Next>(
|
|
170
|
-
|
|
184
|
+
export declare function createRenderEffect<Next>(
|
|
185
|
+
fn: EffectFunction<undefined | NoInfer<Next>, Next>
|
|
186
|
+
): void;
|
|
187
|
+
export declare function createRenderEffect<Next, Init = Next>(
|
|
188
|
+
fn: EffectFunction<Init | Next, Next>,
|
|
189
|
+
value: Init,
|
|
190
|
+
options?: EffectOptions
|
|
191
|
+
): void;
|
|
171
192
|
/**
|
|
172
193
|
* Creates a reactive computation that runs after the render phase
|
|
173
194
|
* ```typescript
|
|
@@ -183,10 +204,16 @@ export declare function createRenderEffect<Next, Init = Next>(fn: EffectFunction
|
|
|
183
204
|
*
|
|
184
205
|
* @description https://www.solidjs.com/docs/latest/api#createeffect
|
|
185
206
|
*/
|
|
186
|
-
export declare function createEffect<Next>(
|
|
187
|
-
|
|
207
|
+
export declare function createEffect<Next>(
|
|
208
|
+
fn: EffectFunction<undefined | NoInfer<Next>, Next>
|
|
209
|
+
): void;
|
|
210
|
+
export declare function createEffect<Next, Init = Next>(
|
|
211
|
+
fn: EffectFunction<Init | Next, Next>,
|
|
212
|
+
value: Init,
|
|
213
|
+
options?: EffectOptions & {
|
|
188
214
|
render?: boolean;
|
|
189
|
-
}
|
|
215
|
+
}
|
|
216
|
+
): void;
|
|
190
217
|
/**
|
|
191
218
|
* Creates a reactive computation that runs after the render phase with flexible tracking
|
|
192
219
|
* ```typescript
|
|
@@ -200,13 +227,16 @@ export declare function createEffect<Next, Init = Next>(fn: EffectFunction<Init
|
|
|
200
227
|
*
|
|
201
228
|
* @description https://www.solidjs.com/docs/latest/api#createreaction
|
|
202
229
|
*/
|
|
203
|
-
export declare function createReaction(
|
|
230
|
+
export declare function createReaction(
|
|
231
|
+
onInvalidate: () => void,
|
|
232
|
+
options?: EffectOptions
|
|
233
|
+
): (tracking: () => void) => void;
|
|
204
234
|
export interface Memo<Prev, Next = Prev> extends SignalState<Next>, Computation<Next> {
|
|
205
|
-
|
|
206
|
-
|
|
235
|
+
value: Next;
|
|
236
|
+
tOwned?: Computation<Prev | Next, Next>[];
|
|
207
237
|
}
|
|
208
238
|
export interface MemoOptions<T> extends EffectOptions {
|
|
209
|
-
|
|
239
|
+
equals?: false | ((prev: T, next: T) => boolean);
|
|
210
240
|
}
|
|
211
241
|
/**
|
|
212
242
|
* Creates a readonly derived reactive memoized signal
|
|
@@ -223,72 +253,84 @@ export interface MemoOptions<T> extends EffectOptions {
|
|
|
223
253
|
*
|
|
224
254
|
* @description https://www.solidjs.com/docs/latest/api#creatememo
|
|
225
255
|
*/
|
|
226
|
-
export declare function createMemo<Next extends Prev, Prev = Next>(
|
|
227
|
-
|
|
256
|
+
export declare function createMemo<Next extends Prev, Prev = Next>(
|
|
257
|
+
fn: EffectFunction<undefined | NoInfer<Prev>, Next>
|
|
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>;
|
|
228
264
|
interface Unresolved {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
265
|
+
state: "unresolved";
|
|
266
|
+
loading: false;
|
|
267
|
+
error: undefined;
|
|
268
|
+
latest: undefined;
|
|
269
|
+
(): undefined;
|
|
234
270
|
}
|
|
235
271
|
interface Pending {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
272
|
+
state: "pending";
|
|
273
|
+
loading: true;
|
|
274
|
+
error: undefined;
|
|
275
|
+
latest: undefined;
|
|
276
|
+
(): undefined;
|
|
241
277
|
}
|
|
242
278
|
interface Ready<T> {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
279
|
+
state: "ready";
|
|
280
|
+
loading: false;
|
|
281
|
+
error: undefined;
|
|
282
|
+
latest: T;
|
|
283
|
+
(): T;
|
|
248
284
|
}
|
|
249
285
|
interface Refreshing<T> {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
286
|
+
state: "refreshing";
|
|
287
|
+
loading: true;
|
|
288
|
+
error: undefined;
|
|
289
|
+
latest: T;
|
|
290
|
+
(): T;
|
|
255
291
|
}
|
|
256
292
|
interface Errored {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
293
|
+
state: "errored";
|
|
294
|
+
loading: false;
|
|
295
|
+
error: any;
|
|
296
|
+
latest: never;
|
|
297
|
+
(): never;
|
|
262
298
|
}
|
|
263
299
|
export type Resource<T> = Unresolved | Pending | Ready<T> | Refreshing<T> | Errored;
|
|
264
300
|
export type InitializedResource<T> = Ready<T> | Refreshing<T> | Errored;
|
|
265
301
|
export type ResourceActions<T, R = unknown> = {
|
|
266
|
-
|
|
267
|
-
|
|
302
|
+
mutate: Setter<T>;
|
|
303
|
+
refetch: (info?: R) => T | Promise<T> | undefined | null;
|
|
268
304
|
};
|
|
269
305
|
export type ResourceSource<S> = S | false | null | undefined | (() => S | false | null | undefined);
|
|
270
|
-
export type ResourceFetcher<S, T, R = unknown> = (
|
|
306
|
+
export type ResourceFetcher<S, T, R = unknown> = (
|
|
307
|
+
k: S,
|
|
308
|
+
info: ResourceFetcherInfo<T, R>
|
|
309
|
+
) => T | Promise<T>;
|
|
271
310
|
export type ResourceFetcherInfo<T, R = unknown> = {
|
|
272
|
-
|
|
273
|
-
|
|
311
|
+
value: T | undefined;
|
|
312
|
+
refetching: R | boolean;
|
|
274
313
|
};
|
|
275
314
|
export type ResourceOptions<T, S = unknown> = {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
315
|
+
initialValue?: T;
|
|
316
|
+
name?: string;
|
|
317
|
+
deferStream?: boolean;
|
|
318
|
+
ssrLoadFrom?: "initial" | "server";
|
|
319
|
+
storage?: (init: T | undefined) => [Accessor<T | undefined>, Setter<T | undefined>];
|
|
320
|
+
onHydrated?: (
|
|
321
|
+
k: S | undefined,
|
|
322
|
+
info: {
|
|
323
|
+
value: T | undefined;
|
|
324
|
+
}
|
|
325
|
+
) => void;
|
|
284
326
|
};
|
|
285
327
|
export type InitializedResourceOptions<T, S = unknown> = ResourceOptions<T, S> & {
|
|
286
|
-
|
|
328
|
+
initialValue: T;
|
|
287
329
|
};
|
|
288
330
|
export type ResourceReturn<T, R = unknown> = [Resource<T>, ResourceActions<T | undefined, R>];
|
|
289
331
|
export type InitializedResourceReturn<T, R = unknown> = [
|
|
290
|
-
|
|
291
|
-
|
|
332
|
+
InitializedResource<T>,
|
|
333
|
+
ResourceActions<T, R>
|
|
292
334
|
];
|
|
293
335
|
/**
|
|
294
336
|
* Creates a resource that wraps a repeated promise in a reactive pattern:
|
|
@@ -318,14 +360,28 @@ export type InitializedResourceReturn<T, R = unknown> = [
|
|
|
318
360
|
*
|
|
319
361
|
* @description https://www.solidjs.com/docs/latest/api#createresource
|
|
320
362
|
*/
|
|
321
|
-
export declare function createResource<T, R = unknown>(
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
363
|
+
export declare function createResource<T, R = unknown>(
|
|
364
|
+
fetcher: ResourceFetcher<true, T, R>,
|
|
365
|
+
options: InitializedResourceOptions<NoInfer<T>, true>
|
|
366
|
+
): InitializedResourceReturn<T, R>;
|
|
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>;
|
|
325
381
|
export interface DeferredOptions<T> {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
382
|
+
equals?: false | ((prev: T, next: T) => boolean);
|
|
383
|
+
name?: string;
|
|
384
|
+
timeoutMs?: number;
|
|
329
385
|
}
|
|
330
386
|
/**
|
|
331
387
|
* Creates a reactive computation that only runs and notifies the reactive context when the browser is idle
|
|
@@ -340,7 +396,10 @@ export interface DeferredOptions<T> {
|
|
|
340
396
|
*
|
|
341
397
|
* @description https://www.solidjs.com/docs/latest/api#createdeferred
|
|
342
398
|
*/
|
|
343
|
-
export declare function createDeferred<T>(
|
|
399
|
+
export declare function createDeferred<T>(
|
|
400
|
+
source: Accessor<T>,
|
|
401
|
+
options?: DeferredOptions<T>
|
|
402
|
+
): Accessor<T>;
|
|
344
403
|
export type EqualityCheckerFunction<T, U> = (a: U, b: T) => boolean;
|
|
345
404
|
/**
|
|
346
405
|
* Creates a conditional signal that only notifies subscribers when entering or exiting their key matching the value
|
|
@@ -366,7 +425,11 @@ export type EqualityCheckerFunction<T, U> = (a: U, b: T) => boolean;
|
|
|
366
425
|
*
|
|
367
426
|
* @description https://www.solidjs.com/docs/latest/api#createselector
|
|
368
427
|
*/
|
|
369
|
-
export declare function createSelector<T, U = T>(
|
|
428
|
+
export declare function createSelector<T, U = T>(
|
|
429
|
+
source: Accessor<T>,
|
|
430
|
+
fn?: EqualityCheckerFunction<T, U>,
|
|
431
|
+
options?: BaseOptions
|
|
432
|
+
): (key: U) => boolean;
|
|
370
433
|
/**
|
|
371
434
|
* Holds changes inside the block before the reactive context is updated
|
|
372
435
|
* @param fn wraps the reactive updates that should be batched
|
|
@@ -384,15 +447,28 @@ export declare function batch<T>(fn: Accessor<T>): T;
|
|
|
384
447
|
*/
|
|
385
448
|
export declare function untrack<T>(fn: Accessor<T>): T;
|
|
386
449
|
/** @deprecated */
|
|
387
|
-
export type ReturnTypes<T> = T extends readonly Accessor<unknown>[]
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
450
|
+
export type ReturnTypes<T> = T extends readonly Accessor<unknown>[]
|
|
451
|
+
? {
|
|
452
|
+
[K in keyof T]: T[K] extends Accessor<infer I> ? I : never;
|
|
453
|
+
}
|
|
454
|
+
: T extends Accessor<infer I>
|
|
455
|
+
? I
|
|
456
|
+
: never;
|
|
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;
|
|
394
470
|
export interface OnOptions {
|
|
395
|
-
|
|
471
|
+
defer?: boolean;
|
|
396
472
|
}
|
|
397
473
|
/**
|
|
398
474
|
* on - make dependencies of a computation explicit
|
|
@@ -420,12 +496,20 @@ export interface OnOptions {
|
|
|
420
496
|
*
|
|
421
497
|
* @description https://www.solidjs.com/docs/latest/api#on
|
|
422
498
|
*/
|
|
423
|
-
export declare function on<S, Next extends Prev, Prev = Next>(
|
|
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 & {
|
|
424
503
|
defer?: false;
|
|
425
|
-
}
|
|
426
|
-
|
|
504
|
+
}
|
|
505
|
+
): EffectFunction<undefined | NoInfer<Next>, NoInfer<Next>>;
|
|
506
|
+
export declare function on<S, Next extends Prev, Prev = Next>(
|
|
507
|
+
deps: AccessorArray<S> | Accessor<S>,
|
|
508
|
+
fn: OnEffectFunction<S, undefined | NoInfer<Prev>, Next>,
|
|
509
|
+
options: OnOptions & {
|
|
427
510
|
defer: true;
|
|
428
|
-
}
|
|
511
|
+
}
|
|
512
|
+
): EffectFunction<undefined | NoInfer<Next>>;
|
|
429
513
|
/**
|
|
430
514
|
* onMount - run an effect only after initial render on mount
|
|
431
515
|
* @param fn an effect that should run only once on mount
|
|
@@ -452,16 +536,6 @@ export declare function onCleanup<T extends () => any>(fn: T): T;
|
|
|
452
536
|
* @description https://www.solidjs.com/docs/latest/api#catcherror
|
|
453
537
|
*/
|
|
454
538
|
export declare function catchError<T>(fn: () => T, handler: (err: Error) => void): T | undefined;
|
|
455
|
-
/**
|
|
456
|
-
* @deprecated since version 1.7.0 and will be removed in next major - use catchError instead
|
|
457
|
-
* onError - run an effect whenever an error is thrown within the context of the child scopes
|
|
458
|
-
* @param fn an error handler that receives the error
|
|
459
|
-
*
|
|
460
|
-
* * If the error is thrown again inside the error handler, it will trigger the next available parent handler
|
|
461
|
-
*
|
|
462
|
-
* @description https://www.solidjs.com/docs/latest/api#onerror
|
|
463
|
-
*/
|
|
464
|
-
export declare function onError(fn: (err: Error) => void): void;
|
|
465
539
|
export declare function getListener(): Computation<any, any> | null;
|
|
466
540
|
export declare function getOwner(): Owner | null;
|
|
467
541
|
export declare function runWithOwner<T>(o: typeof Owner, fn: () => T): T | undefined;
|
|
@@ -487,19 +561,19 @@ export type Transition = [Accessor<boolean>, (fn: () => void) => Promise<void>];
|
|
|
487
561
|
export declare function useTransition(): Transition;
|
|
488
562
|
export declare function resumeEffects(e: Computation<any>[]): void;
|
|
489
563
|
export interface DevComponent<T> extends Memo<unknown> {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
564
|
+
props: T;
|
|
565
|
+
name: string;
|
|
566
|
+
component: (props: T) => unknown;
|
|
493
567
|
}
|
|
494
568
|
export declare function devComponent<P, V>(Comp: (props: P) => V, props: P): V;
|
|
495
569
|
export declare function registerGraph(value: SourceMapValue): void;
|
|
496
570
|
export type ContextProviderComponent<T> = FlowComponent<{
|
|
497
|
-
|
|
571
|
+
value: T;
|
|
498
572
|
}>;
|
|
499
573
|
export interface Context<T> {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
574
|
+
id: symbol;
|
|
575
|
+
Provider: ContextProviderComponent<T>;
|
|
576
|
+
defaultValue: T;
|
|
503
577
|
}
|
|
504
578
|
/**
|
|
505
579
|
* Creates a Context to handle a state scoped for the children of a component
|
|
@@ -520,7 +594,10 @@ export interface Context<T> {
|
|
|
520
594
|
*
|
|
521
595
|
* @description https://www.solidjs.com/docs/latest/api#createcontext
|
|
522
596
|
*/
|
|
523
|
-
export declare function createContext<T>(
|
|
597
|
+
export declare function createContext<T>(
|
|
598
|
+
defaultValue?: undefined,
|
|
599
|
+
options?: EffectOptions
|
|
600
|
+
): Context<T | undefined>;
|
|
524
601
|
export declare function createContext<T>(defaultValue: T, options?: EffectOptions): Context<T>;
|
|
525
602
|
/**
|
|
526
603
|
* use a context to receive a scoped state from a parent's Context.Provider
|
|
@@ -534,7 +611,7 @@ export declare function useContext<T>(context: Context<T>): T;
|
|
|
534
611
|
export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement>;
|
|
535
612
|
export type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
|
|
536
613
|
export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
537
|
-
|
|
614
|
+
toArray: () => ResolvedJSXElement[];
|
|
538
615
|
};
|
|
539
616
|
/**
|
|
540
617
|
* Resolves child elements to help interact with children
|
|
@@ -546,20 +623,34 @@ export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
|
546
623
|
*/
|
|
547
624
|
export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn;
|
|
548
625
|
export type SuspenseContextType = {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
626
|
+
increment?: () => void;
|
|
627
|
+
decrement?: () => void;
|
|
628
|
+
inFallback?: () => boolean;
|
|
629
|
+
effects?: Computation<any>[];
|
|
630
|
+
resolved?: boolean;
|
|
554
631
|
};
|
|
555
632
|
type SuspenseContext = Context<SuspenseContextType> & {
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
633
|
+
active?(): boolean;
|
|
634
|
+
increment?(): void;
|
|
635
|
+
decrement?(): void;
|
|
559
636
|
};
|
|
560
637
|
declare let SuspenseContext: SuspenseContext;
|
|
561
638
|
export declare function getSuspenseContext(): SuspenseContext;
|
|
562
639
|
export declare function enableExternalSource(factory: ExternalSourceFactory): void;
|
|
563
640
|
export declare function readSignal(this: SignalState<any> | Memo<any>): any;
|
|
564
|
-
export declare function writeSignal(
|
|
641
|
+
export declare function writeSignal(
|
|
642
|
+
node: SignalState<any> | Memo<any>,
|
|
643
|
+
value: any,
|
|
644
|
+
isComp?: boolean
|
|
645
|
+
): any;
|
|
646
|
+
/**
|
|
647
|
+
* @deprecated since version 1.7.0 and will be removed in next major - use catchError instead
|
|
648
|
+
* onError - run an effect whenever an error is thrown within the context of the child scopes
|
|
649
|
+
* @param fn an error handler that receives the error
|
|
650
|
+
*
|
|
651
|
+
* * If the error is thrown again inside the error handler, it will trigger the next available parent handler
|
|
652
|
+
*
|
|
653
|
+
* @description https://www.solidjs.com/docs/latest/api#onerror
|
|
654
|
+
*/
|
|
655
|
+
export declare function onError(fn: (err: Error) => void): void;
|
|
565
656
|
export {};
|
|
@@ -5,9 +5,9 @@ import type { JSX } from "../jsx.js";
|
|
|
5
5
|
* @description https://www.solidjs.com/docs/latest/api#suspenselist-experimental
|
|
6
6
|
*/
|
|
7
7
|
export declare function SuspenseList(props: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
children: JSX.Element;
|
|
9
|
+
revealOrder: "forwards" | "backwards" | "together";
|
|
10
|
+
tail?: "collapsed" | "hidden";
|
|
11
11
|
}): JSX.Element;
|
|
12
12
|
/**
|
|
13
13
|
* tracks all resources inside a component and renders a fallback until they are all resolved
|
|
@@ -21,6 +21,6 @@ export declare function SuspenseList(props: {
|
|
|
21
21
|
* @description https://www.solidjs.com/docs/latest/api#suspense
|
|
22
22
|
*/
|
|
23
23
|
export declare function Suspense(props: {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
fallback?: JSX.Element;
|
|
25
|
+
children: JSX.Element;
|
|
26
26
|
}): JSX.Element;
|