import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import{type LyraWidgetDocument}from'./resolve.js';import{type LyraWidgetTypeRegistry}from'./registry.js';export interface LyraWidgetRendererEventMap{'lr-widget-action':CustomEvent<{actionId:string;payload:unknown;nodeId:string;nodeKey:string;nodePath:string;}>;'lr-render-error':CustomEvent<{error:Error;}>;'lr-widget-state-change':CustomEvent<{path:string;value:unknown;nodeId:string;nodeKey:string;nodePath:string;prop:string;}>;} /** * `` — renders an agent-streamed declarative JSON widget tree through an * allowlisted `type -> lyra tag` registry (see `registry.ts`/`resolve.ts` for the allowlist * enforcement itself; this class only turns an already-resolved tree into declarative templates). * Mapped custom-element tags and children are serializable during SSR and keyed identically during * hydration. Primitive mapped props remain property-only by contract: the server emits the stable * element/child shell, then hydration assigns props without converting them into attributes. Lit's * keyed reconciliation reuses the mapped element so focus, scroll position, and internal state * survive a streamed document update. Each unchanged resolved mapped node also reuses its template * and ref callback, avoiding redundant property assignments and listener detach/attach cycles on * unrelated renderer updates. * * The version-two `document` is the sole tree source. An allowlisted prop value shaped as * `{ $bind: '/json/pointer', fallback?: primitive }` reads from the explicit `bindingState` * property; a registry `bindings` entry names the control event that requests a change. * The renderer reports that request through `lr-widget-state-change` and never mutates caller state. * Unknown-type and disallowed-prop warnings deduplicate within the effective root/registry * generation. Binding-state-only re-resolution remains quiet, while replacing the document root * or registry releases its prior warning keys before resolving the new generation. * A malformed root or nested node fails closed: the prior rendered tree is cleared and exactly one * `lr-render-error` describes the rejected update. * The normal `widget-renderer.js` registration entry installs the eight mapped custom elements. * Every renderer owns an explicit immutable registry value, defaulting to the frozen built-in * registry. A lean consumer imports this side-effect-free class module, defines the renderer, * imports only its mapped registrations, and assigns a registry made by * `createWidgetTypeRegistry()`. * * @customElement lr-widget-renderer * @event lr-widget-action - `detail: { actionId, payload, nodeId, nodeKey, nodePath }` — the single bubbling action channel. * @event lr-render-error - `detail: { error }` — the root or one of its nested nodes was structurally unusable. * @event lr-widget-state-change - A bound control requested a controlled state update. `detail: { path, value, nodeId, nodeKey, nodePath, prop }`; the caller must apply the next `bindingState` value. * @csspart base - The root wrapper (`display: contents` — adds no layout box of its own). * @csspart row - A built-in `row` node. * @csspart col - A built-in `col` node. * @csspart text - A built-in `text` node. * @status stable * @since 4.0.0 */ export declare class LyraWidgetRenderer extends LyraElement{protected static readonly ownedCollectionProperties:readonly string[];static styles:import("lit").CSSResultGroup[]; /** Version-two declarative document. Assignment takes a bounded recursively frozen snapshot; * mutate a copy and reassign it to update. `null` renders an empty base. A malformed root or * nested node clears prior content and emits one `lr-render-error`. */ document:LyraWidgetDocument|null; /** Explicit controlled binding state. `null` is a real state value, never an absence sentinel. */ bindingState?:unknown; /** Immutable type registry owned by this renderer. Assign a snapshot returned by * `createWidgetTypeRegistry()` to override the built-ins without affecting another instance. */ registry:LyraWidgetTypeRegistry;private resolved;private readonly warned;private warningScope?;private readonly actionHandlers;private readonly bindingHandlers;private readonly assignedProps;private readonly initialProps;private readonly mappedElementRefs;protected willUpdate(changed:PropertyValues):void;private builtinStyle;private syncActionHandler;private syncBindingHandlers;private syncMappedElement;private cleanupMappedElement; /** Ref callbacks are ignored by Lit SSR and attach only during browser render/hydration. */ private mappedElementRef; /** Declarative dynamic tag path: serializable on the server, stable under hydration and keyed * by the same identity as client-only property/listener attachment. The ref callback is keyed * by the resolved node object so it stays stable until that node is actually re-resolved; the * template itself is never cached across renders -- reusing one `TemplateResult` instance * across Lit's own re-render cycles is unsafe with `unsafeStatic`'s dynamic-tag interpolation. */ private renderMapped;private renderIdentity;private renderChildValue;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-widget-renderer':LyraWidgetRenderer;}}