@contentful/experiences-core 1.23.0-dev-20241202T2137-2facc0f.0 → 1.23.0-dev-20241203T1624-e015e2b.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
@@ -5,6 +5,22 @@ import { Document } from '@contentful/rich-text-types';
5
5
  import { ComponentDefinitionPropertyType, ComponentPropertyValue, ExperienceDataSource, ExperienceUnboundValues, Breakpoint, ExperienceComponentTree, ExperienceUsedComponents, ExperienceComponentSettings, ValuesByBreakpoint, PrimitiveValue } from '@contentful/experiences-validators';
6
6
  export { BoundValue, Breakpoint, ComponentDefinitionPropertyType as ComponentDefinitionVariableType, ComponentPropertyValue, ComponentTreeNode, ComponentValue, DesignValue, ExperienceComponentSettings, ExperienceDataSource, ExperienceUnboundValues, PrimitiveValue, SchemaVersions, UnboundValue, ValuesByBreakpoint } from '@contentful/experiences-validators';
7
7
 
8
+ type ComponentDefinitionVariableTypeMap = {
9
+ Array: unknown[];
10
+ Boolean: boolean;
11
+ Date: string;
12
+ Hyperlink: string;
13
+ Link: Record<string, unknown>;
14
+ Location: {
15
+ lon: number;
16
+ lat: number;
17
+ };
18
+ Media: Record<string, unknown> | string;
19
+ Number: number;
20
+ Object: Record<string, unknown>;
21
+ RichText: string;
22
+ Text: string;
23
+ };
8
24
  type ScrollStateKey = keyof typeof SCROLL_STATES;
9
25
  type ScrollState = (typeof SCROLL_STATES)[ScrollStateKey];
10
26
  type OutgoingEventKey = keyof typeof OUTGOING_EVENTS;
@@ -22,7 +38,7 @@ interface Link<T extends string> {
22
38
  }
23
39
  type VariableFormats = 'URL';
24
40
  type ValidationOption<T extends ComponentDefinitionPropertyType> = {
25
- value: T extends 'Text' ? string : T extends 'Number' ? number : never;
41
+ value: ComponentDefinitionVariableTypeMap[T];
26
42
  displayName?: string;
27
43
  };
28
44
  type ComponentDefinitionVariableValidation<T extends ComponentDefinitionPropertyType> = {
@@ -36,7 +52,7 @@ interface ComponentDefinitionVariableBase<T extends ComponentDefinitionPropertyT
36
52
  group?: 'style' | 'content';
37
53
  description?: string;
38
54
  displayName?: string;
39
- defaultValue?: string | boolean | number | Record<any, any>;
55
+ defaultValue?: ComponentDefinitionVariableTypeMap[T];
40
56
  }
41
57
  type ComponentDefinitionVariable<T extends ComponentDefinitionPropertyType = ComponentDefinitionPropertyType> = ComponentDefinitionVariableBase<T>;
