groove-dev 0.16.1 → 0.16.3
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/node_modules/@groove-dev/daemon/src/index.js +25 -7
- package/node_modules/@groove-dev/daemon/src/terminal-pty.js +141 -0
- package/node_modules/@groove-dev/gui/dist/assets/{index-Gfb8Zxy9.css → index-BhjOFLBc.css} +32 -1
- package/node_modules/@groove-dev/gui/dist/assets/index-CFeltwTB.js +153 -0
- package/node_modules/@groove-dev/gui/dist/index.html +2 -2
- package/node_modules/@groove-dev/gui/package.json +3 -0
- package/node_modules/@groove-dev/gui/src/components/EditorTabs.jsx +3 -3
- package/node_modules/@groove-dev/gui/src/components/FileTree.jsx +18 -22
- package/node_modules/@groove-dev/gui/src/components/Terminal.jsx +154 -0
- package/node_modules/@groove-dev/gui/src/views/FileEditor.jsx +100 -39
- package/node_modules/@xterm/addon-fit/LICENSE +19 -0
- package/node_modules/@xterm/addon-fit/README.md +24 -0
- package/node_modules/@xterm/addon-fit/lib/addon-fit.js +2 -0
- package/node_modules/@xterm/addon-fit/lib/addon-fit.js.map +1 -0
- package/node_modules/@xterm/addon-fit/lib/addon-fit.mjs +18 -0
- package/node_modules/@xterm/addon-fit/lib/addon-fit.mjs.map +7 -0
- package/node_modules/@xterm/addon-fit/package.json +26 -0
- package/node_modules/@xterm/addon-fit/src/FitAddon.ts +92 -0
- package/node_modules/@xterm/addon-fit/typings/addon-fit.d.ts +55 -0
- package/node_modules/@xterm/addon-web-links/LICENSE +19 -0
- package/node_modules/@xterm/addon-web-links/README.md +21 -0
- package/node_modules/@xterm/addon-web-links/lib/addon-web-links.js +2 -0
- package/node_modules/@xterm/addon-web-links/lib/addon-web-links.js.map +1 -0
- package/node_modules/@xterm/addon-web-links/lib/addon-web-links.mjs +18 -0
- package/node_modules/@xterm/addon-web-links/lib/addon-web-links.mjs.map +7 -0
- package/node_modules/@xterm/addon-web-links/package.json +26 -0
- package/node_modules/@xterm/addon-web-links/src/WebLinkProvider.ts +199 -0
- package/node_modules/@xterm/addon-web-links/src/WebLinksAddon.ts +58 -0
- package/node_modules/@xterm/addon-web-links/typings/addon-web-links.d.ts +57 -0
- package/node_modules/@xterm/xterm/LICENSE +21 -0
- package/node_modules/@xterm/xterm/README.md +243 -0
- package/node_modules/@xterm/xterm/css/xterm.css +285 -0
- package/node_modules/@xterm/xterm/lib/xterm.js +2 -0
- package/node_modules/@xterm/xterm/lib/xterm.js.map +1 -0
- package/node_modules/@xterm/xterm/lib/xterm.mjs +53 -0
- package/node_modules/@xterm/xterm/lib/xterm.mjs.map +7 -0
- package/node_modules/@xterm/xterm/package.json +111 -0
- package/node_modules/@xterm/xterm/src/browser/AccessibilityManager.ts +435 -0
- package/node_modules/@xterm/xterm/src/browser/Clipboard.ts +93 -0
- package/node_modules/@xterm/xterm/src/browser/ColorContrastCache.ts +34 -0
- package/node_modules/@xterm/xterm/src/browser/CoreBrowserTerminal.ts +1339 -0
- package/node_modules/@xterm/xterm/src/browser/Linkifier.ts +403 -0
- package/node_modules/@xterm/xterm/src/browser/LocalizableStrings.ts +23 -0
- package/node_modules/@xterm/xterm/src/browser/OscLinkProvider.ts +129 -0
- package/node_modules/@xterm/xterm/src/browser/RenderDebouncer.ts +84 -0
- package/node_modules/@xterm/xterm/src/browser/TimeBasedDebouncer.ts +86 -0
- package/node_modules/@xterm/xterm/src/browser/Types.ts +226 -0
- package/node_modules/@xterm/xterm/src/browser/Viewport.ts +192 -0
- package/node_modules/@xterm/xterm/src/browser/decorations/BufferDecorationRenderer.ts +139 -0
- package/node_modules/@xterm/xterm/src/browser/decorations/ColorZoneStore.ts +117 -0
- package/node_modules/@xterm/xterm/src/browser/decorations/OverviewRulerRenderer.ts +214 -0
- package/node_modules/@xterm/xterm/src/browser/input/CompositionHelper.ts +248 -0
- package/node_modules/@xterm/xterm/src/browser/input/Mouse.ts +54 -0
- package/node_modules/@xterm/xterm/src/browser/input/MoveToCell.ts +251 -0
- package/node_modules/@xterm/xterm/src/browser/public/Terminal.ts +275 -0
- package/node_modules/@xterm/xterm/src/browser/renderer/dom/DomRenderer.ts +542 -0
- package/node_modules/@xterm/xterm/src/browser/renderer/dom/DomRendererRowFactory.ts +546 -0
- package/node_modules/@xterm/xterm/src/browser/renderer/dom/WidthCache.ts +167 -0
- package/node_modules/@xterm/xterm/src/browser/renderer/shared/Constants.ts +6 -0
- package/node_modules/@xterm/xterm/src/browser/renderer/shared/RendererUtils.ts +95 -0
- package/node_modules/@xterm/xterm/src/browser/renderer/shared/SelectionRenderModel.ts +93 -0
- package/node_modules/@xterm/xterm/src/browser/renderer/shared/Types.ts +84 -0
- package/node_modules/@xterm/xterm/src/browser/selection/SelectionModel.ts +144 -0
- package/node_modules/@xterm/xterm/src/browser/selection/Types.ts +15 -0
- package/node_modules/@xterm/xterm/src/browser/services/CharSizeService.ts +127 -0
- package/node_modules/@xterm/xterm/src/browser/services/CharacterJoinerService.ts +339 -0
- package/node_modules/@xterm/xterm/src/browser/services/CoreBrowserService.ts +137 -0
- package/node_modules/@xterm/xterm/src/browser/services/LinkProviderService.ts +28 -0
- package/node_modules/@xterm/xterm/src/browser/services/MouseService.ts +46 -0
- package/node_modules/@xterm/xterm/src/browser/services/RenderService.ts +376 -0
- package/node_modules/@xterm/xterm/src/browser/services/SelectionService.ts +1039 -0
- package/node_modules/@xterm/xterm/src/browser/services/Services.ts +158 -0
- package/node_modules/@xterm/xterm/src/browser/services/ThemeService.ts +198 -0
- package/node_modules/@xterm/xterm/src/browser/shared/Constants.ts +8 -0
- package/node_modules/@xterm/xterm/src/common/CircularList.ts +241 -0
- package/node_modules/@xterm/xterm/src/common/Clone.ts +23 -0
- package/node_modules/@xterm/xterm/src/common/Color.ts +376 -0
- package/node_modules/@xterm/xterm/src/common/CoreTerminal.ts +283 -0
- package/node_modules/@xterm/xterm/src/common/InputHandler.ts +3495 -0
- package/node_modules/@xterm/xterm/src/common/MultiKeyMap.ts +42 -0
- package/node_modules/@xterm/xterm/src/common/Platform.ts +44 -0
- package/node_modules/@xterm/xterm/src/common/SortedList.ts +194 -0
- package/node_modules/@xterm/xterm/src/common/TaskQueue.ts +166 -0
- package/node_modules/@xterm/xterm/src/common/TypedArrayUtils.ts +17 -0
- package/node_modules/@xterm/xterm/src/common/Types.ts +552 -0
- package/node_modules/@xterm/xterm/src/common/WindowsMode.ts +27 -0
- package/node_modules/@xterm/xterm/src/common/buffer/AttributeData.ts +211 -0
- package/node_modules/@xterm/xterm/src/common/buffer/Buffer.ts +662 -0
- package/node_modules/@xterm/xterm/src/common/buffer/BufferLine.ts +551 -0
- package/node_modules/@xterm/xterm/src/common/buffer/BufferRange.ts +13 -0
- package/node_modules/@xterm/xterm/src/common/buffer/BufferReflow.ts +226 -0
- package/node_modules/@xterm/xterm/src/common/buffer/BufferSet.ts +134 -0
- package/node_modules/@xterm/xterm/src/common/buffer/CellData.ts +94 -0
- package/node_modules/@xterm/xterm/src/common/buffer/Constants.ts +157 -0
- package/node_modules/@xterm/xterm/src/common/buffer/Marker.ts +43 -0
- package/node_modules/@xterm/xterm/src/common/buffer/Types.ts +52 -0
- package/node_modules/@xterm/xterm/src/common/data/Charsets.ts +256 -0
- package/node_modules/@xterm/xterm/src/common/data/EscapeSequences.ts +153 -0
- package/node_modules/@xterm/xterm/src/common/input/Keyboard.ts +373 -0
- package/node_modules/@xterm/xterm/src/common/input/TextDecoder.ts +346 -0
- package/node_modules/@xterm/xterm/src/common/input/UnicodeV6.ts +145 -0
- package/node_modules/@xterm/xterm/src/common/input/WriteBuffer.ts +247 -0
- package/node_modules/@xterm/xterm/src/common/input/XParseColor.ts +80 -0
- package/node_modules/@xterm/xterm/src/common/parser/Constants.ts +58 -0
- package/node_modules/@xterm/xterm/src/common/parser/DcsParser.ts +192 -0
- package/node_modules/@xterm/xterm/src/common/parser/EscapeSequenceParser.ts +792 -0
- package/node_modules/@xterm/xterm/src/common/parser/OscParser.ts +238 -0
- package/node_modules/@xterm/xterm/src/common/parser/Params.ts +229 -0
- package/node_modules/@xterm/xterm/src/common/parser/Types.ts +275 -0
- package/node_modules/@xterm/xterm/src/common/public/AddonManager.ts +53 -0
- package/node_modules/@xterm/xterm/src/common/public/BufferApiView.ts +35 -0
- package/node_modules/@xterm/xterm/src/common/public/BufferLineApiView.ts +29 -0
- package/node_modules/@xterm/xterm/src/common/public/BufferNamespaceApi.ts +36 -0
- package/node_modules/@xterm/xterm/src/common/public/ParserApi.ts +37 -0
- package/node_modules/@xterm/xterm/src/common/public/UnicodeApi.ts +27 -0
- package/node_modules/@xterm/xterm/src/common/services/BufferService.ts +154 -0
- package/node_modules/@xterm/xterm/src/common/services/CharsetService.ts +34 -0
- package/node_modules/@xterm/xterm/src/common/services/CoreMouseService.ts +365 -0
- package/node_modules/@xterm/xterm/src/common/services/CoreService.ts +92 -0
- package/node_modules/@xterm/xterm/src/common/services/DecorationService.ts +140 -0
- package/node_modules/@xterm/xterm/src/common/services/InstantiationService.ts +85 -0
- package/node_modules/@xterm/xterm/src/common/services/LogService.ts +124 -0
- package/node_modules/@xterm/xterm/src/common/services/OptionsService.ts +212 -0
- package/node_modules/@xterm/xterm/src/common/services/OscLinkService.ts +115 -0
- package/node_modules/@xterm/xterm/src/common/services/ServiceRegistry.ts +49 -0
- package/node_modules/@xterm/xterm/src/common/services/Services.ts +396 -0
- package/node_modules/@xterm/xterm/src/common/services/UnicodeService.ts +111 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/browser.ts +141 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/canIUse.ts +49 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/dom.ts +2369 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/fastDomNode.ts +316 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/globalPointerMoveMonitor.ts +112 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/iframe.ts +135 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/keyboardEvent.ts +213 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/mouseEvent.ts +229 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/touch.ts +372 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +303 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +114 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +720 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +165 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +114 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +243 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +118 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +116 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/ui/widget.ts +57 -0
- package/node_modules/@xterm/xterm/src/vs/base/browser/window.ts +14 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/arrays.ts +887 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/arraysFind.ts +202 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/assert.ts +71 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/async.ts +1992 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/cancellation.ts +148 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/charCode.ts +450 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/collections.ts +140 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/decorators.ts +130 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/equals.ts +146 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/errors.ts +303 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/event.ts +1778 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/functional.ts +32 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/hash.ts +316 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/iterator.ts +159 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/keyCodes.ts +526 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/keybindings.ts +284 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/lazy.ts +47 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/lifecycle.ts +801 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/linkedList.ts +142 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/map.ts +202 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/numbers.ts +98 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observable.ts +76 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/api.ts +31 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/autorun.ts +281 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/base.ts +489 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/debugName.ts +145 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/derived.ts +428 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/lazyObservableValue.ts +146 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/logging.ts +328 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/promise.ts +209 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/observableInternal/utils.ts +610 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/platform.ts +281 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/scrollable.ts +522 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/sequence.ts +34 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/stopwatch.ts +43 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/strings.ts +557 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/symbols.ts +9 -0
- package/node_modules/@xterm/xterm/src/vs/base/common/uint.ts +59 -0
- package/node_modules/@xterm/xterm/src/vs/patches/nls.ts +90 -0
- package/node_modules/@xterm/xterm/src/vs/typings/base-common.d.ts +20 -0
- package/node_modules/@xterm/xterm/src/vs/typings/require.d.ts +42 -0
- package/node_modules/@xterm/xterm/src/vs/typings/vscode-globals-nls.d.ts +36 -0
- package/node_modules/@xterm/xterm/src/vs/typings/vscode-globals-product.d.ts +33 -0
- package/node_modules/@xterm/xterm/typings/xterm.d.ts +1957 -0
- package/package.json +1 -1
- package/packages/daemon/src/index.js +25 -7
- package/packages/daemon/src/terminal-pty.js +141 -0
- package/packages/gui/dist/assets/{index-Gfb8Zxy9.css → index-BhjOFLBc.css} +32 -1
- package/packages/gui/dist/assets/index-CFeltwTB.js +153 -0
- package/packages/gui/dist/index.html +2 -2
- package/packages/gui/package.json +3 -0
- package/packages/gui/src/components/EditorTabs.jsx +3 -3
- package/packages/gui/src/components/FileTree.jsx +18 -22
- package/packages/gui/src/components/Terminal.jsx +154 -0
- package/packages/gui/src/views/FileEditor.jsx +100 -39
- package/node_modules/@groove-dev/gui/dist/assets/index-BQSznoq0.js +0 -103
- package/packages/gui/dist/assets/index-BQSznoq0.js +0 -103
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xterm/xterm",
|
|
3
|
+
"description": "Full xterm terminal, in your browser",
|
|
4
|
+
"version": "6.0.0",
|
|
5
|
+
"main": "lib/xterm.js",
|
|
6
|
+
"module": "lib/xterm.mjs",
|
|
7
|
+
"style": "css/xterm.css",
|
|
8
|
+
"types": "typings/xterm.d.ts",
|
|
9
|
+
"repository": "https://github.com/xtermjs/xterm.js",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"workspaces": [
|
|
12
|
+
"addons/*"
|
|
13
|
+
],
|
|
14
|
+
"keywords": [
|
|
15
|
+
"cli",
|
|
16
|
+
"command-line",
|
|
17
|
+
"console",
|
|
18
|
+
"pty",
|
|
19
|
+
"shell",
|
|
20
|
+
"ssh",
|
|
21
|
+
"styles",
|
|
22
|
+
"terminal-emulator",
|
|
23
|
+
"terminal",
|
|
24
|
+
"tty",
|
|
25
|
+
"vt100",
|
|
26
|
+
"webgl",
|
|
27
|
+
"xterm"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"setup": "npm run build",
|
|
31
|
+
"start": "node demo/start",
|
|
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",
|
|
43
|
+
"test": "npm run test-unit",
|
|
44
|
+
"posttest": "npm run lint",
|
|
45
|
+
"lint": "eslint -c .eslintrc.json --max-warnings 0 --ext .ts src/ addons/",
|
|
46
|
+
"lint-fix": "eslint -c .eslintrc.json --fix --ext .ts src/ addons/",
|
|
47
|
+
"lint-api": "eslint --no-eslintrc -c .eslintrc.json.typings --max-warnings 0 --no-ignore --ext .d.ts typings/",
|
|
48
|
+
"test-unit": "node ./bin/test_unit.js",
|
|
49
|
+
"test-unit-coverage": "node ./bin/test_unit.js --coverage",
|
|
50
|
+
"test-unit-dev": "cross-env NODE_PATH='./out' mocha",
|
|
51
|
+
"test-integration": "node ./bin/test_integration.js --workers=75%",
|
|
52
|
+
"test-integration-chromium": "node ./bin/test_integration.js --workers=75% \"--project=ChromeStable\"",
|
|
53
|
+
"test-integration-firefox": "node ./bin/test_integration.js --workers=75% \"--project=FirefoxStable\"",
|
|
54
|
+
"test-integration-webkit": "node ./bin/test_integration.js --workers=75% \"--project=WebKit\"",
|
|
55
|
+
"test-integration-debug": "node ./bin/test_integration.js --workers=1 --headed --timeout=30000",
|
|
56
|
+
"benchmark": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json",
|
|
57
|
+
"benchmark-baseline": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --baseline out-test/benchmark/*benchmark.js",
|
|
58
|
+
"benchmark-eval": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json --eval out-test/benchmark/*benchmark.js",
|
|
59
|
+
"clean": "rm -rf lib out addons/*/lib addons/*/out",
|
|
60
|
+
"vtfeatures": "node bin/extract_vtfeatures.js src/**/*.ts src/*.ts",
|
|
61
|
+
"prepackage": "npm run build",
|
|
62
|
+
"package": "webpack",
|
|
63
|
+
"postpackage": "npm run esbuild-package",
|
|
64
|
+
"prepackage-headless": "npm run esbuild-package-headless-only",
|
|
65
|
+
"package-headless": "webpack --config ./webpack.config.headless.js",
|
|
66
|
+
"postpackage-headless": "node ./bin/package_headless.js",
|
|
67
|
+
"prepublishOnly": "npm run package"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@lunapaint/png-codec": "^0.2.0",
|
|
71
|
+
"@playwright/test": "^1.37.1",
|
|
72
|
+
"@stylistic/eslint-plugin": "^2.3.0",
|
|
73
|
+
"@types/chai": "^4.2.22",
|
|
74
|
+
"@types/debug": "^4.1.7",
|
|
75
|
+
"@types/deep-equal": "^1.0.1",
|
|
76
|
+
"@types/express": "4",
|
|
77
|
+
"@types/express-ws": "^3.0.1",
|
|
78
|
+
"@types/jsdom": "^16.2.13",
|
|
79
|
+
"@types/mocha": "^9.0.0",
|
|
80
|
+
"@types/node": "^18.16.0",
|
|
81
|
+
"@types/trusted-types": "^1.0.6",
|
|
82
|
+
"@types/utf8": "^3.0.0",
|
|
83
|
+
"@types/webpack": "^5.28.0",
|
|
84
|
+
"@types/ws": "^8.2.0",
|
|
85
|
+
"@typescript-eslint/eslint-plugin": "^6.2.00",
|
|
86
|
+
"@typescript-eslint/parser": "^6.2.00",
|
|
87
|
+
"chai": "^4.3.4",
|
|
88
|
+
"cross-env": "^7.0.3",
|
|
89
|
+
"deep-equal": "^2.0.5",
|
|
90
|
+
"esbuild": "~0.25.2",
|
|
91
|
+
"eslint": "^8.56.0",
|
|
92
|
+
"eslint-plugin-jsdoc": "^46.9.1",
|
|
93
|
+
"express": "^4.19.2",
|
|
94
|
+
"express-ws": "^5.0.2",
|
|
95
|
+
"jsdom": "^18.0.1",
|
|
96
|
+
"mocha": "^10.1.0",
|
|
97
|
+
"mustache": "^4.2.0",
|
|
98
|
+
"node-pty": "1.1.0-beta19",
|
|
99
|
+
"nyc": "^15.1.0",
|
|
100
|
+
"source-map-loader": "^3.0.0",
|
|
101
|
+
"source-map-support": "^0.5.20",
|
|
102
|
+
"ts-loader": "^9.3.1",
|
|
103
|
+
"typescript": "5.5",
|
|
104
|
+
"utf8": "^3.0.0",
|
|
105
|
+
"webpack": "^5.61.0",
|
|
106
|
+
"webpack-cli": "^4.9.1",
|
|
107
|
+
"ws": "^8.2.3",
|
|
108
|
+
"xterm-benchmark": "^0.3.1"
|
|
109
|
+
},
|
|
110
|
+
"commit": "f447274f430fd22513f6adbf9862d19524471c04"
|
|
111
|
+
}
|
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
|
|
3
|
+
* @license MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as Strings from 'browser/LocalizableStrings';
|
|
7
|
+
import { ITerminal, IRenderDebouncer } from 'browser/Types';
|
|
8
|
+
import { TimeBasedDebouncer } from 'browser/TimeBasedDebouncer';
|
|
9
|
+
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
|
10
|
+
import { ICoreBrowserService, IRenderService } from 'browser/services/Services';
|
|
11
|
+
import { IBuffer } from 'common/buffer/Types';
|
|
12
|
+
import { IInstantiationService } from 'common/services/Services';
|
|
13
|
+
import { addDisposableListener } from 'vs/base/browser/dom';
|
|
14
|
+
|
|
15
|
+
const MAX_ROWS_TO_READ = 20;
|
|
16
|
+
|
|
17
|
+
const enum BoundaryPosition {
|
|
18
|
+
TOP,
|
|
19
|
+
BOTTOM
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Turn this on to unhide the accessibility tree and display it under
|
|
23
|
+
// (instead of overlapping with) the terminal.
|
|
24
|
+
const DEBUG = false;
|
|
25
|
+
|
|
26
|
+
export class AccessibilityManager extends Disposable {
|
|
27
|
+
private _debugRootContainer: HTMLElement | undefined;
|
|
28
|
+
private _accessibilityContainer: HTMLElement;
|
|
29
|
+
|
|
30
|
+
private _rowContainer: HTMLElement;
|
|
31
|
+
private _rowElements: HTMLElement[];
|
|
32
|
+
private _rowColumns: WeakMap<HTMLElement, number[]> = new WeakMap();
|
|
33
|
+
|
|
34
|
+
private _liveRegion: HTMLElement;
|
|
35
|
+
private _liveRegionLineCount: number = 0;
|
|
36
|
+
private _liveRegionDebouncer: IRenderDebouncer;
|
|
37
|
+
|
|
38
|
+
private _topBoundaryFocusListener: (e: FocusEvent) => void;
|
|
39
|
+
private _bottomBoundaryFocusListener: (e: FocusEvent) => void;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* This queue has a character pushed to it for keys that are pressed, if the
|
|
43
|
+
* next character added to the terminal is equal to the key char then it is
|
|
44
|
+
* not announced (added to live region) because it has already been announced
|
|
45
|
+
* by the textarea event (which cannot be canceled). There are some race
|
|
46
|
+
* condition cases if there is typing while data is streaming, but this covers
|
|
47
|
+
* the main case of typing into the prompt and inputting the answer to a
|
|
48
|
+
* question (Y/N, etc.).
|
|
49
|
+
*/
|
|
50
|
+
private _charsToConsume: string[] = [];
|
|
51
|
+
|
|
52
|
+
private _charsToAnnounce: string = '';
|
|
53
|
+
|
|
54
|
+
constructor(
|
|
55
|
+
private readonly _terminal: ITerminal,
|
|
56
|
+
@IInstantiationService instantiationService: IInstantiationService,
|
|
57
|
+
@ICoreBrowserService private readonly _coreBrowserService: ICoreBrowserService,
|
|
58
|
+
@IRenderService private readonly _renderService: IRenderService
|
|
59
|
+
) {
|
|
60
|
+
super();
|
|
61
|
+
const doc = this._coreBrowserService.mainDocument;
|
|
62
|
+
this._accessibilityContainer = doc.createElement('div');
|
|
63
|
+
this._accessibilityContainer.classList.add('xterm-accessibility');
|
|
64
|
+
|
|
65
|
+
this._rowContainer = doc.createElement('div');
|
|
66
|
+
this._rowContainer.setAttribute('role', 'list');
|
|
67
|
+
this._rowContainer.classList.add('xterm-accessibility-tree');
|
|
68
|
+
this._rowElements = [];
|
|
69
|
+
for (let i = 0; i < this._terminal.rows; i++) {
|
|
70
|
+
this._rowElements[i] = this._createAccessibilityTreeNode();
|
|
71
|
+
this._rowContainer.appendChild(this._rowElements[i]);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
this._topBoundaryFocusListener = e => this._handleBoundaryFocus(e, BoundaryPosition.TOP);
|
|
75
|
+
this._bottomBoundaryFocusListener = e => this._handleBoundaryFocus(e, BoundaryPosition.BOTTOM);
|
|
76
|
+
this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);
|
|
77
|
+
this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);
|
|
78
|
+
|
|
79
|
+
this._accessibilityContainer.appendChild(this._rowContainer);
|
|
80
|
+
|
|
81
|
+
this._liveRegion = doc.createElement('div');
|
|
82
|
+
this._liveRegion.classList.add('live-region');
|
|
83
|
+
this._liveRegion.setAttribute('aria-live', 'assertive');
|
|
84
|
+
this._accessibilityContainer.appendChild(this._liveRegion);
|
|
85
|
+
this._liveRegionDebouncer = this._register(new TimeBasedDebouncer(this._renderRows.bind(this)));
|
|
86
|
+
|
|
87
|
+
if (!this._terminal.element) {
|
|
88
|
+
throw new Error('Cannot enable accessibility before Terminal.open');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (DEBUG) {
|
|
92
|
+
this._accessibilityContainer.classList.add('debug');
|
|
93
|
+
this._rowContainer.classList.add('debug');
|
|
94
|
+
|
|
95
|
+
// Use a `<div class="xterm">` container so that the css will still apply.
|
|
96
|
+
this._debugRootContainer = doc.createElement('div');
|
|
97
|
+
this._debugRootContainer.classList.add('xterm');
|
|
98
|
+
|
|
99
|
+
this._debugRootContainer.appendChild(doc.createTextNode('------start a11y------'));
|
|
100
|
+
this._debugRootContainer.appendChild(this._accessibilityContainer);
|
|
101
|
+
this._debugRootContainer.appendChild(doc.createTextNode('------end a11y------'));
|
|
102
|
+
|
|
103
|
+
this._terminal.element.insertAdjacentElement('afterend', this._debugRootContainer);
|
|
104
|
+
} else {
|
|
105
|
+
this._terminal.element.insertAdjacentElement('afterbegin', this._accessibilityContainer);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
this._register(this._terminal.onResize(e => this._handleResize(e.rows)));
|
|
109
|
+
this._register(this._terminal.onRender(e => this._refreshRows(e.start, e.end)));
|
|
110
|
+
this._register(this._terminal.onScroll(() => this._refreshRows()));
|
|
111
|
+
// Line feed is an issue as the prompt won't be read out after a command is run
|
|
112
|
+
this._register(this._terminal.onA11yChar(char => this._handleChar(char)));
|
|
113
|
+
this._register(this._terminal.onLineFeed(() => this._handleChar('\n')));
|
|
114
|
+
this._register(this._terminal.onA11yTab(spaceCount => this._handleTab(spaceCount)));
|
|
115
|
+
this._register(this._terminal.onKey(e => this._handleKey(e.key)));
|
|
116
|
+
this._register(this._terminal.onBlur(() => this._clearLiveRegion()));
|
|
117
|
+
this._register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions()));
|
|
118
|
+
this._register(addDisposableListener(doc, 'selectionchange', () => this._handleSelectionChange()));
|
|
119
|
+
this._register(this._coreBrowserService.onDprChange(() => this._refreshRowsDimensions()));
|
|
120
|
+
|
|
121
|
+
this._refreshRowsDimensions();
|
|
122
|
+
this._refreshRows();
|
|
123
|
+
this._register(toDisposable(() => {
|
|
124
|
+
if (DEBUG) {
|
|
125
|
+
this._debugRootContainer!.remove();
|
|
126
|
+
} else {
|
|
127
|
+
this._accessibilityContainer.remove();
|
|
128
|
+
}
|
|
129
|
+
this._rowElements.length = 0;
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
private _handleTab(spaceCount: number): void {
|
|
134
|
+
for (let i = 0; i < spaceCount; i++) {
|
|
135
|
+
this._handleChar(' ');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private _handleChar(char: string): void {
|
|
140
|
+
if (this._liveRegionLineCount < MAX_ROWS_TO_READ + 1) {
|
|
141
|
+
if (this._charsToConsume.length > 0) {
|
|
142
|
+
// Have the screen reader ignore the char if it was just input
|
|
143
|
+
const shiftedChar = this._charsToConsume.shift();
|
|
144
|
+
if (shiftedChar !== char) {
|
|
145
|
+
this._charsToAnnounce += char;
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
this._charsToAnnounce += char;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (char === '\n') {
|
|
152
|
+
this._liveRegionLineCount++;
|
|
153
|
+
if (this._liveRegionLineCount === MAX_ROWS_TO_READ + 1) {
|
|
154
|
+
this._liveRegion.textContent += Strings.tooMuchOutput.get();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
private _clearLiveRegion(): void {
|
|
161
|
+
this._liveRegion.textContent = '';
|
|
162
|
+
this._liveRegionLineCount = 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
private _handleKey(keyChar: string): void {
|
|
166
|
+
this._clearLiveRegion();
|
|
167
|
+
// Only add the char if there is no control character.
|
|
168
|
+
if (!/\p{Control}/u.test(keyChar)) {
|
|
169
|
+
this._charsToConsume.push(keyChar);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private _refreshRows(start?: number, end?: number): void {
|
|
174
|
+
this._liveRegionDebouncer.refresh(start, end, this._terminal.rows);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
private _renderRows(start: number, end: number): void {
|
|
178
|
+
const buffer: IBuffer = this._terminal.buffer;
|
|
179
|
+
const setSize = buffer.lines.length.toString();
|
|
180
|
+
for (let i = start; i <= end; i++) {
|
|
181
|
+
const line = buffer.lines.get(buffer.ydisp + i);
|
|
182
|
+
const columns: number[] = [];
|
|
183
|
+
const lineData = line?.translateToString(true, undefined, undefined, columns) || '';
|
|
184
|
+
const posInSet = (buffer.ydisp + i + 1).toString();
|
|
185
|
+
const element = this._rowElements[i];
|
|
186
|
+
if (element) {
|
|
187
|
+
if (lineData.length === 0) {
|
|
188
|
+
element.textContent = '\u00a0';
|
|
189
|
+
this._rowColumns.set(element, [0, 1]);
|
|
190
|
+
} else {
|
|
191
|
+
element.textContent = lineData;
|
|
192
|
+
this._rowColumns.set(element, columns);
|
|
193
|
+
}
|
|
194
|
+
element.setAttribute('aria-posinset', posInSet);
|
|
195
|
+
element.setAttribute('aria-setsize', setSize);
|
|
196
|
+
this._alignRowWidth(element);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
this._announceCharacters();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
private _announceCharacters(): void {
|
|
203
|
+
if (this._charsToAnnounce.length === 0) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
this._liveRegion.textContent += this._charsToAnnounce;
|
|
207
|
+
this._charsToAnnounce = '';
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
private _handleBoundaryFocus(e: FocusEvent, position: BoundaryPosition): void {
|
|
211
|
+
const boundaryElement = e.target as HTMLElement;
|
|
212
|
+
const beforeBoundaryElement = this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2];
|
|
213
|
+
|
|
214
|
+
// Don't scroll if the buffer top has reached the end in that direction
|
|
215
|
+
const posInSet = boundaryElement.getAttribute('aria-posinset');
|
|
216
|
+
const lastRowPos = position === BoundaryPosition.TOP ? '1' : `${this._terminal.buffer.lines.length}`;
|
|
217
|
+
if (posInSet === lastRowPos) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Don't scroll when the last focused item was not the second row (focus is going the other
|
|
222
|
+
// direction)
|
|
223
|
+
if (e.relatedTarget !== beforeBoundaryElement) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Remove old boundary element from array
|
|
228
|
+
let topBoundaryElement: HTMLElement;
|
|
229
|
+
let bottomBoundaryElement: HTMLElement;
|
|
230
|
+
if (position === BoundaryPosition.TOP) {
|
|
231
|
+
topBoundaryElement = boundaryElement;
|
|
232
|
+
bottomBoundaryElement = this._rowElements.pop()!;
|
|
233
|
+
this._rowContainer.removeChild(bottomBoundaryElement);
|
|
234
|
+
} else {
|
|
235
|
+
topBoundaryElement = this._rowElements.shift()!;
|
|
236
|
+
bottomBoundaryElement = boundaryElement;
|
|
237
|
+
this._rowContainer.removeChild(topBoundaryElement);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Remove listeners from old boundary elements
|
|
241
|
+
topBoundaryElement.removeEventListener('focus', this._topBoundaryFocusListener);
|
|
242
|
+
bottomBoundaryElement.removeEventListener('focus', this._bottomBoundaryFocusListener);
|
|
243
|
+
|
|
244
|
+
// Add new element to array/DOM
|
|
245
|
+
if (position === BoundaryPosition.TOP) {
|
|
246
|
+
const newElement = this._createAccessibilityTreeNode();
|
|
247
|
+
this._rowElements.unshift(newElement);
|
|
248
|
+
this._rowContainer.insertAdjacentElement('afterbegin', newElement);
|
|
249
|
+
} else {
|
|
250
|
+
const newElement = this._createAccessibilityTreeNode();
|
|
251
|
+
this._rowElements.push(newElement);
|
|
252
|
+
this._rowContainer.appendChild(newElement);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Add listeners to new boundary elements
|
|
256
|
+
this._rowElements[0].addEventListener('focus', this._topBoundaryFocusListener);
|
|
257
|
+
this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);
|
|
258
|
+
|
|
259
|
+
// Scroll up
|
|
260
|
+
this._terminal.scrollLines(position === BoundaryPosition.TOP ? -1 : 1);
|
|
261
|
+
|
|
262
|
+
// Focus new boundary before element
|
|
263
|
+
this._rowElements[position === BoundaryPosition.TOP ? 1 : this._rowElements.length - 2].focus();
|
|
264
|
+
|
|
265
|
+
// Prevent the standard behavior
|
|
266
|
+
e.preventDefault();
|
|
267
|
+
e.stopImmediatePropagation();
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
private _handleSelectionChange(): void {
|
|
271
|
+
if (this._rowElements.length === 0) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const selection = this._coreBrowserService.mainDocument.getSelection();
|
|
276
|
+
if (!selection) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (selection.isCollapsed) {
|
|
281
|
+
// Only do something when the anchorNode is inside the row container. This
|
|
282
|
+
// behavior mirrors what we do with mouse --- if the mouse clicks
|
|
283
|
+
// somewhere outside of the terminal, we don't clear the selection.
|
|
284
|
+
if (this._rowContainer.contains(selection.anchorNode)) {
|
|
285
|
+
this._terminal.clearSelection();
|
|
286
|
+
}
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (!selection.anchorNode || !selection.focusNode) {
|
|
291
|
+
console.error('anchorNode and/or focusNode are null');
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Sort the two selection points in document order.
|
|
296
|
+
let begin = { node: selection.anchorNode, offset: selection.anchorOffset };
|
|
297
|
+
let end = { node: selection.focusNode, offset: selection.focusOffset };
|
|
298
|
+
if ((begin.node.compareDocumentPosition(end.node) & Node.DOCUMENT_POSITION_PRECEDING) || (begin.node === end.node && begin.offset > end.offset) ) {
|
|
299
|
+
[begin, end] = [end, begin];
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// Clamp begin/end to the inside of the row container.
|
|
303
|
+
if (begin.node.compareDocumentPosition(this._rowElements[0]) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_FOLLOWING)) {
|
|
304
|
+
begin = { node: this._rowElements[0].childNodes[0], offset: 0 };
|
|
305
|
+
}
|
|
306
|
+
if (!this._rowContainer.contains(begin.node)) {
|
|
307
|
+
// This happens when `begin` is below the last row.
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
const lastRowElement = this._rowElements.slice(-1)[0];
|
|
311
|
+
if (end.node.compareDocumentPosition(lastRowElement) & (Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_PRECEDING)) {
|
|
312
|
+
end = {
|
|
313
|
+
node: lastRowElement,
|
|
314
|
+
offset: lastRowElement.textContent?.length ?? 0
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
if (!this._rowContainer.contains(end.node)) {
|
|
318
|
+
// This happens when `end` is above the first row.
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const toRowColumn = ({ node, offset }: typeof begin): {row: number, column: number} | null => {
|
|
323
|
+
// `node` is either the row element or the Text node inside it.
|
|
324
|
+
const rowElement: any = node instanceof Text ? node.parentNode : node;
|
|
325
|
+
let row = parseInt(rowElement?.getAttribute('aria-posinset'), 10) - 1;
|
|
326
|
+
if (isNaN(row)) {
|
|
327
|
+
console.warn('row is invalid. Race condition?');
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const columns = this._rowColumns.get(rowElement);
|
|
332
|
+
if (!columns) {
|
|
333
|
+
console.warn('columns is null. Race condition?');
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
let column = offset < columns.length ? columns[offset] : columns.slice(-1)[0] + 1;
|
|
338
|
+
if (column >= this._terminal.cols) {
|
|
339
|
+
++row;
|
|
340
|
+
column = 0;
|
|
341
|
+
}
|
|
342
|
+
return {
|
|
343
|
+
row,
|
|
344
|
+
column
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
const beginRowColumn = toRowColumn(begin);
|
|
349
|
+
const endRowColumn = toRowColumn(end);
|
|
350
|
+
|
|
351
|
+
if (!beginRowColumn || !endRowColumn) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (beginRowColumn.row > endRowColumn.row || (beginRowColumn.row === endRowColumn.row && beginRowColumn.column >= endRowColumn.column)) {
|
|
356
|
+
// This should not happen unless we have some bugs.
|
|
357
|
+
throw new Error('invalid range');
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
this._terminal.select(
|
|
361
|
+
beginRowColumn.column,
|
|
362
|
+
beginRowColumn.row,
|
|
363
|
+
(endRowColumn.row - beginRowColumn.row) * this._terminal.cols - beginRowColumn.column + endRowColumn.column
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
private _handleResize(rows: number): void {
|
|
368
|
+
// Remove bottom boundary listener
|
|
369
|
+
this._rowElements[this._rowElements.length - 1].removeEventListener('focus', this._bottomBoundaryFocusListener);
|
|
370
|
+
|
|
371
|
+
// Grow rows as required
|
|
372
|
+
for (let i = this._rowContainer.children.length; i < this._terminal.rows; i++) {
|
|
373
|
+
this._rowElements[i] = this._createAccessibilityTreeNode();
|
|
374
|
+
this._rowContainer.appendChild(this._rowElements[i]);
|
|
375
|
+
}
|
|
376
|
+
// Shrink rows as required
|
|
377
|
+
while (this._rowElements.length > rows) {
|
|
378
|
+
this._rowContainer.removeChild(this._rowElements.pop()!);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// Add bottom boundary listener
|
|
382
|
+
this._rowElements[this._rowElements.length - 1].addEventListener('focus', this._bottomBoundaryFocusListener);
|
|
383
|
+
|
|
384
|
+
this._refreshRowsDimensions();
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
private _createAccessibilityTreeNode(): HTMLElement {
|
|
388
|
+
const element = this._coreBrowserService.mainDocument.createElement('div');
|
|
389
|
+
element.setAttribute('role', 'listitem');
|
|
390
|
+
element.tabIndex = -1;
|
|
391
|
+
this._refreshRowDimensions(element);
|
|
392
|
+
return element;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
private _refreshRowsDimensions(): void {
|
|
396
|
+
if (!this._renderService.dimensions.css.cell.height) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
Object.assign(this._accessibilityContainer.style, {
|
|
400
|
+
width: `${this._renderService.dimensions.css.canvas.width}px`,
|
|
401
|
+
fontSize: `${this._terminal.options.fontSize}px`
|
|
402
|
+
});
|
|
403
|
+
if (this._rowElements.length !== this._terminal.rows) {
|
|
404
|
+
this._handleResize(this._terminal.rows);
|
|
405
|
+
}
|
|
406
|
+
for (let i = 0; i < this._terminal.rows; i++) {
|
|
407
|
+
this._refreshRowDimensions(this._rowElements[i]);
|
|
408
|
+
this._alignRowWidth(this._rowElements[i]);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
private _refreshRowDimensions(element: HTMLElement): void {
|
|
413
|
+
element.style.height = `${this._renderService.dimensions.css.cell.height}px`;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Scale the width of a row so that each of the character is (mostly) aligned
|
|
418
|
+
* with the actual rendering. This will allow the screen reader to draw
|
|
419
|
+
* selection outline at the correct position.
|
|
420
|
+
*
|
|
421
|
+
* On top of using the "monospace" font and correct font size, the scaling
|
|
422
|
+
* here is necessary to handle characters that are not covered by the font
|
|
423
|
+
* (e.g. CJK).
|
|
424
|
+
*/
|
|
425
|
+
private _alignRowWidth(element: HTMLElement): void {
|
|
426
|
+
element.style.transform = '';
|
|
427
|
+
const width = element.getBoundingClientRect().width;
|
|
428
|
+
const lastColumn = this._rowColumns.get(element)?.slice(-1)?.[0];
|
|
429
|
+
if (!lastColumn) {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
const targetWidth = lastColumn * this._renderService.dimensions.css.cell.width;
|
|
433
|
+
element.style.transform = `scaleX(${targetWidth / width})`;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016 The xterm.js authors. All rights reserved.
|
|
3
|
+
* @license MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ISelectionService } from 'browser/services/Services';
|
|
7
|
+
import { ICoreService, IOptionsService } from 'common/services/Services';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Prepares text to be pasted into the terminal by normalizing the line endings
|
|
11
|
+
* @param text The pasted text that needs processing before inserting into the terminal
|
|
12
|
+
*/
|
|
13
|
+
export function prepareTextForTerminal(text: string): string {
|
|
14
|
+
return text.replace(/\r?\n/g, '\r');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Bracket text for paste, if necessary, as per https://cirw.in/blog/bracketed-paste
|
|
19
|
+
* @param text The pasted text to bracket
|
|
20
|
+
*/
|
|
21
|
+
export function bracketTextForPaste(text: string, bracketedPasteMode: boolean): string {
|
|
22
|
+
if (bracketedPasteMode) {
|
|
23
|
+
return '\x1b[200~' + text + '\x1b[201~';
|
|
24
|
+
}
|
|
25
|
+
return text;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Binds copy functionality to the given terminal.
|
|
30
|
+
* @param ev The original copy event to be handled
|
|
31
|
+
*/
|
|
32
|
+
export function copyHandler(ev: ClipboardEvent, selectionService: ISelectionService): void {
|
|
33
|
+
if (ev.clipboardData) {
|
|
34
|
+
ev.clipboardData.setData('text/plain', selectionService.selectionText);
|
|
35
|
+
}
|
|
36
|
+
// Prevent or the original text will be copied.
|
|
37
|
+
ev.preventDefault();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Redirect the clipboard's data to the terminal's input handler.
|
|
42
|
+
*/
|
|
43
|
+
export function handlePasteEvent(ev: ClipboardEvent, textarea: HTMLTextAreaElement, coreService: ICoreService, optionsService: IOptionsService): void {
|
|
44
|
+
ev.stopPropagation();
|
|
45
|
+
if (ev.clipboardData) {
|
|
46
|
+
const text = ev.clipboardData.getData('text/plain');
|
|
47
|
+
paste(text, textarea, coreService, optionsService);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function paste(text: string, textarea: HTMLTextAreaElement, coreService: ICoreService, optionsService: IOptionsService): void {
|
|
52
|
+
text = prepareTextForTerminal(text);
|
|
53
|
+
text = bracketTextForPaste(text, coreService.decPrivateModes.bracketedPasteMode && optionsService.rawOptions.ignoreBracketedPasteMode !== true);
|
|
54
|
+
coreService.triggerDataEvent(text, true);
|
|
55
|
+
textarea.value = '';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Moves the textarea under the mouse cursor and focuses it.
|
|
60
|
+
* @param ev The original right click event to be handled.
|
|
61
|
+
* @param textarea The terminal's textarea.
|
|
62
|
+
*/
|
|
63
|
+
export function moveTextAreaUnderMouseCursor(ev: MouseEvent, textarea: HTMLTextAreaElement, screenElement: HTMLElement): void {
|
|
64
|
+
|
|
65
|
+
// Calculate textarea position relative to the screen element
|
|
66
|
+
const pos = screenElement.getBoundingClientRect();
|
|
67
|
+
const left = ev.clientX - pos.left - 10;
|
|
68
|
+
const top = ev.clientY - pos.top - 10;
|
|
69
|
+
|
|
70
|
+
// Bring textarea at the cursor position
|
|
71
|
+
textarea.style.width = '20px';
|
|
72
|
+
textarea.style.height = '20px';
|
|
73
|
+
textarea.style.left = `${left}px`;
|
|
74
|
+
textarea.style.top = `${top}px`;
|
|
75
|
+
textarea.style.zIndex = '1000';
|
|
76
|
+
|
|
77
|
+
textarea.focus();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Bind to right-click event and allow right-click copy and paste.
|
|
82
|
+
*/
|
|
83
|
+
export function rightClickHandler(ev: MouseEvent, textarea: HTMLTextAreaElement, screenElement: HTMLElement, selectionService: ISelectionService, shouldSelectWord: boolean): void {
|
|
84
|
+
moveTextAreaUnderMouseCursor(ev, textarea, screenElement);
|
|
85
|
+
|
|
86
|
+
if (shouldSelectWord) {
|
|
87
|
+
selectionService.rightClickSelect(ev);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Get textarea ready to copy from the context menu
|
|
91
|
+
textarea.value = selectionService.selectionText;
|
|
92
|
+
textarea.select();
|
|
93
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
|
|
3
|
+
* @license MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { IColorContrastCache } from 'browser/Types';
|
|
7
|
+
import { IColor } from 'common/Types';
|
|
8
|
+
import { TwoKeyMap } from 'common/MultiKeyMap';
|
|
9
|
+
|
|
10
|
+
export class ColorContrastCache implements IColorContrastCache {
|
|
11
|
+
private _color: TwoKeyMap</* bg */number, /* fg */number, IColor | null> = new TwoKeyMap();
|
|
12
|
+
private _css: TwoKeyMap</* bg */number, /* fg */number, string | null> = new TwoKeyMap();
|
|
13
|
+
|
|
14
|
+
public setCss(bg: number, fg: number, value: string | null): void {
|
|
15
|
+
this._css.set(bg, fg, value);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public getCss(bg: number, fg: number): string | null | undefined {
|
|
19
|
+
return this._css.get(bg, fg);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public setColor(bg: number, fg: number, value: IColor | null): void {
|
|
23
|
+
this._color.set(bg, fg, value);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public getColor(bg: number, fg: number): IColor | null | undefined {
|
|
27
|
+
return this._color.get(bg, fg);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public clear(): void {
|
|
31
|
+
this._color.clear();
|
|
32
|
+
this._css.clear();
|
|
33
|
+
}
|
|
34
|
+
}
|