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