forked from mhutchie/vscode-git-graph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.d.ts
128 lines (104 loc) · 3.28 KB
/
global.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import * as GG from '../out/types'; // Import types from back-end (requires `npm run compile-src`)
declare global {
/* Visual Studio Code API Types */
function acquireVsCodeApi(): {
getState: () => WebViewState | null,
postMessage: (message: GG.RequestMessage) => void,
setState: (state: WebViewState) => void
};
/* State Types */
type Config = GG.GitGraphViewConfig;
const initialState: GG.GitGraphViewInitialState;
const globalState: GG.DeepReadonly<GG.GitGraphViewGlobalState>;
const workspaceState: GG.DeepReadonly<GG.GitGraphViewWorkspaceState>;
type AvatarImageCollection = { [email: string]: string };
interface ExpandedCommit {
index: number;
commitHash: string;
commitElem: HTMLElement | null;
compareWithHash: string | null;
compareWithElem: HTMLElement | null;
commitDetails: GG.GitCommitDetails | null;
fileChanges: ReadonlyArray<GG.GitFileChange> | null;
fileTree: FileTreeFolder | null;
avatar: string | null;
codeReview: GG.CodeReview | null;
lastViewedFile: string | null;
loading: boolean;
scrollTop: {
summary: number,
fileView: number
};
contextMenuOpen: {
summary: boolean,
fileView: number
};
}
interface WebViewState {
readonly currentRepo: string;
readonly currentRepoLoading: boolean;
readonly gitRepos: GG.GitRepoSet;
readonly gitBranches: ReadonlyArray<string>;
readonly gitBranchHead: string | null;
readonly gitConfig: GG.GitRepoConfig | null;
readonly gitRemotes: ReadonlyArray<string>;
readonly gitStashes: ReadonlyArray<GG.GitStash>;
readonly gitTags: ReadonlyArray<string>;
readonly commits: GG.GitCommit[];
readonly commitHead: string | null;
readonly avatars: AvatarImageCollection;
readonly currentBranches: string[] | null;
readonly moreCommitsAvailable: boolean;
readonly maxCommits: number;
readonly onlyFollowFirstParent: boolean;
readonly expandedCommit: ExpandedCommit | null;
readonly scrollTop: number;
readonly findWidget: FindWidgetState;
readonly settingsWidget: SettingsWidgetState;
}
/* Commit Details / Comparison View File Tree Types */
interface FileTreeFile {
readonly type: 'file';
readonly name: string;
readonly index: number;
reviewed: boolean;
}
interface FileTreeRepo {
readonly type: 'repo';
readonly name: string;
readonly path: string;
}
interface FileTreeFolder {
readonly type: 'folder';
readonly name: string;
readonly folderPath: string;
readonly contents: FileTreeFolderContents;
open: boolean;
reviewed: boolean;
}
type FileTreeLeaf = FileTreeFile | FileTreeRepo;
type FileTreeNode = FileTreeFolder | FileTreeLeaf;
type FileTreeFolderContents = { [name: string]: FileTreeNode };
/* Dialog & ContextMenu shared base Target interfaces */
const enum TargetType {
Commit = 'commit',
CommitDetailsView = 'cdv',
Ref = 'ref',
Repo = 'repo'
}
interface CommitOrRefTarget {
type: TargetType.Commit | TargetType.Ref | TargetType.CommitDetailsView;
elem: HTMLElement;
}
interface RepoTarget {
type: TargetType.Repo;
}
interface CommitTarget extends CommitOrRefTarget {
hash: string;
}
interface RefTarget extends CommitTarget {
ref: string;
}
}
export as namespace GG;
export = GG;