vt100.js 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +36 -73
  2. package/package.json +11 -12
  3. package/LICENSE +0 -21
package/README.md CHANGED
@@ -2,10 +2,12 @@
2
2
 
3
3
  Pure TypeScript VT100 terminal emulator. Zero dependencies, headless, fast.
4
4
 
5
+ Part of the [vterm](https://github.com/beorn/vterm) monorepo.
6
+
5
7
  ## Features
6
8
 
7
9
  - Full VT100/ANSI escape sequence parsing
8
- - SGR attributes (bold, italic, underline, colors, etc.)
10
+ - SGR attributes (bold, italic, underline styles, colors, strikethrough, etc.)
9
11
  - 16-color, 256-color, and 24-bit truecolor support
10
12
  - Cursor movement, save/restore (DECSC/DECRC)
11
13
  - Screen modes (alternate screen, auto-wrap, origin mode, etc.)
@@ -13,18 +15,7 @@ Pure TypeScript VT100 terminal emulator. Zero dependencies, headless, fast.
13
15
  - Scrollback buffer with configurable limit
14
16
  - Insert/delete characters and lines
15
17
  - Wide character support (CJK, emoji)
16
- - Zero dependencies -- works in Bun, Node.js, and browsers
17
-
18
- ## Comparison
19
-
20
- | Package | Screen State | SGR Colors | Scrollback | Wide Chars | Zero Deps | Size |
21
- | ------------------------- | :----------: | :---------: | :--------: | :--------: | :-------: | :----------: |
22
- | **vt100.js** | yes | 16/256/true | yes | yes | yes | ~30KB |
23
- | `@xterm/headless` | yes | 16/256/true | yes | yes | no | ~500KB |
24
- | `node-pty` + xterm | yes | 16/256/true | yes | yes | no | native build |
25
- | `ansi-parser` | no | parse only | no | no | yes | ~5KB |
26
- | `terminal-kit` | yes | 16/256/true | no | partial | no | ~2MB |
27
- | `blessed` / `neo-blessed` | yes | 16/256 | no | no | no | ~1MB |
18
+ - Zero dependencies works in Bun, Node.js, and browsers
28
19
 
29
20
  ## Install
30
21
 
@@ -40,91 +31,63 @@ import { createVt100Screen } from "vt100.js"
40
31
  const screen = createVt100Screen({ cols: 80, rows: 24 })
41
32
  screen.process(new TextEncoder().encode("Hello, \x1b[1mBold\x1b[0m World!"))
42
33
 
43
- // Read cell state
44
- const cell = screen.getCell(0, 0)
45
- console.log(cell.char) // "H"
46
-
47
- // Read text
48
34
  console.log(screen.getText()) // "Hello, Bold World!"
49
-
50
- // Check cursor position
51
- const pos = screen.getCursorPosition()
52
- console.log(pos) // { x: 18, y: 0 }
35
+ console.log(screen.getCell(0, 7).bold) // true
36
+ console.log(screen.getCursorPosition()) // { x: 18, y: 0 }
53
37
  ```
54
38
 
55
39
  ## API
56
40
 
57
41
  ### `createVt100Screen(options)`
58
42
 
59
- Create a new screen instance.
60
-
61
- ```typescript
62
- const screen = createVt100Screen({
63
- cols: 80, // terminal width
64
- rows: 24, // terminal height
65
- scrollbackLimit: 1000, // max scrollback lines (default: 1000)
66
- })
67
- ```
43
+ | Option | Type | Default | Description |
44
+ | ----------------- | -------- | -------- | -------------------- |
45
+ | `cols` | `number` | required | Terminal width |
46
+ | `rows` | `number` | required | Terminal height |
47
+ | `scrollbackLimit` | `number` | `1000` | Max scrollback lines |
68
48
 
69
49
  ### Screen methods
70
50
 
71
- | Method | Description |
72
- | -------------------------------------------------- | --------------------------------------------------------- |
73
- | `process(data: Uint8Array)` | Feed raw terminal data |
74
- | `getText()` | Get all text (scrollback + screen) |
75
- | `getTextRange(startRow, startCol, endRow, endCol)` | Get text in a range |
76
- | `getLine(row)` | Get cells for a row |
77
- | `getCell(row, col)` | Get a single cell (char, fg, bg, bold, etc.) |
78
- | `getCursorPosition()` | Get cursor `{ x, y }` |
79
- | `getCursorVisible()` | Check cursor visibility |
80
- | `getMode(mode)` | Check terminal mode (`altScreen`, `bracketedPaste`, etc.) |
81
- | `getTitle()` | Get window title (set via OSC 0/2) |
82
- | `getScrollbackLength()` | Number of scrollback lines |
83
- | `getViewportOffset()` | Current viewport scroll offset |
84
- | `scrollViewport(delta)` | Scroll viewport by delta lines |
85
- | `resize(cols, rows)` | Resize the terminal |
86
- | `reset()` | Reset to initial state |
51
+ | Method | Description |
52
+ | ------------------------------ | ---------------------------------- |
53
+ | `process(data: Uint8Array)` | Feed raw terminal data |
54
+ | `getText()` | Get all text (scrollback + screen) |
55
+ | `getTextRange(sr, sc, er, ec)` | Get text in a range |
56
+ | `getLine(row)` | Get cells for a row |
57
+ | `getCell(row, col)` | Get a single cell |
58
+ | `getCursorPosition()` | Get cursor `{ x, y }` |
59
+ | `getCursorVisible()` | Check cursor visibility |
60
+ | `getMode(mode)` | Check terminal mode |
61
+ | `getTitle()` | Get window title |
62
+ | `getScrollbackLength()` | Number of scrollback lines |
63
+ | `getViewportOffset()` | Current viewport scroll offset |
64
+ | `scrollViewport(delta)` | Scroll viewport |
65
+ | `resize(cols, rows)` | Resize terminal |
66
+ | `reset()` | Reset to initial state |
87
67
 
88
68
  ### Cell properties
89
69
 
90
70
  ```typescript
91
71
  interface ScreenCell {
92
- char: string // character content
93
- fg: CellColor | null // foreground color { r, g, b }
94
- bg: CellColor | null // background color { r, g, b }
72
+ char: string
73
+ fg: CellColor | null // { r, g, b }
74
+ bg: CellColor | null
95
75
  bold: boolean
96
76
  faint: boolean
97
77
  italic: boolean
98
- underline: UnderlineStyle // "none" | "single" | "double" | "curly" | "dotted" | "dashed"
78
+ underline: "none" | "single" | "double" | "curly" | "dotted" | "dashed"
99
79
  strikethrough: boolean
100
80
  inverse: boolean
101
81
  hidden: boolean
102
- wide: boolean // true for CJK/emoji double-width chars
82
+ wide: boolean
103
83
  }
104
84
  ```
105
85
 
106
- ### Terminal modes
107
-
108
- Queryable via `screen.getMode(mode)`:
109
-
110
- - `altScreen` -- alternate screen buffer
111
- - `bracketedPaste` -- bracketed paste mode
112
- - `mouseTracking` -- mouse tracking
113
- - `autoWrap` -- auto-wrap at right margin (default: on)
114
- - `applicationCursor` -- application cursor keys
115
- - `applicationKeypad` -- application keypad mode
116
- - `originMode` -- origin mode
117
- - `insertMode` -- insert mode
118
- - `reverseVideo` -- reverse video
119
- - `focusTracking` -- focus tracking
120
- - `cursorVisible` -- cursor visibility
121
-
122
- ## Ecosystem
86
+ ## See also
123
87
 
124
- - [Termless](https://termless.dev) -- headless terminal testing (uses vt100.js as its default backend)
125
- - [Terminfo.dev](https://terminfo.dev) -- terminal feature support tables
126
- - [Silvery](https://silvery.dev) -- React TUI framework
127
- - [@termless/vt100](https://github.com/beorn/termless) -- Termless backend wrapper for vt100.js
88
+ - [vterm.js](../vterm/) full-featured modern emulator (100% terminfo.dev coverage)
89
+ - [Termless](https://termless.dev) headless terminal testing
90
+ - [Terminfo.dev](https://terminfo.dev) terminal feature support tables
128
91
 
129
92
  ## License
130
93
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vt100.js",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Pure TypeScript VT100 terminal emulator. Zero dependencies, headless, fast.",
5
5
  "keywords": [
6
6
  "ansi",
@@ -11,26 +11,25 @@
11
11
  "vt100",
12
12
  "zero-dependency"
13
13
  ],
14
- "homepage": "https://github.com/beorn/vt100",
15
- "bugs": "https://github.com/beorn/vt100/issues",
14
+ "homepage": "https://github.com/beorn/vterm/tree/main/packages/vt100",
15
+ "bugs": "https://github.com/beorn/vterm/issues",
16
16
  "license": "MIT",
17
17
  "author": "Beorn",
18
- "repository": "github:beorn/vt100",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/beorn/vterm.git",
21
+ "directory": "packages/vt100"
22
+ },
23
+ "files": [
24
+ "src"
25
+ ],
19
26
  "type": "module",
20
27
  "exports": {
21
28
  ".": "./src/index.ts"
22
29
  },
23
- "files": ["src"],
24
30
  "publishConfig": {
25
31
  "access": "public"
26
32
  },
27
- "scripts": {
28
- "test": "vitest run",
29
- "typecheck": "tsc --noEmit"
30
- },
31
- "devDependencies": {
32
- "vitest": "^4.0.0"
33
- },
34
33
  "engines": {
35
34
  "node": ">=23.6.0"
36
35
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Beorn
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.