@builder.io/mitosis
Version:
Write components once, run everywhere. Compiles to Vue, React, Solid, and Liquid. Import code from Figma and Builder.io
21 lines (20 loc) • 926 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseSlot = void 0;
const lodash_1 = require("lodash");
const children_1 = require("../helpers/children");
const mitosis_node_1 = require("../helpers/mitosis-node");
function parseSlot(json, node) {
var _a, _b;
const mitosisNode = (0, mitosis_node_1.createMitosisNode)();
mitosisNode.name = 'Slot';
if (node.attributes.length > 0 &&
node.attributes[0].value.length > 0 &&
((_a = node.attributes[0].value[0].data) === null || _a === void 0 ? void 0 : _a.trim().length)) {
const slotName = (0, lodash_1.upperFirst)((0, lodash_1.camelCase)((_b = node.attributes[0].value[0]) === null || _b === void 0 ? void 0 : _b.data));
mitosisNode.properties.name = slotName;
}
mitosisNode.children = (0, children_1.parseChildren)(json, node);
return mitosisNode;
}
exports.parseSlot = parseSlot;
;