import { type OutputTransformer } from "./render-node-to-output.js"; import { type Dimension } from "../utils/dimension.js"; import { type AnsiCode } from "../types/ansi.js"; /** * Options for writing text to an output target. */ export interface OutputWriteOptions { /** Array of transformers to apply to each rendered line. */ transformers: OutputTransformer[]; } /** * Represents a clipping rectangle. */ export interface Clip { /** Left boundary (undefined for no limit). */ x1: number | undefined; /** Right boundary (undefined for no limit). */ x2: number | undefined; /** Top boundary (undefined for no limit). */ y1: number | undefined; /** Bottom boundary (undefined for no limit). */ y2: number | undefined; } /** * Represents a raw output entry that bypasses normal text rendering. */ export interface RawEntry { /** X coordinate (column) of the raw content. */ x: number; /** Y coordinate (row) of the raw content. */ y: number; /** Raw content to output unchanged. */ content: string; } /** * Shared write/clip/unclip surface used by render traversal. */ export interface OutputLike { write(x: number, y: number, text: string, options: OutputWriteOptions): void; clip(clip: Clip): void; unclip(): void; fill(x: number, y: number, length: number, char: string, charWidth: number, styles: AnsiCode[]): void; writeRaw(x: number, y: number, content: string): void; getRawEntries(): RawEntry[]; } /** * "Virtual" output class * * Handles the positioning and saving of the output of each node in the tree. * Also responsible for applying transformations to each character. * * Used to generate the final output of all nodes before writing to stdout. */ export declare class Output implements OutputLike { width: number; height: number; private readonly operations; private readonly rawEntries; /** * Creates a new Output instance. * * @param dimension - Dimensions containing width and height. */ constructor(dimension: Dimension); /** * Writes text to the output at a specified position. * * @param x - The x-coordinate (column). * @param y - The y-coordinate (row). * @param text - The text to write. * @param options - Options containing transformers. */ write(x: number, y: number, text: string, options: OutputWriteOptions): void; /** * Sets a clipping area for subsequent operations. * * @param clip - The clipping rectangle. */ clip(clip: Clip): void; /** * Removes the last clipping area, restoring the previous one. */ unclip(): void; fill(x: number, y: number, length: number, char: string, _charWidth: number, styles: AnsiCode[]): void; writeRaw(x: number, y: number, content: string): void; getRawEntries(): RawEntry[]; /** * Generates the final output string and its height. * * @returns An object containing the generated output string and its height. */ get(): { output: string; height: number; }; }