Merge remote-tracking branch 'upstream/master' into pr/jerch/5178

This commit is contained in:
Daniel Imms
2026-01-03 15:21:50 -08:00
237 changed files with 24997 additions and 8371 deletions
+625
View File
@@ -0,0 +1,625 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*
* This file is the entry point for browserify.
*/
// HACK: Playwright/WebKit on Windows does not support WebAssembly https://stackoverflow.com/q/62311688/1156119
import type { ImageAddon as ImageAddonType } from '@xterm/addon-image';
let ImageAddon: typeof ImageAddonType | undefined; // eslint-disable-line @typescript-eslint/naming-convention
if ('WebAssembly' in window) {
const imageAddon = require('@xterm/addon-image');
ImageAddon = imageAddon.ImageAddon;
}
import { Terminal, ITerminalOptions, type ITheme } from '@xterm/xterm';
import { AttachAddon } from '@xterm/addon-attach';
import { AddonImageWindow } from './components/window/addonImageWindow';
import { AddonSearchWindow } from './components/window/addonSearchWindow';
import { AddonSerializeWindow } from './components/window/addonSerializeWindow';
import { AddonsWindow } from './components/window/addonsWindow';
import { CellInspectorWindow } from './components/window/cellInspectorWindow';
import { ControlBar } from './components/controlBar';
import { WebglWindow } from './components/window/webglWindow';
import { OptionsWindow } from './components/window/optionsWindow';
import { StyleWindow } from './components/window/styleWindow';
import { TestWindow } from './components/window/testWindow';
import { VtWindow } from './components/window/vtWindow';
import { ClipboardAddon } from '@xterm/addon-clipboard';
import { FitAddon } from '@xterm/addon-fit';
import { LigaturesAddon } from '@xterm/addon-ligatures';
import { ProgressAddon } from '@xterm/addon-progress';
import { SearchAddon, ISearchOptions } from '@xterm/addon-search';
import { SerializeAddon } from '@xterm/addon-serialize';
import { WebLinksAddon } from '@xterm/addon-web-links';
import { WebglAddon } from '@xterm/addon-webgl';
import { Unicode11Addon } from '@xterm/addon-unicode11';
import { UnicodeGraphemesAddon } from '@xterm/addon-unicode-graphemes';
import { AddonCollection, type AddonType, type IDemoAddon } from './types';
export interface IWindowWithTerminal extends Window {
term: typeof Terminal;
Terminal: typeof Terminal;
AttachAddon?: typeof AttachAddon;
ClipboardAddon?: typeof ClipboardAddon;
FitAddon?: typeof FitAddon;
ImageAddon?: typeof ImageAddon;
ProgressAddon?: typeof ProgressAddon;
SearchAddon?: typeof SearchAddon;
SerializeAddon?: typeof SerializeAddon;
WebLinksAddon?: typeof WebLinksAddon;
WebglAddon?: typeof WebglAddon;
Unicode11Addon?: typeof Unicode11Addon;
UnicodeGraphemesAddon?: typeof UnicodeGraphemesAddon;
LigaturesAddon?: typeof LigaturesAddon;
}
declare let window: IWindowWithTerminal;
let term;
let protocol;
let socketURL;
let socket;
let pid;
let controlBar: ControlBar;
let addonsWindow: AddonsWindow;
let addonSearchWindow: AddonSearchWindow;
let addonWebglWindow: WebglWindow;
let optionsWindow: OptionsWindow;
const addons: AddonCollection = {
attach: { name: 'attach', ctor: AttachAddon, canChange: false },
clipboard: { name: 'clipboard', ctor: ClipboardAddon, canChange: true },
fit: { name: 'fit', ctor: FitAddon, canChange: false },
image: { name: 'image', ctor: ImageAddon, canChange: true },
progress: { name: 'progress', ctor: ProgressAddon, canChange: true },
search: { name: 'search', ctor: SearchAddon, canChange: true },
serialize: { name: 'serialize', ctor: SerializeAddon, canChange: true },
webLinks: { name: 'webLinks', ctor: WebLinksAddon, canChange: true },
webgl: { name: 'webgl', ctor: WebglAddon, canChange: true },
unicode11: { name: 'unicode11', ctor: Unicode11Addon, canChange: true },
unicodeGraphemes: { name: 'unicodeGraphemes', ctor: UnicodeGraphemesAddon, canChange: true },
ligatures: { name: 'ligatures', ctor: LigaturesAddon, canChange: true }
};
let terminalContainer = document.getElementById('terminal-container');
let actionElements: {
findNext: HTMLInputElement;
findPrevious: HTMLInputElement;
findResults: HTMLElement;
};
let paddingElement: HTMLInputElement;
const xtermjsTheme = {
foreground: '#F8F8F8',
background: '#2D2E2C',
selectionBackground: '#5DA5D533',
selectionInactiveBackground: '#555555AA',
black: '#1E1E1D',
brightBlack: '#262625',
red: '#CE5C5C',
brightRed: '#FF7272',
green: '#5BCC5B',
brightGreen: '#72FF72',
yellow: '#CCCC5B',
brightYellow: '#FFFF72',
blue: '#5D5DD3',
brightBlue: '#7279FF',
magenta: '#BC5ED1',
brightMagenta: '#E572FF',
cyan: '#5DA5D5',
brightCyan: '#72F0FF',
white: '#F8F8F8',
brightWhite: '#FFFFFF'
} satisfies ITheme;
function setPadding(): void {
term.element.style.padding = parseInt(paddingElement.value, 10).toString() + 'px';
addons.fit.instance.fit();
}
function getSearchOptions(): ISearchOptions {
return {
regex: (document.getElementById('regex') as HTMLInputElement).checked,
wholeWord: (document.getElementById('whole-word') as HTMLInputElement).checked,
caseSensitive: (document.getElementById('case-sensitive') as HTMLInputElement).checked,
decorations: (document.getElementById('highlight-all-matches') as HTMLInputElement).checked ? {
matchBackground: '#232422',
matchBorder: '#555753',
matchOverviewRuler: '#555753',
activeMatchBackground: '#ef2929',
activeMatchBorder: '#ffffff',
activeMatchColorOverviewRuler: '#ef2929'
} : undefined
};
}
const disposeRecreateButtonHandler: () => void = () => {
// If the terminal exists dispose of it, otherwise recreate it
if (term) {
term.dispose();
term = null;
window.term = null;
socket = null;
addons.attach.instance = undefined;
addons.clipboard.instance = undefined;
addons.fit.instance = undefined;
addons.image.instance = undefined;
addons.search.instance = undefined;
addons.serialize.instance = undefined;
addons.unicode11.instance = undefined;
addons.unicodeGraphemes.instance = undefined;
addons.ligatures.instance = undefined;
addons.webLinks.instance = undefined;
addons.webgl.instance = undefined;
document.getElementById('dispose').innerHTML = 'Recreate Terminal';
} else {
createTerminal();
document.getElementById('dispose').innerHTML = 'Dispose terminal';
}
};
const createNewWindowButtonHandler: () => void = () => {
if (term) {
disposeRecreateButtonHandler();
}
const win = window.open();
terminalContainer = win.document.createElement('div');
terminalContainer.id = 'terminal-container';
win.document.body.appendChild(terminalContainer);
// Stylesheets are needed to get the terminal in the popout window to render
// correctly. We also need to wait for them to load before creating the
// terminal, otherwise we will not compute the correct metrics when rendering.
let pendingStylesheets = 0;
for (const linkNode of document.querySelectorAll('head link[rel=stylesheet]')) {
const newLink = document.createElement('link');
newLink.rel = 'stylesheet';
newLink.href = (linkNode as HTMLLinkElement).href;
win.document.head.appendChild(newLink);
pendingStylesheets++;
newLink.addEventListener('load', () => {
pendingStylesheets--;
if (pendingStylesheets === 0) {
createTerminal();
}
});
}
};
if (document.location.pathname === '/test') {
window.Terminal = Terminal;
window.AttachAddon = AttachAddon;
window.ClipboardAddon = ClipboardAddon;
window.FitAddon = FitAddon;
window.ImageAddon = ImageAddon;
window.ProgressAddon = ProgressAddon;
window.SearchAddon = SearchAddon;
window.SerializeAddon = SerializeAddon;
window.Unicode11Addon = Unicode11Addon;
window.UnicodeGraphemesAddon = UnicodeGraphemesAddon;
window.LigaturesAddon = LigaturesAddon;
window.WebLinksAddon = WebLinksAddon;
window.WebglAddon = WebglAddon;
} else {
const typedTerm = createTerminal();
controlBar = new ControlBar(document.getElementById('sidebar'), document.querySelector('.banner-tabs'), []);
optionsWindow = controlBar.registerWindow(new OptionsWindow(typedTerm, addons, { updateTerminalSize, updateTerminalContainerBackground }));
const styleWindow = controlBar.registerWindow(new StyleWindow(typedTerm, addons));
controlBar.registerWindow(new CellInspectorWindow(typedTerm, addons));
controlBar.registerWindow(new VtWindow(typedTerm, addons));
addonsWindow = controlBar.registerWindow(new AddonsWindow(typedTerm, addons));
addonSearchWindow = controlBar.registerWindow(new AddonSearchWindow(typedTerm, addons), { afterId: 'addons', hidden: true, italics: true });
controlBar.registerWindow(new AddonSerializeWindow(typedTerm, addons), { afterId: 'addon-search', hidden: true, italics: true });
controlBar.registerWindow(new AddonImageWindow(typedTerm, addons), { afterId: 'addon-serialize', hidden: true, italics: true });
addonWebglWindow = controlBar.registerWindow(new WebglWindow(typedTerm, addons), { afterId: 'addon-image', hidden: true, italics: true });
controlBar.registerWindow(new TestWindow(typedTerm, addons, { disposeRecreateButtonHandler, createNewWindowButtonHandler }), { afterId: 'options' });
actionElements = {
findNext: addonSearchWindow.findNextInput,
findPrevious: addonSearchWindow.findPreviousInput,
findResults: addonSearchWindow.findResultsSpan
};
controlBar.activateDefaultTab();
// TODO: Most of below should be encapsulated within windows
paddingElement = styleWindow.paddingElement;
controlBar.setTabVisible('addon-webgl', true);
controlBar.setTabVisible('addon-search', true);
controlBar.setTabVisible('addon-serialize', true);
controlBar.setTabVisible('addon-image', true);
addonWebglWindow.setTextureAtlas(addons.webgl.instance.textureAtlas);
addons.webgl.instance.onChangeTextureAtlas(e => addonWebglWindow.setTextureAtlas(e));
addons.webgl.instance.onAddTextureAtlasCanvas(e => addonWebglWindow.appendTextureAtlas(e));
addons.webgl.instance.onRemoveTextureAtlasCanvas(e => addonWebglWindow.removeTextureAtlas(e));
paddingElement.value = '0';
addDomListener(paddingElement, 'change', setPadding);
addDomListener(actionElements.findNext, 'keydown', (e) => {
if (e.key === 'Enter') {
addons.search.instance.findNext(actionElements.findNext.value, getSearchOptions());
e.preventDefault();
}
});
addDomListener(actionElements.findNext, 'input', (e) => {
addons.search.instance.findNext(actionElements.findNext.value, getSearchOptions());
});
addDomListener(actionElements.findPrevious, 'keydown', (e) => {
if (e.key === 'Enter') {
addons.search.instance.findPrevious(actionElements.findPrevious.value, getSearchOptions());
e.preventDefault();
}
});
addDomListener(actionElements.findPrevious, 'input', (e) => {
addons.search.instance.findPrevious(actionElements.findPrevious.value, getSearchOptions());
});
addDomListener(actionElements.findNext, 'blur', (e) => {
addons.search.instance.clearActiveDecoration();
});
addDomListener(actionElements.findPrevious, 'blur', (e) => {
addons.search.instance.clearActiveDecoration();
});
}
function createTerminal(): Terminal {
// Clean terminal
while (terminalContainer.children.length) {
terminalContainer.removeChild(terminalContainer.children[0]);
}
const isWindows = ['Windows', 'Win16', 'Win32', 'WinCE'].indexOf(navigator.platform) >= 0;
term = new Terminal({
allowProposedApi: true,
windowsPty: isWindows ? {
// In a real scenario, these values should be verified on the backend
backend: 'conpty',
buildNumber: 22621
} : undefined,
fontFamily: '"Fira Code", monospace, "Powerline Extra Symbols"',
theme: { ...xtermjsTheme }
} as ITerminalOptions);
// Load addons
const typedTerm = term as Terminal;
addons.search.instance = new SearchAddon();
addons.serialize.instance = new SerializeAddon();
addons.fit.instance = new FitAddon();
addons.image.instance = new ImageAddon();
addons.progress.instance = new ProgressAddon();
addons.unicodeGraphemes.instance = new UnicodeGraphemesAddon();
addons.clipboard.instance = new ClipboardAddon();
try { // try to start with webgl renderer (might throw on older safari/webkit)
addons.webgl.instance = new WebglAddon();
} catch (e) {
console.warn(e);
}
addons.webLinks.instance = new WebLinksAddon();
typedTerm.loadAddon(addons.fit.instance);
typedTerm.loadAddon(addons.image.instance);
typedTerm.loadAddon(addons.progress.instance);
typedTerm.loadAddon(addons.search.instance);
typedTerm.loadAddon(addons.serialize.instance);
typedTerm.loadAddon(addons.unicodeGraphemes.instance);
typedTerm.loadAddon(addons.webLinks.instance);
typedTerm.loadAddon(addons.clipboard.instance);
window.term = term; // Expose `term` to window for debugging purposes
term.onResize((size: { cols: number, rows: number }) => {
if (!pid) {
return;
}
const cols = size.cols;
const rows = size.rows;
const url = '/terminals/' + pid + '/size?cols=' + cols + '&rows=' + rows;
fetch(url, { method: 'POST' });
});
protocol = (location.protocol === 'https:') ? 'wss://' : 'ws://';
socketURL = protocol + location.hostname + ((location.port) ? (':' + location.port) : '') + '/terminals/';
addons.fit.instance!.fit();
if (addons.webgl.instance) {
try {
typedTerm.loadAddon(addons.webgl.instance);
term.open(terminalContainer);
} catch (e) {
console.warn('error during loading webgl addon:', e);
addons.webgl.instance.dispose();
addons.webgl.instance = undefined;
}
}
if (!typedTerm.element) {
// webgl loading failed for some reason, attach with DOM renderer
term.open(terminalContainer);
}
term.focus();
updateTerminalContainerBackground();
const resizeObserver = new ResizeObserver(entries => {
if (optionsWindow.autoResize) {
// In general this should be debounced to avoid excessive work on the main
// thread by firing the expensive resize action repeatedly
addons.fit.instance.fit();
}
});
resizeObserver.observe(terminalContainer);
window.addEventListener('resize', () => {
terminalContainer.style.width = document.body.clientWidth + 'px';
});
// fit is called within a setTimeout, cols and rows need this.
setTimeout(async () => {
optionsWindow.initOptions(addDomListener);
// Set terminal size again to set the specific dimensions on the demo
updateTerminalSize();
const useRealTerminal = document.getElementById('use-real-terminal');
if (useRealTerminal instanceof HTMLInputElement && !useRealTerminal.checked) {
runFakeTerminal();
} else {
const res = await fetch('/terminals?cols=' + term.cols + '&rows=' + term.rows, { method: 'POST' });
const processId = await res.text();
pid = processId;
socketURL += processId;
socket = new WebSocket(socketURL);
socket.onopen = runRealTerminal;
socket.onclose = runFakeTerminal;
socket.onerror = runFakeTerminal;
}
}, 0);
return typedTerm;
}
function runRealTerminal(): void {
addons.attach.instance = new AttachAddon(socket);
term.loadAddon(addons.attach.instance);
term._initialized = true;
initAddons(term);
}
function runFakeTerminal(): void {
if (term._initialized) {
return;
}
term._initialized = true;
initAddons(term);
term.prompt = () => {
term.write('\r\n$ ');
};
term.writeln('Welcome to xterm.js');
term.writeln('This is a local terminal emulation, without a real terminal in the back-end.');
term.writeln('Type some keys and commands to play around.');
term.writeln('');
term.prompt();
term.onKey((e: { key: string, domEvent: KeyboardEvent }) => {
const ev = e.domEvent;
const printable = !ev.altKey && !ev.ctrlKey && !ev.metaKey;
if (ev.keyCode === 13) {
term.prompt();
} else if (ev.keyCode === 8) {
// Do not delete the prompt
if (term._core.buffer.x > 2) {
term.write('\b \b');
}
} else if (printable) {
term.write(e.key);
}
});
}
function updateTerminalContainerBackground(): void {
if (term.options.allowTransparency) {
terminalContainer.style.background = 'repeating-conic-gradient(#000000 0% 25%, #101010 0% 50%) 50% / 20px 20px';
} else {
terminalContainer.style.background = term.options.theme?.background ?? '#000000';
}
}
function initAddons(term: Terminal): void {
const fragment = document.createDocumentFragment();
function postInitWebgl(): void {
controlBar.setTabVisible('addon-webgl', true);
setTimeout(() => {
addonWebglWindow.setTextureAtlas(addons.webgl.instance.textureAtlas);
addons.webgl.instance.onChangeTextureAtlas(e => addonWebglWindow.setTextureAtlas(e));
addons.webgl.instance.onAddTextureAtlasCanvas(e => addonWebglWindow.appendTextureAtlas(e));
}, 500);
}
function preDisposeWebgl(): void {
controlBar.setTabVisible('addon-webgl', false);
if (addons.webgl.instance.textureAtlas) {
addons.webgl.instance.textureAtlas.remove();
}
}
Object.keys(addons).forEach((name: AddonType) => {
const addon = addons[name];
const checkbox = document.createElement('input') as HTMLInputElement;
checkbox.type = 'checkbox';
checkbox.checked = !!addon.instance;
if (!addon.canChange) {
checkbox.disabled = true;
}
if (name === 'unicode11' && checkbox.checked) {
term.unicode.activeVersion = '11';
}
if (name === 'unicodeGraphemes' && checkbox.checked) {
term.unicode.activeVersion = '15-graphemes';
}
if (name === 'search' && checkbox.checked) {
addons[name].instance.onDidChangeResults(e => updateFindResults(e));
}
addDomListener(checkbox, 'change', () => {
if (name === 'image') {
if (checkbox.checked) {
const ctorOptionsJson = document.querySelector<HTMLTextAreaElement>('#image-options').value;
addon.instance = ctorOptionsJson
? new addons[name].ctor(JSON.parse(ctorOptionsJson))
: new addons[name].ctor();
term.loadAddon(addon.instance);
controlBar.setTabVisible('addon-image', true);
} else {
controlBar.setTabVisible('addon-image', false);
addon.instance!.dispose();
addon.instance = undefined;
}
return;
}
if (checkbox.checked) {
// HACK: Manually remove addons that cannot be changes
addon.instance = new (addon as IDemoAddon<Exclude<AddonType, 'attach'>>).ctor();
try {
term.loadAddon(addon.instance);
if (name === 'webgl') {
postInitWebgl();
} else if (name === 'unicode11') {
term.unicode.activeVersion = '11';
} else if (name === 'unicodeGraphemes') {
term.unicode.activeVersion = '15-graphemes';
} else if (name === 'search') {
controlBar.setTabVisible('addon-search', true);
addons[name].instance.onDidChangeResults(e => updateFindResults(e));
} else if (name === 'serialize') {
controlBar.setTabVisible('addon-serialize', true);
}
}
catch {
addon.instance = undefined;
checkbox.checked = false;
checkbox.disabled = true;
}
} else {
if (name === 'webgl') {
preDisposeWebgl();
} else if (name === 'unicode11' || name === 'unicodeGraphemes') {
term.unicode.activeVersion = '6';
} else if (name === 'search') {
controlBar.setTabVisible('addon-search', false);
} else if (name === 'serialize') {
controlBar.setTabVisible('addon-serialize', false);
}
addon.instance!.dispose();
addon.instance = undefined;
}
if (name === 'ligatures') {
// Recreate webgl when ligatures are toggled so texture atlas picks up any font feature
// settings changes
if (addons.webgl.instance) {
preDisposeWebgl();
addons.webgl.instance.dispose();
const customGlyphsCheckbox = document.getElementById('webgl-custom-glyphs') as HTMLInputElement;
addons.webgl.instance = new addons.webgl.ctor({ customGlyphs: customGlyphsCheckbox?.checked ?? true });
term.loadAddon(addons.webgl.instance);
postInitWebgl();
}
}
});
const label = document.createElement('label');
label.classList.add('addon');
if (!addon.canChange) {
label.title = 'This addon is needed for the demo to operate';
}
label.appendChild(checkbox);
label.appendChild(document.createTextNode(name));
const wrapper = document.createElement('div');
wrapper.classList.add('addon');
wrapper.appendChild(label);
// Add customGlyphs sub-checkbox for webgl addon
if (name === 'webgl') {
const customGlyphsCheckbox = document.createElement('input') as HTMLInputElement;
customGlyphsCheckbox.type = 'checkbox';
customGlyphsCheckbox.checked = true; // Default to enabled
customGlyphsCheckbox.id = 'webgl-custom-glyphs';
addDomListener(customGlyphsCheckbox, 'change', () => {
if (addons.webgl.instance) {
preDisposeWebgl();
addons.webgl.instance.dispose();
addons.webgl.instance = new addons.webgl.ctor({ customGlyphs: customGlyphsCheckbox.checked });
term.loadAddon(addons.webgl.instance);
postInitWebgl();
}
});
const customGlyphsLabel = document.createElement('label');
customGlyphsLabel.classList.add('addon');
customGlyphsLabel.style.display = 'block';
customGlyphsLabel.style.marginLeft = '20px';
customGlyphsLabel.appendChild(customGlyphsCheckbox);
customGlyphsLabel.appendChild(document.createTextNode('customGlyphs'));
wrapper.appendChild(customGlyphsLabel);
}
fragment.appendChild(wrapper);
});
const container = addonsWindow.addonsContainer;
container.innerHTML = '';
container.appendChild(fragment);
}
function updateFindResults(e: { resultIndex: number, resultCount: number } | undefined): void {
let content: string;
if (e === undefined) {
content = 'undefined';
} else {
content = `index: ${e.resultIndex}, count: ${e.resultCount}`;
}
actionElements.findResults.textContent = content;
}
function addDomListener(element: HTMLElement, type: string, handler: (...args: any[]) => any): void {
element.addEventListener(type, handler);
term._core._register({ dispose: () => element.removeEventListener(type, handler) });
}
function updateTerminalSize(): void {
const width = optionsWindow.autoResize ? '100%'
: (term.dimensions.css.canvas.width + term._core.viewport.scrollBarWidth).toString() + 'px';
const height = optionsWindow.autoResize ? '100%'
: (term.dimensions.css.canvas.height).toString() + 'px';
terminalContainer.style.width = width;
terminalContainer.style.height = height;
addons.fit.instance.fit();
}
(console as any).image = (source: ImageData | HTMLCanvasElement, scale: number = 1) => {
function getBox(width: number, height: number): any {
return {
string: '+',
style: 'font-size: 1px; padding: ' + Math.floor(height/2) + 'px ' + Math.floor(width/2) + 'px; line-height: ' + height + 'px;'
};
}
if (source instanceof HTMLCanvasElement) {
source = source.getContext('2d')!.getImageData(0, 0, source.width, source.height)!;
}
const canvas = document.createElement('canvas');
canvas.width = source.width;
canvas.height = source.height;
const ctx = canvas.getContext('2d')!;
ctx.putImageData(source, 0, 0);
const sw = source.width * scale;
const sh = source.height * scale;
const dim = getBox(sw, sh);
console.log(
`Image: ${source.width} x ${source.height}\n%c${dim.string}`,
`${dim.style}background: url(${canvas.toDataURL()}); background-size: ${sw}px ${sh}px; background-repeat: no-repeat; color: transparent;`
);
console.groupCollapsed('Zoomed');
console.log(
`%c${dim.string}`,
`${getBox(sw * 10, sh * 10).style}background: url(${canvas.toDataURL()}); background-size: ${sw * 10}px ${sh * 10}px; background-repeat: no-repeat; color: transparent; image-rendering: pixelated;-ms-interpolation-mode: nearest-neighbor;`
);
console.groupEnd();
};
+235
View File
@@ -0,0 +1,235 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import type { Terminal } from '@xterm/xterm';
export interface ITabConfig {
id: string;
label: string;
}
export interface IControlWindow {
readonly id: string;
readonly label: string;
build(container: HTMLElement): void;
setTerminal(terminal: Terminal): void;
}
export class ControlBar {
private readonly _sidebar: HTMLElement;
private readonly _resizeHandleH: HTMLElement;
private readonly _resizeHandleV: HTMLElement;
private readonly _resizeHandleCorner: HTMLElement;
private _resizeMode: 'none' | 'horizontal' | 'vertical' | 'corner' = 'none';
private readonly _tabContainer: HTMLElement;
private readonly _tabs: Map<string, { button: HTMLButtonElement, content: HTMLElement }> = new Map();
private _activeTabId: string | null = null;
constructor(sidebar: HTMLElement, tabContainer: HTMLElement, tabs: ITabConfig[]) {
this._sidebar = sidebar;
this._tabContainer = tabContainer;
// Create resize handles
this._resizeHandleH = document.createElement('div');
this._resizeHandleH.id = 'sidebar-resize-handle-horizontal';
this._resizeHandleV = document.createElement('div');
this._resizeHandleV.id = 'sidebar-resize-handle-vertical';
this._resizeHandleCorner = document.createElement('div');
this._resizeHandleCorner.id = 'sidebar-resize-handle-corner';
// Insert handles at the beginning of the sidebar
this._sidebar.prepend(this._resizeHandleCorner);
this._sidebar.prepend(this._resizeHandleV);
this._sidebar.prepend(this._resizeHandleH);
this._initResizeListeners();
this._initTabs(tabs);
}
private _initResizeListeners(): void {
this._resizeHandleH.addEventListener('mousedown', (e: MouseEvent) => this._startResize('horizontal', e));
this._resizeHandleV.addEventListener('mousedown', (e: MouseEvent) => this._startResize('vertical', e));
this._resizeHandleCorner.addEventListener('mousedown', (e: MouseEvent) => this._startResize('corner', e));
document.addEventListener('mousemove', (e: MouseEvent) => {
if (this._resizeMode === 'none') return;
if (this._resizeMode === 'horizontal' || this._resizeMode === 'corner') {
const newWidth = window.innerWidth - e.clientX - 10;
this._sidebar.style.width = `${Math.max(200, newWidth)}px`;
}
if (this._resizeMode === 'vertical' || this._resizeMode === 'corner') {
const rect = this._sidebar.getBoundingClientRect();
const newHeight = e.clientY - rect.top;
this._sidebar.style.height = `${Math.max(100, newHeight)}px`;
}
});
document.addEventListener('mouseup', () => {
this._resizeMode = 'none';
document.body.style.cursor = '';
document.body.style.userSelect = '';
});
}
private _startResize(mode: 'horizontal' | 'vertical' | 'corner', e: MouseEvent): void {
this._resizeMode = mode;
document.body.style.cursor = mode === 'horizontal' ? 'ew-resize' : mode === 'vertical' ? 'ns-resize' : 'nesw-resize';
document.body.style.userSelect = 'none';
e.preventDefault();
}
private _initTabs(tabs: ITabConfig[]): void {
// Clear existing buttons
this._tabContainer.innerHTML = '';
// Create tab buttons
for (const tab of tabs) {
const content = document.getElementById(tab.id);
if (!content) {
console.warn(`Tab content element not found: ${tab.id}`);
continue;
}
const button = document.createElement('button');
button.id = `${tab.id}button`;
button.className = 'tabLinks';
button.textContent = tab.label;
button.addEventListener('click', (e) => this._openSection(e, tab.id));
this._tabContainer.appendChild(button);
this._tabs.set(tab.id, { button, content });
// Hide content initially
content.style.display = 'none';
}
// Restore saved tab or default to first
const savedTab = localStorage.getItem('tab');
const tabId = savedTab && this._tabs.has(savedTab) ? savedTab : tabs[0]?.id;
if (tabId) {
this._activateTab(tabId);
}
}
private _openSection(event: MouseEvent, tabId: string): void {
const tab = this._tabs.get(tabId);
if (!tab) return;
// If clicking active tab, toggle sidebar visibility
if (tab.button.classList.contains('active')) {
this._sidebar.classList.toggle('sidebar-hidden');
return;
}
// Show sidebar if hidden
this._sidebar.classList.remove('sidebar-hidden');
this._activateTab(tabId);
}
private _activateTab(tabId: string): void {
// Deactivate all tabs
for (const [, { button, content }] of this._tabs) {
button.classList.remove('active');
content.style.display = 'none';
}
// Activate the selected tab
const tab = this._tabs.get(tabId);
if (tab) {
tab.button.classList.add('active');
tab.content.style.display = 'block';
this._activeTabId = tabId;
localStorage.setItem('tab', tabId);
}
}
public registerWindow<T extends IControlWindow>(window: T, options?: { afterId?: string, hidden?: boolean, italics?: boolean }): T {
// Create button
const button = document.createElement('button');
button.id = `${window.id}button`;
button.className = 'tabLinks';
button.textContent = window.label;
button.addEventListener('click', (e) => this._openSection(e, window.id));
// Apply small tab styling
if (options?.italics) {
button.style.fontStyle = 'italic';
}
// Insert after specified tab or append at end
if (options?.afterId) {
const afterTab = this._tabs.get(options.afterId);
if (afterTab?.button.nextSibling) {
this._tabContainer.insertBefore(button, afterTab.button.nextSibling);
} else {
this._tabContainer.appendChild(button);
}
} else {
this._tabContainer.appendChild(button);
}
// Hide if specified
if (options?.hidden) {
button.style.display = 'none';
}
// Create content container
const content = document.createElement('div');
content.id = window.id;
content.className = 'tabContent';
content.style.display = 'none';
this._sidebar.appendChild(content);
// Let the window build its content
window.build(content);
this._tabs.set(window.id, { button, content });
return window;
}
public setTabVisible(tabId: string, visible: boolean): void {
const tab = this._tabs.get(tabId);
if (tab) {
tab.button.style.display = visible ? '' : 'none';
// If hiding the active tab, switch to first visible tab
if (!visible && this._activeTabId === tabId) {
for (const [id, t] of this._tabs) {
if (t.button.style.display !== 'none') {
this._activateTab(id);
break;
}
}
}
}
}
public get activeTabId(): string | null {
return this._activeTabId;
}
public activateDefaultTab(): void {
// Restore saved tab or default to first visible tab
const savedTab = localStorage.getItem('tab');
if (savedTab && this._tabs.has(savedTab)) {
const tab = this._tabs.get(savedTab);
if (tab && tab.button.style.display !== 'none') {
this._activateTab(savedTab);
return;
}
}
// Fall back to first visible tab
for (const [id, tab] of this._tabs) {
if (tab.button.style.display !== 'none') {
this._activateTab(id);
return;
}
}
}
}
@@ -0,0 +1,62 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { BaseWindow } from './baseWindow';
import type { IControlWindow } from '../controlBar';
export class AddonImageWindow extends BaseWindow implements IControlWindow {
public readonly id = 'addon-image';
public readonly label = 'image';
private _imageStorageLimitInput: HTMLInputElement;
private _imageShowPlaceholderCheckbox: HTMLInputElement;
private _imageOptionsTextarea: HTMLTextAreaElement;
public build(container: HTMLElement): void {
// Storage limit
const storageLimitLabel = document.createElement('label');
storageLimitLabel.textContent = 'Storage Limit (in MB) ';
this._imageStorageLimitInput = document.createElement('input');
this._imageStorageLimitInput.type = 'number';
this._imageStorageLimitInput.id = 'image-storagelimit';
storageLimitLabel.appendChild(this._imageStorageLimitInput);
container.appendChild(storageLimitLabel);
container.appendChild(document.createElement('br'));
// Show placeholder
const placeholderLabel = document.createElement('label');
placeholderLabel.textContent = 'Show Placeholder ';
this._imageShowPlaceholderCheckbox = document.createElement('input');
this._imageShowPlaceholderCheckbox.type = 'checkbox';
this._imageShowPlaceholderCheckbox.id = 'image-showplaceholder';
placeholderLabel.appendChild(this._imageShowPlaceholderCheckbox);
container.appendChild(placeholderLabel);
container.appendChild(document.createElement('br'));
container.appendChild(document.createElement('br'));
// Ctor options
const optionsLabel = document.createElement('label');
optionsLabel.appendChild(document.createTextNode('Ctor options (applied on addon relaunch)'));
optionsLabel.appendChild(document.createElement('br'));
this._imageOptionsTextarea = document.createElement('textarea');
this._imageOptionsTextarea.id = 'image-options';
this._imageOptionsTextarea.cols = 40;
this._imageOptionsTextarea.rows = 12;
optionsLabel.appendChild(this._imageOptionsTextarea);
container.appendChild(optionsLabel);
}
public get imageStorageLimitInput(): HTMLInputElement {
return this._imageStorageLimitInput;
}
public get imageShowPlaceholderCheckbox(): HTMLInputElement {
return this._imageShowPlaceholderCheckbox;
}
public get imageOptionsTextarea(): HTMLTextAreaElement {
return this._imageOptionsTextarea;
}
}
@@ -0,0 +1,101 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { BaseWindow } from './baseWindow';
import type { IControlWindow } from '../controlBar';
export class AddonSearchWindow extends BaseWindow implements IControlWindow {
public readonly id = 'addon-search';
public readonly label = 'search';
private _findNextInput: HTMLInputElement;
private _findPreviousInput: HTMLInputElement;
private _findResultsSpan: HTMLElement;
private _regexCheckbox: HTMLInputElement;
private _caseSensitiveCheckbox: HTMLInputElement;
private _wholeWordCheckbox: HTMLInputElement;
private _highlightAllMatchesCheckbox: HTMLInputElement;
public build(container: HTMLElement): void {
const wrapper = document.createElement('div');
wrapper.style.display = 'flex';
wrapper.style.flexDirection = 'column';
// Find next
const findNextLabel = document.createElement('label');
findNextLabel.textContent = 'Find next ';
this._findNextInput = document.createElement('input');
this._findNextInput.id = 'find-next';
findNextLabel.appendChild(this._findNextInput);
wrapper.appendChild(findNextLabel);
// Find previous
const findPrevLabel = document.createElement('label');
findPrevLabel.textContent = 'Find previous ';
this._findPreviousInput = document.createElement('input');
this._findPreviousInput.id = 'find-previous';
findPrevLabel.appendChild(this._findPreviousInput);
wrapper.appendChild(findPrevLabel);
// Results
const resultsDiv = document.createElement('div');
resultsDiv.textContent = 'Results: ';
this._findResultsSpan = document.createElement('span');
this._findResultsSpan.id = 'find-results';
resultsDiv.appendChild(this._findResultsSpan);
wrapper.appendChild(resultsDiv);
// Regex checkbox
const regexLabel = document.createElement('label');
this._regexCheckbox = document.createElement('input');
this._regexCheckbox.type = 'checkbox';
this._regexCheckbox.id = 'regex';
regexLabel.appendChild(this._regexCheckbox);
regexLabel.appendChild(document.createTextNode('Use regex'));
wrapper.appendChild(regexLabel);
// Case sensitive checkbox
const caseLabel = document.createElement('label');
this._caseSensitiveCheckbox = document.createElement('input');
this._caseSensitiveCheckbox.type = 'checkbox';
this._caseSensitiveCheckbox.id = 'case-sensitive';
caseLabel.appendChild(this._caseSensitiveCheckbox);
caseLabel.appendChild(document.createTextNode('Case sensitive'));
wrapper.appendChild(caseLabel);
// Whole word checkbox
const wholeWordLabel = document.createElement('label');
this._wholeWordCheckbox = document.createElement('input');
this._wholeWordCheckbox.type = 'checkbox';
this._wholeWordCheckbox.id = 'whole-word';
wholeWordLabel.appendChild(this._wholeWordCheckbox);
wholeWordLabel.appendChild(document.createTextNode('Whole word'));
wrapper.appendChild(wholeWordLabel);
// Highlight all matches checkbox
const highlightLabel = document.createElement('label');
this._highlightAllMatchesCheckbox = document.createElement('input');
this._highlightAllMatchesCheckbox.type = 'checkbox';
this._highlightAllMatchesCheckbox.id = 'highlight-all-matches';
this._highlightAllMatchesCheckbox.checked = true;
highlightLabel.appendChild(this._highlightAllMatchesCheckbox);
highlightLabel.appendChild(document.createTextNode('Highlight All Matches'));
wrapper.appendChild(highlightLabel);
container.appendChild(wrapper);
}
public get findNextInput(): HTMLInputElement {
return this._findNextInput;
}
public get findPreviousInput(): HTMLInputElement {
return this._findPreviousInput;
}
public get findResultsSpan(): HTMLElement {
return this._findResultsSpan;
}
}
@@ -0,0 +1,91 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { BaseWindow } from './baseWindow';
import type { IControlWindow } from '../controlBar';
export class AddonSerializeWindow extends BaseWindow implements IControlWindow {
public readonly id = 'addon-serialize';
public readonly label = 'serialize';
private _serializeOutputPre: HTMLPreElement;
private _htmlSerializeOutputPre: HTMLPreElement;
private _htmlSerializeOutputResult: HTMLElement;
private _writeToTerminalCheckbox: HTMLInputElement;
public build(container: HTMLElement): void {
const wrapper = document.createElement('div');
// Serialize button
const serializeBtn = document.createElement('button');
serializeBtn.id = 'serialize';
serializeBtn.textContent = 'Serialize the content of terminal';
serializeBtn.addEventListener('click', () => this._serializeButtonHandler());
wrapper.appendChild(serializeBtn);
// Write to terminal checkbox
const writeLabel = document.createElement('label');
this._writeToTerminalCheckbox = document.createElement('input');
this._writeToTerminalCheckbox.type = 'checkbox';
this._writeToTerminalCheckbox.id = 'write-to-terminal';
writeLabel.appendChild(this._writeToTerminalCheckbox);
writeLabel.appendChild(document.createTextNode('Write back to terminal'));
wrapper.appendChild(writeLabel);
// Serialize output
const outputDiv = document.createElement('div');
this._serializeOutputPre = document.createElement('pre');
this._serializeOutputPre.id = 'serialize-output';
outputDiv.appendChild(this._serializeOutputPre);
wrapper.appendChild(outputDiv);
// HTML serialize button
const htmlSerializeBtn = document.createElement('button');
htmlSerializeBtn.id = 'htmlserialize';
htmlSerializeBtn.textContent = 'Serialize the content of terminal in HTML';
htmlSerializeBtn.addEventListener('click', () => this._htmlSerializeButtonHandler());
wrapper.appendChild(htmlSerializeBtn);
// HTML serialize result
this._htmlSerializeOutputResult = document.createElement('span');
this._htmlSerializeOutputResult.id = 'htmlserialize-output-result';
wrapper.appendChild(this._htmlSerializeOutputResult);
// HTML serialize output
const htmlOutputDiv = document.createElement('div');
this._htmlSerializeOutputPre = document.createElement('pre');
this._htmlSerializeOutputPre.id = 'htmlserialize-output';
htmlOutputDiv.appendChild(this._htmlSerializeOutputPre);
wrapper.appendChild(htmlOutputDiv);
container.appendChild(wrapper);
}
private _serializeButtonHandler(): void {
const output = this._addons.serialize.instance.serialize();
const outputString = JSON.stringify(output);
this._serializeOutputPre.innerText = outputString;
if (this._writeToTerminalCheckbox.checked) {
this._terminal.reset();
this._terminal.write(output);
}
}
private _htmlSerializeButtonHandler(): void {
const output = this._addons.serialize.instance.serializeAsHTML();
this._htmlSerializeOutputPre.innerText = output;
// Deprecated, but the most supported for now.
function listener(e: any): void {
e.clipboardData.setData('text/html', output);
e.preventDefault();
}
document.addEventListener('copy', listener);
document.execCommand('copy');
document.removeEventListener('copy', listener);
this._htmlSerializeOutputResult.innerText = 'Copied to clipboard';
}
}
@@ -0,0 +1,30 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { BaseWindow } from './baseWindow';
import type { IControlWindow } from '../controlBar';
export class AddonsWindow extends BaseWindow implements IControlWindow {
public readonly id = 'addons';
public readonly label = 'Addons';
private _addonsContainer: HTMLElement;
public build(container: HTMLElement): void {
// Description
const description = document.createElement('p');
description.textContent = 'Addons can be loaded and unloaded on a particular terminal to extend its functionality.';
container.appendChild(description);
// Addons container (checkboxes go here)
this._addonsContainer = document.createElement('div');
this._addonsContainer.id = 'addons-container';
container.appendChild(this._addonsContainer);
}
public get addonsContainer(): HTMLElement {
return this._addonsContainer;
}
}
@@ -0,0 +1,27 @@
/**
* Copyright (c) 2025 The xterm.js authors. All rights reserved.
* @license MIT
*/
import type { AddonCollection } from '../../types';
import type { IControlWindow } from '../controlBar';
import type { Terminal } from '@xterm/xterm';
export abstract class BaseWindow implements IControlWindow {
protected get _terminal(): Terminal { return this._terminalPrivate; }
constructor(
private _terminalPrivate: Terminal,
protected readonly _addons: AddonCollection,
) {
}
public setTerminal(terminal: Terminal): void {
this._terminalPrivate = terminal;
}
public abstract id: string;
public abstract label: string;
public abstract build(container: HTMLElement): void;
}
@@ -0,0 +1,270 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { BaseWindow } from './baseWindow';
import type { IControlWindow } from '../controlBar';
import type { IBufferCell } from '@xterm/xterm';
// Underline style values from common/buffer/Constants.ts
const enum UnderlineStyle {
NONE = 0,
SINGLE = 1,
DOUBLE = 2,
CURLY = 3,
DOTTED = 4,
DASHED = 5
}
// Internal interface for accessing extended attribute data
interface IAttributeDataInternal {
getUnderlineStyle(): number;
getUnderlineColor(): number;
isUnderlineColorDefault(): boolean;
isUnderlineColorPalette(): boolean;
isUnderlineColorRGB(): boolean;
}
export class CellInspectorWindow extends BaseWindow implements IControlWindow {
public readonly id = 'cell-inspector';
public readonly label = 'Cell Inspector';
private _container: HTMLElement;
private _positionEl: HTMLElement;
private _charEl: HTMLElement;
private _codeEl: HTMLElement;
private _widthEl: HTMLElement;
private _fgEl: HTMLElement;
private _bgEl: HTMLElement;
private _attrsEl: HTMLElement;
public build(container: HTMLElement): void {
this._container = container;
const dl = document.createElement('dl');
dl.style.fontFamily = 'monospace';
dl.style.fontSize = '12px';
this._positionEl = this._addRow(dl, 'Position');
this._charEl = this._addRow(dl, 'Character');
this._codeEl = this._addRow(dl, 'Codepoint');
this._widthEl = this._addRow(dl, 'Width');
this._fgEl = this._addRow(dl, 'Foreground');
this._bgEl = this._addRow(dl, 'Background');
this._attrsEl = this._addRow(dl, 'Attributes');
container.appendChild(dl);
// Add mouse move listener
this._setupMouseListener();
}
private _addRow(dl: HTMLElement, label: string): HTMLElement {
const dt = document.createElement('dt');
dt.textContent = label;
dt.style.fontWeight = 'bold';
dt.style.marginTop = '4px';
dl.appendChild(dt);
const dd = document.createElement('dd');
dd.textContent = '-';
dd.style.margin = '0 0 0 16px';
dl.appendChild(dd);
return dd;
}
private _setupMouseListener(): void {
const terminal = this._terminal;
if (!terminal.element) {
return;
}
const cell = terminal.buffer.active.getNullCell();
terminal.element.addEventListener('mousemove', (e: MouseEvent) => {
const core = (terminal as any)._core;
const coords = core._mouseService?.getCoords(e, core.screenElement, terminal.cols, terminal.rows);
if (!coords) {
this._clearDisplay();
return;
}
const x = coords[0] - 1;
const y = coords[1] - 1;
const bufferY = terminal.buffer.active.viewportY + y;
const line = terminal.buffer.active.getLine(bufferY);
if (!line) {
this._clearDisplay();
return;
}
const cellData = line.getCell(x, cell);
if (!cellData) {
this._clearDisplay();
return;
}
this._updateDisplay(x, y, bufferY, cellData);
});
terminal.element.addEventListener('mouseleave', () => {
this._clearDisplay();
});
}
private _clearDisplay(): void {
this._positionEl.textContent = '-';
this._charEl.textContent = '-';
this._codeEl.textContent = '-';
this._widthEl.textContent = '-';
this._fgEl.textContent = '-';
this._bgEl.textContent = '-';
this._attrsEl.textContent = '-';
}
private _updateDisplay(x: number, y: number, bufferY: number, cell: IBufferCell): void {
// Position
this._positionEl.textContent = `x=${x}, y=${y} (buffer: ${bufferY})`;
// Character
const chars = cell.getChars();
this._charEl.textContent = chars.length > 0 ? `"${chars}"` : '(empty)';
// Codepoint(s)
if (chars.length > 0) {
const codepoints = [...chars].map(c => {
const cp = c.codePointAt(0)!;
return `U+${cp.toString(16).toUpperCase().padStart(4, '0')}`;
});
this._codeEl.textContent = codepoints.join(' ');
} else {
this._codeEl.textContent = '(none)';
}
// Width
this._widthEl.textContent = cell.getWidth().toString();
// Foreground color
this._fgEl.textContent = this._formatFgColor(
cell.getFgColor(),
cell.isFgDefault(),
cell.isFgPalette(),
cell.isFgRGB()
);
// Background color
this._bgEl.textContent = this._formatBgColor(
cell.getBgColor(),
cell.isBgDefault(),
cell.isBgPalette(),
cell.isBgRGB()
);
// Attributes (SGR codes)
const attrs: string[] = [];
if (cell.isBold()) attrs.push('bold (1)');
if (cell.isDim()) attrs.push('dim (2)');
if (cell.isItalic()) attrs.push('italic (3)');
if (cell.isUnderline()) {
const cellData = cell as unknown as IAttributeDataInternal;
const style = cellData.getUnderlineStyle();
const styleName = this._getUnderlineStyleName(style);
attrs.push(`underline ${styleName} (4:${style})`);
// Show underline color if not default
if (!cellData.isUnderlineColorDefault()) {
const color = cellData.getUnderlineColor();
const colorStr = this._formatUnderlineColor(
color,
cellData.isUnderlineColorPalette(),
cellData.isUnderlineColorRGB()
);
attrs.push(`underline color: ${colorStr}`);
}
}
if (cell.isBlink()) attrs.push('blink (5)');
if (cell.isInverse()) attrs.push('inverse (7)');
if (cell.isInvisible()) attrs.push('invisible (8)');
if (cell.isStrikethrough()) attrs.push('strikethrough (9)');
if (cell.isOverline()) attrs.push('overline (53)');
this._attrsEl.textContent = attrs.length > 0 ? attrs.join(', ') : '(none)';
}
private _formatFgColor(color: number, isDefault: boolean, isPalette: boolean, isRGB: boolean): string {
if (isDefault) {
return 'default (39)';
}
if (isPalette) {
// SGR 30-37 for colors 0-7, 90-97 for colors 8-15, or 38;5;n for 0-255
let sgr: string;
if (color < 8) {
sgr = `${30 + color}`;
} else if (color < 16) {
sgr = `${90 + color - 8}`;
} else {
sgr = `38;5;${color}`;
}
return `palette(${color}) (${sgr})`;
}
if (isRGB) {
const r = (color >> 16) & 0xFF;
const g = (color >> 8) & 0xFF;
const b = color & 0xFF;
return `#${color.toString(16).toUpperCase().padStart(6, '0')} (38;2;${r};${g};${b})`;
}
return `unknown(${color})`;
}
private _formatBgColor(color: number, isDefault: boolean, isPalette: boolean, isRGB: boolean): string {
if (isDefault) {
return 'default (49)';
}
if (isPalette) {
// SGR 40-47 for colors 0-7, 100-107 for colors 8-15, or 48;5;n for 0-255
let sgr: string;
if (color < 8) {
sgr = `${40 + color}`;
} else if (color < 16) {
sgr = `${100 + color - 8}`;
} else {
sgr = `48;5;${color}`;
}
return `palette(${color}) (${sgr})`;
}
if (isRGB) {
const r = (color >> 16) & 0xFF;
const g = (color >> 8) & 0xFF;
const b = color & 0xFF;
return `#${color.toString(16).toUpperCase().padStart(6, '0')} (48;2;${r};${g};${b})`;
}
return `unknown(${color})`;
}
private _getUnderlineStyleName(style: UnderlineStyle): string {
switch (style) {
case UnderlineStyle.NONE: return 'none';
case UnderlineStyle.SINGLE: return 'single';
case UnderlineStyle.DOUBLE: return 'double';
case UnderlineStyle.CURLY: return 'curly';
case UnderlineStyle.DOTTED: return 'dotted';
case UnderlineStyle.DASHED: return 'dashed';
default: return 'unknown';
}
}
private _formatUnderlineColor(color: number, isPalette: boolean, isRGB: boolean): string {
if (isPalette) {
return `palette(${color}) (58;5;${color})`;
}
if (isRGB) {
const r = (color >> 16) & 0xFF;
const g = (color >> 8) & 0xFF;
const b = color & 0xFF;
return `#${color.toString(16).toUpperCase().padStart(6, '0')} (58;2;${r};${g};${b})`;
}
return `unknown(${color})`;
}
}
@@ -0,0 +1,51 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { BaseWindow } from './baseWindow';
import type { IControlWindow } from '../controlBar';
export class GpuWindow extends BaseWindow implements IControlWindow {
public readonly id = 'gpu';
public readonly label = 'WebGL';
private _textureAtlasContainer: HTMLElement;
public build(container: HTMLElement): void {
const zoomCheckbox = document.createElement('input');
zoomCheckbox.type = 'checkbox';
zoomCheckbox.id = 'texture-atlas-zoom';
container.appendChild(zoomCheckbox);
const zoomLabel = document.createElement('label');
zoomLabel.htmlFor = 'texture-atlas-zoom';
zoomLabel.textContent = 'Zoom texture atlas';
container.appendChild(zoomLabel);
this._textureAtlasContainer = document.createElement('div');
this._textureAtlasContainer.id = 'texture-atlas';
container.appendChild(this._textureAtlasContainer);
}
public setTextureAtlas(canvas: HTMLCanvasElement): void {
this._styleAtlasPage(canvas);
this._textureAtlasContainer.replaceChildren(canvas);
}
public appendTextureAtlas(canvas: HTMLCanvasElement): void {
this._styleAtlasPage(canvas);
this._textureAtlasContainer.appendChild(canvas);
}
public removeTextureAtlas(canvas: HTMLCanvasElement): void {
canvas.remove();
}
private _styleAtlasPage(canvas: HTMLCanvasElement): void {
// eslint-disable-next-line no-restricted-syntax
const dpr = window.devicePixelRatio;
canvas.style.width = `${canvas.width / dpr}px`;
canvas.style.height = `${canvas.height / dpr}px`;
}
}
@@ -0,0 +1,266 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { BaseWindow } from './baseWindow';
import type { Terminal, ITheme } from '@xterm/xterm';
import type { IControlWindow } from '../controlBar';
import type { AddonCollection } from 'types';
const xtermjsTheme: ITheme = Object.freeze({
foreground: '#F8F8F8',
background: '#2D2E2C',
selectionBackground: '#5DA5D533',
selectionInactiveBackground: '#555555AA',
black: '#1E1E1D',
brightBlack: '#262625',
red: '#CE5C5C',
brightRed: '#FF7272',
green: '#5BCC5B',
brightGreen: '#72FF72',
yellow: '#CCCC5B',
brightYellow: '#FFFF72',
blue: '#5D5DD3',
brightBlue: '#7279FF',
magenta: '#BC5ED1',
brightMagenta: '#E572FF',
cyan: '#5DA5D5',
brightCyan: '#72F0FF',
white: '#F8F8F8',
brightWhite: '#FFFFFF'
});
const sapphireTheme: ITheme = Object.freeze({
background: '#1c2431',
foreground: '#cccccc',
selectionBackground: '#399ef440',
black: '#666666',
blue: '#399ef4',
brightBlack: '#666666',
brightBlue: '#399ef4',
brightCyan: '#21c5c7',
brightGreen: '#4eb071',
brightMagenta: '#b168df',
brightRed: '#da6771',
brightWhite: '#efefef',
brightYellow: '#fff099',
cyan: '#21c5c7',
green: '#4eb071',
magenta: '#b168df',
red: '#da6771',
white: '#efefef',
yellow: '#fff099'
});
const lightTheme: ITheme = Object.freeze({
background: '#ffffff',
foreground: '#333333',
cursor: '#333333',
cursorAccent: '#ffffff',
selectionBackground: '#add6ff',
overviewRulerBorder: '#aaaaaa',
black: '#000000',
blue: '#0451a5',
brightBlack: '#666666',
brightBlue: '#0451a5',
brightCyan: '#0598bc',
brightGreen: '#14ce14',
brightMagenta: '#bc05bc',
brightRed: '#cd3131',
brightWhite: '#a5a5a5',
brightYellow: '#b5ba00',
cyan: '#0598bc',
green: '#00bc00',
magenta: '#bc05bc',
red: '#cd3131',
white: '#555555',
yellow: '#949800'
});
export class OptionsWindow extends BaseWindow implements IControlWindow {
public readonly id = 'options';
public readonly label = 'Options';
private _container: HTMLElement;
private _optionsContainer: HTMLElement;
private _autoResize: boolean = true;
constructor(
terminal: Terminal,
addons: AddonCollection,
private readonly _handlers: {
updateTerminalSize: () => void;
updateTerminalContainerBackground: () => void;
},
) {
super(terminal, addons);
}
public build(container: HTMLElement): void {
this._container = container;
const description = document.createElement('p');
description.innerHTML = 'These options can be set in the <code>Terminal</code> constructor or by using the <code>Terminal.options</code> property.';
container.appendChild(description);
this._optionsContainer = document.createElement('div');
this._optionsContainer.id = 'options-container';
container.appendChild(this._optionsContainer);
}
public initOptions(addDomListener: (el: HTMLElement, type: string, handler: (...args: any[]) => any) => void): void {
const blacklistedOptions = [
'cancelEvents',
'convertEol',
'termName',
'cols', 'rows',
'documentOverride',
'linkHandler',
'logger',
'overviewRuler',
'quirks',
'theme',
'windowOptions',
'windowsPty',
];
const stringOptions: { [key: string]: string[] | null } = {
cursorStyle: ['block', 'underline', 'bar'],
cursorInactiveStyle: ['outline', 'block', 'bar', 'underline', 'none'],
fontFamily: null,
fontWeight: ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
fontWeightBold: ['normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
logLevel: ['trace', 'debug', 'info', 'warn', 'error', 'off'],
theme: ['default', 'xtermjs', 'sapphire', 'light'],
wordSeparator: null,
colsRows: null
};
const options = Object.getOwnPropertyNames(this._terminal.options);
const booleanOptions: string[] = [];
const numberOptions: string[] = [];
options.filter(o => blacklistedOptions.indexOf(o) === -1).forEach(o => {
switch (typeof this._terminal.options[o]) {
case 'boolean':
booleanOptions.push(o);
break;
case 'number':
numberOptions.push(o);
break;
default:
if (Object.keys(stringOptions).indexOf(o) === -1 && numberOptions.indexOf(o) === -1 && booleanOptions.indexOf(o) === -1) {
console.warn(`Unrecognized option: "${o}"`);
}
}
});
let html = '';
html += '<div class="option-group">';
booleanOptions.forEach(o => {
html += `<div class="option"><label><input id="opt-${o}" type="checkbox" ${this._terminal.options[o] ? 'checked' : ''}/> ${o}</label></div>`;
});
html += '</div><div class="option-group">';
numberOptions.forEach(o => {
html += `<div class="option"><label>${o} <input id="opt-${o}" type="number" value="${this._terminal.options[o] ?? ''}" step="${o === 'lineHeight' || o === 'scrollSensitivity' ? '0.1' : '1'}"/></label></div>`;
});
html += '</div><div class="option-group">';
Object.keys(stringOptions).forEach(o => {
if (o === 'colsRows') {
html += `<div class="option"><label>size (<var>cols</var><code>x</code><var>rows</var> or <code>auto</code>) <input id="opt-${o}" type="text" value="auto"/></label></div>`;
} else if (stringOptions[o]) {
const selectedOption = o === 'theme' ? 'xtermjs' : this._terminal.options[o];
html += `<div class="option"><label>${o} <select id="opt-${o}">${stringOptions[o]!.map(v => `<option ${v === selectedOption ? 'selected' : ''}>${v}</option>`).join('')}</select></label></div>`;
} else {
html += `<div class="option"><label>${o} <input id="opt-${o}" type="text" value="${this._terminal.options[o]}"/></label></div>`;
}
});
html += '</div>';
this._optionsContainer.innerHTML = html;
// Attach listeners
booleanOptions.forEach(o => {
const input = document.getElementById(`opt-${o}`) as HTMLInputElement;
addDomListener(input, 'change', () => {
console.log('change', o, input.checked);
this._terminal.options[o] = input.checked;
if (o ==='allowTransparency') {
this._terminal.options.theme = this._getTheme();
this._handlers.updateTerminalContainerBackground();
}
});
});
numberOptions.forEach(o => {
const input = document.getElementById(`opt-${o}`) as HTMLInputElement;
addDomListener(input, 'change', () => {
console.log('change', o, input.value);
if (o === 'lineHeight') {
this._terminal.options.lineHeight = parseFloat(input.value);
} else if (o === 'scrollSensitivity') {
this._terminal.options.scrollSensitivity = parseFloat(input.value);
} else if (o === 'scrollback') {
this._terminal.options.scrollback = parseInt(input.value);
setTimeout(() => this._handlers.updateTerminalSize(), 5);
} else {
this._terminal.options[o] = parseInt(input.value);
}
this._handlers.updateTerminalSize();
});
});
Object.keys(stringOptions).forEach(o => {
const input = document.getElementById(`opt-${o}`) as HTMLInputElement;
addDomListener(input, 'change', () => {
console.log('change', o, input.value);
let value: any = input.value;
if (o === 'colsRows') {
const m = input.value.match(/^([0-9]+)x([0-9]+)$/);
if (m) {
this._autoResize = false;
this._terminal.resize(parseInt(m[1]), parseInt(m[2]));
} else {
this._autoResize = true;
input.value = 'auto';
this._handlers.updateTerminalSize();
}
} else if (o === 'theme') {
value = this._getTheme();
}
this._terminal.options[o] = value;
if (o === 'theme') {
this._handlers.updateTerminalContainerBackground();
}
if (o === 'fontFamily') {
this._handlers.updateTerminalSize();
}
});
});
}
public get autoResize(): boolean {
return this._autoResize;
}
public set autoResize(value: boolean) {
this._autoResize = value;
}
private _getTheme(): ITheme {
const input = document.querySelector<HTMLInputElement>('#opt-theme');
let theme: ITheme;
switch (input.value) {
case 'default':
theme = undefined;
break;
case 'xtermjs':
theme = { ...xtermjsTheme };
break;
case 'sapphire':
theme = { ...sapphireTheme };
break;
case 'light':
theme = { ...lightTheme };
break;
}
if (this._terminal.options.allowTransparency) {
theme.background = 'transparent';
}
return theme;
}
}
@@ -0,0 +1,36 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { BaseWindow } from './baseWindow';
import type { IControlWindow } from '../controlBar';
export class StyleWindow extends BaseWindow implements IControlWindow {
public readonly id = 'style';
public readonly label = 'Style';
private _paddingElement: HTMLInputElement;
public build(container: HTMLElement): void {
const wrapper = document.createElement('div');
wrapper.style.display = 'inline-block';
wrapper.style.marginRight = '16px';
const label = document.createElement('label');
label.htmlFor = 'padding';
label.textContent = 'Padding';
wrapper.appendChild(label);
this._paddingElement = document.createElement('input');
this._paddingElement.type = 'number';
this._paddingElement.id = 'padding';
wrapper.appendChild(this._paddingElement);
container.appendChild(wrapper);
}
public get paddingElement(): HTMLInputElement {
return this._paddingElement;
}
}
File diff suppressed because it is too large Load Diff
+82
View File
@@ -0,0 +1,82 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { BaseWindow } from './baseWindow';
import type { IControlWindow } from '../controlBar';
import type { Terminal } from '@xterm/xterm';
export class VtWindow extends BaseWindow implements IControlWindow {
public readonly id = 'vt';
public readonly label = 'VT';
private _container: HTMLElement;
private _term: Terminal | undefined;
public build(container: HTMLElement): void {
this._container = container;
const vtContainer = document.createElement('div');
vtContainer.id = 'vt-container';
container.appendChild(vtContainer);
const vtFragment = document.createDocumentFragment();
const buttonSpecs: { [key: string]: { label: string, description: string, paramCount?: number } } = {
'A': { label: 'CUU ↑', description: 'Cursor Up Ps Times' },
'B': { label: 'CUD ↓', description: 'Cursor Down Ps Times' },
'C': { label: 'CUF →', description: 'Cursor Forward Ps Times' },
'D': { label: 'CUB ←', description: 'Cursor Backward Ps Times' },
'E': { label: 'CNL', description: 'Cursor Next Line Ps Times' },
'F': { label: 'CPL', description: 'Cursor Preceding Line Ps Times' },
'G': { label: 'CHA', description: 'Cursor Character Absolute' },
'H': { label: 'CUP', description: 'Cursor Position [row;column]', paramCount: 2 },
'I': { label: 'CHT', description: 'Cursor Forward Tabulation Ps tab stops' },
'J': { label: 'ED', description: 'Erase in Display' },
'?|J': { label: 'DECSED', description: 'Erase in Display' },
'K': { label: 'EL', description: 'Erase in Line' },
'?|K': { label: 'DECSEL', description: 'Erase in Line' },
'L': { label: 'IL', description: 'Insert Ps Line(s)' },
'M': { label: 'DL', description: 'Delete Ps Line(s)' },
'P': { label: 'DCH', description: 'Delete Ps Character(s)' },
' q': { label: 'DECSCUSR', description: 'Set Cursor Style' },
'?2026h': { label: 'BSU', description: 'Begin synchronized update', paramCount: 0 },
'?2026l': { label: 'ESU', description: 'End synchronized update', paramCount: 0 }
};
for (const s of Object.keys(buttonSpecs)) {
const spec = buttonSpecs[s];
vtFragment.appendChild(this._createButton(spec.label, spec.description, s, spec.paramCount));
}
vtContainer.appendChild(vtFragment);
}
private _createButton(name: string, description: string, writeCsi: string, paramCount: number = 1): HTMLElement {
const inputs: HTMLInputElement[] = [];
for (let i = 0; i < paramCount; i++) {
const input = document.createElement('input');
input.type = 'number';
input.title = `Input #${i + 1}`;
inputs.push(input);
}
const element = document.createElement('button');
element.textContent = name;
const writeCsiSplit = writeCsi.split('|');
const prefix = writeCsiSplit.length === 2 ? writeCsiSplit[0] : '';
const suffix = writeCsiSplit[writeCsiSplit.length - 1];
element.addEventListener('click', () => this._term?.write(this._csi(`${prefix}${inputs.map(e => e.value).join(';')}${suffix}`)));
const desc = document.createElement('span');
desc.textContent = description;
const container = document.createElement('div');
container.classList.add('vt-button');
container.append(element, ...inputs, desc);
return container;
}
private _csi(e: string): string {
return `\x1b[${e}`;
}
}
@@ -0,0 +1,51 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { BaseWindow } from './baseWindow';
import type { IControlWindow } from '../controlBar';
export class WebglWindow extends BaseWindow implements IControlWindow {
public readonly id = 'addon-webgl';
public readonly label = 'webgl';
private _textureAtlasContainer: HTMLElement;
public build(container: HTMLElement): void {
const zoomCheckbox = document.createElement('input');
zoomCheckbox.type = 'checkbox';
zoomCheckbox.id = 'texture-atlas-zoom';
container.appendChild(zoomCheckbox);
const zoomLabel = document.createElement('label');
zoomLabel.htmlFor = 'texture-atlas-zoom';
zoomLabel.textContent = 'Zoom texture atlas';
container.appendChild(zoomLabel);
this._textureAtlasContainer = document.createElement('div');
this._textureAtlasContainer.id = 'texture-atlas';
container.appendChild(this._textureAtlasContainer);
}
public setTextureAtlas(canvas: HTMLCanvasElement): void {
this._styleAtlasPage(canvas);
this._textureAtlasContainer.replaceChildren(canvas);
}
public appendTextureAtlas(canvas: HTMLCanvasElement): void {
this._styleAtlasPage(canvas);
this._textureAtlasContainer.appendChild(canvas);
}
public removeTextureAtlas(canvas: HTMLCanvasElement): void {
canvas.remove();
}
private _styleAtlasPage(canvas: HTMLCanvasElement): void {
// eslint-disable-next-line no-restricted-syntax
const dpr = window.devicePixelRatio;
canvas.style.width = `${canvas.width / dpr}px`;
canvas.style.height = `${canvas.height / dpr}px`;
}
}
+29
View File
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2021",
"outDir": "../out-demo/client",
"rootDir": ".",
"sourceMap": true,
"baseUrl": ".",
"paths": {
"@xterm/addon-attach": ["../../addons/addon-attach"],
"@xterm/addon-clipboard": ["../../addons/addon-clipboard"],
"@xterm/addon-fit": ["../../addons/addon-fit"],
"@xterm/addon-image": ["../../addons/addon-image"],
"@xterm/addon-progress": ["../../addons/addon-progress"],
"@xterm/addon-search": ["../../addons/addon-search"],
"@xterm/addon-serialize": ["../../addons/addon-serialize"],
"@xterm/addon-web-fonts": ["../../addons/addon-web-fonts"],
"@xterm/addon-web-links": ["../../addons/addon-web-links"],
"@xterm/addon-webgl": ["../../addons/addon-webgl"],
"@xterm/addon-unicode11": ["../../addons/addon-unicode11"],
"@xterm/addon-unicode-graphemes": ["../../addons/addon-unicode-graphemes"],
"@xterm/addon-ligatures": ["../../addons/addon-ligatures"]
}
},
"include": [
"./**/*",
"../../typings/xterm.d.ts"
]
}
+58
View File
@@ -0,0 +1,58 @@
/**
* Copyright (c) 2018 The xterm.js authors. All rights reserved.
* @license MIT
*
* This file is the entry point for browserify.
*/
import type { ImageAddon } from '@xterm/addon-image';
import type { AttachAddon } from '@xterm/addon-attach';
import type { ClipboardAddon } from '@xterm/addon-clipboard';
import type { FitAddon } from '@xterm/addon-fit';
import type { LigaturesAddon } from '@xterm/addon-ligatures';
import type { ProgressAddon } from '@xterm/addon-progress';
import type { SearchAddon } from '@xterm/addon-search';
import type { SerializeAddon } from '@xterm/addon-serialize';
import type { UnicodeGraphemesAddon } from '@xterm/addon-unicode-graphemes';
import type { Unicode11Addon } from '@xterm/addon-unicode11';
import type { WebLinksAddon } from '@xterm/addon-web-links';
import type { WebglAddon } from '@xterm/addon-webgl';
export type AddonType = 'attach' | 'clipboard' | 'fit' | 'image' | 'progress' | 'search' | 'serialize' | 'unicode11' | 'unicodeGraphemes' | 'webLinks' | 'webgl' | 'ligatures';
export interface IDemoAddon<T extends AddonType> {
name: T;
canChange: boolean;
ctor: (
T extends 'attach' ? typeof AttachAddon :
T extends 'clipboard' ? typeof ClipboardAddon :
T extends 'fit' ? typeof FitAddon :
T extends 'image' ? typeof ImageAddon :
T extends 'ligatures' ? typeof LigaturesAddon :
T extends 'progress' ? typeof ProgressAddon :
T extends 'search' ? typeof SearchAddon :
T extends 'serialize' ? typeof SerializeAddon :
T extends 'webLinks' ? typeof WebLinksAddon :
T extends 'unicode11' ? typeof Unicode11Addon :
T extends 'unicodeGraphemes' ? typeof UnicodeGraphemesAddon :
T extends 'webgl' ? typeof WebglAddon :
never
);
instance?: (
T extends 'attach' ? AttachAddon :
T extends 'clipboard' ? ClipboardAddon :
T extends 'fit' ? FitAddon :
T extends 'image' ? ImageAddon :
T extends 'ligatures' ? LigaturesAddon :
T extends 'progress' ? ProgressAddon :
T extends 'search' ? SearchAddon :
T extends 'serialize' ? SerializeAddon :
T extends 'webLinks' ? WebLinksAddon :
T extends 'unicode11' ? Unicode11Addon :
T extends 'unicodeGraphemes' ? UnicodeGraphemesAddon :
T extends 'webgl' ? WebglAddon :
never
);
}
export type AddonCollection = { [T in AddonType]: IDemoAddon<T> };
+270
View File
@@ -0,0 +1,270 @@
/**
* Copyright (c) 2025 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { Terminal } from '@xterm/xterm';
export type UnicodeRangeDefinition = [
label: string,
start: number,
end: number,
reserved?: number[],
];
/**
* Write a unicode table to the terminal from start to end code points.
*
* Beware: Vibe coding ahead
*/
export function writeUnicodeTable(term: Terminal, name: string, start: number, end: number, definitions?: UnicodeRangeDefinition[]): void {
function bold(text: string): string {
return '\x1b[1m' + text + '\x1b[22m';
}
function faint(text: string): string {
return '\x1b[2m' + text + '\x1b[22m';
}
// Rotating colors: Red, Green, Yellow, Blue, Magenta, Cyan
const colors = [31, 32, 33, 34, 35, 36];
function color(text: string, colorIndex: number): string {
const c = colors[colorIndex % colors.length];
return '\x1b[' + c + 'm' + text + '\x1b[39m';
}
term.write('\n\r');
term.write('\n\r');
term.write(`${bold(name)} (${start.toString(16).toUpperCase()}-${end.toString(16).toUpperCase()})\n\r`);
term.write('\n\r');
term.write(bold(' 0 1 2 3 4 5 6 7 8 9 A B C D E F') + '\n\r');
const startRow = Math.floor(start / 16);
// Build a map of codepoint -> label and colorIndex for start positions
const labelStartMap = new Map<number, { label: string, colorIndex: number }>();
// Build a map of codepoint -> colorIndex for all codepoints in each range
const codePointColorMap = new Map<number, number>();
// Build a set of reserved codepoints
const reservedSet = new Set<number>();
let lastDefinitionEnd = start; // Track the last definition's end to stop printing there
if (definitions) {
for (let i = 0; i < definitions.length; i++) {
const [label, labelStart, labelEnd, reserved] = definitions[i];
labelStartMap.set(labelStart, { label, colorIndex: i });
// Map all codepoints in the range to this color
for (let cp = labelStart; cp <= labelEnd; cp++) {
codePointColorMap.set(cp, i);
}
// Track reserved codepoints
if (reserved) {
for (const cp of reserved) {
reservedSet.add(cp);
}
}
if (labelEnd > lastDefinitionEnd) {
lastDefinitionEnd = labelEnd;
}
}
}
const effectiveEnd = definitions ? lastDefinitionEnd : end;
const endRow = Math.floor(effectiveEnd / 16);
for (let row = startRow; row <= endRow; row++) {
// Collect labels for this row with their column positions and color
const rowLabels: { col: number, label: string, colorIndex: number }[] = [];
// Collect reserved codepoints for this row
const rowReserved: { col: number, colorIndex: number }[] = [];
for (let col = 0; col < 16; col++) {
const codePoint = row * 16 + col;
const labelInfo = labelStartMap.get(codePoint);
if (labelInfo) {
rowLabels.push({ col, label: labelInfo.label, colorIndex: labelInfo.colorIndex });
}
if (reservedSet.has(codePoint)) {
const charColorIndex = codePointColorMap.get(codePoint);
rowReserved.push({ col, colorIndex: charColorIndex ?? -1 });
}
}
// If labels exist and don't start at column 0, first output chars before first label
if (rowLabels.length > 0 && rowLabels[0].col > 0) {
const rowHex = row.toString(16).toUpperCase();
const rowPrefix = `U+${rowHex}x`.padEnd(8, ' ');
term.write(bold(rowPrefix));
for (let col = 0; col < rowLabels[0].col; col++) {
const codePoint = row * 16 + col;
term.write(' ');
if (codePoint >= start && codePoint <= end) {
const charColorIndex = codePointColorMap.get(codePoint);
const isReserved = reservedSet.has(codePoint);
let char = String.fromCodePoint(codePoint);
if (charColorIndex !== undefined) {
char = color(char, charColorIndex);
}
if (isReserved) {
char = faint(char);
}
term.write(char);
} else {
term.write(' ');
}
}
term.write('\n\r');
// Render reserved labels that appear before the first label (below the first part of row)
const earlyReserved = rowReserved.filter(r => r.col < rowLabels[0].col);
if (earlyReserved.length > 0) {
for (let i = earlyReserved.length - 1; i >= 0; i--) {
const prefix = ' '.repeat(8);
let line = '';
let visualLen = 0;
for (let col = 0; col < rowLabels[0].col; col++) {
const colPos = col * 2 + 1; // +1 to align with character position
const reservedAtCol = earlyReserved.findIndex(r => r.col === col);
if (reservedAtCol === i) {
const padding = ' '.repeat(colPos - visualLen);
const reservedItem = earlyReserved[i];
if (reservedItem.colorIndex >= 0) {
line += padding + color('└<reserved>', reservedItem.colorIndex);
} else {
line += padding + '└<reserved>';
}
break;
} else if (reservedAtCol !== -1 && reservedAtCol < i) {
const padding = ' '.repeat(colPos - visualLen);
const prevReserved = earlyReserved[reservedAtCol];
if (prevReserved.colorIndex >= 0) {
line += padding + color('│', prevReserved.colorIndex);
} else {
line += padding + '│';
}
visualLen = colPos + 1;
}
}
term.write(faint(prefix + line) + '\n\r');
}
}
}
// If labels exist, render them above the row
if (rowLabels.length > 0) {
// Render label lines from top to bottom (first label on top, last label closest to row)
for (let i = 0; i < rowLabels.length; i++) {
const prefix = ' '.repeat(8); // Same width as "U+1FB0x "
let line = '';
let visualLen = 0; // Track visual length separately from string length (escape codes don't count)
for (let col = 0; col < 16; col++) {
const colPos = col * 2; // Each char takes 2 positions (char + space)
const labelAtCol = rowLabels.findIndex(l => l.col === col);
if (labelAtCol === i) {
// This is where we show the label
const padding = ' '.repeat(colPos - visualLen);
line += padding + color('┌' + rowLabels[i].label, rowLabels[i].colorIndex);
break;
} else if (labelAtCol !== -1 && labelAtCol < i) {
// Show vertical line for labels that were already rendered above
const padding = ' '.repeat(colPos - visualLen);
line += padding + color('│', rowLabels[labelAtCol].colorIndex);
visualLen = colPos + 1;
}
}
term.write(faint(prefix + line) + '\n\r');
}
}
// Row prefix (e.g., "U+1FB0x ")
const rowHex = row.toString(16).toUpperCase();
const rowPrefix = `U+${rowHex}x`.padEnd(8, ' ');
const isSecondPrint = rowLabels.length > 0 && rowLabels[0].col > 0;
term.write(isSecondPrint ? ' '.repeat(rowPrefix.length) : bold(rowPrefix));
// Determine starting column (skip chars already output if we had labels not at col 0)
const startCol = isSecondPrint ? rowLabels[0].col : 0;
// Determine ending column (stop at effectiveEnd on the last row)
const endCol = (row === endRow) ? (effectiveEnd % 16) + 1 : 16;
// Pad for skipped columns
for (let col = 0; col < startCol; col++) {
term.write(' ');
}
// Characters in this row
for (let col = startCol; col < endCol; col++) {
const codePoint = row * 16 + col;
// Check if a label starts here
const labelInfo = labelStartMap.get(codePoint);
if (labelInfo) {
term.write(faint(color('└', labelInfo.colorIndex)));
} else {
term.write(' ');
}
if (codePoint >= start && codePoint <= effectiveEnd) {
// Color the character if it's part of a definition range
const charColorIndex = codePointColorMap.get(codePoint);
const isReserved = reservedSet.has(codePoint);
let char = String.fromCodePoint(codePoint);
if (charColorIndex !== undefined) {
char = color(char, charColorIndex);
}
if (isReserved) {
char = faint(char);
}
term.write(char);
} else {
term.write(' ');
}
}
term.write('\n\r');
// Render reserved labels that appear after the first label (below the row)
// Show one label per non-contiguous reserved range
const lateReserved = rowLabels.length > 0
? rowReserved.filter(r => r.col >= rowLabels[0].col)
: rowReserved;
if (lateReserved.length > 0) {
// Group contiguous reserved ranges
const reservedGroups: { startCol: number, colorIndex: number }[] = [];
for (let i = 0; i < lateReserved.length; i++) {
const curr = lateReserved[i];
const prev = lateReserved[i - 1];
// Start a new group if not contiguous (gap of more than 1 column)
if (i === 0 || curr.col > prev.col + 1) {
reservedGroups.push({ startCol: curr.col, colorIndex: curr.colorIndex });
}
}
// Render from bottom to top (last group at bottom with └, earlier groups with │)
for (let i = reservedGroups.length - 1; i >= 0; i--) {
const prefix = ' '.repeat(8);
let line = '';
let visualLen = 0;
for (let g = 0; g <= i; g++) {
const group = reservedGroups[g];
const colPos = group.startCol * 2 + 1;
const padding = ' '.repeat(colPos - visualLen);
if (g === i) {
// This is the label for this line
if (group.colorIndex >= 0) {
line += padding + color('└<reserved>', group.colorIndex);
} else {
line += padding + '└<reserved>';
}
} else {
// Vertical connector for groups below
if (group.colorIndex >= 0) {
line += padding + color('│', group.colorIndex);
} else {
line += padding + '│';
}
visualLen = colPos + 1;
}
}
term.write(faint(prefix + line) + '\n\r');
}
}
}
}
+182
View File
@@ -0,0 +1,182 @@
body {
font-family: helvetica, sans-serif, arial;
font-size: 1em;
color: #111;
margin: 0;
padding: 0;
height: 100vh;
display: grid;
grid-template-rows: 24px 1fr;
overflow: hidden;
}
#banner {
background: #161716;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 15px;
}
.banner-title {
color: #5DA5D5;
font-weight: bold;
font-size: 14px;
}
.banner-tabs {
display: flex;
gap: 2px;
}
.banner-tabs button {
background: transparent;
border: none;
color: #ccc;
padding: 4px 10px;
cursor: pointer;
font-size: 12px;
}
.banner-tabs button:hover {
background: rgba(255,255,255,0.1);
}
.banner-tabs button.active {
background: rgba(255,255,255,0.2);
color: #fff;
}
p {
font-size: 0.9em;
font-style: italic
}
dl:first-child,
p:first-child {
margin-top: 0;
}
#option-container {
display: flex;
justify-content: center;
}
.option-group {
display: inline-block;
padding-left: 20px;
vertical-align: top;
}
pre {
display: block;
padding: 9.5px;
font-size: 13px;
color: #c7254e;
background-color: #f9f2f4;
word-break: break-all;
word-wrap: break-word;
white-space: pre-wrap;
}
#container {
display: flex;
position: relative;
min-height: 0;
}
.grid {
flex: 1;
width: 100%;
min-width: 100px;
}
div:first-of-type.grid {
flex: 2;
height: 100%;
}
/* Sidebar */
#sidebar {
position: fixed;
top: 24px;
right: 15px; /* Room for scrollbar */
width: 400px;
max-width: calc(100vw - 30px); /* Don't exceed screen width minus scrollbar */
height: 500px;
background: #161716;
color: #fff;
border: 1px solid #333;
border-top: none;
box-shadow: 0 2px 10px rgba(0,0,0,0.4);
z-index: 1000;
overflow: auto;
flex: none;
opacity: 0.5;
transition: opacity 0.1s;
}
#sidebar:hover {
opacity: 1;
}
#sidebar.sidebar-hidden {
display: none;
}
/* Resize handles */
#sidebar-resize-handle-horizontal {
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 6px;
cursor: ew-resize;
background: transparent;
}
#sidebar-resize-handle-horizontal:hover {
background: rgba(0, 120, 212, 0.3);
}
#sidebar-resize-handle-vertical {
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 6px;
cursor: ns-resize;
background: transparent;
}
#sidebar-resize-handle-vertical:hover {
background: rgba(0, 120, 212, 0.3);
}
#sidebar-resize-handle-corner {
position: absolute;
left: 0;
bottom: 0;
width: 12px;
height: 12px;
cursor: nesw-resize;
background: transparent;
}
#sidebar-resize-handle-corner:hover {
background: rgba(0, 120, 212, 0.5);
}
/* Style the tab content */
.tabContent {
display: none;
padding: 6px 12px;
border-top: none;
}
#texture-atlas-zoom:checked ~ #texture-atlas canvas {
/* Zoom atlas to the width of the container*/
width: 100% !important;
height: auto !important;
}
#texture-atlas {
width: 100%;
}
#texture-atlas canvas {
image-rendering: pixelated;
border: 1px solid #ccc;
}
.vt-button * {
margin-right: 1em;
}
input#opt-cols_rows {
width: 6em;
}
+6 -149
View File
@@ -9,163 +9,20 @@
-->
<link rel="shortcut icon" type="image/png" href="/logo.png">
<link rel="stylesheet" href="/xterm.css" />
<link rel="stylesheet" href="/style.css" />
<link rel="stylesheet" href="/index.css" />
</head>
<body>
<h1 style="color: #2D2E2C">xterm.js: A terminal for the <em style="color: #5DA5D5">web</em></h1>
<div id="banner">
<span class="banner-title">xterm.js</span>
<div class="banner-tabs"></div>
</div>
<div id="container">
<div class="grid">
<div id="terminal-container"></div>
</div>
<div class="grid">
<div class="tab">
<button id="optionsbutton" class="tabLinks" onclick="openSection(event, 'options')">Options</button>
<button id="addonsbutton" class="tabLinks" onclick="openSection(event, 'addons')">Addons</button>
<button id="stylebutton" class="tabLinks" onclick="openSection(event, 'style')">Style</button>
<button id="testbutton" class="tabLinks" onclick="openSection(event, 'test')">Test</button>
<button id="vtbutton" class="tabLinks" onclick="openSection(event, 'vt')">VT</button>
</div>
<div id="options" class="tabContent">
<h3>Options</h3>
<p>These options can be set in the <code>Terminal</code> constructor or by using the <code>Terminal.options</code> property.</p>
<div id="options-container"></div>
</div>
<div id="addons" class="tabContent">
<h3>Addons</h3>
<p>Addons can be loaded and unloaded on a particular terminal to extend its functionality.</p>
<div id="addons-container"></div>
<h3>Addons Control</h3>
<h4>SearchAddon</h4>
<div style= "display:flex; flex-direction:column;">
<label>Find next <input id="find-next"/></label>
<label>Find previous <input id="find-previous"/></label>
<div>Results: <span id="find-results"></span></div>
<label><input type="checkbox" id="regex"/>Use regex</label>
<label><input type="checkbox" id="case-sensitive"/>Case sensitive</label>
<label><input type="checkbox" id="whole-word"/>Whole word</label>
<label><input type="checkbox" id="highlight-all-matches" checked/>Highlight All Matches</label>
</div>
<h4>SerializeAddon</h4>
<div>
<button id="serialize">Serialize the content of terminal</button>
<label><input type="checkbox" id="write-to-terminal">Write back to terminal</label>
<div><pre id="serialize-output"></pre></div>
<button id="htmlserialize">Serialize the content of terminal in HTML</button>
<span id="htmlserialize-output-result"></span>
<div><pre id="htmlserialize-output"></pre></div>
</div>
<h4>Image Addon</h4>
<details>
<summary>image addon settings</summary>
<div>
<label>Storage Limit (in MB) <input type="number" id="image-storagelimit"/></label><br/>
<label>Show Placeholder <input type="checkbox" id="image-showplaceholder"/></label>
<br/><br/>
<label>
Ctor options (applied on addon relaunch)<br/>
<textarea id="image-options" cols="40" rows="12"></textarea>
</label>
</div>
</details>
</div>
<div id="style" class="tabContent">
<h3>Style</h3>
<div style="display: inline-block; margin-right: 16px;">
<label for="padding">Padding</label>
<input type="number" id="padding" />
</div>
</div>
<div id="test" class="tabContent">
<h3>Test</h3>
<div style="display: inline-block; margin-right: 16px;">
<dl>
<dt>Lifecycle</dt>
<dd><button id="dispose" title="This is used to testing memory leaks">Dispose terminal</button></dd>
<dd><button id="create-new-window" title="This is used to test rendering in other windows">Create terminal in new window</button></dd>
<dt>Performance</dt>
<dd><button id="load-test" title="Write several MB of data to simulate a lot of data coming from the process">Load test</button></dd>
<dd><button id="load-test-long-lines" title="Write several MB of data with long lines to simulate a lot of data coming from the process">Load test (long lines)</button></dd>
<dd><button id="print-cjk" title="Prints the 20977 characters from the CJK Unified Ideographs unicode block">CJK Unified Ideographs</button></dd>
<dd><button id="print-cjk-sgr" title="Prints the 20977 characters from the CJK Unified Ideographs unicode block with randomized SGR attributes">CJK Unified Ideographs (random SGR)</button></dd>
<dt>Styles</dt>
<dd><button id="custom-glyph" title="Write custom box drawing and block element characters to the terminal">Test custom glyphs</button></dd>
<dd><button id="powerline-symbol-test" title="Write powerline symbol characters to the terminal (\ue0a0+)">Powerline symbol test</button></dd>
<dd><button id="underline-test" title="Write text with Kitty's extended underline sequences">Underline test</button></dd>
<dd><button id="sgr-test" title="Write text with SGR attribute">SGR test</button></dd>
<dd><button id="ansi-colors" title="Write a wide range of ansi colors">Ansi colors test</button></dd>
<dd><button id="osc-hyperlinks" title="Write some OSC 8 hyperlinks">Ansi hyperlinks test</button></dd>
<dd><button id="bce" title="Test colored erase">Colored Erase (BCE)</button></dd>
<dd><button id="add-grapheme-clusters" title="Write grapheme cluster test strings">Grapheme clusters</button></dd>
<dt>Decorations</dt>
<dd><button id="add-decoration" title="Add a decoration to the terminal">Decoration</button></dd>
<dd><button id="add-overview-ruler" title="Add an overview ruler to the terminal">Add Overview Ruler</button></dd>
<dd><button id="decoration-stress-test" title="Toggle between adding and removing a decoration to each line">Stress Test</button></dd>
<dt>Weblinks Addon</dt>
<dd><button id="weblinks-test" title="Various url conditions from demo data, hover&click to test">Test URLs</button></dd>
<dt>Image Test</dt>
<dd><button id="image-demo1">snake (sixel)</button></dd>
<dd><button id="image-demo2">oranges (sixel)</button></dd>
<dd><button id="image-demo3">palette (iip)</button></dd>
<dt>Events Test</dt>
<dd><button id="event-focus">focus</button></dd>
<dd><button id="event-blur">blur</button></dd>
<dt>Webfonts</dt>
<dd><button id="webfont-kongtext">The future is near! (from JS)</button></dd>
<dd><button id="webfont-bpdots">BPdots (from CSS)</button></dd>
</dl>
</div>
</div>
<div id="vt" class="tabContent">
<h3>VT</h3>
<div id="vt-container"></div>
</div>
<div id="sidebar" class="grid">
</div>
</div>
<div id="texture-atlas-container">
<input type="checkbox" id="texture-atlas-zoom"/>
<label for="texture-atlas-zoom">Zoom texture atlas</label>
<div id="texture-atlas"></div>
</div>
<script src="dist/client-bundle.js" defer ></script>
<script>
var tab = localStorage.getItem("tab");
if(tab === null){
document.getElementById("options").style.display = "block";
document.getElementById("optionsbutton").classList.add("active");
}
else {
const tabContent = document.getElementsByClassName("tabContent");
let itr;
for (itr = 0; itr < tabContent.length; itr+=1) {
tabContent[itr].style.display = "none";
}
document.getElementById(""+tab+"").style.display = "block";
document.getElementById(""+tab+"button").classList.add("active");
}
function openSection(event, section) {
const tabContent = document.getElementsByClassName("tabContent");
let itr;
for (itr = 0; itr < tabContent.length; itr+=1) {
tabContent[itr].style.display = "none";
}
const tabLinks = document.getElementsByClassName("tabLinks");
for (itr = 0; itr < tabLinks.length; itr+=1) {
tabLinks[itr].className = tabLinks[itr].className.replace(" active", "");
}
document.getElementById(section).style.display = "block";
localStorage.setItem("tab", section);
event.currentTarget.className += " active";
}
</script>
</body>
</html>
+40 -36
View File
@@ -2,59 +2,63 @@
* WARNING: This demo is a barebones implementation designed for development and evaluation
* purposes only. It is definitely NOT production ready and does not aim to be so. Exposing the
* demo to the public as is would introduce security risks for the host.
**/
*/
// @ts-check
import express from 'express';
import expressWs from 'express-ws';
import * as os from 'os';
import * as pty from 'node-pty';
import * as path from 'path';
import type { IPty } from 'node-pty';
const express = require('express');
const expressWs = require('express-ws');
const os = require('os');
const pty = require('node-pty');
interface IDisposable {
dispose(): void;
}
/** Whether to use binary transport. */
const USE_BINARY = os.platform() !== "win32";
const USE_BINARY = os.platform() !== 'win32';
function startServer() {
const demoRoot = path.join(__dirname, '..');
function startServer(): void {
const app = express();
const appWs = expressWs(app).app;
const terminals = {};
const unsentOutput = {};
const temporaryDisposable = {};
const terminals: { [pid: number]: IPty } = {};
const unsentOutput: { [pid: number]: string } = {};
const temporaryDisposable: { [pid: number]: IDisposable } = {};
app.use('/xterm.css', express.static(__dirname + '/../css/xterm.css'));
app.use('/xterm.css', express.static(demoRoot + '/../css/xterm.css'));
app.get('/logo.png', (req, res) => {
res.sendFile(__dirname + '/logo.png');
res.sendFile(demoRoot + '/logo.png');
});
app.get('/', (req, res) => {
res.sendFile(__dirname + '/index.html');
res.sendFile(demoRoot + '/index.html');
});
app.get('/test', (req, res) => {
res.sendFile(__dirname + '/test.html');
res.sendFile(demoRoot + '/test.html');
});
app.get('/style.css', (req, res) => {
res.sendFile(__dirname + '/style.css');
app.get('/index.css', (req, res) => {
res.sendFile(demoRoot + '/index.css');
});
app.get('/kongtext.regular.ttf', (req, res) => res.sendFile(__dirname + '/kongtext.regular.ttf'));
app.get('/bpdots.regular.otf', (req, res) => res.sendFile(__dirname + '/bpdots.regular.otf'));
app.get('/kongtext.regular.ttf', (req, res) => res.sendFile(demoRoot + '/kongtext.regular.ttf'));
app.get('/bpdots.regular.otf', (req, res) => res.sendFile(demoRoot + '/bpdots.regular.otf'));
app.use('/dist', express.static(__dirname + '/dist'));
app.use('/src', express.static(__dirname + '/src'));
app.use('/dist', express.static(demoRoot + '/dist'));
app.use('/src', express.static(demoRoot + '/src'));
app.post('/terminals', (req, res) => {
/** @type {{ [key: string]: string }} */
const env = {};
const env: { [key: string]: string } = {};
for (const k of Object.keys(process.env)) {
const v = process.env[k];
if (v) {
env[k] = v;
}
}
// const env = Object.assign({}, process.env);
env['COLORTERM'] = 'truecolor';
if (typeof req.query.cols !== 'string' || typeof req.query.rows !== 'string') {
console.error({ req });
@@ -63,7 +67,7 @@ function startServer() {
const cols = parseInt(req.query.cols);
const rows = parseInt(req.query.rows);
const isWindows = process.platform === 'win32';
const term = pty.spawn(isWindows ? 'pwsh.exe' : 'bash', [], {
const term = pty.spawn(isWindows ? 'powershell.exe' : 'bash', [], {
name: 'xterm-256color',
cols: cols ?? 80,
rows: rows ?? 24,
@@ -111,10 +115,10 @@ function startServer() {
let userInput = false;
// string message buffering
function buffer(socket, timeout, maxSize) {
function buffer(socket: typeof ws, timeout: number, maxSize: number) {
let s = '';
let sender = null;
return (data) => {
let sender: ReturnType<typeof setTimeout> | null = null;
return (data: string) => {
s += data;
if (s.length > maxSize || userInput) {
userInput = false;
@@ -134,11 +138,11 @@ function startServer() {
};
}
// binary message buffering
function bufferUtf8(socket, timeout, maxSize) {
const chunks = [];
function bufferUtf8(socket: typeof ws, timeout: number, maxSize: number) {
const chunks: Buffer[] = [];
let length = 0;
let sender = null;
return (data) => {
let sender: ReturnType<typeof setTimeout> | null = null;
return (data: Buffer) => {
chunks.push(data);
length += data.length;
if (length > maxSize || userInput) {
@@ -167,13 +171,13 @@ function startServer() {
// the problem and how to implement flow control at https://xtermjs.org/docs/guides/flowcontrol/
term.onData(function(data) {
try {
send(data);
} catch (ex) {
send(data as string & Buffer);
} catch {
// The WebSocket is not open, ignore
}
});
ws.on('message', function(msg) {
term.write(msg);
term.write(msg.toString());
userInput = true;
});
ws.on('close', function () {
@@ -199,4 +203,4 @@ process.on('uncaughtException', (error) => {
}
});
module.exports = startServer;
export default startServer;
+13
View File
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2021",
"outDir": "../out-demo/server",
"rootDir": ".",
"sourceMap": true,
"esModuleInterop": true
},
"include": [
"./**/*",
]
}
+1 -1
View File
@@ -5,6 +5,6 @@
// @ts-check
const startServer = require('./server.js');
const startServer = require('./dist/server-bundle.js').default;
startServer();
-113
View File
@@ -1,113 +0,0 @@
body {
font-family: helvetica, sans-serif, arial;
font-size: 1em;
color: #111;
}
h1 {
text-align: center;
}
#terminal-container {
height: 60%;
margin: 0 auto;
padding: 2px;
}
p {
font-size: 0.9em;
font-style: italic
}
#option-container {
display: flex;
justify-content: center;
}
.option-group {
display: inline-block;
padding-left: 20px;
vertical-align: top;
}
pre {
display: block;
padding: 9.5px;
font-size: 13px;
color: #c7254e;
background-color: #f9f2f4;
word-break: break-all;
word-wrap: break-word;
white-space: pre-wrap;
}
#container {
display: flex;
}
.grid {
flex: 1;
/* max-height: 80vh;
overflow-y: auto; */
width: 100%;
min-width: 100px;
}
div:first-of-type.grid {
flex: 2;
height: 60vh;
}
.tab {
overflow: hidden;
border: 1px solid #ccc;
background-color: #f1f1f1;
}
/* Style the buttons inside the tab */
.tab button {
background-color: inherit;
float: left;
border: none;
outline: none;
cursor: pointer;
padding: 14px 16px;
transition: 0.3s;
font-size: 17px;
}
/* Change background color of buttons on hover */
.tab button:hover {
background-color: #ddd;
}
/* Create an active/current tablink class */
.tab button.active {
background-color: #ccc;
}
/* Style the tab content */
.tabContent {
display: none;
padding: 6px 12px;
border: 1px solid #ccc;
border-top: none;
}
#texture-atlas-zoom:checked + label + #texture-atlas canvas {
/* Zoom atlas to the width of the container*/
width: 100% !important;
height: auto !important;
}
#texture-atlas {
width: 100%;
}
#texture-atlas canvas {
image-rendering: pixelated;
border: 1px solid #ccc;
}
.vt-button * {
margin-right: 1em;
}
input#opt-cols_rows {
width: 6em;
}
+13 -2
View File
@@ -3,9 +3,20 @@
<head>
<title>xterm.js integration test fixture</title>
<link rel="stylesheet" href="/xterm.css" />
<link rel="stylesheet" href="/style.css" />
<style>
body {
font-family: helvetica, sans-serif, arial;
font-size: 1em;
color: #111;
}
#terminal-container {
height: 60%;
margin: 0 auto;
padding: 2px;
}
</style>
</head>
<body>
<body id="test">
<div id="terminal-container"></div>
<script src="/dist/client-bundle.js" defer></script>
</body>
+5 -25
View File
@@ -1,27 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2021",
"rootDir": ".",
"sourceMap": true,
"baseUrl": ".",
"paths": {
"@xterm/addon-attach": ["../addons/addon-attach"],
"@xterm/addon-clipboard": ["../addons/addon-clipboard"],
"@xterm/addon-fit": ["../addons/addon-fit"],
"@xterm/addon-image": ["../addons/addon-image"],
"@xterm/addon-search": ["../addons/addon-search"],
"@xterm/addon-serialize": ["../addons/addon-serialize"],
"@xterm/addon-web-fonts": ["../addons/addon-web-fonts"],
"@xterm/addon-web-links": ["../addons/addon-web-links"],
"@xterm/addon-webgl": ["../addons/addon-webgl"],
"@xterm/addon-unicode11": ["../addons/addon-unicode11"],
"@xterm/addon-unicode-graphemes": ["../addons/addon-unicode-graphemes"],
"@xterm/addon-ligatures": ["../addons/addon-ligatures"]
}
},
"include": [
"client.ts",
"../typings/xterm.d.ts"
]
"references": [
{ "path": "./client" },
{ "path": "./server" }
],
"files": []
}