vterm.js 0.3.1 → 0.5.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.
@@ -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 };