acode-plugin-types 1.11.7-patch.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.
Files changed (79) hide show
  1. package/README.md +8 -0
  2. package/index.d.ts +91 -0
  3. package/package.json +26 -0
  4. package/src/ace/index.d.ts +1 -0
  5. package/src/ace/modelist.d.ts +22 -0
  6. package/src/acode.d.ts +437 -0
  7. package/src/components/collapsibleList.d.ts +11 -0
  8. package/src/components/contextMenu.d.ts +66 -0
  9. package/src/components/index.d.ts +10 -0
  10. package/src/components/inputhints.d.ts +45 -0
  11. package/src/components/page.d.ts +22 -0
  12. package/src/components/palette.d.ts +21 -0
  13. package/src/components/sideButton.d.ts +35 -0
  14. package/src/components/terminal/index.d.ts +1 -0
  15. package/src/components/terminal/terminalManager.d.ts +113 -0
  16. package/src/components/toast.d.ts +20 -0
  17. package/src/components/tutorial.d.ts +13 -0
  18. package/src/components/webComponents/index.d.ts +1 -0
  19. package/src/components/webComponents/wcPage.d.ts +85 -0
  20. package/src/dialogs/alert.d.ts +15 -0
  21. package/src/dialogs/box.d.ts +45 -0
  22. package/src/dialogs/color.d.ts +15 -0
  23. package/src/dialogs/confirm.d.ts +16 -0
  24. package/src/dialogs/index.d.ts +8 -0
  25. package/src/dialogs/loader.d.ts +44 -0
  26. package/src/dialogs/multiPrompt.d.ts +16 -0
  27. package/src/dialogs/prompt.d.ts +47 -0
  28. package/src/dialogs/select.d.ts +66 -0
  29. package/src/fileSystem.d.ts +113 -0
  30. package/src/handlers/index.d.ts +3 -0
  31. package/src/handlers/intent.d.ts +47 -0
  32. package/src/handlers/keyboard.d.ts +30 -0
  33. package/src/handlers/windowResize.d.ts +13 -0
  34. package/src/index.d.ts +12 -0
  35. package/src/lib/actionStack.d.ts +60 -0
  36. package/src/lib/editorFile.d.ts +344 -0
  37. package/src/lib/editorManager.d.ts +127 -0
  38. package/src/lib/fileList.d.ts +70 -0
  39. package/src/lib/fonts.d.ts +29 -0
  40. package/src/lib/index.d.ts +9 -0
  41. package/src/lib/openFolder.d.ts +102 -0
  42. package/src/lib/projects.d.ts +28 -0
  43. package/src/lib/selectionMenu.d.ts +19 -0
  44. package/src/lib/settings.d.ts +155 -0
  45. package/src/pages/fileBrowser/fileBrowser.d.ts +65 -0
  46. package/src/pages/fileBrowser/index.d.ts +1 -0
  47. package/src/pages/index.d.ts +1 -0
  48. package/src/plugins/customtabs/CustomTabs.d.ts +57 -0
  49. package/src/plugins/customtabs/index.d.ts +1 -0
  50. package/src/plugins/index.d.ts +4 -0
  51. package/src/plugins/system/System.d.ts +550 -0
  52. package/src/plugins/system/index.d.ts +1 -0
  53. package/src/plugins/terminal/Executor.d.ts +155 -0
  54. package/src/plugins/terminal/Terminal.d.ts +123 -0
  55. package/src/plugins/terminal/index.d.ts +2 -0
  56. package/src/plugins/websocket/WebSocket.d.ts +224 -0
  57. package/src/plugins/websocket/index.d.ts +1 -0
  58. package/src/sideBarApps.d.ts +39 -0
  59. package/src/test.ts +517 -0
  60. package/src/theme/builder.d.ts +188 -0
  61. package/src/theme/index.d.ts +2 -0
  62. package/src/theme/list.d.ts +29 -0
  63. package/src/utils/KeyboardEvent.d.ts +19 -0
  64. package/src/utils/Url.d.ts +65 -0
  65. package/src/utils/color.d.ts +51 -0
  66. package/src/utils/encodings.d.ts +24 -0
  67. package/src/utils/helpers.d.ts +102 -0
  68. package/src/utils/index.d.ts +5 -0
  69. package/types/ace/VERSION +1 -0
  70. package/types/ace/ace-modes.d.ts +1724 -0
  71. package/types/ace/index.d.ts +1176 -0
  72. package/types/ace/types/ace-ext.d.ts +720 -0
  73. package/types/ace/types/ace-lib.d.ts +302 -0
  74. package/types/ace/types/ace-modules.d.ts +5293 -0
  75. package/types/ace/types/ace-snippets.d.ts +406 -0
  76. package/types/ace/types/ace-theme.d.ts +437 -0
  77. package/types/html-tag-js.d.ts +680 -0
  78. package/types/require.d.ts +412 -0
  79. package/types/xterm.d.ts +1908 -0
