@lvce-editor/text-search-worker 3.10.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,14 +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;
813
+ const FocusSearchReplaceInput = 31;
814
+ const FocusSearchResults = 22;
815
+ const FocusSearchWholeWord = 34;
816
+ const FocusToggleDetails = 1010;
817
+ const FocusToggleReplace = 1020;
811
818
 
812
819
  const User = 1;
813
820
  const Script = 2;
@@ -965,59 +972,6 @@ const fromAsync = async asyncIterable => {
965
972
  return children;
966
973
  };
967
974
 
968
- class AssertionError extends Error {
969
- constructor(message) {
970
- super(message);
971
- this.name = 'AssertionError';
972
- }
973
- }
974
- const getType = value => {
975
- switch (typeof value) {
976
- case 'number':
977
- return 'number';
978
- case 'function':
979
- return 'function';
980
- case 'string':
981
- return 'string';
982
- case 'object':
983
- if (value === null) {
984
- return 'null';
985
- }
986
- if (Array.isArray(value)) {
987
- return 'array';
988
- }
989
- return 'object';
990
- case 'boolean':
991
- return 'boolean';
992
- default:
993
- return 'unknown';
994
- }
995
- };
996
- const object = value => {
997
- const type = getType(value);
998
- if (type !== 'object') {
999
- throw new AssertionError('expected value to be of type object');
1000
- }
1001
- };
1002
- const number = value => {
1003
- const type = getType(value);
1004
- if (type !== 'number') {
1005
- throw new AssertionError('expected value to be of type number');
1006
- }
1007
- };
1008
- const array = value => {
1009
- const type = getType(value);
1010
- if (type !== 'array') {
1011
- throw new AssertionError('expected value to be of type array');
1012
- }
1013
- };
1014
- const string = value => {
1015
- const type = getType(value);
1016
- if (type !== 'string') {
1017
- throw new AssertionError('expected value to be of type string');
1018
- }
1019
- };
1020
-
1021
975
  const emptyObject = {};
1022
976
  const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
1023
977
  const i18nString = (key, placeholders = emptyObject) => {
@@ -1124,9 +1078,6 @@ const confirmReplaceManyOccurrencesInOneFileNoValue = matchCount => {
1124
1078
  });
1125
1079
  };
