@opensumi/ide-core-browser 2.23.4 → 2.23.5-next-1682046023.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 (80) hide show
  1. package/lib/bootstrap/app.d.ts.map +1 -1
  2. package/lib/bootstrap/app.js +6 -8
  3. package/lib/bootstrap/app.js.map +1 -1
  4. package/lib/bootstrap/inner-providers.js +4 -4
  5. package/lib/bootstrap/inner-providers.js.map +1 -1
  6. package/lib/components/layout/default-layout.d.ts.map +1 -1
  7. package/lib/components/layout/default-layout.js +2 -2
  8. package/lib/components/layout/default-layout.js.map +1 -1
  9. package/lib/components/layout/layout.d.ts +4 -4
  10. package/lib/components/layout/split-panel.d.ts.map +1 -1
  11. package/lib/components/layout/split-panel.js +1 -1
  12. package/lib/components/layout/split-panel.js.map +1 -1
  13. package/lib/components/resize/resize.d.ts.map +1 -1
  14. package/lib/components/resize/resize.js +50 -27
  15. package/lib/components/resize/resize.js.map +1 -1
  16. package/lib/core-preferences.d.ts +1 -0
  17. package/lib/core-preferences.d.ts.map +1 -1
  18. package/lib/core-preferences.js +4 -0
  19. package/lib/core-preferences.js.map +1 -1
  20. package/lib/extensions/schema/menu.d.ts.map +1 -1
  21. package/lib/extensions/schema/menu.js +4 -0
  22. package/lib/extensions/schema/menu.js.map +1 -1
  23. package/lib/layout/view-id.d.ts +1 -0
  24. package/lib/layout/view-id.d.ts.map +1 -1
  25. package/lib/layout/view-id.js +1 -0
  26. package/lib/layout/view-id.js.map +1 -1
  27. package/lib/markdown/index.d.ts.map +1 -1
  28. package/lib/markdown/index.js +0 -1
  29. package/lib/markdown/index.js.map +1 -1
  30. package/lib/menu/next/menu-id.d.ts +2 -0
  31. package/lib/menu/next/menu-id.d.ts.map +1 -1
  32. package/lib/menu/next/menu-id.js +2 -0
  33. package/lib/menu/next/menu-id.js.map +1 -1
  34. package/lib/menu/next/menu-service.js +1 -2
  35. package/lib/menu/next/menu-service.js.map +1 -1
  36. package/lib/quick-open/index.d.ts +5 -0
  37. package/lib/quick-open/index.d.ts.map +1 -1
  38. package/lib/quick-open/index.js.map +1 -1
  39. package/lib/react-providers/slot.d.ts +0 -3
  40. package/lib/react-providers/slot.d.ts.map +1 -1
  41. package/lib/react-providers/slot.js +3 -3
  42. package/lib/react-providers/slot.js.map +1 -1
  43. package/lib/services/storage-service.d.ts.map +1 -1
  44. package/lib/services/storage-service.js +3 -0
  45. package/lib/services/storage-service.js.map +1 -1
  46. package/lib/utils/electron.d.ts +1 -1
  47. package/lib/utils/electron.d.ts.map +1 -1
  48. package/lib/utils/electron.js +26 -1
  49. package/lib/utils/electron.js.map +1 -1
  50. package/lib/utils/index.d.ts +0 -1
  51. package/lib/utils/index.d.ts.map +1 -1
  52. package/lib/utils/index.js +0 -1
  53. package/lib/utils/index.js.map +1 -1
  54. package/lib/utils/label.d.ts +1 -1
  55. package/lib/utils/label.d.ts.map +1 -1
  56. package/lib/utils/label.js +16 -6
  57. package/lib/utils/label.js.map +1 -1
  58. package/package.json +11 -6
  59. package/src/bootstrap/app.ts +2 -3
  60. package/src/bootstrap/inner-providers.ts +4 -4
  61. package/src/components/layout/default-layout.tsx +4 -2
  62. package/src/components/layout/split-panel.tsx +4 -2
  63. package/src/components/resize/resize.tsx +50 -26
  64. package/src/core-preferences.ts +6 -0
  65. package/src/extensions/schema/menu.ts +4 -0
  66. package/src/layout/view-id.ts +1 -0
  67. package/src/markdown/index.tsx +0 -1
  68. package/src/menu/next/menu-id.ts +3 -1
  69. package/src/menu/next/menu-service.ts +1 -2
  70. package/src/quick-open/index.ts +5 -0
  71. package/src/react-providers/slot.tsx +9 -8
  72. package/src/services/storage-service.ts +3 -0
  73. package/src/utils/electron.ts +35 -2
  74. package/src/utils/index.ts +0 -1
  75. package/src/utils/label.tsx +27 -6
  76. package/lib/utils/parse.d.ts +0 -26
  77. package/lib/utils/parse.d.ts.map +0 -1
  78. package/lib/utils/parse.js +0 -81
  79. package/lib/utils/parse.js.map +0 -1
  80. package/src/utils/parse.ts +0 -82
