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

react-move

Package Overview
Dependencies
Maintainers
2
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-move - npm Package Compare versions

Comparing version 5.2.0 to 5.2.1

5

Animate/index.d.ts
import * as React from "react";
import {
HashMap
} from 'kapellmeister';
import { GetInterpolator } from '..'
import { HashMap, GetInterpolator } from '..'

@@ -7,0 +4,0 @@ export interface IAnimateProps {

2

dist/react-move.min.js

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((t=t||self).ReactMove={},t.React)}(this,function(t,e){"use strict";var n="default"in e?e.default:e;var o=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function r(){var t=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=t&&this.setState(t)}function i(t){this.setState(function(e){var n=this.constructor.getDerivedStateFromProps(t,e);return null!=n?n:null}.bind(this))}function a(t,e){try{var n=this.props,o=this.state;this.props=t,this.state=e,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,o)}finally{this.props=n,this.state=o}}r.__suppressDeprecationWarning=!0,i.__suppressDeprecationWarning=!0,a.__suppressDeprecationWarning=!0;var s,l,u=0,c=0,f=0,p=1e3,h=0,y=0,d=0,v="object"==typeof performance&&performance.now?performance:Date,m="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function g(){return y||(m(w),y=v.now()+d)}function w(){y=0}function b(){this._call=this._time=this._next=null}function S(t,e,n){var o=new b;return o.restart(t,e,n),o}function _(){y=(h=v.now())+d,u=c=0;try{!function(){g(),++u;for(var t,e=s;e;)(t=y-e._time)>=0&&e._call.call(null,t),e=e._next;--u}()}finally{u=0,function(){var t,e,n=s,o=1/0;for(;n;)n._call?(o>n._time&&(o=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:s=e);l=t,E(o)}(),y=0}}function D(){var t=v.now(),e=t-h;e>p&&(d-=e,h=t)}function E(t){u||(c&&(c=clearTimeout(c)),t-y>24?(t<1/0&&(c=setTimeout(_,t-v.now()-d)),f&&(f=clearInterval(f))):(f||(h=v.now(),f=setInterval(D,p)),u=1,m(_)))}function U(t,e,n){var o=new b;return e=null==e?0:+e,o.restart(function(n){o.stop(),t(n+e)},e,n),o}b.prototype=S.prototype={constructor:b,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?g():+n)+(null==e?0:+e),this._next||l===this||(l?l._next=this:s=this,l=this),this._call=t,this._time=n,E()},stop:function(){this._call&&(this._call=null,this._time=1/0,E())}};var A=0;function P(t,e){for(var n in e)t[n]=e[n]}var k={delay:0,duration:250,ease:function(t){return+t}};var T=function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.start=null,this.interrupt=null,this.end=null,e.events&&Object.keys(e.events).forEach(function(t){if("function"!=typeof e.events[t])throw new Error("Event handlers must be a function");var o,r;n[t]=(o=e.events[t],r=!1,function(){r||(r=!0,o.call(this))})})};function W(t){return(W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function F(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),o.forEach(function(e){j(t,e,n[e])})}return t}function j(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function x(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var O=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state=e||{}}var e,n,o;return e=t,(n=[{key:"transition",value:function(t){if(Array.isArray(t)){var e=!0,n=!1,o=void 0;try{for(var r,i=t[Symbol.iterator]();!(e=(r=i.next()).done);e=!0){var a=r.value;this.parse(a)}}catch(t){n=!0,o=t}finally{try{e||null==i.return||i.return()}finally{if(n)throw o}}}else this.parse(t)}},{key:"isTransitioning",value:function(){return!!this.transitionData}},{key:"stopTransitions",value:function(){var t=this.transitionData;t&&Object.keys(t).forEach(function(e){t[e].timer.stop()})}},{key:"setState",value:function(t){P(this.state,"function"==typeof t?t(this.state):t)}},{key:"getInterpolator",value:function(t,e,n,o){throw new Error("You must implement getInterpolator.")}},{key:"parse",value:function(t){var e=this,n=F({},t),o=new T(n);n.events&&delete n.events;var r=F({},k,{},n.timing||{},{time:g()});n.timing&&delete n.timing,Object.keys(n).forEach(function(t){var i,a=[],s=n[t];if("object"===W(s)&&!1===Array.isArray(s))Object.keys(s).forEach(function(n){var o=s[n];if(Array.isArray(o))1===o.length?a.push(e.getTween(n,o[0],t)):(e.setState(function(e){var r,i;return(i={})[t]=F({},e[t],((r={})[n]=o[0],r)),i}),a.push(e.getTween(n,o[1],t)));else if("function"==typeof o){a.push(function(){return function(r){e.setState(function(e){var i,a;return(a={})[t]=F({},e[t],((i={})[n]=o(r),i)),a})}})}else e.setState(function(e){var r,i;return(i={})[t]=F({},e[t],((r={})[n]=o,r)),i}),a.push(e.getTween(n,o,t))});else if(Array.isArray(s))1===s.length?a.push(e.getTween(t,s[0],null)):(e.setState(((i={})[t]=s[0],i)),a.push(e.getTween(t,s[1],null)));else if("function"==typeof s){a.push(function(){return function(n){var o;e.setState(((o={})[t]=s(n),o))}})}else{var l;e.setState(((l={})[t]=s,l)),a.push(e.getTween(t,s,null))}e.update({stateKey:t,timing:r,tweens:a,events:o,status:0})})}},{key:"getTween",value:function(t,e,n){var o=this;return function(){var r=n?o.state[n][t]:o.state[t];if(r===e)return null;var i=o.getInterpolator(r,e,t,n);return null===n?function(e){var n;o.setState(((n={})[t]=i(e),n))}:function(e){o.setState(function(o){var r,a;return(a={})[n]=F({},o[n],((r={})[t]=i(e),r)),a})}}}},{key:"update",value:function(t){this.transitionData||(this.transitionData={}),this.init(++A,t)}},{key:"init",value:function(t,e){var n=this,o=e.tweens.length,r=new Array(o);this.transitionData[t]=e,e.timer=S(function(t){e.status=1,e.timer.restart(i,e.timing.delay,e.timing.time),e.timing.delay<=t&&i(t-e.timing.delay)},0,e.timing.time);var i=function i(l){if(1!==e.status)return s();for(var u in n.transitionData){var c=n.transitionData[u];if(c.stateKey===e.stateKey){if(3===c.status)return U(i);4===c.status?(c.status=6,c.timer.stop(),c.events.interrupt&&c.events.interrupt.call(n),delete n.transitionData[u]):+u<t&&(c.status=6,c.timer.stop(),delete n.transitionData[u])}}if(U(function(){3===e.status&&(e.status=4,e.timer.restart(a,e.timing.delay,e.timing.time),a(l))}),e.status=2,e.events.start&&e.events.start.call(n),2===e.status){e.status=3;for(var f=-1,p=0;p<o;++p){var h=e.tweens[p]();h&&(r[++f]=h)}r.length=f+1}},a=function(t){var o=1;t<e.timing.duration?o=e.timing.ease(t/e.timing.duration):(e.timer.restart(s),e.status=5);for(var i=-1;++i<r.length;)r[i](o);5===e.status&&(e.events.end&&e.events.end.call(n),s())},s=function(){for(var o in e.status=6,e.timer.stop(),delete n.transitionData[t],n.transitionData)return;delete n.transitionData}}}])&&x(e.prototype,n),o&&x(e,o),t}();const I="ENTER",N="UPDATE",C="LEAVE";function K(t,e){const n=+t,o=+e-n;return function(t){return n+o*t}}class R extends e.Component{constructor(t){super(t),o(this,"animate",()=>{const{nodeKeys:t,nodeHash:e}=this.state;if(this.unmounting)return;let n=!1;const o=[],r=t.length;for(let i=0;i<r;i++){const r=t[i],a=e[r],s=a.isTransitioning();s&&(n=!0),a.type!==C||s?o.push(r):delete e[r]}n||this.interval.stop(),this.setState(()=>({nodeKeys:o,nodes:o.map(t=>e[t])}))}),o(this,"interval",null),o(this,"unmounting",!1);const{interpolation:e}=t;this.state={Node:class extends O{constructor(t,n){super(),o(this,"getInterpolator",e),this.key=t,this.data=n,this.type=I}},nodeKeys:[],nodeHash:{},nodes:[],data:null}}static getDerivedStateFromProps(t,e){if(t.data!==e.data){const{data:n,keyAccessor:o,start:r,enter:i,update:a,leave:s}=t,{Node:l,nodeKeys:u,nodeHash:c}=e,f={};for(let t=0;t<u.length;t++)f[u[t]]=t;const p={},h=[];for(let t=0;t<n.length;t++){const e=n[t],r=o(e,t);if(p[r]=t,h.push(r),void 0===f[r]){const t=new l;t.key=r,t.data=e,t.type=I,c[r]=t}}for(let t=0;t<u.length;t++){const e=u[t],o=c[e];void 0!==p[e]?(o.data=n[p[e]],o.type=N):o.type=C}const y=function(t,e,n,o){const r=[];for(let t=0;t<n.length;t++)r[t]=n[t];for(let e=0;e<t.length;e++)void 0===o[t[e]]&&r.push(t[e]);return r.sort((t,r)=>{const i=o[t],a=o[r],s=e[t],l=e[r];if(null!=i&&null!=a)return o[t]-o[r];if(null!=s&&null!=l)return e[t]-e[r];if(null!=i){for(let t=0;t<n.length;t++){const r=n[t];if(e[r]){if(i<o[r]&&l>e[r])return-1;if(i>o[r]&&l<e[r])return 1}}return 1}for(let t=0;t<n.length;t++){const r=n[t];if(e[r]){if(a<o[r]&&s>e[r])return 1;if(a>o[r]&&s<e[r])return-1}}return-1})}(u,f,h,p);for(let t=0;t<y.length;t++){const e=y[t],n=c[e],o=n.data;n.type===I?(n.setState(r(o,p[e])),n.transition(i(o,p[e]))):n.type===C?n.transition(s(o,f[e])):n.transition(a(o,p[e]))}return{data:n,nodes:y.map(t=>c[t]),nodeHash:c,nodeKeys:y}}return null}componentDidMount(){this.startInterval()}componentDidUpdate(t){t.data===this.props.data||this.unmounting||this.startInterval()}startInterval(){var t,e,n,o,r;this.interval?this.interval.restart(this.animate):this.interval=(t=this.animate,o=new b,r=e,null==e?(o.restart(t,e,n),o):(e=+e,n=null==n?g():+n,o.restart(function i(a){a+=r,o.restart(i,r+=e,n),t(a)},e,n),o))}componentWillUnmount(){const{nodeKeys:t,nodeHash:e}=this.state;this.unmounting=!0,this.interval&&this.interval.stop(),t.forEach(t=>{e[t].stopTransitions()})}render(){const t=this.props.children(this.state.nodes);return t&&n.Children.only(t)}}R.defaultProps={enter:()=>{},update:()=>{},leave:()=>{},interpolation:K},function(t){var e=t.prototype;if(!e||!e.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof t.getDerivedStateFromProps&&"function"!=typeof e.getSnapshotBeforeUpdate)return t;var n=null,o=null,s=null;if("function"==typeof e.componentWillMount?n="componentWillMount":"function"==typeof e.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof e.componentWillReceiveProps?o="componentWillReceiveProps":"function"==typeof e.UNSAFE_componentWillReceiveProps&&(o="UNSAFE_componentWillReceiveProps"),"function"==typeof e.componentWillUpdate?s="componentWillUpdate":"function"==typeof e.UNSAFE_componentWillUpdate&&(s="UNSAFE_componentWillUpdate"),null!==n||null!==o||null!==s){var l=t.displayName||t.name,u="function"==typeof t.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+l+" uses "+u+" but also contains the following legacy lifecycles:"+(null!==n?"\n "+n:"")+(null!==o?"\n "+o:"")+(null!==s?"\n "+s:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof t.getDerivedStateFromProps&&(e.componentWillMount=r,e.componentWillReceiveProps=i),"function"==typeof e.getSnapshotBeforeUpdate){if("function"!=typeof e.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");e.componentWillUpdate=a;var c=e.componentDidUpdate;e.componentDidUpdate=function(t,e,n){var o=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;c.call(this,t,e,o)}}}(R);const M=()=>"$$key$$";class B extends e.Component{render(){const{show:t,start:e,enter:o,update:r,leave:i,interpolation:a,children:s}=this.props,l="function"==typeof e?e():e;return n.createElement(R,{data:t?[l]:[],start:()=>l,keyAccessor:M,interpolation:a,enter:"function"==typeof o?o:()=>o,update:"function"==typeof r?r:()=>r,leave:"function"==typeof i?i:()=>i},t=>{if(!t[0])return null;const e=s(t[0].state);return e&&n.Children.only(e)})}}B.defaultProps={show:!0,interpolation:K},t.Animate=B,t.NodeGroup=R,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((t=t||self).ReactMove={},t.React)}(this,function(t,e){"use strict";var n="default"in e?e.default:e;var o=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};function r(){var t=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=t&&this.setState(t)}function i(t){this.setState(function(e){var n=this.constructor.getDerivedStateFromProps(t,e);return null!=n?n:null}.bind(this))}function a(t,e){try{var n=this.props,o=this.state;this.props=t,this.state=e,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,o)}finally{this.props=n,this.state=o}}r.__suppressDeprecationWarning=!0,i.__suppressDeprecationWarning=!0,a.__suppressDeprecationWarning=!0;var s,l,u=0,c=0,f=0,p=1e3,h=0,y=0,d=0,v="object"==typeof performance&&performance.now?performance:Date,m="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function g(){return y||(m(w),y=v.now()+d)}function w(){y=0}function b(){this._call=this._time=this._next=null}function S(t,e,n){var o=new b;return o.restart(t,e,n),o}function _(){y=(h=v.now())+d,u=c=0;try{!function(){g(),++u;for(var t,e=s;e;)(t=y-e._time)>=0&&e._call.call(null,t),e=e._next;--u}()}finally{u=0,function(){var t,e,n=s,o=1/0;for(;n;)n._call?(o>n._time&&(o=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:s=e);l=t,E(o)}(),y=0}}function D(){var t=v.now(),e=t-h;e>p&&(d-=e,h=t)}function E(t){u||(c&&(c=clearTimeout(c)),t-y>24?(t<1/0&&(c=setTimeout(_,t-v.now()-d)),f&&(f=clearInterval(f))):(f||(h=v.now(),f=setInterval(D,p)),u=1,m(_)))}function U(t,e,n){var o=new b;return e=null==e?0:+e,o.restart(function(n){o.stop(),t(n+e)},e,n),o}function A(t){return(A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}b.prototype=S.prototype={constructor:b,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?g():+n)+(null==e?0:+e),this._next||l===this||(l?l._next=this:s=this,l=this),this._call=t,this._time=n,E()},stop:function(){this._call&&(this._call=null,this._time=1/0,E())}};var P=0;function k(t,e){for(var n in e)t[n]=e[n]}var T={delay:0,duration:250,ease:function(t){return+t}};var W=function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.start=null,this.interrupt=null,this.end=null,e.events&&Object.keys(e.events).forEach(function(t){if("function"!=typeof e.events[t])throw new Error("Event handlers must be a function");var o,r;n[t]=(o=e.events[t],r=!1,function(){r||(r=!0,o.call(this))})})};function F(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),o.forEach(function(e){j(t,e,n[e])})}return t}function j(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function x(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}var O=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state=e||{}}var e,n,o;return e=t,(n=[{key:"transition",value:function(t){if(Array.isArray(t)){var e=!0,n=!1,o=void 0;try{for(var r,i=t[Symbol.iterator]();!(e=(r=i.next()).done);e=!0){var a=r.value;this.parse(a)}}catch(t){n=!0,o=t}finally{try{e||null==i.return||i.return()}finally{if(n)throw o}}}else this.parse(t)}},{key:"isTransitioning",value:function(){return!!this.transitionData}},{key:"stopTransitions",value:function(){var t=this.transitionData;t&&Object.keys(t).forEach(function(e){t[e].timer.stop()})}},{key:"setState",value:function(t){k(this.state,"function"==typeof t?t(this.state):t)}},{key:"parse",value:function(t){var e=this,n=F({},t),o=new W(n);n.events&&delete n.events;var r=F({},T,n.timing||{},{time:g()});n.timing&&delete n.timing,Object.keys(n).forEach(function(t){var i,a,s=[],l=n[t];if("object"===A(a=l)&&!1===Array.isArray(a))Object.keys(l).forEach(function(n){var o=l[n];if(Array.isArray(o))1===o.length?s.push(e.getTween(n,o[0],t)):(e.setState(function(e){var r,i;return(i={})[t]=F({},e[t],((r={})[n]=o[0],r)),i}),s.push(e.getTween(n,o[1],t)));else if("function"==typeof o){s.push(function(){return function(r){e.setState(function(e){var i,a;return(a={})[t]=F({},e[t],((i={})[n]=o(r),i)),a})}})}else e.setState(function(e){var r,i;return(i={})[t]=F({},e[t],((r={})[n]=o,r)),i}),s.push(e.getTween(n,o,t))});else if(Array.isArray(l))1===l.length?s.push(e.getTween(t,l[0],null)):(e.setState(((i={})[t]=l[0],i)),s.push(e.getTween(t,l[1],null)));else if("function"==typeof l){s.push(function(){return function(n){var o;e.setState(((o={})[t]=l(n),o))}})}else{var u;e.setState(((u={})[t]=l,u)),s.push(e.getTween(t,l,null))}e.update({stateKey:t,timing:r,tweens:s,events:o,status:0})})}},{key:"getTween",value:function(t,e,n){var o=this;return function(){var r=n?o.state[n][t]:o.state[t];if(r===e)return null;var i=o.getInterpolator(r,e,t,n);return null===n?function(e){var n;o.setState(((n={})[t]=i(e),n))}:function(e){o.setState(function(o){var r,a;return(a={})[n]=F({},o[n],((r={})[t]=i(e),r)),a})}}}},{key:"update",value:function(t){this.transitionData||(this.transitionData={}),this.init(++P,t)}},{key:"init",value:function(t,e){var n=this,o=e.tweens.length,r=new Array(o);this.transitionData[t]=e,e.timer=S(function(t){e.status=1,e.timer.restart(i,e.timing.delay,e.timing.time),e.timing.delay<=t&&i(t-e.timing.delay)},0,e.timing.time);var i=function i(l){if(1!==e.status)return s();for(var u in n.transitionData){var c=n.transitionData[u];if(c.stateKey===e.stateKey){if(3===c.status)return U(i);4===c.status?(c.status=6,c.timer.stop(),c.events.interrupt&&c.events.interrupt.call(n),delete n.transitionData[u]):+u<t&&(c.status=6,c.timer.stop(),delete n.transitionData[u])}}if(U(function(){3===e.status&&(e.status=4,e.timer.restart(a,e.timing.delay,e.timing.time),a(l))}),e.status=2,e.events.start&&e.events.start.call(n),2===e.status){e.status=3;for(var f=-1,p=0;p<o;++p){var h=e.tweens[p]();h&&(r[++f]=h)}r.length=f+1}},a=function(t){var o=1;t<e.timing.duration?o=e.timing.ease(t/e.timing.duration):(e.timer.restart(s),e.status=5);for(var i=-1;++i<r.length;)r[i](o);5===e.status&&(e.events.end&&e.events.end.call(n),s())},s=function(){for(var o in e.status=6,e.timer.stop(),delete n.transitionData[t],n.transitionData)return;delete n.transitionData}}}])&&x(e.prototype,n),o&&x(e,o),t}();const I="ENTER",N="UPDATE",C="LEAVE";function K(t,e){const n=+t,o=+e-n;return function(t){return n+o*t}}class R extends e.Component{constructor(t){super(t),o(this,"animate",()=>{const{nodeKeys:t,nodeHash:e}=this.state;if(this.unmounting)return;let n=!1;const o=[],r=t.length;for(let i=0;i<r;i++){const r=t[i],a=e[r],s=a.isTransitioning();s&&(n=!0),a.type!==C||s?o.push(r):delete e[r]}n||this.interval.stop(),this.setState(()=>({nodeKeys:o,nodes:o.map(t=>e[t])}))}),o(this,"interval",null),o(this,"unmounting",!1);const{interpolation:e}=t;this.state={Node:class extends O{constructor(t,n){super(),o(this,"getInterpolator",e),this.key=t,this.data=n,this.type=I}},nodeKeys:[],nodeHash:{},nodes:[],data:null}}static getDerivedStateFromProps(t,e){if(t.data!==e.data){const{data:n,keyAccessor:o,start:r,enter:i,update:a,leave:s}=t,{Node:l,nodeKeys:u,nodeHash:c}=e,f={};for(let t=0;t<u.length;t++)f[u[t]]=t;const p={},h=[];for(let t=0;t<n.length;t++){const e=n[t],r=o(e,t);if(p[r]=t,h.push(r),void 0===f[r]){const t=new l;t.key=r,t.data=e,t.type=I,c[r]=t}}for(let t=0;t<u.length;t++){const e=u[t],o=c[e];void 0!==p[e]?(o.data=n[p[e]],o.type=N):o.type=C}const y=function(t,e,n,o){const r=[];for(let t=0;t<n.length;t++)r[t]=n[t];for(let e=0;e<t.length;e++)void 0===o[t[e]]&&r.push(t[e]);return r.sort((t,r)=>{const i=o[t],a=o[r],s=e[t],l=e[r];if(null!=i&&null!=a)return o[t]-o[r];if(null!=s&&null!=l)return e[t]-e[r];if(null!=i){for(let t=0;t<n.length;t++){const r=n[t];if(e[r]){if(i<o[r]&&l>e[r])return-1;if(i>o[r]&&l<e[r])return 1}}return 1}for(let t=0;t<n.length;t++){const r=n[t];if(e[r]){if(a<o[r]&&s>e[r])return 1;if(a>o[r]&&s<e[r])return-1}}return-1})}(u,f,h,p);for(let t=0;t<y.length;t++){const e=y[t],n=c[e],o=n.data;n.type===I?(n.setState(r(o,p[e])),n.transition(i(o,p[e]))):n.type===C?n.transition(s(o,f[e])):n.transition(a(o,p[e]))}return{data:n,nodes:y.map(t=>c[t]),nodeHash:c,nodeKeys:y}}return null}componentDidMount(){this.startInterval()}componentDidUpdate(t){t.data===this.props.data||this.unmounting||this.startInterval()}startInterval(){var t,e,n,o,r;this.interval?this.interval.restart(this.animate):this.interval=(t=this.animate,o=new b,r=e,null==e?(o.restart(t,e,n),o):(e=+e,n=null==n?g():+n,o.restart(function i(a){a+=r,o.restart(i,r+=e,n),t(a)},e,n),o))}componentWillUnmount(){const{nodeKeys:t,nodeHash:e}=this.state;this.unmounting=!0,this.interval&&this.interval.stop(),t.forEach(t=>{e[t].stopTransitions()})}render(){const t=this.props.children(this.state.nodes);return t&&n.Children.only(t)}}R.defaultProps={enter:()=>{},update:()=>{},leave:()=>{},interpolation:K},function(t){var e=t.prototype;if(!e||!e.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof t.getDerivedStateFromProps&&"function"!=typeof e.getSnapshotBeforeUpdate)return t;var n=null,o=null,s=null;if("function"==typeof e.componentWillMount?n="componentWillMount":"function"==typeof e.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof e.componentWillReceiveProps?o="componentWillReceiveProps":"function"==typeof e.UNSAFE_componentWillReceiveProps&&(o="UNSAFE_componentWillReceiveProps"),"function"==typeof e.componentWillUpdate?s="componentWillUpdate":"function"==typeof e.UNSAFE_componentWillUpdate&&(s="UNSAFE_componentWillUpdate"),null!==n||null!==o||null!==s){var l=t.displayName||t.name,u="function"==typeof t.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+l+" uses "+u+" but also contains the following legacy lifecycles:"+(null!==n?"\n "+n:"")+(null!==o?"\n "+o:"")+(null!==s?"\n "+s:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof t.getDerivedStateFromProps&&(e.componentWillMount=r,e.componentWillReceiveProps=i),"function"==typeof e.getSnapshotBeforeUpdate){if("function"!=typeof e.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");e.componentWillUpdate=a;var c=e.componentDidUpdate;e.componentDidUpdate=function(t,e,n){var o=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;c.call(this,t,e,o)}}}(R);const M=()=>"$$key$$";class B extends e.Component{render(){const{show:t,start:e,enter:o,update:r,leave:i,interpolation:a,children:s}=this.props,l="function"==typeof e?e():e;return n.createElement(R,{data:t?[l]:[],start:()=>l,keyAccessor:M,interpolation:a,enter:"function"==typeof o?o:()=>o,update:"function"==typeof r?r:()=>r,leave:"function"==typeof i?i:()=>i},t=>{if(!t[0])return null;const e=s(t[0].state);return e&&n.Children.only(e)})}}B.defaultProps={show:!0,interpolation:K},t.Animate=B,t.NodeGroup=R,Object.defineProperty(t,"__esModule",{value:!0})});

