malwoden
Version:
   
39 lines (38 loc) • 1.17 kB
TypeScript
import { WidgetConfig } from ".";
import { Color } from "../terminal";
import { Widget } from "./widget";
export declare function truncateText(config: {
text: string;
truncateAfter: number;
addEllipsis: boolean;
}): string;
export declare function wrapText(config: {
text: string;
wrapAt: number;
}): string[];
/**
* The State of a TextWidget
*/
export interface TextWidgetState {
/** The text to display */
text: string;
/** The color to use for the text. Default White. */
foreColor?: Color;
/** The color to use for the background. Default Black*/
backColor?: Color;
/** Truncate the text after this amount */
truncateAfter?: number;
/** Change the last three chars of a truncated text to ... */
truncateAddEllipsis?: boolean;
/** Wrap the text after this number */
wrapAt?: number;
}
/**
* Represents text to draw to the screen, potentially truncated or wrapped.
*/
export declare class TextWidget extends Widget<TextWidgetState> {
constructor(config: WidgetConfig<TextWidgetState>);
private getLines;
private getText;
onDraw(): void;
}