Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Implements

Index

Constructors

constructor

Properties

$

$: object

An object for any miscellanous user data.

Type declaration

  • [index: string]: any

_

_: object

An object for any miscellanous user data.

Type declaration

  • [index: string]: any

Optional _hoverText

_hoverText: BoxElement

Element that implements the text hover. @internal

abottom

abottom: TPosition

Absolute bottom offset, always zero.

aleft

aleft: TTopLeft

Absolute left offset, always zero.

aright

aright: TPosition

Absolute right offset, always zero.

atop

atop: TTopLeft

Absolute top offset, always zero.

autoPadding

autoPadding: boolean

Automatically position child elements with border and padding in mind (NOTE: this is a recommended option. It may become default in the future).

bottom

bottom: TPosition

Relative bottom offset, always zero.

children

children: Node[]

Array of node's children.

cols

cols: number

Same as screen.width.

cursor

cursor: TCursor

data

data: object

An object for any miscellanous user data.

Type declaration

  • [index: string]: any

Optional destroyed

destroyed: boolean

true is the terminal was destroyed. @internal.

dockBorders

dockBorders: boolean

Automatically "dock" borders with other elements instead of overlapping, depending on position (experimental). For example: These border-overlapped elements:

dump

dump: string

Dump all output and input to desired file. Can be used together with log option if set as a boolean.

fastCSR

fastCSR: boolean

Do CSR on any element within 20 cols of the screen edge on either side. Faster than smartCSR, but may cause flickering depending on what is on each side of the element.

focusable

focusable: boolean

focused

Top of the focus history stack.

forceUnicode

forceUnicode: boolean

Force blessed to use unicode even if it is not detected via terminfo, env variables, or windows code page. If value is true unicode is forced. If value is false non-unicode is forced (default: null).

fullUnicode

fullUnicode: boolean

