@lvce-editor/file-search-worker 5.16.0 → 5.18.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.
@@ -60,49 +60,57 @@ class AssertionError extends Error {
60
60
  this.name = 'AssertionError';
61
61
  }
62
62
  }
63
+ const Object$1 = 1;
64
+ const Number$1 = 2;
65
+ const Array$1 = 3;
66
+ const String = 4;
67
+ const Boolean$1 = 5;
68
+ const Function = 6;
69
+ const Null = 7;
70
+ const Unknown = 8;
63
71
  const getType = value => {
64
72
  switch (typeof value) {
65
73
  case 'number':
66
- return 'number';
74
+ return Number$1;
67
75
  case 'function':
68
- return 'function';
76
+ return Function;
69
77
  case 'string':
70
- return 'string';
78
+ return String;
71
79
  case 'object':
72
80
  if (value === null) {
73
- return 'null';
81
+ return Null;
74
82
  }
75
83
  if (Array.isArray(value)) {
76
- return 'array';
84
+ return Array$1;
77
85
  }
78
- return 'object';
86
+ return Object$1;
79
87
  case 'boolean':
80
- return 'boolean';
88
+ return Boolean$1;
81
89
  default:
82
- return 'unknown';
90
+ return Unknown;
83
91
  }
84
92
  };
