@contentful/experiences-visual-editor-react 3.4.1-dev-20250901T1444-72c17a2.0 → 3.5.0-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
@@ -37,8 +37,8 @@ function styleInject(css, ref) {
37
37
  }
38
38
  }
39
39
 
40
- var css_248z$b = "html,\nbody {\n margin: 0;\n padding: 0;\n}\n\n/*\n * All of these variables are tokens from Forma-36 and should not be adjusted as these\n * are global variables that may affect multiple places.\n * As our customers may use other design libraries, we try to avoid overlapping global\n * variables by always using the prefix `--exp-builder-` inside this SDK.\n */\n\n:root {\n /* Color tokens from Forma 36: https://f36.contentful.com/tokens/color-system */\n --exp-builder-blue100: #e8f5ff;\n --exp-builder-blue200: #ceecff;\n --exp-builder-blue300: #98cbff;\n --exp-builder-blue400: #40a0ff;\n --exp-builder-blue500: #036fe3;\n --exp-builder-blue600: #0059c8;\n --exp-builder-blue700: #0041ab;\n --exp-builder-blue800: #003298;\n --exp-builder-blue900: #002a8e;\n --exp-builder-gray100: #f7f9fa;\n --exp-builder-gray200: #e7ebee;\n --exp-builder-gray300: #cfd9e0;\n --exp-builder-gray400: #aec1cc;\n --exp-builder-gray500: #67728a;\n --exp-builder-gray600: #5a657c;\n --exp-builder-gray700: #414d63;\n --exp-builder-gray800: #1b273a;\n --exp-builder-gray900: #111b2b;\n --exp-builder-purple600: #6c3ecf;\n --exp-builder-red200: #ffe0e0;\n --exp-builder-red800: #7f0010;\n --exp-builder-color-white: #ffffff;\n --exp-builder-glow-primary: 0px 0px 0px 3px #e8f5ff;\n\n /* RGB colors for applying opacity */\n --exp-builder-blue100-rgb: 232, 245, 255;\n --exp-builder-blue300-rgb: 152, 203, 255;\n\n /* Spacing tokens from Forma 36: https://f36.contentful.com/tokens/spacing */\n --exp-builder-spacing-s: 0.75rem;\n --exp-builder-spacing-2xs: 0.25rem;\n\n /* Typography tokens from Forma 36: https://f36.contentful.com/tokens/typography */\n --exp-builder-font-size-l: 1rem;\n --exp-builder-font-size-m: 0.875rem;\n --exp-builder-font-stack-primary: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial,\n sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;\n --exp-builder-line-height-condensed: 1.25;\n}\n";
41
- styleInject(css_248z$b);
40
+ var css_248z$a = "html,\nbody {\n margin: 0;\n padding: 0;\n}\n\n/*\n * All of these variables are tokens from Forma-36 and should not be adjusted as these\n * are global variables that may affect multiple places.\n * As our customers may use other design libraries, we try to avoid overlapping global\n * variables by always using the prefix `--exp-builder-` inside this SDK.\n */\n\n:root {\n /* Color tokens from Forma 36: https://f36.contentful.com/tokens/color-system */\n --exp-builder-blue100: #e8f5ff;\n --exp-builder-blue200: #ceecff;\n --exp-builder-blue300: #98cbff;\n --exp-builder-blue400: #40a0ff;\n --exp-builder-blue500: #036fe3;\n --exp-builder-blue600: #0059c8;\n --exp-builder-blue700: #0041ab;\n --exp-builder-blue800: #003298;\n --exp-builder-blue900: #002a8e;\n --exp-builder-gray100: #f7f9fa;\n --exp-builder-gray200: #e7ebee;\n --exp-builder-gray300: #cfd9e0;\n --exp-builder-gray400: #aec1cc;\n --exp-builder-gray500: #67728a;\n --exp-builder-gray600: #5a657c;\n --exp-builder-gray700: #414d63;\n --exp-builder-gray800: #1b273a;\n --exp-builder-gray900: #111b2b;\n --exp-builder-purple600: #6c3ecf;\n --exp-builder-red200: #ffe0e0;\n --exp-builder-red800: #7f0010;\n --exp-builder-color-white: #ffffff;\n --exp-builder-glow-primary: 0px 0px 0px 3px #e8f5ff;\n\n /* RGB colors for applying opacity */\n --exp-builder-blue100-rgb: 232, 245, 255;\n --exp-builder-blue300-rgb: 152, 203, 255;\n\n /* Spacing tokens from Forma 36: https://f36.contentful.com/tokens/spacing */\n --exp-builder-spacing-s: 0.75rem;\n --exp-builder-spacing-2xs: 0.25rem;\n\n /* Typography tokens from Forma 36: https://f36.contentful.com/tokens/typography */\n --exp-builder-font-size-l: 1rem;\n --exp-builder-font-size-m: 0.875rem;\n --exp-builder-font-stack-primary: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial,\n sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;\n --exp-builder-line-height-condensed: 1.25;\n}\n";
41
+ styleInject(css_248z$a);
42
42
 
