@lvce-editor/title-bar-worker 2.11.0 → 2.13.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.
@@ -2313,13 +2313,13 @@ const getTitleBarButtonsVirtualDom = buttons => {
2313
2313
  }, ...buttons.flatMap(createTitleBarButton)];
2314
2314
  };
2315
2315
 
2316
- const parentNode = {
2316
+ const parentNode$1 = {
2317
2317
  type: Div,
2318
2318
  className: mergeClassNames(Viewlet, TitleBarIcon),
2319
2319
  childCount: 1
2320
2320
  };
2321
2321
  const getTitleBarIconVirtualDom = iconSrc => {
2322
- return [parentNode, {
2322
+ return [parentNode$1, {
2323
2323
  type: Img,
2324
2324
  className: TitleBarIconIcon,
2325
2325
  src: iconSrc,
@@ -2397,8 +2397,13 @@ const getTitleBarMenuBarVirtualDom = (visibleItems, focusedIndex) => {
2397
2397
  }, ...getTitleBarMenuBarItemsVirtualDom(visibleItems)];
2398
2398
  };
2399
2399
 
2400
+ const parentNode = {
2401
+ type: Div,
2402
+ className: 'TitleBarTitle',
2403
+ childCount: 1
2404
+ };
2400
2405
  const getTitleVirtualDom = title => {
2401
- return [text(title)];
2406
+ return [parentNode, text(title)];
2402
2407
  };
2403
2408
 
2404
2409
  const maximize = async () => {
@@ -2659,7 +2664,12 @@ const ifElse = (menuOpenFunction, menuClosedFunction) => {
2659
2664
  const handleMouseOut = ifElse(handleMouseOutMenuOpen, handleMouseOutMenuClosed);
2660
2665
 
2661
2666
  const handlePointerOut = (state, clientX, clientY) => {
2662
- const index = getTitleBarIndexFromPosition(state.titleBarEntries, clientX - state.x);
2667
+ const {
2668
+ x,
2669
+ iconWidth,
2670
+ titleBarEntries
2671
+ } = state;
2672
+ const index = getTitleBarIndexFromPosition(titleBarEntries, clientX - x - iconWidth);
2663
2673
  if (index === -1) {
2664
2674
  return state;
2665
2675
  }
@@ -2680,7 +2690,12 @@ const handleMouseOverMenuOpen = async (state, index) => {
2680
2690
  const handleMouseOver = ifElse(handleMouseOverMenuOpen, handleMouseOverMenuClosed);
2681
2691
 
2682
2692
  const handlePointerOver = (state, clientX, clientY) => {
2683
- const index = getTitleBarIndexFromPosition(state.titleBarEntries, clientX - state.x);
2693
+ const {
2694
+ titleBarEntries,
2695
+ x,
2696
+ iconWidth
2697
+ } = state;
2698
+ const index = getTitleBarIndexFromPosition(titleBarEntries, clientX - x - iconWidth);
2684
2699
  if (index === -1) {
2685
2700
  return state;
2686
2701
  }
@@ -2754,11 +2769,13 @@ const loadContent2 = async state => {
2754
2769
  const withWidths = addWidths(titleBarEntries, labelPadding, labelFontWeight, labelFontSize, labelFontFamily, labelLetterSpacing);
2755
2770
  const buttons = getTitleBarButtons(platform, controlsOverlayEnabled, titleBarStyleCustom);
2756
2771
  const title = 'test';
2772
+ const iconWidth = 30;
2757
2773
  return {
2758
2774
  ...state,
2759
2775
  titleBarEntries: withWidths,
2760
2776
  buttons,
2761
- title
2777
+ title,
2778
+ iconWidth
2762
2779
  };
2763
2780
  };
2764
2781
 
@@ -3397,6 +3414,14 @@ const getTitleBarVirtualDom = state => {
3397
3414
  titleBarButtons
3398
3415
  } = state;
3399
3416
  const dom = [];
3417
+ dom.push({
3418
+ type: Div,
3419
+ className: 'Viewlet TitleBar',
3420
+ id: 'TitleBar',
3421
+ role: 'contentinfo',
3422
+ ariaLabel: 'Title Bar',
3423
+ childCount: 4
3424
+ });
3400
3425
 
3401
3426
  // Add icon if enabled
3402
3427
  if (state.titleBarIconEnabled) {
@@ -4030,6 +4055,7 @@ const commandMap = {
4030
4055
  'TitleBarMenuBar.focusNext': wrapCommand(focusNext),
4031
4056
  'TitleBarMenuBar.focusPrevious': wrapCommand(focusPrevious),
4032
4057
  'TitleBarMenuBar.getCommands': getCommandIds,
4058
+ 'TitleBarMenuBar.getCommandIds': getCommandIds,
4033
4059
  'TitleBarMenuBar.getKeyBindings': getKeyBindings$1,
4034
4060
  'TitleBarMenuBar.getMenus': getMenus,
4035
4061
  'TitleBarMenuBar.getTitleBarButtons': getTitleBarButtons,
@@ -4060,6 +4086,14 @@ const commandMap = {
4060
4086
  'TitleBarMenuBar.toggleIndex': wrapCommand(toggleIndex),
4061
4087
  'TitleBarMenuBar.toggleMenu': wrapCommand(toggleMenu)
4062
4088
  };
4089
+ for (const [key, value] of Object.entries(commandMap)) {
4090
+ const [prefix, name] = key.split('.');
4091
+ if (prefix === 'TitleBarMenuBar') {
4092
+ const alternate = `TitleBar.${name}`;
4093
+ // @ts-ignore
4094
+ commandMap[alternate] = value;
4095
+ }
4096
+ }
4063
4097
 
4064
4098
  const listen = async () => {
4065
4099
  registerCommands(commandMap);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "2.11.0",
3
+ "version": "2.13.0",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",