@measured/puck 0.18.3-canary.78bb71d → 0.18.3-canary.9de70d3

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.
@@ -91,6 +91,49 @@ var init_react_import = __esm({
91
91
  }
92
92
  });
93
93
 
94
+ // lib/transform-props.ts
95
+ init_react_import();
96
+
97
+ // lib/default-data.ts
98
+ init_react_import();
99
+ var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
100
+ root: data.root || {},
101
+ content: data.content || []
102
+ });
103
+
104
+ // lib/transform-props.ts
105
+ function transformProps(data, propTransforms) {
106
+ const mapItem = (item) => {
107
+ if (propTransforms[item.type]) {
108
+ return __spreadProps(__spreadValues({}, item), {
109
+ props: propTransforms[item.type](item.props)
110
+ });
111
+ }
112
+ return item;
113
+ };
114
+ const defaultedData = defaultData(data);
115
+ const rootProps = defaultedData.root.props || defaultedData.root;
116
+ let newRoot = __spreadValues({}, defaultedData.root);
117
+ if (propTransforms["root"]) {
118
+ if (defaultedData.root.props) {
119
+ newRoot.props = propTransforms["root"](rootProps);
120
+ } else {
121
+ newRoot = propTransforms["root"](rootProps);
122
+ }
123
+ }
124
+ const afterPropTransforms = __spreadProps(__spreadValues({}, defaultedData), {
125
+ root: newRoot,
126
+ content: defaultedData.content.map(mapItem),
127
+ zones: Object.keys(data.zones || {}).reduce(
128
+ (acc, zoneKey) => __spreadProps(__spreadValues({}, acc), {
129
+ [zoneKey]: data.zones[zoneKey].map(mapItem)
130
+ }),
131
+ {}
132
+ )
133
+ });
134
+ return afterPropTransforms;
135
+ }
136
+
94
137
  // lib/resolve-all-data.ts
95
138
  init_react_import();
96
139
 
@@ -181,13 +224,6 @@ function resolveRootData(data, config) {
181
224
  });
182
225
  }
183
226
 
184
- // lib/default-data.ts
185
- init_react_import();
186
- var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
187
- root: data.root || {},
188
- content: data.content || []
189
- });
190
-
191
227
  // lib/resolve-all-data.ts
