@lvce-editor/find-widget-worker 1.20.0 → 1.22.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.
@@ -989,24 +989,28 @@ const create$1 = (uid, x, y, width, height, parentUid) => {
989
989
  return state;
990
990
  };
991
991
 
992
- const isEqual$6 = (oldState, newState) => {
992
+ const isEqual$7 = (oldState, newState) => {
993
993
  return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
994
994
  };
995
995
 
996
- const isEqual$5 = (oldState, newState) => {
996
+ const isEqual$6 = (oldState, newState) => {
997
997
  return newState.width === newState.width && oldState.height === newState.height && oldState.x === newState.x;
998
998
  };
999
999
 
1000
- const isEqual$4 = (oldState, newState) => {
1000
+ const isEqual$5 = (oldState, newState) => {
1001
1001
  return oldState.version === newState.version;
1002
1002
  };
1003
1003
 
1004
+ const isEqual$4 = (oldState, newState) => {
1005
+ return oldState.focused === newState.focused && oldState.focus === newState.focus;
1006
+ };
1007
+
1004
1008
  const isEqual$3 = (oldState, newState) => {
1005
1009
  return oldState.focused === newState.focused;
1006
1010
  };
1007
1011
 
1008
1012
  const isEqual$2 = (oldState, newState) => {
1009
- return oldState.version === newState.version && oldState.replaceExpanded === newState.replaceExpanded && oldState.matchCount === newState.matchCount && oldState.matchIndex === newState.matchIndex;
1013
+ return oldState.version === newState.version && oldState.replaceExpanded === newState.replaceExpanded && oldState.matchCount === newState.matchCount && oldState.matchIndex === newState.matchIndex && oldState.matchCase === newState.matchCase && oldState.matchWholeWord === newState.matchWholeWord && oldState.useRegularExpression === newState.useRegularExpression && oldState.preserveCase === newState.preserveCase;
1010
1014
  };
1011
1015
 
1012
1016
  const isEqual$1 = (oldState, newState) => {
@@ -1046,11 +1050,26 @@ const SetCss = 'Viewlet.setCss';
1046
1050
  const SetFocusContext = 'Viewlet.setFocusContext';
1047
1051
  const SetValueByName = 'Viewlet.setValueByName';
1048
1052
 
1053
+ const FocusFindWidgetCloseButton$1 = 48;
1054
+ const FocusIgnoreFiles = 1012;
1055
+ const FocusSearchExcludeInput = 1008;
1056
+ const FocusSearchIncludeInput = 1007;
1057
+ const FocusSearchInput = 21;
1058
+ const FocusSearchMatchCase = 32;
1059
+ const FocusSearchOpenEditors = 1011;
1060
+ const FocusSearchPreserveCase = 36;
1061
+ const FocusSearchRegex = 33;
1062
+ const FocusSearchReplaceAll = 35;
1063
+ const FocusSearchReplaceInput = 31;
1064
+ const FocusSearchWholeWord = 34;
1065
+ const FocusToggleDetails = 1010;
1066
+ const FocusToggleReplace = 1020;
1067
+
1049
1068
  const isEqual = (oldState, newState) => {
1050
1069
  return newState.inputSource === User || oldState.value === newState.value;
1051
1070
  };
1052
1071
 
1053
- const modules = [isEqual$4, isEqual$2, isEqual$6, isEqual$1, isEqual$3, isEqual$3, isEqual, isEqual$5];
1072
+ const modules = [isEqual$5, isEqual$2, isEqual$7, isEqual$1, isEqual$3, isEqual$4, isEqual, isEqual$6];
1054
1073
  const numbers = [RenderEventListeners, RenderContent, RenderBounds, RenderUid, RenderFocusContext, RenderFocus, RenderValue, RenderCss];
1055
1074
 
1056
1075
  const diff = (oldState, newState) => {
@@ -1627,6 +1646,108 @@ const toggleReplace$1 = state => {
1627
1646
  };
1628
1647
  };
1629
1648
 
1649
+ const focusElement = (state, whenExpression) => {
1650
+ return {
1651
+ ...state,
1652
+ focus: whenExpression,
1653
+ focusSource: Script
1654
+ };
1655
+ };
1656
+
1657
+ const getNextFocus = (focus, replaceExpanded) => {
1658
+ switch (focus) {
1659
+ case FocusToggleReplace:
1660
+ return FocusSearchInput;
1661
+ case FocusSearchInput:
1662
+ if (replaceExpanded) {
1663
+ return FocusSearchReplaceInput;
1664
+ }
1665
+ return FocusSearchMatchCase;
1666
+ case FocusSearchMatchCase:
1667
+ return FocusSearchWholeWord;
1668
+ case FocusSearchWholeWord:
1669
+ return FocusSearchRegex;
1670
+ case FocusSearchRegex:
1671
+ if (replaceExpanded) {
1672
+ return FocusSearchPreserveCase;
1673
+ }
1674
+ return FocusFindWidgetCloseButton$1;
1675
+ case FocusSearchReplaceInput:
1676
+ return FocusSearchMatchCase;
1677
+ case FocusSearchPreserveCase:
1678
+ return FocusSearchReplaceAll;
1679
+ case FocusSearchReplaceAll:
1680
+ return FocusToggleDetails;
1681
+ case FocusSearchIncludeInput:
1682
+ return FocusSearchOpenEditors;
1683
+ case FocusSearchOpenEditors:
1684
+ return FocusSearchExcludeInput;
1685
+ case FocusSearchExcludeInput:
1686
+ return FocusIgnoreFiles;
1687
+ case FocusToggleDetails:
1688
+ return FocusSearchIncludeInput;
1689
+ default:
1690
+ return focus;
1691
+ }
1692
+ };
1693
+
1694
+ const focusNextElement = state => {
1695
+ const {
1696
+ focus,
1697
+ replaceExpanded
1698
+ } = state;
1699
+ const nextFocus = getNextFocus(focus, replaceExpanded);
1700
+ return focusElement(state, nextFocus);
1701
+ };
1702
+
1703
+ const getPreviousFocus = (focus, replaceExpanded) => {
1704
+ switch (focus) {
1705
+ case FocusSearchInput:
1706
+ return FocusToggleReplace;
1707
+ case FocusSearchMatchCase:
1708
+ if (replaceExpanded) {
1709
+ return FocusSearchReplaceInput;
1710
+ }
1711
+ return FocusSearchInput;
1712
+ case FocusSearchWholeWord:
1713
+ return FocusSearchMatchCase;
1714
+ case FocusSearchRegex:
1715
+ return FocusSearchWholeWord;
1716
+ case FocusSearchPreserveCase:
1717
+ return FocusSearchRegex;
1718
+ case FocusSearchReplaceInput:
1719
+ return FocusSearchInput;
1720
+ case FocusSearchReplaceAll:
1721
+ return FocusSearchPreserveCase;
1722
+ case FocusToggleDetails:
1723
+ if (replaceExpanded) {
1724
+ return FocusSearchReplaceAll;
1725
+ }
1726
+ return FocusSearchRegex;
1727
+ case FocusSearchOpenEditors:
1728
+ return FocusSearchIncludeInput;
1729
+ case FocusSearchExcludeInput:
1730
+ return FocusSearchOpenEditors;
1731
+ case FocusIgnoreFiles:
1732
+ return FocusSearchExcludeInput;
1733
+ case FocusSearchIncludeInput:
1734
+ return FocusToggleDetails;
1735
+ case FocusFindWidgetCloseButton$1:
1736
+ return FocusSearchRegex;
1737
+ default:
1738
+ return focus;
1739
+ }
1740
+ };
1741
+
1742
+ const focusPreviousElement = state => {
1743
+ const {
1744
+ focus,
1745
+ replaceExpanded
1746
+ } = state;
1747
+ const previousFocus = getPreviousFocus(focus, replaceExpanded);
1748
+ return focusElement(state, previousFocus);
1749
+ };
1750
+
1630
1751
  const handleReplaceInput = (state, value, inputSource = User) => {
1631
1752
  return {
1632
1753
  ...state,
@@ -1735,6 +1856,7 @@ const loadContent = async (state, savedState) => {
1735
1856
  const matchCount = getMatchCount(matches);
1736
1857
  return {
1737
1858
  ...state,
1859
+ focus: FocusSearchInput,
1738
1860
  focused: true,
1739
1861
  height,
1740
1862
  inputSource: Script,
@@ -2262,11 +2384,39 @@ const renderEventListeners = state => {
2262
2384
  return [SetEventListeners, uid, eventListeners];
2263
2385
  };
2264
2386
 
2387
+ const getFocusSelector = focusKey => {
2388
+ switch (focusKey) {
2389
+ case FocusSearchInput:
2390
+ return SearchValue;
2391
+ case FocusSearchReplaceInput:
2392
+ return ReplaceValue;
2393
+ case FocusSearchMatchCase:
2394
+ return MatchCase$2;
2395
+ case FocusSearchPreserveCase:
2396
+ return PreserveCase$1;
2397
+ case FocusSearchRegex:
2398
+ return UseRegularExpression$2;
2399
+ case FocusSearchWholeWord:
2400
+ return MatchWholeWord$2;
2401
+ case FocusSearchReplaceAll:
2402
+ return ReplaceAll$2;
2403
+ case FocusToggleReplace:
2404
+ return ToggleReplace$1;
2405
+ case FocusFindWidgetCloseButton$1:
2406
+ return Close$2;
2407
+ default:
2408
+ return '';
2409
+ }
2410
+ };
2411
+
2265
2412
  const renderFocus = (oldState, newState) => {
2266
2413
  const {
2267
- uid
2414
+ uid,
2415
+ focus
2268
2416
  } = newState;
2269
- return [/* method */FocusSelector, uid, `[name="search-value"]`];
2417
+ const name = getFocusSelector(focus);
2418
+ const selector = `[name="${name}"]`;
2419
+ return [FocusSelector, uid, selector];
2270
2420
  };
2271
2421
 
2272
2422
  const FocusFindWidget = 16;
@@ -2374,10 +2524,13 @@ const commandMap = {
2374
2524
  'FindWidget.dispose': dispose$1,
2375
2525
  'FindWidget.focusCloseButton': wrapCommand(focusCloseButton),
2376
2526
  'FindWidget.focusFirst': wrapCommand(focusFirst),
2527
+ 'FindWidget.focusElement': wrapCommand(focusElement),
2377
2528
  'FindWidget.focusIndex': wrapCommand(focusIndex),
2378
2529
  'FindWidget.focusLast': wrapCommand(focusLast),
2379
2530
  'FindWidget.focusNext': wrapCommand(focusNext),
2380
2531
  'FindWidget.focusPrevious': wrapCommand(focusPrevious),
2532
+ 'FindWidget.focusNextElement': wrapCommand(focusNextElement),
2533
+ 'FindWidget.focusPreviousElement': wrapCommand(focusPreviousElement),
2381
2534
  'FindWidget.focusReplace': wrapCommand(focusReplace),
2382
2535
  'FindWidget.focusReplaceAllButton': wrapCommand(focusReplaceAllButton),
2383
2536
  'FindWidget.getCommandIds': getCommandIds,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/find-widget-worker",
3
- "version": "1.20.0",
3
+ "version": "1.22.0",
4
4
  "description": "Web Worker for the find widget in Lvce Editor",
5
5
  "repository": {
6
6
  "type": "git",