42
58
  type ComponentDefinition<T extends ComponentDefinitionPropertyType = ComponentDefinitionPropertyType> = {
@@ -45,7 +61,7 @@ type ComponentDefinition<T extends ComponentDefinitionPropertyType = ComponentDe
45
61
  category?: string;
46
62
  thumbnailUrl?: string;
47
63
  hyperlinkPattern?: string;
48
- variables: Partial<Record<ContainerStyleVariableName, ComponentDefinitionVariable<T>>> & Record<string, ComponentDefinitionVariable<T>>;
64
+ variables: Partial<DesignVariableMap> & Record<string, ComponentDefinitionVariable<T>>;
49
65
  slots?: Record<string, {
50
66
  displayName: string;
51
67
  }>;
@@ -158,6 +174,50 @@ type StyleProps = {
158
174
  cfWrapColumns: boolean;
159
175
  cfWrapColumnsCount: string;
160
176
  };
177
+ /**
178
+ * Internally defined style variables mapped to each variable type
179
+ */
180
+ type DesignVariableTypes = {
181
+ cfVisibility: 'Boolean';
182
+ cfHorizontalAlignment: 'Text';
183
+ cfVerticalAlignment: 'Text';
184
+ cfMargin: 'Text';
185
+ cfPadding: 'Text';
186
+ cfBackgroundColor: 'Text';
187
+ cfWidth: 'Text';
188
+ cfMaxWidth: 'Text';
189
+ cfHeight: 'Text';
190
+ cfFlexDirection: 'Text';
191
+ cfFlexWrap: 'Text';
192
+ cfFlexReverse: 'Boolean';
193
+ cfBorder: 'Text';
194
+ cfBorderRadius: 'Text';
195
+ cfGap: 'Text';
196
+ cfHyperlink: 'Hyperlink';
197
+ cfImageAsset: 'Media';
198
+ cfImageOptions: 'Object';
199
+ cfBackgroundImageUrl: 'Media';
200
+ cfBackgroundImageOptions: 'Object';
201
+ cfOpenInNewTab: 'Boolean';
202
+ cfFontSize: 'Text';
203
+ cfFontWeight: 'Text';
204
+ cfLineHeight: 'Text';
205
+ cfLetterSpacing: 'Text';
206
+ cfTextColor: 'Text';
207
+ cfTextAlign: 'Text';
208
+ cfTextTransform: 'Text';
209
+ cfTextBold: 'Boolean';
210
+ cfTextItalic: 'Boolean';
211
+ cfTextUnderline: 'Boolean';
212
+ cfColumns: 'Text';
213
+ cfColumnSpan: 'Text';
214
+ cfColumnSpanLock: 'Boolean';
215
+ cfWrapColumns: 'Boolean';
216
+ cfWrapColumnsCount: 'Text';
217
+ };
218
+ type DesignVariableMap = {
219
+ [K in keyof DesignVariableTypes]: ComponentDefinitionVariable<DesignVariableTypes[K]>;
220
+ };
161
221
  type CSSProperties = React.CSSProperties;
162
222
  type ContainerStyleVariableName = keyof StyleProps;
163
223
  type ExperienceFields = {
@@ -477,4 +537,4 @@ type IncomingMessage = {
477
537
  };
478
538
  }[keyof INCOMING_EVENT_PAYLOADS];
479
539
 
480
- export type { AssembliesAddedPayload, AssembliesRegisteredPayload, BackgroundImageAlignmentOption, BackgroundImageOptions, BackgroundImageScalingOption, Binding, BindingMap, BindingMapByBlockId, BoundComponentPropertyTypes, CSSProperties, CanvasErrorPayload, CanvasReloadPayload, CanvasResizedPayload, CanvasScrollPayload, ComponentBinding, ComponentDefinition, ComponentDefinitionVariable, ComponentDefinitionVariableBase, ComponentDefinitionVariableValidation, ComponentDragCanceledPayload, ComponentDragEndedPayload, ComponentDragStartedPayload, ComponentDraggingChangedPayload, ComponentDroppedPayload, ComponentMoveEndedPayload, ComponentMoveStartedPayload, ComponentMovedPayload, ComponentRegistration, ComponentRegistrationOptions, ComponentSelectedPayload, ConnectedPayload, ContainerStyleVariableName, Coordinates, DataSourceEntryValueType, DesignTokensDefinition, DesignTokensPayload, 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 };
540
+ export type { AssembliesAddedPayload, AssembliesRegisteredPayload, BackgroundImageAlignmentOption, BackgroundImageOptions, BackgroundImageScalingOption, Binding, BindingMap, BindingMapByBlockId, BoundComponentPropertyTypes, CSSProperties, CanvasErrorPayload, CanvasReloadPayload, CanvasResizedPayload, CanvasScrollPayload, ComponentBinding, ComponentDefinition, ComponentDefinitionVariable, ComponentDefinitionVariableBase, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experiences-core",
3
- "version": "1.23.0-dev-20241202T2137-2facc0f.0",
3
+ "version": "1.23.0-dev-20241203T1624-e015e2b.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -69,11 +69,11 @@
69
69
  "vitest": "^2.1.1"
70
70
  },
71
71
  "dependencies": {
72
- "@contentful/experiences-validators": "1.23.0-dev-20241202T2137-2facc0f.0",
72
+ "@contentful/experiences-validators": "1.23.0-dev-20241203T1624-e015e2b.0",
73
73
  "@contentful/rich-text-types": "^16.3.0"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "contentful": ">=10.6.0"
77
77
  },
78
- "gitHead": "0474cc543f07b66e66210797aeb3da4e1a8aac24"
78
+ "gitHead": "60a791235c37a9450cd7e84c9e5767f8c438ae2a"
79
79
  }