@lvce-editor/file-search-worker 3.9.0 → 3.11.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.
@@ -442,10 +442,10 @@ const create$4$1 = (method, params) => {
442
442
  };
443
443
  };
444
444
  const callbacks = Object.create(null);
445
- const set$1 = (id, fn) => {
445
+ const set$2 = (id, fn) => {
446
446
  callbacks[id] = fn;
447
447
  };
448
- const get$1 = id => {
448
+ const get$2 = id => {
449
449
  return callbacks[id];
450
450
  };
451
451
  const remove$2 = id => {
@@ -461,7 +461,7 @@ const registerPromise = () => {
461
461
  resolve,
462
462
  promise
463
463
  } = Promise.withResolvers();
464
- set$1(id, resolve);
464
+ set$2(id, resolve);
465
465
  return {
466
466
  id,
467
467
  promise
@@ -618,7 +618,7 @@ const warn$1 = (...args) => {
618
618
  console.warn(...args);
619
619
  };
620
620
  const resolve = (id, response) => {
621
- const fn = get$1(id);
621
+ const fn = get$2(id);
622
622
  if (!fn) {
623
623
  console.log(response);
624
624
  warn$1(`callback ${id} may already be disposed`);
@@ -871,14 +871,14 @@ const warn = (...args) => {
871
871
  console.warn(...args);
872
872
  };
873
873
 
874
- const state$5 = {
874
+ const state$4 = {
875
875
  menuEntries: []
876
876
  };
877
877
  const getAll = () => {
878
- return state$5.menuEntries;
878
+ return state$4.menuEntries;
879
879
  };
880
880
  const add = menuEntries => {
881
- state$5.menuEntries = [...state$5.menuEntries, ...menuEntries];
881
+ state$4.menuEntries = [...state$4.menuEntries, ...menuEntries];
882
882
  };
883
883
 
884
884
  const Hide = 'hide';
@@ -950,19 +950,21 @@ const noWorkspaceSymbolsFound = () => {
950
950
  return i18nString(NoWorkspaceSymbolsFound);
951
951
  };
952
952
 
953
- const state$4 = {
954
- rpc: undefined
953
+ const RendererWorker = 1;
954
+
955
+ const rpcs = Object.create(null);
956
+ const set$1 = (id, rpc) => {
957
+ rpcs[id] = rpc;
958
+ };
959
+ const get$1 = id => {
960
+ return rpcs[id];
955
961
  };
956
962
 
957
- // TODO use rpc registry
958
963
  const invoke$1 = (method, ...params) => {
959
- const rpc = state$4.rpc;
964
+ const rpc = get$1(RendererWorker);
960
965
  // @ts-ignore
961
966
  return rpc.invoke(method, ...params);
962
967
  };
963
- const setRpc = rpc => {
964
- state$4.rpc = rpc;
965
- };
966
968
 
967
969
  const name$8 = 'command';
968
970
  const getPlaceholder$b = () => {
@@ -1045,7 +1047,7 @@ const selectPickBuiltin = async item => {
1045
1047
  const selectPickExtension = async item => {
1046
1048
  const id = item.id.slice(4); // TODO lots of string allocation with 'ext.' find a better way to separate builtin commands from extension commands
1047
1049
  try {
1048
- await invoke$1('ExtensionHostCommands.executeCommand', id);
1050
+ await invoke$1('ExtensionHost.executeCommand', id);
1049
1051
  } catch (error) {
1050
1052
  await handleError(error, false);
1051
1053
  // @ts-ignore
@@ -3463,6 +3465,31 @@ const RenderCursorOffset = 7;
3463
3465
  const RenderFocusedIndex = 8;
3464
3466
  const Height = 9;
3465
3467
 
3468
+ const SetCursorOffset = 'setCursorOffset';
3469
+ const SetFocusedIndex = 'setFocusedIndex';
3470
+ const SetItemsHeight = 'setItemsHeight';
3471
+ const SetValue = 'setValue';
3472
+
3473
+ const renderCursorOffset = newState => {
3474
+ return ['Viewlet.send', newState.uid, /* method */SetCursorOffset, /* cursorOffset */newState.cursorOffset];
3475
+ };
3476
+
3477
+ const renderFocus = newState => {
3478
+ const selector = newState.focused ? '.InputBox' : '';
3479
+ return ['Viewlet.focusSelector', selector];
3480
+ };
3481
+
3482
+ const renderFocusedIndex = newState => {
3483
+ return ['Viewlet.send', newState.uid, /* method */SetFocusedIndex, /* oldFocusedIndex */newState.oldFocusedIndex, /* newFocusedIndex */newState.newFocusedIndex];
3484
+ };
3485
+
3486
+ const renderHeight = newState => {
3487
+ if (newState.height === 0) {
3488
+ return ['Viewlet.send', newState.uid, /* method */SetItemsHeight, /* height */20];
3489
+ }
3490
+ return ['Viewlet.send', newState.uid, /* method */SetItemsHeight, /* height */newState.height];
3491
+ };
3492
+
3466
3493
  const FileIcon = 'FileIcon';
3467
3494
  const Label = 'Label';
3468
3495
  const QuickPickHighlight = 'QuickPickHighlight';
@@ -3595,34 +3622,15 @@ const getQuickPickItemsVirtualDom = visibleItems => {
3595
3622
  return dom;
3596
3623
  };
3597
3624
 
3598
- const SetCursorOffset = 'setCursorOffset';
3599
- const SetFocusedIndex = 'setFocusedIndex';
3600
- const SetItemsHeight = 'setItemsHeight';
3601
- const SetValue = 'setValue';
3602
-
3603
- const renderValue = newState => {
3604
- return ['Viewlet.send', newState.uid, /* method */SetValue, /* value */newState.value];
3605
- };
3606
- const renderCursorOffset = newState => {
3607
- return ['Viewlet.send', newState.uid, /* method */SetCursorOffset, /* cursorOffset */newState.cursorOffset];
3608
- };
3609
3625
  const renderItems = newState => {
3610
3626
  const dom = getQuickPickItemsVirtualDom(newState.visibleItems);
3611
3627
  return ['Viewlet.send', newState.uid, /* method */'setItemsDom', dom];
3612
3628
  };
3613
- const renderFocusedIndex = newState => {
3614
- return ['Viewlet.send', newState.uid, /* method */SetFocusedIndex, /* oldFocusedIndex */newState.oldFocusedIndex, /* newFocusedIndex */newState.newFocusedIndex];
3615
- };
3616
- const renderHeight = newState => {
3617
- if (newState.height === 0) {
3618
- return ['Viewlet.send', newState.uid, /* method */SetItemsHeight, /* height */20];
3619
- }
3620
- return ['Viewlet.send', newState.uid, /* method */SetItemsHeight, /* height */newState.height];
3621
- };
3622
- const renderFocus = newState => {
3623
- const selector = newState.focused ? '.InputBox' : '';
3624
- return ['Viewlet.focusSelector', selector];
3629
+
3630
+ const renderValue = newState => {
3631
+ return ['Viewlet.send', newState.uid, /* method */SetValue, /* value */newState.value];
3625
3632
  };
3633
+
3626
3634
  const getRenderer = diffType => {
3627
3635
  switch (diffType) {
3628
3636
  case RenderValue:
@@ -3809,6 +3817,7 @@ const wrapCommand = fn => {
3809
3817
 
3810
3818
  const commandMap = {
3811
3819
  'QuickPick.create2': create$1,
3820
+ 'QuickPick.handleInput': wrapCommand(handleInput),
3812
3821
  'QuickPick.focusFirst': wrapCommand(focusFirst),
3813
3822
  'QuickPick.focusIndex': wrapCommand(focusIndex),
3814
3823
  'QuickPick.focusLast': wrapCommand(focusLast),
@@ -3857,7 +3866,7 @@ const listen = async () => {
3857
3866
  const rpc = await WebWorkerRpcClient.create({
3858
3867
  commandMap: commandMap
3859
3868
  });
3860
- setRpc(rpc);
3869
+ set$1(RendererWorker, rpc);
3861
3870
  };
3862
3871
 
3863
3872
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-search-worker",
3
- "version": "3.9.0",
3
+ "version": "3.11.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "text-search"