import type { Accessor, RevealOrder } from "@solidjs/signals"; export type { RevealOrder }; import type { Element as SolidElement } from "../types.js"; type NonZeroParams any> = Parameters["length"] extends 0 ? never : T; type ErrorAccessor = Accessor; type ConditionalRenderCallback = (item: Accessor>) => SolidElement; type KeyedConditionalRenderCallback = (item: NonNullable) => SolidElement; type ConditionalRenderChildren = ConditionalRenderCallback> = SolidElement | NonZeroParams; type KeyedConditionalRenderChildren = KeyedConditionalRenderCallback> = SolidElement | NonZeroParams; /** * Creates a list of elements from a list. * * Receives a map function as its child and returns a JSX element for each * list item; if the list is empty, an optional `fallback` is rendered instead. * * The child callback shape follows the keying mode: * - default / `keyed={true}` receives `(item, index)` where `item` is the raw * row value and `index` is an accessor. * - `keyed={false}` receives `(item, index)` where `item` is an accessor and * `index` is a stable number. * - `keyed={(item) => key}` receives accessors for both arguments. * * @example * ```tsx * No items}> * {(item, index) =>
{item.label}
} *
* ``` * * @description https://docs.solidjs.com/reference/solid-js/components-jsx/for */ export declare function For(props: { each: T | undefined | null | false; fallback?: SolidElement; keyed?: true; children: (item: T[number], index: Accessor) => U; }): SolidElement; export declare function For(props: { each: T | undefined | null | false; fallback?: SolidElement; keyed: false; children: (item: Accessor, index: number) => U; }): SolidElement; export declare function For(props: { each: T | undefined | null | false; fallback?: SolidElement; keyed: (item: T[number]) => any; children: (item: Accessor, index: Accessor) => U; }): SolidElement; /** * Creates a list of elements from a count. * * Receives a map function as its child that takes the index and returns a JSX * element; if the count is zero, an optional `fallback` is rendered instead. * * @example * ```tsx * No items}> * {(index) =>
{items[index]}
} *
* ``` * * @description https://docs.solidjs.com/reference/solid-js/components-jsx/repeat */ export declare function Repeat(props: { count: number; from?: number | undefined; fallback?: SolidElement; children: ((index: number) => T) | T; }): SolidElement; /** * Conditionally renders its children when `when` is truthy, otherwise renders * the optional `fallback`. * * The function-child form receives a narrowed value. Without `keyed` * (default), it receives an accessor and the child is preserved across truthy * values; with `keyed`, it receives the raw value and remounts whenever the * value's identity changes. * * @example * ```tsx * }> * {u => } * * ``` * * @description https://docs.solidjs.com/reference/solid-js/components-jsx/show */ export declare function Show(props: { when: T | undefined | null | false; keyed: true; fallback?: SolidElement; children: SolidElement; }): SolidElement; export declare function Show>(props: { when: T | undefined | null | false; keyed: true; fallback?: SolidElement; children: NonZeroParams; }): SolidElement; export declare function Show(props: { when: T | undefined | null | false; keyed?: false; fallback?: SolidElement; children: SolidElement; }): SolidElement; export declare function Show>(props: { when: T | undefined | null | false; keyed?: false; fallback?: SolidElement; children: NonZeroParams; }): SolidElement; /** * Switches between content based on mutually exclusive conditions. Renders * the first `` whose `when` is truthy; falls back to `fallback` when * none match. * * @example * ```tsx * }> * * * * * * * * ``` * * @description https://docs.solidjs.com/reference/solid-js/components-jsx/switch-and-match */ export declare function Switch(props: { fallback?: SolidElement; children: SolidElement; }): SolidElement; export type MatchProps = ConditionalRenderCallback> = { when: T | undefined | null | false; keyed?: false; children: ConditionalRenderChildren; }; export type KeyedMatchProps = KeyedConditionalRenderCallback> = { when: T | undefined | null | false; keyed: true; children: KeyedConditionalRenderChildren; }; export type AnyMatchProps = MatchProps | KeyedMatchProps | { when: T | undefined | null | false; keyed?: boolean; children: SolidElement; }; /** * A branch inside a ``. The first `` whose `when` is truthy * wins; remaining matches are skipped. * * Like ``, `` supports a function child. Non-keyed children * receive an accessor for the narrowed value; keyed children receive the raw * narrowed value. * * @example * ```tsx * }> * * {u => } * * * * * * ``` * * @description https://docs.solidjs.com/reference/solid-js/components-jsx/switch-and-match */ export declare function Match(props: { when: T | undefined | null | false; keyed: true; children: SolidElement; }): SolidElement; export declare function Match>(props: KeyedMatchProps): SolidElement; export declare function Match(props: { when: T | undefined | null | false; keyed?: false; children: SolidElement; }): SolidElement; export declare function Match>(props: MatchProps): SolidElement; export declare function Match(props: AnyMatchProps): SolidElement; /** * Catches uncaught errors inside its subtree and renders fallback content * instead. The `fallback` prop can be a JSX element, or a callback that * receives the error and a `reset()` function for retry affordances. * * Errors thrown from the fallback itself can be caught by a parent * ``. * * @example * ```tsx * ( *
Error: {err().toString()}
* )}> * *
* ``` * * @description https://docs.solidjs.com/reference/solid-js/components-jsx/errored */ export declare function Errored(props: { fallback: SolidElement | ((err: ErrorAccessor, reset: () => void) => SolidElement); children: SolidElement; }): SolidElement; /** * Renders a `fallback` while pending async reads inside the subtree settle. * * Any computation (`createMemo`, `createSignal(fn)`, `createStore(fn)`, * `lazy(...)`, etc.) that throws because data isn't ready is caught by the * nearest enclosing ``. The boundary swaps to its `fallback` until * every pending read has resolved, then renders the children. * * Once content has rendered, a refetch keeps it visible: the boundary reads * the pending value like any other reader and holds the write that made it * pending until the data lands (`isPending()` flips meanwhile). * * The optional `on` prop is a dependency list. The expression is tracked and * its value is irrelevant — what matters is what it reads. Whenever anything * it reads changes (a plain write, an optimistic write, a source going * pending or landing), the boundary stops waiting on its current content and * shows `fallback` again if something under it is still pending, until the * new content is ready; if nothing is pending, nothing happens. The fallback * lands with the same frame as the change that caused it: immediately when * nothing else holds that frame; together with the rest of the new page * during a held navigation (a write inside an `action`, or one whose data * other readers are still waiting on) — never a spinner beside a page the * change has not reached yet. If the same data is also read outside the * boundary, the frame waits on it and the fallback can never be seen; DEV * warns `LOADING_ON_OUTSIDE_HOLD`, and the fix is structural — move the * outside read under the boundary so one hold owns the data. A frame held * past the content's landing by something else (the write's action, other * pending data) shows no fallback either; that is a race, a legitimate * outcome, and not reported — show the wait with `isPending()` instead. * A display-ahead read in `on` (`latest()`) shows the fallback now, beside * the held frame; that is a capability, not the recommended shape. The * children are not re-created; they stay alive behind the fallback. * * Scope `` around the data-dependent slot, not the surrounding * shell. Wrapping layout chrome (header, nav, footer) in the same boundary * as the data means revalidation replaces the entire screen with the * fallback; rendering chrome outside the boundary keeps it stable while * only the affordance flips. * * @example * ```tsx * const Profile = lazy(() => import("./Profile")); * * }> * * * ``` * * @example * ```tsx * // Depend on the route: a navigation shows the skeleton with the new route * // while the page loads; a refetch of the same route keeps the page visible. * } on={route()}> * * * * // Several dependencies: a change to any of them shows the fallback. * } on={[query(), page()]}> * * * ``` * * @description https://docs.solidjs.com/reference/solid-js/components-jsx/loading */ export declare function Loading(props: { fallback?: SolidElement; on?: any; children: SolidElement; }): SolidElement; export type RevealProps = { order?: RevealOrder; collapsed?: boolean; children: SolidElement; }; /** * Coordinates the reveal timing of sibling `` boundaries. * * The `order` prop picks the reveal policy: * - `"sequential"` (default) — boundaries reveal in registration order; later boundaries * stay on their fallback until earlier ones resolve. * - `"together"` — every direct slot stays on its fallback until the whole group is * "minimally ready" (every direct slot has its own first visible content available), * then the group releases in one cohesive reveal. * - `"natural"` — each boundary reveals as its own data resolves. At the top level * this is equivalent to omitting ``; the mode exists for nesting, where * the group registers as a single composite slot in an enclosing ``. * * The `collapsed` prop is only consulted when `order="sequential"` (the default); * it is ignored under `"together"` and `"natural"`. When set, tail boundaries past * the frontier suppress their own fallback output. * * Nested `` groups compose: the inner group is one slot in the outer order * and is held on its fallbacks until the outer releases the slot. Once released, the * inner group runs its own `order` locally over whatever is still pending. There is * no escape hatch — nesting under an outer group means participating in its ordering. * See `documentation/solid-2.0/03-control-flow.md` for the full nesting matrix and the * "minimally ready" definition per order. * * @example * ```tsx * // Default order is "sequential"; the inner group composes as one slot * // and runs its own "natural" order locally once the outer releases it. * * }> * * }> * }> * * }> * * ``` * * @description https://docs.solidjs.com/reference/solid-js/components-jsx/reveal */ export declare function Reveal(props: RevealProps): SolidElement;