Compare commits

..
Author SHA1 Message Date
Cursor AgentandDaniel Imms 7c6f793aa2 Fix webpack aliases for target-* module paths and out/primitives+runtime
Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-05-31 00:32:19 +00:00
Cursor AgentandDaniel Imms f22ef02831 Move primitives and runtime out of src/common/
Relocate src/common/primitives and src/common/runtime to src/primitives
and src/runtime. Add src/tsconfig.json as the primitives+runtime solution.
Update tsconfigs, esbuild, webpack aliases, publish path, and docs.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-05-31 00:30:53 +00:00
Cursor AgentandDaniel Imms c569e5ab19 Full common split: composite tsconfigs and target-* modules
- Add composite TypeScript projects for common/primitives and common/runtime
- Decouple primitives from runtime (buffer service interfaces, UnicodeProperties, CellTypes, etc.)
- Move Types.ts to runtime; re-export primitive types from runtime/Types
- Rename src/browser -> src/target-browser, src/headless -> src/target-headless
- Update import paths (target-browser/*, target-headless/*) across repo
- Fix esbuild outbase so common/* and target-* resolve under out-esbuild/
- Point unicode addons at primitives for UnicodeTypes/UnicodeProperties
- Update ARCHITECTURE.md and AGENTS.md

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-05-31 00:19:43 +00:00
Cursor AgentandDaniel Imms 9a65429a30 Split common into primitives and runtime layers
Reorganize src/common per issue #5963: move building blocks under
primitives/ and services/integration under runtime/. Preserve existing
common/* import paths via TypeScript path mapping. Add src/ARCHITECTURE.md
documenting modules and goals.

Fix two relative imports broken by the directory depth change.

Co-authored-by: Daniel Imms <Tyriar@users.noreply.github.com>
2026-05-30 23:47:30 +00:00
284 changed files with 1334 additions and 1509 deletions
+7 -4
View File
@@ -2,10 +2,13 @@
## Architecture Overview
**Core Structure**: xterm.js is a multi-target terminal emulator with three main distributions:
- `src/browser/`: Full-featured browser terminal with DOM rendering
- `src/headless/`: Server-side terminal for Node.js (no DOM)
- `src/common/`: Shared core logic (parsing, buffer management, terminal state)
**Core Structure**: xterm.js is a multi-target terminal emulator with these main source areas:
- `src/primitives/`: Building blocks (buffer, parser, input, data, utilities); TypeScript project `src/primitives/tsconfig.json`
- `src/runtime/`: Services, `CoreTerminal`, `InputHandler`, public API adapters; TypeScript project `src/runtime/tsconfig.json`
- `src/target-browser/`: Browser terminal with DOM rendering
- `src/target-headless/`: Node terminal without DOM
See `src/ARCHITECTURE.md` for the dependency graph and import-path conventions (`common/*`, `target-browser/*`, `target-headless/*`).
**Key Classes**:
- `Terminal` (browser/headless): Public API wrapper
+6 -5
View File
@@ -11,10 +11,11 @@
"removeComments": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"*": [
"./*"
@@ -31,10 +32,10 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
},
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
},
{
"path": "../../../test/playwright"
+3 -3
View File
@@ -15,8 +15,8 @@
"../../../node_modules/@types/mocha"
],
"paths": {
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"@xterm/addon-clipboard": [
"../typings/addon-clipboard.d.ts"
@@ -29,7 +29,7 @@
],
"references": [
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
}
]
}
+6 -5
View File
@@ -11,10 +11,11 @@
"removeComments": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"*": [
"./*"
@@ -31,10 +32,10 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
},
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
},
{
"path": "../../../test/playwright"
+1 -1
View File
@@ -5,7 +5,7 @@
import type { Terminal, ITerminalAddon, IRenderDimensions } from '@xterm/xterm';
import type { FitAddon as IFitApi } from '@xterm/addon-fit';
import { ViewportConstants } from 'browser/shared/Constants';
import { ViewportConstants } from 'target-browser/shared/Constants';
interface ITerminalDimensions {
/**
+3 -3
View File
@@ -15,8 +15,8 @@
"../../../node_modules/@types/mocha"
],
"paths": {
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"@xterm/addon-fit": [
"../typings/addon-fit.d.ts"
@@ -29,7 +29,7 @@
],
"references": [
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
}
]
}
+6 -5
View File
@@ -11,10 +11,11 @@
"removeComments": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"*": [
"./*"
@@ -31,10 +32,10 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
},
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
},
{
"path": "../../../test/playwright"
+1 -1
View File
@@ -5,7 +5,7 @@
import type { ITerminalAddon, IDisposable } from '@xterm/xterm';
import type { ImageAddon as IImageApi } from '@xterm/addon-image';
import { Emitter, type IEvent } from 'common/base/Event';
import { Emitter, type IEvent } from 'common/Event';
import { IIPHandler } from './IIPHandler';
import { ImageRenderer } from './ImageRenderer';
import { ImageStorage, CELL_SIZE_DEFAULT } from './ImageStorage';
+1 -1
View File
@@ -6,7 +6,7 @@
import { toRGBA8888 } from 'sixel/lib/Colors';
import { IDisposable } from '@xterm/xterm';
import { ICellSize, ImageLayer, ITerminalExt, IImageSpec, IRenderDimensions, IRenderService } from './Types';
import { Disposable, MutableDisposable, toDisposable } from 'common/base/Lifecycle';
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
const enum Constants {
PLACEHOLDER_LENGTH = 4096,
+4 -5
View File
@@ -9,11 +9,10 @@ import { IDisposable, IMarker, Terminal } from '@xterm/xterm';
import { Attributes, BgFlags, Content, ExtFlags, UnderlineStyle } from 'common/buffer/Constants';
import type { AttributeData } from 'common/buffer/AttributeData';
import type { IParams, IDcsHandler, IOscHandler, IApcHandler, IEscapeSequenceParser } from 'common/parser/Types';
import type { IBufferLine, IExtendedAttrs } from 'common/buffer/CellTypes';
import type { IInputHandler } from 'common/terminal/InputHandlerTypes';
import type { ITerminal, ReadonlyColorSet } from 'browser/Types';
import type { IRenderDimensions } from 'browser/renderer/shared/Types';
import type { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
import type { IBufferLine, IExtendedAttrs, IInputHandler } from 'common/Types';
import type { ITerminal, ReadonlyColorSet } from 'target-browser/Types';
import type { IRenderDimensions } from 'target-browser/renderer/shared/Types';
import type { ICoreBrowserService, IRenderService, IThemeService } from 'target-browser/services/Services';
export const enum Cell {
CONTENT = 0, // codepoint and wcwidth information (enum Content)
+7 -4
View File
@@ -12,8 +12,11 @@
"../../../node_modules/@types/mocha"
],
"paths": {
"browser/*": [ "../../../src/browser/*" ],
"common/*": [ "../../../src/common/*" ],
"target-browser/*": [ "../../../src/target-browser/*" ],
"common/*": [
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"@xterm/addon-image": [ "../typings/addon-image.d.ts" ],
"*": [ "./*" ]
}
@@ -23,7 +26,7 @@
"../../../typings/xterm.d.ts"
],
"references": [
{ "path": "../../../src/browser" },
{ "path": "../../../src/common" }
{ "path": "../../../src/target-browser" },
{ "path": "../../../src" }
]
}
+6 -5
View File
@@ -11,10 +11,11 @@
"removeComments": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"*": [
"./*"
@@ -31,10 +32,10 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
},
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
},
{
"path": "../../../test/playwright"
+5 -2
View File
@@ -25,8 +25,11 @@ const addon = {
modules: ['./node_modules'],
extensions: [ '.js' ],
alias: {
common: path.resolve('../../out/common'),
browser: path.resolve('../../out/browser'),
common: [
path.resolve('../../out/runtime'),
path.resolve('../../out/primitives'),
],
browser: path.resolve('../../out/target-browser'),
vs: path.resolve('../../out/vs')
}
},
+1 -1
View File
@@ -5,7 +5,7 @@
import type { Terminal, ITerminalAddon, IDisposable } from '@xterm/xterm';
import type { ProgressAddon as IProgressApi, IProgressState } from '@xterm/addon-progress';
import type { Emitter, IEvent } from 'common/base/Event';
import type { Emitter, IEvent } from 'common/Event';
const enum ProgressType {
+6 -5
View File
@@ -16,10 +16,11 @@
],
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"@xterm/addon-progress": [
"../typings/addon-progress.d.ts"
@@ -32,10 +33,10 @@
],
"references": [
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
},
{
"path": "../../../src/common"
"path": "../../../src"
}
]
}
+6 -5
View File
@@ -11,10 +11,11 @@
"removeComments": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"*": [
"./*"
@@ -31,10 +32,10 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
},
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
},
{
"path": "../../../test/playwright"
+5 -2
View File
@@ -25,8 +25,11 @@ module.exports = {
modules: ['./node_modules'],
extensions: [ '.js' ],
alias: {
common: path.resolve('../../out/common'),
browser: path.resolve('../../out/browser'),
common: [
path.resolve('../../out/runtime'),
path.resolve('../../out/primitives'),
],
browser: path.resolve('../../out/target-browser'),
vs: path.resolve('../../out/vs')
}
},
+1 -1
View File
@@ -5,7 +5,7 @@
import type { Terminal, IDisposable, IDecoration } from '@xterm/xterm';
import type { ISearchDecorationOptions } from '@xterm/addon-search';
import { dispose, Disposable, toDisposable } from 'common/base/Lifecycle';
import { dispose, Disposable, toDisposable } from 'common/Lifecycle';
import type { ISearchResult } from './SearchEngine';
/**
+3 -3
View File
@@ -5,9 +5,9 @@
import type { Terminal, IDisposable, ITerminalAddon } from '@xterm/xterm';
import type { SearchAddon as ISearchApi, ISearchOptions, ISearchAddonOptions, ISearchResultChangeEvent, ISearchDecorationOptions } from '@xterm/addon-search';
import { Emitter, type IEvent } from 'common/base/Event';
import { Disposable, MutableDisposable, toDisposable } from 'common/base/Lifecycle';
import { disposableTimeout } from 'common/base/Async';
import { Emitter, type IEvent } from 'common/Event';
import { Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
import { disposableTimeout } from 'common/Async';
import { SearchLineCache } from './SearchLineCache';
import { SearchState } from './SearchState';
import { SearchEngine, type ISearchResult } from './SearchEngine';
+2 -2
View File
@@ -5,9 +5,9 @@
import { assert } from 'chai';
import { SearchEngine } from './SearchEngine';
import { SearchLineCache } from './SearchLineCache';
import { Terminal } from 'browser/public/Terminal';
import { Terminal } from 'target-browser/public/Terminal';
import type { ISearchOptions } from '@xterm/addon-search';
import { DisposableStore } from 'common/base/Lifecycle';
import { DisposableStore } from 'common/Lifecycle';
function writeP(terminal: Terminal, data: string): Promise<void> {
return new Promise(r => terminal.write(data, r));
@@ -4,8 +4,8 @@
*/
import { assert } from 'chai';
import { SearchLineCache, LineCacheEntry } from './SearchLineCache';
import { Terminal } from 'browser/public/Terminal';
import { timeout } from 'common/base/Async';
import { Terminal } from 'target-browser/public/Terminal';
import { timeout } from 'common/Async';
function writeP(terminal: Terminal, data: string): Promise<void> {
return new Promise(r => terminal.write(data, r));
+2 -2
View File
@@ -4,8 +4,8 @@
*/
import type { Terminal } from '@xterm/xterm';
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/base/Lifecycle';
import { disposableTimeout } from 'common/base/Async';
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
import { disposableTimeout } from 'common/Async';
export type LineCacheEntry = [
/**
@@ -5,8 +5,8 @@
import type { ISearchResultChangeEvent } from '@xterm/addon-search';
import type { IDisposable } from '@xterm/xterm';
import { Emitter, type IEvent } from 'common/base/Event';
import { Disposable } from 'common/base/Lifecycle';
import { Emitter, type IEvent } from 'common/Event';
import { Disposable } from 'common/Lifecycle';
import type { ISearchResult } from './SearchEngine';
/**
+6 -5
View File
@@ -16,10 +16,11 @@
],
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"@xterm/addon-search" : [
"../typings/addon-search.d.ts"
@@ -32,10 +33,10 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
},
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
}
]
}
+6 -5
View File
@@ -11,10 +11,11 @@
"removeComments": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"*": [
"./*"
@@ -31,10 +32,10 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
},
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
},
{
"path": "../../../test/playwright"
+4 -1
View File
@@ -25,7 +25,10 @@ module.exports = {
modules: ['./node_modules'],
extensions: [ '.js' ],
alias: {
common: path.resolve('../../out/common'),
common: [
path.resolve('../../out/runtime'),
path.resolve('../../out/primitives'),
],
vs: path.resolve('../../out/vs')
}
},
@@ -6,8 +6,8 @@
import { perfContext, before, ThroughputRuntimeCase } from 'xterm-benchmark';
import { spawn } from 'node-pty';
import { Utf8ToUtf32, stringFromCodePoint } from 'common/encoding/TextDecoder';
import { Terminal } from 'browser/public/Terminal';
import { Utf8ToUtf32, stringFromCodePoint } from 'common/input/TextDecoder';
import { Terminal } from 'target-browser/public/Terminal';
import { SerializeAddon } from 'SerializeAddon';
class TestTerminal extends Terminal {
@@ -12,8 +12,11 @@
"target": "es2021",
"module": "nodenext",
"paths": {
"common/*": ["../../../src/common/*"],
"browser/*": ["../../../src/browser/*"],
"common/*": [
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"target-browser/*": ["../../../src/target-browser/*"],
"SerializeAddon": ["../src/SerializeAddon"],
"@xterm/addon-serialize": [
"../typings/addon-serialize.d.ts"
@@ -23,7 +26,7 @@
"include": ["../**/*", "../../../typings/xterm.d.ts"],
"exclude": ["../../../**/*test.ts", "../../**/*api.ts"],
"references": [
{ "path": "../../../src/common" },
{ "path": "../../../src/browser" }
{ "path": "../../../src" },
{ "path": "../../../src/target-browser" }
]
}
@@ -6,10 +6,10 @@
import jsdom = require('jsdom');
import { assert } from 'chai';
import { SerializeAddon } from './SerializeAddon';
import { Terminal } from 'browser/public/Terminal';
import { SelectionModel } from 'browser/selection/SelectionModel';
import { Terminal } from 'target-browser/public/Terminal';
import { SelectionModel } from 'target-browser/selection/SelectionModel';
import { IBufferService } from 'common/services/Services';
import { ThemeService } from 'browser/services/ThemeService';
import { ThemeService } from 'target-browser/services/ThemeService';
function sgr(...seq: string[]): string {
return `\x1b[${seq.join(';')}m`;
+2 -3
View File
@@ -7,9 +7,8 @@
import type { IBuffer, IBufferCell, IBufferRange, ITerminalAddon, Terminal } from '@xterm/xterm';
import type { IHTMLSerializeOptions, SerializeAddon as ISerializeApi, ISerializeOptions, ISerializeRange } from '@xterm/addon-serialize';
import type { IAttributeData } from 'common/buffer/CellTypes';
import type { IColor } from 'common/base/ColorTypes';
import { DEFAULT_ANSI_COLORS } from 'browser/Types';
import { IAttributeData, IColor } from 'common/Types';
import { DEFAULT_ANSI_COLORS } from 'target-browser/Types';
import { UnderlineStyle } from 'common/buffer/Constants';
function constrain(value: number, low: number, high: number): number {
+6 -5
View File
@@ -12,10 +12,11 @@
"removeComments": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"@xterm/addon-serialize": [
"../typings/addon-serialize.d.ts"
@@ -33,10 +34,10 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
},
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
}
]
}
+6 -5
View File
@@ -11,10 +11,11 @@
"removeComments": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
]
},
"strict": true,
@@ -28,10 +29,10 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
},
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
},
{
"path": "../../../test/playwright"
+5 -2
View File
@@ -25,8 +25,11 @@ module.exports = {
modules: ['./node_modules'],
extensions: [ '.js' ],
alias: {
common: path.resolve('../../out/common'),
browser: path.resolve('../../out/browser')
common: [
path.resolve('../../out/runtime'),
path.resolve('../../out/primitives'),
],
browser: path.resolve('../../out/target-browser')
}
},
output: {
@@ -6,8 +6,8 @@
import { perfContext, before, ThroughputRuntimeCase } from 'xterm-benchmark';
import { spawn } from 'node-pty';
import { Utf8ToUtf32, stringFromCodePoint } from 'common/encoding/TextDecoder';
import { CoreBrowserTerminal } from 'browser/CoreBrowserTerminal';
import { Utf8ToUtf32, stringFromCodePoint } from 'common/input/TextDecoder';
import { CoreBrowserTerminal } from 'target-browser/CoreBrowserTerminal';
import { UnicodeGraphemeProvider } from 'UnicodeGraphemeProvider';
@@ -9,8 +9,11 @@
"target": "es2015",
"module": "nodenext",
"paths": {
"common/*": ["../../../src/common/*"],
"browser/*": ["../../../src/browser/*"],
"common/*": [
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"target-browser/*": ["../../../src/target-browser/*"],
"UnicodeGraphemeProvider": ["../src/UnicodeGraphemeProvider"],
"@xterm/addon-unicode-graphemes": [
"../typings/addon-unicode-graphemes.d.ts"
@@ -20,7 +23,7 @@
"include": ["../**/*", "../../../typings/xterm.d.ts"],
"exclude": ["../../../**/*test.ts", "../../**/*api.ts"],
"references": [
{ "path": "../../../src/common" },
{ "path": "../../../src/browser" }
{ "path": "../../../src" },
{ "path": "../../../src/target-browser" }
]
}
@@ -4,8 +4,8 @@
*/
import { IUnicodeVersionProvider } from '@xterm/xterm';
import { UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';
import { UnicodeService } from 'common/services/UnicodeService';
import { createPropertyValue, extractCharKind, extractWidth } from 'common/input/UnicodeProperties';
import { UnicodeCharProperties, UnicodeCharWidth } from 'common/input/UnicodeTypes';
import * as UC from './third-party/UnicodeProperties';
export class UnicodeGraphemeProvider implements IUnicodeVersionProvider {
@@ -19,7 +19,7 @@ export class UnicodeGraphemeProvider implements IUnicodeVersionProvider {
}
private static readonly _plainNarrowProperties: UnicodeCharProperties
= UnicodeService.createPropertyValue(UC.GRAPHEME_BREAK_Other, 1, false);
= createPropertyValue(UC.GRAPHEME_BREAK_Other, 1, false);
public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {
// Optimize the simple ASCII case, under the condition that
@@ -39,9 +39,9 @@ export class UnicodeGraphemeProvider implements IUnicodeVersionProvider {
w = 1;
}
if (preceding !== 0) {
const oldWidth = UnicodeService.extractWidth(preceding);
const oldWidth = extractWidth(preceding);
if (this.handleGraphemes) {
charInfo = UC.shouldJoin(UnicodeService.extractCharKind(preceding), charInfo);
charInfo = UC.shouldJoin(extractCharKind(preceding), charInfo);
} else {
charInfo = w === 0 ? 1 : 0;
}
@@ -54,7 +54,7 @@ export class UnicodeGraphemeProvider implements IUnicodeVersionProvider {
}
}
}
return UnicodeService.createPropertyValue(charInfo, w, shouldJoin);
return createPropertyValue(charInfo, w, shouldJoin);
}
public wcwidth(codepoint: number): UnicodeCharWidth {
@@ -13,7 +13,8 @@
"strict": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"@xterm/addon-unicode-graphemes": [
"../typings/addon-unicode-graphemes.d.ts"
@@ -29,7 +30,7 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
}
]
}
@@ -11,10 +11,11 @@
"removeComments": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
]
},
"strict": true,
@@ -28,10 +29,10 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
},
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
},
{
"path": "../../../test/playwright"
@@ -25,7 +25,10 @@ module.exports = {
modules: ['./node_modules'],
extensions: [ '.js' ],
alias: {
common: path.resolve('../../out/common'),
common: [
path.resolve('../../out/runtime'),
path.resolve('../../out/primitives'),
],
vs: path.resolve('../../out/vs')
}
},
+4 -4
View File
@@ -4,8 +4,8 @@
*/
import { IUnicodeVersionProvider } from '@xterm/xterm';
import { UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';
import { UnicodeService } from 'common/services/UnicodeService';
import { createPropertyValue, extractWidth } from 'common/input/UnicodeProperties';
import { UnicodeCharProperties, UnicodeCharWidth } from 'common/input/UnicodeTypes';
const BMP_COMBINING = [
[0x0300, 0x036F], [0x0483, 0x0489], [0x0591, 0x05BD],
@@ -223,13 +223,13 @@ export class UnicodeV11 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);
}
}
+3 -2
View File
@@ -13,7 +13,8 @@
"strict": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"@xterm/addon-unicode11": [
"../typings/addon-unicode11.d.ts"
@@ -32,7 +33,7 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
}
]
}
+6 -5
View File
@@ -11,10 +11,11 @@
"removeComments": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"*": [
"./*"
@@ -31,10 +32,10 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
},
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
},
{
"path": "../../../test/playwright"
+4 -1
View File
@@ -25,7 +25,10 @@ module.exports = {
modules: ['./node_modules'],
extensions: [ '.js' ],
alias: {
common: path.resolve('../../out/common'),
common: [
path.resolve('../../out/runtime'),
path.resolve('../../out/primitives'),
],
vs: path.resolve('../../out/vs')
}
},
+6 -5
View File
@@ -11,10 +11,11 @@
"removeComments": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"*": [
"./*"
@@ -31,10 +32,10 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
},
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
},
{
"path": "../../../test/playwright"
+6 -5
View File
@@ -11,10 +11,11 @@
"removeComments": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"*": [
"./*"
@@ -31,10 +32,10 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
},
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
},
{
"path": "../../../test/playwright"
+6 -6
View File
@@ -1,12 +1,12 @@
import { ISelectionRenderModel } from 'browser/renderer/shared/Types';
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { ReadonlyColorSet } from 'browser/Types';
import { ISelectionRenderModel } from 'target-browser/renderer/shared/Types';
import { ICoreBrowserService, IThemeService } from 'target-browser/services/Services';
import { ReadonlyColorSet } from 'target-browser/Types';
import { Attributes, BgFlags, ExtFlags, FgFlags, NULL_CELL_CODE, UnderlineStyle } from 'common/buffer/Constants';
import { IDecorationService, IOptionsService } from 'common/services/Services';
import type { ICellData } from 'common/buffer/CellTypes';
import { ICellData } from 'common/Types';
import { Terminal } from '@xterm/xterm';
import { rgba } from 'common/base/Color';
import { treatGlyphAsBackgroundColor } from 'browser/renderer/shared/RendererUtils';
import { rgba } from 'common/Color';
import { treatGlyphAsBackgroundColor } from 'target-browser/renderer/shared/RendererUtils';
import { blockPatternCodepoints } from './customGlyphs/CustomGlyphDefinitions';
// Work variables to avoid garbage collection
+1 -1
View File
@@ -5,7 +5,7 @@
import { TextureAtlas } from './TextureAtlas';
import { ITerminalOptions, Terminal } from '@xterm/xterm';
import { ITerminal, ReadonlyColorSet } from 'browser/Types';
import { ITerminal, ReadonlyColorSet } from 'target-browser/Types';
import { ICharAtlasConfig, ITextureAtlas } from './Types';
import { generateConfig, configEquals } from './CharAtlasUtils';
import type { ILogService } from 'common/services/Services';
@@ -6,8 +6,8 @@
import { assert } from 'chai';
import { configEquals } from './CharAtlasUtils';
import { ICharAtlasConfig } from './Types';
import { NULL_COLOR } from 'common/base/Color';
import type { IColor } from 'common/base/ColorTypes';
import { NULL_COLOR } from 'common/Color';
import { IColor } from 'common/Types';
function createTestConfig(overrides: Partial<ICharAtlasConfig> = {}): ICharAtlasConfig {
const color: IColor = { css: '#ffffff', rgba: 0xffffffff };
+2 -2
View File
@@ -6,8 +6,8 @@
import { ICharAtlasConfig } from './Types';
import { Attributes } from 'common/buffer/Constants';
import { ITerminalOptions } from '@xterm/xterm';
import { IColorSet, ReadonlyColorSet } from 'browser/Types';
import { NULL_COLOR } from 'common/base/Color';
import { IColorSet, ReadonlyColorSet } from 'target-browser/Types';
import { NULL_COLOR } from 'common/Color';
export function generateConfig(deviceCellWidth: number, deviceCellHeight: number, deviceCharWidth: number, deviceCharHeight: number, options: Required<ITerminalOptions>, colors: ReadonlyColorSet, devicePixelRatio: number, deviceMaxTextureSize: number, customGlyphs: boolean = true): ICharAtlasConfig {
// null out some fields that don't matter
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { isFirefox, isLegacyEdge } from 'common/base/Platform';
import { isFirefox, isLegacyEdge } from 'common/Platform';
export const DIM_OPACITY = 0.5;
// The text baseline is set conditionally by browser. Using 'ideographic' for Firefox or Legacy Edge
@@ -3,8 +3,8 @@
* @license MIT
*/
import { RendererConstants } from 'browser/renderer/shared/Constants';
import { ICoreBrowserService } from 'browser/services/Services';
import { RendererConstants } from 'target-browser/renderer/shared/Constants';
import { ICoreBrowserService } from 'target-browser/services/Services';
const enum Constants {
/**
@@ -3,7 +3,7 @@
* @license MIT
*/
import { toDisposable, IDisposable } from 'common/base/Lifecycle';
import { toDisposable, IDisposable } from 'common/Lifecycle';
export function observeDevicePixelDimensions(element: HTMLElement, parentWindow: Window & typeof globalThis, callback: (deviceWidth: number, deviceHeight: number) => void): IDisposable {
// Observe any resizes to the element and extract the actual pixel size of the element if the
+3 -3
View File
@@ -3,14 +3,14 @@
* @license MIT
*/
import { TextureAtlas } from './TextureAtlas';
import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { IRenderDimensions } from 'target-browser/renderer/shared/Types';
import { NULL_CELL_CODE } from 'common/buffer/Constants';
import { Disposable, toDisposable } from 'common/base/Lifecycle';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { Terminal } from '@xterm/xterm';
import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject, type IRasterizedGlyph, type ITextureAtlas } from './Types';
import { createProgram, GLTexture, PROJECTION_MATRIX } from './WebglUtils';
import type { ILogService, IOptionsService } from 'common/services/Services';
import { allowRescaling, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
import { allowRescaling, throwIfFalsy } from 'target-browser/renderer/shared/RendererUtils';
interface IVertices {
attributes: Float32Array;
+6 -6
View File
@@ -3,17 +3,17 @@
* @license MIT
*/
import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { IThemeService } from 'browser/services/Services';
import { ReadonlyColorSet } from 'browser/Types';
import { IRenderDimensions } from 'target-browser/renderer/shared/Types';
import { IThemeService } from 'target-browser/services/Services';
import { ReadonlyColorSet } from 'target-browser/Types';
import { Attributes, FgFlags } from 'common/buffer/Constants';
import { Disposable, toDisposable } from 'common/base/Lifecycle';
import type { IColor } from 'common/base/ColorTypes';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { IColor } from 'common/Types';
import { Terminal } from '@xterm/xterm';
import { RenderModelConstants } from './RenderModel';
import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject } from './Types';
import { createProgram, expandFloat32Array, PROJECTION_MATRIX } from './WebglUtils';
import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
import { throwIfFalsy } from 'target-browser/renderer/shared/RendererUtils';
import type { ILogService } from 'common/services/Services';
const enum VertexAttribLocations {
+2 -2
View File
@@ -4,8 +4,8 @@
*/
import { ICursorRenderModel, IRenderModel } from './Types';
import { ISelectionRenderModel } from 'browser/renderer/shared/Types';
import { createSelectionRenderModel } from 'browser/renderer/shared/SelectionRenderModel';
import { ISelectionRenderModel } from 'target-browser/renderer/shared/Types';
import { createSelectionRenderModel } from 'target-browser/renderer/shared/SelectionRenderModel';
export const enum RenderModelConstants {
INDICIES_PER_CELL = 4,
+7 -7
View File
@@ -3,19 +3,19 @@
* @license MIT
*/
import { IColorContrastCache } from 'browser/Types';
import { IColorContrastCache } from 'target-browser/Types';
import { DIM_OPACITY, TEXT_BASELINE } from './Constants';
import { tryDrawCustomGlyph } from './customGlyphs/CustomGlyphRasterizer';
import { computeNextVariantOffset, treatGlyphAsBackgroundColor, isPowerlineGlyph, isRestrictedPowerlineGlyph, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
import { computeNextVariantOffset, treatGlyphAsBackgroundColor, isPowerlineGlyph, isRestrictedPowerlineGlyph, throwIfFalsy } from 'target-browser/renderer/shared/RendererUtils';
import { IBoundingBox, ICharAtlasConfig, IRasterizedGlyph, ITextureAtlas } from './Types';
import { NULL_COLOR, channels, color, rgba } from 'common/base/Color';
import { FourKeyMap } from 'common/base/MultiKeyMap';
import { IdleTaskQueue } from 'common/base/TaskQueue';
import type { IColor } from 'common/base/ColorTypes';
import { NULL_COLOR, channels, color, rgba } from 'common/Color';
import { FourKeyMap } from 'common/MultiKeyMap';
import { IdleTaskQueue } from 'common/TaskQueue';
import { IColor } from 'common/Types';
import { AttributeData } from 'common/buffer/AttributeData';
import { Attributes, DEFAULT_COLOR, DEFAULT_EXT, UnderlineStyle } from 'common/buffer/Constants';
import { ILogService, IUnicodeService } from 'common/services/Services';
import { Emitter } from 'common/base/Event';
import { Emitter } from 'common/Event';
/**
* A shared object which is used to draw nothing for a particular cell.
+4 -5
View File
@@ -4,11 +4,10 @@
*/
import { FontWeight } from '@xterm/xterm';
import { IColorSet } from 'browser/Types';
import { ISelectionRenderModel } from 'browser/renderer/shared/Types';
import type { IDisposable } from 'common/base/Lifecycle';
import { CursorInactiveStyle, CursorStyle } from 'common/services/Types';
import type { IEvent } from 'common/base/Event';
import { IColorSet } from 'target-browser/Types';
import { ISelectionRenderModel } from 'target-browser/renderer/shared/Types';
import { CursorInactiveStyle, CursorStyle, type IDisposable } from 'common/Types';
import type { IEvent } from 'common/Event';
export interface IRenderModel {
cells: Uint32Array;
+5 -5
View File
@@ -5,14 +5,14 @@
import type { ITerminalAddon, Terminal } from '@xterm/xterm';
import type { IWebglAddonOptions, WebglAddon as IWebglApi } from '@xterm/addon-webgl';
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
import { ITerminal } from 'browser/Types';
import { Disposable, toDisposable } from 'common/base/Lifecycle';
import { getSafariVersion, isSafari } from 'common/base/Platform';
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'target-browser/services/Services';
import { ITerminal } from 'target-browser/Types';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { getSafariVersion, isSafari } from 'common/Platform';
import { ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services';
import { IWebGL2RenderingContext } from './Types';
import { WebglRenderer } from './WebglRenderer';
import { Emitter, EventUtils } from 'common/base/Event';
import { Emitter, EventUtils } from 'common/Event';
export class WebglAddon extends Disposable implements ITerminalAddon, IWebglApi {
private _terminal?: Terminal;
+9 -9
View File
@@ -3,18 +3,18 @@
* @license MIT
*/
import { ITerminal } from 'browser/Types';
import { ITerminal } from 'target-browser/Types';
import { CellColorResolver } from './CellColorResolver';
import { acquireTextureAtlas, removeTerminalFromCache } from './CharAtlasCache';
import { CursorBlinkStateManager } from './CursorBlinkStateManager';
import { observeDevicePixelDimensions } from './DevicePixelObserver';
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types';
import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
import type { CharData, IBufferLine, ICellData } from 'common/buffer/CellTypes';
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'target-browser/renderer/shared/Types';
import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'target-browser/services/Services';
import { CharData, IBufferLine, ICellData } from 'common/Types';
import { AttributeData } from 'common/buffer/AttributeData';
import { CellData } from 'common/buffer/CellData';
import { Attributes, Content, FgFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/buffer/Constants';
import { TextBlinkStateManager } from 'browser/renderer/shared/TextBlinkStateManager';
import { TextBlinkStateManager } from 'target-browser/renderer/shared/TextBlinkStateManager';
import { ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services';
import { Terminal } from '@xterm/xterm';
import { GlyphRenderer } from './GlyphRenderer';
@@ -23,10 +23,10 @@ import { COMBINED_CHAR_BIT_MASK, RenderModel, RenderModelConstants } from './Ren
import { IWebGL2RenderingContext, type ITextureAtlas } from './Types';
import { LinkRenderLayer } from './renderLayer/LinkRenderLayer';
import { IRenderLayer } from './renderLayer/Types';
import { Emitter, EventUtils } from 'common/base/Event';
import { addDisposableListener } from 'browser/Dom';
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/base/Lifecycle';
import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
import { Emitter, EventUtils } from 'common/Event';
import { addDisposableListener } from 'target-browser/Dom';
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
import { createRenderDimensions } from 'target-browser/renderer/shared/RendererUtils';
const enum Constants {
MERGE_RETRY_LIMIT = 32
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
import { throwIfFalsy } from 'target-browser/renderer/shared/RendererUtils';
import type { ILogService } from 'common/services/Services';
/**
@@ -3,7 +3,7 @@
* @license MIT
*/
import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
import { throwIfFalsy } from 'target-browser/renderer/shared/RendererUtils';
import type { ILogService } from 'common/services/Services';
import { customGlyphDefinitions } from './CustomGlyphDefinitions';
import { CustomGlyphDefinitionType, CustomGlyphScaleType, CustomGlyphVectorType, type CustomGlyphDefinitionPart, type CustomGlyphPathDrawFunctionDefinition, type CustomGlyphPatternDefinition, type ICustomGlyphSolidOctantBlockVector, type ICustomGlyphVectorShape } from './Types';
@@ -3,16 +3,16 @@
* @license MIT
*/
import { ReadonlyColorSet } from 'browser/Types';
import { ReadonlyColorSet } from 'target-browser/Types';
import { acquireTextureAtlas } from '../CharAtlasCache';
import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { Disposable, toDisposable } from 'common/base/Lifecycle';
import { IRenderDimensions } from 'target-browser/renderer/shared/Types';
import { ICoreBrowserService, IThemeService } from 'target-browser/services/Services';
import { Disposable, toDisposable } from 'common/Lifecycle';
import { CellData } from 'common/buffer/CellData';
import { IOptionsService } from 'common/services/Services';
import { Terminal } from '@xterm/xterm';
import { IRenderLayer } from './Types';
import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
import { throwIfFalsy } from 'target-browser/renderer/shared/RendererUtils';
import { TEXT_BASELINE } from '../Constants';
import type { ITextureAtlas } from '../Types';
@@ -4,10 +4,10 @@
*/
import { is256Color } from '../CharAtlasUtils';
import { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants';
import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { ILinkifier2, ILinkifierEvent } from 'browser/Types';
import { INVERTED_DEFAULT_COLOR } from 'target-browser/renderer/shared/Constants';
import { IRenderDimensions } from 'target-browser/renderer/shared/Types';
import { ICoreBrowserService, IThemeService } from 'target-browser/services/Services';
import { ILinkifier2, ILinkifierEvent } from 'target-browser/Types';
import { IOptionsService } from 'common/services/Services';
import { Terminal } from '@xterm/xterm';
import { BaseRenderLayer } from './BaseRenderLayer';
+1 -1
View File
@@ -4,7 +4,7 @@
*/
import { IDisposable, Terminal } from '@xterm/xterm';
import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { IRenderDimensions } from 'target-browser/renderer/shared/Types';
export interface IRenderLayer extends IDisposable {
/**
+6 -5
View File
@@ -12,10 +12,11 @@
"removeComments": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"@xterm/addon-webgl": [
"../typings/addon-webgl.d.ts"
@@ -36,10 +37,10 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
},
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
}
]
}
+6 -5
View File
@@ -11,10 +11,11 @@
"removeComments": true,
"paths": {
"common/*": [
"../../../src/common/*"
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"browser/*": [
"../../../src/browser/*"
"target-browser/*": [
"../../../src/target-browser/*"
],
"*": [
"./*"
@@ -32,10 +33,10 @@
],
"references": [
{
"path": "../../../src/common"
"path": "../../../src"
},
{
"path": "../../../src/browser"
"path": "../../../src/target-browser"
},
{
"path": "../../../test/playwright"
+5 -2
View File
@@ -25,8 +25,11 @@ module.exports = {
modules: ['./node_modules'],
extensions: [ '.js' ],
alias: {
common: path.resolve('../../out/common'),
browser: path.resolve('../../out/browser'),
common: [
path.resolve('../../out/runtime'),
path.resolve('../../out/primitives'),
],
browser: path.resolve('../../out/target-browser'),
vs: path.resolve('../../out/vs')
}
},
+37 -13
View File
@@ -92,6 +92,9 @@ let outConfig = {
}
let skipOut = false;
/** @type {esbuild.BuildOptions[] | undefined} */
let outBuilds;
/** @type {esbuild.BuildOptions} */
let outTestConfig = {
format: 'cjs',
@@ -171,7 +174,7 @@ if (config.addon) {
} else if (config.isHeadless) {
bundleConfig = {
...bundleConfig,
entryPoints: [`src/headless/public/Terminal.ts`],
entryPoints: [`src/target-headless/public/Terminal.ts`],
outfile: `headless/lib-headless/xterm-headless.mjs`
};
outConfig = {
@@ -183,18 +186,35 @@ if (config.addon) {
} else {
bundleConfig = {
...bundleConfig,
entryPoints: [`src/browser/public/Terminal.ts`],
entryPoints: [`src/target-browser/public/Terminal.ts`],
outfile: `lib/xterm.mjs`
};
outConfig = {
...outConfig,
entryPoints: [
'src/browser/**/*.ts',
'src/common/**/*.ts',
'src/headless/**/*.ts'
],
outdir: 'out-esbuild/'
};
outBuilds = [
{
...outConfig,
entryPoints: ['src/primitives/**/*.ts'],
outbase: 'src/primitives',
outdir: 'out-esbuild/common',
},
{
...outConfig,
entryPoints: ['src/runtime/**/*.ts'],
outbase: 'src/runtime',
outdir: 'out-esbuild/common',
},
{
...outConfig,
entryPoints: ['src/target-browser/**/*.ts'],
outbase: 'src',
outdir: 'out-esbuild',
},
{
...outConfig,
entryPoints: ['src/target-headless/**/*.ts'],
outbase: 'src',
outdir: 'out-esbuild',
},
];
outTestConfig = {
...outConfig,
entryPoints: ['test/**/*.ts'],
@@ -205,7 +225,9 @@ if (config.addon) {
if (config.isWatch) {
context(bundleConfig).then(e => e.watch());
if (!skipOut) {
context(outConfig).then(e => e.watch());
for (const buildConfig of outBuilds ?? [outConfig]) {
context(buildConfig).then(e => e.watch());
}
}
if (!skipOutTest) {
context(outTestConfig).then(e => e.watch());
@@ -213,7 +235,9 @@ if (config.isWatch) {
} else {
await build(bundleConfig);
if (!skipOut) {
await build(outConfig);
for (const buildConfig of outBuilds ?? [outConfig]) {
await build(buildConfig);
}
}
if (!skipOutTest) {
await build(outTestConfig);
+1 -1
View File
@@ -81,7 +81,7 @@ function checkAndPublishPackage(packageDir, repoCommit, peerDependencies, update
// Update Version.ts with the new version
if (updateVersionTs) {
const versionTsPath = path.join(packageDir, 'src/common/base/Version.ts');
const versionTsPath = path.join(packageDir, 'src/primitives/Version.ts');
const versionTsContent = fs.readFileSync(versionTsPath, 'utf8');
const updatedVersionTs = versionTsContent.replace(
/export const XTERM_VERSION = '[^']+';/,
+1 -1
View File
@@ -38,4 +38,4 @@ function findUnusedSymbols(
}
// Example usage
findUnusedSymbols("./src/browser/tsconfig.json");
findUnusedSymbols("./src/target-browser/tsconfig.json");
+70
View File
@@ -0,0 +1,70 @@
# xterm.js source architecture
This document describes how `src/` is organized. The layout follows [issue #5963](https://github.com/xtermjs/xterm.js/issues/5963): **primitives** and **runtime** as separate TypeScript composite projects, with **target-browser** and **target-headless** as platform entry points.
## Dependency graph
```mermaid
flowchart BT
primitives["primitives<br/>building blocks"]
runtime["runtime<br/>services, integration"]
targetBrowser["target-browser<br/>DOM terminal"]
targetHeadless["target-headless<br/>Node terminal"]
runtime --> primitives
targetBrowser --> runtime
targetHeadless --> runtime
```
## TypeScript projects
| Project | `tsconfig` | Output | Role |
| --- | --- | --- | --- |
| Primitives | `src/primitives/tsconfig.json` | `out/primitives/` | Buffer, parser, input helpers, static data, shared utilities. Must not import from `runtime/`. |
| Runtime | `src/runtime/tsconfig.json` | `out/runtime/` | Services (DI), `CoreTerminal`, `InputHandler`, public API adapters, `Types.ts`. References primitives. |
| Source (solution) | `src/tsconfig.json` | — | Solution root; references primitives + runtime only. |
| Target browser | `src/target-browser/tsconfig.json` | `out/target-browser/` | Browser rendering, input, public `Terminal`. References `src/`. |
| Target headless | `src/target-headless/tsconfig.json` | `out/target-headless/` | Headless terminal. References `src/`. |
Unit test files (`**/*.test.ts`) are excluded from composite library builds; they are compiled via esbuild for `npm run test-unit`.
## `primitives/`
| Area | Contents |
| --- | --- |
| Root utilities | `Async`, `CircularList`, `Color`, `ColorTypes`, `Event`, `KeyboardTypes`, `Lifecycle`, `MultiKeyMap`, `Platform`, `SortedList`, `StringBuilder`, `TaskQueue`, `TerminalOptions`, `Version` |
| `buffer/` | Screen buffer, `CellTypes`, `BufferService` / `BufferOptions` / `BufferLog` interfaces (buffer-layer contracts) |
| `data/` | `Charsets`, `EscapeSequences` |
| `input/` | UTF decoding, keyboard helpers, `UnicodeTypes`, `UnicodeProperties` |
| `parser/` | Escape-sequence parser |
Primitives depend only on other primitives (and `@xterm/xterm` typings where needed). Buffer code uses `IBufferService` from `common/buffer/BufferService`, not `common/services/Services`.
## `runtime/`
| Area | Contents |
| --- | --- |
| `services/` | DI implementations (`BufferService`, `OptionsService`, …) |
| `public/` | Public API adapters (`AddonManager`, buffer/parser views) |
| Root | `CoreTerminal`, `InputHandler`, `WindowsMode`, `Types.ts`, `TestUtils.test.ts` |
`Types.ts` re-exports primitive types and adds integration types (`IInputHandler`, `ICoreTerminal`, mouse/color helpers, etc.).
## Import paths
Source keeps the `common/...` prefix (logical module name, not a physical `common/` folder). Each project's `paths` in `tsconfig.json` map that prefix to `primitives/` and/or `runtime/`.
Platform code uses:
- `target-browser/...` — browser terminal
- `target-headless/...` — Node terminal
## Published packages vs source folders
The npm package directory `headless/` (e.g. `headless/lib-headless/`) is unchanged; only the **source** tree uses `src/target-headless/`.
## Related issues
- [#5963](https://github.com/xtermjs/xterm.js/issues/5963) — module split
- [#5896](https://github.com/xtermjs/xterm.js/issues/5896) — relative imports
- [#5897](https://github.com/xtermjs/xterm.js/issues/5897) — `import/no-cycle` lint
-28
View File
@@ -1,28 +0,0 @@
{
"extends": "../tsconfig-library-base",
"compilerOptions": {
"lib": [
"dom",
"es2021"
],
"outDir": "../../out",
"types": [
"../../node_modules/@types/mocha"
],
"skipLibCheck": true,
"paths": {
"common/*": [ "./../common/*" ],
"*": [ "./../*" ]
}
},
"include": [
"./**/*",
"../../typings/xterm.d.ts"
],
"exclude": [
"**/*.test.ts"
],
"references": [
{ "path": "../common" }
]
}
-60
View File
@@ -1,60 +0,0 @@
# Common folder rearchitecture
Layered layout for `src/common/` as proposed in [issue #5963](https://github.com/xtermjs/xterm.js/issues/5963).
## Dependency graph (target)
```mermaid
flowchart BT
subgraph platform["Platform layer"]
direction LR
base["common/base"]
encoding["common/encoding"]
data["common/data"]
buffer["common/buffer"]
parser["common/parser"]
input["common/input"]
encoding --> base
data --> base
buffer --> encoding
buffer --> data
parser --> buffer
input --> parser
end
subgraph integration["Integration layer"]
direction LR
services["common/services"]
terminal["common/terminal"]
terminal --> services
end
subgraph api_layer["API layer"]
public["common/public"]
end
integration --> platform
api_layer --> integration
```
## Package contents
| Project | Role | Notable sources |
| --- | --- | --- |
| `common/base` | Core utilities (lifecycle, events, platform) | `Async`, `Event`, `Lifecycle`, `Platform`, `StringBuilder`, `Version`, `CircularList`, `Color`, `ColorTypes` |
| `common/encoding` | UTF conversion | `TextDecoder` (moved from `input/`) |
| `common/data` | Static terminal data | `Charsets`, `EscapeSequences` |
| `common/buffer` | Screen buffer | `Buffer`, `BufferLine`, … |
| `common/parser` | Escape sequence parser | `EscapeSequenceParser`, … |
| `common/input` | Keyboard / write path helpers | `Keyboard`, `WriteBuffer`, … |
| `common/services` | DI service implementations | `Services`, `Types` (modes, mouse, osc link), … |
| `common/terminal` | Core terminal + input handler | `CoreTerminal`, `CoreTerminalTypes`, `InputHandler`, `InputHandlerTypes`, `WindowsMode` |
| `common/public` | Public API adapters | `AddonManager`, buffer API views |
## TypeScript projects
- **`common/tsconfig.json`** — solution root; references each layer project (no sources).
- **`common/<layer>/tsconfig.json`** — self-contained composite project (`lib`, `paths`, `types`, `references`, `outDir`). Test files (`**/*.test.ts`) are excluded from composite builds; unit tests compile via esbuild.
Buffer-layer code depends on `buffer/BufferService`, `buffer/BufferOptions`, and `buffer/BufferLog` instead of `services` so the `buffer` project does not reference `services`.
-38
View File
@@ -1,38 +0,0 @@
{
"extends": "../../tsconfig-library-base",
"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/*": ["./*"],
"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/*": ["../*"],
"*": ["../../*"]
},
"outDir": "../../../out/common/base",
"rootDir": "."
},
"include": [
"./**/*",
"../../../typings/xterm.d.ts"
],
"exclude": [
"**/*.test.ts"
]
}
-43
View File
@@ -1,43 +0,0 @@
{
"extends": "../../tsconfig-library-base",
"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/*": ["./*"],
"common/parser/*": ["../parser/*"],
"common/input/*": ["../input/*"],
"common/services/*": ["../services/*"],
"common/terminal/*": ["../terminal/*"],
"common/public/*": ["../public/*"],
"common/*": ["../*"],
"*": ["../../*"]
},
"outDir": "../../../out/common/buffer",
"rootDir": "."
},
"include": [
"./**/*",
"../../../typings/xterm.d.ts"
],
"exclude": [
"**/*.test.ts"
],
"references": [
{ "path": "../base" },
{ "path": "../encoding" },
{ "path": "../data" }
]
}
-40
View File
@@ -1,40 +0,0 @@
{
"extends": "../../tsconfig-library-base",
"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/*": ["./*"],
"common/buffer/*": ["../buffer/*"],
"common/parser/*": ["../parser/*"],
"common/input/*": ["../input/*"],
"common/services/*": ["../services/*"],
"common/terminal/*": ["../terminal/*"],
"common/public/*": ["../public/*"],
"common/*": ["../*"],
"*": ["../../*"]
},
"outDir": "../../../out/common/data",
"rootDir": "."
},
"include": [
"./**/*"
],
"exclude": [
"**/*.test.ts"
],
"references": [
{ "path": "../base" }
]
}
-40
View File
@@ -1,40 +0,0 @@
{
"extends": "../../tsconfig-library-base",
"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/*": ["./*"],
"common/data/*": ["../data/*"],
"common/buffer/*": ["../buffer/*"],
"common/parser/*": ["../parser/*"],
"common/input/*": ["../input/*"],
"common/services/*": ["../services/*"],
"common/terminal/*": ["../terminal/*"],
"common/public/*": ["../public/*"],
"common/*": ["../*"],
"*": ["../../*"]
},
"outDir": "../../../out/common/encoding",
"rootDir": "."
},
"include": [
"./**/*"
],
"exclude": [
"**/*.test.ts"
],
"references": [
{ "path": "../base" }
]
}
-30
View File
@@ -1,30 +0,0 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
/** CSI window manipulation options (see InputHandler). */
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;
}
-44
View File
@@ -1,44 +0,0 @@
{
"extends": "../../tsconfig-library-base",
"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/*": ["./*"],
"common/services/*": ["../services/*"],
"common/terminal/*": ["../terminal/*"],
"common/public/*": ["../public/*"],
"common/*": ["../*"],
"*": ["../../*"]
},
"outDir": "../../../out/common/input",
"rootDir": "."
},
"include": [
"./**/*"
],
"exclude": [
"**/*.test.ts"
],
"references": [
{ "path": "../base" },
{ "path": "../encoding" },
{ "path": "../data" },
{ "path": "../buffer" },
{ "path": "../parser" }
]
}
-43
View File
@@ -1,43 +0,0 @@
{
"extends": "../../tsconfig-library-base",
"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/*": ["./*"],
"common/input/*": ["../input/*"],
"common/services/*": ["../services/*"],
"common/terminal/*": ["../terminal/*"],
"common/public/*": ["../public/*"],
"common/*": ["../*"],
"*": ["../../*"]
},
"outDir": "../../../out/common/parser",
"rootDir": "."
},
"include": [
"./**/*"
],
"exclude": [
"**/*.test.ts"
],
"references": [
{ "path": "../base" },
{ "path": "../encoding" },
{ "path": "../data" },
{ "path": "../buffer" }
]
}
-48
View File
@@ -1,48 +0,0 @@
{
"extends": "../../tsconfig-library-base",
"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/*": ["./*"],
"common/*": ["../*"],
"*": ["../../*"]
},
"outDir": "../../../out/common/public",
"rootDir": "."
},
"include": [
"./**/*",
"../../../typings/xterm.d.ts"
],
"exclude": [
"**/*.test.ts"
],
"references": [
{ "path": "../base" },
{ "path": "../encoding" },
{ "path": "../data" },
{ "path": "../buffer" },
{ "path": "../parser" },
{ "path": "../input" },
{ "path": "../services" },
{ "path": "../terminal" }
]
}
-98
View File
@@ -1,98 +0,0 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
export type CursorStyle = 'block' | 'underline' | 'bar';
export type CursorInactiveStyle = 'outline' | 'block' | 'bar' | 'underline' | 'none';
/**
* Tracks the current hyperlink for OscLinkService.
*/
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; // defaults: xterm - true, vt100 - false
}
/**
* Kitty keyboard protocol state (CoreService).
*/
export interface IKittyKeyboardState {
flags: number;
mainFlags: number;
altFlags: number;
mainStack: number[];
altStack: number[];
}
export 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 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 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;
-46
View File
@@ -1,46 +0,0 @@
{
"extends": "../../tsconfig-library-base",
"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/*": ["./*"],
"common/terminal/*": ["../terminal/*"],
"common/public/*": ["../public/*"],
"common/*": ["../*"],
"*": ["../../*"]
},
"outDir": "../../../out/common/services",
"rootDir": "."
},
"include": [
"./**/*",
"../../../typings/xterm.d.ts"
],
"exclude": [
"**/*.test.ts"
],
"references": [
{ "path": "../base" },
{ "path": "../encoding" },
{ "path": "../data" },
{ "path": "../buffer" },
{ "path": "../parser" },
{ "path": "../input" }
]
}
-31
View File
@@ -1,31 +0,0 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
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';
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 interface IScrollEvent {
position: number;
}
export type XtermListener = (...args: any[]) => void;
-154
View File
@@ -1,154 +0,0 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import type { IColorRGB } from 'common/base/ColorTypes';
import type { IDisposable } from 'common/base/Lifecycle';
import type { IEvent } from 'common/base/Event';
import type { IParams } from 'common/parser/Types';
import { IFunctionIdentifier } from '@xterm/xterm';
export type { IWindowOptions } from 'common/input/WindowOptions';
// color events from common, used for OSC 4/10/11/12 and 104/110/111/112
export const enum ColorRequestType {
REPORT = 0,
SET = 1,
RESTORE = 2
}
// IntRange from https://stackoverflow.com/a/39495173
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>; // number from 0 to 255
export type AllColorIndex = ColorIndex | SpecialColorIndex;
export 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)[];
/**
* Calls the parser and handles actions generated by the parser.
*/
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;
/** C0 BEL */ bell(): boolean;
/** C0 LF */ lineFeed(): boolean;
/** C0 CR */ carriageReturn(): boolean;
/** C0 BS */ backspace(): boolean;
/** C0 HT */ tab(): boolean;
/** C0 SO */ shiftOut(): boolean;
/** C0 SI */ shiftIn(): boolean;
/** CSI @ */ insertChars(params: IParams): boolean;
/** CSI SP @ */ scrollLeft(params: IParams): boolean;
/** CSI A */ cursorUp(params: IParams): boolean;
/** CSI SP A */ scrollRight(params: IParams): boolean;
/** CSI B */ cursorDown(params: IParams): boolean;
/** CSI C */ cursorForward(params: IParams): boolean;
/** CSI D */ cursorBackward(params: IParams): boolean;
/** CSI E */ cursorNextLine(params: IParams): boolean;
/** CSI F */ cursorPrecedingLine(params: IParams): boolean;
/** CSI G */ cursorCharAbsolute(params: IParams): boolean;
/** CSI H */ cursorPosition(params: IParams): boolean;
/** CSI I */ cursorForwardTab(params: IParams): boolean;
/** CSI J */ eraseInDisplay(params: IParams): boolean;
/** CSI K */ eraseInLine(params: IParams): boolean;
/** CSI L */ insertLines(params: IParams): boolean;
/** CSI M */ deleteLines(params: IParams): boolean;
/** CSI P */ deleteChars(params: IParams): boolean;
/** CSI S */ scrollUp(params: IParams): boolean;
/** CSI T */ scrollDown(params: IParams, collect?: string): boolean;
/** CSI X */ eraseChars(params: IParams): boolean;
/** CSI Z */ cursorBackwardTab(params: IParams): boolean;
/** CSI ` */ charPosAbsolute(params: IParams): boolean;
/** CSI a */ hPositionRelative(params: IParams): boolean;
/** CSI b */ repeatPrecedingCharacter(params: IParams): boolean;
/** CSI c */ sendDeviceAttributesPrimary(params: IParams): boolean;
/** CSI > c */ sendDeviceAttributesSecondary(params: IParams): boolean;
/** CSI d */ linePosAbsolute(params: IParams): boolean;
/** CSI e */ vPositionRelative(params: IParams): boolean;
/** CSI f */ hVPosition(params: IParams): boolean;
/** CSI g */ tabClear(params: IParams): boolean;
/** CSI h */ setMode(params: IParams, collect?: string): boolean;
/** CSI l */ resetMode(params: IParams, collect?: string): boolean;
/** CSI m */ charAttributes(params: IParams): boolean;
/** CSI n */ deviceStatus(params: IParams, collect?: string): boolean;
/** CSI p */ softReset(params: IParams, collect?: string): boolean;
/** CSI q */ setCursorStyle(params: IParams, collect?: string): boolean;
/** CSI r */ setScrollRegion(params: IParams, collect?: string): boolean;
/** CSI s */ saveCursor(params: IParams): boolean;
/** CSI u */ restoreCursor(params: IParams): boolean;
/** CSI ' } */ insertColumns(params: IParams): boolean;
/** CSI ' ~ */ deleteColumns(params: IParams): boolean;
/** OSC 0 */
/** OSC 2 */ setTitle(data: string): boolean;
/** OSC 4 */ setOrReportIndexedColor(data: string): boolean;
/** OSC 10 */ setOrReportFgColor(data: string): boolean;
/** OSC 11 */ setOrReportBgColor(data: string): boolean;
/** OSC 12 */ setOrReportCursorColor(data: string): boolean;
/** OSC 104 */ restoreIndexedColor(data: string): boolean;
/** OSC 110 */ restoreFgColor(data: string): boolean;
/** OSC 111 */ restoreBgColor(data: string): boolean;
/** OSC 112 */ restoreCursorColor(data: string): boolean;
/** ESC E */ nextLine(): boolean;
/** ESC = */ keypadApplicationMode(): boolean;
/** ESC > */ keypadNumericMode(): boolean;
/** ESC % G */
/** ESC % @ */ selectDefaultCharset(): boolean;
/** ESC ( C */
/** ESC ) C */
/** ESC * C */
/** ESC + C */
/** ESC - C */
/** ESC . C */
/** ESC / C */ selectCharset(collectAndFlag: string): boolean;
/** ESC D */ index(): boolean;
/** ESC H */ tabSet(): boolean;
/** ESC M */ reverseIndex(): boolean;
/** ESC c */ fullReset(): boolean;
/** ESC n */
/** ESC o */
/** ESC | */
/** ESC } */
/** ESC ~ */ setgLevel(level: number): boolean;
/** ESC # 8 */ screenAlignmentPattern(): boolean;
}
export interface IParseStack {
paused: boolean;
cursorStartX: number;
cursorStartY: number;
decodedLength: number;
position: number;
}
-47
View File
@@ -1,47 +0,0 @@
{
"extends": "../../tsconfig-library-base",
"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/*": ["./*"],
"common/public/*": ["../public/*"],
"common/*": ["../*"],
"*": ["../../*"]
},
"outDir": "../../../out/common/terminal",
"rootDir": "."
},
"include": [
"./**/*",
"../../../typings/xterm.d.ts"
],
"exclude": [
"**/*.test.ts"
],
"references": [
{ "path": "../base" },
{ "path": "../encoding" },
{ "path": "../data" },
{ "path": "../buffer" },
{ "path": "../parser" },
{ "path": "../input" },
{ "path": "../services" }
]
}
-15
View File
@@ -1,15 +0,0 @@
{
"extends": "../tsconfig-library-base",
"files": [],
"references": [
{ "path": "./base" },
{ "path": "./encoding" },
{ "path": "./data" },
{ "path": "./buffer" },
{ "path": "./parser" },
{ "path": "./input" },
{ "path": "./services" },
{ "path": "./terminal" },
{ "path": "./public" }
]
}
@@ -5,7 +5,7 @@
* Minimal async helpers for xterm.js core.
*/
import { DisposableStore, IDisposable, toDisposable } from 'common/base/Lifecycle';
import { DisposableStore, IDisposable, toDisposable } from 'common/Lifecycle';
export function timeout(millis: number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, millis));
@@ -4,7 +4,7 @@
*/
import { assert } from 'chai';
import { CircularList } from 'common/base/CircularList';
import { CircularList } from 'common/CircularList';
describe('CircularList', () => {
describe('push', () => {
@@ -3,18 +3,8 @@
* @license MIT
*/
import { Disposable } from 'common/base/Lifecycle';
import { Emitter, type IEvent } from 'common/base/Event';
export interface IInsertEvent {
index: number;
amount: number;
}
export interface IDeleteEvent {
index: number;
amount: number;
}
import { Disposable } from 'common/Lifecycle';
import { Emitter, type IEvent } from 'common/Event';
export interface ICircularList<T> {
length: number;
@@ -38,6 +28,16 @@ export interface ICircularList<T> {
shiftElements(start: number, count: number, offset: number): void;
}
export interface IInsertEvent {
index: number;
amount: number;
}
export interface IDeleteEvent {
index: number;
amount: number;
}
/**
* Represents a circular list; a list with a maximum size that wraps around when push is called,
* overriding values at the start of the list.
@@ -4,7 +4,7 @@
*/
import { assert } from 'chai';
import { channels, color, css, rgb, rgba, toPaddedHex, contrastRatio } from 'common/base/Color';
import { channels, color, css, rgb, rgba, toPaddedHex, contrastRatio } from 'common/Color';
describe('Color', () => {
@@ -3,8 +3,7 @@
* @license MIT
*/
import type { IColor } from 'common/base/ColorTypes';
import type { IColorRGB } from 'common/base/ColorTypes';
import { IColor, IColorRGB } from 'common/ColorTypes';
let $r = 0;
let $g = 0;
@@ -4,7 +4,7 @@
*/
import { assert } from 'chai';
import { Emitter } from 'common/base/Event';
import { Emitter } from 'common/Event';
describe('Emitter', () => {
it('should fire with 0 listeners without error', () => {
@@ -6,7 +6,7 @@
* Simplified from VS Code's event.ts - no leak detection/profiling.
*/
import { IDisposable, DisposableStore, toDisposable } from 'common/base/Lifecycle';
import { IDisposable, DisposableStore, toDisposable } from 'common/Lifecycle';
export interface IEvent<T> {
(listener: (e: T) => any, thisArgs?: any, disposables?: IDisposable[] | DisposableStore): IDisposable;
@@ -3,9 +3,6 @@
* @license MIT
*/
/**
* A keyboard event interface which does not depend on the DOM.
*/
export interface IKeyboardEvent {
altKey: boolean;
ctrlKey: boolean;
@@ -4,7 +4,7 @@
*/
import { assert } from 'chai';
import { FourKeyMap, TwoKeyMap } from 'common/base/MultiKeyMap';
import { FourKeyMap, TwoKeyMap } from 'common/MultiKeyMap';
const strictEqual = assert.strictEqual;

Some files were not shown because too many files have changed in this diff Show More