@lvce-editor/text-search-worker 5.9.0 → 5.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.
@@ -1256,6 +1256,7 @@ const FocusSearchRegex = 33;
1256
1256
  const FocusSearchReplaceAll = 35;
1257
1257
  const FocusSearchReplaceInput = 31;
1258
1258
  const FocusSearchResults = 22;
1259
+ const FocusUseExcludeSettings = 90_123;
1259
1260
  const FocusSearchWholeWord = 34;
1260
1261
  const FocusToggleDetails = 1010;
1261
1262
  const FocusToggleReplace = 1020;
@@ -2407,7 +2408,14 @@ const getNextFocus = (focus, flags) => {
2407
2408
  case FocusSearchExcludeInput:
2408
2409
  return FocusIgnoreFiles;
2409
2410
  case FocusToggleDetails:
2410
- return FocusSearchIncludeInput;
2411
+ if (flags & DetailsExpanded) {
2412
+ return FocusSearchIncludeInput;
2413
+ }
2414
+ return FocusSearchResults;
2415
+ case FocusIgnoreFiles:
2416
+ return FocusSearchResults;
2417
+ case FocusUseExcludeSettings:
2418
+ return FocusSearchResults;
2411
2419
  default:
2412
2420
  return focus;
2413
2421
  }
@@ -2415,10 +2423,12 @@ const getNextFocus = (focus, flags) => {
2415
2423
 
2416
2424
  const focusNextInput = state => {
2417
2425
  const nextFocus = getNextFocus(state.focus, state.flags);
2426
+ const isListFocus = nextFocus === FocusSearchResults;
2418
2427
  return {
2419
2428
  ...state,
2420
2429
  focus: nextFocus,
2421
- focusSource: Script
2430
+ focusSource: Script,
2431
+ listFocused: isListFocus
2422
2432
  };
2423
2433
  };
2424
2434
 
@@ -3231,6 +3241,17 @@ const handleInput2 = (state, inputName, value, inputSource = Script) => {
3231
3241
  return fn(state, value, inputSource);
3232
3242
  };
3233
3243
 
3244
+ const handleInputBlur = async (state, name) => {
3245
+ return state;
3246
+ };
3247
+
3248
+ const handleInputFocus = state => {
3249
+ return {
3250
+ ...state,
3251
+ listFocused: false
3252
+ };
3253
+ };
3254
+
3234
3255
  const handleListBlur = state => {
3235
3256
  return {
3236
3257
  ...state,
@@ -3901,6 +3922,8 @@ const getFocusSelector = focusKey => {
3901
3922
  return UseExcludeSettings;
3902
3923
  case FocusToggleReplace:
3903
3924
  return ToggleReplace;
3925
+ case FocusSearchResults:
3926
+ return '.Tree';
3904
3927
  default:
3905
3928
  return '';
3906
3929
  }
@@ -3991,11 +4014,14 @@ const getDisplayResult = (results, fileIcons, i, setSize, searchTermLength, repl
3991
4014
  };
3992
4015
 
3993
4016
  const getDisplayResults = (results, itemHeight, resultCount, searchTerm, minLineY, maxLineY, replacement, fileIcons, focusedIndex, collapsedPaths, originalResults) => {
4017
+ // Filter out child items when parent files are collapsed
4018
+ const filteredResults = getFilteredResults(results, collapsedPaths);
3994
4019
  const displayResults = [];
3995
4020
  const setSize = resultCount;
3996
4021
  const searchTermLength = searchTerm.length;
3997
- for (let i = minLineY; i < maxLineY; i++) {
3998
- const displayResult = getDisplayResult(results, fileIcons, i, setSize, searchTermLength, replacement, focusedIndex, collapsedPaths, minLineY, originalResults);
4022
+ const max = Math.min(filteredResults.length, maxLineY);
4023
+ for (let i = minLineY; i < max; i++) {
4024
+ const displayResult = getDisplayResult(filteredResults, fileIcons, i, setSize, searchTermLength, replacement, focusedIndex, collapsedPaths, minLineY, originalResults);
3999
4025
  displayResults.push(displayResult);
4000
4026
  }
4001
4027
  return displayResults;
@@ -4279,11 +4305,10 @@ const HandleClick = 1;
4279
4305
  const HandleContextMenu = 2;
4280
4306
  const HandleHeaderContextMenu = 3;
4281
4307
  const HandleExcludeInput = 4;
4282
- const HandleHeaderClick2 = 5;
4308
+ const HandleButtonClick = 5;
4283
4309
  const HandleHeaderFocusIn = 6;
4284
4310
  const HandleHeaderFocusOut = 7;
4285
4311
  const HandleIncludeInput = 8;
4286
- const HandleInput = 9;
4287
4312
  const HandleInput2 = 10;
4288
4313
  const HandleListBlur = 11;
4289
4314
  const HandleListFocus = 12;
@@ -4291,16 +4316,19 @@ const HandleReplaceInput = 13;
4291
4316
  const HandleScrollBarPointerDown = 14;
4292
4317
  const HandleToggleButtonClick = 15;
4293
4318
  const HandleWheel = 16;
4319
+ const HandleInputFocus = 17;
4320
+ const HandleInputBlur = 18;
4294
4321
 
4295
4322
  const getSearchDetailsToggleVirtualDom = () => {
4296
4323
  return [{
4297
- type: Div,
4324
+ type: Button$2,
4298
4325
  className: ToggleDetails,
4299
4326
  role: Button$3,
4300
4327
  tabIndex: 0,
4301
4328
  ariaLabel: toggleSearchDetails(),
4302
4329
  title: toggleSearchDetails(),
4303
4330
  name: ToggleSearchDetails,
4331
+ onClick: HandleButtonClick,
4304
4332
  childCount: 1
4305
4333
  }, {
4306
4334
  type: Div,
@@ -4421,7 +4449,8 @@ const getSearchFieldButtonVirtualDom = button => {
4421
4449
  ariaChecked,
4422
4450
  disabled,
4423
4451
  tabIndex: 0,
4424
- childCount: 1
4452
+ childCount: 1,
4453
+ onClick: HandleButtonClick
4425
4454
  }, {
4426
4455
  type: Span,
4427
4456
  className: mergeClassNames(MaskIcon, icon),
@@ -4447,7 +4476,7 @@ const getOutSideButtonsDom = outsideButtons => {
4447
4476
  };
4448
4477
  };
4449
4478
 
4450
- const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, onFocus = '', hasError = false) => {
4479
+ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, hasError = false) => {
4451
4480
  const {
4452
4481
  preNodes,
4453
4482
  postNodes
@@ -4467,7 +4496,9 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
4467
4496
  placeholder,
4468
4497
  name,
4469
4498
  onInput,
4470
- onFocus,
4499
+ onFocus: HandleInputFocus,
4500
+ onBlur: HandleInputBlur,
4501
+ onContextMenu: HandleContextMenu,
4471
4502
  childCount: 0
4472
4503
  }, {
4473
4504
  type: Div,
@@ -4591,10 +4622,11 @@ const getSearchToggleVirtualDom = replaceExpanded => {
4591
4622
  className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
4592
4623
  title: toggleReplace$1(),
4593
4624
  ariaLabel: toggleReplace$1(),
4625
+ // TODO compute label only once
4594
4626
  ariaExpanded: Boolean(replaceExpanded),
4595
4627
  childCount: 1,
4596
- 'data-command': 'toggleReplace',
4597
- name: ToggleReplace
4628
+ name: ToggleReplace,
4629
+ onClick: HandleButtonClick
4598
4630
  }, {
4599
4631
  type: Div,
4600
4632
  className: mergeClassNames(MaskIcon, replaceExpanded ? MaskIconChevronDown : MaskIconChevronRight),
@@ -4618,7 +4650,7 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
4618
4650
  className: SearchHeaderTopRight,
4619
4651
  role: None$1,
4620
4652
  childCount: replaceExpanded ? 2 : 1
4621
- }, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, '', Boolean(searchInputErrorMessage))];
4653
+ }, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, Boolean(searchInputErrorMessage))];
4622
4654
  if (flags & ReplaceExpanded) {
4623
4655
  dom.push(...getSearchFieldVirtualDom(ReplaceValue, replacePlaceholder, HandleInput2, replaceActions.inside, replaceActions.outside));
4624
4656
  }
@@ -4630,9 +4662,6 @@ const parentNode = {
4630
4662
  className: SearchHeader,
4631
4663
  role: None$1,
4632
4664
  childCount: 3,
4633
- onClick: HandleHeaderClick2,
4634
- onFocusIn: HandleHeaderFocusIn,
4635
- onFocusOut: HandleHeaderFocusOut,
4636
4665
  onContextMenu: HandleHeaderContextMenu
4637
4666
  };
4638
4667
  const getSearchHeaderVirtualDom = (flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning) => {
@@ -5050,9 +5079,6 @@ const renderEventListeners = () => {
5050
5079
  }, {
5051
5080
  name: HandleReplaceInput,
5052
5081
  params: ['handleReplaceInput', TargetValue]
5053
- }, {
5054
- name: HandleInput,
5055
- params: ['handleInput', TargetValue, User]
5056
5082
  }, {
5057
5083
  name: HandleClick,
5058
5084
  params: ['handleClickAt', ClientX, ClientY]
@@ -5078,7 +5104,7 @@ const renderEventListeners = () => {
5078
5104
  params: ['handleWheel', DeltaMode, DeltaY],
5079
5105
  passive: true
5080
5106
  }, {
5081
- name: HandleHeaderClick2,
5107
+ name: HandleButtonClick,
5082
5108
  params: ['handleHeaderClick', TargetName]
5083
5109
  }, {
5084
5110
  name: HandleHeaderFocusIn,
@@ -5089,6 +5115,12 @@ const renderEventListeners = () => {
5089
5115
  }, {
5090
5116
  name: HandleScrollBarPointerDown,
5091
5117
  params: ['handleScrollBarClick', DeltaY]
5118
+ }, {
5119
+ name: HandleInputFocus,
5120
+ params: ['handleInputFocus', TargetName]
5121
+ }, {
5122
+ name: HandleInputBlur,
5123
+ params: ['handleInputBlur', TargetName]
5092
5124
  }];
5093
5125
  };
5094
5126
 
@@ -5353,6 +5385,7 @@ const commandMap = {
5353
5385
  'TextSearch.collapseDetails': wrapCommand(collapseDetails),
5354
5386
  'TextSearch.copy': wrapCommand(copy),
5355
5387
  'TextSearch.copyPath': wrapCommand(copyPath),
5388
+ 'TextSearch.handleInputBlur': wrapCommand(handleInputBlur),
5356
5389
  'TextSearch.diff2': diff2,
5357
5390
  'TextSearch.dismissItem': wrapCommand(dismissItem),
5358
5391
  'TextSearch.expandDetails': wrapCommand(expandDetails),
@@ -5379,6 +5412,7 @@ const commandMap = {
5379
5412
  'TextSearch.focusSearchValue': wrapCommand(focusSearchValue$1),
5380
5413
  'TextSearch.focusSearchValueNext': wrapCommand(focusSearchValueNext),
5381
5414
  'TextSearch.handleClickAt': wrapCommand(handleClickAt),
5415
+ 'TextSearch.handleInputFocus': wrapCommand(handleInputFocus),
5382
5416
  'TextSearch.handleContextMenu': wrapCommand(handleContextMenu),
5383
5417
  'TextSearch.handleExcludeInput': wrapCommand(handleExcludeInput),
5384
5418
  'TextSearch.handleFocusIn': wrapCommand(handleFocusIn),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "5.9.0",
3
+ "version": "5.11.0",
4
4
  "description": "Text Search Worker",
5
5
  "keywords": [
6
6
  "text-search"