@gitkraken/gitkraken-components 1.1.0-rc.9 → 2.1.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.
@@ -1,6 +1,7 @@
1
1
  // eslint-disable-next-line no-unused-vars
2
2
  import * as React from 'react';
3
3
  import {
4
+ CommitDateTimeSources,
4
5
  commitNodeType,
5
6
  mergeConflictNodeType,
6
7
  mergeNodeType,
@@ -30,7 +31,8 @@ export type WorkDirType = typeof mergeConflictNodeType
30
31
  export type WorkDirStats = {
31
32
  added: number,
32
33
  deleted: number,
33
- modified: number
34
+ modified: number,
35
+ context?: GraphItemContext
34
36
  // TODO: Add renamed once available in GitLens from provider
35
37
  // renamed: number
36
38
  };
@@ -66,6 +68,12 @@ export type RowContexts = {
66
68
  sha?: GraphItemContext;
67
69
  };
68
70
 
71
+ export type RowStats = {
72
+ files: number;
73
+ additions: number;
74
+ deletions: number;
75
+ };
76
+
69
77
  export type GraphContexts = {
70
78
  graph?: GraphItemContext;
71
79
  header?: GraphItemContext;
@@ -101,6 +109,7 @@ export type GraphRow = {
101
109
  remotes?: Remote[];
102
110
  tags?: Tag[];
103
111
  contexts?: RowContexts;
112
+ stats?: RowStats;
104
113
  };
105
114
 
106
115
  export type GraphColumnSetting = {
@@ -148,9 +157,14 @@ export type GraphRefGroup = Array<GraphRef>;
148
157
  export type RefMetadataById = { [id: string]: RefMetadata | null | undefined } | null;
149
158
  export type RefMetadata = {
150
159
  pullRequests?: PullRequestMetadata[] | null;
160
+ upstream?: UpstreamMetadata | null;
151
161
  };
152
162
 
153
- export type PullRequestMetadata = {
163
+ export interface BaseMetadata {
164
+ context?: GraphItemContext;
165
+ }
166
+
167
+ export interface PullRequestMetadata extends BaseMetadata {
154
168
  hostingServiceType: HostingServiceType;
155
169
  id: number;
156
170
  title: string;
@@ -158,8 +172,15 @@ export type PullRequestMetadata = {
158
172
  date?: number;
159
173
  state?: string;
160
174
  url?: string;
161
- context?: GraphItemContext;
162
- };
175
+ }
176
+
177
+ export interface UpstreamMetadata extends BaseMetadata {
178
+ name: string;
179
+ owner: string;
180
+ ahead: number;
181
+ behind: number;
182
+ sha?: Sha;
183
+ }
163
184
 
164
185
  // Hosting service types for pull request metadata
165
186
  export const gitHubDotComHostingServiceType = 'github';
@@ -182,22 +203,30 @@ export type RefsMissingMetadata = {
182
203
  [refId: string]: RefMetadataType[]
183
204
  }
184
205
  export const pullRequestMetadataType = 'pullRequests';
206
+ export const upstreamMetadataType = 'upstream';
185
207
  // Expand this as we add more types to RefMetadata
186
- export type RefMetadataType = typeof pullRequestMetadataType;
208
+ export type RefMetadataType = typeof pullRequestMetadataType | typeof upstreamMetadataType;
209
+ export type RefMetadataItem = PullRequestMetadata | UpstreamMetadata;
210
+ export type RefMetadataItemWithIdAndType = RefMetadataItem & {
211
+ refId: string;
212
+ metadataType: RefMetadataType;
213
+ };
214
+
215
+ export type CommitDateTimeSource = CommitDateTimeSources;
187
216
 
188
217
  // Callbacks
189
218
  export type GetExternalIcon = (key: string) => React.ReactElement<any>;
190
219
  export type TranslationFn = (key: string, ...formatArgs: any) => string;
191
- export type OnFormatCommitDateTime = (commitDateTime: number) => string;
220
+ export type OnFormatCommitDateTime = (commitDateTime: number, source?: CommitDateTimeSource) => string;
192
221
 
193
222
  // Events
194
223
  export type OnRowContextMenu = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
195
224
  export type OnRefContextMenu = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
196
225
  export type OnToggleRefsVisibilityClick = (event: React.MouseEvent, refs: GraphRefOptData[], visible: boolean, graphRow?: GraphRow) => void;
197
226
  export type OnClickGraphRow = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
198
- export type OnClickGraphRef = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
227
+ export type OnClickGraphRef = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow, metadataItem?: RefMetadataItemWithIdAndType) => void;
199
228
  export type OnDoubleClickGraphRow = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
200
- export type OnDoubleClickGraphRef = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
229
+ export type OnDoubleClickGraphRef = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow, metadataItem?: RefMetadataItemWithIdAndType) => void;
201
230
  export type OnSelectGraphRows = (selectedRows: GraphRow[]) => void;
202
231
  export type OnGraphRowHovered = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
203
232
  export type OnGraphRowUnhovered = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
@@ -206,6 +235,9 @@ export type OnGraphRefNodeUnhovered = (event: any, refGroup: GraphRefGroup, grap
206
235
  export type OnGraphColumnsReOrdered = (columnsSettings: GraphColumnsSettings) => void;
207
236
  export type OnGraphColumnResized = (graphZoneType: GraphZoneType, columnSettings: GraphColumnSetting) => void;
208
237
  export type OnGraphResized = (width: number, height: number) => void;
238
+ export type OnGraphVisibleRowsChanged = (topVisibleRow: GraphRow, bottomVisibleRow: GraphRow) => void;
239
+ export type OnGraphMouseEnter = (event: any) => void;
240
+ export type OnGraphMouseLeave = (event: any) => void;
209
241
  export type OnShowMoreCommits = () => void;
210
242
  export type OnEmailsMissingAvatarUrls = (emails: AvatarUrlByEmail) => void;
211
243
  export type OnRefsMissingMetadata = (refs: RefsMissingMetadata) => void;
@@ -216,13 +248,15 @@ export interface GraphContainerProps {
216
248
  contexts?: GraphContexts;
217
249
  platform?: GraphPlatform;
218
250
  cssVariables?: CssVariables;
251
+ dimMergeCommits?: boolean;
219
252
  getExternalIcon: GetExternalIcon;
220
- highlightRowsOnRefHover?: boolean,
253
+ highlightRowsOnRefHover?: boolean;
221
254
  isContainerWindowFocused?: boolean;
222
- showGhostRefsOnRowHover?: boolean,
223
- showRemoteNamesOnRefs?: boolean,
224
- scrollRowPadding?: number,
225
- enableMultiSelection?: boolean,
255
+ showGhostRefsOnRowHover?: boolean;
256
+ showRemoteNamesOnRefs?: boolean;
257
+ enabledRefMetadataTypes?: RefMetadataType[];
258
+ scrollRowPadding?: number;
259
+ enableMultiSelection?: boolean;
226
260
  graphRows: GraphRow[];
227
261
  hasMoreCommits?: boolean;
228
262
  highlightedShas?: HighlightedShas;
@@ -239,12 +273,12 @@ export interface GraphContainerProps {
239
273
  workDirStats?: WorkDirStats;
240
274
  onRowContextMenu?: OnRowContextMenu;
241
275
  onRefContextMenu?: OnRefContextMenu;
242
- onToggleRefsVisibilityClick?: OnToggleRefsVisibilityClick,
276
+ onToggleRefsVisibilityClick?: OnToggleRefsVisibilityClick;
243
277
  onGraphRowHovered?: OnGraphRowHovered;
244
278
  onGraphRowUnhovered?: OnGraphRowUnhovered;
245
279
  onGraphRefNodeHovered?: OnGraphRefNodeHovered;
246
280
  onGraphRefNodeUnhovered?: OnGraphRefNodeUnhovered;
247
- onGraphColumnsReOrdered?: OnGraphColumnsReOrdered,
281
+ onGraphColumnsReOrdered?: OnGraphColumnsReOrdered;
248
282
  onColumnResized?: OnGraphColumnResized;
249
283
  onClickGraphRef?: OnClickGraphRef;
250
284
  onClickGraphRow?: OnClickGraphRow;
@@ -253,10 +287,13 @@ export interface GraphContainerProps {
253
287
  onSelectGraphRows?: OnSelectGraphRows;
254
288
  onShowMoreCommits?: OnShowMoreCommits;
255
289
  onGraphResized?: OnGraphResized;
290
+ onGraphVisibleRowsChanged?: OnGraphVisibleRowsChanged;
291
+ onGraphMouseEnter?: OnGraphMouseEnter;
292
+ onGraphMouseLeave?: OnGraphMouseLeave;
256
293
  onEmailsMissingAvatarUrls?: OnEmailsMissingAvatarUrls;
257
294
  onRefsMissingMetadata?: OnRefsMissingMetadata;
258
295
  formatCommitDateTime?: OnFormatCommitDateTime;
259
- shaLength?: number;
296
+ shaLength?: number | null;
260
297
  nonce?: string;
261
298
  }
262
299