@contentful/experiences-visual-editor-react 1.35.1 → 1.36.0-dev-20250331T1251-7ba8661.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 +14 -4
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +14 -4
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/renderApp.js
CHANGED
|
@@ -59615,6 +59615,9 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
|
|
|
59615
59615
|
if (!definition || node.type === ASSEMBLY_NODE_TYPE) {
|
|
59616
59616
|
return propsBase;
|
|
59617
59617
|
}
|
|
59618
|
+
// Note, that here we iterate over DEFINITION variables, not the actual node variables
|
|
59619
|
+
// this means that node may have "orphan" props, or some "newborn" props will be initialized
|
|
59620
|
+
// with the default values.
|
|
59618
59621
|
const extractedProps = Object.entries(definition.variables).reduce((acc, [variableName, variableDefinition]) => {
|
|
59619
59622
|
const variableMapping = node.data.props[variableName];
|
|
59620
59623
|
if (!variableMapping) {
|
|
@@ -59717,6 +59720,7 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
|
|
|
59717
59720
|
renderDropzone,
|
|
59718
59721
|
]);
|
|
59719
59722
|
const cfStyles = reactExports.useMemo(() => buildCfStyles(props), [props]);
|
|
59723
|
+
const cfVisibility = props['cfVisibility'];
|
|
59720
59724
|
const isAssemblyBlock = node.type === ASSEMBLY_BLOCK_NODE_TYPE;
|
|
59721
59725
|
const isSingleColumn = node?.data.blockId === CONTENTFUL_COMPONENTS$1.columns.id;
|
|
59722
59726
|
const isStructureComponent = isContentfulStructureComponent(node?.data.blockId);
|
|
@@ -59726,13 +59730,18 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
|
|
|
59726
59730
|
const overrideStyles = {};
|
|
59727
59731
|
const wrapperStyles = { width: options?.wrapContainerWidth };
|
|
59728
59732
|
if (requiresDragWrapper) {
|
|
59729
|
-
|
|
59733
|
+
// when element is marked by user as not-visible, on that element the node `display: none !important`
|
|
59734
|
+
// will be set and it will disappear. However, when such a node has a wrapper div, the wrapper
|
|
59735
|
+
// should not have any css properties (at least not ones which force size), as such div should
|
|
59736
|
+
// simply be a zero height wrapper around element with `display: none !important`.
|
|
59737
|
+
// Hence we guard all wrapperStyles with `cfVisibility` check.
|
|
59738
|
+
if (cfVisibility && cfStyles.width)
|
|
59730
59739
|
wrapperStyles.width = cfStyles.width;
|
|
59731
|
-
if (cfStyles.height)
|
|
59740
|
+
if (cfVisibility && cfStyles.height)
|
|
59732
59741
|
wrapperStyles.height = cfStyles.height;
|
|
59733
|
-
if (cfStyles.maxWidth)
|
|
59742
|
+
if (cfVisibility && cfStyles.maxWidth)
|
|
59734
59743
|
wrapperStyles.maxWidth = cfStyles.maxWidth;
|
|
59735
|
-
if (cfStyles.margin)
|
|
59744
|
+
if (cfVisibility && cfStyles.margin)
|
|
59736
59745
|
wrapperStyles.margin = cfStyles.margin;
|
|
59737
59746
|
}
|
|
59738
59747
|
// Override component styles to fill the wrapper
|
|
@@ -59767,6 +59776,7 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
|
|
|
59767
59776
|
node.data.id,
|
|
59768
59777
|
draggingId,
|
|
59769
59778
|
nodeRect,
|
|
59779
|
+
cfVisibility,
|
|
59770
59780
|
]);
|
|
59771
59781
|
// Styles that will be applied to the component element
|
|
59772
59782
|
// This has to be memoized to avoid recreating the styles in useEditorModeClassName on every render
|