@theia/scm 1.53.0-next.55 → 1.53.0-next.64

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 (41) hide show
  1. package/README.md +31 -31
  2. package/lib/browser/scm-commit-widget.js +1 -1
  3. package/lib/browser/scm-contribution.js +5 -5
  4. package/package.json +6 -6
  5. package/src/browser/decorations/scm-decorations-service.ts +102 -102
  6. package/src/browser/decorations/scm-navigator-decorator.ts +121 -121
  7. package/src/browser/decorations/scm-tab-bar-decorator.ts +83 -83
  8. package/src/browser/dirty-diff/content-lines.spec.ts +42 -42
  9. package/src/browser/dirty-diff/content-lines.ts +121 -121
  10. package/src/browser/dirty-diff/diff-computer.spec.ts +455 -455
  11. package/src/browser/dirty-diff/diff-computer.ts +177 -177
  12. package/src/browser/dirty-diff/dirty-diff-decorator.ts +114 -114
  13. package/src/browser/dirty-diff/dirty-diff-module.ts +33 -33
  14. package/src/browser/dirty-diff/dirty-diff-navigator.ts +288 -288
  15. package/src/browser/dirty-diff/dirty-diff-widget.ts +364 -364
  16. package/src/browser/scm-amend-component.tsx +600 -600
  17. package/src/browser/scm-amend-widget.tsx +77 -77
  18. package/src/browser/scm-avatar-service.ts +27 -27
  19. package/src/browser/scm-colors.ts +21 -21
  20. package/src/browser/scm-commit-widget.tsx +215 -215
  21. package/src/browser/scm-context-key-service.ts +46 -46
  22. package/src/browser/scm-contribution.ts +452 -452
  23. package/src/browser/scm-frontend-module.ts +149 -149
  24. package/src/browser/scm-groups-tree-model.ts +78 -78
  25. package/src/browser/scm-input.ts +164 -164
  26. package/src/browser/scm-layout-migrations.ts +64 -64
  27. package/src/browser/scm-no-repository-widget.tsx +41 -41
  28. package/src/browser/scm-preferences.ts +63 -63
  29. package/src/browser/scm-provider.ts +91 -91
  30. package/src/browser/scm-quick-open-service.ts +48 -48
  31. package/src/browser/scm-repository.ts +52 -52
  32. package/src/browser/scm-service.ts +108 -108
  33. package/src/browser/scm-tree-label-provider.ts +44 -44
  34. package/src/browser/scm-tree-model.ts +405 -405
  35. package/src/browser/scm-tree-widget.tsx +838 -838
  36. package/src/browser/scm-widget.tsx +204 -204
  37. package/src/browser/style/dirty-diff-decorator.css +53 -53
  38. package/src/browser/style/dirty-diff.css +50 -50
  39. package/src/browser/style/index.css +271 -271
  40. package/src/browser/style/scm-amend-component.css +94 -94
  41. package/src/browser/style/scm.svg +4 -4
