@measured/puck 0.19.0-canary.b9add22 → 0.19.0-canary.c79f5db8

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,17 +22,23 @@ 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";
30
+ placeholder?: string;
28
31
  };
29
32
  type NumberField = BaseField & {
30
33
  type: "number";
34
+ placeholder?: string;
31
35
  min?: number;
32
36
  max?: number;
37
+ step?: number;
33
38
  };
34
39
  type TextareaField = BaseField & {
35
40
  type: "textarea";
41
+ placeholder?: string;
36
42
  };
37
43
  type SelectField = BaseField & {
38
44
  type: "select";
@@ -115,6 +121,11 @@ type CustomField<Props extends any = {}> = BaseField & {
115
121
  readOnly?: boolean;
116
122
  }) => ReactElement;
117
123
  };
124
+ type SlotField = BaseField & {
125
+ type: "slot";
126
+ allow?: string[];
127
+ disallow?: string[];
128
+ };
118
129
  type Field<Props extends any = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props extends {
119
130
  [key: string]: any;
120
131
  } ? Props : any> | ObjectField<Props extends {
@@ -123,7 +134,7 @@ type Field<Props extends any = any> = TextField | NumberField | TextareaField |
123
134
  [key: string]: any;
124
135
  } ? Props : any> | ExternalFieldWithAdaptor<Props extends {
125
136
  [key: string]: any;
126
- } ? Props : any> | CustomField<Props>;
137
+ } ? Props : any> | CustomField<Props> | SlotField;
127
138
  type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps> = {
128
139
  [PropName in keyof Omit<ComponentProps, "editMode">]: Field<ComponentProps[PropName]>;
129
140
  };
@@ -136,15 +147,20 @@ type FieldProps<F = Field<any>, ValueType = any> = {
136
147
  };
137
148
 
138
149
  type PuckComponent<Props> = (props: WithId<WithPuckProps<Props>>) => JSX.Element;
150
+ type ResolveDataTrigger = "insert" | "replace" | "load" | "force";
139
151
  type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponentProps, FieldProps extends DefaultComponentProps = RenderProps, DataShape = Omit<ComponentData<FieldProps>, "type">> = {
140
- render: PuckComponent<RenderProps>;
152
+ render: PuckComponent<{
153
+ [PropName in keyof RenderProps]: RenderProps[PropName] extends Slot ? (props?: Omit<DropZoneProps, "zone">) => ReactNode : RenderProps[PropName];
154
+ }>;
141
155
  label?: string;
142
156
  defaultProps?: FieldProps;
143
157
  fields?: Fields<FieldProps>;
144
158
  permissions?: Partial<Permissions>;
145
159
  inline?: boolean;
146
160
  resolveFields?: (data: DataShape, params: {
147
- changed: Partial<Record<keyof FieldProps, boolean>>;
161
+ changed: Partial<Record<keyof FieldProps, boolean> & {
162
+ id: string;
163
+ }>;
148
164
  fields: Fields<FieldProps>;
149
165
  lastFields: Fields<FieldProps>;
150
166
  lastData: DataShape | null;
@@ -152,9 +168,12 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
152
168
  parent: ComponentData | null;
153
169
  }) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
154
170
  resolveData?: (data: DataShape, params: {
155
- changed: Partial<Record<keyof FieldProps, boolean>>;
171
+ changed: Partial<Record<keyof FieldProps, boolean> & {
172
+ id: string;
173
+ }>;
156
174
  lastData: DataShape | null;
157
175
  metadata: Metadata;
176
+ trigger: ResolveDataTrigger;
158
177
  }) => Promise<{
159
178
  props?: Partial<FieldProps>;
160
179
  readOnly?: Partial<Record<keyof FieldProps, boolean>>;
@@ -163,13 +182,17 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
163
182
  readOnly?: Partial<Record<keyof FieldProps, boolean>>;
164
183
  };
165
184
  resolvePermissions?: (data: DataShape, params: {
166
- changed: Partial<Record<keyof FieldProps, boolean>>;
185
+ changed: Partial<Record<keyof FieldProps, boolean> & {
186
+ id: string;
187
+ }>;
167
188
  lastPermissions: Partial<Permissions>;
168
189
  permissions: Partial<Permissions>;
169
190
  appState: AppState;
170
191
  lastData: DataShape | null;
171
192
  }) => Promise<Partial<Permissions>> | Partial<Permissions>;
193
+ metadata?: Metadata;
172
194
  };
195
+ type RootConfig<RootProps extends DefaultComponentProps = any> = Partial<ComponentConfig<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
173
196
  type Category<ComponentName> = {
174
197
  components?: ComponentName[];
175
198
  title?: string;
@@ -183,7 +206,7 @@ type Config<Props extends DefaultComponentProps = DefaultComponentProps, RootPro
183
206
  components: {
184
207
  [ComponentName in keyof Props]: Omit<ComponentConfig<Props[ComponentName], Props[ComponentName]>, "type">;
185
208
  };
186
- root?: Partial<ComponentConfig<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
209
+ root?: RootConfig<RootProps>;
187
210
  };
188
211
 
