@lvce-editor/explorer-view 2.24.0 → 2.25.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 +62 -16
- package/package.json +1 -1
|
@@ -894,6 +894,7 @@ const OpenInIntegratedTerminal = 'Open in integrated Terminal';
|
|
|
894
894
|
const Paste = 'Paste';
|
|
895
895
|
const RefreshExplorer = 'Refresh Explorer';
|
|
896
896
|
const Rename = 'Rename';
|
|
897
|
+
const TypeAFileName = 'Type file name. Press Enter to confirm or Escape to cancel.'; // TODO use keybinding
|
|
897
898
|
const YouHaveNotYetOpenedAFolder = 'You have not yet opened a folder';
|
|
898
899
|
|
|
899
900
|
const newFile$1 = () => {
|
|
@@ -947,6 +948,9 @@ const openFolder$1 = () => {
|
|
|
947
948
|
const fileOrFolderNameMustBeProvided = () => {
|
|
948
949
|
return i18nString(FileOrFolderNameMustBeProvider);
|
|
949
950
|
};
|
|
951
|
+
const typeAFileName = () => {
|
|
952
|
+
return i18nString(TypeAFileName);
|
|
953
|
+
};
|
|
950
954
|
|
|
951
955
|
const List = 1;
|
|
952
956
|
const Input$1 = 2;
|
|
@@ -1574,7 +1578,11 @@ const create2 = (uid, uri, x, y, width, height, args, parentUid, platform = 0) =
|
|
|
1574
1578
|
platform,
|
|
1575
1579
|
focus: 0,
|
|
1576
1580
|
editingErrorMessage: '',
|
|
1577
|
-
inputSource: 0
|
|
1581
|
+
inputSource: 0,
|
|
1582
|
+
editingSelection: {
|
|
1583
|
+
start: 0,
|
|
1584
|
+
end: 0
|
|
1585
|
+
}
|
|
1578
1586
|
};
|
|
1579
1587
|
set(uid, state, state);
|
|
1580
1588
|
};
|
|
@@ -1611,7 +1619,11 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) =>
|
|
|
1611
1619
|
platform,
|
|
1612
1620
|
focus: 0,
|
|
1613
1621
|
editingErrorMessage: '',
|
|
1614
|
-
inputSource: 0
|
|
1622
|
+
inputSource: 0,
|
|
1623
|
+
editingSelection: {
|
|
1624
|
+
start: 0,
|
|
1625
|
+
end: 0
|
|
1626
|
+
}
|
|
1615
1627
|
};
|
|
1616
1628
|
set(state.uid, state, state);
|
|
1617
1629
|
return state;
|
|
@@ -1621,15 +1633,21 @@ const RenderItems = 4;
|
|
|
1621
1633
|
const RenderFocus = 6;
|
|
1622
1634
|
const RenderFocusContext = 7;
|
|
1623
1635
|
const RenderValue = 8;
|
|
1636
|
+
const RenderSelection = 9;
|
|
1624
1637
|
|
|
1625
|
-
const diffType$
|
|
1626
|
-
const isEqual$
|
|
1638
|
+
const diffType$3 = RenderFocus;
|
|
1639
|
+
const isEqual$4 = (oldState, newState) => {
|
|
1627
1640
|
return oldState.focused === newState.focused && oldState.focus === newState.focus;
|
|
1628
1641
|
};
|
|
1629
1642
|
|
|
1630
|
-
const diffType$
|
|
1643
|
+
const diffType$2 = RenderItems;
|
|
1644
|
+
const isEqual$3 = (oldState, newState) => {
|
|
1645
|
+
return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.focusedIndex === newState.focusedIndex && oldState.editingIndex === newState.editingIndex && oldState.editingType === newState.editingType && oldState.editingValue === newState.editingValue && oldState.editingErrorMessage === newState.editingErrorMessage && oldState.width === newState.width && oldState.focused === newState.focused && oldState.dropTargets === newState.dropTargets && oldState.icons === newState.icons;
|
|
1646
|
+
};
|
|
1647
|
+
|
|
1648
|
+
const diffType$1 = RenderSelection;
|
|
1631
1649
|
const isEqual$2 = (oldState, newState) => {
|
|
1632
|
-
return oldState.
|
|
1650
|
+
return oldState.editingSelection.start === newState.editingSelection.start && oldState.editingSelection.end === newState.editingSelection.end;
|
|
1633
1651
|
};
|
|
1634
1652
|
|
|
1635
1653
|
const diffType = RenderValue;
|
|
@@ -1640,8 +1658,8 @@ const isEqual$1 = (oldState, newState) => {
|
|
|
1640
1658
|
return oldState.focus === Input$1 && newState.focus === Input$1 && oldState.editingValue === newState.editingValue;
|
|
1641
1659
|
};
|
|
1642
1660
|
|
|
1643
|
-
const modules = [isEqual$
|
|
1644
|
-
const numbers = [diffType$
|
|
1661
|
+
const modules = [isEqual$3, isEqual$4, isEqual$4, isEqual$1, isEqual$2];
|
|
1662
|
+
const numbers = [diffType$2, diffType$3, RenderFocusContext, diffType, diffType$1];
|
|
1645
1663
|
|
|
1646
1664
|
const diff = (oldState, newState) => {
|
|
1647
1665
|
const diffResult = [];
|
|
@@ -3827,7 +3845,9 @@ const Script = 2;
|
|
|
3827
3845
|
const renameDirent = state => {
|
|
3828
3846
|
const {
|
|
3829
3847
|
focusedIndex,
|
|
3830
|
-
items
|
|
3848
|
+
items,
|
|
3849
|
+
icons,
|
|
3850
|
+
minLineY
|
|
3831
3851
|
} = state;
|
|
3832
3852
|
if (items.length === 0) {
|
|
3833
3853
|
return state;
|
|
@@ -3840,11 +3860,20 @@ const renameDirent = state => {
|
|
|
3840
3860
|
editingIndex: focusedIndex,
|
|
3841
3861
|
editingType: Rename$1,
|
|
3842
3862
|
editingValue: item.name,
|
|
3863
|
+
editingIcon: icons[focusedIndex - minLineY],
|
|
3864
|
+
editingSelection: {
|
|
3865
|
+
start: 0,
|
|
3866
|
+
end: item.name.length
|
|
3867
|
+
},
|
|
3843
3868
|
focus: Input$1,
|
|
3844
3869
|
inputSource: Script
|
|
3845
3870
|
};
|
|
3846
3871
|
};
|
|
3847
3872
|
|
|
3873
|
+
const renderEditingSelection = (oldState, newState) => {
|
|
3874
|
+
return ['Viewlet.setSelection', newState.editingSelection];
|
|
3875
|
+
};
|
|
3876
|
+
|
|
3848
3877
|
const ExplorerInput = 'ExplorerInput';
|
|
3849
3878
|
|
|
3850
3879
|
const renderFocus$1 = (oldState, newState) => {
|
|
@@ -3979,6 +4008,7 @@ const getClassName$2 = hasEditingError => {
|
|
|
3979
4008
|
return InputBox;
|
|
3980
4009
|
};
|
|
3981
4010
|
const getInputDom = hasEditingError => {
|
|
4011
|
+
const ariaLabel = typeAFileName();
|
|
3982
4012
|
return [{
|
|
3983
4013
|
type: Input,
|
|
3984
4014
|
className: getClassName$2(hasEditingError),
|
|
@@ -3986,7 +4016,11 @@ const getInputDom = hasEditingError => {
|
|
|
3986
4016
|
onInput: HandleEditingInput,
|
|
3987
4017
|
onBlur: HandleInputBlur,
|
|
3988
4018
|
childCount: 0,
|
|
3989
|
-
name: ExplorerInput
|
|
4019
|
+
name: ExplorerInput,
|
|
4020
|
+
autocorrect: 'off',
|
|
4021
|
+
autocapitalize: 'off',
|
|
4022
|
+
spellcheck: 'false',
|
|
4023
|
+
ariaLabel: ariaLabel
|
|
3990
4024
|
}];
|
|
3991
4025
|
};
|
|
3992
4026
|
|
|
@@ -4228,6 +4262,8 @@ const getRenderer = diffType => {
|
|
|
4228
4262
|
return renderFocus;
|
|
4229
4263
|
case RenderValue:
|
|
4230
4264
|
return renderValue;
|
|
4265
|
+
case RenderSelection:
|
|
4266
|
+
return renderEditingSelection;
|
|
4231
4267
|
default:
|
|
4232
4268
|
throw new Error('unknown renderer');
|
|
4233
4269
|
}
|
|
@@ -4236,6 +4272,10 @@ const getRenderer = diffType => {
|
|
|
4236
4272
|
const applyRender = (oldState, newState, diffResult) => {
|
|
4237
4273
|
const commands = [];
|
|
4238
4274
|
for (const item of diffResult) {
|
|
4275
|
+
if (item === RenderSelection) {
|
|
4276
|
+
// TODO support this in the future
|
|
4277
|
+
continue;
|
|
4278
|
+
}
|
|
4239
4279
|
const fn = getRenderer(item);
|
|
4240
4280
|
const result = fn(oldState, newState);
|
|
4241
4281
|
if (result.length > 0) {
|
|
@@ -4703,17 +4743,23 @@ const terminate = () => {
|
|
|
4703
4743
|
globalThis.close();
|
|
4704
4744
|
};
|
|
4705
4745
|
|
|
4706
|
-
const getEditingIcon = async (editingType, value) => {
|
|
4746
|
+
const getEditingIcon = async (editingType, value, direntType) => {
|
|
4707
4747
|
if (editingType === CreateFile) {
|
|
4708
4748
|
return invoke('IconTheme.getFileIcon', {
|
|
4709
4749
|
name: value
|
|
4710
4750
|
});
|
|
4711
4751
|
}
|
|
4712
|
-
// TODO need renamefile and renamefolder type
|
|
4713
4752
|
if (editingType === Rename$1) {
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4753
|
+
if (direntType === File || direntType === EditingFile) {
|
|
4754
|
+
return invoke('IconTheme.getFileIcon', {
|
|
4755
|
+
name: value
|
|
4756
|
+
});
|
|
4757
|
+
}
|
|
4758
|
+
if (direntType === Directory || direntType === EditingFolder) {
|
|
4759
|
+
return invoke('IconTheme.getFolderIcon', {
|
|
4760
|
+
name: value
|
|
4761
|
+
});
|
|
4762
|
+
}
|
|
4717
4763
|
}
|
|
4718
4764
|
if (editingType === CreateFolder) {
|
|
4719
4765
|
return invoke('IconTheme.getFolderIcon', {
|
|
@@ -4724,7 +4770,7 @@ const getEditingIcon = async (editingType, value) => {
|
|
|
4724
4770
|
};
|
|
4725
4771
|
|
|
4726
4772
|
const updateEditingValue = async (state, value, inputSource = User) => {
|
|
4727
|
-
const editingIcon = await getEditingIcon(state.editingType, value);
|
|
4773
|
+
const editingIcon = await getEditingIcon(state.editingType, value, state.items[state.editingIndex]?.type);
|
|
4728
4774
|
return {
|
|
4729
4775
|
...state,
|
|
4730
4776
|
editingValue: value,
|