@contentful/experiences-core 1.39.0-alpha-20250528T1549-bd210e1.0 → 1.39.0-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.d.ts +6 -15
- package/dist/constants.js +6 -15
- package/dist/constants.js.map +1 -1
- package/dist/exports.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +69 -12
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +22 -18
- package/dist/utils/utils.d.ts +22 -2
- package/package.json +3 -3
package/dist/constants.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
2
1
|
declare const SCROLL_STATES: {
|
|
3
2
|
readonly Start: "scrollStart";
|
|
4
3
|
readonly IsScrolling: "isScrolling";
|
|
@@ -8,19 +7,20 @@ declare const OUTGOING_EVENTS: {
|
|
|
8
7
|
readonly Connected: "connected";
|
|
9
8
|
readonly DesignTokens: "registerDesignTokens";
|
|
10
9
|
readonly RegisteredBreakpoints: "registeredBreakpoints";
|
|
11
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
12
10
|
readonly MouseMove: "mouseMove";
|
|
13
|
-
|
|
11
|
+
readonly NewHoveredElement: "newHoveredElement";
|
|
14
12
|
readonly ComponentSelected: "componentSelected";
|
|
15
13
|
readonly RegisteredComponents: "registeredComponents";
|
|
16
14
|
readonly RequestComponentTreeUpdate: "requestComponentTreeUpdate";
|
|
15
|
+
readonly ComponentDragCanceled: "componentDragCanceled";
|
|
16
|
+
readonly ComponentDropped: "componentDropped";
|
|
17
|
+
readonly ComponentMoved: "componentMoved";
|
|
17
18
|
readonly CanvasReload: "canvasReload";
|
|
18
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
19
19
|
readonly UpdateSelectedComponentCoordinates: "updateSelectedComponentCoordinates";
|
|
20
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
21
20
|
readonly CanvasScroll: "canvasScrolling";
|
|
22
21
|
readonly CanvasError: "canvasError";
|
|
23
|
-
|
|
22
|
+
readonly ComponentMoveStarted: "componentMoveStarted";
|
|
23
|
+
readonly ComponentMoveEnded: "componentMoveEnded";
|
|
24
24
|
readonly OutsideCanvasClick: "outsideCanvasClick";
|
|
25
25
|
readonly SDKFeatures: "sdkFeatures";
|
|
26
26
|
readonly RequestEntities: "REQUEST_ENTITIES";
|
|
@@ -29,26 +29,17 @@ declare const INCOMING_EVENTS: {
|
|
|
29
29
|
readonly RequestEditorMode: "requestEditorMode";
|
|
30
30
|
readonly RequestReadOnlyMode: "requestReadOnlyMode";
|
|
31
31
|
readonly ExperienceUpdated: "componentTreeUpdated";
|
|
32
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
33
32
|
readonly ComponentDraggingChanged: "componentDraggingChanged";
|
|
34
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
35
33
|
readonly ComponentDragCanceled: "componentDragCanceled";
|
|
36
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
37
34
|
readonly ComponentDragStarted: "componentDragStarted";
|
|
38
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
39
35
|
readonly ComponentDragEnded: "componentDragEnded";
|
|
40
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
41
36
|
readonly ComponentMoveEnded: "componentMoveEnded";
|
|
42
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
43
37
|
readonly CanvasResized: "canvasResized";
|
|
44
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
45
38
|
readonly SelectComponent: "selectComponent";
|
|
46
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
47
39
|
readonly HoverComponent: "hoverComponent";
|
|
48
40
|
readonly UpdatedEntity: "updatedEntity";
|
|
49
41
|
readonly AssembliesAdded: "assembliesAdded";
|
|
50
42
|
readonly AssembliesRegistered: "assembliesRegistered";
|
|
51
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
52
43
|
readonly MouseMove: "mouseMove";
|
|
53
44
|
readonly RequestedEntities: "REQUESTED_ENTITIES";
|
|
54
45
|
};
|
package/dist/constants.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
2
1
|
const SCROLL_STATES = {
|
|
3
2
|
Start: 'scrollStart',
|
|
4
3
|
IsScrolling: 'isScrolling',
|
|
@@ -8,19 +7,20 @@ const OUTGOING_EVENTS = {
|
|
|
8
7
|
Connected: 'connected',
|
|
9
8
|
DesignTokens: 'registerDesignTokens',
|
|
10
9
|
RegisteredBreakpoints: 'registeredBreakpoints',
|
|
11
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
12
10
|
MouseMove: 'mouseMove',
|
|
13
|
-
|
|
11
|
+
NewHoveredElement: 'newHoveredElement',
|
|
14
12
|
ComponentSelected: 'componentSelected',
|
|
15
13
|
RegisteredComponents: 'registeredComponents',
|
|
16
14
|
RequestComponentTreeUpdate: 'requestComponentTreeUpdate',
|
|
15
|
+
ComponentDragCanceled: 'componentDragCanceled',
|
|
16
|
+
ComponentDropped: 'componentDropped',
|
|
17
|
+
ComponentMoved: 'componentMoved',
|
|
17
18
|
CanvasReload: 'canvasReload',
|
|
18
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
19
19
|
UpdateSelectedComponentCoordinates: 'updateSelectedComponentCoordinates',
|
|
20
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
21
20
|
CanvasScroll: 'canvasScrolling',
|
|
22
21
|
CanvasError: 'canvasError',
|
|
23
|
-
|
|
22
|
+
ComponentMoveStarted: 'componentMoveStarted',
|
|
23
|
+
ComponentMoveEnded: 'componentMoveEnded',
|
|
24
24
|
OutsideCanvasClick: 'outsideCanvasClick',
|
|
25
25
|
SDKFeatures: 'sdkFeatures',
|
|
26
26
|
RequestEntities: 'REQUEST_ENTITIES',
|
|
@@ -29,26 +29,17 @@ const INCOMING_EVENTS = {
|
|
|
29
29
|
RequestEditorMode: 'requestEditorMode',
|
|
30
30
|
RequestReadOnlyMode: 'requestReadOnlyMode',
|
|
31
31
|
ExperienceUpdated: 'componentTreeUpdated',
|
|
32
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
33
32
|
ComponentDraggingChanged: 'componentDraggingChanged',
|
|
34
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
35
33
|
ComponentDragCanceled: 'componentDragCanceled',
|
|
36
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
37
34
|
ComponentDragStarted: 'componentDragStarted',
|
|
38
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
39
35
|
ComponentDragEnded: 'componentDragEnded',
|
|
40
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
41
36
|
ComponentMoveEnded: 'componentMoveEnded',
|
|
42
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
43
37
|
CanvasResized: 'canvasResized',
|
|
44
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
45
38
|
SelectComponent: 'selectComponent',
|
|
46
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
47
39
|
HoverComponent: 'hoverComponent',
|
|
48
40
|
UpdatedEntity: 'updatedEntity',
|
|
49
41
|
AssembliesAdded: 'assembliesAdded',
|
|
50
42
|
AssembliesRegistered: 'assembliesRegistered',
|
|
51
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
52
43
|
MouseMove: 'mouseMove',
|
|
53
44
|
RequestedEntities: 'REQUESTED_ENTITIES',
|
|
54
45
|
};
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export const SCROLL_STATES = {\n Start: 'scrollStart',\n IsScrolling: 'isScrolling',\n End: 'scrollEnd',\n} as const;\n\nexport const OUTGOING_EVENTS = {\n Connected: 'connected',\n DesignTokens: 'registerDesignTokens',\n RegisteredBreakpoints: 'registeredBreakpoints',\n MouseMove: 'mouseMove',\n NewHoveredElement: 'newHoveredElement',\n ComponentSelected: 'componentSelected',\n RegisteredComponents: 'registeredComponents',\n RequestComponentTreeUpdate: 'requestComponentTreeUpdate',\n ComponentDragCanceled: 'componentDragCanceled',\n ComponentDropped: 'componentDropped',\n ComponentMoved: 'componentMoved',\n CanvasReload: 'canvasReload',\n UpdateSelectedComponentCoordinates: 'updateSelectedComponentCoordinates',\n CanvasScroll: 'canvasScrolling',\n CanvasError: 'canvasError',\n ComponentMoveStarted: 'componentMoveStarted',\n ComponentMoveEnded: 'componentMoveEnded',\n OutsideCanvasClick: 'outsideCanvasClick',\n SDKFeatures: 'sdkFeatures',\n RequestEntities: 'REQUEST_ENTITIES',\n} as const;\n\nexport const INCOMING_EVENTS = {\n RequestEditorMode: 'requestEditorMode',\n RequestReadOnlyMode: 'requestReadOnlyMode',\n ExperienceUpdated: 'componentTreeUpdated',\n ComponentDraggingChanged: 'componentDraggingChanged',\n ComponentDragCanceled: 'componentDragCanceled',\n ComponentDragStarted: 'componentDragStarted',\n ComponentDragEnded: 'componentDragEnded',\n ComponentMoveEnded: 'componentMoveEnded',\n CanvasResized: 'canvasResized',\n SelectComponent: 'selectComponent',\n HoverComponent: 'hoverComponent',\n UpdatedEntity: 'updatedEntity',\n AssembliesAdded: 'assembliesAdded',\n AssembliesRegistered: 'assembliesRegistered',\n MouseMove: 'mouseMove',\n RequestedEntities: 'REQUESTED_ENTITIES',\n} as const;\n\nexport const INTERNAL_EVENTS = {\n ComponentsRegistered: 'cfComponentsRegistered',\n VisualEditorInitialize: 'cfVisualEditorInitialize',\n} as const;\n\nexport const VISUAL_EDITOR_EVENTS = {\n Ready: 'cfVisualEditorReady',\n};\n\n/**\n * These modes are ONLY intended to be internally used within the context of\n * editing an experience inside of Contentful Studio. i.e. these modes\n * intentionally do not include preview/delivery modes.\n */\nexport enum StudioCanvasMode {\n READ_ONLY = 'readOnlyMode',\n EDITOR = 'editorMode',\n NONE = 'none',\n}\n\nexport const VISUAL_EDITOR_CONTAINER_ID = 'cf-visual-editor';\nexport const CONTENTFUL_COMPONENT_CATEGORY = 'contentful-component';\nexport const CONTENTFUL_DEFAULT_CATEGORY = 'Contentful';\n\nexport const CONTENTFUL_COMPONENTS = {\n section: {\n id: 'contentful-section',\n name: 'Section',\n },\n container: {\n id: 'contentful-container',\n name: 'Container',\n },\n columns: {\n id: 'contentful-columns',\n name: 'Columns',\n },\n singleColumn: {\n id: 'contentful-single-column',\n name: 'Column',\n },\n button: {\n id: 'contentful-button',\n name: 'Button',\n },\n heading: {\n id: 'contentful-heading',\n name: 'Heading',\n },\n image: {\n id: 'contentful-image',\n name: 'Image',\n },\n richText: {\n id: 'contentful-richText',\n name: 'Rich Text',\n },\n text: {\n id: 'contentful-text',\n name: 'Text',\n },\n divider: {\n id: 'contentful-divider',\n name: 'Divider',\n },\n carousel: {\n id: 'contentful-carousel',\n name: 'Carousel',\n },\n} as const;\n\nexport const ASSEMBLY_NODE_TYPE = 'assembly';\nexport const ASSEMBLY_DEFAULT_CATEGORY = 'Assemblies';\nexport const ASSEMBLY_BLOCK_NODE_TYPE = 'assemblyBlock';\nexport const ASSEMBLY_NODE_TYPES = [ASSEMBLY_NODE_TYPE, ASSEMBLY_BLOCK_NODE_TYPE];\nexport const LATEST_SCHEMA_VERSION = '2023-09-28';\nexport const CF_STYLE_ATTRIBUTES = [\n 'cfVisibility',\n 'cfHorizontalAlignment',\n 'cfVerticalAlignment',\n 'cfMargin',\n 'cfPadding',\n 'cfBackgroundColor',\n 'cfWidth',\n 'cfMaxWidth',\n 'cfHeight',\n 'cfImageAsset',\n 'cfImageOptions',\n 'cfBackgroundImageUrl',\n 'cfBackgroundImageOptions',\n 'cfFlexDirection',\n 'cfFlexWrap',\n 'cfFlexReverse',\n 'cfBorder',\n 'cfBorderRadius',\n 'cfGap',\n 'cfColumnSpan',\n 'cfColumnSpanLock',\n 'cfColumns',\n 'cfFontSize',\n 'cfFontWeight',\n 'cfLineHeight',\n 'cfLetterSpacing',\n 'cfTextColor',\n 'cfTextAlign',\n 'cfTextTransform',\n 'cfTextBold',\n 'cfTextItalic',\n 'cfTextUnderline',\n // For backwards compatibility\n // we need to keep those in this constant array\n // so that omit() in <VisualEditorBlock> and <CompositionBlock>\n // can filter them out and not pass as props\n 'cfBackgroundImageScaling',\n 'cfBackgroundImageAlignment',\n 'cfBackgroundImageAlignmentVertical',\n 'cfBackgroundImageAlignmentHorizontal',\n];\n\nexport const EMPTY_CONTAINER_HEIGHT = '80px';\n\nexport const HYPERLINK_DEFAULT_PATTERN = `/{locale}/{entry.fields.slug}/`;\n\nexport const DEFAULT_IMAGE_WIDTH = '500px';\n\nexport enum PostMessageMethods {\n REQUEST_ENTITIES = 'REQUEST_ENTITIES',\n REQUESTED_ENTITIES = 'REQUESTED_ENTITIES',\n}\n\nexport const SUPPORTED_IMAGE_FORMATS = ['jpg', 'png', 'webp', 'gif', 'avif'] as const;\n\nexport const PATTERN_PROPERTY_DIVIDER = '-----';\n"],"names":[],"mappings":"AAAa,MAAA,aAAa,GAAG;AAC3B,IAAA,KAAK,EAAE,aAAa;AACpB,IAAA,WAAW,EAAE,aAAa;AAC1B,IAAA,GAAG,EAAE,WAAW;EACP;AAEE,MAAA,eAAe,GAAG;AAC7B,IAAA,SAAS,EAAE,WAAW;AACtB,IAAA,YAAY,EAAE,sBAAsB;AACpC,IAAA,qBAAqB,EAAE,uBAAuB;AAC9C,IAAA,SAAS,EAAE,WAAW;AACtB,IAAA,iBAAiB,EAAE,mBAAmB;AACtC,IAAA,iBAAiB,EAAE,mBAAmB;AACtC,IAAA,oBAAoB,EAAE,sBAAsB;AAC5C,IAAA,0BAA0B,EAAE,4BAA4B;AACxD,I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,uBAAuB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAW;AAE/E,MAAM,wBAAwB,GAAG;;;;"}
|
package/dist/exports.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_DEFAULT_CATEGORY, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, CONTENTFUL_DEFAULT_CATEGORY, DEFAULT_IMAGE_WIDTH, EMPTY_CONTAINER_HEIGHT, HYPERLINK_DEFAULT_PATTERN, INCOMING_EVENTS, INTERNAL_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, PATTERN_PROPERTY_DIVIDER, PostMessageMethods, SCROLL_STATES, SUPPORTED_IMAGE_FORMATS, StudioCanvasMode, VISUAL_EDITOR_CONTAINER_ID, VISUAL_EDITOR_EVENTS } from './constants.js';
|
|
2
|
-
export { AssembliesAddedPayload, AssembliesRegisteredPayload, BackgroundImageAlignmentOption, BackgroundImageOptions, BackgroundImageScalingOption, Binding, BindingMap, BindingMapByBlockId, BoundComponentPropertyTypes, CSSProperties, CanvasErrorPayload, CanvasReloadPayload, CanvasResizedPayload, CanvasScrollPayload, ComponentBinding, ComponentDefinition, ComponentDefinitionVariable, ComponentDefinitionVariableBase, ComponentDefinitionVariableTypeMap, ComponentDefinitionVariableValidation, ComponentDragCanceledPayload, ComponentDragEndedPayload, ComponentDragStartedPayload, ComponentDraggingChangedPayload, ComponentDroppedPayload, ComponentMoveEndedPayload, ComponentMoveStartedPayload, ComponentMovedPayload, ComponentRegistration, ComponentRegistrationOptions, ComponentSelectedPayload, ConnectedPayload, ContainerStyleVariableName, Coordinates, DataSourceEntryValueType, DesignTokensDefinition, DesignTokensPayload, DesignVariableMap, DesignVariableTypes, Experience, ExperienceEntry, ExperienceFields, ExperienceTree, ExperienceTreeNode, ExperienceUpdatedPayload, HoverComponentPayload, HoveredElement, ImageLoadingOption, ImageObjectFitOption, ImageObjectPositionOption, ImageOptions, IncomingComponentDragCanceledPayload, IncomingComponentMoveEndedPayload, IncomingEvent, IncomingMessage, IncomingMouseMovePayload, InternalEvent, Link, ManagementEntity, MouseMovePayload, NewHoveredElementPayload, OptimizedBackgroundImageAsset, OptimizedImageAsset, OutgoingEvent, OutgoingMessage, OutsideCanvasClickPayload, RawCoordinates, RecursiveDesignTokenDefinition, RegisteredBreakpointsPayload, RegisteredComponentsPayload, RequestComponentTreeUpdatePayload, RequestEditorModePayload, RequestEntitiesMessage, RequestEntitiesPayload, RequestReadOnlyModePayload, RequestedEntitiesMessage, RequestedEntitiesPayload, ResolveDesignValueType, SDKFeaturesPayload, ScrollState, SelectComponentPayload, SendMessageParams,
|
|
2
|
+
export { AssembliesAddedPayload, AssembliesRegisteredPayload, BackgroundImageAlignmentOption, BackgroundImageOptions, BackgroundImageScalingOption, Binding, BindingMap, BindingMapByBlockId, BoundComponentPropertyTypes, CSSProperties, CanvasErrorPayload, CanvasReloadPayload, CanvasResizedPayload, CanvasScrollPayload, ComponentBinding, ComponentDefinition, ComponentDefinitionVariable, ComponentDefinitionVariableBase, ComponentDefinitionVariableTypeMap, ComponentDefinitionVariableValidation, ComponentDragCanceledPayload, ComponentDragEndedPayload, ComponentDragStartedPayload, ComponentDraggingChangedPayload, ComponentDroppedPayload, ComponentMoveEndedPayload, ComponentMoveStartedPayload, ComponentMovedPayload, ComponentRegistration, ComponentRegistrationOptions, ComponentSelectedPayload, ConnectedPayload, ContainerStyleVariableName, Coordinates, DataSourceEntryValueType, DesignTokensDefinition, DesignTokensPayload, DesignVariableMap, DesignVariableTypes, DragWrapperProps, Experience, ExperienceEntry, ExperienceFields, ExperienceTree, ExperienceTreeNode, ExperienceUpdatedPayload, HoverComponentPayload, HoveredElement, ImageLoadingOption, ImageObjectFitOption, ImageObjectPositionOption, ImageOptions, IncomingComponentDragCanceledPayload, IncomingComponentMoveEndedPayload, IncomingEvent, IncomingMessage, IncomingMouseMovePayload, InternalEvent, Link, ManagementEntity, MouseMovePayload, NewHoveredElementPayload, OptimizedBackgroundImageAsset, OptimizedImageAsset, OutgoingEvent, OutgoingMessage, OutsideCanvasClickPayload, RawCoordinates, RecursiveDesignTokenDefinition, RegisteredBreakpointsPayload, RegisteredComponentsPayload, RequestComponentTreeUpdatePayload, RequestEditorModePayload, RequestEntitiesMessage, RequestEntitiesPayload, RequestReadOnlyModePayload, RequestedEntitiesMessage, RequestedEntitiesPayload, ResolveDesignValueType, SDKFeaturesPayload, ScrollState, SelectComponentPayload, SendMessageParams, StyleProps, UpdateSelectedComponentCoordinatesPayload, UpdatedEntityPayload, ValidationOption, VariableFormats, WrapperTags } from './types.js';
|
|
3
3
|
export { BoundValue, Breakpoint, ComponentDefinitionPropertyType as ComponentDefinitionVariableType, ComponentPropertyValue, ComponentTreeNode, ComponentValue, DesignValue, ExperienceComponentSettings, ExperienceDataSource, ExperienceUnboundValues, NoValue, PatternProperty, PatternPropertyDefinition, PrimitiveValue, SchemaVersions, UnboundValue, ValuesByBreakpoint, VariableMapping } from '@contentful/experiences-validators';
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { detachExperienceStyles, flattenDesignTokenRegistry, indexByBreakpoint,
|
|
|
13
13
|
export { transformBoundContentValue } from './utils/transformers/transformBoundContentValue.js';
|
|
14
14
|
export { treeMap, treeVisit } from './utils/treeTraversal.js';
|
|
15
15
|
export { isExperienceEntry } from './utils/typeguards.js';
|
|
16
|
-
export { checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, generateRandomId, getDataFromTree, getTargetValueInPixels, parseCSSValue } from './utils/utils.js';
|
|
16
|
+
export { checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, generateRandomId, getDataFromTree, getInsertionData, getTargetValueInPixels, parseCSSValue } from './utils/utils.js';
|
|
17
17
|
export { doesMismatchMessageSchema, tryParseMessage, validateExperienceBuilderConfig } from './utils/validations.js';
|
|
18
18
|
export { builtInStyles, columnsBuiltInStyles, containerBuiltInStyles, dividerBuiltInStyles, optionalBuiltInStyles, sectionBuiltInStyles, singleColumnBuiltInStyles } from './definitions/styles.js';
|
|
19
19
|
export { EditorModeEntityStore } from './entity/EditorModeEntityStore.js';
|
package/dist/index.js
CHANGED
|
@@ -3,31 +3,21 @@ import { omit, isArray, uniqBy } from 'lodash-es';
|
|
|
3
3
|
import md5 from 'md5';
|
|
4
4
|
import { BLOCKS } from '@contentful/rich-text-types';
|
|
5
5
|
|
|
6
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
7
6
|
const INCOMING_EVENTS = {
|
|
8
7
|
RequestEditorMode: 'requestEditorMode',
|
|
9
8
|
RequestReadOnlyMode: 'requestReadOnlyMode',
|
|
10
9
|
ExperienceUpdated: 'componentTreeUpdated',
|
|
11
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
12
10
|
ComponentDraggingChanged: 'componentDraggingChanged',
|
|
13
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
14
11
|
ComponentDragCanceled: 'componentDragCanceled',
|
|
15
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
16
12
|
ComponentDragStarted: 'componentDragStarted',
|
|
17
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
18
13
|
ComponentDragEnded: 'componentDragEnded',
|
|
19
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
20
14
|
ComponentMoveEnded: 'componentMoveEnded',
|
|
21
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
22
15
|
CanvasResized: 'canvasResized',
|
|
23
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
24
16
|
SelectComponent: 'selectComponent',
|
|
25
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
26
17
|
HoverComponent: 'hoverComponent',
|
|
27
18
|
UpdatedEntity: 'updatedEntity',
|
|
28
19
|
AssembliesAdded: 'assembliesAdded',
|
|
29
20
|
AssembliesRegistered: 'assembliesRegistered',
|
|
30
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
31
21
|
MouseMove: 'mouseMove',
|
|
32
22
|
RequestedEntities: 'REQUESTED_ENTITIES',
|
|
33
23
|
};
|
|
@@ -1440,6 +1430,32 @@ propertyName, resolveDesignTokens = true) => {
|
|
|
1440
1430
|
};
|
|
1441
1431
|
|
|
1442
1432
|
const CF_DEBUG_KEY = 'cf_debug';
|
|
1433
|
+
/**
|
|
1434
|
+
* To ensure that the localStorage API can be used safely, we check
|
|
1435
|
+
* for availability (e.g. undefined in Node.js). Additionally, we
|
|
1436
|
+
* check if the localStorage can be used as some browsers throw a
|
|
1437
|
+
* SecurityError (e.g. Brave or Chromium with specific settings).
|
|
1438
|
+
*/
|
|
1439
|
+
const checkLocalStorageAvailability = () => {
|
|
1440
|
+
if (typeof localStorage === 'undefined' || localStorage === null) {
|
|
1441
|
+
return false;
|
|
1442
|
+
}
|
|
1443
|
+
try {
|
|
1444
|
+
// Attempt to set and remove an item to check if localStorage is enabled
|
|
1445
|
+
const TEST_KEY = 'cf_test_local_storage';
|
|
1446
|
+
localStorage.setItem(TEST_KEY, 'yes');
|
|
1447
|
+
if (localStorage.getItem(TEST_KEY) === 'yes') {
|
|
1448
|
+
localStorage.removeItem(TEST_KEY);
|
|
1449
|
+
return true;
|
|
1450
|
+
}
|
|
1451
|
+
else {
|
|
1452
|
+
return false;
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
catch (_error) {
|
|
1456
|
+
return false;
|
|
1457
|
+
}
|
|
1458
|
+
};
|
|
1443
1459
|
class DebugLogger {
|
|
1444
1460
|
constructor() {
|
|
1445
1461
|
// Public methods for logging
|
|
@@ -1447,7 +1463,7 @@ class DebugLogger {
|
|
|
1447
1463
|
this.warn = this.logger('warn');
|
|
1448
1464
|
this.log = this.logger('log');
|
|
1449
1465
|
this.debug = this.logger('debug');
|
|
1450
|
-
if (
|
|
1466
|
+
if (!checkLocalStorageAvailability()) {
|
|
1451
1467
|
this.enabled = false;
|
|
1452
1468
|
return;
|
|
1453
1469
|
}
|
|
@@ -2944,6 +2960,47 @@ const getDataFromTree = (tree) => {
|
|
|
2944
2960
|
unboundValues,
|
|
2945
2961
|
};
|
|
2946
2962
|
};
|
|
2963
|
+
/**
|
|
2964
|
+
* Gets calculates the index to drop the dragged component based on the mouse position
|
|
2965
|
+
* @returns {InsertionData} a object containing a node that will become a parent for dragged component and index at which it must be inserted
|
|
2966
|
+
*/
|
|
2967
|
+
const getInsertionData = ({ dropReceiverParentNode, dropReceiverNode, flexDirection, isMouseAtTopBorder, isMouseAtBottomBorder, isMouseInLeftHalf, isMouseInUpperHalf, isOverTopIndicator, isOverBottomIndicator, }) => {
|
|
2968
|
+
const APPEND_INSIDE = dropReceiverNode.children.length;
|
|
2969
|
+
const PREPEND_INSIDE = 0;
|
|
2970
|
+
if (isMouseAtTopBorder || isMouseAtBottomBorder) {
|
|
2971
|
+
const indexOfSectionInParentChildren = dropReceiverParentNode.children.findIndex((n) => n.data.id === dropReceiverNode.data.id);
|
|
2972
|
+
const APPEND_OUTSIDE = indexOfSectionInParentChildren + 1;
|
|
2973
|
+
const PREPEND_OUTSIDE = indexOfSectionInParentChildren;
|
|
2974
|
+
return {
|
|
2975
|
+
// when the mouse is around the border we want to drop the new component as a new section onto the root node
|
|
2976
|
+
node: dropReceiverParentNode,
|
|
2977
|
+
index: isMouseAtBottomBorder ? APPEND_OUTSIDE : PREPEND_OUTSIDE,
|
|
2978
|
+
};
|
|
2979
|
+
}
|
|
2980
|
+
// if over one of the section indicators
|
|
2981
|
+
if (isOverTopIndicator || isOverBottomIndicator) {
|
|
2982
|
+
const indexOfSectionInParentChildren = dropReceiverParentNode.children.findIndex((n) => n.data.id === dropReceiverNode.data.id);
|
|
2983
|
+
const APPEND_OUTSIDE = indexOfSectionInParentChildren + 1;
|
|
2984
|
+
const PREPEND_OUTSIDE = indexOfSectionInParentChildren;
|
|
2985
|
+
return {
|
|
2986
|
+
// when the mouse is around the border we want to drop the new component as a new section onto the root node
|
|
2987
|
+
node: dropReceiverParentNode,
|
|
2988
|
+
index: isOverBottomIndicator ? APPEND_OUTSIDE : PREPEND_OUTSIDE,
|
|
2989
|
+
};
|
|
2990
|
+
}
|
|
2991
|
+
if (flexDirection === undefined || flexDirection === 'row') {
|
|
2992
|
+
return {
|
|
2993
|
+
node: dropReceiverNode,
|
|
2994
|
+
index: isMouseInLeftHalf ? PREPEND_INSIDE : APPEND_INSIDE,
|
|
2995
|
+
};
|
|
2996
|
+
}
|
|
2997
|
+
else {
|
|
2998
|
+
return {
|
|
2999
|
+
node: dropReceiverNode,
|
|
3000
|
+
index: isMouseInUpperHalf ? PREPEND_INSIDE : APPEND_INSIDE,
|
|
3001
|
+
};
|
|
3002
|
+
}
|
|
3003
|
+
};
|
|
2947
3004
|
const generateRandomId = (letterCount) => {
|
|
2948
3005
|
const LETTERS = 'abcdefghijklmnopqvwxyzABCDEFGHIJKLMNOPQVWXYZ';
|
|
2949
3006
|
const NUMS = '0123456789';
|
|
@@ -4091,5 +4148,5 @@ async function fetchById({ client, experienceTypeId, id, localeCode, isEditorMod
|
|
|
4091
4148
|
}
|
|
4092
4149
|
}
|
|
4093
4150
|
|
|
4094
|
-
export { DebugLogger, DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles, createExperience, debug, defineBreakpoints, defineDesignTokens, designTokensRegistry, detachExperienceStyles, disableDebug, dividerBuiltInStyles, doesMismatchMessageSchema, enableDebug, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, fetchExperienceEntry, fetchReferencedEntities, findOutermostCoordinates, flattenDesignTokenRegistry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateRandomId, getActiveBreakpointIndex, getBreakpointRegistration, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getTargetValueInPixels, getTemplateValue, getValueForBreakpoint, indexByBreakpoint, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isExperienceEntry, isLink, isLinkToAsset, isPatternComponent, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, localizeEntity, maybePopulateDesignTokenValue, mediaQueryMatcher, optionalBuiltInStyles, parseCSSValue, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, resetBreakpointsRegistry, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sanitizeNodeProps, sectionBuiltInStyles, sendMessage, singleColumnBuiltInStyles, stringifyCssProperties, toCSSAttribute, toMediaQuery, transformBoundContentValue, treeMap, treeVisit, tryParseMessage, validateExperienceBuilderConfig };
|
|
4151
|
+
export { DebugLogger, DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles, createExperience, debug, defineBreakpoints, defineDesignTokens, designTokensRegistry, detachExperienceStyles, disableDebug, dividerBuiltInStyles, doesMismatchMessageSchema, enableDebug, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, fetchExperienceEntry, fetchReferencedEntities, findOutermostCoordinates, flattenDesignTokenRegistry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateRandomId, getActiveBreakpointIndex, getBreakpointRegistration, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getInsertionData, getTargetValueInPixels, getTemplateValue, getValueForBreakpoint, indexByBreakpoint, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isExperienceEntry, isLink, isLinkToAsset, isPatternComponent, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, localizeEntity, maybePopulateDesignTokenValue, mediaQueryMatcher, optionalBuiltInStyles, parseCSSValue, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, resetBreakpointsRegistry, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sanitizeNodeProps, sectionBuiltInStyles, sendMessage, singleColumnBuiltInStyles, stringifyCssProperties, toCSSAttribute, toMediaQuery, transformBoundContentValue, treeMap, treeVisit, tryParseMessage, validateExperienceBuilderConfig };
|
|
4095
4152
|
//# sourceMappingURL=index.js.map
|