@xterm/xterm 5.6.0-beta.7 → 5.6.0-beta.70

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 (118) hide show
  1. package/README.md +6 -3
  2. package/css/xterm.css +71 -4
  3. package/lib/xterm.js +1 -1
  4. package/lib/xterm.js.map +1 -1
  5. package/lib/xterm.mjs +53 -0
  6. package/lib/xterm.mjs.map +7 -0
  7. package/package.json +43 -33
  8. package/src/browser/AccessibilityManager.ts +53 -25
  9. package/src/browser/{Terminal.ts → CoreBrowserTerminal.ts} +135 -146
  10. package/src/browser/Linkifier.ts +26 -14
  11. package/src/browser/LocalizableStrings.ts +15 -4
  12. package/src/browser/{Types.d.ts → Types.ts} +67 -15
  13. package/src/browser/Viewport.ts +143 -370
  14. package/src/browser/decorations/BufferDecorationRenderer.ts +14 -9
  15. package/src/browser/decorations/OverviewRulerRenderer.ts +40 -44
  16. package/src/browser/public/Terminal.ts +25 -19
  17. package/src/browser/renderer/dom/DomRenderer.ts +14 -16
  18. package/src/browser/renderer/shared/CharAtlasUtils.ts +4 -0
  19. package/src/browser/renderer/shared/CustomGlyphs.ts +6 -0
  20. package/src/browser/renderer/shared/DevicePixelObserver.ts +1 -2
  21. package/src/browser/renderer/shared/TextureAtlas.ts +3 -3
  22. package/src/browser/renderer/shared/{Types.d.ts → Types.ts} +4 -4
  23. package/src/browser/services/CharSizeService.ts +6 -6
  24. package/src/browser/services/CoreBrowserService.ts +15 -15
  25. package/src/browser/services/LinkProviderService.ts +2 -2
  26. package/src/browser/services/RenderService.ts +20 -20
  27. package/src/browser/services/SelectionService.ts +8 -8
  28. package/src/browser/services/Services.ts +13 -13
  29. package/src/browser/services/ThemeService.ts +17 -56
  30. package/src/browser/shared/Constants.ts +8 -0
  31. package/src/common/CircularList.ts +5 -5
  32. package/src/common/CoreTerminal.ts +35 -41
  33. package/src/common/InputHandler.ts +34 -28
  34. package/src/common/{Types.d.ts → Types.ts} +11 -17
  35. package/src/common/buffer/Buffer.ts +5 -1
  36. package/src/common/buffer/BufferSet.ts +5 -5
  37. package/src/common/buffer/Marker.ts +4 -4
  38. package/src/common/buffer/{Types.d.ts → Types.ts} +2 -2
  39. package/src/common/input/WriteBuffer.ts +3 -3
  40. package/src/common/parser/EscapeSequenceParser.ts +4 -4
  41. package/src/common/public/BufferNamespaceApi.ts +3 -3
  42. package/src/common/services/BufferService.ts +7 -7
  43. package/src/common/services/CoreMouseService.ts +5 -3
  44. package/src/common/services/CoreService.ts +6 -6
  45. package/src/common/services/DecorationService.ts +8 -9
  46. package/src/common/services/LogService.ts +2 -2
  47. package/src/common/services/OptionsService.ts +5 -5
  48. package/src/common/services/Services.ts +24 -17
  49. package/src/common/services/UnicodeService.ts +2 -2
  50. package/src/vs/base/browser/browser.ts +141 -0
  51. package/src/vs/base/browser/canIUse.ts +49 -0
  52. package/src/vs/base/browser/dom.ts +2369 -0
  53. package/src/vs/base/browser/fastDomNode.ts +316 -0
  54. package/src/vs/base/browser/globalPointerMoveMonitor.ts +112 -0
  55. package/src/vs/base/browser/iframe.ts +135 -0
  56. package/src/vs/base/browser/keyboardEvent.ts +213 -0
  57. package/src/vs/base/browser/mouseEvent.ts +229 -0
  58. package/src/vs/base/browser/touch.ts +372 -0
  59. package/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +303 -0
  60. package/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +114 -0
  61. package/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +720 -0
  62. package/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +165 -0
  63. package/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +114 -0
  64. package/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +243 -0
  65. package/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +118 -0
  66. package/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +116 -0
  67. package/src/vs/base/browser/ui/widget.ts +57 -0
  68. package/src/vs/base/browser/window.ts +14 -0
  69. package/src/vs/base/common/arrays.ts +887 -0
  70. package/src/vs/base/common/arraysFind.ts +202 -0
  71. package/src/vs/base/common/assert.ts +71 -0
  72. package/src/vs/base/common/async.ts +1992 -0
  73. package/src/vs/base/common/cancellation.ts +148 -0
  74. package/src/vs/base/common/charCode.ts +450 -0
  75. package/src/vs/base/common/collections.ts +140 -0
  76. package/src/vs/base/common/decorators.ts +130 -0
  77. package/src/vs/base/common/equals.ts +146 -0
  78. package/src/vs/base/common/errors.ts +303 -0
  79. package/src/vs/base/common/event.ts +1778 -0
  80. package/src/vs/base/common/functional.ts +32 -0
  81. package/src/vs/base/common/hash.ts +316 -0
  82. package/src/vs/base/common/iterator.ts +159 -0
  83. package/src/vs/base/common/keyCodes.ts +526 -0
  84. package/src/vs/base/common/keybindings.ts +284 -0
  85. package/src/vs/base/common/lazy.ts +47 -0
  86. package/src/vs/base/common/lifecycle.ts +801 -0
  87. package/src/vs/base/common/linkedList.ts +142 -0
  88. package/src/vs/base/common/map.ts +202 -0
  89. package/src/vs/base/common/numbers.ts +98 -0
  90. package/src/vs/base/common/observable.ts +76 -0
  91. package/src/vs/base/common/observableInternal/api.ts +31 -0
  92. package/src/vs/base/common/observableInternal/autorun.ts +281 -0
  93. package/src/vs/base/common/observableInternal/base.ts +489 -0
  94. package/src/vs/base/common/observableInternal/debugName.ts +145 -0
  95. package/src/vs/base/common/observableInternal/derived.ts +428 -0
  96. package/src/vs/base/common/observableInternal/lazyObservableValue.ts +146 -0
  97. package/src/vs/base/common/observableInternal/logging.ts +328 -0
  98. package/src/vs/base/common/observableInternal/promise.ts +209 -0
  99. package/src/vs/base/common/observableInternal/utils.ts +610 -0
  100. package/src/vs/base/common/platform.ts +281 -0
  101. package/src/vs/base/common/scrollable.ts +522 -0
  102. package/src/vs/base/common/sequence.ts +34 -0
  103. package/src/vs/base/common/stopwatch.ts +43 -0
  104. package/src/vs/base/common/strings.ts +557 -0
  105. package/src/vs/base/common/symbols.ts +9 -0
  106. package/src/vs/base/common/uint.ts +59 -0
  107. package/src/vs/patches/nls.ts +90 -0
  108. package/src/vs/typings/base-common.d.ts +20 -0
  109. package/src/vs/typings/require.d.ts +42 -0
  110. package/src/vs/typings/thenable.d.ts +12 -0
  111. package/src/vs/typings/vscode-globals-nls.d.ts +36 -0
  112. package/src/vs/typings/vscode-globals-product.d.ts +33 -0
  113. package/typings/xterm.d.ts +59 -15
  114. package/src/browser/Lifecycle.ts +0 -33
  115. package/src/common/EventEmitter.ts +0 -78
  116. package/src/common/Lifecycle.ts +0 -108
  117. /package/src/browser/selection/{Types.d.ts → Types.ts} +0 -0
  118. /package/src/common/parser/{Types.d.ts → Types.ts} +0 -0
