@svelterm/vt100
v0.1.0
Published
VT100/xterm terminal emulator — ANSI parser and cell grid
Maintainers
Readme
@svelterm/vt100
VT100/xterm terminal emulator: an ANSI escape-sequence parser feeding a cell grid, plus Svelte views for rendering it. Powers the embedded terminals in svelterm, but has no dependency on svelterm — the core emulator is plain TypeScript.
npm install @svelterm/vt100Emulator
import { Terminal } from '@svelterm/vt100'
const term = new Terminal(80, 24)
term.write('\x1b[1;32mhello\x1b[0m world\r\n')
// term.grid holds styled cells; term.cursor the cursor positionParser (the raw escape-sequence event stream), Cell/Color/Attr
(the grid vocabulary), and keyEventToBytes (browser KeyboardEvent →
terminal input bytes) are exported for building your own plumbing.
Svelte views
@svelterm/vt100/svelte—TerminalView, renders aTerminalinto the DOM (canvas-free, styled text).@svelterm/vt100/EmbeddedTerminalDom— a terminal wired to aTerminalStreamfor DOM rendering.@svelterm/vt100/EmbeddedTerminalRegion— the same, rendered into a svelterm<svt-region>cell area for terminal-in-terminal use.
The Svelte views need svelte ^5 (an optional peer dependency); the
emulator itself runs anywhere.
License
MIT
