dsh-remote 1.0.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +39 -317
- package/README.md +37 -297
- package/lib/binding.js +4 -2
- package/lib/client.js +1174 -106
- package/lib/file-changes.js +57 -0
- package/lib/index.js +50 -41
- package/lib/local-copy.js +129 -0
- package/lib/local-mutation.js +8 -0
- package/lib/mirror-paths.js +34 -0
- package/lib/remote-fs.js +8 -2
- package/lib/remote-git.js +127 -0
- package/lib/remote-shell-child.cjs +59 -12
- package/lib/remote-shell.js +1 -1
- package/lib/remote-write.js +51 -0
- package/lib/routes-fs.js +55 -23
- package/lib/sftp-surface.js +17 -1
- package/lib/vendor/jsdiff/LICENSE +29 -0
- package/lib/vendor/jsdiff/SOURCE.md +4 -0
- package/lib/vendor/jsdiff/diff/base.js +254 -0
- package/lib/vendor/jsdiff/diff/line.js +66 -0
- package/lib/vendor/jsdiff/patch/create.js +229 -0
- package/lib/vendor/jsdiff/util/params.js +15 -0
- package/lib/workspace-search.js +219 -0
- package/package.json +6 -5
package/lib/client.js
CHANGED
|
@@ -27,7 +27,7 @@ window.__ModuleLoader__.load({
|
|
|
27
27
|
|
|
28
28
|
const React = require('react')
|
|
29
29
|
const name = 'dsh-remote'
|
|
30
|
-
const CLIENT_VERSION = '1.
|
|
30
|
+
const CLIENT_VERSION = '1.1.2'
|
|
31
31
|
|
|
32
32
|
// ── optional host primitives ────────────────────────────────────────────
|
|
33
33
|
// Issue #74: a remote session's .md link must open over SFTP, NOT via the
|
|
@@ -47,6 +47,7 @@ window.__ModuleLoader__.load({
|
|
|
47
47
|
const isComponentType = (value) => typeof value === 'function'
|
|
48
48
|
|| (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')
|
|
49
49
|
const MarkdownText = (Primitives && isComponentType(Primitives.MarkdownText)) ? Primitives.MarkdownText : null
|
|
50
|
+
const NativeDiffBlock = Primitives && isComponentType(Primitives.DiffBlock) ? Primitives.DiffBlock : null
|
|
50
51
|
// Host visual primitives adopted incrementally, always with a graceful
|
|
51
52
|
// fallback (the shared map's contents vary by host version — the bundle
|
|
52
53
|
// ships ~290 exports, older type packages fewer):
|
|
@@ -106,6 +107,108 @@ window.__ModuleLoader__.load({
|
|
|
106
107
|
const NS = 'dsh-remote'
|
|
107
108
|
const L = {
|
|
108
109
|
zh: {
|
|
110
|
+
'workbench.savedWithDraft': '已保存,仍有新的未保存输入',
|
|
111
|
+
'change.applied': "已应用到远端",
|
|
112
|
+
'change.unchanged': "内容未变化",
|
|
113
|
+
'change.expand': "展开其余 {n} 行",
|
|
114
|
+
'change.collapse': "收起差异",
|
|
115
|
+
'change.hunk': "改动片段 {n}",
|
|
116
|
+
'change.binary': "已写入。二进制内容不展示文本差异。",
|
|
117
|
+
'change.noBaseline': "已写入。原文件较大,未读取完整基线;不把本次覆盖误显示为新建文件。",
|
|
118
|
+
'change.truncated': "改动较大,仅展示部分差异。可打开远端文件查看当前内容。",
|
|
119
|
+
'change.legacy': "请求的替换片段 · 当前记录未保存完整差异",
|
|
120
|
+
|
|
121
|
+
'file.mixedEol': "混合换行",
|
|
122
|
+
'changes.title': "远端 Git 改动",
|
|
123
|
+
'changes.failed': "无法读取远端 Git 状态",
|
|
124
|
+
'changes.noGit': "远端未安装 Git,安装后点击刷新。",
|
|
125
|
+
'changes.noRepository': "此工作区不在 Git 仓库中。",
|
|
126
|
+
'changes.unsupportedShell': "当前 Windows 远端未检测到 Git Bash,暂不能查看 Git 状态。",
|
|
127
|
+
'changes.unavailable': "当前无法查看远端 Git 状态。",
|
|
128
|
+
'changes.binary': "二进制文件不提供文本差异。",
|
|
129
|
+
'changes.symlink': "此未跟踪项是符号链接,未读取链接目标。",
|
|
130
|
+
'changes.large': "文件较大,未读取完整内容。可打开文件查看受限预览。",
|
|
131
|
+
'changes.emptyFile': "新建的未跟踪空文件。",
|
|
132
|
+
'changes.noDiff': "当前模式下没有文本差异。",
|
|
133
|
+
'changes.openLine': "打开文件第 {line} 行",
|
|
134
|
+
'changes.detached': "分离 HEAD",
|
|
135
|
+
'changes.readOnly': "查看远端仓库,不自动提交或更改暂存区。",
|
|
136
|
+
'changes.staged': "已暂存",
|
|
137
|
+
'changes.working': "工作区",
|
|
138
|
+
'changes.filter': "筛选改动文件",
|
|
139
|
+
'changes.refreshing': "正在刷新远端状态…",
|
|
140
|
+
'changes.loading': "正在读取远端 Git 状态…",
|
|
141
|
+
'changes.stale': "当前显示上次成功读取的结果。",
|
|
142
|
+
'changes.partial': "改动列表过大或部分路径不受支持,仅显示部分结果。",
|
|
143
|
+
'changes.clean': "工作区干净,暂无改动。",
|
|
144
|
+
'changes.conflict': "冲突",
|
|
145
|
+
'changes.untracked': "未跟踪",
|
|
146
|
+
'changes.noMatch': "没有匹配的改动文件。",
|
|
147
|
+
'changes.emptyGroup': "此分组暂无改动。",
|
|
148
|
+
'changes.openFile': "打开远端文件",
|
|
149
|
+
'changes.stagedDiff': "已暂存改动 · 相对 HEAD",
|
|
150
|
+
'changes.workingDiff': "工作区改动 · 相对暂存区",
|
|
151
|
+
'changes.loadingDiff': "正在读取差异…",
|
|
152
|
+
'changes.diff': "远端文件差异",
|
|
153
|
+
'changes.partialDiff': "差异较大,当前仅显示部分内容。",
|
|
154
|
+
'changes.chooseFile': "选择改动文件查看差异。",
|
|
155
|
+
|
|
156
|
+
'ide.welcome': '欢迎',
|
|
157
|
+
'ide.welcomeTitle': '远程开发工作区',
|
|
158
|
+
'ide.welcomeHint': '从左侧打开文件,即可在这里开始编辑。',
|
|
159
|
+
'ide.guideFiles': '浏览与搜索',
|
|
160
|
+
'ide.guideFilesHint': '在左侧展开目录,或搜索远端文件、目录和内容。',
|
|
161
|
+
'ide.guideEdit': '编辑与保存',
|
|
162
|
+
'ide.guideEditHint': '文件直接打开为可编辑状态。使用 Ctrl / ⌘ + S 保存到远端。',
|
|
163
|
+
'ide.guideAgent': '与 Agent 协作',
|
|
164
|
+
'ide.guideAgentHint': '在右侧描述任务,运行构建并核对输出;点击诊断可跳转源码。',
|
|
165
|
+
'ide.guideLayout': '调整工作空间',
|
|
166
|
+
'ide.guideLayoutHint': '拖动分隔线调整栏宽;窄屏可切换文件、编辑器和会话。',
|
|
167
|
+
'ide.documentation': '使用指南',
|
|
168
|
+
'ide.tools': '会话工具', 'ide.toolsHint': '展开或收起会话附加工具与连接信息',
|
|
169
|
+
'ide.enter': 'IDE 模式', 'ide.exit': '返回普通模式', 'ide.files': '文件',
|
|
170
|
+
'ide.editor': '编辑器', 'ide.chat': '会话', 'ide.openEditor': '打开编辑区',
|
|
171
|
+
'ide.chooseFile': '从左侧选择远程文件,在这里编辑。',
|
|
172
|
+
'ide.unavailable': '当前宿主无法停靠原生会话,请返回普通模式继续工作。',
|
|
173
|
+
'ide.leftWidth': '调整文件栏宽度', 'ide.rightWidth': '调整会话栏宽度',
|
|
174
|
+
'ide.help': '切换布局会保留会话、任务和未保存的编辑。',
|
|
175
|
+
'ide.unsupported': '当前宿主未提供原生编辑区,无法启用 IDE 模式。',
|
|
176
|
+
|
|
177
|
+
'workspaceSearch.options': '搜索选项',
|
|
178
|
+
'workspaceSearch.details': '扫描详情',
|
|
179
|
+
'workspaceSearch.matches': '{n} 个结果',
|
|
180
|
+
'workspaceSearch.scanned': '已扫描 {n} 项',
|
|
181
|
+
'workspaceSearch.activeOptions': '搜索选项 · {n}',
|
|
182
|
+
|
|
183
|
+
'workspaceSearch.query': "搜索远程工作区",
|
|
184
|
+
'workspaceSearch.placeholder': "搜索名称,或切换到文件内容",
|
|
185
|
+
'workspaceSearch.mode': "搜索范围",
|
|
186
|
+
'workspaceSearch.names': "文件和目录",
|
|
187
|
+
'workspaceSearch.files': "仅文件",
|
|
188
|
+
'workspaceSearch.directories': "仅目录",
|
|
189
|
+
'workspaceSearch.content': "文件内容",
|
|
190
|
+
'workspaceSearch.caseSensitive': "区分大小写",
|
|
191
|
+
'workspaceSearch.includeIgnored': "包含忽略目录",
|
|
192
|
+
'workspaceSearch.ignoreHint': "默认跳过依赖、构建目录及配置的忽略项;内容搜索跳过二进制和超大文件。",
|
|
193
|
+
'workspaceSearch.results': "远程搜索结果",
|
|
194
|
+
'workspaceSearch.starting': "准备搜索…",
|
|
195
|
+
'workspaceSearch.running': "正在搜索…",
|
|
196
|
+
'workspaceSearch.completed': "搜索完成",
|
|
197
|
+
'workspaceSearch.partial': "已找到部分结果",
|
|
198
|
+
'workspaceSearch.cancelled': "搜索已停止",
|
|
199
|
+
'workspaceSearch.failed': "搜索失败",
|
|
200
|
+
'workspaceSearch.progress': "{dirs} 个目录 · {files} 个文件 · {results} 个结果 · {seconds} 秒",
|
|
201
|
+
'workspaceSearch.stop': "停止",
|
|
202
|
+
'workspaceSearch.retry': "重新搜索",
|
|
203
|
+
'workspaceSearch.partialHint': "达到搜索预算、结果上限或有目录无法读取。缩小关键词范围后重试,当前结果仍可打开。",
|
|
204
|
+
'workspaceSearch.skipped': "跳过 {skipped} 项 · {errors} 项读取失败",
|
|
205
|
+
'workspaceSearch.wait': "正在遍历远端目录,找到的结果会陆续显示。",
|
|
206
|
+
'workspaceSearch.empty': "未找到匹配项。可切换搜索范围,或包含忽略目录后重试。",
|
|
207
|
+
'workspaceSearch.noneYet': "尚无结果。可修改关键词或重新搜索。",
|
|
208
|
+
'workspaceSearch.directory': "目录",
|
|
209
|
+
'workspaceSearch.file': "文件",
|
|
210
|
+
'workspaceSearch.line': "第 {n} 行",
|
|
211
|
+
|
|
109
212
|
'settings.sshConfigEditorTitle': "SSH 配置",
|
|
110
213
|
'settings.sshConfigEditorHint': "编辑运行 DSH 的主机上的 SSH 配置,保存后重新检测主机。",
|
|
111
214
|
'settings.sshConfigReload': "重新载入",
|
|
@@ -189,8 +292,7 @@ window.__ModuleLoader__.load({
|
|
|
189
292
|
'workbench.explorer': '资源管理器',
|
|
190
293
|
'workbench.openTerminal': '打开远程终端',
|
|
191
294
|
'workbench.terminalUnavailable': '远程终端尚不可用,请检查宿主终端插件与 remote ssh Shell。',
|
|
192
|
-
'workbench.filter': '
|
|
193
|
-
'workbench.noFilteredFiles': '没有匹配的已加载文件',
|
|
295
|
+
'workbench.filter': '搜索远程工作区',
|
|
194
296
|
'workbench.collapse': '折叠全部目录',
|
|
195
297
|
'workbench.remote': '远程工作区',
|
|
196
298
|
'workbench.backToFiles': '返回文件树',
|
|
@@ -489,6 +591,7 @@ window.__ModuleLoader__.load({
|
|
|
489
591
|
'picker.homeBtn': '🏠',
|
|
490
592
|
'picker.goHome': '回家目录',
|
|
491
593
|
'picker.hintKeys': '↑↓ 选择补全 · Enter 补全/确认 · Esc 返回 · Ctrl/⌘+Enter 打开工作区',
|
|
594
|
+
'picker.hintBrowse': 'Enter 进入目录 · Esc 返回路径输入',
|
|
492
595
|
'picker.star': '⭐ Star dsh-remote',
|
|
493
596
|
'picker.feedback': '反馈 / 提 issue',
|
|
494
597
|
'explorer.refresh': '刷新',
|
|
@@ -527,6 +630,7 @@ window.__ModuleLoader__.load({
|
|
|
527
630
|
'file.saveToRemote': '保存到远程',
|
|
528
631
|
'file.saving': '保存中…',
|
|
529
632
|
'file.cancel': '取消',
|
|
633
|
+
'file.discardChanges': '放弃更改',
|
|
530
634
|
'file.edit': '编辑',
|
|
531
635
|
'file.download': '下载',
|
|
532
636
|
'file.loading': '加载中…',
|
|
@@ -539,6 +643,11 @@ window.__ModuleLoader__.load({
|
|
|
539
643
|
'file.saveHint': 'Ctrl/⌘+S 保存',
|
|
540
644
|
'file.downloaded': '已下载到本地镜像{local}',
|
|
541
645
|
'file.downloadedAt': ': {path}',
|
|
646
|
+
'file.localCopyMissing': '远端没有此文件,但本地镜像中有同名副本。',
|
|
647
|
+
'file.localCopyHelp': '可先只读查看,确认后上传到远端。上传仅创建新文件,不覆盖已有文件。',
|
|
648
|
+
'file.localCopyView': '查看本地副本',
|
|
649
|
+
'file.localCopyPublish': '上传到远端并打开',
|
|
650
|
+
'file.localCopySource': '本地镜像副本 · 只读,尚未上传到远端',
|
|
542
651
|
'file.readFail': '远程读取失败: {msg}',
|
|
543
652
|
'file.listFail': '远程目录读取失败: {msg}',
|
|
544
653
|
// Issue #55: a file link in a remote Session cannot be mapped onto the
|
|
@@ -558,6 +667,108 @@ window.__ModuleLoader__.load({
|
|
|
558
667
|
'common.confirm': '确认',
|
|
559
668
|
},
|
|
560
669
|
en: {
|
|
670
|
+
'workbench.savedWithDraft': 'Saved; newer edits are still unsaved',
|
|
671
|
+
'change.applied': "Applied on remote",
|
|
672
|
+
'change.unchanged': "Content unchanged",
|
|
673
|
+
'change.expand': "Expand {n} more lines",
|
|
674
|
+
'change.collapse': "Collapse diff",
|
|
675
|
+
'change.hunk': "Change hunk {n}",
|
|
676
|
+
'change.binary': "Written successfully. Binary content has no text diff.",
|
|
677
|
+
'change.noBaseline': "Written successfully. The original file was too large to capture a baseline; this overwrite is not shown as a new file.",
|
|
678
|
+
'change.truncated': "The change is large; only part of its diff is shown. Open the remote file to inspect current content.",
|
|
679
|
+
'change.legacy': "Requested replacement · full applied diff is unavailable in this record",
|
|
680
|
+
|
|
681
|
+
'file.mixedEol': "Mixed EOL",
|
|
682
|
+
'changes.title': "Remote Git changes",
|
|
683
|
+
'changes.failed': "Could not read remote Git status",
|
|
684
|
+
'changes.noGit': "Git is unavailable on the remote host. Install it, then refresh.",
|
|
685
|
+
'changes.noRepository': "This workspace is not inside a Git repository.",
|
|
686
|
+
'changes.unsupportedShell': "Git inspection requires Git Bash on this Windows remote.",
|
|
687
|
+
'changes.unavailable': "Remote Git inspection is unavailable.",
|
|
688
|
+
'changes.binary': "Binary files have no text diff.",
|
|
689
|
+
'changes.symlink': "This untracked item is a symbolic link; its target was not read.",
|
|
690
|
+
'changes.large': "This file is large; open it for a bounded preview.",
|
|
691
|
+
'changes.emptyFile': "New untracked empty file.",
|
|
692
|
+
'changes.noDiff': "No text diff in this mode.",
|
|
693
|
+
'changes.openLine': "Open file at line {line}",
|
|
694
|
+
'changes.detached': "Detached HEAD",
|
|
695
|
+
'changes.readOnly': "Inspect the remote repository without changing commits or the index.",
|
|
696
|
+
'changes.staged': "Staged",
|
|
697
|
+
'changes.working': "Working tree",
|
|
698
|
+
'changes.filter': "Filter changed files",
|
|
699
|
+
'changes.refreshing': "Refreshing remote status…",
|
|
700
|
+
'changes.loading': "Reading remote Git status…",
|
|
701
|
+
'changes.stale': "Showing the last successfully read snapshot.",
|
|
702
|
+
'changes.partial': "The change list is large or has unsupported paths; showing partial results.",
|
|
703
|
+
'changes.clean': "The working tree is clean.",
|
|
704
|
+
'changes.conflict': "Conflict",
|
|
705
|
+
'changes.untracked': "Untracked",
|
|
706
|
+
'changes.noMatch': "No changed files match.",
|
|
707
|
+
'changes.emptyGroup': "No changes in this group.",
|
|
708
|
+
'changes.openFile': "Open remote file",
|
|
709
|
+
'changes.stagedDiff': "Staged changes · against HEAD",
|
|
710
|
+
'changes.workingDiff': "Working changes · against the index",
|
|
711
|
+
'changes.loadingDiff': "Loading diff…",
|
|
712
|
+
'changes.diff': "Remote file diff",
|
|
713
|
+
'changes.partialDiff': "This diff is large; showing partial content.",
|
|
714
|
+
'changes.chooseFile': "Select a changed file to inspect its diff.",
|
|
715
|
+
|
|
716
|
+
'ide.welcome': 'Welcome',
|
|
717
|
+
'ide.welcomeTitle': 'Your remote development workspace',
|
|
718
|
+
'ide.welcomeHint': 'Open a file on the left to start editing here.',
|
|
719
|
+
'ide.guideFiles': 'Browse and search',
|
|
720
|
+
'ide.guideFilesHint': 'Expand folders on the left, or search remote files, folders and contents.',
|
|
721
|
+
'ide.guideEdit': 'Edit and save',
|
|
722
|
+
'ide.guideEditHint': 'Files open ready to edit. Use Ctrl / ⌘ + S to save to the remote host.',
|
|
723
|
+
'ide.guideAgent': 'Work with your agent',
|
|
724
|
+
'ide.guideAgentHint': 'Describe a task on the right, build and review output. Click diagnostics to open source.',
|
|
725
|
+
'ide.guideLayout': 'Arrange your workspace',
|
|
726
|
+
'ide.guideLayoutHint': 'Drag separators to resize columns. Switch panes on narrow screens.',
|
|
727
|
+
'ide.documentation': 'User guide',
|
|
728
|
+
'ide.tools': 'Chat tools', 'ide.toolsHint': 'Show or hide extra conversation tools and connection details',
|
|
729
|
+
'ide.enter': 'IDE mode', 'ide.exit': 'Return to standard mode', 'ide.files': 'Files',
|
|
730
|
+
'ide.editor': 'Editor', 'ide.chat': 'Chat', 'ide.openEditor': 'Open editor area',
|
|
731
|
+
'ide.chooseFile': 'Choose a remote file on the left to edit it here.',
|
|
732
|
+
'ide.unavailable': 'This host cannot dock the native conversation. Return to standard mode to continue.',
|
|
733
|
+
'ide.leftWidth': 'Resize file column', 'ide.rightWidth': 'Resize chat column',
|
|
734
|
+
'ide.help': 'Switch layouts without losing conversations, running tasks, or unsaved edits.',
|
|
735
|
+
'ide.unsupported': 'This host does not expose the native editor area required by IDE mode.',
|
|
736
|
+
|
|
737
|
+
'workspaceSearch.options': 'Search options',
|
|
738
|
+
'workspaceSearch.details': 'Scan details',
|
|
739
|
+
'workspaceSearch.matches': '{n} results',
|
|
740
|
+
'workspaceSearch.scanned': '{n} scanned',
|
|
741
|
+
'workspaceSearch.activeOptions': 'Search options · {n}',
|
|
742
|
+
|
|
743
|
+
'workspaceSearch.query': "Search remote workspace",
|
|
744
|
+
'workspaceSearch.placeholder': "Search names, or switch to file contents",
|
|
745
|
+
'workspaceSearch.mode': "Search scope",
|
|
746
|
+
'workspaceSearch.names': "Files and folders",
|
|
747
|
+
'workspaceSearch.files': "Files only",
|
|
748
|
+
'workspaceSearch.directories': "Folders only",
|
|
749
|
+
'workspaceSearch.content': "File contents",
|
|
750
|
+
'workspaceSearch.caseSensitive': "Match case",
|
|
751
|
+
'workspaceSearch.includeIgnored': "Include ignored folders",
|
|
752
|
+
'workspaceSearch.ignoreHint': "Skips dependencies, build folders and configured ignores by default; content search skips binary and oversized files.",
|
|
753
|
+
'workspaceSearch.results': "Remote search results",
|
|
754
|
+
'workspaceSearch.starting': "Preparing search…",
|
|
755
|
+
'workspaceSearch.running': "Searching…",
|
|
756
|
+
'workspaceSearch.completed': "Search complete",
|
|
757
|
+
'workspaceSearch.partial': "Partial results",
|
|
758
|
+
'workspaceSearch.cancelled': "Search stopped",
|
|
759
|
+
'workspaceSearch.failed': "Search failed",
|
|
760
|
+
'workspaceSearch.progress': "{dirs} folders · {files} files · {results} results · {seconds}s",
|
|
761
|
+
'workspaceSearch.stop': "Stop",
|
|
762
|
+
'workspaceSearch.retry': "Search again",
|
|
763
|
+
'workspaceSearch.partialHint': "Reached a search budget or result limit, or some folders were unreadable. Narrow the query and retry; current results remain available.",
|
|
764
|
+
'workspaceSearch.skipped': "{skipped} skipped · {errors} read failures",
|
|
765
|
+
'workspaceSearch.wait': "Scanning remote folders. Results will appear as they are found.",
|
|
766
|
+
'workspaceSearch.empty': "No matches. Change the search scope or include ignored folders and retry.",
|
|
767
|
+
'workspaceSearch.noneYet': "No results yet. Change the query or search again.",
|
|
768
|
+
'workspaceSearch.directory': "Folder",
|
|
769
|
+
'workspaceSearch.file': "File",
|
|
770
|
+
'workspaceSearch.line': "Line {n}",
|
|
771
|
+
|
|
561
772
|
'settings.sshConfigEditorTitle': "SSH configuration",
|
|
562
773
|
'settings.sshConfigEditorHint': "Edit SSH configuration on the host running DSH. Saving rechecks the host list.",
|
|
563
774
|
'settings.sshConfigReload': "Reload from disk",
|
|
@@ -641,8 +852,7 @@ window.__ModuleLoader__.load({
|
|
|
641
852
|
'workbench.explorer': 'Explorer',
|
|
642
853
|
'workbench.openTerminal': 'Open remote terminal',
|
|
643
854
|
'workbench.terminalUnavailable': 'Remote terminal is unavailable. Check the host terminal plugin and remote ssh shell.',
|
|
644
|
-
'workbench.filter': '
|
|
645
|
-
'workbench.noFilteredFiles': 'No matching loaded files',
|
|
855
|
+
'workbench.filter': 'Search remote workspace',
|
|
646
856
|
'workbench.collapse': 'Collapse all folders',
|
|
647
857
|
'workbench.remote': 'Remote workspace',
|
|
648
858
|
'workbench.backToFiles': 'Back to explorer',
|
|
@@ -934,6 +1144,7 @@ window.__ModuleLoader__.load({
|
|
|
934
1144
|
'picker.homeBtn': '🏠',
|
|
935
1145
|
'picker.goHome': 'Go to home',
|
|
936
1146
|
'picker.hintKeys': '↑↓ select · Enter completes/confirms · Esc goes back · Ctrl/⌘+Enter opens workspace',
|
|
1147
|
+
'picker.hintBrowse': 'Enter opens a folder · Esc returns to the path input',
|
|
937
1148
|
'picker.star': '⭐ Star dsh-remote',
|
|
938
1149
|
'picker.feedback': 'Feedback / report issue',
|
|
939
1150
|
'explorer.refresh': 'Refresh',
|
|
@@ -972,6 +1183,7 @@ window.__ModuleLoader__.load({
|
|
|
972
1183
|
'file.saveToRemote': 'Save to remote',
|
|
973
1184
|
'file.saving': 'Saving…',
|
|
974
1185
|
'file.cancel': 'Cancel',
|
|
1186
|
+
'file.discardChanges': 'Discard changes',
|
|
975
1187
|
'file.edit': 'Edit',
|
|
976
1188
|
'file.download': 'Download',
|
|
977
1189
|
'file.loading': 'Loading…',
|
|
@@ -984,6 +1196,11 @@ window.__ModuleLoader__.load({
|
|
|
984
1196
|
'file.saveHint': 'Ctrl/⌘+S to save',
|
|
985
1197
|
'file.downloaded': 'Downloaded to local mirror{local}',
|
|
986
1198
|
'file.downloadedAt': ': {path}',
|
|
1199
|
+
'file.localCopyMissing': 'This file is missing remotely. A copy exists in the local mirror.',
|
|
1200
|
+
'file.localCopyHelp': 'Preview the local copy, then upload it. Upload creates a new remote file and never replaces an existing file.',
|
|
1201
|
+
'file.localCopyView': 'View local copy',
|
|
1202
|
+
'file.localCopyPublish': 'Upload and open remotely',
|
|
1203
|
+
'file.localCopySource': 'Local mirror copy · Read only, not uploaded',
|
|
987
1204
|
'file.readFail': 'Failed to read remote: {msg}',
|
|
988
1205
|
'file.listFail': 'Failed to list remote directory: {msg}',
|
|
989
1206
|
'file.markdown.copy': 'Copy',
|
|
@@ -1106,7 +1323,12 @@ window.__ModuleLoader__.load({
|
|
|
1106
1323
|
if (body) { opts.headers['Content-Type'] = 'application/json'; opts.body = JSON.stringify(body) }
|
|
1107
1324
|
const res = await fetch(apiPath(path), opts)
|
|
1108
1325
|
const data = await res.json().catch(() => ({}))
|
|
1109
|
-
if (!res.ok)
|
|
1326
|
+
if (!res.ok) {
|
|
1327
|
+
const error = new Error(trHostError((data && (data.error || data.message))) || 'HTTP ' + res.status)
|
|
1328
|
+
error.code = data?.code
|
|
1329
|
+
error.localCopy = data?.localCopy
|
|
1330
|
+
throw error
|
|
1331
|
+
}
|
|
1110
1332
|
return data
|
|
1111
1333
|
}
|
|
1112
1334
|
|
|
@@ -1159,6 +1381,10 @@ window.__ModuleLoader__.load({
|
|
|
1159
1381
|
const CHROME_CSS_ID = 'dsh-remote-chrome'
|
|
1160
1382
|
const CHROME_CSS_TEXT = [
|
|
1161
1383
|
'[data-rw-settings-legacy-icon]{position:relative}[data-rw-settings-legacy-icon]>svg{opacity:0}[data-rw-settings-legacy-icon]::before{content:"";position:absolute;left:12px;top:50%;transform:translateY(-50%);width:16px;height:16px;background:currentColor;mask:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%204h18v12H3zM8%2020h8M12%2016v4M7%208l3%202-3%202M13%2012h4%22%2F%3E%3C%2Fsvg%3E") center/contain no-repeat;-webkit-mask:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M3%204h18v12H3zM8%2020h8M12%2016v4M7%208l3%202-3%202M13%2012h4%22%2F%3E%3C%2Fsvg%3E") center/contain no-repeat;pointer-events:none}',
|
|
1384
|
+
'.dsh-rw-search-scope{display:flex;gap:8px;align-items:center;margin-top:6px;font-size:11px}.dsh-rw-search-options{position:relative;flex-shrink:0}.dsh-rw-search-options>summary{cursor:pointer;padding:4px 0;color:var(--dsw-alias-label-tertiary,#777);white-space:nowrap}.dsh-rw-search-option-body{position:absolute;right:0;top:100%;z-index:45;width:220px;max-width:calc(100vw - 40px);box-sizing:border-box;padding:12px;background:var(--dsw-alias-bg-base,#fff);border:1px solid var(--dsw-alias-border-l2,#ddd);border-radius:8px;box-shadow:0 4px 16px #0002}.dsh-rw-search-option-body label{display:flex;gap:7px;align-items:center;padding:5px 0}.dsh-rw-search-option-body p{font-size:10px;color:var(--dsw-alias-label-tertiary,#777);line-height:1.6;margin:8px 0 0}.dsh-rw-search-details{flex:1;min-width:0;font-size:11px}.dsh-rw-search-details>summary{cursor:pointer;padding:4px 0;list-style-position:inside}.dsh-rw-search-status{display:inline;line-height:1.6}.dsh-rw-search-status>span+span:before{content:" · ";color:var(--dsw-alias-label-tertiary,#777)}.dsh-rw-search-detail-body{padding:7px 0 2px;line-height:1.7;color:var(--dsw-alias-label-tertiary,#777)}',
|
|
1385
|
+
'.dsh-rw-search-controls{margin-top:8px;min-width:0}.dsh-rw-search-panel{display:flex;flex-direction:column;flex:1;min-height:0;min-width:0}.dsh-rw-search-progress{display:flex;align-items:flex-start;gap:8px;padding:7px 10px;border-bottom:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.2));font-size:12px}.dsh-rw-search-progress button{flex-shrink:0;white-space:nowrap}.dsh-rw-search-indicator{width:100%;height:3px;flex-shrink:0;border:0}.dsh-rw-search-results{overflow:auto;flex:1;min-height:0}.dsh-rw-search-result{width:100%;box-sizing:border-box;display:flex;gap:8px;align-items:flex-start;text-align:left;border:0;border-bottom:1px solid rgba(128,128,128,.12);background:transparent;color:inherit;padding:9px 10px;cursor:pointer}.dsh-rw-search-result:hover{background:rgba(128,128,128,.08)}.dsh-rw-search-result:focus-visible{outline:2px solid var(--dsw-alias-button-primary-fill,#2563eb);outline-offset:-2px}',
|
|
1386
|
+
'.dsh-rw-git{height:100%;min-height:0;display:flex;flex-direction:column;font-size:12px;overflow:hidden;color:inherit}.dsh-rw-git-header{padding:10px;display:flex;flex-direction:column;gap:7px;border-bottom:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.2));flex-shrink:0}.dsh-rw-git-title{display:flex;align-items:center;gap:7px}.dsh-rw-git-title>strong{flex:1}.dsh-rw-git-repo{font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsh-rw-git-hint{font-size:11px;opacity:.7;line-height:1.5}.dsh-rw-git-mode{display:flex;gap:6px}.dsh-rw-git-mode button{padding:4px 8px;white-space:nowrap}.dsh-rw-git-mode button[aria-pressed=true]{font-weight:600;background:rgba(128,128,128,.14)}.dsh-rw-git-header input{box-sizing:border-box;width:100%;font-size:12px}.dsh-rw-git-message{padding:10px;line-height:1.6;overflow-wrap:anywhere}.dsh-rw-git-message button{margin-left:8px}.dsh-rw-git-files{flex:0 1 auto;max-height:34%;overflow:auto;padding:4px;min-height:40px;border-bottom:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.2))}.dsh-rw-git-file{display:flex;gap:7px;align-items:center;width:100%;min-height:30px;padding:5px 8px;border:0;border-radius:4px;background:transparent;color:inherit;cursor:pointer;text-align:left}.dsh-rw-git-file:hover,.dsh-rw-git-file[aria-selected=true]{background:rgba(128,128,128,.13)}.dsh-rw-git-file:focus-visible{outline:2px solid var(--dsw-alias-button-primary-fill,#2563eb);outline-offset:-2px}.dsh-rw-git-file-path{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsh-rw-git-status{flex-shrink:0;font-size:11px;font-family:monospace}.dsh-rw-git-preview{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.dsh-rw-git-preview-title{display:flex;align-items:center;gap:8px;padding:8px 10px}.dsh-rw-git-preview-title>strong{font-size:12px;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dsh-rw-git-preview>.dsh-rw-git-hint{padding:0 10px 7px}.dsh-rw-git-diff{flex:1;min-height:0;overflow:auto;font:11px/1.6 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;tab-size:4;padding:4px 0}.dsh-rw-git-diff-line{display:flex;min-width:max-content;white-space:pre}.dsh-rw-git-diff-line>span:last-child{padding-right:12px}.dsh-rw-git-diff-line[data-rw-diff-kind=added]{background:rgba(34,197,94,.11)}.dsh-rw-git-diff-line[data-rw-diff-kind=removed]{background:rgba(239,68,68,.11)}.dsh-rw-git-diff-line[data-rw-diff-kind=hunk]{background:rgba(59,130,246,.1)}.dsh-rw-git-line-number{box-sizing:border-box;flex:0 0 48px;width:48px;padding:0 7px;border:0;background:transparent;color:inherit;opacity:.6;font:inherit;text-align:right;user-select:none}.dsh-rw-git-diff button.dsh-rw-git-line-number{cursor:pointer}.dsh-rw-git-diff button.dsh-rw-git-line-number:hover{opacity:1;text-decoration:underline}',
|
|
1387
|
+
'.dsh-rw-applied-change{border-top:1px solid var(--dsw-alias-border-l2,rgba(128,128,128,.2));min-width:0;overflow:hidden}.dsh-rw-change-heading{display:flex;gap:8px;align-items:center;padding:7px 10px;font-size:11px}.dsh-rw-change-heading strong{font-weight:500}.dsh-rw-change-hunk{margin:0 8px 6px}.dsh-rw-change-hunk>summary{font-size:11px;cursor:pointer;padding:4px 2px}',
|
|
1162
1388
|
'.dsh-rw-btn{transition:background .12s ease,opacity .12s ease,border-color .12s ease}',
|
|
1163
1389
|
'.dsh-rw-btn:hover:not(:disabled){background:rgba(128,128,128,.18)}',
|
|
1164
1390
|
'.dsh-rw-btn:focus-visible{outline:2px solid var(--dsw-alias-button-primary-fill,#2563eb);outline-offset:1px}',
|
|
@@ -3201,24 +3427,25 @@ window.__ModuleLoader__.load({
|
|
|
3201
3427
|
|
|
3202
3428
|
function renderDirPopup() {
|
|
3203
3429
|
if (!levels || !levels.length) {
|
|
3204
|
-
return React.createElement('div', { style: { opacity: 0.6, fontSize: 12 } }, (loading ? tr('picker.loading') : tr('picker.readingRoot')))
|
|
3430
|
+
return React.createElement('div', { 'data-rw-directory-browser': true, role: 'status', style: { flex: '1 1 0', minHeight: 120, padding: 16, opacity: 0.6, fontSize: 12 } }, (loading ? tr('picker.loading') : tr('picker.readingRoot')))
|
|
3205
3431
|
}
|
|
3206
3432
|
const last = levels[levels.length - 1]
|
|
3207
3433
|
const entries = last.all || []
|
|
3208
|
-
return React.createElement('div', { style: { border: '1px solid ' + T.borderStrong, borderRadius:
|
|
3209
|
-
React.createElement('div', { style: { display: 'flex', gap: 6, alignItems: 'center', padding: '6px 10px', borderBottom: '1px solid ' + T.border } },
|
|
3434
|
+
return React.createElement('div', { 'data-rw-directory-browser': true, style: { border: '1px solid ' + T.borderStrong, borderRadius: 8, background: v('--dsw-alias-bg-overlay', '#1e1e1e'), display: 'flex', flexDirection: 'column', flex: '1 1 0', minHeight: 0, overflow: 'hidden' } },
|
|
3435
|
+
React.createElement('div', { style: { display: 'flex', gap: 6, alignItems: 'center', flexShrink: 0, padding: '6px 10px', borderBottom: '1px solid ' + T.border } },
|
|
3210
3436
|
React.createElement('button', { style: { ...buttonS, padding: '2px 8px' }, onClick: goUp, disabled: loading || (levels.length <= 1 && !parentOf(last.path)) }, tr('picker.back')),
|
|
3211
|
-
React.createElement('div', { style: { fontSize: 11, opacity: 0.75, fontFamily: 'monospace', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', flex: 1 } }, breadcrumb(!!machineId, last.path, win, (p) =>
|
|
3437
|
+
React.createElement('div', { style: { fontSize: 11, opacity: 0.75, fontFamily: 'monospace', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', flex: 1 } }, breadcrumb(!!machineId, last.path, win, (p) => { if (loading) return; const cut = (levels || []).findIndex((lv) => lv.path === p); if (cut >= 0) setLevels(levels.slice(0, cut + 1)); else loadLevels(machineId, p, 0) })),
|
|
3212
3438
|
React.createElement('button', { style: { ...buttonS, padding: '2px 8px' }, onClick: mkdirHere }, tr('picker.newDir')),
|
|
3213
3439
|
React.createElement('button', { style: { ...buttonS, padding: '2px 8px' }, onClick: () => setPopOpen(false) }, tr('picker.closeBtn')),
|
|
3214
3440
|
),
|
|
3215
|
-
React.createElement('div', { style: { overflowY: 'auto', overflowX: 'hidden' } },
|
|
3441
|
+
React.createElement('div', { 'data-rw-directory-list': true, role: 'region', 'aria-label': tr('picker.browse'), style: { flex: 1, minHeight: 0, overflowY: 'auto', overflowX: 'hidden' } },
|
|
3216
3442
|
loading ? React.createElement('div', { style: { opacity: 0.7, padding: 12 } }, tr('picker.loading'))
|
|
3217
3443
|
: (entries.length ? entries.slice(0, 400).map((it, i) => React.createElement('div', {
|
|
3218
|
-
key: i, title: it.drive ? tr('picker.enterDrive', { name: it.name }) : (it.dir ? tr('picker.enterDir', { name: it.name }) : tr('picker.fileAt', { name: it.name })),
|
|
3444
|
+
key: it.path || i, role: it.dir ? 'button' : undefined, tabIndex: it.dir ? 0 : undefined, title: it.drive ? tr('picker.enterDrive', { name: it.name }) : (it.dir ? tr('picker.enterDir', { name: it.name }) : tr('picker.fileAt', { name: it.name })),
|
|
3219
3445
|
onClick: it.dir ? () => enterDir(it) : undefined,
|
|
3446
|
+
onKeyDown: it.dir ? (e) => { if (!e.isComposing && e.keyCode !== 229 && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); e.stopPropagation(); enterDir(it) } } : undefined,
|
|
3220
3447
|
className: it.dir ? 'dsh-rw-list-item' : undefined,
|
|
3221
|
-
style: { padding: '6px 10px', cursor: it.dir ? 'pointer' : 'default', color: T.label, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: 'flex', gap: 8, alignItems: 'center', fontSize: 13, borderBottom: '1px solid ' + T.border },
|
|
3448
|
+
style: { padding: '6px 10px', minHeight: 32, boxSizing: 'border-box', cursor: it.dir ? 'pointer' : 'default', color: T.label, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: 'flex', gap: 8, alignItems: 'center', fontSize: 13, borderBottom: '1px solid ' + T.border },
|
|
3222
3449
|
},
|
|
3223
3450
|
React.createElement('span', { style: { flexShrink: 0, display: 'inline-flex', color: T.label, fontSize: 13 } }, it.drive ? '💽' : (it.dir
|
|
3224
3451
|
? IconFolder()
|
|
@@ -3227,9 +3454,9 @@ window.__ModuleLoader__.load({
|
|
|
3227
3454
|
React.createElement('span', { style: { fontSize: 11, opacity: 0.55, flexShrink: 0, fontFamily: 'monospace' } }, it.dir ? '' : (humanSize(it.size) + (it.mtime ? ' ' + fmtTime(it.mtime) : ''))),
|
|
3228
3455
|
)) : React.createElement('div', { style: { opacity: 0.6, padding: 12 } }, tr('picker.emptyDir'))),
|
|
3229
3456
|
),
|
|
3230
|
-
React.createElement('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end', alignItems: 'center', padding: '6px 10px', borderTop: '1px solid ' + T.border } },
|
|
3457
|
+
React.createElement('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end', alignItems: 'center', flexShrink: 0, padding: '6px 10px', borderTop: '1px solid ' + T.border } },
|
|
3231
3458
|
React.createElement('span', { style: { fontSize: 11, opacity: 0.75, fontFamily: 'monospace', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', flex: 1 } }, tr('picker.selected', { path: (last.path || (win ? tr('picker.driveRoot') : '/')) })),
|
|
3232
|
-
React.createElement('button', { type: 'button', className: 'dsh-rw-btn dsh-rw-primary', style: primaryBtnS, onClick: () => { acceptBrowserPick(last.path); setPopOpen(false) } }, tr('picker.chooseThis')),
|
|
3459
|
+
React.createElement('button', { type: 'button', className: 'dsh-rw-btn dsh-rw-primary', style: { ...primaryBtnS, whiteSpace: 'nowrap' }, disabled: loading || busy || !last.path, onClick: () => { acceptBrowserPick(last.path); setPopOpen(false) } }, tr('picker.chooseThis')),
|
|
3233
3460
|
),
|
|
3234
3461
|
)
|
|
3235
3462
|
}
|
|
@@ -3316,7 +3543,7 @@ window.__ModuleLoader__.load({
|
|
|
3316
3543
|
// backdrop dismisses now.
|
|
3317
3544
|
onClick: (e) => { if (backdrop.onClick(e) && !externalBusy && !mkdirPrompt) closePicker() },
|
|
3318
3545
|
},
|
|
3319
|
-
React.createElement('div', { ref: pickerLayerRef, tabIndex: -1, role: 'dialog', 'aria-modal': true, 'aria-labelledby': suggestListId + '-title', className: 'dsh-rw-modal-panel', style: { background: v('--dsw-alias-bg-layer-1', '#18181b'), color: T.label, border: '1px solid ' + T.borderStrong, borderRadius: 12, boxShadow: '0 12px 48px rgba(0,0,0,0.5)', width: 'min(
|
|
3546
|
+
React.createElement('div', { ref: pickerLayerRef, tabIndex: -1, role: 'dialog', 'aria-modal': true, 'aria-labelledby': suggestListId + '-title', 'data-rw-dir-picker': true, className: 'dsh-rw-modal-panel', style: { background: v('--dsw-alias-bg-layer-1', '#18181b'), color: T.label, border: '1px solid ' + T.borderStrong, borderRadius: 12, boxShadow: '0 12px 48px rgba(0,0,0,0.5)', width: 'min(720px, 94vw)', height: popOpen && tab === 'remote' ? 'min(760px, calc(100dvh - 32px))' : undefined, maxHeight: 'min(760px, calc(100dvh - 32px))', display: 'flex', flexDirection: 'column', padding: 16, boxSizing: 'border-box' }, onClick: (e) => e.stopPropagation() },
|
|
3320
3547
|
React.createElement('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 10 } },
|
|
3321
3548
|
React.createElement('div', { id: suggestListId + '-title', style: { fontSize: 15, fontWeight: 650 } }, tr('picker.title')),
|
|
3322
3549
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, padding: '2px 8px' }, onClick: closePicker, disabled: !!externalBusy }, tr('picker.close')),
|
|
@@ -3361,7 +3588,7 @@ window.__ModuleLoader__.load({
|
|
|
3361
3588
|
},
|
|
3362
3589
|
onProject: (m, p) => { setMachineId(m.id); setRecent(m.recentWorkspaces || []); setPath(p); setChoosingProject(false); commitPath(p, m.id) },
|
|
3363
3590
|
})
|
|
3364
|
-
: React.createElement('div', { style: { display: 'flex', flexDirection: 'column', gap: 8, minHeight: 0, overflowY: 'auto' } },
|
|
3591
|
+
: React.createElement('div', { 'data-rw-picker-remote': true, style: { display: 'flex', flexDirection: 'column', flex: popOpen ? '1 1 0' : '0 1 auto', gap: 8, minHeight: 0, overflowY: popOpen ? 'hidden' : 'auto' } },
|
|
3365
3592
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', disabled: busy, style: { ...buttonS, alignSelf: 'flex-start', fontSize: 12 }, onClick: () => { killSuggestions(); resetPickerFetchState(); setPath(''); setChoosingProject(true) } }, '‹ ' + tr('project.back')),
|
|
3366
3593
|
React.createElement('div', { style: { display: 'flex', gap: 6, alignItems: 'center' } },
|
|
3367
3594
|
React.createElement('label', { style: { fontSize: 12, opacity: 0.8, whiteSpace: 'nowrap' } }, tr('picker.remoteMachine')),
|
|
@@ -3378,10 +3605,10 @@ window.__ModuleLoader__.load({
|
|
|
3378
3605
|
: null,
|
|
3379
3606
|
),
|
|
3380
3607
|
),
|
|
3381
|
-
recent.length ? React.createElement('div', { style: { display: 'flex', gap: 4, alignItems: 'center', flexWrap: 'wrap' } },
|
|
3608
|
+
!popOpen && recent.length ? React.createElement('div', { style: { display: 'flex', gap: 4, alignItems: 'center', flexWrap: 'wrap' } },
|
|
3382
3609
|
React.createElement('span', { style: { fontSize: 11, opacity: 0.6, whiteSpace: 'nowrap' } }, tr('picker.recent')),
|
|
3383
3610
|
recent.map((w, i) => React.createElement('button', { type: 'button', className: 'dsh-rw-btn', key: w + i, onClick: () => { setPath(w); setErr(''); continueSuggest(w) }, style: { ...buttonS, padding: '2px 8px', fontSize: 11, fontFamily: 'monospace' } }, w))) : null,
|
|
3384
|
-
React.createElement('div', { ref: suggestRef, style: { position: 'relative' } },
|
|
3611
|
+
React.createElement('div', { ref: suggestRef, style: { position: 'relative', flexShrink: 0 } },
|
|
3385
3612
|
React.createElement('div', { style: { display: 'flex', gap: 6, flexWrap: 'wrap' } },
|
|
3386
3613
|
React.createElement('input', {
|
|
3387
3614
|
className: 'dsh-rw-input',
|
|
@@ -3416,12 +3643,12 @@ window.__ModuleLoader__.load({
|
|
|
3416
3643
|
placeholder: (machineId ? (win ? tr('picker.pathPlaceholderWin') : tr('picker.pathPlaceholder')) : tr('picker.chooseMachineFirst')),
|
|
3417
3644
|
disabled: !machineId || busy, 'data-modal-autofocus': true, style: { ...inputS, flex: 1, minWidth: 120 },
|
|
3418
3645
|
}),
|
|
3419
|
-
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, whiteSpace: 'nowrap' }, onClick: () => { if (!machineId) return; const p = path.trim(); loadLevels(machineId, p || '', 0); setPopOpen(true) }, disabled: !machineId || busy }, tr('picker.browse')),
|
|
3646
|
+
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, whiteSpace: 'nowrap' }, onClick: () => { if (!machineId) return; killSuggestions(); if (suggestTimer.current) clearTimeout(suggestTimer.current); const p = path.trim(); loadLevels(machineId, p || '', 0); setPopOpen(true) }, disabled: !machineId || busy }, tr('picker.browse')),
|
|
3420
3647
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, whiteSpace: 'nowrap' }, onClick: pickHome, disabled: !machineId || busy }, tr('picker.home')),
|
|
3421
3648
|
),
|
|
3422
3649
|
// Reserve the same space with or without results: suggestions
|
|
3423
3650
|
// never move the dialog or sit beneath the workspace action.
|
|
3424
|
-
React.createElement('div', { className: 'dsh-rw-suggestions', style: { position: 'relative', height: 'min(180px, 25vh)', marginTop: 8, border: '1px solid ' + T.border, borderRadius: 8, background: T.bg } },
|
|
3651
|
+
!popOpen ? React.createElement('div', { className: 'dsh-rw-suggestions', style: { position: 'relative', height: 'min(180px, 25vh)', marginTop: 8, border: '1px solid ' + T.border, borderRadius: 8, background: T.bg } },
|
|
3425
3652
|
(suggestOpen && suggest.length)
|
|
3426
3653
|
? React.createElement('div', { id: suggestListId, role: 'listbox', 'aria-label': tr('picker.pathPlaceholder'), style: { position: 'absolute', top: 0, bottom: 0, left: 0, right: 0, zIndex: 60, background: v('--dsw-alias-bg-overlay', '#1e1e1e'), color: T.label, borderRadius: 8, maxHeight: 200, overflowY: 'auto' } },
|
|
3427
3654
|
// Issue #52 defect 1, local belt-and-braces: swallow the
|
|
@@ -3430,16 +3657,16 @@ window.__ModuleLoader__.load({
|
|
|
3430
3657
|
suggest.map((s, i) => React.createElement('div', { key: s + i, id: suggestListId + '-' + i, role: 'option', 'aria-selected': i === activeSuggestion, onMouseEnter: () => setSuggestIndex(i), className: 'dsh-rw-list-item', onMouseDown: (e) => { e.preventDefault(); e.stopPropagation(); selectSuggestion(s) }, style: { padding: '6px 10px', background: i === activeSuggestion ? T.hoverBg : undefined, cursor: 'pointer', fontSize: 12, fontFamily: 'monospace', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' } }, s)),
|
|
3431
3658
|
)
|
|
3432
3659
|
: React.createElement('div', { style: { padding: '24px 16px', color: T.muted, fontSize: 12, lineHeight: 1.6, textAlign: 'center' } }, tr('picker.suggestionsHint')),
|
|
3433
|
-
),
|
|
3660
|
+
) : null,
|
|
3434
3661
|
),
|
|
3435
3662
|
popOpen ? renderDirPopup() : null,
|
|
3436
3663
|
err ? React.createElement(ProjectOpenError, { error: err }) : null,
|
|
3437
3664
|
// The action stays below the reserved results region, in a
|
|
3438
3665
|
// separate opaque layer with a stable hit target.
|
|
3439
|
-
React.createElement('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end', alignItems: 'center', position: 'relative', zIndex: 70, background: v('--dsw-alias-bg-layer-1', '#18181b') } },
|
|
3666
|
+
!popOpen ? React.createElement('div', { 'data-rw-picker-commit': true, style: { display: 'flex', gap: 8, justifyContent: 'flex-end', alignItems: 'center', position: 'relative', zIndex: 70, background: v('--dsw-alias-bg-layer-1', '#18181b') } },
|
|
3440
3667
|
React.createElement('span', { title: path, style: { fontSize: 11, opacity: 0.75, fontFamily: 'monospace', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', flex: 1 } }, path ? tr('picker.selected', { path }) : ''),
|
|
3441
3668
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn dsh-rw-primary', style: primaryBtnS, onClick: () => commitPath(path), disabled: busy || !machineId || !path.trim() }, busy ? tr('project.opening') : tr('picker.setRemoteWs')),
|
|
3442
|
-
),
|
|
3669
|
+
) : null,
|
|
3443
3670
|
),
|
|
3444
3671
|
choosingProject && !path && err ? React.createElement('div', {},
|
|
3445
3672
|
React.createElement(ProjectOpenError, { error: err }),
|
|
@@ -3448,7 +3675,7 @@ window.__ModuleLoader__.load({
|
|
|
3448
3675
|
React.createElement('span', { style: { flex: 1, color: T.muted } }, tr('project.opening')),
|
|
3449
3676
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: buttonS, onClick: () => { cancelOperation(); setErr(tr('project.cancelled')) } }, tr('project.cancel'))) : null,
|
|
3450
3677
|
React.createElement('div', { style: { display: 'flex', flexWrap: 'wrap', gap: '4px 12px', fontSize: 11, color: T.muted, paddingTop: 8 } },
|
|
3451
|
-
(tab === 'remote' ? tr('picker.hintKeys') : 'Enter · Esc').split(' · ').map((hint) => React.createElement('span', { key: hint, style: { whiteSpace: 'nowrap' } }, hint))),
|
|
3678
|
+
(tab === 'remote' ? tr(popOpen ? 'picker.hintBrowse' : 'picker.hintKeys') : 'Enter · Esc').split(' · ').map((hint) => React.createElement('span', { key: hint, style: { whiteSpace: 'nowrap' } }, hint))),
|
|
3452
3679
|
(tab === 'local') ? React.createElement('div', { style: { display: 'flex', gap: 8, justifyContent: 'flex-end' } }, React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: buttonS, onClick: onCancel }, tr('picker.cancel'))) : null,
|
|
3453
3680
|
mkdirPrompt ? React.createElement(PromptDialog, {
|
|
3454
3681
|
title: tr('picker.newDirName', { path: mkdirPrompt.base || '/' }),
|
|
@@ -3807,7 +4034,9 @@ window.__ModuleLoader__.load({
|
|
|
3807
4034
|
|
|
3808
4035
|
function readRemoteFile(path, maxBytes, sessionId) {
|
|
3809
4036
|
return api('POST', '/dsh-remote/read', withSessionBody({ path, maxBytes }, sessionId)).catch((e) => {
|
|
3810
|
-
|
|
4037
|
+
const error = new Error(tr('file.readFail', { msg: ((e && e.message) || e) }))
|
|
4038
|
+
error.code = e?.code; error.localCopy = e?.localCopy
|
|
4039
|
+
throw error
|
|
3811
4040
|
})
|
|
3812
4041
|
}
|
|
3813
4042
|
|
|
@@ -4057,6 +4286,7 @@ window.__ModuleLoader__.load({
|
|
|
4057
4286
|
refresh: 'M13 6a5 5 0 1 0 0 5M13 2v4H9',
|
|
4058
4287
|
collapse: 'M4 5h9v8H4zM1 10V2h8',
|
|
4059
4288
|
search: 'M10.5 10.5 14 14M11.5 7a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0',
|
|
4289
|
+
branch: 'M5 2v8a3 3 0 0 0 3 3h3M5 5h4a2 2 0 0 0 2-2M4 2h2M10 2h2M10 13h2',
|
|
4060
4290
|
close: 'm4 4 8 8m0-8-8 8',
|
|
4061
4291
|
copy: 'M5 5h8v9H5zM2 11V2h8',
|
|
4062
4292
|
wrap: 'M2 4h12M2 8h9a2 2 0 0 1 0 4H8m2-2-2 2 2 2M2 12h3',
|
|
@@ -4075,6 +4305,85 @@ window.__ModuleLoader__.load({
|
|
|
4075
4305
|
|
|
4076
4306
|
// Tree-style remote file explorer. Data is listed live from the remote host
|
|
4077
4307
|
// over /dsh-remote/ls, rooted at this session's remote workspace dir.
|
|
4308
|
+
function RemoteWorkspaceSearch(props) {
|
|
4309
|
+
const { sessionId, query, mode, includeIgnored, caseSensitive } = props
|
|
4310
|
+
const viewKey = JSON.stringify([sessionId, props.root, query, mode, includeIgnored, caseSensitive])
|
|
4311
|
+
const [state, setState] = React.useState(null)
|
|
4312
|
+
const [retry, setRetry] = React.useState(0)
|
|
4313
|
+
const [focused, setFocused] = React.useState(0)
|
|
4314
|
+
const stopRef = React.useRef(null)
|
|
4315
|
+
React.useEffect(() => {
|
|
4316
|
+
let disposed = false, id = null, pollTimer = null
|
|
4317
|
+
const initial = { viewKey, query, mode, status: 'starting', results: [], scannedDirs: 0, scannedFiles: 0, skipped: 0, errors: 0, elapsedMs: 0 }
|
|
4318
|
+
setState(initial); setFocused(0)
|
|
4319
|
+
const cancelRemote = () => { if (id) void api('POST', '/dsh-remote/search', withSessionBody({ action: 'cancel', id }, sessionId)).catch(() => {}) }
|
|
4320
|
+
const stop = () => {
|
|
4321
|
+
if (disposed) return
|
|
4322
|
+
disposed = true; clearTimeout(startTimer); if (pollTimer) clearTimeout(pollTimer)
|
|
4323
|
+
cancelRemote(); setState(old => ({ ...(old || initial), status: 'cancelled' }))
|
|
4324
|
+
}
|
|
4325
|
+
stopRef.current = stop
|
|
4326
|
+
const receive = response => {
|
|
4327
|
+
if (!response?.ok || !response.search) throw new Error(response?.error || tr('workspaceSearch.failed'))
|
|
4328
|
+
const search = response.search
|
|
4329
|
+
id = search.id
|
|
4330
|
+
if (disposed) { cancelRemote(); return }
|
|
4331
|
+
setState({ ...search, viewKey })
|
|
4332
|
+
if (search.status === 'running') pollTimer = setTimeout(poll, 750)
|
|
4333
|
+
}
|
|
4334
|
+
const failed = error => { if (!disposed) setState(old => ({ ...(old || initial), status: 'failed', error: error.message || String(error) })) }
|
|
4335
|
+
const poll = () => {
|
|
4336
|
+
if (!disposed && id) api('GET', withSessionQuery('/dsh-remote/search?id=' + encodeURIComponent(id), sessionId)).then(receive).catch(failed)
|
|
4337
|
+
}
|
|
4338
|
+
const startTimer = setTimeout(() => {
|
|
4339
|
+
api('POST', '/dsh-remote/search', withSessionBody({ action: 'start', query, mode, includeIgnored, caseSensitive }, sessionId)).then(receive).catch(failed)
|
|
4340
|
+
}, props.retryKey || retry ? 0 : 350)
|
|
4341
|
+
return () => { disposed = true; clearTimeout(startTimer); if (pollTimer) clearTimeout(pollTimer); cancelRemote(); if (stopRef.current === stop) stopRef.current = null }
|
|
4342
|
+
}, [sessionId, props.root, query, mode, includeIgnored, caseSensitive, props.retryKey, retry])
|
|
4343
|
+
const current = state && state.viewKey === viewKey ? state : { status: 'starting', results: [], scannedDirs: 0, scannedFiles: 0, elapsedMs: 0 }
|
|
4344
|
+
const running = current.status === 'starting' || current.status === 'running'
|
|
4345
|
+
const statusKey = ({ starting: 'workspaceSearch.starting', running: 'workspaceSearch.running', completed: 'workspaceSearch.completed', partial: 'workspaceSearch.partial', cancelled: 'workspaceSearch.cancelled', failed: 'workspaceSearch.failed' })[current.status] || 'workspaceSearch.starting'
|
|
4346
|
+
const navigate = event => {
|
|
4347
|
+
if (event.isComposing || !['ArrowDown','ArrowUp','Home','End'].includes(event.key)) return
|
|
4348
|
+
const rows = Array.from(event.currentTarget.querySelectorAll('[data-rw-search-result]'))
|
|
4349
|
+
const index = rows.indexOf(event.target.closest?.('[data-rw-search-result]'))
|
|
4350
|
+
if (index < 0) return
|
|
4351
|
+
event.preventDefault()
|
|
4352
|
+
const next = event.key === 'Home' ? 0 : event.key === 'End' ? rows.length - 1 : Math.max(0, Math.min(rows.length - 1, index + (event.key === 'ArrowDown' ? 1 : -1)))
|
|
4353
|
+
setFocused(next); rows[next]?.focus()
|
|
4354
|
+
}
|
|
4355
|
+
return React.createElement('section', { className: 'dsh-rw-search-panel', 'aria-label': tr('workspaceSearch.results'), 'aria-busy': running },
|
|
4356
|
+
React.createElement('div', { className: 'dsh-rw-search-progress' },
|
|
4357
|
+
React.createElement('details', { className: 'dsh-rw-search-details' },
|
|
4358
|
+
React.createElement('summary', { title: tr('workspaceSearch.details'), 'aria-label': tr('workspaceSearch.details') },
|
|
4359
|
+
React.createElement('span', { role: 'status', 'aria-live': 'polite', className: 'dsh-rw-search-status' },
|
|
4360
|
+
React.createElement('span', {}, tr(statusKey)),
|
|
4361
|
+
React.createElement('span', { style: { color: T.muted } }, tr('workspaceSearch.matches', { n: current.results.length })),
|
|
4362
|
+
running ? React.createElement('span', { style: { color: T.muted } }, tr('workspaceSearch.scanned', { n: (current.scannedDirs || 0) + (current.scannedFiles || 0) })) : null)),
|
|
4363
|
+
React.createElement('div', { className: 'dsh-rw-search-detail-body' },
|
|
4364
|
+
React.createElement('div', {}, tr('workspaceSearch.progress', { dirs: current.scannedDirs || 0, files: current.scannedFiles || 0, results: current.results.length, seconds: ((current.elapsedMs || 0) / 1000).toFixed(1) })),
|
|
4365
|
+
current.skipped || current.errors ? React.createElement('div', {}, tr('workspaceSearch.skipped', { skipped: current.skipped || 0, errors: current.errors || 0 })) : null,
|
|
4366
|
+
current.currentPath ? React.createElement('div', { className: 'dsh-rw-path', title: current.currentPath }, current.currentPath) : null)),
|
|
4367
|
+
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, fontSize: 11, padding: '3px 7px' }, onClick: () => running ? stopRef.current?.() : setRetry(value => value + 1) }, tr(running ? 'workspaceSearch.stop' : 'workspaceSearch.retry'))),
|
|
4368
|
+
current.error ? React.createElement('div', { role: 'alert', style: { padding: '8px 10px', fontSize: 12, color: T.danger, overflowWrap: 'anywhere' } }, current.error) : null,
|
|
4369
|
+
current.status === 'partial' ? React.createElement('div', { style: { padding: '6px 10px', fontSize: 11, color: T.warn } }, tr('workspaceSearch.partialHint')) : null,
|
|
4370
|
+
running ? React.createElement('progress', { className: 'dsh-rw-search-indicator', 'aria-label': tr('workspaceSearch.running') }) : null,
|
|
4371
|
+
React.createElement('div', { role: 'list', 'aria-label': tr('workspaceSearch.results'), className: 'dsh-rw-search-results', onKeyDown: navigate },
|
|
4372
|
+
current.results.map((result, index) => React.createElement('button', {
|
|
4373
|
+
key: result.path + ':' + (result.line || 0), type: 'button', role: 'listitem', className: 'dsh-rw-search-result', 'data-rw-search-result': result.relative,
|
|
4374
|
+
tabIndex: index === focused ? 0 : -1, onFocus: () => setFocused(index), title: result.path,
|
|
4375
|
+
onClick: () => result.type === 'directory' ? props.onRevealDirectory(result.path) : props.onOpenFile(result.path, result.line),
|
|
4376
|
+
},
|
|
4377
|
+
React.createElement('span', { style: { marginTop: 2, flexShrink: 0 } }, result.type === 'directory' ? IconFolder(false) : IconFile(result.name)),
|
|
4378
|
+
React.createElement('span', { style: { minWidth: 0, flex: 1 } },
|
|
4379
|
+
React.createElement('span', { style: { display: 'flex', gap: 6, alignItems: 'baseline' } },
|
|
4380
|
+
React.createElement('strong', { className: 'dsh-rw-path', style: { fontWeight: 500, flex: 1 } }, result.name),
|
|
4381
|
+
React.createElement('span', { style: { color: T.muted, fontSize: 10, flexShrink: 0 } }, result.line ? tr('workspaceSearch.line', { n: result.line }) : null)),
|
|
4382
|
+
React.createElement('span', { className: 'dsh-rw-path', style: { display: 'block', color: T.muted, fontSize: 11, marginTop: 3 } }, result.relative.includes('/') ? result.relative.slice(0, result.relative.lastIndexOf('/')) : ''),
|
|
4383
|
+
result.text != null ? React.createElement('span', { style: { display: 'block', marginTop: 4, fontFamily: 'monospace', fontSize: 11, whiteSpace: 'pre-wrap', overflowWrap: 'anywhere' } }, result.text) : null))),
|
|
4384
|
+
!current.results.length ? React.createElement('div', { style: { padding: '20px 12px', fontSize: 12, color: T.muted, lineHeight: 1.7 } }, tr(running ? 'workspaceSearch.wait' : current.status === 'completed' ? 'workspaceSearch.empty' : 'workspaceSearch.noneYet')) : null))
|
|
4385
|
+
}
|
|
4386
|
+
|
|
4078
4387
|
function RemoteExplorerTab(props) {
|
|
4079
4388
|
const [status, setStatus] = React.useState(null)
|
|
4080
4389
|
const [root, setRoot] = React.useState('') // remote root path for this session
|
|
@@ -4091,6 +4400,11 @@ window.__ModuleLoader__.load({
|
|
|
4091
4400
|
const [selectedPath, setSelectedPath] = React.useState(() => explorerMemory.get(props.scope?.sessionId || '')?.selected || '')
|
|
4092
4401
|
const [filter, setFilter] = React.useState('')
|
|
4093
4402
|
const [filterOpen, setFilterOpen] = React.useState(false)
|
|
4403
|
+
const [searchMode, setSearchMode] = React.useState('names')
|
|
4404
|
+
const [searchIgnored, setSearchIgnored] = React.useState(false)
|
|
4405
|
+
const [searchCase, setSearchCase] = React.useState(false)
|
|
4406
|
+
const [searchRetry, setSearchRetry] = React.useState(0)
|
|
4407
|
+
const revealPending = React.useRef(null)
|
|
4094
4408
|
const filterRef = React.useRef(null)
|
|
4095
4409
|
const remoteTerminal = useRemoteTerminal(props.scope && props.scope.sessionId)
|
|
4096
4410
|
const [namePrompt, setNamePrompt] = React.useState(null) // { kind, path, name }
|
|
@@ -4297,13 +4611,13 @@ window.__ModuleLoader__.load({
|
|
|
4297
4611
|
// identically in both compositions — and it needs no better-sidebar
|
|
4298
4612
|
// descriptor, whose only effect would have been a switch that unregisters
|
|
4299
4613
|
// the viewer.
|
|
4300
|
-
const openFile = (p) => {
|
|
4301
|
-
if (props.onOpenFile) { props.onOpenFile(p); return }
|
|
4614
|
+
const openFile = (p, line) => {
|
|
4615
|
+
if (props.onOpenFile) { props.onOpenFile(p, line); return }
|
|
4302
4616
|
const sessionId = (props.scope && props.scope.sessionId) || ''
|
|
4303
4617
|
try {
|
|
4304
4618
|
const right = props.ctx && props.ctx.get && props.ctx.get('sidebarRight')
|
|
4305
4619
|
if (right && typeof right.openResource === 'function') {
|
|
4306
|
-
right.openResource(remoteFileAddress(sessionId, p))
|
|
4620
|
+
right.openResource(remoteFileAddress(sessionId, p), Number.isSafeInteger(line) && line > 0 ? { params: { line } } : undefined)
|
|
4307
4621
|
return
|
|
4308
4622
|
}
|
|
4309
4623
|
} catch (e) {
|
|
@@ -4313,6 +4627,24 @@ window.__ModuleLoader__.load({
|
|
|
4313
4627
|
console.warn('[dsh-remote] no right-sidebar resource opener; remote file not opened')
|
|
4314
4628
|
}
|
|
4315
4629
|
|
|
4630
|
+
const revealDirectory = (path) => {
|
|
4631
|
+
setFilter(''); setFilterOpen(false); setRootOpen(true)
|
|
4632
|
+
const relative = String(path).slice(String(root).replace(/[\\/]+$/, '').length).replace(/^[\\/]+/, '')
|
|
4633
|
+
let current = root
|
|
4634
|
+
loadDir(root, { force: true })
|
|
4635
|
+
for (const segment of relative.split(/[\\/]+/).filter(Boolean)) {
|
|
4636
|
+
current = joinRemote(current, segment)
|
|
4637
|
+
if (!expandedRef.current.includes(current)) props.onToggleDir?.(current)
|
|
4638
|
+
loadDir(current, { force: true })
|
|
4639
|
+
}
|
|
4640
|
+
rememberRemoteSelection(sessionId, path); revealPending.current = path
|
|
4641
|
+
}
|
|
4642
|
+
React.useEffect(() => {
|
|
4643
|
+
if (!revealPending.current || !treeRef.current) return
|
|
4644
|
+
const row = Array.from(treeRef.current.querySelectorAll('[data-rw-tree-row]')).find(element => element.getAttribute('data-rw-tree-row') === revealPending.current)
|
|
4645
|
+
if (row) { row.scrollIntoView?.({ block: 'nearest' }); row.focus?.(); revealPending.current = null }
|
|
4646
|
+
}, [data, expanded, filterOpen])
|
|
4647
|
+
|
|
4316
4648
|
const doFs = (op, payload, refreshParent) => {
|
|
4317
4649
|
const view = viewRef.current
|
|
4318
4650
|
setBusy(op)
|
|
@@ -4462,12 +4794,11 @@ window.__ModuleLoader__.load({
|
|
|
4462
4794
|
if (level.error !== undefined) {
|
|
4463
4795
|
return React.createElement('div', { key: dir + ':err', style: { display: 'flex', alignItems: 'center', gap: 6, padding: '5px 8px', paddingLeft: depth * 22 + 6, fontSize: 13, color: T.danger } }, React.createElement('span', { role: 'alert' }, level.error), React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: buttonS, onClick: () => loadDir(dir, { force: true }) }, tr('project.retry')))
|
|
4464
4796
|
}
|
|
4465
|
-
const
|
|
4466
|
-
const items = (level.entries || []).filter((it) => it.type === 'dir' || !needle || String(it.name).toLowerCase().includes(needle))
|
|
4797
|
+
const items = level.entries || []
|
|
4467
4798
|
const soft = level.softError
|
|
4468
4799
|
? React.createElement('div', { key: dir + ':softerr', style: { display: 'flex', alignItems: 'center', gap: 6, padding: '5px 8px', paddingLeft: depth * 22 + 6, fontSize: 11, opacity: 0.6, color: T.warn } }, tr('explorer.softError', { msg: level.softError }), React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: buttonS, onClick: () => loadDir(dir, { force: true }) }, tr('project.retry')))
|
|
4469
4800
|
: null
|
|
4470
|
-
if (!items.length) return soft || React.createElement('div', { style: { padding: '8px 12px', paddingLeft: depth * 22 + 6, color: T.muted, fontSize: 12 } }, tr(
|
|
4801
|
+
if (!items.length) return soft || React.createElement('div', { style: { padding: '8px 12px', paddingLeft: depth * 22 + 6, color: T.muted, fontSize: 12 } }, tr('explorer.emptyFolder'))
|
|
4471
4802
|
return React.createElement('div', { key: dir + ':list' },
|
|
4472
4803
|
items.map((it) => row({ ...it, path: joinRemote(dir, it.name) }, depth)),
|
|
4473
4804
|
soft,
|
|
@@ -4489,10 +4820,11 @@ window.__ModuleLoader__.load({
|
|
|
4489
4820
|
|
|
4490
4821
|
return React.createElement('div', { style: { display: 'flex', flexDirection: 'column', height: '100%', minHeight: 0 } },
|
|
4491
4822
|
React.createElement('div', { style: { padding: '10px 10px 6px', borderBottom: '1px solid ' + T.border } },
|
|
4492
|
-
React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 6 } },
|
|
4493
|
-
React.createElement('span', { style: { flex: 1, minWidth: 0, fontSize: 12, fontWeight: 600 } }, tr('workbench.explorer')),
|
|
4823
|
+
React.createElement('div', { 'data-rw-explorer-toolbar': '', style: { display: 'flex', alignItems: 'center', gap: 6 } },
|
|
4824
|
+
React.createElement('span', { 'data-rw-explorer-title': '', style: { flex: 1, minWidth: 0, fontSize: 12, fontWeight: 600, whiteSpace: 'nowrap' } }, tr('workbench.explorer')),
|
|
4494
4825
|
React.createElement(WorkbenchAction, { icon: 'terminal', label: tr('workbench.openTerminal'), disabled: !root || remoteTerminal.pending, onClick: remoteTerminal.open }),
|
|
4495
|
-
React.createElement(WorkbenchAction, { icon: '
|
|
4826
|
+
React.createElement(WorkbenchAction, { icon: 'branch', label: tr('changes.title'), disabled: !root, onClick: () => { if (props.onOpenChanges) props.onOpenChanges(); else if (SIDEBAR_RIGHT?.openTabIn) SIDEBAR_RIGHT.openTabIn(sessionId, NATIVE_CHANGES); else if (SIDEBAR_RIGHT?.mounted?.getSnapshot?.() === sessionId) SIDEBAR_RIGHT.openTab?.(NATIVE_CHANGES) } }),
|
|
4827
|
+
React.createElement(WorkbenchAction, { icon: 'search', label: tr('workbench.filter'), pressed: filterOpen, disabled: !root, onClick: () => { setFilterOpen((v) => !v); setFilter('') } }),
|
|
4496
4828
|
React.createElement(WorkbenchAction, { icon: 'refresh', label: tr('explorer.refresh'), onClick: () => refreshStatus({ force: true }) }),
|
|
4497
4829
|
React.createElement(WorkbenchAction, { icon: 'collapse', label: tr('workbench.collapse'), disabled: !root, onClick: () => { props.onCollapseAll?.(); setRootOpen(true) } }),
|
|
4498
4830
|
),
|
|
@@ -4500,23 +4832,26 @@ window.__ModuleLoader__.load({
|
|
|
4500
4832
|
React.createElement('span', { 'aria-hidden': true, style: { width: 6, height: 6, borderRadius: '50%', flexShrink: 0, background: connectionState === 'ready' ? T.ok : connectionState === 'interrupted' ? T.warn : T.muted } }),
|
|
4501
4833
|
React.createElement('span', { style: { overflow: 'hidden', textOverflow: 'ellipsis' } }, status && status.host ? (status.username ? status.username + '@' : '') + status.host : tr('workbench.remote')),
|
|
4502
4834
|
root ? React.createElement('span', { style: { marginLeft: 'auto', fontSize: 10 } }, rootName) : null),
|
|
4503
|
-
filterOpen ? React.createElement('
|
|
4835
|
+
filterOpen ? React.createElement('div', { className: 'dsh-rw-search-controls' },
|
|
4836
|
+
React.createElement('input', { ref: filterRef, type: 'search', className: 'dsh-rw-input', 'aria-label': tr('workspaceSearch.query'), placeholder: tr('workspaceSearch.placeholder'), value: filter, onChange: e => setFilter(e.target.value), onKeyDown: e => { if (e.isComposing) return; if (e.key === 'Escape') { e.stopPropagation(); setFilter(''); setFilterOpen(false) } else if (e.key === 'Enter') { e.preventDefault(); setSearchRetry(value => value + 1) } }, style: { ...inputS, boxSizing: 'border-box', width: '100%', fontSize: 12 } }),
|
|
4837
|
+
React.createElement('div', { className: 'dsh-rw-search-scope' },
|
|
4838
|
+
React.createElement('select', { 'aria-label': tr('workspaceSearch.mode'), value: searchMode, onChange: e => setSearchMode(e.target.value), style: { ...inputS, width: 'auto', flex: 1, minWidth: 0, fontSize: 11, padding: '4px 6px' } }, ['names','files','directories','content'].map(value => React.createElement('option', { key: value, value }, tr(({ names: 'workspaceSearch.names', files: 'workspaceSearch.files', directories: 'workspaceSearch.directories', content: 'workspaceSearch.content' })[value])))),
|
|
4839
|
+
React.createElement('details', { className: 'dsh-rw-search-options' },
|
|
4840
|
+
React.createElement('summary', { 'aria-label': tr('workspaceSearch.options') }, searchCase || searchIgnored ? tr('workspaceSearch.activeOptions', { n: Number(searchCase) + Number(searchIgnored) }) : tr('workspaceSearch.options')),
|
|
4841
|
+
React.createElement('div', { className: 'dsh-rw-search-option-body' },
|
|
4842
|
+
React.createElement('label', {}, React.createElement('input', { type: 'checkbox', checked: searchCase, onChange: e => setSearchCase(e.target.checked) }), tr('workspaceSearch.caseSensitive')),
|
|
4843
|
+
React.createElement('label', {}, React.createElement('input', { type: 'checkbox', checked: searchIgnored, onChange: e => setSearchIgnored(e.target.checked) }), tr('workspaceSearch.includeIgnored')),
|
|
4844
|
+
React.createElement('p', {}, tr('workspaceSearch.ignoreHint')))))) : null,
|
|
4504
4845
|
),
|
|
4505
4846
|
connectionState === 'interrupted' && root ? React.createElement('div', { role: 'status', style: { padding: '6px 10px', display: 'flex', gap: 6, fontSize: 11, color: T.warn, background: T.bg } },
|
|
4506
4847
|
React.createElement('span', { style: { flex: 1 } }, tr('explorer.connection.interrupted')),
|
|
4507
4848
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: buttonS, onClick: () => refreshStatus({ force: true }) }, tr('project.retry'))) : null,
|
|
4508
4849
|
remoteTerminal.error ? React.createElement('div', { role: 'alert', style: { padding: '6px 10px', color: T.danger, fontSize: 12 } }, remoteTerminal.error) : null,
|
|
4509
|
-
root && status && status.sync ? React.createElement('details', { style: { padding: '4px 8px', fontSize: 11, color: T.muted, borderBottom: '1px solid ' + T.border } },
|
|
4510
|
-
React.createElement('summary', { style: { cursor: 'pointer' } }, tr(({ unknown: 'sync.unknown', running: 'sync.running', completed: 'sync.completed', partial: 'sync.partial', conflicts: 'sync.conflicts', failed: 'sync.failed', pending: 'sync.pending' })[status.sync.phase] || 'sync.unknown')),
|
|
4511
|
-
React.createElement('div', { style: { padding: '6px 0', whiteSpace: 'pre-wrap', overflowWrap: 'anywhere', lineHeight: 1.6 } },
|
|
4512
|
-
status.sync.updatedAt ? new Date(status.sync.updatedAt).toLocaleString() : tr('sync.explain'),
|
|
4513
|
-
status.sync.error ? '\n' + status.sync.error : '',
|
|
4514
|
-
(status.sync.conflicts || []).map((c) => '\n' + c.path + (c.reason ? ' · ' + c.reason : '')).join(''),
|
|
4515
|
-
status.sync.phase === 'conflicts' ? '\n' + tr('sync.conflictHelp') : '')) : null,
|
|
4516
4850
|
picker ? React.createElement('div', { style: { padding: 8 } }, React.createElement(DirPicker, {
|
|
4517
4851
|
open: true, busy: false, registerWorkspace: false, initialTab: 'remote', onPicked: () => { setPicker(false); refreshStatus() }, onCancel: () => setPicker(false),
|
|
4518
4852
|
})) : null,
|
|
4519
|
-
React.createElement(
|
|
4853
|
+
root && filterOpen && filter.trim() ? React.createElement(RemoteWorkspaceSearch, { key: sessionId + ':' + root, root, sessionId, query: filter.trim(), mode: searchMode, includeIgnored: searchIgnored, caseSensitive: searchCase, retryKey: searchRetry, onOpenFile: openFile, onRevealDirectory: revealDirectory }) : null,
|
|
4854
|
+
React.createElement('div', { role: 'tree', 'aria-label': tr('explorer.tabTitle'), ref: treeRef, onScroll: (e) => explorerMemory.set(sessionId || '', { ...explorerMemory.get(sessionId || ''), scrollTop: e.currentTarget.scrollTop }), onKeyDown: treeKeyDown, style: { flex: 1, overflowY: 'auto', minHeight: 0, padding: '2px 0', display: filterOpen && filter.trim() ? 'none' : undefined } },
|
|
4520
4855
|
!root
|
|
4521
4856
|
? React.createElement('div', { style: { opacity: 0.6, padding: 12, fontSize: 13 } }, err ? tr('explorer.cannotResolve') : tr('explorer.localSession'))
|
|
4522
4857
|
: React.createElement('div', { key: root },
|
|
@@ -4535,9 +4870,9 @@ window.__ModuleLoader__.load({
|
|
|
4535
4870
|
rootLevel && rootOpen ? renderLevel(root, 1) : null,
|
|
4536
4871
|
),
|
|
4537
4872
|
),
|
|
4538
|
-
React.createElement('div', { style: { display: 'flex', gap: 6, padding: '6px 10px', borderTop: '1px solid ' + T.border, alignItems: 'center' } },
|
|
4873
|
+
!(filterOpen && filter.trim()) ? React.createElement('div', { style: { display: 'flex', gap: 6, padding: '6px 10px', borderTop: '1px solid ' + T.border, alignItems: 'center' } },
|
|
4539
4874
|
React.createElement('span', { className: 'dsh-rw-path', style: { flex: 1 }, title: root }, root),
|
|
4540
|
-
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, fontSize: 11, padding: '3px 8px' }, disabled: !root || !!busy, onClick: () => setNamePrompt({ kind: 'mkdir', path: root, name: '' }) }, tr('explorer.newDir'))),
|
|
4875
|
+
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, fontSize: 11, padding: '3px 8px' }, disabled: !root || !!busy, onClick: () => setNamePrompt({ kind: 'mkdir', path: root, name: '' }) }, tr('explorer.newDir')) ) : null,
|
|
4541
4876
|
// context menu — host Menu primitive when available (anchored at the
|
|
4542
4877
|
// pointer, body-portaled), otherwise the DOM portal in the effect above
|
|
4543
4878
|
menu && HostMenu ? React.createElement(HostMenu, {
|
|
@@ -4645,7 +4980,7 @@ window.__ModuleLoader__.load({
|
|
|
4645
4980
|
)
|
|
4646
4981
|
}
|
|
4647
4982
|
|
|
4648
|
-
// ── Remote file tab (
|
|
4983
|
+
// ── Remote file tab (live read, editable text and conflict-aware saves) ──
|
|
4649
4984
|
/**
|
|
4650
4985
|
* The host's MarkdownText reads chrome strings off `labels` while rendering
|
|
4651
4986
|
* fenced code blocks (`labels.code.*`) and footnotes (`labels.footnotes`),
|
|
@@ -4687,7 +5022,157 @@ window.__ModuleLoader__.load({
|
|
|
4687
5022
|
return { text: text.slice(0, lineStart) + indented + text.slice(blockEnd), start: Math.max(lineStart, start + firstAdjustment), end: Math.max(lineStart, end + adjustment) }
|
|
4688
5023
|
}
|
|
4689
5024
|
|
|
5025
|
+
// Keeps the native textarea as the editor: selection, IME, accessibility,
|
|
5026
|
+
// clipboard and the browser undo stack never depend on token DOM nodes.
|
|
5027
|
+
function HighlightedEditor(props) {
|
|
5028
|
+
const value = String(props.value ?? '')
|
|
5029
|
+
const lang = languageForPathFn ? languageForPathFn(props.path || '') : undefined
|
|
5030
|
+
const highlight = useCodeHighlighterFn ? useCodeHighlighterFn(lang) : null
|
|
5031
|
+
const lines = React.useMemo(() => value.split('\n'), [value])
|
|
5032
|
+
const large = value.length > 300000 || lines.length > 10000
|
|
5033
|
+
const tokenLines = React.useMemo(() => {
|
|
5034
|
+
if (!highlight || large) return null
|
|
5035
|
+
try {
|
|
5036
|
+
const result = highlight(value)
|
|
5037
|
+
if (!Array.isArray(result)) return null
|
|
5038
|
+
// Never hide native text behind stale, clipped or malformed tokens.
|
|
5039
|
+
if (!lines.every((line, index) => Array.isArray(result[index] || []) && (result[index] || []).every(token => token && typeof token.text === 'string') && (result[index] || []).map(token => token.text).join('') === line)) return null
|
|
5040
|
+
return result
|
|
5041
|
+
} catch { return null }
|
|
5042
|
+
}, [highlight, value, lines, large])
|
|
5043
|
+
const ownEditorRef = React.useRef(null)
|
|
5044
|
+
const paintRef = React.useRef(null)
|
|
5045
|
+
const gutterRef = React.useRef(null)
|
|
5046
|
+
const compositionRef = React.useRef(false)
|
|
5047
|
+
const publishedRef = React.useRef(0)
|
|
5048
|
+
const [composing, setComposing] = React.useState(false)
|
|
5049
|
+
const [metrics, setMetrics] = React.useState({ width: 0, gutterHeights: [] })
|
|
5050
|
+
const layoutEffect = React.useLayoutEffect || React.useEffect
|
|
5051
|
+
const lineHeight = 20
|
|
5052
|
+
const marked = new Set(props.matchingLines || [])
|
|
5053
|
+
const colored = !!tokenLines && !composing
|
|
5054
|
+
const paintText = !composing && !large
|
|
5055
|
+
const typography = {
|
|
5056
|
+
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace', fontSize: 13,
|
|
5057
|
+
lineHeight: lineHeight + 'px', fontWeight: 400, fontStyle: 'normal', fontVariantLigatures: 'none',
|
|
5058
|
+
fontKerning: 'none', fontFeatureSettings: '"liga" 0, "calt" 0', letterSpacing: 0,
|
|
5059
|
+
tabSize: 2, textIndent: 0, textAlign: 'left', textTransform: 'none', direction: 'ltr',
|
|
5060
|
+
whiteSpace: props.wrap ? 'pre-wrap' : 'pre', overflowWrap: props.wrap ? 'anywhere' : 'normal', wordBreak: 'normal',
|
|
5061
|
+
}
|
|
5062
|
+
const syncScroll = node => {
|
|
5063
|
+
if (paintRef.current) paintRef.current.style.transform = 'translate(' + (-node.scrollLeft) + 'px,' + (-node.scrollTop) + 'px)'
|
|
5064
|
+
if (gutterRef.current) gutterRef.current.style.transform = 'translateY(' + (-node.scrollTop) + 'px)'
|
|
5065
|
+
}
|
|
5066
|
+
const publish = event => { publishedRef.current++; props.onChange?.(event) }
|
|
5067
|
+
const notifySelection = node => props.onSelect?.({ currentTarget: node, target: node })
|
|
5068
|
+
const measure = () => {
|
|
5069
|
+
const node = ownEditorRef.current, paint = paintRef.current
|
|
5070
|
+
if (!node || !paint) return
|
|
5071
|
+
const heights = Array.from(paint.children, row => row.getBoundingClientRect().height)
|
|
5072
|
+
setMetrics(previous => previous.width === node.clientWidth && previous.gutterHeights.length === heights.length && heights.every((height, index) => height === previous.gutterHeights[index])
|
|
5073
|
+
? previous : { width: node.clientWidth, gutterHeights: heights })
|
|
5074
|
+
syncScroll(node)
|
|
5075
|
+
}
|
|
5076
|
+
layoutEffect(() => {
|
|
5077
|
+
const node = ownEditorRef.current
|
|
5078
|
+
measure()
|
|
5079
|
+
if (!node || typeof ResizeObserver !== 'function') return undefined
|
|
5080
|
+
const observer = new ResizeObserver(measure)
|
|
5081
|
+
observer.observe(node)
|
|
5082
|
+
if (paintRef.current) observer.observe(paintRef.current)
|
|
5083
|
+
return () => observer.disconnect()
|
|
5084
|
+
}, [])
|
|
5085
|
+
layoutEffect(measure, [value, props.wrap, tokenLines, metrics.width])
|
|
5086
|
+
const revealLine = (requested, select) => {
|
|
5087
|
+
const node = ownEditorRef.current, paint = paintRef.current
|
|
5088
|
+
if (!node || !paint || !Number.isFinite(Number(requested))) return
|
|
5089
|
+
const number = Math.max(1, Math.min(lines.length, Math.trunc(Number(requested))))
|
|
5090
|
+
const row = paint.children[number - 1]
|
|
5091
|
+
if (select) {
|
|
5092
|
+
const offset = lines.slice(0, number - 1).reduce((sum, line) => sum + line.length + 1, 0)
|
|
5093
|
+
try { node.focus({ preventScroll: true }) } catch { node.focus() }
|
|
5094
|
+
node.setSelectionRange(offset, offset)
|
|
5095
|
+
notifySelection(node)
|
|
5096
|
+
}
|
|
5097
|
+
node.scrollTop = Math.max(0, (row ? row.offsetTop : 10 + (number - 1) * lineHeight) - (node.clientHeight - (row ? row.offsetHeight : lineHeight)) / 2)
|
|
5098
|
+
if (select) node.scrollLeft = 0
|
|
5099
|
+
syncScroll(node)
|
|
5100
|
+
props.onScroll?.({ currentTarget: node, target: node })
|
|
5101
|
+
}
|
|
5102
|
+
layoutEffect(() => {
|
|
5103
|
+
const node = ownEditorRef.current
|
|
5104
|
+
if (!node) return undefined
|
|
5105
|
+
node.dshScrollToLine = line => revealLine(line, false)
|
|
5106
|
+
return () => { delete node.dshScrollToLine }
|
|
5107
|
+
}, [value, props.wrap])
|
|
5108
|
+
layoutEffect(() => {
|
|
5109
|
+
if (!props.jumpLine) return undefined
|
|
5110
|
+
const schedule = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : callback => setTimeout(callback, 0)
|
|
5111
|
+
const cancel = typeof cancelAnimationFrame === 'function' ? cancelAnimationFrame : clearTimeout
|
|
5112
|
+
const frame = schedule(() => revealLine(props.jumpLine, true))
|
|
5113
|
+
return () => cancel(frame)
|
|
5114
|
+
}, [props.path, props.jumpLine, props.jumpRevision])
|
|
5115
|
+
layoutEffect(() => { if (props.currentMatchLine) revealLine(props.currentMatchLine, false) }, [props.currentMatchLine])
|
|
5116
|
+
const indentSelection = (node, reverse) => {
|
|
5117
|
+
const transform = props.indent || indentRemoteDraft
|
|
5118
|
+
const result = transform(node.value, node.selectionStart, node.selectionEnd, reverse)
|
|
5119
|
+
if (result.text === node.value) return
|
|
5120
|
+
// Replace only the changed range. Native insertText records a genuine
|
|
5121
|
+
// editing transaction; assigning .value would discard browser undo.
|
|
5122
|
+
const before = node.value
|
|
5123
|
+
let from = 0, oldEnd = before.length, newEnd = result.text.length
|
|
5124
|
+
while (from < oldEnd && from < newEnd && before[from] === result.text[from]) from++
|
|
5125
|
+
while (oldEnd > from && newEnd > from && before[oldEnd - 1] === result.text[newEnd - 1]) { oldEnd--; newEnd-- }
|
|
5126
|
+
const published = publishedRef.current
|
|
5127
|
+
node.setSelectionRange(from, oldEnd)
|
|
5128
|
+
let inserted = false
|
|
5129
|
+
try { inserted = document.execCommand('insertText', false, result.text.slice(from, newEnd)) } catch { /* unsupported browser */ }
|
|
5130
|
+
if (!inserted || node.value !== result.text) node.setRangeText(result.text.slice(from, newEnd), from, oldEnd, 'end')
|
|
5131
|
+
// execCommand fires React's input event on supported browsers. The
|
|
5132
|
+
// fallback must publish explicitly, without emitting a duplicate edit.
|
|
5133
|
+
if (publishedRef.current === published) publish({ currentTarget: node, target: node })
|
|
5134
|
+
node.setSelectionRange(result.start, result.end)
|
|
5135
|
+
notifySelection(node)
|
|
5136
|
+
syncScroll(node)
|
|
5137
|
+
}
|
|
5138
|
+
return React.createElement('div', {
|
|
5139
|
+
'data-rw-highlight-editor': '', 'data-rw-editor-highlighted': colored ? 'true' : 'false',
|
|
5140
|
+
style: { position: 'relative', flex: 1, minHeight: 0, minWidth: 0, display: 'flex', overflow: 'hidden', ...typography, background: 'transparent' },
|
|
5141
|
+
},
|
|
5142
|
+
React.createElement('style', {}, '[data-rw-editor-input]::selection{background:rgba(74,144,226,.32);color:inherit;-webkit-text-fill-color:inherit}'),
|
|
5143
|
+
React.createElement('div', { 'aria-hidden': true, 'data-rw-editor-gutter': '', style: { display: large ? 'none' : undefined, flex: '0 0 ' + (Math.max(3, String(lines.length).length) + 2) + 'ch', overflow: 'hidden', borderRight: '1px solid ' + T.border, color: T.muted, userSelect: 'none', ...typography } },
|
|
5144
|
+
React.createElement('div', { ref: gutterRef, style: { paddingTop: 10, paddingBottom: 10 } }, (large ? [] : lines).map((_, index) => React.createElement('div', { key: index, style: { height: metrics.gutterHeights[index] || lineHeight, textAlign: 'right', paddingRight: 10, boxSizing: 'border-box' } }, index + 1)))),
|
|
5145
|
+
React.createElement('div', { style: { position: 'relative', flex: 1, minWidth: 0, minHeight: 0, overflow: 'hidden' } },
|
|
5146
|
+
React.createElement('pre', { ref: paintRef, 'aria-hidden': true, 'data-rw-editor-paint': '', style: { ...typography, position: 'absolute', left: 0, top: 0, margin: 0, border: 0, padding: '10px 12px', boxSizing: 'border-box', width: metrics.width || '100%', pointerEvents: 'none', visibility: paintText ? 'visible' : 'hidden', color: T.label } },
|
|
5147
|
+
(large ? [] : lines).map((line, index) => React.createElement('span', {
|
|
5148
|
+
key: index + (Number(props.jumpLine) === index + 1 ? '-jump-' + String(props.jumpRevision || 0) : ''),
|
|
5149
|
+
'data-line': index + 1, 'data-rw-editor-line': index + 1,
|
|
5150
|
+
className: [Number(props.jumpLine) === index + 1 ? 'dsh-rw-line-flash' : '', props.currentMatchLine === index + 1 ? 'dsh-rw-code-current' : marked.has(index + 1) ? 'dsh-rw-code-hit' : ''].filter(Boolean).join(' ') || undefined,
|
|
5151
|
+
style: { display: 'block', minHeight: lineHeight, ...typography },
|
|
5152
|
+
}, tokenLines && tokenLines[index]?.length
|
|
5153
|
+
? tokenLines[index].map((token, tokenIndex) => React.createElement('span', { key: tokenIndex, 'data-rw-editor-token': '', style: { color: token.style?.color || T.label } }, token.text))
|
|
5154
|
+
: line || '\u200b'))),
|
|
5155
|
+
React.createElement('textarea', {
|
|
5156
|
+
ref: node => { ownEditorRef.current = node; if (typeof props.editorRef === 'function') props.editorRef(node); else if (props.editorRef) props.editorRef.current = node },
|
|
5157
|
+
'data-rw-editor-input': '', 'aria-label': props['aria-label'], value, wrap: props.wrap ? 'soft' : 'off',
|
|
5158
|
+
spellCheck: false, autoCorrect: 'off', autoCapitalize: 'off', autoComplete: 'off',
|
|
5159
|
+
onChange: publish, onSelect: props.onSelect,
|
|
5160
|
+
onScroll: event => { syncScroll(event.currentTarget); props.onScroll?.(event) },
|
|
5161
|
+
onCompositionStart: () => { compositionRef.current = true; setComposing(true) },
|
|
5162
|
+
onCompositionEnd: event => { compositionRef.current = false; setComposing(false); publish(event) },
|
|
5163
|
+
onKeyDown: event => {
|
|
5164
|
+
if (compositionRef.current || event.isComposing || event.nativeEvent?.isComposing) return
|
|
5165
|
+
if (event.key === 'Tab') { event.preventDefault(); indentSelection(event.currentTarget, event.shiftKey); return }
|
|
5166
|
+
props.onKeyDown?.(event)
|
|
5167
|
+
},
|
|
5168
|
+
style: { ...typography, position: 'absolute', inset: 0, width: '100%', height: '100%', padding: '10px 12px', boxSizing: 'border-box', border: 0, outline: 'none', margin: 0, resize: 'none', background: 'transparent', color: paintText ? 'transparent' : T.label, WebkitTextFillColor: paintText ? 'transparent' : T.label, caretColor: T.label, overflow: 'auto' },
|
|
5169
|
+
}),
|
|
5170
|
+
),
|
|
5171
|
+
)
|
|
5172
|
+
}
|
|
5173
|
+
|
|
4690
5174
|
const remoteDrafts = new Map()
|
|
5175
|
+
const pendingFileSaves = new Map()
|
|
4691
5176
|
function RemoteFileTab(props) {
|
|
4692
5177
|
const { tab, scope } = props
|
|
4693
5178
|
const path = tab.path || ''
|
|
@@ -4695,6 +5180,11 @@ window.__ModuleLoader__.load({
|
|
|
4695
5180
|
const [data, setData] = React.useState(() => fileViewMemory.get(String(fileSessionId || '') + '\0' + path)?.data || null)
|
|
4696
5181
|
const [err, setErr] = React.useState('')
|
|
4697
5182
|
const [loading, setLoading] = React.useState(true)
|
|
5183
|
+
const [localCopy, setLocalCopy] = React.useState(null)
|
|
5184
|
+
const [localPreview, setLocalPreview] = React.useState(null)
|
|
5185
|
+
const [copyBusy, setCopyBusy] = React.useState(false)
|
|
5186
|
+
const copyRequestRef = React.useRef(null)
|
|
5187
|
+
const copyGenerationRef = React.useRef(0)
|
|
4698
5188
|
const [edit, setEdit] = React.useState(false)
|
|
4699
5189
|
const [draft, setDraft] = React.useState('')
|
|
4700
5190
|
const [saving, setSaving] = React.useState(false)
|
|
@@ -4709,7 +5199,7 @@ window.__ModuleLoader__.load({
|
|
|
4709
5199
|
const remoteTerminal = useRemoteTerminal(fileSessionId)
|
|
4710
5200
|
const cachedView = fileViewMemory.get(draftKey)
|
|
4711
5201
|
const [wrap, setWrap] = React.useState(() => !!cachedView?.wrap)
|
|
4712
|
-
const [sourceMode, setSourceMode] = React.useState(() =>
|
|
5202
|
+
const [sourceMode, setSourceMode] = React.useState(() => cachedView?.sourceMode !== false)
|
|
4713
5203
|
const [findOpen, setFindOpen] = React.useState(false)
|
|
4714
5204
|
const [findQuery, setFindQuery] = React.useState('')
|
|
4715
5205
|
const [findIndex, setFindIndex] = React.useState(0)
|
|
@@ -4722,14 +5212,14 @@ window.__ModuleLoader__.load({
|
|
|
4722
5212
|
React.useEffect(() => () => { if (copyTimerRef.current) clearTimeout(copyTimerRef.current) }, [])
|
|
4723
5213
|
React.useEffect(() => {
|
|
4724
5214
|
const view = fileViewMemory.get(draftKey)
|
|
4725
|
-
setWrap(!!view?.wrap); setSourceMode(
|
|
5215
|
+
setWrap(!!view?.wrap); setSourceMode(view?.sourceMode !== false)
|
|
4726
5216
|
setFindOpen(false); setFindQuery(''); setFindIndex(0)
|
|
4727
5217
|
rememberRemoteSelection(fileSessionId, path)
|
|
4728
5218
|
}, [draftKey])
|
|
4729
5219
|
React.useEffect(() => { if (findOpen) { findRef.current?.focus(); findRef.current?.select() } }, [findOpen])
|
|
4730
5220
|
React.useEffect(() => {
|
|
4731
5221
|
if (loading || props.jumpLine) return
|
|
4732
|
-
const node = scrollRef.current
|
|
5222
|
+
const node = editorRef.current || scrollRef.current
|
|
4733
5223
|
const view = fileViewMemory.get(draftKey)
|
|
4734
5224
|
if (node && view) { node.scrollTop = view.scrollTop || 0; node.scrollLeft = view.scrollLeft || 0 }
|
|
4735
5225
|
}, [loading, draftKey])
|
|
@@ -4748,7 +5238,13 @@ window.__ModuleLoader__.load({
|
|
|
4748
5238
|
}
|
|
4749
5239
|
const showExplorer = () => {
|
|
4750
5240
|
rememberRemoteSelection(fileSessionId, path)
|
|
4751
|
-
if (SIDEBAR_RIGHT?.
|
|
5241
|
+
if (remoteIdeState.enabled && SIDEBAR_RIGHT?.mounted?.getSnapshot?.() === fileSessionId) {
|
|
5242
|
+
const rows = document.querySelectorAll?.('[data-rw-ide-tree] [data-rw-tree-row]') || []
|
|
5243
|
+
const row = Array.from(rows).find(node => node.getAttribute('data-rw-tree-row') === path) || rows[0]
|
|
5244
|
+
row?.focus(); return
|
|
5245
|
+
}
|
|
5246
|
+
if (SIDEBAR_RIGHT?.openTabIn) SIDEBAR_RIGHT.openTabIn(fileSessionId, NATIVE_EXPLORER)
|
|
5247
|
+
else if (SIDEBAR_RIGHT?.openTab) SIDEBAR_RIGHT.openTab(NATIVE_EXPLORER)
|
|
4752
5248
|
}
|
|
4753
5249
|
const updateCursor = (node) => {
|
|
4754
5250
|
const before = node.value.slice(0, node.selectionStart)
|
|
@@ -4759,15 +5255,15 @@ window.__ModuleLoader__.load({
|
|
|
4759
5255
|
const saveTokenRef = React.useRef(null)
|
|
4760
5256
|
const discardDraft = async (reload) => {
|
|
4761
5257
|
if (dirty && !(await discardConfirm.ask(tr('file.discardConfirm')))) return
|
|
4762
|
-
remoteDrafts.delete(draftKey); setEdit(
|
|
5258
|
+
remoteDrafts.delete(draftKey); setDraft(originalText); setEdit(!!data && !data.binary && !data.image && !data.truncated); setErr(''); setSaveConflict(false)
|
|
4763
5259
|
if (reload === true) load()
|
|
4764
5260
|
}
|
|
4765
5261
|
const changeDraft = (text) => {
|
|
4766
5262
|
setDraft(text)
|
|
4767
5263
|
const prev = remoteDrafts.get(draftKey)
|
|
4768
5264
|
const baseText = prev ? prev.baseText : originalText
|
|
4769
|
-
if (text === baseText) remoteDrafts.delete(draftKey)
|
|
4770
|
-
else remoteDrafts.set(draftKey, { text, baseText, baseMtime: prev ? prev.baseMtime : data && data.mtime })
|
|
5265
|
+
if (text === baseText && !pendingFileSaves.has(draftKey)) remoteDrafts.delete(draftKey)
|
|
5266
|
+
else remoteDrafts.set(draftKey, { text, baseText, baseMtime: prev ? prev.baseMtime : data && data.mtime, baseRevision: prev ? prev.baseRevision : data?.revision, baseEol: prev ? prev.baseEol : data?.eol })
|
|
4771
5267
|
}
|
|
4772
5268
|
|
|
4773
5269
|
React.useEffect(() => { ensureChromeCss() }, [])
|
|
@@ -4788,49 +5284,88 @@ window.__ModuleLoader__.load({
|
|
|
4788
5284
|
footnotes: tr('file.markdown.footnotes'),
|
|
4789
5285
|
}
|
|
4790
5286
|
|
|
4791
|
-
const originalText = (data && data.content != null ? data.content : '').replace(/\n…\[truncated:.*$/, '')
|
|
5287
|
+
const originalText = (data && data.content != null ? data.content : '').replace(/\n…\[truncated:.*$/, '').replace(/\r\n/g, '\n')
|
|
4792
5288
|
const dirty = edit && draft !== originalText
|
|
4793
5289
|
|
|
4794
5290
|
const load = () => {
|
|
5291
|
+
if (props.visible === false) return
|
|
4795
5292
|
if (!path) { setLoading(false); return }
|
|
4796
5293
|
let cancelled = false
|
|
4797
|
-
|
|
5294
|
+
const cached = fileViewMemory.get(draftKey)?.data || null
|
|
5295
|
+
const generation = ++copyGenerationRef.current; copyRequestRef.current = null
|
|
5296
|
+
setLocalCopy(null); setLocalPreview(null); setCopyBusy(false)
|
|
5297
|
+
setLoading(true); setErr(''); setData(cached); setEdit(!!cached && !cached.binary && !cached.image && !cached.truncated); setSaveConflict(false)
|
|
5298
|
+
setDraft(remoteDrafts.get(draftKey)?.text ?? String(cached?.content || '').replace(/\r\n/g, '\n'))
|
|
4798
5299
|
readRemoteFile(path, 256 * 1024, fileSessionId)
|
|
4799
|
-
.then((d) => { if (!cancelled && fileViewRef.current === draftKey) {
|
|
5300
|
+
.then((d) => { if (!cancelled && fileViewRef.current === draftKey && copyGenerationRef.current === generation) {
|
|
4800
5301
|
keepView({ data: d }); setData(d); setLoading(false)
|
|
4801
5302
|
const saved = remoteDrafts.get(draftKey)
|
|
4802
|
-
if (saved) { setDraft(saved.text); setEdit(true); setSaveConflict(!!d.truncated || (saved.baseMtime != null && d.mtime !== saved.baseMtime)) }
|
|
5303
|
+
if (saved) { setDraft(saved.text); setEdit(true); setSaveConflict(!!d.truncated || (saved.baseMtime != null && d.mtime !== saved.baseMtime) || (saved.baseRevision != null && saved.baseRevision !== d.revision)) }
|
|
5304
|
+
else { setDraft(String(d.content || '').replace(/\r\n/g, '\n')); setEdit(!d.binary && !d.image && !d.truncated && typeof d.content === 'string') }
|
|
5305
|
+
} })
|
|
5306
|
+
.catch((e) => { if (!cancelled && fileViewRef.current === draftKey && copyGenerationRef.current === generation) {
|
|
5307
|
+
if (e?.code === 'REMOTE_FILE_MISSING_LOCAL_COPY' && e.localCopy?.available) {
|
|
5308
|
+
setLocalCopy(e.localCopy); setData(null); setEdit(false); keepView({ data: null }); setErr('')
|
|
5309
|
+
} else setErr(String((e && e.message) || e))
|
|
5310
|
+
setLoading(false)
|
|
4803
5311
|
} })
|
|
4804
|
-
.catch((e) => { if (!cancelled && fileViewRef.current === draftKey) { setErr(String((e && e.message) || e)); setLoading(false) } })
|
|
4805
5312
|
return () => { cancelled = true }
|
|
4806
5313
|
}
|
|
4807
|
-
React.useEffect(load, [path, fileSessionId, props.navigationRevision])
|
|
5314
|
+
React.useEffect(load, [path, fileSessionId, props.navigationRevision, props.visible])
|
|
5315
|
+
|
|
5316
|
+
const recoverLocalCopy = async (publish) => {
|
|
5317
|
+
if (!fileSessionId || copyRequestRef.current || (publish && !localPreview?.localRevision)) return
|
|
5318
|
+
const request = { key: draftKey, generation: copyGenerationRef.current }
|
|
5319
|
+
const isCurrent = () => fileViewRef.current === draftKey && copyRequestRef.current === request && copyGenerationRef.current === request.generation
|
|
5320
|
+
copyRequestRef.current = request
|
|
5321
|
+
setCopyBusy(true); setErr('')
|
|
5322
|
+
try {
|
|
5323
|
+
const result = await api('POST', '/dsh-remote/local-copy/' + (publish ? 'publish' : 'read'),
|
|
5324
|
+
withSessionBody({ path, ...(publish ? { expectedLocalRevision: localPreview.localRevision } : {}) }, fileSessionId))
|
|
5325
|
+
if (!isCurrent()) return
|
|
5326
|
+
if (publish) { setLocalCopy(null); setLocalPreview(null); load() }
|
|
5327
|
+
else setLocalPreview(result)
|
|
5328
|
+
} catch (error) {
|
|
5329
|
+
if (isCurrent()) setErr(String(error?.message || error))
|
|
5330
|
+
} finally {
|
|
5331
|
+
if (isCurrent()) { copyRequestRef.current = null; setCopyBusy(false) }
|
|
5332
|
+
}
|
|
5333
|
+
}
|
|
4808
5334
|
|
|
4809
5335
|
const startEdit = () => {
|
|
4810
5336
|
if (!data || data.binary || data.image || data.truncated) return
|
|
4811
|
-
setDraft((data.content != null ? data.content : '').replace(/\n…\[truncated:.*$/, ''))
|
|
5337
|
+
setDraft((data.content != null ? data.content : '').replace(/\n…\[truncated:.*$/, '').replace(/\r\n/g, '\n'))
|
|
4812
5338
|
setEdit(true); setErr(''); setSaveConflict(false)
|
|
4813
5339
|
}
|
|
4814
5340
|
const saveRemote = () => {
|
|
4815
|
-
if (saving || saveConflict || (data && data.truncated) || saveTokenRef.current === draftKey) return
|
|
5341
|
+
if (saving || saveConflict || (data && data.truncated) || saveTokenRef.current === draftKey || pendingFileSaves.has(draftKey)) return
|
|
4816
5342
|
saveTokenRef.current = draftKey
|
|
5343
|
+
const submittedText = draft
|
|
5344
|
+
const submittedEol = draftRecord?.baseEol || data?.eol
|
|
5345
|
+
const request = { submittedText }
|
|
5346
|
+
pendingFileSaves.set(draftKey, request)
|
|
4817
5347
|
setSaving(true); setErr('')
|
|
4818
|
-
apiRaw('POST', '/dsh-remote/write', withSessionBody({ path, content: draft, expectedMtime: draftRecord ? draftRecord.baseMtime : data && data.mtime }, fileSessionId))
|
|
5348
|
+
apiRaw('POST', '/dsh-remote/write', withSessionBody({ path, content: (draftRecord?.baseEol || data?.eol) === 'crlf' ? draft.replace(/\r?\n/g, '\r\n') : draft, expectedMtime: draftRecord ? draftRecord.baseMtime : data && data.mtime, expectedRevision: draftRecord ? draftRecord.baseRevision : data?.revision }, fileSessionId))
|
|
4819
5349
|
.then((r) => {
|
|
4820
|
-
if (r.status
|
|
4821
|
-
if (fileViewRef.current !== draftKey) return
|
|
5350
|
+
if (r.status >= 400 && fileViewRef.current !== draftKey) return
|
|
4822
5351
|
if (r.status === 409) {
|
|
4823
5352
|
setSaveConflict(true); setErr(String((r.data && r.data.error) || tr('file.conflict')))
|
|
4824
5353
|
return
|
|
4825
5354
|
}
|
|
4826
5355
|
if (r.status >= 400) throw new Error((r.data && (r.data.error || r.data.message)) || 'HTTP ' + r.status)
|
|
4827
|
-
remoteDrafts.
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
5356
|
+
const latest = remoteDrafts.get(draftKey)
|
|
5357
|
+
const newerDraft = latest && latest.text !== submittedText
|
|
5358
|
+
if (newerDraft) remoteDrafts.set(draftKey, { ...latest, baseText: submittedText, baseMtime: r.data?.mtime, baseRevision: r.data?.revision, baseEol: submittedEol })
|
|
5359
|
+
else remoteDrafts.delete(draftKey)
|
|
5360
|
+
const savedData = { ...(fileViewMemory.get(draftKey)?.data || data), content: submittedText, mtime: r.data?.mtime ?? data?.mtime, revision: r.data?.revision, size: r.data?.bytes ?? data?.size, eol: submittedEol }
|
|
5361
|
+
keepView({ data: savedData })
|
|
5362
|
+
if (fileViewRef.current !== draftKey) return
|
|
5363
|
+
setCopyNote(tr(newerDraft ? 'workbench.savedWithDraft' : 'workbench.saved'))
|
|
5364
|
+
if (newerDraft) { setData(savedData); setDraft(latest.text); setEdit(true); setSaveConflict(false) }
|
|
5365
|
+
else { setData(savedData); setDraft(submittedText); setEdit(true); setSaveConflict(false) }
|
|
4831
5366
|
})
|
|
4832
5367
|
.catch((e) => { if (fileViewRef.current === draftKey) setErr(String((e && e.message) || e)) })
|
|
4833
|
-
.finally(() => { if (saveTokenRef.current === draftKey) saveTokenRef.current = null; if (fileViewRef.current === draftKey) setSaving(false) })
|
|
5368
|
+
.finally(() => { if (pendingFileSaves.get(draftKey) === request) pendingFileSaves.delete(draftKey); if (saveTokenRef.current === draftKey) saveTokenRef.current = null; if (fileViewRef.current === draftKey) setSaving(false) })
|
|
4834
5369
|
}
|
|
4835
5370
|
const downloadMirror = () => {
|
|
4836
5371
|
setSaving(true); setErr('')
|
|
@@ -4860,6 +5395,7 @@ window.__ModuleLoader__.load({
|
|
|
4860
5395
|
if (!findOpen || !activeMatch) return
|
|
4861
5396
|
if (edit && editorRef.current) {
|
|
4862
5397
|
editorRef.current.setSelectionRange(activeMatch.start, activeMatch.end)
|
|
5398
|
+
editorRef.current.dshScrollToLine?.(activeMatch.line)
|
|
4863
5399
|
} else {
|
|
4864
5400
|
scrollRef.current?.querySelector('[data-line="' + activeMatch.line + '"]')?.scrollIntoView({ block: 'center' })
|
|
4865
5401
|
}
|
|
@@ -4880,15 +5416,15 @@ window.__ModuleLoader__.load({
|
|
|
4880
5416
|
React.createElement(WorkbenchAction, { icon: 'terminal', label: tr('workbench.openTerminal'), disabled: remoteTerminal.pending, onClick: remoteTerminal.open }),
|
|
4881
5417
|
edit ? React.createElement(React.Fragment, null,
|
|
4882
5418
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn dsh-rw-primary', style: { ...primaryBtnS, padding: '4px 10px', fontSize: 12 }, onClick: saveRemote, disabled: saving || !dirty || saveConflict, title: tr('file.saveHint') }, saving ? tr('file.saving') : tr('file.saveToRemote')),
|
|
4883
|
-
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, padding: '4px 8px', fontSize: 12 }, onClick: () => discardDraft(false) }, tr('file.
|
|
4884
|
-
: React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, padding: '4px 10px', fontSize: 12 }, onClick: startEdit, disabled: loading || !data || data.binary || data.image || data.truncated, title: data && data.truncated ? tr('file.incompletePreview') : tr('file.edit') }, tr('file.edit')),
|
|
5419
|
+
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, padding: '4px 8px', fontSize: 12 }, onClick: () => discardDraft(false), disabled: !dirty || saving }, tr('file.discardChanges')))
|
|
5420
|
+
: React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, padding: '4px 10px', fontSize: 12 }, onClick: startEdit, disabled: loading || !!localCopy || !data || data.binary || data.image || data.truncated, title: data && data.truncated ? tr('file.incompletePreview') : tr('file.edit') }, tr('file.edit')),
|
|
4885
5421
|
),
|
|
4886
5422
|
React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 6, padding: '4px 10px', borderBottom: '1px solid ' + T.border } },
|
|
4887
5423
|
React.createElement(WorkbenchAction, { icon: 'folder', label: tr('workbench.backToFiles'), onClick: showExplorer }),
|
|
4888
5424
|
React.createElement('span', { className: 'dsh-rw-path', style: { flex: 1 }, title: path }, path),
|
|
4889
5425
|
React.createElement(WorkbenchAction, { icon: 'copy', label: tr('workbench.copyPath'), onClick: () => copy(path) }),
|
|
4890
|
-
|
|
4891
|
-
isMarkdown
|
|
5426
|
+
React.createElement(WorkbenchAction, { icon: 'refresh', label: tr('explorer.refresh'), disabled: loading || saving, onClick: load }),
|
|
5427
|
+
isMarkdown ? React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, padding: '3px 8px', fontSize: 11 }, onClick: () => { setSourceMode(!sourceMode); keepView({ sourceMode: !sourceMode }) } }, sourceMode ? tr('workbench.preview') : tr('workbench.source')) : null),
|
|
4892
5428
|
findOpen ? React.createElement('div', { style: { display: 'flex', gap: 4, alignItems: 'center', padding: '6px 10px', borderBottom: '1px solid ' + T.border, background: T.bg } },
|
|
4893
5429
|
React.createElement('input', { ref: findRef, className: 'dsh-rw-input', 'aria-label': tr('workbench.find'), placeholder: tr('workbench.find'), value: findQuery, onChange: (e) => setFindQuery(e.target.value), onKeyDown: (e) => {
|
|
4894
5430
|
if (e.isComposing) return
|
|
@@ -4903,36 +5439,41 @@ window.__ModuleLoader__.load({
|
|
|
4903
5439
|
tr('file.conflictHelp'),
|
|
4904
5440
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, marginLeft: 8 }, onClick: () => copyToClipboard(draft) }, tr('file.copyDraft')),
|
|
4905
5441
|
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, marginLeft: 8 }, onClick: () => discardDraft(true) }, tr('file.discardReload'))) : null,
|
|
5442
|
+
localCopy ? React.createElement('div', { 'data-rw-local-copy-recovery': '', role: 'status', 'aria-busy': copyBusy, style: { padding: '12px', borderBottom: '1px solid ' + T.border, fontSize: 12, lineHeight: 1.6, background: T.bg } },
|
|
5443
|
+
React.createElement('strong', null, tr('file.localCopyMissing')),
|
|
5444
|
+
React.createElement('div', { style: { color: T.muted, marginTop: 4 } }, tr('file.localCopyHelp')),
|
|
5445
|
+
copyBusy ? React.createElement('div', { style: { marginTop: 4, color: T.muted } }, tr('file.loading')) : null,
|
|
5446
|
+
React.createElement('div', { style: { display: 'flex', flexWrap: 'wrap', gap: 8, marginTop: 10 } },
|
|
5447
|
+
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: buttonS, disabled: copyBusy, onClick: () => recoverLocalCopy(false) }, tr('file.localCopyView')),
|
|
5448
|
+
localPreview?.localRevision ? React.createElement('button', { type: 'button', className: 'dsh-rw-btn dsh-rw-primary', style: primaryBtnS, disabled: copyBusy, onClick: () => recoverLocalCopy(true) }, tr('file.localCopyPublish')) : null)) : null,
|
|
4906
5449
|
discardConfirm.node,
|
|
4907
5450
|
React.createElement('div', { ref: scrollRef, className: wrap ? 'dsh-rw-code-wrap' : '', onScroll: (e) => keepView({ scrollTop: e.currentTarget.scrollTop, scrollLeft: e.currentTarget.scrollLeft }), style: { flex: 1, overflow: 'auto', minHeight: 0, display: 'flex', flexDirection: 'column', position: 'relative' } },
|
|
4908
5451
|
err ? React.createElement('div', { style: { color: T.danger, padding: '8px 12px', fontSize: 13, flexShrink: 0 } }, err, !edit ? React.createElement('button', { type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, marginLeft: 8 }, onClick: load }, tr('project.retry')) : null) : null,
|
|
4909
|
-
|
|
5452
|
+
localPreview ? React.createElement('div', { 'data-rw-local-copy-preview': '', style: { padding: 12 } },
|
|
5453
|
+
React.createElement('div', { style: { color: T.warn, fontSize: 12, marginBottom: 12 } }, tr('file.localCopySource')),
|
|
5454
|
+
String(localPreview.content || '').length > 300000 || String(localPreview.content || '').split('\n', 10002).length > 10000
|
|
5455
|
+
? React.createElement('pre', { 'data-rw-local-copy-large': '', tabIndex: 0, style: { fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace', fontSize: 13, lineHeight: 1.55, whiteSpace: wrap ? 'pre-wrap' : 'pre', margin: 0, tabSize: 2 } }, localPreview.content || '')
|
|
5456
|
+
: React.createElement(CodeView, { code: localPreview.content || '', path, wrap }))
|
|
5457
|
+
: loading && !data ? React.createElement('div', { style: { opacity: 0.7, padding: 12, fontSize: 13 } }, tr('file.loading'))
|
|
4910
5458
|
: (data && data.binary
|
|
4911
5459
|
? React.createElement('div', { style: { padding: 12, fontSize: 13, color: T.warn } },
|
|
4912
5460
|
tr('file.binary', { size: (data.size != null ? data.size + ' bytes' : tr('file.unknownSize')) }))
|
|
4913
5461
|
: data && data.image
|
|
4914
5462
|
? React.createElement('div', { style: { flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center', padding: 12, minHeight: 0 } },
|
|
4915
5463
|
React.createElement('img', { src: `data:${data.mime};base64,${data.content}`, alt: baseName, style: { maxWidth: '100%', maxHeight: '100%', objectFit: 'contain' } }))
|
|
4916
|
-
: (edit
|
|
4917
|
-
? React.createElement(
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
changeDraft(result.text)
|
|
4929
|
-
setTimeout(() => { node.setSelectionRange(result.start, result.end); updateCursor(node) }, 0)
|
|
4930
|
-
}
|
|
4931
|
-
if ((e.metaKey || e.ctrlKey) && e.key === 's') { e.preventDefault(); if (!e.isComposing && !saving && dirty && !saveConflict) saveRemote() }
|
|
4932
|
-
if (e.key === 'Escape') { e.preventDefault(); e.currentTarget.blur() }
|
|
5464
|
+
: (edit && (!isMarkdown || sourceMode)
|
|
5465
|
+
? React.createElement(HighlightedEditor, {
|
|
5466
|
+
editorRef, path, wrap, indent: indentRemoteDraft, 'aria-label': tr('file.edit') + ' ' + baseName,
|
|
5467
|
+
value: draft, jumpLine: props.jumpLine || null, jumpRevision: props.navigationRevision,
|
|
5468
|
+
matchingLines: findOpen ? matches.map(match => match.line) : [], currentMatchLine: findOpen && activeMatch ? activeMatch.line : null,
|
|
5469
|
+
onSelect: event => updateCursor(event.currentTarget),
|
|
5470
|
+
onChange: event => { changeDraft(event.target.value); updateCursor(event.target) },
|
|
5471
|
+
onScroll: event => keepView({ scrollTop: event.currentTarget.scrollTop, scrollLeft: event.currentTarget.scrollLeft }),
|
|
5472
|
+
onKeyDown: event => {
|
|
5473
|
+
if (event.isComposing || event.nativeEvent?.isComposing) return
|
|
5474
|
+
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 's') { event.preventDefault(); if (!saving && dirty && !saveConflict) saveRemote() }
|
|
5475
|
+
if (event.key === 'Escape') { event.preventDefault(); event.currentTarget.blur() }
|
|
4933
5476
|
},
|
|
4934
|
-
spellCheck: false,
|
|
4935
|
-
style: { width: '100%', height: '100%', flex: 1, boxSizing: 'border-box', border: 'none', outline: 'none', resize: 'none', background: 'transparent', color: T.label, fontSize: 13, lineHeight: 1.55, fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace', padding: '10px 12px', whiteSpace: wrap ? 'pre-wrap' : 'pre', overflowWrap: wrap ? 'anywhere' : 'normal' },
|
|
4936
5477
|
})
|
|
4937
5478
|
: (isMarkdown && !sourceMode && MarkdownText
|
|
4938
5479
|
// Render remote markdown with the host renderer instead of a
|
|
@@ -4946,9 +5487,9 @@ window.__ModuleLoader__.load({
|
|
|
4946
5487
|
fontSize: 13, lineHeight: 1.55, fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace',
|
|
4947
5488
|
whiteSpace: 'pre-wrap', wordBreak: 'break-word', color: T.label,
|
|
4948
5489
|
},
|
|
4949
|
-
}, originalText),
|
|
5490
|
+
}, edit ? draft : originalText),
|
|
4950
5491
|
},
|
|
4951
|
-
React.createElement(MarkdownText, { text: originalText, variant: 'body', labels: markdownLabels })),
|
|
5492
|
+
React.createElement(MarkdownText, { text: edit ? draft : originalText, variant: 'body', labels: markdownLabels })),
|
|
4952
5493
|
(data && data.truncated)
|
|
4953
5494
|
? React.createElement('div', { style: { color: T.warn, fontSize: 12, marginTop: 8 } }, tr('file.truncated'))
|
|
4954
5495
|
: null)
|
|
@@ -4966,7 +5507,8 @@ window.__ModuleLoader__.load({
|
|
|
4966
5507
|
React.createElement('span', {}, edit ? tr('workbench.position', cursor) : tr('workbench.lines', { n: originalText.split('\n').length })),
|
|
4967
5508
|
React.createElement('span', {}, data && data.size != null ? humanSize(data.size) : ''),
|
|
4968
5509
|
React.createElement('span', {}, baseName.includes('.') ? baseName.split('.').pop().toUpperCase() : 'TEXT'),
|
|
4969
|
-
React.createElement('span', {
|
|
5510
|
+
data?.eol ? React.createElement('span', {}, data.eol === 'crlf' ? 'CRLF' : data.eol === 'mixed' ? tr('file.mixedEol') : 'LF') : null,
|
|
5511
|
+
React.createElement('span', { style: { marginLeft: 'auto', color: copyNote ? T.ok : T.muted } }, copyNote || (localPreview ? tr('file.localCopySource') : loading && data ? tr('workbench.refreshing') : edit ? tr('file.editing') : tr('file.readonly')))),
|
|
4970
5512
|
)
|
|
4971
5513
|
}
|
|
4972
5514
|
|
|
@@ -5043,6 +5585,8 @@ window.__ModuleLoader__.load({
|
|
|
5043
5585
|
// paths are local filesystem resources. Each address is session-scoped.
|
|
5044
5586
|
const NATIVE_EXPLORER = 'dsh-remote/explorer'
|
|
5045
5587
|
const NATIVE_FILE = 'dsh-remote/file'
|
|
5588
|
+
const NATIVE_CHANGES = 'dsh-remote/changes'
|
|
5589
|
+
const NATIVE_WELCOME = 'dsh-remote/welcome'
|
|
5046
5590
|
// Issue #55: the address the CORE emits for a file link, which is NOT the
|
|
5047
5591
|
// one this plugin mints for its own explorer. A model-emitted
|
|
5048
5592
|
// `[x](src/main.c)` (or a `@src/main.c` chip) is turned into
|
|
@@ -5165,13 +5709,14 @@ window.__ModuleLoader__.load({
|
|
|
5165
5709
|
expanded,
|
|
5166
5710
|
onToggleDir: (path) => updateExpanded((old) => old.includes(path) ? old.filter((p) => p !== path) : [...old, path]),
|
|
5167
5711
|
onCollapseAll: () => updateExpanded([]),
|
|
5168
|
-
|
|
5712
|
+
onOpenChanges: () => info.tab.actions.openTab(NATIVE_CHANGES),
|
|
5713
|
+
onOpenFile: (path, line) => info.tab.actions.openResource(remoteFileAddress(props.sessionId, path), Number.isSafeInteger(line) && line > 0 ? { params: { line } } : undefined),
|
|
5169
5714
|
})
|
|
5170
5715
|
}
|
|
5171
5716
|
function NativeFile(props) {
|
|
5172
5717
|
const info = props.useTabInfo()
|
|
5173
5718
|
const path = remoteFilePath(info.tab.navigation.address)
|
|
5174
|
-
return React.createElement(RemoteFileTab, { key: path, tab: { path }, scope: { sessionId: props.sessionId }, navigationRevision: info.tab.navigation.revision })
|
|
5719
|
+
return React.createElement(RemoteFileTab, { key: path, tab: { path }, scope: { sessionId: props.sessionId }, visible: info.tab.visible, jumpLine: Number.isSafeInteger(info.tab.navigation.params?.line) && info.tab.navigation.params.line > 0 ? info.tab.navigation.params.line : null, navigationRevision: info.tab.navigation.revision })
|
|
5175
5720
|
}
|
|
5176
5721
|
/**
|
|
5177
5722
|
* The body for a CORE file link in a remote Session (issue #55).
|
|
@@ -5221,7 +5766,7 @@ window.__ModuleLoader__.load({
|
|
|
5221
5766
|
return React.createElement(RemoteFileTab, {
|
|
5222
5767
|
key: remotePath,
|
|
5223
5768
|
tab: { path: remotePath },
|
|
5224
|
-
scope: { sessionId },
|
|
5769
|
+
scope: { sessionId }, visible: info.tab.visible,
|
|
5225
5770
|
// Current hosts pass line numbers as navigation params; retain support
|
|
5226
5771
|
// for older address-carried anchors. Invalid params must not mask them.
|
|
5227
5772
|
jumpLine: (parsed && parsed.line) || paramsLine || null,
|
|
@@ -5350,8 +5895,10 @@ window.__ModuleLoader__.load({
|
|
|
5350
5895
|
try { syncExplorerType() } catch (e) { console.warn('[dsh-remote] start-page card handover skipped:', e) }
|
|
5351
5896
|
}, 'dsh-remote.start-card-owner')
|
|
5352
5897
|
})
|
|
5898
|
+
inner.effect(() => tabs.register({ id: NATIVE_WELCOME, kind: NATIVE_WELCOME, title: () => tr('ide.welcome') }), 'dsh-remote.native-welcome-type')
|
|
5899
|
+
inner.effect(() => tabs.register({ id: NATIVE_CHANGES, kind: NATIVE_CHANGES, title: () => tr('changes.title') }), 'dsh-remote.native-changes-type')
|
|
5353
5900
|
inner.effect(() => tabs.register({
|
|
5354
|
-
id: NATIVE_FILE, kind: NATIVE_FILE,
|
|
5901
|
+
id: NATIVE_FILE, kind: NATIVE_FILE, keepMounted: true,
|
|
5355
5902
|
patterns: ['dsh-resource://dsh-remote/**'],
|
|
5356
5903
|
title: (address) => remoteFilePath(address).split(/[\\/]/).pop() || tr('explorer.tabTitle'),
|
|
5357
5904
|
}), 'dsh-remote.native-file-type')
|
|
@@ -5375,7 +5922,7 @@ window.__ModuleLoader__.load({
|
|
|
5375
5922
|
inner.effect(() => {
|
|
5376
5923
|
try {
|
|
5377
5924
|
const dispose = tabs.register({
|
|
5378
|
-
id: NATIVE_LINK, kind: NATIVE_LINK,
|
|
5925
|
+
id: NATIVE_LINK, kind: NATIVE_LINK, keepMounted: true,
|
|
5379
5926
|
// Specificity beats bundle order: the registry ranks longest-glob-first,
|
|
5380
5927
|
// and ties fall to registration order (which we do not control). Another
|
|
5381
5928
|
// extension claiming `dsh-resource://file/**` used to win those ties and
|
|
@@ -5422,6 +5969,8 @@ window.__ModuleLoader__.load({
|
|
|
5422
5969
|
const disposers = [
|
|
5423
5970
|
slots.register({ name: 'sidebar.right.pane.tab', key: NATIVE_EXPLORER }, NativeExplorer),
|
|
5424
5971
|
slots.register({ name: 'sidebar.right.pane.tab', key: NATIVE_FILE }, NativeFile),
|
|
5972
|
+
slots.register({ name: 'sidebar.right.pane.tab', key: NATIVE_CHANGES }, NativeChanges),
|
|
5973
|
+
slots.register({ name: 'sidebar.right.pane.tab', key: NATIVE_WELCOME }, RemoteIdeWelcome),
|
|
5425
5974
|
]
|
|
5426
5975
|
// Only register the link body when its type was accepted: a body under a
|
|
5427
5976
|
// kind nothing claims would never render, and on a build that rejected
|
|
@@ -5434,6 +5983,183 @@ window.__ModuleLoader__.load({
|
|
|
5434
5983
|
}
|
|
5435
5984
|
|
|
5436
5985
|
|
|
5986
|
+
// Native read-only Git workbench. Its requests and file navigation always
|
|
5987
|
+
// carry the tab's session identity, including after a late response.
|
|
5988
|
+
const gitViewMemory = new Map()
|
|
5989
|
+
const gitFilesForMode = (files, staged) => (files || []).filter(file => staged
|
|
5990
|
+
? file.indexStatus !== ' ' && file.indexStatus !== '?' && file.indexStatus !== '!'
|
|
5991
|
+
: file.untracked || file.worktreeStatus !== ' ' && file.worktreeStatus !== '!')
|
|
5992
|
+
|
|
5993
|
+
function NativeChanges(props) {
|
|
5994
|
+
const info = props.useTabInfo()
|
|
5995
|
+
return React.createElement(RemoteGitTab, {
|
|
5996
|
+
key: props.sessionId, sessionId: props.sessionId, visible: info.tab.visible,
|
|
5997
|
+
openFile: (path, line) => info.tab.actions.openResource(remoteFileAddress(props.sessionId, path), line ? { params: { line } } : undefined),
|
|
5998
|
+
})
|
|
5999
|
+
}
|
|
6000
|
+
|
|
6001
|
+
function RemoteGitTab(props) {
|
|
6002
|
+
const key = String(props.sessionId || '')
|
|
6003
|
+
const initial = gitViewMemory.get(key)
|
|
6004
|
+
const [git, setGit] = React.useState({ key, data: null, error: '', busy: false, revision: 0 })
|
|
6005
|
+
const [selected, setSelected] = React.useState(initial?.selected || '')
|
|
6006
|
+
const [staged, setStaged] = React.useState(initial?.staged || false)
|
|
6007
|
+
const [filter, setFilter] = React.useState('')
|
|
6008
|
+
const [diff, setDiff] = React.useState(null)
|
|
6009
|
+
const identity = React.useRef(key)
|
|
6010
|
+
identity.current = key
|
|
6011
|
+
const statusRequest = React.useRef({ sequence: 0, controller: null, pending: false })
|
|
6012
|
+
const diffRequest = React.useRef({ sequence: 0, controller: null })
|
|
6013
|
+
const alive = React.useRef(true)
|
|
6014
|
+
const data = git.key === key ? git.data : null
|
|
6015
|
+
const files = gitFilesForMode(data?.files, staged)
|
|
6016
|
+
const chosen = files.find(file => file.path === selected) || null
|
|
6017
|
+
const selectionKey = key + '\0' + (data?.repo || '') + '\0' + (staged ? 'staged' : 'working') + '\0' + selected
|
|
6018
|
+
const currentDiff = diff?.key === selectionKey ? diff : null
|
|
6019
|
+
const inputRef = React.useRef(null)
|
|
6020
|
+
React.useEffect(() => {
|
|
6021
|
+
alive.current = true
|
|
6022
|
+
return () => { alive.current = false; statusRequest.current.controller?.abort(); diffRequest.current.controller?.abort() }
|
|
6023
|
+
}, [])
|
|
6024
|
+
React.useEffect(() => {
|
|
6025
|
+
gitViewMemory.set(key, { selected, staged })
|
|
6026
|
+
while (gitViewMemory.size > 64) gitViewMemory.delete(gitViewMemory.keys().next().value)
|
|
6027
|
+
}, [key, selected, staged])
|
|
6028
|
+
const refresh = React.useCallback(async () => {
|
|
6029
|
+
if (!key || statusRequest.current.pending) return
|
|
6030
|
+
const request = statusRequest.current
|
|
6031
|
+
request.controller?.abort()
|
|
6032
|
+
const controller = new AbortController(), ticket = ++request.sequence
|
|
6033
|
+
request.controller = controller; request.pending = true
|
|
6034
|
+
const current = () => alive.current && identity.current === key && request.sequence === ticket && !controller.signal.aborted
|
|
6035
|
+
setGit(old => ({ key, data: old.key === key ? old.data : null, error: '', busy: true, revision: old.revision }))
|
|
6036
|
+
try {
|
|
6037
|
+
const result = await api('GET', withSessionQuery('/dsh-remote/git?action=status', key), undefined, controller.signal)
|
|
6038
|
+
if (!current()) return
|
|
6039
|
+
if (!result?.ok) throw new Error(result?.error || tr('changes.failed'))
|
|
6040
|
+
setGit(old => ({ key, data: result, error: '', busy: false, revision: old.revision + 1 }))
|
|
6041
|
+
} catch (error) {
|
|
6042
|
+
if (current()) setGit(old => ({ ...old, key, busy: false, error: String(error?.message || error) }))
|
|
6043
|
+
} finally { if (request.sequence === ticket) request.pending = false }
|
|
6044
|
+
}, [key])
|
|
6045
|
+
React.useEffect(() => {
|
|
6046
|
+
// In a normal host the keyed wrapper remounts on session changes. Keep
|
|
6047
|
+
// the independent guard for embeddings that reuse this component.
|
|
6048
|
+
statusRequest.current.controller?.abort(); statusRequest.current.pending = false
|
|
6049
|
+
const saved = gitViewMemory.get(key)
|
|
6050
|
+
setSelected(saved?.selected || ''); setStaged(saved?.staged || false); setFilter(''); setDiff(null)
|
|
6051
|
+
void refresh()
|
|
6052
|
+
return () => { statusRequest.current.sequence++; statusRequest.current.controller?.abort(); statusRequest.current.pending = false }
|
|
6053
|
+
}, [key])
|
|
6054
|
+
React.useEffect(() => {
|
|
6055
|
+
if (props.visible === false) return
|
|
6056
|
+
const timer = setInterval(() => { void refresh() }, 15000)
|
|
6057
|
+
const focus = () => { void refresh() }
|
|
6058
|
+
if (typeof window !== 'undefined') window.addEventListener?.('focus', focus)
|
|
6059
|
+
return () => { clearInterval(timer); if (typeof window !== 'undefined') window.removeEventListener?.('focus', focus) }
|
|
6060
|
+
}, [key, props.visible])
|
|
6061
|
+
React.useEffect(() => {
|
|
6062
|
+
if (!data?.available) { setSelected(''); return }
|
|
6063
|
+
if (files.some(file => file.path === selected)) return
|
|
6064
|
+
setSelected(files[0]?.path || '')
|
|
6065
|
+
}, [data, staged, selected])
|
|
6066
|
+
React.useEffect(() => {
|
|
6067
|
+
const request = diffRequest.current, controller = new AbortController(), ticket = ++request.sequence
|
|
6068
|
+
request.controller?.abort(); request.controller = controller
|
|
6069
|
+
if (!chosen || !data?.available) { setDiff(null); return () => controller.abort() }
|
|
6070
|
+
const current = () => alive.current && identity.current === key && ticket === request.sequence && !controller.signal.aborted
|
|
6071
|
+
setDiff({ key: selectionKey, busy: true, data: null, error: '' })
|
|
6072
|
+
api('GET', withSessionQuery('/dsh-remote/git?action=diff&path=' + encodeURIComponent(chosen.path) + '&staged=' + (staged ? '1' : '0'), key), undefined, controller.signal)
|
|
6073
|
+
.then(result => {
|
|
6074
|
+
if (!current()) return
|
|
6075
|
+
if (!result?.ok) throw new Error(result?.error || tr('changes.failed'))
|
|
6076
|
+
if (result.available === false) throw new Error(result.reason === 'not-repository' ? tr('changes.noRepository') : result.reason === 'git-unavailable' ? tr('changes.noGit') : tr('changes.unavailable'))
|
|
6077
|
+
setDiff({ key: selectionKey, busy: false, data: result, error: '' })
|
|
6078
|
+
})
|
|
6079
|
+
.catch(error => { if (current()) setDiff({ key: selectionKey, busy: false, data: null, error: String(error?.message || error) }) })
|
|
6080
|
+
return () => controller.abort()
|
|
6081
|
+
}, [key, selectionKey, git.revision])
|
|
6082
|
+
const openFile = (line) => {
|
|
6083
|
+
if (!alive.current || identity.current !== key || !chosen || chosen.deleted || typeof props.openFile !== 'function') return
|
|
6084
|
+
props.openFile(chosen.absolutePath, line)
|
|
6085
|
+
}
|
|
6086
|
+
const missingReason = data?.reason === 'git-unavailable' ? tr('changes.noGit')
|
|
6087
|
+
: data?.reason === 'not-repository' ? tr('changes.noRepository')
|
|
6088
|
+
: data?.reason === 'unsupported-shell' ? tr('changes.unsupportedShell') : tr('changes.unavailable')
|
|
6089
|
+
const previewReason = currentDiff?.data?.reason === 'binary' ? tr('changes.binary')
|
|
6090
|
+
: currentDiff?.data?.reason === 'symlink' ? tr('changes.symlink')
|
|
6091
|
+
: currentDiff?.data?.reason === 'too-large' ? tr('changes.large')
|
|
6092
|
+
: currentDiff?.data?.empty ? tr('changes.emptyFile') : tr('changes.noDiff')
|
|
6093
|
+
const visibleFiles = files.filter(file => file.path.toLocaleLowerCase().includes(filter.trim().toLocaleLowerCase()))
|
|
6094
|
+
const patch = currentDiff?.data?.patch || ''
|
|
6095
|
+
const patchLines = patch.split('\n')
|
|
6096
|
+
if (patchLines[patchLines.length - 1] === '') patchLines.pop()
|
|
6097
|
+
let nextLine = null
|
|
6098
|
+
const rows = patchLines.slice(0, 1800).map((text, index) => {
|
|
6099
|
+
const hunk = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(text)
|
|
6100
|
+
let line = null, kind = 'meta'
|
|
6101
|
+
if (hunk) { nextLine = Number(hunk[1]); kind = 'hunk' }
|
|
6102
|
+
else if (nextLine !== null && !/^--- |^\+\+\+ /.test(text)) {
|
|
6103
|
+
if (text[0] === '+') { line = nextLine++; kind = 'added' }
|
|
6104
|
+
else if (text[0] === ' ') { line = nextLine++; kind = 'context' }
|
|
6105
|
+
else if (text[0] === '-') kind = 'removed'
|
|
6106
|
+
}
|
|
6107
|
+
const canOpen = !!line && line > 0 && !chosen?.deleted && typeof props.openFile === 'function'
|
|
6108
|
+
return React.createElement('div', { key: index, className: 'dsh-rw-git-diff-line', 'data-rw-diff-kind': kind },
|
|
6109
|
+
canOpen ? React.createElement('button', { type: 'button', className: 'dsh-rw-git-line-number', 'data-rw-diff-line': line, title: tr('changes.openLine', { line }), 'aria-label': tr('changes.openLine', { line }), onClick: () => openFile(line) }, line)
|
|
6110
|
+
: React.createElement('span', { className: 'dsh-rw-git-line-number', 'aria-hidden': true }, ''),
|
|
6111
|
+
React.createElement('span', {}, text || ' '))
|
|
6112
|
+
})
|
|
6113
|
+
const workingCount = gitFilesForMode(data?.files, false).length, stagedCount = gitFilesForMode(data?.files, true).length
|
|
6114
|
+
const switchMode = value => { if (staged === value) return; setStaged(value); setDiff(null) }
|
|
6115
|
+
return React.createElement('section', { className: 'dsh-rw-git', 'data-rw-git': true, 'aria-label': tr('changes.title') },
|
|
6116
|
+
React.createElement('header', { className: 'dsh-rw-git-header' },
|
|
6117
|
+
React.createElement('div', { className: 'dsh-rw-git-title' },
|
|
6118
|
+
React.createElement(WorkbenchIcon, { name: 'branch' }), React.createElement('strong', {}, tr('changes.title')),
|
|
6119
|
+
React.createElement(WorkbenchAction, { icon: 'refresh', label: tr('explorer.refresh'), disabled: git.busy, onClick: refresh })),
|
|
6120
|
+
data?.available ? React.createElement('div', { className: 'dsh-rw-git-repo', title: data.repo }, data.detached ? tr('changes.detached') : data.branch, ' · ', data.workspace) : null,
|
|
6121
|
+
React.createElement('div', { className: 'dsh-rw-git-hint' }, tr('changes.readOnly')),
|
|
6122
|
+
data?.available ? React.createElement('div', { className: 'dsh-rw-git-mode' },
|
|
6123
|
+
[false,true].map(value => React.createElement('button', { key: String(value), type: 'button', className: 'dsh-rw-btn', style: { ...buttonS, padding: '5px 10px', fontSize: 12, borderRadius: 6 }, 'aria-pressed': staged === value, onClick: () => switchMode(value) },
|
|
6124
|
+
tr(value ? 'changes.staged' : 'changes.working'), ' · ', value ? stagedCount : workingCount))) : null,
|
|
6125
|
+
data?.available && data.files?.length ? React.createElement('input', { ref: inputRef, type: 'search', className: 'dsh-rw-input', style: { ...inputS, width: '100%', fontSize: 12, boxSizing: 'border-box' }, 'aria-label': tr('changes.filter'), placeholder: tr('changes.filter'), value: filter, onChange: e => setFilter(e.target.value), onKeyDown: e => { if (e.key === 'Escape' && !e.isComposing) { e.stopPropagation(); setFilter('') } } }) : null),
|
|
6126
|
+
git.busy ? React.createElement('div', { role: 'status', className: 'dsh-rw-git-message' }, data ? tr('changes.refreshing') : tr('changes.loading')) : null,
|
|
6127
|
+
git.error ? React.createElement('div', { role: 'alert', className: 'dsh-rw-git-message', style: { color: T.danger } }, git.error,
|
|
6128
|
+
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', onClick: refresh, disabled: git.busy }, tr('project.retry')),
|
|
6129
|
+
data ? React.createElement('div', {}, tr('changes.stale')) : null) : null,
|
|
6130
|
+
data && !data.available ? React.createElement('div', { role: 'status', className: 'dsh-rw-git-message' }, missingReason) : null,
|
|
6131
|
+
data?.truncated ? React.createElement('div', { role: 'status', className: 'dsh-rw-git-message', style: { color: T.warn } }, tr('changes.partial')) : null,
|
|
6132
|
+
data?.available && !data.files.length ? React.createElement('div', { role: 'status', className: 'dsh-rw-git-message' }, tr('changes.clean')) : null,
|
|
6133
|
+
data?.available && data.files.length ? React.createElement(React.Fragment, {},
|
|
6134
|
+
React.createElement('div', { className: 'dsh-rw-git-files', role: 'listbox', 'aria-label': staged ? tr('changes.staged') : tr('changes.working'), onKeyDown: e => {
|
|
6135
|
+
if (e.isComposing || e.ctrlKey || e.altKey || e.metaKey || !['ArrowDown','ArrowUp','Home','End'].includes(e.key)) return
|
|
6136
|
+
const options = Array.from(e.currentTarget.querySelectorAll('[data-rw-git-file]'))
|
|
6137
|
+
const at = options.indexOf(e.target.closest('[data-rw-git-file]'))
|
|
6138
|
+
if (at < 0) return
|
|
6139
|
+
e.preventDefault()
|
|
6140
|
+
const next = e.key === 'Home' ? 0 : e.key === 'End' ? options.length - 1 : Math.max(0, Math.min(options.length - 1, at + (e.key === 'ArrowDown' ? 1 : -1)))
|
|
6141
|
+
options[next]?.focus(); options[next]?.click()
|
|
6142
|
+
} },
|
|
6143
|
+
visibleFiles.length ? visibleFiles.map((file, index) => React.createElement('button', { key: file.path, role: 'option', type: 'button', className: 'dsh-rw-git-file', 'aria-selected': selected === file.path, tabIndex: selected === file.path || index === 0 && !visibleFiles.some(value => value.path === selected) ? 0 : -1,
|
|
6144
|
+
'data-rw-git-file': file.path, 'data-rw-git-stage': staged ? 'staged' : 'working', title: file.previousPath ? file.previousPath + ' → ' + file.path : file.path, onClick: () => setSelected(file.path) },
|
|
6145
|
+
React.createElement(WorkbenchIcon, { name: 'file' }), React.createElement('span', { className: 'dsh-rw-git-file-path' }, file.path),
|
|
6146
|
+
React.createElement('span', { className: 'dsh-rw-git-status', style: { color: file.conflict ? T.danger : file.untracked ? T.ok : T.muted } },
|
|
6147
|
+
file.conflict ? tr('changes.conflict') : file.untracked ? tr('changes.untracked') : (staged ? file.indexStatus : file.worktreeStatus))))
|
|
6148
|
+
: React.createElement('div', { role: 'status', className: 'dsh-rw-git-message' }, filter.trim() ? tr('changes.noMatch') : tr('changes.emptyGroup'))),
|
|
6149
|
+
chosen ? React.createElement('div', { className: 'dsh-rw-git-preview' },
|
|
6150
|
+
React.createElement('div', { className: 'dsh-rw-git-preview-title' },
|
|
6151
|
+
React.createElement('strong', { title: chosen.path }, chosen.path),
|
|
6152
|
+
React.createElement(WorkbenchAction, { icon: 'file', label: tr('changes.openFile'), disabled: chosen.deleted || typeof props.openFile !== 'function', onClick: () => openFile() })),
|
|
6153
|
+
React.createElement('div', { className: 'dsh-rw-git-hint' }, staged ? tr('changes.stagedDiff') : tr('changes.workingDiff')),
|
|
6154
|
+
!currentDiff || currentDiff.busy ? React.createElement('div', { role: 'status', className: 'dsh-rw-git-message' }, tr('changes.loadingDiff'))
|
|
6155
|
+
: currentDiff.error ? React.createElement('div', { role: 'alert', className: 'dsh-rw-git-message', style: { color: T.danger } }, currentDiff.error,
|
|
6156
|
+
React.createElement('button', { type: 'button', className: 'dsh-rw-btn', onClick: refresh, disabled: git.busy }, tr('project.retry')))
|
|
6157
|
+
: patch ? React.createElement('div', { className: 'dsh-rw-git-diff', role: 'region', 'aria-label': tr('changes.diff'), tabIndex: 0 }, rows)
|
|
6158
|
+
: React.createElement('div', { role: 'status', className: 'dsh-rw-git-message' }, previewReason),
|
|
6159
|
+
currentDiff?.data?.truncated || patchLines.length > 1800 ? React.createElement('div', { role: 'status', className: 'dsh-rw-git-message', style: { color: T.warn } }, tr('changes.partialDiff')) : null)
|
|
6160
|
+
: React.createElement('div', { className: 'dsh-rw-git-message' }, tr('changes.chooseFile'))) : null)
|
|
6161
|
+
}
|
|
6162
|
+
|
|
5437
6163
|
// Native Tool views are keyed by wire name; older hosts simply omit this seat.
|
|
5438
6164
|
const REMOTE_TOOL_TITLES = {
|
|
5439
6165
|
rw_exec: 'exec', rw_read_file: 'read', rw_edit: 'edit', rw_write_file: 'write', rw_append: 'write',
|
|
@@ -5471,8 +6197,36 @@ window.__ModuleLoader__.load({
|
|
|
5471
6197
|
if (!seen.has(key)) { seen.add(key); diagnostics.push(item) }
|
|
5472
6198
|
if (diagnostics.length >= 200) break
|
|
5473
6199
|
}
|
|
5474
|
-
|
|
6200
|
+
const change = done && !block.isError ? appliedChangeMeta(block.meta) : null
|
|
6201
|
+
return { args, output, status, code, facts, diagnostics, change }
|
|
5475
6202
|
}
|
|
6203
|
+
function appliedChangeMeta(meta) {
|
|
6204
|
+
if (!meta || meta.kind !== 'dsh-remote.change' || meta.version !== 1 || meta.applied !== true || typeof meta.path !== 'string' || !Array.isArray(meta.diffs)) return null
|
|
6205
|
+
if (meta.diffs.length > 30 || !meta.diffs.every(diff => diff && typeof diff.path === 'string' && (diff.oldText === null || typeof diff.oldText === 'string') && typeof diff.newText === 'string')) return null
|
|
6206
|
+
return meta
|
|
6207
|
+
}
|
|
6208
|
+
function AppliedChangeView({ change }) {
|
|
6209
|
+
const labels = {
|
|
6210
|
+
codeLabel: tr('file.markdown.code'), wrapLabel: tr('file.markdown.wrap'), unwrapLabel: tr('file.markdown.unwrap'),
|
|
6211
|
+
copy: tr('file.markdown.copy'), copied: tr('file.markdown.copied'), collapseAria: tr('change.collapse'), collapse: tr('change.collapse'),
|
|
6212
|
+
expandAria: count => tr('change.expand', { n: count }), expand: count => tr('change.expand', { n: count }),
|
|
6213
|
+
}
|
|
6214
|
+
return React.createElement('div', { className: 'dsh-rw-applied-change', 'data-rw-applied-change': true, 'data-rw-change-path': change.path },
|
|
6215
|
+
React.createElement('div', { className: 'dsh-rw-change-heading' },
|
|
6216
|
+
React.createElement('strong', {}, tr(change.unchanged ? 'change.unchanged' : 'change.applied')),
|
|
6217
|
+
change.diffs.length ? React.createElement('span', { style: { marginLeft: 'auto', fontFamily: 'monospace', whiteSpace: 'nowrap' } },
|
|
6218
|
+
React.createElement('span', { style: { color: T.ok } }, '+' + (change.additions || 0)), ' ', React.createElement('span', { style: { color: T.danger } }, '−' + (change.deletions || 0))) : null),
|
|
6219
|
+
change.diffs.length ? NativeDiffBlock
|
|
6220
|
+
? React.createElement(NativeDiffBlock, { diffs: change.diffs, labels, maxLines: 12 })
|
|
6221
|
+
: React.createElement('div', {}, change.diffs.map((diff, index) => React.createElement('details', { key: index, open: index === 0, className: 'dsh-rw-change-hunk' },
|
|
6222
|
+
React.createElement('summary', {}, tr('change.hunk', { n: index + 1 })),
|
|
6223
|
+
React.createElement('div', { style: { color: T.muted, padding: '3px 10px', fontSize: 11 } }, tr('agent.before')),
|
|
6224
|
+
React.createElement('pre', { className: 'dsh-rw-agent-output', style: { color: T.danger, background: 'rgba(239,68,68,.06)' } }, diff.oldText ?? ''),
|
|
6225
|
+
React.createElement('div', { style: { color: T.muted, padding: '3px 10px', fontSize: 11 } }, tr('agent.after')),
|
|
6226
|
+
React.createElement('pre', { className: 'dsh-rw-agent-output', style: { color: T.ok, background: 'rgba(34,197,94,.06)' } }, diff.newText)))) : null,
|
|
6227
|
+
change.truncated ? React.createElement('div', { role: 'status', style: { padding: '7px 10px', color: T.muted, fontSize: 11, lineHeight: 1.6 } }, tr(change.reason === 'binary' ? 'change.binary' : change.reason === 'baseline-unavailable' ? 'change.noBaseline' : 'change.truncated')) : null)
|
|
6228
|
+
}
|
|
6229
|
+
|
|
5476
6230
|
function RemoteToolCard(props) {
|
|
5477
6231
|
const view = remoteToolView(props)
|
|
5478
6232
|
const failed = view.status === 'failed' || view.status === 'timeout'
|
|
@@ -5481,14 +6235,14 @@ window.__ModuleLoader__.load({
|
|
|
5481
6235
|
const [localOpen, setLocalOpen] = React.useState(attention)
|
|
5482
6236
|
const disclosure = props.useDisclosure ? props.useDisclosure() : null
|
|
5483
6237
|
const [touched, setTouched] = React.useState(false)
|
|
5484
|
-
const open = attention && !touched || (disclosure ? disclosure.expanded : localOpen)
|
|
6238
|
+
const open = (attention || !!view.change?.diffs.length) && !touched || (disclosure ? disclosure.expanded : localOpen)
|
|
5485
6239
|
const setOpen = disclosure ? disclosure.setExpanded : setLocalOpen
|
|
5486
6240
|
|
|
5487
6241
|
const [copied, setCopied] = React.useState(false)
|
|
5488
6242
|
const copyTimer = React.useRef(null)
|
|
5489
6243
|
React.useEffect(() => () => { if (copyTimer.current) clearTimeout(copyTimer.current) }, [])
|
|
5490
6244
|
const title = tr(`agent.${REMOTE_TOOL_TITLES[props.toolName] || 'other'}`)
|
|
5491
|
-
const filePath = view.args.path || view.args.file_path || ''
|
|
6245
|
+
const filePath = view.change?.path || view.args.path || view.args.file_path || ''
|
|
5492
6246
|
const summary = props.toolName === 'rw_exec' ? view.args.command || '' : filePath || view.args.query || ''
|
|
5493
6247
|
const color = attention ? T.danger : view.status === 'completed' ? T.ok : ['stopped', 'unknown', 'timeout'].includes(view.status) ? T.warn : T.muted
|
|
5494
6248
|
const bodyId = React.useId()
|
|
@@ -5527,7 +6281,9 @@ window.__ModuleLoader__.load({
|
|
|
5527
6281
|
view.diagnostics.length ? React.createElement('div', { style: { padding: '6px 12px', borderTop: '1px solid ' + T.border } },
|
|
5528
6282
|
React.createElement('strong', { style: { fontSize: 12 } }, tr('agent.diagnostics') + ' · ' + view.diagnostics.length),
|
|
5529
6283
|
view.diagnostics.map((item, index) => React.createElement('button', { key: index, type: 'button', className: 'dsh-rw-agent-diagnostic', disabled: !props.openFile, 'aria-label': tr('agent.open', item), onClick: () => openPath(item.path, item.line), style: { color: /error/.test(item.severity) ? T.danger : T.warn } }, item.path + ':' + item.line + ':' + item.column + ' · ' + item.message))) : null,
|
|
5530
|
-
|
|
6284
|
+
view.change ? React.createElement(AppliedChangeView, { change: view.change }) : null,
|
|
6285
|
+
!view.change && view.status === 'completed' && props.toolName === 'rw_edit' && typeof (view.args.old ?? view.args.old_string) === 'string' ? React.createElement('div', { style: { borderTop: '1px solid ' + T.border, fontSize: 11 } },
|
|
6286
|
+
React.createElement('div', { style: { padding: '5px 12px', color: T.muted } }, tr('change.legacy')),
|
|
5531
6287
|
React.createElement('div', { style: { padding: '4px 12px', color: T.muted } }, tr('agent.before')),
|
|
5532
6288
|
React.createElement('pre', { className: 'dsh-rw-agent-output', style: { color: T.danger } }, String(view.args.old ?? view.args.old_string).slice(0, 20000)),
|
|
5533
6289
|
React.createElement('div', { style: { padding: '4px 12px', color: T.muted } }, tr('agent.after')),
|
|
@@ -5538,6 +6294,317 @@ window.__ModuleLoader__.load({
|
|
|
5538
6294
|
)
|
|
5539
6295
|
}
|
|
5540
6296
|
|
|
6297
|
+
// Optional IDE shell. DOM stays owned by the host React roots: only public
|
|
6298
|
+
// session markers and reversible geometry attributes are used for docking.
|
|
6299
|
+
// Design reference: MIT dsh-gufa-code (Jeff nan); no host sources patched.
|
|
6300
|
+
const REMOTE_IDE_KEY = 'dsh-remote.ide-layout.v1'
|
|
6301
|
+
const remoteIdeWatchers = new Set()
|
|
6302
|
+
let remoteIdeController = null
|
|
6303
|
+
function remoteIdeRead() {
|
|
6304
|
+
try {
|
|
6305
|
+
const value = JSON.parse(window.localStorage.getItem(REMOTE_IDE_KEY) || '{}')
|
|
6306
|
+
return { enabled: value.enabled === true, left: Number(value.left) || 240, right: Number(value.right) || 400 }
|
|
6307
|
+
} catch { return { enabled: false, left: 240, right: 400 } }
|
|
6308
|
+
}
|
|
6309
|
+
let remoteIdeState = remoteIdeRead()
|
|
6310
|
+
function remoteIdeSet(change) {
|
|
6311
|
+
remoteIdeState = { ...remoteIdeState, ...change }
|
|
6312
|
+
try { window.localStorage.setItem(REMOTE_IDE_KEY, JSON.stringify(remoteIdeState)) } catch { /* private browsing */ }
|
|
6313
|
+
for (const fn of remoteIdeWatchers) fn()
|
|
6314
|
+
}
|
|
6315
|
+
function remoteIdeWidths(width, preferred) {
|
|
6316
|
+
// Width preferences are never overwritten by a temporary small viewport.
|
|
6317
|
+
const available = Math.max(0, Number(width) || 0)
|
|
6318
|
+
const left = Math.max(180, Math.min(380, Number(preferred.left) || 240, available - 320 - 280 - 12))
|
|
6319
|
+
const right = Math.max(280, Math.min(700, Number(preferred.right) || 400, available - left - 320 - 12))
|
|
6320
|
+
return { left, right, narrow: available < 960 }
|
|
6321
|
+
}
|
|
6322
|
+
function useRemoteIdeState() {
|
|
6323
|
+
const [state, setState] = React.useState(remoteIdeState)
|
|
6324
|
+
React.useEffect(() => {
|
|
6325
|
+
const update = () => setState(remoteIdeState)
|
|
6326
|
+
remoteIdeWatchers.add(update); update()
|
|
6327
|
+
return () => remoteIdeWatchers.delete(update)
|
|
6328
|
+
}, [])
|
|
6329
|
+
return state
|
|
6330
|
+
}
|
|
6331
|
+
function RemoteIdeToggle(props) {
|
|
6332
|
+
const mirror = useSessionMirror(props.sessionId, props.useSessions)
|
|
6333
|
+
const state = useRemoteIdeState()
|
|
6334
|
+
if (!mirror) return null
|
|
6335
|
+
const supported = !!remoteIdeController?.mounted?.getSnapshot && typeof remoteIdeController.openResourceIn === 'function'
|
|
6336
|
+
return React.createElement('button', {
|
|
6337
|
+
type: 'button', 'data-rw-ide-toggle': '', 'aria-pressed': state.enabled,
|
|
6338
|
+
disabled: !supported, title: tr(supported ? 'ide.help' : 'ide.unsupported'),
|
|
6339
|
+
onClick: () => remoteIdeSet({ enabled: !state.enabled }),
|
|
6340
|
+
style: { ...buttonS, padding: '3px 7px', fontSize: 11, whiteSpace: 'nowrap', display: 'inline-flex', alignItems: 'center', gap: 5 },
|
|
6341
|
+
}, React.createElement('svg', { width: 14, height: 14, viewBox: '0 0 20 20', fill: 'none', stroke: 'currentColor', 'aria-hidden': true },
|
|
6342
|
+
React.createElement('rect', { x: 2, y: 3, width: 16, height: 14, rx: 2 }),
|
|
6343
|
+
React.createElement('path', { d: 'M6 3v14M13 3v14' })), tr('ide.enter'))
|
|
6344
|
+
}
|
|
6345
|
+
const REMOTE_IDE_CSS = `
|
|
6346
|
+
[data-rw-ide-shell]{position:fixed;inset:var(--dsh-windows-titlebar-height,0px) 0 0;z-index:24;background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-primary,#222);display:flex;flex-direction:column;min-width:0;min-height:0;font-size:12px}
|
|
6347
|
+
[data-rw-ide-header]{height:38px;min-height:38px;display:flex;align-items:center;gap:10px;padding:0 12px;border-bottom:1px solid var(--dsw-alias-border-l2,#ddd);background:var(--dsw-specific-sidebar-fill,var(--dsw-alias-bg-base,#fff))}
|
|
6348
|
+
[data-rw-ide-title]{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1}
|
|
6349
|
+
[data-rw-ide-body]{flex:1;min-height:0;min-width:0;display:grid}
|
|
6350
|
+
[data-rw-ide-tree]{min-width:0;min-height:0;overflow:hidden;display:flex;flex-direction:column;border-right:1px solid var(--dsw-alias-border-l2,#ddd)}
|
|
6351
|
+
[data-rw-ide-tree]>div{flex:1;min-height:0}
|
|
6352
|
+
[data-rw-ide-tree] [data-rw-explorer-toolbar]{flex-wrap:wrap}
|
|
6353
|
+
[data-rw-ide-tree] [data-rw-explorer-title]{flex-basis:100%!important}
|
|
6354
|
+
[data-rw-ide-seat]{min-width:0;min-height:0;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden}
|
|
6355
|
+
[data-rw-ide-placeholder]{max-width:320px;padding:24px;line-height:1.7;text-align:center;color:var(--dsw-alias-label-tertiary,#777)}
|
|
6356
|
+
[data-rw-ide-divider]{width:6px;cursor:col-resize;touch-action:none;position:relative;outline:none;z-index:1;background:var(--dsw-alias-bg-base,#fff)}
|
|
6357
|
+
[data-rw-ide-divider]:hover,[data-rw-ide-divider]:focus-visible{background:var(--dsw-static-blue-500,#3b82f6)}
|
|
6358
|
+
[data-rw-ide-editor],[data-rw-ide-chat]{position:fixed!important;top:var(--rw-ide-y)!important;left:var(--rw-ide-x)!important;right:auto!important;bottom:auto!important;width:var(--rw-ide-w)!important;height:var(--rw-ide-h)!important;max-width:none!important;max-height:none!important;margin:0!important;z-index:36!important;box-sizing:border-box!important;background:var(--dsw-alias-bg-base,#fff);border-radius:0!important;overflow:hidden!important;transition:none!important}
|
|
6359
|
+
[data-rw-ide-editor]{--dsh-sidebar-width:var(--rw-ide-w)!important;border-right:1px solid var(--dsw-alias-border-l2,#ddd)}
|
|
6360
|
+
[data-rw-ide-editor] [data-sidebar-right-mode],[data-rw-ide-editor] [data-sidebar-right-toggle]{display:none!important}
|
|
6361
|
+
[data-rw-ide-chat]{--dsh-chat-user-width:calc(var(--rw-ide-w) - 48px)!important;--dsh-conversation-column-width:var(--rw-ide-w)!important;border-left:1px solid var(--dsw-alias-border-l2,#ddd)}
|
|
6362
|
+
[data-rw-ide-chat] [data-conversation-content]{--dsh-chat-content-width:calc(var(--rw-ide-w) - 48px)!important;--dsh-composer-card-max-width:calc(var(--rw-ide-w) - 16px)!important}
|
|
6363
|
+
[data-rw-ide-chat] [data-conversation-header-leading]{display:none!important}
|
|
6364
|
+
[data-rw-ide-editor][data-rw-ide-hidden],[data-rw-ide-chat][data-rw-ide-hidden]{visibility:hidden!important;pointer-events:none!important}
|
|
6365
|
+
[data-rw-ide-navigation]{display:flex;gap:3px}
|
|
6366
|
+
[data-rw-ide-navigation] button[aria-pressed=true]{background:var(--dsw-alias-interactive-bg-hover,#eee);font-weight:600}
|
|
6367
|
+
@media(max-width:600px){[data-rw-ide-header]{gap:5px;padding:0 6px}[data-rw-ide-title]{display:none}[data-rw-ide-header] button{font-size:11px!important;padding:4px 6px!important}}
|
|
6368
|
+
/* Reversible IDE-only header adapter for DSH 0.2.1/0.2.2.
|
|
6369
|
+
* Uses published slot/DOM markers rather than compiled class names.
|
|
6370
|
+
* Removing data-rw-ide-chat restores all native host styles automatically. */
|
|
6371
|
+
[data-rw-ide-chat] header[data-window-drag]{display:flex!important;flex-direction:column!important;flex:none!important;gap:0!important;min-height:0!important;height:auto!important;padding:10px 12px 0!important;box-sizing:border-box!important;overflow:visible!important}
|
|
6372
|
+
[data-rw-ide-chat] header[data-window-drag] div:has(>[data-conversation-header-corner]){display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;grid-template-rows:auto auto!important;align-items:start!important;gap:6px 4px!important;min-width:0!important;width:100%!important;padding:0!important;min-height:0!important;container-type:normal!important}
|
|
6373
|
+
[data-rw-ide-chat] header[data-window-drag] div:has(>nav){display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:5px!important;grid-column:1!important;grid-row:1!important;min-width:0!important;max-width:100%!important;margin:0!important;padding:0!important;mask-image:none!important;overflow:visible!important}
|
|
6374
|
+
[data-rw-ide-chat] header[data-window-drag] nav{display:flex!important;min-width:0!important;max-width:100%!important;overflow:hidden!important}
|
|
6375
|
+
[data-rw-ide-chat] header[data-window-drag] nav>span{min-width:0!important;max-width:100%!important;flex-shrink:1!important}
|
|
6376
|
+
[data-rw-ide-chat] header[data-window-drag] nav>span>span:last-child{min-width:0!important;max-width:100%!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}
|
|
6377
|
+
[data-rw-ide-chat] header[data-window-drag] div:has(>[data-slot="conversation.session.header.actions"]){display:flex!important;flex-wrap:wrap!important;gap:5px!important;align-items:center!important;min-width:0!important;max-width:100%!important;margin:0!important;padding:0!important}
|
|
6378
|
+
[data-rw-ide-chat] header[data-window-drag] div:has(>[data-slot="conversation.session.header.utilities"]){display:flex!important;flex-wrap:wrap!important;align-items:center!important;gap:5px!important;grid-column:1/-1!important;grid-row:2!important;min-width:0!important;max-width:100%!important;margin:0!important;padding:0!important}
|
|
6379
|
+
[data-rw-ide-chat] header[data-window-drag] [data-dsh-remote-chip]{max-width:100%!important;min-width:0!important;flex-shrink:1!important}
|
|
6380
|
+
[data-rw-ide-chat] [data-conversation-header-corner]{grid-column:2!important;grid-row:1!important;align-self:start!important;min-width:0!important;margin:0!important;padding:0!important}
|
|
6381
|
+
[data-rw-ide-chat] header[data-window-drag] div:has(>[data-conversation-tabs]){display:flex!important;flex-wrap:nowrap!important;align-items:flex-end!important;gap:8px!important;min-width:0!important;width:100%!important;margin:6px 0 0!important;padding:0!important;min-height:32px!important;position:relative!important}
|
|
6382
|
+
[data-rw-ide-chat] [data-conversation-tabs]{display:flex!important;flex-wrap:nowrap!important;align-items:stretch!important;gap:16px!important;flex:1!important;min-width:0!important;max-width:100%!important;overflow-x:auto!important;scrollbar-width:none!important}
|
|
6383
|
+
[data-rw-ide-chat] [data-conversation-tabs]>[role="tab"]{flex:none!important;min-height:32px!important;margin:0!important;padding:7px 2px 8px!important;box-sizing:border-box!important}
|
|
6384
|
+
[data-rw-ide-chat] header[data-window-drag] button{max-width:100%}
|
|
6385
|
+
/* The shell already has a persistent Return to standard mode action. */
|
|
6386
|
+
[data-rw-ide-chat] [data-rw-ide-toggle]{display:none!important}
|
|
6387
|
+
|
|
6388
|
+
/* Keep the default conversation header compact; preserve every extension
|
|
6389
|
+
* action behind the shell's explicit Chat tools disclosure. */
|
|
6390
|
+
[data-rw-ide-chat]:not([data-rw-ide-tools-expanded]) header[data-window-drag] div:has(>[data-slot="conversation.session.header.actions"]),
|
|
6391
|
+
[data-rw-ide-chat]:not([data-rw-ide-tools-expanded]) header[data-window-drag] div:has(>[data-slot="conversation.session.header.utilities"]){display:none!important}
|
|
6392
|
+
[data-rw-ide-chat]:not([data-rw-ide-tools-expanded]) header[data-window-drag] div:has(>[data-conversation-header-corner]){grid-template-rows:auto!important}
|
|
6393
|
+
|
|
6394
|
+
`
|
|
6395
|
+
// Returns a disposer that restores only the attributes/variables we own.
|
|
6396
|
+
// No innerHTML, appendChild, React portal, clone or second conversation.
|
|
6397
|
+
function remoteIdeDock(node, kind) {
|
|
6398
|
+
const marker = 'data-rw-ide-' + kind
|
|
6399
|
+
const names = [marker, 'data-rw-ide-hidden', 'data-rw-ide-tools-expanded', 'inert']
|
|
6400
|
+
const attrs = names.map(name => [name, node.getAttribute(name)])
|
|
6401
|
+
const vars = ['--rw-ide-x', '--rw-ide-y', '--rw-ide-w', '--rw-ide-h']
|
|
6402
|
+
const values = vars.map(name => [name, node.style.getPropertyValue(name), node.style.getPropertyPriority(name)])
|
|
6403
|
+
node.setAttribute(marker, '')
|
|
6404
|
+
return {
|
|
6405
|
+
node,
|
|
6406
|
+
position(rect, visible) {
|
|
6407
|
+
node.toggleAttribute('data-rw-ide-hidden', !visible)
|
|
6408
|
+
if (visible) {
|
|
6409
|
+
// Respect an original inert value, and otherwise remove our own.
|
|
6410
|
+
const original = attrs.find(([name]) => name === 'inert')[1]
|
|
6411
|
+
if (original == null) node.removeAttribute('inert')
|
|
6412
|
+
else node.setAttribute('inert', original)
|
|
6413
|
+
} else node.setAttribute('inert', '')
|
|
6414
|
+
const dimensions = [rect.left, rect.top, rect.width, rect.height]
|
|
6415
|
+
vars.forEach((name, i) => {
|
|
6416
|
+
const value = Math.max(0, dimensions[i]) + 'px'
|
|
6417
|
+
if (node.style.getPropertyValue(name) !== value) node.style.setProperty(name, value)
|
|
6418
|
+
})
|
|
6419
|
+
},
|
|
6420
|
+
dispose() {
|
|
6421
|
+
for (const [name, value] of attrs) { if (value == null) node.removeAttribute(name); else node.setAttribute(name, value) }
|
|
6422
|
+
for (const [name, value, priority] of values) { if (value) node.style.setProperty(name, value, priority); else node.style.removeProperty(name) }
|
|
6423
|
+
},
|
|
6424
|
+
}
|
|
6425
|
+
}
|
|
6426
|
+
function RemoteIdeWelcome() {
|
|
6427
|
+
return React.createElement('article', { 'data-rw-ide-welcome': '', style: { boxSizing: 'border-box', width: '100%', minHeight: '100%', padding: 'clamp(24px,5vw,64px)', color: T.label, overflowWrap: 'anywhere' } },
|
|
6428
|
+
React.createElement('div', { style: { maxWidth: 560, margin: 'auto' } },
|
|
6429
|
+
React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 10, color: T.muted, fontSize: 12, marginBottom: 14 } }, React.createElement(WorkbenchIcon, { name: 'remote', size: 24 }), 'dsh / remote'),
|
|
6430
|
+
React.createElement('h1', { style: { fontSize: 'clamp(20px,2vw,28px)', lineHeight: 1.4, fontWeight: 600, margin: '0 0 10px' } }, tr('ide.welcomeTitle')),
|
|
6431
|
+
React.createElement('p', { style: { fontSize: 13, lineHeight: 1.7, margin: '0 0 32px', color: T.muted } }, tr('ide.welcomeHint')),
|
|
6432
|
+
React.createElement('div', { style: { display: 'grid', gap: 24 } }, ['Files','Edit','Agent','Layout'].map((key, index) => React.createElement('section', { key, style: { display: 'flex', gap: 14 } },
|
|
6433
|
+
React.createElement('span', { 'aria-hidden': true, style: { color: T.muted, fontFamily: 'monospace', fontSize: 12, paddingTop: 2 } }, String(index + 1).padStart(2, '0')),
|
|
6434
|
+
React.createElement('div', {}, React.createElement('h2', { style: { fontSize: 13, fontWeight: 600, margin: '0 0 6px' } }, tr({ Files: 'ide.guideFiles', Edit: 'ide.guideEdit', Agent: 'ide.guideAgent', Layout: 'ide.guideLayout' }[key])), React.createElement('p', { style: { color: T.muted, fontSize: 12, lineHeight: 1.75, margin: 0 } }, tr({ Files: 'ide.guideFilesHint', Edit: 'ide.guideEditHint', Agent: 'ide.guideAgentHint', Layout: 'ide.guideLayoutHint' }[key])))))),
|
|
6435
|
+
React.createElement('a', { href: 'https://github.com/flymysql/dsh-remote#readme', target: '_blank', rel: 'noopener noreferrer', style: { display: 'inline-block', color: T.muted, fontSize: 12, marginTop: 32 } }, tr('ide.documentation'))))
|
|
6436
|
+
}
|
|
6437
|
+
// Replace the empty guide or a redundant explorer (already in the left
|
|
6438
|
+
// column). Existing files, terminals and drafts
|
|
6439
|
+
// are untouched, and each action is fenced to the session still on screen.
|
|
6440
|
+
function ensureRemoteIdeWelcome(controller, sessionId) {
|
|
6441
|
+
if (!controller || controller.mounted?.getSnapshot?.() !== sessionId || typeof controller.active !== 'function') return false
|
|
6442
|
+
const tab = controller.active()
|
|
6443
|
+
if (typeof controller.openTabIn !== 'function') return false
|
|
6444
|
+
if (!tab) { controller.openTabIn(sessionId, NATIVE_WELCOME); return true }
|
|
6445
|
+
if (!['guide', NATIVE_EXPLORER].includes(tab.kind) || !tab.id) return false
|
|
6446
|
+
controller.openTabIn(sessionId, NATIVE_WELCOME, { replaceTab: tab.id })
|
|
6447
|
+
controller.closeIn?.(sessionId, tab.id)
|
|
6448
|
+
return true
|
|
6449
|
+
}
|
|
6450
|
+
function RemoteIdeShell() {
|
|
6451
|
+
const state = useRemoteIdeState()
|
|
6452
|
+
const [sessionId, setSessionId] = React.useState('')
|
|
6453
|
+
const [, refresh] = React.useState(0)
|
|
6454
|
+
const [width, setWidth] = React.useState(() => typeof window.innerWidth === 'number' ? window.innerWidth : 1280)
|
|
6455
|
+
const [mobilePane, setMobilePane] = React.useState('chat')
|
|
6456
|
+
const [toolsExpanded, setToolsExpanded] = React.useState(false)
|
|
6457
|
+
const toolsExpandedRef = React.useRef(false)
|
|
6458
|
+
toolsExpandedRef.current = toolsExpanded
|
|
6459
|
+
const [availability, setAvailability] = React.useState({ chat: true, editor: true })
|
|
6460
|
+
const [expanded, setExpanded] = React.useState([])
|
|
6461
|
+
const editorSeat = React.useRef(null), chatSeat = React.useRef(null), shellRef = React.useRef(null)
|
|
6462
|
+
const dragCleanup = React.useRef(null)
|
|
6463
|
+
const controller = remoteIdeController
|
|
6464
|
+
const sizes = remoteIdeWidths(width, state)
|
|
6465
|
+
const mirror = sessionId ? mirrorForCwd(sessionCwdFor(sessionId), MIRRORS.list) : null
|
|
6466
|
+
const active = !!(state.enabled && sessionId && mirror && controller)
|
|
6467
|
+
React.useEffect(() => {
|
|
6468
|
+
const update = () => {
|
|
6469
|
+
setSessionId(String(controller?.mounted?.getSnapshot?.() || ''))
|
|
6470
|
+
refresh(n => n + 1)
|
|
6471
|
+
}
|
|
6472
|
+
const unsubscribers = []
|
|
6473
|
+
if (controller?.mounted?.subscribe) unsubscribers.push(controller.mounted.subscribe(update))
|
|
6474
|
+
if (SESSIONS?.list?.subscribe) unsubscribers.push(SESSIONS.list.subscribe(update))
|
|
6475
|
+
mirrorWatchers.add(update); ensureMirrors(); update()
|
|
6476
|
+
const onResize = () => setWidth(window.innerWidth)
|
|
6477
|
+
window.addEventListener('resize', onResize)
|
|
6478
|
+
return () => { unsubscribers.forEach(dispose => dispose?.()); mirrorWatchers.delete(update); window.removeEventListener('resize', onResize); dragCleanup.current?.() }
|
|
6479
|
+
}, [controller])
|
|
6480
|
+
React.useEffect(() => { setExpanded(explorerMemory.get(sessionId)?.expanded || []); setToolsExpanded(false) }, [sessionId])
|
|
6481
|
+
React.useEffect(() => {
|
|
6482
|
+
const chat = document.querySelector('[data-rw-ide-chat]')
|
|
6483
|
+
chat?.toggleAttribute('data-rw-ide-tools-expanded', toolsExpanded)
|
|
6484
|
+
}, [active, sessionId, toolsExpanded])
|
|
6485
|
+
React.useEffect(() => {
|
|
6486
|
+
if (!active) return
|
|
6487
|
+
const node = document.createElement('style')
|
|
6488
|
+
node.setAttribute('data-rw-ide-css', '')
|
|
6489
|
+
node.textContent = REMOTE_IDE_CSS
|
|
6490
|
+
document.head.appendChild(node)
|
|
6491
|
+
return () => node.remove()
|
|
6492
|
+
}, [active])
|
|
6493
|
+
React.useEffect(() => {
|
|
6494
|
+
if (!active || !editorSeat.current || !chatSeat.current) return
|
|
6495
|
+
let stopped = false, frame = 0, dockChat = null, dockEditor = null
|
|
6496
|
+
const wasExpanded = typeof controller.isExpanded === 'function' ? controller.isExpanded() : true
|
|
6497
|
+
// Use the public controller so aria-hidden, focus and the tab domain
|
|
6498
|
+
// agree. It reveals the EXISTING editor, without opening/replacing tabs.
|
|
6499
|
+
if (!wasExpanded && typeof controller.toggleExpanded === 'function') controller.toggleExpanded()
|
|
6500
|
+
const find = (selector, attribute) => [...document.querySelectorAll(selector)].find(node => node.getAttribute(attribute) === sessionId)
|
|
6501
|
+
const update = () => {
|
|
6502
|
+
frame = 0
|
|
6503
|
+
if (stopped) return
|
|
6504
|
+
ensureRemoteIdeWelcome(controller, sessionId)
|
|
6505
|
+
if (!dockChat?.node.isConnected) {
|
|
6506
|
+
dockChat?.dispose()
|
|
6507
|
+
const content = find('[data-conversation-content][data-conversation-session]', 'data-conversation-session')
|
|
6508
|
+
const root = content?.closest('[data-phase]')
|
|
6509
|
+
dockChat = root ? remoteIdeDock(root, 'chat') : null
|
|
6510
|
+
}
|
|
6511
|
+
if (!dockEditor?.node.isConnected) {
|
|
6512
|
+
dockEditor?.dispose()
|
|
6513
|
+
const panel = find('[data-sidebar-right-panel][data-sidebar-right-session]', 'data-sidebar-right-session')
|
|
6514
|
+
dockEditor = panel ? remoteIdeDock(panel, 'editor') : null
|
|
6515
|
+
}
|
|
6516
|
+
const chatRect = chatSeat.current?.getBoundingClientRect()
|
|
6517
|
+
const editorRect = editorSeat.current?.getBoundingClientRect()
|
|
6518
|
+
if (dockChat && chatRect) { dockChat.position(chatRect, chatRect.width > 0 && chatRect.height > 0); dockChat.node.toggleAttribute('data-rw-ide-tools-expanded', toolsExpandedRef.current) }
|
|
6519
|
+
if (dockEditor && editorRect) dockEditor.position(editorRect, editorRect.width > 0 && editorRect.height > 0)
|
|
6520
|
+
const chat = !!dockChat
|
|
6521
|
+
const editor = !!dockEditor && dockEditor.node.getAttribute('aria-hidden') !== 'true'
|
|
6522
|
+
setAvailability(old => old.chat === chat && old.editor === editor ? old : { chat, editor })
|
|
6523
|
+
}
|
|
6524
|
+
const schedule = () => { if (!stopped && !frame) frame = window.requestAnimationFrame(update) }
|
|
6525
|
+
const observer = typeof ResizeObserver === 'function' ? new ResizeObserver(schedule) : null
|
|
6526
|
+
observer?.observe(editorSeat.current); observer?.observe(chatSeat.current)
|
|
6527
|
+
// React may replace roots during session navigation. Child-list changes
|
|
6528
|
+
// are coalesced, including a newly opened empty guide. Character data
|
|
6529
|
+
// and style attributes are not observed during token streaming.
|
|
6530
|
+
const mutations = typeof MutationObserver === 'function' ? new MutationObserver(schedule) : null
|
|
6531
|
+
mutations?.observe(document.body, { childList: true, subtree: true })
|
|
6532
|
+
const unsub = controller.openTabs?.subscribe?.(schedule)
|
|
6533
|
+
window.addEventListener('resize', schedule)
|
|
6534
|
+
update()
|
|
6535
|
+
return () => {
|
|
6536
|
+
stopped = true; if (frame) window.cancelAnimationFrame(frame)
|
|
6537
|
+
observer?.disconnect(); mutations?.disconnect(); unsub?.(); window.removeEventListener('resize', schedule)
|
|
6538
|
+
dockChat?.dispose(); dockEditor?.dispose()
|
|
6539
|
+
if (!wasExpanded && controller.mounted?.getSnapshot?.() === sessionId && controller.isExpanded?.()) controller.toggleExpanded?.()
|
|
6540
|
+
}
|
|
6541
|
+
}, [active, sessionId, controller, mobilePane, sizes.narrow])
|
|
6542
|
+
if (!active) return null
|
|
6543
|
+
const updateExpanded = fn => setExpanded(old => {
|
|
6544
|
+
const next = typeof fn === 'function' ? fn(old) : fn
|
|
6545
|
+
explorerMemory.set(sessionId, { ...explorerMemory.get(sessionId), expanded: next })
|
|
6546
|
+
return next
|
|
6547
|
+
})
|
|
6548
|
+
const resizeBy = (side, delta) => remoteIdeSet({ [side]: Math.max(side === 'left' ? 180 : 280, Math.min(side === 'left' ? 380 : 700, sizes[side] + delta)) })
|
|
6549
|
+
const divider = side => React.createElement('div', {
|
|
6550
|
+
key: side, role: 'separator', tabIndex: 0, 'aria-orientation': 'vertical',
|
|
6551
|
+
'aria-label': tr(side === 'left' ? 'ide.leftWidth' : 'ide.rightWidth'),
|
|
6552
|
+
'aria-valuemin': side === 'left' ? 180 : 280, 'aria-valuemax': side === 'left' ? 380 : 700,
|
|
6553
|
+
'aria-valuenow': sizes[side], 'data-rw-ide-divider': side,
|
|
6554
|
+
onDoubleClick: () => remoteIdeSet({ [side]: side === 'left' ? 240 : 400 }),
|
|
6555
|
+
onKeyDown: event => {
|
|
6556
|
+
if (!['ArrowLeft', 'ArrowRight', 'Home'].includes(event.key)) return
|
|
6557
|
+
event.preventDefault()
|
|
6558
|
+
if (event.key === 'Home') remoteIdeSet({ [side]: side === 'left' ? 240 : 400 })
|
|
6559
|
+
else resizeBy(side, (event.key === 'ArrowLeft' ? -16 : 16) * (side === 'left' ? 1 : -1))
|
|
6560
|
+
},
|
|
6561
|
+
onPointerDown: event => {
|
|
6562
|
+
if (event.button !== 0) return
|
|
6563
|
+
event.preventDefault(); dragCleanup.current?.()
|
|
6564
|
+
const start = event.clientX, initial = sizes[side]
|
|
6565
|
+
const move = e => remoteIdeSet({ [side]: Math.max(side === 'left' ? 180 : 280, Math.min(side === 'left' ? 380 : 700, initial + (e.clientX - start) * (side === 'left' ? 1 : -1))) })
|
|
6566
|
+
const end = () => { window.removeEventListener('pointermove', move); window.removeEventListener('pointerup', end); window.removeEventListener('pointercancel', end); dragCleanup.current = null }
|
|
6567
|
+
dragCleanup.current = end
|
|
6568
|
+
window.addEventListener('pointermove', move); window.addEventListener('pointerup', end); window.addEventListener('pointercancel', end)
|
|
6569
|
+
},
|
|
6570
|
+
})
|
|
6571
|
+
const openEditor = () => { if (!controller.isExpanded?.()) controller.toggleExpanded?.() }
|
|
6572
|
+
return React.createElement('section', { ref: shellRef, 'data-rw-ide-shell': sessionId, 'aria-label': tr('ide.enter') },
|
|
6573
|
+
React.createElement('header', { 'data-rw-ide-header': '' },
|
|
6574
|
+
React.createElement('span', { 'data-rw-ide-title': '', title: mirror.remotePath }, (mirror.name || mirror.host || '') + ' · ' + (String(mirror.remotePath || '').split(/[\\/]/).filter(Boolean).pop() || '/')),
|
|
6575
|
+
sizes.narrow ? React.createElement('nav', { 'data-rw-ide-navigation': '', 'aria-label': tr('ide.enter') }, ['files', 'editor', 'chat'].map(pane => React.createElement('button', {
|
|
6576
|
+
key: pane, type: 'button', style: { ...buttonS, padding: '4px 9px', fontSize: 12 },
|
|
6577
|
+
'aria-pressed': mobilePane === pane, onClick: () => setMobilePane(pane),
|
|
6578
|
+
}, tr({ files: 'ide.files', editor: 'ide.editor', chat: 'ide.chat' }[pane])))) : null,
|
|
6579
|
+
React.createElement('button', { type: 'button', 'data-rw-ide-tools-toggle': '', 'aria-expanded': toolsExpanded, style: { ...buttonS, padding: '4px 9px', fontSize: 12 }, title: tr('ide.toolsHint'), onClick: () => setToolsExpanded(value => !value) }, tr('ide.tools')),
|
|
6580
|
+
React.createElement('button', { type: 'button', 'data-rw-ide-exit': '', style: { ...buttonS, padding: '4px 9px', fontSize: 12 }, title: tr('ide.help'), onClick: () => remoteIdeSet({ enabled: false }) }, tr('ide.exit'))),
|
|
6581
|
+
React.createElement('div', { 'data-rw-ide-body': '', style: { gridTemplateColumns: sizes.narrow ? 'minmax(0,1fr)' : sizes.left + 'px 6px minmax(320px,1fr) 6px ' + sizes.right + 'px' } },
|
|
6582
|
+
React.createElement('aside', { 'data-rw-ide-tree': '', 'aria-label': tr('ide.files'), style: { display: sizes.narrow && mobilePane !== 'files' ? 'none' : undefined } },
|
|
6583
|
+
React.createElement(RemoteExplorerTab, {
|
|
6584
|
+
key: sessionId, scope: { sessionId }, visible: true, expanded,
|
|
6585
|
+
onToggleDir: path => updateExpanded(old => old.includes(path) ? old.filter(value => value !== path) : [...old, path]),
|
|
6586
|
+
onCollapseAll: () => updateExpanded([]),
|
|
6587
|
+
onOpenFile: (path, line) => { controller.openResourceIn(sessionId, remoteFileAddress(sessionId, path), Number.isSafeInteger(line) && line > 0 ? { params: { line } } : undefined); setMobilePane('editor') },
|
|
6588
|
+
onOpenChanges: () => { controller.openTabIn(sessionId, NATIVE_CHANGES); setMobilePane('editor') },
|
|
6589
|
+
})),
|
|
6590
|
+
sizes.narrow ? null : divider('left'),
|
|
6591
|
+
React.createElement('main', { ref: editorSeat, 'data-rw-ide-seat': 'editor', style: { display: sizes.narrow && mobilePane !== 'editor' ? 'none' : undefined } },
|
|
6592
|
+
React.createElement('div', { 'data-rw-ide-placeholder': '' }, tr('ide.chooseFile'), !availability.editor ? React.createElement('div', null, React.createElement('button', { type: 'button', style: buttonS, onClick: openEditor }, tr('ide.openEditor'))) : null)),
|
|
6593
|
+
sizes.narrow ? null : divider('right'),
|
|
6594
|
+
React.createElement('aside', { ref: chatSeat, 'data-rw-ide-seat': 'chat', 'aria-label': tr('ide.chat'), style: { display: sizes.narrow && mobilePane !== 'chat' ? 'none' : undefined } },
|
|
6595
|
+
!availability.chat ? React.createElement('p', { 'data-rw-ide-placeholder': '', role: 'status' }, tr('ide.unavailable')) : null)))
|
|
6596
|
+
}
|
|
6597
|
+
function installRemoteIde(ctx) {
|
|
6598
|
+
const slots = ctx.get('slots')
|
|
6599
|
+
slots.inject('conversation.session.header.actions', () => slots.register({ name: 'conversation.session.header.actions', id: 'dsh-remote-ide-toggle', order: 40 }, RemoteIdeToggle))
|
|
6600
|
+
ctx.inject(['sidebarRight'], inner => {
|
|
6601
|
+
const controller = inner.get('sidebarRight')
|
|
6602
|
+
remoteIdeController = controller
|
|
6603
|
+
inner.effect(() => () => { if (remoteIdeController === controller) remoteIdeController = null }, 'dsh-remote.ide-controller')
|
|
6604
|
+
slots.inject('shell.overlay', () => slots.register({ name: 'shell.overlay', id: 'dsh-remote-ide-shell', order: 10 }, RemoteIdeShell))
|
|
6605
|
+
})
|
|
6606
|
+
}
|
|
6607
|
+
|
|
5541
6608
|
function apply(ctx) {
|
|
5542
6609
|
ensureChromeCss()
|
|
5543
6610
|
const slots = ctx.get('slots')
|
|
@@ -5605,6 +6672,7 @@ window.__ModuleLoader__.load({
|
|
|
5605
6672
|
slots.inject('conversation.session.header.utilities', () =>
|
|
5606
6673
|
slots.register({ name: 'conversation.session.header.utilities', id: 'dsh-remote-remote-chip', order: 15 }, RemoteSessionChip),
|
|
5607
6674
|
)
|
|
6675
|
+
installRemoteIde(ctx)
|
|
5608
6676
|
}
|
|
5609
6677
|
|
|
5610
6678
|
exports.name = name
|