Socket
Socket
Sign inDemoInstall

react-smooth

Package Overview
Dependencies
Maintainers
3
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-smooth - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

umd/React-smooth.js

4

CHANGELOG.md

@@ -0,1 +1,5 @@

### 0.1.1 / 2016-04-05
===
- feat: add shouldReAnimate prop
### 0.1.0 / 2016-03-16

@@ -2,0 +6,0 @@ ===

36

es6/Animate.js

@@ -7,5 +7,5 @@ 'use strict';

var _isEqual2 = require('lodash/isEqual');
var _isEqual = require('lodash/isEqual');
var _isEqual3 = _interopRequireDefault(_isEqual2);
var _isEqual2 = _interopRequireDefault(_isEqual);

@@ -73,3 +73,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

if (!isActive) {
_this.state = {};
_this.state = { style: {} };

@@ -80,2 +80,3 @@ // if children is a function and animation is not active, set style to 'to'

}
return _possibleConstructorReturn(_this);

@@ -98,3 +99,3 @@ }

} else {
_this.state = {};
_this.state = { style: {} };
}

@@ -123,2 +124,4 @@ return _this;

var canBegin = nextProps.canBegin;
var attributeName = nextProps.attributeName;
var shouldReAnimate = nextProps.shouldReAnimate;

@@ -132,3 +135,3 @@

if ((0, _isEqual3.default)(this.props.to, nextProps.to) && this.props.canBegin && this.props.isActive) {
if ((0, _isEqual2.default)(this.props.to, nextProps.to) && this.props.canBegin && this.props.isActive) {
return;

@@ -147,4 +150,9 @@ }

var from = isTriggered || shouldReAnimate ? nextProps.from : this.props.to;
this.setState({
style: attributeName ? _defineProperty({}, attributeName, from) : from
});
this.runAnimation(_extends({}, nextProps, {
from: isTriggered ? nextProps.from : this.props.to
from: from
}));

@@ -268,6 +276,5 @@ }

var to = attributeName ? _defineProperty({}, attributeName, propsTo) : propsTo;
var from = attributeName ? _defineProperty({}, attributeName, propsFrom) : propsFrom;
var transition = (0, _util.getTransitionVal)(Object.keys(to), duration, easing);
manager.start([from, begin, _extends({}, to, { transition: transition }), duration, onAnimationEnd]);
manager.start([begin, _extends({}, to, { transition: transition }), duration, onAnimationEnd]);
}

@@ -284,3 +291,3 @@ }, {

this.setState({
style: (0, _util.translateStyle)(style)
style: style
});

@@ -291,4 +298,2 @@ }

value: function render() {
var _this4 = this;
var _props2 = this.props;

@@ -308,5 +313,6 @@ var children = _props2.children;

var count = _react.Children.count(children);
var stateStyle = (0, _util.translateStyle)(this.state.style);
if (typeof children === 'function') {
return children(this.state.style);
return children(stateStyle);
}

@@ -326,3 +332,3 @@

var res = (0, _react.cloneElement)(container, _extends({}, others, {
style: _extends({}, style, _this4.state.style),
style: _extends({}, style, stateStyle),
className: className

@@ -369,3 +375,5 @@ }));

canBegin: _react.PropTypes.bool,
onAnimationEnd: _react.PropTypes.func
onAnimationEnd: _react.PropTypes.func,
// decide if it should reanimate with initial from style when props change
shouldReAnimate: _react.PropTypes.bool
}, _class2.defaultProps = {

@@ -372,0 +380,0 @@ begin: 0,

@@ -7,5 +7,5 @@ 'use strict';

var _filter2 = require('lodash/filter');
var _filter = require('lodash/filter');
var _filter3 = _interopRequireDefault(_filter2);
var _filter2 = _interopRequireDefault(_filter);

@@ -103,3 +103,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var shouldStopAnimation = function shouldStopAnimation() {
return !(0, _filter3.default)(stepperStyle, needContinue).length;
return !(0, _filter2.default)(stepperStyle, needContinue).length;
};

@@ -106,0 +106,0 @@

@@ -8,5 +8,5 @@ 'use strict';

var _intersection2 = require('lodash/intersection');
var _intersection = require('lodash/intersection');
var _intersection3 = _interopRequireDefault(_intersection2);
var _intersection2 = _interopRequireDefault(_intersection);

@@ -24,3 +24,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var getIntersectionKeys = exports.getIntersectionKeys = function getIntersectionKeys(preObj, nextObj) {
return (0, _intersection3.default)(Object.keys(preObj), Object.keys(nextObj));
return (0, _intersection2.default)(Object.keys(preObj), Object.keys(nextObj));
};

@@ -27,0 +27,0 @@

@@ -7,5 +7,5 @@ 'use strict';

var _isEqual2 = require('lodash/isEqual');
var _isEqual = require('lodash/isEqual');
var _isEqual3 = _interopRequireDefault(_isEqual2);
var _isEqual2 = _interopRequireDefault(_isEqual);

@@ -73,3 +73,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

if (!isActive) {
_this.state = {};
_this.state = { style: {} };

@@ -80,2 +80,3 @@ // if children is a function and animation is not active, set style to 'to'

}
return _possibleConstructorReturn(_this);

@@ -98,3 +99,3 @@ }

} else {
_this.state = {};
_this.state = { style: {} };
}

