@measured/puck-plugin-heading-analyzer 0.19.0-canary.af1dc891 → 0.19.0-canary.b22833ee

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.
package/dist/index.js CHANGED
@@ -523,6 +523,15 @@ function forRelatedZones(item, data, cb, path = []) {
523
523
 
524
524
  // ../core/lib/data/map-slots.ts
525
525
  init_react_import();
526
+
527
+ // ../core/lib/data/default-slots.ts
528
+ init_react_import();
529
+ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
530
+ (acc, fieldName) => fields[fieldName].type === "slot" ? __spreadValues({ [fieldName]: [] }, acc) : acc,
531
+ value
532
+ );
533
+
534
+ // ../core/lib/data/map-slots.ts
526
535
  var isPromise = (v) => !!v && typeof v.then === "function";
527
536
  var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
528
537
  var containsPromise = (arr) => arr.some(isPromise);
@@ -547,7 +556,7 @@ var walkField = ({
547
556
  }
548
557
  const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
549
558
  return walkField({
550
- value: el,
559
+ value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
551
560
  fields: fields2,
552
561
  map,
553
562
  id: el.props.id,
@@ -633,14 +642,14 @@ var walkObject = ({
633
642
  return flatten(newProps);
634
643
  };
635
644
  function mapSlots(item, map, config, recurseSlots = false) {
636
- var _a, _b, _c, _d;
645
+ var _a, _b, _c, _d, _e;
637
646
  const itemType = "type" in item ? item.type : "root";
638
647
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
639
648
  const newProps = walkObject({
640
- value: (_b = item.props) != null ? _b : {},
641
- fields: (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {},
649
+ value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
650
+ fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
642
651
  map,
643
- id: item.props ? (_d = item.props.id) != null ? _d : "root" : "root",
652
+ id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
644
653
  getPropPath: (k) => k,
645
654
  config,
646
655
  recurseSlots
package/dist/index.mjs CHANGED
@@ -511,6 +511,15 @@ function forRelatedZones(item, data, cb, path = []) {
511
511
 
512
512
  // ../core/lib/data/map-slots.ts
513
513
  init_react_import();
514
+
515
+ // ../core/lib/data/default-slots.ts
516
+ init_react_import();
517
+ var defaultSlots = (value, fields) => Object.keys(fields).reduce(
518
+ (acc, fieldName) => fields[fieldName].type === "slot" ? __spreadValues({ [fieldName]: [] }, acc) : acc,
519
+ value
520
+ );
521
+
522
+ // ../core/lib/data/map-slots.ts
514
523
  var isPromise = (v) => !!v && typeof v.then === "function";
515
524
  var flatten = (values) => values.reduce((acc, item) => __spreadValues(__spreadValues({}, acc), item), {});
516
525
  var containsPromise = (arr) => arr.some(isPromise);
@@ -535,7 +544,7 @@ var walkField = ({
535
544
  }
536
545
  const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
537
546
  return walkField({
538
- value: el,
547
+ value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
539
548
  fields: fields2,
540
549
  map,
541
550
  id: el.props.id,
@@ -621,14 +630,14 @@ var walkObject = ({
621
630
  return flatten(newProps);
622
631
  };
623
632
  function mapSlots(item, map, config, recurseSlots = false) {
624
- var _a, _b, _c, _d;
633
+ var _a, _b, _c, _d, _e;
625
634
  const itemType = "type" in item ? item.type : "root";
626
635
  const componentConfig = itemType === "root" ? config.root : (_a = config.components) == null ? void 0 : _a[itemType];
627
636
  const newProps = walkObject({
628
- value: (_b = item.props) != null ? _b : {},
629
- fields: (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {},
637
+ value: defaultSlots((_b = item.props) != null ? _b : {}, (_c = componentConfig == null ? void 0 : componentConfig.fields) != null ? _c : {}),
638
+ fields: (_d = componentConfig == null ? void 0 : componentConfig.fields) != null ? _d : {},
630
639
  map,
631
- id: item.props ? (_d = item.props.id) != null ? _d : "root" : "root",
640
+ id: item.props ? (_e = item.props.id) != null ? _e : "root" : "root",
632
641
  getPropPath: (k) => k,
633
642
  config,
634
643
  recurseSlots
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck-plugin-heading-analyzer",
3
- "version": "0.19.0-canary.af1dc891",
3
+ "version": "0.19.0-canary.b22833ee",
4
4
  "author": "Chris Villa <chris@puckeditor.com>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",
@@ -25,7 +25,7 @@
25
25
  "dist"
26
26
  ],
27
27
  "devDependencies": {
28
- "@measured/puck": "^0.19.0-canary.af1dc891",
28
+ "@measured/puck": "^0.19.0-canary.b22833ee",
29
29
  "@types/react": "^19.0.1",
30
30
  "@types/react-dom": "^19.0.2",
31
31
  "eslint": "^7.32.0",