vterm.js 0.3.0 → 0.4.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.
package/README.md CHANGED
@@ -152,26 +152,29 @@ interface ScreenCell {
152
152
 
153
153
  ## vs vt100.js
154
154
 
155
- | Feature | vt100.js | vterm.js |
156
- | -------------------------------------------- | -------- | -------- |
157
- | SGR basics (bold, italic, underline, colors) | Yes | Yes |
158
- | Underline styles (curly, dotted, dashed) | Yes | Yes |
159
- | Underline color | No | Yes |
160
- | Blink, overline | No | Yes |
161
- | Cursor shapes (DECSCUSR) | No | Yes |
162
- | OSC 8 hyperlinks | No | Yes |
163
- | DA1/DA2/DA3 responses | No | Yes |
164
- | DSR/DECRPM responses | No | Yes |
165
- | Mouse tracking | No | Yes |
166
- | Focus tracking | No | Yes |
167
- | Synchronized output | No | Yes |
168
- | DEC Special Graphics | No | Yes |
169
- | REP (repeat character) | No | Yes |
170
- | DECSTR (soft reset) | No | Yes |
171
- | DCS sequences | No | Yes |
172
- | Package size | Smaller | Larger |
173
-
174
- **Use vt100.js** when you want fast and simple — it covers ~90% of real-world terminal usage.
155
+ | Feature | vt100.js | vterm.js |
156
+ | ----------------------------------------- | -------- | -------- |
157
+ | Bold, underline (boolean), blink, inverse | Yes | Yes |
158
+ | Colors (8/256/truecolor) | No | Yes |
159
+ | Italic, faint, strikethrough, overline | No | Yes |
160
+ | Underline styles (curly, dotted, dashed) | No | Yes |
161
+ | Underline color | No | Yes |
162
+ | Wide characters (CJK, emoji) | No | Yes |
163
+ | Cursor shapes (DECSCUSR) | No | Yes |
164
+ | Insert/delete characters and lines | No | Yes |
165
+ | OSC 8 hyperlinks | No | Yes |
166
+ | DA1/DA2/DA3 responses | DA1 only | Yes |
167
+ | DSR/DECRPM responses | No | Yes |
168
+ | Mouse tracking | No | Yes |
169
+ | Focus tracking | No | Yes |
170
+ | Synchronized output | No | Yes |
171
+ | DEC Special Graphics | Yes | Yes |
172
+ | REP (repeat character) | No | Yes |
173
+ | DECSTR (soft reset) | No | Yes |
174
+ | DCS sequences | No | Yes |
175
+ | Package size | Smaller | Larger |
176
+
177
+ **Use vt100.js** for strict VT100 conformance — monochrome, no colors, no insert/delete. Fast and minimal.
175
178
 
176
179
  **Use vterm.js** when you need everything — 100% coverage of the [terminfo.dev](https://terminfo.dev) feature matrix.
177
180
 
@@ -0,0 +1,106 @@
1
+ //#region src/screen.d.ts
2
+ /**
3
+ * vterm.js — Modern terminal emulator
4
+ *
5
+ * Full VT/ECMA-48/xterm standards coverage. Pure TypeScript, zero dependencies.
6
+ * Targets 100% of terminfo.dev's feature matrix:
7
+ *
8
+ * - All SGR attributes (bold, faint, italic, underline styles, overline, strikethrough, blink, hidden, inverse)
9
+ * - 16-color, 256-color, 24-bit truecolor (foreground, background, underline color)
10
+ * - Full cursor control (CUP, CUU/CUD/CUF/CUB, CPR, CHA, CNL, CPL, HVP, save/restore)
11
+ * - Cursor shape (DECSCUSR — block, underline, bar, blinking variants)
12
+ * - Erase operations (ED 0/1/2/3, EL 0/1/2, ECH)
13
+ * - Editing operations (ICH, DCH, IL, DL, REP)
14
+ * - Scroll regions (DECSTBM, SU, SD) with content preservation
15
+ * - DEC private modes (alt screen, auto-wrap, origin, insert, reverse video, bracketed paste)
16
+ * - Mouse tracking (X10, normal, button, any-event, SGR format)
17
+ * - Focus tracking (mode 1004)
18
+ * - Application cursor keys & keypad
19
+ * - Synchronized output (mode 2026)
20
+ * - Kitty keyboard protocol (CSI u / progressive enhancement)
21
+ * - Scrollback buffer with configurable limit
22
+ * - Wide character support (CJK, emoji ZWJ, regional indicators, VS-16)
23
+ * - OSC sequences (title, hyperlinks, clipboard, colors)
24
+ * - DCS sequences (XTVERSION, DECRQSS, XTGETTCAP, Sixel)
25
+ * - APC sequences (Kitty graphics protocol — parsed, query responses)
26
+ * - DA1/DA2/DA3 device attribute responses
27
+ * - DSR (device status report) responses
28
+ * - DECRPM (mode reporting)
29
+ * - Character sets (DEC Special Graphics, UTF-8)
30
+ * - Full C0/C1 control code handling
31
+ * - DECSTR soft terminal reset
32
+ *
33
+ * @see https://terminfo.dev for the feature matrix
34
+ * @see https://github.com/beorn/vterm for the monorepo
35
+ */
36
+ interface CellColor {
37
+ r: number;
38
+ g: number;
39
+ b: number;
40
+ }
41
+ type UnderlineStyle = "none" | "single" | "double" | "curly" | "dotted" | "dashed";
42
+ interface ScreenCell {
43
+ char: string;
44
+ fg: CellColor | null;
45
+ bg: CellColor | null;
46
+ bold: boolean;
47
+ faint: boolean;
48
+ italic: boolean;
49
+ underline: UnderlineStyle;
50
+ underlineColor: CellColor | null;
51
+ overline: boolean;
52
+ strikethrough: boolean;
53
+ inverse: boolean;
54
+ hidden: boolean;
55
+ blink: boolean;
56
+ wide: boolean;
57
+ url: string | null;
58
+ }
59
+ interface ScreenOptions {
60
+ cols?: number;
61
+ rows?: number;
62
+ scrollbackLimit?: number;
63
+ /** Callback for DA1/DA2/DSR responses — write these back to the PTY */
64
+ onResponse?: (data: string) => void;
65
+ }
66
+ interface SemanticZone {
67
+ type: "prompt" | "command" | "output";
68
+ startRow: number;
69
+ startCol: number;
70
+ }
71
+ interface SixelImage {
72
+ data: string;
73
+ row: number;
74
+ col: number;
75
+ }
76
+ interface Screen {
77
+ readonly cols: number;
78
+ readonly rows: number;
79
+ process(data: Uint8Array): void;
80
+ resize(cols: number, rows: number): void;
81
+ reset(): void;
82
+ getCell(row: number, col: number): ScreenCell;
83
+ getLine(row: number): ScreenCell[];
84
+ getText(): string;
85
+ getTextRange(startRow: number, startCol: number, endRow: number, endCol: number): string;
86
+ getCursorPosition(): {
87
+ x: number;
88
+ y: number;
89
+ };
90
+ getCursorVisible(): boolean;
91
+ getCursorShape(): "block" | "underline" | "bar";
92
+ getCursorBlinking(): boolean;
93
+ getTitle(): string;
94
+ getMode(mode: string): boolean;
95
+ getClipboard(): string;
96
+ getCwd(): string;
97
+ getNotifications(): string[];
98
+ getScrollbackLength(): number;
99
+ getViewportOffset(): number;
100
+ scrollViewport(delta: number): void;
101
+ getSemanticZones(): SemanticZone[];
102
+ getSixelImages(): SixelImage[];
103
+ }
104
+ declare function createScreen(options?: ScreenOptions): Screen;
105
+ //#endregion
106
+ export { type CellColor, type ScreenCell, type SemanticZone, type SixelImage, type UnderlineStyle, type Screen as VtermScreen, type ScreenOptions as VtermScreenOptions, createScreen as createVtermScreen };