@lvce-editor/extension-search-view 7.20.4 → 7.21.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.
@@ -2904,6 +2904,10 @@ const getActions = () => {
2904
2904
  }];
2905
2905
  };
2906
2906
 
2907
+ const getComponentState = uid => {
2908
+ return get(uid).newState;
2909
+ };
2910
+
2907
2911
  const Tab = 2;
2908
2912
  const Enter = 3;
2909
2913
  const Escape = 8;
@@ -5291,6 +5295,23 @@ const selectPreviousCompletion = state => {
5291
5295
  };
5292
5296
  };
5293
5297
 
5298
+ const applyComponentState = (currentState, state) => {
5299
+ if (!state || typeof state !== 'object' || Array.isArray(state)) {
5300
+ throw new TypeError('Extension Search state must be an object');
5301
+ }
5302
+ const {
5303
+ uid
5304
+ } = state;
5305
+ const {
5306
+ uid: currentUid
5307
+ } = currentState;
5308
+ if (uid !== currentUid) {
5309
+ throw new Error(`Extension Search state uid must remain ${currentUid}`);
5310
+ }
5311
+ return state;
5312
+ };
5313
+ const setComponentState = wrapCommand(applyComponentState);
5314
+
5294
5315
  const toggleSuggest = state => {
5295
5316
  return state.suggestOpen ? closeSuggest(state) : openSuggest(state);
5296
5317
  };
@@ -5332,6 +5353,7 @@ const commandMap = {
5332
5353
  'SearchExtensions.focusPreviousPage': wrapCommand(focusPreviousPage),
5333
5354
  'SearchExtensions.getActions': getActions,
5334
5355
  'SearchExtensions.getCommandIds': getCommandIds,
5356
+ 'SearchExtensions.getComponentState': getComponentState,
5335
5357
  'SearchExtensions.getKeyBindings': getKeyBindings,
5336
5358
  'SearchExtensions.getMenuEntries': getMenuEntriesList,
5337
5359
  'SearchExtensions.getMenuEntries2': wrapGetter(getMenuEntries2),
@@ -5377,6 +5399,7 @@ const commandMap = {
5377
5399
  'SearchExtensions.selectIndex': wrapCommand(selectIndex),
5378
5400
  'SearchExtensions.selectNextCompletion': wrapCommand(selectNextCompletion),
5379
5401
  'SearchExtensions.selectPreviousCompletion': wrapCommand(selectPreviousCompletion),
5402
+ 'SearchExtensions.setComponentState': setComponentState,
5380
5403
  'SearchExtensions.setDeltaY': wrapCommand(setDeltaY),
5381
5404
  'SearchExtensions.setExtensionStatus': wrapCommand(setExtensionStatus),
5382
5405
  'SearchExtensions.terminate': terminate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-search-view",
3
- "version": "7.20.4",
3
+ "version": "7.21.0",
4
4
  "description": "Extension Search View Worker",
5
5
  "repository": {
6
6
  "type": "git",