flex-grow.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 Flex = /*#__PURE__*/function (_Declaration) {
  8. _inheritsLoose(Flex, _Declaration);
  9. function Flex() {
  10. return _Declaration.apply(this, arguments) || this;
  11. }
  12. var _proto = Flex.prototype;
  13. /**
  14. * Return property name by final spec
  15. */
  16. _proto.normalize = function normalize() {
  17. return 'flex';
  18. }
  19. /**
  20. * Return flex property for 2009 and 2012 specs
  21. */
  22. ;
  23. _proto.prefixed = function prefixed(prop, prefix) {
  24. var spec;
  25. var _flexSpec = flexSpec(prefix);
  26. spec = _flexSpec[0];
  27. prefix = _flexSpec[1];
  28. if (spec === 2009) {
  29. return prefix + 'box-flex';
  30. }
  31. if (spec === 2012) {
  32. return prefix + 'flex-positive';
  33. }
  34. return _Declaration.prototype.prefixed.call(this, prop, prefix);
  35. };
  36. return Flex;
  37. }(Declaration);
  38. _defineProperty(Flex, "names", ['flex-grow', 'flex-positive']);
  39. module.exports = Flex;