@@ -0,0 +1,281 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+
6
+ import * as nls from 'vs/nls';
7
+
8
+ export const LANGUAGE_DEFAULT = 'en';
9
+
10
+ let _isWindows = false;
11
+ let _isMacintosh = false;
12
+ let _isLinux = false;
13
+ let _isLinuxSnap = false;
14
+ let _isNative = false;
15
+ let _isWeb = false;
16
+ let _isElectron = false;
17
+ let _isIOS = false;
18
+ let _isCI = false;
19
+ let _isMobile = false;
20
+ let _locale: string | undefined = undefined;
21
+ let _language: string = LANGUAGE_DEFAULT;
22
+ let _platformLocale: string = LANGUAGE_DEFAULT;
23
+ let _translationsConfigFile: string | undefined = undefined;
24
+ let _userAgent: string | undefined = undefined;
25
+
26
+ export interface IProcessEnvironment {
27
+ [key: string]: string | undefined;
28
+ }
29
+
30
+ /**
31
+ * This interface is intentionally not identical to node.js
32
+ * process because it also works in sandboxed environments
33
+ * where the process object is implemented differently. We
34
+ * define the properties here that we need for `platform`
35
+ * to work and nothing else.
36
+ */
37
+ export interface INodeProcess {
38
+ platform: string;
39
+ arch: string;
40
+ env: IProcessEnvironment;
41
+ versions?: {
42
+ node?: string;
43
+ electron?: string;
44
+ chrome?: string;
45
+ };
46
+ type?: string;
47
+ cwd: () => string;
48
+ }
49
+
50
+ declare const process: INodeProcess;
51
+
52
+ const $globalThis: any = globalThis;
53
+
54
+ let nodeProcess: INodeProcess | undefined = undefined;
55
+ if (typeof $globalThis.vscode !== 'undefined' && typeof $globalThis.vscode.process !== 'undefined') {
56
+ // Native environment (sandboxed)
57
+ nodeProcess = $globalThis.vscode.process;
58
+ } else if (typeof process !== 'undefined' && typeof process?.versions?.node === 'string') {
59
+ // Native environment (non-sandboxed)
60
+ nodeProcess = process;
61
+ }
62
+
63
+ const isElectronProcess = typeof nodeProcess?.versions?.electron === 'string';
64
+ const isElectronRenderer = isElectronProcess && nodeProcess?.type === 'renderer';
65
+
66
+ interface INavigator {
67
+ userAgent: string;
68
+ maxTouchPoints?: number;
69
+ language: string;
70
+ }
71
+ declare const navigator: INavigator;
72
+
73
+ // Native environment
74
+ if (typeof nodeProcess === 'object') {
75
+ _isWindows = (nodeProcess.platform === 'win32');
76
+ _isMacintosh = (nodeProcess.platform === 'darwin');
77
+ _isLinux = (nodeProcess.platform === 'linux');
78
+ _isLinuxSnap = _isLinux && !!nodeProcess.env['SNAP'] && !!nodeProcess.env['SNAP_REVISION'];
79
+ _isElectron = isElectronProcess;
80
+ _isCI = !!nodeProcess.env['CI'] || !!nodeProcess.env['BUILD_ARTIFACTSTAGINGDIRECTORY'];
81
+ _locale = LANGUAGE_DEFAULT;
82
+ _language = LANGUAGE_DEFAULT;
83
+ const rawNlsConfig = nodeProcess.env['VSCODE_NLS_CONFIG'];
84
+ if (rawNlsConfig) {
85
+ try {
86
+ const nlsConfig: nls.INLSConfiguration = JSON.parse(rawNlsConfig);
87
+ _locale = nlsConfig.userLocale;
88
+ _platformLocale = nlsConfig.osLocale;
89
+ _language = nlsConfig.resolvedLanguage || LANGUAGE_DEFAULT;
90
+ _translationsConfigFile = nlsConfig.languagePack?.translationsConfigFile;
91
+ } catch (e) {
92
+ }
93
+ }
94
+ _isNative = true;
95
+ }
96
+
97
+ // Web environment
98
+ else if (typeof navigator === 'object' && !isElectronRenderer) {
99
+ _userAgent = navigator.userAgent;
100
+ _isWindows = _userAgent.indexOf('Windows') >= 0;
101
+ _isMacintosh = _userAgent.indexOf('Macintosh') >= 0;
102
+ _isIOS = (_userAgent.indexOf('Macintosh') >= 0 || _userAgent.indexOf('iPad') >= 0 || _userAgent.indexOf('iPhone') >= 0) && !!navigator.maxTouchPoints && navigator.maxTouchPoints > 0;
103
+ _isLinux = _userAgent.indexOf('Linux') >= 0;
104
+ _isMobile = _userAgent?.indexOf('Mobi') >= 0;
105
+ _isWeb = true;
106
+ // VSCODE_GLOBALS: NLS
107
+ _language = globalThis._VSCODE_NLS_LANGUAGE || LANGUAGE_DEFAULT;
108
+ _locale = navigator.language.toLowerCase();
109
+ _platformLocale = _locale;
110
+ }
111
+
112
+ // Unknown environment
113
+ else {
114
+ console.error('Unable to resolve platform.');
115
+ }
116
+
117
+ export const enum Platform {
118
+ Web,
119
+ Mac,
120
+ Linux,
121
+ Windows
122
+ }
123
+ export type PlatformName = 'Web' | 'Windows' | 'Mac' | 'Linux';
124
+
125
+ export function PlatformToString(platform: Platform): PlatformName {
126
+ switch (platform) {
127
+ case Platform.Web: return 'Web';
128
+ case Platform.Mac: return 'Mac';
129
+ case Platform.Linux: return 'Linux';
130
+ case Platform.Windows: return 'Windows';
131
+ }
132
+ }
133
+
134
+ let _platform: Platform = Platform.Web;
135
+ if (_isMacintosh) {
136
+ _platform = Platform.Mac;
137
+ } else if (_isWindows) {
138
+ _platform = Platform.Windows;
139
+ } else if (_isLinux) {
140
+ _platform = Platform.Linux;
141
+ }
142
+
143
+ export const isWindows = _isWindows;
144
+ export const isMacintosh = _isMacintosh;
145
+ export const isLinux = _isLinux;
146
+ export const isLinuxSnap = _isLinuxSnap;
147
+ export const isNative = _isNative;
148
+ export const isElectron = _isElectron;
149
+ export const isWeb = _isWeb;
150
+ export const isWebWorker = (_isWeb && typeof $globalThis.importScripts === 'function');
151
+ export const webWorkerOrigin = isWebWorker ? $globalThis.origin : undefined;
152
+ export const isIOS = _isIOS;
153
+ export const isMobile = _isMobile;
154
+ /**
155
+ * Whether we run inside a CI environment, such as
156
+ * GH actions or Azure Pipelines.
157
+ */
158
+ export const isCI = _isCI;
159
+ export const platform = _platform;
160
+ export const userAgent = _userAgent;
161
+
162
+ /**
163
+ * The language used for the user interface. The format of
164
+ * the string is all lower case (e.g. zh-tw for Traditional
165
+ * Chinese or de for German)
166
+ */
167
+ export const language = _language;
168
+
169
+ export namespace Language {
170
+
171
+ export function value(): string {
172
+ return language;
173
+ }
174
+
175
+ export function isDefaultVariant(): boolean {
176
+ if (language.length === 2) {
177
+ return language === 'en';
178
+ } else if (language.length >= 3) {
179
+ return language[0] === 'e' && language[1] === 'n' && language[2] === '-';
180
+ } else {
181
+ return false;
182
+ }
183
+ }
184
+
185
+ export function isDefault(): boolean {
186
+ return language === 'en';
187
+ }
188
+ }
189
+
190
+ /**
191
+ * Desktop: The OS locale or the locale specified by --locale or `argv.json`.
192
+ * Web: matches `platformLocale`.
193
+ *
194
+ * The UI is not necessarily shown in the provided locale.
195
+ */
196
+ export const locale = _locale;
197
+
198
+ /**
199
+ * This will always be set to the OS/browser's locale regardless of
200
+ * what was specified otherwise. The format of the string is all
201
+ * lower case (e.g. zh-tw for Traditional Chinese). The UI is not
202
+ * necessarily shown in the provided locale.
203
+ */
204
+ export const platformLocale = _platformLocale;
205
+
206
+ /**
207
+ * The translations that are available through language packs.
208
+ */
209
+ export const translationsConfigFile = _translationsConfigFile;
210
+
211
+ export const setTimeout0IsFaster = (typeof $globalThis.postMessage === 'function' && !$globalThis.importScripts);
212
+
213
+ /**
214
+ * See https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#:~:text=than%204%2C%20then-,set%20timeout%20to%204,-.
215
+ *
216
+ * Works similarly to `setTimeout(0)` but doesn't suffer from the 4ms artificial delay
217
+ * that browsers set when the nesting level is > 5.
218
+ */
219
+ export const setTimeout0 = (() => {
220
+ if (setTimeout0IsFaster) {
221
+ interface IQueueElement {
222
+ id: number;
223
+ callback: () => void;
224
+ }
225
+ const pending: IQueueElement[] = [];
226
+
227
+ $globalThis.addEventListener('message', (e: any) => {
228
+ if (e.data && e.data.vscodeScheduleAsyncWork) {
229
+ for (let i = 0, len = pending.length; i < len; i++) {
230
+ const candidate = pending[i];
231
+ if (candidate.id === e.data.vscodeScheduleAsyncWork) {
232
+ pending.splice(i, 1);
233
+ candidate.callback();
234
+ return;
235
+ }
236
+ }
237
+ }
238
+ });
239
+ let lastId = 0;
240
+ return (callback: () => void) => {
241
+ const myId = ++lastId;
242
+ pending.push({
243
+ id: myId,
244
+ callback: callback
245
+ });
246
+ $globalThis.postMessage({ vscodeScheduleAsyncWork: myId }, '*');
247
+ };
248
+ }
249
+ return (callback: () => void) => setTimeout(callback);
250
+ })();
251
+
252
+ export const enum OperatingSystem {
253
+ Windows = 1,
254
+ Macintosh = 2,
255
+ Linux = 3
256
+ }
257
+ export const OS = (_isMacintosh || _isIOS ? OperatingSystem.Macintosh : (_isWindows ? OperatingSystem.Windows : OperatingSystem.Linux));
258
+
259
+ let _isLittleEndian = true;
260
+ let _isLittleEndianComputed = false;
261
+ export function isLittleEndian(): boolean {
262
+ if (!_isLittleEndianComputed) {
263
+ _isLittleEndianComputed = true;
264
+ const test = new Uint8Array(2);
265
+ test[0] = 1;
266
+ test[1] = 2;
267
+ const view = new Uint16Array(test.buffer);
268
+ _isLittleEndian = (view[0] === (2 << 8) + 1);
269
+ }
270
+ return _isLittleEndian;
271
+ }
272
+
273
+ export const isChrome = !!(userAgent && userAgent.indexOf('Chrome') >= 0);
274
+ export const isFirefox = !!(userAgent && userAgent.indexOf('Firefox') >= 0);
275
+ export const isSafari = !!(!isChrome && (userAgent && userAgent.indexOf('Safari') >= 0));
276
+ export const isEdge = !!(userAgent && userAgent.indexOf('Edg/') >= 0);
277
+ export const isAndroid = !!(userAgent && userAgent.indexOf('Android') >= 0);
278
+
279
+ export function isBigSurOrNewer(osVersion: string): boolean {
280
+ return parseFloat(osVersion) >= 20;
281
+ }