@lvce-editor/title-bar-worker 2.8.0 → 2.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.
- package/dist/titleBarWorkerMain.js +46 -18
- package/package.json +2 -1
|
@@ -1051,13 +1051,17 @@ const MenuItemCheckBox = 'menuitemcheckbox';
|
|
|
1051
1051
|
const None$1 = 'none';
|
|
1052
1052
|
const Separator$1 = 'separator';
|
|
1053
1053
|
|
|
1054
|
-
const Button = 1;
|
|
1054
|
+
const Button$1 = 1;
|
|
1055
1055
|
const Div = 4;
|
|
1056
1056
|
const Span = 8;
|
|
1057
1057
|
const Text = 12;
|
|
1058
1058
|
const I = 16;
|
|
1059
1059
|
const Img = 17;
|
|
1060
1060
|
|
|
1061
|
+
const Button = 'event.button';
|
|
1062
|
+
const ClientX = 'event.clientX';
|
|
1063
|
+
const ClientY = 'event.clientY';
|
|
1064
|
+
|
|
1061
1065
|
const Escape$2 = 8;
|
|
1062
1066
|
const Space$2 = 9;
|
|
1063
1067
|
const End$2 = 255;
|
|
@@ -2206,7 +2210,7 @@ const createTitleBarButton = button => {
|
|
|
2206
2210
|
onClick
|
|
2207
2211
|
} = button;
|
|
2208
2212
|
const dom = [{
|
|
2209
|
-
type: Button,
|
|
2213
|
+
type: Button$1,
|
|
2210
2214
|
className: `TitleBarButton TitleBarButton${id}`,
|
|
2211
2215
|
ariaLabel: label,
|
|
2212
2216
|
childCount: 1,
|
|
@@ -3048,20 +3052,15 @@ const getMenuItemDefaultDom = menuItem => {
|
|
|
3048
3052
|
key
|
|
3049
3053
|
} = menuItem;
|
|
3050
3054
|
const className = getMenuItemClassName(isFocused);
|
|
3051
|
-
const
|
|
3052
|
-
|
|
3055
|
+
const keyDom = key ? getKeyDom(key) : [];
|
|
3056
|
+
const childCount = key ? 2 : 1;
|
|
3057
|
+
return [{
|
|
3053
3058
|
type: Div,
|
|
3054
3059
|
className,
|
|
3055
3060
|
role: MenuItem$1,
|
|
3056
3061
|
tabIndex: -1,
|
|
3057
|
-
childCount
|
|
3058
|
-
}, text(label)
|
|
3059
|
-
if (key) {
|
|
3060
|
-
dom[0].childCount++;
|
|
3061
|
-
const keyDom = getKeyDom(key);
|
|
3062
|
-
dom.push(...keyDom);
|
|
3063
|
-
}
|
|
3064
|
-
return dom;
|
|
3062
|
+
childCount
|
|
3063
|
+
}, text(label), ...keyDom];
|
|
3065
3064
|
};
|
|
3066
3065
|
|
|
3067
3066
|
const disabled = {
|
|
@@ -3279,22 +3278,22 @@ const renderEventListeners = () => {
|
|
|
3279
3278
|
params: ['handleFocus']
|
|
3280
3279
|
}, {
|
|
3281
3280
|
name: HandleMenuClick,
|
|
3282
|
-
params: ['handleMenuClick',
|
|
3281
|
+
params: ['handleMenuClick', ClientX, ClientY]
|
|
3283
3282
|
}, {
|
|
3284
3283
|
name: HandleMenuMouseOver,
|
|
3285
|
-
params: ['handleMenuMouseOver',
|
|
3284
|
+
params: ['handleMenuMouseOver', ClientX, ClientY]
|
|
3286
3285
|
}, {
|
|
3287
3286
|
name: HandleClick,
|
|
3288
|
-
params: ['handleClickAt',
|
|
3287
|
+
params: ['handleClickAt', Button, ClientX, ClientY]
|
|
3289
3288
|
}, {
|
|
3290
3289
|
name: HandlePointerOut,
|
|
3291
|
-
params: ['handlePointerOut',
|
|
3290
|
+
params: ['handlePointerOut', ClientX, ClientY]
|
|
3292
3291
|
}, {
|
|
3293
3292
|
name: HandlePointerOver,
|
|
3294
|
-
params: ['handlePointerOver',
|
|
3293
|
+
params: ['handlePointerOver', ClientX, ClientY]
|
|
3295
3294
|
}, {
|
|
3296
3295
|
name: HandleFocusOut,
|
|
3297
|
-
params: ['handleFocusOut',
|
|
3296
|
+
params: ['handleFocusOut', ClientX, ClientY] // TODO maybe check relatedTarget
|
|
3298
3297
|
}];
|
|
3299
3298
|
};
|
|
3300
3299
|
|
|
@@ -3304,8 +3303,37 @@ const saveState = uid => {
|
|
|
3304
3303
|
};
|
|
3305
3304
|
};
|
|
3306
3305
|
|
|
3306
|
+
const DEFAULT_UID = 1;
|
|
3307
|
+
const createDefaultState = (uid = DEFAULT_UID) => ({
|
|
3308
|
+
assetDir: '',
|
|
3309
|
+
focusedIndex: -1,
|
|
3310
|
+
height: 30,
|
|
3311
|
+
iconWidth: 30,
|
|
3312
|
+
isMenuOpen: false,
|
|
3313
|
+
itleBarIconEnabled: true,
|
|
3314
|
+
labelFontFamily: 'system-ui, Ubuntu, Droid Sans, sans-serif',
|
|
3315
|
+
labelFontSize: 13,
|
|
3316
|
+
labelFontWeight: 400,
|
|
3317
|
+
labelLetterSpacing: 0,
|
|
3318
|
+
labelPadding: 8,
|
|
3319
|
+
menus: [],
|
|
3320
|
+
titleBarButtonsEnabled: true,
|
|
3321
|
+
titleBarButtonsWidth: 90,
|
|
3322
|
+
titleBarEntries: [],
|
|
3323
|
+
titleBarHeight: 30,
|
|
3324
|
+
titleBarIconWidth: 30,
|
|
3325
|
+
titleBarMenuBarEnabled: true,
|
|
3326
|
+
titleBarTitleEnabled: true,
|
|
3327
|
+
uid,
|
|
3328
|
+
width: 800,
|
|
3329
|
+
x: 0,
|
|
3330
|
+
y: 0,
|
|
3331
|
+
title: ''
|
|
3332
|
+
});
|
|
3333
|
+
|
|
3307
3334
|
const create = (id, uri, x, y, width, height) => {
|
|
3308
3335
|
const state = {
|
|
3336
|
+
...createDefaultState(),
|
|
3309
3337
|
uid: id,
|
|
3310
3338
|
titleBarEntries: [],
|
|
3311
3339
|
focusedIndex: -1,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/title-bar-worker",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Title Bar Worker",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"main": "dist/titleBarWorkerMain.js",
|
|
13
13
|
"dependencies": {
|
|
14
|
+
"@lvce-editor/constants": "^1.26.0",
|
|
14
15
|
"@lvce-editor/viewlet-registry": "^1.4.0"
|
|
15
16
|
}
|
|
16
17
|
}
|