@lvce-editor/explorer-view 2.61.0 → 2.62.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.
@@ -2021,7 +2021,8 @@ const create2 = (uid, uri, x, y, width, height, args, parentUid, platform = 0) =
2021
2021
  scrollBarHeight: 0,
2022
2022
  confirmPaste: false,
2023
2023
  pasteShouldMove: false,
2024
- cutItems: []
2024
+ cutItems: [],
2025
+ isPointerDown: false
2025
2026
  };
2026
2027
  set(uid, state, state);
2027
2028
  };
@@ -2070,7 +2071,8 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) =>
2070
2071
  scrollBarHeight: 0,
2071
2072
  confirmPaste: false,
2072
2073
  pasteShouldMove: false,
2073
- cutItems: []
2074
+ cutItems: [],
2075
+ isPointerDown: false
2074
2076
  };
2075
2077
  set(state.uid, state, state);
2076
2078
  return state;
@@ -2081,6 +2083,7 @@ const RenderFocus = 6;
2081
2083
  const RenderFocusContext = 7;
2082
2084
  const RenderValue = 8;
2083
2085
  const RenderSelection = 9;
2086
+ const RenderDragData = 10;
2084
2087
 
2085
2088
  const diffType$3 = RenderFocus;
2086
2089
  const isEqual$4 = (oldState, newState) => {
@@ -2408,7 +2411,7 @@ const focusPrevious = state => {
2408
2411
  }
2409
2412
  };
2410
2413
 
2411
- const commandIds = ['acceptEdit', 'cancelEdit', 'cancelTypeAhead', 'collapseAll', 'copyPath', 'copyRelativePath', 'dispose', 'expandAll', 'expandRecursively', 'focus', 'focusFirst', 'focusIndex', 'focusLast', 'handleCut', 'selectIndices', 'toggleIndividualSelection', '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'];
2414
+ 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', 'handleCut', 'handleDragLeave', 'handleDragOver', 'handleDragStart', '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', 'selectIndices', 'selectUp', 'setDeltaY', 'setSelectedIndices', 'toggleIndividualSelection', 'updateEditingValue', 'updateIcons'];
2412
2415
 
2413
2416
  const getCommandIds = () => {
2414
2417
  return commandIds;
@@ -3260,14 +3263,6 @@ const handleCut = async state => {
3260
3263
 
3261
3264
  const handleDragLeave = state => {
3262
3265
  return state;
3263
- // const { dropTargets } = state
3264
- // if (dropTargets.length === 0) {
3265
- // return state
3266
- // }
3267
- // return {
3268
- // ...state,
3269
- // dropTargets: [],
3270
- // }
3271
3266
  };
3272
3267
 
3273
3268
  const canBeDroppedInto = dirent => {
@@ -3333,6 +3328,10 @@ const handleDragOver = (state, x, y) => {
3333
3328
  };
3334
3329
  };
3335
3330
 
3331
+ const handleDragStart = state => {
3332
+ return state;
3333
+ };
3334
+
3336
3335
  const isExpanded = item => {
3337
3336
  return item.type === DirectoryExpanded || item.type === DirectoryExpanding;
3338
3337
  };
@@ -4611,6 +4610,15 @@ const renameDirent = state => {
4611
4610
  };
4612
4611
  };
4613
4612
 
4613
+ const renderDragData = (oldState, newState) => {
4614
+ // TODO send selected urls
4615
+ const dragData = [{
4616
+ type: 'text/plain',
4617
+ data: 'https://example.com'
4618
+ }];
4619
+ return ['Viewlet.setDragData', newState.uid, dragData];
4620
+ };
4621
+
4614
4622
  const ExplorerInput = 'ExplorerInput';
4615
4623
 
4616
4624
  const renderEditingSelection = (oldState, newState) => {
@@ -4734,6 +4742,7 @@ const HandleListBlur = 11;
4734
4742
  const HandleListFocus = 12;
4735
4743
  const HandlePointerDown = 14;
4736
4744
  const HandleWheel = 15;
4745
+ const HandleDragStart = 17;
4737
4746
 
4738
4747
  const getExplorerWelcomeVirtualDom = isWide => {
4739
4748
  return [{
@@ -4847,7 +4856,8 @@ const getExplorerItemVirtualDom = item => {
4847
4856
  path,
4848
4857
  setSize,
4849
4858
  posInSet,
4850
- isCut
4859
+ isCut,
4860
+ index
4851
4861
  } = item;
4852
4862
  const chevronDom = getChevronVirtualDom(chevron);
4853
4863
  return [{
@@ -4864,7 +4874,8 @@ const getExplorerItemVirtualDom = item => {
4864
4874
  ariaLabel: name,
4865
4875
  ariaExpanded,
4866
4876
  ariaDescription: '',
4867
- id
4877
+ id,
4878
+ 'data-index': index
4868
4879
  }, ...chevronDom, getFileIconVirtualDom(icon), ...getInputOrLabelDom(isEditing, hasEditingError, name, isCut)];
4869
4880
  };
4870
4881
 
@@ -5072,7 +5083,8 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
5072
5083
  chevron,
5073
5084
  id,
5074
5085
  className,
5075
- isCut
5086
+ isCut,
5087
+ index: i
5076
5088
  });
5077
5089
  }
5078
5090
  return visible;
@@ -5139,6 +5151,8 @@ const getRenderer = diffType => {
5139
5151
  return renderValue;
5140
5152
  case RenderSelection:
5141
5153
  return renderEditingSelection;
5154
+ case RenderDragData:
5155
+ return renderDragData;
5142
5156
  default:
5143
5157
  throw new Error('unknown renderer');
5144
5158
  }
@@ -5310,6 +5324,13 @@ const renderEventListeners = () => {
5310
5324
  }, {
5311
5325
  name: HandleDragLeave,
5312
5326
  params: ['handleDragLeave']
5327
+ }, {
5328
+ name: HandleDragStart,
5329
+ params: ['handleDragStart'],
5330
+ // @ts-ignore
5331
+ dragInfo: {
5332
+ 'text/uri': 'abc'
5333
+ }
5313
5334
  }];
5314
5335
  };
5315
5336
 
@@ -5606,6 +5627,7 @@ const commandMap = {
5606
5627
  'Explorer.focusFirst': wrapCommand(focusFirst),
5607
5628
  'Explorer.focusIndex': wrapCommand(focusIndex),
5608
5629
  'Explorer.focusLast': wrapCommand(focusLast),
5630
+ 'Explorer.handleDragStart': wrapCommand(handleDragStart),
5609
5631
  'Explorer.focusNext': wrapCommand(focusNext),
5610
5632
  'Explorer.focusNone': wrapCommand(focusNone),
5611
5633
  'Explorer.focusPrevious': wrapCommand(focusPrevious),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "2.61.0",
3
+ "version": "2.62.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",