dsh-diff-approval 0.20.1 → 0.22.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 +7 -5
- package/README.zh.md +7 -5
- package/lib/client.js +3006 -1114
- package/lib/types/client/PendingPanel.d.ts +33 -2
- package/lib/types/client/boundary.d.ts +38 -0
- package/lib/types/client/chords.d.ts +49 -0
- package/lib/types/client/coverage-control.d.ts +49 -0
- package/lib/types/client/dock.d.ts +198 -0
- package/lib/types/client/header-entry.d.ts +59 -0
- package/lib/types/client/locales.d.ts +70 -4
- package/lib/types/client/panel-memory.d.ts +47 -0
- package/lib/types/client/presentation-menu.d.ts +45 -0
- package/lib/types/client/settings.d.ts +59 -1
- package/lib/types/client/slots.d.ts +19 -2
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The mode switch: where the panel shows — floating over the app, or docked as a
|
|
3
|
+
* tab in the app's right sidebar. (What the floating panel *covers* is the
|
|
4
|
+
* coverage control's business; see the panel's own header.)
|
|
5
|
+
*
|
|
6
|
+
* One implementation, two hosts. The floating panel draws it in its own header
|
|
7
|
+
* beside the gear. A *docked* panel draws no header at all — the tab is the
|
|
8
|
+
* frame, its chip already carries the title and a close button — so the chip
|
|
9
|
+
* (`sidebar.right.pane.tab.title`, which is this plugin's own component) hosts
|
|
10
|
+
* the same control instead: the seat's convention is a glyph *before* the title
|
|
11
|
+
* text, and the chip's tail is masked for the kit's own close button.
|
|
12
|
+
*
|
|
13
|
+
* @module dsh-diff-approval/client/presentation-menu
|
|
14
|
+
*/
|
|
15
|
+
import type { ReactNode } from 'react';
|
|
16
|
+
import type { MenuEntry } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
17
|
+
import type { DiffApprovalPresentation } from './settings.ts';
|
|
18
|
+
import type { Translator } from './locales.ts';
|
|
19
|
+
/**
|
|
20
|
+
* The mode switch's mark: the state it currently shows, and the same glyph each
|
|
21
|
+
* menu row leads with. The dock mark is the icon the app's own right sidebar uses
|
|
22
|
+
* (`IconPanelLeftOutline16`, mirrored — see ui-sidebar-right's ExpandButton), so
|
|
23
|
+
* "dock" points at the same affordance the column does.
|
|
24
|
+
* @param props - the state, and the drawn size in px.
|
|
25
|
+
* @returns the glyph.
|
|
26
|
+
*/
|
|
27
|
+
export declare function PresentationIcon({ state, size }: {
|
|
28
|
+
state: DiffApprovalPresentation;
|
|
29
|
+
size: number;
|
|
30
|
+
}): ReactNode;
|
|
31
|
+
export interface PresentationMenuProps {
|
|
32
|
+
t: Translator;
|
|
33
|
+
/** Where the panel is now: the checked row, and the mark on the trigger. */
|
|
34
|
+
current: DiffApprovalPresentation;
|
|
35
|
+
onChoose: (next: DiffApprovalPresentation) => void;
|
|
36
|
+
/** Rows pinned below a hairline, for a host with no other way to reach them
|
|
37
|
+
* (the chip carries this plugin's Settings; a docked panel has no gear). */
|
|
38
|
+
footer?: readonly MenuEntry[];
|
|
39
|
+
/** Called for a `footer` row's id, which is not a presentation. */
|
|
40
|
+
onFooter?: (id: string) => void;
|
|
41
|
+
/** The chip's variant: no room for the chevron, and a box the chip's 28px
|
|
42
|
+
* height can hold. */
|
|
43
|
+
compact?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export declare function PresentationMenu({ t, current, onChoose, footer, onFooter, compact }: PresentationMenuProps): ReactNode;
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
/** Client preferences for the review panel, persisted in localStorage. */
|
|
2
|
+
/** Where the review panel shows: floating over the app, or docked as a tab in the
|
|
3
|
+
* app's right sidebar. What the floating panel covers is a separate setting —
|
|
4
|
+
* see {@link DiffApprovalCover}. */
|
|
5
|
+
export type DiffApprovalPresentation = 'float' | 'dock';
|
|
6
|
+
/**
|
|
7
|
+
* What the floating panel covers: the app's header above the conversation, its
|
|
8
|
+
* left sidebar, its right sidebar, and the composer below. All four on is the
|
|
9
|
+
* presentation the panel used to call "fullscreen" — the panel filling the
|
|
10
|
+
* window; both sidebars and the header only is the plain floating panel, which
|
|
11
|
+
* leaves the input usable.
|
|
12
|
+
*/
|
|
13
|
+
export interface DiffApprovalCover {
|
|
14
|
+
readonly top: boolean;
|
|
15
|
+
readonly left: boolean;
|
|
16
|
+
readonly right: boolean;
|
|
17
|
+
readonly composer: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** The floating panel's default coverage: the header and both sidebars, not the
|
|
20
|
+
* composer. */
|
|
21
|
+
export declare const FLOAT_COVER_DEFAULT: DiffApprovalCover;
|
|
2
22
|
/** Default lead rows above a jumped-to diff block (kept small and bounded). */
|
|
3
23
|
export declare const NAV_LEAD_ROWS_DEFAULT = 2;
|
|
4
24
|
export declare const NAV_LEAD_ROWS_MIN = 0;
|
|
@@ -61,6 +81,42 @@ export declare function setSearchCaseSensitive(value: boolean): void;
|
|
|
61
81
|
export declare function searchWholeWord(): boolean;
|
|
62
82
|
/** Persist the search whole-word preference. */
|
|
63
83
|
export declare function setSearchWholeWord(value: boolean): void;
|
|
84
|
+
/**
|
|
85
|
+
* Where the review panel shows, as the user last had it. Two states, both
|
|
86
|
+
* remembered so the footer entry can restore the one they were using:
|
|
87
|
+
*
|
|
88
|
+
* - `float` — the panel floating over the app, covering what
|
|
89
|
+
* {@link panelCover} says (and the composer only when that says so);
|
|
90
|
+
* - `dock` — the panel docked in the app's right sidebar, as its own tab.
|
|
91
|
+
*
|
|
92
|
+
* A stored `fullscreen` — the third state before coverage became three switches —
|
|
93
|
+
* reads as `float`, with {@link panelCover} supplying the all-on coverage it
|
|
94
|
+
* meant.
|
|
95
|
+
* @returns the remembered presentation; `float` when unset or unrecognized.
|
|
96
|
+
*/
|
|
97
|
+
export declare function panelPresentation(): DiffApprovalPresentation;
|
|
98
|
+
/** Persist the panel's presentation (see {@link panelPresentation}). */
|
|
99
|
+
export declare function setPanelPresentation(value: DiffApprovalPresentation): void;
|
|
100
|
+
/**
|
|
101
|
+
* What the floating panel covers (see {@link DiffApprovalCover}). Defaults to
|
|
102
|
+
* both sidebars and not the composer; a stored `fullscreen` presentation from
|
|
103
|
+
* before the switches means all three.
|
|
104
|
+
* @returns the remembered coverage.
|
|
105
|
+
*/
|
|
106
|
+
export declare function panelCover(): DiffApprovalCover;
|
|
107
|
+
/** Window event: the floating panel's coverage changed (see {@link setPanelCover}). */
|
|
108
|
+
export declare const COVER_CHANGED_EVENT = "diff-approval:cover";
|
|
109
|
+
/** Persist what the floating panel covers. */
|
|
110
|
+
export declare function setPanelCover(value: DiffApprovalCover): void;
|
|
111
|
+
/**
|
|
112
|
+
* Whether the file list always folds into its floating card, whatever width the
|
|
113
|
+
* panel has. Defaults to off, where the width decides: the list sits beside the
|
|
114
|
+
* diff while there is room for both. Only an explicit `'1'` forces the fold.
|
|
115
|
+
* @returns whether the file list is always folded.
|
|
116
|
+
*/
|
|
117
|
+
export declare function fileListFloat(): boolean;
|
|
118
|
+
/** Persist the always-fold preference for the file list. */
|
|
119
|
+
export declare function setFileListFloat(value: boolean): void;
|
|
64
120
|
/**
|
|
65
121
|
* Whether lines wrap (auto-wrap) in the diff for one highlight language.
|
|
66
122
|
* Defaults to off; only an explicit `'1'` enables it. Stored per language, so
|
|
@@ -171,7 +227,9 @@ export declare function quickSummonKey(): string;
|
|
|
171
227
|
/** Persist the quick-summon chord. */
|
|
172
228
|
export declare function setQuickSummonKey(value: string): void;
|
|
173
229
|
/** Default chord for each configurable action (every supported key except the
|
|
174
|
-
* panel's own ESC-to-close, which is intentionally not remapped).
|
|
230
|
+
* panel's own ESC-to-close, which is intentionally not remapped). The coverage
|
|
231
|
+
* switches are keyed like the edges they toggle, in the order the panel lists
|
|
232
|
+
* them: left, top, right, bottom. */
|
|
175
233
|
export declare const DEFAULT_KEYBINDINGS: Record<string, string>;
|
|
176
234
|
/** The currently configured chord for one action; falls back to its default. */
|
|
177
235
|
export declare function keybindingOf(action: string): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** The panel's injected business face and its observable snapshot. */
|
|
2
2
|
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots';
|
|
3
3
|
import type { SessionId } from '@deepseek-ai/dsh-client-connection/client';
|
|
4
|
+
import type { DockSnapshot } from './dock.tsx';
|
|
4
5
|
import type { DiffApprovalAddValue, DiffApprovalBlockRange, DiffApprovalBrowseValue, DiffApprovalOpenAction, DiffApprovalRefreshValue, PendingFileDiff, VcsImportValue } from '../types.ts';
|
|
5
6
|
/** What the panel reads and drives: the pending list plus in-flight entries. */
|
|
6
7
|
export interface PendingDiffSnapshot {
|
|
@@ -26,7 +27,23 @@ export interface PendingPanelFace {
|
|
|
26
27
|
hooks: {
|
|
27
28
|
/** Live pending-diff snapshot for the current page. */
|
|
28
29
|
pending: HostObservable<PendingDiffSnapshot>;
|
|
30
|
+
/** The dock's state (whether our right-sidebar tab is showing), or absent
|
|
31
|
+
* when this build has no right sidebar to dock into. */
|
|
32
|
+
dock?: HostObservable<DockSnapshot>;
|
|
29
33
|
};
|
|
34
|
+
/** Reveal the panel in the app's right sidebar, opening its tab if needed.
|
|
35
|
+
* Absent when this build has no right sidebar: the panel then opens floating
|
|
36
|
+
* whatever the remembered presentation says. */
|
|
37
|
+
onOpenDock?: (() => void) | undefined;
|
|
38
|
+
/** The docked tab body's own visibility, so the footer entry can light up
|
|
39
|
+
* while the panel lives in the sidebar. */
|
|
40
|
+
onDockShowing?: ((showing: boolean) => void) | undefined;
|
|
41
|
+
/** Close the docked panel: the docked tab's own close, published by its chip.
|
|
42
|
+
* `undefined` while no dock tab exists. */
|
|
43
|
+
onDockClose?: ((close: (() => void) | undefined) => void) | undefined;
|
|
44
|
+
/** Close the docked tab now, when one exists (the quick-summon chord's job
|
|
45
|
+
* while the panel lives in the sidebar). */
|
|
46
|
+
closeDock?: (() => void) | undefined;
|
|
30
47
|
/** Read the pending list for the current session into the snapshot. */
|
|
31
48
|
onRefresh: (sessionId: SessionId | undefined) => void;
|
|
32
49
|
/** Keep one operation. `keepListed` leaves the resolved entry in the list. */
|
|
@@ -64,7 +81,7 @@ export interface PendingPanelFace {
|
|
|
64
81
|
onRevertAll: (sessionId: SessionId) => Promise<void>;
|
|
65
82
|
/** Acknowledge the redo-cleared notice so it is only surfaced once. */
|
|
66
83
|
onAckRedoCleared: () => void;
|
|
67
|
-
/** Collapse the DSH sidebar (no-op when already collapsed) before the
|
|
68
|
-
* opens
|
|
84
|
+
/** Collapse the DSH sidebar (no-op when already collapsed) before the floating
|
|
85
|
+
* modal opens on a narrow window, so the sidebar can't overlap it. */
|
|
69
86
|
collapseSidebar: () => void;
|
|
70
87
|
}
|
package/package.json
CHANGED