@contentful/experiences-core 3.7.0-dev-20250918T1641-6da833a.0 → 3.7.0-dev-20250919T0754-9f36582.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/entity/EntityStore.d.ts +1 -1
- package/dist/index.cjs +53 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +50 -12
- package/dist/index.js.map +1 -1
- package/dist/registries/breakpointsRegistry.d.ts +36 -13
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,6 @@ export { createExperience } from './fetchers/createExperience.js';
|
|
|
37
37
|
export { fetchReferencedEntities } from './fetchers/fetchReferencedEntities.js';
|
|
38
38
|
export { fetchExperienceEntry } from './fetchers/fetchExperienceEntry.js';
|
|
39
39
|
export { defineDesignTokens, designTokensRegistry, getDesignTokenRegistration, resetDesignTokenRegistry } from './registries/designTokenRegistry.js';
|
|
40
|
-
export { breakpointsRegistry, defineBreakpoints,
|
|
40
|
+
export { breakpointsRegistry, defineBreakpoints, runBreakpointsValidation } from './registries/breakpointsRegistry.js';
|
|
41
41
|
export { defineSdkOptions, getSdkOptions, sdkOptionsRegistry } from './registries/sdkOptionsRegistry.js';
|
|
42
42
|
export { DeepReference, gatherDeepPrebindingReferencesFromExperienceEntry, gatherDeepPrebindingReferencesFromPatternEntry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree } from './deep-binding/DeepReference.js';
|
package/dist/index.js
CHANGED
|
@@ -998,7 +998,7 @@ const BreakpointSchema = z
|
|
|
998
998
|
id: propertyKeySchema,
|
|
999
999
|
// Can be replace with z.templateLiteral when upgrading to zod v4
|
|
1000
1000
|
query: z.string().refine((s) => BREAKPOINT_QUERY_REGEX.test(s)),
|
|
1001
|
-
previewSize: z.string(),
|
|
1001
|
+
previewSize: z.string().optional(),
|
|
1002
1002
|
displayName: z.string(),
|
|
1003
1003
|
displayIcon: z.enum(['desktop', 'tablet', 'mobile']).optional(),
|
|
1004
1004
|
})
|
|
@@ -1035,6 +1035,19 @@ const ComponentVariableSchema = z.object({
|
|
|
1035
1035
|
});
|
|
1036
1036
|
const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
|
|
1037
1037
|
children: z.lazy(() => ComponentTreeNodeSchema.array()),
|
|
1038
|
+
}).superRefine(({ id, prebindingId, parameters }, ctx) => {
|
|
1039
|
+
if (prebindingId && !parameters) {
|
|
1040
|
+
ctx.addIssue({
|
|
1041
|
+
code: z.ZodIssueCode.custom,
|
|
1042
|
+
message: `Found "prebindingId" but no "parameters" for node with id: "${id}"`,
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
if (parameters && !prebindingId) {
|
|
1046
|
+
ctx.addIssue({
|
|
1047
|
+
code: z.ZodIssueCode.custom,
|
|
1048
|
+
message: `Found "parameters" but no "prebindingId" for node with id: "${id}"`,
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1038
1051
|
});
|
|
1039
1052
|
const ComponentTreeSchema = z
|
|
1040
1053
|
.object({
|
|
@@ -1519,11 +1532,42 @@ const validateBreakpointsDefinition = (breakpoints) => {
|
|
|
1519
1532
|
return { success: true };
|
|
1520
1533
|
};
|
|
1521
1534
|
|
|
1522
|
-
|
|
1535
|
+
const breakpointsRegistry = [];
|
|
1523
1536
|
/**
|
|
1524
|
-
*
|
|
1525
|
-
*
|
|
1526
|
-
*
|
|
1537
|
+
* Define custom breakpoints that should be used for all your experiences.
|
|
1538
|
+
* A breakpoint consists of:
|
|
1539
|
+
* - id: a unique identifier for this breakpoint
|
|
1540
|
+
* - query: a media query string that defines when this breakpoint is active
|
|
1541
|
+
* - previewSize: an optional fixed preview size to be used in the Studio editor when selecting this breakpoint
|
|
1542
|
+
* - displayName: the name to be displayed in the Studio editor for this breakpoint
|
|
1543
|
+
* - displayIcon: an optional icon to be displayed in the Studio editor for this breakpoint
|
|
1544
|
+
*
|
|
1545
|
+
* The first breakpoint must use a wildcard query (`*`) to match all sizes.
|
|
1546
|
+
*
|
|
1547
|
+
* Every subsequent breakpoint inherits the designs of the previous ones by default.
|
|
1548
|
+
*
|
|
1549
|
+
* The order of breakpoints must be either:
|
|
1550
|
+
* - desktop first: from largest to smallest, using `<` operators
|
|
1551
|
+
* - mobile first: from smallest to largest, using `>` operators
|
|
1552
|
+
*
|
|
1553
|
+
* @note changing breakpoints after you have created experiences may break those experiences
|
|
1554
|
+
* @example
|
|
1555
|
+
* defineBreakpoints([{
|
|
1556
|
+
* id: 'desktop',
|
|
1557
|
+
* query: '*',
|
|
1558
|
+
* displayName: 'Desktop',
|
|
1559
|
+
* displayIcon: 'desktop',
|
|
1560
|
+
* }, {
|
|
1561
|
+
* id: 'tablet',
|
|
1562
|
+
* query: '<992px',
|
|
1563
|
+
* displayName: 'Tablet',
|
|
1564
|
+
* displayIcon: 'tablet',
|
|
1565
|
+
* }, {
|
|
1566
|
+
* id: 'mobile',
|
|
1567
|
+
* query: '<576px',
|
|
1568
|
+
* displayName: 'Mobile',
|
|
1569
|
+
* displayIcon: 'mobile',
|
|
1570
|
+
* }]);
|
|
1527
1571
|
*/
|
|
1528
1572
|
const defineBreakpoints = (breakpoints) => {
|
|
1529
1573
|
Object.assign(breakpointsRegistry, breakpoints);
|
|
@@ -1536,12 +1580,6 @@ const runBreakpointsValidation = () => {
|
|
|
1536
1580
|
throw new Error(`Invalid breakpoints definition. Failed with errors: \n${JSON.stringify(validation.errors, null, 2)}`);
|
|
1537
1581
|
}
|
|
1538
1582
|
};
|
|
1539
|
-
// Used in the tests to get a breakpoint registration
|
|
1540
|
-
const getBreakpointRegistration = (id) => breakpointsRegistry.find((breakpoint) => breakpoint.id === id);
|
|
1541
|
-
// Used in the tests to reset the registry
|
|
1542
|
-
const resetBreakpointsRegistry = () => {
|
|
1543
|
-
breakpointsRegistry = [];
|
|
1544
|
-
};
|
|
1545
1583
|
|
|
1546
1584
|
const sdkOptionsRegistry = {};
|
|
1547
1585
|
/**
|
|
@@ -5250,5 +5288,5 @@ async function fetchById({ client, experienceTypeId, id, localeCode, isEditorMod
|
|
|
5250
5288
|
}
|
|
5251
5289
|
}
|
|
5252
5290
|
|
|
5253
|
-
export { BREAKPOINTS_STRATEGY_DESKTOP_FIRST, BREAKPOINTS_STRATEGY_MOBILE_FIRST, DebugLogger, DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles, createExperience, debug, defineBreakpoints, defineDesignTokens, defineSdkOptions, designTokensRegistry, detachExperienceStyles, detectBreakpointsStrategy, disableDebug, dividerBuiltInStyles, doesMismatchMessageSchema, enableDebug, extractLeafLinksReferencedFromExperience, extractPrebindingDataByPatternId, extractReferencesFromEntries, extractReferencesFromEntriesAsIds, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, fetchExperienceEntry, fetchReferencedEntities, findOutermostCoordinates, flattenDesignTokenRegistry, flattenNestedPatterns, gatherDeepPrebindingReferencesFromExperienceEntry, gatherDeepPrebindingReferencesFromPatternEntry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateDefaultDataSourceForPrebindingDefinition, generateRandomId, getActiveBreakpointIndex,
|
|
5291
|
+
export { BREAKPOINTS_STRATEGY_DESKTOP_FIRST, BREAKPOINTS_STRATEGY_MOBILE_FIRST, DebugLogger, DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles, createExperience, debug, defineBreakpoints, defineDesignTokens, defineSdkOptions, designTokensRegistry, detachExperienceStyles, detectBreakpointsStrategy, disableDebug, dividerBuiltInStyles, doesMismatchMessageSchema, enableDebug, extractLeafLinksReferencedFromExperience, extractPrebindingDataByPatternId, extractReferencesFromEntries, extractReferencesFromEntriesAsIds, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, fetchExperienceEntry, fetchReferencedEntities, findOutermostCoordinates, flattenDesignTokenRegistry, flattenNestedPatterns, gatherDeepPrebindingReferencesFromExperienceEntry, gatherDeepPrebindingReferencesFromPatternEntry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateDefaultDataSourceForPrebindingDefinition, generateRandomId, getActiveBreakpointIndex, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getPrebindingPathBySourceEntry, getSdkOptions, getTargetPatternMappingsForParameter, getTargetValueInPixels, getTemplateValue, getValueForBreakpoint, inMemoryEntities, inMemoryEntitiesStore, indexByBreakpoint, isArrayOfLinks, isAsset, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isDeepPrebinding, isElementHidden, isEntry, isExperienceEntry, isLink, isLinkToAsset, isLinkToEntry, isPatternComponent, isPatternEntry, isPreboundProp, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, localizeEntity, maybePopulateDesignTokenValue, mediaQueryMatcher, mergeDesignValuesByBreakpoint, optionalBuiltInStyles, parseCSSValue, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, referencesOf, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sanitizeNodeProps, sdkOptionsRegistry, sectionBuiltInStyles, sendMessage, setDebugLevel, singleColumnBuiltInStyles, splitDirectAndSlotChildren, stringifyCssProperties, toCSSAttribute, toMediaQuery, transformBoundContentValue, transformVisibility, treeMap, treeVisit, tryParseMessage, uniqueById, useInMemoryEntities, validateExperienceBuilderConfig };
|
|
5254
5292
|
//# sourceMappingURL=index.js.map
|