@contentful/experiences-visual-editor-react 3.4.1-dev-20250901T1349-8f11176.0 → 3.4.1-dev-20250901T1444-62c96a8.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 +23 -31
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +23 -31
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -8,8 +8,8 @@ import { create, useStore } from 'zustand';
|
|
|
8
8
|
import { produce } from 'immer';
|
|
9
9
|
import '@contentful/rich-text-react-renderer';
|
|
10
10
|
|
|
11
|
-
var css_248z$
|
|
12
|
-
styleInject(css_248z$
|
|
11
|
+
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";
|
|
12
|
+
styleInject(css_248z$a);
|
|
13
13
|
|
|
14
14
|
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
15
15
|
const INCOMING_EVENTS$1 = {
|
|
@@ -1521,13 +1521,7 @@ function buildTemplate({ template, context, }) {
|
|
|
1521
1521
|
const stylesToKeep = ['cfImageAsset'];
|
|
1522
1522
|
const stylesToRemove = CF_STYLE_ATTRIBUTES.filter((style) => !stylesToKeep.includes(style));
|
|
1523
1523
|
// cfWrapColumns & cfWrapColumnsCount are no real style attributes as they are handled on the editor side
|
|
1524
|
-
const propsToRemove = [
|
|
1525
|
-
'cfHyperlink',
|
|
1526
|
-
'cfOpenInNewTab',
|
|
1527
|
-
'cfSsrClassName',
|
|
1528
|
-
'cfWrapColumns',
|
|
1529
|
-
'cfWrapColumnsCount',
|
|
1530
|
-
];
|
|
1524
|
+
const propsToRemove = ['cfSsrClassName', 'cfWrapColumns', 'cfWrapColumnsCount'];
|
|
1531
1525
|
const sanitizeNodeProps = (nodeProps) => {
|
|
1532
1526
|
return omit(nodeProps, stylesToRemove, propsToRemove);
|
|
1533
1527
|
};
|
|
@@ -3178,10 +3172,6 @@ const cloneDeepAsPOJO = (obj) => {
|
|
|
3178
3172
|
return JSON.parse(JSON.stringify(obj));
|
|
3179
3173
|
};
|
|
3180
3174
|
|
|
3181
|
-
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";
|
|
3182
|
-
var styles$2 = {"rootContainer":"RootRenderer-module_rootContainer__9UawM"};
|
|
3183
|
-
styleInject(css_248z$a);
|
|
3184
|
-
|
|
3185
3175
|
// TODO: In order to support integrations without React, we should extract this heavy logic into simple
|
|
3186
3176
|
// functions that we can reuse in other frameworks.
|
|
3187
3177
|
/*
|
|
@@ -4332,8 +4322,8 @@ var VisualEditorMode;
|
|
|
4332
4322
|
VisualEditorMode["InjectScript"] = "injectScript";
|
|
4333
4323
|
})(VisualEditorMode || (VisualEditorMode = {}));
|
|
4334
4324
|
|
|
4335
|
-
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}";
|
|
4336
|
-
styleInject(css_248z$2);
|
|
4325
|
+
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}";
|
|
4326
|
+
styleInject(css_248z$2$1);
|
|
4337
4327
|
|
|
4338
4328
|
const Flex = 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) => {
|
|
4339
4329
|
return (React.createElement("div", { id: id, ref: ref, style: {
|
|
@@ -4666,9 +4656,9 @@ const MissingComponentPlaceholder = ({ blockId }) => {
|
|
|
4666
4656
|
"'"));
|
|
4667
4657
|
};
|
|
4668
4658
|
|
|
4669
|
-
var css_248z$
|
|
4659
|
+
var css_248z$2 = ".EditorBlock-module_emptySlot__za-Bi {\n min-height: 80px;\n min-width: 80px;\n}\n";
|
|
4670
4660
|
var styles$1 = {"emptySlot":"EditorBlock-module_emptySlot__za-Bi"};
|
|
4671
|
-
styleInject(css_248z$
|
|
4661
|
+
styleInject(css_248z$2);
|
|
4672
4662
|
|
|
4673
4663
|
const useComponentRegistration = (node) => {
|
|
4674
4664
|
return useMemo(() => {
|
|
@@ -4932,23 +4922,23 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
|
|
|
4932
4922
|
'data-cf-node-block-type': node.type,
|
|
4933
4923
|
className: props.cfSsrClassName ?? cfCsrClassName,
|
|
4934
4924
|
};
|
|
4935
|
-
// Only pass `editorMode` and `node` to structure components and assembly root nodes.
|
|
4936
|
-
const isStructureComponent = isContentfulStructureComponent(node.data.blockId);
|
|
4937
|
-
if (isStructureComponent) {
|
|
4938
|
-
return {
|
|
4939
|
-
...sharedProps,
|
|
4940
|
-
editorMode: true,
|
|
4941
|
-
node,
|
|
4942
|
-
};
|
|
4943
|
-
}
|
|
4944
4925
|
return {
|
|
4945
4926
|
...sharedProps,
|
|
4946
4927
|
// Allows custom components to render differently in the editor. This needs to be activated
|
|
4947
4928
|
// through options as the component has to be aware of this prop to not cause any React warnings.
|
|
4948
4929
|
...(options?.enableCustomEditorView ? { isInExpEditorMode: true } : {}),
|
|
4930
|
+
...(options?.editorProperties?.isEditorMode ? { isEditorMode: true } : {}),
|
|
4931
|
+
...(options?.editorProperties?.node ? { node } : {}),
|
|
4949
4932
|
...sanitizeNodeProps(props),
|
|
4950
4933
|
};
|
|
4951
|
-
}, [
|
|
4934
|
+
}, [
|
|
4935
|
+
cfCsrClassName,
|
|
4936
|
+
node,
|
|
4937
|
+
options?.editorProperties?.isEditorMode,
|
|
4938
|
+
options?.editorProperties?.node,
|
|
4939
|
+
options?.enableCustomEditorView,
|
|
4940
|
+
props,
|
|
4941
|
+
]);
|
|
4952
4942
|
return { componentProps };
|
|
4953
4943
|
};
|
|
4954
4944
|
|
|
@@ -4993,9 +4983,9 @@ const RegistrationComponent = ({ node, resolveDesignValue, componentRegistration
|
|
|
4993
4983
|
return React.createElement(ImportedComponentErrorBoundary, { componentId: node.data.blockId }, React.createElement(componentRegistration.component, { ...componentProps, ...slotNodes }, children));
|
|
4994
4984
|
};
|
|
4995
4985
|
|
|
4996
|
-
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";
|
|
4986
|
+
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";
|
|
4997
4987
|
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"};
|
|
4998
|
-
styleInject(css_248z);
|
|
4988
|
+
styleInject(css_248z$1);
|
|
4999
4989
|
|
|
5000
4990
|
const EmptyCanvasMessage = () => {
|
|
5001
4991
|
return (React.createElement("div", { className: styles['empty-canvas-container'], "data-type": "empty-container" },
|
|
@@ -5188,6 +5178,9 @@ function findAllImages() {
|
|
|
5188
5178
|
return Array.from(document.querySelectorAll('img'));
|
|
5189
5179
|
}
|
|
5190
5180
|
|
|
5181
|
+
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";
|
|
5182
|
+
styleInject(css_248z);
|
|
5183
|
+
|
|
5191
5184
|
const RootRenderer = ({ inMemoryEntitiesStore, canvasMode }) => {
|
|
5192
5185
|
useEditorSubscriber(inMemoryEntitiesStore);
|
|
5193
5186
|
const tree = useTreeStore((state) => state.tree);
|
|
@@ -5200,8 +5193,7 @@ const RootRenderer = ({ inMemoryEntitiesStore, canvasMode }) => {
|
|
|
5200
5193
|
const wrappingPatternIds = rootBlockId !== ROOT_ID ? new Set([rootBlockId]) : new Set();
|
|
5201
5194
|
const entityStore = inMemoryEntitiesStore((state) => state.entityStore);
|
|
5202
5195
|
const areEntitiesFetched = inMemoryEntitiesStore((state) => state.areEntitiesFetched);
|
|
5203
|
-
return (React.createElement(React.Fragment, null,
|
|
5204
|
-
React.createElement("div", { "data-ctfl-root": true, className: styles$2.rootContainer }, !tree.root.children.length ? (React.createElement(EmptyCanvasMessage, null)) : (tree.root.children.map((topLevelChildNode) => (React.createElement(EditorBlock, { key: topLevelChildNode.data.id, node: topLevelChildNode, resolveDesignValue: resolveDesignValue, wrappingPatternIds: wrappingPatternIds, entityStore: entityStore, areEntitiesFetched: areEntitiesFetched })))))));
|
|
5196
|
+
return (React.createElement(React.Fragment, null, !tree.root.children.length ? (React.createElement(EmptyCanvasMessage, null)) : (tree.root.children.map((topLevelChildNode) => (React.createElement(EditorBlock, { key: topLevelChildNode.data.id, node: topLevelChildNode, resolveDesignValue: resolveDesignValue, wrappingPatternIds: wrappingPatternIds, entityStore: entityStore, areEntitiesFetched: areEntitiesFetched }))))));
|
|
5205
5197
|
};
|
|
5206
5198
|
|
|
5207
5199
|
const useInitializeEditor = (inMemoryEntitiesStore) => {
|