import { TemplateResult } from '../processor/template-result'; /** * A compiled template — owns the generated render/update functions and * a `refs` cache (populated on first render, reused on subsequent updates). */ export interface CompiledTemplate { /** HTML string for the template (passed to the generated render fn). */ readonly html: string; /** * Ref indices (into the `refs` array) that correspond to Node bindings. * The caller (MiuraElement AOT path) manages real NodeBinding instances * for these indices — the generated update function skips them. */ readonly nodeBindingIndices: readonly number[]; /** * Directive binding descriptors: ref index + directive name (without `#`). * The caller creates real DirectiveBinding instances for these so that * structural directives (#if, #for, #switch …) work in AOT mode. */ readonly directiveBindingInfos: readonly { refIndex: number; name: string; }[]; /** * Create the DOM fragment and collect element refs. * Called once per element instance (on connect / initial render). * Returns `{ fragment, refs }` — store `refs` and pass it to `update()`. */ render(values: unknown[]): { fragment: DocumentFragment; refs: unknown[]; }; /** * Apply new values to cached element refs. * Called on every subsequent update — zero DOM queries. * Node bindings (nodeBindingIndices) are intentionally skipped here; * the caller updates them via NodeBinding.setValue(). */ update(refs: unknown[], values: unknown[]): void; } /** * TemplateCompiler — compiles a TemplateResult into optimised render/update * functions using CodeFactory. * * Templates with the same `strings` reference share a single compiled entry * (WeakMap-cached), so compilation happens only once per unique template * shape regardless of how many component instances use it. * * ── Usage ───────────────────────────────────────────────────────────────────── * * const compiler = new TemplateCompiler(); * * // First call — parses + compiles * const compiled = compiler.compile(result); * * // On first render * const { fragment, refs } = compiled.render(result.values); * shadowRoot.appendChild(fragment); * * // On subsequent updates * compiled.update(refs, newResult.values); */ export declare class TemplateCompiler { private readonly _parseCache; private readonly _compileCache; private readonly _parser; /** * Compile a TemplateResult into a reusable CompiledTemplate. * Results are cached by `strings` reference — identical tagged template * literals always return the same compiled object. */ compile(result: TemplateResult): CompiledTemplate; /** Clear both caches (e.g. in tests or hot-module replacement). */ clearCache(): void; private _getOrParse; } //# sourceMappingURL=compiler.d.ts.map