@lvce-editor/running-extensions-view 1.23.0 → 1.24.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.
@@ -1973,9 +1973,19 @@ const set = rpc => {
1973
1973
  state.connected = true;
1974
1974
  };
1975
1975
 
1976
- const handleMessagePort = async port => {
1976
+ const handleMessagePort = async (port, viewletCommandMap) => {
1977
+ const executeViewletCommand = async (uid, command, ...args) => {
1978
+ const fn = viewletCommandMap[`RunningExtensions.${command}`];
1979
+ if (typeof fn !== 'function') {
1980
+ throw new TypeError(`Viewlet command not found: ${command}`);
1981
+ }
1982
+ await fn(uid, ...args);
1983
+ await invoke$1('Viewlet.requestRender', uid);
1984
+ };
1977
1985
  const rpc = await create$6({
1978
- commandMap: {},
1986
+ commandMap: {
1987
+ 'Viewlet.executeViewletCommand': executeViewletCommand
1988
+ },
1979
1989
  messagePort: port
1980
1990
  });
1981
1991
  set(rpc);
@@ -2656,6 +2666,7 @@ const takeHeapSnapshot = async (state, index) => {
2656
2666
  return state;
2657
2667
  };
2658
2668
 
2669
+ const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
2659
2670
  const commandMap = {
2660
2671
  'RunningExtensions.copyId': wrapCommand(copyId$1),
2661
2672
  'RunningExtensions.create': create,
@@ -2669,7 +2680,7 @@ const commandMap = {
2669
2680
  'RunningExtensions.handleBlur': wrapCommand(handleBlur),
2670
2681
  'RunningExtensions.handleClickAt': wrapCommand(handleClickAt),
2671
2682
  'RunningExtensions.handleContextMenu': wrapCommand(handleContextMenu),
2672
- 'RunningExtensions.handleMessagePort': handleMessagePort,
2683
+ 'RunningExtensions.handleMessagePort': handleDirectMessagePort,
2673
2684
  'RunningExtensions.loadContent': wrapCommand(loadContent),
2674
2685
  'RunningExtensions.render2': render2,
2675
2686
  'RunningExtensions.renderEventListeners': renderEventListeners,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/running-extensions-view",
3
- "version": "1.23.0",
3
+ "version": "1.24.0",
4
4
  "description": "Running Extensions View Worker",
5
5
  "repository": {
6
6
  "type": "git",