nav tabs on admin dashboard

This commit is contained in:
2019-03-07 00:20:34 -06:00
parent f73d6ae228
commit e4f473f376
11661 changed files with 216240 additions and 1544253 deletions
+59 -63
View File
@@ -1,86 +1,82 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var AlignContent = function (_Declaration) {
_inherits(AlignContent, _Declaration);
var AlignContent =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(AlignContent, _Declaration);
function AlignContent() {
_classCallCheck(this, AlignContent);
function AlignContent() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = AlignContent.prototype;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2012) {
return prefix + 'flex-line-pack';
}
/**
* Change property name for 2012 spec
*/
AlignContent.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Return property name by final spec
*/
;
var _flexSpec = flexSpec(prefix);
_proto.normalize = function normalize() {
return 'align-content';
}
/**
* Change value for 2012 spec and ignore prefix for 2009
*/
;
spec = _flexSpec[0];
prefix = _flexSpec[1];
_proto.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2012) {
return prefix + 'flex-line-pack';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
if (spec === 2012) {
decl.value = AlignContent.oldValues[decl.value] || decl.value;
return _Declaration.prototype.set.call(this, decl, prefix);
}
/**
* Return property name by final spec
*/
if (spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
AlignContent.prototype.normalize = function normalize() {
return 'align-content';
};
/**
* Change value for 2012 spec and ignore prefix for 2009
*/
AlignContent.prototype.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2012) {
decl.value = AlignContent.oldValues[decl.value] || decl.value;
return _Declaration.prototype.set.call(this, decl, prefix);
} else if (spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
return AlignContent;
return AlignContent;
}(Declaration);
Object.defineProperty(AlignContent, 'names', {
enumerable: true,
writable: true,
value: ['align-content', 'flex-line-pack']
});
Object.defineProperty(AlignContent, 'oldValues', {
enumerable: true,
writable: true,
value: {
'flex-end': 'end',
'flex-start': 'start',
'space-between': 'justify',
'space-around': 'distribute'
}
});
_defineProperty(AlignContent, "names", ['align-content', 'flex-line-pack']);
_defineProperty(AlignContent, "oldValues", {
'flex-end': 'end',
'flex-start': 'start',
'space-between': 'justify',
'space-around': 'distribute'
/**
* Change property name for 2012 spec
*/
});
module.exports = AlignContent;
+56 -60
View File
@@ -1,83 +1,79 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var AlignItems = function (_Declaration) {
_inherits(AlignItems, _Declaration);
var AlignItems =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(AlignItems, _Declaration);
function AlignItems() {
_classCallCheck(this, AlignItems);
function AlignItems() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = AlignItems.prototype;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-align';
}
/**
* Change property name for 2009 and 2012 specs
*/
AlignItems.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
if (spec === 2012) {
return prefix + 'flex-align';
}
var _flexSpec = flexSpec(prefix);
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Return property name by final spec
*/
;
spec = _flexSpec[0];
prefix = _flexSpec[1];
_proto.normalize = function normalize() {
return 'align-items';
}
/**
* Change value for 2009 and 2012 specs
*/
;
if (spec === 2009) {
return prefix + 'box-align';
} else if (spec === 2012) {
return prefix + 'flex-align';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
_proto.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
/**
* Return property name by final spec
*/
if (spec === 2009 || spec === 2012) {
decl.value = AlignItems.oldValues[decl.value] || decl.value;
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
AlignItems.prototype.normalize = function normalize() {
return 'align-items';
};
/**
* Change value for 2009 and 2012 specs
*/
AlignItems.prototype.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2009 || spec === 2012) {
decl.value = AlignItems.oldValues[decl.value] || decl.value;
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
return AlignItems;
return AlignItems;
}(Declaration);
Object.defineProperty(AlignItems, 'names', {
enumerable: true,
writable: true,
value: ['align-items', 'flex-align', 'box-align']
});
Object.defineProperty(AlignItems, 'oldValues', {
enumerable: true,
writable: true,
value: {
'flex-end': 'end',
'flex-start': 'start'
}
});
_defineProperty(AlignItems, "names", ['align-items', 'flex-align', 'box-align']);
_defineProperty(AlignItems, "oldValues", {
'flex-end': 'end',
'flex-start': 'start'
/**
* Change property name for 2009 and 2012 specs
*/
});
module.exports = AlignItems;
+63 -61
View File
@@ -1,84 +1,86 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var AlignSelf = function (_Declaration) {
_inherits(AlignSelf, _Declaration);
var AlignSelf =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(AlignSelf, _Declaration);
function AlignSelf() {
_classCallCheck(this, AlignSelf);
function AlignSelf() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = AlignSelf.prototype;
_proto.check = function check(decl) {
return decl.parent && decl.parent.every(function (i) {
return !/^grid-/.test(i.prop);
});
}
/**
* Change property name for 2012 specs
*/
;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2012) {
return prefix + 'flex-item-align';
}
/**
* Change property name for 2012 specs
*/
AlignSelf.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Return property name by final spec
*/
;
var _flexSpec = flexSpec(prefix);
_proto.normalize = function normalize() {
return 'align-self';
}
/**
* Change value for 2012 spec and ignore prefix for 2009
*/
;
spec = _flexSpec[0];
prefix = _flexSpec[1];
_proto.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2012) {
return prefix + 'flex-item-align';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
if (spec === 2012) {
decl.value = AlignSelf.oldValues[decl.value] || decl.value;
return _Declaration.prototype.set.call(this, decl, prefix);
}
/**
* Return property name by final spec
*/
if (spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
AlignSelf.prototype.normalize = function normalize() {
return 'align-self';
};
/**
* Change value for 2012 spec and ignore prefix for 2009
*/
AlignSelf.prototype.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2012) {
decl.value = AlignSelf.oldValues[decl.value] || decl.value;
return _Declaration.prototype.set.call(this, decl, prefix);
} else if (spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
return AlignSelf;
return AlignSelf;
}(Declaration);
Object.defineProperty(AlignSelf, 'names', {
enumerable: true,
writable: true,
value: ['align-self', 'flex-item-align']
});
Object.defineProperty(AlignSelf, 'oldValues', {
enumerable: true,
writable: true,
value: {
'flex-end': 'end',
'flex-start': 'start'
}
});
_defineProperty(AlignSelf, "names", ['align-self', 'flex-item-align']);
_defineProperty(AlignSelf, "oldValues", {
'flex-end': 'end',
'flex-start': 'start'
});
module.exports = AlignSelf;
+22 -27
View File
@@ -1,42 +1,37 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var Animation = function (_Declaration) {
_inherits(Animation, _Declaration);
var Animation =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(Animation, _Declaration);
function Animation() {
_classCallCheck(this, Animation);
function Animation() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
var _proto = Animation.prototype;
/**
* Don’t add prefixes for modern values.
*/
Animation.prototype.check = function check(decl) {
return !decl.value.split(/\s+/).some(function (i) {
var lower = i.toLowerCase();
return lower === 'reverse' || lower === 'alternate-reverse';
});
};
/**
* Don’t add prefixes for modern values.
*/
_proto.check = function check(decl) {
return !decl.value.split(/\s+/).some(function (i) {
var lower = i.toLowerCase();
return lower === 'reverse' || lower === 'alternate-reverse';
});
};
return Animation;
return Animation;
}(Declaration);
Object.defineProperty(Animation, 'names', {
enumerable: true,
writable: true,
value: ['animation', 'animation-direction']
});
_defineProperty(Animation, "names", ['animation', 'animation-direction']);
module.exports = Animation;
+23 -26
View File
@@ -1,44 +1,41 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var utils = require('../utils');
var Appearance = function (_Declaration) {
_inherits(Appearance, _Declaration);
var Appearance =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(Appearance, _Declaration);
function Appearance(name, prefixes, all) {
_classCallCheck(this, Appearance);
function Appearance(name, prefixes, all) {
var _this;
var _this = _possibleConstructorReturn(this, _Declaration.call(this, name, prefixes, all));
_this = _Declaration.call(this, name, prefixes, all) || this;
if (_this.prefixes) {
_this.prefixes = utils.uniq(_this.prefixes.map(function (i) {
if (i === '-ms-') {
return '-webkit-';
} else {
return i;
}
}));
if (_this.prefixes) {
_this.prefixes = utils.uniq(_this.prefixes.map(function (i) {
if (i === '-ms-') {
return '-webkit-';
}
return _this;
return i;
}));
}
return Appearance;
return _this;
}
return Appearance;
}(Declaration);
Object.defineProperty(Appearance, 'names', {
enumerable: true,
writable: true,
value: ['appearance']
});
_defineProperty(Appearance, "names", ['appearance']);
module.exports = Appearance;
+24 -27
View File
@@ -1,43 +1,40 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var BackgroundSize = function (_Declaration) {
_inherits(BackgroundSize, _Declaration);
var BackgroundSize =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(BackgroundSize, _Declaration);
function BackgroundSize() {
_classCallCheck(this, BackgroundSize);
function BackgroundSize() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = BackgroundSize.prototype;
/**
* Duplication parameter for -webkit- browsers
*/
_proto.set = function set(decl, prefix) {
var value = decl.value.toLowerCase();
if (prefix === '-webkit-' && value.indexOf(' ') === -1 && value !== 'contain' && value !== 'cover') {
decl.value = decl.value + ' ' + decl.value;
}
/**
* Duplication parameter for -webkit- browsers
*/
BackgroundSize.prototype.set = function set(decl, prefix) {
var value = decl.value.toLowerCase();
if (prefix === '-webkit-' && value.indexOf(' ') === -1 && value !== 'contain' && value !== 'cover') {
decl.value = decl.value + ' ' + decl.value;
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
return _Declaration.prototype.set.call(this, decl, prefix);
};
return BackgroundSize;
return BackgroundSize;
}(Declaration);
Object.defineProperty(BackgroundSize, 'names', {
enumerable: true,
writable: true,
value: ['background-size']
});
_defineProperty(BackgroundSize, "names", ['background-size']);
module.exports = BackgroundSize;
+32 -34
View File
@@ -1,52 +1,50 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var BlockLogical = function (_Declaration) {
_inherits(BlockLogical, _Declaration);
var BlockLogical =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(BlockLogical, _Declaration);
function BlockLogical() {
_classCallCheck(this, BlockLogical);
function BlockLogical() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = BlockLogical.prototype;
/**
* Use old syntax for -moz- and -webkit-
*/
_proto.prefixed = function prefixed(prop, prefix) {
if (prop.indexOf('-start') !== -1) {
return prefix + prop.replace('-block-start', '-before');
}
/**
* Use old syntax for -moz- and -webkit-
*/
BlockLogical.prototype.prefixed = function prefixed(prop, prefix) {
return prefix + (prop.indexOf('-start') !== -1 ? prop.replace('-block-start', '-before') : prop.replace('-block-end', '-after'));
};
return prefix + prop.replace('-block-end', '-after');
}
/**
* Return property name by spec
*/
;
/**
* Return property name by spec
*/
_proto.normalize = function normalize(prop) {
if (prop.indexOf('-before') !== -1) {
return prop.replace('-before', '-block-start');
}
return prop.replace('-after', '-block-end');
};
BlockLogical.prototype.normalize = function normalize(prop) {
if (prop.indexOf('-before') !== -1) {
return prop.replace('-before', '-block-start');
} else {
return prop.replace('-after', '-block-end');
}
};
return BlockLogical;
return BlockLogical;
}(Declaration);
Object.defineProperty(BlockLogical, 'names', {
enumerable: true,
writable: true,
value: ['border-block-start', 'border-block-end', 'margin-block-start', 'margin-block-end', 'padding-block-start', 'padding-block-end', 'border-before', 'border-after', 'margin-before', 'margin-after', 'padding-before', 'padding-after']
});
_defineProperty(BlockLogical, "names", ['border-block-start', 'border-block-end', 'margin-block-start', 'margin-block-end', 'padding-block-start', 'padding-block-end', 'border-before', 'border-after', 'margin-before', 'margin-after', 'padding-before', 'padding-after']);
module.exports = BlockLogical;
+20 -25
View File
@@ -1,40 +1,35 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var BorderImage = function (_Declaration) {
_inherits(BorderImage, _Declaration);
var BorderImage =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(BorderImage, _Declaration);
function BorderImage() {
_classCallCheck(this, BorderImage);
function BorderImage() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
var _proto = BorderImage.prototype;
/**
* Remove fill parameter for prefixed declarations
*/
BorderImage.prototype.set = function set(decl, prefix) {
decl.value = decl.value.replace(/\s+fill(\s)/, '$1');
return _Declaration.prototype.set.call(this, decl, prefix);
};
/**
* Remove fill parameter for prefixed declarations
*/
_proto.set = function set(decl, prefix) {
decl.value = decl.value.replace(/\s+fill(\s)/, '$1');
return _Declaration.prototype.set.call(this, decl, prefix);
};
return BorderImage;
return BorderImage;
}(Declaration);
Object.defineProperty(BorderImage, 'names', {
enumerable: true,
writable: true,
value: ['border-image']
});
_defineProperty(BorderImage, "names", ['border-image']);
module.exports = BorderImage;
+45 -57
View File
@@ -1,79 +1,67 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var BorderRadius = function (_Declaration) {
_inherits(BorderRadius, _Declaration);
var BorderRadius =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(BorderRadius, _Declaration);
function BorderRadius() {
_classCallCheck(this, BorderRadius);
function BorderRadius() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = BorderRadius.prototype;
/**
* Change syntax, when add Mozilla prefix
*/
_proto.prefixed = function prefixed(prop, prefix) {
if (prefix === '-moz-') {
return prefix + (BorderRadius.toMozilla[prop] || prop);
}
/**
* Change syntax, when add Mozilla prefix
*/
BorderRadius.prototype.prefixed = function prefixed(prop, prefix) {
if (prefix === '-moz-') {
return prefix + (BorderRadius.toMozilla[prop] || prop);
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Return unprefixed version of property
*/
;
/**
* Return unprefixed version of property
*/
_proto.normalize = function normalize(prop) {
return BorderRadius.toNormal[prop] || prop;
};
BorderRadius.prototype.normalize = function normalize(prop) {
return BorderRadius.toNormal[prop] || prop;
};
return BorderRadius;
return BorderRadius;
}(Declaration);
Object.defineProperty(BorderRadius, 'names', {
enumerable: true,
writable: true,
value: ['border-radius']
});
Object.defineProperty(BorderRadius, 'toMozilla', {
enumerable: true,
writable: true,
value: {}
});
Object.defineProperty(BorderRadius, 'toNormal', {
enumerable: true,
writable: true,
value: {}
});
_defineProperty(BorderRadius, "names", ['border-radius']);
_defineProperty(BorderRadius, "toMozilla", {});
_defineProperty(BorderRadius, "toNormal", {});
var _arr = ['top', 'bottom'];
for (var _i = 0; _i < _arr.length; _i++) {
var ver = _arr[_i];var _arr2 = ['left', 'right'];
var ver = _arr[_i];
var _arr2 = ['left', 'right'];
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
var hor = _arr2[_i2];
var normal = 'border-' + ver + '-' + hor + '-radius';
var mozilla = 'border-radius-' + ver + hor;
BorderRadius.names.push(normal);
BorderRadius.names.push(mozilla);
BorderRadius.toMozilla[normal] = mozilla;
BorderRadius.toNormal[mozilla] = normal;
}
for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
var hor = _arr2[_i2];
var normal = "border-" + ver + "-" + hor + "-radius";
var mozilla = "border-radius-" + ver + hor;
BorderRadius.names.push(normal);
BorderRadius.names.push(mozilla);
BorderRadius.toMozilla[normal] = mozilla;
BorderRadius.toNormal[mozilla] = normal;
}
}
module.exports = BorderRadius;
+56 -65
View File
@@ -1,87 +1,78 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var BreakProps = function (_Declaration) {
_inherits(BreakProps, _Declaration);
var BreakProps =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(BreakProps, _Declaration);
function BreakProps() {
_classCallCheck(this, BreakProps);
function BreakProps() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = BreakProps.prototype;
/**
* Change name for -webkit- and -moz- prefix
*/
_proto.prefixed = function prefixed(prop, prefix) {
return prefix + "column-" + prop;
}
/**
* Return property name by final spec
*/
;
_proto.normalize = function normalize(prop) {
if (prop.indexOf('inside') !== -1) {
return 'break-inside';
}
/**
* Change name for -webkit- and -moz- prefix
*/
BreakProps.prototype.prefixed = function prefixed(prop, prefix) {
if (prefix === '-moz-') {
return 'page-' + prop;
} else {
return prefix + 'column-' + prop;
}
};
if (prop.indexOf('before') !== -1) {
return 'break-before';
}
/**
* Return property name by final spec
*/
return 'break-after';
}
/**
* Change prefixed value for avoid-column and avoid-page
*/
;
_proto.set = function set(decl, prefix) {
if (decl.prop === 'break-inside' && decl.value === 'avoid-column' || decl.value === 'avoid-page') {
decl.value = 'avoid';
}
BreakProps.prototype.normalize = function normalize(prop) {
if (prop.indexOf('inside') !== -1) {
return 'break-inside';
} else if (prop.indexOf('before') !== -1) {
return 'break-before';
} else {
return 'break-after';
}
};
return _Declaration.prototype.set.call(this, decl, prefix);
}
/**
* Don’t prefix some values
*/
;
/**
* Change prefixed value for avoid-column and avoid-page
*/
_proto.insert = function insert(decl, prefix, prefixes) {
if (decl.prop !== 'break-inside') {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
if (/region/i.test(decl.value) || /page/i.test(decl.value)) {
return undefined;
}
BreakProps.prototype.set = function set(decl, prefix) {
if (decl.prop === 'break-inside' && decl.value === 'avoid-column' || decl.value === 'avoid-page') {
decl.value = 'avoid';
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
};
/**
* Don’t prefix some values
*/
BreakProps.prototype.insert = function insert(decl, prefix, prefixes) {
if (decl.prop !== 'break-inside') {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
} else if (decl.value === 'avoid-region') {
return undefined;
} else if (decl.value === 'avoid-page' && prefix === '-webkit-') {
return undefined;
} else {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
};
return BreakProps;
return BreakProps;
}(Declaration);
Object.defineProperty(BreakProps, 'names', {
enumerable: true,
writable: true,
value: ['break-inside', 'page-break-inside', 'column-break-inside', 'break-before', 'page-break-before', 'column-break-before', 'break-after', 'page-break-after', 'column-break-after']
});
_defineProperty(BreakProps, "names", ['break-inside', 'page-break-inside', 'column-break-inside', 'break-before', 'page-break-before', 'column-break-before', 'break-after', 'page-break-after', 'column-break-after']);
module.exports = BreakProps;
+37 -39
View File
@@ -1,58 +1,56 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Value = require('../value');
var list = require('postcss').list;
var CrossFade = function (_Value) {
_inherits(CrossFade, _Value);
var CrossFade =
/*#__PURE__*/
function (_Value) {
_inheritsLoose(CrossFade, _Value);
function CrossFade() {
_classCallCheck(this, CrossFade);
function CrossFade() {
return _Value.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Value.apply(this, arguments));
}
var _proto = CrossFade.prototype;
CrossFade.prototype.replace = function replace(string, prefix) {
var _this2 = this;
_proto.replace = function replace(string, prefix) {
var _this = this;
return list.space(string).map(function (value) {
if (value.slice(0, +_this2.name.length + 1) !== _this2.name + '(') {
return value;
}
return list.space(string).map(function (value) {
if (value.slice(0, +_this.name.length + 1) !== _this.name + '(') {
return value;
}
var close = value.lastIndexOf(')');
var after = value.slice(close + 1);
var args = value.slice(_this2.name.length + 1, close);
var close = value.lastIndexOf(')');
var after = value.slice(close + 1);
var args = value.slice(_this.name.length + 1, close);
if (prefix === '-webkit-') {
var match = args.match(/\d*.?\d+%?/);
if (match) {
args = args.slice(match[0].length).trim();
args += ', ' + match[0];
} else {
args += ', 0.5';
}
}
return prefix + _this2.name + '(' + args + ')' + after;
}).join(' ');
};
if (prefix === '-webkit-') {
var match = args.match(/\d*.?\d+%?/);
return CrossFade;
if (match) {
args = args.slice(match[0].length).trim();
args += ", " + match[0];
} else {
args += ', 0.5';
}
}
return prefix + _this.name + '(' + args + ')' + after;
}).join(' ');
};
return CrossFade;
}(Value);
Object.defineProperty(CrossFade, 'names', {
enumerable: true,
writable: true,
value: ['cross-fade']
});
_defineProperty(CrossFade, "names", ['cross-fade']);
module.exports = CrossFade;
+67 -73
View File
@@ -1,102 +1,96 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var flexSpec = require('./flex-spec');
var OldValue = require('../old-value');
var Value = require('../value');
var DisplayFlex = function (_Value) {
_inherits(DisplayFlex, _Value);
var DisplayFlex =
/*#__PURE__*/
function (_Value) {
_inheritsLoose(DisplayFlex, _Value);
function DisplayFlex(name, prefixes) {
_classCallCheck(this, DisplayFlex);
function DisplayFlex(name, prefixes) {
var _this;
var _this = _possibleConstructorReturn(this, _Value.call(this, name, prefixes));
_this = _Value.call(this, name, prefixes) || this;
if (name === 'display-flex') {
_this.name = 'flex';
}
return _this;
if (name === 'display-flex') {
_this.name = 'flex';
}
/**
* Faster check for flex value
*/
return _this;
}
/**
* Faster check for flex value
*/
DisplayFlex.prototype.check = function check(decl) {
return decl.prop === 'display' && decl.value === this.name;
};
var _proto = DisplayFlex.prototype;
/**
* Return value by spec
*/
_proto.check = function check(decl) {
return decl.prop === 'display' && decl.value === this.name;
}
/**
* Return value by spec
*/
;
_proto.prefixed = function prefixed(prefix) {
var spec, value;
DisplayFlex.prototype.prefixed = function prefixed(prefix) {
var spec = void 0,
value = void 0;
var _flexSpec = flexSpec(prefix);
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
if (this.name === 'flex') {
value = 'box';
} else {
value = 'inline-box';
}
} else if (spec === 2012) {
if (this.name === 'flex') {
value = 'flexbox';
} else {
value = 'inline-flexbox';
}
} else if (spec === 'final') {
value = this.name;
}
return prefix + value;
}
/**
* Add prefix to value depend on flebox spec version
*/
;
if (spec === 2009) {
if (this.name === 'flex') {
value = 'box';
} else {
value = 'inline-box';
}
} else if (spec === 2012) {
if (this.name === 'flex') {
value = 'flexbox';
} else {
value = 'inline-flexbox';
}
} else if (spec === 'final') {
value = this.name;
}
_proto.replace = function replace(string, prefix) {
return this.prefixed(prefix);
}
/**
* Change value for old specs
*/
;
return prefix + value;
};
_proto.old = function old(prefix) {
var prefixed = this.prefixed(prefix);
if (!prefixed) return undefined;
return new OldValue(this.name, prefixed);
};
/**
* Add prefix to value depend on flebox spec version
*/
DisplayFlex.prototype.replace = function replace(string, prefix) {
return this.prefixed(prefix);
};
/**
* Change value for old specs
*/
DisplayFlex.prototype.old = function old(prefix) {
var prefixed = this.prefixed(prefix);
if (!prefixed) return undefined;
return new OldValue(this.name, prefixed);
};
return DisplayFlex;
return DisplayFlex;
}(Value);
Object.defineProperty(DisplayFlex, 'names', {
enumerable: true,
writable: true,
value: ['display-flex', 'inline-flex']
});
_defineProperty(DisplayFlex, "names", ['display-flex', 'inline-flex']);
module.exports = DisplayFlex;
+24 -27
View File
@@ -1,46 +1,43 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Value = require('../value');
var DisplayGrid = function (_Value) {
_inherits(DisplayGrid, _Value);
var DisplayGrid =
/*#__PURE__*/
function (_Value) {
_inheritsLoose(DisplayGrid, _Value);
function DisplayGrid(name, prefixes) {
_classCallCheck(this, DisplayGrid);
function DisplayGrid(name, prefixes) {
var _this;
var _this = _possibleConstructorReturn(this, _Value.call(this, name, prefixes));
_this = _Value.call(this, name, prefixes) || this;
if (name === 'display-grid') {
_this.name = 'grid';
}
return _this;
if (name === 'display-grid') {
_this.name = 'grid';
}
/**
* Faster check for flex value
*/
return _this;
}
/**
* Faster check for flex value
*/
DisplayGrid.prototype.check = function check(decl) {
return decl.prop === 'display' && decl.value === this.name;
};
var _proto = DisplayGrid.prototype;
return DisplayGrid;
_proto.check = function check(decl) {
return decl.prop === 'display' && decl.value === this.name;
};
return DisplayGrid;
}(Value);
Object.defineProperty(DisplayGrid, 'names', {
enumerable: true,
writable: true,
value: ['display-grid', 'inline-grid']
});
_defineProperty(DisplayGrid, "names", ['display-grid', 'inline-grid']);
module.exports = DisplayGrid;
+17 -21
View File
@@ -1,37 +1,33 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Value = require('../value');
var FilterValue = function (_Value) {
_inherits(FilterValue, _Value);
var FilterValue =
/*#__PURE__*/
function (_Value) {
_inheritsLoose(FilterValue, _Value);
function FilterValue(name, prefixes) {
_classCallCheck(this, FilterValue);
function FilterValue(name, prefixes) {
var _this;
var _this = _possibleConstructorReturn(this, _Value.call(this, name, prefixes));
_this = _Value.call(this, name, prefixes) || this;
if (name === 'filter-function') {
_this.name = 'filter';
}
return _this;
if (name === 'filter-function') {
_this.name = 'filter';
}
return FilterValue;
return _this;
}
return FilterValue;
}(Value);
Object.defineProperty(FilterValue, 'names', {
enumerable: true,
writable: true,
value: ['filter', 'filter-function']
});
_defineProperty(FilterValue, "names", ['filter', 'filter-function']);
module.exports = FilterValue;
+20 -25
View File
@@ -1,40 +1,35 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var Filter = function (_Declaration) {
_inherits(Filter, _Declaration);
var Filter =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(Filter, _Declaration);
function Filter() {
_classCallCheck(this, Filter);
function Filter() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
var _proto = Filter.prototype;
/**
* Check is it Internet Explorer filter
*/
Filter.prototype.check = function check(decl) {
var v = decl.value;
return v.toLowerCase().indexOf('alpha(') === -1 && v.indexOf('DXImageTransform.Microsoft') === -1 && v.indexOf('data:image/svg+xml') === -1;
};
/**
* Check is it Internet Explorer filter
*/
_proto.check = function check(decl) {
var v = decl.value;
return v.toLowerCase().indexOf('alpha(') === -1 && v.indexOf('DXImageTransform.Microsoft') === -1 && v.indexOf('data:image/svg+xml') === -1;
};
return Filter;
return Filter;
}(Declaration);
Object.defineProperty(Filter, 'names', {
enumerable: true,
writable: true,
value: ['filter']
});
_defineProperty(Filter, "names", ['filter']);
module.exports = Filter;
+52 -57
View File
@@ -1,79 +1,74 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var FlexBasis = function (_Declaration) {
_inherits(FlexBasis, _Declaration);
var FlexBasis =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(FlexBasis, _Declaration);
function FlexBasis() {
_classCallCheck(this, FlexBasis);
function FlexBasis() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = FlexBasis.prototype;
/**
* Return property name by final spec
*/
_proto.normalize = function normalize() {
return 'flex-basis';
}
/**
* Return flex property for 2012 spec
*/
;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2012) {
return prefix + 'flex-preferred-size';
}
/**
* Return property name by final spec
*/
FlexBasis.prototype.normalize = function normalize() {
return 'flex-basis';
};
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Ignore 2009 spec and use flex property for 2012
*/
;
/**
* Return flex property for 2012 spec
*/
_proto.set = function set(decl, prefix) {
var spec;
var _flexSpec2 = flexSpec(prefix);
FlexBasis.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
spec = _flexSpec2[0];
prefix = _flexSpec2[1];
var _flexSpec = flexSpec(prefix);
if (spec === 2012 || spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
spec = _flexSpec[0];
prefix = _flexSpec[1];
return undefined;
};
if (spec === 2012) {
return prefix + 'flex-preferred-size';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
/**
* Ignore 2009 spec and use flex property for 2012
*/
FlexBasis.prototype.set = function set(decl, prefix) {
var spec = void 0;
var _flexSpec2 = flexSpec(prefix);
spec = _flexSpec2[0];
prefix = _flexSpec2[1];
if (spec === 2012 || spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
return FlexBasis;
return FlexBasis;
}(Declaration);
Object.defineProperty(FlexBasis, 'names', {
enumerable: true,
writable: true,
value: ['flex-basis', 'flex-preferred-size']
});
_defineProperty(FlexBasis, "names", ['flex-basis', 'flex-preferred-size']);
module.exports = FlexBasis;
+81 -83
View File
@@ -1,112 +1,110 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var FlexDirection = function (_Declaration) {
_inherits(FlexDirection, _Declaration);
var FlexDirection =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(FlexDirection, _Declaration);
function FlexDirection() {
_classCallCheck(this, FlexDirection);
function FlexDirection() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = FlexDirection.prototype;
/**
* Return property name by final spec
*/
_proto.normalize = function normalize() {
return 'flex-direction';
}
/**
* Use two properties for 2009 spec
*/
;
_proto.insert = function insert(decl, prefix, prefixes) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec !== 2009) {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
/**
* Return property name by final spec
*/
FlexDirection.prototype.normalize = function normalize() {
return 'flex-direction';
};
var already = decl.parent.some(function (i) {
return i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction';
});
/**
* Use two properties for 2009 spec
*/
if (already) {
return undefined;
}
var v = decl.value;
var orient, dir;
FlexDirection.prototype.insert = function insert(decl, prefix, prefixes) {
var spec = void 0;
if (v === 'inherit' || v === 'initial' || v === 'unset') {
orient = v;
dir = v;
} else {
orient = v.indexOf('row') !== -1 ? 'horizontal' : 'vertical';
dir = v.indexOf('reverse') !== -1 ? 'reverse' : 'normal';
}
var _flexSpec = flexSpec(prefix);
var cloned = this.clone(decl);
cloned.prop = prefix + 'box-orient';
cloned.value = orient;
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
if (spec !== 2009) {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
} else {
var already = decl.parent.some(function (i) {
return i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction';
});
if (already) {
return undefined;
}
decl.parent.insertBefore(decl, cloned);
cloned = this.clone(decl);
cloned.prop = prefix + 'box-direction';
cloned.value = dir;
var v = decl.value;
var orient = void 0,
dir = void 0;
if (v === 'inherit' || v === 'initial' || v === 'unset') {
orient = v;
dir = v;
} else {
orient = v.indexOf('row') !== -1 ? 'horizontal' : 'vertical';
dir = v.indexOf('reverse') !== -1 ? 'reverse' : 'normal';
}
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
var cloned = this.clone(decl);
cloned.prop = prefix + 'box-orient';
cloned.value = orient;
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
decl.parent.insertBefore(decl, cloned);
return decl.parent.insertBefore(decl, cloned);
}
/**
* Clean two properties for 2009 spec
*/
;
cloned = this.clone(decl);
cloned.prop = prefix + 'box-direction';
cloned.value = dir;
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
return decl.parent.insertBefore(decl, cloned);
}
};
_proto.old = function old(prop, prefix) {
var spec;
/**
* Clean two properties for 2009 spec
*/
var _flexSpec2 = flexSpec(prefix);
spec = _flexSpec2[0];
prefix = _flexSpec2[1];
FlexDirection.prototype.old = function old(prop, prefix) {
var spec = void 0;
if (spec === 2009) {
return [prefix + 'box-orient', prefix + 'box-direction'];
} else {
return _Declaration.prototype.old.call(this, prop, prefix);
}
};
var _flexSpec2 = flexSpec(prefix);
spec = _flexSpec2[0];
prefix = _flexSpec2[1];
if (spec === 2009) {
return [prefix + 'box-orient', prefix + 'box-direction'];
} else {
return _Declaration.prototype.old.call(this, prop, prefix);
}
};
return FlexDirection;
return FlexDirection;
}(Declaration);
Object.defineProperty(FlexDirection, 'names', {
enumerable: true,
writable: true,
value: ['flex-direction', 'box-direction', 'box-orient']
});
_defineProperty(FlexDirection, "names", ['flex-direction', 'box-direction', 'box-orient']);
module.exports = FlexDirection;
+59 -59
View File
@@ -1,83 +1,83 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var FlexFlow = function (_Declaration) {
_inherits(FlexFlow, _Declaration);
var FlexFlow =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(FlexFlow, _Declaration);
function FlexFlow() {
_classCallCheck(this, FlexFlow);
function FlexFlow() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = FlexFlow.prototype;
/**
* Use two properties for 2009 spec
*/
_proto.insert = function insert(decl, prefix, prefixes) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec !== 2009) {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
/**
* Use two properties for 2009 spec
*/
FlexFlow.prototype.insert = function insert(decl, prefix, prefixes) {
var spec = void 0;
var values = decl.value.split(/\s+/).filter(function (i) {
return i !== 'wrap' && i !== 'nowrap' && 'wrap-reverse';
});
var _flexSpec = flexSpec(prefix);
if (values.length === 0) {
return undefined;
}
spec = _flexSpec[0];
prefix = _flexSpec[1];
var already = decl.parent.some(function (i) {
return i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction';
});
if (spec !== 2009) {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
} else {
var values = decl.value.split(/\s+/).filter(function (i) {
return i !== 'wrap' && i !== 'nowrap' && 'wrap-reverse';
});
if (values.length === 0) {
return undefined;
}
if (already) {
return undefined;
}
var already = decl.parent.some(function (i) {
return i.prop === prefix + 'box-orient' || i.prop === prefix + 'box-direction';
});
if (already) {
return undefined;
}
var value = values[0];
var orient = value.indexOf('row') !== -1 ? 'horizontal' : 'vertical';
var dir = value.indexOf('reverse') !== -1 ? 'reverse' : 'normal';
var cloned = this.clone(decl);
cloned.prop = prefix + 'box-orient';
cloned.value = orient;
var value = values[0];
var orient = value.indexOf('row') !== -1 ? 'horizontal' : 'vertical';
var dir = value.indexOf('reverse') !== -1 ? 'reverse' : 'normal';
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
var cloned = this.clone(decl);
cloned.prop = prefix + 'box-orient';
cloned.value = orient;
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
decl.parent.insertBefore(decl, cloned);
decl.parent.insertBefore(decl, cloned);
cloned = this.clone(decl);
cloned.prop = prefix + 'box-direction';
cloned.value = dir;
cloned = this.clone(decl);
cloned.prop = prefix + 'box-direction';
cloned.value = dir;
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
return decl.parent.insertBefore(decl, cloned);
}
};
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
return FlexFlow;
return decl.parent.insertBefore(decl, cloned);
};
return FlexFlow;
}(Declaration);
Object.defineProperty(FlexFlow, 'names', {
enumerable: true,
writable: true,
value: ['flex-flow', 'box-direction', 'box-orient']
});
_defineProperty(FlexFlow, "names", ['flex-flow', 'box-direction', 'box-orient']);
module.exports = FlexFlow;
+41 -44
View File
@@ -1,62 +1,59 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var Flex = function (_Declaration) {
_inherits(Flex, _Declaration);
var Flex =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(Flex, _Declaration);
function Flex() {
_classCallCheck(this, Flex);
function Flex() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = Flex.prototype;
/**
* Return property name by final spec
*/
_proto.normalize = function normalize() {
return 'flex';
}
/**
* Return flex property for 2009 and 2012 specs
*/
;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-flex';
}
/**
* Return property name by final spec
*/
Flex.prototype.normalize = function normalize() {
return 'flex';
};
if (spec === 2012) {
return prefix + 'flex-positive';
}
/**
* Return flex property for 2009 and 2012 specs
*/
return _Declaration.prototype.prefixed.call(this, prop, prefix);
};
Flex.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-flex';
} else if (spec === 2012) {
return prefix + 'flex-positive';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
return Flex;
return Flex;
}(Declaration);
Object.defineProperty(Flex, 'names', {
enumerable: true,
writable: true,
value: ['flex-grow', 'flex-positive']
});
_defineProperty(Flex, "names", ['flex-grow', 'flex-positive']);
module.exports = Flex;
+52 -57
View File
@@ -1,79 +1,74 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var FlexShrink = function (_Declaration) {
_inherits(FlexShrink, _Declaration);
var FlexShrink =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(FlexShrink, _Declaration);
function FlexShrink() {
_classCallCheck(this, FlexShrink);
function FlexShrink() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = FlexShrink.prototype;
/**
* Return property name by final spec
*/
_proto.normalize = function normalize() {
return 'flex-shrink';
}
/**
* Return flex property for 2012 spec
*/
;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2012) {
return prefix + 'flex-negative';
}
/**
* Return property name by final spec
*/
FlexShrink.prototype.normalize = function normalize() {
return 'flex-shrink';
};
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Ignore 2009 spec and use flex property for 2012
*/
;
/**
* Return flex property for 2012 spec
*/
_proto.set = function set(decl, prefix) {
var spec;
var _flexSpec2 = flexSpec(prefix);
FlexShrink.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
spec = _flexSpec2[0];
prefix = _flexSpec2[1];
var _flexSpec = flexSpec(prefix);
if (spec === 2012 || spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
spec = _flexSpec[0];
prefix = _flexSpec[1];
return undefined;
};
if (spec === 2012) {
return prefix + 'flex-negative';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
/**
* Ignore 2009 spec and use flex property for 2012
*/
FlexShrink.prototype.set = function set(decl, prefix) {
var spec = void 0;
var _flexSpec2 = flexSpec(prefix);
spec = _flexSpec2[0];
prefix = _flexSpec2[1];
if (spec === 2012 || spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
return FlexShrink;
return FlexShrink;
}(Declaration);
Object.defineProperty(FlexShrink, 'names', {
enumerable: true,
writable: true,
value: ['flex-shrink', 'flex-negative']
});
_defineProperty(FlexShrink, "names", ['flex-shrink', 'flex-negative']);
module.exports = FlexShrink;
+14 -13
View File
@@ -1,21 +1,22 @@
'use strict';
"use strict";
/**
* Return flexbox spec versions by prefix
*/
module.exports = function (prefix) {
var spec = void 0;
if (prefix === '-webkit- 2009' || prefix === '-moz-') {
spec = 2009;
} else if (prefix === '-ms-') {
spec = 2012;
} else if (prefix === '-webkit-') {
spec = 'final';
}
var spec;
if (prefix === '-webkit- 2009') {
prefix = '-webkit-';
}
if (prefix === '-webkit- 2009' || prefix === '-moz-') {
spec = 2009;
} else if (prefix === '-ms-') {
spec = 2012;
} else if (prefix === '-webkit-') {
spec = 'final';
}
return [spec, prefix];
if (prefix === '-webkit- 2009') {
prefix = '-webkit-';
}
return [spec, prefix];
};
+25 -27
View File
@@ -1,44 +1,42 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var FlexWrap = function (_Declaration) {
_inherits(FlexWrap, _Declaration);
var FlexWrap =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(FlexWrap, _Declaration);
function FlexWrap() {
_classCallCheck(this, FlexWrap);
function FlexWrap() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = FlexWrap.prototype;
/**
* Don't add prefix for 2009 spec
*/
_proto.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec !== 2009) {
return _Declaration.prototype.set.call(this, decl, prefix);
}
/**
* Don't add prefix for 2009 spec
*/
FlexWrap.prototype.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec !== 2009) {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
return undefined;
};
return FlexWrap;
return FlexWrap;
}(Declaration);
Object.defineProperty(FlexWrap, 'names', {
enumerable: true,
writable: true,
value: ['flex-wrap']
});
_defineProperty(FlexWrap, "names", ['flex-wrap']);
module.exports = FlexWrap;
+62 -65
View File
@@ -1,91 +1,88 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var list = require('postcss').list;
var Flex = function (_Declaration) {
_inherits(Flex, _Declaration);
var Flex =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(Flex, _Declaration);
function Flex() {
_classCallCheck(this, Flex);
function Flex() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = Flex.prototype;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-flex';
}
/**
* Change property name for 2009 spec
*/
Flex.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Return property name by final spec
*/
;
var _flexSpec = flexSpec(prefix);
_proto.normalize = function normalize() {
return 'flex';
}
/**
* Spec 2009 supports only first argument
* Spec 2012 disallows unitless basis
*/
;
spec = _flexSpec[0];
prefix = _flexSpec[1];
_proto.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2009) {
return prefix + 'box-flex';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
if (spec === 2009) {
decl.value = list.space(decl.value)[0];
decl.value = Flex.oldValues[decl.value] || decl.value;
return _Declaration.prototype.set.call(this, decl, prefix);
}
/**
* Return property name by final spec
*/
if (spec === 2012) {
var components = list.space(decl.value);
if (components.length === 3 && components[2] === '0') {
decl.value = components.slice(0, 2).concat('0px').join(' ');
}
}
Flex.prototype.normalize = function normalize() {
return 'flex';
};
return _Declaration.prototype.set.call(this, decl, prefix);
};
/**
* Spec 2009 supports only first argument
* Spec 2012 disallows unitless basis
*/
Flex.prototype.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2009) {
decl.value = list.space(decl.value)[0];
decl.value = Flex.oldValues[decl.value] || decl.value;
return _Declaration.prototype.set.call(this, decl, prefix);
} else if (spec === 2012) {
var components = list.space(decl.value);
if (components.length === 3 && components[2] === '0') {
decl.value = components.slice(0, 2).concat('0px').join(' ');
}
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
return Flex;
return Flex;
}(Declaration);
Object.defineProperty(Flex, 'names', {
enumerable: true,
writable: true,
value: ['flex', 'box-flex']
});
Object.defineProperty(Flex, 'oldValues', {
enumerable: true,
writable: true,
value: {
auto: '1',
none: '0'
}
});
_defineProperty(Flex, "names", ['flex', 'box-flex']);
_defineProperty(Flex, "oldValues", {
auto: '1',
none: '0'
/**
* Change property name for 2009 spec
*/
});
module.exports = Flex;
+26 -29
View File
@@ -1,45 +1,42 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Selector = require('../selector');
var Fullscreen = function (_Selector) {
_inherits(Fullscreen, _Selector);
var Fullscreen =
/*#__PURE__*/
function (_Selector) {
_inheritsLoose(Fullscreen, _Selector);
function Fullscreen() {
_classCallCheck(this, Fullscreen);
function Fullscreen() {
return _Selector.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Selector.apply(this, arguments));
var _proto = Fullscreen.prototype;
/**
* Return different selectors depend on prefix
*/
_proto.prefixed = function prefixed(prefix) {
if (prefix === '-webkit-') {
return ':-webkit-full-screen';
}
/**
* Return different selectors depend on prefix
*/
Fullscreen.prototype.prefixed = function prefixed(prefix) {
if (prefix === '-webkit-') {
return ':-webkit-full-screen';
} else if (prefix === '-moz-') {
return ':-moz-full-screen';
} else {
return ':' + prefix + 'fullscreen';
}
};
if (prefix === '-moz-') {
return ':-moz-full-screen';
}
return Fullscreen;
return ":" + prefix + "fullscreen";
};
return Fullscreen;
}(Selector);
Object.defineProperty(Fullscreen, 'names', {
enumerable: true,
writable: true,
value: [':fullscreen']
});
_defineProperty(Fullscreen, "names", [':fullscreen']);
module.exports = Fullscreen;
+510 -452
View File
File diff suppressed because it is too large Load Diff
+35 -67
View File
@@ -1,86 +1,54 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var shorthand = require('./grid-shorthand');
var GridArea = function (_Declaration) {
_inherits(GridArea, _Declaration);
var utils = require('./grid-utils');
function GridArea() {
_classCallCheck(this, GridArea);
var GridArea =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridArea, _Declaration);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
function GridArea() {
return _Declaration.apply(this, arguments) || this;
}
/**
* Translate grid-area to separate -ms- prefixed properties
*/
GridArea.prototype.insert = function insert(decl, prefix, prefixes) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
var _proto = GridArea.prototype;
if (decl.parent.some(function (i) {
return i.prop === '-ms-grid-row';
})) {
return undefined;
}
/**
* Translate grid-area to separate -ms- prefixed properties
*/
_proto.insert = function insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
var values = utils.parse(decl);
var values = shorthand.parse(decl);
var _utils$translate = utils.translate(values, 0, 2),
rowStart = _utils$translate[0],
rowSpan = _utils$translate[1];
var _shorthand$translate = shorthand.translate(values, 0, 2),
rowStart = _shorthand$translate[0],
rowSpan = _shorthand$translate[1];
var _utils$translate2 = utils.translate(values, 1, 3),
columnStart = _utils$translate2[0],
columnSpan = _utils$translate2[1];
var _shorthand$translate2 = shorthand.translate(values, 1, 3),
columnStart = _shorthand$translate2[0],
columnSpan = _shorthand$translate2[1];
[['grid-row', rowStart], ['grid-row-span', rowSpan], ['grid-column', columnStart], ['grid-column-span', columnSpan]].forEach(function (_ref) {
var prop = _ref[0],
value = _ref[1];
utils.insertDecl(decl, prop, value);
});
utils.warnTemplateSelectorNotFound(decl, result);
utils.warnIfGridRowColumnExists(decl, result);
return undefined;
};
if (rowStart) {
decl.cloneBefore({
prop: '-ms-grid-row',
value: rowStart.toString()
});
}
if (rowSpan) {
decl.cloneBefore({
prop: '-ms-grid-row-span',
value: rowSpan.toString()
});
}
if (columnStart) {
decl.cloneBefore({
prop: '-ms-grid-column',
value: columnStart.toString()
});
}
if (columnSpan) {
decl.cloneBefore({
prop: '-ms-grid-column-span',
value: columnSpan.toString()
});
}
return undefined;
};
return GridArea;
return GridArea;
}(Declaration);
Object.defineProperty(GridArea, 'names', {
enumerable: true,
writable: true,
value: ['grid-area']
});
_defineProperty(GridArea, "names", ['grid-area']);
module.exports = GridArea;
+33 -40
View File
@@ -1,57 +1,50 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var GridColumnAlign = function (_Declaration) {
_inherits(GridColumnAlign, _Declaration);
var GridColumnAlign =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridColumnAlign, _Declaration);
function GridColumnAlign() {
_classCallCheck(this, GridColumnAlign);
function GridColumnAlign() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
var _proto = GridColumnAlign.prototype;
/**
* Do not prefix flexbox values
*/
GridColumnAlign.prototype.check = function check(decl) {
return decl.value.indexOf('flex-') === -1 && decl.value !== 'baseline';
};
/**
* Do not prefix flexbox values
*/
_proto.check = function check(decl) {
return decl.value.indexOf('flex-') === -1 && decl.value !== 'baseline';
}
/**
* Change property name for IE
*/
;
/**
* Change property name for IE
*/
_proto.prefixed = function prefixed(prop, prefix) {
return prefix + 'grid-column-align';
}
/**
* Change IE property back
*/
;
_proto.normalize = function normalize() {
return 'justify-self';
};
GridColumnAlign.prototype.prefixed = function prefixed(prop, prefix) {
return prefix + 'grid-column-align';
};
/**
* Change IE property back
*/
GridColumnAlign.prototype.normalize = function normalize() {
return 'justify-self';
};
return GridColumnAlign;
return GridColumnAlign;
}(Declaration);
Object.defineProperty(GridColumnAlign, 'names', {
enumerable: true,
writable: true,
value: ['grid-column-align']
});
_defineProperty(GridColumnAlign, "names", ['grid-column-align']);
module.exports = GridColumnAlign;
+45 -54
View File
@@ -1,73 +1,64 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var GridEnd = function (_Declaration) {
_inherits(GridEnd, _Declaration);
var GridEnd =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridEnd, _Declaration);
function GridEnd() {
_classCallCheck(this, GridEnd);
function GridEnd() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = GridEnd.prototype;
/**
* Change repeating syntax for IE
*/
_proto.insert = function insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
var clonedDecl = this.clone(decl);
var startProp = decl.prop.replace(/end$/, 'start');
var spanProp = prefix + decl.prop.replace(/end$/, 'span');
if (decl.parent.some(function (i) {
return i.prop === spanProp;
})) {
return undefined;
}
/**
* Do not add prefix for unsupported value in IE
*/
GridEnd.prototype.check = function check(decl) {
return decl.value.indexOf('span') !== -1;
};
clonedDecl.prop = spanProp;
/**
* Return a final spec property
*/
if (decl.value.includes('span')) {
clonedDecl.value = decl.value.replace(/span\s/i, '');
} else {
var startDecl;
decl.parent.walkDecls(startProp, function (d) {
startDecl = d;
});
if (startDecl) {
var value = Number(decl.value) - Number(startDecl.value) + '';
clonedDecl.value = value;
} else {
decl.warn(result, "Can not prefix " + decl.prop + " (" + startProp + " is not found)");
}
}
GridEnd.prototype.normalize = function normalize(prop) {
return prop.replace(/(-span|-end)/, '');
};
decl.cloneBefore(clonedDecl);
return undefined;
};
/**
* Change property name for IE
*/
GridEnd.prototype.prefixed = function prefixed(prop, prefix) {
var result = _Declaration.prototype.prefixed.call(this, prop, prefix);
if (prefix === '-ms-') {
result = result.replace('-end', '-span');
}
return result;
};
/**
* Change repeating syntax for IE
*/
GridEnd.prototype.set = function set(decl, prefix) {
if (prefix === '-ms-') {
decl.value = decl.value.replace(/span\s/i, '');
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
return GridEnd;
return GridEnd;
}(Declaration);
Object.defineProperty(GridEnd, 'names', {
enumerable: true,
writable: true,
value: ['grid-row-end', 'grid-column-end', 'grid-row-span', 'grid-column-span']
});
_defineProperty(GridEnd, "names", ['grid-row-end', 'grid-column-end']);
module.exports = GridEnd;
+33 -40
View File
@@ -1,57 +1,50 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var GridRowAlign = function (_Declaration) {
_inherits(GridRowAlign, _Declaration);
var GridRowAlign =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridRowAlign, _Declaration);
function GridRowAlign() {
_classCallCheck(this, GridRowAlign);
function GridRowAlign() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
var _proto = GridRowAlign.prototype;
/**
* Do not prefix flexbox values
*/
GridRowAlign.prototype.check = function check(decl) {
return decl.value.indexOf('flex-') === -1 && decl.value !== 'baseline';
};
/**
* Do not prefix flexbox values
*/
_proto.check = function check(decl) {
return decl.value.indexOf('flex-') === -1 && decl.value !== 'baseline';
}
/**
* Change property name for IE
*/
;
/**
* Change property name for IE
*/
_proto.prefixed = function prefixed(prop, prefix) {
return prefix + 'grid-row-align';
}
/**
* Change IE property back
*/
;
_proto.normalize = function normalize() {
return 'align-self';
};
GridRowAlign.prototype.prefixed = function prefixed(prop, prefix) {
return prefix + 'grid-row-align';
};
/**
* Change IE property back
*/
GridRowAlign.prototype.normalize = function normalize() {
return 'align-self';
};
return GridRowAlign;
return GridRowAlign;
}(Declaration);
Object.defineProperty(GridRowAlign, 'names', {
enumerable: true,
writable: true,
value: ['grid-row-align']
});
_defineProperty(GridRowAlign, "names", ['grid-row-align']);
module.exports = GridRowAlign;
+38 -46
View File
@@ -1,62 +1,54 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var shorthand = require('./grid-shorthand');
var GridRowColumn = function (_Declaration) {
_inherits(GridRowColumn, _Declaration);
var utils = require('./grid-utils');
function GridRowColumn() {
_classCallCheck(this, GridRowColumn);
var GridRowColumn =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridRowColumn, _Declaration);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
function GridRowColumn() {
return _Declaration.apply(this, arguments) || this;
}
var _proto = GridRowColumn.prototype;
/**
* Translate grid-row / grid-column to separate -ms- prefixed properties
*/
_proto.insert = function insert(decl, prefix, prefixes) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
var values = utils.parse(decl);
var _utils$translate = utils.translate(values, 0, 1),
start = _utils$translate[0],
span = _utils$translate[1];
var hasStartValueSpan = values[0] && values[0].includes('span');
if (hasStartValueSpan) {
span = values[0].join('').replace(/\D/g, '');
}
/**
* Translate grid-row / grid-column to separate -ms- prefixed properties
*/
GridRowColumn.prototype.insert = function insert(decl, prefix, prefixes) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
[[decl.prop, start], [decl.prop + "-span", span]].forEach(function (_ref) {
var prop = _ref[0],
value = _ref[1];
utils.insertDecl(decl, prop, value);
});
return undefined;
};
var values = shorthand.parse(decl);
var _shorthand$translate = shorthand.translate(values, 0, 1),
start = _shorthand$translate[0],
span = _shorthand$translate[1];
if (start) {
decl.cloneBefore({
prop: '-ms-' + decl.prop,
value: start.toString()
});
}
if (span) {
decl.cloneBefore({
prop: '-ms-' + decl.prop + '-span',
value: span.toString()
});
}
return undefined;
};
return GridRowColumn;
return GridRowColumn;
}(Declaration);
Object.defineProperty(GridRowColumn, 'names', {
enumerable: true,
writable: true,
value: ['grid-row', 'grid-column']
});
_defineProperty(GridRowColumn, "names", ['grid-row', 'grid-column']);
module.exports = GridRowColumn;
+123 -39
View File
@@ -1,65 +1,149 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var shorthand = require('./grid-shorthand');
var GridRowsColumns = function (_Declaration) {
_inherits(GridRowsColumns, _Declaration);
var _require = require('./grid-utils'),
prefixTrackProp = _require.prefixTrackProp,
prefixTrackValue = _require.prefixTrackValue,
autoplaceGridItems = _require.autoplaceGridItems,
getGridGap = _require.getGridGap,
inheritGridGap = _require.inheritGridGap;
function GridRowsColumns() {
_classCallCheck(this, GridRowsColumns);
var Processor = require('../processor');
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var GridRowsColumns =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridRowsColumns, _Declaration);
function GridRowsColumns() {
return _Declaration.apply(this, arguments) || this;
}
var _proto = GridRowsColumns.prototype;
/**
* Change property name for IE
*/
_proto.prefixed = function prefixed(prop, prefix) {
if (prefix === '-ms-') {
return prefixTrackProp({
prop: prop,
prefix: prefix
});
}
/**
* Change property name for IE
*/
GridRowsColumns.prototype.prefixed = function prefixed(prop, prefix) {
if (prefix === '-ms-') {
return prefix + prop.replace('template-', '');
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Change IE property back
*/
;
_proto.normalize = function normalize(prop) {
return prop.replace(/^grid-(rows|columns)/, 'grid-template-$1');
};
_proto.insert = function insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
var parent = decl.parent,
prop = decl.prop,
value = decl.value;
var isRowProp = prop.includes('rows');
var isColumnProp = prop.includes('columns');
var hasGridTemplate = parent.some(function (i) {
return i.prop === 'grid-template' || i.prop === 'grid-template-areas';
});
/**
* Change IE property back
* Not to prefix rows declaration if grid-template(-areas) is present
*/
if (hasGridTemplate && isRowProp) {
return false;
}
GridRowsColumns.prototype.normalize = function normalize(prop) {
return prop.replace(/^grid-(rows|columns)/, 'grid-template-$1');
};
var processor = new Processor({});
var status = processor.gridStatus(parent, result);
var gap = getGridGap(decl);
gap = inheritGridGap(decl, gap) || gap;
var gapValue = isRowProp ? gap.row : gap.column;
if ((status === 'no-autoplace' || status === true) && !hasGridTemplate) {
gapValue = null;
}
var prefixValue = prefixTrackValue({
value: value,
gap: gapValue
});
/**
* Change repeating syntax for IE
* Insert prefixes
*/
decl.cloneBefore({
prop: prefixTrackProp({
prop: prop,
prefix: prefix
}),
value: prefixValue
});
var autoflow = parent.nodes.find(function (i) {
return i.prop === 'grid-auto-flow';
});
var autoflowValue = 'row';
GridRowsColumns.prototype.set = function set(decl, prefix) {
if (prefix === '-ms-' && decl.value.indexOf('repeat(') !== -1) {
decl.value = shorthand.changeRepeat(decl.value);
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
if (autoflow && !processor.disabled(autoflow, result)) {
autoflowValue = autoflow.value.trim();
}
return GridRowsColumns;
if (status === 'autoplace') {
/**
* Show warning if grid-template-rows decl is not found
*/
var rowDecl = parent.nodes.find(function (i) {
return i.prop === 'grid-template-rows';
});
if (!rowDecl && hasGridTemplate) {
return undefined;
} else if (!rowDecl && !hasGridTemplate) {
decl.warn(result, "Autoplacement does not work without grid-template-rows property");
return undefined;
}
/**
* Show warning if grid-template-columns decl is not found
*/
var columnDecl = parent.nodes.find(function (i) {
return i.prop === 'grid-template-columns';
});
if (!columnDecl && !hasGridTemplate) {
decl.warn(result, "Autoplacement does not work without grid-template-columns property");
}
/**
* Autoplace grid items
*/
if (isColumnProp && !hasGridTemplate) {
autoplaceGridItems(decl, result, gap, autoflowValue);
}
}
return undefined;
};
return GridRowsColumns;
}(Declaration);
Object.defineProperty(GridRowsColumns, 'names', {
enumerable: true,
writable: true,
value: ['grid-template-rows', 'grid-template-columns', 'grid-rows', 'grid-columns']
});
_defineProperty(GridRowsColumns, "names", ['grid-template-rows', 'grid-template-columns', 'grid-rows', 'grid-columns']);
module.exports = GridRowsColumns;
-160
View File
@@ -1,160 +0,0 @@
'use strict';
var parser = require('postcss-value-parser');
function convert(value) {
if (value && value.length === 2 && value[0] === 'span' && parseInt(value[1], 10) > 0) {
return [false, parseInt(value[1], 10)];
}
if (value && value.length === 1 && parseInt(value[0], 10) > 0) {
return [parseInt(value[0], 10), false];
}
return [false, false];
}
function translate(values, startIndex, endIndex) {
var startValue = values[startIndex];
var endValue = values[endIndex];
if (!startValue) {
return [false, false];
}
var _convert = convert(startValue),
start = _convert[0],
spanStart = _convert[1];
var _convert2 = convert(endValue),
end = _convert2[0],
spanEnd = _convert2[1];
if (start && !endValue) {
return [start, false];
}
if (spanStart && end) {
return [end - spanStart, spanStart];
}
if (start && spanEnd) {
return [start, spanEnd];
}
if (start && end) {
return [start, end - start];
}
return [false, false];
}
function parse(decl) {
var node = parser(decl.value);
var values = [];
var current = 0;
values[current] = [];
for (var _iterator = node.nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var i = _ref;
if (i.type === 'div') {
current += 1;
values[current] = [];
} else if (i.type === 'word') {
values[current].push(i.value);
}
}
return values;
}
function parseTemplateShortcut(decl) {
var node = parser(decl.value, { loose: true });
var values = [];
var current = 0;
values[current] = [];
for (var _iterator2 = node.nodes, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
var _ref2;
if (_isArray2) {
if (_i2 >= _iterator2.length) break;
_ref2 = _iterator2[_i2++];
} else {
_i2 = _iterator2.next();
if (_i2.done) break;
_ref2 = _i2.value;
}
var i = _ref2;
if (i.type === 'div') {
current += 1;
values[current] = [];
} else {
values[current].push(parser.stringify(i));
}
}
return values;
}
function walkRepeat(node) {
var fixed = [];
for (var _iterator3 = node.nodes, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
var _ref3;
if (_isArray3) {
if (_i3 >= _iterator3.length) break;
_ref3 = _iterator3[_i3++];
} else {
_i3 = _iterator3.next();
if (_i3.done) break;
_ref3 = _i3.value;
}
var i = _ref3;
if (i.nodes) {
walkRepeat(i);
}
fixed.push(i);
if (i.type === 'function' && i.value === 'repeat') {
var first = i.nodes.shift();
if (first) {
var count = first.value;
i.nodes.shift();
i.value = '';
fixed.push({ type: 'word', value: '[' + count + ']' });
}
}
}
node.nodes = fixed;
}
function changeRepeat(value) {
var ast = parser(value);
walkRepeat(ast);
return ast.toString();
}
module.exports = {
parse: parse,
translate: translate,
changeRepeat: changeRepeat,
parseTemplateShortcut: parseTemplateShortcut
};
+41 -46
View File
@@ -1,62 +1,57 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var GridStart = function (_Declaration) {
_inherits(GridStart, _Declaration);
var GridStart =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridStart, _Declaration);
function GridStart() {
_classCallCheck(this, GridStart);
function GridStart() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = GridStart.prototype;
/**
* Do not add prefix for unsupported value in IE
*/
_proto.check = function check(decl) {
var value = decl.value;
return value.indexOf('/') === -1 || value.indexOf('span') !== -1;
}
/**
* Return a final spec property
*/
;
_proto.normalize = function normalize(prop) {
return prop.replace('-start', '');
}
/**
* Change property name for IE
*/
;
_proto.prefixed = function prefixed(prop, prefix) {
var result = _Declaration.prototype.prefixed.call(this, prop, prefix);
if (prefix === '-ms-') {
result = result.replace('-start', '');
}
/**
* Do not add prefix for unsupported value in IE
*/
GridStart.prototype.check = function check(decl) {
var value = decl.value;
return value.indexOf('/') === -1 || value.indexOf('span') !== -1;
};
return result;
};
/**
* Return a final spec property
*/
GridStart.prototype.normalize = function normalize(prop) {
return prop.replace('-start', '');
};
/**
* Change property name for IE
*/
GridStart.prototype.prefixed = function prefixed(prop, prefix) {
var result = _Declaration.prototype.prefixed.call(this, prop, prefix);
if (prefix === '-ms-') {
result = result.replace('-start', '');
}
return result;
};
return GridStart;
return GridStart;
}(Declaration);
Object.defineProperty(GridStart, 'names', {
enumerable: true,
writable: true,
value: ['grid-row-start', 'grid-column-start']
});
_defineProperty(GridStart, "names", ['grid-row-start', 'grid-column-start']);
module.exports = GridStart;
+79 -113
View File
@@ -1,137 +1,103 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var DOTS = /^\.+$/;
var _require = require('./grid-utils'),
parseGridAreas = _require.parseGridAreas,
warnMissedAreas = _require.warnMissedAreas,
prefixTrackProp = _require.prefixTrackProp,
prefixTrackValue = _require.prefixTrackValue,
getGridGap = _require.getGridGap,
warnGridGap = _require.warnGridGap,
inheritGridGap = _require.inheritGridGap;
function track(start, end) {
return { start: start, end: end, span: end - start };
function getGridRows(tpl) {
return tpl.trim().slice(1, -1).split(/['"]\s*['"]?/g);
}
function getRows(tpl) {
return tpl.trim().slice(1, -1).split(/['"]\s*['"]?/g);
}
var GridTemplateAreas =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridTemplateAreas, _Declaration);
function getColumns(line) {
return line.trim().split(/\s+/g);
}
function GridTemplateAreas() {
return _Declaration.apply(this, arguments) || this;
}
function parseGridAreas(tpl) {
return getRows(tpl).reduce(function (areas, line, rowIndex) {
if (line.trim() === '') return areas;
getColumns(line).forEach(function (area, columnIndex) {
if (DOTS.test(area)) return;
if (typeof areas[area] === 'undefined') {
areas[area] = {
column: track(columnIndex + 1, columnIndex + 2),
row: track(rowIndex + 1, rowIndex + 2)
};
} else {
var _areas$area = areas[area],
column = _areas$area.column,
row = _areas$area.row;
var _proto = GridTemplateAreas.prototype;
/**
* Translate grid-template-areas to separate -ms- prefixed properties
*/
_proto.insert = function insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
var hasColumns = false;
var hasRows = false;
var parent = decl.parent;
var gap = getGridGap(decl);
gap = inheritGridGap(decl, gap) || gap; // remove already prefixed rows
// to prevent doubling prefixes
column.start = Math.min(column.start, columnIndex + 1);
column.end = Math.max(column.end, columnIndex + 2);
column.span = column.end - column.start;
parent.walkDecls(/-ms-grid-rows/, function (i) {
return i.remove();
}); // add empty tracks to rows
row.start = Math.min(row.start, rowIndex + 1);
row.end = Math.max(row.end, rowIndex + 2);
row.span = row.end - row.start;
}
parent.walkDecls(/grid-template-(rows|columns)/, function (trackDecl) {
if (trackDecl.prop === 'grid-template-rows') {
hasRows = true;
var prop = trackDecl.prop,
value = trackDecl.value;
trackDecl.cloneBefore({
prop: prefixTrackProp({
prop: prop,
prefix: prefix
}),
value: prefixTrackValue({
value: value,
gap: gap.row
})
});
return areas;
}, {});
}
} else {
hasColumns = true;
}
});
var gridRows = getGridRows(decl.value);
var GridTemplateAreas = function (_Declaration) {
_inherits(GridTemplateAreas, _Declaration);
function GridTemplateAreas() {
_classCallCheck(this, GridTemplateAreas);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
GridTemplateAreas.prototype.getRoot = function getRoot(parent) {
if (parent.type === 'atrule' || !parent.parent) {
return parent;
}
return this.getRoot(parent.parent);
};
/**
* Translate grid-template-areas to separate -ms- prefixed properties
*/
if (hasColumns && !hasRows && gap.row && gridRows.length > 1) {
decl.cloneBefore({
prop: '-ms-grid-rows',
value: prefixTrackValue({
value: "repeat(" + gridRows.length + ", auto)",
gap: gap.row
}),
raws: {}
});
} // warnings
GridTemplateAreas.prototype.insert = function insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
warnGridGap({
gap: gap,
hasColumns: hasColumns,
decl: decl,
result: result
});
var areas = parseGridAreas({
rows: gridRows,
gap: gap
});
warnMissedAreas(areas, decl, result);
return decl;
};
var areas = parseGridAreas(decl.value);
var missed = Object.keys(areas);
this.getRoot(decl.parent).walkDecls('grid-area', function (gridArea) {
var value = gridArea.value;
var area = areas[value];
missed = missed.filter(function (e) {
return e !== value;
});
if (area) {
gridArea.parent.walkDecls(/-ms-grid-(row|column)/, function (d) {
d.remove();
});
gridArea.cloneBefore({
prop: '-ms-grid-row',
value: String(area.row.start)
});
if (area.row.span > 1) {
gridArea.cloneBefore({
prop: '-ms-grid-row-span',
value: String(area.row.span)
});
}
gridArea.cloneBefore({
prop: '-ms-grid-column',
value: String(area.column.start)
});
if (area.column.span > 1) {
gridArea.cloneBefore({
prop: '-ms-grid-column-span',
value: String(area.column.span)
});
}
}
return undefined;
});
if (missed.length > 0) {
decl.warn(result, 'Can not find grid areas: ' + missed.join(', '));
}
return decl;
};
return GridTemplateAreas;
return GridTemplateAreas;
}(Declaration);
Object.defineProperty(GridTemplateAreas, 'names', {
enumerable: true,
writable: true,
value: ['grid-template-areas']
});
_defineProperty(GridTemplateAreas, "names", ['grid-template-areas']);
module.exports = GridTemplateAreas;
+69 -52
View File
@@ -1,75 +1,92 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var shorthand = require('./grid-shorthand');
var GridTemplate = function (_Declaration) {
_inherits(GridTemplate, _Declaration);
var _require = require('./grid-utils'),
parseTemplate = _require.parseTemplate,
warnMissedAreas = _require.warnMissedAreas,
getGridGap = _require.getGridGap,
warnGridGap = _require.warnGridGap,
inheritGridGap = _require.inheritGridGap;
function GridTemplate() {
_classCallCheck(this, GridTemplate);
var GridTemplate =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(GridTemplate, _Declaration);
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
function GridTemplate() {
return _Declaration.apply(this, arguments) || this;
}
var _proto = GridTemplate.prototype;
/**
* Translate grid-template to separate -ms- prefixed properties
*/
_proto.insert = function insert(decl, prefix, prefixes, result) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
if (decl.parent.some(function (i) {
return i.prop === '-ms-grid-rows';
})) {
return undefined;
}
var gap = getGridGap(decl);
/**
* Do not add prefix for unsupported value in IE
*/
GridTemplate.prototype.check = function check(decl) {
return decl.value.includes('/') && !decl.value.includes('[') && !decl.value.includes('"') && !decl.value.includes('\'');
};
* we must insert inherited gap values in some cases:
* if we are inside media query && if we have no grid-gap value
*/
/**
* Translate grid-template to separate -ms- prefixed properties
*/
var inheritedGap = inheritGridGap(decl, gap);
var _parseTemplate = parseTemplate({
decl: decl,
gap: inheritedGap || gap
}),
rows = _parseTemplate.rows,
columns = _parseTemplate.columns,
areas = _parseTemplate.areas;
GridTemplate.prototype.insert = function insert(decl, prefix, prefixes) {
if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
var hasAreas = Object.keys(areas).length > 0;
var hasRows = Boolean(rows);
var hasColumns = Boolean(columns);
warnGridGap({
gap: gap,
hasColumns: hasColumns,
decl: decl,
result: result
});
warnMissedAreas(areas, decl, result);
if (decl.parent.some(function (i) {
return i.prop === '-ms-grid-rows';
})) {
return undefined;
}
if (hasRows && hasColumns || hasAreas) {
decl.cloneBefore({
prop: '-ms-grid-rows',
value: rows,
raws: {}
});
}
var _shorthand$parseTempl = shorthand.parseTemplateShortcut(decl),
templateRows = _shorthand$parseTempl[0],
templateColumns = _shorthand$parseTempl[1];
if (hasColumns) {
decl.cloneBefore({
prop: '-ms-grid-columns',
value: columns,
raws: {}
});
}
if (templateRows) {
decl.cloneBefore({
prop: '-ms-grid-rows',
value: shorthand.changeRepeat(templateRows.join(''))
});
}
return decl;
};
if (templateColumns) {
decl.cloneBefore({
prop: '-ms-grid-columns',
value: shorthand.changeRepeat(templateColumns.join(''))
});
}
return decl;
};
return GridTemplate;
return GridTemplate;
}(Declaration);
Object.defineProperty(GridTemplate, 'names', {
enumerable: true,
writable: true,
value: ['grid-template']
});
_defineProperty(GridTemplate, "names", ['grid-template']);
module.exports = GridTemplate;
+54 -63
View File
@@ -1,82 +1,73 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var ImageRendering = function (_Declaration) {
_inherits(ImageRendering, _Declaration);
var ImageRendering =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(ImageRendering, _Declaration);
function ImageRendering() {
_classCallCheck(this, ImageRendering);
function ImageRendering() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = ImageRendering.prototype;
/**
* Add hack only for crisp-edges
*/
_proto.check = function check(decl) {
return decl.value === 'pixelated';
}
/**
* Change property name for IE
*/
;
_proto.prefixed = function prefixed(prop, prefix) {
if (prefix === '-ms-') {
return '-ms-interpolation-mode';
}
/**
* Add hack only for crisp-edges
*/
ImageRendering.prototype.check = function check(decl) {
return decl.value === 'pixelated';
};
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Change property and value for IE
*/
;
/**
* Change property name for IE
*/
_proto.set = function set(decl, prefix) {
if (prefix !== '-ms-') return _Declaration.prototype.set.call(this, decl, prefix);
decl.prop = '-ms-interpolation-mode';
decl.value = 'nearest-neighbor';
return decl;
}
/**
* Return property name by spec
*/
;
_proto.normalize = function normalize() {
return 'image-rendering';
}
/**
* Warn on old value
*/
;
ImageRendering.prototype.prefixed = function prefixed(prop, prefix) {
if (prefix === '-ms-') {
return '-ms-interpolation-mode';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
_proto.process = function process(node, result) {
return _Declaration.prototype.process.call(this, node, result);
};
/**
* Change property and value for IE
*/
ImageRendering.prototype.set = function set(decl, prefix) {
if (prefix !== '-ms-') return _Declaration.prototype.set.call(this, decl, prefix);
decl.prop = '-ms-interpolation-mode';
decl.value = 'nearest-neighbor';
return decl;
};
/**
* Return property name by spec
*/
ImageRendering.prototype.normalize = function normalize() {
return 'image-rendering';
};
/**
* Warn on old value
*/
ImageRendering.prototype.process = function process(node, result) {
return _Declaration.prototype.process.call(this, node, result);
};
return ImageRendering;
return ImageRendering;
}(Declaration);
Object.defineProperty(ImageRendering, 'names', {
enumerable: true,
writable: true,
value: ['image-rendering', 'interpolation-mode']
});
_defineProperty(ImageRendering, "names", ['image-rendering', 'interpolation-mode']);
module.exports = ImageRendering;
+24 -27
View File
@@ -1,43 +1,40 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Value = require('../value');
var ImageSet = function (_Value) {
_inherits(ImageSet, _Value);
var ImageSet =
/*#__PURE__*/
function (_Value) {
_inheritsLoose(ImageSet, _Value);
function ImageSet() {
_classCallCheck(this, ImageSet);
function ImageSet() {
return _Value.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Value.apply(this, arguments));
var _proto = ImageSet.prototype;
/**
* Use non-standard name for WebKit and Firefox
*/
_proto.replace = function replace(string, prefix) {
var fixed = _Value.prototype.replace.call(this, string, prefix);
if (prefix === '-webkit-') {
fixed = fixed.replace(/("[^"]+"|'[^']+')(\s+\d+\w)/gi, 'url($1)$2');
}
/**
* Use non-standard name for WebKit and Firefox
*/
ImageSet.prototype.replace = function replace(string, prefix) {
var fixed = _Value.prototype.replace.call(this, string, prefix);
if (prefix === '-webkit-') {
fixed = fixed.replace(/("[^"]+"|'[^']+')(\s+\d+\w)/gi, 'url($1)$2');
}
return fixed;
};
return fixed;
};
return ImageSet;
return ImageSet;
}(Value);
Object.defineProperty(ImageSet, 'names', {
enumerable: true,
writable: true,
value: ['image-set']
});
_defineProperty(ImageSet, "names", ['image-set']);
module.exports = ImageSet;
+26 -32
View File
@@ -1,48 +1,42 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var InlineLogical = function (_Declaration) {
_inherits(InlineLogical, _Declaration);
var InlineLogical =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(InlineLogical, _Declaration);
function InlineLogical() {
_classCallCheck(this, InlineLogical);
function InlineLogical() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
var _proto = InlineLogical.prototype;
/**
* Use old syntax for -moz- and -webkit-
*/
InlineLogical.prototype.prefixed = function prefixed(prop, prefix) {
return prefix + prop.replace('-inline', '');
};
/**
* Use old syntax for -moz- and -webkit-
*/
_proto.prefixed = function prefixed(prop, prefix) {
return prefix + prop.replace('-inline', '');
}
/**
* Return property name by spec
*/
;
/**
* Return property name by spec
*/
_proto.normalize = function normalize(prop) {
return prop.replace(/(margin|padding|border)-(start|end)/, '$1-inline-$2');
};
InlineLogical.prototype.normalize = function normalize(prop) {
return prop.replace(/(margin|padding|border)-(start|end)/, '$1-inline-$2');
};
return InlineLogical;
return InlineLogical;
}(Declaration);
Object.defineProperty(InlineLogical, 'names', {
enumerable: true,
writable: true,
value: ['border-inline-start', 'border-inline-end', 'margin-inline-start', 'margin-inline-end', 'padding-inline-start', 'padding-inline-end', 'border-start', 'border-end', 'margin-start', 'margin-end', 'padding-start', 'padding-end']
});
_defineProperty(InlineLogical, "names", ['border-inline-start', 'border-inline-end', 'margin-inline-start', 'margin-inline-end', 'padding-inline-start', 'padding-inline-end', 'border-start', 'border-end', 'margin-start', 'margin-end', 'padding-start', 'padding-end']);
module.exports = InlineLogical;
+52 -51
View File
@@ -1,75 +1,76 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var OldValue = require('../old-value');
var Value = require('../value');
function _regexp(name) {
return new RegExp('(^|[\\s,(])(' + name + '($|[\\s),]))', 'gi');
return new RegExp("(^|[\\s,(])(" + name + "($|[\\s),]))", 'gi');
}
var Intrinsic = function (_Value) {
_inherits(Intrinsic, _Value);
var Intrinsic =
/*#__PURE__*/
function (_Value) {
_inheritsLoose(Intrinsic, _Value);
function Intrinsic() {
_classCallCheck(this, Intrinsic);
function Intrinsic() {
return _Value.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Value.apply(this, arguments));
var _proto = Intrinsic.prototype;
_proto.regexp = function regexp() {
if (!this.regexpCache) this.regexpCache = _regexp(this.name);
return this.regexpCache;
};
_proto.isStretch = function isStretch() {
return this.name === 'stretch' || this.name === 'fill' || this.name === 'fill-available';
};
_proto.replace = function replace(string, prefix) {
if (prefix === '-moz-' && this.isStretch()) {
return string.replace(this.regexp(), '$1-moz-available$3');
}
Intrinsic.prototype.regexp = function regexp() {
if (!this.regexpCache) this.regexpCache = _regexp(this.name);
return this.regexpCache;
};
if (prefix === '-webkit-' && this.isStretch()) {
return string.replace(this.regexp(), '$1-webkit-fill-available$3');
}
Intrinsic.prototype.isStretch = function isStretch() {
return this.name === 'stretch' || this.name === 'fill' || this.name === 'fill-available';
};
return _Value.prototype.replace.call(this, string, prefix);
};
Intrinsic.prototype.replace = function replace(string, prefix) {
if (prefix === '-moz-' && this.isStretch()) {
return string.replace(this.regexp(), '$1-moz-available$3');
} else if (prefix === '-webkit-' && this.isStretch()) {
return string.replace(this.regexp(), '$1-webkit-fill-available$3');
} else {
return _Value.prototype.replace.call(this, string, prefix);
}
};
_proto.old = function old(prefix) {
var prefixed = prefix + this.name;
Intrinsic.prototype.old = function old(prefix) {
var prefixed = prefix + this.name;
if (this.isStretch()) {
if (prefix === '-moz-') {
prefixed = '-moz-available';
} else if (prefix === '-webkit-') {
prefixed = '-webkit-fill-available';
}
}
return new OldValue(this.name, prefixed, prefixed, _regexp(prefixed));
};
if (this.isStretch()) {
if (prefix === '-moz-') {
prefixed = '-moz-available';
} else if (prefix === '-webkit-') {
prefixed = '-webkit-fill-available';
}
}
Intrinsic.prototype.add = function add(decl, prefix) {
if (decl.prop.indexOf('grid') !== -1 && prefix !== '-webkit-') {
return undefined;
}
return _Value.prototype.add.call(this, decl, prefix);
};
return new OldValue(this.name, prefixed, prefixed, _regexp(prefixed));
};
return Intrinsic;
_proto.add = function add(decl, prefix) {
if (decl.prop.indexOf('grid') !== -1 && prefix !== '-webkit-') {
return undefined;
}
return _Value.prototype.add.call(this, decl, prefix);
};
return Intrinsic;
}(Value);
Object.defineProperty(Intrinsic, 'names', {
enumerable: true,
writable: true,
value: ['max-content', 'min-content', 'fit-content', 'fill', 'fill-available', 'stretch']
});
_defineProperty(Intrinsic, "names", ['max-content', 'min-content', 'fit-content', 'fill', 'fill-available', 'stretch']);
module.exports = Intrinsic;
+64 -67
View File
@@ -1,91 +1,88 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var JustifyContent = function (_Declaration) {
_inherits(JustifyContent, _Declaration);
var JustifyContent =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(JustifyContent, _Declaration);
function JustifyContent() {
_classCallCheck(this, JustifyContent);
function JustifyContent() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = JustifyContent.prototype;
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-pack';
}
/**
* Change property name for 2009 and 2012 specs
*/
JustifyContent.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
if (spec === 2012) {
return prefix + 'flex-pack';
}
var _flexSpec = flexSpec(prefix);
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Return property name by final spec
*/
;
spec = _flexSpec[0];
prefix = _flexSpec[1];
_proto.normalize = function normalize() {
return 'justify-content';
}
/**
* Change value for 2009 and 2012 specs
*/
;
if (spec === 2009) {
return prefix + 'box-pack';
} else if (spec === 2012) {
return prefix + 'flex-pack';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
_proto.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
/**
* Return property name by final spec
*/
if (spec === 2009 || spec === 2012) {
var value = JustifyContent.oldValues[decl.value] || decl.value;
decl.value = value;
if (spec !== 2009 || value !== 'distribute') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
} else if (spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
JustifyContent.prototype.normalize = function normalize() {
return 'justify-content';
};
return undefined;
};
/**
* Change value for 2009 and 2012 specs
*/
JustifyContent.prototype.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2009 || spec === 2012) {
var value = JustifyContent.oldValues[decl.value] || decl.value;
decl.value = value;
if (spec !== 2009 || value !== 'distribute') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
} else if (spec === 'final') {
return _Declaration.prototype.set.call(this, decl, prefix);
}
return undefined;
};
return JustifyContent;
return JustifyContent;
}(Declaration);
Object.defineProperty(JustifyContent, 'names', {
enumerable: true,
writable: true,
value: ['justify-content', 'flex-pack', 'box-pack']
});
Object.defineProperty(JustifyContent, 'oldValues', {
enumerable: true,
writable: true,
value: {
'flex-end': 'end',
'flex-start': 'start',
'space-between': 'justify',
'space-around': 'distribute'
}
});
_defineProperty(JustifyContent, "names", ['justify-content', 'flex-pack', 'box-pack']);
_defineProperty(JustifyContent, "oldValues", {
'flex-end': 'end',
'flex-start': 'start',
'space-between': 'justify',
'space-around': 'distribute'
/**
* Change property name for 2009 and 2012 specs
*/
});
module.exports = JustifyContent;
+32 -36
View File
@@ -1,52 +1,48 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var MaskBorder = function (_Declaration) {
_inherits(MaskBorder, _Declaration);
var MaskBorder =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(MaskBorder, _Declaration);
function MaskBorder() {
_classCallCheck(this, MaskBorder);
function MaskBorder() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = MaskBorder.prototype;
/**
* Return property name by final spec
*/
_proto.normalize = function normalize() {
return this.name.replace('box-image', 'border');
}
/**
* Return flex property for 2012 spec
*/
;
_proto.prefixed = function prefixed(prop, prefix) {
var result = _Declaration.prototype.prefixed.call(this, prop, prefix);
if (prefix === '-webkit-') {
result = result.replace('border', 'box-image');
}
/**
* Return property name by final spec
*/
MaskBorder.prototype.normalize = function normalize() {
return this.name.replace('box-image', 'border');
};
return result;
};
/**
* Return flex property for 2012 spec
*/
MaskBorder.prototype.prefixed = function prefixed(prop, prefix) {
var result = _Declaration.prototype.prefixed.call(this, prop, prefix);
if (prefix === '-webkit-') {
result = result.replace('border', 'box-image');
}
return result;
};
return MaskBorder;
return MaskBorder;
}(Declaration);
Object.defineProperty(MaskBorder, 'names', {
enumerable: true,
writable: true,
value: ['mask-border', 'mask-border-source', 'mask-border-slice', 'mask-border-width', 'mask-border-outset', 'mask-border-repeat', 'mask-box-image', 'mask-box-image-source', 'mask-box-image-slice', 'mask-box-image-width', 'mask-box-image-outset', 'mask-box-image-repeat']
});
_defineProperty(MaskBorder, "names", ['mask-border', 'mask-border-source', 'mask-border-slice', 'mask-border-width', 'mask-border-outset', 'mask-border-repeat', 'mask-box-image', 'mask-box-image-source', 'mask-box-image-slice', 'mask-box-image-width', 'mask-box-image-outset', 'mask-box-image-repeat']);
module.exports = MaskBorder;
+52 -55
View File
@@ -1,77 +1,74 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var flexSpec = require('./flex-spec');
var Declaration = require('../declaration');
var Order = function (_Declaration) {
_inherits(Order, _Declaration);
var Order =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(Order, _Declaration);
function Order() {
_classCallCheck(this, Order);
function Order() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = Order.prototype;
/**
* Change property name for 2009 and 2012 specs
*/
_proto.prefixed = function prefixed(prop, prefix) {
var spec;
var _flexSpec = flexSpec(prefix);
spec = _flexSpec[0];
prefix = _flexSpec[1];
if (spec === 2009) {
return prefix + 'box-ordinal-group';
}
/**
* Change property name for 2009 and 2012 specs
*/
Order.prototype.prefixed = function prefixed(prop, prefix) {
var spec = void 0;
if (spec === 2012) {
return prefix + 'flex-order';
}
var _flexSpec = flexSpec(prefix);
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
/**
* Return property name by final spec
*/
;
spec = _flexSpec[0];
prefix = _flexSpec[1];
_proto.normalize = function normalize() {
return 'order';
}
/**
* Fix value for 2009 spec
*/
;
if (spec === 2009) {
return prefix + 'box-ordinal-group';
} else if (spec === 2012) {
return prefix + 'flex-order';
} else {
return _Declaration.prototype.prefixed.call(this, prop, prefix);
}
};
_proto.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
/**
* Return property name by final spec
*/
if (spec === 2009 && /\d/.test(decl.value)) {
decl.value = (parseInt(decl.value) + 1).toString();
return _Declaration.prototype.set.call(this, decl, prefix);
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
Order.prototype.normalize = function normalize() {
return 'order';
};
/**
* Fix value for 2009 spec
*/
Order.prototype.set = function set(decl, prefix) {
var spec = flexSpec(prefix)[0];
if (spec === 2009 && /\d/.test(decl.value)) {
decl.value = (parseInt(decl.value) + 1).toString();
return _Declaration.prototype.set.call(this, decl, prefix);
} else {
return _Declaration.prototype.set.call(this, decl, prefix);
}
};
return Order;
return Order;
}(Declaration);
Object.defineProperty(Order, 'names', {
enumerable: true,
writable: true,
value: ['order', 'flex-order', 'box-ordinal-group']
});
_defineProperty(Order, "names", ['order', 'flex-order', 'box-ordinal-group']);
module.exports = Order;
+40 -41
View File
@@ -1,61 +1,60 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var OldValue = require('../old-value');
var Value = require('../value');
var Pixelated = function (_Value) {
_inherits(Pixelated, _Value);
var Pixelated =
/*#__PURE__*/
function (_Value) {
_inheritsLoose(Pixelated, _Value);
function Pixelated() {
_classCallCheck(this, Pixelated);
function Pixelated() {
return _Value.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Value.apply(this, arguments));
var _proto = Pixelated.prototype;
/**
* Use non-standard name for WebKit and Firefox
*/
_proto.replace = function replace(string, prefix) {
if (prefix === '-webkit-') {
return string.replace(this.regexp(), '$1-webkit-optimize-contrast');
}
/**
* Use non-standard name for WebKit and Firefox
*/
Pixelated.prototype.replace = function replace(string, prefix) {
if (prefix === '-webkit-') {
return string.replace(this.regexp(), '$1-webkit-optimize-contrast');
} else if (prefix === '-moz-') {
return string.replace(this.regexp(), '$1-moz-crisp-edges');
} else {
return _Value.prototype.replace.call(this, string, prefix);
}
};
if (prefix === '-moz-') {
return string.replace(this.regexp(), '$1-moz-crisp-edges');
}
/**
* Different name for WebKit and Firefox
*/
return _Value.prototype.replace.call(this, string, prefix);
}
/**
* Different name for WebKit and Firefox
*/
;
_proto.old = function old(prefix) {
if (prefix === '-webkit-') {
return new OldValue(this.name, '-webkit-optimize-contrast');
}
Pixelated.prototype.old = function old(prefix) {
if (prefix === '-webkit-') {
return new OldValue(this.name, '-webkit-optimize-contrast');
} else if (prefix === '-moz-') {
return new OldValue(this.name, '-moz-crisp-edges');
} else {
return _Value.prototype.old.call(this, prefix);
}
};
if (prefix === '-moz-') {
return new OldValue(this.name, '-moz-crisp-edges');
}
return Pixelated;
return _Value.prototype.old.call(this, prefix);
};
return Pixelated;
}(Value);
Object.defineProperty(Pixelated, 'names', {
enumerable: true,
writable: true,
value: ['pixelated']
});
_defineProperty(Pixelated, "names", ['pixelated']);
module.exports = Pixelated;
+39 -39
View File
@@ -1,58 +1,58 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Selector = require('../selector');
var Placeholder = function (_Selector) {
_inherits(Placeholder, _Selector);
var Placeholder =
/*#__PURE__*/
function (_Selector) {
_inheritsLoose(Placeholder, _Selector);
function Placeholder() {
_classCallCheck(this, Placeholder);
function Placeholder() {
return _Selector.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Selector.apply(this, arguments));
var _proto = Placeholder.prototype;
/**
* Add old mozilla to possible prefixes
*/
_proto.possible = function possible() {
return _Selector.prototype.possible.call(this).concat(['-moz- old', '-ms- old']);
}
/**
* Return different selectors depend on prefix
*/
;
_proto.prefixed = function prefixed(prefix) {
if (prefix === '-webkit-') {
return '::-webkit-input-placeholder';
}
/**
* Add old mozilla to possible prefixes
*/
Placeholder.prototype.possible = function possible() {
return _Selector.prototype.possible.call(this).concat(['-moz- old', '-ms- old']);
};
if (prefix === '-ms-') {
return '::-ms-input-placeholder';
}
/**
* Return different selectors depend on prefix
*/
if (prefix === '-ms- old') {
return ':-ms-input-placeholder';
}
if (prefix === '-moz- old') {
return ':-moz-placeholder';
}
Placeholder.prototype.prefixed = function prefixed(prefix) {
if (prefix === '-webkit-') {
return '::-webkit-input-placeholder';
} else if (prefix === '-ms-') {
return '::-ms-input-placeholder';
} else if (prefix === '-ms- old') {
return ':-ms-input-placeholder';
} else if (prefix === '-moz- old') {
return ':-moz-placeholder';
} else {
return '::' + prefix + 'placeholder';
}
};
return "::" + prefix + "placeholder";
};
return Placeholder;
return Placeholder;
}(Selector);
Object.defineProperty(Placeholder, 'names', {
enumerable: true,
writable: true,
value: ['::placeholder']
});
_defineProperty(Placeholder, "names", ['::placeholder']);
module.exports = Placeholder;
+21 -26
View File
@@ -1,43 +1,38 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var BASIC = ['none', 'underline', 'overline', 'line-through', 'blink', 'inherit', 'initial', 'unset'];
var TextDecoration = function (_Declaration) {
_inherits(TextDecoration, _Declaration);
var TextDecoration =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(TextDecoration, _Declaration);
function TextDecoration() {
_classCallCheck(this, TextDecoration);
function TextDecoration() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
}
var _proto = TextDecoration.prototype;
/**
* Do not add prefixes for basic values.
*/
TextDecoration.prototype.check = function check(decl) {
return decl.value.split(/\s+/).some(function (i) {
return BASIC.indexOf(i) === -1;
});
};
/**
* Do not add prefixes for basic values.
*/
_proto.check = function check(decl) {
return decl.value.split(/\s+/).some(function (i) {
return BASIC.indexOf(i) === -1;
});
};
return TextDecoration;
return TextDecoration;
}(Declaration);
Object.defineProperty(TextDecoration, 'names', {
enumerable: true,
writable: true,
value: ['text-decoration']
});
_defineProperty(TextDecoration, "names", ['text-decoration']);
module.exports = TextDecoration;
+19 -23
View File
@@ -1,39 +1,35 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var TextEmphasisPosition = function (_Declaration) {
_inherits(TextEmphasisPosition, _Declaration);
var TextEmphasisPosition =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(TextEmphasisPosition, _Declaration);
function TextEmphasisPosition() {
_classCallCheck(this, TextEmphasisPosition);
function TextEmphasisPosition() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = TextEmphasisPosition.prototype;
_proto.set = function set(decl, prefix) {
if (prefix === '-webkit-') {
decl.value = decl.value.replace(/\s*(right|left)\s*/i, '');
}
TextEmphasisPosition.prototype.set = function set(decl, prefix) {
if (prefix === '-webkit-') {
decl.value = decl.value.replace(/\s*(right|left)\s*/i, '');
}
return _Declaration.prototype.set.call(this, decl, prefix);
};
return _Declaration.prototype.set.call(this, decl, prefix);
};
return TextEmphasisPosition;
return TextEmphasisPosition;
}(Declaration);
Object.defineProperty(TextEmphasisPosition, 'names', {
enumerable: true,
writable: true,
value: ['text-emphasis-position']
});
_defineProperty(TextEmphasisPosition, "names", ['text-emphasis-position']);
module.exports = TextEmphasisPosition;
+84 -90
View File
@@ -1,118 +1,112 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var TransformDecl = function (_Declaration) {
_inherits(TransformDecl, _Declaration);
var TransformDecl =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(TransformDecl, _Declaration);
function TransformDecl() {
_classCallCheck(this, TransformDecl);
function TransformDecl() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = TransformDecl.prototype;
/**
* Recursively check all parents for @keyframes
*/
_proto.keyframeParents = function keyframeParents(decl) {
var parent = decl.parent;
while (parent) {
if (parent.type === 'atrule' && parent.name === 'keyframes') {
return true;
}
var _parent = parent;
parent = _parent.parent;
}
/**
* Recursively check all parents for @keyframes
*/
TransformDecl.prototype.keyframeParents = function keyframeParents(decl) {
var parent = decl.parent;
return false;
}
/**
* Is transform contain 3D commands
*/
;
while (parent) {
if (parent.type === 'atrule' && parent.name === 'keyframes') {
return true;
}
var _parent = parent;
parent = _parent.parent;
}
return false;
};
_proto.contain3d = function contain3d(decl) {
if (decl.prop === 'transform-origin') {
return false;
}
/**
* Is transform contain 3D commands
*/
for (var _iterator = TransformDecl.functions3d, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
TransformDecl.prototype.contain3d = function contain3d(decl) {
if (decl.prop === 'transform-origin') {
return false;
}
var func = _ref;
for (var _iterator = TransformDecl.functions3d, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (decl.value.indexOf(func + "(") !== -1) {
return true;
}
}
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
return false;
}
/**
* Replace rotateZ to rotate for IE 9
*/
;
var func = _ref;
_proto.set = function set(decl, prefix) {
decl = _Declaration.prototype.set.call(this, decl, prefix);
if (decl.value.indexOf(func + '(') !== -1) {
return true;
}
}
if (prefix === '-ms-') {
decl.value = decl.value.replace(/rotateZ/gi, 'rotate');
}
return false;
};
return decl;
}
/**
* Don't add prefix for IE in keyframes
*/
;
/**
* Replace rotateZ to rotate for IE 9
*/
_proto.insert = function insert(decl, prefix, prefixes) {
if (prefix === '-ms-') {
if (!this.contain3d(decl) && !this.keyframeParents(decl)) {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
} else if (prefix === '-o-') {
if (!this.contain3d(decl)) {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
} else {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
return undefined;
};
TransformDecl.prototype.set = function set(decl, prefix) {
decl = _Declaration.prototype.set.call(this, decl, prefix);
if (prefix === '-ms-') {
decl.value = decl.value.replace(/rotateZ/gi, 'rotate');
}
return decl;
};
/**
* Don't add prefix for IE in keyframes
*/
TransformDecl.prototype.insert = function insert(decl, prefix, prefixes) {
if (prefix === '-ms-') {
if (!this.contain3d(decl) && !this.keyframeParents(decl)) {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
} else if (prefix === '-o-') {
if (!this.contain3d(decl)) {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
} else {
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
}
return undefined;
};
return TransformDecl;
return TransformDecl;
}(Declaration);
Object.defineProperty(TransformDecl, 'names', {
enumerable: true,
writable: true,
value: ['transform', 'transform-origin']
});
Object.defineProperty(TransformDecl, 'functions3d', {
enumerable: true,
writable: true,
value: ['matrix3d', 'translate3d', 'translateZ', 'scale3d', 'scaleZ', 'rotate3d', 'rotateX', 'rotateY', 'perspective']
});
_defineProperty(TransformDecl, "names", ['transform', 'transform-origin']);
_defineProperty(TransformDecl, "functions3d", ['matrix3d', 'translate3d', 'translateZ', 'scale3d', 'scaleZ', 'rotate3d', 'rotateX', 'rotateY', 'perspective']);
module.exports = TransformDecl;
+44 -33
View File
@@ -1,50 +1,61 @@
'use strict';
"use strict";
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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; }
var Declaration = require('../declaration');
var WritingMode = function (_Declaration) {
_inherits(WritingMode, _Declaration);
var WritingMode =
/*#__PURE__*/
function (_Declaration) {
_inheritsLoose(WritingMode, _Declaration);
function WritingMode() {
_classCallCheck(this, WritingMode);
function WritingMode() {
return _Declaration.apply(this, arguments) || this;
}
return _possibleConstructorReturn(this, _Declaration.apply(this, arguments));
var _proto = WritingMode.prototype;
_proto.insert = function insert(decl, prefix, prefixes) {
if (prefix === '-ms-') {
var cloned = this.set(this.clone(decl), prefix);
if (this.needCascade(decl)) {
cloned.raws.before = this.calcBefore(prefixes, decl, prefix);
}
var direction = 'ltr';
decl.parent.nodes.forEach(function (i) {
if (i.prop === 'direction') {
if (i.value === 'rtl' || i.value === 'ltr') direction = i.value;
}
});
cloned.value = WritingMode.msValues[direction][decl.value] || decl.value;
return decl.parent.insertBefore(decl, cloned);
}
WritingMode.prototype.set = function set(decl, prefix) {
if (prefix === '-ms-') {
decl.value = WritingMode.msValues[decl.value] || decl.value;
return _Declaration.prototype.set.call(this, decl, prefix);
} else {
return _Declaration.prototype.set.call(this, decl, prefix);
}
};
return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
};
return WritingMode;
return WritingMode;
}(Declaration);
Object.defineProperty(WritingMode, 'names', {
enumerable: true,
writable: true,
value: ['writing-mode']
});
Object.defineProperty(WritingMode, 'msValues', {
enumerable: true,
writable: true,
value: {
'horizontal-tb': 'lr-tb',
'vertical-rl': 'tb-rl',
'vertical-lr': 'tb-lr'
}
});
_defineProperty(WritingMode, "names", ['writing-mode']);
_defineProperty(WritingMode, "msValues", {
ltr: {
'horizontal-tb': 'lr-tb',
'vertical-rl': 'tb-rl',
'vertical-lr': 'tb-lr'
},
rtl: {
'horizontal-tb': 'rl-tb',
'vertical-rl': 'bt-rl',
'vertical-lr': 'bt-lr'
}
});
module.exports = WritingMode;