pixelated.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 OldValue = require('../old-value');
  6. var Value = require('../value');
  7. var Pixelated = /*#__PURE__*/function (_Value) {
  8. _inheritsLoose(Pixelated, _Value);
  9. function Pixelated() {
  10. return _Value.apply(this, arguments) || this;
  11. }
  12. var _proto = Pixelated.prototype;
  13. /**
  14. * Use non-standard name for WebKit and Firefox
  15. */
  16. _proto.replace = function replace(string, prefix) {
  17. if (prefix === '-webkit-') {
  18. return string.replace(this.regexp(), '$1-webkit-optimize-contrast');
  19. }
  20. if (prefix === '-moz-') {
  21. return string.replace(this.regexp(), '$1-moz-crisp-edges');
  22. }
  23. return _Value.prototype.replace.call(this, string, prefix);
  24. }
  25. /**
  26. * Different name for WebKit and Firefox
  27. */
  28. ;
  29. _proto.old = function old(prefix) {
  30. if (prefix === '-webkit-') {
  31. return new OldValue(this.name, '-webkit-optimize-contrast');
  32. }
  33. if (prefix === '-moz-') {
  34. return new OldValue(this.name, '-moz-crisp-edges');
  35. }
  36. return _Value.prototype.old.call(this, prefix);
  37. };
  38. return Pixelated;
  39. }(Value);
  40. _defineProperty(Pixelated, "names", ['pixelated']);
  41. module.exports = Pixelated;