@theia/vsx-registry 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 (73) hide show
  1. package/LICENSE +641 -641
  2. package/README.md +36 -36
  3. package/lib/browser/recommended-extensions/preference-provider-overrides.d.ts +17 -17
  4. package/lib/browser/recommended-extensions/preference-provider-overrides.js +95 -95
  5. package/lib/browser/recommended-extensions/recommended-extensions-json-schema.d.ts +14 -14
  6. package/lib/browser/recommended-extensions/recommended-extensions-json-schema.js +94 -94
  7. package/lib/browser/recommended-extensions/recommended-extensions-preference-contribution.d.ts +11 -11
  8. package/lib/browser/recommended-extensions/recommended-extensions-preference-contribution.js +59 -59
  9. package/lib/browser/vsx-extension-commands.d.ts +13 -13
  10. package/lib/browser/vsx-extension-commands.js +63 -63
  11. package/lib/browser/vsx-extension-editor-manager.d.ts +9 -9
  12. package/lib/browser/vsx-extension-editor-manager.js +49 -49
  13. package/lib/browser/vsx-extension-editor.d.ts +21 -21
  14. package/lib/browser/vsx-extension-editor.js +109 -109
  15. package/lib/browser/vsx-extension.d.ts +141 -141
  16. package/lib/browser/vsx-extension.js +581 -581
  17. package/lib/browser/vsx-extensions-contribution.d.ts +54 -54
  18. package/lib/browser/vsx-extensions-contribution.js +328 -328
  19. package/lib/browser/vsx-extensions-model.d.ts +67 -67
  20. package/lib/browser/vsx-extensions-model.js +368 -368
  21. package/lib/browser/vsx-extensions-search-bar.d.ts +14 -14
  22. package/lib/browser/vsx-extensions-search-bar.js +75 -75
  23. package/lib/browser/vsx-extensions-search-model.d.ts +21 -21
  24. package/lib/browser/vsx-extensions-search-model.js +70 -70
  25. package/lib/browser/vsx-extensions-source.d.ts +19 -19
  26. package/lib/browser/vsx-extensions-source.js +102 -102
  27. package/lib/browser/vsx-extensions-view-container.d.ts +49 -49
  28. package/lib/browser/vsx-extensions-view-container.js +179 -179
  29. package/lib/browser/vsx-extensions-widget.d.ts +29 -29
  30. package/lib/browser/vsx-extensions-widget.js +143 -143
  31. package/lib/browser/vsx-language-quick-pick-service.d.ts +13 -13
  32. package/lib/browser/vsx-language-quick-pick-service.js +103 -103
  33. package/lib/browser/vsx-registry-frontend-module.d.ts +4 -4
  34. package/lib/browser/vsx-registry-frontend-module.js +101 -101
  35. package/lib/common/ovsx-client-provider.d.ts +6 -6
  36. package/lib/common/ovsx-client-provider.js +28 -28
  37. package/lib/common/vsx-environment.d.ts +7 -7
  38. package/lib/common/vsx-environment.js +20 -20
  39. package/lib/common/vsx-extension-uri.d.ts +3 -3
  40. package/lib/common/vsx-extension-uri.js +20 -20
  41. package/lib/node/vsx-environment-impl.d.ts +10 -10
  42. package/lib/node/vsx-environment-impl.js +53 -53
  43. package/lib/node/vsx-extension-resolver.d.ts +17 -17
  44. package/lib/node/vsx-extension-resolver.js +137 -137
  45. package/lib/node/vsx-registry-backend-module.d.ts +3 -3
  46. package/lib/node/vsx-registry-backend-module.js +35 -35
  47. package/lib/package.spec.js +25 -25
  48. package/package.json +10 -10
  49. package/src/browser/recommended-extensions/preference-provider-overrides.ts +99 -99
  50. package/src/browser/recommended-extensions/recommended-extensions-json-schema.ts +74 -74
  51. package/src/browser/recommended-extensions/recommended-extensions-preference-contribution.ts +68 -68
  52. package/src/browser/style/extensions.svg +4 -4
  53. package/src/browser/style/index.css +354 -354
  54. package/src/browser/vsx-extension-commands.ts +63 -63
  55. package/src/browser/vsx-extension-editor-manager.ts +42 -42
  56. package/src/browser/vsx-extension-editor.tsx +96 -96
  57. package/src/browser/vsx-extension.tsx +662 -662
  58. package/src/browser/vsx-extensions-contribution.ts +315 -315
  59. package/src/browser/vsx-extensions-model.ts +366 -366
  60. package/src/browser/vsx-extensions-search-bar.tsx +69 -69
  61. package/src/browser/vsx-extensions-search-model.ts +61 -61
  62. package/src/browser/vsx-extensions-source.ts +83 -83
  63. package/src/browser/vsx-extensions-view-container.ts +179 -179
  64. package/src/browser/vsx-extensions-widget.tsx +138 -138
  65. package/src/browser/vsx-language-quick-pick-service.ts +97 -97
  66. package/src/browser/vsx-registry-frontend-module.ts +113 -113
  67. package/src/common/ovsx-client-provider.ts +30 -30
  68. package/src/common/vsx-environment.ts +24 -24
  69. package/src/common/vsx-extension-uri.ts +20 -20
  70. package/src/node/vsx-environment-impl.ts +41 -41
  71. package/src/node/vsx-extension-resolver.ts +111 -111
  72. package/src/node/vsx-registry-backend-module.ts +37 -37
  73. package/src/package.spec.ts +29 -29
