@lvce-editor/explorer-view 1.12.0 → 1.13.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.
@@ -442,10 +442,10 @@ const create$4 = (method, params) => {
442
442
  };
443
443
  };
444
444
  const callbacks = Object.create(null);
445
- const set = (id, fn) => {
445
+ const set$1 = (id, fn) => {
446
446
  callbacks[id] = fn;
447
447
  };
448
- const get = id => {
448
+ const get$1 = id => {
449
449
  return callbacks[id];
450
450
  };
451
451
  const remove$1 = id => {
@@ -461,7 +461,7 @@ const registerPromise = () => {
461
461
  resolve,
462
462
  promise
463
463
  } = Promise.withResolvers();
464
- set(id, resolve);
464
+ set$1(id, resolve);
465
465
  return {
466
466
  id,
467
467
  promise
@@ -618,7 +618,7 @@ const warn = (...args) => {
618
618
  console.warn(...args);
619
619
  };
620
620
  const resolve = (id, response) => {
621
- const fn = get(id);
621
+ const fn = get$1(id);
622
622
  if (!fn) {
623
623
  console.log(response);
624
624
  warn(`callback ${id} may already be disposed`);
@@ -959,7 +959,7 @@ const computeExplorerRenamedDirent = (dirents, index, newName) => {
959
959
  if (dirent.depth < depth) {
960
960
  break;
961
961
  }
962
- if (insertIndex === -1 && compareDirent(dirent, newDirent === -1)) {
962
+ if (insertIndex === -1 && compareDirent(dirent, newDirent) === -1) {
963
963
  for (; endIndex < dirents.length; endIndex++) {
964
964
  }
965
965
  insertIndex = endIndex;
@@ -1010,17 +1010,20 @@ const CreateFile = 1;
1010
1010
  const CreateFolder = 2;
1011
1011
  const Rename$1 = 3;
1012
1012
 
1013
- const state = {
1014
- rpc: undefined
1013
+ const RendererWorker = 1;
1014
+
1015
+ const rpcs = Object.create(null);
1016
+ const set = (id, rpc) => {
1017
+ rpcs[id] = rpc;
1018
+ };
1019
+ const get = id => {
1020
+ return rpcs[id];
1015
1021
  };
1022
+
1016
1023
  const invoke = (method, ...params) => {
1017
- const rpc = state.rpc;
1018
- // @ts-ignore
1024
+ const rpc = get(RendererWorker);
1019
1025
  return rpc.invoke(method, ...params);
1020
1026
  };
1021
- const setRpc = rpc => {
1022
- state.rpc = rpc;
1023
- };
1024
1027
 
1025
1028
  const remove = async dirent => {
1026
1029
  return invoke('FileSystem.remove', dirent);
@@ -1129,15 +1132,21 @@ const acceptCreate = async (state, newDirentType, createFn) => {
1129
1132
  deltaPosInSet = 1 - 1;
1130
1133
  break;
1131
1134
  } else {
1135
+ // @ts-ignore
1132
1136
  posInSet = dirent.posInSet + 1;
1137
+ // @ts-ignore
1133
1138
  setSize = dirent.setSize + 1;
1139
+ // @ts-ignore
1134
1140
  insertIndex = i;
1135
1141
  }
1142
+ // @ts-ignore
1136
1143
  dirent.setSize++;
1144
+ // @ts-ignore
1137
1145
  dirent.posInSet += deltaPosInSet;
1138
1146
  }
1139
1147
  newDirent.setSize = setSize;
1140
1148
  newDirent.posInSet = posInSet;
1149
+ // @ts-ignore
1141
1150
  items.splice(insertIndex + 1, 0, newDirent);
1142
1151
  const newDirents = [...items];
1143
1152
  const newMaxlineY = Math.max(state.maxLineY, newDirents.length);
@@ -1174,6 +1183,7 @@ const acceptRename = async state => {
1174
1183
  focusedIndex
1175
1184
  } = computeExplorerRenamedDirent(items, editingIndex, editingValue);
1176
1185
  // TODO move focused index
1186
+ // @ts-ignore
1177
1187
  state.items = newDirents;
1178
1188
  return {
1179
1189
  ...state,
@@ -1185,7 +1195,7 @@ const acceptRename = async state => {
1185
1195
  focused: true
1186
1196
  };
1187
1197
  };
1188
- const acceptEdit = state => {
1198
+ const acceptEdit = async state => {
1189
1199
  const {
1190
1200
  editingType
1191
1201
  } = state;
@@ -1219,11 +1229,6 @@ const isTopLevel$1 = dirent => {
1219
1229
  return dirent.depth === 1;
1220
1230
  };
1221
1231
 
1222
- const IsTopLevel = {
1223
- __proto__: null,
1224
- isTopLevel: isTopLevel$1
1225
- };
1226
-
1227
1232
  const toCollapsedDirent = dirent => {
1228
1233
  if (dirent.type === DirectoryExpanded) {
1229
1234
  return {
@@ -1238,7 +1243,7 @@ const collapseAll$1 = state => {
1238
1243
  const {
1239
1244
  items
1240
1245
  } = state;
1241
- const newDirents = items.filter(IsTopLevel).map(toCollapsedDirent);
1246
+ const newDirents = items.filter(isTopLevel$1).map(toCollapsedDirent);
1242
1247
  return {
1243
1248
  ...state,
1244
1249
  items: newDirents
@@ -1423,6 +1428,7 @@ const expandAll = async state => {
1423
1428
  if (dirent.depth === depth && dirent.type === Directory) {
1424
1429
  // TODO expand
1425
1430
  // TODO avoid mutating state here
1431
+ // @ts-ignore
1426
1432
  dirent.type = DirectoryExpanding;
1427
1433
  // TODO handle error
1428
1434
  // TODO race condition
@@ -1433,6 +1439,7 @@ const expandAll = async state => {
1433
1439
  }
1434
1440
  newDirents.splice(newIndex + 1, 0, ...childDirents);
1435
1441
  // TODO avoid mutating state here
1442
+ // @ts-ignore
1436
1443
  dirent.type = DirectoryExpanded;
1437
1444
  // await expand(state, dirent.index)
1438
1445
  }
@@ -1504,6 +1511,7 @@ const expandRecursively = async state => {
1504
1511
  // TODO race condition: what if folder is being collapse while it is recursively expanding?
1505
1512
  // TODO race condition: what if folder is being deleted while it is recursively expanding?
1506
1513
  // TODO race condition: what if a new file/folder is created while the folder is recursively expanding?
1514
+ // @ts-ignore
1507
1515
  const childDirents = await getChildDirentsRecursively(dirent);
1508
1516
  const startIndex = focusedIndex;
1509
1517
  if (focusedIndex >= 0) {
@@ -1622,11 +1630,6 @@ const focusPrevious = state => {
1622
1630
 
1623
1631
  const Button$2 = 1;
1624
1632
 
1625
- const CollapseAll = 'CollapseAll';
1626
- const NewFile$1 = 'NewFile';
1627
- const NewFolder$1 = 'NewFolder';
1628
- const Refresh = 'Refresh';
1629
-
1630
1633
  const emptyObject = {};
1631
1634
  const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
1632
1635
  const i18nString = (key, placeholders = emptyObject) => {
@@ -1639,8 +1642,8 @@ const i18nString = (key, placeholders = emptyObject) => {
1639
1642
  return key.replaceAll(RE_PLACEHOLDER, replacer);
1640
1643
  };
1641
1644
 
1642
- const NewFile = 'New File...';
1643
- const NewFolder = 'New Folder...';
1645
+ const NewFile$1 = 'New File...';
1646
+ const NewFolder$1 = 'New Folder...';
1644
1647
  const OpenContainingFolder = 'Open Containing Folder';
1645
1648
  const OpenInIntegratedTerminal = 'Open in integrated Terminal';
1646
1649
  const Cut$1 = 'Cut';
@@ -1657,10 +1660,10 @@ const YouHaveNotYetOpenedAFolder = 'You have not yet opened a folder';
1657
1660
  const OpenFolder = 'Open folder';
1658
1661
 
1659
1662
  const newFile$1 = () => {
1660
- return i18nString(NewFile);
1663
+ return i18nString(NewFile$1);
1661
1664
  };
1662
1665
  const newFolder$1 = () => {
1663
- return i18nString(NewFolder);
1666
+ return i18nString(NewFolder$1);
1664
1667
  };
1665
1668
  const openContainingFolder$1 = () => {
1666
1669
  return i18nString(OpenContainingFolder);
@@ -1705,6 +1708,11 @@ const openFolder$1 = () => {
1705
1708
  return i18nString(OpenFolder);
1706
1709
  };
1707
1710
 
1711
+ const CollapseAll = 'CollapseAll';
1712
+ const NewFile = 'NewFile';
1713
+ const NewFolder = 'NewFolder';
1714
+ const Refresh = 'Refresh';
1715
+
1708
1716
  const getActions = root => {
1709
1717
  if (!root) {
1710
1718
  return [];
@@ -1712,12 +1720,12 @@ const getActions = root => {
1712
1720
  return [{
1713
1721
  type: Button$2,
1714
1722
  id: newFile$1(),
1715
- icon: NewFile$1,
1723
+ icon: NewFile,
1716
1724
  command: 'newFile'
1717
1725
  }, {
1718
1726
  type: Button$2,
1719
1727
  id: newFolder$1(),
1720
- icon: NewFolder$1,
1728
+ icon: NewFolder,
1721
1729
  command: 'newFolder'
1722
1730
  }, {
1723
1731
  type: Button$2,
@@ -1740,6 +1748,7 @@ const TreeItem$1 = 'treeitem';
1740
1748
  const Actions = 'Actions';
1741
1749
  const Button$1 = 'Button';
1742
1750
  const ButtonPrimary = 'ButtonPrimary';
1751
+ const Chevron = 'Chevron';
1743
1752
  const Explorer$1 = 'Explorer';
1744
1753
  const FileIcon = 'FileIcon';
1745
1754
  const IconButton = 'IconButton';
@@ -1776,11 +1785,6 @@ const getFileIconVirtualDom = icon => {
1776
1785
  };
1777
1786
  };
1778
1787
 
1779
- const defaultIndent = 1;
1780
- const getTreeItemIndent = depth => {
1781
- return `${depth * defaultIndent}rem`;
1782
- };
1783
-
1784
1788
  const ExplorerInput = 'ExploreerInput';
1785
1789
 
1786
1790
  const text = data => {
@@ -1800,8 +1804,11 @@ const getItemVirtualDomFile = item => {
1800
1804
  path,
1801
1805
  depth,
1802
1806
  isFocused,
1803
- isEditing
1807
+ isEditing,
1808
+ indent
1804
1809
  } = item;
1810
+
1811
+ // TODO avoid mutation
1805
1812
  const dom = [];
1806
1813
  dom.push({
1807
1814
  type: Div,
@@ -1813,7 +1820,7 @@ const getItemVirtualDomFile = item => {
1813
1820
  ariaSetSize: setSize,
1814
1821
  ariaLevel: depth,
1815
1822
  childCount: 2,
1816
- paddingLeft: getTreeItemIndent(depth),
1823
+ paddingLeft: indent,
1817
1824
  ariaLabel: name,
1818
1825
  ariaDescription: ''
1819
1826
  }, getFileIconVirtualDom(icon));
@@ -1841,6 +1848,22 @@ const getItemVirtualDomFile = item => {
1841
1848
  }
1842
1849
  return dom;
1843
1850
  };
1851
+
1852
+ const getChevronDownVirtualDom = () => {
1853
+ return {
1854
+ type: Div,
1855
+ className: `${Chevron} MaskIconChevronDown`,
1856
+ childCount: 0
1857
+ };
1858
+ };
1859
+ const getChevronRightVirtualDom = () => {
1860
+ return {
1861
+ type: Div,
1862
+ className: `${Chevron} MaskIconChevronRight`,
1863
+ childCount: 0
1864
+ };
1865
+ };
1866
+
1844
1867
  const getItemVirtualDomFolder = item => {
1845
1868
  const {
1846
1869
  posInSet,
@@ -1850,19 +1873,25 @@ const getItemVirtualDomFolder = item => {
1850
1873
  path,
1851
1874
  depth,
1852
1875
  type,
1853
- isFocused
1876
+ isFocused,
1877
+ useChevrons,
1878
+ indent
1854
1879
  } = item;
1855
1880
  let ariaExpanded = '';
1881
+ let chevron;
1856
1882
  switch (type) {
1857
1883
  // TODO decide on directory vs folder
1858
1884
  case Directory:
1859
1885
  ariaExpanded = 'false';
1886
+ chevron = getChevronRightVirtualDom();
1860
1887
  break;
1861
1888
  case DirectoryExpanding:
1862
1889
  ariaExpanded = 'true'; // TODO tree should be aria-busy then
1890
+ chevron = getChevronRightVirtualDom();
1863
1891
  break;
1864
1892
  case DirectoryExpanded:
1865
1893
  ariaExpanded = 'true';
1894
+ chevron = getChevronDownVirtualDom();
1866
1895
  break;
1867
1896
  }
1868
1897
  const dom = [];
@@ -1876,11 +1905,17 @@ const getItemVirtualDomFolder = item => {
1876
1905
  ariaSetSize: setSize,
1877
1906
  ariaLevel: depth,
1878
1907
  childCount: 2,
1879
- paddingLeft: getTreeItemIndent(depth),
1908
+ paddingLeft: indent,
1880
1909
  ariaLabel: name,
1881
1910
  ariaExpanded,
1882
1911
  ariaDescription: ''
1883
1912
  });
1913
+ if (useChevrons) {
1914
+ // @ts-ignore
1915
+ dom[0].childCount++;
1916
+ // @ts-ignore
1917
+ dom.push(chevron);
1918
+ }
1884
1919
  dom.push(getFileIconVirtualDom(icon), {
1885
1920
  type: Div,
1886
1921
  className: Label,
@@ -1892,6 +1927,7 @@ const getItemVirtualDomFolder = item => {
1892
1927
  }
1893
1928
  return dom;
1894
1929
  };
1930
+
1895
1931
  const getExplorerItemVirtualDom = item => {
1896
1932
  const {
1897
1933
  type
@@ -1936,6 +1972,7 @@ const getExplorerVirtualDom = (visibleItems, focusedIndex, root, isWide) => {
1936
1972
  if (!root) {
1937
1973
  return getExplorerWelcomeVirtualDom(isWide);
1938
1974
  }
1975
+ // TODO
1939
1976
  const dom = [];
1940
1977
  dom.push({
1941
1978
  type: Div,
@@ -2168,24 +2205,35 @@ const getMenuEntries = state => {
2168
2205
  }
2169
2206
  };
2170
2207
 
2171
- const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editingIndex, editingType, editingValue, icons) => {
2208
+ const defaultIndent = 1;
2209
+ const getTreeItemIndent = depth => {
2210
+ // TODO logic should be in getVisibleItems
2211
+ return `${depth * defaultIndent}rem`;
2212
+ };
2213
+
2214
+ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editingIndex, editingType, editingValue, icons, useChevrons) => {
2172
2215
  const visible = [];
2173
2216
  let iconIndex = 0;
2174
2217
  for (let i = minLineY; i < Math.min(maxLineY, items.length); i++) {
2175
2218
  const item = items[i];
2176
2219
  const icon = icons[iconIndex++];
2220
+ const indent = getTreeItemIndent(item.depth);
2177
2221
  if (i === editingIndex) {
2178
2222
  visible.push({
2179
2223
  ...item,
2180
2224
  isFocused: i === focusedIndex,
2181
2225
  isEditing: true,
2182
- icon
2226
+ icon,
2227
+ useChevrons,
2228
+ indent
2183
2229
  });
2184
2230
  } else {
2185
2231
  visible.push({
2186
2232
  ...item,
2187
2233
  isFocused: i === focusedIndex,
2188
- icon
2234
+ icon,
2235
+ useChevrons,
2236
+ indent
2189
2237
  });
2190
2238
  }
2191
2239
  }
@@ -2199,7 +2247,9 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
2199
2247
  name: 'new',
2200
2248
  path: '/test/new',
2201
2249
  type: 2,
2202
- isEditing: true
2250
+ isEditing: true,
2251
+ useChevrons,
2252
+ indent: ''
2203
2253
  });
2204
2254
  }
2205
2255
  return visible;
@@ -2316,7 +2366,7 @@ const handleClickDirectoryExpanded$1 = async (state, dirent, index, keepFocus) =
2316
2366
  };
2317
2367
  };
2318
2368
 
2319
- const handleClickDirectoryExpanding = (state, dirent, index, keepFocus) => {
2369
+ const handleClickDirectoryExpanding = async (state, dirent, index, keepFocus) => {
2320
2370
  dirent.type = Directory;
2321
2371
  dirent.icon = getIcon();
2322
2372
  return {
@@ -2501,7 +2551,7 @@ const handleClickDirectoryExpanded = (state, dirent, index, keepFocus) => {
2501
2551
  focused: keepFocus
2502
2552
  };
2503
2553
  };
2504
- const handleClick = (state, index, keepFocus = false) => {
2554
+ const handleClick = async (state, index, keepFocus = false) => {
2505
2555
  const {
2506
2556
  items,
2507
2557
  minLineY
@@ -2553,6 +2603,7 @@ const handleArrowRightDirectoryExpanded = (state, dirent) => {
2553
2603
  if (nextDirent.depth === dirent.depth + 1) {
2554
2604
  return focusIndex(state, focusedIndex + 1);
2555
2605
  }
2606
+ return state;
2556
2607
  };
2557
2608
  const handleArrowRight = async state => {
2558
2609
  const {
@@ -2670,7 +2721,7 @@ const handleCopy = async state => {
2670
2721
  const dirent = getFocusedDirent$1(state);
2671
2722
  if (!dirent) {
2672
2723
  console.info('[ViewletExplorer/handleCopy] no dirent selected');
2673
- return;
2724
+ return state;
2674
2725
  }
2675
2726
  const absolutePath = dirent.path;
2676
2727
  // TODO handle copy error gracefully
@@ -2738,23 +2789,13 @@ const handleDragOver = (state, x, y) => {
2738
2789
  };
2739
2790
  };
2740
2791
 
2741
- const getFilePathElectron = async file => {
2742
- return invoke('GetFilePathElectron.getFilePathElectron', file);
2792
+ const uploadFileSystemHandles = async (root, pathSeparator, fileSystemHandles) => {
2793
+ // TODO send to renderer worker
2743
2794
  };
2744
2795
 
2745
2796
  const mergeDirents$2 = (oldDirents, newDirents) => {
2746
2797
  return newDirents;
2747
2798
  };
2748
-
2749
- // TODO copy files in parallel
2750
- const copyFilesElectron = async (root, pathSeparator, files) => {
2751
- for (const file of files) {
2752
- const from = await getFilePathElectron(file);
2753
- // const from = file.path
2754
- const to = join(pathSeparator, root, file.name);
2755
- await copy$1(from, to);
2756
- }
2757
- };
2758
2799
  const getMergedDirents$2 = async (root, pathSeparator, dirents) => {
2759
2800
  const childDirents = await getChildDirents(pathSeparator, {
2760
2801
  path: root,
@@ -2769,7 +2810,10 @@ const handleDrop$2 = async (state, files) => {
2769
2810
  pathSeparator,
2770
2811
  items
2771
2812
  } = state;
2772
- await copyFilesElectron(root, pathSeparator, files);
2813
+ const handled = await uploadFileSystemHandles();
2814
+ if (handled) {
2815
+ return state;
2816
+ }
2773
2817
  const mergedDirents = await getMergedDirents$2(root, pathSeparator, items);
2774
2818
  return {
2775
2819
  ...state,
@@ -2778,13 +2822,23 @@ const handleDrop$2 = async (state, files) => {
2778
2822
  };
2779
2823
  };
2780
2824
 
2781
- const uploadFileSystemHandles = async (root, pathSeparator, fileSystemHandles) => {
2782
- // TODO send to renderer worker
2825
+ const getFilePathElectron = async file => {
2826
+ return invoke('GetFilePathElectron.getFilePathElectron', file);
2783
2827
  };
2784
2828
 
2785
2829
  const mergeDirents$1 = (oldDirents, newDirents) => {
2786
2830
  return newDirents;
2787
2831
  };
2832
+
2833
+ // TODO copy files in parallel
2834
+ const copyFilesElectron = async (root, pathSeparator, files) => {
2835
+ for (const file of files) {
2836
+ const from = await getFilePathElectron(file);
2837
+ // const from = file.path
2838
+ const to = join(pathSeparator, root, file.name);
2839
+ await copy$1(from, to);
2840
+ }
2841
+ };
2788
2842
  const getMergedDirents$1 = async (root, pathSeparator, dirents) => {
2789
2843
  const childDirents = await getChildDirents(pathSeparator, {
2790
2844
  path: root,
@@ -2799,10 +2853,7 @@ const handleDrop$1 = async (state, files) => {
2799
2853
  pathSeparator,
2800
2854
  items
2801
2855
  } = state;
2802
- const handled = await uploadFileSystemHandles();
2803
- if (handled) {
2804
- return state;
2805
- }
2856
+ await copyFilesElectron(root, pathSeparator, files);
2806
2857
  const mergedDirents = await getMergedDirents$1(root, pathSeparator, items);
2807
2858
  return {
2808
2859
  ...state,
@@ -2813,11 +2864,12 @@ const handleDrop$1 = async (state, files) => {
2813
2864
 
2814
2865
  const getModule = isElectron => {
2815
2866
  if (isElectron) {
2816
- return handleDrop$2;
2867
+ return handleDrop$1;
2817
2868
  }
2818
- return handleDrop$1;
2869
+ return handleDrop$2;
2819
2870
  };
2820
2871
  const handleDropRoot = async (state, files) => {
2872
+ // @ts-ignore
2821
2873
  const fn = await getModule(state.isElectron);
2822
2874
  return fn(state, files);
2823
2875
  };
@@ -2870,7 +2922,7 @@ const handleDropIntoFile = (state, dirent, index, files) => {
2870
2922
  // @ts-ignore
2871
2923
  return handleDropIndex(parentIndex);
2872
2924
  };
2873
- const handleDropIndex = (state, index, files) => {
2925
+ const handleDropIndex = async (state, index, files) => {
2874
2926
  const {
2875
2927
  items
2876
2928
  } = state;
@@ -2969,6 +3021,7 @@ const handlePasteCopy = async (state, nativeFiles) => {
2969
3021
  // TODO handle pasting files into hardlink
2970
3022
  // TODO what if folder is big and it takes a long time
2971
3023
  for (const source of nativeFiles.files) {
3024
+ // @ts-ignore
2972
3025
  const target = join(state.pathSeperator, state.root, getBaseName(state.pathSeparator, source));
2973
3026
  await copy$1(source, target);
2974
3027
  }
@@ -2984,7 +3037,7 @@ const handlePasteCut = async (state, nativeFiles) => {
2984
3037
  return state;
2985
3038
  };
2986
3039
 
2987
- const handlePasteNone = (state, nativeFiles) => {
3040
+ const handlePasteNone = async (state, nativeFiles) => {
2988
3041
  console.info('[ViewletExplorer/handlePaste] no paths detected');
2989
3042
  return state;
2990
3043
  };
@@ -3190,6 +3243,7 @@ const getSavedRoot$1 = (savedState, workspacePath) => {
3190
3243
  return workspacePath;
3191
3244
  };
3192
3245
  const loadContent = async (state, savedState) => {
3246
+ const useChevrons = true;
3193
3247
  const workspacePath = await getWorkspacePath();
3194
3248
  const root = getSavedRoot$1(savedState, workspacePath);
3195
3249
  // TODO path separator could be restored from saved state
@@ -3219,7 +3273,8 @@ const loadContent = async (state, savedState) => {
3219
3273
  deltaY,
3220
3274
  maxLineY,
3221
3275
  pathSeparator,
3222
- excluded
3276
+ excluded,
3277
+ useChevrons
3223
3278
  };
3224
3279
  };
3225
3280
 
@@ -3233,12 +3288,12 @@ const handleWorkspaceChange = async state => {
3233
3288
  return newState;
3234
3289
  };
3235
3290
 
3236
- const ExplorerEditBox = FocusExplorerEditBox;
3237
-
3238
3291
  const setFocus = key => {
3239
3292
  return invoke('Focus.setFocus', key);
3240
3293
  };
3241
3294
 
3295
+ const ExplorerEditBox = FocusExplorerEditBox;
3296
+
3242
3297
  const newDirent = async (state, editingType) => {
3243
3298
  // TODO make focus functional instead of side effect
3244
3299
  await setFocus(ExplorerEditBox);
@@ -3310,12 +3365,14 @@ const removeDirent = async state => {
3310
3365
  // on web should probably show notification (dialog)
3311
3366
  // ErrorHandling.handleError(error)
3312
3367
  // await ErrorHandling.showErrorDialog(error)
3313
- return;
3368
+ return state;
3314
3369
  }
3315
3370
  // TODO avoid state mutation
3371
+ // @ts-ignore
3316
3372
  const newVersion = ++state.version;
3317
3373
  // TODO race condition
3318
3374
  // const newState = await loadContent(state:any)
3375
+ // @ts-ignore
3319
3376
  if (state.version !== newVersion || state.disposed) {
3320
3377
  return state;
3321
3378
  }
@@ -3349,6 +3406,7 @@ const removeDirent = async state => {
3349
3406
  return {
3350
3407
  ...state,
3351
3408
  items: newDirents,
3409
+ // @ts-ignore
3352
3410
  icons,
3353
3411
  focusedIndex: indexToFocus
3354
3412
  };
@@ -3374,7 +3432,11 @@ const renderItems = {
3374
3432
  return JSON.stringify(oldState.items) === JSON.stringify(newState.items) && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.focusedIndex === newState.focusedIndex && oldState.editingIndex === newState.editingIndex && oldState.editingType === newState.editingType && oldState.editingValue === newState.editingValue && oldState.width === newState.width;
3375
3433
  },
3376
3434
  apply(oldState, newState) {
3377
- const visibleDirents = getVisibleExplorerItems(newState.items, newState.minLineY, newState.maxLineY, newState.focusedIndex, newState.editingIndex, newState.editingType, newState.editingValue, newState.icons);
3435
+ const visibleDirents = getVisibleExplorerItems(newState.items, newState.minLineY, newState.maxLineY, newState.focusedIndex, newState.editingIndex, newState.editingType, newState.editingValue,
3436
+ // @ts-ignore
3437
+ newState.icons,
3438
+ // @ts-ignore
3439
+ newState.useChevrons);
3378
3440
  const isWide = newState.width > 450;
3379
3441
  const dom = getExplorerVirtualDom(visibleDirents, newState.focusedIndex, newState.root, isWide);
3380
3442
  return ['Viewlet.setDom2', dom];
@@ -3441,7 +3503,7 @@ const getActionButtonVirtualDom = action => {
3441
3503
  title: id,
3442
3504
  'data-command': command,
3443
3505
  childCount: 1
3444
- }, getIconVirtualDom(icon)];
3506
+ }, getIconVirtualDom(icon || '')];
3445
3507
  };
3446
3508
 
3447
3509
  const getActionVirtualDom = action => {
@@ -3834,7 +3896,7 @@ const listen = async () => {
3834
3896
  const rpc = await WebWorkerRpcClient.create({
3835
3897
  commandMap: commandMap
3836
3898
  });
3837
- setRpc(rpc);
3899
+ set(RendererWorker, rpc);
3838
3900
  };
3839
3901
 
3840
3902
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "Explorer Worker",
5
5
  "main": "dist/explorerViewWorkerMain.js",
6
6
  "type": "module",