create-jd-app
Version:
Create modern type safed Solid web application within seconds
17 lines (16 loc) • 769 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStyle = exports.resolveProviders = void 0;
const SPACES_PER_LINE = 5;
const ADD_SPACES_PER_LINE = 2;
function resolveProviders(providers, children, spaces = SPACES_PER_LINE) {
const SPACES = " ".repeat(spaces - 1);
if (!providers.length)
return children.map((child) => `${SPACES}${child}`).join("\n");
const el = providers.shift();
const elWithoutProps = el.split(" ").shift();
return `${SPACES}<${el}>\n${resolveProviders(providers, children, spaces + ADD_SPACES_PER_LINE)}\n${SPACES}</${elWithoutProps}>`;
}
exports.resolveProviders = resolveProviders;
const getStyle = (useTW, style) => useTW ? ` class="${style}"` : "";
exports.getStyle = getStyle;