@@ -1,50 +1,50 @@
1
- /********************************************************************************
2
- * Copyright (C) 2020 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 WITH Classpath-exception-2.0
15
- *******************************************************************************‚*/
16
- import { ViewContainer, PanelLayout, ViewContainerPart, Message } from '@theia/core/lib/browser';
17
- import { VSXExtensionsSearchBar } from './vsx-extensions-search-bar';
18
- import { VSXExtensionsModel } from './vsx-extensions-model';
19
- import { VSXSearchMode } from './vsx-extensions-search-model';
20
- export declare class VSXExtensionsViewContainer extends ViewContainer {
21
- static ID: string;
22
- static LABEL: string;
23
- disableDNDBetweenContainers: boolean;
24
- protected readonly searchBar: VSXExtensionsSearchBar;
25
- protected readonly model: VSXExtensionsModel;
26
- protected init(): void;
27
- protected onActivateRequest(msg: Message): void;
28
- protected onAfterAttach(msg: Message): void;
29
- protected configureLayout(layout: PanelLayout): void;
30
- protected currentMode: VSXSearchMode;
31
- protected readonly lastModeState: Map<VSXSearchMode, ViewContainer.State>;
32
- protected updateMode(): void;
33
- protected registerPart(part: ViewContainerPart): void;
34
- protected applyModeToPart(part: ViewContainerPart): void;
35
- protected shouldShowWidget(part: ViewContainerPart): boolean;
36
- protected getWidgetsForMode(): string[];
37
- protected doStoreState(): any;
38
- protected doRestoreState(state: any): void;
39
- protected updateToolbarItems(allParts: ViewContainerPart[]): void;
40
- protected getToggleVisibilityGroupLabel(): string;
41
- }
42
- export declare namespace VSXExtensionsViewContainer {
43
- interface State {
44
- query: string;
45
- modes: {
46
- [mode: number]: ViewContainer.State | undefined;
47
- };
48
- }
49
- }
1
+ /********************************************************************************
2
+ * Copyright (C) 2020 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 WITH Classpath-exception-2.0
15
+ *******************************************************************************‚*/
16
+ import { ViewContainer, PanelLayout, ViewContainerPart, Message } from '@theia/core/lib/browser';
17
+ import { VSXExtensionsSearchBar } from './vsx-extensions-search-bar';
18
+ import { VSXExtensionsModel } from './vsx-extensions-model';
19
+ import { VSXSearchMode } from './vsx-extensions-search-model';
20
+ export declare class VSXExtensionsViewContainer extends ViewContainer {
21
+ static ID: string;
22
+ static LABEL: string;
23
+ disableDNDBetweenContainers: boolean;
24
+ protected readonly searchBar: VSXExtensionsSearchBar;
25
+ protected readonly model: VSXExtensionsModel;
26
+ protected init(): void;
27
+ protected onActivateRequest(msg: Message): void;
28
+ protected onAfterAttach(msg: Message): void;
29
+ protected configureLayout(layout: PanelLayout): void;
30
+ protected currentMode: VSXSearchMode;
31
+ protected readonly lastModeState: Map<VSXSearchMode, ViewContainer.State>;
32
+ protected updateMode(): void;
33
+ protected registerPart(part: ViewContainerPart): void;
34
+ protected applyModeToPart(part: ViewContainerPart): void;
35
+ protected shouldShowWidget(part: ViewContainerPart): boolean;
36
+ protected getWidgetsForMode(): string[];
37
+ protected doStoreState(): any;
38
+ protected doRestoreState(state: any): void;
39
+ protected updateToolbarItems(allParts: ViewContainerPart[]): void;
40
+ protected getToggleVisibilityGroupLabel(): string;
41
+ }
42
+ export declare namespace VSXExtensionsViewContainer {
43
+ interface State {
44
+ query: string;
45
+ modes: {
46
+ [mode: number]: ViewContainer.State | undefined;
47
+ };
48
+ }
49
+ }
50
50
  //# sourceMappingURL=vsx-extensions-view-container.d.ts.map
