transition-min.js revision 959c053d56a076109993a2f14094d20b1f8c0c17
YUI.add("transition-native",function(B){var H="transition:start",K="transition:end",G="transition:propertyEnd",I="-webkit-transition",L="WebkitTransition",C="-webkit-transition-property",F="-webkit-transition-duration",A="-webkit-transition-timing-function",D="-webkit-transition-delay",J="webkitTransitionEnd",E=function(){this.init.apply(this,arguments);};E._reKeywords=/^(?:node|duration|iterations|easing|delay)$/;E.useNative=false;if(I in B.config.doc.documentElement.style){E.useNative=true;E.supported=true;}B.Node.DOM_EVENTS[J]=1;E.NAME="transition";E.DEFAULT_EASING="ease-in-out";E.DEFAULT_DURATION=0.5;E.DEFAULT_DELAY=0;E.prototype={constructor:E,init:function(N,M){if(!this._running){this._node=N;this._config=M;N._transition=this;this.initAttrs(M);this._duration=("duration" in M)?M.duration:this.constructor.DEFAULT_DURATION;this._delay=("delay" in M)?M.delay:this.constructor.DEFAULT_DELAY;this._easing=M.easing||this.constructor.DEFAULT_EASING;this._count=0;this._totalDuration=0;this._running=false;}return this;},initAttrs:function(O){var N={},M;for(M in O){if(!E._reKeywords.test(M)){N[M]=O[M];}}if(N.transform&&!N["-webkit-transform"]){N["-webkit-transform"]=N.transform;delete N.transform;}this._attrs=N;},run:function(P){var O=this,N=O._attrs,M;if(!O._running){O._running=true;O._start();}O._callback=P;return O;},_start:function(){this._runNative();},_prepDur:function(M){M=parseFloat(M);if(M>this._totalDuration){this._totalDuration=M;}return M+"s";},_runNative:function(Q){var c={},W=this,V=W._node,a=V._node,Y=a.style,O=getComputedStyle(a),S=W._attrs,d="",N=O[C],P=C+": ",M=F+": ",T=A+": ",b=D+": ",Z,e,X,R,U;if(N!=="all"){P+=N+",";M+=O[F]+",";T+=O[A]+",";b+=O[D]+",";}for(U in S){if(S.hasOwnProperty(U)){c[U]=S[U];Z=c[U];e=Z;W._count++;if(typeof Z.value!=="undefined"){e=Z.value;}if(typeof e==="function"){e=e.call(V,V);}X=(typeof Z.duration!=="undefined")?Z.duration:W._duration;R=(typeof Z.delay!=="undefined")?Z.delay:W._delay;if(!X){X=0.00001;}M+=W._prepDur(X)+",";b+=W._prepDur(R)+",";T+=(Z.easing||W._easing)+",";P+=U+",";d+=U+": "+e+"; ";}}P=P.replace(/,$/,";");M=M.replace(/,$/,";");T=T.replace(/,$/,";");b=b.replace(/,$/,";");if(!W._hasEndEvent){V.on(J,this._onNativeEnd,this);W._hasEndEvent=true;}Y.cssText+=P+M+T+b+d;},_onNativeEnd:function(P){var N=P._event,O=this,M=O._node;O._count--;if(O._count<=0){M._node.style[L]="";O._running=false;if(O._callback){O._callback.call(M,{elapsedTime:N.elapsedTime});O._callback=null;}}},destroy:function(){this.detachAll();this._node=null;}};B.Transition=E;B.TransitionNative=E;B.Node.prototype.transition=function(M,O){var N=this._transition;if(N&&!N._running){N.init(this,M);}else{N=new E(this,M);}N.run(O);return this;};},"@VERSION@",{requires:["node-base"]});YUI.add("transition-timer",function(D){var E="transition:start",C="transition:end",A="transition:propertyEnd",B=D.Transition;D.mix(B.prototype,{_start:function(){if(B.useNative){this._runNative();}else{this._runTimer();}},_runTimer:function(){var F=this;F._initAttrs();B._running[D.stamp(F)]=F;F._startTime=new Date();B._startTimer();},_end:function(F){var G=this._duration*1000;if(F){this._runAttrs(G,G);}delete B._running[D.stamp(this)];this._running=false;this._startTime=null;},_runFrame:function(){var F=new Date()-this._startTime;this._runAttrs(F);},_runAttrs:function(J){var M=this,K=M._node,Q=B._runtimeAttrs[D.stamp(K)],I=B.behaviors,N=false,F=false,H,L,S,G,P,R,T,O;for(O in Q){if(Q[O].to){H=Q[O];R=H.duration;P=H.delay;S=J/1000;T=J;L=(O in I&&"set" in I[O])?I[O].set:B.DEFAULT_SETTER;N=(T>=R);if(T>R){T=R;}if(!M._skip[O]&&(!P||J>=P)){L(M,O,H.from,H.to,T-P,R-P,H.easing,H.unit);if(N){M._skip[O]=true;M._count--;if(!F&&M._count<=0){F=true;M._end();if(M._callback){M._callback.call(M._node,{elapsedTime:(J-P)/1000});M._callback=null;}}}}}}},_initAttrs:function(){var S={},T={},P=this._easing,N={},G=B.behaviors,U=this._attrs,V=D.stamp(this._node),M=B._runtimeAttrs[V],K,L,I,F,R,H,J;if(!M){M=B._runtimeAttrs[V]={};}for(F in U){if(U.hasOwnProperty(F)){I=U[F];K=this._duration*1000;L=this._delay*1000;if(typeof I.value!=="undefined"){K=(("duration" in I)?I.duration:this._duration)*1000;L=(("delay" in I)?I.delay:this._delay)*1000;P=I.easing||P;I=I.value;}K=K||1;K+=L;if(typeof I==="function"){I=I.call(this._node,this._node);}H=(F in G&&"get" in G[F])?G[F].get(this,F):B.DEFAULT_GETTER(this,F);var Q=B.RE_UNITS.exec(H);var O=B.RE_UNITS.exec(I);H=Q?Q[1]:H;J=O?O[1]:I;R=O?O[2]:Q?Q[2]:"";if(!R&&B.RE_DEFAULT_UNIT.test(F)){R=B.DEFAULT_UNIT;}if(!H||!J){return;}if(typeof P==="string"){if(P.indexOf("cubic-bezier")>-1){P=P.substring(13,P.length-1).split(",");}else{if(B.easings[P]){P=B.easings[P];}}}M[F]={from:H,to:J,unit:R,duration:K,delay:L,easing:P};if(K>this._totalDuration){this._totalDuration=K;}this._count++;}}this._skip={};},destroy:function(){this.detachAll();this._node=null;}},true);D.mix(D.Transition,{_runtimeAttrs:{},RE_DEFAULT_UNIT:/^width|height|top|right|bottom|left|margin.*|padding.*|border.*$/i,DEFAULT_UNIT:"px",intervalTime:20,behaviors:{left:{get:function(G,F){return D.DOM._getAttrOffset(G._node._node,F);}}},DEFAULT_SETTER:function(I,J,L,M,O,H,K,N){L=Number(L);M=Number(M);var G=I._node,F=B.cubicBezier(K,O/H);F=L+F[0]*(M-L);if(J in G._node.style||J in D.DOM.CUSTOM_STYLES){N=N||"";G.setStyle(J,F+N);}else{if(G._node.attributes[J]){G.setAttribute(J,F);}else{G.set(J,F);}}},DEFAULT_GETTER:function(H,F){var G=H._node,I="";if(F in G._node.style||F in D.DOM.CUSTOM_STYLES){I=G.getComputedStyle(F);}else{if(G._node.attributes[F]){I=G.getAttribute(F);}else{I=G.get(F);}}return I;},_startTimer:function(){if(!B._timer){B._timer=setInterval(B._runFrame,B.intervalTime);}},_stopTimer:function(){clearInterval(B._timer);B._timer=null;},_runFrame:function(){var F=true,G;for(G in B._running){if(B._running[G]._runFrame){F=false;B._running[G]._runFrame();}}if(F){B._stopTimer();}},cubicBezier:function(X,S){var b=0,L=0,a=X[0],K=X[1],Z=X[2],J=X[3],Y=1,I=0,W=Y-3*Z+3*a-b,V=3*Z-6*a+3*b,U=3*a-3*b,T=b,R=I-3*J+3*K-L,Q=3*J-6*K+3*L,P=3*K-3*L,O=L,N=(((W*S)+V)*S+U)*S+T,M=(((R*S)+Q)*S+P)*S+O;
return[N,M];},easings:{ease:[0.25,0,1,0.25],linear:[0,0,1,1],"ease-in":[0.42,0,1,1],"ease-out":[0,0,0.58,1],"ease-in-out":[0.42,0,0.58,1]},_running:{},_timer:null,RE_UNITS:/^(-?\d*\.?\d*){1}(em|ex|px|in|cm|mm|pt|pc|%)*$/},true);B.behaviors.top=B.behaviors.bottom=B.behaviors.right=B.behaviors.left;D.Transition=B;},"@VERSION@",{requires:["transition-native","node-style"]});YUI.add("transition",function(A){},"@VERSION@",{use:["transition-native","transition-timer"]});