@lvce-editor/explorer-view 2.20.0 → 2.21.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.
@@ -1579,19 +1579,28 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) =>
1579
1579
  const RenderItems = 4;
1580
1580
  const RenderFocus = 6;
1581
1581
  const RenderFocusContext = 7;
1582
+ const RenderValue = 8;
1582
1583
 
1583
- const diffType$1 = RenderFocus;
1584
- const isEqual$2 = (oldState, newState) => {
1584
+ const diffType$2 = RenderFocus;
1585
+ const isEqual$3 = (oldState, newState) => {
1585
1586
  return oldState.focused === newState.focused && oldState.focus === newState.focus;
1586
1587
  };
1587
1588
 
1588
- const diffType = RenderItems;
1589
- const isEqual$1 = (oldState, newState) => {
1589
+ const diffType$1 = RenderItems;
1590
+ const isEqual$2 = (oldState, newState) => {
1590
1591
  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;
1591
1592
  };
1592
1593
 
1593
- const modules = [isEqual$1, isEqual$2, isEqual$2];
1594
- const numbers = [diffType, diffType$1, RenderFocusContext];
1594
+ const diffType = RenderValue;
1595
+ const isEqual$1 = (oldState, newState) => {
1596
+ if (newState.focus !== Input$1) {
1597
+ return true;
1598
+ }
1599
+ return oldState.focus === Input$1 && newState.focus === Input$1 && oldState.editingValue === newState.editingValue;
1600
+ };
1601
+
1602
+ const modules = [isEqual$2, isEqual$3, isEqual$3, isEqual$1];
1603
+ const numbers = [diffType$1, diffType$2, RenderFocusContext, diffType];
1595
1604
 
1596
1605
  const diff = (oldState, newState) => {
1597
1606
  const diffResult = [];
@@ -2225,14 +2234,12 @@ const LeftClick = 0;
2225
2234
 
2226
2235
  const getMouseActions = () => {
2227
2236
  return [{
2228
- id: 'explorer.openFile',
2229
2237
  description: 'Open file on click',
2230
2238
  button: LeftClick,
2231
2239
  modifiers: {},
2232
2240
  command: 'Explorer.openFile',
2233
2241
  when: FocusExplorer
2234
2242
  }, {
2235
- id: 'explorer.toggleSelection',
2236
2243
  description: 'Toggle selection with Ctrl+Click',
2237
2244
  button: LeftClick,
2238
2245
  modifiers: {
@@ -2241,7 +2248,6 @@ const getMouseActions = () => {
2241
2248
  command: 'Explorer.toggleSelection',
2242
2249
  when: FocusExplorer
2243
2250
  }, {
2244
- id: 'explorer.rangeSelection',
2245
2251
  description: 'Select range with Shift+Click',
2246
2252
  button: LeftClick,
2247
2253
  modifiers: {
@@ -2249,14 +2255,6 @@ const getMouseActions = () => {
2249
2255
  },
2250
2256
  command: 'Explorer.rangeSelection',
2251
2257
  when: FocusExplorer
2252
- }, {
2253
- id: 'explorer.contextMenu',
2254
- description: 'Show context menu on right click',
2255
- button: 2,
2256
- // Right click
2257
- modifiers: {},
2258
- command: 'Explorer.showContextMenu',
2259
- when: FocusExplorer
2260
2258
  }];
2261
2259
  };
2262
2260
 
@@ -2623,19 +2621,23 @@ const handleRangeSelection = (state, startIndex, endIndex) => {
2623
2621
  };
2624
2622
  };
2625
2623
 
2626
- const handleClickAt = (state, button, ctrlKey, shiftKey, x, y) => {
2624
+ const handleClickAtRangeSelection = async (state, index) => {
2625
+ const firstSelectedIndex = state.items.findIndex(item => item.selected);
2626
+ if (firstSelectedIndex === -1) {
2627
+ return handleRangeSelection(state, index, index);
2628
+ }
2629
+ const min = Math.min(firstSelectedIndex, index);
2630
+ const max = Math.min(firstSelectedIndex, index);
2631
+ return handleRangeSelection(state, min, max);
2632
+ };
2633
+
2634
+ const handleClickAt = async (state, button, ctrlKey, shiftKey, x, y) => {
2627
2635
  if (button !== LeftClick) {
2628
2636
  return state;
2629
2637
  }
2630
2638
  const index = getIndexFromPosition(state, x, y);
2631
2639
  if (shiftKey) {
2632
- const firstSelectedIndex = state.items.findIndex(item => item.selected);
2633
- if (firstSelectedIndex === -1) {
2634
- return handleRangeSelection(state, index, index);
2635
- }
2636
- const min = Math.min(firstSelectedIndex, index);
2637
- const max = Math.min(firstSelectedIndex, index);
2638
- return handleRangeSelection(state, min, max);
2640
+ return handleClickAtRangeSelection(state, index);
2639
2641
  }
2640
2642
  return handleClick(state, index);
2641
2643
  };
@@ -3657,6 +3659,9 @@ const removeDirent = async state => {
3657
3659
  };
3658
3660
  };
3659
3661
 
3662
+ const User = 1;
3663
+ const Script = 2;
3664
+
3660
3665
  const renameDirent = state => {
3661
3666
  const {
3662
3667
  focusedIndex,
@@ -3668,14 +3673,13 @@ const renameDirent = state => {
3668
3673
  editingIndex: focusedIndex,
3669
3674
  editingType: Rename$1,
3670
3675
  editingValue: item.name,
3671
- focus: Input$1
3676
+ focus: Input$1,
3677
+ inputSource: Script
3672
3678
  };
3673
3679
  };
3674
3680
 
3675
3681
  const ExplorerInput = 'ExplorerInput';
3676
3682
 
3677
- const User = 1;
3678
-
3679
3683
  const renderFocus$1 = (oldState, newState) => {
3680
3684
  if (newState.inputSource === User) {
3681
3685
  return [];
@@ -4049,6 +4053,16 @@ const renderItems = (oldState, newState) => {
4049
4053
  return ['Viewlet.setDom2', dom];
4050
4054
  };
4051
4055
 
4056
+ const renderValue = (oldState, newState) => {
4057
+ if (newState.inputSource === User) {
4058
+ return [];
4059
+ }
4060
+ if (newState.focus === Input$1) {
4061
+ return ['Viewlet.setValueByName', ExplorerInput, newState.editingValue];
4062
+ }
4063
+ return [];
4064
+ };
4065
+
4052
4066
  const getRenderer = diffType => {
4053
4067
  switch (diffType) {
4054
4068
  case RenderItems:
@@ -4057,6 +4071,8 @@ const getRenderer = diffType => {
4057
4071
  return renderFocus$1;
4058
4072
  case RenderFocusContext:
4059
4073
  return renderFocus;
4074
+ case RenderValue:
4075
+ return renderValue;
4060
4076
  default:
4061
4077
  throw new Error('unknown renderer');
4062
4078
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "2.20.0",
3
+ "version": "2.21.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",