@gitkraken/gitkraken-components 6.0.3 → 7.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.
Files changed (75) hide show
  1. package/LICENSE +1 -1
  2. package/ThirdPartyNotices.txt +227 -0
  3. package/dist/components/graph/GraphColumn.d.ts +38 -0
  4. package/dist/components/graph/GraphContainer.d.ts +297 -329
  5. package/dist/components/graph/GraphHeaderRow.d.ts +36 -0
  6. package/dist/components/graph/GraphScrollMarker.d.ts +22 -0
  7. package/dist/components/graph/changeszone/ChangesBar.d.ts +11 -0
  8. package/dist/components/graph/commitzone/BackgroundStreak.d.ts +12 -0
  9. package/dist/components/graph/commitzone/CommitNode.d.ts +24 -0
  10. package/dist/components/graph/commitzone/CommitZone.d.ts +48 -0
  11. package/dist/components/graph/commitzone/GraphAvatar.d.ts +39 -0
  12. package/dist/components/graph/commitzone/Gutter.d.ts +22 -0
  13. package/dist/components/graph/commitzone/edges/Arc.d.ts +4 -0
  14. package/dist/components/graph/commitzone/edges/EdgeNodes.d.ts +3 -0
  15. package/dist/components/graph/commitzone/edges/Edges.d.ts +13 -0
  16. package/dist/components/graph/commitzone/edges/EndingEdge.d.ts +4 -0
  17. package/dist/components/graph/commitzone/edges/PassThroughEdge.d.ts +4 -0
  18. package/dist/components/graph/commitzone/edges/StartingEdge.d.ts +4 -0
  19. package/dist/components/graph/common/DraggableGraphHeader.d.ts +42 -0
  20. package/dist/components/graph/common/EntireRowSpan.d.ts +15 -0
  21. package/dist/components/graph/common/GenericGraphZone.d.ts +46 -0
  22. package/dist/components/graph/common/LoadingSpinner.d.ts +11 -0
  23. package/dist/components/graph/common/RefLine.d.ts +17 -0
  24. package/dist/components/graph/common/Timeline.d.ts +6 -0
  25. package/dist/components/graph/dnd/DndContainer.d.ts +44 -0
  26. package/dist/components/graph/refzone/Icon.d.ts +39 -0
  27. package/dist/components/graph/refzone/OverflowCount.d.ts +7 -0
  28. package/dist/components/graph/refzone/RefName.d.ts +6 -0
  29. package/dist/components/graph/refzone/RefNode.d.ts +36 -0
  30. package/dist/components/graph/refzone/RefNodes.d.ts +31 -0
  31. package/dist/components/graph/refzone/RefPopover.d.ts +15 -0
  32. package/dist/components/graph/refzone/RefZone.d.ts +54 -0
  33. package/dist/components/graph/rowRenderers/ChangesZoneRow.d.ts +8 -0
  34. package/dist/components/graph/rowRenderers/CommitAuthorZoneRow.d.ts +7 -0
  35. package/dist/components/graph/rowRenderers/CommitDateTimeZoneRow.d.ts +10 -0
  36. package/dist/components/graph/rowRenderers/CommitMessageZoneRow.d.ts +20 -0
  37. package/dist/components/graph/rowRenderers/CommitShaZoneRow.d.ts +10 -0
  38. package/dist/components/graph/rowRenderers/CommitZoneRow.d.ts +19 -0
  39. package/dist/components/graph/rowRenderers/CommitsInfoRow.d.ts +25 -0
  40. package/dist/components/graph/rowRenderers/RefZoneRow.d.ts +29 -0
  41. package/dist/components/graph/rowRenderers/TimelineMsgRow.d.ts +7 -0
  42. package/dist/components/graph/shared/Avatar.d.ts +13 -0
  43. package/dist/components/graph/shared/FileDiffTypeIcon.d.ts +13 -0
  44. package/dist/components/graph/shared/InlineWorkDirSummary.d.ts +12 -0
  45. package/dist/components/graph/shared/TinyFilesReadout.d.ts +13 -0
  46. package/dist/components/resizable/Resizable.d.ts +78 -0
  47. package/dist/domain/color/ColorHelpers.d.ts +22 -0
  48. package/dist/domain/commit/CommitConstants.d.ts +10 -0
  49. package/dist/domain/commit/CommitHelpers.d.ts +5 -0
  50. package/dist/domain/commit/CommitTypes.d.ts +9 -0
  51. package/dist/domain/cssvariable/CssVariableConstants.d.ts +259 -0
  52. package/dist/domain/cssvariable/CssVariableHelpers.d.ts +4 -0
  53. package/dist/domain/date/DateHelper.d.ts +7 -0
  54. package/dist/domain/diff/DiffConstants.d.ts +5 -0
  55. package/dist/domain/diff/DiffTypes.d.ts +9 -0
  56. package/dist/domain/edge/EdgeHelpers.d.ts +9 -0
  57. package/dist/domain/generic/GenericTypes.d.ts +34 -0
  58. package/dist/domain/graph/GraphConstants.d.ts +146 -0
  59. package/dist/domain/graph/GraphHelpers.d.ts +71 -0
  60. package/dist/domain/graph/GraphTypes.d.ts +370 -0
  61. package/dist/domain/hostingservice/HostingServiceTypes.d.ts +9 -0
  62. package/dist/domain/language/LanguageConstants.d.ts +3 -0
  63. package/dist/domain/language/LanguageHelpers.d.ts +1 -0
  64. package/dist/domain/language/LanguageTypes.d.ts +1 -0
  65. package/dist/domain/reactvirtualized/ReactVirtualizedHelpers.d.ts +11 -0
  66. package/dist/domain/ref/RefConstants.d.ts +5 -0
  67. package/dist/domain/ref/RefTypes.d.ts +2 -0
  68. package/dist/domain/ui/UiTypes.d.ts +28 -0
  69. package/dist/domain/workdir/WorkDirTypes.d.ts +7 -0
  70. package/dist/index.d.ts +8 -2
  71. package/dist/index.js +1 -1
  72. package/dist/styles.css +2 -1
  73. package/dist/utils/MathUtils.d.ts +1 -0
  74. package/dist/utils/TextFormatting.d.ts +2 -0
  75. package/package.json +86 -82
