@measured/puck 0.15.0-canary.480467a → 0.15.0-canary.b1c40c6

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -60,10 +60,7 @@ const config = {
60
60
  };
61
61
 
62
62
  // Describe the initial data
63
- const initialData = {
64
- content: [],
65
- root: {},
66
- };
63
+ const initialData = {};
67
64
 
68
65
  // Save the data to your database
69
66
  const save = (data) => {};
@@ -152,8 +152,16 @@ type ComponentConfig<ComponentProps extends DefaultComponentProps = DefaultCompo
152
152
  label?: string;
153
153
  defaultProps?: DefaultProps;
154
154
  fields?: Fields<ComponentProps>;
155
+ resolveFields?: (data: DataShape, params: {
156
+ changed: Partial<Record<keyof ComponentProps, boolean>>;
157
+ fields: Fields<ComponentProps>;
158
+ lastFields: Fields<ComponentProps>;
159
+ lastData: DataShape;
160
+ appState: AppState;
161
+ }) => Promise<Fields<ComponentProps>> | Fields<ComponentProps>;
155
162
  resolveData?: (data: DataShape, params: {
156
163
  changed: Partial<Record<keyof ComponentProps, boolean>>;
164
+ lastData: DataShape;
157
165
  }) => Promise<{
158
166
  props?: Partial<ComponentProps>;
159
167
  readOnly?: Partial<Record<keyof ComponentProps, boolean>>;
@@ -179,7 +187,7 @@ type Config<Props extends Record<string, any> = Record<string, any>, RootProps e
179
187
  children?: ReactNode;
180
188
  }, Partial<RootProps & {
181
189
  children?: ReactNode;
182
- }>, RootDataWithProps>>;
190
+ }>, RootData>>;
183
191
  };
184
192
  type BaseData<Props extends {
185
193
  [key: string]: any;
@@ -192,11 +200,11 @@ type ComponentData<Props extends DefaultComponentProps = DefaultComponentProps>
192
200
  type: keyof Props;
193
201
  props: WithPuckProps<Props>;
194
202
  } & BaseData<Props>;
