@opensumi/ide-core-browser 2.27.2 → 2.27.3-next-1706077936.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 (72) hide show
  1. package/lib/bootstrap/app.d.ts +2 -2
  2. package/lib/bootstrap/app.d.ts.map +1 -1
  3. package/lib/bootstrap/app.js +13 -16
  4. package/lib/bootstrap/app.js.map +1 -1
  5. package/lib/bootstrap/app.view.d.ts +7 -4
  6. package/lib/bootstrap/app.view.d.ts.map +1 -1
  7. package/lib/bootstrap/app.view.js +8 -12
  8. package/lib/bootstrap/app.view.js.map +1 -1
  9. package/lib/bootstrap/connection.d.ts +7 -3
  10. package/lib/bootstrap/connection.d.ts.map +1 -1
  11. package/lib/bootstrap/connection.js +55 -25
  12. package/lib/bootstrap/connection.js.map +1 -1
  13. package/lib/common/common.module.d.ts +6 -2
  14. package/lib/common/common.module.d.ts.map +1 -1
  15. package/lib/common/common.module.js +2 -0
  16. package/lib/common/common.module.js.map +1 -1
  17. package/lib/components/layout/box-panel.d.ts.map +1 -1
  18. package/lib/components/layout/box-panel.js +8 -1
  19. package/lib/components/layout/box-panel.js.map +1 -1
  20. package/lib/components/layout/default-layout.d.ts +2 -2
  21. package/lib/components/layout/default-layout.d.ts.map +1 -1
  22. package/lib/components/layout/layout.d.ts +1 -1
  23. package/lib/components/layout/layout.d.ts.map +1 -1
  24. package/lib/components/layout/split-panel.d.ts.map +1 -1
  25. package/lib/components/layout/split-panel.js.map +1 -1
  26. package/lib/components/portal/index.d.ts +1 -0
  27. package/lib/components/portal/index.d.ts.map +1 -1
  28. package/lib/components/portal/index.js.map +1 -1
  29. package/lib/components/resize/resize.d.ts +3 -3
  30. package/lib/components/resize/resize.d.ts.map +1 -1
  31. package/lib/markdown/index.d.ts.map +1 -1
  32. package/lib/markdown/index.js.map +1 -1
  33. package/lib/progress/progress-indicator.d.ts.map +1 -1
  34. package/lib/react-providers/config-provider.d.ts +1 -1
  35. package/lib/react-providers/config-provider.d.ts.map +1 -1
  36. package/lib/react-providers/slot.d.ts +8 -6
  37. package/lib/react-providers/slot.d.ts.map +1 -1
  38. package/lib/react-providers/slot.js.map +1 -1
  39. package/lib/toolbar/components/button.d.ts +1 -1
  40. package/lib/toolbar/components/button.d.ts.map +1 -1
  41. package/lib/toolbar/components/button.js +4 -4
  42. package/lib/toolbar/components/button.js.map +1 -1
  43. package/lib/toolbar/components/dropdown-button.d.ts +2 -2
  44. package/lib/toolbar/components/dropdown-button.d.ts.map +1 -1
  45. package/lib/toolbar/components/select.d.ts +2 -2
  46. package/lib/toolbar/components/select.d.ts.map +1 -1
  47. package/lib/toolbar/toolbar.d.ts +2 -2
  48. package/lib/toolbar/toolbar.d.ts.map +1 -1
  49. package/lib/toolbar/toolbar.js +17 -18
  50. package/lib/toolbar/toolbar.js.map +1 -1
  51. package/lib/utils/create-overlay.d.ts.map +1 -1
  52. package/lib/utils/create-overlay.js +2 -1
  53. package/lib/utils/create-overlay.js.map +1 -1
  54. package/lib/utils/electron.d.ts +8 -2
  55. package/lib/utils/electron.d.ts.map +1 -1
  56. package/lib/utils/electron.js +9 -5
  57. package/lib/utils/electron.js.map +1 -1
  58. package/package.json +9 -8
  59. package/src/bootstrap/app.ts +22 -26
  60. package/src/bootstrap/app.view.tsx +13 -16
  61. package/src/bootstrap/connection.ts +73 -28
  62. package/src/common/common.module.ts +2 -0
  63. package/src/components/layout/box-panel.tsx +9 -0
  64. package/src/components/layout/split-panel.tsx +0 -1
  65. package/src/components/portal/index.tsx +1 -0
  66. package/src/markdown/index.tsx +5 -1
  67. package/src/progress/progress-indicator.ts +1 -1
  68. package/src/react-providers/slot.tsx +8 -3
  69. package/src/toolbar/components/button.tsx +5 -7
  70. package/src/toolbar/toolbar.tsx +15 -18
  71. package/src/utils/create-overlay.tsx +2 -1
  72. package/src/utils/electron.ts +13 -5
