@contentful/experiences-core 3.8.2-dev-20251008T0828-a06681d.0 → 3.8.3-beta.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/{constants.cjs → cjs/constants.cjs} +2 -0
- package/dist/cjs/constants.cjs.map +1 -0
- package/dist/{index.cjs → cjs/index.cjs} +129 -127
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/types/index.d.ts +1675 -0
- package/package.json +17 -21
- package/dist/communication/sendMessage.d.ts +0 -5
- package/dist/constants.cjs.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/deep-binding/DeepReference.d.ts +0 -44
- package/dist/definitions/styles.d.ts +0 -11
- package/dist/entity/EditorEntityStore.d.ts +0 -34
- package/dist/entity/EditorModeEntityStore.d.ts +0 -28
- package/dist/entity/EntityStore.d.ts +0 -99
- package/dist/entity/EntityStoreBase.d.ts +0 -53
- package/dist/entity/InMemoryEntitiesPublicApi.d.ts +0 -41
- package/dist/entity/InMemoryEntitiesStore.d.ts +0 -17
- package/dist/enums.d.ts +0 -6
- package/dist/exports.d.ts +0 -3
- package/dist/fetchers/createExperience.d.ts +0 -25
- package/dist/fetchers/fetchAllEntities.d.ts +0 -30
- package/dist/fetchers/fetchById.d.ts +0 -24
- package/dist/fetchers/fetchBySlug.d.ts +0 -24
- package/dist/fetchers/fetchExperienceEntry.d.ts +0 -30
- package/dist/fetchers/fetchReferencedEntities.d.ts +0 -28
- package/dist/fetchers/gatherAutoFetchedReferentsFromIncludes.d.ts +0 -11
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -42
- package/dist/index.js.map +0 -1
- package/dist/registries/breakpointsRegistry.d.ts +0 -43
- package/dist/registries/designTokenRegistry.d.ts +0 -13
- package/dist/registries/sdkOptionsRegistry.d.ts +0 -11
- package/dist/types.d.ts +0 -630
- package/dist/utils/breakpoints.d.ts +0 -26
- package/dist/utils/components.d.ts +0 -17
- package/dist/utils/debugLogger.d.ts +0 -36
- package/dist/utils/domValues.d.ts +0 -16
- package/dist/utils/extractPrebindingData.d.ts +0 -46
- package/dist/utils/isLink.d.ts +0 -7
- package/dist/utils/isLinkToAsset.d.ts +0 -5
- package/dist/utils/isLinkToEntry.d.ts +0 -5
- package/dist/utils/localizeEntity.d.ts +0 -24
- package/dist/utils/pathSchema.d.ts +0 -43
- package/dist/utils/resolveHyperlinkPattern.d.ts +0 -17
- package/dist/utils/sanitizeNodeProps.d.ts +0 -7
- package/dist/utils/schema/experienceSchema.d.ts +0 -23
- package/dist/utils/schema/references.d.ts +0 -18
- package/dist/utils/splitDirectAndSlotChildren.d.ts +0 -12
- package/dist/utils/styleUtils/ssrStyles.d.ts +0 -75
- package/dist/utils/styleUtils/styleTransformers.d.ts +0 -6
- package/dist/utils/styleUtils/stylesUtils.d.ts +0 -64
- package/dist/utils/styleUtils/toMediaQuery.d.ts +0 -15
- package/dist/utils/transformers/transformBoundContentValue.d.ts +0 -8
- package/dist/utils/treeTraversal.d.ts +0 -17
- package/dist/utils/typeguards.d.ts +0 -15
- package/dist/utils/utils.d.ts +0 -32
- package/dist/utils/validations.d.ts +0 -11
- package/dist/{constants.js → esm/constants.js} +0 -0
- package/dist/{index.js → esm/index.js} +127 -127
- /package/dist/{constants.d.ts → types/constants.d.ts} +0 -0
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
declare const DEBUG_LEVELS_HIERARCHY: readonly ["error", "warn", "log", "debug"];
|
|
2
|
-
type DEBUG_LEVEL = (typeof DEBUG_LEVELS_HIERARCHY)[number];
|
|
3
|
-
declare class DebugLogger {
|
|
4
|
-
private static instance;
|
|
5
|
-
private activeLevel;
|
|
6
|
-
constructor();
|
|
7
|
-
static getInstance(): DebugLogger;
|
|
8
|
-
getActiveLevel(): "error" | "warn" | "log" | "debug";
|
|
9
|
-
setActiveLevel(level: DEBUG_LEVEL): void;
|
|
10
|
-
private logger;
|
|
11
|
-
error: {
|
|
12
|
-
(...data: any[]): void;
|
|
13
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
14
|
-
};
|
|
15
|
-
warn: {
|
|
16
|
-
(...data: any[]): void;
|
|
17
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
18
|
-
};
|
|
19
|
-
log: {
|
|
20
|
-
(...data: any[]): void;
|
|
21
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
22
|
-
};
|
|
23
|
-
debug: {
|
|
24
|
-
(...data: any[]): void;
|
|
25
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
declare const debug: DebugLogger;
|
|
29
|
-
/** Set the logging level to `debug` */
|
|
30
|
-
declare const enableDebug: () => void;
|
|
31
|
-
/** Set the debug level to `warn` */
|
|
32
|
-
declare const disableDebug: () => void;
|
|
33
|
-
/** Set the debug level to the provided level */
|
|
34
|
-
declare const setDebugLevel: (level: DEBUG_LEVEL) => void;
|
|
35
|
-
|
|
36
|
-
export { DebugLogger, debug, disableDebug, enableDebug, setDebugLevel };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
type Rect = {
|
|
2
|
-
top: number;
|
|
3
|
-
right: number;
|
|
4
|
-
bottom: number;
|
|
5
|
-
left: number;
|
|
6
|
-
};
|
|
7
|
-
declare const findOutermostCoordinates: (first: Rect, second: Rect) => {
|
|
8
|
-
top: number;
|
|
9
|
-
right: number;
|
|
10
|
-
bottom: number;
|
|
11
|
-
left: number;
|
|
12
|
-
};
|
|
13
|
-
declare const isElementHidden: (rect: DOMRect) => boolean;
|
|
14
|
-
declare const getElementCoordinates: (element: Element) => DOMRect;
|
|
15
|
-
|
|
16
|
-
export { findOutermostCoordinates, getElementCoordinates, isElementHidden };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { ExperienceEntry } from '../types.js';
|
|
2
|
-
import { ParameterDefinition, VariableMapping, ExperienceComponentSettings } from '@contentful/experiences-validators';
|
|
3
|
-
|
|
4
|
-
type PrebindingData = {
|
|
5
|
-
prebindingDefinitionId: string;
|
|
6
|
-
parameterIds: Array<string>;
|
|
7
|
-
nativeParameterId?: string;
|
|
8
|
-
parameterDefinitions: Record<string, ParameterDefinition>;
|
|
9
|
-
variableMappings?: Record<string, VariableMapping>;
|
|
10
|
-
};
|
|
11
|
-
declare const flattenNestedPatterns: (fetchedPatterns: Array<ExperienceEntry>) => ExperienceEntry[];
|
|
12
|
-
/**
|
|
13
|
-
* Given a list of patterns, extract the prebinding data into a more digestable format indexed by the pattern entry id
|
|
14
|
-
* @param patterns a list of pattern entries
|
|
15
|
-
* @returns a map of pattern entry ids to their prebinding data
|
|
16
|
-
*/
|
|
17
|
-
declare const extractPrebindingDataByPatternId: (patterns: Array<ExperienceEntry>) => Record<string, PrebindingData>;
|
|
18
|
-
declare const generateDefaultDataSourceForPrebindingDefinition: (prebindingDefinitions?: ExperienceComponentSettings["prebindingDefinitions"]) => {
|
|
19
|
-
dataSource: Record<string, {
|
|
20
|
-
sys: {
|
|
21
|
-
type: "Link";
|
|
22
|
-
id: string;
|
|
23
|
-
linkType: "Entry" | "Asset";
|
|
24
|
-
};
|
|
25
|
-
}>;
|
|
26
|
-
parameters: Record<string, {
|
|
27
|
-
path: string;
|
|
28
|
-
type: "BoundValue";
|
|
29
|
-
}>;
|
|
30
|
-
};
|
|
31
|
-
declare function getTargetPatternMappingsForParameter({ fetchedPatterns, prebindingDataByPatternId, patternNodeDefinitionId, parameterId, }: {
|
|
32
|
-
fetchedPatterns: Array<ExperienceEntry>;
|
|
33
|
-
prebindingDataByPatternId: Record<string, PrebindingData>;
|
|
34
|
-
patternNodeDefinitionId: string;
|
|
35
|
-
parameterId: string;
|
|
36
|
-
}): {
|
|
37
|
-
[k: string]: {
|
|
38
|
-
type: "ContentTypeMapping";
|
|
39
|
-
parameterId: string;
|
|
40
|
-
pathsByContentType: Record<string, {
|
|
41
|
-
path: string;
|
|
42
|
-
}>;
|
|
43
|
-
};
|
|
44
|
-
} | undefined;
|
|
45
|
-
|
|
46
|
-
export { type PrebindingData, extractPrebindingDataByPatternId, flattenNestedPatterns, generateDefaultDataSourceForPrebindingDefinition, getTargetPatternMappingsForParameter };
|
package/dist/utils/isLink.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { UnresolvedLink, Entry, Asset } from 'contentful';
|
|
2
|
-
|
|
3
|
-
declare function isLink(maybeLink: UnresolvedLink<'Entry'> | Entry | undefined): maybeLink is UnresolvedLink<'Entry'>;
|
|
4
|
-
declare function isLink(maybeLink: UnresolvedLink<'Asset'> | Asset | undefined): maybeLink is UnresolvedLink<'Asset'>;
|
|
5
|
-
declare function isLink(maybeLink: unknown): maybeLink is UnresolvedLink<'Entry' | 'Asset'>;
|
|
6
|
-
|
|
7
|
-
export { isLink };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Asset, Entry } from 'contentful';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Localizes the provided entry or asset to match the regular format of CDA/CPA entities.
|
|
5
|
-
* Note that this function does not apply a fallback to the default locale nor does it check
|
|
6
|
-
* the content type for the localization setting of each field.
|
|
7
|
-
* It will simply resolve each field to the requested locale. As using single and multiple
|
|
8
|
-
* reference fields is still considered an experimental feature, this function does not handle
|
|
9
|
-
* recursive localization of deeper referenced entities.
|
|
10
|
-
*
|
|
11
|
-
* If the entity is already localized, it will return the entity as is.
|
|
12
|
-
*
|
|
13
|
-
* Note that localization is later on determined by the existence of the `sys.locale` property (matching the API shape).
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```
|
|
17
|
-
* const multiLocaleEntry = { fields: { title: { 'en-US': 'Hello' } } };
|
|
18
|
-
* const localizedEntry = localizeEntity(multiLocaleEntry, 'en-US');
|
|
19
|
-
* console.log(localizedEntry.fields.title); // 'Hello'
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
declare function localizeEntity<T extends Asset | Entry>(entity: T, locale: string): T;
|
|
23
|
-
|
|
24
|
-
export { localizeEntity };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { ComponentPropertyValue, BoundValue } from '@contentful/experiences-validators';
|
|
2
|
-
import { Entry, Asset } from 'contentful';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This module encapsulates format of the path to a deep reference.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
type PreboundVariable = {
|
|
9
|
-
type: 'BoundValue';
|
|
10
|
-
path: string;
|
|
11
|
-
isPrebound: boolean;
|
|
12
|
-
pathsByContentType: Record<string, {
|
|
13
|
-
path: string;
|
|
14
|
-
}>;
|
|
15
|
-
};
|
|
16
|
-
declare const isPreboundProp: (variable: ComponentPropertyValue) => variable is PreboundVariable;
|
|
17
|
-
type UnresolvedFieldset = Array<[null, string, string?]>;
|
|
18
|
-
type Fieldset = Array<[Entry | Asset, string, string?]>;
|
|
19
|
-
declare const parseDataSourcePathIntoFieldset: (path: string) => UnresolvedFieldset;
|
|
20
|
-
/**
|
|
21
|
-
* Parse path into components, supports L1 references (one reference follow) atm.
|
|
22
|
-
* @param path from data source. eg. `/uuid123/fields/image/~locale/fields/file/~locale`
|
|
23
|
-
* eg. `/uuid123/fields/file/~locale/fields/title/~locale`
|
|
24
|
-
* @returns
|
|
25
|
-
*/
|
|
26
|
-
declare const parseDataSourcePathWithL1DeepBindings: (path: string) => {
|
|
27
|
-
key: string;
|
|
28
|
-
field: string;
|
|
29
|
-
referentField: string;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Detects if paths is valid deep-path, like:
|
|
33
|
-
* - /gV6yKXp61hfYrR7rEyKxY/fields/mainStory/~locale/fields/cover/~locale/fields/title/~locale
|
|
34
|
-
* or regular, like:
|
|
35
|
-
* - /6J8eA60yXwdm5eyUh9fX6/fields/mainStory/~locale
|
|
36
|
-
* @returns
|
|
37
|
-
*/
|
|
38
|
-
declare const isDeepPath: (deepPathCandidate: string) => boolean;
|
|
39
|
-
declare const isDeepPrebinding: (boundValueProperty: BoundValue) => boolean;
|
|
40
|
-
declare const getPrebindingPathBySourceEntry: (preboundValueProperty: PreboundVariable, getHeadEntityByDataSourceKey: (id: string) => Entry | Asset | undefined) => string | undefined;
|
|
41
|
-
declare const lastPathNamedSegmentEq: (path: string, expectedName: string) => boolean;
|
|
42
|
-
|
|
43
|
-
export { type Fieldset, type PreboundVariable, type UnresolvedFieldset, getPrebindingPathBySourceEntry, isDeepPath, isDeepPrebinding, isPreboundProp, lastPathNamedSegmentEq, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Entry } from 'contentful';
|
|
2
|
-
|
|
3
|
-
declare const resolveHyperlinkPattern: (pattern: string, entry: Entry | null, locale: string | null) => string | null;
|
|
4
|
-
declare function addLocale(str: string, locale: string): string;
|
|
5
|
-
declare function getTemplateValue(ctx: {
|
|
6
|
-
entry: Entry;
|
|
7
|
-
locale: string;
|
|
8
|
-
}, path: string): string | (() => string);
|
|
9
|
-
declare function buildTemplate({ template, context, }: {
|
|
10
|
-
template: string;
|
|
11
|
-
context: {
|
|
12
|
-
entry: Entry;
|
|
13
|
-
locale: string;
|
|
14
|
-
};
|
|
15
|
-
}): string;
|
|
16
|
-
|
|
17
|
-
export { addLocale, buildTemplate, getTemplateValue, resolveHyperlinkPattern };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { PrimitiveValue } from '@contentful/experiences-validators';
|
|
2
|
-
|
|
3
|
-
declare const sanitizeNodeProps: (nodeProps: Record<PropertyKey, PrimitiveValue>) => {
|
|
4
|
-
[k: string]: string | number | boolean | Record<any, any> | undefined;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export { sanitizeNodeProps };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Experience, Link } from '../../types.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Parses experience and extracts all leaf links that are referenced from the experience.
|
|
5
|
-
* PRECONDITION: Relies on the fact that entityStore is preloaded with all dataSource
|
|
6
|
-
* entries using include=2 (meaning that up to L3 entries are already preloaded into EntitStore).
|
|
7
|
-
*
|
|
8
|
-
* The function iterates over all entries in the entityStore (assuming they can be L1, L2, L3) and
|
|
9
|
-
* over all of their references. Any references that are NOT available in the entityStore are considered
|
|
10
|
-
* "leaf references" aka "leaf links" and are returned.
|
|
11
|
-
*
|
|
12
|
-
* The EntityStore happens to contain also entities representing patterns, which we do NOT consider
|
|
13
|
-
* as entries that point to leaf links. So we don't iterate over patterns only over entries which
|
|
14
|
-
* can be used for binding.
|
|
15
|
-
*/
|
|
16
|
-
declare const extractLeafLinksReferencedFromExperience: (experience: Experience) => {
|
|
17
|
-
assetLinks: Link<"Asset">[];
|
|
18
|
-
entryLinks: Link<"Entry">[];
|
|
19
|
-
assetIds: string[];
|
|
20
|
-
entryIds: string[];
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export { extractLeafLinksReferencedFromExperience };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Entry, UnresolvedLink } from 'contentful';
|
|
2
|
-
|
|
3
|
-
type FnShouldFollowReferencesOfEntryField = (fieldName: string, entry: Entry) => boolean;
|
|
4
|
-
declare const uniqueById: <T extends {
|
|
5
|
-
sys: {
|
|
6
|
-
id: string;
|
|
7
|
-
};
|
|
8
|
-
}>(arr: Array<T>) => T[];
|
|
9
|
-
/**
|
|
10
|
-
* Extracts all references from an entry.
|
|
11
|
-
* Handles both: reference and multi-reference fields.
|
|
12
|
-
* Returns unique array of references (even if they repeat within the entry).
|
|
13
|
-
*/
|
|
14
|
-
declare const referencesOf: (entry: Entry, fnShouldFollowReferencesOfEntryField?: FnShouldFollowReferencesOfEntryField) => UnresolvedLink<"Asset" | "Entry">[];
|
|
15
|
-
declare function extractReferencesFromEntriesAsIds(entries: Array<Entry>): [string[], string[], string[]];
|
|
16
|
-
declare function extractReferencesFromEntries(entries: Array<Entry>): [UnresolvedLink<'Entry'>[], UnresolvedLink<'Asset'>[], UnresolvedLink<'Entry' | 'Asset'>[]];
|
|
17
|
-
|
|
18
|
-
export { type FnShouldFollowReferencesOfEntryField, extractReferencesFromEntries, extractReferencesFromEntriesAsIds, referencesOf, uniqueById };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ExperienceTreeNode, ComponentRegistration } from '../types.js';
|
|
2
|
-
import { ComponentTreeNode } from '@contentful/experiences-validators';
|
|
3
|
-
|
|
4
|
-
declare const splitDirectAndSlotChildren: <T extends ExperienceTreeNode | ComponentTreeNode>(allChildNodes: T[], componentDefinition: ComponentRegistration["definition"]) => {
|
|
5
|
-
slotNodesMap: Record<string, T[] | null>;
|
|
6
|
-
directChildNodes: undefined;
|
|
7
|
-
} | {
|
|
8
|
-
slotNodesMap: Record<string, T[] | null>;
|
|
9
|
-
directChildNodes: T[];
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { splitDirectAndSlotChildren };
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Entry, Asset } from 'contentful/dist/types/types';
|
|
2
|
-
import { ComponentPropertyValue, ExperienceUnboundValues, ExperienceDataSource, ExperienceComponentSettings } from '@contentful/experiences-validators';
|
|
3
|
-
import { Experience, StyleProps, BackgroundImageOptions, DesignTokensDefinition } from '../../types.js';
|
|
4
|
-
|
|
5
|
-
type FlattenedDesignTokens = Record<string, string | {
|
|
6
|
-
width?: string;
|
|
7
|
-
style?: string;
|
|
8
|
-
color?: string;
|
|
9
|
-
}>;
|
|
10
|
-
declare const detachExperienceStyles: (experience: Experience) => string | undefined;
|
|
11
|
-
declare const isCfStyleAttribute: (variableName: string) => variableName is keyof StyleProps;
|
|
12
|
-
declare const maybePopulateDesignTokenValue: (variableName: string, variableValue: unknown, mapOfDesignVariableKeys: FlattenedDesignTokens) => unknown;
|
|
13
|
-
declare const resolveBackgroundImageBinding: ({ variableData, getBoundEntityById, dataSource, unboundValues, componentVariablesOverwrites, componentSettings, options, width, }: {
|
|
14
|
-
variableData: ComponentPropertyValue;
|
|
15
|
-
getBoundEntityById: (id: string) => Entry | Asset | undefined;
|
|
16
|
-
unboundValues?: ExperienceUnboundValues;
|
|
17
|
-
dataSource?: ExperienceDataSource;
|
|
18
|
-
componentSettings?: ExperienceComponentSettings;
|
|
19
|
-
componentVariablesOverwrites?: Record<string, ComponentPropertyValue>;
|
|
20
|
-
options?: BackgroundImageOptions;
|
|
21
|
-
width?: string;
|
|
22
|
-
}) => any;
|
|
23
|
-
/**
|
|
24
|
-
* Takes the initial set of properties, filters only design properties that will be mapped to CSS and
|
|
25
|
-
* re-organizes them to be indexed by breakpoint ID ("breakpoint > variable > value"). It will
|
|
26
|
-
* also resolve the design/ component values to plain values.
|
|
27
|
-
*
|
|
28
|
-
* **Example Input**
|
|
29
|
-
* ```
|
|
30
|
-
* variables = {
|
|
31
|
-
* cfMargin: { type: 'DesignValue', valuesByBreakpoint: { desktop: '1px', tablet: '2px' } },
|
|
32
|
-
* cfPadding: { type: 'DesignValue', valuesByBreakpoint: { desktop: '3px', mobile: '4px' } }
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* **Example Output**
|
|
37
|
-
* ```
|
|
38
|
-
* variableValuesByBreakpoints = {
|
|
39
|
-
* desktop: {
|
|
40
|
-
* cfMargin: '1px',
|
|
41
|
-
* cfPadding: '3px'
|
|
42
|
-
* },
|
|
43
|
-
* tablet: {
|
|
44
|
-
* cfMargin: '2px'
|
|
45
|
-
* },
|
|
46
|
-
* mobile: {
|
|
47
|
-
* cfPadding: '4px'
|
|
48
|
-
* }
|
|
49
|
-
* }
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* **Note**
|
|
53
|
-
* - The property cfBackgroundImageUrl is the only content property that gets mapped to CSS as well.
|
|
54
|
-
* It will be solely stored on the default breakpoint.
|
|
55
|
-
* - For ComponentValues, it will either take the override from the pattern instance or fallback to
|
|
56
|
-
* the defaultValue defined in variableDefinitions.
|
|
57
|
-
*/
|
|
58
|
-
declare const indexByBreakpoint: ({ variables, breakpointIds, getBoundEntityById, unboundValues, dataSource, componentVariablesOverwrites, componentSettings, }: {
|
|
59
|
-
variables: Record<string, ComponentPropertyValue>;
|
|
60
|
-
breakpointIds: string[];
|
|
61
|
-
getBoundEntityById: (id: string) => Entry | Asset | undefined;
|
|
62
|
-
unboundValues?: ExperienceUnboundValues;
|
|
63
|
-
dataSource?: ExperienceDataSource;
|
|
64
|
-
componentVariablesOverwrites?: Record<string, ComponentPropertyValue>;
|
|
65
|
-
componentSettings?: ExperienceComponentSettings;
|
|
66
|
-
}) => Record<string, Record<string, string | number | boolean | Record<any, any>>>;
|
|
67
|
-
/**
|
|
68
|
-
* Flattens the object from
|
|
69
|
-
* `{ color: { [key]: [value] } }`
|
|
70
|
-
* to
|
|
71
|
-
* `{ 'color.key': [value] }`
|
|
72
|
-
*/
|
|
73
|
-
declare const flattenDesignTokenRegistry: (designTokenRegistry: DesignTokensDefinition) => FlattenedDesignTokens;
|
|
74
|
-
|
|
75
|
-
export { detachExperienceStyles, flattenDesignTokenRegistry, indexByBreakpoint, isCfStyleAttribute, maybePopulateDesignTokenValue, resolveBackgroundImageBinding };
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { CSSProperties, StyleProps, ExperienceTreeNode } from '../../types.js';
|
|
3
|
-
import { ComponentTreeNode, PrimitiveValue } from '@contentful/experiences-validators';
|
|
4
|
-
|
|
5
|
-
declare const toCSSAttribute: (key: string) => string;
|
|
6
|
-
/**
|
|
7
|
-
* Turns a list of CSSProperties into a joined CSS string that can be
|
|
8
|
-
* used for <style> tags. Per default it creates a minimized version.
|
|
9
|
-
* For editor mode, use the `useWhitespaces` flag to create a more readable version.
|
|
10
|
-
*
|
|
11
|
-
* @param cssProperties list of CSS properties
|
|
12
|
-
* @param useWhitespaces adds whitespaces and newlines between each rule
|
|
13
|
-
* @returns a string of CSS rules
|
|
14
|
-
*/
|
|
15
|
-
declare const stringifyCssProperties: (cssProperties: CSSProperties, useWhitespaces?: boolean) => string;
|
|
16
|
-
declare const buildStyleTag: ({ styles, nodeId }: {
|
|
17
|
-
styles: CSSProperties;
|
|
18
|
-
nodeId?: string;
|
|
19
|
-
}) => string[];
|
|
20
|
-
/**
|
|
21
|
-
* Takes plain design values and transforms them into CSS properties. Undefined values will
|
|
22
|
-
* be filtered out.
|
|
23
|
-
*
|
|
24
|
-
* **Example Input**
|
|
25
|
-
* ```
|
|
26
|
-
* values = {
|
|
27
|
-
* cfVisibility: 'visible',
|
|
28
|
-
* cfMargin: '10px',
|
|
29
|
-
* cfFlexReverse: true,
|
|
30
|
-
* cfImageOptions: { objectFit: 'cover' },
|
|
31
|
-
* // ...
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
34
|
-
* **Example Output**
|
|
35
|
-
* ```
|
|
36
|
-
* cssProperties = {
|
|
37
|
-
* margin: '10px',
|
|
38
|
-
* flexDirection: 'row-reverse',
|
|
39
|
-
* objectFit: 'cover',
|
|
40
|
-
* // ...
|
|
41
|
-
* }
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
declare const buildCfStyles: (values: Partial<StyleProps>) => CSSProperties;
|
|
45
|
-
/**
|
|
46
|
-
* **Only meant to be used in editor mode!**
|
|
47
|
-
*
|
|
48
|
-
* If the node is an empty structure component with a relative height (e.g. '100%'),
|
|
49
|
-
* it might render with a zero height. In this case, add a min height of 80px to ensure
|
|
50
|
-
* that child nodes can be added via drag & drop.
|
|
51
|
-
*/
|
|
52
|
-
declare const addMinHeightForEmptyStructures: (cssProperties: CSSProperties, node: ComponentTreeNode) => react.CSSProperties;
|
|
53
|
-
/**
|
|
54
|
-
* Container/section default behavior:
|
|
55
|
-
* Default height => height: EMPTY_CONTAINER_SIZE
|
|
56
|
-
* If a container component has children => height: 'fit-content'
|
|
57
|
-
*/
|
|
58
|
-
declare const calculateNodeDefaultHeight: ({ blockId, children, value, }: {
|
|
59
|
-
blockId?: string;
|
|
60
|
-
children: ExperienceTreeNode["children"];
|
|
61
|
-
value: PrimitiveValue;
|
|
62
|
-
}) => string | number | boolean | Record<any, any> | undefined;
|
|
63
|
-
|
|
64
|
-
export { addMinHeightForEmptyStructures, buildCfStyles, buildStyleTag, calculateNodeDefaultHeight, stringifyCssProperties, toCSSAttribute };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create a single CSS string containing all class definitions for a given media query.
|
|
3
|
-
*
|
|
4
|
-
* @param cssByClassName map of class names to CSS strings containing all rules for each class
|
|
5
|
-
* @param condition e.g. "*", "<520px", ">520px"
|
|
6
|
-
* @param nextCondition optional next condition to create a disjunct media query that doesn't affect the next breakpoint
|
|
7
|
-
* @returns joined string of all CSS class definitions wrapped into media queries
|
|
8
|
-
*/
|
|
9
|
-
declare const toMediaQuery: ({ cssByClassName, condition, nextCondition, }: {
|
|
10
|
-
cssByClassName: Record<string, string>;
|
|
11
|
-
condition: string;
|
|
12
|
-
nextCondition?: string;
|
|
13
|
-
}) => string;
|
|
14
|
-
|
|
15
|
-
export { toMediaQuery };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ResolveDesignValueType, BoundComponentPropertyTypes } from '../../types.js';
|
|
2
|
-
import { UnresolvedLink } from 'contentful';
|
|
3
|
-
import { EntityStoreBase } from '../../entity/EntityStoreBase.js';
|
|
4
|
-
import { ComponentTreeNode, ComponentDefinitionPropertyType } from '@contentful/experiences-validators';
|
|
5
|
-
|
|
6
|
-
declare const transformBoundContentValue: (variables: ComponentTreeNode["variables"], entityStore: EntityStoreBase, binding: UnresolvedLink<"Entry" | "Asset">, resolveDesignValue: ResolveDesignValueType, variableName: string, variableType: ComponentDefinitionPropertyType, path: string) => BoundComponentPropertyTypes;
|
|
7
|
-
|
|
8
|
-
export { transformBoundContentValue };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
type NodeWithChildren<T> = {
|
|
2
|
-
children: T[];
|
|
3
|
-
};
|
|
4
|
-
declare function treeVisit<T extends NodeWithChildren<T>>(initialNode: T, onNode: (node: T, index: number, depth: number) => void): void;
|
|
5
|
-
/**
|
|
6
|
-
* Traverses all nodes of a tree and maps all of them.
|
|
7
|
-
* Intuitively works similarly to Array.map().
|
|
8
|
-
* When returning mapped object from the mapper function
|
|
9
|
-
* you _do not_ need to return about `.children[]` field.
|
|
10
|
-
* This field is automatically managed by the treeMap() function.
|
|
11
|
-
*
|
|
12
|
-
* You can map each node to whatever you want, but shouldn't
|
|
13
|
-
* modify the structure of the tree from the mapping function.
|
|
14
|
-
*/
|
|
15
|
-
declare function treeMap<T extends NodeWithChildren<T>, U>(node: T, onNode: (node: T) => Omit<U, 'children'>): U;
|
|
16
|
-
|
|
17
|
-
export { treeMap, treeVisit };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ExperienceEntry } from '../types.js';
|
|
2
|
-
import { Entry, Asset, UnresolvedLink } from 'contentful';
|
|
3
|
-
|
|
4
|
-
declare const isExperienceEntry: (entry: ExperienceEntry | Entry) => entry is ExperienceEntry;
|
|
5
|
-
declare const isPatternEntry: (entry: Entry | ExperienceEntry) => entry is ExperienceEntry;
|
|
6
|
-
declare const isEntry: (value: unknown) => value is Entry;
|
|
7
|
-
declare const isAsset: (value: unknown) => value is Asset;
|
|
8
|
-
/**
|
|
9
|
-
* Checks if the values is an array of links.
|
|
10
|
-
* Note: we use convention where empty arrays are considered valid "arrays of links"
|
|
11
|
-
* as they don't contradict the type definition.
|
|
12
|
-
*/
|
|
13
|
-
declare const isArrayOfLinks: (value: unknown) => value is Array<UnresolvedLink<"Asset"> | UnresolvedLink<"Entry">>;
|
|
14
|
-
|
|
15
|
-
export { isArrayOfLinks, isAsset, isEntry, isExperienceEntry, isPatternEntry };
|
package/dist/utils/utils.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ExperienceTree, ExperienceEntry, ComponentDefinition } from '../types.js';
|
|
2
|
-
import { Entry } from 'contentful';
|
|
3
|
-
import { ExperienceDataSource, ExperienceUnboundValues } from '@contentful/experiences-validators';
|
|
4
|
-
|
|
5
|
-
declare const getDataFromTree: (tree: ExperienceTree) => {
|
|
6
|
-
dataSource: ExperienceDataSource;
|
|
7
|
-
unboundValues: ExperienceUnboundValues;
|
|
8
|
-
};
|
|
9
|
-
declare const generateRandomId: (letterCount: number) => string;
|
|
10
|
-
declare const checkIsAssemblyNode: ({ componentId, usedComponents, }: {
|
|
11
|
-
componentId: string;
|
|
12
|
-
usedComponents: ExperienceEntry["fields"]["usedComponents"];
|
|
13
|
-
}) => boolean;
|
|
14
|
-
/**
|
|
15
|
-
* This check assumes that the entry is already ensured to be an experience, i.e. the
|
|
16
|
-
* content type of the entry is an experience type with the necessary annotations.
|
|
17
|
-
**/
|
|
18
|
-
declare const checkIsAssemblyEntry: (entry: Entry) => boolean;
|
|
19
|
-
declare const checkIsAssemblyDefinition: (component?: ComponentDefinition) => boolean;
|
|
20
|
-
interface ParsedValue {
|
|
21
|
-
value: number;
|
|
22
|
-
unit: 'px' | 'em' | 'rem';
|
|
23
|
-
}
|
|
24
|
-
declare function parseCSSValue(input: string): ParsedValue | null;
|
|
25
|
-
declare function getTargetValueInPixels(targetWidthObject: ParsedValue): number;
|
|
26
|
-
/**
|
|
27
|
-
* Creates a component definition for an assembly. As all assemblies use the same definition in the SDK,
|
|
28
|
-
* all should be registered via this function.
|
|
29
|
-
*/
|
|
30
|
-
declare const createAssemblyDefinition: (definitionId: string) => ComponentDefinition;
|
|
31
|
-
|
|
32
|
-
export { checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, createAssemblyDefinition, generateRandomId, getDataFromTree, getTargetValueInPixels, parseCSSValue };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IncomingMessage } from '../types.js';
|
|
2
|
-
import { StudioCanvasMode } from '../constants.js';
|
|
3
|
-
|
|
4
|
-
declare const doesMismatchMessageSchema: (event: MessageEvent) => false | string;
|
|
5
|
-
declare const tryParseMessage: (event: MessageEvent) => IncomingMessage;
|
|
6
|
-
declare const validateExperienceBuilderConfig: ({ locale, mode, }: {
|
|
7
|
-
locale: string;
|
|
8
|
-
mode: StudioCanvasMode;
|
|
9
|
-
}) => void;
|
|
10
|
-
|
|
11
|
-
export { doesMismatchMessageSchema, tryParseMessage, validateExperienceBuilderConfig };
|
|
File without changes
|