195
- type RootDataWithProps<Props extends DefaultRootProps = DefaultRootProps> = {
203
+ type RootDataWithProps<Props extends DefaultRootProps = DefaultRootProps> = BaseData<Props> & {
196
204
  props: Props;
197
205
  };
198
206
  type RootDataWithoutProps<Props extends DefaultRootProps = DefaultRootProps> = Props;
199
- type RootData<Props extends DefaultRootProps = DefaultRootProps> = BaseData<Props> & Partial<RootDataWithProps<Props>> & Partial<RootDataWithoutProps<Props>>;
207
+ type RootData<Props extends DefaultRootProps = DefaultRootProps> = Partial<RootDataWithProps<Props>> & Partial<RootDataWithoutProps<Props>>;
200
208
  type MappedItem = ComponentData;
201
209
  type Data<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultRootProps = DefaultRootProps> = {
202
210
  root: RootData<RootProps>;
package/dist/index.css CHANGED
@@ -1462,11 +1462,14 @@ textarea._Input-input_1qi5b_46 {
1462
1462
  }
1463
1463
 
1464
1464
  /* css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css/#css-module-data */
1465
- ._PuckFields_17k3p_1 {
1465
+ ._PuckFields_1o0if_1 {
1466
1466
  position: relative;
1467
1467
  font-family: var(--puck-font-family);
1468
1468
  }
1469
- ._PuckFields-loadingOverlay_17k3p_6 {
1469
+ ._PuckFields--isLoading_1o0if_6 {
1470
+ min-height: 48px;
1471
+ }
1472
+ ._PuckFields-loadingOverlay_1o0if_10 {
1470
1473
  background: var(--puck-color-white);
1471
1474
  display: flex;
1472
1475
  justify-content: center;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { U as UiState, D as Data, A as AppState, C as Config, a as DefaultRootProps, I as ItemSelector, b as DropZoneProps, F as Field, V as Viewports, c as DefaultComponentProps, M as MappedItem, R as RootDataWithProps, d as RootData, e as ComponentData } from './Config-550396e1.js';
2
- export { i as Adaptor, h as ArrayField, s as ArrayState, p as BaseData, B as BaseField, o as ComponentConfig, m as Content, k as CustomField, j as ExternalField, E as ExternalFieldWithAdaptor, l as Fields, r as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, n as PuckContext, g as RadioField, q as RootDataWithoutProps, S as SelectField, T as TextField, f as TextareaField } from './Config-550396e1.js';
1
+ import { U as UiState, D as Data, A as AppState, C as Config, a as DefaultRootProps, I as ItemSelector, b as DropZoneProps, F as Field, V as Viewports, c as DefaultComponentProps, M as MappedItem, R as RootDataWithProps, d as RootData, e as ComponentData } from './Config-25917005.js';
2
+ export { i as Adaptor, h as ArrayField, s as ArrayState, p as BaseData, B as BaseField, o as ComponentConfig, m as Content, k as CustomField, j as ExternalField, E as ExternalFieldWithAdaptor, l as Fields, r as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, n as PuckContext, g as RadioField, q as RootDataWithoutProps, S as SelectField, T as TextField, f as TextareaField } from './Config-25917005.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { ReactNode, ReactElement, CSSProperties, SyntheticEvent } from 'react';
@@ -232,7 +232,7 @@ type IframeConfig = {
232
232
  declare function Puck<UserConfig extends Config = Config>({ children, config, data: initialData, ui: initialUi, onChange, onPublish, plugins, overrides, renderHeader, renderHeaderActions, headerTitle, headerPath, viewports, iframe, dnd, }: {
233
233
  children?: ReactNode;
234
234
  config: UserConfig;
235
- data: Data;
235
+ data: Partial<Data>;
236
236
  ui?: Partial<UiState>;
237
237
  onChange?: (data: Data) => void;
238
238
  onPublish?: (data: Data) => void;
@@ -266,7 +266,7 @@ declare namespace Puck {
266
266
 
267
267
  declare function Render<UserConfig extends Config = Config>({ config, data, }: {
268
268
  config: UserConfig;
269
- data: Data;
269
+ data: Partial<Data>;
270
270
  }): react_jsx_runtime.JSX.Element;
271
271
 
272
272
  declare function migrate(data: Data): Data;
@@ -280,9 +280,9 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
280
280
  [key: string]: any;
281
281
  }) => RootProps;
282
282
  }>;
283
- declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultComponentProps>(data: Data, propTransforms: PropTransform<Props, RootProps>): Data;
283
+ declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultComponentProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
284
284
 
285
- declare function resolveAllData(data: Data, config: Config, onResolveStart?: (item: MappedItem) => void, onResolveEnd?: (item: MappedItem) => void): Promise<{
285
+ declare function resolveAllData(data: Partial<Data>, config: Config, onResolveStart?: (item: MappedItem) => void, onResolveEnd?: (item: MappedItem) => void): Promise<{
286
286
  root: RootDataWithProps<DefaultRootProps> | RootData<DefaultRootProps>;
287
287
  content: any[];
288
288
  zones: Record<string, MappedItem[]>;
package/dist/index.js CHANGED
@@ -31095,6 +31095,20 @@ var import_react13 = require("react");
31095
31095
 
31096
31096
  // lib/resolve-component-data.ts
31097
31097
  init_react_import();
31098
+
31099
+ // lib/get-changed.ts
31100
+ init_react_import();
31101
+ var getChanged = (newItem, oldItem) => {
31102
+ return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
31103
+ const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
31104
+ const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
31105
+ return __spreadProps(__spreadValues({}, acc), {
31106
+ [item]: oldItemProps[item] !== newItemProps[item]
31107
+ });
31108
+ }, {}) : {};
31109
+ };
31110
+
31111
+ // lib/resolve-component-data.ts
31098
31112
  var cache = { lastChange: {} };
31099
31113
  var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
31100
31114
  return yield Promise.all(
@@ -31111,25 +31125,15 @@ var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) =>
31111
31125
  var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
31112
31126
  const configForItem = config.components[item.type];
31113
31127
  if (configForItem.resolveData) {
31114
- let changed = Object.keys(item.props).reduce(
31115
- (acc, item2) => __spreadProps(__spreadValues({}, acc), { [item2]: true }),
31116
- {}
31117
- );
31118
- if (cache.lastChange[item.props.id]) {
31119
- const { item: oldItem, resolved } = cache.lastChange[item.props.id];
31120
- if (oldItem === item) {
31121
- return resolved;
31122
- }
31123
- Object.keys(item.props).forEach((propName) => {
31124
- if (oldItem.props[propName] === item.props[propName]) {
31125
- changed[propName] = false;
31126
- }
31127
- });
31128
+ const { item: oldItem = {}, resolved = {} } = cache.lastChange[item.props.id] || {};
31129
+ if (item && item === oldItem) {
31130
+ return resolved;
31128
31131
  }
31132
+ const changed = getChanged(item, oldItem);
31129
31133
  if (onResolveStart) {
31130
31134
  onResolveStart(item);
31131
31135
  }
31132
- const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, { changed });
31136
+ const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, { changed, lastData: oldItem });
31133
31137
  const { readOnly: existingReadOnly = {} } = item || {};
31134
31138
  const newReadOnly = __spreadValues(__spreadValues({}, existingReadOnly), readOnly);
31135
31139
  const resolvedItem = __spreadProps(__spreadValues({}, item), {
@@ -31172,26 +31176,16 @@ var applyDynamicProps = (data, dynamicProps, rootData) => {
31172
31176
  init_react_import();
31173
31177
  var cache2 = {};
31174
31178
  var resolveRootData = (data, config) => __async(void 0, null, function* () {
31175
- var _a, _b;
31179
+ var _a, _b, _c, _d, _e;
31176
31180
  if (((_a = config.root) == null ? void 0 : _a.resolveData) && data.root.props) {
31177
- let changed = Object.keys(data.root.props).reduce(
31178
- (acc, item) => __spreadProps(__spreadValues({}, acc), { [item]: true }),
31179
- {}
31180
- );
31181
- if (cache2.lastChange) {
31182
- const { original, resolved } = cache2.lastChange;
31183
- if (original === data.root) {
31184
- return resolved;
31185
- }
31186
- Object.keys(data.root.props).forEach((propName) => {
31187
- if (original.props[propName] === data.root.props[propName]) {
31188
- changed[propName] = false;
31189
- }
31190
- });
31181
+ if (((_b = cache2.lastChange) == null ? void 0 : _b.original) === data.root) {
31182
+ return cache2.lastChange.resolved;
31191
31183
  }
31184
+ const changed = getChanged(data.root, (_c = cache2.lastChange) == null ? void 0 : _c.original);
31192
31185
  const rootWithProps = data.root;
31193
- const resolvedRoot = yield (_b = config.root) == null ? void 0 : _b.resolveData(rootWithProps, {
31194
- changed
31186
+ const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
31187
+ changed,
31188
+ lastData: ((_d = cache2.lastChange) == null ? void 0 : _d.original) || {}
31195
31189
  });
31196
31190
  cache2.lastChange = {
31197
31191
  original: data.root,
@@ -32321,7 +32315,7 @@ var InputOrGroup = (_a) => {
32321
32315
 
32322
32316
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
32323
32317
  init_react_import();
32324
- var styles_module_default14 = { "PuckFields": "_PuckFields_17k3p_1", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_17k3p_6" };
32318
+ var styles_module_default14 = { "PuckFields": "_PuckFields_1o0if_1", "PuckFields--isLoading": "_PuckFields--isLoading_1o0if_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_1o0if_10" };
32325
32319
 
32326
32320
  // components/Puck/components/Fields/index.tsx
32327
32321
  var import_react19 = require("react");
@@ -32334,13 +32328,73 @@ var DefaultFields = ({
32334
32328
  children,
32335
32329
  isLoading
32336
32330
  }) => {
32337
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19(), children: [
32331
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getClassName19({ isLoading }), children: [
32338
32332
  children,
32339
32333
  isLoading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_spinners6.ClipLoader, { "aria-label": "loading" }) })
32340
32334
  ] });
32341
32335
  };
32336
+ var useResolvedFields = () => {
32337
+ var _a;
32338
+ const { selectedItem, state, config } = useAppContext();
32339
+ const { data } = state;
32340
+ const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
32341
+ const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
32342
+ const defaultFields = selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields;
32343
+ const rootProps = data.root.props || data.root;
32344
+ const [lastSelectedData, setLastSelectedData] = (0, import_react19.useState)(
32345
+ {}
32346
+ );
32347
+ const [resolvedFields, setResolvedFields] = (0, import_react19.useState)(defaultFields || {});
32348
+ const [fieldsLoading, setFieldsLoading] = (0, import_react19.useState)(false);
32349
+ const defaultResolveFields = (_componentData, _params) => defaultFields;
32350
+ const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
32351
+ const resolveFields = (0, import_react19.useCallback)(
32352
+ (..._0) => __async(void 0, [..._0], function* (fields = {}) {
32353
+ var _a2, _b, _c;
32354
+ const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : {};
32355
+ const changed = getChanged(componentData, lastData);
32356
+ setLastSelectedData(componentData);
32357
+ if (selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields)) {
32358
+ return yield componentConfig == null ? void 0 : componentConfig.resolveFields(
32359
+ componentData,
32360
+ {
32361
+ changed,
32362
+ fields,
32363
+ lastFields: resolvedFields,
32364
+ lastData,
32365
+ appState: state
32366
+ }
32367
+ );
32368
+ }
32369
+ if (!selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields)) {
32370
+ return yield (_c = config.root) == null ? void 0 : _c.resolveFields(componentData, {
32371
+ changed,
32372
+ fields,
32373
+ lastFields: resolvedFields,
32374
+ lastData,
32375
+ appState: state
32376
+ });
32377
+ }
32378
+ return defaultResolveFields(componentData, {
32379
+ changed,
32380
+ fields,
32381
+ lastFields: resolvedFields,
32382
+ lastData
32383
+ });
32384
+ }),
32385
+ [data, config, componentData, selectedItem, resolvedFields, state]
32386
+ );
32387
+ (0, import_react19.useEffect)(() => {
32388
+ setFieldsLoading(true);
32389
+ resolveFields(defaultFields).then((fields) => {
32390
+ setResolvedFields(fields || {});
32391
+ setFieldsLoading(false);
32392
+ });
32393
+ }, [data, defaultFields]);
32394
+ return [resolvedFields, fieldsLoading];
32395
+ };
32342
32396
  var Fields = () => {
32343
- var _a, _b, _c, _d;
32397
+ var _a, _b;
32344
32398
  const {
32345
32399
  selectedItem,
32346
32400
  state,
@@ -32352,9 +32406,9 @@ var Fields = () => {
32352
32406
  } = useAppContext();
32353
32407
  const { data, ui } = state;
32354
32408
  const { itemSelector } = ui;
32355
- const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
32356
- const fields = selectedItem ? ((_b = config.components[selectedItem.type]) == null ? void 0 : _b.fields) || {} : rootFields;
32357
- const isLoading = selectedItem ? (_c = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _c.loading : (_d = componentState["puck-root"]) == null ? void 0 : _d.loading;
32409
+ const [fields, fieldsResolving] = useResolvedFields();
32410
+ const componentResolving = selectedItem ? (_a = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a.loading : (_b = componentState["puck-root"]) == null ? void 0 : _b.loading;
32411
+ const isLoading = fieldsResolving || componentResolving;
32358
32412
  const rootProps = data.root.props || data.root;
32359
32413
  const Wrapper = (0, import_react19.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
32360
32414
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
@@ -32366,6 +32420,8 @@ var Fields = () => {
32366
32420
  },
32367
32421
  children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
32368
32422
  const field = fields[fieldName];
32423
+ if (!(field == null ? void 0 : field.type))
32424
+ return null;
32369
32425
  const onChange = (value, updatedUi) => {
32370
32426
  var _a2, _b2;
32371
32427
  let currentProps;
@@ -33644,7 +33700,7 @@ function Puck({
33644
33700
  () => createReducer({ config, record: historyStore.record })
33645
33701
  );
33646
33702
  const [initialAppState] = (0, import_react29.useState)(() => {
33647
- var _a2, _b, _c, _d, _e;
33703
+ var _a2, _b, _c, _d, _e, _f;
33648
33704
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
33649
33705
  let clientUiState = {};
33650
33706
  if (typeof window !== "undefined") {
@@ -33671,11 +33727,12 @@ function Puck({
33671
33727
  };
33672
33728
  }
33673
33729
  }
33674
- const rootProps2 = initialData.root.props || initialData.root;
33675
- const defaultedRootProps = __spreadValues(__spreadValues({}, (_e = config.root) == null ? void 0 : _e.defaultProps), rootProps2);
33730
+ const rootProps2 = ((_e = initialData == null ? void 0 : initialData.root) == null ? void 0 : _e.props) || initialData.root || {};
33731
+ const defaultedRootProps = __spreadValues(__spreadValues({}, (_f = config.root) == null ? void 0 : _f.defaultProps), rootProps2);
33676
33732
  return __spreadProps(__spreadValues({}, defaultAppState), {
33677
33733
  data: __spreadProps(__spreadValues({}, initialData), {
33678
- root: defaultedRootProps
33734
+ root: defaultedRootProps,
33735
+ content: initialData.content || []
33679
33736
  }),
33680
33737
  ui: __spreadProps(__spreadValues(__spreadValues({}, initial), clientUiState), {
33681
33738
  // Store categories under componentList on state to allow render functions and plugins to modify
@@ -34043,10 +34100,14 @@ function Render({
34043
34100
  data
34044
34101
  }) {
34045
34102
  var _a;
34046
- const rootProps = data.root.props || data.root;
34103
+ const defaultedData = __spreadProps(__spreadValues({}, data), {
34104
+ root: data.root || {},
34105
+ content: data.content || []
34106
+ });
34107
+ const rootProps = defaultedData.root.props || defaultedData.root;
34047
34108
  const title = (rootProps == null ? void 0 : rootProps.title) || "";
34048
34109
  if ((_a = config.root) == null ? void 0 : _a.render) {
34049
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
34110
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
34050
34111
  config.root.render,
34051
34112
  __spreadProps(__spreadValues({}, rootProps), {
34052
34113
  puck: {
@@ -34059,7 +34120,7 @@ function Render({
34059
34120
  })
34060
34121
  ) });
34061
34122
  }
34062
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId }) });
34123
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId }) });
34063
34124
  }
34064
34125
 
34065
34126
  // lib/migrate.ts
@@ -34087,6 +34148,15 @@ function migrate(data) {
34087
34148
 
34088
34149
  // lib/transform-props.ts
34089
34150
  init_react_import();
34151
+
34152
+ // lib/default-data.ts
34153
+ init_react_import();
34154
+ var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
34155
+ root: data.root || {},
34156
+ content: data.content || []
34157
+ });
34158
+
34159
+ // lib/transform-props.ts
34090
34160
  function transformProps(data, propTransforms) {
34091
34161
  const mapItem = (item) => {
34092
34162
  if (propTransforms[item.type]) {
@@ -34096,18 +34166,19 @@ function transformProps(data, propTransforms) {
34096
34166
  }
34097
34167
  return item;
34098
34168
  };
34099
- const rootProps = data.root.props || data.root;
34100
- let newRoot = __spreadValues({}, data.root);
34169
+ const defaultedData = defaultData(data);
34170
+ const rootProps = defaultedData.root.props || defaultedData.root;
34171
+ let newRoot = __spreadValues({}, defaultedData.root);
34101
34172
  if (propTransforms["root"]) {
34102
- if (data.root.props) {
34173
+ if (defaultedData.root.props) {
34103
34174
  newRoot.props = propTransforms["root"](rootProps);
34104
34175
  } else {
34105
34176
  newRoot = propTransforms["root"](rootProps);
34106
34177
  }
34107
34178
  }
34108
- const afterPropTransforms = __spreadProps(__spreadValues({}, data), {
34179
+ const afterPropTransforms = __spreadProps(__spreadValues({}, defaultedData), {
34109
34180
  root: newRoot,
34110
- content: data.content.map(mapItem),
34181
+ content: defaultedData.content.map(mapItem),
34111
34182
  zones: Object.keys(data.zones || {}).reduce(
34112
34183
  (acc, zoneKey) => __spreadProps(__spreadValues({}, acc), {
34113
34184
  [zoneKey]: data.zones[zoneKey].map(mapItem)
@@ -34122,7 +34193,8 @@ function transformProps(data, propTransforms) {
34122
34193
  init_react_import();
34123
34194
  function resolveAllData(data, config, onResolveStart, onResolveEnd) {
34124
34195
  return __async(this, null, function* () {
34125
- const dynamicRoot = yield resolveRootData(data, config);
34196
+ const defaultedData = defaultData(data);
34197
+ const dynamicRoot = yield resolveRootData(defaultedData, config);
34126
34198
  const { zones = {} } = data;
34127
34199
  const zoneKeys = Object.keys(zones);
34128
34200
  const resolvedZones = {};
@@ -34135,10 +34207,10 @@ function resolveAllData(data, config, onResolveStart, onResolveEnd) {
34135
34207
  onResolveEnd
34136
34208
  );
34137
34209
  }
34138
- return __spreadProps(__spreadValues({}, data), {
34210
+ return __spreadProps(__spreadValues({}, defaultedData), {
34139
34211
  root: dynamicRoot,
34140
34212
  content: yield resolveAllComponentData(
34141
- data.content,
34213
+ defaultedData.content,
34142
34214
  config,
34143
34215
  onResolveStart,
34144
34216
  onResolveEnd
package/dist/rsc.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, D as Data } from './Config-550396e1.js';
2
+ import { C as Config, D as Data } from './Config-25917005.js';
3
3
  import 'react';
4
4
 
5
5
  declare function Render<UserConfig extends Config = Config>({ config, data, }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.15.0-canary.480467a",
3
+ "version": "0.15.0-canary.b1c40c6",
4
4
  "author": "Measured Corporation Ltd <hello@measured.co>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",