192
228
  function resolveAllData(data, config, onResolveStart, onResolveEnd) {
193
229
  return __async(this, null, function* () {
@@ -251,6 +287,6 @@ export {
251
287
  getChanged,
252
288
  resolveComponentData,
253
289
  resolveRootData,
254
- defaultData,
290
+ transformProps,
255
291
  resolveAllData
256
292
  };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FieldProps, a as Field, D as DropZoneProps, C as Config, U as UserGenerics, b as Data, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, I as IframeConfig, g as InitialHistory, h as DefaultComponentProps, i as DefaultRootFieldProps, H as History, A as AppState, E as ExtractPropsFromConfig, j as ExtractRootPropsFromConfig, k as ComponentDataMap } from './resolve-all-data-ppm982Jh.mjs';
2
- export { Q as Adaptor, K as ArrayField, s as ArrayState, a3 as AsFieldProps, B as BaseData, z as BaseField, u as ComponentConfig, x as ComponentData, y as Content, Y as CustomField, a0 as DefaultRootProps, $ as DefaultRootRenderProps, l as Direction, m as DragAxis, X as ExternalField, W as ExternalFieldWithAdaptor, q as FieldRenderFunctions, Z as Fields, r as ItemWithId, M as MappedItem, N as NumberField, L as ObjectField, p as OverrideKey, t as PuckComponent, _ as PuckContext, J as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, G as TextareaField, n as Viewport, a4 as WithChildren, a1 as WithId, a2 as WithPuckProps, o as overrideKeys, a5 as resolveAllData } from './resolve-all-data-ppm982Jh.mjs';
1
+ import { F as FieldProps, a as Field, D as DropZoneProps, C as Config, U as UserGenerics, b as Data, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, I as IframeConfig, g as InitialHistory, H as History, A as AppState, E as ExtractPropsFromConfig, h as ExtractRootPropsFromConfig, i as ComponentDataMap } from './resolve-all-data-ChsqfT2w.mjs';
2
+ export { K as Adaptor, G as ArrayField, q as ArrayState, a3 as AsFieldProps, B as BaseData, x as BaseField, s as ComponentConfig, v as ComponentData, w as Content, W as CustomField, a0 as DefaultComponentProps, Z as DefaultRootFieldProps, $ as DefaultRootProps, _ as DefaultRootRenderProps, j as Direction, k as DragAxis, Q as ExternalField, L as ExternalFieldWithAdaptor, n as FieldRenderFunctions, X as Fields, p as ItemWithId, M as MappedItem, N as NumberField, J as ObjectField, m as OverrideKey, r as PuckComponent, Y as PuckContext, z as RadioField, u as RootData, R as RootDataWithProps, t as RootDataWithoutProps, S as SelectField, T as TextField, y as TextareaField, l as Viewport, a4 as WithChildren, a1 as WithId, a2 as WithPuckProps, o as overrideKeys, a6 as resolveAllData, a5 as transformProps } from './resolve-all-data-ChsqfT2w.mjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { ReactNode, SyntheticEvent, ReactElement } from 'react';
@@ -140,17 +140,6 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
140
140
 
141
141
  declare function migrate(data: Data): Data;
142
142
 
143
- type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
144
- [ComponentName in keyof Props]: (props: Props[ComponentName] & {
145
- [key: string]: any;
146
- }) => Props[ComponentName];
147
- } & {
148
- root: (props: RootProps & {
149
- [key: string]: any;
150
- }) => RootProps;
151
- }>;
152
- declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
153
-
154
143
  type HistoryStore<D = any> = {
155
144
  index: number;
156
145
  hasPast: boolean;
@@ -194,4 +183,4 @@ declare const usePuck: <UserConfig extends Config = Config>() => {
194
183
  selectedItem: ComponentDataMap<ExtractPropsFromConfig<UserConfig>> | null;
195
184
  };
196
185
 
197
- export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, Label, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, migrate, transformProps, usePuck };
186
+ export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, Drawer, DropZone, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, Label, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, migrate, usePuck };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FieldProps, a as Field, D as DropZoneProps, C as Config, U as UserGenerics, b as Data, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, I as IframeConfig, g as InitialHistory, h as DefaultComponentProps, i as DefaultRootFieldProps, H as History, A as AppState, E as ExtractPropsFromConfig, j as ExtractRootPropsFromConfig, k as ComponentDataMap } from './resolve-all-data-ppm982Jh.js';
2
- export { Q as Adaptor, K as ArrayField, s as ArrayState, a3 as AsFieldProps, B as BaseData, z as BaseField, u as ComponentConfig, x as ComponentData, y as Content, Y as CustomField, a0 as DefaultRootProps, $ as DefaultRootRenderProps, l as Direction, m as DragAxis, X as ExternalField, W as ExternalFieldWithAdaptor, q as FieldRenderFunctions, Z as Fields, r as ItemWithId, M as MappedItem, N as NumberField, L as ObjectField, p as OverrideKey, t as PuckComponent, _ as PuckContext, J as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, G as TextareaField, n as Viewport, a4 as WithChildren, a1 as WithId, a2 as WithPuckProps, o as overrideKeys, a5 as resolveAllData } from './resolve-all-data-ppm982Jh.js';
1
+ import { F as FieldProps, a as Field, D as DropZoneProps, C as Config, U as UserGenerics, b as Data, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, I as IframeConfig, g as InitialHistory, H as History, A as AppState, E as ExtractPropsFromConfig, h as ExtractRootPropsFromConfig, i as ComponentDataMap } from './resolve-all-data-ChsqfT2w.js';
2
+ export { K as Adaptor, G as ArrayField, q as ArrayState, a3 as AsFieldProps, B as BaseData, x as BaseField, s as ComponentConfig, v as ComponentData, w as Content, W as CustomField, a0 as DefaultComponentProps, Z as DefaultRootFieldProps, $ as DefaultRootProps, _ as DefaultRootRenderProps, j as Direction, k as DragAxis, Q as ExternalField, L as ExternalFieldWithAdaptor, n as FieldRenderFunctions, X as Fields, p as ItemWithId, M as MappedItem, N as NumberField, J as ObjectField, m as OverrideKey, r as PuckComponent, Y as PuckContext, z as RadioField, u as RootData, R as RootDataWithProps, t as RootDataWithoutProps, S as SelectField, T as TextField, y as TextareaField, l as Viewport, a4 as WithChildren, a1 as WithId, a2 as WithPuckProps, o as overrideKeys, a6 as resolveAllData, a5 as transformProps } from './resolve-all-data-ChsqfT2w.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { ReactNode, SyntheticEvent, ReactElement } from 'react';
@@ -140,17 +140,6 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
140
140
 
141
141
  declare function migrate(data: Data): Data;
142
142
 
