@contentful/experiences-core 0.0.1 → 0.2.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +16 -0
  3. package/dist/index.d.ts +2 -24
  4. package/dist/index.js +5 -2402
  5. package/dist/index.js.map +1 -1
  6. package/dist/resolve-experience.d.ts +35 -0
  7. package/dist/resolve-experience.js +117 -0
  8. package/dist/resolve-experience.js.map +1 -0
  9. package/dist/types.d.ts +191 -235
  10. package/dist/types.js +1 -0
  11. package/dist/types.js.map +1 -0
  12. package/package.json +23 -66
  13. package/LICENSE +0 -21
  14. package/dist/communication/sendMessage.d.ts +0 -6
  15. package/dist/constants.d.ts +0 -106
  16. package/dist/constants.js +0 -144
  17. package/dist/constants.js.map +0 -1
  18. package/dist/deep-binding/DeepReference.d.ts +0 -28
  19. package/dist/definitions/components.d.ts +0 -8
  20. package/dist/definitions/styles.d.ts +0 -11
  21. package/dist/entity/EditorEntityStore.d.ts +0 -34
  22. package/dist/entity/EditorModeEntityStore.d.ts +0 -29
  23. package/dist/entity/EntityStore.d.ts +0 -68
  24. package/dist/entity/EntityStoreBase.d.ts +0 -49
  25. package/dist/enums.d.ts +0 -6
  26. package/dist/exports.d.ts +0 -3
  27. package/dist/exports.js +0 -2
  28. package/dist/exports.js.map +0 -1
  29. package/dist/fetchers/createExperience.d.ts +0 -20
  30. package/dist/fetchers/fetchById.d.ts +0 -20
  31. package/dist/fetchers/fetchBySlug.d.ts +0 -20
  32. package/dist/registries/designTokenRegistry.d.ts +0 -12
  33. package/dist/utils/breakpoints.d.ts +0 -12
  34. package/dist/utils/components.d.ts +0 -4
  35. package/dist/utils/domValues.d.ts +0 -15
  36. package/dist/utils/isLink.d.ts +0 -5
  37. package/dist/utils/isLinkToAsset.d.ts +0 -5
  38. package/dist/utils/pathSchema.d.ts +0 -30
  39. package/dist/utils/styleUtils/stylesUtils.d.ts +0 -20
  40. package/dist/utils/supportedModes.d.ts +0 -5
  41. package/dist/utils/transformers/transformBoundContentValue.d.ts +0 -8
  42. package/dist/utils/typeguards.d.ts +0 -6
  43. package/dist/utils/utils.d.ts +0 -46
  44. package/dist/utils/validations.d.ts +0 -15
