@lvce-editor/menu-worker 4.1.0 → 4.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.
@@ -1875,12 +1875,12 @@ const getMenuEntries$c = platform => {
1875
1875
  label: openRecent()
1876
1876
  }, menuEntrySeparator, {
1877
1877
  command: 'Main.save',
1878
- flags: None,
1878
+ flags: Disabled,
1879
1879
  id: 'save',
1880
1880
  label: save()
1881
1881
  }, {
1882
1882
  command: 'Main.saveAll',
1883
- flags: None,
1883
+ flags: Disabled,
1884
1884
  id: 'saveAll',
1885
1885
  label: saveAll()
1886
1886
  }];
@@ -2273,6 +2273,7 @@ const Menu = 'Menu';
2273
2273
  const MenuItem = 'MenuItem';
2274
2274
  const MenuItemCheckMark = 'MenuItemCheckMark';
2275
2275
  const MenuItemCheckmarkIcon = 'MenuItemCheckmarkIcon';
2276
+ const MenuItemDisabled = 'MenuItemDisabled';
2276
2277
  const MenuItemFocused = 'MenuItemFocused';
2277
2278
  const MenuItemKeyBinding = 'MenuItemKeyBinding';
2278
2279
  const MenuItemSeparator = 'MenuItemSeparator';
@@ -2357,8 +2358,9 @@ const getMenuItemDefaultDom = menuItem => {
2357
2358
  };
2358
2359
 
2359
2360
  const disabled = {
2361
+ ariaDisabled: true,
2360
2362
  childCount: 1,
2361
- className: MenuItem,
2363
+ className: `${MenuItem} ${MenuItemDisabled}`,
2362
2364
  disabled: true,
2363
2365
  role: MenuItem$1,
2364
2366
  tabIndex: -1,
@@ -2562,6 +2564,7 @@ const show$2 = async (x, y, id, mouseBlocking = false, ...args) => {
2562
2564
  const items = await getMenuEntriesWithKeyBindings(id, ...args);
2563
2565
  const bounds = await getMenuBounds(x, y, items);
2564
2566
  const menu = addMenuInternal({
2567
+ args,
2565
2568
  focusedIndex: -1,
2566
2569
  id,
2567
2570
  items,
@@ -2577,10 +2580,12 @@ const show2$2 = async (uid, menuId, x, y, mouseBlocking = false, ...args) => {
2577
2580
  const items = await getMenuEntriesWithKeyBindings2(uid, menuId, ...args);
2578
2581
  const bounds = await getMenuBounds(x, y, items);
2579
2582
  const menu = addMenuInternal({
2583
+ args,
2580
2584
  focusedIndex: -1,
2581
2585
  id: menuId,
2582
2586
  items,
2583
2587
  level: getCount(),
2588
+ uid,
2584
2589
  x: bounds.x,
2585
2590
  y: bounds.y
2586
2591
  });
@@ -2906,19 +2911,28 @@ const resolveAfterTimeout = async () => {
2906
2911
  await promise;
2907
2912
  };
2908
2913
 
2914
+ const getSubMenuItems = async (parentMenu, item) => {
2915
+ const args = item.args || parentMenu.args || [];
2916
+ if (typeof parentMenu.uid === 'number') {
2917
+ return getMenuEntries2(parentMenu.uid, item.id, ...args);
2918
+ }
2919
+ return getMenuEntries$1(item.id, ...args);
2920
+ };
2909
2921
  const showSubMenuAtEnter = async (level, index, enterX, enterY) => {
2910
2922
  // TODO delete old menus
2911
2923
  set$1(getAll().slice(0, level + 1));
2912
2924
  const parentMenu = get$1(level);
2913
2925
  const item = parentMenu.items[index];
2914
- const subMenuItems = await getMenuEntries$1(item.id);
2926
+ const subMenuItems = await getSubMenuItems(parentMenu, item);
2915
2927
  const subMenu = addMenuInternal({
2928
+ args: item.args || parentMenu.args || [],
2916
2929
  enterX,
2917
2930
  enterY,
2918
2931
  focusedIndex: -1,
2919
2932
  id: item.id,
2920
2933
  items: subMenuItems,
2921
2934
  level: getCount(),
2935
+ uid: parentMenu.uid,
2922
2936
  x: parentMenu.x + MENU_WIDTH,
2923
2937
  y: parentMenu.y + index * 25
2924
2938
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/menu-worker",
3
- "version": "4.1.0",
3
+ "version": "4.3.0",
4
4
  "description": "Menu Worker",
5
5
  "repository": {
6
6
  "type": "git",