Move platform to common and remove dom dependence in common
Because common/ imports 'xterm', it also imported dom accidentally. Fixes #1990
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import * as Strings from './Strings';
|
import * as Strings from './Strings';
|
||||||
import { ITerminal, IBuffer } from './Types';
|
import { ITerminal, IBuffer } from './Types';
|
||||||
import { isMac } from './core/Platform';
|
import { isMac } from './common/Platform';
|
||||||
import { RenderDebouncer } from './ui/RenderDebouncer';
|
import { RenderDebouncer } from './ui/RenderDebouncer';
|
||||||
import { addDisposableDomListener } from './ui/Lifecycle';
|
import { addDisposableDomListener } from './ui/Lifecycle';
|
||||||
import { Disposable } from './common/Lifecycle';
|
import { Disposable } from './common/Lifecycle';
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import { ITerminal, ISelectionManager, IBuffer, CharData, IBufferLine } from './Types';
|
import { ITerminal, ISelectionManager, IBuffer, CharData, IBufferLine } from './Types';
|
||||||
import { XtermListener } from './common/Types';
|
import { XtermListener } from './common/Types';
|
||||||
import { MouseHelper } from './ui/MouseHelper';
|
import { MouseHelper } from './ui/MouseHelper';
|
||||||
import * as Browser from './core/Platform';
|
import * as Browser from './common/Platform';
|
||||||
import { CharMeasure } from './ui/CharMeasure';
|
import { CharMeasure } from './ui/CharMeasure';
|
||||||
import { EventEmitter } from './common/EventEmitter';
|
import { EventEmitter } from './common/EventEmitter';
|
||||||
import { SelectionModel } from './SelectionModel';
|
import { SelectionModel } from './SelectionModel';
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ import { Renderer } from './renderer/Renderer';
|
|||||||
import { Linkifier } from './Linkifier';
|
import { Linkifier } from './Linkifier';
|
||||||
import { SelectionManager } from './SelectionManager';
|
import { SelectionManager } from './SelectionManager';
|
||||||
import { CharMeasure } from './ui/CharMeasure';
|
import { CharMeasure } from './ui/CharMeasure';
|
||||||
import * as Browser from './core/Platform';
|
import * as Browser from './common/Platform';
|
||||||
import { addDisposableDomListener } from './ui/Lifecycle';
|
import { addDisposableDomListener } from './ui/Lifecycle';
|
||||||
import * as Strings from './Strings';
|
import * as Strings from './Strings';
|
||||||
import { MouseHelper } from './ui/MouseHelper';
|
import { MouseHelper } from './ui/MouseHelper';
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { XtermListener } from './Types';
|
import { IDisposable, IEventEmitter, XtermListener } from './Types';
|
||||||
import { IEventEmitter, IDisposable } from 'xterm';
|
|
||||||
import { Disposable } from './Lifecycle';
|
import { Disposable } from './Lifecycle';
|
||||||
|
|
||||||
export class EventEmitter extends Disposable implements IEventEmitter, IDisposable {
|
export class EventEmitter extends Disposable implements IEventEmitter, IDisposable {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IDisposable } from 'xterm';
|
import { IDisposable } from './Types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A base class that can be extended to provide convenience methods for managing the lifecycle of an
|
* A base class that can be extended to provide convenience methods for managing the lifecycle of an
|
||||||
|
|||||||
@@ -3,6 +3,13 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
interface INavigator {
|
||||||
|
userAgent: string;
|
||||||
|
language: string;
|
||||||
|
platform: string;
|
||||||
|
}
|
||||||
|
declare const navigator: INavigator;
|
||||||
|
|
||||||
const isNode = (typeof navigator === 'undefined') ? true : false;
|
const isNode = (typeof navigator === 'undefined') ? true : false;
|
||||||
const userAgent = (isNode) ? 'node' : navigator.userAgent;
|
const userAgent = (isNode) ? 'node' : navigator.userAgent;
|
||||||
const platform = (isNode) ? 'node' : navigator.platform;
|
const platform = (isNode) ? 'node' : navigator.platform;
|
||||||
+10
-1
@@ -3,7 +3,16 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IEventEmitter } from 'xterm';
|
export interface IDisposable {
|
||||||
|
dispose(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IEventEmitter {
|
||||||
|
on(type: string, listener: (...args: any[]) => void): void;
|
||||||
|
off(type: string, listener: (...args: any[]) => void): void;
|
||||||
|
emit(type: string, data?: any): void;
|
||||||
|
addDisposableListener(type: string, handler: (...args: any[]) => void): IDisposable;
|
||||||
|
}
|
||||||
|
|
||||||
export type XtermListener = (...args: any[]) => void;
|
export type XtermListener = (...args: any[]) => void;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
{
|
{
|
||||||
"extends": "../tsconfig-library-base",
|
"extends": "../tsconfig-library-base",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../../lib"
|
"outDir": "../../lib",
|
||||||
|
"types": [
|
||||||
|
"../../node_modules/@types/mocha"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./**/*"
|
"./**/*"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"outDir": "../../lib"
|
"outDir": "../../lib"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./**/*"
|
"./**/*", "../common/Platform.ts"
|
||||||
],
|
],
|
||||||
"references": [
|
"references": [
|
||||||
{ "path": "../common" }
|
{ "path": "../common" }
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { FontWeight } from 'xterm';
|
import { FontWeight } from 'xterm';
|
||||||
import { isFirefox, isSafari } from '../../core/Platform';
|
import { isFirefox, isSafari } from '../../common/Platform';
|
||||||
import { IColor } from '../Types';
|
import { IColor } from '../Types';
|
||||||
import { ICharAtlasConfig, CHAR_ATLAS_CELL_SPACING } from './Types';
|
import { ICharAtlasConfig, CHAR_ATLAS_CELL_SPACING } from './Types';
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import BaseCharAtlas from './BaseCharAtlas';
|
|||||||
import { DEFAULT_ANSI_COLORS } from '../ColorManager';
|
import { DEFAULT_ANSI_COLORS } from '../ColorManager';
|
||||||
import { clearColor } from './CharAtlasGenerator';
|
import { clearColor } from './CharAtlasGenerator';
|
||||||
import LRUMap from './LRUMap';
|
import LRUMap from './LRUMap';
|
||||||
import { isFirefox, isSafari } from '../../core/Platform';
|
import { isFirefox, isSafari } from '../../common/Platform';
|
||||||
import { IColor } from '../Types';
|
import { IColor } from '../Types';
|
||||||
|
|
||||||
// In practice we're probably never going to exhaust a texture this large. For debugging purposes,
|
// In practice we're probably never going to exhaust a texture this large. For debugging purposes,
|
||||||
|
|||||||
@@ -8,8 +8,6 @@
|
|||||||
"removeComments": true,
|
"removeComments": true,
|
||||||
"pretty": true,
|
"pretty": true,
|
||||||
|
|
||||||
"incremental": true,
|
"incremental": true
|
||||||
|
|
||||||
"skipLibCheck": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
{
|
{
|
||||||
"extends": "./tsconfig-base.json",
|
"extends": "./tsconfig-base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"types": [
|
|
||||||
"../../node_modules/@types/mocha",
|
|
||||||
"../../"
|
|
||||||
],
|
|
||||||
"composite": true,
|
"composite": true,
|
||||||
"strict": true
|
"strict": true
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -11,7 +11,7 @@
|
|||||||
],
|
],
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"outDir": "../lib",
|
"outDir": "../lib",
|
||||||
|
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noImplicitAny": true
|
"noImplicitAny": true
|
||||||
},
|
},
|
||||||
@@ -27,4 +27,3 @@
|
|||||||
{ "path": "./core" }
|
{ "path": "./core" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ import { IColorSet, IRenderer, IRenderDimensions, IColorManager } from '../rende
|
|||||||
import { IInputHandlingTerminal, IViewport, ICompositionHelper, ITerminal, IBuffer, IBufferSet, IBrowser, ICharMeasure, ISelectionManager, ITerminalOptions, ILinkifier, IMouseHelper, ILinkMatcherOptions, CharacterJoinerHandler, IBufferLine, IBufferStringIterator } from '../Types';
|
import { IInputHandlingTerminal, IViewport, ICompositionHelper, ITerminal, IBuffer, IBufferSet, IBrowser, ICharMeasure, ISelectionManager, ITerminalOptions, ILinkifier, IMouseHelper, ILinkMatcherOptions, CharacterJoinerHandler, IBufferLine, IBufferStringIterator } from '../Types';
|
||||||
import { ICircularList, XtermListener } from '../common/Types';
|
import { ICircularList, XtermListener } from '../common/Types';
|
||||||
import { Buffer } from '../Buffer';
|
import { Buffer } from '../Buffer';
|
||||||
import * as Browser from '../core/Platform';
|
import * as Browser from '../common/Platform';
|
||||||
import { ITheme, IDisposable, IMarker } from 'xterm';
|
import { ITheme, IDisposable, IMarker } from 'xterm';
|
||||||
import { Terminal } from '../Terminal';
|
import { Terminal } from '../Terminal';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user