@lvce-editor/output-view 2.18.0 → 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);
@@ -2230,7 +2240,7 @@ const refresh = async state => {
2230
2240
  };
2231
2241
 
2232
2242
  const renderFilterValue = (oldState, newState) => {
2233
- return ['Viewlet.setValueByName', Filter$1, newState.filterValue];
2243
+ return ['Viewlet.setValueByName', newState.uid, Filter$1, newState.filterValue];
2234
2244
  };
2235
2245
 
2236
2246
  const HandleBlur = 'handleBlur';
@@ -2370,13 +2380,13 @@ const getOutputVirtualDom = (lines, errorCode, error) => {
2370
2380
 
2371
2381
  const renderItems = (oldState, newState) => {
2372
2382
  const dom = getOutputVirtualDom(newState.filteredItems, newState.errorCode, newState.error);
2373
- return ['Viewlet.setDom2', dom];
2383
+ return ['Viewlet.setDom2', newState.uid, dom];
2374
2384
  };
2375
2385
 
2376
2386
  const renderSelectedItem = (oldState, newState) => {
2377
2387
  const value = newState.selectedOption;
2378
2388
  const name = Output;
2379
- return ['Viewlet.setValueByName', name, value];
2389
+ return ['Viewlet.setValueByName', newState.uid, name, value];
2380
2390
  };
2381
2391
 
2382
2392
  const getRenderer = diffType => {
@@ -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.0",
3
+ "version": "2.19.0",
4
4
  "description": "Output View Worker",
5
5
  "repository": {
6
6
  "type": "git",