@celljs/ta-workspace 4.8.0 → 4.9.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/README.md +2 -2
- package/README.zh-cn.md +2 -2
- package/package.json +13 -4
- package/web/index.js +916 -295
- package/web-src/browser-agent.ts +0 -440
- package/web-src/browser-common.tsx +0 -278
- package/web-src/browser-import.tsx +0 -126
- package/web-src/browser-webview.tsx +0 -270
- package/web-src/browser.tsx +0 -80
- package/web-src/common.tsx +0 -296
- package/web-src/editors.tsx +0 -471
- package/web-src/explorer.tsx +0 -717
- package/web-src/file-icon.tsx +0 -21
- package/web-src/host.ts +0 -121
- package/web-src/i18n.ts +0 -395
- package/web-src/index.tsx +0 -71
- package/web-src/open-files.tsx +0 -80
- package/web-src/preview.tsx +0 -132
- package/web-src/react.ts +0 -8
- package/web-src/scm.tsx +0 -388
- package/web-src/search.tsx +0 -485
- package/web-src/style.ts +0 -254
- package/web-src/terminal.tsx +0 -269
- package/web-src/util/browser-snapshot.spec.ts +0 -96
- package/web-src/util/browser-snapshot.ts +0 -225
- package/web-src/util/file-icon.spec.ts +0 -35
- package/web-src/util/file-icon.ts +0 -23
- package/web-src/util/git.ts +0 -203
- package/web-src/util/preview.spec.ts +0 -48
- package/web-src/util/preview.ts +0 -90
- package/web-src/util/search.spec.ts +0 -164
- package/web-src/util/search.ts +0 -274
- package/web-src/util/seti-font.ts +0 -6
- package/web-src/util/seti.ts +0 -761
- package/web-src/util/upload.spec.ts +0 -66
- package/web-src/util/upload.ts +0 -123
- package/web-src/util/workspace.spec.ts +0 -220
- package/web-src/util/workspace.ts +0 -396
- package/web-src/util/zip.spec.ts +0 -60
- package/web-src/util/zip.ts +0 -137
- package/web-src/workspace-client.ts +0 -221
package/web/index.js
CHANGED
|
@@ -141,10 +141,10 @@ function Action({
|
|
|
141
141
|
strokeWidth: 1.7
|
|
142
142
|
}));
|
|
143
143
|
}
|
|
144
|
-
function Empty(
|
|
145
|
-
return /* @__PURE__ */ React.createElement(
|
|
146
|
-
|
|
147
|
-
}
|
|
144
|
+
function Empty(props) {
|
|
145
|
+
return /* @__PURE__ */ React.createElement(pi.ui.Empty, {
|
|
146
|
+
...props
|
|
147
|
+
});
|
|
148
148
|
}
|
|
149
149
|
function Glyph({ name, size = 15 }) {
|
|
150
150
|
const Icon = Host.icon(name);
|
|
@@ -161,11 +161,20 @@ function useKept(store, key, initial) {
|
|
|
161
161
|
const next = store.get(key) ?? initial();
|
|
162
162
|
setValue(next);
|
|
163
163
|
}
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
164
|
+
const initialRef = React.useRef(initial);
|
|
165
|
+
initialRef.current = initial;
|
|
166
|
+
const set = React.useCallback((next) => {
|
|
167
|
+
const change = (previous) => typeof next === "function" ? next(previous) : next;
|
|
168
|
+
if (keyRef.current !== key) {
|
|
169
|
+
store.set(key, change(store.get(key) ?? initialRef.current()));
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
setValue((previous) => {
|
|
173
|
+
const value2 = change(previous);
|
|
174
|
+
store.set(key, value2);
|
|
175
|
+
return value2;
|
|
176
|
+
});
|
|
177
|
+
}, [store, key]);
|
|
169
178
|
return [value, set];
|
|
170
179
|
}
|
|
171
180
|
function useContextMenu() {
|
|
@@ -184,14 +193,27 @@ function useContextMenu() {
|
|
|
184
193
|
}) : null;
|
|
185
194
|
return [element, open];
|
|
186
195
|
}
|
|
196
|
+
function safeAreaTop(element) {
|
|
197
|
+
const probe = document.createElement("div");
|
|
198
|
+
probe.style.cssText = "position:fixed;visibility:hidden;pointer-events:none;padding-top:env(safe-area-inset-top)";
|
|
199
|
+
element.appendChild(probe);
|
|
200
|
+
const top = Number.parseFloat(getComputedStyle(probe).paddingTop) || 0;
|
|
201
|
+
probe.remove();
|
|
202
|
+
return top;
|
|
203
|
+
}
|
|
187
204
|
function ContextMenu({ x, y, items, onClose }) {
|
|
188
205
|
const root = React.useRef(null);
|
|
189
|
-
const [place, setPlace] = React.useState({ left:
|
|
206
|
+
const [place, setPlace] = React.useState({ left: 0, top: 0, ready: false });
|
|
190
207
|
React.useLayoutEffect(() => {
|
|
191
|
-
const
|
|
208
|
+
const element = root.current;
|
|
209
|
+
const box = element && { width: element.offsetWidth, height: element.offsetHeight };
|
|
192
210
|
if (box) {
|
|
193
|
-
const
|
|
194
|
-
const
|
|
211
|
+
const clamp = (value, max) => Math.max(4, Math.min(value, max - 4));
|
|
212
|
+
const touch = document.documentElement.dataset.touch !== undefined;
|
|
213
|
+
const safeTop = touch ? safeAreaTop(element) : 0;
|
|
214
|
+
const above = y - 14 - box.height;
|
|
215
|
+
const left = touch ? clamp(x - box.width / 2, window.innerWidth - box.width) : clamp(x, window.innerWidth - box.width);
|
|
216
|
+
const top = touch ? above >= safeTop + 4 ? above : clamp(y + 14, window.innerHeight - box.height) : y + box.height > window.innerHeight - 4 ? Math.max(4, y - box.height) : y;
|
|
195
217
|
setPlace({ left, top, ready: true });
|
|
196
218
|
}
|
|
197
219
|
root.current?.querySelector("button:not(:disabled)")?.focus();
|
|
@@ -448,11 +470,13 @@ var ZH = {
|
|
|
448
470
|
browser: "浏览器",
|
|
449
471
|
refresh: "刷新",
|
|
450
472
|
collapseAll: "全部折叠",
|
|
473
|
+
showExcluded: "显示默认隐藏的文件(.git、.DS_Store 等)",
|
|
451
474
|
changeFolder: "切换目录",
|
|
452
475
|
followConversation: "回到对话的目录({name})",
|
|
453
476
|
loading: "加载中…",
|
|
454
477
|
empty: "空目录",
|
|
455
|
-
noOpenFiles: "
|
|
478
|
+
noOpenFiles: "没有打开的文件",
|
|
479
|
+
noOpenFilesHint: "在资源管理器、搜索或源代码管理中点击文件",
|
|
456
480
|
close: "关闭",
|
|
457
481
|
closeAll: "全部关闭",
|
|
458
482
|
searchPlaceholder: "搜索",
|
|
@@ -462,14 +486,22 @@ var ZH = {
|
|
|
462
486
|
noResults: "没有结果。",
|
|
463
487
|
results: "{files} 个文件中有 {count} 个结果",
|
|
464
488
|
moreResults: "结果太多,只显示前 {count} 个。",
|
|
465
|
-
notRepository: "当前目录不是 git
|
|
466
|
-
noChanges: "
|
|
489
|
+
notRepository: "当前目录不是 git 仓库",
|
|
490
|
+
noChanges: "没有更改",
|
|
467
491
|
staged: "暂存的更改",
|
|
468
492
|
ahead: "领先 {count}",
|
|
469
493
|
behind: "落后 {count}",
|
|
470
494
|
newTerminal: "新建终端",
|
|
471
|
-
noTerminals: "
|
|
472
|
-
terminalEnded: "
|
|
495
|
+
noTerminals: "没有打开的终端",
|
|
496
|
+
terminalEnded: "进程已退出,退出码 {code}",
|
|
497
|
+
restartTerminal: "重新启动",
|
|
498
|
+
killTerminal: "终止终端",
|
|
499
|
+
clearTerminal: "清屏",
|
|
500
|
+
paste: "粘贴",
|
|
501
|
+
selectAll: "全选",
|
|
502
|
+
renameTerminal: "重命名",
|
|
503
|
+
terminalKeys: "终端按键",
|
|
504
|
+
terminalAttention: "有新提醒",
|
|
473
505
|
pipeMode: "服务器上没有 script,终端运行在管道上:全屏程序(vim、top)和密码输入不可用。",
|
|
474
506
|
address: "输入网址或搜索",
|
|
475
507
|
back: "后退",
|
|
@@ -634,11 +666,13 @@ var EN = {
|
|
|
634
666
|
browser: "Browser",
|
|
635
667
|
refresh: "Refresh",
|
|
636
668
|
collapseAll: "Collapse all",
|
|
669
|
+
showExcluded: "Show files hidden by default (.git, .DS_Store…)",
|
|
637
670
|
changeFolder: "Change folder",
|
|
638
671
|
followConversation: "Back to the folder of the conversation ({name})",
|
|
639
672
|
loading: "Loading…",
|
|
640
673
|
empty: "Empty folder",
|
|
641
|
-
noOpenFiles: "No
|
|
674
|
+
noOpenFiles: "No open files",
|
|
675
|
+
noOpenFilesHint: "Click a file in the explorer, search or source control",
|
|
642
676
|
close: "Close",
|
|
643
677
|
closeAll: "Close all",
|
|
644
678
|
searchPlaceholder: "Search",
|
|
@@ -648,14 +682,22 @@ var EN = {
|
|
|
648
682
|
noResults: "No results.",
|
|
649
683
|
results: "{count} results in {files} files",
|
|
650
684
|
moreResults: "Too many results; the first {count} are shown.",
|
|
651
|
-
notRepository: "This folder is not a git repository
|
|
652
|
-
noChanges: "No changes
|
|
685
|
+
notRepository: "This folder is not a git repository",
|
|
686
|
+
noChanges: "No changes",
|
|
653
687
|
staged: "Staged changes",
|
|
654
688
|
ahead: "{count} ahead",
|
|
655
689
|
behind: "{count} behind",
|
|
656
690
|
newTerminal: "New terminal",
|
|
657
|
-
noTerminals: "No terminals
|
|
658
|
-
terminalEnded: "
|
|
691
|
+
noTerminals: "No open terminals",
|
|
692
|
+
terminalEnded: "The process exited with code {code}",
|
|
693
|
+
restartTerminal: "Restart",
|
|
694
|
+
killTerminal: "Kill Terminal",
|
|
695
|
+
clearTerminal: "Clear",
|
|
696
|
+
paste: "Paste",
|
|
697
|
+
selectAll: "Select All",
|
|
698
|
+
renameTerminal: "Rename",
|
|
699
|
+
terminalKeys: "Terminal keys",
|
|
700
|
+
terminalAttention: "Needs attention",
|
|
659
701
|
pipeMode: "The server has no script: the terminal runs on pipes, so full-screen programs (vim, top) and password prompts do not work.",
|
|
660
702
|
address: "Enter an address or search",
|
|
661
703
|
back: "Back",
|
|
@@ -897,10 +939,13 @@ var WorkspaceUtil;
|
|
|
897
939
|
return index < 0 ? "" : path.slice(0, index);
|
|
898
940
|
}
|
|
899
941
|
WorkspaceUtil.dirname = dirname;
|
|
900
|
-
function rows(children, expanded,
|
|
942
|
+
function rows(children, expanded, hidden) {
|
|
901
943
|
const out = [];
|
|
902
944
|
const walk = (dir, depth) => {
|
|
903
945
|
for (const entry of children.get(dir) ?? []) {
|
|
946
|
+
if (hidden?.(entry)) {
|
|
947
|
+
continue;
|
|
948
|
+
}
|
|
904
949
|
const open = entry.kind === "directory" && expanded.has(entry.path);
|
|
905
950
|
out.push({ entry, depth, expanded: open, loading: open && !children.has(entry.path) });
|
|
906
951
|
if (open) {
|
|
@@ -908,7 +953,7 @@ var WorkspaceUtil;
|
|
|
908
953
|
}
|
|
909
954
|
}
|
|
910
955
|
};
|
|
911
|
-
walk(
|
|
956
|
+
walk("", 0);
|
|
912
957
|
return out;
|
|
913
958
|
}
|
|
914
959
|
WorkspaceUtil.rows = rows;
|
|
@@ -5294,7 +5339,7 @@ var PreviewUtil;
|
|
|
5294
5339
|
|
|
5295
5340
|
// web-src/preview.tsx
|
|
5296
5341
|
var PAGE_SANDBOX = "allow-scripts allow-forms allow-popups allow-modals allow-downloads";
|
|
5297
|
-
var MARKDOWN_SANDBOX = "allow-popups allow-popups-to-escape-sandbox";
|
|
5342
|
+
var MARKDOWN_SANDBOX = "allow-same-origin allow-popups allow-popups-to-escape-sandbox";
|
|
5298
5343
|
var LINKED = [
|
|
5299
5344
|
["img", "src"],
|
|
5300
5345
|
["source", "src"],
|
|
@@ -5422,8 +5467,12 @@ function MediaPreview({ kind, url, size, onInfo }) {
|
|
|
5422
5467
|
}
|
|
5423
5468
|
}
|
|
5424
5469
|
|
|
5470
|
+
// ../ta-protocol/esm/common/access-protocol.js
|
|
5471
|
+
var TaAccessServer = Symbol("TaAccessServer");
|
|
5425
5472
|
// ../ta-protocol/esm/common/auth-protocol.js
|
|
5426
5473
|
var TaAuthServer = Symbol("TaAuthServer");
|
|
5474
|
+
// ../ta-protocol/esm/common/gateway-protocol.js
|
|
5475
|
+
var TaGatewayServer = Symbol("TaGatewayServer");
|
|
5427
5476
|
// ../ta-protocol/esm/common/location.js
|
|
5428
5477
|
var TaLocation;
|
|
5429
5478
|
(function(TaLocation2) {
|
|
@@ -5515,6 +5564,11 @@ var TaLocation;
|
|
|
5515
5564
|
return `${TaLocation2.SSH}${host2}${path2 ? normalize(path2) : ""}`;
|
|
5516
5565
|
}
|
|
5517
5566
|
TaLocation2.ssh = ssh;
|
|
5567
|
+
function hostLabel(host2) {
|
|
5568
|
+
const name = host2.replace(/^[^@]*@/, "").replace(/^\[(.*)\](?::\d+)?$/, "$1").replace(/^([^:]*):\d+$/, "$1");
|
|
5569
|
+
return /^[\d.]+$/.test(name) || name.includes(":") ? name : name.split(".")[0] || name;
|
|
5570
|
+
}
|
|
5571
|
+
TaLocation2.hostLabel = hostLabel;
|
|
5518
5572
|
function host(location2) {
|
|
5519
5573
|
var _a;
|
|
5520
5574
|
return isRemote(location2) ? (_a = parse(location2)) === null || _a === undefined ? undefined : _a.host : undefined;
|
|
@@ -5570,6 +5624,17 @@ var TaLocation;
|
|
|
5570
5624
|
})(TaLocation || (TaLocation = {}));
|
|
5571
5625
|
// ../ta-protocol/esm/common/package-protocol.js
|
|
5572
5626
|
var TaPackageServer = Symbol("TaPackageServer");
|
|
5627
|
+
var TaPackageTextUtil;
|
|
5628
|
+
(function(TaPackageTextUtil2) {
|
|
5629
|
+
function pick(text, language) {
|
|
5630
|
+
var _a, _b, _c, _d;
|
|
5631
|
+
if (text === undefined || typeof text === "string") {
|
|
5632
|
+
return text;
|
|
5633
|
+
}
|
|
5634
|
+
return (_d = (_c = (_b = (_a = text[language]) !== null && _a !== undefined ? _a : text[language.split("-")[0]]) !== null && _b !== undefined ? _b : text.en) !== null && _c !== undefined ? _c : text["en-US"]) !== null && _d !== undefined ? _d : Object.values(text)[0];
|
|
5635
|
+
}
|
|
5636
|
+
TaPackageTextUtil2.pick = pick;
|
|
5637
|
+
})(TaPackageTextUtil || (TaPackageTextUtil = {}));
|
|
5573
5638
|
// ../ta-protocol/esm/common/relay-protocol.js
|
|
5574
5639
|
var TaRelayServer = Symbol("TaRelayServer");
|
|
5575
5640
|
// ../ta-protocol/esm/common/remote-protocol.js
|
|
@@ -5579,6 +5644,17 @@ var TaSettingsServer = Symbol("TaSettingsServer");
|
|
|
5579
5644
|
// ../ta-protocol/esm/common/ta-protocol.js
|
|
5580
5645
|
var TaServer = Symbol("TaServer");
|
|
5581
5646
|
var TaClient = Symbol("TaClient");
|
|
5647
|
+
var TaErrorUtil;
|
|
5648
|
+
(function(TaErrorUtil2) {
|
|
5649
|
+
function code(error) {
|
|
5650
|
+
var _a;
|
|
5651
|
+
var _b;
|
|
5652
|
+
const failure = error;
|
|
5653
|
+
const code2 = (_b = failure === null || failure === undefined ? undefined : failure.code) !== null && _b !== undefined ? _b : (_a = failure === null || failure === undefined ? undefined : failure.data) === null || _a === undefined ? undefined : _a.code;
|
|
5654
|
+
return typeof code2 === "string" ? code2 : undefined;
|
|
5655
|
+
}
|
|
5656
|
+
TaErrorUtil2.code = code;
|
|
5657
|
+
})(TaErrorUtil || (TaErrorUtil = {}));
|
|
5582
5658
|
var TaMessageContext;
|
|
5583
5659
|
(function(TaMessageContext2) {
|
|
5584
5660
|
const BLOCK = /^<context>\n?[\s\S]*?\n?<\/context>\n?/;
|
|
@@ -5594,9 +5670,38 @@ ${message}`;
|
|
|
5594
5670
|
}
|
|
5595
5671
|
TaMessageContext2.strip = strip;
|
|
5596
5672
|
})(TaMessageContext || (TaMessageContext = {}));
|
|
5673
|
+
var TaSkillUse;
|
|
5674
|
+
(function(TaSkillUse2) {
|
|
5675
|
+
const BLOCK = /^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/;
|
|
5676
|
+
function parse(message) {
|
|
5677
|
+
var _a;
|
|
5678
|
+
const match = BLOCK.exec(message);
|
|
5679
|
+
if (!match) {
|
|
5680
|
+
return;
|
|
5681
|
+
}
|
|
5682
|
+
return { name: match[1], location: match[2], content: match[3], message: ((_a = match[4]) === null || _a === undefined ? undefined : _a.trim()) || undefined };
|
|
5683
|
+
}
|
|
5684
|
+
TaSkillUse2.parse = parse;
|
|
5685
|
+
function command(use2) {
|
|
5686
|
+
return use2.message ? `/skill:${use2.name} ${use2.message}` : `/skill:${use2.name}`;
|
|
5687
|
+
}
|
|
5688
|
+
TaSkillUse2.command = command;
|
|
5689
|
+
})(TaSkillUse || (TaSkillUse = {}));
|
|
5597
5690
|
// ../ta-protocol/esm/common/workspace-protocol.js
|
|
5598
5691
|
var TaWorkspaceServer = Symbol("TaWorkspaceServer");
|
|
5599
5692
|
var TaTerminalServer = Symbol("TaTerminalServer");
|
|
5693
|
+
var TaExcludedFiles;
|
|
5694
|
+
(function(TaExcludedFiles2) {
|
|
5695
|
+
TaExcludedFiles2.NAMES = [".git", ".svn", ".hg", ".DS_Store", "Thumbs.db"];
|
|
5696
|
+
function has(name) {
|
|
5697
|
+
return TaExcludedFiles2.NAMES.includes(name);
|
|
5698
|
+
}
|
|
5699
|
+
TaExcludedFiles2.has = has;
|
|
5700
|
+
function filter(entries) {
|
|
5701
|
+
return entries.filter((entry) => !has(entry.name));
|
|
5702
|
+
}
|
|
5703
|
+
TaExcludedFiles2.filter = filter;
|
|
5704
|
+
})(TaExcludedFiles || (TaExcludedFiles = {}));
|
|
5600
5705
|
var TA_UPLOAD_PART_BYTES = 4 * 1024 * 1024;
|
|
5601
5706
|
// web-src/util/search.ts
|
|
5602
5707
|
var PREVIEW_CHARS = 200;
|
|
@@ -6148,7 +6253,7 @@ var WorkspaceClient;
|
|
|
6148
6253
|
while (level.length) {
|
|
6149
6254
|
const listed = await Promise.all(level.map((dir) => pi.workspace.listDirectory(dir, cwd)));
|
|
6150
6255
|
level = [];
|
|
6151
|
-
for (const entry of listed.flat()) {
|
|
6256
|
+
for (const entry of TaExcludedFiles.filter(listed.flat())) {
|
|
6152
6257
|
if (entry.kind === "directory") {
|
|
6153
6258
|
level.push(entry.path);
|
|
6154
6259
|
} else {
|
|
@@ -6611,6 +6716,182 @@ function DiffEditor({ id, cwd, path, staged }) {
|
|
|
6611
6716
|
}));
|
|
6612
6717
|
}
|
|
6613
6718
|
|
|
6719
|
+
// web-src/explorer-excluded.ts
|
|
6720
|
+
var SHOW_EXCLUDED_KEY = "explorer.showExcluded";
|
|
6721
|
+
var kept;
|
|
6722
|
+
function useShowExcluded() {
|
|
6723
|
+
const [show, setShow] = React.useState(kept ?? false);
|
|
6724
|
+
React.useEffect(() => {
|
|
6725
|
+
let live = true;
|
|
6726
|
+
const read = () => pi.storage.get(SHOW_EXCLUDED_KEY).then((value) => {
|
|
6727
|
+
kept = value === true;
|
|
6728
|
+
if (live) {
|
|
6729
|
+
setShow(kept);
|
|
6730
|
+
}
|
|
6731
|
+
}, () => {
|
|
6732
|
+
return;
|
|
6733
|
+
});
|
|
6734
|
+
read();
|
|
6735
|
+
const stop = pi.storage.onChange((keys) => {
|
|
6736
|
+
if (keys.includes(SHOW_EXCLUDED_KEY)) {
|
|
6737
|
+
read();
|
|
6738
|
+
}
|
|
6739
|
+
});
|
|
6740
|
+
return () => {
|
|
6741
|
+
live = false;
|
|
6742
|
+
stop();
|
|
6743
|
+
};
|
|
6744
|
+
}, []);
|
|
6745
|
+
const change = React.useCallback((next) => {
|
|
6746
|
+
kept = next;
|
|
6747
|
+
setShow(next);
|
|
6748
|
+
pi.storage.set(SHOW_EXCLUDED_KEY, next || null).catch(() => {
|
|
6749
|
+
return;
|
|
6750
|
+
});
|
|
6751
|
+
}, []);
|
|
6752
|
+
return [show, change];
|
|
6753
|
+
}
|
|
6754
|
+
|
|
6755
|
+
// web-src/explorer-transfer.tsx
|
|
6756
|
+
var DRAG_OPEN_MS = 600;
|
|
6757
|
+
function acceptsDrop(dataTransfer) {
|
|
6758
|
+
return dataTransfer.types.includes("Files") || pi.ui.fileDrag.has(dataTransfer);
|
|
6759
|
+
}
|
|
6760
|
+
function useExplorerTransfer(host) {
|
|
6761
|
+
const { root } = host;
|
|
6762
|
+
const [dropTarget, setDropTarget] = React.useState();
|
|
6763
|
+
const [transfer, setTransfer] = React.useState();
|
|
6764
|
+
const filePicker = React.useRef(null);
|
|
6765
|
+
const folderPicker = React.useRef(null);
|
|
6766
|
+
const pickedFolder = React.useRef("");
|
|
6767
|
+
const dragOpen = React.useRef(undefined);
|
|
6768
|
+
const upload = async (folder, pending) => {
|
|
6769
|
+
let batch;
|
|
6770
|
+
try {
|
|
6771
|
+
batch = await pending;
|
|
6772
|
+
} catch (error) {
|
|
6773
|
+
pi.ui.notify(t("uploadFailed", { message: Host.message(error) }), "error");
|
|
6774
|
+
return;
|
|
6775
|
+
}
|
|
6776
|
+
if (!batch.files.length && !batch.folders.length) {
|
|
6777
|
+
return;
|
|
6778
|
+
}
|
|
6779
|
+
const replaced = host.taken(folder, UploadUtil.topNames(batch));
|
|
6780
|
+
if (replaced.length && !await pi.ui.confirm(t("replaceTitle", { names: replaced.join(", ") }), t("replaceMessage"), { confirmLabel: t("replace") })) {
|
|
6781
|
+
return;
|
|
6782
|
+
}
|
|
6783
|
+
if (folder) {
|
|
6784
|
+
host.expandTo(folder);
|
|
6785
|
+
}
|
|
6786
|
+
setTransfer({ label: t("uploading", { name: "" }), done: 0, total: UploadUtil.totalBytes(batch) });
|
|
6787
|
+
try {
|
|
6788
|
+
const count = await WorkspaceClient.upload(root, folder, batch, (done, total, name) => setTransfer({ label: t("uploading", { name }), done, total }));
|
|
6789
|
+
pi.ui.notify(t("uploaded", { count }));
|
|
6790
|
+
} catch (error) {
|
|
6791
|
+
pi.ui.notify(t("uploadFailed", { message: Host.message(error) }), "error");
|
|
6792
|
+
} finally {
|
|
6793
|
+
setTransfer(undefined);
|
|
6794
|
+
await host.reloadFolder(folder);
|
|
6795
|
+
}
|
|
6796
|
+
};
|
|
6797
|
+
const pickFiles = (folder, folders) => {
|
|
6798
|
+
pickedFolder.current = folder;
|
|
6799
|
+
(folders ? folderPicker : filePicker).current?.click();
|
|
6800
|
+
};
|
|
6801
|
+
const onPicked = (event) => {
|
|
6802
|
+
const files = Array.from(event.target.files ?? []);
|
|
6803
|
+
event.target.value = "";
|
|
6804
|
+
if (files.length) {
|
|
6805
|
+
upload(pickedFolder.current, Promise.resolve(UploadUtil.fromFiles(files)));
|
|
6806
|
+
}
|
|
6807
|
+
};
|
|
6808
|
+
const download = async (entry) => {
|
|
6809
|
+
try {
|
|
6810
|
+
if (entry.kind === "directory") {
|
|
6811
|
+
setTransfer({ label: t("packing", { name: entry.name }), done: 0, total: 0 });
|
|
6812
|
+
}
|
|
6813
|
+
await WorkspaceClient.download(root, entry, (done, total) => setTransfer({ label: t("packing", { name: entry.name }), done, total }));
|
|
6814
|
+
} catch (error) {
|
|
6815
|
+
pi.ui.notify(t("downloadFailed", { message: Host.message(error) }), "error");
|
|
6816
|
+
} finally {
|
|
6817
|
+
setTransfer(undefined);
|
|
6818
|
+
}
|
|
6819
|
+
};
|
|
6820
|
+
const stopDragOpen = () => {
|
|
6821
|
+
clearTimeout(dragOpen.current?.timer);
|
|
6822
|
+
dragOpen.current = undefined;
|
|
6823
|
+
};
|
|
6824
|
+
const dragOver = (event, folder, entry) => {
|
|
6825
|
+
if (!acceptsDrop(event.dataTransfer)) {
|
|
6826
|
+
return;
|
|
6827
|
+
}
|
|
6828
|
+
event.preventDefault();
|
|
6829
|
+
event.stopPropagation();
|
|
6830
|
+
event.dataTransfer.dropEffect = event.dataTransfer.types.includes("Files") ? "copy" : "move";
|
|
6831
|
+
if (dropTarget !== folder) {
|
|
6832
|
+
setDropTarget(folder);
|
|
6833
|
+
}
|
|
6834
|
+
const closed = entry?.kind === "directory" && !host.expanded.has(entry.path) ? entry : undefined;
|
|
6835
|
+
if (dragOpen.current?.path !== closed?.path) {
|
|
6836
|
+
stopDragOpen();
|
|
6837
|
+
if (closed) {
|
|
6838
|
+
dragOpen.current = { path: closed.path, timer: setTimeout(() => host.toggle(closed), DRAG_OPEN_MS) };
|
|
6839
|
+
}
|
|
6840
|
+
}
|
|
6841
|
+
};
|
|
6842
|
+
const drop = (event, folder) => {
|
|
6843
|
+
if (!acceptsDrop(event.dataTransfer)) {
|
|
6844
|
+
return;
|
|
6845
|
+
}
|
|
6846
|
+
event.preventDefault();
|
|
6847
|
+
event.stopPropagation();
|
|
6848
|
+
setDropTarget(undefined);
|
|
6849
|
+
stopDragOpen();
|
|
6850
|
+
if (event.dataTransfer.types.includes("Files")) {
|
|
6851
|
+
upload(folder, UploadUtil.fromDrop(event.dataTransfer));
|
|
6852
|
+
return;
|
|
6853
|
+
}
|
|
6854
|
+
const dragged = pi.ui.fileDrag.get(event.dataTransfer);
|
|
6855
|
+
if (dragged?.cwd === root) {
|
|
6856
|
+
host.move(dragged.paths, folder);
|
|
6857
|
+
}
|
|
6858
|
+
};
|
|
6859
|
+
const dragLeave = (event) => {
|
|
6860
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
6861
|
+
setDropTarget(undefined);
|
|
6862
|
+
stopDragOpen();
|
|
6863
|
+
}
|
|
6864
|
+
};
|
|
6865
|
+
const dragEnd = () => {
|
|
6866
|
+
setDropTarget(undefined);
|
|
6867
|
+
stopDragOpen();
|
|
6868
|
+
};
|
|
6869
|
+
const view = /* @__PURE__ */ React.createElement(React.Fragment, null, transfer && /* @__PURE__ */ React.createElement("div", {
|
|
6870
|
+
className: "taw-transfer",
|
|
6871
|
+
role: "status"
|
|
6872
|
+
}, /* @__PURE__ */ React.createElement("span", null, transfer.label), transfer.total > 0 && /* @__PURE__ */ React.createElement("span", {
|
|
6873
|
+
className: "taw-detail"
|
|
6874
|
+
}, Math.floor(transfer.done / transfer.total * 100), "%"), /* @__PURE__ */ React.createElement("span", {
|
|
6875
|
+
className: "taw-transfer-bar",
|
|
6876
|
+
style: { width: transfer.total > 0 ? `${transfer.done / transfer.total * 100}%` : "0%" }
|
|
6877
|
+
})), /* @__PURE__ */ React.createElement("input", {
|
|
6878
|
+
ref: filePicker,
|
|
6879
|
+
type: "file",
|
|
6880
|
+
multiple: true,
|
|
6881
|
+
hidden: true,
|
|
6882
|
+
onChange: onPicked
|
|
6883
|
+
}), /* @__PURE__ */ React.createElement("input", {
|
|
6884
|
+
ref: (element) => {
|
|
6885
|
+
folderPicker.current = element;
|
|
6886
|
+
element?.setAttribute("webkitdirectory", "");
|
|
6887
|
+
},
|
|
6888
|
+
type: "file",
|
|
6889
|
+
hidden: true,
|
|
6890
|
+
onChange: onPicked
|
|
6891
|
+
}));
|
|
6892
|
+
return { transfer: view, dropTarget, upload, pickFiles, download, dragOver, drop, dragLeave, dragEnd };
|
|
6893
|
+
}
|
|
6894
|
+
|
|
6614
6895
|
// web-src/search.tsx
|
|
6615
6896
|
var DEBOUNCE_MS = 300;
|
|
6616
6897
|
var searches = new Map;
|
|
@@ -6907,8 +7188,9 @@ function SearchView() {
|
|
|
6907
7188
|
role: "tree",
|
|
6908
7189
|
"aria-label": t("search")
|
|
6909
7190
|
}, state.error && /* @__PURE__ */ React.createElement(Empty, {
|
|
6910
|
-
tone: "error"
|
|
6911
|
-
|
|
7191
|
+
tone: "error",
|
|
7192
|
+
title: t("failed", { message: state.error })
|
|
7193
|
+
}), rows.map((row) => {
|
|
6912
7194
|
if (row.kind === "folder") {
|
|
6913
7195
|
const open = !state.collapsed.includes(row.key);
|
|
6914
7196
|
const paths = groups.filter((group) => WorkspaceUtil.within(group.path, row.folder.path)).map((group) => group.path);
|
|
@@ -7035,10 +7317,6 @@ var roots = new Map;
|
|
|
7035
7317
|
var INDENT2 = 12;
|
|
7036
7318
|
var EXPANDED_KEY = "explorer.expanded";
|
|
7037
7319
|
var NO_DECORATIONS = { files: new Map, folders: new Map, ignored: [] };
|
|
7038
|
-
var DRAG_OPEN_MS = 600;
|
|
7039
|
-
function acceptsDrop(dataTransfer) {
|
|
7040
|
-
return dataTransfer.types.includes("Files") || pi.ui.fileDrag.has(dataTransfer);
|
|
7041
|
-
}
|
|
7042
7320
|
var RevealRequests = new Channel;
|
|
7043
7321
|
var ShowDirectory = new Channel;
|
|
7044
7322
|
function ExplorerView() {
|
|
@@ -7050,20 +7328,23 @@ function ExplorerView() {
|
|
|
7050
7328
|
const [selected, setSelected] = React.useState();
|
|
7051
7329
|
const [editing, setEditing] = React.useState();
|
|
7052
7330
|
const [picking, setPicking] = React.useState(false);
|
|
7331
|
+
const [revealing, setRevealing] = React.useState();
|
|
7332
|
+
const [shownRoot, setShownRoot] = React.useState(root);
|
|
7333
|
+
const [showExcluded, setShowExcluded] = useShowExcluded();
|
|
7053
7334
|
const [menu, openMenu] = useContextMenu();
|
|
7335
|
+
if (shownRoot !== root) {
|
|
7336
|
+
setShownRoot(root);
|
|
7337
|
+
setSelected(undefined);
|
|
7338
|
+
setEditing(undefined);
|
|
7339
|
+
}
|
|
7054
7340
|
const list2 = React.useRef(null);
|
|
7055
|
-
const [dropTarget, setDropTarget] = React.useState();
|
|
7056
|
-
const [transfer, setTransfer] = React.useState();
|
|
7057
|
-
const filePicker = React.useRef(null);
|
|
7058
|
-
const folderPicker = React.useRef(null);
|
|
7059
|
-
const pickedFolder = React.useRef("");
|
|
7060
|
-
const dragOpen = React.useRef(undefined);
|
|
7061
7341
|
const desktop = pi.ui.desktop;
|
|
7062
7342
|
const showsInFileManager = !!desktop && !TaLocation.isRemote(root);
|
|
7063
|
-
const git = useLoad(() => WorkspaceClient.status(root, true).catch(() => {
|
|
7343
|
+
const git = useLoad(async () => ({ root, status: await WorkspaceClient.status(root, true).catch(() => {
|
|
7064
7344
|
return;
|
|
7065
|
-
}), [root, changed]);
|
|
7066
|
-
const
|
|
7345
|
+
}) }), [root, changed]);
|
|
7346
|
+
const status = git.value?.root === root ? git.value.status : undefined;
|
|
7347
|
+
const decorations = React.useMemo(() => status?.repository ? GitUtil.decorations(status) : NO_DECORATIONS, [status]);
|
|
7067
7348
|
const FolderPicker = pi.ui.FolderPicker;
|
|
7068
7349
|
const load = React.useCallback(async (dirs) => {
|
|
7069
7350
|
const read = await Promise.all(dirs.map(async (dir) => {
|
|
@@ -7095,8 +7376,8 @@ function ExplorerView() {
|
|
|
7095
7376
|
return;
|
|
7096
7377
|
}
|
|
7097
7378
|
let live = true;
|
|
7098
|
-
pi.storage.directory(root).get(EXPANDED_KEY).then((
|
|
7099
|
-
const paths = WorkspaceUtil.paths(
|
|
7379
|
+
pi.storage.directory(root).get(EXPANDED_KEY).then((kept2) => {
|
|
7380
|
+
const paths = WorkspaceUtil.paths(kept2);
|
|
7100
7381
|
if (live) {
|
|
7101
7382
|
setTree((previous) => ({ ...previous, restored: true, expanded: new Set([...previous.expanded, ...paths]) }));
|
|
7102
7383
|
load(paths);
|
|
@@ -7127,18 +7408,21 @@ function ExplorerView() {
|
|
|
7127
7408
|
reveal(active.slice(prefix.length));
|
|
7128
7409
|
}
|
|
7129
7410
|
}, [active, root]);
|
|
7130
|
-
ShowDirectory.useReceive((directory) =>
|
|
7131
|
-
setRoot(directory);
|
|
7132
|
-
setSelected(undefined);
|
|
7133
|
-
});
|
|
7411
|
+
ShowDirectory.useReceive((directory) => setRoot(directory));
|
|
7134
7412
|
RevealRequests.useReceive((request) => {
|
|
7135
|
-
if (request.cwd === root
|
|
7136
|
-
if (request.cwd !== root) {
|
|
7137
|
-
setRoot(request.cwd);
|
|
7138
|
-
}
|
|
7413
|
+
if (request.cwd === root) {
|
|
7139
7414
|
reveal(request.path);
|
|
7415
|
+
} else if (request.cwd === cwd) {
|
|
7416
|
+
setRoot(cwd);
|
|
7417
|
+
setRevealing({ root: cwd, path: request.path });
|
|
7140
7418
|
}
|
|
7141
7419
|
});
|
|
7420
|
+
React.useEffect(() => {
|
|
7421
|
+
if (revealing?.root === root) {
|
|
7422
|
+
setRevealing(undefined);
|
|
7423
|
+
reveal(revealing.path);
|
|
7424
|
+
}
|
|
7425
|
+
}, [revealing, root]);
|
|
7142
7426
|
React.useEffect(() => {
|
|
7143
7427
|
if (selected) {
|
|
7144
7428
|
list2.current?.querySelector(`[data-path="${CSS.escape(selected)}"]`)?.scrollIntoView({ block: "nearest" });
|
|
@@ -7240,58 +7524,6 @@ function ExplorerView() {
|
|
|
7240
7524
|
const there = siblings(folder).map((name) => name.toLowerCase());
|
|
7241
7525
|
return names.filter((name) => there.includes(name.toLowerCase()));
|
|
7242
7526
|
};
|
|
7243
|
-
const upload = async (folder, pending) => {
|
|
7244
|
-
let batch;
|
|
7245
|
-
try {
|
|
7246
|
-
batch = await pending;
|
|
7247
|
-
} catch (error) {
|
|
7248
|
-
pi.ui.notify(t("uploadFailed", { message: Host.message(error) }), "error");
|
|
7249
|
-
return;
|
|
7250
|
-
}
|
|
7251
|
-
if (!batch.files.length && !batch.folders.length) {
|
|
7252
|
-
return;
|
|
7253
|
-
}
|
|
7254
|
-
const replaced = taken(folder, UploadUtil.topNames(batch));
|
|
7255
|
-
if (replaced.length && !await pi.ui.confirm(t("replaceTitle", { names: replaced.join(", ") }), t("replaceMessage"), { confirmLabel: t("replace") })) {
|
|
7256
|
-
return;
|
|
7257
|
-
}
|
|
7258
|
-
if (folder) {
|
|
7259
|
-
expand((previous) => WorkspaceUtil.reveal(new Set([...previous, folder]), folder));
|
|
7260
|
-
}
|
|
7261
|
-
setTransfer({ label: t("uploading", { name: "" }), done: 0, total: UploadUtil.totalBytes(batch) });
|
|
7262
|
-
try {
|
|
7263
|
-
const count = await WorkspaceClient.upload(root, folder, batch, (done, total, name) => setTransfer({ label: t("uploading", { name }), done, total }));
|
|
7264
|
-
pi.ui.notify(t("uploaded", { count }));
|
|
7265
|
-
} catch (error) {
|
|
7266
|
-
pi.ui.notify(t("uploadFailed", { message: Host.message(error) }), "error");
|
|
7267
|
-
} finally {
|
|
7268
|
-
setTransfer(undefined);
|
|
7269
|
-
await reloadFolder(folder);
|
|
7270
|
-
}
|
|
7271
|
-
};
|
|
7272
|
-
const pickFiles = (folder, folders) => {
|
|
7273
|
-
pickedFolder.current = folder;
|
|
7274
|
-
(folders ? folderPicker : filePicker).current?.click();
|
|
7275
|
-
};
|
|
7276
|
-
const onPicked = (event) => {
|
|
7277
|
-
const files = Array.from(event.target.files ?? []);
|
|
7278
|
-
event.target.value = "";
|
|
7279
|
-
if (files.length) {
|
|
7280
|
-
upload(pickedFolder.current, Promise.resolve(UploadUtil.fromFiles(files)));
|
|
7281
|
-
}
|
|
7282
|
-
};
|
|
7283
|
-
const download = async (entry) => {
|
|
7284
|
-
try {
|
|
7285
|
-
if (entry.kind === "directory") {
|
|
7286
|
-
setTransfer({ label: t("packing", { name: entry.name }), done: 0, total: 0 });
|
|
7287
|
-
}
|
|
7288
|
-
await WorkspaceClient.download(root, entry, (done, total) => setTransfer({ label: t("packing", { name: entry.name }), done, total }));
|
|
7289
|
-
} catch (error) {
|
|
7290
|
-
pi.ui.notify(t("downloadFailed", { message: Host.message(error) }), "error");
|
|
7291
|
-
} finally {
|
|
7292
|
-
setTransfer(undefined);
|
|
7293
|
-
}
|
|
7294
|
-
};
|
|
7295
7527
|
const move = async (paths, folder) => {
|
|
7296
7528
|
const moving = WorkspaceUtil.movable(paths, folder);
|
|
7297
7529
|
if (!moving.length) {
|
|
@@ -7325,48 +7557,18 @@ function ExplorerView() {
|
|
|
7325
7557
|
pi.ui.notify(t("moveFailed", { message: Host.message(error) }), "error");
|
|
7326
7558
|
}
|
|
7327
7559
|
};
|
|
7560
|
+
const { transfer, dropTarget, pickFiles, download, dragOver, drop, dragLeave, dragEnd } = useExplorerTransfer({
|
|
7561
|
+
root,
|
|
7562
|
+
expanded: tree.expanded,
|
|
7563
|
+
expandTo: (folder) => expand((previous) => WorkspaceUtil.reveal(new Set([...previous, folder]), folder)),
|
|
7564
|
+
taken,
|
|
7565
|
+
reloadFolder,
|
|
7566
|
+
toggle,
|
|
7567
|
+
move
|
|
7568
|
+
});
|
|
7328
7569
|
const showInFileManager = (path) => {
|
|
7329
7570
|
desktop?.showItemInFolder(absolute(path)).catch((error) => pi.ui.notify(t("revealFailed", { message: Host.message(error) }), "error"));
|
|
7330
7571
|
};
|
|
7331
|
-
const stopDragOpen = () => {
|
|
7332
|
-
clearTimeout(dragOpen.current?.timer);
|
|
7333
|
-
dragOpen.current = undefined;
|
|
7334
|
-
};
|
|
7335
|
-
const dragOver = (event, folder, entry) => {
|
|
7336
|
-
if (!acceptsDrop(event.dataTransfer)) {
|
|
7337
|
-
return;
|
|
7338
|
-
}
|
|
7339
|
-
event.preventDefault();
|
|
7340
|
-
event.stopPropagation();
|
|
7341
|
-
event.dataTransfer.dropEffect = event.dataTransfer.types.includes("Files") ? "copy" : "move";
|
|
7342
|
-
if (dropTarget !== folder) {
|
|
7343
|
-
setDropTarget(folder);
|
|
7344
|
-
}
|
|
7345
|
-
const closed = entry?.kind === "directory" && !tree.expanded.has(entry.path) ? entry : undefined;
|
|
7346
|
-
if (dragOpen.current?.path !== closed?.path) {
|
|
7347
|
-
stopDragOpen();
|
|
7348
|
-
if (closed) {
|
|
7349
|
-
dragOpen.current = { path: closed.path, timer: setTimeout(() => toggle(closed), DRAG_OPEN_MS) };
|
|
7350
|
-
}
|
|
7351
|
-
}
|
|
7352
|
-
};
|
|
7353
|
-
const drop = (event, folder) => {
|
|
7354
|
-
if (!acceptsDrop(event.dataTransfer)) {
|
|
7355
|
-
return;
|
|
7356
|
-
}
|
|
7357
|
-
event.preventDefault();
|
|
7358
|
-
event.stopPropagation();
|
|
7359
|
-
setDropTarget(undefined);
|
|
7360
|
-
stopDragOpen();
|
|
7361
|
-
if (event.dataTransfer.types.includes("Files")) {
|
|
7362
|
-
upload(folder, UploadUtil.fromDrop(event.dataTransfer));
|
|
7363
|
-
return;
|
|
7364
|
-
}
|
|
7365
|
-
const dragged = pi.ui.fileDrag.get(event.dataTransfer);
|
|
7366
|
-
if (dragged?.cwd === root) {
|
|
7367
|
-
move(dragged.paths, folder);
|
|
7368
|
-
}
|
|
7369
|
-
};
|
|
7370
7572
|
const absolute = (path) => path ? `${root.replace(/\/+$/, "")}/${path}` : root;
|
|
7371
7573
|
const findInFolder = (path) => {
|
|
7372
7574
|
SearchRequests.send({ cwd: root, include: path ? `${path}/**` : "" });
|
|
@@ -7416,7 +7618,7 @@ function ExplorerView() {
|
|
|
7416
7618
|
{ label: t("delete"), keys: MAC ? "⌘⌫" : "Delete", run: () => void remove(entry) }
|
|
7417
7619
|
];
|
|
7418
7620
|
};
|
|
7419
|
-
const rows = WorkspaceUtil.rows(tree.children, tree.expanded);
|
|
7621
|
+
const rows = WorkspaceUtil.rows(tree.children, tree.expanded, showExcluded ? undefined : (entry) => TaExcludedFiles.has(entry.name));
|
|
7420
7622
|
const activate = (entry, pin) => {
|
|
7421
7623
|
setSelected(entry.path);
|
|
7422
7624
|
if (entry.kind === "directory") {
|
|
@@ -7582,6 +7784,11 @@ function ExplorerView() {
|
|
|
7582
7784
|
icon: "ChevronsDownUp",
|
|
7583
7785
|
label: t("collapseAll"),
|
|
7584
7786
|
onClick: () => expand(() => new Set)
|
|
7787
|
+
}), /* @__PURE__ */ React.createElement(Action, {
|
|
7788
|
+
icon: "Eye",
|
|
7789
|
+
label: t("showExcluded"),
|
|
7790
|
+
active: showExcluded,
|
|
7791
|
+
onClick: () => setShowExcluded(!showExcluded)
|
|
7585
7792
|
}), /* @__PURE__ */ React.createElement(Action, {
|
|
7586
7793
|
icon: "FolderOpen",
|
|
7587
7794
|
label: t("changeFolder"),
|
|
@@ -7596,46 +7803,20 @@ function ExplorerView() {
|
|
|
7596
7803
|
onKeyDown: (event) => event.key === "Escape" && setSelected(undefined),
|
|
7597
7804
|
onDragOver: (event) => dragOver(event, ""),
|
|
7598
7805
|
onDrop: (event) => drop(event, ""),
|
|
7599
|
-
onDragLeave:
|
|
7600
|
-
|
|
7601
|
-
setDropTarget(undefined);
|
|
7602
|
-
stopDragOpen();
|
|
7603
|
-
}
|
|
7604
|
-
},
|
|
7605
|
-
onDragEnd: () => {
|
|
7606
|
-
setDropTarget(undefined);
|
|
7607
|
-
stopDragOpen();
|
|
7608
|
-
}
|
|
7806
|
+
onDragLeave: dragLeave,
|
|
7807
|
+
onDragEnd: dragEnd
|
|
7609
7808
|
}, tree.error && /* @__PURE__ */ React.createElement(Empty, {
|
|
7610
|
-
tone: "error"
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
},
|
|
7615
|
-
|
|
7616
|
-
},
|
|
7617
|
-
className: "taw-transfer-bar",
|
|
7618
|
-
style: { width: transfer.total > 0 ? `${transfer.done / transfer.total * 100}%` : "0%" }
|
|
7619
|
-
})), /* @__PURE__ */ React.createElement("input", {
|
|
7620
|
-
ref: filePicker,
|
|
7621
|
-
type: "file",
|
|
7622
|
-
multiple: true,
|
|
7623
|
-
hidden: true,
|
|
7624
|
-
onChange: onPicked
|
|
7625
|
-
}), /* @__PURE__ */ React.createElement("input", {
|
|
7626
|
-
ref: (element) => {
|
|
7627
|
-
folderPicker.current = element;
|
|
7628
|
-
element?.setAttribute("webkitdirectory", "");
|
|
7629
|
-
},
|
|
7630
|
-
type: "file",
|
|
7631
|
-
hidden: true,
|
|
7632
|
-
onChange: onPicked
|
|
7633
|
-
}), menu, picking && /* @__PURE__ */ React.createElement(FolderPicker, {
|
|
7809
|
+
tone: "error",
|
|
7810
|
+
title: t("failed", { message: tree.error })
|
|
7811
|
+
}), !tree.error && !tree.children.has("") && /* @__PURE__ */ React.createElement(Empty, {
|
|
7812
|
+
hint: t("loading")
|
|
7813
|
+
}), !tree.error && tree.children.has("") && rows.length === 0 && !creating && /* @__PURE__ */ React.createElement(Empty, {
|
|
7814
|
+
title: t("empty")
|
|
7815
|
+
}), shown), transfer, menu, picking && /* @__PURE__ */ React.createElement(FolderPicker, {
|
|
7634
7816
|
initial: root,
|
|
7635
7817
|
onClose: () => setPicking(false),
|
|
7636
7818
|
onPick: (path) => {
|
|
7637
7819
|
setRoot(path);
|
|
7638
|
-
setSelected(undefined);
|
|
7639
7820
|
setPicking(false);
|
|
7640
7821
|
}
|
|
7641
7822
|
}));
|
|
@@ -7693,7 +7874,10 @@ function OpenFilesView() {
|
|
|
7693
7874
|
className: "taw-list",
|
|
7694
7875
|
role: "listbox",
|
|
7695
7876
|
"aria-label": t("openFiles")
|
|
7696
|
-
}, files.length === 0 && /* @__PURE__ */ React.createElement(Empty,
|
|
7877
|
+
}, files.length === 0 && /* @__PURE__ */ React.createElement(Empty, {
|
|
7878
|
+
title: t("noOpenFiles"),
|
|
7879
|
+
hint: t("noOpenFilesHint")
|
|
7880
|
+
}), files.map((file) => /* @__PURE__ */ React.createElement("div", {
|
|
7697
7881
|
key: file.id,
|
|
7698
7882
|
role: "option",
|
|
7699
7883
|
tabIndex: 0,
|
|
@@ -7931,8 +8115,15 @@ function ScmView() {
|
|
|
7931
8115
|
}), t("commit"))), /* @__PURE__ */ React.createElement("div", {
|
|
7932
8116
|
className: "taw-list taw-scm-list"
|
|
7933
8117
|
}, status.error && /* @__PURE__ */ React.createElement(Empty, {
|
|
7934
|
-
tone: "error"
|
|
7935
|
-
|
|
8118
|
+
tone: "error",
|
|
8119
|
+
title: t("failed", { message: status.error })
|
|
8120
|
+
}), !status.error && !value && /* @__PURE__ */ React.createElement(Empty, {
|
|
8121
|
+
hint: t("loading")
|
|
8122
|
+
}), value && !value.repository && /* @__PURE__ */ React.createElement(Empty, {
|
|
8123
|
+
title: t("notRepository")
|
|
8124
|
+
}), value?.repository && rows.length === 0 && /* @__PURE__ */ React.createElement(Empty, {
|
|
8125
|
+
title: t("noChanges")
|
|
8126
|
+
}), groups.map(([group, list2]) => {
|
|
7936
8127
|
if (list2.length === 0) {
|
|
7937
8128
|
return null;
|
|
7938
8129
|
}
|
|
@@ -8062,10 +8253,10 @@ var SETI_FONT = "data:font/woff;base64,d09GRgABAAAAAJGkAAsAAAAA3RAAAQAAAAAAAAAAA
|
|
|
8062
8253
|
|
|
8063
8254
|
// web-src/style.ts
|
|
8064
8255
|
var STYLE = `
|
|
8065
|
-
.taw-view { --taw-git-added: var(--ta-green); --taw-git-deleted: var(--ta-red); --taw-git-modified: var(--ta-yellow); --taw-git-conflict: #e4676b; position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--ta-text); font-size: 13px; }
|
|
8256
|
+
.taw-view { --taw-git-added: var(--ta-green); --taw-git-deleted: var(--ta-red); --taw-git-modified: var(--ta-yellow); --taw-git-conflict: #e4676b; position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--ta-text); font-size: calc(13px * var(--ta-font-scale)); }
|
|
8066
8257
|
:root[data-theme='light'] .taw-view { --taw-git-modified: #b8860b; --taw-git-conflict: #ad0707; }
|
|
8067
8258
|
.taw-view-head { display: flex; align-items: center; gap: 4px; height: 30px; padding: 0 8px 0 12px; flex: none; }
|
|
8068
|
-
.taw-view-title { flex: 1; min-width: 0; font-size: 12px; font-weight: 600; color: var(--ta-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
8259
|
+
.taw-view-title { flex: 1; min-width: 0; font-size: calc(12px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
8069
8260
|
.taw-actions { display: flex; gap: 2px; }
|
|
8070
8261
|
.taw-action { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: none; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--ta-muted); cursor: pointer; }
|
|
8071
8262
|
.taw-action:hover:not(:disabled) { background: var(--ta-hover); color: var(--ta-text); }
|
|
@@ -8073,6 +8264,7 @@ var STYLE = `
|
|
|
8073
8264
|
.taw-action.taw-on { background: var(--ta-selected); color: var(--ta-text); }
|
|
8074
8265
|
.taw-action:focus-visible, .taw-row:focus-visible, .taw-row-main:focus-visible, .taw-button:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; }
|
|
8075
8266
|
.taw-list { flex: 1; min-height: 0; overflow: auto; padding: 0 4px 12px; }
|
|
8267
|
+
.taw-list:has(> .ta-empty) { display: flex; flex-direction: column; }
|
|
8076
8268
|
.taw-row { position: relative; display: flex; align-items: center; gap: 6px; width: 100%; height: 24px; padding: 0 6px 0 8px; border: 0; border-radius: 6px; background: none; color: var(--ta-body); font: inherit; text-align: left; cursor: pointer; user-select: none; outline: none; }
|
|
8077
8269
|
.taw-row:hover { background: var(--ta-hover); }
|
|
8078
8270
|
.taw-row.taw-selected { background: var(--ta-selected); color: var(--ta-text); }
|
|
@@ -8092,41 +8284,39 @@ var STYLE = `
|
|
|
8092
8284
|
.taw-tree:hover .taw-guide { opacity: 1; }
|
|
8093
8285
|
.taw-tree-row.taw-drop, .taw-tree-row.taw-drop:hover { background: color-mix(in srgb, var(--ta-border-focus) 16%, transparent); }
|
|
8094
8286
|
.taw-tree.taw-drop-root { box-shadow: inset 0 0 0 1px var(--ta-border-focus); background: color-mix(in srgb, var(--ta-border-focus) 8%, transparent); }
|
|
8095
|
-
.taw-transfer { position: relative; flex: none; display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-top: 1px solid var(--ta-border-muted); color: var(--ta-secondary); font-size: 12px; overflow: hidden; }
|
|
8287
|
+
.taw-transfer { position: relative; flex: none; display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-top: 1px solid var(--ta-border-muted); color: var(--ta-secondary); font-size: calc(12px * var(--ta-font-scale)); overflow: hidden; }
|
|
8096
8288
|
.taw-transfer > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
8097
8289
|
.taw-transfer .taw-detail { flex: none; }
|
|
8098
8290
|
.taw-transfer-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--ta-border-focus); transition: width 0.2s ease; }
|
|
8099
8291
|
.taw-editing { cursor: default; background: none !important; }
|
|
8100
8292
|
.taw-name-input { position: relative; flex: 1; min-width: 0; display: flex; }
|
|
8101
|
-
.taw-input.taw-inline { height: 22px; padding: 0 4px; border-radius: 4px; font-size: 13px; }
|
|
8293
|
+
.taw-input.taw-inline { height: 22px; padding: 0 4px; border-radius: 4px; font-size: calc(13px * var(--ta-font-scale)); }
|
|
8102
8294
|
.taw-input.taw-inline.taw-error { border-color: var(--ta-red); }
|
|
8103
8295
|
.taw-input.taw-inline.taw-warning { border-color: var(--ta-yellow); }
|
|
8104
|
-
.taw-input-message { padding: 4px 6px; border-radius: 4px; font-size: 12px; line-height: 1.4; white-space: normal; }
|
|
8296
|
+
.taw-input-message { padding: 4px 6px; border-radius: 4px; font-size: calc(12px * var(--ta-font-scale)); line-height: 1.4; white-space: normal; }
|
|
8105
8297
|
.taw-name-input .taw-input-message { position: absolute; z-index: 5; top: 100%; left: 0; right: 0; margin-top: 1px; box-shadow: var(--ta-shadow-pop); }
|
|
8106
8298
|
.taw-input-message.taw-error { background: color-mix(in srgb, var(--ta-red) 16%, var(--ta-card)); border: 1px solid var(--ta-red); color: var(--ta-text); }
|
|
8107
8299
|
.taw-input-message.taw-warning { background: color-mix(in srgb, var(--ta-yellow) 16%, var(--ta-card)); border: 1px solid var(--ta-yellow); color: var(--ta-text); }
|
|
8108
8300
|
.taw-menu { position: fixed; z-index: 80; min-width: 210px; max-width: 320px; display: flex; flex-direction: column; gap: 1px; padding: 6px; border-radius: 12px; border: 1px solid var(--ta-border); background: var(--ta-side); box-shadow: var(--ta-shadow-pop); animation: taw-fade 100ms ease-out; }
|
|
8109
|
-
.taw-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex: none; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ta-text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; outline: none; }
|
|
8301
|
+
.taw-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex: none; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ta-text); font: inherit; font-size: calc(13px * var(--ta-font-scale)); text-align: left; cursor: pointer; outline: none; }
|
|
8110
8302
|
.taw-menu-item:hover:not(:disabled), .taw-menu-item:focus-visible { background: var(--ta-hover); }
|
|
8111
8303
|
.taw-menu-item:disabled { opacity: 0.45; cursor: default; }
|
|
8112
|
-
.taw-menu-item kbd { font-family: inherit; font-size: 12px; color: var(--ta-muted); }
|
|
8304
|
+
.taw-menu-item kbd { font-family: inherit; font-size: calc(12px * var(--ta-font-scale)); color: var(--ta-muted); }
|
|
8113
8305
|
.taw-menu-line { flex: none; height: 1px; margin: 5px 8px; border: 0; background: var(--ta-border-muted); }
|
|
8114
8306
|
@keyframes taw-fade { from { opacity: 0; } }
|
|
8115
8307
|
.taw-section-head { display: flex; align-items: center; gap: 4px; height: 26px; margin-top: 6px; padding-right: 6px; border-radius: 6px; }
|
|
8116
8308
|
.taw-section-head:hover { background: var(--ta-hover); }
|
|
8117
|
-
.taw-section-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; height: 100%; padding: 0 0 0 4px; border: 0; background: none; color: var(--ta-secondary); font: inherit; font-size: 12px; font-weight: 600; text-align: left; cursor: pointer; }
|
|
8309
|
+
.taw-section-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; height: 100%; padding: 0 0 0 4px; border: 0; background: none; color: var(--ta-secondary); font: inherit; font-size: calc(12px * var(--ta-font-scale)); font-weight: 600; text-align: left; cursor: pointer; }
|
|
8118
8310
|
.taw-section-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
8119
|
-
.taw-badge { flex: none; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--ta-chip); color: var(--ta-secondary); font-size: 11px; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
|
|
8311
|
+
.taw-badge { flex: none; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--ta-chip); color: var(--ta-secondary); font-size: calc(11px * var(--ta-font-scale)); line-height: calc(18px * var(--ta-font-scale)); text-align: center; font-variant-numeric: tabular-nums; }
|
|
8120
8312
|
.taw-twisty { display: inline-flex; width: 14px; flex: none; color: var(--ta-muted); }
|
|
8121
8313
|
.taw-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
8122
|
-
.taw-detail { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; }
|
|
8123
|
-
.taw-count { margin-left: auto; padding: 0 6px; border-radius: 8px; background: var(--ta-chip); color: var(--ta-secondary); font-size: 11px; line-height: 16px; }
|
|
8124
|
-
.taw-letter { margin-left: auto; width: 14px; flex: none; text-align: center; font-size: 12px; font-weight: 600; }
|
|
8125
|
-
.taw-group { display: flex; align-items: center; gap: 6px; margin: 8px 0 2px; padding: 0 8px; font-size: 11px; font-weight: 600; color: var(--ta-secondary); }
|
|
8126
|
-
.taw-empty { padding: 12px; color: var(--ta-muted); font-size: 12px; line-height: 1.6; }
|
|
8127
|
-
.taw-empty p { margin: 0 0 8px; }
|
|
8314
|
+
.taw-detail { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
8315
|
+
.taw-count { margin-left: auto; padding: 0 6px; border-radius: 8px; background: var(--ta-chip); color: var(--ta-secondary); font-size: calc(11px * var(--ta-font-scale)); line-height: calc(16px * var(--ta-font-scale)); }
|
|
8316
|
+
.taw-letter { margin-left: auto; width: 14px; flex: none; text-align: center; font-size: calc(12px * var(--ta-font-scale)); font-weight: 600; }
|
|
8317
|
+
.taw-group { display: flex; align-items: center; gap: 6px; margin: 8px 0 2px; padding: 0 8px; font-size: calc(11px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-secondary); }
|
|
8128
8318
|
.taw-error { color: var(--ta-red); }
|
|
8129
|
-
.taw-note { color: var(--ta-muted); font-size: 12px; }
|
|
8319
|
+
.taw-note { color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
8130
8320
|
.taw-pad { padding: 8px; margin: 0; line-height: 1.6; }
|
|
8131
8321
|
.taw-button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--ta-border); border-radius: 6px; background: var(--ta-card); color: var(--ta-text); font: inherit; cursor: pointer; }
|
|
8132
8322
|
.taw-button:hover { background: var(--ta-hover); }
|
|
@@ -8136,24 +8326,24 @@ var STYLE = `
|
|
|
8136
8326
|
.taw-search-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
|
|
8137
8327
|
.taw-search-fields .taw-field { flex: none; align-items: flex-start; }
|
|
8138
8328
|
.taw-search-fields .taw-field .taw-action { margin-top: 3px; width: 22px; height: 22px; }
|
|
8139
|
-
.taw-field .taw-input.taw-search-input { resize: none; height: auto; min-height: 28px; padding: 5px 4px 5px 8px; line-height: 18px; overflow: hidden; }
|
|
8329
|
+
.taw-field .taw-input.taw-search-input { resize: none; height: auto; min-height: 28px; padding: 5px 4px 5px 8px; line-height: calc(18px * var(--ta-font-scale)); overflow: hidden; }
|
|
8140
8330
|
.taw-field.taw-invalid { border-color: var(--ta-red); }
|
|
8141
8331
|
.taw-replace-row { display: flex; align-items: center; gap: 2px; }
|
|
8142
8332
|
.taw-replace-row .taw-field { flex: 1; }
|
|
8143
8333
|
.taw-details-toggle { display: flex; justify-content: flex-end; margin: -4px 0 -6px; }
|
|
8144
8334
|
.taw-details-toggle .taw-action { width: 22px; height: 16px; }
|
|
8145
8335
|
.taw-search-details { display: flex; flex-direction: column; gap: 6px; }
|
|
8146
|
-
.taw-search-label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--ta-secondary); }
|
|
8147
|
-
.taw-search-label .taw-input { flex: none; height: 28px; font-size: 12.5px; }
|
|
8336
|
+
.taw-search-label { display: flex; flex-direction: column; gap: 3px; font-size: calc(11px * var(--ta-font-scale)); color: var(--ta-secondary); }
|
|
8337
|
+
.taw-search-label .taw-input { flex: none; height: 28px; font-size: calc(12.5px * var(--ta-font-scale)); }
|
|
8148
8338
|
.taw-results-head { display: flex; align-items: center; gap: 4px; min-height: 26px; padding: 0 8px 0 12px; flex: none; }
|
|
8149
|
-
.taw-results-summary { flex: 1; min-width: 0; color: var(--ta-muted); font-size: 12px; }
|
|
8339
|
+
.taw-results-summary { flex: 1; min-width: 0; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
8150
8340
|
.taw-results-summary .taw-summary { padding: 0; }
|
|
8151
8341
|
.taw-progress { display: block; width: 100%; height: 2px; border-radius: 1px; background: linear-gradient(90deg, transparent, var(--ta-accent), transparent) 0 0 / 40% 100% no-repeat; animation: taw-slide 1s linear infinite; }
|
|
8152
8342
|
.taw-progress-bar { position: absolute; left: 0; right: 0; top: 30px; height: 2px; background: linear-gradient(90deg, transparent, var(--ta-accent), transparent) 0 0 / 30% 100% no-repeat; animation: taw-slide 1.1s linear infinite; z-index: 2; }
|
|
8153
8343
|
@keyframes taw-slide { from { background-position: -40% 0; } to { background-position: 140% 0; } }
|
|
8154
8344
|
.taw-result-file { padding-right: 6px; }
|
|
8155
8345
|
.taw-commit { display: flex; flex-direction: column; gap: 8px; padding: 2px 10px 10px; flex: none; }
|
|
8156
|
-
.taw-input.taw-commit-input { flex: none; resize: none; height: auto; min-height: 34px; max-height: 200px; padding: 7px 10px; border-radius: 8px; line-height: 18px; }
|
|
8346
|
+
.taw-input.taw-commit-input { flex: none; resize: none; height: auto; min-height: 34px; max-height: 200px; padding: 7px 10px; border-radius: 8px; line-height: calc(18px * var(--ta-font-scale)); }
|
|
8157
8347
|
.taw-button.taw-commit-button { justify-content: center; height: 30px; border-radius: 8px; border-color: var(--ta-border); background: var(--ta-raised); color: var(--ta-secondary); font-weight: 500; transition: background 120ms, color 120ms, opacity 120ms; }
|
|
8158
8348
|
.taw-button.taw-commit-button:hover:not(:disabled) { background: var(--ta-hover-strong); color: var(--ta-text); }
|
|
8159
8349
|
/* With a message, it stands out a little, without a bright bar in the side panel. */
|
|
@@ -8167,27 +8357,27 @@ var STYLE = `
|
|
|
8167
8357
|
.taw-scm-row { padding-right: 6px; }
|
|
8168
8358
|
.taw-field { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; padding-right: 2px; border: 1px solid var(--ta-border-field); border-radius: 6px; background: var(--ta-input); }
|
|
8169
8359
|
.taw-field:focus-within { border-color: var(--ta-border-focus); }
|
|
8170
|
-
.taw-input { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--ta-border-field); border-radius: 6px; background: var(--ta-input); color: var(--ta-text); font: inherit; font-size: 13px; outline: none; }
|
|
8360
|
+
.taw-input { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--ta-border-field); border-radius: 6px; background: var(--ta-input); color: var(--ta-text); font: inherit; font-size: calc(13px * var(--ta-font-scale)); outline: none; }
|
|
8171
8361
|
.taw-input:focus { border-color: var(--ta-border-focus); }
|
|
8172
8362
|
.taw-field .taw-input { height: 28px; border: 0; background: none; }
|
|
8173
|
-
.taw-summary { padding: 4px 8px 6px; color: var(--ta-muted); font-size: 12px; }
|
|
8363
|
+
.taw-summary { padding: 4px 8px 6px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
8174
8364
|
.taw-match { padding-left: 36px; padding-right: 6px; }
|
|
8175
|
-
.taw-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: pre; color: var(--ta-body); font-size: 12.5px; }
|
|
8365
|
+
.taw-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: pre; color: var(--ta-body); font-size: calc(12.5px * var(--ta-font-scale)); }
|
|
8176
8366
|
.taw-preview mark { background: color-mix(in srgb, var(--ta-yellow) 32%, transparent); color: inherit; border-radius: 2px; }
|
|
8177
8367
|
.taw-preview del { background: color-mix(in srgb, var(--ta-red) 22%, transparent); color: inherit; text-decoration: line-through; }
|
|
8178
8368
|
.taw-preview ins { background: color-mix(in srgb, var(--ta-green) 24%, transparent); color: inherit; text-decoration: none; }
|
|
8179
|
-
.taw-chip { padding: 0 6px; border-radius: 8px; background: var(--ta-chip); font-size: 11px; line-height: 18px; }
|
|
8369
|
+
.taw-chip { padding: 0 6px; border-radius: 8px; background: var(--ta-chip); font-size: calc(11px * var(--ta-font-scale)); line-height: calc(18px * var(--ta-font-scale)); }
|
|
8180
8370
|
.taw-editor { display: flex; flex-direction: column; height: 100%; min-height: 0; background: var(--ta-main); color: var(--ta-text); }
|
|
8181
|
-
.taw-editor-head { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px; border-bottom: 1px solid var(--ta-border-muted); font-size: 12px; color: var(--ta-secondary); flex: none; }
|
|
8371
|
+
.taw-editor-head { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px; border-bottom: 1px solid var(--ta-border-muted); font-size: calc(12px * var(--ta-font-scale)); color: var(--ta-secondary); flex: none; }
|
|
8182
8372
|
.taw-editor-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--ta-mono); }
|
|
8183
8373
|
.taw-view > .taw-editor { flex: 1; height: auto; }
|
|
8184
|
-
.taw-browser { display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--ta-text); font-size: 13px; }
|
|
8374
|
+
.taw-browser { display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--ta-text); font-size: calc(13px * var(--ta-font-scale)); }
|
|
8185
8375
|
.taw-browser-bar { position: relative; display: flex; align-items: center; gap: 2px; height: 42px; padding: 0 8px; border-bottom: 1px solid var(--ta-border-muted); flex: none; }
|
|
8186
8376
|
.taw-browser-bar > .taw-action { width: 28px; height: 28px; border-radius: 7px; }
|
|
8187
8377
|
.taw-address { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 30px; margin: 0 4px; padding: 0 3px 0 11px; border: 1px solid transparent; border-radius: 15px; background: var(--ta-chip); transition: background-color 120ms, border-color 120ms; }
|
|
8188
8378
|
.taw-address:hover { background: color-mix(in srgb, var(--ta-chip) 70%, var(--ta-text) 6%); }
|
|
8189
8379
|
.taw-address:focus-within { border-color: var(--ta-border-focus); background: var(--ta-input); }
|
|
8190
|
-
.taw-address input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; color: var(--ta-text); font: inherit; font-size: 12.5px; outline: none; text-overflow: ellipsis; }
|
|
8380
|
+
.taw-address input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; color: var(--ta-text); font: inherit; font-size: calc(12.5px * var(--ta-font-scale)); outline: none; text-overflow: ellipsis; }
|
|
8191
8381
|
.taw-address input::placeholder { color: var(--ta-muted); }
|
|
8192
8382
|
.taw-address-icon { display: inline-flex; flex: none; color: var(--ta-muted); }
|
|
8193
8383
|
.taw-address-go { width: 24px; height: 24px; border-radius: 12px; }
|
|
@@ -8199,33 +8389,33 @@ var STYLE = `
|
|
|
8199
8389
|
.taw-browser-blank .taw-browser-hero { margin: auto 0; }
|
|
8200
8390
|
.taw-browser-hero { display: flex; flex-direction: column; align-items: center; max-width: 380px; text-align: center; }
|
|
8201
8391
|
.taw-browser-mark { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin-bottom: 14px; border-radius: 14px; background: var(--ta-chip); color: var(--ta-secondary); }
|
|
8202
|
-
.taw-browser-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--ta-text); }
|
|
8203
|
-
.taw-browser-sub { margin: 6px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--ta-muted); }
|
|
8392
|
+
.taw-browser-title { margin: 0; font-size: calc(14px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-text); }
|
|
8393
|
+
.taw-browser-sub { margin: 6px 0 0; font-size: calc(12.5px * var(--ta-font-scale)); line-height: 1.6; color: var(--ta-muted); }
|
|
8204
8394
|
.taw-browser-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 16px; }
|
|
8205
|
-
.taw-browser-chip { height: 26px; padding: 0 10px; border: 1px solid var(--ta-border); border-radius: 13px; background: none; color: var(--ta-secondary); font-family: var(--ta-mono); font-size: 11px; cursor: pointer; transition: background-color 120ms, color 120ms; }
|
|
8395
|
+
.taw-browser-chip { height: 26px; padding: 0 10px; border: 1px solid var(--ta-border); border-radius: 13px; background: none; color: var(--ta-secondary); font-family: var(--ta-mono); font-size: calc(11px * var(--ta-font-scale)); cursor: pointer; transition: background-color 120ms, color 120ms; }
|
|
8206
8396
|
.taw-browser-chip:hover { background: var(--ta-hover); color: var(--ta-text); }
|
|
8207
8397
|
.taw-browser-recent { width: 100%; max-width: 480px; margin-top: 32px; }
|
|
8208
|
-
.taw-browser-heading { margin: 0 0 4px; padding: 0 10px; font-size: 11px; font-weight: 600; color: var(--ta-secondary); }
|
|
8398
|
+
.taw-browser-heading { margin: 0 0 4px; padding: 0 10px; font-size: calc(11px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-secondary); }
|
|
8209
8399
|
.taw-browser-site { display: flex; align-items: center; border-radius: 8px; }
|
|
8210
8400
|
.taw-browser-site:hover { background: var(--ta-hover); }
|
|
8211
8401
|
.taw-browser-site-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 4px 0 8px; border: 0; background: none; color: var(--ta-body); font: inherit; text-align: left; cursor: pointer; outline: none; }
|
|
8212
|
-
.taw-browser-letter { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--ta-chip); color: var(--ta-secondary); font-size: 11px; font-weight: 600; }
|
|
8402
|
+
.taw-browser-letter { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--ta-chip); color: var(--ta-secondary); font-size: calc(11px * var(--ta-font-scale)); font-weight: 600; }
|
|
8213
8403
|
.taw-browser-host { flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-text); }
|
|
8214
|
-
.taw-browser-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; }
|
|
8404
|
+
.taw-browser-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
|
|
8215
8405
|
.taw-browser-remove { margin-right: 6px; opacity: 0; }
|
|
8216
8406
|
.taw-browser-site:hover .taw-browser-remove, .taw-browser-remove:focus-visible { opacity: 1; }
|
|
8217
8407
|
.taw-browser-site-main:focus-visible { box-shadow: inset 0 0 0 1px var(--ta-border-focus); border-radius: 8px; }
|
|
8218
|
-
.taw-browser-foot { margin: auto 0 0; padding-top: 24px; max-width: 340px; text-align: center; font-size: 11.5px; line-height: 1.6; color: var(--ta-muted); opacity: 0.8; }
|
|
8408
|
+
.taw-browser-foot { margin: auto 0 0; padding-top: 24px; max-width: 340px; text-align: center; font-size: calc(11.5px * var(--ta-font-scale)); line-height: 1.6; color: var(--ta-muted); opacity: 0.8; }
|
|
8219
8409
|
.taw-editor-tools { display: flex; align-items: center; gap: 8px; flex: none; min-width: 0; }
|
|
8220
8410
|
.taw-editor-tools .taw-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
8221
8411
|
.taw-warning { color: var(--ta-yellow); }
|
|
8222
8412
|
.taw-link { padding: 0; border: 0; background: none; color: var(--ta-link); font: inherit; cursor: pointer; }
|
|
8223
8413
|
.taw-link:hover { text-decoration: underline; }
|
|
8224
|
-
.taw-button.taw-small { height: 24px; padding: 0 8px; font-size: 12px; flex: none; }
|
|
8414
|
+
.taw-button.taw-small { height: 24px; padding: 0 8px; font-size: calc(12px * var(--ta-font-scale)); flex: none; }
|
|
8225
8415
|
.taw-button:disabled { opacity: 0.6; cursor: default; }
|
|
8226
8416
|
.taw-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ta-text); }
|
|
8227
8417
|
.taw-segmented { display: inline-flex; flex: none; min-inline-size: 0; margin: 0; border: 0; padding: 2px; border-radius: 7px; background: var(--ta-chip); }
|
|
8228
|
-
.taw-segmented > button { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border: 0; border-radius: 5px; background: none; color: var(--ta-secondary); font: inherit; font-size: 12px; cursor: pointer; }
|
|
8418
|
+
.taw-segmented > button { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border: 0; border-radius: 5px; background: none; color: var(--ta-secondary); font: inherit; font-size: calc(12px * var(--ta-font-scale)); cursor: pointer; }
|
|
8229
8419
|
.taw-segmented > button:hover { color: var(--ta-text); }
|
|
8230
8420
|
.taw-segmented > button.taw-on { background: var(--ta-main); color: var(--ta-text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
|
|
8231
8421
|
.taw-segmented > button:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; }
|
|
@@ -8241,23 +8431,23 @@ var STYLE = `
|
|
|
8241
8431
|
.taw-preview-image.taw-actual { align-items: flex-start; justify-content: flex-start; }
|
|
8242
8432
|
.taw-preview-image.taw-actual .taw-image-toggle { max-width: none; max-height: none; margin: auto; cursor: zoom-out; }
|
|
8243
8433
|
.taw-preview-image.taw-actual img { max-width: none; max-height: none; }
|
|
8244
|
-
.taw-message { padding: 16px; color: var(--ta-muted); font-size: 13px; }
|
|
8245
|
-
.taw-code { flex: 1; min-height: 0; overflow: auto; padding: 6px 0; background: var(--ta-code); font-family: var(--ta-mono); font-size: 12px; line-height: 20px; }
|
|
8434
|
+
.taw-message { padding: 16px; color: var(--ta-muted); font-size: calc(13px * var(--ta-font-scale)); }
|
|
8435
|
+
.taw-code { flex: 1; min-height: 0; overflow: auto; padding: 6px 0; background: var(--ta-code); font-family: var(--ta-mono); font-size: calc(12px * var(--ta-font-scale)); line-height: calc(20px * var(--ta-font-scale)); }
|
|
8246
8436
|
.taw-code-block { content-visibility: auto; }
|
|
8247
8437
|
.taw-code-line { display: flex; min-width: max-content; white-space: pre; }
|
|
8248
8438
|
.taw-code-line.taw-current { background: var(--ta-selected); }
|
|
8249
8439
|
.taw-gutter { position: sticky; left: 0; flex: none; width: var(--taw-gutter, 5ch); padding-right: 12px; background: var(--ta-code); color: var(--ta-muted); text-align: right; user-select: none; }
|
|
8250
8440
|
.taw-text { padding-right: 16px; }
|
|
8251
|
-
.taw-hint { flex: none; padding: 4px 12px; border-bottom: 1px solid var(--ta-border-muted); background: var(--ta-raised); color: var(--ta-secondary); font-size: 12px; }
|
|
8441
|
+
.taw-hint { flex: none; padding: 4px 12px; border-bottom: 1px solid var(--ta-border-muted); background: var(--ta-raised); color: var(--ta-secondary); font-size: calc(12px * var(--ta-font-scale)); }
|
|
8252
8442
|
.taw-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
|
|
8253
8443
|
.taw-browser-stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
|
|
8254
8444
|
.taw-webview { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
|
|
8255
|
-
.taw-browser-driven { display: inline-flex; align-items: center; flex: none; gap: 6px; height: 22px; margin-right: 2px; padding: 0 9px 0 8px; border-radius: 11px; background: color-mix(in srgb, var(--ta-green) 14%, transparent); color: var(--ta-green); font-size: 11.5px; white-space: nowrap; }
|
|
8445
|
+
.taw-browser-driven { display: inline-flex; align-items: center; flex: none; gap: 6px; height: 22px; margin-right: 2px; padding: 0 9px 0 8px; border-radius: 11px; background: color-mix(in srgb, var(--ta-green) 14%, transparent); color: var(--ta-green); font-size: calc(11.5px * var(--ta-font-scale)); white-space: nowrap; }
|
|
8256
8446
|
.taw-browser-driven-dot { width: 6px; height: 6px; border-radius: 3px; background: currentColor; animation: taw-pulse 1.2s ease-in-out infinite; }
|
|
8257
8447
|
@keyframes taw-pulse { 50% { opacity: 0.35; } }
|
|
8258
|
-
.taw-browser-import { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; padding: 0; border: 0; background: none; color: var(--ta-secondary); font: inherit; font-size: 12.5px; cursor: pointer; }
|
|
8448
|
+
.taw-browser-import { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; padding: 0; border: 0; background: none; color: var(--ta-secondary); font: inherit; font-size: calc(12.5px * var(--ta-font-scale)); cursor: pointer; }
|
|
8259
8449
|
.taw-browser-import:hover { color: var(--ta-text); text-decoration: underline; text-underline-offset: 3px; }
|
|
8260
|
-
.taw-import { display: flex; flex-direction: column; gap: 12px; width: min(420px, 80vw); font-size: 13px; color: var(--ta-text); }
|
|
8450
|
+
.taw-import { display: flex; flex-direction: column; gap: 12px; width: min(420px, 80vw); font-size: calc(13px * var(--ta-font-scale)); color: var(--ta-text); }
|
|
8261
8451
|
.taw-import-hint { margin: 0; color: var(--ta-secondary); line-height: 1.6; }
|
|
8262
8452
|
.taw-import-error { margin: 0; color: var(--ta-red); line-height: 1.5; overflow-wrap: anywhere; }
|
|
8263
8453
|
.taw-import-profiles { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow: auto; }
|
|
@@ -8273,7 +8463,7 @@ var STYLE = `
|
|
|
8273
8463
|
.taw-button.taw-primary { border-color: var(--ta-brand); background: var(--ta-brand); color: var(--ta-brand-text); font-weight: 500; }
|
|
8274
8464
|
.taw-button.taw-primary:hover:not(:disabled) { background: var(--ta-brand); opacity: 0.88; }
|
|
8275
8465
|
.taw-button:disabled { opacity: 0.45; cursor: default; }
|
|
8276
|
-
.taw-link { padding: 0; border: 0; background: none; color: var(--ta-muted); font: inherit; font-size: 12.5px; cursor: pointer; }
|
|
8466
|
+
.taw-link { padding: 0; border: 0; background: none; color: var(--ta-muted); font: inherit; font-size: calc(12.5px * var(--ta-font-scale)); cursor: pointer; }
|
|
8277
8467
|
.taw-link:hover:not(:disabled) { color: var(--ta-text); text-decoration: underline; text-underline-offset: 3px; }
|
|
8278
8468
|
.taw-address-favicon { width: 14px; height: 14px; border-radius: 3px; object-fit: contain; }
|
|
8279
8469
|
.taw-browser-failure { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; background: var(--ta-main); text-align: center; }
|
|
@@ -8284,45 +8474,133 @@ var STYLE = `
|
|
|
8284
8474
|
.taw-action { width: 32px; height: 32px; }
|
|
8285
8475
|
.taw-row-actions { display: flex; }
|
|
8286
8476
|
.taw-guide { opacity: 1; }
|
|
8287
|
-
.taw-input { height: 34px; font-size: 16px; }
|
|
8288
|
-
.taw-field .taw-input, .taw-search-label .taw-input { height: 34px; font-size: 16px; }
|
|
8289
|
-
.taw-field .taw-input.taw-search-input { min-height: 34px; padding-top: 7px; padding-bottom: 7px; line-height: 20px; }
|
|
8477
|
+
.taw-input { height: 34px; font-size: calc(16px * var(--ta-font-scale)); }
|
|
8478
|
+
.taw-field .taw-input, .taw-search-label .taw-input { height: 34px; font-size: calc(16px * var(--ta-font-scale)); }
|
|
8479
|
+
.taw-field .taw-input.taw-search-input { min-height: 34px; padding-top: 7px; padding-bottom: 7px; line-height: calc(20px * var(--ta-font-scale)); }
|
|
8290
8480
|
.taw-search-fields .taw-field .taw-action { width: 30px; height: 30px; margin-top: 2px; }
|
|
8291
8481
|
.taw-search-toggle { width: 26px; padding-top: 10px; }
|
|
8292
8482
|
.taw-input.taw-commit-input { min-height: 40px; }
|
|
8293
|
-
.taw-address input { font-size: 16px; }
|
|
8483
|
+
.taw-address input { font-size: calc(16px * var(--ta-font-scale)); }
|
|
8294
8484
|
.taw-browser-remove { opacity: 1; }
|
|
8295
8485
|
}
|
|
8296
8486
|
.taw-file-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; overflow: hidden; font-family: 'taw-seti'; font-style: normal; font-weight: normal; line-height: 1; color: var(--taw-icon); -webkit-font-smoothing: antialiased; speak: never; }
|
|
8297
8487
|
:root[data-theme='light'] .taw-file-icon { color: var(--taw-icon-light); }
|
|
8298
|
-
|
|
8299
|
-
.taw-
|
|
8300
|
-
.taw-terminal-
|
|
8488
|
+
/* Terminals: a bar on the terminal's own background (its title, or tabs when there are more), the screen, and under it the keys of a touch screen or how it ended. */
|
|
8489
|
+
.taw-terminals .taw-editor { background: var(--ta-code); }
|
|
8490
|
+
.taw-terminal-bar { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 6px 0 8px; flex: none; background: var(--ta-code); }
|
|
8491
|
+
.taw-terminal-tabs { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; height: 100%; overflow-x: auto; scrollbar-width: none; }
|
|
8492
|
+
.taw-terminal-tabs::-webkit-scrollbar { display: none; }
|
|
8493
|
+
.taw-terminal-tab { display: flex; align-items: center; flex: none; max-width: 200px; height: 26px; padding-right: 3px; border-radius: 6px; color: var(--ta-muted); transition: background-color 0.12s, color 0.12s; }
|
|
8494
|
+
.taw-terminal-tab:hover { background: var(--ta-hover); color: var(--ta-secondary); }
|
|
8301
8495
|
.taw-terminal-tab.taw-on { background: var(--ta-selected); color: var(--ta-text); }
|
|
8302
|
-
.taw-terminal-tab
|
|
8303
|
-
.taw-terminal-tab
|
|
8304
|
-
.taw-terminal-tab
|
|
8496
|
+
.taw-terminal-tab-main { display: flex; align-items: center; gap: 6px; min-width: 0; height: 100%; padding: 0 4px 0 8px; border: 0; background: none; color: inherit; font: inherit; font-size: calc(12px * var(--ta-font-scale)); cursor: pointer; }
|
|
8497
|
+
.taw-terminal-tab-main:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; border-radius: 6px; }
|
|
8498
|
+
.taw-terminal-tab-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
8499
|
+
.taw-terminal-tab > .taw-action { width: 18px; height: 18px; border-radius: 4px; opacity: 0; transition: opacity 0.12s; }
|
|
8500
|
+
.taw-terminal-tab:hover > .taw-action, .taw-terminal-tab.taw-on > .taw-action, .taw-terminal-tab:focus-within > .taw-action { opacity: 1; }
|
|
8501
|
+
.taw-terminal-tab > .taw-action svg { width: 13px; height: 13px; }
|
|
8502
|
+
.taw-terminal-title { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; padding: 0 6px; font-size: calc(12px * var(--ta-font-scale)); color: var(--ta-secondary); cursor: default; }
|
|
8503
|
+
.taw-terminal-rename { width: 140px; min-width: 0; height: 20px; padding: 0 5px; border: 1px solid var(--ta-border-focus); border-radius: 4px; background: var(--ta-input); color: var(--ta-text); font: inherit; font-size: calc(12px * var(--ta-font-scale)); outline: none; }
|
|
8504
|
+
.taw-terminal-dot { flex: none; width: 7px; height: 7px; margin: 0 3px; border-radius: 50%; background: var(--ta-muted); }
|
|
8505
|
+
.taw-terminal-dot.taw-failed { background: var(--ta-red); }
|
|
8506
|
+
.taw-terminal-index { flex: none; min-width: 20px; height: 16px; padding: 0 4px; border-radius: 4px; background: color-mix(in srgb, currentColor 12%, transparent); font-family: var(--ta-mono); font-size: calc(10px * var(--ta-font-scale)); font-weight: 600; line-height: calc(16px * var(--ta-font-scale)); text-align: center; letter-spacing: 0.02em; }
|
|
8507
|
+
.taw-terminal-tab.taw-on .taw-terminal-index { background: color-mix(in srgb, currentColor 16%, transparent); }
|
|
8508
|
+
/* What its program says of itself: at work (a spinner), how far (a ring), that it rang while out of sight (a dot after the title). */
|
|
8509
|
+
.taw-terminal-spinner { flex: none; box-sizing: border-box; width: 12px; height: 12px; margin: 0 0.5px; border: 1.6px solid color-mix(in srgb, currentColor 22%, transparent); border-top-color: var(--ta-brand); border-radius: 50%; animation: taw-terminal-spin 0.9s linear infinite; }
|
|
8510
|
+
@keyframes taw-terminal-spin { to { transform: rotate(360deg); } }
|
|
8511
|
+
.taw-terminal-progress { flex: none; transform: rotate(-90deg); }
|
|
8512
|
+
.taw-terminal-progress circle { fill: none; stroke-width: 1.8; }
|
|
8513
|
+
.taw-terminal-progress circle:first-child { stroke: color-mix(in srgb, currentColor 22%, transparent); }
|
|
8514
|
+
.taw-terminal-progress circle:last-child { stroke: var(--ta-brand); stroke-linecap: round; transition: stroke-dashoffset 0.3s ease; }
|
|
8515
|
+
.taw-terminal-progress.taw-error circle:last-child { stroke: var(--ta-red); }
|
|
8516
|
+
.taw-terminal-progress.taw-paused circle:last-child { stroke: var(--ta-yellow); }
|
|
8517
|
+
.taw-terminal-attention { flex: none; width: 6px; height: 6px; margin-left: 2px; border-radius: 50%; background: var(--ta-brand); animation: taw-terminal-pop 0.24s ease-out; }
|
|
8518
|
+
@keyframes taw-terminal-pop { from { transform: scale(0); } }
|
|
8519
|
+
.taw-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
8520
|
+
@media (prefers-reduced-motion: reduce) { .taw-terminal-spinner { animation-duration: 2.4s; } .taw-terminal-attention { animation: none; } }
|
|
8521
|
+
.taw-terminal-ended { display: flex; align-items: center; gap: 8px; flex: none; padding: 8px 12px; border-top: 1px solid var(--ta-border-muted); background: var(--ta-code); color: var(--ta-secondary); font-size: calc(12px * var(--ta-font-scale)); }
|
|
8522
|
+
.taw-terminal-ended-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
8523
|
+
.taw-terminal-ended .taw-button { height: 26px; padding: 0 9px; font-size: calc(12px * var(--ta-font-scale)); }
|
|
8524
|
+
.taw-touch-keys { display: none; gap: 6px; flex: none; padding: 6px 8px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--ta-border-muted); background: var(--ta-side); }
|
|
8525
|
+
.taw-touch-keys::-webkit-scrollbar { display: none; }
|
|
8526
|
+
:root[data-touch] .taw-touch-keys { display: flex; }
|
|
8527
|
+
.taw-touch-key { flex: none; min-width: 42px; height: 36px; padding: 0 10px; border: 1px solid var(--ta-border); border-radius: 8px; background: var(--ta-card); color: var(--ta-text); font-family: var(--ta-mono); font-size: calc(14px * var(--ta-font-scale)); -webkit-user-select: none; user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
|
|
8528
|
+
.taw-touch-key:active { background: var(--ta-hover); }
|
|
8529
|
+
.taw-touch-key.taw-on { border-color: var(--ta-brand); background: var(--ta-brand); color: var(--ta-brand-text); }
|
|
8530
|
+
:root[data-touch] .taw-terminal-bar { height: 44px; }
|
|
8531
|
+
:root[data-touch] .taw-terminal-tab { height: 34px; }
|
|
8532
|
+
:root[data-touch] .taw-terminal-tab-main { font-size: calc(13px * var(--ta-font-scale)); }
|
|
8533
|
+
:root[data-touch] .taw-terminal-tab > .taw-action { width: 30px; height: 30px; }
|
|
8534
|
+
:root[data-touch] .taw-terminal-tab:not(.taw-on) > .taw-action { display: none; }
|
|
8305
8535
|
`;
|
|
8306
8536
|
function injectStyle() {
|
|
8307
8537
|
const element = document.createElement("style");
|
|
8308
8538
|
element.dataset.taPackage = "ta-workspace";
|
|
8309
8539
|
element.textContent = `@font-face { font-family: 'taw-seti'; src: url('${SETI_FONT}') format('woff'); font-display: block; }
|
|
8310
|
-
${STYLE}
|
|
8540
|
+
${STYLE}/* A finger (the page's data-touch): menus of rows of a finger's height, without the keys a keyboard would press */
|
|
8541
|
+
:root[data-touch] .taw-menu { min-width: 220px; border-radius: 14px; }
|
|
8542
|
+
:root[data-touch] .taw-menu-item { height: 44px; padding: 0 14px; font-size: calc(15px * var(--ta-font-scale)); border-radius: 10px; }
|
|
8543
|
+
:root[data-touch] .taw-menu-item:active:not(:disabled) { background: var(--ta-hover); }
|
|
8544
|
+
:root[data-touch] .taw-menu-item kbd { display: none; }
|
|
8545
|
+
:root[data-touch] .taw-row { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
|
|
8546
|
+
`;
|
|
8311
8547
|
document.head.appendChild(element);
|
|
8312
8548
|
return () => element.remove();
|
|
8313
8549
|
}
|
|
8314
8550
|
|
|
8315
|
-
// web-src/terminal.
|
|
8551
|
+
// web-src/util/terminal.ts
|
|
8552
|
+
var CTRL_SYMBOLS = { "@": "\x00", " ": "\x00", "[": "\x1B", "\\": "\x1C", "]": "\x1D", "^": "\x1E", _: "\x1F", "?": "" };
|
|
8553
|
+
var TerminalUtil;
|
|
8554
|
+
((TerminalUtil) => {
|
|
8555
|
+
function title(raw) {
|
|
8556
|
+
const text = raw?.trim();
|
|
8557
|
+
if (!text) {
|
|
8558
|
+
return;
|
|
8559
|
+
}
|
|
8560
|
+
const at = text.lastIndexOf(":");
|
|
8561
|
+
const where = at < 0 ? "" : text.slice(at + 1).trim();
|
|
8562
|
+
if (where === "~") {
|
|
8563
|
+
return where;
|
|
8564
|
+
}
|
|
8565
|
+
return /[\\/]/.test(where) ? dir(where.replace(/[\\/]+$/, "")) || text : text;
|
|
8566
|
+
}
|
|
8567
|
+
TerminalUtil.title = title;
|
|
8568
|
+
function dir(cwd) {
|
|
8569
|
+
return cwd && /^[\\/]+$/.test(cwd) ? "/" : WorkspaceUtil.basename(cwd.replace(/\\/g, "/"));
|
|
8570
|
+
}
|
|
8571
|
+
TerminalUtil.dir = dir;
|
|
8572
|
+
function shellName(shell) {
|
|
8573
|
+
return WorkspaceUtil.basename(shell.replace(/\\/g, "/")).replace(/\.exe$/i, "");
|
|
8574
|
+
}
|
|
8575
|
+
TerminalUtil.shellName = shellName;
|
|
8576
|
+
function titles(terminals, fallback) {
|
|
8577
|
+
return terminals.map((terminal) => terminal.name || terminal.title || shellName(terminal.shell) || fallback);
|
|
8578
|
+
}
|
|
8579
|
+
TerminalUtil.titles = titles;
|
|
8580
|
+
function ctrl(data) {
|
|
8581
|
+
if (data.length !== 1) {
|
|
8582
|
+
return data;
|
|
8583
|
+
}
|
|
8584
|
+
if (/[a-z]/i.test(data)) {
|
|
8585
|
+
return String.fromCharCode(data.toUpperCase().charCodeAt(0) - 64);
|
|
8586
|
+
}
|
|
8587
|
+
return CTRL_SYMBOLS[data] ?? data;
|
|
8588
|
+
}
|
|
8589
|
+
TerminalUtil.ctrl = ctrl;
|
|
8590
|
+
})(TerminalUtil ||= {});
|
|
8591
|
+
|
|
8592
|
+
// web-src/terminal-sessions.ts
|
|
8316
8593
|
var RESIZE_MS = 120;
|
|
8317
8594
|
var OPEN_COLS = 100;
|
|
8318
8595
|
var OPEN_ROWS = 30;
|
|
8319
8596
|
var Terminals;
|
|
8320
8597
|
((Terminals) => {
|
|
8321
|
-
|
|
8598
|
+
let sessions = new Map;
|
|
8322
8599
|
const closed = new Set;
|
|
8323
8600
|
const listeners = new Set;
|
|
8324
8601
|
let list2 = [];
|
|
8325
8602
|
let frame = 0;
|
|
8603
|
+
let seen;
|
|
8326
8604
|
function all() {
|
|
8327
8605
|
return list2;
|
|
8328
8606
|
}
|
|
@@ -8347,28 +8625,57 @@ var Terminals;
|
|
|
8347
8625
|
});
|
|
8348
8626
|
}
|
|
8349
8627
|
}
|
|
8628
|
+
function create(info, name) {
|
|
8629
|
+
const terminal = pi.ui.createTerminal({ cols: OPEN_COLS, rows: OPEN_ROWS, cwd: info.cwd || undefined });
|
|
8630
|
+
const created = { info, terminal, name };
|
|
8631
|
+
const id = info.terminalId;
|
|
8632
|
+
terminal.onData((data) => {
|
|
8633
|
+
if (created.exitCode !== undefined) {
|
|
8634
|
+
return;
|
|
8635
|
+
}
|
|
8636
|
+
if (created.ctrl) {
|
|
8637
|
+
created.ctrl = false;
|
|
8638
|
+
data = TerminalUtil.ctrl(data);
|
|
8639
|
+
changed();
|
|
8640
|
+
}
|
|
8641
|
+
pi.terminals.writeTerminal(id, data).catch(() => {
|
|
8642
|
+
return;
|
|
8643
|
+
});
|
|
8644
|
+
});
|
|
8645
|
+
let timer;
|
|
8646
|
+
terminal.onResize(({ cols, rows }) => {
|
|
8647
|
+
clearTimeout(timer);
|
|
8648
|
+
timer = setTimeout(() => void pi.terminals.resizeTerminal(id, cols, rows).catch(() => {
|
|
8649
|
+
return;
|
|
8650
|
+
}), RESIZE_MS);
|
|
8651
|
+
});
|
|
8652
|
+
terminal.onCwdChange(() => changed());
|
|
8653
|
+
terminal.onTitleChange((raw) => {
|
|
8654
|
+
const title = TerminalUtil.title(raw);
|
|
8655
|
+
if (title && title !== created.title) {
|
|
8656
|
+
created.title = title;
|
|
8657
|
+
changed();
|
|
8658
|
+
}
|
|
8659
|
+
});
|
|
8660
|
+
terminal.onProgressChange((progress) => {
|
|
8661
|
+
created.progress = progress;
|
|
8662
|
+
changed();
|
|
8663
|
+
});
|
|
8664
|
+
terminal.onAttention(() => {
|
|
8665
|
+
const element = seen?.terminalId === created.info.terminalId ? seen.element : undefined;
|
|
8666
|
+
const inSight = element?.isConnected && element.offsetParent !== null && !document.hidden;
|
|
8667
|
+
if (!inSight && !created.attention) {
|
|
8668
|
+
created.attention = true;
|
|
8669
|
+
changed();
|
|
8670
|
+
}
|
|
8671
|
+
});
|
|
8672
|
+
return created;
|
|
8673
|
+
}
|
|
8350
8674
|
function add(info) {
|
|
8351
8675
|
let session = sessions.get(info.terminalId);
|
|
8352
8676
|
if (!session) {
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
const id = info.terminalId;
|
|
8356
|
-
terminal.onData((data) => {
|
|
8357
|
-
if (created.exitCode === undefined) {
|
|
8358
|
-
pi.terminals.writeTerminal(id, data).catch(() => {
|
|
8359
|
-
return;
|
|
8360
|
-
});
|
|
8361
|
-
}
|
|
8362
|
-
});
|
|
8363
|
-
let timer;
|
|
8364
|
-
terminal.onResize(({ cols, rows }) => {
|
|
8365
|
-
clearTimeout(timer);
|
|
8366
|
-
timer = setTimeout(() => void pi.terminals.resizeTerminal(id, cols, rows).catch(() => {
|
|
8367
|
-
return;
|
|
8368
|
-
}), RESIZE_MS);
|
|
8369
|
-
});
|
|
8370
|
-
session = created;
|
|
8371
|
-
sessions.set(id, session);
|
|
8677
|
+
session = create(info);
|
|
8678
|
+
sessions.set(info.terminalId, session);
|
|
8372
8679
|
changed();
|
|
8373
8680
|
}
|
|
8374
8681
|
return session;
|
|
@@ -8382,9 +8689,8 @@ var Terminals;
|
|
|
8382
8689
|
session.terminal.write(data);
|
|
8383
8690
|
if (exitCode !== undefined && exitCode !== null) {
|
|
8384
8691
|
session.exitCode = exitCode;
|
|
8385
|
-
session.
|
|
8386
|
-
|
|
8387
|
-
\x1B[?25l`);
|
|
8692
|
+
session.ctrl = false;
|
|
8693
|
+
session.terminal.write("\x1B[?25l");
|
|
8388
8694
|
changed();
|
|
8389
8695
|
}
|
|
8390
8696
|
}
|
|
@@ -8398,6 +8704,56 @@ ${t("terminalEnded", { code: exitCode })}\r
|
|
|
8398
8704
|
}
|
|
8399
8705
|
}
|
|
8400
8706
|
Terminals.remove = remove;
|
|
8707
|
+
function rename(terminalId, name) {
|
|
8708
|
+
const session = sessions.get(terminalId);
|
|
8709
|
+
if (session && session.name !== name) {
|
|
8710
|
+
session.name = name;
|
|
8711
|
+
changed();
|
|
8712
|
+
}
|
|
8713
|
+
}
|
|
8714
|
+
Terminals.rename = rename;
|
|
8715
|
+
function see(terminalId, element) {
|
|
8716
|
+
seen = { terminalId, element };
|
|
8717
|
+
const session = sessions.get(terminalId);
|
|
8718
|
+
if (session?.attention) {
|
|
8719
|
+
session.attention = false;
|
|
8720
|
+
changed();
|
|
8721
|
+
}
|
|
8722
|
+
return () => {
|
|
8723
|
+
if (seen?.element === element) {
|
|
8724
|
+
seen = undefined;
|
|
8725
|
+
}
|
|
8726
|
+
};
|
|
8727
|
+
}
|
|
8728
|
+
Terminals.see = see;
|
|
8729
|
+
function setCtrl(terminalId, ctrl) {
|
|
8730
|
+
const session = sessions.get(terminalId);
|
|
8731
|
+
if (session && session.exitCode === undefined && Boolean(session.ctrl) !== ctrl) {
|
|
8732
|
+
session.ctrl = ctrl;
|
|
8733
|
+
changed();
|
|
8734
|
+
}
|
|
8735
|
+
}
|
|
8736
|
+
Terminals.setCtrl = setCtrl;
|
|
8737
|
+
async function restart(session) {
|
|
8738
|
+
const old = session.info.terminalId;
|
|
8739
|
+
const { cols, rows } = session.terminal;
|
|
8740
|
+
const info = await pi.terminals.openTerminal({ cwd: session.info.cwd || undefined, cols, rows });
|
|
8741
|
+
const created = create(info, session.name);
|
|
8742
|
+
sessions = new Map([...sessions].map(([id, other]) => id === old ? [info.terminalId, created] : [id, other]));
|
|
8743
|
+
if (!sessions.has(info.terminalId)) {
|
|
8744
|
+
sessions.set(info.terminalId, created);
|
|
8745
|
+
}
|
|
8746
|
+
closed.add(old);
|
|
8747
|
+
session.terminal.dispose();
|
|
8748
|
+
if (session.exitCode === undefined) {
|
|
8749
|
+
pi.terminals.closeTerminal(old).catch(() => {
|
|
8750
|
+
return;
|
|
8751
|
+
});
|
|
8752
|
+
}
|
|
8753
|
+
changed();
|
|
8754
|
+
return info.terminalId;
|
|
8755
|
+
}
|
|
8756
|
+
Terminals.restart = restart;
|
|
8401
8757
|
async function sync() {
|
|
8402
8758
|
for (const info of await pi.terminals.listTerminals()) {
|
|
8403
8759
|
add(info);
|
|
@@ -8408,8 +8764,12 @@ ${t("terminalEnded", { code: exitCode })}\r
|
|
|
8408
8764
|
function useTerminals() {
|
|
8409
8765
|
return React.useSyncExternalStore(Terminals.subscribe, Terminals.all);
|
|
8410
8766
|
}
|
|
8411
|
-
function
|
|
8412
|
-
return
|
|
8767
|
+
function cwdOf(session) {
|
|
8768
|
+
return session.terminal.cwd || session.info.cwd;
|
|
8769
|
+
}
|
|
8770
|
+
function hintOf(session) {
|
|
8771
|
+
const title = session.terminal.title?.trim();
|
|
8772
|
+
return title ? `${title} — ${cwdOf(session)}` : cwdOf(session);
|
|
8413
8773
|
}
|
|
8414
8774
|
async function close2(session) {
|
|
8415
8775
|
Terminals.remove(session.info.terminalId);
|
|
@@ -8424,10 +8784,100 @@ function closeEach(sessions) {
|
|
|
8424
8784
|
close2(session);
|
|
8425
8785
|
}
|
|
8426
8786
|
}
|
|
8787
|
+
function copySelection(session) {
|
|
8788
|
+
const text = session.terminal.getSelection();
|
|
8789
|
+
if (text) {
|
|
8790
|
+
navigator.clipboard?.writeText(text).catch(() => {
|
|
8791
|
+
return;
|
|
8792
|
+
});
|
|
8793
|
+
}
|
|
8794
|
+
}
|
|
8795
|
+
function pasteClipboard(session) {
|
|
8796
|
+
navigator.clipboard?.readText().then((text) => text && session.terminal.paste(text)).catch(() => {
|
|
8797
|
+
return;
|
|
8798
|
+
});
|
|
8799
|
+
}
|
|
8800
|
+
|
|
8801
|
+
// web-src/terminal.tsx
|
|
8802
|
+
function TerminalBadge({ session, index }) {
|
|
8803
|
+
const progress = session.progress;
|
|
8804
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
|
|
8805
|
+
className: "taw-terminal-index",
|
|
8806
|
+
"aria-hidden": "true"
|
|
8807
|
+
}, "T", index + 1), session.exitCode !== undefined ? /* @__PURE__ */ React.createElement("span", {
|
|
8808
|
+
className: `taw-terminal-dot ${session.exitCode ? "taw-failed" : ""}`,
|
|
8809
|
+
"aria-hidden": "true"
|
|
8810
|
+
}) : progress?.state === "busy" ? /* @__PURE__ */ React.createElement("span", {
|
|
8811
|
+
className: "taw-terminal-spinner",
|
|
8812
|
+
"aria-hidden": "true"
|
|
8813
|
+
}) : progress && (progress.value !== undefined || progress.state === "error") ? /* @__PURE__ */ React.createElement(ProgressRing, {
|
|
8814
|
+
state: progress.state,
|
|
8815
|
+
value: progress.value ?? 100
|
|
8816
|
+
}) : null);
|
|
8817
|
+
}
|
|
8818
|
+
function ProgressRing({ state, value }) {
|
|
8819
|
+
const radius = 5;
|
|
8820
|
+
const length = 2 * Math.PI * radius;
|
|
8821
|
+
return /* @__PURE__ */ React.createElement("svg", {
|
|
8822
|
+
className: `taw-terminal-progress taw-${state}`,
|
|
8823
|
+
width: "13",
|
|
8824
|
+
height: "13",
|
|
8825
|
+
viewBox: "0 0 13 13",
|
|
8826
|
+
"aria-hidden": "true"
|
|
8827
|
+
}, /* @__PURE__ */ React.createElement("circle", {
|
|
8828
|
+
cx: "6.5",
|
|
8829
|
+
cy: "6.5",
|
|
8830
|
+
r: radius
|
|
8831
|
+
}), /* @__PURE__ */ React.createElement("circle", {
|
|
8832
|
+
cx: "6.5",
|
|
8833
|
+
cy: "6.5",
|
|
8834
|
+
r: radius,
|
|
8835
|
+
strokeDasharray: length,
|
|
8836
|
+
strokeDashoffset: length * (1 - value / 100)
|
|
8837
|
+
}));
|
|
8838
|
+
}
|
|
8839
|
+
function stateOf(session) {
|
|
8840
|
+
if (session.exitCode !== undefined) {
|
|
8841
|
+
return t("terminalEnded", { code: session.exitCode });
|
|
8842
|
+
}
|
|
8843
|
+
const progress = session.progress;
|
|
8844
|
+
if (progress?.value !== undefined && progress.state !== "busy") {
|
|
8845
|
+
return `${progress.value}%`;
|
|
8846
|
+
}
|
|
8847
|
+
return;
|
|
8848
|
+
}
|
|
8849
|
+
function RenameField({ value, onDone }) {
|
|
8850
|
+
const input = React.useRef(null);
|
|
8851
|
+
const done = React.useRef(false);
|
|
8852
|
+
React.useEffect(() => input.current?.select(), []);
|
|
8853
|
+
const finish = (keep) => {
|
|
8854
|
+
if (!done.current) {
|
|
8855
|
+
done.current = true;
|
|
8856
|
+
onDone(input.current?.value.trim() || undefined, keep);
|
|
8857
|
+
}
|
|
8858
|
+
};
|
|
8859
|
+
return /* @__PURE__ */ React.createElement("input", {
|
|
8860
|
+
ref: input,
|
|
8861
|
+
className: "taw-terminal-rename",
|
|
8862
|
+
defaultValue: value,
|
|
8863
|
+
"aria-label": t("renameTerminal"),
|
|
8864
|
+
spellCheck: false,
|
|
8865
|
+
onKeyDown: (event) => {
|
|
8866
|
+
if (event.key === "Enter") {
|
|
8867
|
+
finish(true);
|
|
8868
|
+
} else if (event.key === "Escape") {
|
|
8869
|
+
event.stopPropagation();
|
|
8870
|
+
finish(false);
|
|
8871
|
+
}
|
|
8872
|
+
},
|
|
8873
|
+
onBlur: () => finish(true)
|
|
8874
|
+
});
|
|
8875
|
+
}
|
|
8427
8876
|
function TerminalView() {
|
|
8428
8877
|
const cwd = pi.ui.useCwd();
|
|
8429
8878
|
const sessions = useTerminals();
|
|
8430
8879
|
const [shown, setShown] = React.useState();
|
|
8880
|
+
const [renaming, setRenaming] = React.useState();
|
|
8431
8881
|
const [error, setError] = React.useState();
|
|
8432
8882
|
const opening = React.useRef(false);
|
|
8433
8883
|
const create = React.useCallback(async () => {
|
|
@@ -8452,14 +8902,37 @@ function TerminalView() {
|
|
|
8452
8902
|
}, (failure) => setError(Host.message(failure)));
|
|
8453
8903
|
}, []);
|
|
8454
8904
|
const current = sessions.find((session) => session.info.terminalId === shown) ?? sessions[sessions.length - 1];
|
|
8905
|
+
const tabs = React.useRef(null);
|
|
8906
|
+
React.useEffect(() => {
|
|
8907
|
+
tabs.current?.querySelector(".taw-terminal-tab.taw-on")?.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
8908
|
+
}, [current, sessions.length]);
|
|
8909
|
+
const titles = TerminalUtil.titles(sessions.map((session) => ({
|
|
8910
|
+
name: session.name,
|
|
8911
|
+
title: session.title,
|
|
8912
|
+
shell: session.info.shell
|
|
8913
|
+
})), t("terminal"));
|
|
8914
|
+
const titleOf = (session) => titles[sessions.indexOf(session)] ?? t("terminal");
|
|
8915
|
+
const restart = (session) => {
|
|
8916
|
+
Terminals.restart(session).then(setShown, (failure) => setError(Host.message(failure)));
|
|
8917
|
+
};
|
|
8918
|
+
const finishRename = (session) => (name, keep) => {
|
|
8919
|
+
setRenaming(undefined);
|
|
8920
|
+
if (keep) {
|
|
8921
|
+
Terminals.rename(session.info.terminalId, name);
|
|
8922
|
+
}
|
|
8923
|
+
session.terminal.focus();
|
|
8924
|
+
};
|
|
8455
8925
|
const [menu, openMenu] = useContextMenu();
|
|
8456
|
-
const
|
|
8926
|
+
const tabMenu = (session) => {
|
|
8457
8927
|
const at = sessions.indexOf(session);
|
|
8458
8928
|
const others = sessions.filter((other) => other !== session);
|
|
8459
8929
|
const left = sessions.slice(0, at);
|
|
8460
8930
|
const right = sessions.slice(at + 1);
|
|
8461
8931
|
const ended = sessions.filter((other) => other.exitCode !== undefined);
|
|
8462
8932
|
return [
|
|
8933
|
+
{ label: t("renameTerminal"), run: () => setRenaming(session.info.terminalId) },
|
|
8934
|
+
{ label: t("restartTerminal"), run: () => restart(session) },
|
|
8935
|
+
"-",
|
|
8463
8936
|
{ label: t("close"), run: () => void close2(session) },
|
|
8464
8937
|
{ label: t("closeOthers"), run: () => closeEach(others), disabled: others.length === 0 },
|
|
8465
8938
|
{ label: t("closeToTheLeft"), run: () => closeEach(left), disabled: left.length === 0 },
|
|
@@ -8471,38 +8944,104 @@ function TerminalView() {
|
|
|
8471
8944
|
{ label: t("newTerminal"), run: () => void create() }
|
|
8472
8945
|
];
|
|
8473
8946
|
};
|
|
8947
|
+
const screenMenu = (session) => {
|
|
8948
|
+
const selected = Boolean(session.terminal.getSelection());
|
|
8949
|
+
const refocus = (run) => () => {
|
|
8950
|
+
run();
|
|
8951
|
+
session.terminal.focus();
|
|
8952
|
+
};
|
|
8953
|
+
return [
|
|
8954
|
+
{ label: t("copy"), keys: MAC ? "⌘C" : "Ctrl+Shift+C", run: refocus(() => copySelection(session)), disabled: !selected },
|
|
8955
|
+
{ label: t("paste"), keys: MAC ? "⌘V" : "Ctrl+Shift+V", run: refocus(() => pasteClipboard(session)), disabled: session.exitCode !== undefined },
|
|
8956
|
+
{ label: t("selectAll"), run: refocus(() => session.terminal.selectAll()) },
|
|
8957
|
+
"-",
|
|
8958
|
+
{ label: t("clearTerminal"), keys: MAC ? "⌘K" : undefined, run: refocus(() => session.terminal.clear()) },
|
|
8959
|
+
"-",
|
|
8960
|
+
{ label: t("newTerminal"), run: () => void create() },
|
|
8961
|
+
{ label: t("renameTerminal"), run: () => setRenaming(session.info.terminalId) },
|
|
8962
|
+
{ label: t("restartTerminal"), run: () => restart(session) },
|
|
8963
|
+
{ label: t("killTerminal"), run: () => void close2(session) }
|
|
8964
|
+
];
|
|
8965
|
+
};
|
|
8474
8966
|
return /* @__PURE__ */ React.createElement("div", {
|
|
8475
|
-
className: "taw-view"
|
|
8967
|
+
className: "taw-view taw-terminals"
|
|
8476
8968
|
}, /* @__PURE__ */ React.createElement("header", {
|
|
8969
|
+
className: "taw-terminal-bar"
|
|
8970
|
+
}, sessions.length > 1 ? /* @__PURE__ */ React.createElement("div", {
|
|
8477
8971
|
className: "taw-terminal-tabs",
|
|
8972
|
+
ref: tabs,
|
|
8478
8973
|
role: "tablist",
|
|
8479
8974
|
"aria-label": t("terminal")
|
|
8480
|
-
}, sessions.map((session) =>
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
title
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8975
|
+
}, sessions.map((session) => {
|
|
8976
|
+
const id = session.info.terminalId;
|
|
8977
|
+
const on = session === current;
|
|
8978
|
+
const title = titleOf(session);
|
|
8979
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
8980
|
+
key: id,
|
|
8981
|
+
className: `taw-terminal-tab ${on ? "taw-on" : ""}`,
|
|
8982
|
+
title: hintOf(session)
|
|
8983
|
+
}, renaming === id ? /* @__PURE__ */ React.createElement("span", {
|
|
8984
|
+
className: "taw-terminal-tab-main"
|
|
8985
|
+
}, /* @__PURE__ */ React.createElement(TerminalBadge, {
|
|
8986
|
+
session,
|
|
8987
|
+
index: sessions.indexOf(session)
|
|
8988
|
+
}), /* @__PURE__ */ React.createElement(RenameField, {
|
|
8989
|
+
value: title,
|
|
8990
|
+
onDone: finishRename(session)
|
|
8991
|
+
})) : /* @__PURE__ */ React.createElement("button", {
|
|
8992
|
+
type: "button",
|
|
8993
|
+
role: "tab",
|
|
8994
|
+
className: "taw-terminal-tab-main",
|
|
8995
|
+
"aria-selected": on,
|
|
8996
|
+
onClick: () => setShown(id),
|
|
8997
|
+
onDoubleClick: () => setRenaming(id),
|
|
8998
|
+
onAuxClick: (event) => event.button === 1 && void close2(session),
|
|
8999
|
+
onContextMenu: (event) => openMenu(event, tabMenu(session))
|
|
9000
|
+
}, /* @__PURE__ */ React.createElement(TerminalBadge, {
|
|
9001
|
+
session,
|
|
9002
|
+
index: sessions.indexOf(session)
|
|
9003
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
9004
|
+
className: "taw-terminal-tab-title"
|
|
9005
|
+
}, title), stateOf(session) && /* @__PURE__ */ React.createElement("span", {
|
|
9006
|
+
className: "taw-sr-only"
|
|
9007
|
+
}, stateOf(session)), session.attention && !on && /* @__PURE__ */ React.createElement("span", {
|
|
9008
|
+
className: "taw-terminal-attention"
|
|
9009
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
9010
|
+
className: "taw-sr-only"
|
|
9011
|
+
}, t("terminalAttention")))), /* @__PURE__ */ React.createElement(Action, {
|
|
9012
|
+
icon: "X",
|
|
9013
|
+
label: t("close"),
|
|
9014
|
+
onClick: () => void close2(session)
|
|
9015
|
+
}));
|
|
9016
|
+
})) : current && /* @__PURE__ */ React.createElement("div", {
|
|
9017
|
+
className: "taw-terminal-title",
|
|
9018
|
+
title: hintOf(current),
|
|
9019
|
+
onDoubleClick: () => setRenaming(current.info.terminalId),
|
|
9020
|
+
onContextMenu: (event) => openMenu(event, tabMenu(current))
|
|
9021
|
+
}, /* @__PURE__ */ React.createElement(TerminalBadge, {
|
|
9022
|
+
session: current,
|
|
9023
|
+
index: sessions.indexOf(current)
|
|
9024
|
+
}), renaming === current.info.terminalId ? /* @__PURE__ */ React.createElement(RenameField, {
|
|
9025
|
+
value: titleOf(current),
|
|
9026
|
+
onDone: finishRename(current)
|
|
9027
|
+
}) : /* @__PURE__ */ React.createElement("span", {
|
|
9028
|
+
className: "taw-terminal-tab-title"
|
|
9029
|
+
}, titleOf(current))), /* @__PURE__ */ React.createElement("div", {
|
|
9030
|
+
className: "taw-actions"
|
|
9031
|
+
}, /* @__PURE__ */ React.createElement(Action, {
|
|
8500
9032
|
icon: "Plus",
|
|
8501
9033
|
label: t("newTerminal"),
|
|
8502
9034
|
onClick: () => void create()
|
|
8503
|
-
})
|
|
8504
|
-
|
|
8505
|
-
|
|
9035
|
+
}), current && /* @__PURE__ */ React.createElement(Action, {
|
|
9036
|
+
icon: "Trash2",
|
|
9037
|
+
label: t("killTerminal"),
|
|
9038
|
+
onClick: () => void close2(current)
|
|
9039
|
+
}))), menu, error && /* @__PURE__ */ React.createElement(Empty, {
|
|
9040
|
+
tone: "error",
|
|
9041
|
+
title: t("failed", { message: error })
|
|
9042
|
+
}), !error && sessions.length === 0 && /* @__PURE__ */ React.createElement(Empty, {
|
|
9043
|
+
title: t("noTerminals")
|
|
9044
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
8506
9045
|
type: "button",
|
|
8507
9046
|
className: "taw-button",
|
|
8508
9047
|
onClick: () => void create()
|
|
@@ -8511,10 +9050,62 @@ function TerminalView() {
|
|
|
8511
9050
|
size: 14
|
|
8512
9051
|
}), t("newTerminal"))), current && /* @__PURE__ */ React.createElement(TerminalEditor, {
|
|
8513
9052
|
key: current.info.terminalId,
|
|
8514
|
-
terminalId: current.info.terminalId
|
|
9053
|
+
terminalId: current.info.terminalId,
|
|
9054
|
+
onMenu: (event, session) => openMenu(event, screenMenu(session)),
|
|
9055
|
+
onRestart: restart
|
|
8515
9056
|
}));
|
|
8516
9057
|
}
|
|
8517
|
-
|
|
9058
|
+
var TOUCH_KEYS = [
|
|
9059
|
+
{ label: "Esc", key: "Escape" },
|
|
9060
|
+
{ label: "Tab", key: "Tab" },
|
|
9061
|
+
{ label: "↑", key: "ArrowUp" },
|
|
9062
|
+
{ label: "↓", key: "ArrowDown" },
|
|
9063
|
+
{ label: "←", key: "ArrowLeft" },
|
|
9064
|
+
{ label: "→", key: "ArrowRight" },
|
|
9065
|
+
{ label: "~", text: "~" },
|
|
9066
|
+
{ label: "/", text: "/" },
|
|
9067
|
+
{ label: "|", text: "|" },
|
|
9068
|
+
{ label: "-", text: "-" }
|
|
9069
|
+
];
|
|
9070
|
+
function TouchKeys({ session }) {
|
|
9071
|
+
const keep = (event) => event.preventDefault();
|
|
9072
|
+
const press = (run) => () => {
|
|
9073
|
+
run();
|
|
9074
|
+
session.terminal.focus();
|
|
9075
|
+
};
|
|
9076
|
+
const id = session.info.terminalId;
|
|
9077
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
9078
|
+
className: "taw-touch-keys",
|
|
9079
|
+
role: "toolbar",
|
|
9080
|
+
"aria-label": t("terminalKeys")
|
|
9081
|
+
}, /* @__PURE__ */ React.createElement("button", {
|
|
9082
|
+
type: "button",
|
|
9083
|
+
className: `taw-touch-key ${session.ctrl ? "taw-on" : ""}`,
|
|
9084
|
+
"aria-pressed": Boolean(session.ctrl),
|
|
9085
|
+
onPointerDown: keep,
|
|
9086
|
+
onMouseDown: keep,
|
|
9087
|
+
onClick: press(() => Terminals.setCtrl(id, !session.ctrl))
|
|
9088
|
+
}, "Ctrl"), TOUCH_KEYS.map(({ label: label2, key, text }) => /* @__PURE__ */ React.createElement("button", {
|
|
9089
|
+
key: label2,
|
|
9090
|
+
type: "button",
|
|
9091
|
+
className: "taw-touch-key",
|
|
9092
|
+
onPointerDown: keep,
|
|
9093
|
+
onMouseDown: keep,
|
|
9094
|
+
onClick: press(() => {
|
|
9095
|
+
if (key) {
|
|
9096
|
+
Terminals.setCtrl(id, false);
|
|
9097
|
+
session.terminal.sendKey(key);
|
|
9098
|
+
} else if (text) {
|
|
9099
|
+
session.terminal.type(text);
|
|
9100
|
+
}
|
|
9101
|
+
})
|
|
9102
|
+
}, label2)));
|
|
9103
|
+
}
|
|
9104
|
+
function TerminalEditor({
|
|
9105
|
+
terminalId,
|
|
9106
|
+
onMenu,
|
|
9107
|
+
onRestart
|
|
9108
|
+
}) {
|
|
8518
9109
|
useTerminals();
|
|
8519
9110
|
const session = Terminals.get(terminalId);
|
|
8520
9111
|
const box = React.useRef(null);
|
|
@@ -8525,12 +9116,19 @@ function TerminalEditor({ terminalId }) {
|
|
|
8525
9116
|
return;
|
|
8526
9117
|
}
|
|
8527
9118
|
const detach = terminal.attach(element);
|
|
9119
|
+
const unsee = Terminals.see(terminalId, element);
|
|
8528
9120
|
terminal.focus();
|
|
8529
|
-
return
|
|
9121
|
+
return () => {
|
|
9122
|
+
unsee();
|
|
9123
|
+
detach();
|
|
9124
|
+
};
|
|
8530
9125
|
}, [terminal]);
|
|
8531
9126
|
if (!session) {
|
|
8532
|
-
return /* @__PURE__ */ React.createElement(Empty,
|
|
9127
|
+
return /* @__PURE__ */ React.createElement(Empty, {
|
|
9128
|
+
title: t("noTerminals")
|
|
9129
|
+
});
|
|
8533
9130
|
}
|
|
9131
|
+
const ended = session.exitCode !== undefined;
|
|
8534
9132
|
return /* @__PURE__ */ React.createElement("div", {
|
|
8535
9133
|
className: "taw-editor"
|
|
8536
9134
|
}, session.info.pty === false && /* @__PURE__ */ React.createElement("div", {
|
|
@@ -8538,6 +9136,8 @@ function TerminalEditor({ terminalId }) {
|
|
|
8538
9136
|
}, t("pipeMode")), /* @__PURE__ */ React.createElement("div", {
|
|
8539
9137
|
className: "taw-terminal",
|
|
8540
9138
|
ref: box,
|
|
9139
|
+
onFocus: () => box.current && Terminals.see(terminalId, box.current),
|
|
9140
|
+
onContextMenu: (event) => onMenu(event, session),
|
|
8541
9141
|
onDragOver: (event) => {
|
|
8542
9142
|
if (pi.ui.fileDrag.has(event.dataTransfer)) {
|
|
8543
9143
|
event.preventDefault();
|
|
@@ -8546,7 +9146,7 @@ function TerminalEditor({ terminalId }) {
|
|
|
8546
9146
|
},
|
|
8547
9147
|
onDrop: (event) => {
|
|
8548
9148
|
const files = pi.ui.fileDrag.get(event.dataTransfer);
|
|
8549
|
-
if (!files ||
|
|
9149
|
+
if (!files || ended) {
|
|
8550
9150
|
return;
|
|
8551
9151
|
}
|
|
8552
9152
|
event.preventDefault();
|
|
@@ -8557,6 +9157,27 @@ function TerminalEditor({ terminalId }) {
|
|
|
8557
9157
|
});
|
|
8558
9158
|
terminal?.focus();
|
|
8559
9159
|
}
|
|
9160
|
+
}), ended ? /* @__PURE__ */ React.createElement("div", {
|
|
9161
|
+
className: "taw-terminal-ended",
|
|
9162
|
+
role: "status"
|
|
9163
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
9164
|
+
className: `taw-terminal-dot ${session.exitCode ? "taw-failed" : ""}`,
|
|
9165
|
+
"aria-hidden": "true"
|
|
9166
|
+
}), /* @__PURE__ */ React.createElement("span", {
|
|
9167
|
+
className: "taw-terminal-ended-text"
|
|
9168
|
+
}, t("terminalEnded", { code: session.exitCode ?? 0 })), /* @__PURE__ */ React.createElement("button", {
|
|
9169
|
+
type: "button",
|
|
9170
|
+
className: "taw-button",
|
|
9171
|
+
onClick: () => onRestart(session)
|
|
9172
|
+
}, /* @__PURE__ */ React.createElement(Glyph, {
|
|
9173
|
+
name: "RotateCcw",
|
|
9174
|
+
size: 13
|
|
9175
|
+
}), t("restartTerminal")), /* @__PURE__ */ React.createElement("button", {
|
|
9176
|
+
type: "button",
|
|
9177
|
+
className: "taw-button",
|
|
9178
|
+
onClick: () => void close2(session)
|
|
9179
|
+
}, t("close"))) : /* @__PURE__ */ React.createElement(TouchKeys, {
|
|
9180
|
+
session
|
|
8560
9181
|
}));
|
|
8561
9182
|
}
|
|
8562
9183
|
|
|
@@ -8586,8 +9207,8 @@ function activate(pi2) {
|
|
|
8586
9207
|
["terminal", "terminal", "SquareTerminal", TerminalView],
|
|
8587
9208
|
["browser", "browser", "Globe", BrowserView]
|
|
8588
9209
|
];
|
|
8589
|
-
views.forEach(([name,
|
|
8590
|
-
pi2.registerView(name, { title: label(
|
|
9210
|
+
views.forEach(([name, title, icon, render], index) => {
|
|
9211
|
+
pi2.registerView(name, { title: label(title), icon: Host.icon(icon), render, location: "panel", order: 10 + index * 10 });
|
|
8591
9212
|
});
|
|
8592
9213
|
pi2.on("tool_execution_end", () => FilesChanged.notify());
|
|
8593
9214
|
pi2.on("agent_end", () => FilesChanged.notify());
|