@theia/scm 1.75.0-next.12 → 1.75.0-next.18

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 (47) hide show
  1. package/lib/browser/scm-history-graph-helpers.d.ts +26 -6
  2. package/lib/browser/scm-history-graph-helpers.d.ts.map +1 -1
  3. package/lib/browser/scm-history-graph-helpers.js +51 -5
  4. package/lib/browser/scm-history-graph-helpers.js.map +1 -1
  5. package/lib/browser/scm-history-graph-helpers.spec.d.ts +2 -0
  6. package/lib/browser/scm-history-graph-helpers.spec.d.ts.map +1 -0
  7. package/lib/browser/scm-history-graph-helpers.spec.js +71 -0
  8. package/lib/browser/scm-history-graph-helpers.spec.js.map +1 -0
  9. package/lib/browser/scm-history-graph-lanes.d.ts +19 -5
  10. package/lib/browser/scm-history-graph-lanes.d.ts.map +1 -1
  11. package/lib/browser/scm-history-graph-lanes.js +25 -9
  12. package/lib/browser/scm-history-graph-lanes.js.map +1 -1
  13. package/lib/browser/scm-history-graph-lanes.spec.js +62 -25
  14. package/lib/browser/scm-history-graph-lanes.spec.js.map +1 -1
  15. package/lib/browser/scm-history-graph-model.d.ts +7 -0
  16. package/lib/browser/scm-history-graph-model.d.ts.map +1 -1
  17. package/lib/browser/scm-history-graph-model.js +18 -0
  18. package/lib/browser/scm-history-graph-model.js.map +1 -1
  19. package/lib/browser/scm-history-graph-model.spec.js +52 -0
  20. package/lib/browser/scm-history-graph-model.spec.js.map +1 -1
  21. package/lib/browser/scm-history-graph-tooltip.d.ts +27 -2
  22. package/lib/browser/scm-history-graph-tooltip.d.ts.map +1 -1
  23. package/lib/browser/scm-history-graph-tooltip.js +113 -22
  24. package/lib/browser/scm-history-graph-tooltip.js.map +1 -1
  25. package/lib/browser/scm-history-graph-tooltip.spec.d.ts +2 -0
  26. package/lib/browser/scm-history-graph-tooltip.spec.d.ts.map +1 -0
  27. package/lib/browser/scm-history-graph-tooltip.spec.js +213 -0
  28. package/lib/browser/scm-history-graph-tooltip.spec.js.map +1 -0
  29. package/lib/browser/scm-history-graph-widget.d.ts +13 -0
  30. package/lib/browser/scm-history-graph-widget.d.ts.map +1 -1
  31. package/lib/browser/scm-history-graph-widget.js +61 -20
  32. package/lib/browser/scm-history-graph-widget.js.map +1 -1
  33. package/lib/browser/scm-provider.d.ts +9 -1
  34. package/lib/browser/scm-provider.d.ts.map +1 -1
  35. package/lib/browser/scm-provider.js.map +1 -1
  36. package/package.json +6 -6
  37. package/src/browser/scm-history-graph-helpers.spec.ts +85 -0
  38. package/src/browser/scm-history-graph-helpers.ts +56 -6
  39. package/src/browser/scm-history-graph-lanes.spec.ts +70 -25
  40. package/src/browser/scm-history-graph-lanes.ts +48 -11
  41. package/src/browser/scm-history-graph-model.spec.ts +63 -3
  42. package/src/browser/scm-history-graph-model.ts +21 -0
  43. package/src/browser/scm-history-graph-tooltip.spec.ts +254 -0
  44. package/src/browser/scm-history-graph-tooltip.ts +144 -24
  45. package/src/browser/scm-history-graph-widget.tsx +70 -28
  46. package/src/browser/scm-provider.ts +9 -1
  47. package/src/browser/style/scm-history-graph.css +43 -2
@@ -1,12 +1,12 @@
1
- import { ScmHistoryItemRef, ScmHistoryItemChange } from './scm-provider';
1
+ import { ScmHistoryItemRef, ScmHistoryItemChange, ScmHistoryProvider } from './scm-provider';
2
2
  /**
3
- * Returns the CSS color variable for the given lane index.
3
+ * Returns the CSS color variable for the given color index.
4
4
  * Uses Theia's `--theia-scmGraph-*` variables, mirroring the VS Code
5
5
  * scm graph color scheme:
6
- * lane 0 (current ref) → historyItemRefColor
7
- * lane 1 (remote ref) → historyItemRemoteRefColor
8
- * lane 2 (base ref) → historyItemBaseRefColor
9
- * lane 3–7 → foreground1–5
6
+ * 0 (current ref) → historyItemRefColor
7
+ * 1 (remote ref) → historyItemRemoteRefColor
8
+ * 2 (base ref) → historyItemBaseRefColor
9
+ * 3–7 (default rotation) → foreground1–5
10
10
  */
