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.

68 lines
2.2 KiB

2 years ago
  1. "use strict";
  2. exports.__esModule = true;
  3. exports["default"] = void 0;
  4. var _cssesc = _interopRequireDefault(require("cssesc"));
  5. var _util = require("../util");
  6. var _node = _interopRequireDefault(require("./node"));
  7. var _types = require("./types");
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  9. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  10. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  11. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
  12. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  13. var ClassName = /*#__PURE__*/function (_Node) {
  14. _inheritsLoose(ClassName, _Node);
  15. function ClassName(opts) {
  16. var _this;
  17. _this = _Node.call(this, opts) || this;
  18. _this.type = _types.CLASS;
  19. _this._constructed = true;
  20. return _this;
  21. }
  22. var _proto = ClassName.prototype;
  23. _proto.valueToString = function valueToString() {
  24. return '.' + _Node.prototype.valueToString.call(this);
  25. };
  26. _createClass(ClassName, [{
  27. key: "value",
  28. get: function get() {
  29. return this._value;
  30. },
  31. set: function set(v) {
  32. if (this._constructed) {
  33. var escaped = (0, _cssesc["default"])(v, {
  34. isIdentifier: true
  35. });
  36. if (escaped !== v) {
  37. (0, _util.ensureObject)(this, "raws");
  38. this.raws.value = escaped;
  39. } else if (this.raws) {
  40. delete this.raws.value;
  41. }
  42. }
  43. this._value = v;
  44. }
  45. }]);
  46. return ClassName;
  47. }(_node["default"]);
  48. exports["default"] = ClassName;
  49. module.exports = exports.default;