@measured/puck 0.16.0-canary.53c8bfc → 0.16.0-canary.555902

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -183,31 +183,26 @@ init_react_import();
183
183
  // lib/get-class-name-factory.ts
184
184
  init_react_import();
185
185
  var import_classnames = __toESM(require_classnames());
186
- var getClassNameFactory = (rootClass, styles, { baseClass = "" } = {}) => (options = {}) => {
187
- let descendant = false;
188
- let modifiers = false;
186
+ var getClassNameFactory = (rootClass, styles, config = { baseClass: "" }) => (options = {}) => {
189
187
  if (typeof options === "string") {
190
- descendant = options;
191
- } else if (typeof options === "object") {
192
- modifiers = options;
193
- }
194
- if (descendant) {
188
+ const descendant = options;
195
189
  const style = styles[`${rootClass}-${descendant}`];
196
190
  if (style) {
197
- return baseClass + styles[`${rootClass}-${descendant}`] || "";
191
+ return config.baseClass + styles[`${rootClass}-${descendant}`] || "";
198
192
  }
199
193
  return "";
200
- } else if (modifiers) {
194
+ } else if (typeof options === "object") {
195
+ const modifiers = options;
201
196
  const prefixedModifiers = {};
202
197
  for (let modifier in modifiers) {
203
198
  prefixedModifiers[styles[`${rootClass}--${modifier}`]] = modifiers[modifier];
204
199
  }
205
200
  const c = styles[rootClass];
206
- return baseClass + (0, import_classnames.default)(__spreadValues({
201
+ return config.baseClass + (0, import_classnames.default)(__spreadValues({
207
202
  [c]: !!c
208
203
  }, prefixedModifiers));
209
204
  } else {
210
- return baseClass + styles[rootClass] || "";
205
+ return config.baseClass + styles[rootClass] || "";
211
206
  }
212
207
  };
213
208
  var get_class_name_factory_default = getClassNameFactory;
@@ -660,25 +655,29 @@ var rootDroppableId = "default-zone";
660
655
 
661
656
  // lib/setup-zone.ts
662
657
  init_react_import();
658
+ function ensureZones(data) {
659
+ return __spreadProps(__spreadValues({}, data), {
660
+ zones: data.zones || {}
661
+ });
662
+ }
663
663
  var setupZone = (data, zoneKey) => {
664
664
  if (zoneKey === rootDroppableId) {
665
665
  return data;
666
666
  }
667
- const newData = __spreadValues({}, data);
668
- newData.zones = data.zones || {};
667
+ const newData = ensureZones(data);
669
668
  newData.zones[zoneKey] = newData.zones[zoneKey] || [];
670
669
  return newData;
671
670
  };
672
671
 
673
672
  // lib/get-item.ts
674
- var getItem = (selector, data, dynamicProps = {}) => {
673
+ function getItem(selector, data, dynamicProps = {}) {
675
674
  if (!selector.zone || selector.zone === rootDroppableId) {
676
675
  const item2 = data.content[selector.index];
677
676
  return (item2 == null ? void 0 : item2.props) ? __spreadProps(__spreadValues({}, item2), { props: dynamicProps[item2.props.id] || item2.props }) : void 0;
678
677
  }
679
678
  const item = setupZone(data, selector.zone).zones[selector.zone][selector.index];
680
679
  return (item == null ? void 0 : item.props) ? __spreadProps(__spreadValues({}, item), { props: dynamicProps[item.props.id] || item.props }) : void 0;
681
- };
680
+ }
682
681
 
683
682
  // components/ViewportControls/default-viewports.ts
684
683
  init_react_import();
@@ -692,7 +691,7 @@ var defaultViewports = [
692
691
  var import_ua_parser_js = require("ua-parser-js");
693
692
  var import_jsx_runtime4 = require("react/jsx-runtime");
694
693
  var defaultAppState = {
695
- data: { content: [], root: { props: {} } },
694
+ data: { content: [], root: {} },
696
695
  ui: {
697
696
  leftSideBarVisible: true,
698
697
  rightSideBarVisible: true,
@@ -1483,7 +1482,7 @@ var ExternalInput = ({
1483
1482
  }
1484
1483
  ) })
1485
1484
  ] })
1486
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
1485
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Heading, { rank: "2", size: "xs", children: field.placeholder || "Select data" }) }),
1487
1486
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("grid"), children: [
1488
1487
  hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
1489
1488
  const filterField = filterFields[fieldName];
@@ -2905,7 +2904,7 @@ var SidebarSection = ({
2905
2904
  ),
2906
2905
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronRight, { size: 16 })
2907
2906
  ] }, i)) : null,
