@contentful/experiences-core 1.15.0-dev-20240911T1455-8e33695.0 → 1.15.0-dev-20240911T2321-93c9cc5.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 +10 -4
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/utils/breakpoints.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2431,9 +2431,9 @@ const builtInStylesWithDesignTokens = [
|
|
|
2431
2431
|
const isValidBreakpointValue = (value) => {
|
|
2432
2432
|
return value !== undefined && value !== null && value !== '';
|
|
2433
2433
|
};
|
|
2434
|
-
const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpointIndex, variableName) => {
|
|
2434
|
+
const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpointIndex, variableName, resolveDesignTokens = true) => {
|
|
2435
2435
|
const eventuallyResolveDesignTokens = (value) => {
|
|
2436
|
-
// For some built-in design
|
|
2436
|
+
// For some built-in design properties, we support design tokens
|
|
2437
2437
|
if (builtInStylesWithDesignTokens.includes(variableName)) {
|
|
2438
2438
|
return getDesignTokenRegistration(value, variableName);
|
|
2439
2439
|
}
|
|
@@ -2446,14 +2446,20 @@ const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpoint
|
|
|
2446
2446
|
const breakpointId = breakpoints[index]?.id;
|
|
2447
2447
|
if (isValidBreakpointValue(valuesByBreakpoint[breakpointId])) {
|
|
2448
2448
|
// If the value is defined, we use it and stop the breakpoints cascade
|
|
2449
|
-
|
|
2449
|
+
if (resolveDesignTokens) {
|
|
2450
|
+
return eventuallyResolveDesignTokens(valuesByBreakpoint[breakpointId]);
|
|
2451
|
+
}
|
|
2452
|
+
return valuesByBreakpoint[breakpointId];
|
|
2450
2453
|
}
|
|
2451
2454
|
}
|
|
2452
2455
|
// If no breakpoint matched, we search and apply the fallback breakpoint
|
|
2453
2456
|
const fallbackBreakpointIndex = getFallbackBreakpointIndex(breakpoints);
|
|
2454
2457
|
const fallbackBreakpointId = breakpoints[fallbackBreakpointIndex]?.id;
|
|
2455
2458
|
if (isValidBreakpointValue(valuesByBreakpoint[fallbackBreakpointId])) {
|
|
2456
|
-
|
|
2459
|
+
if (resolveDesignTokens) {
|
|
2460
|
+
return eventuallyResolveDesignTokens(valuesByBreakpoint[fallbackBreakpointId]);
|
|
2461
|
+
}
|
|
2462
|
+
return valuesByBreakpoint[fallbackBreakpointId];
|
|
2457
2463
|
}
|
|
2458
2464
|
}
|
|
2459
2465
|
else {
|