@@ -123,2 +124,4 @@ return _this;

var canBegin = nextProps.canBegin;
var attributeName = nextProps.attributeName;
var shouldReAnimate = nextProps.shouldReAnimate;

@@ -132,3 +135,3 @@

if ((0, _isEqual3.default)(this.props.to, nextProps.to) && this.props.canBegin && this.props.isActive) {
if ((0, _isEqual2.default)(this.props.to, nextProps.to) && this.props.canBegin && this.props.isActive) {
return;

@@ -147,4 +150,9 @@ }

var from = isTriggered || shouldReAnimate ? nextProps.from : this.props.to;
this.setState({
style: attributeName ? _defineProperty({}, attributeName, from) : from
});
this.runAnimation(_extends({}, nextProps, {
from: isTriggered ? nextProps.from : this.props.to
from: from
}));

@@ -268,6 +276,5 @@ }

var to = attributeName ? _defineProperty({}, attributeName, propsTo) : propsTo;
var from = attributeName ? _defineProperty({}, attributeName, propsFrom) : propsFrom;
var transition = (0, _util.getTransitionVal)(Object.keys(to), duration, easing);
manager.start([from, begin, _extends({}, to, { transition: transition }), duration, onAnimationEnd]);
manager.start([begin, _extends({}, to, { transition: transition }), duration, onAnimationEnd]);
}

@@ -284,3 +291,3 @@ }, {

this.setState({
style: (0, _util.translateStyle)(style)
style: style
});

@@ -291,4 +298,2 @@ }

