universal-transition
Advanced tools
Comparing version 0.4.10 to 0.4.11
@@ -143,2 +143,4 @@ module.exports = function(require, exports, module) { | ||
var _typeof2 = 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; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -148,3 +150,7 @@ 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; }; | ||
var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) { | ||
return typeof obj === "undefined" ? "undefined" : _typeof2(obj); | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj); | ||
}; | ||
@@ -210,3 +216,4 @@ // https://www.w3.org/TR/html5/webappapis.html#dom-navigator-appcodename | ||
var defaultRem = void 0; | ||
// Default 1 rem to 1 px | ||
var defaultRemUnit = 1; | ||
@@ -229,6 +236,6 @@ /** | ||
function calcRem(str) { | ||
var rem = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultRem; | ||
var remUnit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultRemUnit; | ||
return str.replace(REM_REG, function (remValue) { | ||
return parseFloat(remValue) * rem + 'px'; | ||
return str.replace(REM_REG, function (rem) { | ||
return parseFloat(rem) * remUnit + 'px'; | ||
}); | ||
@@ -238,7 +245,7 @@ } | ||
function getRem() { | ||
return defaultRem; | ||
return defaultRemUnit; | ||
} | ||
function setRem(rem) { | ||
defaultRem = rem; | ||
defaultRemUnit = rem; | ||
} | ||
@@ -251,6 +258,8 @@ | ||
function convertUnit(val, prop) { | ||
var remUnit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultRemUnit; | ||
if (prop && isUnitNumber(val, prop)) { | ||
return val * defaultRem + 'px'; | ||
return val * remUnit + 'px'; | ||
} else if (isRem(val)) { | ||
return calcRem(val); | ||
return calcRem(val, remUnit); | ||
} | ||
@@ -257,0 +266,0 @@ |
@@ -165,2 +165,4 @@ | ||
var _typeof2 = 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; }; | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -170,3 +172,7 @@ 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; }; | ||
var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) { | ||
return typeof obj === "undefined" ? "undefined" : _typeof2(obj); | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj); | ||
}; | ||
@@ -232,3 +238,4 @@ // https://www.w3.org/TR/html5/webappapis.html#dom-navigator-appcodename | ||
var defaultRem = void 0; | ||
// Default 1 rem to 1 px | ||
var defaultRemUnit = 1; | ||
@@ -251,6 +258,6 @@ /** | ||
function calcRem(str) { | ||
var rem = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultRem; | ||
var remUnit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultRemUnit; | ||
return str.replace(REM_REG, function (remValue) { | ||
return parseFloat(remValue) * rem + 'px'; | ||
return str.replace(REM_REG, function (rem) { | ||
return parseFloat(rem) * remUnit + 'px'; | ||
}); | ||
@@ -260,7 +267,7 @@ } | ||
function getRem() { | ||
return defaultRem; | ||
return defaultRemUnit; | ||
} | ||
function setRem(rem) { | ||
defaultRem = rem; | ||
defaultRemUnit = rem; | ||
} | ||
@@ -273,6 +280,8 @@ | ||
function convertUnit(val, prop) { | ||
var remUnit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultRemUnit; | ||
if (prop && isUnitNumber(val, prop)) { | ||
return val * defaultRem + 'px'; | ||
return val * remUnit + 'px'; | ||
} else if (isRem(val)) { | ||
return calcRem(val); | ||
return calcRem(val, remUnit); | ||
} | ||
@@ -279,0 +288,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define)define("universal-transition",function(n,t,o){o.exports=e()});else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:this,n.UniversalTransition=e()}}(function(){return function(e){function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}var t={};return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=0)}([function(e,n,t){"use strict";function o(e,n,o,u){"function"!=typeof o&&null!=o||(u=o,o={timingFunction:"ease",duration:0,delay:0});for(var a in n)n[a]=(0,r.convertUnit)(n[a],a);if(i.isWeex){t(3).transition(e.ref,{styles:n,timingFunction:o.timingFunction||"linear",delay:o.delay||0,duration:o.duration||0},u||function(){})}else if(i.isWeb){var f=o.duration||0,s=o.timingFunction||"linear",l=o.delay||0,d="all "+f+"ms "+s+" "+l+"ms";if(e.style.transition=d,e.style.webkitTransition=d,u){var c=function n(t){t.stopPropagation(),e.removeEventListener("webkitTransitionEnd",n),e.removeEventListener("transitionend",n),e.style.transition="",e.style.webkitTransition="",u()};e.addEventListener("webkitTransitionEnd",c),e.addEventListener("transitionend",c)}for(var p in n){var y=n[p];e.style[p]=y}}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=o;var i=t(1),r=t(2);e.exports=n.default},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};n.isWeb="object"===("undefined"==typeof navigator?"undefined":o(navigator))&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product),n.isNode="undefined"!=typeof process&&!(!process.versions||!process.versions.node),n.isWeex="function"==typeof callNative,n.isReactNative="undefined"!=typeof __fbBatchedBridgeConfig},function(e,n,t){"use strict";function o(e){return"string"==typeof e&&-1!==e.indexOf(l)}function i(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;return e.replace(d,function(e){return parseFloat(e)*n+"px"})}function r(){return c}function u(e){c=e}function a(e,n){return"number"==typeof e&&!s[n]}function f(e,n){return n&&a(e,n)?e*c+"px":o(e)?i(e):e}Object.defineProperty(n,"__esModule",{value:!0}),n.isRem=o,n.calcRem=i,n.getRem=r,n.setRem=u,n.isUnitNumber=a,n.convertUnit=f;var s={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,fontWeight:!0,lineClamp:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,lines:!0},l="rem",d=/[-+]?\d*\.?\d+rem/g,c=void 0},function(e,n){e.exports=require("@weex-module/animation")}])}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define)define("universal-transition",function(n,t,o){o.exports=e()});else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:this,n.UniversalTransition=e()}}(function(){return function(e){function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}var t={};return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=0)}([function(e,n,t){"use strict";function o(e,n,o,u){"function"!=typeof o&&null!=o||(u=o,o={timingFunction:"ease",duration:0,delay:0});for(var f in n)n[f]=(0,r.convertUnit)(n[f],f);if(i.isWeex){t(3).transition(e.ref,{styles:n,timingFunction:o.timingFunction||"linear",delay:o.delay||0,duration:o.duration||0},u||function(){})}else if(i.isWeb){var a=o.duration||0,s=o.timingFunction||"linear",l=o.delay||0,d="all "+a+"ms "+s+" "+l+"ms";if(e.style.transition=d,e.style.webkitTransition=d,u){var c=function n(t){t.stopPropagation(),e.removeEventListener("webkitTransitionEnd",n),e.removeEventListener("transitionend",n),e.style.transition="",e.style.webkitTransition="",u()};e.addEventListener("webkitTransitionEnd",c),e.addEventListener("transitionend",c)}for(var p in n){var y=n[p];e.style[p]=y}}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=o;var i=t(1),r=t(2);e.exports=n.default},function(e,n,t){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(n,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?function(e){return void 0===e?"undefined":o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":o(e)};n.isWeb="object"===("undefined"==typeof navigator?"undefined":i(navigator))&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product),n.isNode="undefined"!=typeof process&&!(!process.versions||!process.versions.node),n.isWeex="function"==typeof callNative,n.isReactNative="undefined"!=typeof __fbBatchedBridgeConfig},function(e,n,t){"use strict";function o(e){return"string"==typeof e&&-1!==e.indexOf(l)}function i(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;return e.replace(d,function(e){return parseFloat(e)*n+"px"})}function r(){return c}function u(e){c=e}function f(e,n){return"number"==typeof e&&!s[n]}function a(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c;return n&&f(e,n)?e*t+"px":o(e)?i(e,t):e}Object.defineProperty(n,"__esModule",{value:!0}),n.isRem=o,n.calcRem=i,n.getRem=r,n.setRem=u,n.isUnitNumber=f,n.convertUnit=a;var s={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,fontWeight:!0,lineClamp:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,lines:!0},l="rem",d=/[-+]?\d*\.?\d+rem/g,c=1},function(e,n){e.exports=require("@weex-module/animation")}])}); |
{ | ||
"name": "universal-transition", | ||
"version": "0.4.10", | ||
"version": "0.4.11", | ||
"description": "A universal transition API.", | ||
@@ -16,5 +16,5 @@ "license": "BSD-3-Clause", | ||
"dependencies": { | ||
"style-unit": "^0.4.10", | ||
"universal-env": "^0.4.10" | ||
"style-unit": "^0.4.11", | ||
"universal-env": "^0.4.11" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53534
656
Updatedstyle-unit@^0.4.11
Updateduniversal-env@^0.4.11