@infinityfx/lively 5.0.0-alpha.6 → 5.0.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/animate.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{jsx as t}from"react/jsx-runtime";import{createContext as n,useId as e,use as r,useRef as i,useImperativeHandle as o,useLayoutEffect as s,useEffect as a,Children as c,isValidElement as m,cloneElement as u}from"react";import d from"./core/animator.js";import l from"./core/clip.js";import{serializeTriggers as f,getLifeCycleAnimations as p,forEachTrigger as g,mergeStyles as y,getInitialStyleFromLinks as h,mergeRefs as j}from"./core/utils.js";import{LayoutGroupContext as k}from"./layout-group.js";import{registerToLayoutGroup as w,getMorphTarget as v,deleteMorphTarget as L,unregisterFromLayoutGroup as E}from"./core/state.js";const C=n("");function b({ref:n,children:b,inherit:x=!1,initial:z={},animate:A={},triggers:D={animate:["mount"]},stagger:I=.07,staggerLimit:S=10,deformCorrection:T,transition:_,morph:M,clips:O,paused:P=!1,onAnimationEnd:q}){const B=D._livelyId??"_la"+e(),F=r(C),G=r(k),H=i(0),J=i(w(G,B)),K=i(null),N=i(f(D)),Q=i(null);if(!Q.current){const t={animate:A instanceof l?A:new l(A,z)};for(const n in O)t[n]=O[n]instanceof l?O[n]:new l(O[n],z);const n=Q.current=new d({id:B,clips:t,lifeCycleAnimations:p(D),deformCorrection:T,transition:_,stagger:I,staggerLimit:S});n.register(F,x,M),n.addLinks(A)}const{current:R}=Q;return o(n,(()=>R),[]),s((()=>{if(H.current=Date.now(),R.register(F,x,M),R.addLinks(A),M){const t=K.current||v(M,B);K.current=t,t&&(R.isMounting=!0,R.transition(t),L(M,t.id),R.state="mounted",t.hide())}w(G,B),J.current&&(R.state="mounted"),document.fonts.ready.finally((()=>R.mount()));const t=()=>R.forEachTrack((t=>t.snapshot()));return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t),R.dispose(M),E(G,B)}}),[]),a((()=>{g(D,((t,n,e)=>{const r=N.current[t];n.forEach(((n,i)=>{r[i]!==n&&!1!==n&&R.play(t,Object.assign({tag:t},e[i])),r[i]=n}))}))}),[D]),a((()=>{if(!(A instanceof l||"mounted"!==R.state))for(const t in A){const n=A[t];t in R.links&&"object"!=typeof n&&R.links[t].set(n,{duration:A.duration,easing:A.easing})}}),[A]),a((()=>(q&&R.on("animationend",q),()=>{q&&R.off("animationend",q)})),[q]),a((()=>R.setPlayState(P)),[P]),t(C,{value:B,children:c.map(b,((t,n)=>{if(!m(t))return t;let{ref:e,style:r}=t.props;return r=y(r,R.mergeInitialStyles(z,J.current?"mounted":"unmounted"),h(R.links,n)),u(t,{ref:j(e||null,(t=>R.addTrack(t,n))),style:r,pathLength:"strokeDasharray"in r?1:void 0,"data-lively":B})}))})}export{C as AnimateContext,b as default};
2
+ import{jsx as t}from"react/jsx-runtime";import{createContext as n,useId as e,use as r,useRef as i,useImperativeHandle as o,useLayoutEffect as a,useEffect as s,Children as c,isValidElement as d,cloneElement as m}from"react";import u from"./core/animator.js";import l from"./core/clip.js";import{serializeTriggers as f,getLifeCycleAnimations as p,forEachTrigger as g,mergeStyles as y,getInitialStyleFromLinks as h,mergeRefs as j}from"./core/utils.js";import{LayoutGroupContext as k}from"./layout-group.js";import{registerToLayoutGroup as w,getMorphTarget as v,deleteMorphTarget as L,unregisterFromLayoutGroup as E}from"./core/state.js";const C=n("");function b({ref:n,children:b,inherit:x=!1,initial:z={},animate:A={},triggers:D={animate:["mount"]},stagger:I=.07,staggerLimit:S=10,deformCorrection:T,transition:U,morph:_,clips:M,paused:O=!1,onAnimationEnd:P}){const q=D._livelyId??"_la"+e(),B=r(C),F=r(k),G=i(0),H=i(null),J=i(f(D)),K=i(null);if(!K.current){const t={animate:A instanceof l?A:new l(A,z)};for(const n in M)t[n]=M[n]instanceof l?M[n]:new l(M[n],z);const n=K.current=new u({id:q,clips:t,lifeCycleAnimations:p(D),deformCorrection:T,transition:U,stagger:I,staggerLimit:S});n.register(B,x,_),n.addLinks(A)}const{current:N}=K,Q=i(w(F,N.id));return o(n,(()=>N),[]),a((()=>{if(G.current=Date.now(),N.register(B,x,_),N.addLinks(A),_){const t=H.current||v(_,N.id);H.current=t,t&&(N.isMounting=!0,N.transition(t),L(_,t.id),N.state="mounted",Q.current=!0,t.delayUnmountUntil=0)}w(F,N.id),Q.current&&(N.state="mounted"),document.fonts.ready.finally((()=>N.mount()));const t=()=>N.forEachTrack((t=>t.snapshot()));return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t),N.dispose(_),E(F,N.id)}}),[]),s((()=>{g(D,((t,n,e)=>{const r=J.current[t];n.forEach(((n,i)=>{r[i]!==n&&!1!==n&&N.play(t,Object.assign({tag:t},e[i])),r[i]=n}))}))}),[D]),s((()=>{if(!(A instanceof l||"mounted"!==N.state))for(const t in A){const n=A[t];t in N.links&&"object"!=typeof n&&N.links[t].set(n,{duration:A.duration,easing:A.easing})}}),[A]),s((()=>(P&&N.on("animationend",P),()=>{P&&N.off("animationend",P)})),[P]),s((()=>N.setPlayState(O)),[O]),t(C,{value:N.id,children:c.map(b,((t,n)=>{if(!d(t))return t;let{ref:e,style:r}=t.props;return r=y(r,N.mergeInitialStyles(z,Q.current?"mounted":"unmounted"),h(N.links,n)),m(t,{ref:j(e||null,(t=>N.addTrack(t,n))),style:r,pathLength:"strokeDasharray"in r?1:void 0,"data-lively":N.id})}))})}export{C as AnimateContext,b as default};
3
3
  //# sourceMappingURL=animate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"animation-link.js","sources":["../../src/core/animation-link.ts"],"sourcesContent":[null],"names":["AnimationLink","constructor","initial","getWithIndex","this","options","duration","eventListeners","value","set","Object","assign","dispatch","get","index","on","event","callback","Set","add","delete","forEach"],"mappings":"AASc,MAAOA,EAWjB,WAAAC,CAAYC,EAAYC,GARxBC,KAAAC,QAA6B,CACzBC,SAAU,IAGdF,KAAAG,eAEI,CAAA,EAGAH,KAAKI,MAAQN,EACbE,KAAKD,aAAeA,QAAuBC,KAAKI,MACpD,CAEA,GAAAC,CAAID,EAAUH,EAA6B,IACvCD,KAAKI,MAAQA,EACbE,OAAOC,OAAOP,KAAKC,QAASA,GAE5BD,KAAKQ,SAAS,SAClB,CAEA,GAAAC,CAAIC,EAAQ,GACR,OAAOV,KAAKD,aAAaW,EAC7B,CAEA,EAAAC,CAAGC,EAA2BC,GAK1B,OAJMD,KAASZ,KAAKG,iBAAiBH,KAAKG,eAAeS,GAAS,IAAIE,KAEtEd,KAAKG,eAAeS,GAAQG,IAAIF,GAEzB,KACHb,KAAKG,eAAeS,IAAQI,OAAOH,EAAS,CAEpD,CAEA,QAAAL,CAASI,GACLZ,KAAKG,eAAeS,IAAQK,SAAQJ,GAAYA,EAASb,KAAKI,QAClE"}
