@measured/puck 0.19.0-canary.32a6f78 → 0.19.0-canary.39958756

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.
@@ -22,6 +22,8 @@ type FieldOption = {
22
22
  type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
23
23
  type BaseField = {
24
24
  label?: string;
25
+ labelIcon?: ReactElement;
26
+ metadata?: Metadata;
25
27
  };
26
28
  type TextField = BaseField & {
27
29
  type: "text";
@@ -32,6 +34,7 @@ type NumberField = BaseField & {
32
34
  placeholder?: string;
33
35
  min?: number;
34
36
  max?: number;
37
+ step?: number;
35
38
  };
36
39
  type TextareaField = BaseField & {
37
40
  type: "textarea";
@@ -118,6 +121,11 @@ type CustomField<Props extends any = {}> = BaseField & {
118
121
  readOnly?: boolean;
119
122
  }) => ReactElement;
120
123
  };
124
+ type SlotField = BaseField & {
125
+ type: "slot";
126
+ allow?: string[];
127
+ disallow?: string[];
128
+ };
121
129
  type Field<Props extends any = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props extends {
122
130
  [key: string]: any;
123
131
  } ? Props : any> | ObjectField<Props extends {
@@ -126,7 +134,7 @@ type Field<Props extends any = any> = TextField | NumberField | TextareaField |
126
134
  [key: string]: any;
127
135
  } ? Props : any> | ExternalFieldWithAdaptor<Props extends {
128
136
  [key: string]: any;
129
- } ? Props : any> | CustomField<Props>;
137
+ } ? Props : any> | CustomField<Props> | SlotField;
130
138
  type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps> = {
131
139
  [PropName in keyof Omit<ComponentProps, "editMode">]: Field<ComponentProps[PropName]>;
132
140
  };
@@ -139,15 +147,20 @@ type FieldProps<F = Field<any>, ValueType = any> = {
139
147
  };
140
148
 
141
149
  type PuckComponent<Props> = (props: WithId<WithPuckProps<Props>>) => JSX.Element;
150
+ type ResolveDataTrigger = "insert" | "replace" | "load" | "force";
142
151
  type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponentProps, FieldProps extends DefaultComponentProps = RenderProps, DataShape = Omit<ComponentData<FieldProps>, "type">> = {
143
- render: PuckComponent<RenderProps>;
152
+ render: PuckComponent<{
153
+ [PropName in keyof RenderProps]: RenderProps[PropName] extends Slot ? (props?: Omit<DropZoneProps, "zone">) => ReactNode : RenderProps[PropName];
154
+ }>;
144
155
  label?: string;
145
156
  defaultProps?: FieldProps;
146
157
  fields?: Fields<FieldProps>;
147
158
  permissions?: Partial<Permissions>;
148
159
  inline?: boolean;
149
160
  resolveFields?: (data: DataShape, params: {
150
- changed: Partial<Record<keyof FieldProps, boolean>>;
161
+ changed: Partial<Record<keyof FieldProps, boolean> & {
162
+ id: string;
163
+ }>;
151
164
  fields: Fields<FieldProps>;
152
165
  lastFields: Fields<FieldProps>;
153
166
  lastData: DataShape | null;
@@ -155,9 +168,12 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
155
168
  parent: ComponentData | null;
156
169
  }) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
157
170
  resolveData?: (data: DataShape, params: {
158
- changed: Partial<Record<keyof FieldProps, boolean>>;
171
+ changed: Partial<Record<keyof FieldProps, boolean> & {
172
+ id: string;
173
+ }>;
159
174
  lastData: DataShape | null;
160
175
  metadata: Metadata;
176
+ trigger: ResolveDataTrigger;
161
177
  }) => Promise<{
162
178
  props?: Partial<FieldProps>;
163
179
  readOnly?: Partial<Record<keyof FieldProps, boolean>>;
@@ -166,13 +182,17 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
166
182
  readOnly?: Partial<Record<keyof FieldProps, boolean>>;
167
183
  };
168
184
  resolvePermissions?: (data: DataShape, params: {
169
- changed: Partial<Record<keyof FieldProps, boolean>>;
185
+ changed: Partial<Record<keyof FieldProps, boolean> & {
186
+ id: string;
187
+ }>;
170
188
  lastPermissions: Partial<Permissions>;
171
189
  permissions: Partial<Permissions>;
172
190
  appState: AppState;
173
191
  lastData: DataShape | null;
174
192
  }) => Promise<Partial<Permissions>> | Partial<Permissions>;
193
+ metadata?: Metadata;
175
194
  };
