@nu-art/commando
Version:
62 lines (61 loc) • 2.26 kB
TypeScript
import * as blessed from 'neo-blessed';
import { Widgets } from 'blessed';
/**
* A collection of Blessed elements for easy access.
*/
export declare const BlessedElements: {
screen: typeof blessed.screen;
box: typeof blessed.box;
text: typeof blessed.text;
list: typeof blessed.list;
log: typeof blessed.log;
textarea: typeof blessed.textarea;
textbox: typeof blessed.textbox;
form: typeof blessed.form;
progressbar: typeof blessed.progressbar;
table: typeof blessed.table;
listTable: typeof blessed.listtable;
prompt: typeof blessed.prompt;
message: typeof blessed.message;
loading: typeof blessed.loading;
radioSet: typeof blessed.radioset;
radiobutton: typeof blessed.radiobutton;
checkbox: typeof blessed.checkbox;
input: typeof blessed.input;
button: typeof blessed.button;
line: typeof blessed.line;
scrollableBox: typeof blessed.scrollablebox;
scrollableText: typeof blessed.scrollabletext;
terminal: typeof blessed.terminal;
bigText: typeof blessed.bigtext;
listBar: typeof blessed.listbar;
fileManager: typeof blessed.filemanager;
};
type Created = typeof BlessedElements;
/**
* A type representing the keys of BlessedElements.
*/
export type BlessedWidgetsType = keyof Created;
/**
* A type representing the options for each Blessed widget.
*/
export type BlessedWidgetOptions = {
[Type in keyof Created]: Parameters<Created[Type]>[0];
};
/**
* A type representing each Blessed widget.
*/
export type BlessedWidget = {
[Type in keyof Created]: ReturnType<Created[Type]>;
};
/**
* Creates a Blessed widget of the specified type with the given properties and parent node.
*
* @template WidgetType - The type of the widget to create.
* @param {WidgetType} type - The type of the widget to create.
* @param {BlessedWidgetOptions[WidgetType]} props - The properties to apply to the widget.
* @param {Widgets.Node} [parent] - The parent node for the widget.
* @returns {BlessedWidget[WidgetType]} The created widget.
*/
export declare function createBlessedWidget<WidgetType extends BlessedWidgetsType>(type: WidgetType, props?: BlessedWidgetOptions[WidgetType], parent?: Widgets.Node): BlessedWidget[WidgetType];
export {};