@contentful/experiences-core 1.31.0-dev-20250217T1404-270aced.0 → 1.31.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
CHANGED
|
@@ -1244,8 +1244,33 @@ const ComponentVariableSchema = z.object({
|
|
|
1244
1244
|
});
|
|
1245
1245
|
const ComponentVariablesSchema = z.record(z.string().regex(/^[a-zA-Z0-9-_]{1,54}$/), // Here the key is <variableName>_<nanoidId> so we need to allow for a longer length
|
|
1246
1246
|
ComponentVariableSchema);
|
|
1247
|
+
const THUMBNAIL_IDS = [
|
|
1248
|
+
'columns',
|
|
1249
|
+
'columnsPlusRight',
|
|
1250
|
+
'imagesSquare',
|
|
1251
|
+
'subtitles',
|
|
1252
|
+
'rowsPlusBottom',
|
|
1253
|
+
'userRectangle',
|
|
1254
|
+
'textbox',
|
|
1255
|
+
'monitorPlay',
|
|
1256
|
+
'article',
|
|
1257
|
+
'table',
|
|
1258
|
+
'star',
|
|
1259
|
+
'heartStraight',
|
|
1260
|
+
'frameCorners',
|
|
1261
|
+
'rows',
|
|
1262
|
+
'dotsThreeOutline',
|
|
1263
|
+
'listDashes',
|
|
1264
|
+
'checkerBoard',
|
|
1265
|
+
'gridFour',
|
|
1266
|
+
'slideshow',
|
|
1267
|
+
'diamondsFour',
|
|
1268
|
+
'cards',
|
|
1269
|
+
'textColumns',
|
|
1270
|
+
];
|
|
1247
1271
|
const ComponentSettingsSchema = z.object({
|
|
1248
1272
|
variableDefinitions: ComponentVariablesSchema,
|
|
1273
|
+
thumbnailId: z.enum(THUMBNAIL_IDS).optional(),
|
|
1249
1274
|
variableMappings: VariableMappingsSchema.optional(),
|
|
1250
1275
|
patternPropertyDefinitions: PatternPropertyDefinitionsSchema.optional(),
|
|
1251
1276
|
});
|
|
@@ -2413,11 +2438,11 @@ function getArrayValue(entryOrAsset, path, entityStore) {
|
|
|
2413
2438
|
return result;
|
|
2414
2439
|
}
|
|
2415
2440
|
|
|
2416
|
-
const transformBoundContentValue = (variables, entityStore, binding, resolveDesignValue, variableName,
|
|
2441
|
+
const transformBoundContentValue = (variables, entityStore, binding, resolveDesignValue, variableName, variableType, path) => {
|
|
2417
2442
|
const entityOrAsset = entityStore.getEntryOrAsset(binding, path);
|
|
2418
2443
|
if (!entityOrAsset)
|
|
2419
2444
|
return;
|
|
2420
|
-
switch (
|
|
2445
|
+
switch (variableType) {
|
|
2421
2446
|
case 'Media':
|
|
2422
2447
|
// If we bound a normal entry field to the media variable we just return the bound value
|
|
2423
2448
|
if (entityOrAsset.sys.type === 'Entry') {
|
|
@@ -2627,7 +2652,7 @@ const builtInStylesWithDesignTokens = [
|
|
|
2627
2652
|
const isValidBreakpointValue = (value) => {
|
|
2628
2653
|
return value !== undefined && value !== null && value !== '';
|
|
2629
2654
|
};
|
|
2630
|
-
const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpointIndex, variableName, resolveDesignTokens = true) => {
|
|
2655
|
+
const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpointIndex, fallbackBreakpointIndex, variableName, resolveDesignTokens = true) => {
|
|
2631
2656
|
const eventuallyResolveDesignTokens = (value) => {
|
|
2632
2657
|
// For some built-in design properties, we support design tokens
|
|
2633
2658
|
if (builtInStylesWithDesignTokens.includes(variableName)) {
|
|
@@ -2648,8 +2673,6 @@ const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpoint
|
|
|
2648
2673
|
return valuesByBreakpoint[breakpointId];
|
|
2649
2674
|
}
|
|
2650
2675
|
}
|
|
2651
|
-
// If no breakpoint matched, we search and apply the fallback breakpoint
|
|
2652
|
-
const fallbackBreakpointIndex = getFallbackBreakpointIndex(breakpoints);
|
|
2653
2676
|
const fallbackBreakpointId = breakpoints[fallbackBreakpointIndex]?.id;
|
|
2654
2677
|
if (isValidBreakpointValue(valuesByBreakpoint[fallbackBreakpointId])) {
|
|
2655
2678
|
if (resolveDesignTokens) {
|