@contentful/experiences-core 2.0.0-prerelease-20250704T1603-11d76eb.0 → 2.0.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,7 +22,6 @@ 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 */
26
25
  type ScrollState = (typeof SCROLL_STATES)[ScrollStateKey];
27
26
  type OutgoingEventKey = keyof typeof OUTGOING_EVENTS;
28
27
  type OutgoingEvent = (typeof OUTGOING_EVENTS)[OutgoingEventKey];
@@ -346,6 +345,27 @@ type BackgroundImageOptions = {
346
345
  quality?: string;
347
346
  targetSize: string;
348
347
  };
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
+ }
349
369
  type ConnectedPayload = undefined | {
350
370
  sdkVersion: string;
351
371
  definitions: ComponentDefinition[];
@@ -435,18 +455,7 @@ type OUTGOING_EVENT_PAYLOADS = {
435
455
  outsideCanvasClick: OutsideCanvasClickPayload;
436
456
  sdkFeatures: SDKFeaturesPayload;
437
457
  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
- };
448
458
  };
449
- type CanvasGeometryUpdateSourceEvent = 'resize' | 'mutation';
450
459
  type SendMessageParams = <T extends OutgoingEvent>(eventType: T, data: OUTGOING_EVENT_PAYLOADS[T]) => void;
451
460
  type OutgoingMessage = {
452
461
  [K in keyof OUTGOING_EVENT_PAYLOADS]: {
@@ -466,33 +475,25 @@ type ExperienceUpdatedPayload = {
466
475
  changedNode?: ExperienceTreeNode;
467
476
  changedValueType?: SelectedValueTypes;
468
477
  };
469
- /** @deprecated will be removed when dropping backward compatibility for old DND */
470
478
  type ComponentDraggingChangedPayload = {
471
479
  isDragging: boolean;
472
480
  };
473
- /** @deprecated will be removed when dropping backward compatibility for old DND */
474
481
  type IncomingComponentDragCanceledPayload = undefined;
475
- /** @deprecated will be removed when dropping backward compatibility for old DND */
476
482
  type ComponentDragStartedPayload = {
477
483
  id: string;
478
484
  isAssembly: boolean;
479
485
  };
480
- /** @deprecated will be removed when dropping backward compatibility for old DND */
481
486
  type ComponentDragEndedPayload = undefined;
482
- /** @deprecated will be removed when dropping backward compatibility for old DND */
483
487
  type IncomingComponentMoveEndedPayload = {
484
488
  mouseX: number;
485
489
  mouseY: number;
486
490
  };
487
- /** @deprecated will be removed when dropping backward compatibility for old DND */
488
491
  type CanvasResizedPayload = {
489
492
  selectedNodeId: string;
490
493
  };
491
- /** @deprecated will be removed when dropping backward compatibility for old DND */
492
494
  type SelectComponentPayload = {
493
495
  selectedNodeId: string;
494
496
  };
495
- /** @deprecated will be removed when dropping backward compatibility for old DND */
496
497
  type HoverComponentPayload = {
497
498
  hoveredNodeId: string;
498
499
  };
@@ -507,7 +508,6 @@ type AssembliesAddedPayload = {
507
508
  type AssembliesRegisteredPayload = {
508
509
  assemblies: ComponentDefinition[];
509
510
  };
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,12 +539,5 @@ 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>;
549
542
 
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 };
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 };
@@ -10,7 +10,6 @@ declare const findOutermostCoordinates: (first: Rect, second: Rect) => {
10
10
  bottom: number;
11
11
  left: number;
12
12
  };
13
- declare const isElementHidden: (rect: DOMRect) => boolean;
14
13
  declare const getElementCoordinates: (element: Element) => DOMRect;
15
14
 
16
- export { findOutermostCoordinates, getElementCoordinates, isElementHidden };
15
+ export { findOutermostCoordinates, getElementCoordinates };
@@ -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_SIZE
55
+ * Default height => height: EMPTY_CONTAINER_HEIGHT
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 } from '../types.js';
1
+ import { ExperienceTree, ExperienceEntry, ComponentDefinition, ExperienceTreeNode, StyleProps } from '../types.js';
2
2
  import { Entry } from 'contentful';
3
3
  import { ExperienceDataSource, ExperienceUnboundValues } from '@contentful/experiences-validators';
4
4
 
@@ -6,6 +6,26 @@ 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;
9
29
  declare const generateRandomId: (letterCount: number) => string;
10
30
  declare const checkIsAssemblyNode: ({ componentId, usedComponents, }: {
11
31
  componentId: string;
@@ -24,4 +44,4 @@ interface ParsedValue {
24
44
  declare function parseCSSValue(input: string): ParsedValue | null;
25
45
  declare function getTargetValueInPixels(targetWidthObject: ParsedValue): number;
26
46
 
27
- export { checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, generateRandomId, getDataFromTree, getTargetValueInPixels, parseCSSValue };
47
+ export { checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, generateRandomId, getDataFromTree, getInsertionData, getTargetValueInPixels, parseCSSValue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experiences-core",
3
- "version": "2.0.0-prerelease-20250704T1603-11d76eb.0",
3
+ "version": "2.0.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -70,11 +70,11 @@
70
70
  "vitest": "^2.1.1"
71
71
  },
72
72
  "dependencies": {
73
- "@contentful/experiences-validators": "2.0.0-prerelease-20250704T1603-11d76eb.0",
73
+ "@contentful/experiences-validators": "2.0.0",
74
74
  "@contentful/rich-text-types": "^17.0.0"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "contentful": ">=10.6.0"
78
78
  },
79
- "gitHead": "5e270693551988015ff54cf4931f6c07187fc3fb"
79
+ "gitHead": "d589d5148ce47c9d0f93ab7748246232893b3b21"
80
80
  }