[6a3a178] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
---|
| 4 |
|
---|
| 5 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
|
---|
| 6 |
|
---|
| 7 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
---|
| 8 |
|
---|
| 9 | var list = require('postcss').list;
|
---|
| 10 |
|
---|
| 11 | var Value = require('../value');
|
---|
| 12 |
|
---|
| 13 | var CrossFade = /*#__PURE__*/function (_Value) {
|
---|
| 14 | _inheritsLoose(CrossFade, _Value);
|
---|
| 15 |
|
---|
| 16 | function CrossFade() {
|
---|
| 17 | return _Value.apply(this, arguments) || this;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | var _proto = CrossFade.prototype;
|
---|
| 21 |
|
---|
| 22 | _proto.replace = function replace(string, prefix) {
|
---|
| 23 | var _this = this;
|
---|
| 24 |
|
---|
| 25 | return list.space(string).map(function (value) {
|
---|
| 26 | if (value.slice(0, +_this.name.length + 1) !== _this.name + '(') {
|
---|
| 27 | return value;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | var close = value.lastIndexOf(')');
|
---|
| 31 | var after = value.slice(close + 1);
|
---|
| 32 | var args = value.slice(_this.name.length + 1, close);
|
---|
| 33 |
|
---|
| 34 | if (prefix === '-webkit-') {
|
---|
| 35 | var match = args.match(/\d*.?\d+%?/);
|
---|
| 36 |
|
---|
| 37 | if (match) {
|
---|
| 38 | args = args.slice(match[0].length).trim();
|
---|
| 39 | args += ", " + match[0];
|
---|
| 40 | } else {
|
---|
| 41 | args += ', 0.5';
|
---|
| 42 | }
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | return prefix + _this.name + '(' + args + ')' + after;
|
---|
| 46 | }).join(' ');
|
---|
| 47 | };
|
---|
| 48 |
|
---|
| 49 | return CrossFade;
|
---|
| 50 | }(Value);
|
---|
| 51 |
|
---|
| 52 | _defineProperty(CrossFade, "names", ['cross-fade']);
|
---|
| 53 |
|
---|
| 54 | module.exports = CrossFade; |
---|