@lvce-editor/title-bar-worker 2.26.0 → 2.27.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.
@@ -1050,6 +1050,8 @@ const About = 'About';
1050
1050
  const CheckForUpdates = 'Check For Updates';
1051
1051
  const ClearRecentlyOpened = 'Clear Recently Opened';
1052
1052
  const Close = 'Close';
1053
+ const MenuBar$1 = 'Menu Bar';
1054
+ const CommandCenter = 'Command Center';
1053
1055
  const Edit$1 = 'Edit';
1054
1056
  const File$2 = 'File';
1055
1057
  const Go$1 = 'Go';
@@ -1098,6 +1100,12 @@ const maximize$1 = () => {
1098
1100
  const close$1 = () => {
1099
1101
  return i18nString(Close);
1100
1102
  };
1103
+ const menuBar = () => {
1104
+ return i18nString(MenuBar$1);
1105
+ };
1106
+ const commandCenter = () => {
1107
+ return i18nString(CommandCenter);
1108
+ };
1101
1109
 
1102
1110
  const getTitleBarButtonsElectron = (controlsOverlayEnabled, titleBarStyleCustom) => {
1103
1111
  if (controlsOverlayEnabled) {
@@ -1618,17 +1626,21 @@ const RestoreFocus = 6;
1618
1626
  const Ignore = 7;
1619
1627
 
1620
1628
  const getMenuEntriesTitleBarContextMenu = async state => {
1629
+ const {
1630
+ titleBarMenuBarEnabled,
1631
+ commandCenterEnabled
1632
+ } = state;
1621
1633
  // TODO checked state should be depending on whether or not that feature is currently visible or not
1622
1634
  return [{
1623
1635
  id: 'MenuBar',
1624
- label: 'menu bar',
1625
- flags: Checked,
1626
- command: ''
1636
+ label: menuBar(),
1637
+ flags: titleBarMenuBarEnabled ? Checked : Unchecked,
1638
+ command: titleBarMenuBarEnabled ? 'TitleBar.hideMenuBar' : 'TitleBar.showMenuBar'
1627
1639
  }, {
1628
1640
  id: 'Command center',
1629
- label: 'command center',
1630
- flags: Checked,
1631
- command: ''
1641
+ label: commandCenter(),
1642
+ flags: commandCenterEnabled ? Checked : Unchecked,
1643
+ command: commandCenterEnabled ? 'TitleBar.hideCommandCenter' : 'TitleBar.showCommandCenter'
1632
1644
  }, {
1633
1645
  id: 'layout controls',
1634
1646
  label: 'layout controls',
@@ -2576,7 +2588,7 @@ const getMenuEntries$1 = async (id, platform) => {
2576
2588
 
2577
2589
  const getMenuEntries2 = async (state, props) => {
2578
2590
  if (props.menuId === MenuIdTitleBarContextMenu) {
2579
- return getMenuEntriesTitleBarContextMenu();
2591
+ return getMenuEntriesTitleBarContextMenu(state);
2580
2592
  }
2581
2593
  // TODO
2582
2594
  return [];
@@ -2893,11 +2905,18 @@ const handlePointerOver = (state, name) => {
2893
2905
  return handleMouseOver(state, index);
2894
2906
  };
2895
2907
 
2896
- const hideMenuBar = async state => {
2908
+ const hideCommandCenter = async state => {
2897
2909
  // TODO
2898
2910
  return state;
2899
2911
  };
2900
2912
 
2913
+ const hideMenuBar = async state => {
2914
+ return {
2915
+ ...state,
2916
+ titleBarMenuBarEnabled: false
2917
+ };
2918
+ };
2919
+
2901
2920
  const createTextMeasureContext = (letterSpacing, font) => {
2902
2921
  const canvas = new OffscreenCanvas(0, 0);
2903
2922
  const ctx = canvas.getContext('2d');
@@ -3570,11 +3589,18 @@ const saveState = state => {
3570
3589
  };
3571
3590
  };
3572
3591
 
3573
- const showMenuBar = async state => {
3592
+ const showCommandCenter = async state => {
3574
3593
  // TODO
3575
3594
  return state;
3576
3595
  };
3577
3596
 
3597
+ const showMenuBar = async state => {
3598
+ return {
3599
+ ...state,
3600
+ titleBarMenuBarEnabled: true
3601
+ };
3602
+ };
3603
+
3578
3604
  const create = (id, uri, x, y, width, height) => {
3579
3605
  const state = {
3580
3606
  ...createDefaultState(),
@@ -4107,7 +4133,7 @@ const commandMap = {
4107
4133
  'TitleBar.handleClickClose': wrapCommand(handleClickClose),
4108
4134
  'TitleBar.handleClickMinimize': wrapCommand(handleClickMinimize),
4109
4135
  'TitleBar.handleClickToggleMaximize': wrapCommand(handleClickToggleMaximize),
4110
- 'TitleBar.handleContextMenu': handleContextMenu,
4136
+ 'TitleBar.handleContextMenu': wrapCommand(handleContextMenu),
4111
4137
  'TitleBar.handleFocus': wrapCommand(handleFocus),
4112
4138
  'TitleBar.handleFocusOut': wrapCommand(handleFocusOut),
4113
4139
  'TitleBar.handleKeyArrowDown': wrapCommand(handleKeyArrowDown),
@@ -4125,12 +4151,14 @@ const commandMap = {
4125
4151
  'TitleBar.handleMouseOver': wrapCommand(handleMouseOver),
4126
4152
  'TitleBar.handlePointerOut': wrapCommand(handlePointerOut),
4127
4153
  'TitleBar.handlePointerOver': wrapCommand(handlePointerOver),
4154
+ 'TitleBar.hideCommandCenter': wrapCommand(hideCommandCenter),
4128
4155
  'TitleBar.hideMenuBar': wrapCommand(hideMenuBar),
4129
4156
  'TitleBar.loadContent2': wrapCommand(loadContent2),
4130
4157
  'TitleBar.render3': render3,
4131
4158
  'TitleBar.renderEventListeners': renderEventListeners,
4132
4159
  'TitleBar.resize': wrapCommand(resize),
4133
4160
  'TitleBar.saveState': wrapGetter(saveState),
4161
+ 'TitleBar.showCommandCenter': wrapCommand(showCommandCenter),
4134
4162
  'TitleBar.showMenuBar': wrapCommand(showMenuBar),
4135
4163
  'TitleBar.terminate': terminate,
4136
4164
  'TitleBar.toggleIndex': wrapCommand(toggleIndex),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "2.26.0",
3
+ "version": "2.27.0",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",