@lvce-editor/text-search-worker 4.5.0 → 4.6.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 +97 -23
- package/package.json +1 -1
|
@@ -1076,7 +1076,7 @@ const FocusSearchWholeWord = 34;
|
|
|
1076
1076
|
const FocusToggleDetails = 1010;
|
|
1077
1077
|
const FocusToggleReplace = 1020;
|
|
1078
1078
|
|
|
1079
|
-
const clearSearchResults = state => {
|
|
1079
|
+
const clearSearchResults$1 = state => {
|
|
1080
1080
|
return {
|
|
1081
1081
|
...state,
|
|
1082
1082
|
value: '',
|
|
@@ -1089,6 +1089,10 @@ const clearSearchResults = state => {
|
|
|
1089
1089
|
};
|
|
1090
1090
|
};
|
|
1091
1091
|
|
|
1092
|
+
const collapseAll$1 = async state => {
|
|
1093
|
+
return state;
|
|
1094
|
+
};
|
|
1095
|
+
|
|
1092
1096
|
const PreserveCase$2 = 1 << 0; // 1
|
|
1093
1097
|
const UseRegularExpression$2 = 1 << 1; // 2
|
|
1094
1098
|
const ReplaceExpanded = 1 << 2; // 4
|
|
@@ -1328,33 +1332,40 @@ const i18nString = (key, placeholders = emptyObject) => {
|
|
|
1328
1332
|
return key.replaceAll(RE_PLACEHOLDER, replacer);
|
|
1329
1333
|
};
|
|
1330
1334
|
|
|
1335
|
+
const ClearSearchResults = 'Clear Search Results';
|
|
1336
|
+
const CollapseAll$1 = 'Collapse All';
|
|
1331
1337
|
const ConfirmReplaceManyOccurrencesInManyFiles = "Replace {PH1} occurrences across {PH2} files with '{PH3}'";
|
|
1332
1338
|
const ConfirmReplaceManyOccurrencesInManyFilesNoValue = 'Replace {PH1} occurrences across {PH2} files';
|
|
1333
1339
|
const ConfirmReplaceManyOccurrencesInOneFile = "Replace {PH1} occurrences across 1 file with '{PH2}'";
|
|
1334
1340
|
const ConfirmReplaceManyOccurrencesInOneFileNoValue = 'Replace {PH1} occurrences across 1 file';
|
|
1335
1341
|
const ConfirmReplaceOneOccurrenceInOneFile = "Replace 1 occurrence across 1 file with '{PH1}'";
|
|
1336
1342
|
const ConfirmReplaceOneOccurrenceInOneFileNoValue = 'Replace 1 occurrence across 1 file';
|
|
1343
|
+
const Exclude = 'Exclude';
|
|
1337
1344
|
const FilesToExclude$1 = 'Files to Exclude';
|
|
1338
1345
|
const FilesToInclude$1 = 'Files to Include';
|
|
1346
|
+
const Include = 'Include';
|
|
1339
1347
|
const ManyResultsInManyFiles = '{PH1} results in {PH2} files';
|
|
1340
1348
|
const ManyResultsInOneFile = '{PH1} results in 1 file';
|
|
1341
1349
|
const MatchCase$1 = 'Match Case';
|
|
1342
1350
|
const MatchWholeWord$1 = 'Match Whole Word';
|
|
1343
1351
|
const NoResults = 'No results found';
|
|
1344
1352
|
const Oneresult = '1 result in 1 file';
|
|
1353
|
+
const OpenNewSearchEditor = 'Open New Search Editor';
|
|
1345
1354
|
const PreserveCase$1 = 'Preserve Case';
|
|
1355
|
+
const Refresh$1 = 'Refresh';
|
|
1346
1356
|
const Replace = 'Replace';
|
|
1347
1357
|
const ReplaceAll$1 = 'Replace All';
|
|
1348
1358
|
const ReplacedManyOccurrencesInManyFiles = "Replaced {PH1} occurrences across {PH2} files with '{PH3}'";
|
|
1349
1359
|
const ReplacedOneOccurrenceInOneFile = "Replaced 1 occurrence across 1 file with '{PH1}'";
|
|
1360
|
+
const ReplaceForHistory = 'Replace (⇅ for history)';
|
|
1350
1361
|
const Search$2 = 'Search';
|
|
1351
1362
|
const SearchForHistory = 'Search (⇅ for history)';
|
|
1352
|
-
const ReplaceForHistory = 'Replace (⇅ for history)';
|
|
1353
1363
|
const SearchOnlyOpenEditors$1 = 'Search Only Open Editors';
|
|
1354
1364
|
const ToggleReplace$1 = 'Toggle Replace';
|
|
1355
1365
|
const ToggleSearchDetails$1 = 'Toggle Search Details';
|
|
1356
1366
|
const UseExcludeSettings$1 = 'Use Exclude Settings';
|
|
1357
1367
|
const UseRegularExpression$1 = 'Use Regular Expression';
|
|
1368
|
+
const ViewAsTree = 'View as Tree';
|
|
1358
1369
|
|
|
1359
1370
|
const noResults = () => {
|
|
1360
1371
|
return i18nString(NoResults);
|
|
@@ -1447,9 +1458,30 @@ const replaceAll$1 = () => {
|
|
|
1447
1458
|
const replace = () => {
|
|
1448
1459
|
return i18nString(Replace);
|
|
1449
1460
|
};
|
|
1461
|
+
const refresh$1 = () => {
|
|
1462
|
+
return i18nString(Refresh$1);
|
|
1463
|
+
};
|
|
1464
|
+
const clearSearchResults = () => {
|
|
1465
|
+
return i18nString(ClearSearchResults);
|
|
1466
|
+
};
|
|
1467
|
+
const openNewSearchEditor = () => {
|
|
1468
|
+
return i18nString(OpenNewSearchEditor);
|
|
1469
|
+
};
|
|
1470
|
+
const viewAsTree$1 = () => {
|
|
1471
|
+
return i18nString(ViewAsTree);
|
|
1472
|
+
};
|
|
1473
|
+
const collapseAll = () => {
|
|
1474
|
+
return i18nString(CollapseAll$1);
|
|
1475
|
+
};
|
|
1450
1476
|
const filesToInclude = () => {
|
|
1451
1477
|
return i18nString(FilesToInclude$1);
|
|
1452
1478
|
};
|
|
1479
|
+
const include = () => {
|
|
1480
|
+
return i18nString(Include);
|
|
1481
|
+
};
|
|
1482
|
+
const exclude = () => {
|
|
1483
|
+
return i18nString(Exclude);
|
|
1484
|
+
};
|
|
1453
1485
|
const filesToExclude = () => {
|
|
1454
1486
|
return i18nString(FilesToExclude$1);
|
|
1455
1487
|
};
|
|
@@ -1750,7 +1782,7 @@ const focusSearchValueNext = state => {
|
|
|
1750
1782
|
return focusMatchCase$1(state);
|
|
1751
1783
|
};
|
|
1752
1784
|
|
|
1753
|
-
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', 'handleHeaderFocusIn', 'handleHeaderFocusOut', 'handleIconThemeChange', 'handleIconThemeChange', 'handleIncludeInput', 'handleInput', 'handleInput2', 'handleListBlur', 'handleListFocus', 'handleReplaceInput', 'handleScrollBarCaptureLost', 'handleScrollBarClick', 'handleScrollBarMove', 'handleScrollBarThumbPointerMove', 'handleTouchEnd', 'handleTouchMove', 'handleTouchStart', 'handleUpdate', 'handleWheel', 'nextHistoryResult', 'previousHistoryResult', 'refresh', 'replaceAll', 'scrollDown', 'selectIndex', 'submit', 'toggleMatchCase', 'toggleMatchWholeWord', 'togglePreserveCase', 'toggleReplace', 'toggleSearchDetails', 'toggleUseRegularExpression'];
|
|
1785
|
+
const commandIds = ['clearSearchResults', 'collapseAll', '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', 'handleHeaderFocusIn', 'handleHeaderFocusOut', 'handleIconThemeChange', 'handleIconThemeChange', 'handleIncludeInput', 'handleInput', 'handleInput2', 'handleListBlur', 'handleListFocus', 'handleReplaceInput', 'handleScrollBarCaptureLost', 'handleScrollBarClick', 'handleScrollBarMove', 'handleScrollBarThumbPointerMove', 'handleTouchEnd', 'handleTouchMove', 'handleTouchStart', 'handleUpdate', 'handleWheel', 'nextHistoryResult', 'previousHistoryResult', 'refresh', 'replaceAll', 'scrollDown', 'selectIndex', 'submit', 'toggleMatchCase', 'toggleMatchWholeWord', 'togglePreserveCase', 'toggleReplace', 'toggleSearchDetails', 'toggleUseRegularExpression', 'viewAsTree'];
|
|
1754
1786
|
|
|
1755
1787
|
const getCommandIds = () => {
|
|
1756
1788
|
return commandIds;
|
|
@@ -2865,13 +2897,17 @@ const selectIndexPreview = async (state, searchResult, index) => {
|
|
|
2865
2897
|
const fileResult = items[fileIndex];
|
|
2866
2898
|
const relativePath = getRelativePath(fileResult.text);
|
|
2867
2899
|
const absolutePath = `${workspacePath}${relativePath}`;
|
|
2900
|
+
if (state.focus !== FocusSearchResults) {
|
|
2901
|
+
await setFocus(FocusSearchResults);
|
|
2902
|
+
}
|
|
2868
2903
|
await openUri(absolutePath, true, {
|
|
2869
2904
|
selections: new Uint32Array([lineNumber, 0, lineNumber, 0])
|
|
2870
2905
|
});
|
|
2871
2906
|
return {
|
|
2872
2907
|
...state,
|
|
2873
2908
|
listFocusedIndex: index,
|
|
2874
|
-
listFocused: false
|
|
2909
|
+
listFocused: false,
|
|
2910
|
+
focus: FocusSearchResults
|
|
2875
2911
|
};
|
|
2876
2912
|
};
|
|
2877
2913
|
|
|
@@ -3737,6 +3773,8 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
|
|
|
3737
3773
|
const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
|
|
3738
3774
|
const includeButtons = getInputActionsInclude(flags);
|
|
3739
3775
|
const excludeButtons = getInputActionsExclude(flags);
|
|
3776
|
+
const includePlaceholder = include();
|
|
3777
|
+
const excludePlaceholder = exclude();
|
|
3740
3778
|
return [{
|
|
3741
3779
|
type: Div,
|
|
3742
3780
|
className: SearchHeaderDetailsExpanded,
|
|
@@ -3749,11 +3787,11 @@ const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
|
|
|
3749
3787
|
type: H4,
|
|
3750
3788
|
className: SearchHeaderDetailsHeading,
|
|
3751
3789
|
childCount: 1
|
|
3752
|
-
}, text(filesToInclude()), ...getSearchFieldVirtualDom(FilesToInclude,
|
|
3790
|
+
}, text(filesToInclude()), ...getSearchFieldVirtualDom(FilesToInclude, includePlaceholder, HandleInput2, includeButtons.inside, includeButtons.outside), {
|
|
3753
3791
|
type: H4,
|
|
3754
3792
|
className: SearchHeaderDetailsHeading,
|
|
3755
3793
|
childCount: 1
|
|
3756
|
-
}, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude,
|
|
3794
|
+
}, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude, excludePlaceholder, HandleInput2, excludeButtons.inside, excludeButtons.outside), ...getSearchMessageVirtualDom(message, false)];
|
|
3757
3795
|
};
|
|
3758
3796
|
|
|
3759
3797
|
const getSearchHeaderDetailsVirtualDom = (flags, message) => {
|
|
@@ -3820,19 +3858,19 @@ const getSearchPlaceholder = focus => {
|
|
|
3820
3858
|
return search();
|
|
3821
3859
|
};
|
|
3822
3860
|
|
|
3823
|
-
const getSearchToggleVirtualDom =
|
|
3861
|
+
const getSearchToggleVirtualDom = replaceExpanded => {
|
|
3824
3862
|
return [{
|
|
3825
3863
|
type: Button$1,
|
|
3826
|
-
className: mergeClassNames(IconButton, SearchToggleButton,
|
|
3864
|
+
className: mergeClassNames(IconButton, SearchToggleButton, replaceExpanded ? SearchToggleButtonExpanded : ''),
|
|
3827
3865
|
title: toggleReplace$1(),
|
|
3828
3866
|
ariaLabel: toggleReplace$1(),
|
|
3829
|
-
ariaExpanded: Boolean(
|
|
3867
|
+
ariaExpanded: Boolean(replaceExpanded),
|
|
3830
3868
|
childCount: 1,
|
|
3831
3869
|
'data-command': 'toggleReplace',
|
|
3832
3870
|
name: ToggleReplace
|
|
3833
3871
|
}, {
|
|
3834
3872
|
type: Div,
|
|
3835
|
-
className: mergeClassNames(MaskIcon,
|
|
3873
|
+
className: mergeClassNames(MaskIcon, replaceExpanded ? MaskIconChevronDown : MaskIconChevronRight),
|
|
3836
3874
|
childCount: 0
|
|
3837
3875
|
}];
|
|
3838
3876
|
};
|
|
@@ -3842,16 +3880,17 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
|
|
|
3842
3880
|
const replaceActions = getInputActionsReplace(flags, matchCount);
|
|
3843
3881
|
const searchPlaceholder = getSearchPlaceholder(focus);
|
|
3844
3882
|
const replacePlaceholder = getReplacePlaceholder(focus);
|
|
3883
|
+
const replaceExpanded = flags & ReplaceExpanded;
|
|
3845
3884
|
const dom = [{
|
|
3846
3885
|
type: Div,
|
|
3847
3886
|
className: SearchHeaderTop,
|
|
3848
3887
|
role: None,
|
|
3849
3888
|
childCount: 2
|
|
3850
|
-
}, ...getSearchToggleVirtualDom(
|
|
3889
|
+
}, ...getSearchToggleVirtualDom(replaceExpanded), {
|
|
3851
3890
|
type: Div,
|
|
3852
3891
|
className: SearchHeaderTopRight,
|
|
3853
3892
|
role: None,
|
|
3854
|
-
childCount:
|
|
3893
|
+
childCount: replaceExpanded ? 2 : 1
|
|
3855
3894
|
}, ...getSearchFieldVirtualDom(SearchValue, searchPlaceholder, HandleInput2, inputActions.inside, inputActions.outside, '', Boolean(searchInputErrorMessage))];
|
|
3856
3895
|
if (flags & ReplaceExpanded) {
|
|
3857
3896
|
dom.push(...getSearchFieldVirtualDom(ReplaceValue, replacePlaceholder, HandleInput2, replaceActions.inside, replaceActions.outside));
|
|
@@ -4069,6 +4108,7 @@ const getTreeItemsVirtualDom = (visibleItems, deltaY, itemHeight) => {
|
|
|
4069
4108
|
onClick: HandleClick,
|
|
4070
4109
|
onBlur: HandleListBlur,
|
|
4071
4110
|
onWheel: HandleWheel,
|
|
4111
|
+
onContextMenu: HandleContextMenu,
|
|
4072
4112
|
id: TreeItems,
|
|
4073
4113
|
top: `${-pixelOffset}px`
|
|
4074
4114
|
}, ...visibleItems.flatMap(getSearchResultVirtualDom)];
|
|
@@ -4198,15 +4238,43 @@ const getActionsVirtualDom = actions => {
|
|
|
4198
4238
|
}, ...actions.flatMap(getActionVirtualDom)];
|
|
4199
4239
|
};
|
|
4200
4240
|
|
|
4241
|
+
const ClearAll = 'ClearAll';
|
|
4242
|
+
const CollapseAll = 'CollapseAll';
|
|
4243
|
+
const ListFlat = 'ListFlat';
|
|
4244
|
+
const NewFile = 'NewFile';
|
|
4245
|
+
const Refresh = 'Refresh';
|
|
4246
|
+
|
|
4247
|
+
const getActions = () => {
|
|
4248
|
+
return [{
|
|
4249
|
+
type: Button,
|
|
4250
|
+
id: refresh$1(),
|
|
4251
|
+
icon: Refresh,
|
|
4252
|
+
command: 'refresh'
|
|
4253
|
+
}, {
|
|
4254
|
+
type: Button,
|
|
4255
|
+
id: clearSearchResults(),
|
|
4256
|
+
icon: ClearAll,
|
|
4257
|
+
command: 'clearSearchResults'
|
|
4258
|
+
}, {
|
|
4259
|
+
type: Button,
|
|
4260
|
+
id: openNewSearchEditor(),
|
|
4261
|
+
icon: NewFile,
|
|
4262
|
+
command: ''
|
|
4263
|
+
}, {
|
|
4264
|
+
type: Button,
|
|
4265
|
+
id: viewAsTree$1(),
|
|
4266
|
+
icon: ListFlat,
|
|
4267
|
+
command: ''
|
|
4268
|
+
}, {
|
|
4269
|
+
type: Button,
|
|
4270
|
+
id: collapseAll(),
|
|
4271
|
+
icon: CollapseAll,
|
|
4272
|
+
command: ''
|
|
4273
|
+
}];
|
|
4274
|
+
};
|
|
4275
|
+
|
|
4201
4276
|
const renderActions = uid => {
|
|
4202
|
-
const
|
|
4203
|
-
oldState,
|
|
4204
|
-
newState
|
|
4205
|
-
} = get(uid);
|
|
4206
|
-
if (oldState === newState) {
|
|
4207
|
-
return [];
|
|
4208
|
-
}
|
|
4209
|
-
const actions = [];
|
|
4277
|
+
const actions = getActions();
|
|
4210
4278
|
const dom = getActionsVirtualDom(actions);
|
|
4211
4279
|
return dom;
|
|
4212
4280
|
};
|
|
@@ -4462,6 +4530,10 @@ const terminate = () => {
|
|
|
4462
4530
|
globalThis.close();
|
|
4463
4531
|
};
|
|
4464
4532
|
|
|
4533
|
+
const viewAsTree = async state => {
|
|
4534
|
+
return state;
|
|
4535
|
+
};
|
|
4536
|
+
|
|
4465
4537
|
const Keyboard = -1;
|
|
4466
4538
|
|
|
4467
4539
|
const show = async (x, y, id, ...args) => {
|
|
@@ -4522,8 +4594,9 @@ const wrapCommand = fn => {
|
|
|
4522
4594
|
};
|
|
4523
4595
|
|
|
4524
4596
|
const commandMap = {
|
|
4525
|
-
'TextSearch.clearSearchResults': wrapCommand(clearSearchResults),
|
|
4597
|
+
'TextSearch.clearSearchResults': wrapCommand(clearSearchResults$1),
|
|
4526
4598
|
'TextSearch.collapseDetails': wrapCommand(collapseDetails),
|
|
4599
|
+
'TextSearch.collapseAll': wrapCommand(collapseAll$1),
|
|
4527
4600
|
'TextSearch.copy': wrapCommand(copy),
|
|
4528
4601
|
'TextSearch.diff2': diff2,
|
|
4529
4602
|
'TextSearch.dismissItem': wrapCommand(dismissItem),
|
|
@@ -4550,8 +4623,8 @@ const commandMap = {
|
|
|
4550
4623
|
'TextSearch.focusReplaceValuePrevious': wrapCommand(focusReplaceValuePrevious),
|
|
4551
4624
|
'TextSearch.focusSearchValue': wrapCommand(focusSearchValue$1),
|
|
4552
4625
|
'TextSearch.focusSearchValueNext': wrapCommand(focusSearchValueNext),
|
|
4553
|
-
'TextSearch.getCommandIds': getCommandIds,
|
|
4554
4626
|
'TextSearch.handleClickAt': wrapCommand(handleClickAt),
|
|
4627
|
+
'TextSearch.viewAsTree': wrapCommand(viewAsTree),
|
|
4555
4628
|
'TextSearch.handleContextMenu': wrapCommand(handleContextMenu),
|
|
4556
4629
|
'TextSearch.handleExcludeInput': wrapCommand(handleExcludeInput),
|
|
4557
4630
|
'TextSearch.handleFocusIn': wrapCommand(handleFocusIn),
|
|
@@ -4574,7 +4647,6 @@ const commandMap = {
|
|
|
4574
4647
|
'TextSearch.nextHistoryResult': wrapCommand(nextHistoryResult),
|
|
4575
4648
|
'TextSearch.previousHistoryResult': wrapCommand(previousHistoryResult),
|
|
4576
4649
|
'TextSearch.refresh': wrapCommand(refresh),
|
|
4577
|
-
'TextSearch.renderActions': renderActions,
|
|
4578
4650
|
'TextSearch.replaceAll': wrapCommand(replaceAll),
|
|
4579
4651
|
'TextSearch.selectIndex': wrapCommand(selectIndex),
|
|
4580
4652
|
'TextSearch.submit': wrapCommand(submit),
|
|
@@ -4588,6 +4660,7 @@ const commandMap = {
|
|
|
4588
4660
|
'TextSearch.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
|
|
4589
4661
|
// not wrapped
|
|
4590
4662
|
'TextSearch.create': create,
|
|
4663
|
+
'TextSearch.getCommandIds': getCommandIds,
|
|
4591
4664
|
'TextSearch.getKeyBindings': getKeyBindings,
|
|
4592
4665
|
'TextSearch.render2': render2,
|
|
4593
4666
|
'TextSearch.renderEventListeners': renderEventListeners,
|
|
@@ -4595,6 +4668,7 @@ const commandMap = {
|
|
|
4595
4668
|
'TextSearch.restoreState': restoreState,
|
|
4596
4669
|
'TextSearch.saveState': saveState,
|
|
4597
4670
|
'TextSearch.terminate': terminate,
|
|
4671
|
+
'TextSearch.renderActions': renderActions,
|
|
4598
4672
|
// TODO needed?
|
|
4599
4673
|
'TextSearch.replaceAllAndPrompt': replaceAllAndPrompt,
|
|
4600
4674
|
'TextSearch.textSearch': textSearch
|