@lvce-editor/title-bar-worker 4.17.0 → 4.18.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.
- package/dist/titleBarWorkerMain.js +23 -5
- package/package.json +1 -1
|
@@ -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);
|
|
@@ -4142,7 +4152,7 @@ const renderFocusedIndex = (oldState, newState) => {
|
|
|
4142
4152
|
if (newState.focusedIndex === -1) {
|
|
4143
4153
|
return [];
|
|
4144
4154
|
}
|
|
4145
|
-
return [FocusSelector, '.ViewletTitleBarMenuBar'];
|
|
4155
|
+
return [FocusSelector, newState.uid, '.ViewletTitleBarMenuBar'];
|
|
4146
4156
|
};
|
|
4147
4157
|
|
|
4148
4158
|
const MaskIconCheck = 'MaskIconCheck';
|
|
@@ -4958,7 +4968,14 @@ const handleFocus = async state => {
|
|
|
4958
4968
|
};
|
|
4959
4969
|
|
|
4960
4970
|
const handleFocusOut = async state => {
|
|
4961
|
-
|
|
4971
|
+
const closedState = closeMenu(state, /* keepFocus */false);
|
|
4972
|
+
if (!closedState.focused) {
|
|
4973
|
+
return closedState;
|
|
4974
|
+
}
|
|
4975
|
+
return {
|
|
4976
|
+
...closedState,
|
|
4977
|
+
focused: false
|
|
4978
|
+
};
|
|
4962
4979
|
};
|
|
4963
4980
|
|
|
4964
4981
|
const openMenu = async (state, focus) => {
|
|
@@ -5445,6 +5462,7 @@ const wakeUp = sleepState => {
|
|
|
5445
5462
|
set$1(sleepState.uid, sleepState, sleepState);
|
|
5446
5463
|
};
|
|
5447
5464
|
|
|
5465
|
+
const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
|
|
5448
5466
|
const commandMap = {
|
|
5449
5467
|
'TitleBar.closeMenu': wrapCommand(closeMenu),
|
|
5450
5468
|
'TitleBar.create': create,
|
|
@@ -5485,7 +5503,7 @@ const commandMap = {
|
|
|
5485
5503
|
'TitleBar.handleKeySpace': wrapCommand(handleKeySpace),
|
|
5486
5504
|
'TitleBar.handleMenuClick': wrapCommand(handleMenuClick),
|
|
5487
5505
|
'TitleBar.handleMenuMouseOver': wrapCommand(handleMenuMouseOver),
|
|
5488
|
-
'TitleBar.handleMessagePort':
|
|
5506
|
+
'TitleBar.handleMessagePort': handleDirectMessagePort,
|
|
5489
5507
|
'TitleBar.handleMouseOut': wrapCommand(handleMouseOut),
|
|
5490
5508
|
'TitleBar.handleMouseOver': wrapCommand(handleMouseOver),
|
|
5491
5509
|
'TitleBar.handlePointerOut': wrapCommand(handlePointerOut),
|