@lvce-editor/explorer-view 7.16.1 → 7.18.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);
@@ -3383,14 +3382,11 @@ const compareNodes = (oldNode, newNode) => {
3383
3382
  }
3384
3383
  const patches = [];
3385
3384
  // Handle reference nodes - special handling for uid changes
3386
- if (oldNode.type === Reference) {
3387
- if (oldNode.uid !== newNode.uid) {
3388
- patches.push({
3389
- type: SetReferenceNodeUid,
3390
- uid: newNode.uid
3391
- });
3392
- }
3393
- return patches;
3385
+ if (oldNode.type === Reference && oldNode.uid !== newNode.uid) {
3386
+ patches.push({
3387
+ type: SetReferenceNodeUid,
3388
+ uid: newNode.uid
3389
+ });
3394
3390
  }
3395
3391
  // Handle text nodes
3396
3392
  if (oldNode.type === Text && newNode.type === Text) {
@@ -3403,8 +3399,8 @@ const compareNodes = (oldNode, newNode) => {
3403
3399
  return patches;
3404
3400
  }
3405
3401
  // Compare attributes
3406
- const oldKeys = getKeys(oldNode);
3407
- const newKeys = getKeys(newNode);
3402
+ const oldKeys = getKeys(oldNode).filter(key => oldNode.type !== Reference || key !== 'uid');
3403
+ const newKeys = getKeys(newNode).filter(key => newNode.type !== Reference || key !== 'uid');
3408
3404
  // Check for attribute changes
3409
3405
  for (const key of newKeys) {
3410
3406
  if (oldNode[key] !== newNode[key]) {
@@ -3428,9 +3424,14 @@ const compareNodes = (oldNode, newNode) => {
3428
3424
  };
3429
3425
 
3430
3426
  const treeToArray = node => {
3431
- const result = [node.node];
3432
- for (const child of node.children) {
3433
- result.push(...treeToArray(child));
3427
+ const result = [];
3428
+ const stack = [node];
3429
+ while (stack.length > 0) {
3430
+ const current = stack.pop();
3431
+ result.push(current.node);
3432
+ for (let i = current.children.length - 1; i >= 0; i--) {
3433
+ stack.push(current.children[i]);
3434
+ }
3434
3435
  }
3435
3436
  return result;
3436
3437
  };
@@ -4303,10 +4304,10 @@ const menuEntryOpenContainingFolder = {
4303
4304
  label: openContainingFolder$1()
4304
4305
  };
4305
4306
  const menuEntryOpenInIntegratedTerminal = {
4306
- command: /* TODO */'-1',
4307
+ command: 'Explorer.openInIntegratedTerminal',
4307
4308
  flags: None$2,
4308
4309
  id: 'openInIntegratedTerminal',
4309
- label: openInIntegratedTerminal()
4310
+ label: openInIntegratedTerminal$1()
4310
4311
  };
4311
4312
  const menuEntryCut = {
4312
4313
  command: 'Explorer.handleCut',
@@ -6725,6 +6726,30 @@ const openContainingFolder = async state => {
6725
6726
  return state;
6726
6727
  };
6727
6728
 
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
+
6728
6753
  const confirmDelete = async paths => {
6729
6754
  // TODO use i18n string
6730
6755
  const message = paths.length === 1 ? `Are you sure you want to delete "${paths[0]}"?` : `Are you sure you want to delete ${paths.length} items?`;
@@ -7995,6 +8020,7 @@ const commandMap = {
7995
8020
  'Explorer.newFile': wrapListItemCommand(newFile),
7996
8021
  'Explorer.newFolder': wrapListItemCommand(newFolder),
7997
8022
  'Explorer.openContainingFolder': wrapListItemCommand(openContainingFolder),
8023
+ 'Explorer.openInIntegratedTerminal': wrapListItemCommand(openInIntegratedTerminal),
7998
8024
  'Explorer.refresh': wrapListItemCommand(refresh),
7999
8025
  'Explorer.removeDirent': wrapListItemCommand(removeDirent),
8000
8026
  'Explorer.renameDirent': wrapListItemCommand(renameDirent),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "7.16.1",
3
+ "version": "7.18.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",