@contentful/experiences-visual-editor-react 1.37.1 → 1.37.2-dev-20250515T1505-4c9ed48.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 +29 -57
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +29 -57
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/renderApp.js
CHANGED
|
@@ -43986,6 +43986,7 @@ const transformVisibility = (value) => {
|
|
|
43986
43986
|
// Don't explicitly set anything when visible to not overwrite values like `grid` or `flex`.
|
|
43987
43987
|
return {};
|
|
43988
43988
|
};
|
|
43989
|
+
// TODO: Remove in next major version v2 since the change is 17 months old
|
|
43989
43990
|
// Keep this for backwards compatibility - deleting this would be a breaking change
|
|
43990
43991
|
// because existing components on a users experience will have the width value as fill
|
|
43991
43992
|
// rather than 100%
|
|
@@ -44511,6 +44512,23 @@ const transformBoundContentValue = (variables, entityStore, binding, resolveDesi
|
|
|
44511
44512
|
}
|
|
44512
44513
|
};
|
|
44513
44514
|
|
|
44515
|
+
function treeVisit(initialNode, onNode) {
|
|
44516
|
+
// returns last used index
|
|
44517
|
+
const _treeVisit = (currentNode, currentIndex, currentDepth) => {
|
|
44518
|
+
// Copy children in case of onNode removing it as we pass the node by reference
|
|
44519
|
+
const children = [...currentNode.children];
|
|
44520
|
+
onNode(currentNode, currentIndex, currentDepth);
|
|
44521
|
+
let nextAvailableIndex = currentIndex + 1;
|
|
44522
|
+
const lastUsedIndex = currentIndex;
|
|
44523
|
+
for (const child of children) {
|
|
44524
|
+
const lastUsedIndex = _treeVisit(child, nextAvailableIndex, currentDepth + 1);
|
|
44525
|
+
nextAvailableIndex = lastUsedIndex + 1;
|
|
44526
|
+
}
|
|
44527
|
+
return lastUsedIndex;
|
|
44528
|
+
};
|
|
44529
|
+
_treeVisit(initialNode, 0, 0);
|
|
44530
|
+
}
|
|
44531
|
+
|
|
44514
44532
|
const getDataFromTree = (tree) => {
|
|
44515
44533
|
let dataSource = {};
|
|
44516
44534
|
let unboundValues = {};
|
|
@@ -45010,23 +45028,6 @@ var VisualEditorMode$1;
|
|
|
45010
45028
|
VisualEditorMode["InjectScript"] = "injectScript";
|
|
45011
45029
|
})(VisualEditorMode$1 || (VisualEditorMode$1 = {}));
|
|
45012
45030
|
|
|
45013
|
-
function treeVisit$1(initialNode, onNode) {
|
|
45014
|
-
// returns last used index
|
|
45015
|
-
const _treeVisit = (currentNode, currentIndex, currentDepth) => {
|
|
45016
|
-
// Copy children in case of onNode removing it as we pass the node by reference
|
|
45017
|
-
const children = [...currentNode.children];
|
|
45018
|
-
onNode(currentNode, currentIndex, currentDepth);
|
|
45019
|
-
let nextAvailableIndex = currentIndex + 1;
|
|
45020
|
-
const lastUsedIndex = currentIndex;
|
|
45021
|
-
for (const child of children) {
|
|
45022
|
-
const lastUsedIndex = _treeVisit(child, nextAvailableIndex, currentDepth + 1);
|
|
45023
|
-
nextAvailableIndex = lastUsedIndex + 1;
|
|
45024
|
-
}
|
|
45025
|
-
return lastUsedIndex;
|
|
45026
|
-
};
|
|
45027
|
-
_treeVisit(initialNode, 0, 0);
|
|
45028
|
-
}
|
|
45029
|
-
|
|
45030
45031
|
class DeepReference {
|
|
45031
45032
|
constructor({ path, dataSource }) {
|
|
45032
45033
|
const { key, field, referentField } = parseDataSourcePathWithL1DeepBindings(path);
|
|
@@ -45064,7 +45065,7 @@ class DeepReference {
|
|
|
45064
45065
|
}
|
|
45065
45066
|
function gatherDeepReferencesFromTree(startingNode, dataSource) {
|
|
45066
45067
|
const deepReferences = [];
|
|
45067
|
-
treeVisit
|
|
45068
|
+
treeVisit(startingNode, (node) => {
|
|
45068
45069
|
if (!node.data.props)
|
|
45069
45070
|
return;
|
|
45070
45071
|
for (const [, variableMapping] of Object.entries(node.data.props)) {
|
|
@@ -56641,26 +56642,6 @@ function getTreeDiffs(tree1, tree2, originalTree) {
|
|
|
56641
56642
|
return differences.filter((diff) => diff);
|
|
56642
56643
|
}
|
|
56643
56644
|
|
|
56644
|
-
/**
|
|
56645
|
-
* @deprecated in favor of one in 'core' package
|
|
56646
|
-
*/
|
|
56647
|
-
function treeVisit(initialNode, onNode) {
|
|
56648
|
-
// returns last used index
|
|
56649
|
-
const _treeVisit = (currentNode, currentIndex, currentDepth) => {
|
|
56650
|
-
// Copy children in case of onNode removing it as we pass the node by reference
|
|
56651
|
-
const children = [...currentNode.children];
|
|
56652
|
-
onNode(currentNode, currentIndex, currentDepth);
|
|
56653
|
-
let nextAvailableIndex = currentIndex + 1;
|
|
56654
|
-
const lastUsedIndex = currentIndex;
|
|
56655
|
-
for (const child of children) {
|
|
56656
|
-
const lastUsedIndex = _treeVisit(child, nextAvailableIndex, currentDepth + 1);
|
|
56657
|
-
nextAvailableIndex = lastUsedIndex + 1;
|
|
56658
|
-
}
|
|
56659
|
-
return lastUsedIndex;
|
|
56660
|
-
};
|
|
56661
|
-
_treeVisit(initialNode, 0, 0);
|
|
56662
|
-
}
|
|
56663
|
-
|
|
56664
56645
|
const useTreeStore = create$1((set, get) => ({
|
|
56665
56646
|
tree: {
|
|
56666
56647
|
root: {
|
|
@@ -56916,8 +56897,6 @@ const useEditorStore = create$1((set, get) => ({
|
|
|
56916
56897
|
dataSource: {},
|
|
56917
56898
|
hyperLinkPattern: undefined,
|
|
56918
56899
|
unboundValues: {},
|
|
56919
|
-
isDragging: false,
|
|
56920
|
-
dragItem: '',
|
|
56921
56900
|
selectedNodeId: null,
|
|
56922
56901
|
locale: null,
|
|
56923
56902
|
setHyperLinkPattern: (pattern) => {
|
|
@@ -58212,7 +58191,7 @@ styleInject(css_248z$5);
|
|
|
58212
58191
|
var css_248z$4 = ".cf-text {\n white-space: pre-line;\n}\n\n.cf-text-link .cf-text {\n margin: 0;\n}\n";
|
|
58213
58192
|
styleInject(css_248z$4);
|
|
58214
58193
|
|
|
58215
|
-
var css_248z$3 = "@import url(https://fonts.googleapis.com/css2?family=Archivo:ital,wght@0,400;0,500;0,600;1,400;1,600&display=swap);\n\n:root {\n /* All sizing comments based of 16px base body font size */\n\n /* color */\n --cf-color-white: #fff;\n --cf-color-black: #000;\n --cf-color-gray100: #f7f9fa;\n --cf-color-gray400: #aec1cc;\n --cf-color-gray400-rgb: 174, 193, 204;\n\n /* spacing */\n --cf-spacing-0: 0rem; /* 0px */\n --cf-spacing-1: 0.125rem; /* 2px */\n --cf-spacing-2: 0.25rem; /* 4px */\n --cf-spacing-3: 0.375rem; /* 6px */\n --cf-spacing-4: 0.5rem; /* 8px */\n --cf-spacing-5: 0.625rem; /* 10px */\n --cf-spacing-6: 0.75rem; /* 12px */\n --cf-spacing-7: 0.875rem; /* 14px */\n --cf-spacing-8: 1rem; /* 16px */\n --cf-spacing-9: 1.25rem; /* 20px */\n --cf-spacing-10: 1.5rem; /* 24px */\n --cf-spacing-11: 1.75rem; /* 28px */\n --cf-spacing-12: 2rem; /* 32px */\n --cf-spacing-13: 2.25rem; /* 36px */\n\n /* font-size */\n --cf-text-xs: 0.75rem; /* 12px */\n --cf-text-sm: 0.875rem; /* 14px */\n --cf-text-base: 1rem; /* 16px */\n --cf-text-lg: 1.125rem; /* 18px */\n --cf-text-xl: 1.25rem; /* 20px */\n --cf-text-2xl: 1.5rem; /* 24px */\n --cf-text-3xl: 2rem; /* 32px */\n --cf-text-4xl: 2.75rem; /* 44px */\n\n /* font-weight */\n --cf-font-light: 300;\n --cf-font-normal: 400;\n --cf-font-medium: 500;\n --cf-font-semibold: 600;\n --cf-font-bold: 700;\n --cf-font-extra-bold: 800;\n --cf-font-black: 900;\n\n /* border-radius */\n --cf-border-radius-none: 0px; /* none */\n --cf-border-radius-sm: 0.125rem; /* 2px */\n --cf-border-radius: 0.25rem; /* 4px */\n --cf-border-radius-md: 0.375rem; /* 6px */\n --cf-border-radius-lg: 0.5rem; /* 8px */\n --cf-border-radius-xl: 0.75rem; /* 12px */\n --cf-border-radius-2xl: 1rem; /* 16px */\n --cf-border-radius-3xl: 1.5rem; /* 24px */\n --cf-border-radius-full: 9999px; /* full */\n\n /* font-family */\n --cf-font-family-sans: Archivo, Helvetica, Arial, sans-serif;\n --cf-font-family-serif: Georgia, Cambria, Times New Roman, Times, serif;\n\n /* max widths */\n --cf-max-width-full: 100%;\n\n /* component specific colors */\n --cf-button-bg: var(--cf-color-black);\n --cf-button-color: var(--cf-color-white);\n --cf-text-color: var(--cf-color-black);\n}\n\nimg.cf-placeholder-image {\n background-color: var(--cf-color-gray100);\n outline-offset: -2px;\n outline: 2px solid rgba(var(--cf-color-gray400-rgb), 0.5);\n}\n\nsvg.cf-placeholder-icon {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n height: var(--cf-text-3xl);\n width: var(--cf-text-3xl);\n max-height: 100%;\n max-width: 100%;\n}\n\nsvg.cf-placeholder-icon path {\n fill: var(--cf-color-gray400);\n}\n";
|
|
58194
|
+
var css_248z$3 = "@import url(https://fonts.googleapis.com/css2?family=Archivo:ital,wght@0,400;0,500;0,600;1,400;1,600&display=swap);\n\n:root {\n /* All sizing comments based of 16px base body font size */\n\n /* color */\n --cf-color-white: #fff;\n --cf-color-black: #000;\n --cf-color-gray100: #f7f9fa;\n --cf-color-gray400: #aec1cc;\n --cf-color-gray400-rgb: 174, 193, 204;\n\n /* spacing */\n --cf-spacing-0: 0rem; /* 0px */\n --cf-spacing-1: 0.125rem; /* 2px */\n --cf-spacing-2: 0.25rem; /* 4px */\n --cf-spacing-3: 0.375rem; /* 6px */\n --cf-spacing-4: 0.5rem; /* 8px */\n --cf-spacing-5: 0.625rem; /* 10px */\n --cf-spacing-6: 0.75rem; /* 12px */\n --cf-spacing-7: 0.875rem; /* 14px */\n --cf-spacing-8: 1rem; /* 16px */\n --cf-spacing-9: 1.25rem; /* 20px */\n --cf-spacing-10: 1.5rem; /* 24px */\n --cf-spacing-11: 1.75rem; /* 28px */\n --cf-spacing-12: 2rem; /* 32px */\n --cf-spacing-13: 2.25rem; /* 36px */\n\n /* font-size */\n --cf-text-xs: 0.75rem; /* 12px */\n --cf-text-sm: 0.875rem; /* 14px */\n --cf-text-base: 1rem; /* 16px */\n --cf-text-lg: 1.125rem; /* 18px */\n --cf-text-xl: 1.25rem; /* 20px */\n --cf-text-2xl: 1.5rem; /* 24px */\n --cf-text-3xl: 2rem; /* 32px */\n --cf-text-4xl: 2.75rem; /* 44px */\n\n /* font-weight */\n --cf-font-light: 300;\n --cf-font-normal: 400;\n --cf-font-medium: 500;\n --cf-font-semibold: 600;\n --cf-font-bold: 700;\n --cf-font-extra-bold: 800;\n --cf-font-black: 900;\n\n /* border-radius */\n --cf-border-radius-none: 0px; /* none */\n --cf-border-radius-sm: 0.125rem; /* 2px */\n --cf-border-radius: 0.25rem; /* 4px */\n --cf-border-radius-md: 0.375rem; /* 6px */\n --cf-border-radius-lg: 0.5rem; /* 8px */\n --cf-border-radius-xl: 0.75rem; /* 12px */\n --cf-border-radius-2xl: 1rem; /* 16px */\n --cf-border-radius-3xl: 1.5rem; /* 24px */\n --cf-border-radius-full: 9999px; /* full */\n\n /* font-family */\n --cf-font-family-sans: Archivo, Helvetica, Arial, sans-serif;\n --cf-font-family-serif: Georgia, Cambria, Times New Roman, Times, serif;\n\n /* max widths */\n --cf-max-width-full: 100%;\n\n /* component specific colors */\n --cf-button-bg: var(--cf-color-black);\n --cf-button-color: var(--cf-color-white);\n --cf-text-color: var(--cf-color-black);\n}\n\ndiv.cf-placeholder-wrapper {\n /* Required for the absolute positioned icon to render in the center */\n position: relative;\n}\n\nimg.cf-placeholder-image {\n background-color: var(--cf-color-gray100);\n outline-offset: -2px;\n outline: 2px solid rgba(var(--cf-color-gray400-rgb), 0.5);\n width: 100%;\n height: 100%;\n}\n\nsvg.cf-placeholder-icon {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n height: var(--cf-text-3xl);\n width: var(--cf-text-3xl);\n max-height: 100%;\n max-width: 100%;\n}\n\nsvg.cf-placeholder-icon path {\n fill: var(--cf-color-gray400);\n}\n";
|
|
58216
58195
|
styleInject(css_248z$3);
|
|
58217
58196
|
|
|
58218
58197
|
/**
|
|
@@ -60448,29 +60427,23 @@ const Tooltip = ({ coordinates, id, label, isAssemblyBlock, isContainer, isSelec
|
|
|
60448
60427
|
function useSingleColumn(node, resolveDesignValue) {
|
|
60449
60428
|
const tree = useTreeStore((store) => store.tree);
|
|
60450
60429
|
const isSingleColumn = node.data.blockId === CONTENTFUL_COMPONENTS$1.singleColumn.id;
|
|
60451
|
-
const
|
|
60452
|
-
let isWrapped = false;
|
|
60453
|
-
let wrapColumnsCount = 0;
|
|
60430
|
+
const isWrapped = reactExports.useMemo(() => {
|
|
60454
60431
|
if (!node.parentId || !isSingleColumn) {
|
|
60455
|
-
return
|
|
60432
|
+
return false;
|
|
60456
60433
|
}
|
|
60457
60434
|
const parentNode = getItem({ id: node.parentId }, tree);
|
|
60458
60435
|
if (!parentNode || parentNode.data.blockId !== CONTENTFUL_COMPONENTS$1.columns.id) {
|
|
60459
|
-
return
|
|
60460
|
-
}
|
|
60461
|
-
const { cfWrapColumns, cfWrapColumnsCount } = parentNode.data.props;
|
|
60462
|
-
if (cfWrapColumns.type === 'DesignValue') {
|
|
60463
|
-
isWrapped = resolveDesignValue(cfWrapColumns.valuesByBreakpoint, 'cfWrapColumns');
|
|
60436
|
+
return false;
|
|
60464
60437
|
}
|
|
60465
|
-
|
|
60466
|
-
|
|
60438
|
+
const { cfWrapColumns } = parentNode.data.props;
|
|
60439
|
+
if (cfWrapColumns.type !== 'DesignValue') {
|
|
60440
|
+
return false;
|
|
60467
60441
|
}
|
|
60468
|
-
return
|
|
60442
|
+
return resolveDesignValue(cfWrapColumns.valuesByBreakpoint, 'cfWrapColumns');
|
|
60469
60443
|
}, [tree, node, isSingleColumn, resolveDesignValue]);
|
|
60470
60444
|
return {
|
|
60471
60445
|
isSingleColumn,
|
|
60472
60446
|
isWrapped,
|
|
60473
|
-
wrapColumnsCount,
|
|
60474
60447
|
};
|
|
60475
60448
|
}
|
|
60476
60449
|
|
|
@@ -60963,7 +60936,7 @@ const VisualEditorRoot = ({ experience }) => {
|
|
|
60963
60936
|
}
|
|
60964
60937
|
SimulateDnD$1.updateDrag(e.clientX, e.clientY);
|
|
60965
60938
|
sendMessage(OUTGOING_EVENTS.MouseMove, {
|
|
60966
|
-
clientX: e.pageX,
|
|
60939
|
+
clientX: e.pageX - window.scrollX,
|
|
60967
60940
|
clientY: e.pageY - window.scrollY,
|
|
60968
60941
|
});
|
|
60969
60942
|
};
|
|
@@ -60971,8 +60944,7 @@ const VisualEditorRoot = ({ experience }) => {
|
|
|
60971
60944
|
return () => {
|
|
60972
60945
|
document.removeEventListener('mousemove', onMouseMove);
|
|
60973
60946
|
};
|
|
60974
|
-
|
|
60975
|
-
}, []);
|
|
60947
|
+
}, [setHoveringZone, setMousePosition]);
|
|
60976
60948
|
if (!initialized)
|
|
60977
60949
|
return null;
|
|
60978
60950
|
return React$1.createElement(RootRenderer, null);
|