43
43
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
44
44
 
@@ -44227,6 +44227,7 @@ const BreakpointSchema$1 = z
44227
44227
  const BaseComponentTreeNodeSchema$1 = z.object({
44228
44228
  id: ComponentTreeNodeIdSchema$1.optional(),
44229
44229
  definitionId: DefinitionPropertyKeySchema$1,
44230
+ prebindingId: z.string().optional(),
44230
44231
  displayName: z.string().optional(),
44231
44232
  slotId: z.string().optional(),
44232
44233
  variables: z.record(propertyKeySchema$1, ComponentPropertyValueSchema$1),
@@ -47342,10 +47343,6 @@ const cloneDeepAsPOJO = (obj) => {
47342
47343
  return JSON.parse(JSON.stringify(obj));
47343
47344
  };
47344
47345
 
47345
- var css_248z$a = ".RootRenderer-module_rootContainer__9UawM {\n position: relative;\n display: flex;\n flex-direction: column;\n}\n\nbody {\n margin: 0;\n}\n\nhtml {\n -ms-overflow-style: none; /* Internet Explorer 10+ */\n scrollbar-width: none; /* Firefox */\n}\n\nhtml::-webkit-scrollbar {\n display: none;\n}\n";
47346
- var styles$2 = {"rootContainer":"RootRenderer-module_rootContainer__9UawM"};
47347
- styleInject(css_248z$a);
47348
-
47349
47346
  // TODO: In order to support integrations without React, we should extract this heavy logic into simple
47350
47347
  // functions that we can reuse in other frameworks.
47351
47348
  /*
@@ -48977,6 +48974,7 @@ const BreakpointSchema = z
48977
48974
  const BaseComponentTreeNodeSchema = z.object({
48978
48975
  id: ComponentTreeNodeIdSchema.optional(),
48979
48976
  definitionId: DefinitionPropertyKeySchema,
48977
+ prebindingId: z.string().optional(),
48980
48978
  displayName: z.string().optional(),
48981
48979
  slotId: z.string().optional(),
48982
48980
  variables: z.record(propertyKeySchema, ComponentPropertyValueSchema),
@@ -49722,8 +49720,8 @@ var VisualEditorMode;
49722
49720
  VisualEditorMode["InjectScript"] = "injectScript";
49723
49721
  })(VisualEditorMode || (VisualEditorMode = {}));
49724
49722
 
49725
- var css_248z$2 = ".contentful-container{display:flex;pointer-events:all;position:relative}.contentful-container::-webkit-scrollbar{display:none}.cf-container-wrapper{position:relative;width:100%}.contentful-container:after{align-items:center;bottom:0;color:var(--exp-builder-gray400);content:\"\";display:block;display:flex;font-family:var(--exp-builder-font-stack-primary);font-size:12px;justify-content:center;left:0;overflow-x:clip;pointer-events:none;position:absolute;right:0;top:0;z-index:1}.contentful-section-label:after{content:\"Section\"}.contentful-container-label:after{content:\"Container\"}.contentful-container-link,.contentful-container-link:active,.contentful-container-link:focus-visible,.contentful-container-link:hover,.contentful-container-link:read-write,.contentful-container-link:visited{color:inherit;outline:unset;text-decoration:unset}";
49726
- styleInject(css_248z$2);
49723
+ var css_248z$2$1 = ".contentful-container{display:flex;pointer-events:all;position:relative}.contentful-container::-webkit-scrollbar{display:none}.cf-container-wrapper{position:relative;width:100%}.contentful-container:after{align-items:center;bottom:0;color:var(--exp-builder-gray400);content:\"\";display:block;display:flex;font-family:var(--exp-builder-font-stack-primary);font-size:12px;justify-content:center;left:0;overflow-x:clip;pointer-events:none;position:absolute;right:0;top:0;z-index:1}.contentful-section-label:after{content:\"Section\"}.contentful-container-label:after{content:\"Container\"}.contentful-container-link,.contentful-container-link:active,.contentful-container-link:focus-visible,.contentful-container-link:hover,.contentful-container-link:read-write,.contentful-container-link:visited{color:inherit;outline:unset;text-decoration:unset}";
49724
+ styleInject(css_248z$2$1);
49727
49725
 
49728
49726
  const Flex = reactExports.forwardRef(({ id, children, onMouseEnter, onMouseUp, onMouseLeave, onMouseDown, onClick, flex, flexBasis, flexShrink, flexDirection, gap, justifyContent, justifyItems, justifySelf, alignItems, alignSelf, alignContent, order, flexWrap, flexGrow, className, cssStyles, ...props }, ref) => {
49729
49727
  return (React$1.createElement("div", { id: id, ref: ref, style: {
@@ -50056,9 +50054,9 @@ const MissingComponentPlaceholder = ({ blockId }) => {
50056
50054
  "'"));
50057
50055
  };
50058
50056
 
50059
- var css_248z$1 = ".EditorBlock-module_emptySlot__za-Bi {\n min-height: 80px;\n min-width: 80px;\n}\n";
50057
+ var css_248z$2 = ".EditorBlock-module_emptySlot__za-Bi {\n min-height: 80px;\n min-width: 80px;\n}\n";
50060
50058
  var styles$1 = {"emptySlot":"EditorBlock-module_emptySlot__za-Bi"};
50061
- styleInject(css_248z$1);
50059
+ styleInject(css_248z$2);
50062
50060
 
50063
50061
  const useComponentRegistration = (node) => {
50064
50062
  return reactExports.useMemo(() => {
@@ -50315,6 +50313,31 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
50315
50313
  styles: componentStyles,
50316
50314
  nodeId: node.data.id,
50317
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
+ ]);
50318
50341
  const componentProps = reactExports.useMemo(() => {
50319
50342
  const sharedProps = {
50320
50343
  'data-cf-node-id': node.data.id,
@@ -50324,21 +50347,10 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
50324
50347
  };
50325
50348
  return {
50326
50349
  ...sharedProps,
50327
- // Allows custom components to render differently in the editor. This needs to be activated
50328
- // through options as the component has to be aware of this prop to not cause any React warnings.
50329
- ...(options?.enableCustomEditorView ? { isInExpEditorMode: true } : {}),
50330
- ...(options?.editorProperties?.isEditorMode ? { isEditorMode: true } : {}),
50331
- ...(options?.editorProperties?.node ? { node } : {}),
50350
+ ...editorProps,
50332
50351
  ...sanitizeNodeProps(props),
50333
50352
  };
50334
- }, [
50335
- cfCsrClassName,
50336
- node,
50337
- options?.editorProperties?.isEditorMode,
50338
- options?.editorProperties?.node,
50339
- options?.enableCustomEditorView,
50340
- props,
50341
- ]);
50353
+ }, [cfCsrClassName, editorProps, node, props]);
50342
50354
  return { componentProps };
50343
50355
  };
50344
50356
 
@@ -50383,9 +50395,9 @@ const RegistrationComponent = ({ node, resolveDesignValue, componentRegistration
50383
50395
  return React$1.createElement(ImportedComponentErrorBoundary, { componentId: node.data.blockId }, React$1.createElement(componentRegistration.component, { ...componentProps, ...slotNodes }, children));
50384
50396
  };
50385
50397
 
50386
- var css_248z = ".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";
50398
+ 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";
50387
50399
  var styles = {"empty-canvas-container":"EmptyCanvasMessage-module_empty-canvas-container__7K-0l","empty-canvas-icon":"EmptyCanvasMessage-module_empty-canvas-icon__EztFr","empty-canvas-label":"EmptyCanvasMessage-module_empty-canvas-label__cbIrR"};
50388
- styleInject(css_248z);
50400
+ styleInject(css_248z$1);
50389
50401
 
50390
50402
  const EmptyCanvasMessage = () => {
50391
50403
  return (React$1.createElement("div", { className: styles['empty-canvas-container'], "data-type": "empty-container" },
@@ -50578,6 +50590,9 @@ function findAllImages() {
50578
50590
  return Array.from(document.querySelectorAll('img'));
50579
50591
  }
50580
50592
 
50593
+ var css_248z = "body {\n margin: 0;\n}\n\nhtml {\n -ms-overflow-style: none; /* Internet Explorer 10+ */\n scrollbar-width: none; /* Firefox */\n}\n\nhtml::-webkit-scrollbar {\n display: none;\n}\n";
50594
+ styleInject(css_248z);
50595
+
50581
50596
  const RootRenderer = ({ inMemoryEntitiesStore, canvasMode }) => {
50582
50597
  useEditorSubscriber(inMemoryEntitiesStore);
50583
50598
  const tree = useTreeStore((state) => state.tree);
@@ -50590,8 +50605,7 @@ const RootRenderer = ({ inMemoryEntitiesStore, canvasMode }) => {
50590
50605
  const wrappingPatternIds = rootBlockId !== ROOT_ID ? new Set([rootBlockId]) : new Set();
50591
50606
  const entityStore = inMemoryEntitiesStore((state) => state.entityStore);
50592
50607
  const areEntitiesFetched = inMemoryEntitiesStore((state) => state.areEntitiesFetched);
50593
- return (React$1.createElement(React$1.Fragment, null,
50594
- React$1.createElement("div", { "data-ctfl-root": true, className: styles$2.rootContainer }, !tree.root.children.length ? (React$1.createElement(EmptyCanvasMessage, null)) : (tree.root.children.map((topLevelChildNode) => (React$1.createElement(EditorBlock, { key: topLevelChildNode.data.id, node: topLevelChildNode, resolveDesignValue: resolveDesignValue, wrappingPatternIds: wrappingPatternIds, entityStore: entityStore, areEntitiesFetched: areEntitiesFetched })))))));
50608
+ return (React$1.createElement(React$1.Fragment, null, !tree.root.children.length ? (React$1.createElement(EmptyCanvasMessage, null)) : (tree.root.children.map((topLevelChildNode) => (React$1.createElement(EditorBlock, { key: topLevelChildNode.data.id, node: topLevelChildNode, resolveDesignValue: resolveDesignValue, wrappingPatternIds: wrappingPatternIds, entityStore: entityStore, areEntitiesFetched: areEntitiesFetched }))))));
50595
50609
  };
50596
50610
 
50597
50611
  const useInitializeEditor = (inMemoryEntitiesStore) => {