@lvce-editor/title-bar-worker 2.20.0 → 2.22.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.
- package/dist/titleBarWorkerMain.js +16 -16
- package/package.json +1 -1
|
@@ -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,
|
|
2819
|
+
const handlePointerOver = (state, name) => {
|
|
2819
2820
|
const {
|
|
2820
|
-
titleBarEntries
|
|
2821
|
-
x,
|
|
2822
|
-
iconWidth
|
|
2821
|
+
titleBarEntries
|
|
2823
2822
|
} = state;
|
|
2824
|
-
const
|
|
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
|
-
|
|
2887
|
+
if (slashIndex === -1) {
|
|
2888
|
+
return '';
|
|
2889
|
+
}
|
|
2890
|
+
const baseName = workspaceUri.slice(slashIndex + 1);
|
|
2890
2891
|
return baseName;
|
|
2891
2892
|
};
|
|
2892
2893
|
|
|
@@ -3249,16 +3250,16 @@ const getItemVirtualDom = item => {
|
|
|
3249
3250
|
isFocused
|
|
3250
3251
|
} = item;
|
|
3251
3252
|
// TODO avoid mutation
|
|
3252
|
-
const dom = [
|
|
3253
|
-
|
|
3254
|
-
type: Div,
|
|
3253
|
+
const dom = [{
|
|
3254
|
+
type: Button$1,
|
|
3255
3255
|
className: TitleBarTopLevelEntry,
|
|
3256
3256
|
ariaHasPopup: true,
|
|
3257
3257
|
ariaExpanded: isOpen,
|
|
3258
3258
|
role: MenuItem$1,
|
|
3259
3259
|
childCount: 1,
|
|
3260
|
-
ariaKeyShortcuts: keyboardShortCut
|
|
3261
|
-
|
|
3260
|
+
ariaKeyShortcuts: keyboardShortCut,
|
|
3261
|
+
name: label // TODO have separate name attribute
|
|
3262
|
+
}];
|
|
3262
3263
|
if (isOpen) {
|
|
3263
3264
|
// @ts-ignore
|
|
3264
3265
|
dom[0].ariaOwns = 'Menu-0';
|
|
@@ -3357,15 +3358,14 @@ const getTitleBarVirtualDom = state => {
|
|
|
3357
3358
|
title,
|
|
3358
3359
|
titleBarButtons
|
|
3359
3360
|
} = state;
|
|
3360
|
-
const dom = [
|
|
3361
|
-
dom.push({
|
|
3361
|
+
const dom = [{
|
|
3362
3362
|
type: Div,
|
|
3363
3363
|
className: 'Viewlet TitleBar',
|
|
3364
3364
|
id: 'TitleBar',
|
|
3365
3365
|
role: 'contentinfo',
|
|
3366
3366
|
ariaLabel: 'Title Bar',
|
|
3367
3367
|
childCount: 4
|
|
3368
|
-
}
|
|
3368
|
+
}];
|
|
3369
3369
|
|
|
3370
3370
|
// Add icon if enabled
|
|
3371
3371
|
if (state.titleBarIconEnabled) {
|
|
@@ -3457,7 +3457,7 @@ const renderEventListeners = () => {
|
|
|
3457
3457
|
params: ['handlePointerOut', ClientX, ClientY]
|
|
3458
3458
|
}, {
|
|
3459
3459
|
name: HandlePointerOver,
|
|
3460
|
-
params: ['handlePointerOver',
|
|
3460
|
+
params: ['handlePointerOver', TargetName]
|
|
3461
3461
|
}, {
|
|
3462
3462
|
name: HandleFocusOut,
|
|
3463
3463
|
params: ['handleFocusOut', ClientX, ClientY] // TODO maybe check relatedTarget
|