@lvce-editor/title-bar-worker 2.19.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
 
@@ -2911,6 +2912,7 @@ const loadContent2 = async state => {
2911
2912
  return {
2912
2913
  ...state,
2913
2914
  titleBarEntries: withWidths,
2915
+ titleBarButtons: buttons,
2914
2916
  buttons,
2915
2917
  title,
2916
2918
  iconWidth
@@ -3250,13 +3252,14 @@ const getItemVirtualDom = item => {
3250
3252
  // TODO avoid mutation
3251
3253
  const dom = [];
3252
3254
  dom.push({
3253
- type: Div,
3255
+ type: Button$1,
3254
3256
  className: TitleBarTopLevelEntry,
3255
3257
  ariaHasPopup: true,
3256
3258
  ariaExpanded: isOpen,
3257
3259
  role: MenuItem$1,
3258
3260
  childCount: 1,
3259
- ariaKeyShortcuts: keyboardShortCut
3261
+ ariaKeyShortcuts: keyboardShortCut,
3262
+ name: label // TODO have separate name attribute
3260
3263
  });
3261
3264
  if (isOpen) {
3262
3265
  // @ts-ignore
@@ -3456,7 +3459,7 @@ const renderEventListeners = () => {
3456
3459
  params: ['handlePointerOut', ClientX, ClientY]
3457
3460
  }, {
3458
3461
  name: HandlePointerOver,
3459
- params: ['handlePointerOver', ClientX, ClientY]
3462
+ params: ['handlePointerOver', TargetName]
3460
3463
  }, {
3461
3464
  name: HandleFocusOut,
3462
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.19.0",
3
+ "version": "2.21.0",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",