1
+ {"version":3,"file":"animation-link.js","sources":["../../src/core/animation-link.ts"],"sourcesContent":[null],"names":["AnimationLink","constructor","initial","getWithIndex","this","options","duration","eventListeners","value","set","Object","assign","dispatch","get","index","on","event","callback","Set","add","delete","forEach"],"mappings":"AAUc,MAAOA,EAWjB,WAAAC,CAAYC,EAAYC,GARxBC,KAAAC,QAA6B,CACzBC,SAAU,IAGdF,KAAAG,eAEI,CAAA,EAGAH,KAAKI,MAAQN,EACbE,KAAKD,aAAeA,QAAuBC,KAAKI,MACpD,CAEA,GAAAC,CAAID,EAAUH,EAA6B,IACvCD,KAAKI,MAAQA,EACbE,OAAOC,OAAOP,KAAKC,QAASA,GAE5BD,KAAKQ,SAAS,SAClB,CAEA,GAAAC,CAAIC,EAAQ,GACR,OAAOV,KAAKD,aAAaW,EAC7B,CAEA,EAAAC,CAAGC,EAA2BC,GAK1B,OAJMD,KAASZ,KAAKG,iBAAiBH,KAAKG,eAAeS,GAAS,IAAIE,KAEtEd,KAAKG,eAAeS,GAAQG,IAAIF,GAEzB,KACHb,KAAKG,eAAeS,IAAQI,OAAOH,EAAS,CAEpD,CAEA,QAAAL,CAASI,GACLZ,KAAKG,eAAeS,IAAQK,SAAQJ,GAAYA,EAASb,KAAKI,QAClE"}
@@ -1,2 +1,2 @@
1
- import t from"./clip.js";import{registerAnimator as i,registerAsMorph as s,getParentAnimator as e,unregisterAnimator as a,deleteMorphTarget as n}from"./state.js";import h from"./track.js";import{extractAnimationLinks as r}from"./utils.js";class o{constructor({id:t,clips:i,lifeCycleAnimations:s,deformCorrection:e,transition:a,stagger:n,staggerLimit:h}){this.parent=null,this.dependents=new Set,this.inherit=[],this.links={},this.onDisposeLinks=null,this.tracks=new Set,this.trackList=[],this.initialStyles={},this.eventListeners={},this.state="unmounted",this.isMounting=!0,this.paused=!1,this.timeout=0,this.frame=0;const{cache:r,...o}=a||{};this.id=t,this.clips=i,this.lifeCycleAnimations=s,this.ignoreScaleDeformation=void 0!==e&&!e,this.defaultTransitionOptions=o,this.cache=r||["x","y","sx","sy","rotate","borderRadius"],this.align="object"==typeof e?e:{x:"left",y:"top"},this.stagger=n,this.staggerLimit=h,void 0===e&&this.inherit.push("ignoreScaleDeformation"),void 0===e&&this.inherit.push("align"),a||this.inherit.push("defaultTransitionOptions"),r||this.inherit.push("cache")}register(t,a,n){if(clearTimeout(this.timeout),i(this.id,this),n&&s(n,this.id),t&&!1!==a&&(this.parent=e(t,"boolean"==typeof a?0:a)),this.parent){this.parent.dependents.add(this);for(const t of this.inherit)this[t]=this.parent[t]}}mount(){"unmounted"===this.state&&this.trigger("mount"),this.state="mounted",cancelAnimationFrame(this.frame),this.tick()}dispose(t){this.onDisposeLinks?.(),cancelAnimationFrame(this.frame),this.trackList.forEach((t=>t.cache=t.snapshot())),this.state="unmounted",this.stop(),this.timeout=setTimeout((()=>{a(this.id),t&&n(t,this.id),this.parent&&this.parent.dependents.delete(this)}),1)}on(t,i){t in this.eventListeners||(this.eventListeners[t]=new Set),this.eventListeners[t].add(i)}off(t,i){this.eventListeners[t]?.delete(i)}dispatch(t,...i){this.eventListeners[t]?.forEach((t=>t(...i)))}tick(){this.paused||this.trackList.forEach((t=>{this.ignoreScaleDeformation||t.correct()})),this.frame=requestAnimationFrame(this.tick.bind(this))}addLinks(i){const[s,e]=r(i,((i,s)=>{this.forEachTrack(((e,a)=>{const n=new t({...s.options,composite:"override",[i]:s.get(a)});e.push(n)}))}));this.links=s,this.onDisposeLinks=e}addTrack(t,i){if(!(t instanceof HTMLElement||t instanceof SVGElement)||this.tracks.has(t))return;const s=new h(t,this.cache,this.align),e=this.lifeCycleAnimations.mount;this.tracks.add(t),this.trackList.splice(i,0,s),"mounted"===this.state&&e&&e.forEach((([t,i])=>s.push(this.clips[t],i)))}mergeInitialStyles(i,s){if(s in this.initialStyles)return this.initialStyles[s];const e=(this.lifeCycleAnimations.mount||[]).map((([t])=>this.clips[t])).filter((t=>!t.isEmpty));return e.length?i=t.mergeInitialStyles(e,i,"mounted"===s):this.parent&&(i=this.parent.mergeInitialStyles(i,s)),this.initialStyles[s]=i}pretime(t,i){if(t.isEmpty)return 0;const{duration:s,delay:e,iterations:a}=t.getConfig(i);return(s*a+e)/1e3+Math.max(Math.min(this.tracks.size,this.staggerLimit)-1,0)*this.stagger}trigger(t,i={}){let s=this.lifeCycleAnimations[t],e=0;return s&&s.forEach((([t,s])=>e=Math.max(this.play(t,Object.assign(s,i)),e))),e}play(t,{cascade:i="forward",delay:s=0,tag:e,...a}={}){if(this.paused||this.parent&&!e)return 0;let n="string"==typeof t?this.clips[t]:t;e&&e in this.clips&&(n=this.clips[e]),e||"string"!=typeof t||(e=t);const h=this.pretime(n,a),r=this.cascade(n,{...a,delay:"reverse"===i?s:h+s,tag:e});return this.push(n,{...a,delay:"reverse"===i?r+s:s,tag:e})}cascade(t,i){let s=0;return this.dependents.forEach((e=>{s=Math.max(s,e.play(t,i))})),s}forEachTrack(t){let i=0;for(;i<this.tracks.size;){const s=this.trackList[i];s.element.isConnected?t(s,i++):(this.tracks.delete(s.element),this.trackList.splice(i,1))}}push(t,{override:i,delay:s=0,tag:e,...a}){if(t.isEmpty)return 0;let n=0;return this.forEachTrack(((h,r)=>{i&&h.clear();const o=h.push(t,{...a,delay:s+Math.min(r,this.staggerLimit-1)*this.stagger},r===this.tracks.size-1?()=>this.dispatch("animationend",e):void 0);n=Math.max(n,o)})),n}transition(t,i=this.defaultTransitionOptions){this.paused||(this.trackList.forEach(((s,e)=>{const{cache:a}=t&&e<t.tracks.size?t.trackList[e]:{};s.transition(a,i)})),this.dispatch("transitionstart"))}setPlayState(t){this.trackList.forEach((i=>i.toggle(t))),this.paused=t,this.dependents.forEach((i=>i.setPlayState(t)))}stop(t){this.trackList.forEach((i=>i.clear(t)))}hide(){this.trackList.forEach((t=>t.element.style.visibility="hidden"))}}export{o as default};
1
+ import t from"./clip.js";import{registerAnimator as i,registerAsMorph as s,getParentAnimator as e,unregisterAnimator as a,deleteMorphTarget as n}from"./state.js";import h from"./track.js";import{extractAnimationLinks as r}from"./utils.js";class o{constructor({id:t,clips:i,lifeCycleAnimations:s,deformCorrection:e,transition:a,stagger:n,staggerLimit:h}){this.parent=null,this.dependents=new Set,this.inherit=[],this.links={},this.onDisposeLinks=null,this.tracks=new Set,this.trackList=[],this.initialStyles={},this.eventListeners={},this.state="unmounted",this.delayUnmountUntil=0,this.isMounting=!0,this.paused=!1,this.timeout=0,this.frame=0;const{cache:r,...o}=a||{};this.id=t,this.clips=i,this.lifeCycleAnimations=s,this.ignoreScaleDeformation=void 0!==e&&!e,this.defaultTransitionOptions=o,this.cache=r||["x","y","sx","sy","rotate","borderRadius"],this.align="object"==typeof e?e:{x:"left",y:"top"},this.stagger=n,this.staggerLimit=h,void 0===e&&this.inherit.push("ignoreScaleDeformation"),void 0===e&&this.inherit.push("align"),a||this.inherit.push("defaultTransitionOptions"),r||this.inherit.push("cache")}register(t,a,n){if(clearTimeout(this.timeout),i(this.id,this),n&&s(n,this.id),t&&!1!==a&&(this.parent=e(t,"boolean"==typeof a?0:a)),this.parent){this.parent.dependents.add(this);for(const t of this.inherit)this[t]=this.parent[t]}}mount(){"unmounted"===this.state&&this.trigger("mount"),this.state="mounted",cancelAnimationFrame(this.frame),this.tick()}dispose(t){this.onDisposeLinks?.(),cancelAnimationFrame(this.frame),this.trackList.forEach((t=>t.cache=t.snapshot())),this.state="unmounted",this.stop(),this.timeout=setTimeout((()=>{a(this.id),t&&n(t,this.id),this.parent&&this.parent.dependents.delete(this)}),1)}on(t,i){t in this.eventListeners||(this.eventListeners[t]=new Set),this.eventListeners[t].add(i)}off(t,i){this.eventListeners[t]?.delete(i)}dispatch(t,...i){this.eventListeners[t]?.forEach((t=>t(...i)))}tick(){this.paused||this.trackList.forEach((t=>{this.ignoreScaleDeformation||t.correct()})),this.frame=requestAnimationFrame(this.tick.bind(this))}addLinks(i){const[s,e]=r(i,((i,s)=>{this.forEachTrack(((e,a)=>{const n=new t({...s.options,composite:"override",[i]:s.get(a)});e.push(n)}))}));this.links=s,this.onDisposeLinks=e}addTrack(t,i){if(!(t instanceof HTMLElement||t instanceof SVGElement)||this.tracks.has(t))return;const s=new h(t,this.cache,this.align),e=this.lifeCycleAnimations.mount;this.tracks.add(t),this.trackList.splice(i,0,s),"mounted"===this.state&&e&&e.forEach((([t,i])=>s.push(this.clips[t],i)))}mergeInitialStyles(i,s){if(s in this.initialStyles)return this.initialStyles[s];const e=(this.lifeCycleAnimations.mount||[]).map((([t])=>this.clips[t])).filter((t=>!t.isEmpty));return e.length?i=t.mergeInitialStyles(e,i,"mounted"===s):this.parent&&(i=this.parent.mergeInitialStyles(i,s)),this.initialStyles[s]=i}pretime(t,i){if(t.isEmpty)return 0;const{duration:s,delay:e,iterations:a}=t.getConfig(i);return(s*a+e)/1e3+Math.max(Math.min(this.tracks.size,this.staggerLimit)-1,0)*this.stagger}trigger(t,i={}){let s=this.lifeCycleAnimations[t],e=0;return s&&s.forEach((([t,s])=>e=Math.max(this.play(t,Object.assign(s,i)),e))),e}play(t,{cascade:i="forward",delay:s=0,tag:e,...a}={}){if(this.paused||this.parent&&!e)return 0;let n="string"==typeof t?this.clips[t]:t;e&&e in this.clips&&(n=this.clips[e]),e||"string"!=typeof t||(e=t);const h=this.pretime(n,a),r=this.cascade(n,{...a,delay:"reverse"===i?s:h+s,tag:e});return this.push(n,{...a,delay:"reverse"===i?r+s:s,tag:e})}cascade(t,i){let s=0;return this.dependents.forEach((e=>{s=Math.max(s,e.play(t,i))})),s}forEachTrack(t){let i=0;for(;i<this.tracks.size;){const s=this.trackList[i];s.element.isConnected?t(s,i++):(this.tracks.delete(s.element),this.trackList.splice(i,1))}}push(t,{override:i,delay:s=0,tag:e,...a}){if(t.isEmpty)return 0;let n=0;return this.forEachTrack(((h,r)=>{i&&h.clear();const o=h.push(t,{...a,delay:s+Math.min(r,this.staggerLimit-1)*this.stagger},r===this.tracks.size-1?()=>this.dispatch("animationend",e):void 0);n=Math.max(n,o)})),n}transition(t,i=this.defaultTransitionOptions){!this.paused&&this.cache.length&&(this.trackList.forEach(((s,e)=>{const{cache:a}=t&&e<t.tracks.size?t.trackList[e]:{};s.transition(a,i)})),this.dispatch("transitionstart"))}setPlayState(t){this.trackList.forEach((i=>i.toggle(t))),this.paused=t,this.dependents.forEach((i=>i.setPlayState(t)))}stop(t){this.trackList.forEach((i=>i.clear(t)))}}export{o as default};
2
2
  //# sourceMappingURL=animator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"animator.js","sources":["../../src/core/animator.ts"],"sourcesContent":[null],"names":["Animator","constructor","id","clips","lifeCycleAnimations","deformCorrection","transition","stagger","staggerLimit","this","parent","dependents","Set","inherit","links","onDisposeLinks","tracks","trackList","initialStyles","eventListeners","state","isMounting","paused","timeout","frame","cache","options","ignoreScaleDeformation","undefined","defaultTransitionOptions","align","x","y","push","register","parentId","morph","clearTimeout","registerAnimator","registerAsMorph","getParentAnimator","add","key","mount","trigger","cancelAnimationFrame","tick","dispose","forEach","track","snapshot","stop","setTimeout","unregisterAnimator","deleteMorphTarget","delete","on","event","callback","off","dispatch","args","correct","requestAnimationFrame","bind","addLinks","animate","disposeLinks","extractAnimationLinks","link","forEachTrack","i","clip","Clip","composite","get","addTrack","element","index","HTMLElement","SVGElement","has","Track","animations","splice","name","mergeInitialStyles","styles","mode","map","filter","isEmpty","length","pretime","duration","delay","iterations","getConfig","Math","max","min","size","elapsed","opts","play","Object","assign","animation","cascade","tag","cascadeDelay","animator","isConnected","override","clear","added","from","setPlayState","toggle","hide","style","visibility"],"mappings":"+OAmBc,MAAOA,EAqCjB,WAAAC,EAAYC,GAAEA,EAAEC,MAAEA,EAAKC,oBAAEA,EAAmBC,iBAAEA,EAAgBC,WAAEA,EAAUC,QAAEA,EAAOC,aAAEA,IAlCrFC,KAAAC,OAA+B,KAC/BD,KAAAE,WAAiC,IAAIC,IACrCH,KAAAI,QAAyF,GAOzFJ,KAAAK,MAEI,CAAA,EACJL,KAAAM,eAAsC,KACtCN,KAAAO,OAAuB,IAAIJ,IAC3BH,KAAAQ,UAAqB,GAOrBR,KAAAS,cAGI,CAAA,EACJT,KAAAU,eAEI,CAAA,EACJV,KAAAW,MAAgD,YAChDX,KAAAY,YAAa,EACbZ,KAAAa,QAAS,EACTb,KAAAc,QAAU,EACVd,KAAAe,MAAQ,EAiBJ,MAAMC,MAAEA,KAAUC,GAAYpB,GAAc,CAAA,EAE5CG,KAAKP,GAAKA,EACVO,KAAKN,MAAQA,EACbM,KAAKL,oBAAsBA,EAC3BK,KAAKkB,4BAA8CC,IAArBvB,IAA0CA,EACxEI,KAAKoB,yBAA2BH,EAChCjB,KAAKgB,MAAQA,GAAS,CAAC,IAAK,IAAK,KAAM,KAAM,SAAU,gBACvDhB,KAAKqB,MAAoC,iBAArBzB,EAAgCA,EAAmB,CAAE0B,EAAG,OAAQC,EAAG,OACvFvB,KAAKF,QAAUA,EACfE,KAAKD,aAAeA,OAEKoB,IAArBvB,GAAgCI,KAAKI,QAAQoB,KAAK,+BAC7BL,IAArBvB,GAAgCI,KAAKI,QAAQoB,KAAK,SACjD3B,GAAYG,KAAKI,QAAQoB,KAAK,4BAC9BR,GAAOhB,KAAKI,QAAQoB,KAAK,QAClC,CAEA,QAAAC,CAASC,E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D,CAEA,IAAAY,GACI9G,KAAKQ,UAAU+B,SAAQC,GAASA,EAAM4B,QAAQ2C,MAAMC,WAAa,UACrE"}
