import { RegionRenderer } from './native/region-renderer.js'; import type { RegionOptions, LineContent } from './types.js'; /** * Reference to a component in the region that can be removed */ export declare class ComponentReference { private region; private componentIndex; private height; constructor(region: TerminalRegion, componentIndex: number, height: number); /** * Delete this component - removes it from the region */ delete(): void; } /** * Reference to a section of lines in the region that can be updated */ export declare class SectionReference { private region; private startLine; private height; constructor(region: TerminalRegion, startLine: number, height: number); /** * Delete this section - removes the lines from the region */ delete(): void; /** * Update the content of this section */ update(content: string | string[] | LineContent[]): void; } /** * TerminalRegion - High-level API for terminal region management * * This is the public API that wraps the low-level RegionRenderer. * It adds component orchestration, grid layout, and styling support. */ export declare class TerminalRegion { private renderer; private _width; private _height; private allComponentDescriptors; private componentCleanupCallbacks; private explicitlyAddedLines; private isReRendering; constructor(options?: RegionOptions); get width(): number; get height(): number; getLine(lineNumber: number): string; getStartRow(): Promise; showCursorAt(lineNumber: number, column: number): void; hideCursor(): void; /** * Get the underlying renderer (for internal use by SectionReference) * @internal */ getRenderer(): RegionRenderer; /** * Get the internal height (for internal use by SectionReference) * @internal */ getInternalHeight(): number; /** * Decrease the region height (for internal use by SectionReference) * @internal */ decreaseHeight(amount: number): void; /** * Remove lines from explicitlyAddedLines (for internal use by SectionReference) * @internal */ removeRegionLines(startIndex: number, count: number): void; /** * Register a cleanup callback for a component (called when component is removed/replaced) * @internal */ registerComponentCleanup(callback: () => void): void; /** * Call all registered cleanup callbacks and clear them * @internal */ private cleanupAllComponents; /** * Remove a component from allComponentDescriptors (for internal use by ComponentReference) * @internal */ removeComponent(componentIndex: number): void; /** * Ensure a region line exists at the given index (for internal use by SectionReference) * @internal */ ensureExplicitlyAddedLine(index: number): void; /** * Update a region line (for internal use by SectionReference) * @internal */ updateExplicitlyAddedLine(index: number, lineInfo: { content: string; lineNumber: number; }): void; /** * Internal method to set a single line (used by components and SectionReference) * @internal */ setLineInternal(lineNumber: number, content: string | LineContent): void; /** * @deprecated Use add() which returns a LineReference with update() method * Set a single line (1-based line numbers) */ setLine(lineNumber: number, content: string | LineContent): void; /** * Set content in the region, replacing all existing content. * This always does a full replace - if the new content is the same length, * it will overwrite the existing lines. If it's a different length, it will * resize the region accordingly. */ set(content: string | LineContent[] | any, ...additionalLines: any[]): void; /** * Add content to the region, appending it after existing content. * This is useful for adding multiple sections without overwriting previous content. * Returns a SectionReference or ComponentReference that can be used to update/delete the content later. */ add(content: string | LineContent[] | any, ...additionalLines: any[]): SectionReference | ComponentReference; clearLine(lineNumber: number): void; clear(): void; /** * Force immediate render of any pending updates (bypasses throttle) * Returns a promise that resolves when rendering is complete * @internal - Internal method, not part of public API */ flush(): void; /** * Re-render the last content that was set * This re-renders all components (grid) with the current width * Used by resize handler and keep-alive to prevent auto-reflow * The region orchestrates this - components don't manage their own re-rendering * * CRITICAL: Re-renders the entire region, including: * - Component lines (grid) * - Static lines (waitForSpacebar, whitespace) * This ensures everything is in the correct position */ reRenderLastContent(): void; setThrottle(_fps: number): void; destroy(clearFirst?: boolean): void; } //# sourceMappingURL=region.d.ts.map