@lvce-editor/explorer-view 3.8.0 → 3.10.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.
@@ -1025,6 +1025,22 @@ const WebWorkerRpcClient = {
1025
1025
  __proto__: null,
1026
1026
  create: create$4
1027
1027
  };
1028
+ const createMockRpc = ({
1029
+ commandMap
1030
+ }) => {
1031
+ const invocations = [];
1032
+ const invoke = (method, ...params) => {
1033
+ invocations.push([method, ...params]);
1034
+ const command = commandMap[method];
1035
+ return command(...params);
1036
+ };
1037
+ const mockRpc = {
1038
+ invoke,
1039
+ invokeAndTransfer: invoke,
1040
+ invocations
1041
+ };
1042
+ return mockRpc;
1043
+ };
1028
1044
 
1029
1045
  const CreateFolder$1 = 1;
1030
1046
  const CreateFile$1 = 2;
@@ -1059,6 +1075,9 @@ const DebugWorker = 55;
1059
1075
  const FileSystemWorker$1 = 209;
1060
1076
  const RendererWorker$1 = 1;
1061
1077
 
1078
+ const FocusExplorer = 13;
1079
+ const FocusExplorerEditBox = 14;
1080
+
1062
1081
  const rpcs = Object.create(null);
1063
1082
  const set$5 = (id, rpc) => {
1064
1083
  rpcs[id] = rpc;
@@ -1432,6 +1451,13 @@ const getLogsDir = async () => {
1432
1451
  // @ts-ignore
1433
1452
  return invoke$2('PlatformPaths.getLogsDir');
1434
1453
  };
1454
+ const registerMockRpc = commandMap => {
1455
+ const mockRpc = createMockRpc({
1456
+ commandMap
1457
+ });
1458
+ set$3(mockRpc);
1459
+ return mockRpc;
1460
+ };
1435
1461
 
1436
1462
  const RendererWorker = {
1437
1463
  __proto__: null,
@@ -1481,6 +1507,7 @@ const RendererWorker = {
1481
1507
  openUrl,
1482
1508
  openWidget,
1483
1509
  readFile,
1510
+ registerMockRpc,
1484
1511
  registerWebViewInterceptor,
1485
1512
  renderMarkdown,
1486
1513
  rerenderEditor,
@@ -2644,7 +2671,8 @@ const create2 = (uid, uri, x, y, width, height, args, parentUid, platform = 0) =
2644
2671
  pasteShouldMove: false,
2645
2672
  cutItems: [],
2646
2673
  isPointerDown: false,
2647
- pointerDownIndex: -1
2674
+ pointerDownIndex: -1,
2675
+ sourceControlIgnoredUris: []
2648
2676
  };
2649
2677
  set(uid, state, state);
2650
2678
  };
@@ -2695,40 +2723,36 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) =>
2695
2723
  pasteShouldMove: false,
2696
2724
  cutItems: [],
2697
2725
  isPointerDown: false,
2698
- pointerDownIndex: -1
2726
+ pointerDownIndex: -1,
2727
+ sourceControlIgnoredUris: []
2699
2728
  };
2700
2729
  set(state.uid, state, state);
2701
2730
  return state;
2702
2731
  };
2703
2732
 
2704
- const RenderItems = 4;
2705
- const RenderFocus = 6;
2706
- const RenderFocusContext = 7;
2707
- const RenderValue = 8;
2708
- const RenderSelection = 9;
2709
- const RenderDragData = 10;
2710
-
2711
- const diffType$4 = RenderDragData;
2712
2733
  const isEqual$5 = (oldState, newState) => {
2713
2734
  return oldState.isPointerDown || !newState.isPointerDown;
2714
2735
  };
2715
2736
 
2716
- const diffType$3 = RenderFocus;
2717
2737
  const isEqual$4 = (oldState, newState) => {
2718
2738
  return oldState.focused === newState.focused && oldState.focus === newState.focus;
2719
2739
  };
2720
2740
 
2721
- const diffType$2 = RenderItems;
2722
2741
  const isEqual$3 = (oldState, newState) => {
2723
2742
  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 && oldState.cutItems === newState.cutItems;
2724
2743
  };
2725
2744
 
2726
- const diffType$1 = RenderSelection;
2727
2745
  const isEqual$2 = (oldState, newState) => {
2728
2746
  return oldState.editingSelectionStart === newState.editingSelectionStart && oldState.editingSelectionEnd === newState.editingSelectionEnd;
2729
2747
  };
2730
2748
 
