import { ComponentChildren } from "preact"; //#region src/components/ClientOnly.d.ts interface ClientOnlyProps { readonly children: ComponentChildren; readonly fallback?: ComponentChildren; } export declare function ClientOnly({ children, fallback }: ClientOnlyProps): ComponentChildren; //#endregion //#region src/components/ServerOnly.d.ts interface ServerOnlyProps { readonly children: ComponentChildren; readonly fallback?: ComponentChildren; } export declare function ServerOnly({ children, fallback }: ServerOnlyProps): ComponentChildren; //#endregion //#region src/components/Await.d.ts interface AwaitProps { /** Deferred key declared in the loader's `defer({ deferred: { : ... } })`. */ readonly name: string; /** Render the resolved value. Suspends while pending; throws inside the * nearest Error Boundary on rejection. */ readonly children: (value: T) => ComponentChildren; } /** * Reads `useDeferred(name)` and hands the resolved value to the render-prop * via Preact's ``-throwing convention. Wrap in `` (or * `` from `preact/compat`). * * ```tsx * }> * name="reviews"> * {(reviews) => } * * * ``` */ export declare function Await({ name, children }: AwaitProps): ComponentChildren; //#endregion //#region src/components/Streamed.d.ts interface StreamedProps { /** Shown while any descendant `` / `use(promise)`-equivalent suspends. */ readonly fallback: ComponentChildren; readonly children: ComponentChildren; } /** * Cross-adapter alias for `` from `preact/compat`. * Pairs with `` for symmetry with the React/Solid/Svelte/Vue/Angular * SSR streaming naming. * * Preact's `Suspense` is part of `preact/compat` (experimental). For * production streaming the preact-render-to-string toolchain is required. */ export declare function Streamed({ fallback, children }: StreamedProps): ComponentChildren; //#endregion //#region src/components/HttpStatusCode.d.ts interface HttpStatusCodeProps { /** HTTP status to apply to the response. Common values: 404, 410, 451, 503. */ readonly code: number; } /** * Render-time HTTP status declaration. Mount inside a route component (typical * use case: a glob `*` route's NotFound page) when the status is decided by * the rendered tree rather than a loader. * * Writes `code` to the nearest ``'s sink during render and * returns `null`. With no provider mounted (the standard client-side case) * the component is a silent no-op — same component tree hydrates without * touching the DOM or warning about mismatches. * * Loader-driven errors (`LoaderNotFound` → 404, `LoaderRedirect` → 30x) keep * working as before; this component covers render-time decisions only. * * Last write wins when several `` instances mount in the * same render pass — sink reflects the last component that ran. * * ```tsx * // entry-server.tsx * import { renderToString } from "preact-render-to-string"; * import { createHttpStatusSink, HttpStatusProvider } from "@real-router/preact/ssr"; * * const sink = createHttpStatusSink(); * const html = renderToString( * * * * * , * ); * response.status(sink.code ?? 200).send(html); * ``` * * **Streaming SSR (`renderToReadableStream`):** the response status MUST be * sent before the first body byte flushes. If `` is mounted * inside a late-resolving `` boundary, the sink write may happen * AFTER the headers are already on the wire — the override is then lost. * Mount the component in the shell (above every `` that could * delay it). For non-streaming SSR (`renderToString` / `renderToStringAsync`) * there is no such ordering concern. * * **Valid `code` range:** Node's `res.end()` throws `Invalid status code` on * `NaN`, `0`, negative values, or values `> 999` — this surfaces as a 5xx / * dropped connection, not silent corruption. Pass a real HTTP status integer * (commonly 4xx/5xx; 100-999 is what Node accepts). */ export declare function HttpStatusCode({ code }: HttpStatusCodeProps): ComponentChildren; //#endregion //#region src/utils/createHttpStatusSink.d.ts /** * Render-scoped HTTP status sink. Created per request on the server, passed to * ``, and read after `renderToString` (or the * Preact streaming helper) to apply the value to the HTTP response. * * Last write wins: if the rendered tree mounts more than one * ``, the value reflects the last component that ran during * the render pass. * * No-op on the client — `` reads the optional context and * skips the write when no provider is mounted, so the same component tree can * be hydrated without changing behaviour. * * Constraints: * - **Per-request only.** Don't share a sink across requests; the rendered * tree mutates `code` in place. Module-level singletons leak status * between concurrent requests. * - **Don't `Object.freeze` the sink.** The component writes to `.code`; * freezing makes the assignment throw under ESM strict mode. */ interface HttpStatusSink { code: number | undefined; } export declare function createHttpStatusSink(): HttpStatusSink; //#endregion //#region src/components/HttpStatusProvider.d.ts interface HttpStatusProviderProps { readonly sink: HttpStatusSink; readonly children: ComponentChildren; } export declare function HttpStatusProvider({ sink, children }: HttpStatusProviderProps): ComponentChildren; //#endregion //#region src/hooks/useDeferred.d.ts /** * Read a deferred promise published by `defer({ deferred: { : Promise } })` * inside an SSR data loader. Mirror of `@real-router/react/ssr` `useDeferred` * — same `state.context.ssrDataDeferred` contract, same NEVER-on-missing * fallback. Pair with `` (this package) which adds Preact-side * promise-status tracking since Preact 10 has no `use(promise)` analogue. */ export declare function useDeferred(key: string): Promise; //#endregion export type { AwaitProps, ClientOnlyProps, HttpStatusCodeProps, HttpStatusProviderProps, HttpStatusSink, ServerOnlyProps, StreamedProps }; //# sourceMappingURL=ssr.d.ts.map