[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 AlignContent = /*#__PURE__*/function (_Declaration) {
|
---|
| 14 | _inheritsLoose(AlignContent, _Declaration);
|
---|
| 15 |
|
---|
| 16 | function AlignContent() {
|
---|
| 17 | return _Declaration.apply(this, arguments) || this;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | var _proto = AlignContent.prototype;
|
---|
| 21 |
|
---|
| 22 | /**
|
---|
| 23 | * Change property name for 2012 spec
|
---|
| 24 | */
|
---|
| 25 | _proto.prefixed = function prefixed(prop, prefix) {
|
---|
| 26 | var spec;
|
---|
| 27 |
|
---|
| 28 | var _flexSpec = flexSpec(prefix);
|
---|
| 29 |
|
---|
| 30 | spec = _flexSpec[0];
|
---|
| 31 | prefix = _flexSpec[1];
|
---|
| 32 |
|
---|
| 33 | if (spec === 2012) {
|
---|
| 34 | return prefix + 'flex-line-pack';
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | return _Declaration.prototype.prefixed.call(this, prop, prefix);
|
---|
| 38 | }
|
---|
| 39 | /**
|
---|
| 40 | * Return property name by final spec
|
---|
| 41 | */
|
---|
| 42 | ;
|
---|
| 43 |
|
---|
| 44 | _proto.normalize = function normalize() {
|
---|
| 45 | return 'align-content';
|
---|
| 46 | }
|
---|
| 47 | /**
|
---|
| 48 | * Change value for 2012 spec and ignore prefix for 2009
|
---|
| 49 | */
|
---|
| 50 | ;
|
---|
| 51 |
|
---|
| 52 | _proto.set = function set(decl, prefix) {
|
---|
| 53 | var spec = flexSpec(prefix)[0];
|
---|
| 54 |
|
---|
| 55 | if (spec === 2012) {
|
---|
| 56 | decl.value = AlignContent.oldValues[decl.value] || decl.value;
|
---|
| 57 | return _Declaration.prototype.set.call(this, decl, prefix);
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | if (spec === 'final') {
|
---|
| 61 | return _Declaration.prototype.set.call(this, decl, prefix);
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | return undefined;
|
---|
| 65 | };
|
---|
| 66 |
|
---|
| 67 | return AlignContent;
|
---|
| 68 | }(Declaration);
|
---|
| 69 |
|
---|
| 70 | _defineProperty(AlignContent, "names", ['align-content', 'flex-line-pack']);
|
---|
| 71 |
|
---|
| 72 | _defineProperty(AlignContent, "oldValues", {
|
---|
| 73 | 'flex-end': 'end',
|
---|
| 74 | 'flex-start': 'start',
|
---|
| 75 | 'space-between': 'justify',
|
---|
| 76 | 'space-around': 'distribute'
|
---|
| 77 | });
|
---|
| 78 |
|
---|
| 79 | module.exports = AlignContent; |
---|