@teaui/core
Version:
A high-level terminal UI library for Node
41 lines • 969 B
JavaScript
import { StringTerminal } from './StringTerminal.js';
/**
* A headless Program for offscreen rendering (screenshots, ANSI export).
* Wraps a StringTerminal and no-ops everything else.
*/
export class HeadlessProgram {
#terminal;
constructor({ cols, rows }) {
this.#terminal = new StringTerminal({ cols, rows });
}
get terminal() {
return this.#terminal;
}
// --- SGRTerminal interface ---
get cols() {
return this.#terminal.cols;
}
get rows() {
return this.#terminal.rows;
}
move(x, y) {
this.#terminal.move(x, y);
}
write(str) {
this.#terminal.write(str);
}
flush() {
this.#terminal.flush();
}
// --- Program lifecycle ---
setup() { }
teardown() { }
// --- Events ---
onEvents(_listener) {
return () => { };
}
onResize(_listener) {
return () => { };
}
}
//# sourceMappingURL=HeadlessProgram.js.map