@lvce-editor/title-bar-worker 4.9.2 → 4.10.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.
@@ -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,11 @@ const getTitleBarIconVirtualDom = (titleBarIconEnabled, iconSrc) => {
4328
4329
  }];
4329
4330
  };
4330
4331
 
4332
+ const activeEntryLabelNode = {
4333
+ childCount: 1,
4334
+ className: TitleBarTopLevelEntryLabel,
4335
+ type: Div
4336
+ };
4331
4337
  const getItemVirtualDom = item => {
4332
4338
  // @ts-ignore
4333
4339
  const {
@@ -4337,10 +4343,7 @@ const getItemVirtualDom = item => {
4337
4343
  keyboardShortCut,
4338
4344
  label
4339
4345
  } = item;
4340
- let className = TitleBarTopLevelEntry;
4341
- if (isFocused) {
4342
- className += ' ' + TitleBarEntryActive;
4343
- }
4346
+ const className = isFocused ? mergeClassNames(TitleBarTopLevelEntry, TitleBarEntryActive) : TitleBarTopLevelEntry;
4344
4347
  return [{
4345
4348
  ariaExpanded: isOpen,
4346
4349
  ariaHasPopup: true,
@@ -4354,11 +4357,7 @@ const getItemVirtualDom = item => {
4354
4357
  // TODO have separate name attribute
4355
4358
  role: MenuItem$1,
4356
4359
  type: Button$1
4357
- }, ...(isFocused ? [{
4358
- childCount: 1,
4359
- className: TitleBarTopLevelEntryLabel,
4360
- type: Div
4361
- }] : []), text(label)];
4360
+ }, ...(isFocused ? [activeEntryLabelNode] : []), text(label)];
4362
4361
  };
4363
4362
  const getTitleBarMenuBarItemsVirtualDom = visibleItems => {
4364
4363
  const dom = visibleItems.flatMap(getItemVirtualDom);
@@ -4398,6 +4397,10 @@ const getTitleVirtualDom = (titleBarTitleEnabled, title) => {
4398
4397
  return [parentNode, text(title)];
4399
4398
  };
4400
4399
 
4400
+ const emptyTitleBarNode = {
4401
+ childCount: 0,
4402
+ type: Div
4403
+ };
4401
4404
  const getTitleBarVirtualDom = state => {
4402
4405
  const {
4403
4406
  assetDir,
@@ -4415,10 +4418,7 @@ const getTitleBarVirtualDom = state => {
4415
4418
  width
4416
4419
  } = state;
4417
4420
  if (platform === Electron$1 && !titleBarStyleCustom) {
4418
- return [{
4419
- childCount: 0,
4420
- type: Div
4421
- }];
4421
+ return [emptyTitleBarNode];
4422
4422
  }
4423
4423
  const iconSrc = getIcon(assetDir);
4424
4424
  const visibleEntries = getVisibleTitleBarEntries(titleBarEntries, width, focusedIndex, isMenuOpen);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "4.9.2",
3
+ "version": "4.10.0",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",