solid-js 1.8.5 → 1.8.7
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 +13 -10
- package/dist/dev.js +545 -307
- package/dist/server.js +170 -75
- package/dist/solid.cjs +8 -7
- package/dist/solid.js +467 -262
- 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/jsx-runtime/types/jsx.d.ts +12 -5
- package/h/types/hyperscript.d.ts +11 -11
- package/html/dist/html.js +216 -94
- package/html/types/lit.d.ts +47 -33
- package/package.json +7 -2
- 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 +75 -9
- package/types/jsx.d.ts +11 -5
- 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 +229 -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 +167 -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 +1 -1
- package/web/dist/dev.js +620 -81
- package/web/dist/server.cjs +28 -13
- package/web/dist/server.js +201 -104
- package/web/dist/storage.js +3 -3
- package/web/dist/web.cjs +1 -1
- package/web/dist/web.js +614 -80
- 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
|
@@ -33,57 +33,61 @@ 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
|
+
afterCreateSignal: ((signal: SignalState<any>) => void) | null;
|
|
38
39
|
};
|
|
39
40
|
export type ComputationState = 0 | 1 | 2;
|
|
40
41
|
export interface SourceMapValue {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
value: unknown;
|
|
43
|
+
name?: string;
|
|
44
|
+
graph?: Owner;
|
|
44
45
|
}
|
|
45
46
|
export interface SignalState<T> extends SourceMapValue {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
value: T;
|
|
48
|
+
observers: Computation<any>[] | null;
|
|
49
|
+
observerSlots: number[] | null;
|
|
50
|
+
tValue?: T;
|
|
51
|
+
comparator?: (prev: T, next: T) => boolean;
|
|
51
52
|
}
|
|
52
53
|
export interface Owner {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
owned: Computation<any>[] | null;
|
|
55
|
+
cleanups: (() => void)[] | null;
|
|
56
|
+
owner: Owner | null;
|
|
57
|
+
context: any | null;
|
|
58
|
+
sourceMap?: SourceMapValue[];
|
|
59
|
+
name?: string;
|
|
59
60
|
}
|
|
60
61
|
export interface Computation<Init, Next extends Init = Init> extends Owner {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
fn: EffectFunction<Init, Next>;
|
|
63
|
+
state: ComputationState;
|
|
64
|
+
tState?: ComputationState;
|
|
65
|
+
sources: SignalState<Next>[] | null;
|
|
66
|
+
sourceSlots: number[] | null;
|
|
67
|
+
value?: Init;
|
|
68
|
+
updatedAt: number | null;
|
|
69
|
+
pure: boolean;
|
|
70
|
+
user?: boolean;
|
|
71
|
+
suspense?: SuspenseContextType;
|
|
71
72
|
}
|
|
72
73
|
export interface TransitionState {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
sources: Set<SignalState<any>>;
|
|
75
|
+
effects: Computation<any>[];
|
|
76
|
+
promises: Set<Promise<any>>;
|
|
77
|
+
disposed: Set<Computation<any>>;
|
|
78
|
+
queue: Set<Computation<any>>;
|
|
79
|
+
scheduler?: (fn: () => void) => unknown;
|
|
80
|
+
running: boolean;
|
|
81
|
+
done?: Promise<void>;
|
|
82
|
+
resolve?: () => void;
|
|
82
83
|
}
|
|
83
|
-
type ExternalSourceFactory = <Prev, Next extends Prev = Prev>(
|
|
84
|
+
type ExternalSourceFactory = <Prev, Next extends Prev = Prev>(
|
|
85
|
+
fn: EffectFunction<Prev, Next>,
|
|
86
|
+
trigger: () => void
|
|
87
|
+
) => ExternalSource;
|
|
84
88
|
export interface ExternalSource {
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
track: EffectFunction<any, any>;
|
|
90
|
+
dispose: () => void;
|
|
87
91
|
}
|
|
88
92
|
export type RootFunction<T> = (dispose: () => void) => T;
|
|
89
93
|
/**
|
|
@@ -98,14 +102,16 @@ export type RootFunction<T> = (dispose: () => void) => T;
|
|
|
98
102
|
export declare function createRoot<T>(fn: RootFunction<T>, detachedOwner?: typeof Owner): T;
|
|
99
103
|
export type Accessor<T> = () => T;
|
|
100
104
|
export type Setter<in out T> = {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
<U extends T>(...args: undefined extends T ? [] : [value: (prev: T) => U]): undefined extends T
|
|
106
|
+
? undefined
|
|
107
|
+
: U;
|
|
108
|
+
<U extends T>(value: (prev: T) => U): U;
|
|
109
|
+
<U extends T>(value: Exclude<U, Function>): U;
|
|
110
|
+
<U extends T>(value: Exclude<U, Function> | ((prev: T) => U)): U;
|
|
105
111
|
};
|
|
106
112
|
export type Signal<T> = [get: Accessor<T>, set: Setter<T>];
|
|
107
113
|
export interface SignalOptions<T> extends MemoOptions<T> {
|
|
108
|
-
|
|
114
|
+
internal?: boolean;
|
|
109
115
|
}
|
|
110
116
|
/**
|
|
111
117
|
* Creates a simple reactive state with a getter and setter
|
|
@@ -133,11 +139,10 @@ export interface SignalOptions<T> extends MemoOptions<T> {
|
|
|
133
139
|
export declare function createSignal<T>(): Signal<T | undefined>;
|
|
134
140
|
export declare function createSignal<T>(value: T, options?: SignalOptions<T>): Signal<T>;
|
|
135
141
|
export interface BaseOptions {
|
|
136
|
-
|
|
142
|
+
name?: string;
|
|
137
143
|
}
|
|
138
144
|
export type NoInfer<T extends any> = [T][T extends any ? 0 : never];
|
|
139
|
-
export interface EffectOptions extends BaseOptions {
|
|
140
|
-
}
|
|
145
|
+
export interface EffectOptions extends BaseOptions {}
|
|
141
146
|
export type EffectFunction<Prev, Next extends Prev = Prev> = (v: Prev) => Next;
|
|
142
147
|
/**
|
|
143
148
|
* Creates a reactive computation that runs immediately before render, mainly used to write to other reactive primitives
|
|
@@ -154,8 +159,14 @@ export type EffectFunction<Prev, Next extends Prev = Prev> = (v: Prev) => Next;
|
|
|
154
159
|
*
|
|
155
160
|
* @description https://www.solidjs.com/docs/latest/api#createcomputed
|
|
156
161
|
*/
|
|
157
|
-
export declare function createComputed<Next>(
|
|
158
|
-
|
|
162
|
+
export declare function createComputed<Next>(
|
|
163
|
+
fn: EffectFunction<undefined | NoInfer<Next>, Next>
|
|
164
|
+
): void;
|
|
165
|
+
export declare function createComputed<Next, Init = Next>(
|
|
166
|
+
fn: EffectFunction<Init | Next, Next>,
|
|
167
|
+
value: Init,
|
|
168
|
+
options?: EffectOptions
|
|
169
|
+
): void;
|
|
159
170
|
/**
|
|
160
171
|
* Creates a reactive computation that runs during the render phase as DOM elements are created and updated but not necessarily connected
|
|
161
172
|
* ```typescript
|
|
@@ -171,8 +182,14 @@ export declare function createComputed<Next, Init = Next>(fn: EffectFunction<Ini
|
|
|
171
182
|
*
|
|
172
183
|
* @description https://www.solidjs.com/docs/latest/api#createrendereffect
|
|
173
184
|
*/
|
|
174
|
-
export declare function createRenderEffect<Next>(
|
|
175
|
-
|
|
185
|
+
export declare function createRenderEffect<Next>(
|
|
186
|
+
fn: EffectFunction<undefined | NoInfer<Next>, Next>
|
|
187
|
+
): void;
|
|
188
|
+
export declare function createRenderEffect<Next, Init = Next>(
|
|
189
|
+
fn: EffectFunction<Init | Next, Next>,
|
|
190
|
+
value: Init,
|
|
191
|
+
options?: EffectOptions
|
|
192
|
+
): void;
|
|
176
193
|
/**
|
|
177
194
|
* Creates a reactive computation that runs after the render phase
|
|
178
195
|
* ```typescript
|
|
@@ -188,10 +205,16 @@ export declare function createRenderEffect<Next, Init = Next>(fn: EffectFunction
|
|
|
188
205
|
*
|
|
189
206
|
* @description https://www.solidjs.com/docs/latest/api#createeffect
|
|
190
207
|
*/
|
|
191
|
-
export declare function createEffect<Next>(
|
|
192
|
-
|
|
208
|
+
export declare function createEffect<Next>(
|
|
209
|
+
fn: EffectFunction<undefined | NoInfer<Next>, Next>
|
|
210
|
+
): void;
|
|
211
|
+
export declare function createEffect<Next, Init = Next>(
|
|
212
|
+
fn: EffectFunction<Init | Next, Next>,
|
|
213
|
+
value: Init,
|
|
214
|
+
options?: EffectOptions & {
|
|
193
215
|
render?: boolean;
|
|
194
|
-
}
|
|
216
|
+
}
|
|
217
|
+
): void;
|
|
195
218
|
/**
|
|
196
219
|
* Creates a reactive computation that runs after the render phase with flexible tracking
|
|
197
220
|
* ```typescript
|
|
@@ -205,13 +228,16 @@ export declare function createEffect<Next, Init = Next>(fn: EffectFunction<Init
|
|
|
205
228
|
*
|
|
206
229
|
* @description https://www.solidjs.com/docs/latest/api#createreaction
|
|
207
230
|
*/
|
|
208
|
-
export declare function createReaction(
|
|
231
|
+
export declare function createReaction(
|
|
232
|
+
onInvalidate: () => void,
|
|
233
|
+
options?: EffectOptions
|
|
234
|
+
): (tracking: () => void) => void;
|
|
209
235
|
export interface Memo<Prev, Next = Prev> extends SignalState<Next>, Computation<Next> {
|
|
210
|
-
|
|
211
|
-
|
|
236
|
+
value: Next;
|
|
237
|
+
tOwned?: Computation<Prev | Next, Next>[];
|
|
212
238
|
}
|
|
213
239
|
export interface MemoOptions<T> extends EffectOptions {
|
|
214
|
-
|
|
240
|
+
equals?: false | ((prev: T, next: T) => boolean);
|
|
215
241
|
}
|
|
216
242
|
/**
|
|
217
243
|
* Creates a readonly derived reactive memoized signal
|
|
@@ -228,72 +254,84 @@ export interface MemoOptions<T> extends EffectOptions {
|
|
|
228
254
|
*
|
|
229
255
|
* @description https://www.solidjs.com/docs/latest/api#creatememo
|
|
230
256
|
*/
|
|
231
|
-
export declare function createMemo<Next extends Prev, Prev = Next>(
|
|
232
|
-
|
|
257
|
+
export declare function createMemo<Next extends Prev, Prev = Next>(
|
|
258
|
+
fn: EffectFunction<undefined | NoInfer<Prev>, Next>
|
|
259
|
+
): Accessor<Next>;
|
|
260
|
+
export declare function createMemo<Next extends Prev, Init = Next, Prev = Next>(
|
|
261
|
+
fn: EffectFunction<Init | Prev, Next>,
|
|
262
|
+
value: Init,
|
|
263
|
+
options?: MemoOptions<Next>
|
|
264
|
+
): Accessor<Next>;
|
|
233
265
|
interface Unresolved {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
266
|
+
state: "unresolved";
|
|
267
|
+
loading: false;
|
|
268
|
+
error: undefined;
|
|
269
|
+
latest: undefined;
|
|
270
|
+
(): undefined;
|
|
239
271
|
}
|
|
240
272
|
interface Pending {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
273
|
+
state: "pending";
|
|
274
|
+
loading: true;
|
|
275
|
+
error: undefined;
|
|
276
|
+
latest: undefined;
|
|
277
|
+
(): undefined;
|
|
246
278
|
}
|
|
247
279
|
interface Ready<T> {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
280
|
+
state: "ready";
|
|
281
|
+
loading: false;
|
|
282
|
+
error: undefined;
|
|
283
|
+
latest: T;
|
|
284
|
+
(): T;
|
|
253
285
|
}
|
|
254
286
|
interface Refreshing<T> {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
287
|
+
state: "refreshing";
|
|
288
|
+
loading: true;
|
|
289
|
+
error: undefined;
|
|
290
|
+
latest: T;
|
|
291
|
+
(): T;
|
|
260
292
|
}
|
|
261
293
|
interface Errored {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
294
|
+
state: "errored";
|
|
295
|
+
loading: false;
|
|
296
|
+
error: any;
|
|
297
|
+
latest: never;
|
|
298
|
+
(): never;
|
|
267
299
|
}
|
|
268
300
|
export type Resource<T> = Unresolved | Pending | Ready<T> | Refreshing<T> | Errored;
|
|
269
301
|
export type InitializedResource<T> = Ready<T> | Refreshing<T> | Errored;
|
|
270
302
|
export type ResourceActions<T, R = unknown> = {
|
|
271
|
-
|
|
272
|
-
|
|
303
|
+
mutate: Setter<T>;
|
|
304
|
+
refetch: (info?: R) => T | Promise<T> | undefined | null;
|
|
273
305
|
};
|
|
274
306
|
export type ResourceSource<S> = S | false | null | undefined | (() => S | false | null | undefined);
|
|
275
|
-
export type ResourceFetcher<S, T, R = unknown> = (
|
|
307
|
+
export type ResourceFetcher<S, T, R = unknown> = (
|
|
308
|
+
k: S,
|
|
309
|
+
info: ResourceFetcherInfo<T, R>
|
|
310
|
+
) => T | Promise<T>;
|
|
276
311
|
export type ResourceFetcherInfo<T, R = unknown> = {
|
|
277
|
-
|
|
278
|
-
|
|
312
|
+
value: T | undefined;
|
|
313
|
+
refetching: R | boolean;
|
|
279
314
|
};
|
|
280
315
|
export type ResourceOptions<T, S = unknown> = {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
316
|
+
initialValue?: T;
|
|
317
|
+
name?: string;
|
|
318
|
+
deferStream?: boolean;
|
|
319
|
+
ssrLoadFrom?: "initial" | "server";
|
|
320
|
+
storage?: (init: T | undefined) => [Accessor<T | undefined>, Setter<T | undefined>];
|
|
321
|
+
onHydrated?: (
|
|
322
|
+
k: S | undefined,
|
|
323
|
+
info: {
|
|
324
|
+
value: T | undefined;
|
|
325
|
+
}
|
|
326
|
+
) => void;
|
|
289
327
|
};
|
|
290
328
|
export type InitializedResourceOptions<T, S = unknown> = ResourceOptions<T, S> & {
|
|
291
|
-
|
|
329
|
+
initialValue: T;
|
|
292
330
|
};
|
|
293
331
|
export type ResourceReturn<T, R = unknown> = [Resource<T>, ResourceActions<T | undefined, R>];
|
|
294
332
|
export type InitializedResourceReturn<T, R = unknown> = [
|
|
295
|
-
|
|
296
|
-
|
|
333
|
+
InitializedResource<T>,
|
|
334
|
+
ResourceActions<T, R>
|
|
297
335
|
];
|
|
298
336
|
/**
|
|
299
337
|
* Creates a resource that wraps a repeated promise in a reactive pattern:
|
|
@@ -323,14 +361,28 @@ export type InitializedResourceReturn<T, R = unknown> = [
|
|
|
323
361
|
*
|
|
324
362
|
* @description https://www.solidjs.com/docs/latest/api#createresource
|
|
325
363
|
*/
|
|
326
|
-
export declare function createResource<T, R = unknown>(
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
364
|
+
export declare function createResource<T, R = unknown>(
|
|
365
|
+
fetcher: ResourceFetcher<true, T, R>,
|
|
366
|
+
options: InitializedResourceOptions<NoInfer<T>, true>
|
|
367
|
+
): InitializedResourceReturn<T, R>;
|
|
368
|
+
export declare function createResource<T, R = unknown>(
|
|
369
|
+
fetcher: ResourceFetcher<true, T, R>,
|
|
370
|
+
options?: ResourceOptions<NoInfer<T>, true>
|
|
371
|
+
): ResourceReturn<T, R>;
|
|
372
|
+
export declare function createResource<T, S, R = unknown>(
|
|
373
|
+
source: ResourceSource<S>,
|
|
374
|
+
fetcher: ResourceFetcher<S, T, R>,
|
|
375
|
+
options: InitializedResourceOptions<NoInfer<T>, S>
|
|
376
|
+
): InitializedResourceReturn<T, R>;
|
|
377
|
+
export declare function createResource<T, S, R = unknown>(
|
|
378
|
+
source: ResourceSource<S>,
|
|
379
|
+
fetcher: ResourceFetcher<S, T, R>,
|
|
380
|
+
options?: ResourceOptions<NoInfer<T>, S>
|
|
381
|
+
): ResourceReturn<T, R>;
|
|
330
382
|
export interface DeferredOptions<T> {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
383
|
+
equals?: false | ((prev: T, next: T) => boolean);
|
|
384
|
+
name?: string;
|
|
385
|
+
timeoutMs?: number;
|
|
334
386
|
}
|
|
335
387
|
/**
|
|
336
388
|
* Creates a reactive computation that only runs and notifies the reactive context when the browser is idle
|
|
@@ -345,7 +397,10 @@ export interface DeferredOptions<T> {
|
|
|
345
397
|
*
|
|
346
398
|
* @description https://www.solidjs.com/docs/latest/api#createdeferred
|
|
347
399
|
*/
|
|
348
|
-
export declare function createDeferred<T>(
|
|
400
|
+
export declare function createDeferred<T>(
|
|
401
|
+
source: Accessor<T>,
|
|
402
|
+
options?: DeferredOptions<T>
|
|
403
|
+
): Accessor<T>;
|
|
349
404
|
export type EqualityCheckerFunction<T, U> = (a: U, b: T) => boolean;
|
|
350
405
|
/**
|
|
351
406
|
* Creates a conditional signal that only notifies subscribers when entering or exiting their key matching the value
|
|
@@ -371,7 +426,11 @@ export type EqualityCheckerFunction<T, U> = (a: U, b: T) => boolean;
|
|
|
371
426
|
*
|
|
372
427
|
* @description https://www.solidjs.com/docs/latest/api#createselector
|
|
373
428
|
*/
|
|
374
|
-
export declare function createSelector<T, U = T>(
|
|
429
|
+
export declare function createSelector<T, U = T>(
|
|
430
|
+
source: Accessor<T>,
|
|
431
|
+
fn?: EqualityCheckerFunction<T, U>,
|
|
432
|
+
options?: BaseOptions
|
|
433
|
+
): (key: U) => boolean;
|
|
375
434
|
/**
|
|
376
435
|
* Holds changes inside the block before the reactive context is updated
|
|
377
436
|
* @param fn wraps the reactive updates that should be batched
|
|
@@ -389,15 +448,28 @@ export declare function batch<T>(fn: Accessor<T>): T;
|
|
|
389
448
|
*/
|
|
390
449
|
export declare function untrack<T>(fn: Accessor<T>): T;
|
|
391
450
|
/** @deprecated */
|
|
392
|
-
export type ReturnTypes<T> = T extends readonly Accessor<unknown>[]
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
451
|
+
export type ReturnTypes<T> = T extends readonly Accessor<unknown>[]
|
|
452
|
+
? {
|
|
453
|
+
[K in keyof T]: T[K] extends Accessor<infer I> ? I : never;
|
|
454
|
+
}
|
|
455
|
+
: T extends Accessor<infer I>
|
|
456
|
+
? I
|
|
457
|
+
: never;
|
|
458
|
+
export type AccessorArray<T> = [
|
|
459
|
+
...Extract<
|
|
460
|
+
{
|
|
461
|
+
[K in keyof T]: Accessor<T[K]>;
|
|
462
|
+
},
|
|
463
|
+
readonly unknown[]
|
|
464
|
+
>
|
|
465
|
+
];
|
|
466
|
+
export type OnEffectFunction<S, Prev, Next extends Prev = Prev> = (
|
|
467
|
+
input: S,
|
|
468
|
+
prevInput: S | undefined,
|
|
469
|
+
prev: Prev
|
|
470
|
+
) => Next;
|
|
399
471
|
export interface OnOptions {
|
|
400
|
-
|
|
472
|
+
defer?: boolean;
|
|
401
473
|
}
|
|
402
474
|
/**
|
|
403
475
|
* on - make dependencies of a computation explicit
|
|
@@ -425,12 +497,22 @@ export interface OnOptions {
|
|
|
425
497
|
*
|
|
426
498
|
* @description https://www.solidjs.com/docs/latest/api#on
|
|
427
499
|
*/
|
|
428
|
-
export declare function on<S, Next extends Prev, Prev = Next>(
|
|
500
|
+
export declare function on<S, Next extends Prev, Prev = Next>(
|
|
501
|
+
deps: AccessorArray<S> | Accessor<S>,
|
|
502
|
+
fn: OnEffectFunction<S, undefined | NoInfer<Prev>, Next>,
|
|
503
|
+
options?: OnOptions & {
|
|
429
504
|
defer?: false;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
505
|
+
}
|
|
506
|
+
): EffectFunction<undefined | NoInfer<Next>, NoInfer<Next>>;
|
|
507
|
+
export declare function on<S, Next extends Prev, Prev = Next>(
|
|
508
|
+
deps: AccessorArray<S> | Accessor<S>,
|
|
509
|
+
fn: OnEffectFunction<S, undefined | NoInfer<Prev>, Next>,
|
|
510
|
+
options:
|
|
511
|
+
| OnOptions
|
|
512
|
+
| {
|
|
513
|
+
defer: true;
|
|
514
|
+
}
|
|
515
|
+
): EffectFunction<undefined | NoInfer<Next>>;
|
|
434
516
|
/**
|
|
435
517
|
* onMount - run an effect only after initial render on mount
|
|
436
518
|
* @param fn an effect that should run only once on mount
|
|
@@ -482,19 +564,19 @@ export type Transition = [Accessor<boolean>, (fn: () => void) => Promise<void>];
|
|
|
482
564
|
export declare function useTransition(): Transition;
|
|
483
565
|
export declare function resumeEffects(e: Computation<any>[]): void;
|
|
484
566
|
export interface DevComponent<T> extends Memo<unknown> {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
567
|
+
props: T;
|
|
568
|
+
name: string;
|
|
569
|
+
component: (props: T) => unknown;
|
|
488
570
|
}
|
|
489
571
|
export declare function devComponent<P, V>(Comp: (props: P) => V, props: P): V;
|
|
490
572
|
export declare function registerGraph(value: SourceMapValue): void;
|
|
491
573
|
export type ContextProviderComponent<T> = FlowComponent<{
|
|
492
|
-
|
|
574
|
+
value: T;
|
|
493
575
|
}>;
|
|
494
576
|
export interface Context<T> {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
577
|
+
id: symbol;
|
|
578
|
+
Provider: ContextProviderComponent<T>;
|
|
579
|
+
defaultValue: T;
|
|
498
580
|
}
|
|
499
581
|
/**
|
|
500
582
|
* Creates a Context to handle a state scoped for the children of a component
|
|
@@ -515,7 +597,10 @@ export interface Context<T> {
|
|
|
515
597
|
*
|
|
516
598
|
* @description https://www.solidjs.com/docs/latest/api#createcontext
|
|
517
599
|
*/
|
|
518
|
-
export declare function createContext<T>(
|
|
600
|
+
export declare function createContext<T>(
|
|
601
|
+
defaultValue?: undefined,
|
|
602
|
+
options?: EffectOptions
|
|
603
|
+
): Context<T | undefined>;
|
|
519
604
|
export declare function createContext<T>(defaultValue: T, options?: EffectOptions): Context<T>;
|
|
520
605
|
/**
|
|
521
606
|
* use a context to receive a scoped state from a parent's Context.Provider
|
|
@@ -529,7 +614,7 @@ export declare function useContext<T>(context: Context<T>): T;
|
|
|
529
614
|
export type ResolvedJSXElement = Exclude<JSX.Element, JSX.ArrayElement>;
|
|
530
615
|
export type ResolvedChildren = ResolvedJSXElement | ResolvedJSXElement[];
|
|
531
616
|
export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
532
|
-
|
|
617
|
+
toArray: () => ResolvedJSXElement[];
|
|
533
618
|
};
|
|
534
619
|
/**
|
|
535
620
|
* Resolves child elements to help interact with children
|
|
@@ -541,22 +626,26 @@ export type ChildrenReturn = Accessor<ResolvedChildren> & {
|
|
|
541
626
|
*/
|
|
542
627
|
export declare function children(fn: Accessor<JSX.Element>): ChildrenReturn;
|
|
543
628
|
export type SuspenseContextType = {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
629
|
+
increment?: () => void;
|
|
630
|
+
decrement?: () => void;
|
|
631
|
+
inFallback?: () => boolean;
|
|
632
|
+
effects?: Computation<any>[];
|
|
633
|
+
resolved?: boolean;
|
|
549
634
|
};
|
|
550
635
|
type SuspenseContext = Context<SuspenseContextType | undefined> & {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
636
|
+
active?(): boolean;
|
|
637
|
+
increment?(): void;
|
|
638
|
+
decrement?(): void;
|
|
554
639
|
};
|
|
555
640
|
declare let SuspenseContext: SuspenseContext;
|
|
556
641
|
export declare function getSuspenseContext(): SuspenseContext;
|
|
557
642
|
export declare function enableExternalSource(factory: ExternalSourceFactory): void;
|
|
558
643
|
export declare function readSignal(this: SignalState<any> | Memo<any>): any;
|
|
559
|
-
export declare function writeSignal(
|
|
644
|
+
export declare function writeSignal(
|
|
645
|
+
node: SignalState<any> | Memo<any>,
|
|
646
|
+
value: any,
|
|
647
|
+
isComp?: boolean
|
|
648
|
+
): any;
|
|
560
649
|
/**
|
|
561
650
|
* @deprecated since version 1.7.0 and will be removed in next major - use catchError instead
|
|
562
651
|
* 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;
|