@contentful/experiences-visual-editor-react 3.0.0-alpha-20250709T0751-bcbfd82.0 → 3.0.0-alpha-20250801T0844-68b7839.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/renderApp.js CHANGED
@@ -44882,6 +44882,17 @@ const propsToRemove = [
44882
44882
  const sanitizeNodeProps = (nodeProps) => {
44883
44883
  return omit(nodeProps, stylesToRemove, propsToRemove);
44884
44884
  };
44885
+
44886
+ /** Turn the visibility value into a style object that can be used for inline styles in React */
44887
+ const transformVisibility = (value) => {
44888
+ if (value === false) {
44889
+ return {
44890
+ display: 'none !important',
44891
+ };
44892
+ }
44893
+ // Don't explicitly set anything when visible to not overwrite values like `grid` or `flex`.
44894
+ return {};
44895
+ };
44885
44896
  const transformGridColumn = (span) => {
44886
44897
  if (!span) {
44887
44898
  return {};
@@ -50061,7 +50072,12 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
50061
50072
  entityStore,
50062
50073
  findNodeById,
50063
50074
  ]);
50064
- const cfStyles = reactExports.useMemo(() => buildCfStyles(props), [props]);
50075
+ const cfStyles = reactExports.useMemo(() => ({
50076
+ ...buildCfStyles(props),
50077
+ // The visibility needs to be transformed separately as it requires
50078
+ // a special handling for preview & SSR rendering (not here though).
50079
+ ...transformVisibility(props.cfVisibility),
50080
+ }), [props]);
50065
50081
  const shouldRenderEmptySpaceWithMinSize = reactExports.useMemo(() => {
50066
50082
  if (node.children.length)
50067
50083
  return false;
@@ -50254,6 +50270,8 @@ const useCanvasGeometryUpdates = ({ tree }) => {
50254
50270
  // Handling DOM mutations
50255
50271
  reactExports.useEffect(() => {
50256
50272
  const observer = new MutationObserver(() => debouncedUpdateGeometry(treeRef.current, 'mutation'));
50273
+ // send initial geometry in case the tree is empty
50274
+ debouncedUpdateGeometry(treeRef.current, 'mutation');
50257
50275
  observer.observe(document.documentElement, {
50258
50276
  childList: true,
50259
50277
  subtree: true,