@codingame/monaco-vscode-api 3.1.1 → 3.2.0

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