@contentful/experiences-core 1.40.0-alpha-20250604T0813-1f6e699.0 → 1.40.0-dev-20250604T0933-fc115de.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];
@@ -148,8 +147,8 @@ type ExperienceTree = {
148
147
  */
149
148
  type StyleProps = {
150
149
  cfVisibility: boolean;
151
- cfHorizontalAlignment: 'start' | 'end' | 'center';
152
- cfVerticalAlignment: 'start' | 'end' | 'center';
150
+ cfHorizontalAlignment: 'start' | 'end' | 'center' | 'stretch';
151
+ cfVerticalAlignment: 'start' | 'end' | 'center' | 'stretch';
153
152
  cfMargin: string;
154
153
  cfPadding: string;
155
154
  cfBackgroundColor: string;
@@ -348,6 +347,27 @@ type BackgroundImageOptions = {
348
347
  quality?: string;
349
348
  targetSize: string;
350
349
  };
350
+ interface DraggableProvidedDraggableProps {
351
+ 'data-rfd-draggable-context-id'?: string;
352
+ 'data-rfd-draggable-id'?: string;
353
+ }
354
+ interface DraggableProvidedDragHandleProps {
355
+ 'data-rfd-drag-handle-draggable-id'?: string;
356
+ 'data-rfd-drag-handle-context-id'?: string;
357
+ }
358
+ type WrapperTags = keyof Pick<JSX.IntrinsicElements, 'div' | 'span' | 'section' | 'article' | 'aside' | 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'header' | 'footer' | 'nav' | 'main'>;
359
+ interface DragWrapperProps extends DraggableProvidedDragHandleProps, DraggableProvidedDraggableProps, React.HTMLAttributes<HTMLElement>, React.PropsWithChildren {
360
+ 'data-cf-node-id'?: string;
361
+ 'data-ctfl-draggable-id'?: string;
362
+ 'data-test-id'?: string;
363
+ 'data-cf-node-block-id'?: string;
364
+ 'data-cf-node-block-type'?: string;
365
+ 'data-ctfl-dragging-element'?: string;
366
+ innerRef?: (refNode: HTMLElement) => void;
367
+ wrapComponent?: boolean;
368
+ Tag?: WrapperTags;
369
+ ToolTipAndPlaceholder?: React.ReactNode;
370
+ }
351
371
  type ConnectedPayload = undefined | {
352
372
  sdkVersion: string;
353
373
  definitions: ComponentDefinition[];
@@ -437,18 +457,7 @@ type OUTGOING_EVENT_PAYLOADS = {
437
457
  outsideCanvasClick: OutsideCanvasClickPayload;
438
458
  sdkFeatures: SDKFeaturesPayload;
439
459
  REQUEST_ENTITIES: RequestEntitiesPayload;
440
- canvasGeometryUpdated: {
441
- size: {
442
- width: number;
443
- height: number;
444
- };
445
- nodes: Record<string, {
446
- coordinates: Pick<DOMRect, 'x' | 'y' | 'width' | 'height'>;
447
- }>;
448
- sourceEvent: CanvasGeometryUpdateSourceEvent;
449
- };
450
460
  };
451
- type CanvasGeometryUpdateSourceEvent = 'resize' | 'mutation';
452
461
  type SendMessageParams = <T extends OutgoingEvent>(eventType: T, data: OUTGOING_EVENT_PAYLOADS[T]) => void;
453
462
  type OutgoingMessage = {
454
463
  [K in keyof OUTGOING_EVENT_PAYLOADS]: {
@@ -472,33 +481,25 @@ type ExperienceUpdatedPayload = {
472
481
  changedNode?: ExperienceTreeNode;
473
482
  changedValueType?: SelectedValueTypes;
474
483
  };
475
- /** @deprecated will be removed when dropping backward compatibility for old DND */
476
484
  type ComponentDraggingChangedPayload = {
477
485
  isDragging: boolean;
478
486
  };
479
- /** @deprecated will be removed when dropping backward compatibility for old DND */
480
487
  type IncomingComponentDragCanceledPayload = undefined;
481
- /** @deprecated will be removed when dropping backward compatibility for old DND */
482
488
  type ComponentDragStartedPayload = {
483
489
  id: string;
484
490
  isAssembly: boolean;
485
491
  };
486
- /** @deprecated will be removed when dropping backward compatibility for old DND */
487
492
  type ComponentDragEndedPayload = undefined;
488
- /** @deprecated will be removed when dropping backward compatibility for old DND */
489
493
  type IncomingComponentMoveEndedPayload = {
490
494
  mouseX: number;
491
495
  mouseY: number;
492
496
  };
493
- /** @deprecated will be removed when dropping backward compatibility for old DND */
494
497
  type CanvasResizedPayload = {
495
498
  selectedNodeId: string;
496
499
  };
497
- /** @deprecated will be removed when dropping backward compatibility for old DND */
498
500
  type SelectComponentPayload = {
499
501
  selectedNodeId: string;
500
502
  };
501
- /** @deprecated will be removed when dropping backward compatibility for old DND */
502
503
  type HoverComponentPayload = {
503
504
  hoveredNodeId: string;
504
505
  };
@@ -513,7 +514,6 @@ type AssembliesAddedPayload = {
513
514
  type AssembliesRegisteredPayload = {
514
515
  assemblies: ComponentDefinition[];
515
516
  };
516
- /** @deprecated will be removed when dropping backward compatibility for old DND */
517
517
  type IncomingMouseMovePayload = {
518
518
  mouseX: number;
519
519
  mouseY: number;
@@ -545,12 +545,5 @@ type IncomingMessage = {
545
545
  payload: INCOMING_EVENT_PAYLOADS[K];
546
546
  };
547
547
  }[keyof INCOMING_EVENT_PAYLOADS];
548
- type StructuralEditorModeProps = {
549
- editorMode: true;
550
- node: ExperienceTreeNode;
551
- } | {
552
- editorMode?: false;
553
- };
554
- type StructureComponentProps<OtherProps> = React.PropsWithChildren<StructuralEditorModeProps & OtherProps>;
555
548
 
556
- 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 };
549
+ 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 };
@@ -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;
@@ -29,4 +49,4 @@ interface ParsedValue {
29
49
  declare function parseCSSValue(input: string): ParsedValue | null;
30
50
  declare function getTargetValueInPixels(targetWidthObject: ParsedValue): number;
31
51
 
32
- export { checkIsAssembly, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, generateRandomId, getDataFromTree, getTargetValueInPixels, parseCSSValue };
52
+ export { checkIsAssembly, 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": "1.40.0-alpha-20250604T0813-1f6e699.0",
3
+ "version": "1.40.0-dev-20250604T0933-fc115de.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": "1.40.0-alpha-20250604T0813-1f6e699.0",
73
+ "@contentful/experiences-validators": "1.40.0-dev-20250604T0933-fc115de.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": "cdf8e35c462fc76e415a338e3e98694cbb2a2364"
79
+ "gitHead": "b49f3d305855d97224c766d8177f3d8954b6e21f"
80
80
  }