/** * ARIA cache manager for expensive accessibility computations. * Implements caching with reference counting for accessible name, description, * hidden state, role, and pointer events computations. * * Based on Playwright's roleUtils.ts caching patterns. */ /** * Statistics about the current cache state. */ export interface AriaCacheStats { /** Whether caching is currently active */ active: boolean; /** Current nesting depth of begin/end calls */ depth: number; /** Number of entries in the accessible name cache */ nameCacheSize: number; /** Number of entries in the hidden-inclusive name cache */ nameHiddenCacheSize: number; /** Number of entries in the accessible description cache */ descriptionCacheSize: number; /** Number of entries in the hidden-inclusive description cache */ descriptionHiddenCacheSize: number; /** Number of entries in the hidden state cache */ hiddenCacheSize: number; /** Number of entries in the role cache */ roleCacheSize: number; /** Number of entries in the pointer events cache */ pointerEventsCacheSize: number; } /** * ARIA cache manager with reference counting. * Manages caches for expensive ARIA computations to improve performance. */ declare class AriaCacheManager { private cacheCounter; private accessibleNameCache; private accessibleNameHiddenCache; private accessibleDescriptionCache; private accessibleDescriptionHiddenCache; private isHiddenCache; private roleCache; private pointerEventsCache; /** * Begin an ARIA caching session. * Multiple calls can be nested; caches are only cleared when the * outermost session ends. */ begin(): void; /** * End an ARIA caching session. * Caches are cleared when all nested sessions have ended. */ end(): void; /** * Check if caching is currently active. */ isActive(): boolean; /** * Get or compute accessible name. * @param element The element to get the name for * @param includeHidden Whether hidden content should be included * @param compute Function to compute the name if not cached */ getAccessibleName(element: Element, includeHidden: boolean, compute: () => string): string; /** * Get or compute accessible description. * @param element The element to get the description for * @param includeHidden Whether hidden content should be included * @param compute Function to compute the description if not cached */ getAccessibleDescription(element: Element, includeHidden: boolean, compute: () => string): string; /** * Get or compute hidden state. * @param element The element to check * @param compute Function to compute the hidden state if not cached */ getIsHidden(element: Element, compute: () => boolean): boolean; /** * Get or compute role. * @param element The element to get the role for * @param compute Function to compute the role if not cached */ getRole(element: Element, compute: () => string | null): string | null; /** * Get or compute pointer events capability. * @param element The element to check * @param compute Function to compute pointer events state if not cached */ getPointerEvents(element: Element, compute: () => boolean): boolean; /** * Clear all caches. */ clearAll(): void; /** * Get cache statistics. */ getStats(): AriaCacheStats; } /** * Global ARIA cache manager. */ export declare const ariaCache: AriaCacheManager; /** * Begin ARIA caching session. * Must be paired with endAriaCaches(). */ export declare function beginAriaCaches(): void; /** * End ARIA caching session. * Caches are cleared when all nested sessions have ended. */ export declare function endAriaCaches(): void; /** * Execute function within ARIA cache session. * Automatically manages begin/end calls. * * @param fn Function to execute with caching enabled * @returns The return value of the function */ export declare function withAriaCache(fn: () => T): T; /** * Async version of withAriaCache. * Execute async function within ARIA cache session. * * @param fn Async function to execute with caching enabled * @returns Promise resolving to the return value of the function */ export declare function withAriaCacheAsync(fn: () => Promise): Promise; export {}; //# sourceMappingURL=cache.d.ts.map