Skip to main content
Module

x/tui/mod.ts

🦕 Deno module for creating Terminal User Interfaces
Go to Latest
import * as tui from "https://deno.land/x/tui@1.0.0-RC/mod.ts";

Classes

Combines multiple async iterators into one

Event that defines changes regarding given component

Creates array that automatically sorts elements using compareFn Additionally allows for removing elements

Typed version of EventTarget

Variables

ANSI escape code to clear screen

ANSI escape code to disable mouse handling

ANSI escape code to enable mouse handling

ANSI escape code to hide terminal cursor

ANSI escape code to show terminal cursor

Regexp that allows for extracting unicode sequences that are supposed to represent single character

Functions

Clamp {number} between {min} and {max}

Used as placeholder style when one is not supplied, returns the input

Check whether {number} fits in <{min}, {max}> range

Check whether {column} and {row} fit in {rectangle} boundaries

handleKeypresses() has to be called in order for this function to work. CTRL+Arrows moves focus in appropriate direction. Just Enter (Return) calls interact("keyboard") on focused component. It's up to component how it handles it.

Intercepts keypresses from readKeypress() and dispatch them as events to tui that way keyPress, multiKeyPress and mousePress events work

handleKeypresses() has to be called in order for this function to work. Clicking component calls interact("mouse") on it. It's up to component how it handles it.

Inserts string into string on given index

Check whether character is full width

Get ANSI escape code for moving cursor to given location

Normalize {value} between 0 and 1

Read keypresses from given stdin (except for Windows) and then parse them. On Windows keys are read by calling _getch() in msvcrt.dll. It yields array of either KeyPress or MousePress

Asynchronously sleep for {time} milliseconds

Strips string of all styles

Returns real text width