@contentful/experiences-core 1.39.0-alpha-20250528T1342-e28bc3d.0 → 1.39.0-dev-20250528T1423-593ccdb.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
@@ -1,9 +1,9 @@
1
1
  import { Entry, Asset, AssetFile, ChainModifiers } from 'contentful';
2
2
  import { SCROLL_STATES, OUTGOING_EVENTS, INCOMING_EVENTS, INTERNAL_EVENTS } from './constants.js';
3
- import { EntityStore } from './entity/EntityStore.js';
4
3
  import { Document } from '@contentful/rich-text-types';
5
4
  import { ComponentDefinitionPropertyType, BindingSourceTypeEnum, ComponentPropertyValue, ExperienceDataSource, ExperienceUnboundValues, Breakpoint, PatternProperty, ExperienceComponentTree, ExperienceUsedComponents, ExperienceComponentSettings, ValuesByBreakpoint, PrimitiveValue } from '@contentful/experiences-validators';
6
5
  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';
6
+ import { EntityStore } from './entity/EntityStore.js';
7
7
 
8
8
  type ComponentDefinitionVariableTypeMap = {
9
9
  Array: unknown[];
@@ -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];
@@ -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[];
@@ -461,33 +481,25 @@ type ExperienceUpdatedPayload = {
461
481
  changedNode?: ExperienceTreeNode;
462
482
  changedValueType?: SelectedValueTypes;
463
483
  };
464
- /** @deprecated will be removed when dropping backward compatibility for old DND */
465
484
  type ComponentDraggingChangedPayload = {
466
485
  isDragging: boolean;
467
486
  };
468
- /** @deprecated will be removed when dropping backward compatibility for old DND */
469
487
  type IncomingComponentDragCanceledPayload = undefined;
470
- /** @deprecated will be removed when dropping backward compatibility for old DND */
471
488
  type ComponentDragStartedPayload = {
472
489
  id: string;
473
490
  isAssembly: boolean;
474
491
  };
475
- /** @deprecated will be removed when dropping backward compatibility for old DND */
476
492
  type ComponentDragEndedPayload = undefined;
477
- /** @deprecated will be removed when dropping backward compatibility for old DND */
478
493
  type IncomingComponentMoveEndedPayload = {
479
494
  mouseX: number;
480
495
  mouseY: number;
481
496
  };
482
- /** @deprecated will be removed when dropping backward compatibility for old DND */
483
497
  type CanvasResizedPayload = {
484
498
  selectedNodeId: string;
485
499
  };
486
- /** @deprecated will be removed when dropping backward compatibility for old DND */
487
500
  type SelectComponentPayload = {
488
501
  selectedNodeId: string;
489
502
  };
490
- /** @deprecated will be removed when dropping backward compatibility for old DND */
491
503
  type HoverComponentPayload = {
492
504
  hoveredNodeId: string;
493
505
  };
@@ -502,7 +514,6 @@ type AssembliesAddedPayload = {
502
514
  type AssembliesRegisteredPayload = {
503
515
  assemblies: ComponentDefinition[];
504
516
  };
505
- /** @deprecated will be removed when dropping backward compatibility for old DND */
506
517
  type IncomingMouseMovePayload = {
507
518
  mouseX: number;
508
519
  mouseY: number;
@@ -534,12 +545,5 @@ type IncomingMessage = {
534
545
  payload: INCOMING_EVENT_PAYLOADS[K];
535
546
  };
536
547
  }[keyof INCOMING_EVENT_PAYLOADS];
537
- type StructuralEditorModeProps = {
538
- editorMode: true;
539
- node: ExperienceTreeNode;
540
- } | {
541
- editorMode?: false;
542
- };
543
- type StructureComponentProps<OtherProps> = React.PropsWithChildren<StructuralEditorModeProps & OtherProps>;
544
548
 
545
- 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, 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.39.0-alpha-20250528T1342-e28bc3d.0",
3
+ "version": "1.39.0-dev-20250528T1423-593ccdb.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.39.0-alpha-20250528T1342-e28bc3d.0",
73
+ "@contentful/experiences-validators": "1.39.0-dev-20250528T1423-593ccdb.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": "2260b6f7c1ba8064ab4e12c7817cffe6cc2cdbd5"
79
+ "gitHead": "32ef2918f32cf4ea9891ad5a27d1af2a947e3f85"
80
80
  }