react-move
Advanced tools
Comparing version 2.9.0 to 2.9.1
@@ -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 r,i,a=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},s=0,o=0,u=0,l=1e3,c=0,h=0,f=0,p="object"==typeof performance&&performance.now?performance:Date,d="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function y(){return h||(d(g),h=p.now()+f)}function g(){h=0}function w(){this._call=this._time=this._next=null}function m(t,e,n){var r=new w;return r.restart(t,e,n),r}function b(){h=(c=p.now())+f,s=o=0;try{!function(){y(),++s;for(var t,e=r;e;)(t=h-e._time)>=0&&e._call.call(null,t),e=e._next;--s}()}finally{s=0,function(){var t,e,n=r,a=1/0;for(;n;)n._call?(a>n._time&&(a=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:r=e);i=t,N(a)}(),h=0}}function v(){var t=p.now(),e=t-c;e>l&&(f-=e,c=t)}function N(t){s||(o&&(o=clearTimeout(o)),t-h>24?(t<1/0&&(o=setTimeout(b,t-p.now()-f)),u&&(u=clearInterval(u))):(u||(c=p.now(),u=setInterval(v,l)),s=1,d(b)))}function k(t,e,n){var r=new w;return e=null==e?0:+e,r.restart(function(n){r.stop(),t(n+e)},e,n),r}function x(t,e){for(const n in e)t[n]=e[n];return t}function M(t,e,n){this.key=t,this.data=e,this.type=n,this.state={}}w.prototype=m.prototype={constructor:w,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?y():+n)+(null==e?0:+e),this._next||i===this||(i?i._next=this:r=this,i=this),this._call=t,this._time=n,N()},stop:function(){this._call&&(this._call=null,this._time=1/0,N())}},x(M.prototype,{setState(t){const e=this.state;x(e,"function"==typeof t?t(e):t)},updateData(t){return this.data=t,this},updateType(t){return this.type=t,this}});const E="ENTER",S="UPDATE",_="LEAVE";function A(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function I(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function T(){}var R="\\s*([+-]?\\d+)\\s*",j="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",q="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",D=/^#([0-9a-f]{3})$/,O=/^#([0-9a-f]{6})$/,X=new RegExp("^rgb\\("+[R,R,R]+"\\)$"),H=new RegExp("^rgb\\("+[q,q,q]+"\\)$"),$=new RegExp("^rgba\\("+[R,R,R,j]+"\\)$"),C=new RegExp("^rgba\\("+[q,q,q,j]+"\\)$"),P=new RegExp("^hsl\\("+[j,q,q]+"\\)$"),U=new RegExp("^hsla\\("+[j,q,q,j]+"\\)$"),K={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function L(t){var e;return t=(t+"").trim().toLowerCase(),(e=D.exec(t))?new G((e=parseInt(e[1],16))>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):(e=O.exec(t))?Y(parseInt(e[1],16)):(e=X.exec(t))?new G(e[1],e[2],e[3],1):(e=H.exec(t))?new G(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=$.exec(t))?F(e[1],e[2],e[3],e[4]):(e=C.exec(t))?F(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=P.exec(t))?W(e[1],e[2]/100,e[3]/100,1):(e=U.exec(t))?W(e[1],e[2]/100,e[3]/100,e[4]):K.hasOwnProperty(t)?Y(K[t]):"transparent"===t?new G(NaN,NaN,NaN,0):null}function Y(t){return new G(t>>16&255,t>>8&255,255&t,1)}function F(t,e,n,r){return r<=0&&(t=e=n=NaN),new G(t,e,n,r)}function V(t){return t instanceof T||(t=L(t)),t?new G((t=t.rgb()).r,t.g,t.b,t.opacity):new G}function z(t,e,n,r){return 1===arguments.length?V(t):new G(t,e,n,null==r?1:r)}function G(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Q(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function W(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new B(t,e,n,r)}function B(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function J(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}A(T,L,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),A(G,z,I(T,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new G(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new G(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+Q(this.r)+Q(this.g)+Q(this.b)},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),A(B,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof B)return new B(t.h,t.s,t.l,t.opacity);if(t instanceof T||(t=L(t)),!t)return new B;if(t instanceof B)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),s=NaN,o=a-i,u=(a+i)/2;return o?(s=e===a?(n-r)/o+6*(n<r):n===a?(r-e)/o+2:(e-n)/o+4,o/=u<.5?a+i:2-a-i,s*=60):o=u>0&&u<1?0:s,new B(s,o,u,t.opacity)}(t):new B(t,e,n,null==r?1:r)},I(T,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new B(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new B(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new G(J(t>=240?t-240:t+120,i,r),J(t,i,r),J(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var Z=Math.PI/180,tt=180/Math.PI,et=.96422,nt=1,rt=.82521,it=4/29,at=6/29,st=3*at*at,ot=at*at*at;function ut(t){if(t instanceof lt)return new lt(t.l,t.a,t.b,t.opacity);if(t instanceof dt){if(isNaN(t.h))return new lt(t.l,0,0,t.opacity);var e=t.h*Z;return new lt(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof G||(t=V(t));var n,r,i=pt(t.r),a=pt(t.g),s=pt(t.b),o=ct((.2225045*i+.7168786*a+.0606169*s)/nt);return i===a&&a===s?n=r=o:(n=ct((.4360747*i+.3850649*a+.1430804*s)/et),r=ct((.0139322*i+.0971045*a+.7141733*s)/rt)),new lt(116*o-16,500*(n-o),200*(o-r),t.opacity)}function lt(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function ct(t){return t>ot?Math.pow(t,1/3):t/st+it}function ht(t){return t>at?t*t*t:st*(t-it)}function ft(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function pt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function dt(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}A(lt,function(t,e,n,r){return 1===arguments.length?ut(t):new lt(t,e,n,null==r?1:r)},I(T,{brighter:function(t){return new lt(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new lt(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new G(ft(3.1338561*(e=et*ht(e))-1.6168667*(t=nt*ht(t))-.4906146*(n=rt*ht(n))),ft(-.9787684*e+1.9161415*t+.033454*n),ft(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),A(dt,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof dt)return new dt(t.h,t.c,t.l,t.opacity);if(t instanceof lt||(t=ut(t)),0===t.a&&0===t.b)return new dt(NaN,0,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*tt;return new dt(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new dt(t,e,n,null==r?1:r)},I(T,{brighter:function(t){return new dt(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new dt(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return ut(this).rgb()}}));var yt=-.14861,gt=1.78277,wt=-.29227,mt=-.90649,bt=1.97294,vt=bt*mt,Nt=bt*gt,kt=gt*wt-mt*yt;function xt(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Mt(t){return function(){return t}}function Et(t){return 1==(t=+t)?St:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Mt(isNaN(e)?n:e)}}function St(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Mt(isNaN(t)?e:t)}A(xt,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof xt)return new xt(t.h,t.s,t.l,t.opacity);t instanceof G||(t=V(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(kt*r+vt*e-Nt*n)/(kt+vt-Nt),a=r-i,s=(bt*(n-i)-wt*a)/mt,o=Math.sqrt(s*s+a*a)/(bt*i*(1-i)),u=o?Math.atan2(s,a)*tt-120:NaN;return new xt(u<0?u+360:u,o,i,t.opacity)}(t):new xt(t,e,n,null==r?1:r)},I(T,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new xt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new xt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Z,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new G(255*(e+n*(yt*r+gt*i)),255*(e+n*(wt*r+mt*i)),255*(e+n*(bt*r)),this.opacity)}}));var _t=function t(e){var n=Et(e);function r(t,e){var r=n((t=z(t)).r,(e=z(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),s=St(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=a(e),t.opacity=s(e),t+""}}return r.gamma=t,r}(1);function At(t,e){return e-=t=+t,function(n){return t+e*n}}var It=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Tt=new RegExp(It.source,"g");function Rt(t,e){var n,r=typeof e;return null==e||"boolean"===r?Mt(e):("number"===r?At:"string"===r?(n=L(e))?(e=n,_t):function(t,e){var n,r,i,a=It.lastIndex=Tt.lastIndex=0,s=-1,o=[],u=[];for(t+="",e+="";(n=It.exec(t))&&(r=Tt.exec(e));)(i=r.index)>a&&(i=e.slice(a,i),o[s]?o[s]+=i:o[++s]=i),(n=n[0])===(r=r[0])?o[s]?o[s]+=r:o[++s]=r:(o[++s]=null,u.push({i:s,x:At(n,r)})),a=Tt.lastIndex;return a<e.length&&(i=e.slice(a),o[s]?o[s]+=i:o[++s]=i),o.length<2?u[0]?function(t){return function(e){return t(e)+""}}(u[0].x):function(t){return function(){return t}}(e):(e=u.length,function(t){for(var n,r=0;r<e;++r)o[(n=u[r]).i]=n.x(t);return o.join("")})}:e instanceof L?_t:e instanceof Date?function(t,e){var n=new Date;return e-=t=+t,function(r){return n.setTime(t+e*r),n}}:Array.isArray(e)?function(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,a=new Array(i),s=new Array(r);for(n=0;n<i;++n)a[n]=Rt(t[n],e[n]);for(;n<r;++n)s[n]=e[n];return function(t){for(n=0;n<i;++n)s[n]=a[n](t);return s}}:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?function(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Rt(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}:At)(t,e)}var jt,qt=180/Math.PI,Dt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};var Ot=function(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(a,s){var o=[],u=[];return a=t(a),s=t(s),function(t,r,i,a,s,o){if(t!==i||r!==a){var u=s.push("translate(",null,e,null,n);o.push({i:u-4,x:At(t,i)},{i:u-2,x:At(r,a)})}else(i||a)&&s.push("translate("+i+e+a+n)}(a.translateX,a.translateY,s.translateX,s.translateY,o,u),function(t,e,n,a){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),a.push({i:n.push(i(n)+"rotate(",null,r)-2,x:At(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(a.rotate,s.rotate,o,u),function(t,e,n,a){t!==e?a.push({i:n.push(i(n)+"skewX(",null,r)-2,x:At(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(a.skewX,s.skewX,o,u),function(t,e,n,r,a,s){if(t!==n||e!==r){var o=a.push(i(a)+"scale(",null,",",null,")");s.push({i:o-4,x:At(t,n)},{i:o-2,x:At(e,r)})}else 1===n&&1===r||a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,s.scaleX,s.scaleY,o,u),a=s=null,function(t){for(var e,n=-1,r=u.length;++n<r;)o[(e=u[n]).i]=e.x(t);return o.join("")}}}(function(t){return null==t?Dt:(jt||(jt=document.createElementNS("http://www.w3.org/2000/svg","g")),jt.setAttribute("transform",t),(t=jt.transform.baseVal.consolidate())?(t=t.matrix,e=t.a,n=t.b,r=t.c,i=t.d,a=t.e,s=t.f,(o=Math.sqrt(e*e+n*n))&&(e/=o,n/=o),(l=e*r+n*i)&&(r-=e*l,i-=n*l),(u=Math.sqrt(r*r+i*i))&&(r/=u,i/=u,l/=u),e*i<n*r&&(e=-e,n=-n,l=-l,o=-o),{translateX:a,translateY:s,rotate:Math.atan2(n,e)*qt,skewX:Math.atan(l)*qt,scaleX:o,scaleY:u}):Dt);var e,n,r,i,a,s,o,u,l},", ",")",")");Math.SQRT2;function Xt(t,e,n){return function(){const r=t?this.state[t][e]:this.state[e];if(r===n)return null;const i=function(t){return"transform"===t?Ot:Rt}(e)(r,n);let a;return a=null===t?t=>{this.setState(()=>({[e]:i(t)}))}:n=>{this.setState(r=>({[t]:{...r[t],[e]:i(n)}}))}}}function Ht(t,e,n){return Xt.call(this,t,e,n)}const $t=0,Ct=1,Pt=2,Ut=3,Kt=4,Lt=5,Yt=6;function Ft(t,e,n,r,i,a={}){const s=t.TRANSITION_SCHEDULES;if(s){if(n in s)return}else t.TRANSITION_SCHEDULES={};!function(t,e,n){const r=t.TRANSITION_SCHEDULES,i={...n},a=i.tweens.length,s=new Array(a);function o(n){if(i.state!==Ct)return l();for(const t in r){const n=r[t];if(n.stateKey===i.stateKey){if(n.state===Ut)return k(o);n.state===Kt?(n.state=Yt,n.timer.stop(),n.events.interrupt&&"function"==typeof n.events.interrupt&&n.events.interrupt.call(this),delete r[t]):+t<e&&(n.state=Yt,n.timer.stop(),delete r[t])}}if(k(()=>{i.state===Ut&&(i.state=Kt,i.timer.restart(u,i.delay,i.time),u(n))}),i.state=Pt,i.events.start&&"function"==typeof i.events.start&&i.events.start.call(t),i.state!==Pt)return;i.state=Ut;let c=-1;for(let e=0;e<a;++e){const n=i.tweens[e].call(t);n&&(s[++c]=n)}s.length=c+1}function u(e){let n=1;e<i.duration?n=i.ease.call(null,e/i.duration):(i.timer.restart(l),i.state=Lt);let r=-1;for(;++r<s.length;)s[r].call(null,n);i.state===Lt&&(i.events.end&&"function"==typeof i.events.end&&i.events.end.call(t),l())}function l(){i.state=Yt,i.timer.stop(),delete r[e];for(const t in r)return;delete t.TRANSITION_SCHEDULES}r[e]=i,i.timer=m(function(t){i.state=Ct,i.timer.restart(o,i.delay,i.time),i.delay<=t&&o(t-i.delay)},0,i.time)}(t,n,{stateKey:e,events:a,tweens:i,...r,timer:null,state:$t})}let Vt=0;const zt={time:null,delay:0,duration:250,ease:function(t){return+t}};function Gt(t={}){const e={...t},n=e.events||{};delete e.events,Object.keys(n).forEach(t=>{if("function"!=typeof n[t])throw new Error("Event handlers must be a function");n[t]=function(t){let e=!1;return function(){e||(e=!0,t.call(this))}}(n[t])});const r=e.timing||{};delete e.timing,Object.keys(e).forEach(t=>{const i=[];if("object"==typeof e[t]&&!1===Array.isArray(e[t]))Object.keys(e[t]).forEach(n=>{const r=e[t][n];if(Array.isArray(r))1===r.length?i.push(Ht.call(this,t,n,r[0])):(this.setState(e=>({[t]:{...e[t],[n]:r[0]}})),i.push(Ht.call(this,t,n,r[1])));else if("function"==typeof r){const e=()=>{return e=>{this.setState(i=>({[t]:{...i[t],[n]:r(e)}}))}};i.push(e)}else this.setState(e=>({[t]:{...e[t],[n]:r}})),i.push(Ht.call(this,t,n,r))});else{const n=e[t];if(Array.isArray(n))1===n.length?i.push(Ht.call(this,null,t,n[0])):(this.setState(()=>({[t]:n[0]})),i.push(Ht.call(this,null,t,n[1])));else if("function"==typeof n){const e=()=>{return e=>{this.setState(()=>({[t]:n(e)}))}};i.push(e)}else this.setState(()=>({[t]:n})),i.push(Ht.call(this,null,t,n))}const a={...zt,...r,time:y()};Ft(this,t,++Vt,a,i,n)})}function Qt(t){Array.isArray(t)?t.forEach(t=>{Gt.call(this,t)}):Gt.call(this,t)}class Wt extends e.Component{constructor(...t){super(...t),a(this,"state",{nodeKeys:[],nodeHash:{},nodes:[],data:null}),a(this,"animate",()=>{const{nodeKeys:t,nodeHash:e}=this.state;if(this.unmounting)return;let n=!1;const r=[],i=t.length;for(let a=0;a<i;a++){const i=t[a],s=e[i];s.TRANSITION_SCHEDULES&&(n=!0),s.type!==_||s.TRANSITION_SCHEDULES?r.push(i):delete e[i]}n||this.interval.stop(),this.setState(()=>({nodeKeys:r,nodes:r.map(t=>e[t])}))}),a(this,"interval",null),a(this,"unmounting",!1)}static getDerivedStateFromProps(t,e){if(t.data!==e.data){const{data:n,keyAccessor:r,start:i,enter:a,update:s,leave:o}=t,{nodeKeys:u,nodeHash:l}=e,c={};for(let t=0;t<u.length;t++)c[u[t]]=t;const h={},f=[];for(let t=0;t<n.length;t++){const e=n[t],i=r(e,t);h[i]=t,f.push(i),void 0===c[i]&&(l[i]=new M(i,e,E))}for(let t=0;t<u.length;t++){const e=u[t],r=l[e];void 0!==h[e]?(r.updateData(n[h[e]]),r.updateType(S)):r.updateType(_)}const p=function(t,e,n,r){const i=[];for(let t=0;t<n.length;t++)i[t]=n[t];for(let e=0;e<t.length;e++)void 0===r[t[e]]&&i.push(t[e]);return i.sort((t,i)=>{const a=r[t],s=r[i],o=e[t],u=e[i];if(null!=a&&null!=s)return r[t]-r[i];if(null!=o&&null!=u)return e[t]-e[i];if(null!=a){for(let t=0;t<n.length;t++){const i=n[t];if(e[i]){if(a<r[i]&&u>e[i])return-1;if(a>r[i]&&u<e[i])return 1}}return 1}for(let t=0;t<n.length;t++){const i=n[t];if(e[i]){if(s<r[i]&&o>e[i])return 1;if(s>r[i]&&o<e[i])return-1}}return-1})}(u,c,f,h);for(let t=0;t<p.length;t++){const e=p[t],n=l[e],r=n.data;n.type===E?(n.setState(i(r,h[e])),Qt.call(n,a(r,h[e]))):n.type===_?Qt.call(n,o(r,c[e])):Qt.call(n,s(r,h[e]))}return{data:n,nodes:p.map(t=>l[t]),nodeHash:l,nodeKeys:p}}return null}componentDidMount(){this.startInterval()}componentDidUpdate(t){t.data===this.props.data||this.unmounting||this.startInterval()}startInterval(){var t,e,n,r,i;this.interval?this.interval.restart(this.animate):this.interval=(t=this.animate,r=new w,i=e,null==e?(r.restart(t,e,n),r):(e=+e,n=null==n?y():+n,r.restart(function a(s){s+=i,r.restart(a,i+=e,n),t(s)},e,n),r))}componentWillUnmount(){const{nodeKeys:t,nodeHash:e}=this.state;this.unmounting=!0,this.interval&&this.interval.stop(),t.forEach(t=>{(function(){const t=this.TRANSITION_SCHEDULES;t&&Object.keys(t).forEach(e=>{t[e].timer.stop()})}).call(e[t])})}render(){const t=this.props.children(this.state.nodes);return t&&n.Children.only(t)}}Wt.defaultProps={enter:()=>{},update:()=>{},leave:()=>{}};const Bt=()=>"$$key$$";function Jt(t){const{show:e,start:r,enter:i,update:a,leave:s,children:o}=t,u="function"==typeof r?r():r;return n.createElement(Wt,{data:e?[u]:[],start:()=>u,keyAccessor:Bt,enter:"function"==typeof i?i:()=>i,update:"function"==typeof a?a:()=>a,leave:"function"==typeof s?s:()=>s},t=>{if(!t[0])return null;const e=o(t[0].state);return e&&n.Children.only(e)})}Jt.defaultProps={show:!0},t.Animate=Jt,t.NodeGroup=Wt,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 r=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 i(){var t=this.constructor.getDerivedStateFromProps(this.props,this.state);null!=t&&this.setState(t)}function o(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,r=this.state;this.props=t,this.state=e,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}i.__suppressDeprecationWarning=!0,o.__suppressDeprecationWarning=!0,a.__suppressDeprecationWarning=!0;var s,l,u=0,c=0,h=0,f=1e3,p=0,d=0,y=0,g="object"==typeof performance&&performance.now?performance:Date,m="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function w(){return d||(m(b),d=g.now()+y)}function b(){d=0}function v(){this._call=this._time=this._next=null}function N(t,e,n){var r=new v;return r.restart(t,e,n),r}function S(){d=(p=g.now())+y,u=c=0;try{!function(){w(),++u;for(var t,e=s;e;)(t=d-e._time)>=0&&e._call.call(null,t),e=e._next;--u}()}finally{u=0,function(){var t,e,n=s,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:s=e);l=t,x(r)}(),d=0}}function k(){var t=g.now(),e=t-p;e>f&&(y-=e,p=t)}function x(t){u||(c&&(c=clearTimeout(c)),t-d>24?(t<1/0&&(c=setTimeout(S,t-g.now()-y)),h&&(h=clearInterval(h))):(h||(p=g.now(),h=setInterval(k,f)),u=1,m(S)))}function M(t,e,n){var r=new v;return e=null==e?0:+e,r.restart(function(n){r.stop(),t(n+e)},e,n),r}function E(t,e){for(const n in e)t[n]=e[n];return t}function _(t,e,n){this.key=t,this.data=e,this.type=n,this.state={}}v.prototype=N.prototype={constructor:v,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?w():+n)+(null==e?0:+e),this._next||l===this||(l?l._next=this:s=this,l=this),this._call=t,this._time=n,x()},stop:function(){this._call&&(this._call=null,this._time=1/0,x())}},E(_.prototype,{setState(t){const e=this.state;E(e,"function"==typeof t?t(e):t)},updateData(t){return this.data=t,this},updateType(t){return this.type=t,this}});const A="ENTER",I="UPDATE",U="LEAVE";function D(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function T(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function R(){}var P="\\s*([+-]?\\d+)\\s*",W="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",F="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",j=/^#([0-9a-f]{3})$/,q=/^#([0-9a-f]{6})$/,O=new RegExp("^rgb\\("+[P,P,P]+"\\)$"),C=new RegExp("^rgb\\("+[F,F,F]+"\\)$"),X=new RegExp("^rgba\\("+[P,P,P,W]+"\\)$"),H=new RegExp("^rgba\\("+[F,F,F,W]+"\\)$"),$=new RegExp("^hsl\\("+[W,F,F]+"\\)$"),L=new RegExp("^hsla\\("+[W,F,F,W]+"\\)$"),K={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Y(t){var e;return t=(t+"").trim().toLowerCase(),(e=j.exec(t))?new Q((e=parseInt(e[1],16))>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):(e=q.exec(t))?B(parseInt(e[1],16)):(e=O.exec(t))?new Q(e[1],e[2],e[3],1):(e=C.exec(t))?new Q(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=X.exec(t))?V(e[1],e[2],e[3],e[4]):(e=H.exec(t))?V(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=$.exec(t))?Z(e[1],e[2]/100,e[3]/100,1):(e=L.exec(t))?Z(e[1],e[2]/100,e[3]/100,e[4]):K.hasOwnProperty(t)?B(K[t]):"transparent"===t?new Q(NaN,NaN,NaN,0):null}function B(t){return new Q(t>>16&255,t>>8&255,255&t,1)}function V(t,e,n,r){return r<=0&&(t=e=n=NaN),new Q(t,e,n,r)}function z(t){return t instanceof R||(t=Y(t)),t?new Q((t=t.rgb()).r,t.g,t.b,t.opacity):new Q}function G(t,e,n,r){return 1===arguments.length?z(t):new Q(t,e,n,null==r?1:r)}function Q(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function J(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Z(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new tt(t,e,n,r)}function tt(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function et(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}D(R,Y,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),D(Q,G,T(R,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Q(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Q(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+J(this.r)+J(this.g)+J(this.b)},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),D(tt,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof tt)return new tt(t.h,t.s,t.l,t.opacity);if(t instanceof R||(t=Y(t)),!t)return new tt;if(t instanceof tt)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=l>0&&l<1?0:a,new tt(a,s,l,t.opacity)}(t):new tt(t,e,n,null==r?1:r)},T(R,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new tt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new tt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Q(et(t>=240?t-240:t+120,i,r),et(t,i,r),et(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var nt=Math.PI/180,rt=180/Math.PI,it=.96422,ot=1,at=.82521,st=4/29,lt=6/29,ut=3*lt*lt,ct=lt*lt*lt;function ht(t){if(t instanceof ft)return new ft(t.l,t.a,t.b,t.opacity);if(t instanceof mt){if(isNaN(t.h))return new ft(t.l,0,0,t.opacity);var e=t.h*nt;return new ft(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof Q||(t=z(t));var n,r,i=gt(t.r),o=gt(t.g),a=gt(t.b),s=pt((.2225045*i+.7168786*o+.0606169*a)/ot);return i===o&&o===a?n=r=s:(n=pt((.4360747*i+.3850649*o+.1430804*a)/it),r=pt((.0139322*i+.0971045*o+.7141733*a)/at)),new ft(116*s-16,500*(n-s),200*(s-r),t.opacity)}function ft(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function pt(t){return t>ct?Math.pow(t,1/3):t/ut+st}function dt(t){return t>lt?t*t*t:ut*(t-st)}function yt(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function gt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function mt(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}D(ft,function(t,e,n,r){return 1===arguments.length?ht(t):new ft(t,e,n,null==r?1:r)},T(R,{brighter:function(t){return new ft(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new ft(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new Q(yt(3.1338561*(e=it*dt(e))-1.6168667*(t=ot*dt(t))-.4906146*(n=at*dt(n))),yt(-.9787684*e+1.9161415*t+.033454*n),yt(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),D(mt,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof mt)return new mt(t.h,t.c,t.l,t.opacity);if(t instanceof ft||(t=ht(t)),0===t.a&&0===t.b)return new mt(NaN,0,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*rt;return new mt(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new mt(t,e,n,null==r?1:r)},T(R,{brighter:function(t){return new mt(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new mt(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return ht(this).rgb()}}));var wt=-.14861,bt=1.78277,vt=-.29227,Nt=-.90649,St=1.97294,kt=St*Nt,xt=St*bt,Mt=bt*vt-Nt*wt;function Et(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function _t(t){return function(){return t}}function At(t){return 1==(t=+t)?It:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):_t(isNaN(e)?n:e)}}function It(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):_t(isNaN(t)?e:t)}D(Et,function(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Et)return new Et(t.h,t.s,t.l,t.opacity);t instanceof Q||(t=z(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(Mt*r+kt*e-xt*n)/(Mt+kt-xt),o=r-i,a=(St*(n-i)-vt*o)/Nt,s=Math.sqrt(a*a+o*o)/(St*i*(1-i)),l=s?Math.atan2(a,o)*rt-120:NaN;return new Et(l<0?l+360:l,s,i,t.opacity)}(t):new Et(t,e,n,null==r?1:r)},T(R,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Et(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Et(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*nt,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new Q(255*(e+n*(wt*r+bt*i)),255*(e+n*(vt*r+Nt*i)),255*(e+n*(St*r)),this.opacity)}}));var Ut=function t(e){var n=At(e);function r(t,e){var r=n((t=G(t)).r,(e=G(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=It(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function Dt(t,e){return e-=t=+t,function(n){return t+e*n}}var Tt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Rt=new RegExp(Tt.source,"g");function Pt(t,e){var n,r=typeof e;return null==e||"boolean"===r?_t(e):("number"===r?Dt:"string"===r?(n=Y(e))?(e=n,Ut):function(t,e){var n,r,i,o=Tt.lastIndex=Rt.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=Tt.exec(t))&&(r=Rt.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:Dt(n,r)})),o=Rt.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)s[(n=l[r]).i]=n.x(t);return s.join("")})}:e instanceof Y?Ut:e instanceof Date?function(t,e){var n=new Date;return e-=t=+t,function(r){return n.setTime(t+e*r),n}}:Array.isArray(e)?function(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(n=0;n<i;++n)o[n]=Pt(t[n],e[n]);for(;n<r;++n)a[n]=e[n];return function(t){for(n=0;n<i;++n)a[n]=o[n](t);return a}}:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?function(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Pt(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}:Dt)(t,e)}var Wt,Ft=180/Math.PI,jt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};var qt=function(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],l=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var l=a.push("translate(",null,e,null,n);s.push({i:l-4,x:Dt(t,i)},{i:l-2,x:Dt(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,l),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Dt(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,l),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Dt(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,l),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Dt(t,n)},{i:s-2,x:Dt(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(t){for(var e,n=-1,r=l.length;++n<r;)s[(e=l[n]).i]=e.x(t);return s.join("")}}}(function(t){return null==t?jt:(Wt||(Wt=document.createElementNS("http://www.w3.org/2000/svg","g")),Wt.setAttribute("transform",t),(t=Wt.transform.baseVal.consolidate())?(t=t.matrix,e=t.a,n=t.b,r=t.c,i=t.d,o=t.e,a=t.f,(s=Math.sqrt(e*e+n*n))&&(e/=s,n/=s),(u=e*r+n*i)&&(r-=e*u,i-=n*u),(l=Math.sqrt(r*r+i*i))&&(r/=l,i/=l,u/=l),e*i<n*r&&(e=-e,n=-n,u=-u,s=-s),{translateX:o,translateY:a,rotate:Math.atan2(n,e)*Ft,skewX:Math.atan(u)*Ft,scaleX:s,scaleY:l}):jt);var e,n,r,i,o,a,s,l,u},", ",")",")");Math.SQRT2;function Ot(t,e,n){return function(){const r=t?this.state[t][e]:this.state[e];if(r===n)return null;const i=function(t){return"transform"===t?qt:Pt}(e)(r,n);let o;return o=null===t?t=>{this.setState(()=>({[e]:i(t)}))}:n=>{this.setState(r=>({[t]:{...r[t],[e]:i(n)}}))}}}function Ct(t,e,n){return Ot.call(this,t,e,n)}const Xt=0,Ht=1,$t=2,Lt=3,Kt=4,Yt=5,Bt=6;function Vt(t,e,n,r,i,o={}){const a=t.TRANSITION_SCHEDULES;if(a){if(n in a)return}else t.TRANSITION_SCHEDULES={};!function(t,e,n){const r=t.TRANSITION_SCHEDULES,i={...n},o=i.tweens.length,a=new Array(o);function s(n){if(i.state!==Ht)return u();for(const t in r){const n=r[t];if(n.stateKey===i.stateKey){if(n.state===Lt)return M(s);n.state===Kt?(n.state=Bt,n.timer.stop(),n.events.interrupt&&"function"==typeof n.events.interrupt&&n.events.interrupt.call(this),delete r[t]):+t<e&&(n.state=Bt,n.timer.stop(),delete r[t])}}if(M(()=>{i.state===Lt&&(i.state=Kt,i.timer.restart(l,i.delay,i.time),l(n))}),i.state=$t,i.events.start&&"function"==typeof i.events.start&&i.events.start.call(t),i.state!==$t)return;i.state=Lt;let c=-1;for(let e=0;e<o;++e){const n=i.tweens[e].call(t);n&&(a[++c]=n)}a.length=c+1}function l(e){let n=1;e<i.duration?n=i.ease.call(null,e/i.duration):(i.timer.restart(u),i.state=Yt);let r=-1;for(;++r<a.length;)a[r].call(null,n);i.state===Yt&&(i.events.end&&"function"==typeof i.events.end&&i.events.end.call(t),u())}function u(){i.state=Bt,i.timer.stop(),delete r[e];for(const t in r)return;delete t.TRANSITION_SCHEDULES}r[e]=i,i.timer=N(function(t){i.state=Ht,i.timer.restart(s,i.delay,i.time),i.delay<=t&&s(t-i.delay)},0,i.time)}(t,n,{stateKey:e,events:o,tweens:i,...r,timer:null,state:Xt})}let zt=0;const Gt={time:null,delay:0,duration:250,ease:function(t){return+t}};function Qt(t={}){const e={...t},n=e.events||{};delete e.events,Object.keys(n).forEach(t=>{if("function"!=typeof n[t])throw new Error("Event handlers must be a function");n[t]=function(t){let e=!1;return function(){e||(e=!0,t.call(this))}}(n[t])});const r=e.timing||{};delete e.timing,Object.keys(e).forEach(t=>{const i=[];if("object"==typeof e[t]&&!1===Array.isArray(e[t]))Object.keys(e[t]).forEach(n=>{const r=e[t][n];if(Array.isArray(r))1===r.length?i.push(Ct.call(this,t,n,r[0])):(this.setState(e=>({[t]:{...e[t],[n]:r[0]}})),i.push(Ct.call(this,t,n,r[1])));else if("function"==typeof r){const e=()=>{return e=>{this.setState(i=>({[t]:{...i[t],[n]:r(e)}}))}};i.push(e)}else this.setState(e=>({[t]:{...e[t],[n]:r}})),i.push(Ct.call(this,t,n,r))});else{const n=e[t];if(Array.isArray(n))1===n.length?i.push(Ct.call(this,null,t,n[0])):(this.setState(()=>({[t]:n[0]})),i.push(Ct.call(this,null,t,n[1])));else if("function"==typeof n){const e=()=>{return e=>{this.setState(()=>({[t]:n(e)}))}};i.push(e)}else this.setState(()=>({[t]:n})),i.push(Ct.call(this,null,t,n))}const o={...Gt,...r,time:w()};Vt(this,t,++zt,o,i,n)})}function Jt(t){Array.isArray(t)?t.forEach(t=>{Qt.call(this,t)}):Qt.call(this,t)}class Zt extends e.Component{constructor(...t){super(...t),r(this,"state",{nodeKeys:[],nodeHash:{},nodes:[],data:null}),r(this,"animate",()=>{const{nodeKeys:t,nodeHash:e}=this.state;if(this.unmounting)return;let n=!1;const r=[],i=t.length;for(let o=0;o<i;o++){const i=t[o],a=e[i];a.TRANSITION_SCHEDULES&&(n=!0),a.type!==U||a.TRANSITION_SCHEDULES?r.push(i):delete e[i]}n||this.interval.stop(),this.setState(()=>({nodeKeys:r,nodes:r.map(t=>e[t])}))}),r(this,"interval",null),r(this,"unmounting",!1)}static getDerivedStateFromProps(t,e){if(t.data!==e.data){const{data:n,keyAccessor:r,start:i,enter:o,update:a,leave:s}=t,{nodeKeys:l,nodeHash:u}=e,c={};for(let t=0;t<l.length;t++)c[l[t]]=t;const h={},f=[];for(let t=0;t<n.length;t++){const e=n[t],i=r(e,t);h[i]=t,f.push(i),void 0===c[i]&&(u[i]=new _(i,e,A))}for(let t=0;t<l.length;t++){const e=l[t],r=u[e];void 0!==h[e]?(r.updateData(n[h[e]]),r.updateType(I)):r.updateType(U)}const p=function(t,e,n,r){const i=[];for(let t=0;t<n.length;t++)i[t]=n[t];for(let e=0;e<t.length;e++)void 0===r[t[e]]&&i.push(t[e]);return i.sort((t,i)=>{const o=r[t],a=r[i],s=e[t],l=e[i];if(null!=o&&null!=a)return r[t]-r[i];if(null!=s&&null!=l)return e[t]-e[i];if(null!=o){for(let t=0;t<n.length;t++){const i=n[t];if(e[i]){if(o<r[i]&&l>e[i])return-1;if(o>r[i]&&l<e[i])return 1}}return 1}for(let t=0;t<n.length;t++){const i=n[t];if(e[i]){if(a<r[i]&&s>e[i])return 1;if(a>r[i]&&s<e[i])return-1}}return-1})}(l,c,f,h);for(let t=0;t<p.length;t++){const e=p[t],n=u[e],r=n.data;n.type===A?(n.setState(i(r,h[e])),Jt.call(n,o(r,h[e]))):n.type===U?Jt.call(n,s(r,c[e])):Jt.call(n,a(r,h[e]))}return{data:n,nodes:p.map(t=>u[t]),nodeHash:u,nodeKeys:p}}return null}componentDidMount(){this.startInterval()}componentDidUpdate(t){t.data===this.props.data||this.unmounting||this.startInterval()}startInterval(){var t,e,n,r,i;this.interval?this.interval.restart(this.animate):this.interval=(t=this.animate,r=new v,i=e,null==e?(r.restart(t,e,n),r):(e=+e,n=null==n?w():+n,r.restart(function o(a){a+=i,r.restart(o,i+=e,n),t(a)},e,n),r))}componentWillUnmount(){const{nodeKeys:t,nodeHash:e}=this.state;this.unmounting=!0,this.interval&&this.interval.stop(),t.forEach(t=>{(function(){const t=this.TRANSITION_SCHEDULES;t&&Object.keys(t).forEach(e=>{t[e].timer.stop()})}).call(e[t])})}render(){const t=this.props.children(this.state.nodes);return t&&n.Children.only(t)}}Zt.defaultProps={enter:()=>{},update:()=>{},leave:()=>{}},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,r=null,s=null;if("function"==typeof e.componentWillMount?n="componentWillMount":"function"==typeof e.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof e.componentWillReceiveProps?r="componentWillReceiveProps":"function"==typeof e.UNSAFE_componentWillReceiveProps&&(r="UNSAFE_componentWillReceiveProps"),"function"==typeof e.componentWillUpdate?s="componentWillUpdate":"function"==typeof e.UNSAFE_componentWillUpdate&&(s="UNSAFE_componentWillUpdate"),null!==n||null!==r||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!==r?"\n "+r:"")+(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=i,e.componentWillReceiveProps=o),"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 r=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;c.call(this,t,e,r)}}}(Zt);const te=()=>"$$key$$";function ee(t){const{show:e,start:r,enter:i,update:o,leave:a,children:s}=t,l="function"==typeof r?r():r;return n.createElement(Zt,{data:e?[l]:[],start:()=>l,keyAccessor:te,enter:"function"==typeof i?i:()=>i,update:"function"==typeof o?o:()=>o,leave:"function"==typeof a?a:()=>a},t=>{if(!t[0])return null;const e=s(t[0].state);return e&&n.Children.only(e)})}ee.defaultProps={show:!0},t.Animate=ee,t.NodeGroup=Zt,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -9,2 +9,3 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
import React, { Component } from 'react'; | ||
import { polyfill } from 'react-lifecycles-compat'; | ||
import PropTypes from 'prop-types'; | ||
@@ -254,2 +255,3 @@ import { interval } from 'd3-timer'; | ||
}; | ||
polyfill(NodeGroup); | ||
export default NodeGroup; |
@@ -10,2 +10,4 @@ "use strict"; | ||
var _reactLifecyclesCompat = require("react-lifecycles-compat"); | ||
var _propTypes = _interopRequireDefault(require("prop-types")); | ||
@@ -284,3 +286,4 @@ | ||
}; | ||
(0, _reactLifecyclesCompat.polyfill)(NodeGroup); | ||
var _default = NodeGroup; | ||
exports.default = _default; |
{ | ||
"name": "react-move", | ||
"version": "2.9.0", | ||
"version": "2.9.1", | ||
"contributors": [ | ||
@@ -40,3 +40,3 @@ { | ||
"peerDependencies": { | ||
"react": "^16.3.0" | ||
"react": "^15.4.0 || ^16.0.0" | ||
}, | ||
@@ -47,4 +47,5 @@ "dependencies": { | ||
"d3-timer": "^1.0.9", | ||
"prop-types": "^15.6.2" | ||
"prop-types": "^15.6.2", | ||
"react-lifecycles-compat": "^3.0.4" | ||
} | ||
} |
@@ -36,2 +36,4 @@ <div style="text-align:center;"> | ||
* [CodeSandbox - Animated Bars](https://codesandbox.io/s/w0ol90x9z5) ([@animateddata](https://github.com/animateddata)) | ||
* [CodeSandbox - Collapsible Tree](https://codesandbox.io/s/ww0xkyqonk) ([@techniq](https://github.com/techniq)) | ||
* [CodeSandbox - Draggable List](https://codesandbox.io/s/j2povnz8ly) | ||
@@ -38,0 +40,0 @@ * [CodeSandbox - Circle Inferno](https://codesandbox.io/s/n033m6nw00) |
Sorry, the diff of this file is too big to display
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
177231
3930
296
6
+ Addedreact-lifecycles-compat@3.0.4(transitive)