@contentful/experiences-visual-editor-react 1.31.0 → 1.31.1-prerelease-20250218T2104-febb4f2.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 +21 -25
- package/dist/index.js.map +1 -1
- package/dist/renderApp.js +21 -25
- package/dist/renderApp.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -926,14 +926,14 @@ const ComponentValueSchema$1 = z
|
|
|
926
926
|
.strict();
|
|
927
927
|
// TODO: finalize schema structure before release
|
|
928
928
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
929
|
-
const
|
|
929
|
+
const NoValueSchema$1 = z.object({ type: z.literal('NoValue') }).strict();
|
|
930
930
|
const ComponentPropertyValueSchema$1 = z.discriminatedUnion('type', [
|
|
931
931
|
DesignValueSchema$1,
|
|
932
932
|
BoundValueSchema$1,
|
|
933
933
|
UnboundValueSchema$1,
|
|
934
934
|
HyperlinkValueSchema$1,
|
|
935
935
|
ComponentValueSchema$1,
|
|
936
|
-
|
|
936
|
+
NoValueSchema$1,
|
|
937
937
|
]);
|
|
938
938
|
// TODO: finalize schema structure before release
|
|
939
939
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
@@ -946,13 +946,12 @@ const VariableMappingsSchema$1 = z.record(propertyKeySchema$1, VariableMappingSc
|
|
|
946
946
|
// TODO: finalize schema structure before release
|
|
947
947
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
948
948
|
const PatternPropertyDefinitionSchema$1 = z.object({
|
|
949
|
-
defaultValue: z
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
]),
|
|
949
|
+
defaultValue: z
|
|
950
|
+
.object({
|
|
951
|
+
path: z.string(),
|
|
952
|
+
type: z.literal('BoundValue'),
|
|
953
|
+
})
|
|
954
|
+
.optional(),
|
|
956
955
|
contentTypes: z.record(z.string(), z.any()),
|
|
957
956
|
});
|
|
958
957
|
const PatternPropertyDefinitionsSchema$1 = z.record(propertyKeySchema$1, PatternPropertyDefinitionSchema$1);
|
|
@@ -1639,7 +1638,7 @@ const builtInStylesWithDesignTokens = [
|
|
|
1639
1638
|
const isValidBreakpointValue = (value) => {
|
|
1640
1639
|
return value !== undefined && value !== null && value !== '';
|
|
1641
1640
|
};
|
|
1642
|
-
const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpointIndex, variableName, resolveDesignTokens = true) => {
|
|
1641
|
+
const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpointIndex, fallbackBreakpointIndex, variableName, resolveDesignTokens = true) => {
|
|
1643
1642
|
const eventuallyResolveDesignTokens = (value) => {
|
|
1644
1643
|
// For some built-in design properties, we support design tokens
|
|
1645
1644
|
if (builtInStylesWithDesignTokens.includes(variableName)) {
|
|
@@ -1660,8 +1659,6 @@ const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpoint
|
|
|
1660
1659
|
return valuesByBreakpoint[breakpointId];
|
|
1661
1660
|
}
|
|
1662
1661
|
}
|
|
1663
|
-
// If no breakpoint matched, we search and apply the fallback breakpoint
|
|
1664
|
-
const fallbackBreakpointIndex = getFallbackBreakpointIndex(breakpoints);
|
|
1665
1662
|
const fallbackBreakpointId = breakpoints[fallbackBreakpointIndex]?.id;
|
|
1666
1663
|
if (isValidBreakpointValue(valuesByBreakpoint[fallbackBreakpointId])) {
|
|
1667
1664
|
if (resolveDesignTokens) {
|
|
@@ -2997,7 +2994,6 @@ styleInject(css_248z$9);
|
|
|
2997
2994
|
*/
|
|
2998
2995
|
const useBreakpoints = (breakpoints) => {
|
|
2999
2996
|
const [mediaQueryMatches, setMediaQueryMatches] = useState({});
|
|
3000
|
-
const fallbackBreakpointIndex = getFallbackBreakpointIndex(breakpoints);
|
|
3001
2997
|
// Register event listeners to update the media query states
|
|
3002
2998
|
useEffect(() => {
|
|
3003
2999
|
const [mediaQueryMatchers, initialMediaQueryMatches] = mediaQueryMatcher(breakpoints);
|
|
@@ -3019,10 +3015,11 @@ const useBreakpoints = (breakpoints) => {
|
|
|
3019
3015
|
// Only re-setup all listeners when the breakpoint definition changed
|
|
3020
3016
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3021
3017
|
}, [breakpoints]);
|
|
3022
|
-
const activeBreakpointIndex = getActiveBreakpointIndex(breakpoints, mediaQueryMatches, fallbackBreakpointIndex);
|
|
3023
3018
|
const resolveDesignValue = useCallback((valuesByBreakpoint, variableName) => {
|
|
3024
|
-
|
|
3025
|
-
|
|
3019
|
+
const fallbackBreakpointIndex = getFallbackBreakpointIndex(breakpoints);
|
|
3020
|
+
const activeBreakpointIndex = getActiveBreakpointIndex(breakpoints, mediaQueryMatches, fallbackBreakpointIndex);
|
|
3021
|
+
return getValueForBreakpoint(valuesByBreakpoint, breakpoints, activeBreakpointIndex, fallbackBreakpointIndex, variableName);
|
|
3022
|
+
}, [mediaQueryMatches, breakpoints]);
|
|
3026
3023
|
return { resolveDesignValue };
|
|
3027
3024
|
};
|
|
3028
3025
|
|
|
@@ -3338,14 +3335,14 @@ const ComponentValueSchema = z
|
|
|
3338
3335
|
.strict();
|
|
3339
3336
|
// TODO: finalize schema structure before release
|
|
3340
3337
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
3341
|
-
const
|
|
3338
|
+
const NoValueSchema = z.object({ type: z.literal('NoValue') }).strict();
|
|
3342
3339
|
const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
|
|
3343
3340
|
DesignValueSchema,
|
|
3344
3341
|
BoundValueSchema,
|
|
3345
3342
|
UnboundValueSchema,
|
|
3346
3343
|
HyperlinkValueSchema,
|
|
3347
3344
|
ComponentValueSchema,
|
|
3348
|
-
|
|
3345
|
+
NoValueSchema,
|
|
3349
3346
|
]);
|
|
3350
3347
|
// TODO: finalize schema structure before release
|
|
3351
3348
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
@@ -3358,13 +3355,12 @@ const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema
|
|
|
3358
3355
|
// TODO: finalize schema structure before release
|
|
3359
3356
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
3360
3357
|
const PatternPropertyDefinitionSchema = z.object({
|
|
3361
|
-
defaultValue: z
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
]),
|
|
3358
|
+
defaultValue: z
|
|
3359
|
+
.object({
|
|
3360
|
+
path: z.string(),
|
|
3361
|
+
type: z.literal('BoundValue'),
|
|
3362
|
+
})
|
|
3363
|
+
.optional(),
|
|
3368
3364
|
contentTypes: z.record(z.string(), z.any()),
|
|
3369
3365
|
});
|
|
3370
3366
|
const PatternPropertyDefinitionsSchema = z.record(propertyKeySchema, PatternPropertyDefinitionSchema);
|