@lvce-editor/text-search-worker 3.11.0 → 3.12.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.
@@ -800,16 +800,21 @@ const WebWorkerRpcClient = {
800
800
  };
801
801
 
802
802
  const Empty$1 = 0;
803
+ const FocusIgnoreFiles = 1012;
804
+ const FocusSearch = 1013;
805
+ const FocusSearchExcludeInput = 1008;
806
+ const FocusSearchIncludeInput = 1007;
803
807
  const FocusSearchInput = 21;
804
- const FocusSearchReplaceInput = 31;
805
808
  const FocusSearchMatchCase = 32;
809
+ const FocusSearchOpenEditors = 1011;
810
+ const FocusSearchPreserveCase = 36;
806
811
  const FocusSearchRegex = 33;
807
- const FocusSearchWholeWord = 34;
808
812
  const FocusSearchReplaceAll = 35;
809
- const FocusSearchPreserveCase = 36;
810
- const FocusSearchIncludeInput = 1007;
811
- const FocusSearchExcludeInput = 1008;
813
+ const FocusSearchReplaceInput = 31;
812
814
  const FocusSearchResults = 22;
815
+ const FocusSearchWholeWord = 34;
816
+ const FocusToggleDetails = 1010;
817
+ const FocusToggleReplace = 1020;
813
818
 
814
819
  const User = 1;
815
820
  const Script = 2;
@@ -1269,21 +1274,6 @@ const focusMatchCase$1 = state => {
1269
1274
  };
1270
1275
  };
1271
1276
 
1272
- const focusReplaceValue$1 = state => {
1273
- return {
1274
- ...state,
1275
- focus: FocusSearchReplaceInput,
1276
- focusSource: Script
1277
- };
1278
- };
1279
-
1280
- const focusSearchValue$1 = state => {
1281
- return {
1282
- ...state,
1283
- focus: FocusSearchInput
1284
- };
1285
- };
1286
-
1287
1277
  const PreserveCase = 1 << 0; // 1
1288
1278
  const UseRegularExpression = 1 << 1; // 2
1289
1279
  const ReplaceExpanded = 1 << 2; // 4
@@ -1312,6 +1302,113 @@ const hasDetailsExpanded = flags => {
1312
1302
  return (flags & DetailsExpanded) === DetailsExpanded;
1313
1303
  };
1314
1304
 
