Split common into composite subprojects with project references

- common/tsconfig.json is a solution root referencing layer tsconfigs
- Each layer has composite tsconfig with correct references and outDir
- Break buffer/services cycle via buffer-local service interfaces
- Move cell types, keyboard/unicode types, TaskQueue, and TerminalOptions
- Exclude *.test.ts from composite builds; fix parser IDisposable imports

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-05-30 17:32:03 +00:00
co-authored by Daniel Imms
parent 6ff26d2c7e
commit eacf90b2b7
76 changed files with 1192 additions and 355 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ import { computeNextVariantOffset, treatGlyphAsBackgroundColor, isPowerlineGlyph
import { IBoundingBox, ICharAtlasConfig, IRasterizedGlyph, ITextureAtlas } from './Types';
import { NULL_COLOR, channels, color, rgba } from 'common/services/Color';
import { FourKeyMap } from 'common/base/MultiKeyMap';
import { IdleTaskQueue } from 'common/services/TaskQueue';
import { IdleTaskQueue } from 'common/base/TaskQueue';
import { IColor } from 'common/services/Types';
import { AttributeData } from 'common/buffer/AttributeData';
import { Attributes, DEFAULT_COLOR, DEFAULT_EXT, UnderlineStyle } from 'common/buffer/Constants';
+1 -1
View File
@@ -8,7 +8,7 @@ import { IRenderDebouncerWithCallback } from 'browser/Types';
import { IRenderDimensions, IRenderer } from 'browser/renderer/shared/Types';
import { ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
import { Disposable, MutableDisposable, toDisposable } from 'common/base/Lifecycle';
import { DebouncedIdleTask } from 'common/services/TaskQueue';
import { DebouncedIdleTask } from 'common/base/TaskQueue';
import { IBufferService, ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services';
import { Emitter } from 'common/base/Event';
+4 -3
View File
@@ -54,7 +54,8 @@ flowchart BT
## TypeScript projects
- **`common/tsconfig.json`** — composite build for all layers (resolves existing `buffer` ↔ `services` imports).
- **`common/<layer>/tsconfig.json`** — per-layer config extending the root (`noEmit`) for tooling and future split into referenced composite projects.
- **`common/tsconfig.json`** — solution root; references each layer project (no sources).
- **`common/tsconfig.compiler.json`** — shared `lib`, `paths`, and `types` for layer projects.
- **`common/<layer>/tsconfig.json`** — composite project with `references` matching the dependency graph above. Test files (`**/*.test.ts`) are excluded from composite builds; unit tests compile via esbuild.
Enforcing one-way project references at compile time (separate `out` per layer) is follow-up work once `Types` and buffer service interfaces are decoupled.
Buffer-layer code depends on `buffer/BufferService`, `buffer/BufferOptions`, and `buffer/BufferLog` instead of `services` so the `buffer` project does not reference `services`.
@@ -3,7 +3,9 @@
* @license MIT
*/
import type { ILogService } from 'common/services/Services';
export interface ITaskQueueLogService {
warn(message: any, ...optionalParams: any[]): void;
}
interface ITaskQueue {
/**
@@ -34,9 +36,9 @@ abstract class TaskQueue implements ITaskQueue {
private _tasks: (() => boolean | void)[] = [];
private _idleCallback?: number;
private _i = 0;
protected readonly _logService: ILogService;
protected readonly _logService: ITaskQueueLogService;
constructor(logService: ILogService) {
constructor(logService: ITaskQueueLogService) {
this._logService = logService;
}
@@ -156,7 +158,7 @@ export const IdleTaskQueue = ('requestIdleCallback' in globalThis) ? IdleTaskQue
export class DebouncedIdleTask {
private _queue: ITaskQueue;
constructor(logService: ILogService) {
constructor(logService: ITaskQueueLogService) {
this._queue = new IdleTaskQueue(logService);
}
+13
View File
@@ -0,0 +1,13 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { ITerminalOptions as IPublicTerminalOptions } from '@xterm/xterm';
// TODO: The options that are not in the public API should be reviewed
export interface ITerminalOptions extends IPublicTerminalOptions {
[key: string]: any;
convertEol?: boolean;
termName?: string;
}
+12 -3
View File
@@ -1,8 +1,17 @@
{
"extends": ["../tsconfig.json"],
"extends": [
"../../tsconfig-library-base",
"../tsconfig.compiler.json"
],
"compilerOptions": {
"noEmit": true,
"outDir": "../../../out/common/base",
"rootDir": "."
},
"include": ["./**/*"]
"include": [
"./**/*",
"../../../typings/xterm.d.ts"
],
"exclude": [
"**/*.test.ts"
]
}
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { IAttributeData, IColorRGB, IExtendedAttrs } from 'common/services/Types';
import { IAttributeData, IColorRGB, IExtendedAttrs } from 'common/buffer/CellTypes';
import { Attributes, FgFlags, BgFlags, UnderlineStyle, ExtFlags } from 'common/buffer/Constants';
export class AttributeData implements IAttributeData {
+8 -5
View File
@@ -5,8 +5,12 @@
import { CircularList, IInsertEvent } from 'common/base/CircularList';
import { Disposable, toDisposable } from 'common/base/Lifecycle';
import { IdleTaskQueue } from 'common/services/TaskQueue';
import { IAttributeData, IBufferLine, ICellData, ICharset } from 'common/services/Types';
import { IdleTaskQueue } from 'common/base/TaskQueue';
import type { IAttributeData, IBufferLine, ICellData } from 'common/buffer/CellTypes';
import type { ICharset } from 'common/data/Charsets';
import type { IBufferService } from 'common/buffer/BufferService';
import type { IBufferOptionsService } from 'common/buffer/BufferOptions';
import type { IBufferLogService } from 'common/buffer/BufferLog';
import { ExtendedAttrs } from 'common/buffer/AttributeData';
import { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
import { BufferLineStringCache } from 'common/buffer/BufferLineStringCache';
@@ -16,7 +20,6 @@ import { NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR,
import { Marker } from 'common/buffer/Marker';
import { IBuffer } from 'common/buffer/Types';
import { DEFAULT_CHARSET } from 'common/data/Charsets';
import { IBufferService, ILogService, IOptionsService } from 'common/services/Services';
export const MAX_BUFFER_SIZE = 4294967295; // 2^32 - 1
@@ -56,9 +59,9 @@ export class Buffer extends Disposable implements IBuffer {
constructor(
private _hasScrollback: boolean,
private _optionsService: IOptionsService,
private _optionsService: IBufferOptionsService,
private _bufferService: IBufferService,
private readonly _logService: ILogService
private readonly _logService: IBufferLogService
) {
super();
this._cols = this._bufferService.cols;
+1 -1
View File
@@ -6,7 +6,7 @@ import { NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE, DEFAULT_ATTR, Content,
import { BufferLine } from 'common/buffer/BufferLine';
import { BufferLineStringCache } from 'common/buffer/BufferLineStringCache';
import { CellData } from 'common/buffer/CellData';
import { CharData, IBufferLine, ICellData } from 'common/services/Types';
import { CharData, IBufferLine, ICellData } from 'common/buffer/CellTypes';
import { assert } from 'chai';
import { AttributeData } from 'common/buffer/AttributeData';
import { createCellData, NULL_CELL_DATA, extendedAttributes } from 'common/terminal/TestUtils.test';
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { CharData, IAttributeData, IBufferLine, ICellData, IExtendedAttrs } from 'common/services/Types';
import { CharData, IAttributeData, IBufferLine, ICellData, IExtendedAttrs } from 'common/buffer/CellTypes';
import { AttributeData } from 'common/buffer/AttributeData';
import { CellData } from 'common/buffer/CellData';
import { Attributes, BgFlags, CHAR_DATA_ATTR_INDEX, CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, Content, NULL_CELL_CHAR, NULL_CELL_CODE, NULL_CELL_WIDTH, WHITESPACE_CELL_CHAR } from 'common/buffer/Constants';
+8
View File
@@ -0,0 +1,8 @@
/**
* Copyright (c) 2022 The xterm.js authors. All rights reserved.
* @license MIT
*/
export interface IBufferLogService {
warn(message: any, ...optionalParams: any[]): void;
}
+15
View File
@@ -0,0 +1,15 @@
/**
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*/
import type { IDisposable } from 'common/base/Lifecycle';
import type { ITerminalOptions } from 'common/base/TerminalOptions';
/**
* Options surface used by the buffer layer.
*/
export interface IBufferOptionsService {
readonly rawOptions: Required<ITerminalOptions>;
onSpecificOptionChange<K extends keyof ITerminalOptions>(key: K, callback: (value: ITerminalOptions[K]) => void): IDisposable;
}
+1 -1
View File
@@ -5,7 +5,7 @@
import { BufferLine } from 'common/buffer/BufferLine';
import { CircularList } from 'common/base/CircularList';
import { IBufferLine, ICellData } from 'common/services/Types';
import { IBufferLine, ICellData } from 'common/buffer/CellTypes';
export interface INewLayoutResult {
layout: number[];
+31
View File
@@ -0,0 +1,31 @@
/**
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*/
import type { IEvent } from 'common/base/Event';
import type { IAttributeData } from 'common/buffer/CellTypes';
import type { IBuffer, IBufferSet } from 'common/buffer/Types';
export interface IBufferResizeEvent {
cols: number;
rows: number;
colsChanged: boolean;
rowsChanged: boolean;
}
export interface IBufferService {
serviceBrand: undefined;
readonly cols: number;
readonly rows: number;
readonly buffer: IBuffer;
readonly buffers: IBufferSet;
isUserScrolling: boolean;
onResize: IEvent<IBufferResizeEvent>;
onScroll: IEvent<number>;
scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;
scrollLines(disp: number, suppressScrollEvent?: boolean): void;
resize(cols: number, rows: number): void;
reset(): void;
}
+6 -4
View File
@@ -4,10 +4,12 @@
*/
import { Disposable, MutableDisposable } from 'common/base/Lifecycle';
import { IAttributeData } from 'common/services/Types';
import type { IAttributeData } from 'common/buffer/CellTypes';
import { Buffer } from 'common/buffer/Buffer';
import { IBuffer, IBufferSet } from 'common/buffer/Types';
import { IBufferService, ILogService, IOptionsService } from 'common/services/Services';
import type { IBufferService } from 'common/buffer/BufferService';
import type { IBufferOptionsService } from 'common/buffer/BufferOptions';
import type { IBufferLogService } from 'common/buffer/BufferLog';
import { Emitter } from 'common/base/Event';
/**
@@ -28,9 +30,9 @@ export class BufferSet extends Disposable implements IBufferSet {
* Create a new BufferSet for the given terminal.
*/
constructor(
private readonly _optionsService: IOptionsService,
private readonly _optionsService: IBufferOptionsService,
private readonly _bufferService: IBufferService,
private readonly _logService: ILogService
private readonly _logService: IBufferLogService
) {
super();
this.reset();
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { CharData, ICellData, IExtendedAttrs } from 'common/services/Types';
import { CharData, ICellData, IExtendedAttrs } from 'common/buffer/CellTypes';
import { stringFromCodePoint } from 'common/encoding/TextDecoder';
import { CHAR_DATA_CHAR_INDEX, CHAR_DATA_WIDTH_INDEX, CHAR_DATA_ATTR_INDEX, Content } from 'common/buffer/Constants';
import { AttributeData, ExtendedAttrs } from 'common/buffer/AttributeData';
+120
View File
@@ -0,0 +1,120 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import type { UnderlineStyle } from 'common/buffer/Constants';
import type { IDisposable } from 'common/base/Lifecycle';
import type { IEvent } from 'common/base/Event';
export type CharData = [attr: number, char: string, width: number, code: number];
export type IColorRGB = [red: number, green: number, blue: number];
export interface IExtendedAttrs {
ext: number;
underlineStyle: UnderlineStyle;
underlineColor: number;
underlineVariantOffset: number;
urlId: number;
clone(): IExtendedAttrs;
isEmpty(): boolean;
}
/**
* An object that represents all attributes of a cell.
*/
export interface IAttributeData {
fg: number;
bg: number;
extended: IExtendedAttrs;
clone(): IAttributeData;
isInverse(): number;
isBold(): number;
isUnderline(): number;
isBlink(): number;
isInvisible(): number;
isItalic(): number;
isDim(): number;
isStrikethrough(): number;
isProtected(): number;
isOverline(): number;
getFgColorMode(): number;
getBgColorMode(): number;
isFgRGB(): boolean;
isBgRGB(): boolean;
isFgPalette(): boolean;
isBgPalette(): boolean;
isFgDefault(): boolean;
isBgDefault(): boolean;
isAttributeDefault(): boolean;
getFgColor(): number;
getBgColor(): number;
hasExtendedAttrs(): number;
updateExtended(): void;
getUnderlineColor(): number;
getUnderlineColorMode(): number;
isUnderlineColorRGB(): boolean;
isUnderlineColorPalette(): boolean;
isUnderlineColorDefault(): boolean;
getUnderlineStyle(): number;
getUnderlineVariantOffset(): number;
}
/** Cell data */
export interface ICellData extends IAttributeData {
content: number;
combinedData: string;
isCombined(): number;
getWidth(): number;
getChars(): string;
getCode(): number;
setFromCharData(value: CharData): void;
getAsCharData(): CharData;
}
/**
* Interface for a line in the terminal buffer.
*/
export interface IBufferLine {
length: number;
isWrapped: boolean;
get(index: number): CharData;
set(index: number, value: CharData): void;
loadCell(index: number, cell: ICellData): ICellData;
setCell(index: number, cell: ICellData): void;
setCellFromCodepoint(index: number, codePoint: number, width: number, attrs: IAttributeData): void;
addCodepointToCell(index: number, codePoint: number, width: number): void;
insertCells(pos: number, n: number, ch: ICellData): void;
deleteCells(pos: number, n: number, fill: ICellData): void;
replaceCells(start: number, end: number, fill: ICellData, respectProtect?: boolean): void;
resize(cols: number, fill: ICellData): boolean;
cleanupMemory(): number;
fill(fillCellData: ICellData, respectProtect?: boolean): void;
copyFrom(line: IBufferLine): void;
clone(): IBufferLine;
getTrimmedLength(): number;
getNoBgTrimmedLength(): number;
translateToString(trimRight?: boolean, startCol?: number, endCol?: number, outColumns?: number[]): string;
getWidth(index: number): number;
hasWidth(index: number): number;
getFg(index: number): number;
getBg(index: number): number;
hasContent(index: number): number;
getCodePoint(index: number): number;
isCombined(index: number): number;
getString(index: number): string;
}
export interface IMarker extends IDisposable {
readonly id: number;
readonly isDisposed: boolean;
readonly line: number;
onDispose: IEvent<void>;
}
+2 -1
View File
@@ -3,7 +3,8 @@
* @license MIT
*/
import { IDisposable, IMarker } from 'common/services/Types';
import type { IDisposable } from 'common/base/Lifecycle';
import type { IMarker } from 'common/buffer/CellTypes';
import { Emitter } from 'common/base/Event';
import { dispose } from 'common/base/Lifecycle';
+3 -1
View File
@@ -4,8 +4,10 @@
*/
import type { ICircularList } from 'common/base/CircularList';
import { IAttributeData, IBufferLine, ICellData, IMarker, ICharset, IDisposable } from 'common/services/Types';
import type { IDisposable } from 'common/base/Lifecycle';
import type { IEvent } from 'common/base/Event';
import type { IAttributeData, IBufferLine, ICellData, IMarker } from 'common/buffer/CellTypes';
import type { ICharset } from 'common/data/Charsets';
// BufferIndex denotes a position in the buffer: [rowIndex, colIndex]
export type BufferIndex = [number, number];
+23 -3
View File
@@ -1,8 +1,28 @@
{
"extends": ["../tsconfig.json"],
"extends": [
"../../tsconfig-library-base",
"../tsconfig.compiler.json"
],
"compilerOptions": {
"noEmit": true,
"outDir": "../../../out/common/buffer",
"rootDir": "."
},
"include": ["./**/*"]
"include": [
"./**/*",
"../../../typings/xterm.d.ts"
],
"references": [
{
"path": "../base"
},
{
"path": "../encoding"
},
{
"path": "../data"
}
],
"exclude": [
"**/*.test.ts"
]
}
+16 -3
View File
@@ -1,8 +1,21 @@
{
"extends": ["../tsconfig.json"],
"extends": [
"../../tsconfig-library-base",
"../tsconfig.compiler.json"
],
"compilerOptions": {
"noEmit": true,
"outDir": "../../../out/common/data",
"rootDir": "."
},
"include": ["./**/*"]
"include": [
"./**/*"
],
"references": [
{
"path": "../base"
}
],
"exclude": [
"**/*.test.ts"
]
}
+16 -3
View File
@@ -1,8 +1,21 @@
{
"extends": ["../tsconfig.json"],
"extends": [
"../../tsconfig-library-base",
"../tsconfig.compiler.json"
],
"compilerOptions": {
"noEmit": true,
"outDir": "../../../out/common/encoding",
"rootDir": "."
},
"include": ["./**/*"]
"include": [
"./**/*"
],
"references": [
{
"path": "../base"
}
],
"exclude": [
"**/*.test.ts"
]
}
+1 -1
View File
@@ -1,7 +1,7 @@
import { assert } from 'chai';
import { evaluateKeyboardEvent } from 'common/input/Keyboard';
import { IKeyboardResult, IKeyboardEvent } from 'common/services/Types';
import { IKeyboardResult, IKeyboardEvent } from 'common/input/KeyboardTypes';
/**
* A helper function for testing which allows passing in a partial event and defaults will be filled
+1 -1
View File
@@ -4,7 +4,7 @@
* @license MIT
*/
import { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/services/Types';
import { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/input/KeyboardTypes';
import { C0 } from 'common/data/EscapeSequences';
// reg + shift key mappings for digits and special chars
+22
View File
@@ -0,0 +1,22 @@
export interface IKeyboardEvent {
altKey: boolean;
ctrlKey: boolean;
shiftKey: boolean;
metaKey: boolean;
keyCode: number;
key: string;
type: string;
code: string;
}
export declare const enum KeyboardResultType {
SEND_KEY = 0,
SELECT_ALL = 1,
PAGE_UP = 2,
PAGE_DOWN = 3
}
export interface IKeyboardResult {
type: KeyboardResultType;
cancel: boolean;
key: string | undefined;
}
//# sourceMappingURL=KeyboardTypes.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"KeyboardTypes.d.ts","sourceRoot":"","sources":["KeyboardTypes.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IAEjB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,0BAAkB,kBAAkB;IAClC,QAAQ,IAAA;IACR,UAAU,IAAA;IACV,OAAO,IAAA;IACP,SAAS,IAAA;CACV;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CACzB"}
+3
View File
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=KeyboardTypes.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"KeyboardTypes.js","sourceRoot":"","sources":["KeyboardTypes.ts"],"names":[],"mappings":""}
+32
View File
@@ -0,0 +1,32 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
/**
* A keyboard event interface which does not depend on the DOM.
*/
export interface IKeyboardEvent {
altKey: boolean;
ctrlKey: boolean;
shiftKey: boolean;
metaKey: boolean;
/** @deprecated See KeyboardEvent.keyCode */
keyCode: number;
key: string;
type: string;
code: string;
}
export const enum KeyboardResultType {
SEND_KEY,
SELECT_ALL,
PAGE_UP,
PAGE_DOWN
}
export interface IKeyboardResult {
type: KeyboardResultType;
cancel: boolean;
key: string | undefined;
}
+1 -1
View File
@@ -1,7 +1,7 @@
import { assert } from 'chai';
import { KittyKeyboard, KittyKeyboardEventType, KittyKeyboardFlags } from 'common/input/KittyKeyboard';
import { IKeyboardEvent } from 'common/services/Types';
import { IKeyboardEvent } from 'common/input/KeyboardTypes';
function createEvent(partialEvent: Partial<IKeyboardEvent> = {}): IKeyboardEvent {
return {
+1 -1
View File
@@ -6,7 +6,7 @@
* @see https://sw.kovidgoyal.net/kitty/keyboard-protocol/
*/
import { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/services/Types';
import { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/input/KeyboardTypes';
import { C0 } from 'common/data/EscapeSequences';
/**
@@ -0,0 +1 @@
{"version":3,"file":"UnicodeProperties.d.ts","sourceRoot":"","sources":["UnicodeProperties.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAEzF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAEvE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,qBAAqB,GAAG,gBAAgB,CAE3E;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,CAEpE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,GAAE,OAAe,GAAG,qBAAqB,CAEpH"}
+22
View File
@@ -0,0 +1,22 @@
/**
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*/
import type { UnicodeCharProperties, UnicodeCharWidth } from 'common/input/UnicodeTypes';
export function extractShouldJoin(value: UnicodeCharProperties): boolean {
return (value & 1) !== 0;
}
export function extractWidth(value: UnicodeCharProperties): UnicodeCharWidth {
return ((value >> 1) & 0x3) as UnicodeCharWidth;
}
export function extractCharKind(value: UnicodeCharProperties): number {
return value >> 3;
}
export function createPropertyValue(state: number, width: number, shouldJoin: boolean = false): UnicodeCharProperties {
return ((state & 0xffffff) << 3) | ((width & 3) << 1) | (shouldJoin ? 1 : 0);
}
+8
View File
@@ -0,0 +1,8 @@
export type UnicodeCharProperties = number;
export type UnicodeCharWidth = 0 | 1 | 2;
export interface IUnicodeVersionProvider {
readonly version: string;
wcwidth(ucs: number): UnicodeCharWidth;
charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties;
}
//# sourceMappingURL=UnicodeTypes.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"UnicodeTypes.d.ts","sourceRoot":"","sources":["UnicodeTypes.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAK3C,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEzC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACvC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,GAAG,qBAAqB,CAAC;CAC5F"}
+3
View File
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=UnicodeTypes.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"UnicodeTypes.js","sourceRoot":"","sources":["UnicodeTypes.ts"],"names":[],"mappings":""}
+24
View File
@@ -0,0 +1,24 @@
/**
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*/
/*
* Width and Grapheme_Cluster_Break properties of a character as a bit mask.
*
* bit 0: shouldJoin - should combine with preceding character.
* bit 1..2: wcwidth - see UnicodeCharWidth.
* bit 3..31: class of character (currently only 4 bits are used).
*/
export type UnicodeCharProperties = number;
/**
* Width in columns of a character.
*/
export type UnicodeCharWidth = 0 | 1 | 2;
export interface IUnicodeVersionProvider {
readonly version: string;
wcwidth(ucs: number): UnicodeCharWidth;
charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties;
}
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"UnicodeV6.d.ts","sourceRoot":"","sources":["UnicodeV6.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AA+ElH,qBAAa,SAAU,YAAW,uBAAuB;IACvD,SAAgB,OAAO,OAAO;IAE9B,cAkCC;IAEM,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAO5C;IAEM,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,GAAG,qBAAqB,CAYhG;CACF"}
+4 -4
View File
@@ -2,8 +2,8 @@
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';
import { UnicodeService } from 'common/services/UnicodeService';
import type { IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/input/UnicodeTypes';
import { createPropertyValue, extractWidth } from 'common/input/UnicodeProperties';
const BMP_COMBINING = [
[0x0300, 0x036F], [0x0483, 0x0486], [0x0488, 0x0489],
@@ -133,13 +133,13 @@ export class UnicodeV6 implements IUnicodeVersionProvider {
let width = this.wcwidth(codepoint);
let shouldJoin = width === 0 && preceding !== 0;
if (shouldJoin) {
const oldWidth = UnicodeService.extractWidth(preceding);
const oldWidth = extractWidth(preceding);
if (oldWidth === 0) {
shouldJoin = false;
} else if (oldWidth > width) {
width = oldWidth;
}
}
return UnicodeService.createPropertyValue(0, width, shouldJoin);
return createPropertyValue(0, width, shouldJoin);
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
import { assert } from 'chai';
import { Win32InputMode, Win32ControlKeyState } from 'common/input/Win32InputMode';
import { IKeyboardEvent, KeyboardResultType } from 'common/services/Types';
import { IKeyboardEvent, KeyboardResultType } from 'common/input/KeyboardTypes';
type EventOpts = Partial<IKeyboardEvent>;
const ev = (opts: EventOpts): IKeyboardEvent => ({
+1 -1
View File
@@ -14,7 +14,7 @@
* Rc: Repeat count (usually 1)
*/
import { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/services/Types';
import { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/input/KeyboardTypes';
import { C0 } from 'common/data/EscapeSequences';
/**
+25 -3
View File
@@ -1,8 +1,30 @@
{
"extends": ["../tsconfig.json"],
"extends": [
"../../tsconfig-library-base",
"../tsconfig.compiler.json"
],
"compilerOptions": {
"noEmit": true,
"outDir": "../../../out/common/input",
"rootDir": "."
},
"include": ["./**/*"]
"include": [
"./**/*"
],
"references": [
{
"path": "../base"
},
{
"path": "../data"
},
{
"path": "../encoding"
},
{
"path": "../parser"
}
],
"exclude": [
"**/*.test.ts"
]
}
+1 -1
View File
@@ -6,7 +6,7 @@
import { IApcHandler, IHandlerCollection, ApcFallbackHandlerType, IApcParser, ISubParserStackState } from 'common/parser/Types';
import { ParserConstants } from 'common/parser/Constants';
import { utf32ToString } from 'common/encoding/TextDecoder';
import { IDisposable } from 'common/services/Types';
import { IDisposable } from 'common/base/Lifecycle';
import { LimitedStringBuilder } from 'common/base/StringBuilder';
const EMPTY_HANDLERS: IApcHandler[] = [];
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["Constants.ts"],"names":[],"mappings":"AAQA,0BAAkB,WAAW;IAC3B,MAAM,IAAI;IACV,MAAM,IAAI;IACV,mBAAmB,IAAI;IACvB,SAAS,IAAI;IACb,SAAS,IAAI;IACb,gBAAgB,IAAI;IACpB,UAAU,IAAI;IACd,aAAa,IAAI;IACjB,UAAU,IAAI;IACd,SAAS,IAAI;IACb,SAAS,KAAK;IACd,UAAU,KAAK;IACf,gBAAgB,KAAK;IACrB,eAAe,KAAK;IACpB,SAAS,KAAK;IACd,gBAAgB,KAAK;IACrB,eAAe,KAAK;IAEpB,YAAY,KAAK;CAClB;AAKD,0BAAkB,YAAY;IAC5B,MAAM,IAAI;IACV,KAAK,IAAI;IACT,KAAK,IAAI;IACT,OAAO,IAAI;IACX,SAAS,IAAI;IACb,OAAO,IAAI;IACX,OAAO,IAAI;IACX,YAAY,IAAI;IAChB,KAAK,IAAI;IACT,OAAO,IAAI;IACX,YAAY,KAAK;IACjB,KAAK,KAAK;IACV,QAAQ,KAAK;IACb,OAAO,KAAK;IACZ,UAAU,KAAK;IACf,SAAS,KAAK;IACd,OAAO,KAAK;IACZ,OAAO,KAAK;CACb;AAKD,0BAAkB,QAAQ;IACxB,KAAK,IAAI;IACT,EAAE,IAAI;IACN,OAAO,IAAI;IACX,KAAK,IAAI;CACV;AAGD,0BAAkB,eAAe;IAC/B,aAAa,WAAW;CACzB"}
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { IDisposable } from 'common/services/Types';
import { IDisposable } from 'common/base/Lifecycle';
import { IDcsHandler, IParams, IHandlerCollection, IDcsParser, DcsFallbackHandlerType, ISubParserStackState } from 'common/parser/Types';
import { utf32ToString } from 'common/encoding/TextDecoder';
import { Params } from 'common/parser/Params';
@@ -10,7 +10,7 @@ import { StringToUtf32, stringFromCodePoint, utf32ToString } from 'common/encodi
import { ParserState } from 'common/parser/Constants';
import { Params } from 'common/parser/Params';
import { OscHandler } from 'common/parser/OscParser';
import { IDisposable } from 'common/services/Types';
import type { IDisposable } from 'common/base/Lifecycle';
import { DcsHandler } from 'common/parser/DcsParser';
import { ApcHandler } from 'common/parser/ApcParser';
+1 -1
View File
@@ -6,7 +6,7 @@
import { IParsingState, IDcsHandler, IEscapeSequenceParser, IParams, IOscHandler, IHandlerCollection, CsiHandlerType, OscFallbackHandlerType, IOscParser, EscHandlerType, IDcsParser, DcsFallbackHandlerType, IFunctionIdentifier, ExecuteFallbackHandlerType, CsiFallbackHandlerType, EscFallbackHandlerType, PrintHandlerType, PrintFallbackHandlerType, ExecuteHandlerType, IParserStackState, ParserStackType, ResumableHandlersType, IApcHandler, IApcParser, ApcFallbackHandlerType } from 'common/parser/Types';
import { ParserState, ParserAction } from 'common/parser/Constants';
import { Disposable, toDisposable } from 'common/base/Lifecycle';
import { IDisposable } from 'common/services/Types';
import { IDisposable } from 'common/base/Lifecycle';
import { Params } from 'common/parser/Params';
import { OscParser } from 'common/parser/OscParser';
import { DcsParser } from 'common/parser/DcsParser';
+1 -1
View File
@@ -6,7 +6,7 @@
import { IOscHandler, IHandlerCollection, OscFallbackHandlerType, IOscParser, ISubParserStackState } from 'common/parser/Types';
import { OscState, ParserConstants } from 'common/parser/Constants';
import { utf32ToString } from 'common/encoding/TextDecoder';
import { IDisposable } from 'common/services/Types';
import { IDisposable } from 'common/base/Lifecycle';
import { LimitedStringBuilder } from 'common/base/StringBuilder';
const EMPTY_HANDLERS: IOscHandler[] = [];
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { IDisposable } from 'common/services/Types';
import type { IDisposable } from 'common/base/Lifecycle';
import { ParserState } from 'common/parser/Constants';
+19 -3
View File
@@ -1,8 +1,24 @@
{
"extends": ["../tsconfig.json"],
"extends": [
"../../tsconfig-library-base",
"../tsconfig.compiler.json"
],
"compilerOptions": {
"noEmit": true,
"outDir": "../../../out/common/parser",
"rootDir": "."
},
"include": ["./**/*"]
"include": [
"./**/*"
],
"references": [
{
"path": "../base"
},
{
"path": "../buffer"
}
],
"exclude": [
"**/*.test.ts"
]
}
+29 -3
View File
@@ -1,8 +1,34 @@
{
"extends": ["../tsconfig.json"],
"extends": [
"../../tsconfig-library-base",
"../tsconfig.compiler.json"
],
"compilerOptions": {
"noEmit": true,
"outDir": "../../../out/common/public",
"rootDir": "."
},
"include": ["./**/*"]
"include": [
"./**/*",
"../../../typings/xterm.d.ts"
],
"references": [
{
"path": "../base"
},
{
"path": "../buffer"
},
{
"path": "../parser"
},
{
"path": "../services"
},
{
"path": "../terminal"
}
],
"exclude": [
"**/*.test.ts"
]
}
@@ -0,0 +1 @@
{"version":3,"file":"OptionsService.d.ts","sourceRoot":"","sources":["OptionsService.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAgB,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAe,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAc,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGzF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAiDhE,CAAC;AAIF,qBAAa,cAAe,SAAQ,UAAW,YAAW,eAAe;IAChE,YAAY,EAAE,GAAG,CAAC;IAEzB,SAAgB,UAAU,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAChD,OAAO,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAE3C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAyD;IACzF,SAAgB,cAAc,6DAA8B;IAE5D,YAAY,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,EA0B7C;IAGM,sBAAsB,CAAC,CAAC,SAAS,MAAM,gBAAgB,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,WAAW,CAMlI;IAGM,sBAAsB,CAAC,IAAI,EAAE,CAAC,MAAM,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,GAAG,WAAW,CAMhG;IAED,OAAO,CAAC,aAAa;IA8BrB,OAAO,CAAC,0BAA0B;CAiEnC"}
+9
View File
@@ -0,0 +1,9 @@
import { IServiceIdentifier } from 'common/services/Services';
export declare const serviceRegistry: Map<string, IServiceIdentifier<any>>;
export declare function getServiceDependencies(ctor: any): {
id: IServiceIdentifier<any>;
index: number;
optional: boolean;
}[];
export declare function createDecorator<T>(id: string): IServiceIdentifier<T>;
//# sourceMappingURL=ServiceRegistry.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"ServiceRegistry.d.ts","sourceRoot":"","sources":["ServiceRegistry.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAO9D,eAAO,MAAM,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAa,CAAC;AAE/E,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,GAAG;IAAE,EAAE,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,EAAE,CAErH;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAiBpE"}
+33
View File
@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.serviceRegistry = void 0;
exports.getServiceDependencies = getServiceDependencies;
exports.createDecorator = createDecorator;
exports.serviceRegistry = new Map();
function getServiceDependencies(ctor) {
return ctor["di$dependencies"] || [];
}
function createDecorator(id) {
if (exports.serviceRegistry.has(id)) {
return exports.serviceRegistry.get(id);
}
const decorator = function (target, key, index) {
if (arguments.length !== 3) {
throw new Error('@IServiceName-decorator can only be used to decorate a parameter');
}
storeServiceDependency(decorator, target, index);
};
decorator._id = id;
exports.serviceRegistry.set(id, decorator);
return decorator;
}
function storeServiceDependency(id, target, index) {
if (target["di$target"] === target) {
target["di$dependencies"].push({ id, index });
}
else {
target["di$dependencies"] = [{ id, index }];
target["di$target"] = target;
}
}
//# sourceMappingURL=ServiceRegistry.js.map
@@ -0,0 +1 @@
{"version":3,"file":"ServiceRegistry.js","sourceRoot":"","sources":["ServiceRegistry.ts"],"names":[],"mappings":";;;;;AAkBa,QAAA,eAAe,GAAyC,IAAI,GAAG,EAAE,CAAC;AAE/E,gCAAuC,IAAS;IAC9C,OAAO,IAAI,mBAA2B,IAAI,EAAE,CAAC;AAC/C,CAAC;AAED,yBAAmC,EAAU;IAC3C,IAAI,QAAA,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5B,OAAO,QAAA,eAAe,CAAC,GAAG,CAAC,EAAE,CAAE,CAAC;IAClC,CAAC;IAED,MAAM,SAAS,GAAQ,UAAU,MAAgB,EAAE,GAAW,EAAE,KAAa;QAC3E,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACtF,CAAC;QAED,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC,CAAC;IAEF,SAAS,CAAC,GAAG,GAAG,EAAE,CAAC;IAEnB,QAAA,eAAe,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;IACnC,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,sBAAsB,CAAC,EAAY,EAAE,MAAgB,EAAE,KAAa;IAC3E,IAAK,MAAc,aAAqB,KAAK,MAAM,EAAE,CAAC;QACnD,MAAc,mBAA2B,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACjE,CAAC;SAAM,CAAC;QACL,MAAc,mBAA2B,GAAG,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5D,MAAc,aAAqB,GAAG,MAAM,CAAC;IAChD,CAAC;AACH,CAAC"}
+230
View File
@@ -0,0 +1,230 @@
import type { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, IOverviewRulerOptions } from '@xterm/xterm';
import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IKittyKeyboardState, IModes, IOscLinkData, IWindowOptions } from 'common/services/Types';
import type { IBufferService as IBufferServiceApi } from 'common/buffer/BufferService';
import type { Emitter, IEvent } from 'common/base/Event';
import type { IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/input/UnicodeTypes';
export type { IBufferResizeEvent } from 'common/buffer/BufferService';
export interface IBufferService extends IBufferServiceApi {
}
export declare const IBufferService: IServiceIdentifier<IBufferService>;
export declare const IMouseStateService: IServiceIdentifier<IMouseStateService>;
export interface IMouseStateService {
serviceBrand: undefined;
activeProtocol: string;
activeEncoding: string;
areMouseEventsActive: boolean;
addProtocol(name: string, protocol: ICoreMouseProtocol): void;
addEncoding(name: string, encoding: CoreMouseEncoding): void;
reset(): void;
setCustomWheelEventHandler(customWheelEventHandler: ((event: WheelEvent) => boolean) | undefined): void;
allowCustomWheelEvent(ev: WheelEvent): boolean;
onProtocolChange: IEvent<CoreMouseEventType>;
restrictMouseEvent(event: ICoreMouseEvent): boolean;
encodeMouseEvent(event: ICoreMouseEvent): string;
readonly isDefaultEncoding: boolean;
readonly isPixelEncoding: boolean;
}
export declare const ICoreService: IServiceIdentifier<ICoreService>;
export interface ICoreService {
serviceBrand: undefined;
isCursorInitialized: boolean;
isCursorHidden: boolean;
readonly modes: IModes;
readonly decPrivateModes: IDecPrivateModes;
readonly kittyKeyboard: IKittyKeyboardState;
readonly onData: IEvent<string>;
readonly onUserInput: IEvent<void>;
readonly onBinary: IEvent<string>;
readonly onRequestScrollToBottom: IEvent<void>;
reset(): void;
triggerDataEvent(data: string, wasUserInput?: boolean): void;
triggerBinaryEvent(data: string): void;
}
export declare const ICharsetService: IServiceIdentifier<ICharsetService>;
export interface ICharsetService {
serviceBrand: undefined;
charset: ICharset | undefined;
readonly glevel: number;
readonly charsets: (ICharset | undefined)[];
reset(): void;
setgLevel(g: number): void;
setgCharset(g: number, charset: ICharset | undefined): void;
}
export interface IServiceIdentifier<T> {
(...args: any[]): void;
type: T;
_id: string;
}
export interface IBrandedService {
serviceBrand: undefined;
}
type GetLeadingNonServiceArgs<TArgs extends any[]> = TArgs extends [] ? [] : TArgs extends [...infer TFirst, infer TLast] ? TLast extends IBrandedService ? GetLeadingNonServiceArgs<TFirst> : TArgs : never;
export declare const IInstantiationService: IServiceIdentifier<IInstantiationService>;
export interface IInstantiationService {
serviceBrand: undefined;
setService<T>(id: IServiceIdentifier<T>, instance: T): void;
getService<T>(id: IServiceIdentifier<T>): T | undefined;
createInstance<Ctor extends new (...args: any[]) => any, R extends InstanceType<Ctor>>(t: Ctor, ...args: GetLeadingNonServiceArgs<ConstructorParameters<Ctor>>): R;
}
export declare enum LogLevelEnum {
TRACE = 0,
DEBUG = 1,
INFO = 2,
WARN = 3,
ERROR = 4,
OFF = 5
}
export declare const ILogService: IServiceIdentifier<ILogService>;
export interface ILogService {
serviceBrand: undefined;
readonly logLevel: LogLevelEnum;
trace(message: any, ...optionalParams: any[]): void;
debug(message: any, ...optionalParams: any[]): void;
info(message: any, ...optionalParams: any[]): void;
warn(message: any, ...optionalParams: any[]): void;
error(message: any, ...optionalParams: any[]): void;
}
export declare const IOptionsService: IServiceIdentifier<IOptionsService>;
export interface IOptionsService {
serviceBrand: undefined;
readonly rawOptions: Required<ITerminalOptions>;
readonly options: Required<ITerminalOptions>;
readonly onOptionChange: IEvent<keyof ITerminalOptions>;
onSpecificOptionChange<T extends keyof ITerminalOptions>(key: T, listener: (arg1: Required<ITerminalOptions>[T]) => any): IDisposable;
onMultipleOptionChange(keys: (keyof ITerminalOptions)[], listener: () => any): IDisposable;
}
export type FontWeight = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | number;
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'off';
export interface ITerminalOptions {
allowProposedApi?: boolean;
allowTransparency?: boolean;
altClickMovesCursor?: boolean;
cols?: number;
convertEol?: boolean;
cursorBlink?: boolean;
blinkIntervalDuration?: number;
cursorStyle?: CursorStyle;
cursorWidth?: number;
cursorInactiveStyle?: CursorInactiveStyle;
disableStdin?: boolean;
documentOverride?: any | null;
drawBoldTextInBrightColors?: boolean;
fastScrollSensitivity?: number;
fontSize?: number;
fontFamily?: string;
fontWeight?: FontWeight;
fontWeightBold?: FontWeight;
ignoreBracketedPasteMode?: boolean;
letterSpacing?: number;
lineHeight?: number;
linkHandler?: ILinkHandler | null;
logLevel?: LogLevel;
logger?: ILogger | null;
macOptionIsMeta?: boolean;
macOptionClickForcesSelection?: boolean;
minimumContrastRatio?: number;
mouseEventsRequireAlt?: boolean;
reflowCursorLine?: boolean;
rescaleOverlappingGlyphs?: boolean;
rightClickSelectsWord?: boolean;
rows?: number;
showCursorImmediately?: boolean;
screenReaderMode?: boolean;
scrollback?: number;
scrollOnUserInput?: boolean;
scrollSensitivity?: number;
smoothScrollDuration?: number;
tabStopWidth?: number;
theme?: ITheme;
windowsPty?: IWindowsPty;
windowOptions?: IWindowOptions;
wordSeparator?: string;
quirks?: ITerminalQuirks;
scrollbar?: IScrollbarOptions;
scrollOnEraseInDisplay?: boolean;
vtExtensions?: IVtExtensions;
[key: string]: any;
termName: string;
}
export interface ITheme {
foreground?: string;
background?: string;
cursor?: string;
cursorAccent?: string;
selectionForeground?: string;
selectionBackground?: string;
selectionInactiveBackground?: string;
scrollbarSliderBackground?: string;
scrollbarSliderHoverBackground?: string;
scrollbarSliderActiveBackground?: string;
overviewRulerBorder?: 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;
extendedAnsi?: string[];
}
export interface ITerminalQuirks {
allowSetCursorBlink?: boolean;
}
export interface IScrollbarOptions {
showScrollbar?: boolean;
showArrows?: boolean;
width?: number;
overviewRuler?: IOverviewRulerOptions;
}
export interface IVtExtensions {
kittyKeyboard?: boolean;
kittySgrBoldFaintControl?: boolean;
win32InputMode?: boolean;
colorSchemeQuery?: boolean;
}
export declare const IOscLinkService: IServiceIdentifier<IOscLinkService>;
export interface IOscLinkService {
serviceBrand: undefined;
registerLink(linkData: IOscLinkData): number;
addLineToLink(linkId: number, y: number): void;
getLinkData(linkId: number): IOscLinkData | undefined;
}
export type { UnicodeCharProperties, UnicodeCharWidth, IUnicodeVersionProvider } from 'common/input/UnicodeTypes';
export declare const IUnicodeService: IServiceIdentifier<IUnicodeService>;
export interface IUnicodeService {
serviceBrand: undefined;
register(provider: IUnicodeVersionProvider): void;
readonly versions: string[];
activeVersion: string;
readonly onChange: IEvent<string>;
wcwidth(codepoint: number): UnicodeCharWidth;
getStringCellWidth(s: string): number;
charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties;
}
export declare const IDecorationService: IServiceIdentifier<IDecorationService>;
export interface IDecorationService extends IDisposable {
serviceBrand: undefined;
readonly decorations: IterableIterator<IInternalDecoration>;
readonly onDecorationRegistered: IEvent<IInternalDecoration>;
readonly onDecorationRemoved: IEvent<IInternalDecoration>;
registerDecoration(decorationOptions: IDecorationOptions): IDecoration | undefined;
reset(): void;
forEachDecorationAtCell(x: number, line: number, layer: 'bottom' | 'top' | undefined, callback: (decoration: IInternalDecoration) => void): void;
}
export interface IInternalDecoration extends IDecoration {
readonly options: IDecorationOptions;
readonly backgroundColorRGB: IColor | undefined;
readonly foregroundColorRGB: IColor | undefined;
readonly onRenderEmitter: Emitter<HTMLElement>;
_indexedStartLine: number;
}
//# sourceMappingURL=Services.d.ts.map
File diff suppressed because one or more lines are too long
+24
View File
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IDecorationService = exports.IUnicodeService = exports.IOscLinkService = exports.IOptionsService = exports.ILogService = exports.LogLevelEnum = exports.IInstantiationService = exports.ICharsetService = exports.ICoreService = exports.IMouseStateService = exports.IBufferService = void 0;
const ServiceRegistry_1 = require("common/services/ServiceRegistry");
exports.IBufferService = (0, ServiceRegistry_1.createDecorator)('BufferService');
exports.IMouseStateService = (0, ServiceRegistry_1.createDecorator)('MouseStateService');
exports.ICoreService = (0, ServiceRegistry_1.createDecorator)('CoreService');
exports.ICharsetService = (0, ServiceRegistry_1.createDecorator)('CharsetService');
exports.IInstantiationService = (0, ServiceRegistry_1.createDecorator)('InstantiationService');
var LogLevelEnum;
(function (LogLevelEnum) {
LogLevelEnum[LogLevelEnum["TRACE"] = 0] = "TRACE";
LogLevelEnum[LogLevelEnum["DEBUG"] = 1] = "DEBUG";
LogLevelEnum[LogLevelEnum["INFO"] = 2] = "INFO";
LogLevelEnum[LogLevelEnum["WARN"] = 3] = "WARN";
LogLevelEnum[LogLevelEnum["ERROR"] = 4] = "ERROR";
LogLevelEnum[LogLevelEnum["OFF"] = 5] = "OFF";
})(LogLevelEnum || (exports.LogLevelEnum = LogLevelEnum = {}));
exports.ILogService = (0, ServiceRegistry_1.createDecorator)('LogService');
exports.IOptionsService = (0, ServiceRegistry_1.createDecorator)('OptionsService');
exports.IOscLinkService = (0, ServiceRegistry_1.createDecorator)('OscLinkService');
exports.IUnicodeService = (0, ServiceRegistry_1.createDecorator)('UnicodeService');
exports.IDecorationService = (0, ServiceRegistry_1.createDecorator)('DecorationService');
//# sourceMappingURL=Services.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Services.js","sourceRoot":"","sources":["Services.ts"],"names":[],"mappings":";;;AASA,qEAAkE;AAMrD,QAAA,cAAc,GAAG,IAAA,iCAAe,EAAiB,eAAe,CAAC,CAAC;AAElE,QAAA,kBAAkB,GAAG,IAAA,iCAAe,EAAqB,mBAAmB,CAAC,CAAC;AAuB9E,QAAA,YAAY,GAAG,IAAA,iCAAe,EAAe,aAAa,CAAC,CAAC;AAuC5D,QAAA,eAAe,GAAG,IAAA,iCAAe,EAAkB,gBAAgB,CAAC,CAAC;AAsCrE,QAAA,qBAAqB,GAAG,IAAA,iCAAe,EAAwB,sBAAsB,CAAC,CAAC;AASpG,IAAY,YAOX;AAPD,WAAY,YAAY;IACtB,iDAAS,CAAA;IACT,iDAAS,CAAA;IACT,+CAAQ,CAAA;IACR,+CAAQ,CAAA;IACR,iDAAS,CAAA;IACT,6CAAO,CAAA;AACT,CAAC,EAPW,YAAY,aAAZ,YAAY,GAAZ,YAAY,QAOvB;AAEY,QAAA,WAAW,GAAG,IAAA,iCAAe,EAAc,YAAY,CAAC,CAAC;AAazD,QAAA,eAAe,GAAG,IAAA,iCAAe,EAAkB,gBAAgB,CAAC,CAAC;AAgJrE,QAAA,eAAe,GAAG,IAAA,iCAAe,EAAkB,gBAAgB,CAAC,CAAC;AAkBrE,QAAA,eAAe,GAAG,IAAA,iCAAe,EAAkB,gBAAgB,CAAC,CAAC;AAyBrE,QAAA,kBAAkB,GAAG,IAAA,iCAAe,EAAqB,mBAAmB,CAAC,CAAC"}
+5 -50
View File
@@ -6,32 +6,14 @@
import type { IDecoration, IDecorationOptions, ILinkHandler, ILogger, IWindowsPty, IOverviewRulerOptions } from '@xterm/xterm';
import { CoreMouseEncoding, CoreMouseEventType, CursorInactiveStyle, CursorStyle, IAttributeData, ICharset, IColor, ICoreMouseEvent, ICoreMouseProtocol, IDecPrivateModes, IDisposable, IKittyKeyboardState, IModes, IOscLinkData, IWindowOptions } from 'common/services/Types';
import { IBuffer, IBufferSet } from 'common/buffer/Types';
import type { IBufferResizeEvent, IBufferService as IBufferServiceApi } from 'common/buffer/BufferService';
import { createDecorator } from 'common/services/ServiceRegistry';
import type { Emitter, IEvent } from 'common/base/Event';
import type { IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/input/UnicodeTypes';
export type { IBufferResizeEvent } from 'common/buffer/BufferService';
export interface IBufferService extends IBufferServiceApi {}
export const IBufferService = createDecorator<IBufferService>('BufferService');
export interface IBufferService {
serviceBrand: undefined;
readonly cols: number;
readonly rows: number;
readonly buffer: IBuffer;
readonly buffers: IBufferSet;
isUserScrolling: boolean;
onResize: IEvent<IBufferResizeEvent>;
onScroll: IEvent<number>;
scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;
scrollLines(disp: number, suppressScrollEvent?: boolean): void;
resize(cols: number, rows: number): void;
reset(): void;
}
export interface IBufferResizeEvent {
cols: number;
rows: number;
colsChanged: boolean;
rowsChanged: boolean;
}
export const IMouseStateService = createDecorator<IMouseStateService>('MouseStateService');
export interface IMouseStateService {
@@ -324,28 +306,7 @@ export interface IOscLinkService {
getLinkData(linkId: number): IOscLinkData | undefined;
}
/*
* Width and Grapheme_Cluster_Break properties of a character as a bit mask.
*
* bit 0: shouldJoin - should combine with preceding character.
* bit 1..2: wcwidth - see UnicodeCharWidth.
* bit 3..31: class of character (currently only 4 bits are used).
* This is used to determined grapheme clustering - i.e. which codepoints
* are to be combined into a single compound character.
*
* Use the UnicodeService static function createPropertyValue to create a
* UnicodeCharProperties; use extractShouldJoin, extractWidth, and
* extractCharKind to extract the components.
*/
export type UnicodeCharProperties = number;
/**
* Width in columns of a character.
* In a CJK context, "half-width" characters (such as Latin) are width 1,
* while "full-width" characters (such as Kanji) are 2 columns wide.
* Combining characters (such as accents) are width 0.
*/
export type UnicodeCharWidth = 0 | 1 | 2;
export type { UnicodeCharProperties, UnicodeCharWidth, IUnicodeVersionProvider } from 'common/input/UnicodeTypes';
export const IUnicodeService = createDecorator<IUnicodeService>('UnicodeService');
export interface IUnicodeService {
@@ -372,12 +333,6 @@ export interface IUnicodeService {
charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties;
}
export interface IUnicodeVersionProvider {
readonly version: string;
wcwidth(ucs: number): UnicodeCharWidth;
charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties;
}
export const IDecorationService = createDecorator<IDecorationService>('DecorationService');
export interface IDecorationService extends IDisposable {
serviceBrand: undefined;
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { IdleTaskQueue } from 'common/services/TaskQueue';
import { IdleTaskQueue } from 'common/base/TaskQueue';
import type { ILogService } from 'common/services/Services';
// Work variables to avoid garbage collection.
+254
View File
@@ -0,0 +1,254 @@
import type { IBufferSet } from 'common/buffer/Types';
import type { IParams } from 'common/parser/Types';
import type { IMouseStateService, ICoreService, IOptionsService, IUnicodeService } from 'common/services/Services';
import { IFunctionIdentifier } from '@xterm/xterm';
import type { IDisposable } from 'common/base/Lifecycle';
import type { ITerminalOptions } from 'common/base/TerminalOptions';
import type { IColorRGB } from 'common/buffer/CellTypes';
import type { IEvent } from 'common/base/Event';
export type { IDisposable } from 'common/base/Lifecycle';
export type { ITerminalOptions } from 'common/base/TerminalOptions';
export type { CharData, IAttributeData, ICellData, IBufferLine, IExtendedAttrs, IMarker } from 'common/buffer/CellTypes';
export type { ICharset } from 'common/data/Charsets';
export type { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/input/KeyboardTypes';
export type { UnicodeCharProperties, UnicodeCharWidth, IUnicodeVersionProvider } from 'common/input/UnicodeTypes';
export interface ICoreTerminal {
mouseStateService: IMouseStateService;
coreService: ICoreService;
optionsService: IOptionsService;
unicodeService: IUnicodeService;
buffers: IBufferSet;
options: Required<ITerminalOptions>;
registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise<boolean>): IDisposable;
registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise<boolean>): IDisposable;
registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise<boolean>): IDisposable;
registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
registerApcHandler(id: IFunctionIdentifier, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
}
export type CursorStyle = 'block' | 'underline' | 'bar';
export type CursorInactiveStyle = 'outline' | 'block' | 'bar' | 'underline' | 'none';
export type XtermListener = (...args: any[]) => void;
export interface IScrollEvent {
position: number;
}
export interface IColor {
readonly css: string;
readonly rgba: number;
}
export type { IColorRGB } from 'common/buffer/CellTypes';
export interface IOscLinkData {
id?: string;
uri: string;
}
export interface IModes {
insertMode: boolean;
}
export interface IDecPrivateModes {
applicationCursorKeys: boolean;
applicationKeypad: boolean;
bracketedPasteMode: boolean;
colorSchemeUpdates: boolean;
cursorBlink: boolean | undefined;
cursorStyle: CursorStyle | undefined;
origin: boolean;
reverseWraparound: boolean;
sendFocus: boolean;
synchronizedOutput: boolean;
win32InputMode: boolean;
wraparound: boolean;
}
export interface IKittyKeyboardState {
flags: number;
mainFlags: number;
altFlags: number;
mainStack: number[];
altStack: number[];
}
export interface IRowRange {
start: number;
end: number;
}
export declare const enum CoreMouseButton {
LEFT = 0,
MIDDLE = 1,
RIGHT = 2,
NONE = 3,
WHEEL = 4,
AUX1 = 8,
AUX2 = 9,
AUX3 = 10,
AUX4 = 11,
AUX5 = 12,
AUX6 = 13,
AUX7 = 14,
AUX8 = 15
}
export declare const enum CoreMouseAction {
UP = 0,
DOWN = 1,
LEFT = 2,
RIGHT = 3,
MOVE = 32
}
export interface ICoreMouseEvent {
col: number;
row: number;
x: number;
y: number;
button: CoreMouseButton;
action: CoreMouseAction;
ctrl?: boolean;
alt?: boolean;
shift?: boolean;
}
export declare const enum CoreMouseEventType {
NONE = 0,
DOWN = 1,
UP = 2,
DRAG = 4,
MOVE = 8,
WHEEL = 16
}
export interface ICoreMouseProtocol {
events: CoreMouseEventType;
restrict: (e: ICoreMouseEvent) => boolean;
}
export type CoreMouseEncoding = (event: ICoreMouseEvent) => string;
export interface IWindowOptions {
restoreWin?: boolean;
minimizeWin?: boolean;
setWinPosition?: boolean;
setWinSizePixels?: boolean;
raiseWin?: boolean;
lowerWin?: boolean;
refreshWin?: boolean;
setWinSizeChars?: boolean;
maximizeWin?: boolean;
fullscreenWin?: boolean;
getWinState?: boolean;
getWinPosition?: boolean;
getWinSizePixels?: boolean;
getScreenSizePixels?: boolean;
getCellSizePixels?: boolean;
getWinSizeChars?: boolean;
getScreenSizeChars?: boolean;
getIconTitle?: boolean;
getWinTitle?: boolean;
pushTitle?: boolean;
popTitle?: boolean;
setWinLines?: boolean;
}
export declare const enum ColorRequestType {
REPORT = 0,
SET = 1,
RESTORE = 2
}
type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>;
type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>;
export type ColorIndex = IntRange<0, 256>;
export type AllColorIndex = ColorIndex | SpecialColorIndex;
export declare const enum SpecialColorIndex {
FOREGROUND = 256,
BACKGROUND = 257,
CURSOR = 258
}
export interface IColorReportRequest {
type: ColorRequestType.REPORT;
index: AllColorIndex;
}
export interface IColorSetRequest {
type: ColorRequestType.SET;
index: AllColorIndex;
color: IColorRGB;
}
export interface IColorRestoreRequest {
type: ColorRequestType.RESTORE;
index?: AllColorIndex;
}
export type IColorEvent = (IColorReportRequest | IColorSetRequest | IColorRestoreRequest)[];
export interface IInputHandler {
onTitleChange: IEvent<string>;
parse(data: string | Uint8Array, promiseResult?: boolean): void | Promise<boolean>;
print(data: Uint32Array, start: number, end: number): void;
registerCsiHandler(id: IFunctionIdentifier, callback: (params: IParams) => boolean | Promise<boolean>): IDisposable;
registerDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: IParams) => boolean | Promise<boolean>): IDisposable;
registerEscHandler(id: IFunctionIdentifier, callback: () => boolean | Promise<boolean>): IDisposable;
registerOscHandler(ident: number, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
registerApcHandler(id: IFunctionIdentifier, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
bell(): boolean;
lineFeed(): boolean;
carriageReturn(): boolean;
backspace(): boolean;
tab(): boolean;
shiftOut(): boolean;
shiftIn(): boolean;
insertChars(params: IParams): boolean;
scrollLeft(params: IParams): boolean;
cursorUp(params: IParams): boolean;
scrollRight(params: IParams): boolean;
cursorDown(params: IParams): boolean;
cursorForward(params: IParams): boolean;
cursorBackward(params: IParams): boolean;
cursorNextLine(params: IParams): boolean;
cursorPrecedingLine(params: IParams): boolean;
cursorCharAbsolute(params: IParams): boolean;
cursorPosition(params: IParams): boolean;
cursorForwardTab(params: IParams): boolean;
eraseInDisplay(params: IParams): boolean;
eraseInLine(params: IParams): boolean;
insertLines(params: IParams): boolean;
deleteLines(params: IParams): boolean;
deleteChars(params: IParams): boolean;
scrollUp(params: IParams): boolean;
scrollDown(params: IParams, collect?: string): boolean;
eraseChars(params: IParams): boolean;
cursorBackwardTab(params: IParams): boolean;
charPosAbsolute(params: IParams): boolean;
hPositionRelative(params: IParams): boolean;
repeatPrecedingCharacter(params: IParams): boolean;
sendDeviceAttributesPrimary(params: IParams): boolean;
sendDeviceAttributesSecondary(params: IParams): boolean;
linePosAbsolute(params: IParams): boolean;
vPositionRelative(params: IParams): boolean;
hVPosition(params: IParams): boolean;
tabClear(params: IParams): boolean;
setMode(params: IParams, collect?: string): boolean;
resetMode(params: IParams, collect?: string): boolean;
charAttributes(params: IParams): boolean;
deviceStatus(params: IParams, collect?: string): boolean;
softReset(params: IParams, collect?: string): boolean;
setCursorStyle(params: IParams, collect?: string): boolean;
setScrollRegion(params: IParams, collect?: string): boolean;
saveCursor(params: IParams): boolean;
restoreCursor(params: IParams): boolean;
insertColumns(params: IParams): boolean;
deleteColumns(params: IParams): boolean;
setTitle(data: string): boolean;
setOrReportIndexedColor(data: string): boolean;
setOrReportFgColor(data: string): boolean;
setOrReportBgColor(data: string): boolean;
setOrReportCursorColor(data: string): boolean;
restoreIndexedColor(data: string): boolean;
restoreFgColor(data: string): boolean;
restoreBgColor(data: string): boolean;
restoreCursorColor(data: string): boolean;
nextLine(): boolean;
keypadApplicationMode(): boolean;
keypadNumericMode(): boolean;
selectDefaultCharset(): boolean;
selectCharset(collectAndFlag: string): boolean;
index(): boolean;
tabSet(): boolean;
reverseIndex(): boolean;
fullReset(): boolean;
setgLevel(level: number): boolean;
screenAlignmentPattern(): boolean;
}
export interface IParseStack {
paused: boolean;
cursorStartX: number;
cursorStartY: number;
decodedLength: number;
position: number;
}
//# sourceMappingURL=Types.d.ts.map
File diff suppressed because one or more lines are too long
+3
View File
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Types.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Types.js","sourceRoot":"","sources":["Types.ts"],"names":[],"mappings":""}
+10 -185
View File
@@ -3,14 +3,21 @@
* @license MIT
*/
import type { UnderlineStyle } from 'common/buffer/Constants';
import type { IBufferSet } from 'common/buffer/Types';
import type { IParams } from 'common/parser/Types';
import type { IMouseStateService, ICoreService, IOptionsService, IUnicodeService } from 'common/services/Services';
import { IFunctionIdentifier, ITerminalOptions as IPublicTerminalOptions } from '@xterm/xterm';
import { IFunctionIdentifier } from '@xterm/xterm';
import type { IDisposable } from 'common/base/Lifecycle';
import type { ITerminalOptions } from 'common/base/TerminalOptions';
import type { IColorRGB } from 'common/buffer/CellTypes';
import type { IEvent } from 'common/base/Event';
export type { IDisposable } from 'common/base/Lifecycle';
export type { ITerminalOptions } from 'common/base/TerminalOptions';
export type { CharData, IAttributeData, ICellData, IBufferLine, IExtendedAttrs, IMarker } from 'common/buffer/CellTypes';
export type { ICharset } from 'common/data/Charsets';
export type { IKeyboardEvent, IKeyboardResult, KeyboardResultType } from 'common/input/KeyboardTypes';
export type { UnicodeCharProperties, UnicodeCharWidth, IUnicodeVersionProvider } from 'common/input/UnicodeTypes';
export interface ICoreTerminal {
mouseStateService: IMouseStateService;
@@ -26,73 +33,21 @@ export interface ICoreTerminal {
registerApcHandler(id: IFunctionIdentifier, callback: (data: string) => boolean | Promise<boolean>): IDisposable;
}
export interface IDisposable {
dispose(): void;
}
// TODO: The options that are not in the public API should be reviewed
export interface ITerminalOptions extends IPublicTerminalOptions {
[key: string]: any;
convertEol?: boolean;
termName?: string;
}
export type CursorStyle = 'block' | 'underline' | 'bar';
export type CursorInactiveStyle = 'outline' | 'block' | 'bar' | 'underline' | 'none';
export type XtermListener = (...args: any[]) => void;
/**
* A keyboard event interface which does not depend on the DOM, KeyboardEvent implicitly extends
* this event.
*/
export interface IKeyboardEvent {
altKey: boolean;
ctrlKey: boolean;
shiftKey: boolean;
metaKey: boolean;
/** @deprecated See KeyboardEvent.keyCode */
keyCode: number;
key: string;
type: string;
code: string;
}
export interface IScrollEvent {
position: number;
}
export const enum KeyboardResultType {
SEND_KEY,
SELECT_ALL,
PAGE_UP,
PAGE_DOWN
}
export interface IKeyboardResult {
type: KeyboardResultType;
cancel: boolean;
key: string | undefined;
}
export type CharData = [attr: number, char: string, width: number, code: number];
export interface IColor {
readonly css: string;
readonly rgba: number; // 32-bit int with rgba in each byte
}
export type IColorRGB = [red: number, green: number, blue: number];
export interface IExtendedAttrs {
ext: number;
underlineStyle: UnderlineStyle;
underlineColor: number;
underlineVariantOffset: number;
urlId: number;
clone(): IExtendedAttrs;
isEmpty(): boolean;
}
export type { IColorRGB } from 'common/buffer/CellTypes';
/**
* Tracks the current hyperlink. Since these are treated as extended attirbutes, these get passed on
@@ -105,136 +60,6 @@ export interface IOscLinkData {
uri: string;
}
/**
* An object that represents all attributes of a cell.
*/
export interface IAttributeData {
/**
* "fg" is a 32-bit unsigned integer that stores the foreground color of the cell in the 24 least
* significant bits and additional flags in the remaining 8 bits.
*/
fg: number;
/**
* "bg" is a 32-bit unsigned integer that stores the background color of the cell in the 24 least
* significant bits and additional flags in the remaining 8 bits.
*/
bg: number;
/**
* "extended", aka "ext", stores extended attributes beyond those available in fg and bg. This
* data is optional on a cell and encodes less common data.
*/
extended: IExtendedAttrs;
clone(): IAttributeData;
// flags
isInverse(): number;
isBold(): number;
isUnderline(): number;
isBlink(): number;
isInvisible(): number;
isItalic(): number;
isDim(): number;
isStrikethrough(): number;
isProtected(): number;
isOverline(): number;
/**
* The color mode of the foreground color which determines how to decode {@link getFgColor},
* possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
* {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
*/
getFgColorMode(): number;
/**
* The color mode of the background color which determines how to decode {@link getBgColor},
* possible values include {@link Attributes.CM_DEFAULT}, {@link Attributes.CM_P16},
* {@link Attributes.CM_P256} and {@link Attributes.CM_RGB}.
*/
getBgColorMode(): number;
isFgRGB(): boolean;
isBgRGB(): boolean;
isFgPalette(): boolean;
isBgPalette(): boolean;
isFgDefault(): boolean;
isBgDefault(): boolean;
isAttributeDefault(): boolean;
/**
* Gets an integer representation of the foreground color, how to decode the color depends on the
* color mode {@link getFgColorMode}.
*/
getFgColor(): number;
/**
* Gets an integer representation of the background color, how to decode the color depends on the
* color mode {@link getBgColorMode}.
*/
getBgColor(): number;
// extended attrs
hasExtendedAttrs(): number;
updateExtended(): void;
getUnderlineColor(): number;
getUnderlineColorMode(): number;
isUnderlineColorRGB(): boolean;
isUnderlineColorPalette(): boolean;
isUnderlineColorDefault(): boolean;
getUnderlineStyle(): number;
getUnderlineVariantOffset(): number;
}
/** Cell data */
export interface ICellData extends IAttributeData {
content: number;
combinedData: string;
isCombined(): number;
getWidth(): number;
getChars(): string;
getCode(): number;
setFromCharData(value: CharData): void;
getAsCharData(): CharData;
}
/**
* Interface for a line in the terminal buffer.
*/
export interface IBufferLine {
length: number;
isWrapped: boolean;
get(index: number): CharData;
set(index: number, value: CharData): void;
loadCell(index: number, cell: ICellData): ICellData;
setCell(index: number, cell: ICellData): void;
setCellFromCodepoint(index: number, codePoint: number, width: number, attrs: IAttributeData): void;
addCodepointToCell(index: number, codePoint: number, width: number): void;
insertCells(pos: number, n: number, ch: ICellData): void;
deleteCells(pos: number, n: number, fill: ICellData): void;
replaceCells(start: number, end: number, fill: ICellData, respectProtect?: boolean): void;
resize(cols: number, fill: ICellData): boolean;
cleanupMemory(): number;
fill(fillCellData: ICellData, respectProtect?: boolean): void;
copyFrom(line: IBufferLine): void;
clone(): IBufferLine;
getTrimmedLength(): number;
getNoBgTrimmedLength(): number;
translateToString(trimRight?: boolean, startCol?: number, endCol?: number, outColumns?: number[]): string;
/* direct access to cell attrs */
getWidth(index: number): number;
hasWidth(index: number): number;
getFg(index: number): number;
getBg(index: number): number;
hasContent(index: number): number;
getCodePoint(index: number): number;
isCombined(index: number): number;
getString(index: number): string;
}
export interface IMarker extends IDisposable {
readonly id: number;
readonly isDisposed: boolean;
readonly line: number;
onDispose: IEvent<void>;
}
export interface IModes {
insertMode: boolean;
}
@@ -0,0 +1 @@
{"version":3,"file":"UnicodeService.d.ts","sourceRoot":"","sources":["UnicodeService.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClH,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAGvH,qBAAa,cAAe,YAAW,eAAe;IAC7C,YAAY,EAAE,GAAG,CAAC;IAEzB,OAAO,CAAC,UAAU,CAAiE;IACnF,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,eAAe,CAA0B;IAEjD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;IACnD,SAAgB,QAAQ,6CAAwB;IAEhD,OAAc,iBAAiB,2BAAqB;IACpD,OAAc,YAAY,sBAAgB;IAC1C,OAAc,eAAe,yBAAmB;IAChD,OAAc,mBAAmB,6BAAuB;IAExD,cAKC;IAEM,OAAO,IAAI,IAAI,CAErB;IAED,IAAW,QAAQ,IAAI,MAAM,EAAE,CAE9B;IAED,IAAW,aAAa,IAAI,MAAM,CAEjC;IAED,IAAW,aAAa,CAAC,OAAO,EAAE,MAAM,EAOvC;IAEM,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,GAAG,IAAI,CAEvD;IAKM,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAE5C;IAEM,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAkC3C;IAEM,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,GAAG,qBAAqB,CAEhG;CACF"}
+7 -13
View File
@@ -4,7 +4,9 @@
*/
import { UnicodeV6 } from 'common/input/UnicodeV6';
import { IUnicodeService, IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';
import { IUnicodeService } from 'common/services/Services';
import type { IUnicodeVersionProvider, UnicodeCharProperties, UnicodeCharWidth } from 'common/input/UnicodeTypes';
import { createPropertyValue, extractCharKind, extractShouldJoin, extractWidth } from 'common/input/UnicodeProperties';
import { Emitter } from 'common/base/Event';
export class UnicodeService implements IUnicodeService {
@@ -17,18 +19,10 @@ export class UnicodeService implements IUnicodeService {
private readonly _onChange = new Emitter<string>();
public readonly onChange = this._onChange.event;
public static extractShouldJoin(value: UnicodeCharProperties): boolean {
return (value & 1) !== 0;
}
public static extractWidth(value: UnicodeCharProperties): UnicodeCharWidth {
return ((value >> 1) & 0x3) as UnicodeCharWidth;
}
public static extractCharKind(value: UnicodeCharProperties): number {
return value >> 3;
}
public static createPropertyValue(state: number, width: number, shouldJoin: boolean = false): UnicodeCharProperties {
return ((state & 0xffffff) << 3) | ((width & 3) << 1) | (shouldJoin?1:0);
}
public static extractShouldJoin = extractShouldJoin;
public static extractWidth = extractWidth;
public static extractCharKind = extractCharKind;
public static createPropertyValue = createPropertyValue;
constructor() {
const defaultProvider = new UnicodeV6();
+32 -3
View File
@@ -1,8 +1,37 @@
{
"extends": ["../tsconfig.json"],
"extends": [
"../../tsconfig-library-base",
"../tsconfig.compiler.json"
],
"compilerOptions": {
"noEmit": true,
"outDir": "../../../out/common/services",
"rootDir": "."
},
"include": ["./**/*"]
"include": [
"./**/*",
"../../../typings/xterm.d.ts"
],
"references": [
{
"path": "../base"
},
{
"path": "../encoding"
},
{
"path": "../data"
},
{
"path": "../buffer"
},
{
"path": "../parser"
},
{
"path": "../input"
}
],
"exclude": [
"**/*.test.ts"
]
}
File diff suppressed because one or more lines are too long
+35 -3
View File
@@ -1,8 +1,40 @@
{
"extends": ["../tsconfig.json"],
"extends": [
"../../tsconfig-library-base",
"../tsconfig.compiler.json"
],
"compilerOptions": {
"noEmit": true,
"outDir": "../../../out/common/terminal",
"rootDir": "."
},
"include": ["./**/*"]
"include": [
"./**/*",
"../../../typings/xterm.d.ts"
],
"references": [
{
"path": "../base"
},
{
"path": "../encoding"
},
{
"path": "../data"
},
{
"path": "../buffer"
},
{
"path": "../parser"
},
{
"path": "../input"
},
{
"path": "../services"
}
],
"exclude": [
"**/*.test.ts"
]
}
+28
View File
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"lib": [
"es2015",
"es2016.Array.Include",
"es2019.string",
"es2021.weakref",
"dom"
],
"types": [
"../../node_modules/@types/mocha"
],
"paths": {
"@xterm/xterm": ["../../typings/xterm.d.ts"],
"common/base/*": ["./base/*"],
"common/encoding/*": ["./encoding/*"],
"common/data/*": ["./data/*"],
"common/buffer/*": ["./buffer/*"],
"common/parser/*": ["./parser/*"],
"common/input/*": ["./input/*"],
"common/services/*": ["./services/*"],
"common/terminal/*": ["./terminal/*"],
"common/public/*": ["./public/*"],
"common/*": ["./*"],
"*": ["../*"]
}
}
}
+11 -38
View File
@@ -1,42 +1,15 @@
{
"extends": "../tsconfig-library-base",
"compilerOptions": {
"lib": [
"es2015",
"es2016.Array.Include",
"es2019.string",
"es2021.weakref",
"dom"
],
"outDir": "../../out/common",
"rootDir": ".",
"types": [
"../../node_modules/@types/mocha"
],
"paths": {
"common/base/*": ["./base/*"],
"common/encoding/*": ["./encoding/*"],
"common/data/*": ["./data/*"],
"common/buffer/*": ["./buffer/*"],
"common/parser/*": ["./parser/*"],
"common/input/*": ["./input/*"],
"common/services/*": ["./services/*"],
"common/terminal/*": ["./terminal/*"],
"common/public/*": ["./public/*"],
"common/*": ["./*"],
"*": ["../*"]
}
},
"include": [
"./base/**/*",
"./encoding/**/*",
"./data/**/*",
"./buffer/**/*",
"./parser/**/*",
"./input/**/*",
"./services/**/*",
"./terminal/**/*",
"./public/**/*",
"../../typings/xterm.d.ts"
"files": [],
"references": [
{ "path": "./base" },
{ "path": "./encoding" },
{ "path": "./data" },
{ "path": "./buffer" },
{ "path": "./parser" },
{ "path": "./input" },
{ "path": "./services" },
{ "path": "./terminal" },
{ "path": "./public" }
]
}