/** * Server-side rendering with direct tree walking for directive indexing. * * @packageDocumentation */ import { Directive, RenderOptions } from '../types.js'; import type { StreamPendingChunk } from './async-render.js'; export type { IndexedDirective } from './index-tree.js'; export type { StreamPendingChunk } from './async-render.js'; /** * Registry of directives by name. */ export type DirectiveRegistry = Map; export type { ServiceRegistry } from '../resolver-config.js'; /** * Register a directive in the registry. * * @param registry - The directive registry * @param name - Directive name * @param fn - The directive function * * @deprecated Use `directive()` from 'gonia' instead to register directives globally. */ export declare function registerDirective(registry: DirectiveRegistry, name: string, fn: Directive): void; /** * Register a service for dependency injection. * * @param name - Service name (used in $inject arrays) * @param service - The service instance */ export declare function registerService(name: string, service: unknown): void; /** * Render HTML with directives on the server. * * @remarks * Uses direct tree walking to index elements with directive attributes, * then executes directives to produce the final HTML. * Directive attributes are preserved in output for client hydration. * Directives are processed in tree order (parents before children), * with priority used only for multiple directives on the same element. * * @param html - The HTML template string * @param state - The state object to use for expression evaluation * @param registry - The directive registry * @param renderOptions - Optional async rendering configuration * @param streamPending - Internal: collects pending chunks for stream mode * @returns The rendered HTML string * * @example * ```ts * const registry = new Map(); * registry.set('text', textDirective); * * const html = await render( * '', * { user: { name: 'Alice' } }, * registry * ); * // 'Alice' * ``` */ export declare function render(html: string, state: Record, registry: DirectiveRegistry, renderOptions?: RenderOptions, streamPending?: StreamPendingChunk[]): Promise;