195
+ type RootConfig<RootProps extends DefaultComponentProps = any> = Partial<ComponentConfig<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
176
196
  type Category<ComponentName> = {
177
197
  components?: ComponentName[];
178
198
  title?: string;
@@ -186,7 +206,7 @@ type Config<Props extends DefaultComponentProps = DefaultComponentProps, RootPro
186
206
  components: {
187
207
  [ComponentName in keyof Props]: Omit<ComponentConfig<Props[ComponentName], Props[ComponentName]>, "type">;
188
208
  };
189
- root?: Partial<ComponentConfig<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
209
+ root?: RootConfig<RootProps>;
190
210
  };
191
211
 
192
212
  type WithId<Props> = Props & {
@@ -202,7 +222,7 @@ type WithChildren<Props> = Props & {
202
222
  };
203
223
  type ExtractPropsFromConfig<UserConfig> = UserConfig extends Config<infer P, any, any> ? P : never;
204
224
  type ExtractRootPropsFromConfig<UserConfig> = UserConfig extends Config<any, infer P, any> ? P : never;
205
- type UserGenerics<UserConfig extends Config = Config, UserProps extends ExtractPropsFromConfig<UserConfig> = ExtractPropsFromConfig<UserConfig>, UserRootProps extends ExtractRootPropsFromConfig<UserConfig> = ExtractRootPropsFromConfig<UserConfig>, UserData extends Data<UserProps, UserRootProps> | Data = Data<UserProps, UserRootProps>, UserAppState extends AppState<UserData> = AppState<UserData>, UserComponentData extends ComponentData = UserData["content"][0]> = {
225
+ type UserGenerics<UserConfig extends Config = Config, UserProps extends ExtractPropsFromConfig<UserConfig> = ExtractPropsFromConfig<UserConfig>, UserRootProps extends ExtractRootPropsFromConfig<UserConfig> = ExtractRootPropsFromConfig<UserConfig>, UserData extends Data<UserProps, UserRootProps> | Data = Data<UserProps, UserRootProps>, UserAppState extends PrivateAppState<UserData> = PrivateAppState<UserData>, UserComponentData extends ComponentData = UserData["content"][0]> = {
206
226
  UserConfig: UserConfig;
207
227
  UserProps: UserProps;
208
228
  UserRootProps: UserRootProps;
@@ -298,6 +318,27 @@ type AppState<UserData extends Data = Data> = {
298
318
  ui: UiState;
299
319
  };
300
320
 
321
+ type ZoneType = "root" | "dropzone" | "slot";
322
+ type PuckNodeData = {
323
+ data: ComponentData;
324
+ flatData: ComponentData;
325
+ parentId: string | null;
326
+ zone: string;
327
+ path: string[];
328
+ };
329
+ type PuckZoneData = {
330
+ contentIds: string[];
331
+ type: ZoneType;
332
+ };
333
+ type NodeIndex = Record<string, PuckNodeData>;
334
+ type ZoneIndex = Record<string, PuckZoneData>;
335
+ type PrivateAppState<UserData extends Data = Data> = AppState<UserData> & {
336
+ indexes: {
337
+ nodes: NodeIndex;
338
+ zones: ZoneIndex;
339
+ };
340
+ };
341
+
301
342
  type RenderFunc<Props extends {
302
343
  [key: string]: any;
303
344
  } = {
@@ -404,6 +445,7 @@ type InitialHistoryNoAppend<AS = Partial<AppState>> = {
404
445
  appendData?: false;
405
446
  };
406
447
  type InitialHistory<AS = Partial<AppState>> = InitialHistoryAppend<AS> | InitialHistoryNoAppend<AS>;
448
+ type Slot = Content;
407
449
 
408
450
  type InsertAction = {
409
451
  type: "insert";
@@ -417,11 +459,17 @@ type DuplicateAction = {
417
459
  sourceIndex: number;
418
460
  sourceZone: string;
419
461
  };
420
- type ReplaceAction = {
462
+ type ReplaceAction<UserData extends Data = Data> = {
421
463
  type: "replace";
422
464
  destinationIndex: number;
423
465
  destinationZone: string;
424
- data: any;
466
+ data: ComponentData;
467
+ ui?: Partial<AppState<UserData>["ui"]>;
468
+ };
469
+ type ReplaceRootAction<UserData extends Data = Data> = {
470
+ type: "replaceRoot";
471
+ root: RootData;
472
+ ui?: Partial<AppState<UserData>["ui"]>;
425
473
  };
426
474
  type ReorderAction = {
427
475
  type: "reorder";
@@ -451,7 +499,7 @@ type SetDataAction = {
451
499
  };
452
500
  type SetAction<UserData extends Data = Data> = {
453
501
  type: "set";
454
- state: Partial<AppState<UserData>> | ((previous: AppState<UserData>) => Partial<AppState<UserData>>);
502
+ state: Partial<PrivateAppState<UserData>> | ((previous: PrivateAppState<UserData>) => Partial<PrivateAppState<UserData>>);
455
503
  };
456
504
  type RegisterZoneAction = {
457
505
  type: "registerZone";
@@ -463,8 +511,19 @@ type UnregisterZoneAction = {
463
511
  };
464
512
  type PuckAction = {
465
513
  recordHistory?: boolean;
466
- } & (ReorderAction | InsertAction | MoveAction | ReplaceAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
514
+ } & (ReorderAction | InsertAction | MoveAction | ReplaceAction | ReplaceRootAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
515
+
516
+ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
517
+ [ComponentName in keyof Props]: (props: Props[ComponentName] & {
518
+ [key: string]: any;
519
+ }) => Props[ComponentName];
520
+ } & {
521
+ root: (props: RootProps & {
522
+ [key: string]: any;
523
+ }) => RootProps;
524
+ }>;
525
+ declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
467
526
 
468
527
  declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, metadata?: Metadata, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
469
528
 
470
- export { type PuckContext as $, type AppState as A, type BaseData as B, type Config as C, type DropZoneProps as D, type ExtractPropsFromConfig as E, type FieldProps as F, type BaseField as G, type History as H, type IframeConfig as I, type TextareaField as J, type RadioField as K, type ArrayField as L, type Metadata as M, type NumberField as N, type OnAction as O, type Permissions as P, type ObjectField as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type Adaptor as W, type ExternalFieldWithAdaptor as X, type ExternalField as Y, type CustomField as Z, type Fields as _, type Field as a, type DefaultRootRenderProps as a0, type DefaultRootProps as a1, type WithId as a2, type WithPuckProps as a3, type AsFieldProps as a4, type WithChildren as a5, resolveAllData as a6, type Data as b, type UiState as c, type Plugin as d, type Overrides as e, type PuckAction as f, type InitialHistory as g, type DefaultComponentProps as h, type DefaultRootFieldProps as i, type ExtractRootPropsFromConfig as j, type ComponentDataMap as k, type Direction as l, type DragAxis as m, type Viewport as n, overrideKeys as o, type OverrideKey as p, type FieldRenderFunctions as q, type ItemWithId as r, type ArrayState as s, type PuckComponent as t, type ComponentConfig as u, type RootDataWithoutProps as v, type RootData as w, type ComponentData as x, type MappedItem as y, type Content as z };
529
+ export { type SlotField as $, type AppState as A, type BaseData as B, type ComponentData as C, type DropZoneProps as D, type ComponentDataMap as E, type Fields as F, type BaseField as G, type History as H, type IframeConfig as I, type TextareaField as J, type SelectField as K, type RadioField as L, type Metadata as M, type NumberField as N, type Overrides as O, type Permissions as P, type ArrayField as Q, type RootDataWithProps as R, type Slot as S, type TextField as T, type UserGenerics as U, type Viewports as V, type ObjectField as W, type Adaptor as X, type ExternalFieldWithAdaptor as Y, type ExternalField as Z, type CustomField as _, type Config as a, type PuckContext as a0, type DefaultRootFieldProps as a1, type DefaultRootRenderProps as a2, type DefaultRootProps as a3, type DefaultComponentProps as a4, type WithId as a5, type WithPuckProps as a6, type AsFieldProps as a7, type WithChildren as a8, type ExtractPropsFromConfig as a9, type ExtractRootPropsFromConfig as aa, transformProps as ab, resolveAllData as ac, type PuckAction as b, type ResolveDataTrigger as c, type Plugin as d, type UiState as e, type ComponentConfig as f, type Field as g, type FieldProps as h, type Data as i, type OnAction as j, type InitialHistory as k, type RootData as l, type Content as m, type ItemSelector as n, type Direction as o, type DragAxis as p, type Viewport as q, overrideKeys as r, type OverrideKey as s, type FieldRenderFunctions as t, type ItemWithId as u, type ArrayState as v, type PuckComponent as w, type RootConfig as x, type RootDataWithoutProps as y, type MappedItem as z };
@@ -22,6 +22,8 @@ type FieldOption = {
22
22
  type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
23
23
  type BaseField = {
24
24
  label?: string;
25
+ labelIcon?: ReactElement;
26
+ metadata?: Metadata;
25
27
  };
26
28
  type TextField = BaseField & {
27
29
  type: "text";
@@ -32,6 +34,7 @@ type NumberField = BaseField & {
32
34
  placeholder?: string;
33
35
  min?: number;
34
36
  max?: number;
37
+ step?: number;
35
38
  };
36
39
  type TextareaField = BaseField & {
37
40
  type: "textarea";
@@ -118,6 +121,11 @@ type CustomField<Props extends any = {}> = BaseField & {
118
121
  readOnly?: boolean;
119
122
  }) => ReactElement;
120
123
  };
124
+ type SlotField = BaseField & {
125
+ type: "slot";
126
+ allow?: string[];
127
+ disallow?: string[];
128
+ };
121
129
  type Field<Props extends any = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props extends {
122
130
  [key: string]: any;
123
131
  } ? Props : any> | ObjectField<Props extends {
@@ -126,7 +134,7 @@ type Field<Props extends any = any> = TextField | NumberField | TextareaField |
126
134
  [key: string]: any;
127
135
  } ? Props : any> | ExternalFieldWithAdaptor<Props extends {
128
136
  [key: string]: any;
129
- } ? Props : any> | CustomField<Props>;
137
+ } ? Props : any> | CustomField<Props> | SlotField;
130
138
  type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps> = {
131
139
  [PropName in keyof Omit<ComponentProps, "editMode">]: Field<ComponentProps[PropName]>;
132
140
  };
@@ -139,15 +147,20 @@ type FieldProps<F = Field<any>, ValueType = any> = {
139
147
  };
140
148
 
141
149
  type PuckComponent<Props> = (props: WithId<WithPuckProps<Props>>) => JSX.Element;
150
+ type ResolveDataTrigger = "insert" | "replace" | "load" | "force";
142
151
  type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponentProps, FieldProps extends DefaultComponentProps = RenderProps, DataShape = Omit<ComponentData<FieldProps>, "type">> = {
143
- render: PuckComponent<RenderProps>;
152
+ render: PuckComponent<{
153
+ [PropName in keyof RenderProps]: RenderProps[PropName] extends Slot ? (props?: Omit<DropZoneProps, "zone">) => ReactNode : RenderProps[PropName];
154
+ }>;
144
155
  label?: string;
145
156
  defaultProps?: FieldProps;
146
157
  fields?: Fields<FieldProps>;
147
158
  permissions?: Partial<Permissions>;
148
159
  inline?: boolean;
149
160
  resolveFields?: (data: DataShape, params: {
150
- changed: Partial<Record<keyof FieldProps, boolean>>;
161
+ changed: Partial<Record<keyof FieldProps, boolean> & {
162
+ id: string;
163
+ }>;
151
164
  fields: Fields<FieldProps>;
152
165
  lastFields: Fields<FieldProps>;
153
166
  lastData: DataShape | null;
@@ -155,9 +168,12 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
155
168
  parent: ComponentData | null;
156
169
  }) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
157
170
  resolveData?: (data: DataShape, params: {
158
- changed: Partial<Record<keyof FieldProps, boolean>>;
171
+ changed: Partial<Record<keyof FieldProps, boolean> & {
172
+ id: string;
173
+ }>;
159
174
  lastData: DataShape | null;
160
175
  metadata: Metadata;
176
+ trigger: ResolveDataTrigger;
161
177
  }) => Promise<{
162
178
  props?: Partial<FieldProps>;
163
179
  readOnly?: Partial<Record<keyof FieldProps, boolean>>;
@@ -166,13 +182,17 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
166
182
  readOnly?: Partial<Record<keyof FieldProps, boolean>>;
167
183
  };
168
184
  resolvePermissions?: (data: DataShape, params: {
169
- changed: Partial<Record<keyof FieldProps, boolean>>;
185
+ changed: Partial<Record<keyof FieldProps, boolean> & {
186
+ id: string;
187
+ }>;
170
188
  lastPermissions: Partial<Permissions>;
171
189
  permissions: Partial<Permissions>;
172
190
  appState: AppState;
173
191
  lastData: DataShape | null;
174
192
  }) => Promise<Partial<Permissions>> | Partial<Permissions>;
193
+ metadata?: Metadata;
175
194
  };
195
+ type RootConfig<RootProps extends DefaultComponentProps = any> = Partial<ComponentConfig<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
176
196
  type Category<ComponentName> = {
177
197
  components?: ComponentName[];
178
198
  title?: string;
@@ -186,7 +206,7 @@ type Config<Props extends DefaultComponentProps = DefaultComponentProps, RootPro
186
206
  components: {
187
207
  [ComponentName in keyof Props]: Omit<ComponentConfig<Props[ComponentName], Props[ComponentName]>, "type">;
188
208
  };
189
- root?: Partial<ComponentConfig<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
209
+ root?: RootConfig<RootProps>;
190
210
  };
191
211
 
192
212
  type WithId<Props> = Props & {
@@ -202,7 +222,7 @@ type WithChildren<Props> = Props & {
202
222
  };
203
223
  type ExtractPropsFromConfig<UserConfig> = UserConfig extends Config<infer P, any, any> ? P : never;
204
224
  type ExtractRootPropsFromConfig<UserConfig> = UserConfig extends Config<any, infer P, any> ? P : never;
205
- type UserGenerics<UserConfig extends Config = Config, UserProps extends ExtractPropsFromConfig<UserConfig> = ExtractPropsFromConfig<UserConfig>, UserRootProps extends ExtractRootPropsFromConfig<UserConfig> = ExtractRootPropsFromConfig<UserConfig>, UserData extends Data<UserProps, UserRootProps> | Data = Data<UserProps, UserRootProps>, UserAppState extends AppState<UserData> = AppState<UserData>, UserComponentData extends ComponentData = UserData["content"][0]> = {
225
+ type UserGenerics<UserConfig extends Config = Config, UserProps extends ExtractPropsFromConfig<UserConfig> = ExtractPropsFromConfig<UserConfig>, UserRootProps extends ExtractRootPropsFromConfig<UserConfig> = ExtractRootPropsFromConfig<UserConfig>, UserData extends Data<UserProps, UserRootProps> | Data = Data<UserProps, UserRootProps>, UserAppState extends PrivateAppState<UserData> = PrivateAppState<UserData>, UserComponentData extends ComponentData = UserData["content"][0]> = {
206
226
  UserConfig: UserConfig;
207
227
  UserProps: UserProps;
208
228
  UserRootProps: UserRootProps;
@@ -298,6 +318,27 @@ type AppState<UserData extends Data = Data> = {
298
318
  ui: UiState;
299
319
  };
300
320
 
321
+ type ZoneType = "root" | "dropzone" | "slot";
322
+ type PuckNodeData = {
323
+ data: ComponentData;
324
+ flatData: ComponentData;
325
+ parentId: string | null;
326
+ zone: string;
327
+ path: string[];
328
+ };
329
+ type PuckZoneData = {
330
+ contentIds: string[];
331
+ type: ZoneType;
332
+ };
333
+ type NodeIndex = Record<string, PuckNodeData>;
334
+ type ZoneIndex = Record<string, PuckZoneData>;
335
+ type PrivateAppState<UserData extends Data = Data> = AppState<UserData> & {
336
+ indexes: {
337
+ nodes: NodeIndex;
338
+ zones: ZoneIndex;
339
+ };
340
+ };
341
+
301
342
  type RenderFunc<Props extends {
302
343
  [key: string]: any;
303
344
  } = {
@@ -404,6 +445,7 @@ type InitialHistoryNoAppend<AS = Partial<AppState>> = {
404
445
  appendData?: false;
405
446
  };
406
447
  type InitialHistory<AS = Partial<AppState>> = InitialHistoryAppend<AS> | InitialHistoryNoAppend<AS>;
448
+ type Slot = Content;
407
449
 
408
450
  type InsertAction = {
409
451
  type: "insert";
@@ -417,11 +459,17 @@ type DuplicateAction = {
417
459
  sourceIndex: number;
418
460
  sourceZone: string;
419
461
  };
420
- type ReplaceAction = {
462
+ type ReplaceAction<UserData extends Data = Data> = {
421
463
  type: "replace";
422
464
  destinationIndex: number;
423
465
  destinationZone: string;
424
- data: any;
466
+ data: ComponentData;
467
+ ui?: Partial<AppState<UserData>["ui"]>;
468
+ };
469
+ type ReplaceRootAction<UserData extends Data = Data> = {
470
+ type: "replaceRoot";
471
+ root: RootData;
472
+ ui?: Partial<AppState<UserData>["ui"]>;
425
473
  };
426
474
  type ReorderAction = {
427
475
  type: "reorder";
@@ -451,7 +499,7 @@ type SetDataAction = {
451
499
  };
452
500
  type SetAction<UserData extends Data = Data> = {
453
501
  type: "set";
454
- state: Partial<AppState<UserData>> | ((previous: AppState<UserData>) => Partial<AppState<UserData>>);
502
+ state: Partial<PrivateAppState<UserData>> | ((previous: PrivateAppState<UserData>) => Partial<PrivateAppState<UserData>>);
455
503
  };
456
504
  type RegisterZoneAction = {
457
505
  type: "registerZone";
@@ -463,8 +511,19 @@ type UnregisterZoneAction = {
463
511
  };
464
512
  type PuckAction = {
465
513
  recordHistory?: boolean;
466
- } & (ReorderAction | InsertAction | MoveAction | ReplaceAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
514
+ } & (ReorderAction | InsertAction | MoveAction | ReplaceAction | ReplaceRootAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
515
+
516
+ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
517
+ [ComponentName in keyof Props]: (props: Props[ComponentName] & {
518
+ [key: string]: any;
519
+ }) => Props[ComponentName];
520
+ } & {
521
+ root: (props: RootProps & {
522
+ [key: string]: any;
523
+ }) => RootProps;
524
+ }>;
525
+ declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
467
526
 
468
527
  declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, metadata?: Metadata, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
469
528
 
470
- export { type PuckContext as $, type AppState as A, type BaseData as B, type Config as C, type DropZoneProps as D, type ExtractPropsFromConfig as E, type FieldProps as F, type BaseField as G, type History as H, type IframeConfig as I, type TextareaField as J, type RadioField as K, type ArrayField as L, type Metadata as M, type NumberField as N, type OnAction as O, type Permissions as P, type ObjectField as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type Adaptor as W, type ExternalFieldWithAdaptor as X, type ExternalField as Y, type CustomField as Z, type Fields as _, type Field as a, type DefaultRootRenderProps as a0, type DefaultRootProps as a1, type WithId as a2, type WithPuckProps as a3, type AsFieldProps as a4, type WithChildren as a5, resolveAllData as a6, type Data as b, type UiState as c, type Plugin as d, type Overrides as e, type PuckAction as f, type InitialHistory as g, type DefaultComponentProps as h, type DefaultRootFieldProps as i, type ExtractRootPropsFromConfig as j, type ComponentDataMap as k, type Direction as l, type DragAxis as m, type Viewport as n, overrideKeys as o, type OverrideKey as p, type FieldRenderFunctions as q, type ItemWithId as r, type ArrayState as s, type PuckComponent as t, type ComponentConfig as u, type RootDataWithoutProps as v, type RootData as w, type ComponentData as x, type MappedItem as y, type Content as z };
529
+ export { type SlotField as $, type AppState as A, type BaseData as B, type ComponentData as C, type DropZoneProps as D, type ComponentDataMap as E, type Fields as F, type BaseField as G, type History as H, type IframeConfig as I, type TextareaField as J, type SelectField as K, type RadioField as L, type Metadata as M, type NumberField as N, type Overrides as O, type Permissions as P, type ArrayField as Q, type RootDataWithProps as R, type Slot as S, type TextField as T, type UserGenerics as U, type Viewports as V, type ObjectField as W, type Adaptor as X, type ExternalFieldWithAdaptor as Y, type ExternalField as Z, type CustomField as _, type Config as a, type PuckContext as a0, type DefaultRootFieldProps as a1, type DefaultRootRenderProps as a2, type DefaultRootProps as a3, type DefaultComponentProps as a4, type WithId as a5, type WithPuckProps as a6, type AsFieldProps as a7, type WithChildren as a8, type ExtractPropsFromConfig as a9, type ExtractRootPropsFromConfig as aa, transformProps as ab, resolveAllData as ac, type PuckAction as b, type ResolveDataTrigger as c, type Plugin as d, type UiState as e, type ComponentConfig as f, type Field as g, type FieldProps as h, type Data as i, type OnAction as j, type InitialHistory as k, type RootData as l, type Content as m, type ItemSelector as n, type Direction as o, type DragAxis as p, type Viewport as q, overrideKeys as r, type OverrideKey as s, type FieldRenderFunctions as t, type ItemWithId as u, type ArrayState as v, type PuckComponent as w, type RootConfig as x, type RootDataWithoutProps as y, type MappedItem as z };