Split common/ Types.ts into .d.ts and Constants.ts

This commit is contained in:
Daniel Imms
2019-06-14 21:30:51 -07:00
parent 6e9c7888d2
commit 0b2df9d611
11 changed files with 71 additions and 60 deletions
+6 -1
View File
@@ -13,7 +13,12 @@ export interface IEvent<T> {
(listener: (e: T) => any): IDisposable;
}
export class EventEmitter<T> {
export interface IEventEmitter<T> {
event: IEvent<T>;
fire(data: T): void;
}
export class EventEmitter<T> implements IEventEmitter<T> {
private _listeners: IListener<T>[] = [];
private _event?: IEvent<T>;
+4 -13
View File
@@ -3,22 +3,13 @@
* @license MIT
*/
import { IEvent, EventEmitter } from 'common/EventEmitter';
import { IEvent, IEventEmitter } from 'common/EventEmitter';
import { IDeleteEvent, IInsertEvent } from 'common/CircularList';
export const DEFAULT_COLOR = 256;
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;
/**
@@ -40,11 +31,11 @@ export interface ICircularList<T> {
maxLength: number;
isFull: boolean;
onDeleteEmitter: EventEmitter<IDeleteEvent>;
onDeleteEmitter: IEventEmitter<IDeleteEvent>;
onDelete: IEvent<IDeleteEvent>;
onInsertEmitter: EventEmitter<IInsertEvent>;
onInsertEmitter: IEventEmitter<IInsertEvent>;
onInsert: IEvent<IInsertEvent>;
onTrimEmitter: EventEmitter<number>;
onTrimEmitter: IEventEmitter<number>;
onTrim: IEvent<number>;
get(index: number): T | undefined;
+2 -1
View File
@@ -2,8 +2,9 @@
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { DEFAULT_COLOR, CharData, IBufferLine, ICellData, IColorRGB, IAttributeData } from 'common/Types';
import { CharData, IBufferLine, ICellData, IColorRGB, IAttributeData } from 'common/Types';
import { stringFromCodePoint } from 'common/input/TextDecoder';
import { DEFAULT_COLOR } from 'common/buffer/Constants';
export const DEFAULT_ATTR = (0 << 18) | (DEFAULT_COLOR << 9) | (256 << 0);
+6
View File
@@ -0,0 +1,6 @@
/**
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*/
export const DEFAULT_COLOR = 256;
+45
View File
@@ -0,0 +1,45 @@
/**
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
* @license MIT
*/
/**
* Internal states of EscapeSequenceParser.
*/
export const enum ParserState {
GROUND = 0,
ESCAPE = 1,
ESCAPE_INTERMEDIATE = 2,
CSI_ENTRY = 3,
CSI_PARAM = 4,
CSI_INTERMEDIATE = 5,
CSI_IGNORE = 6,
SOS_PM_APC_STRING = 7,
OSC_STRING = 8,
DCS_ENTRY = 9,
DCS_PARAM = 10,
DCS_IGNORE = 11,
DCS_INTERMEDIATE = 12,
DCS_PASSTHROUGH = 13
}
/**
* Internal actions of EscapeSequenceParser.
*/
export const enum ParserAction {
IGNORE = 0,
ERROR = 1,
PRINT = 2,
EXECUTE = 3,
OSC_START = 4,
OSC_PUT = 5,
OSC_END = 6,
CSI_DISPATCH = 7,
PARAM = 8,
COLLECT = 9,
ESC_DISPATCH = 10,
CLEAR = 11,
DCS_HOOK = 12,
DCS_PUT = 13,
DCS_UNHOOK = 14
}
@@ -3,10 +3,11 @@
* @license MIT
*/
import { ParserState, IDcsHandler, IParsingState } from 'common/parser/Types';
import { IDcsHandler, IParsingState } from 'common/parser/Types';
import { EscapeSequenceParser, TransitionTable, VT500_TRANSITION_TABLE } from 'common/parser/EscapeSequenceParser';
import * as chai from 'chai';
import { StringToUtf32, stringFromCodePoint } from 'common/input/TextDecoder';
import { ParserState } from 'common/parser/Constants';
function r(a: number, b: number): string[] {
let c = b - a;
+2 -1
View File
@@ -3,7 +3,8 @@
* @license MIT
*/
import { ParserState, ParserAction, IParsingState, IDcsHandler, IEscapeSequenceParser } from 'common/parser/Types';
import { IParsingState, IDcsHandler, IEscapeSequenceParser } from 'common/parser/Types';
import { ParserState, ParserAction } from 'common/parser/Constants';
import { Disposable } from 'common/Lifecycle';
import { utf32ToString } from 'common/input/TextDecoder';
import { IDisposable } from 'common/Types';
+1 -41
View File
@@ -4,47 +4,7 @@
*/
import { IDisposable } from 'common/Types';
/**
* Internal states of EscapeSequenceParser.
*/
export const enum ParserState {
GROUND = 0,
ESCAPE = 1,
ESCAPE_INTERMEDIATE = 2,
CSI_ENTRY = 3,
CSI_PARAM = 4,
CSI_INTERMEDIATE = 5,
CSI_IGNORE = 6,
SOS_PM_APC_STRING = 7,
OSC_STRING = 8,
DCS_ENTRY = 9,
DCS_PARAM = 10,
DCS_IGNORE = 11,
DCS_INTERMEDIATE = 12,
DCS_PASSTHROUGH = 13
}
/**
* Internal actions of EscapeSequenceParser.
*/
export const enum ParserAction {
IGNORE = 0,
ERROR = 1,
PRINT = 2,
EXECUTE = 3,
OSC_START = 4,
OSC_PUT = 5,
OSC_END = 6,
CSI_DISPATCH = 7,
PARAM = 8,
COLLECT = 9,
ESC_DISPATCH = 10,
CLEAR = 11,
DCS_HOOK = 12,
DCS_PUT = 13,
DCS_UNHOOK = 14
}
import { ParserState } from 'common/parser/Constants';
/**
* Internal state of EscapeSequenceParser.
+2 -1
View File
@@ -6,7 +6,8 @@
import { IRenderLayer } from './Types';
import { IRenderDimensions } from 'browser/renderer/Types';
import { ITerminal } from '../Types';
import { ICellData, DEFAULT_COLOR } from 'common/Types';
import { ICellData } from 'common/Types';
import { DEFAULT_COLOR } from 'common/buffer/Constants';
import { DIM_OPACITY, INVERTED_DEFAULT_COLOR, IGlyphIdentifier } from './atlas/Types';
import { BaseCharAtlas } from './atlas/BaseCharAtlas';
import { acquireCharAtlas } from './atlas/CharAtlasCache';
+1 -1
View File
@@ -5,7 +5,7 @@
import { ITerminal } from '../../Types';
import { ICharAtlasConfig } from './Types';
import { DEFAULT_COLOR } from 'common/Types';
import { DEFAULT_COLOR } from 'common/buffer/Constants';
import { IColorSet } from 'browser/Types';
export function generateConfig(scaledCharWidth: number, scaledCharHeight: number, terminal: ITerminal, colors: IColorSet): ICharAtlasConfig {