@contentful/experiences-visual-editor-react 1.37.1-dev-20250429T1152-2f2b3a7.0 → 1.37.1-dev-20250512T1147-4ad9c25.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 +18 -38
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +18 -38
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
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
|
|
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: {
|