Merge pull request #1652 from Tyriar/1337_project_refs_prep

Preparation for project references
This commit is contained in:
Daniel Imms
2018-09-08 02:59:26 -07:00
committed by GitHub
17 changed files with 47 additions and 40 deletions
+1 -1
View File
@@ -40,7 +40,7 @@
"ts-loader": "^4.5.0", "ts-loader": "^4.5.0",
"tslint": "^5.9.1", "tslint": "^5.9.1",
"tslint-consistent-codestyle": "^1.13.0", "tslint-consistent-codestyle": "^1.13.0",
"typescript": "2.8.3", "typescript": "3.0",
"vinyl-buffer": "^1.0.0", "vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0", "vinyl-source-stream": "^1.1.0",
"webpack": "^4.17.1", "webpack": "^4.17.1",
+1 -1
View File
@@ -5,7 +5,7 @@
import { CircularList } from './common/CircularList'; import { CircularList } from './common/CircularList';
import { CharData, ITerminal, IBuffer, IBufferLine } from './Types'; import { CharData, ITerminal, IBuffer, IBufferLine } from './Types';
import { EventEmitter } from './EventEmitter'; import { EventEmitter } from './common/EventEmitter';
import { IMarker } from 'xterm'; import { IMarker } from 'xterm';
import { BufferLine } from './BufferLine'; import { BufferLine } from './BufferLine';
+1 -1
View File
@@ -5,7 +5,7 @@
import { ITerminal, IBufferSet } from './Types'; import { ITerminal, IBufferSet } from './Types';
import { Buffer } from './Buffer'; import { Buffer } from './Buffer';
import { EventEmitter } from './EventEmitter'; import { EventEmitter } from './common/EventEmitter';
/** /**
* The BufferSet represents the set of two buffers used by xterm terminals (normal and alt) and * The BufferSet represents the set of two buffers used by xterm terminals (normal and alt) and
+1 -1
View File
@@ -6,7 +6,7 @@
import { IMouseZoneManager } from './ui/Types'; import { IMouseZoneManager } from './ui/Types';
import { ILinkHoverEvent, ILinkMatcher, LinkMatcherHandler, LinkHoverEventTypes, ILinkMatcherOptions, ILinkifier, ITerminal, IBufferLine } from './Types'; import { ILinkHoverEvent, ILinkMatcher, LinkMatcherHandler, LinkHoverEventTypes, ILinkMatcherOptions, ILinkifier, ITerminal, IBufferLine } from './Types';
import { MouseZone } from './ui/MouseZoneManager'; import { MouseZone } from './ui/MouseZoneManager';
import { EventEmitter } from './EventEmitter'; import { EventEmitter } from './common/EventEmitter';
import { CHAR_DATA_ATTR_INDEX } from './Buffer'; import { CHAR_DATA_ATTR_INDEX } from './Buffer';
/** /**
+3 -2
View File
@@ -3,11 +3,12 @@
* @license MIT * @license MIT
*/ */
import { ITerminal, ISelectionManager, IBuffer, CharData, XtermListener, IBufferLine } from './Types'; import { ITerminal, ISelectionManager, IBuffer, CharData, IBufferLine } from './Types';
import { XtermListener } from './common/Types';
import { MouseHelper } from './utils/MouseHelper'; import { MouseHelper } from './utils/MouseHelper';
import * as Browser from './shared/utils/Browser'; import * as Browser from './shared/utils/Browser';
import { CharMeasure } from './ui/CharMeasure'; import { CharMeasure } from './ui/CharMeasure';
import { EventEmitter } from './EventEmitter'; import { EventEmitter } from './common/EventEmitter';
import { SelectionModel } from './SelectionModel'; import { SelectionModel } from './SelectionModel';
import { CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_CODE_INDEX } from './Buffer'; import { CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_CODE_INDEX } from './Buffer';
import { AltClickHandler } from './handlers/AltClickHandler'; import { AltClickHandler } from './handlers/AltClickHandler';
+1 -1
View File
@@ -27,7 +27,7 @@ import { IRenderer } from './renderer/Types';
import { BufferSet } from './BufferSet'; import { BufferSet } from './BufferSet';
import { Buffer, MAX_BUFFER_SIZE, DEFAULT_ATTR, NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR } from './Buffer'; import { Buffer, MAX_BUFFER_SIZE, DEFAULT_ATTR, NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR } from './Buffer';
import { CompositionHelper } from './CompositionHelper'; import { CompositionHelper } from './CompositionHelper';
import { EventEmitter } from './EventEmitter'; import { EventEmitter } from './common/EventEmitter';
import { Viewport } from './Viewport'; import { Viewport } from './Viewport';
import { rightClickHandler, moveTextAreaUnderMouseCursor, pasteHandler, copyHandler } from './handlers/Clipboard'; import { rightClickHandler, moveTextAreaUnderMouseCursor, pasteHandler, copyHandler } from './handlers/Clipboard';
import { C0 } from './common/data/EscapeSequences'; import { C0 } from './common/data/EscapeSequences';
+1 -15
View File
@@ -7,11 +7,10 @@ import { Terminal as PublicTerminal, ITerminalOptions as IPublicTerminalOptions,
import { IColorSet, IRenderer } from './renderer/Types'; import { IColorSet, IRenderer } from './renderer/Types';
import { IMouseZoneManager } from './ui/Types'; import { IMouseZoneManager } from './ui/Types';
import { ICharset } from './core/Types'; import { ICharset } from './core/Types';
import { ICircularList } from './common/Types';
export type CustomKeyEventHandler = (event: KeyboardEvent) => boolean; export type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;
export type XtermListener = (...args: any[]) => void;
export type CharData = [number, string, number, number]; export type CharData = [number, string, number, number];
export type LineData = CharData[]; export type LineData = CharData[];
@@ -294,19 +293,6 @@ export interface IBufferSet extends IEventEmitter {
activateAltBuffer(): void; activateAltBuffer(): void;
} }
export interface ICircularList<T> extends IEventEmitter {
length: number;
maxLength: number;
get(index: number): T;
set(index: number, value: T): void;
push(value: T): void;
pop(): T;
splice(start: number, deleteCount: number, ...items: T[]): void;
trimStart(count: number): void;
shiftElements(start: number, count: number, offset: number): void;
}
export interface ISelectionManager { export interface ISelectionManager {
selectionText: string; selectionText: string;
selectionStart: [number, number]; selectionStart: [number, number];
+7 -7
View File
@@ -3,15 +3,15 @@
* @license MIT * @license MIT
*/ */
import { EventEmitter } from '../EventEmitter'; import { EventEmitter } from './EventEmitter';
import { ICircularList } from '../Types'; import { ICircularList } from './Types';
/** /**
* Represents a circular list; a list with a maximum size that wraps around when push is called, * Represents a circular list; a list with a maximum size that wraps around when push is called,
* overriding values at the start of the list. * overriding values at the start of the list.
*/ */
export class CircularList<T> extends EventEmitter implements ICircularList<T> { export class CircularList<T> extends EventEmitter implements ICircularList<T> {
protected _array: T[]; protected _array: (T | undefined)[];
private _startIndex: number; private _startIndex: number;
private _length: number; private _length: number;
@@ -36,7 +36,7 @@ export class CircularList<T> extends EventEmitter implements ICircularList<T> {
// Reconstruct array, starting at index 0. Only transfer values from the // Reconstruct array, starting at index 0. Only transfer values from the
// indexes 0 to length. // indexes 0 to length.
const newArray = new Array<T>(newMaxLength); const newArray = new Array<T | undefined>(newMaxLength);
for (let i = 0; i < Math.min(newMaxLength, this.length); i++) { for (let i = 0; i < Math.min(newMaxLength, this.length); i++) {
newArray[i] = this._array[this._getCyclicIndex(i)]; newArray[i] = this._array[this._getCyclicIndex(i)];
} }
@@ -66,7 +66,7 @@ export class CircularList<T> extends EventEmitter implements ICircularList<T> {
* @param index The index of the value to get. * @param index The index of the value to get.
* @return The value corresponding to the index. * @return The value corresponding to the index.
*/ */
public get(index: number): T { public get(index: number): T | undefined {
return this._array[this._getCyclicIndex(index)]; return this._array[this._getCyclicIndex(index)];
} }
@@ -78,7 +78,7 @@ export class CircularList<T> extends EventEmitter implements ICircularList<T> {
* @param index The index to set. * @param index The index to set.
* @param value The value to set. * @param value The value to set.
*/ */
public set(index: number, value: T): void { public set(index: number, value: T | undefined): void {
this._array[this._getCyclicIndex(index)] = value; this._array[this._getCyclicIndex(index)] = value;
} }
@@ -104,7 +104,7 @@ export class CircularList<T> extends EventEmitter implements ICircularList<T> {
* Removes and returns the last value on the list. * Removes and returns the last value on the list.
* @return The popped value. * @return The popped value.
*/ */
public pop(): T { public pop(): T | undefined {
return this._array[this._getCyclicIndex(this._length-- - 1)]; return this._array[this._getCyclicIndex(this._length-- - 1)];
} }
@@ -5,7 +5,7 @@
import { XtermListener } from './Types'; import { XtermListener } from './Types';
import { IEventEmitter, IDisposable } from 'xterm'; import { IEventEmitter, IDisposable } from 'xterm';
import { Disposable } from './common/Lifecycle'; import { Disposable } from './Lifecycle';
export class EventEmitter extends Disposable implements IEventEmitter, IDisposable { export class EventEmitter extends Disposable implements IEventEmitter, IDisposable {
private _events: {[type: string]: XtermListener[]}; private _events: {[type: string]: XtermListener[]};
@@ -30,14 +30,15 @@ export class EventEmitter extends Disposable implements IEventEmitter, IDisposab
public addDisposableListener(type: string, handler: XtermListener): IDisposable { public addDisposableListener(type: string, handler: XtermListener): IDisposable {
// TODO: Rename addDisposableEventListener to more easily disambiguate from Dom listener // TODO: Rename addDisposableEventListener to more easily disambiguate from Dom listener
this.on(type, handler); this.on(type, handler);
let disposed = false;
return { return {
dispose: () => { dispose: () => {
if (!handler) { if (disposed) {
// Already disposed // Already disposed
return; return;
} }
this.off(type, handler); this.off(type, handler);
handler = null; disposed = true;
} }
}; };
} }
+17
View File
@@ -3,6 +3,10 @@
* @license MIT * @license MIT
*/ */
import { IEventEmitter } from 'xterm';
export type XtermListener = (...args: any[]) => void;
/** /**
* A keyboard event interface which does not depend on the DOM, KeyboardEvent implicitly extends * A keyboard event interface which does not depend on the DOM, KeyboardEvent implicitly extends
* this event. * this event.
@@ -16,3 +20,16 @@ export interface IKeyboardEvent {
key: string; key: string;
type: string; type: string;
} }
export interface ICircularList<T> extends IEventEmitter {
length: number;
maxLength: number;
get(index: number): T | undefined;
set(index: number, value: T): void;
push(value: T): void;
pop(): T | undefined;
splice(start: number, deleteCount: number, ...items: T[]): void;
trimStart(count: number): void;
shiftElements(start: number, count: number, offset: number): void;
}
+2 -1
View File
@@ -3,7 +3,8 @@
* @license MIT * @license MIT
*/ */
import { ITerminal, ICircularList, IBufferLine } from '../Types'; import { ITerminal, IBufferLine } from '../Types';
import { ICircularList } from '../common/Types';
import { C0 } from '../common/data/EscapeSequences'; import { C0 } from '../common/data/EscapeSequences';
const enum Direction { const enum Direction {
+1 -1
View File
@@ -10,7 +10,7 @@ import { ColorManager } from './ColorManager';
import { IRenderLayer, IColorSet, IRenderer, IRenderDimensions, ICharacterJoinerRegistry } from './Types'; import { IRenderLayer, IColorSet, IRenderer, IRenderDimensions, ICharacterJoinerRegistry } from './Types';
import { ITerminal, CharacterJoinerHandler } from '../Types'; import { ITerminal, CharacterJoinerHandler } from '../Types';
import { LinkRenderLayer } from './LinkRenderLayer'; import { LinkRenderLayer } from './LinkRenderLayer';
import { EventEmitter } from '../EventEmitter'; import { EventEmitter } from '../common/EventEmitter';
import { RenderDebouncer } from '../ui/RenderDebouncer'; import { RenderDebouncer } from '../ui/RenderDebouncer';
import { ScreenDprMonitor } from '../ui/ScreenDprMonitor'; import { ScreenDprMonitor } from '../ui/ScreenDprMonitor';
import { ITheme } from 'xterm'; import { ITheme } from 'xterm';
+1 -1
View File
@@ -6,7 +6,7 @@
import { IRenderer, IRenderDimensions, IColorSet } from '../Types'; import { IRenderer, IRenderDimensions, IColorSet } from '../Types';
import { ITerminal, CharacterJoinerHandler } from '../../Types'; import { ITerminal, CharacterJoinerHandler } from '../../Types';
import { ITheme } from 'xterm'; import { ITheme } from 'xterm';
import { EventEmitter } from '../../EventEmitter'; import { EventEmitter } from '../../common/EventEmitter';
import { ColorManager } from '../ColorManager'; import { ColorManager } from '../ColorManager';
import { RenderDebouncer } from '../../ui/RenderDebouncer'; import { RenderDebouncer } from '../../ui/RenderDebouncer';
import { BOLD_CLASS, ITALIC_CLASS, CURSOR_CLASS, CURSOR_STYLE_BLOCK_CLASS, CURSOR_STYLE_BAR_CLASS, CURSOR_STYLE_UNDERLINE_CLASS, DomRendererRowFactory } from './DomRendererRowFactory'; import { BOLD_CLASS, ITALIC_CLASS, CURSOR_CLASS, CURSOR_STYLE_BLOCK_CLASS, CURSOR_STYLE_BAR_CLASS, CURSOR_STYLE_UNDERLINE_CLASS, DomRendererRowFactory } from './DomRendererRowFactory';
+1 -1
View File
@@ -4,7 +4,7 @@
*/ */
import { ICharMeasure, ITerminalOptions } from '../Types'; import { ICharMeasure, ITerminalOptions } from '../Types';
import { EventEmitter } from '../EventEmitter'; import { EventEmitter } from '../common/EventEmitter';
/** /**
* Utility class that measures the size of a character. Measurements are done in * Utility class that measures the size of a character. Measurements are done in
+2 -1
View File
@@ -4,7 +4,8 @@
*/ */
import { IColorSet, IRenderer, IRenderDimensions, IColorManager } from '../renderer/Types'; import { IColorSet, IRenderer, IRenderDimensions, IColorManager } from '../renderer/Types';
import { IInputHandlingTerminal, IViewport, ICompositionHelper, ITerminal, IBuffer, IBufferSet, IBrowser, ICharMeasure, ISelectionManager, ITerminalOptions, ICircularList, ILinkifier, IMouseHelper, ILinkMatcherOptions, XtermListener, CharacterJoinerHandler, IBufferLine } from '../Types'; import { IInputHandlingTerminal, IViewport, ICompositionHelper, ITerminal, IBuffer, IBufferSet, IBrowser, ICharMeasure, ISelectionManager, ITerminalOptions, ILinkifier, IMouseHelper, ILinkMatcherOptions, CharacterJoinerHandler, IBufferLine } from '../Types';
import { ICircularList, XtermListener } from '../common/Types';
import { Buffer } from '../Buffer'; import { Buffer } from '../Buffer';
import * as Browser from '../shared/utils/Browser'; import * as Browser from '../shared/utils/Browser';
import { ITheme, IDisposable, IMarker } from 'xterm'; import { ITheme, IDisposable, IMarker } from 'xterm';
+3 -3
View File
@@ -5868,9 +5868,9 @@ typedarray@^0.0.6, typedarray@~0.0.5:
version "0.0.6" version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
typescript@2.8.3: typescript@3.0:
version "2.8.3" version "3.0.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.3.tgz#5d817f9b6f31bb871835f4edf0089f21abe6c170" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.3.tgz#4853b3e275ecdaa27f78fda46dc273a7eb7fc1c8"
uglify-es@^3.3.4: uglify-es@^3.3.4:
version "3.3.9" version "3.3.9"