@@ -1,30 +0,0 @@
1
- import { Entry, Asset } from 'contentful';
2
-
3
- /**
4
- * This module encapsulates format of the path to a deep reference.
5
- */
6
-
7
- type UnresolvedFieldset = Array<[null, string, string?]>;
8
- type Fieldset = Array<[Entry | Asset, string, string?]>;
9
- declare const parseDataSourcePathIntoFieldset: (path: string) => UnresolvedFieldset;
10
- /**
11
- * Parse path into components, supports L1 references (one reference follow) atm.
12
- * @param path from data source. eg. `/uuid123/fields/image/~locale/fields/file/~locale`
13
- * eg. `/uuid123/fields/file/~locale/fields/title/~locale`
14
- * @returns
15
- */
16
- declare const parseDataSourcePathWithL1DeepBindings: (path: string) => {
17
- key: string;
18
- field: string;
19
- referentField: string;
20
- };
21
- /**
22
- * Detects if paths is valid deep-path, like:
23
- * - /gV6yKXp61hfYrR7rEyKxY/fields/mainStory/~locale/fields/cover/~locale/fields/title/~locale
24
- * or regular, like:
25
- * - /6J8eA60yXwdm5eyUh9fX6/fields/mainStory/~locale
26
- * @returns
27
- */
28
- declare const isDeepPath: (deepPathCandidate: string) => boolean;
29
-
30
- export { type Fieldset, type UnresolvedFieldset, isDeepPath, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings };
@@ -1,20 +0,0 @@
1
- import { CSSProperties, StyleProps, ExperienceTreeNode } from '../../types.js';
2
- import { PrimitiveValue } from '@contentful/experiences-validators';
3
-
4
- declare const buildStyleTag: ({ styles, nodeId }: {
5
- styles: CSSProperties;
6
- nodeId?: string | undefined;
7
- }) => string[];
8
- declare const buildCfStyles: ({ cfHorizontalAlignment, cfVerticalAlignment, cfFlexDirection, cfFlexWrap, cfMargin, cfPadding, cfBackgroundColor, cfWidth, cfHeight, cfMaxWidth, cfBorder, cfBorderRadius, cfGap, cfBackgroundImageUrl, cfBackgroundImageOptions, cfFontSize, cfFontWeight, cfImageOptions, cfLineHeight, cfLetterSpacing, cfTextColor, cfTextAlign, cfTextTransform, cfTextBold, cfTextItalic, cfTextUnderline, cfColumnSpan, }: Partial<StyleProps>) => CSSProperties;
9
- /**
10
- * Container/section default behavior:
11
- * Default height => height: EMPTY_CONTAINER_HEIGHT (120px)
12
- * If a container component has children => height: 'fit-content'
13
- */
14
- declare const calculateNodeDefaultHeight: ({ blockId, children, value, }: {
15
- blockId?: string | undefined;
16
- children: ExperienceTreeNode['children'];
17
- value: PrimitiveValue;
18
- }) => string | number | boolean | Record<any, any> | undefined;
19
-
20
- export { buildCfStyles, buildStyleTag, calculateNodeDefaultHeight };
@@ -1,5 +0,0 @@
1
- import { InternalSDKMode } from '../types.js';
2
-
3
- declare const supportedModes: InternalSDKMode[];
4
-
5
- export { supportedModes };
@@ -1,8 +0,0 @@
1
- import { ResolveDesignValueType, ComponentDefinitionVariable, BoundComponentPropertyTypes } from '../../types.js';
2
- import { UnresolvedLink } from 'contentful';
3
- import { EntityStoreBase } from '../../entity/EntityStoreBase.js';
4
- import { ComponentTreeNode } from '@contentful/experiences-validators';
5
-
6
- declare const transformBoundContentValue: (variables: ComponentTreeNode['variables'], entityStore: EntityStoreBase, binding: UnresolvedLink<'Entry' | 'Asset'>, resolveDesignValue: ResolveDesignValueType, variableName: string, variableDefinition: ComponentDefinitionVariable, path: string) => BoundComponentPropertyTypes;
7
-
8
- export { transformBoundContentValue };
@@ -1,6 +0,0 @@
1
- import { ExperienceEntry } from '../types.js';
2
- import { Entry } from 'contentful';
3
-
4
- declare const isExperienceEntry: (entry: ExperienceEntry | Entry) => entry is ExperienceEntry;
5
-
6
- export { isExperienceEntry };
@@ -1,46 +0,0 @@
1
- import { ExperienceTree, ExperienceEntry, ComponentDefinition, ExperienceTreeNode, StyleProps } 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
- type GetInsertionDataParams = {
10
- dropReceiverNode: ExperienceTreeNode;
11
- dropReceiverParentNode: ExperienceTreeNode;
12
- flexDirection?: StyleProps['cfFlexDirection'];
13
- isMouseAtTopBorder: boolean;
14
- isMouseAtBottomBorder: boolean;
15
- isMouseInLeftHalf: boolean;
16
- isMouseInUpperHalf: boolean;
17
- isOverTopIndicator: boolean;
18
- isOverBottomIndicator: boolean;
19
- };
20
- type InsertionData = {
21
- node: ExperienceTreeNode;
22
- index: number;
23
- };
24
- /**
25
- * Gets calculates the index to drop the dragged component based on the mouse position
26
- * @returns {InsertionData} a object containing a node that will become a parent for dragged component and index at which it must be inserted
27
- */
28
- declare const getInsertionData: ({ dropReceiverParentNode, dropReceiverNode, flexDirection, isMouseAtTopBorder, isMouseAtBottomBorder, isMouseInLeftHalf, isMouseInUpperHalf, isOverTopIndicator, isOverBottomIndicator, }: GetInsertionDataParams) => InsertionData;
29
- declare const generateRandomId: (letterCount: number) => string;
30
- declare const checkIsAssemblyNode: ({ componentId, usedComponents, }: {
31
- componentId: string;
32
- usedComponents: ExperienceEntry['fields']['usedComponents'];
33
- }) => boolean;
34
- /** @deprecated use `checkIsAssemblyNode` instead. Will be removed with SDK v5. */
35
- declare const checkIsAssembly: ({ componentId, usedComponents, }: {
36
- componentId: string;
37
- usedComponents: ExperienceEntry['fields']['usedComponents'];
38
- }) => boolean;
39
- /**
40
- * This check assumes that the entry is already ensured to be an experience, i.e. the
41
- * content type of the entry is an experience type with the necessary annotations.
42
- **/
43
- declare const checkIsAssemblyEntry: (entry: Entry) => boolean;
44
- declare const checkIsAssemblyDefinition: (component?: ComponentDefinition) => boolean;
45
-
46
- export { checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, generateRandomId, getDataFromTree, getInsertionData };
@@ -1,15 +0,0 @@
1
- import { IncomingEvent } from '../types.js';
2
-
3
- type VisualEditorMessagePayload = {
4
- source: string;
5
- eventType: IncomingEvent;
6
- payload: any;
7
- };
8
- declare const doesMismatchMessageSchema: (event: MessageEvent) => false | string;
9
- declare const tryParseMessage: (event: MessageEvent) => VisualEditorMessagePayload;
10
- declare const validateExperienceBuilderConfig: ({ locale, isEditorMode, }: {
11
- locale: string;
12
- isEditorMode: boolean;
13
- }) => void;
14
-
15
- export { type VisualEditorMessagePayload, doesMismatchMessageSchema, tryParseMessage, validateExperienceBuilderConfig };