1126
1080
  const confirmReplaceManyOccurrencesInManyFiles = (matchCount, fileCount, replacement) => {
1127
- number(matchCount);
1128
- number(fileCount);
1129
- string(replacement);
1130
1081
  return i18nString(UiStrings.ConfirmReplaceManyOccurrencesInManyFiles, {
1131
1082
  PH1: matchCount,
1132
1083
  PH2: fileCount,
@@ -1134,8 +1085,6 @@ const confirmReplaceManyOccurrencesInManyFiles = (matchCount, fileCount, replace
1134
1085
  });
1135
1086
  };
1136
1087
  const confirmReplaceManyOccurrencesInManyFilesNoValue = (matchCount, fileCount) => {
1137
- number(matchCount);
1138
- number(fileCount);
1139
1088
  return i18nString(UiStrings.ConfirmReplaceManyOccurrencesInManyFilesNoValue, {
1140
1089
  PH1: matchCount,
1141
1090
  PH2: fileCount
@@ -1176,8 +1125,6 @@ const useExcludeSettings = () => {
1176
1125
  };
1177
1126
 
1178
1127
  const getStatusMessage = (resultCount, fileResultCount) => {
1179
- number(resultCount);
1180
- number(fileResultCount);
1181
1128
  if (resultCount === 0) {
1182
1129
  return noResults();
1183
1130
  }
@@ -1327,20 +1274,6 @@ const focusMatchCase$1 = state => {
1327
1274
  };
1328
1275
  };
1329
1276
 
1330
- const focusReplaceValue$1 = state => {
1331
- return {
1332
- ...state,
1333
- focus: FocusSearchReplaceInput
1334
- };
1335
- };
1336
-
1337
- const focusSearchValue$1 = state => {
1338
- return {
1339
- ...state,
1340
- focus: FocusSearchInput
1341
- };
1342
- };
1343
-
1344
1277
  const PreserveCase = 1 << 0; // 1
1345
1278
  const UseRegularExpression = 1 << 1; // 2
1346
1279
  const ReplaceExpanded = 1 << 2; // 4
@@ -1369,6 +1302,113 @@ const hasDetailsExpanded = flags => {
1369
1302
  return (flags & DetailsExpanded) === DetailsExpanded;
1370
1303
  };
1371
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
+
1372
1412
  const focusSearchValueNext = state => {
1373
1413
  if (hasReplaceExpanded(state.flags)) {
1374
1414
  return focusReplaceValue$1(state);
@@ -1491,6 +1531,67 @@ const getActionsVirtualDom = actions => {
1491
1531
  }, ...actions.flatMap(getActionVirtualDom)];
1492
1532
  };
1493
1533
 
1534
+ const Tab = 2;
1535
+ const Enter = 3;
1536
+ const End = 255;
1537
+ const Home = 12;
1538
+ const UpArrow = 14;
1539
+ const DownArrow = 16;
1540
+ const Delete = 18;
1541
+ const KeyC = 31;
1542
+
1543
+ const CtrlCmd = 1 << 11 >>> 0;
1544
+ const Shift = 1 << 10 >>> 0;
1545
+ const Alt = 1 << 9 >>> 0;
1546
+
1547
+ const getKeyBindings = () => {
1548
+ return [{
1549
+ key: CtrlCmd | Alt | Enter,
1550
+ command: 'Search.replaceAll',
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
1560
+ }, {
1561
+ key: DownArrow,
1562
+ command: 'Search.focusNext',
1563
+ when: FocusSearchResults
1564
+ }, {
1565
+ key: UpArrow,
1566
+ command: 'Search.focusPrevious',
1567
+ when: FocusSearchResults
1568
+ }, {
1569
+ key: Delete,
1570
+ command: 'Search.dismissItem',
1571
+ when: FocusSearchResults
1572
+ }, {
1573
+ key: Home,
1574
+ command: 'Search.focusFirst',
1575
+ when: FocusSearchResults
1576
+ }, {
1577
+ key: End,
1578
+ command: 'Search.focusLast',
1579
+ when: FocusSearchResults
1580
+ }, {
1581
+ key: CtrlCmd | KeyC,
1582
+ command: 'Search.copy',
1583
+ when: FocusSearchResults
1584
+ }, {
1585
+ key: Enter,
1586
+ command: 'Search.submit',
1587
+ when: FocusSearchInput
1588
+ }, {
1589
+ key: Enter,
1590
+ command: 'Search.submit',
1591
+ when: FocusSearchReplaceInput
1592
+ }];
1593
+ };
1594
+
1494
1595
  const ClearAll = 'ClearAll';
1495
1596
  const CollapseAll = 'CollapseAll';
1496
1597
  const ListFlat = 'ListFlat';
@@ -1744,18 +1845,18 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
1744
1845
  return dom;
1745
1846
  };
1746
1847
 
1747
- const getSearchHeaderDetailsExpandedVirtualDom = message => {
1848
+ const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
1748
1849
  const includeButtons = [{
1749
1850
  icon: MaskIconBook,
1750
1851
  title: searchOnlyOpenEditors(),
1751
1852
  command: 'searchOnlyOpenEditors',
1752
- checked: false
1853
+ checked: Boolean(flags & OpenEditors)
1753
1854
  }];
1754
1855
  const excludeButtons = [{
1755
1856
  icon: MaskIconExclude,
1756
1857
  title: useExcludeSettings(),
1757
1858
  command: 'toggleUseExcludeSettings',
1758
- checked: false
1859
+ checked: Boolean(flags & UseIgnoreFiles)
1759
1860
  }];
1760
1861
  return [{
1761
1862
  type: Div,
@@ -1778,7 +1879,7 @@ const getSearchHeaderDetailsExpandedVirtualDom = message => {
1778
1879
 
1779
1880
  const getSearchHeaderDetailsVirtualDom = (flags, message) => {
1780
1881
  if (flags & DetailsExpanded) {
1781
- return getSearchHeaderDetailsExpandedVirtualDom(message);
1882
+ return getSearchHeaderDetailsExpandedVirtualDom(flags, message);
1782
1883
  }
1783
1884
  return getSearchHeaderDetailsCollapsedVirtualDom(message);
1784
1885
  };
@@ -1867,9 +1968,6 @@ const chevronDownVirtualDom = {
1867
1968
  className: mergeClassNames(Chevron, MaskIconChevronRight),
1868
1969
  childCount: 0
1869
1970
  });
1870
- const getChevronDownVirtualDom = () => {
1871
- return chevronDownVirtualDom;
1872
- };
1873
1971
 
1874
1972
  const getFileIconVirtualDom = icon => {
1875
1973
  return {
@@ -1966,7 +2064,7 @@ const getSearchResultVirtualDom = rowInfo => {
1966
2064
  dom.push(treeItem);
1967
2065
  if (type === File$1) {
1968
2066
  treeItem.childCount += 2;
1969
- dom.push(getChevronDownVirtualDom(), getFileIconVirtualDom(icon));
2067
+ dom.push(chevronDownVirtualDom, getFileIconVirtualDom(icon));
1970
2068
  }
1971
2069
  dom.push(...getLabelVirtualDom(displayText, matchLength, matchStart, replacement));
1972
2070
  if (matchCount) {
@@ -2007,6 +2105,10 @@ const getSearchVirtualDom = (visibleItems, flags, message, focusOutline) => {
2007
2105
  return dom;
2008
2106
  };
2009
2107
 
2108
+ const handleError = error => {
2109
+ console.error(`[text-search-worker] ${error}`);
2110
+ };
2111
+
2010
2112
  const getFileIcons = async files => {
2011
2113
  // TODO cache file icons
2012
2114
  const promises = [];
@@ -2022,24 +2124,6 @@ const getFileIcons = async files => {
2022
2124
  return icons;
2023
2125
  };
2024
2126
 
2025
- const handleIconThemeChange = async state => {
2026
- const {
2027
- items,
2028
- minLineY,
2029
- maxLineY
2030
- } = state;
2031
- const visibleItems = items.slice(minLineY, maxLineY);
2032
- const icons = await getFileIcons(visibleItems);
2033
- return {
2034
- ...state,
2035
- icons
2036
- };
2037
- };
2038
-
2039
- const handleError = error => {
2040
- console.error(`[text-search-worker] ${error}`);
2041
- };
2042
-
2043
2127
  // TODO optimize this function to return the minimum number
2044
2128
  // of visible items needed, e.g. when not scrolled 5 items with
2045
2129
  // 20px fill 100px but when scrolled 6 items are needed
@@ -2106,6 +2190,59 @@ const getNewDeltaPercent = (height, scrollBarHeight, relativeY) => {
2106
2190
  };
2107
2191
  };
2108
2192
 
2193
+ class AssertionError extends Error {
2194
+ constructor(message) {
2195
+ super(message);
2196
+ this.name = 'AssertionError';
2197
+ }
2198
+ }
2199
+ const getType = value => {
2200
+ switch (typeof value) {
2201
+ case 'number':
2202
+ return 'number';
2203
+ case 'function':
2204
+ return 'function';
2205
+ case 'string':
2206
+ return 'string';
2207
+ case 'object':
2208
+ if (value === null) {
2209
+ return 'null';
2210
+ }
2211
+ if (Array.isArray(value)) {
2212
+ return 'array';
2213
+ }
2214
+ return 'object';
2215
+ case 'boolean':
2216
+ return 'boolean';
2217
+ default:
2218
+ return 'unknown';
2219
+ }
2220
+ };
2221
+ const object = value => {
2222
+ const type = getType(value);
2223
+ if (type !== 'object') {
2224
+ throw new AssertionError('expected value to be of type object');
2225
+ }
2226
+ };
2227
+ const number = value => {
2228
+ const type = getType(value);
2229
+ if (type !== 'number') {
2230
+ throw new AssertionError('expected value to be of type number');
2231
+ }
2232
+ };
2233
+ const array = value => {
2234
+ const type = getType(value);
2235
+ if (type !== 'array') {
2236
+ throw new AssertionError('expected value to be of type array');
2237
+ }
2238
+ };
2239
+ const string = value => {
2240
+ const type = getType(value);
2241
+ if (type !== 'string') {
2242
+ throw new AssertionError('expected value to be of type string');
2243
+ }
2244
+ };
2245
+
2109
2246
  const RE_PROTOCOL = /^([a-z-\d]+):\/\//;
2110
2247
  const getProtocol = uri => {
2111
2248
  const protocolMatch = uri.match(RE_PROTOCOL);
@@ -2809,23 +2946,45 @@ const handleUpdate = async (state, update) => {
2809
2946
  }
2810
2947
  };
2811
2948
 
2812
- const handleInput = (state, value, inputSource = Script) => {
2949
+ const handleExcludeInput = (state, value, inputSource = Script) => {
2813
2950
  return handleUpdate(state, {
2814
- value,
2951
+ excludeValue: value,
2815
2952
  inputSource
2816
2953
  });
2817
2954
  };
2818
2955
 
2819
- const handleReplaceInput = (state, value, inputSource = Script) => {
2956
+ const handleIconThemeChange = async state => {
2957
+ const {
2958
+ items,
2959
+ minLineY,
2960
+ maxLineY
2961
+ } = state;
2962
+ const visibleItems = items.slice(minLineY, maxLineY);
2963
+ const icons = await getFileIcons(visibleItems);
2964
+ return {
2965
+ ...state,
2966
+ icons
2967
+ };
2968
+ };
2969
+
2970
+ const handleIncludeInput = (state, includeValue) => {
2971
+ return {
2972
+ ...state,
2973
+ includeValue,
2974
+ focusSource: User
2975
+ };
2976
+ };
2977
+
2978
+ const handleInput = (state, value, inputSource = Script) => {
2820
2979
  return handleUpdate(state, {
2821
- replacement: value,
2980
+ value,
2822
2981
  inputSource
2823
2982
  });
2824
2983
  };
2825
2984
 
2826
- const handleExcludeInput = (state, value, inputSource = Script) => {
2985
+ const handleReplaceInput = (state, value, inputSource = Script) => {
2827
2986
  return handleUpdate(state, {
2828
- excludeValue: value,
2987
+ replacement: value,
2829
2988
  inputSource
2830
2989
  });
2831
2990
  };
@@ -2848,14 +3007,6 @@ const handleSharedInput = (state, name, value, inputSource = Script) => {
2848
3007
  return fn(state, value, inputSource);
2849
3008
  };
2850
3009
 
2851
- const handleIncludeInput = (state, includeValue) => {
2852
- return {
2853
- ...state,
2854
- includeValue,
2855
- focusSource: User
2856
- };
2857
- };
2858
-
2859
3010
  const first = () => {
2860
3011
  return 0;
2861
3012
  };
@@ -3231,7 +3382,9 @@ const loadContent = async (state, savedState) => {
3231
3382
  savedCollapsedPaths,
3232
3383
  threads,
3233
3384
  replacement,
3234
- flags
3385
+ flags,
3386
+ includeValue,
3387
+ excludeValue
3235
3388
  } = restoreState(savedState);
3236
3389
  if (savedValue) {
3237
3390
  return handleUpdate(state, {
@@ -3240,7 +3393,9 @@ const loadContent = async (state, savedState) => {
3240
3393
  inputSource: Script,
3241
3394
  collapsedPaths: savedCollapsedPaths,
3242
3395
  replacement,
3243
- flags
3396
+ flags,
3397
+ includeValue,
3398
+ excludeValue
3244
3399
  });
3245
3400
  }
3246
3401
  return {
@@ -3262,6 +3417,8 @@ const getFocusSelector = focusKey => {
3262
3417
  return '[name="search-value"]';
3263
3418
  case FocusSearchReplaceInput:
3264
3419
  return '[name="search-replace-value"]';
3420
+ case FocusToggleDetails:
3421
+ return '[title="Toggle Search Details"]';
3265
3422
  case FocusSearchMatchCase:
3266
3423
  return '[title="Match Case"]';
3267
3424
  case FocusSearchPreserveCase:
@@ -3270,6 +3427,18 @@ const getFocusSelector = focusKey => {
3270
3427
  return '[title="Use Regular Expression"]';
3271
3428
  case FocusSearchIncludeInput:
3272
3429
  return '[name="files-to-include-value"]';
3430
+ case FocusSearchExcludeInput:
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"]';
3273
3442
  default:
3274
3443
  return '';
3275
3444
  }
@@ -3308,10 +3477,29 @@ const renderReplacement = {
3308
3477
  return oldState.replacement === newState.replacement || newState.inputSource === User;
3309
3478
  },
3310
3479
  apply(oldState, newState) {
3311
- return ['Viewlet.send', newState.uid, 'setValue', newState.replacement, '[name="search-replace-value"]'];
3480
+ const selector = getFocusSelector(FocusSearchReplaceInput);
3481
+ return ['Viewlet.send', newState.uid, 'setValue', newState.replacement, selector];
3312
3482
  }
3313
3483
  };
3314
- const render = [renderItems, renderValue, renderReplacement, renderFocus];
3484
+ const renderIncludeValue = {
3485
+ isEqual(oldState, newState) {
3486
+ return oldState.includeValue === newState.includeValue || newState.inputSource === User;
3487
+ },
3488
+ apply(oldState, newState) {
3489
+ const selector = getFocusSelector(FocusSearchIncludeInput);
3490
+ return ['Viewlet.send', newState.uid, 'setValue', newState.includeValue, selector];
3491
+ }
3492
+ };
3493
+ const renderExcludeValue = {
3494
+ isEqual(oldState, newState) {
3495
+ return oldState.excludeValue === newState.excludeValue || newState.inputSource === User;
3496
+ },
3497
+ apply(oldState, newState) {
3498
+ const selector = getFocusSelector(FocusSearchExcludeInput);
3499
+ return ['Viewlet.send', newState.uid, 'setValue', newState.excludeValue, selector];
3500
+ }
3501
+ };
3502
+ const render = [renderItems, renderValue, renderIncludeValue, renderExcludeValue, renderReplacement, renderFocus];
3315
3503
  const doRender = uid => {
3316
3504
  const {
3317
3505
  oldState,
@@ -3460,6 +3648,16 @@ const getSearchFocusKey = key => {
3460
3648
  return FocusSearchReplaceAll;
3461
3649
  case 'Preserve Case':
3462
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;
3463
3661
  default:
3464
3662
  return Empty$1;
3465
3663
  }
@@ -3474,12 +3672,18 @@ const focusMatchCasePrevious = state => {
3474
3672
  }
3475
3673
  return focusSearchValue(state);
3476
3674
  };
3675
+ const focusReplaceValuePrevious = state => {
3676
+ return focusSearchValue(state);
3677
+ };
3477
3678
  const focusReplaceValueNext = state => {
3478
3679
  return focusMatchCase(state);
3479
3680
  };
3480
3681
  const focusRegexNext = state => {
3481
3682
  return focusPreserveCase(state);
3482
3683
  };
3684
+ const focusPreserveCasePrevious = state => {
3685
+ return focusRegex(state);
3686
+ };
3483
3687
  const focusReplaceValue = state => {
3484
3688
  return focusElement(state, FocusSearchReplaceInput);
3485
3689
  };
@@ -3503,7 +3707,7 @@ const handleFocusIn = (state, key) => {
3503
3707
  if (state.focus === focusKey) {
3504
3708
  return state;
3505
3709
  }
3506
- void setFocus(focusKey);
3710
+ void setFocus(FocusSearch);
3507
3711
  return {
3508
3712
  ...state,
3509
3713
  focus: focusKey,
@@ -3525,22 +3729,29 @@ const toggleSearchFlag = (state, flag) => {
3525
3729
  };
3526
3730
  };
3527
3731
 
3528
- const toggleDetailsExpanded = state => {
3529
- const newState = toggleSearchFlag(state, DetailsExpanded);
3530
- if (hasDetailsExpanded(newState.flags)) {
3531
- return {
3532
- ...newState,
3533
- focus: FocusSearchIncludeInput,
3534
- focusSource: Script
3535
- };
3536
- }
3732
+ const collapseDetails = state => {
3537
3733
  return {
3538
- ...newState,
3734
+ ...toggleSearchFlag(state, DetailsExpanded),
3539
3735
  focus: FocusSearchInput,
3540
3736
  focusSource: Script
3541
3737
  };
3542
3738
  };
3543
3739
 
3740
+ const expandDetails = state => {
3741
+ return {
3742
+ ...toggleSearchFlag(state, DetailsExpanded),
3743
+ focus: FocusSearchIncludeInput,
3744
+ focusSource: Script
3745
+ };
3746
+ };
3747
+
3748
+ const toggleDetailsExpanded = state => {
3749
+ if (hasDetailsExpanded(state.flags)) {
3750
+ return collapseDetails(state);
3751
+ }
3752
+ return expandDetails(state);
3753
+ };
3754
+
3544
3755
  const toggleMatchCase = state => {
3545
3756
  return toggleSearchFlag(state, MatchCase);
3546
3757
  };
@@ -3625,15 +3836,19 @@ const commandMap = {
3625
3836
  'TextSearch.focusMatchCasePrevious': wrapCommand(focusMatchCasePrevious),
3626
3837
  'TextSearch.focusMatchWholeWord': wrapCommand(focusMatchWholeWord),
3627
3838
  'TextSearch.focusNext': wrapCommand(focusNext),
3839
+ 'TextSearch.focusNextInput': wrapCommand(focusNextInput),
3628
3840
  'TextSearch.focusNextPage': wrapCommand(focusNextPage),
3629
3841
  'TextSearch.focusPreserveCase': wrapCommand(focusPreserveCase),
3842
+ 'TextSearch.focusPreserveCasePrevious': wrapCommand(focusPreserveCasePrevious),
3630
3843
  'TextSearch.focusPrevious': wrapCommand(focusPrevious),
3844
+ 'TextSearch.focusPreviousInput': wrapCommand(focusPreviousInput),
3631
3845
  'TextSearch.focusPreviousPage': wrapCommand(focusPreviousPage),
3632
3846
  'TextSearch.focusRegex': wrapCommand(focusRegex),
3633
3847
  'TextSearch.focusRegexNext': wrapCommand(focusRegexNext),
3634
3848
  'TextSearch.focusReplaceAll': wrapCommand(focusReplaceAll),
3635
3849
  'TextSearch.focusReplaceValue': wrapCommand(focusReplaceValue$1),
3636
3850
  'TextSearch.focusReplaceValueNext': wrapCommand(focusReplaceValueNext),
3851
+ 'TextSearch.focusReplaceValuePrevious': wrapCommand(focusReplaceValuePrevious),
3637
3852
  'TextSearch.focusSearchValue': wrapCommand(focusSearchValue$1),
3638
3853
  'TextSearch.focusSearchValueNext': wrapCommand(focusSearchValueNext),
3639
3854
  'TextSearch.getActions': wrapCommand(getActions),
@@ -3642,12 +3857,12 @@ const commandMap = {
3642
3857
  'TextSearch.getVirtualDom': wrapCommand(getSearchVirtualDom),
3643
3858
  'TextSearch.handleClickAt': wrapCommand(handleClickAt),
3644
3859
  'TextSearch.handleContextMenu': wrapCommand(handleContextMenu),
3860
+ 'TextSearch.handleExcludeInput': wrapCommand(handleExcludeInput),
3645
3861
  'TextSearch.handleFocusIn': wrapCommand(handleFocusIn),
3646
3862
  'TextSearch.handleIconThemeChange': wrapCommand(handleIconThemeChange),
3863
+ 'TextSearch.handleIncludeInput': wrapCommand(handleIncludeInput),
3647
3864
  'TextSearch.handleInput': wrapCommand(handleInput),
3648
3865
  'TextSearch.handleReplaceInput': wrapCommand(handleReplaceInput),
3649
- 'TextSearch.handleIncludeInput': wrapCommand(handleIncludeInput),
3650
- 'TextSearch.handleExcludeInput': wrapCommand(handleExcludeInput),
3651
3866
  'TextSearch.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
3652
3867
  'TextSearch.handleScrollBarClick': wrapCommand(handleScrollBarClick),
3653
3868
  'TextSearch.handleScrollBarMove': wrapCommand(handleScrollBarMove),
@@ -3670,6 +3885,7 @@ const commandMap = {
3670
3885
  'TextSearch.create': create,
3671
3886
  'TextSearch.render': doRender,
3672
3887
  'TextSearch.saveState': saveState,
3888
+ 'TextSearch.getKeyBindings': getKeyBindings,
3673
3889
  // TODO needed?
3674
3890
  'TextSearch.textSearch': textSearch
3675
3891
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "3.10.0",
3
+ "version": "3.12.0",
4
4
  "description": "Text Search Worker",
5
5
  "main": "dist/textSearchWorkerMain.js",
6
6
  "type": "module",