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.

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