@@ -1,5 +1,5 @@
1
+ import { NetSocketConnection } from '@opensumi/ide-connection/lib/common/connection';
1
2
  import { IElectronMainApi } from '@opensumi/ide-core-common/lib/electron';
2
- import type { MessageConnection } from '@opensumi/vscode-jsonrpc';
3
3
  export interface IElectronIpcRenderer {
4
4
  on(channel: string, listener: (event: any, ...args: any[]) => void): any;
5
5
  once(channel: string, listener: (event: any, ...args: any[]) => void): any;
@@ -8,12 +8,17 @@ export interface IElectronIpcRenderer {
8
8
  send(channel: string, ...args: any[]): void;
9
9
  }
10
10
  export declare function createElectronMainApi(name: string, enableCaptured?: boolean): IElectronMainApi<any>;
11
+ export interface IElectronEnvMetadata {
12
+ windowClientId: string;
13
+ [key: string]: any;
14
+ }
11
15
  export declare const electronEnv: {
12
16
  currentWindowId: number;
13
17
  currentWebContentsId: number;
14
18
  ipcRenderer: IElectronIpcRenderer;
15
19
  webviewPreload: string;
16
20
  plainWebviewPreload: string;
21
+ metadata: IElectronEnvMetadata;
17
22
  [key: string]: any;
18
23
  };
19
24
  export interface IElectronNativeDialogService {
@@ -21,5 +26,6 @@ export interface IElectronNativeDialogService {
21
26
  showSaveDialog(options: Electron.SaveDialogOptions): Promise<string | undefined>;
22
27
  }
23
28
  export declare const IElectronNativeDialogService: unique symbol;
24
- export declare function createElectronClientConnection(connectPath?: string): MessageConnection;
29
+ export declare function createNetSocketConnection(connectPath?: string): NetSocketConnection;
30
+ export declare function fromWindowClientId(suffix: string): string;
25
31
  //# sourceMappingURL=electron.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"electron.d.ts","sourceRoot":"","sources":["../../src/utils/electron.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAIlE,MAAM,WAAW,oBAAoB;IACnC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,OAAE;IACpE,IAAI,C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iBAAiB,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IACnF,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,iBAAiB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAClF;AAED,eAAO,MAAM,4BAA4B,eAAyC,CAAC;AAEnF,wBAAgB,yBAAyB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAQnF;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,UAEhD"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createElectronClientConnection = exports.IElectronNativeDialogService = exports.electronEnv = exports.createElectronMainApi = void 0;
3
+ exports.fromWindowClientId = exports.createNetSocketConnection = exports.IElectronNativeDialogService = exports.electronEnv = exports.createElectronMainApi = void 0;
4
+ const connection_1 = require("@opensumi/ide-connection/lib/common/connection");
4
5
  const ide_core_common_1 = require("@opensumi/ide-core-common");
5
6
  const getCapturer = () => {
6
7
  var _a;
@@ -76,7 +77,7 @@ if (typeof ElectronIpcRenderer !== 'undefined') {
76
77
  exports.electronEnv.ipcRenderer = ElectronIpcRenderer;
77
78
  }
78
79
  exports.IElectronNativeDialogService = Symbol('IElectronNativeDialogService');
79
- function createElectronClientConnection(connectPath) {
80
+ function createNetSocketConnection(connectPath) {
80
81
  let socket;
81
82
  if (connectPath) {
82
83
  socket = exports.electronEnv.createNetConnection(connectPath);
@@ -84,8 +85,11 @@ function createElectronClientConnection(connectPath) {
84
85
  else {
85
86
  socket = exports.electronEnv.createRPCNetConnection();
86
87
  }
87
- const { createSocketConnection } = require('@opensumi/ide-connection/lib/node/connect');
88
- return createSocketConnection(socket);
88
+ return new connection_1.NetSocketConnection(socket);
89
89
  }
90
- exports.createElectronClientConnection = createElectronClientConnection;
90
+ exports.createNetSocketConnection = createNetSocketConnection;
91
+ function fromWindowClientId(suffix) {
92
+ return `${suffix}-${exports.electronEnv.metadata.windowClientId}`;
93
+ }
94
+ exports.fromWindowClientId = fromWindowClientId;
91
95
  //# sourceMappingURL=electron.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"electron.js","sourceRoot":"","sources":["../../src/utils/electron.ts"],"names":[],"mappings":";;;AAAA,+DAAmE;AAsBnE,MAAM,WAAW,GAAG,GAAG,EAAE;;IACvB,IAAI,MAAA,MAAM,CAAC,iCAAiC,0CAAE,UAAU,EAAE;QACxD,OAAO,MAAM,CAAC,iCAAiC,CAAC,UAAU,CAAC;KAC5D;IACD,OAAO;AACT,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,OAAmB,EAAE,EAAE;IACtC,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,IAAI,IAAA,2BAAS,EAAC,QAAQ,CAAC,EAAE;QACvB,kCAAkC;QAClC,QAAQ,CAAC,OAAO,CAAC,CAAC;KACnB;AACH,CAAC,CAAC;AAEF,SAAgB,qBAAqB,CAAC,IAAY,EAAE,cAAwB;IAC1E,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,OAAO,IAAI,KAAK,CACd;QACE,EAAE,EAAE,CAAC,KAAa,EAAE,QAA2B,EAAe,EAAE;YAC9D,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE;gBAChD,IAAI,SAAS,KAAK,KAAK,EAAE;oBACvB,cAAc,IAAI,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;oBACjF,OAAO,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;iBAC1B;YACH,CAAC,CAAC;YACF,mBAAmB,CAAC,EAAE,CAAC,QAAQ,GAAG,IAAI,EAAE,eAAe,CAAC,CAAC;YACzD,OAAO;gBACL,OAAO,EAAE,GAAG,EAAE;oBACZ,mBAAmB,CAAC,cAAc,CA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B,CAAC,WAAoB;IAC5D,IAAI,MAAM,CAAC;IACX,IAAI,WAAW,EAAE;QACf,MAAM,GAAG,mBAAW,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;KACvD;SAAM;QACL,MAAM,GAAG,mBAAW,CAAC,sBAAsB,EAAE,CAAC;KAC/C;IACD,OAAO,IAAI,gCAAmB,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC;AARD,8DAQC;AAED,SAAgB,kBAAkB,CAAC,MAAc;IAC/C,OAAO,GAAG,MAAM,IAAI,mBAAW,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC;AAC5D,CAAC;AAFD,gDAEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/ide-core-browser",
3
- "version": "2.27.2",
3
+ "version": "2.27.3-next-1706077936.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.27.2",
22
- "@opensumi/ide-connection": "2.27.2",
23
- "@opensumi/ide-core-common": "2.27.2",
21
+ "@opensumi/ide-components": "2.27.3-next-1706077936.0",
22
+ "@opensumi/ide-connection": "2.27.3-next-1706077936.0",
23
+ "@opensumi/ide-core-common": "2.27.3-next-1706077936.0",
24
24
  "@opensumi/vscode-debugprotocol": "1.49.0-beta.1",
25
25
  "@vscode/codicons": "0.0.27",
26
26
  "ajv": "^6.10.0",
@@ -29,11 +29,12 @@
29
29
  "fuzzy": "^0.1.3",
30
30
  "jsonc-parser": "^2.1.0",
31
31
  "keycode": "^2.2.0",
32
- "lodash": "^4.17.15",
32
+ "lodash": "^4.17.21",
33
33
  "mobx": "^5.9.4",
34
34
  "mobx-react-lite": "^1.3.1",
35
35
  "onigasm": "2.2.2",
36
36
  "rc-menu": "^9.3.2",
37
+ "react": "^18.0.0",
37
38
  "react-autosize-textarea": "^7.0.0",
38
39
  "react-ctxmenu-trigger": "^1.0.0",
39
40
  "react-custom-scrollbars": "^4.2.1",
@@ -45,10 +46,10 @@
45
46
  "vscode-textmate": "7.0.1"
46
47
  },
47
48
  "devDependencies": {
48
- "react": "^16.8.6"
49
+ "react": "^18.0.0"
49
50
  },
50
51
  "peerDependencies": {
51
- "react": ">=16.8.6"
52
+ "react": ">=18.0.0"
52
53
  },
53
- "gitHead": "4e91cc8361995d7de03b5d67f346c5ad74fa0efb"
54
+ "gitHead": "aee2428fd9fc6117cf124170e2c0eda48a7b62ca"
54
55
  }
@@ -6,7 +6,7 @@ import '@opensumi/monaco-editor-core/esm/vs/editor/editor.main';
6
6
  import ResizeObserver from 'resize-observer-polyfill';
7
7
 
8
8
  import { Injector } from '@opensumi/di';
9
- import { RPCMessageConnection } from '@opensumi/ide-connection';
9
+ import { WSChannel } from '@opensumi/ide-connection';
10
10
  import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser';
11
11
  import {
12
12
  CommandRegistry,
@@ -45,7 +45,6 @@ import {
45
45
  } from '@opensumi/ide-core-common/lib/const/application';
46
46
  import { IElectronMainLifeCycleService } from '@opensumi/ide-core-common/lib/electron';
47
47
 
48
- import { createElectronClientConnection } from '..';
49
48
  import { ClientAppStateService } from '../application';
50
49
  import { BrowserModule, IClientApp } from '../browser-module';
51
50
  import { ClientAppContribution } from '../common';
@@ -71,7 +70,7 @@ import { electronEnv } from '../utils';
71
70
 
72
71
  import { IClientAppOpts, IconInfo, IconMap, IPreferences, LayoutConfig, ModuleConstructor } from './app.interface';
73
72
  import { renderClientApp, IAppRenderer } from './app.view';
74
- import { createClientConnection2, bindConnectionService } from './connection';
73
+ import { createClientConnection4Web, createClientConnection4Electron, bindConnectionService } from './connection';
75
74
  import { injectInnerProviders } from './inner-providers';
76
75
  import { injectElectronInnerProviders } from './inner-providers-electron';
77
76
 
@@ -208,35 +207,33 @@ export class ClientApp implements IClientApp, IDisposable {
208
207
  public async start(
209
208
  container: HTMLElement | IAppRenderer,
210
209
  type?: 'electron' | 'web',
211
- connection?: RPCMessageConnection,
210
+ channel?: WSChannel,
212
211
  ): Promise<void> {
213
212
  const reporterService: IReporterService = this.injector.get(IReporterService);
214
213
  const measureReporter = reporterService.time(REPORT_NAME.MEASURE);
215
214
 
216
215
  this.lifeCycleService.phase = LifeCyclePhase.Prepare;
217
216
 
218
- if (connection) {
219
- await bindConnectionService(this.injector, this.modules, connection);
220
- } else {
221
- if (type === 'electron') {
222
- await bindConnectionService(this.injector, this.modules, createElectronClientConnection());
223
- } else if (type === 'web') {
224
- await createClientConnection2(
225
- this.injector,
226
- this.modules,
227
- this.connectionPath,
228
- () => {
229
- this.onReconnectContributions();
230
- },
231
- this.connectionProtocols,
232
- this.config.clientId,
233
- );
234
-
235
- this.logger = this.getLogger();
236
- // Replace Logger
237
- this.injector.get(WSChannelHandler).replaceLogger(this.logger);
238
- }
217
+ if (channel) {
218
+ await bindConnectionService(this.injector, this.modules, channel);
219
+ } else if (type === 'electron') {
220
+ await createClientConnection4Electron(this.injector, this.modules, this.config.clientId);
221
+ } else if (type === 'web') {
222
+ await createClientConnection4Web(
223
+ this.injector,
224
+ this.modules,
225
+ this.connectionPath,
226
+ () => {
227
+ this.onReconnectContributions();
228
+ },
229
+ this.connectionProtocols,
230
+ this.config.clientId,
231
+ );
232
+ this.logger = this.getLogger();
233
+ // Replace Logger
234
+ this.injector.get(WSChannelHandler).replaceLogger(this.logger);
239
235
  }
236
+
240
237
  measureReporter.timeEnd('ClientApp.createConnection');
241
238
 
242
239
  this.logger = this.getLogger();
@@ -402,7 +399,6 @@ export class ClientApp implements IClientApp, IDisposable {
402
399
  const eventBus = this.injector.get(IEventBus);
403
400
  eventBus.fire(new RenderedEvent());
404
401
  }
405
-
406
402
  protected async measure<T>(name: string, fn: () => MaybePromise<T>): Promise<T> {
407
403
  const reporterService: IReporterService = this.injector.get(IReporterService);
408
404
  const measureReporter = reporterService.time(REPORT_NAME.MEASURE);
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import ReactDom from 'react-dom';
2
+ import ReactDom from 'react-dom/client';
3
3
 
4
4
  import { ComponentContextProvider, IIconResourceOptions } from '@opensumi/ide-components';
5
5
  import { getDebugLogger, IEventBus, URI, localize } from '@opensumi/ide-core-common';
@@ -14,7 +14,8 @@ import { getIcon } from '../style/icon/icon';
14
14
 
15
15
  export interface AppProps {
16
16
  app: IClientApp;
17
- main: React.ComponentType;
17
+ main: React.ComponentType<{ callback?: () => void }>;
18
+ callback?: () => void;
18
19
  overlays?: React.ComponentType[];
19
20
  }
20
21
 
@@ -26,6 +27,7 @@ export function App(props: AppProps) {
26
27
  (uri: string, options: IIconResourceOptions) => labelService.getIcon(URI.parse(uri), options),
27
28
  [],
28
29
  );
30
+
29
31
  React.useEffect(() => {
30
32
  let lastFrame: number | null;
31
33
  const handle = () => {
@@ -47,26 +49,21 @@ export function App(props: AppProps) {
47
49
  return (
48
50
  <ComponentContextProvider value={{ getIcon, localize, getResourceIcon }}>
49
51
  <ConfigProvider value={props.app.config}>
50
- {<props.main />}
52
+ {<props.main callback={props.callback} />}
51
53
  {props.overlays && props.overlays.map((Component, index) => <Component key={index} />)}
52
54
  </ConfigProvider>
53
55
  </ComponentContextProvider>
54
56
  );
55
57
  }
56
58
 
57
- export type IAppRenderer = (app: React.ReactElement) => Promise<void>;
59
+ export type IAppRenderer = (app: (props: any) => JSX.Element) => void;
58
60
 
59
61
  const defaultAppRender =
60
- (dom: HTMLElement, onDidRendered?: () => void): IAppRenderer =>
61
- (app) =>
62
- new Promise((resolve) => {
63
- ReactDom.render(app, dom, () => {
64
- if (onDidRendered && typeof onDidRendered === 'function') {
65
- onDidRendered();
66
- }
67
- resolve();
68
- });
69
- });
62
+ (dom: HTMLElement): IAppRenderer =>
63
+ (IDEApp: (props: any) => JSX.Element) => {
64
+ const root = ReactDom.createRoot(dom);
65
+ root.render(<IDEApp />);
66
+ };
70
67
 
71
68
  export function renderClientApp(app: IClientApp, container: HTMLElement | IAppRenderer) {
72
69
  const Layout = app.config.layoutComponent || DefaultLayout;
@@ -80,9 +77,9 @@ export function renderClientApp(app: IClientApp, container: HTMLElement | IAppRe
80
77
  return module.component;
81
78
  });
82
79
 
83
- const IdeApp = <App app={app} main={Layout} overlays={overlayComponents} />;
80
+ const IdeApp = (props) => <App {...props} app={app} main={Layout} overlays={overlayComponents} />;
84
81
 
85
- const render = typeof container === 'function' ? container : defaultAppRender(container, app.config.didRendered);
82
+ const render = typeof container === 'function' ? container : defaultAppRender(container);
86
83
 
87
84
  return render(IdeApp);
88
85
  }
@@ -1,7 +1,8 @@
1
1
  import { Injector, Provider } from '@opensumi/di';
2
- import { RPCServiceCenter, initRPCService, RPCMessageConnection } from '@opensumi/ide-connection';
2
+ import { RPCServiceCenter, WSChannel, initRPCService } from '@opensumi/ide-connection';
3
3
  import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser';
4
- import { createWebSocketConnection } from '@opensumi/ide-connection/lib/common/message';
4
+ import { NetSocketConnection } from '@opensumi/ide-connection/lib/common/connection';
5
+ import { ReconnectingWebSocketConnection } from '@opensumi/ide-connection/lib/common/connection/drivers/reconnecting-websocket';
5
6
  import {
6
7
  getDebugLogger,
7
8
  IReporterService,
@@ -15,63 +16,104 @@ import {
15
16
  import { BackService } from '@opensumi/ide-core-common/lib/module';
16
17
 
17
18
  import { ClientAppStateService } from '../application';
19
+ import { createNetSocketConnection, fromWindowClientId } from '../utils';
18
20
 
19
21
  import { ModuleConstructor } from './app.interface';
20
22
 
21
23
  const initialLogger = getDebugLogger();
22
24
 
23
- export async function createClientConnection2(
25
+ export async function createClientConnection4Web(
24
26
  injector: Injector,
25
27
  modules: ModuleConstructor[],
26
28
  wsPath: UrlProvider,
27
29
  onReconnect: () => void,
28
30
  protocols?: string[],
29
31
  clientId?: string,
32
+ ) {
33
+ return createConnectionService(
34
+ injector,
35
+ modules,
36
+ onReconnect,
37
+ ReconnectingWebSocketConnection.forURL(wsPath, protocols),
38
+ clientId,
39
+ );
40
+ }
41
+
42
+ export async function createClientConnection4Electron(
43
+ injector: Injector,
44
+ modules: ModuleConstructor[],
45
+ clientId?: string,
46
+ ) {
47
+ const connection = createNetSocketConnection();
48
+ const channel = WSChannel.forClient(connection, {
49
+ id: clientId || fromWindowClientId('RPCService'),
50
+ logger: console,
51
+ });
52
+ return bindConnectionService(injector, modules, channel);
53
+ }
54
+
55
+ export async function createConnectionService(
56
+ injector: Injector,
57
+ modules: ModuleConstructor[],
58
+ onReconnect: () => void,
59
+ connection: ReconnectingWebSocketConnection | NetSocketConnection,
60
+ clientId?: string,
30
61
  ) {
31
62
  const reporterService: IReporterService = injector.get(IReporterService);
32
63
  const eventBus = injector.get(IEventBus);
33
64
  const stateService = injector.get(ClientAppStateService);
34
65
 
35
- const wsChannelHandler = new WSChannelHandler(wsPath, initialLogger, protocols, clientId);
36
- wsChannelHandler.setReporter(reporterService);
37
- wsChannelHandler.connection.addEventListener('open', async () => {
38
- await stateService.reachedState('core_module_initialized');
39
- eventBus.fire(new BrowserConnectionOpenEvent());
40
- });
66
+ const channelHandler = new WSChannelHandler(connection, initialLogger, clientId);
67
+ channelHandler.setReporter(reporterService);
68
+
69
+ const onOpen = () => {
70
+ stateService.reachedState('core_module_initialized').then(() => {
71
+ eventBus.fire(new BrowserConnectionOpenEvent());
72
+ });
73
+ };
74
+
75
+ if (channelHandler.connection.isOpen()) {
76
+ onOpen();
77
+ } else {
78
+ const dispose = channelHandler.connection.onOpen(() => {
79
+ onOpen();
80
+ dispose.dispose();
81
+ });
82
+ }
41
83
 
42
- wsChannelHandler.connection.addEventListener('close', async () => {
43
- await stateService.reachedState('core_module_initialized');
44
- eventBus.fire(new BrowserConnectionCloseEvent());
84
+ channelHandler.connection.onceClose(() => {
85
+ stateService.reachedState('core_module_initialized').then(() => {
86
+ eventBus.fire(new BrowserConnectionCloseEvent());
87
+ });
45
88
  });
46
89
 
47
- wsChannelHandler.connection.addEventListener('error', async (e) => {
48
- await stateService.reachedState('core_module_initialized');
49
- eventBus.fire(new BrowserConnectionErrorEvent(e));
90
+ channelHandler.connection.onError((e) => {
91
+ stateService.reachedState('core_module_initialized').then(() => {
92
+ eventBus.fire(new BrowserConnectionErrorEvent(e));
93
+ });
50
94
  });
51
95
 
52
- await wsChannelHandler.initHandler();
96
+ await channelHandler.initHandler();
53
97
 
54
98
  injector.addProviders({
55
99
  token: WSChannelHandler,
56
- useValue: wsChannelHandler,
100
+ useValue: channelHandler,
57
101
  });
102
+
58
103
  // 重连不会执行后面的逻辑
59
- const channel = await wsChannelHandler.openChannel('RPCService');
60
- channel.onReOpen(() => onReconnect());
104
+ const channel = await channelHandler.openChannel('RPCService');
105
+ channel.onReopen(() => onReconnect());
61
106
 
62
- bindConnectionService(injector, modules, createWebSocketConnection(channel));
107
+ bindConnectionService(injector, modules, channel);
63
108
  }
64
109
 
65
- export async function bindConnectionService(
66
- injector: Injector,
67
- modules: ModuleConstructor[],
68
- connection: RPCMessageConnection,
69
- ) {
110
+ export async function bindConnectionService(injector: Injector, modules: ModuleConstructor[], channel: WSChannel) {
70
111
  const clientCenter = new RPCServiceCenter();
71
- clientCenter.setConnection(connection);
112
+ const dispose = clientCenter.setChannel(channel);
72
113
 
73
- connection.onClose(() => {
74
- clientCenter.removeConnection(connection);
114
+ const toRemove = channel.onClose(() => {
115
+ dispose.dispose();
116
+ toRemove();
75
117
  });
76
118
 
77
119
  const { getRPCService } = initRPCService(clientCenter);
@@ -85,6 +127,9 @@ export async function bindConnectionService(
85
127
  if (moduleInstance.backServices) {
86
128
  for (const backService of moduleInstance.backServices) {
87
129
  backServiceArr.push(backService);
130
+ if (backService.protocol) {
131
+ clientCenter.loadProtocol(backService.protocol);
132
+ }
88
133
  }
89
134
  }
90
135
  }
@@ -1,4 +1,5 @@
1
1
  import { Injectable, Provider } from '@opensumi/di';
2
+ import { CommonServerProtocol } from '@opensumi/ide-connection/lib/common/protocols/common-server';
2
3
  import { CommonServerPath, CryptoServicePath, KeytarServicePath } from '@opensumi/ide-core-common';
3
4
 
4
5
  import { AuthenticationContribution } from '../authentication/authentication.contribution';
@@ -29,6 +30,7 @@ export class ClientCommonModule extends BrowserModule {
29
30
  backServices = [
30
31
  {
31
32
  servicePath: CommonServerPath,
33
+ protocol: CommonServerProtocol,
32
34
  },
33
35
  {
34
36
  servicePath: KeytarServicePath,
@@ -1,6 +1,9 @@
1
1
  import clsx from 'classnames';
2
2
  import React from 'react';
3
3
 
4
+ import { useInjectable } from '../../react-hooks';
5
+ import { AppConfig } from '../../react-providers';
6
+
4
7
  import { Layout } from './layout';
5
8
  import styles from './styles.module.less';
6
9
 
@@ -56,9 +59,15 @@ export const BoxPanel: React.FC<{
56
59
  }> = ({ className, children = [], direction = 'left-to-right', ...restProps }) => {
57
60
  // convert children to list
58
61
  const arrayChildren = React.Children.toArray(children) as ChildComponent[];
62
+ const appConfig = useInjectable<AppConfig>(AppConfig);
59
63
 
60
64
  return (
61
65
  <div
66
+ ref={() => {
67
+ if (appConfig.didRendered) {
68
+ appConfig.didRendered();
69
+ }
70
+ }}
62
71
  {...restProps}
63
72
  className={clsx(styles['box-panel'], className)}
64
73
  style={{ flexDirection: Layout.getFlexDirection(direction), zIndex: restProps['z-index'] }}
@@ -112,7 +112,6 @@ export const SplitPanel: React.FC<SplitPanelProps> = ({
112
112
  () => childList.reduce((accumulator, item) => accumulator + getProp(item, 'flex', 1), 0),
113
113
  [childList],
114
114
  );
115
-
116
115
  const resizeDelegates = React.useRef<IResizeHandleDelegate[]>([]);
117
116
  const eventBus = useInjectable<IEventBus>(IEventBus);
118
117
  const rootRef = React.useRef<HTMLElement>();
@@ -5,6 +5,7 @@ import { usePortal } from '../../react-hooks';
5
5
 
6
6
  const Portal: React.FC<{
7
7
  id: string;
8
+ children: React.ReactChild;
8
9
  }> = ({ id, children }) => {
9
10
  const target = usePortal(id);
10
11
  return ReactDOM.createPortal(children, target);
@@ -5,7 +5,11 @@ import { createMarkedRenderer, toMarkdownHtml as toHtml, IMarkedOptions } from '
5
5
 
6
6
  import { IOpenerService } from '../opener';
7
7
 
8
- export const toMarkdown = (message: string | React.ReactNode, opener?: IOpenerService, options?: IMarkedOptions): React.ReactNode =>
8
+ export const toMarkdown = (
9
+ message: string | React.ReactNode,
10
+ opener?: IOpenerService,
11
+ options?: IMarkedOptions,
12
+ ): React.ReactNode =>
9
13
  typeof message === 'string' ? (
10
14
  <RenderWrapper opener={opener} html={toMarkdownHtml(message, options)}></RenderWrapper>
11
15
  ) : (
@@ -45,7 +45,7 @@ export class ProgressIndicator implements IProgressIndicator {
45
45
  this.doDone(false);
46
46
  }
47
47
 
48
- private scheduled: NodeJS.Timer;
48
+ private scheduled: NodeJS.Timeout;
49
49
  private showOnceScheduler(delay?: number) {
50
50
  if (typeof delay === 'number') {
51
51
  clearTimeout(this.scheduled);
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { PropsWithChildren } from 'react';
2
2
 
3
3
  import { Button } from '@opensumi/ide-components';
4
4
  import { getDebugLogger, localize } from '@opensumi/ide-core-common';
@@ -59,7 +59,7 @@ export function getTabbarCtxKey(location: string): TabbarContextKeys {
59
59
  return standardTabbarCtxKeys[location] || 'activeExtendViewlet';
60
60
  }
61
61
 
62
- export class ErrorBoundary extends React.Component {
62
+ export class ErrorBoundary extends React.Component<PropsWithChildren<any>> {
63
63
  state = { error: null, errorInfo: null };
64
64
 
65
65
  componentDidCatch(error, errorInfo) {
@@ -96,7 +96,12 @@ export class ErrorBoundary extends React.Component {
96
96
 
97
97
  export const allSlot: { slot: string; dom: HTMLElement }[] = [];
98
98
 
99
- export const SlotDecorator: React.FC<{ slot: string; backgroundColor?: string }> = ({ slot, ...props }) => {
99
+ export const SlotDecorator: React.FC<{
100
+ slot: string;
101
+ color?: string;
102
+ children: React.ReactChild;
103
+ backgroundColor?: string;
104
+ }> = ({ slot, ...props }) => {
100
105
  const ref = React.useRef<HTMLElement | null>();
101
106
  React.useEffect(() => {
102
107
  if (ref.current) {
@@ -1,6 +1,7 @@
1
1
  import classnames from 'classnames';
2
- import React from 'react';
2
+ import React, { PropsWithChildren } from 'react';
3
3
  import ReactDOM from 'react-dom';
4
+ import ReactDOMClient from 'react-dom/client';
4
5
 
5
6
  import { Injectable, Autowired } from '@opensumi/di';
6
7
  import { Button } from '@opensumi/ide-components';
@@ -218,7 +219,7 @@ export class ToolbarActionBtnClickEvent extends BasicEvent<{
218
219
 
219
220
  const popOverMap = new Map<string, Promise<HTMLDivElement>>();
220
221
 
221
- const PopOverComponentWrapper: React.FC<{ delegate: IToolbarActionBtnDelegate }> = (props) => {
222
+ const PopOverComponentWrapper: React.FC<PropsWithChildren<{ delegate: IToolbarActionBtnDelegate }>> = (props) => {
222
223
  const [context, setContext] = React.useState();
223
224
 
224
225
  React.useEffect(() => {
@@ -338,17 +339,14 @@ class ToolbarBtnDelegate implements IToolbarActionBtnDelegate {
338
339
  this._popOverElement = new Promise((resolve) => {
339
340
  const div = document.createElement('div');
340
341
  const C = this.popoverComponent!;
341
- ReactDOM.render(
342
+ ReactDOMClient.createRoot(div).render(
342
343
  <ConfigProvider value={this.context}>
343
344
  <PopOverComponentWrapper delegate={this}>
344
345
  <C />
345
346
  </PopOverComponentWrapper>
346
347
  </ConfigProvider>,
347
- div,
348
- () => {
349
- resolve(div);
350
- },
351
348
  );
349
+ resolve(div);
352
350
  });
353
351
  popOverMap.set(this.actionId, this._popOverElement);
354
352
  }
@@ -1,7 +1,7 @@
1
1
  import classnames from 'classnames';
2
2
  import throttle from 'lodash/throttle';
3
3
  import React from 'react';
4
- import ReactDOM from 'react-dom';
4
+ import ReactDOM from 'react-dom/client';
5
5
 
6
6
  import { IEventBus, Disposable, Emitter } from '@opensumi/ide-core-common';
7
7
 
@@ -638,7 +638,7 @@ class ToolbarActionRenderer {
638
638
  element.classList.add(...this.resolvedToolbarAction.extraClassNames);
639
639
  }
640
640
  let setInDropDown: (inDropDown: boolean) => void | undefined;
641
- ReactDOM.render(
641
+ ReactDOM.createRoot(element).render(
642
642
  <ToolbarActionRenderWrapper
643
643
  initialInDropDown={inDropDown}
644
644
  action={this.toolbarAction}
@@ -651,23 +651,20 @@ class ToolbarActionRenderer {
651
651
  }}
652
652
  location={location}
653
653
  />,
654
- element,
655
- () => {
656
- if (canceled) {
657
- reject('canceled render toolbar');
658
- } else {
659
- this.reactElement = {
660
- element,
661
- setInDropDown: (inDropdown: boolean) => {
662
- if (setInDropDown) {
663
- setInDropDown(inDropdown);
664
- }
665
- },
666
- };
667
- resolve(element);
668
- }
669
- },
670
654
  );
655
+ if (canceled) {
656
+ reject('canceled render toolbar');
657
+ } else {
658
+ this.reactElement = {
659
+ element,
660
+ setInDropDown: (inDropdown: boolean) => {
661
+ if (setInDropDown) {
662
+ setInDropDown(inDropdown);
663
+ }
664
+ },
665
+ };
666
+ resolve(element);
667
+ }
671
668
  }
672
669
  }).then((resolved) => {
673
670
  this.renderPromise.resolved = resolved;