1
+ {"version":3,"file":"animator.js","sources":["../../src/core/animator.ts"],"sourcesContent":[null],"names":["Animator","constructor","id","clips","lifeCycleAnimations","deformCorrection","transition","stagger","staggerLimit","this","parent","dependents","Set","inherit","links","onDisposeLinks","tracks","trackList","initialStyles","eventListeners","state","delayUnmountUntil","isMounting","paused","timeout","frame","cache","options","ignoreScaleDeformation","undefined","defaultTransitionOptions","align","x","y","push","register","parentId","morph","clearTimeout","registerAnimator","registerAsMorph","getParentAnimator","add","key","mount","trigger","cancelAnimationFrame","tick","dispose","forEach","track","snapshot","stop","setTimeout","unregisterAnimator","deleteMorphTarget","delete","on","event","callback","off","dispatch","args","correct","requestAnimationFrame","bind","addLinks","animate","disposeLinks","extractAnimationLinks","link","forEachTrack","i","clip","Clip","composite","get","addTrack","element","index","HTMLElement","SVGElement","has","Track","animations","splice","name","mergeInitialStyles","styles","mode","map","filter","isEmpty","length","pretime","duration","delay","iterations","getConfig","Math","max","min","size","elapsed","opts","play","Object","assign","animation","cascade","tag","cascadeDelay","animator","isConnected","override","clear","added","from","setPlayState","toggle"],"mappings":"+OAmBc,MAAOA,EAsCjB,WAAAC,EAAYC,GAAEA,EAAEC,MAAEA,EAAKC,oBAAEA,EAAmBC,iBAAEA,EAAgBC,WAAEA,EAAUC,QAAEA,EAAOC,aAAEA,IAnCrFC,KAAAC,OAA+B,KAC/BD,KAAAE,WAAiC,IAAIC,IACrCH,KAAAI,QAAyF,GAOzFJ,KAAAK,MAEI,CAAA,EACJL,KAAAM,eAAsC,KACtCN,KAAAO,OAAuB,IAAIJ,IAC3BH,KAAAQ,UAAqB,GAOrBR,KAAAS,cAGI,CAAA,EACJT,KAAAU,eAEI,CAAA,EACJV,KAAAW,MAAgD,YAChDX,KAAAY,kBAAoB,EACpBZ,KAAAa,YAAa,EACbb,KAAAc,QAAS,EACTd,KAAAe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S,eAAgBiD,QAAOjF,GAE3E0E,EAAUJ,KAAKC,IAAIG,EAASa,EAAM,IAG/Bb,CACX,CAEA,UAAAjG,CAAW+G,EAAsB1F,EAA6BlB,KAAKqB,2BAC3DrB,KAAKc,QAAWd,KAAKiB,MAAMmE,SAE/BpF,KAAKQ,UAAUgC,SAAQ,CAACC,EAAOsB,KAC3B,MAAM9C,MAAEA,GAAU2F,GAAQ7C,EAAI6C,EAAKrG,OAAOsF,KAAOe,EAAKpG,UAAUuD,GAAK,CAAA,EAErEtB,EAAM5C,WAAWoB,EAAOC,EAAQ,IAGpClB,KAAKoD,SAAS,mBAClB,CAEA,YAAAyD,CAAa/F,GACTd,KAAKQ,UAAUgC,SAAQC,GAASA,EAAMqE,OAAOhG,KAC7Cd,KAAKc,OAASA,EAEdd,KAAKE,WAAWsC,SAAQ+D,GAAYA,EAASM,aAAa/F,IAC9D,CAEA,IAAA6B,CAAKwD,GACDnG,KAAKQ,UAAUgC,SAAQC,GAASA,EAAMiE,MAAMP,IAChD"}
package/dist/core/clip.js CHANGED
@@ -1,2 +1,2 @@
1
- import{parseClipKeyframes as e}from"./utils.js";class t{constructor({duration:t=.5,delay:s=0,repeat:i=1,alternate:a=!1,reverse:r=!1,easing:n="ease",composite:o="none",...l},c={}){this.duration=t,this.delay=s,this.repeat=i,this.alternate=a,this.reverse=r,this.easing=n,this.composite=o,this.keyframes=e(l,c),this.isEmpty=!this.keyframes.length}getConfig({delay:e=0,repeat:t=this.repeat,alternate:s=this.alternate,reverse:i=this.reverse,composite:a=this.composite,commit:r=!0}){return{duration:1e3*this.duration,delay:1e3*(this.delay+e),iterations:t,direction:s?i?"alternate-reverse":"alternate":i?"reverse":"normal",easing:this.easing,composite:"combine"===a?"accumulate":"replace",blendmode:a,commit:r}}static mergeInitialStyles(e,t,s=!1){const i={backfaceVisibility:"hidden",willChange:"transform"};for(const t of e){const e=s!==t.reverse?t.keyframes.length-1:0,{offset:a,...r}=t.keyframes[e];Object.assign(i,r)}return Object.assign(i,t)}}export{t as default};
1
+ import{parseClipKeyframes as e}from"./utils.js";class t{constructor({duration:t=.5,delay:s=0,repeat:i=1,alternate:a=!1,reverse:r=!1,easing:n="ease",composite:o="none",...l},c={}){this.duration=t,this.delay=s,this.repeat=i,this.alternate=a,this.reverse=r,this.easing=n,this.composite=o,this.keyframes=e(l,c),this.isEmpty=!this.keyframes.length}getConfig({delay:e=0,repeat:t=this.repeat,alternate:s=this.alternate,reverse:i=this.reverse,composite:a=this.composite,commit:r=!0}){return{duration:1e3*this.duration,delay:1e3*(this.delay+e),iterations:t,direction:s?i?"alternate-reverse":"alternate":i?"reverse":"normal",easing:this.easing,composite:"combine"===a?"accumulate":"replace",fill:"both",blendmode:a,commit:r}}static mergeInitialStyles(e,t,s=!1){const i={backfaceVisibility:"hidden",willChange:"transform"};for(const t of e){const e=s!==t.reverse?t.keyframes.length-1:0,{offset:a,...r}=t.keyframes[e];Object.assign(i,r)}return Object.assign(i,t)}}export{t as default};
2
2
  //# sourceMappingURL=clip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clip.js","sources":["../../src/core/clip.ts"],"sourcesContent":[null],"names":["Clip","constructor","duration","delay","repeat","alternate","reverse","easing","composite","keyframes","initial","this","parseClipKeyframes","isEmpty","length","getConfig","commit","iterations","direction","blendmode","mergeInitialStyles","clips","styles","mounted","merged","backfaceVisibility","willChange","clip","index","offset","Object","assign"],"mappings":"gDAoCc,MAAOA,EAYjB,WAAAC,EAAYC,SACRA,EAAW,GAAEC,MACbA,EAAQ,EAACC,OACTA,EAAS,EAACC,UACVA,GAAY,EAAKC,QACjBA,GAAU,EAAKC,OACfA,EAAS,OAAMC,UACfA,EAAY,UACTC,GACSC,EAAwB,IACpCC,KAAKT,SAAWA,EAChBS,KAAKR,MAAQA,EACbQ,KAAKP,OAASA,EACdO,KAAKN,UAAYA,EACjBM,KAAKL,QAAUA,EACfK,KAAKJ,OAASA,EACdI,KAAKH,UAAYA,EAEjBG,KAAKF,UAAYG,EAAmBH,EAAWC,GAC/CC,KAAKE,SAAWF,KAAKF,UAAUK,MACnC,CAEA,SAAAC,EAAUZ,MACNA,EAAQ,EAACC,OACTA,EAASO,KAAKP,OAAMC,UACpBA,EAAYM,KAAKN,UAASC,QAC1BA,EAAUK,KAAKL,QAAOE,UACtBA,EAAYG,KAAKH,UAASQ,OAC1BA,GAAS,IAGT,MAAO,CACHd,SAA0B,IAAhBS,KAAKT,SACfC,MAA8B,KAAtBQ,KAAKR,MAAQA,GACrBc,WAAYb,EACZc,UAAWb,EACNC,EAAU,oBAA+B,YACzCA,EAAU,UAAqB,SACpCC,OAAQI,KAAKJ,OACbC,UAAyB,YAAdA,EAA0B,aAAwB,UAE7DW,UAAWX,EACXQ,SAER,CAEA,yBAAOI,CAAmBC,EAAeC,EAAsBC,GAAU,GACrE,MAAMC,EAAS,CACXC,mBAAoB,SACpBC,WAAY,aAGhB,IAAK,MAAMC,KAAQN,EAAO,CACtB,MAAMO,EAAQL,IAAYI,EAAKrB,QAAUqB,EAAKlB,UAAUK,OAAS,EAAI,GAC/De,OAAEA,KAAWP,GAAWK,EAAKlB,UAAUmB,GAC7CE,OAAOC,OAAOP,EAAQF,EAC1B,CAEA,OAAOQ,OAAOC,OAAOP,EAAQF,EACjC"}