2908
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
2907
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading, { rank: "2", size: "xs", children: title }) })
2909
2908
  ] }) }),
2910
2909
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("content"), children }),
2911
2910
  isLoading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Loader, { size: 32 }) })
@@ -2938,7 +2937,7 @@ var remove = (list, index) => {
2938
2937
 
2939
2938
  // lib/reduce-related-zones.ts
2940
2939
  init_react_import();
2941
- var reduceRelatedZones = (item, data, fn) => {
2940
+ function reduceRelatedZones(item, data, fn) {
2942
2941
  return __spreadProps(__spreadValues({}, data), {
2943
2942
  zones: Object.keys(data.zones || {}).reduce(
2944
2943
  (acc, key) => {
@@ -2952,28 +2951,34 @@ var reduceRelatedZones = (item, data, fn) => {
2952
2951
  {}
2953
2952
  )
2954
2953
  });
2955
- };
2954
+ }
2956
2955
  var findRelatedByZoneId = (zoneId, data) => {
2957
2956
  const [zoneParentId] = getZoneId(zoneId);
2958
- return (data.zones[zoneId] || []).reduce((acc, zoneItem) => {
2959
- const related = findRelatedByItem(zoneItem, data);
2960
- if (zoneItem.props.id === zoneParentId) {
2961
- return __spreadProps(__spreadValues(__spreadValues({}, acc), related), { [zoneId]: zoneItem });
2962
- }
2963
- return __spreadValues(__spreadValues({}, acc), related);
2964
- }, {});
2957
+ return (data.zones[zoneId] || []).reduce(
2958
+ (acc, zoneItem) => {
2959
+ const related = findRelatedByItem(zoneItem, data);
2960
+ if (zoneItem.props.id === zoneParentId) {
2961
+ return __spreadProps(__spreadValues(__spreadValues({}, acc), related), { [zoneId]: zoneItem });
2962
+ }
2963
+ return __spreadValues(__spreadValues({}, acc), related);
2964
+ },
2965
+ {}
2966
+ );
2965
2967
  };
2966
2968
  var findRelatedByItem = (item, data) => {
2967
- return Object.keys(data.zones || {}).reduce((acc, zoneId) => {
2968
- const [zoneParentId] = getZoneId(zoneId);
2969
- if (item.props.id === zoneParentId) {
2970
- const related = findRelatedByZoneId(zoneId, data);
2971
- return __spreadProps(__spreadValues(__spreadValues({}, acc), related), {
2972
- [zoneId]: data.zones[zoneId]
2973
- });
2974
- }
2975
- return acc;
2976
- }, {});
2969
+ return Object.keys(data.zones || {}).reduce(
2970
+ (acc, zoneId) => {
2971
+ const [zoneParentId] = getZoneId(zoneId);
2972
+ if (item.props.id === zoneParentId) {
2973
+ const related = findRelatedByZoneId(zoneId, data);
2974
+ return __spreadProps(__spreadValues(__spreadValues({}, acc), related), {
2975
+ [zoneId]: data.zones[zoneId]
2976
+ });
2977
+ }
2978
+ return acc;
2979
+ },
2980
+ {}
2981
+ );
2977
2982
  };
2978
2983
  var removeRelatedZones = (item, data) => {
2979
2984
  const newData = __spreadValues({}, data);
@@ -2983,7 +2988,7 @@ var removeRelatedZones = (item, data) => {
2983
2988
  });
2984
2989
  return newData;
2985
2990
  };
2986
- var duplicateRelatedZones = (item, data, newId) => {
2991
+ function duplicateRelatedZones(item, data, newId) {
2987
2992
  return reduceRelatedZones(item, data, (acc, key, zone) => {
2988
2993
  const dupedZone = zone.map((zoneItem) => __spreadProps(__spreadValues({}, zoneItem), {
2989
2994
  props: __spreadProps(__spreadValues({}, zoneItem.props), { id: generateId(zoneItem.type) })
@@ -2998,7 +3003,7 @@ var duplicateRelatedZones = (item, data, newId) => {
2998
3003
  [`${newId}:${zoneId}`]: dupedZone
2999
3004
  });
3000
3005
  });
3001
- };
3006
+ }
3002
3007
 
3003
3008
  // reducer/data.ts
3004
3009
  var zoneCache = {};
@@ -3022,7 +3027,7 @@ var replaceAction = (data, action) => {
3022
3027
  })
3023
3028
  });
3024
3029
  };
