@opensumi/ide-design 2.27.3-rc-1714116491.0 → 2.27.3-rc-1714982362.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 (65) hide show
  1. package/lib/browser/design.contribution.d.ts +4 -1
  2. package/lib/browser/design.contribution.d.ts.map +1 -1
  3. package/lib/browser/design.contribution.js +23 -1
  4. package/lib/browser/design.contribution.js.map +1 -1
  5. package/lib/browser/index.d.ts.map +1 -1
  6. package/lib/browser/index.js +2 -1
  7. package/lib/browser/index.js.map +1 -1
  8. package/lib/browser/menu-bar/logo.svg +1 -0
  9. package/lib/browser/menu-bar/menu-bar.contribution.d.ts +8 -0
  10. package/lib/browser/menu-bar/menu-bar.contribution.d.ts.map +1 -0
  11. package/lib/browser/menu-bar/menu-bar.contribution.js +45 -0
  12. package/lib/browser/menu-bar/menu-bar.contribution.js.map +1 -0
  13. package/lib/browser/menu-bar/menu-bar.module.less +107 -0
  14. package/lib/browser/menu-bar/menu-bar.view.d.ts +3 -0
  15. package/lib/browser/menu-bar/menu-bar.view.d.ts.map +1 -0
  16. package/lib/browser/menu-bar/menu-bar.view.js +110 -0
  17. package/lib/browser/menu-bar/menu-bar.view.js.map +1 -0
  18. package/lib/browser/override/editor-tab.service.js +3 -3
  19. package/lib/browser/override/editor-tab.service.js.map +1 -1
  20. package/lib/browser/override/menu.service.js +10 -10
  21. package/lib/browser/override/menu.service.js.map +1 -1
  22. package/lib/browser/style/design.module.less +190 -38
  23. package/lib/browser/style/global.less +22 -4
  24. package/lib/browser/style/images/design-background-dark.png +0 -0
  25. package/lib/browser/style/images/design-background-light.png +0 -0
  26. package/lib/browser/theme/default-theme.d.ts +1 -0
  27. package/lib/browser/theme/default-theme.d.ts.map +1 -1
  28. package/lib/browser/theme/default-theme.js +1 -0
  29. package/lib/browser/theme/default-theme.js.map +1 -1
  30. package/lib/browser/theme/light-theme.d.ts +1 -0
  31. package/lib/browser/theme/light-theme.d.ts.map +1 -1
  32. package/lib/browser/theme/light-theme.js +1 -0
  33. package/lib/browser/theme/light-theme.js.map +1 -1
  34. package/lib/common/constants.d.ts +4 -0
  35. package/lib/common/constants.d.ts.map +1 -0
  36. package/lib/common/constants.js +7 -0
  37. package/lib/common/constants.js.map +1 -0
  38. package/lib/common/index.d.ts +2 -0
  39. package/lib/common/index.d.ts.map +1 -0
  40. package/lib/common/index.js +5 -0
  41. package/lib/common/index.js.map +1 -0
  42. package/lib/index.d.ts +1 -0
  43. package/lib/index.d.ts.map +1 -1
  44. package/lib/index.js +3 -0
  45. package/lib/index.js.map +1 -1
  46. package/package.json +6 -6
  47. package/src/browser/design.contribution.ts +31 -1
  48. package/src/browser/index.ts +2 -1
  49. package/src/browser/menu-bar/logo.svg +1 -0
  50. package/src/browser/menu-bar/menu-bar.contribution.tsx +48 -0
  51. package/src/browser/menu-bar/menu-bar.module.less +107 -0
  52. package/src/browser/menu-bar/menu-bar.view.tsx +152 -0
  53. package/src/browser/override/editor-tab.service.tsx +1 -1
  54. package/src/browser/override/menu.service.tsx +1 -1
  55. package/src/browser/style/design.module.less +190 -38
  56. package/src/browser/style/global.less +22 -4
  57. package/src/browser/style/images/design-background-dark.png +0 -0
  58. package/src/browser/style/images/design-background-light.png +0 -0
  59. package/src/browser/theme/default-theme.ts +1 -0
  60. package/src/browser/theme/light-theme.ts +1 -0
  61. package/src/common/constants.ts +3 -0
  62. package/src/common/index.ts +1 -0
  63. package/src/index.ts +1 -0
  64. package/lib/browser/override/override.module.less +0 -135
  65. package/src/browser/override/override.module.less +0 -135
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/ide-design",
3
- "version": "2.27.3-rc-1714116491.0",
3
+ "version": "2.27.3-rc-1714982362.0",
4
4
  "files": [
5
5
  "lib",
6
6
  "src"
@@ -19,12 +19,12 @@
19
19
  "url": "git@github.com:opensumi/core.git"
20
20
  },
