flex-grow.js 1.7 KB

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