@gitkraken/gitkraken-components 13.0.0-vnext.27 → 13.0.0-vnext.29

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 (31) hide show
  1. package/README.md +4 -0
  2. package/dist/components/graph/GraphContainer.d.ts +69 -11
  3. package/dist/components/graph/commitzone/CommitZone.d.ts +2 -1
  4. package/dist/components/graph/commitzone/edges/Arc.d.ts +2 -2
  5. package/dist/components/graph/commitzone/edges/EndingEdge.d.ts +2 -2
  6. package/dist/components/graph/commitzone/edges/PassThroughEdge.d.ts +2 -2
  7. package/dist/components/graph/commitzone/edges/StartingEdge.d.ts +2 -2
  8. package/dist/components/graph/common/GenericGraphZone.d.ts +3 -1
  9. package/dist/components/graph/refzone/RefNode.d.ts +9 -6
  10. package/dist/components/graph/refzone/RefNodeAnnotationTarget.d.ts +10 -0
  11. package/dist/components/graph/refzone/RefNodes.d.ts +3 -2
  12. package/dist/components/graph/refzone/RefZone.d.ts +5 -3
  13. package/dist/components/graph/rowRenderers/CommitMessageZoneRow.d.ts +2 -1
  14. package/dist/components/graph/rowRenderers/CommitZoneRow.d.ts +2 -0
  15. package/dist/components/graph/rowRenderers/RefZoneRow.d.ts +1 -0
  16. package/dist/domain/commit/CommitHelpers.d.ts +2 -2
  17. package/dist/domain/commit/CommitTypes.d.ts +1 -0
  18. package/dist/domain/edge/EdgeHelpers.d.ts +4 -4
  19. package/dist/domain/graph/GraphConstants.d.ts +3 -1
  20. package/dist/domain/graph/GraphEdgeHelpers.d.ts +34 -0
  21. package/dist/domain/graph/GraphHelpers.d.ts +7 -1
  22. package/dist/domain/graph/GraphTypes.d.ts +56 -4
  23. package/dist/domain/graph/PinnedBranchHelpers.d.ts +21 -0
  24. package/dist/domain/graph/ScopedGraphHelpers.d.ts +15 -0
  25. package/dist/domain/graph/row/ProcessedGraphRowObj.d.ts +2 -1
  26. package/dist/domain/graph/rowAdornment/RowAdornmentHelpers.d.ts +14 -0
  27. package/dist/domain/workdir/WorkDirHelpers.d.ts +50 -0
  28. package/dist/domain/workdir/WorkDirTypes.d.ts +51 -0
  29. package/dist/index.js +11 -11
  30. package/dist/styles.css +1 -1
  31. package/package.json +27 -27
@@ -1,7 +1,7 @@
1
1
  import type { GridCellRenderer, ScrollParams } from 'react-virtualized';
2
2
  import type { ReactElement, ReactNode } from 'react';
3
3
  import type { CommitDateTimeSources } from '../commit/CommitConstants';
4
- import type { CommitType, Sha } from '../commit/CommitTypes';
4
+ import type { CommitType, EdgeCommitType, Sha } from '../commit/CommitTypes';
5
5
  import type { CssVariables } from '../generic/GenericTypes';
6
6
  import type { HostingServiceType, IssueTrackerType } from '../hostingservice/HostingServiceTypes';
7
7
  import type { TranslationFn } from '../language/LanguageTypes';
