/** * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ import { type Document } from './htmlparser.js'; /** * A class that streams arbitrary HTML content into a target DOM element in an incremental manner. * * It uses a virtual DOM to avoid flickering of images and other dynamic content. */ export declare class HTMLStreamer { /** * Creates an instance of HTMLStreamer. */ constructor(options: HTMLStreamerOptions); /** * Incrementally streams the HTML string into provided target DOM element. * * **Note**: This method can be called repeatedly with a new document to continue the previous call. The new parsed document * must be an extension of the previous document (only growing, never shrinking). * * ## Basic example * * ```ts * const document = parse( '

foo bar

' ); * * const htmlStreamer = new HTMLStreamer( { * targetElement, * textNodeStyle: 'animation: my-animation .5s' * } ); * * await htmlStreamer.stream( { document } ); * ``` * * after 20ms will stream: * * ```html *

* ``` * * and after 40ms: * * ```html *

foo

* ``` * * and after 60ms: * * ```html *

* foo * bar *

* ``` */ stream({ document, targetElement, abortSignal }: { document: Document; targetElement: HTMLElement; abortSignal?: AbortSignal; }): Promise; /** * Resets the HTMLStreamer to its initial state. */ reset(): void; /** * Cleans up the animation `` elements from the configured target element with minimum DOM manipulation. */ cleanUpAnimations({ targetElement }: { targetElement: HTMLElement; }): void; } /** * Options for the HTMLStreamer. */ interface HTMLStreamerOptions { /** * Delay between `stream()` updates in milliseconds. Default is 20ms. */ delay?: number; /** * The `style` attribute value for `` elements that wrap text nodes. */ textNodeStyle: string; /** * Callback to be called every time the stream is updated. */ onStreamUpdate?: () => void; } export {};