@theia/scm 1.34.2 → 1.34.3

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 (95) hide show
  1. package/LICENSE +641 -641
  2. package/README.md +31 -31
  3. package/lib/browser/decorations/scm-decorations-service.d.ts +14 -14
  4. package/lib/browser/decorations/scm-decorations-service.js +101 -101
  5. package/lib/browser/decorations/scm-navigator-decorator.d.ts +25 -25
  6. package/lib/browser/decorations/scm-navigator-decorator.js +132 -132
  7. package/lib/browser/decorations/scm-tab-bar-decorator.d.ts +17 -17
  8. package/lib/browser/decorations/scm-tab-bar-decorator.js +93 -93
  9. package/lib/browser/dirty-diff/content-lines.d.ts +12 -12
  10. package/lib/browser/dirty-diff/content-lines.js +106 -106
  11. package/lib/browser/dirty-diff/content-lines.spec.d.ts +1 -1
  12. package/lib/browser/dirty-diff/content-lines.spec.js +39 -39
  13. package/lib/browser/dirty-diff/diff-computer.d.ts +29 -29
  14. package/lib/browser/dirty-diff/diff-computer.js +102 -102
  15. package/lib/browser/dirty-diff/diff-computer.spec.d.ts +1 -1
  16. package/lib/browser/dirty-diff/diff-computer.spec.js +315 -315
  17. package/lib/browser/dirty-diff/dirty-diff-decorator.d.ts +14 -14
  18. package/lib/browser/dirty-diff/dirty-diff-decorator.js +98 -98
  19. package/lib/browser/dirty-diff/dirty-diff-module.d.ts +3 -3
  20. package/lib/browser/dirty-diff/dirty-diff-module.js +24 -24
  21. package/lib/browser/scm-amend-component.d.ts +123 -123
  22. package/lib/browser/scm-amend-component.js +423 -423
  23. package/lib/browser/scm-amend-widget.d.ts +20 -20
  24. package/lib/browser/scm-amend-widget.js +101 -101
  25. package/lib/browser/scm-avatar-service.d.ts +3 -3
  26. package/lib/browser/scm-avatar-service.js +36 -36
  27. package/lib/browser/scm-commit-widget.d.ts +52 -52
  28. package/lib/browser/scm-commit-widget.js +199 -199
  29. package/lib/browser/scm-context-key-service.d.ts +10 -10
  30. package/lib/browser/scm-context-key-service.js +58 -58
  31. package/lib/browser/scm-contribution.d.ts +83 -83
  32. package/lib/browser/scm-contribution.js +353 -353
  33. package/lib/browser/scm-frontend-module.d.ts +6 -6
  34. package/lib/browser/scm-frontend-module.js +130 -130
  35. package/lib/browser/scm-groups-tree-model.d.ts +14 -14
  36. package/lib/browser/scm-groups-tree-model.js +97 -97
  37. package/lib/browser/scm-input.d.ts +53 -53
  38. package/lib/browser/scm-input.js +127 -127
  39. package/lib/browser/scm-layout-migrations.d.ts +9 -9
  40. package/lib/browser/scm-layout-migrations.js +79 -79
  41. package/lib/browser/scm-no-repository-widget.d.ts +8 -8
  42. package/lib/browser/scm-no-repository-widget.js +49 -49
  43. package/lib/browser/scm-preferences.d.ts +11 -11
  44. package/lib/browser/scm-preferences.js +51 -51
  45. package/lib/browser/scm-provider.d.ts +56 -56
  46. package/lib/browser/scm-provider.js +19 -19
  47. package/lib/browser/scm-quick-open-service.d.ts +11 -11
  48. package/lib/browser/scm-quick-open-service.js +73 -73
  49. package/lib/browser/scm-repository.d.ts +17 -17
  50. package/lib/browser/scm-repository.js +41 -41
  51. package/lib/browser/scm-service.d.ts +26 -26
  52. package/lib/browser/scm-service.js +108 -108
  53. package/lib/browser/scm-tree-label-provider.d.ts +7 -7
  54. package/lib/browser/scm-tree-label-provider.js +57 -57
  55. package/lib/browser/scm-tree-model.d.ts +74 -74
  56. package/lib/browser/scm-tree-model.js +348 -348
  57. package/lib/browser/scm-tree-widget.d.ts +201 -201
  58. package/lib/browser/scm-tree-widget.js +664 -664
  59. package/lib/browser/scm-widget.d.ts +40 -40
  60. package/lib/browser/scm-widget.js +218 -218
  61. package/package.json +6 -6
  62. package/src/browser/decorations/scm-decorations-service.ts +78 -78
  63. package/src/browser/decorations/scm-navigator-decorator.ts +121 -121
  64. package/src/browser/decorations/scm-tab-bar-decorator.ts +83 -83
  65. package/src/browser/dirty-diff/content-lines.spec.ts +42 -42
  66. package/src/browser/dirty-diff/content-lines.ts +112 -112
  67. package/src/browser/dirty-diff/diff-computer.spec.ts +387 -387
  68. package/src/browser/dirty-diff/diff-computer.ts +129 -129
  69. package/src/browser/dirty-diff/dirty-diff-decorator.ts +107 -107
  70. package/src/browser/dirty-diff/dirty-diff-module.ts +24 -24
  71. package/src/browser/scm-amend-component.tsx +600 -600
  72. package/src/browser/scm-amend-widget.tsx +77 -77
  73. package/src/browser/scm-avatar-service.ts +27 -27
  74. package/src/browser/scm-commit-widget.tsx +215 -215
  75. package/src/browser/scm-context-key-service.ts +46 -46
  76. package/src/browser/scm-contribution.ts +361 -361
  77. package/src/browser/scm-frontend-module.ts +149 -149
  78. package/src/browser/scm-groups-tree-model.ts +78 -78
  79. package/src/browser/scm-input.ts +164 -164
  80. package/src/browser/scm-layout-migrations.ts +64 -64
  81. package/src/browser/scm-no-repository-widget.tsx +41 -41
  82. package/src/browser/scm-preferences.ts +63 -63
  83. package/src/browser/scm-provider.ts +89 -89
  84. package/src/browser/scm-quick-open-service.ts +48 -48
  85. package/src/browser/scm-repository.ts +52 -52
  86. package/src/browser/scm-service.ts +108 -108
  87. package/src/browser/scm-tree-label-provider.ts +44 -44
  88. package/src/browser/scm-tree-model.ts +405 -405
  89. package/src/browser/scm-tree-widget.tsx +809 -809
  90. package/src/browser/scm-widget.tsx +204 -204
  91. package/src/browser/style/dirty-diff-decorator.css +52 -52
  92. package/src/browser/style/dirty-diff.css +50 -50
  93. package/src/browser/style/index.css +267 -267
  94. package/src/browser/style/scm-amend-component.css +94 -94
  95. package/src/browser/style/scm.svg +4 -4
