@lvce-editor/text-search-worker 4.6.0 → 4.7.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.
@@ -1172,13 +1172,37 @@ const create$2 = () => {
1172
1172
  return Object.keys(states).map(key => {
1173
1173
  return Number.parseInt(key);
1174
1174
  });
1175
+ },
1176
+ clear() {
1177
+ for (const key of Object.keys(states)) {
1178
+ delete states[key];
1179
+ }
1180
+ },
1181
+ wrapCommand(fn) {
1182
+ const wrapped = async (uid, ...args) => {
1183
+ const {
1184
+ newState
1185
+ } = states[uid];
1186
+ const newerState = await fn(newState, ...args);
1187
+ if (newState === newerState) {
1188
+ return;
1189
+ }
1190
+ const latest = states[uid];
1191
+ states[uid] = {
1192
+ oldState: latest.oldState,
1193
+ newState: newerState
1194
+ };
1195
+ };
1196
+ return wrapped;
1175
1197
  }
1176
1198
  };
1177
1199
  };
1178
1200
 
1179
1201
  const {
1180
1202
  get,
1181
- set} = create$2();
1203
+ set,
1204
+ wrapCommand
1205
+ } = create$2();
1182
1206
 
1183
1207
  const create$1 = ({
1184
1208
  itemHeight,
@@ -1782,7 +1806,7 @@ const focusSearchValueNext = state => {
1782
1806
  return focusMatchCase$1(state);
1783
1807
  };
1784
1808
 
1785
- const commandIds = ['clearSearchResults', 'collapseAll', 'collapseDetails', 'copy', 'dismissItem', 'expandDetails', 'focusFirst', 'focusIndex', 'focusLast', 'focusMatchCase', 'focusMatchCasePrevious', 'focusMatchWholeWord', 'focusNext', 'focusNextInput', 'focusNextPage', 'focusPreserveCasePrevious', 'focusPrevious', 'focusPreviousInput', 'focusPreviousPage', 'focusRegex', 'focusRegexNext', 'focusReplaceAll', 'focusReplaceValue', 'focusReplaceValueNext', 'focusReplaceValuePrevious', 'focusSearchValue', 'focusSearchValueNext', 'handleClick', 'handleClickAt', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleContextMenuMouseAt', 'handleExcludeInput', 'handleFocusIn', 'handleHeaderClick', 'handleHeaderFocusIn', 'handleHeaderFocusOut', 'handleIconThemeChange', 'handleIconThemeChange', 'handleIncludeInput', 'handleInput', 'handleInput2', 'handleListBlur', 'handleListFocus', 'handleReplaceInput', 'handleScrollBarCaptureLost', 'handleScrollBarClick', 'handleScrollBarMove', 'handleScrollBarThumbPointerMove', 'handleTouchEnd', 'handleTouchMove', 'handleTouchStart', 'handleUpdate', 'handleWheel', 'nextHistoryResult', 'previousHistoryResult', 'refresh', 'replaceAll', 'scrollDown', 'selectIndex', 'submit', 'toggleMatchCase', 'toggleMatchWholeWord', 'togglePreserveCase', 'toggleReplace', 'toggleSearchDetails', 'toggleUseRegularExpression', 'viewAsTree'];
1809
+ const commandIds = ['clearSearchResults', 'collapseAll', 'collapseDetails', 'copy', 'dismissItem', 'dispose', 'expandDetails', 'focusFirst', 'focusIndex', 'focusLast', 'focusMatchCase', 'focusMatchCasePrevious', 'focusMatchWholeWord', 'focusNext', 'focusNextInput', 'focusNextPage', 'focusPreserveCasePrevious', 'focusPrevious', 'focusPreviousInput', 'focusPreviousPage', 'focusRegex', 'focusRegexNext', 'focusReplaceAll', 'focusReplaceValue', 'focusReplaceValueNext', 'focusReplaceValuePrevious', 'focusSearchValue', 'focusSearchValueNext', 'handleClick', 'handleClickAt', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleContextMenuMouseAt', 'handleExcludeInput', 'handleFocusIn', 'handleHeaderClick', 'handleHeaderFocusIn', 'handleHeaderFocusOut', 'handleIconThemeChange', 'handleIconThemeChange', 'handleIncludeInput', 'handleInput', 'handleInput2', 'handleListBlur', 'handleListFocus', 'handleReplaceInput', 'handleScrollBarCaptureLost', 'handleScrollBarClick', 'handleScrollBarMove', 'handleScrollBarThumbPointerMove', 'handleTouchEnd', 'handleTouchMove', 'handleTouchStart', 'handleUpdate', 'handleWheel', 'nextHistoryResult', 'previousHistoryResult', 'refresh', 'replaceAll', 'scrollDown', 'selectIndex', 'submit', 'toggleMatchCase', 'toggleMatchWholeWord', 'togglePreserveCase', 'toggleReplace', 'toggleSearchDetails', 'toggleUseRegularExpression', 'viewAsTree'];
1786
1810
 
1787
1811
  const getCommandIds = () => {
1788
1812
  return commandIds;
@@ -4578,21 +4602,6 @@ const handleContextMenu = async (state, button, x, y) => {
4578
4602
  return newState;
4579
4603
  };
4580
4604
 
4581
- const wrapCommand = fn => {
4582
- const wrapped = async (uid, ...args) => {
4583
- const {
4584
- newState
4585
- } = get(uid);
4586
- const newerState = await fn(newState, ...args);
4587
- if (newState === newerState) {
4588
- return;
4589
- }
4590
- const latest = get(uid);
4591
- set(uid, latest.oldState, newerState);
4592
- };
4593
- return wrapped;
4594
- };
4595
-
4596
4605
  const commandMap = {
4597
4606
  'TextSearch.clearSearchResults': wrapCommand(clearSearchResults$1),
4598
4607
  'TextSearch.collapseDetails': wrapCommand(collapseDetails),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-worker",
3
- "version": "4.6.0",
3
+ "version": "4.7.0",
4
4
  "description": "Text Search Worker",
5
5
  "keywords": [
6
6
  "text-search"