@opensumi/ide-main-layout 3.9.1-next-1748425167.0 → 3.9.1-next-1748425792.0

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 (71) hide show
  1. package/README.md +31 -30
  2. package/lib/browser/accordion/accordion.service.d.ts +1 -9
  3. package/lib/browser/accordion/accordion.service.d.ts.map +1 -1
  4. package/lib/browser/accordion/accordion.service.js +33 -120
  5. package/lib/browser/accordion/accordion.service.js.map +1 -1
  6. package/lib/browser/accordion/accordion.view.d.ts.map +1 -1
  7. package/lib/browser/accordion/accordion.view.js +1 -4
  8. package/lib/browser/accordion/accordion.view.js.map +1 -1
  9. package/lib/browser/accordion/section.view.d.ts.map +1 -1
  10. package/lib/browser/accordion/section.view.js +1 -1
  11. package/lib/browser/accordion/section.view.js.map +1 -1
  12. package/lib/browser/accordion/styles.module.less +0 -61
  13. package/lib/browser/default-config.d.ts.map +1 -1
  14. package/lib/browser/default-config.js +6 -7
  15. package/lib/browser/default-config.js.map +1 -1
  16. package/lib/browser/drop-area/drop-area.d.ts +2 -3
  17. package/lib/browser/drop-area/drop-area.d.ts.map +1 -1
  18. package/lib/browser/drop-area/drop-area.js +5 -8
  19. package/lib/browser/drop-area/drop-area.js.map +1 -1
  20. package/lib/browser/index.d.ts.map +1 -1
  21. package/lib/browser/index.js.map +1 -1
  22. package/lib/browser/layout.service.d.ts +0 -3
  23. package/lib/browser/layout.service.d.ts.map +1 -1
  24. package/lib/browser/layout.service.js +78 -120
  25. package/lib/browser/layout.service.js.map +1 -1
  26. package/lib/browser/main-layout.contribution.d.ts +18 -2
  27. package/lib/browser/main-layout.contribution.d.ts.map +1 -1
  28. package/lib/browser/main-layout.contribution.js +131 -75
  29. package/lib/browser/main-layout.contribution.js.map +1 -1
  30. package/lib/browser/tabbar/bar.view.d.ts.map +1 -1
  31. package/lib/browser/tabbar/bar.view.js +10 -5
  32. package/lib/browser/tabbar/bar.view.js.map +1 -1
  33. package/lib/browser/tabbar/panel.view.js +1 -1
  34. package/lib/browser/tabbar/panel.view.js.map +1 -1
  35. package/lib/browser/tabbar/renderer.view.js +4 -4
  36. package/lib/browser/tabbar/renderer.view.js.map +1 -1
  37. package/lib/browser/tabbar/tabbar.service.d.ts +19 -8
  38. package/lib/browser/tabbar/tabbar.service.d.ts.map +1 -1
  39. package/lib/browser/tabbar/tabbar.service.js +146 -37
  40. package/lib/browser/tabbar/tabbar.service.js.map +1 -1
  41. package/lib/common/main-layout.definition.d.ts +3 -4
  42. package/lib/common/main-layout.definition.d.ts.map +1 -1
  43. package/lib/common/main-layout.definition.js +4 -5
  44. package/lib/common/main-layout.definition.js.map +1 -1
  45. package/package.json +8 -8
  46. package/src/browser/accordion/accordion.service.ts +35 -152
  47. package/src/browser/accordion/accordion.view.tsx +2 -4
  48. package/src/browser/accordion/section.view.tsx +1 -5
  49. package/src/browser/accordion/styles.module.less +0 -61
  50. package/src/browser/default-config.ts +7 -8
  51. package/src/browser/drop-area/drop-area.tsx +3 -6
  52. package/src/browser/index.ts +0 -1
  53. package/src/browser/layout.service.ts +66 -134
  54. package/src/browser/main-layout.contribution.ts +138 -93
  55. package/src/browser/tabbar/bar.view.tsx +15 -9
  56. package/src/browser/tabbar/panel.view.tsx +2 -2
  57. package/src/browser/tabbar/renderer.view.tsx +4 -4
  58. package/src/browser/tabbar/tabbar.service.ts +161 -52
  59. package/src/common/main-layout.definition.ts +4 -6
  60. package/lib/browser/command.d.ts +0 -29
  61. package/lib/browser/command.d.ts.map +0 -1
  62. package/lib/browser/command.js +0 -84
  63. package/lib/browser/command.js.map +0 -1
  64. package/lib/browser/tabbar/TABBAR_CONFIG_USAGE.md +0 -141
  65. package/lib/browser/tabbar/tabbar-behavior-handler.d.ts +0 -71
  66. package/lib/browser/tabbar/tabbar-behavior-handler.d.ts.map +0 -1
  67. package/lib/browser/tabbar/tabbar-behavior-handler.js +0 -210
  68. package/lib/browser/tabbar/tabbar-behavior-handler.js.map +0 -1
  69. package/src/browser/command.ts +0 -99
  70. package/src/browser/tabbar/TABBAR_CONFIG_USAGE.md +0 -141
  71. package/src/browser/tabbar/tabbar-behavior-handler.ts +0 -260