11
11
  export declare function laneColor(index: number): string;
12
12
  export declare function getChangeStatus(change: ScmHistoryItemChange): string;
@@ -17,6 +17,26 @@ export declare function getFilePath(uri: string): string;
17
17
  * Falls back to the full path if rootUri is unavailable or doesn't match.
18
18
  */
19
19
  export declare function getRepoRelativePath(uri: string, rootUri: string | undefined): string;
20
+ /**
21
+ * Returns the ref-based color index of the given ref (0 = current ref,
22
+ * 1 = remote ref, 2 = base ref), or `undefined` when the ref is none of
23
+ * the provider's current history item refs. Mirrors VS Code's scm graph
24
+ * color map.
25
+ */
26
+ export declare function getRefColorIndex(ref: ScmHistoryItemRef, provider: ScmHistoryProvider | undefined): number | undefined;
27
+ export interface RefBadgePresentation {
28
+ /** Icon class for the badge icon, e.g. 'codicon-git-branch'. */
29
+ iconClass: string;
30
+ /** Ref-based color index (0-2), or `undefined` to use the row color. */
31
+ colorIndex?: number;
32
+ }
33
+ /**
34
+ * Resolves how a ref badge is presented: the provider-supplied codicon icon
35
+ * when available (VS Code renders `ref.icon` unconditionally), otherwise a
36
+ * category fallback with the `target` icon marking the current ref; plus the
37
+ * ref-based color index.
38
+ */
39
+ export declare function getRefBadgePresentation(ref: ScmHistoryItemRef, provider: ScmHistoryProvider | undefined): RefBadgePresentation;
20
40
  export declare function getRefBadgeClass(ref: ScmHistoryItemRef): string;
21
41
  export declare function isTagRef(ref: ScmHistoryItemRef): boolean;
22
42
  export declare function isRemoteRef(ref: ScmHistoryItemRef): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"scm-history-graph-helpers.d.ts","sourceRoot":"","sources":["../../src/browser/scm-history-graph-helpers.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEzE;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAW/C;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAWpE;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAA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AM,CAYpF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,iBAAiB,EAAE,QAAQ,EAAE,kBAAkB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAcrH;AAED,MAAM,WAAW,oBAAoB;IACjC,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,iBAAiB,EAAE,QAAQ,EAAE,kBAAkB,GAAG,SAAS,GAAG,oBAAoB,CAa9H;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,iBAAiB,GAAG,MAAM,CAe/D;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAOxD;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAO3D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAGjE;AAED,MAAM,WAAW,eAAe;IAC5B,GAAG,EAAE,iBAAiB,CAAC;IACvB,oFAAoF;IACpF,OAAO,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,iBAAiB,EAAE,GAAG,eAAe,EAAE,CAkCrF"}
@@ -20,19 +20,21 @@ exports.getChangeStatus = getChangeStatus;
20
20
  exports.getFileName = getFileName;
21
21
  exports.getFilePath = getFilePath;
22
22
  exports.getRepoRelativePath = getRepoRelativePath;
23
+ exports.getRefColorIndex = getRefColorIndex;
24
+ exports.getRefBadgePresentation = getRefBadgePresentation;
23
25
  exports.getRefBadgeClass = getRefBadgeClass;
24
26
  exports.isTagRef = isTagRef;
25
27
  exports.isRemoteRef = isRemoteRef;
26
28
  exports.getLocalNameFromRemote = getLocalNameFromRemote;
27
29
  exports.deduplicateRefs = deduplicateRefs;
28
30
  /**
29
- * Returns the CSS color variable for the given lane index.
31
+ * Returns the CSS color variable for the given color index.
30
32
  * Uses Theia's `--theia-scmGraph-*` variables, mirroring the VS Code
31
33
  * scm graph color scheme:
32
- * lane 0 (current ref) → historyItemRefColor
33
- * lane 1 (remote ref) → historyItemRemoteRefColor
34
- * lane 2 (base ref) → historyItemBaseRefColor
35
- * lane 3–7 → foreground1–5
34
+ * 0 (current ref) → historyItemRefColor
35
+ * 1 (remote ref) → historyItemRemoteRefColor
36
+ * 2 (base ref) → historyItemBaseRefColor
37
+ * 3–7 (default rotation) → foreground1–5
36
38
  */