1305
+ const getNextFocus = (focus, flags) => {
1306
+ switch (focus) {
1307
+ case FocusToggleReplace:
1308
+ return FocusSearchInput;
1309
+ case FocusSearchInput:
1310
+ if (flags & ReplaceExpanded) {
1311
+ return FocusSearchReplaceInput;
1312
+ }
1313
+ return FocusSearchMatchCase;
1314
+ case FocusSearchMatchCase:
1315
+ return FocusSearchWholeWord;
1316
+ case FocusSearchWholeWord:
1317
+ return FocusSearchRegex;
1318
+ case FocusSearchRegex:
1319
+ if (flags & ReplaceExpanded) {
1320
+ return FocusSearchPreserveCase;
1321
+ }
1322
+ return FocusToggleDetails;
1323
+ case FocusSearchReplaceInput:
1324
+ return FocusSearchMatchCase;
1325
+ case FocusSearchPreserveCase:
1326
+ return FocusSearchReplaceAll;
1327
+ case FocusSearchReplaceAll:
1328
+ return FocusToggleDetails;
1329
+ case FocusSearchIncludeInput:
1330
+ return FocusSearchOpenEditors;
1331
+ case FocusSearchOpenEditors:
1332
+ return FocusSearchExcludeInput;
1333
+ case FocusSearchExcludeInput:
1334
+ return FocusIgnoreFiles;
1335
+ case FocusToggleDetails:
1336
+ return FocusSearchIncludeInput;
1337
+ default:
1338
+ return focus;
1339
+ }
1340
+ };
1341
+
1342
+ const focusNextInput = state => {
1343
+ const nextFocus = getNextFocus(state.focus, state.flags);
1344
+ return {
1345
+ ...state,
1346
+ focus: nextFocus,
1347
+ focusSource: Script
1348
+ };
1349
+ };
1350
+
1351
+ const getPreviousFocus = (focus, flags) => {
1352
+ switch (focus) {
1353
+ case FocusSearchInput:
1354
+ return FocusToggleReplace;
1355
+ case FocusSearchMatchCase:
1356
+ if (flags & ReplaceExpanded) {
1357
+ return FocusSearchReplaceInput;
1358
+ }
1359
+ return FocusSearchInput;
1360
+ case FocusSearchWholeWord:
1361
+ return FocusSearchMatchCase;
1362
+ case FocusSearchRegex:
1363
+ return FocusSearchWholeWord;
1364
+ case FocusSearchPreserveCase:
1365
+ return FocusSearchRegex;
1366
+ case FocusSearchReplaceInput:
1367
+ return FocusSearchInput;
1368
+ case FocusSearchReplaceAll:
1369
+ return FocusSearchPreserveCase;
1370
+ case FocusToggleDetails:
1371
+ if (flags & ReplaceExpanded) {
1372
+ return FocusSearchReplaceAll;
1373
+ }
1374
+ return FocusSearchRegex;
1375
+ case FocusSearchOpenEditors:
1376
+ return FocusSearchIncludeInput;
1377
+ case FocusSearchExcludeInput:
1378
+ return FocusSearchOpenEditors;
1379
+ case FocusIgnoreFiles:
1380
+ return FocusSearchExcludeInput;
1381
+ case FocusSearchIncludeInput:
1382
+ return FocusToggleDetails;
1383
+ default:
1384
+ return focus;
1385
+ }
1386
+ };
1387
+
1388
+ const focusPreviousInput = state => {
1389
+ const previousFocus = getPreviousFocus(state.focus, state.flags);
1390
+ return {
1391
+ ...state,
1392
+ focus: previousFocus,
1393
+ focusSource: Script
1394
+ };
1395
+ };
1396
+
1397
+ const focusReplaceValue$1 = state => {
1398
+ return {
1399
+ ...state,
1400
+ focus: FocusSearchReplaceInput,
1401
+ focusSource: Script
1402
+ };
1403
+ };
1404
+
1405
+ const focusSearchValue$1 = state => {
1406
+ return {
1407
+ ...state,
1408
+ focus: FocusSearchInput
1409
+ };
1410
+ };
1411
+
1315
1412
  const focusSearchValueNext = state => {
1316
1413
  if (hasReplaceExpanded(state.flags)) {
1317
1414
  return focusReplaceValue$1(state);
@@ -1451,7 +1548,15 @@ const getKeyBindings = () => {
1451
1548
  return [{
1452
1549
  key: CtrlCmd | Alt | Enter,
1453
1550
  command: 'Search.replaceAll',
1454
- when: FocusSearchReplaceInput
1551
+ when: FocusSearch
1552
+ }, {
1553
+ key: Tab,
1554
+ command: 'Search.focusNextInput',
1555
+ when: FocusSearch
1556
+ }, {
1557
+ key: Shift | Tab,
1558
+ command: 'Search.focusPreviousInput',
1559
+ when: FocusSearch
1455
1560
  }, {
1456
1561
  key: DownArrow,
1457
1562
  command: 'Search.focusNext',
@@ -1476,30 +1581,6 @@ const getKeyBindings = () => {
1476
1581
  key: CtrlCmd | KeyC,
1477
1582
  command: 'Search.copy',
1478
1583
  when: FocusSearchResults
1479
- }, {
1480
- key: Tab,
1481
- command: 'Search.focusSearchValueNext',
1482
- when: FocusSearchInput
1483
- }, {
1484
- key: Shift | Tab,
1485
- command: 'Search.focusReplaceValuePrevious',
1486
- when: FocusSearchReplaceInput
1487
- }, {
1488
- key: Tab,
1489
- command: 'Search.focusReplaceValueNext',
1490
- when: FocusSearchReplaceInput
1491
- }, {
1492
- key: Shift | Tab,
1493
- command: 'Search.focusMatchCasePrevious',
1494
- when: FocusSearchMatchCase
1495
- }, {
1496
- key: Tab,
1497
- command: 'Search.focusRegexNext',
1498
- when: FocusSearchRegex
1499
- }, {
1500
- key: Shift | Tab,
1501
- command: 'Search.focusPreserveCasePrevious',
1502
- when: FocusSearchPreserveCase
1503
1584
  }, {
1504
1585
  key: Enter,
1505
1586
  command: 'Search.submit',
@@ -1764,18 +1845,18 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
1764
1845
  return dom;
1765
1846
  };
1766
1847
 
1767
- const getSearchHeaderDetailsExpandedVirtualDom = message => {
1848
+ const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
1768
1849
  const includeButtons = [{
1769
1850
  icon: MaskIconBook,
1770
1851
  title: searchOnlyOpenEditors(),
1771
1852
  command: 'searchOnlyOpenEditors',
1772
- checked: false
1853
+ checked: Boolean(flags & OpenEditors)
1773
1854
  }];
1774
1855
  const excludeButtons = [{
1775
1856
  icon: MaskIconExclude,
1776
1857
  title: useExcludeSettings(),
1777
1858
  command: 'toggleUseExcludeSettings',
1778
- checked: false
1859
+ checked: Boolean(flags & UseIgnoreFiles)
1779
1860
  }];
1780
1861
  return [{
1781
1862
  type: Div,
@@ -1798,7 +1879,7 @@ const getSearchHeaderDetailsExpandedVirtualDom = message => {
1798
1879
 
1799
1880
  const getSearchHeaderDetailsVirtualDom = (flags, message) => {
1800
1881
  if (flags & DetailsExpanded) {
1801
- return getSearchHeaderDetailsExpandedVirtualDom(message);
1882
+ return getSearchHeaderDetailsExpandedVirtualDom(flags, message);
1802
1883
  }
1803
1884
  return getSearchHeaderDetailsCollapsedVirtualDom(message);
1804
1885
  };
@@ -3336,6 +3417,8 @@ const getFocusSelector = focusKey => {
3336
3417
  return '[name="search-value"]';
3337
3418
  case FocusSearchReplaceInput:
3338
3419
  return '[name="search-replace-value"]';
3420
+ case FocusToggleDetails:
3421
+ return '[title="Toggle Search Details"]';
3339
3422
  case FocusSearchMatchCase:
3340
3423
  return '[title="Match Case"]';
3341
3424
  case FocusSearchPreserveCase:
@@ -3346,6 +3429,16 @@ const getFocusSelector = focusKey => {
3346
3429
  return '[name="files-to-include-value"]';
3347
3430
  case FocusSearchExcludeInput:
3348
3431
  return '[name="files-to-exclude-value"]';
3432
+ case FocusSearchWholeWord:
3433
+ return '[title="Match Whole Word"]';
3434
+ case FocusSearchReplaceAll:
3435
+ return '[title="Replace All"]';
3436
+ case FocusSearchOpenEditors:
3437
+ return '[title="Search Only Open Editors"]';
3438
+ case FocusIgnoreFiles:
3439
+ return '[title="Use Exclude Settings"]';
3440
+ case FocusToggleReplace:
3441
+ return '[aria-label="Toggle Replace"]';
3349
3442
  default:
3350
3443
  return '';
3351
3444
  }
@@ -3555,6 +3648,16 @@ const getSearchFocusKey = key => {
3555
3648
  return FocusSearchReplaceAll;
3556
3649
  case 'Preserve Case':
3557
3650
  return FocusSearchPreserveCase;
3651
+ case 'Toggle Search Details':
3652
+ return FocusToggleDetails;
3653
+ case 'files-to-include-value':
3654
+ return FocusSearchIncludeInput;
3655
+ case 'files-to-exclude-value':
3656
+ return FocusSearchExcludeInput;
3657
+ case 'Search Only Open Editors':
3658
+ return FocusSearchOpenEditors;
3659
+ case 'Use Exclude Settings':
3660
+ return FocusIgnoreFiles;
3558
3661
  default:
3559
3662
  return Empty$1;
3560
3663
  }
@@ -3578,6 +3681,9 @@ const focusReplaceValueNext = state => {
3578
3681
  const focusRegexNext = state => {
3579
3682
  return focusPreserveCase(state);
3580
3683
  };
3684
+ const focusPreserveCasePrevious = state => {
3685
+ return focusRegex(state);
3686
+ };
3581
3687
  const focusReplaceValue = state => {
3582
3688
  return focusElement(state, FocusSearchReplaceInput);
3583
3689
  };
@@ -3601,7 +3707,7 @@ const handleFocusIn = (state, key) => {
3601
3707
  if (state.focus === focusKey) {
3602
3708
  return state;
3603
3709
  }
3604
- void setFocus(focusKey);
3710
+ void setFocus(FocusSearch);
3605
3711
  return {
3606
3712
  ...state,
3607
3713
  focus: focusKey,
@@ -3730,16 +3836,19 @@ const commandMap = {
3730
3836
  'TextSearch.focusMatchCasePrevious': wrapCommand(focusMatchCasePrevious),
3731
3837
  'TextSearch.focusMatchWholeWord': wrapCommand(focusMatchWholeWord),
3732
3838
  'TextSearch.focusNext': wrapCommand(focusNext),
3839
+ 'TextSearch.focusNextInput': wrapCommand(focusNextInput),
3733
3840
  'TextSearch.focusNextPage': wrapCommand(focusNextPage),
3734
3841
  'TextSearch.focusPreserveCase': wrapCommand(focusPreserveCase),
3842
+ 'TextSearch.focusPreserveCasePrevious': wrapCommand(focusPreserveCasePrevious),
3735
3843
  'TextSearch.focusPrevious': wrapCommand(focusPrevious),
3844
+ 'TextSearch.focusPreviousInput': wrapCommand(focusPreviousInput),
3736
3845
  'TextSearch.focusPreviousPage': wrapCommand(focusPreviousPage),
3737
3846
  'TextSearch.focusRegex': wrapCommand(focusRegex),
3738
3847
  'TextSearch.focusRegexNext': wrapCommand(focusRegexNext),
3739
3848
  'TextSearch.focusReplaceAll': wrapCommand(focusReplaceAll),
3740
3849
  'TextSearch.focusReplaceValue': wrapCommand(focusReplaceValue$1),
3741
- 'TextSearch.focusReplaceValuePrevious': wrapCommand(focusReplaceValuePrevious),
3742
3850
  'TextSearch.focusReplaceValueNext': wrapCommand(focusReplaceValueNext),
3851
+ 'TextSearch.focusReplaceValuePrevious': wrapCommand(focusReplaceValuePrevious),
3743
3852
  'TextSearch.focusSearchValue': wrapCommand(focusSearchValue$1),
3744
3853
  'TextSearch.focusSearchValueNext': wrapCommand(focusSearchValueNext),
3745
3854
  'TextSearch.getActions': wrapCommand(getActions),
@@ -3748,12 +3857,12 @@ const commandMap = {
3748
3857
  'TextSearch.getVirtualDom': wrapCommand(getSearchVirtualDom),
3749
3858
  'TextSearch.handleClickAt': wrapCommand(handleClickAt),
3750
3859
  'TextSearch.handleContextMenu': wrapCommand(handleContextMenu),
3860
+ 'TextSearch.handleExcludeInput': wrapCommand(handleExcludeInput),
3751
3861
  'TextSearch.handleFocusIn': wrapCommand(handleFocusIn),
3752
3862
  'TextSearch.handleIconThemeChange': wrapCommand(handleIconThemeChange),
3863
+ 'TextSearch.handleIncludeInput': wrapCommand(handleIncludeInput),
3753
3864
  'TextSearch.handleInput': wrapCommand(handleInput),
3754
3865
  'TextSearch.handleReplaceInput': wrapCommand(handleReplaceInput),
3755
- 'TextSearch.handleIncludeInput': wrapCommand(handleIncludeInput),
3756
- 'TextSearch.handleExcludeInput': wrapCommand(handleExcludeInput),
3757
3866
  'TextSearch.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
3758
3867
  'TextSearch.handleScrollBarClick': wrapCommand(handleScrollBarClick),
3759
3868
  'TextSearch.handleScrollBarMove': wrapCommand(handleScrollBarMove),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "3.11.0",
3
+ "version": "3.12.0",
4
4
  "description": "Text Search Worker",
5
5
  "main": "dist/textSearchWorkerMain.js",
6
6
  "type": "module",