@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/renderApp.js CHANGED
@@ -43547,14 +43547,14 @@ const ComponentValueSchema$1 = z
43547
43547
  .strict();
43548
43548
  // TODO: finalize schema structure before release
43549
43549
  // https://contentful.atlassian.net/browse/LUMOS-523
43550
- const EmptyObjectSchema$1 = z.object({ type: z.undefined() });
43550
+ const NoValueSchema$1 = z.object({ type: z.literal('NoValue') }).strict();
43551
43551
  const ComponentPropertyValueSchema$1 = z.discriminatedUnion('type', [
43552
43552
  DesignValueSchema$1,
43553
43553
  BoundValueSchema$1,
43554
43554
  UnboundValueSchema$1,
43555
43555
  HyperlinkValueSchema$1,
43556
43556
  ComponentValueSchema$1,
43557
- EmptyObjectSchema$1,
43557
+ NoValueSchema$1,
43558
43558
  ]);
43559
43559
  // TODO: finalize schema structure before release
43560
43560
  // https://contentful.atlassian.net/browse/LUMOS-523
@@ -43567,13 +43567,12 @@ const VariableMappingsSchema$1 = z.record(propertyKeySchema$1, VariableMappingSc
43567
43567
  // TODO: finalize schema structure before release
43568
43568
  // https://contentful.atlassian.net/browse/LUMOS-523
43569
43569
  const PatternPropertyDefinitionSchema$1 = z.object({
43570
- defaultValue: z.union([
43571
- z.object({
43572
- path: z.string(),
43573
- type: z.literal('BoundValue'),
43574
- }),
43575
- z.null(),
43576
- ]),
43570
+ defaultValue: z
43571
+ .object({
43572
+ path: z.string(),
43573
+ type: z.literal('BoundValue'),
43574
+ })
43575
+ .optional(),
43577
43576
  contentTypes: z.record(z.string(), z.any()),
43578
43577
  });
43579
43578
  const PatternPropertyDefinitionsSchema$1 = z.record(propertyKeySchema$1, PatternPropertyDefinitionSchema$1);
@@ -44260,7 +44259,7 @@ const builtInStylesWithDesignTokens = [
44260
44259
  const isValidBreakpointValue = (value) => {
44261
44260
  return value !== undefined && value !== null && value !== '';
44262
44261
  };
44263
- const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpointIndex, variableName, resolveDesignTokens = true) => {
44262
+ const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpointIndex, fallbackBreakpointIndex, variableName, resolveDesignTokens = true) => {
44264
44263
  const eventuallyResolveDesignTokens = (value) => {
44265
44264
  // For some built-in design properties, we support design tokens
44266
44265
  if (builtInStylesWithDesignTokens.includes(variableName)) {
@@ -44281,8 +44280,6 @@ const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpoint
44281
44280
  return valuesByBreakpoint[breakpointId];
44282
44281
  }
44283
44282
  }
44284
- // If no breakpoint matched, we search and apply the fallback breakpoint
44285
- const fallbackBreakpointIndex = getFallbackBreakpointIndex(breakpoints);
44286
44283
  const fallbackBreakpointId = breakpoints[fallbackBreakpointIndex]?.id;
44287
44284
  if (isValidBreakpointValue(valuesByBreakpoint[fallbackBreakpointId])) {
44288
44285
  if (resolveDesignTokens) {
@@ -56685,7 +56682,6 @@ styleInject(css_248z$9);
56685
56682
  */
56686
56683
  const useBreakpoints = (breakpoints) => {
56687
56684
  const [mediaQueryMatches, setMediaQueryMatches] = reactExports.useState({});
56688
- const fallbackBreakpointIndex = getFallbackBreakpointIndex(breakpoints);
56689
56685
  // Register event listeners to update the media query states
56690
56686
  reactExports.useEffect(() => {
56691
56687
  const [mediaQueryMatchers, initialMediaQueryMatches] = mediaQueryMatcher(breakpoints);
@@ -56707,10 +56703,11 @@ const useBreakpoints = (breakpoints) => {
56707
56703
  // Only re-setup all listeners when the breakpoint definition changed
56708
56704
  // eslint-disable-next-line react-hooks/exhaustive-deps
56709
56705
  }, [breakpoints]);
56710
- const activeBreakpointIndex = getActiveBreakpointIndex(breakpoints, mediaQueryMatches, fallbackBreakpointIndex);
56711
56706
  const resolveDesignValue = reactExports.useCallback((valuesByBreakpoint, variableName) => {
56712
- return getValueForBreakpoint(valuesByBreakpoint, breakpoints, activeBreakpointIndex, variableName);
56713
- }, [activeBreakpointIndex, breakpoints]);
56707
+ const fallbackBreakpointIndex = getFallbackBreakpointIndex(breakpoints);
56708
+ const activeBreakpointIndex = getActiveBreakpointIndex(breakpoints, mediaQueryMatches, fallbackBreakpointIndex);
56709
+ return getValueForBreakpoint(valuesByBreakpoint, breakpoints, activeBreakpointIndex, fallbackBreakpointIndex, variableName);
56710
+ }, [mediaQueryMatches, breakpoints]);
56714
56711
  return { resolveDesignValue };
56715
56712
  };
56716
56713
 
@@ -58252,14 +58249,14 @@ const ComponentValueSchema = z
58252
58249
  .strict();
58253
58250
  // TODO: finalize schema structure before release
58254
58251
  // https://contentful.atlassian.net/browse/LUMOS-523
58255
- const EmptyObjectSchema = z.object({ type: z.undefined() });
58252
+ const NoValueSchema = z.object({ type: z.literal('NoValue') }).strict();
58256
58253
  const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
58257
58254
  DesignValueSchema,
58258
58255
  BoundValueSchema,
58259
58256
  UnboundValueSchema,
58260
58257
  HyperlinkValueSchema,
58261
58258
  ComponentValueSchema,
58262
- EmptyObjectSchema,
58259
+ NoValueSchema,
58263
58260
  ]);
58264
58261
  // TODO: finalize schema structure before release
58265
58262
  // https://contentful.atlassian.net/browse/LUMOS-523
@@ -58272,13 +58269,12 @@ const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema
58272
58269
  // TODO: finalize schema structure before release
58273
58270
  // https://contentful.atlassian.net/browse/LUMOS-523
58274
58271
  const PatternPropertyDefinitionSchema = z.object({
58275
- defaultValue: z.union([
58276
- z.object({
58277
- path: z.string(),
58278
- type: z.literal('BoundValue'),
58279
- }),
58280
- z.null(),
58281
- ]),
58272
+ defaultValue: z
58273
+ .object({
58274
+ path: z.string(),
58275
+ type: z.literal('BoundValue'),
58276
+ })
58277
+ .optional(),
58282
58278
  contentTypes: z.record(z.string(), z.any()),
58283
58279
  });
58284
58280
  const PatternPropertyDefinitionsSchema = z.record(propertyKeySchema, PatternPropertyDefinitionSchema);