benchmark/packages/302/dynamic/plugins/transition.js
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.default = transition;
var _hyphenateProperty = require('css-in-js-utils/lib/hyphenateProperty');
var _hyphenateProperty2 = _interopRequireDefault(_hyphenateProperty);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var properties = {
transition: true,
transitionProperty: true,
WebkitTransition: true,
WebkitTransitionProperty: true,
MozTransition: true,
MozTransitionProperty: true
};
var requiresPrefixDashCased = void 0;
function transition(property, value, style, _ref) {
var cssPrefix = _ref.cssPrefix,
keepUnprefixed = _ref.keepUnprefixed,
requiresPrefix = _ref.requiresPrefix;
if (typeof value === 'string' && properties.hasOwnProperty(property)) {
var _ret = function () {
// memoize the prefix array for later use
if (!requiresPrefixDashCased) {
requiresPrefixDashCased = Object.keys(requiresPrefix).map(function (prop) {
return (0, _hyphenateProperty2.default)(prop);
});
}
// only split multi values, not cubic beziers
var multipleValues = value.split(/,(?![^()]*(?:\([^()]*\))?\))/g);
requiresPrefixDashCased.forEach(function (prop) {
multipleValues.forEach(function (val, index) {
if (val.indexOf(prop) > -1 && prop !== 'order') {
multipleValues[index] = val.replace(prop, cssPrefix + prop) + (keepUnprefixed ? ',' + val : '');
}
});
});
return {
v: multipleValues.join(',')
};
}();
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
}
module.exports = exports['default'];