@@ -2,33 +2,43 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformLabelWithCodicon = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const classnames_1 = tslib_1.__importDefault(require("classnames"));
5
6
  const react_1 = tslib_1.__importDefault(require("react"));
6
7
  const icon_1 = require("@opensumi/ide-components/lib/icon/icon");
7
8
  const ide_core_common_1 = require("@opensumi/ide-core-common");
8
9
  const SEPERATOR = ' ';
9
- function transformLabelWithCodicon(label, iconStyles = {}, transformer, renderText) {
10
+ function transformLabelWithCodicon(label, iconStyleProps = {}, transformer, renderText) {
10
11
  const ICON_REGX = /\$\(([a-z.]+\/)?([a-z-]+)(~[a-z]+)?\)/gi;
11
12
  const ICON_WITH_ANIMATE_REGX = /\$\(([a-z.]+\/)?([a-z-]+)~([a-z]+)\)/gi;
12
- return label.split(SEPERATOR).map((e, index) => {
13
+ // some string like $() $(~spin)
14
+ const ICON_ERROR_REGX = /\$\(([a-z.]+\/)?([a-z-]+)?(~[a-z]+)?\)/gi;
15
+ const generateIconStyle = (icon, styleProps) => typeof styleProps === 'string' ? { className: (0, classnames_1.default)(icon, styleProps) } : { className: icon, style: styleProps };
16
+ const splitLabel = label.split(SEPERATOR);
17
+ const length = splitLabel.length;
18
+ return splitLabel.map((e, index) => {
13
19
  if (!transformer) {
14
20
  return e;
15
21
  }
16
22
  const icon = transformer(e);
17
23
  if (icon) {
18
- return react_1.default.createElement(icon_1.Icon, { className: icon, style: iconStyles, key: `${index}-${icon}` });
24
+ return react_1.default.createElement(icon_1.Icon, Object.assign({}, generateIconStyle(icon, iconStyleProps), { key: `${index}-${icon}` }));
19
25
  }
20
26
  else if (ICON_REGX.test(e)) {
21
27
  if (e.includes('~')) {
22
28
  const [, , icon, animate] = ICON_WITH_ANIMATE_REGX.exec(e) || [];
23
29
  if (animate && icon) {
24
- return (react_1.default.createElement(icon_1.Icon, { className: transformer(`$(${icon})`), style: iconStyles, animate: animate, key: `${index}-${icon}` }));
30
+ return (react_1.default.createElement(icon_1.Icon, Object.assign({}, generateIconStyle(transformer(`$(${icon})`), iconStyleProps), { animate: animate, key: `${index}-${icon}` })));
25
31
  }
26
32
  }
27
33
  const newStr = e.replaceAll(ICON_REGX, (e) => `${SEPERATOR}${e}${SEPERATOR}`);
28
- return transformLabelWithCodicon(newStr, iconStyles, transformer);
34
+ return transformLabelWithCodicon(newStr, iconStyleProps, transformer);
35
+ }
36
+ else if (ICON_ERROR_REGX.test(e)) {
37
+ return transformLabelWithCodicon(e.replaceAll(ICON_ERROR_REGX, ''), iconStyleProps, transformer, renderText);
29
38
  }
30
39
  else {
31
- return (0, ide_core_common_1.isFunction)(renderText) ? renderText(e, index) : react_1.default.createElement("span", { key: `${index}-${e}` }, e);
40
+ const withSeperator = e + (index === length - 1 ? '' : SEPERATOR);
41
+ return (0, ide_core_common_1.isFunction)(renderText) ? (renderText(withSeperator, index)) : (react_1.default.createElement("span", { key: `${index}-${e}` }, withSeperator));
32
42
  }
33
43
  });
34
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/utils/label.tsx"],"names":[],"mappings":";;;;AAAA,0DAA6C;AAE7C,iEAA8D;AAC9D,+DAAuD;AAEvD,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,SAAgB,yBAAyB,CACvC,KAAa,EACb,aAA4B,EAAE,EAC9B,WAAiD,EACjD,UAA4D;IAE5D,MAAM,SAAS,GAAG,yCAAyC,CAAC;IAC5D,MAAM,sBAAsB,GAAG,wCAAwC,CAAC;IACxE,OAAO,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QAC7C,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO,CAAC,CAAC;SACV;QACD,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAC5B,IAAI,IAAI,EAAE;YACR,O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I,EAAE;oBACnB,OAAO,CACL,8BAAC,WAAI,oBACC,iBAAiB,CAAC,WAAW,CAAC,KAAK,IAAI,GAAG,CAAC,EAAE,cAAc,CAAC,IAChE,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,KAAK,IAAI,IAAI,EAAE,IACvB,CACH,CAAC;iBACH;aACF;YACD,MAAM,MAAM,GAAG,CAAC,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,SAAS,GAAG,CAAC,GAAG,SAAS,EAAE,CAAC,CAAC;YAC9E,OAAO,yBAAyB,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;SACvE;aAAM,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;YAClC,OAAO,yBAAyB,CAAC,CAAC,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,CAAC,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;SAC9G;aAAM;YACL,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAClE,OAAO,IAAA,4BAAU,EAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAC9B,UAAU,CAAC,aAAa,EAAE,KAAK,CAAC,CACjC,CAAC,CAAC,CAAC,CACF,wCAAM,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC,EAAE,IAAG,aAAa,CAAQ,CACnD,CAAC;SACH;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAlDD,8DAkDC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/ide-core-browser",
3
- "version": "2.23.4",
3
+ "version": "2.23.5-next-1682046023.0",
4
4
  "description": "@opensumi/ide-core-browser",
5
5
  "files": [
6
6
  "lib",
@@ -18,9 +18,9 @@
18
18
  "build": "tsc --build ../../configs/ts/references/tsconfig.core-browser.json"
19
19
  },
20
20
  "dependencies": {
21
- "@opensumi/ide-components": "2.23.4",
22
- "@opensumi/ide-connection": "2.23.4",
23
- "@opensumi/ide-core-common": "2.23.4",
21
+ "@opensumi/ide-components": "2.23.5-next-1682046023.0",
22
+ "@opensumi/ide-connection": "2.23.5-next-1682046023.0",
23
+ "@opensumi/ide-core-common": "2.23.5-next-1682046023.0",
24
24
  "@opensumi/vscode-debugprotocol": "1.49.0-beta.1",
25
25
  "@vscode/codicons": "0.0.27",
26
26
  "ajv": "^6.10.0",
@@ -34,7 +34,6 @@
34
34
  "mobx-react-lite": "^1.3.1",
35
35
  "onigasm": "2.2.2",
36
36
  "rc-menu": "^9.3.2",
37
- "react": "^16.8.6",
38
37
  "react-autosize-textarea": "^7.0.0",
39
38
  "react-ctxmenu-trigger": "^1.0.0",
40
39
  "react-custom-scrollbars": "^4.2.1",
@@ -45,5 +44,11 @@
45
44
  "strip-json-comments": "3.0.1",
46
45
  "vscode-textmate": "7.0.1"
47
46
  },
48
- "gitHead": "23400e4cfb82f3eada37c0d6c110e6d44d8a8193"
47
+ "devDependencies": {
48
+ "react": "^16.8.6"
49
+ },
50
+ "peerDependencies": {
51
+ "react": ">=16.8.6"
52
+ },
53
+ "gitHead": "813132a420c10062743acf37559ea63ace25fe89"
49
54
  }
@@ -109,7 +109,6 @@ export class ClientApp implements IClientApp, IDisposable {
109
109
  editorBackgroundImage,
110
110
  defaultPreferences,
111
111
  allowSetDocumentTitleFollowWorkspaceDir = true,
112
- devtools = false, // if not set, disable devtools support as default
113
112
  ...restOpts
114
113
  } = opts;
115
114
 
@@ -139,10 +138,10 @@ export class ClientApp implements IClientApp, IDisposable {
139
138
  layoutConfig: opts.layoutConfig as LayoutConfig,
140
139
  editorBackgroundImage: opts.editorBackgroundImage || editorBackgroundImage,
141
140
  allowSetDocumentTitleFollowWorkspaceDir,
142
- devtools,
141
+ devtools: opts.devtools ?? false,
143
142
  };
144
143
 
145
- if (devtools) {
144
+ if (this.config.devtools) {
146
145
  // set a global so the opensumi devtools can identify that
147
146
  // the current page is powered by opensumi core
148
147
  window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__ = {};
@@ -270,19 +270,19 @@ export function injectInnerProviders(injector: Injector) {
270
270
  injector.addProviders(
271
271
  {
272
272
  token: IElectronMainMenuService,
273
- useValue: createElectronMainApi(IElectronMainMenuService),
273
+ useValue: createElectronMainApi(IElectronMainMenuService, appConfig.devtools),
274
274
  },
275
275
  {
276
276
  token: IElectronMainUIService,
277
- useValue: createElectronMainApi(IElectronMainUIService),
277
+ useValue: createElectronMainApi(IElectronMainUIService, appConfig.devtools),
278
278
  },
279
279
  {
280
280
  token: IElectronMainLifeCycleService,
281
- useValue: createElectronMainApi(IElectronMainLifeCycleService),
281
+ useValue: createElectronMainApi(IElectronMainLifeCycleService, appConfig.devtools),
282
282
  },
283
283
  {
284
284
  token: IElectronURLService,
285
- useValue: createElectronMainApi(IElectronURLService),
285
+ useValue: createElectronMainApi(IElectronURLService, appConfig.devtools),
286
286
  },
287
287
  {
288
288
  token: IElectronMenuFactory,
@@ -32,7 +32,8 @@ export function ToolbarActionBasedLayout() {
32
32
  slot='left'
33
33
  isTabbar={true}
34
34
  defaultSize={layout.left?.currentId ? layout.left?.size || 310 : 49}
35
- minResize={204}
35
+ minResize={280}
36
+ maxResize={480}
36
37
  minSize={49}
37
38
  />
38
39
  <SplitPanel id='main-vertical' minResize={300} flexGrow={1} direction='top-to-bottom'>
@@ -51,7 +52,8 @@ export function ToolbarActionBasedLayout() {
51
52
  slot='right'
52
53
  isTabbar={true}
53
54
  defaultSize={layout.right?.currentId ? layout.right?.size || 310 : 0}
54
- minResize={200}
55
+ minResize={280}
56
+ maxResize={480}
55
57
  minSize={0}
56
58
  />
57
59
  </SplitPanel>
@@ -228,6 +228,7 @@ export const SplitPanel: React.FC<SplitPanelProps> = ({
228
228
  );
229
229
  }
230
230
  }
231
+
231
232
  elements.push(
232
233
  <PanelContext.Provider
233
234
  key={index}
@@ -243,6 +244,7 @@ export const SplitPanel: React.FC<SplitPanelProps> = ({
243
244
  >
244
245
  <div
245
246
  data-min-resize={getProp(element, 'minResize')}
247
+ data-max-resize={getProp(element, 'maxResize')}
246
248
  ref={(ele) => {
247
249
  if (ele && splitPanelService.panels.indexOf(ele) === -1) {
248
250
  splitPanelService.panels.push(ele);
@@ -250,7 +252,7 @@ export const SplitPanel: React.FC<SplitPanelProps> = ({
250
252
  }}
251
253
  id={getProp(element, 'id') /* @deprecated: query by data-view-id */}
252
254
  style={{
253
- // 手风琴场景,固定尺寸和flex尺寸混合布局;需要在resize flex模式下禁用
255
+ // 手风琴场景,固定尺寸和 flex 尺寸混合布局;需要在 Resize Flex 模式下禁用
254
256
  ...(getProp(element, 'flex') &&
255
257
  !getProp(element, 'savedSize') &&
256
258
  !childList.find((item) => getProp(item, 'flexGrow'))
@@ -262,7 +264,7 @@ export const SplitPanel: React.FC<SplitPanelProps> = ({
262
264
  : '-1px',
263
265
  [Layout.getMaxSizeProperty(direction)]:
264
266
  maxLocks[index] && getProp(element, 'maxSize') ? getProp(element, 'maxSize') + 'px' : 'unset',
265
- // resize flex模式下应用flexGrow
267
+ // Resize Flex 模式下应用 flexGrow
266
268
  ...(getProp(element, 'flexGrow') !== undefined ? { flexGrow: getProp(element, 'flexGrow') } : {}),
267
269
  display: hides[index] ? 'none' : 'block',
268
270
  backgroundColor: getProp(element, 'backgroundColor'),
@@ -88,16 +88,25 @@ export const ResizeHandleHorizontal = (props: ResizeHandleProps) => {
88
88
  const parentWidth = ref.current!.parentElement!.offsetWidth;
89
89
  const prevEle = props.findPrevElement ? props.findPrevElement() : prevElement.current!;
90
90
  const nextEle = props.findNextElement ? props.findNextElement() : nextElement.current!;
91
+
91
92
  if ((prevEle && prevEle.classList.contains(RESIZE_LOCK)) || (nextEle && nextEle.classList.contains(RESIZE_LOCK))) {
92
93
  return;
93
94
  }
94
- const prevMinResize = prevEle!.dataset.minResize || 0;
95
- const nextMinResize = nextEle!.dataset.minResize || 0;
95
+ const prevMinResize = prevEle?.dataset.minResize || 0;
96
+ const nextMinResize = nextEle?.dataset.minResize || 0;
97
+
98
+ const prevMaxResize = prevEle?.dataset.maxResize || 0;
99
+ const nextMaxResize = nextEle?.dataset.maxResize || 0;
96
100
  if (prevMinResize || nextMinResize) {
97
101
  if (prev * parentWidth <= prevMinResize || next * parentWidth <= nextMinResize) {
98
102
  return;
99
103
  }
100
104
  }
105
+ if (prevMaxResize || nextMaxResize) {
106
+ if (prev * parentWidth >= prevMaxResize || next * parentWidth >= nextMaxResize) {
107
+ return;
108
+ }
109
+ }
101
110
  if (nextEle) {
102
111
  nextEle.style.width = next * 100 + '%';
103
112
  }
@@ -109,34 +118,49 @@ export const ResizeHandleHorizontal = (props: ResizeHandleProps) => {
109
118
  }
110
119
  };
111
120
 
112
- const flexModeSetSize = (prevWidth: number, nextWidth: number, ignoreMin?: boolean, direction?: boolean) => {
121
+ const flexModeSetSize = (prevWidth: number, nextWidth: number, ignoreResizeRange?: boolean, direction?: boolean) => {
113
122
  const prevEle = props.findPrevElement ? props.findPrevElement(direction) : prevElement.current!;
114
123
  const nextEle = props.findNextElement ? props.findNextElement(direction) : nextElement.current!;
115
- let fixedElement: HTMLElement;
116
- let flexElement: HTMLElement;
117
- let targetFixedWidth = 0;
118
- const prevMinResize = parseInt(prevEle!.dataset.minResize || '0', 10);
119
- const nextMinResize = parseInt(nextEle!.dataset.minResize || '0', 10);
120
- if (props.flexMode === ResizeFlexMode.Prev) {
121
- fixedElement = prevEle!;
122
- flexElement = nextEle!;
123
- targetFixedWidth = prevWidth;
124
- if (!ignoreMin) {
125
- if (prevMinResize > prevWidth) {
126
- targetFixedWidth = prevMinResize;
127
- } else if (nextMinResize > nextWidth) {
128
- targetFixedWidth = prevWidth + nextWidth - nextMinResize;
124
+ const prevMinResize = Number(prevEle?.dataset.minResize ?? 0);
125
+ const nextMinResize = Number(nextEle?.dataset.minResize ?? 0);
126
+
127
+ const prevMaxResize = prevEle?.dataset.maxResize ? Number(prevEle?.dataset.maxResize) : null;
128
+ const nextMaxResize = nextEle?.dataset.maxResize ? Number(nextEle?.dataset.maxResize) : null;
129
+
130
+ const isPreFlexMode = props.flexMode === ResizeFlexMode.Prev;
131
+ const fixedElement = (isPreFlexMode ? prevEle : nextEle)!;
132
+ const flexElement = (isPreFlexMode ? nextEle : prevEle)!;
133
+ let targetFixedWidth = isPreFlexMode ? prevWidth : nextWidth;
134
+
135
+ if (!ignoreResizeRange) {
136
+ if (prevMinResize || nextMinResize) {
137
+ if (isPreFlexMode) {
138
+ if (prevMinResize > prevWidth) {
139
+ targetFixedWidth = prevMinResize;
140
+ } else if (nextMinResize > nextWidth) {
141
+ targetFixedWidth = prevWidth + nextWidth - nextMinResize;
142
+ }
143
+ } else {
144
+ if (nextMinResize > nextWidth) {
145
+ targetFixedWidth = nextMinResize;
146
+ } else if (prevMinResize > prevWidth) {
147
+ targetFixedWidth = prevWidth + nextWidth - prevMinResize;
148
+ }
129
149
  }
130
150
  }
131
- } else {
132
- fixedElement = nextEle!;
133
- flexElement = prevEle!;
134
- targetFixedWidth = nextWidth;
135
- if (!ignoreMin) {
136
- if (nextMinResize > nextWidth) {
137
- targetFixedWidth = nextMinResize;
138
- } else if (prevMinResize > prevWidth) {
139
- targetFixedWidth = prevWidth + nextWidth - prevMinResize;
151
+ if (prevMaxResize || nextMaxResize) {
152
+ if (isPreFlexMode) {
153
+ if (prevMaxResize && prevMaxResize <= prevWidth) {
154
+ targetFixedWidth = prevMaxResize;
155
+ } else if (nextMaxResize && nextMaxResize > nextWidth) {
156
+ targetFixedWidth = prevWidth + nextWidth - nextMaxResize;
157
+ }
158
+ } else {
159
+ if (nextMaxResize && nextMaxResize <= nextWidth) {
160
+ targetFixedWidth = nextMaxResize;
161
+ } else if (prevMaxResize && prevMaxResize > nextWidth) {
162
+ targetFixedWidth = prevWidth + nextWidth - prevMaxResize;
163
+ }
140
164
  }
141
165
  }
142
166
  }
@@ -5,6 +5,7 @@ import {
5
5
  SUPPORTED_ENCODINGS,
6
6
  GeneralSettingsId,
7
7
  PreferenceSchema,
8
+ MenubarSettingId,
8
9
  } from '@opensumi/ide-core-common';
9
10
  import { LOCALE_TYPES } from '@opensumi/ide-core-common/lib/const';
10
11
 
@@ -276,6 +277,10 @@ export const corePreferenceSchema: PreferenceSchema = {
276
277
  type: 'boolean',
277
278
  default: false,
278
279
  },
280
+ [MenubarSettingId.CompactMode]: {
281
+ type: 'boolean',
282
+ default: false,
283
+ },
279
284
  },
280
285
  };
281
286
 
@@ -303,6 +308,7 @@ export interface CoreConfiguration {
303
308
  'general.language': string;
304
309
  'general.theme': string;
305
310
  'view.saveLayoutWithWorkspace': boolean;
311
+ 'menubar.compactMode': boolean;
306
312
  }
307
313
 
308
314
  export const CorePreferences = Symbol('CorePreferences');
@@ -86,6 +86,10 @@ const apiMenus: IAPIMenu[] = [
86
86
  id: MenuId.ActivityBarExtra,
87
87
  description: localize('sumiContributes.menu.api.ActivityBarExtra'),
88
88
  },
89
+ {
90
+ id: MenuId.ActivityBarTopExtra,
91
+ description: localize('sumiContributes.menu.api.ActivityBarTopExtra'),
92
+ },
89
93
  {
90
94
  id: MenuId.DebugBreakpointsContext,
91
95
  description: localize('sumiContributes.menu.api.DebugBreakpointsContext'),
@@ -15,4 +15,5 @@ export namespace VIEW_CONTAINERS {
15
15
  export const QUICKPICK_INPUT = `${VIEW_CONTAINERS_PREFIX}-quickpick-input`;
16
16
  export const QUICKPICK_TABS = `${VIEW_CONTAINERS_PREFIX}-quickpick-tabs`;
17
17
  export const QUICKPICK_ITEM = `${VIEW_CONTAINERS_PREFIX}-quickpick-item`;
18
+ export const QUICKPICK_PROGRESS = `${VIEW_CONTAINERS_PREFIX}-quickpick-progress`;
18
19
  }
@@ -22,7 +22,6 @@ export const toMarkdownHtml = (message: string): string => {
22
22
  gfm: true,
23
23
  breaks: false,
24
24
  pedantic: false,
25
- sanitize: true,
26
25
  smartLists: true,
27
26
  smartypants: false,
28
27
  renderer,
@@ -3,6 +3,7 @@ export enum MenuId {
3
3
  AccountsContext = 'accounts/context',
4
4
  ActivityBarContext = 'activityBar/context',
5
5
  ActivityBarExtra = 'activityBar/extra',
6
+ ActivityBarTopExtra = 'activityBar/top/extra',
6
7
  CommandPalette = 'commandPalette',
7
8
  DebugBreakpointsContext = 'debug/breakpoints/context',
8
9
  DebugCallStackContext = 'debug/callstack/context',
@@ -33,6 +34,7 @@ export enum MenuId {
33
34
  MenubarSwitchGroupMenu = 'menubar/switch/group',
34
35
  MenubarTerminalMenu = 'menubar/terminal',
35
36
  MenubarViewMenu = 'menubar/view',
37
+ MenubarCompactMenu = 'menubar/compact/mode',
36
38
  TerminalInstanceContext = 'terminal/instance/context',
37
39
  TerminalNewDropdownContext = 'terminal/newDropdown/context',
38
40
  TerminalTabContext = 'terminal/tab/context',
@@ -55,7 +57,7 @@ export enum MenuId {
55
57
  ViewTitle = 'view/title',
56
58
  GlobalActivity = 'global/activity',
57
59
  ExtensionContext = 'extension/context', // 插件市场 item
58
- SettingsIconMenu = 'settings/icon/menu', // 右下角 setting menu
60
+ SettingsIconMenu = 'settings/icon/menu', // 左下角 setting menu
59
61
  // The contributed comment thread context menu, rendered as buttons below the comment editor
60
62
  CommentsCommentThreadContext = 'comments/commentThread/context',
61
63
  // The contributed comment thread title menu
@@ -196,8 +196,7 @@ class Menu extends Disposable implements IMenu {
196
196
  ]);
197
197
  return action;
198
198
  } else {
199
- // 只有 label 存在值的时候才渲染
200
- if (item.label) {
199
+ if (item.label || item.iconClass) {
201
200
  const action = this.injector.get(SubmenuItemNode, [item]);
202
201
  return action;
203
202
  }
@@ -247,6 +247,7 @@ export interface QuickOpenService {
247
247
  showDecoration(type: VALIDATE_TYPE): void;
248
248
  hideDecoration(): void;
249
249
  refresh(): void;
250
+ updateOptions(options: QuickOpenOptions): void;
250
251
  }
251
252
 
252
253
  export type QuickOpenOptions = Partial<QuickOpenOptions.Resolved>;
@@ -355,6 +356,10 @@ export namespace QuickOpenOptions {
355
356
  * 内容更新后保持滚动区域不变
356
357
  */
357
358
  keepScrollPosition?: boolean;
359
+ /**
360
+ * 是否显示 progress
361
+ */
362
+ busy?: boolean;
358
363
  }
359
364
  export const defaultOptions: Resolved = Object.freeze({
360
365
  enabled: true,
@@ -39,7 +39,7 @@ export function getSlotLocation(moduleName: string, layoutConfig: LayoutConfig)
39
39
  return location;
40
40
  }
41
41
  }
42
- getDebugLogger().warn(`没有找到${moduleName}所对应的位置!`);
42
+ logger.warn(`Cannot find the location with ${moduleName}`);
43
43
  return '';
44
44
  }
45
45
 
@@ -97,14 +97,14 @@ export class ErrorBoundary extends React.Component {
97
97
  export const allSlot: { slot: string; dom: HTMLElement }[] = [];
98
98
 
99
99
  export const SlotDecorator: React.FC<{ slot: string; backgroundColor?: string }> = ({ slot, ...props }) => {
100
- const ref = React.useRef<HTMLElement>();
100
+ const ref = React.useRef<HTMLElement | null>();
101
101
  React.useEffect(() => {
102
102
  if (ref.current) {
103
103
  allSlot.push({ slot, dom: ref.current });
104
104
  }
105
105
  }, [ref]);
106
106
  return (
107
- <div ref={(ele) => (ref.current = ele!)} className='resize-wrapper'>
107
+ <div ref={(ele) => (ref.current = ele)} className='resize-wrapper'>
108
108
  {props.children}
109
109
  </div>
110
110
  );
@@ -163,12 +163,13 @@ export class SlotRendererRegistry {
163
163
  export const slotRendererRegistry = new SlotRendererRegistry();
164
164
 
165
165
  export interface SlotProps {
166
+ // Name of the slot view
166
167
  slot: string;
167
- /**
168
- * slot 默认的背景色
169
- */
168
+ // Background color of the slot view
170
169
  backgroundColor?: string;
170
+ // Is tabbar slot renderer or not
171
171
  isTabbar?: boolean;
172
+ // Optional props
172
173
  [key: string]: any;
173
174
  }
174
175
 
@@ -181,7 +182,7 @@ export function SlotRenderer({ slot, isTabbar, ...props }: SlotProps) {
181
182
  slotRendererRegistry.addTabbar(slot);
182
183
  }
183
184
  if (!componentKeys || !componentKeys.length) {
184
- getDebugLogger().warn(`No ${slot} view declared by location.`);
185
+ logger.warn(`No ${slot} view declared by location.`);
185
186
  }
186
187
  const [componentInfos, setInfos] = React.useState<ComponentRegistryInfo[]>([]);
187
188
  const updateComponentInfos = React.useCallback(() => {
@@ -189,7 +190,7 @@ export function SlotRenderer({ slot, isTabbar, ...props }: SlotProps) {
189
190
  componentKeys.forEach((token) => {
190
191
  const info = componentRegistry.getComponentRegistryInfo(token);
191
192
  if (!info) {
192
- getDebugLogger().warn(`${token} view isn't registered, please check.`);
193
+ logger.warn(`${token} view isn't registered, please check.`);
193
194
  } else {
194
195
  infos.push(info);
195
196
  }
@@ -99,6 +99,9 @@ abstract class BaseBrowserStorageService implements StorageService {
99
99
  } catch (e) {
100
100
  this.logger.error(`storage getDate error: ${e}, use defaultValue as result.`);
101
101
  }
102
+ if (defaultValue && isObject(defaultValue)) {
103
+ delete defaultValue['expires'];
104
+ }
102
105
  return defaultValue;
103
106
  }
104
107
 
@@ -1,4 +1,4 @@
1
- import { IDisposable } from '@opensumi/ide-core-common';
1
+ import { IDisposable, isUndefined } from '@opensumi/ide-core-common';
2
2
  import { IElectronMainApi } from '@opensumi/ide-core-common/lib/electron';
3
3
  import type { MessageConnection } from '@opensumi/vscode-jsonrpc';
4
4
 
@@ -12,13 +12,37 @@ export interface IElectronIpcRenderer {
12
12
  send(channel: string, ...args: any[]): void;
13
13
  }
14
14
 
15
- export function createElectronMainApi(name: string): IElectronMainApi<any> {
15
+ interface IPCMessage {
16
+ type: 'event' | 'request' | 'response';
17
+ service: string;
18
+ method: string;
19
+ requestId?: number; // for connecting 'requst' and 'response'
20
+ args: any[];
21
+ }
22
+
23
+ const getCapturer = () => {
24
+ if (window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__?.captureIPC) {
25
+ return window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__.captureIPC;
26
+ }
27
+ return;
28
+ };
29
+
30
+ const capture = (message: IPCMessage) => {
31
+ const capturer = getCapturer();
32
+ if (!isUndefined(capture)) {
33
+ // if OpenSumi DevTools is opended
34
+ capturer(message);
35
+ }
36
+ };
37
+
38
+ export function createElectronMainApi(name: string, enableCaptured?: boolean): IElectronMainApi<any> {
16
39
  let id = 0;
17
40
  return new Proxy(
18
41
  {
19
42
  on: (event: string, listener: (...args) => void): IDisposable => {
20
43
  const wrappedListener = (e, eventName, ...args) => {
21
44
  if (eventName === event) {
45
+ enableCaptured && capture({ type: 'event', service: name, method: event, args });
22
46
  return listener(...args);
23
47
  }
24
48
  };
@@ -39,6 +63,7 @@ export function createElectronMainApi(name: string): IElectronMainApi<any> {
39
63
  new Promise((resolve, reject) => {
40
64
  const requestId = id++;
41
65
  ElectronIpcRenderer.send('request:' + name, method, requestId, ...args);
66
+ enableCaptured && capture({ type: 'request', service: name, method: String(method), requestId, args });
42
67
  const listener = (event, id, error, result) => {
43
68
  if (id === requestId) {
44
69
  ElectronIpcRenderer.removeListener('response:' + name, listener);
@@ -49,6 +74,14 @@ export function createElectronMainApi(name: string): IElectronMainApi<any> {
49
74
  } else {
50
75
  resolve(result);
51
76
  }
77
+ enableCaptured &&
78
+ capture({
79
+ type: 'response',
80
+ service: name,
81
+ method: String(method),
82
+ requestId,
83
+ args: [error, result],
84
+ });
52
85
  }
53
86
  };
54
87
  ElectronIpcRenderer.on('response:' + name, listener);
@@ -2,6 +2,5 @@ export * from './env';
2
2
  export * from './electron';
3
3
  export * from './react-hooks';
4
4
  export * from './icon';
5
- export * from './parse';
6
5
  export * from './json';
7
6
  export * from './label';
@@ -1,3 +1,4 @@
1
+ import clx from 'classnames';
1
2
  import React, { CSSProperties } from 'react';
2
3
 
3
4
  import { Icon } from '@opensumi/ide-components/lib/icon/icon';
@@ -7,32 +8,52 @@ const SEPERATOR = ' ';
7
8
 
8
9
  export function transformLabelWithCodicon(
9
10
  label: string,
10
- iconStyles: CSSProperties = {},
11
+ iconStyleProps: CSSProperties | string = {},
11
12
  transformer?: (str: string) => string | undefined,
12
13
  renderText?: (str: string, index: number) => React.ReactNode,
13
14
  ) {
14
15
  const ICON_REGX = /\$\(([a-z.]+\/)?([a-z-]+)(~[a-z]+)?\)/gi;
15
16
  const ICON_WITH_ANIMATE_REGX = /\$\(([a-z.]+\/)?([a-z-]+)~([a-z]+)\)/gi;
16
- return label.split(SEPERATOR).map((e, index) => {
17
+ // some string like $() $(~spin)
18
+ const ICON_ERROR_REGX = /\$\(([a-z.]+\/)?([a-z-]+)?(~[a-z]+)?\)/gi;
19
+
20
+ const generateIconStyle = (icon?: string, styleProps?: CSSProperties | string) =>
21
+ typeof styleProps === 'string' ? { className: clx(icon, styleProps) } : { className: icon, style: styleProps };
22
+
23
+ const splitLabel = label.split(SEPERATOR);
24
+ const length = splitLabel.length;
25
+
26
+ return splitLabel.map((e, index) => {
17
27
  if (!transformer) {
18
28
  return e;
19
29
  }
20
30
  const icon = transformer(e);
21
31
  if (icon) {
22
- return <Icon className={icon} style={iconStyles} key={`${index}-${icon}`} />;
32
+ return <Icon {...generateIconStyle(icon, iconStyleProps)} key={`${index}-${icon}`} />;
23
33
  } else if (ICON_REGX.test(e)) {
24
34
  if (e.includes('~')) {
25
35
  const [, , icon, animate] = ICON_WITH_ANIMATE_REGX.exec(e) || [];
26
36
  if (animate && icon) {
27
37
  return (
28
- <Icon className={transformer(`$(${icon})`)} style={iconStyles} animate={animate} key={`${index}-${icon}`} />
38
+ <Icon
39
+ {...generateIconStyle(transformer(`$(${icon})`), iconStyleProps)}
40
+ animate={animate}
41
+ key={`${index}-${icon}`}
42
+ />
29
43
  );
30
44
  }
31
45
  }
32
46
  const newStr = e.replaceAll(ICON_REGX, (e) => `${SEPERATOR}${e}${SEPERATOR}`);
33
- return transformLabelWithCodicon(newStr, iconStyles, transformer);
47
+ return transformLabelWithCodicon(newStr, iconStyleProps, transformer);
48
+ } else if (ICON_ERROR_REGX.test(e)) {
49
+ return transformLabelWithCodicon(e.replaceAll(ICON_ERROR_REGX, ''), iconStyleProps, transformer, renderText);
34
50
  } else {
35
- return isFunction(renderText) ? renderText(e, index) : <span key={`${index}-${e}`}>{e}</span>;
51
+ const withSeperator = e + (index === length - 1 ? '' : SEPERATOR);
52
+ return isFunction(renderText) ? (
53
+ renderText(withSeperator, index)
54
+ ) : (
55
+ <span key={`${index}-${e}`}>{withSeperator}</span>
56
+ );
36
57
  }
37
58
  });
38
59
  }