3025
- var insertAction = (data, action, config) => {
3030
+ function insertAction(data, action, config) {
3026
3031
  const emptyComponentData = {
3027
3032
  type: action.componentType,
3028
3033
  props: __spreadProps(__spreadValues({}, config.components[action.componentType].defaultProps || {}), {
@@ -3048,8 +3053,8 @@ var insertAction = (data, action, config) => {
3048
3053
  )
3049
3054
  })
3050
3055
  });
3051
- };
3052
- var reduceData = (data, action, config) => {
3056
+ }
3057
+ function reduceData(data, action, config) {
3053
3058
  if (action.type === "insert") {
3054
3059
  return insertAction(data, action, config);
3055
3060
  }
@@ -3198,7 +3203,7 @@ var reduceData = (data, action, config) => {
3198
3203
  return __spreadValues(__spreadValues({}, data), action.data(data));
3199
3204
  }
3200
3205
  return data;
3201
- };
3206
+ }
3202
3207
 
3203
3208
  // reducer/state.ts
3204
3209
  init_react_import();
@@ -3216,7 +3221,7 @@ var reduceUi = (ui, action) => {
3216
3221
  init_react_import();
3217
3222
 
3218
3223
  // reducer/index.ts
3219
- var storeInterceptor = (reducer, record, onAction) => {
3224
+ function storeInterceptor(reducer, record, onAction) {
3220
3225
  return (state, action) => {
3221
3226
  const newAppState = reducer(state, action);
3222
3227
  const isValidType = ![
@@ -3232,7 +3237,7 @@ var storeInterceptor = (reducer, record, onAction) => {
3232
3237
  onAction == null ? void 0 : onAction(action, newAppState, state);
3233
3238
  return newAppState;
3234
3239
  };
3235
- };
3240
+ }
3236
3241
  var setAction = (state, action) => {
3237
3242
  if (typeof action.state === "object") {
3238
3243
  return __spreadValues(__spreadValues({}, state), action.state);
@@ -3347,28 +3352,30 @@ var applyDynamicProps = (data, dynamicProps, rootData) => {
3347
3352
  // lib/resolve-root-data.ts
3348
3353
  init_react_import();
3349
3354
  var cache3 = {};
3350
- var resolveRootData = (data, config) => __async(void 0, null, function* () {
3351
- var _a, _b, _c, _d, _e;
3352
- if (((_a = config.root) == null ? void 0 : _a.resolveData) && data.root.props) {
3353
- if (((_b = cache3.lastChange) == null ? void 0 : _b.original) === data.root) {
3354
- return cache3.lastChange.resolved;
3355
+ function resolveRootData(data, config) {
3356
+ return __async(this, null, function* () {
3357
+ var _a, _b, _c, _d, _e;
3358
+ if (((_a = config.root) == null ? void 0 : _a.resolveData) && data.root.props) {
3359
+ if (((_b = cache3.lastChange) == null ? void 0 : _b.original) === data.root) {
3360
+ return cache3.lastChange.resolved;
3361
+ }
3362
+ const changed = getChanged(data.root, (_c = cache3.lastChange) == null ? void 0 : _c.original);
3363
+ const rootWithProps = data.root;
3364
+ const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
3365
+ changed,
3366
+ lastData: ((_d = cache3.lastChange) == null ? void 0 : _d.original) || {}
3367
+ });
3368
+ cache3.lastChange = {
3369
+ original: data.root,
3370
+ resolved: resolvedRoot
3371
+ };
3372
+ return __spreadProps(__spreadValues(__spreadValues({}, data.root), resolvedRoot), {
3373
+ props: __spreadValues(__spreadValues({}, data.root.props), resolvedRoot.props)
3374
+ });
3355
3375
  }
3356
- const changed = getChanged(data.root, (_c = cache3.lastChange) == null ? void 0 : _c.original);
3357
- const rootWithProps = data.root;
3358
- const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
3359
- changed,
3360
- lastData: ((_d = cache3.lastChange) == null ? void 0 : _d.original) || {}
3361
- });
3362
- cache3.lastChange = {
3363
- original: data.root,
3364
- resolved: resolvedRoot
3365
- };
3366
- return __spreadProps(__spreadValues(__spreadValues({}, data.root), resolvedRoot), {
3367
- props: __spreadValues(__spreadValues({}, data.root.props), resolvedRoot.props)
3368
- });
3369
- }
3370
- return data.root;
3371
- });
3376
+ return data.root;
3377
+ });
3378
+ }
3372
3379
 
3373
3380
  // lib/use-resolved-data.ts
3374
3381
  var useResolvedData = (appState, config, dispatch) => {
@@ -3473,15 +3480,14 @@ var styles_module_default14 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpe
3473
3480
  // components/MenuBar/index.tsx
3474
3481
  var import_jsx_runtime27 = require("react/jsx-runtime");
3475
3482
  var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
3476
- var MenuBar = ({
3483
+ function MenuBar({
3477
3484
  appState,
3478
- data = { content: [], root: {} },
3479
3485
  dispatch,
3480
3486
  menuOpen = false,
3481
3487
  onPublish,
3482
3488
  renderHeaderActions,
3483
3489
  setMenuOpen
3484
- }) => {
3490
+ }) {
3485
3491
  const {
3486
3492
  history: { back, forward, historyStore }
3487
3493
  } = useAppContext();
@@ -3512,7 +3518,7 @@ var MenuBar = ({
3512
3518
  ] })
3513
3519
  }
3514
3520
  );
3515
- };
3521
+ }
3516
3522
 
3517
3523
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
3518
3524
  init_react_import();
@@ -3545,9 +3551,7 @@ var useResolvedFields = () => {
3545
3551
  const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
3546
3552
  const defaultFields = selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields;
3547
3553
  const rootProps = data.root.props || data.root;
3548
- const [lastSelectedData, setLastSelectedData] = (0, import_react20.useState)(
3549
- {}
3550
- );
3554
+ const [lastSelectedData, setLastSelectedData] = (0, import_react20.useState)({});
3551
3555
  const [resolvedFields, setResolvedFields] = (0, import_react20.useState)(defaultFields || {});
3552
3556
  const [fieldsLoading, setFieldsLoading] = (0, import_react20.useState)(false);
3553
3557
  const defaultResolveFields = (_componentData, _params) => defaultFields;
@@ -3710,7 +3714,7 @@ var Fields = () => {
3710
3714
  `${selectedItem.props.id}_${fieldName}`
3711
3715
  );
3712
3716
  } else {
3713
- const { readOnly = {} } = data.root;
3717
+ const readOnly = data.root.readOnly || {};
3714
3718
  return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3715
3719
  AutoFieldPrivate,
3716
3720
  {
@@ -4165,13 +4169,9 @@ var Preview = ({ id = "puck-preview" }) => {
4165
4169
  const Page = (0, import_react24.useCallback)(
4166
4170
  (pageProps) => {
4167
4171
  var _a, _b;
4168
- return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({
4172
+ return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadValues({
4169
4173
  id: "puck-root"
4170
- }, pageProps), {
4171
- editMode: true,
4172
- // DEPRECATED
4173
- puck: { renderDropZone: DropZone, isEditing: true }
4174
- })) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: pageProps.children });
4174
+ }, pageProps)) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: pageProps.children });
4175
4175
  },
