{"size": 1109, "ext": "js", "max_stars_repo_path": "dist/package/models/Width/WidthModel.js", "max_stars_repo_name": "siriwatknp/gatsby-mui-layout", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "dist/package/models/Width/WidthModel.js", "max_issues_repo_name": "siriwatknp/gatsby-mui-layout", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "dist/package/models/Width/WidthModel.js", "max_forks_repo_name": "siriwatknp/gatsby-mui-layout", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 30.8055555556, "max_line_length": 89, "alphanum_fraction": 0.5761947701}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../../utils");
exports.getCssWidth = (externalGap) => {
    if (typeof externalGap === "string") {
        return `calc(100% - (${externalGap}))`;
    }
    if (typeof externalGap === "number") {
        if (externalGap === 0)
            return "100%";
        return `calc(100% - ${externalGap}px)`;
    }
    return "auto";
};
exports.sumExternalGap = (a, b) => {
    if (utils_1.isNilOrEmpty(a) && utils_1.isNilOrEmpty(b))
        return undefined;
    if (a === 0 && b === 0)
        return 0;
    if (!a && b)
        return b;
    if (a && !b)
        return a;
    return `${utils_1.toValidCssValue(a)} + ${utils_1.toValidCssValue(b)}`;
};
const createWidthInterface = (externalGap) => {
    return {
        value: externalGap,
        combine: w => createWidthInterface(exports.sumExternalGap(externalGap, w.value)),
        getStyle: () => ({
            width: exports.getCssWidth(externalGap),
        }),
    };
};
exports.default = createWidthInterface;
//# sourceMappingURL=WidthModel.js.map