@lvce-editor/explorer-view 2.9.0 → 2.11.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.
@@ -2701,12 +2701,29 @@ const mergeDirents$2 = (oldDirents, newDirents) => {
2701
2701
  };
2702
2702
 
2703
2703
  // TODO add lots of tests for this
2704
- const refresh = async state1 => {
2705
- const topLevelDirents = await getTopLevelDirents(state1.root, state1.pathSeparator, []);
2706
- const newDirents = mergeDirents$2(state1.items, topLevelDirents);
2704
+ const refresh = async state => {
2705
+ const {
2706
+ root,
2707
+ pathSeparator,
2708
+ minLineY,
2709
+ height,
2710
+ itemHeight,
2711
+ fileIconCache
2712
+ } = state;
2713
+ const topLevelDirents = await getTopLevelDirents(root, pathSeparator, []);
2714
+ const newDirents = mergeDirents$2(state.items, topLevelDirents);
2715
+ const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, newDirents.length);
2716
+ const visible = newDirents.slice(minLineY, maxLineY);
2717
+ const {
2718
+ icons,
2719
+ newFileIconCache
2720
+ } = await getFileIcons(visible, fileIconCache);
2707
2721
  const state3 = {
2708
- ...state1,
2709
- items: newDirents
2722
+ ...state,
2723
+ items: newDirents,
2724
+ fileIconCache: newFileIconCache,
2725
+ icons,
2726
+ maxLineY
2710
2727
  };
2711
2728
  return state3;
2712
2729
  };
@@ -2979,6 +2996,12 @@ const getDropHandler = index => {
2979
2996
  }
2980
2997
  };
2981
2998
 
2999
+ const getFileArray = fileList => {
3000
+ // @ts-ignore
3001
+ const files = [...fileList];
3002
+ return files;
3003
+ };
3004
+
2982
3005
  const getFileHandles = async fileIds => {
2983
3006
  const files = await invoke('FileSystemHandle.getFileHandles', fileIds);
2984
3007
  return files;
@@ -3002,8 +3025,7 @@ const getFilePaths = async (files, platform) => {
3002
3025
 
3003
3026
  const handleDrop = async (state, x, y, fileIds, fileList) => {
3004
3027
  try {
3005
- // @ts-ignore
3006
- const files = [...fileList];
3028
+ const files = getFileArray(fileList);
3007
3029
  const fileHandles = await getFileHandles(fileIds);
3008
3030
  const paths = await getFilePaths(files, state.platform);
3009
3031
  const index = getIndexFromPosition(state, x, y);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "2.9.0",
3
+ "version": "2.11.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",