4176
4176
  [config.root]
4177
4177
  );
@@ -4195,14 +4195,28 @@ var Preview = ({ id = "puck-preview" }) => {
4195
4195
  setStatus("READY");
4196
4196
  },
4197
4197
  children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(autoFrameContext.Consumer, { children: ({ document: document2 }) => {
4198
- const inner = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId }) }));
4198
+ const inner = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4199
+ Page,
4200
+ __spreadProps(__spreadValues({}, rootProps), {
4201
+ puck: { renderDropZone: DropZone, isEditing: true },
4202
+ editMode: true,
4203
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId })
4204
+ })
4205
+ );
4199
4206
  if (Frame) {
4200
4207
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Frame, { document: document2, children: inner });
4201
4208
  }
4202
4209
  return inner;
4203
4210
  } })
4204
4211
  }
4205
- ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { id: "preview-frame", className: getClassName23("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId }) })) })
4212
+ ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { id: "preview-frame", className: getClassName23("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4213
+ Page,
4214
+ __spreadProps(__spreadValues({}, rootProps), {
4215
+ puck: { renderDropZone: DropZone, isEditing: true },
4216
+ editMode: true,
4217
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId })
4218
+ })
4219
+ ) })
4206
4220
  }
4207
4221
  );
4208
4222
  };
