/** * Head manager for SSR. * * Collects ``, `<meta>`, `<link>` and inline `<script>` directives that * a render path wants to inject into the document head, then serialises them * as a single HTML string. The same descriptor shape is reused by the * server-side head manager methods across SSR entry points. * * @module bquery/ssr */ /** A `<meta>` tag descriptor. */ export interface SSRMeta { name?: string; property?: string; httpEquiv?: string; charset?: string; content?: string; } /** A `<link>` tag descriptor. */ export interface SSRLink { rel: string; href: string; as?: string; type?: string; crossorigin?: string; media?: string; integrity?: string; nonce?: string; } /** An inline or external `<script>` tag descriptor. */ export interface SSRScript { src?: string; type?: string; body?: string; defer?: boolean; async?: boolean; nonce?: string; crossorigin?: string; integrity?: string; module?: boolean; } /** Options accepted by `HeadManager.add()`. */ export interface UseHeadOptions { title?: string; titleTemplate?: string; meta?: SSRMeta[]; link?: SSRLink[]; script?: SSRScript[]; } /** Aggregated head state collected during a render. */ export interface SSRHeadState { title: string | null; titleTemplate: string | null; meta: SSRMeta[]; link: SSRLink[]; script: SSRScript[]; } /** Public head manager handle. */ export interface HeadManager { /** Add or replace head entries. */ add(options: UseHeadOptions): void; /** Returns the current state snapshot. */ state(): SSRHeadState; /** Renders the collected head into HTML. */ render(options?: { nonce?: string; }): string; /** Resets the manager to an empty state. */ reset(): void; } /** * Creates an isolated head manager. Each SSR context owns one instance. */ export declare const createHeadManager: () => HeadManager; /** Asset preload entry. */ export interface SSRAsset { href: string; rel: 'preload' | 'modulepreload' | 'stylesheet'; as?: string; type?: string; crossorigin?: string; integrity?: string; } /** Public asset manager handle. */ export interface AssetManager { /** Add a generic preload (`<link rel="preload">`). */ preload(href: string, opts?: Omit<SSRAsset, 'href' | 'rel'>): void; /** Add a JS module preload (`<link rel="modulepreload">`). */ module(href: string, opts?: Omit<SSRAsset, 'href' | 'rel' | 'as'>): void; /** Add a stylesheet link (`<link rel="stylesheet">`). */ style(href: string, opts?: Omit<SSRAsset, 'href' | 'rel' | 'as'>): void; /** Returns the current asset list snapshot. */ list(): SSRAsset[]; /** Renders all assets to a series of `<link>` tags. */ render(options?: { nonce?: string; }): string; /** Resets the manifest. */ reset(): void; } export declare const createAssetManager: () => AssetManager; //# sourceMappingURL=head.d.ts.map