@lvce-editor/panel-worker 2.10.4 → 2.11.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.
@@ -1646,12 +1646,17 @@ const layoutCommands = {
1646
1646
  handleClickMaximize: 'Layout.maximizePanel',
1647
1647
  handleClickUnmaximize: 'Layout.unmaximizePanel'
1648
1648
  };
1649
- const handleMessagePort = async (port, viewletCommandMap) => {
1649
+ const forwardLayoutCommand = layoutCommand => {
1650
+ setTimeout(() => {
1651
+ void invoke('Viewlet.forwardRendererWorkerCommand', layoutCommand);
1652
+ }, 0);
1653
+ };
1654
+ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
1650
1655
  const executeViewletCommand = async (uid, command, ...args) => {
1651
1656
  const layoutCommand = layoutCommands[command];
1652
1657
  if (layoutCommand) {
1653
- // The layout command can resize this worker before it completes.
1654
- void invoke$1(layoutCommand);
1658
+ // Forward after this direct event returns so layout callbacks use an idle worker RPC.
1659
+ forwardLayoutCommand(layoutCommand);
1655
1660
  return;
1656
1661
  }
1657
1662
  const fn = viewletCommandMap[`Panel.${command}`];
@@ -1667,7 +1672,9 @@ const handleMessagePort = async (port, viewletCommandMap) => {
1667
1672
  },
1668
1673
  messagePort: port
1669
1674
  });
1670
- set(rpc);
1675
+ if (setAsRendererProcess) {
1676
+ set(rpc);
1677
+ }
1671
1678
  };
1672
1679
 
1673
1680
  const setBadgeCount = (state, id, count) => {
@@ -2444,7 +2451,7 @@ const selectName = async (state, name) => {
2444
2451
  return selectIndex(state, index);
2445
2452
  };
2446
2453
 
2447
- const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
2454
+ const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
2448
2455
  const commandMap = {
2449
2456
  'Panel.create': create,
2450
2457
  'Panel.diff2': diff2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/panel-worker",
3
- "version": "2.10.4",
3
+ "version": "2.11.0",
4
4
  "description": "Panel Worker",
5
5
  "repository": {
6
6
  "type": "git",