@lvce-editor/text-search-worker 4.7.0 → 4.8.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 +62 -30
- package/package.json +1 -1
|
@@ -1085,7 +1085,8 @@ const clearSearchResults$1 = state => {
|
|
|
1085
1085
|
maxLineY: 0,
|
|
1086
1086
|
message: '',
|
|
1087
1087
|
focus: FocusSearchInput,
|
|
1088
|
-
focusSource: Script
|
|
1088
|
+
focusSource: Script,
|
|
1089
|
+
inputSource: Script
|
|
1089
1090
|
};
|
|
1090
1091
|
};
|
|
1091
1092
|
|
|
@@ -1194,6 +1195,20 @@ const create$2 = () => {
|
|
|
1194
1195
|
};
|
|
1195
1196
|
};
|
|
1196
1197
|
return wrapped;
|
|
1198
|
+
},
|
|
1199
|
+
diff(uid, modules, numbers) {
|
|
1200
|
+
const {
|
|
1201
|
+
oldState,
|
|
1202
|
+
newState
|
|
1203
|
+
} = states[uid];
|
|
1204
|
+
const diffResult = [];
|
|
1205
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1206
|
+
const fn = modules[i];
|
|
1207
|
+
if (!fn(oldState, newState)) {
|
|
1208
|
+
diffResult.push(numbers[i]);
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
return diffResult;
|
|
1197
1212
|
}
|
|
1198
1213
|
};
|
|
1199
1214
|
};
|
|
@@ -1286,15 +1301,19 @@ const RenderExcludeValue = 6;
|
|
|
1286
1301
|
const RenderFocusContext = 7;
|
|
1287
1302
|
|
|
1288
1303
|
const diffType$5 = RenderExcludeValue;
|
|
1289
|
-
const isEqual$
|
|
1304
|
+
const isEqual$6 = (oldState, newState) => {
|
|
1290
1305
|
return oldState.excludeValue === newState.excludeValue || newState.inputSource === User;
|
|
1291
1306
|
};
|
|
1292
1307
|
|
|
1293
1308
|
const diffType$4 = RenderFocus;
|
|
1294
|
-
const isEqual$
|
|
1309
|
+
const isEqual$5 = (oldState, newState) => {
|
|
1295
1310
|
return oldState.focus === newState.focus || newState.focusSource === User;
|
|
1296
1311
|
};
|
|
1297
1312
|
|
|
1313
|
+
const isEqual$4 = (oldState, newState) => {
|
|
1314
|
+
return oldState.focus === newState.focus;
|
|
1315
|
+
};
|
|
1316
|
+
|
|
1298
1317
|
const diffType$3 = RenderIncludeValue;
|
|
1299
1318
|
const isEqual$3 = (oldState, newState) => {
|
|
1300
1319
|
return oldState.includeValue === newState.includeValue || newState.inputSource === User;
|
|
@@ -1315,8 +1334,8 @@ const isEqual = (oldState, newState) => {
|
|
|
1315
1334
|
return oldState.value === newState.value || newState.inputSource === User;
|
|
1316
1335
|
};
|
|
1317
1336
|
|
|
1318
|
-
const modules = [isEqual$2, isEqual$
|
|
1319
|
-
const numbers = [diffType$2, diffType$4, diffType$3, diffType$5, diffType$1, diffType];
|
|
1337
|
+
const modules = [isEqual$2, isEqual$5, isEqual$3, isEqual$6, isEqual$1, isEqual, isEqual$4];
|
|
1338
|
+
const numbers = [diffType$2, diffType$4, diffType$3, diffType$5, diffType$1, diffType, RenderFocusContext];
|
|
1320
1339
|
|
|
1321
1340
|
const diff$1 = (oldState, newState) => {
|
|
1322
1341
|
const diffResult = [];
|
|
@@ -1787,12 +1806,7 @@ const focusReplaceValue$1 = state => {
|
|
|
1787
1806
|
};
|
|
1788
1807
|
};
|
|
1789
1808
|
|
|
1790
|
-
const setFocus = async focusKey => {
|
|
1791
|
-
await invoke$2('Focus.setFocus', focusKey);
|
|
1792
|
-
};
|
|
1793
|
-
|
|
1794
1809
|
const focusSearchValue$1 = async state => {
|
|
1795
|
-
await setFocus(FocusSearchInput);
|
|
1796
1810
|
return {
|
|
1797
1811
|
...state,
|
|
1798
1812
|
focus: FocusSearchInput
|
|
@@ -1806,7 +1820,7 @@ const focusSearchValueNext = state => {
|
|
|
1806
1820
|
return focusMatchCase$1(state);
|
|
1807
1821
|
};
|
|
1808
1822
|
|
|
1809
|
-
const commandIds = ['clearSearchResults', 'collapseAll', 'collapseDetails', 'copy', 'dismissItem', 'dispose', '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'];
|
|
1823
|
+
const commandIds = ['clearSearchResults', 'collapseAll', 'collapseDetails', 'copy', 'dismissItem', 'dispose', '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', 'handleHeaderContextMenu', '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'];
|
|
1810
1824
|
|
|
1811
1825
|
const getCommandIds = () => {
|
|
1812
1826
|
return commandIds;
|
|
@@ -1825,7 +1839,7 @@ const CtrlCmd = 1 << 11 >>> 0;
|
|
|
1825
1839
|
const Shift = 1 << 10 >>> 0;
|
|
1826
1840
|
const Alt = 1 << 9 >>> 0;
|
|
1827
1841
|
|
|
1828
|
-
const
|
|
1842
|
+
const getSearchHeaderKeyBindings = () => {
|
|
1829
1843
|
return [{
|
|
1830
1844
|
key: CtrlCmd | Alt | Enter,
|
|
1831
1845
|
command: 'Search.replaceAll',
|
|
@@ -1847,6 +1861,18 @@ const getKeyBindings = () => {
|
|
|
1847
1861
|
command: 'Search.nextHistoryResult',
|
|
1848
1862
|
when: FocusSearchInput
|
|
1849
1863
|
}, {
|
|
1864
|
+
key: Enter,
|
|
1865
|
+
command: 'Search.submit',
|
|
1866
|
+
when: FocusSearchInput
|
|
1867
|
+
}, {
|
|
1868
|
+
key: Enter,
|
|
1869
|
+
command: 'Search.submit',
|
|
1870
|
+
when: FocusSearchReplaceInput
|
|
1871
|
+
}];
|
|
1872
|
+
};
|
|
1873
|
+
|
|
1874
|
+
const getSearchResultKeyBindings = () => {
|
|
1875
|
+
return [{
|
|
1850
1876
|
key: DownArrow,
|
|
1851
1877
|
command: 'Search.focusNext',
|
|
1852
1878
|
when: FocusSearchResults
|
|
@@ -1870,17 +1896,13 @@ const getKeyBindings = () => {
|
|
|
1870
1896
|
key: CtrlCmd | KeyC,
|
|
1871
1897
|
command: 'Search.copy',
|
|
1872
1898
|
when: FocusSearchResults
|
|
1873
|
-
}, {
|
|
1874
|
-
key: Enter,
|
|
1875
|
-
command: 'Search.submit',
|
|
1876
|
-
when: FocusSearchInput
|
|
1877
|
-
}, {
|
|
1878
|
-
key: Enter,
|
|
1879
|
-
command: 'Search.submit',
|
|
1880
|
-
when: FocusSearchReplaceInput
|
|
1881
1899
|
}];
|
|
1882
1900
|
};
|
|
1883
1901
|
|
|
1902
|
+
const getKeyBindings = () => {
|
|
1903
|
+
return [...getSearchHeaderKeyBindings(), ...getSearchResultKeyBindings()];
|
|
1904
|
+
};
|
|
1905
|
+
|
|
1884
1906
|
const handleError = error => {
|
|
1885
1907
|
console.error(`[text-search-worker] ${error}`);
|
|
1886
1908
|
};
|
|
@@ -2459,6 +2481,10 @@ const handleHeaderClick = async (state, name) => {
|
|
|
2459
2481
|
return fn(state);
|
|
2460
2482
|
};
|
|
2461
2483
|
|
|
2484
|
+
const handleHeaderContextMenu = async state => {
|
|
2485
|
+
return state;
|
|
2486
|
+
};
|
|
2487
|
+
|
|
2462
2488
|
const handleHeaderFocusIn = state => {
|
|
2463
2489
|
return state;
|
|
2464
2490
|
};
|
|
@@ -2877,7 +2903,9 @@ const selectIndexFile = async (state, searchResult, index) => {
|
|
|
2877
2903
|
listFocused: true,
|
|
2878
2904
|
listItems: filteredResults,
|
|
2879
2905
|
maxLineY,
|
|
2880
|
-
icons
|
|
2906
|
+
icons,
|
|
2907
|
+
focus: FocusSearchResults,
|
|
2908
|
+
focusSource: Script
|
|
2881
2909
|
};
|
|
2882
2910
|
};
|
|
2883
2911
|
|
|
@@ -2921,9 +2949,6 @@ const selectIndexPreview = async (state, searchResult, index) => {
|
|
|
2921
2949
|
const fileResult = items[fileIndex];
|
|
2922
2950
|
const relativePath = getRelativePath(fileResult.text);
|
|
2923
2951
|
const absolutePath = `${workspacePath}${relativePath}`;
|
|
2924
|
-
if (state.focus !== FocusSearchResults) {
|
|
2925
|
-
await setFocus(FocusSearchResults);
|
|
2926
|
-
}
|
|
2927
2952
|
await openUri(absolutePath, true, {
|
|
2928
2953
|
selections: new Uint32Array([lineNumber, 0, lineNumber, 0])
|
|
2929
2954
|
});
|
|
@@ -2931,7 +2956,8 @@ const selectIndexPreview = async (state, searchResult, index) => {
|
|
|
2931
2956
|
...state,
|
|
2932
2957
|
listFocusedIndex: index,
|
|
2933
2958
|
listFocused: false,
|
|
2934
|
-
focus: FocusSearchResults
|
|
2959
|
+
focus: FocusSearchResults,
|
|
2960
|
+
focusSource: Script
|
|
2935
2961
|
};
|
|
2936
2962
|
};
|
|
2937
2963
|
|
|
@@ -2962,7 +2988,7 @@ const selectIndex = async (state, index) => {
|
|
|
2962
2988
|
return fn(state, searchResult, index);
|
|
2963
2989
|
};
|
|
2964
2990
|
|
|
2965
|
-
const handleClickAt = (state, eventX, eventY) => {
|
|
2991
|
+
const handleClickAt = async (state, eventX, eventY) => {
|
|
2966
2992
|
const {
|
|
2967
2993
|
x,
|
|
2968
2994
|
y,
|
|
@@ -3362,6 +3388,7 @@ const TreeItem = 'treeitem';
|
|
|
3362
3388
|
|
|
3363
3389
|
const HandleClick = 'handleClick';
|
|
3364
3390
|
const HandleContextMenu = 'handleContextMenu';
|
|
3391
|
+
const HandleHeaderContextMenu = 'handleHeaderContextMenu';
|
|
3365
3392
|
const HandleExcludeInput = 'handleExcludeInput';
|
|
3366
3393
|
const HandleHeaderClick2 = 'handleHeaderClick2';
|
|
3367
3394
|
const HandleHeaderFocusIn = 'handleHeaderFocusIn';
|
|
@@ -3929,7 +3956,8 @@ const parentNode = {
|
|
|
3929
3956
|
childCount: 2,
|
|
3930
3957
|
onClick: HandleHeaderClick2,
|
|
3931
3958
|
onFocusIn: HandleHeaderFocusIn,
|
|
3932
|
-
onFocusOut: HandleHeaderFocusOut
|
|
3959
|
+
onFocusOut: HandleHeaderFocusOut,
|
|
3960
|
+
onContextMenu: HandleHeaderContextMenu
|
|
3933
3961
|
};
|
|
3934
3962
|
const getSearchHeaderVirtualDom = (flags, message, searchInputErrorMessage, matchCount, focus) => {
|
|
3935
3963
|
const dom = [parentNode, ...getSearchHeaderTopVirtualDom(flags, searchInputErrorMessage, matchCount, focus), ...getSearchHeaderDetailsVirtualDom(flags, message)];
|
|
@@ -4335,6 +4363,10 @@ const renderEventListeners = () => {
|
|
|
4335
4363
|
name: HandleContextMenu,
|
|
4336
4364
|
params: ['handleContextMenu', 'event.button', 'event.clientX', 'event.clientY'],
|
|
4337
4365
|
preventDefault: true
|
|
4366
|
+
}, {
|
|
4367
|
+
name: HandleHeaderContextMenu,
|
|
4368
|
+
params: ['handleHeaderContextMenu'],
|
|
4369
|
+
preventDefault: true
|
|
4338
4370
|
}, {
|
|
4339
4371
|
name: HandleWheel,
|
|
4340
4372
|
params: ['handleWheel', 'event.deltaMode', 'event.deltaY'],
|
|
@@ -4487,7 +4519,6 @@ const handleFocusIn = async (state, key) => {
|
|
|
4487
4519
|
if (state.focus === focusKey) {
|
|
4488
4520
|
return state;
|
|
4489
4521
|
}
|
|
4490
|
-
await setFocus(FocusSearch);
|
|
4491
4522
|
return {
|
|
4492
4523
|
...state,
|
|
4493
4524
|
focus: focusKey,
|
|
@@ -4604,8 +4635,8 @@ const handleContextMenu = async (state, button, x, y) => {
|
|
|
4604
4635
|
|
|
4605
4636
|
const commandMap = {
|
|
4606
4637
|
'TextSearch.clearSearchResults': wrapCommand(clearSearchResults$1),
|
|
4607
|
-
'TextSearch.collapseDetails': wrapCommand(collapseDetails),
|
|
4608
4638
|
'TextSearch.collapseAll': wrapCommand(collapseAll$1),
|
|
4639
|
+
'TextSearch.collapseDetails': wrapCommand(collapseDetails),
|
|
4609
4640
|
'TextSearch.copy': wrapCommand(copy),
|
|
4610
4641
|
'TextSearch.diff2': diff2,
|
|
4611
4642
|
'TextSearch.dismissItem': wrapCommand(dismissItem),
|
|
@@ -4633,11 +4664,11 @@ const commandMap = {
|
|
|
4633
4664
|
'TextSearch.focusSearchValue': wrapCommand(focusSearchValue$1),
|
|
4634
4665
|
'TextSearch.focusSearchValueNext': wrapCommand(focusSearchValueNext),
|
|
4635
4666
|
'TextSearch.handleClickAt': wrapCommand(handleClickAt),
|
|
4636
|
-
'TextSearch.viewAsTree': wrapCommand(viewAsTree),
|
|
4637
4667
|
'TextSearch.handleContextMenu': wrapCommand(handleContextMenu),
|
|
4638
4668
|
'TextSearch.handleExcludeInput': wrapCommand(handleExcludeInput),
|
|
4639
4669
|
'TextSearch.handleFocusIn': wrapCommand(handleFocusIn),
|
|
4640
4670
|
'TextSearch.handleHeaderClick': wrapCommand(handleHeaderClick),
|
|
4671
|
+
'TextSearch.handleHeaderContextMenu': wrapCommand(handleHeaderContextMenu),
|
|
4641
4672
|
'TextSearch.handleHeaderFocusIn': wrapCommand(handleHeaderFocusIn),
|
|
4642
4673
|
'TextSearch.handleHeaderFocusOut': wrapCommand(handleHeaderFocusOut),
|
|
4643
4674
|
'TextSearch.handleIconThemeChange': wrapCommand(handleIconThemeChange),
|
|
@@ -4667,6 +4698,7 @@ const commandMap = {
|
|
|
4667
4698
|
'TextSearch.toggleSearchDetails': wrapCommand(toggleDetailsExpanded),
|
|
4668
4699
|
'TextSearch.toggleUseIgnoreFiles': wrapCommand(toggleUseIgnoreFiles),
|
|
4669
4700
|
'TextSearch.toggleUseRegularExpression': wrapCommand(toggleUseRegularExpression),
|
|
4701
|
+
'TextSearch.viewAsTree': wrapCommand(viewAsTree),
|
|
4670
4702
|
// not wrapped
|
|
4671
4703
|
'TextSearch.create': create,
|
|
4672
4704
|
'TextSearch.getCommandIds': getCommandIds,
|