UNPKG

@teaui/core

Version:

A high-level terminal UI library for Node

37 lines (36 loc) 1.38 kB
import type { Terminal, SGRTerminal } from './terminal.js'; import type { Color } from './Color.js'; import { Style } from './Style.js'; import { Size } from './geometry.js'; export declare class Buffer implements Terminal { #private; size: Size; setForeground(_fg: Color): void; setBackground(_bg: Color): void; resize(size: Size): void; /** * Invalidates the diff cache so the next flush writes all cells. * Used by test harnesses that reset the terminal between renders. */ invalidate(): void; /** * Writes the string at the cursor from left to write. Exits on newline (no default * wrapping behavior). */ writeChar(char: string, x: number, y: number, style: Style): void; /** * Fills a rectangular region with BG_DRAW cells lazily. * The cells are materialized during flush or when overwritten by writeChar. */ paintRect(style: Style, minX: number, minY: number, maxX: number, maxY: number): void; /** * Replaces the style of an existing cell without changing its character. * If no cell exists at (x, y), writes a space with the given style. */ restyleChar(x: number, y: number, style: Style): void; /** * For ANSI sequences that aren't related to any specific character. */ writeMeta(str: string): void; flush(terminal: SGRTerminal): void; }