@xterm/xterm 5.6.0-beta.9 → 5.6.0-beta.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/css/xterm.css +71 -4
- package/lib/xterm.js +1 -1
- package/lib/xterm.js.map +1 -1
- package/lib/xterm.mjs +53 -0
- package/lib/xterm.mjs.map +7 -0
- package/package.json +43 -33
- package/src/browser/AccessibilityManager.ts +53 -25
- package/src/browser/{Terminal.ts → CoreBrowserTerminal.ts} +139 -148
- package/src/browser/Linkifier.ts +26 -14
- package/src/browser/LocalizableStrings.ts +15 -4
- package/src/browser/{Types.d.ts → Types.ts} +67 -15
- package/src/browser/Viewport.ts +143 -370
- package/src/browser/decorations/BufferDecorationRenderer.ts +14 -9
- package/src/browser/decorations/OverviewRulerRenderer.ts +40 -44
- package/src/browser/input/CompositionHelper.ts +2 -1
- package/src/browser/public/Terminal.ts +25 -19
- package/src/browser/renderer/dom/DomRenderer.ts +19 -14
- package/src/browser/renderer/dom/DomRendererRowFactory.ts +35 -15
- package/src/browser/renderer/shared/CharAtlasCache.ts +3 -2
- package/src/browser/renderer/shared/CharAtlasUtils.ts +6 -1
- package/src/browser/renderer/shared/CustomGlyphs.ts +6 -0
- package/src/browser/renderer/shared/DevicePixelObserver.ts +1 -2
- package/src/browser/renderer/shared/TextureAtlas.ts +45 -12
- package/src/browser/renderer/shared/{Types.d.ts → Types.ts} +7 -6
- package/src/browser/services/CharSizeService.ts +6 -6
- package/src/browser/services/CoreBrowserService.ts +15 -15
- package/src/browser/services/LinkProviderService.ts +2 -2
- package/src/browser/services/RenderService.ts +20 -20
- package/src/browser/services/SelectionService.ts +8 -8
- package/src/browser/services/Services.ts +13 -13
- package/src/browser/services/ThemeService.ts +19 -58
- package/src/browser/shared/Constants.ts +8 -0
- package/src/common/CircularList.ts +5 -5
- package/src/common/CoreTerminal.ts +35 -41
- package/src/common/InputHandler.ts +63 -51
- package/src/common/{Types.d.ts → Types.ts} +13 -17
- package/src/common/buffer/Buffer.ts +15 -7
- package/src/common/buffer/BufferReflow.ts +9 -6
- package/src/common/buffer/BufferSet.ts +5 -5
- package/src/common/buffer/Marker.ts +4 -4
- package/src/common/buffer/{Types.d.ts → Types.ts} +2 -2
- package/src/common/input/WriteBuffer.ts +3 -3
- package/src/common/parser/EscapeSequenceParser.ts +4 -4
- package/src/common/public/BufferNamespaceApi.ts +3 -3
- package/src/common/services/BufferService.ts +7 -7
- package/src/common/services/CoreMouseService.ts +5 -3
- package/src/common/services/CoreService.ts +8 -6
- package/src/common/services/DecorationService.ts +8 -9
- package/src/common/services/InstantiationService.ts +1 -1
- package/src/common/services/LogService.ts +2 -2
- package/src/common/services/OptionsService.ts +7 -6
- package/src/common/services/ServiceRegistry.ts +1 -1
- package/src/common/services/Services.ts +26 -17
- package/src/common/services/UnicodeService.ts +2 -2
- package/src/vs/base/browser/browser.ts +141 -0
- package/src/vs/base/browser/canIUse.ts +49 -0
- package/src/vs/base/browser/dom.ts +2369 -0
- package/src/vs/base/browser/fastDomNode.ts +316 -0
- package/src/vs/base/browser/globalPointerMoveMonitor.ts +112 -0
- package/src/vs/base/browser/iframe.ts +135 -0
- package/src/vs/base/browser/keyboardEvent.ts +213 -0
- package/src/vs/base/browser/mouseEvent.ts +229 -0
- package/src/vs/base/browser/touch.ts +372 -0
- package/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +303 -0
- package/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +114 -0
- package/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +720 -0
- package/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +165 -0
- package/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +114 -0
- package/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +243 -0
- package/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +118 -0
- package/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +116 -0
- package/src/vs/base/browser/ui/widget.ts +57 -0
- package/src/vs/base/browser/window.ts +14 -0
- package/src/vs/base/common/arrays.ts +887 -0
- package/src/vs/base/common/arraysFind.ts +202 -0
- package/src/vs/base/common/assert.ts +71 -0
- package/src/vs/base/common/async.ts +1992 -0
- package/src/vs/base/common/cancellation.ts +148 -0
- package/src/vs/base/common/charCode.ts +450 -0
- package/src/vs/base/common/collections.ts +140 -0
- package/src/vs/base/common/decorators.ts +130 -0
- package/src/vs/base/common/equals.ts +146 -0
- package/src/vs/base/common/errors.ts +303 -0
- package/src/vs/base/common/event.ts +1778 -0
- package/src/vs/base/common/functional.ts +32 -0
- package/src/vs/base/common/hash.ts +316 -0
- package/src/vs/base/common/iterator.ts +159 -0
- package/src/vs/base/common/keyCodes.ts +526 -0
- package/src/vs/base/common/keybindings.ts +284 -0
- package/src/vs/base/common/lazy.ts +47 -0
- package/src/vs/base/common/lifecycle.ts +801 -0
- package/src/vs/base/common/linkedList.ts +142 -0
- package/src/vs/base/common/map.ts +202 -0
- package/src/vs/base/common/numbers.ts +98 -0
- package/src/vs/base/common/observable.ts +76 -0
- package/src/vs/base/common/observableInternal/api.ts +31 -0
- package/src/vs/base/common/observableInternal/autorun.ts +281 -0
- package/src/vs/base/common/observableInternal/base.ts +489 -0
- package/src/vs/base/common/observableInternal/debugName.ts +145 -0
- package/src/vs/base/common/observableInternal/derived.ts +428 -0
- package/src/vs/base/common/observableInternal/lazyObservableValue.ts +146 -0
- package/src/vs/base/common/observableInternal/logging.ts +328 -0
- package/src/vs/base/common/observableInternal/promise.ts +209 -0
- package/src/vs/base/common/observableInternal/utils.ts +610 -0
- package/src/vs/base/common/platform.ts +281 -0
- package/src/vs/base/common/scrollable.ts +522 -0
- package/src/vs/base/common/sequence.ts +34 -0
- package/src/vs/base/common/stopwatch.ts +43 -0
- package/src/vs/base/common/strings.ts +557 -0
- package/src/vs/base/common/symbols.ts +9 -0
- package/src/vs/base/common/uint.ts +59 -0
- package/src/vs/patches/nls.ts +90 -0
- package/src/vs/typings/base-common.d.ts +20 -0
- package/src/vs/typings/require.d.ts +42 -0
- package/src/vs/typings/thenable.d.ts +12 -0
- package/src/vs/typings/vscode-globals-nls.d.ts +36 -0
- package/src/vs/typings/vscode-globals-product.d.ts +33 -0
- package/typings/xterm.d.ts +66 -15
- package/src/browser/Lifecycle.ts +0 -33
- package/src/common/EventEmitter.ts +0 -78
- package/src/common/Lifecycle.ts +0 -108
- /package/src/browser/selection/{Types.d.ts → Types.ts} +0 -0
- /package/src/common/parser/{Types.d.ts → Types.ts} +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { IParsingState, IDcsHandler, IEscapeSequenceParser, IParams, IOscHandler, IHandlerCollection, CsiHandlerType, OscFallbackHandlerType, IOscParser, EscHandlerType, IDcsParser, DcsFallbackHandlerType, IFunctionIdentifier, ExecuteFallbackHandlerType, CsiFallbackHandlerType, EscFallbackHandlerType, PrintHandlerType, PrintFallbackHandlerType, ExecuteHandlerType, IParserStackState, ParserStackType, ResumableHandlersType } from 'common/parser/Types';
|
|
7
7
|
import { ParserState, ParserAction } from 'common/parser/Constants';
|
|
8
|
-
import { Disposable, toDisposable } from 'common/
|
|
8
|
+
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
|
9
9
|
import { IDisposable } from 'common/Types';
|
|
10
10
|
import { Params } from 'common/parser/Params';
|
|
11
11
|
import { OscParser } from 'common/parser/OscParser';
|
|
@@ -283,13 +283,13 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
|
|
|
283
283
|
this._executeHandlers = Object.create(null);
|
|
284
284
|
this._csiHandlers = Object.create(null);
|
|
285
285
|
this._escHandlers = Object.create(null);
|
|
286
|
-
this.
|
|
286
|
+
this._register(toDisposable(() => {
|
|
287
287
|
this._csiHandlers = Object.create(null);
|
|
288
288
|
this._executeHandlers = Object.create(null);
|
|
289
289
|
this._escHandlers = Object.create(null);
|
|
290
290
|
}));
|
|
291
|
-
this._oscParser = this.
|
|
292
|
-
this._dcsParser = this.
|
|
291
|
+
this._oscParser = this._register(new OscParser());
|
|
292
|
+
this._dcsParser = this._register(new DcsParser());
|
|
293
293
|
this._errorHandler = this._errorHandlerFb;
|
|
294
294
|
|
|
295
295
|
// swallow 7bit ST (ESC+\)
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
|
|
6
6
|
import { IBuffer as IBufferApi, IBufferNamespace as IBufferNamespaceApi } from '@xterm/xterm';
|
|
7
7
|
import { BufferApiView } from 'common/public/BufferApiView';
|
|
8
|
-
import { EventEmitter } from 'common/EventEmitter';
|
|
9
8
|
import { ICoreTerminal } from 'common/Types';
|
|
10
|
-
import { Disposable } from 'common/
|
|
9
|
+
import { Disposable } from 'vs/base/common/lifecycle';
|
|
10
|
+
import { Emitter } from 'vs/base/common/event';
|
|
11
11
|
|
|
12
12
|
export class BufferNamespaceApi extends Disposable implements IBufferNamespaceApi {
|
|
13
13
|
private _normal: BufferApiView;
|
|
14
14
|
private _alternate: BufferApiView;
|
|
15
15
|
|
|
16
|
-
private readonly _onBufferChange = this.
|
|
16
|
+
private readonly _onBufferChange = this._register(new Emitter<IBufferApi>());
|
|
17
17
|
public readonly onBufferChange = this._onBufferChange.event;
|
|
18
18
|
|
|
19
19
|
constructor(private _core: ICoreTerminal) {
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { IAttributeData, IBufferLine, ScrollSource } from 'common/Types';
|
|
6
|
+
import { Disposable } from 'vs/base/common/lifecycle';
|
|
7
|
+
import { IAttributeData, IBufferLine } from 'common/Types';
|
|
9
8
|
import { BufferSet } from 'common/buffer/BufferSet';
|
|
10
9
|
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
|
11
10
|
import { IBufferService, IOptionsService } from 'common/services/Services';
|
|
11
|
+
import { Emitter } from 'vs/base/common/event';
|
|
12
12
|
|
|
13
13
|
export const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars
|
|
14
14
|
export const MINIMUM_ROWS = 1;
|
|
@@ -22,9 +22,9 @@ export class BufferService extends Disposable implements IBufferService {
|
|
|
22
22
|
/** Whether the user is scrolling (locks the scroll position) */
|
|
23
23
|
public isUserScrolling: boolean = false;
|
|
24
24
|
|
|
25
|
-
private readonly _onResize = this.
|
|
25
|
+
private readonly _onResize = this._register(new Emitter<{ cols: number, rows: number }>());
|
|
26
26
|
public readonly onResize = this._onResize.event;
|
|
27
|
-
private readonly _onScroll = this.
|
|
27
|
+
private readonly _onScroll = this._register(new Emitter<number>());
|
|
28
28
|
public readonly onScroll = this._onScroll.event;
|
|
29
29
|
|
|
30
30
|
public get buffer(): IBuffer { return this.buffers.active; }
|
|
@@ -36,7 +36,7 @@ export class BufferService extends Disposable implements IBufferService {
|
|
|
36
36
|
super();
|
|
37
37
|
this.cols = Math.max(optionsService.rawOptions.cols || 0, MINIMUM_COLS);
|
|
38
38
|
this.rows = Math.max(optionsService.rawOptions.rows || 0, MINIMUM_ROWS);
|
|
39
|
-
this.buffers = this.
|
|
39
|
+
this.buffers = this._register(new BufferSet(optionsService, this));
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
public resize(cols: number, rows: number): void {
|
|
@@ -125,7 +125,7 @@ export class BufferService extends Disposable implements IBufferService {
|
|
|
125
125
|
* to avoid unwanted events being handled by the viewport when the event was triggered from the
|
|
126
126
|
* viewport originally.
|
|
127
127
|
*/
|
|
128
|
-
public scrollLines(disp: number, suppressScrollEvent?: boolean
|
|
128
|
+
public scrollLines(disp: number, suppressScrollEvent?: boolean): void {
|
|
129
129
|
const buffer = this.buffer;
|
|
130
130
|
if (disp < 0) {
|
|
131
131
|
if (buffer.ydisp === 0) {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
import { IBufferService, ICoreService, ICoreMouseService } from 'common/services/Services';
|
|
6
|
-
import { EventEmitter } from 'common/EventEmitter';
|
|
7
6
|
import { ICoreMouseProtocol, ICoreMouseEvent, CoreMouseEncoding, CoreMouseEventType, CoreMouseButton, CoreMouseAction } from 'common/Types';
|
|
8
|
-
import { Disposable } from 'common/
|
|
7
|
+
import { Disposable } from 'vs/base/common/lifecycle';
|
|
8
|
+
import { Emitter } from 'vs/base/common/event';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Supported default protocols.
|
|
@@ -167,13 +167,15 @@ const DEFAULT_ENCODINGS: { [key: string]: CoreMouseEncoding } = {
|
|
|
167
167
|
* To send a mouse event call `triggerMouseEvent`.
|
|
168
168
|
*/
|
|
169
169
|
export class CoreMouseService extends Disposable implements ICoreMouseService {
|
|
170
|
+
public serviceBrand: any;
|
|
171
|
+
|
|
170
172
|
private _protocols: { [name: string]: ICoreMouseProtocol } = {};
|
|
171
173
|
private _encodings: { [name: string]: CoreMouseEncoding } = {};
|
|
172
174
|
private _activeProtocol: string = '';
|
|
173
175
|
private _activeEncoding: string = '';
|
|
174
176
|
private _lastEvent: ICoreMouseEvent | null = null;
|
|
175
177
|
|
|
176
|
-
private readonly _onProtocolChange = this.
|
|
178
|
+
private readonly _onProtocolChange = this._register(new Emitter<CoreMouseEventType>());
|
|
177
179
|
public readonly onProtocolChange = this._onProtocolChange.event;
|
|
178
180
|
|
|
179
181
|
constructor(
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { clone } from 'common/Clone';
|
|
7
|
-
import {
|
|
8
|
-
import { Disposable } from 'common/Lifecycle';
|
|
7
|
+
import { Disposable } from 'vs/base/common/lifecycle';
|
|
9
8
|
import { IDecPrivateModes, IModes } from 'common/Types';
|
|
10
9
|
import { IBufferService, ICoreService, ILogService, IOptionsService } from 'common/services/Services';
|
|
10
|
+
import { Emitter } from 'vs/base/common/event';
|
|
11
11
|
|
|
12
12
|
const DEFAULT_MODES: IModes = Object.freeze({
|
|
13
13
|
insertMode: false
|
|
@@ -17,6 +17,8 @@ const DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({
|
|
|
17
17
|
applicationCursorKeys: false,
|
|
18
18
|
applicationKeypad: false,
|
|
19
19
|
bracketedPasteMode: false,
|
|
20
|
+
cursorBlink: undefined,
|
|
21
|
+
cursorStyle: undefined,
|
|
20
22
|
origin: false,
|
|
21
23
|
reverseWraparound: false,
|
|
22
24
|
sendFocus: false,
|
|
@@ -31,13 +33,13 @@ export class CoreService extends Disposable implements ICoreService {
|
|
|
31
33
|
public modes: IModes;
|
|
32
34
|
public decPrivateModes: IDecPrivateModes;
|
|
33
35
|
|
|
34
|
-
private readonly _onData = this.
|
|
36
|
+
private readonly _onData = this._register(new Emitter<string>());
|
|
35
37
|
public readonly onData = this._onData.event;
|
|
36
|
-
private readonly _onUserInput = this.
|
|
38
|
+
private readonly _onUserInput = this._register(new Emitter<void>());
|
|
37
39
|
public readonly onUserInput = this._onUserInput.event;
|
|
38
|
-
private readonly _onBinary = this.
|
|
40
|
+
private readonly _onBinary = this._register(new Emitter<string>());
|
|
39
41
|
public readonly onBinary = this._onBinary.event;
|
|
40
|
-
private readonly _onRequestScrollToBottom = this.
|
|
42
|
+
private readonly _onRequestScrollToBottom = this._register(new Emitter<void>());
|
|
41
43
|
public readonly onRequestScrollToBottom = this._onRequestScrollToBottom.event;
|
|
42
44
|
|
|
43
45
|
constructor(
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { css } from 'common/Color';
|
|
7
|
-
import {
|
|
8
|
-
import { Disposable, toDisposable } from 'common/Lifecycle';
|
|
7
|
+
import { Disposable, DisposableStore, toDisposable } from 'vs/base/common/lifecycle';
|
|
9
8
|
import { IDecorationService, IInternalDecoration } from 'common/services/Services';
|
|
10
9
|
import { SortedList } from 'common/SortedList';
|
|
11
10
|
import { IColor } from 'common/Types';
|
|
12
11
|
import { IDecoration, IDecorationOptions, IMarker } from '@xterm/xterm';
|
|
12
|
+
import { Emitter } from 'vs/base/common/event';
|
|
13
13
|
|
|
14
14
|
// Work variables to avoid garbage collection
|
|
15
15
|
let $xmin = 0;
|
|
@@ -25,9 +25,9 @@ export class DecorationService extends Disposable implements IDecorationService
|
|
|
25
25
|
*/
|
|
26
26
|
private readonly _decorations: SortedList<IInternalDecoration> = new SortedList(e => e?.marker.line);
|
|
27
27
|
|
|
28
|
-
private readonly _onDecorationRegistered = this.
|
|
28
|
+
private readonly _onDecorationRegistered = this._register(new Emitter<IInternalDecoration>());
|
|
29
29
|
public readonly onDecorationRegistered = this._onDecorationRegistered.event;
|
|
30
|
-
private readonly _onDecorationRemoved = this.
|
|
30
|
+
private readonly _onDecorationRemoved = this._register(new Emitter<IInternalDecoration>());
|
|
31
31
|
public readonly onDecorationRemoved = this._onDecorationRemoved.event;
|
|
32
32
|
|
|
33
33
|
public get decorations(): IterableIterator<IInternalDecoration> { return this._decorations.values(); }
|
|
@@ -35,7 +35,7 @@ export class DecorationService extends Disposable implements IDecorationService
|
|
|
35
35
|
constructor() {
|
|
36
36
|
super();
|
|
37
37
|
|
|
38
|
-
this.
|
|
38
|
+
this._register(toDisposable(() => this.reset()));
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
public registerDecoration(options: IDecorationOptions): IDecoration | undefined {
|
|
@@ -90,14 +90,13 @@ export class DecorationService extends Disposable implements IDecorationService
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
class Decoration extends
|
|
93
|
+
class Decoration extends DisposableStore implements IInternalDecoration {
|
|
94
94
|
public readonly marker: IMarker;
|
|
95
95
|
public element: HTMLElement | undefined;
|
|
96
|
-
public get isDisposed(): boolean { return this._isDisposed; }
|
|
97
96
|
|
|
98
|
-
public readonly onRenderEmitter = this.
|
|
97
|
+
public readonly onRenderEmitter = this.add(new Emitter<HTMLElement>());
|
|
99
98
|
public readonly onRender = this.onRenderEmitter.event;
|
|
100
|
-
private readonly _onDispose = this.
|
|
99
|
+
private readonly _onDispose = this.add(new Emitter<void>());
|
|
101
100
|
public readonly onDispose = this._onDispose.event;
|
|
102
101
|
|
|
103
102
|
private _cachedBg: IColor | undefined | null = null;
|
|
@@ -67,7 +67,7 @@ export class InstantiationService implements IInstantiationService {
|
|
|
67
67
|
for (const dependency of serviceDependencies) {
|
|
68
68
|
const service = this._services.get(dependency.id);
|
|
69
69
|
if (!service) {
|
|
70
|
-
throw new Error(`[createInstance] ${ctor.name} depends on UNKNOWN service ${dependency.id}.`);
|
|
70
|
+
throw new Error(`[createInstance] ${ctor.name} depends on UNKNOWN service ${dependency.id._id}.`);
|
|
71
71
|
}
|
|
72
72
|
serviceArgs.push(service);
|
|
73
73
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Disposable } from 'common/
|
|
6
|
+
import { Disposable } from 'vs/base/common/lifecycle';
|
|
7
7
|
import { ILogService, IOptionsService, LogLevelEnum } from 'common/services/Services';
|
|
8
8
|
|
|
9
9
|
type LogType = (message?: any, ...optionalParams: any[]) => void;
|
|
@@ -42,7 +42,7 @@ export class LogService extends Disposable implements ILogService {
|
|
|
42
42
|
) {
|
|
43
43
|
super();
|
|
44
44
|
this._updateLogLevel();
|
|
45
|
-
this.
|
|
45
|
+
this._register(this._optionsService.onSpecificOptionChange('logLevel', () => this._updateLogLevel()));
|
|
46
46
|
|
|
47
47
|
// For trace logging, assume the latest created log service is valid
|
|
48
48
|
traceLogger = this;
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { Disposable, toDisposable } from 'common/Lifecycle';
|
|
6
|
+
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
|
8
7
|
import { isMac } from 'common/Platform';
|
|
9
8
|
import { CursorStyle, IDisposable } from 'common/Types';
|
|
10
9
|
import { FontWeight, IOptionsService, ITerminalOptions } from 'common/services/Services';
|
|
10
|
+
import { Emitter } from 'vs/base/common/event';
|
|
11
11
|
|
|
12
12
|
export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
|
13
13
|
cols: 80,
|
|
@@ -21,7 +21,7 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
|
|
21
21
|
documentOverride: null,
|
|
22
22
|
fastScrollModifier: 'alt',
|
|
23
23
|
fastScrollSensitivity: 5,
|
|
24
|
-
fontFamily: '
|
|
24
|
+
fontFamily: 'monospace',
|
|
25
25
|
fontSize: 15,
|
|
26
26
|
fontWeight: 'normal',
|
|
27
27
|
fontWeightBold: 'bold',
|
|
@@ -44,6 +44,7 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
|
|
44
44
|
allowTransparency: false,
|
|
45
45
|
tabStopWidth: 8,
|
|
46
46
|
theme: {},
|
|
47
|
+
reflowCursorLine: false,
|
|
47
48
|
rescaleOverlappingGlyphs: false,
|
|
48
49
|
rightClickSelectsWord: isMac,
|
|
49
50
|
windowOptions: {},
|
|
@@ -54,7 +55,7 @@ export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
|
|
54
55
|
convertEol: false,
|
|
55
56
|
termName: 'xterm',
|
|
56
57
|
cancelEvents: false,
|
|
57
|
-
|
|
58
|
+
overviewRuler: {}
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
const FONT_WEIGHT_OPTIONS: Extract<FontWeight, string>[] = ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'];
|
|
@@ -65,7 +66,7 @@ export class OptionsService extends Disposable implements IOptionsService {
|
|
|
65
66
|
public readonly rawOptions: Required<ITerminalOptions>;
|
|
66
67
|
public options: Required<ITerminalOptions>;
|
|
67
68
|
|
|
68
|
-
private readonly _onOptionChange = this.
|
|
69
|
+
private readonly _onOptionChange = this._register(new Emitter<keyof ITerminalOptions>());
|
|
69
70
|
public readonly onOptionChange = this._onOptionChange.event;
|
|
70
71
|
|
|
71
72
|
constructor(options: Partial<ITerminalOptions>) {
|
|
@@ -90,7 +91,7 @@ export class OptionsService extends Disposable implements IOptionsService {
|
|
|
90
91
|
|
|
91
92
|
// Clear out options that could link outside xterm.js as they could easily cause an embedder
|
|
92
93
|
// memory leak
|
|
93
|
-
this.
|
|
94
|
+
this._register(toDisposable(() => {
|
|
94
95
|
this.rawOptions.linkHandler = null;
|
|
95
96
|
this.rawOptions.documentOverride = null;
|
|
96
97
|
}));
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, type IOverviewRulerOptions } from '@xterm/xterm';
|
|
7
|
+
import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IModes, IOscLinkData, IWindowOptions } from 'common/Types';
|
|
7
8
|
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
|
8
|
-
import { IDecPrivateModes, ICoreMouseEvent, CoreMouseEncoding, ICoreMouseProtocol, CoreMouseEventType, ICharset, IWindowOptions, IModes, IAttributeData, ScrollSource, IDisposable, IColor, CursorStyle, CursorInactiveStyle, IOscLinkData } from 'common/Types';
|
|
9
9
|
import { createDecorator } from 'common/services/ServiceRegistry';
|
|
10
|
-
import {
|
|
10
|
+
import type { Emitter, Event } from 'vs/base/common/event';
|
|
11
11
|
|
|
12
12
|
export const IBufferService = createDecorator<IBufferService>('BufferService');
|
|
13
13
|
export interface IBufferService {
|
|
@@ -18,16 +18,18 @@ export interface IBufferService {
|
|
|
18
18
|
readonly buffer: IBuffer;
|
|
19
19
|
readonly buffers: IBufferSet;
|
|
20
20
|
isUserScrolling: boolean;
|
|
21
|
-
onResize:
|
|
22
|
-
onScroll:
|
|
21
|
+
onResize: Event<{ cols: number, rows: number }>;
|
|
22
|
+
onScroll: Event<number>;
|
|
23
23
|
scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;
|
|
24
|
-
scrollLines(disp: number, suppressScrollEvent?: boolean
|
|
24
|
+
scrollLines(disp: number, suppressScrollEvent?: boolean): void;
|
|
25
25
|
resize(cols: number, rows: number): void;
|
|
26
26
|
reset(): void;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export const ICoreMouseService = createDecorator<ICoreMouseService>('CoreMouseService');
|
|
30
30
|
export interface ICoreMouseService {
|
|
31
|
+
serviceBrand: undefined;
|
|
32
|
+
|
|
31
33
|
activeProtocol: string;
|
|
32
34
|
activeEncoding: string;
|
|
33
35
|
areMouseEventsActive: boolean;
|
|
@@ -50,7 +52,7 @@ export interface ICoreMouseService {
|
|
|
50
52
|
/**
|
|
51
53
|
* Event to announce changes in mouse tracking.
|
|
52
54
|
*/
|
|
53
|
-
onProtocolChange:
|
|
55
|
+
onProtocolChange: Event<CoreMouseEventType>;
|
|
54
56
|
|
|
55
57
|
/**
|
|
56
58
|
* Human readable version of mouse events.
|
|
@@ -72,10 +74,10 @@ export interface ICoreService {
|
|
|
72
74
|
readonly modes: IModes;
|
|
73
75
|
readonly decPrivateModes: IDecPrivateModes;
|
|
74
76
|
|
|
75
|
-
readonly onData:
|
|
76
|
-
readonly onUserInput:
|
|
77
|
-
readonly onBinary:
|
|
78
|
-
readonly onRequestScrollToBottom:
|
|
77
|
+
readonly onData: Event<string>;
|
|
78
|
+
readonly onUserInput: Event<void>;
|
|
79
|
+
readonly onBinary: Event<string>;
|
|
80
|
+
readonly onRequestScrollToBottom: Event<void>;
|
|
79
81
|
|
|
80
82
|
reset(): void;
|
|
81
83
|
|
|
@@ -122,6 +124,7 @@ export interface ICharsetService {
|
|
|
122
124
|
export interface IServiceIdentifier<T> {
|
|
123
125
|
(...args: any[]): void;
|
|
124
126
|
type: T;
|
|
127
|
+
_id: string;
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
export interface IBrandedService {
|
|
@@ -184,7 +187,7 @@ export interface IOptionsService {
|
|
|
184
187
|
/**
|
|
185
188
|
* Adds an event listener for when any option changes.
|
|
186
189
|
*/
|
|
187
|
-
readonly onOptionChange:
|
|
190
|
+
readonly onOptionChange: Event<keyof ITerminalOptions>;
|
|
188
191
|
|
|
189
192
|
/**
|
|
190
193
|
* Adds an event listener for when a specific option changes, this is a convenience method that is
|
|
@@ -219,6 +222,7 @@ export interface ITerminalOptions {
|
|
|
219
222
|
disableStdin?: boolean;
|
|
220
223
|
documentOverride?: any | null;
|
|
221
224
|
drawBoldTextInBrightColors?: boolean;
|
|
225
|
+
/** @deprecated No longer supported */
|
|
222
226
|
fastScrollModifier?: 'none' | 'alt' | 'ctrl' | 'shift';
|
|
223
227
|
fastScrollSensitivity?: number;
|
|
224
228
|
fontSize?: number;
|
|
@@ -234,6 +238,7 @@ export interface ITerminalOptions {
|
|
|
234
238
|
macOptionIsMeta?: boolean;
|
|
235
239
|
macOptionClickForcesSelection?: boolean;
|
|
236
240
|
minimumContrastRatio?: number;
|
|
241
|
+
reflowCursorLine?: boolean;
|
|
237
242
|
rescaleOverlappingGlyphs?: boolean;
|
|
238
243
|
rightClickSelectsWord?: boolean;
|
|
239
244
|
rows?: number;
|
|
@@ -248,7 +253,7 @@ export interface ITerminalOptions {
|
|
|
248
253
|
windowsPty?: IWindowsPty;
|
|
249
254
|
windowOptions?: IWindowOptions;
|
|
250
255
|
wordSeparator?: string;
|
|
251
|
-
|
|
256
|
+
overviewRuler?: IOverviewRulerOptions;
|
|
252
257
|
|
|
253
258
|
[key: string]: any;
|
|
254
259
|
cancelEvents: boolean;
|
|
@@ -263,6 +268,10 @@ export interface ITheme {
|
|
|
263
268
|
selectionForeground?: string;
|
|
264
269
|
selectionBackground?: string;
|
|
265
270
|
selectionInactiveBackground?: string;
|
|
271
|
+
scrollbarSliderBackground?: string;
|
|
272
|
+
scrollbarSliderHoverBackground?: string;
|
|
273
|
+
scrollbarSliderActiveBackground?: string;
|
|
274
|
+
overviewRulerBorder?: string;
|
|
266
275
|
black?: string;
|
|
267
276
|
red?: string;
|
|
268
277
|
green?: string;
|
|
@@ -331,7 +340,7 @@ export interface IUnicodeService {
|
|
|
331
340
|
/** Currently active version. */
|
|
332
341
|
activeVersion: string;
|
|
333
342
|
/** Event triggered, when activate version changed. */
|
|
334
|
-
readonly onChange:
|
|
343
|
+
readonly onChange: Event<string>;
|
|
335
344
|
|
|
336
345
|
/**
|
|
337
346
|
* Unicode version dependent
|
|
@@ -356,8 +365,8 @@ export const IDecorationService = createDecorator<IDecorationService>('Decoratio
|
|
|
356
365
|
export interface IDecorationService extends IDisposable {
|
|
357
366
|
serviceBrand: undefined;
|
|
358
367
|
readonly decorations: IterableIterator<IInternalDecoration>;
|
|
359
|
-
readonly onDecorationRegistered:
|
|
360
|
-
readonly onDecorationRemoved:
|
|
368
|
+
readonly onDecorationRegistered: Event<IInternalDecoration>;
|
|
369
|
+
readonly onDecorationRemoved: Event<IInternalDecoration>;
|
|
361
370
|
registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;
|
|
362
371
|
reset(): void;
|
|
363
372
|
/**
|
|
@@ -370,5 +379,5 @@ export interface IInternalDecoration extends IDecoration {
|
|
|
370
379
|
readonly options: IDecorationOptions;
|
|
371
380
|
readonly backgroundColorRGB: IColor | undefined;
|
|
372
381
|
readonly foregroundColorRGB: IColor | undefined;
|
|
373
|
-
readonly onRenderEmitter:
|
|
382
|
+
readonly onRenderEmitter: Emitter<HTMLElement>;
|
|
374
383
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* @license MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { EventEmitter } from 'common/EventEmitter';
|
|
7
6
|
import { UnicodeV6 } from 'common/input/UnicodeV6';
|
|
8
7
|
import { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';
|
|
8
|
+
import { Emitter } from 'vs/base/common/event';
|
|
9
9
|
|
|
10
10
|
export class UnicodeService implements IUnicodeService {
|
|
11
11
|
public serviceBrand: any;
|
|
@@ -14,7 +14,7 @@ export class UnicodeService implements IUnicodeService {
|
|
|
14
14
|
private _active: string = '';
|
|
15
15
|
private _activeProvider: IUnicodeVersionProvider;
|
|
16
16
|
|
|
17
|
-
private readonly _onChange = new
|
|
17
|
+
private readonly _onChange = new Emitter<string>();
|
|
18
18
|
public readonly onChange = this._onChange.event;
|
|
19
19
|
|
|
20
20
|
public static extractShouldJoin(value: UnicodeCharProperties): boolean {
|
|
@@ -0,0 +1,141 @@
|
|
|
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 { CodeWindow, mainWindow } from 'vs/base/browser/window';
|
|
7
|
+
import { Emitter } from 'vs/base/common/event';
|
|
8
|
+
|
|
9
|
+
class WindowManager {
|
|
10
|
+
|
|
11
|
+
static readonly INSTANCE = new WindowManager();
|
|
12
|
+
|
|
13
|
+
// --- Zoom Level
|
|
14
|
+
|
|
15
|
+
private readonly mapWindowIdToZoomLevel = new Map<number, number>();
|
|
16
|
+
|
|
17
|
+
private readonly _onDidChangeZoomLevel = new Emitter<number>();
|
|
18
|
+
readonly onDidChangeZoomLevel = this._onDidChangeZoomLevel.event;
|
|
19
|
+
|
|
20
|
+
getZoomLevel(targetWindow: Window): number {
|
|
21
|
+
return this.mapWindowIdToZoomLevel.get(this.getWindowId(targetWindow)) ?? 0;
|
|
22
|
+
}
|
|
23
|
+
setZoomLevel(zoomLevel: number, targetWindow: Window): void {
|
|
24
|
+
if (this.getZoomLevel(targetWindow) === zoomLevel) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const targetWindowId = this.getWindowId(targetWindow);
|
|
29
|
+
this.mapWindowIdToZoomLevel.set(targetWindowId, zoomLevel);
|
|
30
|
+
this._onDidChangeZoomLevel.fire(targetWindowId);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// --- Zoom Factor
|
|
34
|
+
|
|
35
|
+
private readonly mapWindowIdToZoomFactor = new Map<number, number>();
|
|
36
|
+
|
|
37
|
+
getZoomFactor(targetWindow: Window): number {
|
|
38
|
+
return this.mapWindowIdToZoomFactor.get(this.getWindowId(targetWindow)) ?? 1;
|
|
39
|
+
}
|
|
40
|
+
setZoomFactor(zoomFactor: number, targetWindow: Window): void {
|
|
41
|
+
this.mapWindowIdToZoomFactor.set(this.getWindowId(targetWindow), zoomFactor);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// --- Fullscreen
|
|
45
|
+
|
|
46
|
+
private readonly _onDidChangeFullscreen = new Emitter<number>();
|
|
47
|
+
readonly onDidChangeFullscreen = this._onDidChangeFullscreen.event;
|
|
48
|
+
|
|
49
|
+
private readonly mapWindowIdToFullScreen = new Map<number, boolean>();
|
|
50
|
+
|
|
51
|
+
setFullscreen(fullscreen: boolean, targetWindow: Window): void {
|
|
52
|
+
if (this.isFullscreen(targetWindow) === fullscreen) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const windowId = this.getWindowId(targetWindow);
|
|
57
|
+
this.mapWindowIdToFullScreen.set(windowId, fullscreen);
|
|
58
|
+
this._onDidChangeFullscreen.fire(windowId);
|
|
59
|
+
}
|
|
60
|
+
isFullscreen(targetWindow: Window): boolean {
|
|
61
|
+
return !!this.mapWindowIdToFullScreen.get(this.getWindowId(targetWindow));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private getWindowId(targetWindow: Window): number {
|
|
65
|
+
return (targetWindow as CodeWindow).vscodeWindowId;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function addMatchMediaChangeListener(targetWindow: Window, query: string | MediaQueryList, callback: (this: MediaQueryList, ev: MediaQueryListEvent) => any): void {
|
|
70
|
+
if (typeof query === 'string') {
|
|
71
|
+
query = targetWindow.matchMedia(query);
|
|
72
|
+
}
|
|
73
|
+
query.addEventListener('change', callback);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** A zoom index, e.g. 1, 2, 3 */
|
|
77
|
+
export function setZoomLevel(zoomLevel: number, targetWindow: Window): void {
|
|
78
|
+
WindowManager.INSTANCE.setZoomLevel(zoomLevel, targetWindow);
|
|
79
|
+
}
|
|
80
|
+
export function getZoomLevel(targetWindow: Window): number {
|
|
81
|
+
return WindowManager.INSTANCE.getZoomLevel(targetWindow);
|
|
82
|
+
}
|
|
83
|
+
export const onDidChangeZoomLevel = WindowManager.INSTANCE.onDidChangeZoomLevel;
|
|
84
|
+
|
|
85
|
+
/** The zoom scale for an index, e.g. 1, 1.2, 1.4 */
|
|
86
|
+
export function getZoomFactor(targetWindow: Window): number {
|
|
87
|
+
return WindowManager.INSTANCE.getZoomFactor(targetWindow);
|
|
88
|
+
}
|
|
89
|
+
export function setZoomFactor(zoomFactor: number, targetWindow: Window): void {
|
|
90
|
+
WindowManager.INSTANCE.setZoomFactor(zoomFactor, targetWindow);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function setFullscreen(fullscreen: boolean, targetWindow: Window): void {
|
|
94
|
+
WindowManager.INSTANCE.setFullscreen(fullscreen, targetWindow);
|
|
95
|
+
}
|
|
96
|
+
export function isFullscreen(targetWindow: Window): boolean {
|
|
97
|
+
return WindowManager.INSTANCE.isFullscreen(targetWindow);
|
|
98
|
+
}
|
|
99
|
+
export const onDidChangeFullscreen = WindowManager.INSTANCE.onDidChangeFullscreen;
|
|
100
|
+
|
|
101
|
+
const userAgent = typeof navigator === 'object' ? navigator.userAgent : '';
|
|
102
|
+
|
|
103
|
+
export const isFirefox = (userAgent.indexOf('Firefox') >= 0);
|
|
104
|
+
export const isWebKit = (userAgent.indexOf('AppleWebKit') >= 0);
|
|
105
|
+
export const isChrome = (userAgent.indexOf('Chrome') >= 0);
|
|
106
|
+
export const isSafari = (!isChrome && (userAgent.indexOf('Safari') >= 0));
|
|
107
|
+
export const isWebkitWebView = (!isChrome && !isSafari && isWebKit);
|
|
108
|
+
export const isElectron = (userAgent.indexOf('Electron/') >= 0);
|
|
109
|
+
export const isAndroid = (userAgent.indexOf('Android') >= 0);
|
|
110
|
+
|
|
111
|
+
let standalone = false;
|
|
112
|
+
if (typeof mainWindow.matchMedia === 'function') {
|
|
113
|
+
const standaloneMatchMedia = mainWindow.matchMedia('(display-mode: standalone) or (display-mode: window-controls-overlay)');
|
|
114
|
+
const fullScreenMatchMedia = mainWindow.matchMedia('(display-mode: fullscreen)');
|
|
115
|
+
standalone = standaloneMatchMedia.matches;
|
|
116
|
+
addMatchMediaChangeListener(mainWindow, standaloneMatchMedia, ({ matches }) => {
|
|
117
|
+
// entering fullscreen would change standaloneMatchMedia.matches to false
|
|
118
|
+
// if standalone is true (running as PWA) and entering fullscreen, skip this change
|
|
119
|
+
if (standalone && fullScreenMatchMedia.matches) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
// otherwise update standalone (browser to PWA or PWA to browser)
|
|
123
|
+
standalone = matches;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
export function isStandalone(): boolean {
|
|
127
|
+
return standalone;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Visible means that the feature is enabled, not necessarily being rendered
|
|
131
|
+
// e.g. visible is true even in fullscreen mode where the controls are hidden
|
|
132
|
+
// See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/visible
|
|
133
|
+
export function isWCOEnabled(): boolean {
|
|
134
|
+
return (navigator as any)?.windowControlsOverlay?.visible;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Returns the bounding rect of the titlebar area if it is supported and defined
|
|
138
|
+
// See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/getTitlebarAreaRect
|
|
139
|
+
export function getWCOBoundingRect(): DOMRect | undefined {
|
|
140
|
+
return (navigator as any)?.windowControlsOverlay?.getTitlebarAreaRect();
|
|
141
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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 browser from 'vs/base/browser/browser';
|
|
7
|
+
import { mainWindow } from 'vs/base/browser/window';
|
|
8
|
+
import * as platform from 'vs/base/common/platform';
|
|
9
|
+
|
|
10
|
+
export const enum KeyboardSupport {
|
|
11
|
+
Always,
|
|
12
|
+
FullScreen,
|
|
13
|
+
None
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const safeNavigator = typeof navigator === 'object' ? navigator : {} as { [key: string]: any };
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Browser feature we can support in current platform, browser and environment.
|
|
20
|
+
*/
|
|
21
|
+
export const BrowserFeatures = {
|
|
22
|
+
clipboard: {
|
|
23
|
+
writeText: (
|
|
24
|
+
platform.isNative
|
|
25
|
+
|| (document.queryCommandSupported && document.queryCommandSupported('copy'))
|
|
26
|
+
|| !!(safeNavigator && safeNavigator.clipboard && safeNavigator.clipboard.writeText)
|
|
27
|
+
),
|
|
28
|
+
readText: (
|
|
29
|
+
platform.isNative
|
|
30
|
+
|| !!(safeNavigator && safeNavigator.clipboard && safeNavigator.clipboard.readText)
|
|
31
|
+
)
|
|
32
|
+
},
|
|
33
|
+
keyboard: (() => {
|
|
34
|
+
if (platform.isNative || browser.isStandalone()) {
|
|
35
|
+
return KeyboardSupport.Always;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if ((<any>safeNavigator).keyboard || browser.isSafari) {
|
|
39
|
+
return KeyboardSupport.FullScreen;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return KeyboardSupport.None;
|
|
43
|
+
})(),
|
|
44
|
+
|
|
45
|
+
// 'ontouchstart' in window always evaluates to true with typescript's modern typings. This causes `window` to be
|
|
46
|
+
// `never` later in `window.navigator`. That's why we need the explicit `window as Window` cast
|
|
47
|
+
touch: 'ontouchstart' in mainWindow || safeNavigator.maxTouchPoints > 0,
|
|
48
|
+
pointerEvents: mainWindow.PointerEvent && ('ontouchstart' in mainWindow || navigator.maxTouchPoints > 0)
|
|
49
|
+
};
|