@@ -38,6 +38,7 @@ export type EdgeCache = {
38
38
  export type ArcEndpointAngle = 0 | 90 | 180 | 270;
39
39
  export interface SvgStyles {
40
40
  fill: string;
41
+ filter?: string;
41
42
  shapeRendering: string;
42
43
  strokeLinejoin: string;
43
44
  strokeWidth: number;
@@ -57,7 +58,7 @@ export type SvgProps = ArcSvgProps | LineSvgProps;
57
58
  export type AnySvgProps = ArcSvgProps & LineSvgProps;
58
59
  export type Edge = {
59
60
  parentSha: Sha;
60
- type: CommitType;
61
+ type: EdgeCommitType;
61
62
  };
62
63
  export type EdgeByColumn = {
63
64
  [column: number]: Edge;
@@ -136,6 +137,45 @@ export type IsSelectedBySha = {
136
137
  export type HighlightedShas = {
137
138
  [sha: Sha]: boolean;
138
139
  };
140
+ export type SyntheticParentsBySha = Map<Sha, Sha[]>;
141
+ export interface GraphScope {
142
+ /** Full ref id of the specific branch to scope to (e.g. 'refs/heads/feature/x'). NOT necessarily HEAD. */
143
+ branchRef: string;
144
+ /** Full ref id of the branch's upstream (e.g. 'refs/remotes/origin/feature/x'). */
145
+ upstreamRef?: string;
146
+ /** SHA of the merge-target tip commit. Its ancestors are NOT walked — the tip is kept as a marker. */
147
+ mergeTargetTipSha?: Sha;
148
+ /**
149
+ * Additional ref ids to include in the scope. Each tip becomes an anchor (same treatment as
150
+ * branchRef — shows all refs, acts as visibility floor) and its ancestors contribute to
151
+ * visibleShas subject to the mergeTarget exclusion.
152
+ *
153
+ * Primary use case: branches stacked on top of the focal branch (e.g. F2, F3 stacked on F1).
154
+ * The helper makes no stackedness check — any refs are valid (siblings, comparisons, etc.).
155
+ */
156
+ additionalBranchRefs?: string[];
157
+ /** How to render gaps when an anchor's real parents are hidden. Defaults to 'syntheticEdge'. */
158
+ collapseStyle?: 'syntheticEdge' | 'gap';
159
+ }
160
+ export interface ScopeVisibility {
161
+ visibleShas: Set<Sha>;
162
+ anchorShas: Set<Sha>;
163
+ /** Fork points (merge bases) where an anchor's ancestor walk terminated. Visual boundary "below" the focus group. */
164
+ forkPointShas: Set<Sha>;
165
+ /** The merge-target tip sha, when scope.mergeTargetTipSha was provided. Visual boundary "above" the focus group. */
166
+ mergeTargetShas: Set<Sha>;
167
+ syntheticParentsBySha: SyntheticParentsBySha;
168
+ /** Anchors whose synthetic walk failed — merge base not in loaded rows. Consumer should fetch more data. */
169
+ unreachableAnchors: Set<Sha>;
170
+ /**
171
+ * True when scope walks terminated at identified boundaries — at least one fork point was
172
+ * found AND no anchor was left unreachable. When false, the scope may be incomplete due to
173
+ * missing data (merge base not loaded, foreign ref not yet surfaced, partial history). Callers
174
+ * should NOT suppress commit autoloading while this is false — more data could establish the
175
+ * missing boundary.
176
+ */
177
+ isBounded: boolean;
178
+ }
139
179
  export type IsExcludedBySha = {
140
180
  [id: Sha]: boolean;
141
181
  };
@@ -145,6 +185,9 @@ export type HasSpecialChildBySha = {
145
185
  export type ReserverInfoBySha = {
146
186
  [id: Sha]: ReserverInfo;
147
187
  };
188
+ export type ColumnNumberBySha = {
189
+ [sha: Sha]: number;
190
+ };
148
191
  export type RefTargetFunc = () => Element | null | undefined;
149
192
  export type ColumnContentGenerator = () => ReactElement<any>;
150
193
  export type GraphItemContext = string | object;
@@ -322,6 +365,8 @@ export interface ReadonlyGraphRow extends ReadonlyDeep<GraphRow> {
322
365
  /** Whether the row is hidden from the graph (filtered out by type or other filters). Output only */
323
366
  readonly hidden: boolean;
324
367
  }
368
+ /** Which scope-boundary role this row plays, when an active scope identifies it as one. */
369
+ export type ScopeBoundaryKind = 'forkPoint' | 'mergeTarget';
325
370
  export interface ProcessedGraphRow extends GraphRow {
326
371
  rowIndex?: number;
327
372
  column: number;
@@ -338,6 +383,7 @@ export interface ProcessedGraphRow extends GraphRow {
338
383
  timeLineEntry?: TimelineEntry;
339
384
  childRefs?: ChildRefsByType;
340
385
  refsData?: GraphRefsData;
386
+ scopeBoundaryKind?: ScopeBoundaryKind;
341
387
  }
342
388
  export type TopAndBottomVisibleRowIndex = {
343
389
  top: number;
@@ -406,7 +452,7 @@ export type DownstreamsByUpstream = {
406
452
  [upstreamName: string]: string[];
407
453
  };
408
454
  export type GraphPlatform = 'aix' | 'android' | 'darwin' | 'freebsd' | 'linux' | 'openbsd' | 'sunos' | 'win32' | 'cygwin';
409
- export type ExternalIconKeys = 'added' | 'author' | 'branch' | 'changes' | 'check' | 'commit' | 'datetime' | 'deleted' | 'files' | 'filter' | 'graph' | 'head' | 'hide' | `issue-${IssueTrackerType}` | 'loading' | 'message' | 'modified' | 'pull-request' | 'remote' | `remote-${HostingServiceType}` | 'renamed' | 'resolved' | 'settings' | 'show' | 'stash' | 'tag' | 'upstream-ahead' | 'upstream-behind' | 'warning' | 'worktree';
455
+ export type ExternalIconKeys = 'added' | 'author' | 'branch' | 'changes' | 'check' | 'commit' | 'datetime' | 'deleted' | 'files' | 'filter' | 'graph' | 'head' | 'hide' | `issue-${IssueTrackerType}` | 'loading' | 'message' | 'modified' | 'pin' | 'pull-request' | 'remote' | `remote-${HostingServiceType}` | 'renamed' | 'resolved' | 'settings' | 'show' | 'stash' | 'tag' | 'upstream-ahead' | 'upstream-behind' | 'warning' | 'worktree';
410
456
  export type GetExternalIcon = (key: ExternalIconKeys) => ReactElement<any>;
411
457
  export type GetMissingAvatar = (email: string, sha: string) => void;
412
458
  export type GetMissingRefMetadata = (id: string, types: RefMetadataType[]) => void;
@@ -479,7 +525,7 @@ export type OnToggleRefsVisibilityClick = (event: React.MouseEvent<any>, refs: G
479
525
  export interface GraphSelectionState {
480
526
  /** Whether the selected rows form a topologically contiguous selection (connected via parent-child relationships) */
481
527
  isContiguous: boolean;
482
- /** Whether the selection was made topologically (via shift+click following graph topology) */
528
+ /** Whether the selection was made topologically (via ctrl/shift+click following graph topology) */
483
529
  isTopological: boolean;
484
530
  }
485
531
  export type OnSelectGraphRows = (rows: ReadonlyGraphRow[], focusedRow: ReadonlyGraphRow | undefined, state: GraphSelectionState) => void;
@@ -493,4 +539,10 @@ export type OnGraphColumnResized = (graphZoneType: GraphZoneType, columnSettings
493
539
  export type OnShowMoreCommits = () => void;
494
540
  export type OnEmailsMissingAvatarUrls = (emails: AvatarUrlByEmail) => void;
495
541
  export type OnRefsMissingMetadata = (refs: RefsMissingMetadata) => void;
542
+ /**
543
+ * Callback invoked when column numbers are calculated for each commit.
544
+ * Receives a map of SHA → column number.
545
+ * Used to sync column layout data back to the parent application.
546
+ */
547
+ export type OnColumnsCalculated = (columnsBySha: ColumnNumberBySha) => void;
496
548
  export {};
@@ -0,0 +1,21 @@
1
+ import type { Sha } from '../commit/CommitTypes';
2
+ import type { GraphRow } from './GraphTypes';
3
+ /**
4
+ * Identifies commits that belong to the pinned branch by following the first-parent chain.
5
+ * Returns a Set of SHAs that are part of the pinned branch.
6
+ */
7
+ export declare function identifyPinnedBranchCommits(graphRows: GraphRow[], pinnedBranchFullName?: string | null): Set<Sha>;
8
+ /**
9
+ * Gets the next available column number, marking it as used.
10
+ * When reserveColumn0ForPinned is true, starts searching from column 1.
11
+ */
12
+ export declare function getAvailableColumnAndUseIt(columnsUsed: {
13
+ [column: number]: boolean;
14
+ }, reserveColumn0ForPinned?: boolean): number;
15
+ /**
16
+ * Determines the column number for a parent commit based on pinning status and parent index.
17
+ * For pinned parents, always reserve column 0; for non-pinned, use normal logic.
18
+ */
19
+ export declare function getParentColumn(columnsUsed: {
20
+ [column: number]: boolean;
21
+ }, isParentPinned: boolean, parentIndex: number, currentColumn: number, hasPinnedBranch: boolean): number;
@@ -0,0 +1,15 @@
1
+ import type { GraphRow, GraphScope, ScopeVisibility } from './GraphTypes';
2
+ export declare function computeScopeVisibility(rows: GraphRow[], scope: GraphScope): ScopeVisibility;
3
+ /**
4
+ * Returns true when a WIP row should be hidden under an active scope.
5
+ *
6
+ * Secondary (per-worktree) WIP rows are kept only when their parent is a branch anchor of the
7
+ * scope — i.e. the tip of `branchRef`, `upstreamRef`, or one of `additionalBranchRefs` (so a
8
+ * worktree checked out on a scoped branch still surfaces its WIP, even when empty). The merge
9
+ * target tip is excluded: it's a boundary, not a focused branch.
10
+ *
11
+ * The primary WIP row, merge-conflict node, and unsupported-rebase warning node are tied to
12
+ * the primary repo's HEAD. They are kept whenever at least one of their parents is in the
13
+ * scope's visible set; otherwise they would render as floating nodes with no anchoring topology.
14
+ */
15
+ export declare function shouldHideWipRowForScope(row: GraphRow, scopeVisibility: ScopeVisibility | null): boolean;
@@ -2,7 +2,7 @@ import type { ReactNode } from 'react';
2
2
  import type { IGraphContainer } from '../../../components/graph/IGraphContainer';
3
3
  import type { CommitType, Sha } from '../../commit/CommitTypes';
4
4
  import type { TimelineEntry } from '../GraphConstants';
5
- import type { ChildRefsByType, GraphRefsData, GraphRow, Head, ProcessedGraphRow, Remote, RowContexts, RowEdges, Tag } from '../GraphTypes';
5
+ import type { ChildRefsByType, GraphRefsData, GraphRow, Head, ProcessedGraphRow, Remote, RowContexts, RowEdges, ScopeBoundaryKind, Tag } from '../GraphTypes';
6
6
  export declare class ProcessedGraphRowObj implements ProcessedGraphRow {
7
7
  private _graph;
8
8
  private _message;
@@ -27,6 +27,7 @@ export declare class ProcessedGraphRowObj implements ProcessedGraphRow {
27
27
  edges: RowEdges;
28
28
  childRefs: ChildRefsByType;
29
29
  timeLineEntry?: TimelineEntry;
30
+ scopeBoundaryKind?: ScopeBoundaryKind;
30
31
  summary: string;
31
32
  body?: string;
32
33
  displaySummary: string | ReactNode;
@@ -0,0 +1,14 @@
1
+ import type { Sha } from '../../commit/CommitTypes';
2
+ /**
3
+ * Builds the CSS `<dashed-ident>` used to tie a graph row's `anchor-name`
4
+ * to the overlay's `position-anchor`. Shas are arbitrary caller-provided
5
+ * strings (e.g. `worktree-wip::/some/path` for multi-WIP rows) and may
6
+ * contain characters that aren't valid inside a CSS <custom-ident>, so
7
+ * each unsafe character is prefixed with `\` — a single-character CSS
8
+ * escape that preserves readability in DevTools while keeping the
9
+ * identifier parseable by the browser.
10
+ *
11
+ * Letters, digits, hyphen, underscore, and non-ASCII code points are
12
+ * already legal inside a CSS ident and pass through unchanged.
13
+ */
14
+ export declare function getRowAnchorName(sha: Sha): string;
@@ -0,0 +1,50 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { Sha } from '../commit/CommitTypes';
3
+ import type { VisibleWipShas, WipNodeMetadataBySha, WipShasMissingStats, WorkDirStats } from './WorkDirTypes';
4
+ /** Translation key for the WIP row's label, selected based on stats state. */
5
+ export type WipRowMessageKey = 'Graph-WorkInProgress' | 'Graph-WorkInProgress-Changes' | 'Graph-WorkInProgress-Clean';
6
+ /**
7
+ * Picks the translation key for a WIP row's label based on the stats it has (or doesn't have):
8
+ * - `Graph-WorkInProgress-Changes` when stats show any added/modified/deleted activity
9
+ * - `Graph-WorkInProgress-Clean` when stats are present but all zero (queried, clean)
10
+ * - `Graph-WorkInProgress` when stats are not yet known (neutral fallback)
11
+ */
12
+ export declare function getWipRowMessageKey(workDirStats: WorkDirStats | undefined): WipRowMessageKey;
13
+ export type ResolvedWipState = {
14
+ isPrimaryWip: boolean;
15
+ effectiveWorkDirStats: WorkDirStats | undefined;
16
+ hasWorkDirChanges: boolean;
17
+ isWipEditable: boolean;
18
+ customWipContent: ReactElement<any> | null;
19
+ needsWipStatsRequest: boolean;
20
+ };
21
+ /**
22
+ * Resolves the effective WIP state for a given row.
23
+ *
24
+ * For the primary WIP row (sha === workDirType), uses the global workDirStats.
25
+ * For secondary WIP rows, uses the per-row metadata from wipNodeMetadataBySha. There is
26
+ * NO fallback to the global workDirStats — secondary rows belong to other worktrees, and
27
+ * painting the primary repo's counts on them would be wrong. Until per-row stats arrive,
28
+ * the pill renders nothing and `needsWipStatsRequest` triggers a deferred fetch.
29
+ */
30
+ export declare function resolveWipState(sha: Sha, type: string, workDirStats: WorkDirStats | undefined, wipNodeMetadataBySha: WipNodeMetadataBySha | undefined, wipMessageEditable: boolean): ResolvedWipState;
31
+ /** Predicate for secondary-WIP rows (per-worktree WIPs), excluding the primary WIP row. */
32
+ export declare function isSecondaryWipRow(row: {
33
+ sha: Sha;
34
+ type?: string;
35
+ }): boolean;
36
+ /** Key-set equality for `VisibleWipShas` / `WipShasMissingStats`-shaped records (values are always `true`). */
37
+ export declare function areVisibleWipShasEqual(a: VisibleWipShas, b: VisibleWipShas): boolean;
38
+ /**
39
+ * Given the set of currently-visible secondary-WIP shas, the prior dedup map of shas already
40
+ * requested, and the per-sha metadata, compute (a) the pruned dedup map that only retains entries
41
+ * for shas still visible, and (b) the set of shas whose stats should be requested this tick.
42
+ *
43
+ * Shas that have left the viewport are dropped from the dedup so they can be re-asked on re-entry.
44
+ * Shas with `customContent` override or with non-stale `workDirStats` already populated are not
45
+ * added to `missing`.
46
+ */
47
+ export declare function computeWipMissingShasUpdate(current: VisibleWipShas, priorRequestedDedup: WipShasMissingStats, metadataBySha: WipNodeMetadataBySha | undefined): {
48
+ missing: WipShasMissingStats;
49
+ prunedRequestedDedup: WipShasMissingStats;
50
+ };
@@ -1,3 +1,5 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { Sha } from '../commit/CommitTypes';
1
3
  import type { GraphItemContext } from '../graph/GraphTypes';
2
4
  export type WorkDirStats = {
3
5
  added: number;
@@ -6,3 +8,52 @@ export type WorkDirStats = {
6
8
  context?: GraphItemContext;
7
9
  renamed?: number;
8
10
  };
11
+ /**
12
+ * Per-row decoration for a secondary (worktree) WIP graph row. Looked up by the row's `sha`.
13
+ *
14
+ * Not applied to the primary WIP row (`sha === workDirType`); use the `workDirStats` prop for that one.
15
+ *
16
+ * @see docs/multi-wip-rows.md
17
+ */
18
+ export type WipNodeMetadata = {
19
+ /**
20
+ * Stats for this secondary WIP row's worktree. Omit to have the library request them via
21
+ * `onWipShasMissingStats`. Until per-row stats arrive, the pill renders nothing — the library does
22
+ * NOT fall back to the global `workDirStats` (which belongs to the primary repo).
23
+ */
24
+ workDirStats?: WorkDirStats;
25
+ /** When true, the library requests fresh stats while continuing to render `workDirStats` (stale-while-revalidate). */
26
+ workDirStatsStale?: boolean;
27
+ /** If provided, renders this element in place of the default WIP stats pill. Suppresses any stats request. */
28
+ customContent?: ReactElement<any>;
29
+ /** If provided, renders this avatar URL inside the graph node circle instead of the default WIP dot. */
30
+ nodeAvatarUrl?: string;
31
+ };
32
+ /**
33
+ * Decoration map for secondary WIP rows, keyed by the row's `sha`. The library does not create rows from
34
+ * this map — provide the row in `graphRows` and this map augments it.
35
+ */
36
+ export type WipNodeMetadataBySha = Record<Sha, WipNodeMetadata>;
37
+ /**
38
+ * Batched set of secondary-WIP shas for which the library is requesting stats. Delivered to the
39
+ * `onWipShasMissingStats` callback after a 100ms debounce with dedup.
40
+ */
41
+ export type WipShasMissingStats = Record<Sha, true>;
42
+ /**
43
+ * Caller-supplied handler invoked when one or more secondary WIP rows need stats fetched.
44
+ * Handler should async-fetch and push back an updated `wipNodeMetadataBySha` reference with
45
+ * `workDirStats` populated for each requested sha.
46
+ */
47
+ export type OnWipShasMissingStats = (shas: WipShasMissingStats) => void;
48
+ /**
49
+ * Batched set of secondary-WIP shas currently rendered in the viewport. Delivered to the
50
+ * `onVisibleWipShasChanged` callback after a 100ms debounce when the set changes.
51
+ */
52
+ export type VisibleWipShas = Record<Sha, true>;
53
+ /**
54
+ * Caller-supplied handler invoked when the set of secondary WIP rows visible in the viewport changes.
55
+ * Use this to acquire/release per-worktree resources (filesystem watchers, subscriptions, etc.) as
56
+ * rows scroll in and out of view. Consumers diff the provided set against their own tracking to
57
+ * decide what to hook/unhook.
58
+ */
59
+ export type OnVisibleWipShasChanged = (shas: VisibleWipShas) => void;