@lvce-editor/title-bar-worker 1.8.0 → 1.9.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.
@@ -997,7 +997,8 @@ const getTitleBarMenuBarItemsVirtualDom = visibleItems => {
997
997
  return dom;
998
998
  };
999
999
 
1000
- const getTitleBarMenuBarVirtualDom = visibleItems => {
1000
+ const activeId = 'TitleBarEntryActive';
1001
+ const getTitleBarMenuBarVirtualDom = (visibleItems, focusedIndex) => {
1001
1002
  return [{
1002
1003
  type: Div,
1003
1004
  className: 'Viewlet TitleBarMenuBar',
@@ -1008,7 +1009,8 @@ const getTitleBarMenuBarVirtualDom = visibleItems => {
1008
1009
  onFocusOut: HandleFocusOut,
1009
1010
  onFocusIn: HandleFocusIn,
1010
1011
  onPointerOver: HandlePointerOver,
1011
- onPointerOut: HandlePointerOut
1012
+ onPointerOut: HandlePointerOut,
1013
+ ariaActivedescendant: focusedIndex === -1 ? '' : activeId
1012
1014
  }, ...getTitleBarMenuBarItemsVirtualDom(visibleItems)];
1013
1015
  };
1014
1016
 
@@ -1088,7 +1090,7 @@ const getVisibleTitleBarEntries = (entries, width, focusedIndex, isMenuOpen) =>
1088
1090
 
1089
1091
  const renderEntries = (oldState, newState) => {
1090
1092
  const visibleEntries = getVisibleTitleBarEntries(newState.titleBarEntries, newState.width, newState.focusedIndex, newState.isMenuOpen);
1091
- const dom = getTitleBarMenuBarVirtualDom(visibleEntries);
1093
+ const dom = getTitleBarMenuBarVirtualDom(visibleEntries, newState.focusedIndex);
1092
1094
  return ['Viewlet.setDom2', newState.uid, dom];
1093
1095
  };
1094
1096
 
@@ -2693,7 +2695,7 @@ const renderEventListeners = () => {
2693
2695
  params: ['handleClickToggleMaximize']
2694
2696
  }, {
2695
2697
  name: HandleFocusIn,
2696
- params: ['handlefocus']
2698
+ params: ['handleFocus']
2697
2699
  }, {
2698
2700
  name: HandleMenuClick,
2699
2701
  params: ['handleMenuClick', 'event.clientX', 'event.clientY']
@@ -2702,7 +2704,7 @@ const renderEventListeners = () => {
2702
2704
  params: ['handleMenuMouseOver', 'event.clientX', 'event.clientY']
2703
2705
  }, {
2704
2706
  name: HandleClick,
2705
- params: ['handleClick', 'event.button', 'event.clientX', 'event.clientY']
2707
+ params: ['handleClickAt', 'event.button', 'event.clientX', 'event.clientY']
2706
2708
  }, {
2707
2709
  name: HandlePointerOut,
2708
2710
  params: ['handlePointerOut', 'event.clientX', 'event.clientY']
@@ -2834,6 +2836,14 @@ const handleClick = async (state, button, index) => {
2834
2836
  return toggleIndex(state, index);
2835
2837
  };
2836
2838
 
2839
+ const handleClickAt = async (state, button, x, y) => {
2840
+ const index = getTitleBarIndexFromPosition(state.titleBarEntries, x - state.x);
2841
+ if (index === -1) {
2842
+ return state;
2843
+ }
2844
+ return handleClick(state, button, index);
2845
+ };
2846
+
2837
2847
  // TODO remove this file and merge with whenExpressions
2838
2848
  const TitleBarMenuBar = FocusTitleBarMenuBar;
2839
2849
 
@@ -3248,6 +3258,7 @@ const commandMap = {
3248
3258
  'TitleBarMenuBar.handleKeyArrowLeft': wrapCommand(handleKeyArrowLeft),
3249
3259
  'TitleBarMenuBar.handleKeyArrowRight': wrapCommand(handleKeyArrowRight),
3250
3260
  'TitleBarMenuBar.handleKeyArrowUp': wrapCommand(handleKeyArrowUp),
3261
+ 'TitleBarMenuBar.handleClickAt': wrapCommand(handleClickAt),
3251
3262
  'TitleBarMenuBar.handlePointerOver': wrapCommand(handlePointerOver),
3252
3263
  'TitleBarMenuBar.handleKeyEnd': wrapCommand(handleKeyEnd),
3253
3264
  'TitleBarMenuBar.handleKeyEnter': wrapCommand(handleKeyEnter),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",