1
+ {"version":3,"file":"clip.js","sources":["../../src/core/clip.ts"],"sourcesContent":[null],"names":["Clip","constructor","duration","delay","repeat","alternate","reverse","easing","composite","keyframes","initial","this","parseClipKeyframes","isEmpty","length","getConfig","commit","iterations","direction","fill","blendmode","mergeInitialStyles","clips","styles","mounted","merged","backfaceVisibility","willChange","clip","index","offset","Object","assign"],"mappings":"gDAoCc,MAAOA,EAYjB,WAAAC,EAAYC,SACRA,EAAW,GAAEC,MACbA,EAAQ,EAACC,OACTA,EAAS,EAACC,UACVA,GAAY,EAAKC,QACjBA,GAAU,EAAKC,OACfA,EAAS,OAAMC,UACfA,EAAY,UACTC,GACSC,EAAwB,IACpCC,KAAKT,SAAWA,EAChBS,KAAKR,MAAQA,EACbQ,KAAKP,OAASA,EACdO,KAAKN,UAAYA,EACjBM,KAAKL,QAAUA,EACfK,KAAKJ,OAASA,EACdI,KAAKH,UAAYA,EAEjBG,KAAKF,UAAYG,EAAmBH,EAAWC,GAC/CC,KAAKE,SAAWF,KAAKF,UAAUK,MACnC,CAEA,SAAAC,EAAUZ,MACNA,EAAQ,EAACC,OACTA,EAASO,KAAKP,OAAMC,UACpBA,EAAYM,KAAKN,UAASC,QAC1BA,EAAUK,KAAKL,QAAOE,UACtBA,EAAYG,KAAKH,UAASQ,OAC1BA,GAAS,IAGT,MAAO,CACHd,SAA0B,IAAhBS,KAAKT,SACfC,MAA8B,KAAtBQ,KAAKR,MAAQA,GACrBc,WAAYb,EACZc,UAAWb,EACNC,EAAU,oBAA+B,YACzCA,EAAU,UAAqB,SACpCC,OAAQI,KAAKJ,OACbC,UAAyB,YAAdA,EAA0B,aAAwB,UAC7DW,KAAM,OACNC,UAAWZ,EACXQ,SAER,CAEA,yBAAOK,CAAmBC,EAAeC,EAAsBC,GAAU,GACrE,MAAMC,EAAS,CACXC,mBAAoB,SACpBC,WAAY,aAGhB,IAAK,MAAMC,KAAQN,EAAO,CACtB,MAAMO,EAAQL,IAAYI,EAAKtB,QAAUsB,EAAKnB,UAAUK,OAAS,EAAI,GAC/DgB,OAAEA,KAAWP,GAAWK,EAAKnB,UAAUoB,GAC7CE,OAAOC,OAAOP,EAAQF,EAC1B,CAEA,OAAOQ,OAAOC,OAAOP,EAAQF,EACjC"}
@@ -1,2 +1,2 @@
1
- import t from"./clip.js";import{clampLowerBound as e,correctForParentScale as s,scaleCorrectShadow as i,scaleCorrectRadius as n}from"./utils.js";class a{constructor(t,e,s){this.scale=[1,1],this.correctionAnimation=null,this.queue=[],this.animations=[],this.active=0,this.timeout=0,this.correctAfterEnded=!1,this.element=t,this.shouldCache=e,this.align=s,this.styles=getComputedStyle(t),this.cache=this.snapshot(),this.corrected={borderRadius:this.styles.borderRadius,boxShadow:this.styles.boxShadow}}snapshot(){const t={x:0,y:0,sx:1,sy:1};if(this.element instanceof SVGElement)return t;for(const e of this.shouldCache)t[e]=this.styles[e];const{width:e,height:s,x:i,y:n}=this.element.getBoundingClientRect();t.sx=e,t.sy=s,t.x=i+e/2,t.y=n+s/2;let a=this.element;for(;a=a?.parentElement;)if(a.dataset.lively){const{x:e,y:s}=a.getBoundingClientRect();t.x-=e,t.y-=s;break}return t}push(t,e={},s){const{commit:i,blendmode:n,...a}=t.getConfig(e),o=this.element.animate(t.keyframes,a);return o.name=e.tag,o.blendmode=n,o.onfinish=()=>{try{i&&o.commitStyles()}catch{}finally{o.cancel(),this.advance(),s?.()}},this.active&&"none"===n?(o.pause(),this.queue.push(o),0):(this.animations.push(o),"none"===n&&this.active++,(a.duration*a.iterations+a.delay)/1e3)}advance(){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.cache=this.snapshot()),1/120),--this.active>0||(this.animations=this.animations.filter((t=>"running"===t.playState)),this.animations.push(...this.queue.splice(0,1)),this.active=this.animations.filter((t=>"none"===t.blendmode)).length,this.correctAfterEnded=!0)}transition(s=this.cache,i={}){const n=this.snapshot(),a={...i,composite:"override"},o=[1,1],h=[0,0];for(const t of this.shouldCache)switch(t){case"x":case"y":h["x"===t?0:1]=s[t]-n[t];break;case"sx":case"sy":o["sx"===t?0:1]=s[t]/e(n[t]);break;default:a[t]=[s[t],n[t]]}[new t(a),new t({...i,scale:[o.join(" "),null],translate:[h.map((t=>`${t}px`)).join(" "),null],composite:"combine"})].filter((t=>!t.isEmpty)).forEach((t=>this.push(t,{commit:!1}))),this.cache=n}clear(t){this.animations.forEach((e=>{if(!t||e.name===t){e.onfinish=null;try{e.finish()}catch{e.cancel()}}})),this.animations=this.animations.filter((t=>"running"===t.playState)),this.active=this.animations.filter((t=>"none"===t.blendmode)).length}toggle(t){this.animations.forEach((e=>e[t?"pause":"play"]()))}correct(){if(this.element instanceof SVGElement)return;const t=(/none|0px/.test(this.styles.translate)?"0 0":this.styles.translate).split(" ").map(parseFloat);if(s(this.element,t,this.align),!this.animations.length&&!this.correctAfterEnded)return;this.correctAfterEnded=!1,this.correctionAnimation?.cancel();const a=this.styles.borderRadius!==this.corrected.borderRadius?[1,1]:this.scale,o=this.styles.boxShadow!==this.corrected.boxShadow?[1,1]:this.scale,{width:h,height:c}=this.element.getBoundingClientRect();this.scale=[e(h/this.element.offsetWidth),e(c/this.element.offsetHeight)],this.corrected={borderRadius:n(this.styles.borderRadius,this.scale,a),boxShadow:i(this.styles.boxShadow,this.scale,o)},this.corrected.borderRadius===this.styles.borderRadius&&this.corrected.boxShadow===this.styles.boxShadow||(this.correctionAnimation=this.element.animate(this.corrected,{duration:0,fill:"forwards"}))}}export{a as default};
1
+ import t from"./clip.js";import{clampLowerBound as e,correctForParentScale as s,scaleCorrectShadow as i,scaleCorrectRadius as n}from"./utils.js";class a{constructor(t,e,s){this.correctionAnimation=null,this.queue=[],this.animations=[],this.active=0,this.timeout=0,this.correctAfterEnded=!1,this.element=t,this.shouldCache=e,this.align=s,this.scale=this.getScale(),this.styles=getComputedStyle(t),this.cache=this.snapshot(),this.corrected={borderRadius:this.styles.borderRadius,boxShadow:this.styles.boxShadow}}getScale(){if(this.element instanceof SVGElement)return[1,1];const{width:t,height:s}=this.element.getBoundingClientRect();return[e(t/this.element.offsetWidth),e(s/this.element.offsetHeight)]}snapshot(){const t={x:0,y:0,sx:1,sy:1};if(this.element instanceof SVGElement)return t;for(const e of this.shouldCache)t[e]=this.styles[e];const{width:e,height:s,x:i,y:n}=this.element.getBoundingClientRect();t.sx=e,t.sy=s,t.x=i+e/2,t.y=n+s/2;let a=this.element;for(;a=a?.parentElement;)if(a.dataset.lively){const{x:e,y:s}=a.getBoundingClientRect();t.x-=e,t.y-=s;break}return t}push(t,e={},s){const{commit:i,blendmode:n,...a}=t.getConfig(e),o=this.element.animate(t.keyframes,a);return o.name=e.tag,o.blendmode=n,o.onfinish=()=>{try{i&&o.commitStyles()}catch{}finally{o.cancel(),this.advance(),s?.()}},this.active&&"none"===n?(o.pause(),this.queue.push(o),0):(this.animations.push(o),"none"===n&&this.active++,(a.duration*a.iterations+a.delay)/1e3)}advance(){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.cache=this.snapshot()),1/120),--this.active>0||(this.animations=this.animations.filter((t=>"running"===t.playState)),this.animations.push(...this.queue.splice(0,1)),this.active=this.animations.filter((t=>"none"===t.blendmode)).length,this.correctAfterEnded=!0)}transition(s=this.cache,i={}){const n=this.snapshot(),a={composite:"override",...i},o=[1,1],h=[0,0];for(const t of this.shouldCache)switch(t){case"x":case"y":h["x"===t?0:1]=s[t]-n[t];break;case"sx":case"sy":o["sx"===t?0:1]=s[t]/e(n[t]);break;default:a[t]=[s[t],n[t]]}[new t(a),new t({scale:[o.join(" "),null],translate:[h.map((t=>`${t}px`)).join(" "),null],composite:"combine",...i})].filter((t=>!t.isEmpty)).forEach((t=>this.push(t,{commit:!1}))),this.cache=n}clear(t){this.animations.forEach((e=>{if(!t||e.name===t){e.onfinish=null;try{e.finish()}catch{e.cancel()}}})),this.animations=this.animations.filter((t=>"running"===t.playState)),this.active=this.animations.filter((t=>"none"===t.blendmode)).length}toggle(t){this.animations.forEach((e=>e[t?"pause":"play"]()))}correct(){if(this.element instanceof SVGElement)return;const t=(/none|0px/.test(this.styles.translate)?"0 0":this.styles.translate).split(" ").map(parseFloat);if(s(this.element,t,this.align),!this.animations.length&&!this.correctAfterEnded)return;this.correctAfterEnded=!1,this.correctionAnimation?.cancel();const e=this.styles.borderRadius!==this.corrected.borderRadius?[1,1]:this.scale,a=this.styles.boxShadow!==this.corrected.boxShadow?[1,1]:this.scale;this.scale=this.getScale(),this.corrected={borderRadius:n(this.styles.borderRadius,this.scale,e),boxShadow:i(this.styles.boxShadow,this.scale,a)},this.corrected.borderRadius===this.styles.borderRadius&&this.corrected.boxShadow===this.styles.boxShadow||(this.correctionAnimation=this.element.animate(this.corrected,{duration:0,fill:"forwards"}))}}export{a as default};
2
2
  //# sourceMappingURL=track.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"track.js","sources":["../../src/core/track.ts"],"sourcesContent":[null],"names":["Track","constructor","element","shouldCache","align","this","scale","correctionAnimation","queue","animations","active","timeout","correctAfterEnded","styles","getComputedStyle","cache","snapshot","corrected","borderRadius","boxShadow","data","x","y","sx","sy","SVGElement","key","width","height","getBoundingClientRect","parent","parentElement","dataset","lively","push","clip","options","onEnded","commit","blendmode","config","getConfig","animation","animate","keyframes","name","tag","onfinish","commitStyles","cancel","advance","pause","duration","iterations","delay","clearTimeout","setTimeout","filter","playState","splice","length","transition","from","composite","translate","clampLowerBound","Clip","join","map","num","isEmpty","forEach","clear","entry","finish","toggle","paused","correct","offset","test","split","parseFloat","correctForParentScale","previousRadiusScale","previousShadowScale","offsetWidth","offsetHeight","scaleCorrectRadius","scaleCorrectShadow","fill"],"mappings":"iJA0Bc,MAAOA,EAmBjB,WAAAC,CAAYC,EAAmCC,EAAyBC,GAZxEC,KAAAC,MAAoB,CAAC,EAAG,GAKxBD,KAAAE,oBAAwC,KACxCF,KAAAG,MAA0B,GAC1BH,KAAAI,WAA+B,GAC/BJ,KAAAK,OAAS,EACTL,KAAAM,QAAU,EACVN,KAAAO,mBAAoB,EAGhBP,KAAKH,QAAUA,EACfG,KAAKF,YAAcA,EACnBE,KAAKD,MAAQA,EAEbC,KAAKQ,OAASC,iBAAiBZ,GAC/BG,KAAKU,MAAQV,KAAKW,WAClBX,KAAKY,UAAY,CACbC,aAAcb,KAAKQ,OAAOK,aAC1BC,UAAWd,KAAKQ,OAAOM,UAE/B,CAEA,QAAAH,GACI,MAAMI,EAAmB,CAAEC,EAAG,EAAGC,EAAG,EAAGC,GAAI,EAAGC,GAAI,GAClD,GAAInB,KAAKH,mBAAmBuB,WAAY,OAAOL,EAG/C,IAAK,MAAMM,KAAOrB,KAAKF,YAAaiB,EAAKM,GAAOrB,KAAKQ,OAAOa,GAE5D,MAAMC,MAAEA,EAAKC,OAAEA,EAAMP,EAAEA,E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EAAS,QAAU,WACtE,CAEA,OAAAC,GACI,GAAIxE,KAAKH,mBAAmBuB,WAAY,OAExC,MAAMqD,GAAe,WAAWC,KAAK1E,KAAKQ,OAAOmD,WAAa,MAAQ3D,KAAKQ,OAAOmD,WAAWgB,MAAM,KAAKZ,IAAIa,YAG5G,GAFAC,EAAsB7E,KAAKH,QAAS4E,EAAQzE,KAAKD,QAE5CC,KAAKI,WAAWmD,SAAWvD,KAAKO,kBAAmB,OACxDP,KAAKO,mBAAoB,EAEzBP,KAAKE,qBAAqB0C,SAC1B,MAAMkC,EAAkC9E,KAAKQ,OAAOK,eAAiBb,KAAKY,UAAUC,aAAe,CAAC,EAAG,GAAKb,KAAKC,MAC3G8E,EAAkC/E,KAAKQ,OAAOM,YAAcd,KAAKY,UAAUE,UAAY,CAAC,EAAG,GAAKd,KAAKC,OAErGqB,MAAEA,EAAKC,OAAEA,GAAWvB,KAAKH,QAAQ2B,wBACvCxB,KAAKC,MAAQ,CACT2D,EAAgBtC,EAAQtB,KAAKH,QAAQmF,aACrCpB,EAAgBrC,EAASvB,KAAKH,QAAQoF,eAG1CjF,KAAKY,UAAY,CACbC,aAAcqE,EAAmBlF,KAAKQ,OAAOK,aAAcb,KAAKC,MAAO6E,GACvEhE,UAAWqE,EAAmBnF,KAAKQ,OAAOM,UAAWd,KAAKC,MAAO8E,IAGjE/E,KAAKY,UAAUC,eAAiBb,KAAKQ,OAAOK,cAC5Cb,KAAKY,UAAUE,YAAcd,KAAKQ,OAAOM,YAAWd,KAAKE,oBAAsBF,KAAKH,QAAQyC,QAAQtC,KAAKY,UAAW,CAChHmC,SAAU,EACVqC,KAAM,aAElB"}