21
21
  "dependencies": {
22
- "@opensumi/ide-core-common": "2.27.3-rc-1714116491.0",
23
- "@opensumi/ide-core-node": "2.27.3-rc-1714116491.0"
22
+ "@opensumi/ide-core-common": "2.27.3-rc-1714982362.0",
23
+ "@opensumi/ide-core-node": "2.27.3-rc-1714982362.0"
24
24
  },
25
25
  "devDependencies": {
26
- "@opensumi/ide-core-browser": "2.27.3-rc-1714116491.0",
27
- "@opensumi/ide-dev-tool": "2.27.3-rc-1714116491.0"
26
+ "@opensumi/ide-core-browser": "2.27.3-rc-1714982362.0",
27
+ "@opensumi/ide-dev-tool": "2.27.3-rc-1714982362.0"
28
28
  },
29
- "gitHead": "b3e24dca0866b038e5b93fb14119f30e947f4710"
29
+ "gitHead": "197b8ef9917d764baced87ea93e800b1ce43ac82"
30
30
  }
@@ -1,15 +1,20 @@
1
1
  import { Autowired, Injectable } from '@opensumi/di';
2
2
  import {
3
+ AppConfig,
3
4
  ClientAppContribution,
5
+ ComponentRegistryImpl,
4
6
  Domain,
5
7
  SlotLocation,
6
8
  SlotRendererContribution,
7
9
  SlotRendererRegistry,
8
10
  } from '@opensumi/ide-core-browser';
11
+ import { DesignLayoutConfig, LayoutViewSizeConfig } from '@opensumi/ide-core-browser/lib/layout/constants';
9
12
  import { Schemes } from '@opensumi/ide-core-common';
10
13
  import { IFileServiceClient } from '@opensumi/ide-file-service';
11
14
  import { FileServiceClient } from '@opensumi/ide-file-service/lib/browser/file-service-client';
12
15
 
16
+ import { DESIGN_MENUBAR_CONTAINER_VIEW_ID } from '../common/constants';
17
+
13
18
  import { DesignBottomTabRenderer, DesignLeftTabRenderer, DesignRightTabRenderer } from './layout/tabbar.view';
14
19
  import { DesignThemeFileSystemProvider } from './theme/file-system.provider';
15
20
 
@@ -22,8 +27,33 @@ export class DesignCoreContribution implements ClientAppContribution, SlotRender
22
27
  @Autowired()
23
28
  private readonly designThemeFileSystemProvider: DesignThemeFileSystemProvider;
24
29
 
