@lvce-editor/text-search-worker 3.47.0 → 3.48.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.
@@ -1086,6 +1086,30 @@ const clearSearchResults$1 = state => {
1086
1086
  };
1087
1087
  };
1088
1088
 
1089
+ const PreserveCase$2 = 1 << 0; // 1
1090
+ const UseRegularExpression$2 = 1 << 1; // 2
1091
+ const ReplaceExpanded = 1 << 2; // 4
1092
+ const MatchWholeWord$2 = 1 << 3; // 8
1093
+ const MatchCase$2 = 1 << 4; // 16
1094
+ const DetailsExpanded = 1 << 5; // 32
1095
+ const OpenEditors = 1 << 6; // 64
1096
+ const UseIgnoreFiles = 1 << 7; // 128
1097
+ const hasDetailsExpanded = flags => {
1098
+ return (flags & DetailsExpanded) === DetailsExpanded;
1099
+ };
1100
+
1101
+ const collapseDetails = state => {
1102
+ const {
1103
+ flags
1104
+ } = state;
1105
+ return {
1106
+ ...state,
1107
+ flags: flags & -33,
1108
+ focus: FocusSearchInput,
1109
+ focusSource: Script
1110
+ };
1111
+ };
1112
+
1089
1113
  const RendererWorker = 1;
1090
1114
 
1091
1115
  const rpcs = Object.create(null);
@@ -1238,19 +1262,19 @@ const ConfirmReplaceOneOccurrenceInOneFile = "Replace 1 occurrence across 1 file
1238
1262
  const ConfirmReplaceOneOccurrenceInOneFileNoValue = 'Replace 1 occurrence across 1 file';
1239
1263
  const ManyResultsInManyFiles = '{PH1} results in {PH2} files';
1240
1264
  const ManyResultsInOneFile = '{PH1} results in 1 file';
1241
- const MatchCase$2 = 'Match Case';
1242
- const MatchWholeWord$2 = 'Match Whole Word';
1265
+ const MatchCase$1 = 'Match Case';
1266
+ const MatchWholeWord$1 = 'Match Whole Word';
1243
1267
  const NoResults = 'No results found';
1244
1268
  const Oneresult = '1 result in 1 file';
1245
1269
  const OpenNewSearchEditor = 'Open New Search Editor';
1246
- const PreserveCase$2 = 'Preserve Case';
1270
+ const PreserveCase$1 = 'Preserve Case';
1247
1271
  const Refresh$1 = 'Refresh';
1248
1272
  const Replace = 'Replace';
1249
1273
  const ReplaceAll$1 = 'Replace All';
1250
1274
  const ReplacedManyOccurrencesInManyFiles = "Replaced {PH1} occurrences across {PH2} files with '{PH3}'";
1251
1275
  const ReplacedOneOccurrenceInOneFile = "Replaced 1 occurrence across 1 file with '{PH1}'";
1252
1276
  const ToggleReplace$1 = 'Toggle Replace';
1253
- const UseRegularExpression$2 = 'Use Regular Expression';
1277
+ const UseRegularExpression$1 = 'Use Regular Expression';
1254
1278
  const ViewAsTree = 'View as Tree';
1255
1279
  const FilesToInclude$1 = 'Files to Include';
1256
1280
  const FilesToExclude$1 = 'Files to Exclude';
@@ -1268,19 +1292,19 @@ const toggleReplace$1 = () => {
1268
1292
  return i18nString(ToggleReplace$1);
1269
1293
  };
1270
1294
  const matchCase = () => {
1271
- return i18nString(MatchCase$2);
1295
+ return i18nString(MatchCase$1);
1272
1296
  };
1273
1297
  const preserveCase = () => {
1274
- return i18nString(PreserveCase$2);
1298
+ return i18nString(PreserveCase$1);
1275
1299
  };
1276
1300
  const matchWholeWord = () => {
1277
- return i18nString(MatchWholeWord$2);
1301
+ return i18nString(MatchWholeWord$1);
1278
1302
  };
1279
1303
  const toggleSearchDetails = () => {
1280
1304
  return i18nString(ToggleSearchDetails$1);
1281
1305
  };
1282
1306
  const useRegularExpression = () => {
1283
- return i18nString(UseRegularExpression$2);
1307
+ return i18nString(UseRegularExpression$1);
1284
1308
  };
