@eum-agent/web-shell 1.0.1 → 1.1.0
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/ui/ui.js +198 -72
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"en-US": "Terminal",
|
|
5
5
|
"zh-CN": "终端"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.0
|
|
7
|
+
"version": "1.1.0",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"description": "Sessionless host-account interactive terminals",
|
|
10
10
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"lucide-react": "^1.40.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@eum-agent/plugin": "1.0
|
|
31
|
+
"@eum-agent/plugin": "1.1.0",
|
|
32
32
|
"@eum-agent/runtime": "1.0.0",
|
|
33
33
|
"@eum-agent/protocol": "1.0.0",
|
|
34
34
|
"@types/react": "^19.2.18",
|
package/ui/ui.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createContext, createElement, forwardRef, useContext, useEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { SettingsPreview, useDeviceFonts } from "@eum-agent/host/framework";
|
|
3
4
|
//#region ../../../node_modules/.pnpm/@xterm+xterm@6.0.0/node_modules/@xterm/xterm/css/xterm.css?inline
|
|
4
5
|
var xterm_default = "/**\n * Copyright (c) 2014 The xterm.js authors. All rights reserved.\n * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)\n * https://github.com/chjj/term.js\n * @license MIT\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n * Originally forked from (with the author's permission):\n * Fabrice Bellard's javascript vt100 for jslinux:\n * http://bellard.org/jslinux/\n * Copyright (c) 2011 Fabrice Bellard\n * The original design remains. The terminal itself\n * has been extended to include xterm CSI codes, among\n * other features.\n */\n\n/**\n * Default styles for xterm.js\n */\n\n.xterm {\n cursor: text;\n position: relative;\n user-select: none;\n -ms-user-select: none;\n -webkit-user-select: none;\n}\n\n.xterm.focus,\n.xterm:focus {\n outline: none;\n}\n\n.xterm .xterm-helpers {\n position: absolute;\n top: 0;\n /**\n * The z-index of the helpers must be higher than the canvases in order for\n * IMEs to appear on top.\n */\n z-index: 5;\n}\n\n.xterm .xterm-helper-textarea {\n padding: 0;\n border: 0;\n margin: 0;\n /* Move textarea out of the screen to the far left, so that the cursor is not visible */\n position: absolute;\n opacity: 0;\n left: -9999em;\n top: 0;\n width: 0;\n height: 0;\n z-index: -5;\n /** Prevent wrapping so the IME appears against the textarea at the correct position */\n white-space: nowrap;\n overflow: hidden;\n resize: none;\n}\n\n.xterm .composition-view {\n /* TODO: Composition position got messed up somewhere */\n background: #000;\n color: #FFF;\n display: none;\n position: absolute;\n white-space: nowrap;\n z-index: 1;\n}\n\n.xterm .composition-view.active {\n display: block;\n}\n\n.xterm .xterm-viewport {\n /* On OS X this is required in order for the scroll bar to appear fully opaque */\n background-color: #000;\n overflow-y: scroll;\n cursor: default;\n position: absolute;\n right: 0;\n left: 0;\n top: 0;\n bottom: 0;\n}\n\n.xterm .xterm-screen {\n position: relative;\n}\n\n.xterm .xterm-screen canvas {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.xterm-char-measure-element {\n display: inline-block;\n visibility: hidden;\n position: absolute;\n top: 0;\n left: -9999em;\n line-height: normal;\n}\n\n.xterm.enable-mouse-events {\n /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */\n cursor: default;\n}\n\n.xterm.xterm-cursor-pointer,\n.xterm .xterm-cursor-pointer {\n cursor: pointer;\n}\n\n.xterm.column-select.focus {\n /* Column selection mode */\n cursor: crosshair;\n}\n\n.xterm .xterm-accessibility:not(.debug),\n.xterm .xterm-message {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n z-index: 10;\n color: transparent;\n pointer-events: none;\n}\n\n.xterm .xterm-accessibility-tree:not(.debug) *::selection {\n color: transparent;\n}\n\n.xterm .xterm-accessibility-tree {\n font-family: monospace;\n user-select: text;\n white-space: pre;\n}\n\n.xterm .xterm-accessibility-tree > div {\n transform-origin: left;\n width: fit-content;\n}\n\n.xterm .live-region {\n position: absolute;\n left: -9999px;\n width: 1px;\n height: 1px;\n overflow: hidden;\n}\n\n.xterm-dim {\n /* Dim should not apply to background, so the opacity of the foreground color is applied\n * explicitly in the generated class and reset to 1 here */\n opacity: 1 !important;\n}\n\n.xterm-underline-1 { text-decoration: underline; }\n.xterm-underline-2 { text-decoration: double underline; }\n.xterm-underline-3 { text-decoration: wavy underline; }\n.xterm-underline-4 { text-decoration: dotted underline; }\n.xterm-underline-5 { text-decoration: dashed underline; }\n\n.xterm-overline {\n text-decoration: overline;\n}\n\n.xterm-overline.xterm-underline-1 { text-decoration: overline underline; }\n.xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }\n.xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }\n.xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }\n.xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }\n\n.xterm-strikethrough {\n text-decoration: line-through;\n}\n\n.xterm-screen .xterm-decoration-container .xterm-decoration {\n z-index: 6;\n position: absolute;\n}\n\n.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {\n z-index: 7;\n}\n\n.xterm-decoration-overview-ruler {\n z-index: 8;\n position: absolute;\n top: 0;\n right: 0;\n pointer-events: none;\n}\n\n.xterm-decoration-top {\n z-index: 2;\n position: relative;\n}\n\n\n\n/* Derived from vs/base/browser/ui/scrollbar/media/scrollbar.css */\n\n/* xterm.js customization: Override xterm's cursor style */\n.xterm .xterm-scrollable-element > .scrollbar {\n cursor: default;\n}\n\n/* Arrows */\n.xterm .xterm-scrollable-element > .scrollbar > .scra {\n cursor: pointer;\n font-size: 11px !important;\n}\n\n.xterm .xterm-scrollable-element > .visible {\n opacity: 1;\n\n /* Background rule added for IE9 - to allow clicks on dom node */\n background:rgba(0,0,0,0);\n\n transition: opacity 100ms linear;\n /* In front of peek view */\n z-index: 11;\n}\n.xterm .xterm-scrollable-element > .invisible {\n opacity: 0;\n pointer-events: none;\n}\n.xterm .xterm-scrollable-element > .invisible.fade {\n transition: opacity 800ms linear;\n}\n\n/* Scrollable Content Inset Shadow */\n.xterm .xterm-scrollable-element > .shadow {\n position: absolute;\n display: none;\n}\n.xterm .xterm-scrollable-element > .shadow.top {\n display: block;\n top: 0;\n left: 3px;\n height: 3px;\n width: 100%;\n box-shadow: var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset;\n}\n.xterm .xterm-scrollable-element > .shadow.left {\n display: block;\n top: 3px;\n left: 0;\n height: 100%;\n width: 3px;\n box-shadow: var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset;\n}\n.xterm .xterm-scrollable-element > .shadow.top-left-corner {\n display: block;\n top: 0;\n left: 0;\n height: 3px;\n width: 3px;\n}\n.xterm .xterm-scrollable-element > .shadow.top.left {\n box-shadow: var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset;\n}\n";
|
|
5
6
|
//#endregion
|
|
@@ -10,7 +11,16 @@ var CATALOGUES = {
|
|
|
10
11
|
settingsReadFailed: "Could not read settings in this browser. Defaults are in use.",
|
|
11
12
|
settingsWriteFailed: "Changes are applied but could not be saved in this browser; reloading may lose them.",
|
|
12
13
|
settingsText: "Text display",
|
|
14
|
+
settingsResetAppearance: "Reset appearance",
|
|
15
|
+
settingsPreview: "Preview",
|
|
16
|
+
settingsPreviewInfo: "Preview information",
|
|
17
|
+
settingsPreviewTerminal: "Terminal output",
|
|
18
|
+
settingsPreviewHint: "This fixed sample updates with your font, size and cursor choices, using system fallbacks for missing fonts. It sends no messages and runs no commands.",
|
|
13
19
|
settingsFontFamily: "Font Family",
|
|
20
|
+
settingsFontFamilyDefault: "Terminal default",
|
|
21
|
+
settingsFontMonospace: "System monospace",
|
|
22
|
+
settingsFontDiscoveryFailed: "Could not read device fonts",
|
|
23
|
+
settingsFontDiscoveryUnavailable: "Device fonts unavailable",
|
|
14
24
|
settingsFontFamilyError: "Enter a font family, up to 512 characters.",
|
|
15
25
|
settingsFontSize: "Font size",
|
|
16
26
|
settingsFontSizeError: "Enter a whole number from 8 to 32.",
|
|
@@ -22,6 +32,8 @@ var CATALOGUES = {
|
|
|
22
32
|
settingsCursorUnderline: "Underline",
|
|
23
33
|
settingsCursorBar: "Bar",
|
|
24
34
|
settingsCursorBlink: "Blinking cursor",
|
|
35
|
+
settingsEnabled: "On",
|
|
36
|
+
settingsDisabled: "Off",
|
|
25
37
|
settingsSessions: "Sessions",
|
|
26
38
|
settingsExitBehavior: "Session retention",
|
|
27
39
|
settingsExitKeep: "Keep all",
|
|
@@ -87,7 +99,16 @@ var CATALOGUES = {
|
|
|
87
99
|
settingsReadFailed: "无法读取此浏览器的设置,已使用默认值。",
|
|
88
100
|
settingsWriteFailed: "修改已应用,但无法保存在此浏览器;刷新后可能丢失。",
|
|
89
101
|
settingsText: "文本显示",
|
|
102
|
+
settingsResetAppearance: "恢复外观默认",
|
|
103
|
+
settingsPreview: "预览",
|
|
104
|
+
settingsPreviewInfo: "预览说明",
|
|
105
|
+
settingsPreviewTerminal: "终端输出",
|
|
106
|
+
settingsPreviewHint: "固定示例会随字体、字号和光标设置即时更新,字体缺失时使用系统回退。不会发送消息或执行命令。",
|
|
90
107
|
settingsFontFamily: "字体",
|
|
108
|
+
settingsFontFamilyDefault: "终端默认",
|
|
109
|
+
settingsFontMonospace: "系统等宽",
|
|
110
|
+
settingsFontDiscoveryFailed: "未能读取本机字体",
|
|
111
|
+
settingsFontDiscoveryUnavailable: "当前环境不支持读取字体",
|
|
91
112
|
settingsFontFamilyError: "请输入字体族,最多 512 个字符。",
|
|
92
113
|
settingsFontSize: "字号",
|
|
93
114
|
settingsFontSizeError: "请输入 8 到 32 之间的整数。",
|
|
@@ -99,6 +120,8 @@ var CATALOGUES = {
|
|
|
99
120
|
settingsCursorUnderline: "下划线",
|
|
100
121
|
settingsCursorBar: "竖线",
|
|
101
122
|
settingsCursorBlink: "光标闪烁",
|
|
123
|
+
settingsEnabled: "开启",
|
|
124
|
+
settingsDisabled: "关闭",
|
|
102
125
|
settingsSessions: "会话",
|
|
103
126
|
settingsExitBehavior: "会话保留方案",
|
|
104
127
|
settingsExitKeep: "不移除",
|
|
@@ -16910,6 +16933,7 @@ function createTerminalPreferences(signal) {
|
|
|
16910
16933
|
} catch {
|
|
16911
16934
|
problem = "read";
|
|
16912
16935
|
}
|
|
16936
|
+
let appearanceResetRevision = 0;
|
|
16913
16937
|
const listeners = /* @__PURE__ */ new Set();
|
|
16914
16938
|
let disposed = signal.aborted;
|
|
16915
16939
|
const update = (patch) => {
|
|
@@ -16958,6 +16982,7 @@ function createTerminalPreferences(signal) {
|
|
|
16958
16982
|
return {
|
|
16959
16983
|
getState: () => state,
|
|
16960
16984
|
getProblem: () => problem,
|
|
16985
|
+
getAppearanceResetRevision: () => appearanceResetRevision,
|
|
16961
16986
|
subscribe: (listener) => {
|
|
16962
16987
|
if (disposed) return () => {};
|
|
16963
16988
|
listeners.add(listener);
|
|
@@ -16966,8 +16991,19 @@ function createTerminalPreferences(signal) {
|
|
|
16966
16991
|
};
|
|
16967
16992
|
},
|
|
16968
16993
|
update,
|
|
16969
|
-
reset: () => {
|
|
16970
|
-
|
|
16994
|
+
reset: (scope) => {
|
|
16995
|
+
if (disposed) return;
|
|
16996
|
+
const { fontFamily, fontSize, cursorStyle, cursorBlink, exitBehavior } = DEFAULT_TERMINAL_PREFERENCES;
|
|
16997
|
+
update(scope === "appearance" ? {
|
|
16998
|
+
fontFamily,
|
|
16999
|
+
fontSize,
|
|
17000
|
+
cursorStyle,
|
|
17001
|
+
cursorBlink
|
|
17002
|
+
} : { exitBehavior });
|
|
17003
|
+
if (scope === "appearance") {
|
|
17004
|
+
appearanceResetRevision += 1;
|
|
17005
|
+
for (const listener of listeners) listener();
|
|
17006
|
+
}
|
|
16971
17007
|
},
|
|
16972
17008
|
dispose
|
|
16973
17009
|
};
|
|
@@ -17784,6 +17820,7 @@ function TerminalScreen({ ctx, store, preferences, terminal, visible, renaming,
|
|
|
17784
17820
|
onClick: () => setPaste(void 0),
|
|
17785
17821
|
children: t("cancel")
|
|
17786
17822
|
}), /* @__PURE__ */ jsx(Button, {
|
|
17823
|
+
variant: "primary",
|
|
17787
17824
|
disabled: !writer || paste.length > 32768,
|
|
17788
17825
|
onClick: () => {
|
|
17789
17826
|
display.current?.paste(paste);
|
|
@@ -17817,6 +17854,7 @@ function TerminalScreen({ ctx, store, preferences, terminal, visible, renaming,
|
|
|
17817
17854
|
onClick: () => setTakeover(false),
|
|
17818
17855
|
children: t("cancel")
|
|
17819
17856
|
}), /* @__PURE__ */ jsx(Button, {
|
|
17857
|
+
variant: "primary",
|
|
17820
17858
|
disabled: !state.online || !connection.current,
|
|
17821
17859
|
onClick: () => {
|
|
17822
17860
|
connection.current?.takeover().catch((error) => setProblem(String(error)));
|
|
@@ -18059,7 +18097,9 @@ function ShellPage({ ctx, store, preferences = store.preferences }) {
|
|
|
18059
18097
|
}
|
|
18060
18098
|
//#endregion
|
|
18061
18099
|
//#region ui-src/settings.tsx
|
|
18100
|
+
/** Terminal appearance and session behavior share one browser-local preference store. */
|
|
18062
18101
|
function FontPreference({ ctx, preferences, value }) {
|
|
18102
|
+
const device = useDeviceFonts(ctx.signal, ctx.services.get("native-device-fonts"));
|
|
18063
18103
|
const [draft, setDraft] = useState(value);
|
|
18064
18104
|
useEffect(() => setDraft(value), [value]);
|
|
18065
18105
|
const t = ctx.i18n.t;
|
|
@@ -18068,13 +18108,30 @@ function FontPreference({ ctx, preferences, value }) {
|
|
|
18068
18108
|
label: t("settingsFontFamily"),
|
|
18069
18109
|
error: valid ? void 0 : t("settingsFontFamilyError"),
|
|
18070
18110
|
inline: true,
|
|
18071
|
-
|
|
18111
|
+
className: "settings-field-row flex flex-row flex-wrap items-center justify-between [&>div:nth-child(2)]:ml-auto",
|
|
18112
|
+
children: (binding) => /* @__PURE__ */ jsx(ctx.ui.FontPicker, {
|
|
18072
18113
|
...binding,
|
|
18073
|
-
"
|
|
18114
|
+
className: "w-72 max-w-full",
|
|
18115
|
+
label: t("settingsFontFamily"),
|
|
18116
|
+
onLoadFonts: device.available ? device.load : void 0,
|
|
18117
|
+
loading: device.loading,
|
|
18118
|
+
loadError: device.failed ? t("settingsFontDiscoveryFailed") : void 0,
|
|
18119
|
+
loadUnavailable: !device.available ? t("settingsFontDiscoveryUnavailable") : void 0,
|
|
18120
|
+
options: [
|
|
18121
|
+
...device.options,
|
|
18122
|
+
{
|
|
18123
|
+
value: DEFAULT_TERMINAL_PREFERENCES.fontFamily,
|
|
18124
|
+
label: t("settingsFontFamilyDefault")
|
|
18125
|
+
},
|
|
18126
|
+
{
|
|
18127
|
+
value: "monospace",
|
|
18128
|
+
label: t("settingsFontMonospace")
|
|
18129
|
+
}
|
|
18130
|
+
],
|
|
18074
18131
|
value: draft,
|
|
18075
|
-
|
|
18076
|
-
setDraft(
|
|
18077
|
-
preferences.update({ fontFamily:
|
|
18132
|
+
onValueChange: (value) => {
|
|
18133
|
+
setDraft(value);
|
|
18134
|
+
preferences.update({ fontFamily: value });
|
|
18078
18135
|
}
|
|
18079
18136
|
})
|
|
18080
18137
|
});
|
|
@@ -18088,6 +18145,7 @@ function FontSizePreference({ ctx, preferences, value }) {
|
|
|
18088
18145
|
label: t("settingsFontSize"),
|
|
18089
18146
|
error: valid ? void 0 : t("settingsFontSizeError"),
|
|
18090
18147
|
inline: true,
|
|
18148
|
+
className: "settings-field-row flex flex-row flex-wrap items-center justify-between [&>div:nth-child(2)]:ml-auto",
|
|
18091
18149
|
children: (binding) => /* @__PURE__ */ jsx("div", {
|
|
18092
18150
|
className: "ws-settings-number",
|
|
18093
18151
|
children: /* @__PURE__ */ jsx(ctx.ui.InputNumber, {
|
|
@@ -18108,11 +18166,17 @@ function FontSizePreference({ ctx, preferences, value }) {
|
|
|
18108
18166
|
})
|
|
18109
18167
|
});
|
|
18110
18168
|
}
|
|
18111
|
-
|
|
18169
|
+
function StorageProblem({ ctx, preferences }) {
|
|
18170
|
+
const problem = useSyncExternalStore(preferences.subscribe, preferences.getProblem);
|
|
18171
|
+
return problem ? /* @__PURE__ */ jsx("p", {
|
|
18172
|
+
role: "alert",
|
|
18173
|
+
className: "ws-settings-error",
|
|
18174
|
+
children: ctx.i18n.t(problem === "read" ? "settingsReadFailed" : "settingsWriteFailed")
|
|
18175
|
+
}) : null;
|
|
18176
|
+
}
|
|
18177
|
+
/** Session-retention settings keep their existing system-settings page and storage record. */
|
|
18112
18178
|
function TerminalSettings({ ctx, preferences }) {
|
|
18113
18179
|
const value = useSyncExternalStore(preferences.subscribe, preferences.getState);
|
|
18114
|
-
const problem = useSyncExternalStore(preferences.subscribe, preferences.getProblem);
|
|
18115
|
-
const [reset, setReset] = useState(0);
|
|
18116
18180
|
const t = ctx.i18n.t;
|
|
18117
18181
|
return /* @__PURE__ */ jsxs("div", {
|
|
18118
18182
|
className: "ws-settings",
|
|
@@ -18125,35 +18189,76 @@ function TerminalSettings({ ctx, preferences }) {
|
|
|
18125
18189
|
type: "button",
|
|
18126
18190
|
variant: "text",
|
|
18127
18191
|
className: "min-w-0 text-right",
|
|
18128
|
-
onClick: () =>
|
|
18129
|
-
preferences.reset();
|
|
18130
|
-
setReset((current) => current + 1);
|
|
18131
|
-
},
|
|
18192
|
+
onClick: () => preferences.reset("behavior"),
|
|
18132
18193
|
children: t("settingsReset")
|
|
18133
18194
|
})]
|
|
18134
18195
|
}), /* @__PURE__ */ jsxs("div", {
|
|
18135
18196
|
className: "ws-settings-body @container flex min-h-0 flex-1 flex-col gap-6 px-6 pb-6 pt-1",
|
|
18136
|
-
children: [
|
|
18137
|
-
|
|
18138
|
-
|
|
18139
|
-
|
|
18140
|
-
|
|
18141
|
-
|
|
18142
|
-
|
|
18143
|
-
|
|
18144
|
-
|
|
18145
|
-
|
|
18146
|
-
|
|
18147
|
-
|
|
18148
|
-
|
|
18149
|
-
|
|
18150
|
-
|
|
18151
|
-
|
|
18152
|
-
|
|
18153
|
-
|
|
18154
|
-
|
|
18155
|
-
|
|
18156
|
-
|
|
18197
|
+
children: [/* @__PURE__ */ jsx(StorageProblem, {
|
|
18198
|
+
ctx,
|
|
18199
|
+
preferences
|
|
18200
|
+
}), /* @__PURE__ */ jsx(ctx.ui.SettingsPanel, {
|
|
18201
|
+
title: t("settingsSessions"),
|
|
18202
|
+
children: /* @__PURE__ */ jsx(ctx.ui.SettingsPanel, {
|
|
18203
|
+
title: t("settingsExitBehavior"),
|
|
18204
|
+
level: "field",
|
|
18205
|
+
inline: true,
|
|
18206
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
18207
|
+
className: "ws-settings-choice flex min-w-0 justify-end",
|
|
18208
|
+
children: /* @__PURE__ */ jsx(ctx.ui.Segmented, {
|
|
18209
|
+
label: t("settingsExitBehavior"),
|
|
18210
|
+
value: value.exitBehavior,
|
|
18211
|
+
options: [
|
|
18212
|
+
{
|
|
18213
|
+
value: "keep",
|
|
18214
|
+
label: t("settingsExitKeep")
|
|
18215
|
+
},
|
|
18216
|
+
{
|
|
18217
|
+
value: "on-success",
|
|
18218
|
+
label: t("settingsExitSuccess")
|
|
18219
|
+
},
|
|
18220
|
+
{
|
|
18221
|
+
value: "remove",
|
|
18222
|
+
label: t("settingsExitRemove")
|
|
18223
|
+
}
|
|
18224
|
+
],
|
|
18225
|
+
onSelect: (exitBehavior) => preferences.update({ exitBehavior })
|
|
18226
|
+
})
|
|
18227
|
+
})
|
|
18228
|
+
})
|
|
18229
|
+
})]
|
|
18230
|
+
})]
|
|
18231
|
+
});
|
|
18232
|
+
}
|
|
18233
|
+
/** Appearance content uses the personalization host's title, spacing and scroll container. */
|
|
18234
|
+
function TerminalPersonalization({ ctx, preferences }) {
|
|
18235
|
+
const value = useSyncExternalStore(preferences.subscribe, preferences.getState);
|
|
18236
|
+
const reset = useSyncExternalStore(preferences.subscribe, preferences.getAppearanceResetRevision);
|
|
18237
|
+
const t = ctx.i18n.t;
|
|
18238
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
18239
|
+
className: "ws-personalization @container flex min-w-0 flex-1 flex-col gap-6",
|
|
18240
|
+
children: [
|
|
18241
|
+
/* @__PURE__ */ jsx(StorageProblem, {
|
|
18242
|
+
ctx,
|
|
18243
|
+
preferences
|
|
18244
|
+
}),
|
|
18245
|
+
/* @__PURE__ */ jsxs(ctx.ui.SettingsPanel, {
|
|
18246
|
+
title: t("settingsText"),
|
|
18247
|
+
children: [/* @__PURE__ */ jsx(FontPreference, {
|
|
18248
|
+
ctx,
|
|
18249
|
+
preferences,
|
|
18250
|
+
value: value.fontFamily
|
|
18251
|
+
}, `font-${reset}`), /* @__PURE__ */ jsx(FontSizePreference, {
|
|
18252
|
+
ctx,
|
|
18253
|
+
preferences,
|
|
18254
|
+
value: value.fontSize
|
|
18255
|
+
}, `size-${reset}`)]
|
|
18256
|
+
}),
|
|
18257
|
+
/* @__PURE__ */ jsxs(ctx.ui.SettingsPanel, {
|
|
18258
|
+
title: t("settingsCursor"),
|
|
18259
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
18260
|
+
className: "[&>section]:flex-row [&>section]:flex-wrap [&>section]:items-center [&>section]:justify-between [&>section>div]:ml-auto",
|
|
18261
|
+
children: /* @__PURE__ */ jsx(ctx.ui.SettingsPanel, {
|
|
18157
18262
|
title: t("settingsCursorStyle"),
|
|
18158
18263
|
level: "field",
|
|
18159
18264
|
inline: true,
|
|
@@ -18179,52 +18284,61 @@ function TerminalSettings({ ctx, preferences }) {
|
|
|
18179
18284
|
onSelect: (cursorStyle) => preferences.update({ cursorStyle })
|
|
18180
18285
|
})
|
|
18181
18286
|
})
|
|
18182
|
-
})
|
|
18287
|
+
})
|
|
18288
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
18289
|
+
className: "[&>section]:flex-row [&>section]:flex-wrap [&>section]:items-center [&>section]:justify-between [&>section>div]:ml-auto",
|
|
18290
|
+
children: /* @__PURE__ */ jsx(ctx.ui.SettingsPanel, {
|
|
18183
18291
|
title: t("settingsCursorBlink"),
|
|
18184
18292
|
level: "field",
|
|
18185
18293
|
inline: true,
|
|
18186
18294
|
children: /* @__PURE__ */ jsx("div", {
|
|
18187
18295
|
className: "flex min-w-0 justify-end",
|
|
18188
|
-
children: /* @__PURE__ */ jsx(ctx.ui.Switch, {
|
|
18189
|
-
"aria-label": t("settingsCursorBlink"),
|
|
18190
|
-
checked: value.cursorBlink,
|
|
18191
|
-
onCheckedChange: (cursorBlink) => preferences.update({ cursorBlink })
|
|
18192
|
-
})
|
|
18193
|
-
})
|
|
18194
|
-
})]
|
|
18195
|
-
}),
|
|
18196
|
-
/* @__PURE__ */ jsx(ctx.ui.SettingsPanel, {
|
|
18197
|
-
title: t("settingsSessions"),
|
|
18198
|
-
children: /* @__PURE__ */ jsx(ctx.ui.SettingsPanel, {
|
|
18199
|
-
title: t("settingsExitBehavior"),
|
|
18200
|
-
level: "field",
|
|
18201
|
-
inline: true,
|
|
18202
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
18203
|
-
className: "ws-settings-choice flex min-w-0 justify-end",
|
|
18204
18296
|
children: /* @__PURE__ */ jsx(ctx.ui.Segmented, {
|
|
18205
|
-
label: t("
|
|
18206
|
-
value: value.
|
|
18207
|
-
options: [
|
|
18208
|
-
|
|
18209
|
-
|
|
18210
|
-
|
|
18211
|
-
|
|
18212
|
-
|
|
18213
|
-
|
|
18214
|
-
|
|
18215
|
-
},
|
|
18216
|
-
{
|
|
18217
|
-
value: "remove",
|
|
18218
|
-
label: t("settingsExitRemove")
|
|
18219
|
-
}
|
|
18220
|
-
],
|
|
18221
|
-
onSelect: (exitBehavior) => preferences.update({ exitBehavior })
|
|
18297
|
+
label: t("settingsCursorBlink"),
|
|
18298
|
+
value: value.cursorBlink ? "on" : "off",
|
|
18299
|
+
options: [{
|
|
18300
|
+
value: "on",
|
|
18301
|
+
label: t("settingsEnabled")
|
|
18302
|
+
}, {
|
|
18303
|
+
value: "off",
|
|
18304
|
+
label: t("settingsDisabled")
|
|
18305
|
+
}],
|
|
18306
|
+
onSelect: (next) => preferences.update({ cursorBlink: next === "on" })
|
|
18222
18307
|
})
|
|
18223
18308
|
})
|
|
18224
18309
|
})
|
|
18225
|
-
})
|
|
18226
|
-
|
|
18227
|
-
|
|
18310
|
+
})]
|
|
18311
|
+
}),
|
|
18312
|
+
/* @__PURE__ */ jsxs(SettingsPreview, {
|
|
18313
|
+
title: t("settingsPreview"),
|
|
18314
|
+
infoLabel: t("settingsPreviewInfo"),
|
|
18315
|
+
description: t("settingsPreviewHint"),
|
|
18316
|
+
kind: t("settingsPreviewTerminal"),
|
|
18317
|
+
canvasClassName: "ws-settings-preview",
|
|
18318
|
+
canvasStyle: {
|
|
18319
|
+
fontFamily: terminalFontFamily(value.fontFamily),
|
|
18320
|
+
fontSize: value.fontSize
|
|
18321
|
+
},
|
|
18322
|
+
children: [
|
|
18323
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
|
|
18324
|
+
className: "ws-preview-prompt",
|
|
18325
|
+
children: "➜"
|
|
18326
|
+
}), " ~/yaoguang"] }),
|
|
18327
|
+
/* @__PURE__ */ jsx("div", { children: "$ echo \"Hello, 瑶光\"" }),
|
|
18328
|
+
/* @__PURE__ */ jsx("div", { children: "Hello, 瑶光" }),
|
|
18329
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
18330
|
+
"$",
|
|
18331
|
+
" ",
|
|
18332
|
+
/* @__PURE__ */ jsx("span", {
|
|
18333
|
+
"aria-hidden": "true",
|
|
18334
|
+
className: "ws-preview-cursor",
|
|
18335
|
+
"data-cursor-style": value.cursorStyle,
|
|
18336
|
+
"data-blink": value.cursorBlink
|
|
18337
|
+
})
|
|
18338
|
+
] })
|
|
18339
|
+
]
|
|
18340
|
+
})
|
|
18341
|
+
]
|
|
18228
18342
|
});
|
|
18229
18343
|
}
|
|
18230
18344
|
//#endregion
|
|
@@ -18811,6 +18925,7 @@ var STYLES = `
|
|
|
18811
18925
|
.ws-page .ws-terminal .xterm .xterm-decoration-overview-ruler{visibility:hidden}
|
|
18812
18926
|
.ws-settings-error{margin:0;color:var(--destructive);font-size:12px;line-height:20px}
|
|
18813
18927
|
.ws-settings{display:flex;flex-direction:column;flex:1;min-width:0;min-height:0}.ws-settings-body{overflow:auto;min-height:0}.ws-settings-choice [data-slot=segmented]{max-width:100%;width:auto;flex-wrap:wrap}
|
|
18928
|
+
.ws-settings-preview{background:#141820;color:#e8ecf2;line-height:1.7;white-space:pre}.ws-preview-prompt{color:#8cccaf}.ws-preview-cursor{display:inline-block;width:.6em;height:1.15em;vertical-align:-.15em;background:currentColor}.ws-preview-cursor[data-cursor-style=bar]{width:2px}.ws-preview-cursor[data-cursor-style=underline]{height:2px;vertical-align:-.15em}.ws-preview-cursor[data-blink=true]{animation:ws-preview-blink 1.2s step-end infinite}@keyframes ws-preview-blink{50%{opacity:0}}@media(prefers-reduced-motion:reduce){.ws-preview-cursor{animation:none!important}}
|
|
18814
18929
|
.ws-settings-number{display:flex;min-width:0;flex-direction:column;align-items:flex-end;gap:.25rem}.ws-settings-number>*{width:9rem;max-width:100%}
|
|
18815
18930
|
.ws-page{height:100%;min-height:0;min-width:0;display:grid;grid-template-columns:288px minmax(0,1fr);overflow:hidden;background:var(--background);color:var(--foreground);position:relative}
|
|
18816
18931
|
.ws-sessions{display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--background);border-inline-end:1px solid var(--border)}
|
|
@@ -18860,6 +18975,17 @@ var register = (ctx) => {
|
|
|
18860
18975
|
preferences
|
|
18861
18976
|
})
|
|
18862
18977
|
});
|
|
18978
|
+
ctx.slots.register("shell.personalization.category", {
|
|
18979
|
+
id: "terminal-personalization",
|
|
18980
|
+
onReset: () => preferences.reset("appearance"),
|
|
18981
|
+
order: 30,
|
|
18982
|
+
label: () => ctx.i18n.t("nav"),
|
|
18983
|
+
icon: "terminal",
|
|
18984
|
+
component: () => /* @__PURE__ */ jsx(TerminalPersonalization, {
|
|
18985
|
+
ctx,
|
|
18986
|
+
preferences
|
|
18987
|
+
})
|
|
18988
|
+
});
|
|
18863
18989
|
ctx.services.provide("web-shell-launcher", store.launcher);
|
|
18864
18990
|
};
|
|
18865
18991
|
//#endregion
|