@lvce-editor/title-bar-worker 1.9.0 → 1.10.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.
@@ -913,6 +913,34 @@ const diff = (oldState, newState) => {
913
913
  return diffResult;
914
914
  };
915
915
 
916
+ const create$1 = () => {
917
+ const states = Object.create(null);
918
+ return {
919
+ get(uid) {
920
+ return states[uid];
921
+ },
922
+ set(uid, oldState, newState) {
923
+ states[uid] = {
924
+ oldState,
925
+ newState
926
+ };
927
+ }
928
+ };
929
+ };
930
+
931
+ const {
932
+ get,
933
+ set
934
+ } = create$1();
935
+
936
+ const diff2 = uid => {
937
+ const {
938
+ oldState,
939
+ newState
940
+ } = get(uid);
941
+ return diff(oldState, newState);
942
+ };
943
+
916
944
  const Menu$1 = 'menu';
917
945
  const MenuBar = 'menubar';
918
946
  const MenuItem$1 = 'menuitem';
@@ -1630,26 +1658,6 @@ const applyRender = (oldState, newState, diffResult) => {
1630
1658
  return commands;
1631
1659
  };
1632
1660
 
1633
- const create$1 = () => {
1634
- const states = Object.create(null);
1635
- return {
1636
- get(uid) {
1637
- return states[uid];
1638
- },
1639
- set(uid, oldState, newState) {
1640
- states[uid] = {
1641
- oldState,
1642
- newState
1643
- };
1644
- }
1645
- };
1646
- };
1647
-
1648
- const {
1649
- get,
1650
- set
1651
- } = create$1();
1652
-
1653
1661
  const doRender = async uid => {
1654
1662
  const {
1655
1663
  oldState,
@@ -2683,6 +2691,15 @@ const loadContent = async (state, titleBarEntries) => {
2683
2691
  };
2684
2692
  };
2685
2693
 
2694
+ const render2 = async (uid, diffResult) => {
2695
+ const {
2696
+ oldState,
2697
+ newState
2698
+ } = get(uid);
2699
+ const commands = applyRender(oldState, newState, diffResult);
2700
+ return commands;
2701
+ };
2702
+
2686
2703
  const renderEventListeners = () => {
2687
2704
  return [{
2688
2705
  name: HandleClickMinimize,
@@ -3242,6 +3259,8 @@ const commandMap = {
3242
3259
  'TitleBarMenuBar.closeMenu': closeMenu,
3243
3260
  'TitleBarMenuBar.create': create,
3244
3261
  'TitleBarMenuBar.focus': wrapCommand(focus),
3262
+ 'TitleBarMenuBar.diff2': diff2,
3263
+ 'TitleBarMenuBar.render2': render2,
3245
3264
  'TitleBarMenuBar.focusFirst': wrapCommand(focusFirst),
3246
3265
  'TitleBarMenuBar.focusIndex': wrapCommand(focusLast),
3247
3266
  'TitleBarMenuBar.focusLast': wrapCommand(focusIndex),
@@ -3250,7 +3269,6 @@ const commandMap = {
3250
3269
  'TitleBarMenuBar.getCommands': getCommandIds,
3251
3270
  'TitleBarMenuBar.getKeyBindings': getKeyBindings,
3252
3271
  'TitleBarMenuBar.getMenus': getMenus,
3253
- 'TitleBarMenuBar.diff': diff,
3254
3272
  'TitleBarMenuBar.getVirtualDom': getTitleBarMenuBarVirtualDom,
3255
3273
  'TitleBarMenuBar.handleClick': wrapCommand(handleClick),
3256
3274
  'TitleBarMenuBar.handleFocus': wrapCommand(handleFocus),
@@ -3271,11 +3289,13 @@ const commandMap = {
3271
3289
  'TitleBarMenuBar.handleMouseOut': wrapCommand(handleMouseOut),
3272
3290
  'TitleBarMenuBar.handleMouseOver': wrapCommand(handleMouseOver),
3273
3291
  'TitleBarMenuBar.loadContent': wrapCommand(loadContent),
3274
- 'TitleBarMenuBar.render': doRender,
3275
3292
  'TitleBarMenuBar.saveState': saveState,
3276
3293
  'TitleBarMenuBar.terminate': terminate,
3277
3294
  'TitleBarMenuBar.toggleIndex': wrapCommand(toggleIndex),
3278
- 'TitleBarMenuBar.toggleMenu': wrapCommand(toggleMenu)
3295
+ 'TitleBarMenuBar.toggleMenu': wrapCommand(toggleMenu),
3296
+ // deprecated
3297
+ 'TitleBarMenuBar.diff': diff,
3298
+ 'TitleBarMenuBar.render': doRender
3279
3299
  };
3280
3300
 
3281
3301
  const listen = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",