@lvce-editor/main-area-worker 9.52.0 → 9.53.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.
- package/dist/mainAreaWorkerMain.js +116 -23
- package/package.json +1 -1
|
@@ -1748,12 +1748,13 @@ const getIcons = async iconRequests => {
|
|
|
1748
1748
|
|
|
1749
1749
|
const {
|
|
1750
1750
|
invoke: invoke$2,
|
|
1751
|
+
invokeAndTransfer: invokeAndTransfer$2,
|
|
1751
1752
|
set: set$3
|
|
1752
1753
|
} = create$3(RendererProcess);
|
|
1753
1754
|
|
|
1754
1755
|
const {
|
|
1755
1756
|
invoke: invoke$1,
|
|
1756
|
-
invokeAndTransfer,
|
|
1757
|
+
invokeAndTransfer: invokeAndTransfer$1,
|
|
1757
1758
|
set: set$2
|
|
1758
1759
|
} = create$3(RendererWorker);
|
|
1759
1760
|
const handleModifiedStatusChange$1 = async (uri, modified) => {
|
|
@@ -1768,19 +1769,15 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
|
1768
1769
|
};
|
|
1769
1770
|
const sendMessagePortToClipBoardWorker$1 = async (port, rpcId) => {
|
|
1770
1771
|
const command = 'ClipBoard.handleMessagePort';
|
|
1771
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToClipBoardWorker', port, command, rpcId);
|
|
1772
|
-
};
|
|
1773
|
-
const sendMessagePortToDragAndDropWorker = async port => {
|
|
1774
|
-
const command = 'DragAndDrop.handleMessagePort';
|
|
1775
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToDragAndDropWorker', port, command);
|
|
1772
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToClipBoardWorker', port, command, rpcId);
|
|
1776
1773
|
};
|
|
1777
1774
|
const sendMessagePortToDialogWorker = async port => {
|
|
1778
1775
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
1779
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker', port, command);
|
|
1776
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker', port, command);
|
|
1780
1777
|
};
|
|
1781
1778
|
const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
1782
1779
|
const command = 'IconTheme.handleMessagePort';
|
|
1783
|
-
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1780
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1784
1781
|
};
|
|
1785
1782
|
const readFile = async uri => {
|
|
1786
1783
|
return invoke$1('FileSystem.readFile', uri);
|
|
@@ -2925,6 +2922,9 @@ const isConnected = () => {
|
|
|
2925
2922
|
const invoke = (method, ...params) => {
|
|
2926
2923
|
return invoke$2(method, ...params);
|
|
2927
2924
|
};
|
|
2925
|
+
const invokeAndTransfer = (method, ...params) => {
|
|
2926
|
+
return invokeAndTransfer$2(method, ...params);
|
|
2927
|
+
};
|
|
2928
2928
|
const set = rpc => {
|
|
2929
2929
|
set$3(rpc);
|
|
2930
2930
|
state.connected = true;
|
|
@@ -5065,6 +5065,17 @@ const handleDragStart = state => {
|
|
|
5065
5065
|
return state;
|
|
5066
5066
|
};
|
|
5067
5067
|
|
|
5068
|
+
const resetPointerDown = state => {
|
|
5069
|
+
if (state.pointerDownGroupIndex === -1 && state.pointerDownTabIndex === -1) {
|
|
5070
|
+
return state;
|
|
5071
|
+
}
|
|
5072
|
+
return {
|
|
5073
|
+
...state,
|
|
5074
|
+
pointerDownGroupIndex: -1,
|
|
5075
|
+
pointerDownTabIndex: -1
|
|
5076
|
+
};
|
|
5077
|
+
};
|
|
5078
|
+
|
|
5068
5079
|
const openUrisWithContext = async (context, uris, reuseExisting = true) => {
|
|
5069
5080
|
for (const uri of uris) {
|
|
5070
5081
|
await openUriWithContext(context, {
|
|
@@ -5257,6 +5268,81 @@ const applyDropAction = async (context, action, splitDirection, targetGroupId) =
|
|
|
5257
5268
|
}
|
|
5258
5269
|
};
|
|
5259
5270
|
|
|
5271
|
+
const moveTabToGroup = (state, sourceGroupId, targetGroupId, tabId, targetIndex) => {
|
|
5272
|
+
const {
|
|
5273
|
+
layout
|
|
5274
|
+
} = state;
|
|
5275
|
+
const {
|
|
5276
|
+
groups
|
|
5277
|
+
} = layout;
|
|
5278
|
+
const sourceGroup = groups.find(group => group.id === sourceGroupId);
|
|
5279
|
+
const hasTargetGroup = groups.some(group => group.id === targetGroupId);
|
|
5280
|
+
if (!sourceGroup || !hasTargetGroup || sourceGroupId === targetGroupId) {
|
|
5281
|
+
return state;
|
|
5282
|
+
}
|
|
5283
|
+
const tabToMove = sourceGroup.tabs.find(tab => tab.id === tabId);
|
|
5284
|
+
if (!tabToMove) {
|
|
5285
|
+
return state;
|
|
5286
|
+
}
|
|
5287
|
+
const updatedGroups = groups.map(group => {
|
|
5288
|
+
if (group.id === sourceGroupId) {
|
|
5289
|
+
const newTabs = group.tabs.filter(tab => tab.id !== tabId);
|
|
5290
|
+
let newActiveTabId = group.activeTabId;
|
|
5291
|
+
if (group.activeTabId === tabId) {
|
|
5292
|
+
if (newTabs.length > 0) {
|
|
5293
|
+
const removedIndex = group.tabs.findIndex(tab => tab.id === tabId);
|
|
5294
|
+
newActiveTabId = newTabs[Math.min(removedIndex, newTabs.length - 1)].id;
|
|
5295
|
+
} else {
|
|
5296
|
+
newActiveTabId = -1;
|
|
5297
|
+
}
|
|
5298
|
+
}
|
|
5299
|
+
return {
|
|
5300
|
+
...group,
|
|
5301
|
+
activeTabId: newActiveTabId,
|
|
5302
|
+
isEmpty: newTabs.length === 0,
|
|
5303
|
+
tabs: newTabs
|
|
5304
|
+
};
|
|
5305
|
+
}
|
|
5306
|
+
if (group.id === targetGroupId) {
|
|
5307
|
+
const insertIndex = group.tabs.length ;
|
|
5308
|
+
const newTabs = [...group.tabs];
|
|
5309
|
+
newTabs.splice(insertIndex, 0, tabToMove);
|
|
5310
|
+
return {
|
|
5311
|
+
...group,
|
|
5312
|
+
activeTabId: tabId,
|
|
5313
|
+
isEmpty: newTabs.length === 0,
|
|
5314
|
+
tabs: newTabs
|
|
5315
|
+
};
|
|
5316
|
+
}
|
|
5317
|
+
return group;
|
|
5318
|
+
});
|
|
5319
|
+
return {
|
|
5320
|
+
...state,
|
|
5321
|
+
layout: {
|
|
5322
|
+
...layout,
|
|
5323
|
+
activeGroupId: targetGroupId,
|
|
5324
|
+
groups: updatedGroups
|
|
5325
|
+
}
|
|
5326
|
+
};
|
|
5327
|
+
};
|
|
5328
|
+
|
|
5329
|
+
const getOpenTabCount = state => {
|
|
5330
|
+
return state.layout.groups.reduce((count, group) => count + group.tabs.length, 0);
|
|
5331
|
+
};
|
|
5332
|
+
const applyTabDrop = (state, sourceGroupId, tabId, splitDirection, targetGroupId) => {
|
|
5333
|
+
if (targetGroupId === undefined) {
|
|
5334
|
+
return state;
|
|
5335
|
+
}
|
|
5336
|
+
if (splitDirection === None) {
|
|
5337
|
+
return moveTabToGroup(state, sourceGroupId, targetGroupId, tabId);
|
|
5338
|
+
}
|
|
5339
|
+
if (getOpenTabCount(state) === 1) {
|
|
5340
|
+
return state;
|
|
5341
|
+
}
|
|
5342
|
+
const splitState = splitForDrop(state, splitDirection, targetGroupId);
|
|
5343
|
+
return moveTabToGroup(splitState, sourceGroupId, splitState.layout.activeGroupId, tabId);
|
|
5344
|
+
};
|
|
5345
|
+
|
|
5260
5346
|
const getDropAction = async uris => {
|
|
5261
5347
|
for (const uri of uris) {
|
|
5262
5348
|
if (uri.endsWith('/') || (await isDirectoryEditorInput({
|
|
@@ -5281,11 +5367,21 @@ const getDropAction = async uris => {
|
|
|
5281
5367
|
};
|
|
5282
5368
|
};
|
|
5283
5369
|
|
|
5370
|
+
const normalizeUri = uri => {
|
|
5371
|
+
return uri.startsWith('/') ? `file://${uri}` : uri;
|
|
5372
|
+
};
|
|
5284
5373
|
const handleDrop = async (context, dropIdOrItemIds) => {
|
|
5374
|
+
const initialState = context.getState();
|
|
5375
|
+
const {
|
|
5376
|
+
pointerDownGroupIndex,
|
|
5377
|
+
pointerDownTabIndex
|
|
5378
|
+
} = initialState;
|
|
5379
|
+
const sourceGroup = initialState.layout.groups[pointerDownGroupIndex];
|
|
5380
|
+
const draggedTab = sourceGroup?.tabs[pointerDownTabIndex];
|
|
5285
5381
|
const {
|
|
5286
5382
|
splitDirection = None,
|
|
5287
5383
|
targetGroupId
|
|
5288
|
-
} =
|
|
5384
|
+
} = initialState.dragOverlay ?? {};
|
|
5289
5385
|
await context.updateState(handleDragLeave);
|
|
5290
5386
|
const {
|
|
5291
5387
|
platform
|
|
@@ -5300,6 +5396,10 @@ const handleDrop = async (context, dropIdOrItemIds) => {
|
|
|
5300
5396
|
} = await getDroppedItems(dropIdOrItemIds, isElectron);
|
|
5301
5397
|
uris = droppedUris;
|
|
5302
5398
|
}
|
|
5399
|
+
if (draggedTab?.uri && uris.length === 1 && normalizeUri(uris[0]) === normalizeUri(draggedTab.uri)) {
|
|
5400
|
+
await context.updateState(state => resetPointerDown(applyTabDrop(state, sourceGroup.id, draggedTab.id, splitDirection, targetGroupId)));
|
|
5401
|
+
return;
|
|
5402
|
+
}
|
|
5303
5403
|
const actions = await getDropAction(uris);
|
|
5304
5404
|
await applyDropAction(context, actions, splitDirection, targetGroupId);
|
|
5305
5405
|
};
|
|
@@ -7556,6 +7656,9 @@ const renderTabIcon = tab => {
|
|
|
7556
7656
|
if (tab.uri?.startsWith(SearchEditorScheme)) {
|
|
7557
7657
|
return renderMaskIcon(MaskIconSearch);
|
|
7558
7658
|
}
|
|
7659
|
+
if (!tab.icon) {
|
|
7660
|
+
return [];
|
|
7661
|
+
}
|
|
7559
7662
|
return [{
|
|
7560
7663
|
childCount: 0,
|
|
7561
7664
|
className: TabIcon,
|
|
@@ -7566,6 +7669,7 @@ const renderTabIcon = tab => {
|
|
|
7566
7669
|
};
|
|
7567
7670
|
const renderTab = (tab, isActive, tabIndex, groupIndex) => {
|
|
7568
7671
|
const closeButtonNodes = renderTabActions(tab.isDirty, tabIndex, groupIndex);
|
|
7672
|
+
const tabIconNodes = renderTabIcon(tab);
|
|
7569
7673
|
let className = MainTab;
|
|
7570
7674
|
if (isActive) {
|
|
7571
7675
|
className = mergeClassNames(className, MainTabSelected);
|
|
@@ -7578,7 +7682,7 @@ const renderTab = (tab, isActive, tabIndex, groupIndex) => {
|
|
|
7578
7682
|
}
|
|
7579
7683
|
return [{
|
|
7580
7684
|
'aria-selected': isActive,
|
|
7581
|
-
childCount:
|
|
7685
|
+
childCount: 2 + (tabIconNodes.length > 0 ? 1 : 0),
|
|
7582
7686
|
className,
|
|
7583
7687
|
'data-groupIndex': groupIndex,
|
|
7584
7688
|
'data-index': tabIndex,
|
|
@@ -7594,7 +7698,7 @@ const renderTab = (tab, isActive, tabIndex, groupIndex) => {
|
|
|
7594
7698
|
tabIndex: isActive ? 0 : -1,
|
|
7595
7699
|
title: tab.uriTitle || tab.uri || tab.title,
|
|
7596
7700
|
type: Div
|
|
7597
|
-
}, ...
|
|
7701
|
+
}, ...tabIconNodes, tabTitleNode, text(tab.title), ...closeButtonNodes];
|
|
7598
7702
|
};
|
|
7599
7703
|
|
|
7600
7704
|
const getTabsVirtualDom = (group, groupIndex, tabsChildCount) => {
|
|
@@ -8186,17 +8290,6 @@ const reopenEditorWith = async (context, preferredEditorId) => {
|
|
|
8186
8290
|
}
|
|
8187
8291
|
};
|
|
8188
8292
|
|
|
8189
|
-
const resetPointerDown = state => {
|
|
8190
|
-
if (state.pointerDownGroupIndex === -1 && state.pointerDownTabIndex === -1) {
|
|
8191
|
-
return state;
|
|
8192
|
-
}
|
|
8193
|
-
return {
|
|
8194
|
-
...state,
|
|
8195
|
-
pointerDownGroupIndex: -1,
|
|
8196
|
-
pointerDownTabIndex: -1
|
|
8197
|
-
};
|
|
8198
|
-
};
|
|
8199
|
-
|
|
8200
8293
|
const resize$1 = (state, dimensions) => {
|
|
8201
8294
|
return {
|
|
8202
8295
|
...state,
|
|
@@ -8685,7 +8778,7 @@ const initializeClipBoardWorker = async () => {
|
|
|
8685
8778
|
};
|
|
8686
8779
|
|
|
8687
8780
|
const send$1 = async port => {
|
|
8688
|
-
await
|
|
8781
|
+
await invokeAndTransfer('DragAndDrop.handleMessagePort', port);
|
|
8689
8782
|
};
|
|
8690
8783
|
const createDragAndDropWorkerRpc = async () => {
|
|
8691
8784
|
return create$6({
|