@@ -1,99 +1,99 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2018 TypeFox 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 WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.DirtyDiffDecorator = exports.DirtyDiffDecorationType = void 0;
25
- const inversify_1 = require("@theia/core/shared/inversify");
26
- const browser_1 = require("@theia/editor/lib/browser");
27
- var DirtyDiffDecorationType;
28
- (function (DirtyDiffDecorationType) {
29
- DirtyDiffDecorationType["AddedLine"] = "dirty-diff-added-line";
30
- DirtyDiffDecorationType["RemovedLine"] = "dirty-diff-removed-line";
31
- DirtyDiffDecorationType["ModifiedLine"] = "dirty-diff-modified-line";
32
- })(DirtyDiffDecorationType = exports.DirtyDiffDecorationType || (exports.DirtyDiffDecorationType = {}));
33
- const AddedLineDecoration = {
34
- linesDecorationsClassName: 'dirty-diff-glyph dirty-diff-added-line',
35
- overviewRuler: {
36
- color: {
37
- id: 'editorOverviewRuler.addedForeground'
38
- },
39
- position: browser_1.OverviewRulerLane.Left,
40
- },
41
- minimap: {
42
- color: {
43
- id: 'minimapGutter.addedBackground'
44
- },
45
- position: browser_1.MinimapPosition.Gutter
46
- },
47
- isWholeLine: true
48
- };
49
- const RemovedLineDecoration = {
50
- linesDecorationsClassName: 'dirty-diff-glyph dirty-diff-removed-line',
51
- overviewRuler: {
52
- color: {
53
- id: 'editorOverviewRuler.deletedForeground'
54
- },
55
- position: browser_1.OverviewRulerLane.Left,
56
- },
57
- minimap: {
58
- color: {
59
- id: 'minimapGutter.deletedBackground'
60
- },
61
- position: browser_1.MinimapPosition.Gutter
62
- },
63
- isWholeLine: false
64
- };
65
- const ModifiedLineDecoration = {
66
- linesDecorationsClassName: 'dirty-diff-glyph dirty-diff-modified-line',
67
- overviewRuler: {
68
- color: {
69
- id: 'editorOverviewRuler.modifiedForeground'
70
- },
71
- position: browser_1.OverviewRulerLane.Left,
72
- },
73
- minimap: {
74
- color: {
75
- id: 'minimapGutter.modifiedBackground'
76
- },
77
- position: browser_1.MinimapPosition.Gutter
78
- },
79
- isWholeLine: true
80
- };
81
- let DirtyDiffDecorator = class DirtyDiffDecorator extends browser_1.EditorDecorator {
82
- applyDecorations(update) {
83
- const modifications = update.modified.map(range => this.toDeltaDecoration(range, ModifiedLineDecoration));
84
- const additions = update.added.map(range => this.toDeltaDecoration(range, AddedLineDecoration));
85
- const removals = update.removed.map(line => this.toDeltaDecoration(line, RemovedLineDecoration));
86
- const decorations = [...modifications, ...additions, ...removals];
87
- this.setDecorations(update.editor, decorations);
88
- }
89
- toDeltaDecoration(from, options) {
90
- const [start, end] = (typeof from === 'number') ? [from, from] : [from.start, from.end];
91
- const range = browser_1.Range.create(browser_1.Position.create(start, 0), browser_1.Position.create(end, 0));
92
- return { range, options };
93
- }
94
- };
95
- DirtyDiffDecorator = __decorate([
96
- (0, inversify_1.injectable)()
97
- ], DirtyDiffDecorator);
98
- exports.DirtyDiffDecorator = DirtyDiffDecorator;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 TypeFox 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 WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.DirtyDiffDecorator = exports.DirtyDiffDecorationType = void 0;
25
+ const inversify_1 = require("@theia/core/shared/inversify");
26
+ const browser_1 = require("@theia/editor/lib/browser");
27
+ var DirtyDiffDecorationType;
28
+ (function (DirtyDiffDecorationType) {
29
+ DirtyDiffDecorationType["AddedLine"] = "dirty-diff-added-line";
30
+ DirtyDiffDecorationType["RemovedLine"] = "dirty-diff-removed-line";
31
+ DirtyDiffDecorationType["ModifiedLine"] = "dirty-diff-modified-line";
32
+ })(DirtyDiffDecorationType = exports.DirtyDiffDecorationType || (exports.DirtyDiffDecorationType = {}));
33
+ const AddedLineDecoration = {
34
+ linesDecorationsClassName: 'dirty-diff-glyph dirty-diff-added-line',
35
+ overviewRuler: {
36
+ color: {
37
+ id: 'editorOverviewRuler.addedForeground'
38
+ },
39
+ position: browser_1.OverviewRulerLane.Left,
40
+ },
41
+ minimap: {
42
+ color: {
43
+ id: 'minimapGutter.addedBackground'
44
+ },
45
+ position: browser_1.MinimapPosition.Gutter
46
+ },
47
+ isWholeLine: true
48
+ };
49
+ const RemovedLineDecoration = {
50
+ linesDecorationsClassName: 'dirty-diff-glyph dirty-diff-removed-line',
51
+ overviewRuler: {
52
+ color: {
53
+ id: 'editorOverviewRuler.deletedForeground'
54
+ },
55
+ position: browser_1.OverviewRulerLane.Left,
56
+ },
57
+ minimap: {
58
+ color: {
59
+ id: 'minimapGutter.deletedBackground'
60
+ },
61
+ position: browser_1.MinimapPosition.Gutter
62
+ },
63
+ isWholeLine: false
64
+ };
65
+ const ModifiedLineDecoration = {
66
+ linesDecorationsClassName: 'dirty-diff-glyph dirty-diff-modified-line',
67
+ overviewRuler: {
68
+ color: {
69
+ id: 'editorOverviewRuler.modifiedForeground'
70
+ },
71
+ position: browser_1.OverviewRulerLane.Left,
72
+ },
73
+ minimap: {
74
+ color: {
75
+ id: 'minimapGutter.modifiedBackground'
76
+ },
77
+ position: browser_1.MinimapPosition.Gutter
78
+ },
79
+ isWholeLine: true
80
+ };
81
+ let DirtyDiffDecorator = class DirtyDiffDecorator extends browser_1.EditorDecorator {
82
+ applyDecorations(update) {
83
+ const modifications = update.modified.map(range => this.toDeltaDecoration(range, ModifiedLineDecoration));
84
+ const additions = update.added.map(range => this.toDeltaDecoration(range, AddedLineDecoration));
85
+ const removals = update.removed.map(line => this.toDeltaDecoration(line, RemovedLineDecoration));
86
+ const decorations = [...modifications, ...additions, ...removals];
87
+ this.setDecorations(update.editor, decorations);
88
+ }
89
+ toDeltaDecoration(from, options) {
90
+ const [start, end] = (typeof from === 'number') ? [from, from] : [from.start, from.end];
91
+ const range = browser_1.Range.create(browser_1.Position.create(start, 0), browser_1.Position.create(end, 0));
92
+ return { range, options };
93
+ }
94
+ };
95
+ DirtyDiffDecorator = __decorate([
96
+ (0, inversify_1.injectable)()
97
+ ], DirtyDiffDecorator);
98
+ exports.DirtyDiffDecorator = DirtyDiffDecorator;
99
99
  //# sourceMappingURL=dirty-diff-decorator.js.map
