@contentful/experiences-core 1.16.0-dev-20240912T1817-4f0cf3e.0 → 1.16.0-dev-20240916T1430-3c5ff38.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 +2 -1
- package/dist/index.js +45 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/breakpoints.d.ts +3 -2
- package/dist/utils/patternUtils.d.ts +15 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -6,11 +6,12 @@ export { detachExperienceStyles, flattenDesignTokenRegistry, indexByBreakpoint,
|
|
|
6
6
|
export { transformBoundContentValue } from './utils/transformers/transformBoundContentValue.js';
|
|
7
7
|
export { checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, generateRandomId, getDataFromTree, getInsertionData } from './utils/utils.js';
|
|
8
8
|
export { isExperienceEntry } from './utils/typeguards.js';
|
|
9
|
-
export { MEDIA_QUERY_REGEXP, getActiveBreakpointIndex, getFallbackBreakpointIndex, getValueForBreakpoint, mediaQueryMatcher } from './utils/breakpoints.js';
|
|
9
|
+
export { MEDIA_QUERY_REGEXP, getActiveBreakpointIndex, getFallbackBreakpointIndex, getValueForBreakpoint, isValidBreakpointValue, mediaQueryMatcher } from './utils/breakpoints.js';
|
|
10
10
|
export { isLinkToAsset } from './utils/isLinkToAsset.js';
|
|
11
11
|
export { isLink } from './utils/isLink.js';
|
|
12
12
|
export { Fieldset, UnresolvedFieldset, isDeepPath, lastPathNamedSegmentEq, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings } from './utils/pathSchema.js';
|
|
13
13
|
export { addLocale, buildTemplate, getTemplateValue, resolveHyperlinkPattern } from './utils/resolveHyperlinkPattern.js';
|
|
14
|
+
export { deserializePatternVariables } from './utils/patternUtils.js';
|
|
14
15
|
export { columnsDefinition, containerDefinition, dividerDefinition, sectionDefinition, singleColumnDefinition } from './definitions/components.js';
|
|
15
16
|
export { builtInStyles, columnsBuiltInStyles, containerBuiltInStyles, dividerBuiltInStyles, optionalBuiltInStyles, sectionBuiltInStyles, singleColumnBuiltInStyles } from './definitions/styles.js';
|
|
16
17
|
export { EditorModeEntityStore } from './entity/EditorModeEntityStore.js';
|
package/dist/index.js
CHANGED
|
@@ -1961,7 +1961,7 @@ const indexByBreakpoint = ({ variables, breakpointIds, getBoundEntityById, unbou
|
|
|
1961
1961
|
continue;
|
|
1962
1962
|
}
|
|
1963
1963
|
for (const [breakpointId, variableValue] of Object.entries(resolvedVariableData.valuesByBreakpoint)) {
|
|
1964
|
-
if (
|
|
1964
|
+
if (!isValidBreakpointValue(variableValue)) {
|
|
1965
1965
|
continue;
|
|
1966
1966
|
}
|
|
1967
1967
|
variableValuesByBreakpoints[breakpointId] = {
|
|
@@ -2673,6 +2673,49 @@ function buildTemplate({ template, context, }) {
|
|
|
2673
2673
|
}));
|
|
2674
2674
|
}
|
|
2675
2675
|
|
|
2676
|
+
const deserializePatternVariables = ({ nodeVariables, componentInstanceProps, componentInstanceUnboundValues, componentInstanceDataSource, patternVariableDefinitions, }) => {
|
|
2677
|
+
const childNodeVariable = {};
|
|
2678
|
+
const dataSource = {};
|
|
2679
|
+
const unboundValues = {};
|
|
2680
|
+
for (const [variableName, variable] of Object.entries(nodeVariables)) {
|
|
2681
|
+
childNodeVariable[variableName] = variable;
|
|
2682
|
+
if (variable.type === 'ComponentValue') {
|
|
2683
|
+
const componentValueKey = variable.key;
|
|
2684
|
+
const instanceProperty = componentInstanceProps[componentValueKey];
|
|
2685
|
+
const variableDefinition = patternVariableDefinitions?.[componentValueKey];
|
|
2686
|
+
const defaultValue = variableDefinition?.defaultValue;
|
|
2687
|
+
// For pattern, we look up the value in the pattern instance and
|
|
2688
|
+
// replace the componentValue with that one.
|
|
2689
|
+
if (instanceProperty?.type === 'UnboundValue') {
|
|
2690
|
+
const componentInstanceValue = componentInstanceUnboundValues[instanceProperty.key];
|
|
2691
|
+
unboundValues[instanceProperty.key] = componentInstanceValue;
|
|
2692
|
+
childNodeVariable[variableName] = instanceProperty;
|
|
2693
|
+
}
|
|
2694
|
+
else if (instanceProperty?.type === 'BoundValue') {
|
|
2695
|
+
const [, dataSourceKey] = instanceProperty.path.split('/');
|
|
2696
|
+
const componentInstanceValue = componentInstanceDataSource[dataSourceKey];
|
|
2697
|
+
dataSource[dataSourceKey] = componentInstanceValue;
|
|
2698
|
+
childNodeVariable[variableName] = instanceProperty;
|
|
2699
|
+
}
|
|
2700
|
+
else if (instanceProperty?.type === 'HyperlinkValue') {
|
|
2701
|
+
const componentInstanceValue = componentInstanceDataSource[instanceProperty.linkTargetKey];
|
|
2702
|
+
dataSource[instanceProperty.linkTargetKey] == componentInstanceValue;
|
|
2703
|
+
childNodeVariable[variableName] = instanceProperty;
|
|
2704
|
+
}
|
|
2705
|
+
else if (instanceProperty?.type === 'DesignValue') {
|
|
2706
|
+
childNodeVariable[variableName] = instanceProperty;
|
|
2707
|
+
}
|
|
2708
|
+
else if (!instanceProperty && defaultValue) {
|
|
2709
|
+
// So far, we only automatically fallback to the defaultValue for design properties
|
|
2710
|
+
if (variableDefinition.group === 'style') {
|
|
2711
|
+
childNodeVariable[variableName] = defaultValue;
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
}
|
|
2716
|
+
return { childNodeVariable, dataSource, unboundValues };
|
|
2717
|
+
};
|
|
2718
|
+
|
|
2676
2719
|
const sendMessage = (eventType, data) => {
|
|
2677
2720
|
if (typeof window === 'undefined') {
|
|
2678
2721
|
return;
|
|
@@ -3606,5 +3649,5 @@ async function fetchById({ client, experienceTypeId, id, localeCode, }) {
|
|
|
3606
3649
|
}
|
|
3607
3650
|
}
|
|
3608
3651
|
|
|
3609
|
-
export { DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, columnsDefinition, containerBuiltInStyles, containerDefinition, createExperience, defineBreakpoints, defineDesignTokens, designTokensRegistry, detachExperienceStyles, dividerBuiltInStyles, dividerDefinition, doesMismatchMessageSchema, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, findOutermostCoordinates, flattenDesignTokenRegistry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateRandomId, getActiveBreakpointIndex, getBreakpointRegistration, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getInsertionData, getTemplateValue, getValueForBreakpoint, indexByBreakpoint, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isExperienceEntry, isLink, isLinkToAsset, isStructureWithRelativeHeight, lastPathNamedSegmentEq, maybePopulateDesignTokenValue, mediaQueryMatcher, optionalBuiltInStyles, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, resetBreakpointsRegistry, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sectionBuiltInStyles, sectionDefinition, sendMessage, singleColumnBuiltInStyles, singleColumnDefinition, toCSSAttribute, toCSSString, toMediaQuery, transformBoundContentValue, tryParseMessage, validateExperienceBuilderConfig };
|
|
3652
|
+
export { DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, columnsDefinition, containerBuiltInStyles, containerDefinition, createExperience, defineBreakpoints, defineDesignTokens, deserializePatternVariables, designTokensRegistry, detachExperienceStyles, dividerBuiltInStyles, dividerDefinition, doesMismatchMessageSchema, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, findOutermostCoordinates, flattenDesignTokenRegistry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateRandomId, getActiveBreakpointIndex, getBreakpointRegistration, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getInsertionData, getTemplateValue, getValueForBreakpoint, indexByBreakpoint, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isExperienceEntry, isLink, isLinkToAsset, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, maybePopulateDesignTokenValue, mediaQueryMatcher, optionalBuiltInStyles, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, resetBreakpointsRegistry, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sectionBuiltInStyles, sectionDefinition, sendMessage, singleColumnBuiltInStyles, singleColumnDefinition, toCSSAttribute, toCSSString, toMediaQuery, transformBoundContentValue, tryParseMessage, validateExperienceBuilderConfig };
|
|
3610
3653
|
//# sourceMappingURL=index.js.map
|