@lvce-editor/file-search-worker 4.3.0 → 4.5.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.
@@ -858,11 +858,6 @@ const WebWorkerRpcClient = {
858
858
  create: create$3
859
859
  };
860
860
 
861
- const User = 1;
862
- const Script = 2;
863
-
864
- const minimumSliderSize = 20;
865
-
866
861
  const RendererWorker = 1;
867
862
 
868
863
  const rpcs = Object.create(null);
@@ -879,6 +874,20 @@ const invoke$1 = (method, ...params) => {
879
874
  return rpc.invoke(method, ...params);
880
875
  };
881
876
 
877
+ const closeWidget = async id => {
878
+ await invoke$1('Viewlet.closeWidget', id);
879
+ };
880
+
881
+ const close = async state => {
882
+ await closeWidget(state.uid);
883
+ return state;
884
+ };
885
+
886
+ const User = 1;
887
+ const Script = 2;
888
+
889
+ const minimumSliderSize = 20;
890
+
882
891
  const handleError = async (error, notify = true, prefix = '') => {
883
892
  console.error(error);
884
893
  };
@@ -1778,7 +1787,7 @@ const handleWheel = (state, deltaMode, deltaY) => {
1778
1787
  return setDeltaY(state, state.deltaY + deltaY);
1779
1788
  };
1780
1789
 
