/** * Context and DI provider system for sharing state and services across directive descendants. * * @packageDocumentation */ import { Directive } from './types.js'; /** * Get or create local state for an element. * * @remarks * Each directive instance gets its own isolated state object. * The state is reactive. * * @param el - The element to get state for * @returns A reactive state object * * @internal */ export declare function getLocalState(el: Element): Record; /** * Register a context provider for an element. * * @remarks * Called after a directive with `$context` has executed. * Stores the directive and its state so descendants can find it. * * @param el - The element providing context * @param directive - The directive that provides context * @param state - The directive's local state * * @internal */ export declare function registerProvider(el: Element, directive: Directive, state: Record): void; /** * Register DI providers for an element. * * @remarks * Called when a directive with `provide` option is processed. * Stores the provider map so descendants can resolve from it. * * @param el - The element providing DI overrides * @param provideMap - Map of name to value * * @internal */ export declare function registerDIProviders(el: Element, provideMap: Record): void; /** * Resolve a DI provider value from ancestor elements. * * @remarks * Walks up the DOM tree to find the nearest ancestor with a * `provide` map containing the requested name. * * @param el - The element requesting the value * @param name - The name to look up * @returns The provided value, or undefined if not found * * @internal */ export declare function resolveFromDIProviders(el: Element, name: string): unknown | undefined; /** * Resolve a context value from ancestor elements. * * @remarks * Walks up the DOM tree to find the nearest ancestor whose * directive declares `$context` containing the requested name. * * @param el - The element requesting the value * @param name - The name to look up * @returns The provider's state, or undefined if not found * * @internal */ export declare function resolveFromProviders(el: Element, name: string): Record | undefined; /** * Clear local state for an element. * * @remarks * Called when an element is removed or re-rendered. * * @param el - The element to clear state for * * @internal */ export declare function clearLocalState(el: Element): void; /** * Clear providers for an element. * * @remarks * Called when an element is removed or re-rendered. * * @param el - The element to clear providers for * * @internal */ export declare function clearProvider(el: Element): void;