@next-core/brick-utils 2.50.4 → 2.51.0

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.esm.js CHANGED
@@ -17684,7 +17684,7 @@ function parseBrick(brick, options) {
17684
17684
  }, parseBrickProperties(brick.properties)), {}, {
17685
17685
  context: parseContext(brick.context)
17686
17686
  })), {}, {
17687
- children: parseSlots(brick.slots, options)
17687
+ children: parseSlots(childrenToSlots(brick.children, brick.slots), options)
17688
17688
  });
17689
17689
  }
17690
17690
  function parseCondition(condition) {
@@ -17792,6 +17792,29 @@ function parseLifeCycles(lifeCycle) {
17792
17792
  });
17793
17793
  }
17794
17794
  }
17795
+ function childrenToSlots(children, originalSlots) {
17796
+ var newSlots = originalSlots;
17797
+ // istanbul ignore next
17798
+ if (process.env.NODE_ENV === "development" && children && !Array.isArray(children)) {
17799
+ // eslint-disable-next-line no-console
17800
+ console.warn("Specified brick children but not array:", "<".concat(typeof children, ">"), children);
17801
+ }
17802
+ if (Array.isArray(children) && !newSlots) {
17803
+ newSlots = {};
17804
+ for (var child of children) {
17805
+ var _slot;
17806
+ var slot = (_slot = child.slot) !== null && _slot !== void 0 ? _slot : "";
17807
+ if (!Object.prototype.hasOwnProperty.call(newSlots, slot)) {
17808
+ newSlots[slot] = {
17809
+ type: "bricks",
17810
+ bricks: []
17811
+ };
17812
+ }
17813
+ newSlots[slot].bricks.push(child);
17814
+ }
17815
+ }
17816
+ return newSlots;
17817
+ }
17795
17818
  function parseSlots(slots, options) {
17796
17819
  if (isObject(slots)) {
17797
17820
  return Object.entries(slots).map(_ref2 => {