/** * Scope management for element state. * * @packageDocumentation */ import { Directive, DirectiveOptions } from './types.js'; /** * Clear all element scopes. * * @remarks * Primarily useful for testing. */ export declare function clearElementScopes(): void; /** * Get or create the root scope. * * @remarks * The root scope is used as a fallback for directives that aren't * inside an element with `scope: true`. This allows top-level * directives like `g-model` to work without requiring a parent scope. * * @returns The root reactive scope */ export declare function getRootScope(): Record; /** * Clear the root scope. * * @remarks * Primarily useful for testing. */ export declare function clearRootScope(): void; /** * Create a new scope for an element. * * @param el - The element to create scope for * @param parentScope - Optional parent scope to inherit from via prototype * @returns The new reactive scope */ export declare function createElementScope(el: Element, parentScope?: Record): Record; /** * Store an externally-created scope on an element. * * @remarks * Unlike {@link createElementScope} which creates a new scope, * this stores an already-created scope (e.g., from `createScope`) * so descendants can find it via DOM walking with {@link findParentScope}. * * @param el - The element to associate with the scope * @param scope - The scope to store */ export declare function setElementScope(el: Element, scope: Record): void; /** * Get the scope for an element. * * @param el - The element * @returns The element's scope, or undefined if none */ export declare function getElementScope(el: Element): Record | undefined; /** * Find the nearest ancestor scope by walking up the DOM tree. * * @param el - The element to start from * @param includeSelf - Whether to check the element itself (default: false) * @param useRootFallback - Whether to return root scope if no parent found (default: true) * @returns The nearest scope, or root scope if none found and fallback enabled */ export declare function findParentScope(el: Element, includeSelf?: boolean, useRootFallback?: boolean): Record | undefined; /** * Remove scope for an element (cleanup). * * @param el - The element */ export declare function removeElementScope(el: Element): void; /** * Register a directive as a custom element. * * @param name - The custom element name (must contain hyphen) * @param fn - The directive function * @param options - Directive options */ export declare function registerDirectiveElement(name: string, fn: Directive, options: DirectiveOptions): void;