37
39
  function laneColor(index) {
38
40
  switch (index % 8) {
@@ -88,6 +90,50 @@ function getRepoRelativePath(uri, rootUri) {
88
90
  }
89
91
  return fullPath;
90
92
  }
93
+ /**
94
+ * Returns the ref-based color index of the given ref (0 = current ref,
95
+ * 1 = remote ref, 2 = base ref), or `undefined` when the ref is none of
96
+ * the provider's current history item refs. Mirrors VS Code's scm graph
97
+ * color map.
98
+ */
99
+ function getRefColorIndex(ref, provider) {
100
+ if (!provider) {
101
+ return undefined;
102
+ }
103
+ if (ref.id === provider.currentHistoryItemRef?.id) {
104
+ return 0;
105
+ }
106
+ if (ref.id === provider.currentHistoryItemRemoteRef?.id) {
107
+ return 1;
108
+ }
109
+ if (ref.id === provider.currentHistoryItemBaseRef?.id) {
110
+ return 2;
111
+ }
112
+ return undefined;
113
+ }
114
+ /**
115
+ * Resolves how a ref badge is presented: the provider-supplied codicon icon
116
+ * when available (VS Code renders `ref.icon` unconditionally), otherwise a
117
+ * category fallback with the `target` icon marking the current ref; plus the
118
+ * ref-based color index.
119
+ */
120
+ function getRefBadgePresentation(ref, provider) {
121
+ const colorIndex = getRefColorIndex(ref, provider);
122
+ let iconClass;
123
+ if (ref.icon && ref.icon.startsWith('codicon ')) {
124
+ iconClass = ref.icon.substring('codicon '.length);
125
+ }
126
+ else if (isTagRef(ref)) {
127
+ iconClass = 'codicon-tag';
128
+ }
129
+ else if (isRemoteRef(ref)) {
130
+ iconClass = 'codicon-cloud';
131
+ }
132
+ else {
133
+ iconClass = colorIndex === 0 ? 'codicon-target' : 'codicon-git-branch';
134
+ }
135
+ return { iconClass, colorIndex };
136
+ }
91
137
  function getRefBadgeClass(ref) {
92
138
  const cat = (ref.category ?? '').toLowerCase();
93
139
  if (cat === 'heads' || cat === 'head' || ref.id.startsWith('refs/heads/')) {
@@ -1 +1 @@
1
- {"version":3,"file":"scm-history-graph-helpers.js","sourceRoot":"","sources":["../../src/browser/scm-history-graph-helpers.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAahF,8BAWC;AAED,0CAWC;AAED,kCAGC;AAED,kCAOC;AAMD,kDAYC;AAED,4CAeC;AAED,4BAOC;AAED,kCAOC;AAMD,wDAGC;AAaD,0CAkCC;AA5JD;;;;;;;;GAQG;AACH,SAAgB,SAAS,CAAC,KAAa;IACnC,QAAQ,KAAK,GAAG,CAAC,EAAE,CAAC;QAChB,KAAK,CAAC,CAAC,CAAC,OAAO,2CAA2C,CAAC;QAC3D,KAAK,CAAC,CAAC,CAAC,OAAO,iDAAiD,CAAC;QACjE,KAAK,CAAC,CAAC,CAAC,OAAO,+CAA+C,CAAC;QAC/D,KAAK,CAAC,CAAC,CAAC,OAAO,mCAAmC,CAAC;QACnD,KAAK,CAAC,CAAC,CAAC,OAAO,mCAAmC,CAAC;QACnD,KAAK,CAAC,CAAC,CAAC,OAAO,mCAAmC,CAAC;QACnD,KAAK,CAAC,CAAC,CAAC,OAAO,mCAAmC,CAAC;QACnD,OAAO,CAAC,CAAC,OAAO,mCAAmC,CAAC;IACxD,CAAC;AACL,CAAC;AAED,SAAgB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K,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACrB,IAAI,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YAChC,SAAS;QACb,CAAC;QACD,MAAM,OAAO,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC/C,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YAC3G,CAAC,CAAC,KAAK,CAAC;QACZ,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
1
+ {"version":3,"file":"scm-history-graph-helpers.js","sourceRoot":"","sources":["../../src/browser/scm-history-graph-helpers.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAahF,8BAWC;AAED,0CAWC;AAED,kCAGC;AAED,kCAOC;AAMD,kDAYC;AAQD,4CAcC;AAeD,0DAaC;AAED,4CAeC;AAED,4BAOC;AAED,kCAOC;AAMD,wDAGC;AAaD,0CAkCC;AA9MD;;;;;;;;GAQG;AACH,SAAgB,SAAS,CAAC,KAAa;IACnC,QAAQ,KAAK,GAAG,CAAC,EAAE,CAAC;QAChB,KAAK,CAAC,CAAC,CAAC,OAAO,2CAA2C,CAAC;QAC3D,KAAK,CAAC,CAAC,CAAC,OAAO,iDAAiD,CAAC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C;QACrB,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;YACnB,MAAM,SAAS,GAAG,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;YACjE,IAAI,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC5B,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAClC,CAAC;QACL,CAAC;IACL,CAAC;IAED,4DAA4D;IAC5D,oEAAoE;IACpE,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACrB,IAAI,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YAChC,SAAS;QACb,CAAC;QACD,MAAM,OAAO,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC/C,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YAC3G,CAAC,CAAC,KAAK,CAAC;QACZ,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=scm-history-graph-helpers.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scm-history-graph-helpers.spec.d.ts","sourceRoot":"","sources":["../../src/browser/scm-history-graph-helpers.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2026 Safi Seid-Ahmad, K2view and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const chai_1 = require("chai");
19
+ const scm_history_graph_helpers_1 = require("./scm-history-graph-helpers");
20
+ describe('getRefColorIndex', () => {
21
+ const mainRef = { id: 'refs/heads/main', name: 'main' };
22
+ const remoteRef = { id: 'refs/remotes/origin/main', name: 'origin/main' };
23
+ const baseRef = { id: 'refs/remotes/origin/develop', name: 'origin/develop' };
24
+ const otherRef = { id: 'refs/heads/feature', name: 'feature' };
25
+ const provider = {
26
+ currentHistoryItemRef: mainRef,
27
+ currentHistoryItemRemoteRef: remoteRef,
28
+ currentHistoryItemBaseRef: baseRef,
29
+ };
30
+ it('returns 0 for the current history item ref', () => {
31
+ (0, chai_1.expect)((0, scm_history_graph_helpers_1.getRefColorIndex)(mainRef, provider)).to.equal(0);
32
+ });
33
+ it('returns 1 for the current remote ref', () => {
34
+ (0, chai_1.expect)((0, scm_history_graph_helpers_1.getRefColorIndex)(remoteRef, provider)).to.equal(1);
35
+ });
36
+ it('returns 2 for the current base ref', () => {
37
+ (0, chai_1.expect)((0, scm_history_graph_helpers_1.getRefColorIndex)(baseRef, provider)).to.equal(2);
38
+ });
39
+ it('returns undefined for any other ref', () => {
40
+ (0, chai_1.expect)((0, scm_history_graph_helpers_1.getRefColorIndex)(otherRef, provider)).to.be.undefined;
41
+ });
42
+ it('returns undefined without a provider', () => {
43
+ (0, chai_1.expect)((0, scm_history_graph_helpers_1.getRefColorIndex)(mainRef, undefined)).to.be.undefined;
44
+ });
45
+ });
46
+ describe('getRefBadgePresentation', () => {
47
+ const mainRef = { id: 'refs/heads/main', name: 'main' };
48
+ const remoteRef = { id: 'refs/remotes/origin/main', name: 'origin/main' };
49
+ const provider = {
50
+ currentHistoryItemRef: mainRef,
51
+ currentHistoryItemRemoteRef: remoteRef,
52
+ };
53
+ it('prefers the codicon icon transferred from the provider', () => {
54
+ const ref = { ...mainRef, icon: 'codicon codicon-target' };
55
+ (0, chai_1.expect)((0, scm_history_graph_helpers_1.getRefBadgePresentation)(ref, undefined).iconClass).to.equal('codicon-target');
56
+ });
57
+ it('falls back to the target icon for the current ref', () => {
58
+ (0, chai_1.expect)((0, scm_history_graph_helpers_1.getRefBadgePresentation)(mainRef, provider).iconClass).to.equal('codicon-target');
59
+ });
60
+ it('falls back to category icons for remote, tag, and other local refs', () => {
61
+ (0, chai_1.expect)((0, scm_history_graph_helpers_1.getRefBadgePresentation)(remoteRef, provider).iconClass).to.equal('codicon-cloud');
62
+ (0, chai_1.expect)((0, scm_history_graph_helpers_1.getRefBadgePresentation)({ id: 'refs/tags/v1', name: 'v1' }, provider).iconClass).to.equal('codicon-tag');
63
+ (0, chai_1.expect)((0, scm_history_graph_helpers_1.getRefBadgePresentation)({ id: 'refs/heads/feature', name: 'feature' }, provider).iconClass).to.equal('codicon-git-branch');
64
+ });
65
+ it('carries the ref color index', () => {
66
+ (0, chai_1.expect)((0, scm_history_graph_helpers_1.getRefBadgePresentation)(mainRef, provider).colorIndex).to.equal(0);
67
+ (0, chai_1.expect)((0, scm_history_graph_helpers_1.getRefBadgePresentation)(remoteRef, provider).colorIndex).to.equal(1);
68
+ (0, chai_1.expect)((0, scm_history_graph_helpers_1.getRefBadgePresentation)({ id: 'refs/heads/feature', name: 'feature' }, provider).colorIndex).to.be.undefined;
69
+ });
70
+ });
71
+ //# sourceMappingURL=scm-history-graph-helpers.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scm-history-graph-helpers.spec.js","sourceRoot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AAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -28,8 +28,14 @@ export interface GraphEdge {
28
28
  export interface GraphRow {
29
29
  /** Lane index where the commit node is rendered. */
30
30
  readonly lane: number;
31
- /** Color index for the commit node dot. */
31
+ /** Color index for the commit node dot and the lane segment below it. */
32
32
  readonly color: number;
33
+ /**
34
+ * Color index for the lane segment above the commit node. Differs from
35
+ * `color` when this commit's ref color overrides the color inherited from
36
+ * the chain above (e.g. the current branch tip below remote-only commits).
37
+ */
38
+ readonly topColor: number;
33
39
  /** Edges crossing or originating on this row. */
34
40
  readonly edges: readonly GraphEdge[];
35
41
  /**
@@ -45,6 +51,17 @@ export interface GraphRow {
45
51
  */
46
52
  readonly hasTopLine: boolean;
47
53
  }
54
+ export interface GraphCommitInput {
55
+ id: string;
56
+ parentIds?: readonly string[];
57
+ /**
58
+ * Ref-based color index resolved from the commit's references
59
+ * (0 = current ref, 1 = remote ref, 2 = base ref). When set, it colors
60
+ * this row and propagates down the first-parent chain, mirroring
61
+ * VS Code's scm graph color map.
62
+ */
63
+ colorIndex?: number;
64
+ }
48
65
  /**
49
66
  * Compute graph rows for an ordered list of commits (topological order,
50
67
  * newest first). Each commit must supply its own `id` and `parentIds`.
@@ -52,8 +69,5 @@ export interface GraphRow {
52
69
  * @param commits Topologically sorted commits (newest → oldest).
53
70
  * @returns One `GraphRow` per commit in the same order.
54
71
  */
55
- export declare function computeGraphRows(commits: ReadonlyArray<{
56
- id: string;
57
- parentIds?: readonly string[];
58
- }>): GraphRow[];
72
+ export declare function computeGraphRows(commits: ReadonlyArray<GraphCommitInput>): GraphRow[];
59
73
  //# sourceMappingURL=scm-history-graph-lanes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scm-history-graph-lanes.d.ts","sourceRoot":"","sources":["../../src/browser/scm-history-graph-lanes.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,YAA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,IAAI,EAAE,aAAa,CAAC;CAChC;AAED,MAAM,WAAW,QAAQ;IACrB,oDAAoD;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iDAAiD;IACjD,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAChC;AAcD,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAOD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,aAAa,CAAC,gBAAgB,CAAC,GACzC,QAAQ,EAAE,CAiLZ"}
@@ -16,6 +16,10 @@
16
16
  // *****************************************************************************
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.computeGraphRows = computeGraphRows;
19
+ /** First color index of the default rotation (`scmGraph.foreground1`). */
20
+ const DEFAULT_COLOR_FIRST = 3;
21
+ /** Number of default rotation colors (`scmGraph.foreground1-5`). */
22
+ const DEFAULT_COLOR_COUNT = 5;
19
23
  /**
20
24
  * Compute graph rows for an ordered list of commits (topological order,
21
25
  * newest first). Each commit must supply its own `id` and `parentIds`.
@@ -27,8 +31,15 @@ function computeGraphRows(commits) {
27
31
  // lanes[i] = id of commit that "owns" lane i (i.e. we are waiting for this
28
32
  // commit to appear in the list so we can close the lane).
29
33
  const lanes = [];
30
- // laneColors[i] = the color index permanently assigned to lane i
34
+ // laneColors[i] = the color index currently assigned to lane i
31
35
  const laneColors = [];
36
+ // Default lane colors rotate through foreground1-5, like VS Code's
37
+ // color registry; indices 0-2 are reserved for ref-based colors.
38
+ let rotation = -1;
39
+ const nextDefaultColor = () => {
40
+ rotation = (rotation + 1) % DEFAULT_COLOR_COUNT;
41
+ return DEFAULT_COLOR_FIRST + rotation;
42
+ };
32
43
  const rows = [];
33
44
  for (const commit of commits) {
34
45
  const parentIds = commit.parentIds ?? [];
@@ -41,9 +52,14 @@ function computeGraphRows(commits) {
41
52
  // Not yet tracked → open a new lane
42
53
  myLane = firstFreeLane(lanes);
43
54
  lanes[myLane] = commit.id;
44
- laneColors[myLane] = myLane % 8;
55
+ laneColors[myLane] = commit.colorIndex ?? nextDefaultColor();
45
56
  }
46
- const myColor = laneColors[myLane] ?? myLane % 8;
57
+ // The segment above the commit keeps the color inherited from the
58
+ // chain above; the commit's own ref color (if any) takes over from
59
+ // this row downward.
60
+ const topColor = laneColors[myLane] ?? DEFAULT_COLOR_FIRST;
61
+ const myColor = commit.colorIndex ?? topColor;
62
+ laneColors[myLane] = myColor;
47
63
  // Collect any duplicate lane occupants: other lanes that were kept
48
64
  // alive pointing at this same commit (sibling branch tips whose lane
49
65
  // was preserved until the parent row). These emit merge-in edges and
@@ -53,7 +69,7 @@ function computeGraphRows(commits) {
53
69
  if (hasTopLine) {
54
70
  for (let li = 0; li < lanes.length; li++) {
55
71
  if (lanes[li] === commit.id && li !== myLane) {
56
- duplicateLanes.push({ lane: li, color: laneColors[li] ?? li % 8 });
72
+ duplicateLanes.push({ lane: li, color: laneColors[li] ?? DEFAULT_COLOR_FIRST });
57
73
  lanes[li] = undefined;
58
74
  laneColors[li] = undefined;
59
75
  }
@@ -102,7 +118,7 @@ function computeGraphRows(commits) {
102
118
  // Additional parents get new lanes — branch-out
103
119
  const newLane = firstFreeLane(lanes);
104
120
  lanes[newLane] = pid;
105
- laneColors[newLane] = newLane % 8;
121
+ laneColors[newLane] = nextDefaultColor();
106
122
  parentLanes.push(newLane);
107
123
  parentIsExisting.push(false);
108
124
  }
@@ -137,7 +153,7 @@ function computeGraphRows(commits) {
137
153
  if (!occupant || occupant === commit.id) {
138
154
  continue;
139
155
  }
140
- const color = laneColors[li] ?? li % 8;
156
+ const color = laneColors[li] ?? DEFAULT_COLOR_FIRST;
141
157
  edges.push({ fromLane: li, toLane: li, color, type: 'pass-through' });
142
158
  }
143
159
  for (let pi = 0; pi < parentIds.length; pi++) {
@@ -153,12 +169,12 @@ function computeGraphRows(commits) {
153
169
  if (isExisting) {
154
170
  // Merge-in: an existing lane at the top of the row curves into
155
171
  // the commit position at mid-row.
156
- const color = laneColors[toLane] ?? toLane % 8;
172
+ const color = laneColors[toLane] ?? DEFAULT_COLOR_FIRST;
157
173
  edges.push({ fromLane: toLane, toLane: myLane, color, type: 'merge-in' });
158
174
  }
159
175
  else {
160
176
  // Branch-out: the commit spawns a new lane below mid-row.
161
- const color = laneColors[toLane] ?? toLane % 8;
177
+ const color = laneColors[toLane] ?? DEFAULT_COLOR_FIRST;
162
178
  edges.push({ fromLane: myLane, toLane, color, type: 'branch-out' });
163
179
  }
164
180
  }
@@ -171,7 +187,7 @@ function computeGraphRows(commits) {
171
187
  // OR if this is a sibling branch tip whose lane was kept alive (pointing
172
188
  // at the parent) so it persists as a pass-through to the parent row.
173
189
  const hasContinuation = parentIds.length > 0 && (parentLanes[0] === myLane || lanes[myLane] === parentIds[0]);
174
- rows.push({ lane: myLane, color: myColor, edges, hasContinuation, hasTopLine });
190
+ rows.push({ lane: myLane, color: myColor, topColor, edges, hasContinuation, hasTopLine });
175
191
  }
176
192
  return rows;
177
193
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scm-history-graph-lanes.js","sourceRoot":"","sources":["../../src/browser/scm-history-graph-lanes.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAy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wE;QACxE,yEAAyE;QACzE,qEAAqE;QACrE,MAAM,eAAe,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAE9G,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,8EAA8E;AAC9E,SAAS,aAAa,CAAC,KAA6B;IAChD,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACrC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;AAC3C,CAAC"}
@@ -33,9 +33,13 @@ describe('computeGraphRows', () => {
33
33
  it('all commits stay in lane 0', () => {
34
34
  (0, chai_1.expect)(lanes(commits)).to.deep.equal([0, 0, 0]);
35
35
  });
36
- it('colors are all 0', () => {
36
+ it('colors default to the first rotation color (foreground1 = index 3)', () => {
37
37
  const rows = (0, scm_history_graph_lanes_1.computeGraphRows)(commits);
38
- (0, chai_1.expect)(rows.map(r => r.color)).to.deep.equal([0, 0, 0]);
38
+ (0, chai_1.expect)(rows.map(r => r.color)).to.deep.equal([3, 3, 3]);
39
+ });
40
+ it('topColor equals color when no ref color overrides the lane', () => {
41
+ const rows = (0, scm_history_graph_lanes_1.computeGraphRows)(commits);
42
+ rows.forEach(r => (0, chai_1.expect)(r.topColor).to.equal(r.color));
39
43
  });
40
44
  it('first parent same-lane continuation emits no separate edge (handled by commit line)', () => {
41
45
  const rows = (0, scm_history_graph_lanes_1.computeGraphRows)(commits);
@@ -174,9 +178,13 @@ describe('computeGraphRows', () => {
174
178
  const mergeIn = rows[0].edges.filter(e => e.type === 'merge-in');
175
179
  (0, chai_1.expect)(mergeIn.length).to.equal(0);
176
180
  });
177
- it('lane colors are correct modulo 8', () => {
181
+ it('lane colors rotate through the default registry (indices 3-7)', () => {
178
182
  const rows = (0, scm_history_graph_lanes_1.computeGraphRows)(commits);
179
- rows.forEach(r => (0, chai_1.expect)(r.color).to.equal(r.lane % 8));
183
+ // O and P1 share lane 0 → first rotation color; P2/P3 opened new lanes
184
+ (0, chai_1.expect)(rows[0].color).to.equal(3);
185
+ (0, chai_1.expect)(rows[1].color).to.equal(3);
186
+ (0, chai_1.expect)(rows[2].color).to.not.equal(rows[3].color);
187
+ rows.forEach(r => (0, chai_1.expect)(r.color).to.be.within(3, 7));
180
188
  });
181
189
  });
182
190
  // -------------------------------------------------------------------------
@@ -337,25 +345,14 @@ describe('computeGraphRows', () => {
337
345
  });
338
346
  });
339
347
  // -------------------------------------------------------------------------
340
- // Lane color wraps at 8
348
+ // Default color rotation (VS Code cycles scmGraph.foreground1-5)
341
349
  // -------------------------------------------------------------------------
342
- describe('color wrapping', () => {
343
- it('lane color is always lane % 8', () => {
344
- // 4 parallel chains so we have lanes 0, 1, 2, 3 occupied at once.
345
- // Chain structure: X0→X1→X2, Y0→Y1→Y2, etc., interleaved.
346
- const commits = [
347
- { id: 'X0', parentIds: ['X1'] },
348
- { id: 'Y0', parentIds: ['Y1'] },
349
- { id: 'Z0', parentIds: ['Z1'] },
350
- { id: 'W0', parentIds: ['W1'] },
351
- { id: 'X1', parentIds: [] },
352
- { id: 'Y1', parentIds: [] },
353
- { id: 'Z1', parentIds: [] },
354
- { id: 'W1', parentIds: [] },
355
- ];
350
+ describe('default color rotation', () => {
351
+ it('cycles through indices 3-7 and wraps', () => {
352
+ // 6 independent tips 6 lanes; the sixth wraps back to the first color
353
+ const commits = ['A', 'B', 'C', 'D', 'E', 'F'].map(id => ({ id, parentIds: [id.toLowerCase()] }));
356
354
  const rows = (0, scm_history_graph_lanes_1.computeGraphRows)(commits);
357
- // Every row's color must equal lane % 8
358
- rows.forEach(r => (0, chai_1.expect)(r.color).to.equal(r.lane % 8));
355
+ (0, chai_1.expect)(rows.map(r => r.color)).to.deep.equal([3, 4, 5, 6, 7, 3]);
359
356
  });
360
357
  it('assigns distinct lanes to 8 simultaneous branches', () => {
361
358
  // 8 independent commits whose parents haven't been seen yet
@@ -372,10 +369,50 @@ describe('computeGraphRows', () => {
372
369
  const rows = (0, scm_history_graph_lanes_1.computeGraphRows)(commits);
373
370
  const laneSet = new Set(rows.map(r => r.lane));
374
371
  (0, chai_1.expect)(laneSet.size).to.equal(8); // all distinct lanes
375
- // Color of lane 7 is 7, lane 0 is 0
376
- const lane7 = rows.find(r => r.lane === 7);
377
- (0, chai_1.expect)(lane7).to.not.be.undefined;
378
- (0, chai_1.expect)(lane7.color).to.equal(7);
372
+ // Default colors never use the reserved ref color indices 0-2
373
+ rows.forEach(r => (0, chai_1.expect)(r.color).to.be.within(3, 7));
374
+ });
375
+ });
376
+ // -------------------------------------------------------------------------
377
+ // Ref-based colors (VS Code colorMap: current=0, remote=1, base=2)
378
+ // -------------------------------------------------------------------------
379
+ describe('ref-based colors', () => {
380
+ // Remote is one commit ahead: R (origin/main) → L (main = HEAD) → A
381
+ const behindCommits = [
382
+ { id: 'R', parentIds: ['L'], colorIndex: 1 },
383
+ { id: 'L', parentIds: ['A'], colorIndex: 0 },
384
+ { id: 'A', parentIds: [] },
385
+ ];
386
+ it('a tip with a color index colors its row', () => {
387
+ const rows = (0, scm_history_graph_lanes_1.computeGraphRows)(behindCommits);
388
+ (0, chai_1.expect)(rows[0].color).to.equal(1);
389
+ });
390
+ it('an overriding commit recolors the chain from its row downward', () => {
391
+ const rows = (0, scm_history_graph_lanes_1.computeGraphRows)(behindCommits);
392
+ (0, chai_1.expect)(rows[1].color).to.equal(0);
393
+ (0, chai_1.expect)(rows[2].color).to.equal(0);
394
+ });
395
+ it('topColor keeps the inherited color for the segment above an overriding commit', () => {
396
+ const rows = (0, scm_history_graph_lanes_1.computeGraphRows)(behindCommits);
397
+ (0, chai_1.expect)(rows[0].topColor).to.equal(1);
398
+ (0, chai_1.expect)(rows[1].topColor).to.equal(1);
399
+ (0, chai_1.expect)(rows[2].topColor).to.equal(0);
400
+ });
401
+ // Diverged: L (main = HEAD) and R (origin/main) both branched off A
402
+ const divergedCommits = [
403
+ { id: 'L', parentIds: ['A'], colorIndex: 0 },
404
+ { id: 'R', parentIds: ['A'], colorIndex: 1 },
405
+ { id: 'A', parentIds: [] },
406
+ ];
407
+ it('pass-through edges use the propagated ref color', () => {
408
+ const rows = (0, scm_history_graph_lanes_1.computeGraphRows)(divergedCommits);
409
+ const pass = rows[1].edges.find(e => e.type === 'pass-through');
410
+ (0, chai_1.expect)(pass?.color).to.equal(0);
411
+ });
412
+ it('merge-in edges from a ref-colored lane keep that color', () => {
413
+ const rows = (0, scm_history_graph_lanes_1.computeGraphRows)(divergedCommits);
414
+ const mergeIn = rows[2].edges.find(e => e.type === 'merge-in');
415
+ (0, chai_1.expect)(mergeIn?.color).to.equal(1);
379
416
  });
380
417
  });
381
418
  // -------------------------------------------------------------------------