@lvce-editor/explorer-view 7.27.1 → 7.28.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/explorerViewWorkerMain.js +80 -44
- package/package.json +1 -1
|
@@ -1355,10 +1355,10 @@ const Button$3 = 'event.button';
|
|
|
1355
1355
|
const ClientX = 'event.clientX';
|
|
1356
1356
|
const ClientY = 'event.clientY';
|
|
1357
1357
|
const CtrlKey = 'event.ctrlKey';
|
|
1358
|
-
const DataTransferFiles2 = 'event.dataTransfer.files2';
|
|
1359
1358
|
const DefaultPrevented = 'event.defaultPrevented';
|
|
1360
1359
|
const DeltaMode = 'event.deltaMode';
|
|
1361
1360
|
const DeltaY = 'event.deltaY';
|
|
1361
|
+
const DropId = 'event.dropId';
|
|
1362
1362
|
const EventTargetClassName = 'event.target.className';
|
|
1363
1363
|
const IsTrusted = 'event.isTrusted';
|
|
1364
1364
|
const Key = 'event.key';
|
|
@@ -1416,6 +1416,12 @@ const {
|
|
|
1416
1416
|
const getDroppedItems$1 = async (itemIds, isElectron) => {
|
|
1417
1417
|
return invoke$6('DragAndDrop.getDroppedItems', itemIds, isElectron);
|
|
1418
1418
|
};
|
|
1419
|
+
const getDroppedItemsByDropId = async (dropId, isElectron) => {
|
|
1420
|
+
return invoke$6('DragAndDrop.getDroppedItemsByDropId', dropId, isElectron);
|
|
1421
|
+
};
|
|
1422
|
+
const discardDrop = async dropId => {
|
|
1423
|
+
await invoke$6('DragAndDrop.discardDrop', dropId);
|
|
1424
|
+
};
|
|
1419
1425
|
|
|
1420
1426
|
const {
|
|
1421
1427
|
set: set$8
|
|
@@ -2296,6 +2302,30 @@ const refreshWorkspace = async () => {
|
|
|
2296
2302
|
}
|
|
2297
2303
|
};
|
|
2298
2304
|
|
|
2305
|
+
const state$1 = {
|
|
2306
|
+
connected: false
|
|
2307
|
+
};
|
|
2308
|
+
const postRenderFocusRequests = new Set();
|
|
2309
|
+
const isConnected = () => {
|
|
2310
|
+
const {
|
|
2311
|
+
connected
|
|
2312
|
+
} = state$1;
|
|
2313
|
+
return connected;
|
|
2314
|
+
};
|
|
2315
|
+
const invoke = (method, ...params) => {
|
|
2316
|
+
return invoke$4(method, ...params);
|
|
2317
|
+
};
|
|
2318
|
+
const requestPostRenderFocus = uid => {
|
|
2319
|
+
postRenderFocusRequests.add(uid);
|
|
2320
|
+
};
|
|
2321
|
+
const set$2 = rpc => {
|
|
2322
|
+
set$6(rpc);
|
|
2323
|
+
state$1.connected = true;
|
|
2324
|
+
};
|
|
2325
|
+
const takePostRenderFocus = uid => {
|
|
2326
|
+
return postRenderFocusRequests.delete(uid);
|
|
2327
|
+
};
|
|
2328
|
+
|
|
2299
2329
|
const treeToArrayInternal = (map, root, items, path, depth) => {
|
|
2300
2330
|
const children = map[path];
|
|
2301
2331
|
if (!children) {
|
|
@@ -2490,6 +2520,16 @@ const focusEditorAfterExplorerRender = () => {
|
|
|
2490
2520
|
void invoke$3('Main.focus');
|
|
2491
2521
|
}, 0);
|
|
2492
2522
|
};
|
|
2523
|
+
const openCreatedFile = async absolutePath => {
|
|
2524
|
+
await openUri(absolutePath, true);
|
|
2525
|
+
focusEditorAfterExplorerRender();
|
|
2526
|
+
};
|
|
2527
|
+
const finishCreate = async (absolutePath, newDirentType) => {
|
|
2528
|
+
await refreshWorkspace();
|
|
2529
|
+
if (newDirentType === File) {
|
|
2530
|
+
await openCreatedFile(absolutePath);
|
|
2531
|
+
}
|
|
2532
|
+
};
|
|
2493
2533
|
const acceptCreate = async (state, newDirentType) => {
|
|
2494
2534
|
const {
|
|
2495
2535
|
editingValue,
|
|
@@ -2497,7 +2537,8 @@ const acceptCreate = async (state, newDirentType) => {
|
|
|
2497
2537
|
focusedIndex,
|
|
2498
2538
|
items,
|
|
2499
2539
|
pathSeparator,
|
|
2500
|
-
root
|
|
2540
|
+
root,
|
|
2541
|
+
uid
|
|
2501
2542
|
} = state;
|
|
2502
2543
|
const newFileName = editingValue;
|
|
2503
2544
|
const siblingFileNames = getSiblingFileNames(items, focusedIndex);
|
|
@@ -2526,10 +2567,13 @@ const acceptCreate = async (state, newDirentType) => {
|
|
|
2526
2567
|
const newItems = treeToArray$1(merged, root);
|
|
2527
2568
|
const dirents = newItems;
|
|
2528
2569
|
const newFocusedIndex = getIndex(newItems, absolutePath);
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2570
|
+
if (isConnected()) {
|
|
2571
|
+
if (newDirentType === File) {
|
|
2572
|
+
await openUri(absolutePath, true);
|
|
2573
|
+
requestPostRenderFocus(uid);
|
|
2574
|
+
}
|
|
2575
|
+
} else {
|
|
2576
|
+
await finishCreate(absolutePath, newDirentType);
|
|
2533
2577
|
}
|
|
2534
2578
|
return {
|
|
2535
2579
|
...state,
|
|
@@ -2905,16 +2949,16 @@ const copyRelativePath = async state => {
|
|
|
2905
2949
|
};
|
|
2906
2950
|
|
|
2907
2951
|
const missingDialogWorkerRelay = 'Command "SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker" not found';
|
|
2908
|
-
const state
|
|
2952
|
+
const state = {
|
|
2909
2953
|
isTest: false
|
|
2910
2954
|
};
|
|
2911
2955
|
const setIsTest = value => {
|
|
2912
|
-
state
|
|
2956
|
+
state.isTest = value;
|
|
2913
2957
|
};
|
|
2914
2958
|
const confirm = async message => {
|
|
2915
2959
|
const {
|
|
2916
2960
|
isTest
|
|
2917
|
-
} = state
|
|
2961
|
+
} = state;
|
|
2918
2962
|
if (isTest) {
|
|
2919
2963
|
return confirm$1(message);
|
|
2920
2964
|
}
|
|
@@ -2929,7 +2973,7 @@ const confirm = async message => {
|
|
|
2929
2973
|
};
|
|
2930
2974
|
|
|
2931
2975
|
const commandCompletions = new WeakMap();
|
|
2932
|
-
const set$
|
|
2976
|
+
const set$1 = (state, completion) => {
|
|
2933
2977
|
commandCompletions.set(state, completion);
|
|
2934
2978
|
return state;
|
|
2935
2979
|
};
|
|
@@ -3750,7 +3794,7 @@ const {
|
|
|
3750
3794
|
get,
|
|
3751
3795
|
getCommandIds,
|
|
3752
3796
|
registerCommands,
|
|
3753
|
-
set
|
|
3797
|
+
set,
|
|
3754
3798
|
wrapGetter
|
|
3755
3799
|
} = create$1();
|
|
3756
3800
|
const commandQueues = new Map();
|
|
@@ -3883,10 +3927,10 @@ const wrapListItemCommandInternal = (fn, queued) => {
|
|
|
3883
3927
|
useChevrons
|
|
3884
3928
|
} = updatedState;
|
|
3885
3929
|
const intermediate = get(id);
|
|
3886
|
-
set
|
|
3930
|
+
set(id, intermediate.oldState, updatedState, intermediate.scheduledState);
|
|
3887
3931
|
if (hasSameVisibleExplorerItemInputs(intermediate.newState, updatedState)) {
|
|
3888
3932
|
if (updatedState.inputSource === User || !hasSameDragDataInputs(intermediate.newState, updatedState)) {
|
|
3889
|
-
set
|
|
3933
|
+
set(id, intermediate.oldState, updatedState);
|
|
3890
3934
|
}
|
|
3891
3935
|
return {
|
|
3892
3936
|
completion
|
|
@@ -3907,7 +3951,7 @@ const wrapListItemCommandInternal = (fn, queued) => {
|
|
|
3907
3951
|
visibleExplorerItems
|
|
3908
3952
|
};
|
|
3909
3953
|
const intermediate2 = get(id);
|
|
3910
|
-
set
|
|
3954
|
+
set(id, intermediate2.oldState, finalState);
|
|
3911
3955
|
maybeScheduleGitIgnoredUrisUpdate(newState, finalState);
|
|
3912
3956
|
return {
|
|
3913
3957
|
completion
|
|
@@ -4017,7 +4061,7 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0, ass
|
|
|
4017
4061
|
x,
|
|
4018
4062
|
y
|
|
4019
4063
|
};
|
|
4020
|
-
set
|
|
4064
|
+
set(state.uid, state, state);
|
|
4021
4065
|
return state;
|
|
4022
4066
|
};
|
|
4023
4067
|
|
|
@@ -4835,7 +4879,7 @@ const handleClickFile = async (state, dirent, index, keepFocus = false) => {
|
|
|
4835
4879
|
focused: keepFocus,
|
|
4836
4880
|
focusedIndex: index
|
|
4837
4881
|
};
|
|
4838
|
-
return set$
|
|
4882
|
+
return set$1(newState, completion);
|
|
4839
4883
|
};
|
|
4840
4884
|
|
|
4841
4885
|
const handleClickSymLink = async (state, dirent, index) => {
|
|
@@ -5264,7 +5308,7 @@ const handleClick = async (state, index, keepFocus = false) => {
|
|
|
5264
5308
|
...newState,
|
|
5265
5309
|
...resetEditing
|
|
5266
5310
|
};
|
|
5267
|
-
return completion ? set$
|
|
5311
|
+
return completion ? set$1(finalState, completion) : finalState;
|
|
5268
5312
|
};
|
|
5269
5313
|
|
|
5270
5314
|
// export const handleBlur=()=>{}
|
|
@@ -5412,7 +5456,7 @@ const handleContextMenuAtIndex = async (state, index, x, y) => {
|
|
|
5412
5456
|
focusedIndex: index,
|
|
5413
5457
|
items: newItems
|
|
5414
5458
|
};
|
|
5415
|
-
set
|
|
5459
|
+
set(uid, state, newState);
|
|
5416
5460
|
await show2(uid, Explorer, x, y, {
|
|
5417
5461
|
menuId: Explorer
|
|
5418
5462
|
});
|
|
@@ -5516,7 +5560,7 @@ const handleDoubleClick = async (state, eventX, eventY) => {
|
|
|
5516
5560
|
const item = state.items[index];
|
|
5517
5561
|
const type = normalizeDirentType(item.type);
|
|
5518
5562
|
if (type === File || type === SymLinkFile) {
|
|
5519
|
-
return set$
|
|
5563
|
+
return set$1(state, openUri(item.path, true));
|
|
5520
5564
|
}
|
|
5521
5565
|
return state;
|
|
5522
5566
|
};
|
|
@@ -6406,8 +6450,8 @@ const getDropHandler = index => {
|
|
|
6406
6450
|
}
|
|
6407
6451
|
};
|
|
6408
6452
|
|
|
6409
|
-
const getDroppedItems = async (
|
|
6410
|
-
const result = await getDroppedItems$1(
|
|
6453
|
+
const getDroppedItems = async (dropIdOrItemIds, isElectron) => {
|
|
6454
|
+
const result = typeof dropIdOrItemIds === 'number' ? await getDroppedItemsByDropId(dropIdOrItemIds, isElectron) : await getDroppedItems$1(dropIdOrItemIds, isElectron);
|
|
6411
6455
|
const files = isElectron ? result.files : result.files.filter(file => file.handle);
|
|
6412
6456
|
const fileHandles = files.map(file => file.handle || {
|
|
6413
6457
|
kind: file.kind,
|
|
@@ -6446,8 +6490,11 @@ const getInternalDragPaths = (items, uris) => {
|
|
|
6446
6490
|
return paths;
|
|
6447
6491
|
};
|
|
6448
6492
|
|
|
6449
|
-
const handleDrop = async (state, x, y,
|
|
6493
|
+
const handleDrop = async (state, x, y, dropIdOrFileIds) => {
|
|
6450
6494
|
if (state.isReadonly && state.root !== '') {
|
|
6495
|
+
if (typeof dropIdOrFileIds === 'number') {
|
|
6496
|
+
await discardDrop(dropIdOrFileIds);
|
|
6497
|
+
}
|
|
6451
6498
|
return state;
|
|
6452
6499
|
}
|
|
6453
6500
|
try {
|
|
@@ -6456,7 +6503,7 @@ const handleDrop = async (state, x, y, fileIds) => {
|
|
|
6456
6503
|
fileHandles,
|
|
6457
6504
|
paths,
|
|
6458
6505
|
uris
|
|
6459
|
-
} = await getDroppedItems(
|
|
6506
|
+
} = await getDroppedItems(dropIdOrFileIds, isElectron);
|
|
6460
6507
|
const internalPaths = getInternalDragPaths(state.items, uris);
|
|
6461
6508
|
const droppedPaths = internalPaths.length > 0 ? internalPaths : paths;
|
|
6462
6509
|
const index = getIndexFromPosition(state, x, y);
|
|
@@ -6601,23 +6648,6 @@ const handleKeyDown = (state, defaultPrevented, key) => {
|
|
|
6601
6648
|
};
|
|
6602
6649
|
};
|
|
6603
6650
|
|
|
6604
|
-
const state = {
|
|
6605
|
-
connected: false
|
|
6606
|
-
};
|
|
6607
|
-
const isConnected = () => {
|
|
6608
|
-
const {
|
|
6609
|
-
connected
|
|
6610
|
-
} = state;
|
|
6611
|
-
return connected;
|
|
6612
|
-
};
|
|
6613
|
-
const invoke = (method, ...params) => {
|
|
6614
|
-
return invoke$4(method, ...params);
|
|
6615
|
-
};
|
|
6616
|
-
const set = rpc => {
|
|
6617
|
-
set$6(rpc);
|
|
6618
|
-
state.connected = true;
|
|
6619
|
-
};
|
|
6620
|
-
|
|
6621
6651
|
const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
|
|
6622
6652
|
const executeViewletCommand = async (uid, command, ...args) => {
|
|
6623
6653
|
const fn = viewletCommandMap[`Explorer.${command}`];
|
|
@@ -6626,6 +6656,11 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess =
|
|
|
6626
6656
|
}
|
|
6627
6657
|
await fn(uid, ...args);
|
|
6628
6658
|
await invoke$3('Viewlet.requestRender', uid);
|
|
6659
|
+
if (takePostRenderFocus(uid)) {
|
|
6660
|
+
setTimeout(() => {
|
|
6661
|
+
void invoke$3('Main.focus');
|
|
6662
|
+
}, 0);
|
|
6663
|
+
}
|
|
6629
6664
|
};
|
|
6630
6665
|
const rpc = await create$6({
|
|
6631
6666
|
commandMap: {
|
|
@@ -6634,7 +6669,7 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess =
|
|
|
6634
6669
|
messagePort: port
|
|
6635
6670
|
});
|
|
6636
6671
|
if (setAsRendererProcess) {
|
|
6637
|
-
set(rpc);
|
|
6672
|
+
set$2(rpc);
|
|
6638
6673
|
}
|
|
6639
6674
|
};
|
|
6640
6675
|
|
|
@@ -7931,11 +7966,12 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
7931
7966
|
|
|
7932
7967
|
const render2 = async (uid, _diffResult) => {
|
|
7933
7968
|
const {
|
|
7969
|
+
newState,
|
|
7934
7970
|
oldState,
|
|
7935
7971
|
scheduledState
|
|
7936
7972
|
} = get(uid);
|
|
7937
7973
|
const diffResult = diff(oldState, scheduledState);
|
|
7938
|
-
set
|
|
7974
|
+
set(uid, scheduledState, newState, scheduledState);
|
|
7939
7975
|
const commands = applyRender(oldState, scheduledState, diffResult);
|
|
7940
7976
|
if (!isConnected()) {
|
|
7941
7977
|
return commands;
|
|
@@ -7943,7 +7979,7 @@ const render2 = async (uid, _diffResult) => {
|
|
|
7943
7979
|
const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
|
|
7944
7980
|
const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
|
|
7945
7981
|
const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
|
|
7946
|
-
return [
|
|
7982
|
+
return [['Viewlet.commitPending', uid, transactionId], ...rendererWorkerCommands];
|
|
7947
7983
|
};
|
|
7948
7984
|
|
|
7949
7985
|
const Button = 1;
|
|
@@ -8107,7 +8143,7 @@ const renderEventListeners = () => {
|
|
|
8107
8143
|
preventDefault: true
|
|
8108
8144
|
}, {
|
|
8109
8145
|
name: HandleDrop,
|
|
8110
|
-
params: ['handleDrop', ClientX, ClientY,
|
|
8146
|
+
params: ['handleDrop', ClientX, ClientY, DropId],
|
|
8111
8147
|
preventDefault: true
|
|
8112
8148
|
}, {
|
|
8113
8149
|
name: HandleNativePaste,
|