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.
Files changed (52) hide show
  1. package/README.md +223 -223
  2. package/dist/dev.cjs +29 -24
  3. package/dist/dev.js +344 -580
  4. package/dist/server.cjs +31 -18
  5. package/dist/server.js +103 -185
  6. package/dist/solid.cjs +29 -24
  7. package/dist/solid.js +302 -507
  8. package/h/dist/h.cjs +12 -1
  9. package/h/dist/h.js +19 -34
  10. package/h/jsx-runtime/dist/jsx.js +1 -1
  11. package/h/jsx-runtime/types/index.d.ts +8 -11
  12. package/h/jsx-runtime/types/jsx.d.ts +5 -0
  13. package/h/types/hyperscript.d.ts +11 -11
  14. package/html/dist/html.js +94 -216
  15. package/html/types/lit.d.ts +33 -47
  16. package/package.json +3 -3
  17. package/store/dist/dev.js +43 -122
  18. package/store/dist/server.js +8 -19
  19. package/store/dist/store.js +40 -113
  20. package/store/types/index.d.ts +7 -21
  21. package/store/types/modifiers.d.ts +3 -6
  22. package/store/types/mutable.d.ts +2 -5
  23. package/store/types/server.d.ts +4 -12
  24. package/store/types/store.d.ts +62 -219
  25. package/types/index.d.ts +10 -75
  26. package/types/jsx.d.ts +5 -0
  27. package/types/reactive/array.d.ts +6 -14
  28. package/types/reactive/observable.d.ts +18 -26
  29. package/types/reactive/scheduler.d.ts +6 -9
  30. package/types/reactive/signal.d.ts +164 -255
  31. package/types/render/Suspense.d.ts +7 -7
  32. package/types/render/component.d.ts +33 -64
  33. package/types/render/flow.d.ts +37 -49
  34. package/types/render/hydration.d.ts +15 -13
  35. package/types/server/index.d.ts +2 -57
  36. package/types/server/reactive.d.ts +42 -73
  37. package/types/server/rendering.d.ts +99 -168
  38. package/universal/dist/dev.js +12 -28
  39. package/universal/dist/universal.js +12 -28
  40. package/universal/types/index.d.ts +1 -3
  41. package/universal/types/universal.d.ts +1 -0
  42. package/web/dist/dev.cjs +6 -4
  43. package/web/dist/dev.js +88 -630
  44. package/web/dist/server.cjs +6 -6
  45. package/web/dist/server.js +102 -216
  46. package/web/dist/web.cjs +6 -4
  47. package/web/dist/web.js +86 -621
  48. package/web/storage/dist/storage.js +3 -3
  49. package/web/types/client.d.ts +2 -2
  50. package/web/types/core.d.ts +1 -10
  51. package/web/types/index.d.ts +12 -29
  52. 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
- afterUpdate: (() => void) | null;
36
- afterCreateOwner: ((owner: Owner) => void) | null;
37
- afterCreateSignal: ((signal: SignalState<any>) => void) | null;
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
- value: unknown;
42
- name?: string;
43
- graph?: Owner;
41
+ value: unknown;
42
+ name?: string;
43
+ graph?: Owner;
44
44
  }
