dsh-remote-vs 0.25.0 → 0.27.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.
Files changed (109) hide show
  1. package/README.en.md +12 -15
  2. package/README.md +11 -12
  3. package/THIRD-PARTY-NOTICES.md +193 -0
  4. package/lib/client.js +7313 -79961
  5. package/lib/index.js +1529 -964
  6. package/lib/p2-router-fs.js +1 -1
  7. package/lib/types/client/CodeEditor.d.ts +22 -0
  8. package/lib/types/client/OutlinePanel.d.ts +22 -0
  9. package/lib/types/client/ProcessesSection.d.ts +19 -0
  10. package/lib/types/client/RemoteExplorer.d.ts +53 -0
  11. package/lib/types/client/api.d.ts +42 -3
  12. package/lib/types/client/blame-model.d.ts +77 -0
  13. package/lib/types/client/changes/review-state.d.ts +19 -0
  14. package/lib/types/client/connection.d.ts +16 -0
  15. package/lib/types/client/i18n.d.ts +1 -1
  16. package/lib/types/client/outline-model.d.ts +59 -0
  17. package/lib/types/client/request-gate.d.ts +110 -0
  18. package/lib/types/client/scm/DiffView.d.ts +45 -7
  19. package/lib/types/client/scm/actions.d.ts +43 -4
  20. package/lib/types/client/store.d.ts +71 -0
  21. package/lib/types/client/vsc/FindWidget.d.ts +6 -0
  22. package/lib/types/client/vsc/blame.d.ts +19 -0
  23. package/lib/types/client/vsc/change-marks.d.ts +16 -6
  24. package/lib/types/client/vsc/editor-keymap.d.ts +35 -1
  25. package/lib/types/client/vsc/kit.d.ts +11 -2
  26. package/lib/types/client/vsc/preview-document.d.ts +46 -0
  27. package/lib/types/client/vsc/preview-model.d.ts +31 -0
  28. package/lib/types/client/vsc/preview-services.d.ts +24 -0
  29. package/lib/types/client/vsc/save-shortcut.d.ts +21 -0
  30. package/lib/types/client/vsc/terminal-theme.d.ts +28 -2
  31. package/lib/types/forward.d.ts +12 -0
  32. package/lib/types/fs-ops.d.ts +42 -0
  33. package/lib/types/git-ops.d.ts +18 -0
  34. package/lib/types/http.d.ts +2 -0
  35. package/lib/types/keygen.d.ts +9 -0
  36. package/lib/types/monitor.d.ts +8 -0
  37. package/lib/types/notices.d.ts +16 -1
  38. package/lib/types/p2/helper-rpc.d.ts +45 -0
  39. package/lib/types/processes.d.ts +43 -0
  40. package/lib/types/protocol.d.ts +34 -0
  41. package/lib/types/routes.d.ts +2 -0
  42. package/lib/types/store.d.ts +7 -0
  43. package/lib/types/terminal.d.ts +8 -0
  44. package/lib/types/view-settings.d.ts +5 -0
  45. package/lib/{worlds-B7gEDBzC.js → worlds-RG8K5eom.js} +113 -15
  46. package/package.json +3 -1
  47. package/src/client/CodeEditor.tsx +194 -9
  48. package/src/client/DirectoryFlow.tsx +16 -0
  49. package/src/client/DoctorPanel.tsx +70 -7
  50. package/src/client/EditorPane.tsx +574 -42
  51. package/src/client/HostsView.tsx +12 -3
  52. package/src/client/MonitorView.tsx +16 -5
  53. package/src/client/OutlinePanel.tsx +287 -0
  54. package/src/client/ProcessesSection.tsx +292 -0
  55. package/src/client/RemoteDirectoryPicker.tsx +12 -0
  56. package/src/client/RemoteExplorer.tsx +929 -40
  57. package/src/client/RemoteRoot.tsx +147 -22
  58. package/src/client/SearchView.tsx +8 -0
  59. package/src/client/TerminalSnippets.tsx +83 -8
  60. package/src/client/api.ts +114 -13
  61. package/src/client/blame-model.ts +242 -0
  62. package/src/client/changes/ChangesDock.tsx +188 -6
  63. package/src/client/changes/changes.css +10 -3
  64. package/src/client/changes/review-state.ts +34 -0
  65. package/src/client/connection.ts +29 -0
  66. package/src/client/downloads.ts +49 -4
  67. package/src/client/i18n.ts +276 -8
  68. package/src/client/index.tsx +4 -0
  69. package/src/client/outline-model.ts +775 -0
  70. package/src/client/request-gate.ts +221 -0
  71. package/src/client/scm/CommitPane.tsx +20 -2
  72. package/src/client/scm/DiffView.tsx +343 -117
  73. package/src/client/scm/HistoryPanel.tsx +61 -3
  74. package/src/client/scm/RepoPicker.tsx +1 -1
  75. package/src/client/scm/ScmPanel.tsx +391 -87
  76. package/src/client/scm/actions.ts +150 -14
  77. package/src/client/store.tsx +426 -14
  78. package/src/client/ui.tsx +4 -0
  79. package/src/client/vsc/FindWidget.tsx +24 -9
  80. package/src/client/vsc/blame.ts +147 -0
  81. package/src/client/vsc/breadcrumb.tsx +91 -3
  82. package/src/client/vsc/change-marks.ts +93 -44
  83. package/src/client/vsc/editor-keymap.ts +59 -1
  84. package/src/client/vsc/file-icons.tsx +17 -3
  85. package/src/client/vsc/kit.tsx +29 -20
  86. package/src/client/vsc/preview-document.tsx +323 -0
  87. package/src/client/vsc/preview-model.ts +216 -0
  88. package/src/client/vsc/preview-services.ts +118 -0
  89. package/src/client/vsc/save-shortcut.ts +47 -1
  90. package/src/client/vsc/terminal-theme.ts +44 -18
  91. package/src/client/vsc/vsc.css +6509 -5458
  92. package/src/forward.ts +47 -9
  93. package/src/fs-ops.ts +124 -4
  94. package/src/git-ops.ts +54 -3
  95. package/src/http.ts +35 -4
  96. package/src/keygen.ts +55 -4
  97. package/src/monitor.ts +13 -0
  98. package/src/notices.ts +23 -1
  99. package/src/p2/helper-rpc.ts +113 -7
  100. package/src/p2/worlds.ts +14 -1
  101. package/src/processes.ts +177 -0
  102. package/src/protocol.ts +37 -0
  103. package/src/routes.ts +330 -43
  104. package/src/sftp.ts +51 -14
  105. package/src/store.ts +10 -0
  106. package/src/terminal.ts +73 -26
  107. package/src/view-settings.ts +50 -10
  108. package/lib/types/client/Dialog.d.ts +0 -14
  109. package/src/client/Dialog.tsx +0 -76
