@lvce-editor/explorer-view 2.62.0 → 3.0.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.
- package/dist/explorerViewWorkerMain.js +81 -36
- package/package.json +1 -1
|
@@ -2085,6 +2085,11 @@ const RenderValue = 8;
|
|
|
2085
2085
|
const RenderSelection = 9;
|
|
2086
2086
|
const RenderDragData = 10;
|
|
2087
2087
|
|
|
2088
|
+
const diffType$4 = RenderDragData;
|
|
2089
|
+
const isEqual$5 = (oldState, newState) => {
|
|
2090
|
+
return oldState.isPointerDown || !newState.isPointerDown;
|
|
2091
|
+
};
|
|
2092
|
+
|
|
2088
2093
|
const diffType$3 = RenderFocus;
|
|
2089
2094
|
const isEqual$4 = (oldState, newState) => {
|
|
2090
2095
|
return oldState.focused === newState.focused && oldState.focus === newState.focus;
|
|
@@ -2108,8 +2113,8 @@ const isEqual$1 = (oldState, newState) => {
|
|
|
2108
2113
|
return oldState.focus === Input$1 && newState.focus === Input$1 && oldState.editingValue === newState.editingValue;
|
|
2109
2114
|
};
|
|
2110
2115
|
|
|
2111
|
-
const modules = [isEqual$3, isEqual$4, isEqual$4, isEqual$1, isEqual$2];
|
|
2112
|
-
const numbers = [diffType$2, diffType$3, RenderFocusContext, diffType, diffType$1];
|
|
2116
|
+
const modules = [isEqual$3, isEqual$4, isEqual$4, isEqual$1, isEqual$2, isEqual$5];
|
|
2117
|
+
const numbers = [diffType$2, diffType$3, RenderFocusContext, diffType, diffType$1, diffType$4];
|
|
2113
2118
|
|
|
2114
2119
|
const diff = (oldState, newState) => {
|
|
2115
2120
|
const diffResult = [];
|
|
@@ -2930,9 +2935,19 @@ const handleArrowRight = async state => {
|
|
|
2930
2935
|
const handleBlur = async state => {
|
|
2931
2936
|
// TODO when blur event occurs because of context menu, focused index should stay the same
|
|
2932
2937
|
// but focus outline should be removed
|
|
2938
|
+
const {
|
|
2939
|
+
items
|
|
2940
|
+
} = state;
|
|
2941
|
+
const newItems = items.map(item => {
|
|
2942
|
+
return {
|
|
2943
|
+
...item,
|
|
2944
|
+
selected: false
|
|
2945
|
+
};
|
|
2946
|
+
});
|
|
2933
2947
|
return {
|
|
2934
2948
|
...state,
|
|
2935
|
-
focused: false
|
|
2949
|
+
focused: false,
|
|
2950
|
+
items: newItems
|
|
2936
2951
|
};
|
|
2937
2952
|
};
|
|
2938
2953
|
|
|
@@ -3648,8 +3663,7 @@ const handleDropIntoFile = (state, dirent, index, fileHandles, files, paths) =>
|
|
|
3648
3663
|
if (parentIndex === -1) {
|
|
3649
3664
|
return handleDropRoot(state, fileHandles, files, paths);
|
|
3650
3665
|
}
|
|
3651
|
-
|
|
3652
|
-
return handleDropIndex(parentIndex);
|
|
3666
|
+
return handleDropIndex(state, fileHandles, files, paths, parentIndex);
|
|
3653
3667
|
};
|
|
3654
3668
|
const handleDropIndex = async (state, fileHandles, files, paths, index) => {
|
|
3655
3669
|
const {
|
|
@@ -4076,7 +4090,10 @@ const handlePointerDown = (state, button, x, y) => {
|
|
|
4076
4090
|
focus: List
|
|
4077
4091
|
};
|
|
4078
4092
|
}
|
|
4079
|
-
return
|
|
4093
|
+
return {
|
|
4094
|
+
...state,
|
|
4095
|
+
focusedIndex: index
|
|
4096
|
+
};
|
|
4080
4097
|
};
|
|
4081
4098
|
|
|
4082
4099
|
const handleUpload = async (state, dirents) => {
|
|
@@ -4610,12 +4627,41 @@ const renameDirent = state => {
|
|
|
4610
4627
|
};
|
|
4611
4628
|
};
|
|
4612
4629
|
|
|
4613
|
-
const
|
|
4614
|
-
|
|
4630
|
+
const getDragLabel = urls => {
|
|
4631
|
+
if (urls.length === 1) {
|
|
4632
|
+
return urls[0];
|
|
4633
|
+
}
|
|
4634
|
+
return `${urls.length}`;
|
|
4635
|
+
};
|
|
4636
|
+
|
|
4637
|
+
const toUri = path => {
|
|
4638
|
+
if (path.startsWith('file://')) {
|
|
4639
|
+
return path;
|
|
4640
|
+
}
|
|
4641
|
+
return 'file://' + path;
|
|
4642
|
+
};
|
|
4643
|
+
const getDragData = urls => {
|
|
4644
|
+
const data = urls.map(toUri).join('\n');
|
|
4615
4645
|
const dragData = [{
|
|
4646
|
+
type: 'text/uri-list',
|
|
4647
|
+
data
|
|
4648
|
+
}, {
|
|
4616
4649
|
type: 'text/plain',
|
|
4617
|
-
data
|
|
4650
|
+
data
|
|
4618
4651
|
}];
|
|
4652
|
+
// @ts-ignore
|
|
4653
|
+
dragData.label = getDragLabel(urls);
|
|
4654
|
+
return dragData;
|
|
4655
|
+
};
|
|
4656
|
+
|
|
4657
|
+
const renderDragData = (oldState, newState) => {
|
|
4658
|
+
const {
|
|
4659
|
+
items,
|
|
4660
|
+
focusedIndex
|
|
4661
|
+
} = newState;
|
|
4662
|
+
const selected = items.filter((item, index) => item.selected || index === focusedIndex);
|
|
4663
|
+
const urls = selected.map(item => item.path);
|
|
4664
|
+
const dragData = getDragData(urls);
|
|
4619
4665
|
return ['Viewlet.setDragData', newState.uid, dragData];
|
|
4620
4666
|
};
|
|
4621
4667
|
|
|
@@ -4905,6 +4951,7 @@ const getListItemsVirtualDom = (visibleItems, focusedIndex, focused, dropTargets
|
|
|
4905
4951
|
onContextMenu: HandleContextMenu,
|
|
4906
4952
|
onDragLeave: HandleDragLeave,
|
|
4907
4953
|
onDragOver: HandleDragOver,
|
|
4954
|
+
onDragStart: HandleDragStart,
|
|
4908
4955
|
onDrop: HandleDrop,
|
|
4909
4956
|
onFocus: HandleListFocus,
|
|
4910
4957
|
onPointerDown: HandlePointerDown,
|
|
@@ -5010,16 +5057,15 @@ const getExpandedType = type => {
|
|
|
5010
5057
|
}
|
|
5011
5058
|
};
|
|
5012
5059
|
|
|
5013
|
-
const
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
return focused;
|
|
5060
|
+
const getTreeItemClassName = (isSelected, isFocused, isDropping) => {
|
|
5061
|
+
let className = TreeItem;
|
|
5062
|
+
if (isSelected || isFocused) {
|
|
5063
|
+
className = mergeClassNames(className, TreeItemActive);
|
|
5018
5064
|
}
|
|
5019
|
-
if (
|
|
5020
|
-
|
|
5065
|
+
if (isDropping) {
|
|
5066
|
+
className = mergeClassNames(className, 'DropTarget');
|
|
5021
5067
|
}
|
|
5022
|
-
return
|
|
5068
|
+
return className;
|
|
5023
5069
|
};
|
|
5024
5070
|
|
|
5025
5071
|
const defaultIndent$1 = 1;
|
|
@@ -5061,7 +5107,8 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
|
|
|
5061
5107
|
const id = isFocused ? 'TreeItemActive' : undefined;
|
|
5062
5108
|
const isSelected = item.selected;
|
|
5063
5109
|
const isCut = cutItems.includes(item.path);
|
|
5064
|
-
const
|
|
5110
|
+
const isDropping = dropTargets.includes(i);
|
|
5111
|
+
const className = getTreeItemClassName(isSelected, isFocused, isDropping); // TODO compute classname in dom function
|
|
5065
5112
|
const expanded = getExpandedType(item.type);
|
|
5066
5113
|
const ariaExpanded = ariaExpandedValues[expanded];
|
|
5067
5114
|
const isEditing = i === editingIndex;
|
|
@@ -5092,25 +5139,25 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
|
|
|
5092
5139
|
|
|
5093
5140
|
const renderItems = (oldState, newState) => {
|
|
5094
5141
|
const {
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5142
|
+
cutItems,
|
|
5143
|
+
deltaY,
|
|
5144
|
+
dropTargets,
|
|
5145
|
+
editingErrorMessage,
|
|
5146
|
+
editingIcon,
|
|
5099
5147
|
editingIndex,
|
|
5100
5148
|
editingType,
|
|
5101
5149
|
editingValue,
|
|
5102
|
-
|
|
5150
|
+
focused,
|
|
5151
|
+
focusedIndex,
|
|
5152
|
+
height,
|
|
5103
5153
|
icons,
|
|
5104
|
-
useChevrons,
|
|
5105
|
-
dropTargets,
|
|
5106
|
-
editingIcon,
|
|
5107
5154
|
itemHeight,
|
|
5108
|
-
|
|
5155
|
+
items,
|
|
5156
|
+
maxLineY,
|
|
5157
|
+
minLineY,
|
|
5109
5158
|
root,
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
height,
|
|
5113
|
-
cutItems
|
|
5159
|
+
useChevrons,
|
|
5160
|
+
width
|
|
5114
5161
|
} = newState;
|
|
5115
5162
|
const visibleDirents = getVisibleExplorerItems(items, minLineY, maxLineY, focusedIndex, editingIndex, editingType, editingValue, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems);
|
|
5116
5163
|
const isWide = width > 450;
|
|
@@ -5300,8 +5347,8 @@ const renderEventListeners = () => {
|
|
|
5300
5347
|
preventDefault: true
|
|
5301
5348
|
}, {
|
|
5302
5349
|
name: HandlePointerDown,
|
|
5303
|
-
params: ['handlePointerDown', 'event.button', 'event.clientX', 'event.clientY']
|
|
5304
|
-
preventDefault: true
|
|
5350
|
+
params: ['handlePointerDown', 'event.button', 'event.clientX', 'event.clientY']
|
|
5351
|
+
// preventDefault: true,
|
|
5305
5352
|
}, {
|
|
5306
5353
|
name: HandleEditingInput,
|
|
5307
5354
|
params: ['updateEditingValue', 'event.target.value']
|
|
@@ -5328,9 +5375,7 @@ const renderEventListeners = () => {
|
|
|
5328
5375
|
name: HandleDragStart,
|
|
5329
5376
|
params: ['handleDragStart'],
|
|
5330
5377
|
// @ts-ignore
|
|
5331
|
-
|
|
5332
|
-
'text/uri': 'abc'
|
|
5333
|
-
}
|
|
5378
|
+
dragEffect: 'copyMove'
|
|
5334
5379
|
}];
|
|
5335
5380
|
};
|
|
5336
5381
|
|