@xterm/headless 6.1.0-beta.3 → 6.1.0-beta.300

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xterm/headless",
3
3
  "description": "A headless terminal component that runs in Node.js",
4
- "version": "6.1.0-beta.3",
4
+ "version": "6.1.0-beta.300",
5
5
  "main": "lib-headless/xterm-headless.js",
6
6
  "module": "lib/xterm.mjs",
7
7
  "types": "typings/xterm-headless.d.ts",
@@ -10,6 +10,9 @@
10
10
  "workspaces": [
11
11
  "addons/*"
12
12
  ],
13
+ "overrides": {
14
+ "serialize-javascript": "^7.0.3"
15
+ },
13
16
  "keywords": [
14
17
  "cli",
15
18
  "command-line",
@@ -25,5 +28,5 @@
25
28
  "webgl",
26
29
  "xterm"
27
30
  ],
28
- "commit": "8308ede3f5a74b24e1a7aaed89be68404951e5bc"
31
+ "commit": "6ccafd97791ed8c6bf05662708a0745b1d085023"
29
32
  }
@@ -49,10 +49,19 @@ declare module '@xterm/headless' {
49
49
  convertEol?: boolean;
50
50
 
51
51
  /**
52
- * Whether the cursor blinks.
52
+ * Whether the cursor blinks. The blinking will stop after 5 minutes of idle
53
+ * time (refreshed by clicking, focusing or the cursor moving). The default
54
+ * is false.
53
55
  */
54
56
  cursorBlink?: boolean;
55
57
 
58
+ /**
59
+ * The interval in milliseconds for the blink attribute. This is the amount
60
+ * of time text remains visible or hidden before toggling. Set to 0 to
61
+ * disable blinking. The default is 0.
62
+ */
63
+ blinkIntervalDuration?: number;
64
+
56
65
  /**
57
66
  * The style of the cursor.
58
67
  */
@@ -63,14 +72,6 @@ declare module '@xterm/headless' {
63
72
  */
64
73
  cursorWidth?: number;
65
74
 
66
- /**
67
- * Whether to draw custom glyphs for block element and box drawing
68
- * characters instead of using the font. This should typically result in
69
- * better rendering with continuous lines, even when line height and letter
70
- * spacing is used. Note that this doesn't work with the DOM renderer which
71
- * renders all characters using the font. The default is true.
72
- */
73
- customGlyphs?: boolean;
74
75
  /**
75
76
  * Whether input should be disabled.
76
77
  */
@@ -81,13 +82,6 @@ declare module '@xterm/headless' {
81
82
  */
82
83
  drawBoldTextInBrightColors?: boolean;
83
84
 
84
- /**
85
- * The modifier key hold to multiply scroll speed.
86
- * @deprecated This option is no longer available and will always use alt.
87
- * Setting this will be ignored.
88
- */
89
- fastScrollModifier?: 'none' | 'alt' | 'ctrl' | 'shift';
90
-
91
85
  /**
92
86
  * The spacing in whole pixels between characters.
93
87
  */
@@ -142,10 +136,22 @@ declare module '@xterm/headless' {
142
136
  */
143
137
  minimumContrastRatio?: number;
144
138
 
139
+ /**
140
+ * When enabled and the terminal is in mouse events mode, mouse click, drag,
141
+ * and move events are only sent to the underlying application when the alt
142
+ * key is held. The alt key is not included in the mouse reports sent to the
143
+ * application. Wheel events are not affected. This allows normal text
144
+ * selection by default while still supporting application mouse interaction
145
+ * and scrolling when holding alt. When enabled, this takes precedence over
146
+ * `macOptionClickForcesSelection`.
147
+ */
148
+ mouseEventsRequireAlt?: boolean;
149
+
145
150
  /**
146
151
  * Whether to reflow the line containing the cursor when the terminal is
147
152
  * resized. Defaults to false, because shells usually handle this
148
- * themselves.
153
+ * themselves. Note that this will not move the cursor position, only the
154
+ * line contents.
149
155
  */
150
156
  reflowCursorLine?: boolean;
151
157
 
@@ -214,25 +220,6 @@ declare module '@xterm/headless' {
214
220
  */
215
221
  theme?: ITheme;
216
222
 
217
- /**
218
- * Whether "Windows mode" is enabled. Because Windows backends winpty and
219
- * conpty operate by doing line wrapping on their side, xterm.js does not
220
- * have access to wrapped lines. When Windows mode is enabled the following
221
- * changes will be in effect:
222
- *
223
- * - Reflow is disabled.
224
- * - Lines are assumed to be wrapped if the last character of the line is
225
- * not whitespace.
226
- *
227
- * When using conpty on Windows 11 version >= 21376, it is recommended to
228
- * disable this because native text wrapping sequences are output correctly
229
- * thanks to https://github.com/microsoft/terminal/issues/405
230
- *
231
- * @deprecated Use {@link windowsPty}. This value will be ignored if
232
- * windowsPty is set.
233
- */
234
- windowsMode?: boolean;
235
-
236
223
  /**
237
224
  * Compatibility information when the pty is known to be hosted on Windows.
238
225
  * Setting this will turn on certain heuristics/workarounds depending on the
@@ -262,6 +249,11 @@ declare module '@xterm/headless' {
262
249
  * All features are disabled by default for security reasons.
263
250
  */
264
251
  windowOptions?: IWindowOptions;
252
+
253
+ /**
254
+ * Enable various VT extensions.
255
+ */
256
+ vtExtensions?: IVtExtensions;
265
257
  }
266
258
 
267
259
  /**
@@ -278,6 +270,13 @@ declare module '@xterm/headless' {
278
270
  * The number of rows in the terminal.
279
271
  */
280
272
  rows?: number;
273
+
274
+ /**
275
+ * Whether to show the cursor immediately when the terminal is created.
276
+ * When false (default), the cursor will not be visible until the terminal
277
+ * is focused for the first time.
278
+ */
279
+ showCursorImmediately?: boolean;
281
280
  }
282
281
 
283
282
  /**
@@ -344,6 +343,51 @@ declare module '@xterm/headless' {
344
343
  buildNumber?: number;
345
344
  }
346
345
 
346
+ /**
347
+ * Enable VT extensions that are not part of the core VT specification.
348
+ */
349
+ export interface IVtExtensions {
350
+ /**
351
+ * Whether the [kitty keyboard protocol][0] (`CSI =|?|>|< u`) is enabled.
352
+ * When enabled, the terminal will respond to keyboard protocol queries and
353
+ * allow programs to enable enhanced keyboard reporting. The default is
354
+ * false.
355
+ *
356
+ * [0]: https://sw.kovidgoyal.net/kitty/keyboard-protocol/
357
+ */
358
+ kittyKeyboard?: boolean;
359
+
360
+ /**
361
+ * Whether [SGR 221 (not bold) and SGR 222 (not faint) are enabled][0].
362
+ * These are kitty extensions that allow resetting bold and faint
363
+ * independently. The default is true.
364
+ *
365
+ * [0]: https://sw.kovidgoyal.net/kitty/misc-protocol/
366
+ */
367
+ kittySgrBoldFaintControl?: boolean;
368
+
369
+ /**
370
+ * Whether [win32-input-mode][0] (`DECSET 9001`) is enabled. When enabled,
371
+ * the terminal will allow programs to enable win32 INPUT_RECORD keyboard
372
+ * reporting via `CSI ? 9001 h`. The default is false.
373
+ *
374
+ * [0]: https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md
375
+ */
376
+ win32InputMode?: boolean;
377
+
378
+ /**
379
+ * Whether [color scheme query and notification][0] (`CSI ? 996 n` and
380
+ * `DECSET 2031`) is enabled. When enabled, the terminal will respond to
381
+ * color scheme queries with `CSI ? 997 ; 1 n` (dark) or `CSI ? 997 ; 2 n`
382
+ * (light) based on the relative luminance of the background and foreground
383
+ * theme colors. Programs can enable unsolicited notifications via
384
+ * `CSI ? 2031 h`. The default is true.
385
+ *
386
+ * [0]: https://contour-terminal.org/vt-extensions/color-palette-update-notifications/
387
+ */
388
+ colorSchemeQuery?: boolean;
389
+ }
390
+
347
391
  /**
348
392
  * A replacement logger for `console`.
349
393
  */
@@ -615,21 +659,18 @@ declare module '@xterm/headless' {
615
659
  readonly cols: number;
616
660
 
617
661
  /**
618
- * (EXPERIMENTAL) The terminal's current buffer, this might be either the
619
- * normal buffer or the alt buffer depending on what's running in the
620
- * terminal.
662
+ * Access to the terminal's normal and alt buffer.
621
663
  */
622
664
  readonly buffer: IBufferNamespace;
623
665
 
624
666
  /**
625
- * (EXPERIMENTAL) Get all markers registered against the buffer. If the alt
626
- * buffer is active this will always return [].
667
+ * Get all markers registered against the buffer. If the alt buffer is
668
+ * active this will always return [].
627
669
  */
628
670
  readonly markers: ReadonlyArray<IMarker>;
629
671
 
630
672
  /**
631
- * (EXPERIMENTAL) Get the parser interface to register
632
- * custom escape sequence handlers.
673
+ * Get the parser interface to register custom escape sequence handlers.
633
674
  */
634
675
  readonly parser: IParser;
635
676
 
@@ -730,6 +771,17 @@ declare module '@xterm/headless' {
730
771
  */
731
772
  onLineFeed: IEvent<void>;
732
773
 
774
+ /**
775
+ * Adds an event listener for when rows are _requested_ to be rendered. The
776
+ * event value contains the start row and end rows of the rendered area
777
+ * (ranges from `0` to `Terminal.rows - 1`). This differs from the regular
778
+ * xterm.js in that it doesn't actually do any rendering but requests
779
+ * rendering from the outside. This is useful for implementing a custom
780
+ * renderer on top of xterm-headless.
781
+ * @returns an `IDisposable` to stop listening.
782
+ */
783
+ onRender: IEvent<{ start: number, end: number }>;
784
+
733
785
  /**
734
786
  * Adds an event listener for when data has been parsed by the terminal,
735
787
  * after {@link write} is called. This event is useful to listen for any
@@ -784,12 +836,11 @@ declare module '@xterm/headless' {
784
836
  resize(columns: number, rows: number): void;
785
837
 
786
838
  /**
787
- * Adds a marker to the normal buffer and returns it. If the alt buffer is
788
- * active, undefined is returned.
839
+ * Adds a marker to the normal buffer and returns it.
789
840
  * @param cursorYOffset The y position offset of the marker from the cursor.
790
841
  * @returns The new marker or undefined.
791
842
  */
792
- registerMarker(cursorYOffset?: number): IMarker | undefined;
843
+ registerMarker(cursorYOffset?: number): IMarker;
793
844
 
794
845
  /*
795
846
  * Disposes of the terminal, detaching it from the DOM and removing any
@@ -1177,6 +1228,26 @@ declare module '@xterm/headless' {
1177
1228
 
1178
1229
  /** Whether the cell has the default attribute (no color or style). */
1179
1230
  isAttributeDefault(): boolean;
1231
+
1232
+ /** Gets the underline style. */
1233
+ getUnderlineStyle(): number;
1234
+ /** Gets the underline color number. */
1235
+ getUnderlineColor(): number;
1236
+ /** Gets the underline color mode. */
1237
+ getUnderlineColorMode(): number;
1238
+ /** Whether the cell is using the RGB underline color mode. */
1239
+ isUnderlineColorRGB(): boolean;
1240
+ /** Whether the cell is using the palette underline color mode. */
1241
+ isUnderlineColorPalette(): boolean;
1242
+ /** Whether the cell is using the default underline color mode. */
1243
+ isUnderlineColorDefault(): boolean;
1244
+
1245
+ /**
1246
+ * Compares the cell's attributes (colors and styles) with another cell.
1247
+ * This does not compare the cell's content and excludes URL ids and
1248
+ * underline variant offsets.
1249
+ */
1250
+ attributesEquals(other: IBufferCell): boolean;
1180
1251
  }
1181
1252
 
1182
1253
  /**
@@ -1213,12 +1284,12 @@ declare module '@xterm/headless' {
1213
1284
  prefix?: string;
1214
1285
  /**
1215
1286
  * Optional intermediate bytes, must be in range \x20 .. \x2f.
1216
- * Usable in CSI, DCS and ESC.
1287
+ * Usable in CSI, DCS, ESC and APC.
1217
1288
  */
1218
1289
  intermediates?: string;
1219
1290
  /**
1220
1291
  * Final byte, must be in range \x40 .. \x7e for CSI and DCS,
1221
- * \x30 .. \x7e for ESC.
1292
+ * \x30 .. \x7e for ESC and APC.
1222
1293
  */
1223
1294
  final: string;
1224
1295
  }
@@ -1265,7 +1336,7 @@ declare module '@xterm/headless' {
1265
1336
  * @param id Specifies the function identifier under which the callback
1266
1337
  * gets registered, e.g. {intermediates: '%' final: 'G'} for
1267
1338
  * default charset selection.
1268
- * @param callback The function to handle the sequence.
1339
+ * @param handler The function to handle the sequence.
1269
1340
  * Return true if the sequence was handled; false if we should try
1270
1341
  * a previous handler (set by addEscHandler or setEscHandler).
1271
1342
  * The most recently added handler is tried first.
@@ -1290,6 +1361,24 @@ declare module '@xterm/headless' {
1290
1361
  * @returns An IDisposable you can call to remove this handler.
1291
1362
  */
1292
1363
  registerOscHandler(ident: number, callback: (data: string) => boolean): IDisposable;
1364
+
1365
+ /**
1366
+ * Adds a handler for APC escape sequences.
1367
+ * @param id Specifies the function identifier under which the callback
1368
+ * gets registered, e.g. {final: 'G'} for Kitty graphics protocol.
1369
+ * @param callback The function to handle the sequence. Note that the
1370
+ * function will only be called once if the sequence finished successfully.
1371
+ * There is currently no way to intercept smaller data chunks, data chunks
1372
+ * will be stored up until the sequence is finished. Since APC sequences are
1373
+ * not limited by the amount of data this might impose a problem for big
1374
+ * payloads. Currently xterm.js limits APC payload to 10 MB which should
1375
+ * give enough room for most use cases. The callback is called with APC data
1376
+ * string (excluding the identifier character). Return true if the sequence
1377
+ * was handled; false if we should try a previous handler. The most recently
1378
+ * added handler is tried first.
1379
+ * @returns An IDisposable you can call to remove this handler.
1380
+ */
1381
+ registerApcHandler(id: IFunctionIdentifier, callback: (data: string) => boolean): IDisposable;
1293
1382
  }
1294
1383
 
1295
1384
  /**
@@ -1370,6 +1459,10 @@ declare module '@xterm/headless' {
1370
1459
  * Send FocusIn/FocusOut events: `CSI ? 1 0 0 4 h`
1371
1460
  */
1372
1461
  readonly sendFocusMode: boolean;
1462
+ /**
1463
+ * Show Cursor (DECTCEM): `CSI ? 2 5 h`
1464
+ */
1465
+ readonly showCursor: boolean;
1373
1466
  /**
1374
1467
  * Synchronized Output Mode: `CSI ? 2 0 2 6 h`
1375
1468
  *
@@ -1377,6 +1470,13 @@ declare module '@xterm/headless' {
1377
1470
  * disabled, allowing for atomic screen updates without tearing.
1378
1471
  */
1379
1472
  readonly synchronizedOutputMode: boolean;
1473
+ /**
1474
+ * Win32 Input Mode: `CSI ? 9 0 0 1 h`
1475
+ *
1476
+ * When enabled, keyboard input is sent as Win32 INPUT_RECORD format:
1477
+ * `CSI Vk ; Sc ; Uc ; Kd ; Cs ; Rc _`
1478
+ */
1479
+ readonly win32InputMode: boolean;
1380
1480
  /**
1381
1481
  * Auto-Wrap Mode (DECAWM): `CSI ? 7 h`
1382
1482
  */