143
- type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
144
- [ComponentName in keyof Props]: (props: Props[ComponentName] & {
145
- [key: string]: any;
146
- }) => Props[ComponentName];
147
- } & {
148
- root: (props: RootProps & {
149
- [key: string]: any;
150
- }) => RootProps;
151
- }>;
152
- declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
153
-
154
143
  type HistoryStore<D = any> = {
155
144
  index: number;
156
145
  hasPast: boolean;
@@ -194,4 +183,4 @@ declare const usePuck: <UserConfig extends Config = Config>() => {
194
183
  selectedItem: ComponentDataMap<ExtractPropsFromConfig<UserConfig>> | null;
195
184
  };
196
185
 
197
- export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, Label, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, migrate, transformProps, usePuck };
186
+ export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, Drawer, DropZone, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, Label, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, migrate, usePuck };
package/dist/index.js CHANGED
@@ -3753,10 +3753,18 @@ var DraggableComponent = ({
3753
3753
  const rect = el.getBoundingClientRect();
3754
3754
  const diffLeft = rect.x;
3755
3755
  const exceedsBoundsLeft = diffLeft < 0;
3756
+ const diffTop = rect.y;
3757
+ const exceedsBoundsTop = diffTop < 0;
3756
3758
  if (exceedsBoundsLeft) {
3757
3759
  el.style.transformOrigin = "left top";
3758
3760
  el.style.left = "0px";
3759
3761
  }
3762
+ if (exceedsBoundsTop) {
3763
+ el.style.top = "12px";
3764
+ if (!exceedsBoundsLeft) {
3765
+ el.style.transformOrigin = "right top";
3766
+ }
3767
+ }
3760
3768
  }
3761
3769
  }
3762
3770
  },
package/dist/index.mjs CHANGED
@@ -8,15 +8,15 @@ import {
8
8
  __spreadProps,
9
9
  __spreadValues,
10
10
  __toESM,
11
- defaultData,
12
11
  getChanged,
13
12
  init_react_import,
14
13
  resolveAllData,
15
14
  resolveComponentData,
16
15
  resolveRootData,
17
16
  rootDroppableId,
18
- setupZone
19
- } from "./chunk-CHWFBYEM.mjs";
17
+ setupZone,
18
+ transformProps
19
+ } from "./chunk-4QIG6FWS.mjs";
20
20
 
21
21
  // ../../node_modules/classnames/index.js
