@contentful/experiences-visual-editor-react 3.0.0-alpha-20250711T0717-d5ee667.0 → 3.0.0-alpha-20250804T0859-6413b63.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 CHANGED
@@ -1444,6 +1444,17 @@ const propsToRemove = [
1444
1444
  const sanitizeNodeProps = (nodeProps) => {
1445
1445
  return omit(nodeProps, stylesToRemove, propsToRemove);
1446
1446
  };
1447
+
1448
+ /** Turn the visibility value into a style object that can be used for inline styles in React */
1449
+ const transformVisibility = (value) => {
1450
+ if (value === false) {
1451
+ return {
1452
+ display: 'none !important',
1453
+ };
1454
+ }
1455
+ // Don't explicitly set anything when visible to not overwrite values like `grid` or `flex`.
1456
+ return {};
1457
+ };
1447
1458
  const transformGridColumn = (span) => {
1448
1459
  if (!span) {
1449
1460
  return {};
@@ -2815,11 +2826,6 @@ function compareNodes({ currentNode, updatedNode, originalTree, differences = []
2815
2826
  });
2816
2827
  });
2817
2828
  map.forEach((index, key) => {
2818
- // If the node count of the entire tree doesn't signify
2819
- // a node was removed, don't add that as a diff
2820
- if (!nodeRemoved) {
2821
- return;
2822
- }
2823
2829
  // Remaining nodes in the map are removed in the second tree
2824
2830
  differences.push({
2825
2831
  type: TreeAction.REMOVE_NODE,
@@ -3171,7 +3177,7 @@ styleInject(css_248z$5);
3171
3177
  var css_248z$4 = ".cf-text{white-space:pre-line}.cf-text-link .cf-text{margin:0}";
3172
3178
  styleInject(css_248z$4);
3173
3179
 
3174
- var css_248z$3 = "div.cf-placeholder-wrapper{position:relative}img.cf-placeholder-image{background-color:var(--cf-color-gray100);height:100%;outline:2px solid rgba(var(--cf-color-gray400-rgb),.5);outline-offset:-2px;width:100%}svg.cf-placeholder-icon{height:var(--cf-text-3xl);left:50%;max-height:100%;max-width:100%;position:absolute;top:50%;transform:translate(-50%,-50%);width:var(--cf-text-3xl)}svg.cf-placeholder-icon path{fill:var(--cf-color-gray400)}";
3180
+ var css_248z$3 = "div.cf-placeholder-wrapper{outline:2px solid rgba(var(--cf-color-gray400-rgb),.5);outline-offset:-2px;overflow:hidden;position:relative}img.cf-placeholder-image{background-color:var(--cf-color-gray100);height:100%;width:100%}svg.cf-placeholder-icon{height:var(--cf-text-3xl);left:50%;max-height:100%;max-width:100%;position:absolute;top:50%;transform:translate(-50%,-50%);width:var(--cf-text-3xl)}svg.cf-placeholder-icon path{fill:var(--cf-color-gray400)}";
3175
3181
  styleInject(css_248z$3);
3176
3182
 
3177
3183
  /**
@@ -4691,7 +4697,12 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
4691
4697
  entityStore,
4692
4698
  findNodeById,
4693
4699
  ]);
4694
- const cfStyles = useMemo(() => buildCfStyles(props), [props]);
4700
+ const cfStyles = useMemo(() => ({
4701
+ ...buildCfStyles(props),
4702
+ // The visibility needs to be transformed separately as it requires
4703
+ // a special handling for preview & SSR rendering (not here though).
4704
+ ...transformVisibility(props.cfVisibility),
4705
+ }), [props]);
4695
4706
  const shouldRenderEmptySpaceWithMinSize = useMemo(() => {
4696
4707
  if (node.children.length)
4697
4708
  return false;