@xterm/xterm 5.6.0-beta.39 → 5.6.0-beta.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@xterm/xterm",
3
3
  "description": "Full xterm terminal, in your browser",
4
- "version": "5.6.0-beta.39",
4
+ "version": "5.6.0-beta.40",
5
5
  "main": "lib/xterm.js",
6
+ "module": "lib/xterm.mjs",
6
7
  "style": "css/xterm.css",
7
8
  "types": "typings/xterm.d.ts",
8
9
  "repository": "https://github.com/xtermjs/xterm.js",
@@ -23,36 +24,46 @@
23
24
  "xterm"
24
25
  ],
25
26
  "scripts": {
26
- "prepackage": "npm run build",
27
- "package": "webpack",
28
- "package-headless": "webpack --config ./webpack.config.headless.js",
29
- "postpackage-headless": "node ./bin/package_headless.js",
27
+ "setup": "npm run build",
28
+ "presetup": "npm run install-addons",
29
+ "install-addons": "node ./bin/install-addons.js",
30
30
  "start": "node demo/start",
31
- "start-server-only": "node demo/start-server-only",
32
31
  "build-demo": "webpack --config ./demo/webpack.config.js",
33
- "lint": "eslint -c .eslintrc.json --max-warnings 0 --ext .ts src/ addons/",
34
- "lint-api": "eslint --no-eslintrc -c .eslintrc.json.typings --max-warnings 0 --no-ignore --ext .d.ts typings/",
32
+ "build": "npm run tsc",
33
+ "watch": "npm run tsc-watch",
34
+ "tsc": "tsc -b ./tsconfig.all.json",
35
+ "tsc-watch": "tsc -b -w ./tsconfig.all.json --preserveWatchOutput",
36
+ "esbuild": "node bin/esbuild_all.mjs",
37
+ "esbuild-watch": "node bin/esbuild_all.mjs --watch",
38
+ "esbuild-package": "node bin/esbuild_all.mjs --prod",
39
+ "esbuild-package-watch": "node bin/esbuild_all.mjs --prod --watch",
40
+ "esbuild-package-headless-only": "node bin/esbuild.mjs --prod --headless",
41
+ "esbuild-demo": "node bin/esbuild.mjs --demo-client",
42
+ "esbuild-demo-watch": "node bin/esbuild.mjs --demo-client --watch",
35
43
  "test": "npm run test-unit",
36
44
  "posttest": "npm run lint",
45
+ "lint": "eslint -c .eslintrc.json --max-warnings 0 --ext .ts src/ addons/",
46
+ "lint-api": "eslint --no-eslintrc -c .eslintrc.json.typings --max-warnings 0 --no-ignore --ext .d.ts typings/",
47
+ "test-unit": "node ./bin/test.js",
48
+ "test-unit-coverage": "node ./bin/test.js --coverage",
49
+ "test-unit-dev": "cross-env NODE_PATH='./out' mocha",
37
50
  "test-integration": "node ./bin/test_playwright.js --workers=75%",
38
51
  "test-integration-chromium": "node ./bin/test_playwright.js --workers=75% \"--project=ChromeStable\"",
39
52
  "test-integration-firefox": "node ./bin/test_playwright.js --workers=75% \"--project=FirefoxStable\"",
40
53
  "test-integration-webkit": "node ./bin/test_playwright.js --workers=75% \"--project=WebKit\"",
41
54
  "test-integration-debug": "node ./bin/test_playwright.js --workers=1 --headed --timeout=30000",
42
- "test-unit": "node ./bin/test.js",
43
- "test-unit-coverage": "node ./bin/test.js --coverage",
44
- "test-unit-dev": "cross-env NODE_PATH='./out' mocha",
45
- "build": "tsc -b ./tsconfig.all.json",
46
- "install-addons": "node ./bin/install-addons.js",
47
- "presetup": "npm run install-addons",
48
- "setup": "npm run build",
49
- "prepublishOnly": "npm run package",
50
- "watch": "tsc -b -w ./tsconfig.all.json --preserveWatchOutput",
51
55
  "benchmark": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json",
52
- "benchmark-baseline": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --baseline out-test/benchmark/test/benchmark/*benchmark.js",
53
- "benchmark-eval": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --eval out-test/benchmark/test/benchmark/*benchmark.js",
56
+ "benchmark-baseline": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --baseline out-tsc/test-benchmark/test/benchmark/*benchmark.js",
57
+ "benchmark-eval": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --eval out-tsc/test-benchmark/test/benchmark/*benchmark.js",
54
58
  "clean": "rm -rf lib out addons/*/lib addons/*/out",
55
- "vtfeatures": "node bin/extract_vtfeatures.js src/**/*.ts src/*.ts"
59
+ "vtfeatures": "node bin/extract_vtfeatures.js src/**/*.ts src/*.ts",
60
+ "prepackage": "npm run build",
61
+ "package": "webpack",
62
+ "postpackage": "npm run esbuild-package",
63
+ "prepackage-headless": "npm run esbuild-package-headless-only",
64
+ "package-headless": "webpack --config ./webpack.config.headless.js",
65
+ "postpackage-headless": "node ./bin/package_headless.js",
66
+ "prepublishOnly": "npm run package"
56
67
  },
57
68
  "devDependencies": {
58
69
  "@lunapaint/png-codec": "^0.2.0",
@@ -75,6 +86,7 @@
75
86
  "chai": "^4.3.4",
76
87
  "cross-env": "^7.0.3",
77
88
  "deep-equal": "^2.0.5",
89
+ "esbuild": "^0.23.0",
78
90
  "eslint": "^8.56.0",
79
91
  "eslint-plugin-jsdoc": "^46.9.1",
80
92
  "express": "^4.19.2",
@@ -151,7 +151,7 @@ export class AccessibilityManager extends Disposable {
151
151
  if (char === '\n') {
152
152
  this._liveRegionLineCount++;
153
153
  if (this._liveRegionLineCount === MAX_ROWS_TO_READ + 1) {
154
- this._liveRegion.textContent += Strings.tooMuchOutput;
154
+ this._liveRegion.textContent += Strings.tooMuchOutput.get();
155
155
  }
156
156
  }
157
157
  }
@@ -59,7 +59,7 @@ import { WindowsOptionsReportType } from '../common/InputHandler';
59
59
  import { AccessibilityManager } from './AccessibilityManager';
60
60
  import { LinkProviderService } from 'browser/services/LinkProviderService';
61
61
 
62
- export class Terminal extends CoreTerminal implements ITerminal {
62
+ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
63
63
  public textarea: HTMLTextAreaElement | undefined;
64
64
  public element: HTMLElement | undefined;
65
65
  public screenElement: HTMLElement | undefined;
@@ -443,7 +443,7 @@ export class Terminal extends CoreTerminal implements ITerminal {
443
443
 
444
444
  this.textarea = this._document.createElement('textarea');
445
445
  this.textarea.classList.add('xterm-helper-textarea');
446
- this.textarea.setAttribute('aria-label', Strings.promptLabel);
446
+ this.textarea.setAttribute('aria-label', Strings.promptLabel.get());
447
447
  if (!Browser.isChromeOS) {
448
448
  // ChromeVox on ChromeOS does not like this. See
449
449
  // https://issuetracker.google.com/issues/260170397
@@ -5,8 +5,19 @@
5
5
 
6
6
  // This file contains strings that get exported in the API so they can be localized
7
7
 
8
- // eslint-disable-next-line prefer-const
9
- export let promptLabel = 'Terminal input';
8
+ let promptLabelInternal = 'Terminal input';
9
+ const promptLabel = {
10
+ get: () => promptLabelInternal,
11
+ set: (value: string) => promptLabelInternal = value
12
+ };
10
13
 
11
- // eslint-disable-next-line prefer-const
12
- export let tooMuchOutput = 'Too much output to announce, navigate to rows manually to read';
14
+ let tooMuchOutputInternal = 'Too much output to announce, navigate to rows manually to read';
15
+ const tooMuchOutput = {
16
+ get: () => tooMuchOutputInternal,
17
+ set: (value: string) => tooMuchOutputInternal = value
18
+ };
19
+
20
+ export {
21
+ promptLabel,
22
+ tooMuchOutput
23
+ };
@@ -7,6 +7,7 @@ import { IEvent } from 'common/EventEmitter';
7
7
  import { CharData, IColor, ICoreTerminal, ITerminalOptions } from 'common/Types';
8
8
  import { IBuffer } from 'common/buffer/Types';
9
9
  import { IDisposable, Terminal as ITerminalApi } from '@xterm/xterm';
10
+ import { channels, css } from 'common/Color';
10
11
 
11
12
  /**
12
13
  * A portion of the public API that are implemented identially internally and simply passed through.
@@ -172,3 +173,51 @@ export interface IRenderDebouncerWithCallback extends IRenderDebouncer {
172
173
  export interface IBufferElementProvider {
173
174
  provideBufferElements(): DocumentFragment | HTMLElement;
174
175
  }
176
+
177
+ // An IIFE to generate DEFAULT_ANSI_COLORS.
178
+ export const DEFAULT_ANSI_COLORS = Object.freeze((() => {
179
+ const colors = [
180
+ // dark:
181
+ css.toColor('#2e3436'),
182
+ css.toColor('#cc0000'),
183
+ css.toColor('#4e9a06'),
184
+ css.toColor('#c4a000'),
185
+ css.toColor('#3465a4'),
186
+ css.toColor('#75507b'),
187
+ css.toColor('#06989a'),
188
+ css.toColor('#d3d7cf'),
189
+ // bright:
190
+ css.toColor('#555753'),
191
+ css.toColor('#ef2929'),
192
+ css.toColor('#8ae234'),
193
+ css.toColor('#fce94f'),
194
+ css.toColor('#729fcf'),
195
+ css.toColor('#ad7fa8'),
196
+ css.toColor('#34e2e2'),
197
+ css.toColor('#eeeeec')
198
+ ];
199
+
200
+ // Fill in the remaining 240 ANSI colors.
201
+ // Generate colors (16-231)
202
+ const v = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff];
203
+ for (let i = 0; i < 216; i++) {
204
+ const r = v[(i / 36) % 6 | 0];
205
+ const g = v[(i / 6) % 6 | 0];
206
+ const b = v[i % 6];
207
+ colors.push({
208
+ css: channels.toCss(r, g, b),
209
+ rgba: channels.toRgba(r, g, b)
210
+ });
211
+ }
212
+
213
+ // Generate greys (232-255)
214
+ for (let i = 0; i < 24; i++) {
215
+ const c = 8 + i * 10;
216
+ colors.push({
217
+ css: channels.toCss(c, c, c),
218
+ rgba: channels.toRgba(c, c, c)
219
+ });
220
+ }
221
+
222
+ return colors;
223
+ })());
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import * as Strings from 'browser/LocalizableStrings';
7
- import { Terminal as TerminalCore } from 'browser/Terminal';
7
+ import { CoreBrowserTerminal as TerminalCore } from 'browser/CoreBrowserTerminal';
8
8
  import { IBufferRange, ITerminal } from 'browser/Types';
9
9
  import { IEvent } from 'common/EventEmitter';
10
10
  import { Disposable } from 'common/Lifecycle';
@@ -247,7 +247,13 @@ export class Terminal extends Disposable implements ITerminalApi {
247
247
  this._addonManager.loadAddon(this, addon);
248
248
  }
249
249
  public static get strings(): ILocalizableStrings {
250
- return Strings;
250
+ // A wrapper is required here because esbuild prevents setting an `export let`
251
+ return {
252
+ get promptLabel(): string { return Strings.promptLabel.get(); },
253
+ set promptLabel(value: string) { Strings.promptLabel.set(value); },
254
+ get tooMuchOutput(): string { return Strings.tooMuchOutput.get(); },
255
+ set tooMuchOutput(value: string) { Strings.tooMuchOutput.set(value); }
256
+ };
251
257
  }
252
258
 
253
259
  private _verifyIntegers(...values: number[]): void {
@@ -5,8 +5,8 @@
5
5
 
6
6
  import { ColorContrastCache } from 'browser/ColorContrastCache';
7
7
  import { IThemeService } from 'browser/services/Services';
8
- import { IColorContrastCache, IColorSet, ReadonlyColorSet } from 'browser/Types';
9
- import { channels, color, css, NULL_COLOR } from 'common/Color';
8
+ import { DEFAULT_ANSI_COLORS, IColorContrastCache, IColorSet, ReadonlyColorSet } from 'browser/Types';
9
+ import { color, css, NULL_COLOR } from 'common/Color';
10
10
  import { EventEmitter } from 'common/EventEmitter';
11
11
  import { Disposable } from 'common/Lifecycle';
12
12
  import { IOptionsService, ITheme } from 'common/services/Services';
@@ -29,54 +29,6 @@ const DEFAULT_SELECTION = {
29
29
  rgba: 0xFFFFFF4D
30
30
  };
31
31
 
32
- // An IIFE to generate DEFAULT_ANSI_COLORS.
33
- export const DEFAULT_ANSI_COLORS = Object.freeze((() => {
34
- const colors = [
35
- // dark:
36
- css.toColor('#2e3436'),
37
- css.toColor('#cc0000'),
38
- css.toColor('#4e9a06'),
39
- css.toColor('#c4a000'),
40
- css.toColor('#3465a4'),
41
- css.toColor('#75507b'),
42
- css.toColor('#06989a'),
43
- css.toColor('#d3d7cf'),
44
- // bright:
45
- css.toColor('#555753'),
46
- css.toColor('#ef2929'),
47
- css.toColor('#8ae234'),
48
- css.toColor('#fce94f'),
49
- css.toColor('#729fcf'),
50
- css.toColor('#ad7fa8'),
51
- css.toColor('#34e2e2'),
52
- css.toColor('#eeeeec')
53
- ];
54
-
55
- // Fill in the remaining 240 ANSI colors.
56
- // Generate colors (16-231)
57
- const v = [0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff];
58
- for (let i = 0; i < 216; i++) {
59
- const r = v[(i / 36) % 6 | 0];
60
- const g = v[(i / 6) % 6 | 0];
61
- const b = v[i % 6];
62
- colors.push({
63
- css: channels.toCss(r, g, b),
64
- rgba: channels.toRgba(r, g, b)
65
- });
66
- }
67
-
68
- // Generate greys (232-255)
69
- for (let i = 0; i < 24; i++) {
70
- const c = 8 + i * 10;
71
- colors.push({
72
- css: channels.toCss(c, c, c),
73
- rgba: channels.toRgba(c, c, c)
74
- });
75
- }
76
-
77
- return colors;
78
- })());
79
-
80
32
  export class ThemeService extends Disposable implements IThemeService {
81
33
  public serviceBrand: undefined;
82
34