@lvce-editor/title-bar-worker 4.17.1 → 4.18.1

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.
@@ -3548,9 +3548,19 @@ const set = rpc => {
3548
3548
  state.connected = true;
3549
3549
  };
3550
3550
 
3551
- const handleMessagePort = async port => {
3551
+ const handleMessagePort = async (port, viewletCommandMap) => {
3552
+ const executeViewletCommand = async (uid, command, ...args) => {
3553
+ const fn = viewletCommandMap[`TitleBar.${command}`];
3554
+ if (typeof fn !== 'function') {
3555
+ throw new TypeError(`Viewlet command not found: ${command}`);
3556
+ }
3557
+ await fn(uid, ...args);
3558
+ await invoke$1('Viewlet.requestRender', uid);
3559
+ };
3552
3560
  const rpc = await create$5({
3553
- commandMap: {},
3561
+ commandMap: {
3562
+ 'Viewlet.executeViewletCommand': executeViewletCommand
3563
+ },
3554
3564
  messagePort: port
3555
3565
  });
3556
3566
  set(rpc);
@@ -4958,6 +4968,7 @@ const handleFocus = async state => {
4958
4968
  };
4959
4969
 
4960
4970
  const handleFocusOut = async state => {
4971
+ // The renderer process checks relatedTarget and closes the menu only when focus leaves the complete menu tree.
4961
4972
  return state;
4962
4973
  };
4963
4974
 
@@ -5445,6 +5456,7 @@ const wakeUp = sleepState => {
5445
5456
  set$1(sleepState.uid, sleepState, sleepState);
5446
5457
  };
5447
5458
 
5459
+ const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
5448
5460
  const commandMap = {
5449
5461
  'TitleBar.closeMenu': wrapCommand(closeMenu),
5450
5462
  'TitleBar.create': create,
@@ -5485,7 +5497,7 @@ const commandMap = {
5485
5497
  'TitleBar.handleKeySpace': wrapCommand(handleKeySpace),
5486
5498
  'TitleBar.handleMenuClick': wrapCommand(handleMenuClick),
5487
5499
  'TitleBar.handleMenuMouseOver': wrapCommand(handleMenuMouseOver),
5488
- 'TitleBar.handleMessagePort': handleMessagePort,
5500
+ 'TitleBar.handleMessagePort': handleDirectMessagePort,
5489
5501
  'TitleBar.handleMouseOut': wrapCommand(handleMouseOut),
5490
5502
  'TitleBar.handleMouseOver': wrapCommand(handleMouseOver),
5491
5503
  'TitleBar.handlePointerOut': wrapCommand(handlePointerOut),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "4.17.1",
3
+ "version": "4.18.1",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",