@@ -1,4 +1,4 @@
1
- import { interfaces } from '@theia/core/shared/inversify';
2
- import '../../../src/browser/style/dirty-diff.css';
3
- export declare function bindDirtyDiff(bind: interfaces.Bind): void;
1
+ import { interfaces } from '@theia/core/shared/inversify';
2
+ import '../../../src/browser/style/dirty-diff.css';
3
+ export declare function bindDirtyDiff(bind: interfaces.Bind): void;
4
4
  //# sourceMappingURL=dirty-diff-module.d.ts.map
@@ -1,25 +1,25 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2018 TypeFox 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 WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.bindDirtyDiff = void 0;
19
- const dirty_diff_decorator_1 = require("./dirty-diff-decorator");
20
- require("../../../src/browser/style/dirty-diff.css");
21
- function bindDirtyDiff(bind) {
22
- bind(dirty_diff_decorator_1.DirtyDiffDecorator).toSelf().inSingletonScope();
23
- }
24
- exports.bindDirtyDiff = bindDirtyDiff;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 TypeFox 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 WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.bindDirtyDiff = void 0;
19
+ const dirty_diff_decorator_1 = require("./dirty-diff-decorator");
20
+ require("../../../src/browser/style/dirty-diff.css");
21
+ function bindDirtyDiff(bind) {
22
+ bind(dirty_diff_decorator_1.DirtyDiffDecorator).toSelf().inSingletonScope();
23
+ }
24
+ exports.bindDirtyDiff = bindDirtyDiff;
25
25
  //# sourceMappingURL=dirty-diff-module.js.map