1
+ {"version":3,"file":"track.js","sources":["../../src/core/track.ts"],"sourcesContent":[null],"names":["Track","constructor","element","shouldCache","align","this","correctionAnimation","queue","animations","active","timeout","correctAfterEnded","scale","getScale","styles","getComputedStyle","cache","snapshot","corrected","borderRadius","boxShadow","SVGElement","width","height","getBoundingClientRect","clampLowerBound","offsetWidth","offsetHeight","data","x","y","sx","sy","key","parent","parentElement","dataset","lively","push","clip","options","onEnded","commit","blendmode","config","getConfig","animation","animate","keyframes","name","tag","onfinish","commitStyles","cancel","advance","pause","duration","iterations","delay","clearTimeout","setTimeout","filter","playState","splice","length","transition","from","composite","translate","Clip","join","map","num","isEmpty","forEach","clear","entry","finish","toggle","paused","correct","offset","test","split","parseFloat","correctForParentScale","previousRadiusScale","previousShadowScale","scaleCorrectRadius","scaleCorrectShadow","fill"],"mappings":"iJA0Bc,MAAOA,EAmBjB,WAAAC,CAAYC,EAAmCC,EAAyBC,GAPxEC,KAAAC,oBAAwC,KACxCD,KAAAE,MAA0B,GAC1BF,KAAAG,WAA+B,GAC/BH,KAAAI,OAAS,EACTJ,KAAAK,QAAU,EACVL,KAAAM,mBAAoB,EAGhBN,KAAKH,QAAUA,EACfG,KAAKF,YAAcA,EACnBE,KAAKD,MAAQA,EAEbC,KAAKO,MAAQP,KAAKQ,WAClBR,KAAKS,OAASC,iBAAiBb,GAC/BG,KAAKW,MAAQX,KAAKY,WAClBZ,KAAKa,UAAY,CACbC,aAAcd,KAAKS,OAAOK,aAC1BC,UAAWf,KAAKS,OAAOM,UAE/B,CAEA,QAAAP,GACI,GAAIR,KAAKH,mBAAmBmB,WAAY,MAAO,CAAC,EAAG,GAEnD,MAAMC,MAAEA,EAAKC,OAAEA,GAAWlB,KAAKH,QAAQsB,wBAEvC,MAAO,CACHC,EAAgBH,EAAQjB,KAAKH,QAAQwB,aACrCD,EAAgBF,EAASlB,KAAKH,QAAQyB,cAE9C,CAEA,QAAAV,GACI,MAAMW,EAAmB,CAAEC,EAAG,EAAGC,EAAG,EAAGC,GAAI,EAAGC,GAAI,GAClD,GAAI3B,KAAKH,mBAAmBmB,WAAY,OAAOO,EAG/C,IAAK,MAAMK,KAAO5B,KAAKF,YAAayB,EAAKK,GAAO5B,KAAKS,OAAOmB,GAE5D,MAAMX,MAAEA,EAAKC,OAAEA,EAAMM,EAAEA,EAACC,EAA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U,WACtE,CAEA,OAAAC,GACI,GAAI3E,KAAKH,mBAAmBmB,WAAY,OAExC,MAAM4D,GAAe,WAAWC,KAAK7E,KAAKS,OAAOsD,WAAa,MAAQ/D,KAAKS,OAAOsD,WAAWe,MAAM,KAAKZ,IAAIa,YAG5G,GAFAC,EAAsBhF,KAAKH,QAAS+E,EAAQ5E,KAAKD,QAE5CC,KAAKG,WAAWwD,SAAW3D,KAAKM,kBAAmB,OACxDN,KAAKM,mBAAoB,EAEzBN,KAAKC,qBAAqB+C,SAC1B,MAAMiC,EAAkCjF,KAAKS,OAAOK,eAAiBd,KAAKa,UAAUC,aAAe,CAAC,EAAG,GAAKd,KAAKO,MAC3G2E,EAAkClF,KAAKS,OAAOM,YAAcf,KAAKa,UAAUE,UAAY,CAAC,EAAG,GAAKf,KAAKO,MAE3GP,KAAKO,MAAQP,KAAKQ,WAElBR,KAAKa,UAAY,CACbC,aAAcqE,EAAmBnF,KAAKS,OAAOK,aAAcd,KAAKO,MAAO0E,GACvElE,UAAWqE,EAAmBpF,KAAKS,OAAOM,UAAWf,KAAKO,MAAO2E,IAGjElF,KAAKa,UAAUC,eAAiBd,KAAKS,OAAOK,cAC5Cd,KAAKa,UAAUE,YAAcf,KAAKS,OAAOM,YAAWf,KAAKC,oBAAsBD,KAAKH,QAAQ6C,QAAQ1C,KAAKa,UAAW,CAChHsC,SAAU,EACVkC,KAAM,aAElB"}
@@ -1,2 +1,2 @@
1
- import{isValidElement as t}from"react";import n from"./clip.js";import e from"./animation-link.js";import{getParentAnimator as o}from"./state.js";const r=1e-4;function s(t,n=8){const e=1/Math.pow(10,n);return isNaN(t)?e:(t<0?-1:1)*Math.max(Math.abs(t),e)}const i=t=>Array.isArray(t)?t:[t];function f(...t){return n=>{t.forEach((t=>{t&&"current"in t&&(t.current=n),t instanceof Function&&t(n)}))}}function c(...t){const n={};for(const e of t)Object.assign(n,e);return"strokeLength"in n&&(n.strokeDashoffset=2-n.strokeLength,delete n.strokeLength),"strokeDashoffset"in n&&(n.strokeDasharray=2),n}function a(t,n){for(const e in t){if("_livelyId"===e)continue;const o=[];n(e,t[e].map((t=>{const{on:n,...e}="object"==typeof t&&"on"in t?t:{on:t};return o.push(e),n})),o)}}function u(t){const n={};return a(t,((t,e)=>{n[t]=e})),n}function l(t){const n={};return a(t,((t,e,o)=>{["mount","unmount"].forEach((r=>{const s=e.indexOf(r);s<0||(r in n||(n[r]=[]),n[r].push([t,o[s]]))}))})),n}function h(t){let n,e=[],o=0;for(let s=0;s<t.length;s++){const i=t[s],f=Math.round(s/(t.length-1)/r)*r;if(null===i)continue;const c="object"!=typeof i?{offset:f,to:i}:i;"offset"in c||(c.offset=f),e.push(c);const a=c.to||c.after;n===a&&o++,n=a}return o===e.length?null:e}function p(t,n,e,o){t.has(n)||t.set(n,{offset:n});const r=t.get(n);if("strokeLength"===e)return r.strokeDashoffset=2-o;r[e]=o}function g(t,n){const o=new Map;for(const s in t){const i=t[s];if(i instanceof e)continue;const f=Array.isArray(i)?i:[i];f.length<2&&f.unshift(n[s]??null);const c=h(f);if(c)for(let{to:t,after:n,offset:e}of c)void 0!==n&&(1===e&&(e-=r),p(o,e+r,s,n)),void 0!==t&&p(o,e,s,t)}return Array.from(o.values()).sort(((t,n)=>t.offset-n.offset))}function m(t,n,e){if(/^\s*$|0px/.test(t))return t;const o=t.split(/\s*\/\s*/);return o.length<2&&(o[1]=o[0]),o.map(((t,o)=>t.split(" ").map((t=>parseFloat(t)*e[o]/n[o]+(t.match(/[^\d\.]+$/)?.[0]||"px"))).join(" "))).join("/")}function y(t,n,e){if(/^\s*$|none/.test(t))return t;const[o,r,s]=t.split(/(?<=px),\s?/)[0].split(/(?<=\))\s|\s(?=inset)/);if(!r)return"";const[i,f,c,a]=r.split(" ").map(parseFloat),u=Math.max(...e)/Math.max(...n),l=new Array(3).fill([i*e[0]/n[0],f*e[1]/n[1],c*u,a*u]);return n[0]<n[1]?(l[1][0]-=1/n[0],l[2][0]+=1/n[0]):(l[1][1]-=1/n[1],l[2][1]+=1/n[1]),l.map((t=>`${o} ${t.map((t=>`${t}px`)).join(" ")}${s?" inset":""}`)).join(", ")}function d(t,n,e){let r,i=t;for(;i=i?.parentElement;)if(i.dataset.lively){r=o(i.dataset.lively,0);break}if(!i||!r||!r.trackList.some((t=>t.animations.length||t.correctAfterEnded)))return;const{width:f,height:c}=i.getBoundingClientRect(),a=s(i.offsetWidth/f),u=s(i.offsetHeight/c),l="center"===e.x?0:(t.offsetWidth-t.offsetWidth*a)/2*("right"===e.x?1:-1),h="center"===e.y?0:(t.offsetHeight-t.offsetHeight*u)/2*("bottom"===e.y?1:-1);t.style.transform=`translate(${l-2*n[0]}px, ${h-2*n[1]}px) scale(${a}, ${u}) translate(${n[0]/a}px, ${n[1]/u}px)`}function x(n,e,o="_la"){const r=Array.isArray(n)?n:[n];for(let n=0;n<r.length;n++){if(!t(r[n]))continue;const{props:s,key:i}=r[n],f=o+(null!==i?`${i}_`:n);"object"==typeof s.triggers&&(s.triggers._livelyId=f,e.delete(f)),x(s.children,e,f)}return e}function $(n,e){const o=Array.isArray(n)?n:[n],r=[];for(let n=0;n<o.length;n++){if(!t(o[n]))continue;const{key:s}=o[n],i="_la"+(null!==s?`${s}_`:n);e.has(i)&&r.push([n,o[n]])}return r}const k={duration:0,delay:1,repeat:2,alternate:3,reverse:4,easing:5,composite:6};function j(t,o){const r={},s=[];if(!(t instanceof n))for(const n in t){let i=t[n];"object"==typeof i||n in k||(i=new e(i)),i instanceof e&&(s.push(i.on("change",(()=>o(n,i)))),r[n]=i)}return[r,()=>s.forEach((t=>t()))]}function A(t,n){const e={};for(const o in t)e[o]=t[o].get(n);return e}export{k as ClipConfigKeys,p as addKeyframeEntry,i as asArray,s as clampLowerBound,d as correctForParentScale,j as extractAnimationLinks,x as filterRemovedAnimators,a as forEachTrigger,A as getInitialStyleFromLinks,l as getLifeCycleAnimations,$ as getRemovedAnimators,r as keyframeEpsilon,f as mergeRefs,c as mergeStyles,g as parseClipKeyframes,m as scaleCorrectRadius,y as scaleCorrectShadow,u as serializeTriggers,h as transformKeyframeList};
1
+ import{isValidElement as t}from"react";import n from"./clip.js";import e from"./animation-link.js";import{getParentAnimator as o}from"./state.js";const r=1e-4;function s(t,n=8){const e=1/Math.pow(10,n);return isNaN(t)?e:(t<0?-1:1)*Math.max(Math.abs(t),e)}const i=t=>Array.isArray(t)?t:[t];function f(...t){return n=>{t.forEach((t=>{t&&"current"in t&&(t.current=n),t instanceof Function&&t(n)}))}}function c(...t){const n={};for(const e of t)Object.assign(n,e);return"strokeLength"in n&&(n.strokeDashoffset=2-n.strokeLength,delete n.strokeLength),"strokeDashoffset"in n&&(n.strokeDasharray=2),n}function a(t,n){for(const e in t){if("_livelyId"===e)continue;const o=[];n(e,t[e].map((t=>{const{on:n,...e}="object"==typeof t&&"on"in t?t:{on:t};return o.push(e),n})),o)}}function u(t){const n={};return a(t,((t,e)=>{n[t]=e})),n}function l(t){const n={};return a(t,((t,e,o)=>{["mount","unmount"].forEach((r=>{const s=e.indexOf(r);s<0||(r in n||(n[r]=[]),n[r].push([t,o[s]]))}))})),n}function h(t){let n,e=[],o=0;for(let s=0;s<t.length;s++){const i=t[s],f=Math.round(s/(t.length-1)/r)*r;if(null===i)continue;const c="object"!=typeof i?{offset:f,to:i}:i;"offset"in c||(c.offset=f),e.push(c);const a=c.to??c.after;n===a&&o++,n=a}return o===e.length?null:e}function p(t,n,e,o){t.has(n)||t.set(n,{offset:n});const r=t.get(n);if("strokeLength"===e)return r.strokeDashoffset=2-o;r[e]=o}function g(t,n){const o=new Map;for(const s in t){const i=t[s];if(i instanceof e)continue;const f=Array.isArray(i)?i:[i];f.length<2&&f.unshift(n[s]??null);const c=h(f);if(c)for(let{to:t,after:n,offset:e}of c)void 0!==n&&(1===e&&(e-=r),p(o,e+r,s,n)),void 0!==t&&p(o,e,s,t)}return Array.from(o.values()).sort(((t,n)=>t.offset-n.offset))}function m(t,n,e){if(/^\s*$|0px/.test(t))return t;const o=t.split(/\s*\/\s*/);return o.length<2&&(o[1]=o[0]),o.map(((t,o)=>t.split(" ").map((t=>parseFloat(t)*e[o]/n[o]+(t.match(/[^\d\.]+$/)?.[0]||"px"))).join(" "))).join("/")}function y(t,n,e){if(/^\s*$|none/.test(t))return t;const[o,r,s]=t.split(/(?<=px),\s?/)[0].split(/(?<=\))\s|\s(?=inset)/);if(!r)return"";const[i,f,c,a]=r.split(" ").map(parseFloat),u=Math.max(...e)/Math.max(...n),l=new Array(3).fill([i*e[0]/n[0],f*e[1]/n[1],c*u,a*u]);return n[0]<n[1]?(l[1][0]-=1/n[0],l[2][0]+=1/n[0]):(l[1][1]-=1/n[1],l[2][1]+=1/n[1]),l.map((t=>`${o} ${t.map((t=>`${t}px`)).join(" ")}${s?" inset":""}`)).join(", ")}function d(t,n,e){let r,i=t;for(;i=i?.parentElement;)if(i.dataset.lively){r=o(i.dataset.lively,0);break}if(!i||!r||!r.trackList.some((t=>t.animations.length||t.correctAfterEnded)))return;const{width:f,height:c}=i.getBoundingClientRect(),a=s(i.offsetWidth/f),u=s(i.offsetHeight/c),l="center"===e.x?0:(t.offsetWidth-t.offsetWidth*a)/2*("right"===e.x?1:-1),h="center"===e.y?0:(t.offsetHeight-t.offsetHeight*u)/2*("bottom"===e.y?1:-1);t.style.transform=`translate(${l-2*n[0]}px, ${h-2*n[1]}px) scale(${a}, ${u}) translate(${n[0]/a}px, ${n[1]/u}px)`}function x(n,e,o){const r=Array.isArray(n)?n:[n];for(let n=0;n<r.length;n++){if(!t(r[n]))continue;const{props:s,key:i}=r[n],f=o+(null!==i?`${i}_`:n);"object"==typeof s.triggers&&(s.triggers._livelyId=f,e.delete(f)),x(s.children,e,f)}return e}function $(n,e){const o=Array.isArray(n)?n:[n],r=[];for(let n=0;n<o.length;n++){if(!t(o[n]))continue;const{key:s}=o[n],i="_la"+(null!==s?`${s}_`:n);e.has(i)&&r.push([n,o[n]])}return r}const k={duration:0,delay:1,repeat:2,alternate:3,reverse:4,easing:5,composite:6};function j(t,o){const r={},s=[];if(!(t instanceof n))for(const n in t){let i=t[n];"object"==typeof i||n in k||(i=new e(i)),i instanceof e&&(s.push(i.on("change",(()=>o(n,i)))),r[n]=i)}return[r,()=>s.forEach((t=>t()))]}function A(t,n){const e={};for(const o in t)e[o]=t[o].get(n);return e}export{k as ClipConfigKeys,p as addKeyframeEntry,i as asArray,s as clampLowerBound,d as correctForParentScale,j as extractAnimationLinks,x as filterRemovedAnimators,a as forEachTrigger,A as getInitialStyleFromLinks,l as getLifeCycleAnimations,$ as getRemovedAnimators,r as keyframeEpsilon,f as mergeRefs,c as mergeStyles,g as parseClipKeyframes,m as scaleCorrectRadius,y as scaleCorrectShadow,u as serializeTriggers,h as transformKeyframeList};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../src/core/utils.ts"],"sourcesContent":[null],"names":["keyframeEpsilon","clampLowerBound","num","precision","lowerBound","Math","pow","isNaN","max","abs","asArray","value","Array","isArray","mergeRefs","refs","forEach","ref","current","Function","mergeStyles","stylesList","merged","styles","Object","assign","strokeDashoffset","strokeLength","strokeDasharray","forEachTrigger","triggers","callback","key","optionsArray","map","on","options","push","serializeTriggers","serialized","list","getLifeCycleAnimations","animations","trigger","index","indexOf","transformKeyframeList","last","keyframes","equal","i","length","offset","round","keyframe","to","after","addKeyframeEntry","prop","has","set","entry","get","parseClipKeyframes","initial","Map","AnimationLink","array","unshift","transformed","undefined","from","values","sort","a","b","scaleCorrectRadius","radius","scale","previousScale","test","split","axis","parseFloat","match","join","scaleCorrectShadow","shadow","color","params","inset","ofx","ofy","blr","spr","ratio","shadows","fill","val","correctForParentScale","element","align","animator","parent","parentElement","dataset","lively","getParentAnimator","trackList","some","track","correctAfterEnded","width","height","getBoundingClientRect","x","offsetWidth","y","offsetHeight","dx","dy","style","transform","filterRemovedAnimators","children","toRemove","prefix","isValidElement","props","id","_livelyId","delete","getRemovedAnimators","removed","animators","ClipConfigKeys","duration","delay","repeat","alternate","reverse","easing","composite","extractAnimationLinks","animate","links","callbacks","Clip","remove","getInitialStyleFromLinks"],"mappings":"kJAQO,MAAMA,EAAkB,cAEfC,EAAgBC,EAAaC,EAAY,GACrD,MAAMC,EAAa,EAAIC,KAAKC,IAAI,GAAIH,GAEpC,OAAII,MAAML,GAAaE,GAEfF,EAAM,GAAI,EAAK,GAAKG,KAAKG,IAAIH,KAAKI,IAAIP,GAAME,EACxD,CAEO,MAAMM,EAAWC,GAA6BC,MAAMC,QAAQF,GAASA,EAAQ,CAACA,GAE/E,SAAUG,KAAaC,GACzB,OAAQJ,IACJI,EAAKC,SAAQC,IACLA,GAAO,YAAaA,IAAKA,EAAIC,QAAUP,GACvCM,aAAeE,UAAUF,EAAIN,EAAM,GACzC,CAEV,CAEM,SAAUS,KAAeC,GAC3B,MAAMC,EAA8B,CAAA,EAEpC,IAAK,MAAMC,KAAUF,EAAYG,OAAOC,OAAOH,EAAQC,GAOvD,MANI,iBAAkBD,IAClBA,EAAOI,iBAAmB,EAAKJ,EAAOK,oBAC/BL,EAAOK,cAEd,qBAAsBL,IAAQA,EAAOM,gBAAkB,GAEpDN,CACX,CAEM,SAAUO,EAAiCC,EAA8BC,GAC3E,IAAK,MAAMC,KAAOF,EAAU,CACxB,GAAY,cAARE,EAAqB,SAEzB,MAAMC,EAAmC,GAUzCF,EAASC,EARIF,EAASE,GAAME,KAAIvB,IAC5B,MAAMwB,GAAEA,KAAOC,GAA6B,iBAAVzB,GAAsB,OAAQA,EAAQA,EAAQ,CAAEwB,GAAIxB,GAItF,OAFAsB,EAAaI,KAAKD,GAEXD,CAAE,IAGOF,EACxB,CACJ,CAEM,SAAUK,EAAoCR,GAChD,MAAMS,EAEF,CAAA,EAMJ,OAJAV,EAAeC,GAAU,CAACE,EAAKQ,KAC3BD,EAAWP,GAAOQ,CAAI,IAGnBD,CACX,CAEM,SAAUE,EAAyCX,GACrD,MAAMY,EAEF,CAAA,EAYJ,OAVAb,EAAeC,GAAU,CAACE,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,SAAUC,EAAyBJ,EAEtCrG,GACC,MAAMrB,EAAuB,CAAA,EAE7B,IAAK,MAAMS,KAAOiH,EACd1H,EAAOS,GAAkBiH,EAAMjH,GAAiB8B,IAAIlB,GAGxD,OAAOrB,CACX"}
1
+ {"version":3,"file":"utils.js","sources":["../../src/core/utils.ts"],"sourcesContent":[null],"names":["keyframeEpsilon","clampLowerBound","num","precision","lowerBound","Math","pow","isNaN","max","abs","asArray","value","Array","isArray","mergeRefs","refs","forEach","ref","current","Function","mergeStyles","stylesList","merged","styles","Object","assign","strokeDashoffset","strokeLength","strokeDasharray","forEachTrigger","triggers","callback","key","optionsArray","map","on","options","push","serializeTriggers","serialized","list","getLifeCycleAnimations","animations","trigger","index","indexOf","transformKeyframeList","last","keyframes","equal","i","length","offset","round","keyframe","to","after","addKeyframeEntry","prop","has","set","entry","get","parseClipKeyframes","initial","Map","AnimationLink","array","unshift","transformed","undefined","from","values","sort","a","b","scaleCorrectRadius","radius","scale","previousScale","test","split","axis","parseFloat","match","join","scaleCorrectShadow","shadow","color","params","inset","ofx","ofy","blr","spr","ratio","shadows","fill","val","correctForParentScale","element","align","animator","parent","parentElement","dataset","lively","getParentAnimator","trackList","some","track","correctAfterEnded","width","height","getBoundingClientRect","x","offsetWidth","y","offsetHeight","dx","dy","style","transform","filterRemovedAnimators","children","toRemove","prefix","isValidElement","props","id","_livelyId","delete","getRemovedAnimators","removed","animators","ClipConfigKeys","duration","delay","repeat","alternate","reverse","easing","composite","extractAnimationLinks","animate","links","callbacks","Clip","remove","getInitialStyleFromLinks"],"mappings":"kJAQO,MAAMA,EAAkB,cAEfC,EAAgBC,EAAaC,EAAY,GACrD,MAAMC,EAAa,EAAIC,KAAKC,IAAI,GAAIH,GAEpC,OAAII,MAAML,GAAaE,GAEfF,EAAM,GAAI,EAAK,GAAKG,KAAKG,IAAIH,KAAKI,IAAIP,GAAME,EACxD,CAEO,MAAMM,EAAWC,GAA6BC,MAAMC,QAAQF,GAASA,EAAQ,CAAC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3D,MAAMlE,EAAQvD,MAAMC,QAAQ+G,GAAYA,EAAW,CAACA,GAC9CU,EAAiD,GAEvD,IAAK,IAAIpF,EAAI,EAAGA,EAAIiB,EAAMhB,OAAQD,IAAK,CACnC,IAAK6E,EAAe5D,EAAMjB,IAAK,SAE/B,MAAMlB,IAAEA,GAAQmC,EAAMjB,GAChB+E,EAAK,OAAiB,OAARjG,EAAe,GAAGA,KAASkB,GAE3CmF,EAAQ1E,IAAIsE,IAAKK,EAAUjG,KAAK,CAACa,EAAGiB,EAAMjB,IAClD,CAEA,OAAOoF,CACX,CAEO,MAAMC,EAET,CACAC,SAAU,EACVC,MAAO,EACPC,OAAQ,EACRC,UAAW,EACXC,QAAS,EACTC,OAAQ,EACRC,UAAW,GAGT,SAAUC,EAAsBC,EAA6BjH,GAC/D,MAAMkH,EAEF,CAAA,EACEC,EAA4B,GAGlC,KAAMF,aAAmBG,GACrB,IAAK,MAAMnH,KAAOgH,EAAS,CACvB,IAAIrI,EAAQqI,EAAQhH,GACC,iBAAVrB,GAAwBqB,KAAOuG,IAAiB5H,EAAQ,IAAIuD,EAAcvD,IAEjFA,aAAiBuD,IACjBgF,EAAU7G,KAAK1B,EAAMwB,GAAG,UAAU,IAAMJ,EAASC,EAAgBrB,MAEjEsI,EAAMjH,GAAkBrB,EAEhC,CAGJ,MAAO,CAACsI,EAfa,IAAMC,EAAUlI,SAAQoI,GAAUA,MAgB3D,CAEM,SAAUC,EAAyBJ,EAEtCrG,GACC,MAAMrB,EAAuB,CAAA,EAE7B,IAAK,MAAMS,KAAOiH,EACd1H,EAAOS,GAAkBiH,EAAMjH,GAAiB8B,IAAIlB,GAGxD,OAAOrB,CACX"}
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{jsx as t}from"react/jsx-runtime";import{createContext as r,useId as e,useRef as n,useState as o,useLayoutEffect as i,useEffect as a}from"react";import{filterRemovedAnimators as u,getRemovedAnimators as s}from"./core/utils.js";import{registerLayoutGroup as c,forEachAnimator as m,unregisterLayoutGroup as l}from"./core/state.js";const d=r("");function f({children:r,skipInitialMount:f=!1,mode:p="wait"}){const g="_lg"+e(),h=n(0),M=n(0),w=n(r),v=c(g,f),[x,j]=o(0),y=u(r,new Set(v.animators));if(y.size){if("sync"===p){const t=Array.isArray(r)?r.slice():[r];for(const[r,e]of s(w.current,y))t.splice(r,0,e);w.current=t}let t=0;m(y,(r=>{"mounted"===r.state&&(t=Math.max(t,r.trigger("unmount",{cascade:"reverse",composite:"override"})),t&&(r.state="unmounting",r.dispatch("unmount")))})),M.current=Math.max(M.current,Date.now()+1e3*t)}clearTimeout(h.current);const T=M.current-Date.now();return T>0?(m(v.animators,(t=>{"unmounting"!==t.state||y.has(t.id)||(t.trigger("mount",{override:!0}),t.state="mounted")})),h.current=setTimeout((()=>{w.current=r,j((t=>t+1))}),T)):"wait"===p&&(w.current=r),i((()=>{m(v.animators,(t=>{"mounted"!==t.state||t.isMounting||t.transition(),t.isMounting=!1}))}),[r]),a((()=>(v.skipInitialMount=!1,()=>{l(g),clearTimeout(h.current)})),[]),t(d,{value:g,children:w.current})}export{d as LayoutGroupContext,f as default};
2
+ import{jsx as t}from"react/jsx-runtime";import{createContext as n,useId as e,useRef as r,useState as o,useLayoutEffect as i,useEffect as a}from"react";import{filterRemovedAnimators as s,getRemovedAnimators as u}from"./core/utils.js";import{registerLayoutGroup as m,forEachAnimator as c,unregisterLayoutGroup as l}from"./core/state.js";const d=n("");function f({children:n,skipInitialMount:f=!1,mode:p="wait"}){const g="_lg"+e(),y=r(0),U=r(n),h=m(g,f),[w,M]=o(0),v=s(n,new Set(h.animators),`${g}_la_`);if(v.size){if("sync"===p){const t=Array.isArray(n)?n.slice():[n];for(const[n,e]of u(U.current,v))t.splice(n,0,e);U.current=t}c(v,(t=>{"mounted"===t.state&&(t.delayUnmountUntil=Date.now()+1e3*t.trigger("unmount",{cascade:"reverse",composite:"override"}),t.delayUnmountUntil&&(t.state="unmounting",t.dispatch("unmount")))}))}let j=0;c(h.animators,(t=>j=Math.max(j,t.delayUnmountUntil)));const x=j-Date.now();return clearTimeout(y.current),x>0?(c(h.animators,(t=>{"unmounting"!==t.state||v.has(t.id)||(t.trigger("mount",{override:!0}),t.state="mounted")})),y.current=setTimeout((()=>{U.current=n,M((t=>t+1))}),x)):"wait"===p&&(U.current=n),i((()=>{c(h.animators,(t=>{"mounted"!==t.state||t.isMounting||t.transition(),t.isMounting=!1}))}),[n]),a((()=>(h.skipInitialMount=!1,()=>{l(g),clearTimeout(y.current)})),[]),t(d,{value:g,children:U.current})}export{d as LayoutGroupContext,f as default};
3
3
  //# sourceMappingURL=layout-group.js.map
