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.

77 lines
2.1 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 AlignItems =
  8. /*#__PURE__*/
  9. function (_Declaration) {
  10. _inheritsLoose(AlignItems, _Declaration);
  11. function AlignItems() {
  12. return _Declaration.apply(this, arguments) || this;
  13. }
  14. var _proto = AlignItems.prototype;
  15. /**
  16. * Change property name for 2009 and 2012 specs
  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 === 2009) {
  24. return prefix + 'box-align';
  25. }
  26. if (spec === 2012) {
  27. return prefix + 'flex-align';
  28. }
  29. return _Declaration.prototype.prefixed.call(this, prop, prefix);
  30. }
  31. /**
  32. * Return property name by final spec
  33. */
  34. ;
  35. _proto.normalize = function normalize() {
  36. return 'align-items';
  37. }
  38. /**
  39. * Change value for 2009 and 2012 specs
  40. */
  41. ;
  42. _proto.set = function set(decl, prefix) {
  43. var spec = flexSpec(prefix)[0];
  44. if (spec === 2009 || spec === 2012) {
  45. decl.value = AlignItems.oldValues[decl.value] || decl.value;
  46. }
  47. return _Declaration.prototype.set.call(this, decl, prefix);
  48. };
  49. return AlignItems;
  50. }(Declaration);
  51. _defineProperty(AlignItems, "names", ['align-items', 'flex-align', 'box-align']);
  52. _defineProperty(AlignItems, "oldValues", {
  53. 'flex-end': 'end',
  54. 'flex-start': 'start'
  55. });
  56. module.exports = AlignItems;