@contentful/experiences-core 1.37.1-dev-20250514T1115-cc6f809.0 → 1.37.1-dev-20250515T1211-cc16b86.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.d.ts +1 -1
- package/dist/index.js +11 -33
- package/dist/index.js.map +1 -1
- package/dist/utils/breakpoints.d.ts +2 -5
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isPatternComponent, isStructureWithRelativeHeight } from './utils/components.js';
|
|
2
|
-
export { MEDIA_QUERY_REGEXP, getActiveBreakpointIndex, getFallbackBreakpointIndex, getValueForBreakpoint, isValidBreakpointValue, mediaQueryMatcher
|
|
2
|
+
export { MEDIA_QUERY_REGEXP, getActiveBreakpointIndex, getFallbackBreakpointIndex, getValueForBreakpoint, isValidBreakpointValue, mediaQueryMatcher } from './utils/breakpoints.js';
|
|
3
3
|
export { DebugLogger, debug, disableDebug, enableDebug } from './utils/debugLogger.js';
|
|
4
4
|
export { findOutermostCoordinates, getElementCoordinates } from './utils/domValues.js';
|
|
5
5
|
export { isLinkToAsset } from './utils/isLinkToAsset.js';
|
package/dist/index.js
CHANGED
|
@@ -1412,21 +1412,6 @@ const getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpoint
|
|
|
1412
1412
|
return valuesByBreakpoint;
|
|
1413
1413
|
}
|
|
1414
1414
|
};
|
|
1415
|
-
/** Overwrites the default value breakpoint by breakpoint. If a breakpoint
|
|
1416
|
-
* is not overwritten, it will fall back to the default. */
|
|
1417
|
-
const mergeDesignValuesByBreakpoint = (defaultValue, overwriteValue) => {
|
|
1418
|
-
const mergedValuesByBreakpoint = { ...defaultValue.valuesByBreakpoint };
|
|
1419
|
-
for (const [breakpointId, value] of Object.entries(overwriteValue.valuesByBreakpoint)) {
|
|
1420
|
-
if (!isValidBreakpointValue(value)) {
|
|
1421
|
-
continue;
|
|
1422
|
-
}
|
|
1423
|
-
mergedValuesByBreakpoint[breakpointId] = value;
|
|
1424
|
-
}
|
|
1425
|
-
return {
|
|
1426
|
-
type: 'DesignValue',
|
|
1427
|
-
valuesByBreakpoint: mergedValuesByBreakpoint,
|
|
1428
|
-
};
|
|
1429
|
-
};
|
|
1430
1415
|
|
|
1431
1416
|
const CF_DEBUG_KEY = 'cf_debug';
|
|
1432
1417
|
class DebugLogger {
|
|
@@ -2310,10 +2295,9 @@ const resolveComponentVariablesOverwrites = ({ patternNode, wrapperComponentVari
|
|
|
2310
2295
|
const overwritingValue = wrapperComponentVariablesOverwrites?.[propertyValue.key];
|
|
2311
2296
|
// Property definition from the parent pattern
|
|
2312
2297
|
const propertyDefinition = wrapperComponentSettings?.variableDefinitions?.[propertyValue.key];
|
|
2313
|
-
const defaultValue = propertyDefinition?.defaultValue;
|
|
2314
2298
|
// The overwriting value is either a custom value from the experience or default value from a
|
|
2315
2299
|
// wrapping pattern node that got trickled down to this nesting level.
|
|
2316
|
-
resolvedValues[propertyName] =
|
|
2300
|
+
resolvedValues[propertyName] = overwritingValue ?? propertyDefinition?.defaultValue;
|
|
2317
2301
|
}
|
|
2318
2302
|
else {
|
|
2319
2303
|
// Keep raw values
|
|
@@ -2398,15 +2382,15 @@ const resolveBackgroundImageBinding = ({ variableData, getBoundEntityById, dataS
|
|
|
2398
2382
|
// @ts-expect-error TODO: Types coming from validations erroneously assume that `defaultValue` can be a primitive value (e.g. string or number)
|
|
2399
2383
|
const defaultValueKey = variableDefinition.defaultValue?.key;
|
|
2400
2384
|
const defaultValue = unboundValues[defaultValueKey].value;
|
|
2401
|
-
const
|
|
2402
|
-
//
|
|
2403
|
-
if (!
|
|
2385
|
+
const userSetValue = componentVariablesOverwrites?.[variableDefinitionKey];
|
|
2386
|
+
// userSetValue is a ComponentValue we can safely return the default value
|
|
2387
|
+
if (!userSetValue || userSetValue.type === 'ComponentValue') {
|
|
2404
2388
|
return defaultValue;
|
|
2405
2389
|
}
|
|
2406
|
-
// at this point
|
|
2390
|
+
// at this point userSetValue will either be type of 'DesignValue' or 'BoundValue'
|
|
2407
2391
|
// so we recursively run resolution again to resolve it
|
|
2408
2392
|
const resolvedValue = resolveBackgroundImageBinding({
|
|
2409
|
-
variableData:
|
|
2393
|
+
variableData: userSetValue,
|
|
2410
2394
|
getBoundEntityById,
|
|
2411
2395
|
dataSource,
|
|
2412
2396
|
unboundValues,
|
|
@@ -2559,10 +2543,10 @@ const indexByBreakpoint = ({ variables, breakpointIds, getBoundEntityById, unbou
|
|
|
2559
2543
|
let resolvedVariableData = variableData;
|
|
2560
2544
|
if (variableData.type === 'ComponentValue') {
|
|
2561
2545
|
const variableDefinition = componentSettings?.variableDefinitions[variableData.key];
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2546
|
+
if (variableDefinition.group === 'style' && variableDefinition.defaultValue !== undefined) {
|
|
2547
|
+
const overrideVariableData = componentVariablesOverwrites?.[variableData.key];
|
|
2548
|
+
resolvedVariableData =
|
|
2549
|
+
overrideVariableData || variableDefinition.defaultValue;
|
|
2566
2550
|
}
|
|
2567
2551
|
}
|
|
2568
2552
|
if (resolvedVariableData.type !== 'DesignValue') {
|
|
@@ -2618,12 +2602,6 @@ const toMediaQuery = ({ condition, cssByClassName }) => {
|
|
|
2618
2602
|
const mediaQueryRule = evaluation === '<' ? 'max-width' : 'min-width';
|
|
2619
2603
|
return `@media(${mediaQueryRule}:${pixelValue}){${mediaQueryStyles}}`;
|
|
2620
2604
|
};
|
|
2621
|
-
function mergeDefaultAndOverwriteValues(defaultValue, overwriteValue) {
|
|
2622
|
-
if (defaultValue?.type === 'DesignValue' && overwriteValue?.type === 'DesignValue') {
|
|
2623
|
-
return mergeDesignValuesByBreakpoint(defaultValue, overwriteValue);
|
|
2624
|
-
}
|
|
2625
|
-
return overwriteValue ?? defaultValue;
|
|
2626
|
-
}
|
|
2627
2605
|
|
|
2628
2606
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2629
2607
|
function get(obj, path) {
|
|
@@ -4136,5 +4114,5 @@ async function fetchById({ client, experienceTypeId, id, localeCode, isEditorMod
|
|
|
4136
4114
|
}
|
|
4137
4115
|
}
|
|
4138
4116
|
|
|
4139
|
-
export { DebugLogger, DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles, createExperience, debug, defineBreakpoints, defineDesignTokens, designTokensRegistry, detachExperienceStyles, disableDebug, dividerBuiltInStyles, doesMismatchMessageSchema, enableDebug, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, fetchExperienceEntry, fetchReferencedEntities, findOutermostCoordinates, flattenDesignTokenRegistry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateRandomId, getActiveBreakpointIndex, getBreakpointRegistration, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getInsertionData, getTargetValueInPixels, getTemplateValue, getValueForBreakpoint, indexByBreakpoint, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isExperienceEntry, isLink, isLinkToAsset, isPatternComponent, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, localizeEntity, maybePopulateDesignTokenValue, mediaQueryMatcher,
|
|
4117
|
+
export { DebugLogger, DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles, createExperience, debug, defineBreakpoints, defineDesignTokens, designTokensRegistry, detachExperienceStyles, disableDebug, dividerBuiltInStyles, doesMismatchMessageSchema, enableDebug, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, fetchExperienceEntry, fetchReferencedEntities, findOutermostCoordinates, flattenDesignTokenRegistry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateRandomId, getActiveBreakpointIndex, getBreakpointRegistration, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getInsertionData, getTargetValueInPixels, getTemplateValue, getValueForBreakpoint, indexByBreakpoint, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isExperienceEntry, isLink, isLinkToAsset, isPatternComponent, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, localizeEntity, maybePopulateDesignTokenValue, mediaQueryMatcher, optionalBuiltInStyles, parseCSSValue, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, resetBreakpointsRegistry, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sanitizeNodeProps, sectionBuiltInStyles, sendMessage, singleColumnBuiltInStyles, stringifyCssProperties, toCSSAttribute, toMediaQuery, transformBoundContentValue, treeMap, treeVisit, tryParseMessage, validateExperienceBuilderConfig };
|
|
4140
4118
|
//# sourceMappingURL=index.js.map
|