[6a3a178] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
---|
| 4 |
|
---|
| 5 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
|
---|
| 6 |
|
---|
| 7 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
---|
| 8 |
|
---|
| 9 | var flexSpec = require('./flex-spec');
|
---|
| 10 |
|
---|
| 11 | var Declaration = require('../declaration');
|
---|
| 12 |
|
---|
| 13 | var FlexBasis = /*#__PURE__*/function (_Declaration) {
|
---|
| 14 | _inheritsLoose(FlexBasis, _Declaration);
|
---|
| 15 |
|
---|
| 16 | function FlexBasis() {
|
---|
| 17 | return _Declaration.apply(this, arguments) || this;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | var _proto = FlexBasis.prototype;
|
---|
| 21 |
|
---|
| 22 | /**
|
---|
| 23 | * Return property name by final spec
|
---|
| 24 | */
|
---|
| 25 | _proto.normalize = function normalize() {
|
---|
| 26 | return 'flex-basis';
|
---|
| 27 | }
|
---|
| 28 | /**
|
---|
| 29 | * Return flex property for 2012 spec
|
---|
| 30 | */
|
---|
| 31 | ;
|
---|
| 32 |
|
---|
| 33 | _proto.prefixed = function prefixed(prop, prefix) {
|
---|
| 34 | var spec;
|
---|
| 35 |
|
---|
| 36 | var _flexSpec = flexSpec(prefix);
|
---|
| 37 |
|
---|
| 38 | spec = _flexSpec[0];
|
---|
| 39 | prefix = _flexSpec[1];
|
---|
| 40 |
|
---|
| 41 | if (spec === 2012) {
|
---|
| 42 | return prefix + 'flex-preferred-size';
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | return _Declaration.prototype.prefixed.call(this, prop, prefix);
|
---|
| 46 | }
|
---|
| 47 | /**
|
---|
| 48 | * Ignore 2009 spec and use flex property for 2012
|
---|
| 49 | */
|
---|
| 50 | ;
|
---|
| 51 |
|
---|
| 52 | _proto.set = function set(decl, prefix) {
|
---|
| 53 | var spec;
|
---|
| 54 |
|
---|
| 55 | var _flexSpec2 = flexSpec(prefix);
|
---|
| 56 |
|
---|
| 57 | spec = _flexSpec2[0];
|
---|
| 58 | prefix = _flexSpec2[1];
|
---|
| 59 |
|
---|
| 60 | if (spec === 2012 || spec === 'final') {
|
---|
| 61 | return _Declaration.prototype.set.call(this, decl, prefix);
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | return undefined;
|
---|
| 65 | };
|
---|
| 66 |
|
---|
| 67 | return FlexBasis;
|
---|
| 68 | }(Declaration);
|
---|
| 69 |
|
---|
| 70 | _defineProperty(FlexBasis, "names", ['flex-basis', 'flex-preferred-size']);
|
---|
| 71 |
|
---|
| 72 | module.exports = FlexBasis; |
---|