25
- async initialize() {
30
+ @Autowired(AppConfig)
31
+ private appConfig: AppConfig;
32
+
33
+ @Autowired(LayoutViewSizeConfig)
34
+ private layoutViewSize: LayoutViewSizeConfig;
35
+
36
+ @Autowired(DesignLayoutConfig)
37
+ private designLayoutConfig: DesignLayoutConfig;
38
+
39
+ initialize() {
40
+ const { useMenubarView } = this.designLayoutConfig;
41
+
26
42
  this.fileSystem.registerProvider(Schemes.design, this.designThemeFileSystemProvider);
43
+
44
+ if (useMenubarView) {
45
+ this.layoutViewSize.setMenubarHeight(48);
46
+
47
+ ComponentRegistryImpl.replaceLayoutModule(
48
+ this.appConfig.layoutConfig,
49
+ SlotLocation.top,
50
+ DESIGN_MENUBAR_CONTAINER_VIEW_ID,
51
+ );
52
+ }
53
+
54
+ this.layoutViewSize.setEditorTabsHeight(36);
55
+ this.layoutViewSize.setStatusBarHeight(36);
56
+ this.layoutViewSize.setAccordionHeaderSizeHeight(36);
27
57
  }
28
58
 
29
59
  registerRenderer(registry: SlotRendererRegistry): void {
@@ -15,6 +15,7 @@ import { IThemeContribution, IThemeService, IThemeStore } from '@opensumi/ide-th
15
15
  import { ThemeStore } from '@opensumi/ide-theme/lib/browser/theme-store';
16
16
 
17
17
  import { DesignCoreContribution } from './design.contribution';
18
+ import { DesignMenuBarContribution } from './menu-bar/menu-bar.contribution';
18
19
  import { DesignEditorTabService } from './override/editor-tab.service';
19
20
  import { DesignBrowserCtxMenuService } from './override/menu.service';
20
21
  import { DesignSplitPanelService } from './override/split-panel.service';
@@ -24,7 +25,7 @@ import lightTheme from './theme/light-theme';
24
25
 
25
26
  @Injectable()
26
27
  export class DesignModule extends BrowserModule {
27
- providers: Provider[] = [DesignCoreContribution];
28
+ providers: Provider[] = [DesignMenuBarContribution, DesignCoreContribution];
28
29
 
29
30
  preferences = (injector: Injector) => {
30
31
  import('./style/global.less');
@@ -0,0 +1 @@
1
+ <svg id="layer_1" data-name="layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 86.97 78.11"><defs><style>.cls-1{fill:#fff;}.cls-2{fill:#fc3d50;}</style></defs><path d="M64.89,27.54A53.23,53.23,0,0,0,42.64,6.24C39.4,4.54,35.92,4.7,32,5.05c-2.73.25-5.19.15-11.76-.11l-1,0a6.15,6.15,0,0,0-5.43,2.29c-3,3.87-2,11.34-1,14.75,2.83,9.74,8,18.45,14.5,24.53a60.15,60.15,0,0,0,6.17,5C38,54.67,45,58.58,52.4,59l.8,0a16.12,16.12,0,0,0,14.58-9.23C71.46,41.77,67.55,32.41,64.89,27.54Z"/><path class="cls-1" d="M10.05,58.75c-3.83,0-6.49-1.22-7.9-3.61C-1.2,49.47,9.22,39.08,13.86,34.88l1.67-1.51,1,1.51A14.51,14.51,0,0,0,18.07,37L19,38l-1.21,1.29c-4.74,5-5.44,7.92-5.16,8.4.57,1,2.14,1.17,3.35,1.17a19.18,19.18,0,0,0,4.09-.53c1-.23,2-.48,3.05-.76.75-.2,1.49-.42,2.23-.64A91,91,0,0,0,50.13,35.5c0-.06,0-.12,0-.18a6.55,6.55,0,0,1,5.76-7.26,6.36,6.36,0,0,1,3.22.43c1-.89,1.92-1.8,2.81-2.72,2.15-2.18,4.9-5.63,5.88-9.61a1.6,1.6,0,0,0-.08-1.34c-.38-.48-1.53-.76-3.08-.76A30.62,30.62,0,0,0,57,15.34l-1.19.36-.64-.76a14.07,14.07,0,0,0-2-1.91l-2-1.61,3-1.2C61,7.47,67,6,71.37,6c5,0,7.19,1.89,8.12,3.47a5.92,5.92,0,0,1,.36,4.69c-1.31,4.88-7.69,12.32-16.73,19.55l0,.1a6.55,6.55,0,0,1-5.77,7.26,6.61,6.61,0,0,1-.76.05,6.47,6.47,0,0,1-2.84-.66c-2,1.27-3.94,2.49-5.92,3.63C35.31,51.31,24.38,56.1,16.22,58A28.15,28.15,0,0,1,10.05,58.75Z"/><path d="M71.38,7.51c3.38,0,5.74.91,6.82,2.74a4.51,4.51,0,0,1,.21,3.53c-1.23,4.53-7.55,12-16.95,19.34a5.05,5.05,0,0,1-4.26,6.47,3.9,3.9,0,0,1-.59,0,5,5,0,0,1-2.89-.92c-2.11,1.4-4.32,2.77-6.62,4.09C34,50.33,23.43,54.78,15.89,56.49a27.13,27.13,0,0,1-5.84.76c-3.27,0-5.48-1-6.61-2.87C1.54,51.15,5.91,44.11,14.87,36l.35-.31A16.31,16.31,0,0,0,17,38l-.25.26c-4.31,4.59-6.37,8.49-5.36,10.19.75,1.27,2.33,1.91,4.64,1.91a20.42,20.42,0,0,0,4.42-.57c1-.24,2.08-.49,3.11-.77.76-.21,1.52-.42,2.27-.65a92.24,92.24,0,0,0,26-12.19,5,5,0,0,1,4.22-6.62,3.77,3.77,0,0,1,.58,0,5,5,0,0,1,2.7.79C60.58,29.18,61.8,28,63,26.82c2.74-2.8,5.3-6.41,6.26-10.3.75-3.09-1.66-4-4.62-4a32.59,32.59,0,0,0-8.08,1.34l-.25.08A15.56,15.56,0,0,0,54,11.86l.62-.25c6.81-2.72,12.54-4.1,16.72-4.1m0-3C66.77,4.51,60.6,6,53.55,8.83l-.62.25L48.18,11l4,3.21A13.73,13.73,0,0,1,54,15.91l1.27,1.51,1.89-.57.25-.08a29.1,29.1,0,0,1,7.21-1.21,6.53,6.53,0,0,1,1.72.18l0,.06a20.5,20.5,0,0,1-5.49,8.92c-.67.7-1.38,1.39-2.11,2.07a8.16,8.16,0,0,0-2.09-.28,7.26,7.26,0,0,0-.93.06,8,8,0,0,0-7.13,8.17A90.11,90.11,0,0,1,25,45.49l-2.2.62c-1,.27-2,.52-3,.75a18,18,0,0,1-3.75.49,4.45,4.45,0,0,1-1.83-.28c.25-.91,1.38-3.2,4.73-6.76l.25-.27,1.92-2-1.9-2a12.73,12.73,0,0,1-1.42-1.87l-1.9-3-2.65,2.4-.35.32C-.64,46-1.12,52.56.86,55.9c1.17,2,3.71,4.35,9.19,4.35a30,30,0,0,0,6.51-.83c8.3-1.89,19.38-6.73,32-14,1.77-1,3.56-2.11,5.32-3.24a7.93,7.93,0,0,0,2.69.47,7.26,7.26,0,0,0,.93-.06,8.06,8.06,0,0,0,7.14-8.18C73.75,27,79.92,19.69,81.3,14.56a7.39,7.39,0,0,0-.51-5.84C79.65,6.8,77.1,4.51,71.38,4.51Z"/><path class="cls-1" d="M25,48.8C17.71,42,12,32.37,8.85,21.57,7.74,17.73,6.54,9.24,10,4.64a7.73,7.73,0,0,1,6.47-3.07h.46l1.13,0c4.35.17,7,.28,9,.28,1.35,0,2.43,0,3.6-.15,1.43-.13,3-.26,4.48-.26a15.94,15.94,0,0,1,7.71,1.68A60.3,60.3,0,0,1,65.47,23.31l.63,1-.77.85c-1,1.11-2.11,2.25-3.31,3.38l-1.34,1.25-1-1.55A52.53,52.53,0,0,0,39.39,9.8,8.72,8.72,0,0,0,35.17,9c-1.21,0-2.54.12-3.8.23s-2.71.18-4.28.18c-2.21,0-4.9-.11-9.36-.29l-1.25,0a1.53,1.53,0,0,0-.5,0c-.08.13-.79,1.17-.8,4.19A23.52,23.52,0,0,0,16,19.48c2.77,9.52,7.75,18,14,23.85.55.52,1.14,1,1.74,1.55l1.85,1.57-2.23.95c-1.68.73-3.29,1.36-4.77,1.88l-.86.3Z"/><path d="M35.17,3a14.67,14.67,0,0,1,7,1.5,58.7,58.7,0,0,1,22,19.62Q62.79,25.73,61,27.41A53.87,53.87,0,0,0,40.09,8.47a10.24,10.24,0,0,0-4.92-1c-1.27,0-2.64.12-3.94.24s-2.61.17-4.14.17c-2.18,0-4.87-.11-9.32-.29l-1.08,0h-.21c-1.1,0-1.44.33-1.7.67s-1.09,1.81-1.1,5.06a25.11,25.11,0,0,0,.92,6.61c2.84,9.78,8,18.49,14.44,24.53.58.54,1.18,1.07,1.8,1.6-1.69.72-3.24,1.33-4.68,1.84L26,47.71c-7.54-7-12.84-16.72-15.7-26.56C8.65,15.5,7.64,3.07,16.48,3.07h.39c5,.2,8,.33,10.22.33,1.4,0,2.54-.05,3.73-.16C32.28,3.12,33.73,3,35.17,3m0-3C33.58,0,32,.13,30.55.26a33.81,33.81,0,0,1-3.46.15c-2,0-4.66-.11-9-.28L17,.08h-.51A9.2,9.2,0,0,0,8.8,3.74C5,8.8,6.14,17.59,7.41,22,10.63,33,16.49,43,23.94,49.9l.13.12.05,0,1.33,1.23,1.71-.6c1.51-.54,3.15-1.18,4.86-1.92l4.45-1.91-3.69-3.13c-.62-.53-1.17-1-1.69-1.5C25,36.56,20.17,28.33,17.48,19.06a22.06,22.06,0,0,1-.8-5.76,10.27,10.27,0,0,1,.3-2.73l.67,0c4.49.18,7.2.29,9.44.29,1.62,0,3-.06,4.41-.19,1.23-.11,2.52-.22,3.67-.22a7.35,7.35,0,0,1,3.52.65A50.88,50.88,0,0,1,58.44,29l1.93,3.11L63,29.6c1.24-1.17,2.39-2.34,3.41-3.48L68,24.41l-1.25-1.92A61.78,61.78,0,0,0,43.57,1.85,17.4,17.4,0,0,0,35.17,0Z"/><path class="cls-1" d="M81.4,74.71C79,73.93,67,69.9,64.21,67.16a8.37,8.37,0,0,1,3.74-14,8.19,8.19,0,0,1,2.15-.28A8.42,8.42,0,0,1,76,55.34c2.72,2.72,6.76,14.8,7.54,17.19l1,3.23Z"/><path d="M70.1,54.37a6.92,6.92,0,0,1,4.88,2c2.6,2.6,7,16,7.18,16.6l.14.42-.43-.14c-.57-.18-14-4.58-16.6-7.18a6.86,6.86,0,0,1,3.07-11.5,7,7,0,0,1,1.76-.23m0-3a9.86,9.86,0,0,0-6.94,16.86C66,71.05,76.53,74.7,80.94,76.14l.43.14L87,78.11,85.15,72.5,85,72.07c-1.44-4.42-5.1-15-7.91-17.79a9.92,9.92,0,0,0-7-2.91Z"/><path class="cls-2" d="M68.85,64.44a3.22,3.22,0,1,1,4.56-4.56c1.26,1.26,5.47,10,5.47,10s-8.77-4.21-10-5.47Zm0,0"/><path class="cls-1" d="M53.88,62.73l-.94,0c-8.35-.43-16.11-4.79-21.15-8.38-.63-.45-1.25-.9-1.86-1.37l-2-1.54,2.34-1c1.47-.64,3-1.36,4.61-2.13l.8-.38.72.51c7.56,5.33,13.39,6.66,17,6.84l.56,0a11.27,11.27,0,0,0,6-1.75A10.73,10.73,0,0,0,64,48.9a14.34,14.34,0,0,0,.73-8.61A31.32,31.32,0,0,0,62.32,33L61.84,32l.9-.73c1.2-1,2.36-2,3.46-3l1.47-1.35.88,1.79C71.61,34.91,74.47,44,70.77,52A18.61,18.61,0,0,1,53.88,62.73Z"/><path d="M67.21,29.37c3.3,6.7,5.42,15,2.19,22a17.16,17.16,0,0,1-15.52,9.83l-.86,0c-7.29-.37-14.52-4-20.36-8.1l-1.82-1.34q2.21-1,4.65-2.15c7.84,5.52,14,6.92,17.76,7.11l.63,0a12.79,12.79,0,0,0,6.8-2,12.24,12.24,0,0,0,4.65-5.24,15.76,15.76,0,0,0,.84-9.5,32.3,32.3,0,0,0-2.48-7.62c1.24-1,2.41-2,3.52-3m.92-4.91-2.95,2.69c-1.07,1-2.22,2-3.4,2.94L60,31.55l1,2.1a30.18,30.18,0,0,1,2.26,6.91,12.9,12.9,0,0,1-.61,7.71,9.26,9.26,0,0,1-3.52,4,9.81,9.81,0,0,1-5.21,1.52H53.4c-3.37-.18-8.91-1.45-16.18-6.58l-1.44-1-1.59.76c-1.58.76-3.11,1.47-4.56,2.11L25,51.08,29,54.16c.62.47,1.26.94,1.89,1.39,5.2,3.7,13.23,8.21,21.95,8.65.33,0,.67,0,1,0A20.1,20.1,0,0,0,72.13,52.66c4-8.57,1-18.12-2.23-24.62l-1.77-3.58Z"/><path class="cls-1" d="M25.56,14.26a17.41,17.41,0,0,1-8-1.66.72.72,0,0,1-.29-1,.71.71,0,0,1,1-.28c.1.05,7.38,3.87,18.43-1.11a.71.71,0,0,1,1,.36.71.71,0,0,1-.36.95A28.35,28.35,0,0,1,25.56,14.26Z"/><path class="cls-1" d="M78.2,10.25C75.79,6.16,67,6.68,54.66,11.61l-.62.25A15.56,15.56,0,0,1,56.29,14l.25-.08c2.58-.77,14.24-3.68,12.7,2.62-1,3.89-3.52,7.5-6.26,10.3-1.18,1.21-2.4,2.36-3.65,3.48a5,5,0,0,0-7.5,5.87,92.24,92.24,0,0,1-26,12.19c-.75.23-1.51.44-2.27.65-1,.28-2.07.53-3.11.77-4.77,1.08-7.91.62-9.06-1.34-1-1.7,1.05-5.6,5.36-10.19L17,38a15.59,15.59,0,0,1-1.75-2.31l-.35.31c-9,8.12-13.33,15.16-11.43,18.39,1.13,1.91,3.34,2.87,6.61,2.87a27.13,27.13,0,0,0,5.84-.76C23.43,54.78,34,50.33,47.1,42.8c2.3-1.32,4.51-2.69,6.62-4.09a5,5,0,0,0,2.89.92,3.9,3.9,0,0,0,.59,0,5,5,0,0,0,4.26-6.47c9.4-7.39,15.72-14.81,16.95-19.34A4.51,4.51,0,0,0,78.2,10.25Z"/></svg>
@@ -0,0 +1,48 @@
1
+ import { Autowired } from '@opensumi/di';
2
+ import { ComponentContribution, ComponentRegistry, Disposable, Domain } from '@opensumi/ide-core-browser';
3
+ import { IMenuRegistry, IMenubarItem, ISubmenuItem, MenuId } from '@opensumi/ide-core-browser/lib/menu/next';
4
+ import { MenubarStore } from '@opensumi/ide-menu-bar/lib/browser/menu-bar.store';
5
+
6
+ import { DESIGN_MENUBAR_CONTAINER_VIEW_ID } from '../../common';
7
+
8
+ import { DesignMenuBarView } from './menu-bar.view';
9
+
10
+ @Domain(ComponentContribution)
11
+ export class DesignMenuBarContribution extends Disposable implements ComponentContribution {
12
+ @Autowired(MenubarStore)
13
+ private readonly menubarStore: MenubarStore;
14
+
15
+ @Autowired(IMenuRegistry)
16
+ private readonly menuRegistry: IMenuRegistry;
17
+
18
+ constructor() {
19
+ super();
20
+
21
+ this.menubarStore.unregisterMenusBarByCompact(MenuId.DesignMenuBarTopExtra);
22
+
23
+ this.addDispose(
24
+ this.menubarStore.onDidMenuBarChange((menubarItems: IMenubarItem[]) => {
25
+ this.menuRegistry.registerMenuItems(
26
+ MenuId.DesignMenuBarTopExtra,
27
+ menubarItems.map(
28
+ (item: IMenubarItem) =>
29
+ ({
30
+ label: item.label,
31
+ submenu: item.id,
32
+ iconClass: item.iconClass,
33
+ group: '1_navigation',
34
+ order: 100,
35
+ } as ISubmenuItem),
36
+ ),
37
+ );
38
+ }),
39
+ );
40
+ }
41
+
42
+ registerComponent(registry: ComponentRegistry): void {
43
+ registry.register(DESIGN_MENUBAR_CONTAINER_VIEW_ID, {
44
+ component: DesignMenuBarView,
45
+ id: DESIGN_MENUBAR_CONTAINER_VIEW_ID,
46
+ });
47
+ }
48
+ }
@@ -0,0 +1,107 @@
1
+ .menu_bar_view {
2
+ display: flex;
3
+ background-color: var(--kt-menubar-background);
4
+ align-items: center;
5
+ width: 100%;
6
+
7
+ .container {
8
+ display: flex;
9
+ justify-content: space-between;
10
+ width: inherit;
11
+ align-items: center;
12
+ padding: 0 12px 0 8px;
13
+
14
+ .left {
15
+ display: flex;
16
+ align-items: center;
17
+ z-index: 2;
18
+
19
+ .enhance_menu {
20
+ padding: 8px;
21
+ }
22
+
23
+ .dividing {
24
+ margin-left: 5px;
25
+ width: 2px;
26
+ height: 12px;
27
+ background-color: var(--editorGroup-border);
28
+ }
29
+
30
+ .top_menus_bar {
31
+ margin-left: 6px;
32
+ display: flex;
33
+ align-items: center;
34
+ border-radius: 6px;
35
+
36
+ .ai_enhance_menu {
37
+ padding: 8px 6px;
38
+ height: 32px;
39
+ }
40
+
41
+ .caret_icon {
42
+ font-size: 14px;
43
+ margin-left: 4px;
44
+ }
45
+
46
+ .logo_container {
47
+ display: flex;
48
+ align-items: center;
49
+
50
+ .extra_top_icon {
51
+ width: 16px;
52
+ height: 16px;
53
+ background-repeat: no-repeat;
54
+ background-size: 100%;
55
+
56
+ &::before {
57
+ content: initial;
58
+ }
59
+
60
+ &:hover {
61
+ background-color: transparent;
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
67
+
68
+ .center {
69
+ text-align: center;
70
+ position: absolute;
71
+ left: 0;
72
+ right: 0;
73
+ z-index: 1;
74
+
75
+ .run {
76
+ .btn {
77
+ border-radius: 6px;
78
+ padding: 0 13px 0 11px;
79
+ border: 0;
80
+ }
81
+ span {
82
+ color: #58ce5f;
83
+ font-size: 12px;
84
+ }
85
+ }
86
+ }
87
+
88
+ .right {
89
+ display: flex;
90
+ align-items: center;
91
+ z-index: 2;
92
+
93
+ .input {
94
+ margin-right: 16px;
95
+ width: 240px;
96
+ flex-shrink: 0;
97
+
98
+ .input_wrapper {
99
+ height: 32px;
100
+ background-color: var(--design-borderColor-common);
101
+ border-radius: 8px;
102
+ border: 1px solid var(--design-input-foreground);
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
@@ -0,0 +1,152 @@
1
+ import cls from 'classnames';
2
+ import * as React from 'react';
3
+
4
+ import { AINativeConfigService, SlotLocation, SlotRenderer, getIcon, useInjectable } from '@opensumi/ide-core-browser';
5
+ import { Icon } from '@opensumi/ide-core-browser/lib/components';
6
+ import { EnhanceIcon } from '@opensumi/ide-core-browser/lib/components/ai-native';
7
+ import { DesignLayoutConfig } from '@opensumi/ide-core-browser/lib/layout/constants';
8
+ import { VIEW_CONTAINERS } from '@opensumi/ide-core-browser/lib/layout/view-id';
9
+ import { AbstractContextMenuService, ICtxMenuRenderer, MenuId } from '@opensumi/ide-core-browser/lib/menu/next';
10
+ import { CommandService } from '@opensumi/ide-core-common';
11
+ import { IMainLayoutService } from '@opensumi/ide-main-layout';
12
+
13
+ import { DESIGN_MENU_BAR_LEFT, DESIGN_MENU_BAR_RIGHT } from '../../common';
14
+
15
+ import OpenSumiLogo from './logo.svg';
16
+ import styles from './menu-bar.module.less';
17
+
18
+ const DesignMenuBarRender = () => {
19
+ const contextmenuService = useInjectable<AbstractContextMenuService>(AbstractContextMenuService);
20
+ const designLayoutConfig = useInjectable<DesignLayoutConfig>(DesignLayoutConfig);
21
+ const ctxMenuRenderer = useInjectable<ICtxMenuRenderer>(ICtxMenuRenderer);
22
+
23
+ const iconRef = React.useRef<HTMLDivElement | null>(null);
24
+ const [anchor, setAnchor] = React.useState<{ x: number; y: number } | undefined>(undefined);
25
+
26
+ React.useEffect(() => {
27
+ handleRefRect();
28
+ }, []);
29
+
30
+ const handleRefRect = React.useCallback(
31
+ (cb?: (_anchor: { x: number; y: number }) => void) => {
32
+ requestAnimationFrame(() => {
33
+ if (iconRef.current) {
34
+ const rect = iconRef.current.getBoundingClientRect();
35
+ const { x, y, width, height } = rect;
36
+ const _anchor = {
37
+ x,
38
+ y: y + height,
39
+ };
40
+
41
+ setAnchor(_anchor);
42
+
43
+ if (cb) {
44
+ cb(_anchor);
45
+ }
46
+ }
47
+ });
48
+ },
49
+ [iconRef.current],
50
+ );
51
+
52
+ const extraTopMenus = React.useMemo(
53
+ () =>
54
+ contextmenuService.createMenu({
55
+ id: MenuId.DesignMenuBarTopExtra,
56
+ }),
57
+ [contextmenuService],
58
+ );
59
+
60
+ const handleClick = React.useCallback(() => {
61
+ if (!anchor) {
62
+ return;
63
+ }
64
+
65
+ const menuNodes = extraTopMenus.getMergedMenuNodes();
66
+ extraTopMenus.dispose();
67
+
68
+ handleRefRect((_anchor) => {
69
+ ctxMenuRenderer.show({
70
+ anchor: _anchor,
71
+ menuNodes,
72
+ });
73
+ });
74
+ }, [anchor, extraTopMenus]);
75
+
76
+ const logo = React.useMemo(() => designLayoutConfig.menubarLogo || OpenSumiLogo, [designLayoutConfig.menubarLogo]);
77
+
78
+ return (
79
+ <>
80
+ <EnhanceIcon wrapperClassName={styles.ai_enhance_menu} ref={iconRef} onClick={handleClick}>
81
+ <div className={styles.logo_container}>
82
+ <img className={styles.extra_top_icon} src={logo} alt='' />
83
+ <Icon className={cls(getIcon('down'), styles.caret_icon)} />
84
+ </div>
85
+ </EnhanceIcon>
86
+ </>
87
+ );
88
+ };
89
+
90
+ export const DesignMenuBarView = () => {
91
+ const commandService = useInjectable<CommandService>(CommandService);
92
+ const mainLayoutService = useInjectable<IMainLayoutService>(IMainLayoutService);
93
+ const aiNativeConfigService = useInjectable<AINativeConfigService>(AINativeConfigService);
94
+ const [isLeftPanelVisible, setIsVisiablePanel] = React.useState<boolean>(false);
95
+
96
+ React.useEffect(() => {
97
+ requestAnimationFrame(() => {
98
+ setIsVisiablePanel(isVisiable());
99
+ });
100
+
101
+ const tabbarService = mainLayoutService.getTabbarService(SlotLocation.left);
102
+ const toDispose = tabbarService.onCurrentChange(({ previousId, currentId }) => {
103
+ if (previousId && !currentId) {
104
+ setIsVisiablePanel(false);
105
+ } else if (!previousId && currentId) {
106
+ setIsVisiablePanel(true);
107
+ }
108
+ });
109
+
110
+ return () => {
111
+ toDispose.dispose();
112
+ };
113
+ }, []);
114
+
115
+ const handleLeftMenuVisiable = React.useCallback(() => {
116
+ commandService.executeCommand('main-layout.left-panel.toggle');
117
+ requestAnimationFrame(() => {
118
+ setIsVisiablePanel(isVisiable());
119
+ });
120
+ }, []);
121
+
122
+ const isVisiable = React.useCallback(() => {
123
+ const tabbarService = mainLayoutService.getTabbarService(SlotLocation.left);
124
+ return !!tabbarService.currentContainerId;
125
+ }, [mainLayoutService]);
126
+
127
+ return (
128
+ <div
129
+ id={VIEW_CONTAINERS.MENUBAR}
130
+ className={styles.menu_bar_view}
131
+ style={{ height: aiNativeConfigService.layoutViewSize.menubarHeight }}
132
+ >
133
+ <div className={styles.container}>
134
+ <div className={styles.left}>
135
+ <EnhanceIcon
136
+ wrapperClassName={styles.enhance_menu}
137
+ icon={isLeftPanelVisible ? 'left-nav-open' : 'left-nav-close'}
138
+ onClick={handleLeftMenuVisiable}
139
+ />
140
+ <span className={styles.dividing}></span>
141
+ <div className={styles.top_menus_bar}>
142
+ <DesignMenuBarRender />
143
+ </div>
144
+ <SlotRenderer slot={DESIGN_MENU_BAR_LEFT} flex={1} overflow={'initial'} />
145
+ </div>
146
+ <div className={styles.right}>
147
+ <SlotRenderer slot={DESIGN_MENU_BAR_RIGHT} flex={1} overflow={'initial'} />
148
+ </div>
149
+ </div>
150
+ </div>
151
+ );
152
+ };
@@ -6,7 +6,7 @@ import { Popover } from '@opensumi/ide-core-browser/lib/components';
6
6
  import { localize, uuid } from '@opensumi/ide-core-common';
7
7
  import { EditorTabService } from '@opensumi/ide-editor/lib/browser/editor.tab.service';
8
8
 
9
- import styles from './override.module.less';
9
+ import styles from '../style/design.module.less';
10
10
 
11
11
  const EditorTabCloseComponent = (props) => {
12
12
  const { children } = props;
@@ -10,7 +10,7 @@ import { BrowserCtxMenuService } from '@opensumi/ide-overlay/lib/browser/ctx-men
10
10
  import { IIconService } from '@opensumi/ide-theme';
11
11
  import { IconService } from '@opensumi/ide-theme/lib/browser';
12
12
 
13
- import styles from './override.module.less';
13
+ import styles from '../style/design.module.less';
14
14
 
15
15
  const MenuComponent = (props: { data: MenuNode } & IMenuRenderProps) => {
16
16
  const iconService = useInjectable<IconService>(IIconService);