import { Writable } from 'node:stream';
import { ReactNode } from 'react';
import { StreamableHeadContext, CreateStreamableServerHeadOptions } from 'unhead/stream/server';
export { BaseStreamableHeadContext, CreateStreamableServerHeadOptions, StreamableHeadContext, StreamingTemplateParts, WebStreamableHeadContext, prepareStreamingTemplate, renderSSRHeadShell, renderSSRHeadSuspenseChunk, wrapStream } from 'unhead/stream/server';
import { ResolvableHead, Unhead } from 'unhead/types';

declare function UnheadProvider({ value, children }: {
    value: Unhead;
    children: ReactNode;
}): ReactNode;
/**
 * Streaming head component for React.
 * Place inside Suspense boundaries after async components that use useHead.
 */
declare function HeadStream(): ReactNode;
/**
 * A pipe function from React's renderToPipeableStream
 */
type ReactPipeFunction = (writable: Writable) => void;
/**
 * React-specific context returned by createStreamableHead.
 * Extends core StreamableHeadContext with React's wrap helper.
 */
interface ReactStreamableHeadContext<T = ResolvableHead> extends Pick<StreamableHeadContext<T>, 'head' | 'onShellReady'> {
    /**
     * Wrap React's pipe function to handle head injection automatically
     * @param pipe - The pipe function from renderToPipeableStream
     * @param template - The HTML template (from Vite's transformIndexHtml)
     * @returns A new pipe function that handles shell rendering
     */
    wrap: (pipe: ReactPipeFunction, template: string) => (writable: Writable) => void;
}
/**
 * Creates a head instance configured for React streaming SSR.
 *
 * Returns a context with:
 * - `head`: The Unhead instance for UnheadProvider
 * - `onShellReady`: Callback to pass to renderToPipeableStream
 * - `wrap`: Wraps React's pipe to handle head injection
 *
 * @example
 * ```tsx
 * const { head, onShellReady, wrap } = createStreamableHead()
 *
 * const { pipe } = renderToPipeableStream(
 *   <UnheadProvider value={head}><App /></UnheadProvider>,
 *   { onShellReady }
 * )
 *
 * return { pipe: wrap(pipe, template) }
 * ```
 */
declare function createStreamableHead<T = ResolvableHead>(options?: CreateStreamableServerHeadOptions): ReactStreamableHeadContext<T>;

export { HeadStream, UnheadProvider, createStreamableHead };
export type { ReactStreamableHeadContext };