189
212
  type WithId<Props> = Props & {
@@ -199,7 +222,7 @@ type WithChildren<Props> = Props & {
199
222
  };
200
223
  type ExtractPropsFromConfig<UserConfig> = UserConfig extends Config<infer P, any, any> ? P : never;
201
224
  type ExtractRootPropsFromConfig<UserConfig> = UserConfig extends Config<any, infer P, any> ? P : never;
202
- 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]> = {
203
226
  UserConfig: UserConfig;
204
227
  UserProps: UserProps;
205
228
  UserRootProps: UserRootProps;
@@ -295,6 +318,27 @@ type AppState<UserData extends Data = Data> = {
295
318
  ui: UiState;
296
319
  };
297
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
+
298
342
  type RenderFunc<Props extends {
299
343
  [key: string]: any;
300
344
  } = {
@@ -401,6 +445,7 @@ type InitialHistoryNoAppend<AS = Partial<AppState>> = {
401
445
  appendData?: false;
402
446
  };
403
447
  type InitialHistory<AS = Partial<AppState>> = InitialHistoryAppend<AS> | InitialHistoryNoAppend<AS>;
448
+ type Slot = Content;
404
449
 
405
450
  type InsertAction = {
406
451
  type: "insert";
@@ -414,11 +459,17 @@ type DuplicateAction = {
414
459
  sourceIndex: number;
415
460
  sourceZone: string;
416
461
  };
417
- type ReplaceAction = {
462
+ type ReplaceAction<UserData extends Data = Data> = {
418
463
  type: "replace";
419
464
  destinationIndex: number;
420
465
  destinationZone: string;
421
- 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"]>;
422
473
  };
423
474
  type ReorderAction = {
424
475
  type: "reorder";
@@ -448,7 +499,7 @@ type SetDataAction = {
448
499
  };
449
500
  type SetAction<UserData extends Data = Data> = {
450
501
  type: "set";
451
- state: Partial<AppState<UserData>> | ((previous: AppState<UserData>) => Partial<AppState<UserData>>);
502
+ state: Partial<PrivateAppState<UserData>> | ((previous: PrivateAppState<UserData>) => Partial<PrivateAppState<UserData>>);
452
503
  };
453
504
  type RegisterZoneAction = {
454
505
  type: "registerZone";
@@ -460,8 +511,19 @@ type UnregisterZoneAction = {
460
511
  };
461
512
  type PuckAction = {
462
513
  recordHistory?: boolean;
463
- } & (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;
464
526
 
465
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>>;
466
528
 
467
- 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,17 +22,23 @@ 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";
30
+ placeholder?: string;
28
31
  };
29
32
  type NumberField = BaseField & {
30
33
  type: "number";
34
+ placeholder?: string;
31
35
  min?: number;
32
36
  max?: number;
37
+ step?: number;
33
38
  };
34
39
  type TextareaField = BaseField & {
35
40
  type: "textarea";
41
+ placeholder?: string;
36
42
  };
37
43
  type SelectField = BaseField & {
38
44
  type: "select";
@@ -115,6 +121,11 @@ type CustomField<Props extends any = {}> = BaseField & {
115
121
  readOnly?: boolean;
116
122
  }) => ReactElement;
117
123
  };
124
+ type SlotField = BaseField & {
125
+ type: "slot";
126
+ allow?: string[];
127
+ disallow?: string[];
128
+ };
118
129
  type Field<Props extends any = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props extends {
119
130
  [key: string]: any;
120
131
  } ? Props : any> | ObjectField<Props extends {
@@ -123,7 +134,7 @@ type Field<Props extends any = any> = TextField | NumberField | TextareaField |
123
134
  [key: string]: any;
124
135
  } ? Props : any> | ExternalFieldWithAdaptor<Props extends {
125
136
  [key: string]: any;
126
- } ? Props : any> | CustomField<Props>;
137
+ } ? Props : any> | CustomField<Props> | SlotField;
127
138
  type Fields<ComponentProps extends DefaultComponentProps = DefaultComponentProps> = {
128
139
  [PropName in keyof Omit<ComponentProps, "editMode">]: Field<ComponentProps[PropName]>;
129
140
  };
@@ -136,15 +147,20 @@ type FieldProps<F = Field<any>, ValueType = any> = {
136
147
  };
137
148
 
138
149
  type PuckComponent<Props> = (props: WithId<WithPuckProps<Props>>) => JSX.Element;
150
+ type ResolveDataTrigger = "insert" | "replace" | "load" | "force";
139
151
  type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponentProps, FieldProps extends DefaultComponentProps = RenderProps, DataShape = Omit<ComponentData<FieldProps>, "type">> = {
140
- render: PuckComponent<RenderProps>;
152
+ render: PuckComponent<{
153
+ [PropName in keyof RenderProps]: RenderProps[PropName] extends Slot ? (props?: Omit<DropZoneProps, "zone">) => ReactNode : RenderProps[PropName];
154
+ }>;
141
155
  label?: string;
142
156
  defaultProps?: FieldProps;
143
157
  fields?: Fields<FieldProps>;
144
158
  permissions?: Partial<Permissions>;
145
159
  inline?: boolean;
146
160
  resolveFields?: (data: DataShape, params: {
147
- changed: Partial<Record<keyof FieldProps, boolean>>;
161
+ changed: Partial<Record<keyof FieldProps, boolean> & {
162
+ id: string;
163
+ }>;
148
164
  fields: Fields<FieldProps>;
149
165
  lastFields: Fields<FieldProps>;
150
166
  lastData: DataShape | null;
@@ -152,9 +168,12 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
152
168
  parent: ComponentData | null;
153
169
  }) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
154
170
  resolveData?: (data: DataShape, params: {
155
- changed: Partial<Record<keyof FieldProps, boolean>>;
171
+ changed: Partial<Record<keyof FieldProps, boolean> & {
172
+ id: string;
173
+ }>;
156
174
  lastData: DataShape | null;
157
175
  metadata: Metadata;
176
+ trigger: ResolveDataTrigger;
158
177
  }) => Promise<{
159
178
  props?: Partial<FieldProps>;
160
179
  readOnly?: Partial<Record<keyof FieldProps, boolean>>;
@@ -163,13 +182,17 @@ type ComponentConfig<RenderProps extends DefaultComponentProps = DefaultComponen
163
182
  readOnly?: Partial<Record<keyof FieldProps, boolean>>;
164
183
  };
165
184
  resolvePermissions?: (data: DataShape, params: {
166
- changed: Partial<Record<keyof FieldProps, boolean>>;
185
+ changed: Partial<Record<keyof FieldProps, boolean> & {
186
+ id: string;
187
+ }>;
167
188
  lastPermissions: Partial<Permissions>;
168
189
  permissions: Partial<Permissions>;
169
190
  appState: AppState;
170
191
  lastData: DataShape | null;
171
192
  }) => Promise<Partial<Permissions>> | Partial<Permissions>;
193
+ metadata?: Metadata;
172
194
  };
195
+ type RootConfig<RootProps extends DefaultComponentProps = any> = Partial<ComponentConfig<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
173
196
  type Category<ComponentName> = {
174
197
  components?: ComponentName[];
175
198
  title?: string;
@@ -183,7 +206,7 @@ type Config<Props extends DefaultComponentProps = DefaultComponentProps, RootPro
183
206
  components: {
184
207
  [ComponentName in keyof Props]: Omit<ComponentConfig<Props[ComponentName], Props[ComponentName]>, "type">;
185
208
  };
186
- root?: Partial<ComponentConfig<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>>>;
209
+ root?: RootConfig<RootProps>;
187
210
  };
188
211
 
189
212
  type WithId<Props> = Props & {
@@ -199,7 +222,7 @@ type WithChildren<Props> = Props & {
199
222
  };
200
223
  type ExtractPropsFromConfig<UserConfig> = UserConfig extends Config<infer P, any, any> ? P : never;
201
224
  type ExtractRootPropsFromConfig<UserConfig> = UserConfig extends Config<any, infer P, any> ? P : never;
202
- 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]> = {
203
226
  UserConfig: UserConfig;
204
227
  UserProps: UserProps;
205
228
  UserRootProps: UserRootProps;
@@ -295,6 +318,27 @@ type AppState<UserData extends Data = Data> = {
295
318
  ui: UiState;
296
319
  };
297
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
+
298
342
  type RenderFunc<Props extends {
299
343
  [key: string]: any;
300
344
  } = {
@@ -401,6 +445,7 @@ type InitialHistoryNoAppend<AS = Partial<AppState>> = {
401
445
  appendData?: false;
402
446
  };
403
447
  type InitialHistory<AS = Partial<AppState>> = InitialHistoryAppend<AS> | InitialHistoryNoAppend<AS>;
448
+ type Slot = Content;
404
449
 
405
450
  type InsertAction = {
406
451
  type: "insert";
@@ -414,11 +459,17 @@ type DuplicateAction = {
414
459
  sourceIndex: number;
415
460
  sourceZone: string;
416
461
  };
417
- type ReplaceAction = {
462
+ type ReplaceAction<UserData extends Data = Data> = {
418
463
  type: "replace";
419
464
  destinationIndex: number;
420
465
  destinationZone: string;
421
- 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"]>;
422
473
  };
423
474
  type ReorderAction = {
424
475
  type: "reorder";
@@ -448,7 +499,7 @@ type SetDataAction = {
448
499
  };
449
500
  type SetAction<UserData extends Data = Data> = {
450
501
  type: "set";
451
- state: Partial<AppState<UserData>> | ((previous: AppState<UserData>) => Partial<AppState<UserData>>);
502
+ state: Partial<PrivateAppState<UserData>> | ((previous: PrivateAppState<UserData>) => Partial<PrivateAppState<UserData>>);
452
503
  };
453
504
  type RegisterZoneAction = {
454
505
  type: "registerZone";
@@ -460,8 +511,19 @@ type UnregisterZoneAction = {
460
511
  };
461
512
  type PuckAction = {
462
513
  recordHistory?: boolean;
463
- } & (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;
464
526
 
465
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>>;
466
528
 
467
- 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 };