UNPKG

neo-neo-bblessed

Version:

A fork of neo-blessed (which is a fork of blessed) with bug fixes and maintenance.

394 lines (381 loc) 12 kB
import { EventEmitter } from 'events'; /** * helpers.js - helpers for blessed * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). * https://github.com/chjj/blessed */ /** * Helpers */ declare const helpers: any; declare const merge: any; declare const asort: any; declare const hsort: any; declare const findFile: any; declare const escape: any; declare const parseTags: any; declare const generateTags: any; declare const attrToBinary: any; declare const stripTags: any; declare const cleanTags: any; declare const dropUnicode: any; declare const __helpers_js_asort: typeof asort; declare const __helpers_js_attrToBinary: typeof attrToBinary; declare const __helpers_js_cleanTags: typeof cleanTags; declare const __helpers_js_dropUnicode: typeof dropUnicode; declare const __helpers_js_escape: typeof escape; declare const __helpers_js_findFile: typeof findFile; declare const __helpers_js_generateTags: typeof generateTags; declare const __helpers_js_hsort: typeof hsort; declare const __helpers_js_merge: typeof merge; declare const __helpers_js_parseTags: typeof parseTags; declare const __helpers_js_stripTags: typeof stripTags; declare namespace __helpers_js { export { __helpers_js_asort as asort, __helpers_js_attrToBinary as attrToBinary, __helpers_js_cleanTags as cleanTags, helpers as default, __helpers_js_dropUnicode as dropUnicode, __helpers_js_escape as escape, __helpers_js_findFile as findFile, __helpers_js_generateTags as generateTags, __helpers_js_hsort as hsort, __helpers_js_merge as merge, __helpers_js_parseTags as parseTags, __helpers_js_stripTags as stripTags }; } /** * unicode.ts - modern unicode utilities using npm packages * Copyright (c) 2025, Contributors (MIT License). * Replaces embedded unicode libraries with proper npm dependencies */ /** * Wide, Surrogates, and Combining */ declare function charWidth(str: string | number, i?: number): number; declare function strWidth(str: string): number; declare function isSurrogate(str: string | number, i?: number): boolean; /** * Use unicode-properties for combining character detection */ declare function isCombining(str: string | number, i?: number): boolean; /** * Code Point Helpers - using native implementations when available */ declare function codePointAt(str: string, position?: number): number; declare function fromCodePoint(...codePoints: number[]): string; declare const charsWithAll: { all: RegExp; wide: RegExp; swide: RegExp; surrogate: RegExp; combining: RegExp; }; declare const combiningTable: number[][]; declare const combiningProxy: {}; declare const __unicode_js_charWidth: typeof charWidth; declare const __unicode_js_codePointAt: typeof codePointAt; declare const __unicode_js_combiningTable: typeof combiningTable; declare const __unicode_js_fromCodePoint: typeof fromCodePoint; declare const __unicode_js_isCombining: typeof isCombining; declare const __unicode_js_isSurrogate: typeof isSurrogate; declare const __unicode_js_strWidth: typeof strWidth; declare namespace __unicode_js { export { __unicode_js_charWidth as charWidth, charsWithAll as chars, __unicode_js_codePointAt as codePointAt, combiningProxy as combining, __unicode_js_combiningTable as combiningTable, __unicode_js_fromCodePoint as fromCodePoint, __unicode_js_isCombining as isCombining, __unicode_js_isSurrogate as isSurrogate, __unicode_js_strWidth as strWidth }; } /** * colors.js - color-related functions for blessed. * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). * https://github.com/chjj/blessed */ interface RGB { 0: number; 1: number; 2: number; } type ColorInput = string | number[] | RGB; declare function match(r1: number | string | number[], g1?: number, b1?: number): number; declare function RGBToHex(r: number | number[], g?: number, b?: number): string; declare function hexToRGB(hex: string): number[]; declare function colorDistance(r1: number, g1: number, b1: number, r2: number, g2: number, b2: number): number; declare function mixColors(c1: number, c2: number, alpha?: number | null): number; declare function blend(attr: number, attr2?: number | null, alpha?: number): number; declare namespace blend { var _cache: {}; } declare const _cache: {}; declare function reduce(color: number, total: number): number; declare const xterm: string[]; declare const vcolors: number[][]; declare const colors: string[]; declare const colorNames: { [key: string]: number; }; declare function convert(color: ColorInput): number; declare const ccolors: any; declare const ncolors: string[]; declare const __colors_js_RGBToHex: typeof RGBToHex; declare const __colors_js__cache: typeof _cache; declare const __colors_js_blend: typeof blend; declare const __colors_js_ccolors: typeof ccolors; declare const __colors_js_colorDistance: typeof colorDistance; declare const __colors_js_colorNames: typeof colorNames; declare const __colors_js_colors: typeof colors; declare const __colors_js_convert: typeof convert; declare const __colors_js_hexToRGB: typeof hexToRGB; declare const __colors_js_match: typeof match; declare const __colors_js_mixColors: typeof mixColors; declare const __colors_js_ncolors: typeof ncolors; declare const __colors_js_reduce: typeof reduce; declare const __colors_js_vcolors: typeof vcolors; declare const __colors_js_xterm: typeof xterm; declare namespace __colors_js { export { __colors_js_RGBToHex as RGBToHex, __colors_js__cache as _cache, __colors_js_blend as blend, __colors_js_ccolors as ccolors, __colors_js_colorDistance as colorDistance, __colors_js_colorNames as colorNames, __colors_js_colors as colors, __colors_js_convert as convert, __colors_js_hexToRGB as hexToRGB, __colors_js_match as match, __colors_js_mixColors as mixColors, __colors_js_ncolors as ncolors, __colors_js_reduce as reduce, __colors_js_vcolors as vcolors, __colors_js_xterm as xterm }; } /** * tput.js - parse and compile terminfo caps to javascript. * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). * https://github.com/chjj/blessed */ /** * Tput */ interface TputOptions { terminal?: string; term?: string; debug?: boolean; padding?: boolean; extended?: boolean; printf?: boolean; termcap?: boolean; terminfoPrefix?: string; terminfoFile?: string; termcapFile?: string; [key: string]: any; } interface TerminfoData { header: any; dataSize: number; name: string; names: string[]; desc: string; file: string; booleans: { [key: string]: boolean; }; numbers: { [key: string]: number; }; strings: { [key: string]: string; }; } interface TputInterface { options: TputOptions; terminal: string; debug?: boolean; padding?: boolean; extended?: boolean; printf?: boolean; termcap?: boolean; error: Error | null; terminfoPrefix?: string; terminfoFile?: string; termcapFile?: string; setup(): void; term(is: string): boolean; readTerminfo(term?: string): TerminfoData; parseTerminfo(data: Buffer, file?: string): TerminfoData; injectTerminfo(file?: string): void; injectTermcap(file?: string): void; [key: string]: any; } declare function Tput(this: TputInterface, options?: TputOptions | string): TputInterface; declare namespace Tput { var ipaths: (string | string[])[]; var _prefix: (this: TputInterface, term?: string) => string; var _tprefix: (this: TputInterface, prefix: string | string[], term: string, soft?: boolean) => string | null; var print: () => any; var cpaths: (string | string[])[]; var _alias: any; var alias: {}; var aliasMap: {}; var termcap: string; var bools: string[]; var numbers: string[]; var strings: string[]; var acsc: { '`': string; a: string; b: string; c: string; d: string; e: string; f: string; g: string; h: string; i: string; j: string; k: string; l: string; m: string; n: string; o: string; p: string; q: string; r: string; s: string; t: string; u: string; v: string; w: string; x: string; y: string; z: string; '{': string; '|': string; '}': string; '~': string; }; var utoa: { '\u25C6': string; '\u2592': string; '\u00B0': string; '\u00B1': string; '\u2424': string; '\u2518': string; '\u2510': string; '\u250C': string; '\u2514': string; '\u253C': string; '\u23BA': string; '\u23BB': string; '\u2500': string; '\u23BC': string; '\u23BD': string; '\u251C': string; '\u2524': string; '\u2534': string; '\u252C': string; '\u2502': string; '\u2264': string; '\u2265': string; π: string; '\u2260': string; '\u00A3': string; '\u00B7': string; }; } /** * program.js - basic curses-like functionality for blessed. * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License). * https://github.com/chjj/blessed */ /** * Modules */ /** * Program */ interface ProgramOptions { input?: any; output?: any; log?: string; dump?: string; zero?: boolean; buffer?: boolean; terminal?: string; term?: string; debug?: boolean; resizeTimeout?: number; [key: string]: any; } interface ProgramInterface extends EventEmitter { options: ProgramOptions; input: any; output: any; x: number; y: number; savedX: number; savedY: number; cols: number; rows: number; scrollTop: number; scrollBottom: number; _terminal: string; tput?: any; isOSXTerm: boolean; isiTerm2: boolean; isXFCE: boolean; isTerminator: boolean; isLXDE: boolean; isVTE: boolean; isRxvt: boolean; isXterm: boolean; isTmux: boolean; isScreen: boolean; listen(): void; destroy(): void; write(text: string): boolean; flush(): void; clear(): void; reset(): void; _write(text: string): boolean; log(...args: any[]): void; [key: string]: any; } declare function Program(this: ProgramInterface, options?: ProgramOptions | any): ProgramInterface; declare namespace Program { var global: any; var total: number; var instances: any[]; var bind: (program: ProgramInterface) => void; } declare const screen: any; declare const box: any; declare const text: any; declare const line: any; declare const list: any; declare const scrollablebox: any; declare const scrollabletext: any; declare const log: any; declare const textbox: any; declare const textarea: any; /** * The main blessed namespace that provides access to all widgets and functionality. * * @example * ```typescript * import blessed from 'neo-neo-blessed'; * * const screen = blessed.screen({ * smartCSR: true * }); * * const box = blessed.box({ * parent: screen, * top: 'center', * left: 'center', * width: '50%', * height: '50%', * content: 'Hello World!', * tags: true, * border: { * type: 'line' * }, * style: { * fg: 'white', * bg: 'magenta', * border: { * fg: '#f0f0f0' * }, * hover: { * bg: 'green' * } * } * }); * * screen.render(); * ``` */ declare function blessed(): any; declare namespace blessed { var program: typeof Program; var Program: typeof Program; var tput: typeof Tput; var Tput: typeof Tput; var widget: any; var colors: typeof __colors_js; var unicode: typeof __unicode_js; var helpers: typeof __helpers_js; } export { box, blessed as default, line, list, log, Program as program, screen, scrollablebox, scrollabletext, text, textarea, textbox, Tput as tput };