@@ -4998,7 +5012,8 @@ var loadOverrides = ({
4998
5012
  }) => {
4999
5013
  const collected = __spreadValues({}, overrides);
5000
5014
  plugins == null ? void 0 : plugins.forEach((plugin) => {
5001
- Object.keys(plugin.overrides).forEach((overridesType) => {
5015
+ Object.keys(plugin.overrides).forEach((_overridesType) => {
5016
+ const overridesType = _overridesType;
5002
5017
  if (overridesType === "fieldTypes") {
5003
5018
  const fieldTypes = plugin.overrides.fieldTypes;
5004
5019
  Object.keys(fieldTypes).forEach((fieldType) => {
@@ -5038,7 +5053,7 @@ var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_mod
5038
5053
  function Puck({
5039
5054
  children,
5040
5055
  config,
5041
- data: initialData = { content: [], root: {} },
5056
+ data: initialData,
5042
5057
  ui: initialUi,
5043
5058
  onChange,
5044
5059
  onPublish,
@@ -5060,10 +5075,14 @@ function Puck({
5060
5075
  var _a;
5061
5076
  const historyStore = useHistoryStore(initialHistory);
5062
5077
  const [reducer] = (0, import_react31.useState)(
5063
- () => createReducer({ config, record: historyStore.record, onAction })
5078
+ () => createReducer({
5079
+ config,
5080
+ record: historyStore.record,
5081
+ onAction
5082
+ })
5064
5083
  );
5065
5084
  const [initialAppState] = (0, import_react31.useState)(() => {
5066
- var _a2, _b, _c, _d, _e, _f, _g;
5085
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
5067
5086
  const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
5068
5087
  let clientUiState = {};
5069
5088
  if (typeof window !== "undefined") {
@@ -5083,20 +5102,20 @@ function Puck({
5083
5102
  clientUiState = {
5084
5103
  viewports: __spreadProps(__spreadValues({}, initial.viewports), {
5085
5104
  current: __spreadProps(__spreadValues({}, initial.viewports.current), {
5086
- height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || viewports[closestViewport].height || "auto",
5087
- width: ((_d = (_c = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _c.current) == null ? void 0 : _d.width) || viewports[closestViewport].width
5105
+ height: ((_b = (_a2 = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _a2.current) == null ? void 0 : _b.height) || ((_c = viewports[closestViewport]) == null ? void 0 : _c.height) || "auto",
5106
+ width: ((_e = (_d = initialUi == null ? void 0 : initialUi.viewports) == null ? void 0 : _d.current) == null ? void 0 : _e.width) || ((_f = viewports[closestViewport]) == null ? void 0 : _f.width)
5088
5107
  })
5089
5108
  })
5090
5109
  };
5091
5110
  }
5092
5111
  }
5093
- if (Object.keys((initialData == null ? void 0 : initialData.root) || {}).length > 0 && !((_e = initialData == null ? void 0 : initialData.root) == null ? void 0 : _e.props)) {
5112
+ if (Object.keys((initialData == null ? void 0 : initialData.root) || {}).length > 0 && !((_g = initialData == null ? void 0 : initialData.root) == null ? void 0 : _g.props)) {
5094
5113
  console.error(
5095
5114
  "Warning: Defining props on `root` is deprecated. Please use `root.props`, or republish this page to migrate automatically."
5096
5115
  );
5097
5116
  }
5098
- const rootProps2 = ((_f = initialData == null ? void 0 : initialData.root) == null ? void 0 : _f.props) || (initialData == null ? void 0 : initialData.root) || {};
5099
- const defaultedRootProps = __spreadValues(__spreadValues({}, (_g = config.root) == null ? void 0 : _g.defaultProps), rootProps2);
5117
+ const rootProps2 = ((_h = initialData == null ? void 0 : initialData.root) == null ? void 0 : _h.props) || (initialData == null ? void 0 : initialData.root) || {};
5118
+ const defaultedRootProps = __spreadValues(__spreadValues({}, (_i = config.root) == null ? void 0 : _i.defaultProps), rootProps2);
5100
5119
  return __spreadProps(__spreadValues({}, defaultAppState), {
5101
5120
  data: __spreadProps(__spreadValues({}, initialData), {
5102
5121
  root: __spreadProps(__spreadValues({}, initialData == null ? void 0 : initialData.root), { props: defaultedRootProps }),
@@ -5388,7 +5407,7 @@ function Puck({
5388
5407
  }
5389
5408
  )
5390
5409
  ] }),
5391
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Heading, { rank: 2, size: "xs", children: [
5410
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Heading, { rank: "2", size: "xs", children: [
5392
5411
  headerTitle || rootProps.title || "Page",
5393
5412
  headerPath && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
5394
5413
  " ",
@@ -5416,7 +5435,6 @@ function Puck({
5416
5435
  MenuBar,
5417
5436
  {
5418
5437
  appState,
5419
- data,
5420
5438
  dispatch,
5421
5439
  onPublish,
5422
5440
  menuOpen,
@@ -5472,10 +5490,7 @@ Puck.Preview = Preview;
5472
5490
  // components/Render/index.tsx
5473
5491
  init_react_import();
5474
5492
  var import_jsx_runtime39 = require("react/jsx-runtime");
5475
- function Render({
5476
- config,
5477
- data
5478
- }) {
5493
+ function Render({ config, data }) {
5479
5494
  var _a;
5480
5495
  const defaultedData = __spreadProps(__spreadValues({}, data), {
5481
5496
  root: data.root || {},