85
93
  const object = value => {
86
94
  const type = getType(value);
87
- if (type !== 'object') {
95
+ if (type !== Object$1) {
88
96
  throw new AssertionError('expected value to be of type object');
89
97
  }
90
98
  };
91
99
  const number = value => {
92
100
  const type = getType(value);
93
- if (type !== 'number') {
101
+ if (type !== Number$1) {
94
102
  throw new AssertionError('expected value to be of type number');
95
103
  }
96
104
  };
97
105
  const array = value => {
98
106
  const type = getType(value);
99
- if (type !== 'array') {
107
+ if (type !== Array$1) {
100
108
  throw new AssertionError('expected value to be of type array');
101
109
  }
102
110
  };
103
111
  const string = value => {
104
112
  const type = getType(value);
105
- if (type !== 'string') {
113
+ if (type !== String) {
106
114
  throw new AssertionError('expected value to be of type string');
107
115
  }
108
116
  };
@@ -918,20 +926,52 @@ const create$3 = rpcId => {
918
926
  };
919
927
  const RendererWorker$1 = 1;
920
928
  const {
921
- invoke: invoke$4,
929
+ invoke: invoke$3,
922
930
  set: set$3} = create$3(RendererWorker$1);
931
+ const setFocus$2 = key => {
932
+ return invoke$3('Focus.setFocus', key);
933
+ };
934
+ const getFileIcon$1 = async options => {
935
+ return invoke$3('IconTheme.getFileIcon', options);
936
+ };
937
+ const getFolderIcon$1 = async options => {
938
+ return invoke$3('IconTheme.getFolderIcon', options);
939
+ };
940
+ const closeWidget$2 = async widgetId => {
941
+ return invoke$3('Viewlet.closeWidget', widgetId);
942
+ };
943
+ const openUri$2 = async (uri, focus, options) => {
944
+ await invoke$3('Main.openUri', uri, focus, options);
945
+ };
946
+ const showErrorDialog$2 = async errorInfo => {
947
+ // @ts-ignore
948
+ await invoke$3('ErrorHandling.showErrorDialog', errorInfo);
949
+ };
923
950
  const RendererWorker = {
924
951
  __proto__: null,
925
- invoke: invoke$4,
926
- set: set$3
927
- };
952
+ closeWidget: closeWidget$2,
953
+ getFileIcon: getFileIcon$1,
954
+ getFolderIcon: getFolderIcon$1,
955
+ invoke: invoke$3,
956
+ openUri: openUri$2,
957
+ set: set$3,
958
+ setFocus: setFocus$2,
959
+ showErrorDialog: showErrorDialog$2};
928
960
 
929
961
  const {
930
962
  invoke: invoke$1,
931
- set: set$1} = RendererWorker;
963
+ set: set$1,
964
+ setFocus: setFocus$1,
965
+ closeWidget: closeWidget$1,
966
+ showErrorDialog: showErrorDialog$1,
967
+ openUri: openUri$1,
968
+ getFileIcon,
969
+ getFolderIcon
970
+ } = RendererWorker;
932
971
 
933
972
  const closeWidget = async id => {
934
- await invoke$1('Viewlet.closeWidget', id);
973
+ // @ts-ignore
974
+ await closeWidget$1(id);
935
975
  };
936
976
 
937
977
  const close = async state => {
@@ -1233,9 +1273,9 @@ const requestFileIcon = async request => {
1233
1273
  if (!request.name) {
1234
1274
  return '';
1235
1275
  }
1236
- return request.type === File$1 ? invoke$1('IconTheme.getFileIcon', {
1276
+ return request.type === File$1 ? getFileIcon({
1237
1277
  name: request.name
1238
- }) : invoke$1('IconTheme.getFolderIcon', {
1278
+ }) : getFolderIcon({
1239
1279
  name: request.name
1240
1280
  });
1241
1281
  };
@@ -1857,7 +1897,7 @@ const showErrorDialog = async error => {
1857
1897
  stack,
1858
1898
  name
1859
1899
  };
1860
- await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
1900
+ await showErrorDialog$1(errorInfo);
1861
1901
  };
1862
1902
  const warn = (...args) => {
1863
1903
  console.warn(...args);
@@ -2278,7 +2318,7 @@ const selectPick$7 = async pick => {
2278
2318
  };
2279
2319
 
2280
2320
  const openUri = async uri => {
2281
- await invoke$1(/* Main.openUri */'Main.openUri', /* uri */uri);
2321
+ await openUri$1(uri);
2282
2322
  };
2283
2323
 
2284
2324
  const selectPick$6 = async pick => {
@@ -2532,9 +2572,7 @@ const handleClickAt = (state, x, y) => {
2532
2572
  return selectIndex(state, index);
2533
2573
  };
2534
2574
 
2535
- const setFocus = async focusKey => {
2536
- await invoke$1('Focus.setFocus', focusKey);
2537
- };
2575
+ const setFocus = setFocus$1;
2538
2576
 
2539
2577
  const handleFocus = async state => {
2540
2578
  // TODO fix virtual dom diffing so that input isn't destroyed and loses focus when rerendering
@@ -2775,6 +2813,34 @@ const renderHeight = newState => {
2775
2813
  return ['Viewlet.send', newState.uid, /* method */SetItemsHeight, /* height */newState.height];
2776
2814
  };
2777
2815
 
2816
+ const mergeClassNames = (...classNames) => {
2817
+ return classNames.filter(Boolean).join(' ');
2818
+ };
2819
+ const px = value => {
2820
+ return `${value}px`;
2821
+ };
2822
+ const position = (x, y) => {
2823
+ return `${x}px ${y}px`;
2824
+ };
2825
+ const Div = 4;
2826
+ const Input = 6;
2827
+ const Span = 8;
2828
+ const Text = 12;
2829
+ const Img = 17;
2830
+ const VirtualDomElements = {
2831
+ __proto__: null,
2832
+ Div,
2833
+ Img,
2834
+ Input,
2835
+ Span};
2836
+ const text = data => {
2837
+ return {
2838
+ type: Text,
2839
+ text: data,
2840
+ childCount: 0
2841
+ };
2842
+ };
2843
+
2778
2844
  const ComboBox = 'combobox';
2779
2845
  const ListBox = 'listbox';
2780
2846
  const None = 'none';
@@ -2812,15 +2878,10 @@ const QuickPick = 'QuickPick';
2812
2878
  const QuickPickItems = 'QuickPickItems';
2813
2879
  const QuickPickItemActive = 'QuickPickItemActive';
2814
2880
 
2815
- const Div = 4;
2816
- const Input = 6;
2817
- const Span = 8;
2818
- const Img = 17;
2819
-
2820
2881
  const getQuickPickInputVirtualDom = () => {
2821
2882
  const ariaLabel = typeNameofCommandToRun();
2822
2883
  return {
2823
- type: Input,
2884
+ type: VirtualDomElements.Input,
2824
2885
  className: InputBox,
2825
2886
  spellcheck: false,
2826
2887
  autocapitalize: 'off',
@@ -2841,7 +2902,7 @@ const getQuickPickInputVirtualDom = () => {
2841
2902
 
2842
2903
  const getQuickPickHeaderVirtualDom = () => {
2843
2904
  return [{
2844
- type: Div,
2905
+ type: VirtualDomElements.Div,
2845
2906
  className: QuickPickHeader,
2846
2907
  childCount: 1
2847
2908
  }, getQuickPickInputVirtualDom()];
@@ -2849,7 +2910,7 @@ const getQuickPickHeaderVirtualDom = () => {
2849
2910
 
2850
2911
  const getFileIconVirtualDom = icon => {
2851
2912
  return {
2852
- type: Img,
2913
+ type: VirtualDomElements.Img,
2853
2914
  className: FileIcon,
2854
2915
  src: icon,
2855
2916
  role: None,
@@ -2857,32 +2918,14 @@ const getFileIconVirtualDom = icon => {
2857
2918
  };
2858
2919
  };
2859
2920
 
2860
- const mergeClassNames = (...classNames) => {
2861
- return classNames.filter(Boolean).join(' ');
2862
- };
2863
- const px = value => {
2864
- return `${value}px`;
2865
- };
2866
- const position = (x, y) => {
2867
- return `${x}px ${y}px`;
2868
- };
2869
- const Text = 12;
2870
- const text = data => {
2871
- return {
2872
- type: Text,
2873
- text: data,
2874
- childCount: 0
2875
- };
2876
- };
2877
-
2878
2921
  const quickPickHighlight = {
2879
- type: Span,
2922
+ type: VirtualDomElements.Span,
2880
2923
  className: QuickPickHighlight,
2881
2924
  childCount: 1
2882
2925
  };
2883
2926
  const getHighlights = (sections, label) => {
2884
2927
  const labelDom = {
2885
- type: Div,
2928
+ type: VirtualDomElements.Div,
2886
2929
  className: QuickPickItemLabel,
2887
2930
  childCount: 0
2888
2931
  };
@@ -2917,7 +2960,7 @@ const getQuickPickItemVirtualDom = visibleItem => {
2917
2960
  } = visibleItem;
2918
2961
  const dom = [];
2919
2962
  dom.push({
2920
- type: Div,
2963
+ type: VirtualDomElements.Div,
2921
2964
  className: QuickPickItem,
2922
2965
  role: Option,
2923
2966
  ariaPosInSet: posInSet,
@@ -2936,7 +2979,7 @@ const getQuickPickItemVirtualDom = visibleItem => {
2936
2979
  } else if (icon) {
2937
2980
  parent.childCount++;
2938
2981
  dom.push({
2939
- type: Div,
2982
+ type: VirtualDomElements.Div,
2940
2983
  className: mergeClassNames(QuickPickMaskIcon, MaskIcon, `MaskIcon${icon}`),
2941
2984
  childCount: 0
2942
2985
  });
@@ -2946,7 +2989,7 @@ const getQuickPickItemVirtualDom = visibleItem => {
2946
2989
  if (description) {
2947
2990
  parent.childCount++;
2948
2991
  dom.push({
2949
- type: Div,
2992
+ type: VirtualDomElements.Div,
2950
2993
  className: QuickPickItemDescription,
2951
2994
  childCount: 1
2952
2995
  }, text(description));
@@ -2957,11 +3000,11 @@ const getQuickPickItemVirtualDom = visibleItem => {
2957
3000
  const getQuickPickNoResultsVirtualDom = () => {
2958
3001
  const noResults$1 = noResults();
2959
3002
  return [{
2960
- type: Div,
3003
+ type: VirtualDomElements.Div,
2961
3004
  className: mergeClassNames(QuickPickItem, QuickPickItemActive$1, QuickPickStatus),
2962
3005
  childCount: 1
2963
3006
  }, {
2964
- type: Div,
3007
+ type: VirtualDomElements.Div,
2965
3008
  className: Label,
2966
3009
  childCount: 1
2967
3010
  }, text(noResults$1)];
@@ -2983,11 +3026,11 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarTop) => {
2983
3026
  const heightString = px(scrollBarHeight);
2984
3027
  const translateString = position(0, scrollBarTop);
2985
3028
  return [{
2986
- type: Div,
3029
+ type: VirtualDomElements.Div,
2987
3030
  className: mergeClassNames(ScrollBar, ScrollBarSmall),
2988
3031
  childCount: 1
2989
3032
  }, {
2990
- type: Div,
3033
+ type: VirtualDomElements.Div,
2991
3034
  className: ScrollBarThumb,
2992
3035
  childCount: 0,
2993
3036
  height: heightString,
@@ -2999,13 +3042,13 @@ const getQuickPickVirtualDom = (visibleItems, scrollBarHeight, scrollBarTop) =>
2999
3042
  const quickOpen$1 = quickOpen();
3000
3043
  const shouldShowScrollbar = scrollBarHeight > 0;
3001
3044
  return [{
3002
- type: Div,
3045
+ type: VirtualDomElements.Div,
3003
3046
  className: mergeClassNames(Viewlet, QuickPick$1),
3004
3047
  childCount: 2,
3005
3048
  id: QuickPick,
3006
3049
  ariaLabel: quickOpen$1
3007
3050
  }, ...getQuickPickHeaderVirtualDom(), {
3008
- type: Div,
3051
+ type: VirtualDomElements.Div,
3009
3052
  className: mergeClassNames(List, ContainContent),
3010
3053
  id: QuickPickItems,
3011
3054
  role: ListBox,
@@ -3014,7 +3057,7 @@ const getQuickPickVirtualDom = (visibleItems, scrollBarHeight, scrollBarTop) =>
3014
3057
  onPointerDown: HandlePointerDown,
3015
3058
  childCount: shouldShowScrollbar ? 2 : 1
3016
3059
  }, {
3017
- type: Div,
3060
+ type: VirtualDomElements.Div,
3018
3061
  className: mergeClassNames(ListItems, ContainContent),
3019
3062
  childCount: visibleItems.length
3020
3063
  }, ...getQuickPickItemsVirtualDom(visibleItems), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarTop)];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-search-worker",
3
- "version": "5.16.0",
3
+ "version": "5.18.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "text-search"