@contentful/experiences-visual-editor-react 3.6.0-dev-20250903T1157-8aba2a4.0 → 3.6.1-beta.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 +19 -7
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +19 -7
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -10
package/dist/index.js
CHANGED
|
@@ -3276,7 +3276,7 @@ const useEditorStore = create((set, get) => ({
|
|
|
3276
3276
|
},
|
|
3277
3277
|
}));
|
|
3278
3278
|
|
|
3279
|
-
var css_248z$8 = "
|
|
3279
|
+
var css_248z$8 = ":root{--cf-color-white:#fff;--cf-color-black:#000;--cf-color-gray100:#f7f9fa;--cf-color-gray400:#aec1cc;--cf-color-gray400-rgb:174,193,204;--cf-spacing-0:0rem;--cf-spacing-1:0.125rem;--cf-spacing-2:0.25rem;--cf-spacing-3:0.375rem;--cf-spacing-4:0.5rem;--cf-spacing-5:0.625rem;--cf-spacing-6:0.75rem;--cf-spacing-7:0.875rem;--cf-spacing-8:1rem;--cf-spacing-9:1.25rem;--cf-spacing-10:1.5rem;--cf-spacing-11:1.75rem;--cf-spacing-12:2rem;--cf-spacing-13:2.25rem;--cf-text-xs:0.75rem;--cf-text-sm:0.875rem;--cf-text-base:1rem;--cf-text-lg:1.125rem;--cf-text-xl:1.25rem;--cf-text-2xl:1.5rem;--cf-text-3xl:2rem;--cf-text-4xl:2.75rem;--cf-font-light:300;--cf-font-normal:400;--cf-font-medium:500;--cf-font-semibold:600;--cf-font-bold:700;--cf-font-extra-bold:800;--cf-font-black:900;--cf-border-radius-none:0px;--cf-border-radius-sm:0.125rem;--cf-border-radius:0.25rem;--cf-border-radius-md:0.375rem;--cf-border-radius-lg:0.5rem;--cf-border-radius-xl:0.75rem;--cf-border-radius-2xl:1rem;--cf-border-radius-3xl:1.5rem;--cf-border-radius-full:9999px;--cf-max-width-full:100%;--cf-button-bg:var(--cf-color-black);--cf-button-color:var(--cf-color-white);--cf-text-color:var(--cf-color-black)}*{box-sizing:border-box}";
|
|
3280
3280
|
styleInject(css_248z$8);
|
|
3281
3281
|
|
|
3282
3282
|
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
@@ -4756,6 +4756,15 @@ const maybeMergePatternDefaultDesignValues = ({ variableName, variableMapping, n
|
|
|
4756
4756
|
return variableMapping.valuesByBreakpoint;
|
|
4757
4757
|
};
|
|
4758
4758
|
|
|
4759
|
+
const checkIsNodeVisible = (node, resolveDesignValue) => {
|
|
4760
|
+
if (node.type === ASSEMBLY_NODE_TYPE || node.type === ROOT_ID) {
|
|
4761
|
+
// If this is a wrapping pattern/root with no visible children, it is invisible as well
|
|
4762
|
+
return node.children.some((childNode) => checkIsNodeVisible(childNode, resolveDesignValue));
|
|
4763
|
+
}
|
|
4764
|
+
// Check if the current node is visible (`cfVisibility` is enforced on all nodes)
|
|
4765
|
+
return !!resolveDesignValue(node.data.props['cfVisibility'].valuesByBreakpoint);
|
|
4766
|
+
};
|
|
4767
|
+
|
|
4759
4768
|
const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesignValue, definition, options, }) => {
|
|
4760
4769
|
const unboundValues = useEditorStore((state) => state.unboundValues);
|
|
4761
4770
|
const hyperlinkPattern = useEditorStore((state) => state.hyperLinkPattern);
|
|
@@ -4896,7 +4905,8 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
|
|
|
4896
4905
|
...transformVisibility(props.cfVisibility),
|
|
4897
4906
|
}), [props]);
|
|
4898
4907
|
const shouldRenderEmptySpaceWithMinSize = useMemo(() => {
|
|
4899
|
-
|
|
4908
|
+
const isAnyChildrenVisible = node.children.some((childNode) => checkIsNodeVisible(childNode, resolveDesignValue));
|
|
4909
|
+
if (isAnyChildrenVisible)
|
|
4900
4910
|
return false;
|
|
4901
4911
|
// Render with minimum height and with in those two scenarios:
|
|
4902
4912
|
if (isStructureWithRelativeHeight(node.data.blockId, cfStyles.height))
|
|
@@ -4904,7 +4914,7 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
|
|
|
4904
4914
|
if (definition?.children)
|
|
4905
4915
|
return true;
|
|
4906
4916
|
return false;
|
|
4907
|
-
}, [cfStyles.height, definition?.children, node.children
|
|
4917
|
+
}, [cfStyles.height, definition?.children, node.children, node.data.blockId, resolveDesignValue]);
|
|
4908
4918
|
// Styles that will be applied to the component element
|
|
4909
4919
|
const componentStyles = useMemo(() => ({
|
|
4910
4920
|
...cfStyles,
|
|
@@ -4925,7 +4935,8 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
|
|
|
4925
4935
|
editorProps.isEditorMode = true;
|
|
4926
4936
|
}
|
|
4927
4937
|
if (options?.enableEditorProperties?.isEmpty) {
|
|
4928
|
-
|
|
4938
|
+
const areAllChildrenHidden = node.children.every((childNode) => !checkIsNodeVisible(childNode, resolveDesignValue));
|
|
4939
|
+
editorProps.isEmpty = node.children.length === 0 || areAllChildrenHidden;
|
|
4929
4940
|
}
|
|
4930
4941
|
if (options?.enableEditorProperties?.nodeBlockId) {
|
|
4931
4942
|
editorProps.nodeBlockId = node.data.blockId;
|
|
@@ -4935,12 +4946,12 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
|
|
|
4935
4946
|
}
|
|
4936
4947
|
return editorProps;
|
|
4937
4948
|
}, [
|
|
4938
|
-
node.children.length,
|
|
4939
|
-
node.data.blockId,
|
|
4940
4949
|
options?.enableEditorProperties?.isEditorMode,
|
|
4941
4950
|
options?.enableEditorProperties?.isEmpty,
|
|
4942
4951
|
options?.enableEditorProperties?.nodeBlockId,
|
|
4943
4952
|
options?.enableCustomEditorView,
|
|
4953
|
+
node,
|
|
4954
|
+
resolveDesignValue,
|
|
4944
4955
|
]);
|
|
4945
4956
|
const componentProps = useMemo(() => {
|
|
4946
4957
|
const sharedProps = {
|
|
@@ -5212,7 +5223,8 @@ const RootRenderer = ({ inMemoryEntitiesStore, canvasMode }) => {
|
|
|
5212
5223
|
const wrappingPatternIds = rootBlockId !== ROOT_ID ? new Set([rootBlockId]) : new Set();
|
|
5213
5224
|
const entityStore = inMemoryEntitiesStore((state) => state.entityStore);
|
|
5214
5225
|
const areEntitiesFetched = inMemoryEntitiesStore((state) => state.areEntitiesFetched);
|
|
5215
|
-
|
|
5226
|
+
const isAnyNodeVisible = checkIsNodeVisible(tree.root, resolveDesignValue);
|
|
5227
|
+
return (React.createElement(React.Fragment, null, !isAnyNodeVisible ? (React.createElement(EmptyCanvasMessage, null)) : (tree.root.children.map((topLevelChildNode) => (React.createElement(EditorBlock, { key: topLevelChildNode.data.id, node: topLevelChildNode, resolveDesignValue: resolveDesignValue, wrappingPatternIds: wrappingPatternIds, entityStore: entityStore, areEntitiesFetched: areEntitiesFetched }))))));
|
|
5216
5228
|
};
|
|
5217
5229
|
|
|
5218
5230
|
const useInitializeEditor = (inMemoryEntitiesStore) => {
|