border-radius.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 Declaration = require('../declaration');
  6. var BorderRadius = /*#__PURE__*/function (_Declaration) {
  7. _inheritsLoose(BorderRadius, _Declaration);
  8. function BorderRadius() {
  9. return _Declaration.apply(this, arguments) || this;
  10. }
  11. var _proto = BorderRadius.prototype;
  12. /**
  13. * Change syntax, when add Mozilla prefix
  14. */
  15. _proto.prefixed = function prefixed(prop, prefix) {
  16. if (prefix === '-moz-') {
  17. return prefix + (BorderRadius.toMozilla[prop] || prop);
  18. }
  19. return _Declaration.prototype.prefixed.call(this, prop, prefix);
  20. }
  21. /**
  22. * Return unprefixed version of property
  23. */
  24. ;
  25. _proto.normalize = function normalize(prop) {
  26. return BorderRadius.toNormal[prop] || prop;
  27. };
  28. return BorderRadius;
  29. }(Declaration);
  30. _defineProperty(BorderRadius, "names", ['border-radius']);
  31. _defineProperty(BorderRadius, "toMozilla", {});
  32. _defineProperty(BorderRadius, "toNormal", {});
  33. for (var _i = 0, _arr = ['top', 'bottom']; _i < _arr.length; _i++) {
  34. var ver = _arr[_i];
  35. for (var _i2 = 0, _arr2 = ['left', 'right']; _i2 < _arr2.length; _i2++) {
  36. var hor = _arr2[_i2];
  37. var normal = "border-" + ver + "-" + hor + "-radius";
  38. var mozilla = "border-radius-" + ver + hor;
  39. BorderRadius.names.push(normal);
  40. BorderRadius.names.push(mozilla);
  41. BorderRadius.toMozilla[normal] = mozilla;
  42. BorderRadius.toNormal[mozilla] = normal;
  43. }
  44. }
  45. module.exports = BorderRadius;