@builder.io/mitosis 0.5.37 → 0.6.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.
|
@@ -68,9 +68,13 @@ const componentMappers = {
|
|
|
68
68
|
}),
|
|
69
69
|
Columns(node, options) {
|
|
70
70
|
const block = (0, exports.blockToBuilder)(node, options, { skipMapper: true });
|
|
71
|
-
const columns = block.children.map((item) =>
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
const columns = block.children.map((item) => {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
return ({
|
|
74
|
+
blocks: item.children,
|
|
75
|
+
width: (_b = (_a = item.component) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.width,
|
|
76
|
+
});
|
|
77
|
+
});
|
|
74
78
|
block.component.options.columns = columns;
|
|
75
79
|
block.children = [];
|
|
76
80
|
return block;
|
|
@@ -25,13 +25,17 @@ const collectStyles = (json, options = {}) => {
|
|
|
25
25
|
const componentIndexes = {};
|
|
26
26
|
const componentHashes = {};
|
|
27
27
|
(0, legacy_1.default)(json).forEach(function (item) {
|
|
28
|
-
var _a;
|
|
28
|
+
var _a, _b;
|
|
29
29
|
if ((0, is_mitosis_node_1.isMitosisNode)(item)) {
|
|
30
30
|
if ((0, helpers_1.nodeHasCss)(item)) {
|
|
31
31
|
const value = (0, helpers_1.parseCssObject)((_a = item.bindings.css) === null || _a === void 0 ? void 0 : _a.code);
|
|
32
32
|
delete item.bindings.css;
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
// Clean the name by keeping only alphanumeric characters, underscores, and dashes
|
|
34
|
+
const cleanedName = (_b = item.properties.$name) === null || _b === void 0 ? void 0 : _b.replace(/[^a-zA-Z0-9_-]/g, '');
|
|
35
|
+
// Remove leading numbers or dashes
|
|
36
|
+
const normalizedName = cleanedName === null || cleanedName === void 0 ? void 0 : cleanedName.replace(/^[0-9-]+/, '');
|
|
37
|
+
const componentName = normalizedName
|
|
38
|
+
? (0, dash_case_1.dashCase)(normalizedName)
|
|
35
39
|
: /^h\d$/.test(item.name || '') // don't dashcase h1 into h-1
|
|
36
40
|
? item.name
|
|
37
41
|
: (0, dash_case_1.dashCase)(item.name || 'div');
|