@lvce-editor/file-search-worker 5.17.0 → 5.19.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.
@@ -926,19 +926,52 @@ const create$3 = rpcId => {
926
926
  };
927
927
  const RendererWorker$1 = 1;
928
928
  const {
929
- invoke: invoke$4,
929
+ invoke: invoke$3,
930
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
+ };
931
950
  const RendererWorker = {
932
951
  __proto__: null,
933
- invoke: invoke$4,
934
- set: set$3};
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};
935
960
 
936
961
  const {
937
962
  invoke: invoke$1,
938
- 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;
939
971
 
940
972
  const closeWidget = async id => {
941
- await invoke$1('Viewlet.closeWidget', id);
973
+ // @ts-ignore
974
+ await closeWidget$1(id);
942
975
  };
943
976
 
944
977
  const close = async state => {
@@ -954,8 +987,13 @@ const minimumSliderSize = 20;
954
987
  const Default$1 = 0;
955
988
  const Finished = 2;
956
989
 
990
+ const toCommandId = key => {
991
+ const dotIndex = key.indexOf('.');
992
+ return key.slice(dotIndex + 1);
993
+ };
957
994
  const create$2 = () => {
958
995
  const states = Object.create(null);
996
+ const commandMapRef = {};
959
997
  return {
960
998
  get(uid) {
961
999
  return states[uid];
@@ -996,6 +1034,15 @@ const create$2 = () => {
996
1034
  };
997
1035
  return wrapped;
998
1036
  },
1037
+ wrapGetter(fn) {
1038
+ const wrapped = (uid, ...args) => {
1039
+ const {
1040
+ newState
1041
+ } = states[uid];
1042
+ return fn(newState, ...args);
1043
+ };
1044
+ return wrapped;
1045
+ },
999
1046
  diff(uid, modules, numbers) {
1000
1047
  const {
1001
1048
  oldState,
@@ -1009,6 +1056,14 @@ const create$2 = () => {
1009
1056
  }
1010
1057
  }
1011
1058
  return diffResult;
1059
+ },
1060
+ getCommandIds() {
1061
+ const keys = Object.keys(commandMapRef);
1062
+ const ids = keys.map(toCommandId);
1063
+ return ids;
1064
+ },
1065
+ registerCommands(commandMap) {
1066
+ Object.assign(commandMapRef, commandMap);
1012
1067
  }
1013
1068
  };
1014
1069
  };
@@ -1240,9 +1295,9 @@ const requestFileIcon = async request => {
1240
1295
  if (!request.name) {
1241
1296
  return '';
1242
1297
  }
1243
- return request.type === File$1 ? invoke$1('IconTheme.getFileIcon', {
1298
+ return request.type === File$1 ? getFileIcon({
1244
1299
  name: request.name
1245
- }) : invoke$1('IconTheme.getFolderIcon', {
1300
+ }) : getFolderIcon({
1246
1301
  name: request.name
1247
1302
  });
1248
1303
  };
@@ -1864,7 +1919,7 @@ const showErrorDialog = async error => {
1864
1919
  stack,
1865
1920
  name
1866
1921
  };
1867
- await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
1922
+ await showErrorDialog$1(errorInfo);
1868
1923
  };
1869
1924
  const warn = (...args) => {
1870
1925
  console.warn(...args);
@@ -2285,7 +2340,7 @@ const selectPick$7 = async pick => {
2285
2340
  };
2286
2341
 
2287
2342
  const openUri = async uri => {
2288
- await invoke$1(/* Main.openUri */'Main.openUri', /* uri */uri);
2343
+ await openUri$1(uri);
2289
2344
  };
2290
2345
 
2291
2346
  const selectPick$6 = async pick => {
@@ -2539,9 +2594,7 @@ const handleClickAt = (state, x, y) => {
2539
2594
  return selectIndex(state, index);
2540
2595
  };
2541
2596
 
2542
- const setFocus = async focusKey => {
2543
- await invoke$1('Focus.setFocus', focusKey);
2544
- };
2597
+ const setFocus = setFocus$1;
2545
2598
 
2546
2599
  const handleFocus = async state => {
2547
2600
  // TODO fix virtual dom diffing so that input isn't destroyed and loses focus when rerendering
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-search-worker",
3
- "version": "5.17.0",
4
- "description": "",
3
+ "version": "5.19.0",
5
4
  "keywords": [
6
5
  "text-search"
7
6
  ],