@@ -1,338 +1,306 @@
1
- // eslint-disable-next-line no-unused-vars
2
- import * as React from 'react';
3
- import {
4
- CommitDateTimeSources,
5
- commitNodeType,
6
- mergeConflictNodeType,
7
- mergeNodeType,
8
- unsupportedRebaseWarningNodeType,
9
- stashNodeType,
10
- workDirType
11
- } from '../../domain/commit/CommitConstants';
12
-
13
- // Input variables
14
- export type Sha = string;
15
- export type CssVariables = { [variable: string]: string };
16
- export type ExcludeByType = {
17
- heads?: boolean;
18
- remotes?: boolean;
19
- stashes?: boolean;
20
- tags?: boolean;
21
- };
22
- export type ExcludeRefsById = { [refId: string]: GraphRefOptData };
23
- export type IncludeOnlyRefsById = { [refId: string]: GraphRefOptData };
24
- export type IsSelectedBySha = { [sha: Sha]: boolean };
25
- export type HighlightedShas = { [sha: Sha]: boolean };
26
-
27
- export type WorkDirType = typeof mergeConflictNodeType
28
- | typeof unsupportedRebaseWarningNodeType
29
- | typeof workDirType;
30
-
31
- export type WorkDirStats = {
32
- added: number,
33
- deleted: number,
34
- modified: number,
35
- context?: GraphItemContext
36
- // TODO: Add renamed once available in GitLens from provider
37
- // renamed: number
38
- };
39
-
40
- export type CommitType = typeof commitNodeType
41
- | typeof mergeNodeType
42
- | typeof mergeConflictNodeType
43
- | typeof stashNodeType
44
- | WorkDirType;
45
-
46
- export type GraphPlatform = 'aix'
47
- | 'android'
48
- | 'darwin'
49
- | 'freebsd'
50
- | 'linux'
51
- | 'openbsd'
52
- | 'sunos'
53
- | 'win32'
54
- | 'cygwin';
55
-
56
- export type GraphItemContext = string | object;
57
- export type RefGroupContexts = { [name: string]: GraphItemContext };
58
-
59
- export type RowContexts = {
60
- row?: GraphItemContext;
61
- ref?: GraphItemContext;
62
- refGroups?: RefGroupContexts;
63
- graph?: GraphItemContext;
64
- avatar?: GraphItemContext;
65
- message?: GraphItemContext;
66
- author?: GraphItemContext;
67
- date?: GraphItemContext;
68
- sha?: GraphItemContext;
69
- };
70
-
71
- export type RowStats = {
72
- files: number;
73
- additions: number;
74
- deletions: number;
75
- };
76
-
77
- export type GraphContexts = {
78
- graph?: GraphItemContext;
79
- header?: GraphItemContext;
80
- };
81
-
82
- interface Ref {
83
- id?: string;
84
- name: string;
85
- context?: GraphItemContext;
86
- contextGroup?: GraphItemContext;
1
+ /// <reference types="node" />
2
+ import type { Alignment, ScrollParams } from 'react-virtualized';
3
+ import type { ReactElement } from 'react';
4
+ import React from 'react';
5
+ import type { Sha } from '../../domain/commit/CommitTypes';
6
+ import type { CssVariables } from '../../domain/generic/GenericTypes';
7
+ import type { GraphZone, GraphZoneType } from '../../domain/graph/GraphConstants';
8
+ import { GraphMarkerType } from '../../domain/graph/GraphConstants';
9
+ import type { ThrottledFn } from '../../domain/graph/GraphHelpers';
10
+ import type { AbsoluteNodeLeftByColumn, AvatarUrlByEmail, AvatarUrlRequestedByEmail, ChildrenBySha, ColumnColorByColumn, DownstreamsByUpstream, EdgeByColumn, ExcludeByType, ExcludeRefsById, ExcludeRemotesByName, GetExternalIcon, GetMissingAvatar, GetMissingRefMetadata, GraphColumnSetting, GraphColumnsSettings, GraphContexts, GraphMarkerColors, GraphMarkerRowIndices, GraphPlatform, GraphRefGroup, GraphRefOptData, GraphRow, GraphZonesByType, Head, HighlightedShas, IncludeOnlyRefsById, IncludeOnlyRemotesByName, IsSelectedBySha, NodeOffsetByColumn, NodeOpacityByColumn, OnClearCurrentlyHoveredGraphCommit, OnClickCommit, OnClickRef, OnCommitContextMenu, OnCommitMessageChange, OnCurrentlyHoveredGraphCommit, OnDoubleClickCommit, OnDoubleClickRef, OnFormatCommitDateTime, OnGraphColumnReOrdered, OnGraphMouseEnter, OnGraphMouseLeave, OnGraphResized, OnGraphVisibleRowsChanged, OnGraphZoneResize, OnGraphZoneResizeEnd, OnPopupGraphHeaderContextMenu, OnRefNodeHovered, OnRefNodeUnhovered, OnRefZoneContextMenu, OnRefZoneHovered, OnRefZoneUnhovered, OnScrollForZone, OnToggleRefNodesShown, ProcessedGraphRow, ProcessedGraphRowBySha, RefMetadataById, RefMetadataItem, RefMetadataRequestedById, RefMetadataType, RefsMissingMetadata, Remote, ReserverInfoBySha, RowEdges, RowStatsConstraints, Tag, TopAndBottomVisibleRowIndex } from '../../domain/graph/GraphTypes';
11
+ import type { TranslationFn } from '../../domain/language/LanguageTypes';
12
+ import type { OnBlur, OnComponentWillUnmount, OnFocus, OnKeyDown, OnKeyUp, OnMouseDown, OnResizeParams } from '../../domain/ui/UiTypes';
13
+ import type { WorkDirStats } from '../../domain/workdir/WorkDirTypes';
14
+ type OnClickGraphRow = (event: React.MouseEvent<any>, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
15
+ type OnDoubleClickGraphRow = (event: React.MouseEvent<any>, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
16
+ type OnClickGraphRef = (event: React.MouseEvent<any>, refGroup: GraphRefGroup, graphRow: GraphRow, metadataItem?: RefMetadataItem) => void;
17
+ type OnDoubleClickGraphRef = (event: React.MouseEvent<any>, refGroup: GraphRefGroup, graphRow: GraphRow, metadataItem?: RefMetadataItem) => void;
18
+ type OnRowContextMenu = (event: React.MouseEvent<any>, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
19
+ type OnRefContextMenu = (event: React.MouseEvent<any>, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
20
+ type OnToggleRefsVisibilityClick = (event: React.MouseEvent<any>, refs: GraphRefOptData[], visible: boolean, graphRow?: GraphRow) => void;
21
+ type OnSelectGraphRows = (selectedRows: GraphRow[]) => void;
22
+ type OnGraphRowHovered = (event: React.MouseEvent<any>, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
23
+ type OnGraphRowUnhovered = (event: React.MouseEvent<any>, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
24
+ type OnGraphRefNodeHovered = (event: React.MouseEvent<any>, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
25
+ type OnGraphScrollForZone = (graphZoneType: GraphZoneType, scroll: ScrollParams) => void;
26
+ type OnGraphRefNodeUnhovered = (event: React.MouseEvent<any> | React.FocusEvent<any> | null, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
27
+ type OnGraphColumnsReOrdered = (columnsSettings: GraphColumnsSettings) => void;
28
+ type OnGraphColumnResized = (graphZoneType: GraphZoneType, columnSettings: GraphColumnSetting) => void;
29
+ type OnShowMoreCommits = () => void;
30
+ type OnEmailsMissingAvatarUrls = (emails: AvatarUrlByEmail) => void;
31
+ type OnRefsMissingMetadata = (refs: RefsMissingMetadata) => void;
32
+ type ClearScrollToIndex = () => void;
33
+ type OnZoneEnter = (e: React.MouseEvent<any>, zoneType: GraphZoneType, hoveredRefGroup?: GraphRefGroup, hoveredSha?: Sha) => void;
34
+ type OnGraphContainerBlurred = (event: React.FocusEvent<any>, hoveredRefGroup?: GraphRefGroup, hoveredSha?: Sha) => void;
35
+ interface OwnProps {
36
+ formatCommitDateTime?: OnFormatCommitDateTime;
37
+ getExternalIcon: GetExternalIcon;
38
+ platform?: GraphPlatform;
39
+ shaLength?: number | null;
40
+ nonce?: string;
87
41
  }
88
- export interface Head extends Ref {
89
- isCurrentHead?: boolean;
90
- upstream?: string;
42
+ export interface StateProps {
43
+ avatarUrlByEmail?: AvatarUrlByEmail;
44
+ cssVariables?: CssVariables;
45
+ contexts?: GraphContexts | null;
46
+ dimMergeCommits?: boolean;
47
+ downstreamsByUpstream?: DownstreamsByUpstream;
48
+ highlightRowsOnRefHover?: boolean;
49
+ isContainerWindowFocused?: boolean;
50
+ showGhostRefsOnRowHover?: boolean;
51
+ showRemoteNamesOnRefs?: boolean;
52
+ enabledRefMetadataTypes?: RefMetadataType[];
53
+ enabledScrollMarkerTypes?: GraphMarkerType[];
54
+ scrollRowPadding?: number;
55
+ enableMultiSelection?: boolean;
56
+ graphRows: GraphRow[];
57
+ hasMoreCommits?: boolean;
58
+ highlightedShas?: HighlightedShas;
59
+ excludeByType?: ExcludeByType;
60
+ excludeRefsById?: ExcludeRefsById;
61
+ includeOnlyRefsById?: IncludeOnlyRefsById;
62
+ isCommitting?: boolean;
63
+ isSelectedBySha?: IsSelectedBySha;
64
+ isInUnsupportedRebase?: boolean;
65
+ isLoadingRows?: boolean;
66
+ pendingCommitMessageSummary?: string;
67
+ refMetadataById?: RefMetadataById | null;
68
+ repoPath?: string;
69
+ columnsSettings?: GraphColumnsSettings;
70
+ themeOpacityFactor?: number;
71
+ translate?: TranslationFn;
72
+ useAuthorInitialsForAvatars: boolean;
73
+ workDirStats?: WorkDirStats;
91
74
  }
92
- export interface Remote extends Ref {
93
- owner?: string;
94
- avatarUrl?: string;
95
- url?: string;
96
- current?: boolean;
75
+ export interface DispatchProps {
76
+ onDoubleClickGraphRef?: OnDoubleClickGraphRef;
77
+ onGraphRowHovered?: OnGraphRowHovered;
78
+ onGraphRowUnhovered?: OnGraphRowUnhovered;
79
+ onRefContextMenu?: OnRefContextMenu;
80
+ onToggleRefsVisibilityClick?: OnToggleRefsVisibilityClick;
81
+ onRowContextMenu?: OnRowContextMenu;
82
+ onGraphRefNodeHovered?: OnGraphRefNodeHovered;
83
+ onGraphRefNodeUnhovered?: OnGraphRefNodeUnhovered;
84
+ onBlurWipNodeInput?: OnBlur;
85
+ onGraphColumnsReOrdered?: OnGraphColumnsReOrdered;
86
+ onColumnResized?: OnGraphColumnResized;
87
+ onFocusWipNodeInput?: OnFocus;
88
+ onMessageChange?: OnCommitMessageChange;
89
+ onClickGraphRef?: OnClickGraphRef;
90
+ onClickGraphRow?: OnClickGraphRow;
91
+ onDoubleClickGraphRow?: OnDoubleClickGraphRow;
92
+ onSelectGraphRows?: OnSelectGraphRows;
93
+ onScrollForZone?: OnGraphScrollForZone;
94
+ onScrollToRowCausedUpdateForRefZone?: OnGraphScrollForZone;
95
+ onShowMoreCommits?: OnShowMoreCommits;
96
+ onWipNodeInputWillUnmount?: OnComponentWillUnmount;
97
+ onGraphResized?: OnGraphResized;
98
+ onGraphVisibleRowsChanged?: OnGraphVisibleRowsChanged;
99
+ onGraphMouseEnter?: OnGraphMouseEnter;
100
+ onGraphMouseLeave?: OnGraphMouseLeave;
101
+ onEmailsMissingAvatarUrls?: OnEmailsMissingAvatarUrls;
102
+ onRefsMissingMetadata?: OnRefsMissingMetadata;
97
103
  }
98
- export interface Tag extends Ref {
99
- annotated?: boolean;
104
+ interface Props extends OwnProps, StateProps, DispatchProps {
100
105
  }
101
-
102
- export type GraphRow = {
103
- sha: Sha;
104
- parents: string[];
105
- author: string;
106
- email: string;
107
- date: number;
108
- message: string;
109
- type: CommitType;
110
- heads?: Head[];
111
- remotes?: Remote[];
112
- tags?: Tag[];
113
- contexts?: RowContexts;
114
- stats?: RowStats;
115
- };
116
-
117
- export type GraphColumnSetting = {
118
- width: number,
119
- isHidden: boolean,
120
- order?: number
106
+ export type GraphContainerProps = Props;
107
+ type ComponentState = {
108
+ avatarUrlByEmail: AvatarUrlByEmail;
109
+ columnColorByColumn: ColumnColorByColumn;
110
+ contexts?: GraphContexts | null;
111
+ cssVariablesWithDefaults: CssVariables;
112
+ currentlyHoveredCommitSha?: Sha;
113
+ dimMergeCommits: boolean;
114
+ dimRowsOfSelectedCommit: boolean;
115
+ highlightRowsOnRefHover: boolean;
116
+ showGhostRefsOnRowHover: boolean;
117
+ showRemoteNamesOnRefs: boolean;
118
+ enabledRefMetadataTypes: RefMetadataType[];
119
+ enabledScrollMarkerTypes: GraphMarkerType[];
120
+ graphZones: GraphZone[];
121
+ hasMoreCommits: boolean;
122
+ height: number;
123
+ highlightedShas?: HighlightedShas;
124
+ hoveredRefGroup?: GraphRefGroup;
125
+ hoveredRefZoneSha?: Sha;
126
+ isContainerWindowFocused: boolean;
127
+ isLoadingRows: boolean;
128
+ numGraphColumns: number;
129
+ processedRows: ProcessedGraphRow[];
130
+ refMetadataById?: RefMetadataById | null;
131
+ useAuthorInitialsForAvatars: boolean;
132
+ scrollLeft: number;
133
+ scrollToAlignment: Alignment;
134
+ scrollToIndex?: number;
135
+ scrollTop: number;
136
+ shaLength?: number | null;
137
+ themeOpacityFactor: number;
138
+ width: number;
139
+ workDirStats: WorkDirStats;
121
140
  };
122
-
123
- export type AvatarUrlByEmail = { [email: string]: string };
124
-
125
- export const REF_ZONE_TYPE = 'ref';
126
- export const GRAPH_ZONE_TYPE = 'graph';
127
- export const MESSAGE_ZONE_TYPE = 'message';
128
- export const AUTHOR_ZONE_TYPE = 'author';
129
- export const DATE_TIME_ZONE_TYPE = 'datetime';
130
- export const SHA_ZONE_TYPE = 'sha';
131
- export const CHANGES_ZONE_TYPE = 'changes';
132
-
133
- export type GraphZoneType = typeof REF_ZONE_TYPE
134
- | typeof GRAPH_ZONE_TYPE
135
- | typeof MESSAGE_ZONE_TYPE
136
- | typeof AUTHOR_ZONE_TYPE
137
- | typeof DATE_TIME_ZONE_TYPE
138
- | typeof SHA_ZONE_TYPE
139
- | typeof CHANGES_ZONE_TYPE;
140
-
141
- export type GraphColumnsSettings = { [graphZoneType: string]: GraphColumnSetting };
142
-
143
- export type GraphRefType = 'head'
144
- | 'remote'
145
- | 'tag';
146
-
147
- export interface GraphRef extends Head, Remote, Tag {
148
- refType: GraphRefType;
149
- }
150
-
151
- export type GraphRefOptData = {
152
- id: string;
153
- name: string;
154
- type: GraphRefType;
155
- owner?: string;
156
- avatarUrl?: string;
141
+ type ColumnsToFreeBySha = {
142
+ [sha: Sha]: number[];
157
143
  };
158
-
159
- export type GraphRefGroup = Array<GraphRef>;
160
-
161
- export type RefMetadataById = { [id: string]: RefMetadata | null | undefined } | null;
162
- export type RefMetadata = {
163
- pullRequest?: PullRequestMetadata[] | null;
164
- upstream?: UpstreamMetadata | null;
144
+ type ColumnsUsed = {
145
+ [column: number]: boolean;
165
146
  };
166
-
167
- export interface BaseMetadata {
168
- context?: GraphItemContext;
169
- }
170
-
171
- export interface PullRequestMetadata extends BaseMetadata {
172
- hostingServiceType: HostingServiceType;
173
- id: number;
174
- title: string;
175
- author?: string;
176
- date?: number;
177
- state?: string;
178
- url?: string;
179
- }
180
-
181
- export interface UpstreamMetadata extends BaseMetadata {
182
- name: string;
183
- owner: string;
184
- ahead: number;
185
- behind: number;
186
- sha?: Sha;
187
- }
188
-
189
- // Hosting service types for pull request metadata
190
- export const gitHubDotComHostingServiceType = 'github';
191
- export const githubEnterpriseHostingServiceType = 'githubEnterprise';
192
- export const gitLabHostingServiceType = 'gitlab';
193
- export const gitLabSelfHostingServiceType = 'gitlabSelfHosted';
194
- export const azureDevopsHostingServiceType = 'azureDevops';
195
- export const bitBucketHostingServiceType = 'bitbucket';
196
- export const bitBucketServerHostingServiceType = 'bitbucketServer';
197
- export type HostingServiceType =
198
- typeof gitHubDotComHostingServiceType |
199
- typeof githubEnterpriseHostingServiceType |
200
- typeof bitBucketHostingServiceType |
201
- typeof bitBucketServerHostingServiceType |
202
- typeof gitLabHostingServiceType |
203
- typeof gitLabSelfHostingServiceType |
204
- typeof azureDevopsHostingServiceType;
205
-
206
- export type RefsMissingMetadata = {
207
- [refId: string]: RefMetadataType[]
208
- }
209
- export type RefMetadataType = keyof RefMetadata;
210
- export const pullRequestMetadataType = 'pullRequest';
211
- export const upstreamMetadataType = 'upstream';
212
- // Expand this as we add more types to RefMetadata
213
- export type RefMetadataItem =
214
- | {
215
- refId: string;
216
- type: typeof pullRequestMetadataType;
217
- data: PullRequestMetadata;
218
- }
219
- | {
220
- refId: string;
221
- type: typeof upstreamMetadataType;
222
- data: UpstreamMetadata;
223
- };
224
-
225
- export type GraphMarkerType =
226
- | 'head'
227
- | 'upstream'
228
- | 'localBranches'
229
- | 'remoteBranches'
230
- | 'stashes'
231
- | 'tags'
232
- | 'highlights'
233
- | 'selection';
234
-
235
- export type CommitDateTimeSource = CommitDateTimeSources;
236
-
237
- // Callbacks
238
- export type GetExternalIcon = (key: string) => React.ReactElement<any>;
239
- export type TranslationFn = (key: string, ...formatArgs: any) => string;
240
- export type OnFormatCommitDateTime = (commitDateTime: number, source?: CommitDateTimeSource) => string;
241
-
242
- // Events
243
- export type OnRowContextMenu = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
244
- export type OnRefContextMenu = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
245
- export type OnToggleRefsVisibilityClick = (event: React.MouseEvent, refs: GraphRefOptData[], visible: boolean, graphRow?: GraphRow) => void;
246
- export type OnClickGraphRow = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
247
- export type OnClickGraphRef = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow, metadataItem?: RefMetadataItem) => void;
248
- export type OnDoubleClickGraphRow = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
249
- export type OnDoubleClickGraphRef = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow, metadataItem?: RefMetadataItem) => void;
250
- export type OnSelectGraphRows = (selectedRows: GraphRow[]) => void;
251
- export type OnGraphRowHovered = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
252
- export type OnGraphRowUnhovered = (event: any, graphZoneType: GraphZoneType, graphRow: GraphRow) => void;
253
- export type OnGraphRefNodeHovered = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
254
- export type OnGraphRefNodeUnhovered = (event: any, refGroup: GraphRefGroup, graphRow: GraphRow) => void;
255
- export type OnGraphColumnsReOrdered = (columnsSettings: GraphColumnsSettings) => void;
256
- export type OnGraphColumnResized = (graphZoneType: GraphZoneType, columnSettings: GraphColumnSetting) => void;
257
- export type OnGraphResized = (width: number, height: number) => void;
258
- export type OnGraphVisibleRowsChanged = (topVisibleRow: GraphRow, bottomVisibleRow: GraphRow) => void;
259
- export type OnGraphMouseEnter = (event: any) => void;
260
- export type OnGraphMouseLeave = (event: any) => void;
261
- export type OnShowMoreCommits = () => void;
262
- export type OnEmailsMissingAvatarUrls = (emails: AvatarUrlByEmail) => void;
263
- export type OnRefsMissingMetadata = (refs: RefsMissingMetadata) => void;
264
-
265
- // Main graph component
266
- export interface GraphContainerProps {
267
- avatarUrlByEmail?: AvatarUrlByEmail;
268
- contexts?: GraphContexts;
269
- platform?: GraphPlatform;
270
- cssVariables?: CssVariables;
271
- dimMergeCommits?: boolean;
272
- getExternalIcon: GetExternalIcon;
273
- highlightRowsOnRefHover?: boolean;
274
- isContainerWindowFocused?: boolean;
275
- showGhostRefsOnRowHover?: boolean;
276
- showRemoteNamesOnRefs?: boolean;
277
- enabledRefMetadataTypes?: RefMetadataType[];
278
- enabledScrollMarkerTypes?: GraphMarkerType[];
279
- scrollRowPadding?: number;
280
- enableMultiSelection?: boolean;
281
- graphRows: GraphRow[];
282
- hasMoreCommits?: boolean;
283
- highlightedShas?: HighlightedShas;
284
- excludeByType?: ExcludeByType;
285
- excludeRefsById?: ExcludeRefsById;
286
- includeOnlyRefsById?: IncludeOnlyRefsById;
287
- isSelectedBySha?: IsSelectedBySha;
288
- isLoadingRows?: boolean;
289
- columnsSettings?: GraphColumnsSettings;
290
- refMetadataById?: RefMetadataById;
291
- themeOpacityFactor?: number;
292
- translate?: TranslationFn;
293
- useAuthorInitialsForAvatars?: boolean;
294
- workDirStats?: WorkDirStats;
295
- onRowContextMenu?: OnRowContextMenu;
296
- onRefContextMenu?: OnRefContextMenu;
297
- onToggleRefsVisibilityClick?: OnToggleRefsVisibilityClick;
298
- onGraphRowHovered?: OnGraphRowHovered;
299
- onGraphRowUnhovered?: OnGraphRowUnhovered;
300
- onGraphRefNodeHovered?: OnGraphRefNodeHovered;
301
- onGraphRefNodeUnhovered?: OnGraphRefNodeUnhovered;
302
- onGraphColumnsReOrdered?: OnGraphColumnsReOrdered;
303
- onColumnResized?: OnGraphColumnResized;
304
- onClickGraphRef?: OnClickGraphRef;
305
- onClickGraphRow?: OnClickGraphRow;
306
- onDoubleClickGraphRow?: OnDoubleClickGraphRow;
307
- onDoubleClickGraphRef?: OnDoubleClickGraphRef;
308
- onSelectGraphRows?: OnSelectGraphRows;
309
- onShowMoreCommits?: OnShowMoreCommits;
310
- onGraphResized?: OnGraphResized;
311
- onGraphVisibleRowsChanged?: OnGraphVisibleRowsChanged;
312
- onGraphMouseEnter?: OnGraphMouseEnter;
313
- onGraphMouseLeave?: OnGraphMouseLeave;
314
- onEmailsMissingAvatarUrls?: OnEmailsMissingAvatarUrls;
315
- onRefsMissingMetadata?: OnRefsMissingMetadata;
316
- formatCommitDateTime?: OnFormatCommitDateTime;
317
- shaLength?: number | null;
318
- nonce?: string;
319
- }
320
-
321
- declare class GraphContainer extends React.PureComponent<GraphContainerProps, any> {
322
- context: unknown;
323
- props: Readonly<GraphContainerProps>;
324
- state: Readonly<any>;
325
- refs: {
326
- [key: string]: React.ReactInstance
327
- };
328
- setState(
329
- state: ((prevState: Readonly<any>, props: Readonly<GraphContainerProps>) =>
330
- (Pick<any, any> | any | null)) | (Pick<any, any> | any | null),
331
- callback?: () => void
332
- ): void;
333
- forceUpdate(callback?: () => void): void;
334
- render(): JSX.Element;
335
- selectCommits(shas: Sha[], includeToPrevSel: boolean, isAutoOrKeyScroll: boolean): void;
147
+ declare class GraphContainer extends React.PureComponent<Props, ComponentState> {
148
+ graphContainerRef: any;
149
+ resizeObserver: ResizeObserver;
150
+ isSelectedBySha: IsSelectedBySha;
151
+ processedGraphRowBySha: ProcessedGraphRowBySha;
152
+ childrenBySha: ChildrenBySha;
153
+ scrollToSha?: Sha;
154
+ lastLazyLoadHeight: number;
155
+ lastTopVisibleRowIndex: number;
156
+ lastBottomVisibleRowIndex: number;
157
+ maxColumns: number;
158
+ orderedGraphRows: ProcessedGraphRow[];
159
+ rowStatsConstraints: RowStatsConstraints;
160
+ shouldFireShowMoreCommits: boolean;
161
+ columnsToFreeWhenFound: ColumnsToFreeBySha;
162
+ reserverInfoBySha: ReserverInfoBySha;
163
+ columnsUsed: ColumnsUsed;
164
+ workDirStats: WorkDirStats;
165
+ excludeByType: ExcludeByType;
166
+ excludeRefsById: ExcludeRefsById;
167
+ includeOnlyRefsById: IncludeOnlyRefsById;
168
+ excludeRemotesByName: ExcludeRemotesByName;
169
+ includeOnlyRemotesByName: IncludeOnlyRemotesByName;
170
+ scrollLeft: number;
171
+ scrollTop: number;
172
+ graphHeight: number;
173
+ graphWidth: number;
174
+ graphZonesByType: GraphZonesByType;
175
+ graphZoneOrdering: GraphZoneType[];
176
+ missingAvatarsTimer?: NodeJS.Timeout;
177
+ pendingMissingAvatars: AvatarUrlByEmail;
178
+ requestedMissingAvatars: AvatarUrlRequestedByEmail;
179
+ missingRefsMetadataTimer?: NodeJS.Timeout;
180
+ pendingMissingRefsMetadata: RefsMissingMetadata;
181
+ requestedMissingRefsMetadata: RefMetadataRequestedById;
182
+ markerRowIndices: GraphMarkerRowIndices;
183
+ branchUpstreamRowIndices: number[];
184
+ downstreamsByUpstream: DownstreamsByUpstream;
185
+ timelinesInterval?: NodeJS.Timeout;
186
+ constructor(props: Props);
187
+ componentDidMount(): void;
188
+ componentWillReceiveProps(nextProps: Props): void;
189
+ componentWillUnmount(): void;
190
+ onGraphVisibleRowsUpdatedThrottled: ThrottledFn;
191
+ onBlurWipNodeInput: OnBlur;
192
+ onDoubleClickRef: OnDoubleClickRef;
193
+ onFocusWipNodeInput: OnFocus;
194
+ onCurrentlyHoveredGraphCommit: OnCurrentlyHoveredGraphCommit;
195
+ onClearCurrentlyHoveredGraphCommit: OnClearCurrentlyHoveredGraphCommit;
196
+ onGraphColumnReOrdered: OnGraphColumnReOrdered;
197
+ onGraphZoneResize: OnGraphZoneResize;
198
+ onGraphZoneResizeEnd: OnGraphZoneResizeEnd;
199
+ onPopupGraphHeaderContextMenu: OnPopupGraphHeaderContextMenu;
200
+ onMessageChange: OnCommitMessageChange;
201
+ onClickRef: OnClickRef;
202
+ onClickCommit: OnClickCommit;
203
+ onDoubleClickCommit: OnDoubleClickCommit;
204
+ onWindowKeyUp: OnKeyUp;
205
+ onWindowBlur: OnBlur;
206
+ onWindowKeyDown: OnKeyDown;
207
+ onKeyDown: OnKeyDown;
208
+ onRefNodeHovered: OnRefNodeHovered;
209
+ onRefNodeUnhovered: OnRefNodeUnhovered;
210
+ onRefZoneHovered: OnRefZoneHovered;
211
+ onRefZoneUnhovered: OnRefZoneUnhovered;
212
+ onShowMoreCommits: OnShowMoreCommits;
213
+ onScrollForZone: OnScrollForZone;
214
+ onScrollToRowCausedUpdateForRefZone: OnScrollForZone;
215
+ onCommitContextMenu: OnCommitContextMenu;
216
+ onRefContextMenu: OnRefZoneContextMenu;
217
+ onWipNodeInputWillUnmount: OnComponentWillUnmount;
218
+ selectCommits(shas: Sha[], includeToPrevSel: boolean, isAutoOrKeyScroll: boolean): void;
219
+ getCommitZoneContentWidthBetweenGutters(): number;
220
+ getSelectedShas(): Sha[];
221
+ getExcludeRemotesByName(): ExcludeRemotesByName;
222
+ getIncludeOnlyRemotesByName(): IncludeOnlyRemotesByName;
223
+ clearScrollToIndex: ClearScrollToIndex;
224
+ getTopAndBottomVisibleRowIndex(): TopAndBottomVisibleRowIndex;
225
+ getOffsetSha(sha: Sha): Sha;
226
+ selectSha(sha: Sha, isAutoOrKeyScroll?: boolean): void;
227
+ updateWidthByZone(widthToAssignForZone: number, graphZoneType: GraphZoneType, updatePreferredWidth?: boolean): void;
228
+ updateCommitZoneContentWidthFromGraphRowsChange(): void;
229
+ getCurrentWidthByZone(graphZoneType: GraphZoneType): number;
230
+ getCommitZoneContentWidth(): number;
231
+ getCommitZoneWidth(): number;
232
+ getSingleColumnModeFactor(): number;
233
+ setScroll(graphZoneType: GraphZoneType, scroll: ScrollParams): void;
234
+ getNonAdjustedScrollLeft(): number;
235
+ setScrollLeft(scrollLeft: number): void;
236
+ getScrollLeft(): number;
237
+ setScrollTop(scrollTop: number): void;
238
+ getScrollTop(): number;
239
+ getScrollToSha(): Sha | undefined;
240
+ setScrollToSha(scrollToSha: Sha, scrollLeft: number): void;
241
+ getScrollToIndex(): number;
242
+ getScrollToAlignment(): Alignment;
243
+ getMinNodeOffset(): number;
244
+ getMaxNodeOffset(): number;
245
+ getAbsoluteNodeLeftByColumn(): AbsoluteNodeLeftByColumn;
246
+ getNodeOffsetByColumn(): NodeOffsetByColumn;
247
+ getMaxNodeLeft(): number;
248
+ getMinNodeLeft(): number;
249
+ getRightGutterSlideOutFactor(): number;
250
+ getNodeOpacityByColumn(): NodeOpacityByColumn;
251
+ getLeftGutterWidth(): number;
252
+ getRightGutterWidth(): number;
253
+ getBoxShadowAlphaForGutter(singleColumnModeFactor: number, gutterFactor: number): number;
254
+ getLeftGutterBoxShadowAlpha(themeOpacityFactor: number): number;
255
+ getRightGutterBoxShadowAlpha(themeOpacityFactor: number): number;
256
+ updateMarkerRowIndices(types: GraphMarkerType[]): void;
257
+ getMarkerColors(): GraphMarkerColors;
258
+ initializeGraphZones(zoneSettings: GraphColumnsSettings | undefined, zoneOrdering: GraphZoneType[], width: number): GraphZone[];
259
+ updateZonesFromSettings(zoneSettings?: GraphColumnsSettings): void;
260
+ getEdgeColumnMaxes(sha: Sha): number;
261
+ getEndingAndPassThroughEdgesByColumnFromPrevRow(graphRow: ProcessedGraphRow, prevRowEdges: RowEdges): RowEdges;
262
+ getFinalEdgeStateForGraphAndRow(graphRow: ProcessedGraphRow, prevRowEdges: RowEdges): RowEdges;
263
+ loadEdgesBySha(): void;
264
+ processRows(graphRows?: GraphRow[]): void;
265
+ getStartingEdgesByColumn(currentRow: ProcessedGraphRow): EdgeByColumn;
266
+ formatCommitDateTimeCallback: OnFormatCommitDateTime;
267
+ translateCallback: TranslationFn;
268
+ getIconCallback: GetExternalIcon;
269
+ onMissingAvatar: GetMissingAvatar;
270
+ onMissingRefMetadata: GetMissingRefMetadata;
271
+ selectNext(topological?: boolean): void;
272
+ selectPrevious(topological?: boolean): void;
273
+ getAvailableColumnAndUseIt(): number;
274
+ getColumns(graphRow: GraphRow): number;
275
+ getFilteredHeadsForGraphRow(row: GraphRow, hasIncludes: boolean): Head[];
276
+ getFilteredRemotesForGraphRow(row: GraphRow, hasIncludes: boolean): Remote[];
277
+ getFilteredTagsForGraphRow(row: GraphRow, hasIncludes: boolean, rowHasVisibleChild: boolean): Tag[];
278
+ loadRowsbySha(graphRows: GraphRow[]): void;
279
+ updateRowStatsConstraints(): void;
280
+ updateTimelines(): void;
281
+ clearTimelines(): void;
282
+ cleanupSelections(): void;
283
+ getColumnColorByColumn(cssVariables: CssVariables): ColumnColorByColumn;
284
+ getNumGraphColumns(cssVariables: CssVariables): number;
285
+ ensureZoneWidthsMatchGraphWidth(orderedActiveGraphZones: GraphZone[], width: number): void;
286
+ shrinkZoneWidthsToFitWidth(orderedActiveGraphZones: GraphZone[], width: number, stoppingIndex?: number): void;
287
+ getOrderedActiveGraphZones(): GraphZone[];
288
+ expandZoneWidthsToFitWidth(orderedActiveGraphZones: GraphZone[], width: number, startingIndex?: number): void;
289
+ onGraphHeaderRowMouseDown: OnMouseDown;
290
+ onToggleRefNodesShown: OnToggleRefNodesShown;
291
+ cleanEdgeCaches(): void;
292
+ onZoneEnter: OnZoneEnter;
293
+ adjustResizedGraphZone(graphZones: GraphZone[], graphZone: GraphZone, dimensions: OnResizeParams, updatePreferredWidth: boolean): void;
294
+ dimRowsOfSelectedCommit(dimRows: boolean): void;
295
+ onGraphContainerBlurred: OnGraphContainerBlurred;
296
+ onGraphContainerMouseEnter: OnGraphMouseEnter;
297
+ onGraphContainerMouseLeave: OnGraphMouseLeave;
298
+ onGraphResized: OnGraphResized;
299
+ onGraphVisibleRowsUpdated(): void;
300
+ getCurrentPlatform(): string;
301
+ isMacOSPlatform(): boolean;
302
+ getGraphColumnSettingFromZoneType(graphZone: GraphZone): GraphColumnSetting;
303
+ decorateWithHelmet: (container: ReactElement<'div'>, cssVariables: CssVariables, nonce?: string) => ReactElement<'div'>;
304
+ render(): ReactElement<'div'>;
336
305
  }
337
-
338
306
  export default GraphContainer;