@lvce-editor/text-search-view 1.9.1 → 1.11.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/textSearchViewMain.js +65 -10
- package/package.json +1 -1
|
@@ -2583,7 +2583,7 @@ const isEqual$3 = (oldState, newState) => {
|
|
|
2583
2583
|
};
|
|
2584
2584
|
|
|
2585
2585
|
const isEqual$2 = (oldState, newState) => {
|
|
2586
|
-
return oldState.collapsedPaths === newState.collapsedPaths && oldState.contextLinesEnabled === newState.contextLinesEnabled && oldState.deltaY === newState.deltaY && oldState.flags === newState.flags && oldState.focus === newState.focus && oldState.icons === newState.icons && oldState.items === newState.items && oldState.isSearchEditor === newState.isSearchEditor && oldState.listFocused === newState.listFocused && oldState.listFocusedIndex === newState.listFocusedIndex && oldState.loaded === newState.loaded && oldState.maxLineY === newState.maxLineY && oldState.message === newState.message && oldState.minLineY === newState.minLineY && oldState.renderFolderPaths === newState.renderFolderPaths && oldState.replacement === newState.replacement && oldState.searchInputErrorMessage === newState.searchInputErrorMessage;
|
|
2586
|
+
return oldState.collapsedPaths === newState.collapsedPaths && oldState.contextLinesEnabled === newState.contextLinesEnabled && oldState.deltaY === newState.deltaY && oldState.flags === newState.flags && oldState.focus === newState.focus && oldState.icons === newState.icons && oldState.items === newState.items && oldState.isSearchEditor === newState.isSearchEditor && oldState.listFocused === newState.listFocused && oldState.listFocusedIndex === newState.listFocusedIndex && oldState.loaded === newState.loaded && oldState.maxLineY === newState.maxLineY && oldState.message === newState.message && oldState.minLineY === newState.minLineY && oldState.renderFolderPaths === newState.renderFolderPaths && oldState.replacement === newState.replacement && oldState.searchInputErrorMessage === newState.searchInputErrorMessage && oldState.workspacePath === newState.workspacePath;
|
|
2587
2587
|
};
|
|
2588
2588
|
|
|
2589
2589
|
const isEqual$1 = (oldState, newState) => {
|
|
@@ -2803,7 +2803,9 @@ const MatchCase$1 = 'Match Case';
|
|
|
2803
2803
|
const Remove$1 = 'Remove';
|
|
2804
2804
|
const MatchWholeWord$1 = 'Match Whole Word';
|
|
2805
2805
|
const NoResults = 'No results found';
|
|
2806
|
+
const NoWorkspaceFolder = 'You have not opened or specified a folder.';
|
|
2806
2807
|
const Oneresult = '1 result in 1 file';
|
|
2808
|
+
const OpenFolder = 'Open Folder';
|
|
2807
2809
|
const OpenNewSearchEditor = 'Open New Search Editor';
|
|
2808
2810
|
const ContextLines$1 = 'Context Lines';
|
|
2809
2811
|
const ToggleContextLines$1 = 'Toggle Context Lines';
|
|
@@ -2830,6 +2832,12 @@ const TheResultSetOnlyContainsASubSetOfMatches = 'The result set only contains a
|
|
|
2830
2832
|
const noResults = () => {
|
|
2831
2833
|
return i18nString(NoResults);
|
|
2832
2834
|
};
|
|
2835
|
+
const noWorkspaceFolder = () => {
|
|
2836
|
+
return i18nString(NoWorkspaceFolder);
|
|
2837
|
+
};
|
|
2838
|
+
const openFolder$1 = () => {
|
|
2839
|
+
return i18nString(OpenFolder);
|
|
2840
|
+
};
|
|
2833
2841
|
const oneResult = () => {
|
|
2834
2842
|
return i18nString(Oneresult);
|
|
2835
2843
|
};
|
|
@@ -4823,7 +4831,7 @@ const set = rpc => {
|
|
|
4823
4831
|
state.connected = true;
|
|
4824
4832
|
};
|
|
4825
4833
|
|
|
4826
|
-
const handleMessagePort = async (port, viewletCommandMap) => {
|
|
4834
|
+
const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
|
|
4827
4835
|
const executeViewletCommand = async (uid, command, ...args) => {
|
|
4828
4836
|
const fn = viewletCommandMap[`TextSearch.${command}`];
|
|
4829
4837
|
if (typeof fn !== 'function') {
|
|
@@ -4838,7 +4846,18 @@ const handleMessagePort = async (port, viewletCommandMap) => {
|
|
|
4838
4846
|
},
|
|
4839
4847
|
messagePort: port
|
|
4840
4848
|
});
|
|
4841
|
-
|
|
4849
|
+
if (setAsRendererProcess) {
|
|
4850
|
+
set(rpc);
|
|
4851
|
+
}
|
|
4852
|
+
};
|
|
4853
|
+
|
|
4854
|
+
const openFolder = async () => {
|
|
4855
|
+
await invoke$2('Dialog.openFolder');
|
|
4856
|
+
};
|
|
4857
|
+
|
|
4858
|
+
const handleOpenFolderClick = async state => {
|
|
4859
|
+
await openFolder();
|
|
4860
|
+
return state;
|
|
4842
4861
|
};
|
|
4843
4862
|
|
|
4844
4863
|
const handlePullResultsFound = async (state, resultSearchId, newResults) => {
|
|
@@ -5858,6 +5877,16 @@ const getCss = (top, uniqueIndents, uniqueIndentRights, scrollBarHeight, scrollB
|
|
|
5858
5877
|
contain: strict;
|
|
5859
5878
|
height: ${headerHeight}px;
|
|
5860
5879
|
}
|
|
5880
|
+
|
|
5881
|
+
.SearchWorkspaceMessageAction {
|
|
5882
|
+
background: none;
|
|
5883
|
+
border: none;
|
|
5884
|
+
color: var(--LinkForeground, #3794ff);
|
|
5885
|
+
cursor: pointer;
|
|
5886
|
+
font: inherit;
|
|
5887
|
+
padding: 0;
|
|
5888
|
+
text-decoration: underline;
|
|
5889
|
+
}
|
|
5861
5890
|
`, ...uniqueIndents.map(getIndentRule), ...uniqueIndentRights.map(getIndentRightRule), getTreeItemsTopRule(treeItemsTop), getScrollBarThumbTopRule(scrollBarY)];
|
|
5862
5891
|
return rules.join('\n');
|
|
5863
5892
|
};
|
|
@@ -5937,6 +5966,11 @@ const renderFocusContext = (oldState, newState) => {
|
|
|
5937
5966
|
return [SetFocusContext, newState.uid, FocusSearch, newState.focus];
|
|
5938
5967
|
};
|
|
5939
5968
|
|
|
5969
|
+
const SearchWarningMessage = 'SearchWarningMessage';
|
|
5970
|
+
const SearchWorkspaceMessage = 'SearchWorkspaceMessage';
|
|
5971
|
+
const SearchWorkspaceMessageAction = 'SearchWorkspaceMessageAction';
|
|
5972
|
+
const MessageAction = 'MessageAction';
|
|
5973
|
+
|
|
5940
5974
|
const HandleClick = 1;
|
|
5941
5975
|
const HandleListContextMenu = 2;
|
|
5942
5976
|
const HandleHeaderContextMenu = 3;
|
|
@@ -5958,6 +5992,23 @@ const HandleListPointerDown = 19;
|
|
|
5958
5992
|
const HandleInputContextMenu = 20;
|
|
5959
5993
|
const HandleInputSelectionChange = 21;
|
|
5960
5994
|
const HandleActionClick = 22;
|
|
5995
|
+
const HandleOpenFolderClick = 23;
|
|
5996
|
+
|
|
5997
|
+
const getNoWorkspaceMessageVirtualDom = workspacePath => {
|
|
5998
|
+
if (workspacePath !== '') {
|
|
5999
|
+
return [];
|
|
6000
|
+
}
|
|
6001
|
+
return [{
|
|
6002
|
+
childCount: 2,
|
|
6003
|
+
className: mergeClassNames(ViewletSearchMessage, ViewletSearchMessageIndented, SearchWorkspaceMessage),
|
|
6004
|
+
type: Div
|
|
6005
|
+
}, text(`${noWorkspaceFolder()} - `), {
|
|
6006
|
+
childCount: 1,
|
|
6007
|
+
className: mergeClassNames(MessageAction, SearchWorkspaceMessageAction),
|
|
6008
|
+
onClick: HandleOpenFolderClick,
|
|
6009
|
+
type: Button$2
|
|
6010
|
+
}, text(openFolder$1())];
|
|
6011
|
+
};
|
|
5961
6012
|
|
|
5962
6013
|
const Focusable = 0;
|
|
5963
6014
|
|
|
@@ -6190,8 +6241,6 @@ const getSearchHeaderDetailsVirtualDom = (flags, message) => {
|
|
|
6190
6241
|
return getSearchHeaderDetailsCollapsedVirtualDom(message);
|
|
6191
6242
|
};
|
|
6192
6243
|
|
|
6193
|
-
const SearchWarningMessage = 'SearchWarningMessage';
|
|
6194
|
-
|
|
6195
6244
|
const getSearchHeaderLimitHitVirtualDom = limitHitWarning => {
|
|
6196
6245
|
if (!limitHitWarning) {
|
|
6197
6246
|
return [];
|
|
@@ -6594,22 +6643,23 @@ const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight,
|
|
|
6594
6643
|
};
|
|
6595
6644
|
|
|
6596
6645
|
const className = mergeClassNames(Viewlet, Search$3);
|
|
6597
|
-
const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchInputErrorMessage, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight, matchCount, limitHitWarning, focus = 0, initial = false, isSearchEditor = false, contextLines = 1, contextLinesEnabled = false) => {
|
|
6646
|
+
const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchInputErrorMessage, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight, matchCount, limitHitWarning, focus = 0, initial = false, isSearchEditor = false, contextLines = 1, contextLinesEnabled = false, workspacePath) => {
|
|
6598
6647
|
if (initial) {
|
|
6599
6648
|
return [];
|
|
6600
6649
|
}
|
|
6601
6650
|
const errorDom = getSearchInputErrorVirtualDom(searchInputErrorMessage);
|
|
6602
|
-
const
|
|
6651
|
+
const noWorkspaceMessageDom = getNoWorkspaceMessageVirtualDom(workspacePath);
|
|
6652
|
+
const childCount = 2 + (errorDom.length > 0 ? 1 : 0) + (noWorkspaceMessageDom.length > 0 ? 1 : 0);
|
|
6603
6653
|
return [{
|
|
6604
6654
|
childCount,
|
|
6605
6655
|
className,
|
|
6606
6656
|
type: Div
|
|
6607
|
-
}, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning, isSearchEditor, contextLines, contextLinesEnabled), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight)];
|
|
6657
|
+
}, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage, matchCount, focus, limitHitWarning, isSearchEditor, contextLines, contextLinesEnabled), ...errorDom, ...noWorkspaceMessageDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline, scrollBarHeight, scrollBarY, scrollBarValue, deltaY, itemHeight)];
|
|
6608
6658
|
};
|
|
6609
6659
|
|
|
6610
6660
|
const getDom = newState => {
|
|
6611
6661
|
const viewModel = createViewModel(newState);
|
|
6612
|
-
const dom = getSearchVirtualDom(viewModel.displayResults, viewModel.flags, viewModel.message, viewModel.focusOutline, viewModel.searchInputErrorMessage, viewModel.scrollBarHeight, viewModel.scrollBarY, viewModel.scrollBarValue, viewModel.deltaY, viewModel.itemHeight, viewModel.matchCount, newState.limitHitWarning, viewModel.focus, newState.initial, newState.isSearchEditor, newState.contextLines, newState.contextLinesEnabled);
|
|
6662
|
+
const dom = getSearchVirtualDom(viewModel.displayResults, viewModel.flags, viewModel.message, viewModel.focusOutline, viewModel.searchInputErrorMessage, viewModel.scrollBarHeight, viewModel.scrollBarY, viewModel.scrollBarValue, viewModel.deltaY, viewModel.itemHeight, viewModel.matchCount, newState.limitHitWarning, viewModel.focus, newState.initial, newState.isSearchEditor, newState.contextLines, newState.contextLinesEnabled, newState.workspacePath);
|
|
6613
6663
|
return dom;
|
|
6614
6664
|
};
|
|
6615
6665
|
|
|
@@ -6871,6 +6921,10 @@ const renderEventListeners = () => {
|
|
|
6871
6921
|
}, {
|
|
6872
6922
|
name: HandleInputBlur,
|
|
6873
6923
|
params: ['handleInputBlur', TargetName]
|
|
6924
|
+
}, {
|
|
6925
|
+
name: HandleOpenFolderClick,
|
|
6926
|
+
params: ['handleOpenFolderClick'],
|
|
6927
|
+
preventDefault: true
|
|
6874
6928
|
}];
|
|
6875
6929
|
};
|
|
6876
6930
|
|
|
@@ -7061,7 +7115,7 @@ const handleContextMenu = async (state, button, x, y) => {
|
|
|
7061
7115
|
return newState;
|
|
7062
7116
|
};
|
|
7063
7117
|
|
|
7064
|
-
const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
|
|
7118
|
+
const handleDirectMessagePort = (port, setAsRendererProcess) => handleMessagePort(port, commandMap, setAsRendererProcess);
|
|
7065
7119
|
const commandMap = {
|
|
7066
7120
|
'TextSearch.clearSearchResults': wrapCommand(clearSearchResults$1),
|
|
7067
7121
|
'TextSearch.collapseAll': wrapCommand(collapseAll$1),
|
|
@@ -7129,6 +7183,7 @@ const commandMap = {
|
|
|
7129
7183
|
'TextSearch.handleListFocus': wrapCommand(handleListFocus),
|
|
7130
7184
|
'TextSearch.handleListPointerDown': wrapCommand(handleListPointerDown),
|
|
7131
7185
|
'TextSearch.handleMessagePort': handleDirectMessagePort,
|
|
7186
|
+
'TextSearch.handleOpenFolderClick': wrapCommand(handleOpenFolderClick),
|
|
7132
7187
|
'TextSearch.handlePullResultsFound': wrapCommand(handlePullResultsFound),
|
|
7133
7188
|
'TextSearch.handleReplaceInput': wrapCommand(handleReplaceInput),
|
|
7134
7189
|
'TextSearch.handleResize': wrapCommand(handleResize),
|