/** * Pure state for the streaming text node. Text that has already been shown * lives in `settled`; every append while streaming becomes its own segment so * several chunks can fade in at once instead of the newest one cutting the * previous fade short. Segments are folded back into `settled` once they have * been on screen for the fade duration, keeping the DOM small. */ /** How long a streamed chunk takes to fade in. Mirrored to CSS via a custom property. */ export declare const STREAMING_TEXT_FADE_MS = 320; /** Upper bound on live segments so a paused animation clock cannot grow the DOM forever. */ export declare const STREAMING_TEXT_MAX_SEGMENTS = 48; export interface StreamingTextSegment { id: number; text: string; startedAt: number; } export interface StreamingTextState { settled: string; segments: readonly StreamingTextSegment[]; nextId: number; } export declare function renderedStreamingText(state: StreamingTextState): string; /** * Initial state for a node. Content that was already rendered by a previous * instance of the same node (markstream persists it per index key while it * re-parses inline markup) stays settled; only the unseen tail animates. */ export declare function createStreamingTextState(content: string, options: { persisted?: string; now: number; animate: boolean; }): StreamingTextState; /** * Apply the next content snapshot. A pure append becomes a new segment; any * other change (rewrite, shrink, animation disabled) settles everything so * the text never lags behind the parser. */ export declare function applyStreamingTextContent(state: StreamingTextState, content: string, options: { now: number; animate: boolean; }): StreamingTextState; /** Fold segments that finished fading into `settled`. Order is preserved, so only a settled head can be folded. */ export declare function settleStreamingTextSegments(state: StreamingTextState, now: number, durationMs?: number): StreamingTextState; /** Fold the oldest segments until at most `max` remain live. */ export declare function capStreamingTextSegments(state: StreamingTextState, max: number): StreamingTextState; /** Time at which the oldest live segment finishes fading, or null when nothing is animating. */ export declare function nextStreamingTextSettleAt(state: StreamingTextState, durationMs?: number): number | null;