Allow for rendering of East Asian double-width characters, utf-16 surrogate pairs, and unicode combining characters. This allows you to display text above the basic multilingual plane. This is behind an option because it may affect performance slightly negatively. Without this option enabled, all double-width, surrogate pair, and combining characters will be replaced by '??', '?', '' respectively. (NOTE: iTerm2 cannot display combining characters properly. Blessed simply removes them from an element's content if iTerm2 is detected).

grabKeys

grabKeys: any

Whether the focused element grabs all keypresses.

height

height: number

Height of the screen (same as program.rows).

history

history: BlessedElement[]

focus history. @internal

hover

hover: any

The currently hovered element. Only set if mouse events are bound.

ignoreDockContrast

ignoreDockContrast: boolean

Normally, dockable borders will not dock if the colors or attributes are different. This option will allow them to dock regardless. It may produce some odd looking multi-colored borders though.

ignoreLocked

ignoreLocked: boolean

Array of keys in their full format (e.g. C-c) to ignore when keys are locked or grabbed. Useful for creating a key that will always exit no matter whether the keys are locked.

index

index: number

Render index (document order index) of the last render call.

input

input: stream.Writable

Input and output streams. process.stdin/process.stdout by default, however, it could be a net.Socket if you want to make a program that runs over telnet or something of that nature.

left

left: TTopLeft

Relative left offset, always zero.

lines

lines: ScreenLine[][]

Internal Screen buffer of current lines. Exposed for debug purpuses. @internal

lockKeys

lockKeys: boolean

Prevent keypresses from being received by any element.

lpos

options

Original options object.

output

output: stream.Readable

Input and output streams. process.stdin/process.stdout by default, however, it could be a net.Socket if you want to make a program that runs over telnet or something of that nature.

Optional parent

parent: Node

Parent node. If null it means the element is not attached to any screen or program, or the node is a Screen.

program

The blessed Program to be associated with. Will be automatically instantiated if none is provided.

resizeTimeout

resizeTimeout: number

Amount of time (in ms) to redraw the screen after the terminal is resized (Default: 300).

right

right: TPosition

Relative right offset, always zero.

rows

rows: number

Same as screen.height.

screen

screen: Screen

Parent screen.

sendFocus

sendFocus: boolean

Send focus events after mouse is enabled.

smartCSR

smartCSR: boolean

Attempt to perform CSR optimization on all possible elements (not just full-width ones, elements with uniform cells to their sides). This is known to cause flickering with elements that are not full-width, however, it is more optimal for terminal rendering.

tabSize

tabSize: number

The width of tabs within an element's content.

terminal

terminal: string

Set or get terminal name. Set calls screen.setTerminal() internally.

title

title: string

Set or get window title.

top

Relative top offset, always zero.

tput

tput: Tput

The blessed Tput object (only available if you passed tput: true to the Program constructor.)

type

type: string

Type of the node (e.g. box).

uid

uid: number

Unique identifier for Node instances. @internal

useBCE

useBCE: boolean

Attempt to perform back_color_erase optimizations for terminals that support it. It will also work with terminals that don't support it, but only on lines with the default background color. As it stands with the current implementation, it's uncertain how much terminal performance this adds at the cost of overhead within node.

warnings

warnings: boolean

Display warnings (such as the output not being a TTY, similar to ncurses).

width

width: number

Width of the screen (same as program.cols).

Static defaultMaxListeners

defaultMaxListeners: number

Methods

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

alloc

  • alloc(): void
  • Allocate a new pending screen buffer and a new output screen buffer.

    Returns void

append

  • append(node: Node): void

attrCode

  • attrCode(code: string, cur: number, def: number): number
  • Convert an SGR string to our own attribute format.

    Parameters

    • code: string
    • cur: number
    • def: number

    Returns number

cleanSides

  • Parse the sides of an element to determine whether an element has uniform cells on both sides. If it does, we can use CSR to optimize scrolling on a scrollable element. Not exactly sure how worthwile this is. This will cause a performance/cpu-usage hit, but will it be less or greater than the performance hit of slow-rendering scrollable boxes with clean sides?

    Parameters

    Returns boolean

clearRegion

  • clearRegion(x1: number, x2: number, y1: number, y2: number): void

codeAttr

  • codeAttr(attr: number): string

collectAncestors

  • collectAncestors(s?: boolean): void

collectDescendants

  • collectDescendants(s?: boolean): void

copyToClipboard

  • copyToClipboard(text: string): void
  • Attempt to copy text to clipboard using iTerm2's proprietary sequence. Returns true if successful.

    Parameters

    • text: string

    Returns void

cursorColor

  • cursorColor(color: string): void

cursorReset

  • cursorReset(): void

cursorShape

  • cursorShape(shape: boolean, blink: boolean): any
  • Attempt to change cursor shape. Will not work in all terminals (see artificial cursors for a solution to this). Returns true if successful.

    Parameters

    • shape: boolean
    • blink: boolean

    Returns any

debug

  • debug(...msg: string[]): void
  • Same as the log method, but only gets called if the debug option was set.

    Parameters

    • Rest ...msg: string[]

    Returns void

deleteBottom

  • deleteBottom(top: number, bottom: number): void

deleteLine

  • deleteLine(n: number, y: number, top: number, bottom: number): void
  • Delete a line from the screen (using csr: this bypasses the output buffer).

    Parameters

    • n: number
    • y: number
    • top: number
    • bottom: number

    Returns void

deleteTop

  • deleteTop(top: number, bottom: number): void

destroy

  • destroy(): void
  • Destroy the screen object and remove it from the global list. Also remove all global events relevant to the screen object. If all screen objects are destroyed, the node process is essentially reset to its initial state.

    Returns void

detach

  • detach(): void

draw

  • draw(start: number, end: number): void
  • Draw the screen based on the contents of the screen buffer.

    Parameters

    • start: number
    • end: number

    Returns void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

emitAncestors

  • emitAncestors(): void

emitDescendants

  • emitDescendants(type?: string, ...args: any[]): void
  • Emit event for element, and recursively emit same event for all descendants. If s is provided it will call [[iter]] on self first.

    Parameters

    • Optional type: string
    • Rest ...args: any[]

    Returns void

enableInput

enableKeys

  • Enable keypress events for the screen and optionally an element (automatically called when a form of on('keypress') is bound).

    Parameters

    Returns void

enableMouse

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

exec

  • Spawn a process in the foreground, return to blessed app after exit. Executes callback on error or exit.

    Parameters

    • file: string
    • args: string[]
    • options: NodeChildProcessExecOptions
    • callback: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns ChildProcess

fillRegion

  • fillRegion(attr: string, ch: string, x1: number, x2: number, y1: number, y2: number): void
  • Fill any region with a character of a certain attribute.

    Parameters

    • attr: string
    • ch: string
    • x1: number
    • x2: number
    • y1: number
    • y2: number

    Returns void

focusNext

  • focusNext(): void

focusOffset

  • focusOffset(offset: number): any

focusPop

focusPrevious

  • focusPrevious(): void

focusPush

forAncestors

  • forAncestors(iter: function, s?: boolean): void

forDescendants

  • forDescendants(iter: function, s?: boolean): void
  • Visit each node's descendants, with [[iter]] function, parents first. If s is provided it will call [[iter]] on self first.

    Parameters

    • iter: function
        • (node: Node): void
        • Parameters

          Returns void

    • Optional s: boolean

    Returns void

free

  • free(): void

get

  • get<T>(name: string, def: T): T
  • Get user property with a potential default value.

    Type parameters

    • T

    Parameters

    • name: string
    • def: T

    Returns T

getMaxListeners

  • getMaxListeners(): number
  • Returns number

hasAncestor

hasDescendant

insert

  • insert(node: Node, index: number): void
  • Insert a node to this node's children at index i.

    Parameters

    • node: Node
    • index: number

    Returns void

insertAfter

  • insertAfter(node: Node, refNode: Node): void

insertBefore

  • insertBefore(node: Node, refNode: Node): void

insertBottom

  • insertBottom(top: number, bottom: number): void

insertLine

  • insertLine(n: number, y: number, top: number, bottom: number): void
  • Insert a line into the screen (using csr: this bypasses the output buffer).

    Parameters

    • n: number
    • y: number
    • top: number
    • bottom: number

    Returns void

insertTop

  • insertTop(top: number, bottom: number): void

key

leave

  • leave(): void
  • Resets the focus, buffers, clear the sreen, alloc new memory, reset the keypad keys, stop listening to the mouse, etc. But won't emit destroy or other events nor unregister any listener. (I guess is like a reset)

    internal

    Returns void

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

log

  • log(...msg: any[]): void
  • Write string to the log file if one was created.

    Parameters

    • Rest ...msg: any[]

    Returns void

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

onceKey

postEnter

  • postEnter(): void

prepend

  • prepend(node: Node): void

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

readEditor

  • readEditor(options: any, callback: function): void
  • readEditor(callback: function): void
  • Read data from text editor.

    Parameters

    • options: any
    • callback: function
        • (err: ErrnoException, data: Buffer): void
        • Parameters

          • err: ErrnoException
          • data: Buffer

          Returns void

    Returns void

  • Parameters

    • callback: function
        • (err: ErrnoException, data: Buffer): void
        • Parameters

          • err: ErrnoException
          • data: Buffer

          Returns void

    Returns void

realloc

  • realloc(): void

remove

  • remove(node: Node): void

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeKey

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

render

  • render(): void
  • Render all child elements, writing all data to the screen buffer and drawing the screen.

    Returns void

restoreFocus

rewindFocus

saveFocus

screenshot

  • screenshot(xi: number, xl: number, yi: number, yl: number): string
  • screenshot(): void
  • Take an SGR screenshot of the screen within the region. Returns a string containing only characters and SGR codes. Can be displayed by simply echoing it in a terminal.

    Parameters

    • xi: number
    • xl: number
    • yi: number
    • yl: number

    Returns string

  • Returns void

set

  • set(name: string, value: any): void
  • Set user property to value.

    Parameters

    • name: string
    • value: any

    Returns void

setEffects

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

setTerminal

  • setTerminal(term: string): void

spawn

unkey

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc