@lvce-editor/explorer-view 5.5.0 → 5.6.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 +514 -514
- package/package.json +1 -1
|
@@ -1393,14 +1393,14 @@ const copy$1 = async (oldUri, newUri) => {
|
|
|
1393
1393
|
|
|
1394
1394
|
const applyOperation = operation => {
|
|
1395
1395
|
switch (operation.type) {
|
|
1396
|
-
case CreateFolder$1:
|
|
1397
|
-
return mkdir(operation.path);
|
|
1398
1396
|
case Copy$1:
|
|
1399
1397
|
return copy$1(operation.from || '', operation.path);
|
|
1400
|
-
case
|
|
1401
|
-
return
|
|
1398
|
+
case CreateFolder$1:
|
|
1399
|
+
return mkdir(operation.path);
|
|
1402
1400
|
case Remove:
|
|
1403
1401
|
return remove(operation.path);
|
|
1402
|
+
case Rename$2:
|
|
1403
|
+
return rename$1(operation.from || '', operation.path);
|
|
1404
1404
|
default:
|
|
1405
1405
|
return writeFile(operation.path, operation.text);
|
|
1406
1406
|
}
|
|
@@ -1473,9 +1473,9 @@ const createTree = (items, root) => {
|
|
|
1473
1473
|
});
|
|
1474
1474
|
for (const item of items) {
|
|
1475
1475
|
const {
|
|
1476
|
-
type,
|
|
1477
1476
|
name,
|
|
1478
|
-
path
|
|
1477
|
+
path,
|
|
1478
|
+
type
|
|
1479
1479
|
} = item;
|
|
1480
1480
|
const relativePath = path.slice(rootLength);
|
|
1481
1481
|
const dirname = dirname2(relativePath);
|
|
@@ -1506,8 +1506,8 @@ const getFileOperationsNestedPath = (path, root, pathSeparator) => {
|
|
|
1506
1506
|
if (!part) continue;
|
|
1507
1507
|
currentPath = join2(currentPath, part);
|
|
1508
1508
|
operations.push({
|
|
1509
|
-
|
|
1510
|
-
|
|
1509
|
+
path: join2(root, currentPath),
|
|
1510
|
+
type: CreateFolder$1
|
|
1511
1511
|
});
|
|
1512
1512
|
}
|
|
1513
1513
|
return operations;
|
|
@@ -1518,14 +1518,14 @@ const getFileOperationsCreate = (newFileName, newDirentType, pathSeparator, abso
|
|
|
1518
1518
|
operations.push(...getFileOperationsNestedPath(parentPath, root, pathSeparator));
|
|
1519
1519
|
if (newDirentType === File) {
|
|
1520
1520
|
operations.push({
|
|
1521
|
-
type: CreateFile$1,
|
|
1522
1521
|
path: absolutePath,
|
|
1523
|
-
text: ''
|
|
1522
|
+
text: '',
|
|
1523
|
+
type: CreateFile$1
|
|
1524
1524
|
});
|
|
1525
1525
|
} else if (newDirentType === Directory) {
|
|
1526
1526
|
operations.push({
|
|
1527
|
-
|
|
1528
|
-
|
|
1527
|
+
path: absolutePath,
|
|
1528
|
+
type: CreateFolder$1
|
|
1529
1529
|
});
|
|
1530
1530
|
}
|
|
1531
1531
|
return operations;
|
|
@@ -1555,11 +1555,11 @@ const getPathParts = (root, uri, pathSeparator) => {
|
|
|
1555
1555
|
while ((index = uri.indexOf(pathSeparator, index + 1)) !== -1) {
|
|
1556
1556
|
const partUri = uri.slice(0, index);
|
|
1557
1557
|
parts.push({
|
|
1558
|
-
path: partUri,
|
|
1559
1558
|
depth: depth++,
|
|
1560
|
-
|
|
1559
|
+
expanded: true,
|
|
1560
|
+
path: partUri,
|
|
1561
1561
|
pathSeparator,
|
|
1562
|
-
|
|
1562
|
+
root
|
|
1563
1563
|
});
|
|
1564
1564
|
}
|
|
1565
1565
|
return parts;
|
|
@@ -1577,10 +1577,10 @@ const ENOENT = 'ENOENT';
|
|
|
1577
1577
|
|
|
1578
1578
|
const getSymlinkType = type => {
|
|
1579
1579
|
switch (type) {
|
|
1580
|
-
case File:
|
|
1581
|
-
return SymLinkFile;
|
|
1582
1580
|
case Directory:
|
|
1583
1581
|
return SymLinkFolder;
|
|
1582
|
+
case File:
|
|
1583
|
+
return SymLinkFile;
|
|
1584
1584
|
default:
|
|
1585
1585
|
return Symlink;
|
|
1586
1586
|
}
|
|
@@ -1645,11 +1645,11 @@ const compareStringNumeric = (a, b) => {
|
|
|
1645
1645
|
|
|
1646
1646
|
const priorityMapFoldersFirst = {
|
|
1647
1647
|
[Directory]: 1,
|
|
1648
|
-
[SymLinkFolder]: 1,
|
|
1649
1648
|
[File]: 0,
|
|
1649
|
+
[Socket]: 0,
|
|
1650
1650
|
[SymLinkFile]: 0,
|
|
1651
|
-
[
|
|
1652
|
-
[
|
|
1651
|
+
[SymLinkFolder]: 1,
|
|
1652
|
+
[Unknown]: 0
|
|
1653
1653
|
};
|
|
1654
1654
|
const compareDirentType = (direntA, direntB) => {
|
|
1655
1655
|
return priorityMapFoldersFirst[direntB.type] - priorityMapFoldersFirst[direntA.type];
|
|
@@ -1669,15 +1669,15 @@ const sortExplorerItems = rawDirents => {
|
|
|
1669
1669
|
const toDisplayDirent = (parentPath, parentDepth, rawDirentType, rawDirentName, index, length) => {
|
|
1670
1670
|
const path = join2(parentPath, rawDirentName);
|
|
1671
1671
|
return {
|
|
1672
|
-
name: rawDirentName,
|
|
1673
|
-
posInSet: index + 1,
|
|
1674
|
-
setSize: length,
|
|
1675
1672
|
depth: parentDepth + 1,
|
|
1676
|
-
|
|
1673
|
+
icon: '',
|
|
1674
|
+
name: rawDirentName,
|
|
1677
1675
|
path,
|
|
1678
1676
|
// TODO storing absolute path might be too costly, could also store relative path here
|
|
1679
|
-
|
|
1680
|
-
selected: false
|
|
1677
|
+
posInSet: index + 1,
|
|
1678
|
+
selected: false,
|
|
1679
|
+
setSize: length,
|
|
1680
|
+
type: rawDirentType
|
|
1681
1681
|
};
|
|
1682
1682
|
};
|
|
1683
1683
|
|
|
@@ -1794,12 +1794,12 @@ const treeToArrayInternal = (map, root, items, path, depth) => {
|
|
|
1794
1794
|
const absolutePath = join2(root, childPath);
|
|
1795
1795
|
items.push({
|
|
1796
1796
|
depth,
|
|
1797
|
-
posInSet: i + 1,
|
|
1798
|
-
setSize: count,
|
|
1799
1797
|
icon: '',
|
|
1798
|
+
name: child.name,
|
|
1800
1799
|
path: absolutePath,
|
|
1800
|
+
posInSet: i + 1,
|
|
1801
1801
|
selected: false,
|
|
1802
|
-
|
|
1802
|
+
setSize: count,
|
|
1803
1803
|
type: child.type
|
|
1804
1804
|
});
|
|
1805
1805
|
treeToArrayInternal(map, root, items, childPath, depth + 1);
|
|
@@ -1952,10 +1952,10 @@ const validateFileName2 = (name, siblingFileNames = []) => {
|
|
|
1952
1952
|
const acceptCreate = async (state, newDirentType) => {
|
|
1953
1953
|
const {
|
|
1954
1954
|
editingValue,
|
|
1955
|
-
pathSeparator,
|
|
1956
|
-
root,
|
|
1957
1955
|
focusedIndex,
|
|
1958
|
-
items
|
|
1956
|
+
items,
|
|
1957
|
+
pathSeparator,
|
|
1958
|
+
root
|
|
1959
1959
|
} = state;
|
|
1960
1960
|
const newFileName = editingValue;
|
|
1961
1961
|
const siblingFileNames = getSiblingFileNames(items, focusedIndex);
|
|
@@ -1987,11 +1987,11 @@ const acceptCreate = async (state, newDirentType) => {
|
|
|
1987
1987
|
await refreshWorkspace();
|
|
1988
1988
|
return {
|
|
1989
1989
|
...state,
|
|
1990
|
-
items: dirents,
|
|
1991
1990
|
editingIndex: -1,
|
|
1992
|
-
focusedIndex: newFocusedIndex,
|
|
1993
1991
|
editingType: None$5,
|
|
1994
|
-
focus: List
|
|
1992
|
+
focus: List,
|
|
1993
|
+
focusedIndex: newFocusedIndex,
|
|
1994
|
+
items: dirents
|
|
1995
1995
|
};
|
|
1996
1996
|
};
|
|
1997
1997
|
|
|
@@ -2026,9 +2026,9 @@ const getFileOperationsRename = (oldAbsolutePath, newFileName) => {
|
|
|
2026
2026
|
const oldParentPath = dirname2(oldAbsolutePath);
|
|
2027
2027
|
const newAbsolutePath = join2(oldParentPath, newFileName);
|
|
2028
2028
|
operations.push({
|
|
2029
|
-
|
|
2029
|
+
from: oldAbsolutePath,
|
|
2030
2030
|
path: newAbsolutePath,
|
|
2031
|
-
|
|
2031
|
+
type: Rename$2
|
|
2032
2032
|
});
|
|
2033
2033
|
return operations;
|
|
2034
2034
|
};
|
|
@@ -2075,16 +2075,16 @@ const acceptRename = async state => {
|
|
|
2075
2075
|
const newFocusedIndex = getIndex(newDirents, newUri);
|
|
2076
2076
|
return {
|
|
2077
2077
|
...state,
|
|
2078
|
+
editingIcon: '',
|
|
2078
2079
|
editingIndex: -1,
|
|
2079
|
-
|
|
2080
|
+
editingSelectionEnd: 0,
|
|
2081
|
+
editingSelectionStart: 0,
|
|
2080
2082
|
editingType: None$5,
|
|
2081
|
-
|
|
2082
|
-
focusedIndex: newFocusedIndex,
|
|
2083
|
-
focused: true,
|
|
2083
|
+
editingValue: '',
|
|
2084
2084
|
focus: List,
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2085
|
+
focused: true,
|
|
2086
|
+
focusedIndex: newFocusedIndex,
|
|
2087
|
+
items: newDirents
|
|
2088
2088
|
};
|
|
2089
2089
|
};
|
|
2090
2090
|
|
|
@@ -2122,14 +2122,14 @@ const cancelEditCreate = async (state, keepFocus) => {
|
|
|
2122
2122
|
const newFocusedIndex = getFocusedIndexCancel(items, editingIndex);
|
|
2123
2123
|
return {
|
|
2124
2124
|
...state,
|
|
2125
|
-
items: filteredItems,
|
|
2126
|
-
focusedIndex: newFocusedIndex,
|
|
2127
|
-
focused: keepFocus,
|
|
2128
|
-
editingIndex: -1,
|
|
2129
|
-
editingValue: '',
|
|
2130
2125
|
editingErrorMessage: '',
|
|
2126
|
+
editingIndex: -1,
|
|
2131
2127
|
editingType: None$5,
|
|
2132
|
-
|
|
2128
|
+
editingValue: '',
|
|
2129
|
+
focus: List,
|
|
2130
|
+
focused: keepFocus,
|
|
2131
|
+
focusedIndex: newFocusedIndex,
|
|
2132
|
+
items: filteredItems
|
|
2133
2133
|
};
|
|
2134
2134
|
};
|
|
2135
2135
|
|
|
@@ -2159,16 +2159,16 @@ const cancelEditRename = (state, keepFocus) => {
|
|
|
2159
2159
|
const newFocusedIndex = getFocusedIndexCancel(items, editingIndex);
|
|
2160
2160
|
return {
|
|
2161
2161
|
...state,
|
|
2162
|
-
|
|
2163
|
-
focusedIndex: newFocusedIndex,
|
|
2164
|
-
focused: keepFocus,
|
|
2162
|
+
editingErrorMessage: '',
|
|
2165
2163
|
editingIndex: -1,
|
|
2166
|
-
|
|
2164
|
+
editingSelectionEnd: 0,
|
|
2165
|
+
editingSelectionStart: 0,
|
|
2167
2166
|
editingType: None$5,
|
|
2168
|
-
|
|
2167
|
+
editingValue: '',
|
|
2169
2168
|
focus: List,
|
|
2170
|
-
|
|
2171
|
-
|
|
2169
|
+
focused: keepFocus,
|
|
2170
|
+
focusedIndex: newFocusedIndex,
|
|
2171
|
+
items: newItems
|
|
2172
2172
|
};
|
|
2173
2173
|
};
|
|
2174
2174
|
|
|
@@ -2217,8 +2217,8 @@ const collapseAll = async state => {
|
|
|
2217
2217
|
const getFocusedDirent$1 = state => {
|
|
2218
2218
|
const {
|
|
2219
2219
|
focusedIndex,
|
|
2220
|
-
|
|
2221
|
-
|
|
2220
|
+
items,
|
|
2221
|
+
minLineY
|
|
2222
2222
|
} = state;
|
|
2223
2223
|
const dirent = items[focusedIndex + minLineY];
|
|
2224
2224
|
return dirent;
|
|
@@ -2290,9 +2290,9 @@ const getMissingDirents = (dirents, fileIconCache) => {
|
|
|
2290
2290
|
};
|
|
2291
2291
|
const toIconRequest = dirent => {
|
|
2292
2292
|
return {
|
|
2293
|
-
type: dirent.type,
|
|
2294
2293
|
name: dirent.name,
|
|
2295
|
-
path: dirent.path
|
|
2294
|
+
path: dirent.path,
|
|
2295
|
+
type: dirent.type
|
|
2296
2296
|
};
|
|
2297
2297
|
};
|
|
2298
2298
|
const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
@@ -2405,8 +2405,8 @@ const getExpandedType = type => {
|
|
|
2405
2405
|
switch (type) {
|
|
2406
2406
|
case Directory:
|
|
2407
2407
|
return Collapsed;
|
|
2408
|
-
case DirectoryExpanding:
|
|
2409
2408
|
case DirectoryExpanded:
|
|
2409
|
+
case DirectoryExpanding:
|
|
2410
2410
|
return Expanded;
|
|
2411
2411
|
default:
|
|
2412
2412
|
return None$3;
|
|
@@ -2542,21 +2542,21 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
|
|
|
2542
2542
|
}
|
|
2543
2543
|
visible.push({
|
|
2544
2544
|
...item,
|
|
2545
|
-
posInSet: item.posInSet ?? i + 1,
|
|
2546
|
-
setSize: item.setSize ?? items.length,
|
|
2547
|
-
isEditing: isEditing,
|
|
2548
|
-
hasEditingError: isEditing && Boolean(editingErrorMessage),
|
|
2549
|
-
icon,
|
|
2550
|
-
indent,
|
|
2551
2545
|
ariaExpanded,
|
|
2552
2546
|
chevron,
|
|
2553
|
-
id,
|
|
2554
2547
|
className,
|
|
2548
|
+
// @ts-ignore
|
|
2549
|
+
decoration,
|
|
2550
|
+
hasEditingError: isEditing && Boolean(editingErrorMessage),
|
|
2551
|
+
icon,
|
|
2552
|
+
id,
|
|
2553
|
+
indent,
|
|
2554
|
+
index: i,
|
|
2555
2555
|
isCut,
|
|
2556
|
+
isEditing: isEditing,
|
|
2556
2557
|
isIgnored,
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
decoration
|
|
2558
|
+
posInSet: item.posInSet ?? i + 1,
|
|
2559
|
+
setSize: item.setSize ?? items.length
|
|
2560
2560
|
});
|
|
2561
2561
|
}
|
|
2562
2562
|
return visible;
|
|
@@ -2564,9 +2564,9 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
|
|
|
2564
2564
|
|
|
2565
2565
|
const {
|
|
2566
2566
|
get,
|
|
2567
|
-
set,
|
|
2568
|
-
registerCommands,
|
|
2569
2567
|
getCommandIds,
|
|
2568
|
+
registerCommands,
|
|
2569
|
+
set,
|
|
2570
2570
|
wrapGetter
|
|
2571
2571
|
} = create$1();
|
|
2572
2572
|
const wrapListItemCommand = fn => {
|
|
@@ -2576,20 +2576,20 @@ const wrapListItemCommand = fn => {
|
|
|
2576
2576
|
} = get(id);
|
|
2577
2577
|
const updatedState = await fn(newState, ...args);
|
|
2578
2578
|
const {
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
focusedIndex,
|
|
2582
|
-
editingIndex,
|
|
2583
|
-
editingErrorMessage,
|
|
2584
|
-
useChevrons,
|
|
2579
|
+
cutItems,
|
|
2580
|
+
decorations,
|
|
2585
2581
|
dropTargets,
|
|
2582
|
+
editingErrorMessage,
|
|
2586
2583
|
editingIcon,
|
|
2587
|
-
|
|
2588
|
-
|
|
2584
|
+
editingIndex,
|
|
2585
|
+
fileIconCache,
|
|
2586
|
+
focusedIndex,
|
|
2589
2587
|
height,
|
|
2590
2588
|
itemHeight,
|
|
2591
|
-
|
|
2592
|
-
|
|
2589
|
+
items,
|
|
2590
|
+
minLineY,
|
|
2591
|
+
sourceControlIgnoredUris,
|
|
2592
|
+
useChevrons
|
|
2593
2593
|
} = updatedState;
|
|
2594
2594
|
const intermediate = get(id);
|
|
2595
2595
|
set(id, intermediate.oldState, updatedState);
|
|
@@ -2605,10 +2605,10 @@ const wrapListItemCommand = fn => {
|
|
|
2605
2605
|
const visibleExplorerItems = getVisibleExplorerItems(items, minLineY, maxLineY, focusedIndex, editingIndex, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems, sourceControlIgnoredUris, decorations);
|
|
2606
2606
|
const finalState = {
|
|
2607
2607
|
...updatedState,
|
|
2608
|
-
visibleExplorerItems,
|
|
2609
2608
|
fileIconCache: newFileIconCache,
|
|
2610
2609
|
icons,
|
|
2611
|
-
maxLineY
|
|
2610
|
+
maxLineY,
|
|
2611
|
+
visibleExplorerItems
|
|
2612
2612
|
};
|
|
2613
2613
|
const intermediate2 = get(id);
|
|
2614
2614
|
set(id, intermediate2.oldState, finalState);
|
|
@@ -2623,58 +2623,58 @@ const Slash = '/';
|
|
|
2623
2623
|
// TODO parentUid might ot be needed
|
|
2624
2624
|
const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) => {
|
|
2625
2625
|
const state = {
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
focusedIndex: -1,
|
|
2631
|
-
focused: false,
|
|
2632
|
-
hoverIndex: -1,
|
|
2633
|
-
x,
|
|
2634
|
-
y,
|
|
2635
|
-
width,
|
|
2636
|
-
height,
|
|
2626
|
+
confirmDelete: false,
|
|
2627
|
+
confirmPaste: false,
|
|
2628
|
+
cutItems: [],
|
|
2629
|
+
decorations: [],
|
|
2637
2630
|
deltaY: 0,
|
|
2638
|
-
minLineY: 0,
|
|
2639
|
-
maxLineY: 0,
|
|
2640
|
-
pathSeparator: Slash,
|
|
2641
|
-
version: 0,
|
|
2642
|
-
editingIndex: -1,
|
|
2643
|
-
itemHeight: ListItem,
|
|
2644
2631
|
dropTargets: [],
|
|
2645
|
-
|
|
2646
|
-
editingValue: '',
|
|
2647
|
-
editingType: None$5,
|
|
2632
|
+
editingErrorMessage: '',
|
|
2648
2633
|
editingIcon: '',
|
|
2634
|
+
editingIndex: -1,
|
|
2635
|
+
editingSelectionEnd: 0,
|
|
2636
|
+
editingSelectionStart: 0,
|
|
2637
|
+
editingType: None$5,
|
|
2638
|
+
editingValue: '',
|
|
2639
|
+
errorMessageLeft: 0,
|
|
2640
|
+
errorMessageTop: 0,
|
|
2641
|
+
errorMessageWidth: 0,
|
|
2642
|
+
excluded: [],
|
|
2649
2643
|
fileIconCache: Object.create(null),
|
|
2650
|
-
|
|
2651
|
-
confirmDelete: false,
|
|
2652
|
-
icons: [],
|
|
2653
|
-
platform,
|
|
2644
|
+
finalDeltaY: 0,
|
|
2654
2645
|
focus: 0,
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
editingSelectionStart: 0,
|
|
2658
|
-
editingSelectionEnd: 0,
|
|
2646
|
+
focused: false,
|
|
2647
|
+
focusedIndex: -1,
|
|
2659
2648
|
focusWord: '',
|
|
2660
2649
|
focusWordTimeout: 800,
|
|
2661
|
-
finalDeltaY: 0,
|
|
2662
2650
|
handleOffset: 0,
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
cutItems: [],
|
|
2651
|
+
height,
|
|
2652
|
+
hoverIndex: -1,
|
|
2653
|
+
icons: [],
|
|
2654
|
+
inputSource: 0,
|
|
2668
2655
|
isPointerDown: false,
|
|
2656
|
+
itemHeight: ListItem,
|
|
2657
|
+
items: [],
|
|
2658
|
+
maxIndent: 0,
|
|
2659
|
+
maxLineY: 0,
|
|
2660
|
+
minLineY: 0,
|
|
2661
|
+
parentUid,
|
|
2662
|
+
pasteShouldMove: false,
|
|
2663
|
+
pathSeparator: Slash,
|
|
2664
|
+
platform,
|
|
2669
2665
|
pointerDownIndex: -1,
|
|
2666
|
+
root: '',
|
|
2667
|
+
scrollBarActive: false,
|
|
2668
|
+
scrollBarHeight: 0,
|
|
2669
|
+
sourceControlDecorations: false,
|
|
2670
2670
|
sourceControlIgnoredUris: [],
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2671
|
+
uid: id,
|
|
2672
|
+
useChevrons: false,
|
|
2673
|
+
version: 0,
|
|
2674
2674
|
visibleExplorerItems: [],
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2675
|
+
width,
|
|
2676
|
+
x,
|
|
2677
|
+
y
|
|
2678
2678
|
};
|
|
2679
2679
|
set(state.uid, state, state);
|
|
2680
2680
|
return state;
|
|
@@ -2739,8 +2739,8 @@ const diff = (oldState, newState) => {
|
|
|
2739
2739
|
|
|
2740
2740
|
const diff2 = uid => {
|
|
2741
2741
|
const {
|
|
2742
|
-
|
|
2743
|
-
|
|
2742
|
+
newState,
|
|
2743
|
+
oldState
|
|
2744
2744
|
} = get(uid);
|
|
2745
2745
|
const result = diff(oldState, newState);
|
|
2746
2746
|
return result;
|
|
@@ -2748,8 +2748,8 @@ const diff2 = uid => {
|
|
|
2748
2748
|
|
|
2749
2749
|
const expandAll = async state => {
|
|
2750
2750
|
const {
|
|
2751
|
-
items,
|
|
2752
2751
|
focusedIndex,
|
|
2752
|
+
items,
|
|
2753
2753
|
pathSeparator
|
|
2754
2754
|
} = state;
|
|
2755
2755
|
if (focusedIndex === -1) {
|
|
@@ -2800,11 +2800,9 @@ const makeExpanded = dirent => {
|
|
|
2800
2800
|
// TODO this is very inefficient
|
|
2801
2801
|
const getChildDirentsRecursively = async (dirent, pathSeparator) => {
|
|
2802
2802
|
switch (dirent.type) {
|
|
2803
|
-
case File:
|
|
2804
|
-
return [dirent];
|
|
2805
2803
|
case Directory:
|
|
2806
|
-
case DirectoryExpanding:
|
|
2807
2804
|
case DirectoryExpanded:
|
|
2805
|
+
case DirectoryExpanding:
|
|
2808
2806
|
const childDirents = await getChildDirents(pathSeparator, dirent.path, dirent.depth);
|
|
2809
2807
|
const all = [makeExpanded(dirent)];
|
|
2810
2808
|
for (const childDirent of childDirents) {
|
|
@@ -2812,6 +2810,8 @@ const getChildDirentsRecursively = async (dirent, pathSeparator) => {
|
|
|
2812
2810
|
all.push(...childAll);
|
|
2813
2811
|
}
|
|
2814
2812
|
return all;
|
|
2813
|
+
case File:
|
|
2814
|
+
return [dirent];
|
|
2815
2815
|
default:
|
|
2816
2816
|
return [];
|
|
2817
2817
|
}
|
|
@@ -2831,15 +2831,15 @@ const getParentEndIndex = (dirents, index) => {
|
|
|
2831
2831
|
|
|
2832
2832
|
const expandRecursively = async state => {
|
|
2833
2833
|
const {
|
|
2834
|
-
items,
|
|
2835
2834
|
focusedIndex,
|
|
2835
|
+
items,
|
|
2836
2836
|
pathSeparator,
|
|
2837
2837
|
root
|
|
2838
2838
|
} = state;
|
|
2839
2839
|
const dirent = focusedIndex < 0 ? {
|
|
2840
|
-
|
|
2840
|
+
depth: 0,
|
|
2841
2841
|
path: root,
|
|
2842
|
-
|
|
2842
|
+
type: Directory
|
|
2843
2843
|
} : items[focusedIndex];
|
|
2844
2844
|
if (dirent.type !== Directory && dirent.type !== DirectoryExpanding && dirent.type !== DirectoryExpanded) {
|
|
2845
2845
|
return state;
|
|
@@ -2877,9 +2877,9 @@ const focus = state => {
|
|
|
2877
2877
|
|
|
2878
2878
|
const focusIndex = (state, index) => {
|
|
2879
2879
|
const {
|
|
2880
|
-
|
|
2880
|
+
items,
|
|
2881
2881
|
maxLineY,
|
|
2882
|
-
|
|
2882
|
+
minLineY
|
|
2883
2883
|
} = state;
|
|
2884
2884
|
const newItems = items.map((item, i) => ({
|
|
2885
2885
|
...item,
|
|
@@ -2889,37 +2889,37 @@ const focusIndex = (state, index) => {
|
|
|
2889
2889
|
if (index < 0) {
|
|
2890
2890
|
return {
|
|
2891
2891
|
...state,
|
|
2892
|
-
|
|
2892
|
+
focused: true,
|
|
2893
2893
|
focusedIndex: index,
|
|
2894
|
-
|
|
2894
|
+
items: newItems
|
|
2895
2895
|
};
|
|
2896
2896
|
}
|
|
2897
2897
|
const diff = maxLineY - minLineY;
|
|
2898
2898
|
return {
|
|
2899
2899
|
...state,
|
|
2900
|
-
items: newItems,
|
|
2901
|
-
focusedIndex: index,
|
|
2902
2900
|
focused: true,
|
|
2903
|
-
|
|
2904
|
-
|
|
2901
|
+
focusedIndex: index,
|
|
2902
|
+
items: newItems,
|
|
2903
|
+
maxLineY: index + diff,
|
|
2904
|
+
minLineY: index
|
|
2905
2905
|
};
|
|
2906
2906
|
}
|
|
2907
2907
|
if (index >= maxLineY) {
|
|
2908
2908
|
const diff = maxLineY - minLineY;
|
|
2909
2909
|
return {
|
|
2910
2910
|
...state,
|
|
2911
|
-
items: newItems,
|
|
2912
|
-
focusedIndex: index,
|
|
2913
2911
|
focused: true,
|
|
2914
|
-
|
|
2915
|
-
|
|
2912
|
+
focusedIndex: index,
|
|
2913
|
+
items: newItems,
|
|
2914
|
+
maxLineY: index + 1,
|
|
2915
|
+
minLineY: index + 1 - diff
|
|
2916
2916
|
};
|
|
2917
2917
|
}
|
|
2918
2918
|
return {
|
|
2919
2919
|
...state,
|
|
2920
|
-
|
|
2920
|
+
focused: true,
|
|
2921
2921
|
focusedIndex: index,
|
|
2922
|
-
|
|
2922
|
+
items: newItems
|
|
2923
2923
|
};
|
|
2924
2924
|
};
|
|
2925
2925
|
|
|
@@ -2998,96 +2998,96 @@ const focusPrevious = state => {
|
|
|
2998
2998
|
|
|
2999
2999
|
const getKeyBindings = () => {
|
|
3000
3000
|
return [{
|
|
3001
|
-
key: Shift | UpArrow,
|
|
3002
3001
|
command: 'Explorer.selectUp',
|
|
3002
|
+
key: Shift | UpArrow,
|
|
3003
3003
|
when: FocusExplorer
|
|
3004
3004
|
}, {
|
|
3005
|
-
key: Shift | DownArrow,
|
|
3006
3005
|
command: 'Explorer.selectDown',
|
|
3006
|
+
key: Shift | DownArrow,
|
|
3007
3007
|
when: FocusExplorer
|
|
3008
3008
|
}, {
|
|
3009
|
-
key: RightArrow,
|
|
3010
3009
|
command: 'Explorer.handleArrowRight',
|
|
3010
|
+
key: RightArrow,
|
|
3011
3011
|
when: FocusExplorer
|
|
3012
3012
|
}, {
|
|
3013
|
-
key: LeftArrow,
|
|
3014
3013
|
command: 'Explorer.handleArrowLeft',
|
|
3014
|
+
key: LeftArrow,
|
|
3015
3015
|
when: FocusExplorer
|
|
3016
3016
|
}, {
|
|
3017
|
-
key: Home,
|
|
3018
3017
|
command: 'Explorer.focusFirst',
|
|
3018
|
+
key: Home,
|
|
3019
3019
|
when: FocusExplorer
|
|
3020
3020
|
}, {
|
|
3021
|
-
key: End,
|
|
3022
3021
|
command: 'Explorer.focusLast',
|
|
3022
|
+
key: End,
|
|
3023
3023
|
when: FocusExplorer
|
|
3024
3024
|
}, {
|
|
3025
|
-
key: UpArrow,
|
|
3026
3025
|
command: 'Explorer.focusPrevious',
|
|
3026
|
+
key: UpArrow,
|
|
3027
3027
|
when: FocusExplorer
|
|
3028
3028
|
}, {
|
|
3029
|
-
key: DownArrow,
|
|
3030
3029
|
command: 'Explorer.focusNext',
|
|
3030
|
+
key: DownArrow,
|
|
3031
3031
|
when: FocusExplorer
|
|
3032
3032
|
}, {
|
|
3033
|
-
key: CtrlCmd | Star,
|
|
3034
3033
|
command: 'Explorer.expandAll',
|
|
3034
|
+
key: CtrlCmd | Star,
|
|
3035
3035
|
when: FocusExplorer
|
|
3036
3036
|
}, {
|
|
3037
|
-
key: Alt | RightArrow,
|
|
3038
3037
|
command: 'Explorer.expandRecursively',
|
|
3038
|
+
key: Alt | RightArrow,
|
|
3039
3039
|
when: FocusExplorer
|
|
3040
3040
|
}, {
|
|
3041
|
-
key: CtrlCmd | LeftArrow,
|
|
3042
3041
|
command: 'Explorer.collapseAll',
|
|
3042
|
+
key: CtrlCmd | LeftArrow,
|
|
3043
3043
|
when: FocusExplorer
|
|
3044
3044
|
}, {
|
|
3045
|
-
key: CtrlCmd | KeyV,
|
|
3046
3045
|
command: 'Explorer.handlePaste',
|
|
3046
|
+
key: CtrlCmd | KeyV,
|
|
3047
3047
|
when: FocusExplorer
|
|
3048
3048
|
}, {
|
|
3049
|
-
key: CtrlCmd | KeyC,
|
|
3050
3049
|
command: 'Explorer.handleCopy',
|
|
3050
|
+
key: CtrlCmd | KeyC,
|
|
3051
3051
|
when: FocusExplorer
|
|
3052
3052
|
}, {
|
|
3053
|
-
key: CtrlCmd | KeyX,
|
|
3054
3053
|
command: 'Explorer.handleCut',
|
|
3054
|
+
key: CtrlCmd | KeyX,
|
|
3055
3055
|
when: FocusExplorer
|
|
3056
3056
|
}, {
|
|
3057
|
-
key: F2,
|
|
3058
3057
|
command: 'Explorer.renameDirent',
|
|
3058
|
+
key: F2,
|
|
3059
3059
|
when: FocusExplorer
|
|
3060
3060
|
}, {
|
|
3061
|
-
key: Escape,
|
|
3062
3061
|
command: 'Explorer.cancelEdit',
|
|
3062
|
+
key: Escape,
|
|
3063
3063
|
when: FocusExplorerEditBox
|
|
3064
3064
|
}, {
|
|
3065
|
-
key: Enter,
|
|
3066
3065
|
command: 'Explorer.acceptEdit',
|
|
3066
|
+
key: Enter,
|
|
3067
3067
|
when: FocusExplorerEditBox
|
|
3068
3068
|
}, {
|
|
3069
|
-
key: Delete$1,
|
|
3070
3069
|
command: 'Explorer.removeDirent',
|
|
3070
|
+
key: Delete$1,
|
|
3071
3071
|
when: FocusExplorer
|
|
3072
3072
|
}, {
|
|
3073
|
-
key: Escape,
|
|
3074
3073
|
command: 'Explorer.focusNone',
|
|
3074
|
+
key: Escape,
|
|
3075
3075
|
when: FocusExplorer
|
|
3076
3076
|
}, {
|
|
3077
|
-
key: Space,
|
|
3078
3077
|
command: 'Explorer.handleClickCurrentButKeepFocus',
|
|
3078
|
+
key: Space,
|
|
3079
3079
|
when: FocusExplorer
|
|
3080
3080
|
}, {
|
|
3081
|
-
key: Enter,
|
|
3082
3081
|
command: 'Explorer.handleClickCurrent',
|
|
3082
|
+
key: Enter,
|
|
3083
3083
|
when: FocusExplorer
|
|
3084
3084
|
}, {
|
|
3085
|
-
key: Escape,
|
|
3086
3085
|
command: 'Explorer.handleEscape',
|
|
3086
|
+
key: Escape,
|
|
3087
3087
|
when: FocusExplorer
|
|
3088
3088
|
}, {
|
|
3089
|
-
key: CtrlCmd | KeyA,
|
|
3090
3089
|
command: 'Explorer.selectAll',
|
|
3090
|
+
key: CtrlCmd | KeyA,
|
|
3091
3091
|
when: FocusExplorer
|
|
3092
3092
|
}];
|
|
3093
3093
|
};
|
|
@@ -3097,77 +3097,77 @@ const None$2 = 0;
|
|
|
3097
3097
|
const RestoreFocus = 6;
|
|
3098
3098
|
|
|
3099
3099
|
const menuEntrySeparator = {
|
|
3100
|
-
|
|
3101
|
-
label: '',
|
|
3100
|
+
command: '',
|
|
3102
3101
|
flags: Separator,
|
|
3103
|
-
|
|
3102
|
+
id: 'separator',
|
|
3103
|
+
label: ''
|
|
3104
3104
|
};
|
|
3105
3105
|
|
|
3106
3106
|
const menuEntryNewFile = {
|
|
3107
|
-
|
|
3108
|
-
label: newFile$1(),
|
|
3107
|
+
command: 'Explorer.newFile',
|
|
3109
3108
|
flags: None$2,
|
|
3110
|
-
|
|
3109
|
+
id: 'newFile',
|
|
3110
|
+
label: newFile$1()
|
|
3111
3111
|
};
|
|
3112
3112
|
const menuEntryNewFolder = {
|
|
3113
|
-
|
|
3114
|
-
label: newFolder$1(),
|
|
3113
|
+
command: 'Explorer.newFolder',
|
|
3115
3114
|
flags: None$2,
|
|
3116
|
-
|
|
3115
|
+
id: 'newFolder',
|
|
3116
|
+
label: newFolder$1()
|
|
3117
3117
|
};
|
|
3118
3118
|
const menuEntryOpenContainingFolder = {
|
|
3119
|
-
|
|
3120
|
-
label: openContainingFolder$1(),
|
|
3119
|
+
command: 'Explorer.openContainingFolder',
|
|
3121
3120
|
flags: RestoreFocus,
|
|
3122
|
-
|
|
3121
|
+
id: 'openContainingFolder',
|
|
3122
|
+
label: openContainingFolder$1()
|
|
3123
3123
|
};
|
|
3124
3124
|
const menuEntryOpenInIntegratedTerminal = {
|
|
3125
|
-
|
|
3126
|
-
label: openInIntegratedTerminal(),
|
|
3125
|
+
command: /* TODO */'-1',
|
|
3127
3126
|
flags: None$2,
|
|
3128
|
-
|
|
3127
|
+
id: 'openInIntegratedTerminal',
|
|
3128
|
+
label: openInIntegratedTerminal()
|
|
3129
3129
|
};
|
|
3130
3130
|
const menuEntryCut = {
|
|
3131
|
-
|
|
3132
|
-
label: cut(),
|
|
3131
|
+
command: 'Explorer.handleCut',
|
|
3133
3132
|
flags: RestoreFocus,
|
|
3134
|
-
|
|
3133
|
+
id: 'cut',
|
|
3134
|
+
label: cut()
|
|
3135
3135
|
};
|
|
3136
3136
|
const menuEntryCopy = {
|
|
3137
|
-
|
|
3138
|
-
label: copy(),
|
|
3137
|
+
command: 'Explorer.handleCopy',
|
|
3139
3138
|
flags: RestoreFocus,
|
|
3140
|
-
|
|
3139
|
+
id: 'copy',
|
|
3140
|
+
label: copy()
|
|
3141
3141
|
};
|
|
3142
3142
|
const menuEntryPaste = {
|
|
3143
|
-
|
|
3144
|
-
label: paste(),
|
|
3143
|
+
command: 'Explorer.handlePaste',
|
|
3145
3144
|
flags: None$2,
|
|
3146
|
-
|
|
3145
|
+
id: 'paste',
|
|
3146
|
+
label: paste()
|
|
3147
3147
|
};
|
|
3148
3148
|
const menuEntryCopyPath = {
|
|
3149
|
-
|
|
3150
|
-
label: copyPath$1(),
|
|
3149
|
+
command: 'Explorer.copyPath',
|
|
3151
3150
|
flags: RestoreFocus,
|
|
3152
|
-
|
|
3151
|
+
id: 'copyPath',
|
|
3152
|
+
label: copyPath$1()
|
|
3153
3153
|
};
|
|
3154
3154
|
const menuEntryCopyRelativePath = {
|
|
3155
|
-
|
|
3156
|
-
label: copyRelativePath$1(),
|
|
3155
|
+
command: 'Explorer.copyRelativePath',
|
|
3157
3156
|
flags: RestoreFocus,
|
|
3158
|
-
|
|
3157
|
+
id: 'copyRelativePath',
|
|
3158
|
+
label: copyRelativePath$1()
|
|
3159
3159
|
};
|
|
3160
3160
|
const menuEntryRename = {
|
|
3161
|
-
|
|
3162
|
-
label: rename(),
|
|
3161
|
+
command: 'Explorer.renameDirent',
|
|
3163
3162
|
flags: None$2,
|
|
3164
|
-
|
|
3163
|
+
id: 'rename',
|
|
3164
|
+
label: rename()
|
|
3165
3165
|
};
|
|
3166
3166
|
const menuEntryDelete = {
|
|
3167
|
-
|
|
3168
|
-
label: deleteItem(),
|
|
3167
|
+
command: 'Explorer.removeDirent',
|
|
3169
3168
|
flags: None$2,
|
|
3170
|
-
|
|
3169
|
+
id: 'delete',
|
|
3170
|
+
label: deleteItem()
|
|
3171
3171
|
};
|
|
3172
3172
|
const ALL_ENTRIES = [menuEntryNewFile, menuEntryNewFolder, menuEntryOpenContainingFolder, menuEntryOpenInIntegratedTerminal, menuEntrySeparator, menuEntryCut, menuEntryCopy, menuEntryPaste, menuEntrySeparator, menuEntryCopyPath, menuEntryCopyRelativePath, menuEntrySeparator, menuEntryRename, menuEntryDelete];
|
|
3173
3173
|
|
|
@@ -3216,26 +3216,26 @@ const LeftClick = 0;
|
|
|
3216
3216
|
|
|
3217
3217
|
const getMouseActions = () => {
|
|
3218
3218
|
return [{
|
|
3219
|
-
description: 'Open file on click',
|
|
3220
3219
|
button: LeftClick,
|
|
3221
|
-
modifiers: {},
|
|
3222
3220
|
command: 'Explorer.openFile',
|
|
3221
|
+
description: 'Open file on click',
|
|
3222
|
+
modifiers: {},
|
|
3223
3223
|
when: FocusExplorer
|
|
3224
3224
|
}, {
|
|
3225
|
-
description: 'Toggle selection with Ctrl+Click',
|
|
3226
3225
|
button: LeftClick,
|
|
3226
|
+
command: 'Explorer.toggleSelection',
|
|
3227
|
+
description: 'Toggle selection with Ctrl+Click',
|
|
3227
3228
|
modifiers: {
|
|
3228
3229
|
ctrl: true
|
|
3229
3230
|
},
|
|
3230
|
-
command: 'Explorer.toggleSelection',
|
|
3231
3231
|
when: FocusExplorer
|
|
3232
3232
|
}, {
|
|
3233
|
-
description: 'Select range with Shift+Click',
|
|
3234
3233
|
button: LeftClick,
|
|
3234
|
+
command: 'Explorer.rangeSelection',
|
|
3235
|
+
description: 'Select range with Shift+Click',
|
|
3235
3236
|
modifiers: {
|
|
3236
3237
|
shift: true
|
|
3237
3238
|
},
|
|
3238
|
-
command: 'Explorer.rangeSelection',
|
|
3239
3239
|
when: FocusExplorer
|
|
3240
3240
|
}];
|
|
3241
3241
|
};
|
|
@@ -3259,10 +3259,10 @@ const focusParentFolder = state => {
|
|
|
3259
3259
|
|
|
3260
3260
|
const handleClickDirectoryExpanded = async (state, dirent, index, keepFocus) => {
|
|
3261
3261
|
const {
|
|
3262
|
-
minLineY,
|
|
3263
|
-
maxLineY,
|
|
3264
3262
|
itemHeight,
|
|
3265
|
-
items
|
|
3263
|
+
items,
|
|
3264
|
+
maxLineY,
|
|
3265
|
+
minLineY
|
|
3266
3266
|
} = state;
|
|
3267
3267
|
// @ts-ignore
|
|
3268
3268
|
dirent.type = Directory;
|
|
@@ -3299,8 +3299,8 @@ const handleClickDirectoryExpanded = async (state, dirent, index, keepFocus) =>
|
|
|
3299
3299
|
|
|
3300
3300
|
const handleArrowLeft = state => {
|
|
3301
3301
|
const {
|
|
3302
|
-
|
|
3303
|
-
|
|
3302
|
+
focusedIndex,
|
|
3303
|
+
items
|
|
3304
3304
|
} = state;
|
|
3305
3305
|
if (focusedIndex === -1) {
|
|
3306
3306
|
return state;
|
|
@@ -3321,8 +3321,8 @@ const handleArrowLeft = state => {
|
|
|
3321
3321
|
|
|
3322
3322
|
const handleArrowRightDirectoryExpanded = (state, dirent) => {
|
|
3323
3323
|
const {
|
|
3324
|
-
|
|
3325
|
-
|
|
3324
|
+
focusedIndex,
|
|
3325
|
+
items
|
|
3326
3326
|
} = state;
|
|
3327
3327
|
if (focusedIndex === items.length - 1) {
|
|
3328
3328
|
return state;
|
|
@@ -3359,10 +3359,10 @@ const handleClickDirectory = async (state, dirent, index, keepFocus) => {
|
|
|
3359
3359
|
|
|
3360
3360
|
return {
|
|
3361
3361
|
...state,
|
|
3362
|
+
focus: List,
|
|
3362
3363
|
focused: keepFocus,
|
|
3363
3364
|
focusedIndex: newIndex,
|
|
3364
|
-
items: newDirents
|
|
3365
|
-
focus: List
|
|
3365
|
+
items: newDirents
|
|
3366
3366
|
};
|
|
3367
3367
|
};
|
|
3368
3368
|
|
|
@@ -3374,8 +3374,8 @@ const handleClickFile = async (state, dirent, index, keepFocus = false) => {
|
|
|
3374
3374
|
await openUri(dirent.path, !keepFocus);
|
|
3375
3375
|
return {
|
|
3376
3376
|
...state,
|
|
3377
|
-
|
|
3378
|
-
|
|
3377
|
+
focused: keepFocus,
|
|
3378
|
+
focusedIndex: index
|
|
3379
3379
|
};
|
|
3380
3380
|
};
|
|
3381
3381
|
|
|
@@ -3392,23 +3392,23 @@ const handleClickSymLink = async (state, dirent, index) => {
|
|
|
3392
3392
|
|
|
3393
3393
|
const handleArrowRight = async state => {
|
|
3394
3394
|
const {
|
|
3395
|
-
|
|
3396
|
-
|
|
3395
|
+
focusedIndex,
|
|
3396
|
+
items
|
|
3397
3397
|
} = state;
|
|
3398
3398
|
if (focusedIndex === -1) {
|
|
3399
3399
|
return state;
|
|
3400
3400
|
}
|
|
3401
3401
|
const dirent = items[focusedIndex];
|
|
3402
3402
|
switch (dirent.type) {
|
|
3403
|
-
case File:
|
|
3404
|
-
case SymLinkFile:
|
|
3405
|
-
return state;
|
|
3406
3403
|
case Directory:
|
|
3407
3404
|
case SymLinkFolder:
|
|
3408
3405
|
// @ts-ignore
|
|
3409
3406
|
return handleClickDirectory(state, dirent);
|
|
3410
3407
|
case DirectoryExpanded:
|
|
3411
3408
|
return handleArrowRightDirectoryExpanded(state, dirent);
|
|
3409
|
+
case File:
|
|
3410
|
+
case SymLinkFile:
|
|
3411
|
+
return state;
|
|
3412
3412
|
case Symlink:
|
|
3413
3413
|
return handleClickSymLink(state, dirent, focusedIndex);
|
|
3414
3414
|
default:
|
|
@@ -3449,8 +3449,8 @@ const handleClickDirectoryExpanding = async (state, dirent, index, keepFocus) =>
|
|
|
3449
3449
|
dirent.icon = '';
|
|
3450
3450
|
return {
|
|
3451
3451
|
...state,
|
|
3452
|
-
|
|
3453
|
-
|
|
3452
|
+
focused: keepFocus,
|
|
3453
|
+
focusedIndex: index
|
|
3454
3454
|
};
|
|
3455
3455
|
};
|
|
3456
3456
|
|
|
@@ -3473,16 +3473,16 @@ const handleClickDirectoryExpanding = async (state, dirent, index, keepFocus) =>
|
|
|
3473
3473
|
|
|
3474
3474
|
const getClickFn = direntType => {
|
|
3475
3475
|
switch (direntType) {
|
|
3476
|
-
case File:
|
|
3477
|
-
case SymLinkFile:
|
|
3478
|
-
return handleClickFile;
|
|
3479
3476
|
case Directory:
|
|
3480
3477
|
case SymLinkFolder:
|
|
3481
3478
|
return handleClickDirectory;
|
|
3482
|
-
case DirectoryExpanding:
|
|
3483
|
-
return handleClickDirectoryExpanding;
|
|
3484
3479
|
case DirectoryExpanded:
|
|
3485
3480
|
return handleClickDirectoryExpanded;
|
|
3481
|
+
case DirectoryExpanding:
|
|
3482
|
+
return handleClickDirectoryExpanding;
|
|
3483
|
+
case File:
|
|
3484
|
+
case SymLinkFile:
|
|
3485
|
+
return handleClickFile;
|
|
3486
3486
|
case Symlink:
|
|
3487
3487
|
return handleClickSymLink;
|
|
3488
3488
|
case CharacterDevice:
|
|
@@ -3497,15 +3497,15 @@ const getClickFn = direntType => {
|
|
|
3497
3497
|
};
|
|
3498
3498
|
|
|
3499
3499
|
const resetEditing = {
|
|
3500
|
-
editingIndex: -1,
|
|
3501
|
-
editingValue: '',
|
|
3502
|
-
editingType: None$5,
|
|
3503
|
-
editingIcon: '',
|
|
3504
3500
|
editingErrorMessage: '',
|
|
3501
|
+
editingIcon: '',
|
|
3502
|
+
editingIndex: -1,
|
|
3505
3503
|
editingSelection: {
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
}
|
|
3504
|
+
end: 0,
|
|
3505
|
+
start: 0
|
|
3506
|
+
},
|
|
3507
|
+
editingType: None$5,
|
|
3508
|
+
editingValue: ''
|
|
3509
3509
|
};
|
|
3510
3510
|
|
|
3511
3511
|
// TODO viewlet should only have create and refresh functions
|
|
@@ -3558,9 +3558,9 @@ const handleClick = async (state, index, keepFocus = false) => {
|
|
|
3558
3558
|
|
|
3559
3559
|
const getIndexFromPosition = (state, eventX, eventY) => {
|
|
3560
3560
|
const {
|
|
3561
|
-
y,
|
|
3562
3561
|
itemHeight,
|
|
3563
|
-
items
|
|
3562
|
+
items,
|
|
3563
|
+
y
|
|
3564
3564
|
} = state;
|
|
3565
3565
|
const index = Math.floor((eventY - y) / itemHeight);
|
|
3566
3566
|
if (index < 0) {
|
|
@@ -3682,8 +3682,8 @@ const handleContextMenuAtIndex = async (state, index, x, y) => {
|
|
|
3682
3682
|
} = state;
|
|
3683
3683
|
const newState = {
|
|
3684
3684
|
...state,
|
|
3685
|
-
|
|
3686
|
-
|
|
3685
|
+
focused: false,
|
|
3686
|
+
focusedIndex: index
|
|
3687
3687
|
};
|
|
3688
3688
|
set(uid, state, newState);
|
|
3689
3689
|
await show2(uid, Explorer, x, y, {
|
|
@@ -3695,10 +3695,10 @@ const handleContextMenuAtIndex = async (state, index, x, y) => {
|
|
|
3695
3695
|
const handleContextMenuKeyboard = async state => {
|
|
3696
3696
|
const {
|
|
3697
3697
|
focusedIndex,
|
|
3698
|
-
|
|
3699
|
-
y,
|
|
3698
|
+
itemHeight,
|
|
3700
3699
|
minLineY,
|
|
3701
|
-
|
|
3700
|
+
x,
|
|
3701
|
+
y
|
|
3702
3702
|
} = state;
|
|
3703
3703
|
const menuX = x;
|
|
3704
3704
|
const menuY = y + (focusedIndex - minLineY + 1) * itemHeight;
|
|
@@ -3755,8 +3755,8 @@ const handleCut = async state => {
|
|
|
3755
3755
|
// TODO handle multiple files
|
|
3756
3756
|
// TODO if not file is selected, what happens?
|
|
3757
3757
|
const {
|
|
3758
|
-
|
|
3759
|
-
|
|
3758
|
+
focusedIndex,
|
|
3759
|
+
items
|
|
3760
3760
|
} = state;
|
|
3761
3761
|
const dirents = getSelectedItems(items, focusedIndex);
|
|
3762
3762
|
if (dirents.length === 0) {
|
|
@@ -3766,8 +3766,8 @@ const handleCut = async state => {
|
|
|
3766
3766
|
await writeNativeFiles('cut', files);
|
|
3767
3767
|
return {
|
|
3768
3768
|
...state,
|
|
3769
|
-
|
|
3770
|
-
|
|
3769
|
+
cutItems: files,
|
|
3770
|
+
pasteShouldMove: true
|
|
3771
3771
|
};
|
|
3772
3772
|
};
|
|
3773
3773
|
|
|
@@ -3894,14 +3894,14 @@ const getProtoMapInternal = (root, pathToDirents, expandedPaths, depth) => {
|
|
|
3894
3894
|
const item = items[i];
|
|
3895
3895
|
const path = join2(root, item.name);
|
|
3896
3896
|
const displayDirent = {
|
|
3897
|
+
depth,
|
|
3898
|
+
icon: '',
|
|
3897
3899
|
name: item.name,
|
|
3900
|
+
path,
|
|
3898
3901
|
posInSet: i + 1,
|
|
3902
|
+
selected: false,
|
|
3899
3903
|
setSize: items.length,
|
|
3900
|
-
|
|
3901
|
-
type: restoreDirentType(item.type, path, expandedPaths),
|
|
3902
|
-
path,
|
|
3903
|
-
icon: '',
|
|
3904
|
-
selected: false
|
|
3904
|
+
type: restoreDirentType(item.type, path, expandedPaths)
|
|
3905
3905
|
};
|
|
3906
3906
|
const children = getProtoMapInternal(path, pathToDirents, expandedPaths, depth + 1);
|
|
3907
3907
|
protoMap.push(displayDirent, ...children);
|
|
@@ -3924,9 +3924,9 @@ const sortPathDirentsMap = map => {
|
|
|
3924
3924
|
|
|
3925
3925
|
const refresh = async state => {
|
|
3926
3926
|
const {
|
|
3927
|
-
root,
|
|
3928
3927
|
focusedIndex,
|
|
3929
|
-
items
|
|
3928
|
+
items,
|
|
3929
|
+
root
|
|
3930
3930
|
} = state;
|
|
3931
3931
|
const expandedDirents = getExpandedDirents(items);
|
|
3932
3932
|
const expandedPaths = getPaths(expandedDirents);
|
|
@@ -3992,15 +3992,15 @@ const getFileOperations = (root, uploadTree) => {
|
|
|
3992
3992
|
const fullPath = currentPath ? join2(currentPath, path) : path;
|
|
3993
3993
|
if (typeof value === 'object') {
|
|
3994
3994
|
operations.push({
|
|
3995
|
-
|
|
3996
|
-
|
|
3995
|
+
path: join2(root, fullPath),
|
|
3996
|
+
type: CreateFolder$1
|
|
3997
3997
|
});
|
|
3998
3998
|
processTree(value, fullPath);
|
|
3999
3999
|
} else if (typeof value === 'string') {
|
|
4000
4000
|
operations.push({
|
|
4001
|
-
type: CreateFile$1,
|
|
4002
4001
|
path: join2(root, fullPath),
|
|
4003
|
-
text: value
|
|
4002
|
+
text: value,
|
|
4003
|
+
type: CreateFile$1
|
|
4004
4004
|
});
|
|
4005
4005
|
}
|
|
4006
4006
|
}
|
|
@@ -4032,9 +4032,9 @@ const getMergedDirents$2 = async (root, pathSeparator, dirents) => {
|
|
|
4032
4032
|
};
|
|
4033
4033
|
const handleDrop$2 = async (state, fileHandles, files) => {
|
|
4034
4034
|
const {
|
|
4035
|
-
|
|
4035
|
+
items,
|
|
4036
4036
|
pathSeparator,
|
|
4037
|
-
|
|
4037
|
+
root
|
|
4038
4038
|
} = state;
|
|
4039
4039
|
const handled = await uploadFileSystemHandles(root, pathSeparator, fileHandles);
|
|
4040
4040
|
if (handled) {
|
|
@@ -4047,8 +4047,8 @@ const handleDrop$2 = async (state, fileHandles, files) => {
|
|
|
4047
4047
|
const mergedDirents = await getMergedDirents$2(root, pathSeparator, items);
|
|
4048
4048
|
return {
|
|
4049
4049
|
...state,
|
|
4050
|
-
|
|
4051
|
-
|
|
4050
|
+
dropTargets: [],
|
|
4051
|
+
items: mergedDirents
|
|
4052
4052
|
};
|
|
4053
4053
|
};
|
|
4054
4054
|
|
|
@@ -4061,9 +4061,9 @@ const getFileOperationsElectron = async (root, paths, fileHandles, pathSeparator
|
|
|
4061
4061
|
} = fileHandle;
|
|
4062
4062
|
const path = paths[i];
|
|
4063
4063
|
operations.push({
|
|
4064
|
-
|
|
4064
|
+
from: path,
|
|
4065
4065
|
path: join(pathSeparator, root, name),
|
|
4066
|
-
|
|
4066
|
+
type: Copy$1
|
|
4067
4067
|
});
|
|
4068
4068
|
}
|
|
4069
4069
|
return operations;
|
|
@@ -4086,16 +4086,16 @@ const getMergedDirents$1 = async (root, pathSeparator, dirents) => {
|
|
|
4086
4086
|
};
|
|
4087
4087
|
const handleDrop$1 = async (state, fileHandles, files, paths) => {
|
|
4088
4088
|
const {
|
|
4089
|
-
|
|
4089
|
+
items,
|
|
4090
4090
|
pathSeparator,
|
|
4091
|
-
|
|
4091
|
+
root
|
|
4092
4092
|
} = state;
|
|
4093
4093
|
await copyFilesElectron(root, fileHandles, files, paths);
|
|
4094
4094
|
const mergedDirents = await getMergedDirents$1(root, pathSeparator, items);
|
|
4095
4095
|
return {
|
|
4096
4096
|
...state,
|
|
4097
|
-
|
|
4098
|
-
|
|
4097
|
+
dropTargets: [],
|
|
4098
|
+
items: mergedDirents
|
|
4099
4099
|
};
|
|
4100
4100
|
};
|
|
4101
4101
|
|
|
@@ -4132,8 +4132,8 @@ const getMergedDirents = (items, index, dirent, childDirents) => {
|
|
|
4132
4132
|
};
|
|
4133
4133
|
const handleDropIntoFolder = async (state, dirent, index, fileHandles, files, paths) => {
|
|
4134
4134
|
const {
|
|
4135
|
-
|
|
4136
|
-
|
|
4135
|
+
items,
|
|
4136
|
+
pathSeparator
|
|
4137
4137
|
} = state;
|
|
4138
4138
|
// @ts-ignore
|
|
4139
4139
|
for (const file of fileHandles) {
|
|
@@ -4148,8 +4148,8 @@ const handleDropIntoFolder = async (state, dirent, index, fileHandles, files, pa
|
|
|
4148
4148
|
// TODO update maxlineY
|
|
4149
4149
|
return {
|
|
4150
4150
|
...state,
|
|
4151
|
-
|
|
4152
|
-
|
|
4151
|
+
dropTargets: [],
|
|
4152
|
+
items: mergedDirents
|
|
4153
4153
|
};
|
|
4154
4154
|
};
|
|
4155
4155
|
const handleDropIntoFile = (state, dirent, index, fileHandles, files, paths) => {
|
|
@@ -4248,8 +4248,8 @@ const handleFocus = async state => {
|
|
|
4248
4248
|
const updateIcons = async state => {
|
|
4249
4249
|
const {
|
|
4250
4250
|
items,
|
|
4251
|
-
|
|
4252
|
-
|
|
4251
|
+
maxLineY,
|
|
4252
|
+
minLineY
|
|
4253
4253
|
} = state;
|
|
4254
4254
|
const visible = items.slice(minLineY, maxLineY);
|
|
4255
4255
|
const {
|
|
@@ -4258,8 +4258,8 @@ const updateIcons = async state => {
|
|
|
4258
4258
|
} = await getFileIcons(visible, Object.create(null));
|
|
4259
4259
|
return {
|
|
4260
4260
|
...state,
|
|
4261
|
-
|
|
4262
|
-
|
|
4261
|
+
fileIconCache: newFileIconCache,
|
|
4262
|
+
icons
|
|
4263
4263
|
};
|
|
4264
4264
|
};
|
|
4265
4265
|
|
|
@@ -4317,10 +4317,10 @@ const isAscii = key => {
|
|
|
4317
4317
|
let timeout;
|
|
4318
4318
|
const handleKeyDown = (state, key) => {
|
|
4319
4319
|
const {
|
|
4320
|
-
focusWord,
|
|
4321
|
-
items,
|
|
4322
4320
|
focusedIndex,
|
|
4323
|
-
|
|
4321
|
+
focusWord,
|
|
4322
|
+
focusWordTimeout,
|
|
4323
|
+
items
|
|
4324
4324
|
} = state;
|
|
4325
4325
|
if (focusWord && key === '') {
|
|
4326
4326
|
return cancelTypeAhead(state);
|
|
@@ -4347,8 +4347,8 @@ const handleKeyDown = (state, key) => {
|
|
|
4347
4347
|
}
|
|
4348
4348
|
return {
|
|
4349
4349
|
...state,
|
|
4350
|
-
|
|
4351
|
-
|
|
4350
|
+
focusedIndex: matchingIndex,
|
|
4351
|
+
focusWord: newFocusWord
|
|
4352
4352
|
};
|
|
4353
4353
|
};
|
|
4354
4354
|
|
|
@@ -4358,40 +4358,40 @@ const scrollInto = (index, minLineY, maxLineY) => {
|
|
|
4358
4358
|
const largerHalf = diff - smallerHalf;
|
|
4359
4359
|
if (index < minLineY) {
|
|
4360
4360
|
return {
|
|
4361
|
-
|
|
4362
|
-
|
|
4361
|
+
newMaxLineY: index + largerHalf,
|
|
4362
|
+
newMinLineY: index - smallerHalf
|
|
4363
4363
|
};
|
|
4364
4364
|
}
|
|
4365
4365
|
if (index >= maxLineY) {
|
|
4366
4366
|
return {
|
|
4367
|
-
|
|
4368
|
-
|
|
4367
|
+
newMaxLineY: index + largerHalf,
|
|
4368
|
+
newMinLineY: index - smallerHalf
|
|
4369
4369
|
};
|
|
4370
4370
|
}
|
|
4371
4371
|
return {
|
|
4372
|
-
|
|
4373
|
-
|
|
4372
|
+
newMaxLineY: maxLineY,
|
|
4373
|
+
newMinLineY: minLineY
|
|
4374
4374
|
};
|
|
4375
4375
|
};
|
|
4376
4376
|
|
|
4377
4377
|
const adjustScrollAfterPaste = (state, focusedIndex) => {
|
|
4378
4378
|
const {
|
|
4379
|
-
|
|
4379
|
+
itemHeight,
|
|
4380
4380
|
maxLineY,
|
|
4381
|
-
|
|
4381
|
+
minLineY
|
|
4382
4382
|
} = state;
|
|
4383
4383
|
const {
|
|
4384
|
-
|
|
4385
|
-
|
|
4384
|
+
newMaxLineY,
|
|
4385
|
+
newMinLineY
|
|
4386
4386
|
} = scrollInto(focusedIndex, minLineY, maxLineY);
|
|
4387
4387
|
const newDeltaY = newMinLineY * itemHeight;
|
|
4388
4388
|
return {
|
|
4389
4389
|
...state,
|
|
4390
|
-
|
|
4390
|
+
deltaY: newDeltaY,
|
|
4391
4391
|
focused: true,
|
|
4392
|
-
|
|
4392
|
+
focusedIndex,
|
|
4393
4393
|
maxLineY: newMaxLineY,
|
|
4394
|
-
|
|
4394
|
+
minLineY: newMinLineY
|
|
4395
4395
|
};
|
|
4396
4396
|
};
|
|
4397
4397
|
|
|
@@ -4440,18 +4440,18 @@ const getFileOperationsCopy = (root, existingUris, files, focusedUri) => {
|
|
|
4440
4440
|
const baseName = getBaseName('/', file);
|
|
4441
4441
|
if (existingUris.includes(file)) {
|
|
4442
4442
|
operations.push({
|
|
4443
|
-
type: Rename$2,
|
|
4444
4443
|
from: file,
|
|
4445
|
-
path: join2(focusedUri, baseName)
|
|
4444
|
+
path: join2(focusedUri, baseName),
|
|
4445
|
+
type: Rename$2
|
|
4446
4446
|
});
|
|
4447
4447
|
} else {
|
|
4448
4448
|
const uniqueName = generateUniqueName(baseName, existingUris, root);
|
|
4449
4449
|
const newUri = join2(root, uniqueName);
|
|
4450
4450
|
operations.push({
|
|
4451
|
-
type: Copy$1,
|
|
4452
4451
|
from: file,
|
|
4453
4452
|
// TODO ensure file is uri
|
|
4454
|
-
path: newUri
|
|
4453
|
+
path: newUri,
|
|
4454
|
+
type: Copy$1
|
|
4455
4455
|
});
|
|
4456
4456
|
}
|
|
4457
4457
|
}
|
|
@@ -4467,9 +4467,9 @@ const handlePasteCopy = async (state, nativeFiles) => {
|
|
|
4467
4467
|
|
|
4468
4468
|
// TODO use file operations and bulk edit
|
|
4469
4469
|
const {
|
|
4470
|
+
focusedIndex,
|
|
4470
4471
|
items,
|
|
4471
|
-
root
|
|
4472
|
-
focusedIndex
|
|
4472
|
+
root
|
|
4473
4473
|
} = state;
|
|
4474
4474
|
const focusedUri = items[focusedIndex]?.path || root;
|
|
4475
4475
|
const existingUris = items.map(item => item.path);
|
|
@@ -4514,9 +4514,9 @@ const getOperations = (toUri, files) => {
|
|
|
4514
4514
|
const baseName = getBaseName('/', file);
|
|
4515
4515
|
const newUri = join2(toUri, baseName);
|
|
4516
4516
|
operations.push({
|
|
4517
|
-
type: Rename$2,
|
|
4518
4517
|
from: file,
|
|
4519
|
-
path: newUri
|
|
4518
|
+
path: newUri,
|
|
4519
|
+
type: Rename$2
|
|
4520
4520
|
});
|
|
4521
4521
|
}
|
|
4522
4522
|
return operations;
|
|
@@ -4529,10 +4529,10 @@ const getTargetUri = (root, items, index) => {
|
|
|
4529
4529
|
};
|
|
4530
4530
|
const handlePasteCut = async (state, nativeFiles) => {
|
|
4531
4531
|
const {
|
|
4532
|
-
|
|
4533
|
-
pathSeparator,
|
|
4532
|
+
focusedIndex,
|
|
4534
4533
|
items,
|
|
4535
|
-
|
|
4534
|
+
pathSeparator,
|
|
4535
|
+
root
|
|
4536
4536
|
} = state;
|
|
4537
4537
|
// TODO root is not necessrily target uri
|
|
4538
4538
|
const targetUri = getTargetUri(root, items, focusedIndex);
|
|
@@ -4551,15 +4551,15 @@ const handlePasteCut = async (state, nativeFiles) => {
|
|
|
4551
4551
|
const adjustedState = adjustScrollAfterPaste(latestState, pastedFileIndex);
|
|
4552
4552
|
return {
|
|
4553
4553
|
...adjustedState,
|
|
4554
|
-
|
|
4555
|
-
|
|
4554
|
+
cutItems: [],
|
|
4555
|
+
pasteShouldMove: false
|
|
4556
4556
|
};
|
|
4557
4557
|
}
|
|
4558
4558
|
}
|
|
4559
4559
|
return {
|
|
4560
4560
|
...latestState,
|
|
4561
|
-
|
|
4562
|
-
|
|
4561
|
+
cutItems: [],
|
|
4562
|
+
pasteShouldMove: false
|
|
4563
4563
|
};
|
|
4564
4564
|
};
|
|
4565
4565
|
|
|
@@ -4600,9 +4600,9 @@ const handlePointerDown = (state, button, x, y) => {
|
|
|
4600
4600
|
if (button === LeftClick && index === -1) {
|
|
4601
4601
|
return {
|
|
4602
4602
|
...state,
|
|
4603
|
+
focus: List,
|
|
4603
4604
|
focused: true,
|
|
4604
|
-
focusedIndex: -1
|
|
4605
|
-
focus: List
|
|
4605
|
+
focusedIndex: -1
|
|
4606
4606
|
};
|
|
4607
4607
|
}
|
|
4608
4608
|
return state;
|
|
@@ -4610,8 +4610,8 @@ const handlePointerDown = (state, button, x, y) => {
|
|
|
4610
4610
|
|
|
4611
4611
|
const handleUpload = async (state, dirents) => {
|
|
4612
4612
|
const {
|
|
4613
|
-
|
|
4614
|
-
|
|
4613
|
+
pathSeparator,
|
|
4614
|
+
root
|
|
4615
4615
|
} = state;
|
|
4616
4616
|
for (const dirent of dirents) {
|
|
4617
4617
|
// TODO switch
|
|
@@ -4629,8 +4629,8 @@ const handleUpload = async (state, dirents) => {
|
|
|
4629
4629
|
|
|
4630
4630
|
const setDeltaY = async (state, deltaY) => {
|
|
4631
4631
|
const {
|
|
4632
|
-
itemHeight,
|
|
4633
4632
|
height,
|
|
4633
|
+
itemHeight,
|
|
4634
4634
|
items
|
|
4635
4635
|
} = state;
|
|
4636
4636
|
if (deltaY < 0) {
|
|
@@ -4711,10 +4711,10 @@ const getSettings = async () => {
|
|
|
4711
4711
|
const sourceControlDecorationsRaw = await invoke$2('Preferences.get', 'explorer.sourceControlDecorations');
|
|
4712
4712
|
const sourceControlDecorations = sourceControlDecorationsRaw === false ? false : true;
|
|
4713
4713
|
return {
|
|
4714
|
-
useChevrons,
|
|
4715
4714
|
confirmDelete,
|
|
4716
4715
|
confirmPaste,
|
|
4717
|
-
sourceControlDecorations
|
|
4716
|
+
sourceControlDecorations,
|
|
4717
|
+
useChevrons
|
|
4718
4718
|
};
|
|
4719
4719
|
};
|
|
4720
4720
|
|
|
@@ -4744,22 +4744,22 @@ const getSavedChildDirents = (map, path, depth, excluded, pathSeparator) => {
|
|
|
4744
4744
|
if ((child.type === Directory || child.type === SymLinkFolder) && childPath in map) {
|
|
4745
4745
|
dirents.push({
|
|
4746
4746
|
depth,
|
|
4747
|
-
posInSet: i + 1,
|
|
4748
|
-
setSize: visibleLength,
|
|
4749
4747
|
icon: '',
|
|
4750
4748
|
name,
|
|
4751
4749
|
path: childPath,
|
|
4750
|
+
posInSet: i + 1,
|
|
4751
|
+
setSize: visibleLength,
|
|
4752
4752
|
type: DirectoryExpanded
|
|
4753
4753
|
});
|
|
4754
4754
|
dirents.push(...getSavedChildDirents(map, childPath, depth + 1, excluded, pathSeparator));
|
|
4755
4755
|
} else {
|
|
4756
4756
|
dirents.push({
|
|
4757
4757
|
depth,
|
|
4758
|
-
posInSet: i + 1,
|
|
4759
|
-
setSize: visibleLength,
|
|
4760
4758
|
icon: '',
|
|
4761
4759
|
name,
|
|
4762
4760
|
path: childPath,
|
|
4761
|
+
posInSet: i + 1,
|
|
4762
|
+
setSize: visibleLength,
|
|
4763
4763
|
type
|
|
4764
4764
|
});
|
|
4765
4765
|
}
|
|
@@ -4829,9 +4829,9 @@ const getSavedRoot = (savedState, workspacePath) => {
|
|
|
4829
4829
|
};
|
|
4830
4830
|
const loadContent = async (state, savedState) => {
|
|
4831
4831
|
const {
|
|
4832
|
-
useChevrons,
|
|
4833
4832
|
confirmDelete,
|
|
4834
|
-
sourceControlDecorations
|
|
4833
|
+
sourceControlDecorations,
|
|
4834
|
+
useChevrons
|
|
4835
4835
|
} = await getSettings();
|
|
4836
4836
|
const workspacePath = await getWorkspacePath();
|
|
4837
4837
|
const root = getSavedRoot(savedState, workspacePath);
|
|
@@ -4955,14 +4955,14 @@ const getNewChildDirentsForNewDirent = async (items, depth, parentPath, direntTy
|
|
|
4955
4955
|
if (existingChildren.length === 0) {
|
|
4956
4956
|
const childDirents = await readDirWithFileTypes(parentPath);
|
|
4957
4957
|
existingChildren = childDirents.map((dirent, index) => ({
|
|
4958
|
+
depth,
|
|
4959
|
+
icon: '',
|
|
4958
4960
|
name: dirent.name,
|
|
4959
|
-
type: dirent.type,
|
|
4960
4961
|
path: join2(parentPath, dirent.name),
|
|
4961
|
-
depth,
|
|
4962
|
-
selected: false,
|
|
4963
4962
|
posInSet: index + 1,
|
|
4963
|
+
selected: false,
|
|
4964
4964
|
setSize: childDirents.length,
|
|
4965
|
-
|
|
4965
|
+
type: dirent.type
|
|
4966
4966
|
}));
|
|
4967
4967
|
}
|
|
4968
4968
|
const updatedChildren = existingChildren.map((child, index) => ({
|
|
@@ -4971,14 +4971,14 @@ const getNewChildDirentsForNewDirent = async (items, depth, parentPath, direntTy
|
|
|
4971
4971
|
setSize: existingChildren.length + 2
|
|
4972
4972
|
}));
|
|
4973
4973
|
const newDirent = {
|
|
4974
|
+
depth,
|
|
4975
|
+
icon: '',
|
|
4974
4976
|
name: '',
|
|
4975
|
-
type: direntType,
|
|
4976
4977
|
path: parentPath,
|
|
4977
|
-
depth,
|
|
4978
|
-
selected: false,
|
|
4979
4978
|
posInSet: updatedChildren.length + 1,
|
|
4979
|
+
selected: false,
|
|
4980
4980
|
setSize: existingChildren.length + 2,
|
|
4981
|
-
|
|
4981
|
+
type: direntType
|
|
4982
4982
|
};
|
|
4983
4983
|
const allChildDirents = [...updatedChildren, newDirent];
|
|
4984
4984
|
return allChildDirents;
|
|
@@ -4987,14 +4987,14 @@ const getNewChildDirentsForNewDirent = async (items, depth, parentPath, direntTy
|
|
|
4987
4987
|
const getNewDirentsForNewDirent = async (items, focusedIndex, type, root) => {
|
|
4988
4988
|
if (items.length === 0 || focusedIndex === -1) {
|
|
4989
4989
|
const newDirent = {
|
|
4990
|
+
depth: 0,
|
|
4991
|
+
icon: '',
|
|
4990
4992
|
name: '',
|
|
4991
|
-
type,
|
|
4992
4993
|
path: root,
|
|
4993
|
-
depth: 0,
|
|
4994
|
-
selected: false,
|
|
4995
4994
|
posInSet: 1,
|
|
4995
|
+
selected: false,
|
|
4996
4996
|
setSize: 1,
|
|
4997
|
-
|
|
4997
|
+
type
|
|
4998
4998
|
};
|
|
4999
4999
|
return [...items, newDirent];
|
|
5000
5000
|
}
|
|
@@ -5043,9 +5043,9 @@ const getFittingIndex = (dirents, startIndex) => {
|
|
|
5043
5043
|
const newDirent = async (state, editingType) => {
|
|
5044
5044
|
// TODO do it like vscode, select position between folders and files
|
|
5045
5045
|
const {
|
|
5046
|
-
root,
|
|
5047
5046
|
focusedIndex,
|
|
5048
|
-
items
|
|
5047
|
+
items,
|
|
5048
|
+
root
|
|
5049
5049
|
} = state;
|
|
5050
5050
|
const index = getFittingIndex(items, focusedIndex);
|
|
5051
5051
|
const direntType = getNewDirentType(editingType);
|
|
@@ -5089,8 +5089,9 @@ const openNativeFolder = async path => {
|
|
|
5089
5089
|
const openContainingFolder = async state => {
|
|
5090
5090
|
const {
|
|
5091
5091
|
focusedIndex,
|
|
5092
|
-
|
|
5093
|
-
|
|
5092
|
+
items,
|
|
5093
|
+
root
|
|
5094
|
+
} = state;
|
|
5094
5095
|
const path = getContainingFolder(root, items, focusedIndex);
|
|
5095
5096
|
await openNativeFolder(path);
|
|
5096
5097
|
return state;
|
|
@@ -5110,9 +5111,9 @@ const showErrorAlert = async errorMessage => {
|
|
|
5110
5111
|
|
|
5111
5112
|
const removeDirent = async state => {
|
|
5112
5113
|
const {
|
|
5113
|
-
|
|
5114
|
+
confirmDelete: confirmDelete$1,
|
|
5114
5115
|
focusedIndex,
|
|
5115
|
-
|
|
5116
|
+
items
|
|
5116
5117
|
} = state;
|
|
5117
5118
|
const selectedItems = getSelectedItems(items, focusedIndex);
|
|
5118
5119
|
if (selectedItems.length === 0) {
|
|
@@ -5127,8 +5128,8 @@ const removeDirent = async state => {
|
|
|
5127
5128
|
}
|
|
5128
5129
|
const fileOperations = toRemove.map(item => {
|
|
5129
5130
|
return {
|
|
5130
|
-
|
|
5131
|
-
|
|
5131
|
+
path: item,
|
|
5132
|
+
type: Remove
|
|
5132
5133
|
};
|
|
5133
5134
|
});
|
|
5134
5135
|
// TODO use bulk edit and explorer refresh
|
|
@@ -5140,8 +5141,8 @@ const removeDirent = async state => {
|
|
|
5140
5141
|
const newState = await refresh(state);
|
|
5141
5142
|
return {
|
|
5142
5143
|
...newState,
|
|
5143
|
-
|
|
5144
|
-
|
|
5144
|
+
focus: List,
|
|
5145
|
+
focused: true
|
|
5145
5146
|
};
|
|
5146
5147
|
};
|
|
5147
5148
|
|
|
@@ -5168,13 +5169,13 @@ const getRenameSelectionRange = name => {
|
|
|
5168
5169
|
const dotIndex = name.lastIndexOf('.');
|
|
5169
5170
|
if (dotIndex === -1) {
|
|
5170
5171
|
return {
|
|
5171
|
-
|
|
5172
|
-
|
|
5172
|
+
end: name.length,
|
|
5173
|
+
start: 0
|
|
5173
5174
|
};
|
|
5174
5175
|
}
|
|
5175
5176
|
return {
|
|
5176
|
-
|
|
5177
|
-
|
|
5177
|
+
end: dotIndex,
|
|
5178
|
+
start: 0
|
|
5178
5179
|
};
|
|
5179
5180
|
};
|
|
5180
5181
|
|
|
@@ -5184,8 +5185,8 @@ const Script = 2;
|
|
|
5184
5185
|
const renameDirent = async state => {
|
|
5185
5186
|
const {
|
|
5186
5187
|
focusedIndex,
|
|
5187
|
-
items,
|
|
5188
5188
|
icons,
|
|
5189
|
+
items,
|
|
5189
5190
|
minLineY
|
|
5190
5191
|
} = state;
|
|
5191
5192
|
if (items.length === 0) {
|
|
@@ -5194,20 +5195,20 @@ const renameDirent = async state => {
|
|
|
5194
5195
|
const item = items[focusedIndex];
|
|
5195
5196
|
const newItems = getNewDirentsForRename(items, focusedIndex);
|
|
5196
5197
|
const {
|
|
5197
|
-
|
|
5198
|
-
|
|
5198
|
+
end,
|
|
5199
|
+
start
|
|
5199
5200
|
} = getRenameSelectionRange(item.name);
|
|
5200
5201
|
return {
|
|
5201
5202
|
...state,
|
|
5202
|
-
|
|
5203
|
+
editingIcon: icons[focusedIndex - minLineY],
|
|
5203
5204
|
editingIndex: focusedIndex,
|
|
5205
|
+
editingSelectionEnd: end,
|
|
5206
|
+
editingSelectionStart: start,
|
|
5204
5207
|
editingType: Rename$1,
|
|
5205
5208
|
editingValue: item.name,
|
|
5206
|
-
editingIcon: icons[focusedIndex - minLineY],
|
|
5207
|
-
editingSelectionStart: start,
|
|
5208
|
-
editingSelectionEnd: end,
|
|
5209
5209
|
focus: Input$1,
|
|
5210
|
-
inputSource: Script
|
|
5210
|
+
inputSource: Script,
|
|
5211
|
+
items: newItems
|
|
5211
5212
|
};
|
|
5212
5213
|
};
|
|
5213
5214
|
|
|
@@ -5232,9 +5233,9 @@ const getErrorMessagePosition = (itemHeight, focusedIndex, minLineY, depth, inde
|
|
|
5232
5233
|
const left = depth * indent + fileIconWidth + padding;
|
|
5233
5234
|
const errorMessageWidth = width - left;
|
|
5234
5235
|
return {
|
|
5235
|
-
|
|
5236
|
+
errorMessageWidth,
|
|
5236
5237
|
left,
|
|
5237
|
-
|
|
5238
|
+
top
|
|
5238
5239
|
};
|
|
5239
5240
|
};
|
|
5240
5241
|
|
|
@@ -5250,14 +5251,14 @@ const getUnique = items => {
|
|
|
5250
5251
|
|
|
5251
5252
|
const renderCss = (oldState, newState) => {
|
|
5252
5253
|
const {
|
|
5253
|
-
|
|
5254
|
+
focusedIndex,
|
|
5255
|
+
itemHeight,
|
|
5254
5256
|
items,
|
|
5257
|
+
minLineY,
|
|
5255
5258
|
scrollBarHeight,
|
|
5256
5259
|
uid,
|
|
5257
5260
|
visibleExplorerItems,
|
|
5258
|
-
|
|
5259
|
-
focusedIndex,
|
|
5260
|
-
minLineY
|
|
5261
|
+
width
|
|
5261
5262
|
} = newState;
|
|
5262
5263
|
const indents = visibleExplorerItems.map(item => item.indent);
|
|
5263
5264
|
const uniqueIndents = getUnique(indents);
|
|
@@ -5268,9 +5269,9 @@ const renderCss = (oldState, newState) => {
|
|
|
5268
5269
|
const chevronSpace = 22;
|
|
5269
5270
|
const depth = items[focusedIndex]?.depth || 0;
|
|
5270
5271
|
const {
|
|
5271
|
-
|
|
5272
|
+
errorMessageWidth,
|
|
5272
5273
|
left,
|
|
5273
|
-
|
|
5274
|
+
top
|
|
5274
5275
|
} = getErrorMessagePosition(itemHeight, focusedIndex, minLineY, depth, indent, fileIconWidth, padding + defaultPaddingLeft + chevronSpace, width);
|
|
5275
5276
|
const css = getCss(scrollBarHeight, uniqueIndents, left, top, errorMessageWidth);
|
|
5276
5277
|
return [SetCss, uid, css];
|
|
@@ -5292,11 +5293,11 @@ const toUri = path => {
|
|
|
5292
5293
|
const getDragData = urls => {
|
|
5293
5294
|
const data = urls.map(toUri).join('\n');
|
|
5294
5295
|
const dragData = [{
|
|
5295
|
-
|
|
5296
|
-
|
|
5296
|
+
data,
|
|
5297
|
+
type: 'text/uri-list'
|
|
5297
5298
|
}, {
|
|
5298
|
-
|
|
5299
|
-
|
|
5299
|
+
data,
|
|
5300
|
+
type: 'text/plain'
|
|
5300
5301
|
}];
|
|
5301
5302
|
// @ts-ignore
|
|
5302
5303
|
dragData.label = getDragLabel(urls);
|
|
@@ -5305,8 +5306,8 @@ const getDragData = urls => {
|
|
|
5305
5306
|
|
|
5306
5307
|
const renderDragData = (oldState, newState) => {
|
|
5307
5308
|
const {
|
|
5308
|
-
|
|
5309
|
-
|
|
5309
|
+
focusedIndex,
|
|
5310
|
+
items
|
|
5310
5311
|
} = newState;
|
|
5311
5312
|
const selected = items.filter((item, index) => item.selected || index === focusedIndex);
|
|
5312
5313
|
const urls = selected.map(item => item.path);
|
|
@@ -5319,8 +5320,8 @@ const OpenFolder = 'OpenFolder';
|
|
|
5319
5320
|
|
|
5320
5321
|
const renderEditingSelection = (oldState, newState) => {
|
|
5321
5322
|
const {
|
|
5322
|
-
editingSelectionStart,
|
|
5323
5323
|
editingSelectionEnd,
|
|
5324
|
+
editingSelectionStart,
|
|
5324
5325
|
uid
|
|
5325
5326
|
} = newState;
|
|
5326
5327
|
return ['Viewlet.setSelectionByName', uid, ExplorerInput, editingSelectionStart, editingSelectionEnd];
|
|
@@ -5368,9 +5369,9 @@ const getErrorMessageDom = errorMessage => {
|
|
|
5368
5369
|
return [];
|
|
5369
5370
|
}
|
|
5370
5371
|
return [{
|
|
5371
|
-
|
|
5372
|
+
childCount: 1,
|
|
5372
5373
|
className: mergeClassNames(ExplorerErrorMessage),
|
|
5373
|
-
|
|
5374
|
+
type: Div
|
|
5374
5375
|
}, text(errorMessage)];
|
|
5375
5376
|
};
|
|
5376
5377
|
|
|
@@ -5391,37 +5392,37 @@ const HandleDragStart = 17;
|
|
|
5391
5392
|
|
|
5392
5393
|
const getExplorerWelcomeVirtualDom = isWide => {
|
|
5393
5394
|
return [{
|
|
5394
|
-
|
|
5395
|
+
childCount: 1,
|
|
5395
5396
|
className: mergeClassNames(Viewlet, Explorer$1),
|
|
5396
5397
|
tabIndex: 0,
|
|
5397
|
-
|
|
5398
|
+
type: Div
|
|
5398
5399
|
}, {
|
|
5399
|
-
|
|
5400
|
+
childCount: 2,
|
|
5400
5401
|
className: Welcome,
|
|
5401
|
-
|
|
5402
|
+
type: Div
|
|
5402
5403
|
}, {
|
|
5403
|
-
|
|
5404
|
+
childCount: 1,
|
|
5404
5405
|
className: WelcomeMessage,
|
|
5405
|
-
|
|
5406
|
+
type: P
|
|
5406
5407
|
}, text(youHaveNotYetOpenedAFolder()), {
|
|
5407
|
-
|
|
5408
|
+
childCount: 1,
|
|
5408
5409
|
className: mergeClassNames(Button$2, ButtonPrimary, isWide ? ButtonWide : ButtonNarrow),
|
|
5409
5410
|
name: OpenFolder,
|
|
5410
|
-
|
|
5411
|
-
|
|
5411
|
+
onClick: HandleClickOpenFolder,
|
|
5412
|
+
type: Button$1
|
|
5412
5413
|
}, text(openFolder$1())];
|
|
5413
5414
|
};
|
|
5414
5415
|
|
|
5415
5416
|
const chevronDownVirtualDom = {
|
|
5416
|
-
|
|
5417
|
+
childCount: 0,
|
|
5417
5418
|
className: mergeClassNames(Chevron, MaskIconChevronDown),
|
|
5418
|
-
|
|
5419
|
+
type: Div
|
|
5419
5420
|
};
|
|
5420
5421
|
|
|
5421
5422
|
const chevronRightVirtualDom = {
|
|
5422
|
-
|
|
5423
|
+
childCount: 0,
|
|
5423
5424
|
className: mergeClassNames(Chevron, MaskIconChevronRight),
|
|
5424
|
-
|
|
5425
|
+
type: Div
|
|
5425
5426
|
};
|
|
5426
5427
|
|
|
5427
5428
|
const chevronDomNodes = [[], [chevronRightVirtualDom], [chevronDownVirtualDom]];
|
|
@@ -5431,11 +5432,11 @@ const getChevronVirtualDom = chevronType => {
|
|
|
5431
5432
|
|
|
5432
5433
|
const getFileIconVirtualDom = icon => {
|
|
5433
5434
|
return {
|
|
5434
|
-
|
|
5435
|
+
childCount: 0,
|
|
5435
5436
|
className: FileIcon,
|
|
5436
|
-
src: icon,
|
|
5437
5437
|
role: None,
|
|
5438
|
-
|
|
5438
|
+
src: icon,
|
|
5439
|
+
type: Img
|
|
5439
5440
|
};
|
|
5440
5441
|
};
|
|
5441
5442
|
|
|
@@ -5452,11 +5453,10 @@ const getInputDom = (isEditing, hasEditingError) => {
|
|
|
5452
5453
|
}
|
|
5453
5454
|
const ariaLabel = typeAFileName();
|
|
5454
5455
|
return [{
|
|
5455
|
-
type: Input,
|
|
5456
5456
|
ariaLabel: ariaLabel,
|
|
5457
5457
|
autocapitalize: 'off',
|
|
5458
|
-
autocorrect: 'off',
|
|
5459
5458
|
autocomplete: 'off',
|
|
5459
|
+
autocorrect: 'off',
|
|
5460
5460
|
childCount: 0,
|
|
5461
5461
|
className: getInputClassName(hasEditingError),
|
|
5462
5462
|
id: 'ExplorerInput',
|
|
@@ -5464,14 +5464,15 @@ const getInputDom = (isEditing, hasEditingError) => {
|
|
|
5464
5464
|
onBlur: HandleInputBlur,
|
|
5465
5465
|
onClick: HandleInputClick,
|
|
5466
5466
|
onInput: HandleEditingInput,
|
|
5467
|
-
spellcheck: 'false'
|
|
5467
|
+
spellcheck: 'false',
|
|
5468
|
+
type: Input
|
|
5468
5469
|
}];
|
|
5469
5470
|
};
|
|
5470
5471
|
|
|
5471
5472
|
const label = {
|
|
5472
|
-
|
|
5473
|
+
childCount: 1,
|
|
5473
5474
|
className: Label,
|
|
5474
|
-
|
|
5475
|
+
type: Div
|
|
5475
5476
|
};
|
|
5476
5477
|
const getLabelDom = (isEditing, name, isDimmed) => {
|
|
5477
5478
|
if (isEditing) {
|
|
@@ -5479,9 +5480,9 @@ const getLabelDom = (isEditing, name, isDimmed) => {
|
|
|
5479
5480
|
}
|
|
5480
5481
|
if (isDimmed) {
|
|
5481
5482
|
return [{
|
|
5482
|
-
|
|
5483
|
+
childCount: 1,
|
|
5483
5484
|
className: mergeClassNames(Label, LabelCut),
|
|
5484
|
-
|
|
5485
|
+
type: Div
|
|
5485
5486
|
}, text(name)];
|
|
5486
5487
|
}
|
|
5487
5488
|
return [label, text(name)];
|
|
@@ -5496,31 +5497,31 @@ const getExplorerItemVirtualDom = item => {
|
|
|
5496
5497
|
hasEditingError,
|
|
5497
5498
|
icon,
|
|
5498
5499
|
id,
|
|
5500
|
+
index,
|
|
5501
|
+
isCut,
|
|
5499
5502
|
isEditing,
|
|
5503
|
+
isIgnored,
|
|
5500
5504
|
name,
|
|
5501
5505
|
path,
|
|
5502
|
-
setSize,
|
|
5503
5506
|
posInSet,
|
|
5504
|
-
|
|
5505
|
-
isIgnored,
|
|
5506
|
-
index
|
|
5507
|
+
setSize
|
|
5507
5508
|
} = item;
|
|
5508
5509
|
const chevronDom = getChevronVirtualDom(chevron);
|
|
5509
5510
|
return [{
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
title: path,
|
|
5511
|
+
ariaDescription: '',
|
|
5512
|
+
ariaExpanded,
|
|
5513
|
+
ariaLabel: name,
|
|
5514
|
+
ariaLevel: depth,
|
|
5515
5515
|
ariaPosInSet: posInSet,
|
|
5516
5516
|
ariaSetSize: setSize,
|
|
5517
|
-
ariaLevel: depth,
|
|
5518
5517
|
childCount: 2 + chevronDom.length,
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5518
|
+
className,
|
|
5519
|
+
'data-index': index,
|
|
5520
|
+
draggable: true,
|
|
5522
5521
|
id,
|
|
5523
|
-
|
|
5522
|
+
role: TreeItem,
|
|
5523
|
+
title: path,
|
|
5524
|
+
type: Div
|
|
5524
5525
|
}, ...chevronDom, getFileIconVirtualDom(icon), ...getInputDom(isEditing, hasEditingError), ...getLabelDom(isEditing, name, isCut || isIgnored)];
|
|
5525
5526
|
};
|
|
5526
5527
|
|
|
@@ -5538,13 +5539,10 @@ const getClassName = (focused, focusedIndex, dropTarget) => {
|
|
|
5538
5539
|
};
|
|
5539
5540
|
const getListItemsVirtualDom = (visibleItems, focusedIndex, focused, dropTargets) => {
|
|
5540
5541
|
const dom = [{
|
|
5541
|
-
|
|
5542
|
-
className: getClassName(focused, focusedIndex, dropTargets),
|
|
5543
|
-
tabIndex: 0,
|
|
5544
|
-
role: Tree,
|
|
5542
|
+
ariaActiveDescendant: getActiveDescendant(focusedIndex),
|
|
5545
5543
|
ariaLabel: filesExplorer(),
|
|
5546
5544
|
childCount: visibleItems.length,
|
|
5547
|
-
|
|
5545
|
+
className: getClassName(focused, focusedIndex, dropTargets),
|
|
5548
5546
|
onBlur: HandleListBlur,
|
|
5549
5547
|
onClick: HandleClick,
|
|
5550
5548
|
onContextMenu: HandleContextMenu,
|
|
@@ -5554,7 +5552,10 @@ const getListItemsVirtualDom = (visibleItems, focusedIndex, focused, dropTargets
|
|
|
5554
5552
|
onDrop: HandleDrop,
|
|
5555
5553
|
onFocus: HandleListFocus,
|
|
5556
5554
|
onPointerDown: HandlePointerDown,
|
|
5557
|
-
onWheel: HandleWheel
|
|
5555
|
+
onWheel: HandleWheel,
|
|
5556
|
+
role: Tree,
|
|
5557
|
+
tabIndex: 0,
|
|
5558
|
+
type: Div
|
|
5558
5559
|
// onKeyDown: DomEventListenerFunctions.HandleListKeyDown,
|
|
5559
5560
|
}, ...visibleItems.flatMap(getExplorerItemVirtualDom)];
|
|
5560
5561
|
return dom;
|
|
@@ -5580,15 +5581,15 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarTop) => {
|
|
|
5580
5581
|
const heightString = px(scrollBarHeight);
|
|
5581
5582
|
const translateString = position(0, scrollBarTop);
|
|
5582
5583
|
return [{
|
|
5583
|
-
|
|
5584
|
+
childCount: 1,
|
|
5584
5585
|
className: mergeClassNames(ScrollBar, ScrollBarSmall),
|
|
5585
|
-
|
|
5586
|
+
type: Div
|
|
5586
5587
|
}, {
|
|
5587
|
-
type: Div,
|
|
5588
|
-
className: ScrollBarThumb,
|
|
5589
5588
|
childCount: 0,
|
|
5589
|
+
className: ScrollBarThumb,
|
|
5590
5590
|
height: heightString,
|
|
5591
|
-
translate: translateString
|
|
5591
|
+
translate: translateString,
|
|
5592
|
+
type: Div
|
|
5592
5593
|
}];
|
|
5593
5594
|
};
|
|
5594
5595
|
|
|
@@ -5612,10 +5613,10 @@ const getExplorerVirtualDom = (visibleItems, focusedIndex, root, isWide, focused
|
|
|
5612
5613
|
const errorDom = getErrorMessageDom(errorMessage);
|
|
5613
5614
|
const childCount = getChildCount(scrollBarDom.length, errorDom.length);
|
|
5614
5615
|
const parentNode = {
|
|
5615
|
-
type: Div,
|
|
5616
5616
|
childCount,
|
|
5617
5617
|
className: mergeClassNames(Viewlet, Explorer$1),
|
|
5618
|
-
role: None
|
|
5618
|
+
role: None,
|
|
5619
|
+
type: Div
|
|
5619
5620
|
};
|
|
5620
5621
|
const dom = [parentNode, ...getListItemsVirtualDom(visibleItems, focusedIndex, focused, dropTargets), ...scrollBarDom, ...errorDom];
|
|
5621
5622
|
return dom;
|
|
@@ -5653,20 +5654,20 @@ const renderValue = (oldState, newState) => {
|
|
|
5653
5654
|
|
|
5654
5655
|
const getRenderer = diffType => {
|
|
5655
5656
|
switch (diffType) {
|
|
5656
|
-
case
|
|
5657
|
-
return
|
|
5657
|
+
case RenderCss:
|
|
5658
|
+
return renderCss;
|
|
5659
|
+
case RenderDragData:
|
|
5660
|
+
return renderDragData;
|
|
5658
5661
|
case RenderFocus:
|
|
5659
5662
|
return renderFocus;
|
|
5660
5663
|
case RenderFocusContext:
|
|
5661
5664
|
return renderFocusContext;
|
|
5662
|
-
case
|
|
5663
|
-
return
|
|
5665
|
+
case RenderItems:
|
|
5666
|
+
return renderItems;
|
|
5664
5667
|
case RenderSelection:
|
|
5665
5668
|
return renderEditingSelection;
|
|
5666
|
-
case
|
|
5667
|
-
return
|
|
5668
|
-
case RenderCss:
|
|
5669
|
-
return renderCss;
|
|
5669
|
+
case RenderValue:
|
|
5670
|
+
return renderValue;
|
|
5670
5671
|
default:
|
|
5671
5672
|
throw new Error('unknown renderer');
|
|
5672
5673
|
}
|
|
@@ -5686,8 +5687,8 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
5686
5687
|
|
|
5687
5688
|
const render2 = (uid, diffResult) => {
|
|
5688
5689
|
const {
|
|
5689
|
-
|
|
5690
|
-
|
|
5690
|
+
newState,
|
|
5691
|
+
oldState
|
|
5691
5692
|
} = get(uid);
|
|
5692
5693
|
set(uid, newState, newState);
|
|
5693
5694
|
const commands = applyRender(oldState, newState, diffResult);
|
|
@@ -5706,49 +5707,49 @@ const getActions = root => {
|
|
|
5706
5707
|
return [];
|
|
5707
5708
|
}
|
|
5708
5709
|
return [{
|
|
5709
|
-
|
|
5710
|
-
id: newFile$1(),
|
|
5710
|
+
command: 'newFile',
|
|
5711
5711
|
icon: NewFile,
|
|
5712
|
-
|
|
5712
|
+
id: newFile$1(),
|
|
5713
|
+
type: Button
|
|
5713
5714
|
}, {
|
|
5714
|
-
|
|
5715
|
-
id: newFolder$1(),
|
|
5715
|
+
command: 'newFolder',
|
|
5716
5716
|
icon: NewFolder,
|
|
5717
|
-
|
|
5717
|
+
id: newFolder$1(),
|
|
5718
|
+
type: Button
|
|
5718
5719
|
}, {
|
|
5719
|
-
|
|
5720
|
-
id: refresh$1(),
|
|
5720
|
+
command: 'refresh',
|
|
5721
5721
|
icon: Refresh,
|
|
5722
|
-
|
|
5722
|
+
id: refresh$1(),
|
|
5723
|
+
type: Button
|
|
5723
5724
|
}, {
|
|
5724
|
-
|
|
5725
|
-
id: collapseAll$1(),
|
|
5725
|
+
command: 'collapseAll',
|
|
5726
5726
|
icon: CollapseAll,
|
|
5727
|
-
|
|
5727
|
+
id: collapseAll$1(),
|
|
5728
|
+
type: Button
|
|
5728
5729
|
}];
|
|
5729
5730
|
};
|
|
5730
5731
|
|
|
5731
5732
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
5732
5733
|
return {
|
|
5733
|
-
|
|
5734
|
+
childCount: 0,
|
|
5734
5735
|
className: `MaskIcon MaskIcon${icon}`,
|
|
5735
5736
|
role: None,
|
|
5736
|
-
|
|
5737
|
+
type
|
|
5737
5738
|
};
|
|
5738
5739
|
};
|
|
5739
5740
|
|
|
5740
5741
|
const getActionButtonVirtualDom = action => {
|
|
5741
5742
|
const {
|
|
5742
|
-
|
|
5743
|
+
command,
|
|
5743
5744
|
icon,
|
|
5744
|
-
|
|
5745
|
+
id
|
|
5745
5746
|
} = action;
|
|
5746
5747
|
return [{
|
|
5747
|
-
|
|
5748
|
+
childCount: 1,
|
|
5748
5749
|
className: IconButton,
|
|
5749
|
-
title: id,
|
|
5750
5750
|
'data-command': command,
|
|
5751
|
-
|
|
5751
|
+
title: id,
|
|
5752
|
+
type: Button$1
|
|
5752
5753
|
}, getIconVirtualDom(icon || '')];
|
|
5753
5754
|
};
|
|
5754
5755
|
|
|
@@ -5763,10 +5764,10 @@ const getActionVirtualDom = action => {
|
|
|
5763
5764
|
|
|
5764
5765
|
const getActionsVirtualDom = actions => {
|
|
5765
5766
|
return [{
|
|
5766
|
-
|
|
5767
|
+
childCount: actions.length,
|
|
5767
5768
|
className: Actions,
|
|
5768
5769
|
role: ToolBar,
|
|
5769
|
-
|
|
5770
|
+
type: Div
|
|
5770
5771
|
}, ...actions.flatMap(getActionVirtualDom)];
|
|
5771
5772
|
};
|
|
5772
5773
|
|
|
@@ -5827,10 +5828,10 @@ const renderEventListeners = () => {
|
|
|
5827
5828
|
name: HandleDragLeave,
|
|
5828
5829
|
params: ['handleDragLeave']
|
|
5829
5830
|
}, {
|
|
5830
|
-
name: HandleDragStart,
|
|
5831
|
-
params: ['handleDragStart'],
|
|
5832
5831
|
// @ts-ignore
|
|
5833
|
-
dragEffect: 'copyMove'
|
|
5832
|
+
dragEffect: 'copyMove',
|
|
5833
|
+
name: HandleDragStart,
|
|
5834
|
+
params: ['handleDragStart']
|
|
5834
5835
|
}];
|
|
5835
5836
|
};
|
|
5836
5837
|
|
|
@@ -5862,18 +5863,18 @@ const getSavedWorkspacePath = savedState => {
|
|
|
5862
5863
|
const restoreState = savedState => {
|
|
5863
5864
|
if (!savedState) {
|
|
5864
5865
|
return {
|
|
5865
|
-
|
|
5866
|
+
deltaY: 0,
|
|
5866
5867
|
minLineY: 0,
|
|
5867
|
-
|
|
5868
|
+
root: ''
|
|
5868
5869
|
};
|
|
5869
5870
|
}
|
|
5870
5871
|
const root = getSavedWorkspacePath(savedState);
|
|
5871
5872
|
const minLineY = getSavedMinLineY(savedState);
|
|
5872
5873
|
const deltaY = getSavedDeltaY(savedState);
|
|
5873
5874
|
return {
|
|
5874
|
-
|
|
5875
|
+
deltaY,
|
|
5875
5876
|
minLineY,
|
|
5876
|
-
|
|
5877
|
+
root
|
|
5877
5878
|
};
|
|
5878
5879
|
};
|
|
5879
5880
|
|
|
@@ -5906,11 +5907,11 @@ const mergeVisibleWithHiddenItems = (visibleItems, hiddenItems) => {
|
|
|
5906
5907
|
// TODO maybe just insert items into explorer and refresh whole explorer
|
|
5907
5908
|
const revealItemHidden = async (state, uri) => {
|
|
5908
5909
|
const {
|
|
5909
|
-
root,
|
|
5910
|
-
pathSeparator,
|
|
5911
5910
|
items,
|
|
5911
|
+
maxLineY,
|
|
5912
5912
|
minLineY,
|
|
5913
|
-
|
|
5913
|
+
pathSeparator,
|
|
5914
|
+
root
|
|
5914
5915
|
} = state;
|
|
5915
5916
|
const pathParts = getPathParts(root, uri, pathSeparator);
|
|
5916
5917
|
if (pathParts.length === 0) {
|
|
@@ -5926,34 +5927,34 @@ const revealItemHidden = async (state, uri) => {
|
|
|
5926
5927
|
throw new Error(`File not found in explorer ${uri}`);
|
|
5927
5928
|
}
|
|
5928
5929
|
const {
|
|
5929
|
-
|
|
5930
|
-
|
|
5930
|
+
newMaxLineY,
|
|
5931
|
+
newMinLineY
|
|
5931
5932
|
} = scrollInto(index, minLineY, maxLineY);
|
|
5932
5933
|
return {
|
|
5933
5934
|
...state,
|
|
5934
|
-
items: mergedDirents,
|
|
5935
5935
|
focused: true,
|
|
5936
5936
|
focusedIndex: index,
|
|
5937
|
-
|
|
5938
|
-
maxLineY: newMaxLineY
|
|
5937
|
+
items: mergedDirents,
|
|
5938
|
+
maxLineY: newMaxLineY,
|
|
5939
|
+
minLineY: newMinLineY
|
|
5939
5940
|
};
|
|
5940
5941
|
};
|
|
5941
5942
|
|
|
5942
5943
|
const revealItemVisible = (state, index) => {
|
|
5943
5944
|
const {
|
|
5944
|
-
|
|
5945
|
-
|
|
5945
|
+
maxLineY,
|
|
5946
|
+
minLineY
|
|
5946
5947
|
} = state;
|
|
5947
5948
|
const {
|
|
5948
|
-
|
|
5949
|
-
|
|
5949
|
+
newMaxLineY,
|
|
5950
|
+
newMinLineY
|
|
5950
5951
|
} = scrollInto(index, minLineY, maxLineY);
|
|
5951
5952
|
return {
|
|
5952
5953
|
...state,
|
|
5953
5954
|
focused: true,
|
|
5954
5955
|
focusedIndex: index,
|
|
5955
|
-
|
|
5956
|
-
|
|
5956
|
+
maxLineY: newMaxLineY,
|
|
5957
|
+
minLineY: newMinLineY
|
|
5957
5958
|
};
|
|
5958
5959
|
};
|
|
5959
5960
|
|
|
@@ -5976,19 +5977,19 @@ const isExpandedDirectory = dirent => {
|
|
|
5976
5977
|
|
|
5977
5978
|
const saveState = state => {
|
|
5978
5979
|
const {
|
|
5979
|
-
items,
|
|
5980
|
-
root,
|
|
5981
5980
|
deltaY,
|
|
5981
|
+
items,
|
|
5982
|
+
maxLineY,
|
|
5982
5983
|
minLineY,
|
|
5983
|
-
|
|
5984
|
+
root
|
|
5984
5985
|
} = state;
|
|
5985
5986
|
const expandedPaths = items.filter(isExpandedDirectory).map(getPath);
|
|
5986
5987
|
return {
|
|
5988
|
+
deltaY,
|
|
5987
5989
|
expandedPaths,
|
|
5988
|
-
root,
|
|
5989
|
-
minLineY,
|
|
5990
5990
|
maxLineY,
|
|
5991
|
-
|
|
5991
|
+
minLineY,
|
|
5992
|
+
root
|
|
5992
5993
|
};
|
|
5993
5994
|
};
|
|
5994
5995
|
|
|
@@ -6017,8 +6018,8 @@ const getLastSelectedIndex = items => {
|
|
|
6017
6018
|
};
|
|
6018
6019
|
const selectDown = state => {
|
|
6019
6020
|
const {
|
|
6020
|
-
|
|
6021
|
-
|
|
6021
|
+
focusedIndex,
|
|
6022
|
+
items
|
|
6022
6023
|
} = state;
|
|
6023
6024
|
const lastSelectedIndex = getLastSelectedIndex(items);
|
|
6024
6025
|
const targetIndex = lastSelectedIndex === -1 ? focusedIndex : lastSelectedIndex;
|
|
@@ -6031,8 +6032,8 @@ const selectDown = state => {
|
|
|
6031
6032
|
}));
|
|
6032
6033
|
return {
|
|
6033
6034
|
...state,
|
|
6034
|
-
|
|
6035
|
-
|
|
6035
|
+
focusedIndex: targetIndex + 1,
|
|
6036
|
+
items: newItems
|
|
6036
6037
|
};
|
|
6037
6038
|
};
|
|
6038
6039
|
|
|
@@ -6052,8 +6053,8 @@ const setSelectedIndices = (state, indices) => {
|
|
|
6052
6053
|
|
|
6053
6054
|
const selectUp = state => {
|
|
6054
6055
|
const {
|
|
6055
|
-
|
|
6056
|
-
|
|
6056
|
+
focusedIndex,
|
|
6057
|
+
items
|
|
6057
6058
|
} = state;
|
|
6058
6059
|
const firstSelectedIndex = items.findIndex(item => item.selected);
|
|
6059
6060
|
const targetIndex = firstSelectedIndex === -1 ? focusedIndex : firstSelectedIndex;
|
|
@@ -6098,11 +6099,10 @@ const getEditingIcon = async (editingType, value, direntType) => {
|
|
|
6098
6099
|
|
|
6099
6100
|
const updateEditingValue = async (state, value, inputSource = User) => {
|
|
6100
6101
|
const {
|
|
6101
|
-
editingType,
|
|
6102
|
-
items,
|
|
6103
6102
|
editingIndex,
|
|
6104
|
-
|
|
6105
|
-
|
|
6103
|
+
editingType,
|
|
6104
|
+
focusedIndex,
|
|
6105
|
+
items} = state;
|
|
6106
6106
|
const editingIcon = await getEditingIcon(editingType, value, items[editingIndex]?.type);
|
|
6107
6107
|
|
|
6108
6108
|
// Get sibling file names for validation during file/folder creation
|
|
@@ -6113,9 +6113,9 @@ const updateEditingValue = async (state, value, inputSource = User) => {
|
|
|
6113
6113
|
const editingErrorMessage = validateFileName2(value, siblingFileNames);
|
|
6114
6114
|
return {
|
|
6115
6115
|
...state,
|
|
6116
|
-
|
|
6116
|
+
editingErrorMessage,
|
|
6117
6117
|
editingIcon,
|
|
6118
|
-
|
|
6118
|
+
editingValue: value
|
|
6119
6119
|
};
|
|
6120
6120
|
};
|
|
6121
6121
|
|
|
@@ -6126,6 +6126,10 @@ const commandMap = {
|
|
|
6126
6126
|
'Explorer.collapseAll': wrapListItemCommand(collapseAll),
|
|
6127
6127
|
'Explorer.copyPath': wrapListItemCommand(copyPath),
|
|
6128
6128
|
'Explorer.copyRelativePath': wrapListItemCommand(copyRelativePath),
|
|
6129
|
+
'Explorer.create': create,
|
|
6130
|
+
// not wrapped
|
|
6131
|
+
'Explorer.create2': create2,
|
|
6132
|
+
'Explorer.diff2': diff2,
|
|
6129
6133
|
'Explorer.expandAll': wrapListItemCommand(expandAll),
|
|
6130
6134
|
'Explorer.expandRecursively': wrapListItemCommand(expandRecursively),
|
|
6131
6135
|
'Explorer.focus': wrapListItemCommand(focus),
|
|
@@ -6136,6 +6140,8 @@ const commandMap = {
|
|
|
6136
6140
|
'Explorer.focusNone': wrapListItemCommand(focusNone),
|
|
6137
6141
|
'Explorer.focusPrevious': wrapListItemCommand(focusPrevious),
|
|
6138
6142
|
'Explorer.getCommandIds': getCommandIds,
|
|
6143
|
+
'Explorer.getKeyBindings': getKeyBindings,
|
|
6144
|
+
'Explorer.getMenuEntries': getMenuEntries,
|
|
6139
6145
|
'Explorer.getMenuEntries2': wrapGetter(getMenuEntries2),
|
|
6140
6146
|
'Explorer.getMouseActions': getMouseActions,
|
|
6141
6147
|
'Explorer.handleArrowLeft': wrapListItemCommand(handleArrowLeft),
|
|
@@ -6168,6 +6174,7 @@ const commandMap = {
|
|
|
6168
6174
|
'Explorer.handleWheel': wrapListItemCommand(handleWheel),
|
|
6169
6175
|
'Explorer.handleWorkspaceChange': wrapListItemCommand(handleWorkspaceChange),
|
|
6170
6176
|
'Explorer.handleWorkspaceRefresh': wrapListItemCommand(handleWorkspaceRefresh),
|
|
6177
|
+
'Explorer.initialize': initialize,
|
|
6171
6178
|
'Explorer.loadContent': wrapListItemCommand(loadContent),
|
|
6172
6179
|
'Explorer.newFile': wrapListItemCommand(newFile),
|
|
6173
6180
|
'Explorer.newFolder': wrapListItemCommand(newFolder),
|
|
@@ -6175,29 +6182,22 @@ const commandMap = {
|
|
|
6175
6182
|
'Explorer.refresh': wrapListItemCommand(refresh),
|
|
6176
6183
|
'Explorer.removeDirent': wrapListItemCommand(removeDirent),
|
|
6177
6184
|
'Explorer.renameDirent': wrapListItemCommand(renameDirent),
|
|
6185
|
+
'Explorer.render2': render2,
|
|
6186
|
+
'Explorer.renderActions2': renderActions,
|
|
6187
|
+
'Explorer.renderEventListeners': renderEventListeners,
|
|
6178
6188
|
'Explorer.restoreState': restoreState,
|
|
6179
6189
|
'Explorer.revealItem': wrapListItemCommand(revealItem),
|
|
6190
|
+
'Explorer.saveState': wrapGetter(saveState),
|
|
6180
6191
|
'Explorer.selectAll': wrapListItemCommand(selectAll),
|
|
6181
6192
|
'Explorer.selectDown': wrapListItemCommand(selectDown),
|
|
6182
6193
|
'Explorer.selectIndices': wrapListItemCommand(setSelectedIndices),
|
|
6183
6194
|
'Explorer.selectUp': wrapListItemCommand(selectUp),
|
|
6184
6195
|
'Explorer.setDeltaY': wrapListItemCommand(setDeltaY),
|
|
6185
6196
|
'Explorer.setSelectedIndices': wrapListItemCommand(setSelectedIndices),
|
|
6197
|
+
'Explorer.terminate': terminate,
|
|
6186
6198
|
'Explorer.toggleIndividualSelection': wrapListItemCommand(toggleIndividualSelection),
|
|
6187
6199
|
'Explorer.updateEditingValue': wrapListItemCommand(updateEditingValue),
|
|
6188
|
-
'Explorer.updateIcons': wrapListItemCommand(updateIcons)
|
|
6189
|
-
// not wrapped
|
|
6190
|
-
'Explorer.create2': create2,
|
|
6191
|
-
'Explorer.diff2': diff2,
|
|
6192
|
-
'Explorer.getKeyBindings': getKeyBindings,
|
|
6193
|
-
'Explorer.getMenuEntries': getMenuEntries,
|
|
6194
|
-
'Explorer.render2': render2,
|
|
6195
|
-
'Explorer.renderActions2': renderActions,
|
|
6196
|
-
'Explorer.renderEventListeners': renderEventListeners,
|
|
6197
|
-
'Explorer.saveState': wrapGetter(saveState),
|
|
6198
|
-
'Explorer.terminate': terminate,
|
|
6199
|
-
'Explorer.initialize': initialize,
|
|
6200
|
-
'Explorer.create': create
|
|
6200
|
+
'Explorer.updateIcons': wrapListItemCommand(updateIcons)
|
|
6201
6201
|
};
|
|
6202
6202
|
|
|
6203
6203
|
const listen = async () => {
|