@contentful/experiences-visual-editor-react 1.34.0 → 1.34.1-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 +97 -50
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +97 -50
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/renderApp.js
CHANGED
|
@@ -37,8 +37,8 @@ function styleInject(css, ref) {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
var css_248z$
|
|
41
|
-
styleInject(css_248z$
|
|
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);
|
|
42
42
|
|
|
43
43
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
44
44
|
|
|
@@ -43005,45 +43005,85 @@ const toCSSAttribute = (key) => {
|
|
|
43005
43005
|
val = val.replace(/\d+$/, '');
|
|
43006
43006
|
return val;
|
|
43007
43007
|
};
|
|
43008
|
-
|
|
43009
|
-
|
|
43008
|
+
/**
|
|
43009
|
+
* Turns a list of CSSProperties into a joined CSS string that can be
|
|
43010
|
+
* used for <style> tags. Per default it creates a minimized version.
|
|
43011
|
+
* For editor mode, use the `useWhitespaces` flag to create a more readable version.
|
|
43012
|
+
*
|
|
43013
|
+
* @param cssProperties list of CSS properties
|
|
43014
|
+
* @param useWhitespaces adds whitespaces and newlines between each rule
|
|
43015
|
+
* @returns a string of CSS rules
|
|
43016
|
+
*/
|
|
43017
|
+
const stringifyCssProperties = (cssProperties, useWhitespaces = false) => {
|
|
43018
|
+
const rules = Object.entries(cssProperties)
|
|
43010
43019
|
.filter(([, value]) => value !== undefined)
|
|
43011
|
-
.
|
|
43012
|
-
|
|
43013
|
-
|
|
43014
|
-
|
|
43020
|
+
.map(([key, value]) => useWhitespaces ? `${toCSSAttribute(key)}: ${value};` : `${toCSSAttribute(key)}:${value};`);
|
|
43021
|
+
return rules.join(useWhitespaces ? '\n' : '');
|
|
43022
|
+
};
|
|
43023
|
+
const buildStyleTag = ({ styles, nodeId }) => {
|
|
43024
|
+
const generatedStyles = stringifyCssProperties(styles, true);
|
|
43025
|
+
const className = `cfstyles-${nodeId ? nodeId : md5(generatedStyles)}`;
|
|
43026
|
+
const styleRule = `.${className}{ ${generatedStyles} }`;
|
|
43015
43027
|
return [className, styleRule];
|
|
43016
43028
|
};
|
|
43017
|
-
|
|
43018
|
-
|
|
43029
|
+
/**
|
|
43030
|
+
* Takes plain design values and transforms them into CSS properties. Undefined values will
|
|
43031
|
+
* be filtered out.
|
|
43032
|
+
*
|
|
43033
|
+
* **Example Input**
|
|
43034
|
+
* ```
|
|
43035
|
+
* values = {
|
|
43036
|
+
* cfVisibility: 'visible',
|
|
43037
|
+
* cfMargin: '10px',
|
|
43038
|
+
* cfFlexReverse: true,
|
|
43039
|
+
* cfImageOptions: { objectFit: 'cover' },
|
|
43040
|
+
* // ...
|
|
43041
|
+
* }
|
|
43042
|
+
* ```
|
|
43043
|
+
* **Example Output**
|
|
43044
|
+
* ```
|
|
43045
|
+
* cssProperties = {
|
|
43046
|
+
* margin: '10px',
|
|
43047
|
+
* flexDirection: 'row-reverse',
|
|
43048
|
+
* objectFit: 'cover',
|
|
43049
|
+
* // ...
|
|
43050
|
+
* }
|
|
43051
|
+
* ```
|
|
43052
|
+
*/
|
|
43053
|
+
const buildCfStyles = (values) => {
|
|
43054
|
+
const cssProperties = {
|
|
43019
43055
|
boxSizing: 'border-box',
|
|
43020
|
-
...transformVisibility(cfVisibility),
|
|
43021
|
-
margin: cfMargin,
|
|
43022
|
-
padding: cfPadding,
|
|
43023
|
-
backgroundColor: cfBackgroundColor,
|
|
43024
|
-
width: transformFill(cfWidth || cfImageOptions?.width),
|
|
43025
|
-
height: transformFill(cfHeight || cfImageOptions?.height),
|
|
43026
|
-
maxWidth: cfMaxWidth,
|
|
43027
|
-
...transformGridColumn(cfColumnSpan),
|
|
43028
|
-
...transformBorderStyle(cfBorder),
|
|
43029
|
-
borderRadius: cfBorderRadius,
|
|
43030
|
-
gap: cfGap,
|
|
43031
|
-
...transformAlignment(cfHorizontalAlignment, cfVerticalAlignment, cfFlexDirection),
|
|
43032
|
-
flexDirection: cfFlexReverse && cfFlexDirection
|
|
43033
|
-
|
|
43034
|
-
|
|
43035
|
-
|
|
43036
|
-
|
|
43037
|
-
|
|
43038
|
-
|
|
43039
|
-
|
|
43040
|
-
|
|
43041
|
-
|
|
43042
|
-
|
|
43043
|
-
|
|
43044
|
-
|
|
43045
|
-
|
|
43056
|
+
...transformVisibility(values.cfVisibility),
|
|
43057
|
+
margin: values.cfMargin,
|
|
43058
|
+
padding: values.cfPadding,
|
|
43059
|
+
backgroundColor: values.cfBackgroundColor,
|
|
43060
|
+
width: transformFill(values.cfWidth || values.cfImageOptions?.width),
|
|
43061
|
+
height: transformFill(values.cfHeight || values.cfImageOptions?.height),
|
|
43062
|
+
maxWidth: values.cfMaxWidth,
|
|
43063
|
+
...transformGridColumn(values.cfColumnSpan),
|
|
43064
|
+
...transformBorderStyle(values.cfBorder),
|
|
43065
|
+
borderRadius: values.cfBorderRadius,
|
|
43066
|
+
gap: values.cfGap,
|
|
43067
|
+
...transformAlignment(values.cfHorizontalAlignment, values.cfVerticalAlignment, values.cfFlexDirection),
|
|
43068
|
+
flexDirection: values.cfFlexReverse && values.cfFlexDirection
|
|
43069
|
+
? `${values.cfFlexDirection}-reverse`
|
|
43070
|
+
: values.cfFlexDirection,
|
|
43071
|
+
flexWrap: values.cfFlexWrap,
|
|
43072
|
+
...transformBackgroundImage(values.cfBackgroundImageUrl, values.cfBackgroundImageOptions),
|
|
43073
|
+
fontSize: values.cfFontSize,
|
|
43074
|
+
fontWeight: values.cfTextBold ? 'bold' : values.cfFontWeight,
|
|
43075
|
+
fontStyle: values.cfTextItalic ? 'italic' : undefined,
|
|
43076
|
+
textDecoration: values.cfTextUnderline ? 'underline' : undefined,
|
|
43077
|
+
lineHeight: values.cfLineHeight,
|
|
43078
|
+
letterSpacing: values.cfLetterSpacing,
|
|
43079
|
+
color: values.cfTextColor,
|
|
43080
|
+
textAlign: values.cfTextAlign,
|
|
43081
|
+
textTransform: values.cfTextTransform,
|
|
43082
|
+
objectFit: values.cfImageOptions?.objectFit,
|
|
43083
|
+
objectPosition: values.cfImageOptions?.objectPosition,
|
|
43046
43084
|
};
|
|
43085
|
+
const cssPropertiesWithoutUndefined = Object.fromEntries(Object.entries(cssProperties).filter(([, value]) => value !== undefined));
|
|
43086
|
+
return cssPropertiesWithoutUndefined;
|
|
43047
43087
|
};
|
|
43048
43088
|
/**
|
|
43049
43089
|
* Container/section default behavior:
|
|
@@ -43568,11 +43608,13 @@ const VariableMappingsSchema$1 = z.record(propertyKeySchema$1, VariableMappingSc
|
|
|
43568
43608
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
43569
43609
|
const PatternPropertyDefinitionSchema$1 = z.object({
|
|
43570
43610
|
defaultValue: z
|
|
43571
|
-
.object({
|
|
43572
|
-
|
|
43573
|
-
|
|
43574
|
-
|
|
43575
|
-
|
|
43611
|
+
.record(z.string(), z.object({
|
|
43612
|
+
sys: z.object({
|
|
43613
|
+
type: z.literal('Link'),
|
|
43614
|
+
id: z.string(),
|
|
43615
|
+
linkType: z.enum(['Entry']),
|
|
43616
|
+
}),
|
|
43617
|
+
}))
|
|
43576
43618
|
.optional(),
|
|
43577
43619
|
contentTypes: z.record(z.string(), z.any()),
|
|
43578
43620
|
});
|
|
@@ -56697,9 +56739,9 @@ const cloneDeepAsPOJO = (obj) => {
|
|
|
56697
56739
|
return JSON.parse(JSON.stringify(obj));
|
|
56698
56740
|
};
|
|
56699
56741
|
|
|
56700
|
-
var css_248z$
|
|
56742
|
+
var css_248z$a = ".render-module_hitbox__l4ysJ {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 10px;\n z-index: 1000000;\n}\n\n.render-module_hitboxLower__tgsA1 {\n position: absolute;\n bottom: -20px;\n left: 0;\n width: 100%;\n height: 20px;\n z-index: 1000000;\n}\n\n.render-module_canvasBottomSpacer__JuxVh {\n position: absolute;\n width: 100%;\n height: 50px;\n}\n\n.render-module_container__-C3d7 {\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";
|
|
56701
56743
|
var styles$3 = {"hitbox":"render-module_hitbox__l4ysJ","hitboxLower":"render-module_hitboxLower__tgsA1","canvasBottomSpacer":"render-module_canvasBottomSpacer__JuxVh","container":"render-module_container__-C3d7"};
|
|
56702
|
-
styleInject(css_248z$
|
|
56744
|
+
styleInject(css_248z$a);
|
|
56703
56745
|
|
|
56704
56746
|
// TODO: In order to support integrations without React, we should extract this heavy logic into simple
|
|
56705
56747
|
// functions that we can reuse in other frameworks.
|
|
@@ -58094,6 +58136,9 @@ function getSchemaWithNodeType(nodeType) {
|
|
|
58094
58136
|
|
|
58095
58137
|
} (dist));
|
|
58096
58138
|
|
|
58139
|
+
var css_248z$8 = "/* Initially added with PR #253 for each component, this is now a global setting\n * It is recommended on MDN to use this as a default for layouting.\n*/\n* {\n box-sizing: border-box;\n}\n";
|
|
58140
|
+
styleInject(css_248z$8);
|
|
58141
|
+
|
|
58097
58142
|
/**
|
|
58098
58143
|
* These modes are ONLY intended to be internally used within the context of
|
|
58099
58144
|
* editing an experience inside of Contentful Studio. i.e. these modes
|
|
@@ -58296,11 +58341,13 @@ const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema
|
|
|
58296
58341
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
58297
58342
|
const PatternPropertyDefinitionSchema = z.object({
|
|
58298
58343
|
defaultValue: z
|
|
58299
|
-
.object({
|
|
58300
|
-
|
|
58301
|
-
|
|
58302
|
-
|
|
58303
|
-
|
|
58344
|
+
.record(z.string(), z.object({
|
|
58345
|
+
sys: z.object({
|
|
58346
|
+
type: z.literal('Link'),
|
|
58347
|
+
id: z.string(),
|
|
58348
|
+
linkType: z.enum(['Entry']),
|
|
58349
|
+
}),
|
|
58350
|
+
}))
|
|
58304
58351
|
.optional(),
|
|
58305
58352
|
contentTypes: z.record(z.string(), z.any()),
|
|
58306
58353
|
});
|
|
@@ -58612,8 +58659,8 @@ Flex.displayName = 'Flex';
|
|
|
58612
58659
|
var css_248z$1$1 = ".cf-divider {\n display: contents;\n position: relative;\n width: 100%;\n height: 100%;\n}\n\n.cf-divider hr {\n border: none;\n}\n\n/* For the editor mode add this 10px tolerance to make it easier picking up the divider component.\n * Using the DND zone as precondition makes sure that we don't render this pseudo element in delivery. */\n\n[data-ctfl-zone-id='root'] .cf-divider::before {\n content: \"\";\n position: absolute;\n top: -5px;\n left: -5px;\n bottom: -5px;\n right: -5px;\n pointer-events: all;\n}\n";
|
|
58613
58660
|
styleInject(css_248z$1$1);
|
|
58614
58661
|
|
|
58615
|
-
var css_248z$
|
|
58616
|
-
styleInject(css_248z$
|
|
58662
|
+
var css_248z$9 = ".cf-columns {\n display: flex;\n gap: 24px;\n grid-template-columns: repeat(12, 1fr);\n flex-direction: column;\n min-height: 0; /* NEW */\n min-width: 0; /* NEW; needed for Firefox */\n}\n\n@media (min-width: 768px) {\n .cf-columns {\n display: grid;\n }\n}\n\n.cf-single-column-wrapper {\n position: relative;\n display: flex;\n}\n\n.cf-single-column {\n pointer-events: all;\n}\n\n.cf-single-column-wrapper: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.cf-single-column-label:after {\n content: 'Column';\n}\n";
|
|
58663
|
+
styleInject(css_248z$9);
|
|
58617
58664
|
|
|
58618
58665
|
const ColumnWrapper = reactExports.forwardRef((props, ref) => {
|
|
58619
58666
|
return (React$1.createElement("div", { ref: ref, ...props, style: {
|