Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-animate

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-animate - npm Package Compare versions

Comparing version 1.3.0 to 2.0.0

88

lib/Animate.js

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

if (showProp) {
children = children.filter(function (c) {
return !!c.props[showProp];
children = children.filter(function (child) {
return !!child.props[showProp];
});
}
children.forEach(function (c) {
_this.performAppear(c.key);
children.forEach(function (child) {
_this.performAppear(child.key);
});

@@ -147,4 +147,4 @@ },

nextChildren.forEach(function (c) {
var key = c.key;
nextChildren.forEach(function (child) {
var key = child.key;
if (currentlyAnimatingKeys[key]) {

@@ -155,3 +155,3 @@ return;

if (showProp) {
var showInNext = c.props[showProp];
var showInNext = child.props[showProp];
if (hasPrev) {

@@ -170,4 +170,4 @@ var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);

currentChildren.forEach(function (c) {
var key = c.key;
currentChildren.forEach(function (child) {
var key = child.key;
if (currentlyAnimatingKeys[key]) {

@@ -178,3 +178,3 @@ return;

if (showProp) {
var showInNow = c.props[showProp];
var showInNow = child.props[showProp];
if (hasNext) {

@@ -203,36 +203,2 @@ var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp);

render: function render() {
var props = this.props;
var stateChildren = this.state.children;
var children = null;
if (stateChildren) {
children = stateChildren.map(function (child) {
if (!child.key) {
throw new Error('must set key for <rc-animate> children');
}
return _react2['default'].createElement(
_AnimateChild2['default'],
{
key: child.key,
ref: child.key,
animation: props.animation,
transitionName: props.transitionName,
transitionEnter: props.transitionEnter,
transitionAppear: props.transitionAppear,
transitionLeave: props.transitionLeave },
child
);
});
}
var Component = props.component;
if (Component) {
return _react2['default'].createElement(
Component,
this.props,
children
);
}
return children[0] || null;
},
performEnter: function performEnter(key) {

@@ -317,2 +283,36 @@ // may already remove by exclusive

}
},
render: function render() {
var props = this.props;
var stateChildren = this.state.children;
var children = null;
if (stateChildren) {
children = stateChildren.map(function (child) {
if (!child.key) {
throw new Error('must set key for <rc-animate> children');
}
return _react2['default'].createElement(
_AnimateChild2['default'],
{
key: child.key,
ref: child.key,
animation: props.animation,
transitionName: props.transitionName,
transitionEnter: props.transitionEnter,
transitionAppear: props.transitionAppear,
transitionLeave: props.transitionLeave },
child
);
});
}
var Component = props.component;
if (Component) {
return _react2['default'].createElement(
Component,
this.props,
children
);
}
return children[0] || null;
}

@@ -319,0 +319,0 @@ });

@@ -13,2 +13,6 @@ 'use strict';

var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _cssAnimation = require('css-animation');

@@ -35,27 +39,2 @@

transition: function transition(animationType, finishCallback) {
var _this = this;
var node = _react2['default'].findDOMNode(this);
var props = this.props;
var transitionName = props.transitionName;
this.stop();
var end = function end() {
_this.stopper = null;
finishCallback();
};
if ((_cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) {
this.stopper = (0, _cssAnimation2['default'])(node, transitionName + '-' + animationType, end);
} else {
this.stopper = props.animation[animationType](node, end);
}
},
stop: function stop() {
if (this.stopper) {
this.stopper.stop();
this.stopper = null;
}
},
componentWillUnmount: function componentWillUnmount() {

@@ -89,2 +68,27 @@ this.stop();

transition: function transition(animationType, finishCallback) {
var _this = this;
var node = _reactDom2['default'].findDOMNode(this);
var props = this.props;
var transitionName = props.transitionName;
this.stop();
var end = function end() {
_this.stopper = null;
finishCallback();
};
if ((_cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) {
this.stopper = (0, _cssAnimation2['default'])(node, transitionName + '-' + animationType, end);
} else {
this.stopper = props.animation[animationType](node, end);
}
},
stop: function stop() {
if (this.stopper) {
this.stopper.stop();
this.stopper = null;
}
},
render: function render() {

@@ -91,0 +95,0 @@ return this.props.children;

@@ -16,4 +16,4 @@ 'use strict';

var ret = [];
_react2['default'].Children.forEach(children, function (c) {
ret.push(c);
_react2['default'].Children.forEach(children, function (child) {
ret.push(child);
});

@@ -26,8 +26,8 @@ return ret;

if (children) {
children.forEach(function (c) {
children.forEach(function (child) {
if (ret) {
return;
}
if (c.key === key) {
ret = c;
if (child.key === key) {
ret = child;
}

@@ -42,8 +42,8 @@ });

if (children) {
children.forEach(function (c) {
if (c.key === key && c.props[showProp]) {
children.forEach(function (child) {
if (child.key === key && child.props[showProp]) {
if (ret) {
throw new Error('two child with same key for <rc-animate> children');
}
ret = c;
ret = child;
}

@@ -58,7 +58,7 @@ });

if (children) {
children.forEach(function (c) {
children.forEach(function (child) {
if (found) {
return;
}
found = c.key === key && !c.props[showProp];
found = child.key === key && !child.props[showProp];
});

@@ -72,4 +72,4 @@ }

if (same) {
c1.forEach(function (child, i) {
var child2 = c2[i];
c1.forEach(function (child, index) {
var child2 = c2[index];
if (child.key !== child2.key) {

@@ -92,18 +92,18 @@ same = false;

var pendingChildren = [];
prev.forEach(function (c) {
if (utils.findChildInChildrenByKey(next, c.key)) {
prev.forEach(function (child) {
if (utils.findChildInChildrenByKey(next, child.key)) {
if (pendingChildren.length) {
nextChildrenPending[c.key] = pendingChildren;
nextChildrenPending[child.key] = pendingChildren;
pendingChildren = [];
}
} else {
pendingChildren.push(c);
pendingChildren.push(child);
}
});
next.forEach(function (c) {
if (nextChildrenPending.hasOwnProperty(c.key)) {
ret = ret.concat(nextChildrenPending[c.key]);
next.forEach(function (child) {
if (nextChildrenPending.hasOwnProperty(child.key)) {
ret = ret.concat(nextChildrenPending[child.key]);
}
ret.push(c);
ret.push(child);
});

@@ -110,0 +110,0 @@

{
"name": "rc-animate",
"version": "1.3.0",
"version": "2.0.0",
"description": "css-transition ui component for react",

@@ -37,3 +37,4 @@ "keywords": [

"browser-test": "rc-tools run browser-test",
"browser-test-cover": "rc-tools run browser-test-cover"
"browser-test-cover": "rc-tools run browser-test-cover",
"validate": "npm ls"
},

@@ -44,9 +45,10 @@ "devDependencies": {

"object-assign": "~3.0.0",
"precommit-hook": "1.x",
"precommit-hook-eslint": "~3.0.0",
"rc-server": "3.x",
"rc-tools": "4.x",
"react": "0.13.x",
"react": "0.14.x",
"react-dom": "0.14.x",
"velocity-animate": "~1.2.2"
},
"precommit": [
"pre-commit": [
"lint"

@@ -53,0 +55,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