@@ -1,124 +1,124 @@
1
- /// <reference types="react" />
2
- import '../../src/browser/style/scm-amend-component.css';
3
- import * as React from '@theia/core/shared/react';
4
- import { ScmAvatarService } from './scm-avatar-service';
5
- import { StorageService } from '@theia/core/lib/browser';
6
- import { DisposableCollection } from '@theia/core';
7
- import { ScmRepository } from './scm-repository';
8
- import { ScmAmendSupport, ScmCommit } from './scm-provider';
9
- export interface ScmAmendComponentProps {
10
- style: React.CSSProperties | undefined;
11
- repository: ScmRepository;
12
- scmAmendSupport: ScmAmendSupport;
13
- setCommitMessage: (message: string) => void;
14
- avatarService: ScmAvatarService;
15
- storageService: StorageService;
16
- }
17
- interface ScmAmendComponentState {
18
- /**
19
- * This is used for transitioning. When setting up a transition, we first set to render
20
- * the elements in their starting positions. This includes creating the elements to be
21
- * transitioned in, even though those controls will not be visible when state is 'start'.
22
- * On the next frame after 'start', we render elements with their final positions and with
23
- * the transition properties.
24
- */
25
- transition: {
26
- state: 'none';
27
- } | {
28
- state: 'start' | 'transitioning';
29
- direction: 'up' | 'down';
30
- previousLastCommit: {
31
- commit: ScmCommit;
32
- avatar: string;
33
- };
34
- };
35
- amendingCommits: {
36
- commit: ScmCommit;
37
- avatar: string;
38
- }[];
39
- lastCommit: {
40
- commit: ScmCommit;
41
- avatar: string;
42
- } | undefined;
43
- }
44
- export declare class ScmAmendComponent extends React.Component<ScmAmendComponentProps, ScmAmendComponentState> {
45
- /**
46
- * a hint on how to animate an update, set by certain user action handlers
47
- * and used when updating the view based on a repository change
48
- */
49
- protected transitionHint: 'none' | 'amend' | 'unamend';
50
- protected lastCommitHeight: number;
51
- lastCommitScrollRef: (instance: HTMLDivElement) => void;
52
- constructor(props: ScmAmendComponentProps);
53
- protected readonly toDisposeOnUnmount: DisposableCollection;
54
- componentDidMount(): Promise<void>;
55
- componentWillUnmount(): void;
56
- fetchStatusAndSetState(): Promise<void>;
57
- private clearAmendingCommits;
58
- private buildAmendingList;
59
- private getStorageKey;
60
- /**
61
- * Commits are equal if the ids are equal or if both are undefined.
62
- * (If a commit is undefined, it represents the initial empty state of a repository,
63
- * before the initial commit).
64
- */
65
- private commitsAreEqual;
66
- /**
67
- * This function will update the 'model' (lastCommit, amendingCommits) only
68
- * when the repository sees the last commit change.
69
- * 'render' can be called at any time, so be sure we don't update any 'model'
70
- * fields until we actually start the transition.
71
- */
72
- protected amend: () => Promise<void>;
73
- protected unamend: () => Promise<void>;
74
- private resetAndSetMessage;
75
- render(): JSX.Element;
76
- protected getLastCommit(): Promise<{
77
- commit: ScmCommit;
78
- avatar: string;
79
- } | undefined>;
80
- protected renderAmendingCommits(): React.ReactNode;
81
- protected renderAmendCommitListButtons(): React.ReactNode;
82
- protected renderLastCommit(): React.ReactNode;
83
- protected renderLastCommitNoButton(lastCommit: {
84
- commit: ScmCommit;
85
- avatar: string;
86
- }): React.ReactNode;
87
- /**
88
- * See https://stackoverflow.com/questions/26556436/react-after-render-code
89
- *
90
- * @param callback
91
- */
92
- protected onNextFrame(callback: FrameRequestCallback): void;
93
- protected renderCommitAvatarAndDetail(commitData: {
94
- commit: ScmCommit;
95
- avatar: string;
96
- }): React.ReactNode;
97
- protected renderCommitCount(commits: number): React.ReactNode;
98
- protected renderCommitBeingAmended(commitData: {
99
- commit: ScmCommit;
100
- avatar: string;
101
- }, isOldestAmendCommit: boolean): JSX.Element;
102
- protected styleAmendedCommits(): React.CSSProperties;
103
- protected styleLastCommitMovingUp(transitionState: 'start' | 'transitioning'): React.CSSProperties;
104
- protected styleLastCommitMovingDown(transitionState: 'start' | 'transitioning'): React.CSSProperties;
105
- protected styleLastCommit(transitionState: 'start' | 'transitioning', startingMarginTop: number, startingMarginBottom: number): React.CSSProperties;
106
- readonly unamendAll: () => Promise<void>;
107
- protected doUnamendAll(): Promise<void>;
108
- readonly clearAmending: () => Promise<void>;
109
- protected doClearAmending(): Promise<void>;
110
- }
111
- export declare namespace ScmAmendComponent {
112
- namespace Styles {
113
- const COMMIT_CONTAINER = "theia-scm-commit-container";
114
- const COMMIT_AND_BUTTON = "theia-scm-commit-and-button";
115
- const COMMIT_AVATAR_AND_TEXT = "theia-scm-commit-avatar-and-text";
116
- const COMMIT_DETAILS = "theia-scm-commit-details";
117
- const COMMIT_MESSAGE_AVATAR = "theia-scm-commit-message-avatar";
118
- const COMMIT_MESSAGE_SUMMARY = "theia-scm-commit-message-summary";
119
- const LAST_COMMIT_MESSAGE_TIME = "theia-scm-commit-message-time";
120
- const FLEX_CENTER = "theia-scm-flex-container-center";
121
- }
122
- }
123
- export {};
1
+ /// <reference types="react" />
2
+ import '../../src/browser/style/scm-amend-component.css';
3
+ import * as React from '@theia/core/shared/react';
4
+ import { ScmAvatarService } from './scm-avatar-service';
5
+ import { StorageService } from '@theia/core/lib/browser';
6
+ import { DisposableCollection } from '@theia/core';
7
+ import { ScmRepository } from './scm-repository';
8
+ import { ScmAmendSupport, ScmCommit } from './scm-provider';
9
+ export interface ScmAmendComponentProps {
10
+ style: React.CSSProperties | undefined;
11
+ repository: ScmRepository;
12
+ scmAmendSupport: ScmAmendSupport;
13
+ setCommitMessage: (message: string) => void;
14
+ avatarService: ScmAvatarService;
15
+ storageService: StorageService;
16
+ }
17
+ interface ScmAmendComponentState {
18
+ /**
19
+ * This is used for transitioning. When setting up a transition, we first set to render
20
+ * the elements in their starting positions. This includes creating the elements to be
21
+ * transitioned in, even though those controls will not be visible when state is 'start'.
22
+ * On the next frame after 'start', we render elements with their final positions and with
23
+ * the transition properties.
24
+ */
25
+ transition: {
26
+ state: 'none';
27
+ } | {
28
+ state: 'start' | 'transitioning';
29
+ direction: 'up' | 'down';
30
+ previousLastCommit: {
31
+ commit: ScmCommit;
32
+ avatar: string;
33
+ };
34
+ };
35
+ amendingCommits: {
36
+ commit: ScmCommit;
37
+ avatar: string;
38
+ }[];
39
+ lastCommit: {
40
+ commit: ScmCommit;
41
+ avatar: string;
42
+ } | undefined;
43
+ }
44
+ export declare class ScmAmendComponent extends React.Component<ScmAmendComponentProps, ScmAmendComponentState> {
45
+ /**
46
+ * a hint on how to animate an update, set by certain user action handlers
47
+ * and used when updating the view based on a repository change
48
+ */
49
+ protected transitionHint: 'none' | 'amend' | 'unamend';
50
+ protected lastCommitHeight: number;
51
+ lastCommitScrollRef: (instance: HTMLDivElement) => void;
52
+ constructor(props: ScmAmendComponentProps);
53
+ protected readonly toDisposeOnUnmount: DisposableCollection;
54
+ componentDidMount(): Promise<void>;
55
+ componentWillUnmount(): void;
56
+ fetchStatusAndSetState(): Promise<void>;
57
+ private clearAmendingCommits;
58
+ private buildAmendingList;
59
+ private getStorageKey;
60
+ /**
61
+ * Commits are equal if the ids are equal or if both are undefined.
62
+ * (If a commit is undefined, it represents the initial empty state of a repository,
63
+ * before the initial commit).
64
+ */
65
+ private commitsAreEqual;
66
+ /**
67
+ * This function will update the 'model' (lastCommit, amendingCommits) only
68
+ * when the repository sees the last commit change.
69
+ * 'render' can be called at any time, so be sure we don't update any 'model'
70
+ * fields until we actually start the transition.
71
+ */
72
+ protected amend: () => Promise<void>;
73
+ protected unamend: () => Promise<void>;
74
+ private resetAndSetMessage;
75
+ render(): JSX.Element;
76
+ protected getLastCommit(): Promise<{
77
+ commit: ScmCommit;
78
+ avatar: string;
79
+ } | undefined>;
80
+ protected renderAmendingCommits(): React.ReactNode;
81
+ protected renderAmendCommitListButtons(): React.ReactNode;
82
+ protected renderLastCommit(): React.ReactNode;
83
+ protected renderLastCommitNoButton(lastCommit: {
84
+ commit: ScmCommit;
85
+ avatar: string;
86
+ }): React.ReactNode;
87
+ /**
88
+ * See https://stackoverflow.com/questions/26556436/react-after-render-code
89
+ *
90
+ * @param callback
91
+ */
92
+ protected onNextFrame(callback: FrameRequestCallback): void;
93
+ protected renderCommitAvatarAndDetail(commitData: {
94
+ commit: ScmCommit;
95
+ avatar: string;
96
+ }): React.ReactNode;
97
+ protected renderCommitCount(commits: number): React.ReactNode;
98
+ protected renderCommitBeingAmended(commitData: {
99
+ commit: ScmCommit;
100
+ avatar: string;
101
+ }, isOldestAmendCommit: boolean): JSX.Element;
102
+ protected styleAmendedCommits(): React.CSSProperties;
103
+ protected styleLastCommitMovingUp(transitionState: 'start' | 'transitioning'): React.CSSProperties;
104
+ protected styleLastCommitMovingDown(transitionState: 'start' | 'transitioning'): React.CSSProperties;
105
+ protected styleLastCommit(transitionState: 'start' | 'transitioning', startingMarginTop: number, startingMarginBottom: number): React.CSSProperties;
106
+ readonly unamendAll: () => Promise<void>;
107
+ protected doUnamendAll(): Promise<void>;
108
+ readonly clearAmending: () => Promise<void>;
109
+ protected doClearAmending(): Promise<void>;
110
+ }
111
+ export declare namespace ScmAmendComponent {
112
+ namespace Styles {
113
+ const COMMIT_CONTAINER = "theia-scm-commit-container";
114
+ const COMMIT_AND_BUTTON = "theia-scm-commit-and-button";
115
+ const COMMIT_AVATAR_AND_TEXT = "theia-scm-commit-avatar-and-text";
116
+ const COMMIT_DETAILS = "theia-scm-commit-details";
117
+ const COMMIT_MESSAGE_AVATAR = "theia-scm-commit-message-avatar";
118
+ const COMMIT_MESSAGE_SUMMARY = "theia-scm-commit-message-summary";
119
+ const LAST_COMMIT_MESSAGE_TIME = "theia-scm-commit-message-time";
120
+ const FLEX_CENTER = "theia-scm-flex-container-center";
121
+ }
122
+ }
123
+ export {};
124
124
  //# sourceMappingURL=scm-amend-component.d.ts.map