@lvce-editor/main-area-worker 9.44.1 → 9.45.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.
- package/dist/mainAreaWorkerMain.js +140 -90
- package/package.json +1 -1
|
@@ -1269,7 +1269,7 @@ const createMockRpc = ({
|
|
|
1269
1269
|
};
|
|
1270
1270
|
|
|
1271
1271
|
const rpcs = Object.create(null);
|
|
1272
|
-
const set$
|
|
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$
|
|
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$
|
|
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$
|
|
1526
|
-
set: set$
|
|
1526
|
+
invoke: invoke$6,
|
|
1527
|
+
set: set$7
|
|
1527
1528
|
} = create$4(ClipBoardWorker);
|
|
1528
1529
|
const writeText = async text => {
|
|
1529
|
-
return invoke$
|
|
1530
|
+
return invoke$6('ClipBoard.writeText', text);
|
|
1530
1531
|
};
|
|
1531
1532
|
|
|
1532
1533
|
const {
|
|
1533
|
-
invoke: invoke$
|
|
1534
|
-
set: set$
|
|
1534
|
+
invoke: invoke$5,
|
|
1535
|
+
set: set$6
|
|
1535
1536
|
} = create$4(DialogWorker);
|
|
1536
1537
|
|
|
1537
1538
|
const {
|
|
1538
|
-
invoke: invoke$
|
|
1539
|
-
set: set$
|
|
1539
|
+
invoke: invoke$4,
|
|
1540
|
+
set: set$5
|
|
1540
1541
|
} = create$4(DragAndDropWorker);
|
|
1541
1542
|
const getDroppedItems = async (itemIds, isElectron) => {
|
|
1542
|
-
return invoke$
|
|
1543
|
+
return invoke$4('DragAndDrop.getDroppedItems', itemIds, isElectron);
|
|
1543
1544
|
};
|
|
1544
1545
|
|
|
1545
1546
|
const {
|
|
1546
|
-
invoke: invoke$
|
|
1547
|
-
set: set$
|
|
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$
|
|
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$
|
|
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$
|
|
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
|
|
@@ -2723,7 +2729,7 @@ const getGroupById = (state, groupId) => {
|
|
|
2723
2729
|
return groups.find(group => group.id === groupId);
|
|
2724
2730
|
};
|
|
2725
2731
|
|
|
2726
|
-
const closeTabsRight = (state, groupId) => {
|
|
2732
|
+
const closeTabsRight = (state, groupId, tabId) => {
|
|
2727
2733
|
const {
|
|
2728
2734
|
layout
|
|
2729
2735
|
} = state;
|
|
@@ -2743,28 +2749,30 @@ const closeTabsRight = (state, groupId) => {
|
|
|
2743
2749
|
activeTabId,
|
|
2744
2750
|
tabs
|
|
2745
2751
|
} = group;
|
|
2746
|
-
|
|
2752
|
+
const targetTabId = tabId ?? activeTabId;
|
|
2753
|
+
if (targetTabId === -1) {
|
|
2747
2754
|
return state;
|
|
2748
2755
|
}
|
|
2749
|
-
const
|
|
2750
|
-
if (
|
|
2756
|
+
const targetTabIndex = tabs.findIndex(tab => tab.id === targetTabId);
|
|
2757
|
+
if (targetTabIndex === -1) {
|
|
2751
2758
|
return state;
|
|
2752
2759
|
}
|
|
2753
|
-
const newTabs = tabs.slice(0,
|
|
2760
|
+
const newTabs = tabs.slice(0, targetTabIndex + 1);
|
|
2754
2761
|
if (newTabs.length === tabs.length) {
|
|
2755
2762
|
return state;
|
|
2756
2763
|
}
|
|
2757
2764
|
const groupIndex = groups.findIndex(g => g.id === targetGroupId);
|
|
2758
|
-
const closedTabs = tabs.slice(
|
|
2765
|
+
const closedTabs = tabs.slice(targetTabIndex + 1).map((tab, index) => ({
|
|
2759
2766
|
group,
|
|
2760
2767
|
groupIndex,
|
|
2761
2768
|
tab,
|
|
2762
|
-
tabIndex:
|
|
2769
|
+
tabIndex: targetTabIndex + index + 1
|
|
2763
2770
|
}));
|
|
2764
2771
|
const newGroups = groups.map(g => {
|
|
2765
2772
|
if (g.id === targetGroupId) {
|
|
2766
2773
|
return {
|
|
2767
2774
|
...g,
|
|
2775
|
+
activeTabId: newTabs.some(tab => tab.id === activeTabId) ? activeTabId : targetTabId,
|
|
2768
2776
|
isEmpty: newTabs.length === 0,
|
|
2769
2777
|
tabs: newTabs
|
|
2770
2778
|
};
|
|
@@ -2805,7 +2813,7 @@ const copyIntoNewWindow$1 = async state => {
|
|
|
2805
2813
|
if (!tab?.uri) {
|
|
2806
2814
|
return state;
|
|
2807
2815
|
}
|
|
2808
|
-
await invoke('ElectronWindow.openNewWithUri', tab.uri);
|
|
2816
|
+
await invoke$1('ElectronWindow.openNewWithUri', tab.uri);
|
|
2809
2817
|
return state;
|
|
2810
2818
|
};
|
|
2811
2819
|
|
|
@@ -2817,7 +2825,7 @@ const copyPath$1 = async (state, path) => {
|
|
|
2817
2825
|
|
|
2818
2826
|
const copyRelativePath$1 = async (state, path) => {
|
|
2819
2827
|
string(path);
|
|
2820
|
-
const relativePath = await invoke('Workspace.pathBaseName', path);
|
|
2828
|
+
const relativePath = await invoke$1('Workspace.pathBaseName', path);
|
|
2821
2829
|
await writeText(relativePath);
|
|
2822
2830
|
return state;
|
|
2823
2831
|
};
|
|
@@ -2869,7 +2877,7 @@ const create$1 = (uid, uri, x, y, width, height, platform, assetDir, tabHeight =
|
|
|
2869
2877
|
x,
|
|
2870
2878
|
y
|
|
2871
2879
|
};
|
|
2872
|
-
set(uid, state, state);
|
|
2880
|
+
set$1(uid, state, state);
|
|
2873
2881
|
};
|
|
2874
2882
|
|
|
2875
2883
|
const isEqual$3 = (oldState, newState) => {
|
|
@@ -2943,7 +2951,7 @@ const focus = async state => {
|
|
|
2943
2951
|
if (typeof editorUid !== 'number' || editorUid < 0) {
|
|
2944
2952
|
return state;
|
|
2945
2953
|
}
|
|
2946
|
-
await invoke('Viewlet.focusSelector', editorUid, '[name="editor"]');
|
|
2954
|
+
await invoke$1('Viewlet.focusSelector', editorUid, '[name="editor"]');
|
|
2947
2955
|
return state;
|
|
2948
2956
|
};
|
|
2949
2957
|
|
|
@@ -3249,7 +3257,7 @@ const getViewletModuleId$1 = async (uri, opener) => {
|
|
|
3249
3257
|
// Query RendererWorker for viewlet module ID (optional, may fail in tests)
|
|
3250
3258
|
let viewletModuleId;
|
|
3251
3259
|
try {
|
|
3252
|
-
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);
|
|
3253
3261
|
} catch {
|
|
3254
3262
|
// Viewlet creation is optional - silently ignore if RendererWorker isn't available
|
|
3255
3263
|
}
|
|
@@ -3287,7 +3295,7 @@ const getViewletModuleIdForEditorInput = async editorInput => {
|
|
|
3287
3295
|
|
|
3288
3296
|
const getViewletModuleId = async tab => {
|
|
3289
3297
|
const normalizedTab = normalizeTabEditorInput(tab);
|
|
3290
|
-
return normalizedTab.editorInput ? getViewletModuleIdForEditorInput(normalizedTab.editorInput) : invoke('Layout.getModuleId', normalizedTab.uri);
|
|
3298
|
+
return normalizedTab.editorInput ? getViewletModuleIdForEditorInput(normalizedTab.editorInput) : invoke$1('Layout.getModuleId', normalizedTab.uri);
|
|
3291
3299
|
};
|
|
3292
3300
|
|
|
3293
3301
|
const startContentLoading = async (oldState, state, tabId, path, requestId) => {
|
|
@@ -3298,7 +3306,7 @@ const startContentLoading = async (oldState, state, tabId, path, requestId) => {
|
|
|
3298
3306
|
const getLatestState = () => {
|
|
3299
3307
|
return get(uid).newState;
|
|
3300
3308
|
};
|
|
3301
|
-
set(uid, oldState, state);
|
|
3309
|
+
set$1(uid, oldState, state);
|
|
3302
3310
|
const newState = await loadTabContentAsync(tabId, path, requestId, getLatestState);
|
|
3303
3311
|
return newState;
|
|
3304
3312
|
} catch {
|
|
@@ -3329,7 +3337,7 @@ const maybeCreateViewletForSelectedTab = async (state, newState, groupIndex, ind
|
|
|
3329
3337
|
}
|
|
3330
3338
|
const bounds = getSelectedTabBounds(newState);
|
|
3331
3339
|
let stateWithViewlet = createViewletForTab(newState, tabId);
|
|
3332
|
-
set(uid, state, stateWithViewlet);
|
|
3340
|
+
set$1(uid, state, stateWithViewlet);
|
|
3333
3341
|
if (switchCommands.length > 0) {
|
|
3334
3342
|
await executeViewletCommands(switchCommands);
|
|
3335
3343
|
}
|
|
@@ -3341,7 +3349,7 @@ const maybeCreateViewletForSelectedTab = async (state, newState, groupIndex, ind
|
|
|
3341
3349
|
if (editorUid !== -1 && selectedTab.uri) {
|
|
3342
3350
|
const title = await createViewlet(viewletModuleId, editorUid, tabId, bounds, selectedTab.uri);
|
|
3343
3351
|
stateWithViewlet = handleViewletReady(stateWithViewlet, editorUid, title);
|
|
3344
|
-
set(uid, state, stateWithViewlet);
|
|
3352
|
+
set$1(uid, state, stateWithViewlet);
|
|
3345
3353
|
}
|
|
3346
3354
|
}
|
|
3347
3355
|
return maybeStartLoading(state, stateWithViewlet, tabId, tab, needsLoading, requestId);
|
|
@@ -3395,7 +3403,7 @@ const selectTab = async (state, groupIndex, index) => {
|
|
|
3395
3403
|
if (maybeCreatedState) {
|
|
3396
3404
|
return maybeCreatedState;
|
|
3397
3405
|
}
|
|
3398
|
-
set(uid, state, newState);
|
|
3406
|
+
set$1(uid, state, newState);
|
|
3399
3407
|
if (switchCommands.length > 0) {
|
|
3400
3408
|
await executeViewletCommands(switchCommands);
|
|
3401
3409
|
}
|
|
@@ -3489,7 +3497,7 @@ const handleClickTogglePreview = async state => {
|
|
|
3489
3497
|
if (!activeTabInfo || !activeTabInfo.tab.uri) {
|
|
3490
3498
|
return state;
|
|
3491
3499
|
}
|
|
3492
|
-
await invoke('Layout.showPreview', activeTabInfo.tab.uri);
|
|
3500
|
+
await invoke$1('Layout.showPreview', activeTabInfo.tab.uri);
|
|
3493
3501
|
return state;
|
|
3494
3502
|
};
|
|
3495
3503
|
|
|
@@ -3568,14 +3576,14 @@ const getCurrentState = state => {
|
|
|
3568
3576
|
} = state;
|
|
3569
3577
|
const stateFromStore = get(uid);
|
|
3570
3578
|
if (!stateFromStore) {
|
|
3571
|
-
set(uid, state, state);
|
|
3579
|
+
set$1(uid, state, state);
|
|
3572
3580
|
return state;
|
|
3573
3581
|
}
|
|
3574
3582
|
const storedState = stateFromStore.newState;
|
|
3575
3583
|
if (getTabCount(storedState) > getTabCount(state)) {
|
|
3576
3584
|
return storedState;
|
|
3577
3585
|
}
|
|
3578
|
-
set(uid, state, state);
|
|
3586
|
+
set$1(uid, state, state);
|
|
3579
3587
|
return state;
|
|
3580
3588
|
};
|
|
3581
3589
|
|
|
@@ -3910,7 +3918,7 @@ const isDirectoryEditorInput = async editorInput => {
|
|
|
3910
3918
|
return false;
|
|
3911
3919
|
}
|
|
3912
3920
|
try {
|
|
3913
|
-
const type = await invoke('FileSystem.stat', editorInput.uri);
|
|
3921
|
+
const type = await invoke$1('FileSystem.stat', editorInput.uri);
|
|
3914
3922
|
return type === Directory;
|
|
3915
3923
|
} catch {
|
|
3916
3924
|
return false;
|
|
@@ -4067,7 +4075,7 @@ const updateTabIcon = async (context, readyState, tabId) => {
|
|
|
4067
4075
|
|
|
4068
4076
|
const renderMainAreaPending = async uid => {
|
|
4069
4077
|
try {
|
|
4070
|
-
await invoke('Layout.renderMainAreaPending', uid);
|
|
4078
|
+
await invoke$1('Layout.renderMainAreaPending', uid);
|
|
4071
4079
|
} catch {
|
|
4072
4080
|
// Older renderer workers render the final state when openInput completes.
|
|
4073
4081
|
}
|
|
@@ -4213,7 +4221,7 @@ const openInput = async (state, options) => {
|
|
|
4213
4221
|
const storedState = get(uid);
|
|
4214
4222
|
const latestState = storedState?.newState ?? currentState;
|
|
4215
4223
|
currentState = updater(latestState);
|
|
4216
|
-
set(uid, storedState?.oldState ?? state, currentState);
|
|
4224
|
+
set$1(uid, storedState?.oldState ?? state, currentState);
|
|
4217
4225
|
return Promise.resolve(currentState);
|
|
4218
4226
|
}
|
|
4219
4227
|
};
|
|
@@ -4431,7 +4439,7 @@ const restoreClosedTab = async state => {
|
|
|
4431
4439
|
return state;
|
|
4432
4440
|
}
|
|
4433
4441
|
const newState = await selectTab(restored.newState, restored.groupIndex, restored.tabIndex);
|
|
4434
|
-
set(state.uid, state, newState);
|
|
4442
|
+
set$1(state.uid, state, newState);
|
|
4435
4443
|
return newState;
|
|
4436
4444
|
};
|
|
4437
4445
|
|
|
@@ -5144,10 +5152,10 @@ const applyDropAction = async (context, action, splitDirection) => {
|
|
|
5144
5152
|
break;
|
|
5145
5153
|
}
|
|
5146
5154
|
case 'setPath':
|
|
5147
|
-
void invoke('Workspace.setPath', action.value).catch(() => {});
|
|
5155
|
+
void invoke$1('Workspace.setPath', action.value).catch(() => {});
|
|
5148
5156
|
break;
|
|
5149
5157
|
case 'setUri':
|
|
5150
|
-
void invoke('Workspace.setUri', action.value).catch(() => {});
|
|
5158
|
+
void invoke$1('Workspace.setUri', action.value).catch(() => {});
|
|
5151
5159
|
break;
|
|
5152
5160
|
}
|
|
5153
5161
|
};
|
|
@@ -5314,7 +5322,7 @@ const newFile = async state => {
|
|
|
5314
5322
|
newState: switchedState
|
|
5315
5323
|
} = switchViewlet(intermediateState);
|
|
5316
5324
|
intermediateState = switchedState;
|
|
5317
|
-
set(uid, state, intermediateState);
|
|
5325
|
+
set$1(uid, state, intermediateState);
|
|
5318
5326
|
|
|
5319
5327
|
// Get the tab to extract editorUid
|
|
5320
5328
|
const tabWithViewlet = findTabById(intermediateState, tabId);
|
|
@@ -5409,6 +5417,31 @@ const handleIconThemeChange = async state => {
|
|
|
5409
5417
|
};
|
|
5410
5418
|
};
|
|
5411
5419
|
|
|
5420
|
+
const state = {
|
|
5421
|
+
connected: false
|
|
5422
|
+
};
|
|
5423
|
+
const isConnected = () => {
|
|
5424
|
+
const {
|
|
5425
|
+
connected
|
|
5426
|
+
} = state;
|
|
5427
|
+
return connected;
|
|
5428
|
+
};
|
|
5429
|
+
const invoke = (method, ...params) => {
|
|
5430
|
+
return invoke$2(method, ...params);
|
|
5431
|
+
};
|
|
5432
|
+
const set = rpc => {
|
|
5433
|
+
set$3(rpc);
|
|
5434
|
+
state.connected = true;
|
|
5435
|
+
};
|
|
5436
|
+
|
|
5437
|
+
const handleMessagePort = async port => {
|
|
5438
|
+
const rpc = await create$8({
|
|
5439
|
+
commandMap: {},
|
|
5440
|
+
messagePort: port
|
|
5441
|
+
});
|
|
5442
|
+
set(rpc);
|
|
5443
|
+
};
|
|
5444
|
+
|
|
5412
5445
|
const handleModifiedStatusChange = (state, uri, newStatus) => {
|
|
5413
5446
|
const {
|
|
5414
5447
|
layout
|
|
@@ -5445,7 +5478,7 @@ const handleModifiedStatusChangeWithContext = async (context, uri, newStatus) =>
|
|
|
5445
5478
|
|
|
5446
5479
|
const resizeChild = async (editorUid, dimensions) => {
|
|
5447
5480
|
try {
|
|
5448
|
-
return await invoke('Viewlet.resize', editorUid, dimensions);
|
|
5481
|
+
return await invoke$1('Viewlet.resize', editorUid, dimensions);
|
|
5449
5482
|
} catch {
|
|
5450
5483
|
return [];
|
|
5451
5484
|
}
|
|
@@ -5780,14 +5813,23 @@ const handleSashPointerUp = async state => {
|
|
|
5780
5813
|
};
|
|
5781
5814
|
};
|
|
5782
5815
|
|
|
5783
|
-
const handleTabContextMenu = async (state, button, x, y) => {
|
|
5816
|
+
const handleTabContextMenu = async (state, button, x, y, groupIndexRaw = '', tabIndexRaw = '') => {
|
|
5784
5817
|
number(x);
|
|
5785
5818
|
number(y);
|
|
5786
5819
|
const {
|
|
5787
5820
|
uid
|
|
5788
5821
|
} = state;
|
|
5822
|
+
const groupIndex = Number.parseInt(groupIndexRaw);
|
|
5823
|
+
const tabIndex = Number.parseInt(tabIndexRaw);
|
|
5824
|
+
const group = state.layout.groups[groupIndex];
|
|
5825
|
+
const tab = group?.tabs[tabIndex];
|
|
5826
|
+
const target = group && tab ? {
|
|
5827
|
+
groupId: group.id,
|
|
5828
|
+
tabId: tab.id
|
|
5829
|
+
} : {};
|
|
5789
5830
|
await show2(uid, Tab, x, y, {
|
|
5790
|
-
menuId: Tab
|
|
5831
|
+
menuId: Tab,
|
|
5832
|
+
...target
|
|
5791
5833
|
});
|
|
5792
5834
|
return state;
|
|
5793
5835
|
};
|
|
@@ -5814,7 +5856,7 @@ const handleUriChange = async (state, oldUri, newUri) => {
|
|
|
5814
5856
|
}
|
|
5815
5857
|
if (renamedUri) {
|
|
5816
5858
|
if (tab.editorType === 'text' && tab.editorUid !== -1) {
|
|
5817
|
-
editorUriUpdates.push(invoke('Editor.handleUriChange', tab.editorUid, renamedUri));
|
|
5859
|
+
editorUriUpdates.push(invoke$1('Editor.handleUriChange', tab.editorUid, renamedUri));
|
|
5818
5860
|
}
|
|
5819
5861
|
const editorInput = tab.editorInput && 'uri' in tab.editorInput ? {
|
|
5820
5862
|
...tab.editorInput,
|
|
@@ -5864,7 +5906,7 @@ const toFileUri = path => {
|
|
|
5864
5906
|
};
|
|
5865
5907
|
const loadHomeDirUri = async () => {
|
|
5866
5908
|
try {
|
|
5867
|
-
const homeDir = await invoke('Workspace.getHomeDir');
|
|
5909
|
+
const homeDir = await invoke$1('Workspace.getHomeDir');
|
|
5868
5910
|
return typeof homeDir === 'string' ? toFileUri(homeDir) : '';
|
|
5869
5911
|
} catch {
|
|
5870
5912
|
return '';
|
|
@@ -6168,7 +6210,7 @@ const reloadChangedEditors = async (state, changed) => {
|
|
|
6168
6210
|
}
|
|
6169
6211
|
}
|
|
6170
6212
|
}
|
|
6171
|
-
await Promise.allSettled(Array.from(editorUids, editorUid => invoke('Viewlet.reload', editorUid)));
|
|
6213
|
+
await Promise.allSettled(Array.from(editorUids, editorUid => invoke$1('Viewlet.reload', editorUid)));
|
|
6172
6214
|
};
|
|
6173
6215
|
const handleWorkspaceRefresh = async (state, refresh = {}) => {
|
|
6174
6216
|
const changes = Array.isArray(refresh) ? {
|
|
@@ -6430,15 +6472,14 @@ const getMenuEntries$2 = (state, groupId) => {
|
|
|
6430
6472
|
}];
|
|
6431
6473
|
};
|
|
6432
6474
|
|
|
6433
|
-
|
|
6434
|
-
const getMenuEntries$1 = state => {
|
|
6475
|
+
const getMenuEntries$1 = (state, groupId, tabId) => {
|
|
6435
6476
|
const {
|
|
6436
6477
|
layout
|
|
6437
6478
|
} = state;
|
|
6438
6479
|
const {
|
|
6439
6480
|
activeGroupId
|
|
6440
6481
|
} = layout;
|
|
6441
|
-
const group = findGroupById(state,
|
|
6482
|
+
const group = findGroupById(state, groupId ?? activeGroupId);
|
|
6442
6483
|
if (!group) {
|
|
6443
6484
|
return [];
|
|
6444
6485
|
}
|
|
@@ -6446,7 +6487,7 @@ const getMenuEntries$1 = state => {
|
|
|
6446
6487
|
activeTabId,
|
|
6447
6488
|
tabs
|
|
6448
6489
|
} = group;
|
|
6449
|
-
const tab = tabs.find(t => t.id === activeTabId);
|
|
6490
|
+
const tab = tabs.find(t => t.id === (tabId ?? activeTabId));
|
|
6450
6491
|
if (!tab) {
|
|
6451
6492
|
return [];
|
|
6452
6493
|
}
|
|
@@ -6464,6 +6505,7 @@ const getMenuEntries$1 = state => {
|
|
|
6464
6505
|
id: 'tabCloseOthers',
|
|
6465
6506
|
label: closeOthers()
|
|
6466
6507
|
}, {
|
|
6508
|
+
args: [group.id, tab.id],
|
|
6467
6509
|
command: 'Main.closeTabsRight',
|
|
6468
6510
|
flags: None$1,
|
|
6469
6511
|
id: 'tabCloseToTheRight',
|
|
@@ -6560,7 +6602,7 @@ const getMenuEntries = async (state, props) => {
|
|
|
6560
6602
|
case Main$1:
|
|
6561
6603
|
return getMenuEntries$2(state, props.groupId);
|
|
6562
6604
|
case Tab:
|
|
6563
|
-
return getMenuEntries$1(state);
|
|
6605
|
+
return getMenuEntries$1(state, props.groupId, props.tabId);
|
|
6564
6606
|
default:
|
|
6565
6607
|
return [];
|
|
6566
6608
|
}
|
|
@@ -6587,12 +6629,12 @@ const moveIntoNewWindow = async state => {
|
|
|
6587
6629
|
if (!tab?.uri) {
|
|
6588
6630
|
return state;
|
|
6589
6631
|
}
|
|
6590
|
-
await invoke('ElectronWindow.openNewWithUri', tab.uri);
|
|
6632
|
+
await invoke$1('ElectronWindow.openNewWithUri', tab.uri);
|
|
6591
6633
|
return closeTabAndSave(state, group.id, activeTabId);
|
|
6592
6634
|
};
|
|
6593
6635
|
|
|
6594
6636
|
const newWindow = async state => {
|
|
6595
|
-
await invoke('ElectronWindow.openNew');
|
|
6637
|
+
await invoke$1('ElectronWindow.openNew');
|
|
6596
6638
|
return state;
|
|
6597
6639
|
};
|
|
6598
6640
|
|
|
@@ -7668,7 +7710,7 @@ const renderPendingViewletUpdate = (oldState, newState) => {
|
|
|
7668
7710
|
const update = newState.pendingViewletUpdate;
|
|
7669
7711
|
newState.pendingViewletUpdate = undefined;
|
|
7670
7712
|
setTimeout(() => {
|
|
7671
|
-
void invoke('Viewlet.dispose', update.disposal).catch(() => {});
|
|
7713
|
+
void invoke$1('Viewlet.dispose', update.disposal).catch(() => {});
|
|
7672
7714
|
}, 50);
|
|
7673
7715
|
return update.focus === undefined ? [] : ['Viewlet.setFocusContext', update.focus, FocusEditorText, 0, update.focus, 'Editor'];
|
|
7674
7716
|
};
|
|
@@ -7707,9 +7749,16 @@ const render2 = (uid, diffResult) => {
|
|
|
7707
7749
|
newState,
|
|
7708
7750
|
oldState
|
|
7709
7751
|
} = get(uid);
|
|
7710
|
-
set(uid, newState, newState);
|
|
7752
|
+
set$1(uid, newState, newState);
|
|
7711
7753
|
const commands = applyRender(oldState, newState, diffResult);
|
|
7712
|
-
|
|
7754
|
+
if (!isConnected()) {
|
|
7755
|
+
return commands;
|
|
7756
|
+
}
|
|
7757
|
+
return renderDirect(uid, commands);
|
|
7758
|
+
};
|
|
7759
|
+
const renderDirect = async (uid, commands) => {
|
|
7760
|
+
const transactionId = await invoke('Viewlet.queueCommands', uid, commands);
|
|
7761
|
+
return [['Viewlet.commitPending', uid, transactionId]];
|
|
7713
7762
|
};
|
|
7714
7763
|
|
|
7715
7764
|
const renderEventListeners = () => {
|
|
@@ -7731,7 +7780,7 @@ const renderEventListeners = () => {
|
|
|
7731
7780
|
preventDefault: true
|
|
7732
7781
|
}, {
|
|
7733
7782
|
name: HandleTabContextMenu,
|
|
7734
|
-
params: ['handleTabContextMenu', Button$1, ClientX, ClientY],
|
|
7783
|
+
params: ['handleTabContextMenu', Button$1, ClientX, ClientY, 'event.target.dataset.groupIndex', 'event.target.dataset.index'],
|
|
7735
7784
|
preventDefault: true
|
|
7736
7785
|
}, {
|
|
7737
7786
|
name: HandleClickAction,
|
|
@@ -7792,7 +7841,7 @@ const textEditorEntry = {
|
|
|
7792
7841
|
};
|
|
7793
7842
|
const getViewProviderEntries = async uri => {
|
|
7794
7843
|
try {
|
|
7795
|
-
const providers = await invoke('WebView.getEditorProviders');
|
|
7844
|
+
const providers = await invoke$1('WebView.getEditorProviders');
|
|
7796
7845
|
const matchingProviders = providers.filter(provider => provider?.id && provider.selector?.some(selector => uri.endsWith(selector)));
|
|
7797
7846
|
return [textEditorEntry, ...matchingProviders.map(provider => {
|
|
7798
7847
|
const titleElement = provider.elements?.find(element => element.type === 'title');
|
|
@@ -7827,7 +7876,7 @@ const reopenEditorWith = async (context, preferredEditorId) => {
|
|
|
7827
7876
|
label: entry.label,
|
|
7828
7877
|
value: entry
|
|
7829
7878
|
}));
|
|
7830
|
-
selected = await invoke('ExtensionHostQuickPick.showQuickPick', {
|
|
7879
|
+
selected = await invoke$1('ExtensionHostQuickPick.showQuickPick', {
|
|
7831
7880
|
items,
|
|
7832
7881
|
placeholder: 'Select Editor'
|
|
7833
7882
|
});
|
|
@@ -7878,7 +7927,7 @@ const reopenEditorWith = async (context, preferredEditorId) => {
|
|
|
7878
7927
|
await context.updateState(() => readyState);
|
|
7879
7928
|
if (oldEditorUid !== -1) {
|
|
7880
7929
|
try {
|
|
7881
|
-
await invoke('Viewlet.dispose', oldEditorUid);
|
|
7930
|
+
await invoke$1('Viewlet.dispose', oldEditorUid);
|
|
7882
7931
|
} catch {
|
|
7883
7932
|
// Reopening should still proceed if the previous viewlet was already disposed.
|
|
7884
7933
|
}
|
|
@@ -7907,7 +7956,7 @@ const settingsUri = 'app://settings.json';
|
|
|
7907
7956
|
const saveEditorAndHandleSettingsChange = async tab => {
|
|
7908
7957
|
const editorState = await saveEditor(tab.editorUid);
|
|
7909
7958
|
if (!editorState?.modified && tab.uri === settingsUri) {
|
|
7910
|
-
await invoke('Layout.handleSettingsChanged');
|
|
7959
|
+
await invoke$1('Layout.handleSettingsChanged');
|
|
7911
7960
|
}
|
|
7912
7961
|
return editorState;
|
|
7913
7962
|
};
|
|
@@ -8247,7 +8296,7 @@ const resize = async (uid, dimensions) => {
|
|
|
8247
8296
|
return [];
|
|
8248
8297
|
}
|
|
8249
8298
|
const resizedState = resize$1(instance.newState, dimensions);
|
|
8250
|
-
set(uid, instance.oldState, resizedState);
|
|
8299
|
+
set$1(uid, instance.oldState, resizedState);
|
|
8251
8300
|
return handleResize(resizedState, dimensions);
|
|
8252
8301
|
};
|
|
8253
8302
|
const commandMap = {
|
|
@@ -8313,6 +8362,7 @@ const commandMap = {
|
|
|
8313
8362
|
'MainArea.handleDrop': wrapSerialAsyncCommand(handleDrop),
|
|
8314
8363
|
'MainArea.handleHeaderDoubleClick': wrapSerialCommand(handleHeaderDoubleClick),
|
|
8315
8364
|
'MainArea.handleIconThemeChange': wrapSerialCommand(handleIconThemeChange),
|
|
8365
|
+
'MainArea.handleMessagePort': handleMessagePort,
|
|
8316
8366
|
'MainArea.handleModifiedStatusChange': wrapAsyncCommand(handleModifiedStatusChangeWithContext),
|
|
8317
8367
|
'MainArea.handleResize': resize,
|
|
8318
8368
|
'MainArea.handleSashCornerPointerDown': wrapSerialCommand(handleSashCornerPointerDown),
|
|
@@ -8369,7 +8419,7 @@ const initializeClipBoardWorker = async () => {
|
|
|
8369
8419
|
commandMap: {},
|
|
8370
8420
|
send: sendMessagePortToClipBoardWorker
|
|
8371
8421
|
});
|
|
8372
|
-
set$
|
|
8422
|
+
set$7(rpc);
|
|
8373
8423
|
};
|
|
8374
8424
|
|
|
8375
8425
|
const send$1 = async port => {
|
|
@@ -8383,7 +8433,7 @@ const createDragAndDropWorkerRpc = async () => {
|
|
|
8383
8433
|
};
|
|
8384
8434
|
|
|
8385
8435
|
const initializeDragAndDropWorker = async () => {
|
|
8386
|
-
set$
|
|
8436
|
+
set$5(await createDragAndDropWorkerRpc());
|
|
8387
8437
|
};
|
|
8388
8438
|
|
|
8389
8439
|
const send = port => {
|
|
@@ -8409,13 +8459,13 @@ const refreshFileIcons = async () => {
|
|
|
8409
8459
|
oldState
|
|
8410
8460
|
} = get(uid);
|
|
8411
8461
|
const updatedState = await handleIconThemeChange(newState);
|
|
8412
|
-
set(uid, oldState, updatedState);
|
|
8462
|
+
set$1(uid, oldState, updatedState);
|
|
8413
8463
|
}
|
|
8414
8464
|
};
|
|
8415
8465
|
|
|
8416
8466
|
const initializeIconThemeWorker = async () => {
|
|
8417
8467
|
const rpc = await createIconThemeWorkerRpc();
|
|
8418
|
-
set$
|
|
8468
|
+
set$4(rpc);
|
|
8419
8469
|
await refreshFileIcons();
|
|
8420
8470
|
};
|
|
8421
8471
|
|
|
@@ -8423,7 +8473,7 @@ const initializeRendererWorker = async () => {
|
|
|
8423
8473
|
const rpc = await create$5({
|
|
8424
8474
|
commandMap: commandMap
|
|
8425
8475
|
});
|
|
8426
|
-
set$
|
|
8476
|
+
set$2(rpc);
|
|
8427
8477
|
};
|
|
8428
8478
|
|
|
8429
8479
|
const listen = async () => {
|
|
@@ -8433,7 +8483,7 @@ const listen = async () => {
|
|
|
8433
8483
|
commandMap: {},
|
|
8434
8484
|
send: sendMessagePortToDialogWorker
|
|
8435
8485
|
});
|
|
8436
|
-
set$
|
|
8486
|
+
set$6(dialogRpc);
|
|
8437
8487
|
};
|
|
8438
8488
|
|
|
8439
8489
|
const main$1 = async () => {
|
|
@@ -8445,7 +8495,7 @@ const main = async () => {
|
|
|
8445
8495
|
const rpc = await create$5({
|
|
8446
8496
|
commandMap: commandMap
|
|
8447
8497
|
});
|
|
8448
|
-
set$
|
|
8498
|
+
set$2(rpc);
|
|
8449
8499
|
};
|
|
8450
8500
|
|
|
8451
8501
|
await main$1();
|