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