/** DOM-only measurement and synchronization for worker-rendered MSDF text. * @module three-blocks/text/main */ import { type TextCanvasRect, type TextFallbackSignal, type TextFallbackStatus, type TextSyncBatch, type TextSyncDelivery } from '../text-runtime/index.js'; export type TextSyncPublisher = (delivery: TextSyncDelivery) => void; export interface TextSyncEnvironment { readonly document: Document; readonly window: Window; readonly Element: typeof Element; readonly Node: typeof Node; readonly NodeFilter: typeof NodeFilter; readonly MutationObserver: typeof MutationObserver; readonly IntersectionObserver: typeof IntersectionObserver; readonly ResizeObserver: typeof ResizeObserver; readonly getComputedStyle: typeof getComputedStyle; readonly requestAnimationFrame: (callback: FrameRequestCallback) => number; readonly cancelAnimationFrame: (handle: number) => void; } export interface TextSyncOptions { readonly publish: TextSyncPublisher; readonly attribute?: string; readonly fontAttribute?: string; readonly zIndexAttribute?: string; readonly fallbackAttribute?: string; readonly idAttribute?: string; readonly disabled?: boolean; readonly maxCharacters?: number; readonly root?: ParentNode; readonly getCanvasRect?: () => TextCanvasRect; readonly onFallbackChange?: (element: Element, visible: boolean, status: TextFallbackStatus) => void; readonly environment?: TextSyncEnvironment; } /** Long-lived main-thread synchronizer. Replacing its publisher replays a complete snapshot. */ export declare class TextSync { #private; constructor(options: TextSyncOptions); get started(): boolean; get disposed(): boolean; get size(): number; start(): Promise; setPublisher(publisher: TextSyncPublisher, options?: { readonly replay?: boolean; }): void; replay(): TextSyncDelivery; snapshot(): TextSyncBatch; flush(): TextSyncDelivery | null; add(element: Element): void; remove(element: Element): void; refresh(element: Element): void; refreshAll(): void; notifyScroll(): void; pause(): void; resume(): void; applyFallbackSignal(signal: TextFallbackSignal): void; dispose(): void; } /** Create and start a synchronizer; await `start()` when authoritative font measurement matters. */ export declare function createTextSync(options: TextSyncOptions): TextSync;