Merge pull request #2229 from Tyriar/types_constants
Split Types.ts into Types.d.ts and Constants.ts
This commit is contained in:
Vendored
+3
-3
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { ITerminalOptions as IPublicTerminalOptions, IDisposable, IMarker, ISelectionPosition } from 'xterm';
|
import { ITerminalOptions as IPublicTerminalOptions, IDisposable, IMarker, ISelectionPosition } from 'xterm';
|
||||||
import { ICharset, IAttributeData, CharData } from 'common/Types';
|
import { ICharset, IAttributeData, CharData } from 'common/Types';
|
||||||
import { IEvent, EventEmitter } from 'common/EventEmitter';
|
import { IEvent, IEventEmitter } from 'common/EventEmitter';
|
||||||
import { IColorSet, IMouseHelper } from 'browser/Types';
|
import { IColorSet, IMouseHelper } from 'browser/Types';
|
||||||
import { IOptionsService } from 'common/services/Services';
|
import { IOptionsService } from 'common/services/Services';
|
||||||
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
||||||
@@ -54,8 +54,8 @@ export interface IInputHandlingTerminal {
|
|||||||
viewport: IViewport;
|
viewport: IViewport;
|
||||||
selectionManager: ISelectionManager;
|
selectionManager: ISelectionManager;
|
||||||
|
|
||||||
onA11yCharEmitter: EventEmitter<string>;
|
onA11yCharEmitter: IEventEmitter<string>;
|
||||||
onA11yTabEmitter: EventEmitter<number>;
|
onA11yTabEmitter: IEventEmitter<number>;
|
||||||
|
|
||||||
bell(): void;
|
bell(): void;
|
||||||
focus(): void;
|
focus(): void;
|
||||||
@@ -13,7 +13,12 @@ export interface IEvent<T> {
|
|||||||
(listener: (e: T) => any): IDisposable;
|
(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 _listeners: IListener<T>[] = [];
|
||||||
private _event?: IEvent<T>;
|
private _event?: IEvent<T>;
|
||||||
|
|
||||||
|
|||||||
+4
-13
@@ -3,22 +3,13 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IEvent, EventEmitter } from 'common/EventEmitter';
|
import { IEvent, IEventEmitter } from 'common/EventEmitter';
|
||||||
import { IDeleteEvent, IInsertEvent } from 'common/CircularList';
|
import { IDeleteEvent, IInsertEvent } from 'common/CircularList';
|
||||||
|
|
||||||
export const DEFAULT_COLOR = 256;
|
|
||||||
|
|
||||||
export interface IDisposable {
|
export interface IDisposable {
|
||||||
dispose(): void;
|
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,11 +31,11 @@ export interface ICircularList<T> {
|
|||||||
maxLength: number;
|
maxLength: number;
|
||||||
isFull: boolean;
|
isFull: boolean;
|
||||||
|
|
||||||
onDeleteEmitter: EventEmitter<IDeleteEvent>;
|
onDeleteEmitter: IEventEmitter<IDeleteEvent>;
|
||||||
onDelete: IEvent<IDeleteEvent>;
|
onDelete: IEvent<IDeleteEvent>;
|
||||||
onInsertEmitter: EventEmitter<IInsertEvent>;
|
onInsertEmitter: IEventEmitter<IInsertEvent>;
|
||||||
onInsert: IEvent<IInsertEvent>;
|
onInsert: IEvent<IInsertEvent>;
|
||||||
onTrimEmitter: EventEmitter<number>;
|
onTrimEmitter: IEventEmitter<number>;
|
||||||
onTrim: IEvent<number>;
|
onTrim: IEvent<number>;
|
||||||
|
|
||||||
get(index: number): T | undefined;
|
get(index: number): T | undefined;
|
||||||
@@ -2,8 +2,9 @@
|
|||||||
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
|
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
|
||||||
* @license MIT
|
* @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 { stringFromCodePoint } from 'common/input/TextDecoder';
|
||||||
|
import { DEFAULT_COLOR } from 'common/buffer/Constants';
|
||||||
|
|
||||||
export const DEFAULT_ATTR = (0 << 18) | (DEFAULT_COLOR << 9) | (256 << 0);
|
export const DEFAULT_ATTR = (0 << 18) | (DEFAULT_COLOR << 9) | (256 << 0);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const DEFAULT_COLOR = 256;
|
||||||
@@ -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
|
* @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 { EscapeSequenceParser, TransitionTable, VT500_TRANSITION_TABLE } from 'common/parser/EscapeSequenceParser';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
import { StringToUtf32, stringFromCodePoint } from 'common/input/TextDecoder';
|
import { StringToUtf32, stringFromCodePoint } from 'common/input/TextDecoder';
|
||||||
|
import { ParserState } from 'common/parser/Constants';
|
||||||
|
|
||||||
function r(a: number, b: number): string[] {
|
function r(a: number, b: number): string[] {
|
||||||
let c = b - a;
|
let c = b - a;
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
* @license MIT
|
* @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 { Disposable } from 'common/Lifecycle';
|
||||||
import { utf32ToString } from 'common/input/TextDecoder';
|
import { utf32ToString } from 'common/input/TextDecoder';
|
||||||
import { IDisposable } from 'common/Types';
|
import { IDisposable } from 'common/Types';
|
||||||
|
|||||||
+1
-41
@@ -4,47 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { IDisposable } from 'common/Types';
|
import { IDisposable } from 'common/Types';
|
||||||
|
import { ParserState } from 'common/parser/Constants';
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal state of EscapeSequenceParser.
|
* Internal state of EscapeSequenceParser.
|
||||||
@@ -6,8 +6,10 @@
|
|||||||
import { IRenderLayer } from './Types';
|
import { IRenderLayer } from './Types';
|
||||||
import { IRenderDimensions } from 'browser/renderer/Types';
|
import { IRenderDimensions } from 'browser/renderer/Types';
|
||||||
import { ITerminal } from '../Types';
|
import { ITerminal } from '../Types';
|
||||||
import { ICellData, DEFAULT_COLOR } from 'common/Types';
|
import { ICellData } from 'common/Types';
|
||||||
import { DIM_OPACITY, INVERTED_DEFAULT_COLOR, IGlyphIdentifier } from './atlas/Types';
|
import { DEFAULT_COLOR } from 'common/buffer/Constants';
|
||||||
|
import { IGlyphIdentifier } from './atlas/Types';
|
||||||
|
import { DIM_OPACITY, INVERTED_DEFAULT_COLOR } from './atlas/Constants';
|
||||||
import { BaseCharAtlas } from './atlas/BaseCharAtlas';
|
import { BaseCharAtlas } from './atlas/BaseCharAtlas';
|
||||||
import { acquireCharAtlas } from './atlas/CharAtlasCache';
|
import { acquireCharAtlas } from './atlas/CharAtlasCache';
|
||||||
import { CellData, AttributeData, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE } from 'common/buffer/BufferLine';
|
import { CellData, AttributeData, WHITESPACE_CELL_CHAR, WHITESPACE_CELL_CODE } from 'common/buffer/BufferLine';
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flags used to render terminal text properly for the old CharData format
|
||||||
|
*/
|
||||||
|
export const enum FLAGS {
|
||||||
|
BOLD = 1,
|
||||||
|
UNDERLINE = 2,
|
||||||
|
BLINK = 4,
|
||||||
|
INVERSE = 8,
|
||||||
|
INVISIBLE = 16,
|
||||||
|
DIM = 32,
|
||||||
|
ITALIC = 64
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
import { ILinkifierEvent, ITerminal, ILinkifierAccessor } from '../Types';
|
import { ILinkifierEvent, ITerminal, ILinkifierAccessor } from '../Types';
|
||||||
import { IRenderDimensions } from 'browser/renderer/Types';
|
import { IRenderDimensions } from 'browser/renderer/Types';
|
||||||
import { BaseRenderLayer } from './BaseRenderLayer';
|
import { BaseRenderLayer } from './BaseRenderLayer';
|
||||||
import { INVERTED_DEFAULT_COLOR } from './atlas/Types';
|
import { INVERTED_DEFAULT_COLOR } from './atlas/Constants';
|
||||||
import { is256Color } from './atlas/CharAtlasUtils';
|
import { is256Color } from './atlas/CharAtlasUtils';
|
||||||
import { IColorSet } from 'browser/Types';
|
import { IColorSet } from 'browser/Types';
|
||||||
|
|
||||||
|
|||||||
-13
@@ -8,19 +8,6 @@ import { IDisposable } from 'xterm';
|
|||||||
import { IColorSet } from 'browser/Types';
|
import { IColorSet } from 'browser/Types';
|
||||||
import { IRenderDimensions, CharacterJoinerHandler } from 'browser/renderer/Types';
|
import { IRenderDimensions, CharacterJoinerHandler } from 'browser/renderer/Types';
|
||||||
|
|
||||||
/**
|
|
||||||
* Flags used to render terminal text properly.
|
|
||||||
*/
|
|
||||||
export const enum FLAGS {
|
|
||||||
BOLD = 1,
|
|
||||||
UNDERLINE = 2,
|
|
||||||
BLINK = 4,
|
|
||||||
INVERSE = 8,
|
|
||||||
INVISIBLE = 16,
|
|
||||||
DIM = 32,
|
|
||||||
ITALIC = 64
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IRenderLayer extends IDisposable {
|
export interface IRenderLayer extends IDisposable {
|
||||||
/**
|
/**
|
||||||
* Called when the terminal loses focus.
|
* Called when the terminal loses focus.
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { ITerminal } from '../../Types';
|
import { ITerminal } from '../../Types';
|
||||||
import { ICharAtlasConfig } from './Types';
|
import { ICharAtlasConfig } from './Types';
|
||||||
import { DEFAULT_COLOR } from 'common/Types';
|
import { DEFAULT_COLOR } from 'common/buffer/Constants';
|
||||||
import { IColorSet } from 'browser/Types';
|
import { IColorSet } from 'browser/Types';
|
||||||
|
|
||||||
export function generateConfig(scaledCharWidth: number, scaledCharHeight: number, terminal: ITerminal, colors: IColorSet): ICharAtlasConfig {
|
export function generateConfig(scaledCharWidth: number, scaledCharHeight: number, terminal: ITerminal, colors: IColorSet): ICharAtlasConfig {
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const INVERTED_DEFAULT_COLOR = 257;
|
||||||
|
export const DIM_OPACITY = 0.5;
|
||||||
|
|
||||||
|
export const CHAR_ATLAS_CELL_SPACING = 1;
|
||||||
@@ -3,7 +3,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { DIM_OPACITY, IGlyphIdentifier, INVERTED_DEFAULT_COLOR, ICharAtlasConfig } from './Types';
|
import { IGlyphIdentifier, ICharAtlasConfig } from './Types';
|
||||||
|
import { DIM_OPACITY, INVERTED_DEFAULT_COLOR } from './Constants';
|
||||||
import { BaseCharAtlas } from './BaseCharAtlas';
|
import { BaseCharAtlas } from './BaseCharAtlas';
|
||||||
import { DEFAULT_ANSI_COLORS } from 'browser/ColorManager';
|
import { DEFAULT_ANSI_COLORS } from 'browser/ColorManager';
|
||||||
import { LRUMap } from './LRUMap';
|
import { LRUMap } from './LRUMap';
|
||||||
|
|||||||
@@ -6,11 +6,6 @@
|
|||||||
import { FontWeight } from 'xterm';
|
import { FontWeight } from 'xterm';
|
||||||
import { IColorSet } from 'browser/Types';
|
import { IColorSet } from 'browser/Types';
|
||||||
|
|
||||||
export const INVERTED_DEFAULT_COLOR = 257;
|
|
||||||
export const DIM_OPACITY = 0.5;
|
|
||||||
|
|
||||||
export const CHAR_ATLAS_CELL_SPACING = 1;
|
|
||||||
|
|
||||||
export interface IGlyphIdentifier {
|
export interface IGlyphIdentifier {
|
||||||
chars: string;
|
chars: string;
|
||||||
code: number;
|
code: number;
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
import { IRenderer, IRenderDimensions, CharacterJoinerHandler } from 'browser/renderer/Types';
|
import { IRenderer, IRenderDimensions, CharacterJoinerHandler } from 'browser/renderer/Types';
|
||||||
import { ILinkifierEvent, ITerminal } from '../../Types';
|
import { ILinkifierEvent, ITerminal } from '../../Types';
|
||||||
import { BOLD_CLASS, ITALIC_CLASS, CURSOR_CLASS, CURSOR_STYLE_BLOCK_CLASS, CURSOR_BLINK_CLASS, CURSOR_STYLE_BAR_CLASS, CURSOR_STYLE_UNDERLINE_CLASS, DomRendererRowFactory } from './DomRendererRowFactory';
|
import { BOLD_CLASS, ITALIC_CLASS, CURSOR_CLASS, CURSOR_STYLE_BLOCK_CLASS, CURSOR_BLINK_CLASS, CURSOR_STYLE_BAR_CLASS, CURSOR_STYLE_UNDERLINE_CLASS, DomRendererRowFactory } from './DomRendererRowFactory';
|
||||||
import { INVERTED_DEFAULT_COLOR } from '../atlas/Types';
|
import { INVERTED_DEFAULT_COLOR } from '../atlas/Constants';
|
||||||
import { Disposable } from 'common/Lifecycle';
|
import { Disposable } from 'common/Lifecycle';
|
||||||
import { IColorSet } from 'browser/Types';
|
import { IColorSet } from 'browser/Types';
|
||||||
import { ICharSizeService } from 'browser/services/Services';
|
import { ICharSizeService } from 'browser/services/Services';
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { ITerminalOptions } from '../../Types';
|
import { ITerminalOptions } from '../../Types';
|
||||||
import { IBufferLine } from 'common/Types';
|
import { IBufferLine } from 'common/Types';
|
||||||
import { INVERTED_DEFAULT_COLOR } from '../atlas/Types';
|
import { INVERTED_DEFAULT_COLOR } from '../atlas/Constants';
|
||||||
import { CellData, AttributeData, NULL_CELL_CODE, WHITESPACE_CELL_CHAR } from 'common/buffer/BufferLine';
|
import { CellData, AttributeData, NULL_CELL_CODE, WHITESPACE_CELL_CHAR } from 'common/buffer/BufferLine';
|
||||||
|
|
||||||
export const BOLD_CLASS = 'xterm-bold';
|
export const BOLD_CLASS = 'xterm-bold';
|
||||||
|
|||||||
Reference in New Issue
Block a user