1781
- const create = (uid, uri, listItemHeight, x, y, width, height, platform, args, renderAllItems) => {
1790
+ const create = (uid, uri, listItemHeight, x, y, width, height, platform, args) => {
1782
1791
  const state = {
1783
1792
  uid,
1784
1793
  state: Default$1,
@@ -1806,8 +1815,7 @@ const create = (uid, uri, listItemHeight, x, y, width, height, platform, args, r
1806
1815
  args,
1807
1816
  focused: false,
1808
1817
  platform,
1809
- value: '',
1810
- renderAllItems
1818
+ value: ''
1811
1819
  };
1812
1820
  set(uid, state, state);
1813
1821
  };
@@ -2091,7 +2099,7 @@ const focusPrevious = state => {
2091
2099
  return focusIndex(state, previousIndex);
2092
2100
  };
2093
2101
 
2094
- const commandIds = ['dispose', 'focusFirst', 'focusIndex', 'focusLast', 'focusNext', 'focusPrevious', 'handleBeforeInput', 'handleBlur', 'handleClickAt', 'handleFocus', 'handleInput', 'handleWheel', 'renderEventListeners', 'selectCurrentIndex', 'selectIndex', 'selectItem', 'setValue'];
2102
+ const commandIds = ['close', 'dispose', 'focusFirst', 'focusIndex', 'focusLast', 'focusNext', 'focusPrevious', 'handleBeforeInput', 'handleBlur', 'handleClickAt', 'handleFocus', 'handleInput', 'handleWheel', 'renderEventListeners', 'selectCurrentIndex', 'selectIndex', 'selectItem', 'setValue'];
2095
2103
 
2096
2104
  const getCommandIds = () => {
2097
2105
  return commandIds;
@@ -2144,6 +2152,11 @@ const InsertLineBreak = 'insertLineBreak';
2144
2152
  const InsertCompositionText = 'insertCompositionText';
2145
2153
  const InsertFromPaste = 'insertFromPaste';
2146
2154
 
2155
+ const RE_ALPHA_NUMERIC = /[a-z\d]/i;
2156
+ const isAlphaNumeric = character => {
2157
+ return RE_ALPHA_NUMERIC.test(character);
2158
+ };
2159
+
2147
2160
  const getNewValueInsertText = (value, selectionStart, selectionEnd, data) => {
2148
2161
  if (selectionStart === value.length) {
2149
2162
  const newValue = value + data;
@@ -2177,10 +2190,6 @@ const getNewValueDeleteContentBackward = (value, selectionStart, selectionEnd, d
2177
2190
  cursorOffset: selectionStart
2178
2191
  };
2179
2192
  };
2180
- const RE_ALPHA_NUMERIC = /[a-z\d]/i;
2181
- const isAlphaNumeric = character => {
2182
- return RE_ALPHA_NUMERIC.test(character);
2183
- };
2184
2193
  const getNewValueDeleteWordBackward = (value, selectionStart, selectionEnd, data) => {
2185
2194
  const after = value.slice(selectionEnd);
2186
2195
  if (selectionStart === selectionEnd) {
@@ -2328,10 +2337,6 @@ const handleBlur$1 = async state => {
2328
2337
  return state;
2329
2338
  };
2330
2339
 
2331
- const closeWidget = async id => {
2332
- await invoke$1('Viewlet.closeWidget', id);
2333
- };
2334
-
2335
2340
  const getPick = (items, index) => {
2336
2341
  array(items);
2337
2342
  number(index);
@@ -2584,6 +2589,13 @@ const getIconRequests = (items, provider) => {
2584
2589
  return iconRequests;
2585
2590
  };
2586
2591
 
2592
+ const getPickDescription$3 = (provider, pick) => {
2593
+ if (provider.getPickDescription) {
2594
+ return provider.getPickDescription(pick);
2595
+ }
2596
+ return '';
2597
+ };
2598
+
2587
2599
  const requestFileIcons = async requests => {
2588
2600
  const promises = requests.map(request => {
2589
2601
  if (!request.name) {
@@ -2598,12 +2610,6 @@ const requestFileIcons = async requests => {
2598
2610
  return Promise.all(promises);
2599
2611
  };
2600
2612
 
2601
- const getPickDescription$3 = (provider, pick) => {
2602
- if (provider.getPickDescription) {
2603
- return provider.getPickDescription(pick);
2604
- }
2605
- return '';
2606
- };
2607
2613
  const getVisible = async (provider, items, minLineY, maxLineY, focusedIndex) => {
2608
2614
  const visibleItems = [];
2609
2615
  const setSize = items.length;
@@ -2647,8 +2653,7 @@ const createQuickPickViewModel = async (oldState, newState) => {
2647
2653
  height,
2648
2654
  oldFocusedIndex,
2649
2655
  newFocusedIndex,
2650
- uid: newState.uid,
2651
- renderAllItems: newState.renderAllItems
2656
+ uid: newState.uid
2652
2657
  };
2653
2658
  };
2654
2659
 
@@ -2671,11 +2676,7 @@ const renderCursorOffset = newState => {
2671
2676
  const QuickPickInput = 'QuickPickInput';
2672
2677
 
2673
2678
  const renderFocus = newState => {
2674
- if (newState.renderAllItems) {
2675
- return ['Viewlet.focusElementByName', QuickPickInput];
2676
- }
2677
- const selector = newState.focused ? '.InputBox' : '';
2678
- return ['Viewlet.focusSelector', selector];
2679
+ return ['Viewlet.focusElementByName', QuickPickInput];
2679
2680
  };
2680
2681
 
2681
2682
  const renderFocusedIndex = newState => {
@@ -2707,21 +2708,52 @@ const QuickPickItemLabel = 'QuickPickItemLabel';
2707
2708
  const QuickPickItems$1 = 'QuickPickItems';
2708
2709
  const Viewlet = 'Viewlet';
2709
2710
 
2711
+ const HandleBeforeInput = 'handleBeforeInput';
2712
+ const HandleBlur = 'handleBlur';
2713
+ const HandleFocus = 'handleFocus';
2714
+ const HandleInput = 'handleInput';
2715
+ const HandlePointerDown = 'handlePointerDown';
2716
+ const HandleWheel = 'handleWheel';
2717
+
2718
+ const QuickPick = 'QuickPick';
2719
+ const QuickPickItems = 'QuickPickItems';
2720
+ const QuickPickItemActive = 'QuickPickItemActive';
2721
+
2710
2722
  const Div$1 = 4;
2711
2723
  const Input$1 = 6;
2712
2724
  const Span$1 = 8;
2713
2725
  const Img$1 = 17;
2714
2726
 
2715
- const getFileIconVirtualDom = icon => {
2727
+ const getQuickPickInputVirtualDom = () => {
2728
+ const ariaLabel = typeNameofCommandToRun();
2716
2729
  return {
2717
- type: Img$1,
2718
- className: FileIcon,
2719
- src: icon,
2720
- role: None$1,
2721
- childCount: 0
2730
+ type: Input$1,
2731
+ className: InputBox,
2732
+ spellcheck: false,
2733
+ autocapitalize: 'off',
2734
+ inputType: 'text',
2735
+ childCount: 0,
2736
+ role: ComboBox,
2737
+ name: QuickPickInput,
2738
+ onBeforeInput: HandleBeforeInput,
2739
+ onBlur: HandleBlur,
2740
+ onInput: HandleInput,
2741
+ onFocus: HandleFocus,
2742
+ ariaLabel: ariaLabel,
2743
+ ariaAutoComplete: 'list',
2744
+ ariaExpanded: true,
2745
+ autocomplete: 'off'
2722
2746
  };
2723
2747
  };
2724
2748
 
2749
+ const getQuickPickHeaderVirtualDom = () => {
2750
+ return [{
2751
+ type: Div$1,
2752
+ className: QuickPickHeader,
2753
+ childCount: 1
2754
+ }, getQuickPickInputVirtualDom()];
2755
+ };
2756
+
2725
2757
  var __defProp = Object.defineProperty;
2726
2758
  var __export = (target, all) => {
2727
2759
  for (var name in all) __defProp(target, name, {
@@ -2889,6 +2921,17 @@ const addHighlights = (dom, highlights, label) => {
2889
2921
  dom.push(text(afterText));
2890
2922
  }
2891
2923
  };
2924
+
2925
+ const getFileIconVirtualDom = icon => {
2926
+ return {
2927
+ type: Img$1,
2928
+ className: FileIcon,
2929
+ src: icon,
2930
+ role: None$1,
2931
+ childCount: 0
2932
+ };
2933
+ };
2934
+
2892
2935
  const getQuickPickItemVirtualDom = visibleItem => {
2893
2936
  const {
2894
2937
  posInSet,
@@ -2923,7 +2966,7 @@ const getQuickPickItemVirtualDom = visibleItem => {
2923
2966
  parent.childCount++;
2924
2967
  dom.push({
2925
2968
  type: Div$1,
2926
- className: `QuickPickMaskIcon MaskIcon MaskIcon${icon}`,
2969
+ className: mergeClassNames(`QuickPickMaskIcon`, 'MaskIcon', `MaskIcon${icon}`),
2927
2970
  childCount: 0
2928
2971
  });
2929
2972
  }
@@ -2940,6 +2983,7 @@ const getQuickPickItemVirtualDom = visibleItem => {
2940
2983
  };
2941
2984
 
2942
2985
  const getQuickPickNoResultsVirtualDom = () => {
2986
+ const noResults$1 = noResults();
2943
2987
  return [{
2944
2988
  type: Div$1,
2945
2989
  className: 'QuickPickItem QuickPickItemActive QuickPickStatus',
@@ -2948,7 +2992,7 @@ const getQuickPickNoResultsVirtualDom = () => {
2948
2992
  type: Div$1,
2949
2993
  className: Label,
2950
2994
  childCount: 1
2951
- }, text('No Results')];
2995
+ }, text(noResults$1)];
2952
2996
  };
2953
2997
 
2954
2998
  const getQuickPickItemsVirtualDom = visibleItems => {
@@ -2959,47 +3003,6 @@ const getQuickPickItemsVirtualDom = visibleItems => {
2959
3003
  return dom;
2960
3004
  };
2961
3005
 
2962
- const HandleBeforeInput = 'handleBeforeInput';
2963
- const HandleBlur = 'handleBlur';
2964
- const HandleFocus = 'handleFocus';
2965
- const HandleInput = 'handleInput';
2966
- const HandlePointerDown = 'handlePointerDown';
2967
- const HandleWheel = 'handleWheel';
2968
-
2969
- const QuickPick = 'QuickPick';
2970
- const QuickPickItems = 'QuickPickItems';
2971
- const QuickPickItemActive = 'QuickPickItemActive';
2972
-
2973
- const getQuickPickInputVirtualDom = () => {
2974
- const ariaLabel = typeNameofCommandToRun();
2975
- return {
2976
- type: Input$1,
2977
- className: InputBox,
2978
- spellcheck: false,
2979
- autocapitalize: 'off',
2980
- inputType: 'text',
2981
- childCount: 0,
2982
- role: ComboBox,
2983
- name: QuickPickInput,
2984
- onBeforeInput: HandleBeforeInput,
2985
- onBlur: HandleBlur,
2986
- onInput: HandleInput,
2987
- onFocus: HandleFocus,
2988
- ariaLabel: ariaLabel,
2989
- ariaAutoComplete: 'list',
2990
- ariaExpanded: true,
2991
- autocomplete: 'off'
2992
- };
2993
- };
2994
-
2995
- const getQuickPickHeaderVirtualDom = () => {
2996
- return [{
2997
- type: Div$1,
2998
- className: QuickPickHeader,
2999
- childCount: 1
3000
- }, getQuickPickInputVirtualDom()];
3001
- };
3002
-
3003
3006
  const getQuickPickVirtualDom = visibleItems => {
3004
3007
  const quickOpen$1 = quickOpen();
3005
3008
  return [{
@@ -3020,12 +3023,8 @@ const getQuickPickVirtualDom = visibleItems => {
3020
3023
  };
3021
3024
 
3022
3025
  const renderItems = newState => {
3023
- if (newState.renderAllItems) {
3024
- const dom = getQuickPickVirtualDom(newState.visibleItems);
3025
- return ['Viewlet.setDom2', dom];
3026
- }
3027
- const dom = getQuickPickItemsVirtualDom(newState.visibleItems);
3028
- return ['Viewlet.send', newState.uid, /* method */'setItemsDom', dom];
3026
+ const dom = getQuickPickVirtualDom(newState.visibleItems);
3027
+ return ['Viewlet.setDom2', dom];
3029
3028
  };
3030
3029
 
3031
3030
  const renderValue = newState => {
@@ -3055,10 +3054,10 @@ const applyRender = async (oldState, newState, diffResult) => {
3055
3054
  const commands = [];
3056
3055
  const viewModel = await createQuickPickViewModel(oldState, newState);
3057
3056
  for (const item of diffResult) {
3058
- if (viewModel.renderAllItems && item === Height) {
3057
+ if (item === Height) {
3059
3058
  continue;
3060
3059
  }
3061
- if (viewModel.renderAllItems && item === RenderFocusedIndex) {
3060
+ if (item === RenderFocusedIndex) {
3062
3061
  continue;
3063
3062
  }
3064
3063
  const fn = getRenderer(item);
@@ -3173,6 +3172,7 @@ const wrapCommand = fn => {
3173
3172
 
3174
3173
  const commandMap = {
3175
3174
  'QuickPick.addMenuEntries': add,
3175
+ 'QuickPick.close': close,
3176
3176
  'QuickPick.create2': create,
3177
3177
  'QuickPick.dispose': dispose,
3178
3178
  'QuickPick.focusFirst': wrapCommand(focusFirst),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-search-worker",
3
- "version": "4.3.0",
3
+ "version": "4.5.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "text-search"