|
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
exports.default = void 0;
|
|
|
|
var _node = _interopRequireDefault(require("./node"));
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
|
|
|
/**
|
|
* Represents a CSS declaration.
|
|
*
|
|
* @extends Node
|
|
*
|
|
* @example
|
|
* const root = postcss.parse('a { color: black }')
|
|
* const decl = root.first.first
|
|
* decl.type //=> 'decl'
|
|
* decl.toString() //=> ' color: black'
|
|
*/
|
|
var Declaration =
|
|
/*#__PURE__*/
|
|
function (_Node) {
|
|
_inheritsLoose(Declaration, _Node);
|
|
|
|
function Declaration(defaults) {
|
|
var _this;
|
|
|
|
_this = _Node.call(this, defaults) || this;
|
|
_this.type = 'decl';
|
|
return _this;
|
|
}
|
|
/**
|
|
* @memberof Declaration#
|
|
* @member {string} prop The declaration’s property name.
|
|
*
|
|
* @example
|
|
* const root = postcss.parse('a { color: black }')
|
|
* const decl = root.first.first
|
|
* decl.prop //=> 'color'
|
|
*/
|
|
|
|
/**
|
|
* @memberof Declaration#
|
|
* @member {string} value The declaration’s value.
|
|
*
|
|
* @example
|
|
* const root = postcss.parse('a { color: black }')
|
|
* const decl = root.first.first
|
|
* decl.value //=> 'black'
|
|
*/
|
|
|
|
/**
|
|
* @memberof Declaration#
|
|
* @member {boolean} important `true` if the declaration
|
|
* has an !important annotation.
|
|
*
|
|
* @example
|
|
* const root = postcss.parse('a { color: black !important; color: red }')
|
|
* root.first.first.important //=> true
|
|
* root.first.last.important //=> undefined
|
|
*/
|
|
|
|
/**
|
|
* @memberof Declaration#
|
|
* @member {object} raws Information to generate byte-to-byte equal
|
|
* node string as it was in the origin input.
|
|
*
|
|
* Every parser saves its own properties,
|
|
* but the default CSS parser uses:
|
|
*
|
|
* * `before`: the space symbols before the node. It also stores `*`
|
|
* and `_` symbols before the declaration (IE hack).
|
|
* * `between`: the symbols between the property and value
|
|
* for declarations.
|
|
* * `important`: the content of the important statement,
|
|
* if it is not just `!important`.
|
|
*
|
|
* PostCSS cleans declaration from comments and extra spaces,
|
|
* but it stores origin content in raws properties.
|
|
* As such, if you don’t change a declaration’s value,
|
|
* PostCSS will use the raw value with comments.
|
|
*
|
|
* @example
|
|
* const root = postcss.parse('a {\n color:black\n}')
|
|
* root.first.first.raws //=> { before: '\n ', between: ':' }
|
|
*/
|
|
|
|
|
|
return Declaration;
|
|
}(_node.default);
|
|
|
|
var _default = Declaration;
|
|
exports.default = _default;
|
|
module.exports = exports.default;
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRlY2xhcmF0aW9uLmVzNiJdLCJuYW1lcyI6WyJEZWNsYXJhdGlvbiIsImRlZmF1bHRzIiwidHlwZSIsIk5vZGUiXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUE7Ozs7OztBQUVBOzs7Ozs7Ozs7OztJQVdNQSxXOzs7OztBQUNKLHVCQUFhQyxRQUFiLEVBQXVCO0FBQUE7O0FBQ3JCLDZCQUFNQSxRQUFOO0FBQ0EsVUFBS0MsSUFBTCxHQUFZLE1BQVo7QUFGcUI7QUFHdEI7QUFFRDs7Ozs7Ozs7OztBQVVBOzs7Ozs7Ozs7O0FBVUE7Ozs7Ozs7Ozs7O0FBV0E7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztFQXJDd0JDLGE7O2VBK0RYSCxXIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IE5vZGUgZnJvbSAnLi9ub2RlJ1xuXG4vKipcbiAqIFJlcHJlc2VudHMgYSBDU1MgZGVjbGFyYXRpb24uXG4gKlxuICogQGV4dGVuZHMgTm9kZVxuICpcbiAqIEBleGFtcGxlXG4gKiBjb25zdCByb290ID0gcG9zdGNzcy5wYXJzZSgnYSB7IGNvb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