@lvce-editor/main-area-worker 9.60.0 → 9.61.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.
@@ -1430,55 +1430,55 @@ const SetPatches = 'Viewlet.setPatches';
1430
1430
  const FocusEditorText = 12;
1431
1431
 
1432
1432
  const {
1433
- invoke: invoke$6,
1433
+ invoke: invoke$7,
1434
1434
  set: set$7
1435
1435
  } = create$3(ClipBoardWorker);
1436
1436
  const writeText = async text => {
1437
- return invoke$6('ClipBoard.writeText', text);
1437
+ return invoke$7('ClipBoard.writeText', text);
1438
1438
  };
1439
1439
 
1440
1440
  const {
1441
- invoke: invoke$5,
1441
+ invoke: invoke$6,
1442
1442
  set: set$6
1443
1443
  } = create$3(DialogWorker);
1444
1444
 
1445
1445
  const {
1446
- invoke: invoke$4,
1446
+ invoke: invoke$5,
1447
1447
  set: set$5
1448
1448
  } = create$3(DragAndDropWorker);
1449
1449
  const getDroppedUrisByDropId = async (dropId, isElectron) => {
1450
- return invoke$4('DragAndDrop.getDroppedUrisByDropId', dropId, isElectron);
1450
+ return invoke$5('DragAndDrop.getDroppedUrisByDropId', dropId, isElectron);
1451
1451
  };
1452
1452
 
1453
1453
  const {
1454
- invoke: invoke$3,
1454
+ invoke: invoke$4,
1455
1455
  set: set$4
1456
1456
  } = create$3(IconThemeWorker);
1457
1457
  const getIcons = async iconRequests => {
1458
1458
  // @ts-ignore
1459
- return invoke$3('IconTheme.getIcons', iconRequests);
1459
+ return invoke$4('IconTheme.getIcons', iconRequests);
1460
1460
  };
1461
1461
 
1462
1462
  const {
1463
- invoke: invoke$2,
1463
+ invoke: invoke$3,
1464
1464
  invokeAndTransfer: invokeAndTransfer$2,
1465
1465
  set: set$3
1466
1466
  } = create$3(RendererProcess);
1467
1467
 
1468
1468
  const {
1469
- invoke: invoke$1,
1469
+ invoke: invoke$2,
1470
1470
  invokeAndTransfer: invokeAndTransfer$1,
1471
1471
  set: set$2
1472
1472
  } = create$3(RendererWorker);
1473
1473
  const handleModifiedStatusChange$1 = async (uri, modified) => {
1474
- return invoke$1('Main.handleModifiedStatusChange', uri, modified);
1474
+ return invoke$2('Main.handleModifiedStatusChange', uri, modified);
1475
1475
  };
1476
1476
  const showContextMenu2 = async (uid, menuId, x, y, args) => {
1477
1477
  number(uid);
1478
1478
  number(menuId);
1479
1479
  number(x);
1480
1480
  number(y);
1481
- await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
1481
+ await invoke$2('ContextMenu.show2', uid, menuId, x, y, args);
1482
1482
  };
1483
1483
  const sendMessagePortToClipBoardWorker$1 = async (port, rpcId) => {
1484
1484
  const command = 'ClipBoard.handleMessagePort';
@@ -1493,14 +1493,14 @@ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1493
1493
  await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
1494
1494
  };
1495
1495
  const readFile = async uri => {
1496
- return invoke$1('FileSystem.readFile', uri);
1496
+ return invoke$2('FileSystem.readFile', uri);
1497
1497
  };
1498
1498
  const confirm$1 = async (message, options) => {
1499
- const result = await invoke$1('ConfirmPrompt.prompt', message, options);
1499
+ const result = await invoke$2('ConfirmPrompt.prompt', message, options);
1500
1500
  return result;
1501
1501
  };
1502
1502
  const getPreference = async key => {
1503
- return await invoke$1('Preferences.get', key);
1503
+ return await invoke$2('Preferences.get', key);
1504
1504
  };
1505
1505
 
1506
1506
  const maxClosedTabs = 20;
@@ -1536,7 +1536,7 @@ const isClosedTabEntry = value => {
1536
1536
  return Boolean(entry.group && typeof entry.group === 'object' && entry.tab && typeof entry.tab === 'object' && typeof entry.groupIndex === 'number' && typeof entry.tabIndex === 'number');
1537
1537
  };
1538
1538
  const getEntries = async key => {
1539
- const entries = await invoke$1('CacheStorage.getJson', key);
1539
+ const entries = await invoke$2('CacheStorage.getJson', key);
1540
1540
  return Array.isArray(entries) ? entries.filter(isClosedTabEntry) : [];
1541
1541
  };