45
45
  export interface SignalState<T> extends SourceMapValue {
46
- value: T;
47
- observers: Computation<any>[] | null;
48
- observerSlots: number[] | null;
49
- tValue?: T;
50
- comparator?: (prev: T, next: T) => boolean;
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
- owned: Computation<any>[] | null;
54
- cleanups: (() => void)[] | null;
55
- owner: Owner | null;
56
- context: any | null;
57
- sourceMap?: SourceMapValue[];
58
- name?: string;
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
- 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;
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
- 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;
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
- track: EffectFunction<any, any>;
89
- dispose: () => void;
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://www.solidjs.com/docs/latest/api#createroot
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
- <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;
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
- internal?: boolean;
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://www.solidjs.com/docs/latest/api#createsignal
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
- name?: string;
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://www.solidjs.com/docs/latest/api#createcomputed
155
+ * @description https://docs.solidjs.com/reference/secondary-primitives/create-computed
160
156
  */
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;
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://www.solidjs.com/docs/latest/api#createrendereffect
172
+ * @description https://docs.solidjs.com/reference/secondary-primitives/create-render-effect
183
173
  */
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;
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://www.solidjs.com/docs/latest/api#createeffect
189
+ * @description https://docs.solidjs.com/reference/basic-reactivity/create-effect
206
190
  */
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 & {
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://www.solidjs.com/docs/latest/api#createreaction
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
- value: Next;
236
- tOwned?: Computation<Prev | Next, Next>[];
210
+ value: Next;
211
+ tOwned?: Computation<Prev | Next, Next>[];
237
212
  }
238
213
  export interface MemoOptions<T> extends EffectOptions {
239
- equals?: false | ((prev: T, next: T) => boolean);
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://www.solidjs.com/docs/latest/api#creatememo
229
+ * @description https://docs.solidjs.com/reference/basic-reactivity/create-memo
255
230
  */
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>;
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
- state: "unresolved";
266
- loading: false;
267
- error: undefined;
268
- latest: undefined;
269
- (): undefined;
234
+ state: "unresolved";
235
+ loading: false;
236
+ error: undefined;
237
+ latest: undefined;
238
+ (): undefined;
270
239
  }
271
240
  interface Pending {
272
- state: "pending";
273
- loading: true;
274
- error: undefined;
275
- latest: undefined;
276
- (): undefined;
241
+ state: "pending";
242
+ loading: true;
243
+ error: undefined;
244
+ latest: undefined;
245
+ (): undefined;
277
246
  }
278
247
  interface Ready<T> {
279
- state: "ready";
280
- loading: false;
281
- error: undefined;
282
- latest: T;
283
- (): T;
248
+ state: "ready";
249
+ loading: false;
250
+ error: undefined;
251
+ latest: T;
252
+ (): T;
284
253
  }
285
254
  interface Refreshing<T> {
286
- state: "refreshing";
287
- loading: true;
288
- error: undefined;
289
- latest: T;
290
- (): T;
255
+ state: "refreshing";
256
+ loading: true;
257
+ error: undefined;
258
+ latest: T;
259
+ (): T;
291
260
  }
292
261
  interface Errored {
293
- state: "errored";
294
- loading: false;
295
- error: any;
296
- latest: never;
297
- (): never;
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
- mutate: Setter<T>;
303
- refetch: (info?: R) => T | Promise<T> | undefined | null;
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
- value: T | undefined;
312
- refetching: R | boolean;
277
+ value: T | undefined;
278
+ refetching: R | boolean;
313
279
  };
314
280
  export type ResourceOptions<T, S = unknown> = {
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;
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
- initialValue: T;
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
- InitializedResource<T>,
333
- ResourceActions<T, R>
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://www.solidjs.com/docs/latest/api#createresource
324
+ * @description https://docs.solidjs.com/reference/basic-reactivity/create-resource
362
325
  */
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>;
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
- equals?: false | ((prev: T, next: T) => boolean);
383
- name?: string;
384
- timeoutMs?: number;
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://www.solidjs.com/docs/latest/api#createdeferred
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://www.solidjs.com/docs/latest/api#createselector
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://www.solidjs.com/docs/latest/api#batch
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://www.solidjs.com/docs/latest/api#untrack
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
- [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;
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
- defer?: boolean;
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://www.solidjs.com/docs/latest/api#on
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
- ): 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>>;
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://www.solidjs.com/docs/latest/api#onmount
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://www.solidjs.com/docs/latest/api#oncleanup
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://www.solidjs.com/docs/latest/api#catcherror
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://www.solidjs.com/docs/latest/api#usetransition
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://www.solidjs.com/docs/latest/api#usetransition
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
- props: T;
568
- name: string;
569
- component: (props: T) => unknown;
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
- value: T;
493
+ value: T;
575
494
  }>;
576
495
  export interface Context<T> {
577
- id: symbol;
578
- Provider: ContextProviderComponent<T>;
579
- defaultValue: T;
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://www.solidjs.com/docs/latest/api#createcontext
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://www.solidjs.com/docs/latest/api#usecontext
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
- toArray: () => ResolvedJSXElement[];
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://www.solidjs.com/docs/latest/api#children
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
- increment?: () => void;
630
- decrement?: () => void;
631
- inFallback?: () => boolean;
632
- effects?: Computation<any>[];
633
- resolved?: boolean;
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
- active?(): boolean;
637
- increment?(): void;
638
- decrement?(): void;
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 {};