solid-js 1.8.2 → 1.8.4
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 +1 -1
- package/dist/dev.js +534 -299
- package/dist/server.js +170 -75
- package/dist/solid.cjs +1 -1
- package/dist/solid.js +461 -257
- package/h/dist/h.js +34 -8
- package/h/jsx-runtime/dist/jsx.js +1 -1
- package/h/jsx-runtime/types/index.d.ts +11 -8
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +216 -94
- package/html/types/lit.d.ts +47 -31
- package/package.json +7 -3
- package/store/dist/dev.js +114 -42
- package/store/dist/server.js +19 -8
- package/store/dist/store.js +105 -39
- 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 +218 -61
- package/types/index.d.ts +72 -9
- 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 +228 -140
- 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 +13 -13
- package/types/server/index.d.ts +57 -2
- package/types/server/reactive.d.ts +73 -42
- package/types/server/rendering.d.ts +166 -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.cjs +3 -0
- package/web/dist/dev.js +620 -81
- package/web/dist/server.cjs +17 -5
- package/web/dist/server.js +188 -95
- package/web/dist/storage.cjs +12 -0
- package/web/dist/storage.js +10 -0
- package/web/dist/web.cjs +3 -0
- package/web/dist/web.js +614 -80
- package/web/types/client.d.ts +8 -3
- 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 +10 -1
- package/web/types/storage.d.ts +2 -0
|
@@ -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
|
/**
|
|
@@ -98,14 +101,16 @@ export type RootFunction<T> = (dispose: () => void) => T;
|
|
|
98
101
|
export declare function createRoot<T>(fn: RootFunction<T>, detachedOwner?: typeof Owner): T;
|
|
99
102
|
export type Accessor<T> = () => T;
|
|
100
103
|
export type Setter<in out T> = {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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;
|
|
105
110
|
};
|
|
106
111
|
export type Signal<T> = [get: Accessor<T>, set: Setter<T>];
|
|
107
112
|
export interface SignalOptions<T> extends MemoOptions<T> {
|
|
108
|
-
|
|
113
|
+
internal?: boolean;
|
|
109
114
|
}
|
|
110
115
|
/**
|
|
111
116
|
* Creates a simple reactive state with a getter and setter
|
|
@@ -133,11 +138,10 @@ export interface SignalOptions<T> extends MemoOptions<T> {
|
|
|
133
138
|
export declare function createSignal<T>(): Signal<T | undefined>;
|
|
134
139
|
export declare function createSignal<T>(value: T, options?: SignalOptions<T>): Signal<T>;
|
|
135
140
|
export interface BaseOptions {
|
|
136
|
-
|
|
141
|
+
name?: string;
|
|
137
142
|
}
|
|
138
143
|
export type NoInfer<T extends any> = [T][T extends any ? 0 : never];
|
|
139
|
-
export interface EffectOptions extends BaseOptions {
|
|
140
|
-
}
|
|
144
|
+
export interface EffectOptions extends BaseOptions {}
|
|
141
145
|
export type EffectFunction<Prev, Next extends Prev = Prev> = (v: Prev) => Next;
|
|
142
146
|
/**
|
|
143
147
|
* Creates a reactive computation that runs immediately before render, mainly used to write to other reactive primitives
|
|
@@ -154,8 +158,14 @@ export type EffectFunction<Prev, Next extends Prev = Prev> = (v: Prev) => Next;
|
|
|
154
158
|
*
|
|
155
159
|
* @description https://www.solidjs.com/docs/latest/api#createcomputed
|
|
156
160
|
*/
|
|
157
|
-
export declare function createComputed<Next>(
|
|
158
|
-
|
|
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;
|
|
159
169
|
/**
|
|
160
170
|
* Creates a reactive computation that runs during the render phase as DOM elements are created and updated but not necessarily connected
|
|
161
171
|
* ```typescript
|
|
@@ -171,8 +181,14 @@ export declare function createComputed<Next, Init = Next>(fn: EffectFunction<Ini
|
|
|
171
181
|
*
|
|
172
182
|
* @description https://www.solidjs.com/docs/latest/api#createrendereffect
|
|
173
183
|
*/
|
|
174
|
-
export declare function createRenderEffect<Next>(
|
|
175
|
-
|
|
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;
|
|
176
192
|
/**
|
|
177
193
|
* Creates a reactive computation that runs after the render phase
|
|
178
194
|
* ```typescript
|
|
@@ -188,10 +204,16 @@ export declare function createRenderEffect<Next, Init = Next>(fn: EffectFunction
|
|
|
188
204
|
*
|
|
189
205
|
* @description https://www.solidjs.com/docs/latest/api#createeffect
|
|
190
206
|
*/
|
|
191
|
-
export declare function createEffect<Next>(
|
|
192
|
-
|
|
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 & {
|
|
193
214
|
render?: boolean;
|
|
194
|
-
}
|
|
215
|
+
}
|
|
216
|
+
): void;
|
|
195
217
|
/**
|
|
196
218
|
* Creates a reactive computation that runs after the render phase with flexible tracking
|
|
197
219
|
* ```typescript
|
|
@@ -205,13 +227,16 @@ export declare function createEffect<Next, Init = Next>(fn: EffectFunction<Init
|
|
|
205
227
|
*
|
|
206
228
|
* @description https://www.solidjs.com/docs/latest/api#createreaction
|
|
207
229
|
*/
|
|
208
|
-
export declare function createReaction(
|
|
230
|
+
export declare function createReaction(
|
|
231
|
+
onInvalidate: () => void,
|
|
232
|
+
options?: EffectOptions
|
|
233
|
+
): (tracking: () => void) => void;
|
|
209
234
|
export interface Memo<Prev, Next = Prev> extends SignalState<Next>, Computation<Next> {
|
|
210
|
-
|
|
211
|
-
|
|
235
|
+
value: Next;
|
|
236
|
+
tOwned?: Computation<Prev | Next, Next>[];
|
|
212
237
|
}
|
|
213
238
|
export interface MemoOptions<T> extends EffectOptions {
|
|
214
|
-
|
|
239
|
+
equals?: false | ((prev: T, next: T) => boolean);
|
|
215
240
|
}
|
|
216
241
|
/**
|
|
217
242
|
* Creates a readonly derived reactive memoized signal
|
|
@@ -228,72 +253,84 @@ export interface MemoOptions<T> extends EffectOptions {
|
|
|
228
253
|
*
|
|
229
254
|
* @description https://www.solidjs.com/docs/latest/api#creatememo
|
|
230
255
|
*/
|
|
231
|
-
export declare function createMemo<Next extends Prev, Prev = Next>(
|
|
232
|
-
|
|
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>;
|
|
233
264
|
interface Unresolved {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
265
|
+
state: "unresolved";
|
|
266
|
+
loading: false;
|
|
267
|
+
error: undefined;
|
|
268
|
+
latest: undefined;
|
|
269
|
+
(): undefined;
|
|
239
270
|
}
|
|
240
271
|
interface Pending {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
272
|
+
state: "pending";
|
|
273
|
+
loading: true;
|
|
274
|
+
error: undefined;
|
|
275
|
+
latest: undefined;
|
|
276
|
+
(): undefined;
|
|
246
277
|
}
|
|
247
278
|
interface Ready<T> {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
279
|
+
state: "ready";
|
|
280
|
+
loading: false;
|
|
281
|
+
error: undefined;
|
|
282
|
+
latest: T;
|
|
283
|
+
(): T;
|
|
253
284
|
}
|
|
254
285
|
interface Refreshing<T> {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
286
|
+
state: "refreshing";
|
|
287
|
+
loading: true;
|
|
288
|
+
error: undefined;
|
|
289
|
+
latest: T;
|
|
290
|
+
(): T;
|
|
260
291
|
}
|
|
261
292
|
interface Errored {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
293
|
+
state: "errored";
|
|
294
|
+
loading: false;
|
|
295
|
+
error: any;
|
|
296
|
+
latest: never;
|
|
297
|
+
(): never;
|
|
267
298
|
}
|
|
268
299
|
export type Resource<T> = Unresolved | Pending | Ready<T> | Refreshing<T> | Errored;
|
|
269
300
|
export type InitializedResource<T> = Ready<T> | Refreshing<T> | Errored;
|
|
270
301
|
export type ResourceActions<T, R = unknown> = {
|
|
271
|
-
|
|
272
|
-
|
|
302
|
+
mutate: Setter<T>;
|
|
303
|
+
refetch: (info?: R) => T | Promise<T> | undefined | null;
|
|
273
304
|
};
|
|
274
305
|
export type ResourceSource<S> = S | false | null | undefined | (() => S | false | null | undefined);
|
|
275
|
-
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>;
|
|
276
310
|
export type ResourceFetcherInfo<T, R = unknown> = {
|
|
277
|
-
|
|
278
|
-
|
|
311
|
+
value: T | undefined;
|
|
312
|
+
refetching: R | boolean;
|
|
279
313
|
};
|
|
280
314
|
export type ResourceOptions<T, S = unknown> = {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
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;
|
|
289
326
|
};
|
|
290
327
|
export type InitializedResourceOptions<T, S = unknown> = ResourceOptions<T, S> & {
|
|
291
|
-
|
|
328
|
+
initialValue: T;
|
|
292
329
|
};
|
|
293
330
|
export type ResourceReturn<T, R = unknown> = [Resource<T>, ResourceActions<T | undefined, R>];
|
|
294
331
|
export type InitializedResourceReturn<T, R = unknown> = [
|
|
295
|
-
|
|
296
|
-
|
|
332
|
+
InitializedResource<T>,
|
|
333
|
+
ResourceActions<T, R>
|
|
297
334
|
];
|
|
298
335
|
/**
|
|
299
336
|
* Creates a resource that wraps a repeated promise in a reactive pattern:
|
|
@@ -323,14 +360,28 @@ export type InitializedResourceReturn<T, R = unknown> = [
|
|
|
323
360
|
*
|
|
324
361
|
* @description https://www.solidjs.com/docs/latest/api#createresource
|
|
325
362
|
*/
|
|
326
|
-
export declare function createResource<T, R = unknown>(
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
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>;
|
|
330
381
|
export interface DeferredOptions<T> {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
382
|
+
equals?: false | ((prev: T, next: T) => boolean);
|
|
383
|
+
name?: string;
|
|
384
|
+
timeoutMs?: number;
|
|
334
385
|
}
|
|
335
386
|
/**
|
|
336
387
|
* Creates a reactive computation that only runs and notifies the reactive context when the browser is idle
|
|
@@ -345,7 +396,10 @@ export interface DeferredOptions<T> {
|
|
|
345
396
|
*
|
|
346
397
|
* @description https://www.solidjs.com/docs/latest/api#createdeferred
|
|
347
398
|
*/
|
|
348
|
-
export declare function createDeferred<T>(
|
|
399
|
+
export declare function createDeferred<T>(
|
|
400
|
+
source: Accessor<T>,
|
|
401
|
+
options?: DeferredOptions<T>
|
|
402
|
+
): Accessor<T>;
|
|
349
403
|
export type EqualityCheckerFunction<T, U> = (a: U, b: T) => boolean;
|
|
350
404
|
/**
|
|
351
405
|
* Creates a conditional signal that only notifies subscribers when entering or exiting their key matching the value
|
|
@@ -371,7 +425,11 @@ export type EqualityCheckerFunction<T, U> = (a: U, b: T) => boolean;
|
|
|
371
425
|
*
|
|
372
426
|
* @description https://www.solidjs.com/docs/latest/api#createselector
|
|
373
427
|
*/
|
|
374
|
-
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;
|
|
375
433
|
/**
|
|
376
434
|
* Holds changes inside the block before the reactive context is updated
|
|
377
435
|
* @param fn wraps the reactive updates that should be batched
|
|
@@ -389,15 +447,28 @@ export declare function batch<T>(fn: Accessor<T>): T;
|
|
|
389
447
|
*/
|
|
390
448
|
export declare function untrack<T>(fn: Accessor<T>): T;
|
|
391
449
|
/** @deprecated */
|
|
392
|
-
export type ReturnTypes<T> = T extends readonly Accessor<unknown>[]
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
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;
|
|
399
470
|
export interface OnOptions {
|
|
400
|
-
|
|
471
|
+
defer?: boolean;
|
|
401
472
|
}
|
|
402
473
|
/**
|
|
403
474
|
* on - make dependencies of a computation explicit
|
|
@@ -425,12 +496,22 @@ export interface OnOptions {
|
|
|
425
496
|
*
|
|
426
497
|
* @description https://www.solidjs.com/docs/latest/api#on
|
|
427
498
|
*/
|
|
428
|
-
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 & {
|
|
429
503
|
defer?: false;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
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:
|
|
510
|
+
| OnOptions
|
|
511
|
+
| {
|
|
512
|
+
defer: true;
|
|
513
|
+
}
|
|
514
|
+
): EffectFunction<undefined | NoInfer<Next>>;
|
|
434
515
|
/**
|
|
435
516
|
* onMount - run an effect only after initial render on mount
|
|
436
517
|
* @param fn an effect that should run only once on mount
|
|
@@ -482,19 +563,19 @@ export type Transition = [Accessor<boolean>, (fn: () => void) => Promise<void>];
|
|
|
482
563
|
export declare function useTransition(): Transition;
|
|
483
564
|
export declare function resumeEffects(e: Computation<any>[]): void;
|
|
484
565
|
export interface DevComponent<T> extends Memo<unknown> {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
566
|
+
props: T;
|
|
567
|
+
name: string;
|
|
568
|
+
component: (props: T) => unknown;
|
|
488
569
|
}
|
|
489
570
|
export declare function devComponent<P, V>(Comp: (props: P) => V, props: P): V;
|
|
490
571
|
export declare function registerGraph(value: SourceMapValue): void;
|
|
491
572
|
export type ContextProviderComponent<T> = FlowComponent<{
|
|
492
|
-
|
|
573
|
+
value: T;
|
|
493
574
|
}>;
|
|
494
575
|
export interface Context<T> {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
576
|
+
id: symbol;
|
|
577
|
+
Provider: ContextProviderComponent<T>;
|
|
578
|
+
defaultValue: T;
|
|
498
579
|
}
|
|
499
580
|
/**
|
|
500
581
|
* Creates a Context to handle a state scoped for the children of a component
|
|
@@ -515,7 +596,10 @@ export interface Context<T> {
|
|
|
515
596
|
*
|
|
516
597
|
* @description https://www.solidjs.com/docs/latest/api#createcontext
|
|
517
598
|
*/
|
|
518
|
-
export declare function createContext<T>(
|
|
599
|
+
export declare function createContext<T>(
|
|
600
|
+
defaultValue?: undefined,
|
|
601
|
+
options?: EffectOptions
|
|
602
|
+
): Context<T | undefined>;
|
|
519
603
|
export declare function createContext<T>(defaultValue: T, options?: EffectOptions): Context<T>;
|
|
520
604
|
/**
|
|
521
605
|
* use a context to receive a scoped state from a parent's Context.Provider
|
|
@@ -529,7 +613,7 @@ export declare function useContext<T>(context: Context<T>): T;
|
|
|
529
613
|
export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement>;
|
|
530
614
|
export type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
|
|
531
615
|
export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
532
|
-
|
|
616
|
+
toArray: () => ResolvedJSXElement[];
|
|
533
617
|
};
|
|
534
618
|
/**
|
|
535
619
|
* Resolves child elements to help interact with children
|
|
@@ -541,22 +625,26 @@ export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
|
541
625
|
*/
|
|
542
626
|
export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn;
|
|
543
627
|
export type SuspenseContextType = {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
628
|
+
increment?: () => void;
|
|
629
|
+
decrement?: () => void;
|
|
630
|
+
inFallback?: () => boolean;
|
|
631
|
+
effects?: Computation<any>[];
|
|
632
|
+
resolved?: boolean;
|
|
549
633
|
};
|
|
550
634
|
type SuspenseContext = Context<SuspenseContextType | undefined> & {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
635
|
+
active?(): boolean;
|
|
636
|
+
increment?(): void;
|
|
637
|
+
decrement?(): void;
|
|
554
638
|
};
|
|
555
639
|
declare let SuspenseContext: SuspenseContext;
|
|
556
640
|
export declare function getSuspenseContext(): SuspenseContext;
|
|
557
641
|
export declare function enableExternalSource(factory: ExternalSourceFactory): void;
|
|
558
642
|
export declare function readSignal(this: SignalState<any> | Memo<any>): any;
|
|
559
|
-
export declare function writeSignal(
|
|
643
|
+
export declare function writeSignal(
|
|
644
|
+
node: SignalState<any> | Memo<any>,
|
|
645
|
+
value: any,
|
|
646
|
+
isComp?: boolean
|
|
647
|
+
): any;
|
|
560
648
|
/**
|
|
561
649
|
* @deprecated since version 1.7.0 and will be removed in next major - use catchError instead
|
|
562
650
|
* onError - run an effect whenever an error is thrown within the context of the child scopes
|
|
@@ -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;
|