@lvce-editor/explorer-view 1.17.0 → 1.19.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 +217 -82
- package/package.json +6 -6
|
@@ -442,10 +442,10 @@ const create$4 = (method, params) => {
|
|
|
442
442
|
};
|
|
443
443
|
};
|
|
444
444
|
const callbacks = Object.create(null);
|
|
445
|
-
const set$
|
|
445
|
+
const set$2 = (id, fn) => {
|
|
446
446
|
callbacks[id] = fn;
|
|
447
447
|
};
|
|
448
|
-
const get$
|
|
448
|
+
const get$2 = id => {
|
|
449
449
|
return callbacks[id];
|
|
450
450
|
};
|
|
451
451
|
const remove$1 = id => {
|
|
@@ -461,7 +461,7 @@ const registerPromise = () => {
|
|
|
461
461
|
resolve,
|
|
462
462
|
promise
|
|
463
463
|
} = Promise.withResolvers();
|
|
464
|
-
set$
|
|
464
|
+
set$2(id, resolve);
|
|
465
465
|
return {
|
|
466
466
|
id,
|
|
467
467
|
promise
|
|
@@ -618,7 +618,7 @@ const warn = (...args) => {
|
|
|
618
618
|
console.warn(...args);
|
|
619
619
|
};
|
|
620
620
|
const resolve = (id, response) => {
|
|
621
|
-
const fn = get$
|
|
621
|
+
const fn = get$2(id);
|
|
622
622
|
if (!fn) {
|
|
623
623
|
console.log(response);
|
|
624
624
|
warn(`callback ${id} may already be disposed`);
|
|
@@ -657,7 +657,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
657
657
|
}
|
|
658
658
|
};
|
|
659
659
|
};
|
|
660
|
-
const create$1 = (message, error) => {
|
|
660
|
+
const create$1$1 = (message, error) => {
|
|
661
661
|
return {
|
|
662
662
|
jsonrpc: Two,
|
|
663
663
|
id: message.id,
|
|
@@ -668,7 +668,7 @@ const getErrorResponse = (message, error, preparePrettyError, logError) => {
|
|
|
668
668
|
const prettyError = preparePrettyError(error);
|
|
669
669
|
logError(error, prettyError);
|
|
670
670
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
671
|
-
return create$1(message, errorProperty);
|
|
671
|
+
return create$1$1(message, errorProperty);
|
|
672
672
|
};
|
|
673
673
|
const create$5 = (message, result) => {
|
|
674
674
|
return {
|
|
@@ -843,7 +843,7 @@ const listen$1 = async (module, options) => {
|
|
|
843
843
|
const ipc = module.wrap(rawIpc);
|
|
844
844
|
return ipc;
|
|
845
845
|
};
|
|
846
|
-
const create = async ({
|
|
846
|
+
const create$1 = async ({
|
|
847
847
|
commandMap
|
|
848
848
|
}) => {
|
|
849
849
|
// TODO create a commandMap per rpc instance
|
|
@@ -855,7 +855,7 @@ const create = async ({
|
|
|
855
855
|
};
|
|
856
856
|
const WebWorkerRpcClient = {
|
|
857
857
|
__proto__: null,
|
|
858
|
-
create
|
|
858
|
+
create: create$1
|
|
859
859
|
};
|
|
860
860
|
|
|
861
861
|
const RE_CHARACTERS = /^[a-zA-Z.-]+$/;
|
|
@@ -925,7 +925,9 @@ const computeExplorerRenamedDirent = (dirents, index, newName) => {
|
|
|
925
925
|
name: newName
|
|
926
926
|
})
|
|
927
927
|
};
|
|
928
|
-
const
|
|
928
|
+
const {
|
|
929
|
+
depth
|
|
930
|
+
} = newDirent;
|
|
929
931
|
// TODO
|
|
930
932
|
for (; startIndex >= 0; startIndex--) {
|
|
931
933
|
const dirent = dirents[startIndex];
|
|
@@ -1013,15 +1015,15 @@ const Rename$1 = 3;
|
|
|
1013
1015
|
const RendererWorker = 1;
|
|
1014
1016
|
|
|
1015
1017
|
const rpcs = Object.create(null);
|
|
1016
|
-
const set = (id, rpc) => {
|
|
1018
|
+
const set$1 = (id, rpc) => {
|
|
1017
1019
|
rpcs[id] = rpc;
|
|
1018
1020
|
};
|
|
1019
|
-
const get = id => {
|
|
1021
|
+
const get$1 = id => {
|
|
1020
1022
|
return rpcs[id];
|
|
1021
1023
|
};
|
|
1022
1024
|
|
|
1023
1025
|
const invoke = (method, ...params) => {
|
|
1024
|
-
const rpc = get(RendererWorker);
|
|
1026
|
+
const rpc = get$1(RendererWorker);
|
|
1025
1027
|
return rpc.invoke(method, ...params);
|
|
1026
1028
|
};
|
|
1027
1029
|
|
|
@@ -1093,7 +1095,7 @@ const acceptCreate = async (state, newDirentType, createFn) => {
|
|
|
1093
1095
|
// TODO better handle error
|
|
1094
1096
|
try {
|
|
1095
1097
|
await createFn(absolutePath);
|
|
1096
|
-
} catch
|
|
1098
|
+
} catch {
|
|
1097
1099
|
// TODO display error
|
|
1098
1100
|
return state;
|
|
1099
1101
|
}
|
|
@@ -1173,7 +1175,7 @@ const acceptRename = async state => {
|
|
|
1173
1175
|
const oldParentPath = dirname(pathSeparator, oldAbsolutePath);
|
|
1174
1176
|
const newAbsolutePath = [oldParentPath, editingValue].join(pathSeparator);
|
|
1175
1177
|
await rename$1(oldAbsolutePath, newAbsolutePath);
|
|
1176
|
-
} catch
|
|
1178
|
+
} catch {
|
|
1177
1179
|
// TODO
|
|
1178
1180
|
// await ErrorHandling.showErrorDialog(error)
|
|
1179
1181
|
return state;
|
|
@@ -1283,6 +1285,54 @@ const copyRelativePath$1 = async state => {
|
|
|
1283
1285
|
return state;
|
|
1284
1286
|
};
|
|
1285
1287
|
|
|
1288
|
+
const states = Object.create(null);
|
|
1289
|
+
const get = uid => {
|
|
1290
|
+
return states[uid];
|
|
1291
|
+
};
|
|
1292
|
+
const set = (uid, oldState, newState) => {
|
|
1293
|
+
states[uid] = {
|
|
1294
|
+
oldState,
|
|
1295
|
+
newState
|
|
1296
|
+
};
|
|
1297
|
+
};
|
|
1298
|
+
|
|
1299
|
+
const ListItem = 22;
|
|
1300
|
+
|
|
1301
|
+
const Slash = '/';
|
|
1302
|
+
|
|
1303
|
+
const create = (id, uri, x, y, width, height, args, parentUid) => {
|
|
1304
|
+
const state = {
|
|
1305
|
+
uid: id,
|
|
1306
|
+
parentUid,
|
|
1307
|
+
root: '',
|
|
1308
|
+
items: [],
|
|
1309
|
+
focusedIndex: -1,
|
|
1310
|
+
focused: false,
|
|
1311
|
+
hoverIndex: -1,
|
|
1312
|
+
x,
|
|
1313
|
+
y,
|
|
1314
|
+
width,
|
|
1315
|
+
height,
|
|
1316
|
+
deltaY: 0,
|
|
1317
|
+
minLineY: 0,
|
|
1318
|
+
maxLineY: 0,
|
|
1319
|
+
pathSeparator: Slash,
|
|
1320
|
+
version: 0,
|
|
1321
|
+
editingIndex: -1,
|
|
1322
|
+
itemHeight: ListItem,
|
|
1323
|
+
dropTargets: [],
|
|
1324
|
+
excluded: [],
|
|
1325
|
+
editingValue: '',
|
|
1326
|
+
editingType: None$5,
|
|
1327
|
+
editingIcon: '',
|
|
1328
|
+
fileIconCache: Object.create(null),
|
|
1329
|
+
useChevrons: false,
|
|
1330
|
+
icons: []
|
|
1331
|
+
};
|
|
1332
|
+
set(state.uid, state, state);
|
|
1333
|
+
return state;
|
|
1334
|
+
};
|
|
1335
|
+
|
|
1286
1336
|
const isSymbolicLink = dirent => {
|
|
1287
1337
|
return dirent.type === Symlink;
|
|
1288
1338
|
};
|
|
@@ -1474,7 +1524,9 @@ const expandAll = async state => {
|
|
|
1474
1524
|
return state;
|
|
1475
1525
|
}
|
|
1476
1526
|
const dirent = items[focusedIndex];
|
|
1477
|
-
const
|
|
1527
|
+
const {
|
|
1528
|
+
depth
|
|
1529
|
+
} = dirent;
|
|
1478
1530
|
const newDirents = [...items];
|
|
1479
1531
|
// TODO fetch child dirents in parallel
|
|
1480
1532
|
for (const dirent of newDirents) {
|
|
@@ -1813,6 +1865,7 @@ const ButtonWide = 'ButtonWide';
|
|
|
1813
1865
|
const Chevron = 'Chevron';
|
|
1814
1866
|
const Explorer$1 = 'Explorer';
|
|
1815
1867
|
const FileIcon = 'FileIcon';
|
|
1868
|
+
const FocusOutline = 'FocusOutline';
|
|
1816
1869
|
const IconButton = 'IconButton';
|
|
1817
1870
|
const InputBox = 'InputBox';
|
|
1818
1871
|
const Label = 'Label';
|
|
@@ -1824,6 +1877,18 @@ const Viewlet = 'Viewlet';
|
|
|
1824
1877
|
const Welcome = 'Welcome';
|
|
1825
1878
|
const WelcomeMessage = 'WelcomeMessage';
|
|
1826
1879
|
|
|
1880
|
+
// TODO add option to make classnames numeric
|
|
1881
|
+
// once at start, send all classnames to renderer process
|
|
1882
|
+
// then, components uses numeric classname
|
|
1883
|
+
// when a component uses multiple classnames, it is a new number
|
|
1884
|
+
// representing the concatenated strings for example
|
|
1885
|
+
// 0 = 'Button'
|
|
1886
|
+
// 1 = 'IconButton'
|
|
1887
|
+
// 2 = 'Button IconButton'
|
|
1888
|
+
// it could make dom diffing faster, since for classname,
|
|
1889
|
+
// only numbers are compared. it could also make rendering faster,
|
|
1890
|
+
// since less data is transferred to renderer process
|
|
1891
|
+
|
|
1827
1892
|
const HandleBlur = 'handleBlur';
|
|
1828
1893
|
const HandleClick = 'handleClick';
|
|
1829
1894
|
const handleClickOpenFolder$1 = 'handleClickOpenFolder';
|
|
@@ -1957,13 +2022,14 @@ const getExplorerWelcomeVirtualDom = isWide => {
|
|
|
1957
2022
|
}, text(openFolder$1())];
|
|
1958
2023
|
};
|
|
1959
2024
|
|
|
1960
|
-
const getExplorerVirtualDom = (visibleItems, focusedIndex, root, isWide) => {
|
|
2025
|
+
const getExplorerVirtualDom = (visibleItems, focusedIndex, root, isWide, focused) => {
|
|
1961
2026
|
if (!root) {
|
|
1962
2027
|
return getExplorerWelcomeVirtualDom(isWide);
|
|
1963
2028
|
}
|
|
2029
|
+
const extraClass = focused && focusedIndex === -1 ? FocusOutline : '';
|
|
1964
2030
|
const dom = [{
|
|
1965
2031
|
type: Div,
|
|
1966
|
-
className: mergeClassNames(Viewlet, Explorer$1),
|
|
2032
|
+
className: mergeClassNames(Viewlet, Explorer$1, extraClass),
|
|
1967
2033
|
tabIndex: 0,
|
|
1968
2034
|
role: Tree,
|
|
1969
2035
|
ariaLabel: filesExplorer(),
|
|
@@ -2304,6 +2370,7 @@ const handleBlur = state => {
|
|
|
2304
2370
|
};
|
|
2305
2371
|
|
|
2306
2372
|
const handleClickDirectory = async (state, dirent, index, keepFocus) => {
|
|
2373
|
+
// @ts-ignore
|
|
2307
2374
|
dirent.type = DirectoryExpanding;
|
|
2308
2375
|
// TODO handle error
|
|
2309
2376
|
const dirents = await getChildDirents(state.pathSeparator, dirent);
|
|
@@ -2319,7 +2386,9 @@ const handleClickDirectory = async (state, dirent, index, keepFocus) => {
|
|
|
2319
2386
|
}
|
|
2320
2387
|
const newDirents = [...state2.items];
|
|
2321
2388
|
newDirents.splice(newIndex + 1, 0, ...dirents);
|
|
2389
|
+
// @ts-ignore
|
|
2322
2390
|
dirent.type = DirectoryExpanded;
|
|
2391
|
+
// @ts-ignore
|
|
2323
2392
|
dirent.icon = getIcon();
|
|
2324
2393
|
const {
|
|
2325
2394
|
height,
|
|
@@ -2348,9 +2417,12 @@ const handleClickDirectoryExpanded$1 = async (state, dirent, index, keepFocus) =
|
|
|
2348
2417
|
const {
|
|
2349
2418
|
minLineY,
|
|
2350
2419
|
maxLineY,
|
|
2351
|
-
itemHeight
|
|
2420
|
+
itemHeight,
|
|
2421
|
+
fileIconCache
|
|
2352
2422
|
} = state;
|
|
2423
|
+
// @ts-ignore
|
|
2353
2424
|
dirent.type = Directory;
|
|
2425
|
+
// @ts-ignore
|
|
2354
2426
|
dirent.icon = getIcon();
|
|
2355
2427
|
const endIndex = getParentEndIndex(state.items, index);
|
|
2356
2428
|
const removeCount = endIndex - index - 1;
|
|
@@ -2367,7 +2439,7 @@ const handleClickDirectoryExpanded$1 = async (state, dirent, index, keepFocus) =
|
|
|
2367
2439
|
const {
|
|
2368
2440
|
icons,
|
|
2369
2441
|
newFileIconCache
|
|
2370
|
-
} = await getFileIcons(parts,
|
|
2442
|
+
} = await getFileIcons(parts, fileIconCache);
|
|
2371
2443
|
return {
|
|
2372
2444
|
...state,
|
|
2373
2445
|
items: newDirents,
|
|
@@ -2384,7 +2456,7 @@ const handleClickDirectoryExpanded$1 = async (state, dirent, index, keepFocus) =
|
|
|
2384
2456
|
const {
|
|
2385
2457
|
icons,
|
|
2386
2458
|
newFileIconCache
|
|
2387
|
-
} = await getFileIcons(parts,
|
|
2459
|
+
} = await getFileIcons(parts, fileIconCache);
|
|
2388
2460
|
return {
|
|
2389
2461
|
...state,
|
|
2390
2462
|
items: newDirents,
|
|
@@ -2396,7 +2468,9 @@ const handleClickDirectoryExpanded$1 = async (state, dirent, index, keepFocus) =
|
|
|
2396
2468
|
};
|
|
2397
2469
|
|
|
2398
2470
|
const handleClickDirectoryExpanding = async (state, dirent, index, keepFocus) => {
|
|
2471
|
+
// @ts-ignore
|
|
2399
2472
|
dirent.type = Directory;
|
|
2473
|
+
// @ts-ignore
|
|
2400
2474
|
dirent.icon = getIcon();
|
|
2401
2475
|
return {
|
|
2402
2476
|
...state,
|
|
@@ -2405,8 +2479,12 @@ const handleClickDirectoryExpanding = async (state, dirent, index, keepFocus) =>
|
|
|
2405
2479
|
};
|
|
2406
2480
|
};
|
|
2407
2481
|
|
|
2482
|
+
const openUri = async (uri, focus) => {
|
|
2483
|
+
await invoke(/* Main.openAbsolutePath */'Main.openUri', /* absolutePath */uri, /* focus */focus);
|
|
2484
|
+
};
|
|
2485
|
+
|
|
2408
2486
|
const handleClickFile$1 = async (state, dirent, index, keepFocus = false) => {
|
|
2409
|
-
await
|
|
2487
|
+
await openUri(dirent.path, !keepFocus);
|
|
2410
2488
|
return {
|
|
2411
2489
|
...state,
|
|
2412
2490
|
focusedIndex: index,
|
|
@@ -2793,7 +2871,9 @@ const isEqual = (a, b) => {
|
|
|
2793
2871
|
if (a.length !== b.length) {
|
|
2794
2872
|
return false;
|
|
2795
2873
|
}
|
|
2796
|
-
const
|
|
2874
|
+
const {
|
|
2875
|
+
length
|
|
2876
|
+
} = a;
|
|
2797
2877
|
for (let i = 0; i < length; i++) {
|
|
2798
2878
|
if (a[i] !== b[i]) {
|
|
2799
2879
|
return false;
|
|
@@ -2984,6 +3064,15 @@ const handleDrop = async (state, x, y, files) => {
|
|
|
2984
3064
|
}
|
|
2985
3065
|
};
|
|
2986
3066
|
|
|
3067
|
+
const setFocus = key => {
|
|
3068
|
+
return invoke('Focus.setFocus', key);
|
|
3069
|
+
};
|
|
3070
|
+
|
|
3071
|
+
const handleFocus = async state => {
|
|
3072
|
+
await setFocus(FocusExplorer);
|
|
3073
|
+
return state;
|
|
3074
|
+
};
|
|
3075
|
+
|
|
2987
3076
|
const updateIcon = dirent => {
|
|
2988
3077
|
return {
|
|
2989
3078
|
...dirent,
|
|
@@ -3322,10 +3411,6 @@ const handleWorkspaceChange = async state => {
|
|
|
3322
3411
|
return newState;
|
|
3323
3412
|
};
|
|
3324
3413
|
|
|
3325
|
-
const setFocus = key => {
|
|
3326
|
-
return invoke('Focus.setFocus', key);
|
|
3327
|
-
};
|
|
3328
|
-
|
|
3329
3414
|
const ExplorerEditBox = FocusExplorerEditBox;
|
|
3330
3415
|
|
|
3331
3416
|
const newDirent = async (state, editingType) => {
|
|
@@ -3393,7 +3478,7 @@ const removeDirent = async state => {
|
|
|
3393
3478
|
try {
|
|
3394
3479
|
// TODO handle error
|
|
3395
3480
|
await remove(absolutePath);
|
|
3396
|
-
} catch
|
|
3481
|
+
} catch {
|
|
3397
3482
|
// TODO vscode shows error as alert (no stacktrace) and retry button
|
|
3398
3483
|
// maybe should show alert as well, but where to put stacktrace?
|
|
3399
3484
|
// on web should probably show notification (dialog)
|
|
@@ -3463,21 +3548,22 @@ const renameDirent = state => {
|
|
|
3463
3548
|
|
|
3464
3549
|
const renderItems = {
|
|
3465
3550
|
isEqual(oldState, newState) {
|
|
3466
|
-
return
|
|
3551
|
+
return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.focusedIndex === newState.focusedIndex && oldState.editingIndex === newState.editingIndex && oldState.editingType === newState.editingType && oldState.editingValue === newState.editingValue && oldState.width === newState.width && oldState.focused === newState.focused;
|
|
3467
3552
|
},
|
|
3468
3553
|
apply(oldState, newState) {
|
|
3469
3554
|
const visibleDirents = getVisibleExplorerItems(newState.items, newState.minLineY, newState.maxLineY, newState.focusedIndex, newState.editingIndex, newState.editingType, newState.editingValue, newState.icons, newState.useChevrons);
|
|
3470
3555
|
const isWide = newState.width > 450;
|
|
3471
|
-
const dom = getExplorerVirtualDom(visibleDirents, newState.focusedIndex, newState.root, isWide);
|
|
3556
|
+
const dom = getExplorerVirtualDom(visibleDirents, newState.focusedIndex, newState.root, isWide, newState.focused);
|
|
3472
3557
|
return ['Viewlet.setDom2', dom];
|
|
3473
3558
|
}
|
|
3474
3559
|
};
|
|
3475
3560
|
|
|
3476
|
-
//
|
|
3477
|
-
//
|
|
3561
|
+
// TODO add virtual dom diffing so that focus is not lost when updating dom
|
|
3562
|
+
// const renderFocus = {
|
|
3563
|
+
// isEqual(oldState: any, newState: any) {
|
|
3478
3564
|
// return oldState.focusedIndex === newState.focusedIndex && oldState.focused === newState.focused && oldState.minLineY === newState.minLineY
|
|
3479
3565
|
// },
|
|
3480
|
-
// apply(oldState:any, newState:any) {
|
|
3566
|
+
// apply(oldState: any, newState: any) {
|
|
3481
3567
|
// const oldFocusedIndex = oldState.focusedIndex - oldState.minLineY
|
|
3482
3568
|
// const newFocusedIndex = newState.focusedIndex - newState.minLineY
|
|
3483
3569
|
// return [/* method */ 'setFocusedIndex', /* oldindex */ oldFocusedIndex, /* newIndex */ newFocusedIndex, /* focused */ newState.focused]
|
|
@@ -3502,7 +3588,23 @@ const renderEditingIndex = {
|
|
|
3502
3588
|
}
|
|
3503
3589
|
};
|
|
3504
3590
|
const render = [renderItems, renderEditingIndex];
|
|
3505
|
-
const doRender = (
|
|
3591
|
+
const doRender = (uid, _) => {
|
|
3592
|
+
if (typeof uid === 'number') {
|
|
3593
|
+
const {
|
|
3594
|
+
oldState,
|
|
3595
|
+
newState
|
|
3596
|
+
} = get(uid);
|
|
3597
|
+
const commands = [];
|
|
3598
|
+
for (const fn of render) {
|
|
3599
|
+
if (!fn.isEqual(oldState, newState)) {
|
|
3600
|
+
commands.push(fn.apply(oldState, newState));
|
|
3601
|
+
}
|
|
3602
|
+
}
|
|
3603
|
+
return commands;
|
|
3604
|
+
}
|
|
3605
|
+
// deprecated
|
|
3606
|
+
const oldState = uid;
|
|
3607
|
+
const newState = _;
|
|
3506
3608
|
const commands = [];
|
|
3507
3609
|
for (const fn of render) {
|
|
3508
3610
|
if (!fn.isEqual(oldState, newState)) {
|
|
@@ -3818,14 +3920,22 @@ const isExpandedDirectory = dirent => {
|
|
|
3818
3920
|
return dirent.type === DirectoryExpanded;
|
|
3819
3921
|
};
|
|
3820
3922
|
|
|
3821
|
-
const saveState =
|
|
3923
|
+
const saveState = uid => {
|
|
3924
|
+
let newState;
|
|
3925
|
+
if (typeof uid === 'number') {
|
|
3926
|
+
const value = get(uid);
|
|
3927
|
+
newState = value.newState;
|
|
3928
|
+
} else {
|
|
3929
|
+
// deprecated
|
|
3930
|
+
newState = uid;
|
|
3931
|
+
}
|
|
3822
3932
|
const {
|
|
3823
3933
|
items,
|
|
3824
3934
|
root,
|
|
3825
3935
|
deltaY,
|
|
3826
3936
|
minLineY,
|
|
3827
3937
|
maxLineY
|
|
3828
|
-
} =
|
|
3938
|
+
} = newState;
|
|
3829
3939
|
const expandedPaths = items.filter(isExpandedDirectory).map(getPath);
|
|
3830
3940
|
return {
|
|
3831
3941
|
expandedPaths,
|
|
@@ -3860,6 +3970,10 @@ const setDeltaY = (state, deltaY) => {
|
|
|
3860
3970
|
};
|
|
3861
3971
|
};
|
|
3862
3972
|
|
|
3973
|
+
const terminate = () => {
|
|
3974
|
+
globalThis.close();
|
|
3975
|
+
};
|
|
3976
|
+
|
|
3863
3977
|
const updateEditingValue = (state, value) => {
|
|
3864
3978
|
const editingIcon = getFileIcon({
|
|
3865
3979
|
name: value
|
|
@@ -3871,62 +3985,83 @@ const updateEditingValue = (state, value) => {
|
|
|
3871
3985
|
};
|
|
3872
3986
|
};
|
|
3873
3987
|
|
|
3988
|
+
const wrapCommand = fn => {
|
|
3989
|
+
const wrapped = async (uid, ...args) => {
|
|
3990
|
+
if (typeof uid === 'number') {
|
|
3991
|
+
const {
|
|
3992
|
+
newState
|
|
3993
|
+
} = get(uid);
|
|
3994
|
+
const newerState = await fn(newState, ...args);
|
|
3995
|
+
set(uid, newState, newerState);
|
|
3996
|
+
} else {
|
|
3997
|
+
// deprecated
|
|
3998
|
+
const newerState = await fn(uid, ...args);
|
|
3999
|
+
return newerState;
|
|
4000
|
+
}
|
|
4001
|
+
};
|
|
4002
|
+
return wrapped;
|
|
4003
|
+
};
|
|
4004
|
+
|
|
3874
4005
|
const commandMap = {
|
|
3875
|
-
'Explorer.acceptEdit': acceptEdit,
|
|
3876
|
-
'Explorer.cancelEdit': cancelEdit,
|
|
3877
|
-
'Explorer.collapseAll': collapseAll$1,
|
|
3878
|
-
'Explorer.copyPath': copyPath$1,
|
|
3879
|
-
'Explorer.copyRelativePath': copyRelativePath$1,
|
|
3880
|
-
'Explorer.expandAll': expandAll,
|
|
3881
|
-
'Explorer.expandRecursively': expandRecursively,
|
|
3882
|
-
'Explorer.focusFirst': focusFirst,
|
|
3883
|
-
'Explorer.focusIndex': focusIndex,
|
|
3884
|
-
'Explorer.focusLast': focusLast,
|
|
3885
|
-
'Explorer.focusNext': focusNext,
|
|
3886
|
-
'Explorer.focusPrevious': focusPrevious,
|
|
3887
|
-
'Explorer.getActions': getActions,
|
|
3888
|
-
'Explorer.getKeyBindings': getKeyBindings,
|
|
3889
|
-
'Explorer.getMenuEntries': getMenuEntries,
|
|
3890
|
-
'Explorer.getVirtualDom': getExplorerVirtualDom,
|
|
3891
|
-
'Explorer.getVisibleItems': getVisibleExplorerItems,
|
|
3892
|
-
'Explorer.handleArrowLeft': handleArrowLeft,
|
|
3893
|
-
'Explorer.handleArrowRight': handleArrowRight,
|
|
3894
|
-
'Explorer.handleBlur': handleBlur,
|
|
3895
|
-
'Explorer.handleClick': handleClick,
|
|
3896
|
-
'Explorer.handleClickAt': handleClickAt,
|
|
3897
|
-
'Explorer.handleClickCurrentButKeepFocus': handleClickCurrentButKeepFocus,
|
|
3898
|
-
'Explorer.handleClickOpenFolder': handleClickOpenFolder,
|
|
3899
|
-
'Explorer.handleContextMenu': handleContextMenu,
|
|
3900
|
-
'Explorer.handleCopy': handleCopy,
|
|
3901
|
-
'Explorer.handleDragOver': handleDragOver,
|
|
3902
|
-
'Explorer.handleDrop': handleDrop,
|
|
3903
|
-
'Explorer.
|
|
3904
|
-
'Explorer.
|
|
3905
|
-
'Explorer.
|
|
3906
|
-
'Explorer.
|
|
3907
|
-
'Explorer.
|
|
3908
|
-
'Explorer.
|
|
3909
|
-
'Explorer.
|
|
3910
|
-
'Explorer.
|
|
3911
|
-
'Explorer.
|
|
3912
|
-
'Explorer.
|
|
3913
|
-
'Explorer.
|
|
3914
|
-
'Explorer.
|
|
4006
|
+
'Explorer.acceptEdit': wrapCommand(acceptEdit),
|
|
4007
|
+
'Explorer.cancelEdit': wrapCommand(cancelEdit),
|
|
4008
|
+
'Explorer.collapseAll': wrapCommand(collapseAll$1),
|
|
4009
|
+
'Explorer.copyPath': wrapCommand(copyPath$1),
|
|
4010
|
+
'Explorer.copyRelativePath': wrapCommand(copyRelativePath$1),
|
|
4011
|
+
'Explorer.expandAll': wrapCommand(expandAll),
|
|
4012
|
+
'Explorer.expandRecursively': wrapCommand(expandRecursively),
|
|
4013
|
+
'Explorer.focusFirst': wrapCommand(focusFirst),
|
|
4014
|
+
'Explorer.focusIndex': wrapCommand(focusIndex),
|
|
4015
|
+
'Explorer.focusLast': wrapCommand(focusLast),
|
|
4016
|
+
'Explorer.focusNext': wrapCommand(focusNext),
|
|
4017
|
+
'Explorer.focusPrevious': wrapCommand(focusPrevious),
|
|
4018
|
+
'Explorer.getActions': wrapCommand(getActions),
|
|
4019
|
+
'Explorer.getKeyBindings': wrapCommand(getKeyBindings),
|
|
4020
|
+
'Explorer.getMenuEntries': wrapCommand(getMenuEntries),
|
|
4021
|
+
'Explorer.getVirtualDom': wrapCommand(getExplorerVirtualDom),
|
|
4022
|
+
'Explorer.getVisibleItems': wrapCommand(getVisibleExplorerItems),
|
|
4023
|
+
'Explorer.handleArrowLeft': wrapCommand(handleArrowLeft),
|
|
4024
|
+
'Explorer.handleArrowRight': wrapCommand(handleArrowRight),
|
|
4025
|
+
'Explorer.handleBlur': wrapCommand(handleBlur),
|
|
4026
|
+
'Explorer.handleClick': wrapCommand(handleClick),
|
|
4027
|
+
'Explorer.handleClickAt': wrapCommand(handleClickAt),
|
|
4028
|
+
'Explorer.handleClickCurrentButKeepFocus': wrapCommand(handleClickCurrentButKeepFocus),
|
|
4029
|
+
'Explorer.handleClickOpenFolder': wrapCommand(handleClickOpenFolder),
|
|
4030
|
+
'Explorer.handleContextMenu': wrapCommand(handleContextMenu),
|
|
4031
|
+
'Explorer.handleCopy': wrapCommand(handleCopy),
|
|
4032
|
+
'Explorer.handleDragOver': wrapCommand(handleDragOver),
|
|
4033
|
+
'Explorer.handleDrop': wrapCommand(handleDrop),
|
|
4034
|
+
'Explorer.handleFocus': wrapCommand(handleFocus),
|
|
4035
|
+
'Explorer.handleIconThemeChange': wrapCommand(handleIconThemeChange),
|
|
4036
|
+
'Explorer.handlePaste': wrapCommand(handlePaste),
|
|
4037
|
+
'Explorer.handlePointerDown': wrapCommand(handlePointerDown),
|
|
4038
|
+
'Explorer.handleUpload': wrapCommand(handleUpload),
|
|
4039
|
+
'Explorer.handleWheel': wrapCommand(handleWheel),
|
|
4040
|
+
'Explorer.handleWorkspaceChange': wrapCommand(handleWorkspaceChange),
|
|
4041
|
+
'Explorer.loadContent': wrapCommand(loadContent),
|
|
4042
|
+
'Explorer.newFile': wrapCommand(newFile),
|
|
4043
|
+
'Explorer.newFolder': wrapCommand(newFolder),
|
|
4044
|
+
'Explorer.openContainingFolder': wrapCommand(openContainingFolder),
|
|
4045
|
+
'Explorer.removeDirent': wrapCommand(removeDirent),
|
|
4046
|
+
'Explorer.renameDirent': wrapCommand(renameDirent),
|
|
4047
|
+
'Explorer.restoreState': wrapCommand(restoreState),
|
|
4048
|
+
'Explorer.revealItem': wrapCommand(revealItem),
|
|
4049
|
+
'Explorer.setDeltaY': wrapCommand(setDeltaY),
|
|
4050
|
+
'Explorer.terminate': wrapCommand(terminate),
|
|
4051
|
+
'Explorer.updateEditingValue': wrapCommand(updateEditingValue),
|
|
4052
|
+
'Explorer.updateIcons': wrapCommand(updateIcons),
|
|
4053
|
+
// not wrapped
|
|
4054
|
+
'Explorer.create': create,
|
|
3915
4055
|
'Explorer.render': doRender,
|
|
3916
4056
|
'Explorer.renderActions': renderActions,
|
|
3917
|
-
'Explorer.
|
|
3918
|
-
'Explorer.revealItem': revealItem,
|
|
3919
|
-
'Explorer.saveState': saveState,
|
|
3920
|
-
'Explorer.setDeltaY': setDeltaY,
|
|
3921
|
-
'Explorer.updateEditingValue': updateEditingValue,
|
|
3922
|
-
'Explorer.updateIcons': updateIcons
|
|
4057
|
+
'Explorer.saveState': saveState
|
|
3923
4058
|
};
|
|
3924
4059
|
|
|
3925
4060
|
const listen = async () => {
|
|
3926
4061
|
const rpc = await WebWorkerRpcClient.create({
|
|
3927
4062
|
commandMap: commandMap
|
|
3928
4063
|
});
|
|
3929
|
-
set(RendererWorker, rpc);
|
|
4064
|
+
set$1(RendererWorker, rpc);
|
|
3930
4065
|
};
|
|
3931
4066
|
|
|
3932
4067
|
const main = async () => {
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/explorer-view",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"description": "Explorer Worker",
|
|
5
|
-
"main": "dist/explorerViewWorkerMain.js",
|
|
6
|
-
"type": "module",
|
|
7
5
|
"keywords": [],
|
|
8
|
-
"author": "Lvce Editor",
|
|
9
|
-
"license": "MIT",
|
|
10
6
|
"repository": {
|
|
11
7
|
"type": "git",
|
|
12
8
|
"url": "git+https://github.com/lvce-editor/explorer-view.git"
|
|
13
|
-
}
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"author": "Lvce Editor",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "dist/explorerViewWorkerMain.js"
|
|
14
14
|
}
|