dsh-bash-terminal-ts 0.7.0 → 0.7.1

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/lib/client.js CHANGED
@@ -1,160 +1,205 @@
1
- window.__ModuleLoader__.load({
2
- id: "dsh-bash-terminal-ts",
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-ts";
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
- "shell.unavailable": "\u8BBE\u7F6E\u9762\u4E0D\u53EF\u7528\uFF1A\u5BBF\u4E3B\u672A\u63D0\u4F9B\u672C\u63D2\u4EF6\u7684 configForms \u6761\u76EE\uFF08\u68C0\u67E5 cordis.patch.yml \u7684 entry id\uFF09"
54
- };
55
- var en = {
56
- "shell.title": "Default terminal",
57
- "shell.description": "Terminal used by the shell tool",
58
- "shell.powershell": "PowerShell",
59
- "shell.gitbash": "Git Bash",
60
- "shell.msys2": "MSYS2",
61
- "shell.wsl": "WSL",
62
- "shell.unavailable": "Settings unavailable: the host exposes no configForms entry for this plugin (check the cordis.patch.yml entry id)"
63
- };
64
- var inject = ["slots", "locale", "configForms"];
65
- function ShellPreferenceRow({ t, useStore, setShell }) {
66
- const shell = useStore((s) => s.shell);
67
- const writable = useStore((s) => s.writable);
68
- const status = useStore((s) => s.status);
69
- const [open, setOpen] = (0, import_react.useState)(false);
70
- const items = SHELLS.map((id) => ({ id, label: t("shell." + id) }));
71
- if (status === "unavailable") {
72
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btRow", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
73
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
74
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.unavailable") })
75
- ] }) });
76
- }
77
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRow", children: [
78
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
79
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
80
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.description") })
81
- ] }),
82
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
83
- import_dsh_client_ui_primitives.Menu,
84
- {
85
- open,
86
- onClose: () => setOpen(false),
87
- items,
88
- selectedId: shell,
89
- onSelect: (id) => {
90
- setOpen(false);
91
- setShell(id);
92
- },
93
- align: "end",
94
- portal: true,
95
- anchor: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
96
- "button",
97
- {
98
- type: "button",
99
- className: "btSelector",
100
- "aria-haspopup": "menu",
101
- "aria-expanded": open,
102
- disabled: !writable,
103
- onClick: () => setOpen(!open),
104
- style: !writable ? { opacity: 0.5, cursor: "not-allowed" } : void 0,
105
- children: [
106
- t("shell." + shell),
107
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronDownOutlineMedium, { className: "btChevron" })
108
- ]
109
- }
110
- )
111
- }
112
- )
113
- ] });
114
- }
115
- var zhDictTitle = () => zh["shell.title"] ?? "\u7EC8\u7AEF";
116
- function apply(ctx) {
117
- ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh, en }), "bash-terminal: settings dictionaries");
118
- const scope = ctx.configForms.get(ENTRY_ID);
119
- const store = (0, import_dsh_client_store.defineStore)({
120
- init: () => ({ shell: "powershell", revision: -1, writable: false, status: "loading" }),
121
- actions: {
122
- sync: (d, shell, revision, writable, status) => {
123
- if (revision !== void 0 && revision <= d.revision) return;
124
- if (shell !== void 0) d.shell = shell;
125
- if (revision !== void 0) d.revision = revision;
126
- if (writable !== void 0) d.writable = writable;
127
- if (status !== void 0) d.status = status;
128
- }
129
- }
130
- });
131
- let bound;
132
- const push = (snap) => {
133
- bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable, snap.status);
134
- };
135
- ctx.slots.inject(
136
- "dsh-family.tab",
137
- () => ctx.slots.register(
138
- {
139
- name: "dsh-family.tab",
140
- id: "bash-terminal-shell",
141
- order: 60,
142
- label: () => zhDictTitle(),
143
- store,
144
- locale: SETTINGS_NS,
145
- inject: (actions) => {
146
- bound = actions;
147
- push(scope.getSnapshot());
148
- return { setShell: (value) => void scope.set("defaultShell", value) };
149
- }
150
- },
151
- ShellPreferenceRow
152
- ),
153
- "bash-terminal: settings row"
154
- );
155
- ctx.effect(() => scope.subscribe(() => push(scope.getSnapshot())), "bash-terminal: settings watch");
156
- }
157
-
158
- return module.exports;
159
- }
160
- });
1
+ window.__ModuleLoader__.load({
2
+ id: "dsh-bash-terminal-ts",
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-ts";
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
+ "shell.unavailable": "\u8BBE\u7F6E\u9762\u4E0D\u53EF\u7528\uFF1A\u5BBF\u4E3B\u672A\u63D0\u4F9B\u672C\u63D2\u4EF6\u7684 configForms \u6761\u76EE\uFF08\u68C0\u67E5 cordis.patch.yml \u7684 entry id\uFF09"
54
+ };
55
+ var en = {
56
+ "shell.title": "Default terminal",
57
+ "shell.description": "Terminal used by the shell tool",
58
+ "shell.powershell": "PowerShell",
59
+ "shell.gitbash": "Git Bash",
60
+ "shell.msys2": "MSYS2",
61
+ "shell.wsl": "WSL",
62
+ "shell.unavailable": "Settings unavailable: the host exposes no configForms entry for this plugin (check the cordis.patch.yml entry id)"
63
+ };
64
+ var fr = {
65
+ "shell.title": "Terminal par d\xE9faut",
66
+ "shell.description": "Terminal utilis\xE9 par l'outil shell",
67
+ "shell.powershell": "PowerShell",
68
+ "shell.gitbash": "Git Bash",
69
+ "shell.msys2": "MSYS2",
70
+ "shell.wsl": "WSL",
71
+ "shell.unavailable": "Param\xE8tres indisponibles : l'h\xF4te n'expose aucune entr\xE9e configForms pour ce plugin (v\xE9rifiez l'entry id du cordis.patch.yml)"
72
+ };
73
+ var de = {
74
+ "shell.title": "Standard-Terminal",
75
+ "shell.description": "Terminal, das vom Shell-Tool verwendet wird",
76
+ "shell.powershell": "PowerShell",
77
+ "shell.gitbash": "Git Bash",
78
+ "shell.msys2": "MSYS2",
79
+ "shell.wsl": "WSL",
80
+ "shell.unavailable": "Einstellungen nicht verf\xFCgbar: Der Host stellt keinen configForms-Eintrag f\xFCr dieses Plugin bereit (Entry-ID in cordis.patch.yml pr\xFCfen)"
81
+ };
82
+ var it = {
83
+ "shell.title": "Terminale predefinito",
84
+ "shell.description": "Terminale usato dallo strumento shell",
85
+ "shell.powershell": "PowerShell",
86
+ "shell.gitbash": "Git Bash",
87
+ "shell.msys2": "MSYS2",
88
+ "shell.wsl": "WSL",
89
+ "shell.unavailable": "Impostazioni non disponibili: l'host non espone alcuna voce configForms per questo plugin (verifica l'entry id in cordis.patch.yml)"
90
+ };
91
+ var ru = {
92
+ "shell.title": "\u0422\u0435\u0440\u043C\u0438\u043D\u0430\u043B \u043F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",
93
+ "shell.description": "\u0422\u0435\u0440\u043C\u0438\u043D\u0430\u043B, \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u043C\u044B\u0439 \u0438\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442\u043E\u043C shell",
94
+ "shell.powershell": "PowerShell",
95
+ "shell.gitbash": "Git Bash",
96
+ "shell.msys2": "MSYS2",
97
+ "shell.wsl": "WSL",
98
+ "shell.unavailable": "\u041D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B: \u0445\u043E\u0441\u0442 \u043D\u0435 \u043F\u0440\u0435\u0434\u043E\u0441\u0442\u0430\u0432\u043B\u044F\u0435\u0442 \u0437\u0430\u043F\u0438\u0441\u044C configForms \u0434\u043B\u044F \u044D\u0442\u043E\u0433\u043E \u043F\u043B\u0430\u0433\u0438\u043D\u0430 (\u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 entry id \u0432 cordis.patch.yml)"
99
+ };
100
+ var es = {
101
+ "shell.title": "Terminal predeterminado",
102
+ "shell.description": "Terminal que usa la herramienta shell",
103
+ "shell.powershell": "PowerShell",
104
+ "shell.gitbash": "Git Bash",
105
+ "shell.msys2": "MSYS2",
106
+ "shell.wsl": "WSL",
107
+ "shell.unavailable": "Configuraci\xF3n no disponible: el host no expone ninguna entrada configForms para este plugin (comprueba el entry id de cordis.patch.yml)"
108
+ };
109
+ var inject = ["slots", "locale", "configForms"];
110
+ function ShellPreferenceRow({ t, useStore, setShell }) {
111
+ const shell = useStore((s) => s.shell);
112
+ const writable = useStore((s) => s.writable);
113
+ const status = useStore((s) => s.status);
114
+ const [open, setOpen] = (0, import_react.useState)(false);
115
+ const items = SHELLS.map((id) => ({ id, label: t("shell." + id) }));
116
+ if (status === "unavailable") {
117
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btRow", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
118
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
119
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.unavailable") })
120
+ ] }) });
121
+ }
122
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRow", children: [
123
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "btRowText", children: [
124
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btTitle", children: t("shell.title") }),
125
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btDesc", children: t("shell.description") })
126
+ ] }),
127
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
128
+ import_dsh_client_ui_primitives.Menu,
129
+ {
130
+ open,
131
+ onClose: () => setOpen(false),
132
+ items,
133
+ selectedId: shell,
134
+ onSelect: (id) => {
135
+ setOpen(false);
136
+ setShell(id);
137
+ },
138
+ align: "end",
139
+ portal: true,
140
+ anchor: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
141
+ "button",
142
+ {
143
+ type: "button",
144
+ className: "btSelector",
145
+ "aria-haspopup": "menu",
146
+ "aria-expanded": open,
147
+ disabled: !writable,
148
+ onClick: () => setOpen(!open),
149
+ style: !writable ? { opacity: 0.5, cursor: "not-allowed" } : void 0,
150
+ children: [
151
+ t("shell." + shell),
152
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconChevronDownOutlineMedium, { className: "btChevron" })
153
+ ]
154
+ }
155
+ )
156
+ }
157
+ )
158
+ ] });
159
+ }
160
+ var zhDictTitle = () => zh["shell.title"] ?? "\u7EC8\u7AEF";
161
+ function apply(ctx) {
162
+ ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh, en, fr, de, it, ru, es }), "bash-terminal: settings dictionaries");
163
+ const scope = ctx.configForms.get(ENTRY_ID);
164
+ const store = (0, import_dsh_client_store.defineStore)({
165
+ init: () => ({ shell: "powershell", revision: -1, writable: false, status: "loading" }),
166
+ actions: {
167
+ sync: (d, shell, revision, writable, status) => {
168
+ if (revision !== void 0 && revision <= d.revision) return;
169
+ if (shell !== void 0) d.shell = shell;
170
+ if (revision !== void 0) d.revision = revision;
171
+ if (writable !== void 0) d.writable = writable;
172
+ if (status !== void 0) d.status = status;
173
+ }
174
+ }
175
+ });
176
+ let bound;
177
+ const push = (snap) => {
178
+ bound?.sync(snap.value?.defaultShell, snap.revision, snap.writable, snap.status);
179
+ };
180
+ ctx.slots.inject(
181
+ "dsh-family.tab",
182
+ () => ctx.slots.register(
183
+ {
184
+ name: "dsh-family.tab",
185
+ id: "bash-terminal-shell",
186
+ order: 60,
187
+ label: () => zhDictTitle(),
188
+ store,
189
+ locale: SETTINGS_NS,
190
+ inject: (actions) => {
191
+ bound = actions;
192
+ push(scope.getSnapshot());
193
+ return { setShell: (value) => void scope.set("defaultShell", value) };
194
+ }
195
+ },
196
+ ShellPreferenceRow
197
+ ),
198
+ "bash-terminal: settings row"
199
+ );
200
+ ctx.effect(() => scope.subscribe(() => push(scope.getSnapshot())), "bash-terminal: settings watch");
201
+ }
202
+
203
+ return module.exports;
204
+ }
205
+ });