@@ -1,180 +1,180 @@
1
- "use strict";
2
- /********************************************************************************
3
- * Copyright (C) 2020 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
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- var VSXExtensionsViewContainer_1;
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.VSXExtensionsViewContainer = void 0;
29
- const inversify_1 = require("@theia/core/shared/inversify");
30
- const browser_1 = require("@theia/core/lib/browser");
31
- const vsx_extensions_search_bar_1 = require("./vsx-extensions-search-bar");
32
- const vsx_extensions_model_1 = require("./vsx-extensions-model");
33
- const vsx_extensions_search_model_1 = require("./vsx-extensions-search-model");
34
- const vsx_extensions_widget_1 = require("./vsx-extensions-widget");
35
- const vsx_extensions_source_1 = require("./vsx-extensions-source");
36
- const vsx_extension_commands_1 = require("./vsx-extension-commands");
37
- const nls_1 = require("@theia/core/lib/common/nls");
38
- let VSXExtensionsViewContainer = VSXExtensionsViewContainer_1 = class VSXExtensionsViewContainer extends browser_1.ViewContainer {
39
- constructor() {
40
- super(...arguments);
41
- this.disableDNDBetweenContainers = true;
42
- this.currentMode = vsx_extensions_search_model_1.VSXSearchMode.Initial;
43
- this.lastModeState = new Map();
44
- }
45
- init() {
46
- super.init();
47
- this.id = VSXExtensionsViewContainer_1.ID;
48
- this.addClass('theia-vsx-extensions-view-container');
49
- this.setTitleOptions({
50
- label: VSXExtensionsViewContainer_1.LABEL,
51
- iconClass: (0, browser_1.codicon)('extensions'),
52
- closeable: true
53
- });
54
- }
55
- onActivateRequest(msg) {
56
- this.searchBar.activate();
57
- }
58
- onAfterAttach(msg) {
59
- super.onBeforeAttach(msg);
60
- this.updateMode();
61
- this.toDisposeOnDetach.push(this.model.search.onDidChangeQuery(() => this.updateMode()));
62
- }
63
- configureLayout(layout) {
64
- layout.addWidget(this.searchBar);
65
- super.configureLayout(layout);
66
- }
67
- updateMode() {
68
- const currentMode = this.model.search.getModeForQuery();
69
- if (currentMode === this.currentMode) {
70
- return;
71
- }
72
- if (this.currentMode !== vsx_extensions_search_model_1.VSXSearchMode.Initial) {
73
- this.lastModeState.set(this.currentMode, super.doStoreState());
74
- }
75
- this.currentMode = currentMode;
76
- const lastState = this.lastModeState.get(currentMode);
77
- if (lastState) {
78
- super.doRestoreState(lastState);
79
- }
80
- else {
81
- for (const part of this.getParts()) {
82
- this.applyModeToPart(part);
83
- }
84
- }
85
- const specialWidgets = this.getWidgetsForMode();
86
- if (specialWidgets === null || specialWidgets === void 0 ? void 0 : specialWidgets.length) {
87
- const widgetChecker = new Set(specialWidgets);
88
- const relevantParts = this.getParts().filter(part => widgetChecker.has(part.wrapped.id));
89
- relevantParts.forEach(part => {
90
- part.collapsed = false;
91
- part.show();
92
- });
93
- }
94
- }
95
- registerPart(part) {
96
- super.registerPart(part);
97
- this.applyModeToPart(part);
98
- }
99
- applyModeToPart(part) {
100
- if (this.shouldShowWidget(part)) {
101
- part.show();
102
- }
103
- else {
104
- part.hide();
105
- }
106
- }
107
- shouldShowWidget(part) {
108
- const widgetsToShow = this.getWidgetsForMode();
109
- if (widgetsToShow.length) {
110
- return widgetsToShow.includes(part.wrapped.id);
111
- }
112
- return part.wrapped.id !== (0, vsx_extensions_widget_1.generateExtensionWidgetId)(vsx_extensions_source_1.VSXExtensionsSourceOptions.SEARCH_RESULT);
113
- }
114
- getWidgetsForMode() {
115
- switch (this.currentMode) {
116
- case vsx_extensions_search_model_1.VSXSearchMode.Builtin:
117
- return [(0, vsx_extensions_widget_1.generateExtensionWidgetId)(vsx_extensions_source_1.VSXExtensionsSourceOptions.BUILT_IN)];
118
- case vsx_extensions_search_model_1.VSXSearchMode.Installed:
119
- return [(0, vsx_extensions_widget_1.generateExtensionWidgetId)(vsx_extensions_source_1.VSXExtensionsSourceOptions.INSTALLED)];
120
- case vsx_extensions_search_model_1.VSXSearchMode.Recommended:
121
- return [(0, vsx_extensions_widget_1.generateExtensionWidgetId)(vsx_extensions_source_1.VSXExtensionsSourceOptions.RECOMMENDED)];
122
- case vsx_extensions_search_model_1.VSXSearchMode.Search:
123
- return [(0, vsx_extensions_widget_1.generateExtensionWidgetId)(vsx_extensions_source_1.VSXExtensionsSourceOptions.SEARCH_RESULT)];
124
- default:
125
- return [];
126
- }
127
- }
128
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
129
- doStoreState() {
130
- const modes = {};
131
- for (const mode of this.lastModeState.keys()) {
132
- modes[mode] = this.lastModeState.get(mode);
133
- }
134
- return {
135
- query: this.model.search.query,
136
- modes
137
- };
138
- }
139
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
140
- doRestoreState(state) {
141
- // eslint-disable-next-line guard-for-in
142
- for (const key in state.modes) {
143
- const mode = Number(key);
144
- const modeState = state.modes[mode];
145
- if (modeState) {
146
- this.lastModeState.set(mode, modeState);
147
- }
148
- }
149
- this.model.search.query = state.query;
150
- }
151
- updateToolbarItems(allParts) {
152
- super.updateToolbarItems(allParts);
153
- this.registerToolbarItem(vsx_extension_commands_1.VSXExtensionsCommands.INSTALL_FROM_VSIX.id, { tooltip: vsx_extension_commands_1.VSXExtensionsCommands.INSTALL_FROM_VSIX.label, group: 'other_1' });
154
- this.registerToolbarItem(vsx_extension_commands_1.VSXExtensionsCommands.CLEAR_ALL.id, { tooltip: vsx_extension_commands_1.VSXExtensionsCommands.CLEAR_ALL.label, priority: 1, onDidChange: this.model.onDidChange });
155
- }
156
- getToggleVisibilityGroupLabel() {
157
- return 'a/' + nls_1.nls.localizeByDefault('Views');
158
- }
159
- };
160
- VSXExtensionsViewContainer.ID = 'vsx-extensions-view-container';
161
- VSXExtensionsViewContainer.LABEL = nls_1.nls.localizeByDefault('Extensions');
162
- __decorate([
163
- (0, inversify_1.inject)(vsx_extensions_search_bar_1.VSXExtensionsSearchBar),
164
- __metadata("design:type", vsx_extensions_search_bar_1.VSXExtensionsSearchBar)
165
- ], VSXExtensionsViewContainer.prototype, "searchBar", void 0);
166
- __decorate([
167
- (0, inversify_1.inject)(vsx_extensions_model_1.VSXExtensionsModel),
168
- __metadata("design:type", vsx_extensions_model_1.VSXExtensionsModel)
169
- ], VSXExtensionsViewContainer.prototype, "model", void 0);
170
- __decorate([
171
- (0, inversify_1.postConstruct)(),
172
- __metadata("design:type", Function),
173
- __metadata("design:paramtypes", []),
174
- __metadata("design:returntype", void 0)
175
- ], VSXExtensionsViewContainer.prototype, "init", null);
176
- VSXExtensionsViewContainer = VSXExtensionsViewContainer_1 = __decorate([
177
- (0, inversify_1.injectable)()
178
- ], VSXExtensionsViewContainer);
179
- exports.VSXExtensionsViewContainer = VSXExtensionsViewContainer;
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (C) 2020 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
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ var VSXExtensionsViewContainer_1;
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.VSXExtensionsViewContainer = void 0;
29
+ const inversify_1 = require("@theia/core/shared/inversify");
30
+ const browser_1 = require("@theia/core/lib/browser");
31
+ const vsx_extensions_search_bar_1 = require("./vsx-extensions-search-bar");
32
+ const vsx_extensions_model_1 = require("./vsx-extensions-model");
33
+ const vsx_extensions_search_model_1 = require("./vsx-extensions-search-model");
34
+ const vsx_extensions_widget_1 = require("./vsx-extensions-widget");
35
+ const vsx_extensions_source_1 = require("./vsx-extensions-source");
36
+ const vsx_extension_commands_1 = require("./vsx-extension-commands");
37
+ const nls_1 = require("@theia/core/lib/common/nls");
38
+ let VSXExtensionsViewContainer = VSXExtensionsViewContainer_1 = class VSXExtensionsViewContainer extends browser_1.ViewContainer {
39
+ constructor() {
40
+ super(...arguments);
41
+ this.disableDNDBetweenContainers = true;
42
+ this.currentMode = vsx_extensions_search_model_1.VSXSearchMode.Initial;
43
+ this.lastModeState = new Map();
44
+ }
45
+ init() {
46
+ super.init();
47
+ this.id = VSXExtensionsViewContainer_1.ID;
48
+ this.addClass('theia-vsx-extensions-view-container');
49
+ this.setTitleOptions({
50
+ label: VSXExtensionsViewContainer_1.LABEL,
51
+ iconClass: (0, browser_1.codicon)('extensions'),
52
+ closeable: true
53
+ });
54
+ }
55
+ onActivateRequest(msg) {
56
+ this.searchBar.activate();
57
+ }
58
+ onAfterAttach(msg) {
59
+ super.onBeforeAttach(msg);
60
+ this.updateMode();
61
+ this.toDisposeOnDetach.push(this.model.search.onDidChangeQuery(() => this.updateMode()));
62
+ }
63
+ configureLayout(layout) {
64
+ layout.addWidget(this.searchBar);
65
+ super.configureLayout(layout);
66
+ }
67
+ updateMode() {
68
+ const currentMode = this.model.search.getModeForQuery();
69
+ if (currentMode === this.currentMode) {
70
+ return;
71
+ }
72
+ if (this.currentMode !== vsx_extensions_search_model_1.VSXSearchMode.Initial) {
73
+ this.lastModeState.set(this.currentMode, super.doStoreState());
74
+ }
75
+ this.currentMode = currentMode;
76
+ const lastState = this.lastModeState.get(currentMode);
77
+ if (lastState) {
78
+ super.doRestoreState(lastState);
79
+ }
80
+ else {
81
+ for (const part of this.getParts()) {
82
+ this.applyModeToPart(part);
83
+ }
84
+ }
85
+ const specialWidgets = this.getWidgetsForMode();
86
+ if (specialWidgets === null || specialWidgets === void 0 ? void 0 : specialWidgets.length) {
87
+ const widgetChecker = new Set(specialWidgets);
88
+ const relevantParts = this.getParts().filter(part => widgetChecker.has(part.wrapped.id));
89
+ relevantParts.forEach(part => {
90
+ part.collapsed = false;
91
+ part.show();
92
+ });
93
+ }
94
+ }
95
+ registerPart(part) {
96
+ super.registerPart(part);
97
+ this.applyModeToPart(part);
98
+ }
99
+ applyModeToPart(part) {
100
+ if (this.shouldShowWidget(part)) {
101
+ part.show();
102
+ }
103
+ else {
104
+ part.hide();
105
+ }
106
+ }
107
+ shouldShowWidget(part) {
108
+ const widgetsToShow = this.getWidgetsForMode();
109
+ if (widgetsToShow.length) {
110
+ return widgetsToShow.includes(part.wrapped.id);
111
+ }
112
+ return part.wrapped.id !== (0, vsx_extensions_widget_1.generateExtensionWidgetId)(vsx_extensions_source_1.VSXExtensionsSourceOptions.SEARCH_RESULT);
113
+ }
114
+ getWidgetsForMode() {
115
+ switch (this.currentMode) {
116
+ case vsx_extensions_search_model_1.VSXSearchMode.Builtin:
117
+ return [(0, vsx_extensions_widget_1.generateExtensionWidgetId)(vsx_extensions_source_1.VSXExtensionsSourceOptions.BUILT_IN)];
118
+ case vsx_extensions_search_model_1.VSXSearchMode.Installed:
119
+ return [(0, vsx_extensions_widget_1.generateExtensionWidgetId)(vsx_extensions_source_1.VSXExtensionsSourceOptions.INSTALLED)];
120
+ case vsx_extensions_search_model_1.VSXSearchMode.Recommended:
121
+ return [(0, vsx_extensions_widget_1.generateExtensionWidgetId)(vsx_extensions_source_1.VSXExtensionsSourceOptions.RECOMMENDED)];
122
+ case vsx_extensions_search_model_1.VSXSearchMode.Search:
123
+ return [(0, vsx_extensions_widget_1.generateExtensionWidgetId)(vsx_extensions_source_1.VSXExtensionsSourceOptions.SEARCH_RESULT)];
124
+ default:
125
+ return [];
126
+ }
127
+ }
128
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
129
+ doStoreState() {
130
+ const modes = {};
131
+ for (const mode of this.lastModeState.keys()) {
132
+ modes[mode] = this.lastModeState.get(mode);
133
+ }
134
+ return {
135
+ query: this.model.search.query,
136
+ modes
137
+ };
138
+ }
139
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
140
+ doRestoreState(state) {
141
+ // eslint-disable-next-line guard-for-in
142
+ for (const key in state.modes) {
143
+ const mode = Number(key);
144
+ const modeState = state.modes[mode];
145
+ if (modeState) {
146
+ this.lastModeState.set(mode, modeState);
147
+ }
148
+ }
149
+ this.model.search.query = state.query;
150
+ }
151
+ updateToolbarItems(allParts) {
152
+ super.updateToolbarItems(allParts);
153
+ this.registerToolbarItem(vsx_extension_commands_1.VSXExtensionsCommands.INSTALL_FROM_VSIX.id, { tooltip: vsx_extension_commands_1.VSXExtensionsCommands.INSTALL_FROM_VSIX.label, group: 'other_1' });
154
+ this.registerToolbarItem(vsx_extension_commands_1.VSXExtensionsCommands.CLEAR_ALL.id, { tooltip: vsx_extension_commands_1.VSXExtensionsCommands.CLEAR_ALL.label, priority: 1, onDidChange: this.model.onDidChange });
155
+ }
156
+ getToggleVisibilityGroupLabel() {
157
+ return 'a/' + nls_1.nls.localizeByDefault('Views');
158
+ }
159
+ };
160
+ VSXExtensionsViewContainer.ID = 'vsx-extensions-view-container';
161
+ VSXExtensionsViewContainer.LABEL = nls_1.nls.localizeByDefault('Extensions');
162
+ __decorate([
163
+ (0, inversify_1.inject)(vsx_extensions_search_bar_1.VSXExtensionsSearchBar),
164
+ __metadata("design:type", vsx_extensions_search_bar_1.VSXExtensionsSearchBar)
165
+ ], VSXExtensionsViewContainer.prototype, "searchBar", void 0);
166
+ __decorate([
167
+ (0, inversify_1.inject)(vsx_extensions_model_1.VSXExtensionsModel),
168
+ __metadata("design:type", vsx_extensions_model_1.VSXExtensionsModel)
169
+ ], VSXExtensionsViewContainer.prototype, "model", void 0);
170
+ __decorate([
171
+ (0, inversify_1.postConstruct)(),
172
+ __metadata("design:type", Function),
173
+ __metadata("design:paramtypes", []),
174
+ __metadata("design:returntype", void 0)
175
+ ], VSXExtensionsViewContainer.prototype, "init", null);
176
+ VSXExtensionsViewContainer = VSXExtensionsViewContainer_1 = __decorate([
177
+ (0, inversify_1.injectable)()
178
+ ], VSXExtensionsViewContainer);
179
+ exports.VSXExtensionsViewContainer = VSXExtensionsViewContainer;
180
180
  //# sourceMappingURL=vsx-extensions-view-container.js.map
@@ -1,30 +1,30 @@
1
- /// <reference types="react" />
2
- import { interfaces } from '@theia/core/shared/inversify';
3
- import { TreeModel, TreeNode } from '@theia/core/lib/browser';
4
- import { SourceTreeWidget } from '@theia/core/lib/browser/source-tree';
5
- import { VSXExtensionsSource, VSXExtensionsSourceOptions } from './vsx-extensions-source';
6
- import { BadgeWidget } from '@theia/core/lib/browser/view-container';
7
- import { Emitter, Event } from '@theia/core/lib/common';
8
- import * as React from '@theia/core/shared/react';
9
- export declare class VSXExtensionsWidgetOptions extends VSXExtensionsSourceOptions {
10
- title?: string;
11
- }
12
- export declare const generateExtensionWidgetId: (widgetId: string) => string;
13
- export declare class VSXExtensionsWidget extends SourceTreeWidget implements BadgeWidget {
14
- static ID: string;
15
- static createWidget(parent: interfaces.Container, options: VSXExtensionsWidgetOptions): VSXExtensionsWidget;
16
- protected _badge?: number;
17
- protected onDidChangeBadgeEmitter: Emitter<void>;
18
- protected readonly options: VSXExtensionsWidgetOptions;
19
- protected readonly extensionsSource: VSXExtensionsSource;
20
- protected init(): void;
21
- get onDidChangeBadge(): Event<void>;
22
- get badge(): number | undefined;
23
- set badge(count: number | undefined);
24
- protected computeTitle(): string;
25
- protected resolveCount(): Promise<number | undefined>;
26
- protected tapNode(node?: TreeNode): void;
27
- protected handleDblClickEvent(): void;
28
- protected renderTree(model: TreeModel): React.ReactNode;
29
- }
1
+ /// <reference types="react" />
2
+ import { interfaces } from '@theia/core/shared/inversify';
3
+ import { TreeModel, TreeNode } from '@theia/core/lib/browser';
4
+ import { SourceTreeWidget } from '@theia/core/lib/browser/source-tree';
5
+ import { VSXExtensionsSource, VSXExtensionsSourceOptions } from './vsx-extensions-source';
6
+ import { BadgeWidget } from '@theia/core/lib/browser/view-container';
7
+ import { Emitter, Event } from '@theia/core/lib/common';
8
+ import * as React from '@theia/core/shared/react';
9
+ export declare class VSXExtensionsWidgetOptions extends VSXExtensionsSourceOptions {
10
+ title?: string;
11
+ }
12
+ export declare const generateExtensionWidgetId: (widgetId: string) => string;
13
+ export declare class VSXExtensionsWidget extends SourceTreeWidget implements BadgeWidget {
14
+ static ID: string;
15
+ static createWidget(parent: interfaces.Container, options: VSXExtensionsWidgetOptions): VSXExtensionsWidget;
16
+ protected _badge?: number;
17
+ protected onDidChangeBadgeEmitter: Emitter<void>;
18
+ protected readonly options: VSXExtensionsWidgetOptions;
19
+ protected readonly extensionsSource: VSXExtensionsSource;
20
+ protected init(): void;
21
+ get onDidChangeBadge(): Event<void>;
22
+ get badge(): number | undefined;
23
+ set badge(count: number | undefined);
24
+ protected computeTitle(): string;
25
+ protected resolveCount(): Promise<number | undefined>;
26
+ protected tapNode(node?: TreeNode): void;
27
+ protected handleDblClickEvent(): void;
28
+ protected renderTree(model: TreeModel): React.ReactNode;
29
+ }
30
30
  //# sourceMappingURL=vsx-extensions-widget.d.ts.map