@@ -18,7 +18,7 @@ import {
18
18
  WithEventBus,
19
19
  slotRendererRegistry,
20
20
  } from '@opensumi/ide-core-browser';
21
- import { Layout, fixLayout } from '@opensumi/ide-core-browser/lib/components';
21
+ import { fixLayout } from '@opensumi/ide-core-browser/lib/components';
22
22
  import { LAYOUT_STATE, LayoutState } from '@opensumi/ide-core-browser/lib/layout/layout-state';
23
23
  import { ComponentRegistryInfo } from '@opensumi/ide-core-browser/lib/layout/layout.interface';
24
24
  import {
@@ -29,13 +29,11 @@ import {
29
29
  MenuId,
30
30
  } from '@opensumi/ide-core-browser/lib/menu/next';
31
31
  import { Deferred, getDebugLogger, isUndefined } from '@opensumi/ide-core-common';
32
- import { transaction } from '@opensumi/ide-monaco/lib/common/observable';
33
32
  import { ThemeChangedEvent } from '@opensumi/ide-theme';
34
33
 
35
34
  import {
36
- DROP_EXTEND_VIEW_CONTAINER,
37
- DROP_PANEL_CONTAINER,
38
- DROP_VIEW_CONTAINER,
35
+ DROP_BOTTOM_CONTAINER,
36
+ DROP_RIGHT_CONTAINER,
39
37
  IMainLayoutService,
40
38
  MainLayoutContribution,
41
39
  SUPPORT_ACCORDION_LOCATION,
@@ -47,21 +45,19 @@ import { TabbarService } from './tabbar/tabbar.service';
47
45
  import { TabBarHandler } from './tabbar-handler';
48
46
 
49
47
  const defaultLayoutState = {
50
- [SlotLocation.view]: {
48
+ [SlotLocation.left]: {
51
49
  currentId: undefined,
52
50
  size: undefined,
53
51
  },
54
- [SlotLocation.extendView]: {
52
+ [SlotLocation.right]: {
55
53
  // 依照下面的恢复逻辑,这里设置为 `''` 时,就不会恢复右侧的 TabBar 的状态(即选中相应的 viewContainer)
56
54
  currentId: '',
57
55
  size: undefined,
58
56
  },
59
- [SlotLocation.panel]: {
57
+ [SlotLocation.bottom]: {
60
58
  currentId: undefined,
61
59
  size: undefined,
62
60
  },
63
- // 存储 Container 的移动信息:containerId -> location
64
- containerLocations: {},
65
61
  };
66
62
 
67
63
  @Injectable()
@@ -158,7 +154,6 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
158
154
  currentId,
159
155
  size: service.prevSize,
160
156
  };
161
-
162
157
  this.layoutState.setState(LAYOUT_STATE.MAIN, this.state);
163
158
  }
164
159
 
@@ -179,86 +174,63 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
179
174
 
180
175
  restoreTabbarService = async (service: TabbarService) => {
181
176
  this.state = fixLayout(this.layoutState.getState(LAYOUT_STATE.MAIN, defaultLayoutState));
177
+
182
178
  const { currentId, size } = this.state[service.location] || {};
183
179
  service.prevSize = size;
184
-
185
- // 根据存储的容器位置信息恢复容器位置(drag & drop 移动过的)
186
- if (this.state.containerLocations) {
187
- for (const [containerId, targetLocation] of Object.entries(this.state.containerLocations)) {
188
- if (targetLocation === service.location && !this.isDropContainer(containerId)) {
189
- // 检查容器是否在其他 tabbar 中,如果是则移动到当前 tabbar
190
- const expectTabbar = this.findTabbarServiceByContainerId(containerId);
191
- if (expectTabbar && expectTabbar.location !== service.location) {
192
- this.moveContainerTo(containerId, service.location);
180
+ let defaultContainer = service.visibleContainers[0] && service.visibleContainers[0].options!.containerId;
181
+ const defaultPanels = this.appConfig.defaultPanels;
182
+ const restorePanel = defaultPanels && defaultPanels[service.location];
183
+ if (defaultPanels && restorePanel !== undefined) {
184
+ if (restorePanel) {
185
+ if (service.containersMap.has(restorePanel)) {
186
+ defaultContainer = restorePanel;
187
+ } else {
188
+ const componentInfo = this.componentRegistry.getComponentRegistryInfo(restorePanel);
189
+ if (
190
+ componentInfo &&
191
+ this.appConfig.layoutConfig[service.location]?.modules &&
192
+ ~this.appConfig.layoutConfig[service.location].modules.indexOf(restorePanel)
193
+ ) {
194
+ defaultContainer = componentInfo.options!.containerId;
193
195
  } else {
194
- // 清理无用的状态
195
- delete this.state.containerLocations[containerId];
196
- this.layoutState.setState(LAYOUT_STATE.MAIN, this.state);
196
+ this.logger.warn(`[defaultPanels] No \`${restorePanel}\` view found!`);
197
197
  }
198
198
  }
199
+ } else {
200
+ defaultContainer = '';
199
201
  }
200
202
  }
201
-
202
- const defaultContainer = this.getDefaultContainer(service);
203
- this.restoreContainerId(service, currentId, defaultContainer);
204
- };
205
-
206
- private getDefaultContainer(service: TabbarService): string | undefined {
207
- const defaultPanels = this.appConfig.defaultPanels;
208
- const defaultPanel = defaultPanels && defaultPanels[service.location];
209
-
210
- // 如果配置了默认面板,则使用配置的面板
211
- if (defaultPanels && defaultPanel !== undefined) {
212
- if (service.containersMap.has(defaultPanel)) {
213
- return defaultPanel;
214
- }
215
-
216
- const componentInfo = this.componentRegistry.getComponentRegistryInfo(defaultPanel);
217
- const isValidModule =
218
- componentInfo && this.appConfig.layoutConfig[service.location]?.modules?.includes(defaultPanel);
219
-
220
- if (isValidModule) {
221
- return componentInfo.options!.containerId;
222
- }
223
-
224
- this.logger.warn(`[defaultPanels] No \`${defaultPanel}\` view found!`);
225
- }
226
-
227
- // 获取第一个可见容器作为默认值
228
- return service.visibleContainers[0]?.options?.containerId;
229
- }
230
-
231
- private restoreContainerId(
232
- service: TabbarService,
233
- currentId: string | undefined,
234
- defaultContainer: string | undefined,
235
- ) {
203
+ /**
204
+ * ContainerId 存在三种值类型,对应的处理模式如下:
205
+ * 1. undefined: 采用首个注册的容器作为当前 containerId
206
+ * 2. string: 非 drop container 直接使用该 containerId 作为当前 containerId
207
+ * 3. '': 直接清空当前 containerId,不展开相应的 viewContainer
208
+ */
236
209
  if (isUndefined(currentId)) {
237
- // 未指定 currentId 时,使用默认容器或第一个注册的容器
238
210
  if (isUndefined(defaultContainer)) {
211
+ // 默认采用首个注册的容器作为当前 containerId
239
212
  service.updateNextContainerId();
240
213
  } else {
241
214
  service.updateCurrentContainerId(defaultContainer);
242
215
  }
243
- return;
244
- }
245
-
246
- if (currentId && !this.isDropContainer(currentId)) {
216
+ } else if (currentId && !this.isDropContainer(currentId)) {
247
217
  if (service.containersMap.has(currentId)) {
248
218
  service.updateCurrentContainerId(currentId);
249
- return;
219
+ } else {
220
+ // 如果在别的 tabbar 中存在该 containerId,则将其移动到当前 tabbar
221
+ if (this.findTabbarServiceByContainerId(currentId)) {
222
+ this.moveContainerTo(currentId, service.location);
223
+ service.updateCurrentContainerId(currentId);
224
+ } else {
225
+ service.updateCurrentContainerId(defaultContainer);
226
+ // 等待后续新容器注册时,更新当前的 containerId
227
+ service.updateNextContainerId(currentId);
228
+ }
250
229
  }
251
-
252
- // 如果当前 containerId 不存在,则使用默认容器
253
- service.updateCurrentContainerId(defaultContainer || '');
254
- service.updateNextContainerId(currentId);
255
- return;
256
- }
257
-
258
- if (currentId === '' || this.isDropContainer(currentId)) {
230
+ } else if (currentId === '' || this.isDropContainer(currentId)) {
259
231
  service.updateCurrentContainerId('');
260
232
  }
261
- }
233
+ };
262
234
 
263
235
  findTabbarServiceByContainerId(containerId: string): TabbarService | undefined {
264
236
  let tabbarService: undefined | TabbarService;
@@ -284,7 +256,7 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
284
256
  this.logger.error(`cannot find container: ${containerId}`);
285
257
  return;
286
258
  }
287
- if (container.options?.draggable === false) {
259
+ if (!container.options?.draggable) {
288
260
  this.logger.warn(`container: ${containerId} is not draggable`);
289
261
  return;
290
262
  }
@@ -299,59 +271,33 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
299
271
  toTabbar.dynamicAddContainer(containerId, container);
300
272
  const newHandler = this.injector.get(TabBarHandler, [containerId, this.getTabbarService(toTabbar.location)]);
301
273
  this.handleMap.set(containerId, newHandler!);
302
-
303
- // 更新容器位置信息
304
- if (!this.state.containerLocations) {
305
- this.state.containerLocations = {};
306
- }
307
- this.state.containerLocations[containerId] = to;
308
- // this.layoutState.setState(LAYOUT_STATE.MAIN, this.state);
309
274
  }
310
275
 
311
276
  showDropAreaForContainer(containerId: string): void {
312
277
  const tabbarService = this.findTabbarServiceByContainerId(containerId);
313
- const panelService = this.tabbarServices.get(SlotLocation.panel);
314
- const extendViewService = this.tabbarServices.get(SlotLocation.extendView);
315
- const viewService = this.tabbarServices.get(SlotLocation.view);
278
+ const bottomService = this.tabbarServices.get('bottom');
279
+ const rightService = this.tabbarServices.get('right');
316
280
  if (!tabbarService) {
317
281
  this.logger.error(`cannot find container: ${containerId}`);
318
282
  return;
319
283
  }
320
- const otherServices = {
321
- [SlotLocation.extendView]: [panelService, viewService],
322
- [SlotLocation.panel]: [extendViewService, viewService],
323
- [SlotLocation.view]: [panelService, extendViewService],
324
- };
325
-
326
- const dropContainers = {
327
- [SlotLocation.panel]: DROP_PANEL_CONTAINER,
328
- [SlotLocation.extendView]: DROP_EXTEND_VIEW_CONTAINER,
329
- [SlotLocation.view]: DROP_VIEW_CONTAINER,
330
- };
331
-
332
- transaction((tx) => {
333
- otherServices[tabbarService?.location]?.forEach((service) => {
334
- service?.updateCurrentContainerId(dropContainers[service?.location], tx);
335
- });
336
- });
284
+ if (tabbarService?.location === 'right') {
285
+ bottomService?.updateCurrentContainerId(DROP_BOTTOM_CONTAINER);
286
+ }
287
+ if (tabbarService?.location === 'bottom') {
288
+ rightService?.updateCurrentContainerId(DROP_RIGHT_CONTAINER);
289
+ }
337
290
  }
338
291
 
339
292
  hideDropArea(): void {
340
- const panelService = this.tabbarServices.get(SlotLocation.panel);
341
- const extendViewService = this.tabbarServices.get(SlotLocation.extendView);
342
- const viewService = this.tabbarServices.get(SlotLocation.view);
343
-
344
- transaction((tx) => {
345
- if (panelService?.currentContainerId.get() === DROP_PANEL_CONTAINER) {
346
- panelService.updateCurrentContainerId(panelService.previousContainerId || '', tx);
347
- }
348
- if (extendViewService?.currentContainerId.get() === DROP_EXTEND_VIEW_CONTAINER) {
349
- extendViewService.updateCurrentContainerId(extendViewService.previousContainerId || '', tx);
350
- }
351
- if (viewService?.currentContainerId.get() === DROP_VIEW_CONTAINER) {
352
- viewService.updateCurrentContainerId(viewService.previousContainerId || '', tx);
353
- }
354
- });
293
+ const bottomService = this.tabbarServices.get('bottom');
294
+ const rightService = this.tabbarServices.get('right');
295
+ if (bottomService?.currentContainerId.get() === DROP_BOTTOM_CONTAINER) {
296
+ bottomService.updateCurrentContainerId(bottomService.previousContainerId || '');
297
+ }
298
+ if (rightService?.currentContainerId.get() === DROP_RIGHT_CONTAINER) {
299
+ rightService.updateCurrentContainerId(rightService.previousContainerId || '');
300
+ }
355
301
  }
356
302
 
357
303
  isVisible(location: string) {
@@ -390,7 +336,7 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
390
336
  }
391
337
 
392
338
  private isDropContainer(containerId: string): boolean {
393
- return [DROP_PANEL_CONTAINER, DROP_EXTEND_VIEW_CONTAINER, DROP_VIEW_CONTAINER].includes(containerId);
339
+ return [DROP_BOTTOM_CONTAINER, DROP_RIGHT_CONTAINER].includes(containerId);
394
340
  }
395
341
 
396
342
  private findNonDropContainerId(tabbarService: TabbarService): string {
@@ -436,7 +382,7 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
436
382
  });
437
383
  const debouncedStoreState = debounce(() => this.storeState(service, service.currentContainerId.get()), 100);
438
384
  service.addDispose(service.onSizeChange(debouncedStoreState));
439
- if (location === SlotLocation.panel) {
385
+ if (location === SlotLocation.bottom) {
440
386
  // use this getter's side effect to set bottomExpanded contextKey
441
387
  const debouncedUpdate = debounce(() => void this.bottomExpanded, 100);
442
388
  service.addDispose(service.onSizeChange(() => debouncedUpdate));
@@ -517,7 +463,6 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
517
463
  if (Fc) {
518
464
  this.debug.warn('collectTabbarComponent api warning: Please move react component into options.component!');
519
465
  }
520
- side = this.mapSideToLocation(side);
521
466
  if (options.hideIfEmpty && !views.length && !options.component) {
522
467
  this.holdTabbarComponent.set(options.containerId, { views, options, side });
523
468
  if (this.tabbarUpdateSet.has(options.containerId)) {
@@ -550,19 +495,6 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
550
495
  return options.containerId;
551
496
  }
552
497
 
553
- private mapSideToLocation(side: string): SlotLocation {
554
- switch (side) {
555
- case 'left':
556
- return SlotLocation.view;
557
- case 'right':
558
- return SlotLocation.extendView;
559
- case 'bottom':
560
- return SlotLocation.panel;
561
- default:
562
- return side;
563
- }
564
- }
565
-
566
498
  getViewAccordionService(viewId: string) {
567
499
  const containerId = this.viewToContainerMap.get(viewId);
568
500
  if (!containerId) {
@@ -708,7 +640,7 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
708
640
 
709
641
  // TODO 这样很耦合,不能做到tab renderer自由拆分
710
642
  expandBottom(expand: boolean): void {
711
- const tabbarService = this.getTabbarService(SlotLocation.panel);
643
+ const tabbarService = this.getTabbarService(SlotLocation.bottom);
712
644
  if (!tabbarService.currentContainerId.get()) {
713
645
  tabbarService.updateCurrentContainerId(
714
646
  tabbarService.currentContainerId.get() ||
@@ -721,7 +653,7 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
721
653
  }
722
654
 
723
655
  get bottomExpanded(): boolean {
724
- const tabbarService = this.getTabbarService(SlotLocation.panel);
656
+ const tabbarService = this.getTabbarService(SlotLocation.bottom);
725
657
  this.contextKeyService.createKey('bottomFullExpanded', tabbarService.isExpanded);
726
658
  return tabbarService.isExpanded;
727
659
  }
@@ -39,34 +39,85 @@ import {
39
39
  MenuId,
40
40
  } from '@opensumi/ide-core-browser/lib/menu/next';
41
41
  import { ContributionProvider, Domain, IEventBus, WithEventBus, localize } from '@opensumi/ide-core-common';
42
- import { CommandContribution, CommandRegistry, CommandService } from '@opensumi/ide-core-common/lib/command';
42
+ import { Command, CommandContribution, CommandRegistry, CommandService } from '@opensumi/ide-core-common/lib/command';
43
43
 
44
- import { DROP_EXTEND_VIEW_CONTAINER, DROP_PANEL_CONTAINER, DROP_VIEW_CONTAINER, IMainLayoutService } from '../common';
44
+ import { DROP_BOTTOM_CONTAINER, DROP_RIGHT_CONTAINER, IMainLayoutService } from '../common';
45
45
 
46
- import {
47
- EXPAND_BOTTOM_PANEL,
48
- EXPAND_PANEL_COMMAND,
49
- IS_VISIBLE_BOTTOM_PANEL_COMMAND,
50
- IS_VISIBLE_EXTEND_VIEW_COMMAND,
51
- IS_VISIBLE_LEFT_PANEL_COMMAND,
52
- IS_VISIBLE_PANEL_COMMAND,
53
- IS_VISIBLE_RIGHT_PANEL_COMMAND,
54
- IS_VISIBLE_VIEW_COMMAND,
55
- RETRACT_BOTTOM_PANEL,
56
- RETRACT_PANEL_COMMAND,
57
- TOGGLE_BOTTOM_PANEL_COMMAND,
58
- TOGGLE_EXTEND_VIEW_COMMAND,
59
- TOGGLE_LEFT_PANEL_COMMAND,
60
- TOGGLE_PANEL_COMMAND,
61
- TOGGLE_RIGHT_PANEL_COMMAND,
62
- TOGGLE_VIEW_COMMAND,
63
- WORKBENCH_ACTION_CLOSEPANEL,
64
- WORKBENCH_ACTION_CLOSESIDECAR,
65
- } from './command';
66
- import { ExtendViewDropArea, PanelDropArea, ViewDropArea } from './drop-area/drop-area';
46
+ import { BottomDropArea, RightDropArea } from './drop-area/drop-area';
67
47
  import { ViewQuickOpenHandler } from './quick-open-view';
68
48
  import { BottomTabRenderer, LeftTabRenderer, RightTabRenderer } from './tabbar/renderer.view';
69
49
 
50
+ // NOTE 左右侧面板的展开、折叠命令请使用组合命令 activity-bar.left.toggle,layout命令仅做折叠展开,不处理tab激活逻辑
51
+ export const HIDE_LEFT_PANEL_COMMAND: Command = {
52
+ id: 'main-layout.left-panel.hide',
53
+ label: '%main-layout.left-panel.hide%',
54
+ };
55
+
56
+ export const WORKBENCH_ACTION_CLOSESIDECAR: Command = {
57
+ id: 'workbench.action.closeSidebar',
58
+ label: '%main-layout.sidebar.hide%',
59
+ };
60
+
61
+ export const SHOW_LEFT_PANEL_COMMAND: Command = {
62
+ id: 'main-layout.left-panel.show',
63
+ label: '%main-layout.left-panel.show%',
64
+ };
65
+ export const TOGGLE_LEFT_PANEL_COMMAND: MenuCommandDesc = {
66
+ id: 'main-layout.left-panel.toggle',
67
+ label: '%main-layout.left-panel.toggle%',
68
+ };
69
+ export const HIDE_RIGHT_PANEL_COMMAND: Command = {
70
+ id: 'main-layout.right-panel.hide',
71
+ label: '%main-layout.right-panel.hide%',
72
+ };
73
+ export const SHOW_RIGHT_PANEL_COMMAND: Command = {
74
+ id: 'main-layout.right-panel.show',
75
+ label: '%main-layout.right-panel.show%',
76
+ };
77
+ export const TOGGLE_RIGHT_PANEL_COMMAND: MenuCommandDesc = {
78
+ id: 'main-layout.right-panel.toggle',
79
+ label: '%main-layout.right-panel.toggle%',
80
+ };
81
+
82
+ export const HIDE_BOTTOM_PANEL_COMMAND: Command = {
83
+ id: 'main-layout.bottom-panel.hide',
84
+ label: '%main-layout.bottom-panel.hide%',
85
+ };
86
+
87
+ export const WORKBENCH_ACTION_CLOSEPANEL: Command = {
88
+ id: 'workbench.action.closePanel',
89
+ delegate: HIDE_BOTTOM_PANEL_COMMAND.id,
90
+ };
91
+
92
+ export const SHOW_BOTTOM_PANEL_COMMAND: Command = {
93
+ id: 'main-layout.bottom-panel.show',
94
+ label: '%main-layout.bottom-panel.show%',
95
+ };
96
+ export const TOGGLE_BOTTOM_PANEL_COMMAND: Command = {
97
+ id: 'main-layout.bottom-panel.toggle',
98
+ iconClass: getIcon('minus'),
99
+ label: '%layout.tabbar.toggle%',
100
+ };
101
+ export const IS_VISIBLE_BOTTOM_PANEL_COMMAND: Command = {
102
+ id: 'main-layout.bottom-panel.is-visible',
103
+ };
104
+ export const IS_VISIBLE_LEFT_PANEL_COMMAND: Command = {
105
+ id: 'main-layout.left-panel.is-visible',
106
+ };
107
+ export const IS_VISIBLE_RIGHT_PANEL_COMMAND: Command = {
108
+ id: 'main-layout.right-panel.is-visible',
109
+ };
110
+ export const EXPAND_BOTTOM_PANEL: Command = {
111
+ id: 'main-layout.bottom-panel.expand',
112
+ label: '%layout.tabbar.expand%',
113
+ iconClass: getIcon('expand'),
114
+ };
115
+ export const RETRACT_BOTTOM_PANEL: Command = {
116
+ id: 'main-layout.bottom-panel.retract',
117
+ label: '%layout.tabbar.retract%',
118
+ iconClass: getIcon('shrink'),
119
+ };
120
+
70
121
  @Domain(
71
122
  CommandContribution,
72
123
  ClientAppContribution,
@@ -145,20 +196,15 @@ export class MainLayoutModuleContribution
145
196
  }
146
197
 
147
198
  registerComponent(registry: ComponentRegistry): void {
148
- registry.register(DROP_EXTEND_VIEW_CONTAINER, [], {
149
- component: ExtendViewDropArea,
150
- hideTab: true,
151
- containerId: DROP_EXTEND_VIEW_CONTAINER,
152
- });
153
- registry.register(DROP_PANEL_CONTAINER, [], {
154
- component: PanelDropArea,
199
+ registry.register(DROP_RIGHT_CONTAINER, [], {
200
+ component: RightDropArea,
155
201
  hideTab: true,
156
- containerId: DROP_PANEL_CONTAINER,
202
+ containerId: DROP_RIGHT_CONTAINER,
157
203
  });
158
- registry.register(DROP_VIEW_CONTAINER, [], {
159
- component: ViewDropArea,
204
+ registry.register(DROP_BOTTOM_CONTAINER, [], {
205
+ component: BottomDropArea,
160
206
  hideTab: true,
161
- containerId: DROP_VIEW_CONTAINER,
207
+ containerId: DROP_BOTTOM_CONTAINER,
162
208
  });
163
209
  }
164
210
 
@@ -171,75 +217,78 @@ export class MainLayoutModuleContribution
171
217
  }
172
218
 
173
219
  registerRenderer(registry: SlotRendererRegistry) {
174
- registry.registerSlotRenderer(SlotLocation.extendView, RightTabRenderer, {
175
- isLatter: true,
176
- supportedActions: {
177
- accordion: true,
220
+ registry.registerSlotRenderer(SlotLocation.right, RightTabRenderer);
221
+ registry.registerSlotRenderer(SlotLocation.left, LeftTabRenderer);
222
+ registry.registerSlotRenderer(SlotLocation.bottom, BottomTabRenderer);
223
+ }
224
+
225
+ registerCommands(commands: CommandRegistry): void {
226
+ // @deprecated
227
+ commands.registerCommand(HIDE_LEFT_PANEL_COMMAND, {
228
+ execute: () => {
229
+ this.mainLayoutService.toggleSlot(SlotLocation.left, false);
178
230
  },
179
231
  });
180
- registry.registerSlotRenderer(SlotLocation.view, LeftTabRenderer, {
181
- supportedActions: {
182
- accordion: true,
232
+ // @deprecated
233
+ commands.registerCommand(SHOW_LEFT_PANEL_COMMAND, {
234
+ execute: (size?: number) => {
235
+ this.mainLayoutService.toggleSlot(SlotLocation.left, true, size);
183
236
  },
184
237
  });
185
- registry.registerSlotRenderer(SlotLocation.panel, BottomTabRenderer, {
186
- isLatter: true,
187
- supportedActions: {
188
- expand: true,
189
- toggle: true,
238
+ commands.registerCommand(TOGGLE_LEFT_PANEL_COMMAND, {
239
+ execute: (show?: boolean, size?: number) => {
240
+ this.mainLayoutService.toggleSlot(SlotLocation.left, show, size);
190
241
  },
191
242
  });
192
- }
193
243
 
194
- registerCommands(commands: CommandRegistry): void {
195
- commands.registerCommand(TOGGLE_VIEW_COMMAND, {
196
- execute: (show?: boolean, size?: number) => {
197
- this.mainLayoutService.toggleSlot(SlotLocation.view, show, size);
244
+ // @deprecated
245
+ commands.registerCommand(HIDE_RIGHT_PANEL_COMMAND, {
246
+ execute: () => {
247
+ this.mainLayoutService.toggleSlot(SlotLocation.right, false);
198
248
  },
199
249
  });
200
- commands.registerCommand(TOGGLE_EXTEND_VIEW_COMMAND, {
201
- execute: (show?: boolean, size?: number) => {
202
- this.mainLayoutService.toggleSlot(SlotLocation.extendView, show, size);
250
+ // @deprecated
251
+ commands.registerCommand(SHOW_RIGHT_PANEL_COMMAND, {
252
+ execute: (size?: number) => {
253
+ this.mainLayoutService.toggleSlot(SlotLocation.right, true, size);
203
254
  },
204
255
  });
205
- commands.registerCommand(TOGGLE_PANEL_COMMAND, {
256
+ commands.registerCommand(TOGGLE_RIGHT_PANEL_COMMAND, {
206
257
  execute: (show?: boolean, size?: number) => {
207
- this.mainLayoutService.toggleSlot(SlotLocation.panel, show, size);
258
+ this.mainLayoutService.toggleSlot(SlotLocation.right, show, size);
208
259
  },
209
260
  });
210
- commands.registerCommand(IS_VISIBLE_VIEW_COMMAND, {
211
- execute: () => this.mainLayoutService.isVisible(SlotLocation.view),
212
- });
213
- commands.registerCommand(IS_VISIBLE_EXTEND_VIEW_COMMAND, {
214
- execute: () => this.mainLayoutService.isVisible(SlotLocation.extendView),
215
- });
216
- commands.registerCommand(IS_VISIBLE_PANEL_COMMAND, {
217
- execute: () => this.mainLayoutService.isVisible(SlotLocation.panel),
218
- });
219
- // TODO: 下个版本废弃掉
220
- commands.registerCommand(TOGGLE_LEFT_PANEL_COMMAND);
221
- commands.registerCommand(TOGGLE_RIGHT_PANEL_COMMAND);
222
- commands.registerCommand(TOGGLE_BOTTOM_PANEL_COMMAND);
223
- commands.registerCommand(EXPAND_BOTTOM_PANEL);
224
- commands.registerCommand(RETRACT_BOTTOM_PANEL);
225
- commands.registerCommand(IS_VISIBLE_LEFT_PANEL_COMMAND);
226
- commands.registerCommand(IS_VISIBLE_RIGHT_PANEL_COMMAND);
227
- commands.registerCommand(IS_VISIBLE_BOTTOM_PANEL_COMMAND);
228
261
 
229
262
  commands.registerCommand(WORKBENCH_ACTION_CLOSESIDECAR, {
230
263
  execute: () =>
231
264
  Promise.all([
232
- this.mainLayoutService.toggleSlot(SlotLocation.view, false),
233
- this.mainLayoutService.toggleSlot(SlotLocation.extendView, false),
265
+ this.mainLayoutService.toggleSlot(SlotLocation.left, false),
266
+ this.mainLayoutService.toggleSlot(SlotLocation.right, false),
234
267
  ]),
235
268
  });
236
269
 
237
- commands.registerCommand(WORKBENCH_ACTION_CLOSEPANEL, {
270
+ commands.registerCommand(SHOW_BOTTOM_PANEL_COMMAND, {
238
271
  execute: () => {
239
- this.mainLayoutService.toggleSlot(SlotLocation.panel, false);
272
+ this.mainLayoutService.toggleSlot(SlotLocation.bottom, true);
240
273
  },
241
274
  });
242
275
 
276
+ commands.registerCommand(HIDE_BOTTOM_PANEL_COMMAND, {
277
+ execute: () => {
278
+ this.mainLayoutService.toggleSlot(SlotLocation.bottom, false);
279
+ },
280
+ });
281
+ commands.registerCommand(WORKBENCH_ACTION_CLOSEPANEL);
282
+ commands.registerCommand(IS_VISIBLE_BOTTOM_PANEL_COMMAND, {
283
+ execute: () => this.mainLayoutService.getTabbarService('bottom').currentContainerId.get() !== '',
284
+ });
285
+ commands.registerCommand(IS_VISIBLE_LEFT_PANEL_COMMAND, {
286
+ execute: () => this.mainLayoutService.isVisible(SlotLocation.left),
287
+ });
288
+ commands.registerCommand(IS_VISIBLE_RIGHT_PANEL_COMMAND, {
289
+ execute: () => this.mainLayoutService.isVisible(SlotLocation.left),
290
+ });
291
+
243
292
  commands.registerCommand(
244
293
  {
245
294
  id: 'view.outward.right-panel.hide',
@@ -310,14 +359,14 @@ export class MainLayoutModuleContribution
310
359
  });
311
360
 
312
361
  Object.entries({
313
- [SlotLocation.view]: [
362
+ [SlotLocation.left]: [
314
363
  EXPLORER_CONTAINER_ID,
315
364
  SEARCH_CONTAINER_ID,
316
365
  SCM_CONTAINER_ID,
317
366
  DEBUG_CONTAINER_ID,
318
367
  EXTENSION_CONTAINER_ID,
319
368
  ],
320
- [SlotLocation.panel]: [
369
+ [SlotLocation.bottom]: [
321
370
  MARKER_CONTAINER_ID,
322
371
  OUTPUT_CONTAINER_ID,
323
372
  DEBUG_CONSOLE_CONTAINER_ID,
@@ -347,24 +396,24 @@ export class MainLayoutModuleContribution
347
396
  });
348
397
 
349
398
  menus.registerMenuItem(MenuId.MenubarViewMenu, {
350
- command: TOGGLE_VIEW_COMMAND,
399
+ command: TOGGLE_LEFT_PANEL_COMMAND,
351
400
  group: '5_panel',
352
401
  });
353
402
  menus.registerMenuItem(MenuId.MenubarViewMenu, {
354
- command: TOGGLE_EXTEND_VIEW_COMMAND,
403
+ command: TOGGLE_RIGHT_PANEL_COMMAND,
355
404
  group: '5_panel',
356
405
  });
357
406
  menus.registerMenuItem(MenuId.MenubarViewMenu, {
358
- command: TOGGLE_PANEL_COMMAND as MenuCommandDesc,
407
+ command: TOGGLE_BOTTOM_PANEL_COMMAND as MenuCommandDesc,
359
408
  group: '5_panel',
360
409
  });
361
410
  menus.registerMenuItem(MenuId.MenubarViewMenu, {
362
- command: EXPAND_PANEL_COMMAND as MenuCommandDesc,
411
+ command: EXPAND_BOTTOM_PANEL as MenuCommandDesc,
363
412
  group: '5_panel',
364
413
  when: '!bottomFullExpanded',
365
414
  });
366
415
  menus.registerMenuItem(MenuId.MenubarViewMenu, {
367
- command: RETRACT_PANEL_COMMAND as MenuCommandDesc,
416
+ command: RETRACT_BOTTOM_PANEL as MenuCommandDesc,
368
417
  group: '5_panel',
369
418
  when: 'bottomFullExpanded',
370
419
  });
@@ -382,24 +431,20 @@ export class MainLayoutModuleContribution
382
431
  protected registerSideToggleKey() {
383
432
  this.keybindingRegistry.registerKeybinding({
384
433
  keybinding: 'ctrlcmd+b',
385
- command: TOGGLE_VIEW_COMMAND.id,
386
- });
387
- this.keybindingRegistry.registerKeybinding({
388
- keybinding: 'ctrlcmd+alt+b',
389
- command: TOGGLE_EXTEND_VIEW_COMMAND.id,
434
+ command: TOGGLE_LEFT_PANEL_COMMAND.id,
390
435
  });
391
436
  this.keybindingRegistry.registerKeybinding({
392
437
  keybinding: 'ctrlcmd+j',
393
- command: TOGGLE_PANEL_COMMAND.id,
438
+ command: TOGGLE_BOTTOM_PANEL_COMMAND.id,
394
439
  });
395
440
  this.keybindingRegistry.registerKeybinding({
396
441
  keybinding: 'ctrlcmd+shift+j',
397
- command: EXPAND_PANEL_COMMAND.id,
442
+ command: EXPAND_BOTTOM_PANEL.id,
398
443
  when: '!bottomFullExpanded',
399
444
  });
400
445
  this.keybindingRegistry.registerKeybinding({
401
446
  keybinding: 'ctrlcmd+shift+j',
402
- command: RETRACT_PANEL_COMMAND.id,
447
+ command: RETRACT_BOTTOM_PANEL.id,
403
448
  when: 'bottomFullExpanded',
404
449
  });
405
450
  }