@contentful/experiences-core 1.40.0-alpha-20250604T0813-1f6e699.0 → 1.40.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 -16
- package/dist/constants.js +6 -16
- 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 +58 -11
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +24 -31
- 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,48 +7,39 @@ 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";
|
|
27
|
-
readonly CanvasGeometryUpdated: "canvasGeometryUpdated";
|
|
28
27
|
};
|
|
29
28
|
declare const INCOMING_EVENTS: {
|
|
30
29
|
readonly RequestEditorMode: "requestEditorMode";
|
|
31
30
|
readonly RequestReadOnlyMode: "requestReadOnlyMode";
|
|
32
31
|
readonly ExperienceUpdated: "componentTreeUpdated";
|
|
33
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
34
32
|
readonly ComponentDraggingChanged: "componentDraggingChanged";
|
|
35
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
36
33
|
readonly ComponentDragCanceled: "componentDragCanceled";
|
|
37
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
38
34
|
readonly ComponentDragStarted: "componentDragStarted";
|
|
39
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
40
35
|
readonly ComponentDragEnded: "componentDragEnded";
|
|
41
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
42
36
|
readonly ComponentMoveEnded: "componentMoveEnded";
|
|
43
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
44
37
|
readonly CanvasResized: "canvasResized";
|
|
45
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
46
38
|
readonly SelectComponent: "selectComponent";
|
|
47
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
48
39
|
readonly HoverComponent: "hoverComponent";
|
|
49
40
|
readonly UpdatedEntity: "updatedEntity";
|
|
50
41
|
readonly AssembliesAdded: "assembliesAdded";
|
|
51
42
|
readonly AssembliesRegistered: "assembliesRegistered";
|
|
52
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
53
43
|
readonly MouseMove: "mouseMove";
|
|
54
44
|
readonly RequestedEntities: "REQUESTED_ENTITIES";
|
|
55
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,48 +7,39 @@ 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',
|
|
27
|
-
CanvasGeometryUpdated: 'canvasGeometryUpdated',
|
|
28
27
|
};
|
|
29
28
|
const INCOMING_EVENTS = {
|
|
30
29
|
RequestEditorMode: 'requestEditorMode',
|
|
31
30
|
RequestReadOnlyMode: 'requestReadOnlyMode',
|
|
32
31
|
ExperienceUpdated: 'componentTreeUpdated',
|
|
33
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
34
32
|
ComponentDraggingChanged: 'componentDraggingChanged',
|
|
35
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
36
33
|
ComponentDragCanceled: 'componentDragCanceled',
|
|
37
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
38
34
|
ComponentDragStarted: 'componentDragStarted',
|
|
39
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
40
35
|
ComponentDragEnded: 'componentDragEnded',
|
|
41
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
42
36
|
ComponentMoveEnded: 'componentMoveEnded',
|
|
43
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
44
37
|
CanvasResized: 'canvasResized',
|
|
45
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
46
38
|
SelectComponent: 'selectComponent',
|
|
47
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
48
39
|
HoverComponent: 'hoverComponent',
|
|
49
40
|
UpdatedEntity: 'updatedEntity',
|
|
50
41
|
AssembliesAdded: 'assembliesAdded',
|
|
51
42
|
AssembliesRegistered: 'assembliesRegistered',
|
|
52
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
53
43
|
MouseMove: 'mouseMove',
|
|
54
44
|
RequestedEntities: 'REQUESTED_ENTITIES',
|
|
55
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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C,CAAA;AAC3C,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,GAG7B,EAAA,CAAA,CAAA,CAAA;AAEM,MAAM,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,
|
|
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
|
};
|
|
@@ -178,6 +168,10 @@ const builtInStyles = {
|
|
|
178
168
|
value: 'end',
|
|
179
169
|
displayName: 'Align right',
|
|
180
170
|
},
|
|
171
|
+
{
|
|
172
|
+
value: 'stretch',
|
|
173
|
+
displayName: 'Stretch',
|
|
174
|
+
},
|
|
181
175
|
],
|
|
182
176
|
},
|
|
183
177
|
type: 'Text',
|
|
@@ -201,6 +195,10 @@ const builtInStyles = {
|
|
|
201
195
|
value: 'end',
|
|
202
196
|
displayName: 'Align bottom',
|
|
203
197
|
},
|
|
198
|
+
{
|
|
199
|
+
value: 'stretch',
|
|
200
|
+
displayName: 'Stretch',
|
|
201
|
+
},
|
|
204
202
|
],
|
|
205
203
|
},
|
|
206
204
|
type: 'Text',
|
|
@@ -571,6 +569,10 @@ const singleColumnBuiltInStyles = {
|
|
|
571
569
|
value: 'end',
|
|
572
570
|
displayName: 'Align right',
|
|
573
571
|
},
|
|
572
|
+
{
|
|
573
|
+
value: 'stretch',
|
|
574
|
+
displayName: 'Stretch',
|
|
575
|
+
},
|
|
574
576
|
],
|
|
575
577
|
},
|
|
576
578
|
type: 'Text',
|
|
@@ -594,6 +596,10 @@ const singleColumnBuiltInStyles = {
|
|
|
594
596
|
value: 'end',
|
|
595
597
|
displayName: 'Align bottom',
|
|
596
598
|
},
|
|
599
|
+
{
|
|
600
|
+
value: 'stretch',
|
|
601
|
+
displayName: 'Stretch',
|
|
602
|
+
},
|
|
597
603
|
],
|
|
598
604
|
},
|
|
599
605
|
type: 'Text',
|
|
@@ -2970,6 +2976,47 @@ const getDataFromTree = (tree) => {
|
|
|
2970
2976
|
unboundValues,
|
|
2971
2977
|
};
|
|
2972
2978
|
};
|
|
2979
|
+
/**
|
|
2980
|
+
* Gets calculates the index to drop the dragged component based on the mouse position
|
|
2981
|
+
* @returns {InsertionData} a object containing a node that will become a parent for dragged component and index at which it must be inserted
|
|
2982
|
+
*/
|
|
2983
|
+
const getInsertionData = ({ dropReceiverParentNode, dropReceiverNode, flexDirection, isMouseAtTopBorder, isMouseAtBottomBorder, isMouseInLeftHalf, isMouseInUpperHalf, isOverTopIndicator, isOverBottomIndicator, }) => {
|
|
2984
|
+
const APPEND_INSIDE = dropReceiverNode.children.length;
|
|
2985
|
+
const PREPEND_INSIDE = 0;
|
|
2986
|
+
if (isMouseAtTopBorder || isMouseAtBottomBorder) {
|
|
2987
|
+
const indexOfSectionInParentChildren = dropReceiverParentNode.children.findIndex((n) => n.data.id === dropReceiverNode.data.id);
|
|
2988
|
+
const APPEND_OUTSIDE = indexOfSectionInParentChildren + 1;
|
|
2989
|
+
const PREPEND_OUTSIDE = indexOfSectionInParentChildren;
|
|
2990
|
+
return {
|
|
2991
|
+
// when the mouse is around the border we want to drop the new component as a new section onto the root node
|
|
2992
|
+
node: dropReceiverParentNode,
|
|
2993
|
+
index: isMouseAtBottomBorder ? APPEND_OUTSIDE : PREPEND_OUTSIDE,
|
|
2994
|
+
};
|
|
2995
|
+
}
|
|
2996
|
+
// if over one of the section indicators
|
|
2997
|
+
if (isOverTopIndicator || isOverBottomIndicator) {
|
|
2998
|
+
const indexOfSectionInParentChildren = dropReceiverParentNode.children.findIndex((n) => n.data.id === dropReceiverNode.data.id);
|
|
2999
|
+
const APPEND_OUTSIDE = indexOfSectionInParentChildren + 1;
|
|
3000
|
+
const PREPEND_OUTSIDE = indexOfSectionInParentChildren;
|
|
3001
|
+
return {
|
|
3002
|
+
// when the mouse is around the border we want to drop the new component as a new section onto the root node
|
|
3003
|
+
node: dropReceiverParentNode,
|
|
3004
|
+
index: isOverBottomIndicator ? APPEND_OUTSIDE : PREPEND_OUTSIDE,
|
|
3005
|
+
};
|
|
3006
|
+
}
|
|
3007
|
+
if (flexDirection === undefined || flexDirection === 'row') {
|
|
3008
|
+
return {
|
|
3009
|
+
node: dropReceiverNode,
|
|
3010
|
+
index: isMouseInLeftHalf ? PREPEND_INSIDE : APPEND_INSIDE,
|
|
3011
|
+
};
|
|
3012
|
+
}
|
|
3013
|
+
else {
|
|
3014
|
+
return {
|
|
3015
|
+
node: dropReceiverNode,
|
|
3016
|
+
index: isMouseInUpperHalf ? PREPEND_INSIDE : APPEND_INSIDE,
|
|
3017
|
+
};
|
|
3018
|
+
}
|
|
3019
|
+
};
|
|
2973
3020
|
const generateRandomId = (letterCount) => {
|
|
2974
3021
|
const LETTERS = 'abcdefghijklmnopqvwxyzABCDEFGHIJKLMNOPQVWXYZ';
|
|
2975
3022
|
const NUMS = '0123456789';
|
|
@@ -4117,5 +4164,5 @@ async function fetchById({ client, experienceTypeId, id, localeCode, isEditorMod
|
|
|
4117
4164
|
}
|
|
4118
4165
|
}
|
|
4119
4166
|
|
|
4120
|
-
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 };
|
|
4167
|
+
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 };
|
|
4121
4168
|
//# sourceMappingURL=index.js.map
|