@lvce-editor/title-bar-worker 2.20.0 → 2.21.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.
@@ -1259,6 +1259,7 @@ const Img = 17;
1259
1259
  const Button = 'event.button';
1260
1260
  const ClientX = 'event.clientX';
1261
1261
  const ClientY = 'event.clientY';
1262
+ const TargetName = 'event.target.name';
1262
1263
 
1263
1264
  const Backspace$1 = 1;
1264
1265
  const Tab$1 = 2;
@@ -2815,14 +2816,11 @@ const handleMouseOverMenuOpen = async (state, index) => {
2815
2816
 
2816
2817
  const handleMouseOver = ifElse(handleMouseOverMenuOpen, handleMouseOverMenuClosed);
2817
2818
 
2818
- const handlePointerOver = (state, clientX, clientY) => {
2819
+ const handlePointerOver = (state, name) => {
2819
2820
  const {
2820
- titleBarEntries,
2821
- x,
2822
- iconWidth
2821
+ titleBarEntries
2823
2822
  } = state;
2824
- const menuOffset = getMenuOffset(x, clientX, iconWidth);
2825
- const index = getTitleBarIndexFromPosition(titleBarEntries, menuOffset);
2823
+ const index = titleBarEntries.findIndex(item => item.label === name);
2826
2824
  if (index === -1) {
2827
2825
  return state;
2828
2826
  }
@@ -2886,7 +2884,10 @@ const getTitle = workspaceUri => {
2886
2884
  return '';
2887
2885
  }
2888
2886
  const slashIndex = workspaceUri.lastIndexOf('/');
2889
- const baseName = workspaceUri.slice(slashIndex);
2887
+ if (slashIndex === -1) {
2888
+ return '';
2889
+ }
2890
+ const baseName = workspaceUri.slice(slashIndex + 1);
2890
2891
  return baseName;
2891
2892
  };
2892
2893
 
@@ -3251,13 +3252,14 @@ const getItemVirtualDom = item => {
3251
3252
  // TODO avoid mutation
3252
3253
  const dom = [];
3253
3254
  dom.push({
3254
- type: Div,
3255
+ type: Button$1,
3255
3256
  className: TitleBarTopLevelEntry,
3256
3257
  ariaHasPopup: true,
3257
3258
  ariaExpanded: isOpen,
3258
3259
  role: MenuItem$1,
3259
3260
  childCount: 1,
3260
- ariaKeyShortcuts: keyboardShortCut
3261
+ ariaKeyShortcuts: keyboardShortCut,
3262
+ name: label // TODO have separate name attribute
3261
3263
  });
3262
3264
  if (isOpen) {
3263
3265
  // @ts-ignore
@@ -3457,7 +3459,7 @@ const renderEventListeners = () => {
3457
3459
  params: ['handlePointerOut', ClientX, ClientY]
3458
3460
  }, {
3459
3461
  name: HandlePointerOver,
3460
- params: ['handlePointerOver', ClientX, ClientY]
3462
+ params: ['handlePointerOver', TargetName]
3461
3463
  }, {
3462
3464
  name: HandleFocusOut,
3463
3465
  params: ['handleFocusOut', ClientX, ClientY] // TODO maybe check relatedTarget
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "2.20.0",
3
+ "version": "2.21.0",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",