nuke-transition
Advanced tools
Comparing version 2.1.3 to 2.1.4
@@ -6,2 +6,14 @@ # Change Log | ||
<a name="2.1.4"></a> | ||
## [2.1.4](https://gitlab.alibaba-inc.com/nuke/transition/compare/v2.1.3...v2.1.4) (2018-08-15) | ||
### Bug Fixes | ||
* eslint for import {isWeb} from nuke-env ([d856e2c](https://gitlab.alibaba-inc.com/nuke/transition/commit/d856e2c)) | ||
<a name="2.1.3"></a> | ||
@@ -8,0 +20,0 @@ ## [2.1.3](https://gitlab.alibaba-inc.com/nuke/transition/compare/v2.1.2...v2.1.3) (2018-08-15) |
@@ -1,1 +0,1 @@ | ||
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});var _nukeEnv=require('nuke-env'),_nukeEnv2=_interopRequireDefault(_nukeEnv),_transition=require('./transition'),_transition2=_interopRequireDefault(_transition);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var isWeex=_nukeEnv2.default.isWeex,isWeb=_nukeEnv2.default.isWeb;function getDefaultRem(){return document.documentElement.clientWidth/750}function parseRem(val){var regArr={translateX:'translateX\\(([-+]?\\w+)\\)',translateY:'translateY\\(([-+]?\\w+)\\)',translate:'translate\\(([-+]?\\w+)\\,\\s?([-+]?\\w+)\\)'};for(var p in regArr){var reg=new RegExp(regArr[p]);if(val.match(reg))if('translateX'==p||'translateY'==p){var matchArr=val.match(reg),num=parseInt(matchArr[1],10);val=val.replace(matchArr[1],getPx(matchArr[1]))}else if('translate'==p){var matchArr=val.match(reg),x=matchArr[1],y=matchArr[2];val='translate('+getPx(x)+','+getPx(y)+')'}}return val}function getPx(str){return isWeex?parseInt(str,10):parseInt(str,10)*getDefaultRem().toString()+'px'}function Trans(node,styles,options,callback){for(var key in styles)if('transform'===key||'webkitTransform'==key)styles[key]=parseRem(styles[key]);else if(arrayContains(key,['top','left','height','bottom','right','width'])){var matchArr=styles[key].match(/(\d+)(rem){0,1}/);styles[key]=styles[key].replace(matchArr[0],getPx(matchArr[1]))}(0,_transition2.default)(node,styles,options,callback)}function arrayContains(value,arr){for(var i=0;i<arr.length;i++)if(value===arr[i])return!0;return!1}exports.default=Trans,module.exports=exports['default']; | ||
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});var _nukeEnv=require('nuke-env'),_transition=require('./transition'),_transition2=_interopRequireDefault(_transition);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function getDefaultRem(){return document.documentElement.clientWidth/750}function parseRem(val){var regArr={translateX:'translateX\\(([-+]?\\w+)\\)',translateY:'translateY\\(([-+]?\\w+)\\)',translate:'translate\\(([-+]?\\w+)\\,\\s?([-+]?\\w+)\\)'};for(var p in regArr){var reg=new RegExp(regArr[p]);if(val.match(reg))if('translateX'==p||'translateY'==p){var matchArr=val.match(reg),num=parseInt(matchArr[1],10);val=val.replace(matchArr[1],getPx(matchArr[1]))}else if('translate'==p){var matchArr=val.match(reg),x=matchArr[1],y=matchArr[2];val='translate('+getPx(x)+','+getPx(y)+')'}}return val}function getPx(str){return _nukeEnv.isWeex?parseInt(str,10):parseInt(str,10)*getDefaultRem().toString()+'px'}function Trans(node,styles,options,callback){for(var key in styles)if('transform'===key||'webkitTransform'==key)styles[key]=parseRem(styles[key]);else if(arrayContains(key,['top','left','height','bottom','right','width'])){var matchArr=styles[key].match(/(\d+)(rem){0,1}/);styles[key]=styles[key].replace(matchArr[0],getPx(matchArr[1]))}(0,_transition2.default)(node,styles,options,callback)}function arrayContains(value,arr){for(var i=0;i<arr.length;i++)if(value===arr[i])return!0;return!1}exports.default=Trans,module.exports=exports['default']; |
{ | ||
"name": "nuke-transition", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "渐变", | ||
@@ -31,9 +31,9 @@ "main": "lib/index", | ||
"devDependencies": { | ||
"nuke-button": "^2.1.3", | ||
"nuke-button": "^2.1.4", | ||
"nuke-dimensions": "^2.1.3", | ||
"nuke-image": "^2.1.3", | ||
"nuke-page": "^2.1.3", | ||
"nuke-scroll-view": "^2.1.3", | ||
"nuke-page": "^2.1.4", | ||
"nuke-scroll-view": "^2.1.4", | ||
"nuke-text": "^2.1.3", | ||
"nuke-view": "^2.1.3" | ||
"nuke-view": "^2.1.4" | ||
}, | ||
@@ -44,3 +44,3 @@ "publishConfig": { | ||
"license": "Apache", | ||
"gitHead": "c5505fdafa2a561e741007ab32582394b5f028aa" | ||
"gitHead": "8b2a213253ed6cdf6d613a10bea387e80043fa6a" | ||
} |
@@ -16,6 +16,8 @@ /** @jsx createElement */ | ||
*/ | ||
'use strict'; | ||
import Env from 'nuke-env'; | ||
const { isWeex, isWeb } = Env; | ||
import { isWeex, isWeb } from 'nuke-env'; | ||
import Transition from './transition'; | ||
function getDefaultRem() { | ||
@@ -25,20 +27,20 @@ return document.documentElement.clientWidth / 750; | ||
function parseRem(val) { | ||
let regArr = { | ||
const regArr = { | ||
translateX: 'translateX\\(([-+]?\\w+)\\)', | ||
translateY: 'translateY\\(([-+]?\\w+)\\)', | ||
translate: 'translate\\(([-+]?\\w+)\\,\\s?([-+]?\\w+)\\)' | ||
translate: 'translate\\(([-+]?\\w+)\\,\\s?([-+]?\\w+)\\)', | ||
}; | ||
for (var p in regArr) { | ||
var reg = new RegExp(regArr[p]); | ||
for (const p in regArr) { | ||
const reg = new RegExp(regArr[p]); | ||
if (val.match(reg)) { | ||
if (p === 'translateX' || p === 'translateY') { | ||
var matchArr = val.match(reg); | ||
var num = parseInt(matchArr[1], 10); | ||
const num = parseInt(matchArr[1], 10); | ||
val = val.replace(matchArr[1], getPx(matchArr[1])); | ||
} else if (p === 'translate') { | ||
var matchArr = val.match(reg); | ||
var x = matchArr[1]; | ||
var y = matchArr[2]; | ||
val = 'translate(' + getPx(x) + ',' + getPx(y) + ')'; | ||
const x = matchArr[1]; | ||
const y = matchArr[2]; | ||
val = `translate(${getPx(x)},${getPx(y)})`; | ||
} | ||
@@ -53,8 +55,7 @@ } | ||
return parseInt(str, 10); | ||
} else { | ||
return parseInt(str, 10) * getDefaultRem().toString() + 'px'; | ||
} | ||
return `${parseInt(str, 10) * getDefaultRem().toString()}px`; | ||
} | ||
function Trans(node, styles, options, callback) { | ||
//rem to px | ||
// rem to px | ||
for (const key in styles) { | ||
@@ -64,6 +65,4 @@ // compat with ios 8 | ||
styles[key] = parseRem(styles[key]); | ||
} else if ( | ||
arrayContains(key, ['top', 'left', 'height', 'bottom', 'right', 'width']) | ||
) { | ||
var matchArr = styles[key].match(/(\d+)(rem){0,1}/); | ||
} else if (arrayContains(key, ['top', 'left', 'height', 'bottom', 'right', 'width'])) { | ||
const matchArr = styles[key].match(/(\d+)(rem){0,1}/); | ||
styles[key] = styles[key].replace(matchArr[0], getPx(matchArr[1])); | ||
@@ -77,3 +76,3 @@ } | ||
function arrayContains(value, arr) { | ||
for (var i = 0; i < arr.length; i++) { | ||
for (let i = 0; i < arr.length; i++) { | ||
if (value === arr[i]) { | ||
@@ -80,0 +79,0 @@ return true; |
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
22601
271