2731
- const diffType = RenderValue;
2749
+ const RenderItems = 4;
2750
+ const RenderFocus = 6;
2751
+ const RenderFocusContext = 7;
2752
+ const RenderValue = 8;
2753
+ const RenderSelection = 9;
2754
+ const RenderDragData = 10;
2755
+
2732
2756
  const isEqual$1 = (oldState, newState) => {
2733
2757
  if (newState.focus !== Input$1) {
2734
2758
  return true;
@@ -2737,7 +2761,7 @@ const isEqual$1 = (oldState, newState) => {
2737
2761
  };
2738
2762
 
2739
2763
  const modules = [isEqual$3, isEqual$4, isEqual$4, isEqual$1, isEqual$2, isEqual$5];
2740
- const numbers = [diffType$2, diffType$3, RenderFocusContext, diffType, diffType$1, diffType$4];
2764
+ const numbers = [RenderItems, RenderFocus, RenderFocusContext, RenderValue, RenderSelection, RenderDragData];
2741
2765
 
2742
2766
  const diff = (oldState, newState) => {
2743
2767
  const diffResult = [];
@@ -3058,9 +3082,6 @@ const text = data => {
3058
3082
  };
3059
3083
  };
3060
3084
 
3061
- const FocusExplorer = 13;
3062
- const FocusExplorerEditBox = 14;
3063
-
3064
3085
  const getKeyBindings = () => {
3065
3086
  return [{
3066
3087
  key: Shift | UpArrow,
@@ -5323,10 +5344,10 @@ const renderFocus = (oldState, newState) => {
5323
5344
 
5324
5345
  const renderFocusContext = (oldState, newState) => {
5325
5346
  if (newState.focus === Input$1) {
5326
- return ['Viewlet.setFocusContext', FocusExplorerEditBox];
5347
+ return ['Viewlet.setFocusContext', newState.uid, FocusExplorerEditBox];
5327
5348
  }
5328
5349
  if (newState.focus === List) {
5329
- return ['Viewlet.setFocusContext', FocusExplorer];
5350
+ return ['Viewlet.setFocusContext', newState.uid, FocusExplorer];
5330
5351
  }
5331
5352
  return [];
5332
5353
  };
@@ -5498,8 +5519,8 @@ const label = {
5498
5519
  className: Label,
5499
5520
  childCount: 1
5500
5521
  };
5501
- const getLabelDom = (name, isCut) => {
5502
- if (isCut) {
5522
+ const getLabelDom = (name, isDimmed) => {
5523
+ if (isDimmed) {
5503
5524
  return [{
5504
5525
  type: Div,
5505
5526
  className: mergeClassNames(Label, LabelCut),
@@ -5509,11 +5530,11 @@ const getLabelDom = (name, isCut) => {
5509
5530
  return [label, text(name)];
5510
5531
  };
5511
5532
 
5512
- const getInputOrLabelDom = (isEditing, hasEditingError, name, isCut) => {
5533
+ const getInputOrLabelDom = (isEditing, hasEditingError, name, isCut, isIgnored) => {
5513
5534
  if (isEditing) {
5514
5535
  return getInputDom(hasEditingError);
5515
5536
  }
5516
- return getLabelDom(name, isCut);
5537
+ return getLabelDom(name, isCut || isIgnored);
5517
5538
  };
5518
5539
 
5519
5540
  const getExplorerItemVirtualDom = item => {
@@ -5532,6 +5553,7 @@ const getExplorerItemVirtualDom = item => {
5532
5553
  setSize,
5533
5554
  posInSet,
5534
5555
  isCut,
5556
+ isIgnored,
5535
5557
  index
5536
5558
  } = item;
5537
5559
  const chevronDom = getChevronVirtualDom(chevron);
@@ -5551,7 +5573,7 @@ const getExplorerItemVirtualDom = item => {
5551
5573
  ariaDescription: '',
5552
5574
  id,
5553
5575
  'data-index': index
5554
- }, ...chevronDom, getFileIconVirtualDom(icon), ...getInputOrLabelDom(isEditing, hasEditingError, name, isCut)];
5576
+ }, ...chevronDom, getFileIconVirtualDom(icon), ...getInputOrLabelDom(isEditing, hasEditingError, name, isCut, isIgnored)];
5555
5577
  };
5556
5578
 
5557
5579
  const getActiveDescendant = focusedIndex => {
@@ -5725,7 +5747,7 @@ const getEditingChevron = direntType => {
5725
5747
  return None$1;
5726
5748
  }
5727
5749
  };
5728
- const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editingIndex, editingType, editingValue, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems) => {
5750
+ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editingIndex, editingType, editingValue, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems, sourceControlIgnoredUris = []) => {
5729
5751
  const visible = [];
5730
5752
  const indentFn = useChevrons ? getTreeItemIndentWithChevron : getTreeItemIndent;
5731
5753
  let iconIndex = 0;
@@ -5737,6 +5759,7 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
5737
5759
  const isSelected = item.selected;
5738
5760
  const isCut = cutItems.includes(item.path);
5739
5761
  const isDropping = dropTargets.includes(i);
5762
+ const isIgnored = sourceControlIgnoredUris.includes(item.path);
5740
5763
  const className = getTreeItemClassName(isSelected, isFocused, isDropping); // TODO compute classname in dom function
5741
5764
  const expanded = getExpandedType(item.type);
5742
5765
  const ariaExpanded = ariaExpandedValues[expanded];
@@ -5760,6 +5783,7 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
5760
5783
  id,
5761
5784
  className,
5762
5785
  isCut,
5786
+ isIgnored,
5763
5787
  index: i
5764
5788
  });
5765
5789
  }
@@ -5769,6 +5793,7 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
5769
5793
  const renderItems = (oldState, newState) => {
5770
5794
  const {
5771
5795
  cutItems,
5796
+ sourceControlIgnoredUris,
5772
5797
  deltaY,
5773
5798
  dropTargets,
5774
5799
  editingErrorMessage,
@@ -5788,7 +5813,7 @@ const renderItems = (oldState, newState) => {
5788
5813
  useChevrons,
5789
5814
  width
5790
5815
  } = newState;
5791
- const visibleDirents = getVisibleExplorerItems(items, minLineY, maxLineY, focusedIndex, editingIndex, editingType, editingValue, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems);
5816
+ const visibleDirents = getVisibleExplorerItems(items, minLineY, maxLineY, focusedIndex, editingIndex, editingType, editingValue, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems, sourceControlIgnoredUris);
5792
5817
  const isWide = width > 450;
5793
5818
  const contentHeight = items.length * itemHeight;
5794
5819
  const depth = items[focusedIndex]?.depth || 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "3.8.0",
3
+ "version": "3.10.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",