@contentful/experiences-visual-editor-react 3.5.0-dev-20250902T0640-ab0b512.0 → 3.6.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
@@ -50313,6 +50313,31 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
50313
50313
  styles: componentStyles,
50314
50314
  nodeId: node.data.id,
50315
50315
  });
50316
+ // Allows custom components to render differently in the editor. This needs to be activated
50317
+ // through registry options as the component has to be aware of this prop to not cause any React warnings.
50318
+ const editorProps = reactExports.useMemo(() => {
50319
+ const editorProps = {};
50320
+ if (options?.enableEditorProperties?.isEditorMode) {
50321
+ editorProps.isEditorMode = true;
50322
+ }
50323
+ if (options?.enableEditorProperties?.isEmpty) {
50324
+ editorProps.isEmpty = node.children.length === 0;
50325
+ }
50326
+ if (options?.enableEditorProperties?.nodeBlockId) {
50327
+ editorProps.nodeBlockId = node.data.blockId;
50328
+ }
50329
+ if (options?.enableCustomEditorView) {
50330
+ editorProps.isInExpEditorMode = true;
50331
+ }
50332
+ return editorProps;
50333
+ }, [
50334
+ node.children.length,
50335
+ node.data.blockId,
50336
+ options?.enableEditorProperties?.isEditorMode,
50337
+ options?.enableEditorProperties?.isEmpty,
50338
+ options?.enableEditorProperties?.nodeBlockId,
50339
+ options?.enableCustomEditorView,
50340
+ ]);
50316
50341
  const componentProps = reactExports.useMemo(() => {
50317
50342
  const sharedProps = {
50318
50343
  'data-cf-node-id': node.data.id,
@@ -50321,22 +50346,12 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
50321
50346
  className: props.cfSsrClassName ?? cfCsrClassName,
50322
50347
  };
50323
50348
  return {
50324
- ...sharedProps,
50325
- // Allows custom components to render differently in the editor. This needs to be activated
50326
- // through options as the component has to be aware of this prop to not cause any React warnings.
50327
- ...(options?.enableCustomEditorView ? { isInExpEditorMode: true } : {}),
50328
- ...(options?.editorProperties?.isEditorMode ? { isEditorMode: true } : {}),
50329
- ...(options?.editorProperties?.node ? { node } : {}),
50330
50349
  ...sanitizeNodeProps(props),
50350
+ // Add those at last to not let them get overwritten by custom properties
50351
+ ...editorProps,
50352
+ ...sharedProps,
50331
50353
  };
50332
- }, [
50333
- cfCsrClassName,
50334
- node,
50335
- options?.editorProperties?.isEditorMode,
50336
- options?.editorProperties?.node,
50337
- options?.enableCustomEditorView,
50338
- props,
50339
- ]);
50354
+ }, [cfCsrClassName, editorProps, node, props]);
50340
50355
  return { componentProps };
50341
50356
  };
50342
50357
 
@@ -50378,7 +50393,9 @@ const RegistrationComponent = ({ node, resolveDesignValue, componentRegistration
50378
50393
  entityStore,
50379
50394
  areEntitiesFetched,
50380
50395
  });
50381
- return React$1.createElement(ImportedComponentErrorBoundary, { componentId: node.data.blockId }, React$1.createElement(componentRegistration.component, { ...componentProps, ...slotNodes }, children));
50396
+ return React$1.createElement(ImportedComponentErrorBoundary, { componentId: node.data.blockId }, React$1.createElement(componentRegistration.component, { ...componentProps, ...slotNodes },
50397
+ // If there are no children, a custom property called `children` can be passed through to the custom component
50398
+ ...(children ?? [])));
50382
50399
  };
50383
50400
 
50384
50401
  var css_248z$1 = ".EmptyCanvasMessage-module_empty-canvas-container__7K-0l {\n height: 200px;\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n flex-direction: row;\n transition: all 0.2s;\n color: var(--exp-builder-gray400);\n font-size: var(--exp-builder-font-size-l);\n font-family: var(--exp-builder-font-stack-primary);\n outline: 2px dashed var(--exp-builder-gray400);\n outline-offset: -2px;\n}\n\n.EmptyCanvasMessage-module_empty-canvas-icon__EztFr rect {\n fill: var(--exp-builder-gray400);\n}\n\n.EmptyCanvasMessage-module_empty-canvas-label__cbIrR {\n margin-left: var(--exp-builder-spacing-s);\n}\n";