import { PreparedTemplate } from '../parser.js'; export { prepareTemplate } from '../parser.js'; import { ServerUnhead } from '../server.js'; import { f as CreateStreamableServerHeadOptions, U as Unhead, S as SSRHeadPayload } from '../shared/unhead.CguV8W7j.js'; import { ResolvableHead } from '../types.js'; export { H as HeadTag } from '../shared/unhead.DC0v7nqS.js'; import 'hookable'; /** * Base context with just the head instance. * Extended by framework-specific contexts. */ interface BaseStreamableHeadContext { /** * The Unhead instance to provide to your framework */ head: ServerUnhead; } /** * Context returned by createStreamableHead for streaming SSR. * Includes shell coordination utilities for framework wrappers. */ interface StreamableHeadContext extends BaseStreamableHeadContext { /** * Call this when the shell is ready. * Pass to your framework's onShellReady callback. */ onShellReady: () => void; /** * Promise that resolves when shell is ready. * Use this to coordinate stream wrapping in framework-specific code. */ shellReady: Promise; } /** * Context for frameworks using web streams (Vue, Solid, Svelte). * Provides a wrapStream helper for easy stream wrapping. */ interface WebStreamableHeadContext extends BaseStreamableHeadContext { /** * Wrap a web ReadableStream to handle head injection automatically. * @param stream - The app's ReadableStream * @param template - The HTML template (string or `prepareTemplate()` result) * @returns A new ReadableStream with shell and closing HTML included */ wrapStream: (stream: ReadableStream, template: string | PreparedTemplate) => ReadableStream; } /** * Creates a head instance configured for streaming SSR. * * Returns a context with: * - `head`: The Unhead instance for your framework's provider * - `onShellReady`: Callback to pass to your framework's streaming API * - `shellReady`: Promise that resolves when shell is ready * * Each framework package (@unhead/react, @unhead/vue, etc.) may extend this * with framework-specific streaming utilities. * * @example * ```ts * const { head, onShellReady, shellReady } = createStreamableHead() * ``` */ declare function createStreamableHead(options?: CreateStreamableServerHeadOptions): StreamableHeadContext; /** * Generates the bootstrap script that creates the streaming queue on the window object. * This script is injected into the shell and must run before any streaming updates. * * For frameworks that construct HTML programmatically (without a template), * use this directly to inject the bootstrap into your shell ``. * * @param streamKey - The window property name for the stream queue (default: '__unhead__') * @param nonce - Optional CSP nonce to stamp on the script tag * @returns An inline `