Move Shared interfaces into a new typings file
This will enable sharing the internal interface with addons (and catching breakages early)
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { ITerminal } from './Interfaces';
|
import { ITerminal } from '../typings/xterm-internal';
|
||||||
import { Buffer } from './Buffer';
|
import { Buffer } from './Buffer';
|
||||||
import { CircularList } from './utils/CircularList';
|
import { CircularList } from './utils/CircularList';
|
||||||
import { MockTerminal } from './utils/TestUtils.test';
|
import { MockTerminal } from './utils/TestUtils.test';
|
||||||
|
|||||||
+1
-2
@@ -3,9 +3,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ITerminal, IBuffer } from './Interfaces';
|
import { ITerminal, IBuffer, LineData, CharData } from '../typings/xterm-internal';
|
||||||
import { CircularList } from './utils/CircularList';
|
import { CircularList } from './utils/CircularList';
|
||||||
import { LineData, CharData } from './Types';
|
|
||||||
|
|
||||||
export const CHAR_DATA_ATTR_INDEX = 0;
|
export const CHAR_DATA_ATTR_INDEX = 0;
|
||||||
export const CHAR_DATA_CHAR_INDEX = 1;
|
export const CHAR_DATA_CHAR_INDEX = 1;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { ITerminal } from './Interfaces';
|
import { ITerminal } from '../typings/xterm-internal';
|
||||||
import { BufferSet } from './BufferSet';
|
import { BufferSet } from './BufferSet';
|
||||||
import { Buffer } from './Buffer';
|
import { Buffer } from './Buffer';
|
||||||
import { MockTerminal } from './utils/TestUtils.test';
|
import { MockTerminal } from './utils/TestUtils.test';
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ITerminal, IBufferSet } from './Interfaces';
|
import { ITerminal, IBufferSet } from '../typings/xterm-internal';
|
||||||
import { Buffer } from './Buffer';
|
import { Buffer } from './Buffer';
|
||||||
import { EventEmitter } from './EventEmitter';
|
import { EventEmitter } from './EventEmitter';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ITerminal } from './Interfaces';
|
import { ITerminal } from '../typings/xterm-internal';
|
||||||
|
|
||||||
interface IPosition {
|
interface IPosition {
|
||||||
start: number;
|
start: number;
|
||||||
|
|||||||
+2
-2
@@ -4,10 +4,10 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IInputHandler, ITerminal, IInputHandlingTerminal } from './Interfaces';
|
import { CharData, ITerminal } from '../typings/xterm-internal';
|
||||||
|
import { IInputHandler, IInputHandlingTerminal } from './Interfaces';
|
||||||
import { C0 } from './EscapeSequences';
|
import { C0 } from './EscapeSequences';
|
||||||
import { DEFAULT_CHARSET } from './Charsets';
|
import { DEFAULT_CHARSET } from './Charsets';
|
||||||
import { CharData } from './Types';
|
|
||||||
import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX } from './Buffer';
|
import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX } from './Buffer';
|
||||||
import { FLAGS } from './renderer/Types';
|
import { FLAGS } from './renderer/Types';
|
||||||
import { wcwidth } from './CharWidth';
|
import { wcwidth } from './CharWidth';
|
||||||
|
|||||||
+3
-189
@@ -3,64 +3,11 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/// <reference path="../typings/xterm.d.ts"/>
|
import { IEventEmitter } from 'xterm';
|
||||||
|
import { ITerminalOptions, ILinkMatcherOptions, IMouseZoneManager, LinkMatcherHandler, LinkMatcherValidationCallback, LineData, IColorSet, IRenderer, IBufferSet, IBuffer, ISelectionManager } from '../typings/xterm-internal';
|
||||||
|
import { ICharset } from './Interfaces';
|
||||||
|
|
||||||
import { Terminal as PublicTerminal, ITerminalOptions as IPublicTerminalOptions, IEventEmitter } from 'xterm';
|
|
||||||
import { ICharset, ILinkMatcherOptions } from './Interfaces';
|
|
||||||
import { LinkMatcherHandler, LinkMatcherValidationCallback, LineData } from './Types';
|
|
||||||
import { IColorSet, IRenderer } from './renderer/Interfaces';
|
|
||||||
import { IMouseZoneManager } from './input/Interfaces';
|
|
||||||
|
|
||||||
export interface IBrowser {
|
|
||||||
isNode: boolean;
|
|
||||||
userAgent: string;
|
|
||||||
platform: string;
|
|
||||||
isFirefox: boolean;
|
|
||||||
isMSIE: boolean;
|
|
||||||
isMac: boolean;
|
|
||||||
isIpad: boolean;
|
|
||||||
isIphone: boolean;
|
|
||||||
isMSWindows: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IBufferAccessor {
|
|
||||||
buffer: IBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IElementAccessor {
|
|
||||||
element: HTMLElement;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ILinkifierAccessor {
|
|
||||||
linkifier: ILinkifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ITerminal extends PublicTerminal, ILinkifierAccessor, IBufferAccessor, IElementAccessor {
|
|
||||||
selectionManager: ISelectionManager;
|
|
||||||
charMeasure: ICharMeasure;
|
|
||||||
renderer: IRenderer;
|
|
||||||
browser: IBrowser;
|
|
||||||
writeBuffer: string[];
|
|
||||||
cursorHidden: boolean;
|
|
||||||
cursorState: number;
|
|
||||||
defAttr: number;
|
|
||||||
options: ITerminalOptions;
|
|
||||||
buffers: IBufferSet;
|
|
||||||
isFocused: boolean;
|
|
||||||
mouseHelper: IMouseHelper;
|
|
||||||
bracketedPasteMode: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Emit the 'data' event and populate the given data.
|
|
||||||
* @param data The data to populate in the event.
|
|
||||||
*/
|
|
||||||
handler(data: string): void;
|
|
||||||
scrollLines(disp: number, suppressScrollEvent?: boolean): void;
|
|
||||||
cancel(ev: Event, force?: boolean): boolean | void;
|
|
||||||
log(text: string): void;
|
|
||||||
showCursor(): void;
|
|
||||||
blankLine(cur?: boolean, isWrapped?: boolean, cols?: number): LineData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface encapsulates everything needed from the Terminal by the
|
* This interface encapsulates everything needed from the Terminal by the
|
||||||
@@ -125,48 +72,6 @@ export interface IInputHandlingTerminal extends IEventEmitter {
|
|||||||
setOption(key: string, value: any): void;
|
setOption(key: string, value: any): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: The options that are not in the public API should be reviewed
|
|
||||||
export interface ITerminalOptions extends IPublicTerminalOptions {
|
|
||||||
cancelEvents?: boolean;
|
|
||||||
convertEol?: boolean;
|
|
||||||
debug?: boolean;
|
|
||||||
handler?: (data: string) => void;
|
|
||||||
screenKeys?: boolean;
|
|
||||||
termName?: string;
|
|
||||||
useFlowControl?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IBuffer {
|
|
||||||
lines: ICircularList<LineData>;
|
|
||||||
ydisp: number;
|
|
||||||
ybase: number;
|
|
||||||
y: number;
|
|
||||||
x: number;
|
|
||||||
tabs: any;
|
|
||||||
scrollBottom: number;
|
|
||||||
scrollTop: number;
|
|
||||||
savedY: number;
|
|
||||||
savedX: number;
|
|
||||||
isCursorInViewport: boolean;
|
|
||||||
translateBufferLineToString(lineIndex: number, trimRight: boolean, startCol?: number, endCol?: number): string;
|
|
||||||
nextStop(x?: number): number;
|
|
||||||
prevStop(x?: number): number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IBufferSet {
|
|
||||||
alt: IBuffer;
|
|
||||||
normal: IBuffer;
|
|
||||||
active: IBuffer;
|
|
||||||
|
|
||||||
activateNormalBuffer(): void;
|
|
||||||
activateAltBuffer(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IMouseHelper {
|
|
||||||
getCoords(event: {pageX: number, pageY: number}, element: HTMLElement, charMeasure: ICharMeasure, lineHeight: number, colCount: number, rowCount: number, isSelection?: boolean): [number, number];
|
|
||||||
getRawByteCoords(event: MouseEvent, element: HTMLElement, charMeasure: ICharMeasure, lineHeight: number, colCount: number, rowCount: number): { x: number, y: number };
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IViewport {
|
export interface IViewport {
|
||||||
syncScrollArea(): void;
|
syncScrollArea(): void;
|
||||||
onWheel(ev: WheelEvent): void;
|
onWheel(ev: WheelEvent): void;
|
||||||
@@ -175,17 +80,6 @@ export interface IViewport {
|
|||||||
onThemeChanged(colors: IColorSet): void;
|
onThemeChanged(colors: IColorSet): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ISelectionManager {
|
|
||||||
selectionText: string;
|
|
||||||
selectionStart: [number, number];
|
|
||||||
selectionEnd: [number, number];
|
|
||||||
|
|
||||||
disable(): void;
|
|
||||||
enable(): void;
|
|
||||||
setBuffer(buffer: IBuffer): void;
|
|
||||||
setSelection(row: number, col: number, length: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ICompositionHelper {
|
export interface ICompositionHelper {
|
||||||
compositionstart(): void;
|
compositionstart(): void;
|
||||||
compositionupdate(ev: CompositionEvent): void;
|
compositionupdate(ev: CompositionEvent): void;
|
||||||
@@ -194,62 +88,6 @@ export interface ICompositionHelper {
|
|||||||
keydown(ev: KeyboardEvent): boolean;
|
keydown(ev: KeyboardEvent): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICharMeasure {
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
measure(options: ITerminalOptions): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ILinkifier extends IEventEmitter {
|
|
||||||
attachToDom(mouseZoneManager: IMouseZoneManager): void;
|
|
||||||
linkifyRows(start: number, end: number): void;
|
|
||||||
setHypertextLinkHandler(handler: LinkMatcherHandler): void;
|
|
||||||
setHypertextValidationCallback(callback: LinkMatcherValidationCallback): void;
|
|
||||||
registerLinkMatcher(regex: RegExp, handler: LinkMatcherHandler, options?: ILinkMatcherOptions): number;
|
|
||||||
deregisterLinkMatcher(matcherId: number): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ICircularList<T> extends IEventEmitter {
|
|
||||||
length: number;
|
|
||||||
maxLength: number;
|
|
||||||
forEach: (callbackfn: (value: T, index: number) => void) => void;
|
|
||||||
|
|
||||||
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 ILinkMatcherOptions {
|
|
||||||
/**
|
|
||||||
* The index of the link from the regex.match(text) call. This defaults to 0
|
|
||||||
* (for regular expressions without capture groups).
|
|
||||||
*/
|
|
||||||
matchIndex?: number;
|
|
||||||
/**
|
|
||||||
* A callback that validates an individual link, returning true if valid and
|
|
||||||
* false if invalid.
|
|
||||||
*/
|
|
||||||
validationCallback?: LinkMatcherValidationCallback;
|
|
||||||
/**
|
|
||||||
* A callback that fires when the mouse hovers over a link.
|
|
||||||
*/
|
|
||||||
tooltipCallback?: LinkMatcherHandler;
|
|
||||||
/**
|
|
||||||
* A callback that fires when the mouse leaves a link that was hovered.
|
|
||||||
*/
|
|
||||||
leaveCallback?: () => void;
|
|
||||||
/**
|
|
||||||
* The priority of the link matcher, this defines the order in which the link
|
|
||||||
* matcher is evaluated relative to others, from highest to lowest. The
|
|
||||||
* default value is 0.
|
|
||||||
*/
|
|
||||||
priority?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles actions generated by the parser.
|
* Handles actions generated by the parser.
|
||||||
*/
|
*/
|
||||||
@@ -302,30 +140,6 @@ export interface IInputHandler {
|
|||||||
/** CSI u */ restoreCursor(params?: number[]): void;
|
/** CSI u */ restoreCursor(params?: number[]): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITheme {
|
|
||||||
foreground?: string;
|
|
||||||
background?: string;
|
|
||||||
cursor?: string;
|
|
||||||
cursorAccent?: string;
|
|
||||||
selection?: string;
|
|
||||||
black?: string;
|
|
||||||
red?: string;
|
|
||||||
green?: string;
|
|
||||||
yellow?: string;
|
|
||||||
blue?: string;
|
|
||||||
magenta?: string;
|
|
||||||
cyan?: string;
|
|
||||||
white?: string;
|
|
||||||
brightBlack?: string;
|
|
||||||
brightRed?: string;
|
|
||||||
brightGreen?: string;
|
|
||||||
brightYellow?: string;
|
|
||||||
brightBlue?: string;
|
|
||||||
brightMagenta?: string;
|
|
||||||
brightCyan?: string;
|
|
||||||
brightWhite?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ILinkMatcher {
|
export interface ILinkMatcher {
|
||||||
id: number;
|
id: number;
|
||||||
regex: RegExp;
|
regex: RegExp;
|
||||||
|
|||||||
@@ -4,10 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { ITerminal, ILinkifier, ILinkMatcher, IBuffer, IBufferAccessor, IElementAccessor } from './Interfaces';
|
import { ITerminal, ILinkifier, IBuffer, IBufferAccessor, IElementAccessor, LineData, IMouseZoneManager, IMouseZone } from '../typings/xterm-internal';
|
||||||
|
import { ILinkMatcher } from './Interfaces';
|
||||||
import { Linkifier } from './Linkifier';
|
import { Linkifier } from './Linkifier';
|
||||||
import { LineData } from './Types';
|
|
||||||
import { IMouseZoneManager, IMouseZone } from './input/Interfaces';
|
|
||||||
import { MockBuffer } from './utils/TestUtils.test';
|
import { MockBuffer } from './utils/TestUtils.test';
|
||||||
import { CircularList } from './utils/CircularList';
|
import { CircularList } from './utils/CircularList';
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -3,9 +3,9 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ILinkHoverEvent, ILinkMatcher, ILinkMatcherOptions, ITerminal, IBufferAccessor, ILinkifier, IElementAccessor } from './Interfaces';
|
import { ILinkMatcherOptions, ITerminal, IBufferAccessor, ILinkifier, IElementAccessor, LinkMatcherHandler, LinkMatcherValidationCallback, LineData, IMouseZoneManager } from '../typings/xterm-internal';
|
||||||
import { LinkMatcherHandler, LinkMatcherValidationCallback, LineData, LinkHoverEventTypes } from './Types';
|
import { ILinkHoverEvent, ILinkMatcher } from './Interfaces';
|
||||||
import { IMouseZoneManager } from './input/Interfaces';
|
import { LinkHoverEventTypes } from './Types';
|
||||||
import { MouseZone } from './input/MouseZoneManager';
|
import { MouseZone } from './input/MouseZoneManager';
|
||||||
import { EventEmitter } from './EventEmitter';
|
import { EventEmitter } from './EventEmitter';
|
||||||
|
|
||||||
|
|||||||
@@ -4,15 +4,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import jsdom = require('jsdom');
|
import jsdom = require('jsdom');
|
||||||
|
import { ITerminal, ICircularList, IBuffer, LineData, CharData } from '../typings/xterm-internal';
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { ITerminal, ICircularList, IBuffer } from './Interfaces';
|
|
||||||
import { CharMeasure } from './utils/CharMeasure';
|
import { CharMeasure } from './utils/CharMeasure';
|
||||||
import { CircularList } from './utils/CircularList';
|
import { CircularList } from './utils/CircularList';
|
||||||
import { SelectionManager } from './SelectionManager';
|
import { SelectionManager } from './SelectionManager';
|
||||||
import { SelectionModel } from './SelectionModel';
|
import { SelectionModel } from './SelectionModel';
|
||||||
import { BufferSet } from './BufferSet';
|
import { BufferSet } from './BufferSet';
|
||||||
import { MockTerminal } from './utils/TestUtils.test';
|
import { MockTerminal } from './utils/TestUtils.test';
|
||||||
import { LineData, CharData } from './Types';
|
|
||||||
|
|
||||||
class TestMockTerminal extends MockTerminal {
|
class TestMockTerminal extends MockTerminal {
|
||||||
emit(event: string, data: any): void {}
|
emit(event: string, data: any): void {}
|
||||||
|
|||||||
@@ -3,14 +3,13 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { ITerminal, ICircularList, ISelectionManager, IBuffer, LineData, CharData } from '../typings/xterm-internal';
|
||||||
import { MouseHelper } from './utils/MouseHelper';
|
import { MouseHelper } from './utils/MouseHelper';
|
||||||
import * as Browser from './utils/Browser';
|
import * as Browser from './utils/Browser';
|
||||||
import { CharMeasure } from './utils/CharMeasure';
|
import { CharMeasure } from './utils/CharMeasure';
|
||||||
import { CircularList } from './utils/CircularList';
|
import { CircularList } from './utils/CircularList';
|
||||||
import { EventEmitter } from './EventEmitter';
|
import { EventEmitter } from './EventEmitter';
|
||||||
import { ITerminal, ICircularList, ISelectionManager, IBuffer } from './Interfaces';
|
|
||||||
import { SelectionModel } from './SelectionModel';
|
import { SelectionModel } from './SelectionModel';
|
||||||
import { LineData, CharData } from './Types';
|
|
||||||
import { CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX } from './Buffer';
|
import { CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX } from './Buffer';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { ITerminal } from './Interfaces';
|
import { ITerminal } from '../typings/xterm-internal';
|
||||||
import { SelectionModel } from './SelectionModel';
|
import { SelectionModel } from './SelectionModel';
|
||||||
import { BufferSet } from './BufferSet';
|
import { BufferSet } from './BufferSet';
|
||||||
import { MockTerminal } from './utils/TestUtils.test';
|
import { MockTerminal } from './utils/TestUtils.test';
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ITerminal } from './Interfaces';
|
import { ITerminal } from '../typings/xterm-internal';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a selection within the buffer. This model only cares about column
|
* Represents a selection within the buffer. This model only cares about column
|
||||||
|
|||||||
+3
-4
@@ -21,6 +21,7 @@
|
|||||||
* http://linux.die.net/man/7/urxvt
|
* http://linux.die.net/man/7/urxvt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { ITerminalOptions, ITerminal, IBrowser, IRenderer, ILinkifier, IMouseZoneManager, ITheme, LinkMatcherHandler, LinkMatcherValidationCallback, ILinkMatcherOptions, CharData, LineData } from '../typings/xterm-internal';
|
||||||
import { BufferSet } from './BufferSet';
|
import { BufferSet } from './BufferSet';
|
||||||
import { Buffer, MAX_BUFFER_SIZE } from './Buffer';
|
import { Buffer, MAX_BUFFER_SIZE } from './Buffer';
|
||||||
import { CompositionHelper } from './CompositionHelper';
|
import { CompositionHelper } from './CompositionHelper';
|
||||||
@@ -38,14 +39,12 @@ import { CharMeasure } from './utils/CharMeasure';
|
|||||||
import * as Browser from './utils/Browser';
|
import * as Browser from './utils/Browser';
|
||||||
import { MouseHelper } from './utils/MouseHelper';
|
import { MouseHelper } from './utils/MouseHelper';
|
||||||
import { CHARSETS } from './Charsets';
|
import { CHARSETS } from './Charsets';
|
||||||
import { CustomKeyEventHandler, LinkMatcherHandler, LinkMatcherValidationCallback, CharData, LineData } from './Types';
|
import { CustomKeyEventHandler } from './Types';
|
||||||
import { ITerminal, IBrowser, ICharset, ITerminalOptions, IInputHandlingTerminal, ILinkMatcherOptions, IViewport, ICompositionHelper, ITheme, ILinkifier } from './Interfaces';
|
import { ICharset, IInputHandlingTerminal, IViewport, ICompositionHelper } from './Interfaces';
|
||||||
import { BELL_SOUND } from './utils/Sounds';
|
import { BELL_SOUND } from './utils/Sounds';
|
||||||
import { DEFAULT_ANSI_COLORS } from './renderer/ColorManager';
|
import { DEFAULT_ANSI_COLORS } from './renderer/ColorManager';
|
||||||
import { IMouseZoneManager } from './input/Interfaces';
|
|
||||||
import { MouseZoneManager } from './input/MouseZoneManager';
|
import { MouseZoneManager } from './input/MouseZoneManager';
|
||||||
import { initialize as initializeCharAtlas } from './renderer/CharAtlas';
|
import { initialize as initializeCharAtlas } from './renderer/CharAtlas';
|
||||||
import { IRenderer } from './renderer/Interfaces';
|
|
||||||
|
|
||||||
// Let it work inside Node.js for automated testing purposes.
|
// Let it work inside Node.js for automated testing purposes.
|
||||||
const document = (typeof window !== 'undefined') ? window.document : null;
|
const document = (typeof window !== 'undefined') ? window.document : null;
|
||||||
|
|||||||
@@ -3,14 +3,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type LinkMatcherHandler = (event: MouseEvent, uri: string) => boolean | void;
|
|
||||||
export type LinkMatcherValidationCallback = (uri: string, callback: (isValid: boolean) => void) => void;
|
|
||||||
|
|
||||||
export type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;
|
export type CustomKeyEventHandler = (event: KeyboardEvent) => boolean;
|
||||||
|
|
||||||
export type CharData = [number, string, number, number];
|
|
||||||
export type LineData = CharData[];
|
|
||||||
|
|
||||||
export enum LinkHoverEventTypes {
|
export enum LinkHoverEventTypes {
|
||||||
HOVER = 'linkhover',
|
HOVER = 'linkhover',
|
||||||
TOOLTIP = 'linktooltip',
|
TOOLTIP = 'linktooltip',
|
||||||
|
|||||||
+2
-2
@@ -3,9 +3,9 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ITerminal, IViewport } from './Interfaces';
|
import { ITerminal, IColorSet } from '../typings/xterm-internal';
|
||||||
|
import { IViewport } from './Interfaces';
|
||||||
import { CharMeasure } from './utils/CharMeasure';
|
import { CharMeasure } from './utils/CharMeasure';
|
||||||
import { IColorSet } from './renderer/Interfaces';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the viewport of a terminal, the visible area within the larger buffer of output.
|
* Represents the viewport of a terminal, the visible area within the larger buffer of output.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ITerminal, ISelectionManager } from '../Interfaces';
|
import { ITerminal, ISelectionManager } from '../../typings/xterm-internal';
|
||||||
|
|
||||||
interface IWindow extends Window {
|
interface IWindow extends Window {
|
||||||
clipboardData?: {
|
clipboardData?: {
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
|
|
||||||
* @license MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
export interface IMouseZoneManager {
|
|
||||||
add(zone: IMouseZone): void;
|
|
||||||
clearAll(start?: number, end?: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IMouseZone {
|
|
||||||
x1: number;
|
|
||||||
x2: number;
|
|
||||||
y: number;
|
|
||||||
clickCallback: (e: MouseEvent) => any;
|
|
||||||
hoverCallback?: (e: MouseEvent) => any;
|
|
||||||
tooltipCallback?: (e: MouseEvent) => any;
|
|
||||||
leaveCallback?: () => any;
|
|
||||||
}
|
|
||||||
@@ -3,8 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IMouseZoneManager, IMouseZone } from './Interfaces';
|
import { IMouseZoneManager, IMouseZone, ITerminal } from '../../typings/xterm-internal';
|
||||||
import { ITerminal } from '../Interfaces';
|
|
||||||
|
|
||||||
const HOVER_DURATION = 500;
|
const HOVER_DURATION = 500;
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,9 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IRenderLayer, IColorSet, IRenderDimensions } from './Interfaces';
|
import { IColorSet, IRenderDimensions, ITerminal, ITerminalOptions, CharData } from '../../typings/xterm-internal';
|
||||||
import { ITerminal, ITerminalOptions } from '../Interfaces';
|
import { IRenderLayer } from './Interfaces';
|
||||||
import { acquireCharAtlas, CHAR_ATLAS_CELL_SPACING } from './CharAtlas';
|
import { acquireCharAtlas, CHAR_ATLAS_CELL_SPACING } from './CharAtlas';
|
||||||
import { CharData } from '../Types';
|
|
||||||
import { CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX } from '../Buffer';
|
import { CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX } from '../Buffer';
|
||||||
|
|
||||||
export const INVERTED_DEFAULT_COLOR = -1;
|
export const INVERTED_DEFAULT_COLOR = -1;
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ITerminal, ITheme } from '../Interfaces';
|
import { ITerminal, ITheme, IColorSet } from '../../typings/xterm-internal';
|
||||||
import { IColorSet } from '../renderer/Interfaces';
|
|
||||||
import { isFirefox } from '../utils/Browser';
|
import { isFirefox } from '../utils/Browser';
|
||||||
|
|
||||||
export const CHAR_ATLAS_CELL_SPACING = 1;
|
export const CHAR_ATLAS_CELL_SPACING = 1;
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IColorSet, IColorManager } from './Interfaces';
|
import { IColorSet, IColorManager, ITheme } from '../../typings/xterm-internal';
|
||||||
import { ITheme } from '../Interfaces';
|
|
||||||
|
|
||||||
const DEFAULT_FOREGROUND = '#ffffff';
|
const DEFAULT_FOREGROUND = '#ffffff';
|
||||||
const DEFAULT_BACKGROUND = '#000000';
|
const DEFAULT_BACKGROUND = '#000000';
|
||||||
|
|||||||
@@ -3,13 +3,12 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IColorSet, IRenderDimensions } from './Interfaces';
|
import { IColorSet, IRenderDimensions, IBuffer, ICharMeasure, ITerminal, ITerminalOptions, CharData } from '../../typings/xterm-internal';
|
||||||
import { IBuffer, ICharMeasure, ITerminal, ITerminalOptions } from '../Interfaces';
|
|
||||||
import { CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CODE_INDEX, CHAR_DATA_CHAR_INDEX } from '../Buffer';
|
import { CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CODE_INDEX, CHAR_DATA_CHAR_INDEX } from '../Buffer';
|
||||||
import { GridCache } from './GridCache';
|
import { GridCache } from './GridCache';
|
||||||
import { FLAGS } from './Types';
|
import { FLAGS } from './Types';
|
||||||
import { BaseRenderLayer } from './BaseRenderLayer';
|
import { BaseRenderLayer } from './BaseRenderLayer';
|
||||||
import { CharData } from '../Types';
|
import { } from '../Types';
|
||||||
|
|
||||||
interface ICursorState {
|
interface ICursorState {
|
||||||
x: number;
|
x: number;
|
||||||
|
|||||||
@@ -3,26 +3,10 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ITerminal, ITerminalOptions, ITheme } from '../Interfaces';
|
import { IColorSet, IRenderDimensions, ITerminal } from '../../typings/xterm-internal';
|
||||||
|
|
||||||
import { IEventEmitter } from 'xterm';
|
import { IEventEmitter } from 'xterm';
|
||||||
|
|
||||||
export interface IRenderer extends IEventEmitter {
|
|
||||||
dimensions: IRenderDimensions;
|
|
||||||
colorManager: IColorManager;
|
|
||||||
|
|
||||||
setTheme(theme: ITheme): IColorSet;
|
|
||||||
onWindowResize(devicePixelRatio: number): void;
|
|
||||||
onResize(cols: number, rows: number, didCharSizeChange: boolean): void;
|
|
||||||
onCharSizeChanged(): void;
|
|
||||||
onBlur(): void;
|
|
||||||
onFocus(): void;
|
|
||||||
onSelectionChanged(start: [number, number], end: [number, number]): void;
|
|
||||||
onCursorMove(): void;
|
|
||||||
onOptionsChanged(): void;
|
|
||||||
clear(): void;
|
|
||||||
queueRefresh(start: number, end: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IRenderLayer {
|
export interface IRenderLayer {
|
||||||
/**
|
/**
|
||||||
* Called when the terminal loses focus.
|
* Called when the terminal loses focus.
|
||||||
@@ -70,31 +54,3 @@ export interface IRenderLayer {
|
|||||||
*/
|
*/
|
||||||
reset(terminal: ITerminal): void;
|
reset(terminal: ITerminal): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IColorManager {
|
|
||||||
colors: IColorSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IColorSet {
|
|
||||||
foreground: string;
|
|
||||||
background: string;
|
|
||||||
cursor: string;
|
|
||||||
cursorAccent: string;
|
|
||||||
selection: string;
|
|
||||||
ansi: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IRenderDimensions {
|
|
||||||
scaledCharWidth: number;
|
|
||||||
scaledCharHeight: number;
|
|
||||||
scaledCellWidth: number;
|
|
||||||
scaledCellHeight: number;
|
|
||||||
scaledCharLeft: number;
|
|
||||||
scaledCharTop: number;
|
|
||||||
scaledCanvasWidth: number;
|
|
||||||
scaledCanvasHeight: number;
|
|
||||||
canvasWidth: number;
|
|
||||||
canvasHeight: number;
|
|
||||||
actualCellWidth: number;
|
|
||||||
actualCellHeight: number;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IColorSet, IRenderDimensions } from './Interfaces';
|
import { IColorSet, IRenderDimensions, ITerminal, ILinkifierAccessor, IBuffer, ICharMeasure } from '../../typings/xterm-internal';
|
||||||
import { IBuffer, ICharMeasure, ILinkHoverEvent, ITerminal, ILinkifierAccessor } from '../Interfaces';
|
import { ILinkHoverEvent } from '../Interfaces';
|
||||||
import { CHAR_DATA_ATTR_INDEX } from '../Buffer';
|
import { CHAR_DATA_ATTR_INDEX } from '../Buffer';
|
||||||
import { GridCache } from './GridCache';
|
import { GridCache } from './GridCache';
|
||||||
import { FLAGS } from './Types';
|
import { FLAGS } from './Types';
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ITerminal, ITheme } from '../Interfaces';
|
import { ITerminal, ITheme, IColorSet, IRenderer, IRenderDimensions } from '../../typings/xterm-internal';
|
||||||
import { CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX } from '../Buffer';
|
import { CHAR_DATA_WIDTH_INDEX, CHAR_DATA_CHAR_INDEX } from '../Buffer';
|
||||||
import { TextRenderLayer } from './TextRenderLayer';
|
import { TextRenderLayer } from './TextRenderLayer';
|
||||||
import { SelectionRenderLayer } from './SelectionRenderLayer';
|
import { SelectionRenderLayer } from './SelectionRenderLayer';
|
||||||
import { CursorRenderLayer } from './CursorRenderLayer';
|
import { CursorRenderLayer } from './CursorRenderLayer';
|
||||||
import { ColorManager } from './ColorManager';
|
import { ColorManager } from './ColorManager';
|
||||||
import { BaseRenderLayer } from './BaseRenderLayer';
|
import { BaseRenderLayer } from './BaseRenderLayer';
|
||||||
import { IRenderLayer, IColorSet, IRenderer, IRenderDimensions } from './Interfaces';
|
import { IRenderLayer } from './Interfaces';
|
||||||
import { LinkRenderLayer } from './LinkRenderLayer';
|
import { LinkRenderLayer } from './LinkRenderLayer';
|
||||||
import { EventEmitter } from '../EventEmitter';
|
import { EventEmitter } from '../EventEmitter';
|
||||||
import { ScreenDprMonitor } from '../utils/ScreenDprMonitor';
|
import { ScreenDprMonitor } from '../utils/ScreenDprMonitor';
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IColorSet, IRenderDimensions } from './Interfaces';
|
import { IColorSet, IRenderDimensions, IBuffer, ICharMeasure, ITerminal } from '../../typings/xterm-internal';
|
||||||
import { IBuffer, ICharMeasure, ITerminal } from '../Interfaces';
|
|
||||||
import { CHAR_DATA_ATTR_INDEX } from '../Buffer';
|
import { CHAR_DATA_ATTR_INDEX } from '../Buffer';
|
||||||
import { GridCache } from './GridCache';
|
import { GridCache } from './GridCache';
|
||||||
import { FLAGS } from './Types';
|
import { FLAGS } from './Types';
|
||||||
|
|||||||
@@ -3,12 +3,10 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IColorSet, IRenderDimensions } from './Interfaces';
|
import { IBuffer, ICharMeasure, ITerminal, IColorSet, IRenderDimensions, CharData } from '../../typings/xterm-internal';
|
||||||
import { IBuffer, ICharMeasure, ITerminal } from '../Interfaces';
|
|
||||||
import { CHAR_DATA_ATTR_INDEX, CHAR_DATA_CODE_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX } from '../Buffer';
|
import { CHAR_DATA_ATTR_INDEX, CHAR_DATA_CODE_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX } from '../Buffer';
|
||||||
import { FLAGS } from './Types';
|
import { FLAGS } from './Types';
|
||||||
import { GridCache } from './GridCache';
|
import { GridCache } from './GridCache';
|
||||||
import { CharData } from '../Types';
|
|
||||||
import { BaseRenderLayer, INVERTED_DEFAULT_COLOR } from './BaseRenderLayer';
|
import { BaseRenderLayer, INVERTED_DEFAULT_COLOR } from './BaseRenderLayer';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import jsdom = require('jsdom');
|
import jsdom = require('jsdom');
|
||||||
|
import { ICharMeasure, ITerminal } from '../../typings/xterm-internal';
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { ICharMeasure, ITerminal } from '../Interfaces';
|
|
||||||
import { CharMeasure } from './CharMeasure';
|
import { CharMeasure } from './CharMeasure';
|
||||||
|
|
||||||
describe('CharMeasure', () => {
|
describe('CharMeasure', () => {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { ICharMeasure, ITerminal, ITerminalOptions } from '../../typings/xterm-internal';
|
||||||
import { EventEmitter } from '../EventEmitter';
|
import { EventEmitter } from '../EventEmitter';
|
||||||
import { ICharMeasure, ITerminal, ITerminalOptions } from '../Interfaces';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { EventEmitter } from '../EventEmitter';
|
import { EventEmitter } from '../EventEmitter';
|
||||||
import { ICircularList } from '../Interfaces';
|
import { ICircularList } from '../../typings/xterm-internal';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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,
|
||||||
|
|||||||
@@ -3,8 +3,7 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ICharMeasure } from '../Interfaces';
|
import { ICharMeasure, IRenderer } from '../../typings/xterm-internal';
|
||||||
import { IRenderer } from '../renderer/Interfaces';
|
|
||||||
|
|
||||||
export class MouseHelper {
|
export class MouseHelper {
|
||||||
constructor(private _renderer: IRenderer) {}
|
constructor(private _renderer: IRenderer) {}
|
||||||
@@ -24,7 +23,7 @@ export class MouseHelper {
|
|||||||
while (element) {
|
while (element) {
|
||||||
x -= element.offsetLeft;
|
x -= element.offsetLeft;
|
||||||
y -= element.offsetTop;
|
y -= element.offsetTop;
|
||||||
element = 'offsetParent' in element ? <HTMLElement>element.offsetParent : <HTMLElement>element.parentElement;
|
element = <HTMLElement>element.offsetParent;
|
||||||
}
|
}
|
||||||
element = originalElement;
|
element = originalElement;
|
||||||
while (element && element !== element.ownerDocument.body) {
|
while (element && element !== element.ownerDocument.body) {
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ITerminal, IBuffer, IBufferSet, IBrowser, ICharMeasure, ISelectionManager, ITerminalOptions, IInputHandlingTerminal, IViewport, ICircularList, ICompositionHelper, ITheme, ILinkifier, IMouseHelper, ILinkMatcherOptions } from '../Interfaces';
|
import { ITerminal, IBuffer, IBufferSet, IBrowser, ICharMeasure, ISelectionManager, ITerminalOptions, ICircularList, ITheme, ILinkifier, IMouseHelper, ILinkMatcherOptions, LineData, IColorSet, IRenderer, IRenderDimensions, IColorManager } from '../../typings/xterm-internal';
|
||||||
import { LineData } from '../Types';
|
import { IInputHandlingTerminal, IViewport, ICompositionHelper } from '../Interfaces';
|
||||||
|
import { } from '../Types';
|
||||||
import { Buffer } from '../Buffer';
|
import { Buffer } from '../Buffer';
|
||||||
import * as Browser from './Browser';
|
import * as Browser from './Browser';
|
||||||
import { IColorSet, IRenderer, IRenderDimensions, IColorManager } from '../renderer/Interfaces';
|
|
||||||
|
|
||||||
export class MockTerminal implements ITerminal {
|
export class MockTerminal implements ITerminal {
|
||||||
getOption(key: any): any {
|
getOption(key: any): any {
|
||||||
|
|||||||
Vendored
+259
@@ -0,0 +1,259 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
|
||||||
|
* @license MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// <reference path="./xterm.d.ts"/>
|
||||||
|
|
||||||
|
import { Terminal as PublicTerminal, ITerminalOptions as IPublicTerminalOptions, IEventEmitter } from 'xterm';
|
||||||
|
|
||||||
|
export type CharData = [number, string, number, number];
|
||||||
|
export type LineData = CharData[];
|
||||||
|
|
||||||
|
export type LinkMatcherHandler = (event: MouseEvent, uri: string) => boolean | void;
|
||||||
|
export type LinkMatcherValidationCallback = (uri: string, callback: (isValid: boolean) => void) => void;
|
||||||
|
|
||||||
|
export interface ITerminal extends PublicTerminal, IElementAccessor, IBufferAccessor, ILinkifierAccessor {
|
||||||
|
selectionManager: ISelectionManager;
|
||||||
|
charMeasure: ICharMeasure;
|
||||||
|
renderer: IRenderer;
|
||||||
|
browser: IBrowser;
|
||||||
|
writeBuffer: string[];
|
||||||
|
cursorHidden: boolean;
|
||||||
|
cursorState: number;
|
||||||
|
defAttr: number;
|
||||||
|
options: ITerminalOptions;
|
||||||
|
buffer: IBuffer;
|
||||||
|
buffers: IBufferSet;
|
||||||
|
isFocused: boolean;
|
||||||
|
mouseHelper: IMouseHelper;
|
||||||
|
bracketedPasteMode: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emit the 'data' event and populate the given data.
|
||||||
|
* @param data The data to populate in the event.
|
||||||
|
*/
|
||||||
|
handler(data: string): void;
|
||||||
|
scrollLines(disp: number, suppressScrollEvent?: boolean): void;
|
||||||
|
cancel(ev: Event, force?: boolean): boolean | void;
|
||||||
|
log(text: string): void;
|
||||||
|
showCursor(): void;
|
||||||
|
blankLine(cur?: boolean, isWrapped?: boolean, cols?: number): LineData;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IBufferAccessor {
|
||||||
|
buffer: IBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IElementAccessor {
|
||||||
|
element: HTMLElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ILinkifierAccessor {
|
||||||
|
linkifier: ILinkifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IMouseHelper {
|
||||||
|
getCoords(event: {pageX: number, pageY: number}, element: HTMLElement, charMeasure: ICharMeasure, lineHeight: number, colCount: number, rowCount: number, isSelection?: boolean): [number, number];
|
||||||
|
getRawByteCoords(event: MouseEvent, element: HTMLElement, charMeasure: ICharMeasure, lineHeight: number, colCount: number, rowCount: number): { x: number, y: number };
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICharMeasure {
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
measure(options: ITerminalOptions): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: The options that are not in the public API should be reviewed
|
||||||
|
export interface ITerminalOptions extends IPublicTerminalOptions {
|
||||||
|
cancelEvents?: boolean;
|
||||||
|
convertEol?: boolean;
|
||||||
|
debug?: boolean;
|
||||||
|
handler?: (data: string) => void;
|
||||||
|
screenKeys?: boolean;
|
||||||
|
termName?: string;
|
||||||
|
useFlowControl?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IBuffer {
|
||||||
|
lines: ICircularList<LineData>;
|
||||||
|
ydisp: number;
|
||||||
|
ybase: number;
|
||||||
|
y: number;
|
||||||
|
x: number;
|
||||||
|
tabs: any;
|
||||||
|
scrollBottom: number;
|
||||||
|
scrollTop: number;
|
||||||
|
savedY: number;
|
||||||
|
savedX: number;
|
||||||
|
isCursorInViewport: boolean;
|
||||||
|
translateBufferLineToString(lineIndex: number, trimRight: boolean, startCol?: number, endCol?: number): string;
|
||||||
|
nextStop(x?: number): number;
|
||||||
|
prevStop(x?: number): number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IBufferSet {
|
||||||
|
alt: IBuffer;
|
||||||
|
normal: IBuffer;
|
||||||
|
active: IBuffer;
|
||||||
|
|
||||||
|
activateNormalBuffer(): void;
|
||||||
|
activateAltBuffer(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICircularList<T> extends IEventEmitter {
|
||||||
|
length: number;
|
||||||
|
maxLength: number;
|
||||||
|
forEach: (callbackfn: (value: T, index: number) => void) => void;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
selectionText: string;
|
||||||
|
selectionStart: [number, number];
|
||||||
|
selectionEnd: [number, number];
|
||||||
|
|
||||||
|
disable(): void;
|
||||||
|
enable(): void;
|
||||||
|
setBuffer(buffer: IBuffer): void;
|
||||||
|
setSelection(row: number, col: number, length: number): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ILinkifier extends IEventEmitter {
|
||||||
|
attachToDom(mouseZoneManager: IMouseZoneManager): void;
|
||||||
|
linkifyRows(start: number, end: number): void;
|
||||||
|
setHypertextLinkHandler(handler: LinkMatcherHandler): void;
|
||||||
|
setHypertextValidationCallback(callback: LinkMatcherValidationCallback): void;
|
||||||
|
registerLinkMatcher(regex: RegExp, handler: LinkMatcherHandler, options?: ILinkMatcherOptions): number;
|
||||||
|
deregisterLinkMatcher(matcherId: number): boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ILinkMatcherOptions {
|
||||||
|
/**
|
||||||
|
* The index of the link from the regex.match(text) call. This defaults to 0
|
||||||
|
* (for regular expressions without capture groups).
|
||||||
|
*/
|
||||||
|
matchIndex?: number;
|
||||||
|
/**
|
||||||
|
* A callback that validates an individual link, returning true if valid and
|
||||||
|
* false if invalid.
|
||||||
|
*/
|
||||||
|
validationCallback?: LinkMatcherValidationCallback;
|
||||||
|
/**
|
||||||
|
* A callback that fires when the mouse hovers over a link.
|
||||||
|
*/
|
||||||
|
tooltipCallback?: LinkMatcherHandler;
|
||||||
|
/**
|
||||||
|
* A callback that fires when the mouse leaves a link that was hovered.
|
||||||
|
*/
|
||||||
|
leaveCallback?: () => void;
|
||||||
|
/**
|
||||||
|
* The priority of the link matcher, this defines the order in which the link
|
||||||
|
* matcher is evaluated relative to others, from highest to lowest. The
|
||||||
|
* default value is 0.
|
||||||
|
*/
|
||||||
|
priority?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IBrowser {
|
||||||
|
isNode: boolean;
|
||||||
|
userAgent: string;
|
||||||
|
platform: string;
|
||||||
|
isFirefox: boolean;
|
||||||
|
isMSIE: boolean;
|
||||||
|
isMac: boolean;
|
||||||
|
isIpad: boolean;
|
||||||
|
isIphone: boolean;
|
||||||
|
isMSWindows: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IMouseZoneManager {
|
||||||
|
add(zone: IMouseZone): void;
|
||||||
|
clearAll(start?: number, end?: number): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IMouseZone {
|
||||||
|
x1: number;
|
||||||
|
x2: number;
|
||||||
|
y: number;
|
||||||
|
clickCallback: (e: MouseEvent) => any;
|
||||||
|
hoverCallback?: (e: MouseEvent) => any;
|
||||||
|
tooltipCallback?: (e: MouseEvent) => any;
|
||||||
|
leaveCallback?: () => any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IRenderer extends IEventEmitter {
|
||||||
|
dimensions: IRenderDimensions;
|
||||||
|
colorManager: IColorManager;
|
||||||
|
|
||||||
|
setTheme(theme: ITheme): IColorSet;
|
||||||
|
onWindowResize(devicePixelRatio: number): void;
|
||||||
|
onResize(cols: number, rows: number, didCharSizeChange: boolean): void;
|
||||||
|
onCharSizeChanged(): void;
|
||||||
|
onBlur(): void;
|
||||||
|
onFocus(): void;
|
||||||
|
onSelectionChanged(start: [number, number], end: [number, number]): void;
|
||||||
|
onCursorMove(): void;
|
||||||
|
onOptionsChanged(): void;
|
||||||
|
clear(): void;
|
||||||
|
queueRefresh(start: number, end: number): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IColorManager {
|
||||||
|
colors: IColorSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IColorSet {
|
||||||
|
foreground: string;
|
||||||
|
background: string;
|
||||||
|
cursor: string;
|
||||||
|
cursorAccent: string;
|
||||||
|
selection: string;
|
||||||
|
ansi: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IRenderDimensions {
|
||||||
|
scaledCharWidth: number;
|
||||||
|
scaledCharHeight: number;
|
||||||
|
scaledCellWidth: number;
|
||||||
|
scaledCellHeight: number;
|
||||||
|
scaledCharLeft: number;
|
||||||
|
scaledCharTop: number;
|
||||||
|
scaledCanvasWidth: number;
|
||||||
|
scaledCanvasHeight: number;
|
||||||
|
canvasWidth: number;
|
||||||
|
canvasHeight: number;
|
||||||
|
actualCellWidth: number;
|
||||||
|
actualCellHeight: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ITheme {
|
||||||
|
foreground?: string;
|
||||||
|
background?: string;
|
||||||
|
cursor?: string;
|
||||||
|
cursorAccent?: string;
|
||||||
|
selection?: string;
|
||||||
|
black?: string;
|
||||||
|
red?: string;
|
||||||
|
green?: string;
|
||||||
|
yellow?: string;
|
||||||
|
blue?: string;
|
||||||
|
magenta?: string;
|
||||||
|
cyan?: string;
|
||||||
|
white?: string;
|
||||||
|
brightBlack?: string;
|
||||||
|
brightRed?: string;
|
||||||
|
brightGreen?: string;
|
||||||
|
brightYellow?: string;
|
||||||
|
brightBlue?: string;
|
||||||
|
brightMagenta?: string;
|
||||||
|
brightCyan?: string;
|
||||||
|
brightWhite?: string;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user