@lvce-editor/title-bar-worker 4.9.2 → 4.11.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 +24 -18
- package/package.json +1 -1
|
@@ -4032,16 +4032,17 @@ const getKeyLabel = (keyCode, fallback) => {
|
|
|
4032
4032
|
};
|
|
4033
4033
|
|
|
4034
4034
|
const altKeyMask = 1 << 9;
|
|
4035
|
+
const keyBindingNode = {
|
|
4036
|
+
childCount: 1,
|
|
4037
|
+
className: MenuItemKeyBinding,
|
|
4038
|
+
type: Span
|
|
4039
|
+
};
|
|
4035
4040
|
const getKeyDom = key => {
|
|
4036
4041
|
const parsedKey = parseKey(key);
|
|
4037
4042
|
const isAlt = Boolean(key & altKeyMask);
|
|
4038
4043
|
const keyLabel = getKeyLabel(key & 0xff, parsedKey.key);
|
|
4039
4044
|
const keyBindingsString = getKeyBindingString(keyLabel, isAlt, parsedKey.isCtrl, parsedKey.isShift);
|
|
4040
|
-
return [
|
|
4041
|
-
childCount: 1,
|
|
4042
|
-
className: MenuItemKeyBinding,
|
|
4043
|
-
type: Span
|
|
4044
|
-
}, text(keyBindingsString)];
|
|
4045
|
+
return [keyBindingNode, text(keyBindingsString)];
|
|
4045
4046
|
};
|
|
4046
4047
|
|
|
4047
4048
|
const checkMark = {
|
|
@@ -4328,6 +4329,17 @@ const getTitleBarIconVirtualDom = (titleBarIconEnabled, iconSrc) => {
|
|
|
4328
4329
|
}];
|
|
4329
4330
|
};
|
|
4330
4331
|
|
|
4332
|
+
const activeEntryLabelNode = {
|
|
4333
|
+
childCount: 1,
|
|
4334
|
+
className: TitleBarTopLevelEntryLabel,
|
|
4335
|
+
type: Div
|
|
4336
|
+
};
|
|
4337
|
+
const getActiveEntryLabelDom = isFocused => {
|
|
4338
|
+
if (!isFocused) {
|
|
4339
|
+
return [];
|
|
4340
|
+
}
|
|
4341
|
+
return [activeEntryLabelNode];
|
|
4342
|
+
};
|
|
4331
4343
|
const getItemVirtualDom = item => {
|
|
4332
4344
|
// @ts-ignore
|
|
4333
4345
|
const {
|
|
@@ -4337,10 +4349,7 @@ const getItemVirtualDom = item => {
|
|
|
4337
4349
|
keyboardShortCut,
|
|
4338
4350
|
label
|
|
4339
4351
|
} = item;
|
|
4340
|
-
|
|
4341
|
-
if (isFocused) {
|
|
4342
|
-
className += ' ' + TitleBarEntryActive;
|
|
4343
|
-
}
|
|
4352
|
+
const className = isFocused ? mergeClassNames(TitleBarTopLevelEntry, TitleBarEntryActive) : TitleBarTopLevelEntry;
|
|
4344
4353
|
return [{
|
|
4345
4354
|
ariaExpanded: isOpen,
|
|
4346
4355
|
ariaHasPopup: true,
|
|
@@ -4354,11 +4363,7 @@ const getItemVirtualDom = item => {
|
|
|
4354
4363
|
// TODO have separate name attribute
|
|
4355
4364
|
role: MenuItem$1,
|
|
4356
4365
|
type: Button$1
|
|
4357
|
-
}, ...(isFocused
|
|
4358
|
-
childCount: 1,
|
|
4359
|
-
className: TitleBarTopLevelEntryLabel,
|
|
4360
|
-
type: Div
|
|
4361
|
-
}] : []), text(label)];
|
|
4366
|
+
}, ...getActiveEntryLabelDom(isFocused), text(label)];
|
|
4362
4367
|
};
|
|
4363
4368
|
const getTitleBarMenuBarItemsVirtualDom = visibleItems => {
|
|
4364
4369
|
const dom = visibleItems.flatMap(getItemVirtualDom);
|
|
@@ -4398,6 +4403,10 @@ const getTitleVirtualDom = (titleBarTitleEnabled, title) => {
|
|
|
4398
4403
|
return [parentNode, text(title)];
|
|
4399
4404
|
};
|
|
4400
4405
|
|
|
4406
|
+
const emptyTitleBarNode = {
|
|
4407
|
+
childCount: 0,
|
|
4408
|
+
type: Div
|
|
4409
|
+
};
|
|
4401
4410
|
const getTitleBarVirtualDom = state => {
|
|
4402
4411
|
const {
|
|
4403
4412
|
assetDir,
|
|
@@ -4415,10 +4424,7 @@ const getTitleBarVirtualDom = state => {
|
|
|
4415
4424
|
width
|
|
4416
4425
|
} = state;
|
|
4417
4426
|
if (platform === Electron$1 && !titleBarStyleCustom) {
|
|
4418
|
-
return [
|
|
4419
|
-
childCount: 0,
|
|
4420
|
-
type: Div
|
|
4421
|
-
}];
|
|
4427
|
+
return [emptyTitleBarNode];
|
|
4422
4428
|
}
|
|
4423
4429
|
const iconSrc = getIcon(assetDir);
|
|
4424
4430
|
const visibleEntries = getVisibleTitleBarEntries(titleBarEntries, width, focusedIndex, isMenuOpen);
|