Socket
Socket
Sign inDemoInstall

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 2.0.0 to 2.0.1

36

lib/Animate.js

@@ -17,4 +17,2 @@ 'use strict';

var _ChildrenUtils2 = _interopRequireDefault(_ChildrenUtils);
var _AnimateChild = require('./AnimateChild');

@@ -53,2 +51,3 @@

transitionAppear: _react2['default'].PropTypes.bool,
exclusive: _react2['default'].PropTypes.bool,
transitionLeave: _react2['default'].PropTypes.bool,

@@ -106,3 +105,2 @@ onEnd: _react2['default'].PropTypes.func,

var showProp = props.showProp;
var exclusive = props.exclusive;
var currentlyAnimatingKeys = this.currentlyAnimatingKeys;

@@ -133,13 +131,5 @@ // last props children if exclusive

} else {
newChildren = _ChildrenUtils2['default'].mergeChildren(currentChildren, nextChildren);
newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren);
}
// exclusive needs immediate response
if (exclusive) {
Object.keys(currentlyAnimatingKeys).forEach(function (key) {
_this2.stop(key);
});
currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
}
// need render to avoid update

@@ -194,8 +184,18 @@ this.setState({

componentDidUpdate: function componentDidUpdate() {
var keysToEnter = this.keysToEnter;
this.keysToEnter = [];
keysToEnter.forEach(this.performEnter);
var keysToLeave = this.keysToLeave;
this.keysToLeave = [];
keysToLeave.forEach(this.performLeave);
var _this3 = this;
// exclusive needs immediate response
if (this.props.exclusive) {
Object.keys(this.currentlyAnimatingKeys).forEach(function (key) {
_this3.stop(key);
});
}
if (this.isMounted()) {
var keysToEnter = this.keysToEnter;
this.keysToEnter = [];
keysToEnter.forEach(this.performEnter);
var keysToLeave = this.keysToLeave;
this.keysToLeave = [];
keysToLeave.forEach(this.performLeave);
}
},

@@ -202,0 +202,0 @@

@@ -85,5 +85,6 @@ 'use strict';

stop: function stop() {
if (this.stopper) {
this.stopper.stop();
var stopper = this.stopper;
if (stopper) {
this.stopper = null;
stopper.stop();
}

@@ -90,0 +91,0 @@ },

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

});
exports.toArrayChildren = toArrayChildren;
exports.findChildInChildrenByKey = findChildInChildrenByKey;
exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey;
exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey;
exports.isSameChildren = isSameChildren;
exports.mergeChildren = mergeChildren;

@@ -14,101 +20,96 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

var utils = {
toArrayChildren: function toArrayChildren(children) {
var ret = [];
_react2['default'].Children.forEach(children, function (child) {
ret.push(child);
function toArrayChildren(children) {
var ret = [];
_react2['default'].Children.forEach(children, function (child) {
ret.push(child);
});
return ret;
}
function findChildInChildrenByKey(children, key) {
var ret = null;
if (children) {
children.forEach(function (child) {
if (ret) {
return;
}
if (child.key === key) {
ret = child;
}
});
return ret;
},
}
return ret;
}
findChildInChildrenByKey: function findChildInChildrenByKey(children, key) {
var ret = null;
if (children) {
children.forEach(function (child) {
function findShownChildInChildrenByKey(children, key, showProp) {
var ret = null;
if (children) {
children.forEach(function (child) {
if (child.key === key && child.props[showProp]) {
if (ret) {
return;
throw new Error('two child with same key for <rc-animate> children');
}
if (child.key === key) {
ret = child;
}
});
}
return ret;
},
ret = child;
}
});
}
return ret;
}
findShownChildInChildrenByKey: function findShownChildInChildrenByKey(children, key, showProp) {
var ret = null;
if (children) {
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 = child;
}
});
}
return ret;
},
findHiddenChildInChildrenByKey: function findHiddenChildInChildrenByKey(children, key, showProp) {
var found = 0;
if (children) {
children.forEach(function (child) {
if (found) {
return;
}
found = child.key === key && !child.props[showProp];
});
}
return found;
},
isSameChildren: function isSameChildren(c1, c2, showProp) {
var same = c1.length === c2.length;
if (same) {
c1.forEach(function (child, index) {
var child2 = c2[index];
if (child.key !== child2.key) {
same = false;
} else if (showProp && child.props[showProp] !== child2.props[showProp]) {
same = false;
}
});
}
return same;
},
mergeChildren: function mergeChildren(prev, next) {
var ret = [];
// For each key of `next`, the list of keys to insert before that key in
// the combined list
var nextChildrenPending = {};
var pendingChildren = [];
prev.forEach(function (child) {
if (utils.findChildInChildrenByKey(next, child.key)) {
if (pendingChildren.length) {
nextChildrenPending[child.key] = pendingChildren;
pendingChildren = [];
}
} else {
pendingChildren.push(child);
function findHiddenChildInChildrenByKey(children, key, showProp) {
var found = 0;
if (children) {
children.forEach(function (child) {
if (found) {
return;
}
found = child.key === key && !child.props[showProp];
});
}
return found;
}
next.forEach(function (child) {
if (nextChildrenPending.hasOwnProperty(child.key)) {
ret = ret.concat(nextChildrenPending[child.key]);
function isSameChildren(c1, c2, showProp) {
var same = c1.length === c2.length;
if (same) {
c1.forEach(function (child, index) {
var child2 = c2[index];
if (child.key !== child2.key) {
same = false;
} else if (showProp && child.props[showProp] !== child2.props[showProp]) {
same = false;
}
ret.push(child);
});
}
return same;
}
ret = ret.concat(pendingChildren);
function mergeChildren(prev, next) {
var ret = [];
return ret;
}
};
// For each key of `next`, the list of keys to insert before that key in
// the combined list
var nextChildrenPending = {};
var pendingChildren = [];
prev.forEach(function (child) {
if (findChildInChildrenByKey(next, child.key)) {
if (pendingChildren.length) {
nextChildrenPending[child.key] = pendingChildren;
pendingChildren = [];
}
} else {
pendingChildren.push(child);
}
});
exports['default'] = utils;
module.exports = exports['default'];
next.forEach(function (child) {
if (nextChildrenPending.hasOwnProperty(child.key)) {
ret = ret.concat(nextChildrenPending[child.key]);
}
ret.push(child);
});
ret = ret.concat(pendingChildren);
return ret;
}
{
"name": "rc-animate",
"version": "2.0.0",
"version": "2.0.1",
"description": "css-transition ui component for react",

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

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

@@ -44,4 +43,4 @@ "devDependencies": {

"jquery": "~1.11.3",
"object-assign": "~3.0.0",
"precommit-hook-eslint": "~3.0.0",
"object-assign": "4.x",
"pre-commit": "1.x",
"rc-server": "3.x",

@@ -51,2 +50,3 @@ "rc-tools": "4.x",

"react-dom": "0.14.x",
"react-addons-test-utils": "~0.14.0",
"velocity-animate": "~1.2.2"

@@ -53,0 +53,0 @@ },

@@ -42,4 +42,4 @@ # rc-animate

var Animate = require('rc-animate');
var React = require('react');
React.render(<Animate animation={{}}><p key="1">1</p><p key="2">2</p></Animate>, container);
var ReactDOM = require('react-dom');
ReactDOM.render(<Animate animation={{}}><p key="1">1</p><p key="2">2</p></Animate>, container);
```

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