@lvce-editor/file-search-worker 4.1.0 → 4.2.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.
@@ -448,7 +448,7 @@ const set$2 = (id, fn) => {
448
448
  const get$2 = id => {
449
449
  return callbacks[id];
450
450
  };
451
- const remove = id => {
451
+ const remove$1 = id => {
452
452
  delete callbacks[id];
453
453
  };
454
454
  let id = 0;
@@ -625,7 +625,7 @@ const resolve = (id, response) => {
625
625
  return;
626
626
  }
627
627
  fn(response);
628
- remove(id);
628
+ remove$1(id);
629
629
  };
630
630
  const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
631
631
  const getErrorType = prettyError => {
@@ -1699,13 +1699,17 @@ const create$2 = () => {
1699
1699
  oldState,
1700
1700
  newState
1701
1701
  };
1702
+ },
1703
+ remove(uid) {
1704
+ delete states[uid];
1702
1705
  }
1703
1706
  };
1704
1707
  };
1705
1708
 
1706
1709
  const {
1707
1710
  get,
1708
- set
1711
+ set,
1712
+ remove
1709
1713
  } = create$2();
1710
1714
 
1711
1715
  const create$1 = ({
@@ -1808,6 +1812,10 @@ const create = (uid, uri, listItemHeight, x, y, width, height, platform, args, r
1808
1812
  set(uid, state, state);
1809
1813
  };
1810
1814
 
1815
+ const dispose = uid => {
1816
+ remove(uid);
1817
+ };
1818
+
1811
1819
  const emptyMatches = [];
1812
1820
 
1813
1821
  const convertToPick = item => {
@@ -2083,7 +2091,7 @@ const focusPrevious = state => {
2083
2091
  return focusIndex(state, previousIndex);
2084
2092
  };
2085
2093
 
2086
- const commandIds = ['focusFirst', 'focusIndex', 'focusLast', 'focusNext', 'focusPrevious', 'handleBeforeInput', 'handleBlur', 'handleClickAt', 'handleInput', 'handleWheel', 'renderEventListeners', 'selectCurrentIndex', 'selectIndex', 'selectItem', 'setValue'];
2094
+ const commandIds = ['focusFirst', 'focusIndex', 'focusLast', 'focusNext', 'focusPrevious', 'handleBeforeInput', 'handleBlur', 'handleClickAt', 'handleInput', 'handleWheel', 'dispose', 'renderEventListeners', 'selectCurrentIndex', 'selectIndex', 'selectItem', 'setValue'];
2087
2095
 
2088
2096
  const getCommandIds = () => {
2089
2097
  return commandIds;
@@ -2314,15 +2322,16 @@ const handleBeforeInput = (state, inputType, data, selectionStart, selectionEnd)
2314
2322
  return handleInput(state, newValue, cursorOffset, User);
2315
2323
  };
2316
2324
 
2317
- const closeWidget = async id => {
2318
- await invoke$1('Viewlet.closeWidget', id);
2319
- };
2320
-
2321
2325
  const handleBlur = async state => {
2322
- await closeWidget(state.uid);
2326
+ // TODO fix virtual dom diffing so that input isn't destroyed and loses focus when rerendering
2327
+ // await CloseWidget.closeWidget(state.uid)
2323
2328
  return state;
2324
2329
  };
2325
2330
 
2331
+ const closeWidget = async id => {
2332
+ await invoke$1('Viewlet.closeWidget', id);
2333
+ };
2334
+
2326
2335
  const getPick = (items, index) => {
2327
2336
  array(items);
2328
2337
  number(index);
@@ -2648,7 +2657,12 @@ const renderCursorOffset = newState => {
2648
2657
  return ['Viewlet.send', newState.uid, /* method */SetCursorOffset, /* cursorOffset */newState.cursorOffset];
2649
2658
  };
2650
2659
 
2660
+ const QuickPickInput = 'QuickPickInput';
2661
+
2651
2662
  const renderFocus = newState => {
2663
+ if (newState.renderAllItems) {
2664
+ return ['Viewlet.focusElementByName', QuickPickInput];
2665
+ }
2652
2666
  const selector = newState.focused ? '.InputBox' : '';
2653
2667
  return ['Viewlet.focusSelector', selector];
2654
2668
  };
@@ -2676,7 +2690,7 @@ const QuickPick$1 = 'QuickPick';
2676
2690
  const QuickPickHeader = 'QuickPickHeader';
2677
2691
  const QuickPickHighlight = 'QuickPickHighlight';
2678
2692
  const QuickPickItem = 'QuickPickItem';
2679
- const QuickPickItemActive = 'QuickPickItemActive';
2693
+ const QuickPickItemActive$1 = 'QuickPickItemActive';
2680
2694
  const QuickPickItemDescription = 'QuickPickItemDescription';
2681
2695
  const QuickPickItemLabel = 'QuickPickItemLabel';
2682
2696
  const QuickPickItems$1 = 'QuickPickItems';
@@ -2889,7 +2903,7 @@ const getQuickPickItemVirtualDom = visibleItem => {
2889
2903
  if (isActive) {
2890
2904
  // @ts-ignore
2891
2905
  parent.id = 'QuickPickItemActive';
2892
- parent.className += ' ' + QuickPickItemActive;
2906
+ parent.className += ' ' + QuickPickItemActive$1;
2893
2907
  }
2894
2908
  if (fileIcon) {
2895
2909
  parent.childCount++;
@@ -2934,15 +2948,15 @@ const getQuickPickItemsVirtualDom = visibleItems => {
2934
2948
  return dom;
2935
2949
  };
2936
2950
 
2937
- const QuickPick = 'QuickPick';
2938
- const QuickPickItems = 'QuickPickItems';
2939
-
2940
2951
  const HandlePointerDown = 'handlePointerDown';
2941
2952
  const HandleWheel = 'handleWheel';
2942
2953
  const HandleBlur = 'handleBlur';
2943
2954
  const HandleBeforeInput = 'handleBeforeInput';
2955
+ const HandleInput = 'handleInput';
2944
2956
 
2945
- const QuickPickInput = 'QuickPickInput';
2957
+ const QuickPick = 'QuickPick';
2958
+ const QuickPickItems = 'QuickPickItems';
2959
+ const QuickPickItemActive = 'QuickPickItemActive';
2946
2960
 
2947
2961
  const getQuickPickHeaderVirtualDom = () => {
2948
2962
  const ariaLabel = typeNameofCommandToRun();
@@ -2961,7 +2975,10 @@ const getQuickPickHeaderVirtualDom = () => {
2961
2975
  name: QuickPickInput,
2962
2976
  onBeforeInput: HandleBeforeInput,
2963
2977
  onBlur: HandleBlur,
2964
- ariaLabel: ariaLabel
2978
+ onInput: HandleInput,
2979
+ ariaLabel: ariaLabel,
2980
+ ariaAutoComplete: 'list',
2981
+ ariaExpanded: true
2965
2982
  }];
2966
2983
  };
2967
2984
 
@@ -2978,6 +2995,8 @@ const getQuickPickVirtualDom = visibleItems => {
2978
2995
  className: QuickPickItems$1,
2979
2996
  id: QuickPickItems,
2980
2997
  role: ListBox,
2998
+ ariaActiveDescendant: QuickPickItemActive,
2999
+ onWheel: HandleWheel,
2981
3000
  childCount: visibleItems.length
2982
3001
  }, ...getQuickPickItemsVirtualDom(visibleItems)];
2983
3002
  };
@@ -3018,6 +3037,12 @@ const applyRender = async (oldState, newState, diffResult) => {
3018
3037
  const commands = [];
3019
3038
  const viewModel = await createQuickPickViewModel(oldState, newState);
3020
3039
  for (const item of diffResult) {
3040
+ if (viewModel.renderAllItems && item === Height) {
3041
+ continue;
3042
+ }
3043
+ if (viewModel.renderAllItems && item === RenderFocusedIndex) {
3044
+ continue;
3045
+ }
3021
3046
  const fn = getRenderer(item);
3022
3047
  commands.push(fn(viewModel));
3023
3048
  }
@@ -3049,8 +3074,8 @@ const isEqual = (oldState, newState) => {
3049
3074
  return newState.inputSource === User || oldState.value === newState.value;
3050
3075
  };
3051
3076
 
3052
- const modules = [isEqual$2, isEqual$1, isEqual$4, isEqual, isEqual$3];
3053
- const numbers = [diffType$2, diffType$1, diffType$4, diffType, diffType$3];
3077
+ const modules = [isEqual$2, isEqual$1, isEqual, isEqual$3, isEqual$4];
3078
+ const numbers = [diffType$2, diffType$1, diffType, diffType$3, diffType$4];
3054
3079
 
3055
3080
  const diff = (oldState, newState) => {
3056
3081
  const diffResult = [];
@@ -3079,13 +3104,16 @@ const renderEventListeners = () => {
3079
3104
  preventDefault: true
3080
3105
  }, {
3081
3106
  name: HandleWheel,
3082
- params: ['handleWheel']
3107
+ params: ['handleWheel', 'event.deltaMode', 'event.deltaY']
3083
3108
  }, {
3084
3109
  name: HandleBlur,
3085
3110
  params: ['handleBlur']
3086
3111
  }, {
3087
3112
  name: HandleBeforeInput,
3088
3113
  params: ['handleBeforeInput']
3114
+ }, {
3115
+ name: HandleInput,
3116
+ params: ['handleInput', 'event.target.value']
3089
3117
  }];
3090
3118
  };
3091
3119
 
@@ -3134,6 +3162,7 @@ const commandMap = {
3134
3162
  'QuickPick.getKeyBindings': getKeyBindings,
3135
3163
  'QuickPick.handleBeforeInput': wrapCommand(handleBeforeInput),
3136
3164
  'QuickPick.handleBlur': wrapCommand(handleBlur),
3165
+ 'QuickPick.dispose': dispose,
3137
3166
  'QuickPick.handleClickAt': wrapCommand(handleClickAt),
3138
3167
  'QuickPick.handleInput': wrapCommand(handleInput),
3139
3168
  'QuickPick.handleWheel': wrapCommand(handleWheel),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-search-worker",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "text-search"