@@ -1,149 +1,149 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2019 Red Hat, Inc. and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import '../../src/browser/style/index.css';
18
-
19
- import { interfaces, ContainerModule, Container } from '@theia/core/shared/inversify';
20
- import {
21
- bindViewContribution, FrontendApplicationContribution,
22
- WidgetFactory, ViewContainer,
23
- WidgetManager, ApplicationShellLayoutMigration,
24
- createTreeContainer, TreeModel, TreeModelImpl, StylingParticipant
25
- } from '@theia/core/lib/browser';
26
- import { ScmService } from './scm-service';
27
- import { SCM_WIDGET_FACTORY_ID, ScmContribution, SCM_VIEW_CONTAINER_ID, SCM_VIEW_CONTAINER_TITLE_OPTIONS } from './scm-contribution';
28
- import { ScmWidget } from './scm-widget';
29
- import { ScmTreeWidget } from './scm-tree-widget';
30
- import { ScmCommitWidget } from './scm-commit-widget';
31
- import { ScmAmendWidget } from './scm-amend-widget';
32
- import { ScmNoRepositoryWidget } from './scm-no-repository-widget';
33
- import { ScmTreeModelProps } from './scm-tree-model';
34
- import { ScmGroupsTreeModel } from './scm-groups-tree-model';
35
- import { ScmQuickOpenService } from './scm-quick-open-service';
36
- import { bindDirtyDiff } from './dirty-diff/dirty-diff-module';
37
- import { ScmDecorationsService } from './decorations/scm-decorations-service';
38
- import { ScmAvatarService } from './scm-avatar-service';
39
- import { ScmContextKeyService } from './scm-context-key-service';
40
- import { ScmLayoutVersion3Migration, ScmLayoutVersion5Migration } from './scm-layout-migrations';
41
- import { ScmTreeLabelProvider } from './scm-tree-label-provider';
42
- import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
43
- import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
44
- import { LabelProviderContribution } from '@theia/core/lib/browser/label-provider';
45
- import { bindScmPreferences } from './scm-preferences';
46
- import { ScmTabBarDecorator } from './decorations/scm-tab-bar-decorator';
47
- import { TabBarDecorator } from '@theia/core/lib/browser/shell/tab-bar-decorator';
48
- export default new ContainerModule(bind => {
49
- bind(ScmContextKeyService).toSelf().inSingletonScope();
50
- bind(ScmService).toSelf().inSingletonScope();
51
-
52
- bind(ScmWidget).toSelf();
53
- bind(WidgetFactory).toDynamicValue(({ container }) => ({
54
- id: SCM_WIDGET_FACTORY_ID,
55
- createWidget: () => {
56
- const child = createScmWidgetContainer(container);
57
- return child.get(ScmWidget);
58
- }
59
- })).inSingletonScope();
60
-
61
- bind(ScmCommitWidget).toSelf();
62
- bind(WidgetFactory).toDynamicValue(({ container }) => ({
63
- id: ScmCommitWidget.ID,
64
- createWidget: () => container.get(ScmCommitWidget)
65
- })).inSingletonScope();
66
-
67
- bind(WidgetFactory).toDynamicValue(({ container }) => ({
68
- id: ScmTreeWidget.ID,
69
- createWidget: () => container.get(ScmTreeWidget)
70
- })).inSingletonScope();
71
-
72
- bind(ScmAmendWidget).toSelf();
73
- bind(WidgetFactory).toDynamicValue(({ container }) => ({
74
- id: ScmAmendWidget.ID,
75
- createWidget: () => container.get(ScmAmendWidget)
76
- })).inSingletonScope();
77
-
78
- bind(ScmNoRepositoryWidget).toSelf();
79
- bind(WidgetFactory).toDynamicValue(({ container }) => ({
80
- id: ScmNoRepositoryWidget.ID,
81
- createWidget: () => container.get(ScmNoRepositoryWidget)
82
- })).inSingletonScope();
83
-
84
- bind(WidgetFactory).toDynamicValue(({ container }) => ({
85
- id: SCM_VIEW_CONTAINER_ID,
86
- createWidget: async () => {
87
- const viewContainer = container.get<ViewContainer.Factory>(ViewContainer.Factory)({
88
- id: SCM_VIEW_CONTAINER_ID,
89
- progressLocationId: 'scm'
90
- });
91
- viewContainer.setTitleOptions(SCM_VIEW_CONTAINER_TITLE_OPTIONS);
92
- const widget = await container.get(WidgetManager).getOrCreateWidget(SCM_WIDGET_FACTORY_ID);
93
- viewContainer.addWidget(widget, {
94
- canHide: false,
95
- initiallyCollapsed: false
96
- });
97
- return viewContainer;
98
- }
99
- })).inSingletonScope();
100
- bind(ApplicationShellLayoutMigration).to(ScmLayoutVersion3Migration).inSingletonScope();
101
- bind(ApplicationShellLayoutMigration).to(ScmLayoutVersion5Migration).inSingletonScope();
102
-
103
- bind(ScmQuickOpenService).toSelf().inSingletonScope();
104
- bindViewContribution(bind, ScmContribution);
105
- bind(FrontendApplicationContribution).toService(ScmContribution);
106
- bind(TabBarToolbarContribution).toService(ScmContribution);
107
- bind(ColorContribution).toService(ScmContribution);
108
- bind(StylingParticipant).toService(ScmContribution);
109
-
110
- bind(ScmDecorationsService).toSelf().inSingletonScope();
111
-
112
- bind(ScmAvatarService).toSelf().inSingletonScope();
113
-
114
- bindDirtyDiff(bind);
115
-
116
- bind(ScmTreeLabelProvider).toSelf().inSingletonScope();
117
- bind(LabelProviderContribution).toService(ScmTreeLabelProvider);
118
-
119
- bindScmPreferences(bind);
120
-
121
- bind(ScmTabBarDecorator).toSelf().inSingletonScope();
122
- bind(TabBarDecorator).toService(ScmTabBarDecorator);
123
- });
124
-
125
- export function createScmTreeContainer(parent: interfaces.Container): Container {
126
- const child = createTreeContainer(parent, {
127
- props: {
128
- virtualized: true,
129
- search: true,
130
- multiSelect: true,
131
- },
132
- widget: ScmTreeWidget,
133
- });
134
-
135
- child.unbind(TreeModel);
136
- child.unbind(TreeModelImpl);
137
-
138
- child.bind(ScmTreeModelProps).toConstantValue({
139
- defaultExpansion: 'expanded',
140
- });
141
- return child;
142
- }
143
-
144
- export function createScmWidgetContainer(parent: interfaces.Container): Container {
145
- const child = createScmTreeContainer(parent);
146
- child.bind(ScmGroupsTreeModel).toSelf();
147
- child.bind(TreeModel).toService(ScmGroupsTreeModel);
148
- return child;
149
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2019 Red Hat, Inc. and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import '../../src/browser/style/index.css';
18
+
19
+ import { interfaces, ContainerModule, Container } from '@theia/core/shared/inversify';
20
+ import {
21
+ bindViewContribution, FrontendApplicationContribution,
22
+ WidgetFactory, ViewContainer,
23
+ WidgetManager, ApplicationShellLayoutMigration,
24
+ createTreeContainer, TreeModel, TreeModelImpl, StylingParticipant
25
+ } from '@theia/core/lib/browser';
26
+ import { ScmService } from './scm-service';
27
+ import { SCM_WIDGET_FACTORY_ID, ScmContribution, SCM_VIEW_CONTAINER_ID, SCM_VIEW_CONTAINER_TITLE_OPTIONS } from './scm-contribution';
28
+ import { ScmWidget } from './scm-widget';
29
+ import { ScmTreeWidget } from './scm-tree-widget';
30
+ import { ScmCommitWidget } from './scm-commit-widget';
31
+ import { ScmAmendWidget } from './scm-amend-widget';
32
+ import { ScmNoRepositoryWidget } from './scm-no-repository-widget';
33
+ import { ScmTreeModelProps } from './scm-tree-model';
34
+ import { ScmGroupsTreeModel } from './scm-groups-tree-model';
35
+ import { ScmQuickOpenService } from './scm-quick-open-service';
36
+ import { bindDirtyDiff } from './dirty-diff/dirty-diff-module';
37
+ import { ScmDecorationsService } from './decorations/scm-decorations-service';
38
+ import { ScmAvatarService } from './scm-avatar-service';
39
+ import { ScmContextKeyService } from './scm-context-key-service';
40
+ import { ScmLayoutVersion3Migration, ScmLayoutVersion5Migration } from './scm-layout-migrations';
41
+ import { ScmTreeLabelProvider } from './scm-tree-label-provider';
42
+ import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
43
+ import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
44
+ import { LabelProviderContribution } from '@theia/core/lib/browser/label-provider';
45
+ import { bindScmPreferences } from './scm-preferences';
46
+ import { ScmTabBarDecorator } from './decorations/scm-tab-bar-decorator';
47
+ import { TabBarDecorator } from '@theia/core/lib/browser/shell/tab-bar-decorator';
48
+ export default new ContainerModule(bind => {
49
+ bind(ScmContextKeyService).toSelf().inSingletonScope();
50
+ bind(ScmService).toSelf().inSingletonScope();
51
+
52
+ bind(ScmWidget).toSelf();
53
+ bind(WidgetFactory).toDynamicValue(({ container }) => ({
54
+ id: SCM_WIDGET_FACTORY_ID,
55
+ createWidget: () => {
56
+ const child = createScmWidgetContainer(container);
57
+ return child.get(ScmWidget);
58
+ }
59
+ })).inSingletonScope();
60
+
61
+ bind(ScmCommitWidget).toSelf();
62
+ bind(WidgetFactory).toDynamicValue(({ container }) => ({
63
+ id: ScmCommitWidget.ID,
64
+ createWidget: () => container.get(ScmCommitWidget)
65
+ })).inSingletonScope();
66
+
67
+ bind(WidgetFactory).toDynamicValue(({ container }) => ({
68
+ id: ScmTreeWidget.ID,
69
+ createWidget: () => container.get(ScmTreeWidget)
70
+ })).inSingletonScope();
71
+
72
+ bind(ScmAmendWidget).toSelf();
73
+ bind(WidgetFactory).toDynamicValue(({ container }) => ({
74
+ id: ScmAmendWidget.ID,
75
+ createWidget: () => container.get(ScmAmendWidget)
76
+ })).inSingletonScope();
77
+
78
+ bind(ScmNoRepositoryWidget).toSelf();
79
+ bind(WidgetFactory).toDynamicValue(({ container }) => ({
80
+ id: ScmNoRepositoryWidget.ID,
81
+ createWidget: () => container.get(ScmNoRepositoryWidget)
82
+ })).inSingletonScope();
83
+
84
+ bind(WidgetFactory).toDynamicValue(({ container }) => ({
85
+ id: SCM_VIEW_CONTAINER_ID,
86
+ createWidget: async () => {
87
+ const viewContainer = container.get<ViewContainer.Factory>(ViewContainer.Factory)({
88
+ id: SCM_VIEW_CONTAINER_ID,
89
+ progressLocationId: 'scm'
90
+ });
91
+ viewContainer.setTitleOptions(SCM_VIEW_CONTAINER_TITLE_OPTIONS);
92
+ const widget = await container.get(WidgetManager).getOrCreateWidget(SCM_WIDGET_FACTORY_ID);
93
+ viewContainer.addWidget(widget, {
94
+ canHide: false,
95
+ initiallyCollapsed: false
96
+ });
97
+ return viewContainer;
98
+ }
99
+ })).inSingletonScope();
100
+ bind(ApplicationShellLayoutMigration).to(ScmLayoutVersion3Migration).inSingletonScope();
101
+ bind(ApplicationShellLayoutMigration).to(ScmLayoutVersion5Migration).inSingletonScope();
102
+
103
+ bind(ScmQuickOpenService).toSelf().inSingletonScope();
104
+ bindViewContribution(bind, ScmContribution);
105
+ bind(FrontendApplicationContribution).toService(ScmContribution);
106
+ bind(TabBarToolbarContribution).toService(ScmContribution);
107
+ bind(ColorContribution).toService(ScmContribution);
108
+ bind(StylingParticipant).toService(ScmContribution);
109
+
110
+ bind(ScmDecorationsService).toSelf().inSingletonScope();
111
+
112
+ bind(ScmAvatarService).toSelf().inSingletonScope();
113
+
114
+ bindDirtyDiff(bind);
115
+
116
+ bind(ScmTreeLabelProvider).toSelf().inSingletonScope();
117
+ bind(LabelProviderContribution).toService(ScmTreeLabelProvider);
118
+
119
+ bindScmPreferences(bind);
120
+
121
+ bind(ScmTabBarDecorator).toSelf().inSingletonScope();
122
+ bind(TabBarDecorator).toService(ScmTabBarDecorator);
123
+ });
124
+
125
+ export function createScmTreeContainer(parent: interfaces.Container): Container {
126
+ const child = createTreeContainer(parent, {
127
+ props: {
128
+ virtualized: true,
129
+ search: true,
130
+ multiSelect: true,
131
+ },
132
+ widget: ScmTreeWidget,
133
+ });
134
+
135
+ child.unbind(TreeModel);
136
+ child.unbind(TreeModelImpl);
137
+
138
+ child.bind(ScmTreeModelProps).toConstantValue({
139
+ defaultExpansion: 'expanded',
140
+ });
141
+ return child;
142
+ }
143
+
144
+ export function createScmWidgetContainer(parent: interfaces.Container): Container {
145
+ const child = createScmTreeContainer(parent);
146
+ child.bind(ScmGroupsTreeModel).toSelf();
147
+ child.bind(TreeModel).toService(ScmGroupsTreeModel);
148
+ return child;
149
+ }
@@ -1,78 +1,78 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2020 Arm and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
18
- import { DisposableCollection } from '@theia/core/lib/common/disposable';
19
- import { ScmService } from './scm-service';
20
- import { ScmTreeModel } from './scm-tree-model';
21
- import { ScmResourceGroup, ScmProvider } from './scm-provider';
22
-
23
- @injectable()
24
- export class ScmGroupsTreeModel extends ScmTreeModel {
25
-
26
- @inject(ScmService) protected readonly scmService: ScmService;
27
-
28
- protected readonly toDisposeOnRepositoryChange = new DisposableCollection();
29
-
30
- @postConstruct()
31
- protected override init(): void {
32
- super.init();
33
- this.refreshOnRepositoryChange();
34
- this.toDispose.push(this.scmService.onDidChangeSelectedRepository(() => {
35
- this.refreshOnRepositoryChange();
36
- }));
37
- }
38
-
39
- protected refreshOnRepositoryChange(): void {
40
- const repository = this.scmService.selectedRepository;
41
- if (repository) {
42
- this.changeRepository(repository.provider);
43
- } else {
44
- this.changeRepository(undefined);
45
- }
46
- }
47
-
48
- protected changeRepository(provider: ScmProvider | undefined): void {
49
- this.toDisposeOnRepositoryChange.dispose();
50
- this.contextKeys.scmProvider.set(provider ? provider.id : undefined);
51
- this.provider = provider;
52
- if (provider) {
53
- this.toDisposeOnRepositoryChange.push(provider.onDidChange(() => this.root = this.createTree()));
54
- if (provider.onDidChangeResources) {
55
- this.toDisposeOnRepositoryChange.push(provider.onDidChangeResources(() => this.root = this.createTree()));
56
- }
57
- this.root = this.createTree();
58
- }
59
- }
60
-
61
- get rootUri(): string | undefined {
62
- if (this.provider) {
63
- return this.provider.rootUri;
64
- }
65
- };
66
-
67
- get groups(): ScmResourceGroup[] {
68
- if (this.provider) {
69
- return this.provider.groups;
70
- } else {
71
- return [];
72
- }
73
- };
74
-
75
- canTabToWidget(): boolean {
76
- return !!this.provider;
77
- }
78
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2020 Arm and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
18
+ import { DisposableCollection } from '@theia/core/lib/common/disposable';
19
+ import { ScmService } from './scm-service';
20
+ import { ScmTreeModel } from './scm-tree-model';
21
+ import { ScmResourceGroup, ScmProvider } from './scm-provider';
22
+
23
+ @injectable()
24
+ export class ScmGroupsTreeModel extends ScmTreeModel {
25
+
26
+ @inject(ScmService) protected readonly scmService: ScmService;
27
+
28
+ protected readonly toDisposeOnRepositoryChange = new DisposableCollection();
29
+
30
+ @postConstruct()
31
+ protected override init(): void {
32
+ super.init();
33
+ this.refreshOnRepositoryChange();
34
+ this.toDispose.push(this.scmService.onDidChangeSelectedRepository(() => {
35
+ this.refreshOnRepositoryChange();
36
+ }));
37
+ }
38
+
39
+ protected refreshOnRepositoryChange(): void {
40
+ const repository = this.scmService.selectedRepository;
41
+ if (repository) {
42
+ this.changeRepository(repository.provider);
43
+ } else {
44
+ this.changeRepository(undefined);
45
+ }
46
+ }
47
+
48
+ protected changeRepository(provider: ScmProvider | undefined): void {
49
+ this.toDisposeOnRepositoryChange.dispose();
50
+ this.contextKeys.scmProvider.set(provider ? provider.id : undefined);
51
+ this.provider = provider;
52
+ if (provider) {
53
+ this.toDisposeOnRepositoryChange.push(provider.onDidChange(() => this.root = this.createTree()));
54
+ if (provider.onDidChangeResources) {
55
+ this.toDisposeOnRepositoryChange.push(provider.onDidChangeResources(() => this.root = this.createTree()));
56
+ }
57
+ this.root = this.createTree();
58
+ }
59
+ }
60
+
61
+ get rootUri(): string | undefined {
62
+ if (this.provider) {
63
+ return this.provider.rootUri;
64
+ }
65
+ };
66
+
67
+ get groups(): ScmResourceGroup[] {
68
+ if (this.provider) {
69
+ return this.provider.groups;
70
+ } else {
71
+ return [];
72
+ }
73
+ };
74
+
75
+ canTabToWidget(): boolean {
76
+ return !!this.provider;
77
+ }
78
+ }