22
22
  var require_classnames = __commonJS({
@@ -3606,10 +3606,18 @@ var DraggableComponent = ({
3606
3606
  const rect = el.getBoundingClientRect();
3607
3607
  const diffLeft = rect.x;
3608
3608
  const exceedsBoundsLeft = diffLeft < 0;
3609
+ const diffTop = rect.y;
3610
+ const exceedsBoundsTop = diffTop < 0;
3609
3611
  if (exceedsBoundsLeft) {
3610
3612
  el.style.transformOrigin = "left top";
3611
3613
  el.style.left = "0px";
3612
3614
  }
3615
+ if (exceedsBoundsTop) {
3616
+ el.style.top = "12px";
3617
+ if (!exceedsBoundsLeft) {
3618
+ el.style.transformOrigin = "right top";
3619
+ }
3620
+ }
3613
3621
  }
3614
3622
  }
3615
3623
  },
@@ -7826,40 +7834,6 @@ function migrate(data) {
7826
7834
  return migrations == null ? void 0 : migrations.reduce((acc, migration) => migration(acc), data);
7827
7835
  }
7828
7836
 
7829
- // lib/transform-props.ts
7830
- init_react_import();
7831
- function transformProps(data, propTransforms) {
7832
- const mapItem = (item) => {
7833
- if (propTransforms[item.type]) {
7834
- return __spreadProps(__spreadValues({}, item), {
7835
- props: propTransforms[item.type](item.props)
7836
- });
7837
- }
7838
- return item;
7839
- };
7840
- const defaultedData = defaultData(data);
7841
- const rootProps = defaultedData.root.props || defaultedData.root;
7842
- let newRoot = __spreadValues({}, defaultedData.root);
7843
- if (propTransforms["root"]) {
7844
- if (defaultedData.root.props) {
7845
- newRoot.props = propTransforms["root"](rootProps);
7846
- } else {
7847
- newRoot = propTransforms["root"](rootProps);
7848
- }
7849
- }
7850
- const afterPropTransforms = __spreadProps(__spreadValues({}, defaultedData), {
7851
- root: newRoot,
7852
- content: defaultedData.content.map(mapItem),
7853
- zones: Object.keys(data.zones || {}).reduce(
7854
- (acc, zoneKey) => __spreadProps(__spreadValues({}, acc), {
7855
- [zoneKey]: data.zones[zoneKey].map(mapItem)
7856
- }),
7857
- {}
7858
- )
7859
- });
7860
- return afterPropTransforms;
7861
- }
7862
-
7863
7837
  // lib/use-puck.ts
7864
7838
  init_react_import();
7865
7839
  var usePuck = () => {
@@ -457,6 +457,17 @@ type PuckAction = {
457
457
  recordHistory?: boolean;
458
458
  } & (ReorderAction | InsertAction | MoveAction | ReplaceAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
459
459
 
460
+ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
461
+ [ComponentName in keyof Props]: (props: Props[ComponentName] & {
462
+ [key: string]: any;
463
+ }) => Props[ComponentName];
464
+ } & {
465
+ root: (props: RootProps & {
466
+ [key: string]: any;
467
+ }) => RootProps;
468
+ }>;
469
+ declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
470
+
460
471
  declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
461
472
 
462
- export { type DefaultRootRenderProps 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 TextareaField as G, type History as H, type IframeConfig as I, type RadioField as J, type ArrayField as K, type ObjectField as L, type MappedItem as M, type NumberField as N, type OnAction as O, type Permissions as P, type Adaptor as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type ExternalFieldWithAdaptor as W, type ExternalField as X, type CustomField as Y, type Fields as Z, type PuckContext as _, type Field as a, type DefaultRootProps as a0, type WithId as a1, type WithPuckProps as a2, type AsFieldProps as a3, type WithChildren as a4, resolveAllData as a5, 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 Content as y, type BaseField as z };
473
+ export { type DefaultRootProps 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 ArrayField as G, type History as H, type IframeConfig as I, type ObjectField as J, type Adaptor as K, type ExternalFieldWithAdaptor as L, type MappedItem as M, type NumberField as N, type OnAction as O, type Permissions as P, type ExternalField as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type CustomField as W, type Fields as X, type PuckContext as Y, type DefaultRootFieldProps as Z, type DefaultRootRenderProps as _, type Field as a, type DefaultComponentProps as a0, type WithId as a1, type WithPuckProps as a2, type AsFieldProps as a3, type WithChildren as a4, transformProps 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 ExtractRootPropsFromConfig as h, type ComponentDataMap as i, type Direction as j, type DragAxis as k, type Viewport as l, type OverrideKey as m, type FieldRenderFunctions as n, overrideKeys as o, type ItemWithId as p, type ArrayState as q, type PuckComponent as r, type ComponentConfig as s, type RootDataWithoutProps as t, type RootData as u, type ComponentData as v, type Content as w, type BaseField as x, type TextareaField as y, type RadioField as z };
@@ -457,6 +457,17 @@ type PuckAction = {
457
457
  recordHistory?: boolean;
458
458
  } & (ReorderAction | InsertAction | MoveAction | ReplaceAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
459
459
 
460
+ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
461
+ [ComponentName in keyof Props]: (props: Props[ComponentName] & {
462
+ [key: string]: any;
463
+ }) => Props[ComponentName];
464
+ } & {
465
+ root: (props: RootProps & {
466
+ [key: string]: any;
467
+ }) => RootProps;
468
+ }>;
469
+ declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
470
+
460
471
  declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
461
472
 
462
- export { type DefaultRootRenderProps 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 TextareaField as G, type History as H, type IframeConfig as I, type RadioField as J, type ArrayField as K, type ObjectField as L, type MappedItem as M, type NumberField as N, type OnAction as O, type Permissions as P, type Adaptor as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type ExternalFieldWithAdaptor as W, type ExternalField as X, type CustomField as Y, type Fields as Z, type PuckContext as _, type Field as a, type DefaultRootProps as a0, type WithId as a1, type WithPuckProps as a2, type AsFieldProps as a3, type WithChildren as a4, resolveAllData as a5, 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 Content as y, type BaseField as z };
473
+ export { type DefaultRootProps 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 ArrayField as G, type History as H, type IframeConfig as I, type ObjectField as J, type Adaptor as K, type ExternalFieldWithAdaptor as L, type MappedItem as M, type NumberField as N, type OnAction as O, type Permissions as P, type ExternalField as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type CustomField as W, type Fields as X, type PuckContext as Y, type DefaultRootFieldProps as Z, type DefaultRootRenderProps as _, type Field as a, type DefaultComponentProps as a0, type WithId as a1, type WithPuckProps as a2, type AsFieldProps as a3, type WithChildren as a4, transformProps 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 ExtractRootPropsFromConfig as h, type ComponentDataMap as i, type Direction as j, type DragAxis as k, type Viewport as l, type OverrideKey as m, type FieldRenderFunctions as n, overrideKeys as o, type ItemWithId as p, type ArrayState as q, type PuckComponent as r, type ComponentConfig as s, type RootDataWithoutProps as t, type RootData as u, type ComponentData as v, type Content as w, type BaseField as x, type TextareaField as y, type RadioField as z };
package/dist/rsc.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, U as UserGenerics } from './resolve-all-data-ppm982Jh.mjs';
3
- export { a5 as resolveAllData } from './resolve-all-data-ppm982Jh.mjs';
2
+ import { C as Config, U as UserGenerics } from './resolve-all-data-ChsqfT2w.mjs';
3
+ export { a6 as resolveAllData, a5 as transformProps } from './resolve-all-data-ChsqfT2w.mjs';
4
4
  import 'react';
5
5
 
6
6
  declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data }: {
package/dist/rsc.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, U as UserGenerics } from './resolve-all-data-ppm982Jh.js';
3
- export { a5 as resolveAllData } from './resolve-all-data-ppm982Jh.js';
2
+ import { C as Config, U as UserGenerics } from './resolve-all-data-ChsqfT2w.js';
3
+ export { a6 as resolveAllData, a5 as transformProps } from './resolve-all-data-ChsqfT2w.js';
4
4
  import 'react';
