Compare commits

..
259 changed files with 901 additions and 1033 deletions
+4 -7
View File
@@ -2,13 +2,10 @@
## Architecture Overview ## Architecture Overview
**Core Structure**: xterm.js is a multi-target terminal emulator with these main source areas: **Core Structure**: xterm.js is a multi-target terminal emulator with three main distributions:
- `src/primitives/`: Building blocks (buffer, parser, input, data, utilities); TypeScript project `src/primitives/tsconfig.json` - `src/browser/`: Full-featured browser terminal with DOM rendering
- `src/runtime/`: Services, `CoreTerminal`, `InputHandler`, public API adapters; TypeScript project `src/runtime/tsconfig.json` - `src/headless/`: Server-side terminal for Node.js (no DOM)
- `src/target-browser/`: Browser terminal with DOM rendering - `src/common/`: Shared core logic (parsing, buffer management, terminal state)
- `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**: **Key Classes**:
- `Terminal` (browser/headless): Public API wrapper - `Terminal` (browser/headless): Public API wrapper
+5 -6
View File
@@ -11,11 +11,10 @@
"removeComments": true, "removeComments": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"*": [ "*": [
"./*" "./*"
@@ -32,10 +31,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
}, },
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
}, },
{ {
"path": "../../../test/playwright" "path": "../../../test/playwright"
+3 -3
View File
@@ -15,8 +15,8 @@
"../../../node_modules/@types/mocha" "../../../node_modules/@types/mocha"
], ],
"paths": { "paths": {
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"@xterm/addon-clipboard": [ "@xterm/addon-clipboard": [
"../typings/addon-clipboard.d.ts" "../typings/addon-clipboard.d.ts"
@@ -29,7 +29,7 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
} }
] ]
} }
+5 -6
View File
@@ -11,11 +11,10 @@
"removeComments": true, "removeComments": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"*": [ "*": [
"./*" "./*"
@@ -32,10 +31,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
}, },
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
}, },
{ {
"path": "../../../test/playwright" "path": "../../../test/playwright"
+1 -1
View File
@@ -5,7 +5,7 @@
import type { Terminal, ITerminalAddon, IRenderDimensions } from '@xterm/xterm'; import type { Terminal, ITerminalAddon, IRenderDimensions } from '@xterm/xterm';
import type { FitAddon as IFitApi } from '@xterm/addon-fit'; import type { FitAddon as IFitApi } from '@xterm/addon-fit';
import { ViewportConstants } from 'target-browser/shared/Constants'; import { ViewportConstants } from 'browser/shared/Constants';
interface ITerminalDimensions { interface ITerminalDimensions {
/** /**
+3 -3
View File
@@ -15,8 +15,8 @@
"../../../node_modules/@types/mocha" "../../../node_modules/@types/mocha"
], ],
"paths": { "paths": {
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"@xterm/addon-fit": [ "@xterm/addon-fit": [
"../typings/addon-fit.d.ts" "../typings/addon-fit.d.ts"
@@ -29,7 +29,7 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
} }
] ]
} }
+5 -6
View File
@@ -11,11 +11,10 @@
"removeComments": true, "removeComments": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"*": [ "*": [
"./*" "./*"
@@ -32,10 +31,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
}, },
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
}, },
{ {
"path": "../../../test/playwright" "path": "../../../test/playwright"
+3 -3
View File
@@ -10,9 +10,9 @@ import { Attributes, BgFlags, Content, ExtFlags, UnderlineStyle } from 'common/b
import type { AttributeData } from 'common/buffer/AttributeData'; import type { AttributeData } from 'common/buffer/AttributeData';
import type { IParams, IDcsHandler, IOscHandler, IApcHandler, IEscapeSequenceParser } from 'common/parser/Types'; import type { IParams, IDcsHandler, IOscHandler, IApcHandler, IEscapeSequenceParser } from 'common/parser/Types';
import type { IBufferLine, IExtendedAttrs, IInputHandler } from 'common/Types'; import type { IBufferLine, IExtendedAttrs, IInputHandler } from 'common/Types';
import type { ITerminal, ReadonlyColorSet } from 'target-browser/Types'; import type { ITerminal, ReadonlyColorSet } from 'browser/Types';
import type { IRenderDimensions } from 'target-browser/renderer/shared/Types'; import type { IRenderDimensions } from 'browser/renderer/shared/Types';
import type { ICoreBrowserService, IRenderService, IThemeService } from 'target-browser/services/Services'; import type { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
export const enum Cell { export const enum Cell {
CONTENT = 0, // codepoint and wcwidth information (enum Content) CONTENT = 0, // codepoint and wcwidth information (enum Content)
+4 -7
View File
@@ -12,11 +12,8 @@
"../../../node_modules/@types/mocha" "../../../node_modules/@types/mocha"
], ],
"paths": { "paths": {
"target-browser/*": [ "../../../src/target-browser/*" ], "browser/*": [ "../../../src/browser/*" ],
"common/*": [ "common/*": [ "../../../src/common/*" ],
"../../../src/primitives/*",
"../../../src/runtime/*",
],
"@xterm/addon-image": [ "../typings/addon-image.d.ts" ], "@xterm/addon-image": [ "../typings/addon-image.d.ts" ],
"*": [ "./*" ] "*": [ "./*" ]
} }
@@ -26,7 +23,7 @@
"../../../typings/xterm.d.ts" "../../../typings/xterm.d.ts"
], ],
"references": [ "references": [
{ "path": "../../../src/target-browser" }, { "path": "../../../src/browser" },
{ "path": "../../../src" } { "path": "../../../src/common" }
] ]
} }
+5 -6
View File
@@ -11,11 +11,10 @@
"removeComments": true, "removeComments": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"*": [ "*": [
"./*" "./*"
@@ -32,10 +31,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
}, },
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
}, },
{ {
"path": "../../../test/playwright" "path": "../../../test/playwright"
+2 -5
View File
@@ -25,11 +25,8 @@ const addon = {
modules: ['./node_modules'], modules: ['./node_modules'],
extensions: [ '.js' ], extensions: [ '.js' ],
alias: { alias: {
common: [ common: path.resolve('../../out/common'),
path.resolve('../../out/runtime'), browser: path.resolve('../../out/browser'),
path.resolve('../../out/primitives'),
],
browser: path.resolve('../../out/target-browser'),
vs: path.resolve('../../out/vs') vs: path.resolve('../../out/vs')
} }
}, },
+5 -6
View File
@@ -16,11 +16,10 @@
], ],
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"@xterm/addon-progress": [ "@xterm/addon-progress": [
"../typings/addon-progress.d.ts" "../typings/addon-progress.d.ts"
@@ -33,10 +32,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
}, },
{ {
"path": "../../../src" "path": "../../../src/common"
} }
] ]
} }
+5 -6
View File
@@ -11,11 +11,10 @@
"removeComments": true, "removeComments": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"*": [ "*": [
"./*" "./*"
@@ -32,10 +31,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
}, },
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
}, },
{ {
"path": "../../../test/playwright" "path": "../../../test/playwright"
+2 -5
View File
@@ -25,11 +25,8 @@ module.exports = {
modules: ['./node_modules'], modules: ['./node_modules'],
extensions: [ '.js' ], extensions: [ '.js' ],
alias: { alias: {
common: [ common: path.resolve('../../out/common'),
path.resolve('../../out/runtime'), browser: path.resolve('../../out/browser'),
path.resolve('../../out/primitives'),
],
browser: path.resolve('../../out/target-browser'),
vs: path.resolve('../../out/vs') vs: path.resolve('../../out/vs')
} }
}, },
+1 -1
View File
@@ -5,7 +5,7 @@
import { assert } from 'chai'; import { assert } from 'chai';
import { SearchEngine } from './SearchEngine'; import { SearchEngine } from './SearchEngine';
import { SearchLineCache } from './SearchLineCache'; import { SearchLineCache } from './SearchLineCache';
import { Terminal } from 'target-browser/public/Terminal'; import { Terminal } from 'browser/public/Terminal';
import type { ISearchOptions } from '@xterm/addon-search'; import type { ISearchOptions } from '@xterm/addon-search';
import { DisposableStore } from 'common/Lifecycle'; import { DisposableStore } from 'common/Lifecycle';
@@ -4,7 +4,7 @@
*/ */
import { assert } from 'chai'; import { assert } from 'chai';
import { SearchLineCache, LineCacheEntry } from './SearchLineCache'; import { SearchLineCache, LineCacheEntry } from './SearchLineCache';
import { Terminal } from 'target-browser/public/Terminal'; import { Terminal } from 'browser/public/Terminal';
import { timeout } from 'common/Async'; import { timeout } from 'common/Async';
function writeP(terminal: Terminal, data: string): Promise<void> { function writeP(terminal: Terminal, data: string): Promise<void> {
+5 -6
View File
@@ -16,11 +16,10 @@
], ],
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"@xterm/addon-search" : [ "@xterm/addon-search" : [
"../typings/addon-search.d.ts" "../typings/addon-search.d.ts"
@@ -33,10 +32,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
}, },
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
} }
] ]
} }
+5 -6
View File
@@ -11,11 +11,10 @@
"removeComments": true, "removeComments": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"*": [ "*": [
"./*" "./*"
@@ -32,10 +31,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
}, },
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
}, },
{ {
"path": "../../../test/playwright" "path": "../../../test/playwright"
+1 -4
View File
@@ -25,10 +25,7 @@ module.exports = {
modules: ['./node_modules'], modules: ['./node_modules'],
extensions: [ '.js' ], extensions: [ '.js' ],
alias: { alias: {
common: [ common: path.resolve('../../out/common'),
path.resolve('../../out/runtime'),
path.resolve('../../out/primitives'),
],
vs: path.resolve('../../out/vs') vs: path.resolve('../../out/vs')
} }
}, },
@@ -7,7 +7,7 @@ import { perfContext, before, ThroughputRuntimeCase } from 'xterm-benchmark';
import { spawn } from 'node-pty'; import { spawn } from 'node-pty';
import { Utf8ToUtf32, stringFromCodePoint } from 'common/input/TextDecoder'; import { Utf8ToUtf32, stringFromCodePoint } from 'common/input/TextDecoder';
import { Terminal } from 'target-browser/public/Terminal'; import { Terminal } from 'browser/public/Terminal';
import { SerializeAddon } from 'SerializeAddon'; import { SerializeAddon } from 'SerializeAddon';
class TestTerminal extends Terminal { class TestTerminal extends Terminal {
@@ -12,11 +12,8 @@
"target": "es2021", "target": "es2021",
"module": "nodenext", "module": "nodenext",
"paths": { "paths": {
"common/*": [ "common/*": ["../../../src/common/*"],
"../../../src/primitives/*", "browser/*": ["../../../src/browser/*"],
"../../../src/runtime/*",
],
"target-browser/*": ["../../../src/target-browser/*"],
"SerializeAddon": ["../src/SerializeAddon"], "SerializeAddon": ["../src/SerializeAddon"],
"@xterm/addon-serialize": [ "@xterm/addon-serialize": [
"../typings/addon-serialize.d.ts" "../typings/addon-serialize.d.ts"
@@ -26,7 +23,7 @@
"include": ["../**/*", "../../../typings/xterm.d.ts"], "include": ["../**/*", "../../../typings/xterm.d.ts"],
"exclude": ["../../../**/*test.ts", "../../**/*api.ts"], "exclude": ["../../../**/*test.ts", "../../**/*api.ts"],
"references": [ "references": [
{ "path": "../../../src" }, { "path": "../../../src/common" },
{ "path": "../../../src/target-browser" } { "path": "../../../src/browser" }
] ]
} }
@@ -6,10 +6,10 @@
import jsdom = require('jsdom'); import jsdom = require('jsdom');
import { assert } from 'chai'; import { assert } from 'chai';
import { SerializeAddon } from './SerializeAddon'; import { SerializeAddon } from './SerializeAddon';
import { Terminal } from 'target-browser/public/Terminal'; import { Terminal } from 'browser/public/Terminal';
import { SelectionModel } from 'target-browser/selection/SelectionModel'; import { SelectionModel } from 'browser/selection/SelectionModel';
import { IBufferService } from 'common/services/Services'; import { IBufferService } from 'common/services/Services';
import { ThemeService } from 'target-browser/services/ThemeService'; import { ThemeService } from 'browser/services/ThemeService';
function sgr(...seq: string[]): string { function sgr(...seq: string[]): string {
return `\x1b[${seq.join(';')}m`; return `\x1b[${seq.join(';')}m`;
+1 -1
View File
@@ -8,7 +8,7 @@
import type { IBuffer, IBufferCell, IBufferRange, ITerminalAddon, Terminal } from '@xterm/xterm'; import type { IBuffer, IBufferCell, IBufferRange, ITerminalAddon, Terminal } from '@xterm/xterm';
import type { IHTMLSerializeOptions, SerializeAddon as ISerializeApi, ISerializeOptions, ISerializeRange } from '@xterm/addon-serialize'; import type { IHTMLSerializeOptions, SerializeAddon as ISerializeApi, ISerializeOptions, ISerializeRange } from '@xterm/addon-serialize';
import { IAttributeData, IColor } from 'common/Types'; import { IAttributeData, IColor } from 'common/Types';
import { DEFAULT_ANSI_COLORS } from 'target-browser/Types'; import { DEFAULT_ANSI_COLORS } from 'browser/Types';
import { UnderlineStyle } from 'common/buffer/Constants'; import { UnderlineStyle } from 'common/buffer/Constants';
function constrain(value: number, low: number, high: number): number { function constrain(value: number, low: number, high: number): number {
+5 -6
View File
@@ -12,11 +12,10 @@
"removeComments": true, "removeComments": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"@xterm/addon-serialize": [ "@xterm/addon-serialize": [
"../typings/addon-serialize.d.ts" "../typings/addon-serialize.d.ts"
@@ -34,10 +33,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
}, },
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
} }
] ]
} }
+5 -6
View File
@@ -11,11 +11,10 @@
"removeComments": true, "removeComments": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
] ]
}, },
"strict": true, "strict": true,
@@ -29,10 +28,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
}, },
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
}, },
{ {
"path": "../../../test/playwright" "path": "../../../test/playwright"
+2 -5
View File
@@ -25,11 +25,8 @@ module.exports = {
modules: ['./node_modules'], modules: ['./node_modules'],
extensions: [ '.js' ], extensions: [ '.js' ],
alias: { alias: {
common: [ common: path.resolve('../../out/common'),
path.resolve('../../out/runtime'), browser: path.resolve('../../out/browser')
path.resolve('../../out/primitives'),
],
browser: path.resolve('../../out/target-browser')
} }
}, },
output: { output: {
@@ -7,7 +7,7 @@ import { perfContext, before, ThroughputRuntimeCase } from 'xterm-benchmark';
import { spawn } from 'node-pty'; import { spawn } from 'node-pty';
import { Utf8ToUtf32, stringFromCodePoint } from 'common/input/TextDecoder'; import { Utf8ToUtf32, stringFromCodePoint } from 'common/input/TextDecoder';
import { CoreBrowserTerminal } from 'target-browser/CoreBrowserTerminal'; import { CoreBrowserTerminal } from 'browser/CoreBrowserTerminal';
import { UnicodeGraphemeProvider } from 'UnicodeGraphemeProvider'; import { UnicodeGraphemeProvider } from 'UnicodeGraphemeProvider';
@@ -9,11 +9,8 @@
"target": "es2015", "target": "es2015",
"module": "nodenext", "module": "nodenext",
"paths": { "paths": {
"common/*": [ "common/*": ["../../../src/common/*"],
"../../../src/primitives/*", "browser/*": ["../../../src/browser/*"],
"../../../src/runtime/*",
],
"target-browser/*": ["../../../src/target-browser/*"],
"UnicodeGraphemeProvider": ["../src/UnicodeGraphemeProvider"], "UnicodeGraphemeProvider": ["../src/UnicodeGraphemeProvider"],
"@xterm/addon-unicode-graphemes": [ "@xterm/addon-unicode-graphemes": [
"../typings/addon-unicode-graphemes.d.ts" "../typings/addon-unicode-graphemes.d.ts"
@@ -23,7 +20,7 @@
"include": ["../**/*", "../../../typings/xterm.d.ts"], "include": ["../**/*", "../../../typings/xterm.d.ts"],
"exclude": ["../../../**/*test.ts", "../../**/*api.ts"], "exclude": ["../../../**/*test.ts", "../../**/*api.ts"],
"references": [ "references": [
{ "path": "../../../src" }, { "path": "../../../src/common" },
{ "path": "../../../src/target-browser" } { "path": "../../../src/browser" }
] ]
} }
@@ -4,8 +4,8 @@
*/ */
import { IUnicodeVersionProvider } from '@xterm/xterm'; import { IUnicodeVersionProvider } from '@xterm/xterm';
import { createPropertyValue, extractCharKind, extractWidth } from 'common/input/UnicodeProperties'; import { UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';
import { UnicodeCharProperties, UnicodeCharWidth } from 'common/input/UnicodeTypes'; import { UnicodeService } from 'common/services/UnicodeService';
import * as UC from './third-party/UnicodeProperties'; import * as UC from './third-party/UnicodeProperties';
export class UnicodeGraphemeProvider implements IUnicodeVersionProvider { export class UnicodeGraphemeProvider implements IUnicodeVersionProvider {
@@ -19,7 +19,7 @@ export class UnicodeGraphemeProvider implements IUnicodeVersionProvider {
} }
private static readonly _plainNarrowProperties: UnicodeCharProperties private static readonly _plainNarrowProperties: UnicodeCharProperties
= createPropertyValue(UC.GRAPHEME_BREAK_Other, 1, false); = UnicodeService.createPropertyValue(UC.GRAPHEME_BREAK_Other, 1, false);
public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties { public charProperties(codepoint: number, preceding: UnicodeCharProperties): UnicodeCharProperties {
// Optimize the simple ASCII case, under the condition that // Optimize the simple ASCII case, under the condition that
@@ -39,9 +39,9 @@ export class UnicodeGraphemeProvider implements IUnicodeVersionProvider {
w = 1; w = 1;
} }
if (preceding !== 0) { if (preceding !== 0) {
const oldWidth = extractWidth(preceding); const oldWidth = UnicodeService.extractWidth(preceding);
if (this.handleGraphemes) { if (this.handleGraphemes) {
charInfo = UC.shouldJoin(extractCharKind(preceding), charInfo); charInfo = UC.shouldJoin(UnicodeService.extractCharKind(preceding), charInfo);
} else { } else {
charInfo = w === 0 ? 1 : 0; charInfo = w === 0 ? 1 : 0;
} }
@@ -54,7 +54,7 @@ export class UnicodeGraphemeProvider implements IUnicodeVersionProvider {
} }
} }
} }
return createPropertyValue(charInfo, w, shouldJoin); return UnicodeService.createPropertyValue(charInfo, w, shouldJoin);
} }
public wcwidth(codepoint: number): UnicodeCharWidth { public wcwidth(codepoint: number): UnicodeCharWidth {
@@ -13,8 +13,7 @@
"strict": true, "strict": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"@xterm/addon-unicode-graphemes": [ "@xterm/addon-unicode-graphemes": [
"../typings/addon-unicode-graphemes.d.ts" "../typings/addon-unicode-graphemes.d.ts"
@@ -30,7 +29,7 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
} }
] ]
} }
@@ -11,11 +11,10 @@
"removeComments": true, "removeComments": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
] ]
}, },
"strict": true, "strict": true,
@@ -29,10 +28,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
}, },
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
}, },
{ {
"path": "../../../test/playwright" "path": "../../../test/playwright"
@@ -25,10 +25,7 @@ module.exports = {
modules: ['./node_modules'], modules: ['./node_modules'],
extensions: [ '.js' ], extensions: [ '.js' ],
alias: { alias: {
common: [ common: path.resolve('../../out/common'),
path.resolve('../../out/runtime'),
path.resolve('../../out/primitives'),
],
vs: path.resolve('../../out/vs') vs: path.resolve('../../out/vs')
} }
}, },
+4 -4
View File
@@ -4,8 +4,8 @@
*/ */
import { IUnicodeVersionProvider } from '@xterm/xterm'; import { IUnicodeVersionProvider } from '@xterm/xterm';
import { createPropertyValue, extractWidth } from 'common/input/UnicodeProperties'; import { UnicodeCharProperties, UnicodeCharWidth } from 'common/services/Services';
import { UnicodeCharProperties, UnicodeCharWidth } from 'common/input/UnicodeTypes'; import { UnicodeService } from 'common/services/UnicodeService';
const BMP_COMBINING = [ const BMP_COMBINING = [
[0x0300, 0x036F], [0x0483, 0x0489], [0x0591, 0x05BD], [0x0300, 0x036F], [0x0483, 0x0489], [0x0591, 0x05BD],
@@ -223,13 +223,13 @@ export class UnicodeV11 implements IUnicodeVersionProvider {
let width = this.wcwidth(codepoint); let width = this.wcwidth(codepoint);
let shouldJoin = width === 0 && preceding !== 0; let shouldJoin = width === 0 && preceding !== 0;
if (shouldJoin) { if (shouldJoin) {
const oldWidth = extractWidth(preceding); const oldWidth = UnicodeService.extractWidth(preceding);
if (oldWidth === 0) { if (oldWidth === 0) {
shouldJoin = false; shouldJoin = false;
} else if (oldWidth > width) { } else if (oldWidth > width) {
width = oldWidth; width = oldWidth;
} }
} }
return createPropertyValue(0, width, shouldJoin); return UnicodeService.createPropertyValue(0, width, shouldJoin);
} }
} }
+2 -3
View File
@@ -13,8 +13,7 @@
"strict": true, "strict": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"@xterm/addon-unicode11": [ "@xterm/addon-unicode11": [
"../typings/addon-unicode11.d.ts" "../typings/addon-unicode11.d.ts"
@@ -33,7 +32,7 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
} }
] ]
} }
+5 -6
View File
@@ -11,11 +11,10 @@
"removeComments": true, "removeComments": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"*": [ "*": [
"./*" "./*"
@@ -32,10 +31,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
}, },
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
}, },
{ {
"path": "../../../test/playwright" "path": "../../../test/playwright"
+1 -4
View File
@@ -25,10 +25,7 @@ module.exports = {
modules: ['./node_modules'], modules: ['./node_modules'],
extensions: [ '.js' ], extensions: [ '.js' ],
alias: { alias: {
common: [ common: path.resolve('../../out/common'),
path.resolve('../../out/runtime'),
path.resolve('../../out/primitives'),
],
vs: path.resolve('../../out/vs') vs: path.resolve('../../out/vs')
} }
}, },
+5 -6
View File
@@ -11,11 +11,10 @@
"removeComments": true, "removeComments": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"*": [ "*": [
"./*" "./*"
@@ -32,10 +31,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
}, },
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
}, },
{ {
"path": "../../../test/playwright" "path": "../../../test/playwright"
+5 -6
View File
@@ -11,11 +11,10 @@
"removeComments": true, "removeComments": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"*": [ "*": [
"./*" "./*"
@@ -32,10 +31,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
}, },
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
}, },
{ {
"path": "../../../test/playwright" "path": "../../../test/playwright"
+4 -4
View File
@@ -1,12 +1,12 @@
import { ISelectionRenderModel } from 'target-browser/renderer/shared/Types'; import { ISelectionRenderModel } from 'browser/renderer/shared/Types';
import { ICoreBrowserService, IThemeService } from 'target-browser/services/Services'; import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { ReadonlyColorSet } from 'target-browser/Types'; import { ReadonlyColorSet } from 'browser/Types';
import { Attributes, BgFlags, ExtFlags, FgFlags, NULL_CELL_CODE, UnderlineStyle } from 'common/buffer/Constants'; import { Attributes, BgFlags, ExtFlags, FgFlags, NULL_CELL_CODE, UnderlineStyle } from 'common/buffer/Constants';
import { IDecorationService, IOptionsService } from 'common/services/Services'; import { IDecorationService, IOptionsService } from 'common/services/Services';
import { ICellData } from 'common/Types'; import { ICellData } from 'common/Types';
import { Terminal } from '@xterm/xterm'; import { Terminal } from '@xterm/xterm';
import { rgba } from 'common/Color'; import { rgba } from 'common/Color';
import { treatGlyphAsBackgroundColor } from 'target-browser/renderer/shared/RendererUtils'; import { treatGlyphAsBackgroundColor } from 'browser/renderer/shared/RendererUtils';
import { blockPatternCodepoints } from './customGlyphs/CustomGlyphDefinitions'; import { blockPatternCodepoints } from './customGlyphs/CustomGlyphDefinitions';
// Work variables to avoid garbage collection // Work variables to avoid garbage collection
+1 -1
View File
@@ -5,7 +5,7 @@
import { TextureAtlas } from './TextureAtlas'; import { TextureAtlas } from './TextureAtlas';
import { ITerminalOptions, Terminal } from '@xterm/xterm'; import { ITerminalOptions, Terminal } from '@xterm/xterm';
import { ITerminal, ReadonlyColorSet } from 'target-browser/Types'; import { ITerminal, ReadonlyColorSet } from 'browser/Types';
import { ICharAtlasConfig, ITextureAtlas } from './Types'; import { ICharAtlasConfig, ITextureAtlas } from './Types';
import { generateConfig, configEquals } from './CharAtlasUtils'; import { generateConfig, configEquals } from './CharAtlasUtils';
import type { ILogService } from 'common/services/Services'; import type { ILogService } from 'common/services/Services';
+1 -1
View File
@@ -6,7 +6,7 @@
import { ICharAtlasConfig } from './Types'; import { ICharAtlasConfig } from './Types';
import { Attributes } from 'common/buffer/Constants'; import { Attributes } from 'common/buffer/Constants';
import { ITerminalOptions } from '@xterm/xterm'; import { ITerminalOptions } from '@xterm/xterm';
import { IColorSet, ReadonlyColorSet } from 'target-browser/Types'; import { IColorSet, ReadonlyColorSet } from 'browser/Types';
import { NULL_COLOR } from 'common/Color'; 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 { export function generateConfig(deviceCellWidth: number, deviceCellHeight: number, deviceCharWidth: number, deviceCharHeight: number, options: Required<ITerminalOptions>, colors: ReadonlyColorSet, devicePixelRatio: number, deviceMaxTextureSize: number, customGlyphs: boolean = true): ICharAtlasConfig {
@@ -3,8 +3,8 @@
* @license MIT * @license MIT
*/ */
import { RendererConstants } from 'target-browser/renderer/shared/Constants'; import { RendererConstants } from 'browser/renderer/shared/Constants';
import { ICoreBrowserService } from 'target-browser/services/Services'; import { ICoreBrowserService } from 'browser/services/Services';
const enum Constants { const enum Constants {
/** /**
+2 -2
View File
@@ -3,14 +3,14 @@
* @license MIT * @license MIT
*/ */
import { TextureAtlas } from './TextureAtlas'; import { TextureAtlas } from './TextureAtlas';
import { IRenderDimensions } from 'target-browser/renderer/shared/Types'; import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { NULL_CELL_CODE } from 'common/buffer/Constants'; import { NULL_CELL_CODE } from 'common/buffer/Constants';
import { Disposable, toDisposable } from 'common/Lifecycle'; import { Disposable, toDisposable } from 'common/Lifecycle';
import { Terminal } from '@xterm/xterm'; import { Terminal } from '@xterm/xterm';
import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject, type IRasterizedGlyph, type ITextureAtlas } from './Types'; import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject, type IRasterizedGlyph, type ITextureAtlas } from './Types';
import { createProgram, GLTexture, PROJECTION_MATRIX } from './WebglUtils'; import { createProgram, GLTexture, PROJECTION_MATRIX } from './WebglUtils';
import type { ILogService, IOptionsService } from 'common/services/Services'; import type { ILogService, IOptionsService } from 'common/services/Services';
import { allowRescaling, throwIfFalsy } from 'target-browser/renderer/shared/RendererUtils'; import { allowRescaling, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
interface IVertices { interface IVertices {
attributes: Float32Array; attributes: Float32Array;
+4 -4
View File
@@ -3,9 +3,9 @@
* @license MIT * @license MIT
*/ */
import { IRenderDimensions } from 'target-browser/renderer/shared/Types'; import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { IThemeService } from 'target-browser/services/Services'; import { IThemeService } from 'browser/services/Services';
import { ReadonlyColorSet } from 'target-browser/Types'; import { ReadonlyColorSet } from 'browser/Types';
import { Attributes, FgFlags } from 'common/buffer/Constants'; import { Attributes, FgFlags } from 'common/buffer/Constants';
import { Disposable, toDisposable } from 'common/Lifecycle'; import { Disposable, toDisposable } from 'common/Lifecycle';
import { IColor } from 'common/Types'; import { IColor } from 'common/Types';
@@ -13,7 +13,7 @@ import { Terminal } from '@xterm/xterm';
import { RenderModelConstants } from './RenderModel'; import { RenderModelConstants } from './RenderModel';
import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject } from './Types'; import { IRenderModel, IWebGL2RenderingContext, IWebGLVertexArrayObject } from './Types';
import { createProgram, expandFloat32Array, PROJECTION_MATRIX } from './WebglUtils'; import { createProgram, expandFloat32Array, PROJECTION_MATRIX } from './WebglUtils';
import { throwIfFalsy } from 'target-browser/renderer/shared/RendererUtils'; import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
import type { ILogService } from 'common/services/Services'; import type { ILogService } from 'common/services/Services';
const enum VertexAttribLocations { const enum VertexAttribLocations {
+2 -2
View File
@@ -4,8 +4,8 @@
*/ */
import { ICursorRenderModel, IRenderModel } from './Types'; import { ICursorRenderModel, IRenderModel } from './Types';
import { ISelectionRenderModel } from 'target-browser/renderer/shared/Types'; import { ISelectionRenderModel } from 'browser/renderer/shared/Types';
import { createSelectionRenderModel } from 'target-browser/renderer/shared/SelectionRenderModel'; import { createSelectionRenderModel } from 'browser/renderer/shared/SelectionRenderModel';
export const enum RenderModelConstants { export const enum RenderModelConstants {
INDICIES_PER_CELL = 4, INDICIES_PER_CELL = 4,
+2 -2
View File
@@ -3,10 +3,10 @@
* @license MIT * @license MIT
*/ */
import { IColorContrastCache } from 'target-browser/Types'; import { IColorContrastCache } from 'browser/Types';
import { DIM_OPACITY, TEXT_BASELINE } from './Constants'; import { DIM_OPACITY, TEXT_BASELINE } from './Constants';
import { tryDrawCustomGlyph } from './customGlyphs/CustomGlyphRasterizer'; import { tryDrawCustomGlyph } from './customGlyphs/CustomGlyphRasterizer';
import { computeNextVariantOffset, treatGlyphAsBackgroundColor, isPowerlineGlyph, isRestrictedPowerlineGlyph, throwIfFalsy } from 'target-browser/renderer/shared/RendererUtils'; import { computeNextVariantOffset, treatGlyphAsBackgroundColor, isPowerlineGlyph, isRestrictedPowerlineGlyph, throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
import { IBoundingBox, ICharAtlasConfig, IRasterizedGlyph, ITextureAtlas } from './Types'; import { IBoundingBox, ICharAtlasConfig, IRasterizedGlyph, ITextureAtlas } from './Types';
import { NULL_COLOR, channels, color, rgba } from 'common/Color'; import { NULL_COLOR, channels, color, rgba } from 'common/Color';
import { FourKeyMap } from 'common/MultiKeyMap'; import { FourKeyMap } from 'common/MultiKeyMap';
+2 -2
View File
@@ -4,8 +4,8 @@
*/ */
import { FontWeight } from '@xterm/xterm'; import { FontWeight } from '@xterm/xterm';
import { IColorSet } from 'target-browser/Types'; import { IColorSet } from 'browser/Types';
import { ISelectionRenderModel } from 'target-browser/renderer/shared/Types'; import { ISelectionRenderModel } from 'browser/renderer/shared/Types';
import { CursorInactiveStyle, CursorStyle, type IDisposable } from 'common/Types'; import { CursorInactiveStyle, CursorStyle, type IDisposable } from 'common/Types';
import type { IEvent } from 'common/Event'; import type { IEvent } from 'common/Event';
+2 -2
View File
@@ -5,8 +5,8 @@
import type { ITerminalAddon, Terminal } from '@xterm/xterm'; import type { ITerminalAddon, Terminal } from '@xterm/xterm';
import type { IWebglAddonOptions, WebglAddon as IWebglApi } from '@xterm/addon-webgl'; import type { IWebglAddonOptions, WebglAddon as IWebglApi } from '@xterm/addon-webgl';
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'target-browser/services/Services'; import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
import { ITerminal } from 'target-browser/Types'; import { ITerminal } from 'browser/Types';
import { Disposable, toDisposable } from 'common/Lifecycle'; import { Disposable, toDisposable } from 'common/Lifecycle';
import { getSafariVersion, isSafari } from 'common/Platform'; import { getSafariVersion, isSafari } from 'common/Platform';
import { ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services'; import { ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services';
+6 -6
View File
@@ -3,18 +3,18 @@
* @license MIT * @license MIT
*/ */
import { ITerminal } from 'target-browser/Types'; import { ITerminal } from 'browser/Types';
import { CellColorResolver } from './CellColorResolver'; import { CellColorResolver } from './CellColorResolver';
import { acquireTextureAtlas, removeTerminalFromCache } from './CharAtlasCache'; import { acquireTextureAtlas, removeTerminalFromCache } from './CharAtlasCache';
import { CursorBlinkStateManager } from './CursorBlinkStateManager'; import { CursorBlinkStateManager } from './CursorBlinkStateManager';
import { observeDevicePixelDimensions } from './DevicePixelObserver'; import { observeDevicePixelDimensions } from './DevicePixelObserver';
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'target-browser/renderer/shared/Types'; import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types';
import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'target-browser/services/Services'; import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { CharData, IBufferLine, ICellData } from 'common/Types'; import { CharData, IBufferLine, ICellData } from 'common/Types';
import { AttributeData } from 'common/buffer/AttributeData'; import { AttributeData } from 'common/buffer/AttributeData';
import { CellData } from 'common/buffer/CellData'; import { CellData } from 'common/buffer/CellData';
import { Attributes, Content, FgFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/buffer/Constants'; import { Attributes, Content, FgFlags, NULL_CELL_CHAR, NULL_CELL_CODE } from 'common/buffer/Constants';
import { TextBlinkStateManager } from 'target-browser/renderer/shared/TextBlinkStateManager'; import { TextBlinkStateManager } from 'browser/renderer/shared/TextBlinkStateManager';
import { ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services'; import { ICoreService, IDecorationService, ILogService, IOptionsService } from 'common/services/Services';
import { Terminal } from '@xterm/xterm'; import { Terminal } from '@xterm/xterm';
import { GlyphRenderer } from './GlyphRenderer'; import { GlyphRenderer } from './GlyphRenderer';
@@ -24,9 +24,9 @@ import { IWebGL2RenderingContext, type ITextureAtlas } from './Types';
import { LinkRenderLayer } from './renderLayer/LinkRenderLayer'; import { LinkRenderLayer } from './renderLayer/LinkRenderLayer';
import { IRenderLayer } from './renderLayer/Types'; import { IRenderLayer } from './renderLayer/Types';
import { Emitter, EventUtils } from 'common/Event'; import { Emitter, EventUtils } from 'common/Event';
import { addDisposableListener } from 'target-browser/Dom'; import { addDisposableListener } from 'browser/Dom';
import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle'; import { combinedDisposable, Disposable, MutableDisposable, toDisposable } from 'common/Lifecycle';
import { createRenderDimensions } from 'target-browser/renderer/shared/RendererUtils'; import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
const enum Constants { const enum Constants {
MERGE_RETRY_LIMIT = 32 MERGE_RETRY_LIMIT = 32
+1 -1
View File
@@ -3,7 +3,7 @@
* @license MIT * @license MIT
*/ */
import { throwIfFalsy } from 'target-browser/renderer/shared/RendererUtils'; import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
import type { ILogService } from 'common/services/Services'; import type { ILogService } from 'common/services/Services';
/** /**
@@ -3,7 +3,7 @@
* @license MIT * @license MIT
*/ */
import { throwIfFalsy } from 'target-browser/renderer/shared/RendererUtils'; import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
import type { ILogService } from 'common/services/Services'; import type { ILogService } from 'common/services/Services';
import { customGlyphDefinitions } from './CustomGlyphDefinitions'; import { customGlyphDefinitions } from './CustomGlyphDefinitions';
import { CustomGlyphDefinitionType, CustomGlyphScaleType, CustomGlyphVectorType, type CustomGlyphDefinitionPart, type CustomGlyphPathDrawFunctionDefinition, type CustomGlyphPatternDefinition, type ICustomGlyphSolidOctantBlockVector, type ICustomGlyphVectorShape } from './Types'; import { CustomGlyphDefinitionType, CustomGlyphScaleType, CustomGlyphVectorType, type CustomGlyphDefinitionPart, type CustomGlyphPathDrawFunctionDefinition, type CustomGlyphPatternDefinition, type ICustomGlyphSolidOctantBlockVector, type ICustomGlyphVectorShape } from './Types';
@@ -3,16 +3,16 @@
* @license MIT * @license MIT
*/ */
import { ReadonlyColorSet } from 'target-browser/Types'; import { ReadonlyColorSet } from 'browser/Types';
import { acquireTextureAtlas } from '../CharAtlasCache'; import { acquireTextureAtlas } from '../CharAtlasCache';
import { IRenderDimensions } from 'target-browser/renderer/shared/Types'; import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { ICoreBrowserService, IThemeService } from 'target-browser/services/Services'; import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { Disposable, toDisposable } from 'common/Lifecycle'; import { Disposable, toDisposable } from 'common/Lifecycle';
import { CellData } from 'common/buffer/CellData'; import { CellData } from 'common/buffer/CellData';
import { IOptionsService } from 'common/services/Services'; import { IOptionsService } from 'common/services/Services';
import { Terminal } from '@xterm/xterm'; import { Terminal } from '@xterm/xterm';
import { IRenderLayer } from './Types'; import { IRenderLayer } from './Types';
import { throwIfFalsy } from 'target-browser/renderer/shared/RendererUtils'; import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
import { TEXT_BASELINE } from '../Constants'; import { TEXT_BASELINE } from '../Constants';
import type { ITextureAtlas } from '../Types'; import type { ITextureAtlas } from '../Types';
@@ -4,10 +4,10 @@
*/ */
import { is256Color } from '../CharAtlasUtils'; import { is256Color } from '../CharAtlasUtils';
import { INVERTED_DEFAULT_COLOR } from 'target-browser/renderer/shared/Constants'; import { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants';
import { IRenderDimensions } from 'target-browser/renderer/shared/Types'; import { IRenderDimensions } from 'browser/renderer/shared/Types';
import { ICoreBrowserService, IThemeService } from 'target-browser/services/Services'; import { ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { ILinkifier2, ILinkifierEvent } from 'target-browser/Types'; import { ILinkifier2, ILinkifierEvent } from 'browser/Types';
import { IOptionsService } from 'common/services/Services'; import { IOptionsService } from 'common/services/Services';
import { Terminal } from '@xterm/xterm'; import { Terminal } from '@xterm/xterm';
import { BaseRenderLayer } from './BaseRenderLayer'; import { BaseRenderLayer } from './BaseRenderLayer';
+1 -1
View File
@@ -4,7 +4,7 @@
*/ */
import { IDisposable, Terminal } from '@xterm/xterm'; import { IDisposable, Terminal } from '@xterm/xterm';
import { IRenderDimensions } from 'target-browser/renderer/shared/Types'; import { IRenderDimensions } from 'browser/renderer/shared/Types';
export interface IRenderLayer extends IDisposable { export interface IRenderLayer extends IDisposable {
/** /**
+5 -6
View File
@@ -12,11 +12,10 @@
"removeComments": true, "removeComments": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"@xterm/addon-webgl": [ "@xterm/addon-webgl": [
"../typings/addon-webgl.d.ts" "../typings/addon-webgl.d.ts"
@@ -37,10 +36,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
}, },
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
} }
] ]
} }
+5 -6
View File
@@ -11,11 +11,10 @@
"removeComments": true, "removeComments": true,
"paths": { "paths": {
"common/*": [ "common/*": [
"../../../src/primitives/*", "../../../src/common/*"
"../../../src/runtime/*",
], ],
"target-browser/*": [ "browser/*": [
"../../../src/target-browser/*" "../../../src/browser/*"
], ],
"*": [ "*": [
"./*" "./*"
@@ -33,10 +32,10 @@
], ],
"references": [ "references": [
{ {
"path": "../../../src" "path": "../../../src/common"
}, },
{ {
"path": "../../../src/target-browser" "path": "../../../src/browser"
}, },
{ {
"path": "../../../test/playwright" "path": "../../../test/playwright"
+2 -5
View File
@@ -25,11 +25,8 @@ module.exports = {
modules: ['./node_modules'], modules: ['./node_modules'],
extensions: [ '.js' ], extensions: [ '.js' ],
alias: { alias: {
common: [ common: path.resolve('../../out/common'),
path.resolve('../../out/runtime'), browser: path.resolve('../../out/browser'),
path.resolve('../../out/primitives'),
],
browser: path.resolve('../../out/target-browser'),
vs: path.resolve('../../out/vs') vs: path.resolve('../../out/vs')
} }
}, },
+13 -37
View File
@@ -92,9 +92,6 @@ let outConfig = {
} }
let skipOut = false; let skipOut = false;
/** @type {esbuild.BuildOptions[] | undefined} */
let outBuilds;
/** @type {esbuild.BuildOptions} */ /** @type {esbuild.BuildOptions} */
let outTestConfig = { let outTestConfig = {
format: 'cjs', format: 'cjs',
@@ -174,7 +171,7 @@ if (config.addon) {
} else if (config.isHeadless) { } else if (config.isHeadless) {
bundleConfig = { bundleConfig = {
...bundleConfig, ...bundleConfig,
entryPoints: [`src/target-headless/public/Terminal.ts`], entryPoints: [`src/headless/public/Terminal.ts`],
outfile: `headless/lib-headless/xterm-headless.mjs` outfile: `headless/lib-headless/xterm-headless.mjs`
}; };
outConfig = { outConfig = {
@@ -186,35 +183,18 @@ if (config.addon) {
} else { } else {
bundleConfig = { bundleConfig = {
...bundleConfig, ...bundleConfig,
entryPoints: [`src/target-browser/public/Terminal.ts`], entryPoints: [`src/browser/public/Terminal.ts`],
outfile: `lib/xterm.mjs` outfile: `lib/xterm.mjs`
}; };
outBuilds = [ outConfig = {
{ ...outConfig,
...outConfig, entryPoints: [
entryPoints: ['src/primitives/**/*.ts'], 'src/browser/**/*.ts',
outbase: 'src/primitives', 'src/common/**/*.ts',
outdir: 'out-esbuild/common', 'src/headless/**/*.ts'
}, ],
{ outdir: 'out-esbuild/'
...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 = { outTestConfig = {
...outConfig, ...outConfig,
entryPoints: ['test/**/*.ts'], entryPoints: ['test/**/*.ts'],
@@ -225,9 +205,7 @@ if (config.addon) {
if (config.isWatch) { if (config.isWatch) {
context(bundleConfig).then(e => e.watch()); context(bundleConfig).then(e => e.watch());
if (!skipOut) { if (!skipOut) {
for (const buildConfig of outBuilds ?? [outConfig]) { context(outConfig).then(e => e.watch());
context(buildConfig).then(e => e.watch());
}
} }
if (!skipOutTest) { if (!skipOutTest) {
context(outTestConfig).then(e => e.watch()); context(outTestConfig).then(e => e.watch());
@@ -235,9 +213,7 @@ if (config.isWatch) {
} else { } else {
await build(bundleConfig); await build(bundleConfig);
if (!skipOut) { if (!skipOut) {
for (const buildConfig of outBuilds ?? [outConfig]) { await build(outConfig);
await build(buildConfig);
}
} }
if (!skipOutTest) { if (!skipOutTest) {
await build(outTestConfig); await build(outTestConfig);
+1 -1
View File
@@ -81,7 +81,7 @@ function checkAndPublishPackage(packageDir, repoCommit, peerDependencies, update
// Update Version.ts with the new version // Update Version.ts with the new version
if (updateVersionTs) { if (updateVersionTs) {
const versionTsPath = path.join(packageDir, 'src/primitives/Version.ts'); const versionTsPath = path.join(packageDir, 'src/common/Version.ts');
const versionTsContent = fs.readFileSync(versionTsPath, 'utf8'); const versionTsContent = fs.readFileSync(versionTsPath, 'utf8');
const updatedVersionTs = versionTsContent.replace( const updatedVersionTs = versionTsContent.replace(
/export const XTERM_VERSION = '[^']+';/, /export const XTERM_VERSION = '[^']+';/,
+1 -1
View File
@@ -38,4 +38,4 @@ function findUnusedSymbols(
} }
// Example usage // Example usage
findUnusedSymbols("./src/target-browser/tsconfig.json"); findUnusedSymbols("./src/browser/tsconfig.json");
-70
View File
@@ -1,70 +0,0 @@
# 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
@@ -3,14 +3,14 @@
* @license MIT * @license MIT
*/ */
import * as Strings from 'target-browser/LocalizableStrings'; import * as Strings from 'browser/LocalizableStrings';
import { ITerminal, IRenderDebouncer } from 'target-browser/Types'; import { ITerminal, IRenderDebouncer } from 'browser/Types';
import { TimeBasedDebouncer } from 'target-browser/TimeBasedDebouncer'; import { TimeBasedDebouncer } from 'browser/TimeBasedDebouncer';
import { Disposable, toDisposable } from 'common/Lifecycle'; import { Disposable, toDisposable } from 'common/Lifecycle';
import { ICoreBrowserService, IRenderService } from 'target-browser/services/Services'; import { ICoreBrowserService, IRenderService } from 'browser/services/Services';
import { IBuffer } from 'common/buffer/Types'; import { IBuffer } from 'common/buffer/Types';
import { IInstantiationService } from 'common/services/Services'; import { IInstantiationService } from 'common/services/Services';
import { addDisposableListener } from 'target-browser/Dom'; import { addDisposableListener } from 'browser/Dom';
const enum Constants { const enum Constants {
MAX_ROWS_TO_READ = 20 MAX_ROWS_TO_READ = 20
@@ -4,7 +4,7 @@
*/ */
import { assert } from 'chai'; import { assert } from 'chai';
import * as Clipboard from 'target-browser/Clipboard'; import * as Clipboard from 'browser/Clipboard';
describe('evaluatePastedTextProcessing', () => { describe('evaluatePastedTextProcessing', () => {
it('should replace carriage return and/or line feed with carriage return', () => { it('should replace carriage return and/or line feed with carriage return', () => {
@@ -3,7 +3,7 @@
* @license MIT * @license MIT
*/ */
import { ISelectionService } from 'target-browser/services/Services'; import { ISelectionService } from 'browser/services/Services';
import { ICoreService, IOptionsService } from 'common/services/Services'; import { ICoreService, IOptionsService } from 'common/services/Services';
/** /**
@@ -4,7 +4,7 @@
*/ */
import { assert } from 'chai'; import { assert } from 'chai';
import { ColorContrastCache } from 'target-browser/ColorContrastCache'; import { ColorContrastCache } from 'browser/ColorContrastCache';
describe('ColorContrastCache', () => { describe('ColorContrastCache', () => {
let cache: ColorContrastCache; let cache: ColorContrastCache;
@@ -3,7 +3,7 @@
* @license MIT * @license MIT
*/ */
import { IColorContrastCache } from 'target-browser/Types'; import { IColorContrastCache } from 'browser/Types';
import { IColor } from 'common/Types'; import { IColor } from 'common/Types';
import { TwoKeyMap } from 'common/MultiKeyMap'; import { TwoKeyMap } from 'common/MultiKeyMap';
@@ -22,27 +22,27 @@
*/ */
import { IDecoration, IDecorationOptions, IDisposable, ILinkProvider, IMarker, IRenderDimensions as IRenderDimensionsApi } from '@xterm/xterm'; import { IDecoration, IDecorationOptions, IDisposable, ILinkProvider, IMarker, IRenderDimensions as IRenderDimensionsApi } from '@xterm/xterm';
import { copyHandler, handlePasteEvent, moveTextAreaUnderMouseCursor, paste, rightClickHandler } from 'target-browser/Clipboard'; import { copyHandler, handlePasteEvent, moveTextAreaUnderMouseCursor, paste, rightClickHandler } from 'browser/Clipboard';
import * as Strings from 'target-browser/LocalizableStrings'; import * as Strings from 'browser/LocalizableStrings';
import { OscLinkProvider } from 'target-browser/OscLinkProvider'; import { OscLinkProvider } from 'browser/OscLinkProvider';
import { CharacterJoinerHandler, CustomKeyEventHandler, CustomWheelEventHandler, IBrowser, IBufferRange, ICompositionHelper, ILinkifier2, ITerminal } from 'target-browser/Types'; import { CharacterJoinerHandler, CustomKeyEventHandler, CustomWheelEventHandler, IBrowser, IBufferRange, ICompositionHelper, ILinkifier2, ITerminal } from 'browser/Types';
import { Viewport } from 'target-browser/Viewport'; import { Viewport } from 'browser/Viewport';
import { BufferDecorationRenderer } from 'target-browser/decorations/BufferDecorationRenderer'; import { BufferDecorationRenderer } from 'browser/decorations/BufferDecorationRenderer';
import { OverviewRulerRenderer } from 'target-browser/decorations/OverviewRulerRenderer'; import { OverviewRulerRenderer } from 'browser/decorations/OverviewRulerRenderer';
import { CompositionHelper } from 'target-browser/input/CompositionHelper'; import { CompositionHelper } from 'browser/input/CompositionHelper';
import { DomRenderer } from 'target-browser/renderer/dom/DomRenderer'; import { DomRenderer } from 'browser/renderer/dom/DomRenderer';
import { IRenderer } from 'target-browser/renderer/shared/Types'; import { IRenderer } from 'browser/renderer/shared/Types';
import { CharSizeService } from 'target-browser/services/CharSizeService'; import { CharSizeService } from 'browser/services/CharSizeService';
import { CharacterJoinerService } from 'target-browser/services/CharacterJoinerService'; import { CharacterJoinerService } from 'browser/services/CharacterJoinerService';
import { CoreBrowserService } from 'target-browser/services/CoreBrowserService'; import { CoreBrowserService } from 'browser/services/CoreBrowserService';
import { LinkProviderService } from 'target-browser/services/LinkProviderService'; import { LinkProviderService } from 'browser/services/LinkProviderService';
import { MouseCoordsService } from 'target-browser/services/MouseCoordsService'; import { MouseCoordsService } from 'browser/services/MouseCoordsService';
import { MouseEventCssClasses, MouseService } from 'target-browser/services/MouseService'; import { MouseEventCssClasses, MouseService } from 'browser/services/MouseService';
import { RenderService } from 'target-browser/services/RenderService'; import { RenderService } from 'browser/services/RenderService';
import { SelectionService } from 'target-browser/services/SelectionService'; import { SelectionService } from 'browser/services/SelectionService';
import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IKeyboardService, ILinkProviderService, IMouseCoordsService, IMouseService, IRenderService, ISelectionService, IThemeService } from 'target-browser/services/Services'; import { ICharSizeService, ICharacterJoinerService, ICoreBrowserService, IKeyboardService, ILinkProviderService, IMouseCoordsService, IMouseService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services';
import { ThemeService } from 'target-browser/services/ThemeService'; import { ThemeService } from 'browser/services/ThemeService';
import { KeyboardService } from 'target-browser/services/KeyboardService'; import { KeyboardService } from 'browser/services/KeyboardService';
import { channels, color, rgb } from 'common/Color'; import { channels, color, rgb } from 'common/Color';
import { CoreTerminal } from 'common/CoreTerminal'; import { CoreTerminal } from 'common/CoreTerminal';
import * as Browser from 'common/Platform'; import * as Browser from 'common/Platform';
@@ -53,11 +53,11 @@ import { C0, C1ESCAPED } from 'common/data/EscapeSequences';
import { toRgbString } from 'common/input/XParseColor'; import { toRgbString } from 'common/input/XParseColor';
import { DecorationService } from 'common/services/DecorationService'; import { DecorationService } from 'common/services/DecorationService';
import { IDecorationService } from 'common/services/Services'; import { IDecorationService } from 'common/services/Services';
import { WindowsOptionsReportType } from 'common/InputHandler'; import { WindowsOptionsReportType } from '../common/InputHandler';
import { AccessibilityManager } from './AccessibilityManager'; import { AccessibilityManager } from './AccessibilityManager';
import { Linkifier } from './Linkifier'; import { Linkifier } from './Linkifier';
import { Emitter, EventUtils, type IEvent } from 'common/Event'; import { Emitter, EventUtils, type IEvent } from 'common/Event';
import { addDisposableListener } from 'target-browser/Dom'; import { addDisposableListener } from 'browser/Dom';
import { MutableDisposable, toDisposable } from 'common/Lifecycle'; import { MutableDisposable, toDisposable } from 'common/Lifecycle';
export class CoreBrowserTerminal extends CoreTerminal implements ITerminal { export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
@@ -7,8 +7,8 @@ import { assert } from 'chai';
import { IBufferService } from 'common/services/Services'; import { IBufferService } from 'common/services/Services';
import { Linkifier } from './Linkifier'; import { Linkifier } from './Linkifier';
import { MockBufferService } from 'common/TestUtils.test'; import { MockBufferService } from 'common/TestUtils.test';
import { ILink } from 'target-browser/Types'; import { ILink } from 'browser/Types';
import { LinkProviderService } from 'target-browser/services/LinkProviderService'; import { LinkProviderService } from 'browser/services/LinkProviderService';
import jsdom = require('jsdom'); import jsdom = require('jsdom');
class TestLinkifier2 extends Linkifier { class TestLinkifier2 extends Linkifier {
@@ -3,13 +3,13 @@
* @license MIT * @license MIT
*/ */
import { IBufferCellPosition, ILink, ILinkDecorations, ILinkWithState, ILinkifier2, ILinkifierEvent } from 'target-browser/Types'; import { IBufferCellPosition, ILink, ILinkDecorations, ILinkWithState, ILinkifier2, ILinkifierEvent } from 'browser/Types';
import { Disposable, dispose, toDisposable } from 'common/Lifecycle'; import { Disposable, dispose, toDisposable } from 'common/Lifecycle';
import { IDisposable } from 'common/Types'; import { IDisposable } from 'common/Types';
import { IBufferService } from 'common/services/Services'; import { IBufferService } from 'common/services/Services';
import { ILinkProviderService, IMouseCoordsService, IRenderService } from './services/Services'; import { ILinkProviderService, IMouseCoordsService, IRenderService } from './services/Services';
import { Emitter } from 'common/Event'; import { Emitter } from 'common/Event';
import { addDisposableListener } from 'target-browser/Dom'; import { addDisposableListener } from 'browser/Dom';
export class Linkifier extends Disposable implements ILinkifier2 { export class Linkifier extends Disposable implements ILinkifier2 {
public get currentLink(): ILinkWithState | undefined { return this._currentLink; } public get currentLink(): ILinkWithState | undefined { return this._currentLink; }
@@ -4,8 +4,8 @@
*/ */
import { assert } from 'chai'; import { assert } from 'chai';
import { OscLinkProvider } from 'target-browser/OscLinkProvider'; import { OscLinkProvider } from 'browser/OscLinkProvider';
import { ILink } from 'target-browser/Types'; import { ILink } from 'browser/Types';
import { createCellData, MockBufferService, MockOptionsService } from 'common/TestUtils.test'; import { createCellData, MockBufferService, MockOptionsService } from 'common/TestUtils.test';
import { IBufferService, IOscLinkService } from 'common/services/Services'; import { IBufferService, IOscLinkService } from 'common/services/Services';
import { IBufferLine, IOscLinkData } from 'common/Types'; import { IBufferLine, IOscLinkData } from 'common/Types';
@@ -3,8 +3,8 @@
* @license MIT * @license MIT
*/ */
import { IBufferRange, ILink } from 'target-browser/Types'; import { IBufferRange, ILink } from 'browser/Types';
import { ILinkProvider } from 'target-browser/services/Services'; import { ILinkProvider } from 'browser/services/Services';
import { CellData } from 'common/buffer/CellData'; import { CellData } from 'common/buffer/CellData';
import { IBufferLine } from 'common/Types'; import { IBufferLine } from 'common/Types';
import { IBufferService, IOptionsService, IOscLinkService } from 'common/services/Services'; import { IBufferService, IOptionsService, IOscLinkService } from 'common/services/Services';
+173
View File
@@ -0,0 +1,173 @@
# Browser folder rearchitecture
Composite TypeScript projects with enforced dependencies, mirroring the layered layout planned for `src/common/`.
## Platform layer rule
A module is **platform** only if **no class** in that project has a **service** injected via its constructor. That includes:
- Common services (`@IBufferService`, `@IOptionsService`, `@ICoreService`, `@IInstantiationService`, etc.)
- Browser services (`@ICoreBrowserService`, `@IRenderService`, `@IThemeService`, `@ICharSizeService`, …)
Passing a service into a **function** (e.g. `moveToCellSequence(…, bufferService)`) is fine. `new TextBlinkStateManager(…, coreBrowserService, optionsService)` is not — that class belongs in integration.
Interface-only modules (`browser/selection/Types.ts`, `renderer/shared/Types.ts`) are platform. Implementations that take services are not.
## Dependency graph (corrected)
```mermaid
flowchart BT
subgraph platform["Platform layer — no ctor service injection"]
direction LR
base["browser/base"]
scrollable["browser/scrollable"]
input["browser/input"]
selectionTypes["browser/selection/types"]
renderCore["browser/renderer/core"]
decorStore["browser/decorations/store"]
scrollable --> base
input --> base
selectionTypes --> base
renderCore --> base
decorStore --> base
end
subgraph integration["Integration layer — DI and wiring"]
direction LR
services["browser/services"]
renderer["browser/renderer"]
decorations["browser/decorations"]
terminal["browser/terminal"]
services --> base
services --> input
services --> selectionTypes
services --> renderCore
services --> decorStore
renderer --> services
renderer --> renderCore
renderer --> base
decorations --> services
decorations --> decorStore
decorations --> renderCore
terminal --> services
terminal --> renderer
terminal --> decorations
terminal --> input
terminal --> scrollable
terminal --> base
end
subgraph api_layer["API layer"]
public["browser/public"]
end
integration --> platform
api_layer --> integration
public --> terminal
```
`browser/renderer` is **not** platform: it owns `DomRenderer`, `DomRendererRowFactory`, and `TextBlinkStateManager`, all of which take injected services.
## Constructor audit (current tree)
### Platform-eligible
| Location | Type | Notes |
| --- | --- | --- |
| `Dom.ts`, `Types.ts`, `LocalizableStrings.ts`, `ColorContrastCache.ts`, `TimeBasedDebouncer.ts`, `shared/` | classes / functions | no DI |
| `scrollable/**` | widgets | `touch.ts` uses `Dom` only |
| `input/Mouse.ts` | functions | pure DOM math |
| `input/MoveToCell.ts` | functions | `IBufferService` passed as argument, not ctor-injected |
| `selection/Types.ts` | interfaces | no classes with DI |
| `renderer/shared/Constants.ts`, `RendererUtils.ts`, `Types.ts`, `SelectionRenderModel.ts` | classes | no DI |
| `renderer/dom/WidthCache.ts` | class | canvas factory only, no services |
| `decorations/ColorZoneStore.ts` | class | common types only, no DI |
### Integration-only (ctor service injection)
| Location | Injected services (representative) |
| --- | --- |
| `selection/SelectionModel.ts` | `IBufferService` |
| `input/CompositionHelper.ts` | `IBufferService`, `IOptionsService`, `ICoreService`, `IRenderService` |
| `renderer/shared/TextBlinkStateManager.ts` | `ICoreBrowserService`, `IOptionsService` |
| `renderer/dom/DomRendererRowFactory.ts` | `ICharacterJoinerService`, `IOptionsService`, `ICoreBrowserService`, `ICoreService`, `IDecorationService`, `IThemeService` |
| `renderer/dom/DomRenderer.ts` | `IInstantiationService`, `ICharSizeService`, `IOptionsService`, `IBufferService`, `ICoreService`, `ICoreBrowserService`, `IThemeService`; creates `DomRendererRowFactory` via `IInstantiationService` |
| `renderer/dom/DomRenderer` inner `CursorBlinkStateManager` | `ICoreBrowserService` |
| `services/**` | common + browser services (all `@…` ctor params) |
| `RenderDebouncer.ts` | `ICoreBrowserService` |
| `decorations/BufferDecorationRenderer.ts`, `OverviewRulerRenderer.ts` | `IBufferService`, `ICoreBrowserService`, `IDecorationService`, `IRenderService`, `IThemeService`, … |
| `Viewport.ts`, `Linkifier.ts`, `AccessibilityManager.ts`, `OscLinkProvider.ts` | multiple common + browser services |
| `CoreBrowserTerminal.ts` | orchestrates service registration and renderer construction |
`Clipboard.ts` has no class ctor DI; handlers receive `ISelectionService` at call sites — keep with `terminal`.
## Target package layout
### Platform
| Project | Contents |
| --- | --- |
| `browser/base` | `Dom`, `Types`, `LocalizableStrings`, `ColorContrastCache`, `TimeBasedDebouncer`, `shared/`; browser **service interfaces** (extracted from `services/Services.ts`) |
| `browser/scrollable` | `scrollable/**` |
| `browser/input` | `Mouse.ts`, `MoveToCell.ts` only |
| `browser/selection/types` | `selection/Types.ts` (or merge into `base` if preferred) |
| `browser/renderer/core` | `renderer/shared/{Constants,RendererUtils,Types,SelectionRenderModel}.ts`, `renderer/dom/WidthCache.ts` |
| `browser/decorations/store` | `ColorZoneStore.ts` |
`SelectionModel` moves to **`browser/services`** (only consumer is `SelectionService`).
`CompositionHelper` moves to **`browser/terminal`** (or `browser/input/ime` as integration sibling).
`TextBlinkStateManager`, `DomRenderer`, `DomRendererRowFactory` move to **`browser/renderer`** (integration), depending on **`browser/services`**.
### Integration
| Project | Contents |
| --- | --- |
| `browser/services` | `services/**`, `selection/SelectionModel.ts`, `RenderDebouncer.ts` |
| `browser/renderer` | `TextBlinkStateManager.ts`, `renderer/dom/DomRenderer.ts`, `DomRendererRowFactory.ts` (+ tests) |
| `browser/decorations` | `BufferDecorationRenderer.ts`, `OverviewRulerRenderer.ts` |
| `browser/terminal` | `CoreBrowserTerminal.ts`, `Viewport.ts`, `Linkifier.ts`, `Clipboard.ts`, `AccessibilityManager.ts`, `OscLinkProvider.ts`, `CompositionHelper.ts` |
### API
| Project | Contents |
| --- | --- |
| `browser/public` | `public/Terminal.ts` |
## Build order
1. `base`, `scrollable`, `input`, `selection/types`, `renderer/core`, `decorations/store`
2. `services`
3. `renderer`, `decorations`
4. `terminal`
5. `public`
## Why `renderer/dom` is not platform
`DomRenderer` (abbreviated):
```ts
constructor(
…,
@IInstantiationService instantiationService: IInstantiationService,
@ICharSizeService private readonly _charSizeService: ICharSizeService,
@IOptionsService private readonly _optionsService: IOptionsService,
@IBufferService private readonly _bufferService: IBufferService,
@ICoreService private readonly _coreService: ICoreService,
@ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,
@IThemeService private readonly _themeService: IThemeService
) {
this._rowFactory = instantiationService.createInstance(DomRendererRowFactory, document);
this._textBlinkStateManager = this._register(new TextBlinkStateManager(…, this._coreBrowserService, this._optionsService));
}
```
`DomRendererRowFactory` similarly injects `ICharacterJoinerService`, `ICoreBrowserService`, `IThemeService`, and other services. So **`renderer/dom` → `browser/services`** (and common services) today; the corrected graph places the whole DOM renderer stack in integration, with only `WidthCache` left in `renderer/core`.
## Parity with `common/`
Common platform modules contain algorithms and data structures without terminal service wiring. Browser platform modules are the same: DOM/scroll utilities, pointer math, renderer **primitives** (`WidthCache`, selection render geometry), and shared types — not renderers or IME helpers that pull `IRenderService` / `IThemeService` from DI.
@@ -3,8 +3,8 @@
* @license MIT * @license MIT
*/ */
import { IRenderDebouncerWithCallback } from 'target-browser/Types'; import { IRenderDebouncerWithCallback } from 'browser/Types';
import { ICoreBrowserService } from 'target-browser/services/Services'; import { ICoreBrowserService } from 'browser/services/Services';
/** /**
* Debounces calls to render terminal rows using animation frames. * Debounces calls to render terminal rows using animation frames.
@@ -3,8 +3,8 @@
* @license MIT * @license MIT
*/ */
import { MockCompositionHelper, MockRenderer, MockViewport, TestTerminal } from 'target-browser/TestUtils.test'; import { MockCompositionHelper, MockRenderer, MockViewport, TestTerminal } from 'browser/TestUtils.test';
import type { IBrowser } from 'target-browser/Types'; import type { IBrowser } from 'browser/Types';
import { assert } from 'chai'; import { assert } from 'chai';
import { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine'; import { DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
import { CellData } from 'common/buffer/CellData'; import { CellData } from 'common/buffer/CellData';
@@ -7,7 +7,7 @@ import * as path from 'path';
import * as os from 'os'; import * as os from 'os';
import * as fs from 'fs'; import * as fs from 'fs';
import * as pty from 'node-pty'; import * as pty from 'node-pty';
import { CoreBrowserTerminal } from 'target-browser/CoreBrowserTerminal'; import { CoreBrowserTerminal } from 'browser/CoreBrowserTerminal';
import { IDisposable } from '@xterm/xterm'; import { IDisposable } from '@xterm/xterm';
// all test files expect terminal in 80x25 // all test files expect terminal in 80x25
@@ -4,20 +4,20 @@
*/ */
import { IDisposable, IMarker, ILinkProvider, IDecorationOptions, IDecoration, IRenderDimensions as IRenderDimensionsApi } from '@xterm/xterm'; import { IDisposable, IMarker, ILinkProvider, IDecorationOptions, IDecoration, IRenderDimensions as IRenderDimensionsApi } from '@xterm/xterm';
import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IMouseService, IRenderService, ISelectionService, IThemeService } from 'target-browser/services/Services'; import { ICharacterJoinerService, ICharSizeService, ICoreBrowserService, IMouseService, IRenderService, ISelectionService, IThemeService } from 'browser/services/Services';
import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'target-browser/renderer/shared/Types'; import { IRenderDimensions, IRenderer, IRequestRedrawEvent } from 'browser/renderer/shared/Types';
import { IColorSet, ITerminal, ILinkifier2, IBrowser, IViewport, ICompositionHelper, CharacterJoinerHandler, IBufferRange, ReadonlyColorSet, IBufferElementProvider } from 'target-browser/Types'; import { IColorSet, ITerminal, ILinkifier2, IBrowser, IViewport, ICompositionHelper, CharacterJoinerHandler, IBufferRange, ReadonlyColorSet, IBufferElementProvider } from 'browser/Types';
import { IBuffer, IBufferSet } from 'common/buffer/Types'; import { IBuffer, IBufferSet } from 'common/buffer/Types';
import { IBufferLine, ICellData, IAttributeData, ICircularList, XtermListener, ICharset, ITerminalOptions, ColorIndex } from 'common/Types'; import { IBufferLine, ICellData, IAttributeData, ICircularList, XtermListener, ICharset, ITerminalOptions, ColorIndex } from 'common/Types';
import { Buffer } from 'common/buffer/Buffer'; import { Buffer } from 'common/buffer/Buffer';
import * as Browser from 'common/Platform'; import * as Browser from 'common/Platform';
import { CoreBrowserTerminal } from 'target-browser/CoreBrowserTerminal'; import { CoreBrowserTerminal } from 'browser/CoreBrowserTerminal';
import { IUnicodeService, IOptionsService, ICoreService, IMouseStateService } from 'common/services/Services'; import { IUnicodeService, IOptionsService, ICoreService, IMouseStateService } from 'common/services/Services';
import { IFunctionIdentifier, IParams } from 'common/parser/Types'; import { IFunctionIdentifier, IParams } from 'common/parser/Types';
import { AttributeData } from 'common/buffer/AttributeData'; import { AttributeData } from 'common/buffer/AttributeData';
import { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from 'target-browser/selection/Types'; import { ISelectionRedrawRequestEvent, ISelectionRequestScrollLinesEvent } from 'browser/selection/Types';
import { css } from 'common/Color'; import { css } from 'common/Color';
import { createRenderDimensions } from 'target-browser/renderer/shared/RendererUtils'; import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
import { Emitter, type IEvent } from 'common/Event'; import { Emitter, type IEvent } from 'common/Event';
export class TestTerminal extends CoreBrowserTerminal { export class TestTerminal extends CoreBrowserTerminal {
@@ -5,7 +5,7 @@
const RENDER_DEBOUNCE_THRESHOLD_MS = 1000; // 1 Second const RENDER_DEBOUNCE_THRESHOLD_MS = 1000; // 1 Second
import { IRenderDebouncer } from 'target-browser/Types'; import { IRenderDebouncer } from 'browser/Types';
/** /**
* Debounces calls to update screen readers to update at most once configurable interval of time. * Debounces calls to update screen readers to update at most once configurable interval of time.
@@ -3,16 +3,16 @@
* @license MIT * @license MIT
*/ */
import { ICoreBrowserService, IRenderService, IThemeService } from 'target-browser/services/Services'; import { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
import { ViewportConstants } from 'target-browser/shared/Constants'; import { ViewportConstants } from 'browser/shared/Constants';
import { Disposable, toDisposable } from 'common/Lifecycle'; import { Disposable, toDisposable } from 'common/Lifecycle';
import { IBufferService, ICoreService, IMouseStateService, IOptionsService } from 'common/services/Services'; import { IBufferService, ICoreService, IMouseStateService, IOptionsService } from 'common/services/Services';
import { CoreMouseEventType } from 'common/Types'; import { CoreMouseEventType } from 'common/Types';
import { scheduleAtNextAnimationFrame } from 'target-browser/Dom'; import { scheduleAtNextAnimationFrame } from 'browser/Dom';
import { SmoothScrollableElement } from 'target-browser/scrollable/scrollableElement'; import { SmoothScrollableElement } from 'browser/scrollable/scrollableElement';
import type { IScrollableElementChangeOptions } from 'target-browser/scrollable/scrollableElementOptions'; import type { IScrollableElementChangeOptions } from 'browser/scrollable/scrollableElementOptions';
import { Emitter, EventUtils } from 'common/Event'; import { Emitter, EventUtils } from 'common/Event';
import { Scrollable, ScrollbarVisibility, type IScrollEvent } from 'target-browser/scrollable/scrollable'; import { Scrollable, ScrollbarVisibility, type IScrollEvent } from 'browser/scrollable/scrollable';
export class Viewport extends Disposable { export class Viewport extends Disposable {
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { ICoreBrowserService, IRenderService } from 'target-browser/services/Services'; import { ICoreBrowserService, IRenderService } from 'browser/services/Services';
import { Disposable, toDisposable } from 'common/Lifecycle'; import { Disposable, toDisposable } from 'common/Lifecycle';
import { IBufferService, IDecorationService, IInternalDecoration } from 'common/services/Services'; import { IBufferService, IDecorationService, IInternalDecoration } from 'common/services/Services';
@@ -4,7 +4,7 @@
*/ */
import { assert } from 'chai'; import { assert } from 'chai';
import { ColorZoneStore } from 'target-browser/decorations/ColorZoneStore'; import { ColorZoneStore } from 'browser/decorations/ColorZoneStore';
const optionsRedFull = { const optionsRedFull = {
overviewRulerOptions: { overviewRulerOptions: {
@@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { ColorZoneStore, IColorZone, IColorZoneStore } from 'target-browser/decorations/ColorZoneStore'; import { ColorZoneStore, IColorZone, IColorZoneStore } from 'browser/decorations/ColorZoneStore';
import { ICoreBrowserService, IRenderService, IThemeService } from 'target-browser/services/Services'; import { ICoreBrowserService, IRenderService, IThemeService } from 'browser/services/Services';
import { Disposable, toDisposable } from 'common/Lifecycle'; import { Disposable, toDisposable } from 'common/Lifecycle';
import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services'; import { IBufferService, IDecorationService, IOptionsService } from 'common/services/Services';
@@ -4,8 +4,8 @@
*/ */
import { assert } from 'chai'; import { assert } from 'chai';
import { CompositionHelper } from 'target-browser/input/CompositionHelper'; import { CompositionHelper } from 'browser/input/CompositionHelper';
import { MockRenderService } from 'target-browser/TestUtils.test'; import { MockRenderService } from 'browser/TestUtils.test';
import { MockCoreService, MockBufferService, MockOptionsService } from 'common/TestUtils.test'; import { MockCoreService, MockBufferService, MockOptionsService } from 'common/TestUtils.test';
describe('CompositionHelper', () => { describe('CompositionHelper', () => {
@@ -3,7 +3,7 @@
* @license MIT * @license MIT
*/ */
import { IRenderService } from 'target-browser/services/Services'; import { IRenderService } from 'browser/services/Services';
import { IBufferService, ICoreService, IOptionsService } from 'common/services/Services'; import { IBufferService, ICoreService, IOptionsService } from 'common/services/Services';
import { C0 } from 'common/data/EscapeSequences'; import { C0 } from 'common/data/EscapeSequences';
@@ -5,7 +5,7 @@
import jsdom = require('jsdom'); import jsdom = require('jsdom');
import { assert } from 'chai'; import { assert } from 'chai';
import { getCoords } from 'target-browser/input/Mouse'; import { getCoords } from 'browser/input/Mouse';
const CHAR_WIDTH = 10; const CHAR_WIDTH = 10;
const CHAR_HEIGHT = 20; const CHAR_HEIGHT = 20;
@@ -3,9 +3,9 @@
* @license MIT * @license MIT
*/ */
import * as Strings from 'target-browser/LocalizableStrings'; import * as Strings from 'browser/LocalizableStrings';
import { CoreBrowserTerminal as TerminalCore } from 'target-browser/CoreBrowserTerminal'; import { CoreBrowserTerminal as TerminalCore } from 'browser/CoreBrowserTerminal';
import { IBufferRange, ITerminal } from 'target-browser/Types'; import { IBufferRange, ITerminal } from 'browser/Types';
import { Disposable } from 'common/Lifecycle'; import { Disposable } from 'common/Lifecycle';
import { ITerminalOptions } from 'common/Types'; import { ITerminalOptions } from 'common/Types';
import { AddonManager } from 'common/public/AddonManager'; import { AddonManager } from 'common/public/AddonManager';
@@ -3,20 +3,20 @@
* @license MIT * @license MIT
*/ */
import { DomRendererRowFactory, RowCss } from 'target-browser/renderer/dom/DomRendererRowFactory'; import { DomRendererRowFactory, RowCss } from 'browser/renderer/dom/DomRendererRowFactory';
import { WidthCache } from 'target-browser/renderer/dom/WidthCache'; import { WidthCache } from 'browser/renderer/dom/WidthCache';
import { INVERTED_DEFAULT_COLOR, RendererConstants } from 'target-browser/renderer/shared/Constants'; import { INVERTED_DEFAULT_COLOR, RendererConstants } from 'browser/renderer/shared/Constants';
import { createRenderDimensions } from 'target-browser/renderer/shared/RendererUtils'; import { createRenderDimensions } from 'browser/renderer/shared/RendererUtils';
import { createSelectionRenderModel } from 'target-browser/renderer/shared/SelectionRenderModel'; import { createSelectionRenderModel } from 'browser/renderer/shared/SelectionRenderModel';
import { TextBlinkStateManager } from 'target-browser/renderer/shared/TextBlinkStateManager'; import { TextBlinkStateManager } from 'browser/renderer/shared/TextBlinkStateManager';
import { IRenderDimensions, IRenderer, IRequestRedrawEvent, ISelectionRenderModel } from 'target-browser/renderer/shared/Types'; import { IRenderDimensions, IRenderer, IRequestRedrawEvent, ISelectionRenderModel } from 'browser/renderer/shared/Types';
import { ICharSizeService, ICoreBrowserService, IThemeService } from 'target-browser/services/Services'; import { ICharSizeService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { ILinkifier2, ILinkifierEvent, ITerminal, ReadonlyColorSet } from 'target-browser/Types'; import { ILinkifier2, ILinkifierEvent, ITerminal, ReadonlyColorSet } from 'browser/Types';
import { color } from 'common/Color'; import { color } from 'common/Color';
import { Disposable, toDisposable } from 'common/Lifecycle'; import { Disposable, toDisposable } from 'common/Lifecycle';
import { IBufferService, ICoreService, IInstantiationService, IOptionsService } from 'common/services/Services'; import { IBufferService, ICoreService, IInstantiationService, IOptionsService } from 'common/services/Services';
import { Emitter } from 'common/Event'; import { Emitter } from 'common/Event';
import { addDisposableListener } from 'target-browser/Dom'; import { addDisposableListener } from 'browser/Dom';
const enum Constants { const enum Constants {
@@ -5,15 +5,15 @@
import jsdom = require('jsdom'); import jsdom = require('jsdom');
import { assert } from 'chai'; import { assert } from 'chai';
import { DomRendererRowFactory } from 'target-browser/renderer/dom/DomRendererRowFactory'; import { DomRendererRowFactory } from 'browser/renderer/dom/DomRendererRowFactory';
import { NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR, DEFAULT_ATTR, FgFlags, BgFlags, Attributes, UnderlineStyle } from 'common/buffer/Constants'; import { NULL_CELL_CODE, NULL_CELL_WIDTH, NULL_CELL_CHAR, DEFAULT_ATTR, FgFlags, BgFlags, Attributes, UnderlineStyle } from 'common/buffer/Constants';
import { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine'; import { BufferLine, DEFAULT_ATTR_DATA } from 'common/buffer/BufferLine';
import { BufferLineStringCache } from 'common/buffer/BufferLineStringCache'; import { BufferLineStringCache } from 'common/buffer/BufferLineStringCache';
import { IBufferLine } from 'common/Types'; import { IBufferLine } from 'common/Types';
import { CellData } from 'common/buffer/CellData'; import { CellData } from 'common/buffer/CellData';
import { MockCoreService, MockDecorationService, MockOptionsService, createCellData, NULL_CELL_DATA } from 'common/TestUtils.test'; import { MockCoreService, MockDecorationService, MockOptionsService, createCellData, NULL_CELL_DATA } from 'common/TestUtils.test';
import { MockCharacterJoinerService, MockCoreBrowserService, MockThemeService } from 'target-browser/TestUtils.test'; import { MockCharacterJoinerService, MockCoreBrowserService, MockThemeService } from 'browser/TestUtils.test';
import { TestWidthCache } from 'target-browser/renderer/dom/WidthCache.test'; import { TestWidthCache } from 'browser/renderer/dom/WidthCache.test';
const TEST_STRING_CACHE = new BufferLineStringCache(); const TEST_STRING_CACHE = new BufferLineStringCache();
@@ -4,17 +4,17 @@
*/ */
import { IBufferLine, ICellData, IColor } from 'common/Types'; import { IBufferLine, ICellData, IColor } from 'common/Types';
import { INVERTED_DEFAULT_COLOR } from 'target-browser/renderer/shared/Constants'; import { INVERTED_DEFAULT_COLOR } from 'browser/renderer/shared/Constants';
import { WHITESPACE_CELL_CHAR, Attributes } from 'common/buffer/Constants'; import { WHITESPACE_CELL_CHAR, Attributes } from 'common/buffer/Constants';
import { CellData } from 'common/buffer/CellData'; import { CellData } from 'common/buffer/CellData';
import { ICoreService, IDecorationService, IOptionsService } from 'common/services/Services'; import { ICoreService, IDecorationService, IOptionsService } from 'common/services/Services';
import { channels, color } from 'common/Color'; import { channels, color } from 'common/Color';
import { ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'target-browser/services/Services'; import { ICharacterJoinerService, ICoreBrowserService, IThemeService } from 'browser/services/Services';
import { JoinedCellData } from 'target-browser/services/CharacterJoinerService'; import { JoinedCellData } from 'browser/services/CharacterJoinerService';
import { treatGlyphAsBackgroundColor } from 'target-browser/renderer/shared/RendererUtils'; import { treatGlyphAsBackgroundColor } from 'browser/renderer/shared/RendererUtils';
import { AttributeData } from 'common/buffer/AttributeData'; import { AttributeData } from 'common/buffer/AttributeData';
import { WidthCache } from 'target-browser/renderer/dom/WidthCache'; import { WidthCache } from 'browser/renderer/dom/WidthCache';
import { IColorContrastCache } from 'target-browser/Types'; import { IColorContrastCache } from 'browser/Types';
export const enum RowCss { export const enum RowCss {
@@ -4,7 +4,7 @@
*/ */
import * as assert from 'assert'; import * as assert from 'assert';
import { IWidthCacheFontVariantCanvas, WidthCache, WidthCacheSettings } from 'target-browser/renderer/dom/WidthCache'; import { IWidthCacheFontVariantCanvas, WidthCache, WidthCacheSettings } from 'browser/renderer/dom/WidthCache';
class MockWidthCacheFontVariantCanvas implements IWidthCacheFontVariantCanvas { class MockWidthCacheFontVariantCanvas implements IWidthCacheFontVariantCanvas {
@@ -3,7 +3,7 @@
* @license MIT * @license MIT
*/ */
import { throwIfFalsy } from 'target-browser/renderer/shared/RendererUtils'; import { throwIfFalsy } from 'browser/renderer/shared/RendererUtils';
import { IDisposable } from 'common/Types'; import { IDisposable } from 'common/Types';
import { FontWeight } from 'common/services/Services'; import { FontWeight } from 'common/services/Services';
@@ -3,7 +3,7 @@
* @license MIT * @license MIT
*/ */
import { computeNextVariantOffset } from 'target-browser/renderer/shared/RendererUtils'; import { computeNextVariantOffset } from 'browser/renderer/shared/RendererUtils';
import { assert } from 'chai'; import { assert } from 'chai';
describe('RendererUtils', () => { describe('RendererUtils', () => {

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