value: function render() {
var _this4 = this;
var _props2 = this.props;

@@ -308,5 +313,6 @@ var children = _props2.children;

var count = _react.Children.count(children);
var stateStyle = (0, _util.translateStyle)(this.state.style);
if (typeof children === 'function') {
return children(this.state.style);
return children(stateStyle);
}

@@ -326,3 +332,3 @@

var res = (0, _react.cloneElement)(container, _extends({}, others, {
style: _extends({}, style, _this4.state.style),
style: _extends({}, style, stateStyle),
className: className

@@ -369,3 +375,5 @@ }));

canBegin: _react.PropTypes.bool,
onAnimationEnd: _react.PropTypes.func
onAnimationEnd: _react.PropTypes.func,
// decide if it should reanimate with initial from style when props change
shouldReAnimate: _react.PropTypes.bool
}, _class2.defaultProps = {

@@ -372,0 +380,0 @@ begin: 0,

@@ -7,5 +7,5 @@ 'use strict';

var _filter2 = require('lodash/filter');
var _filter = require('lodash/filter');
var _filter3 = _interopRequireDefault(_filter2);
var _filter2 = _interopRequireDefault(_filter);

@@ -103,3 +103,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var shouldStopAnimation = function shouldStopAnimation() {
return !(0, _filter3.default)(stepperStyle, needContinue).length;
return !(0, _filter2.default)(stepperStyle, needContinue).length;
};

@@ -106,0 +106,0 @@

@@ -8,5 +8,5 @@ 'use strict';

var _intersection2 = require('lodash/intersection');
var _intersection = require('lodash/intersection');
var _intersection3 = _interopRequireDefault(_intersection2);
var _intersection2 = _interopRequireDefault(_intersection);

@@ -24,3 +24,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var getIntersectionKeys = exports.getIntersectionKeys = function getIntersectionKeys(preObj, nextObj) {
return (0, _intersection3.default)(Object.keys(preObj), Object.keys(nextObj));
return (0, _intersection2.default)(Object.keys(preObj), Object.keys(nextObj));
};

@@ -27,0 +27,0 @@

{
"name": "react-smooth",
"version": "0.1.0",
"version": "0.1.1",
"description": "react animation library",

@@ -58,2 +58,3 @@ "main": "lib/index",

"babel-plugin-transform-export-extensions": "^6.5.0",
"babel-plugin-lodash": "2.1.0",
"babel-polyfill": "^6.7.2",

@@ -70,5 +71,5 @@ "babel-preset-es2015": "^6.6.0",

"karma": "^0.13.22",
"karma-mocha": "^0.2.2",
"karma-chrome-launcher": "^0.2.2",
"karma-firefox-launcher": "^0.1.7",
"karma-mocha": "^0.2.2",
"karma-sourcemap-loader": "^0.3.7",

@@ -80,3 +81,3 @@ "karma-webpack": "^1.7.0",

"react-dom": "^0.14.0",
"webpack": "^2.1.0-beta.4",
"webpack": "^1.12.14",
"webpack-dev-server": "^1.14.1"

@@ -83,0 +84,0 @@ },

@@ -36,2 +36,4 @@ import React, { Component, PropTypes, cloneElement, Children } from 'react';

onAnimationEnd: PropTypes.func,
// decide if it should reanimate with initial from style when props change
shouldReAnimate: PropTypes.bool,
};

@@ -61,3 +63,3 @@

if (!isActive) {
this.state = {};
this.state = { style: {} };

@@ -68,2 +70,3 @@ // if children is a function and animation is not active, set style to 'to'

}
return;

@@ -86,3 +89,3 @@ }

} else {
this.state = {};
this.state = { style: {} };
}

@@ -102,3 +105,3 @@ }

componentWillReceiveProps(nextProps) {
const { isActive, canBegin } = nextProps;
const { isActive, canBegin, attributeName, shouldReAnimate } = nextProps;

@@ -125,5 +128,10 @@ if (!isActive || !canBegin) {

const from = isTriggered || shouldReAnimate ? nextProps.from : this.props.to;
this.setState({
style: attributeName ? { [attributeName]: from } : from,
});
this.runAnimation({
...nextProps,
from: isTriggered ? nextProps.from : this.props.to,
from,
});

@@ -241,6 +249,5 @@ }

const to = attributeName ? { [attributeName]: propsTo } : propsTo;
const from = attributeName ? { [attributeName]: propsFrom } : propsFrom;
const transition = getTransitionVal(Object.keys(to), duration, easing);
manager.start([from, begin, { ...to, transition }, duration, onAnimationEnd]);
manager.start([begin, { ...to, transition }, duration, onAnimationEnd]);
}

@@ -255,3 +262,3 @@

this.setState({
style: translateStyle(style),
style,
});

@@ -274,5 +281,6 @@ }

const count = Children.count(children);
const stateStyle = translateStyle(this.state.style);
if (typeof children === 'function') {
return children(this.state.style);
return children(stateStyle);
}

@@ -291,3 +299,3 @@

...style,
...this.state.style,
...stateStyle,
},

@@ -294,0 +302,0 @@ className,

@@ -63,3 +63,3 @@ import { warn } from './util';

'[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s',
args,
args
);

@@ -66,0 +66,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc