solid-js 2.0.0-beta.11 → 2.0.0-beta.13

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.
@@ -2,19 +2,28 @@ import type { Accessor, RevealOrder } from "@solidjs/signals";
2
2
  export type { RevealOrder };
3
3
  import type { Element as SolidElement } from "../types.js";
4
4
  type NonZeroParams<T extends (...args: any[]) => any> = Parameters<T>["length"] extends 0 ? never : T;
5
+ type ErrorAccessor = Accessor<unknown>;
5
6
  type ConditionalRenderCallback<T> = (item: Accessor<NonNullable<T>>) => SolidElement;
7
+ type KeyedConditionalRenderCallback<T> = (item: NonNullable<T>) => SolidElement;
6
8
  type ConditionalRenderChildren<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = SolidElement | NonZeroParams<F>;
9
+ type KeyedConditionalRenderChildren<T, F extends KeyedConditionalRenderCallback<T> = KeyedConditionalRenderCallback<T>> = SolidElement | NonZeroParams<F>;
7
10
  /**
8
11
  * Creates a list of elements from a list.
9
12
  *
10
- * Receives a map function as its child that takes list element and index
11
- * accessors and returns a JSX element; if the list is empty, an optional
12
- * `fallback` is rendered instead.
13
+ * Receives a map function as its child and returns a JSX element for each
14
+ * list item; if the list is empty, an optional `fallback` is rendered instead.
15
+ *
16
+ * The child callback shape follows the keying mode:
17
+ * - default / `keyed={true}` receives `(item, index)` where `item` is the raw
18
+ * row value and `index` is an accessor.
19
+ * - `keyed={false}` receives `(item, index)` where `item` is an accessor and
20
+ * `index` is a stable number.
21
+ * - `keyed={(item) => key}` receives accessors for both arguments.
13
22
  *
14
23
  * @example
15
24
  * ```tsx
16
25
  * <For each={items} fallback={<div>No items</div>}>
17
- * {(item, index) => <div data-index={index()}>{item()}</div>}
26
+ * {(item, index) => <div data-index={index()}>{item.label}</div>}
18
27
  * </For>
19
28
  * ```
20
29
  *
@@ -23,7 +32,19 @@ type ConditionalRenderChildren<T, F extends ConditionalRenderCallback<T> = Condi
23
32
  export declare function For<T extends readonly any[], U extends SolidElement>(props: {
24
33
  each: T | undefined | null | false;
25
34
  fallback?: SolidElement;
26
- keyed?: boolean | ((item: T[number]) => any);
35
+ keyed?: true;
36
+ children: (item: T[number], index: Accessor<number>) => U;
37
+ }): SolidElement;
38
+ export declare function For<T extends readonly any[], U extends SolidElement>(props: {
39
+ each: T | undefined | null | false;
40
+ fallback?: SolidElement;
41
+ keyed: false;
42
+ children: (item: Accessor<T[number]>, index: number) => U;
43
+ }): SolidElement;
44
+ export declare function For<T extends readonly any[], U extends SolidElement>(props: {
45
+ each: T | undefined | null | false;
46
+ fallback?: SolidElement;
47
+ keyed: (item: T[number]) => any;
27
48
  children: (item: Accessor<T[number]>, index: Accessor<number>) => U;
28
49
  }): SolidElement;
29
50
  /**
@@ -51,10 +72,10 @@ export declare function Repeat<T extends SolidElement>(props: {
51
72
  * Conditionally renders its children when `when` is truthy, otherwise renders
52
73
  * the optional `fallback`.
53
74
  *
54
- * The function-child form receives an accessor for the narrowed value call
55
- * it to read. Without `keyed` (default), the child is preserved across
56
- * truthy values; with `keyed`, the child remounts whenever the value's
57
- * identity changes.
75
+ * The function-child form receives a narrowed value. Without `keyed`
76
+ * (default), it receives an accessor and the child is preserved across truthy
77
+ * values; with `keyed`, it receives the raw value and remounts whenever the
78
+ * value's identity changes.
58
79
  *
59
80
  * @example
60
81
  * ```tsx
@@ -65,11 +86,29 @@ export declare function Repeat<T extends SolidElement>(props: {
65
86
  *
66
87
  * @description https://docs.solidjs.com/reference/components/show
67
88
  */
89
+ export declare function Show<T>(props: {
90
+ when: T | undefined | null | false;
91
+ keyed: true;
92
+ fallback?: SolidElement;
93
+ children: SolidElement;
94
+ }): SolidElement;
95
+ export declare function Show<T, F extends KeyedConditionalRenderCallback<T>>(props: {
96
+ when: T | undefined | null | false;
97
+ keyed: true;
98
+ fallback?: SolidElement;
99
+ children: NonZeroParams<F>;
100
+ }): SolidElement;
101
+ export declare function Show<T>(props: {
102
+ when: T | undefined | null | false;
103
+ keyed?: false;
104
+ fallback?: SolidElement;
105
+ children: SolidElement;
106
+ }): SolidElement;
68
107
  export declare function Show<T, F extends ConditionalRenderCallback<T>>(props: {
69
108
  when: T | undefined | null | false;
70
- keyed?: boolean;
109
+ keyed?: false;
71
110
  fallback?: SolidElement;
72
- children: ConditionalRenderChildren<T, F>;
111
+ children: NonZeroParams<F>;
73
112
  }): SolidElement;
74
113
  /**
75
114
  * Switches between content based on mutually exclusive conditions. Renders
@@ -96,15 +135,26 @@ export declare function Switch(props: {
96
135
  }): SolidElement;
97
136
  export type MatchProps<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = {
98
137
  when: T | undefined | null | false;
99
- keyed?: boolean;
138
+ keyed?: false;
100
139
  children: ConditionalRenderChildren<T, F>;
101
140
  };
141
+ export type KeyedMatchProps<T, F extends KeyedConditionalRenderCallback<T> = KeyedConditionalRenderCallback<T>> = {
142
+ when: T | undefined | null | false;
143
+ keyed: true;
144
+ children: KeyedConditionalRenderChildren<T, F>;
145
+ };
146
+ export type AnyMatchProps<T> = MatchProps<T> | KeyedMatchProps<T> | {
147
+ when: T | undefined | null | false;
148
+ keyed?: boolean;
149
+ children: SolidElement;
150
+ };
102
151
  /**
103
152
  * A branch inside a `<Switch>`. The first `<Match>` whose `when` is truthy
104
153
  * wins; remaining matches are skipped.
105
154
  *
106
- * Like `<Show>`, `<Match>` supports a function child that receives an
107
- * accessor for the narrowed value.
155
+ * Like `<Show>`, `<Match>` supports a function child. Non-keyed children
156
+ * receive an accessor for the narrowed value; keyed children receive the raw
157
+ * narrowed value.
108
158
  *
109
159
  * @example
110
160
  * ```tsx
@@ -120,7 +170,19 @@ export type MatchProps<T, F extends ConditionalRenderCallback<T> = ConditionalRe
120
170
  *
121
171
  * @description https://docs.solidjs.com/reference/components/switch-and-match
122
172
  */
173
+ export declare function Match<T>(props: {
174
+ when: T | undefined | null | false;
175
+ keyed: true;
176
+ children: SolidElement;
177
+ }): SolidElement;
178
+ export declare function Match<T, F extends KeyedConditionalRenderCallback<T>>(props: KeyedMatchProps<T, F>): SolidElement;
179
+ export declare function Match<T>(props: {
180
+ when: T | undefined | null | false;
181
+ keyed?: false;
182
+ children: SolidElement;
183
+ }): SolidElement;
123
184
  export declare function Match<T, F extends ConditionalRenderCallback<T>>(props: MatchProps<T, F>): SolidElement;
185
+ export declare function Match<T>(props: AnyMatchProps<T>): SolidElement;
124
186
  /**
125
187
  * Catches uncaught errors inside its subtree and renders fallback content
126
188
  * instead. The `fallback` prop can be a JSX element, or a callback that
@@ -132,7 +194,7 @@ export declare function Match<T, F extends ConditionalRenderCallback<T>>(props:
132
194
  * @example
133
195
  * ```tsx
134
196
  * <Errored fallback={(err, reset) => (
135
- * <div onClick={reset}>Error: {err.toString()}</div>
197
+ * <div onClick={reset}>Error: {err().toString()}</div>
136
198
  * )}>
137
199
  * <MyComp />
138
200
  * </Errored>
@@ -141,7 +203,7 @@ export declare function Match<T, F extends ConditionalRenderCallback<T>>(props:
141
203
  * @description https://docs.solidjs.com/reference/components/error-boundary
142
204
  */
143
205
  export declare function Errored(props: {
144
- fallback: SolidElement | ((err: any, reset: () => void) => SolidElement);
206
+ fallback: SolidElement | ((err: ErrorAccessor, reset: () => void) => SolidElement);
145
207
  children: SolidElement;
146
208
  }): SolidElement;
147
209
  /**
@@ -1,4 +1,4 @@
1
- import { createErrorBoundary as coreErrorBoundary, createRenderEffect as coreRenderEffect, createEffect as coreEffect, type ComputeFunction, type MemoOptions, type NoInfer, type ProjectionOptions, type Refreshable, type Signal, type SignalOptions, type SourceAccessor, type Store, type StoreSetter, type Context } from "@solidjs/signals";
1
+ import { createRenderEffect as coreRenderEffect, createEffect as coreEffect, type Accessor, type ComputeFunction, type MemoOptions, type NoInfer, type ProjectionOptions, type Refreshable, type Signal, type SignalOptions, type SourceAccessor, type Store, type StoreSetter, type Context } from "@solidjs/signals";
2
2
  import type { Element as SolidElement } from "../types.js";
3
3
  type HydrationSsrFields = {
4
4
  /**
@@ -201,8 +201,8 @@ export declare const createSignal: {
201
201
  /**
202
202
  * Lower-level primitive that backs the `<Errored>` flow control.
203
203
  * Catches errors thrown inside `fn` and renders `fallback(error,
204
- * reset)` instead. `reset()` recomputes the failing sources so the
205
- * boundary can attempt to recover.
204
+ * reset)` instead. `error` is an accessor for the latest captured error;
205
+ * `reset()` recomputes the failing sources so the boundary can attempt to recover.
206
206
  *
207
207
  * App code should use `<Errored fallback={...}>` directly — reach for
208
208
  * this only when authoring a custom boundary component.
@@ -216,20 +216,20 @@ export declare const createSignal: {
216
216
  * // Custom boundary built on the primitive — adds telemetry around the
217
217
  * // canonical `<Errored>` shape.
218
218
  * function TracedErrored(props: {
219
- * fallback: (e: unknown) => JSX.Element;
219
+ * fallback: (e: () => unknown) => JSX.Element;
220
220
  * children: JSX.Element;
221
221
  * }): JSX.Element {
222
222
  * return createErrorBoundary(
223
223
  * () => props.children,
224
224
  * (err, reset) => {
225
- * reportError(err);
225
+ * reportError(err());
226
226
  * return props.fallback(err);
227
227
  * }
228
228
  * ) as unknown as JSX.Element;
229
229
  * }
230
230
  * ```
231
231
  */
232
- export declare const createErrorBoundary: typeof coreErrorBoundary;
232
+ export declare const createErrorBoundary: <U>(fn: () => any, fallback: (error: Accessor<unknown>, reset: () => void) => U) => () => unknown;
233
233
  /**
234
234
  * Creates an optimistic signal — a `Signal<T>` whose writes are
235
235
  * tentative inside an `action` transition: they show up immediately,
@@ -3,16 +3,29 @@ import type { Element as SolidElement } from "../types.js";
3
3
  export type { RevealOrder };
4
4
  type NonZeroParams<T extends (...args: any[]) => any> = Parameters<T>["length"] extends 0 ? never : T;
5
5
  type ConditionalRenderCallback<T> = (item: Accessor<NonNullable<T>>) => SolidElement;
6
+ type KeyedConditionalRenderCallback<T> = (item: NonNullable<T>) => SolidElement;
6
7
  type ConditionalRenderChildren<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = SolidElement | NonZeroParams<F>;
8
+ type KeyedConditionalRenderChildren<T, F extends KeyedConditionalRenderCallback<T> = KeyedConditionalRenderCallback<T>> = SolidElement | NonZeroParams<F>;
7
9
  /**
8
10
  * Creates a list of elements from a list
9
- *
10
11
  * @description https://docs.solidjs.com/reference/components/for
11
12
  */
12
13
  export declare function For<T extends readonly any[], U extends SolidElement>(props: {
13
14
  each: T | undefined | null | false;
14
15
  fallback?: SolidElement;
15
- keyed?: boolean | ((item: T[number]) => any);
16
+ keyed?: true;
17
+ children: (item: T[number], index: Accessor<number>) => U;
18
+ }): SolidElement;
19
+ export declare function For<T extends readonly any[], U extends SolidElement>(props: {
20
+ each: T | undefined | null | false;
21
+ fallback?: SolidElement;
22
+ keyed: false;
23
+ children: (item: Accessor<T[number]>, index: number) => U;
24
+ }): SolidElement;
25
+ export declare function For<T extends readonly any[], U extends SolidElement>(props: {
26
+ each: T | undefined | null | false;
27
+ fallback?: SolidElement;
28
+ keyed: (item: T[number]) => any;
16
29
  children: (item: Accessor<T[number]>, index: Accessor<number>) => U;
17
30
  }): SolidElement;
18
31
  /**
@@ -30,11 +43,29 @@ export declare function Repeat<T extends SolidElement>(props: {
30
43
  * Conditionally render its children or an optional fallback component
31
44
  * @description https://docs.solidjs.com/reference/components/show
32
45
  */
46
+ export declare function Show<T>(props: {
47
+ when: T | undefined | null | false;
48
+ keyed: true;
49
+ fallback?: SolidElement;
50
+ children: SolidElement;
51
+ }): SolidElement;
52
+ export declare function Show<T, F extends KeyedConditionalRenderCallback<T>>(props: {
53
+ when: T | undefined | null | false;
54
+ keyed: true;
55
+ fallback?: SolidElement;
56
+ children: NonZeroParams<F>;
57
+ }): SolidElement;
58
+ export declare function Show<T>(props: {
59
+ when: T | undefined | null | false;
60
+ keyed?: false;
61
+ fallback?: SolidElement;
62
+ children: SolidElement;
63
+ }): SolidElement;
33
64
  export declare function Show<T, F extends ConditionalRenderCallback<T>>(props: {
34
65
  when: T | undefined | null | false;
35
- keyed?: boolean;
66
+ keyed?: false;
36
67
  fallback?: SolidElement;
37
- children: ConditionalRenderChildren<T, F>;
68
+ children: NonZeroParams<F>;
38
69
  }): SolidElement;
39
70
  /**
40
71
  * Switches between content based on mutually exclusive conditions
@@ -46,20 +77,42 @@ export declare function Switch(props: {
46
77
  }): SolidElement;
47
78
  export type MatchProps<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = {
48
79
  when: T | undefined | null | false;
49
- keyed?: boolean;
80
+ keyed?: false;
50
81
  children: ConditionalRenderChildren<T, F>;
51
82
  };
83
+ export type KeyedMatchProps<T, F extends KeyedConditionalRenderCallback<T> = KeyedConditionalRenderCallback<T>> = {
84
+ when: T | undefined | null | false;
85
+ keyed: true;
86
+ children: KeyedConditionalRenderChildren<T, F>;
87
+ };
88
+ export type AnyMatchProps<T> = MatchProps<T> | KeyedMatchProps<T> | {
89
+ when: T | undefined | null | false;
90
+ keyed?: boolean;
91
+ children: SolidElement;
92
+ };
52
93
  /**
53
94
  * Selects a content based on condition when inside a `<Switch>` control flow
54
95
  * @description https://docs.solidjs.com/reference/components/switch-and-match
55
96
  */
97
+ export declare function Match<T>(props: {
98
+ when: T | undefined | null | false;
99
+ keyed: true;
100
+ children: SolidElement;
101
+ }): SolidElement;
102
+ export declare function Match<T, F extends KeyedConditionalRenderCallback<T>>(props: KeyedMatchProps<T, F>): SolidElement;
103
+ export declare function Match<T>(props: {
104
+ when: T | undefined | null | false;
105
+ keyed?: false;
106
+ children: SolidElement;
107
+ }): SolidElement;
56
108
  export declare function Match<T, F extends ConditionalRenderCallback<T>>(props: MatchProps<T, F>): SolidElement;
109
+ export declare function Match<T>(props: AnyMatchProps<T>): SolidElement;
57
110
  /**
58
111
  * Catches uncaught errors inside components and renders a fallback content
59
112
  * @description https://docs.solidjs.com/reference/components/error-boundary
60
113
  */
61
114
  export declare function Errored(props: {
62
- fallback: SolidElement | ((err: any, reset: () => void) => SolidElement);
115
+ fallback: SolidElement | ((err: () => any, reset: () => void) => SolidElement);
63
116
  children: SolidElement;
64
117
  }): SolidElement;
65
118
  /**
@@ -2,11 +2,11 @@ import { $REFRESH } from "@solidjs/signals";
2
2
  export { $REFRESH };
3
3
  export { NotReadyError, NoOwnerError, ContextNotFoundError, isEqual, isWrappable, SUPPORTS_PROXY, enableExternalSource, enforceLoadingBoundary } from "@solidjs/signals";
4
4
  export { flatten } from "@solidjs/signals";
5
- export { snapshot, merge, omit, storePath, $PROXY, $TRACK } from "@solidjs/signals";
5
+ export { snapshot, omit, storePath, $PROXY, $TRACK } from "@solidjs/signals";
6
6
  import type { Accessor as SignalAccessor, Refreshable } from "@solidjs/signals";
7
7
  export type SourceAccessor<T> = Refreshable<SignalAccessor<T>>;
8
8
  export type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, ExternalSource, ExternalSourceConfig, ExternalSourceFactory, MemoOptions, NoInfer, SignalOptions, Setter, Signal, Owner, Refreshable, Maybe, Store, StoreSetter, StoreNode, NotWrappable, SolidStore, Merge, Omit, Context, ContextRecord, IQueue, StorePathRange, ArrayFilterFn, CustomPartial, Part, PathSetter } from "@solidjs/signals";
9
- import type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, MemoOptions, SignalOptions, Signal, Owner, Store, StoreSetter, Context } from "@solidjs/signals";
9
+ import type { Accessor, ComputeFunction, EffectFunction, EffectBundle, EffectOptions, MemoOptions, SignalOptions, Signal, Merge, Owner, Store, StoreSetter, Context } from "@solidjs/signals";
10
10
  import { sharedConfig, NoHydrateContext } from "./shared.js";
11
11
  type Disposable = () => void;
12
12
  export declare function getNextChildId(owner: Owner): string;
@@ -90,8 +90,17 @@ export declare const createOptimisticStore: typeof createStore;
90
90
  export declare function createProjection<T extends object>(fn: (draft: T) => void | T | Promise<void | T> | AsyncIterable<void | T>, initialValue: Partial<T>, options?: ServerSsrOptions): Store<T>;
91
91
  export declare function reconcile<T extends U, U extends object>(value: T): (state: U) => T;
92
92
  export declare function deep<T extends object>(store: Store<T>): Store<T>;
93
- export declare function mapArray<T, U>(list: Accessor<readonly T[] | undefined | null | false>, mapFn: (v: Accessor<T>, i: Accessor<number>) => U, options?: {
94
- keyed?: boolean | ((item: T) => any);
93
+ export declare function merge<T extends unknown[]>(...sources: T): Merge<T>;
94
+ export declare function mapArray<T, U>(list: Accessor<readonly T[] | undefined | null | false>, mapFn: (v: T, i: Accessor<number>) => U, options?: {
95
+ keyed?: true;
96
+ fallback?: Accessor<any>;
97
+ }): () => U[];
98
+ export declare function mapArray<T, U>(list: Accessor<readonly T[] | undefined | null | false>, mapFn: (v: Accessor<T>, i: number) => U, options: {
99
+ keyed: false;
100
+ fallback?: Accessor<any>;
101
+ }): () => U[];
102
+ export declare function mapArray<T, U>(list: Accessor<readonly T[] | undefined | null | false>, mapFn: (v: Accessor<T>, i: Accessor<number>) => U, options: {
103
+ keyed: (item: T) => any;
95
104
  fallback?: Accessor<any>;
96
105
  }): () => U[];
97
106
  export declare function repeat<T>(count: Accessor<number>, mapFn: (i: number) => T, options?: {
@@ -102,7 +111,7 @@ declare const ErrorContext: Context<((err: any) => void) | null>;
102
111
  export { ErrorContext };
103
112
  export declare function runWithBoundaryErrorContext<T>(owner: Owner, render: () => T, onError: (err: any, parentHandler: ((err: any) => void) | null) => void, context?: NonNullable<typeof sharedConfig.context>, boundaryId?: string): T;
104
113
  export { NoHydrateContext };
105
- export declare function createErrorBoundary<U>(fn: () => any, fallback: (error: unknown, reset: () => void) => U): () => unknown;
114
+ export declare function createErrorBoundary<U>(fn: () => any, fallback: (error: Accessor<unknown>, reset: () => void) => U): () => unknown;
106
115
  export declare function createLoadingBoundary(fn: () => any, fallback: () => any, options?: {
107
116
  on?: () => any;
108
117
  }): () => unknown;
@@ -114,7 +123,7 @@ export declare function createRevealOrder<T>(fn: () => T, _options?: {
114
123
  export declare function untrack<T>(fn: () => T): T;
115
124
  export declare function flush(): void;
116
125
  export declare function resolve<T>(fn: () => T): Promise<T>;
117
- export declare function isPending(fn: () => any, fallback?: boolean): boolean;
126
+ export declare function isPending(fn: () => any, loading?: boolean): boolean;
118
127
  export declare function latest<T>(fn: () => T): T;
119
128
  export declare function isRefreshing(): boolean;
120
129
  export declare function refresh<T>(_target: Refreshable<T>): void;
@@ -2,19 +2,28 @@ import type { Accessor, RevealOrder } from "@solidjs/signals";
2
2
  export type { RevealOrder };
3
3
  import type { Element as SolidElement } from "../types.cjs";
4
4
  type NonZeroParams<T extends (...args: any[]) => any> = Parameters<T>["length"] extends 0 ? never : T;
5
+ type ErrorAccessor = Accessor<unknown>;
5
6
  type ConditionalRenderCallback<T> = (item: Accessor<NonNullable<T>>) => SolidElement;
7
+ type KeyedConditionalRenderCallback<T> = (item: NonNullable<T>) => SolidElement;
6
8
  type ConditionalRenderChildren<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = SolidElement | NonZeroParams<F>;
9
+ type KeyedConditionalRenderChildren<T, F extends KeyedConditionalRenderCallback<T> = KeyedConditionalRenderCallback<T>> = SolidElement | NonZeroParams<F>;
7
10
  /**
8
11
  * Creates a list of elements from a list.
9
12
  *
10
- * Receives a map function as its child that takes list element and index
11
- * accessors and returns a JSX element; if the list is empty, an optional
12
- * `fallback` is rendered instead.
13
+ * Receives a map function as its child and returns a JSX element for each
14
+ * list item; if the list is empty, an optional `fallback` is rendered instead.
15
+ *
16
+ * The child callback shape follows the keying mode:
17
+ * - default / `keyed={true}` receives `(item, index)` where `item` is the raw
18
+ * row value and `index` is an accessor.
19
+ * - `keyed={false}` receives `(item, index)` where `item` is an accessor and
20
+ * `index` is a stable number.
21
+ * - `keyed={(item) => key}` receives accessors for both arguments.
13
22
  *
14
23
  * @example
15
24
  * ```tsx
16
25
  * <For each={items} fallback={<div>No items</div>}>
17
- * {(item, index) => <div data-index={index()}>{item()}</div>}
26
+ * {(item, index) => <div data-index={index()}>{item.label}</div>}
18
27
  * </For>
19
28
  * ```
20
29
  *
@@ -23,7 +32,19 @@ type ConditionalRenderChildren<T, F extends ConditionalRenderCallback<T> = Condi
23
32
  export declare function For<T extends readonly any[], U extends SolidElement>(props: {
24
33
  each: T | undefined | null | false;
25
34
  fallback?: SolidElement;
26
- keyed?: boolean | ((item: T[number]) => any);
35
+ keyed?: true;
36
+ children: (item: T[number], index: Accessor<number>) => U;
37
+ }): SolidElement;
38
+ export declare function For<T extends readonly any[], U extends SolidElement>(props: {
39
+ each: T | undefined | null | false;
40
+ fallback?: SolidElement;
41
+ keyed: false;
42
+ children: (item: Accessor<T[number]>, index: number) => U;
43
+ }): SolidElement;
44
+ export declare function For<T extends readonly any[], U extends SolidElement>(props: {
45
+ each: T | undefined | null | false;
46
+ fallback?: SolidElement;
47
+ keyed: (item: T[number]) => any;
27
48
  children: (item: Accessor<T[number]>, index: Accessor<number>) => U;
28
49
  }): SolidElement;
29
50
  /**
@@ -51,10 +72,10 @@ export declare function Repeat<T extends SolidElement>(props: {
51
72
  * Conditionally renders its children when `when` is truthy, otherwise renders
52
73
  * the optional `fallback`.
53
74
  *
54
- * The function-child form receives an accessor for the narrowed value call
55
- * it to read. Without `keyed` (default), the child is preserved across
56
- * truthy values; with `keyed`, the child remounts whenever the value's
57
- * identity changes.
75
+ * The function-child form receives a narrowed value. Without `keyed`
76
+ * (default), it receives an accessor and the child is preserved across truthy
77
+ * values; with `keyed`, it receives the raw value and remounts whenever the
78
+ * value's identity changes.
58
79
  *
59
80
  * @example
60
81
  * ```tsx
@@ -65,11 +86,29 @@ export declare function Repeat<T extends SolidElement>(props: {
65
86
  *
66
87
  * @description https://docs.solidjs.com/reference/components/show
67
88
  */
89
+ export declare function Show<T>(props: {
90
+ when: T | undefined | null | false;
91
+ keyed: true;
92
+ fallback?: SolidElement;
93
+ children: SolidElement;
94
+ }): SolidElement;
95
+ export declare function Show<T, F extends KeyedConditionalRenderCallback<T>>(props: {
96
+ when: T | undefined | null | false;
97
+ keyed: true;
98
+ fallback?: SolidElement;
99
+ children: NonZeroParams<F>;
100
+ }): SolidElement;
101
+ export declare function Show<T>(props: {
102
+ when: T | undefined | null | false;
103
+ keyed?: false;
104
+ fallback?: SolidElement;
105
+ children: SolidElement;
106
+ }): SolidElement;
68
107
  export declare function Show<T, F extends ConditionalRenderCallback<T>>(props: {
69
108
  when: T | undefined | null | false;
70
- keyed?: boolean;
109
+ keyed?: false;
71
110
  fallback?: SolidElement;
72
- children: ConditionalRenderChildren<T, F>;
111
+ children: NonZeroParams<F>;
73
112
  }): SolidElement;
74
113
  /**
75
114
  * Switches between content based on mutually exclusive conditions. Renders
@@ -96,15 +135,26 @@ export declare function Switch(props: {
96
135
  }): SolidElement;
97
136
  export type MatchProps<T, F extends ConditionalRenderCallback<T> = ConditionalRenderCallback<T>> = {
98
137
  when: T | undefined | null | false;
99
- keyed?: boolean;
138
+ keyed?: false;
100
139
  children: ConditionalRenderChildren<T, F>;
101
140
  };
141
+ export type KeyedMatchProps<T, F extends KeyedConditionalRenderCallback<T> = KeyedConditionalRenderCallback<T>> = {
142
+ when: T | undefined | null | false;
143
+ keyed: true;
144
+ children: KeyedConditionalRenderChildren<T, F>;
145
+ };
146
+ export type AnyMatchProps<T> = MatchProps<T> | KeyedMatchProps<T> | {
147
+ when: T | undefined | null | false;
148
+ keyed?: boolean;
149
+ children: SolidElement;
150
+ };
102
151
  /**
103
152
  * A branch inside a `<Switch>`. The first `<Match>` whose `when` is truthy
104
153
  * wins; remaining matches are skipped.
105
154
  *
106
- * Like `<Show>`, `<Match>` supports a function child that receives an
107
- * accessor for the narrowed value.
155
+ * Like `<Show>`, `<Match>` supports a function child. Non-keyed children
156
+ * receive an accessor for the narrowed value; keyed children receive the raw
157
+ * narrowed value.
108
158
  *
109
159
  * @example
110
160
  * ```tsx
@@ -120,7 +170,19 @@ export type MatchProps<T, F extends ConditionalRenderCallback<T> = ConditionalRe
120
170
  *
121
171
  * @description https://docs.solidjs.com/reference/components/switch-and-match
122
172
  */
173
+ export declare function Match<T>(props: {
174
+ when: T | undefined | null | false;
175
+ keyed: true;
176
+ children: SolidElement;
177
+ }): SolidElement;
178
+ export declare function Match<T, F extends KeyedConditionalRenderCallback<T>>(props: KeyedMatchProps<T, F>): SolidElement;
179
+ export declare function Match<T>(props: {
180
+ when: T | undefined | null | false;
181
+ keyed?: false;
182
+ children: SolidElement;
183
+ }): SolidElement;
123
184
  export declare function Match<T, F extends ConditionalRenderCallback<T>>(props: MatchProps<T, F>): SolidElement;
185
+ export declare function Match<T>(props: AnyMatchProps<T>): SolidElement;
124
186
  /**
125
187
  * Catches uncaught errors inside its subtree and renders fallback content
126
188
  * instead. The `fallback` prop can be a JSX element, or a callback that
@@ -132,7 +194,7 @@ export declare function Match<T, F extends ConditionalRenderCallback<T>>(props:
132
194
  * @example
133
195
  * ```tsx
134
196
  * <Errored fallback={(err, reset) => (
135
- * <div onClick={reset}>Error: {err.toString()}</div>
197
+ * <div onClick={reset}>Error: {err().toString()}</div>
136
198
  * )}>
137
199
  * <MyComp />
138
200
  * </Errored>
@@ -141,7 +203,7 @@ export declare function Match<T, F extends ConditionalRenderCallback<T>>(props:
141
203
  * @description https://docs.solidjs.com/reference/components/error-boundary
142
204
  */
143
205
  export declare function Errored(props: {
144
- fallback: SolidElement | ((err: any, reset: () => void) => SolidElement);
206
+ fallback: SolidElement | ((err: ErrorAccessor, reset: () => void) => SolidElement);
145
207
  children: SolidElement;
146
208
  }): SolidElement;
147
209
  /**
@@ -1,4 +1,4 @@
1
- import { createErrorBoundary as coreErrorBoundary, createRenderEffect as coreRenderEffect, createEffect as coreEffect, type ComputeFunction, type MemoOptions, type NoInfer, type ProjectionOptions, type Refreshable, type Signal, type SignalOptions, type SourceAccessor, type Store, type StoreSetter, type Context } from "@solidjs/signals";
1
+ import { createRenderEffect as coreRenderEffect, createEffect as coreEffect, type Accessor, type ComputeFunction, type MemoOptions, type NoInfer, type ProjectionOptions, type Refreshable, type Signal, type SignalOptions, type SourceAccessor, type Store, type StoreSetter, type Context } from "@solidjs/signals";
2
2
  import type { Element as SolidElement } from "../types.cjs";
3
3
  type HydrationSsrFields = {
4
4
  /**
@@ -201,8 +201,8 @@ export declare const createSignal: {
201
201
  /**
202
202
  * Lower-level primitive that backs the `<Errored>` flow control.
203
203
  * Catches errors thrown inside `fn` and renders `fallback(error,
204
- * reset)` instead. `reset()` recomputes the failing sources so the
205
- * boundary can attempt to recover.
204
+ * reset)` instead. `error` is an accessor for the latest captured error;
205
+ * `reset()` recomputes the failing sources so the boundary can attempt to recover.
206
206
  *
207
207
  * App code should use `<Errored fallback={...}>` directly — reach for
208
208
  * this only when authoring a custom boundary component.
@@ -216,20 +216,20 @@ export declare const createSignal: {
216
216
  * // Custom boundary built on the primitive — adds telemetry around the
217
217
  * // canonical `<Errored>` shape.
218
218
  * function TracedErrored(props: {
219
- * fallback: (e: unknown) => JSX.Element;
219
+ * fallback: (e: () => unknown) => JSX.Element;
220
220
  * children: JSX.Element;
221
221
  * }): JSX.Element {
222
222
  * return createErrorBoundary(
223
223
  * () => props.children,
224
224
  * (err, reset) => {
225
- * reportError(err);
225
+ * reportError(err());
226
226
  * return props.fallback(err);
227
227
  * }
228
228
  * ) as unknown as JSX.Element;
229
229
  * }
230
230
  * ```
231
231
  */
232
- export declare const createErrorBoundary: typeof coreErrorBoundary;
232
+ export declare const createErrorBoundary: <U>(fn: () => any, fallback: (error: Accessor<unknown>, reset: () => void) => U) => () => unknown;
233
233
  /**
234
234
  * Creates an optimistic signal — a `Signal<T>` whose writes are
235
235
  * tentative inside an `action` transition: they show up immediately,