1542
1542
  const compact = entry => {
@@ -1557,7 +1557,7 @@ const add = (uid, entries) => {
1557
1557
  const key = getKey(uid);
1558
1558
  const existing = await getEntries(key);
1559
1559
  const compactEntries = entries.map(compact);
1560
- await invoke$1('CacheStorage.setJson', key, [...existing, ...compactEntries].slice(-maxClosedTabs));
1560
+ await invoke$2('CacheStorage.setJson', key, [...existing, ...compactEntries].slice(-maxClosedTabs));
1561
1561
  } catch {
1562
1562
  // Closed tab history is optional and must never break editor commands.
1563
1563
  }
@@ -1566,7 +1566,7 @@ const add = (uid, entries) => {
1566
1566
  const clear = uid => {
1567
1567
  return run(uid, async () => {
1568
1568
  try {
1569
- await invoke$1('CacheStorage.setJson', getKey(uid), []);
1569
+ await invoke$2('CacheStorage.setJson', getKey(uid), []);
1570
1570
  } catch {
1571
1571
  // Closed tab history is optional and must never break workspace changes.
1572
1572
  }
@@ -1581,7 +1581,7 @@ const takeLast = uid => {
1581
1581
  if (!isClosedTabEntry(entry)) {
1582
1582
  return undefined;
1583
1583
  }
1584
- await invoke$1('CacheStorage.setJson', key, entries.slice(0, -1));
1584
+ await invoke$2('CacheStorage.setJson', key, entries.slice(0, -1));
1585
1585
  return entry;
1586
1586
  } catch {
1587
1587
  return undefined;
@@ -1714,26 +1714,30 @@ const closeTab = (state, groupId, tabId) => {
1714
1714
  const handleAttach = async command => {
1715
1715
  // TODO find a better way to append editors
1716
1716
  const parentNodeSelector = '.editor-groups-container, .EditorGroup';
1717
- await invoke$1('Layout.attachViewlet', parentNodeSelector, command.instanceId);
1717
+ await invoke$2('Layout.attachViewlet', parentNodeSelector, command.instanceId);
1718
+ };
1719
+
1720
+ const invoke$1 = async (applicationId, method, ...args) => {
1721
+ return applicationId === undefined ? invoke$2(method, ...args) : invoke$2('Application.execute', applicationId, method, ...args);
1718
1722
  };
1719
1723
 
1720
1724
  const getViewletTitle = async editorUid => {
1721
1725
  try {
1722
- const title = await invoke$1('Viewlet.getTitle', editorUid);
1726
+ const title = await invoke$2('Viewlet.getTitle', editorUid);
1723
1727
  return typeof title === 'string' && title ? title : undefined;
1724
1728
  } catch {
1725
1729
  return undefined;
1726
1730
  }
1727
1731
  };
1728
- const createViewletContent = async (viewletModuleId, editorUid, tabId, bounds, uri, args) => {
1732
+ const createViewletContent = async (viewletModuleId, editorUid, tabId, bounds, uri, args, applicationId) => {
1729
1733
  if (args === undefined) {
1730
- await invoke$1('Layout.createViewlet', viewletModuleId, editorUid, tabId, bounds, uri);
1734
+ await invoke$1(applicationId, 'Layout.createViewlet', viewletModuleId, editorUid, tabId, bounds, uri);
1731
1735
  } else {
1732
- await invoke$1('Layout.createViewlet', viewletModuleId, editorUid, tabId, bounds, uri, args);
1736
+ await invoke$1(applicationId, 'Layout.createViewlet', viewletModuleId, editorUid, tabId, bounds, uri, args);
1733
1737
  }
1734
1738
  };
1735
- const createViewlet = async (viewletModuleId, editorUid, tabId, bounds, uri, args) => {
1736
- await createViewletContent(viewletModuleId, editorUid, tabId, bounds, uri, args);
1739
+ const createViewlet = async (viewletModuleId, editorUid, tabId, bounds, uri, args, applicationId) => {
1740
+ await createViewletContent(viewletModuleId, editorUid, tabId, bounds, uri, args, applicationId);
1737
1741
  return getViewletTitle(editorUid);
1738
1742
  };
1739
1743
 
@@ -1766,7 +1770,7 @@ const notifyActiveEditorChange = async (oldState, newState) => {
1766
1770
  return;
1767
1771
  }
1768
1772
  try {
1769
- await invoke$1('Layout.handleActiveEditorChange', newUri);
1773
+ await invoke$1(newState.applicationId, 'Layout.handleActiveEditorChange', newUri);
1770
1774
  } catch (error) {
1771
1775
  console.warn('Failed to notify viewlets about active editor change', error);
1772
1776
  }
@@ -1793,7 +1797,7 @@ const notifyMountedViewlets = async (oldState, newState) => {
1793
1797
  return;
1794
1798
  }
1795
1799
  try {
1796
- await invoke$1('Layout.setMountedViewlets', newState.uid, newViewletUids);
1800
+ await invoke$1(newState.applicationId, 'Layout.setMountedViewlets', newState.uid, newViewletUids);
1797
1801
  } catch (error) {
1798
1802
  console.warn('Failed to publish mounted viewlets', error);
1799
1803
  }
@@ -2092,7 +2096,10 @@ const disposeViewletForTab = (state, tabId) => {
2092
2096
  const handleCreate = async command => {
2093
2097
  // Safe to call - no visible side effects
2094
2098
 
2095
- const title = await createViewlet(command.viewletModuleId, command.editorUid, command.tabId, command.bounds, command.uri || '');
2099
+ const {
2100
+ applicationId
2101
+ } = get$1(command.uid).newState;
2102
+ const title = await createViewlet(command.viewletModuleId, command.editorUid, command.tabId, command.bounds, command.uri || '', undefined, applicationId);
2096
2103
 
2097
2104
  // After viewlet is created, mark it as ready
2098
2105
  // Attachment is handled automatically by virtual DOM reference nodes
@@ -2108,17 +2115,17 @@ const handleCreate = async command => {
2108
2115
  const handleDetach = async command => {
2109
2116
  // Hides viewlet but keeps it alive
2110
2117
 
2111
- await invoke$1('Viewlet.detach', command.instanceId);
2118
+ await invoke$2('Viewlet.detach', command.instanceId);
2112
2119
  };
2113
2120
 
2114
2121
  const handleDispose = async command => {
2115
2122
  // Fully destroys viewlet
2116
2123
 
2117
- await invoke$1('Viewlet.dispose', command.instanceId);
2124
+ await invoke$2('Viewlet.dispose', command.instanceId);
2118
2125
  };
2119
2126
 
2120
2127
  const handleSetBounds = async command => {
2121
- await invoke$1('Viewlet.setBounds', command.instanceId, command.bounds);
2128
+ await invoke$2('Viewlet.setBounds', command.instanceId, command.bounds);
2122
2129
  };
2123
2130
 
2124
2131
  const executeViewletCommand = async command => {
@@ -2202,7 +2209,7 @@ const closeTabWithViewlet = async (state, groupId, tabId) => {
2202
2209
  };
2203
2210
 
2204
2211
  const saveEditor = async editorUid => {
2205
- return invoke$1('Editor.save', editorUid);
2212
+ return invoke$2('Editor.save', editorUid);
2206
2213
  };
2207
2214
 
2208
2215
  const confirm = async (message, options) => {
@@ -2213,7 +2220,7 @@ const confirm = async (message, options) => {
2213
2220
  if (!errorMessage.includes('ConfirmPrompt.prompt') || !errorMessage.includes('not found')) {
2214
2221
  throw error;
2215
2222
  }
2216
- return invoke$5('ConfirmPrompt.prompt', message, options);
2223
+ return invoke$6('ConfirmPrompt.prompt', message, options);
2217
2224
  }
2218
2225
  };
2219
2226
  const promptSave = async title => {
@@ -2293,7 +2300,7 @@ const disposeEditors = async editorUids => {
2293
2300
  // Dispose all child viewlets in the renderer worker
2294
2301
  for (const editorUid of editorUids) {
2295
2302
  try {
2296
- await invoke$1('Viewlet.dispose', editorUid);
2303
+ await invoke$2('Viewlet.dispose', editorUid);
2297
2304
  } catch {
2298
2305
  // Silently ignore errors during disposal
2299
2306
  // Viewlet may already be disposed or renderer worker may not be available
@@ -2604,7 +2611,7 @@ const copyIntoNewWindow$1 = async state => {
2604
2611
  if (!tab?.uri) {
2605
2612
  return state;
2606
2613
  }
2607
- await invoke$1('ElectronWindow.openNewWithUri', tab.uri);
2614
+ await invoke$2('ElectronWindow.openNewWithUri', tab.uri);
2608
2615
  return state;
2609
2616
  };
2610
2617
 
@@ -2616,7 +2623,7 @@ const copyPath$1 = async (state, path) => {
2616
2623
 
2617
2624
  const copyRelativePath$1 = async (state, path) => {
2618
2625
  string(path);
2619
- const relativePath = await invoke$1('Workspace.pathBaseName', path);
2626
+ const relativePath = await invoke$1(state.applicationId, 'Workspace.pathBaseName', path);
2620
2627
  await writeText(relativePath);
2621
2628
  return state;
2622
2629
  };
@@ -2639,8 +2646,11 @@ const normalizeLayoutDirection = direction => {
2639
2646
  return undefined;
2640
2647
  };
2641
2648
 
2642
- const create$1 = (uid, uri, x, y, width, height, platform, assetDir, tabHeight = 35) => {
2649
+ const create$1 = (uid, uri, x, y, width, height, platform, assetDir, tabHeight = 35, applicationId) => {
2643
2650
  const state = {
2651
+ ...(applicationId !== undefined && {
2652
+ applicationId
2653
+ }),
2644
2654
  assetDir,
2645
2655
  fileIconCache: {},
2646
2656
  height,
@@ -2750,7 +2760,7 @@ const isConnected = () => {
2750
2760
  return connected;
2751
2761
  };
2752
2762
  const invoke = (method, ...params) => {
2753
- return invoke$2(method, ...params);
2763
+ return invoke$3(method, ...params);
2754
2764
  };
2755
2765
  const invokeAndTransfer = (method, ...params) => {
2756
2766
  return invokeAndTransfer$2(method, ...params);
@@ -2770,7 +2780,7 @@ const focus = async state => {
2770
2780
  await invoke('Viewlet.focusSelector', editorUid, '[name="editor"]');
2771
2781
  await invoke('Viewlet.focusSelectorAfterRender', editorUid, '[name="editor"]');
2772
2782
  } else {
2773
- await invoke$1('Viewlet.focusSelector', editorUid, '[name="editor"]');
2783
+ await invoke$2('Viewlet.focusSelector', editorUid, '[name="editor"]');
2774
2784
  }
2775
2785
  return state;
2776
2786
  };
@@ -3176,11 +3186,11 @@ const getSelectedTabBounds = (state, groupId = state.layout.activeGroupId) => {
3176
3186
  };
3177
3187
  };
3178
3188
 
3179
- const getViewletModuleId$1 = async (uri, opener) => {
3189
+ const getViewletModuleId$1 = async (uri, opener, applicationId) => {
3180
3190
  // Query RendererWorker for viewlet module ID (optional, may fail in tests)
3181
3191
  let viewletModuleId;
3182
3192
  try {
3183
- viewletModuleId = opener === undefined ? await invoke$1('Layout.getModuleId', uri) : await invoke$1('Layout.getModuleId', uri, opener);
3193
+ viewletModuleId = opener === undefined ? await invoke$1(applicationId, 'Layout.getModuleId', uri) : await invoke$1(applicationId, 'Layout.getModuleId', uri, opener);
3184
3194
  } catch {
3185
3195
  // Viewlet creation is optional - silently ignore if RendererWorker isn't available
3186
3196
  }
@@ -3194,31 +3204,31 @@ const ProcessExplorer = 'ProcessExplorer';
3194
3204
  const RunningExtensions = 'RunningExtensions';
3195
3205
  const QuickPick = 'QuickPick';
3196
3206
 
3197
- const getViewletModuleIdForEditorInput = async editorInput => {
3207
+ const getViewletModuleIdForEditorInput = async (editorInput, applicationId) => {
3198
3208
  switch (editorInput.type) {
3199
3209
  case 'binary':
3200
3210
  return undefined;
3201
3211
  case 'diff-editor':
3202
3212
  return DiffEditor;
3203
3213
  case 'editor':
3204
- return editorInput.forceText ? EditorText : getViewletModuleId$1(editorInput.uri);
3214
+ return editorInput.forceText ? EditorText : getViewletModuleId$1(editorInput.uri, undefined, applicationId);
3205
3215
  case 'extension-detail-view':
3206
3216
  return ExtensionDetail;
3207
3217
  case 'image':
3208
3218
  case 'video':
3209
- return getViewletModuleId$1(editorInput.uri);
3219
+ return getViewletModuleId$1(editorInput.uri, undefined, applicationId);
3210
3220
  case 'process-explorer':
3211
3221
  return ProcessExplorer;
3212
3222
  case 'running-extensions':
3213
3223
  return RunningExtensions;
3214
3224
  case 'webview':
3215
- return getViewletModuleId$1(editorInput.uri, editorInput.providerId);
3225
+ return getViewletModuleId$1(editorInput.uri, editorInput.providerId, applicationId);
3216
3226
  }
3217
3227
  };
3218
3228
 
3219
- const getViewletModuleId = async tab => {
3229
+ const getViewletModuleId = async (tab, applicationId) => {
3220
3230
  const normalizedTab = normalizeTabEditorInput(tab);
3221
- return normalizedTab.editorInput ? getViewletModuleIdForEditorInput(normalizedTab.editorInput) : invoke$1('Layout.getModuleId', normalizedTab.uri);
3231
+ return normalizedTab.editorInput ? getViewletModuleIdForEditorInput(normalizedTab.editorInput, applicationId) : invoke$1(applicationId, 'Layout.getModuleId', normalizedTab.uri);
3222
3232
  };
3223
3233
 
3224
3234
  const startContentLoading = async (oldState, state, tabId, path, requestId) => {
@@ -3254,7 +3264,7 @@ const maybeCreateViewletForSelectedTab = async (state, newState, groupIndex, ind
3254
3264
  if (!shouldCreateViewletForSelectedTab(selectedTab)) {
3255
3265
  return undefined;
3256
3266
  }
3257
- const viewletModuleId = await getViewletModuleId(selectedTab);
3267
+ const viewletModuleId = await getViewletModuleId(selectedTab, state.applicationId);
3258
3268
  if (!viewletModuleId) {
3259
3269
  return undefined;
3260
3270
  }
@@ -3270,7 +3280,7 @@ const maybeCreateViewletForSelectedTab = async (state, newState, groupIndex, ind
3270
3280
  editorUid
3271
3281
  } = tabWithViewlet.tab;
3272
3282
  if (editorUid !== -1 && selectedTab.uri) {
3273
- const title = await createViewlet(viewletModuleId, editorUid, tabId, bounds, selectedTab.uri);
3283
+ const title = await createViewlet(viewletModuleId, editorUid, tabId, bounds, selectedTab.uri, undefined, state.applicationId);
3274
3284
  stateWithViewlet = handleViewletReady(stateWithViewlet, editorUid, title);
3275
3285
  set$1(uid, state, stateWithViewlet);
3276
3286
  }
@@ -4732,7 +4742,7 @@ const handleClickTogglePreview = async state => {
4732
4742
  if (!activeTabInfo || !activeTabInfo.tab.uri) {
4733
4743
  return state;
4734
4744
  }
4735
- await invoke$1('Layout.showPreview', activeTabInfo.tab.uri);
4745
+ await invoke$1(state.applicationId, 'Layout.showPreview', activeTabInfo.tab.uri);
4736
4746
  return state;
4737
4747
  };
4738
4748
 
@@ -4939,12 +4949,12 @@ const getMaxFileSize = async () => {
4939
4949
  }
4940
4950
  return defaultMaxFileSizeMb * bytesPerMegabyte;
4941
4951
  };
4942
- const getLargeFileSize = async (editorInput, forceOpen = false) => {
4952
+ const getLargeFileSize = async (editorInput, forceOpen = false, applicationId) => {
4943
4953
  if (editorInput.type !== 'editor' || forceOpen || !editorInput.uri.startsWith('file://')) {
4944
4954
  return undefined;
4945
4955
  }
4946
4956
  try {
4947
- const [fileSize, maxFileSize] = await Promise.all([invoke$1('FileSystem.getFileSize', editorInput.uri), getMaxFileSize()]);
4957
+ const [fileSize, maxFileSize] = await Promise.all([invoke$1(applicationId, 'FileSystem.getFileSize', editorInput.uri), getMaxFileSize()]);
4948
4958
  return typeof fileSize === 'number' && fileSize > maxFileSize ? fileSize : undefined;
4949
4959
  } catch {
4950
4960
  // File systems without stat support should retain the existing open behavior.
@@ -5199,12 +5209,12 @@ const shouldCheckDirectoryEditorInput = editorInput => {
5199
5209
  return baseName.endsWith('/') || baseName !== '' && !baseName.includes('.');
5200
5210
  };
5201
5211
 
5202
- const isDirectoryEditorInput = async editorInput => {
5212
+ const isDirectoryEditorInput = async (editorInput, applicationId) => {
5203
5213
  if (!shouldCheckDirectoryEditorInput(editorInput)) {
5204
5214
  return false;
5205
5215
  }
5206
5216
  try {
5207
- const type = await invoke$1('FileSystem.stat', editorInput.uri);
5217
+ const type = await invoke$1(applicationId, 'FileSystem.stat', editorInput.uri);
5208
5218
  return type === Directory;
5209
5219
  } catch {
5210
5220
  return false;
@@ -5366,9 +5376,9 @@ const updateTabIcon = async (context, readyState, tabId) => {
5366
5376
  }
5367
5377
  };
5368
5378
 
5369
- const renderMainAreaPending = async uid => {
5379
+ const renderMainAreaPending = async (uid, applicationId) => {
5370
5380
  try {
5371
- await invoke$1('Layout.renderMainAreaPending', uid);
5381
+ await invoke$1(applicationId, 'Layout.renderMainAreaPending', uid);
5372
5382
  } catch {
5373
5383
  // Older renderer workers render the final state when openInput completes.
5374
5384
  }
@@ -5432,7 +5442,7 @@ const openInputWithContext = async (context, options) => {
5432
5442
  if (replacedEditorUid !== -1) {
5433
5443
  await disposeEditors([replacedEditorUid]);
5434
5444
  }
5435
- if (await isDirectoryEditorInput(editorInput)) {
5445
+ if (await isDirectoryEditorInput(editorInput, state.applicationId)) {
5436
5446
  const latestState = context.getState();
5437
5447
  const errorState = updateTab(latestState, tabId, {
5438
5448
  errorMessage: 'Expected a file but received a folder',
@@ -5450,7 +5460,7 @@ const openInputWithContext = async (context, options) => {
5450
5460
  await context.updateState(() => binaryState);
5451
5461
  return;
5452
5462
  }
5453
- const fileSize = await getLargeFileSize(editorInput, options.forceOpen === true);
5463
+ const fileSize = await getLargeFileSize(editorInput, options.forceOpen === true, state.applicationId);
5454
5464
  if (fileSize !== undefined) {
5455
5465
  const latestState = context.getState();
5456
5466
  const largeFileState = updateTab(latestState, tabId, {
@@ -5462,7 +5472,7 @@ const openInputWithContext = async (context, options) => {
5462
5472
  return;
5463
5473
  }
5464
5474
  try {
5465
- const viewletModuleId = await getViewletModuleIdForEditorInput(editorInput);
5475
+ const viewletModuleId = await getViewletModuleIdForEditorInput(editorInput, state.applicationId);
5466
5476
  const stateAfterModuleId = context.getState();
5467
5477
  if (!viewletModuleId) {
5468
5478
  const unsupportedState = updateTab(stateAfterModuleId, tabId, {
@@ -5491,11 +5501,11 @@ const openInputWithContext = async (context, options) => {
5491
5501
  if (editorUid === -1) {
5492
5502
  throw new Error('invalid editorUid');
5493
5503
  }
5494
- await createViewletContent(viewletModuleId, editorUid, tabId, bounds, uri, options.args);
5504
+ await createViewletContent(viewletModuleId, editorUid, tabId, bounds, uri, options.args, state.applicationId);
5495
5505
  const latestState = context.getState();
5496
5506
  let readyState = handleViewletReady(latestState, editorUid);
5497
5507
  await context.updateState(() => readyState);
5498
- await renderMainAreaPending(state.uid);
5508
+ await renderMainAreaPending(state.uid, state.applicationId);
5499
5509
  await focusIfRequested(context.getState(), options.focus);
5500
5510
  const renderedTitle = await getViewletTitle(editorUid);
5501
5511
  if (renderedTitle) {
@@ -6521,10 +6531,10 @@ const applyDropAction = async (context, action, splitDirection, targetGroupId) =
6521
6531
  break;
6522
6532
  }
6523
6533
  case 'setPath':
6524
- void invoke$1('Workspace.setPath', action.value).catch(() => {});
6534
+ void invoke$1(context.getState().applicationId, 'Workspace.setPath', action.value).catch(() => {});
6525
6535
  break;
6526
6536
  case 'setUri':
6527
- void invoke$1('Workspace.setUri', action.value).catch(() => {});
6537
+ void invoke$1(context.getState().applicationId, 'Workspace.setUri', action.value).catch(() => {});
6528
6538
  break;
6529
6539
  }
6530
6540
  };
@@ -6628,12 +6638,12 @@ const applyTabDrop = (state, sourceGroupId, tabId, splitDirection, targetGroupId
6628
6638
  return moveTabToGroup(splitState, sourceGroupId, splitState.layout.activeGroupId, tabId);
6629
6639
  };
6630
6640
 
6631
- const getDropAction = async uris => {
6641
+ const getDropAction = async (uris, applicationId) => {
6632
6642
  for (const uri of uris) {
6633
6643
  if (uri.endsWith('/') || (await isDirectoryEditorInput({
6634
6644
  type: 'editor',
6635
6645
  uri
6636
- }))) {
6646
+ }, applicationId))) {
6637
6647
  if (uri.includes('://')) {
6638
6648
  return {
6639
6649
  command: 'setUri',
@@ -6682,7 +6692,7 @@ const handleDrop = async (context, dropId) => {
6682
6692
  await context.updateState(state => resetPointerDown(applyTabDrop(state, sourceGroup.id, draggedTab.id, splitDirection, tabTargetGroupId, tabTargetIndex)));
6683
6693
  return;
6684
6694
  }
6685
- const actions = await getDropAction(uris);
6695
+ const actions = await getDropAction(uris, initialState.applicationId);
6686
6696
  await applyDropAction(context, actions, splitDirection, targetGroupId);
6687
6697
  };
6688
6698
 
@@ -6779,7 +6789,7 @@ const newFile = async state => {
6779
6789
  if (actualEditorUid === -1) {
6780
6790
  throw new Error(`invalid editorUid`);
6781
6791
  }
6782
- const title = await createViewlet(viewletModuleId, actualEditorUid, tabId, bounds, newTab.uri || '');
6792
+ const title = await createViewlet(viewletModuleId, actualEditorUid, tabId, bounds, newTab.uri || '', undefined, state.applicationId);
6783
6793
 
6784
6794
  // After viewlet is created, get the latest state and mark it as ready
6785
6795
  const {
@@ -6881,7 +6891,7 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcessFa
6881
6891
  throw new TypeError(`Viewlet command not found: ${command}`);
6882
6892
  }
6883
6893
  await fn(uid, ...args);
6884
- await invoke$1('Viewlet.requestRender', uid);
6894
+ await invoke$2('Viewlet.requestRender', uid);
6885
6895
  };
6886
6896
  const rpc = await create$8({
6887
6897
  commandMap: {
@@ -6930,7 +6940,7 @@ const handleModifiedStatusChangeWithContext = async (context, uri, newStatus) =>
6930
6940
 
6931
6941
  const resizeChild = async (editorUid, dimensions) => {
6932
6942
  try {
6933
- return await invoke$1('Viewlet.resize', editorUid, dimensions);
6943
+ return await invoke$2('Viewlet.resize', editorUid, dimensions);
6934
6944
  } catch {
6935
6945
  return [];
6936
6946
  }
@@ -7272,7 +7282,7 @@ const focusTab = async (state, groupIndex, index) => {
7272
7282
  if (isConnected()) {
7273
7283
  await invoke('Viewlet.focusSelector', state.uid, selector);
7274
7284
  } else {
7275
- await invoke$1('Viewlet.focusSelector', state.uid, selector);
7285
+ await invoke$2('Viewlet.focusSelector', state.uid, selector);
7276
7286
  }
7277
7287
  };
7278
7288
  const handleTabKeyDown = async (state, groupIndexRaw, indexRaw, key) => {
@@ -7319,7 +7329,7 @@ const handleTabsWheel = async (state, groupIndexRaw, deltaMode, deltaY) => {
7319
7329
  if (isConnected()) {
7320
7330
  await invoke('Viewlet.scrollSelectorBy', state.uid, selector, pixelDelta);
7321
7331
  } else {
7322
- await invoke$1('Viewlet.scrollSelectorBy', state.uid, selector, pixelDelta);
7332
+ await invoke$2('Viewlet.scrollSelectorBy', state.uid, selector, pixelDelta);
7323
7333
  }
7324
7334
  return state;
7325
7335
  };
@@ -7346,7 +7356,7 @@ const handleUriChange = async (state, oldUri, newUri) => {
7346
7356
  }
7347
7357
  if (renamedUri) {
7348
7358
  if (tab.editorInput?.type === 'editor' && tab.editorUid !== -1) {
7349
- editorUriUpdates.push(invoke$1('Editor.handleUriChange', tab.editorUid, renamedUri));
7359
+ editorUriUpdates.push(invoke$2('Editor.handleUriChange', tab.editorUid, renamedUri));
7350
7360
  }
7351
7361
  const editorInput = tab.editorInput && 'uri' in tab.editorInput ? {
7352
7362
  ...tab.editorInput,
@@ -7401,9 +7411,9 @@ const toFileUri = path => {
7401
7411
  }
7402
7412
  return path;
7403
7413
  };
7404
- const loadHomeDirUri = async () => {
7414
+ const loadHomeDirUri = async applicationId => {
7405
7415
  try {
7406
- const homeDir = await invoke$1('Workspace.getHomeDir');
7416
+ const homeDir = await invoke$1(applicationId, 'Workspace.getHomeDir');
7407
7417
  return typeof homeDir === 'string' ? toFileUri(homeDir) : '';
7408
7418
  } catch {
7409
7419
  return '';
@@ -7517,7 +7527,7 @@ const createViewlets = async (state, viewletModuleIds) => {
7517
7527
  const editorUid = activeTab.editorUid === -1 ? create$2() : activeTab.editorUid;
7518
7528
  editorUids[activeTab.id] = editorUid;
7519
7529
  const bounds = getSelectedTabBounds(state, group.id);
7520
- const title = await createViewlet(viewletModuleIds[activeTab.id], editorUid, activeTab.id, bounds, activeTab.uri || '');
7530
+ const title = await createViewlet(viewletModuleIds[activeTab.id], editorUid, activeTab.id, bounds, activeTab.uri || '', undefined, state.applicationId);
7521
7531
  if (title) {
7522
7532
  titles[activeTab.id] = title;
7523
7533
  }
@@ -7529,7 +7539,7 @@ const createViewlets = async (state, viewletModuleIds) => {
7529
7539
  };
7530
7540
  };
7531
7541
 
7532
- const getViewletModuleIds = async layout => {
7542
+ const getViewletModuleIds = async (layout, applicationId) => {
7533
7543
  const {
7534
7544
  groups
7535
7545
  } = layout;
@@ -7545,7 +7555,7 @@ const getViewletModuleIds = async layout => {
7545
7555
  editorInput,
7546
7556
  uri
7547
7557
  } = normalizedTab;
7548
- const viewletModuleId = normalizedTab.editorInput ? await getViewletModuleIdForEditorInput(editorInput) : await getViewletModuleId$1(uri);
7558
+ const viewletModuleId = normalizedTab.editorInput ? await getViewletModuleIdForEditorInput(editorInput, applicationId) : await getViewletModuleId$1(uri, undefined, applicationId);
7549
7559
  if (viewletModuleId) {
7550
7560
  viewletModuleIds[activeTab.id] = viewletModuleId;
7551
7561
  }
@@ -7597,7 +7607,7 @@ const restoreAndCreateEditors = async (state, restoredLayout) => {
7597
7607
  };
7598
7608
 
7599
7609
  // Get viewlet module IDs for all active tabs
7600
- const viewletModuleIds = await getViewletModuleIds(newState.layout);
7610
+ const viewletModuleIds = await getViewletModuleIds(newState.layout, state.applicationId);
7601
7611
 
7602
7612
  // Create viewlets and get editor UIDs
7603
7613
  const {
@@ -7622,7 +7632,7 @@ const restoreAndCreateEditors = async (state, restoredLayout) => {
7622
7632
  };
7623
7633
 
7624
7634
  const loadContent$1 = async (state, savedState) => {
7625
- const homeDirUri = await loadHomeDirUri();
7635
+ const homeDirUri = await loadHomeDirUri(state.applicationId);
7626
7636
  const stateWithHomeDir = {
7627
7637
  ...state,
7628
7638
  homeDirUri
@@ -7700,7 +7710,7 @@ const reloadChangedEditors = async (state, changed) => {
7700
7710
  }
7701
7711
  }
7702
7712
  }
7703
- await Promise.allSettled(Array.from(editorUids, editorUid => invoke$1('Viewlet.reload', editorUid)));
7713
+ await Promise.allSettled(Array.from(editorUids, editorUid => invoke$2('Viewlet.reload', editorUid)));
7704
7714
  };
7705
7715
  const handleWorkspaceRefresh = async (state, refresh = {}) => {
7706
7716
  const changes = Array.isArray(refresh) ? {
@@ -8007,12 +8017,12 @@ const moveIntoNewWindow = async state => {
8007
8017
  if (!tab?.uri) {
8008
8018
  return state;
8009
8019
  }
8010
- await invoke$1('ElectronWindow.openNewWithUri', tab.uri);
8020
+ await invoke$2('ElectronWindow.openNewWithUri', tab.uri);
8011
8021
  return closeTabAndSave(state, group.id, activeTabId);
8012
8022
  };
8013
8023
 
8014
8024
  const newWindow = async state => {
8015
- await invoke$1('ElectronWindow.openNew');
8025
+ await invoke$2('ElectronWindow.openNew');
8016
8026
  return state;
8017
8027
  };
8018
8028
 
@@ -8237,7 +8247,7 @@ const renderPendingViewletUpdate = (oldState, newState) => {
8237
8247
  const update = newState.pendingViewletUpdate;
8238
8248
  newState.pendingViewletUpdate = undefined;
8239
8249
  setTimeout(() => {
8240
- void invoke$1('Viewlet.dispose', update.disposal).catch(() => {});
8250
+ void invoke$2('Viewlet.dispose', update.disposal).catch(() => {});
8241
8251
  }, 50);
8242
8252
  return update.focus === undefined ? [] : ['Viewlet.setFocusContext', update.focus, FocusEditorText, 0, update.focus, 'Editor'];
8243
8253
  };
@@ -8387,9 +8397,9 @@ const textEditorEntry = {
8387
8397
  label: 'Text Editor',
8388
8398
  type: 'editor'
8389
8399
  };
8390
- const getViewProviderEntries = async uri => {
8400
+ const getViewProviderEntries = async (uri, applicationId) => {
8391
8401
  try {
8392
- const providers = await invoke$1('WebView.getEditorProviders');
8402
+ const providers = await invoke$1(applicationId, 'WebView.getEditorProviders');
8393
8403
  const matchingProviders = providers.filter(provider => provider?.id && provider.selector?.some(selector => uri.endsWith(selector)));
8394
8404
  return [textEditorEntry, ...matchingProviders.map(provider => {
8395
8405
  const titleElement = provider.elements?.find(element => element.type === 'title');
@@ -8418,13 +8428,13 @@ const reopenEditorWith = async (context, preferredEditorId) => {
8418
8428
  if (preferredEditorId === textEditorEntry.id) {
8419
8429
  selected = textEditorEntry;
8420
8430
  } else {
8421
- const entries = await getViewProviderEntries(initialTab.uri);
8431
+ const entries = await getViewProviderEntries(initialTab.uri, initialState.applicationId);
8422
8432
  const items = entries.map(entry => ({
8423
8433
  description: '',
8424
8434
  label: entry.label,
8425
8435
  value: entry
8426
8436
  }));
8427
- selected = await invoke$1('ExtensionHostQuickPick.showQuickPick', {
8437
+ selected = await invoke$1(initialState.applicationId, 'ExtensionHostQuickPick.showQuickPick', {
8428
8438
  items,
8429
8439
  placeholder: 'Select Editor'
8430
8440
  });
@@ -8441,7 +8451,7 @@ const reopenEditorWith = async (context, preferredEditorId) => {
8441
8451
  type: 'webview',
8442
8452
  uri: initialTab.uri
8443
8453
  };
8444
- const viewletModuleId = await getViewletModuleIdForEditorInput(editorInput);
8454
+ const viewletModuleId = await getViewletModuleIdForEditorInput(editorInput, context.getState().applicationId);
8445
8455
  if (!viewletModuleId) {
8446
8456
  return;
8447
8457
  }
@@ -8464,12 +8474,12 @@ const reopenEditorWith = async (context, preferredEditorId) => {
8464
8474
  if (!tabWithViewlet || tabWithViewlet.tab.editorUid === -1) {
8465
8475
  return;
8466
8476
  }
8467
- const renderedTitle = await createViewlet(viewletModuleId, tabWithViewlet.tab.editorUid, initialTab.id, bounds, initialTab.uri);
8477
+ const renderedTitle = await createViewlet(viewletModuleId, tabWithViewlet.tab.editorUid, initialTab.id, bounds, initialTab.uri, undefined, latestState.applicationId);
8468
8478
  const readyState = handleViewletReady(context.getState(), tabWithViewlet.tab.editorUid, renderedTitle);
8469
8479
  await context.updateState(() => readyState);
8470
8480
  if (oldEditorUid !== -1) {
8471
8481
  try {
8472
- await invoke$1('Viewlet.dispose', oldEditorUid);
8482
+ await invoke$2('Viewlet.dispose', oldEditorUid);
8473
8483
  } catch {
8474
8484
  // Reopening should still proceed if the previous viewlet was already disposed.
8475
8485
  }
@@ -8484,10 +8494,10 @@ const resize$1 = (state, dimensions) => {
8484
8494
  };
8485
8495
 
8486
8496
  const settingsUri = 'app://settings.json';
8487
- const saveEditorAndHandleSettingsChange = async tab => {
8497
+ const saveEditorAndHandleSettingsChange = async (tab, applicationId) => {
8488
8498
  const editorState = await saveEditor(tab.editorUid);
8489
8499
  if (!editorState?.modified && tab.uri === settingsUri) {
8490
- await invoke$1('Layout.handleSettingsChanged');
8500
+ await invoke$1(applicationId, 'Layout.handleSettingsChanged');
8491
8501
  }
8492
8502
  return editorState;
8493
8503
  };
@@ -8529,16 +8539,16 @@ const save = async state => {
8529
8539
  return currentState;
8530
8540
  }
8531
8541
  if (!tab.isDirty) {
8532
- await saveEditorAndHandleSettingsChange(tab);
8542
+ await saveEditorAndHandleSettingsChange(tab, state.applicationId);
8533
8543
  return getLatestStoredState(uid, currentState, tab.id, tab.uri);
8534
8544
  }
8535
- const editorState = await saveEditorAndHandleSettingsChange(tab);
8545
+ const editorState = await saveEditorAndHandleSettingsChange(tab, state.applicationId);
8536
8546
  const latestState = getLatestStoredState(uid, currentState, tab.id, tab.uri);
8537
8547
  if (editorState?.modified) {
8538
8548
  return latestState;
8539
8549
  }
8540
8550
  if (tab.uri) {
8541
- await handleModifiedStatusChange$1(tab.uri, false);
8551
+ await invoke$1(state.applicationId, 'Main.handleModifiedStatusChange', tab.uri, false);
8542
8552
  }
8543
8553
  const stateAfterModifiedStatusChange = getLatestStoredState(uid, latestState, tab.id, tab.uri);
8544
8554
  return updateTab(stateAfterModifiedStatusChange, tab.id, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.60.0",
3
+ "version": "9.61.0",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",