dsh-remote-vs 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +50 -16
- package/README.md +40 -15
- package/THIRD-PARTY-NOTICES.md +188 -0
- package/lib/client.js +6512 -77887
- package/lib/index.js +1461 -1024
- package/lib/p2-router-fs.js +1 -1
- package/lib/types/client/CodeEditor.d.ts +25 -0
- package/lib/types/client/EditorPane.d.ts +16 -5
- package/lib/types/client/FloatingPlaceholder.d.ts +16 -5
- package/lib/types/client/RemoteEditorView.d.ts +13 -10
- package/lib/types/client/RemoteExplorer.d.ts +53 -0
- package/lib/types/client/RemoteRoot.d.ts +5 -5
- package/lib/types/client/TerminalSnippets.d.ts +36 -0
- package/lib/types/client/TerminalView.d.ts +1 -1
- package/lib/types/client/XTerm.d.ts +33 -0
- package/lib/types/client/api.d.ts +37 -2
- package/lib/types/client/changes/review-state.d.ts +19 -0
- package/lib/types/client/connection.d.ts +16 -0
- package/lib/types/client/editor-capability.d.ts +27 -0
- package/lib/types/client/i18n.d.ts +1 -1
- package/lib/types/client/request-gate.d.ts +110 -0
- package/lib/types/client/scm/DiffView.d.ts +45 -7
- package/lib/types/client/scm/actions.d.ts +31 -3
- package/lib/types/client/store.d.ts +112 -4
- package/lib/types/client/terminal-input.d.ts +23 -0
- package/lib/types/client/terminal-snippets.d.ts +86 -0
- package/lib/types/client/vsc/FindWidget.d.ts +6 -0
- package/lib/types/client/vsc/breadcrumb.d.ts +30 -0
- package/lib/types/client/vsc/change-marks.d.ts +16 -6
- package/lib/types/client/vsc/editor-caret.d.ts +32 -0
- package/lib/types/client/vsc/editor-keymap.d.ts +35 -1
- package/lib/types/client/vsc/editor-langs.d.ts +9 -0
- package/lib/types/client/vsc/editor-settings.d.ts +55 -0
- package/lib/types/client/vsc/image-preview.d.ts +36 -0
- package/lib/types/client/vsc/kit.d.ts +13 -0
- package/lib/types/client/vsc/save-shortcut.d.ts +21 -0
- package/lib/types/client/vsc/terminal-clipboard.d.ts +15 -0
- package/lib/types/client/vsc/terminal-line.d.ts +25 -0
- package/lib/types/client/vsc/terminal-links.d.ts +62 -0
- package/lib/types/client/vsc/terminal-theme.d.ts +48 -0
- package/lib/types/client/vsc/terminal-writer.d.ts +52 -0
- package/lib/types/forward.d.ts +12 -0
- package/lib/types/fs-ops.d.ts +42 -0
- package/lib/types/http.d.ts +2 -0
- package/lib/types/keygen.d.ts +9 -0
- package/lib/types/monitor.d.ts +8 -0
- package/lib/types/notices.d.ts +16 -1
- package/lib/types/p2/helper-rpc.d.ts +45 -0
- package/lib/types/pool.d.ts +25 -0
- package/lib/types/routes.d.ts +2 -0
- package/lib/types/store.d.ts +7 -0
- package/lib/types/terminal.d.ts +33 -1
- package/lib/types/view-settings.d.ts +5 -0
- package/lib/{worlds-B7gEDBzC.js → worlds-RG8K5eom.js} +113 -15
- package/package.json +2 -1
- package/src/client/CodeEditor.tsx +205 -10
- package/src/client/DirectoryFlow.tsx +16 -0
- package/src/client/DoctorPanel.tsx +70 -7
- package/src/client/EditorPane.tsx +545 -118
- package/src/client/FloatingPlaceholder.tsx +34 -5
- package/src/client/HostsView.tsx +12 -3
- package/src/client/RemoteDirectoryPicker.tsx +12 -0
- package/src/client/RemoteEditorView.tsx +14 -11
- package/src/client/RemoteExplorer.tsx +929 -40
- package/src/client/RemoteRoot.tsx +167 -147
- package/src/client/SearchView.tsx +8 -0
- package/src/client/TerminalSnippets.tsx +432 -0
- package/src/client/TerminalView.tsx +50 -1
- package/src/client/XTerm.tsx +228 -58
- package/src/client/api.ts +106 -13
- package/src/client/auto-open-remote.ts +11 -9
- package/src/client/changes/ChangesDock.tsx +188 -6
- package/src/client/changes/changes.css +10 -3
- package/src/client/changes/review-state.ts +34 -0
- package/src/client/connection.ts +29 -0
- package/src/client/downloads.ts +49 -4
- package/src/client/editor-capability.ts +42 -0
- package/src/client/i18n.ts +228 -12
- package/src/client/index.tsx +22 -6
- package/src/client/request-gate.ts +221 -0
- package/src/client/scm/CommitPane.tsx +20 -2
- package/src/client/scm/DiffView.tsx +343 -117
- package/src/client/scm/HistoryPanel.tsx +23 -2
- package/src/client/scm/RepoPicker.tsx +1 -1
- package/src/client/scm/ScmPanel.tsx +391 -87
- package/src/client/scm/actions.ts +95 -12
- package/src/client/store.tsx +537 -22
- package/src/client/terminal-input.ts +44 -0
- package/src/client/terminal-snippets.ts +216 -0
- package/src/client/ui.tsx +4 -0
- package/src/client/vsc/FindWidget.tsx +24 -9
- package/src/client/vsc/breadcrumb.tsx +339 -0
- package/src/client/vsc/change-marks.ts +93 -44
- package/src/client/vsc/editor-caret.ts +30 -0
- package/src/client/vsc/editor-keymap.ts +59 -1
- package/src/client/vsc/editor-langs.ts +20 -0
- package/src/client/vsc/editor-settings.ts +146 -0
- package/src/client/vsc/editor-theme.ts +4 -5
- package/src/client/vsc/file-icons.tsx +17 -3
- package/src/client/vsc/image-preview.tsx +110 -0
- package/src/client/vsc/kit.tsx +46 -10
- package/src/client/vsc/save-shortcut.ts +47 -1
- package/src/client/vsc/terminal-clipboard.ts +19 -0
- package/src/client/vsc/terminal-line.ts +101 -0
- package/src/client/vsc/terminal-links.ts +166 -0
- package/src/client/vsc/terminal-theme.ts +97 -0
- package/src/client/vsc/terminal-writer.ts +112 -0
- package/src/client/vsc/vsc.css +1078 -181
- package/src/forward.ts +47 -9
- package/src/fs-ops.ts +124 -4
- package/src/git-ops.ts +20 -3
- package/src/http.ts +35 -4
- package/src/keygen.ts +55 -4
- package/src/monitor.ts +13 -0
- package/src/notices.ts +23 -1
- package/src/p2/helper-rpc.ts +113 -7
- package/src/p2/worlds.ts +14 -1
- package/src/pool.ts +99 -27
- package/src/routes.ts +212 -43
- package/src/sftp.ts +51 -14
- package/src/store.ts +10 -0
- package/src/terminal.ts +225 -24
- package/src/view-settings.ts +50 -10
- package/lib/types/client/Dialog.d.ts +0 -14
- package/src/client/Dialog.tsx +0 -76
|
@@ -94,6 +94,20 @@ async function copyReport(text: string): Promise<boolean> {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Focusable controls inside this layer, in DOM order.
|
|
99
|
+
*
|
|
100
|
+
* Same rule as `vsc/kit.tsx`'s `focusables`, inlined instead of imported: this
|
|
101
|
+
* panel deliberately does not import the kit (its copy path must not use the
|
|
102
|
+
* silently-failing `copyText`), and `check-doctor.mjs` pins that.
|
|
103
|
+
*/
|
|
104
|
+
const FOCUSABLE = 'button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
105
|
+
|
|
106
|
+
function focusables(root: HTMLElement | null): HTMLElement[] {
|
|
107
|
+
if (root === null) return []
|
|
108
|
+
return Array.from(root.querySelectorAll<HTMLElement>(FOCUSABLE))
|
|
109
|
+
}
|
|
110
|
+
|
|
97
111
|
export function DoctorPanel(props: {
|
|
98
112
|
t: (key: string) => string
|
|
99
113
|
alias: string
|
|
@@ -103,6 +117,10 @@ export function DoctorPanel(props: {
|
|
|
103
117
|
/** `undefined` = the probe is still running. */
|
|
104
118
|
const [items, setItems] = useState<DoctorItem[] | undefined>(undefined)
|
|
105
119
|
const [copyState, setCopyState] = useState<'idle' | 'copied' | 'failed'>('idle')
|
|
120
|
+
/** The card, so the Tab trap below has one root to walk. */
|
|
121
|
+
const cardRef = useRef<HTMLDivElement>(null)
|
|
122
|
+
/** Where focus came from (the "环境自检" button); handed back on close. */
|
|
123
|
+
const openerRef = useRef<HTMLElement | null>(null)
|
|
106
124
|
const alive = useRef(true)
|
|
107
125
|
// Re-armed on every setup: a StrictMode/replay remount runs setup → cleanup →
|
|
108
126
|
// setup, and a flag that only ever got set to false would freeze the panel on
|
|
@@ -124,14 +142,59 @@ export function DoctorPanel(props: {
|
|
|
124
142
|
run()
|
|
125
143
|
}, [run])
|
|
126
144
|
|
|
145
|
+
/**
|
|
146
|
+
* The layer takes the keyboard on open and gives it back on close.
|
|
147
|
+
*
|
|
148
|
+
* The panel declared `role="dialog" aria-modal="true"` but nothing moved the
|
|
149
|
+
* focus into it, so Tab walked straight out into the DSH Settings form behind
|
|
150
|
+
* the overlay while a screen reader had been told that form is inert. It lives
|
|
151
|
+
* INSIDE the host Settings dialog, hence both halves: keep the keyboard here,
|
|
152
|
+
* and give it back to the button that opened this layer.
|
|
153
|
+
*/
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
openerRef.current = typeof document === 'undefined' ? null : (document.activeElement as HTMLElement | null)
|
|
156
|
+
// First paint first: the copy button is still disabled while the probe runs,
|
|
157
|
+
// so this settles on the close button — a safe, always-present target.
|
|
158
|
+
const focusTimer = window.setTimeout(() => { focusables(cardRef.current)[0]?.focus() }, 0)
|
|
159
|
+
return () => {
|
|
160
|
+
window.clearTimeout(focusTimer)
|
|
161
|
+
const opener = openerRef.current
|
|
162
|
+
if (opener !== null && document.body.contains(opener)) opener.focus()
|
|
163
|
+
}
|
|
164
|
+
}, [])
|
|
165
|
+
|
|
127
166
|
useEffect(() => {
|
|
128
167
|
const onKey = (e: KeyboardEvent): void => {
|
|
129
|
-
if (e.key
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
168
|
+
if (e.key === 'Escape') {
|
|
169
|
+
// CAPTURE phase + stop: the panel lives inside the DSH Settings dialog,
|
|
170
|
+
// whose own Escape handler would otherwise close the whole dialog (and the
|
|
171
|
+
// report) together with this layer.
|
|
172
|
+
e.stopPropagation()
|
|
173
|
+
props.onClose()
|
|
174
|
+
return
|
|
175
|
+
}
|
|
176
|
+
if (e.key !== 'Tab') return
|
|
177
|
+
// Tab trap, first <-> last (same shape as the kit's ModalCard).
|
|
178
|
+
const controls = focusables(cardRef.current)
|
|
179
|
+
if (controls.length === 0) return
|
|
180
|
+
const first = controls[0] as HTMLElement
|
|
181
|
+
const last = controls[controls.length - 1] as HTMLElement
|
|
182
|
+
const active = document.activeElement
|
|
183
|
+
const inside = cardRef.current?.contains(active) === true
|
|
184
|
+
// Focus outside the card: a plain Tab used to walk straight into the DSH
|
|
185
|
+
// Settings form behind the overlay (only Shift+Tab was pulled back, so the
|
|
186
|
+
// trap was not a closed loop). Both directions now return to the card.
|
|
187
|
+
if (!inside) {
|
|
188
|
+
e.preventDefault()
|
|
189
|
+
if (e.shiftKey) last.focus()
|
|
190
|
+
else first.focus()
|
|
191
|
+
} else if (e.shiftKey && active === first) {
|
|
192
|
+
e.preventDefault()
|
|
193
|
+
last.focus()
|
|
194
|
+
} else if (!e.shiftKey && active === last) {
|
|
195
|
+
e.preventDefault()
|
|
196
|
+
first.focus()
|
|
197
|
+
}
|
|
135
198
|
}
|
|
136
199
|
document.addEventListener('keydown', onKey, true)
|
|
137
200
|
return () => document.removeEventListener('keydown', onKey, true)
|
|
@@ -160,7 +223,7 @@ export function DoctorPanel(props: {
|
|
|
160
223
|
aria-label={title}
|
|
161
224
|
onClick={props.onClose}
|
|
162
225
|
>
|
|
163
|
-
<div className="rvs-doctor-card" onClick={(e) => e.stopPropagation()}>
|
|
226
|
+
<div ref={cardRef} className="rvs-doctor-card" onClick={(e) => e.stopPropagation()}>
|
|
164
227
|
<div className="rvs-doctor-head">
|
|
165
228
|
<span className="rvs-doctor-title">{title}</span>
|
|
166
229
|
<span style={{ flex: 1 }} />
|