@lvce-editor/title-bar-worker 3.2.0 → 3.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.
@@ -1774,12 +1774,12 @@ const menuEntrySeparator = {
1774
1774
  const getMenuEntries$c = () => {
1775
1775
  return [{
1776
1776
  command: /* TODO */'-1',
1777
- flags: Disabled,
1777
+ flags: None,
1778
1778
  id: 'undo',
1779
1779
  label: undo()
1780
1780
  }, {
1781
1781
  command: /* TODO */'-1',
1782
- flags: Disabled,
1782
+ flags: None,
1783
1783
  id: 'redo',
1784
1784
  label: redo()
1785
1785
  }, menuEntrySeparator, {
@@ -2056,47 +2056,47 @@ const getMenuEntries$6 = () => {
2056
2056
  label: copyLineDown()
2057
2057
  }, {
2058
2058
  command: 'Editor.moveLineUp',
2059
- flags: Disabled,
2059
+ flags: None,
2060
2060
  id: 'moveLineUp',
2061
2061
  label: moveLineUp()
2062
2062
  }, {
2063
2063
  command: 'Editor.moveLineDown',
2064
- flags: Disabled,
2064
+ flags: None,
2065
2065
  id: 'moveLineDown',
2066
2066
  label: moveLineDown()
2067
2067
  }, {
2068
2068
  command: 'Editor.duplicateSelection',
2069
- flags: Disabled,
2069
+ flags: None,
2070
2070
  id: 'duplicateSelection',
2071
2071
  label: duplicateSelection()
2072
2072
  }, menuEntrySeparator, {
2073
2073
  command: 'Editor.addCursorAbove',
2074
- flags: Disabled,
2074
+ flags: None,
2075
2075
  id: 'addCursorAbove',
2076
2076
  label: addCursorAbove()
2077
2077
  }, {
2078
2078
  command: 'Editor.addCursorBelow',
2079
- flags: Disabled,
2079
+ flags: None,
2080
2080
  id: 'addCursorBelow',
2081
2081
  label: addCursorBelow()
2082
2082
  }, {
2083
2083
  command: 'Editor.addCursorsToLineEnds',
2084
- flags: Disabled,
2084
+ flags: None,
2085
2085
  id: 'addCursorsToLineEnds',
2086
2086
  label: addCursorsToLineEnds()
2087
2087
  }, {
2088
2088
  command: 'Editor.addNextOccurrence',
2089
- flags: Disabled,
2089
+ flags: None,
2090
2090
  id: 'addNextOccurrence',
2091
2091
  label: addNextOccurrence()
2092
2092
  }, {
2093
2093
  command: 'Editor.addPreviousOccurrence',
2094
- flags: Disabled,
2094
+ flags: None,
2095
2095
  id: 'addPreviousOccurrence',
2096
2096
  label: addPreviousOccurrence()
2097
2097
  }, {
2098
2098
  command: 'Editor.selectAllOccurrences',
2099
- flags: Disabled,
2099
+ flags: None,
2100
2100
  id: 'selectAllOccurrences',
2101
2101
  label: selectAllOccurrences()
2102
2102
  }];
@@ -2876,7 +2876,8 @@ const renderMenus = (oldState, newState) => {
2876
2876
  const oldMenu = oldMenus[i];
2877
2877
  const newMenu = newMenus[i];
2878
2878
  if (oldMenu !== newMenu) {
2879
- const visible = getVisible(newMenu.items, newMenu.focusedIndex, newMenu.expanded, newMenu.level);
2879
+ const expanded = newMenu.expanded ?? false;
2880
+ const visible = getVisible(newMenu.items, newMenu.focusedIndex, expanded, newMenu.level);
2880
2881
  const dom = getMenuVirtualDom(visible).slice(1);
2881
2882
  changes.push([/* method */'updateMenu', newMenu, /* newLength */newLength, dom]);
2882
2883
  }
@@ -2884,9 +2885,12 @@ const renderMenus = (oldState, newState) => {
2884
2885
  const difference = newLength - oldLength;
2885
2886
  if (difference > 0) {
2886
2887
  const newMenu = newMenus.at(-1);
2887
- const visible = getVisible(newMenu.items, newMenu.focusedIndex, newMenu.expanded, newMenu.level);
2888
- const dom = getMenuVirtualDom(visible).slice(1);
2889
- changes.push(['addMenu', newMenu, dom]);
2888
+ if (newMenu) {
2889
+ const expanded = newMenu.expanded ?? false;
2890
+ const visible = getVisible(newMenu.items, newMenu.focusedIndex, expanded, newMenu.level);
2891
+ const dom = getMenuVirtualDom(visible).slice(1);
2892
+ changes.push(['addMenu', newMenu, dom]);
2893
+ }
2890
2894
  } else if (difference < 0) {
2891
2895
  changes.push(['closeMenus', newLength]);
2892
2896
  }
@@ -3490,7 +3494,7 @@ const handleKeyArrowRightMenuOpen = async state => {
3490
3494
  return focusNext(state);
3491
3495
  }
3492
3496
  const item = items[focusedIndex];
3493
- if (item.flags === SubMenu) {
3497
+ if (item.flags === SubMenu && item.id !== undefined) {
3494
3498
  const subMenuEntries = await getMenuEntries(item.id);
3495
3499
  const subMenu = {
3496
3500
  focusedIndex: 0,
@@ -3523,6 +3527,9 @@ const handleKeyArrowUpMenuOpen = state => {
3523
3527
  menus
3524
3528
  } = state;
3525
3529
  const menu = menus.at(-1);
3530
+ if (!menu) {
3531
+ return state;
3532
+ }
3526
3533
  const previousIndex = getIndexToFocusPrevious(menu);
3527
3534
  const newMenus = [...menus.slice(0, -1), {
3528
3535
  ...menu,
@@ -3649,6 +3656,9 @@ const selectIndexSubMenu = async (state, menu, index) => {
3649
3656
  y
3650
3657
  } = menu;
3651
3658
  const item = items[index];
3659
+ if (!item.id) {
3660
+ return state;
3661
+ }
3652
3662
  const subMenuEntries = await getMenuEntries(item.id);
3653
3663
  const subMenu = {
3654
3664
  focusedIndex: -1,
@@ -3729,6 +3739,9 @@ const getNewMenus = async (menus, level, index, flags) => {
3729
3739
  }
3730
3740
  if (item.flags === SubMenu) {
3731
3741
  const item = items[index];
3742
+ if (!item.id) {
3743
+ return menus;
3744
+ }
3732
3745
  const subMenuEntries = await getMenuEntries(item.id);
3733
3746
  const subMenu = {
3734
3747
  focusedIndex: -1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",