@lvce-editor/about-view 7.20.5 → 7.21.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/aboutWorkerMain.js +16 -4
- package/package.json +1 -1
package/dist/aboutWorkerMain.js
CHANGED
|
@@ -1302,6 +1302,7 @@ const FileSystemWorker = 209;
|
|
|
1302
1302
|
const RendererProcess = 1670;
|
|
1303
1303
|
const RendererWorker = 1;
|
|
1304
1304
|
|
|
1305
|
+
const SetDom2 = 'Viewlet.setDom2';
|
|
1305
1306
|
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
1306
1307
|
|
|
1307
1308
|
const {
|
|
@@ -1850,9 +1851,19 @@ const set = rpc => {
|
|
|
1850
1851
|
state.connected = true;
|
|
1851
1852
|
};
|
|
1852
1853
|
|
|
1853
|
-
const handleMessagePort = async port => {
|
|
1854
|
+
const handleMessagePort = async (port, viewletCommandMap) => {
|
|
1855
|
+
const executeViewletCommand = async (uid, command, ...args) => {
|
|
1856
|
+
const fn = viewletCommandMap[`About.${command}`];
|
|
1857
|
+
if (typeof fn !== 'function') {
|
|
1858
|
+
throw new TypeError(`Viewlet command not found: ${command}`);
|
|
1859
|
+
}
|
|
1860
|
+
await fn(uid, ...args);
|
|
1861
|
+
await invoke$1('Viewlet.requestRender', uid);
|
|
1862
|
+
};
|
|
1854
1863
|
const rpc = await create$6({
|
|
1855
|
-
commandMap: {
|
|
1864
|
+
commandMap: {
|
|
1865
|
+
'Viewlet.executeViewletCommand': executeViewletCommand
|
|
1866
|
+
},
|
|
1856
1867
|
messagePort: port
|
|
1857
1868
|
});
|
|
1858
1869
|
set(rpc);
|
|
@@ -2435,7 +2446,7 @@ const doRender = async (uid, diffResult) => {
|
|
|
2435
2446
|
return commands;
|
|
2436
2447
|
}
|
|
2437
2448
|
const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
|
|
2438
|
-
const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
|
|
2449
|
+
const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext).flatMap(command => command[0] === SetDom2 ? [command, ['Viewlet.setUid', uid, uid]] : [command]);
|
|
2439
2450
|
const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
|
|
2440
2451
|
return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
|
|
2441
2452
|
};
|
|
@@ -2535,6 +2546,7 @@ const showAbout = async platform => {
|
|
|
2535
2546
|
await fn();
|
|
2536
2547
|
};
|
|
2537
2548
|
|
|
2549
|
+
const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
|
|
2538
2550
|
const commandMap = {
|
|
2539
2551
|
'About.create': create,
|
|
2540
2552
|
'About.diff2': diff2,
|
|
@@ -2548,7 +2560,7 @@ const commandMap = {
|
|
|
2548
2560
|
'About.handleClickCopy': wrapCommand(handleClickCopy),
|
|
2549
2561
|
'About.handleClickOk': wrapCommand(handleClickOk),
|
|
2550
2562
|
'About.handleFocusIn': wrapAsyncCommand(handleFocusIn),
|
|
2551
|
-
'About.handleMessagePort':
|
|
2563
|
+
'About.handleMessagePort': handleDirectMessagePort,
|
|
2552
2564
|
'About.loadContent2': wrapAsyncCommand(loadContent2),
|
|
2553
2565
|
'About.render2': doRender,
|
|
2554
2566
|
'About.renderEventListeners': renderEventListeners,
|