5
5
 
6
6
  declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data }: {
package/dist/rsc.js CHANGED
@@ -68,7 +68,8 @@ var __async = (__this, __arguments, generator) => {
68
68
  var rsc_exports = {};
69
69
  __export(rsc_exports, {
70
70
  Render: () => Render,
71
- resolveAllData: () => resolveAllData
71
+ resolveAllData: () => resolveAllData,
72
+ transformProps: () => transformProps
72
73
  });
73
74
  module.exports = __toCommonJS(rsc_exports);
74
75
 
@@ -271,8 +272,42 @@ function resolveAllData(data, config, onResolveStart, onResolveEnd) {
271
272
  });
272
273
  });
273
274
  }
275
+
276
+ // lib/transform-props.ts
277
+ function transformProps(data, propTransforms) {
278
+ const mapItem = (item) => {
279
+ if (propTransforms[item.type]) {
280
+ return __spreadProps(__spreadValues({}, item), {
281
+ props: propTransforms[item.type](item.props)
282
+ });
283
+ }
284
+ return item;
285
+ };
286
+ const defaultedData = defaultData(data);
287
+ const rootProps = defaultedData.root.props || defaultedData.root;
288
+ let newRoot = __spreadValues({}, defaultedData.root);
289
+ if (propTransforms["root"]) {
290
+ if (defaultedData.root.props) {
291
+ newRoot.props = propTransforms["root"](rootProps);
292
+ } else {
293
+ newRoot = propTransforms["root"](rootProps);
294
+ }
295
+ }
296
+ const afterPropTransforms = __spreadProps(__spreadValues({}, defaultedData), {
297
+ root: newRoot,
298
+ content: defaultedData.content.map(mapItem),
299
+ zones: Object.keys(data.zones || {}).reduce(
300
+ (acc, zoneKey) => __spreadProps(__spreadValues({}, acc), {
301
+ [zoneKey]: data.zones[zoneKey].map(mapItem)
302
+ }),
303
+ {}
304
+ )
305
+ });
306
+ return afterPropTransforms;
307
+ }
274
308
  // Annotate the CommonJS export names for ESM import in node:
275
309
  0 && (module.exports = {
276
310
  Render,
277
- resolveAllData
311
+ resolveAllData,
312
+ transformProps
278
313
  });
package/dist/rsc.mjs CHANGED
@@ -4,8 +4,9 @@ import {
4
4
  init_react_import,
5
5
  resolveAllData,
6
6
  rootDroppableId,
7
- setupZone
8
- } from "./chunk-CHWFBYEM.mjs";
7
+ setupZone,
8
+ transformProps
9
+ } from "./chunk-4QIG6FWS.mjs";
9
10
 
10
11
  // rsc.tsx
11
12
  init_react_import();
@@ -76,5 +77,6 @@ function Render({ config, data }) {
76
77
  }
77
78
  export {
78
79
  Render,
79
- resolveAllData
80
+ resolveAllData,
81
+ transformProps
80
82
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.18.3-canary.78bb71d",
3
+ "version": "0.18.3-canary.9de70d3",
4
4
  "author": "Measured Corporation Ltd <hello@measured.co>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",