@lvce-editor/text-search-view 1.10.0 → 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.
@@ -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
  };
@@ -4843,6 +4851,15 @@ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess =
4843
4851
  }
4844
4852
  };
4845
4853
 
4854
+ const openFolder = async () => {
4855
+ await invoke$2('Dialog.openFolder');
4856
+ };
4857
+
4858
+ const handleOpenFolderClick = async state => {
4859
+ await openFolder();
4860
+ return state;
4861
+ };
4862
+
4846
4863
  const handlePullResultsFound = async (state, resultSearchId, newResults) => {
4847
4864
  const {
4848
4865
  fileIconCache,
@@ -5860,6 +5877,16 @@ const getCss = (top, uniqueIndents, uniqueIndentRights, scrollBarHeight, scrollB
5860
5877
  contain: strict;
5861
5878
  height: ${headerHeight}px;
5862
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
+ }
5863
5890
  `, ...uniqueIndents.map(getIndentRule), ...uniqueIndentRights.map(getIndentRightRule), getTreeItemsTopRule(treeItemsTop), getScrollBarThumbTopRule(scrollBarY)];
5864
5891
  return rules.join('\n');
5865
5892
  };
@@ -5939,6 +5966,11 @@ const renderFocusContext = (oldState, newState) => {
5939
5966
  return [SetFocusContext, newState.uid, FocusSearch, newState.focus];
5940
5967
  };
5941
5968
 
5969
+ const SearchWarningMessage = 'SearchWarningMessage';
5970
+ const SearchWorkspaceMessage = 'SearchWorkspaceMessage';
5971
+ const SearchWorkspaceMessageAction = 'SearchWorkspaceMessageAction';
5972
+ const MessageAction = 'MessageAction';
5973
+
5942
5974
  const HandleClick = 1;
5943
5975
  const HandleListContextMenu = 2;
5944
5976
  const HandleHeaderContextMenu = 3;
@@ -5960,6 +5992,23 @@ const HandleListPointerDown = 19;
5960
5992
  const HandleInputContextMenu = 20;
5961
5993
  const HandleInputSelectionChange = 21;
5962
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
+ };
5963
6012
 
5964
6013
  const Focusable = 0;
5965
6014
 
@@ -6192,8 +6241,6 @@ const getSearchHeaderDetailsVirtualDom = (flags, message) => {
6192
6241
  return getSearchHeaderDetailsCollapsedVirtualDom(message);
6193
6242
  };
6194
6243
 
6195
- const SearchWarningMessage = 'SearchWarningMessage';
6196
-
6197
6244
  const getSearchHeaderLimitHitVirtualDom = limitHitWarning => {
6198
6245
  if (!limitHitWarning) {
6199
6246
  return [];
@@ -6596,22 +6643,23 @@ const getSearchResultsVirtualDom = (visibleItems, focusOutline, scrollbarHeight,
6596
6643
  };
6597
6644
 
6598
6645
  const className = mergeClassNames(Viewlet, Search$3);
6599
- 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) => {
6600
6647
  if (initial) {
6601
6648
  return [];
6602
6649
  }
6603
6650
  const errorDom = getSearchInputErrorVirtualDom(searchInputErrorMessage);
6604
- const childCount = 2 + (errorDom.length > 0 ? 1 : 0);
6651
+ const noWorkspaceMessageDom = getNoWorkspaceMessageVirtualDom(workspacePath);
6652
+ const childCount = 2 + (errorDom.length > 0 ? 1 : 0) + (noWorkspaceMessageDom.length > 0 ? 1 : 0);
6605
6653
  return [{
6606
6654
  childCount,
6607
6655
  className,
6608
6656
  type: Div
6609
- }, ...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)];
6610
6658
  };
6611
6659
 
6612
6660
  const getDom = newState => {
6613
6661
  const viewModel = createViewModel(newState);
6614
- 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);
6615
6663
  return dom;
6616
6664
  };
6617
6665
 
@@ -6873,6 +6921,10 @@ const renderEventListeners = () => {
6873
6921
  }, {
6874
6922
  name: HandleInputBlur,
6875
6923
  params: ['handleInputBlur', TargetName]
6924
+ }, {
6925
+ name: HandleOpenFolderClick,
6926
+ params: ['handleOpenFolderClick'],
6927
+ preventDefault: true
6876
6928
  }];
6877
6929
  };
6878
6930
 
@@ -7131,6 +7183,7 @@ const commandMap = {
7131
7183
  'TextSearch.handleListFocus': wrapCommand(handleListFocus),
7132
7184
  'TextSearch.handleListPointerDown': wrapCommand(handleListPointerDown),
7133
7185
  'TextSearch.handleMessagePort': handleDirectMessagePort,
7186
+ 'TextSearch.handleOpenFolderClick': wrapCommand(handleOpenFolderClick),
7134
7187
  'TextSearch.handlePullResultsFound': wrapCommand(handlePullResultsFound),
7135
7188
  'TextSearch.handleReplaceInput': wrapCommand(handleReplaceInput),
7136
7189
  'TextSearch.handleResize': wrapCommand(handleResize),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-view",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "Text Search View",
5
5
  "keywords": [
6
6
  "text-search"