@@ -25,8 +25,8 @@ import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } fro
25
25
  import type { GitCommit, GitCommitFile } from '../../protocol.ts'
26
26
  import { GIT_LOG_MAX } from '../../git-format.ts'
27
27
  import { api } from '../api.ts'
28
- import { gitReadSettleMs, useExplorer } from '../store.tsx'
29
- import { checkoutCommit, joinRemote, loadCommitFiles, loadCommitMessage, loadCommitPatch } from './actions.ts'
28
+ import { gitReadSettleMs, shallowEqual, useExplorerSelector, type ExplorerValue } from '../store.tsx'
29
+ import { checkoutCommit, joinRemote, loadCommit, loadCommitFiles, loadCommitMessage, loadCommitPatch } from './actions.ts'
30
30
  import { CommitPane } from './CommitPane.tsx'
31
31
  import { isHistoryTab, needsPatchLoad, refBadgeClass, refBadgeLabel, type HistoryTab } from './commit-model.ts'
32
32
  import { ReadQueue } from './read-queue.ts'
@@ -44,6 +44,16 @@ import {
44
44
  } from '../vsc/kit.tsx'
45
45
 
46
46
  const ROW_H = 22
47
+
48
+ /**
49
+ * Last `commitFocus` request consumed by ANY mounted panel instance.
50
+ *
51
+ * The request lives in the store until overwritten, and the panel re-renders
52
+ * whenever the log refreshes; without this module-level watermark a click on
53
+ * blame would be replayed over the user's later manual selection (and across
54
+ * repository switches). Same rule as `revealRequest`/`terminalRequest`.
55
+ */
56
+ let consumedCommitFocusId = 0
47
57
  const LANE_W = 13
