@lvce-editor/renderer-process 30.46.2 → 30.46.4

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.
@@ -2480,7 +2480,9 @@ const getInputMap = $Viewlet => {
2480
2480
  const $$Inputs = queryInputs($Viewlet);
2481
2481
  const inputMap = Object.create(null);
2482
2482
  for (const $Input of $$Inputs) {
2483
- inputMap[$Input.name] = $Input.value;
2483
+ if (!$Input.readOnly) {
2484
+ inputMap[$Input.name] = $Input.value;
2485
+ }
2484
2486
  }
2485
2487
  return inputMap;
2486
2488
  };
@@ -2509,6 +2511,9 @@ const restoreFocusedElement = ($Hidden, $New, focused) => {
2509
2511
  if (!$NewFocused) {
2510
2512
  return;
2511
2513
  }
2514
+ if ($NewFocused.readOnly) {
2515
+ return;
2516
+ }
2512
2517
  const $Previous = $Hidden.firstChild;
2513
2518
  if (!$Previous) {
2514
2519
  return;
@@ -2526,7 +2531,9 @@ const renderWithUid = ($Viewlet, dom, eventMap, uid, inputMap, focused, activeEl
2526
2531
  setComponentUid($New, uid);
2527
2532
  const $$NewInputs = queryInputs($New);
2528
2533
  for (const $Input of $$NewInputs) {
2529
- $Input.value = inputMap[$Input.name] || $Input.value || '';
2534
+ if (!$Input.readOnly) {
2535
+ $Input.value = inputMap[$Input.name] || $Input.value || '';
2536
+ }
2530
2537
  }
2531
2538
  $Viewlet.replaceWith($New);
2532
2539
  if (focused) {
@@ -1916,7 +1916,9 @@ const getInputMap = $Viewlet => {
1916
1916
  const $$Inputs = queryInputs($Viewlet);
1917
1917
  const inputMap = Object.create(null);
1918
1918
  for (const $Input of $$Inputs) {
1919
- inputMap[$Input.name] = $Input.value;
1919
+ if (!$Input.readOnly) {
1920
+ inputMap[$Input.name] = $Input.value;
1921
+ }
1920
1922
  }
1921
1923
  return inputMap;
1922
1924
  };
@@ -1945,6 +1947,9 @@ const restoreFocusedElement = ($Hidden, $New, focused) => {
1945
1947
  if (!$NewFocused) {
1946
1948
  return;
1947
1949
  }
1950
+ if ($NewFocused.readOnly) {
1951
+ return;
1952
+ }
1948
1953
  const $Previous = $Hidden.firstChild;
1949
1954
  if (!$Previous) {
1950
1955
  return;
@@ -1962,7 +1967,9 @@ const renderWithUid = ($Viewlet, dom, eventMap, uid, inputMap, focused, activeEl
1962
1967
  setComponentUid($New, uid);
1963
1968
  const $$NewInputs = queryInputs($New);
1964
1969
  for (const $Input of $$NewInputs) {
1965
- $Input.value = inputMap[$Input.name] || $Input.value || '';
1970
+ if (!$Input.readOnly) {
1971
+ $Input.value = inputMap[$Input.name] || $Input.value || '';
1972
+ }
1966
1973
  }
1967
1974
  $Viewlet.replaceWith($New);
1968
1975
  if (focused) {
@@ -3662,15 +3669,18 @@ const addFileHandle = fileHandle => {
3662
3669
  return addFileHandle$1(fileHandle);
3663
3670
  };
3664
3671
 
3672
+ const getWindowControlsOverlay = () => {
3673
+ const navigatorWithWindowControls = globalThis.navigator;
3674
+ return navigatorWithWindowControls.windowControlsOverlay;
3675
+ };
3676
+ const getTitleBarRect = () => {
3677
+ return getWindowControlsOverlay()?.getTitlebarAreaRect();
3678
+ };
3665
3679
  const getTitleBarHeight = () => {
3666
- if (
3667
- // @ts-expect-error
3668
- globalThis.navigator.windowControlsOverlay?.getTitlebarAreaRect) {
3669
- // @ts-expect-error
3670
- const titleBarRect = globalThis.navigator.windowControlsOverlay.getTitlebarAreaRect();
3671
- return titleBarRect.height;
3672
- }
3673
- return 0;
3680
+ return getTitleBarRect()?.height ?? 0;
3681
+ };
3682
+ const getTitleBarLeftInset = () => {
3683
+ return getTitleBarRect()?.x ?? 0;
3674
3684
  };
3675
3685
  const getBounds = () => {
3676
3686
  return {
@@ -8806,6 +8816,9 @@ const ViewletTitleBarMenuBarEvents = {
8806
8816
  };
8807
8817
 
8808
8818
  const activeId = 'TitleBarEntryActive';
8819
+ const getMenuX = x => {
8820
+ return x + getTitleBarLeftInset();
8821
+ };
8809
8822
  const removeDocumentClickListener = state => {
8810
8823
  const {
8811
8824
  documentClickListener
@@ -8934,7 +8947,7 @@ const openMenu = (state, unFocusIndex, index, level, menuItems, menuFocusedIndex
8934
8947
  items: menuItems,
8935
8948
  level,
8936
8949
  width,
8937
- x,
8950
+ x: getMenuX(x),
8938
8951
  y
8939
8952
  });
8940
8953
  if (menuFocusedIndex !== -1) {
@@ -9001,7 +9014,7 @@ const addMenu = ($$Menus, change, uid) => {
9001
9014
  x,
9002
9015
  y
9003
9016
  } = menu;
9004
- setBounds$a($Menu, x, y, width, height);
9017
+ setBounds$a($Menu, getMenuX(x), y, width, height);
9005
9018
  renderInto($Menu, dom);
9006
9019
  $Menu.id = `Menu-${level}`;
9007
9020
  append$1($Menu);
@@ -9033,7 +9046,7 @@ const updateMenu = ($$Menus, change) => {
9033
9046
  y
9034
9047
  } = menu;
9035
9048
  const $Menu = $$Menus[level];
9036
- setBounds$a($Menu, x, y, width, height);
9049
+ setBounds$a($Menu, getMenuX(x), y, width, height);
9037
9050
  renderInto($Menu, dom);
9038
9051
  const isOpeningSubMenu = $$Menus.length < newLength;
9039
9052
  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.2",
3
+ "version": "30.46.4",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"