@next-core/brick-utils 2.50.4 → 2.51.1
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.bundle.js +38 -2
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +38 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/types/scanStoryboard.d.ts +1 -1
- package/package.json +3 -3
package/dist/index.bundle.js
CHANGED
|
@@ -17690,7 +17690,7 @@
|
|
|
17690
17690
|
}, parseBrickProperties(brick.properties)), {}, {
|
|
17691
17691
|
context: parseContext(brick.context)
|
|
17692
17692
|
})), {}, {
|
|
17693
|
-
children: parseSlots(brick.slots, options)
|
|
17693
|
+
children: parseSlots(childrenToSlots(brick.children, brick.slots), options)
|
|
17694
17694
|
});
|
|
17695
17695
|
}
|
|
17696
17696
|
function parseCondition(condition) {
|
|
@@ -17798,6 +17798,29 @@
|
|
|
17798
17798
|
});
|
|
17799
17799
|
}
|
|
17800
17800
|
}
|
|
17801
|
+
function childrenToSlots(children, originalSlots) {
|
|
17802
|
+
var newSlots = originalSlots;
|
|
17803
|
+
// istanbul ignore next
|
|
17804
|
+
if (process.env.NODE_ENV === "development" && children && !Array.isArray(children)) {
|
|
17805
|
+
// eslint-disable-next-line no-console
|
|
17806
|
+
console.warn("Specified brick children but not array:", "<".concat(typeof children, ">"), children);
|
|
17807
|
+
}
|
|
17808
|
+
if (Array.isArray(children) && !newSlots) {
|
|
17809
|
+
newSlots = {};
|
|
17810
|
+
for (var child of children) {
|
|
17811
|
+
var _slot;
|
|
17812
|
+
var slot = (_slot = child.slot) !== null && _slot !== void 0 ? _slot : "";
|
|
17813
|
+
if (!Object.prototype.hasOwnProperty.call(newSlots, slot)) {
|
|
17814
|
+
newSlots[slot] = {
|
|
17815
|
+
type: "bricks",
|
|
17816
|
+
bricks: []
|
|
17817
|
+
};
|
|
17818
|
+
}
|
|
17819
|
+
newSlots[slot].bricks.push(child);
|
|
17820
|
+
}
|
|
17821
|
+
}
|
|
17822
|
+
return newSlots;
|
|
17823
|
+
}
|
|
17801
17824
|
function parseSlots(slots, options) {
|
|
17802
17825
|
if (isObject(slots)) {
|
|
17803
17826
|
return Object.entries(slots).map(_ref2 => {
|
|
@@ -18242,10 +18265,21 @@
|
|
|
18242
18265
|
var v3Processors = new Set();
|
|
18243
18266
|
if ((bricks === null || bricks === void 0 ? void 0 : bricks.length) > 0 || (processors === null || processors === void 0 ? void 0 : processors.length) > 0 || (editorBricks === null || editorBricks === void 0 ? void 0 : editorBricks.length) > 0) {
|
|
18244
18267
|
var brickMap = getBrickToPackageMap(brickPackages);
|
|
18268
|
+
var v3DefinedBricks = new Set();
|
|
18269
|
+
for (var pkg of brickPackages) {
|
|
18270
|
+
var {
|
|
18271
|
+
id,
|
|
18272
|
+
elements
|
|
18273
|
+
} = pkg;
|
|
18274
|
+
if (id && elements !== null && elements !== void 0 && elements.length) {
|
|
18275
|
+
for (var element of elements) {
|
|
18276
|
+
v3DefinedBricks.add(element);
|
|
18277
|
+
}
|
|
18278
|
+
}
|
|
18279
|
+
}
|
|
18245
18280
|
[...(bricks !== null && bricks !== void 0 ? bricks : []).map(n => [n]), ...(processors !== null && processors !== void 0 ? processors : []).map(n => [n, true])].forEach(_ref2 => {
|
|
18246
18281
|
var [name, isProcessor] = _ref2;
|
|
18247
18282
|
// ignore custom template
|
|
18248
|
-
// istanbul ignore else
|
|
18249
18283
|
if (name.includes(".")) {
|
|
18250
18284
|
var namespace = name.split(".")[0];
|
|
18251
18285
|
// processor 是 camelCase 格式,转成 brick 的 param-case 格式,统一去判断
|
|
@@ -18268,6 +18302,8 @@
|
|
|
18268
18302
|
// eslint-disable-next-line no-console
|
|
18269
18303
|
console.error("".concat(isProcessor ? "Processor" : "Brick", " `").concat(name, "` does not match any brick package"));
|
|
18270
18304
|
}
|
|
18305
|
+
} else if (!name.startsWith("tpl-") && v3DefinedBricks.has(name)) {
|
|
18306
|
+
v3Bricks.add(name);
|
|
18271
18307
|
}
|
|
18272
18308
|
});
|
|
18273
18309
|
editorBricks === null || editorBricks === void 0 ? void 0 : editorBricks.forEach(editor => {
|