@lvce-editor/explorer-view 3.20.0 → 3.22.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.
@@ -1173,6 +1173,7 @@ const RendererWorker$1 = 1;
1173
1173
  const FocusElementByName = 'Viewlet.focusElementByName';
1174
1174
  const FocusSelector = 'Viewlet.focusSelector';
1175
1175
  const SetCss = 'Viewlet.setCss';
1176
+ const SetDom2 = 'Viewlet.setDom2';
1176
1177
  const SetFocusContext = 'Viewlet.setFocusContext';
1177
1178
 
1178
1179
  const FocusExplorer = 13;
@@ -1691,19 +1692,18 @@ const copy$1 = async (oldUri, newUri) => {
1691
1692
  };
1692
1693
 
1693
1694
  const applyOperation = operation => {
1694
- if (operation.type === CreateFolder$1) {
1695
- return mkdir(operation.path);
1696
- }
1697
- if (operation.type === Copy$1) {
1698
- return copy$1(operation.from || '', operation.path);
1699
- }
1700
- if (operation.type === Rename$2) {
1701
- return rename$1(operation.from || '', operation.path);
1702
- }
1703
- if (operation.type === Remove) {
1704
- return remove(operation.path);
1695
+ switch (operation.type) {
1696
+ case CreateFolder$1:
1697
+ return mkdir(operation.path);
1698
+ case Copy$1:
1699
+ return copy$1(operation.from || '', operation.path);
1700
+ case Rename$2:
1701
+ return rename$1(operation.from || '', operation.path);
1702
+ case Remove:
1703
+ return remove(operation.path);
1704
+ default:
1705
+ return writeFile(operation.path, operation.text);
1705
1706
  }
1706
- return writeFile(operation.path, operation.text);
1707
1707
  };
1708
1708
 
1709
1709
  const applyFileOperations = async operations => {
@@ -2776,7 +2776,6 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
2776
2776
  const {
2777
2777
  get,
2778
2778
  set,
2779
- wrapCommand,
2780
2779
  registerCommands,
2781
2780
  getCommandIds,
2782
2781
  wrapGetter
@@ -2807,6 +2806,9 @@ const wrapListItemCommand = fn => {
2807
2806
  const intermediate = get(id);
2808
2807
  set(id, intermediate.oldState, updatedState);
2809
2808
  const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, items.length);
2809
+ if (items === intermediate.newState.items && minLineY === intermediate.newState.minLineY && editingIcon === intermediate.newState.editingIcon && cutItems === intermediate.newState.cutItems && editingErrorMessage === intermediate.newState.editingErrorMessage) {
2810
+ return;
2811
+ }
2810
2812
  const visible = items.slice(minLineY, maxLineY);
2811
2813
  const {
2812
2814
  icons,
@@ -5741,28 +5743,19 @@ const getExplorerVirtualDom = (visibleItems, focusedIndex, root, isWide, focused
5741
5743
 
5742
5744
  const renderItems = (oldState, newState) => {
5743
5745
  const {
5744
- cutItems,
5745
- sourceControlIgnoredUris,
5746
5746
  deltaY,
5747
5747
  dropTargets,
5748
5748
  editingErrorMessage,
5749
- editingIcon,
5750
- editingIndex,
5751
- editingType,
5752
- editingValue,
5753
5749
  focused,
5754
5750
  focusedIndex,
5755
5751
  height,
5756
- icons,
5757
5752
  itemHeight,
5758
5753
  items,
5759
- maxLineY,
5760
5754
  minLineY,
5761
5755
  root,
5762
- useChevrons,
5763
5756
  width
5764
5757
  } = newState;
5765
- const visibleDirents = getVisibleExplorerItems(items, minLineY, maxLineY, focusedIndex, editingIndex, editingType, editingValue, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems, sourceControlIgnoredUris);
5758
+ const visibleDirents = newState.visibleExplorerItems;
5766
5759
  const isWide = width > 450;
5767
5760
  const contentHeight = items.length * itemHeight;
5768
5761
  const depth = items[focusedIndex]?.depth || 0;
@@ -5776,7 +5769,7 @@ const renderItems = (oldState, newState) => {
5776
5769
  left
5777
5770
  } = getErrorMessagePosition(itemHeight, focusedIndex, minLineY, depth, indent, fileIconWidth, padding + defaultPaddingLeft + chevronSpace);
5778
5771
  const dom = getExplorerVirtualDom(visibleDirents, focusedIndex, root, isWide, focused, dropTargets, height, contentHeight, deltaY, editingErrorMessage, top, left);
5779
- return ['Viewlet.setDom2', dom];
5772
+ return [SetDom2, dom];
5780
5773
  };
5781
5774
 
5782
5775
  const renderValue = (oldState, newState) => {
@@ -6258,69 +6251,69 @@ const updateEditingValue = async (state, value, inputSource = User) => {
6258
6251
  const commandMap = {
6259
6252
  'Explorer.acceptEdit': wrapListItemCommand(acceptEdit),
6260
6253
  'Explorer.cancelEdit': wrapListItemCommand(cancelEdit),
6261
- 'Explorer.cancelTypeAhead': wrapCommand(cancelTypeAhead),
6254
+ 'Explorer.cancelTypeAhead': wrapListItemCommand(cancelTypeAhead),
6262
6255
  'Explorer.collapseAll': wrapListItemCommand(collapseAll),
6263
- 'Explorer.copyPath': wrapCommand(copyPath),
6264
- 'Explorer.copyRelativePath': wrapCommand(copyRelativePath),
6256
+ 'Explorer.copyPath': wrapListItemCommand(copyPath),
6257
+ 'Explorer.copyRelativePath': wrapListItemCommand(copyRelativePath),
6265
6258
  'Explorer.expandAll': wrapListItemCommand(expandAll),
6266
6259
  'Explorer.expandRecursively': wrapListItemCommand(expandRecursively),
6267
- 'Explorer.focus': wrapCommand(focus),
6268
- 'Explorer.focusFirst': wrapCommand(focusFirst),
6269
- 'Explorer.focusIndex': wrapCommand(focusIndex),
6270
- 'Explorer.focusLast': wrapCommand(focusLast),
6271
- 'Explorer.handleDragStart': wrapCommand(handleDragStart),
6272
- 'Explorer.handleDragOverIndex': wrapCommand(handleDragOverIndex),
6273
- 'Explorer.focusNext': wrapCommand(focusNext),
6274
- 'Explorer.focusNone': wrapCommand(focusNone),
6275
- 'Explorer.focusPrevious': wrapCommand(focusPrevious),
6260
+ 'Explorer.focus': wrapListItemCommand(focus),
6261
+ 'Explorer.focusFirst': wrapListItemCommand(focusFirst),
6262
+ 'Explorer.focusIndex': wrapListItemCommand(focusIndex),
6263
+ 'Explorer.focusLast': wrapListItemCommand(focusLast),
6264
+ 'Explorer.handleDragStart': wrapListItemCommand(handleDragStart),
6265
+ 'Explorer.handleDragOverIndex': wrapListItemCommand(handleDragOverIndex),
6266
+ 'Explorer.focusNext': wrapListItemCommand(focusNext),
6267
+ 'Explorer.focusNone': wrapListItemCommand(focusNone),
6268
+ 'Explorer.focusPrevious': wrapListItemCommand(focusPrevious),
6276
6269
  'Explorer.getCommandIds': getCommandIds,
6277
6270
  'Explorer.getMenuEntries2': getMenuEntries2,
6278
6271
  'Explorer.getMouseActions': getMouseActions,
6279
- 'Explorer.handleArrowLeft': wrapCommand(handleArrowLeft),
6280
- 'Explorer.handleArrowRight': wrapCommand(handleArrowRight),
6281
- 'Explorer.handleEscape': wrapCommand(handleEscape),
6282
- 'Explorer.handleBlur': wrapCommand(handleBlur),
6272
+ 'Explorer.handleArrowLeft': wrapListItemCommand(handleArrowLeft),
6273
+ 'Explorer.handleArrowRight': wrapListItemCommand(handleArrowRight),
6274
+ 'Explorer.handleEscape': wrapListItemCommand(handleEscape),
6275
+ 'Explorer.handleBlur': wrapListItemCommand(handleBlur),
6283
6276
  'Explorer.handleClick': wrapListItemCommand(handleClick),
6284
- 'Explorer.handleClickAt': wrapCommand(handleClickAt),
6285
- 'Explorer.handleClickCurrent': wrapCommand(handleClickCurrent),
6286
- 'Explorer.handleClickCurrentButKeepFocus': wrapCommand(handleClickCurrentButKeepFocus),
6287
- 'Explorer.handleClickOpenFolder': wrapCommand(handleClickOpenFolder),
6288
- 'Explorer.handleContextMenu': wrapCommand(handleContextMenu),
6289
- 'Explorer.handleContextMenuKeyboard': wrapCommand(handleContextMenuKeyboard),
6290
- 'Explorer.handleCopy': wrapCommand(handleCopy),
6291
- 'Explorer.handleCut': wrapCommand(handleCut),
6292
- 'Explorer.handleDragLeave': wrapCommand(handleDragLeave),
6293
- 'Explorer.handleDragOver': wrapCommand(handleDragOver),
6294
- 'Explorer.handleDrop': wrapCommand(handleDrop),
6295
- 'Explorer.handleFocus': wrapCommand(handleFocus),
6296
- 'Explorer.handleIconThemeChange': wrapCommand(handleIconThemeChange),
6297
- 'Explorer.handleInputBlur': wrapCommand(handleInputBlur),
6298
- 'Explorer.handleInputClick': wrapCommand(handleInputClick),
6299
- 'Explorer.handleInputKeyDown': wrapCommand(handleInputKeyDown),
6300
- 'Explorer.handleKeyDown': wrapCommand(handleKeyDown),
6277
+ 'Explorer.handleClickAt': wrapListItemCommand(handleClickAt),
6278
+ 'Explorer.handleClickCurrent': wrapListItemCommand(handleClickCurrent),
6279
+ 'Explorer.handleClickCurrentButKeepFocus': wrapListItemCommand(handleClickCurrentButKeepFocus),
6280
+ 'Explorer.handleClickOpenFolder': wrapListItemCommand(handleClickOpenFolder),
6281
+ 'Explorer.handleContextMenu': wrapListItemCommand(handleContextMenu),
6282
+ 'Explorer.handleContextMenuKeyboard': wrapListItemCommand(handleContextMenuKeyboard),
6283
+ 'Explorer.handleCopy': wrapListItemCommand(handleCopy),
6284
+ 'Explorer.handleCut': wrapListItemCommand(handleCut),
6285
+ 'Explorer.handleDragLeave': wrapListItemCommand(handleDragLeave),
6286
+ 'Explorer.handleDragOver': wrapListItemCommand(handleDragOver),
6287
+ 'Explorer.handleDrop': wrapListItemCommand(handleDrop),
6288
+ 'Explorer.handleFocus': wrapListItemCommand(handleFocus),
6289
+ 'Explorer.handleIconThemeChange': wrapListItemCommand(handleIconThemeChange),
6290
+ 'Explorer.handleInputBlur': wrapListItemCommand(handleInputBlur),
6291
+ 'Explorer.handleInputClick': wrapListItemCommand(handleInputClick),
6292
+ 'Explorer.handleInputKeyDown': wrapListItemCommand(handleInputKeyDown),
6293
+ 'Explorer.handleKeyDown': wrapListItemCommand(handleKeyDown),
6301
6294
  'Explorer.handlePaste': wrapListItemCommand(handlePaste),
6302
- 'Explorer.handlePointerDown': wrapCommand(handlePointerDown),
6303
- 'Explorer.handleUpload': wrapCommand(handleUpload),
6304
- 'Explorer.handleWheel': wrapCommand(handleWheel),
6295
+ 'Explorer.handlePointerDown': wrapListItemCommand(handlePointerDown),
6296
+ 'Explorer.handleUpload': wrapListItemCommand(handleUpload),
6297
+ 'Explorer.handleWheel': wrapListItemCommand(handleWheel),
6305
6298
  'Explorer.handleWorkspaceChange': wrapListItemCommand(handleWorkspaceChange),
6306
6299
  'Explorer.loadContent': wrapListItemCommand(loadContent),
6307
6300
  'Explorer.newFile': wrapListItemCommand(newFile),
6308
6301
  'Explorer.newFolder': wrapListItemCommand(newFolder),
6309
- 'Explorer.openContainingFolder': wrapCommand(openContainingFolder),
6302
+ 'Explorer.openContainingFolder': wrapListItemCommand(openContainingFolder),
6310
6303
  'Explorer.refresh': wrapListItemCommand(refresh),
6311
6304
  'Explorer.removeDirent': wrapListItemCommand(removeDirent),
6312
6305
  'Explorer.renameDirent': wrapListItemCommand(renameDirent),
6313
6306
  'Explorer.restoreState': restoreState,
6314
- 'Explorer.revealItem': wrapCommand(revealItem),
6315
- 'Explorer.selectAll': wrapCommand(selectAll),
6316
- 'Explorer.selectDown': wrapCommand(selectDown),
6317
- 'Explorer.selectIndices': wrapCommand(setSelectedIndices),
6318
- 'Explorer.selectUp': wrapCommand(selectUp),
6307
+ 'Explorer.revealItem': wrapListItemCommand(revealItem),
6308
+ 'Explorer.selectAll': wrapListItemCommand(selectAll),
6309
+ 'Explorer.selectDown': wrapListItemCommand(selectDown),
6310
+ 'Explorer.selectIndices': wrapListItemCommand(setSelectedIndices),
6311
+ 'Explorer.selectUp': wrapListItemCommand(selectUp),
6319
6312
  'Explorer.setDeltaY': wrapListItemCommand(setDeltaY),
6320
- 'Explorer.setSelectedIndices': wrapCommand(setSelectedIndices),
6321
- 'Explorer.toggleIndividualSelection': wrapCommand(toggleIndividualSelection),
6322
- 'Explorer.updateEditingValue': wrapCommand(updateEditingValue),
6323
- 'Explorer.updateIcons': wrapCommand(updateIcons),
6313
+ 'Explorer.setSelectedIndices': wrapListItemCommand(setSelectedIndices),
6314
+ 'Explorer.toggleIndividualSelection': wrapListItemCommand(toggleIndividualSelection),
6315
+ 'Explorer.updateEditingValue': wrapListItemCommand(updateEditingValue),
6316
+ 'Explorer.updateIcons': wrapListItemCommand(updateIcons),
6324
6317
  // not wrapped
6325
6318
  'Explorer.create2': create2,
6326
6319
  'Explorer.diff2': diff2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "3.20.0",
3
+ "version": "3.22.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",