@contentful/experiences-visual-editor-react 1.37.3-dev-20250522T1032-0caa03f.0 → 1.38.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 +36 -20
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +36 -20
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/renderApp.js
CHANGED
|
@@ -43300,7 +43300,13 @@ const PatternPropertyDefinitionSchema$1 = z.object({
|
|
|
43300
43300
|
}),
|
|
43301
43301
|
}))
|
|
43302
43302
|
.optional(),
|
|
43303
|
-
contentTypes: z.record(z.string(), z.
|
|
43303
|
+
contentTypes: z.record(z.string(), z.object({
|
|
43304
|
+
sys: z.object({
|
|
43305
|
+
type: z.literal('Link'),
|
|
43306
|
+
id: z.string(),
|
|
43307
|
+
linkType: z.enum(['ContentType']),
|
|
43308
|
+
}),
|
|
43309
|
+
})),
|
|
43304
43310
|
});
|
|
43305
43311
|
const PatternPropertyDefinitionsSchema$1 = z.record(propertyKeySchema$1, PatternPropertyDefinitionSchema$1);
|
|
43306
43312
|
// TODO: finalize schema structure before release
|
|
@@ -43650,11 +43656,21 @@ const builtInStylesWithDesignTokens = [
|
|
|
43650
43656
|
const isValidBreakpointValue = (value) => {
|
|
43651
43657
|
return value !== undefined && value !== null && value !== '';
|
|
43652
43658
|
};
|
|
43653
|
-
const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpointIndex, fallbackBreakpointIndex,
|
|
43659
|
+
const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpointIndex, fallbackBreakpointIndex,
|
|
43660
|
+
/** Provide the name for built-in styles to replace design tokens. Supported properties are:
|
|
43661
|
+
* cfMargin, cfPadding, cfGap, cfWidth, cfHeight, cfBackgroundColor,
|
|
43662
|
+
* cfBorder, cfBorderRadius, cfFontSize, cfLineHeight, cfLetterSpacing,
|
|
43663
|
+
* cfTextColor, cfMaxWidth
|
|
43664
|
+
*/
|
|
43665
|
+
propertyName, resolveDesignTokens = true) => {
|
|
43654
43666
|
const eventuallyResolveDesignTokens = (value) => {
|
|
43667
|
+
// This is used externally in the web app to determine the original persisted value
|
|
43668
|
+
if (!resolveDesignTokens) {
|
|
43669
|
+
return value;
|
|
43670
|
+
}
|
|
43655
43671
|
// For some built-in design properties, we support design tokens
|
|
43656
|
-
if (builtInStylesWithDesignTokens.includes(
|
|
43657
|
-
return getDesignTokenRegistration(value,
|
|
43672
|
+
if (propertyName && builtInStylesWithDesignTokens.includes(propertyName)) {
|
|
43673
|
+
return getDesignTokenRegistration(value, propertyName);
|
|
43658
43674
|
}
|
|
43659
43675
|
// For all other properties, we just return the breakpoint-specific value
|
|
43660
43676
|
return value;
|
|
@@ -43665,18 +43681,12 @@ const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpoint
|
|
|
43665
43681
|
const breakpointId = breakpoints[index]?.id;
|
|
43666
43682
|
if (isValidBreakpointValue(valuesByBreakpoint[breakpointId])) {
|
|
43667
43683
|
// If the value is defined, we use it and stop the breakpoints cascade
|
|
43668
|
-
|
|
43669
|
-
return eventuallyResolveDesignTokens(valuesByBreakpoint[breakpointId]);
|
|
43670
|
-
}
|
|
43671
|
-
return valuesByBreakpoint[breakpointId];
|
|
43684
|
+
return eventuallyResolveDesignTokens(valuesByBreakpoint[breakpointId]);
|
|
43672
43685
|
}
|
|
43673
43686
|
}
|
|
43674
43687
|
const fallbackBreakpointId = breakpoints[fallbackBreakpointIndex]?.id;
|
|
43675
43688
|
if (isValidBreakpointValue(valuesByBreakpoint[fallbackBreakpointId])) {
|
|
43676
|
-
|
|
43677
|
-
return eventuallyResolveDesignTokens(valuesByBreakpoint[fallbackBreakpointId]);
|
|
43678
|
-
}
|
|
43679
|
-
return valuesByBreakpoint[fallbackBreakpointId];
|
|
43689
|
+
return eventuallyResolveDesignTokens(valuesByBreakpoint[fallbackBreakpointId]);
|
|
43680
43690
|
}
|
|
43681
43691
|
}
|
|
43682
43692
|
else {
|
|
@@ -44363,7 +44373,7 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
44363
44373
|
const optionsVariableName = 'cfImageOptions';
|
|
44364
44374
|
const options = resolveDesignValue(variables[optionsVariableName]?.type === 'DesignValue'
|
|
44365
44375
|
? variables[optionsVariableName].valuesByBreakpoint
|
|
44366
|
-
: {}
|
|
44376
|
+
: {});
|
|
44367
44377
|
if (!options) {
|
|
44368
44378
|
console.error(`Error transforming image asset: Required variable [${optionsVariableName}] missing from component definition`);
|
|
44369
44379
|
return;
|
|
@@ -44388,7 +44398,7 @@ const transformMedia = (asset, variables, resolveDesignValue, variableName, path
|
|
|
44388
44398
|
const optionsVariableName = 'cfBackgroundImageOptions';
|
|
44389
44399
|
const options = resolveDesignValue(variables[optionsVariableName]?.type === 'DesignValue'
|
|
44390
44400
|
? variables[optionsVariableName].valuesByBreakpoint
|
|
44391
|
-
: {}
|
|
44401
|
+
: {});
|
|
44392
44402
|
if (!options) {
|
|
44393
44403
|
console.error(`Error transforming image asset: Required variable [${optionsVariableName}] missing from component definition`);
|
|
44394
44404
|
return;
|
|
@@ -56796,10 +56806,10 @@ const useBreakpoints = (breakpoints) => {
|
|
|
56796
56806
|
});
|
|
56797
56807
|
};
|
|
56798
56808
|
}, [breakpoints]);
|
|
56799
|
-
const resolveDesignValue = reactExports.useCallback((valuesByBreakpoint,
|
|
56809
|
+
const resolveDesignValue = reactExports.useCallback((valuesByBreakpoint, propertyName) => {
|
|
56800
56810
|
const fallbackBreakpointIndex = getFallbackBreakpointIndex(breakpoints);
|
|
56801
56811
|
const activeBreakpointIndex = getActiveBreakpointIndex(breakpoints, mediaQueryMatches, fallbackBreakpointIndex);
|
|
56802
|
-
return getValueForBreakpoint(valuesByBreakpoint, breakpoints, activeBreakpointIndex, fallbackBreakpointIndex,
|
|
56812
|
+
return getValueForBreakpoint(valuesByBreakpoint, breakpoints, activeBreakpointIndex, fallbackBreakpointIndex, propertyName);
|
|
56803
56813
|
}, [mediaQueryMatches, breakpoints]);
|
|
56804
56814
|
return { resolveDesignValue };
|
|
56805
56815
|
};
|
|
@@ -58372,7 +58382,13 @@ const PatternPropertyDefinitionSchema = z.object({
|
|
|
58372
58382
|
}),
|
|
58373
58383
|
}))
|
|
58374
58384
|
.optional(),
|
|
58375
|
-
contentTypes: z.record(z.string(), z.
|
|
58385
|
+
contentTypes: z.record(z.string(), z.object({
|
|
58386
|
+
sys: z.object({
|
|
58387
|
+
type: z.literal('Link'),
|
|
58388
|
+
id: z.string(),
|
|
58389
|
+
linkType: z.enum(['ContentType']),
|
|
58390
|
+
}),
|
|
58391
|
+
})),
|
|
58376
58392
|
});
|
|
58377
58393
|
const PatternPropertyDefinitionsSchema = z.record(propertyKeySchema, PatternPropertyDefinitionSchema);
|
|
58378
58394
|
// TODO: finalize schema structure before release
|
|
@@ -59583,7 +59599,7 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
|
|
|
59583
59599
|
const props = reactExports.useMemo(() => {
|
|
59584
59600
|
const propsBase = {
|
|
59585
59601
|
cfSsrClassName: node.data.props.cfSsrClassName
|
|
59586
|
-
? resolveDesignValue(node.data.props.cfSsrClassName.valuesByBreakpoint
|
|
59602
|
+
? resolveDesignValue(node.data.props.cfSsrClassName.valuesByBreakpoint)
|
|
59587
59603
|
: undefined,
|
|
59588
59604
|
};
|
|
59589
59605
|
// Don't enrich the assembly wrapper node with props
|
|
@@ -60439,7 +60455,7 @@ function useSingleColumn(node, resolveDesignValue) {
|
|
|
60439
60455
|
if (cfWrapColumns.type !== 'DesignValue') {
|
|
60440
60456
|
return false;
|
|
60441
60457
|
}
|
|
60442
|
-
return resolveDesignValue(cfWrapColumns.valuesByBreakpoint
|
|
60458
|
+
return resolveDesignValue(cfWrapColumns.valuesByBreakpoint);
|
|
60443
60459
|
}, [tree, node, isSingleColumn, resolveDesignValue]);
|
|
60444
60460
|
return {
|
|
60445
60461
|
isSingleColumn,
|
|
@@ -60583,7 +60599,7 @@ const useDropzoneDirection = ({ resolveDesignValue, node, zoneId }) => {
|
|
|
60583
60599
|
if (!designValues || !resolveDesignValue || designValues.type !== 'DesignValue') {
|
|
60584
60600
|
return 'vertical';
|
|
60585
60601
|
}
|
|
60586
|
-
const direction = resolveDesignValue(designValues.valuesByBreakpoint
|
|
60602
|
+
const direction = resolveDesignValue(designValues.valuesByBreakpoint);
|
|
60587
60603
|
if (direction === 'row') {
|
|
60588
60604
|
return 'horizontal';
|
|
60589
60605
|
}
|