@@ -5,4 +5,4 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";

import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

@@ -27,3 +27,3 @@ import React, { Component } from 'react';

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "animate", function () {
_defineProperty(_assertThisInitialized(_this), "animate", function () {
var _this$state = _this.state,

@@ -71,5 +71,5 @@ nodeKeys = _this$state.nodeKeys,

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "interval", null);
_defineProperty(_assertThisInitialized(_this), "interval", null);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "unmounting", false);
_defineProperty(_assertThisInitialized(_this), "unmounting", false);

@@ -88,3 +88,3 @@ var interpolation = props.interpolation;

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this2)), "getInterpolator", interpolation);
_defineProperty(_assertThisInitialized(_this2), "getInterpolator", interpolation);

@@ -91,0 +91,0 @@ _this2.key = key;

@@ -5,3 +5,7 @@ import * as React from "react";

export interface HashMap {
[key: string]: any
}
export { default as Animate } from './Animate';
export { default as NodeGroup } from './NodeGroup';
import * as React from "react";
import {
HashMap,
} from 'kapellmeister';
import { GetInterpolator } from '..'
import { HashMap, GetInterpolator } from '..'

@@ -20,2 +17,2 @@ export interface INodeGroupProps {

export default INodeGroup
export default INodeGroup

@@ -38,2 +38,4 @@ "use strict";

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

@@ -43,4 +45,2 @@

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -58,3 +58,3 @@

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "animate", function () {
_defineProperty(_assertThisInitialized(_this), "animate", function () {
var _this$state = _this.state,

@@ -102,5 +102,5 @@ nodeKeys = _this$state.nodeKeys,

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "interval", null);
_defineProperty(_assertThisInitialized(_this), "interval", null);
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "unmounting", false);
_defineProperty(_assertThisInitialized(_this), "unmounting", false);

@@ -119,3 +119,3 @@ var interpolation = props.interpolation;

_defineProperty(_assertThisInitialized(_assertThisInitialized(_this2)), "getInterpolator", interpolation);
_defineProperty(_assertThisInitialized(_this2), "getInterpolator", interpolation);

@@ -122,0 +122,0 @@ _this2.key = key;

{
"name": "react-move",
"version": "5.2.0",
"version": "5.2.1",
"contributors": [

@@ -43,4 +43,4 @@ {

"dependencies": {
"@babel/runtime": "^7.3.1",
"kapellmeister": "^2.0.0",
"@babel/runtime": "^7.3.4",
"kapellmeister": "^3.0.1",
"prop-types": "^15.7.2",

@@ -47,0 +47,0 @@ "react-lifecycles-compat": "^3.0.4"

@@ -95,2 +95,3 @@ <div style="text-align:center;">

* [CodeSandbox - Animated Bars](https://codesandbox.io/s/w0ol90x9z5) ([@animateddata](https://github.com/animateddata))
* [Blog Post by Peter Cook](https://frontendcharts.com/react-move-barchart/)
* [CodeSandbox - Collapsible Tree](https://codesandbox.io/s/ww0xkyqonk) ([@techniq](https://github.com/techniq))

@@ -97,0 +98,0 @@ * [CodeSandbox - Draggable List](https://codesandbox.io/s/j2povnz8ly)

Sorry, the diff of this file is too big to display

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