flex-shrink.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 FlexShrink = /*#__PURE__*/function (_Declaration) {
  8. _inheritsLoose(FlexShrink, _Declaration);
  9. function FlexShrink() {
  10. return _Declaration.apply(this, arguments) || this;
  11. }
  12. var _proto = FlexShrink.prototype;
  13. /**
  14. * Return property name by final spec
  15. */
  16. _proto.normalize = function normalize() {
  17. return 'flex-shrink';
  18. }
  19. /**
  20. * Return flex property for 2012 spec
  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 === 2012) {
  29. return prefix + 'flex-negative';
  30. }
  31. return _Declaration.prototype.prefixed.call(this, prop, prefix);
  32. }
  33. /**
  34. * Ignore 2009 spec and use flex property for 2012
  35. */
  36. ;
  37. _proto.set = function set(decl, prefix) {
  38. var spec;
  39. var _flexSpec2 = flexSpec(prefix);
  40. spec = _flexSpec2[0];
  41. prefix = _flexSpec2[1];
  42. if (spec === 2012 || spec === 'final') {
  43. return _Declaration.prototype.set.call(this, decl, prefix);
  44. }
  45. return undefined;
  46. };
  47. return FlexShrink;
  48. }(Declaration);
  49. _defineProperty(FlexShrink, "names", ['flex-shrink', 'flex-negative']);
  50. module.exports = FlexShrink;