@contentful/experiences-core 1.39.0-alpha-20250528T1201-58ca01e.0 → 1.39.0-alpha-20250528T1549-bd210e1.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.
@@ -1,3 +1,4 @@
1
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
1
2
  declare const SCROLL_STATES: {
2
3
  readonly Start: "scrollStart";
3
4
  readonly IsScrolling: "isScrolling";
@@ -7,20 +8,19 @@ declare const OUTGOING_EVENTS: {
7
8
  readonly Connected: "connected";
8
9
  readonly DesignTokens: "registerDesignTokens";
9
10
  readonly RegisteredBreakpoints: "registeredBreakpoints";
11
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
10
12
  readonly MouseMove: "mouseMove";
11
- readonly NewHoveredElement: "newHoveredElement";
13
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
12
14
  readonly ComponentSelected: "componentSelected";
13
15
  readonly RegisteredComponents: "registeredComponents";
14
16
  readonly RequestComponentTreeUpdate: "requestComponentTreeUpdate";
15
- readonly ComponentDragCanceled: "componentDragCanceled";
16
- readonly ComponentDropped: "componentDropped";
17
- readonly ComponentMoved: "componentMoved";
18
17
  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 */
20
21
  readonly CanvasScroll: "canvasScrolling";
21
22
  readonly CanvasError: "canvasError";
22
- readonly ComponentMoveStarted: "componentMoveStarted";
23
- readonly ComponentMoveEnded: "componentMoveEnded";
23
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
24
24
  readonly OutsideCanvasClick: "outsideCanvasClick";
25
25
  readonly SDKFeatures: "sdkFeatures";
26
26
  readonly RequestEntities: "REQUEST_ENTITIES";
@@ -29,17 +29,26 @@ 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 */
32
33
  readonly ComponentDraggingChanged: "componentDraggingChanged";
34
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
33
35
  readonly ComponentDragCanceled: "componentDragCanceled";
36
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
34
37
  readonly ComponentDragStarted: "componentDragStarted";
38
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
35
39
  readonly ComponentDragEnded: "componentDragEnded";
40
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
36
41
  readonly ComponentMoveEnded: "componentMoveEnded";
42
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
37
43
  readonly CanvasResized: "canvasResized";
44
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
38
45
  readonly SelectComponent: "selectComponent";
46
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
39
47
  readonly HoverComponent: "hoverComponent";
40
48
  readonly UpdatedEntity: "updatedEntity";
41
49
  readonly AssembliesAdded: "assembliesAdded";
42
50
  readonly AssembliesRegistered: "assembliesRegistered";
51
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
43
52
  readonly MouseMove: "mouseMove";
44
53
  readonly RequestedEntities: "REQUESTED_ENTITIES";
45
54
  };
package/dist/constants.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
1
2
  const SCROLL_STATES = {
2
3
  Start: 'scrollStart',
3
4
  IsScrolling: 'isScrolling',
@@ -7,20 +8,19 @@ const OUTGOING_EVENTS = {
7
8
  Connected: 'connected',
8
9
  DesignTokens: 'registerDesignTokens',
9
10
  RegisteredBreakpoints: 'registeredBreakpoints',
11
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
10
12
  MouseMove: 'mouseMove',
11
- NewHoveredElement: 'newHoveredElement',
13
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
12
14
  ComponentSelected: 'componentSelected',
13
15
  RegisteredComponents: 'registeredComponents',
14
16
  RequestComponentTreeUpdate: 'requestComponentTreeUpdate',
15
- ComponentDragCanceled: 'componentDragCanceled',
16
- ComponentDropped: 'componentDropped',
17
- ComponentMoved: 'componentMoved',
18
17
  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 */
20
21
  CanvasScroll: 'canvasScrolling',
21
22
  CanvasError: 'canvasError',
22
- ComponentMoveStarted: 'componentMoveStarted',
23
- ComponentMoveEnded: 'componentMoveEnded',
23
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
24
24
  OutsideCanvasClick: 'outsideCanvasClick',
25
25
  SDKFeatures: 'sdkFeatures',
26
26
  RequestEntities: 'REQUEST_ENTITIES',
@@ -29,17 +29,26 @@ 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 */
32
33
  ComponentDraggingChanged: 'componentDraggingChanged',
34
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
33
35
  ComponentDragCanceled: 'componentDragCanceled',
36
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
34
37
  ComponentDragStarted: 'componentDragStarted',
38
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
35
39
  ComponentDragEnded: 'componentDragEnded',
40
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
36
41
  ComponentMoveEnded: 'componentMoveEnded',
42
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
37
43
  CanvasResized: 'canvasResized',
44
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
38
45
  SelectComponent: 'selectComponent',
46
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
39
47
  HoverComponent: 'hoverComponent',
40
48
  UpdatedEntity: 'updatedEntity',
41
49
  AssembliesAdded: 'assembliesAdded',
42
50
  AssembliesRegistered: 'assembliesRegistered',
51
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
43
52
  MouseMove: 'mouseMove',
44
53
  RequestedEntities: 'REQUESTED_ENTITIES',
45
54
  };
@@ -1 +1 @@
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,GA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E,MAAM,mBAAmB,GAAG,QAAQ;IAE/B,mBAGX;AAHD,CAAA,UAAY,kBAAkB,EAAA;AAC5B,IAAA,kBAAA,CAAA,kBAAA,CAAA,GAAA,kBAAqC,CAAA;AACrC,IAAA,kBAAA,CAAA,oBAAA,CAAA,GAAA,oBAAyC,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;;;;"}
1
+ {"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["/** @deprecated will be removed when dropping backward compatibility for old DND */\nexport 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 /** @deprecated will be removed when dropping backward compatibility for old DND */\n MouseMove: 'mouseMove',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentSelected: 'componentSelected',\n RegisteredComponents: 'registeredComponents',\n RequestComponentTreeUpdate: 'requestComponentTreeUpdate',\n CanvasReload: 'canvasReload',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n UpdateSelectedComponentCoordinates: 'updateSelectedComponentCoordinates',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n CanvasScroll: 'canvasScrolling',\n CanvasError: 'canvasError',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\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 /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDraggingChanged: 'componentDraggingChanged',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragCanceled: 'componentDragCanceled',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragStarted: 'componentDragStarted',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragEnded: 'componentDragEnded',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentMoveEnded: 'componentMoveEnded',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n CanvasResized: 'canvasResized',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n SelectComponent: 'selectComponent',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n HoverComponent: 'hoverComponent',\n UpdatedEntity: 'updatedEntity',\n AssembliesAdded: 'assembliesAdded',\n AssembliesRegistered: 'assembliesRegistered',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\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;AACa,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;;AAE9C,IAAA,SAAS,EAAE,WAAW;;AAEtB,IAAA,iBAAiB,EAAE,mBAAmB;AACtC,IAAA,oBAAoB,EAAE,sBAAsB;AAC5C,IAAA,0BAA0B,EAAE,4BAA4B;AACxD,IAAA,YAAY,EAAE,cAAc;;AAE5B,IAAA,kCAAkC,EAAE,oCAAoC;;AAExE,IAAA,YAAY,EAAE,iBAAiB;AAC/B,IAAA,WAAW,EAAE,aAAa;;AAE1B,IAAA,kBAAkB,EAAE,oBAAoB;AACxC,IAAA,WAAW,EAAE,aAAa;AAC1B,IAAA,eAAe,EAAE,kBAAkB;EAC1B;AAEE,MAAA,eAAe,GAAG;AAC7B,IAAA,iBAAiB,EAAE,mBAAmB;AACtC,IAAA,mBAAmB,EAAE,qBAAqB;AAC1C,IAAA,iBAAiB,EAAE,sBAAsB;;AAEzC,IAAA,wBAAwB,EAAE,0BAA0B;;AAEpD,IAAA,qBAAqB,EAAE,uBAAuB;;AAE9C,IAAA,oBAAoB,EAA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IACV,gBAAgB;IAChB,OAAO;IACP,cAAc;IACd,kBAAkB;IAClB,WAAW;IACX,YAAY;IACZ,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,aAAa;IACb,iBAAiB;IACjB,YAAY;IACZ,cAAc;IACd,iBAAiB;;;;;IAKjB,0BAA0B;IAC1B,4BAA4B;IAC5B,oCAAoC;IACpC,sCAAsC;EACtC;AAEK,MAAM,sBAAsB,GAAG,OAAO;AAEtC,MAAM,yBAAyB,GAAG,iCAAiC;AAEnE,MAAM,mBAAmB,GAAG,QAAQ;IAE/B,mBAGX;AAHD,CAAA,UAAY,kBAAkB,EAAA;AAC5B,IAAA,kBAAA,CAAA,kBAAA,CAAA,GAAA,kBAAqC,CAAA;AACrC,IAAA,kBAAA,CAAA,oBAAA,CAAA,GAAA,oBAAyC,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, 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';
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, StructureComponentProps, StyleProps, UpdateSelectedComponentCoordinatesPayload, UpdatedEntityPayload, ValidationOption, VariableFormats } 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, getInsertionData, getTargetValueInPixels, parseCSSValue } from './utils/utils.js';
16
+ export { checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, generateRandomId, getDataFromTree, 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,21 +3,31 @@ 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 */
6
7
  const INCOMING_EVENTS = {
7
8
  RequestEditorMode: 'requestEditorMode',
8
9
  RequestReadOnlyMode: 'requestReadOnlyMode',
9
10
  ExperienceUpdated: 'componentTreeUpdated',
11
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
10
12
  ComponentDraggingChanged: 'componentDraggingChanged',
13
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
11
14
  ComponentDragCanceled: 'componentDragCanceled',
15
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
12
16
  ComponentDragStarted: 'componentDragStarted',
17
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
13
18
  ComponentDragEnded: 'componentDragEnded',
19
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
14
20
  ComponentMoveEnded: 'componentMoveEnded',
21
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
15
22
  CanvasResized: 'canvasResized',
23
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
16
24
  SelectComponent: 'selectComponent',
25
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
17
26
  HoverComponent: 'hoverComponent',
18
27
  UpdatedEntity: 'updatedEntity',
19
28
  AssembliesAdded: 'assembliesAdded',
20
29
  AssembliesRegistered: 'assembliesRegistered',
30
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
21
31
  MouseMove: 'mouseMove',
22
32
  RequestedEntities: 'REQUESTED_ENTITIES',
23
33
  };
@@ -818,17 +828,16 @@ const PrimitiveValueSchema = z.union([
818
828
  z.record(z.any(), z.any()),
819
829
  z.undefined(),
820
830
  ]);
831
+ const UsedComponentsSchema = z.array(z.object({
832
+ sys: z.object({
833
+ type: z.literal('Link'),
834
+ id: z.string(),
835
+ linkType: z.literal('Entry'),
836
+ }),
837
+ }));
821
838
  const uuidKeySchema = z
822
839
  .string()
823
840
  .regex(/^[a-zA-Z0-9-_]{1,21}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,21}$/' });
824
- /**
825
- * Property keys for imported components have a limit of 32 characters (to be implemented) while
826
- * property keys for patterns have a limit of 54 characters (<32-char-variabl-name>_<21-char-nanoid-id>).
827
- * Because we cannot distinguish between the two in the componentTree, we will use the larger limit for both.
828
- */
829
- const propertyKeySchema = z
830
- .string()
831
- .regex(/^[a-zA-Z0-9-_]{1,54}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,54}$/' });
832
841
  const DataSourceSchema = z.record(uuidKeySchema, z.object({
833
842
  sys: z.object({
834
843
  type: z.literal('Link'),
@@ -836,7 +845,62 @@ const DataSourceSchema = z.record(uuidKeySchema, z.object({
836
845
  linkType: z.enum(['Entry', 'Asset']),
837
846
  }),
838
847
  }));
848
+ const UnboundValuesSchema = z.record(uuidKeySchema, z.object({
849
+ value: PrimitiveValueSchema,
850
+ }));
851
+ /**
852
+ * Property keys for imported components have a limit of 32 characters (to be implemented) while
853
+ * property keys for patterns have a limit of 54 characters (<32-char-variable-name>_<21-char-nanoid-id>).
854
+ * Because we cannot distinguish between the two in the componentTree, we will use the larger limit for both.
855
+ */
856
+ const propertyKeySchema = z
857
+ .string()
858
+ .regex(/^[a-zA-Z0-9-_]{1,54}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,54}$/' });
859
+ const ComponentTreeNodeIdSchema = z
860
+ .string()
861
+ .regex(/^[a-zA-Z0-9]{1,8}$/, { message: 'Does not match /^[a-zA-Z0-9]{1,8}$/' });
862
+ const breakpointsRefinement = (value, ctx) => {
863
+ if (!value.length || value[0].query !== '*') {
864
+ ctx.addIssue({
865
+ code: z.ZodIssueCode.custom,
866
+ message: `The first breakpoint should include the following attributes: { "query": "*" }`,
867
+ });
868
+ }
869
+ const hasDuplicateIds = value.some((currentBreakpoint, currentBreakpointIndex) => {
870
+ // check if the current breakpoint id is found in the rest of the array
871
+ const breakpointIndex = value.findIndex((breakpoint) => breakpoint.id === currentBreakpoint.id);
872
+ return breakpointIndex !== currentBreakpointIndex;
873
+ });
874
+ if (hasDuplicateIds) {
875
+ ctx.addIssue({
876
+ code: z.ZodIssueCode.custom,
877
+ message: `Breakpoint IDs must be unique`,
878
+ });
879
+ }
880
+ // Extract the queries boundary by removing the special characters around it
881
+ const queries = value.map((bp) => bp.query === '*' ? bp.query : parseInt(bp.query.replace(/px|<|>/, '')));
882
+ // sort updates queries array in place so we need to create a copy
883
+ const originalQueries = [...queries];
884
+ queries.sort((q1, q2) => {
885
+ if (q1 === '*') {
886
+ return -1;
887
+ }
888
+ if (q2 === '*') {
889
+ return 1;
890
+ }
891
+ return q1 > q2 ? -1 : 1;
892
+ });
893
+ if (originalQueries.join('') !== queries.join('')) {
894
+ ctx.addIssue({
895
+ code: z.ZodIssueCode.custom,
896
+ message: `Breakpoints should be ordered from largest to smallest pixel value`,
897
+ });
898
+ }
899
+ };
839
900
  const ValuesByBreakpointSchema = z.record(z.lazy(() => PrimitiveValueSchema));
901
+ const BindingSourceTypeEnumSchema = z
902
+ .array(z.enum(['entry', 'asset', 'manual', 'experience']))
903
+ .nonempty();
840
904
  const DesignValueSchema = z
841
905
  .object({
842
906
  type: z.literal('DesignValue'),
@@ -869,8 +933,6 @@ const ComponentValueSchema = z
869
933
  key: z.string(),
870
934
  })
871
935
  .strict();
872
- // TODO: finalize schema structure before release
873
- // https://contentful.atlassian.net/browse/LUMOS-523
874
936
  const NoValueSchema = z.object({ type: z.literal('NoValue') }).strict();
875
937
  const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
876
938
  DesignValueSchema,
@@ -882,41 +944,12 @@ const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
882
944
  ]);
883
945
  // TODO: finalize schema structure before release
884
946
  // https://contentful.atlassian.net/browse/LUMOS-523
885
- const VariableMappingSchema = z.object({
886
- patternPropertyDefinitionId: propertyKeySchema,
887
- type: z.literal('ContentTypeMapping'),
888
- pathsByContentType: z.record(z.string(), z.object({ path: z.string() })),
889
- });
890
- const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
891
- // TODO: finalize schema structure before release
892
- // https://contentful.atlassian.net/browse/LUMOS-523
893
- const PatternPropertyDefinitionSchema = z.object({
894
- defaultValue: z
895
- .record(z.string(), z.object({
896
- sys: z.object({
897
- type: z.literal('Link'),
898
- id: z.string(),
899
- linkType: z.enum(['Entry']),
900
- }),
901
- }))
902
- .optional(),
903
- contentTypes: z.record(z.string(), z.object({
904
- sys: z.object({
905
- type: z.literal('Link'),
906
- id: z.string(),
907
- linkType: z.enum(['ContentType']),
908
- }),
909
- })),
910
- });
911
- const PatternPropertyDefinitionsSchema = z.record(propertyKeySchema, PatternPropertyDefinitionSchema);
912
- // TODO: finalize schema structure before release
913
- // https://contentful.atlassian.net/browse/LUMOS-523
914
947
  const PatternPropertySchema = z.object({
915
948
  type: z.literal('BoundValue'),
916
949
  path: z.string(),
917
950
  contentType: z.string(),
918
951
  });
919
- const PatternPropertysSchema = z.record(propertyKeySchema, PatternPropertySchema);
952
+ const PatternPropertiesSchema = z.record(propertyKeySchema, PatternPropertySchema);
920
953
  const BreakpointSchema = z
921
954
  .object({
922
955
  id: propertyKeySchema,
@@ -926,12 +959,6 @@ const BreakpointSchema = z
926
959
  displayIcon: z.enum(['desktop', 'tablet', 'mobile']).optional(),
927
960
  })
928
961
  .strict();
929
- const UnboundValuesSchema = z.record(uuidKeySchema, z.object({
930
- value: PrimitiveValueSchema,
931
- }));
932
- const ComponentTreeNodeIdSchema = z
933
- .string()
934
- .regex(/^[a-zA-Z0-9]{1,8}$/, { message: 'Does not match /^[a-zA-Z0-9]{1,8}$/' });
935
962
  // Use helper schema to define a recursive schema with its type correctly below
936
963
  const BaseComponentTreeNodeSchema = z.object({
937
964
  id: ComponentTreeNodeIdSchema.optional(),
@@ -939,14 +966,8 @@ const BaseComponentTreeNodeSchema = z.object({
939
966
  displayName: z.string().optional(),
940
967
  slotId: z.string().optional(),
941
968
  variables: z.record(propertyKeySchema, ComponentPropertyValueSchema),
942
- patternProperties: PatternPropertysSchema.optional(),
969
+ patternProperties: PatternPropertiesSchema.optional(),
943
970
  });
944
- const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
945
- children: z.lazy(() => ComponentTreeNodeSchema.array()),
946
- });
947
- const BindingSourceTypeEnumSchema = z
948
- .array(z.enum(['entry', 'asset', 'manual', 'experience']))
949
- .nonempty();
950
971
  const ComponentVariableSchema = z.object({
951
972
  displayName: z.string().optional(),
952
973
  type: DefinitionPropertyTypeSchema,
@@ -967,8 +988,25 @@ const ComponentVariableSchema = z.object({
967
988
  })
968
989
  .optional(),
969
990
  });
970
- const ComponentVariablesSchema = z.record(z.string().regex(/^[a-zA-Z0-9-_]{1,54}$/), // Here the key is <variableName>_<nanoidId> so we need to allow for a longer length
971
- ComponentVariableSchema);
991
+ const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
992
+ children: z.lazy(() => ComponentTreeNodeSchema.array()),
993
+ });
994
+ const ComponentTreeSchema = z
995
+ .object({
996
+ breakpoints: z.array(BreakpointSchema).superRefine(breakpointsRefinement),
997
+ children: z.array(ComponentTreeNodeSchema),
998
+ schemaVersion: SchemaVersions,
999
+ })
1000
+ .strict();
1001
+ const localeWrapper = (fieldSchema) => z.record(z.string(), fieldSchema);
1002
+
1003
+ z.object({
1004
+ componentTree: localeWrapper(ComponentTreeSchema),
1005
+ dataSource: localeWrapper(DataSourceSchema),
1006
+ unboundValues: localeWrapper(UnboundValuesSchema),
1007
+ usedComponents: localeWrapper(UsedComponentsSchema).optional(),
1008
+ });
1009
+
972
1010
  const THUMBNAIL_IDS = [
973
1011
  'columns',
974
1012
  'columnsPlusRight',
@@ -994,6 +1032,37 @@ const THUMBNAIL_IDS = [
994
1032
  'textColumns',
995
1033
  'duplex',
996
1034
  ];
1035
+ // TODO: finalize schema structure before release
1036
+ // https://contentful.atlassian.net/browse/LUMOS-523
1037
+ const VariableMappingSchema = z.object({
1038
+ patternPropertyDefinitionId: propertyKeySchema,
1039
+ type: z.literal('ContentTypeMapping'),
1040
+ pathsByContentType: z.record(z.string(), z.object({ path: z.string() })),
1041
+ });
1042
+ // TODO: finalize schema structure before release
1043
+ // https://contentful.atlassian.net/browse/LUMOS-523
1044
+ const PatternPropertyDefinitionSchema = z.object({
1045
+ defaultValue: z
1046
+ .record(z.string(), z.object({
1047
+ sys: z.object({
1048
+ type: z.literal('Link'),
1049
+ id: z.string(),
1050
+ linkType: z.enum(['Entry']),
1051
+ }),
1052
+ }))
1053
+ .optional(),
1054
+ contentTypes: z.record(z.string(), z.object({
1055
+ sys: z.object({
1056
+ type: z.literal('Link'),
1057
+ id: z.string(),
1058
+ linkType: z.enum(['ContentType']),
1059
+ }),
1060
+ })),
1061
+ });
1062
+ const PatternPropertyDefinitionsSchema = z.record(propertyKeySchema, PatternPropertyDefinitionSchema);
1063
+ const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
1064
+ const ComponentVariablesSchema = z.record(z.string().regex(/^[a-zA-Z0-9-_]{1,54}$/), // Here the key is <variableName>_<nanoidId> so we need to allow for a longer length
1065
+ ComponentVariableSchema);
997
1066
  const ComponentSettingsSchema = z.object({
998
1067
  variableDefinitions: ComponentVariablesSchema,
999
1068
  thumbnailId: z.enum(THUMBNAIL_IDS).optional(),
@@ -1001,65 +1070,12 @@ const ComponentSettingsSchema = z.object({
1001
1070
  variableMappings: VariableMappingsSchema.optional(),
1002
1071
  patternPropertyDefinitions: PatternPropertyDefinitionsSchema.optional(),
1003
1072
  });
1004
- const UsedComponentsSchema = z.array(z.object({
1005
- sys: z.object({
1006
- type: z.literal('Link'),
1007
- id: z.string(),
1008
- linkType: z.literal('Entry'),
1009
- }),
1010
- }));
1011
- const breakpointsRefinement = (value, ctx) => {
1012
- if (!value.length || value[0].query !== '*') {
1013
- ctx.addIssue({
1014
- code: z.ZodIssueCode.custom,
1015
- message: `The first breakpoint should include the following attributes: { "query": "*" }`,
1016
- });
1017
- }
1018
- const hasDuplicateIds = value.some((currentBreakpoint, currentBreakpointIndex) => {
1019
- // check if the current breakpoint id is found in the rest of the array
1020
- const breakpointIndex = value.findIndex((breakpoint) => breakpoint.id === currentBreakpoint.id);
1021
- return breakpointIndex !== currentBreakpointIndex;
1022
- });
1023
- if (hasDuplicateIds) {
1024
- ctx.addIssue({
1025
- code: z.ZodIssueCode.custom,
1026
- message: `Breakpoint IDs must be unique`,
1027
- });
1028
- }
1029
- // Extract the queries boundary by removing the special characters around it
1030
- const queries = value.map((bp) => bp.query === '*' ? bp.query : parseInt(bp.query.replace(/px|<|>/, '')));
1031
- // sort updates queries array in place so we need to create a copy
1032
- const originalQueries = [...queries];
1033
- queries.sort((q1, q2) => {
1034
- if (q1 === '*') {
1035
- return -1;
1036
- }
1037
- if (q2 === '*') {
1038
- return 1;
1039
- }
1040
- return q1 > q2 ? -1 : 1;
1041
- });
1042
- if (originalQueries.join('') !== queries.join('')) {
1043
- ctx.addIssue({
1044
- code: z.ZodIssueCode.custom,
1045
- message: `Breakpoints should be ordered from largest to smallest pixel value`,
1046
- });
1047
- }
1048
- };
1049
- const ComponentTreeSchema = z
1050
- .object({
1051
- breakpoints: z.array(BreakpointSchema).superRefine(breakpointsRefinement),
1052
- children: z.array(ComponentTreeNodeSchema),
1053
- schemaVersion: SchemaVersions,
1054
- })
1055
- .strict();
1056
- const localeWrapper = (fieldSchema) => z.record(z.string(), fieldSchema);
1057
1073
  z.object({
1058
1074
  componentTree: localeWrapper(ComponentTreeSchema),
1059
1075
  dataSource: localeWrapper(DataSourceSchema),
1060
1076
  unboundValues: localeWrapper(UnboundValuesSchema),
1061
1077
  usedComponents: localeWrapper(UsedComponentsSchema).optional(),
1062
- componentSettings: localeWrapper(ComponentSettingsSchema).optional(),
1078
+ componentSettings: localeWrapper(ComponentSettingsSchema),
1063
1079
  });
1064
1080
 
1065
1081
  z.object({
@@ -2928,47 +2944,6 @@ const getDataFromTree = (tree) => {
2928
2944
  unboundValues,
2929
2945
  };
2930
2946
  };
2931
- /**
2932
- * Gets calculates the index to drop the dragged component based on the mouse position
2933
- * @returns {InsertionData} a object containing a node that will become a parent for dragged component and index at which it must be inserted
2934
- */
2935
- const getInsertionData = ({ dropReceiverParentNode, dropReceiverNode, flexDirection, isMouseAtTopBorder, isMouseAtBottomBorder, isMouseInLeftHalf, isMouseInUpperHalf, isOverTopIndicator, isOverBottomIndicator, }) => {
2936
- const APPEND_INSIDE = dropReceiverNode.children.length;
2937
- const PREPEND_INSIDE = 0;
2938
- if (isMouseAtTopBorder || isMouseAtBottomBorder) {
2939
- const indexOfSectionInParentChildren = dropReceiverParentNode.children.findIndex((n) => n.data.id === dropReceiverNode.data.id);
2940
- const APPEND_OUTSIDE = indexOfSectionInParentChildren + 1;
2941
- const PREPEND_OUTSIDE = indexOfSectionInParentChildren;
2942
- return {
2943
- // when the mouse is around the border we want to drop the new component as a new section onto the root node
2944
- node: dropReceiverParentNode,
2945
- index: isMouseAtBottomBorder ? APPEND_OUTSIDE : PREPEND_OUTSIDE,
2946
- };
2947
- }
2948
- // if over one of the section indicators
2949
- if (isOverTopIndicator || isOverBottomIndicator) {
2950
- const indexOfSectionInParentChildren = dropReceiverParentNode.children.findIndex((n) => n.data.id === dropReceiverNode.data.id);
2951
- const APPEND_OUTSIDE = indexOfSectionInParentChildren + 1;
2952
- const PREPEND_OUTSIDE = indexOfSectionInParentChildren;
2953
- return {
2954
- // when the mouse is around the border we want to drop the new component as a new section onto the root node
2955
- node: dropReceiverParentNode,
2956
- index: isOverBottomIndicator ? APPEND_OUTSIDE : PREPEND_OUTSIDE,
2957
- };
2958
- }
2959
- if (flexDirection === undefined || flexDirection === 'row') {
2960
- return {
2961
- node: dropReceiverNode,
2962
- index: isMouseInLeftHalf ? PREPEND_INSIDE : APPEND_INSIDE,
2963
- };
2964
- }
2965
- else {
2966
- return {
2967
- node: dropReceiverNode,
2968
- index: isMouseInUpperHalf ? PREPEND_INSIDE : APPEND_INSIDE,
2969
- };
2970
- }
2971
- };
2972
2947
  const generateRandomId = (letterCount) => {
2973
2948
  const LETTERS = 'abcdefghijklmnopqvwxyzABCDEFGHIJKLMNOPQVWXYZ';
2974
2949
  const NUMS = '0123456789';
@@ -4116,5 +4091,5 @@ async function fetchById({ client, experienceTypeId, id, localeCode, isEditorMod
4116
4091
  }
4117
4092
  }
4118
4093
 
4119
- 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 };
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 };
4120
4095
  //# sourceMappingURL=index.js.map