vt100.js 0.1.0 → 0.2.0

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 (2) hide show
  1. package/README.md +35 -35
  2. package/package.json +18 -7
package/README.md CHANGED
@@ -17,14 +17,14 @@ Pure TypeScript VT100 terminal emulator. Zero dependencies, headless, fast.
17
17
 
18
18
  ## Comparison
19
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 |
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 |
28
28
 
29
29
  ## Install
30
30
 
@@ -42,14 +42,14 @@ screen.process(new TextEncoder().encode("Hello, \x1b[1mBold\x1b[0m World!"))
42
42
 
43
43
  // Read cell state
44
44
  const cell = screen.getCell(0, 0)
45
- console.log(cell.char) // "H"
45
+ console.log(cell.char) // "H"
46
46
 
47
47
  // Read text
48
- console.log(screen.getText()) // "Hello, Bold World!"
48
+ console.log(screen.getText()) // "Hello, Bold World!"
49
49
 
50
50
  // Check cursor position
51
51
  const pos = screen.getCursorPosition()
52
- console.log(pos) // { x: 18, y: 0 }
52
+ console.log(pos) // { x: 18, y: 0 }
53
53
  ```
54
54
 
55
55
  ## API
@@ -60,46 +60,46 @@ Create a new screen instance.
60
60
 
61
61
  ```typescript
62
62
  const screen = createVt100Screen({
63
- cols: 80, // terminal width
64
- rows: 24, // terminal height
65
- scrollbackLimit: 1000 // max scrollback lines (default: 1000)
63
+ cols: 80, // terminal width
64
+ rows: 24, // terminal height
65
+ scrollbackLimit: 1000, // max scrollback lines (default: 1000)
66
66
  })
67
67
  ```
68
68
 
69
69
  ### Screen methods
70
70
 
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 |
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 |
87
87
 
88
88
  ### Cell properties
89
89
 
90
90
  ```typescript
91
91
  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 }
92
+ char: string // character content
93
+ fg: CellColor | null // foreground color { r, g, b }
94
+ bg: CellColor | null // background color { r, g, b }
95
95
  bold: boolean
96
96
  faint: boolean
97
97
  italic: boolean
98
- underline: UnderlineStyle // "none" | "single" | "double" | "curly" | "dotted" | "dashed"
98
+ underline: UnderlineStyle // "none" | "single" | "double" | "curly" | "dotted" | "dashed"
99
99
  strikethrough: boolean
100
100
  inverse: boolean
101
101
  hidden: boolean
102
- wide: boolean // true for CJK/emoji double-width chars
102
+ wide: boolean // true for CJK/emoji double-width chars
103
103
  }
104
104
  ```
105
105
 
package/package.json CHANGED
@@ -1,26 +1,37 @@
1
1
  {
2
2
  "name": "vt100.js",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Pure TypeScript VT100 terminal emulator. Zero dependencies, headless, fast.",
5
- "keywords": ["vt100", "terminal-emulator", "ansi", "typescript", "headless", "zero-dependency", "tui"],
5
+ "keywords": [
6
+ "ansi",
7
+ "headless",
8
+ "terminal-emulator",
9
+ "tui",
10
+ "typescript",
11
+ "vt100",
12
+ "zero-dependency"
13
+ ],
6
14
  "homepage": "https://github.com/beorn/vt100",
7
15
  "bugs": "https://github.com/beorn/vt100/issues",
8
16
  "license": "MIT",
9
17
  "author": "Beorn",
10
18
  "repository": "github:beorn/vt100",
11
19
  "type": "module",
12
- "module": "./src/index.ts",
13
20
  "exports": {
14
21
  ".": "./src/index.ts"
15
22
  },
16
23
  "files": ["src"],
17
- "publishConfig": { "access": "public" },
18
- "engines": { "bun": ">=1.0.0", "node": ">=18" },
19
- "devDependencies": {
20
- "vitest": "^4.0.0"
24
+ "publishConfig": {
25
+ "access": "public"
21
26
  },
22
27
  "scripts": {
23
28
  "test": "vitest run",
24
29
  "typecheck": "tsc --noEmit"
30
+ },
31
+ "devDependencies": {
32
+ "vitest": "^4.0.0"
33
+ },
34
+ "engines": {
35
+ "node": ">=23.6.0"
25
36
  }
26
37
  }