@lvce-editor/about-view 5.2.0 → 5.3.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.
@@ -832,6 +832,23 @@ const create$1 = () => {
832
832
  for (const key of Object.keys(states)) {
833
833
  delete states[key];
834
834
  }
835
+ },
836
+ wrapCommand(fn) {
837
+ const wrapped = async (uid, ...args) => {
838
+ const {
839
+ newState
840
+ } = states[uid];
841
+ const newerState = await fn(newState, ...args);
842
+ if (newState === newerState) {
843
+ return;
844
+ }
845
+ const latest = states[uid];
846
+ states[uid] = {
847
+ oldState: latest.oldState,
848
+ newState: newerState
849
+ };
850
+ };
851
+ return wrapped;
835
852
  }
836
853
  };
837
854
  };
@@ -839,7 +856,9 @@ const create$1 = () => {
839
856
  const {
840
857
  get: get$1,
841
858
  set: set$1,
842
- dispose: dispose$1} = create$1();
859
+ dispose: dispose$1,
860
+ wrapCommand
861
+ } = create$1();
843
862
 
844
863
  const create = uid => {
845
864
  const state = {
@@ -943,7 +962,8 @@ const focusPrevious = state => {
943
962
  };
944
963
  };
945
964
 
946
- const commandIds = ['handleClickClose', 'handleClickOk', 'handleClickCopy', 'handleFocusIn', 'focusNext', 'focusPrevious'];
965
+ const commandIds = ['dispose', 'handleClickClose', 'handleClickOk', 'handleClickCopy', 'handleFocusIn', 'focusNext', 'focusPrevious'];
966
+
947
967
  const getCommandIds = () => {
948
968
  return commandIds;
949
969
  };
@@ -1734,21 +1754,6 @@ const showAbout = async platform => {
1734
1754
  await fn();
1735
1755
  };
1736
1756
 
1737
- const wrapCommand = fn => {
1738
- const wrapped = async (uid, ...args) => {
1739
- const {
1740
- newState
1741
- } = get$1(uid);
1742
- const newerState = await fn(newState, ...args);
1743
- if (newState === newerState) {
1744
- return;
1745
- }
1746
- const latest = get$1(uid);
1747
- set$1(uid, latest.oldState, newerState);
1748
- };
1749
- return wrapped;
1750
- };
1751
-
1752
1757
  const commandMap = {
1753
1758
  'About.create': create,
1754
1759
  'About.diff2': diff2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/about-view",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "description": "About View Worker",
5
5
  "keywords": [
6
6
  "about-view"