@lvce-editor/about-view 7.20.5 → 7.22.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.
@@ -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,12 +1851,24 @@ const set = rpc => {
1850
1851
  state.connected = true;
1851
1852
  };
1852
1853
 
1853
- const handleMessagePort = async port => {
1854
+ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
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
- set(rpc);
1869
+ if (setAsRendererProcess) {
1870
+ set(rpc);
1871
+ }
1859
1872
  };
1860
1873
 
1861
1874
  const OneSecondAgo = '1 second ago';
@@ -2435,7 +2448,7 @@ const doRender = async (uid, diffResult) => {
2435
2448
  return commands;
2436
2449
  }
2437
2450
  const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
2438
- const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
2451
+ const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext).flatMap(command => command[0] === SetDom2 ? [command, ['Viewlet.setUid', uid, uid]] : [command]);
2439
2452
  const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
2440
2453
  return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
2441
2454
  };
@@ -2535,6 +2548,7 @@ const showAbout = async platform => {
2535
2548
  await fn();
2536
2549
  };
2537
2550
 
2551
+ const handleDirectMessagePort = (port, setAsRendererProcess) => handleMessagePort(port, commandMap, setAsRendererProcess);
2538
2552
  const commandMap = {
2539
2553
  'About.create': create,
2540
2554
  'About.diff2': diff2,
@@ -2548,7 +2562,7 @@ const commandMap = {
2548
2562
  'About.handleClickCopy': wrapCommand(handleClickCopy),
2549
2563
  'About.handleClickOk': wrapCommand(handleClickOk),
2550
2564
  'About.handleFocusIn': wrapAsyncCommand(handleFocusIn),
2551
- 'About.handleMessagePort': handleMessagePort,
2565
+ 'About.handleMessagePort': handleDirectMessagePort,
2552
2566
  'About.loadContent2': wrapAsyncCommand(loadContent2),
2553
2567
  'About.render2': doRender,
2554
2568
  'About.renderEventListeners': renderEventListeners,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/about-view",
3
- "version": "7.20.5",
3
+ "version": "7.22.0",
4
4
  "description": "About View Worker",
5
5
  "keywords": [
6
6
  "about-view"