48
58
  const PAD_X = 9
49
59
  const LANE_COLORS = ['#e2b714', '#4ec9b0', '#58a6ff', '#d2a8ff', '#ff7b72', '#79c0ff', '#7ee787', '#ffa657']
@@ -207,8 +217,30 @@ interface CommitPatchState {
207
217
  error?: string
208
218
  }
209
219
 
220
+ /**
221
+ * The store fields this panel reads — and only those.
222
+ *
223
+ * Same reasoning as `ScmPanel`'s slice: the commit graph (up to `GIT_LOG_MAX`
224
+ * rows) and the pane below it used to be rebuilt on EVERY store publish, which
225
+ * includes saves, git refreshes and rail switches that this view cannot show.
226
+ * The slice below is what a graph/pane actually depends on: the repository
227
+ * identity the log is read for, the branch pill, and the actions.
228
+ */
229
+ const selectHistoryStore = (snapshot: ExplorerValue) => ({
230
+ t: snapshot.t,
231
+ lang: snapshot.lang,
232
+ alias: snapshot.alias,
233
+ repoRoot: snapshot.repoRoot,
234
+ head: snapshot.head,
235
+ afterWrite: snapshot.afterWrite,
236
+ openCommitFile: snapshot.openCommitFile,
237
+ revealInExplorer: snapshot.revealInExplorer,
238
+ openTerminalAt: snapshot.openTerminalAt,
239
+ commitFocus: snapshot.commitFocus,
240
+ })
241
+
210
242
  export function HistoryPanel(): ReactNode {
211
- const store = useExplorer()
243
+ const store = useExplorerSelector(selectHistoryStore, shallowEqual)
212
244
  const { t, lang, alias, repoRoot } = store
213
245
  const [commits, setCommits] = useState<GitCommit[]>([])
214
246
  /**
@@ -328,6 +360,32 @@ export function HistoryPanel(): ReactNode {
328
360
  setFocusPath(undefined)
329
361
  }, [repoKey])
330
362
 
363
+ // Blame / file-history entries only know a hash: the editor asks the store to
364
+ // show it here, and the log above owns the row object the detail pane needs.
365
+ // Declared AFTER the repository-switch reset so a first mount cannot clear the
366
+ // selection that this request just set.
367
+ useEffect(() => {
368
+ const request = store.commitFocus
369
+ if (request === undefined) return
370
+ if (request.id === consumedCommitFocusId) return
371
+ consumedCommitFocusId = request.id
372
+ setSelectedHash(request.hash)
373
+ setFocusPath(undefined)
374
+ // Blame can point at a commit older than the loaded graph window; fetch its
375
+ // header so the detail pane still opens instead of selecting nothing.
376
+ const live = rows.some(commit => commit.hash === request.hash)
377
+ if (live || selectedSnapshot?.hash === request.hash || alias === '' || repoRoot === undefined) return
378
+ let cancelled = false
379
+ void loadCommit(alias, repoRoot, request.hash)
380
+ .then((commit) => {
381
+ if (!cancelled && commit !== undefined) setSelectedSnapshot(commit)
382
+ })
383
+ .catch(() => {
384
+ // A stale/invalid hash is not worth a toast: the rail is still usable.
385
+ })
386
+ return () => { cancelled = true }
387
+ }, [store.commitFocus?.id, rows, selectedSnapshot?.hash, alias, repoRoot])
388
+
331
389
  // Message + file list: what 提交详情 and 内容 need. The patch is NOT read here
332
390
  // (see the lazy effect below), so clicking through commits stays cheap.
333
391
  useEffect(() => {
@@ -136,7 +136,7 @@ export function RepoPicker(props: {
136
136
 
137
137
  return (
138
138
  <div className="rvs-modal-mask" onMouseDown={(e) => { if (e.target === e.currentTarget) props.onClose() }}>
139
- <div className="rvs-modal-box rvs-repopick" role="dialog" aria-label={t('scm.pickTitle')}>
139
+ <div className="rvs-modal-box rvs-repopick" role="dialog" aria-modal="true" aria-label={t('scm.pickTitle')}>
140
140
  <div className="rvs-modal-title">
141
141
  {t('scm.pickTitle')}
142
142
  <IconButton title={t('common.close')} onClick={props.onClose}><IconClose size={13} /></IconButton>