@contentful/experiences-visual-editor-react 1.40.0-dev-20250604T0933-fc115de.0 → 1.40.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/renderApp.js CHANGED
@@ -44027,6 +44027,7 @@ const sanitizeNodeProps = (nodeProps) => {
44027
44027
  return omit(nodeProps, stylesToRemove, propsToRemove);
44028
44028
  };
44029
44029
 
44030
+ /** Turn the visibility value into a style object that can be used for inline styles in React */
44030
44031
  const transformVisibility = (value) => {
44031
44032
  if (value === false) {
44032
44033
  return {
@@ -44195,7 +44196,6 @@ const buildStyleTag = ({ styles, nodeId }) => {
44195
44196
  const buildCfStyles = (values) => {
44196
44197
  const cssProperties = {
44197
44198
  boxSizing: 'border-box',
44198
- ...transformVisibility(values.cfVisibility),
44199
44199
  margin: values.cfMargin,
44200
44200
  padding: values.cfPadding,
44201
44201
  backgroundColor: values.cfBackgroundColor,
@@ -44853,6 +44853,17 @@ class EntityStoreBase {
44853
44853
  resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);
44854
44854
  entityToResolveFieldsFrom = entity; // we move up
44855
44855
  }
44856
+ else if (this.isAsset(fieldValue) || this.isEntry(fieldValue)) {
44857
+ resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);
44858
+ entityToResolveFieldsFrom = fieldValue; // we move up
44859
+ }
44860
+ else {
44861
+ return {
44862
+ resolvedFieldset,
44863
+ isFullyResolved: false,
44864
+ reason: `Deep path points to an invalid field value of type '${typeof fieldValue}' (value=${fieldValue})`,
44865
+ };
44866
+ }
44856
44867
  }
44857
44868
  return {
44858
44869
  resolvedFieldset,
@@ -44878,8 +44889,17 @@ class EntityStoreBase {
44878
44889
  const [leafEntity] = resolvedFieldset[resolvedFieldset.length - 1];
44879
44890
  return leafEntity;
44880
44891
  }
44881
- isAsset(entity) {
44882
- return entity.sys.type === 'Asset';
44892
+ isAsset(value) {
44893
+ return (null !== value &&
44894
+ typeof value === 'object' &&
44895
+ 'sys' in value &&
44896
+ value.sys?.type === 'Asset');
44897
+ }
44898
+ isEntry(value) {
44899
+ return (null !== value &&
44900
+ typeof value === 'object' &&
44901
+ 'sys' in value &&
44902
+ value.sys?.type === 'Entry');
44883
44903
  }
44884
44904
  getEntity(type, id) {
44885
44905
  if (type === 'Asset') {
@@ -59782,7 +59802,11 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
59782
59802
  entityStore,
59783
59803
  renderDropzone,
59784
59804
  ]);
59785
- const cfStyles = reactExports.useMemo(() => buildCfStyles(props), [props]);
59805
+ const cfStyles = reactExports.useMemo(() => ({
59806
+ ...buildCfStyles(props),
59807
+ // This is not handled by buildCfStyles as it requires separate disjunct media queries in preview mode
59808
+ ...transformVisibility(props.cfVisibility),
59809
+ }), [props]);
59786
59810
  const cfVisibility = props['cfVisibility'];
59787
59811
  const isAssemblyBlock = node.type === ASSEMBLY_BLOCK_NODE_TYPE;
59788
59812
  const isSingleColumn = node?.data.blockId === CONTENTFUL_COMPONENTS$1.columns.id;