@contentful/experiences-core 3.7.0-dev-20250918T1641-6da833a.0 → 3.7.0-dev-20250918T1653-d735f6f.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 +40 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +37 -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
|
})
|
|
@@ -1519,11 +1519,42 @@ const validateBreakpointsDefinition = (breakpoints) => {
|
|
|
1519
1519
|
return { success: true };
|
|
1520
1520
|
};
|
|
1521
1521
|
|
|
1522
|
-
|
|
1522
|
+
const breakpointsRegistry = [];
|
|
1523
1523
|
/**
|
|
1524
|
-
*
|
|
1525
|
-
*
|
|
1526
|
-
*
|
|
1524
|
+
* Define custom breakpoints that should be used for all your experiences.
|
|
1525
|
+
* A breakpoint consists of:
|
|
1526
|
+
* - id: a unique identifier for this breakpoint
|
|
1527
|
+
* - query: a media query string that defines when this breakpoint is active
|
|
1528
|
+
* - previewSize: an optional fixed preview size to be used in the Studio editor when selecting this breakpoint
|
|
1529
|
+
* - displayName: the name to be displayed in the Studio editor for this breakpoint
|
|
1530
|
+
* - displayIcon: an optional icon to be displayed in the Studio editor for this breakpoint
|
|
1531
|
+
*
|
|
1532
|
+
* The first breakpoint must use a wildcard query (`*`) to match all sizes.
|
|
1533
|
+
*
|
|
1534
|
+
* Every subsequent breakpoint inherits the designs of the previous ones by default.
|
|
1535
|
+
*
|
|
1536
|
+
* The order of breakpoints must be either:
|
|
1537
|
+
* - desktop first: from largest to smallest, using `<` operators
|
|
1538
|
+
* - mobile first: from smallest to largest, using `>` operators
|
|
1539
|
+
*
|
|
1540
|
+
* @note changing breakpoints after you have created experiences may break those experiences
|
|
1541
|
+
* @example
|
|
1542
|
+
* defineBreakpoints([{
|
|
1543
|
+
* id: 'desktop',
|
|
1544
|
+
* query: '*',
|
|
1545
|
+
* displayName: 'Desktop',
|
|
1546
|
+
* displayIcon: 'desktop',
|
|
1547
|
+
* }, {
|
|
1548
|
+
* id: 'tablet',
|
|
1549
|
+
* query: '<992px',
|
|
1550
|
+
* displayName: 'Tablet',
|
|
1551
|
+
* displayIcon: 'tablet',
|
|
1552
|
+
* }, {
|
|
1553
|
+
* id: 'mobile',
|
|
1554
|
+
* query: '<576px',
|
|
1555
|
+
* displayName: 'Mobile',
|
|
1556
|
+
* displayIcon: 'mobile',
|
|
1557
|
+
* }]);
|
|
1527
1558
|
*/
|
|
1528
1559
|
const defineBreakpoints = (breakpoints) => {
|
|
1529
1560
|
Object.assign(breakpointsRegistry, breakpoints);
|
|
@@ -1536,12 +1567,6 @@ const runBreakpointsValidation = () => {
|
|
|
1536
1567
|
throw new Error(`Invalid breakpoints definition. Failed with errors: \n${JSON.stringify(validation.errors, null, 2)}`);
|
|
1537
1568
|
}
|
|
1538
1569
|
};
|
|
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
1570
|
|
|
1546
1571
|
const sdkOptionsRegistry = {};
|
|
1547
1572
|
/**
|
|
@@ -5250,5 +5275,5 @@ async function fetchById({ client, experienceTypeId, id, localeCode, isEditorMod
|
|
|
5250
5275
|
}
|
|
5251
5276
|
}
|
|
5252
5277
|
|
|
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,
|
|
5278
|
+
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
5279
|
//# sourceMappingURL=index.js.map
|