@measured/puck-plugin-heading-analyzer 0.15.0-canary.480467a → 0.15.0-canary.aedd401

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/dist/index.js +27 -15
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -79567,7 +79567,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79567
79567
  () => createReducer({ config, record: historyStore.record })
79568
79568
  );
79569
79569
  const [initialAppState] = (0, import_react29.useState)(() => {
79570
- var _a22, _b, _c, _d, _e;
79570
+ var _a22, _b, _c, _d, _e, _f;
79571
79571
  const initial = __spreadValues2(__spreadValues2({}, defaultAppState2.ui), initialUi);
79572
79572
  let clientUiState = {};
79573
79573
  if (typeof window !== "undefined") {
@@ -79594,11 +79594,12 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79594
79594
  };
79595
79595
  }
79596
79596
  }
79597
- const rootProps2 = initialData.root.props || initialData.root;
79598
- const defaultedRootProps = __spreadValues2(__spreadValues2({}, (_e = config.root) == null ? void 0 : _e.defaultProps), rootProps2);
79597
+ const rootProps2 = ((_e = initialData == null ? void 0 : initialData.root) == null ? void 0 : _e.props) || initialData.root || {};
79598
+ const defaultedRootProps = __spreadValues2(__spreadValues2({}, (_f = config.root) == null ? void 0 : _f.defaultProps), rootProps2);
79599
79599
  return __spreadProps2(__spreadValues2({}, defaultAppState2), {
79600
79600
  data: __spreadProps2(__spreadValues2({}, initialData), {
79601
- root: defaultedRootProps
79601
+ root: defaultedRootProps,
79602
+ content: initialData.content || []
79602
79603
  }),
79603
79604
  ui: __spreadProps2(__spreadValues2(__spreadValues2({}, initial), clientUiState), {
79604
79605
  // Store categories under componentList on state to allow render functions and plugins to modify
@@ -79964,10 +79965,14 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79964
79965
  data
79965
79966
  }) {
79966
79967
  var _a3;
79967
- const rootProps = data.root.props || data.root;
79968
+ const defaultedData = __spreadProps2(__spreadValues2({}, data), {
79969
+ root: data.root || {},
79970
+ content: data.content || []
79971
+ });
79972
+ const rootProps = defaultedData.root.props || defaultedData.root;
79968
79973
  const title = (rootProps == null ? void 0 : rootProps.title) || "";
79969
79974
  if ((_a3 = config.root) == null ? void 0 : _a3.render) {
79970
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
79975
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
79971
79976
  config.root.render,
79972
79977
  __spreadProps2(__spreadValues2({}, rootProps), {
79973
79978
  puck: {
@@ -79980,7 +79985,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
79980
79985
  })
79981
79986
  ) });
79982
79987
  }
79983
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId2 }) });
79988
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DropZone, { zone: rootDroppableId2 }) });
79984
79989
  }
79985
79990
  init_react_import2();
79986
79991
  var migrations = [
@@ -80004,6 +80009,11 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80004
80009
  return migrations == null ? void 0 : migrations.reduce((acc, migration) => migration(acc), data);
80005
80010
  }
80006
80011
  init_react_import2();
80012
+ init_react_import2();
80013
+ var defaultData = (data) => __spreadProps2(__spreadValues2({}, data), {
80014
+ root: data.root || {},
80015
+ content: data.content || []
80016
+ });
80007
80017
  function transformProps(data, propTransforms) {
80008
80018
  const mapItem = (item) => {
80009
80019
  if (propTransforms[item.type]) {
@@ -80013,18 +80023,19 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80013
80023
  }
80014
80024
  return item;
80015
80025
  };
80016
- const rootProps = data.root.props || data.root;
80017
- let newRoot = __spreadValues2({}, data.root);
80026
+ const defaultedData = defaultData(data);
80027
+ const rootProps = defaultedData.root.props || defaultedData.root;
80028
+ let newRoot = __spreadValues2({}, defaultedData.root);
80018
80029
  if (propTransforms["root"]) {
80019
- if (data.root.props) {
80030
+ if (defaultedData.root.props) {
80020
80031
  newRoot.props = propTransforms["root"](rootProps);
80021
80032
  } else {
80022
80033
  newRoot = propTransforms["root"](rootProps);
80023
80034
  }
80024
80035
  }
80025
- const afterPropTransforms = __spreadProps2(__spreadValues2({}, data), {
80036
+ const afterPropTransforms = __spreadProps2(__spreadValues2({}, defaultedData), {
80026
80037
  root: newRoot,
80027
- content: data.content.map(mapItem),
80038
+ content: defaultedData.content.map(mapItem),
80028
80039
  zones: Object.keys(data.zones || {}).reduce(
80029
80040
  (acc, zoneKey) => __spreadProps2(__spreadValues2({}, acc), {
80030
80041
  [zoneKey]: data.zones[zoneKey].map(mapItem)
@@ -80037,7 +80048,8 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80037
80048
  init_react_import2();
80038
80049
  function resolveAllData(data, config, onResolveStart, onResolveEnd) {
80039
80050
  return __async2(this, null, function* () {
80040
- const dynamicRoot = yield resolveRootData(data, config);
80051
+ const defaultedData = defaultData(data);
80052
+ const dynamicRoot = yield resolveRootData(defaultedData, config);
80041
80053
  const { zones = {} } = data;
80042
80054
  const zoneKeys = Object.keys(zones);
80043
80055
  const resolvedZones = {};
@@ -80050,10 +80062,10 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
80050
80062
  onResolveEnd
80051
80063
  );
80052
80064
  }
80053
- return __spreadProps2(__spreadValues2({}, data), {
80065
+ return __spreadProps2(__spreadValues2({}, defaultedData), {
80054
80066
  root: dynamicRoot,
80055
80067
  content: yield resolveAllComponentData(
80056
- data.content,
80068
+ defaultedData.content,
80057
80069
  config,
80058
80070
  onResolveStart,
80059
80071
  onResolveEnd
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck-plugin-heading-analyzer",
3
- "version": "0.15.0-canary.480467a",
3
+ "version": "0.15.0-canary.aedd401",
4
4
  "author": "Measured Corporation Ltd <hello@measured.co>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",
@@ -18,7 +18,7 @@
18
18
  "dist"
19
19
  ],
20
20
  "devDependencies": {
21
- "@measured/puck": "^0.15.0-canary.480467a",
21
+ "@measured/puck": "^0.15.0-canary.aedd401",
22
22
  "@types/react": "^18.2.0",
23
23
  "@types/react-dom": "^18.2.0",
24
24
  "eslint": "^7.32.0",