@contentful/experiences-core 2.0.3-dev-20250731T1506-4b21110.0 → 2.0.3-dev-20250806T1104-2992bd9.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/types.d.ts CHANGED
@@ -22,6 +22,7 @@ type ComponentDefinitionVariableTypeMap = {
22
22
  Text: string;
23
23
  };
24
24
  type ScrollStateKey = keyof typeof SCROLL_STATES;
25
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
25
26
  type ScrollState = (typeof SCROLL_STATES)[ScrollStateKey];
26
27
  type OutgoingEventKey = keyof typeof OUTGOING_EVENTS;
27
28
  type OutgoingEvent = (typeof OUTGOING_EVENTS)[OutgoingEventKey];
@@ -170,7 +171,7 @@ type StyleProps = {
170
171
  cfLineHeight: string;
171
172
  cfLetterSpacing: string;
172
173
  cfTextColor: string;
173
- cfTextAlign: 'left' | 'center' | 'right';
174
+ cfTextAlign: 'start' | 'center' | 'end';
174
175
  cfTextTransform: 'none' | 'capitalize' | 'uppercase' | 'lowercase';
175
176
  cfTextBold: boolean;
176
177
  cfTextItalic: boolean;
@@ -345,27 +346,6 @@ type BackgroundImageOptions = {
345
346
  quality?: string;
346
347
  targetSize: string;
347
348
  };
348
- interface DraggableProvidedDraggableProps {
349
- 'data-rfd-draggable-context-id'?: string;
350
- 'data-rfd-draggable-id'?: string;
351
- }
352
- interface DraggableProvidedDragHandleProps {
353
- 'data-rfd-drag-handle-draggable-id'?: string;
354
- 'data-rfd-drag-handle-context-id'?: string;
355
- }
356
- type WrapperTags = keyof Pick<JSX.IntrinsicElements, 'div' | 'span' | 'section' | 'article' | 'aside' | 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'header' | 'footer' | 'nav' | 'main'>;
357
- interface DragWrapperProps extends DraggableProvidedDragHandleProps, DraggableProvidedDraggableProps, React.HTMLAttributes<HTMLElement>, React.PropsWithChildren {
358
- 'data-cf-node-id'?: string;
359
- 'data-ctfl-draggable-id'?: string;
360
- 'data-test-id'?: string;
361
- 'data-cf-node-block-id'?: string;
362
- 'data-cf-node-block-type'?: string;
363
- 'data-ctfl-dragging-element'?: string;
364
- innerRef?: (refNode: HTMLElement) => void;
365
- wrapComponent?: boolean;
366
- Tag?: WrapperTags;
367
- ToolTipAndPlaceholder?: React.ReactNode;
368
- }
369
349
  type ConnectedPayload = undefined | {
370
350
  sdkVersion: string;
371
351
  definitions: ComponentDefinition[];
@@ -455,7 +435,18 @@ type OUTGOING_EVENT_PAYLOADS = {
455
435
  outsideCanvasClick: OutsideCanvasClickPayload;
456
436
  sdkFeatures: SDKFeaturesPayload;
457
437
  REQUEST_ENTITIES: RequestEntitiesPayload;
438
+ canvasGeometryUpdated: {
439
+ size: {
440
+ width: number;
441
+ height: number;
442
+ };
443
+ nodes: Record<string, {
444
+ coordinates: Pick<DOMRect, 'x' | 'y' | 'width' | 'height'>;
445
+ }>;
446
+ sourceEvent: CanvasGeometryUpdateSourceEvent;
447
+ };
458
448
  };
449
+ type CanvasGeometryUpdateSourceEvent = 'resize' | 'mutation';
459
450
  type SendMessageParams = <T extends OutgoingEvent>(eventType: T, data: OUTGOING_EVENT_PAYLOADS[T]) => void;
460
451
  type OutgoingMessage = {
461
452
  [K in keyof OUTGOING_EVENT_PAYLOADS]: {
@@ -475,25 +466,33 @@ type ExperienceUpdatedPayload = {
475
466
  changedNode?: ExperienceTreeNode;
476
467
  changedValueType?: SelectedValueTypes;
477
468
  };
469
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
478
470
  type ComponentDraggingChangedPayload = {
479
471
  isDragging: boolean;
480
472
  };
473
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
481
474
  type IncomingComponentDragCanceledPayload = undefined;
475
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
482
476
  type ComponentDragStartedPayload = {
483
477
  id: string;
484
478
  isAssembly: boolean;
485
479
  };
480
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
486
481
  type ComponentDragEndedPayload = undefined;
482
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
487
483
  type IncomingComponentMoveEndedPayload = {
488
484
  mouseX: number;
489
485
  mouseY: number;
490
486
  };
487
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
491
488
  type CanvasResizedPayload = {
492
489
  selectedNodeId: string;
493
490
  };
491
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
494
492
  type SelectComponentPayload = {
495
493
  selectedNodeId: string;
496
494
  };
495
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
497
496
  type HoverComponentPayload = {
498
497
  hoveredNodeId: string;
499
498
  };
@@ -508,6 +507,7 @@ type AssembliesAddedPayload = {
508
507
  type AssembliesRegisteredPayload = {
509
508
  assemblies: ComponentDefinition[];
510
509
  };
510
+ /** @deprecated will be removed when dropping backward compatibility for old DND */
511
511
  type IncomingMouseMovePayload = {
512
512
  mouseX: number;
513
513
  mouseY: number;
@@ -539,5 +539,12 @@ type IncomingMessage = {
539
539
  payload: INCOMING_EVENT_PAYLOADS[K];
540
540
  };
541
541
  }[keyof INCOMING_EVENT_PAYLOADS];
542
+ type StructuralEditorModeProps = {
543
+ editorMode: true;
544
+ node: ExperienceTreeNode;
545
+ } | {
546
+ editorMode?: false;
547
+ };
548
+ type StructureComponentProps<OtherProps> = React.PropsWithChildren<StructuralEditorModeProps & OtherProps>;
542
549
 
543
- export type { 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 };
550
+ export type { AssembliesAddedPayload, AssembliesRegisteredPayload, BackgroundImageAlignmentOption, BackgroundImageOptions, BackgroundImageScalingOption, Binding, BindingMap, BindingMapByBlockId, BoundComponentPropertyTypes, CSSProperties, CanvasErrorPayload, CanvasGeometryUpdateSourceEvent, 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 };
@@ -10,6 +10,7 @@ declare const findOutermostCoordinates: (first: Rect, second: Rect) => {
10
10
  bottom: number;
11
11
  left: number;
12
12
  };
13
+ declare const isElementHidden: (rect: DOMRect) => boolean;
13
14
  declare const getElementCoordinates: (element: Element) => DOMRect;
14
15
 
15
- export { findOutermostCoordinates, getElementCoordinates };
16
+ export { findOutermostCoordinates, getElementCoordinates, isElementHidden };
@@ -52,7 +52,7 @@ declare const buildCfStyles: (values: Partial<StyleProps>) => CSSProperties;
52
52
  declare const addMinHeightForEmptyStructures: (cssProperties: CSSProperties, node: ComponentTreeNode) => react.CSSProperties;
53
53
  /**
54
54
  * Container/section default behavior:
55
- * Default height => height: EMPTY_CONTAINER_HEIGHT
55
+ * Default height => height: EMPTY_CONTAINER_SIZE
56
56
  * If a container component has children => height: 'fit-content'
57
57
  */
58
58
  declare const calculateNodeDefaultHeight: ({ blockId, children, value, }: {
@@ -1,4 +1,4 @@
1
- import { ExperienceTree, ExperienceEntry, ComponentDefinition, ExperienceTreeNode, StyleProps } from '../types.js';
1
+ import { ExperienceTree, ExperienceEntry, ComponentDefinition } from '../types.js';
2
2
  import { Entry } from 'contentful';
3
3
  import { ExperienceDataSource, ExperienceUnboundValues } from '@contentful/experiences-validators';
4
4
 
@@ -6,26 +6,6 @@ declare const getDataFromTree: (tree: ExperienceTree) => {
6
6
  dataSource: ExperienceDataSource;
7
7
  unboundValues: ExperienceUnboundValues;
8
8
  };
9
- type GetInsertionDataParams = {
10
- dropReceiverNode: ExperienceTreeNode;
11
- dropReceiverParentNode: ExperienceTreeNode;
12
- flexDirection?: StyleProps['cfFlexDirection'];
13
- isMouseAtTopBorder: boolean;
14
- isMouseAtBottomBorder: boolean;
15
- isMouseInLeftHalf: boolean;
16
- isMouseInUpperHalf: boolean;
17
- isOverTopIndicator: boolean;
18
- isOverBottomIndicator: boolean;
19
- };
20
- type InsertionData = {
21
- node: ExperienceTreeNode;
22
- index: number;
23
- };
24
- /**
25
- * Gets calculates the index to drop the dragged component based on the mouse position
26
- * @returns {InsertionData} a object containing a node that will become a parent for dragged component and index at which it must be inserted
27
- */
28
- declare const getInsertionData: ({ dropReceiverParentNode, dropReceiverNode, flexDirection, isMouseAtTopBorder, isMouseAtBottomBorder, isMouseInLeftHalf, isMouseInUpperHalf, isOverTopIndicator, isOverBottomIndicator, }: GetInsertionDataParams) => InsertionData;
29
9
  declare const generateRandomId: (letterCount: number) => string;
30
10
  declare const checkIsAssemblyNode: ({ componentId, usedComponents, }: {
31
11
  componentId: string;
@@ -44,4 +24,4 @@ interface ParsedValue {
44
24
  declare function parseCSSValue(input: string): ParsedValue | null;
45
25
  declare function getTargetValueInPixels(targetWidthObject: ParsedValue): number;
46
26
 
47
- export { checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, generateRandomId, getDataFromTree, getInsertionData, getTargetValueInPixels, parseCSSValue };
27
+ export { checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, generateRandomId, getDataFromTree, getTargetValueInPixels, parseCSSValue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experiences-core",
3
- "version": "2.0.3-dev-20250731T1506-4b21110.0",
3
+ "version": "2.0.3-dev-20250806T1104-2992bd9.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -70,12 +70,12 @@
70
70
  "vitest": "^2.1.1"
71
71
  },
72
72
  "dependencies": {
73
- "@contentful/experiences-validators": "2.0.3-dev-20250731T1506-4b21110.0",
73
+ "@contentful/experiences-validators": "2.0.3-dev-20250806T1104-2992bd9.0",
74
74
  "@contentful/rich-text-types": "^17.0.0",
75
75
  "zustand": "^4.4.7"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "contentful": ">=10.6.0"
79
79
  },
80
- "gitHead": "7fd3773f5ed263af934dbf0e9b4b988927d089d6"
80
+ "gitHead": "113b72a55e30e29179d6598036ca0845866b56cf"
81
81
  }