@lvce-editor/explorer-view 7.17.0 → 7.19.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.
@@ -2350,7 +2350,7 @@ const newFolder$1 = () => {
2350
2350
  const openContainingFolder$1 = () => {
2351
2351
  return i18nString(OpenContainingFolder);
2352
2352
  };
2353
- const openInIntegratedTerminal = () => {
2353
+ const openInIntegratedTerminal$1 = () => {
2354
2354
  return i18nString(OpenInIntegratedTerminal);
2355
2355
  };
2356
2356
  const cut = () => {
@@ -2814,10 +2814,9 @@ const compareWithSelected = async state => {
2814
2814
  const getFocusedDirent$1 = state => {
2815
2815
  const {
2816
2816
  focusedIndex,
2817
- items,
2818
- minLineY
2817
+ items
2819
2818
  } = state;
2820
- const dirent = items[focusedIndex + minLineY];
2819
+ const dirent = items[focusedIndex];
2821
2820
  return dirent;
2822
2821
  };
2823
2822
 
@@ -2973,7 +2972,7 @@ const getFileIcons = async (dirents, fileIconCache) => {
2973
2972
  };
2974
2973
  };
2975
2974
 
2976
- const directoryTypes = new Set([DirectoryExpanded, DirectoryExpanding, EditingDirectoryExpanded]);
2975
+ const directoryTypes$1 = new Set([DirectoryExpanded, DirectoryExpanding, EditingDirectoryExpanded]);
2977
2976
  const getParentPath = (path, pathSeparator) => {
2978
2977
  const index = path.lastIndexOf(pathSeparator);
2979
2978
  if (index === -1) {
@@ -2984,7 +2983,7 @@ const getParentPath = (path, pathSeparator) => {
2984
2983
  const getGitIgnoreCandidateDirs = (root, items, pathSeparator) => {
2985
2984
  const dirs = new Set([root]);
2986
2985
  for (const item of items) {
2987
- if (directoryTypes.has(item.type)) {
2986
+ if (directoryTypes$1.has(item.type)) {
2988
2987
  dirs.add(item.path);
2989
2988
  }
2990
2989
  const parent = getParentPath(item.path, pathSeparator);
@@ -4252,7 +4251,7 @@ const getKeyBindings = () => {
4252
4251
  key: Delete$1,
4253
4252
  when: FocusExplorer
4254
4253
  }, {
4255
- command: 'Explorer.focusNone',
4254
+ command: 'Explorer.handleEscape',
4256
4255
  key: Escape,
4257
4256
  when: FocusExplorer
4258
4257
  }, {
@@ -4263,10 +4262,6 @@ const getKeyBindings = () => {
4263
4262
  command: 'Explorer.handleClickCurrent',
4264
4263
  key: Enter,
4265
4264
  when: FocusExplorer
4266
- }, {
4267
- command: 'Explorer.handleEscape',
4268
- key: Escape,
4269
- when: FocusExplorer
4270
4265
  }, {
4271
4266
  command: 'Explorer.selectAll',
4272
4267
  key: CtrlCmd | KeyA,
@@ -4305,10 +4300,10 @@ const menuEntryOpenContainingFolder = {
4305
4300
  label: openContainingFolder$1()
4306
4301
  };
4307
4302
  const menuEntryOpenInIntegratedTerminal = {
4308
- command: /* TODO */'-1',
4303
+ command: 'Explorer.openInIntegratedTerminal',
4309
4304
  flags: None$2,
4310
4305
  id: 'openInIntegratedTerminal',
4311
- label: openInIntegratedTerminal()
4306
+ label: openInIntegratedTerminal$1()
4312
4307
  };
4313
4308
  const menuEntryCut = {
4314
4309
  command: 'Explorer.handleCut',
@@ -5216,11 +5211,12 @@ const handleContextMenuAtIndex = async (state, index, x, y) => {
5216
5211
  number(x);
5217
5212
  number(y);
5218
5213
  const {
5214
+ focusedIndex,
5219
5215
  items,
5220
5216
  uid
5221
5217
  } = state;
5222
5218
  const contextMenuItem = items[index];
5223
- const newItems = contextMenuItem && !contextMenuItem.selected ? items.map(item => ({
5219
+ const newItems = contextMenuItem && index !== focusedIndex && !contextMenuItem.selected ? items.map(item => ({
5224
5220
  ...item,
5225
5221
  selected: false
5226
5222
  })) : items;
@@ -5316,9 +5312,12 @@ const handleCut = async state => {
5316
5312
  }
5317
5313
  const files = dirents.map(dirent => dirent.path);
5318
5314
  await writeNativeFiles('cut', files);
5315
+ await invoke$2('Focus.setFocus', FocusExplorer);
5319
5316
  return {
5320
5317
  ...state,
5321
5318
  cutItems: files,
5319
+ focus: List,
5320
+ focused: true,
5322
5321
  pasteShouldMove: true
5323
5322
  };
5324
5323
  };
@@ -6115,7 +6114,7 @@ const handleDrop = async (state, x, y, fileIds, fileList) => {
6115
6114
 
6116
6115
  const handleEscape = async state => {
6117
6116
  return {
6118
- ...state,
6117
+ ...focusNone(state),
6119
6118
  cutItems: []
6120
6119
  };
6121
6120
  };
@@ -6727,9 +6726,34 @@ const openContainingFolder = async state => {
6727
6726
  return state;
6728
6727
  };
6729
6728
 
6730
- const confirmDelete = async paths => {
6729
+ const directoryTypes = new Set([Directory, DirectoryExpanded, DirectoryExpanding, SymLinkFolder]);
6730
+ const getIntegratedTerminalCwd = state => {
6731
+ const {
6732
+ focusedIndex,
6733
+ items,
6734
+ pathSeparator,
6735
+ root
6736
+ } = state;
6737
+ if (focusedIndex < 0 || focusedIndex >= items.length) {
6738
+ return root;
6739
+ }
6740
+ const item = items[focusedIndex];
6741
+ if (directoryTypes.has(item.type)) {
6742
+ return item.path;
6743
+ }
6744
+ return dirname(pathSeparator, item.path);
6745
+ };
6746
+
6747
+ const openInIntegratedTerminal = async state => {
6748
+ const cwd = getIntegratedTerminalCwd(state);
6749
+ await invoke$2('Layout.openIntegratedTerminal', cwd);
6750
+ return state;
6751
+ };
6752
+
6753
+ const confirmDelete = async items => {
6731
6754
  // TODO use i18n string
6732
- const message = paths.length === 1 ? `Are you sure you want to delete "${paths[0]}"?` : `Are you sure you want to delete ${paths.length} items?`;
6755
+ const names = items.map(item => `"${item.name}"`).join(', ');
6756
+ const message = items.length === 1 ? `Are you sure you want to delete "${items[0].path}"?` : `Are you sure you want to delete ${names}?`;
6733
6757
  const result = await confirm(message);
6734
6758
  return result;
6735
6759
  };
@@ -6753,7 +6777,7 @@ const removeDirent = async state => {
6753
6777
  }
6754
6778
  const toRemove = getPaths(selectedItems);
6755
6779
  if (confirmDelete$1) {
6756
- const confirmed = await confirmDelete(toRemove);
6780
+ const confirmed = await confirmDelete(selectedItems);
6757
6781
  if (!confirmed) {
6758
6782
  return state;
6759
6783
  }
@@ -7997,6 +8021,7 @@ const commandMap = {
7997
8021
  'Explorer.newFile': wrapListItemCommand(newFile),
7998
8022
  'Explorer.newFolder': wrapListItemCommand(newFolder),
7999
8023
  'Explorer.openContainingFolder': wrapListItemCommand(openContainingFolder),
8024
+ 'Explorer.openInIntegratedTerminal': wrapListItemCommand(openInIntegratedTerminal),
8000
8025
  'Explorer.refresh': wrapListItemCommand(refresh),
8001
8026
  'Explorer.removeDirent': wrapListItemCommand(removeDirent),
8002
8027
  'Explorer.renameDirent': wrapListItemCommand(renameDirent),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "7.17.0",
3
+ "version": "7.19.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",