You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB

2 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. function _export(target, all) {
  6. for(var name in all)Object.defineProperty(target, name, {
  7. enumerable: true,
  8. get: all[name]
  9. });
  10. }
  11. _export(exports, {
  12. asClass: ()=>asClass,
  13. default: ()=>nameClass,
  14. formatClass: ()=>formatClass
  15. });
  16. const _escapeClassName = /*#__PURE__*/ _interopRequireDefault(require("./escapeClassName"));
  17. const _escapeCommas = /*#__PURE__*/ _interopRequireDefault(require("./escapeCommas"));
  18. function _interopRequireDefault(obj) {
  19. return obj && obj.__esModule ? obj : {
  20. default: obj
  21. };
  22. }
  23. function asClass(name) {
  24. return (0, _escapeCommas.default)(`.${(0, _escapeClassName.default)(name)}`);
  25. }
  26. function nameClass(classPrefix, key) {
  27. return asClass(formatClass(classPrefix, key));
  28. }
  29. function formatClass(classPrefix, key) {
  30. if (key === "DEFAULT") {
  31. return classPrefix;
  32. }
  33. if (key === "-" || key === "-DEFAULT") {
  34. return `-${classPrefix}`;
  35. }
  36. if (key.startsWith("-")) {
  37. return `-${classPrefix}${key}`;
  38. }
  39. return `${classPrefix}-${key}`;
  40. }