@lvce-editor/renderer-process 30.46.3 → 30.46.5

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.
@@ -3669,15 +3669,18 @@ const addFileHandle = fileHandle => {
3669
3669
  return addFileHandle$1(fileHandle);
3670
3670
  };
3671
3671
 
3672
+ const getWindowControlsOverlay = () => {
3673
+ const navigatorWithWindowControls = globalThis.navigator;
3674
+ return navigatorWithWindowControls.windowControlsOverlay;
3675
+ };
3676
+ const getTitleBarRect = () => {
3677
+ return getWindowControlsOverlay()?.getTitlebarAreaRect();
3678
+ };
3672
3679
  const getTitleBarHeight = () => {
3673
- if (
3674
- // @ts-expect-error
3675
- globalThis.navigator.windowControlsOverlay?.getTitlebarAreaRect) {
3676
- // @ts-expect-error
3677
- const titleBarRect = globalThis.navigator.windowControlsOverlay.getTitlebarAreaRect();
3678
- return titleBarRect.height;
3679
- }
3680
- return 0;
3680
+ return getTitleBarRect()?.height ?? 0;
3681
+ };
3682
+ const getTitleBarLeftInset = () => {
3683
+ return getTitleBarRect()?.x ?? 0;
3681
3684
  };
3682
3685
  const getBounds = () => {
3683
3686
  return {
@@ -7790,8 +7793,21 @@ const isNativeButtonActivation = event => {
7790
7793
  }
7791
7794
  return target instanceof HTMLButtonElement && target.role !== MenuItem && (key === 'Enter' || key === ' ');
7792
7795
  };
7796
+ const isTerminalTextInput = event => {
7797
+ const {
7798
+ altKey,
7799
+ ctrlKey,
7800
+ key,
7801
+ metaKey,
7802
+ target
7803
+ } = event;
7804
+ if (altKey || ctrlKey || metaKey || key.length !== 1) {
7805
+ return false;
7806
+ }
7807
+ return target instanceof Element && Boolean(target.closest('.XtermTerminal'));
7808
+ };
7793
7809
  const handleKeyDown$1 = event => {
7794
- if (isNativeButtonActivation(event)) {
7810
+ if (isNativeButtonActivation(event) || isTerminalTextInput(event)) {
7795
7811
  return;
7796
7812
  }
7797
7813
  const identifier = getKeyBindingIdentifier(event);
@@ -8813,6 +8829,9 @@ const ViewletTitleBarMenuBarEvents = {
8813
8829
  };
8814
8830
 
8815
8831
  const activeId = 'TitleBarEntryActive';
8832
+ const getMenuX = x => {
8833
+ return x + getTitleBarLeftInset();
8834
+ };
8816
8835
  const removeDocumentClickListener = state => {
8817
8836
  const {
8818
8837
  documentClickListener
@@ -8941,7 +8960,7 @@ const openMenu = (state, unFocusIndex, index, level, menuItems, menuFocusedIndex
8941
8960
  items: menuItems,
8942
8961
  level,
8943
8962
  width,
8944
- x,
8963
+ x: getMenuX(x),
8945
8964
  y
8946
8965
  });
8947
8966
  if (menuFocusedIndex !== -1) {
@@ -9008,7 +9027,7 @@ const addMenu = ($$Menus, change, uid) => {
9008
9027
  x,
9009
9028
  y
9010
9029
  } = menu;
9011
- setBounds$a($Menu, x, y, width, height);
9030
+ setBounds$a($Menu, getMenuX(x), y, width, height);
9012
9031
  renderInto($Menu, dom);
9013
9032
  $Menu.id = `Menu-${level}`;
9014
9033
  append$1($Menu);
@@ -9040,7 +9059,7 @@ const updateMenu = ($$Menus, change) => {
9040
9059
  y
9041
9060
  } = menu;
9042
9061
  const $Menu = $$Menus[level];
9043
- setBounds$a($Menu, x, y, width, height);
9062
+ setBounds$a($Menu, getMenuX(x), y, width, height);
9044
9063
  renderInto($Menu, dom);
9045
9064
  const isOpeningSubMenu = $$Menus.length < newLength;
9046
9065
  if (level === newLength - 1 || isOpeningSubMenu) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.46.3",
3
+ "version": "30.46.5",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"