@lvce-editor/text-search-worker 3.25.0 → 3.26.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.
@@ -1673,7 +1673,6 @@ const Highlight = 'Highlight';
1673
1673
  const HighlightDeleted = 'HighlightDeleted';
1674
1674
  const HighlightInserted = 'HighlightInserted';
1675
1675
  const IconButton = 'IconButton';
1676
- const SearchInputError = 'SearchInputError';
1677
1676
  const Label = 'Label';
1678
1677
  const List = 'List';
1679
1678
  const MaskIcon = 'MaskIcon';
@@ -1694,6 +1693,7 @@ const SearchFieldButton = 'SearchFieldButton';
1694
1693
  const SearchFieldButtonChecked = 'SearchFieldButtonChecked';
1695
1694
  const SearchFieldButtons = 'SearchFieldButtons';
1696
1695
  const SearchFieldContainer = 'SearchFieldContainer';
1696
+ const SearchFieldError = 'SearchFieldError';
1697
1697
  const SearchHeader = 'SearchHeader';
1698
1698
  const SearchHeaderDetails = 'SearchHeaderDetails';
1699
1699
  const SearchHeaderDetailsExpanded = 'SearchHeaderDetailsExpanded';
@@ -1701,6 +1701,7 @@ const SearchHeaderDetailsExpandedTop = 'SearchHeaderDetailsExpandedTop';
1701
1701
  const SearchHeaderDetailsHeading = 'SearchHeaderDetailsHeading';
1702
1702
  const SearchHeaderTop = 'SearchHeaderTop';
1703
1703
  const SearchHeaderTopRight = 'SearchHeaderTopRight';
1704
+ const SearchInputError = 'SearchInputError';
1704
1705
  const SearchRemove = 'SearchRemove';
1705
1706
  const SearchToggleButton = 'SearchToggleButton';
1706
1707
  const SearchToggleButtonExpanded = 'SearchToggleButtonExpanded';
@@ -2101,14 +2102,16 @@ const getOutSideButtonsDom = outsideButtons => {
2101
2102
  postNodes: outsideButtons.flatMap(getSearchFieldButtonVirtualDom)
2102
2103
  };
2103
2104
  };
2104
- const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, onFocus = '') => {
2105
+
2106
+ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, onFocus = '', hasError = false) => {
2105
2107
  const {
2106
2108
  preNodes,
2107
2109
  postNodes
2108
2110
  } = getOutSideButtonsDom(outsideButtons);
2111
+ const searchFieldClassName = hasError ? mergeClassNames(SearchField, SearchFieldError) : SearchField;
2109
2112
  const dom = [...preNodes, {
2110
2113
  type: Div,
2111
- className: SearchField,
2114
+ className: searchFieldClassName,
2112
2115
  role: None,
2113
2116
  childCount: 2
2114
2117
  }, {
@@ -2219,7 +2222,7 @@ const getSearchToggleVirtualDom = flags => {
2219
2222
  }];
2220
2223
  };
2221
2224
 
2222
- const getSearchHeaderTopVirtualDom = flags => {
2225
+ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage = '') => {
2223
2226
  const inputActions = getInputActionsInput(flags);
2224
2227
  const replaceActions = getInputActionsReplace(flags);
2225
2228
  const dom = [{
@@ -2232,14 +2235,14 @@ const getSearchHeaderTopVirtualDom = flags => {
2232
2235
  className: SearchHeaderTopRight,
2233
2236
  role: None,
2234
2237
  childCount: flags & ReplaceExpanded ? 2 : 1
2235
- }, ...getSearchFieldVirtualDom(SearchValue, 'Search', HandleInput, inputActions.inside, inputActions.outside)];
2238
+ }, ...getSearchFieldVirtualDom(SearchValue, 'Search', HandleInput, inputActions.inside, inputActions.outside, '', Boolean(searchInputErrorMessage))];
2236
2239
  if (flags & ReplaceExpanded) {
2237
2240
  dom.push(...getSearchFieldVirtualDom(ReplaceValue, 'Replace', HandleReplaceInput, replaceActions.inside, replaceActions.outside));
2238
2241
  }
2239
2242
  return dom;
2240
2243
  };
2241
2244
 
2242
- const getSearchHeaderVirtualDom = (flags, message) => {
2245
+ const getSearchHeaderVirtualDom = (flags, message, searchInputErrorMessage) => {
2243
2246
  const dom = [{
2244
2247
  type: Div,
2245
2248
  className: SearchHeader,
@@ -2247,7 +2250,7 @@ const getSearchHeaderVirtualDom = (flags, message) => {
2247
2250
  childCount: 2,
2248
2251
  onClick: HandleHeaderClick,
2249
2252
  onFocusIn: HandleHeaderFocusIn
2250
- }, ...getSearchHeaderTopVirtualDom(flags), ...getSearchHeaderDetailsVirtualDom(flags, message)];
2253
+ }, ...getSearchHeaderTopVirtualDom(flags, searchInputErrorMessage), ...getSearchHeaderDetailsVirtualDom(flags, message)];
2251
2254
  return dom;
2252
2255
  };
2253
2256
 
@@ -2416,7 +2419,7 @@ const getSearchVirtualDom = (visibleItems, flags, message, focusOutline, searchI
2416
2419
  type: Div,
2417
2420
  className: mergeClassNames(Viewlet, Search$1),
2418
2421
  childCount
2419
- }, ...getSearchHeaderVirtualDom(flags, message), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline)];
2422
+ }, ...getSearchHeaderVirtualDom(flags, message, searchInputErrorMessage), ...errorDom, ...getSearchResultsVirtualDom(visibleItems, focusOutline)];
2420
2423
  };
2421
2424
 
2422
2425
  const handleError = error => {
@@ -2824,7 +2827,8 @@ const handleUpdate = async (state, update) => {
2824
2827
  fileCount,
2825
2828
  matchCount: resultCount,
2826
2829
  loaded: true,
2827
- icons
2830
+ icons,
2831
+ searchInputErrorMessage: ''
2828
2832
  };
2829
2833
  } catch (error) {
2830
2834
  handleError(error);
@@ -3243,6 +3247,12 @@ const getTopHeight = flags => {
3243
3247
  return 61;
3244
3248
  };
3245
3249
 
3250
+ const addCollapsedPath = (collapsedPaths, path) => {
3251
+ const pathWithDot = `.${path}`;
3252
+ const newCollapsedPaths = [...collapsedPaths, path, pathWithDot];
3253
+ return newCollapsedPaths;
3254
+ };
3255
+
3246
3256
  const getFilteredResults = (results, collapsedPaths) => {
3247
3257
  if (collapsedPaths.length === 0) {
3248
3258
  return results;
@@ -3271,9 +3281,7 @@ const selectIndexFile = (state, searchResult, index) => {
3271
3281
  maxLineY
3272
3282
  } = state;
3273
3283
  const path = getAbsolutePath(searchResult.text);
3274
- string(path);
3275
- const pathWithDot = `.${path}`;
3276
- const newCollapsedPaths = [...collapsedPaths, path, pathWithDot];
3284
+ const newCollapsedPaths = addCollapsedPath(collapsedPaths, path);
3277
3285
  const filteredResults = getFilteredResults(items, collapsedPaths);
3278
3286
  const newMaxLineY = Math.min(maxLineY, filteredResults.length);
3279
3287
  return {
@@ -3890,6 +3898,7 @@ const commandMap = {
3890
3898
  'TextSearch.refresh': wrapCommand(refresh),
3891
3899
  'TextSearch.replaceAll': wrapCommand(replaceAll),
3892
3900
  'TextSearch.replaceAllAndPrompt': wrapCommand(replaceAllAndPrompt),
3901
+ 'TextSearch.selectIndex': wrapCommand(selectIndex),
3893
3902
  'TextSearch.submit': wrapCommand(submit),
3894
3903
  'TextSearch.toggleMatchCase': wrapCommand(toggleMatchCase),
3895
3904
  'TextSearch.toggleMatchWholeWord': wrapCommand(toggleMatchWholeWord),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "3.25.0",
3
+ "version": "3.26.0",
4
4
  "description": "Text Search Worker",
5
5
  "main": "dist/textSearchWorkerMain.js",
6
6
  "type": "module",