@lvce-editor/output-view 2.18.1 → 2.19.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.
@@ -1857,9 +1857,19 @@ const set = rpc => {
1857
1857
  state.connected = true;
1858
1858
  };
1859
1859
 
1860
- const handleMessagePort = async port => {
1860
+ const handleMessagePort = async (port, viewletCommandMap) => {
1861
+ const executeViewletCommand = async (uid, command, ...args) => {
1862
+ const fn = viewletCommandMap[`Output.${command}`];
1863
+ if (typeof fn !== 'function') {
1864
+ throw new TypeError(`Viewlet command not found: ${command}`);
1865
+ }
1866
+ await fn(uid, ...args);
1867
+ await invoke$1('Viewlet.requestRender', uid);
1868
+ };
1861
1869
  const rpc = await create$6({
1862
- commandMap: {},
1870
+ commandMap: {
1871
+ 'Viewlet.executeViewletCommand': executeViewletCommand
1872
+ },
1863
1873
  messagePort: port
1864
1874
  });
1865
1875
  set(rpc);
@@ -2601,6 +2611,7 @@ const setOutputChannel = async state => {
2601
2611
  };
2602
2612
  };
2603
2613
 
2614
+ const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
2604
2615
  const commandMap = {
2605
2616
  'Output.clear': wrapCommand(clear),
2606
2617
  'Output.closeFindWidget': wrapCommand(closeFindWidget),
@@ -2618,7 +2629,7 @@ const commandMap = {
2618
2629
  'Output.handleData': wrapCommand(handleData),
2619
2630
  'Output.handleError': wrapCommand(handleError),
2620
2631
  'Output.handleFilterInput': wrapCommand(handleFilterInput),
2621
- 'Output.handleMessagePort': handleMessagePort,
2632
+ 'Output.handleMessagePort': handleDirectMessagePort,
2622
2633
  'Output.handleSelect': wrapCommand(handleSelect),
2623
2634
  'Output.handleSourceLinkClick': wrapCommand(handleSourceLinkClick),
2624
2635
  'Output.initialize': initialize,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/output-view",
3
- "version": "2.18.1",
3
+ "version": "2.19.0",
4
4
  "description": "Output View Worker",
5
5
  "repository": {
6
6
  "type": "git",