@contentful/experiences-visual-editor-react 3.3.1-dev-20250825T1222-bc8206a.0 → 3.4.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 +32 -3
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +32 -3
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/renderApp.js
CHANGED
|
@@ -44475,6 +44475,18 @@ var CodeNames$1;
|
|
|
44475
44475
|
CodeNames["Custom"] = "custom";
|
|
44476
44476
|
})(CodeNames$1 || (CodeNames$1 = {}));
|
|
44477
44477
|
|
|
44478
|
+
const sdkOptionsRegistry = {};
|
|
44479
|
+
/**
|
|
44480
|
+
* Used inside defineComponents to forward registry arguments to this registry
|
|
44481
|
+
* of SDK options.
|
|
44482
|
+
*/
|
|
44483
|
+
const defineSdkOptions = (options) => {
|
|
44484
|
+
Object.assign(sdkOptionsRegistry, options);
|
|
44485
|
+
};
|
|
44486
|
+
const getSdkOptions = () => {
|
|
44487
|
+
return { ...sdkOptionsRegistry };
|
|
44488
|
+
};
|
|
44489
|
+
|
|
44478
44490
|
const MEDIA_QUERY_REGEXP = /(<|>)(\d{1,})(px|cm|mm|in|pt|pc)$/;
|
|
44479
44491
|
const toCSSMediaQuery = ({ query }) => {
|
|
44480
44492
|
if (query === '*')
|
|
@@ -45059,6 +45071,20 @@ const transformBackgroundImage = (cfBackgroundImageUrl, cfBackgroundImageOptions
|
|
|
45059
45071
|
backgroundSize: matchBackgroundSize(cfBackgroundImageOptions?.scaling),
|
|
45060
45072
|
};
|
|
45061
45073
|
};
|
|
45074
|
+
const transformTextAlign = (value) => {
|
|
45075
|
+
if (!value)
|
|
45076
|
+
return undefined;
|
|
45077
|
+
const sdkOptions = getSdkOptions();
|
|
45078
|
+
// New behavior: translate left/right to start/end
|
|
45079
|
+
// Customer can opt-out by activating this global option toggle
|
|
45080
|
+
if (!sdkOptions.__disableTextAlignmentTransform) {
|
|
45081
|
+
if (value === 'left')
|
|
45082
|
+
return 'start';
|
|
45083
|
+
if (value === 'right')
|
|
45084
|
+
return 'end';
|
|
45085
|
+
}
|
|
45086
|
+
return value;
|
|
45087
|
+
};
|
|
45062
45088
|
|
|
45063
45089
|
const toCSSAttribute = (key) => {
|
|
45064
45090
|
let val = key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase());
|
|
@@ -45136,7 +45162,7 @@ const buildCfStyles = (values) => {
|
|
|
45136
45162
|
lineHeight: values.cfLineHeight,
|
|
45137
45163
|
letterSpacing: values.cfLetterSpacing,
|
|
45138
45164
|
color: values.cfTextColor,
|
|
45139
|
-
textAlign: values.cfTextAlign,
|
|
45165
|
+
textAlign: transformTextAlign(values.cfTextAlign),
|
|
45140
45166
|
textTransform: values.cfTextTransform,
|
|
45141
45167
|
objectFit: values.cfImageOptions?.objectFit,
|
|
45142
45168
|
objectPosition: values.cfImageOptions?.objectPosition,
|
|
@@ -47410,12 +47436,14 @@ const useEditorStore = create((set, get) => ({
|
|
|
47410
47436
|
}
|
|
47411
47437
|
set({ locale });
|
|
47412
47438
|
},
|
|
47413
|
-
initializeEditor({ componentRegistry: initialRegistry, designTokens, initialLocale }) {
|
|
47439
|
+
initializeEditor({ componentRegistry: initialRegistry, designTokens, sdkOptions, initialLocale, }) {
|
|
47414
47440
|
initialRegistry.forEach((registration) => {
|
|
47415
47441
|
componentRegistry.set(registration.definition.id, registration);
|
|
47416
47442
|
});
|
|
47417
47443
|
// Re-register the design tokens with the Visual Editor's instance of the experiences-core package
|
|
47418
47444
|
defineDesignTokens(designTokens);
|
|
47445
|
+
// Same copy over from one instance to the other is necessary for the sdk options
|
|
47446
|
+
defineSdkOptions(sdkOptions);
|
|
47419
47447
|
set({ locale: initialLocale });
|
|
47420
47448
|
},
|
|
47421
47449
|
}));
|
|
@@ -50567,11 +50595,12 @@ const useInitializeEditor = (inMemoryEntitiesStore) => {
|
|
|
50567
50595
|
const onVisualEditorInitialize = (event) => {
|
|
50568
50596
|
if (!event.detail)
|
|
50569
50597
|
return;
|
|
50570
|
-
const { componentRegistry, designTokens, locale: initialLocale, entities } = event.detail;
|
|
50598
|
+
const { componentRegistry, designTokens, sdkOptions, locale: initialLocale, entities, } = event.detail;
|
|
50571
50599
|
initializeEditor({
|
|
50572
50600
|
initialLocale,
|
|
50573
50601
|
componentRegistry,
|
|
50574
50602
|
designTokens,
|
|
50603
|
+
sdkOptions,
|
|
50575
50604
|
});
|
|
50576
50605
|
// if entities is set to [], then everything will still work as EntityStore will
|
|
50577
50606
|
// request entities on demand via ▲REQUEST_ENTITY
|