You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.3 KiB

4 years ago
  1. "use strict";
  2. 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; }
  3. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
  4. 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; }
  5. var flexSpec = require('./flex-spec');
  6. var Declaration = require('../declaration');
  7. var AlignContent =
  8. /*#__PURE__*/
  9. function (_Declaration) {
  10. _inheritsLoose(AlignContent, _Declaration);
  11. function AlignContent() {
  12. return _Declaration.apply(this, arguments) || this;
  13. }
  14. var _proto = AlignContent.prototype;
  15. /**
  16. * Change property name for 2012 spec
  17. */
  18. _proto.prefixed = function prefixed(prop, prefix) {
  19. var spec;
  20. var _flexSpec = flexSpec(prefix);
  21. spec = _flexSpec[0];
  22. prefix = _flexSpec[1];
  23. if (spec === 2012) {
  24. return prefix + 'flex-line-pack';
  25. }
  26. return _Declaration.prototype.prefixed.call(this, prop, prefix);
  27. }
  28. /**
  29. * Return property name by final spec
  30. */
  31. ;
  32. _proto.normalize = function normalize() {
  33. return 'align-content';
  34. }
  35. /**
  36. * Change value for 2012 spec and ignore prefix for 2009
  37. */
  38. ;
  39. _proto.set = function set(decl, prefix) {
  40. var spec = flexSpec(prefix)[0];
  41. if (spec === 2012) {
  42. decl.value = AlignContent.oldValues[decl.value] || decl.value;
  43. return _Declaration.prototype.set.call(this, decl, prefix);
  44. }
  45. if (spec === 'final') {
  46. return _Declaration.prototype.set.call(this, decl, prefix);
  47. }
  48. return undefined;
  49. };
  50. return AlignContent;
  51. }(Declaration);
  52. _defineProperty(AlignContent, "names", ['align-content', 'flex-line-pack']);
  53. _defineProperty(AlignContent, "oldValues", {
  54. 'flex-end': 'end',
  55. 'flex-start': 'start',
  56. 'space-between': 'justify',
  57. 'space-around': 'distribute'
  58. });
  59. module.exports = AlignContent;