@boba-cli/machine 0.1.0-alpha.1
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 +335 -0
- package/dist/browser/index.cjs +696 -0
- package/dist/browser/index.cjs.map +1 -0
- package/dist/browser/index.d.cts +232 -0
- package/dist/browser/index.d.ts +232 -0
- package/dist/browser/index.js +686 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/index.cjs +435 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +329 -0
- package/dist/index.d.ts +329 -0
- package/dist/index.js +364 -0
- package/dist/index.js.map +1 -0
- package/dist/node/index.cjs +827 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +235 -0
- package/dist/node/index.d.ts +235 -0
- package/dist/node/index.js +790 -0
- package/dist/node/index.js.map +1 -0
- package/dist/types-FB6TYMn5.d.cts +443 -0
- package/dist/types-FB6TYMn5.d.ts +443 -0
- package/package.json +95 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { S as StyleFn, C as ColorSupport } from './types-FB6TYMn5.cjs';
|
|
2
|
+
export { A as ArchiveAdapter, a as ClipboardAdapter, D as DirectoryEntry, b as Disposable, E as EnvironmentAdapter, F as FileStat, c as FileSystemAdapter, I as InputHandler, P as PathAdapter, d as PlatformAdapter, R as ResizeHandler, e as SignalAdapter, f as SignalHandler, g as StyleAdapter, T as TerminalAdapter, h as TerminalBackground, i as TerminalSize } from './types-FB6TYMn5.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Platform-agnostic byte utilities using Uint8Array.
|
|
6
|
+
* These replace Node.js Buffer operations for cross-platform compatibility.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Encode a string to UTF-8 bytes.
|
|
10
|
+
* Equivalent to `Buffer.from(text, 'utf8')`.
|
|
11
|
+
* @param text - String to encode
|
|
12
|
+
* @returns UTF-8 encoded bytes
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
declare function encodeString(text: string): Uint8Array;
|
|
16
|
+
/**
|
|
17
|
+
* Decode UTF-8 bytes to a string.
|
|
18
|
+
* Equivalent to `buffer.toString('utf8')`.
|
|
19
|
+
* @param bytes - Bytes to decode
|
|
20
|
+
* @returns Decoded string
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
declare function decodeString(bytes: Uint8Array): string;
|
|
24
|
+
/**
|
|
25
|
+
* Get the byte length of a string when encoded as UTF-8.
|
|
26
|
+
* Equivalent to `Buffer.byteLength(text, 'utf8')`.
|
|
27
|
+
* @param text - String to measure
|
|
28
|
+
* @returns Byte length
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
declare function byteLength(text: string): number;
|
|
32
|
+
/**
|
|
33
|
+
* Concatenate multiple Uint8Arrays into one.
|
|
34
|
+
* Equivalent to `Buffer.concat(arrays)`.
|
|
35
|
+
* @param arrays - Arrays to concatenate
|
|
36
|
+
* @returns Combined array
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
declare function concatBytes(...arrays: Uint8Array[]): Uint8Array;
|
|
40
|
+
/**
|
|
41
|
+
* Create a new Uint8Array of the specified size, filled with zeros.
|
|
42
|
+
* Equivalent to `Buffer.alloc(size)`.
|
|
43
|
+
* @param size - Size of the array
|
|
44
|
+
* @returns New zero-filled array
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
declare function allocBytes(size: number): Uint8Array;
|
|
48
|
+
/**
|
|
49
|
+
* Create a Uint8Array from an array of byte values.
|
|
50
|
+
* Equivalent to `Buffer.from([...])`.
|
|
51
|
+
* @param values - Byte values (0-255)
|
|
52
|
+
* @returns New Uint8Array
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
declare function fromBytes(values: number[]): Uint8Array;
|
|
56
|
+
/**
|
|
57
|
+
* Compare two Uint8Arrays for equality.
|
|
58
|
+
* Equivalent to `buffer1.equals(buffer2)`.
|
|
59
|
+
* @param a - First array
|
|
60
|
+
* @param b - Second array
|
|
61
|
+
* @returns True if arrays are equal
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
declare function bytesEqual(a: Uint8Array, b: Uint8Array): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Check if a byte array starts with a specific prefix.
|
|
67
|
+
* @param bytes - Array to check
|
|
68
|
+
* @param prefix - Prefix to look for
|
|
69
|
+
* @returns True if bytes starts with prefix
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
declare function startsWith(bytes: Uint8Array, prefix: Uint8Array): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Check if a byte array starts with a specific string (UTF-8 encoded).
|
|
75
|
+
* @param bytes - Array to check
|
|
76
|
+
* @param prefix - String prefix to look for
|
|
77
|
+
* @returns True if bytes starts with the encoded prefix
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
declare function startsWithString(bytes: Uint8Array, prefix: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Find the index of a substring within a byte array.
|
|
83
|
+
* Returns -1 if not found.
|
|
84
|
+
* @param bytes - Array to search
|
|
85
|
+
* @param needle - String to find
|
|
86
|
+
* @param fromIndex - Start index (default 0)
|
|
87
|
+
* @returns Index of first occurrence or -1
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
declare function indexOfString(bytes: Uint8Array, needle: string, fromIndex?: number): number;
|
|
91
|
+
/**
|
|
92
|
+
* Decode the first complete UTF-8 character from a byte array.
|
|
93
|
+
* Returns the character and its byte length, or null if incomplete.
|
|
94
|
+
* @param bytes - Byte array to decode
|
|
95
|
+
* @param offset - Start offset (default 0)
|
|
96
|
+
* @returns Tuple of [character, byteLength] or [null, 0] if incomplete
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
declare function decodeFirstRune(bytes: Uint8Array, offset?: number): [string | null, number];
|
|
100
|
+
/**
|
|
101
|
+
* Slice a portion of a byte array.
|
|
102
|
+
* Equivalent to `buffer.subarray(start, end)`.
|
|
103
|
+
* @param bytes - Source array
|
|
104
|
+
* @param start - Start index
|
|
105
|
+
* @param end - End index (optional, defaults to length)
|
|
106
|
+
* @returns New Uint8Array view of the slice
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
109
|
+
declare function sliceBytes(bytes: Uint8Array, start: number, end?: number): Uint8Array;
|
|
110
|
+
/**
|
|
111
|
+
* Create a copy of a byte array.
|
|
112
|
+
* @param bytes - Array to copy
|
|
113
|
+
* @returns New Uint8Array with copied data
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
declare function copyBytes(bytes: Uint8Array): Uint8Array;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* ANSI escape sequences for terminal control.
|
|
120
|
+
* These are platform-agnostic constants that work in any terminal emulator.
|
|
121
|
+
*/
|
|
122
|
+
/** Escape character. @public */
|
|
123
|
+
declare const ESC = "\u001B";
|
|
124
|
+
/** Control Sequence Introducer. @public */
|
|
125
|
+
declare const CSI = "\u001B[";
|
|
126
|
+
/** Operating System Command. @public */
|
|
127
|
+
declare const OSC = "\u001B]";
|
|
128
|
+
/** String Terminator. @public */
|
|
129
|
+
declare const ST = "\u001B\\";
|
|
130
|
+
/** Bell character (alternative string terminator). @public */
|
|
131
|
+
declare const BEL = "\u0007";
|
|
132
|
+
/** Show the cursor. @public */
|
|
133
|
+
declare const CURSOR_SHOW = "\u001B[?25h";
|
|
134
|
+
/** Hide the cursor. @public */
|
|
135
|
+
declare const CURSOR_HIDE = "\u001B[?25l";
|
|
136
|
+
/** Move cursor to home position (1,1). @public */
|
|
137
|
+
declare const CURSOR_HOME = "\u001B[H";
|
|
138
|
+
/**
|
|
139
|
+
* Move cursor to specific position.
|
|
140
|
+
* @param row - Row number (1-based)
|
|
141
|
+
* @param col - Column number (1-based)
|
|
142
|
+
* @returns ANSI escape sequence
|
|
143
|
+
* @public
|
|
144
|
+
*/
|
|
145
|
+
declare function cursorTo(row: number, col: number): string;
|
|
146
|
+
/**
|
|
147
|
+
* Move cursor up by n rows.
|
|
148
|
+
* @param n - Number of rows
|
|
149
|
+
* @returns ANSI escape sequence
|
|
150
|
+
* @public
|
|
151
|
+
*/
|
|
152
|
+
declare function cursorUp(n?: number): string;
|
|
153
|
+
/**
|
|
154
|
+
* Move cursor down by n rows.
|
|
155
|
+
* @param n - Number of rows
|
|
156
|
+
* @returns ANSI escape sequence
|
|
157
|
+
* @public
|
|
158
|
+
*/
|
|
159
|
+
declare function cursorDown(n?: number): string;
|
|
160
|
+
/**
|
|
161
|
+
* Move cursor forward (right) by n columns.
|
|
162
|
+
* @param n - Number of columns
|
|
163
|
+
* @returns ANSI escape sequence
|
|
164
|
+
* @public
|
|
165
|
+
*/
|
|
166
|
+
declare function cursorForward(n?: number): string;
|
|
167
|
+
/**
|
|
168
|
+
* Move cursor backward (left) by n columns.
|
|
169
|
+
* @param n - Number of columns
|
|
170
|
+
* @returns ANSI escape sequence
|
|
171
|
+
* @public
|
|
172
|
+
*/
|
|
173
|
+
declare function cursorBackward(n?: number): string;
|
|
174
|
+
/**
|
|
175
|
+
* Save cursor position.
|
|
176
|
+
* @public
|
|
177
|
+
*/
|
|
178
|
+
declare const CURSOR_SAVE = "\u001B[s";
|
|
179
|
+
/**
|
|
180
|
+
* Restore cursor position.
|
|
181
|
+
* @public
|
|
182
|
+
*/
|
|
183
|
+
declare const CURSOR_RESTORE = "\u001B[u";
|
|
184
|
+
/** Clear the entire screen. @public */
|
|
185
|
+
declare const CLEAR_SCREEN = "\u001B[2J";
|
|
186
|
+
/** Clear from cursor to end of screen. @public */
|
|
187
|
+
declare const CLEAR_SCREEN_DOWN = "\u001B[0J";
|
|
188
|
+
/** Clear from cursor to beginning of screen. @public */
|
|
189
|
+
declare const CLEAR_SCREEN_UP = "\u001B[1J";
|
|
190
|
+
/** Clear the entire line. @public */
|
|
191
|
+
declare const CLEAR_LINE = "\u001B[2K";
|
|
192
|
+
/** Clear from cursor to end of line. @public */
|
|
193
|
+
declare const CLEAR_LINE_END = "\u001B[0K";
|
|
194
|
+
/** Clear from cursor to beginning of line. @public */
|
|
195
|
+
declare const CLEAR_LINE_START = "\u001B[1K";
|
|
196
|
+
/** Enter alternate screen buffer. @public */
|
|
197
|
+
declare const ALT_SCREEN_ON = "\u001B[?1049h";
|
|
198
|
+
/** Exit alternate screen buffer. @public */
|
|
199
|
+
declare const ALT_SCREEN_OFF = "\u001B[?1049l";
|
|
200
|
+
/** Enable cell-motion mouse tracking (button events + motion while pressed). @public */
|
|
201
|
+
declare const MOUSE_CELL_ON = "\u001B[?1002h";
|
|
202
|
+
/** Enable all-motion mouse tracking (button events + all motion). @public */
|
|
203
|
+
declare const MOUSE_ALL_ON = "\u001B[?1003h";
|
|
204
|
+
/** Enable SGR extended mouse mode (supports coordinates \> 223). @public */
|
|
205
|
+
declare const MOUSE_SGR_ON = "\u001B[?1006h";
|
|
206
|
+
/** Disable cell-motion mouse tracking. @public */
|
|
207
|
+
declare const MOUSE_CELL_OFF = "\u001B[?1002l";
|
|
208
|
+
/** Disable all-motion mouse tracking. @public */
|
|
209
|
+
declare const MOUSE_ALL_OFF = "\u001B[?1003l";
|
|
210
|
+
/** Disable SGR extended mouse mode. @public */
|
|
211
|
+
declare const MOUSE_SGR_OFF = "\u001B[?1006l";
|
|
212
|
+
/** Enable bracketed paste mode. @public */
|
|
213
|
+
declare const BRACKETED_PASTE_ON = "\u001B[?2004h";
|
|
214
|
+
/** Disable bracketed paste mode. @public */
|
|
215
|
+
declare const BRACKETED_PASTE_OFF = "\u001B[?2004l";
|
|
216
|
+
/** Bracketed paste start sequence. @public */
|
|
217
|
+
declare const BRACKETED_PASTE_START = "\u001B[200~";
|
|
218
|
+
/** Bracketed paste end sequence. @public */
|
|
219
|
+
declare const BRACKETED_PASTE_END = "\u001B[201~";
|
|
220
|
+
/** Enable focus reporting. @public */
|
|
221
|
+
declare const REPORT_FOCUS_ON = "\u001B[?1004h";
|
|
222
|
+
/** Disable focus reporting. @public */
|
|
223
|
+
declare const REPORT_FOCUS_OFF = "\u001B[?1004l";
|
|
224
|
+
/** Focus gained sequence. @public */
|
|
225
|
+
declare const FOCUS_IN = "\u001B[I";
|
|
226
|
+
/** Focus lost sequence. @public */
|
|
227
|
+
declare const FOCUS_OUT = "\u001B[O";
|
|
228
|
+
/**
|
|
229
|
+
* Set the terminal window title.
|
|
230
|
+
* @param title - Window title
|
|
231
|
+
* @returns ANSI escape sequence
|
|
232
|
+
* @public
|
|
233
|
+
*/
|
|
234
|
+
declare function setWindowTitle(title: string): string;
|
|
235
|
+
/** Reset all text attributes. @public */
|
|
236
|
+
declare const RESET = "\u001B[0m";
|
|
237
|
+
/** Bold text. @public */
|
|
238
|
+
declare const BOLD = "\u001B[1m";
|
|
239
|
+
/** Dim/faint text. @public */
|
|
240
|
+
declare const DIM = "\u001B[2m";
|
|
241
|
+
/** Italic text. @public */
|
|
242
|
+
declare const ITALIC = "\u001B[3m";
|
|
243
|
+
/** Underlined text. @public */
|
|
244
|
+
declare const UNDERLINE = "\u001B[4m";
|
|
245
|
+
/** Blinking text. @public */
|
|
246
|
+
declare const BLINK = "\u001B[5m";
|
|
247
|
+
/** Reverse video (swap foreground/background). @public */
|
|
248
|
+
declare const REVERSE = "\u001B[7m";
|
|
249
|
+
/** Hidden text. @public */
|
|
250
|
+
declare const HIDDEN = "\u001B[8m";
|
|
251
|
+
/** Strikethrough text. @public */
|
|
252
|
+
declare const STRIKETHROUGH = "\u001B[9m";
|
|
253
|
+
/**
|
|
254
|
+
* Set foreground color using 256-color palette.
|
|
255
|
+
* @param colorIndex - Color index (0-255)
|
|
256
|
+
* @returns ANSI escape sequence
|
|
257
|
+
* @public
|
|
258
|
+
*/
|
|
259
|
+
declare function fg256(colorIndex: number): string;
|
|
260
|
+
/**
|
|
261
|
+
* Set background color using 256-color palette.
|
|
262
|
+
* @param colorIndex - Color index (0-255)
|
|
263
|
+
* @returns ANSI escape sequence
|
|
264
|
+
* @public
|
|
265
|
+
*/
|
|
266
|
+
declare function bg256(colorIndex: number): string;
|
|
267
|
+
/**
|
|
268
|
+
* Set foreground color using RGB true color.
|
|
269
|
+
* @param r - Red component (0-255)
|
|
270
|
+
* @param g - Green component (0-255)
|
|
271
|
+
* @param b - Blue component (0-255)
|
|
272
|
+
* @returns ANSI escape sequence
|
|
273
|
+
* @public
|
|
274
|
+
*/
|
|
275
|
+
declare function fgRGB(r: number, g: number, b: number): string;
|
|
276
|
+
/**
|
|
277
|
+
* Set background color using RGB true color.
|
|
278
|
+
* @param r - Red component (0-255)
|
|
279
|
+
* @param g - Green component (0-255)
|
|
280
|
+
* @param b - Blue component (0-255)
|
|
281
|
+
* @returns ANSI escape sequence
|
|
282
|
+
* @public
|
|
283
|
+
*/
|
|
284
|
+
declare function bgRGB(r: number, g: number, b: number): string;
|
|
285
|
+
/**
|
|
286
|
+
* Scroll up by n lines.
|
|
287
|
+
* @param n - Number of lines
|
|
288
|
+
* @returns ANSI escape sequence
|
|
289
|
+
* @public
|
|
290
|
+
*/
|
|
291
|
+
declare function scrollUp(n?: number): string;
|
|
292
|
+
/**
|
|
293
|
+
* Scroll down by n lines.
|
|
294
|
+
* @param n - Number of lines
|
|
295
|
+
* @returns ANSI escape sequence
|
|
296
|
+
* @public
|
|
297
|
+
*/
|
|
298
|
+
declare function scrollDown(n?: number): string;
|
|
299
|
+
/**
|
|
300
|
+
* Set scrolling region.
|
|
301
|
+
* @param top - Top row (1-based)
|
|
302
|
+
* @param bottom - Bottom row (1-based)
|
|
303
|
+
* @returns ANSI escape sequence
|
|
304
|
+
* @public
|
|
305
|
+
*/
|
|
306
|
+
declare function setScrollRegion(top: number, bottom: number): string;
|
|
307
|
+
/** Reset scrolling region to full screen. @public */
|
|
308
|
+
declare const RESET_SCROLL_REGION = "\u001B[r";
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Pure JavaScript ANSI styling utility for terminal text.
|
|
312
|
+
* Works identically in Node.js and browser/xterm.js contexts.
|
|
313
|
+
*/
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Create a chainable style function.
|
|
317
|
+
* @param colorSupport - Color support level information
|
|
318
|
+
* @returns Chainable style function
|
|
319
|
+
* @public
|
|
320
|
+
*/
|
|
321
|
+
declare function createStyle(colorSupport: ColorSupport): StyleFn;
|
|
322
|
+
/**
|
|
323
|
+
* Create a style function that always applies colors (for xterm.js).
|
|
324
|
+
* @returns Chainable style function with full color support
|
|
325
|
+
* @public
|
|
326
|
+
*/
|
|
327
|
+
declare function createAlwaysEnabledStyle(): StyleFn;
|
|
328
|
+
|
|
329
|
+
export { ALT_SCREEN_OFF, ALT_SCREEN_ON, BEL, BLINK, BOLD, BRACKETED_PASTE_END, BRACKETED_PASTE_OFF, BRACKETED_PASTE_ON, BRACKETED_PASTE_START, CLEAR_LINE, CLEAR_LINE_END, CLEAR_LINE_START, CLEAR_SCREEN, CLEAR_SCREEN_DOWN, CLEAR_SCREEN_UP, CSI, CURSOR_HIDE, CURSOR_HOME, CURSOR_RESTORE, CURSOR_SAVE, CURSOR_SHOW, ColorSupport, DIM, ESC, FOCUS_IN, FOCUS_OUT, HIDDEN, ITALIC, MOUSE_ALL_OFF, MOUSE_ALL_ON, MOUSE_CELL_OFF, MOUSE_CELL_ON, MOUSE_SGR_OFF, MOUSE_SGR_ON, OSC, REPORT_FOCUS_OFF, REPORT_FOCUS_ON, RESET, RESET_SCROLL_REGION, REVERSE, ST, STRIKETHROUGH, StyleFn, UNDERLINE, allocBytes, bg256, bgRGB, byteLength, bytesEqual, concatBytes, copyBytes, createAlwaysEnabledStyle, createStyle, cursorBackward, cursorDown, cursorForward, cursorTo, cursorUp, decodeFirstRune, decodeString, encodeString, fg256, fgRGB, fromBytes, indexOfString, scrollDown, scrollUp, setScrollRegion, setWindowTitle, sliceBytes, startsWith, startsWithString };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { S as StyleFn, C as ColorSupport } from './types-FB6TYMn5.js';
|
|
2
|
+
export { A as ArchiveAdapter, a as ClipboardAdapter, D as DirectoryEntry, b as Disposable, E as EnvironmentAdapter, F as FileStat, c as FileSystemAdapter, I as InputHandler, P as PathAdapter, d as PlatformAdapter, R as ResizeHandler, e as SignalAdapter, f as SignalHandler, g as StyleAdapter, T as TerminalAdapter, h as TerminalBackground, i as TerminalSize } from './types-FB6TYMn5.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Platform-agnostic byte utilities using Uint8Array.
|
|
6
|
+
* These replace Node.js Buffer operations for cross-platform compatibility.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Encode a string to UTF-8 bytes.
|
|
10
|
+
* Equivalent to `Buffer.from(text, 'utf8')`.
|
|
11
|
+
* @param text - String to encode
|
|
12
|
+
* @returns UTF-8 encoded bytes
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
declare function encodeString(text: string): Uint8Array;
|
|
16
|
+
/**
|
|
17
|
+
* Decode UTF-8 bytes to a string.
|
|
18
|
+
* Equivalent to `buffer.toString('utf8')`.
|
|
19
|
+
* @param bytes - Bytes to decode
|
|
20
|
+
* @returns Decoded string
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
declare function decodeString(bytes: Uint8Array): string;
|
|
24
|
+
/**
|
|
25
|
+
* Get the byte length of a string when encoded as UTF-8.
|
|
26
|
+
* Equivalent to `Buffer.byteLength(text, 'utf8')`.
|
|
27
|
+
* @param text - String to measure
|
|
28
|
+
* @returns Byte length
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
declare function byteLength(text: string): number;
|
|
32
|
+
/**
|
|
33
|
+
* Concatenate multiple Uint8Arrays into one.
|
|
34
|
+
* Equivalent to `Buffer.concat(arrays)`.
|
|
35
|
+
* @param arrays - Arrays to concatenate
|
|
36
|
+
* @returns Combined array
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
declare function concatBytes(...arrays: Uint8Array[]): Uint8Array;
|
|
40
|
+
/**
|
|
41
|
+
* Create a new Uint8Array of the specified size, filled with zeros.
|
|
42
|
+
* Equivalent to `Buffer.alloc(size)`.
|
|
43
|
+
* @param size - Size of the array
|
|
44
|
+
* @returns New zero-filled array
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
declare function allocBytes(size: number): Uint8Array;
|
|
48
|
+
/**
|
|
49
|
+
* Create a Uint8Array from an array of byte values.
|
|
50
|
+
* Equivalent to `Buffer.from([...])`.
|
|
51
|
+
* @param values - Byte values (0-255)
|
|
52
|
+
* @returns New Uint8Array
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
declare function fromBytes(values: number[]): Uint8Array;
|
|
56
|
+
/**
|
|
57
|
+
* Compare two Uint8Arrays for equality.
|
|
58
|
+
* Equivalent to `buffer1.equals(buffer2)`.
|
|
59
|
+
* @param a - First array
|
|
60
|
+
* @param b - Second array
|
|
61
|
+
* @returns True if arrays are equal
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
declare function bytesEqual(a: Uint8Array, b: Uint8Array): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Check if a byte array starts with a specific prefix.
|
|
67
|
+
* @param bytes - Array to check
|
|
68
|
+
* @param prefix - Prefix to look for
|
|
69
|
+
* @returns True if bytes starts with prefix
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
declare function startsWith(bytes: Uint8Array, prefix: Uint8Array): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Check if a byte array starts with a specific string (UTF-8 encoded).
|
|
75
|
+
* @param bytes - Array to check
|
|
76
|
+
* @param prefix - String prefix to look for
|
|
77
|
+
* @returns True if bytes starts with the encoded prefix
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
declare function startsWithString(bytes: Uint8Array, prefix: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Find the index of a substring within a byte array.
|
|
83
|
+
* Returns -1 if not found.
|
|
84
|
+
* @param bytes - Array to search
|
|
85
|
+
* @param needle - String to find
|
|
86
|
+
* @param fromIndex - Start index (default 0)
|
|
87
|
+
* @returns Index of first occurrence or -1
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
declare function indexOfString(bytes: Uint8Array, needle: string, fromIndex?: number): number;
|
|
91
|
+
/**
|
|
92
|
+
* Decode the first complete UTF-8 character from a byte array.
|
|
93
|
+
* Returns the character and its byte length, or null if incomplete.
|
|
94
|
+
* @param bytes - Byte array to decode
|
|
95
|
+
* @param offset - Start offset (default 0)
|
|
96
|
+
* @returns Tuple of [character, byteLength] or [null, 0] if incomplete
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
declare function decodeFirstRune(bytes: Uint8Array, offset?: number): [string | null, number];
|
|
100
|
+
/**
|
|
101
|
+
* Slice a portion of a byte array.
|
|
102
|
+
* Equivalent to `buffer.subarray(start, end)`.
|
|
103
|
+
* @param bytes - Source array
|
|
104
|
+
* @param start - Start index
|
|
105
|
+
* @param end - End index (optional, defaults to length)
|
|
106
|
+
* @returns New Uint8Array view of the slice
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
109
|
+
declare function sliceBytes(bytes: Uint8Array, start: number, end?: number): Uint8Array;
|
|
110
|
+
/**
|
|
111
|
+
* Create a copy of a byte array.
|
|
112
|
+
* @param bytes - Array to copy
|
|
113
|
+
* @returns New Uint8Array with copied data
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
declare function copyBytes(bytes: Uint8Array): Uint8Array;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* ANSI escape sequences for terminal control.
|
|
120
|
+
* These are platform-agnostic constants that work in any terminal emulator.
|
|
121
|
+
*/
|
|
122
|
+
/** Escape character. @public */
|
|
123
|
+
declare const ESC = "\u001B";
|
|
124
|
+
/** Control Sequence Introducer. @public */
|
|
125
|
+
declare const CSI = "\u001B[";
|
|
126
|
+
/** Operating System Command. @public */
|
|
127
|
+
declare const OSC = "\u001B]";
|
|
128
|
+
/** String Terminator. @public */
|
|
129
|
+
declare const ST = "\u001B\\";
|
|
130
|
+
/** Bell character (alternative string terminator). @public */
|
|
131
|
+
declare const BEL = "\u0007";
|
|
132
|
+
/** Show the cursor. @public */
|
|
133
|
+
declare const CURSOR_SHOW = "\u001B[?25h";
|
|
134
|
+
/** Hide the cursor. @public */
|
|
135
|
+
declare const CURSOR_HIDE = "\u001B[?25l";
|
|
136
|
+
/** Move cursor to home position (1,1). @public */
|
|
137
|
+
declare const CURSOR_HOME = "\u001B[H";
|
|
138
|
+
/**
|
|
139
|
+
* Move cursor to specific position.
|
|
140
|
+
* @param row - Row number (1-based)
|
|
141
|
+
* @param col - Column number (1-based)
|
|
142
|
+
* @returns ANSI escape sequence
|
|
143
|
+
* @public
|
|
144
|
+
*/
|
|
145
|
+
declare function cursorTo(row: number, col: number): string;
|
|
146
|
+
/**
|
|
147
|
+
* Move cursor up by n rows.
|
|
148
|
+
* @param n - Number of rows
|
|
149
|
+
* @returns ANSI escape sequence
|
|
150
|
+
* @public
|
|
151
|
+
*/
|
|
152
|
+
declare function cursorUp(n?: number): string;
|
|
153
|
+
/**
|
|
154
|
+
* Move cursor down by n rows.
|
|
155
|
+
* @param n - Number of rows
|
|
156
|
+
* @returns ANSI escape sequence
|
|
157
|
+
* @public
|
|
158
|
+
*/
|
|
159
|
+
declare function cursorDown(n?: number): string;
|
|
160
|
+
/**
|
|
161
|
+
* Move cursor forward (right) by n columns.
|
|
162
|
+
* @param n - Number of columns
|
|
163
|
+
* @returns ANSI escape sequence
|
|
164
|
+
* @public
|
|
165
|
+
*/
|
|
166
|
+
declare function cursorForward(n?: number): string;
|
|
167
|
+
/**
|
|
168
|
+
* Move cursor backward (left) by n columns.
|
|
169
|
+
* @param n - Number of columns
|
|
170
|
+
* @returns ANSI escape sequence
|
|
171
|
+
* @public
|
|
172
|
+
*/
|
|
173
|
+
declare function cursorBackward(n?: number): string;
|
|
174
|
+
/**
|
|
175
|
+
* Save cursor position.
|
|
176
|
+
* @public
|
|
177
|
+
*/
|
|
178
|
+
declare const CURSOR_SAVE = "\u001B[s";
|
|
179
|
+
/**
|
|
180
|
+
* Restore cursor position.
|
|
181
|
+
* @public
|
|
182
|
+
*/
|
|
183
|
+
declare const CURSOR_RESTORE = "\u001B[u";
|
|
184
|
+
/** Clear the entire screen. @public */
|
|
185
|
+
declare const CLEAR_SCREEN = "\u001B[2J";
|
|
186
|
+
/** Clear from cursor to end of screen. @public */
|
|
187
|
+
declare const CLEAR_SCREEN_DOWN = "\u001B[0J";
|
|
188
|
+
/** Clear from cursor to beginning of screen. @public */
|
|
189
|
+
declare const CLEAR_SCREEN_UP = "\u001B[1J";
|
|
190
|
+
/** Clear the entire line. @public */
|
|
191
|
+
declare const CLEAR_LINE = "\u001B[2K";
|
|
192
|
+
/** Clear from cursor to end of line. @public */
|
|
193
|
+
declare const CLEAR_LINE_END = "\u001B[0K";
|
|
194
|
+
/** Clear from cursor to beginning of line. @public */
|
|
195
|
+
declare const CLEAR_LINE_START = "\u001B[1K";
|
|
196
|
+
/** Enter alternate screen buffer. @public */
|
|
197
|
+
declare const ALT_SCREEN_ON = "\u001B[?1049h";
|
|
198
|
+
/** Exit alternate screen buffer. @public */
|
|
199
|
+
declare const ALT_SCREEN_OFF = "\u001B[?1049l";
|
|
200
|
+
/** Enable cell-motion mouse tracking (button events + motion while pressed). @public */
|
|
201
|
+
declare const MOUSE_CELL_ON = "\u001B[?1002h";
|
|
202
|
+
/** Enable all-motion mouse tracking (button events + all motion). @public */
|
|
203
|
+
declare const MOUSE_ALL_ON = "\u001B[?1003h";
|
|
204
|
+
/** Enable SGR extended mouse mode (supports coordinates \> 223). @public */
|
|
205
|
+
declare const MOUSE_SGR_ON = "\u001B[?1006h";
|
|
206
|
+
/** Disable cell-motion mouse tracking. @public */
|
|
207
|
+
declare const MOUSE_CELL_OFF = "\u001B[?1002l";
|
|
208
|
+
/** Disable all-motion mouse tracking. @public */
|
|
209
|
+
declare const MOUSE_ALL_OFF = "\u001B[?1003l";
|
|
210
|
+
/** Disable SGR extended mouse mode. @public */
|
|
211
|
+
declare const MOUSE_SGR_OFF = "\u001B[?1006l";
|
|
212
|
+
/** Enable bracketed paste mode. @public */
|
|
213
|
+
declare const BRACKETED_PASTE_ON = "\u001B[?2004h";
|
|
214
|
+
/** Disable bracketed paste mode. @public */
|
|
215
|
+
declare const BRACKETED_PASTE_OFF = "\u001B[?2004l";
|
|
216
|
+
/** Bracketed paste start sequence. @public */
|
|
217
|
+
declare const BRACKETED_PASTE_START = "\u001B[200~";
|
|
218
|
+
/** Bracketed paste end sequence. @public */
|
|
219
|
+
declare const BRACKETED_PASTE_END = "\u001B[201~";
|
|
220
|
+
/** Enable focus reporting. @public */
|
|
221
|
+
declare const REPORT_FOCUS_ON = "\u001B[?1004h";
|
|
222
|
+
/** Disable focus reporting. @public */
|
|
223
|
+
declare const REPORT_FOCUS_OFF = "\u001B[?1004l";
|
|
224
|
+
/** Focus gained sequence. @public */
|
|
225
|
+
declare const FOCUS_IN = "\u001B[I";
|
|
226
|
+
/** Focus lost sequence. @public */
|
|
227
|
+
declare const FOCUS_OUT = "\u001B[O";
|
|
228
|
+
/**
|
|
229
|
+
* Set the terminal window title.
|
|
230
|
+
* @param title - Window title
|
|
231
|
+
* @returns ANSI escape sequence
|
|
232
|
+
* @public
|
|
233
|
+
*/
|
|
234
|
+
declare function setWindowTitle(title: string): string;
|
|
235
|
+
/** Reset all text attributes. @public */
|
|
236
|
+
declare const RESET = "\u001B[0m";
|
|
237
|
+
/** Bold text. @public */
|
|
238
|
+
declare const BOLD = "\u001B[1m";
|
|
239
|
+
/** Dim/faint text. @public */
|
|
240
|
+
declare const DIM = "\u001B[2m";
|
|
241
|
+
/** Italic text. @public */
|
|
242
|
+
declare const ITALIC = "\u001B[3m";
|
|
243
|
+
/** Underlined text. @public */
|
|
244
|
+
declare const UNDERLINE = "\u001B[4m";
|
|
245
|
+
/** Blinking text. @public */
|
|
246
|
+
declare const BLINK = "\u001B[5m";
|
|
247
|
+
/** Reverse video (swap foreground/background). @public */
|
|
248
|
+
declare const REVERSE = "\u001B[7m";
|
|
249
|
+
/** Hidden text. @public */
|
|
250
|
+
declare const HIDDEN = "\u001B[8m";
|
|
251
|
+
/** Strikethrough text. @public */
|
|
252
|
+
declare const STRIKETHROUGH = "\u001B[9m";
|
|
253
|
+
/**
|
|
254
|
+
* Set foreground color using 256-color palette.
|
|
255
|
+
* @param colorIndex - Color index (0-255)
|
|
256
|
+
* @returns ANSI escape sequence
|
|
257
|
+
* @public
|
|
258
|
+
*/
|
|
259
|
+
declare function fg256(colorIndex: number): string;
|
|
260
|
+
/**
|
|
261
|
+
* Set background color using 256-color palette.
|
|
262
|
+
* @param colorIndex - Color index (0-255)
|
|
263
|
+
* @returns ANSI escape sequence
|
|
264
|
+
* @public
|
|
265
|
+
*/
|
|
266
|
+
declare function bg256(colorIndex: number): string;
|
|
267
|
+
/**
|
|
268
|
+
* Set foreground color using RGB true color.
|
|
269
|
+
* @param r - Red component (0-255)
|
|
270
|
+
* @param g - Green component (0-255)
|
|
271
|
+
* @param b - Blue component (0-255)
|
|
272
|
+
* @returns ANSI escape sequence
|
|
273
|
+
* @public
|
|
274
|
+
*/
|
|
275
|
+
declare function fgRGB(r: number, g: number, b: number): string;
|
|
276
|
+
/**
|
|
277
|
+
* Set background color using RGB true color.
|
|
278
|
+
* @param r - Red component (0-255)
|
|
279
|
+
* @param g - Green component (0-255)
|
|
280
|
+
* @param b - Blue component (0-255)
|
|
281
|
+
* @returns ANSI escape sequence
|
|
282
|
+
* @public
|
|
283
|
+
*/
|
|
284
|
+
declare function bgRGB(r: number, g: number, b: number): string;
|
|
285
|
+
/**
|
|
286
|
+
* Scroll up by n lines.
|
|
287
|
+
* @param n - Number of lines
|
|
288
|
+
* @returns ANSI escape sequence
|
|
289
|
+
* @public
|
|
290
|
+
*/
|
|
291
|
+
declare function scrollUp(n?: number): string;
|
|
292
|
+
/**
|
|
293
|
+
* Scroll down by n lines.
|
|
294
|
+
* @param n - Number of lines
|
|
295
|
+
* @returns ANSI escape sequence
|
|
296
|
+
* @public
|
|
297
|
+
*/
|
|
298
|
+
declare function scrollDown(n?: number): string;
|
|
299
|
+
/**
|
|
300
|
+
* Set scrolling region.
|
|
301
|
+
* @param top - Top row (1-based)
|
|
302
|
+
* @param bottom - Bottom row (1-based)
|
|
303
|
+
* @returns ANSI escape sequence
|
|
304
|
+
* @public
|
|
305
|
+
*/
|
|
306
|
+
declare function setScrollRegion(top: number, bottom: number): string;
|
|
307
|
+
/** Reset scrolling region to full screen. @public */
|
|
308
|
+
declare const RESET_SCROLL_REGION = "\u001B[r";
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Pure JavaScript ANSI styling utility for terminal text.
|
|
312
|
+
* Works identically in Node.js and browser/xterm.js contexts.
|
|
313
|
+
*/
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Create a chainable style function.
|
|
317
|
+
* @param colorSupport - Color support level information
|
|
318
|
+
* @returns Chainable style function
|
|
319
|
+
* @public
|
|
320
|
+
*/
|
|
321
|
+
declare function createStyle(colorSupport: ColorSupport): StyleFn;
|
|
322
|
+
/**
|
|
323
|
+
* Create a style function that always applies colors (for xterm.js).
|
|
324
|
+
* @returns Chainable style function with full color support
|
|
325
|
+
* @public
|
|
326
|
+
*/
|
|
327
|
+
declare function createAlwaysEnabledStyle(): StyleFn;
|
|
328
|
+
|
|
329
|
+
export { ALT_SCREEN_OFF, ALT_SCREEN_ON, BEL, BLINK, BOLD, BRACKETED_PASTE_END, BRACKETED_PASTE_OFF, BRACKETED_PASTE_ON, BRACKETED_PASTE_START, CLEAR_LINE, CLEAR_LINE_END, CLEAR_LINE_START, CLEAR_SCREEN, CLEAR_SCREEN_DOWN, CLEAR_SCREEN_UP, CSI, CURSOR_HIDE, CURSOR_HOME, CURSOR_RESTORE, CURSOR_SAVE, CURSOR_SHOW, ColorSupport, DIM, ESC, FOCUS_IN, FOCUS_OUT, HIDDEN, ITALIC, MOUSE_ALL_OFF, MOUSE_ALL_ON, MOUSE_CELL_OFF, MOUSE_CELL_ON, MOUSE_SGR_OFF, MOUSE_SGR_ON, OSC, REPORT_FOCUS_OFF, REPORT_FOCUS_ON, RESET, RESET_SCROLL_REGION, REVERSE, ST, STRIKETHROUGH, StyleFn, UNDERLINE, allocBytes, bg256, bgRGB, byteLength, bytesEqual, concatBytes, copyBytes, createAlwaysEnabledStyle, createStyle, cursorBackward, cursorDown, cursorForward, cursorTo, cursorUp, decodeFirstRune, decodeString, encodeString, fg256, fgRGB, fromBytes, indexOfString, scrollDown, scrollUp, setScrollRegion, setWindowTitle, sliceBytes, startsWith, startsWithString };
|