dsh-remote-vs 0.21.1 → 0.23.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 +489 -473
- package/README.md +434 -424
- package/cordis.patch.yml +13 -5
- package/lib/client.js +946 -256
- package/lib/index.js +187 -15
- package/lib/p2-router-fs.js +6 -7
- package/lib/types/changes/recorder.d.ts +21 -0
- package/lib/types/changes/status.d.ts +41 -1
- package/lib/types/changes/text-diff.d.ts +18 -0
- package/lib/types/client/changes/ChangesDock.d.ts +9 -2
- package/lib/types/client/changes/model.d.ts +3 -1
- package/lib/types/client/changes/review-state.d.ts +67 -0
- package/lib/types/client/notices.d.ts +35 -0
- package/lib/types/client/store.d.ts +51 -0
- package/lib/types/client/vsc/change-marks.d.ts +17 -0
- package/lib/types/client/vsc/kit.d.ts +9 -0
- package/lib/types/deploy.d.ts +28 -2
- package/lib/types/notices.d.ts +22 -0
- package/lib/types/p2/router-fs.d.ts +4 -5
- package/lib/types/p2/worlds.d.ts +10 -0
- package/lib/types/protocol.d.ts +37 -1
- package/lib/{worlds-DSzyajOB.js → worlds-DXdP4SMn.js} +80 -4
- package/package.json +37 -37
- package/src/changes/recorder.ts +93 -28
- package/src/changes/status.ts +69 -2
- package/src/changes/text-diff.ts +42 -0
- package/src/client/DirectoryFlow.tsx +65 -5
- package/src/client/api.ts +5 -0
- package/src/client/changes/ChangesDock.tsx +241 -39
- package/src/client/changes/changes.css +122 -9
- package/src/client/changes/model.ts +106 -22
- package/src/client/changes/review-state.ts +133 -0
- package/src/client/i18n.ts +48 -8
- package/src/client/index.tsx +24 -5
- package/src/client/notices.ts +86 -0
- package/src/client/store.tsx +186 -2
- package/src/client/vsc/change-marks.ts +39 -6
- package/src/client/vsc/kit.tsx +16 -1
- package/src/client/vsc/vsc.css +23 -0
- package/src/deploy.ts +38 -2
- package/src/http.ts +12 -1
- package/src/notices.ts +37 -0
- package/src/p2/router-fs.ts +5 -6
- package/src/p2/worlds.ts +46 -2
- package/src/protocol.ts +37 -1
- package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.2-rc.4-linux-x64.helper.json +19 -0
- package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.2-rc.4-linux-x64.tar.gz +4 -0
- package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.2-rc.4-linux-x64.tar.gz.sha256 +1 -0
- package/vendor/dsh-remote-helpers/ssh-helper-runtime-deps.patch +14 -0
- package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.1-alpha.2-linux-x64.helper.json +0 -16
- package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.1-alpha.2-linux-x64.tar.gz +0 -4
- package/vendor/dsh-remote-helpers/dsh-ssh-helper-0.2.1-alpha.2-linux-x64.tar.gz.sha256 +0 -1
|
@@ -12,8 +12,15 @@
|
|
|
12
12
|
* written with `node:fs`), which the probe measured as 58 remote sessions with
|
|
13
13
|
* zero change events.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* Three things happen here, and they are deliberately different in kind:
|
|
16
|
+
* - a row's LEFT click opens the file and hands the editor the same hunks, so the
|
|
17
|
+
* changed lines are painted in place;
|
|
18
|
+
* - a row's RIGHT click offers the writes ("revert everything this session did to
|
|
19
|
+
* this file", "undo a tracked creation") plus the navigation shortcuts. The
|
|
20
|
+
* host decides which of those exist (`RemoteChangedFile.revert`), because only
|
|
21
|
+
* git knows whether a creation has a copy to fall back on;
|
|
22
|
+
* - the ✓ on a row is a LOCAL review note (`review-state.ts`): it writes nothing,
|
|
23
|
+
* it is what makes a thirty-file refactor converge.
|
|
17
24
|
*/
|
|
18
25
|
|
|
19
26
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
@@ -25,8 +32,10 @@ import {
|
|
|
25
32
|
openRemoteFileInBinding,
|
|
26
33
|
refreshAll,
|
|
27
34
|
remoteOpenBindings,
|
|
35
|
+
revertFileChanges,
|
|
28
36
|
sessionRepoSubdir,
|
|
29
37
|
setFollowSession,
|
|
38
|
+
setView,
|
|
30
39
|
useExplorer,
|
|
31
40
|
workspaceMatchesSession,
|
|
32
41
|
} from '../store.tsx'
|
|
@@ -34,14 +43,32 @@ import { bindingForChangedFile } from '../remote-file-open-target.ts'
|
|
|
34
43
|
import { useRemoteChatTarget } from '../use-remote-chat-target.ts'
|
|
35
44
|
import type { RemoteChangedFile, RemoteChangesSummary } from '../../protocol.ts'
|
|
36
45
|
import { EMPTY_CHANGE_SET, changeSetFromHunks, type ChangeSet } from './model.ts'
|
|
46
|
+
import {
|
|
47
|
+
isReviewed,
|
|
48
|
+
parseReviewed,
|
|
49
|
+
pruneReviewed,
|
|
50
|
+
reviewedCount,
|
|
51
|
+
serializeReviewed,
|
|
52
|
+
setAllReviewed,
|
|
53
|
+
toggleReviewed as toggleReviewedEntry,
|
|
54
|
+
} from './review-state.ts'
|
|
37
55
|
import { setUndoContext } from './undo-context.ts'
|
|
38
56
|
import { forgetChangeOrigin, publishableUndoOrigin, rememberChangeOrigin } from './undo-target.ts'
|
|
39
|
-
import { FileIcon } from '../vsc/kit.tsx'
|
|
57
|
+
import { ContextMenu, FileIcon, copyText, useContextMenu } from '../vsc/kit.tsx'
|
|
40
58
|
import './changes.css'
|
|
41
59
|
|
|
42
60
|
/** How often an open panel re-reads the ledger (the host refreshes it per turn). */
|
|
43
61
|
const POLL_MS = 3000
|
|
44
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Where the review marks are remembered, per session.
|
|
65
|
+
*
|
|
66
|
+
* `localStorage`, like the port-forward rules: this is a note about the user's own
|
|
67
|
+
* reading progress, not a fact about the remote tree, so it must survive a page
|
|
68
|
+
* reload without becoming a protocol field nobody else needs.
|
|
69
|
+
*/
|
|
70
|
+
const REVIEW_STORAGE_PREFIX = 'rvs.changes.reviewed.'
|
|
71
|
+
|
|
45
72
|
/**
|
|
46
73
|
* How many polls between two follow retries (5 × 3 s = one probe every 15 s).
|
|
47
74
|
*
|
|
@@ -79,6 +106,17 @@ function splitDisplay(display: string): { dir: string; name: string } {
|
|
|
79
106
|
return at < 0 ? { dir: '', name: display } : { dir: display.slice(0, at + 1), name: display.slice(at + 1) }
|
|
80
107
|
}
|
|
81
108
|
|
|
109
|
+
/** Read one session's review marks, tolerating a storage that refuses to answer. */
|
|
110
|
+
function loadReviewed(sessionId: string | undefined): Record<string, 1> {
|
|
111
|
+
if (sessionId === undefined || sessionId === '') return {}
|
|
112
|
+
try {
|
|
113
|
+
return parseReviewed(window.localStorage.getItem(`${REVIEW_STORAGE_PREFIX}${sessionId}`))
|
|
114
|
+
} catch {
|
|
115
|
+
// Private mode / disabled storage: the marks simply do not persist.
|
|
116
|
+
return {}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
82
120
|
export function ChangesDock(props: ChangesDockProps): React.ReactNode {
|
|
83
121
|
const explorer = useExplorer()
|
|
84
122
|
// The dock is a second surface of the same store as the explorer, and it can
|
|
@@ -104,9 +142,13 @@ export function ChangesDock(props: ChangesDockProps): React.ReactNode {
|
|
|
104
142
|
// push the composer off the screen.
|
|
105
143
|
const [collapsed, setCollapsed] = useState(true)
|
|
106
144
|
const [busy, setBusy] = useState<string | undefined>(undefined)
|
|
145
|
+
/** This session's local review marks (see `review-state.ts`). */
|
|
146
|
+
const [reviewed, setReviewed] = useState<Record<string, 1>>(() => loadReviewed(sessionId))
|
|
107
147
|
const alive = useRef(true)
|
|
108
148
|
const currentSession = useRef(sessionId)
|
|
109
149
|
currentSession.current = sessionId
|
|
150
|
+
const rowMenu = useContextMenu()
|
|
151
|
+
const reviewMenu = useContextMenu()
|
|
110
152
|
// The Source Control panel's repository directory, resolved at call time: it is
|
|
111
153
|
// the user's explicit answer to "which repository in this workspace", and it
|
|
112
154
|
// outranks the host's one-level guess. A ref (not a value) so a change made
|
|
@@ -150,6 +192,12 @@ export function ChangesDock(props: ChangesDockProps): React.ReactNode {
|
|
|
150
192
|
}
|
|
151
193
|
}, [load])
|
|
152
194
|
|
|
195
|
+
// A different conversation has different marks: reload them instead of carrying
|
|
196
|
+
// one session's ✓ onto another's files.
|
|
197
|
+
useEffect(() => {
|
|
198
|
+
setReviewed(loadReviewed(sessionId))
|
|
199
|
+
}, [sessionId])
|
|
200
|
+
|
|
153
201
|
/**
|
|
154
202
|
* Publish the revert coordinates for the tab the user is LOOKING AT.
|
|
155
203
|
*
|
|
@@ -233,6 +281,25 @@ export function ChangesDock(props: ChangesDockProps): React.ReactNode {
|
|
|
233
281
|
void followSessionWorkspace({ sessionId, alias: summary.alias, remoteRoot: summary.root })
|
|
234
282
|
}, [sessionId, summary, chatTarget.sessionId])
|
|
235
283
|
|
|
284
|
+
const files = useMemo(() => summary?.files ?? [], [summary])
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Resolve the binding a row belongs to, with one refresh for a cold page.
|
|
288
|
+
*
|
|
289
|
+
* The store may still be loading its workspace table on a cold page, so a miss
|
|
290
|
+
* is worth one refresh before giving up.
|
|
291
|
+
*/
|
|
292
|
+
const bindingOf = useCallback(async (file: RemoteChangedFile) => {
|
|
293
|
+
if (summary === null) return undefined
|
|
294
|
+
let binding = bindingForChangedFile(remoteOpenBindings(), summary, file.path)
|
|
295
|
+
if (binding === undefined) {
|
|
296
|
+
refreshAll()
|
|
297
|
+
await new Promise(resolve => { window.setTimeout(resolve, 300) })
|
|
298
|
+
binding = bindingForChangedFile(remoteOpenBindings(), summary, file.path)
|
|
299
|
+
}
|
|
300
|
+
return binding
|
|
301
|
+
}, [summary])
|
|
302
|
+
|
|
236
303
|
/** Open one listed file in the remote editor with its change marks. */
|
|
237
304
|
const openChanged = useCallback(async (file: RemoteChangedFile): Promise<void> => {
|
|
238
305
|
if (sessionId === undefined || summary === null) return
|
|
@@ -242,24 +309,14 @@ export function ChangesDock(props: ChangesDockProps): React.ReactNode {
|
|
|
242
309
|
if (!alive.current) return
|
|
243
310
|
const stamp = `${file.path}@${summary.at}@${summary.turn}`
|
|
244
311
|
const set: ChangeSet = diff !== null && diff.kind === 'text'
|
|
245
|
-
? changeSetFromHunks(diff.hunks, stamp)
|
|
312
|
+
? changeSetFromHunks(diff.hunks, stamp, diff.patch)
|
|
246
313
|
: { ...EMPTY_CHANGE_SET, stamp }
|
|
247
|
-
// The store may still be loading its workspace table on a cold page, so a
|
|
248
|
-
// miss is worth one refresh before giving up on the click. Read through
|
|
249
|
-
// the snapshot accessor, not the render-time props, so the retry actually
|
|
250
|
-
// sees what the load wrote.
|
|
251
|
-
//
|
|
252
314
|
// Resolved by the session's REMOTE root, never by the alias alone: one
|
|
253
315
|
// alias carries several bindings (two workspaces can live on one alias),
|
|
254
316
|
// and the alias-only form picked whichever came first —
|
|
255
317
|
// the file opened while the tree and the selector stayed on the other
|
|
256
318
|
// workspace. That was the reported bug.
|
|
257
|
-
|
|
258
|
-
if (binding === undefined) {
|
|
259
|
-
refreshAll()
|
|
260
|
-
await new Promise(resolve => { window.setTimeout(resolve, 300) })
|
|
261
|
-
binding = bindingForChangedFile(remoteOpenBindings(), summary, file.path)
|
|
262
|
-
}
|
|
319
|
+
const binding = await bindingOf(file)
|
|
263
320
|
if (binding === undefined) {
|
|
264
321
|
explorer.info(t('changes.noWorkspace'))
|
|
265
322
|
return
|
|
@@ -284,9 +341,94 @@ export function ChangesDock(props: ChangesDockProps): React.ReactNode {
|
|
|
284
341
|
} finally {
|
|
285
342
|
if (alive.current) setBusy(undefined)
|
|
286
343
|
}
|
|
287
|
-
}, [explorer, sessionId, summary, t])
|
|
344
|
+
}, [bindingOf, explorer, sessionId, summary, t])
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Revert EVERYTHING this session did to one listed file.
|
|
348
|
+
*
|
|
349
|
+
* The write itself (gates, patch, confirmation, refresh) lives in the store's
|
|
350
|
+
* `revertFileChanges`: it is the same class of remote write as the hover-revert
|
|
351
|
+
* and must obey the same rules. This callback only resolves the coordinates the
|
|
352
|
+
* row stands for.
|
|
353
|
+
*/
|
|
354
|
+
const revertRow = useCallback(async (file: RemoteChangedFile): Promise<void> => {
|
|
355
|
+
if (sessionId === undefined || summary === null || file.revert === undefined) return
|
|
356
|
+
const binding = await bindingOf(file)
|
|
357
|
+
if (binding === undefined) {
|
|
358
|
+
explorer.info(t('changes.noWorkspace'))
|
|
359
|
+
return
|
|
360
|
+
}
|
|
361
|
+
setBusy(file.path)
|
|
362
|
+
try {
|
|
363
|
+
await revertFileChanges({
|
|
364
|
+
sessionId,
|
|
365
|
+
bindingId: binding.id,
|
|
366
|
+
alias: binding.alias,
|
|
367
|
+
root: summary.root,
|
|
368
|
+
path: file.path,
|
|
369
|
+
display: file.display,
|
|
370
|
+
mode: file.revert,
|
|
371
|
+
})
|
|
372
|
+
} finally {
|
|
373
|
+
if (alive.current) setBusy(undefined)
|
|
374
|
+
}
|
|
375
|
+
}, [bindingOf, explorer, sessionId, summary, t])
|
|
376
|
+
|
|
377
|
+
const toggleReviewed = useCallback((file: RemoteChangedFile): void => {
|
|
378
|
+
setReviewed(previous => toggleReviewedEntry(files, previous, file))
|
|
379
|
+
}, [files])
|
|
380
|
+
|
|
381
|
+
// Persist the marks whenever they change. A storage that refuses (private mode)
|
|
382
|
+
// must cost nothing but persistence — never a broken panel.
|
|
383
|
+
useEffect(() => {
|
|
384
|
+
if (sessionId === undefined || sessionId === '') return
|
|
385
|
+
try {
|
|
386
|
+
window.localStorage.setItem(`${REVIEW_STORAGE_PREFIX}${sessionId}`, serializeReviewed(reviewed))
|
|
387
|
+
} catch {
|
|
388
|
+
// Ignore: see above.
|
|
389
|
+
}
|
|
390
|
+
}, [reviewed, sessionId])
|
|
391
|
+
|
|
392
|
+
// Drop marks for rows that are gone (or whose counts changed). Without this a
|
|
393
|
+
// path that leaves and comes back would show a ✓ nobody gave it.
|
|
394
|
+
useEffect(() => {
|
|
395
|
+
setReviewed(previous => {
|
|
396
|
+
const next = pruneReviewed(files, previous)
|
|
397
|
+
// A prune only ever removes entries, so equal length means "identical".
|
|
398
|
+
return Object.keys(next).length === Object.keys(previous).length ? previous : next
|
|
399
|
+
})
|
|
400
|
+
}, [files])
|
|
401
|
+
|
|
402
|
+
const done = reviewedCount(files, reviewed)
|
|
403
|
+
|
|
404
|
+
const openRowMenu = useCallback((event: React.MouseEvent, file: RemoteChangedFile): void => {
|
|
405
|
+
event.preventDefault()
|
|
406
|
+
event.stopPropagation()
|
|
407
|
+
const cannotRevert = file.revert === undefined
|
|
408
|
+
rowMenu.open(event.clientX, event.clientY, [
|
|
409
|
+
{ label: t('changes.menuOpen'), onSelect: () => { void openChanged(file) } },
|
|
410
|
+
{
|
|
411
|
+
label: file.revert === 'delete' ? t('changes.revertCreation') : t('changes.revertFile'),
|
|
412
|
+
danger: true,
|
|
413
|
+
disabled: cannotRevert,
|
|
414
|
+
...(cannotRevert ? { hint: t('changes.revertNotPossible') } : {}),
|
|
415
|
+
separated: true,
|
|
416
|
+
onSelect: () => { void revertRow(file) },
|
|
417
|
+
},
|
|
418
|
+
{ label: t('changes.openInScm'), separated: true, onSelect: () => { setView('scm') } },
|
|
419
|
+
{ label: t('changes.copyPath'), onSelect: () => { void copyText(file.path) } },
|
|
420
|
+
])
|
|
421
|
+
}, [openChanged, revertRow, rowMenu, t])
|
|
422
|
+
|
|
423
|
+
/** The header counter doubles as the "mark all / clear all" menu. */
|
|
424
|
+
const openReviewMenu = useCallback((event: React.MouseEvent): void => {
|
|
425
|
+
const rect = (event.currentTarget as HTMLElement).getBoundingClientRect()
|
|
426
|
+
reviewMenu.open(rect.left, rect.bottom + 4, [
|
|
427
|
+
{ label: t('changes.reviewAll'), onSelect: () => { setReviewed(setAllReviewed(files, true)) } },
|
|
428
|
+
{ label: t('changes.reviewNone'), onSelect: () => { setReviewed(setAllReviewed(files, false)) } },
|
|
429
|
+
])
|
|
430
|
+
}, [files, reviewMenu, t])
|
|
288
431
|
|
|
289
|
-
const files = summary?.files ?? []
|
|
290
432
|
const activeTab = explorer.tabs.find(candidate => candidate.id === explorer.activeTabId)
|
|
291
433
|
const visible = useMemo(() => {
|
|
292
434
|
if (summary === null) return false
|
|
@@ -318,6 +460,16 @@ export function ChangesDock(props: ChangesDockProps): React.ReactNode {
|
|
|
318
460
|
<span className="rvs-chg-del">−{summary?.deleted ?? 0}</span>
|
|
319
461
|
</span>
|
|
320
462
|
)}
|
|
463
|
+
{done > 0 && (
|
|
464
|
+
<button
|
|
465
|
+
type="button"
|
|
466
|
+
className="rvs-changes-reviewed"
|
|
467
|
+
title={t('changes.reviewMenu')}
|
|
468
|
+
onClick={openReviewMenu}
|
|
469
|
+
>
|
|
470
|
+
{t('changes.reviewCount').replace('{done}', String(done)).replace('{total}', String(files.length))}
|
|
471
|
+
</button>
|
|
472
|
+
)}
|
|
321
473
|
{summary?.pending === true && <span className="rvs-changes-pending">{t('changes.pending')}</span>}
|
|
322
474
|
<span className="rvs-changes-spacer" />
|
|
323
475
|
{stale && <span className="rvs-changes-stale" title={t('changes.staleHint')}>{t('changes.stale')}</span>}
|
|
@@ -339,37 +491,87 @@ export function ChangesDock(props: ChangesDockProps): React.ReactNode {
|
|
|
339
491
|
)}
|
|
340
492
|
{files.map(file => {
|
|
341
493
|
const { dir, name } = splitDisplay(file.display)
|
|
494
|
+
const marked = isReviewed(file, reviewed)
|
|
342
495
|
return (
|
|
343
|
-
<
|
|
344
|
-
type="button"
|
|
496
|
+
<div
|
|
345
497
|
key={file.path}
|
|
346
498
|
className={`rvs-chg-row${busy === file.path ? ' rvs-chg-loading' : ''}`}
|
|
347
|
-
|
|
348
|
-
onClick={() => { void openChanged(file) }}
|
|
499
|
+
data-reviewed={marked ? '1' : '0'}
|
|
349
500
|
>
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
<
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
501
|
+
{/*
|
|
502
|
+
Two buttons, not one: a whole-row <button> cannot legally contain
|
|
503
|
+
the review toggle, and the toggle must not open the file. The
|
|
504
|
+
status letter is decoration here — its meaning is in the title.
|
|
505
|
+
*/}
|
|
506
|
+
<button
|
|
507
|
+
type="button"
|
|
508
|
+
className="rvs-chg-open"
|
|
509
|
+
title={`${file.path}\n${statusWord(file, t)}`}
|
|
510
|
+
onClick={() => { void openChanged(file) }}
|
|
511
|
+
onContextMenu={(event) => { openRowMenu(event, file) }}
|
|
512
|
+
>
|
|
513
|
+
<span className="rvs-chg-status" data-status={file.status ?? 'M'} aria-hidden="true">
|
|
514
|
+
{file.status ?? 'M'}
|
|
515
|
+
</span>
|
|
516
|
+
<span className="rvs-chg-icon" aria-hidden="true"><FileIcon path={file.display} size={14} /></span>
|
|
517
|
+
<span className="rvs-chg-path">
|
|
518
|
+
<span className="rvs-chg-dir">{dir}</span>
|
|
519
|
+
<span className="rvs-chg-name">{name}</span>
|
|
520
|
+
</span>
|
|
521
|
+
<span className="rvs-chg-counts">
|
|
522
|
+
{file.oversized === true
|
|
523
|
+
? <span className="rvs-chg-note">{t('changes.oversized')}</span>
|
|
524
|
+
: file.binary === true
|
|
525
|
+
? <span className="rvs-chg-note">{t('changes.binary')}</span>
|
|
526
|
+
: (
|
|
527
|
+
<>
|
|
528
|
+
<span className="rvs-chg-add">+{file.added}</span>
|
|
529
|
+
<span className="rvs-chg-del">−{file.deleted}</span>
|
|
530
|
+
</>
|
|
531
|
+
)}
|
|
532
|
+
</span>
|
|
533
|
+
</button>
|
|
534
|
+
<button
|
|
535
|
+
type="button"
|
|
536
|
+
className={`rvs-chg-review${marked ? ' is-on' : ''}`}
|
|
537
|
+
aria-pressed={marked}
|
|
538
|
+
title={marked ? t('changes.unmarkReviewed') : t('changes.markReviewed')}
|
|
539
|
+
onClick={() => { toggleReviewed(file) }}
|
|
540
|
+
>{marked ? '✓' : ''}</button>
|
|
541
|
+
</div>
|
|
368
542
|
)
|
|
369
543
|
})}
|
|
370
544
|
{summary?.truncated === true && <div className="rvs-changes-note">{t('changes.truncated')}</div>}
|
|
545
|
+
{/*
|
|
546
|
+
Which paths the new-file scan skipped. Stated, never silent: a file
|
|
547
|
+
the user expected to see must not be missing without a reason, and
|
|
548
|
+
the SCM panel is where every path (build output included) is listed.
|
|
549
|
+
*/}
|
|
550
|
+
{(summary?.excludedDirs?.length ?? 0) > 0 && (
|
|
551
|
+
<div className="rvs-changes-note" title={summary?.excludedDirs?.join(', ')}>
|
|
552
|
+
{t('changes.excluded').replace('{dirs}', summary?.excludedDirs?.join(', ') ?? '')}
|
|
553
|
+
</div>
|
|
554
|
+
)}
|
|
371
555
|
</div>
|
|
372
556
|
)}
|
|
557
|
+
{rowMenu.menu !== undefined && (
|
|
558
|
+
<ContextMenu
|
|
559
|
+
x={rowMenu.menu.x}
|
|
560
|
+
y={rowMenu.menu.y}
|
|
561
|
+
entries={rowMenu.menu.entries}
|
|
562
|
+
onClose={rowMenu.close}
|
|
563
|
+
className="rvs-menu-dock"
|
|
564
|
+
/>
|
|
565
|
+
)}
|
|
566
|
+
{reviewMenu.menu !== undefined && (
|
|
567
|
+
<ContextMenu
|
|
568
|
+
x={reviewMenu.menu.x}
|
|
569
|
+
y={reviewMenu.menu.y}
|
|
570
|
+
entries={reviewMenu.menu.entries}
|
|
571
|
+
onClose={reviewMenu.close}
|
|
572
|
+
className="rvs-menu-dock"
|
|
573
|
+
/>
|
|
574
|
+
)}
|
|
373
575
|
</div>
|
|
374
576
|
)
|
|
375
577
|
}
|
|
@@ -137,21 +137,39 @@
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
/*
|
|
140
|
-
* One file per row: type icon, path, counts
|
|
140
|
+
* One file per row: status letter, type icon, path, counts, review toggle.
|
|
141
141
|
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
142
|
+
* The row is a flex CONTAINER holding two buttons (open + review): a whole-row
|
|
143
|
+
* <button> cannot legally contain the toggle, and clicking the toggle must not
|
|
144
|
+
* also open the file. Every part is nowrap and the path is the only flexible
|
|
145
|
+
* one, so a long remote path ellipsizes in the middle of the row instead of
|
|
146
|
+
* pushing the counts out of view or wrapping the row into a paragraph.
|
|
146
147
|
*/
|
|
147
148
|
.rvs-chg-row {
|
|
148
149
|
display: flex;
|
|
149
150
|
flex: 0 0 auto;
|
|
150
151
|
align-items: center;
|
|
151
|
-
gap: 6px;
|
|
152
152
|
width: 100%;
|
|
153
|
+
min-width: 0;
|
|
154
|
+
border-radius: 5px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.rvs-chg-row:hover { background-color: var(--rvs-chg-hover); }
|
|
158
|
+
|
|
159
|
+
.rvs-chg-row.rvs-chg-loading { opacity: .55; }
|
|
160
|
+
|
|
161
|
+
/* Reviewed rows recede a little, but hover brings them back to full contrast so
|
|
162
|
+
a row is never unreadable at the moment the user is about to act on it. */
|
|
163
|
+
.rvs-chg-row[data-reviewed='1']:not(:hover) .rvs-chg-open { opacity: .58; }
|
|
164
|
+
|
|
165
|
+
.rvs-chg-open {
|
|
166
|
+
display: flex;
|
|
167
|
+
flex: 1 1 auto;
|
|
168
|
+
align-items: center;
|
|
169
|
+
gap: 6px;
|
|
170
|
+
min-width: 0;
|
|
153
171
|
min-height: 24px;
|
|
154
|
-
padding: 1px 6px;
|
|
172
|
+
padding: 1px 4px 1px 6px;
|
|
155
173
|
border: none;
|
|
156
174
|
border-radius: 5px;
|
|
157
175
|
background: transparent;
|
|
@@ -163,9 +181,81 @@
|
|
|
163
181
|
cursor: pointer;
|
|
164
182
|
}
|
|
165
183
|
|
|
166
|
-
|
|
184
|
+
/*
|
|
185
|
+
* Review toggle. Hidden until the row is hovered (or focused by keyboard) so the
|
|
186
|
+
* list stays quiet, and always visible once the mark is ON — that ✓ is the only
|
|
187
|
+
* evidence the mark exists.
|
|
188
|
+
*/
|
|
189
|
+
.rvs-chg-review {
|
|
190
|
+
flex: 0 0 auto;
|
|
191
|
+
width: 18px;
|
|
192
|
+
height: 18px;
|
|
193
|
+
margin-right: 2px;
|
|
194
|
+
padding: 0;
|
|
195
|
+
border: none;
|
|
196
|
+
border-radius: 4px;
|
|
197
|
+
background: transparent;
|
|
198
|
+
color: var(--rvs-chg-fg3);
|
|
199
|
+
font-size: 11px;
|
|
200
|
+
line-height: 18px;
|
|
201
|
+
text-align: center;
|
|
202
|
+
cursor: pointer;
|
|
203
|
+
opacity: 0;
|
|
204
|
+
}
|
|
167
205
|
|
|
168
|
-
.rvs-chg-row.rvs-chg-
|
|
206
|
+
.rvs-chg-row:hover .rvs-chg-review,
|
|
207
|
+
.rvs-chg-review:focus-visible,
|
|
208
|
+
.rvs-chg-review.is-on { opacity: 1; }
|
|
209
|
+
|
|
210
|
+
.rvs-chg-review:hover { background-color: var(--rvs-chg-hover); color: var(--rvs-chg-fg); }
|
|
211
|
+
|
|
212
|
+
.rvs-chg-review.is-on { color: var(--rvs-chg-add); }
|
|
213
|
+
|
|
214
|
+
/*
|
|
215
|
+
* Status letter (A/M/D/R/C/T/U).
|
|
216
|
+
*
|
|
217
|
+
* A one-character column instead of a second tooltip: the row already shows the
|
|
218
|
+
* counts, and "was this file added, deleted or renamed" is the other question a
|
|
219
|
+
* reviewer asks. Colour follows the same vocabulary as the diff marks.
|
|
220
|
+
*/
|
|
221
|
+
.rvs-chg-status {
|
|
222
|
+
flex: 0 0 auto;
|
|
223
|
+
width: 10px;
|
|
224
|
+
font-variant-numeric: tabular-nums;
|
|
225
|
+
font-size: 10px;
|
|
226
|
+
font-weight: 600;
|
|
227
|
+
text-align: center;
|
|
228
|
+
color: var(--rvs-chg-fg3);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.rvs-chg-status[data-status='A'] { color: var(--rvs-chg-add); }
|
|
232
|
+
.rvs-chg-status[data-status='M'] { color: var(--rvs-chg-mod); }
|
|
233
|
+
.rvs-chg-status[data-status='D'] { color: var(--rvs-chg-del); }
|
|
234
|
+
.rvs-chg-status[data-status='R'] { color: var(--rvs-chg-info); }
|
|
235
|
+
.rvs-chg-status[data-status='C'] { color: var(--rvs-chg-info); }
|
|
236
|
+
.rvs-chg-status[data-status='U'] { color: var(--rvs-chg-del); }
|
|
237
|
+
|
|
238
|
+
/* The reviewed counter in the header doubles as the mark-all / clear menu. */
|
|
239
|
+
.rvs-changes-reviewed {
|
|
240
|
+
flex: 0 0 auto;
|
|
241
|
+
padding: 0 5px;
|
|
242
|
+
height: 18px;
|
|
243
|
+
border: none;
|
|
244
|
+
border-radius: 9px;
|
|
245
|
+
background: transparent;
|
|
246
|
+
color: var(--rvs-chg-fg3);
|
|
247
|
+
font: inherit;
|
|
248
|
+
font-size: 11px;
|
|
249
|
+
font-variant-numeric: tabular-nums;
|
|
250
|
+
line-height: 18px;
|
|
251
|
+
white-space: nowrap;
|
|
252
|
+
cursor: pointer;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.rvs-changes-reviewed:hover {
|
|
256
|
+
background-color: var(--rvs-chg-hover);
|
|
257
|
+
color: var(--rvs-chg-fg);
|
|
258
|
+
}
|
|
169
259
|
|
|
170
260
|
/* File-type icon: the host's icon theme when the shell provides one, else the
|
|
171
261
|
plugin's own SVG set (see vsc/kit.tsx FileIcon). */
|
|
@@ -228,3 +318,26 @@ body:not([data-ds-dark-theme]) .rvs-changes {
|
|
|
228
318
|
--rvs-chg-mod: #9a6700;
|
|
229
319
|
--rvs-chg-info: #0969da;
|
|
230
320
|
}
|
|
321
|
+
|
|
322
|
+
/*
|
|
323
|
+
* The row / header menus opened from THIS panel.
|
|
324
|
+
*
|
|
325
|
+
* `ContextMenu` portals to `document.body`, so neither `.rvs-changes`' palette
|
|
326
|
+
* nor the `.rvs-root` variables are in scope: the menu would come up with no
|
|
327
|
+
* border and no hover feedback. The panel therefore hands the shared component
|
|
328
|
+
* the four variables it reads, under this class — one menu component, one visual
|
|
329
|
+
* language, and no restyling of the other surfaces' menus.
|
|
330
|
+
*/
|
|
331
|
+
.rvs-menu-dock {
|
|
332
|
+
--rvs-fg: var(--dsw-alias-label-primary, #e6e6e6);
|
|
333
|
+
--rvs-hover: var(--dsw-alias-interactive-bg-hover, rgba(127, 127, 127, .14));
|
|
334
|
+
--rvs-border: var(--dsw-alias-border-l1, rgba(127, 127, 127, .28));
|
|
335
|
+
--rvs-border2: var(--dsw-alias-border-l2, rgba(127, 127, 127, .38));
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
body:not([data-ds-dark-theme]) .rvs-menu-dock {
|
|
339
|
+
--rvs-fg: var(--dsw-alias-label-primary, #1f2328);
|
|
340
|
+
--rvs-hover: var(--dsw-alias-interactive-bg-hover, rgba(31, 35, 40, .07));
|
|
341
|
+
--rvs-border: var(--dsw-alias-border-l1, rgba(31, 35, 40, .16));
|
|
342
|
+
--rvs-border2: var(--dsw-alias-border-l1, rgba(31, 35, 40, .16));
|
|
343
|
+
}
|