[6a3a178] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | exports.__esModule = true;
|
---|
| 4 | exports.default = void 0;
|
---|
| 5 |
|
---|
| 6 | var _node = _interopRequireDefault(require("./node"));
|
---|
| 7 |
|
---|
| 8 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
---|
| 9 |
|
---|
| 10 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
---|
| 11 |
|
---|
| 12 | /**
|
---|
| 13 | * Represents a CSS declaration.
|
---|
| 14 | *
|
---|
| 15 | * @extends Node
|
---|
| 16 | *
|
---|
| 17 | * @example
|
---|
| 18 | * const root = postcss.parse('a { color: black }')
|
---|
| 19 | * const decl = root.first.first
|
---|
| 20 | * decl.type //=> 'decl'
|
---|
| 21 | * decl.toString() //=> ' color: black'
|
---|
| 22 | */
|
---|
| 23 | var Declaration = /*#__PURE__*/function (_Node) {
|
---|
| 24 | _inheritsLoose(Declaration, _Node);
|
---|
| 25 |
|
---|
| 26 | function Declaration(defaults) {
|
---|
| 27 | var _this;
|
---|
| 28 |
|
---|
| 29 | _this = _Node.call(this, defaults) || this;
|
---|
| 30 | _this.type = 'decl';
|
---|
| 31 | return _this;
|
---|
| 32 | }
|
---|
| 33 | /**
|
---|
| 34 | * @memberof Declaration#
|
---|
| 35 | * @member {string} prop The declaration’s property name.
|
---|
| 36 | *
|
---|
| 37 | * @example
|
---|
| 38 | * const root = postcss.parse('a { color: black }')
|
---|
| 39 | * const decl = root.first.first
|
---|
| 40 | * decl.prop //=> 'color'
|
---|
| 41 | */
|
---|
| 42 |
|
---|
| 43 | /**
|
---|
| 44 | * @memberof Declaration#
|
---|
| 45 | * @member {string} value The declaration’s value.
|
---|
| 46 | *
|
---|
| 47 | * @example
|
---|
| 48 | * const root = postcss.parse('a { color: black }')
|
---|
| 49 | * const decl = root.first.first
|
---|
| 50 | * decl.value //=> 'black'
|
---|
| 51 | */
|
---|
| 52 |
|
---|
| 53 | /**
|
---|
| 54 | * @memberof Declaration#
|
---|
| 55 | * @member {boolean} important `true` if the declaration
|
---|
| 56 | * has an !important annotation.
|
---|
| 57 | *
|
---|
| 58 | * @example
|
---|
| 59 | * const root = postcss.parse('a { color: black !important; color: red }')
|
---|
| 60 | * root.first.first.important //=> true
|
---|
| 61 | * root.first.last.important //=> undefined
|
---|
| 62 | */
|
---|
| 63 |
|
---|
| 64 | /**
|
---|
| 65 | * @memberof Declaration#
|
---|
| 66 | * @member {object} raws Information to generate byte-to-byte equal
|
---|
| 67 | * node string as it was in the origin input.
|
---|
| 68 | *
|
---|
| 69 | * Every parser saves its own properties,
|
---|
| 70 | * but the default CSS parser uses:
|
---|
| 71 | *
|
---|
| 72 | * * `before`: the space symbols before the node. It also stores `*`
|
---|
| 73 | * and `_` symbols before the declaration (IE hack).
|
---|
| 74 | * * `between`: the symbols between the property and value
|
---|
| 75 | * for declarations.
|
---|
| 76 | * * `important`: the content of the important statement,
|
---|
| 77 | * if it is not just `!important`.
|
---|
| 78 | *
|
---|
| 79 | * PostCSS cleans declaration from comments and extra spaces,
|
---|
| 80 | * but it stores origin content in raws properties.
|
---|
| 81 | * As such, if you don’t change a declaration’s value,
|
---|
| 82 | * PostCSS will use the raw value with comments.
|
---|
| 83 | *
|
---|
| 84 | * @example
|
---|
| 85 | * const root = postcss.parse('a {\n color:black\n}')
|
---|
| 86 | * root.first.first.raws //=> { before: '\n ', between: ':' }
|
---|
| 87 | */
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 | return Declaration;
|
---|
| 91 | }(_node.default);
|
---|
| 92 |
|
---|
| 93 | var _default = Declaration;
|
---|
| 94 | exports.default = _default;
|
---|
| 95 | module.exports = exports.default;
|
---|
| 96 | //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRlY2xhcmF0aW9uLmVzNiJdLCJuYW1lcyI6WyJEZWN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