@@ -0,0 +1,1908 @@
1
+ /**
2
+ * @license MIT
3
+ *
4
+ * This contains the type declarations for the xterm.js library. Note that
5
+ * some interfaces differ between this file and the actual implementation in
6
+ * src/, that's because this file declares the *public* API which is intended
7
+ * to be stable and consumed by external programs.
8
+ */
9
+
10
+ /// <reference lib="dom"/>
11
+
12
+ declare namespace Xterm {
13
+ /**
14
+ * A string or number representing text font weight.
15
+ */
16
+ export type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | number;
17
+
18
+ /**
19
+ * A string representing log level.
20
+ */
21
+ export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'off';
22
+
23
+ /**
24
+ * An object containing options for the terminal.
25
+ */
26
+ export interface ITerminalOptions {
27
+ /**
28
+ * Whether to allow the use of proposed API. When false, any usage of APIs
29
+ * marked as experimental/proposed will throw an error. The default is
30
+ * false.
31
+ */
32
+ allowProposedApi?: boolean;
33
+
34
+ /**
35
+ * Whether background should support non-opaque color. It must be set before
36
+ * executing the `Terminal.open()` method and can't be changed later without
37
+ * executing it again. Note that enabling this can negatively impact
38
+ * performance.
39
+ */
40
+ allowTransparency?: boolean;
41
+
42
+ /**
43
+ * If enabled, alt + click will move the prompt cursor to position
44
+ * underneath the mouse. The default is true.
45
+ */
46
+ altClickMovesCursor?: boolean;
47
+
48
+ /**
49
+ * When enabled the cursor will be set to the beginning of the next line
50
+ * with every new line. This is equivalent to sending '\r\n' for each '\n'.
51
+ * Normally the termios settings of the underlying PTY deals with the
52
+ * translation of '\n' to '\r\n' and this setting should not be used. If you
53
+ * deal with data from a non-PTY related source, this settings might be
54
+ * useful.
55
+ */
56
+ convertEol?: boolean;
57
+
58
+ /**
59
+ * Whether the cursor blinks.
60
+ */
61
+ cursorBlink?: boolean;
62
+
63
+ /**
64
+ * The style of the cursor when the terminal is focused.
65
+ */
66
+ cursorStyle?: 'block' | 'underline' | 'bar';
67
+
68
+ /**
69
+ * The width of the cursor in CSS pixels when `cursorStyle` is set to 'bar'.
70
+ */
71
+ cursorWidth?: number;
72
+
73
+ /**
74
+ * The style of the cursor when the terminal is not focused.
75
+ */
76
+ cursorInactiveStyle?: 'outline' | 'block' | 'bar' | 'underline' | 'none';
77
+
78
+ /**
79
+ * Whether to draw custom glyphs for block element and box drawing
80
+ * characters instead of using the font. This should typically result in
81
+ * better rendering with continuous lines, even when line height and letter
82
+ * spacing is used. Note that this doesn't work with the DOM renderer which
83
+ * renders all characters using the font. The default is true.
84
+ */
85
+ customGlyphs?: boolean;
86
+
87
+ /**
88
+ * Whether input should be disabled.
89
+ */
90
+ disableStdin?: boolean;
91
+
92
+ /**
93
+ * A {@link Document} to use instead of the one that xterm.js was attached
94
+ * to. The purpose of this is to improve support in multi-window
95
+ * applications where HTML elements may be references across multiple
96
+ * windows which can cause problems with `instanceof`.
97
+ *
98
+ * The type is `any` because using `Document` can cause TS to have
99
+ * performance/compiler problems.
100
+ */
101
+ documentOverride?: any | null;
102
+
103
+ /**
104
+ * Whether to draw bold text in bright colors. The default is true.
105
+ */
106
+ drawBoldTextInBrightColors?: boolean;
107
+
108
+ /**
109
+ * The modifier key hold to multiply scroll speed.
110
+ */
111
+ fastScrollModifier?: 'none' | 'alt' | 'ctrl' | 'shift';
112
+
113
+ /**
114
+ * The scroll speed multiplier used for fast scrolling.
115
+ */
116
+ fastScrollSensitivity?: number;
117
+
118
+ /**
119
+ * The font size used to render text.
120
+ */
121
+ fontSize?: number;
122
+
123
+ /**
124
+ * The font family used to render text.
125
+ */
126
+ fontFamily?: string;
127
+
128
+ /**
129
+ * The font weight used to render non-bold text.
130
+ */
131
+ fontWeight?: FontWeight;
132
+
133
+ /**
134
+ * The font weight used to render bold text.
135
+ */
136
+ fontWeightBold?: FontWeight;
137
+
138
+ /**
139
+ * Whether to ignore the bracketed paste mode. When true, this will always
140
+ * paste without the `\x1b[200~` and `\x1b[201~` sequences, even when the
141
+ * shell enables bracketed mode.
142
+ */
143
+ ignoreBracketedPasteMode?: boolean;
144
+
145
+ /**
146
+ * The spacing in whole pixels between characters.
147
+ */
148
+ letterSpacing?: number;
149
+
150
+ /**
151
+ * The line height used to render text.
152
+ */
153
+ lineHeight?: number;
154
+
155
+ /**
156
+ * The handler for OSC 8 hyperlinks. Links will use the `confirm` browser
157
+ * API with a strongly worded warning if no link handler is set.
158
+ *
159
+ * When setting this, consider the security of users opening these links,
160
+ * at a minimum there should be a tooltip or a prompt when hovering or
161
+ * activating the link respectively. An example of what might be possible is
162
+ * a terminal app writing link in the form `javascript:...` that runs some
163
+ * javascript, a safe approach to prevent that is to validate the link
164
+ * starts with http(s)://.
165
+ */
166
+ linkHandler?: ILinkHandler | null;
167
+
168
+ /**
169
+ * What log level to use, this will log for all levels below and including
170
+ * what is set:
171
+ *
172
+ * 1. trace
173
+ * 2. debug
174
+ * 3. info (default)
175
+ * 4. warn
176
+ * 5. error
177
+ * 6. off
178
+ */
179
+ logLevel?: LogLevel;
180
+
181
+ /**
182
+ * A logger to use instead of `console`.
183
+ */
184
+ logger?: ILogger | null;
185
+
186
+ /**
187
+ * Whether to treat option as the meta key.
188
+ */
189
+ macOptionIsMeta?: boolean;
190
+
191
+ /**
192
+ * Whether holding a modifier key will force normal selection behavior,
193
+ * regardless of whether the terminal is in mouse events mode. This will
194
+ * also prevent mouse events from being emitted by the terminal. For
195
+ * example, this allows you to use xterm.js' regular selection inside tmux
196
+ * with mouse mode enabled.
197
+ */
198
+ macOptionClickForcesSelection?: boolean;
199
+
200
+ /**
201
+ * The minimum contrast ratio for text in the terminal, setting this will
202
+ * change the foreground color dynamically depending on whether the contrast
203
+ * ratio is met. Example values:
204
+ *
205
+ * - 1: The default, do nothing.
206
+ * - 4.5: Minimum for WCAG AA compliance.
207
+ * - 7: Minimum for WCAG AAA compliance.
208
+ * - 21: White on black or black on white.
209
+ */
210
+ minimumContrastRatio?: number;
211
+
212
+ /**
213
+ * Whether to rescale glyphs horizontally that are a single cell wide but
214
+ * have glyphs that would overlap following cell(s). This typically happens
215
+ * for ambiguous width characters (eg. the roman numeral characters U+2160+)
216
+ * which aren't featured in monospace fonts. This is an important feature
217
+ * for achieving GB18030 compliance.
218
+ *
219
+ * The following glyphs will never be rescaled:
220
+ *
221
+ * - Emoji glyphs
222
+ * - Powerline glyphs
223
+ * - Nerd font glyphs
224
+ *
225
+ * Note that this doesn't work with the DOM renderer. The default is false.
226
+ */
227
+ rescaleOverlappingGlyphs?: boolean;
228
+
229
+ /**
230
+ * Whether to select the word under the cursor on right click, this is
231
+ * standard behavior in a lot of macOS applications.
232
+ */
233
+ rightClickSelectsWord?: boolean;
234
+
235
+ /**
236
+ * Whether screen reader support is enabled. When on this will expose
237
+ * supporting elements in the DOM to support NVDA on Windows and VoiceOver
238
+ * on macOS.
239
+ */
240
+ screenReaderMode?: boolean;
241
+
242
+ /**
243
+ * The amount of scrollback in the terminal. Scrollback is the amount of
244
+ * rows that are retained when lines are scrolled beyond the initial
245
+ * viewport. Defaults to 1000.
246
+ */
247
+ scrollback?: number;
248
+
249
+ /**
250
+ * Whether to scroll to the bottom whenever there is some user input. The
251
+ * default is true.
252
+ */
253
+ scrollOnUserInput?: boolean;
254
+
255
+ /**
256
+ * The scrolling speed multiplier used for adjusting normal scrolling speed.
257
+ */
258
+ scrollSensitivity?: number;
259
+
260
+ /**
261
+ * The duration to smoothly scroll between the origin and the target in
262
+ * milliseconds. Set to 0 to disable smooth scrolling and scroll instantly.
263
+ */
264
+ smoothScrollDuration?: number;
265
+
266
+ /**
267
+ * The size of tab stops in the terminal.
268
+ */
269
+ tabStopWidth?: number;
270
+
271
+ /**
272
+ * The color theme of the terminal.
273
+ */
274
+ theme?: ITheme;
275
+
276
+ /**
277
+ * Whether "Windows mode" is enabled. Because Windows backends winpty and
278
+ * conpty operate by doing line wrapping on their side, xterm.js does not
279
+ * have access to wrapped lines. When Windows mode is enabled the following
280
+ * changes will be in effect:
281
+ *
282
+ * - Reflow is disabled.
283
+ * - Lines are assumed to be wrapped if the last character of the line is
284
+ * not whitespace.
285
+ *
286
+ * When using conpty on Windows 11 version >= 21376, it is recommended to
287
+ * disable this because native text wrapping sequences are output correctly
288
+ * thanks to https://github.com/microsoft/terminal/issues/405
289
+ *
290
+ * @deprecated Use {@link windowsPty}. This value will be ignored if
291
+ * windowsPty is set.
292
+ */
293
+ windowsMode?: boolean;
294
+
295
+ /**
296
+ * Compatibility information when the pty is known to be hosted on Windows.
297
+ * Setting this will turn on certain heuristics/workarounds depending on the
298
+ * values:
299
+ *
300
+ * - `if (backend !== undefined || buildNumber !== undefined)`
301
+ * - When increasing the rows in the terminal, the amount increased into
302
+ * the scrollback. This is done because ConPTY does not behave like
303
+ * expect scrollback to come back into the viewport, instead it makes
304
+ * empty rows at of the viewport. Not having this behavior can result in
305
+ * missing data as the rows get replaced.
306
+ * - `if !(backend === 'conpty' && buildNumber >= 21376)`
307
+ * - Reflow is disabled
308
+ * - Lines are assumed to be wrapped if the last character of the line is
309
+ * not whitespace.
310
+ */
311
+ windowsPty?: IWindowsPty;
312
+
313
+ /**
314
+ * A string containing all characters that are considered word separated by
315
+ * the double click to select work logic.
316
+ */
317
+ wordSeparator?: string;
318
+
319
+ /**
320
+ * Enable various window manipulation and report features.
321
+ * All features are disabled by default for security reasons.
322
+ */
323
+ windowOptions?: IWindowOptions;
324
+
325
+ /**
326
+ * The width, in pixels, of the canvas for the overview ruler. The overview
327
+ * ruler will be hidden when not set.
328
+ */
329
+ overviewRulerWidth?: number;
330
+ }
331
+
332
+ /**
333
+ * An object containing additional options for the terminal that can only be
334
+ * set on start up.
335
+ */
336
+ export interface ITerminalInitOnlyOptions {
337
+ /**
338
+ * The number of columns in the terminal.
339
+ */
340
+ cols?: number;
341
+
342
+ /**
343
+ * The number of rows in the terminal.
344
+ */
345
+ rows?: number;
346
+ }
347
+
348
+ /**
349
+ * Contains colors to theme the terminal with.
350
+ */
351
+ export interface ITheme {
352
+ /** The default foreground color */
353
+ foreground?: string;
354
+ /** The default background color */
355
+ background?: string;
356
+ /** The cursor color */
357
+ cursor?: string;
358
+ /** The accent color of the cursor (fg color for a block cursor) */
359
+ cursorAccent?: string;
360
+ /** The selection background color (can be transparent) */
361
+ selectionBackground?: string;
362
+ /** The selection foreground color */
363
+ selectionForeground?: string;
364
+ /**
365
+ * The selection background color when the terminal does not have focus (can
366
+ * be transparent)
367
+ */
368
+ selectionInactiveBackground?: string;
369
+ /** ANSI black (eg. `\x1b[30m`) */
370
+ black?: string;
371
+ /** ANSI red (eg. `\x1b[31m`) */
372
+ red?: string;
373
+ /** ANSI green (eg. `\x1b[32m`) */
374
+ green?: string;
375
+ /** ANSI yellow (eg. `\x1b[33m`) */
376
+ yellow?: string;
377
+ /** ANSI blue (eg. `\x1b[34m`) */
378
+ blue?: string;
379
+ /** ANSI magenta (eg. `\x1b[35m`) */
380
+ magenta?: string;
381
+ /** ANSI cyan (eg. `\x1b[36m`) */
382
+ cyan?: string;
383
+ /** ANSI white (eg. `\x1b[37m`) */
384
+ white?: string;
385
+ /** ANSI bright black (eg. `\x1b[1;30m`) */
386
+ brightBlack?: string;
387
+ /** ANSI bright red (eg. `\x1b[1;31m`) */
388
+ brightRed?: string;
389
+ /** ANSI bright green (eg. `\x1b[1;32m`) */
390
+ brightGreen?: string;
391
+ /** ANSI bright yellow (eg. `\x1b[1;33m`) */
392
+ brightYellow?: string;
393
+ /** ANSI bright blue (eg. `\x1b[1;34m`) */
394
+ brightBlue?: string;
395
+ /** ANSI bright magenta (eg. `\x1b[1;35m`) */
396
+ brightMagenta?: string;
397
+ /** ANSI bright cyan (eg. `\x1b[1;36m`) */
398
+ brightCyan?: string;
399
+ /** ANSI bright white (eg. `\x1b[1;37m`) */
400
+ brightWhite?: string;
401
+ /** ANSI extended colors (16-255) */
402
+ extendedAnsi?: string[];
403
+ }
404
+
405
+ /**
406
+ * Pty information for Windows.
407
+ */
408
+ export interface IWindowsPty {
409
+ /**
410
+ * What pty emulation backend is being used.
411
+ */
412
+ backend?: 'conpty' | 'winpty';
413
+ /**
414
+ * The Windows build version (eg. 19045)
415
+ */
416
+ buildNumber?: number;
417
+ }
418
+
419
+ /**
420
+ * A replacement logger for `console`.
421
+ */
422
+ export interface ILogger {
423
+ /**
424
+ * Log a trace message, this will only be called if
425
+ * {@link ITerminalOptions.logLevel} is set to trace.
426
+ */
427
+ trace(message: string, ...args: any[]): void;
428
+ /**
429
+ * Log a debug message, this will only be called if
430
+ * {@link ITerminalOptions.logLevel} is set to debug or below.
431
+ */
432
+ debug(message: string, ...args: any[]): void;
433
+ /**
434
+ * Log a debug message, this will only be called if
435
+ * {@link ITerminalOptions.logLevel} is set to info or below.
436
+ */
437
+ info(message: string, ...args: any[]): void;
438
+ /**
439
+ * Log a debug message, this will only be called if
440
+ * {@link ITerminalOptions.logLevel} is set to warn or below.
441
+ */
442
+ warn(message: string, ...args: any[]): void;
443
+ /**
444
+ * Log a debug message, this will only be called if
445
+ * {@link ITerminalOptions.logLevel} is set to error or below.
446
+ */
447
+ error(message: string | Error, ...args: any[]): void;
448
+ }
449
+
450
+ /**
451
+ * An object that can be disposed via a dispose function.
452
+ */
453
+ export interface IDisposable {
454
+ dispose(): void;
455
+ }
456
+
457
+ /**
458
+ * An event that can be listened to.
459
+ * @returns an `IDisposable` to stop listening.
460
+ */
461
+ export interface IEvent<T, U = void> {
462
+ (listener: (arg1: T, arg2: U) => any): IDisposable;
463
+ }
464
+
465
+ /**
466
+ * Represents a specific line in the terminal that is tracked when scrollback
467
+ * is trimmed and lines are added or removed. This is a single line that may
468
+ * be part of a larger wrapped line.
469
+ */
470
+ export interface IMarker extends IDisposableWithEvent {
471
+ /**
472
+ * A unique identifier for this marker.
473
+ */
474
+ readonly id: number;
475
+
476
+ /**
477
+ * The actual line index in the buffer at this point in time. This is set to
478
+ * -1 if the marker has been disposed.
479
+ */
480
+ readonly line: number;
481
+ }
482
+
483
+ /**
484
+ * Represents a disposable that tracks is disposed state.
485
+ */
486
+ export interface IDisposableWithEvent extends IDisposable {
487
+ /**
488
+ * Event listener to get notified when this gets disposed.
489
+ */
490
+ onDispose: IEvent<void>;
491
+
492
+ /**
493
+ * Whether this is disposed.
494
+ */
495
+ readonly isDisposed: boolean;
496
+ }
497
+
498
+ /**
499
+ * Represents a decoration in the terminal that is associated with a
500
+ * particular marker and DOM element.
501
+ */
502
+ export interface IDecoration extends IDisposableWithEvent {
503
+ /*
504
+ * The marker for the decoration in the terminal.
505
+ */
506
+ readonly marker: IMarker;
507
+
508
+ /**
509
+ * An event fired when the decoration
510
+ * is rendered, returns the dom element
511
+ * associated with the decoration.
512
+ */
513
+ readonly onRender: IEvent<HTMLElement>;
514
+
515
+ /**
516
+ * The element that the decoration is rendered to. This will be undefined
517
+ * until it is rendered for the first time by {@link IDecoration.onRender}.
518
+ * that.
519
+ */
520
+ element: HTMLElement | undefined;
521
+
522
+ /**
523
+ * The options for the overview ruler that can be updated. This will only
524
+ * take effect when {@link IDecorationOptions.overviewRulerOptions} were
525
+ * provided initially.
526
+ */
527
+ options: Pick<IDecorationOptions, 'overviewRulerOptions'>;
528
+ }
529
+
530
+
531
+ /**
532
+ * Overview ruler decoration options
533
+ */
534
+ interface IDecorationOverviewRulerOptions {
535
+ color: string;
536
+ position?: 'left' | 'center' | 'right' | 'full';
537
+ }
538
+
539
+ /*
540
+ * Options that define the presentation of the decoration.
541
+ */
542
+ export interface IDecorationOptions {
543
+ /**
544
+ * The line in the terminal where
545
+ * the decoration will be displayed
546
+ */
547
+ readonly marker: IMarker;
548
+
549
+ /*
550
+ * Where the decoration will be anchored -
551
+ * defaults to the left edge
552
+ */
553
+ readonly anchor?: 'right' | 'left';
554
+
555
+ /**
556
+ * The x position offset relative to the anchor
557
+ */
558
+ readonly x?: number;
559
+
560
+
561
+ /**
562
+ * The width of the decoration in cells, defaults to 1.
563
+ */
564
+ readonly width?: number;
565
+
566
+ /**
567
+ * The height of the decoration in cells, defaults to 1.
568
+ */
569
+ readonly height?: number;
570
+
571
+ /**
572
+ * The background color of the cell(s). When 2 decorations both set the
573
+ * foreground color the last registered decoration will be used. Only the
574
+ * `#RRGGBB` format is supported.
575
+ */
576
+ readonly backgroundColor?: string;
577
+
578
+ /**
579
+ * The foreground color of the cell(s). When 2 decorations both set the
580
+ * foreground color the last registered decoration will be used. Only the
581
+ * `#RRGGBB` format is supported.
582
+ */
583
+ readonly foregroundColor?: string;
584
+
585
+ /**
586
+ * What layer to render the decoration at when {@link backgroundColor} or
587
+ * {@link foregroundColor} are used. `'bottom'` will render under the
588
+ * selection, `'top`' will render above the selection\*.
589
+ *
590
+ * *\* The selection will render on top regardless of layer on the canvas
591
+ * renderer due to how it renders selection separately.*
592
+ */
593
+ readonly layer?: 'bottom' | 'top';
594
+
595
+ /**
596
+ * When defined, renders the decoration in the overview ruler to the right
597
+ * of the terminal. {@link ITerminalOptions.overviewRulerWidth} must be set
598
+ * in order to see the overview ruler.
599
+ * @param color The color of the decoration.
600
+ * @param position The position of the decoration.
601
+ */
602
+ overviewRulerOptions?: IDecorationOverviewRulerOptions;
603
+ }
604
+
605
+ /**
606
+ * The set of localizable strings.
607
+ */
608
+ export interface ILocalizableStrings {
609
+ /**
610
+ * The aria label for the underlying input textarea for the terminal.
611
+ */
612
+ promptLabel: string;
613
+
614
+ /**
615
+ * Announcement for when line reading is suppressed due to too many lines
616
+ * being printed to the terminal when `screenReaderMode` is enabled.
617
+ */
618
+ tooMuchOutput: string;
619
+ }
620
+
621
+ /**
622
+ * Enable various window manipulation and report features
623
+ * (`CSI Ps ; Ps ; Ps t`).
624
+ *
625
+ * Most settings have no default implementation, as they heavily rely on
626
+ * the embedding environment.
627
+ *
628
+ * To implement a feature, create a custom CSI hook like this:
629
+ * ```ts
630
+ * term.parser.addCsiHandler({final: 't'}, params => {
631
+ * const ps = params[0];
632
+ * switch (ps) {
633
+ * case XY:
634
+ * ... // your implementation for option XY
635
+ * return true; // signal Ps=XY was handled
636
+ * }
637
+ * return false; // any Ps that was not handled
638
+ * });
639
+ * ```
640
+ *
641
+ * Note on security:
642
+ * Most features are meant to deal with some information of the host machine
643
+ * where the terminal runs on. This is seen as a security risk possibly
644
+ * leaking sensitive data of the host to the program in the terminal.
645
+ * Therefore all options (even those without a default implementation) are
646
+ * guarded by the boolean flag and disabled by default.
647
+ */
648
+ export interface IWindowOptions {
649
+ /**
650
+ * Ps=1 De-iconify window.
651
+ * No default implementation.
652
+ */
653
+ restoreWin?: boolean;
654
+ /**
655
+ * Ps=2 Iconify window.
656
+ * No default implementation.
657
+ */
658
+ minimizeWin?: boolean;
659
+ /**
660
+ * Ps=3 ; x ; y
661
+ * Move window to [x, y].
662
+ * No default implementation.
663
+ */
664
+ setWinPosition?: boolean;
665
+ /**
666
+ * Ps = 4 ; height ; width
667
+ * Resize the window to given `height` and `width` in pixels.
668
+ * Omitted parameters should reuse the current height or width.
669
+ * Zero parameters should use the display's height or width.
670
+ * No default implementation.
671
+ */
672
+ setWinSizePixels?: boolean;
673
+ /**
674
+ * Ps=5 Raise the window to the front of the stacking order.
675
+ * No default implementation.
676
+ */
677
+ raiseWin?: boolean;
678
+ /**
679
+ * Ps=6 Lower the xterm window to the bottom of the stacking order.
680
+ * No default implementation.
681
+ */
682
+ lowerWin?: boolean;
683
+ /** Ps=7 Refresh the window. */
684
+ refreshWin?: boolean;
685
+ /**
686
+ * Ps = 8 ; height ; width
687
+ * Resize the text area to given height and width in characters.
688
+ * Omitted parameters should reuse the current height or width.
689
+ * Zero parameters use the display's height or width.
690
+ * No default implementation.
691
+ */
692
+ setWinSizeChars?: boolean;
693
+ /**
694
+ * Ps=9 ; 0 Restore maximized window.
695
+ * Ps=9 ; 1 Maximize window (i.e., resize to screen size).
696
+ * Ps=9 ; 2 Maximize window vertically.
697
+ * Ps=9 ; 3 Maximize window horizontally.
698
+ * No default implementation.
699
+ */
700
+ maximizeWin?: boolean;
701
+ /**
702
+ * Ps=10 ; 0 Undo full-screen mode.
703
+ * Ps=10 ; 1 Change to full-screen.
704
+ * Ps=10 ; 2 Toggle full-screen.
705
+ * No default implementation.
706
+ */
707
+ fullscreenWin?: boolean;
708
+ /** Ps=11 Report xterm window state.
709
+ * If the xterm window is non-iconified, it returns "CSI 1 t".
710
+ * If the xterm window is iconified, it returns "CSI 2 t".
711
+ * No default implementation.
712
+ */
713
+ getWinState?: boolean;
714
+ /**
715
+ * Ps=13 Report xterm window position. Result is "CSI 3 ; x ; y t".
716
+ * Ps=13 ; 2 Report xterm text-area position. Result is "CSI 3 ; x ; y t".
717
+ * No default implementation.
718
+ */
719
+ getWinPosition?: boolean;
720
+ /**
721
+ * Ps=14 Report xterm text area size in pixels. Result is "CSI 4 ; height ; width t".
722
+ * Ps=14 ; 2 Report xterm window size in pixels. Result is "CSI 4 ; height ; width t".
723
+ * Has a default implementation.
724
+ */
725
+ getWinSizePixels?: boolean;
726
+ /**
727
+ * Ps=15 Report size of the screen in pixels. Result is "CSI 5 ; height ; width t".
728
+ * No default implementation.
729
+ */
730
+ getScreenSizePixels?: boolean;
731
+ /**
732
+ * Ps=16 Report xterm character cell size in pixels. Result is "CSI 6 ; height ; width t".
733
+ * Has a default implementation.
734
+ */
735
+ getCellSizePixels?: boolean;
736
+ /**
737
+ * Ps=18 Report the size of the text area in characters. Result is "CSI 8 ; height ; width t".
738
+ * Has a default implementation.
739
+ */
740
+ getWinSizeChars?: boolean;
741
+ /**
742
+ * Ps=19 Report the size of the screen in characters. Result is "CSI 9 ; height ; width t".
743
+ * No default implementation.
744
+ */
745
+ getScreenSizeChars?: boolean;
746
+ /**
747
+ * Ps=20 Report xterm window's icon label. Result is "OSC L label ST".
748
+ * No default implementation.
749
+ */
750
+ getIconTitle?: boolean;
751
+ /**
752
+ * Ps=21 Report xterm window's title. Result is "OSC l label ST".
753
+ * No default implementation.
754
+ */
755
+ getWinTitle?: boolean;
756
+ /**
757
+ * Ps=22 ; 0 Save xterm icon and window title on stack.
758
+ * Ps=22 ; 1 Save xterm icon title on stack.
759
+ * Ps=22 ; 2 Save xterm window title on stack.
760
+ * All variants have a default implementation.
761
+ */
762
+ pushTitle?: boolean;
763
+ /**
764
+ * Ps=23 ; 0 Restore xterm icon and window title from stack.
765
+ * Ps=23 ; 1 Restore xterm icon title from stack.
766
+ * Ps=23 ; 2 Restore xterm window title from stack.
767
+ * All variants have a default implementation.
768
+ */
769
+ popTitle?: boolean;
770
+ /**
771
+ * Ps>=24 Resize to Ps lines (DECSLPP).
772
+ * DECSLPP is not implemented. This settings is also used to
773
+ * enable / disable DECCOLM (earlier variant of DECSLPP).
774
+ */
775
+ setWinLines?: boolean;
776
+ }
777
+
778
+ /**
779
+ * The class that represents an xterm.js terminal.
780
+ */
781
+ export class Terminal implements IDisposable {
782
+ /**
783
+ * The element containing the terminal.
784
+ */
785
+ readonly element: HTMLElement | undefined;
786
+
787
+ /**
788
+ * The textarea that accepts input for the terminal.
789
+ */
790
+ readonly textarea: HTMLTextAreaElement | undefined;
791
+
792
+ /**
793
+ * The number of rows in the terminal's viewport. Use
794
+ * `ITerminalOptions.rows` to set this in the constructor and
795
+ * `Terminal.resize` for when the terminal exists.
796
+ */
797
+ readonly rows: number;
798
+
799
+ /**
800
+ * The number of columns in the terminal's viewport. Use
801
+ * `ITerminalOptions.cols` to set this in the constructor and
802
+ * `Terminal.resize` for when the terminal exists.
803
+ */
804
+ readonly cols: number;
805
+
806
+ /**
807
+ * Access to the terminal's normal and alt buffer.
808
+ */
809
+ readonly buffer: IBufferNamespace;
810
+
811
+ /**
812
+ * (EXPERIMENTAL) Get all markers registered against the buffer. If the alt
813
+ * buffer is active this will always return [].
814
+ */
815
+ readonly markers: ReadonlyArray<IMarker>;
816
+
817
+ /**
818
+ * Get the parser interface to register custom escape sequence handlers.
819
+ */
820
+ readonly parser: IParser;
821
+
822
+ /**
823
+ * (EXPERIMENTAL) Get the Unicode handling interface
824
+ * to register and switch Unicode version.
825
+ */
826
+ readonly unicode: IUnicodeHandling;
827
+
828
+ /**
829
+ * Gets the terminal modes as set by SM/DECSET.
830
+ */
831
+ readonly modes: IModes;
832
+
833
+ /**
834
+ * Gets or sets the terminal options. This supports setting multiple
835
+ * options.
836
+ *
837
+ * @example Get a single option
838
+ * ```ts
839
+ * console.log(terminal.options.fontSize);
840
+ * ```
841
+ *
842
+ * @example Set a single option:
843
+ * ```ts
844
+ * terminal.options.fontSize = 12;
845
+ * ```
846
+ * Note that for options that are object, a new object must be used in order
847
+ * to take effect as a reference comparison will be done:
848
+ * ```ts
849
+ * const newValue = terminal.options.theme;
850
+ * newValue.background = '#000000';
851
+ *
852
+ * // This won't work
853
+ * terminal.options.theme = newValue;
854
+ *
855
+ * // This will work
856
+ * terminal.options.theme = { ...newValue };
857
+ * ```
858
+ *
859
+ * @example Set multiple options
860
+ * ```ts
861
+ * terminal.options = {
862
+ * fontSize: 12,
863
+ * fontFamily: 'Courier New'
864
+ * };
865
+ * ```
866
+ */
867
+ options: ITerminalOptions;
868
+
869
+ /**
870
+ * Natural language strings that can be localized.
871
+ */
872
+ static strings: ILocalizableStrings;
873
+
874
+ /**
875
+ * Creates a new `Terminal` object.
876
+ *
877
+ * @param options An object containing a set of options.
878
+ */
879
+ constructor(options?: ITerminalOptions & ITerminalInitOnlyOptions);
880
+
881
+ /**
882
+ * Adds an event listener for when the bell is triggered.
883
+ * @returns an `IDisposable` to stop listening.
884
+ */
885
+ onBell: IEvent<void>;
886
+
887
+ /**
888
+ * Adds an event listener for when a binary event fires. This is used to
889
+ * enable non UTF-8 conformant binary messages to be sent to the backend.
890
+ * Currently this is only used for a certain type of mouse reports that
891
+ * happen to be not UTF-8 compatible.
892
+ * The event value is a JS string, pass it to the underlying pty as
893
+ * binary data, e.g. `pty.write(Buffer.from(data, 'binary'))`.
894
+ * @returns an `IDisposable` to stop listening.
895
+ */
896
+ onBinary: IEvent<string>;
897
+
898
+ /**
899
+ * Adds an event listener for the cursor moves.
900
+ * @returns an `IDisposable` to stop listening.
901
+ */
902
+ onCursorMove: IEvent<void>;
903
+
904
+ /**
905
+ * Adds an event listener for when a data event fires. This happens for
906
+ * example when the user types or pastes into the terminal. The event value
907
+ * is whatever `string` results, in a typical setup, this should be passed
908
+ * on to the backing pty.
909
+ * @returns an `IDisposable` to stop listening.
910
+ */
911
+ onData: IEvent<string>;
912
+
913
+ /**
914
+ * Adds an event listener for when a key is pressed. The event value
915
+ * contains the string that will be sent in the data event as well as the
916
+ * DOM event that triggered it.
917
+ * @returns an `IDisposable` to stop listening.
918
+ */
919
+ onKey: IEvent<{ key: string, domEvent: KeyboardEvent }>;
920
+
921
+ /**
922
+ * Adds an event listener for when a line feed is added.
923
+ * @returns an `IDisposable` to stop listening.
924
+ */
925
+ onLineFeed: IEvent<void>;
926
+
927
+ /**
928
+ * Adds an event listener for when rows are rendered. The event value
929
+ * contains the start row and end rows of the rendered area (ranges from `0`
930
+ * to `Terminal.rows - 1`).
931
+ * @returns an `IDisposable` to stop listening.
932
+ */
933
+ onRender: IEvent<{ start: number, end: number }>;
934
+
935
+ /**
936
+ * Adds an event listener for when data has been parsed by the terminal,
937
+ * after {@link write} is called. This event is useful to listen for any
938
+ * changes in the buffer.
939
+ *
940
+ * This fires at most once per frame, after data parsing completes. Note
941
+ * that this can fire when there are still writes pending if there is a lot
942
+ * of data.
943
+ */
944
+ onWriteParsed: IEvent<void>;
945
+
946
+ /**
947
+ * Adds an event listener for when the terminal is resized. The event value
948
+ * contains the new size.
949
+ * @returns an `IDisposable` to stop listening.
950
+ */
951
+ onResize: IEvent<{ cols: number, rows: number }>;
952
+
953
+ /**
954
+ * Adds an event listener for when a scroll occurs. The event value is the
955
+ * new position of the viewport.
956
+ * @returns an `IDisposable` to stop listening.
957
+ */
958
+ onScroll: IEvent<number>;
959
+
960
+ /**
961
+ * Adds an event listener for when a selection change occurs.
962
+ * @returns an `IDisposable` to stop listening.
963
+ */
964
+ onSelectionChange: IEvent<void>;
965
+
966
+ /**
967
+ * Adds an event listener for when an OSC 0 or OSC 2 title change occurs.
968
+ * The event value is the new title.
969
+ * @returns an `IDisposable` to stop listening.
970
+ */
971
+ onTitleChange: IEvent<string>;
972
+
973
+ /**
974
+ * Unfocus the terminal.
975
+ */
976
+ blur(): void;
977
+
978
+ /**
979
+ * Focus the terminal.
980
+ */
981
+ focus(): void;
982
+
983
+ /**
984
+ * Input data to application side. The data is treated the same way input
985
+ * typed into the terminal would (ie. the {@link onData} event will fire).
986
+ * @param data The data to forward to the application.
987
+ * @param wasUserInput Whether the input is genuine user input. This is true
988
+ * by default and triggers additionalbehavior like focus or selection
989
+ * clearing. Set this to false if the data sent should not be treated like
990
+ * user input would, for example passing an escape sequence to the
991
+ * application.
992
+ */
993
+ input(data: string, wasUserInput?: boolean): void;
994
+
995
+ /**
996
+ * Resizes the terminal. It's best practice to debounce calls to resize,
997
+ * this will help ensure that the pty can respond to the resize event
998
+ * before another one occurs.
999
+ * @param x The number of columns to resize to.
1000
+ * @param y The number of rows to resize to.
1001
+ */
1002
+ resize(columns: number, rows: number): void;
1003
+
1004
+ /**
1005
+ * Opens the terminal within an element. This should also be called if the
1006
+ * xterm.js element ever changes browser window.
1007
+ * @param parent The element to create the terminal within. This element
1008
+ * must be visible (have dimensions) when `open` is called as several DOM-
1009
+ * based measurements need to be performed when this function is called.
1010
+ */
1011
+ open(parent: HTMLElement): void;
1012
+
1013
+ /**
1014
+ * Attaches a custom key event handler which is run before keys are
1015
+ * processed, giving consumers of xterm.js ultimate control as to what keys
1016
+ * should be processed by the terminal and what keys should not.
1017
+ * @param customKeyEventHandler The custom KeyboardEvent handler to attach.
1018
+ * This is a function that takes a KeyboardEvent, allowing consumers to stop
1019
+ * propagation and/or prevent the default action. The function returns
1020
+ * whether the event should be processed by xterm.js.
1021
+ *
1022
+ * @example A custom keymap that overrides the backspace key
1023
+ * ```ts
1024
+ * const keymap = [
1025
+ * { "key": "Backspace", "shiftKey": false, "mapCode": 8 },
1026
+ * { "key": "Backspace", "shiftKey": true, "mapCode": 127 }
1027
+ * ];
1028
+ * term.attachCustomKeyEventHandler(ev => {
1029
+ * if (ev.type === 'keydown') {
1030
+ * for (let i in keymap) {
1031
+ * if (keymap[i].key == ev.key && keymap[i].shiftKey == ev.shiftKey) {
1032
+ * socket.send(String.fromCharCode(keymap[i].mapCode));
1033
+ * return false;
1034
+ * }
1035
+ * }
1036
+ * }
1037
+ * });
1038
+ * ```
1039
+ */
1040
+ attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void;
1041
+
1042
+ /**
1043
+ * Attaches a custom wheel event handler which is run before keys are
1044
+ * processed, giving consumers of xterm.js control over whether to proceed
1045
+ * or cancel terminal wheel events.
1046
+ * @param customWheelEventHandler The custom WheelEvent handler to attach.
1047
+ * This is a function that takes a WheelEvent, allowing consumers to stop
1048
+ * propagation and/or prevent the default action. The function returns
1049
+ * whether the event should be processed by xterm.js.
1050
+ *
1051
+ * @example A handler that prevents all wheel events while ctrl is held from
1052
+ * being processed.
1053
+ * ```ts
1054
+ * term.attachCustomWheelEventHandler(ev => {
1055
+ * if (ev.ctrlKey) {
1056
+ * return false;
1057
+ * }
1058
+ * return true;
1059
+ * });
1060
+ * ```
1061
+ */
1062
+ attachCustomWheelEventHandler(customWheelEventHandler: (event: WheelEvent) => boolean): void;
1063
+
1064
+ /**
1065
+ * Registers a link provider, allowing a custom parser to be used to match
1066
+ * and handle links. Multiple link providers can be used, they will be asked
1067
+ * in the order in which they are registered.
1068
+ * @param linkProvider The link provider to use to detect links.
1069
+ */
1070
+ registerLinkProvider(linkProvider: ILinkProvider): IDisposable;
1071
+
1072
+ /**
1073
+ * (EXPERIMENTAL) Registers a character joiner, allowing custom sequences of
1074
+ * characters to be rendered as a single unit. This is useful in particular
1075
+ * for rendering ligatures and graphemes, among other things.
1076
+ *
1077
+ * Each registered character joiner is called with a string of text
1078
+ * representing a portion of a line in the terminal that can be rendered as
1079
+ * a single unit. The joiner must return a sorted array, where each entry is
1080
+ * itself an array of length two, containing the start (inclusive) and end
1081
+ * (exclusive) index of a substring of the input that should be rendered as
1082
+ * a single unit. When multiple joiners are provided, the results of each
1083
+ * are collected. If there are any overlapping substrings between them, they
1084
+ * are combined into one larger unit that is drawn together.
1085
+ *
1086
+ * All character joiners that are registered get called every time a line is
1087
+ * rendered in the terminal, so it is essential for the handler function to
1088
+ * run as quickly as possible to avoid slowdowns when rendering. Similarly,
1089
+ * joiners should strive to return the smallest possible substrings to
1090
+ * render together, since they aren't drawn as optimally as individual
1091
+ * characters.
1092
+ *
1093
+ * NOTE: character joiners are only used by the canvas renderer.
1094
+ *
1095
+ * @param handler The function that determines character joins. It is called
1096
+ * with a string of text that is eligible for joining and returns an array
1097
+ * where each entry is an array containing the start (inclusive) and end
1098
+ * (exclusive) indexes of ranges that should be rendered as a single unit.
1099
+ * @returns The ID of the new joiner, this can be used to deregister
1100
+ */
1101
+ registerCharacterJoiner(handler: (text: string) => [number, number][]): number;
1102
+
1103
+ /**
1104
+ * (EXPERIMENTAL) Deregisters the character joiner if one was registered.
1105
+ * NOTE: character joiners are only used by the canvas renderer.
1106
+ * @param joinerId The character joiner's ID (returned after register)
1107
+ */
1108
+ deregisterCharacterJoiner(joinerId: number): void;
1109
+
1110
+ /**
1111
+ * Adds a marker to the normal buffer and returns it.
1112
+ * @param cursorYOffset The y position offset of the marker from the cursor.
1113
+ * @returns The new marker or undefined.
1114
+ */
1115
+ registerMarker(cursorYOffset?: number): IMarker;
1116
+
1117
+ /**
1118
+ * (EXPERIMENTAL) Adds a decoration to the terminal using
1119
+ * @param decorationOptions, which takes a marker and an optional anchor,
1120
+ * width, height, and x offset from the anchor. Returns the decoration or
1121
+ * undefined if the alt buffer is active or the marker has already been
1122
+ * disposed of.
1123
+ * @throws when options include a negative x offset.
1124
+ */
1125
+ registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;
1126
+
1127
+ /**
1128
+ * Gets whether the terminal has an active selection.
1129
+ */
1130
+ hasSelection(): boolean;
1131
+
1132
+ /**
1133
+ * Gets the terminal's current selection, this is useful for implementing
1134
+ * copy behavior outside of xterm.js.
1135
+ */
1136
+ getSelection(): string;
1137
+
1138
+ /**
1139
+ * Gets the selection position or undefined if there is no selection.
1140
+ */
1141
+ getSelectionPosition(): IBufferRange | undefined;
1142
+
1143
+ /**
1144
+ * Clears the current terminal selection.
1145
+ */
1146
+ clearSelection(): void;
1147
+
1148
+ /**
1149
+ * Selects text within the terminal.
1150
+ * @param column The column the selection starts at.
1151
+ * @param row The row the selection starts at.
1152
+ * @param length The length of the selection.
1153
+ */
1154
+ select(column: number, row: number, length: number): void;
1155
+
1156
+ /**
1157
+ * Selects all text within the terminal.
1158
+ */
1159
+ selectAll(): void;
1160
+
1161
+ /**
1162
+ * Selects text in the buffer between 2 lines.
1163
+ * @param start The 0-based line index to select from (inclusive).
1164
+ * @param end The 0-based line index to select to (inclusive).
1165
+ */
1166
+ selectLines(start: number, end: number): void;
1167
+
1168
+ /*
1169
+ * Disposes of the terminal, detaching it from the DOM and removing any
1170
+ * active listeners. Once the terminal is disposed it should not be used
1171
+ * again.
1172
+ */
1173
+ dispose(): void;
1174
+
1175
+ /**
1176
+ * Scroll the display of the terminal
1177
+ * @param amount The number of lines to scroll down (negative scroll up).
1178
+ */
1179
+ scrollLines(amount: number): void;
1180
+
1181
+ /**
1182
+ * Scroll the display of the terminal by a number of pages.
1183
+ * @param pageCount The number of pages to scroll (negative scrolls up).
1184
+ */
1185
+ scrollPages(pageCount: number): void;
1186
+
1187
+ /**
1188
+ * Scrolls the display of the terminal to the top.
1189
+ */
1190
+ scrollToTop(): void;
1191
+
1192
+ /**
1193
+ * Scrolls the display of the terminal to the bottom.
1194
+ */
1195
+ scrollToBottom(): void;
1196
+
1197
+ /**
1198
+ * Scrolls to a line within the buffer.
1199
+ * @param line The 0-based line index to scroll to.
1200
+ */
1201
+ scrollToLine(line: number): void;
1202
+
1203
+ /**
1204
+ * Clear the entire buffer, making the prompt line the new first line.
1205
+ */
1206
+ clear(): void;
1207
+
1208
+ /**
1209
+ * Write data to the terminal.
1210
+ * @param data The data to write to the terminal. This can either be raw
1211
+ * bytes given as Uint8Array from the pty or a string. Raw bytes will always
1212
+ * be treated as UTF-8 encoded, string data as UTF-16.
1213
+ * @param callback Optional callback that fires when the data was processed
1214
+ * by the parser.
1215
+ */
1216
+ write(data: string | Uint8Array, callback?: () => void): void;
1217
+
1218
+ /**
1219
+ * Writes data to the terminal, followed by a break line character (\n).
1220
+ * @param data The data to write to the terminal. This can either be raw
1221
+ * bytes given as Uint8Array from the pty or a string. Raw bytes will always
1222
+ * be treated as UTF-8 encoded, string data as UTF-16.
1223
+ * @param callback Optional callback that fires when the data was processed
1224
+ * by the parser.
1225
+ */
1226
+ writeln(data: string | Uint8Array, callback?: () => void): void;
1227
+
1228
+ /**
1229
+ * Writes text to the terminal, performing the necessary transformations for
1230
+ * pasted text.
1231
+ * @param data The text to write to the terminal.
1232
+ */
1233
+ paste(data: string): void;
1234
+
1235
+ /**
1236
+ * Tells the renderer to refresh terminal content between two rows
1237
+ * (inclusive) at the next opportunity.
1238
+ * @param start The row to start from (between 0 and this.rows - 1).
1239
+ * @param end The row to end at (between start and this.rows - 1).
1240
+ */
1241
+ refresh(start: number, end: number): void;
1242
+
1243
+ /**
1244
+ * Clears the texture atlas of the canvas renderer if it's active. Doing
1245
+ * this will force a redraw of all glyphs which can workaround issues
1246
+ * causing the texture to become corrupt, for example Chromium/Nvidia has an
1247
+ * issue where the texture gets messed up when resuming the OS from sleep.
1248
+ */
1249
+ clearTextureAtlas(): void;
1250
+
1251
+ /**
1252
+ * Perform a full reset (RIS, aka '\x1bc').
1253
+ */
1254
+ reset(): void;
1255
+
1256
+ /**
1257
+ * Loads an addon into this instance of xterm.js.
1258
+ * @param addon The addon to load.
1259
+ */
1260
+ loadAddon(addon: ITerminalAddon): void;
1261
+ }
1262
+
1263
+ /**
1264
+ * An addon that can provide additional functionality to the terminal.
1265
+ */
1266
+ export interface ITerminalAddon extends IDisposable {
1267
+ /**
1268
+ * This is called when the addon is activated.
1269
+ */
1270
+ activate(terminal: Terminal): void;
1271
+ }
1272
+
1273
+ /**
1274
+ * An object representing a range within the viewport of the terminal.
1275
+ */
1276
+ export interface IViewportRange {
1277
+ /**
1278
+ * The start of the range.
1279
+ */
1280
+ start: IViewportRangePosition;
1281
+
1282
+ /**
1283
+ * The end of the range.
1284
+ */
1285
+ end: IViewportRangePosition;
1286
+ }
1287
+
1288
+ /**
1289
+ * An object representing a cell position within the viewport of the terminal.
1290
+ */
1291
+ interface IViewportRangePosition {
1292
+ /**
1293
+ * The x position of the cell. This is a 0-based index that refers to the
1294
+ * space in between columns, not the column itself. Index 0 refers to the
1295
+ * left side of the viewport, index `Terminal.cols` refers to the right side
1296
+ * of the viewport. This can be thought of as how a cursor is positioned in
1297
+ * a text editor.
1298
+ */
1299
+ x: number;
1300
+
1301
+ /**
1302
+ * The y position of the cell. This is a 0-based index that refers to a
1303
+ * specific row.
1304
+ */
1305
+ y: number;
1306
+ }
1307
+
1308
+ /**
1309
+ * A link handler for OSC 8 hyperlinks.
1310
+ */
1311
+ interface ILinkHandler {
1312
+ /**
1313
+ * Calls when the link is activated.
1314
+ * @param event The mouse event triggering the callback.
1315
+ * @param text The text of the link.
1316
+ * @param range The buffer range of the link.
1317
+ */
1318
+ activate(event: MouseEvent, text: string, range: IBufferRange): void;
1319
+
1320
+ /**
1321
+ * Called when the mouse hovers the link. To use this to create a DOM-based
1322
+ * hover tooltip, create the hover element within `Terminal.element` and
1323
+ * add the `xterm-hover` class to it, that will cause mouse events to not
1324
+ * fall through and activate other links.
1325
+ * @param event The mouse event triggering the callback.
1326
+ * @param text The text of the link.
1327
+ * @param range The buffer range of the link.
1328
+ */
1329
+ hover?(event: MouseEvent, text: string, range: IBufferRange): void;
1330
+
1331
+ /**
1332
+ * Called when the mouse leaves the link.
1333
+ * @param event The mouse event triggering the callback.
1334
+ * @param text The text of the link.
1335
+ * @param range The buffer range of the link.
1336
+ */
1337
+ leave?(event: MouseEvent, text: string, range: IBufferRange): void;
1338
+
1339
+ /**
1340
+ * Whether to receive non-HTTP URLs from LinkProvider. When false, any
1341
+ * usage of non-HTTP URLs will be ignored. Enabling this option without
1342
+ * proper protection in `activate` function may cause security issues such
1343
+ * as XSS.
1344
+ */
1345
+ allowNonHttpProtocols?: boolean;
1346
+ }
1347
+
1348
+ /**
1349
+ * A custom link provider.
1350
+ */
1351
+ interface ILinkProvider {
1352
+ /**
1353
+ * Provides a link a buffer position
1354
+ * @param bufferLineNumber The y position of the buffer to check for links
1355
+ * within.
1356
+ * @param callback The callback to be fired when ready with the resulting
1357
+ * link(s) for the line or `undefined`.
1358
+ */
1359
+ provideLinks(bufferLineNumber: number, callback: (links: ILink[] | undefined) => void): void;
1360
+ }
1361
+
1362
+ /**
1363
+ * A link within the terminal.
1364
+ */
1365
+ interface ILink {
1366
+ /**
1367
+ * The buffer range of the link.
1368
+ */
1369
+ range: IBufferRange;
1370
+
1371
+ /**
1372
+ * The text of the link.
1373
+ */
1374
+ text: string;
1375
+
1376
+ /**
1377
+ * What link decorations to show when hovering the link, this property is
1378
+ * tracked and changes made after the link is provided will trigger changes.
1379
+ * If not set, all decroations will be enabled.
1380
+ */
1381
+ decorations?: ILinkDecorations;
1382
+
1383
+ /**
1384
+ * Calls when the link is activated.
1385
+ * @param event The mouse event triggering the callback.
1386
+ * @param text The text of the link.
1387
+ */
1388
+ activate(event: MouseEvent, text: string): void;
1389
+
1390
+ /**
1391
+ * Called when the mouse hovers the link. To use this to create a DOM-based
1392
+ * hover tooltip, create the hover element within `Terminal.element` and add
1393
+ * the `xterm-hover` class to it, that will cause mouse events to not fall
1394
+ * through and activate other links.
1395
+ * @param event The mouse event triggering the callback.
1396
+ * @param text The text of the link.
1397
+ */
1398
+ hover?(event: MouseEvent, text: string): void;
1399
+
1400
+ /**
1401
+ * Called when the mouse leaves the link.
1402
+ * @param event The mouse event triggering the callback.
1403
+ * @param text The text of the link.
1404
+ */
1405
+ leave?(event: MouseEvent, text: string): void;
1406
+
1407
+ /**
1408
+ * Called when the link is released and no longer used by xterm.js.
1409
+ */
1410
+ dispose?(): void;
1411
+ }
1412
+
1413
+ /**
1414
+ * A set of decorations that can be applied to links.
1415
+ */
1416
+ interface ILinkDecorations {
1417
+ /**
1418
+ * Whether the cursor is set to pointer.
1419
+ */
1420
+ pointerCursor: boolean;
1421
+
1422
+ /**
1423
+ * Whether the underline is visible
1424
+ */
1425
+ underline: boolean;
1426
+ }
1427
+
1428
+ /**
1429
+ * A range within a buffer.
1430
+ */
1431
+ interface IBufferRange {
1432
+ /**
1433
+ * The start position of the range.
1434
+ */
1435
+ start: IBufferCellPosition;
1436
+
1437
+ /**
1438
+ * The end position of the range.
1439
+ */
1440
+ end: IBufferCellPosition;
1441
+ }
1442
+
1443
+ /**
1444
+ * A position within a buffer.
1445
+ */
1446
+ interface IBufferCellPosition {
1447
+ /**
1448
+ * The x position within the buffer (1-based).
1449
+ */
1450
+ x: number;
1451
+
1452
+ /**
1453
+ * The y position within the buffer (1-based).
1454
+ */
1455
+ y: number;
1456
+ }
1457
+
1458
+ /**
1459
+ * Represents a terminal buffer.
1460
+ */
1461
+ interface IBuffer {
1462
+ /**
1463
+ * The type of the buffer.
1464
+ */
1465
+ readonly type: 'normal' | 'alternate';
1466
+
1467
+ /**
1468
+ * The y position of the cursor. This ranges between `0` (when the
1469
+ * cursor is at baseY) and `Terminal.rows - 1` (when the cursor is on the
1470
+ * last row).
1471
+ */
1472
+ readonly cursorY: number;
1473
+
1474
+ /**
1475
+ * The x position of the cursor. This ranges between `0` (left side) and
1476
+ * `Terminal.cols` (after last cell of the row).
1477
+ */
1478
+ readonly cursorX: number;
1479
+
1480
+ /**
1481
+ * The line within the buffer where the top of the viewport is.
1482
+ */
1483
+ readonly viewportY: number;
1484
+
1485
+ /**
1486
+ * The line within the buffer where the top of the bottom page is (when
1487
+ * fully scrolled down).
1488
+ */
1489
+ readonly baseY: number;
1490
+
1491
+ /**
1492
+ * The amount of lines in the buffer.
1493
+ */
1494
+ readonly length: number;
1495
+
1496
+ /**
1497
+ * Gets a line from the buffer, or undefined if the line index does not
1498
+ * exist.
1499
+ *
1500
+ * Note that the result of this function should be used immediately after
1501
+ * calling as when the terminal updates it could lead to unexpected
1502
+ * behavior.
1503
+ *
1504
+ * @param y The line index to get.
1505
+ */
1506
+ getLine(y: number): IBufferLine | undefined;
1507
+
1508
+ /**
1509
+ * Creates an empty cell object suitable as a cell reference in
1510
+ * `line.getCell(x, cell)`. Use this to avoid costly recreation of
1511
+ * cell objects when dealing with tons of cells.
1512
+ */
1513
+ getNullCell(): IBufferCell;
1514
+ }
1515
+
1516
+ export interface IBufferElementProvider {
1517
+ /**
1518
+ * Provides a document fragment or HTMLElement containing the buffer
1519
+ * elements.
1520
+ */
1521
+ provideBufferElements(): DocumentFragment | HTMLElement;
1522
+ }
1523
+
1524
+ /**
1525
+ * Represents the terminal's set of buffers.
1526
+ */
1527
+ interface IBufferNamespace {
1528
+ /**
1529
+ * The active buffer, this will either be the normal or alternate buffers.
1530
+ */
1531
+ readonly active: IBuffer;
1532
+
1533
+ /**
1534
+ * The normal buffer.
1535
+ */
1536
+ readonly normal: IBuffer;
1537
+
1538
+ /**
1539
+ * The alternate buffer, this becomes the active buffer when an application
1540
+ * enters this mode via DECSET (`CSI ? 4 7 h`)
1541
+ */
1542
+ readonly alternate: IBuffer;
1543
+
1544
+ /**
1545
+ * Adds an event listener for when the active buffer changes.
1546
+ * @returns an `IDisposable` to stop listening.
1547
+ */
1548
+ onBufferChange: IEvent<IBuffer>;
1549
+ }
1550
+
1551
+ /**
1552
+ * Represents a line in the terminal's buffer.
1553
+ */
1554
+ interface IBufferLine {
1555
+ /**
1556
+ * Whether the line is wrapped from the previous line.
1557
+ */
1558
+ readonly isWrapped: boolean;
1559
+
1560
+ /**
1561
+ * The length of the line, all call to getCell beyond the length will result
1562
+ * in `undefined`. Note that this may exceed columns as the line array may
1563
+ * not be trimmed after a resize, compare against {@link Terminal.cols} to
1564
+ * get the actual maximum length of a line.
1565
+ */
1566
+ readonly length: number;
1567
+
1568
+ /**
1569
+ * Gets a cell from the line, or undefined if the line index does not exist.
1570
+ *
1571
+ * Note that the result of this function should be used immediately after
1572
+ * calling as when the terminal updates it could lead to unexpected
1573
+ * behavior.
1574
+ *
1575
+ * @param x The character index to get.
1576
+ * @param cell Optional cell object to load data into for performance
1577
+ * reasons. This is mainly useful when every cell in the buffer is being
1578
+ * looped over to avoid creating new objects for every cell.
1579
+ */
1580
+ getCell(x: number, cell?: IBufferCell): IBufferCell | undefined;
1581
+
1582
+ /**
1583
+ * Gets the line as a string. Note that this is gets only the string for the
1584
+ * line, not taking isWrapped into account.
1585
+ *
1586
+ * @param trimRight Whether to trim any whitespace at the right of the line.
1587
+ * @param startColumn The column to start from (inclusive).
1588
+ * @param endColumn The column to end at (exclusive).
1589
+ */
1590
+ translateToString(trimRight?: boolean, startColumn?: number, endColumn?: number): string;
1591
+ }
1592
+
1593
+ /**
1594
+ * Represents a single cell in the terminal's buffer.
1595
+ */
1596
+ interface IBufferCell {
1597
+ /**
1598
+ * The width of the character. Some examples:
1599
+ *
1600
+ * - `1` for most cells.
1601
+ * - `2` for wide character like CJK glyphs.
1602
+ * - `0` for cells immediately following cells with a width of `2`.
1603
+ */
1604
+ getWidth(): number;
1605
+
1606
+ /**
1607
+ * The character(s) within the cell. Examples of what this can contain:
1608
+ *
1609
+ * - A normal width character
1610
+ * - A wide character (eg. CJK)
1611
+ * - An emoji
1612
+ */
1613
+ getChars(): string;
1614
+
1615
+ /**
1616
+ * Gets the UTF32 codepoint of single characters, if content is a combined
1617
+ * string it returns the codepoint of the last character in the string.
1618
+ */
1619
+ getCode(): number;
1620
+
1621
+ /**
1622
+ * Gets the number representation of the foreground color mode, this can be
1623
+ * used to perform quick comparisons of 2 cells to see if they're the same.
1624
+ * Use `isFgRGB`, `isFgPalette` and `isFgDefault` to check what color mode
1625
+ * a cell is.
1626
+ */
1627
+ getFgColorMode(): number;
1628
+
1629
+ /**
1630
+ * Gets the number representation of the background color mode, this can be
1631
+ * used to perform quick comparisons of 2 cells to see if they're the same.
1632
+ * Use `isBgRGB`, `isBgPalette` and `isBgDefault` to check what color mode
1633
+ * a cell is.
1634
+ */
1635
+ getBgColorMode(): number;
1636
+
1637
+ /**
1638
+ * Gets a cell's foreground color number, this differs depending on what the
1639
+ * color mode of the cell is:
1640
+ *
1641
+ * - Default: This should be 0, representing the default foreground color
1642
+ * (CSI 39 m).
1643
+ * - Palette: This is a number from 0 to 255 of ANSI colors (CSI 3(0-7) m,
1644
+ * CSI 9(0-7) m, CSI 38 ; 5 ; 0-255 m).
1645
+ * - RGB: A hex value representing a 'true color': 0xRRGGBB.
1646
+ * (CSI 3 8 ; 2 ; Pi ; Pr ; Pg ; Pb)
1647
+ */
1648
+ getFgColor(): number;
1649
+
1650
+ /**
1651
+ * Gets a cell's background color number, this differs depending on what the
1652
+ * color mode of the cell is:
1653
+ *
1654
+ * - Default: This should be 0, representing the default background color
1655
+ * (CSI 49 m).
1656
+ * - Palette: This is a number from 0 to 255 of ANSI colors
1657
+ * (CSI 4(0-7) m, CSI 10(0-7) m, CSI 48 ; 5 ; 0-255 m).
1658
+ * - RGB: A hex value representing a 'true color': 0xRRGGBB
1659
+ * (CSI 4 8 ; 2 ; Pi ; Pr ; Pg ; Pb)
1660
+ */
1661
+ getBgColor(): number;
1662
+
1663
+ /** Whether the cell has the bold attribute (CSI 1 m). */
1664
+ isBold(): number;
1665
+ /** Whether the cell has the italic attribute (CSI 3 m). */
1666
+ isItalic(): number;
1667
+ /** Whether the cell has the dim attribute (CSI 2 m). */
1668
+ isDim(): number;
1669
+ /** Whether the cell has the underline attribute (CSI 4 m). */
1670
+ isUnderline(): number;
1671
+ /** Whether the cell has the blink attribute (CSI 5 m). */
1672
+ isBlink(): number;
1673
+ /** Whether the cell has the inverse attribute (CSI 7 m). */
1674
+ isInverse(): number;
1675
+ /** Whether the cell has the invisible attribute (CSI 8 m). */
1676
+ isInvisible(): number;
1677
+ /** Whether the cell has the strikethrough attribute (CSI 9 m). */
1678
+ isStrikethrough(): number;
1679
+ /** Whether the cell has the overline attribute (CSI 53 m). */
1680
+ isOverline(): number;
1681
+
1682
+ /** Whether the cell is using the RGB foreground color mode. */
1683
+ isFgRGB(): boolean;
1684
+ /** Whether the cell is using the RGB background color mode. */
1685
+ isBgRGB(): boolean;
1686
+ /** Whether the cell is using the palette foreground color mode. */
1687
+ isFgPalette(): boolean;
1688
+ /** Whether the cell is using the palette background color mode. */
1689
+ isBgPalette(): boolean;
1690
+ /** Whether the cell is using the default foreground color mode. */
1691
+ isFgDefault(): boolean;
1692
+ /** Whether the cell is using the default background color mode. */
1693
+ isBgDefault(): boolean;
1694
+
1695
+ /** Whether the cell has the default attribute (no color or style). */
1696
+ isAttributeDefault(): boolean;
1697
+ }
1698
+
1699
+ /**
1700
+ * Data type to register a CSI, DCS or ESC callback in the parser
1701
+ * in the form:
1702
+ * ESC I..I F
1703
+ * CSI Prefix P..P I..I F
1704
+ * DCS Prefix P..P I..I F data_bytes ST
1705
+ *
1706
+ * with these rules/restrictions:
1707
+ * - prefix can only be used with CSI and DCS
1708
+ * - only one leading prefix byte is recognized by the parser
1709
+ * before any other parameter bytes (P..P)
1710
+ * - intermediate bytes are recognized up to 2
1711
+ *
1712
+ * For custom sequences make sure to read ECMA-48 and the resources at
1713
+ * vt100.net to not clash with existing sequences or reserved address space.
1714
+ * General recommendations:
1715
+ * - use private address space (see ECMA-48)
1716
+ * - use max one intermediate byte (technically not limited by the spec,
1717
+ * in practice there are no sequences with more than one intermediate byte,
1718
+ * thus parsers might get confused with more intermediates)
1719
+ * - test against other common emulators to check whether they escape/ignore
1720
+ * the sequence correctly
1721
+ *
1722
+ * Notes: OSC command registration is handled differently (see addOscHandler)
1723
+ * APC, PM or SOS is currently not supported.
1724
+ */
1725
+ export interface IFunctionIdentifier {
1726
+ /**
1727
+ * Optional prefix byte, must be in range \x3c .. \x3f.
1728
+ * Usable in CSI and DCS.
1729
+ */
1730
+ prefix?: string;
1731
+ /**
1732
+ * Optional intermediate bytes, must be in range \x20 .. \x2f.
1733
+ * Usable in CSI, DCS and ESC.
1734
+ */
1735
+ intermediates?: string;
1736
+ /**
1737
+ * Final byte, must be in range \x40 .. \x7e for CSI and DCS,
1738
+ * \x30 .. \x7e for ESC.
1739
+ */
1740
+ final: string;
1741
+ }
1742
+
1743
+ /**
1744
+ * Allows hooking into the parser for custom handling of escape sequences.
1745
+ *
1746
+ * Note on sync vs. async handlers:
1747
+ * xterm.js implements all parser actions with synchronous handlers.
1748
+ * In general custom handlers should also operate in sync mode wherever
1749
+ * possible to keep the parser fast.
1750
+ * Still the exposed interfaces allow to register async handlers by returning
1751
+ * a `Promise<boolean>`. Here the parser will pause input processing until
1752
+ * the promise got resolved or rejected (in-band blocking). This "full stop"
1753
+ * on the input chain allows to implement backpressure from a certain async
1754
+ * action while the terminal state will not progress any further from input.
1755
+ * It does not mean that the terminal state will not change at all in between,
1756
+ * as user actions like resize or reset are still processed immediately.
1757
+ * It is an error to assume a stable terminal state while giving back control
1758
+ * in between, e.g. by multiple chained `then` calls.
1759
+ * Downside of an async handler is a rather bad throughput performance,
1760
+ * thus use async handlers only as a last resort or for actions that have
1761
+ * to rely on async interfaces itself.
1762
+ */
1763
+ export interface IParser {
1764
+ /**
1765
+ * Adds a handler for CSI escape sequences.
1766
+ * @param id Specifies the function identifier under which the callback gets
1767
+ * registered, e.g. {final: 'm'} for SGR.
1768
+ * @param callback The function to handle the sequence. The callback is
1769
+ * called with the numerical params. If the sequence has subparams the array
1770
+ * will contain subarrays with their numercial values. Return `true` if the
1771
+ * sequence was handled, `false` if the parser should try a previous
1772
+ * handler. The most recently added handler is tried first.
1773
+ * @returns An IDisposable you can call to remove this handler.
1774
+ */
1775
+ registerCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean | Promise<boolean>): IDisposable;
1776
+
1777
+ /**
1778
+ * Adds a handler for DCS escape sequences.
1779
+ * @param id Specifies the function identifier under which the callback gets
1780
+ * registered, e.g. {intermediates: '$' final: 'q'} for DECRQSS.
1781
+ * @param callback The function to handle the sequence. Note that the
1782
+ * function will only be called once if the sequence finished sucessfully.
1783
+ * There is currently no way to intercept smaller data chunks, data chunks
1784
+ * will be stored up until the sequence is finished. Since DCS sequences are
1785
+ * not limited by the amount of data this might impose a problem for big
1786
+ * payloads. Currently xterm.js limits DCS payload to 10 MB which should
1787
+ * give enough room for most use cases. The function gets the payload and
1788
+ * numerical parameters as arguments. Return `true` if the sequence was
1789
+ * handled, `false` if the parser should try a previous handler. The most
1790
+ * recently added handler is tried first.
1791
+ * @returns An IDisposable you can call to remove this handler.
1792
+ */
1793
+ registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean | Promise<boolean>): IDisposable;
1794
+
1795
+ /**
1796
+ * Adds a handler for ESC escape sequences.
1797
+ * @param id Specifies the function identifier under which the callback gets
1798
+ * registered, e.g. {intermediates: '%' final: 'G'} for default charset
1799
+ * selection.
1800
+ * @param callback The function to handle the sequence.
1801
+ * Return `true` if the sequence was handled, `false` if the parser should
1802
+ * try a previous handler. The most recently added handler is tried first.
1803
+ * @returns An IDisposable you can call to remove this handler.
1804
+ */
1805
+ registerEscHandler(id: IFunctionIdentifier, handler: () => boolean | Promise<boolean>): IDisposable;
1806
+
1807
+ /**
1808
+ * Adds a handler for OSC escape sequences.
1809
+ * @param ident The number (first parameter) of the sequence.
1810
+ * @param callback The function to handle the sequence. Note that the
1811
+ * function will only be called once if the sequence finished sucessfully.
1812
+ * There is currently no way to intercept smaller data chunks, data chunks
1813
+ * will be stored up until the sequence is finished. Since OSC sequences are
1814
+ * not limited by the amount of data this might impose a problem for big
1815
+ * payloads. Currently xterm.js limits OSC payload to 10 MB which should
1816
+ * give enough room for most use cases. The callback is called with OSC data
1817
+ * string. Return `true` if the sequence was handled, `false` if the parser
1818
+ * should try a previous handler. The most recently added handler is tried
1819
+ * first.
1820
+ * @returns An IDisposable you can call to remove this handler.
1821
+ */
1822
+ registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
1823
+ }
1824
+
1825
+ /**
1826
+ * (EXPERIMENTAL) Unicode version provider.
1827
+ * Used to register custom Unicode versions with `Terminal.unicode.register`.
1828
+ */
1829
+ export interface IUnicodeVersionProvider {
1830
+ /**
1831
+ * String indicating the Unicode version provided.
1832
+ */
1833
+ readonly version: string;
1834
+
1835
+ /**
1836
+ * Unicode version dependent wcwidth implementation.
1837
+ */
1838
+ wcwidth(codepoint: number): 0 | 1 | 2;
1839
+ charProperties(codepoint: number, preceding: number): number;
1840
+ }
1841
+
1842
+ /**
1843
+ * (EXPERIMENTAL) Unicode handling interface.
1844
+ */
1845
+ export interface IUnicodeHandling {
1846
+ /**
1847
+ * Register a custom Unicode version provider.
1848
+ */
1849
+ register(provider: IUnicodeVersionProvider): void;
1850
+
1851
+ /**
1852
+ * Registered Unicode versions.
1853
+ */
1854
+ readonly versions: ReadonlyArray<string>;
1855
+
1856
+ /**
1857
+ * Getter/setter for active Unicode version.
1858
+ */
1859
+ activeVersion: string;
1860
+ }
1861
+
1862
+ /**
1863
+ * Terminal modes as set by SM/DECSET.
1864
+ */
1865
+ export interface IModes {
1866
+ /**
1867
+ * Application Cursor Keys (DECCKM): `CSI ? 1 h`
1868
+ */
1869
+ readonly applicationCursorKeysMode: boolean;
1870
+ /**
1871
+ * Application Keypad Mode (DECNKM): `CSI ? 6 6 h`
1872
+ */
1873
+ readonly applicationKeypadMode: boolean;
1874
+ /**
1875
+ * Bracketed Paste Mode: `CSI ? 2 0 0 4 h`
1876
+ */
1877
+ readonly bracketedPasteMode: boolean;
1878
+ /**
1879
+ * Insert Mode (IRM): `CSI 4 h`
1880
+ */
1881
+ readonly insertMode: boolean;
1882
+ /**
1883
+ * Mouse Tracking, this can be one of the following:
1884
+ * - none: This is the default value and can be reset with DECRST
1885
+ * - x10: Send Mouse X & Y on button press `CSI ? 9 h`
1886
+ * - vt200: Send Mouse X & Y on button press and release `CSI ? 1 0 0 0 h`
1887
+ * - drag: Use Cell Motion Mouse Tracking `CSI ? 1 0 0 2 h`
1888
+ * - any: Use All Motion Mouse Tracking `CSI ? 1 0 0 3 h`
1889
+ */
1890
+ readonly mouseTrackingMode: 'none' | 'x10' | 'vt200' | 'drag' | 'any';
1891
+ /**
1892
+ * Origin Mode (DECOM): `CSI ? 6 h`
1893
+ */
1894
+ readonly originMode: boolean;
1895
+ /**
1896
+ * Reverse-wraparound Mode: `CSI ? 4 5 h`
1897
+ */
1898
+ readonly reverseWraparoundMode: boolean;
1899
+ /**
1900
+ * Send FocusIn/FocusOut events: `CSI ? 1 0 0 4 h`
1901
+ */
1902
+ readonly sendFocusMode: boolean;
1903
+ /**
1904
+ * Auto-Wrap Mode (DECAWM): `CSI ? 7 h`
1905
+ */
1906
+ readonly wraparoundMode: boolean;
1907
+ }
1908
+ }