@lvce-editor/explorer-view 1.24.0 → 1.25.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.
@@ -898,18 +898,6 @@ const compareDirent = (direntA, direntB) => {
898
898
  return compareDirentType(direntA, direntB) || compareDirentName(direntA, direntB);
899
899
  };
900
900
 
901
- const getFileIcon = ({
902
- name
903
- }) => {
904
- return '';
905
- };
906
- const getIcon = dirent => {
907
- return '';
908
- };
909
- const getFolderIcon = dirent => {
910
- return '';
911
- };
912
-
913
901
  // TODO use posInSet and setSize properties to compute more effectively
914
902
  const computeExplorerRenamedDirent = (dirents, index, newName) => {
915
903
  let startIndex = index;
@@ -921,9 +909,7 @@ const computeExplorerRenamedDirent = (dirents, index, newName) => {
921
909
  ...oldDirent,
922
910
  name: newName,
923
911
  path: oldDirent.path.slice(0, -oldDirent.name.length) + newName,
924
- icon: getFileIcon({
925
- name: newName
926
- })
912
+ icon: ''
927
913
  };
928
914
  const {
929
915
  depth
@@ -1111,7 +1097,7 @@ const acceptCreate = async (state, newDirentType, createFn) => {
1111
1097
  type: newDirentType,
1112
1098
  icon: ''
1113
1099
  };
1114
- newDirent.icon = getIcon();
1100
+ newDirent.icon = '';
1115
1101
  let insertIndex = state.focusedIndex;
1116
1102
  let deltaPosInSet = 0;
1117
1103
  let posInSet = 1;
@@ -1441,7 +1427,7 @@ const toDisplayDirents = (pathSeparator, rawDirents, parentDirent, excluded) =>
1441
1427
  type: rawDirent.type,
1442
1428
  path,
1443
1429
  // TODO storing absolute path might be too costly, could also store relative path here
1444
- icon: getIcon()
1430
+ icon: ''
1445
1431
  };
1446
1432
  };
1447
1433
  const result = [];
@@ -2437,7 +2423,7 @@ const handleClickDirectoryExpanded = async (state, dirent, index, keepFocus) =>
2437
2423
  // @ts-ignore
2438
2424
  dirent.type = Directory;
2439
2425
  // @ts-ignore
2440
- dirent.icon = getIcon();
2426
+ dirent.icon = '';
2441
2427
  const endIndex = getParentEndIndex(state.items, index);
2442
2428
  const removeCount = endIndex - index - 1;
2443
2429
  // TODO race conditions and side effects are everywhere
@@ -2538,7 +2524,7 @@ const handleClickDirectory = async (state, dirent, index, keepFocus) => {
2538
2524
  // @ts-ignore
2539
2525
  dirent.type = DirectoryExpanded;
2540
2526
  // @ts-ignore
2541
- dirent.icon = getIcon();
2527
+ dirent.icon = '';
2542
2528
  const {
2543
2529
  height,
2544
2530
  itemHeight,
@@ -2631,7 +2617,7 @@ const handleClickDirectoryExpanding = async (state, dirent, index, keepFocus) =>
2631
2617
  // @ts-ignore
2632
2618
  dirent.type = Directory;
2633
2619
  // @ts-ignore
2634
- dirent.icon = getIcon();
2620
+ dirent.icon = '';
2635
2621
  return {
2636
2622
  ...state,
2637
2623
  focusedIndex: index,
@@ -3056,15 +3042,27 @@ const handleFocus = async state => {
3056
3042
  const updateIcon = dirent => {
3057
3043
  return {
3058
3044
  ...dirent,
3059
- icon: getIcon()
3045
+ icon: ''
3060
3046
  };
3061
3047
  };
3062
3048
 
3063
- const updateIcons = state => {
3049
+ const updateIcons = async state => {
3064
3050
  const newDirents = state.items.map(updateIcon);
3051
+ const {
3052
+ items,
3053
+ minLineY,
3054
+ maxLineY
3055
+ } = state;
3056
+ const visible = items.slice(minLineY, maxLineY);
3057
+ const {
3058
+ icons,
3059
+ newFileIconCache
3060
+ } = await getFileIcons(visible, Object.create(null));
3065
3061
  return {
3066
3062
  ...state,
3067
- items: newDirents
3063
+ items: newDirents,
3064
+ icons,
3065
+ fileIconCache: newFileIconCache
3068
3066
  };
3069
3067
  };
3070
3068
 
@@ -3298,7 +3296,7 @@ const getSavedChildDirents = (map, path, depth, excluded, pathSeparator) => {
3298
3296
  depth,
3299
3297
  posInSet: i + 1,
3300
3298
  setSize: visibleLength,
3301
- icon: getFolderIcon(),
3299
+ icon: '',
3302
3300
  name,
3303
3301
  path: childPath,
3304
3302
  type: DirectoryExpanded
@@ -3309,7 +3307,7 @@ const getSavedChildDirents = (map, path, depth, excluded, pathSeparator) => {
3309
3307
  depth,
3310
3308
  posInSet: i + 1,
3311
3309
  setSize: visibleLength,
3312
- icon: getIcon(),
3310
+ icon: '',
3313
3311
  name,
3314
3312
  path: childPath,
3315
3313
  type
@@ -3992,9 +3990,7 @@ const terminate = () => {
3992
3990
  };
3993
3991
 
3994
3992
  const updateEditingValue = (state, value) => {
3995
- const editingIcon = getFileIcon({
3996
- name: value
3997
- });
3993
+ const editingIcon = '';
3998
3994
  return {
3999
3995
  ...state,
4000
3996
  editingValue: value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "1.24.0",
3
+ "version": "1.25.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",