@@ -1,7 +1,8 @@
1
- import { Easing } from "./clip";
1
+ import { BlendMode, Easing } from "./clip";
2
2
  export type TransitionOptions = {
3
3
  duration?: number;
4
4
  easing?: Easing;
5
+ composite?: BlendMode;
5
6
  };
6
7
  export type AnimationLinkEvent = 'change';
7
8
  export default class AnimationLink<T, K = T> {
@@ -41,6 +41,7 @@ export default class Animator<T extends string> {
41
41
  [key in AnimatorEvent]?: Set<(...args: any) => void>;
42
42
  };
43
43
  state: 'unmounted' | 'unmounting' | 'mounted';
44
+ delayUnmountUntil: number;
44
45
  isMounting: boolean;
45
46
  paused: boolean;
46
47
  timeout: number;
@@ -79,5 +80,4 @@ export default class Animator<T extends string> {
79
80
  transition(from?: Animator<any>, options?: TransitionOptions): void;
80
81
  setPlayState(paused: boolean): void;
81
82
  stop(animation?: T): void;
82
- hide(): void;
83
83
  }
@@ -42,6 +42,7 @@ export default class Clip {
42
42
  direction: "reverse" | "alternate" | "alternate-reverse" | "normal";
43
43
  easing: Easing;
44
44
  composite: "accumulate" | "replace";
45
+ fill: "both";
45
46
  blendmode: BlendMode;
46
47
  commit: boolean;
47
48
  };
@@ -37,6 +37,7 @@ export default class Track {
37
37
  timeout: number;
38
38
  correctAfterEnded: boolean;
39
39
  constructor(element: HTMLElement | SVGElement, shouldCache: CacheKey[], align: CorrectionAlignment);
40
+ getScale(): ScaleTuple;
40
41
  snapshot(): StyleCache;
41
42
  push(clip: Clip, options?: AnimationOptions, onEnded?: () => void): number;
42
43
  advance(): void;
@@ -27,7 +27,7 @@ export type ScaleTuple = readonly [number, number];
27
27
  export declare function scaleCorrectRadius(radius: string, scale: ScaleTuple, previousScale: ScaleTuple): string;
28
28
  export declare function scaleCorrectShadow(shadow: string, scale: ScaleTuple, previousScale: ScaleTuple): string;
29
29
  export declare function correctForParentScale(element: HTMLElement, offset: [number, number], align: CorrectionAlignment): void;
30
- export declare function filterRemovedAnimators(children: React.ReactNode, toRemove: Set<string>, prefix?: string): Set<string>;
30
+ export declare function filterRemovedAnimators(children: React.ReactNode, toRemove: Set<string>, prefix: string): Set<string>;
31
31
  export declare function getRemovedAnimators(children: React.ReactNode, removed: Set<string>): [number, import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>][];
32
32
  export declare const ClipConfigKeys: {
33
33
  [key in keyof Required<ClipConfig>]: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infinityfx/lively",
3
- "version": "5.0.0-alpha.6",
3
+ "version": "5.0.0-alpha.8",
4
4
  "type": "module",
5
5
  "description": "Feature complete, lightweight react animation library.",
6
6
  "main": "dist/index.js",