@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,164 +1,164 @@
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
- /* eslint-disable @typescript-eslint/no-explicit-any */
18
-
19
- import * as debounce from 'p-debounce';
20
- import { Disposable, DisposableCollection, Emitter } from '@theia/core/lib/common';
21
- import { JSONExt, JSONObject } from '@theia/core/shared/@phosphor/coreutils';
22
-
23
- export interface ScmInputIssue {
24
- message: string;
25
- type: ScmInputIssueType;
26
- }
27
-
28
- export enum ScmInputIssueType {
29
- Error = 0,
30
- Warning = 1,
31
- Information = 2
32
- }
33
-
34
- export interface ScmInputValidator {
35
- (value: string): Promise<ScmInputIssue | undefined>;
36
- }
37
-
38
- export interface ScmInputOptions {
39
- placeholder?: string;
40
- validator?: ScmInputValidator;
41
- visible?: boolean;
42
- enabled?: boolean;
43
- }
44
-
45
- export interface ScmInputData {
46
- value?: string;
47
- issue?: ScmInputIssue;
48
- }
49
-
50
- export class ScmInput implements Disposable {
51
-
52
- protected readonly onDidChangeEmitter = new Emitter<void>();
53
- readonly onDidChange = this.onDidChangeEmitter.event;
54
- protected fireDidChange(): void {
55
- this.onDidChangeEmitter.fire(undefined);
56
- }
57
-
58
- protected readonly onDidFocusEmitter = new Emitter<void>();
59
- readonly onDidFocus = this.onDidFocusEmitter.event;
60
-
61
- protected readonly toDispose = new DisposableCollection(
62
- this.onDidChangeEmitter,
63
- this.onDidFocusEmitter
64
- );
65
-
66
- constructor(
67
- protected readonly options: ScmInputOptions = {}
68
- ) { }
69
-
70
- dispose(): void {
71
- this.toDispose.dispose();
72
- }
73
-
74
- protected _placeholder = this.options.placeholder;
75
- get placeholder(): string | undefined {
76
- return this._placeholder;
77
- }
78
- set placeholder(placeholder: string | undefined) {
79
- if (this._placeholder === placeholder) {
80
- return;
81
- }
82
- this._placeholder = placeholder;
83
- this.fireDidChange();
84
- }
85
-
86
- protected _value: string | undefined;
87
- get value(): string {
88
- return this._value || '';
89
- }
90
- set value(value: string) {
91
- if (this.value === value) {
92
- return;
93
- }
94
- this._value = value;
95
- this.fireDidChange();
96
- this.validate();
97
- }
98
-
99
- protected _visible = this.options.visible;
100
- get visible(): boolean {
101
- return this._visible ?? true;
102
- }
103
- set visible(visible: boolean) {
104
- if (this.visible === visible) {
105
- return;
106
- }
107
- this._visible = visible;
108
- this.fireDidChange();
109
- this.validate();
110
- }
111
-
112
- protected _enabled = this.options.enabled ?? true;
113
- get enabled(): boolean {
114
- return this._enabled;
115
- }
116
- set enabled(enabled: boolean) {
117
- if (this._enabled === enabled) {
118
- return;
119
- }
120
- this._enabled = enabled;
121
- this.fireDidChange();
122
- this.validate();
123
- }
124
-
125
- protected _issue: ScmInputIssue | undefined;
126
- get issue(): ScmInputIssue | undefined {
127
- return this._issue;
128
- }
129
- set issue(issue: ScmInputIssue | undefined) {
130
- if (JSONExt.deepEqual(<JSONObject>(this._issue || {}), <JSONObject>(issue || {}))) {
131
- return;
132
- }
133
- this._issue = issue;
134
- this.fireDidChange();
135
- }
136
-
137
- validate = debounce(async (): Promise<void> => {
138
- if (this.options.validator) {
139
- this.issue = await this.options.validator(this.value);
140
- }
141
- }, 200);
142
-
143
- focus(): void {
144
- this.onDidFocusEmitter.fire(undefined);
145
- }
146
-
147
- toJSON(): ScmInputData {
148
- return {
149
- value: this._value,
150
- issue: this._issue
151
- };
152
- }
153
-
154
- fromJSON(data: ScmInputData | any): void {
155
- if (this._value !== undefined) {
156
- return;
157
- }
158
- if ('value' in data) {
159
- this._value = data.value;
160
- this._issue = data.issue;
161
- this.fireDidChange();
162
- }
163
- }
164
- }
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
+ /* eslint-disable @typescript-eslint/no-explicit-any */
18
+
19
+ import * as debounce from 'p-debounce';
20
+ import { Disposable, DisposableCollection, Emitter } from '@theia/core/lib/common';
21
+ import { JSONExt, JSONObject } from '@theia/core/shared/@phosphor/coreutils';
22
+
23
+ export interface ScmInputIssue {
24
+ message: string;
25
+ type: ScmInputIssueType;
26
+ }
27
+
28
+ export enum ScmInputIssueType {
29
+ Error = 0,
30
+ Warning = 1,
31
+ Information = 2
32
+ }
33
+
34
+ export interface ScmInputValidator {
35
+ (value: string): Promise<ScmInputIssue | undefined>;
36
+ }
37
+
38
+ export interface ScmInputOptions {
39
+ placeholder?: string;
40
+ validator?: ScmInputValidator;
41
+ visible?: boolean;
42
+ enabled?: boolean;
43
+ }
44
+
45
+ export interface ScmInputData {
46
+ value?: string;
47
+ issue?: ScmInputIssue;
48
+ }
49
+
50
+ export class ScmInput implements Disposable {
51
+
52
+ protected readonly onDidChangeEmitter = new Emitter<void>();
53
+ readonly onDidChange = this.onDidChangeEmitter.event;
54
+ protected fireDidChange(): void {
55
+ this.onDidChangeEmitter.fire(undefined);
56
+ }
57
+
58
+ protected readonly onDidFocusEmitter = new Emitter<void>();
59
+ readonly onDidFocus = this.onDidFocusEmitter.event;
60
+
61
+ protected readonly toDispose = new DisposableCollection(
62
+ this.onDidChangeEmitter,
63
+ this.onDidFocusEmitter
64
+ );
65
+
66
+ constructor(
67
+ protected readonly options: ScmInputOptions = {}
68
+ ) { }
69
+
70
+ dispose(): void {
71
+ this.toDispose.dispose();
72
+ }
73
+
74
+ protected _placeholder = this.options.placeholder;
75
+ get placeholder(): string | undefined {
76
+ return this._placeholder;
77
+ }
78
+ set placeholder(placeholder: string | undefined) {
79
+ if (this._placeholder === placeholder) {
80
+ return;
81
+ }
82
+ this._placeholder = placeholder;
83
+ this.fireDidChange();
84
+ }
85
+
86
+ protected _value: string | undefined;
87
+ get value(): string {
88
+ return this._value || '';
89
+ }
90
+ set value(value: string) {
91
+ if (this.value === value) {
92
+ return;
93
+ }
94
+ this._value = value;
95
+ this.fireDidChange();
96
+ this.validate();
97
+ }
98
+
99
+ protected _visible = this.options.visible;
100
+ get visible(): boolean {
101
+ return this._visible ?? true;
102
+ }
103
+ set visible(visible: boolean) {
104
+ if (this.visible === visible) {
105
+ return;
106
+ }
107
+ this._visible = visible;
108
+ this.fireDidChange();
109
+ this.validate();
110
+ }
111
+
112
+ protected _enabled = this.options.enabled ?? true;
113
+ get enabled(): boolean {
114
+ return this._enabled;
115
+ }
116
+ set enabled(enabled: boolean) {
117
+ if (this._enabled === enabled) {
118
+ return;
119
+ }
120
+ this._enabled = enabled;
121
+ this.fireDidChange();
122
+ this.validate();
123
+ }
124
+
125
+ protected _issue: ScmInputIssue | undefined;
126
+ get issue(): ScmInputIssue | undefined {
127
+ return this._issue;
128
+ }
129
+ set issue(issue: ScmInputIssue | undefined) {
130
+ if (JSONExt.deepEqual(<JSONObject>(this._issue || {}), <JSONObject>(issue || {}))) {
131
+ return;
132
+ }
133
+ this._issue = issue;
134
+ this.fireDidChange();
135
+ }
136
+
137
+ validate = debounce(async (): Promise<void> => {
138
+ if (this.options.validator) {
139
+ this.issue = await this.options.validator(this.value);
140
+ }
141
+ }, 200);
142
+
143
+ focus(): void {
144
+ this.onDidFocusEmitter.fire(undefined);
145
+ }
146
+
147
+ toJSON(): ScmInputData {
148
+ return {
149
+ value: this._value,
150
+ issue: this._issue
151
+ };
152
+ }
153
+
154
+ fromJSON(data: ScmInputData | any): void {
155
+ if (this._value !== undefined) {
156
+ return;
157
+ }
158
+ if ('value' in data) {
159
+ this._value = data.value;
160
+ this._issue = data.issue;
161
+ this.fireDidChange();
162
+ }
163
+ }
164
+ }
@@ -1,64 +1,64 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2019 TypeFox 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 } from '@theia/core/shared/inversify';
18
- import { ApplicationShellLayoutMigration, WidgetDescription, ApplicationShellLayoutMigrationContext } from '@theia/core/lib/browser/shell/shell-layout-restorer';
19
- import { SCM_VIEW_CONTAINER_TITLE_OPTIONS, SCM_VIEW_CONTAINER_ID, SCM_WIDGET_FACTORY_ID } from './scm-contribution';
20
-
21
- @injectable()
22
- export class ScmLayoutVersion3Migration implements ApplicationShellLayoutMigration {
23
- readonly layoutVersion = 3.0;
24
- onWillInflateWidget(desc: WidgetDescription, { parent }: ApplicationShellLayoutMigrationContext): WidgetDescription | undefined {
25
- if (desc.constructionOptions.factoryId === 'scm' && !parent) {
26
- return {
27
- constructionOptions: {
28
- factoryId: SCM_VIEW_CONTAINER_ID
29
- },
30
- innerWidgetState: {
31
- parts: [
32
- {
33
- widget: {
34
- constructionOptions: {
35
- factoryId: SCM_WIDGET_FACTORY_ID
36
- },
37
- innerWidgetState: desc.innerWidgetState
38
- },
39
- partId: {
40
- factoryId: SCM_WIDGET_FACTORY_ID
41
- },
42
- collapsed: false,
43
- hidden: false
44
- }
45
- ],
46
- title: SCM_VIEW_CONTAINER_TITLE_OPTIONS
47
- }
48
- };
49
- }
50
- return undefined;
51
- }
52
- }
53
-
54
- @injectable()
55
- export class ScmLayoutVersion5Migration implements ApplicationShellLayoutMigration {
56
- readonly layoutVersion = 5.0;
57
- onWillInflateWidget(desc: WidgetDescription): WidgetDescription | undefined {
58
- if (desc.constructionOptions.factoryId === SCM_VIEW_CONTAINER_ID && typeof desc.innerWidgetState === 'string') {
59
- desc.innerWidgetState = desc.innerWidgetState.replace(/scm-tab-icon/g, SCM_VIEW_CONTAINER_TITLE_OPTIONS.iconClass!);
60
- return desc;
61
- }
62
- return undefined;
63
- }
64
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2019 TypeFox 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 } from '@theia/core/shared/inversify';
18
+ import { ApplicationShellLayoutMigration, WidgetDescription, ApplicationShellLayoutMigrationContext } from '@theia/core/lib/browser/shell/shell-layout-restorer';
19
+ import { SCM_VIEW_CONTAINER_TITLE_OPTIONS, SCM_VIEW_CONTAINER_ID, SCM_WIDGET_FACTORY_ID } from './scm-contribution';
20
+
21
+ @injectable()
22
+ export class ScmLayoutVersion3Migration implements ApplicationShellLayoutMigration {
23
+ readonly layoutVersion = 3.0;
24
+ onWillInflateWidget(desc: WidgetDescription, { parent }: ApplicationShellLayoutMigrationContext): WidgetDescription | undefined {
25
+ if (desc.constructionOptions.factoryId === 'scm' && !parent) {
26
+ return {
27
+ constructionOptions: {
28
+ factoryId: SCM_VIEW_CONTAINER_ID
29
+ },
30
+ innerWidgetState: {
31
+ parts: [
32
+ {
33
+ widget: {
34
+ constructionOptions: {
35
+ factoryId: SCM_WIDGET_FACTORY_ID
36
+ },
37
+ innerWidgetState: desc.innerWidgetState
38
+ },
39
+ partId: {
40
+ factoryId: SCM_WIDGET_FACTORY_ID
41
+ },
42
+ collapsed: false,
43
+ hidden: false
44
+ }
45
+ ],
46
+ title: SCM_VIEW_CONTAINER_TITLE_OPTIONS
47
+ }
48
+ };
49
+ }
50
+ return undefined;
51
+ }
52
+ }
53
+
54
+ @injectable()
55
+ export class ScmLayoutVersion5Migration implements ApplicationShellLayoutMigration {
56
+ readonly layoutVersion = 5.0;
57
+ onWillInflateWidget(desc: WidgetDescription): WidgetDescription | undefined {
58
+ if (desc.constructionOptions.factoryId === SCM_VIEW_CONTAINER_ID && typeof desc.innerWidgetState === 'string') {
59
+ desc.innerWidgetState = desc.innerWidgetState.replace(/scm-tab-icon/g, SCM_VIEW_CONTAINER_TITLE_OPTIONS.iconClass!);
60
+ return desc;
61
+ }
62
+ return undefined;
63
+ }
64
+ }
@@ -1,41 +1,41 @@
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 } from '@theia/core/shared/inversify';
18
- import * as React from '@theia/core/shared/react';
19
- import { ReactWidget } from '@theia/core/lib/browser';
20
- import { AlertMessage } from '@theia/core/lib/browser/widgets/alert-message';
21
- import { nls } from '@theia/core/lib/common/nls';
22
-
23
- @injectable()
24
- export class ScmNoRepositoryWidget extends ReactWidget {
25
-
26
- static ID = 'scm-no-repository-widget';
27
-
28
- constructor() {
29
- super();
30
- this.addClass('theia-scm-no-repository');
31
- this.id = ScmNoRepositoryWidget.ID;
32
- }
33
-
34
- protected render(): React.ReactNode {
35
- return <AlertMessage
36
- type='WARNING'
37
- header={nls.localize('theia/scm/noRepositoryFound', 'No repository found')}
38
- />;
39
- }
40
-
41
- }
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 } from '@theia/core/shared/inversify';
18
+ import * as React from '@theia/core/shared/react';
19
+ import { ReactWidget } from '@theia/core/lib/browser';
20
+ import { AlertMessage } from '@theia/core/lib/browser/widgets/alert-message';
21
+ import { nls } from '@theia/core/lib/common/nls';
22
+
23
+ @injectable()
24
+ export class ScmNoRepositoryWidget extends ReactWidget {
25
+
26
+ static ID = 'scm-no-repository-widget';
27
+
28
+ constructor() {
29
+ super();
30
+ this.addClass('theia-scm-no-repository');
31
+ this.id = ScmNoRepositoryWidget.ID;
32
+ }
33
+
34
+ protected render(): React.ReactNode {
35
+ return <AlertMessage
36
+ type='WARNING'
37
+ header={nls.localize('theia/scm/noRepositoryFound', 'No repository found')}
38
+ />;
39
+ }
40
+
41
+ }