/** * Server-side utilities for `` prerendering. * * These utilities run in Node.js (or any non-browser JS runtime) and generate * the island HTML that the browser's `MiuraIsland` custom element will hydrate. * * **Zero DOM dependency** — safe to import in SSR/SSG contexts. */ export type HydrationStrategy = 'load' | 'visible' | 'idle' | string; /** * Definition for a single island instance. * * `TProps` is the props type — kept as `Record` by default * to allow passing rich objects, arrays, booleans, and numbers through * ` * 5 * * ``` */ export declare function createIslandHTML(def: IslandDef): string; /** * Render an array of island definitions to their HTML strings and return * both the individual `html` strings and a structured manifest. * * Useful for SSR templates that need to inject islands at multiple positions. * * ```ts * const { rendered, manifest } = renderIslands([ * { component: 'my-counter', props: { count: 5 } }, * { component: 'app-chart', props: { data: [1,2,3] }, hydrate: 'visible' }, * ]); * ``` */ export declare function renderIslands(defs: IslandDef[]): { rendered: RenderedIsland[]; manifest: IslandManifest; }; export interface IslandManifestEntry { component: string; hydrate: HydrationStrategy; count: number; } export interface IslandManifest { /** ISO timestamp of when the manifest was generated. */ generatedAt: string; /** Total number of islands. */ total: number; /** One entry per unique (component, hydrate) combination. */ entries: IslandManifestEntry[]; } /** Build an `IslandManifest` from a list of rendered islands. */ export declare function buildManifest(islands: RenderedIsland[]): IslandManifest; /** * A static registry of island definitions keyed by component tag. * * Register islands once (e.g. at app initialisation), then look them up * during SSR to resolve default props and placeholders without passing * them everywhere. * * ```ts * import { IslandRegistry } from '@miurajs/miura-element/server'; * * IslandRegistry.register('my-counter', { props: { count: 0 }, hydrate: 'load' }); * IslandRegistry.register('app-chart', { props: { data: [] }, hydrate: 'visible' }); * IslandRegistry.register('like-button', { props: { liked: false}, hydrate: 'idle' }); * * // Later, in a route handler: * const html = IslandRegistry.render('my-counter', { count: 5 }); * ``` */ export declare class IslandRegistry { private static _defs; /** * Register default configuration for an island. * Per-call props in `render()` are **merged** on top of these defaults. */ static register(component: string, def: Omit): void; /** Returns true if `component` has been registered. */ static has(component: string): boolean; /** Return the registered defaults for a component, or `undefined`. */ static get(component: string): Omit | undefined; /** * Render a registered island to HTML, merging `overrides` on top of the * registered defaults. * * @throws if `component` was never registered. */ static render(component: string, overrides?: Partial): string; /** * Render every registered island with its defaults. * Useful for generating a full-page manifest or testing. */ static renderAll(overrides?: Record>): RenderedIsland[]; /** Remove all registrations — useful in tests. */ static clear(): void; /** List all registered component tags. */ static list(): string[]; } //# sourceMappingURL=island-renderer.d.ts.map