export interface RegionOptions { width?: number; height?: number; stdout?: NodeJS.WriteStream; disableRendering?: boolean; } /** * TerminalRegion manages a rectangular region of the terminal. * * The region reserves new lines at the bottom of the terminal and only * updates within those reserved lines. This prevents overwriting existing * terminal content. * * Performance optimizations: * - Frame diffing to minimize writes * - Throttling to limit render frequency * - Batched writes to stdout * - Efficient string operations * - Relative cursor movements (no absolute positioning) */ export declare class TerminalRegion { private width; private height; private pendingFrame; private previousFrame; private renderScheduled; private throttle; private renderBuffer; private stdout; private disableRendering; private isInitialized; private resizeCleanup?; private widthExplicitlySet; private savedCursorPosition; private autoWrapDisabled; private startRow; private lastRenderedHeight; constructor(options?: RegionOptions); /** * Set up process exit handler to automatically clean up the region */ private setupExitHandler; /** * Set up resize event handler to react to terminal size changes */ private setupResizeHandler; /** * Initialize the region by reserving new lines at the bottom of the terminal. * This appends new lines so the region doesn't overwrite existing content. * * Also disables terminal auto-wrap so we can manage all wrapping ourselves. */ private initializeRegion; /** * Expand region to accommodate more lines */ private expandTo; /** * Get a single line (1-based line numbers) * Returns empty string if line doesn't exist */ getLine(lineNumber: number): string; /** * Set a single line (1-based line numbers) * * Note: With auto-wrap disabled, we manage all wrapping ourselves. * This method sets a single line - if content needs to wrap, it should * be handled by the component layer (col, flex, etc.) before calling this. */ setLine(lineNumber: number, content: string): void; /** * Set entire content (multiple lines with \n separators) */ set(content: string): void; /** * Schedule a render (respects throttle) */ private scheduleRender; /** * Copy pending frame to previous frame */ private copyPendingToPrevious; /** * Render immediately (bypasses throttle) * Uses relative cursor movements to update only within reserved lines */ renderNow(): void; /** * Force immediate render of pending updates (bypasses throttle) */ flush(): void; /** * Set throttle FPS */ setThrottleFps(fps: number): void; /** * Clear a single line (1-based) */ clearLine(lineNumber: number): void; /** * Clear entire region */ clear(): void; /** * Destroy the region (cleanup) * Automatically deletes any blank lines from the terminal, but preserves content * * @param clearFirst - If true, clears the region before destroying (default: false) * * Note: This is automatically called on process exit, but you can also call it explicitly * to clean up resources earlier (e.g., before continuing with other terminal output) */ destroy(clearFirst?: boolean): void; getWidth(): number; getHeight(): number; } //# sourceMappingURL=region-old.d.ts.map