@contentful/experiences-visual-editor-react 1.40.3-dev-20250611T0948-7389339.0 → 1.41.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/index.js +40 -29
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +40 -29
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/renderApp.js
CHANGED
|
@@ -43345,7 +43345,6 @@ const ComponentPropertyValueSchema$1 = z.discriminatedUnion('type', [
|
|
|
43345
43345
|
const PatternPropertySchema$1 = z.object({
|
|
43346
43346
|
type: z.literal('BoundValue'),
|
|
43347
43347
|
path: z.string(),
|
|
43348
|
-
contentType: z.string(),
|
|
43349
43348
|
});
|
|
43350
43349
|
const PatternPropertiesSchema$1 = z.record(propertyKeySchema$1, PatternPropertySchema$1);
|
|
43351
43350
|
const BreakpointSchema$1 = z
|
|
@@ -44196,7 +44195,6 @@ const buildStyleTag = ({ styles, nodeId }) => {
|
|
|
44196
44195
|
*/
|
|
44197
44196
|
const buildCfStyles = (values) => {
|
|
44198
44197
|
const cssProperties = {
|
|
44199
|
-
boxSizing: 'border-box',
|
|
44200
44198
|
margin: values.cfMargin,
|
|
44201
44199
|
padding: values.cfPadding,
|
|
44202
44200
|
backgroundColor: values.cfBackgroundColor,
|
|
@@ -44465,18 +44463,41 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
44465
44463
|
return asset.fields.file?.url;
|
|
44466
44464
|
};
|
|
44467
44465
|
|
|
44466
|
+
const isAsset = (value) => {
|
|
44467
|
+
return (null !== value &&
|
|
44468
|
+
typeof value === 'object' &&
|
|
44469
|
+
'sys' in value &&
|
|
44470
|
+
value.sys?.type === 'Asset');
|
|
44471
|
+
};
|
|
44472
|
+
const isEntry = (value) => {
|
|
44473
|
+
return (null !== value &&
|
|
44474
|
+
typeof value === 'object' &&
|
|
44475
|
+
'sys' in value &&
|
|
44476
|
+
value.sys?.type === 'Entry');
|
|
44477
|
+
};
|
|
44478
|
+
|
|
44468
44479
|
function getResolvedEntryFromLink(entryOrAsset, path, entityStore) {
|
|
44469
|
-
if (entryOrAsset
|
|
44480
|
+
if (isAsset(entryOrAsset)) {
|
|
44470
44481
|
return entryOrAsset;
|
|
44471
44482
|
}
|
|
44483
|
+
else if (!isEntry(entryOrAsset)) {
|
|
44484
|
+
throw new Error(`Expected an Entry or Asset, but got: ${JSON.stringify(entryOrAsset)}`);
|
|
44485
|
+
}
|
|
44472
44486
|
const value = get(entryOrAsset, path.split('/').slice(2, -1));
|
|
44473
|
-
|
|
44474
|
-
|
|
44475
|
-
|
|
44487
|
+
let resolvedEntity;
|
|
44488
|
+
if (isAsset(value) || isEntry(value)) {
|
|
44489
|
+
// In some cases, reference fields are already resolved
|
|
44490
|
+
resolvedEntity = value;
|
|
44491
|
+
}
|
|
44492
|
+
else if (value?.sys.type === 'Link') {
|
|
44493
|
+
// Look up the reference in the entity store
|
|
44494
|
+
resolvedEntity = entityStore.getEntityFromLink(value);
|
|
44495
|
+
if (!resolvedEntity) {
|
|
44496
|
+
return;
|
|
44497
|
+
}
|
|
44476
44498
|
}
|
|
44477
|
-
|
|
44478
|
-
|
|
44479
|
-
if (!resolvedEntity) {
|
|
44499
|
+
else {
|
|
44500
|
+
console.warn(`Expected a link to a reference, but got: ${JSON.stringify(value)}`);
|
|
44480
44501
|
return;
|
|
44481
44502
|
}
|
|
44482
44503
|
//resolve any embedded links - we currently only support 2 levels deep
|
|
@@ -44731,10 +44752,13 @@ class EntityStoreBase {
|
|
|
44731
44752
|
}
|
|
44732
44753
|
entity = resolvedEntity;
|
|
44733
44754
|
}
|
|
44734
|
-
else {
|
|
44755
|
+
else if (isAsset(linkOrEntryOrAsset) || isEntry(linkOrEntryOrAsset)) {
|
|
44735
44756
|
// We already have the complete entity in preview & delivery (resolved by the CMA client)
|
|
44736
44757
|
entity = linkOrEntryOrAsset;
|
|
44737
44758
|
}
|
|
44759
|
+
else {
|
|
44760
|
+
throw new Error(`Unexpected object when resolving entity: ${JSON.stringify(linkOrEntryOrAsset)}`);
|
|
44761
|
+
}
|
|
44738
44762
|
return entity;
|
|
44739
44763
|
}
|
|
44740
44764
|
/**
|
|
@@ -44780,14 +44804,14 @@ class EntityStoreBase {
|
|
|
44780
44804
|
};
|
|
44781
44805
|
}
|
|
44782
44806
|
addEntity(entity) {
|
|
44783
|
-
if (
|
|
44807
|
+
if (isAsset(entity)) {
|
|
44784
44808
|
this.assetMap.set(entity.sys.id, entity);
|
|
44785
44809
|
}
|
|
44786
|
-
else if (
|
|
44810
|
+
else if (isEntry(entity)) {
|
|
44787
44811
|
this.entryMap.set(entity.sys.id, entity);
|
|
44788
44812
|
}
|
|
44789
44813
|
else {
|
|
44790
|
-
|
|
44814
|
+
throw new Error(`Attempted to add an entity to the store that is neither Asset nor Entry: '${JSON.stringify(entity)}'`);
|
|
44791
44815
|
}
|
|
44792
44816
|
}
|
|
44793
44817
|
async fetchAsset(id) {
|
|
@@ -44857,7 +44881,7 @@ class EntityStoreBase {
|
|
|
44857
44881
|
resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);
|
|
44858
44882
|
entityToResolveFieldsFrom = entity; // we move up
|
|
44859
44883
|
}
|
|
44860
|
-
else if (
|
|
44884
|
+
else if (isAsset(fieldValue) || isEntry(fieldValue)) {
|
|
44861
44885
|
resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);
|
|
44862
44886
|
entityToResolveFieldsFrom = fieldValue; // we move up
|
|
44863
44887
|
}
|
|
@@ -44893,18 +44917,6 @@ class EntityStoreBase {
|
|
|
44893
44917
|
const [leafEntity] = resolvedFieldset[resolvedFieldset.length - 1];
|
|
44894
44918
|
return leafEntity;
|
|
44895
44919
|
}
|
|
44896
|
-
isAsset(value) {
|
|
44897
|
-
return (null !== value &&
|
|
44898
|
-
typeof value === 'object' &&
|
|
44899
|
-
'sys' in value &&
|
|
44900
|
-
value.sys?.type === 'Asset');
|
|
44901
|
-
}
|
|
44902
|
-
isEntry(value) {
|
|
44903
|
-
return (null !== value &&
|
|
44904
|
-
typeof value === 'object' &&
|
|
44905
|
-
'sys' in value &&
|
|
44906
|
-
value.sys?.type === 'Entry');
|
|
44907
|
-
}
|
|
44908
44920
|
getEntity(type, id) {
|
|
44909
44921
|
if (type === 'Asset') {
|
|
44910
44922
|
return this.assetMap.get(id);
|
|
@@ -58483,7 +58495,6 @@ const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
|
|
|
58483
58495
|
const PatternPropertySchema = z.object({
|
|
58484
58496
|
type: z.literal('BoundValue'),
|
|
58485
58497
|
path: z.string(),
|
|
58486
|
-
contentType: z.string(),
|
|
58487
58498
|
});
|
|
58488
58499
|
const PatternPropertiesSchema = z.record(propertyKeySchema, PatternPropertySchema);
|
|
58489
58500
|
const BreakpointSchema = z
|
|
@@ -58815,7 +58826,7 @@ var VisualEditorMode;
|
|
|
58815
58826
|
VisualEditorMode["InjectScript"] = "injectScript";
|
|
58816
58827
|
})(VisualEditorMode || (VisualEditorMode = {}));
|
|
58817
58828
|
|
|
58818
|
-
var css_248z$2$1 = ".contentful-container {\n position: relative;\n display: flex;\n
|
|
58829
|
+
var css_248z$2$1 = ".contentful-container {\n position: relative;\n display: flex;\n pointer-events: all;\n}\n\n.contentful-container::-webkit-scrollbar {\n display: none; /* Safari and Chrome */\n}\n\n.cf-single-column-wrapper {\n position: relative;\n}\n\n.cf-container-wrapper {\n position: relative;\n width: 100%;\n}\n\n.contentful-container:after {\n content: '';\n display: block;\n position: absolute;\n pointer-events: none;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n overflow-x: clip;\n font-family: var(--exp-builder-font-stack-primary);\n font-size: 12px;\n color: var(--exp-builder-gray400);\n z-index: 1;\n}\n\n.contentful-section-label:after {\n content: 'Section';\n}\n\n.contentful-container-label:after {\n content: 'Container';\n}\n\n/* used by ContentfulSectionAsHyperlink.tsx */\n\n.contentful-container-link,\n.contentful-container-link:active,\n.contentful-container-link:visited,\n.contentful-container-link:hover,\n.contentful-container-link:read-write,\n.contentful-container-link:focus-visible {\n color: inherit;\n text-decoration: unset;\n outline: unset;\n}\n";
|
|
58819
58830
|
styleInject(css_248z$2$1);
|
|
58820
58831
|
|
|
58821
58832
|
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) => {
|
|
@@ -60553,7 +60564,7 @@ function useSingleColumn(node, resolveDesignValue) {
|
|
|
60553
60564
|
return false;
|
|
60554
60565
|
}
|
|
60555
60566
|
const { cfWrapColumns } = parentNode.data.props;
|
|
60556
|
-
if (cfWrapColumns
|
|
60567
|
+
if (cfWrapColumns?.type !== 'DesignValue') {
|
|
60557
60568
|
return false;
|
|
60558
60569
|
}
|
|
60559
60570
|
return resolveDesignValue(cfWrapColumns.valuesByBreakpoint);
|