@lvce-editor/main-area-worker 9.44.2 → 9.45.1

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.
@@ -1269,7 +1269,7 @@ const createMockRpc = ({
1269
1269
  };
1270
1270
 
1271
1271
  const rpcs = Object.create(null);
1272
- const set$6 = (id, rpc) => {
1272
+ const set$8 = (id, rpc) => {
1273
1273
  rpcs[id] = rpc;
1274
1274
  };
1275
1275
  const get$1 = id => {
@@ -1302,7 +1302,7 @@ const create$4 = rpcId => {
1302
1302
  const mockRpc = createMockRpc({
1303
1303
  commandMap
1304
1304
  });
1305
- set$6(rpcId, mockRpc);
1305
+ set$8(rpcId, mockRpc);
1306
1306
  // @ts-ignore
1307
1307
  mockRpc[Symbol.dispose] = () => {
1308
1308
  remove(rpcId);
@@ -1311,7 +1311,7 @@ const create$4 = rpcId => {
1311
1311
  return mockRpc;
1312
1312
  },
1313
1313
  set(rpc) {
1314
- set$6(rpcId, rpc);
1314
+ set$8(rpcId, rpc);
1315
1315
  }
1316
1316
  };
1317
1317
  };
@@ -1513,6 +1513,7 @@ const ClipBoardWorker = 3400;
1513
1513
  const DialogWorker = 7014;
1514
1514
  const DragAndDropWorker = 3404;
1515
1515
  const IconThemeWorker = 7009;
1516
+ const RendererProcess = 1670;
1516
1517
  const RendererWorker = 1;
1517
1518
 
1518
1519
  const SetCss = 'Viewlet.setCss';
@@ -1522,49 +1523,54 @@ const SetPatches = 'Viewlet.setPatches';
1522
1523
  const FocusEditorText = 12;
1523
1524
 
1524
1525
  const {
1525
- invoke: invoke$4,
1526
- set: set$5
1526
+ invoke: invoke$6,
1527
+ set: set$7
1527
1528
  } = create$4(ClipBoardWorker);
1528
1529
  const writeText = async text => {
1529
- return invoke$4('ClipBoard.writeText', text);
1530
+ return invoke$6('ClipBoard.writeText', text);
1530
1531
  };
1531
1532
 
1532
1533
  const {
1533
- invoke: invoke$3,
1534
- set: set$4
1534
+ invoke: invoke$5,
1535
+ set: set$6
1535
1536
  } = create$4(DialogWorker);
1536
1537
 
1537
1538
  const {
1538
- invoke: invoke$2,
1539
- set: set$3
1539
+ invoke: invoke$4,
1540
+ set: set$5
1540
1541
  } = create$4(DragAndDropWorker);
1541
1542
  const getDroppedItems = async (itemIds, isElectron) => {
1542
- return invoke$2('DragAndDrop.getDroppedItems', itemIds, isElectron);
1543
+ return invoke$4('DragAndDrop.getDroppedItems', itemIds, isElectron);
1543
1544
  };
1544
1545
 
1545
1546
  const {
1546
- invoke: invoke$1,
1547
- set: set$2
1547
+ invoke: invoke$3,
1548
+ set: set$4
1548
1549
  } = create$4(IconThemeWorker);
1549
1550
  const getIcons = async iconRequests => {
1550
1551
  // @ts-ignore
1551
- return invoke$1('IconTheme.getIcons', iconRequests);
1552
+ return invoke$3('IconTheme.getIcons', iconRequests);
1552
1553
  };
1553
1554
 
1554
1555
  const {
1555
- invoke,
1556
+ invoke: invoke$2,
1557
+ set: set$3
1558
+ } = create$4(RendererProcess);
1559
+
1560
+ const {
1561
+ invoke: invoke$1,
1556
1562
  invokeAndTransfer,
1557
- set: set$1
1563
+ set: set$2
1558
1564
  } = create$4(RendererWorker);
1559
1565
  const handleModifiedStatusChange$1 = async (uri, modified) => {
1560
- return invoke('Main.handleModifiedStatusChange', uri, modified);
1566
+ return invoke$1('Main.handleModifiedStatusChange', uri, modified);
1561
1567
  };
1562
1568
  const showContextMenu2 = async (uid, menuId, x, y, args) => {
1563
1569
  number(uid);
1564
1570
  number(menuId);
1565
1571
  number(x);
1566
1572
  number(y);
1567
- await invoke('ContextMenu.show2', uid, menuId, x, y, args);
1573
+ await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
1568
1574
  };
1569
1575
  const sendMessagePortToClipBoardWorker$1 = async (port, rpcId) => {
1570
1576
  const command = 'ClipBoard.handleMessagePort';
@@ -1583,10 +1589,10 @@ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1583
1589
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
1584
1590
  };
1585
1591
  const readFile = async uri => {
1586
- return invoke('FileSystem.readFile', uri);
1592
+ return invoke$1('FileSystem.readFile', uri);
1587
1593
  };
1588
1594
  const confirm$1 = async (message, options) => {
1589
- const result = await invoke('ConfirmPrompt.prompt', message, options);
1595
+ const result = await invoke$1('ConfirmPrompt.prompt', message, options);
1590
1596
  return result;
1591
1597
  };
1592
1598
 
@@ -1966,12 +1972,12 @@ const closeTab = (state, groupId, tabId) => {
1966
1972
  const handleAttach = async command => {
1967
1973
  // TODO find a better way to append editors
1968
1974
  const parentNodeSelector = '.editor-groups-container, .EditorGroup';
1969
- await invoke('Layout.attachViewlet', parentNodeSelector, command.instanceId);
1975
+ await invoke$1('Layout.attachViewlet', parentNodeSelector, command.instanceId);
1970
1976
  };
1971
1977
 
1972
1978
  const getViewletTitle = async editorUid => {
1973
1979
  try {
1974
- const title = await invoke('Viewlet.getTitle', editorUid);
1980
+ const title = await invoke$1('Viewlet.getTitle', editorUid);
1975
1981
  return typeof title === 'string' && title ? title : undefined;
1976
1982
  } catch {
1977
1983
  return undefined;
@@ -1979,9 +1985,9 @@ const getViewletTitle = async editorUid => {
1979
1985
  };
1980
1986
  const createViewletContent = async (viewletModuleId, editorUid, tabId, bounds, uri, args) => {
1981
1987
  if (args === undefined) {
1982
- await invoke('Layout.createViewlet', viewletModuleId, editorUid, tabId, bounds, uri);
1988
+ await invoke$1('Layout.createViewlet', viewletModuleId, editorUid, tabId, bounds, uri);
1983
1989
  } else {
1984
- await invoke('Layout.createViewlet', viewletModuleId, editorUid, tabId, bounds, uri, args);
1990
+ await invoke$1('Layout.createViewlet', viewletModuleId, editorUid, tabId, bounds, uri, args);
1985
1991
  }
1986
1992
  };
1987
1993
  const createViewlet = async (viewletModuleId, editorUid, tabId, bounds, uri, args) => {
@@ -2018,7 +2024,7 @@ const notifyActiveEditorChange = async (oldState, newState) => {
2018
2024
  return;
2019
2025
  }
2020
2026
  try {
2021
- await invoke('Layout.handleActiveEditorChange', newUri);
2027
+ await invoke$1('Layout.handleActiveEditorChange', newUri);
2022
2028
  } catch (error) {
2023
2029
  console.warn('Failed to notify viewlets about active editor change', error);
2024
2030
  }
@@ -2045,7 +2051,7 @@ const notifyMountedViewlets = async (oldState, newState) => {
2045
2051
  return;
2046
2052
  }
2047
2053
  try {
2048
- await invoke('Layout.setMountedViewlets', newState.uid, newViewletUids);
2054
+ await invoke$1('Layout.setMountedViewlets', newState.uid, newViewletUids);
2049
2055
  } catch (error) {
2050
2056
  console.warn('Failed to publish mounted viewlets', error);
2051
2057
  }
@@ -2075,7 +2081,7 @@ const {
2075
2081
  getCommandIds,
2076
2082
  getKeys: getKeys$1,
2077
2083
  registerCommands,
2078
- set,
2084
+ set: set$1,
2079
2085
  wrapGetter
2080
2086
  } = registry;
2081
2087
  const wrapAsyncCommand = fn => {
@@ -2319,24 +2325,24 @@ const handleCreate = async command => {
2319
2325
  oldState
2320
2326
  } = get(command.uid);
2321
2327
  const readyState = handleViewletReady(state, command.editorUid, title);
2322
- set(command.uid, oldState, readyState);
2328
+ set$1(command.uid, oldState, readyState);
2323
2329
  return readyState;
2324
2330
  };
2325
2331
 
2326
2332
  const handleDetach = async command => {
2327
2333
  // Hides viewlet but keeps it alive
2328
2334
 
2329
- await invoke('Viewlet.detach', command.instanceId);
2335
+ await invoke$1('Viewlet.detach', command.instanceId);
2330
2336
  };
2331
2337
 
2332
2338
  const handleDispose = async command => {
2333
2339
  // Fully destroys viewlet
2334
2340
 
2335
- await invoke('Viewlet.dispose', command.instanceId);
2341
+ await invoke$1('Viewlet.dispose', command.instanceId);
2336
2342
  };
2337
2343
 
2338
2344
  const handleSetBounds = async command => {
2339
- await invoke('Viewlet.setBounds', command.instanceId, command.bounds);
2345
+ await invoke$1('Viewlet.setBounds', command.instanceId, command.bounds);
2340
2346
  };
2341
2347
 
2342
2348
  const executeViewletCommand = async command => {
@@ -2420,13 +2426,13 @@ const closeTabWithViewlet = async (state, groupId, tabId) => {
2420
2426
  };
2421
2427
 
2422
2428
  const saveEditor = async editorUid => {
2423
- return invoke('Editor.save', editorUid);
2429
+ return invoke$1('Editor.save', editorUid);
2424
2430
  };
2425
2431
 
2426
2432
  const missingDialogWorkerRelay = 'Command "SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker" not found';
2427
2433
  const confirm = async (message, options) => {
2428
2434
  try {
2429
- return await invoke$3('ConfirmPrompt.prompt', message, options);
2435
+ return await invoke$5('ConfirmPrompt.prompt', message, options);
2430
2436
  } catch (error) {
2431
2437
  if (!String(error).includes(missingDialogWorkerRelay)) {
2432
2438
  throw error;
@@ -2506,7 +2512,7 @@ const disposeEditors = async editorUids => {
2506
2512
  // Dispose all child viewlets in the renderer worker
2507
2513
  for (const editorUid of editorUids) {
2508
2514
  try {
2509
- await invoke('Viewlet.dispose', editorUid);
2515
+ await invoke$1('Viewlet.dispose', editorUid);
2510
2516
  } catch {
2511
2517
  // Silently ignore errors during disposal
2512
2518
  // Viewlet may already be disposed or renderer worker may not be available
@@ -2807,7 +2813,7 @@ const copyIntoNewWindow$1 = async state => {
2807
2813
  if (!tab?.uri) {
2808
2814
  return state;
2809
2815
  }
2810
- await invoke('ElectronWindow.openNewWithUri', tab.uri);
2816
+ await invoke$1('ElectronWindow.openNewWithUri', tab.uri);
2811
2817
  return state;
2812
2818
  };
2813
2819
 
@@ -2819,7 +2825,7 @@ const copyPath$1 = async (state, path) => {
2819
2825
 
2820
2826
  const copyRelativePath$1 = async (state, path) => {
2821
2827
  string(path);
2822
- const relativePath = await invoke('Workspace.pathBaseName', path);
2828
+ const relativePath = await invoke$1('Workspace.pathBaseName', path);
2823
2829
  await writeText(relativePath);
2824
2830
  return state;
2825
2831
  };
@@ -2871,7 +2877,7 @@ const create$1 = (uid, uri, x, y, width, height, platform, assetDir, tabHeight =
2871
2877
  x,
2872
2878
  y
2873
2879
  };
2874
- set(uid, state, state);
2880
+ set$1(uid, state, state);
2875
2881
  };
2876
2882
 
2877
2883
  const isEqual$3 = (oldState, newState) => {
@@ -2945,7 +2951,7 @@ const focus = async state => {
2945
2951
  if (typeof editorUid !== 'number' || editorUid < 0) {
2946
2952
  return state;
2947
2953
  }
2948
- await invoke('Viewlet.focusSelector', editorUid, '[name="editor"]');
2954
+ await invoke$1('Viewlet.focusSelector', editorUid, '[name="editor"]');
2949
2955
  return state;
2950
2956
  };
2951
2957
 
@@ -3251,7 +3257,7 @@ const getViewletModuleId$1 = async (uri, opener) => {
3251
3257
  // Query RendererWorker for viewlet module ID (optional, may fail in tests)
3252
3258
  let viewletModuleId;
3253
3259
  try {
3254
- viewletModuleId = opener === undefined ? await invoke('Layout.getModuleId', uri) : await invoke('Layout.getModuleId', uri, opener);
3260
+ viewletModuleId = opener === undefined ? await invoke$1('Layout.getModuleId', uri) : await invoke$1('Layout.getModuleId', uri, opener);
3255
3261
  } catch {
3256
3262
  // Viewlet creation is optional - silently ignore if RendererWorker isn't available
3257
3263
  }
@@ -3289,7 +3295,7 @@ const getViewletModuleIdForEditorInput = async editorInput => {
3289
3295
 
3290
3296
  const getViewletModuleId = async tab => {
3291
3297
  const normalizedTab = normalizeTabEditorInput(tab);
3292
- return normalizedTab.editorInput ? getViewletModuleIdForEditorInput(normalizedTab.editorInput) : invoke('Layout.getModuleId', normalizedTab.uri);
3298
+ return normalizedTab.editorInput ? getViewletModuleIdForEditorInput(normalizedTab.editorInput) : invoke$1('Layout.getModuleId', normalizedTab.uri);
3293
3299
  };
3294
3300
 
3295
3301
  const startContentLoading = async (oldState, state, tabId, path, requestId) => {
@@ -3300,7 +3306,7 @@ const startContentLoading = async (oldState, state, tabId, path, requestId) => {
3300
3306
  const getLatestState = () => {
3301
3307
  return get(uid).newState;
3302
3308
  };
3303
- set(uid, oldState, state);
3309
+ set$1(uid, oldState, state);
3304
3310
  const newState = await loadTabContentAsync(tabId, path, requestId, getLatestState);
3305
3311
  return newState;
3306
3312
  } catch {
@@ -3331,7 +3337,7 @@ const maybeCreateViewletForSelectedTab = async (state, newState, groupIndex, ind
3331
3337
  }
3332
3338
  const bounds = getSelectedTabBounds(newState);
3333
3339
  let stateWithViewlet = createViewletForTab(newState, tabId);
3334
- set(uid, state, stateWithViewlet);
3340
+ set$1(uid, state, stateWithViewlet);
3335
3341
  if (switchCommands.length > 0) {
3336
3342
  await executeViewletCommands(switchCommands);
3337
3343
  }
@@ -3343,7 +3349,7 @@ const maybeCreateViewletForSelectedTab = async (state, newState, groupIndex, ind
3343
3349
  if (editorUid !== -1 && selectedTab.uri) {
3344
3350
  const title = await createViewlet(viewletModuleId, editorUid, tabId, bounds, selectedTab.uri);
3345
3351
  stateWithViewlet = handleViewletReady(stateWithViewlet, editorUid, title);
3346
- set(uid, state, stateWithViewlet);
3352
+ set$1(uid, state, stateWithViewlet);
3347
3353
  }
3348
3354
  }
3349
3355
  return maybeStartLoading(state, stateWithViewlet, tabId, tab, needsLoading, requestId);
@@ -3397,7 +3403,7 @@ const selectTab = async (state, groupIndex, index) => {
3397
3403
  if (maybeCreatedState) {
3398
3404
  return maybeCreatedState;
3399
3405
  }
3400
- set(uid, state, newState);
3406
+ set$1(uid, state, newState);
3401
3407
  if (switchCommands.length > 0) {
3402
3408
  await executeViewletCommands(switchCommands);
3403
3409
  }
@@ -3491,7 +3497,7 @@ const handleClickTogglePreview = async state => {
3491
3497
  if (!activeTabInfo || !activeTabInfo.tab.uri) {
3492
3498
  return state;
3493
3499
  }
3494
- await invoke('Layout.showPreview', activeTabInfo.tab.uri);
3500
+ await invoke$1('Layout.showPreview', activeTabInfo.tab.uri);
3495
3501
  return state;
3496
3502
  };
3497
3503
 
@@ -3570,14 +3576,14 @@ const getCurrentState = state => {
3570
3576
  } = state;
3571
3577
  const stateFromStore = get(uid);
3572
3578
  if (!stateFromStore) {
3573
- set(uid, state, state);
3579
+ set$1(uid, state, state);
3574
3580
  return state;
3575
3581
  }
3576
3582
  const storedState = stateFromStore.newState;
3577
3583
  if (getTabCount(storedState) > getTabCount(state)) {
3578
3584
  return storedState;
3579
3585
  }
3580
- set(uid, state, state);
3586
+ set$1(uid, state, state);
3581
3587
  return state;
3582
3588
  };
3583
3589
 
@@ -3892,15 +3898,8 @@ const Directory = 3;
3892
3898
  const DirectoryExpanded = 4;
3893
3899
  const File = 7;
3894
3900
 
3895
- const isLocalEditorInput = editorInput => {
3896
- if (editorInput.type !== 'editor') {
3897
- return false;
3898
- }
3899
- return editorInput.uri.startsWith('file://') || !editorInput.uri.includes('://');
3900
- };
3901
-
3902
3901
  const shouldCheckDirectoryEditorInput = editorInput => {
3903
- if (!isLocalEditorInput(editorInput)) {
3902
+ if (editorInput.type !== 'editor') {
3904
3903
  return false;
3905
3904
  }
3906
3905
  const baseName = editorInput.uri.slice(editorInput.uri.lastIndexOf('/') + 1);
@@ -3912,7 +3911,7 @@ const isDirectoryEditorInput = async editorInput => {
3912
3911
  return false;
3913
3912
  }
3914
3913
  try {
3915
- const type = await invoke('FileSystem.stat', editorInput.uri);
3914
+ const type = await invoke$1('FileSystem.stat', editorInput.uri);
3916
3915
  return type === Directory;
3917
3916
  } catch {
3918
3917
  return false;
@@ -4069,7 +4068,7 @@ const updateTabIcon = async (context, readyState, tabId) => {
4069
4068
 
4070
4069
  const renderMainAreaPending = async uid => {
4071
4070
  try {
4072
- await invoke('Layout.renderMainAreaPending', uid);
4071
+ await invoke$1('Layout.renderMainAreaPending', uid);
4073
4072
  } catch {
4074
4073
  // Older renderer workers render the final state when openInput completes.
4075
4074
  }
@@ -4215,7 +4214,7 @@ const openInput = async (state, options) => {
4215
4214
  const storedState = get(uid);
4216
4215
  const latestState = storedState?.newState ?? currentState;
4217
4216
  currentState = updater(latestState);
4218
- set(uid, storedState?.oldState ?? state, currentState);
4217
+ set$1(uid, storedState?.oldState ?? state, currentState);
4219
4218
  return Promise.resolve(currentState);
4220
4219
  }
4221
4220
  };
@@ -4433,7 +4432,7 @@ const restoreClosedTab = async state => {
4433
4432
  return state;
4434
4433
  }
4435
4434
  const newState = await selectTab(restored.newState, restored.groupIndex, restored.tabIndex);
4436
- set(state.uid, state, newState);
4435
+ set$1(state.uid, state, newState);
4437
4436
  return newState;
4438
4437
  };
4439
4438
 
@@ -5146,10 +5145,10 @@ const applyDropAction = async (context, action, splitDirection) => {
5146
5145
  break;
5147
5146
  }
5148
5147
  case 'setPath':
5149
- void invoke('Workspace.setPath', action.value).catch(() => {});
5148
+ void invoke$1('Workspace.setPath', action.value).catch(() => {});
5150
5149
  break;
5151
5150
  case 'setUri':
5152
- void invoke('Workspace.setUri', action.value).catch(() => {});
5151
+ void invoke$1('Workspace.setUri', action.value).catch(() => {});
5153
5152
  break;
5154
5153
  }
5155
5154
  };
@@ -5160,7 +5159,7 @@ const getDropAction = async uris => {
5160
5159
  type: 'editor',
5161
5160
  uri
5162
5161
  }))) {
5163
- if (uri.startsWith('file://')) {
5162
+ if (uri.includes('://')) {
5164
5163
  return {
5165
5164
  command: 'setUri',
5166
5165
  value: uri
@@ -5316,7 +5315,7 @@ const newFile = async state => {
5316
5315
  newState: switchedState
5317
5316
  } = switchViewlet(intermediateState);
5318
5317
  intermediateState = switchedState;
5319
- set(uid, state, intermediateState);
5318
+ set$1(uid, state, intermediateState);
5320
5319
 
5321
5320
  // Get the tab to extract editorUid
5322
5321
  const tabWithViewlet = findTabById(intermediateState, tabId);
@@ -5411,6 +5410,31 @@ const handleIconThemeChange = async state => {
5411
5410
  };
5412
5411
  };
5413
5412
 
5413
+ const state = {
5414
+ connected: false
5415
+ };
5416
+ const isConnected = () => {
5417
+ const {
5418
+ connected
5419
+ } = state;
5420
+ return connected;
5421
+ };
5422
+ const invoke = (method, ...params) => {
5423
+ return invoke$2(method, ...params);
5424
+ };
5425
+ const set = rpc => {
5426
+ set$3(rpc);
5427
+ state.connected = true;
5428
+ };
5429
+
5430
+ const handleMessagePort = async port => {
5431
+ const rpc = await create$8({
5432
+ commandMap: {},
5433
+ messagePort: port
5434
+ });
5435
+ set(rpc);
5436
+ };
5437
+
5414
5438
  const handleModifiedStatusChange = (state, uri, newStatus) => {
5415
5439
  const {
5416
5440
  layout
@@ -5447,7 +5471,7 @@ const handleModifiedStatusChangeWithContext = async (context, uri, newStatus) =>
5447
5471
 
5448
5472
  const resizeChild = async (editorUid, dimensions) => {
5449
5473
  try {
5450
- return await invoke('Viewlet.resize', editorUid, dimensions);
5474
+ return await invoke$1('Viewlet.resize', editorUid, dimensions);
5451
5475
  } catch {
5452
5476
  return [];
5453
5477
  }
@@ -5825,7 +5849,7 @@ const handleUriChange = async (state, oldUri, newUri) => {
5825
5849
  }
5826
5850
  if (renamedUri) {
5827
5851
  if (tab.editorType === 'text' && tab.editorUid !== -1) {
5828
- editorUriUpdates.push(invoke('Editor.handleUriChange', tab.editorUid, renamedUri));
5852
+ editorUriUpdates.push(invoke$1('Editor.handleUriChange', tab.editorUid, renamedUri));
5829
5853
  }
5830
5854
  const editorInput = tab.editorInput && 'uri' in tab.editorInput ? {
5831
5855
  ...tab.editorInput,
@@ -5875,7 +5899,7 @@ const toFileUri = path => {
5875
5899
  };
5876
5900
  const loadHomeDirUri = async () => {
5877
5901
  try {
5878
- const homeDir = await invoke('Workspace.getHomeDir');
5902
+ const homeDir = await invoke$1('Workspace.getHomeDir');
5879
5903
  return typeof homeDir === 'string' ? toFileUri(homeDir) : '';
5880
5904
  } catch {
5881
5905
  return '';
@@ -6179,7 +6203,7 @@ const reloadChangedEditors = async (state, changed) => {
6179
6203
  }
6180
6204
  }
6181
6205
  }
6182
- await Promise.allSettled(Array.from(editorUids, editorUid => invoke('Viewlet.reload', editorUid)));
6206
+ await Promise.allSettled(Array.from(editorUids, editorUid => invoke$1('Viewlet.reload', editorUid)));
6183
6207
  };
6184
6208
  const handleWorkspaceRefresh = async (state, refresh = {}) => {
6185
6209
  const changes = Array.isArray(refresh) ? {
@@ -6598,12 +6622,12 @@ const moveIntoNewWindow = async state => {
6598
6622
  if (!tab?.uri) {
6599
6623
  return state;
6600
6624
  }
6601
- await invoke('ElectronWindow.openNewWithUri', tab.uri);
6625
+ await invoke$1('ElectronWindow.openNewWithUri', tab.uri);
6602
6626
  return closeTabAndSave(state, group.id, activeTabId);
6603
6627
  };
6604
6628
 
6605
6629
  const newWindow = async state => {
6606
- await invoke('ElectronWindow.openNew');
6630
+ await invoke$1('ElectronWindow.openNew');
6607
6631
  return state;
6608
6632
  };
6609
6633
 
@@ -7679,7 +7703,7 @@ const renderPendingViewletUpdate = (oldState, newState) => {
7679
7703
  const update = newState.pendingViewletUpdate;
7680
7704
  newState.pendingViewletUpdate = undefined;
7681
7705
  setTimeout(() => {
7682
- void invoke('Viewlet.dispose', update.disposal).catch(() => {});
7706
+ void invoke$1('Viewlet.dispose', update.disposal).catch(() => {});
7683
7707
  }, 50);
7684
7708
  return update.focus === undefined ? [] : ['Viewlet.setFocusContext', update.focus, FocusEditorText, 0, update.focus, 'Editor'];
7685
7709
  };
@@ -7718,9 +7742,16 @@ const render2 = (uid, diffResult) => {
7718
7742
  newState,
7719
7743
  oldState
7720
7744
  } = get(uid);
7721
- set(uid, newState, newState);
7745
+ set$1(uid, newState, newState);
7722
7746
  const commands = applyRender(oldState, newState, diffResult);
7723
- return commands;
7747
+ if (!isConnected()) {
7748
+ return commands;
7749
+ }
7750
+ return renderDirect(uid, commands);
7751
+ };
7752
+ const renderDirect = async (uid, commands) => {
7753
+ const transactionId = await invoke('Viewlet.queueCommands', uid, commands);
7754
+ return [['Viewlet.commitPending', uid, transactionId]];
7724
7755
  };
7725
7756
 
7726
7757
  const renderEventListeners = () => {
@@ -7803,7 +7834,7 @@ const textEditorEntry = {
7803
7834
  };
7804
7835
  const getViewProviderEntries = async uri => {
7805
7836
  try {
7806
- const providers = await invoke('WebView.getEditorProviders');
7837
+ const providers = await invoke$1('WebView.getEditorProviders');
7807
7838
  const matchingProviders = providers.filter(provider => provider?.id && provider.selector?.some(selector => uri.endsWith(selector)));
7808
7839
  return [textEditorEntry, ...matchingProviders.map(provider => {
7809
7840
  const titleElement = provider.elements?.find(element => element.type === 'title');
@@ -7838,7 +7869,7 @@ const reopenEditorWith = async (context, preferredEditorId) => {
7838
7869
  label: entry.label,
7839
7870
  value: entry
7840
7871
  }));
7841
- selected = await invoke('ExtensionHostQuickPick.showQuickPick', {
7872
+ selected = await invoke$1('ExtensionHostQuickPick.showQuickPick', {
7842
7873
  items,
7843
7874
  placeholder: 'Select Editor'
7844
7875
  });
@@ -7889,7 +7920,7 @@ const reopenEditorWith = async (context, preferredEditorId) => {
7889
7920
  await context.updateState(() => readyState);
7890
7921
  if (oldEditorUid !== -1) {
7891
7922
  try {
7892
- await invoke('Viewlet.dispose', oldEditorUid);
7923
+ await invoke$1('Viewlet.dispose', oldEditorUid);
7893
7924
  } catch {
7894
7925
  // Reopening should still proceed if the previous viewlet was already disposed.
7895
7926
  }
@@ -7918,7 +7949,7 @@ const settingsUri = 'app://settings.json';
7918
7949
  const saveEditorAndHandleSettingsChange = async tab => {
7919
7950
  const editorState = await saveEditor(tab.editorUid);
7920
7951
  if (!editorState?.modified && tab.uri === settingsUri) {
7921
- await invoke('Layout.handleSettingsChanged');
7952
+ await invoke$1('Layout.handleSettingsChanged');
7922
7953
  }
7923
7954
  return editorState;
7924
7955
  };
@@ -8258,7 +8289,7 @@ const resize = async (uid, dimensions) => {
8258
8289
  return [];
8259
8290
  }
8260
8291
  const resizedState = resize$1(instance.newState, dimensions);
8261
- set(uid, instance.oldState, resizedState);
8292
+ set$1(uid, instance.oldState, resizedState);
8262
8293
  return handleResize(resizedState, dimensions);
8263
8294
  };
8264
8295
  const commandMap = {
@@ -8324,6 +8355,7 @@ const commandMap = {
8324
8355
  'MainArea.handleDrop': wrapSerialAsyncCommand(handleDrop),
8325
8356
  'MainArea.handleHeaderDoubleClick': wrapSerialCommand(handleHeaderDoubleClick),
8326
8357
  'MainArea.handleIconThemeChange': wrapSerialCommand(handleIconThemeChange),
8358
+ 'MainArea.handleMessagePort': handleMessagePort,
8327
8359
  'MainArea.handleModifiedStatusChange': wrapAsyncCommand(handleModifiedStatusChangeWithContext),
8328
8360
  'MainArea.handleResize': resize,
8329
8361
  'MainArea.handleSashCornerPointerDown': wrapSerialCommand(handleSashCornerPointerDown),
@@ -8380,7 +8412,7 @@ const initializeClipBoardWorker = async () => {
8380
8412
  commandMap: {},
8381
8413
  send: sendMessagePortToClipBoardWorker
8382
8414
  });
8383
- set$5(rpc);
8415
+ set$7(rpc);
8384
8416
  };
8385
8417
 
8386
8418
  const send$1 = async port => {
@@ -8394,7 +8426,7 @@ const createDragAndDropWorkerRpc = async () => {
8394
8426
  };
8395
8427
 
8396
8428
  const initializeDragAndDropWorker = async () => {
8397
- set$3(await createDragAndDropWorkerRpc());
8429
+ set$5(await createDragAndDropWorkerRpc());
8398
8430
  };
8399
8431
 
8400
8432
  const send = port => {
@@ -8420,13 +8452,13 @@ const refreshFileIcons = async () => {
8420
8452
  oldState
8421
8453
  } = get(uid);
8422
8454
  const updatedState = await handleIconThemeChange(newState);
8423
- set(uid, oldState, updatedState);
8455
+ set$1(uid, oldState, updatedState);
8424
8456
  }
8425
8457
  };
8426
8458
 
8427
8459
  const initializeIconThemeWorker = async () => {
8428
8460
  const rpc = await createIconThemeWorkerRpc();
8429
- set$2(rpc);
8461
+ set$4(rpc);
8430
8462
  await refreshFileIcons();
8431
8463
  };
8432
8464
 
@@ -8434,7 +8466,7 @@ const initializeRendererWorker = async () => {
8434
8466
  const rpc = await create$5({
8435
8467
  commandMap: commandMap
8436
8468
  });
8437
- set$1(rpc);
8469
+ set$2(rpc);
8438
8470
  };
8439
8471
 
8440
8472
  const listen = async () => {
@@ -8444,7 +8476,7 @@ const listen = async () => {
8444
8476
  commandMap: {},
8445
8477
  send: sendMessagePortToDialogWorker
8446
8478
  });
8447
- set$4(dialogRpc);
8479
+ set$6(dialogRpc);
8448
8480
  };
8449
8481
 
8450
8482
  const main$1 = async () => {
@@ -8456,7 +8488,7 @@ const main = async () => {
8456
8488
  const rpc = await create$5({
8457
8489
  commandMap: commandMap
8458
8490
  });
8459
- set$1(rpc);
8491
+ set$2(rpc);
8460
8492
  };
8461
8493
 
8462
8494
  await main$1();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.44.2",
3
+ "version": "9.45.1",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",