import { ConditionalDescriptor, LoopDescriptor, TwoWayBindingDescriptor } from '../../types'; export type RefMap = Map; export type DirectiveContext = { loops: LoopDescriptor[]; conditionals: ConditionalDescriptor[][]; twoWayBindings: TwoWayBindingDescriptor[]; refs: RefMap; showElements: ShowDescriptor[]; }; /** * Registry for two-way bindings. * Maps state keys to the elements bound to them. */ export type TwoWayBindingRegistry = Map>; export type ShowDescriptor = { element: HTMLElement; expression: string; originalDisplay: string; }; /** * Scans the template for all directives and returns descriptors for each. * This should be called after the template HTML is injected into the DOM. */ export declare function scanDirectives(host: HTMLElement | ShadowRoot): DirectiveContext; /** * Scans the template for all directives and returns descriptors for each. * This version accepts an existing refs Map to populate (used when refs * need to be available before scripts run). */ export declare function scanDirectivesWithRefs(host: HTMLElement | ShadowRoot, existingRefs: RefMap): DirectiveContext; /** * Scans for $ref directives only and populates the refs Map. * This can be called early (before scripts run) to make refs available. */ export declare function scanRefsOnly(host: HTMLElement | ShadowRoot | DocumentFragment, refs: RefMap): void; /** * Renders all loops with the current state. */ export declare function renderLoops(loops: LoopDescriptor[], state: Record, evaluateExpression: (expr: string, context: Record) => unknown): void; /** * Updates all conditionals with the current state. */ export declare function updateConditionals(conditionals: ConditionalDescriptor[][], state: Record, evaluateExpression: (expr: string, context: Record) => unknown): void; /** * Updates all $show elements with the current state. */ export declare function updateShowElements(showElements: ShowDescriptor[], state: Record, evaluateExpression: (expr: string, context: Record) => unknown): void; /** * Sets up two-way bindings and returns a registry for state→input sync. * * Returns a function that should be called when state changes to update * all bound input elements with the new state values. */ export declare function setupTwoWayBindings(bindings: TwoWayBindingDescriptor[], state: Record, evaluateExpression: (expr: string, context: Record) => unknown): (changedKey?: string) => void;