dsh-bash-terminal-ts 0.6.1 → 0.6.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.
@@ -1,139 +1,141 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/client.tsx
20
- var client_exports = {};
21
- __export(client_exports, {
22
- apply: () => apply,
23
- inject: () => inject
24
- });
25
- module.exports = __toCommonJS(client_exports);
26
- var import_react = require("react");
27
- var import_dsh_client_store = require("@deepseek-ai/dsh-client-store");
28
- var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
29
- var import_jsx_runtime = require("react/jsx-runtime");
30
- var SETTINGS_NS = "settings.bash-terminal";
31
- var ENTRY_ID = "tool-bash-terminal";
32
- var SHELLS = ["powershell", "gitbash", "msys2", "wsl"];
33
- var ROW_CSS = ".btRow{border-bottom:1px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}.btRowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}.btTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}.btDesc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}.btSelector{background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;border-radius:18px;align-items:center;gap:12px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.btSelector:hover{background:var(--dsw-alias-interactive-bg-hover)}.btChevron{flex:none}";
34
- if (typeof document !== "undefined" && document.querySelector('style[data-plugin-css="bash-terminal-row"]') === null) {
35
- const tag = document.createElement("style");
36
- tag.dataset.plugin = "dsh-bash-terminal";
37
- tag.dataset.pluginCss = "bash-terminal-row";
38
- tag.textContent = ROW_CSS;
39
- document.head.appendChild(tag);
40
- }
41
- var zh = {
42
- "shell.title": "\u9ED8\u8BA4\u7EC8\u7AEF",
43
- "shell.description": "shell \u5DE5\u5177\u6267\u884C\u547D\u4EE4\u65F6\u4F7F\u7528\u7684\u7EC8\u7AEF",
44
- "shell.powershell": "PowerShell",
45
- "shell.gitbash": "Git Bash",
46
- "shell.msys2": "MSYS2",
47
- "shell.wsl": "WSL"
48
- };
49
- var en = {
50
- "shell.title": "Default terminal",
51
- "shell.description": "Terminal used by the shell tool",
52
- "shell.powershell": "PowerShell",
53
- "shell.gitbash": "Git Bash",
54
- "shell.msys2": "MSYS2",
55
- "shell.wsl": "WSL"
56
- };
57
- var inject = ["slots", "locale", "configForms"];
58
- function ShellPreferenceRow({ t, useStore, setShell }) {
59
- const shell = useStore((s) => s.shell);
60
- const writable = useStore((s) => s.writable);
61
- const [open, setOpen] = (0, import_react.useState)(false);
62
- const items = SHELLS.map((id) => ({ id, label: t("shell." + id) }));
63
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRow", children: [
64
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
65
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
66
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.description") })
67
- ] }),
68
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
69
- import_dsh_client_ui_primitives.Menu,
70
- {
71
- open,
72
- onClose: () => setOpen(false),
73
- items,
74
- selectedId: shell,
75
- onSelect: (id) => {
76
- setOpen(false);
77
- setShell(id);
78
- },
79
- align: "end",
80
- portal: true,
81
- anchor: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
82
- "button",
83
- {
84
- type: "button",
85
- className: "btSelector",
86
- "aria-haspopup": "menu",
87
- "aria-expanded": open,
88
- disabled: !writable,
89
- onClick: () => setOpen(!open),
90
- style: !writable ? { opacity: 0.5, cursor: "not-allowed" } : void 0,
91
- children: [
92
- t("shell." + shell),
93
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronDownOutline14, { className: "btChevron" })
94
- ]
95
- }
96
- )
97
- }
98
- )
99
- ] });
100
- }
101
- function apply(ctx) {
102
- ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh, en }), "bash-terminal: settings dictionaries");
103
- const scope = ctx.configForms.get(ENTRY_ID);
104
- const store = (0, import_dsh_client_store.defineStore)({
105
- init: () => ({ shell: "powershell", revision: -1, writable: false }),
106
- actions: {
107
- sync: (d, shell, revision, writable) => {
108
- if (revision !== void 0 && revision <= d.revision) return;
109
- if (shell !== void 0) d.shell = shell;
110
- if (revision !== void 0) d.revision = revision;
111
- if (writable !== void 0) d.writable = writable;
112
- }
113
- }
114
- });
115
- let bound;
116
- const push = (snap) => {
117
- bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable);
118
- };
119
- ctx.slots.inject(
120
- "settings.general.item",
121
- () => ctx.slots.register(
122
- {
123
- name: "settings.general.item",
124
- id: "bash-terminal-shell",
125
- order: 20,
126
- store,
127
- locale: SETTINGS_NS,
128
- inject: (actions) => {
129
- bound = actions;
130
- push(scope.getSnapshot());
131
- return { setShell: (value) => void scope.set("defaultShell", value) };
132
- }
133
- },
134
- ShellPreferenceRow
135
- ),
136
- "bash-terminal: settings row"
137
- );
138
- ctx.effect(() => scope.subscribe(() => push(scope.getSnapshot())), "bash-terminal: settings watch");
139
- }
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/client.tsx
20
+ var client_exports = {};
21
+ __export(client_exports, {
22
+ apply: () => apply,
23
+ inject: () => inject
24
+ });
25
+ module.exports = __toCommonJS(client_exports);
26
+ var import_react = require("react");
27
+ var import_dsh_client_store = require("@deepseek-ai/dsh-client-store");
28
+ var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
29
+ var import_jsx_runtime = require("react/jsx-runtime");
30
+ var SETTINGS_NS = "settings.bash-terminal";
31
+ var ENTRY_ID = "tool-bash-terminal";
32
+ var SHELLS = ["powershell", "gitbash", "msys2", "wsl"];
33
+ var ROW_CSS = ".btRow{border-bottom:1px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}.btRowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}.btTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}.btDesc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}.btSelector{background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;border-radius:18px;align-items:center;gap:12px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.btSelector:hover{background:var(--dsw-alias-interactive-bg-hover)}.btChevron{flex:none}";
34
+ if (typeof document !== "undefined" && document.querySelector('style[data-plugin-css="bash-terminal-row"]') === null) {
35
+ const tag = document.createElement("style");
36
+ tag.dataset.plugin = "dsh-bash-terminal";
37
+ tag.dataset.pluginCss = "bash-terminal-row";
38
+ tag.textContent = ROW_CSS;
39
+ document.head.appendChild(tag);
40
+ }
41
+ var zh = {
42
+ "shell.title": "\u9ED8\u8BA4\u7EC8\u7AEF",
43
+ "shell.description": "shell \u5DE5\u5177\u6267\u884C\u547D\u4EE4\u65F6\u4F7F\u7528\u7684\u7EC8\u7AEF",
44
+ "shell.powershell": "PowerShell",
45
+ "shell.gitbash": "Git Bash",
46
+ "shell.msys2": "MSYS2",
47
+ "shell.wsl": "WSL"
48
+ };
49
+ var en = {
50
+ "shell.title": "Default terminal",
51
+ "shell.description": "Terminal used by the shell tool",
52
+ "shell.powershell": "PowerShell",
53
+ "shell.gitbash": "Git Bash",
54
+ "shell.msys2": "MSYS2",
55
+ "shell.wsl": "WSL"
56
+ };
57
+ var inject = ["slots", "locale", "configForms"];
58
+ function ShellPreferenceRow({ t, useStore, setShell }) {
59
+ const shell = useStore((s) => s.shell);
60
+ const writable = useStore((s) => s.writable);
61
+ const [open, setOpen] = (0, import_react.useState)(false);
62
+ const items = SHELLS.map((id) => ({ id, label: t("shell." + id) }));
63
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRow", children: [
64
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
65
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
66
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.description") })
67
+ ] }),
68
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
69
+ import_dsh_client_ui_primitives.Menu,
70
+ {
71
+ open,
72
+ onClose: () => setOpen(false),
73
+ items,
74
+ selectedId: shell,
75
+ onSelect: (id) => {
76
+ setOpen(false);
77
+ setShell(id);
78
+ },
79
+ align: "end",
80
+ portal: true,
81
+ anchor: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
82
+ "button",
83
+ {
84
+ type: "button",
85
+ className: "btSelector",
86
+ "aria-haspopup": "menu",
87
+ "aria-expanded": open,
88
+ disabled: !writable,
89
+ onClick: () => setOpen(!open),
90
+ style: !writable ? { opacity: 0.5, cursor: "not-allowed" } : void 0,
91
+ children: [
92
+ t("shell." + shell),
93
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronDownOutlineMedium, { className: "btChevron" })
94
+ ]
95
+ }
96
+ )
97
+ }
98
+ )
99
+ ] });
100
+ }
101
+ var zhDictTitle = () => zh["shell.title"] ?? "\u7EC8\u7AEF";
102
+ function apply(ctx) {
103
+ ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh, en }), "bash-terminal: settings dictionaries");
104
+ const scope = ctx.configForms.get(ENTRY_ID);
105
+ const store = (0, import_dsh_client_store.defineStore)({
106
+ init: () => ({ shell: "powershell", revision: -1, writable: false }),
107
+ actions: {
108
+ sync: (d, shell, revision, writable) => {
109
+ if (revision !== void 0 && revision <= d.revision) return;
110
+ if (shell !== void 0) d.shell = shell;
111
+ if (revision !== void 0) d.revision = revision;
112
+ if (writable !== void 0) d.writable = writable;
113
+ }
114
+ }
115
+ });
116
+ let bound;
117
+ const push = (snap) => {
118
+ bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable);
119
+ };
120
+ ctx.slots.inject(
121
+ "dsh-family.tab",
122
+ () => ctx.slots.register(
123
+ {
124
+ name: "dsh-family.tab",
125
+ id: "bash-terminal-shell",
126
+ order: 60,
127
+ label: () => zhDictTitle(),
128
+ store,
129
+ locale: SETTINGS_NS,
130
+ inject: (actions) => {
131
+ bound = actions;
132
+ push(scope.getSnapshot());
133
+ return { setShell: (value) => void scope.set("defaultShell", value) };
134
+ }
135
+ },
136
+ ShellPreferenceRow
137
+ ),
138
+ "bash-terminal: settings row"
139
+ );
140
+ ctx.effect(() => scope.subscribe(() => push(scope.getSnapshot())), "bash-terminal: settings watch");
141
+ }
package/dist/client.js CHANGED
@@ -1,148 +1,150 @@
1
- window.__ModuleLoader__.load({
2
- id: "dsh-bash-terminal",
3
- factory: (require) => {
4
- var module = { exports: {} };
5
- var exports = module.exports;
6
- var __defProp = Object.defineProperty;
7
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
- var __getOwnPropNames = Object.getOwnPropertyNames;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
-
24
- // src/client.tsx
25
- var client_exports = {};
26
- __export(client_exports, {
27
- apply: () => apply,
28
- inject: () => inject
29
- });
30
- module.exports = __toCommonJS(client_exports);
31
- var import_react = require("react");
32
- var import_dsh_client_store = require("@deepseek-ai/dsh-client-store");
33
- var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
34
- var import_jsx_runtime = require("react/jsx-runtime");
35
- var SETTINGS_NS = "settings.bash-terminal";
36
- var ENTRY_ID = "tool-bash-terminal";
37
- var SHELLS = ["powershell", "gitbash", "msys2", "wsl"];
38
- var ROW_CSS = ".btRow{border-bottom:1px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}.btRowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}.btTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}.btDesc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}.btSelector{background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;border-radius:18px;align-items:center;gap:12px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.btSelector:hover{background:var(--dsw-alias-interactive-bg-hover)}.btChevron{flex:none}";
39
- if (typeof document !== "undefined" && document.querySelector('style[data-plugin-css="bash-terminal-row"]') === null) {
40
- const tag = document.createElement("style");
41
- tag.dataset.plugin = "dsh-bash-terminal";
42
- tag.dataset.pluginCss = "bash-terminal-row";
43
- tag.textContent = ROW_CSS;
44
- document.head.appendChild(tag);
45
- }
46
- var zh = {
47
- "shell.title": "\u9ED8\u8BA4\u7EC8\u7AEF",
48
- "shell.description": "shell \u5DE5\u5177\u6267\u884C\u547D\u4EE4\u65F6\u4F7F\u7528\u7684\u7EC8\u7AEF",
49
- "shell.powershell": "PowerShell",
50
- "shell.gitbash": "Git Bash",
51
- "shell.msys2": "MSYS2",
52
- "shell.wsl": "WSL"
53
- };
54
- var en = {
55
- "shell.title": "Default terminal",
56
- "shell.description": "Terminal used by the shell tool",
57
- "shell.powershell": "PowerShell",
58
- "shell.gitbash": "Git Bash",
59
- "shell.msys2": "MSYS2",
60
- "shell.wsl": "WSL"
61
- };
62
- var inject = ["slots", "locale", "configForms"];
63
- function ShellPreferenceRow({ t, useStore, setShell }) {
64
- const shell = useStore((s) => s.shell);
65
- const writable = useStore((s) => s.writable);
66
- const [open, setOpen] = (0, import_react.useState)(false);
67
- const items = SHELLS.map((id) => ({ id, label: t("shell." + id) }));
68
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRow", children: [
69
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
70
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
71
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.description") })
72
- ] }),
73
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
- import_dsh_client_ui_primitives.Menu,
75
- {
76
- open,
77
- onClose: () => setOpen(false),
78
- items,
79
- selectedId: shell,
80
- onSelect: (id) => {
81
- setOpen(false);
82
- setShell(id);
83
- },
84
- align: "end",
85
- portal: true,
86
- anchor: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
87
- "button",
88
- {
89
- type: "button",
90
- className: "btSelector",
91
- "aria-haspopup": "menu",
92
- "aria-expanded": open,
93
- disabled: !writable,
94
- onClick: () => setOpen(!open),
95
- style: !writable ? { opacity: 0.5, cursor: "not-allowed" } : void 0,
96
- children: [
97
- t("shell." + shell),
98
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronDownOutline14, { className: "btChevron" })
99
- ]
100
- }
101
- )
102
- }
103
- )
104
- ] });
105
- }
106
- function apply(ctx) {
107
- ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh, en }), "bash-terminal: settings dictionaries");
108
- const scope = ctx.configForms.get(ENTRY_ID);
109
- const store = (0, import_dsh_client_store.defineStore)({
110
- init: () => ({ shell: "powershell", revision: -1, writable: false }),
111
- actions: {
112
- sync: (d, shell, revision, writable) => {
113
- if (revision !== void 0 && revision <= d.revision) return;
114
- if (shell !== void 0) d.shell = shell;
115
- if (revision !== void 0) d.revision = revision;
116
- if (writable !== void 0) d.writable = writable;
117
- }
118
- }
119
- });
120
- let bound;
121
- const push = (snap) => {
122
- bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable);
123
- };
124
- ctx.slots.inject(
125
- "settings.general.item",
126
- () => ctx.slots.register(
127
- {
128
- name: "settings.general.item",
129
- id: "bash-terminal-shell",
130
- order: 20,
131
- store,
132
- locale: SETTINGS_NS,
133
- inject: (actions) => {
134
- bound = actions;
135
- push(scope.getSnapshot());
136
- return { setShell: (value) => void scope.set("defaultShell", value) };
137
- }
138
- },
139
- ShellPreferenceRow
140
- ),
141
- "bash-terminal: settings row"
142
- );
143
- ctx.effect(() => scope.subscribe(() => push(scope.getSnapshot())), "bash-terminal: settings watch");
144
- }
145
-
146
- return module.exports;
147
- }
148
- });
1
+ window.__ModuleLoader__.load({
2
+ id: "dsh-bash-terminal",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropNames = Object.getOwnPropertyNames;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
23
+
24
+ // src/client.tsx
25
+ var client_exports = {};
26
+ __export(client_exports, {
27
+ apply: () => apply,
28
+ inject: () => inject
29
+ });
30
+ module.exports = __toCommonJS(client_exports);
31
+ var import_react = require("react");
32
+ var import_dsh_client_store = require("@deepseek-ai/dsh-client-store");
33
+ var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ var SETTINGS_NS = "settings.bash-terminal";
36
+ var ENTRY_ID = "tool-bash-terminal";
37
+ var SHELLS = ["powershell", "gitbash", "msys2", "wsl"];
38
+ var ROW_CSS = ".btRow{border-bottom:1px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}.btRowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}.btTitle{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}.btDesc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}.btSelector{background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;border-radius:18px;align-items:center;gap:12px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.btSelector:hover{background:var(--dsw-alias-interactive-bg-hover)}.btChevron{flex:none}";
39
+ if (typeof document !== "undefined" && document.querySelector('style[data-plugin-css="bash-terminal-row"]') === null) {
40
+ const tag = document.createElement("style");
41
+ tag.dataset.plugin = "dsh-bash-terminal";
42
+ tag.dataset.pluginCss = "bash-terminal-row";
43
+ tag.textContent = ROW_CSS;
44
+ document.head.appendChild(tag);
45
+ }
46
+ var zh = {
47
+ "shell.title": "\u9ED8\u8BA4\u7EC8\u7AEF",
48
+ "shell.description": "shell \u5DE5\u5177\u6267\u884C\u547D\u4EE4\u65F6\u4F7F\u7528\u7684\u7EC8\u7AEF",
49
+ "shell.powershell": "PowerShell",
50
+ "shell.gitbash": "Git Bash",
51
+ "shell.msys2": "MSYS2",
52
+ "shell.wsl": "WSL"
53
+ };
54
+ var en = {
55
+ "shell.title": "Default terminal",
56
+ "shell.description": "Terminal used by the shell tool",
57
+ "shell.powershell": "PowerShell",
58
+ "shell.gitbash": "Git Bash",
59
+ "shell.msys2": "MSYS2",
60
+ "shell.wsl": "WSL"
61
+ };
62
+ var inject = ["slots", "locale", "configForms"];
63
+ function ShellPreferenceRow({ t, useStore, setShell }) {
64
+ const shell = useStore((s) => s.shell);
65
+ const writable = useStore((s) => s.writable);
66
+ const [open, setOpen] = (0, import_react.useState)(false);
67
+ const items = SHELLS.map((id) => ({ id, label: t("shell." + id) }));
68
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRow", children: [
69
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
70
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
71
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.description") })
72
+ ] }),
73
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
+ import_dsh_client_ui_primitives.Menu,
75
+ {
76
+ open,
77
+ onClose: () => setOpen(false),
78
+ items,
79
+ selectedId: shell,
80
+ onSelect: (id) => {
81
+ setOpen(false);
82
+ setShell(id);
83
+ },
84
+ align: "end",
85
+ portal: true,
86
+ anchor: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
87
+ "button",
88
+ {
89
+ type: "button",
90
+ className: "btSelector",
91
+ "aria-haspopup": "menu",
92
+ "aria-expanded": open,
93
+ disabled: !writable,
94
+ onClick: () => setOpen(!open),
95
+ style: !writable ? { opacity: 0.5, cursor: "not-allowed" } : void 0,
96
+ children: [
97
+ t("shell." + shell),
98
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronDownOutlineMedium, { className: "btChevron" })
99
+ ]
100
+ }
101
+ )
102
+ }
103
+ )
104
+ ] });
105
+ }
106
+ var zhDictTitle = () => zh["shell.title"] ?? "\u7EC8\u7AEF";
107
+ function apply(ctx) {
108
+ ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh, en }), "bash-terminal: settings dictionaries");
109
+ const scope = ctx.configForms.get(ENTRY_ID);
110
+ const store = (0, import_dsh_client_store.defineStore)({
111
+ init: () => ({ shell: "powershell", revision: -1, writable: false }),
112
+ actions: {
113
+ sync: (d, shell, revision, writable) => {
114
+ if (revision !== void 0 && revision <= d.revision) return;
115
+ if (shell !== void 0) d.shell = shell;
116
+ if (revision !== void 0) d.revision = revision;
117
+ if (writable !== void 0) d.writable = writable;
118
+ }
119
+ }
120
+ });
121
+ let bound;
122
+ const push = (snap) => {
123
+ bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable);
124
+ };
125
+ ctx.slots.inject(
126
+ "dsh-family.tab",
127
+ () => ctx.slots.register(
128
+ {
129
+ name: "dsh-family.tab",
130
+ id: "bash-terminal-shell",
131
+ order: 60,
132
+ label: () => zhDictTitle(),
133
+ store,
134
+ locale: SETTINGS_NS,
135
+ inject: (actions) => {
136
+ bound = actions;
137
+ push(scope.getSnapshot());
138
+ return { setShell: (value) => void scope.set("defaultShell", value) };
139
+ }
140
+ },
141
+ ShellPreferenceRow
142
+ ),
143
+ "bash-terminal: settings row"
144
+ );
145
+ ctx.effect(() => scope.subscribe(() => push(scope.getSnapshot())), "bash-terminal: settings watch");
146
+ }
147
+
148
+ return module.exports;
149
+ }
150
+ });