@lvce-editor/quick-pick-worker 4.14.1 → 4.15.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.
@@ -2758,14 +2758,24 @@ const i18nString = (key, placeholders = emptyObject) => {
2758
2758
  const GoToFile = 'Go to file';
2759
2759
  const GoToLineColumn = 'Go to Line / Column';
2760
2760
  const GoToSymbolInEditor = 'Go to Symbol in Editor';
2761
+ const GoToSymbolInWorkspace = 'Go to Symbol in Workspace';
2761
2762
  const NoResults = 'No Results';
2762
2763
  const OpenView = 'Open View';
2763
2764
  const QuickOpen = 'Quick open';
2764
2765
  const SearchForText = 'Search for text';
2766
+ const SelectColorTheme = 'Select Color Theme';
2767
+ const SelectLanguageMode = 'Select Language Mode';
2768
+ const SelectToOpen = 'Select to open';
2765
2769
  const ShowAndRunCommands = 'Show And Run Commands';
2766
2770
  const TypeNameOfCommandToRun = 'Type the name of a command to run.';
2767
2771
  const PressEnterToGoToLine = "Press 'Enter' to go to line {PH1} column {PH2}";
2768
2772
 
2773
+ const selectColorTheme = () => {
2774
+ return i18nString(SelectColorTheme);
2775
+ };
2776
+ const selectLanguageMode = () => {
2777
+ return i18nString(SelectLanguageMode);
2778
+ };
2769
2779
  const pressEnterToGoToLine = (row, column) => {
2770
2780
  return i18nString(PressEnterToGoToLine, {
2771
2781
  PH1: row,
@@ -2784,6 +2794,9 @@ const goToFile = () => {
2784
2794
  const noResults = () => {
2785
2795
  return i18nString(NoResults);
2786
2796
  };
2797
+ const selectToOpen = () => {
2798
+ return i18nString(SelectToOpen);
2799
+ };
2787
2800
  const quickOpen = () => {
2788
2801
  return i18nString(QuickOpen);
2789
2802
  };
@@ -2793,6 +2806,9 @@ const goToLineColumn = () => {
2793
2806
  const goToSymbolInEditor = () => {
2794
2807
  return i18nString(GoToSymbolInEditor);
2795
2808
  };
2809
+ const goToSymbolInWorkspace = () => {
2810
+ return i18nString(GoToSymbolInWorkspace);
2811
+ };
2796
2812
  const searchForText = () => {
2797
2813
  return i18nString(SearchForText);
2798
2814
  };
@@ -3816,9 +3832,19 @@ const set = rpc => {
3816
3832
  state.connected = true;
3817
3833
  };
3818
3834
 
3819
- const handleRendererProcessMessagePort = async port => {
3835
+ const handleRendererProcessMessagePort = async (port, viewletCommandMap) => {
3836
+ const executeViewletCommand = async (uid, command, ...args) => {
3837
+ const fn = viewletCommandMap[`QuickPick.${command}`];
3838
+ if (typeof fn !== 'function') {
3839
+ throw new TypeError(`Viewlet command not found: ${command}`);
3840
+ }
3841
+ await fn(uid, ...args);
3842
+ await invoke$2('Viewlet.requestRender', uid);
3843
+ };
3820
3844
  const rpc = await create$8({
3821
- commandMap: {},
3845
+ commandMap: {
3846
+ 'Viewlet.executeViewletCommand': executeViewletCommand
3847
+ },
3822
3848
  messagePort: port
3823
3849
  });
3824
3850
  set(rpc);
@@ -4269,6 +4295,36 @@ const createQuickPickViewModel = (oldState, newState) => {
4269
4295
  };
4270
4296
  };
4271
4297
 
4298
+ const getQuickPickInputAriaLabel = (providerId, value, placeholder) => {
4299
+ const prefix = getQuickPickPrefix(value);
4300
+ const subProviderId = getQuickPickSubProviderId(providerId, prefix);
4301
+ switch (subProviderId) {
4302
+ case ColorTheme$1:
4303
+ return selectColorTheme();
4304
+ case Commands$1:
4305
+ return typeNameofCommandToRun();
4306
+ case Custom$1:
4307
+ return placeholder || quickOpen();
4308
+ case File$1:
4309
+ return goToFile();
4310
+ case GoToColumn$1:
4311
+ case GoToLine$2:
4312
+ return goToLineColumn();
4313
+ case LanguageMode$1:
4314
+ return selectLanguageMode();
4315
+ case Recent$1:
4316
+ return selectToOpen();
4317
+ case Symbol$3:
4318
+ return goToSymbolInEditor();
4319
+ case View$3:
4320
+ return openView();
4321
+ case WorkspaceSymbol$2:
4322
+ return goToSymbolInWorkspace();
4323
+ default:
4324
+ return quickOpen();
4325
+ }
4326
+ };
4327
+
4272
4328
  const ComboBox = 'combobox';
4273
4329
  const ListBox = 'listbox';
4274
4330
  const None = 'none';
@@ -4309,8 +4365,7 @@ const QuickPick$1 = 'QuickPick';
4309
4365
  const QuickPickItems = 'QuickPickItems';
4310
4366
  const QuickPickItemActive = 'QuickPickItemActive';
4311
4367
 
4312
- const getQuickPickInputVirtualDom = (placeholder = '') => {
4313
- const ariaLabel = typeNameofCommandToRun();
4368
+ const getQuickPickInputVirtualDom = (placeholder = '', ariaLabel = typeNameofCommandToRun()) => {
4314
4369
  return [{
4315
4370
  childCount: 1,
4316
4371
  className: QuickPickInputWrapper,
@@ -4335,12 +4390,12 @@ const getQuickPickInputVirtualDom = (placeholder = '') => {
4335
4390
  }];
4336
4391
  };
4337
4392
 
4338
- const getQuickPickHeaderVirtualDom = (placeholder = '') => {
4393
+ const getQuickPickHeaderVirtualDom = (placeholder = '', ariaLabel) => {
4339
4394
  return [{
4340
4395
  childCount: 1,
4341
4396
  className: QuickPickHeader,
4342
4397
  type: Div
4343
- }, ...getQuickPickInputVirtualDom(placeholder)];
4398
+ }, ...getQuickPickInputVirtualDom(placeholder, ariaLabel)];
4344
4399
  };
4345
4400
 
4346
4401
  const getFileIconVirtualDom = icon => {
@@ -4489,7 +4544,7 @@ const getRootNodeCount = nodes => {
4489
4544
  }
4490
4545
  return count;
4491
4546
  };
4492
- const getQuickPickVirtualDom = (visibleItems, scrollBarHeight, scrollBarTop, placeholder = '') => {
4547
+ const getQuickPickVirtualDom = (visibleItems, scrollBarHeight, scrollBarTop, placeholder = '', inputAriaLabel) => {
4493
4548
  const quickOpen$1 = quickOpen();
4494
4549
  const shouldShowScrollbar = scrollBarHeight > 0;
4495
4550
  const quickPickItemsDom = getQuickPickItemsVirtualDom(visibleItems);
@@ -4500,7 +4555,7 @@ const getQuickPickVirtualDom = (visibleItems, scrollBarHeight, scrollBarTop, pla
4500
4555
  className: mergeClassNames(Viewlet, QuickPick$2),
4501
4556
  id: QuickPick$1,
4502
4557
  type: Div
4503
- }, ...getQuickPickHeaderVirtualDom(placeholder), {
4558
+ }, ...getQuickPickHeaderVirtualDom(placeholder, inputAriaLabel), {
4504
4559
  ariaActivedescendant: QuickPickItemActive,
4505
4560
  childCount: shouldShowScrollbar ? 2 : 1,
4506
4561
  className: mergeClassNames(List, ContainContent),
@@ -4526,7 +4581,8 @@ const renderItemsDom = state => {
4526
4581
  scrollBarTop,
4527
4582
  visibleItems
4528
4583
  } = viewModel;
4529
- return getQuickPickVirtualDom(visibleItems, scrollBarHeight, scrollBarTop, state.placeholder);
4584
+ const inputAriaLabel = getQuickPickInputAriaLabel(state.providerId, state.value, state.placeholder);
4585
+ return getQuickPickVirtualDom(visibleItems, scrollBarHeight, scrollBarTop, state.placeholder, inputAriaLabel);
4530
4586
  };
4531
4587
  const renderItems = (_oldState, newState) => {
4532
4588
  const dom = renderItemsDom(newState);
@@ -4722,6 +4778,7 @@ const showQuickPick = async ({
4722
4778
  }
4723
4779
  };
4724
4780
 
4781
+ const handleDirectMessagePort = port => handleRendererProcessMessagePort(port, commandMap);
4725
4782
  const commandMap = {
4726
4783
  'QuickPick.addMenuEntries': add$1,
4727
4784
  'QuickPick.close': wrapCommand(close),
@@ -4742,7 +4799,7 @@ const commandMap = {
4742
4799
  'QuickPick.handleFocus': wrapCommand(handleFocus),
4743
4800
  'QuickPick.handleInput': wrapAsyncCommand(handleInputWithContext),
4744
4801
  'QuickPick.handleMessagePort': handleMessagePort,
4745
- 'QuickPick.handleRendererProcessMessagePort': handleRendererProcessMessagePort,
4802
+ 'QuickPick.handleRendererProcessMessagePort': handleDirectMessagePort,
4746
4803
  'QuickPick.handleScrollBarPointerDown': wrapCommand(handleScrollBarPointerDown),
4747
4804
  'QuickPick.handleScrollBarPointerMove': wrapCommand(handleScrollBarPointerMove),
4748
4805
  'QuickPick.handleScrollBarPointerUp': wrapCommand(handleScrollBarPointerUp),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/quick-pick-worker",
3
- "version": "4.14.1",
3
+ "version": "4.15.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lvce-editor/quick-pick-worker.git"