1285
1309
  const manyResultsInOneFile = resultCount => {
1286
1310
  return i18nString(ManyResultsInOneFile, {
@@ -1520,23 +1544,23 @@ const dismissItem = state => {
1520
1544
  };
1521
1545
  };
1522
1546
 
1523
- const focusMatchCase$1 = state => {
1547
+ const expandDetails = state => {
1548
+ const {
1549
+ flags
1550
+ } = state;
1524
1551
  return {
1525
1552
  ...state,
1526
- focus: FocusSearchMatchCase
1553
+ flags: flags | DetailsExpanded,
1554
+ focus: FocusSearchIncludeInput,
1555
+ focusSource: Script
1527
1556
  };
1528
1557
  };
1529
1558
 
1530
- const PreserveCase$1 = 1 << 0; // 1
1531
- const UseRegularExpression$1 = 1 << 1; // 2
1532
- const ReplaceExpanded = 1 << 2; // 4
1533
- const MatchWholeWord$1 = 1 << 3; // 8
1534
- const MatchCase$1 = 1 << 4; // 16
1535
- const DetailsExpanded = 1 << 5; // 32
1536
- const OpenEditors = 1 << 6; // 64
1537
- const UseIgnoreFiles = 1 << 7; // 128
1538
- const hasDetailsExpanded = flags => {
1539
- return (flags & DetailsExpanded) === DetailsExpanded;
1559
+ const focusMatchCase$1 = state => {
1560
+ return {
1561
+ ...state,
1562
+ focus: FocusSearchMatchCase
1563
+ };
1540
1564
  };
1541
1565
 
1542
1566
  const getNextFocus = (focus, flags) => {
@@ -1779,7 +1803,7 @@ const getActionsVirtualDom = actions => {
1779
1803
  }, ...actions.flatMap(getActionVirtualDom)];
1780
1804
  };
1781
1805
 
1782
- const commandIds = ['clearSearchResults', 'copy', 'dismissItem', 'focusFirst', 'focusIndex', 'focusLast', 'focusMatchCase', 'focusMatchCasePrevious', 'focusMatchWholeWord', 'focusNext', 'focusNextInput', 'focusNextPage', 'focusPreserveCasePrevious', 'focusPrevious', 'focusPreviousInput', 'focusPreviousPage', 'focusRegex', 'focusRegexNext', 'focusReplaceAll', 'focusReplaceValue', 'focusReplaceValueNext', 'focusReplaceValuePrevious', 'focusSearchValue', 'focusSearchValueNext', 'handleClick', 'handleClickAt', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleContextMenuMouseAt', 'handleExcludeInput', 'handleFocusIn', 'handleHeaderClick', 'handleIconThemeChange', 'handleIconThemeChange', 'handleIncludeInput', 'handleInput', 'handleListBlur', 'handleListFocus', 'handleReplaceInput', 'handleScrollBarCaptureLost', 'handleScrollBarClick', 'handleScrollBarMove', 'handleScrollBarThumbPointerMove', 'handleTouchEnd', 'handleTouchMove', 'handleTouchStart', 'handleUpdate', 'handleWheel', 'refresh', 'replaceAll', 'scrollDown', 'selectIndex', 'submit', 'toggleMatchCase', 'toggleMatchWholeWord', 'togglePreserveCase', 'toggleReplace', 'toggleSearchDetails', 'toggleUseRegularExpression'];
1806
+ const commandIds = ['clearSearchResults', 'collapseDetails', 'copy', 'dismissItem', 'expandDetails', 'focusFirst', 'focusIndex', 'focusLast', 'focusMatchCase', 'focusMatchCasePrevious', 'focusMatchWholeWord', 'focusNext', 'focusNextInput', 'focusNextPage', 'focusPreserveCasePrevious', 'focusPrevious', 'focusPreviousInput', 'focusPreviousPage', 'focusRegex', 'focusRegexNext', 'focusReplaceAll', 'focusReplaceValue', 'focusReplaceValueNext', 'focusReplaceValuePrevious', 'focusSearchValue', 'focusSearchValueNext', 'handleClick', 'handleClickAt', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleContextMenuMouseAt', 'handleExcludeInput', 'handleFocusIn', 'handleHeaderClick', 'handleIconThemeChange', 'handleIconThemeChange', 'handleIncludeInput', 'handleInput', 'handleListBlur', 'handleListFocus', 'handleReplaceInput', 'handleScrollBarCaptureLost', 'handleScrollBarClick', 'handleScrollBarMove', 'handleScrollBarThumbPointerMove', 'handleTouchEnd', 'handleTouchMove', 'handleTouchStart', 'handleUpdate', 'handleWheel', 'refresh', 'replaceAll', 'scrollDown', 'selectIndex', 'submit', 'toggleMatchCase', 'toggleMatchWholeWord', 'togglePreserveCase', 'toggleReplace', 'toggleSearchDetails', 'toggleUseRegularExpression'];
1783
1807
 
1784
1808
  const getCommandIds = () => {
1785
1809
  return commandIds;
@@ -2260,17 +2284,17 @@ const getSearchHeaderDetailsVirtualDom = (flags, message) => {
2260
2284
  const getInputActionsInput = flags => {
2261
2285
  const inside = [{
2262
2286
  icon: MaskIconCaseSensitive,
2263
- flag: flags & MatchCase$1 ? CheckBoxEnabled : CheckBoxDisabled,
2287
+ flag: flags & MatchCase$2 ? CheckBoxEnabled : CheckBoxDisabled,
2264
2288
  title: matchCase(),
2265
2289
  name: MatchCase
2266
2290
  }, {
2267
2291
  icon: MaskIconWholeWord,
2268
- flag: flags & MatchWholeWord$1 ? CheckBoxEnabled : CheckBoxDisabled,
2292
+ flag: flags & MatchWholeWord$2 ? CheckBoxEnabled : CheckBoxDisabled,
2269
2293
  title: matchWholeWord(),
2270
2294
  name: MatchWholeWord
2271
2295
  }, {
2272
2296
  icon: MaskIconRegex,
2273
- flag: flags & UseRegularExpression$1 ? CheckBoxEnabled : CheckBoxDisabled,
2297
+ flag: flags & UseRegularExpression$2 ? CheckBoxEnabled : CheckBoxDisabled,
2274
2298
  title: useRegularExpression(),
2275
2299
  name: UseRegularExpression
2276
2300
  }];
@@ -2284,7 +2308,7 @@ const getInputActionsInput = flags => {
2284
2308
  const getInputActionsReplace = (flags, matchCount) => {
2285
2309
  const inside = [{
2286
2310
  icon: MaskIconPreserveCase,
2287
- flag: flags & PreserveCase$1 ? CheckBoxEnabled : CheckBoxDisabled,
2311
+ flag: flags & PreserveCase$2 ? CheckBoxEnabled : CheckBoxDisabled,
2288
2312
  title: preserveCase(),
2289
2313
  name: PreserveCase
2290
2314
  }];
@@ -2874,7 +2898,7 @@ const validateSearchInput = (value, flags) => {
2874
2898
  if (!value) {
2875
2899
  return '';
2876
2900
  }
2877
- if (!(flags & UseRegularExpression$1)) {
2901
+ if (!(flags & UseRegularExpression$2)) {
2878
2902
  return '';
2879
2903
  }
2880
2904
  try {
@@ -2930,8 +2954,8 @@ const handleUpdate = async (state, update) => {
2930
2954
  const scheme = getProtocol$1(root);
2931
2955
  const results = await textSearch(root, value, {
2932
2956
  threads,
2933
- isCaseSensitive: Boolean(flags & MatchCase$1),
2934
- useRegularExpression: Boolean(flags & UseRegularExpression$1),
2957
+ isCaseSensitive: Boolean(flags & MatchCase$2),
2958
+ useRegularExpression: Boolean(flags & UseRegularExpression$2),
2935
2959
  exclude: excludeValue,
2936
2960
  include: includeValue,
2937
2961
  assetDir: state.assetDir,
@@ -2939,7 +2963,7 @@ const handleUpdate = async (state, update) => {
2939
2963
  query: value,
2940
2964
  scheme,
2941
2965
  flags,
2942
- matchWholeWord: Boolean(flags & MatchWholeWord$1)
2966
+ matchWholeWord: Boolean(flags & MatchWholeWord$2)
2943
2967
  }, state.assetDir, state.platform);
2944
2968
  if (!Array.isArray(results)) {
2945
2969
  throw new TypeError('results must be of type array');
@@ -3079,28 +3103,6 @@ const replaceAll = async state => {
3079
3103
  };
3080
3104
  };
3081
3105
 
3082
- const toggleSearchFlag = (state, flag) => {
3083
- return handleUpdate(state, {
3084
- flags: state.flags ^ flag
3085
- });
3086
- };
3087
-
3088
- const collapseDetails = async state => {
3089
- return {
3090
- ...(await toggleSearchFlag(state, DetailsExpanded)),
3091
- focus: FocusSearchInput,
3092
- focusSource: Script
3093
- };
3094
- };
3095
-
3096
- const expandDetails = async state => {
3097
- return {
3098
- ...(await toggleSearchFlag(state, DetailsExpanded)),
3099
- focus: FocusSearchIncludeInput,
3100
- focusSource: Script
3101
- };
3102
- };
3103
-
3104
3106
  const toggleDetailsExpanded = state => {
3105
3107
  if (hasDetailsExpanded(state.flags)) {
3106
3108
  return collapseDetails(state);
@@ -3108,12 +3110,18 @@ const toggleDetailsExpanded = state => {
3108
3110
  return expandDetails(state);
3109
3111
  };
3110
3112
 
3113
+ const toggleSearchFlag = (state, flag) => {
3114
+ return handleUpdate(state, {
3115
+ flags: state.flags ^ flag
3116
+ });
3117
+ };
3118
+
3111
3119
  const toggleMatchCase = state => {
3112
- return toggleSearchFlag(state, MatchCase$1);
3120
+ return toggleSearchFlag(state, MatchCase$2);
3113
3121
  };
3114
3122
 
3115
3123
  const toggleMatchWholeWord = state => {
3116
- return toggleSearchFlag(state, MatchWholeWord$1);
3124
+ return toggleSearchFlag(state, MatchWholeWord$2);
3117
3125
  };
3118
3126
 
3119
3127
  const toggleOpenEditors = state => {
@@ -3121,7 +3129,7 @@ const toggleOpenEditors = state => {
3121
3129
  };
3122
3130
 
3123
3131
  const togglePreserveCase = state => {
3124
- return toggleSearchFlag(state, PreserveCase$1);
3132
+ return toggleSearchFlag(state, PreserveCase$2);
3125
3133
  };
3126
3134
 
3127
3135
  const toggleReplace = state => {
@@ -3133,7 +3141,7 @@ const toggleUseIgnoreFiles = state => {
3133
3141
  };
3134
3142
 
3135
3143
  const toggleUseRegularExpression = state => {
3136
- return toggleSearchFlag(state, UseRegularExpression$1);
3144
+ return toggleSearchFlag(state, UseRegularExpression$2);
3137
3145
  };
3138
3146
 
3139
3147
  const getClickHandler = name => {
@@ -3707,8 +3715,42 @@ const RenderReplaceValue = 4;
3707
3715
  const RenderIncludeValue = 5;
3708
3716
  const RenderExcludeValue = 6;
3709
3717
 
3718
+ const getFocusSelector = focusKey => {
3719
+ switch (focusKey) {
3720
+ case FocusSearchInput:
3721
+ return SearchValue;
3722
+ case FocusSearchReplaceInput:
3723
+ return ReplaceValue;
3724
+ case FocusToggleDetails:
3725
+ return ToggleSearchDetails;
3726
+ case FocusSearchMatchCase:
3727
+ return MatchCase;
3728
+ case FocusSearchPreserveCase:
3729
+ return PreserveCase;
3730
+ case FocusSearchRegex:
3731
+ return UseRegularExpression;
3732
+ case FocusSearchIncludeInput:
3733
+ return FilesToInclude;
3734
+ case FocusSearchExcludeInput:
3735
+ return FilesToExclude;
3736
+ case FocusSearchWholeWord:
3737
+ return MatchWholeWord;
3738
+ case FocusSearchReplaceAll:
3739
+ return ReplaceAll;
3740
+ case FocusSearchOpenEditors:
3741
+ return SearchOnlyOpenEditors;
3742
+ case FocusIgnoreFiles:
3743
+ return UseExcludeSettings;
3744
+ case FocusToggleReplace:
3745
+ return ToggleReplace;
3746
+ default:
3747
+ return '';
3748
+ }
3749
+ };
3750
+
3710
3751
  const renderFocus = (oldState, newState) => {
3711
- return oldState.focus === newState.focus || newState.focusSource === User;
3752
+ const selector = getFocusSelector(newState.focus);
3753
+ return ['Viewlet.focusElementByName', newState.uid, selector];
3712
3754
  };
3713
3755
 
3714
3756
  const createViewModel = state => {
@@ -3885,7 +3927,8 @@ const doRender = uid => {
3885
3927
  newState
3886
3928
  } = get(uid);
3887
3929
  const diffResult = diff$1(oldState, newState);
3888
- return applyRender(oldState, newState, diffResult);
3930
+ const commands = applyRender(oldState, newState, diffResult);
3931
+ return commands;
3889
3932
  };
3890
3933
 
3891
3934
  const renderActions = uid => {
@@ -3916,13 +3959,13 @@ const renderEventListeners = () => {
3916
3959
  params: ['handleInput', 'event.target.value', User]
3917
3960
  }, {
3918
3961
  name: HandleClick,
3919
- params: ['handleClickAt', 'event.clientX', 'event.clientY']
3962
+ params: ['handleClick', 'event.clientX', 'event.clientY']
3920
3963
  }, {
3921
3964
  name: HandleToggleButtonClick,
3922
- params: ['handleClickAt', 'event.clientX', 'event.clientY']
3965
+ params: ['handleToggleButtonClick']
3923
3966
  }, {
3924
3967
  name: HandleListFocus,
3925
- params: ['handleClickAt', 'event.clientX', 'event.clientY']
3968
+ params: ['handleListFocus']
3926
3969
  }, {
3927
3970
  name: HandleListBlur,
3928
3971
  params: ['handleListBlur']
@@ -3932,7 +3975,7 @@ const renderEventListeners = () => {
3932
3975
  preventDefault: true
3933
3976
  }, {
3934
3977
  name: HandleWheel,
3935
- params: ['handleContextMenu', 'event.deltaMode', 'event.deltaY'],
3978
+ params: ['handleWheel', 'event.deltaMode', 'event.deltaY'],
3936
3979
  passive: true
3937
3980
  }, {
3938
3981
  name: HandleHeaderClick2,
@@ -4525,6 +4568,8 @@ const commandMap = {
4525
4568
  'TextSearch.copy': wrapCommand(copy),
4526
4569
  'TextSearch.dismissItem': wrapCommand(dismissItem),
4527
4570
  'TextSearch.focusFirst': wrapCommand(focusFirst),
4571
+ 'TextSearch.collapseDetails': wrapCommand(collapseDetails),
4572
+ 'TextSearch.expandDetails': wrapCommand(expandDetails),
4528
4573
  'TextSearch.focusIndex': wrapCommand(focusIndex),
4529
4574
  'TextSearch.focusLast': wrapCommand(focusLast),
4530
4575
  'TextSearch.focusMatchCase': wrapCommand(focusMatchCase$1),
@@ -4539,14 +4584,14 @@ const commandMap = {
4539
4584
  'TextSearch.focusPreviousInput': wrapCommand(focusPreviousInput),
4540
4585
  'TextSearch.focusPreviousPage': wrapCommand(focusPreviousPage),
4541
4586
  'TextSearch.focusRegex': wrapCommand(focusRegex),
4542
- 'TextSearch.getCommandIds': getCommandIds,
4543
4587
  'TextSearch.focusRegexNext': wrapCommand(focusRegexNext),
4544
4588
  'TextSearch.focusReplaceAll': wrapCommand(focusReplaceAll),
4545
4589
  'TextSearch.focusReplaceValue': wrapCommand(focusReplaceValue$1),
4546
4590
  'TextSearch.focusReplaceValueNext': wrapCommand(focusReplaceValueNext),
4547
4591
  'TextSearch.focusReplaceValuePrevious': wrapCommand(focusReplaceValuePrevious),
4548
- 'TextSearch.renderActions': wrapCommand(renderActions),
4549
4592
  'TextSearch.focusSearchValue': wrapCommand(focusSearchValue$1),
4593
+ 'TextSearch.getCommandIds': getCommandIds,
4594
+ 'TextSearch.renderActions': wrapCommand(renderActions),
4550
4595
  'TextSearch.focusSearchValueNext': wrapCommand(focusSearchValueNext),
4551
4596
  'TextSearch.getActions': wrapCommand(getActions),
4552
4597
  'TextSearch.getActionsVirtualDom': wrapCommand(getActionsVirtualDom),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "3.47.0",
3
+ "version": "3.48.0",
4
4
  "description": "Text Search Worker",
5
5
  "keywords": [
6
6
  "text-search"