@lvce-editor/text-search-worker 3.9.0 → 3.10.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.
@@ -799,6 +799,19 @@ const WebWorkerRpcClient = {
799
799
  create: create$1$1
800
800
  };
801
801
 
802
+ const Empty$1 = 0;
803
+ const FocusSearchInput = 21;
804
+ const FocusSearchReplaceInput = 31;
805
+ const FocusSearchMatchCase = 32;
806
+ const FocusSearchRegex = 33;
807
+ const FocusSearchWholeWord = 34;
808
+ const FocusSearchReplaceAll = 35;
809
+ const FocusSearchPreserveCase = 36;
810
+ const FocusSearchIncludeInput = 1007;
811
+
812
+ const User = 1;
813
+ const Script = 2;
814
+
802
815
  const clearSearchResults$1 = state => {
803
816
  return {
804
817
  ...state,
@@ -806,7 +819,9 @@ const clearSearchResults$1 = state => {
806
819
  items: [],
807
820
  minLineY: 0,
808
821
  maxLineY: 0,
809
- message: ''
822
+ message: '',
823
+ focus: FocusSearchInput,
824
+ focusSource: Script
810
825
  };
811
826
  };
812
827
 
@@ -835,9 +850,6 @@ const copy = async state => {
835
850
  return state;
836
851
  };
837
852
 
838
- const User = 1;
839
- const Script = 2;
840
-
841
853
  const minimumSliderSize = 20;
842
854
 
843
855
  const states = Object.create(null);
@@ -874,16 +886,6 @@ const create$1 = ({
874
886
  };
875
887
  };
876
888
 
877
- const Empty$1 = 0;
878
- const FocusSearchInput = 21;
879
- const FocusSearchReplaceInput = 31;
880
- const FocusSearchMatchCase = 32;
881
- const FocusSearchRegex = 33;
882
- const FocusSearchWholeWord = 34;
883
- const FocusSearchReplaceAll = 35;
884
- const FocusSearchPreserveCase = 36;
885
- const FocusSearchIncludeInput = 1007;
886
-
887
889
  const create = (uid, x, y, width, height, workspacePath, assetDir, itemHeight, value = '', replacement = '') => {
888
890
  const state = {
889
891
  uid,
@@ -1402,10 +1404,10 @@ const MaskIconCaseSensitive = 'MaskIconCaseSensitive';
1402
1404
  const MaskIconChevronDown = 'MaskIconChevronDown';
1403
1405
  const MaskIconChevronRight = 'MaskIconChevronRight';
1404
1406
  const MaskIconEllipsis = 'MaskIconEllipsis';
1407
+ const MaskIconExclude = 'MaskIconExclude';
1405
1408
  const MaskIconPreserveCase = 'MaskIconPreserveCase';
1406
1409
  const MaskIconRegex = 'MaskIconRegex';
1407
1410
  const MaskIconReplaceAll = 'MaskIconReplaceAll';
1408
- const MaskIconSettings = 'MaskIconSettings';
1409
1411
  const MaskIconWholeWord = 'MaskIconWholeWord';
1410
1412
  const MultilineInputBox = 'MultilineInputBox';
1411
1413
  const Search$1 = 'Search';
@@ -1750,7 +1752,7 @@ const getSearchHeaderDetailsExpandedVirtualDom = message => {
1750
1752
  checked: false
1751
1753
  }];
1752
1754
  const excludeButtons = [{
1753
- icon: MaskIconSettings,
1755
+ icon: MaskIconExclude,
1754
1756
  title: useExcludeSettings(),
1755
1757
  command: 'toggleUseExcludeSettings',
1756
1758
  checked: false
@@ -2821,12 +2823,21 @@ const handleReplaceInput = (state, value, inputSource = Script) => {
2821
2823
  });
2822
2824
  };
2823
2825
 
2826
+ const handleExcludeInput = (state, value, inputSource = Script) => {
2827
+ return handleUpdate(state, {
2828
+ excludeValue: value,
2829
+ inputSource
2830
+ });
2831
+ };
2832
+
2824
2833
  const getInputHandler = name => {
2825
2834
  switch (name) {
2826
2835
  case 'search-value':
2827
2836
  return handleInput;
2828
2837
  case 'replacement-value':
2829
2838
  return handleReplaceInput;
2839
+ case 'files-to-exclude-value':
2840
+ return handleExcludeInput;
2830
2841
  default:
2831
2842
  throw new Error(`unknown input handler: ${name}`);
2832
2843
  }
@@ -2837,6 +2848,14 @@ const handleSharedInput = (state, name, value, inputSource = Script) => {
2837
2848
  return fn(state, value, inputSource);
2838
2849
  };
2839
2850
 
2851
+ const handleIncludeInput = (state, includeValue) => {
2852
+ return {
2853
+ ...state,
2854
+ includeValue,
2855
+ focusSource: User
2856
+ };
2857
+ };
2858
+
2840
2859
  const first = () => {
2841
2860
  return 0;
2842
2861
  };
@@ -3182,13 +3201,27 @@ const getSavedFlags = savedState => {
3182
3201
  }
3183
3202
  return 0;
3184
3203
  };
3204
+ const getSavedIncludeValue = savedState => {
3205
+ if (savedState && typeof savedState === 'object' && 'includeValue' in savedState && typeof savedState.includeValue === 'string') {
3206
+ return savedState.includeValue;
3207
+ }
3208
+ return '';
3209
+ };
3210
+ const getSavedExcludeValue = savedState => {
3211
+ if (savedState && typeof savedState === 'object' && 'excludeValue' in savedState && typeof savedState.excludeValue === 'string') {
3212
+ return savedState.excludeValue;
3213
+ }
3214
+ return '';
3215
+ };
3185
3216
  const restoreState = savedState => {
3186
3217
  return {
3187
3218
  savedValue: getSavedValue(savedState),
3188
3219
  replacement: getSavedReplacement(savedState),
3189
3220
  savedCollapsedPaths: [],
3190
3221
  threads: 1,
3191
- flags: getSavedFlags(savedState)
3222
+ flags: getSavedFlags(savedState),
3223
+ includeValue: getSavedIncludeValue(savedState),
3224
+ excludeValue: getSavedExcludeValue(savedState)
3192
3225
  };
3193
3226
  };
3194
3227
 
@@ -3379,13 +3412,23 @@ const replaceAllAndPrompt = async (workspacePath, items, replacement, matchCount
3379
3412
  return true;
3380
3413
  };
3381
3414
 
3382
- const saveState = state => {
3415
+ const saveState = uid => {
3416
+ const {
3417
+ newState
3418
+ } = get(uid);
3419
+ const {
3420
+ value,
3421
+ replacement,
3422
+ flags,
3423
+ includeValue,
3424
+ excludeValue
3425
+ } = newState;
3383
3426
  return {
3384
- value: state.value,
3385
- replacement: state.replacement,
3386
- flags: state.flags,
3387
- includeValue: state.includeValue,
3388
- excludeValue: state.excludeValue
3427
+ value,
3428
+ replacement,
3429
+ flags,
3430
+ includeValue,
3431
+ excludeValue
3389
3432
  };
3390
3433
  };
3391
3434
 
@@ -3603,6 +3646,8 @@ const commandMap = {
3603
3646
  'TextSearch.handleIconThemeChange': wrapCommand(handleIconThemeChange),
3604
3647
  'TextSearch.handleInput': wrapCommand(handleInput),
3605
3648
  'TextSearch.handleReplaceInput': wrapCommand(handleReplaceInput),
3649
+ 'TextSearch.handleIncludeInput': wrapCommand(handleIncludeInput),
3650
+ 'TextSearch.handleExcludeInput': wrapCommand(handleExcludeInput),
3606
3651
  'TextSearch.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
3607
3652
  'TextSearch.handleScrollBarClick': wrapCommand(handleScrollBarClick),
3608
3653
  '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.9.0",
3
+ "version": "3.10.0",
4
4
  "description": "Text Search Worker",
5
5
  "main": "dist/textSearchWorkerMain.js",
6
6
  "type": "module",