@lvce-editor/text-search-worker 5.12.0 → 5.14.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.
@@ -1243,7 +1243,7 @@ const terminate = () => {
1243
1243
  const Alert = 'alert';
1244
1244
  const Button$3 = 'button';
1245
1245
  const CheckBox = 'checkbox';
1246
- const None$1 = 'none';
1246
+ const None$2 = 'none';
1247
1247
  const ScrollBar$1 = 'scrollbar';
1248
1248
  const Status = 'status';
1249
1249
  const ToolBar = 'toolbar';
@@ -1330,6 +1330,10 @@ const TargetValue = 'event.target.value';
1330
1330
 
1331
1331
  const Search$1 = 18;
1332
1332
 
1333
+ const None$1 = 0;
1334
+
1335
+ const LeftClick = 0;
1336
+
1333
1337
  const Electron = 2;
1334
1338
  const Remote = 3;
1335
1339
 
@@ -2652,7 +2656,11 @@ const getNextFocus = (focus, flags) => {
2652
2656
  };
2653
2657
 
2654
2658
  const focusNextInput = state => {
2655
- const nextFocus = getNextFocus(state.focus, state.flags);
2659
+ const {
2660
+ focus,
2661
+ flags
2662
+ } = state;
2663
+ const nextFocus = getNextFocus(focus, flags);
2656
2664
  const isListFocus = nextFocus === FocusSearchResults;
2657
2665
  return {
2658
2666
  ...state,
@@ -2807,6 +2815,23 @@ const getKeyBindings = () => {
2807
2815
  return [...getSearchHeaderKeyBindings(), ...getSearchResultKeyBindings()];
2808
2816
  };
2809
2817
 
2818
+ const getMenuEntryIds = () => {
2819
+ return [Search$1];
2820
+ };
2821
+ const getMenuEntries = () => {
2822
+ return [{
2823
+ id: 'dismiss',
2824
+ label: 'dismiss',
2825
+ flags: None$1,
2826
+ command: /* TODO */''
2827
+ }, {
2828
+ id: 'copyPath',
2829
+ label: 'copyPath',
2830
+ flags: None$1,
2831
+ command: /* TODO */''
2832
+ }];
2833
+ };
2834
+
2810
2835
  const handleError = error => {
2811
2836
  console.error(`[text-search-worker] ${error}`);
2812
2837
  };
@@ -3475,11 +3500,45 @@ const handleInputBlur = async (state, name) => {
3475
3500
  return state;
3476
3501
  };
3477
3502
 
3478
- const handleInputFocus = state => {
3503
+ const getSearchFocusKey = key => {
3504
+ switch (key) {
3505
+ case SearchValue:
3506
+ return FocusSearchInput;
3507
+ case ReplaceValue:
3508
+ return FocusSearchReplaceInput;
3509
+ case MatchCase:
3510
+ return FocusSearchMatchCase;
3511
+ case MatchWholeWord:
3512
+ return FocusSearchWholeWord;
3513
+ case UseRegularExpression:
3514
+ return FocusSearchRegex;
3515
+ case ReplaceAll:
3516
+ return FocusSearchReplaceAll;
3517
+ case PreserveCase:
3518
+ return FocusSearchPreserveCase;
3519
+ case ToggleSearchDetails:
3520
+ return FocusToggleDetails;
3521
+ case FilesToInclude:
3522
+ return FocusSearchIncludeInput;
3523
+ case FilesToExclude:
3524
+ return FocusSearchExcludeInput;
3525
+ case SearchOnlyOpenEditors:
3526
+ return FocusSearchOpenEditors;
3527
+ case UseExcludeSettings:
3528
+ return FocusIgnoreFiles;
3529
+ case ToggleReplace:
3530
+ return FocusToggleReplace;
3531
+ default:
3532
+ return Empty;
3533
+ }
3534
+ };
3535
+
3536
+ const handleInputFocus = (state, name) => {
3537
+ const key = getSearchFocusKey(name);
3479
3538
  return {
3480
3539
  ...state,
3481
3540
  listFocused: false,
3482
- focus: FocusSearchInput,
3541
+ focus: key,
3483
3542
  focused: true
3484
3543
  };
3485
3544
  };
@@ -3491,6 +3550,19 @@ const handleListBlur = state => {
3491
3550
  };
3492
3551
  };
3493
3552
 
3553
+ const handleListFocus = async state => {
3554
+ const {
3555
+ listFocused
3556
+ } = state;
3557
+ if (listFocused) {
3558
+ return state;
3559
+ }
3560
+ return {
3561
+ ...state,
3562
+ listFocused: true
3563
+ };
3564
+ };
3565
+
3494
3566
  const handleSharedInput = (state, name, value, inputSource = Script) => {
3495
3567
  const fn = getInputHandler(name);
3496
3568
  return fn(state, value, inputSource);
@@ -3988,8 +4060,10 @@ const handleClickAt = async (state, eventX, eventY) => {
3988
4060
  return selectIndex(state, index);
3989
4061
  };
3990
4062
 
3991
- const handleListPointerDown = async state => {
3992
- // TODO set list to focused and render focus outline
4063
+ const handleListPointerDown = async (state, button) => {
4064
+ if (button !== LeftClick) {
4065
+ return state;
4066
+ }
3993
4067
  return {
3994
4068
  ...state,
3995
4069
  listFocused: true
@@ -4193,7 +4267,7 @@ const renderFocus = (oldState, newState) => {
4193
4267
  };
4194
4268
 
4195
4269
  const renderFocusContext = (oldState, newState) => {
4196
- return [SetFocusContext, newState.uid, newState.focus];
4270
+ return [SetFocusContext, newState.uid, FocusSearch, newState.focus];
4197
4271
  };
4198
4272
 
4199
4273
  const None = 0;
@@ -4380,7 +4454,6 @@ const getSearchMessageVirtualDom = (message, indented) => {
4380
4454
  type: Div,
4381
4455
  className: getClassName(indented),
4382
4456
  role: Status,
4383
- tabIndex: 0,
4384
4457
  childCount: 1
4385
4458
  }, text(message)];
4386
4459
  };
@@ -4501,7 +4574,7 @@ const getOutSideButtonsDom = outsideButtons => {
4501
4574
  preNodes: [{
4502
4575
  type: Div,
4503
4576
  className: SearchFieldContainer,
4504
- role: None$1,
4577
+ role: None$2,
4505
4578
  childCount: 1 + outsideButtons.length
4506
4579
  }],
4507
4580
  postNodes: outsideButtons.flatMap(getSearchFieldButtonVirtualDom)
@@ -4517,7 +4590,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
4517
4590
  const dom = [...preNodes, {
4518
4591
  type: Div,
4519
4592
  className: searchFieldClassName,
4520
- role: None$1,
4593
+ role: None$2,
4521
4594
  childCount: 2
4522
4595
  }, {
4523
4596
  type: TextArea,
@@ -4675,12 +4748,12 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
4675
4748
  const dom = [{
4676
4749
  type: Div,
4677
4750
  className: SearchHeaderTop,
4678
- role: None$1,
4751
+ role: None$2,
4679
4752
  childCount: 2
4680
4753
  }, ...getSearchToggleVirtualDom(replaceExpanded), {
4681
4754
  type: Div,
4682
4755
  className: SearchHeaderTopRight,
4683
- role: None$1,
4756
+ role: None$2,
4684
4757
  childCount: replaceExpanded ? 2 : 1
4685
4758
  }, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, Boolean(searchInputErrorMessage))];
4686
4759
  if (flags & ReplaceExpanded) {
@@ -4692,7 +4765,7 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
4692
4765
  const parentNode = {
4693
4766
  type: Div,
4694
4767
  className: SearchHeader,
4695
- role: None$1,
4768
+ role: None$2,
4696
4769
  childCount: 3,
4697
4770
  onContextMenu: HandleHeaderContextMenu
4698
4771
  };
@@ -4788,7 +4861,7 @@ const getFileIconVirtualDom = icon => {
4788
4861
  type: Img,
4789
4862
  className: FileIcon,
4790
4863
  src: icon,
4791
- role: None$1,
4864
+ role: None$2,
4792
4865
  childCount: 0
4793
4866
  };
4794
4867
  };
@@ -4942,7 +5015,8 @@ const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight,
4942
5015
  tabIndex: 0,
4943
5016
  childCount,
4944
5017
  onBlur: HandleListBlur,
4945
- onPointerDown: HandleListPointerDown
5018
+ onPointerDown: HandleListPointerDown,
5019
+ onFocus: HandleListFocus
4946
5020
  }, ...getTreeItemsVirtualDom(visibleItems, deltaY, itemHeight), ...getScrollBarVirtualDom(scrollbarHeight, scrollBarY, scrollBarValue)];
4947
5021
  };
4948
5022
 
@@ -5021,7 +5095,7 @@ const getIconVirtualDom = (icon, type = Div) => {
5021
5095
  return {
5022
5096
  type,
5023
5097
  className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
5024
- role: None$1,
5098
+ role: None$2,
5025
5099
  childCount: 0
5026
5100
  };
5027
5101
  };
@@ -5118,7 +5192,7 @@ const renderEventListeners = () => {
5118
5192
  params: ['handleClickAt', ClientX, ClientY]
5119
5193
  }, {
5120
5194
  name: HandleListPointerDown,
5121
- params: ['handleListPointerDown']
5195
+ params: ['handleListPointerDown', Button$1]
5122
5196
  }, {
5123
5197
  name: HandleToggleButtonClick,
5124
5198
  params: ['handleToggleButtonClick']
@@ -5265,39 +5339,6 @@ const focusElement = (state, focusKey) => {
5265
5339
  };
5266
5340
  };
5267
5341
 
5268
- const getSearchFocusKey = key => {
5269
- switch (key) {
5270
- case SearchValue:
5271
- return FocusSearchInput;
5272
- case ReplaceValue:
5273
- return FocusSearchReplaceInput;
5274
- case MatchCase:
5275
- return FocusSearchMatchCase;
5276
- case MatchWholeWord:
5277
- return FocusSearchWholeWord;
5278
- case UseRegularExpression:
5279
- return FocusSearchRegex;
5280
- case ReplaceAll:
5281
- return FocusSearchReplaceAll;
5282
- case PreserveCase:
5283
- return FocusSearchPreserveCase;
5284
- case ToggleSearchDetails:
5285
- return FocusToggleDetails;
5286
- case FilesToInclude:
5287
- return FocusSearchIncludeInput;
5288
- case FilesToExclude:
5289
- return FocusSearchExcludeInput;
5290
- case SearchOnlyOpenEditors:
5291
- return FocusSearchOpenEditors;
5292
- case UseExcludeSettings:
5293
- return FocusIgnoreFiles;
5294
- case ToggleReplace:
5295
- return FocusToggleReplace;
5296
- default:
5297
- return Empty;
5298
- }
5299
- };
5300
-
5301
5342
  const handleFocusIn = async (state, key) => {
5302
5343
  const focusKey = getSearchFocusKey(key);
5303
5344
  if (state.focus === focusKey) {
@@ -5423,7 +5464,6 @@ const commandMap = {
5423
5464
  'TextSearch.collapseDetails': wrapCommand(collapseDetails),
5424
5465
  'TextSearch.copy': wrapCommand(copy),
5425
5466
  'TextSearch.copyPath': wrapCommand(copyPath),
5426
- 'TextSearch.handleInputBlur': wrapCommand(handleInputBlur),
5427
5467
  'TextSearch.diff2': diff2,
5428
5468
  'TextSearch.dismissItem': wrapCommand(dismissItem),
5429
5469
  'TextSearch.expandDetails': wrapCommand(expandDetails),
@@ -5450,7 +5490,6 @@ const commandMap = {
5450
5490
  'TextSearch.focusSearchValue': wrapCommand(focusSearchValue$1),
5451
5491
  'TextSearch.focusSearchValueNext': wrapCommand(focusSearchValueNext),
5452
5492
  'TextSearch.handleClickAt': wrapCommand(handleClickAt),
5453
- 'TextSearch.handleInputFocus': wrapCommand(handleInputFocus),
5454
5493
  'TextSearch.handleContextMenu': wrapCommand(handleContextMenu),
5455
5494
  'TextSearch.handleExcludeInput': wrapCommand(handleExcludeInput),
5456
5495
  'TextSearch.handleFocusIn': wrapCommand(handleFocusIn),
@@ -5462,7 +5501,11 @@ const commandMap = {
5462
5501
  'TextSearch.handleIncludeInput': wrapCommand(handleIncludeInput),
5463
5502
  'TextSearch.handleInput': wrapCommand(handleInput),
5464
5503
  'TextSearch.handleInput2': wrapCommand(handleInput2),
5504
+ 'TextSearch.handleInputBlur': wrapCommand(handleInputBlur),
5505
+ 'TextSearch.handleInputFocus': wrapCommand(handleInputFocus),
5465
5506
  'TextSearch.handleListBlur': wrapCommand(handleListBlur),
5507
+ 'TextSearch.handleListFocus': wrapCommand(handleListFocus),
5508
+ 'TextSearch.handleListPointerDown': wrapCommand(handleListPointerDown),
5466
5509
  'TextSearch.handleReplaceInput': wrapCommand(handleReplaceInput),
5467
5510
  'TextSearch.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
5468
5511
  'TextSearch.handleScrollBarClick': wrapCommand(handleScrollBarClick),
@@ -5485,7 +5528,6 @@ const commandMap = {
5485
5528
  'TextSearch.toggleReplace': wrapCommand(toggleReplace),
5486
5529
  'TextSearch.toggleSearchDetails': wrapCommand(toggleDetailsExpanded),
5487
5530
  'TextSearch.toggleUseIgnoreFiles': wrapCommand(toggleUseIgnoreFiles),
5488
- 'TextSearch.handleListPointerDown': wrapCommand(handleListPointerDown),
5489
5531
  'TextSearch.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
5490
5532
  'TextSearch.viewAsTree': wrapCommand(viewAsTree),
5491
5533
  // not wrapped
@@ -5500,6 +5542,8 @@ const commandMap = {
5500
5542
  'TextSearch.saveState': wrapGetter(saveState),
5501
5543
  'TextSearch.terminate': terminate,
5502
5544
  'TextSearch.renderActions': renderActions,
5545
+ 'TextSearch.getMenuEntryIds': getMenuEntryIds,
5546
+ 'TextSearch.getMenuEntries': getMenuEntries,
5503
5547
  // TODO needed?
5504
5548
  'TextSearch.replaceAllAndPrompt': replaceAllAndPrompt,
5505
5549
  'TextSearch.textSearch': textSearch$6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "5.12.0",
3
+ "version": "5.14.0",
4
4
  "description": "Text Search Worker",
5
5
  "keywords": [
6
6
  "text-search"