import { type Accessor } from "solid-js"; /** * Image loading status reported by the probe. Mirrors Base UI React's * `ImageLoadingStatus` union (`packages/react/src/avatar/image/useImageLoadingStatus.ts`). * * It survives the move to async-native (`solidify.md` §4) because the Avatar * compound coordinates `` and its sibling `` * through a shared status signal in root context — sibling parts, not nested * subtrees, so a ``/`` boundary can't replace it. The union * is a *derived view* of the async probe below, not a hand-rolled state * machine: a failed image is a domain state (→ fallback), not an exception * that should escape to `` — the same messages-vs-exceptions split * `createValidator` draws. */ export type ImageLoadingStatus = "idle" | "loading" | "loaded" | "error"; /** * Inputs to {@link useImageLoadingStatus}. Each entry is an accessor so the * primitive can react to upstream prop changes without being re-created. * Matching the React helper, only `src`, `referrerPolicy`, and `crossOrigin` * participate in re-probing. */ export interface UseImageLoadingStatusOptions { src: Accessor; referrerPolicy: Accessor; crossOrigin: Accessor; } /** * Runs a standalone image probe whose async outcome drives a discrete * `ImageLoadingStatus` accessor. * * Solid 2 shape (`solidify.md` §4 — RFC 05 async-native): * * - `probe` is an async `createMemo` returning {@link loadImage}'s Promise. * It re-runs whenever `src`/`referrerPolicy`/`crossOrigin` flip; the prior * in-flight probe is discarded by the graph (last-write-wins), so no manual * `isActive` latch is needed. * - The bundled `createEffect(compute, { effect, error })` reads `probe()` in * its compute half. While the Promise is pending the compute *suspends* — * the `effect` (apply) half does not run, and no `ASYNC_OUTSIDE_LOADING_BOUNDARY` * diagnostic fires (verified: a suspended *computation* without a `` * ancestor is silent; only a pending *read in render* requires the boundary). * On resolve the apply half lands `"loaded"`; on reject the `error` half * lands `"error"` — caught from the compute phase per RFC 01's bundle * contract, so the rejection is handled here rather than escaping upward. * - A separate split effect tracks the probe inputs and lands `"loading"` * synchronously the moment they change to a non-empty `src` (the bundle * effect can't — it's suspended until the probe settles). An empty `src` * lands `"error"` directly, preserving the React helper's "no loading flash * for a missing src" behaviour (the memo also rejects for empty `src`, so * the two agree). * * The returned `status` accessor is a plain signal read; callers can drive * further effects off it (mirror into a root context, forward into a consumer * callback). */ export declare function useImageLoadingStatus(options: UseImageLoadingStatusOptions): Accessor; //# sourceMappingURL=use-image-loading-status.d.ts.map