@lvce-editor/text-search-worker 5.13.0 → 5.15.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.
- package/dist/textSearchWorkerMain.js +89 -54
- package/package.json +1 -1
|
@@ -1243,7 +1243,7 @@ const terminate = () => {
|
|
|
1243
1243
|
const Alert = 'alert';
|
|
1244
1244
|
const Button$3 = 'button';
|
|
1245
1245
|
const CheckBox = 'checkbox';
|
|
1246
|
-
const None$
|
|
1246
|
+
const None$2 = 'none';
|
|
1247
1247
|
const ScrollBar$1 = 'scrollbar';
|
|
1248
1248
|
const Status = 'status';
|
|
1249
1249
|
const ToolBar = 'toolbar';
|
|
@@ -1330,6 +1330,8 @@ const TargetValue = 'event.target.value';
|
|
|
1330
1330
|
|
|
1331
1331
|
const Search$1 = 18;
|
|
1332
1332
|
|
|
1333
|
+
const None$1 = 0;
|
|
1334
|
+
|
|
1333
1335
|
const LeftClick = 0;
|
|
1334
1336
|
|
|
1335
1337
|
const Electron = 2;
|
|
@@ -2090,7 +2092,7 @@ const copy = async state => {
|
|
|
2090
2092
|
return state;
|
|
2091
2093
|
};
|
|
2092
2094
|
|
|
2093
|
-
const copyPath = async state => {
|
|
2095
|
+
const copyPath$1 = async state => {
|
|
2094
2096
|
const {
|
|
2095
2097
|
items,
|
|
2096
2098
|
focusedIndex
|
|
@@ -2287,6 +2289,8 @@ const ConfirmReplaceManyOccurrencesInOneFile = "Replace {PH1} occurrences across
|
|
|
2287
2289
|
const ConfirmReplaceManyOccurrencesInOneFileNoValue = 'Replace {PH1} occurrences across 1 file';
|
|
2288
2290
|
const ConfirmReplaceOneOccurrenceInOneFile = "Replace 1 occurrence across 1 file with '{PH1}'";
|
|
2289
2291
|
const ConfirmReplaceOneOccurrenceInOneFileNoValue = 'Replace 1 occurrence across 1 file';
|
|
2292
|
+
const CopyPath = 'Copy Path';
|
|
2293
|
+
const Dismiss = 'Dismiss';
|
|
2290
2294
|
const Exclude = 'Exclude';
|
|
2291
2295
|
const FilesToExclude$1 = 'Files to Exclude';
|
|
2292
2296
|
const FilesToInclude$1 = 'Files to Include';
|
|
@@ -2406,9 +2410,15 @@ const replaceAll$1 = () => {
|
|
|
2406
2410
|
const replace = () => {
|
|
2407
2411
|
return i18nString(Replace);
|
|
2408
2412
|
};
|
|
2413
|
+
const dismiss = () => {
|
|
2414
|
+
return i18nString(Dismiss);
|
|
2415
|
+
};
|
|
2409
2416
|
const theResultSetOnlyContainsASubSetOfMatches = () => {
|
|
2410
2417
|
return i18nString(TheResultSetOnlyContainsASubSetOfMatches);
|
|
2411
2418
|
};
|
|
2419
|
+
const copyPath = () => {
|
|
2420
|
+
return i18nString(CopyPath);
|
|
2421
|
+
};
|
|
2412
2422
|
const refresh$1 = () => {
|
|
2413
2423
|
return i18nString(Refresh$1);
|
|
2414
2424
|
};
|
|
@@ -2654,7 +2664,11 @@ const getNextFocus = (focus, flags) => {
|
|
|
2654
2664
|
};
|
|
2655
2665
|
|
|
2656
2666
|
const focusNextInput = state => {
|
|
2657
|
-
const
|
|
2667
|
+
const {
|
|
2668
|
+
focus,
|
|
2669
|
+
flags
|
|
2670
|
+
} = state;
|
|
2671
|
+
const nextFocus = getNextFocus(focus, flags);
|
|
2658
2672
|
const isListFocus = nextFocus === FocusSearchResults;
|
|
2659
2673
|
return {
|
|
2660
2674
|
...state,
|
|
@@ -2809,6 +2823,23 @@ const getKeyBindings = () => {
|
|
|
2809
2823
|
return [...getSearchHeaderKeyBindings(), ...getSearchResultKeyBindings()];
|
|
2810
2824
|
};
|
|
2811
2825
|
|
|
2826
|
+
const getMenuEntryIds = () => {
|
|
2827
|
+
return [Search$1];
|
|
2828
|
+
};
|
|
2829
|
+
const getMenuEntries = () => {
|
|
2830
|
+
return [{
|
|
2831
|
+
id: 'dismiss',
|
|
2832
|
+
label: dismiss(),
|
|
2833
|
+
flags: None$1,
|
|
2834
|
+
command: /* TODO */''
|
|
2835
|
+
}, {
|
|
2836
|
+
id: 'copyPath',
|
|
2837
|
+
label: copyPath(),
|
|
2838
|
+
flags: None$1,
|
|
2839
|
+
command: /* TODO */''
|
|
2840
|
+
}];
|
|
2841
|
+
};
|
|
2842
|
+
|
|
2812
2843
|
const handleError = error => {
|
|
2813
2844
|
console.error(`[text-search-worker] ${error}`);
|
|
2814
2845
|
};
|
|
@@ -3027,8 +3058,7 @@ const getRipGrepArgs = ({
|
|
|
3027
3058
|
searchString,
|
|
3028
3059
|
useRegularExpression
|
|
3029
3060
|
}) => {
|
|
3030
|
-
const ripGrepArgs = ['--hidden', '--no-require-git', '--smart-case', '--stats', '--json'];
|
|
3031
|
-
ripGrepArgs.push('--threads', `${threads}`);
|
|
3061
|
+
const ripGrepArgs = ['--hidden', '--no-require-git', '--smart-case', '--stats', '--json', '--threads', `${threads}`];
|
|
3032
3062
|
if (isCaseSensitive) {
|
|
3033
3063
|
ripGrepArgs.push('--case-sensitive');
|
|
3034
3064
|
} else {
|
|
@@ -3477,11 +3507,45 @@ const handleInputBlur = async (state, name) => {
|
|
|
3477
3507
|
return state;
|
|
3478
3508
|
};
|
|
3479
3509
|
|
|
3480
|
-
const
|
|
3510
|
+
const getSearchFocusKey = key => {
|
|
3511
|
+
switch (key) {
|
|
3512
|
+
case SearchValue:
|
|
3513
|
+
return FocusSearchInput;
|
|
3514
|
+
case ReplaceValue:
|
|
3515
|
+
return FocusSearchReplaceInput;
|
|
3516
|
+
case MatchCase:
|
|
3517
|
+
return FocusSearchMatchCase;
|
|
3518
|
+
case MatchWholeWord:
|
|
3519
|
+
return FocusSearchWholeWord;
|
|
3520
|
+
case UseRegularExpression:
|
|
3521
|
+
return FocusSearchRegex;
|
|
3522
|
+
case ReplaceAll:
|
|
3523
|
+
return FocusSearchReplaceAll;
|
|
3524
|
+
case PreserveCase:
|
|
3525
|
+
return FocusSearchPreserveCase;
|
|
3526
|
+
case ToggleSearchDetails:
|
|
3527
|
+
return FocusToggleDetails;
|
|
3528
|
+
case FilesToInclude:
|
|
3529
|
+
return FocusSearchIncludeInput;
|
|
3530
|
+
case FilesToExclude:
|
|
3531
|
+
return FocusSearchExcludeInput;
|
|
3532
|
+
case SearchOnlyOpenEditors:
|
|
3533
|
+
return FocusSearchOpenEditors;
|
|
3534
|
+
case UseExcludeSettings:
|
|
3535
|
+
return FocusIgnoreFiles;
|
|
3536
|
+
case ToggleReplace:
|
|
3537
|
+
return FocusToggleReplace;
|
|
3538
|
+
default:
|
|
3539
|
+
return Empty;
|
|
3540
|
+
}
|
|
3541
|
+
};
|
|
3542
|
+
|
|
3543
|
+
const handleInputFocus = (state, name) => {
|
|
3544
|
+
const key = getSearchFocusKey(name);
|
|
3481
3545
|
return {
|
|
3482
3546
|
...state,
|
|
3483
3547
|
listFocused: false,
|
|
3484
|
-
focus:
|
|
3548
|
+
focus: key,
|
|
3485
3549
|
focused: true
|
|
3486
3550
|
};
|
|
3487
3551
|
};
|
|
@@ -3528,13 +3592,17 @@ const launchSearchProcessNode = async () => {
|
|
|
3528
3592
|
return rpc;
|
|
3529
3593
|
};
|
|
3530
3594
|
|
|
3531
|
-
const
|
|
3595
|
+
const setSearchProcessFactory = platform => {
|
|
3532
3596
|
if (platform === Electron) {
|
|
3533
3597
|
setFactory(launchSearchProcessElectron);
|
|
3534
3598
|
} else if (platform === Remote) {
|
|
3535
3599
|
setFactory(launchSearchProcessNode);
|
|
3536
3600
|
}
|
|
3537
|
-
|
|
3601
|
+
};
|
|
3602
|
+
const initialize = async platform => {
|
|
3603
|
+
setSearchProcessFactory(platform);
|
|
3604
|
+
|
|
3605
|
+
// TODO connect to icon theme worker
|
|
3538
3606
|
};
|
|
3539
3607
|
|
|
3540
3608
|
// TODO optimize this function to return the minimum number
|
|
@@ -4210,7 +4278,7 @@ const renderFocus = (oldState, newState) => {
|
|
|
4210
4278
|
};
|
|
4211
4279
|
|
|
4212
4280
|
const renderFocusContext = (oldState, newState) => {
|
|
4213
|
-
return [SetFocusContext, newState.uid, newState.focus];
|
|
4281
|
+
return [SetFocusContext, newState.uid, FocusSearch, newState.focus];
|
|
4214
4282
|
};
|
|
4215
4283
|
|
|
4216
4284
|
const None = 0;
|
|
@@ -4517,7 +4585,7 @@ const getOutSideButtonsDom = outsideButtons => {
|
|
|
4517
4585
|
preNodes: [{
|
|
4518
4586
|
type: Div,
|
|
4519
4587
|
className: SearchFieldContainer,
|
|
4520
|
-
role: None$
|
|
4588
|
+
role: None$2,
|
|
4521
4589
|
childCount: 1 + outsideButtons.length
|
|
4522
4590
|
}],
|
|
4523
4591
|
postNodes: outsideButtons.flatMap(getSearchFieldButtonVirtualDom)
|
|
@@ -4533,7 +4601,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
|
|
|
4533
4601
|
const dom = [...preNodes, {
|
|
4534
4602
|
type: Div,
|
|
4535
4603
|
className: searchFieldClassName,
|
|
4536
|
-
role: None$
|
|
4604
|
+
role: None$2,
|
|
4537
4605
|
childCount: 2
|
|
4538
4606
|
}, {
|
|
4539
4607
|
type: TextArea,
|
|
@@ -4691,12 +4759,12 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
4691
4759
|
const dom = [{
|
|
4692
4760
|
type: Div,
|
|
4693
4761
|
className: SearchHeaderTop,
|
|
4694
|
-
role: None$
|
|
4762
|
+
role: None$2,
|
|
4695
4763
|
childCount: 2
|
|
4696
4764
|
}, ...getSearchToggleVirtualDom(replaceExpanded), {
|
|
4697
4765
|
type: Div,
|
|
4698
4766
|
className: SearchHeaderTopRight,
|
|
4699
|
-
role: None$
|
|
4767
|
+
role: None$2,
|
|
4700
4768
|
childCount: replaceExpanded ? 2 : 1
|
|
4701
4769
|
}, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, Boolean(searchInputErrorMessage))];
|
|
4702
4770
|
if (flags & ReplaceExpanded) {
|
|
@@ -4708,7 +4776,7 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
4708
4776
|
const parentNode = {
|
|
4709
4777
|
type: Div,
|
|
4710
4778
|
className: SearchHeader,
|
|
4711
|
-
role: None$
|
|
4779
|
+
role: None$2,
|
|
4712
4780
|
childCount: 3,
|
|
4713
4781
|
onContextMenu: HandleHeaderContextMenu
|
|
4714
4782
|
};
|
|
@@ -4804,7 +4872,7 @@ const getFileIconVirtualDom = icon => {
|
|
|
4804
4872
|
type: Img,
|
|
4805
4873
|
className: FileIcon,
|
|
4806
4874
|
src: icon,
|
|
4807
|
-
role: None$
|
|
4875
|
+
role: None$2,
|
|
4808
4876
|
childCount: 0
|
|
4809
4877
|
};
|
|
4810
4878
|
};
|
|
@@ -5038,7 +5106,7 @@ const getIconVirtualDom = (icon, type = Div) => {
|
|
|
5038
5106
|
return {
|
|
5039
5107
|
type,
|
|
5040
5108
|
className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
|
|
5041
|
-
role: None$
|
|
5109
|
+
role: None$2,
|
|
5042
5110
|
childCount: 0
|
|
5043
5111
|
};
|
|
5044
5112
|
};
|
|
@@ -5282,39 +5350,6 @@ const focusElement = (state, focusKey) => {
|
|
|
5282
5350
|
};
|
|
5283
5351
|
};
|
|
5284
5352
|
|
|
5285
|
-
const getSearchFocusKey = key => {
|
|
5286
|
-
switch (key) {
|
|
5287
|
-
case SearchValue:
|
|
5288
|
-
return FocusSearchInput;
|
|
5289
|
-
case ReplaceValue:
|
|
5290
|
-
return FocusSearchReplaceInput;
|
|
5291
|
-
case MatchCase:
|
|
5292
|
-
return FocusSearchMatchCase;
|
|
5293
|
-
case MatchWholeWord:
|
|
5294
|
-
return FocusSearchWholeWord;
|
|
5295
|
-
case UseRegularExpression:
|
|
5296
|
-
return FocusSearchRegex;
|
|
5297
|
-
case ReplaceAll:
|
|
5298
|
-
return FocusSearchReplaceAll;
|
|
5299
|
-
case PreserveCase:
|
|
5300
|
-
return FocusSearchPreserveCase;
|
|
5301
|
-
case ToggleSearchDetails:
|
|
5302
|
-
return FocusToggleDetails;
|
|
5303
|
-
case FilesToInclude:
|
|
5304
|
-
return FocusSearchIncludeInput;
|
|
5305
|
-
case FilesToExclude:
|
|
5306
|
-
return FocusSearchExcludeInput;
|
|
5307
|
-
case SearchOnlyOpenEditors:
|
|
5308
|
-
return FocusSearchOpenEditors;
|
|
5309
|
-
case UseExcludeSettings:
|
|
5310
|
-
return FocusIgnoreFiles;
|
|
5311
|
-
case ToggleReplace:
|
|
5312
|
-
return FocusToggleReplace;
|
|
5313
|
-
default:
|
|
5314
|
-
return Empty;
|
|
5315
|
-
}
|
|
5316
|
-
};
|
|
5317
|
-
|
|
5318
5353
|
const handleFocusIn = async (state, key) => {
|
|
5319
5354
|
const focusKey = getSearchFocusKey(key);
|
|
5320
5355
|
if (state.focus === focusKey) {
|
|
@@ -5405,9 +5440,7 @@ const show = async (x, y, id, ...args) => {
|
|
|
5405
5440
|
|
|
5406
5441
|
const handleContextMenuKeyboard = async state => {
|
|
5407
5442
|
const {
|
|
5408
|
-
x
|
|
5409
|
-
} = state; // TODO
|
|
5410
|
-
const {
|
|
5443
|
+
x,
|
|
5411
5444
|
y
|
|
5412
5445
|
} = state; // TODO
|
|
5413
5446
|
await show(x, y, Search$1);
|
|
@@ -5439,7 +5472,7 @@ const commandMap = {
|
|
|
5439
5472
|
'TextSearch.collapseAll': wrapCommand(collapseAll$1),
|
|
5440
5473
|
'TextSearch.collapseDetails': wrapCommand(collapseDetails),
|
|
5441
5474
|
'TextSearch.copy': wrapCommand(copy),
|
|
5442
|
-
'TextSearch.copyPath': wrapCommand(copyPath),
|
|
5475
|
+
'TextSearch.copyPath': wrapCommand(copyPath$1),
|
|
5443
5476
|
'TextSearch.diff2': diff2,
|
|
5444
5477
|
'TextSearch.dismissItem': wrapCommand(dismissItem),
|
|
5445
5478
|
'TextSearch.expandDetails': wrapCommand(expandDetails),
|
|
@@ -5518,6 +5551,8 @@ const commandMap = {
|
|
|
5518
5551
|
'TextSearch.saveState': wrapGetter(saveState),
|
|
5519
5552
|
'TextSearch.terminate': terminate,
|
|
5520
5553
|
'TextSearch.renderActions': renderActions,
|
|
5554
|
+
'TextSearch.getMenuEntryIds': getMenuEntryIds,
|
|
5555
|
+
'TextSearch.getMenuEntries': getMenuEntries,
|
|
5521
5556
|
// TODO needed?
|
|
5522
5557
|
'TextSearch.replaceAllAndPrompt': replaceAllAndPrompt,
|
|
5523
5558
|
'TextSearch.textSearch': textSearch$6
|