www_hero/node_modules/tailwindcss/lib/util/nameClass.js

33 lines
937 B
JavaScript
Raw Permalink Normal View History

2024-05-03 04:39:20 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = nameClass;
exports.asClass = asClass;
exports.formatClass = formatClass;
var _escapeClassName = _interopRequireDefault(require("./escapeClassName"));
var _escapeCommas = _interopRequireDefault(require("./escapeCommas"));
function nameClass(classPrefix, key) {
return asClass(formatClass(classPrefix, key));
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function asClass(name) {
return (0, _escapeCommas).default(`.${(0, _escapeClassName).default(name)}`);
}
function formatClass(classPrefix, key) {
if (key === "DEFAULT") {
return classPrefix;
}
if (key === "-" || key === "-DEFAULT") {
return `-${classPrefix}`;
}
if (key.startsWith("-")) {
return `-${classPrefix}${key}`;
}
return `${classPrefix}-${key}`;
}