align-content.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. (function() {
  2. var AlignContent, Declaration, flexSpec,
  3. __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  4. __hasProp = {}.hasOwnProperty;
  5. flexSpec = require('./flex-spec');
  6. Declaration = require('../declaration');
  7. AlignContent = (function(_super) {
  8. __extends(AlignContent, _super);
  9. function AlignContent() {
  10. return AlignContent.__super__.constructor.apply(this, arguments);
  11. }
  12. AlignContent.names = ['align-content', 'flex-line-pack'];
  13. AlignContent.oldValues = {
  14. 'flex-end': 'end',
  15. 'flex-start': 'start',
  16. 'space-between': 'justify',
  17. 'space-around': 'distribute'
  18. };
  19. AlignContent.prototype.prefixed = function(prop, prefix) {
  20. var spec, _ref;
  21. _ref = flexSpec(prefix), spec = _ref[0], prefix = _ref[1];
  22. if (spec === 2012) {
  23. return prefix + 'flex-line-pack';
  24. } else {
  25. return AlignContent.__super__.prefixed.apply(this, arguments);
  26. }
  27. };
  28. AlignContent.prototype.normalize = function(prop) {
  29. return 'align-content';
  30. };
  31. AlignContent.prototype.set = function(decl, prefix) {
  32. var spec;
  33. spec = flexSpec(prefix)[0];
  34. if (spec === 2012) {
  35. decl.value = AlignContent.oldValues[decl.value] || decl.value;
  36. return AlignContent.__super__.set.call(this, decl, prefix);
  37. } else if (spec === 'final') {
  38. return AlignContent.__super__.set.apply(this, arguments);
  39. }
  40. };
  41. return AlignContent;
  42. })(Declaration);
  43. module.exports = AlignContent;
  44. }).call(this);