UNPKG

@teaui/core

Version:

A high-level terminal UI library for Node

29 lines (28 loc) 1.19 kB
/** * A global function to turn debugging on/off, useful to test things that would * otherwise output way too much, ie console in render() */ export declare function debug(value?: boolean): boolean; /** * Left pads (with spaces) according to terminal width */ export declare function leftPad(str: string, length: number): string; /** * Right pads (with spaces) according to terminal width */ export declare function rightPad(str: string, length: number): string; /** * Center pads (with spaces) according to terminal width */ export declare function centerPad(str: string, length: number): string; /** * Used to add {enumerable: true} to defined properties on Components, so they * are picked up by inspect(). */ export declare function define<T extends object>(object: T, property: keyof T, attributes: PropertyDescriptor): void; /** * Wraps lines to fit within contentWidth. Lots to solve for here. * 1. Word wrapping is accomplished using unicode.words * 2. ANSI codes are restored by scanning the segments, inserting the ANSI back where it belongs */ export declare function wrap(input: string | string[] | [string, number][], contentWidth: number): [string, number][];