@lvce-editor/text-search-worker 3.42.0 → 3.44.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.
@@ -1703,6 +1703,7 @@ const TreeItemActive = 'TreeItemActive';
1703
1703
  const TreeItems$1 = 'TreeItems';
1704
1704
  const Viewlet = 'Viewlet';
1705
1705
  const ViewletSearchMessage = 'ViewletSearchMessage';
1706
+ const ViewletSearchMessageIndented = 'ViewletSearchMessageIndented';
1706
1707
 
1707
1708
  const Button$2 = 1;
1708
1709
 
@@ -2042,10 +2043,16 @@ const text = data => {
2042
2043
  };
2043
2044
  };
2044
2045
 
2045
- const getSearchMessageVirtualDom = message => {
2046
+ const getClassName = indented => {
2047
+ if (indented) {
2048
+ return mergeClassNames(ViewletSearchMessage, ViewletSearchMessageIndented);
2049
+ }
2050
+ return ViewletSearchMessage;
2051
+ };
2052
+ const getSearchMessageVirtualDom = (message, indented) => {
2046
2053
  return [{
2047
2054
  type: Div$1,
2048
- className: ViewletSearchMessage,
2055
+ className: getClassName(indented),
2049
2056
  role: Status,
2050
2057
  tabIndex: 0,
2051
2058
  childCount: 1
@@ -2057,7 +2064,7 @@ const getSearchHeaderDetailsCollapsedVirtualDom = message => {
2057
2064
  type: Div$1,
2058
2065
  className: SearchHeaderDetails,
2059
2066
  childCount: 2
2060
- }, ...getSearchMessageVirtualDom(message), ...getSearchDetailsToggleVirtualDom()];
2067
+ }, ...getSearchMessageVirtualDom(message, true), ...getSearchDetailsToggleVirtualDom()];
2061
2068
  };
2062
2069
 
2063
2070
  const CheckBoxEnabled = 1;
@@ -2223,7 +2230,7 @@ const getSearchHeaderDetailsExpandedVirtualDom = (flags, message) => {
2223
2230
  type: H4$1,
2224
2231
  className: SearchHeaderDetailsHeading,
2225
2232
  childCount: 1
2226
- }, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude, 'Exclude', HandleExcludeInput, excludeButtons.inside, excludeButtons.outside), ...getSearchMessageVirtualDom(message)];
2233
+ }, text(filesToExclude()), ...getSearchFieldVirtualDom(FilesToExclude, 'Exclude', HandleExcludeInput, excludeButtons.inside, excludeButtons.outside), ...getSearchMessageVirtualDom(message, false)];
2227
2234
  };
2228
2235
 
2229
2236
  const getSearchHeaderDetailsVirtualDom = (flags, message) => {
@@ -2313,15 +2320,16 @@ const getSearchHeaderTopVirtualDom = (flags, searchInputErrorMessage, matchCount
2313
2320
  return dom;
2314
2321
  };
2315
2322
 
2323
+ const parentNode = {
2324
+ type: Div$1,
2325
+ className: SearchHeader,
2326
+ role: None$1,
2327
+ childCount: 2,
2328
+ onClick: HandleHeaderClick2,
2329
+ onFocusIn: HandleHeaderFocusIn
2330
+ };
2316
2331
  const getSearchHeaderVirtualDom = (flags, message, searchInputErrorMessage, matchCount) => {
2317
- const dom = [{
2318
- type: Div$1,
2319
- className: SearchHeader,
2320
- role: None$1,
2321
- childCount: 2,
2322
- onClick: HandleHeaderClick2,
2323
- onFocusIn: HandleHeaderFocusIn
2324
- }, ...getSearchHeaderTopVirtualDom(flags, searchInputErrorMessage, matchCount), ...getSearchHeaderDetailsVirtualDom(flags, message)];
2332
+ const dom = [parentNode, ...getSearchHeaderTopVirtualDom(flags, searchInputErrorMessage, matchCount), ...getSearchHeaderDetailsVirtualDom(flags, message)];
2325
2333
  return dom;
2326
2334
  };
2327
2335
 
@@ -3675,106 +3683,148 @@ const refresh = state => {
3675
3683
  return handleUpdate(state, {});
3676
3684
  };
3677
3685
 
3678
- const getFocusSelector = focusKey => {
3679
- switch (focusKey) {
3680
- case FocusSearchInput:
3681
- return SearchValue;
3682
- case FocusSearchReplaceInput:
3683
- return ReplaceValue;
3684
- case FocusToggleDetails:
3685
- return ToggleSearchDetails;
3686
- case FocusSearchMatchCase:
3687
- return MatchCase;
3688
- case FocusSearchPreserveCase:
3689
- return PreserveCase;
3690
- case FocusSearchRegex:
3691
- return UseRegularExpression;
3692
- case FocusSearchIncludeInput:
3693
- return FilesToInclude;
3694
- case FocusSearchExcludeInput:
3695
- return FilesToExclude;
3696
- case FocusSearchWholeWord:
3697
- return MatchWholeWord;
3698
- case FocusSearchReplaceAll:
3699
- return ReplaceAll;
3700
- case FocusSearchOpenEditors:
3701
- return SearchOnlyOpenEditors;
3702
- case FocusIgnoreFiles:
3703
- return UseExcludeSettings;
3704
- case FocusToggleReplace:
3705
- return ToggleReplace;
3686
+ const RenderItems = 1;
3687
+ const RenderFocus = 2;
3688
+ const RenderValue = 3;
3689
+ const RenderReplaceValue = 4;
3690
+ const RenderIncludeValue = 5;
3691
+ const RenderExcludeValue = 6;
3692
+
3693
+ const renderItems = (oldState, newState) => {
3694
+ const displayResults = getDisplayResults(newState.listItems, newState.itemHeight, newState.fileCount, newState.value, newState.minLineY, newState.maxLineY, newState.replacement, newState.icons, newState.listFocusedIndex, newState.collapsedPaths, newState.items);
3695
+ const focusOutline = newState.listFocused && newState.listFocusedIndex === -1;
3696
+ const scrollBarValue = newState.deltaY / newState.finalDeltaY * 100;
3697
+ const scrollBarY = getScrollBarY(newState.deltaY, newState.finalDeltaY, newState.height - newState.headerHeight, newState.scrollBarHeight);
3698
+ const dom = getSearchVirtualDom(displayResults, newState.flags, newState.message, focusOutline, newState.searchInputErrorMessage, newState.scrollBarHeight, scrollBarY, scrollBarValue, newState.deltaY, newState.itemHeight, newState.matchCount);
3699
+ return ['Viewlet.setDom2', newState.uid, dom];
3700
+ };
3701
+ const renderFocus = (oldState, newState) => {
3702
+ return oldState.focus === newState.focus || newState.focusSource === User;
3703
+ };
3704
+ const renderValue = (oldState, newState) => {
3705
+ return ['Viewlet.send', newState.uid, 'setValue', newState.value, `[name="${SearchValue}"]`];
3706
+ };
3707
+ const renderReplacement = (oldState, newState) => {
3708
+ return ['Viewlet.send', newState.uid, 'setValue', newState.replacement, `[name=${ReplaceValue}]`];
3709
+ };
3710
+ const renderIncludeValue = (oldState, newState) => {
3711
+ return ['Viewlet.send', newState.uid, 'setValue', newState.includeValue, `[name=${FilesToInclude}]`];
3712
+ };
3713
+ const renderExcludeValue = (oldState, newState) => {
3714
+ return ['Viewlet.send', newState.uid, 'setValue', newState.excludeValue, `[name=${FilesToExclude}]`];
3715
+ };
3716
+ const getRenderer = diffType => {
3717
+ switch (diffType) {
3718
+ case RenderValue:
3719
+ return renderValue;
3720
+ case RenderFocus:
3721
+ return renderFocus;
3722
+ case RenderReplaceValue:
3723
+ return renderReplacement;
3724
+ case RenderIncludeValue:
3725
+ return renderIncludeValue;
3726
+ case RenderExcludeValue:
3727
+ return renderExcludeValue;
3728
+ case RenderItems:
3729
+ return renderItems;
3706
3730
  default:
3707
- return '';
3731
+ throw new Error('unknown renderer');
3708
3732
  }
3709
3733
  };
3710
3734
 
3711
- const renderItems = {
3712
- isEqual(oldState, newState) {
3713
- return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.replacement === newState.replacement && oldState.flags === newState.flags && oldState.message === newState.message && oldState.loaded === newState.loaded && oldState.collapsedPaths === newState.collapsedPaths && oldState.listFocusedIndex === newState.listFocusedIndex && oldState.listFocused === newState.listFocused && oldState.icons === newState.icons && oldState.searchInputErrorMessage === newState.searchInputErrorMessage && oldState.deltaY === newState.deltaY;
3714
- },
3715
- apply(oldState, newState) {
3716
- const displayResults = getDisplayResults(newState.listItems, newState.itemHeight, newState.fileCount, newState.value, newState.minLineY, newState.maxLineY, newState.replacement, newState.icons, newState.listFocusedIndex, newState.collapsedPaths, newState.items);
3717
- const focusOutline = newState.listFocused && newState.listFocusedIndex === -1;
3718
- const scrollBarValue = newState.deltaY / newState.finalDeltaY * 100;
3719
- const scrollBarY = getScrollBarY(newState.deltaY, newState.finalDeltaY, newState.height - newState.headerHeight, newState.scrollBarHeight);
3720
- const dom = getSearchVirtualDom(displayResults, newState.flags, newState.message, focusOutline, newState.searchInputErrorMessage, newState.scrollBarHeight, scrollBarY, scrollBarValue, newState.deltaY, newState.itemHeight, newState.matchCount);
3721
- return ['Viewlet.setDom2', newState.uid, dom];
3735
+ const applyRender = (oldState, newState, diffResult) => {
3736
+ const commands = [];
3737
+ for (const item of diffResult) {
3738
+ const fn = getRenderer(item);
3739
+ commands.push(fn(oldState, newState));
3722
3740
  }
3741
+ return commands;
3723
3742
  };
3724
- const renderFocus = {
3725
- isEqual(oldState, newState) {
3726
- return oldState.focus === newState.focus || newState.focusSource === User;
3727
- },
3728
- apply(oldState, newState) {
3729
- const name = newState.focusSource === User ? '' : getFocusSelector(newState.focus);
3730
- return ['Viewlet.focusElementByName', newState.uid, name];
3731
- }
3743
+
3744
+ const diffType$5 = RenderExcludeValue;
3745
+ const isEqual$5 = (oldState, newState) => {
3746
+ return oldState.excludeValue === newState.excludeValue || newState.inputSource === User;
3732
3747
  };
3733
- const renderValue = {
3734
- isEqual(oldState, newState) {
3735
- return oldState.value === newState.value || newState.inputSource === User;
3736
- },
3737
- apply(oldState, newState) {
3738
- return ['Viewlet.send', newState.uid, 'setValue', newState.value, `[name="${SearchValue}"]`];
3739
- }
3748
+
3749
+ const DiffExcludeValue = {
3750
+ __proto__: null,
3751
+ diffType: diffType$5,
3752
+ isEqual: isEqual$5
3740
3753
  };
3741
- const renderReplacement = {
3742
- isEqual(oldState, newState) {
3743
- return oldState.replacement === newState.replacement || newState.inputSource === User;
3744
- },
3745
- apply(oldState, newState) {
3746
- return ['Viewlet.send', newState.uid, 'setValue', newState.replacement, `[name=${ReplaceValue}]`];
3747
- }
3754
+
3755
+ const diffType$4 = RenderFocus;
3756
+ const isEqual$4 = (oldState, newState) => {
3757
+ return oldState.focus === newState.focus || newState.focusSource === User;
3748
3758
  };
3749
- const renderIncludeValue = {
3750
- isEqual(oldState, newState) {
3751
- return oldState.includeValue === newState.includeValue || newState.inputSource === User;
3752
- },
3753
- apply(oldState, newState) {
3754
- return ['Viewlet.send', newState.uid, 'setValue', newState.includeValue, `[name=${FilesToInclude}]`];
3755
- }
3759
+
3760
+ const DiffFocus = {
3761
+ __proto__: null,
3762
+ diffType: diffType$4,
3763
+ isEqual: isEqual$4
3764
+ };
3765
+
3766
+ const diffType$3 = RenderIncludeValue;
3767
+ const isEqual$3 = (oldState, newState) => {
3768
+ return oldState.includeValue === newState.includeValue || newState.inputSource === User;
3756
3769
  };
3757
- const renderExcludeValue = {
3758
- isEqual(oldState, newState) {
3759
- return oldState.excludeValue === newState.excludeValue || newState.inputSource === User;
3760
- },
3761
- apply(oldState, newState) {
3762
- return ['Viewlet.send', newState.uid, 'setValue', newState.excludeValue, `[name=${FilesToExclude}]`];
3770
+
3771
+ const DiffIncludeValue = {
3772
+ __proto__: null,
3773
+ diffType: diffType$3,
3774
+ isEqual: isEqual$3
3775
+ };
3776
+
3777
+ const diffType$2 = RenderItems;
3778
+ const isEqual$2 = (oldState, newState) => {
3779
+ return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.replacement === newState.replacement && oldState.flags === newState.flags && oldState.message === newState.message && oldState.loaded === newState.loaded && oldState.collapsedPaths === newState.collapsedPaths && oldState.listFocusedIndex === newState.listFocusedIndex && oldState.listFocused === newState.listFocused && oldState.icons === newState.icons && oldState.searchInputErrorMessage === newState.searchInputErrorMessage && oldState.deltaY === newState.deltaY;
3780
+ };
3781
+
3782
+ const DiffItems = {
3783
+ __proto__: null,
3784
+ diffType: diffType$2,
3785
+ isEqual: isEqual$2
3786
+ };
3787
+
3788
+ const diffType$1 = RenderReplaceValue;
3789
+ const isEqual$1 = (oldState, newState) => {
3790
+ return oldState.replacement === newState.replacement || newState.inputSource === User;
3791
+ };
3792
+
3793
+ const DiffReplaceValue = {
3794
+ __proto__: null,
3795
+ diffType: diffType$1,
3796
+ isEqual: isEqual$1
3797
+ };
3798
+
3799
+ const diffType = RenderValue;
3800
+ const isEqual = (oldState, newState) => {
3801
+ return oldState.value === newState.value || newState.inputSource === User;
3802
+ };
3803
+
3804
+ const DiffValue = {
3805
+ __proto__: null,
3806
+ diffType,
3807
+ isEqual
3808
+ };
3809
+
3810
+ const modules = [DiffItems, DiffFocus, DiffIncludeValue, DiffExcludeValue, DiffReplaceValue, DiffValue];
3811
+ const diff$1 = (oldState, newState) => {
3812
+ const diffResult = [];
3813
+ for (const module of modules) {
3814
+ if (!module.isEqual(oldState, newState)) {
3815
+ diffResult.push(module.diffType);
3816
+ }
3763
3817
  }
3818
+ return diffResult;
3764
3819
  };
3765
- const render = [renderItems, renderValue, renderIncludeValue, renderExcludeValue, renderReplacement, renderFocus];
3820
+
3766
3821
  const doRender = uid => {
3767
3822
  const {
3768
3823
  oldState,
3769
3824
  newState
3770
3825
  } = get(uid);
3771
- const commands = [];
3772
- for (const fn of render) {
3773
- if (!fn.isEqual(oldState, newState)) {
3774
- commands.push(fn.apply(oldState, newState));
3775
- }
3776
- }
3777
- return commands;
3826
+ const diffResult = diff$1(oldState, newState);
3827
+ return applyRender(oldState, newState, diffResult);
3778
3828
  };
3779
3829
 
3780
3830
  const renderEventListeners = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "3.42.0",
3
+ "version": "3.44.0",
4
4
  "description": "Text Search Worker",
5
5
  "keywords": [
6
6
  "text-search"