export interface CaptureOpts { onCapture: (offscreen: OffscreenCanvas) => void; maxSize?: number; } /** * Add a waiter to the set and resolve when it is called or on timeout. * Resolves to false on timeout. */ export declare function waitForFlush(waiters: Set<() => void>, timeoutMs: number): Promise; /** * Move a node and keep its state (iframes, video, focus) when the browser * supports `moveBefore`. */ export declare function moveNode(parent: ParentNode & Node, node: Node, before: Node | null): void; /** * Request a new capture of a canvas set up by `setupCapture`. * Resolves after the capture is handed to `onCapture`, or to false after a timeout. * Returns `undefined` if the canvas has no capture set up. */ export declare function requestCapture(canvas: HTMLCanvasElement, timeoutMs?: number): Promise | undefined; /** * Pin the canvas's CSS size so content changes don't resize it. * Returns a function that restores the size and syncs the height to the child. */ export declare function lockCanvasSize(canvas: HTMLCanvasElement): () => void; /** * Clear the first capture that `setupCapture` left on the canvas and drop * the still copy `wrapElement` put over it. * Call it once the overlay has the element's texture. */ export declare function releaseFirstCapture(canvas: HTMLCanvasElement, keepCapture?: boolean): void; /** * Set up the paint handler + ResizeObservers on an html-in-canvas wrapper * (``). Returns the initial * OffscreenCanvas from the first paint. * * The first capture stays on the canvas so wrapping does not flash. * `VFX.add` releases it once the overlay shows the texture. */ export declare function setupCapture(canvas: HTMLCanvasElement, opts: CaptureOpts): Promise; /** * Tear down onpaint handler + ResizeObservers set up by setupCapture. */ export declare function teardownCapture(canvas: HTMLCanvasElement): void; interface WrapOpts extends CaptureOpts { /** Cover the wrap frame with a still copy at this z-index. */ stillCover?: { zIndex: number; }; } interface WrapResult { canvas: HTMLCanvasElement; initialCapture: OffscreenCanvas; } /** * Wrap an element in a `` for * html-in-canvas capture. * * CSS identity (class + style) is copied to the canvas so width/height * resolve via normal CSS cascade. Canvas is a replaced element — it does * NOT auto-fit height to children, even with `layoutsubtree`. A child RO * in `setupCapture` keeps the CSS height in sync with the child. * * The element is expected to fill its containing block (full-width) or carry * an explicit px width; content-sized elements are unsupported. See the * sizing policy in docs/html-in-canvas.md. * * Delegates onpaint + ROs to `setupCapture`. */ export declare function wrapElement(element: HTMLElement, opts: WrapOpts): Promise; /** * Unwrap: move element back out of the canvas wrapper and restore state. */ export declare function unwrapElement(canvas: HTMLCanvasElement, element: HTMLElement): void; export {};