@lvce-editor/explorer-view 2.43.0 → 2.44.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.
@@ -431,7 +431,7 @@ const create$4 = (method, params) => {
431
431
  };
432
432
  };
433
433
  const callbacks = Object.create(null);
434
- const set$3 = (id, fn) => {
434
+ const set$2 = (id, fn) => {
435
435
  callbacks[id] = fn;
436
436
  };
437
437
  const get$2 = id => {
@@ -450,7 +450,7 @@ const registerPromise = () => {
450
450
  resolve,
451
451
  promise
452
452
  } = Promise.withResolvers();
453
- set$3(id, resolve);
453
+ set$2(id, resolve);
454
454
  return {
455
455
  id,
456
456
  promise
@@ -761,7 +761,7 @@ const send = (transport, method, ...params) => {
761
761
  const message = create$4(method, params);
762
762
  transport.send(message);
763
763
  };
764
- const invoke$3 = (ipc, method, ...params) => {
764
+ const invoke$2 = (ipc, method, ...params) => {
765
765
  return invokeHelper(ipc, method, params, false);
766
766
  };
767
767
  const invokeAndTransfer = (ipc, method, ...params) => {
@@ -794,7 +794,7 @@ const createRpc = ipc => {
794
794
  send(ipc, method, ...params);
795
795
  },
796
796
  invoke(method, ...params) {
797
- return invoke$3(ipc, method, ...params);
797
+ return invoke$2(ipc, method, ...params);
798
798
  },
799
799
  invokeAndTransfer(method, ...params) {
800
800
  return invokeAndTransfer(ipc, method, ...params);
@@ -851,7 +851,7 @@ const WebWorkerRpcClient = {
851
851
  };
852
852
 
853
853
  const rpcs = Object.create(null);
854
- const set$7 = (id, rpc) => {
854
+ const set$9 = (id, rpc) => {
855
855
  rpcs[id] = rpc;
856
856
  };
857
857
  const get$1 = id => {
@@ -875,19 +875,19 @@ const create$2 = rpcId => {
875
875
  return rpc.invokeAndTransfer(method, ...params);
876
876
  },
877
877
  set(rpc) {
878
- set$7(rpcId, rpc);
878
+ set$9(rpcId, rpc);
879
879
  }
880
880
  };
881
881
  };
882
882
  const RendererWorker$1 = 1;
883
883
  const {
884
- invoke: invoke$2,
885
- set: set$2
884
+ invoke: invoke$4,
885
+ set: set$4
886
886
  } = create$2(RendererWorker$1);
887
887
  const RendererWorker = {
888
888
  __proto__: null,
889
- invoke: invoke$2,
890
- set: set$2
889
+ invoke: invoke$4,
890
+ set: set$4
891
891
  };
892
892
 
893
893
  const {
@@ -2279,7 +2279,7 @@ const focusPrevious = state => {
2279
2279
  }
2280
2280
  };
2281
2281
 
2282
- const commandIds = ['acceptEdit', 'cancelEdit', 'collapseAll', 'copyPath', 'copyRelativePath', 'dispose', 'expandAll', 'expandRecursively', 'focus', 'focusFirst', 'focusIndex', 'focusLast', 'focusNext', 'focusNone', 'handleInputKeyDown', 'focusPrevious', 'getFocusedDirent', 'getMenuEntries2', 'getMouseActions', 'handleArrowLeft', 'handleArrowLeft', 'handleArrowRight', 'handleArrowRight', 'handleBlur', 'handleClick', 'handleClickAt', 'handleClickCurrent', 'handleClickCurrentButKeepFocus', 'handleClickOpenFolder', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleCopy', 'handleDragLeave', 'handleDragOver', 'handleDrop', 'handleFocus', 'handleIconThemeChange', 'handleInputBlur', 'handleInputClick', 'handleLanguagesChanged', 'handleMouseEnter', 'handleMouseLeave', 'handlePaste', 'handlePointerDown', 'handleUpload', 'handleWheel', 'handleWorkspaceChange', 'hotReload', 'newFile', 'newFolder', 'openContainingFolder', 'refresh', 'removeDirent', 'rename', 'renameDirent', 'renderEventListeners', 'revealItem', 'revealItem', 'scrollDown', 'scrollUp', 'selectAll', 'selectDown', 'selectUp', 'setDeltaY', 'setSelectedIndices', 'cancelTypeAhead', 'updateEditingValue', 'handleKeyDown', 'updateIcons'];
2282
+ const commandIds = ['acceptEdit', 'cancelEdit', 'cancelTypeAhead', 'collapseAll', 'copyPath', 'copyRelativePath', 'dispose', 'expandAll', 'expandRecursively', 'focus', 'focusFirst', 'focusIndex', 'focusLast', 'focusNext', 'focusNone', 'focusPrevious', 'getFocusedDirent', 'getMenuEntries2', 'getMouseActions', 'handleArrowLeft', 'handleArrowLeft', 'handleArrowRight', 'handleArrowRight', 'handleBlur', 'handleClick', 'handleClickAt', 'handleClickCurrent', 'handleClickCurrentButKeepFocus', 'handleClickOpenFolder', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleCopy', 'handleDragLeave', 'handleDragOver', 'handleDrop', 'handleFocus', 'handleIconThemeChange', 'handleInputBlur', 'handleInputClick', 'handleInputKeyDown', 'handleKeyDown', 'handleLanguagesChanged', 'handleMouseEnter', 'handleMouseLeave', 'handlePaste', 'handlePointerDown', 'handleUpload', 'handleWheel', 'handleWorkspaceChange', 'hotReload', 'newFile', 'newFolder', 'openContainingFolder', 'refresh', 'removeDirent', 'rename', 'renameDirent', 'renderEventListeners', 'revealItem', 'revealItem', 'scrollDown', 'scrollUp', 'selectAll', 'selectDown', 'selectUp', 'setDeltaY', 'setSelectedIndices', 'updateEditingValue', 'updateIcons'];
2283
2283
 
2284
2284
  const getCommandIds = () => {
2285
2285
  return commandIds;
@@ -4071,6 +4071,18 @@ const getNewDirentType = editingType => {
4071
4071
  }
4072
4072
  };
4073
4073
 
4074
+ const isFolder = direntType => {
4075
+ return direntType === Directory || direntType === DirectoryExpanded || direntType === SymLinkFolder;
4076
+ };
4077
+ const getFittingIndex = (dirents, startIndex) => {
4078
+ for (let i = startIndex; i >= 0; i--) {
4079
+ const dirent = dirents[i];
4080
+ if (isFolder(dirent.type)) {
4081
+ return i;
4082
+ }
4083
+ }
4084
+ return -1;
4085
+ };
4074
4086
  const newDirent = async (state, editingType) => {
4075
4087
  // TODO make focus functional instead of side effect
4076
4088
  await setFocus(ExplorerEditBox);
@@ -4084,8 +4096,9 @@ const newDirent = async (state, editingType) => {
4084
4096
  fileIconCache,
4085
4097
  root
4086
4098
  } = state;
4099
+ const index = getFittingIndex(items, focusedIndex);
4087
4100
  const direntType = getNewDirentType(editingType);
4088
- const newDirents = await getNewDirentsForNewDirent(items, focusedIndex, direntType, root);
4101
+ const newDirents = await getNewDirentsForNewDirent(items, index, direntType, root);
4089
4102
  const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, newDirents.length);
4090
4103
  const visible = newDirents.slice(minLineY, maxLineY);
4091
4104
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "2.43.0",
3
+ "version": "2.44.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",