@nkzw/codiff-core 1.8.1
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/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/SharedPlanApp.d.ts +32 -0
- package/dist/SharedWalkthroughApp.d.ts +40 -0
- package/dist/app/components/Avatar.d.ts +6 -0
- package/dist/app/components/Button.d.ts +12 -0
- package/dist/app/components/CommandBar.d.ts +8 -0
- package/dist/app/components/FileTree.d.ts +10 -0
- package/dist/app/components/KeyboardShortcutsHelp.d.ts +5 -0
- package/dist/app/components/MarkdownDocumentEditor.d.ts +26 -0
- package/dist/app/components/Panels.d.ts +71 -0
- package/dist/app/components/PlanEditorView.d.ts +18 -0
- package/dist/app/components/ReadOnlyMarkdownView.d.ts +16 -0
- package/dist/app/components/ReviewCodeView.d.ts +103 -0
- package/dist/app/components/Sidebar.d.ts +48 -0
- package/dist/app/components/WalkthroughFileError.d.ts +4 -0
- package/dist/app/components/merge-request/GeneralComments.d.ts +49 -0
- package/dist/app/components/useCopiedState.d.ts +1 -0
- package/dist/app/components/walkthrough/CommitView.d.ts +23 -0
- package/dist/app/components/walkthrough/NarrativeSidebar.d.ts +12 -0
- package/dist/app/components/walkthrough/NarrativeWalkthroughView.d.ts +44 -0
- package/dist/app/components/walkthrough/WalkthroughDiffSurface.d.ts +16 -0
- package/dist/app/components/walkthrough/WalkthroughProgress.d.ts +8 -0
- package/dist/app/components/walkthrough/parts.d.ts +15 -0
- package/dist/app/components/walkthrough/useNarrativeNavigation.d.ts +34 -0
- package/dist/app/hooks/useAppCommands.d.ts +22 -0
- package/dist/app/hooks/useAppKeyboardShortcuts.d.ts +18 -0
- package/dist/app/hooks/useAppReviewComments.d.ts +38 -0
- package/dist/app/hooks/useAppWalkthrough.d.ts +96 -0
- package/dist/app/hooks/useDiffSearch.d.ts +24 -0
- package/dist/app/hooks/useDocumentAppearance.d.ts +10 -0
- package/dist/app/hooks/useResizableSidebar.d.ts +12 -0
- package/dist/app/hooks/useReviewCommentDrafts.d.ts +23 -0
- package/dist/app/hooks/useReviewState.d.ts +22 -0
- package/dist/config/defaults.d.ts +4 -0
- package/dist/config/keymap.d.ts +3 -0
- package/dist/config/types.d.ts +44 -0
- package/dist/defaults.d.ts +2 -0
- package/dist/fonts/firacode/FiraCode-Regular.woff2 +0 -0
- package/dist/fonts/firacode/FiraCode-SemiBold.woff2 +0 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +12 -0
- package/dist/lib/app-constants.d.ts +7 -0
- package/dist/lib/app-types.d.ts +137 -0
- package/dist/lib/code-view-options.d.ts +26 -0
- package/dist/lib/command-registry.d.ts +14 -0
- package/dist/lib/diff-search.d.ts +3 -0
- package/dist/lib/diff.d.ts +35 -0
- package/dist/lib/files.d.ts +14 -0
- package/dist/lib/item-version.d.ts +1 -0
- package/dist/lib/keyboard.d.ts +2 -0
- package/dist/lib/markdown.d.ts +3 -0
- package/dist/lib/narrative-walkthrough-diff.d.ts +113 -0
- package/dist/lib/narrative-walkthrough-diff.mjs +257 -0
- package/dist/lib/narrative-walkthrough.d.ts +108 -0
- package/dist/lib/reload-selection.d.ts +23 -0
- package/dist/lib/review-command-target.d.ts +15 -0
- package/dist/lib/review-comments.d.ts +29 -0
- package/dist/lib/review-identity.d.ts +7 -0
- package/dist/lib/review-scroll.d.ts +5 -0
- package/dist/lib/search-highlights.d.ts +5 -0
- package/dist/lib/sidebar-width.d.ts +9 -0
- package/dist/lib/source.d.ts +18 -0
- package/dist/lib/viewed.d.ts +2 -0
- package/dist/react.d.ts +3 -0
- package/dist/react.mjs +9355 -0
- package/dist/share.d.ts +301 -0
- package/dist/share.mjs +103 -0
- package/dist/style.css +9142 -0
- package/dist/styles.css.d.ts +2 -0
- package/dist/types.d.ts +702 -0
- package/package.json +71 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ChangedFile, NarrativeWalkthrough } from '../../../types.ts';
|
|
2
|
+
export type NarrativeViewMode = 'stop' | 'support' | 'commit';
|
|
3
|
+
export type NarrativeNavigation = ReturnType<typeof useNarrativeNavigation>;
|
|
4
|
+
/**
|
|
5
|
+
* Shared navigation state for the narrative walkthrough, owned by App and passed
|
|
6
|
+
* to both the sidebar table-of-contents and the main hybrid view.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useNarrativeNavigation: (walkthrough: NarrativeWalkthrough | null, files: ReadonlyArray<ChangedFile>, resetKey?: string) => {
|
|
9
|
+
commitBody: string;
|
|
10
|
+
commitSelected: ReadonlySet<string>;
|
|
11
|
+
commitSubject: string;
|
|
12
|
+
enterCommit: () => void;
|
|
13
|
+
goNext: () => void;
|
|
14
|
+
goPrev: () => void;
|
|
15
|
+
goStop: (target: number) => void;
|
|
16
|
+
index: number;
|
|
17
|
+
mode: NarrativeViewMode;
|
|
18
|
+
openSupport: () => void;
|
|
19
|
+
releaseStopScrollLock: () => void;
|
|
20
|
+
scrollTarget: {
|
|
21
|
+
index: number;
|
|
22
|
+
nonce: number;
|
|
23
|
+
};
|
|
24
|
+
setCommitBody: (value: string) => void;
|
|
25
|
+
setCommitSubject: (value: string) => void;
|
|
26
|
+
supportScrollRequest: number;
|
|
27
|
+
supportVisited: boolean;
|
|
28
|
+
syncIndexFromScroll: (target: number) => void;
|
|
29
|
+
syncSupportFromScroll: () => void;
|
|
30
|
+
toggleCommitFile: (path: string) => void;
|
|
31
|
+
toggleCommitGroup: (paths: ReadonlyArray<string>) => void;
|
|
32
|
+
visited: ReadonlySet<string>;
|
|
33
|
+
walkthroughView: import("../../../lib/narrative-walkthrough.ts").WalkthroughView | null;
|
|
34
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import type { ReviewComment, ReviewIdentity, SidebarMode } from '../../lib/app-types.ts';
|
|
3
|
+
import { type Command } from '../../lib/command-registry.ts';
|
|
4
|
+
import type { ReviewCommandTarget } from '../../lib/review-command-target.ts';
|
|
5
|
+
import type { ChangedFile, CodiffPreferences, RepositoryState } from '../../types.ts';
|
|
6
|
+
type UseAppCommandsOptions = {
|
|
7
|
+
changeSidebarMode: (mode: SidebarMode) => void;
|
|
8
|
+
focusFileFilter: () => void;
|
|
9
|
+
getReviewCommandTarget: () => ReviewCommandTarget | null;
|
|
10
|
+
onOpenDiffSearch: () => void;
|
|
11
|
+
onOpenSelectedFile: () => void;
|
|
12
|
+
onRefreshRepository: () => void;
|
|
13
|
+
onToggleSidebar: () => void;
|
|
14
|
+
onToggleViewed: (file: ChangedFile, isViewed: boolean, reviewIdentity: ReviewIdentity) => void;
|
|
15
|
+
onToggleWordWrap: () => void;
|
|
16
|
+
preferencesRef: RefObject<CodiffPreferences>;
|
|
17
|
+
reviewCommentsRef: RefObject<ReadonlyArray<ReviewComment>>;
|
|
18
|
+
stateRef: RefObject<RepositoryState | null>;
|
|
19
|
+
viewedRef: RefObject<Record<string, string>>;
|
|
20
|
+
};
|
|
21
|
+
export declare function useAppCommands({ changeSidebarMode, focusFileFilter, getReviewCommandTarget, onOpenDiffSearch, onOpenSelectedFile, onRefreshRepository, onToggleSidebar, onToggleViewed, onToggleWordWrap, preferencesRef, reviewCommentsRef, stateRef, viewedRef, }: UseAppCommandsOptions): readonly Command[];
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CodiffKeymap } from '../../config/types.ts';
|
|
2
|
+
type UseAppKeyboardShortcutsOptions = {
|
|
3
|
+
keymap: CodiffKeymap;
|
|
4
|
+
navigateHunks: (direction: 1 | -1) => void;
|
|
5
|
+
onFocusFileFilter: () => void;
|
|
6
|
+
onOpenDiffSearch: () => void;
|
|
7
|
+
onOpenSelectedFile: () => void;
|
|
8
|
+
onToggleSidebar: () => void;
|
|
9
|
+
onToggleWordWrap: () => void;
|
|
10
|
+
shouldDeferHunkNavigation: () => boolean;
|
|
11
|
+
sidebarCollapsed: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function useAppKeyboardShortcuts({ keymap, navigateHunks, onFocusFileFilter, onOpenDiffSearch, onOpenSelectedFile, onToggleSidebar, onToggleWordWrap, shouldDeferHunkNavigation, sidebarCollapsed, }: UseAppKeyboardShortcutsOptions): {
|
|
14
|
+
closeCommandBar: () => void;
|
|
15
|
+
commandBarVisible: boolean;
|
|
16
|
+
shortcutsHelpVisible: boolean;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import type { ReviewComment } from '../../lib/app-types.ts';
|
|
3
|
+
import type { PullRequestReviewEvent, PullRequestReviewStatus, RepositoryState } from '../../types.ts';
|
|
4
|
+
type UseAppReviewCommentsOptions = {
|
|
5
|
+
isReviewActionDisabled: (reviewStatus: PullRequestReviewStatus | undefined, event: PullRequestReviewEvent) => boolean;
|
|
6
|
+
onCommentFileChange: (filePath: string) => void;
|
|
7
|
+
stateRef: RefObject<RepositoryState | null>;
|
|
8
|
+
};
|
|
9
|
+
export declare function useAppReviewComments({ isReviewActionDisabled, onCommentFileChange, stateRef, }: UseAppReviewCommentsOptions): {
|
|
10
|
+
activeReviewCommentDraftRef: RefObject<{
|
|
11
|
+
body: string;
|
|
12
|
+
id: string;
|
|
13
|
+
} | null>;
|
|
14
|
+
activeReviewCommentDraftState: {
|
|
15
|
+
body: string;
|
|
16
|
+
id: string;
|
|
17
|
+
} | null;
|
|
18
|
+
clearCommentFocus: (commentId: string) => void;
|
|
19
|
+
createComment: (comment: Omit<ReviewComment, 'body' | 'id'>) => void;
|
|
20
|
+
deleteComment: (commentId: string) => void;
|
|
21
|
+
focusCommentId: string | null;
|
|
22
|
+
focusCommentRequest: number;
|
|
23
|
+
resetCommentFocus: () => void;
|
|
24
|
+
reviewCommentsRef: RefObject<readonly ReviewComment[]>;
|
|
25
|
+
updateActiveReviewCommentDraft: (comment: {
|
|
26
|
+
body: string;
|
|
27
|
+
id: string;
|
|
28
|
+
} | null) => void;
|
|
29
|
+
updateComment: (commentId: string, body: string) => void;
|
|
30
|
+
askCodex: (commentId: string) => void;
|
|
31
|
+
hasPendingReviewComments: boolean;
|
|
32
|
+
pullRequestReviewSubmitting: PullRequestReviewEvent | null;
|
|
33
|
+
reviewComments: readonly ReviewComment[];
|
|
34
|
+
setReviewComments: import("react").Dispatch<import("react").SetStateAction<readonly ReviewComment[]>>;
|
|
35
|
+
submitPullRequestComment: (commentId: string) => void;
|
|
36
|
+
submitPullRequestReview: (event: PullRequestReviewEvent, body?: string) => Promise<void> | undefined;
|
|
37
|
+
};
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
import type { SidebarMode } from '../../lib/app-types.ts';
|
|
3
|
+
import { type ReviewCommandTarget } from '../../lib/review-command-target.ts';
|
|
4
|
+
import type { CodiffPreferences, NarrativeWalkthrough, RepositoryState, WalkthroughCommitMessageRequest, WalkthroughCommitRequest, WalkthroughProgressEvent } from '../../types.ts';
|
|
5
|
+
import type { WalkthroughReviewTarget } from '../components/walkthrough/NarrativeWalkthroughView.tsx';
|
|
6
|
+
import type { WalkthroughFileError } from '../components/WalkthroughFileError.tsx';
|
|
7
|
+
type MainMode = 'commit' | 'review';
|
|
8
|
+
type UseAppWalkthroughOptions = {
|
|
9
|
+
preferencesRef: RefObject<CodiffPreferences>;
|
|
10
|
+
state: RepositoryState | null;
|
|
11
|
+
stateGenerationRef: RefObject<number>;
|
|
12
|
+
stateRef: RefObject<RepositoryState | null>;
|
|
13
|
+
};
|
|
14
|
+
export declare function useAppWalkthrough({ preferencesRef, state, stateGenerationRef, stateRef, }: UseAppWalkthroughOptions): {
|
|
15
|
+
activeReviewCommandTargetRef: RefObject<ReviewCommandTarget | null>;
|
|
16
|
+
changeSidebarMode: (mode: SidebarMode) => void;
|
|
17
|
+
closeCommitView: () => void;
|
|
18
|
+
commitWalkthrough: (request: WalkthroughCommitRequest) => Promise<import("../../types.ts").WalkthroughCommitResult>;
|
|
19
|
+
enabledShareWalkthrough: (() => void) | undefined;
|
|
20
|
+
mainModeRef: RefObject<MainMode>;
|
|
21
|
+
narrativeNavigation: {
|
|
22
|
+
commitBody: string;
|
|
23
|
+
commitSelected: ReadonlySet<string>;
|
|
24
|
+
commitSubject: string;
|
|
25
|
+
enterCommit: () => void;
|
|
26
|
+
goNext: () => void;
|
|
27
|
+
goPrev: () => void;
|
|
28
|
+
goStop: (target: number) => void;
|
|
29
|
+
index: number;
|
|
30
|
+
mode: import("../components/walkthrough/useNarrativeNavigation.ts").NarrativeViewMode;
|
|
31
|
+
openSupport: () => void;
|
|
32
|
+
releaseStopScrollLock: () => void;
|
|
33
|
+
scrollTarget: {
|
|
34
|
+
index: number;
|
|
35
|
+
nonce: number;
|
|
36
|
+
};
|
|
37
|
+
setCommitBody: (value: string) => void;
|
|
38
|
+
setCommitSubject: (value: string) => void;
|
|
39
|
+
supportScrollRequest: number;
|
|
40
|
+
supportVisited: boolean;
|
|
41
|
+
syncIndexFromScroll: (target: number) => void;
|
|
42
|
+
syncSupportFromScroll: () => void;
|
|
43
|
+
toggleCommitFile: (path: string) => void;
|
|
44
|
+
toggleCommitGroup: (paths: ReadonlyArray<string>) => void;
|
|
45
|
+
visited: ReadonlySet<string>;
|
|
46
|
+
walkthroughView: import("../../lib/narrative-walkthrough.ts").WalkthroughView | null;
|
|
47
|
+
};
|
|
48
|
+
narrativeWalkthrough: NarrativeWalkthrough | null;
|
|
49
|
+
narrativeWalkthroughRef: RefObject<NarrativeWalkthrough | null>;
|
|
50
|
+
openCommitView: () => void;
|
|
51
|
+
plainCommitModel: import("../../lib/narrative-walkthrough.ts").CommitModel;
|
|
52
|
+
regenerateWalkthrough: () => void;
|
|
53
|
+
setMainMode: import("react").Dispatch<import("react").SetStateAction<MainMode>>;
|
|
54
|
+
setNarrativeWalkthrough: import("react").Dispatch<import("react").SetStateAction<NarrativeWalkthrough | null>>;
|
|
55
|
+
setShareWalkthroughEnabled: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
56
|
+
setSidebarMode: import("react").Dispatch<import("react").SetStateAction<SidebarMode>>;
|
|
57
|
+
setWalkthroughError: import("react").Dispatch<import("react").SetStateAction<{
|
|
58
|
+
code?: 'CODEX_NOT_FOUND' | 'CLAUDE_NOT_FOUND' | 'OPENCODE_NOT_FOUND' | 'PI_NOT_FOUND';
|
|
59
|
+
reason: string;
|
|
60
|
+
status: 'unavailable';
|
|
61
|
+
} | null>>;
|
|
62
|
+
setWalkthroughFileError: import("react").Dispatch<import("react").SetStateAction<WalkthroughFileError | null>>;
|
|
63
|
+
setWalkthroughLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
64
|
+
setWalkthroughOutdatedPaths: import("react").Dispatch<import("react").SetStateAction<ReadonlySet<string>>>;
|
|
65
|
+
setWalkthroughUnread: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
66
|
+
showNarrativeWalkthrough: boolean;
|
|
67
|
+
showPlainCommitView: boolean;
|
|
68
|
+
sidebarMode: SidebarMode;
|
|
69
|
+
sidebarModeRef: RefObject<SidebarMode>;
|
|
70
|
+
startWalkthroughLoading: () => void;
|
|
71
|
+
subscribeToCommitOutput: (callback: (chunk: string) => void) => () => void;
|
|
72
|
+
updateActiveWalkthroughReviewTarget: (target: WalkthroughReviewTarget | null) => void;
|
|
73
|
+
updateWalkthroughCommitMessage: (request: WalkthroughCommitMessageRequest) => Promise<import("../../types.ts").WalkthroughCommitMessageResult>;
|
|
74
|
+
walkthroughError: {
|
|
75
|
+
code?: 'CODEX_NOT_FOUND' | 'CLAUDE_NOT_FOUND' | 'OPENCODE_NOT_FOUND' | 'PI_NOT_FOUND';
|
|
76
|
+
reason: string;
|
|
77
|
+
status: 'unavailable';
|
|
78
|
+
} | null;
|
|
79
|
+
walkthroughErrorRef: RefObject<{
|
|
80
|
+
code?: 'CODEX_NOT_FOUND' | 'CLAUDE_NOT_FOUND' | 'OPENCODE_NOT_FOUND' | 'PI_NOT_FOUND';
|
|
81
|
+
reason: string;
|
|
82
|
+
status: 'unavailable';
|
|
83
|
+
} | null>;
|
|
84
|
+
walkthroughFileError: WalkthroughFileError | null;
|
|
85
|
+
walkthroughLoading: boolean;
|
|
86
|
+
walkthroughOutdatedPaths: ReadonlySet<string>;
|
|
87
|
+
walkthroughOutdatedPathsRef: RefObject<ReadonlySet<string>>;
|
|
88
|
+
walkthroughProgress: {
|
|
89
|
+
phase: WalkthroughProgressEvent['phase'] | null;
|
|
90
|
+
responseLabelIndex: number;
|
|
91
|
+
stageRevision: number;
|
|
92
|
+
};
|
|
93
|
+
walkthroughSharing: boolean;
|
|
94
|
+
walkthroughUnread: boolean;
|
|
95
|
+
};
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ChangedFile } from '../../types.ts';
|
|
2
|
+
type UseDiffSearchOptions = {
|
|
3
|
+
files: ReadonlyArray<ChangedFile>;
|
|
4
|
+
fileSearchQuery: string;
|
|
5
|
+
showWhitespace: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function useDiffSearch({ files, fileSearchQuery, showWhitespace }: UseDiffSearchOptions): {
|
|
8
|
+
activeMatch: import("../../lib/app-types.ts").DiffSearchMatch;
|
|
9
|
+
activeMatchIndex: number;
|
|
10
|
+
closeSearch: () => void;
|
|
11
|
+
fileFilteredFiles: ChangedFile[];
|
|
12
|
+
focusRequest: number;
|
|
13
|
+
hasQuery: boolean;
|
|
14
|
+
matches: import("../../lib/app-types.ts").DiffSearchMatch[];
|
|
15
|
+
matchPathSet: Set<string>;
|
|
16
|
+
moveMatch: (direction: 1 | -1) => void;
|
|
17
|
+
openSearch: () => void;
|
|
18
|
+
query: string;
|
|
19
|
+
resetSearch: () => void;
|
|
20
|
+
updateQuery: (nextQuery: string) => void;
|
|
21
|
+
visible: boolean;
|
|
22
|
+
visibleFiles: ChangedFile[];
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CodiffPreferences } from '../../types.ts';
|
|
2
|
+
export declare const CODE_FONT_SIZE_DEFAULT = 13;
|
|
3
|
+
export declare const normalizeCodeFontSizePreference: (size: number) => number;
|
|
4
|
+
export declare const getCodeFontLineHeight: (size: number) => number;
|
|
5
|
+
type UseDocumentAppearanceOptions = Pick<CodiffPreferences, 'codeFontFamily' | 'codeFontSize' | 'theme'> & {
|
|
6
|
+
cleanupCodeFontProperties?: boolean;
|
|
7
|
+
clearEmptyCodeFontFamily?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function useDocumentAppearance({ cleanupCodeFontProperties, clearEmptyCodeFontFamily, codeFontFamily, codeFontSize, theme, }: UseDocumentAppearanceOptions): void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type PointerEvent as ReactPointerEvent } from 'react';
|
|
2
|
+
type UseResizableSidebarOptions = {
|
|
3
|
+
collapseThreshold?: number;
|
|
4
|
+
onCollapse?: () => void;
|
|
5
|
+
onWidthCommit: (width: number) => void;
|
|
6
|
+
readWidth: () => number;
|
|
7
|
+
};
|
|
8
|
+
export declare function useResizableSidebar({ collapseThreshold, onCollapse, onWidthCommit, readWidth, }: UseResizableSidebarOptions): {
|
|
9
|
+
resizeSidebar: (event: ReactPointerEvent<HTMLDivElement>) => void;
|
|
10
|
+
sidebarWidth: number;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Dispatch, type SetStateAction } from 'react';
|
|
2
|
+
import type { ReviewComment } from '../../lib/app-types.ts';
|
|
3
|
+
type ReviewCommentDraft = Pick<ReviewComment, 'body' | 'id'>;
|
|
4
|
+
type UseReviewCommentDraftsOptions = {
|
|
5
|
+
canCreateComment?: boolean;
|
|
6
|
+
comments: ReadonlyArray<ReviewComment>;
|
|
7
|
+
onCommentFileChange: (filePath: string) => void;
|
|
8
|
+
setComments: Dispatch<SetStateAction<ReadonlyArray<ReviewComment>>>;
|
|
9
|
+
};
|
|
10
|
+
export declare function useReviewCommentDrafts({ canCreateComment, comments, onCommentFileChange, setComments, }: UseReviewCommentDraftsOptions): {
|
|
11
|
+
activeReviewCommentDraftRef: import("react").RefObject<ReviewCommentDraft | null>;
|
|
12
|
+
activeReviewCommentDraftState: ReviewCommentDraft | null;
|
|
13
|
+
clearCommentFocus: (commentId: string) => void;
|
|
14
|
+
createComment: (comment: Omit<ReviewComment, 'body' | 'id'>) => void;
|
|
15
|
+
deleteComment: (commentId: string) => void;
|
|
16
|
+
focusCommentId: string | null;
|
|
17
|
+
focusCommentRequest: number;
|
|
18
|
+
resetCommentFocus: () => void;
|
|
19
|
+
reviewCommentsRef: import("react").RefObject<readonly ReviewComment[]>;
|
|
20
|
+
updateActiveReviewCommentDraft: (comment: ReviewCommentDraft | null) => void;
|
|
21
|
+
updateComment: (commentId: string, body: string) => void;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReviewIdentity } from '../../lib/app-types.ts';
|
|
2
|
+
import type { ChangedFile } from '../../types.ts';
|
|
3
|
+
type UseReviewFileStateOptions = {
|
|
4
|
+
initialSelectedPath?: string | null;
|
|
5
|
+
onViewedChange?: (viewed: Record<string, string>) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function useReviewFileState({ initialSelectedPath, onViewedChange, }?: UseReviewFileStateOptions): {
|
|
8
|
+
bumpItemVersion: (key: string) => void;
|
|
9
|
+
collapsed: Set<string>;
|
|
10
|
+
expandedGenerated: Set<string>;
|
|
11
|
+
itemVersionByKey: Record<string, number>;
|
|
12
|
+
selectedPath: string | null;
|
|
13
|
+
setCollapsed: import("react").Dispatch<import("react").SetStateAction<Set<string>>>;
|
|
14
|
+
setExpandedGenerated: import("react").Dispatch<import("react").SetStateAction<Set<string>>>;
|
|
15
|
+
setItemVersionByKey: import("react").Dispatch<import("react").SetStateAction<Record<string, number>>>;
|
|
16
|
+
setSelectedPath: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
17
|
+
setViewed: import("react").Dispatch<import("react").SetStateAction<Record<string, string>>>;
|
|
18
|
+
toggleCollapsed: (file: ChangedFile, isCollapsed: boolean, reviewKey?: string) => void;
|
|
19
|
+
toggleViewed: (file: ChangedFile, isViewed: boolean, reviewIdentity?: ReviewIdentity) => void;
|
|
20
|
+
viewed: Record<string, string>;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CodiffKeymap } from './types.ts';
|
|
2
|
+
export declare const matchesShortcut: (event: Pick<KeyboardEvent, 'altKey' | 'ctrlKey' | 'key' | 'metaKey' | 'shiftKey'>, keymap: CodiffKeymap, action: keyof CodiffKeymap) => boolean;
|
|
3
|
+
export declare const getShortcutLabel: (keymap: CodiffKeymap, action: keyof CodiffKeymap) => string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type CodiffDiffStyle = 'split' | 'unified';
|
|
2
|
+
export type CodiffTheme = 'system' | 'light' | 'dark';
|
|
3
|
+
export type CodiffAgentBackend = 'codex' | 'claude' | 'opencode' | 'pi';
|
|
4
|
+
export type CodiffSettings = {
|
|
5
|
+
agentBackend: CodiffAgentBackend;
|
|
6
|
+
claudeModel: string;
|
|
7
|
+
codeFontFamily: string;
|
|
8
|
+
codeFontSize: number;
|
|
9
|
+
copyCommentsOnClose: boolean;
|
|
10
|
+
diffStyle: CodiffDiffStyle;
|
|
11
|
+
editorCommand: string;
|
|
12
|
+
lastRepositoryPath: string;
|
|
13
|
+
openAIModel: string;
|
|
14
|
+
opencodeModel: string;
|
|
15
|
+
piModel: string;
|
|
16
|
+
reviewCommentsPrefix: string;
|
|
17
|
+
showOutdated: boolean;
|
|
18
|
+
showWhitespace: boolean;
|
|
19
|
+
theme: CodiffTheme;
|
|
20
|
+
walkthroughPrompt: string;
|
|
21
|
+
wordWrap: boolean;
|
|
22
|
+
};
|
|
23
|
+
export type KeyCombo = string;
|
|
24
|
+
export type KeyComboBinding = KeyCombo | ReadonlyArray<KeyCombo>;
|
|
25
|
+
export type CodiffKeymap = {
|
|
26
|
+
closeSearch: KeyCombo;
|
|
27
|
+
commandBar: KeyCombo;
|
|
28
|
+
diffSearch: KeyCombo;
|
|
29
|
+
discardComment: KeyCombo;
|
|
30
|
+
fileFilter: KeyCombo;
|
|
31
|
+
nextHunk: KeyComboBinding;
|
|
32
|
+
nextSearchMatch: KeyCombo;
|
|
33
|
+
openFile: KeyCombo;
|
|
34
|
+
prevHunk: KeyComboBinding;
|
|
35
|
+
prevSearchMatch: KeyCombo;
|
|
36
|
+
shortcutsHelp: KeyCombo;
|
|
37
|
+
submitComment: KeyCombo;
|
|
38
|
+
toggleSidebar: KeyCombo;
|
|
39
|
+
toggleWordWrap: KeyCombo;
|
|
40
|
+
};
|
|
41
|
+
export type CodiffConfig = {
|
|
42
|
+
keymap: CodiffKeymap;
|
|
43
|
+
settings: CodiffSettings;
|
|
44
|
+
};
|
|
Binary file
|
|
Binary file
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { defaultReviewPreferences } from './defaults.ts';
|
|
2
|
+
export { parsePlanShareManifest, parsePlanShareUpload, type PlanShareManifestV1, type ShareUploader, } from './share.ts';
|
|
3
|
+
export type { ChangedFile, CodiffFeatureFlags, CodiffPreferences, DiffSection, GitIdentity, NarrativeWalkthrough, PlanCommentThread, PullRequestCodeQualityFinding, PullRequestGeneralComment, PullRequestGeneralCommentThread, PullRequestExistingReviewComment, PullRequestMergeOptions, PullRequestMergeState, PullRequestReviewComment, PullRequestReviewEvent, PullRequestReviewStatus, PullRequestReviewer, ReviewPreferences, RepositoryState, ReviewSource, SharePlanResult, ShareWalkthroughResult, SharedPlanSnapshot, SharedWalkthroughSnapshot, WalkthroughShareManifestV1, WalkthroughHunk, } from './types.ts';
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { parsePlanShareManifest, parsePlanShareUpload } from "./share.mjs";
|
|
2
|
+
//#region defaults.ts
|
|
3
|
+
const defaultReviewPreferences = Object.freeze({
|
|
4
|
+
codeFontFamily: "Fira Code",
|
|
5
|
+
codeFontSize: 13,
|
|
6
|
+
diffStyle: "split",
|
|
7
|
+
showWhitespace: false,
|
|
8
|
+
theme: "system",
|
|
9
|
+
wordWrap: false
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { defaultReviewPreferences, parsePlanShareManifest, parsePlanShareUpload };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CodiffAgentBackend } from '../config/types.ts';
|
|
2
|
+
import type { AgentSkillStatus, CodiffLaunchOptions, TerminalHelperStatus } from '../types.ts';
|
|
3
|
+
export declare const HISTORY_PAGE_SIZE = 30;
|
|
4
|
+
export declare const defaultLaunchOptions: CodiffLaunchOptions;
|
|
5
|
+
export declare const defaultAgentSkillStatus: AgentSkillStatus;
|
|
6
|
+
export declare const getAgentLabel: (backend: CodiffAgentBackend) => string;
|
|
7
|
+
export declare const defaultTerminalHelperStatus: TerminalHelperStatus;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { CodeViewHandle } from '@pierre/diffs/react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { ChangedFile, DiffSection, NarrativeWalkthrough, NarrativeWalkthroughResult, PullRequestCodeQualityFinding, PullRequestExistingReviewComment, ReviewSource } from '../types.ts';
|
|
4
|
+
export type WalkthroughError = Extract<NarrativeWalkthroughResult, {
|
|
5
|
+
status: 'unavailable';
|
|
6
|
+
}>;
|
|
7
|
+
export type ReviewCommentAnnotationMetadata = {
|
|
8
|
+
commentIds: ReadonlyArray<string>;
|
|
9
|
+
type: 'review-comment';
|
|
10
|
+
};
|
|
11
|
+
export type CodeQualityAnnotationMetadata = {
|
|
12
|
+
finding: PullRequestCodeQualityFinding;
|
|
13
|
+
type: 'code-quality';
|
|
14
|
+
};
|
|
15
|
+
type MarkdownPreviewAnnotationMetadata = {
|
|
16
|
+
addedLines: ReadonlySet<number>;
|
|
17
|
+
contents: string;
|
|
18
|
+
editable: boolean;
|
|
19
|
+
layoutKey: string;
|
|
20
|
+
path: string;
|
|
21
|
+
sectionId: string;
|
|
22
|
+
type: 'markdown-preview';
|
|
23
|
+
};
|
|
24
|
+
type ImagePreviewAnnotationMetadata = {
|
|
25
|
+
path: string;
|
|
26
|
+
sectionId: string;
|
|
27
|
+
type: 'image-preview';
|
|
28
|
+
};
|
|
29
|
+
type WalkthroughHeaderAnnotationMetadata = {
|
|
30
|
+
header: ReactNode;
|
|
31
|
+
type: 'walkthrough-header';
|
|
32
|
+
};
|
|
33
|
+
export type ReviewAnnotationMetadata = CodeQualityAnnotationMetadata | ImagePreviewAnnotationMetadata | MarkdownPreviewAnnotationMetadata | ReviewCommentAnnotationMetadata | WalkthroughHeaderAnnotationMetadata;
|
|
34
|
+
export type CodeViewInstance = NonNullable<ReturnType<CodeViewHandle<ReviewAnnotationMetadata>['getInstance']>>;
|
|
35
|
+
export type DiffSearchMatch = {
|
|
36
|
+
filePath: string;
|
|
37
|
+
itemId: string;
|
|
38
|
+
lineNumber?: number;
|
|
39
|
+
side?: 'additions' | 'deletions';
|
|
40
|
+
};
|
|
41
|
+
export type DiffSearchResult = {
|
|
42
|
+
file: ChangedFile;
|
|
43
|
+
matchCount: number;
|
|
44
|
+
matches: ReadonlyArray<DiffSearchMatch>;
|
|
45
|
+
};
|
|
46
|
+
export type ReviewScrollBehavior = 'instant' | 'smooth';
|
|
47
|
+
export type ReviewScrollTarget = {
|
|
48
|
+
behavior?: ReviewScrollBehavior;
|
|
49
|
+
blockId?: string;
|
|
50
|
+
path?: string;
|
|
51
|
+
request: number;
|
|
52
|
+
};
|
|
53
|
+
export type ReviewIdentity = {
|
|
54
|
+
fingerprint: string;
|
|
55
|
+
key: string;
|
|
56
|
+
};
|
|
57
|
+
export type DiffLineCount = {
|
|
58
|
+
additions: number;
|
|
59
|
+
countable: boolean;
|
|
60
|
+
deletions: number;
|
|
61
|
+
};
|
|
62
|
+
export type ReviewComment = {
|
|
63
|
+
anchor?: 'file' | 'line';
|
|
64
|
+
author?: PullRequestExistingReviewComment['author'];
|
|
65
|
+
body: string;
|
|
66
|
+
canDelete?: boolean;
|
|
67
|
+
canEdit?: boolean;
|
|
68
|
+
canReplyThread?: boolean;
|
|
69
|
+
canResolveThread?: boolean;
|
|
70
|
+
codexReply?: {
|
|
71
|
+
body?: string;
|
|
72
|
+
error?: string;
|
|
73
|
+
status: 'error' | 'loading' | 'ready';
|
|
74
|
+
};
|
|
75
|
+
filePath: string;
|
|
76
|
+
id: string;
|
|
77
|
+
isOutdated?: boolean;
|
|
78
|
+
isReadOnly?: boolean;
|
|
79
|
+
isThreadResolved?: boolean;
|
|
80
|
+
lineNumber?: number;
|
|
81
|
+
remoteSubmit?: {
|
|
82
|
+
error?: string;
|
|
83
|
+
status: 'error' | 'submitting';
|
|
84
|
+
};
|
|
85
|
+
sectionId: string;
|
|
86
|
+
side?: 'additions' | 'deletions';
|
|
87
|
+
startLineNumber?: number;
|
|
88
|
+
startSide?: 'additions' | 'deletions';
|
|
89
|
+
submittedAt?: string;
|
|
90
|
+
threadId?: string;
|
|
91
|
+
url?: string;
|
|
92
|
+
};
|
|
93
|
+
export type SidebarMode = 'tree' | 'walkthrough' | 'history';
|
|
94
|
+
export type PullRequestSource = Extract<ReviewSource, {
|
|
95
|
+
type: 'pull-request';
|
|
96
|
+
}>;
|
|
97
|
+
export type WalkthroughNote = {
|
|
98
|
+
action: 'review' | 'scan' | 'skim';
|
|
99
|
+
context: string;
|
|
100
|
+
groupReason: string;
|
|
101
|
+
groupTitle: string;
|
|
102
|
+
impact: 'wide' | 'contained' | 'mechanical';
|
|
103
|
+
order: number;
|
|
104
|
+
reason: string;
|
|
105
|
+
};
|
|
106
|
+
export type SourceSession = {
|
|
107
|
+
collapsed: Set<string>;
|
|
108
|
+
expandedGenerated: Set<string>;
|
|
109
|
+
/** Populated by a generated or pre-authored narrative walkthrough document. */
|
|
110
|
+
narrativeWalkthrough?: NarrativeWalkthrough | null;
|
|
111
|
+
reviewComments: ReadonlyArray<ReviewComment>;
|
|
112
|
+
selectedPath: string | null;
|
|
113
|
+
viewed: Record<string, string>;
|
|
114
|
+
walkthroughError: WalkthroughError | null;
|
|
115
|
+
walkthroughOutdatedPaths: ReadonlySet<string>;
|
|
116
|
+
};
|
|
117
|
+
export type RepositoryLoadError = {
|
|
118
|
+
kind: 'generic' | 'not-a-repository';
|
|
119
|
+
message: string;
|
|
120
|
+
};
|
|
121
|
+
export type CodeViewItemMetadata = {
|
|
122
|
+
blockId: string;
|
|
123
|
+
canEditMarkdown: boolean;
|
|
124
|
+
canRenderMarkdown: boolean;
|
|
125
|
+
comments: ReadonlyArray<ReviewComment>;
|
|
126
|
+
file: ChangedFile;
|
|
127
|
+
isCollapsed: boolean;
|
|
128
|
+
isMarkdownPreview: boolean;
|
|
129
|
+
isSelected: boolean;
|
|
130
|
+
isViewed: boolean;
|
|
131
|
+
lineCount: DiffLineCount;
|
|
132
|
+
reviewIdentity: ReviewIdentity;
|
|
133
|
+
section: DiffSection;
|
|
134
|
+
sectionCount: number;
|
|
135
|
+
walkthroughNote?: WalkthroughNote;
|
|
136
|
+
};
|
|
137
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { DiffSection, GitFileStatus } from '../types.ts';
|
|
2
|
+
export declare const statusLabel: Record<GitFileStatus, string>;
|
|
3
|
+
export declare const sectionLabel: Record<DiffSection['kind'], string>;
|
|
4
|
+
export declare const DEFAULT_PADDING = 11;
|
|
5
|
+
export declare const codeViewLayout: {
|
|
6
|
+
gap: number;
|
|
7
|
+
paddingBottom: number;
|
|
8
|
+
paddingTop: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const codeViewItemMetrics: {
|
|
11
|
+
diffHeaderHeight: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const DIFF_LINE_HEIGHT = 20;
|
|
14
|
+
export declare const diffContextExpansionLineCount = 100;
|
|
15
|
+
export declare const diffCollapsedContextThreshold = 12;
|
|
16
|
+
export declare const workerHighlighterOptions: {
|
|
17
|
+
maxLineDiffLength: number;
|
|
18
|
+
theme: {
|
|
19
|
+
dark: string;
|
|
20
|
+
light: string;
|
|
21
|
+
};
|
|
22
|
+
tokenizeMaxLineLength: number;
|
|
23
|
+
useTokenTransformer: boolean;
|
|
24
|
+
};
|
|
25
|
+
export declare const maxWorkerThreads = 3;
|
|
26
|
+
export declare const codeViewUnsafeCSS = "\n :host {\n border-radius: var(--codiff-diff-radius, 28px);\n corner-shape: squircle;\n --diffs-font-family: var(--font-diff-mono, var(--font-mono));\n --diffs-header-font-family: var(--font-sans);\n --diffs-font-size: var(--font-diff-size, 13px);\n --diffs-line-height: var(--font-diff-line-height, 20px);\n --diffs-light-bg: var(--code-bg);\n --diffs-dark-bg: var(--code-bg);\n --diffs-bg-selection-override: rgb(61 135 245 / 0.34);\n --diffs-bg-selection-number-override: rgb(61 135 245 / 0.46);\n }\n\n [data-diff-type=\"split\"][data-overflow=\"scroll\"] {\n grid-template-columns: minmax(0, 42fr) minmax(0, 58fr);\n }\n\n [data-diffs-header=\"custom\"][data-sticky] {\n background-color: transparent;\n border-radius: 0;\n }\n\n :host(.codiff-walkthrough-header-item) {\n background: var(--app-bg);\n border-radius: 0;\n box-shadow: none;\n corner-shape: initial;\n overflow: visible;\n }\n\n :host(.codiff-walkthrough-header-item) [data-file],\n :host(.codiff-walkthrough-header-item) pre,\n :host(.codiff-walkthrough-header-item) code,\n :host(.codiff-walkthrough-header-item) [data-code],\n :host(.codiff-walkthrough-header-item) [data-line-annotation] {\n background: var(--app-bg);\n border-radius: 0;\n box-shadow: none;\n overflow: visible;\n }\n\n :host(.codiff-walkthrough-header-item) [data-column-number],\n :host(.codiff-walkthrough-header-item) [data-line-number],\n :host(.codiff-walkthrough-header-item) [data-gutter],\n :host(.codiff-walkthrough-header-item) [data-gutter-buffer],\n :host(.codiff-walkthrough-header-item) [data-content] > [data-line] {\n display: none;\n }\n\n .review-comment-thread {\n padding: 8px 0 8px 16px;\n }\n\n /* Align scrollbar with number column */\n [data-code]::-webkit-scrollbar-track {\n margin-left: var(--diffs-column-number-width);\n }\n\n /* Ensure right edge of scrollbar never gets cropped by rounded corners */\n [data-file] [data-code]::-webkit-scrollbar-track,\n [data-diff-type=\"single\"] [data-code]::-webkit-scrollbar-track,\n [data-diff-type=\"split\"] [data-code][data-additions]::-webkit-scrollbar-track {\n margin-right: 14px;\n }\n\n :host(.codiff-markdown-preview-item) [data-file] [data-code] {\n grid-column: 1 / -1;\n }\n\n :host(.codiff-markdown-preview-item) [data-file] [data-line=\"1\"][data-line-index=\"0\"][data-line-type=\"context\"],\n :host(.codiff-markdown-preview-item) [data-file] [data-column-number=\"1\"][data-line-index=\"0\"][data-line-type=\"context\"],\n :host(.codiff-markdown-preview-item) [data-gutter] > [data-gutter-utility-slot] {\n display: none;\n pointer-events: none;\n }\n\n :host(.codiff-image-preview-item) [data-file] {\n --diffs-code-grid: 1fr;\n }\n\n :host(.codiff-image-preview-item) [data-file] [data-code] {\n grid-column: 1 / -1;\n padding-block: 0;\n }\n\n :host(.codiff-image-preview-item) [data-file] [data-content] {\n grid-column: 1;\n }\n\n :host(.codiff-image-preview-item) [data-file] [data-gutter],\n :host(.codiff-image-preview-item) [data-file] [data-line=\"1\"][data-line-index=\"0\"][data-line-type=\"context\"] {\n display: none;\n pointer-events: none;\n }\n\n :host(.codiff-loadable-summary-item) [data-file] [data-line],\n :host(.codiff-loadable-summary-item) [data-file] [data-column-number] {\n cursor: pointer;\n }\n\n :host(.codiff-loading-summary-item) [data-file] [data-line],\n :host(.codiff-loading-summary-item) [data-file] [data-column-number] {\n cursor: progress;\n }\n\n .codiff-search-mark {\n background: var(--diffs-find-highlight-bg, rgb(255 216 92 / 0.65));\n border-radius: 3px;\n color: inherit;\n padding: 0 1px;\n }\n\n .codiff-search-mark.active {\n background: var(--diffs-find-active-bg, rgb(255 176 46 / 0.96));\n box-shadow: 0 0 0 1px rgb(255 142 36 / 0.4);\n }\n\n [data-utility-button] {\n background: color-mix(in srgb, var(--diffs-bg) 88%, var(--diffs-modified-base));\n border: 1px solid color-mix(in srgb, var(--diffs-modified-base) 34%, transparent);\n border-radius: 3px;\n box-shadow: 0 7px 18px -14px rgb(0 0 0 / 0.72);\n color: var(--diffs-modified-base);\n height: calc(1lh - 4px);\n transform: translate(-4px, 2px);\n width: calc(1lh - 4px);\n }\n\n [data-selected-line] [data-gutter-utility-slot] {\n display: none;\n }\n";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CodiffKeymap } from '../config/types.ts';
|
|
2
|
+
export type Command = {
|
|
3
|
+
description?: () => string | null;
|
|
4
|
+
execute: () => void;
|
|
5
|
+
id: string;
|
|
6
|
+
keymapAction?: keyof CodiffKeymap;
|
|
7
|
+
title: string;
|
|
8
|
+
};
|
|
9
|
+
export type CommandRegistry = {
|
|
10
|
+
commands: ReadonlyArray<Command>;
|
|
11
|
+
register: (command: Command) => () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const createCommandRegistry: () => CommandRegistry;
|
|
14
|
+
export declare const filterCommands: (commands: ReadonlyArray<Command>, query: string) => ReadonlyArray<Command>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type FileDiffLoadedFiles, type FileDiffMetadata } from '@pierre/diffs';
|
|
2
|
+
import type { ChangedFile, DiffSection } from '../types.ts';
|
|
3
|
+
import type { DiffLineCount } from './app-types.ts';
|
|
4
|
+
export declare const getItemId: (section: DiffSection) => string;
|
|
5
|
+
export declare const isMarkdownFilePath: (path: string) => boolean;
|
|
6
|
+
export declare const canRenderImagePreview: (path: string, section: DiffSection) => boolean;
|
|
7
|
+
export declare const isPatchOnlyDiffSection: (section: DiffSection) => boolean;
|
|
8
|
+
export declare const shouldLoadDiffSectionContents: (section: DiffSection) => boolean;
|
|
9
|
+
export declare const shouldPreloadSectionContentsForSearch: (section: DiffSection) => boolean;
|
|
10
|
+
export declare const getSectionForFileDiff: (fileDiff: FileDiffMetadata) => {
|
|
11
|
+
file: ChangedFile;
|
|
12
|
+
section: DiffSection;
|
|
13
|
+
} | undefined;
|
|
14
|
+
export declare const loadSectionContents: (file: ChangedFile, section: DiffSection, load: (file: ChangedFile, section: DiffSection) => Promise<FileDiffLoadedFiles>) => Promise<FileDiffLoadedFiles>;
|
|
15
|
+
export type MarkdownPreviewContents = {
|
|
16
|
+
addedLines: ReadonlySet<number>;
|
|
17
|
+
contents: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const getMarkdownPreviewContents: (file: ChangedFile, section: DiffSection, fileDiff: FileDiffMetadata) => MarkdownPreviewContents | null;
|
|
20
|
+
export declare const getDiffLineCountFromVisibleSections: (sections: ReadonlyArray<{
|
|
21
|
+
fileDiff: FileDiffMetadata;
|
|
22
|
+
section: DiffSection;
|
|
23
|
+
}>) => DiffLineCount;
|
|
24
|
+
export declare const getDiffLineCount: (file: ChangedFile, showWhitespace: boolean) => DiffLineCount;
|
|
25
|
+
export declare const getTotalDiffLineCount: (lineCounts: Iterable<DiffLineCount>) => DiffLineCount;
|
|
26
|
+
export declare const formatLineCountNumber: (value: number) => string;
|
|
27
|
+
export declare const formatTreeLineCount: ({ additions, deletions }: DiffLineCount) => string;
|
|
28
|
+
export declare const getDiffLineCountTitle: ({ additions, deletions }: DiffLineCount) => string;
|
|
29
|
+
export declare const parseSectionDiffWithOptions: (file: ChangedFile, section: DiffSection, showWhitespace: boolean) => FileDiffMetadata;
|
|
30
|
+
export declare const getVisibleDiffSections: (file: ChangedFile, showWhitespace: boolean) => {
|
|
31
|
+
fileDiff: FileDiffMetadata;
|
|
32
|
+
section: DiffSection;
|
|
33
|
+
}[];
|
|
34
|
+
export declare const fileHasVisibleDiff: (file: ChangedFile, showWhitespace: boolean) => boolean;
|
|
35
|
+
export declare const getFirstVisibleSection: (file: ChangedFile, showWhitespace: boolean) => DiffSection;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ChangedFile, GitFileStatus } from '../types.ts';
|
|
2
|
+
export declare const statusForTree: Record<GitFileStatus, 'added' | 'deleted' | 'modified' | 'renamed' | 'untracked'>;
|
|
3
|
+
export declare const fileTreeSort: (left: {
|
|
4
|
+
isDirectory: boolean;
|
|
5
|
+
path: string;
|
|
6
|
+
segments?: ReadonlyArray<string>;
|
|
7
|
+
}, right: {
|
|
8
|
+
isDirectory: boolean;
|
|
9
|
+
path: string;
|
|
10
|
+
segments?: ReadonlyArray<string>;
|
|
11
|
+
}) => number;
|
|
12
|
+
export declare const compactPath: (path: string) => string;
|
|
13
|
+
export declare const sortFiles: (files: ReadonlyArray<ChangedFile>) => ChangedFile[];
|
|
14
|
+
export declare const fuzzyMatches: (path: string, query: string) => boolean;
|