dsh-diff-approval 0.16.0 → 0.18.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.md +15 -11
- package/README.zh.md +15 -11
- package/docs/images/file-list-collapsed.png +0 -0
- package/docs/images/file-list-collapsed.zh.png +0 -0
- package/docs/images/fullscreen.png +0 -0
- package/docs/images/fullscreen.zh.png +0 -0
- package/docs/images/pending-panel.png +0 -0
- package/docs/images/pending-panel.zh.png +0 -0
- package/lib/client.js +1760 -399
- package/lib/index.js +37 -3
- package/lib/types/client/ColorPicker.d.ts +23 -0
- package/lib/types/client/PendingPanel.d.ts +14 -2
- package/lib/types/client/conversation-access.d.ts +9 -0
- package/lib/types/client/locales.d.ts +58 -0
- package/lib/types/client/port.d.ts +2 -2
- package/lib/types/client/produced-diff.d.ts +27 -0
- package/lib/types/client/reference.d.ts +11 -0
- package/lib/types/client/settings.d.ts +45 -0
- package/lib/types/client/slots.d.ts +2 -7
- package/lib/types/client/store.d.ts +2 -4
- package/lib/types/client/whole-file-diff.d.ts +9 -0
- package/lib/types/types.d.ts +5 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1325,9 +1325,25 @@ function apply(ctx, config) {
|
|
|
1325
1325
|
fileText: void 0
|
|
1326
1326
|
});
|
|
1327
1327
|
persistSession();
|
|
1328
|
+
const fullyResolved = updatedOld === entry.newText;
|
|
1329
|
+
if (fullyResolved && blockTarget.removeWhenResolved === true) {
|
|
1330
|
+
store.remove(blockTarget.id);
|
|
1331
|
+
pushUndo(blockTarget.sessionId, {
|
|
1332
|
+
id: entry.id,
|
|
1333
|
+
path: entry.path,
|
|
1334
|
+
entry: afterEntry,
|
|
1335
|
+
fileText: void 0
|
|
1336
|
+
}, {
|
|
1337
|
+
id: entry.id,
|
|
1338
|
+
path: entry.path,
|
|
1339
|
+
entry: void 0,
|
|
1340
|
+
fileText: void 0
|
|
1341
|
+
});
|
|
1342
|
+
persistSession(true);
|
|
1343
|
+
}
|
|
1328
1344
|
return {
|
|
1329
1345
|
ok: true,
|
|
1330
|
-
value:
|
|
1346
|
+
value: fullyResolved ? {
|
|
1331
1347
|
outcome: "kept",
|
|
1332
1348
|
resolved: true
|
|
1333
1349
|
} : { outcome: "kept" }
|
|
@@ -1378,9 +1394,25 @@ function apply(ctx, config) {
|
|
|
1378
1394
|
}
|
|
1379
1395
|
if (undo !== void 0) pushUndo(blockTarget.sessionId, undo.before, undo.after);
|
|
1380
1396
|
persistSession();
|
|
1397
|
+
const fullyResolved = normalizeEol(updatedNew) === normalizeEol(entry.oldText);
|
|
1398
|
+
if (fullyResolved && blockTarget.removeWhenResolved === true) {
|
|
1399
|
+
store.remove(blockTarget.id);
|
|
1400
|
+
pushUndo(blockTarget.sessionId, {
|
|
1401
|
+
id: entry.id,
|
|
1402
|
+
path: entry.path,
|
|
1403
|
+
entry: afterEntry,
|
|
1404
|
+
fileText: void 0
|
|
1405
|
+
}, {
|
|
1406
|
+
id: entry.id,
|
|
1407
|
+
path: entry.path,
|
|
1408
|
+
entry: void 0,
|
|
1409
|
+
fileText: void 0
|
|
1410
|
+
});
|
|
1411
|
+
persistSession(true);
|
|
1412
|
+
}
|
|
1381
1413
|
return {
|
|
1382
1414
|
ok: true,
|
|
1383
|
-
value:
|
|
1415
|
+
value: fullyResolved ? {
|
|
1384
1416
|
outcome: "reverted",
|
|
1385
1417
|
resolved: true
|
|
1386
1418
|
} : { outcome: "reverted" }
|
|
@@ -1625,6 +1657,7 @@ function blockTargetOf(payload) {
|
|
|
1625
1657
|
newStart,
|
|
1626
1658
|
newEnd
|
|
1627
1659
|
].every((value) => typeof value === "number" && Number.isFinite(value))) return void 0;
|
|
1660
|
+
const removeWhenResolved = payload.removeWhenResolved;
|
|
1628
1661
|
return {
|
|
1629
1662
|
...target,
|
|
1630
1663
|
block: {
|
|
@@ -1632,7 +1665,8 @@ function blockTargetOf(payload) {
|
|
|
1632
1665
|
oldEnd,
|
|
1633
1666
|
newStart,
|
|
1634
1667
|
newEnd
|
|
1635
|
-
}
|
|
1668
|
+
},
|
|
1669
|
+
removeWhenResolved: typeof removeWhenResolved === "boolean" ? removeWhenResolved : void 0
|
|
1636
1670
|
};
|
|
1637
1671
|
}
|
|
1638
1672
|
/** Narrow a wire payload to one keep/revert target. */
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** A compact HSV color picker (saturation/value square + hue bar + hex/RGB
|
|
2
|
+
* input). Avoids the browser-native color dialog, which cannot be themed, so
|
|
3
|
+
* it matches DSH. Pure helpers are exported for testing. */
|
|
4
|
+
/** Parse `#rrggbb` / `#rgb` / `rrggbb` / `rgb(r,g,b)` into a normalised
|
|
5
|
+
* `#rrggbb`, or `undefined` when the text is not a color. */
|
|
6
|
+
export declare function parseColor(input: string): string | undefined;
|
|
7
|
+
/** Convert a `#rrggbb` hex to HSV (h 0-360, s 0-1, v 0-1). */
|
|
8
|
+
export declare function hexToHsv(hex: string): {
|
|
9
|
+
h: number;
|
|
10
|
+
s: number;
|
|
11
|
+
v: number;
|
|
12
|
+
};
|
|
13
|
+
/** Convert HSV (h 0-360, s 0-1, v 0-1) to a `#rrggbb` hex. */
|
|
14
|
+
export declare function hsvToHex(h: number, s: number, v: number): string;
|
|
15
|
+
/** A draggable HSV picker: saturation/value square + hue bar + a hex/RGB text
|
|
16
|
+
* input. `onChange` reports a normalised `#rrggbb`; `onClose` fires after a
|
|
17
|
+
* committed text value so the caller can close the popover. */
|
|
18
|
+
export declare function ColorPicker({ value, onChange, onClose, ariaLabel, }: {
|
|
19
|
+
value: string;
|
|
20
|
+
onChange: (hex: string) => void;
|
|
21
|
+
onClose?: () => void;
|
|
22
|
+
ariaLabel: string;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
@@ -7,6 +7,15 @@ import type { DiffApprovalKey } from './locales.ts';
|
|
|
7
7
|
import { computeWholeFileDiff } from './whole-file-diff.ts';
|
|
8
8
|
import type { IntraRun } from './whole-file-diff.ts';
|
|
9
9
|
import { highlightLines } from './highlight.ts';
|
|
10
|
+
/** Normalize a path for comparison: forward slashes, no trailing slash. */
|
|
11
|
+
export declare function normalizeDiffPath(p: string): string;
|
|
12
|
+
/** Whether a produced-file chip path and a pending file path refer to the same
|
|
13
|
+
* file, tolerant of separator style (\\ vs /) and of a workspace-relative vs
|
|
14
|
+
* absolute form. `chipPath` is typically the harness's workspace-relative
|
|
15
|
+
* forward-slash path; `filePath` is the host's absolute native-separator path.
|
|
16
|
+
* Matching is case-insensitive so a Windows drive/segment case difference does
|
|
17
|
+
* not miss the file the user clicked. */
|
|
18
|
+
export declare function diffPathsMatch(chipPath: string, filePath: string, workspacePath: string | undefined): boolean;
|
|
10
19
|
/** The dsh shell's sidebar auto-collapse breakpoint (ui-layout columns.ts):
|
|
11
20
|
* below it the sidebar auto-collapses, and the file list floats on the same
|
|
12
21
|
* breakpoint so the two stay consistent. */
|
|
@@ -55,8 +64,9 @@ interface RowRange {
|
|
|
55
64
|
/** Imperative surface the parent uses to drive block navigation from the
|
|
56
65
|
* shared toolbar/keyboard in split mode (its own `focus` is private here). */
|
|
57
66
|
export interface SplitDiffHandle {
|
|
58
|
-
jump: (direction: -1 | 1) => void;
|
|
67
|
+
jump: (direction: -1 | 1, wrapGuard?: boolean) => void;
|
|
59
68
|
openSearch: () => void;
|
|
69
|
+
searchNext: (direction: -1 | 1) => boolean;
|
|
60
70
|
}
|
|
61
71
|
/** The two-column (side-by-side) whole-file diff view. */
|
|
62
72
|
export declare const SplitDiff: import("react").ForwardRefExoticComponent<{
|
|
@@ -71,6 +81,8 @@ export declare const SplitDiff: import("react").ForwardRefExoticComponent<{
|
|
|
71
81
|
leadRows: number;
|
|
72
82
|
onBlockKeep: (sessionId: SessionId, id: string, block: DiffApprovalBlockRange) => Promise<void>;
|
|
73
83
|
onBlockRevert: (sessionId: SessionId, id: string, block: DiffApprovalBlockRange) => Promise<void>;
|
|
84
|
+
/** Notify the parent to toast a block-wrap boundary / single-block (Ctrl+Up/Down). */
|
|
85
|
+
onWrapToast: (text: string) => void;
|
|
74
86
|
} & import("react").RefAttributes<SplitDiffHandle>>;
|
|
75
87
|
/**
|
|
76
88
|
* Reconstruct the plain text of the current selection so auto-wrap's visual
|
|
@@ -81,5 +93,5 @@ export declare const SplitDiff: import("react").ForwardRefExoticComponent<{
|
|
|
81
93
|
*/
|
|
82
94
|
export declare function selectedPlainText(): string | undefined;
|
|
83
95
|
/** Render the pending-edit review panel and its unified footer action. */
|
|
84
|
-
export declare function PendingPanel({ wide, useSessions, usePending, onRefresh, onKeep, onRevert, onBlockKeep, onBlockRevert, onOpen, onPasteReference, onUndo, onRedo, onImportVcs, onAckRedoCleared,
|
|
96
|
+
export declare function PendingPanel({ wide, useSessions, usePending, onRefresh, onKeep, onRevert, onBlockKeep, onBlockRevert, onOpen, onPasteReference, onUndo, onRedo, onImportVcs, onAckRedoCleared, collapseSidebar, t, }: PendingPanelProps): import("react").JSX.Element;
|
|
85
97
|
export {};
|
|
@@ -23,6 +23,7 @@ export interface ConversationFace {
|
|
|
23
23
|
state: {
|
|
24
24
|
getSnapshot(): {
|
|
25
25
|
queue: readonly QueueMessageView[];
|
|
26
|
+
draft?: string;
|
|
26
27
|
};
|
|
27
28
|
};
|
|
28
29
|
};
|
|
@@ -51,6 +52,14 @@ export declare function resolveConversation(ctx: ClientContext, sessionId: Sessi
|
|
|
51
52
|
export interface ConversationAccess {
|
|
52
53
|
/** Write the current session's composer draft. */
|
|
53
54
|
writeDraft: (text: string) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Append a suffix to the current session's draft (a copy reference), or
|
|
57
|
+
* replace it when the draft is empty. The existing draft is read from the
|
|
58
|
+
* input state's plain text — the composer surface is a contenteditable div,
|
|
59
|
+
* not a <textarea>, so reading a DOM `.value` would always be empty and
|
|
60
|
+
* silently replace an existing draft instead of appending.
|
|
61
|
+
*/
|
|
62
|
+
appendDraft: (suffix: string) => void;
|
|
54
63
|
/** Read the current session's still-queued messages (queued placement only). */
|
|
55
64
|
readQueue: () => readonly QueueMessageView[];
|
|
56
65
|
/** Apply an edit mutation to one queued message's full content. */
|
|
@@ -11,6 +11,11 @@ export declare const zh: {
|
|
|
11
11
|
'panel.aria': string;
|
|
12
12
|
'panel.stats': string;
|
|
13
13
|
'panel.blockPosition': string;
|
|
14
|
+
'panel.blockAtEnd': string;
|
|
15
|
+
'panel.blockAtStart': string;
|
|
16
|
+
'panel.blockSingle': string;
|
|
17
|
+
'panel.viewDiff': string;
|
|
18
|
+
'panel.fileNotPending': string;
|
|
14
19
|
'panel.selectHint': string;
|
|
15
20
|
'panel.searchPlaceholder': string;
|
|
16
21
|
'panel.missing': string;
|
|
@@ -27,9 +32,33 @@ export declare const zh: {
|
|
|
27
32
|
'panel.splitModeDesc': string;
|
|
28
33
|
'panel.navLeadRows': string;
|
|
29
34
|
'panel.navLeadRowsDesc': string;
|
|
35
|
+
'panel.diffFontSize': string;
|
|
36
|
+
'panel.diffFontSizeDesc': string;
|
|
37
|
+
'panel.diffLineHeight': string;
|
|
38
|
+
'panel.diffLineHeightDesc': string;
|
|
39
|
+
'panel.diffAddColor': string;
|
|
40
|
+
'panel.diffAddColorDesc': string;
|
|
41
|
+
'panel.diffDelColor': string;
|
|
42
|
+
'panel.diffDelColorDesc': string;
|
|
30
43
|
'panel.quickSummon': string;
|
|
31
44
|
'panel.quickSummonDesc': string;
|
|
32
45
|
'panel.recordShortcut': string;
|
|
46
|
+
'settings.keybindings': string;
|
|
47
|
+
'settings.keybindingsDesc': string;
|
|
48
|
+
'settings.diffView': string;
|
|
49
|
+
'settings.diffViewDesc': string;
|
|
50
|
+
'settings.diffPreview': string;
|
|
51
|
+
'panel.keyDesc': string;
|
|
52
|
+
'panel.key.jumpUp': string;
|
|
53
|
+
'panel.key.jumpDown': string;
|
|
54
|
+
'panel.key.copyRef': string;
|
|
55
|
+
'panel.key.openSearch': string;
|
|
56
|
+
'panel.key.searchNext': string;
|
|
57
|
+
'panel.key.searchPrev': string;
|
|
58
|
+
'panel.key.undo': string;
|
|
59
|
+
'panel.key.redo': string;
|
|
60
|
+
'panel.key.cycleNext': string;
|
|
61
|
+
'panel.key.cyclePrev': string;
|
|
33
62
|
'settings.tabLabel': string;
|
|
34
63
|
'row.create': string;
|
|
35
64
|
'row.failed': string;
|
|
@@ -96,6 +125,11 @@ export declare const en: {
|
|
|
96
125
|
'panel.aria': string;
|
|
97
126
|
'panel.stats': string;
|
|
98
127
|
'panel.blockPosition': string;
|
|
128
|
+
'panel.blockAtEnd': string;
|
|
129
|
+
'panel.blockAtStart': string;
|
|
130
|
+
'panel.blockSingle': string;
|
|
131
|
+
'panel.viewDiff': string;
|
|
132
|
+
'panel.fileNotPending': string;
|
|
99
133
|
'panel.selectHint': string;
|
|
100
134
|
'panel.searchPlaceholder': string;
|
|
101
135
|
'panel.missing': string;
|
|
@@ -112,9 +146,33 @@ export declare const en: {
|
|
|
112
146
|
'panel.splitModeDesc': string;
|
|
113
147
|
'panel.navLeadRows': string;
|
|
114
148
|
'panel.navLeadRowsDesc': string;
|
|
149
|
+
'panel.diffFontSize': string;
|
|
150
|
+
'panel.diffFontSizeDesc': string;
|
|
151
|
+
'panel.diffLineHeight': string;
|
|
152
|
+
'panel.diffLineHeightDesc': string;
|
|
153
|
+
'panel.diffAddColor': string;
|
|
154
|
+
'panel.diffAddColorDesc': string;
|
|
155
|
+
'panel.diffDelColor': string;
|
|
156
|
+
'panel.diffDelColorDesc': string;
|
|
115
157
|
'panel.quickSummon': string;
|
|
116
158
|
'panel.quickSummonDesc': string;
|
|
117
159
|
'panel.recordShortcut': string;
|
|
160
|
+
'settings.keybindings': string;
|
|
161
|
+
'settings.keybindingsDesc': string;
|
|
162
|
+
'settings.diffView': string;
|
|
163
|
+
'settings.diffViewDesc': string;
|
|
164
|
+
'settings.diffPreview': string;
|
|
165
|
+
'panel.keyDesc': string;
|
|
166
|
+
'panel.key.jumpUp': string;
|
|
167
|
+
'panel.key.jumpDown': string;
|
|
168
|
+
'panel.key.copyRef': string;
|
|
169
|
+
'panel.key.openSearch': string;
|
|
170
|
+
'panel.key.searchNext': string;
|
|
171
|
+
'panel.key.searchPrev': string;
|
|
172
|
+
'panel.key.undo': string;
|
|
173
|
+
'panel.key.redo': string;
|
|
174
|
+
'panel.key.cycleNext': string;
|
|
175
|
+
'panel.key.cyclePrev': string;
|
|
118
176
|
'settings.tabLabel': string;
|
|
119
177
|
'row.create': string;
|
|
120
178
|
'row.failed': string;
|
|
@@ -17,9 +17,9 @@ export interface DiffApprovalPort {
|
|
|
17
17
|
/** Revert one operation. */
|
|
18
18
|
revert(sessionId: SessionId, id: string): Promise<DiffApprovalActionValue>;
|
|
19
19
|
/** Keep one diff block (accept its change into the tracked baseline). */
|
|
20
|
-
blockKeep(sessionId: SessionId, id: string, block: DiffApprovalBlockRange): Promise<DiffApprovalActionValue>;
|
|
20
|
+
blockKeep(sessionId: SessionId, id: string, block: DiffApprovalBlockRange, removeWhenResolved?: boolean): Promise<DiffApprovalActionValue>;
|
|
21
21
|
/** Revert one diff block (restore its old lines in the file). */
|
|
22
|
-
blockRevert(sessionId: SessionId, id: string, block: DiffApprovalBlockRange): Promise<DiffApprovalActionValue>;
|
|
22
|
+
blockRevert(sessionId: SessionId, id: string, block: DiffApprovalBlockRange, removeWhenResolved?: boolean): Promise<DiffApprovalActionValue>;
|
|
23
23
|
/** Undo the session's last keep/revert (restore the before state). */
|
|
24
24
|
undo(sessionId: SessionId): Promise<DiffApprovalActionValue>;
|
|
25
25
|
/** Redo the session's last undone keep/revert (re-apply the after state). */
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inject a "查看差异" button beside each DSH produced-file chip.
|
|
3
|
+
*
|
|
4
|
+
* The harness's `ProducedFiles` component renders each produced file as a
|
|
5
|
+
* `<button>` chip inside `[data-produced-files-row]`; the full path rides the
|
|
6
|
+
* chip's `title`. This plugin wants a quick "view this file's diff" affordance
|
|
7
|
+
* there, but the plugin should not have to touch the harness component. So this
|
|
8
|
+
* module watches the DOM for those chips (via a MutationObserver, the same
|
|
9
|
+
* bridge the dsh-pocket mobile fork uses to inject its 复制 buttons) and injects
|
|
10
|
+
* a small button after each one. Clicking it dispatches a window event that the
|
|
11
|
+
* diff-approval panel listens for (see PendingPanel), which opens the panel and
|
|
12
|
+
* selects the file when it is still pending, or toasts otherwise.
|
|
13
|
+
*
|
|
14
|
+
* The injected button is intentionally self-contained (inline styles + a fixed
|
|
15
|
+
* label) so it needs no stylesheet and no harness change.
|
|
16
|
+
*/
|
|
17
|
+
/** Window event dispatched by the injected button; PendingPanel listens for it. */
|
|
18
|
+
export declare const OPEN_FILE_EVENT = "diff-approval:open-file";
|
|
19
|
+
/**
|
|
20
|
+
* Start injecting diff buttons into the produced-files row.
|
|
21
|
+
* @param label - localized "查看差异" text, used as the icon button's accessible
|
|
22
|
+
* name + hover title (the button renders only an icon).
|
|
23
|
+
* @param openPath - called with a produced-file path when its injected button is
|
|
24
|
+
* clicked; the diff-approval panel decides whether that file is still pending.
|
|
25
|
+
* @returns a cleanup that disconnects the observer and removes injected buttons.
|
|
26
|
+
*/
|
|
27
|
+
export declare function startProducedDiffInjection(label: string, openPath: (path: string) => void): () => void;
|
|
@@ -31,6 +31,17 @@ export declare function referencePathOf(path: string, workspacePath: string | un
|
|
|
31
31
|
* @returns the range label.
|
|
32
32
|
*/
|
|
33
33
|
export declare function lineRangeLabel(start: number, end: number): string;
|
|
34
|
+
/**
|
|
35
|
+
* Build the bare reference label for a selected line range — `path:range` with
|
|
36
|
+
* no surrounding parentheses. Used for display (the status-bar copy control
|
|
37
|
+
* shows the reference without the token-wrapping parens).
|
|
38
|
+
* @param path - the selected file's path.
|
|
39
|
+
* @param workspacePath - the current workspace root, or `undefined`.
|
|
40
|
+
* @param start - first selected line number.
|
|
41
|
+
* @param end - last selected line number.
|
|
42
|
+
* @returns the `path:range` reference label.
|
|
43
|
+
*/
|
|
44
|
+
export declare function referenceLabelOf(path: string, workspacePath: string | undefined, start: number, end: number): string;
|
|
34
45
|
/**
|
|
35
46
|
* Build the clipboard text for a selected line range, wrapped in parentheses so
|
|
36
47
|
* the reference reads as one unambiguous token (and can be matched precisely).
|
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
export declare const NAV_LEAD_ROWS_DEFAULT = 2;
|
|
4
4
|
export declare const NAV_LEAD_ROWS_MIN = 0;
|
|
5
5
|
export declare const NAV_LEAD_ROWS_MAX = 10;
|
|
6
|
+
/** The code block's fixed row height used by the virtual window and jump math.
|
|
7
|
+
* A hardcoded px base; the settings UI offers 10–36 (a low floor would clip the
|
|
8
|
+
* code text, so the range is loose but never degenerate). */
|
|
9
|
+
export declare const DIFF_LINE_HEIGHT_DEFAULT = 22;
|
|
10
|
+
export declare const DIFF_LINE_HEIGHT_MIN = 10;
|
|
11
|
+
export declare const DIFF_LINE_HEIGHT_MAX = 36;
|
|
12
|
+
/** Font-size scale range: a percentage of the current value, stepped by 10. */
|
|
13
|
+
export declare const DIFF_FONT_SCALE_DEFAULT = 100;
|
|
14
|
+
export declare const DIFF_FONT_SCALE_MIN = 50;
|
|
15
|
+
export declare const DIFF_FONT_SCALE_MAX = 200;
|
|
6
16
|
/**
|
|
7
17
|
* Whether copying a reference should also paste it into the chat input and
|
|
8
18
|
* focus it. Defaults to on; only an explicit `'0'` disables it.
|
|
@@ -40,6 +50,34 @@ export declare function setWrapEnabled(lang: string, value: boolean): void;
|
|
|
40
50
|
export declare function tabWidth(): number;
|
|
41
51
|
/** Persist the diff's tab width (in spaces). */
|
|
42
52
|
export declare function setTabWidth(value: number): void;
|
|
53
|
+
/**
|
|
54
|
+
* The diff code font size as a percentage of the current (theme) size. Defaults
|
|
55
|
+
* to 100 (the current look); the settings UI steps it by ±10.
|
|
56
|
+
* @returns the font-size scale, as a percentage (e.g. 100, 110, 90).
|
|
57
|
+
*/
|
|
58
|
+
export declare function diffFontScale(): number;
|
|
59
|
+
/** Persist the diff's code font-size scale (a percentage). */
|
|
60
|
+
export declare function setDiffFontScale(value: number): void;
|
|
61
|
+
/**
|
|
62
|
+
* The diff code line height in px (the fixed row height the virtual window and
|
|
63
|
+
* jump math are keyed to). Defaults to 22 (the pre-customization value).
|
|
64
|
+
* @returns the line height in px.
|
|
65
|
+
*/
|
|
66
|
+
export declare function diffLineHeight(): number;
|
|
67
|
+
/** Persist the diff's code line height (px). */
|
|
68
|
+
export declare function setDiffLineHeight(value: number): void;
|
|
69
|
+
/** The added-line base color the user chose, or `undefined` (theme color). */
|
|
70
|
+
export declare function diffAddColor(): string | undefined;
|
|
71
|
+
/** Persist the added-line base color (a hex like `#22c55e`). */
|
|
72
|
+
export declare function setDiffAddColor(value: string): void;
|
|
73
|
+
/** The removed-line base color the user chose, or `undefined` (theme color). */
|
|
74
|
+
export declare function diffDelColor(): string | undefined;
|
|
75
|
+
/** Persist the removed-line base color (a hex like `#ef4444`). */
|
|
76
|
+
export declare function setDiffDelColor(value: string): void;
|
|
77
|
+
/** The theme's added-line base color, for the settings swatch default. */
|
|
78
|
+
export declare function currentDiffAddColor(): string;
|
|
79
|
+
/** The theme's removed-line base color, for the settings swatch default. */
|
|
80
|
+
export declare function currentDiffDelColor(): string;
|
|
43
81
|
/**
|
|
44
82
|
* Whether the whole-file diff view uses the two-column (side-by-side) layout.
|
|
45
83
|
* Default off (single column): the unified diff. Only an explicit `'1'` enables
|
|
@@ -68,6 +106,13 @@ export declare const DEFAULT_QUICK_SUMMON = "Ctrl+D";
|
|
|
68
106
|
export declare function quickSummonKey(): string;
|
|
69
107
|
/** Persist the quick-summon chord. */
|
|
70
108
|
export declare function setQuickSummonKey(value: string): void;
|
|
109
|
+
/** Default chord for each configurable action (every supported key except the
|
|
110
|
+
* panel's own ESC-to-close, which is intentionally not remapped). */
|
|
111
|
+
export declare const DEFAULT_KEYBINDINGS: Record<string, string>;
|
|
112
|
+
/** The currently configured chord for one action; falls back to its default. */
|
|
113
|
+
export declare function keybindingOf(action: string): string;
|
|
114
|
+
/** Persist one action's chord. */
|
|
115
|
+
export declare function setKeybinding(action: string, chord: string): void;
|
|
71
116
|
/**
|
|
72
117
|
* Whether a keyboard event matches a chord string like `Ctrl+D`. Modifier
|
|
73
118
|
* names are matched case-insensitively (`Ctrl`/`Control`, `Alt`/`Option`,
|
|
@@ -20,9 +20,6 @@ export interface PendingDiffSnapshot {
|
|
|
20
20
|
* superseded the redo history; the panel surfaces it once (deferred if the
|
|
21
21
|
* panel is closed) via a bottom-right notice. */
|
|
22
22
|
redoCleared?: boolean;
|
|
23
|
-
/** Latched file id whose last block just resolved; the panel prompts once to
|
|
24
|
-
* remove-or-keep it, then acknowledges to clear the latch. */
|
|
25
|
-
justResolved?: string | undefined;
|
|
26
23
|
}
|
|
27
24
|
/** The injected face the panel component receives from the plugin body. */
|
|
28
25
|
export interface PendingPanelFace {
|
|
@@ -37,9 +34,9 @@ export interface PendingPanelFace {
|
|
|
37
34
|
/** Revert one operation (restore its prior content, or remove a created file). */
|
|
38
35
|
onRevert: (sessionId: SessionId, id: string) => Promise<void>;
|
|
39
36
|
/** Keep one diff block (accept its change into the tracked baseline). */
|
|
40
|
-
onBlockKeep: (sessionId: SessionId, id: string, block: DiffApprovalBlockRange) => Promise<void>;
|
|
37
|
+
onBlockKeep: (sessionId: SessionId, id: string, block: DiffApprovalBlockRange, removeWhenResolved?: boolean) => Promise<void>;
|
|
41
38
|
/** Revert one diff block (restore its old lines in the file). */
|
|
42
|
-
onBlockRevert: (sessionId: SessionId, id: string, block: DiffApprovalBlockRange) => Promise<void>;
|
|
39
|
+
onBlockRevert: (sessionId: SessionId, id: string, block: DiffApprovalBlockRange, removeWhenResolved?: boolean) => Promise<void>;
|
|
43
40
|
/** Open one file with its default application or reveal it in the folder. */
|
|
44
41
|
onOpen: (sessionId: SessionId, id: string, action: DiffApprovalOpenAction) => Promise<void>;
|
|
45
42
|
/** Paste a copied reference into the session's chat input and focus it. */
|
|
@@ -52,8 +49,6 @@ export interface PendingPanelFace {
|
|
|
52
49
|
onImportVcs: (sessionId: SessionId, includeUntracked: boolean) => Promise<VcsImportValue>;
|
|
53
50
|
/** Acknowledge the redo-cleared notice so it is only surfaced once. */
|
|
54
51
|
onAckRedoCleared: () => void;
|
|
55
|
-
/** Acknowledge the just-resolved prompt so it is only surfaced once. */
|
|
56
|
-
onAckJustResolved: () => void;
|
|
57
52
|
/** Collapse the DSH sidebar (no-op when already collapsed) before the modal
|
|
58
53
|
* opens or fullscreens, so an expanded sidebar can't overlap the modal. */
|
|
59
54
|
collapseSidebar: () => void;
|
|
@@ -19,9 +19,9 @@ export interface PendingDiffStore extends HostObservable<PendingDiffSnapshot> {
|
|
|
19
19
|
/** Revert one operation. */
|
|
20
20
|
revert: (sessionId: SessionId, id: string) => Promise<void>;
|
|
21
21
|
/** Keep one diff block, then refresh so the entry's diff reflects the accept. */
|
|
22
|
-
blockKeep: (sessionId: SessionId, id: string, block: DiffApprovalBlockRange) => Promise<void>;
|
|
22
|
+
blockKeep: (sessionId: SessionId, id: string, block: DiffApprovalBlockRange, removeWhenResolved?: boolean) => Promise<void>;
|
|
23
23
|
/** Revert one diff block, then refresh so the entry's diff reflects the undo. */
|
|
24
|
-
blockRevert: (sessionId: SessionId, id: string, block: DiffApprovalBlockRange) => Promise<void>;
|
|
24
|
+
blockRevert: (sessionId: SessionId, id: string, block: DiffApprovalBlockRange, removeWhenResolved?: boolean) => Promise<void>;
|
|
25
25
|
/** Undo the session's last keep/revert, then refresh; resolves to the affected entry id when it is still pending. */
|
|
26
26
|
undo: (sessionId: SessionId) => Promise<string | undefined>;
|
|
27
27
|
/** Redo the session's last undone keep/revert, then refresh; resolves to the affected entry id when it is still pending. */
|
|
@@ -34,8 +34,6 @@ export interface PendingDiffStore extends HostObservable<PendingDiffSnapshot> {
|
|
|
34
34
|
reset: () => void;
|
|
35
35
|
/** Acknowledge a redo-cleared notice so the panel surfaces it only once. */
|
|
36
36
|
clearRedoCleared: () => void;
|
|
37
|
-
/** Acknowledge the just-resolved prompt so it is only surfaced once. */
|
|
38
|
-
clearJustResolved: () => void;
|
|
39
37
|
}
|
|
40
38
|
/**
|
|
41
39
|
* Create the store over the review-channel port.
|
|
@@ -46,6 +46,15 @@ export interface WholeFileDiff {
|
|
|
46
46
|
* @returns the normalized line bodies.
|
|
47
47
|
*/
|
|
48
48
|
export declare function contentKey(text: string): string;
|
|
49
|
+
/** Reorder each contiguous change run (a maximal run of non-context rows) into
|
|
50
|
+
* the standard unified-diff shape — all `del` rows first, then all `add` rows.
|
|
51
|
+
* The diff package's Myers scan can emit per-line replacements (`del add del
|
|
52
|
+
* add`) for some content, which reads as interleaved in the viewer and makes
|
|
53
|
+
* the split view pair each line separately. Reordering a run to del-block→add-
|
|
54
|
+
* block keeps each row's own line numbers and never changes the run's row
|
|
55
|
+
* boundaries, so change blocks, split alignment, and keep/revert ranges stay
|
|
56
|
+
* correct — it only tidies the display order. */
|
|
57
|
+
export declare function normalizeChangeRuns(rows: WholeFileDiffRow[]): void;
|
|
49
58
|
export declare function computeWholeFileDiff(oldText: string, newText: string): WholeFileDiff;
|
|
50
59
|
/**
|
|
51
60
|
* One intra-line segment of a changed line, used to highlight which characters
|
package/lib/types/types.d.ts
CHANGED
|
@@ -88,6 +88,11 @@ export interface DiffApprovalBlockTarget {
|
|
|
88
88
|
sessionId: SessionId;
|
|
89
89
|
id: string;
|
|
90
90
|
block: DiffApprovalBlockRange;
|
|
91
|
+
/** When true and this action clears the entry's last remaining change, remove
|
|
92
|
+
* the entry from the pending list as part of the same request. When false or
|
|
93
|
+
* absent, a fully-resolved entry stays listed (the panel's remove-and-keep
|
|
94
|
+
* prompt sets this from the user's choice). */
|
|
95
|
+
removeWhenResolved?: boolean | undefined;
|
|
91
96
|
}
|
|
92
97
|
/** Outcome of one keep/revert/undo/redo request. */
|
|
93
98
|
export type DiffApprovalActionOutcome = 'kept' | 'reverted' | 'missing' | 'undone' | 'redone' | 'nothing';
|
package/package.json
CHANGED