@qodalis/cli 2.5.0 → 2.5.2
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 +2 -2
- package/public-api.d.mts +15 -1
- package/public-api.d.ts +15 -1
- package/public-api.js +214 -5
- package/public-api.js.map +1 -1
- package/public-api.mjs +214 -5
- package/public-api.mjs.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qodalis/cli",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"description": "Framework-agnostic CLI engine for @qodalis terminal applications.",
|
|
5
5
|
"author": "Nicolae Lupei, Qodalis Solutions",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"./assets/*": "./assets/*"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@qodalis/cli-core": "2.5.
|
|
33
|
+
"@qodalis/cli-core": "2.5.2",
|
|
34
34
|
"@xterm/xterm": "^6.0.0",
|
|
35
35
|
"@xterm/addon-fit": "^0.11.0",
|
|
36
36
|
"@xterm/addon-web-links": "^0.12.0",
|
package/public-api.d.mts
CHANGED
|
@@ -165,7 +165,7 @@ declare const CliKeyValueStore_TOKEN: any;
|
|
|
165
165
|
*/
|
|
166
166
|
declare const SyntaxHighlighterRegistry_TOKEN: any;
|
|
167
167
|
|
|
168
|
-
declare const LIBRARY_VERSION = "2.5.
|
|
168
|
+
declare const LIBRARY_VERSION = "2.5.2";
|
|
169
169
|
declare const API_VERSION = 2;
|
|
170
170
|
|
|
171
171
|
declare class CliAliasCommandProcessor implements ICliCommandProcessor {
|
|
@@ -2889,6 +2889,14 @@ interface CliEngineOptions extends CliOptions {
|
|
|
2889
2889
|
* @default true
|
|
2890
2890
|
*/
|
|
2891
2891
|
autoFocus?: boolean;
|
|
2892
|
+
/**
|
|
2893
|
+
* Scroll the scrollback with a finger on touch screens (xterm.js has no
|
|
2894
|
+
* touch scrolling, so a drag would scroll the page instead). Paused while
|
|
2895
|
+
* a full-screen command runs. Turn it off when the host scrolls the
|
|
2896
|
+
* terminal itself.
|
|
2897
|
+
* @default true
|
|
2898
|
+
*/
|
|
2899
|
+
touchScroll?: boolean;
|
|
2892
2900
|
}
|
|
2893
2901
|
declare class CliEngine {
|
|
2894
2902
|
private readonly container;
|
|
@@ -2903,6 +2911,7 @@ declare class CliEngine {
|
|
|
2903
2911
|
private resizeObserver?;
|
|
2904
2912
|
private resizeListener?;
|
|
2905
2913
|
private wheelListener?;
|
|
2914
|
+
private disposeTouchScroll?;
|
|
2906
2915
|
private resizeVersion;
|
|
2907
2916
|
private resizeScheduled;
|
|
2908
2917
|
private bootService?;
|
|
@@ -4165,6 +4174,11 @@ declare class CliPanelController implements ICliPanelRef<CliEngine> {
|
|
|
4165
4174
|
private readonly onSystemSchemeChange;
|
|
4166
4175
|
/** A terminal in the panel changed theme: follow the first one. */
|
|
4167
4176
|
private readonly onTerminalTheme;
|
|
4177
|
+
/**
|
|
4178
|
+
* A wheel over the panel chrome (header, icon strip, empty pane) would
|
|
4179
|
+
* scroll the page behind it; the terminals already keep their own wheel.
|
|
4180
|
+
*/
|
|
4181
|
+
private readonly onPanelWheel;
|
|
4168
4182
|
/**
|
|
4169
4183
|
* Phone browsers open the keyboard over the page and shrink only the visual
|
|
4170
4184
|
* viewport; follow it so the panel stays above the keyboard.
|
package/public-api.d.ts
CHANGED
|
@@ -165,7 +165,7 @@ declare const CliKeyValueStore_TOKEN: any;
|
|
|
165
165
|
*/
|
|
166
166
|
declare const SyntaxHighlighterRegistry_TOKEN: any;
|
|
167
167
|
|
|
168
|
-
declare const LIBRARY_VERSION = "2.5.
|
|
168
|
+
declare const LIBRARY_VERSION = "2.5.2";
|
|
169
169
|
declare const API_VERSION = 2;
|
|
170
170
|
|
|
171
171
|
declare class CliAliasCommandProcessor implements ICliCommandProcessor {
|
|
@@ -2889,6 +2889,14 @@ interface CliEngineOptions extends CliOptions {
|
|
|
2889
2889
|
* @default true
|
|
2890
2890
|
*/
|
|
2891
2891
|
autoFocus?: boolean;
|
|
2892
|
+
/**
|
|
2893
|
+
* Scroll the scrollback with a finger on touch screens (xterm.js has no
|
|
2894
|
+
* touch scrolling, so a drag would scroll the page instead). Paused while
|
|
2895
|
+
* a full-screen command runs. Turn it off when the host scrolls the
|
|
2896
|
+
* terminal itself.
|
|
2897
|
+
* @default true
|
|
2898
|
+
*/
|
|
2899
|
+
touchScroll?: boolean;
|
|
2892
2900
|
}
|
|
2893
2901
|
declare class CliEngine {
|
|
2894
2902
|
private readonly container;
|
|
@@ -2903,6 +2911,7 @@ declare class CliEngine {
|
|
|
2903
2911
|
private resizeObserver?;
|
|
2904
2912
|
private resizeListener?;
|
|
2905
2913
|
private wheelListener?;
|
|
2914
|
+
private disposeTouchScroll?;
|
|
2906
2915
|
private resizeVersion;
|
|
2907
2916
|
private resizeScheduled;
|
|
2908
2917
|
private bootService?;
|
|
@@ -4165,6 +4174,11 @@ declare class CliPanelController implements ICliPanelRef<CliEngine> {
|
|
|
4165
4174
|
private readonly onSystemSchemeChange;
|
|
4166
4175
|
/** A terminal in the panel changed theme: follow the first one. */
|
|
4167
4176
|
private readonly onTerminalTheme;
|
|
4177
|
+
/**
|
|
4178
|
+
* A wheel over the panel chrome (header, icon strip, empty pane) would
|
|
4179
|
+
* scroll the page behind it; the terminals already keep their own wheel.
|
|
4180
|
+
*/
|
|
4181
|
+
private readonly onPanelWheel;
|
|
4168
4182
|
/**
|
|
4169
4183
|
* Phone browsers open the keyboard over the page and shrink only the visual
|
|
4170
4184
|
* viewport; follow it so the panel stays above the keyboard.
|
package/public-api.js
CHANGED
|
@@ -519,7 +519,7 @@ var CliKeyValueStore_TOKEN = cliCore.createCliToken("cli-key-value-store");
|
|
|
519
519
|
var SyntaxHighlighterRegistry_TOKEN = cliCore.createCliToken("syntax-highlighter-registry");
|
|
520
520
|
|
|
521
521
|
// src/lib/version.ts
|
|
522
|
-
var LIBRARY_VERSION = "2.5.
|
|
522
|
+
var LIBRARY_VERSION = "2.5.2";
|
|
523
523
|
var API_VERSION = 2;
|
|
524
524
|
var ANONYMOUS = "\0anonymous";
|
|
525
525
|
function aliasOwner(context2) {
|
|
@@ -21611,6 +21611,27 @@ function parseAddArgs(value) {
|
|
|
21611
21611
|
}
|
|
21612
21612
|
return {};
|
|
21613
21613
|
}
|
|
21614
|
+
function sameServerUrl(a, b) {
|
|
21615
|
+
const key = (url) => normalizeServerUrl(absoluteUrl(url))?.toLowerCase();
|
|
21616
|
+
const left = key(a);
|
|
21617
|
+
return !!left && left === key(b);
|
|
21618
|
+
}
|
|
21619
|
+
function absoluteUrl(url) {
|
|
21620
|
+
const origin = globalThis.location?.origin;
|
|
21621
|
+
if (!origin || /^[a-z][a-z0-9+.-]*:\/\//i.test(url.trim())) return url;
|
|
21622
|
+
try {
|
|
21623
|
+
return new URL(url.trim() || "/", origin).href;
|
|
21624
|
+
} catch {
|
|
21625
|
+
return url;
|
|
21626
|
+
}
|
|
21627
|
+
}
|
|
21628
|
+
async function serverAt(manager, linked, url) {
|
|
21629
|
+
for (const [name, connection] of manager.connections) {
|
|
21630
|
+
if (!manager.isLinked(name) && sameServerUrl(connection.config.url, url)) return { name, byApp: true };
|
|
21631
|
+
}
|
|
21632
|
+
const saved = (await linked.list()).find((server) => sameServerUrl(server.url, url));
|
|
21633
|
+
return saved ? { name: saved.name, byApp: false } : void 0;
|
|
21634
|
+
}
|
|
21614
21635
|
async function replaceConnection(manager, config) {
|
|
21615
21636
|
const current = [...manager.connections.keys()].find((n) => n.toLowerCase() === config.name.toLowerCase());
|
|
21616
21637
|
const wasDefault = !!current && manager.defaultServer === current;
|
|
@@ -21655,6 +21676,17 @@ var ServerAddProcessor = class {
|
|
|
21655
21676
|
if (checked.mixedContent) {
|
|
21656
21677
|
writer.writeWarning(t.t("cli.server.link.mixed_content", "This page is served over https: the browser may block requests to an http server."));
|
|
21657
21678
|
}
|
|
21679
|
+
const same = await serverAt(manager, linked, url);
|
|
21680
|
+
if (same?.byApp) {
|
|
21681
|
+
writer.writeError(t.t("cli.server.link.same_as_app_server", "{url} is already configured by the app as '{name}'.", { url, name: same.name }));
|
|
21682
|
+
return;
|
|
21683
|
+
}
|
|
21684
|
+
if (same) {
|
|
21685
|
+
writer.writeWarning(t.t("cli.server.link.already_linked", "{url} is already linked as '{name}'.", { url, name: same.name }));
|
|
21686
|
+
const again = await reader.readConfirm(t.t("cli.server.link.link_again", "Link it again? It replaces '{name}' (a new token)", { name: same.name }), false);
|
|
21687
|
+
if (!again) return;
|
|
21688
|
+
}
|
|
21689
|
+
const replacing = same?.name;
|
|
21658
21690
|
let probe;
|
|
21659
21691
|
context2.spinner?.show(t.t("cli.server.link.checking", "Checking {url}\u2026", { url }));
|
|
21660
21692
|
try {
|
|
@@ -21671,8 +21703,8 @@ var ServerAddProcessor = class {
|
|
|
21671
21703
|
const go = await reader.readConfirm(t.t("cli.server.link.http_confirm", "Link it anyway?"), false);
|
|
21672
21704
|
if (!go) return;
|
|
21673
21705
|
}
|
|
21674
|
-
let name = args.name;
|
|
21675
|
-
if (name) {
|
|
21706
|
+
let name = args.name ?? replacing;
|
|
21707
|
+
if (name && name !== replacing) {
|
|
21676
21708
|
if (!await this.nameAvailable(context2, manager, linked, name)) return;
|
|
21677
21709
|
}
|
|
21678
21710
|
const tokenFlag = command2.args?.["token"];
|
|
@@ -21720,6 +21752,10 @@ var ServerAddProcessor = class {
|
|
|
21720
21752
|
const server = { name, url, addedAt: Date.now() };
|
|
21721
21753
|
const previous = (await linked.get(name))?.name;
|
|
21722
21754
|
if (previous && previous !== name) await linked.remove(previous);
|
|
21755
|
+
if (replacing && replacing.toLowerCase() !== name.toLowerCase()) {
|
|
21756
|
+
await linked.remove(replacing);
|
|
21757
|
+
if (manager.isLinked(replacing)) manager.removeServer(replacing);
|
|
21758
|
+
}
|
|
21723
21759
|
await linked.save(server, token);
|
|
21724
21760
|
const connection = await replaceConnection(manager, linkedServerConfig(server, token));
|
|
21725
21761
|
if (connection.connected) {
|
|
@@ -23865,6 +23901,143 @@ function createCompletionProviders(deps) {
|
|
|
23865
23901
|
return [...fromPlugins, ...builtIn];
|
|
23866
23902
|
}
|
|
23867
23903
|
|
|
23904
|
+
// src/lib/engine/cli-touch-scroll.ts
|
|
23905
|
+
var SLOP_PX = 8;
|
|
23906
|
+
var MIN_FLING = 0.15;
|
|
23907
|
+
var FRICTION = 0.997;
|
|
23908
|
+
var VELOCITY_WINDOW_MS = 100;
|
|
23909
|
+
var KEYBOARD_HOLD_MS = 400;
|
|
23910
|
+
function enableTouchScroll(terminal, paused = () => false) {
|
|
23911
|
+
const element = terminal.element;
|
|
23912
|
+
if (!element) {
|
|
23913
|
+
return () => {
|
|
23914
|
+
};
|
|
23915
|
+
}
|
|
23916
|
+
let startY = 0;
|
|
23917
|
+
let lastY = 0;
|
|
23918
|
+
let scrolling = false;
|
|
23919
|
+
let carry = 0;
|
|
23920
|
+
let moves = [];
|
|
23921
|
+
let frame = 0;
|
|
23922
|
+
let holdTimer = 0;
|
|
23923
|
+
let holding = false;
|
|
23924
|
+
const textarea = terminal.textarea;
|
|
23925
|
+
const keyboardOpen = () => window.innerHeight < screen.height * 0.75;
|
|
23926
|
+
const holdKeyboard = () => {
|
|
23927
|
+
clearTimeout(holdTimer);
|
|
23928
|
+
if (holding || !textarea || textarea.hasAttribute("inputmode") || keyboardOpen()) {
|
|
23929
|
+
return;
|
|
23930
|
+
}
|
|
23931
|
+
holding = true;
|
|
23932
|
+
textarea.setAttribute("inputmode", "none");
|
|
23933
|
+
};
|
|
23934
|
+
const releaseKeyboard = () => {
|
|
23935
|
+
clearTimeout(holdTimer);
|
|
23936
|
+
if (holding) {
|
|
23937
|
+
holding = false;
|
|
23938
|
+
textarea?.removeAttribute("inputmode");
|
|
23939
|
+
}
|
|
23940
|
+
};
|
|
23941
|
+
const rowHeight = () => {
|
|
23942
|
+
const screen2 = element.querySelector(".xterm-screen");
|
|
23943
|
+
return (screen2?.clientHeight || element.clientHeight) / terminal.rows || 16;
|
|
23944
|
+
};
|
|
23945
|
+
const scrollBy = (pixels) => {
|
|
23946
|
+
carry += pixels;
|
|
23947
|
+
const height = rowHeight();
|
|
23948
|
+
const rows = Math.trunc(carry / height);
|
|
23949
|
+
if (rows === 0) {
|
|
23950
|
+
return true;
|
|
23951
|
+
}
|
|
23952
|
+
carry -= rows * height;
|
|
23953
|
+
const buffer = terminal.buffer.active;
|
|
23954
|
+
const before = buffer.viewportY;
|
|
23955
|
+
terminal.scrollLines(-rows);
|
|
23956
|
+
const moved = buffer.viewportY !== before;
|
|
23957
|
+
if (!moved) {
|
|
23958
|
+
carry = 0;
|
|
23959
|
+
}
|
|
23960
|
+
return moved;
|
|
23961
|
+
};
|
|
23962
|
+
const stopGlide = () => {
|
|
23963
|
+
cancelAnimationFrame(frame);
|
|
23964
|
+
frame = 0;
|
|
23965
|
+
};
|
|
23966
|
+
const glide = (velocity) => {
|
|
23967
|
+
let previous = performance.now();
|
|
23968
|
+
const step = (now) => {
|
|
23969
|
+
const elapsed = Math.min(now - previous, 50);
|
|
23970
|
+
previous = now;
|
|
23971
|
+
velocity *= Math.pow(FRICTION, elapsed);
|
|
23972
|
+
if (Math.abs(velocity) < 0.02 || !scrollBy(velocity * elapsed)) {
|
|
23973
|
+
frame = 0;
|
|
23974
|
+
return;
|
|
23975
|
+
}
|
|
23976
|
+
frame = requestAnimationFrame(step);
|
|
23977
|
+
};
|
|
23978
|
+
frame = requestAnimationFrame(step);
|
|
23979
|
+
};
|
|
23980
|
+
const onStart = (e) => {
|
|
23981
|
+
stopGlide();
|
|
23982
|
+
scrolling = false;
|
|
23983
|
+
if (e.touches.length !== 1 || paused()) {
|
|
23984
|
+
return;
|
|
23985
|
+
}
|
|
23986
|
+
holdKeyboard();
|
|
23987
|
+
startY = lastY = e.touches[0].clientY;
|
|
23988
|
+
carry = 0;
|
|
23989
|
+
moves = [{ y: startY, time: e.timeStamp }];
|
|
23990
|
+
};
|
|
23991
|
+
const onMove = (e) => {
|
|
23992
|
+
if (e.touches.length !== 1 || paused() || moves.length === 0) {
|
|
23993
|
+
return;
|
|
23994
|
+
}
|
|
23995
|
+
const y = e.touches[0].clientY;
|
|
23996
|
+
if (!scrolling && Math.abs(y - startY) < SLOP_PX) {
|
|
23997
|
+
return;
|
|
23998
|
+
}
|
|
23999
|
+
scrolling = true;
|
|
24000
|
+
e.preventDefault();
|
|
24001
|
+
scrollBy(y - lastY);
|
|
24002
|
+
lastY = y;
|
|
24003
|
+
moves.push({ y, time: e.timeStamp });
|
|
24004
|
+
while (moves.length > 2 && e.timeStamp - moves[0].time > VELOCITY_WINDOW_MS) {
|
|
24005
|
+
moves.shift();
|
|
24006
|
+
}
|
|
24007
|
+
};
|
|
24008
|
+
const onEnd = (e) => {
|
|
24009
|
+
if (!scrolling) {
|
|
24010
|
+
releaseKeyboard();
|
|
24011
|
+
moves = [];
|
|
24012
|
+
return;
|
|
24013
|
+
}
|
|
24014
|
+
e.preventDefault();
|
|
24015
|
+
scrolling = false;
|
|
24016
|
+
holdTimer = window.setTimeout(releaseKeyboard, KEYBOARD_HOLD_MS);
|
|
24017
|
+
const first = moves[0];
|
|
24018
|
+
const last = moves[moves.length - 1];
|
|
24019
|
+
moves = [];
|
|
24020
|
+
const elapsed = last.time - first.time;
|
|
24021
|
+
const velocity = elapsed > 0 && e.timeStamp - last.time < VELOCITY_WINDOW_MS ? (last.y - first.y) / elapsed : 0;
|
|
24022
|
+
if (Math.abs(velocity) >= MIN_FLING) {
|
|
24023
|
+
glide(velocity);
|
|
24024
|
+
}
|
|
24025
|
+
};
|
|
24026
|
+
const options = { passive: false, capture: true };
|
|
24027
|
+
element.addEventListener("touchstart", onStart, options);
|
|
24028
|
+
element.addEventListener("touchmove", onMove, options);
|
|
24029
|
+
element.addEventListener("touchend", onEnd, options);
|
|
24030
|
+
element.addEventListener("touchcancel", onEnd, options);
|
|
24031
|
+
return () => {
|
|
24032
|
+
stopGlide();
|
|
24033
|
+
releaseKeyboard();
|
|
24034
|
+
element.removeEventListener("touchstart", onStart, options);
|
|
24035
|
+
element.removeEventListener("touchmove", onMove, options);
|
|
24036
|
+
element.removeEventListener("touchend", onEnd, options);
|
|
24037
|
+
element.removeEventListener("touchcancel", onEnd, options);
|
|
24038
|
+
};
|
|
24039
|
+
}
|
|
24040
|
+
|
|
23868
24041
|
// src/lib/engine/cli-engine.ts
|
|
23869
24042
|
var CliEngine = class {
|
|
23870
24043
|
constructor(container, options) {
|
|
@@ -23976,6 +24149,12 @@ var CliEngine = class {
|
|
|
23976
24149
|
this.serializeAddon = setup.serializeAddon;
|
|
23977
24150
|
this.dragDropService = setup.dragDropService;
|
|
23978
24151
|
this.wheelListener = setup.wheelListener;
|
|
24152
|
+
if (this.options?.touchScroll !== false) {
|
|
24153
|
+
this.disposeTouchScroll = enableTouchScroll(
|
|
24154
|
+
this.terminal,
|
|
24155
|
+
() => !!this.executionContext?.contextProcessor
|
|
24156
|
+
);
|
|
24157
|
+
}
|
|
23979
24158
|
this.handleResize();
|
|
23980
24159
|
}
|
|
23981
24160
|
/** 2. Service container, boot service, executor and execution context. */
|
|
@@ -24205,6 +24384,7 @@ var CliEngine = class {
|
|
|
24205
24384
|
if (this.wheelListener) {
|
|
24206
24385
|
this.container.removeEventListener("wheel", this.wheelListener);
|
|
24207
24386
|
}
|
|
24387
|
+
this.disposeTouchScroll?.();
|
|
24208
24388
|
this.resizeVersion = -1;
|
|
24209
24389
|
this.resizeScheduled = false;
|
|
24210
24390
|
this.resizeObserver?.disconnect();
|
|
@@ -25113,6 +25293,21 @@ var DARK_SCHEME_QUERY = "(prefers-color-scheme: dark)";
|
|
|
25113
25293
|
function asEventTarget(node) {
|
|
25114
25294
|
return node && typeof node.addEventListener === "function" ? node : null;
|
|
25115
25295
|
}
|
|
25296
|
+
function canScrollWithin(target, root, dx, dy) {
|
|
25297
|
+
for (let el = target; el && el !== root; el = el.parentElement) {
|
|
25298
|
+
if (!(el instanceof HTMLElement)) continue;
|
|
25299
|
+
const style = getComputedStyle(el);
|
|
25300
|
+
const scrollsY = /auto|scroll/.test(style.overflowY) && el.scrollHeight > el.clientHeight;
|
|
25301
|
+
const scrollsX = /auto|scroll/.test(style.overflowX) && el.scrollWidth > el.clientWidth;
|
|
25302
|
+
if (dy !== 0 && scrollsY) {
|
|
25303
|
+
if (dy < 0 ? el.scrollTop > 0 : el.scrollTop + el.clientHeight < el.scrollHeight) return true;
|
|
25304
|
+
}
|
|
25305
|
+
if (dx !== 0 && scrollsX) {
|
|
25306
|
+
if (dx < 0 ? el.scrollLeft > 0 : el.scrollLeft + el.clientWidth < el.scrollWidth) return true;
|
|
25307
|
+
}
|
|
25308
|
+
}
|
|
25309
|
+
return false;
|
|
25310
|
+
}
|
|
25116
25311
|
function followsSystem(input) {
|
|
25117
25312
|
return input === "auto" || typeof input === "object" && input !== null && input.base === "auto";
|
|
25118
25313
|
}
|
|
@@ -25194,6 +25389,16 @@ var CliPanelController = class {
|
|
|
25194
25389
|
if (event.target !== first) return;
|
|
25195
25390
|
this.syncThemeFromEngine(event.detail);
|
|
25196
25391
|
};
|
|
25392
|
+
/**
|
|
25393
|
+
* A wheel over the panel chrome (header, icon strip, empty pane) would
|
|
25394
|
+
* scroll the page behind it; the terminals already keep their own wheel.
|
|
25395
|
+
*/
|
|
25396
|
+
this.onPanelWheel = (event) => {
|
|
25397
|
+
const wheel = event;
|
|
25398
|
+
const root = this.rootElement;
|
|
25399
|
+
if (!root || canScrollWithin(wheel.target, root, wheel.deltaX, wheel.deltaY)) return;
|
|
25400
|
+
wheel.preventDefault();
|
|
25401
|
+
};
|
|
25197
25402
|
this.onVisualViewportChange = () => {
|
|
25198
25403
|
const fields = visualViewportFields();
|
|
25199
25404
|
const s = this.snapshot;
|
|
@@ -25302,9 +25507,13 @@ var CliPanelController = class {
|
|
|
25302
25507
|
/** Element containing the terminals, used for theme sync. */
|
|
25303
25508
|
setRootElement(element) {
|
|
25304
25509
|
if (element === this.rootElement) return;
|
|
25305
|
-
asEventTarget(this.rootElement)
|
|
25510
|
+
const previous = asEventTarget(this.rootElement);
|
|
25511
|
+
previous?.removeEventListener(CLI_TERMINAL_THEME_EVENT, this.onTerminalTheme);
|
|
25512
|
+
previous?.removeEventListener("wheel", this.onPanelWheel);
|
|
25306
25513
|
this.rootElement = element;
|
|
25307
|
-
asEventTarget(element)
|
|
25514
|
+
const next = asEventTarget(element);
|
|
25515
|
+
next?.addEventListener(CLI_TERMINAL_THEME_EVENT, this.onTerminalTheme);
|
|
25516
|
+
next?.addEventListener("wheel", this.onPanelWheel, { passive: false });
|
|
25308
25517
|
if (element && this.followsTerminalTheme) this.startThemeSync();
|
|
25309
25518
|
}
|
|
25310
25519
|
/**
|