border-radius.js 2.1 KB

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