@contentful/experiences-visual-editor-react 1.37.1-dev-20250430T0833-06bfee1.0 → 1.37.1-dev-20250513T0700-6e8c057.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.
package/dist/index.js CHANGED
@@ -1891,6 +1891,23 @@ const transformBoundContentValue = (variables, entityStore, binding, resolveDesi
1891
1891
  }
1892
1892
  };
1893
1893
 
1894
+ function treeVisit(initialNode, onNode) {
1895
+ // returns last used index
1896
+ const _treeVisit = (currentNode, currentIndex, currentDepth) => {
1897
+ // Copy children in case of onNode removing it as we pass the node by reference
1898
+ const children = [...currentNode.children];
1899
+ onNode(currentNode, currentIndex, currentDepth);
1900
+ let nextAvailableIndex = currentIndex + 1;
1901
+ const lastUsedIndex = currentIndex;
1902
+ for (const child of children) {
1903
+ const lastUsedIndex = _treeVisit(child, nextAvailableIndex, currentDepth + 1);
1904
+ nextAvailableIndex = lastUsedIndex + 1;
1905
+ }
1906
+ return lastUsedIndex;
1907
+ };
1908
+ _treeVisit(initialNode, 0, 0);
1909
+ }
1910
+
1894
1911
  const getDataFromTree = (tree) => {
1895
1912
  let dataSource = {};
1896
1913
  let unboundValues = {};
@@ -2390,23 +2407,6 @@ var VisualEditorMode$1;
2390
2407
  VisualEditorMode["InjectScript"] = "injectScript";
2391
2408
  })(VisualEditorMode$1 || (VisualEditorMode$1 = {}));
2392
2409
 
2393
- function treeVisit$1(initialNode, onNode) {
2394
- // returns last used index
2395
- const _treeVisit = (currentNode, currentIndex, currentDepth) => {
2396
- // Copy children in case of onNode removing it as we pass the node by reference
2397
- const children = [...currentNode.children];
2398
- onNode(currentNode, currentIndex, currentDepth);
2399
- let nextAvailableIndex = currentIndex + 1;
2400
- const lastUsedIndex = currentIndex;
2401
- for (const child of children) {
2402
- const lastUsedIndex = _treeVisit(child, nextAvailableIndex, currentDepth + 1);
2403
- nextAvailableIndex = lastUsedIndex + 1;
2404
- }
2405
- return lastUsedIndex;
2406
- };
2407
- _treeVisit(initialNode, 0, 0);
2408
- }
2409
-
2410
2410
  class DeepReference {
2411
2411
  constructor({ path, dataSource }) {
2412
2412
  const { key, field, referentField } = parseDataSourcePathWithL1DeepBindings(path);
@@ -2444,7 +2444,7 @@ class DeepReference {
2444
2444
  }
2445
2445
  function gatherDeepReferencesFromTree(startingNode, dataSource) {
2446
2446
  const deepReferences = [];
2447
- treeVisit$1(startingNode, (node) => {
2447
+ treeVisit(startingNode, (node) => {
2448
2448
  if (!node.data.props)
2449
2449
  return;
2450
2450
  for (const [, variableMapping] of Object.entries(node.data.props)) {
@@ -2954,26 +2954,6 @@ function getTreeDiffs(tree1, tree2, originalTree) {
2954
2954
  return differences.filter((diff) => diff);
2955
2955
  }
2956
2956
 
2957
- /**
2958
- * @deprecated in favor of one in 'core' package
2959
- */
2960
- function treeVisit(initialNode, onNode) {
2961
- // returns last used index
2962
- const _treeVisit = (currentNode, currentIndex, currentDepth) => {
2963
- // Copy children in case of onNode removing it as we pass the node by reference
2964
- const children = [...currentNode.children];
2965
- onNode(currentNode, currentIndex, currentDepth);
2966
- let nextAvailableIndex = currentIndex + 1;
2967
- const lastUsedIndex = currentIndex;
2968
- for (const child of children) {
2969
- const lastUsedIndex = _treeVisit(child, nextAvailableIndex, currentDepth + 1);
2970
- nextAvailableIndex = lastUsedIndex + 1;
2971
- }
2972
- return lastUsedIndex;
2973
- };
2974
- _treeVisit(initialNode, 0, 0);
2975
- }
2976
-
2977
2957
  const useTreeStore = create((set, get) => ({
2978
2958
  tree: {
2979
2959
  root: {
@@ -5915,7 +5895,7 @@ const VisualEditorRoot = ({ experience }) => {
5915
5895
  }
5916
5896
  SimulateDnD$1.updateDrag(e.clientX, e.clientY);
5917
5897
  sendMessage(OUTGOING_EVENTS.MouseMove, {
5918
- clientX: e.pageX,
5898
+ clientX: e.pageX - window.scrollX,
5919
5899
  clientY: e.pageY - window.scrollY,
5920
5900
  });
5921
5901
  };
@@ -5923,8 +5903,7 @@ const VisualEditorRoot = ({ experience }) => {
5923
5903
  return () => {
5924
5904
  document.removeEventListener('mousemove', onMouseMove);
5925
5905
  };
5926
- // eslint-disable-next-line react-hooks/exhaustive-deps
5927
- }, []);
5906
+ }, [setHoveringZone, setMousePosition]);
5928
5907
  if (!initialized)
5929
5908
  return null;
5930
5909
  return React.createElement(RootRenderer, null);