@lvce-editor/title-bar-worker 1.2.0 → 1.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.
- package/dist/titleBarWorkerMain.js +19 -12
- package/package.json +1 -1
|
@@ -1515,7 +1515,7 @@ const renderTitleBarEntries = {
|
|
|
1515
1515
|
apply(oldState, newState) {
|
|
1516
1516
|
const visibleEntries = getVisibleTitleBarEntries(newState.titleBarEntries, newState.width, newState.focusedIndex, newState.isMenuOpen);
|
|
1517
1517
|
const dom = getTitleBarMenuBarVirtualDom(visibleEntries);
|
|
1518
|
-
return ['Viewlet.setDom2', dom];
|
|
1518
|
+
return ['Viewlet.setDom2', newState.uid, dom];
|
|
1519
1519
|
}
|
|
1520
1520
|
};
|
|
1521
1521
|
const renderFocusedIndex = {
|
|
@@ -1523,7 +1523,7 @@ const renderFocusedIndex = {
|
|
|
1523
1523
|
return oldState.focusedIndex === newState.focusedIndex && oldState.isMenuOpen === newState.isMenuOpen;
|
|
1524
1524
|
},
|
|
1525
1525
|
apply(oldState, newState) {
|
|
1526
|
-
return [/* method */SetFocusedIndex, /* oldFocusedIndex */oldState.focusedIndex, /* newfocusedIndex */newState.focusedIndex, /* oldIsMenuOpen */oldState.isMenuOpen, /* newIsMenuOpen */newState.isMenuOpen];
|
|
1526
|
+
return ['Viewlet.send', newState.uid, /* method */SetFocusedIndex, /* oldFocusedIndex */oldState.focusedIndex, /* newfocusedIndex */newState.focusedIndex, /* oldIsMenuOpen */oldState.isMenuOpen, /* newIsMenuOpen */newState.isMenuOpen];
|
|
1527
1527
|
}
|
|
1528
1528
|
};
|
|
1529
1529
|
const renderMenus = {
|
|
@@ -1555,7 +1555,7 @@ const renderMenus = {
|
|
|
1555
1555
|
} else if (difference < 0) {
|
|
1556
1556
|
changes.push(['closeMenus', newLength]);
|
|
1557
1557
|
}
|
|
1558
|
-
return [/* method */SetMenus, /* changes */changes, newState.uid];
|
|
1558
|
+
return ['Viewlet.send', newState.uid, /* method */SetMenus, /* changes */changes, newState.uid];
|
|
1559
1559
|
}
|
|
1560
1560
|
};
|
|
1561
1561
|
const render = [renderTitleBarEntries, renderFocusedIndex, renderMenus];
|
|
@@ -2248,9 +2248,17 @@ const menus = [MenuEntriesEdit, MenuEntriesFile, MenuEntriesGo, MenuEntriesHelp,
|
|
|
2248
2248
|
const getMenus = () => {
|
|
2249
2249
|
return menus;
|
|
2250
2250
|
};
|
|
2251
|
+
const getModule = id => {
|
|
2252
|
+
for (const module of menus) {
|
|
2253
|
+
if (module.id === id) {
|
|
2254
|
+
return module;
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
return undefined;
|
|
2258
|
+
};
|
|
2251
2259
|
const getMenuEntries = async (id, ...args) => {
|
|
2252
2260
|
try {
|
|
2253
|
-
const module =
|
|
2261
|
+
const module = getModule(id);
|
|
2254
2262
|
// @ts-ignore
|
|
2255
2263
|
const inject = module.inject || [];
|
|
2256
2264
|
// @ts-ignore
|
|
@@ -2751,17 +2759,16 @@ const handleKeySpaceMenuOpen = state => {
|
|
|
2751
2759
|
const handleKeySpace = ifElse(handleKeySpaceMenuOpen, handleKeySpaceMenuClosed);
|
|
2752
2760
|
|
|
2753
2761
|
const executeMenuItemCommand = async item => {
|
|
2754
|
-
|
|
2755
|
-
throw new Error('not implemented');
|
|
2762
|
+
await invoke(item.command, ...(item.args || []));
|
|
2756
2763
|
};
|
|
2757
2764
|
|
|
2758
2765
|
const selectIndexIgnore = async (state, item) => {
|
|
2759
|
-
await executeMenuItemCommand();
|
|
2766
|
+
await executeMenuItemCommand(item);
|
|
2760
2767
|
return state;
|
|
2761
2768
|
};
|
|
2762
2769
|
|
|
2763
2770
|
const selectIndexNone = async (state, item) => {
|
|
2764
|
-
await executeMenuItemCommand();
|
|
2771
|
+
await executeMenuItemCommand(item);
|
|
2765
2772
|
return {
|
|
2766
2773
|
...state,
|
|
2767
2774
|
menus: [],
|
|
@@ -2770,7 +2777,7 @@ const selectIndexNone = async (state, item) => {
|
|
|
2770
2777
|
};
|
|
2771
2778
|
|
|
2772
2779
|
const selectIndexRestoreFocus = async (state, item) => {
|
|
2773
|
-
await executeMenuItemCommand();
|
|
2780
|
+
await executeMenuItemCommand(item);
|
|
2774
2781
|
return {
|
|
2775
2782
|
...state,
|
|
2776
2783
|
menus: [],
|
|
@@ -2816,13 +2823,13 @@ const handleMenuClick = (state, level, index) => {
|
|
|
2816
2823
|
const item = menu.items[index];
|
|
2817
2824
|
switch (item.flags) {
|
|
2818
2825
|
case None:
|
|
2819
|
-
return selectIndexNone(state);
|
|
2826
|
+
return selectIndexNone(state, item);
|
|
2820
2827
|
case SubMenu:
|
|
2821
2828
|
return selectIndexSubMenu(state, menu, index);
|
|
2822
2829
|
case RestoreFocus:
|
|
2823
|
-
return selectIndexRestoreFocus(state);
|
|
2830
|
+
return selectIndexRestoreFocus(state, item);
|
|
2824
2831
|
case Ignore:
|
|
2825
|
-
return selectIndexIgnore(state);
|
|
2832
|
+
return selectIndexIgnore(state, item);
|
|
2826
2833
|
default:
|
|
2827
2834
|
return state;
|
|
2828
2835
|
}
|